@andorra-labs/code 0.1.10 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (238) hide show
  1. package/README.md +31 -205
  2. package/THIRD_PARTY_NOTICES.md +30 -0
  3. package/dist/src/agent-execution.js +50 -2
  4. package/dist/src/agent-mcp.js +5 -0
  5. package/dist/src/app-server/protocol.d.ts +9 -1
  6. package/dist/src/app-server/protocol.js +1 -1
  7. package/dist/src/app-server.d.ts +49 -1
  8. package/dist/src/app-server.js +353 -64
  9. package/dist/src/automation-service.js +1 -1
  10. package/dist/src/browser-panel-tool.d.ts +24 -3
  11. package/dist/src/browser-panel-tool.js +80 -6
  12. package/dist/src/browser-runner.js +3 -1
  13. package/dist/src/browser-session.d.ts +8 -0
  14. package/dist/src/browser-session.js +27 -1
  15. package/dist/src/browser-ui/app.js +237 -15
  16. package/dist/src/browser-ui/index.html +5 -5
  17. package/dist/src/browser-ui/style.css +110 -65
  18. package/dist/src/browser-ui/tokens.css +27 -26
  19. package/dist/src/browser-view.d.ts +16 -0
  20. package/dist/src/browser-view.js +38 -2
  21. package/dist/src/claude-provider.js +15 -2
  22. package/dist/src/cli.d.ts +2 -1
  23. package/dist/src/cli.js +175 -43
  24. package/dist/src/code-intelligence/CodeIntelligenceManager.js +1 -1
  25. package/dist/src/codex-provider.js +6 -3
  26. package/dist/src/coding-tools.d.ts +26 -1
  27. package/dist/src/coding-tools.js +104 -33
  28. package/dist/src/command-screens.js +1 -1
  29. package/dist/src/commands.js +1 -1
  30. package/dist/src/completion-gates.d.ts +42 -7
  31. package/dist/src/completion-gates.js +55 -9
  32. package/dist/src/completion.d.ts +51 -1
  33. package/dist/src/completion.js +164 -5
  34. package/dist/src/config.d.ts +1 -0
  35. package/dist/src/config.js +2 -0
  36. package/dist/src/dashboard-view.js +2 -2
  37. package/dist/src/deadline.js +4 -0
  38. package/dist/src/decision/PreparedSteps.js +1 -1
  39. package/dist/src/delegation-changes.js +19 -2
  40. package/dist/src/diff-preview.d.ts +1 -0
  41. package/dist/src/diff-preview.js +12 -3
  42. package/dist/src/engine-streams.d.ts +22 -0
  43. package/dist/src/engine-streams.js +16 -0
  44. package/dist/src/extensions.js +17 -6
  45. package/dist/src/file-read-key.d.ts +8 -0
  46. package/dist/src/file-read-key.js +12 -0
  47. package/dist/src/graph-editor-session.js +2 -1
  48. package/dist/src/graph-health.d.ts +21 -0
  49. package/dist/src/graph-health.js +46 -0
  50. package/dist/src/graph-manager-chat.d.ts +52 -3
  51. package/dist/src/graph-manager-chat.js +62 -17
  52. package/dist/src/graph-runner.js +62 -5
  53. package/dist/src/graph-server.d.ts +1 -1
  54. package/dist/src/graph-server.js +48 -27
  55. package/dist/src/graph-sync.d.ts +8 -0
  56. package/dist/src/graph-sync.js +54 -3
  57. package/dist/src/graph-tool.js +1 -1
  58. package/dist/src/graph-ui/app.js +362 -123
  59. package/dist/src/graph-ui/controls.css +95 -22
  60. package/dist/src/graph-ui/controls.js +31 -1
  61. package/dist/src/graph-ui/embed.js +62 -13
  62. package/dist/src/graph-ui/icons.js +7 -0
  63. package/dist/src/graph-ui/index.html +4 -4
  64. package/dist/src/graph-ui/manager-state.js +143 -5
  65. package/dist/src/graph-ui/manager.css +21 -20
  66. package/dist/src/graph-ui/manager.js +337 -75
  67. package/dist/src/graph-ui/model-picker.js +279 -0
  68. package/dist/src/graph-ui/provider-glyphs/alibaba-cloud.png +0 -0
  69. package/dist/src/graph-ui/provider-glyphs/anthropic.png +0 -0
  70. package/dist/src/graph-ui/provider-glyphs/aws-bedrock.png +0 -0
  71. package/dist/src/graph-ui/provider-glyphs/claude.png +0 -0
  72. package/dist/src/graph-ui/provider-glyphs/deepseek.png +0 -0
  73. package/dist/src/graph-ui/provider-glyphs/fireworks.png +0 -0
  74. package/dist/src/graph-ui/provider-glyphs/kimi.png +0 -0
  75. package/dist/src/graph-ui/provider-glyphs/minimax.png +0 -0
  76. package/dist/src/graph-ui/provider-glyphs/openai.png +0 -0
  77. package/dist/src/graph-ui/provider-glyphs/opencode.png +0 -0
  78. package/dist/src/graph-ui/provider-glyphs/openrouter.png +0 -0
  79. package/dist/src/graph-ui/provider-glyphs/xai.png +0 -0
  80. package/dist/src/graph-ui/provider-glyphs/xiaomi-mimo.png +0 -0
  81. package/dist/src/graph-ui/provider-glyphs/zai.png +0 -0
  82. package/dist/src/graph-ui/skill-picker.js +1 -1
  83. package/dist/src/graph-ui/studio-canvas.js +8 -8
  84. package/dist/src/graph-ui/studio.css +18 -15
  85. package/dist/src/graph-ui/studio.js +92 -35
  86. package/dist/src/graph-ui/style.css +122 -79
  87. package/dist/src/graph-ui/theme.js +2 -2
  88. package/dist/src/graph-ui/tokens.css +33 -29
  89. package/dist/src/graphs.d.ts +5 -2
  90. package/dist/src/graphs.js +10 -9
  91. package/dist/src/mcp.d.ts +52 -14
  92. package/dist/src/mcp.js +285 -128
  93. package/dist/src/membership-errors.d.ts +7 -1
  94. package/dist/src/membership-errors.js +9 -3
  95. package/dist/src/memory/ProjectMemory.d.ts +77 -0
  96. package/dist/src/memory/ProjectMemory.js +310 -0
  97. package/dist/src/memory/index.d.ts +1 -0
  98. package/dist/src/memory/index.js +1 -0
  99. package/dist/src/opencode-provider.js +5 -6
  100. package/dist/src/package-name.d.ts +3 -0
  101. package/dist/src/package-name.js +3 -0
  102. package/dist/src/provider-engine.js +2 -2
  103. package/dist/src/pull-requests.d.ts +42 -6
  104. package/dist/src/pull-requests.js +11 -3
  105. package/dist/src/qa/runtime/PtyManager.js +2 -1
  106. package/dist/src/react-runtime.js +137 -22
  107. package/dist/src/read-document-doc.d.ts +20 -0
  108. package/dist/src/read-document-doc.js +524 -0
  109. package/dist/src/read-document-docx.d.ts +21 -0
  110. package/dist/src/read-document-docx.js +584 -0
  111. package/dist/src/read-document-text.d.ts +29 -0
  112. package/dist/src/read-document-text.js +67 -0
  113. package/dist/src/read-document-tool.d.ts +48 -0
  114. package/dist/src/read-document-tool.js +162 -0
  115. package/dist/src/read-document.d.ts +78 -0
  116. package/dist/src/read-document.js +353 -0
  117. package/dist/src/read-image.d.ts +29 -2
  118. package/dist/src/read-image.js +42 -17
  119. package/dist/src/remote/cert.d.ts +1 -1
  120. package/dist/src/remote/cert.js +2 -7
  121. package/dist/src/remote/client.js +1 -1
  122. package/dist/src/remote/pem.d.ts +6 -0
  123. package/dist/src/remote/pem.js +11 -0
  124. package/dist/src/run-records.js +49 -10
  125. package/dist/src/runtime.d.ts +21 -0
  126. package/dist/src/runtime.js +10 -1
  127. package/dist/src/session-changes.d.ts +6 -1
  128. package/dist/src/session-changes.js +13 -5
  129. package/dist/src/sessions.d.ts +3 -1
  130. package/dist/src/sessions.js +5 -3
  131. package/dist/src/side-panel.d.ts +6 -1
  132. package/dist/src/side-panel.js +12 -10
  133. package/dist/src/sign-in-detection.d.ts +82 -0
  134. package/dist/src/sign-in-detection.js +197 -0
  135. package/dist/src/sign-in-offer.d.ts +35 -0
  136. package/dist/src/sign-in-offer.js +116 -0
  137. package/dist/src/skills/bundled/create-skill/SKILL.md +1 -1
  138. package/dist/src/skills/bundled/diagram/SKILL.md +1 -1
  139. package/dist/src/skills/bundled/graph-manager/SKILL.md +59 -7
  140. package/dist/src/skills/bundled/graph-manager/patterns.md +27 -0
  141. package/dist/src/skills/bundled/provenance.json +4 -4
  142. package/dist/src/skills/runtime-skills.d.ts +6 -0
  143. package/dist/src/skills/runtime-skills.js +16 -3
  144. package/dist/src/stall-recovery.d.ts +6 -2
  145. package/dist/src/stall-recovery.js +7 -2
  146. package/dist/src/stray-files.d.ts +14 -0
  147. package/dist/src/stray-files.js +81 -0
  148. package/dist/src/subagent-run.js +6 -1
  149. package/dist/src/terminal-ui.d.ts +1 -1
  150. package/dist/src/terminal-ui.js +11 -5
  151. package/dist/src/time-limit.d.ts +53 -0
  152. package/dist/src/time-limit.js +79 -0
  153. package/dist/src/tool-activity.js +1 -1
  154. package/dist/src/tool-schema-compatibility.d.ts +7 -2
  155. package/dist/src/tool-schema-compatibility.js +8 -4
  156. package/dist/src/tools.js +92 -7
  157. package/dist/src/transcript.d.ts +5 -0
  158. package/dist/src/transcript.js +12 -4
  159. package/dist/src/types.d.ts +8 -0
  160. package/dist/src/untracked-file-removal.d.ts +3 -0
  161. package/dist/src/untracked-file-removal.js +125 -0
  162. package/dist/src/update-check.js +1 -1
  163. package/dist/src/update.d.ts +11 -1
  164. package/dist/src/update.js +27 -5
  165. package/dist/src/usage-analytics.d.ts +3 -1
  166. package/dist/src/usage-analytics.js +16 -2
  167. package/dist/src/workspace-git-metadata.d.ts +15 -0
  168. package/dist/src/workspace-git-metadata.js +50 -1
  169. package/dist/src/workspace-instructions.js +1 -1
  170. package/package.json +6 -26
  171. package/docs/README.md +0 -36
  172. package/docs/agents/README.md +0 -62
  173. package/docs/agents/install-for-agents.md +0 -56
  174. package/docs/agents/mcp-server.md +0 -212
  175. package/docs/agents/subagent-mode.md +0 -149
  176. package/docs/concepts/README.md +0 -47
  177. package/docs/concepts/jev-actionable-routing.md +0 -113
  178. package/docs/concepts/jev-decision-thresholds.md +0 -412
  179. package/docs/concepts/jev-efficiency.md +0 -217
  180. package/docs/concepts/jev-eval-2026-11-01.md +0 -78
  181. package/docs/concepts/limits.md +0 -52
  182. package/docs/concepts/memory.md +0 -10
  183. package/docs/concepts/security.md +0 -50
  184. package/docs/concepts/workspace-instructions.md +0 -29
  185. package/docs/getting-started/README.md +0 -82
  186. package/docs/getting-started/accounts.md +0 -78
  187. package/docs/getting-started/configure-providers.md +0 -132
  188. package/docs/guides/README.md +0 -13
  189. package/docs/guides/browser.md +0 -39
  190. package/docs/guides/desktop-app.md +0 -414
  191. package/docs/guides/extensions.md +0 -102
  192. package/docs/guides/graph-builder.md +0 -116
  193. package/docs/guides/headless.md +0 -46
  194. package/docs/guides/tui.md +0 -75
  195. package/docs/guides/update.md +0 -70
  196. package/docs/guides/web-search.md +0 -51
  197. package/docs/guides/windows-code-signing.md +0 -319
  198. package/docs/llms.txt +0 -45
  199. package/docs/reference/README.md +0 -7
  200. package/docs/reference/cli.md +0 -76
  201. package/docs/reference/config.md +0 -91
  202. package/docs/reference/slash-commands.md +0 -59
  203. package/docs/superpowers/plans/2026-11-01-claude-console-sign-in.md +0 -111
  204. package/docs/superpowers/plans/2026-11-01-jev-node-opt-in.md +0 -910
  205. package/docs/superpowers/plans/2026-11-02-workflow-pane.md +0 -398
  206. package/docs/superpowers/plans/2026-11-06-graph-soft-delete.md +0 -125
  207. package/docs/superpowers/plans/2026-11-09-orchestrator-delegation.md +0 -295
  208. package/docs/superpowers/plans/2026-11-13-graph-manager-chat.md +0 -203
  209. package/docs/superpowers/plans/2026-11-14-jev-fair-use-pricing.md +0 -79
  210. package/docs/superpowers/specs/2026-10-31-work-line-summary-design.md +0 -50
  211. package/docs/superpowers/specs/2026-11-01-claude-console-sign-in-design.md +0 -176
  212. package/docs/superpowers/specs/2026-11-01-jev-node-opt-in-design.md +0 -164
  213. package/docs/superpowers/specs/2026-11-01-pr-section-design.md +0 -111
  214. package/docs/superpowers/specs/2026-11-02-workflow-pane-design.md +0 -130
  215. package/docs/superpowers/specs/2026-11-06-bundled-skills-design.md +0 -206
  216. package/docs/superpowers/specs/2026-11-09-orchestrator-delegation-design.md +0 -291
  217. package/docs/superpowers/specs/2026-11-13-graph-manager-chat-design.md +0 -182
  218. package/docs/superpowers/specs/2026-11-14-jev-fair-use-pricing-design.md +0 -156
  219. package/scripts/jev-efficiency-eval.mjs +0 -187
  220. package/scripts/jev-efficiency-live.mjs +0 -193
  221. package/scripts/zcode-engine-replay.mjs +0 -223
  222. package/tests/agent-centric-mcp-test-plan.md +0 -208
  223. package/tests/analytics-settings-test-plan.md +0 -165
  224. package/tests/browser-cli-smoke.mjs +0 -276
  225. package/tests/browser-test-plan.md +0 -280
  226. package/tests/chat-side-panel-test-plan.md +0 -309
  227. package/tests/decision-engine-test-plan.md +0 -163
  228. package/tests/default-active-jev-test-plan.md +0 -85
  229. package/tests/harness-extensions-test-plan.md +0 -113
  230. package/tests/jev-all-decisions-test-plan.md +0 -156
  231. package/tests/jev-efficiency/criteria.json +0 -158
  232. package/tests/jev-efficiency/workloads.mjs +0 -242
  233. package/tests/jev-efficiency-test-plan.md +0 -198
  234. package/tests/permissions-sandbox-probe.mjs +0 -74
  235. package/tests/permissions-test-plan.md +0 -191
  236. package/tests/product-telemetry-test-plan.md +0 -536
  237. package/tests/thinking-stream-preview-test-plan.md +0 -136
  238. package/tests/zcode-react-engine-test-plan.md +0 -396
