-
Notifications
You must be signed in to change notification settings - Fork 6
feat: add session advisor and transcript rendering updates #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
84f8135
feat(agent): track context history revisions for rewrite detection
elkaix cb13eb1
feat(protocol): add advisor.status event schema
elkaix d9eb1f1
feat: add WATCHDOG advisor config discovery and schema
elkaix 26ed389
feat: add WATCHDOG multi-advisor review runtime
elkaix 5972db4
feat(rpc): expose advisor status and control over session RPC
elkaix 96cbbd7
feat(node-sdk): expose session advisor status and controls
elkaix 61ba025
feat: add /advisor slash command and status rendering
elkaix 09329d3
refactor: add TranscriptContainer with per-child render metadata
elkaix d39b5ac
refactor: migrate transcript inserts to metadata-aware API
elkaix e1de4c4
feat: stream live thinking in the activity pane, promote on completion
elkaix 00e7b01
refactor: use braille spinner frames for workflow running rows
elkaix 3d45177
docs: document the /advisor slash command
elkaix 9e9ac0f
chore: add changesets for session advisor and TUI rendering
elkaix 2404e3a
fix: address PR review findings
elkaix e07df1d
fix: preserve global compaction offsets
elkaix 98305c3
fix: align transcript separator row counts
elkaix File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@pymodel/pythinker-code-sdk": minor | ||
| --- | ||
|
|
||
| Add advisor status and control methods to the session client. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@pymodel/pythinker-code": minor | ||
| --- | ||
|
|
||
| Add a session advisor that reviews work in the background, with the /advisor command to show and control it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@pymodel/pythinker-code": patch | ||
| --- | ||
|
|
||
| Stream in-progress thinking in the activity pane and move it into the transcript when complete. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@pymodel/pythinker-code": patch | ||
| --- | ||
|
|
||
| Show running dynamic workflow rows with the same braille spinner glyphs as other loaders. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| import { formatErrorMessage, type AdvisorStatusSnapshot } from '@pymodel/pythinker-code-sdk'; | ||
| import type { SlashCommandHost } from './dispatch'; | ||
|
|
||
| const ADVISOR_STATUS_GLYPHS: Record<string, string> = { | ||
| running: '●', | ||
| paused: '○', | ||
| no_model: '○', | ||
| quota_exhausted: '✕', | ||
| error: '✕', | ||
| }; | ||
|
|
||
| const ADVISOR_STATUS_LABELS: Record<string, string> = { | ||
| running: 'running', | ||
| paused: 'off', | ||
| no_model: 'no model', | ||
| quota_exhausted: 'quota exhausted', | ||
| error: 'error', | ||
| }; | ||
|
|
||
| export async function handleAdvisorCommand(host: SlashCommandHost, args: string): Promise<void> { | ||
| const parts = args.trim().split(/\s+/u).filter(Boolean); | ||
| const verb = parts[0] ?? 'status'; | ||
| const advisorId = parts[1]; | ||
| if (parts.length > 2 || !['on', 'off', 'reload', 'status', 'toggle'].includes(verb)) { | ||
| host.showError('Usage: /advisor [on|off|status|reload|toggle] [advisor-id]'); | ||
| return; | ||
| } | ||
| if (host.session === undefined) { | ||
| host.showError('No active session.'); | ||
| return; | ||
| } | ||
|
|
||
| if (verb === 'status') { | ||
| host.showNotice('Advisor status', formatAdvisorStatuses(await host.session.advisor.status())); | ||
| return; | ||
| } | ||
| if (verb === 'reload') { | ||
| await host.session.advisor.reload(); | ||
| host.showStatus('Advisor configuration reloaded.'); | ||
| return; | ||
| } | ||
|
|
||
| const statuses = await host.session.advisor.status(); | ||
| if (advisorId !== undefined && !statuses.some((status) => status.id === advisorId)) { | ||
| host.showError( | ||
| `Unknown advisor: ${advisorId}. Run /advisor status to list configured advisors.`, | ||
| ); | ||
| return; | ||
| } | ||
| const enabled = | ||
| verb === 'toggle' | ||
| ? !( | ||
| statuses.find((status) => | ||
| advisorId === undefined ? true : status.id === advisorId, | ||
| )?.enabled ?? false | ||
| ) | ||
| : verb === 'on'; | ||
| let updatedStatuses: readonly AdvisorStatusSnapshot[]; | ||
| try { | ||
| updatedStatuses = await host.session.advisor.setEnabled(enabled, advisorId); | ||
| } catch (error) { | ||
| host.showError(formatErrorMessage(error)); | ||
| return; | ||
| } | ||
| const target = advisorId === undefined ? 'Advisor' : `Advisor ${advisorId}`; | ||
| const applied = | ||
| advisorId === undefined | ||
| ? updatedStatuses.length > 0 && | ||
| updatedStatuses.every((status) => status.enabled === enabled) | ||
| : updatedStatuses.find((status) => status.id === advisorId)?.enabled === enabled; | ||
| if (!applied) { | ||
| host.showError(`${target} remains ${enabled ? 'disabled' : 'enabled'}.`); | ||
| return; | ||
| } | ||
| host.showStatus(`${target} ${enabled ? 'enabled' : 'disabled'}.`); | ||
| } | ||
|
|
||
| function formatAdvisorStatuses(statuses: readonly AdvisorStatusSnapshot[]): string { | ||
| if (statuses.length === 0) return 'Advisor is disabled.'; | ||
| return statuses | ||
| .map((advisor) => { | ||
| const glyph = ADVISOR_STATUS_GLYPHS[advisor.status] ?? '?'; | ||
| const label = ADVISOR_STATUS_LABELS[advisor.status] ?? advisor.status; | ||
| const model = advisor.model === undefined ? '' : `\n Model: ${advisor.model}`; | ||
| const details = `\n ${advisor.notes} notes · $${advisor.costUsd.toFixed(4)} · ${advisor.failures} failures`; | ||
| const message = advisor.message === undefined ? '' : `\n ${advisor.message}`; | ||
| return `${glyph} ${advisor.name} [${label}]${advisor.enabled ? '' : ' (disabled)'}${model}${details}${message}`; | ||
| }) | ||
| .join('\n\n'); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.