@@ -1,50 +0,0 @@
1
- # Work line summary: what a stretch did, not how long it took
2
-
3
- Date: 2026-10-31. Status: approved and implemented in this change.
4
-
5
- ## Problem
6
-
7
- When a run's answer lands in the desktop transcript, the thoughts and tool calls that produced it
8
- fold into one gray line. That line read `Worked for` with the stretch's figure (`175.0s`) at the
9
- row's right edge. The words said only that time passed; the reader had to open the line to learn
10
- what the run did in it.
11
-
12
- ## Decision
13
-
14
- The line's words become a deterministic summary of the calls the stretch absorbed, built in the
15
- pure module `desktop/src/engine/workGroups.ts` (`workGroupLabel`). The figure stays where it was.
16
-
17
- - Calls are bucketed by canonical verb using the coding tools and their aliases from
18
- `src/tool-names.ts`: `read`, `searched`, `edited`, `wrote`, `ran`.
19
- - Reads, edits and writes count distinct files by the whole path the call named (`ToolRow.path`,
20
- carried from `toolRowParts`), never by the row's label, which is a basename with a read range or
21
- an edit count beside it. A call with no path counts as a file of its own. Searches and commands
22
- count calls.
23
- - Clauses come in the fixed order read, searched, edited, wrote, ran, then any other tool as
24
- `N <Tool> calls` in order of first use. The sentence is capitalized once at the start:
25
- `Read 3 files, searched 2 times, edited 1 file, ran 4 commands`. One search reads `searched once`.
26
- - A stretch with no calls reads `Reasoned`. A stretch nothing timed shows the same words and no
27
- figure, replacing the former bare `Worked`.
28
- - The label clips with an ellipsis so a long summary never pushes the figure off the row; the
29
- span's `title` carries the whole sentence.
30
- - Failure and in-flight signals (the accent dot, the failed row's red mark, the screen-reader
31
- announcement) are unchanged.
32
-
33
- ## Alternatives considered
34
-
35
- - A model-written one-liner after the answer lands: richer wording, but it costs tokens, arrives
36
- late, and needs journal persistence so reopened sessions show it. Rejected for now; it could
37
- replace the deterministic words later without changing where they are drawn.
38
- - Counting calls for every bucket (`Read 4 times`): simpler, but the reader wants to know what was
39
- touched, not how often the model looked.
40
-
41
- ## Out of scope
42
-
43
- The session-level `Worked for 597.0s` line under the transcript (`SessionView.tsx`) measures the
44
- whole session, not a batch, and keeps its wording.
45
-
46
- ## Testing
47
-
48
- Unit tests in `desktop/src/engine/workGroups.test.ts` cover the buckets, distinct-file counting,
49
- ordering, legacy tool names, other tools and the reasoning-only case; `Timeline.test.ts` checks the
50
- rendered head. The QA plan is `tests/desktop-work-collapse-test-plan.md` (WC-2, WC-2a, WC-2b).
@@ -1,176 +0,0 @@
1
- # Claude Console sign-in for Anthropic providers
2
-
3
- Status: approved 2026-11-01.
4
-
5
- ## Goal
6
-
7
- An `anthropic` provider can sign in with a Claude Console account in the browser instead of an API key, from
8
- the desktop settings and from `/providers` in the TUI. Requests are billed to the Console organization and
9
- workspace the user picks during sign-in. New Anthropic providers default to `claude-opus-5-5`.
10
-
11
- Out of scope: Claude Pro/Max subscription access. The Agent SDK overview says third-party products may not offer
12
- claude.ai login without Anthropic's approval, and the Client SDK has no subscription login. The existing `claude`
13
- provider type (which runs the local Claude Code CLI) keeps its behaviour; only its labels change.
14
-
15
- ## How the sign-in works
16
-
17
- The Client SDK (`@anthropic-ai/sdk`, already a dependency at 0.124.0) reads and refreshes Console logins but does
18
- not perform one. The browser login is done by the official `ant` CLI (`ant auth login`, anthropic-cli v2.4.0
19
- source: `pkg/cmd/cmd_auth.go`):
20
-
21
- - It runs PKCE against the Console, opens the browser itself, waits on a loopback callback, and also accepts a
22
- pasted code on stdin. With stdin closed it waits for the callback alone. Progress and the fallback URL go to
23
- stderr.
24
- - It writes `configs/<profile>.json` (authentication type `user_oauth`, the ant client id, scope, workspace) and
25
- `credentials/<profile>.json` (access and refresh tokens, expiry, account email, organization and workspace
26
- names) under `ANTHROPIC_CONFIG_DIR`.
27
- - Passing `--profile` always makes that profile the active one, so Andorra never passes it. Instead each provider
28
- gets its own config directory, `<andorra home>/anthropic-accounts/<provider id>/`, passed as
29
- `ANTHROPIC_CONFIG_DIR`, and logs in to that directory's `default` profile. The user's own `~/.config/anthropic`
30
- (or `%APPDATA%\Anthropic`) is never read or written.
31
-
32
- Andorra never handles the OAuth client id or the authorization code itself. It runs `ant`, then uses the SDK's
33
- `resolveCredentialsFromConfig` on the files `ant` wrote, which refreshes the access token with the stored refresh
34
- token and rewrites the credentials file atomically.
35
-
36
- ## Configuration
37
-
38
- `ProviderConfig` gains one field:
39
-
40
- ```ts
41
- /** `console`: requests use the Claude Console login stored for this provider instead of an API key. */
42
- anthropicAuth?: 'console';
43
- ```
44
-
45
- Validation (`src/config.ts`, `assertProviderCredentials`):
46
-
47
- - `anthropicAuth` is allowed only on `type: 'anthropic'`, and only with the value `'console'`.
48
- - A provider with `anthropicAuth: 'console'` may not also carry `apiKey` or `apiKeyEnv`.
49
- - Its `baseUrl` must be `https://api.anthropic.com/v1` (the Console token is only valid there).
50
- - Two console providers whose ids differ only by case are rejected, because their account directories would be one
51
- directory on Windows and macOS (the same rule Codex account slots already follow).
52
-
53
- The provider id is immutable, so the account directory never moves. Removing a provider deletes its account
54
- directory, best effort, in the same place Codex slots are retired. The app-server upsert carries `anthropicAuth`
55
- through like other fields: omitted keeps the stored value, `null` removes it.
56
-
57
- ## Engine
58
-
59
- ### `src/anthropic-console-auth.ts` (new)
60
-
61
- ```ts
62
- export interface AnthropicConsoleAuthState {
63
- state: 'signedOut' | 'starting' | 'waiting' | 'signedIn' | 'cancelled' | 'error';
64
- attemptId?: string;
65
- email?: string;
66
- organization?: string;
67
- workspace?: string;
68
- message?: string;
69
- reason?: 'unavailable' | 'timeout' | 'denied' | 'busy' | 'unverified' | 'logoutFailed';
70
- }
71
- export class AnthropicConsoleAuth {
72
- start(attemptId: string, home: string): Promise<AnthropicConsoleAuthState>;
73
- status(attemptId: string | undefined, home: string): Promise<AnthropicConsoleAuthState>;
74
- cancel(attemptId: string, home: string): Promise<AnthropicConsoleAuthState>;
75
- logout(home: string): Promise<AnthropicConsoleAuthState>;
76
- close(): Promise<void>;
77
- }
78
- export function anthropicAccountHome(providerId: string, configHome?: string): string;
79
- export function resolveAntExecutable(options?): Promise<string>;
80
- ```
81
-
82
- - `resolveAntExecutable` looks for `ANDORRA_ANT_PATH`, then `ant`/`ant.exe` on `PATH`, never a `.cmd`/`.bat`/`.ps1`
83
- shim (the rule `resolveClaudeExecutable` follows). Missing: `reason: 'unavailable'` with the install message
84
- "Install the Anthropic CLI (ant) from github.com/anthropics/anthropic-cli/releases, then try again."
85
- - `start` spawns `ant auth login --timeout 10m` with `shell: false`, `windowsHide`, stdin closed, a temporary
86
- working directory, and an environment that keeps the parent's but sets `ANTHROPIC_CONFIG_DIR` to the account
87
- directory and drops `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, `ANTHROPIC_PROFILE`, `ANTHROPIC_BASE_URL` and the
88
- federation variables. It answers `waiting` at once; the attempt finishes when the child exits. Exit 0 then a
89
- readable credentials file is `signedIn`; anything else is `error` with a fixed message. `ant`'s stdout and stderr
90
- are counted against a size cap and discarded, never forwarded, because they name the account and organization.
91
- - One attempt per account directory at a time; a second `start` answers `busy`. `cancel` kills the process tree
92
- (`taskkill /T /F` on Windows, process group elsewhere), as `runClaudeProcess` does.
93
- - `status` reads `credentials/default.json` from the account directory: signed in when it has an access token and
94
- either an unexpired `expires_at` or a refresh token. It returns email, organization and workspace names only.
95
- - `logout` deletes the account directory. A failure answers `error` with `reason: 'logoutFailed'`.
96
-
97
- ### Request headers
98
-
99
- `src/anthropic-credentials.ts` (new) exports one async helper used by inference (`createAdapter`'s `send`), the
100
- connection test (`src/provider-connection.ts`) and model discovery (`src/model-metadata.ts`):
101
-
102
- ```ts
103
- export async function providerAuthHeaders(provider: ProviderConfig, options?: { forceRefresh?: boolean }): Promise<Record<string, string>>;
104
- ```
105
-
106
- - API-key providers: exactly today's headers (`x-api-key` for Anthropic, `Authorization: Bearer` otherwise).
107
- - Console providers: reads `configs/default.json` from the account directory, sets its `credentials_path`, calls
108
- `resolveCredentialsFromConfig`, and returns `Authorization: Bearer <token>`, `anthropic-beta: oauth-2025-04-20`,
109
- and the result's extra headers (`anthropic-workspace-id`). A missing login throws
110
- "Sign in with Claude Console for provider <id>, then retry." Token values never appear in errors.
111
- - A 401 from a console provider retries the request once with `forceRefresh: true`.
112
-
113
- The existing streaming, retry, timeout and usage code is unchanged; only header construction moves into the helper.
114
-
115
- ### App-server
116
-
117
- - `providers.auth.{start,status,cancel,logout}` accept `providerType: 'anthropic'` with a required `providerId`
118
- naming a stored console provider. Like Codex sign-in, these methods are local-client only and the remote relay
119
- does not admit them.
120
- - The result reuses `AppServerProviderAuth` and adds optional `organization` and `workspace` strings, projected
121
- through the same length and control-character checks as `email`.
122
- - New capability `providers.anthropicConsole`. `AppServerProvider` exposes `anthropicAuth` so the window can show
123
- the credential row.
124
-
125
- ## Desktop
126
-
127
- - The Anthropic provider form gets a "Credential" choice: **API key** (today's fields) or **Claude Console sign-in**.
128
- Choosing sign-in hides the key fields and fixes the base URL.
129
- - A new `AnthropicConsoleSignIn` component, modelled on `CodexSignIn`, appears on a saved console provider: "Sign in
130
- with Claude Console", a waiting state with **Cancel sign-in**, then "Signed in as <email> · <organization> /
131
- <workspace>" with **Sign out** and **Refresh sign-in status**. On an unsaved draft it says to save the provider
132
- first, as a second Codex account already does.
133
- - An engine without `providers.anthropicConsole` refuses the save with "Update the Andorra CLI to use Claude
134
- Console sign-in."
135
- - Provider details show `Credential: Claude Console sign-in`.
136
-
137
- ## TUI
138
-
139
- `/providers` on an Anthropic provider gets a "Claude Console sign-in" toggle and a "Sign in with Claude Console"
140
- entry. Sign-in runs the same `AnthropicConsoleAuth.start`, prints "Opening your browser…" and waits on a loading
141
- screen that Esc cancels, then discovers models.
142
-
143
- ## Opus defaults
144
-
145
- - `defaultProviders()` and the desktop and TUI Anthropic presets use `claude-opus-5-5`.
146
- - Model discovery already reads `/v1/models`, which works with either credential.
147
-
148
- ## Labels on the existing `claude` provider
149
-
150
- Product branding may not present Andorra as Claude Code. The provider stays as it is; its labels describe the
151
- dependency instead of naming the provider after it:
152
-
153
- - Preset name "Claude Code" becomes "Claude", description "Uses your Claude Code CLI sign-in".
154
- - Type option "Claude (Claude Code sign-in)" becomes "Claude (via Claude Code CLI)".
155
-
156
- ## Errors
157
-
158
- | Situation | Shown to the user |
159
- |---|---|
160
- | `ant` not found | Install the Anthropic CLI (ant) from github.com/anthropics/anthropic-cli/releases, then try again. |
161
- | Sign-in timed out (10 min) or browser closed | Claude Console sign-in timed out. Try signing in again. |
162
- | `ant` exited non-zero | Claude Console sign-in did not complete. Try again. |
163
- | Request with no login | Sign in with Claude Console for provider <id>, then retry. |
164
- | Refresh rejected (expired refresh token) | Your Claude Console sign-in expired. Sign in again. |
165
-
166
- ## Testing
167
-
168
- - `test/anthropic-console-auth.test.ts`: a fake `ant` script (a Node file run through `ANDORRA_ANT_PATH`) that writes
169
- credentials, exits non-zero, or hangs; checks start/status/cancel/logout, busy, output never forwarded, and the
170
- environment the child gets.
171
- - `test/anthropic-credentials.test.ts`: header construction for both credential kinds, a fake credentials file,
172
- 401 retry with refresh against a local token endpoint, and no token text in errors.
173
- - Config tests for the validation rules; app-server tests for the auth methods and capability; desktop tests for the
174
- form choice and `AnthropicConsoleSignIn` states.
175
- - QA plan: `tests/claude-console-sign-in-test-plan.md`, including one real sign-in against a Console account with
176
- `ant` 2.4.0 installed.
@@ -1,164 +0,0 @@
1
- # Jev node opt-in, composer toggle, and account requirement
2
-
3
- Date: 2026-11-01
4
- Status: approved design, pending implementation plan
5
-
6
- ## Problem
7
-
8
- Today the installation-wide Jev switch (`config.jevEnabled`, set by `/jev on|off` and by the desktop's
9
- "Configure decisions" dialog) is the main control, and a node's own `jevEnabled` setting can only opt
10
- *out*:
11
-
12
- - An Agent node with no `jevEnabled` setting uses Jev (`src/graph-runner.ts`, `node.jevEnabled === false`
13
- is the only check).
14
- - A node's opt-out is honoured only for signed-in paid accounts (`decisionNodeOverrides` in
15
- `src/decision/hostedPolicy.ts`); free accounts ignore node settings entirely.
16
- - A configured local decision service (Laya or Jev at a user endpoint) runs without any account.
17
- - The desktop has no per-run control: the bundled "Default" preset (the single-node Software Engineer
18
- graph) cannot be saved, so its node setting cannot be changed, and the only alternative is the
19
- installation-wide switch buried in Settings.
20
- - `/jev` is refused during a CLI run ("unavailable during a run").
21
-
22
- ## Goals
23
-
24
- 1. **Per-node opt-in.** A node uses Jev only when it explicitly enables it. With nodes A (Jev on),
25
- B and C (no setting), turning Jev on lets only A use it; turning Jev off lets no node use it.
26
- 2. **Composer toggle.** A boolean Jev switch in the desktop chat composer.
27
- 3. **Mid-run notice.** Flipping the switch during a run saves it immediately and says it applies once
28
- the current run ends or is interrupted.
29
- 4. **Account required.** A user who is not signed in gets no Jev of any kind, hosted or local.
30
-
31
- ## Non-goals
32
-
33
- - Changing the hosted quota, the decision engine, or decision routing modes.
34
- - Rewriting saved graph snapshots.
35
- - A per-session Jev setting distinct from the installation-wide switch.
36
- - Changing the telemetry `jevEnabled` field, which keeps reporting the switch.
37
-
38
- ## Design
39
-
40
- ### 1. Effective rule
41
-
42
- An Agent node runs with an active decision manager only when all of these hold:
43
-
44
- | Condition | Source |
45
- |---|---|
46
- | Signed in | `membership.subject` |
47
- | Switch on | `config.jevEnabled !== false` |
48
- | Node opted in | `node.jevEnabled === true` |
49
- | A decision service is configured or hosted access applies | existing `hostedDecisionPolicy` resolution |
50
-
51
- Everything else runs with `{ mode: 'off', provider: 'none' }`.
52
-
53
- Changes:
54
-
55
- - **`src/decision/hostedPolicy.ts`** — a new pure `resolveDecisionConfig` returns an off configuration
56
- when `!enabled || !membership.subject`, before it considers a local `decisions` configuration. This
57
- closes the account-less local path. `hostedDecisionPolicy` uses it and returns
58
- `decisionNodeOptIn: true` in place of the paid-only `decisionNodeOverrides`.
59
- - **`src/graph-runner.ts`** — under `decisionNodeOptIn`, a node gets the run's manager only when
60
- `node.jevEnabled === true`, with no plan condition. `GraphRunOptions.decisionNodeOverrides` is
61
- renamed `decisionNodeOptIn` (`src/runtime.ts`). A direct `runGraph` caller that passes no flag keeps
62
- giving every node the manager it supplied; every production run site goes through the policy, so the
63
- flag is always set there. This keeps the ~40 decision tests that drive `runGraph` directly valid.
64
- - **`src/subagent-run.ts`** — the external subagent run builds its `DecisionManager` from
65
- `config.decisions` directly, without a sign-in check. A new `subagentDecisionConfig` keeps its
66
- existing service selection (it never defaulted to hosted Jev) and adds only the account requirement,
67
- asking for membership only when decisions would otherwise be on.
68
- - Callers (`src/cli.ts`, `src/app-server.ts`, `src/browser-runner.ts`) keep spreading
69
- `hostedDecisionPolicy(...)` and pick up `decisionNodeOptIn` with no edit.
70
-
71
- Free and paid signed-in accounts are treated alike: node opt-in applies to both.
72
-
73
- ### 2. Bundled presets opt in
74
-
75
- Presets cannot be edited, so they ship opted in, and the switch is their control:
76
-
77
- - `SOFTWARE_ENGINEER_HARNESS` (`src/membership.ts`, the desktop's single-node "Default") — set
78
- `jevEnabled: true` on `engineer` in place. It has no frozen-revision convention: the app server
79
- already serves its current definition for its one revision. Bumping it to revision 2 is avoided
80
- because the `default` id's revision lookup is shared with `DEFAULT_HARNESS`'s frozen revisions
81
- (`getGraph('default', 2)` would become ambiguous).
82
- - The Andorra preset — `getAndorraHarness()` sets `jevEnabled: true` on every Agent node of the copy it
83
- builds from `DEFAULT_HARNESS`.
84
- - `DEFAULT_HARNESS` and its frozen revisions are not touched. They are the Graph Studio template and
85
- resume snapshots; a duplicate of the template starts unticked like any new node.
86
-
87
- A resume pinned to a frozen `default` revision carries no node setting and so runs without Jev. That
88
- is accepted: the revision describes what it always described.
89
-
90
- ### 3. Saved user graphs
91
-
92
- Nodes in graphs users already saved carry no setting and therefore stop using Jev. Snapshots are not
93
- rewritten. Graph Studio makes this visible:
94
-
95
- - **`src/graph-ui/app.js`** — the per-node "Jev decisions" checkbox reads `node.jevEnabled === true`
96
- (unticked when unset). Ticking writes `true`; unticking deletes the key, so an unticked node and an
97
- old node serialize identically. The help text becomes: "Off unless ticked. When Jev is on, it assists
98
- this agent with routing decisions. Requires sign-in; quota and runtime permissions apply."
99
- - The client-side validation at `app.js:243` and server validation at `src/graphs.ts:476` are unchanged
100
- (boolean on Agent nodes).
101
-
102
- ### 4. CLI `/jev`
103
-
104
- - **`src/commands.ts`** — status and confirmation text describe the new rule:
105
- `Jev: enabled (saved preference). Applies to nodes with Jev turned on. Requires sign-in and available
106
- quota.` The free/paid wording about node settings is removed.
107
- - **`src/cli.ts`** — `/jev` joins the in-run command allowlist. During a run it saves the switch and
108
- prints `Jev <on|off> saved. The current run keeps its setting; the change applies after it ends or
109
- you interrupt it.` The status-bar `jevEnabled` updates immediately to the saved value.
110
- - **`src/account-presentation.ts`** — the signed-in notice ("Jev decisions default to enabled when
111
- signed in; use /jev to toggle.") is reworded to "Jev runs on nodes that turn it on; use /jev to
112
- toggle."
113
-
114
- ### 5. Desktop composer toggle
115
-
116
- A `JevToggle` component (new file `desktop/src/components/JevToggle.tsx`) rendered in the composer
117
- controls of both `NewTaskView.tsx` and `SessionView.tsx`, beside the model picker.
118
-
119
- - **State:** reads `config.jevEnabled` from the data store (`!== false` means on) and the account's
120
- `signedIn`. Writes with `saveConfig({ jevEnabled }, { jevEnabled: config.jevEnabled ?? null })`,
121
- the same call `DecisionSettings` uses, so the CLI, Settings and the composer always agree.
122
- - **Gated:** hidden when the host lacks the `config.decisions` capability. Disabled when signed out,
123
- with the tooltip "Sign in to use Jev."
124
- - **Mid-run:** when `running` (the existing `SessionView` selector) is true at the moment of a change,
125
- the save proceeds and the app notifies
126
- `Jev <on|off> saved. The current run keeps its setting; the change applies after it ends or you
127
- interrupt it.` No notice when idle.
128
- - **Failure:** a rejected save reverts the switch and notifies the error via `describeError`.
129
- - **Settings consistency:** `DecisionSettings`' "Off" source and the composer switch are the same
130
- setting; Settings' row note keeps describing the decision service.
131
-
132
- ### 6. Error handling
133
-
134
- - Membership lookup failure: `getMembership` already yields no `subject` on failure, so Jev is off for
135
- that run; existing account notices explain why.
136
- - Signed out with a local decision service configured: the configuration is kept but inert; the
137
- Settings row note adds "Requires sign-in." so the user is not left guessing.
138
-
139
- ## Testing
140
-
141
- Automated:
142
-
143
- - `test/hosted-decision-policy.test.ts` — the rule table: signed out (with and without a local
144
- service) → off; signed in + switch off → off; signed in + switch on → resolved service.
145
- - `test/hosted-decision-policy.test.ts` (also) — a three-node graph with A `true`, B unset, C `false`:
146
- under opt-in only A uses the manager (one third of the calls a flagless run makes); free and paid
147
- behave the same; the presets' Agent nodes are opted in and `DEFAULT_HARNESS` is not.
148
- - `test/subagent-run-decisions.test.ts` — signed out → off; decisions off → no account request.
149
- - `test/cli-live-control.test.ts` — `/jev` accepted mid-run with the notice and the status bar
150
- updated.
151
- - Desktop vitest — `JevToggle`: reflects config, disabled when signed out, notice only while running,
152
- revert on save failure.
153
- - `test/graph-ui-client-validation.test.ts` — checkbox serialization (tick writes `true`, untick
154
- removes the key).
155
-
156
- QA plan: `tests/jev-node-opt-in-test-plan.md`, covering the CLI and desktop flows, signed-out,
157
- free, and paid accounts, mid-run toggling, presets, and saved graphs losing Jev until ticked.
158
- `tests/default-active-jev-test-plan.md` is updated where it asserts the old default-on behavior.
159
-
160
- ## Rollout notes
161
-
162
- - Behavior change for existing users: saved custom graphs lose Jev until nodes are ticked; signed-out
163
- users with a local decision service lose it until they sign in. The PR description says so.
164
- - `docs/reference/config.md` and `docs/getting-started/accounts.md` are updated to the new rule.
@@ -1,111 +0,0 @@
1
- # Pull request section in the Plan card
2
-
3
- Status: approved 2026-11-01.
4
-
5
- Amended 2026-11-07: **Auto-archive on merge or close was removed**, from the menu, the protocol and the
6
- `pull_request` tool (the engine still sends `autoArchive: false` so older desktops keep showing the section).
7
- **Auto-fix now stops with the PR**: it switches itself off once the PR is merged or closed, and the engine reads
8
- the PR from GitHub right before each Auto-fix prompt is delivered, so a PR merged by hand since the last poll gets
9
- no prompt. The Auto-archive parts below describe the original design; `tests/pr-section-test-plan.md` describes
10
- the current behavior.
11
-
12
- ## Goal
13
-
14
- After the agent opens a pull request, the session's Plan card shows a **Pull request** section with the PR's link
15
- (opened in the system browser) and a ⋯ menu:
16
-
17
- - Open on GitHub · Copy link
18
- - View changes (the PR's `/files` page)
19
- - ☐ Auto-fix · ☐ Merge when ready · ☐ Auto-archive on merge or close
20
- - Convert to draft (Mark ready when the PR is a draft)
21
- - Dismiss
22
-
23
- The agent can change the same settings from a prompt ("turn on auto-merge for this PR") through a `pull_request` tool.
24
-
25
- ## Where the state lives
26
-
27
- One JSON file per session: `<home>/pull-requests/<sessionId>.json`.
28
-
29
- ```ts
30
- interface SessionPullRequest {
31
- url: string; // https://github.com/<owner>/<repo>/pull/<n>
32
- owner: string; repo: string; number: number;
33
- title?: string;
34
- state: 'open' | 'draft' | 'merged' | 'closed';
35
- autoFix: boolean; mergeWhenReady: boolean; autoArchive: boolean;
36
- /** Newest review-comment time Auto-fix has already handed to the agent. */
37
- handledThrough?: string;
38
- updatedAt: string;
39
- }
40
- ```
41
-
42
- It isn't stored on `SavedSession` because a run saves the record it captured at startup when it finishes. A setting
43
- the agent changed mid-run would then be silently reverted, which is the reason `sessions.setArchived` is refused
44
- during a run. A separate file also lets the watcher engine and the session's own engine share one source of truth.
45
- Deleting a session deletes its file.
46
-
47
- ## Engine (`src/pull-requests.ts`)
48
-
49
- - **Store:** `readPullRequest`, `writePullRequest` (atomic), `removePullRequest`, `listPullRequests`.
50
- - **URL parsing:** `parsePullRequestUrl(text)` returns the first `github.com/<owner>/<repo>/pull/<n>` URL.
51
- - **Detection:** the run's event hook remembers each `node.tool.started` whose arguments contain `gh pr create`.
52
- When the matching `node.tool.completed` arrives, its output is parsed and the PR is attached to the session.
53
- Attaching a URL that is already attached keeps its settings.
54
- - **gh actions** (`execFile('gh', …)`, nothing interpolated into a shell):
55
- - Merge when ready on: `gh pr merge <url> --auto --merge`. Off: `gh pr merge <url> --disable-auto`.
56
- - Convert to draft: `gh pr ready <url> --undo`. Mark ready: `gh pr ready <url>`.
57
- - Refresh: `gh pr view <url> --json number,title,state,isDraft,url,autoMergeRequest`.
58
- - A failed `gh` call raises an error naming the command and its stderr. The stored setting is left unchanged, so
59
- the menu never shows a checkmark the PR doesn't have.
60
- - **Protocol** (capability `sessions.pullRequest`):
61
- - `sessions.pullRequest.get {id}` returns `{ pullRequest | null }`.
62
- - `sessions.pullRequest.update {id, autoFix?, mergeWhenReady?, autoArchive?, draft?}` returns `{ pullRequest }`.
63
- - `sessions.pullRequest.dismiss {id}`.
64
- - Event `session.pullRequest.updated {sessionId, pullRequest | null}`.
65
- - **Agent tool** `pull_request` (family `git`, capability `github.pull-request`, sequential), with
66
- `action: 'status' | 'attach' | 'update' | 'dismiss'`, `url?`, `autoFix?`, `mergeWhenReady?`, `autoArchive?` and
67
- `draft?`. It reaches the engine through `ToolContext.pullRequests`, which is bound to the run's session. Where no
68
- session exists, the tool reports itself unavailable, the way `set_timer` does.
69
-
70
- ## Watcher
71
-
72
- - Exactly one engine per home polls. It holds an exclusive lease (the store lock at `<home>/pull-requests/.watcher`),
73
- and another engine takes the lease over only when the previous holder's pid is dead.
74
- - It polls every 60s, and only while some PR has `autoFix` or `autoArchive` on and is still open or draft. It
75
- refreshes state with `gh pr view` and emits the update event whenever state or title changed.
76
- - **Auto-archive:** a PR that is now merged or closed archives its session with `sessions.setArchived` semantics.
77
- A `busy` refusal means a run is active, and the archive is retried on the next poll.
78
- - **Auto-fix:** it reads unresolved review threads plus top-level PR comments through `gh api graphql`, and drops
79
- comments written by the `gh` viewer (the agent's own replies). If any is newer than `handledThrough`, it arms a
80
- 1-second self-wake for the session with a fixed prompt naming the PR and how many threads are new. Comment text
81
- is never put in the prompt, because it is untrusted third-party content; the agent reads it with `gh` as tool
82
- output. Once the wake is armed, `handledThrough` is set to the newest comment time.
83
- - Auto-fix reacts to review comments only. It ignores CI failures and merge conflicts, as the user decided.
84
- - The watcher stops polling a PR once it's merged, closed or dismissed.
85
-
86
- ## Desktop
87
-
88
- - The store keeps `pullRequests[sessionId]`, filled from `sessions.pullRequest.get` when a session opens and kept
89
- current by the update event from any engine.
90
- - `PlanWidget` takes a `pullRequest` prop and renders a section under the subagents:
91
- - a state chip;
92
- - an `owner/repo#n` link with the title, which calls `openExternalUrl`;
93
- - a ⋯ button that opens the menu. It closes on Escape or an outside click, and focus goes back to the button.
94
- - `planHasContent` counts a PR, so the card stays up after a plan is cleared.
95
- - Each checkbox calls `sessions.pullRequest.update` and shows a pending state while the call runs. An error goes
96
- to `notify('error', …)`.
97
-
98
- ## Limits
99
-
100
- - Polling happens only while some engine with this home is running; with the app closed, nothing polls.
101
- - Providers that run an external agent CLI (Claude, Codex) don't see the `pull_request` tool. Detection from shell
102
- output still covers PRs created through the built-in shell tools.
103
- - Merge when ready uses a merge commit (`--merge`).
104
-
105
- ## Testing
106
-
107
- - **Unit tests:** URL parsing, detection from a tool start/complete pair, the store, the tool with a fake
108
- controller, the watcher with an injected `gh` runner (archive on merge, a wake on a new foreign comment, no wake
109
- for the viewer's own comment) and the `PlanWidget` markup.
110
- - **QA plan:** `tests/pr-section-test-plan.md`.
111
- - **Run verification:** drive the built desktop dev app over CDP against a throwaway PR.
@@ -1,130 +0,0 @@
1
- # Workflow visualizer and pane
2
-
3
- Status: approved 2026-11-02.
4
-
5
- ## Goal
6
-
7
- The session's plan card becomes a live workflow visualizer that a person can follow while a run works: the graph
8
- node visits in order, each with the subagents it started nested under it, and the plan checklist below them. The
9
- card can be expanded into a right-side pane, the same slot the browser uses, with an animation that grows the card
10
- into the pane. Only one of the two panes is open at a time.
11
-
12
- Agents are drawn without avatars or per-agent colours: a monochrome status glyph, a name, a duration and a status
13
- word.
14
-
15
- ## What the visualizer shows
16
-
17
- One component, `WorkflowView`, renders in two sizes: `card` (the docked card) and `pane` (the expanded pane).
18
-
19
- - **Phases are node visits, in start order.** Each is a row on a vertical timeline: a status dot (pulsing while
20
- the visit works, filled once it completes, hollow when the run ended without it completing), the node's display
21
- name, the count of its subagents that finished out of all it started (`3/51`), its duration, and a chevron that
22
- folds its agents away. A visit with no subagents has no count and no chevron.
23
- - **Subagents nest under the visit that started them.** Each row: a glyph (spinner while running, ✓ succeeded,
24
- ✕ failed, ■ stopped), the readable name (`File analyzer 3`, from `subagentLabels`), the duration, and the
25
- status word (`subagentStatusLabel`). Activating a row opens that subagent's transcript view, as the card does
26
- today.
27
- - **Long lists fold.** A visit with more than six subagents shows the first five and folds the rest into an
28
- `N more` row that also says how many of them are running. Opening it lists the rest: one column in the card, a
29
- two-column grid in the pane.
30
- - **Subagents with no visit** (a start event without a node, or a node the run never reported starting) are
31
- listed in a final `Other agents` group, so none is ever dropped.
32
- - **The plan checklist is a separate list below the phases**, followed by the graph's widgets and the pull
33
- request section, as the card has them today.
34
- - A run with no visits and no subagents (an engine that reports neither) shows the checklist alone, as today.
35
- - The card docks when the run has a checklist, widgets, subagents or a pull request, as today, and also once the
36
- run has visited more than one node. A single-node run with nothing else to show keeps the whole column.
37
-
38
- Running durations tick once a second while the run is live; a stopped subagent or visit with no end time shows
39
- no duration.
40
-
41
- ## Card to pane
42
-
43
- - The card's header gains an **Expand** button (`PanelRightOpen`). It is offered only when the session has a
44
- pane scope (`browserKey`), the same condition the Browser button has.
45
- - Expanding records the card's on-screen rectangle, opens the workflow pane, and hides the card. When the pane
46
- mounts it draws a *morph box*: a fixed-position element with the card's surface, border and radius that animates
47
- from the card's rectangle to the pane's (about 220 ms, standard easing). The pane's content fades in as the box
48
- finishes, and the box is removed.
49
- - The pane's header has the title **Workflow**, the overall progress, and a **Collapse** button
50
- (`PanelRightClose`). Collapsing records the pane's rectangle, closes the pane, and the card, when it mounts again,
51
- runs the same morph in reverse into its own rectangle.
52
- - A morph whose target never mounts (the card is too small for the conversation, or the session changed) is
53
- dropped on the next frame rather than waiting.
54
- - `prefers-reduced-motion: reduce` switches instantly with no morph.
55
- - The pane uses the browser's divider: drag and arrow keys resize it, within the same limits
56
- (`browserWidthLimits`). It remembers its width per session, starting at 420 px.
57
-
58
- ## One pane at a time
59
-
60
- The browser and the workflow pane share the right-hand slot. The pane state per session scope gains
61
- `workflow: boolean` and `workflowWidth: number` beside `expanded`, in the same persisted store, so every action
62
- keeps the invariant in one update:
63
-
64
- | Action | Browser (`expanded`) | Workflow |
65
- |---|---|---|
66
- | `openWorkflow(scope)` | false | true |
67
- | `closeWorkflow(scope)` | unchanged | false |
68
- | `toggle(scope)` opening the browser, `expand(scope)`, `reportHeadlessOpen` | true | false |
69
- | `collapse(scope)`, `toggle(scope)` closing the browser | false | unchanged |
70
-
71
- So the agent opening a browser by itself takes the slot from the workflow pane, which returns to the card (no
72
- morph: the user did not ask for it). Older persisted entries with no `workflow` field read as closed.
73
-
74
- While the workflow pane is open the card renders nothing and reports itself hidden, so the conversation column
75
- keeps the whole width beside the pane.
76
-
77
- ## Data (desktop fold only)
78
-
79
- No engine change. The fold already receives the events this needs:
80
-
81
- - `graph.node.started` carries `nodeId`, `nodeName`, `runId` and the node's `visit` number.
82
- - `graph.node.completed` carries `nodeId` and the node's `completion` (with `outcome` when it has one).
83
- - `graph.finalization.resumed` wakes a completed node again.
84
- - `subagent.started` and `subagent.completed` carry `subagentId` and the parent's `nodeId`.
85
-
86
- New fold state, with the same lifetime as `subagents` (reset at `graph.started`, replaced rather than mutated):
87
-
88
- ```ts
89
- export interface NodeVisit {
90
- /** `${nodeId}#${visit}`: unique within the run, stable when a journal replays the start. */
91
- key: string;
92
- nodeId: string;
93
- name: string;
94
- status: 'running' | 'completed';
95
- time: string;
96
- endTime?: string;
97
- }
98
- FoldState.visits: NodeVisit[];
99
- SubagentItem.visit?: string; // the key of the visit that started it
100
- SubagentItem.endTime?: string; // when it settled
101
- ```
102
-
103
- - A start whose key is already listed updates that entry rather than adding one. A start with no `visit` number
104
- counts that node's earlier visits in this run.
105
- - A completion settles the newest running visit of that node. A resume sets that node's newest visit running again
106
- and clears its end time.
107
- - A subagent start is stamped with the newest running visit of its `nodeId`. When no visit of that node is
108
- running, it takes the newest running visit of any node. When nothing is running, it gets no visit.
109
- - When the run is not live, a visit or subagent still marked running is drawn as stopped (the rule
110
- `PlanWidget` already applies to subagents).
111
-
112
- Grouping is a pure function, `workflowPhases(visits, subagents)`, so it can be tested without rendering.
113
-
114
- ## Where the pane is rendered
115
-
116
- `SessionBrowserLayout` owns the slot and its divider. The workflow content needs `SessionView`'s state (the fold,
117
- the pull request and the open subagent), so the layout provides its pane element through a React context and
118
- `SessionView` portals `WorkflowView` into it. The browser branch is unchanged.
119
-
120
- ## Testing
121
-
122
- - Fold: visits are recorded, settled and resumed; a replayed start does not duplicate a visit; subagents are
123
- stamped with the right visit, the fallback visit, or none; `graph.started` resets visits.
124
- - `workflowPhases`: nesting, the `Other agents` group, the overflow split and its running count.
125
- - Store: every row of the exclusion table, plus the parsing of old entries.
126
- - Static renders: the card shows phases, nested agents, `N more` and the expand button; the pane shows the grid;
127
- no agent avatars or colour classes are rendered.
128
- - QA plan: `tests/desktop-workflow-pane-test-plan.md`.
129
- - Run verification: the built dev desktop app driven over CDP through a real run that spawns subagents. Check the
130
- morph both ways, the exclusion with the Browser button, the overflow, and that the column keeps its width.