@andorra-labs/code 0.1.11 → 0.1.13

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 (614) hide show
  1. package/README.md +8 -2
  2. package/THIRD_PARTY_NOTICES.md +15 -0
  3. package/dist/src/account-presentation.d.ts +1 -37
  4. package/dist/src/account-presentation.js +2 -42
  5. package/dist/src/activity.d.ts +0 -25
  6. package/dist/src/activity.js +1 -23
  7. package/dist/src/agent-definitions.d.ts +0 -26
  8. package/dist/src/agent-definitions.js +0 -43
  9. package/dist/src/agent-execution.d.ts +0 -2
  10. package/dist/src/agent-execution.js +59 -414
  11. package/dist/src/agent-mcp-catalog.d.ts +0 -8
  12. package/dist/src/agent-mcp-catalog.js +0 -2
  13. package/dist/src/agent-mcp.d.ts +0 -56
  14. package/dist/src/agent-mcp.js +14 -153
  15. package/dist/src/agent-modifiers.d.ts +0 -1
  16. package/dist/src/agent-modifiers.js +25 -68
  17. package/dist/src/analytics.d.ts +0 -66
  18. package/dist/src/analytics.js +0 -45
  19. package/dist/src/anthropic-console-auth.d.ts +0 -24
  20. package/dist/src/anthropic-console-auth.js +0 -37
  21. package/dist/src/anthropic-credentials.d.ts +0 -25
  22. package/dist/src/anthropic-credentials.js +0 -28
  23. package/dist/src/app-server/protocol.d.ts +19 -244
  24. package/dist/src/app-server/protocol.js +1 -132
  25. package/dist/src/app-server/reasoning.d.ts +0 -31
  26. package/dist/src/app-server/reasoning.js +0 -54
  27. package/dist/src/app-server/terminal.d.ts +0 -36
  28. package/dist/src/app-server/terminal.js +3 -39
  29. package/dist/src/app-server/workspace.d.ts +0 -167
  30. package/dist/src/app-server/workspace.js +4 -406
  31. package/dist/src/app-server.d.ts +33 -918
  32. package/dist/src/app-server.js +608 -2984
  33. package/dist/src/artifacts.d.ts +0 -10
  34. package/dist/src/artifacts.js +1 -11
  35. package/dist/src/attachments.d.ts +4 -98
  36. package/dist/src/attachments.js +10 -130
  37. package/dist/src/auth/AuthManager.d.ts +0 -93
  38. package/dist/src/auth/AuthManager.js +3 -165
  39. package/dist/src/auth/callback-page.d.ts +0 -1
  40. package/dist/src/auth/callback-page.js +0 -4
  41. package/dist/src/auth/callback.d.ts +0 -25
  42. package/dist/src/auth/callback.js +1 -29
  43. package/dist/src/auth/deployment.d.ts +0 -16
  44. package/dist/src/auth/deployment.js +0 -16
  45. package/dist/src/auth/index.d.ts +0 -11
  46. package/dist/src/auth/index.js +0 -11
  47. package/dist/src/auth/lock.d.ts +0 -1
  48. package/dist/src/auth/lock.js +0 -1
  49. package/dist/src/auth/store.d.ts +7 -108
  50. package/dist/src/auth/store.js +21 -129
  51. package/dist/src/auth/types.d.ts +0 -8
  52. package/dist/src/auth-commands.d.ts +0 -5
  53. package/dist/src/auth-commands.js +0 -1
  54. package/dist/src/automation-runner.d.ts +0 -9
  55. package/dist/src/automation-runner.js +0 -11
  56. package/dist/src/automation-service.d.ts +0 -10
  57. package/dist/src/automation-service.js +3 -17
  58. package/dist/src/automation-tool.js +0 -5
  59. package/dist/src/automation-worker-shutdown.d.ts +0 -1
  60. package/dist/src/automation-worker-shutdown.js +0 -3
  61. package/dist/src/automations.d.ts +23 -2
  62. package/dist/src/automations.js +91 -12
  63. package/dist/src/background-tasks.d.ts +0 -23
  64. package/dist/src/background-tasks.js +0 -11
  65. package/dist/src/boot-trace.d.ts +0 -13
  66. package/dist/src/boot-trace.js +1 -14
  67. package/dist/src/browser-activity.js +0 -2
  68. package/dist/src/browser-bridge.d.ts +0 -2
  69. package/dist/src/browser-bridge.js +0 -27
  70. package/dist/src/browser-captcha-tool.d.ts +0 -13
  71. package/dist/src/browser-captcha-tool.js +3 -35
  72. package/dist/src/browser-extensions-tool.d.ts +24 -0
  73. package/dist/src/browser-extensions-tool.js +137 -0
  74. package/dist/src/browser-extensions.d.ts +127 -0
  75. package/dist/src/browser-extensions.js +729 -0
  76. package/dist/src/browser-observation.d.ts +0 -15
  77. package/dist/src/browser-observation.js +1 -22
  78. package/dist/src/browser-panel-tool.d.ts +10 -25
  79. package/dist/src/browser-panel-tool.js +64 -60
  80. package/dist/src/browser-runner.d.ts +0 -1
  81. package/dist/src/browser-runner.js +7 -46
  82. package/dist/src/browser-server.d.ts +0 -6
  83. package/dist/src/browser-server.js +6 -229
  84. package/dist/src/browser-session.d.ts +0 -25
  85. package/dist/src/browser-session.js +1 -71
  86. package/dist/src/browser-stealth.d.ts +0 -12
  87. package/dist/src/browser-stealth.js +0 -36
  88. package/dist/src/browser-ui/app.js +7 -174
  89. package/dist/src/browser-ui/style.css +0 -68
  90. package/dist/src/browser-ui/tokens.css +11 -93
  91. package/dist/src/browser-view.d.ts +52 -290
  92. package/dist/src/browser-view.js +354 -567
  93. package/dist/src/capabilities.d.ts +0 -8
  94. package/dist/src/capabilities.js +0 -29
  95. package/dist/src/capsolver.d.ts +0 -13
  96. package/dist/src/capsolver.js +0 -15
  97. package/dist/src/clarification-ui.d.ts +0 -7
  98. package/dist/src/clarification-ui.js +0 -8
  99. package/dist/src/claude-executable.d.ts +0 -1
  100. package/dist/src/claude-executable.js +1 -2
  101. package/dist/src/claude-provider.d.ts +6 -19
  102. package/dist/src/claude-provider.js +166 -61
  103. package/dist/src/cli-executable.d.ts +0 -16
  104. package/dist/src/cli-executable.js +0 -7
  105. package/dist/src/cli-process.d.ts +0 -26
  106. package/dist/src/cli-process.js +0 -18
  107. package/dist/src/cli-sign-in.d.ts +0 -20
  108. package/dist/src/cli-sign-in.js +1 -17
  109. package/dist/src/cli.d.ts +3 -56
  110. package/dist/src/cli.js +193 -702
  111. package/dist/src/code-intelligence/CodeIntelligenceManager.d.ts +4 -59
  112. package/dist/src/code-intelligence/CodeIntelligenceManager.js +27 -100
  113. package/dist/src/code-intelligence/ContextLedger.d.ts +0 -4
  114. package/dist/src/code-intelligence/ContextLedger.js +0 -10
  115. package/dist/src/code-intelligence/ContextRouter.d.ts +0 -6
  116. package/dist/src/code-intelligence/ContextRouter.js +0 -8
  117. package/dist/src/code-intelligence/codegraph/CodeGraphProjectSession.d.ts +0 -2
  118. package/dist/src/code-intelligence/codegraph/CodeGraphProjectSession.js +5 -12
  119. package/dist/src/code-intelligence/codegraph/CodeGraphProvider.d.ts +0 -6
  120. package/dist/src/code-intelligence/codegraph/CodeGraphProvider.js +0 -6
  121. package/dist/src/code-intelligence/codegraph/CodeGraphSyncBarrier.d.ts +0 -5
  122. package/dist/src/code-intelligence/codegraph/CodeGraphSyncBarrier.js +1 -17
  123. package/dist/src/code-intelligence/codegraph/repoExploreTool.d.ts +0 -5
  124. package/dist/src/code-intelligence/codegraph/repoExploreTool.js +0 -5
  125. package/dist/src/code-intelligence/repository.d.ts +0 -9
  126. package/dist/src/code-intelligence/repository.js +1 -11
  127. package/dist/src/code-intelligence/types.d.ts +0 -8
  128. package/dist/src/codex-auth.d.ts +0 -44
  129. package/dist/src/codex-auth.js +0 -45
  130. package/dist/src/codex-browser-auth.d.ts +0 -13
  131. package/dist/src/codex-browser-auth.js +3 -20
  132. package/dist/src/codex-errors.js +0 -2
  133. package/dist/src/codex-executable.d.ts +0 -2
  134. package/dist/src/codex-executable.js +1 -7
  135. package/dist/src/codex-provider.d.ts +0 -13
  136. package/dist/src/codex-provider.js +1 -26
  137. package/dist/src/codex-rpc.d.ts +0 -10
  138. package/dist/src/codex-rpc.js +0 -12
  139. package/dist/src/coding-tools.d.ts +6 -27
  140. package/dist/src/coding-tools.js +193 -205
  141. package/dist/src/command-metrics.d.ts +0 -4
  142. package/dist/src/command-output-tap.d.ts +0 -11
  143. package/dist/src/command-output-tap.js +0 -3
  144. package/dist/src/command-screens.d.ts +24 -0
  145. package/dist/src/command-screens.js +132 -100
  146. package/dist/src/commands.d.ts +6 -63
  147. package/dist/src/commands.js +20 -100
  148. package/dist/src/completion-gates.d.ts +0 -47
  149. package/dist/src/completion-gates.js +0 -14
  150. package/dist/src/completion.d.ts +2 -58
  151. package/dist/src/completion.js +90 -186
  152. package/dist/src/config.d.ts +12 -116
  153. package/dist/src/config.js +41 -171
  154. package/dist/src/context-budget.d.ts +0 -22
  155. package/dist/src/context-budget.js +0 -44
  156. package/dist/src/context-compaction.d.ts +29 -6
  157. package/dist/src/context-compaction.js +94 -25
  158. package/dist/src/context-selection.d.ts +0 -24
  159. package/dist/src/context-selection.js +0 -34
  160. package/dist/src/dashboard-view.d.ts +0 -2
  161. package/dist/src/dashboard-view.js +0 -35
  162. package/dist/src/dashboard.d.ts +0 -2
  163. package/dist/src/dashboard.js +0 -9
  164. package/dist/src/deadline.d.ts +0 -45
  165. package/dist/src/deadline.js +0 -54
  166. package/dist/src/decision/ContinuationAdapter.d.ts +0 -5
  167. package/dist/src/decision/ContinuationAdapter.js +0 -5
  168. package/dist/src/decision/DecisionEngine.d.ts +0 -4
  169. package/dist/src/decision/DecisionManager.d.ts +0 -1
  170. package/dist/src/decision/DecisionManager.js +2 -7
  171. package/dist/src/decision/DecisionPolicy.d.ts +0 -1
  172. package/dist/src/decision/DecisionPolicy.js +0 -1
  173. package/dist/src/decision/FactContinuations.d.ts +11 -43
  174. package/dist/src/decision/FactContinuations.js +126 -95
  175. package/dist/src/decision/FactServiceGate.d.ts +0 -1
  176. package/dist/src/decision/FactServiceGate.js +0 -4
  177. package/dist/src/decision/PreparedSteps.d.ts +0 -15
  178. package/dist/src/decision/PreparedSteps.js +1 -11
  179. package/dist/src/decision/applyToolMenu.d.ts +0 -1
  180. package/dist/src/decision/applyToolMenu.js +1 -5
  181. package/dist/src/decision/checks.d.ts +15 -28
  182. package/dist/src/decision/checks.js +118 -49
  183. package/dist/src/decision/facts.d.ts +0 -16
  184. package/dist/src/decision/facts.js +0 -30
  185. package/dist/src/decision/guidancePolicy.js +0 -1
  186. package/dist/src/decision/hostedPolicy.d.ts +0 -6
  187. package/dist/src/decision/hostedPolicy.js +0 -7
  188. package/dist/src/decision/hostedSkills.d.ts +0 -19
  189. package/dist/src/decision/hostedSkills.js +0 -19
  190. package/dist/src/decision/optimizationPolicy.d.ts +0 -3
  191. package/dist/src/decision/optimizationPolicy.js +1 -4
  192. package/dist/src/decision/providers/AndorraDecisionProvider.d.ts +0 -7
  193. package/dist/src/decision/providers/AndorraDecisionProvider.js +4 -27
  194. package/dist/src/decision/providers/HttpDecisionProvider.d.ts +0 -2
  195. package/dist/src/decision/providers/HttpDecisionProvider.js +0 -6
  196. package/dist/src/decision/routeTools.d.ts +0 -8
  197. package/dist/src/decision/routeTools.js +1 -8
  198. package/dist/src/decision/toolFamilies.d.ts +0 -1
  199. package/dist/src/decision/toolFamilies.js +0 -1
  200. package/dist/src/decision/toolMenu.d.ts +0 -3
  201. package/dist/src/decision/toolMenu.js +0 -4
  202. package/dist/src/decision/types.d.ts +0 -6
  203. package/dist/src/default-graph.d.ts +0 -9
  204. package/dist/src/default-graph.js +0 -9
  205. package/dist/src/delegation-changes.d.ts +0 -56
  206. package/dist/src/delegation-changes.js +15 -124
  207. package/dist/src/diff-preview.d.ts +1 -1
  208. package/dist/src/diff-preview.js +4 -12
  209. package/dist/src/duration.d.ts +0 -50
  210. package/dist/src/duration.js +0 -50
  211. package/dist/src/efficiency.d.ts +0 -39
  212. package/dist/src/efficiency.js +0 -16
  213. package/dist/src/engine/protocol.d.ts +0 -2
  214. package/dist/src/engine/protocol.js +0 -2
  215. package/dist/src/engine-streams.d.ts +13 -0
  216. package/dist/src/engine-streams.js +16 -0
  217. package/dist/src/extensions.d.ts +3 -2
  218. package/dist/src/extensions.js +76 -37
  219. package/dist/src/favicons.d.ts +0 -26
  220. package/dist/src/favicons.js +0 -34
  221. package/dist/src/file-diff.d.ts +2 -58
  222. package/dist/src/file-diff.js +0 -32
  223. package/dist/src/file-read-key.d.ts +1 -0
  224. package/dist/src/file-read-key.js +5 -0
  225. package/dist/src/file-read-state.d.ts +0 -1
  226. package/dist/src/file-read-state.js +0 -4
  227. package/dist/src/firefox-cookies.d.ts +0 -34
  228. package/dist/src/firefox-cookies.js +1 -55
  229. package/dist/src/git-identity-audit.d.ts +27 -0
  230. package/dist/src/git-identity-audit.js +286 -0
  231. package/dist/src/git-identity-guard.d.ts +4 -0
  232. package/dist/src/git-identity-guard.js +998 -0
  233. package/dist/src/git-identity-hold.d.ts +12 -0
  234. package/dist/src/git-identity-hold.js +81 -0
  235. package/dist/src/git-summary.d.ts +0 -58
  236. package/dist/src/git-summary.js +2 -212
  237. package/dist/src/goal-completion-verification.d.ts +2 -2
  238. package/dist/src/goal-completion-verification.js +3 -6
  239. package/dist/src/graph-account.d.ts +0 -21
  240. package/dist/src/graph-account.js +0 -17
  241. package/dist/src/graph-editor-session.d.ts +0 -1
  242. package/dist/src/graph-editor-session.js +1 -3
  243. package/dist/src/graph-health.d.ts +7 -49
  244. package/dist/src/graph-health.js +35 -46
  245. package/dist/src/graph-manager-chat.d.ts +27 -128
  246. package/dist/src/graph-manager-chat.js +36 -166
  247. package/dist/src/graph-provider-portability.d.ts +1 -21
  248. package/dist/src/graph-provider-portability.js +6 -45
  249. package/dist/src/graph-quota.d.ts +0 -33
  250. package/dist/src/graph-quota.js +1 -44
  251. package/dist/src/graph-runner.d.ts +0 -1
  252. package/dist/src/graph-runner.js +47 -387
  253. package/dist/src/graph-selection.d.ts +0 -14
  254. package/dist/src/graph-selection.js +0 -14
  255. package/dist/src/graph-server.d.ts +3 -11
  256. package/dist/src/graph-server.js +70 -111
  257. package/dist/src/graph-studio-features.d.ts +0 -5
  258. package/dist/src/graph-studio-features.js +2 -42
  259. package/dist/src/graph-sync.d.ts +0 -78
  260. package/dist/src/graph-sync.js +5 -201
  261. package/dist/src/graph-tool.d.ts +0 -18
  262. package/dist/src/graph-tool.js +0 -27
  263. package/dist/src/graph-ui/app.js +229 -498
  264. package/dist/src/graph-ui/compat.js +0 -7
  265. package/dist/src/graph-ui/controls.css +47 -43
  266. package/dist/src/graph-ui/controls.js +0 -88
  267. package/dist/src/graph-ui/drafts.js +0 -12
  268. package/dist/src/graph-ui/edge-router.js +0 -62
  269. package/dist/src/graph-ui/embed.js +0 -59
  270. package/dist/src/graph-ui/icons.js +2 -7
  271. package/dist/src/graph-ui/index.html +2 -2
  272. package/dist/src/graph-ui/library.css +0 -5
  273. package/dist/src/graph-ui/manager-markdown.js +0 -11
  274. package/dist/src/graph-ui/manager-state.js +110 -49
  275. package/dist/src/graph-ui/manager.css +2 -20
  276. package/dist/src/graph-ui/manager.js +251 -166
  277. package/dist/src/graph-ui/model-picker.js +250 -0
  278. package/dist/src/graph-ui/provider-glyphs/alibaba-cloud.png +0 -0
  279. package/dist/src/graph-ui/provider-glyphs/anthropic.png +0 -0
  280. package/dist/src/graph-ui/provider-glyphs/aws-bedrock.png +0 -0
  281. package/dist/src/graph-ui/provider-glyphs/claude.png +0 -0
  282. package/dist/src/graph-ui/provider-glyphs/deepseek.png +0 -0
  283. package/dist/src/graph-ui/provider-glyphs/fireworks.png +0 -0
  284. package/dist/src/graph-ui/provider-glyphs/kimi.png +0 -0
  285. package/dist/src/graph-ui/provider-glyphs/minimax.png +0 -0
  286. package/dist/src/graph-ui/provider-glyphs/openai.png +0 -0
  287. package/dist/src/graph-ui/provider-glyphs/opencode.png +0 -0
  288. package/dist/src/graph-ui/provider-glyphs/openrouter.png +0 -0
  289. package/dist/src/graph-ui/provider-glyphs/xai.png +0 -0
  290. package/dist/src/graph-ui/provider-glyphs/xiaomi-mimo.png +0 -0
  291. package/dist/src/graph-ui/provider-glyphs/zai.png +0 -0
  292. package/dist/src/graph-ui/sidebar.js +2 -3
  293. package/dist/src/graph-ui/skill-picker.js +373 -39
  294. package/dist/src/graph-ui/studio-canvas.js +3 -38
  295. package/dist/src/graph-ui/studio.css +0 -18
  296. package/dist/src/graph-ui/studio.js +3 -71
  297. package/dist/src/graph-ui/style.css +11 -134
  298. package/dist/src/graph-ui/theme.js +1 -26
  299. package/dist/src/graph-ui/tokens.css +15 -114
  300. package/dist/src/graphs.d.ts +7 -156
  301. package/dist/src/graphs.js +72 -273
  302. package/dist/src/grep-regex-worker.js +0 -2
  303. package/dist/src/grep-regex.d.ts +1 -5
  304. package/dist/src/grep-regex.js +6 -8
  305. package/dist/src/grok-provider.d.ts +0 -17
  306. package/dist/src/grok-provider.js +1 -26
  307. package/dist/src/handoffs.d.ts +0 -11
  308. package/dist/src/handoffs.js +0 -13
  309. package/dist/src/hardened-runtime.d.ts +0 -10
  310. package/dist/src/hardened-runtime.js +8 -46
  311. package/dist/src/harness-home.d.ts +21 -0
  312. package/dist/src/harness-home.js +87 -0
  313. package/dist/src/host-process-guard.d.ts +0 -50
  314. package/dist/src/host-process-guard.js +0 -641
  315. package/dist/src/limits.d.ts +0 -64
  316. package/dist/src/limits.js +0 -62
  317. package/dist/src/managed-sign-in.d.ts +0 -12
  318. package/dist/src/managed-sign-in.js +0 -16
  319. package/dist/src/markdown.d.ts +0 -28
  320. package/dist/src/markdown.js +1 -175
  321. package/dist/src/mcp.d.ts +21 -82
  322. package/dist/src/mcp.js +228 -237
  323. package/dist/src/membership-errors.d.ts +0 -14
  324. package/dist/src/membership-errors.js +0 -13
  325. package/dist/src/membership.d.ts +2 -60
  326. package/dist/src/membership.js +0 -85
  327. package/dist/src/memory/LocalToolMemory.d.ts +0 -1
  328. package/dist/src/memory/LocalToolMemory.js +2 -7
  329. package/dist/src/memory/MemoryDistiller.js +0 -15
  330. package/dist/src/memory/MemoryManager.d.ts +0 -3
  331. package/dist/src/memory/MemoryManager.js +6 -18
  332. package/dist/src/memory/MemoryPolicy.d.ts +0 -2
  333. package/dist/src/memory/MemoryPolicy.js +0 -2
  334. package/dist/src/memory/MemoryProvider.d.ts +0 -6
  335. package/dist/src/memory/MemoryRetriever.js +0 -7
  336. package/dist/src/memory/PermissionMemoryProvider.d.ts +0 -1
  337. package/dist/src/memory/PermissionMemoryProvider.js +0 -1
  338. package/dist/src/memory/ProjectMemory.d.ts +42 -0
  339. package/dist/src/memory/ProjectMemory.js +285 -0
  340. package/dist/src/memory/ToolFailureLessons.d.ts +0 -3
  341. package/dist/src/memory/ToolFailureLessons.js +0 -6
  342. package/dist/src/memory/index.d.ts +1 -0
  343. package/dist/src/memory/index.js +1 -0
  344. package/dist/src/memory/providers/NoOpMemoryProvider.d.ts +0 -1
  345. package/dist/src/memory/providers/NoOpMemoryProvider.js +0 -1
  346. package/dist/src/memory/redaction.d.ts +0 -5
  347. package/dist/src/memory/redaction.js +0 -11
  348. package/dist/src/memory/repository.d.ts +0 -6
  349. package/dist/src/memory/repository.js +2 -12
  350. package/dist/src/memory/types.d.ts +0 -1
  351. package/dist/src/model-health-cache.d.ts +0 -38
  352. package/dist/src/model-health-cache.js +1 -49
  353. package/dist/src/model-metadata.d.ts +0 -18
  354. package/dist/src/model-metadata.js +2 -42
  355. package/dist/src/model-override.d.ts +0 -36
  356. package/dist/src/model-override.js +0 -43
  357. package/dist/src/model-tiers.d.ts +0 -13
  358. package/dist/src/model-tiers.js +0 -23
  359. package/dist/src/opencode-catalog.d.ts +0 -2
  360. package/dist/src/opencode-catalog.js +0 -11
  361. package/dist/src/opencode-cli-provider.d.ts +0 -35
  362. package/dist/src/opencode-cli-provider.js +1 -44
  363. package/dist/src/opencode-provider.d.ts +0 -2
  364. package/dist/src/opencode-provider.js +6 -22
  365. package/dist/src/package-name.d.ts +1 -0
  366. package/dist/src/package-name.js +1 -0
  367. package/dist/src/paged-transcript.d.ts +0 -11
  368. package/dist/src/paged-transcript.js +2 -20
  369. package/dist/src/palette.d.ts +0 -63
  370. package/dist/src/palette.js +0 -63
  371. package/dist/src/permissions.d.ts +0 -15
  372. package/dist/src/permissions.js +0 -17
  373. package/dist/src/powershell-pool.d.ts +0 -9
  374. package/dist/src/powershell-pool.js +3 -26
  375. package/dist/src/process-warnings.d.ts +4 -0
  376. package/dist/src/process-warnings.js +103 -0
  377. package/dist/src/profile.d.ts +0 -43
  378. package/dist/src/profile.js +0 -43
  379. package/dist/src/project-reservation.d.ts +11 -0
  380. package/dist/src/project-reservation.js +143 -0
  381. package/dist/src/provider-connection.d.ts +0 -18
  382. package/dist/src/provider-connection.js +0 -39
  383. package/dist/src/provider-engine.d.ts +0 -21
  384. package/dist/src/provider-engine.js +3 -98
  385. package/dist/src/provider-import.d.ts +0 -49
  386. package/dist/src/provider-import.js +0 -60
  387. package/dist/src/provider-keys.d.ts +1 -36
  388. package/dist/src/provider-keys.js +5 -48
  389. package/dist/src/provider-settings.d.ts +0 -2
  390. package/dist/src/provider-settings.js +0 -32
  391. package/dist/src/providers.d.ts +0 -217
  392. package/dist/src/providers.js +0 -315
  393. package/dist/src/pull-requests.d.ts +0 -173
  394. package/dist/src/pull-requests.js +5 -195
  395. package/dist/src/qa/browser/PlaywrightRunner.d.ts +0 -7
  396. package/dist/src/qa/browser/PlaywrightRunner.js +2 -16
  397. package/dist/src/qa/command-policy.d.ts +0 -23
  398. package/dist/src/qa/command-policy.js +0 -30
  399. package/dist/src/qa/guidance.d.ts +0 -21
  400. package/dist/src/qa/guidance.js +0 -20
  401. package/dist/src/qa/profile/ProjectInspector.d.ts +0 -4
  402. package/dist/src/qa/profile/ProjectInspector.js +0 -6
  403. package/dist/src/qa/profile/QaConfigLoader.d.ts +0 -7
  404. package/dist/src/qa/profile/QaConfigLoader.js +0 -6
  405. package/dist/src/qa/profile/QaProfile.d.ts +0 -7
  406. package/dist/src/qa/profile/QaProfile.js +0 -7
  407. package/dist/src/qa/profile/yaml.d.ts +0 -9
  408. package/dist/src/qa/profile/yaml.js +0 -13
  409. package/dist/src/qa/qa-authorize.d.ts +0 -19
  410. package/dist/src/qa/qa-authorize.js +4 -11
  411. package/dist/src/qa/runtime/ProcessManager.d.ts +0 -31
  412. package/dist/src/qa/runtime/ProcessManager.js +4 -41
  413. package/dist/src/qa/runtime/PtyManager.d.ts +0 -4
  414. package/dist/src/qa/runtime/PtyManager.js +2 -7
  415. package/dist/src/qa/runtime/changes.d.ts +0 -11
  416. package/dist/src/qa/runtime/changes.js +1 -3
  417. package/dist/src/qa/tools.d.ts +0 -10
  418. package/dist/src/qa/tools.js +0 -12
  419. package/dist/src/qa/types.d.ts +0 -13
  420. package/dist/src/react-runtime.d.ts +2 -21
  421. package/dist/src/react-runtime.js +106 -418
  422. package/dist/src/read-document-doc.d.ts +0 -6
  423. package/dist/src/read-document-doc.js +0 -55
  424. package/dist/src/read-document-docx.d.ts +0 -16
  425. package/dist/src/read-document-docx.js +2 -69
  426. package/dist/src/read-document-text.d.ts +0 -17
  427. package/dist/src/read-document-text.js +0 -22
  428. package/dist/src/read-document-tool.d.ts +0 -31
  429. package/dist/src/read-document-tool.js +0 -30
  430. package/dist/src/read-document.d.ts +0 -49
  431. package/dist/src/read-document.js +1 -67
  432. package/dist/src/read-image.d.ts +0 -32
  433. package/dist/src/read-image.js +0 -33
  434. package/dist/src/remote/cert.d.ts +1 -19
  435. package/dist/src/remote/cert.js +2 -51
  436. package/dist/src/remote/client.d.ts +0 -70
  437. package/dist/src/remote/client.js +2 -117
  438. package/dist/src/remote/command.js +0 -17
  439. package/dist/src/remote/engine-pool.d.ts +0 -152
  440. package/dist/src/remote/engine-pool.js +17 -335
  441. package/dist/src/remote/errors.d.ts +0 -15
  442. package/dist/src/remote/errors.js +0 -7
  443. package/dist/src/remote/network.d.ts +0 -26
  444. package/dist/src/remote/network.js +1 -34
  445. package/dist/src/remote/pairing.d.ts +16 -51
  446. package/dist/src/remote/pairing.js +50 -57
  447. package/dist/src/remote/pem.d.ts +2 -0
  448. package/dist/src/remote/pem.js +7 -0
  449. package/dist/src/remote/roots.d.ts +0 -20
  450. package/dist/src/remote/roots.js +0 -8
  451. package/dist/src/remote/serve.d.ts +0 -47
  452. package/dist/src/remote/serve.js +0 -30
  453. package/dist/src/remote/server.d.ts +0 -14
  454. package/dist/src/remote/server.js +1 -79
  455. package/dist/src/remote/types.d.ts +1 -32
  456. package/dist/src/remote/types.js +0 -10
  457. package/dist/src/run-control.d.ts +0 -7
  458. package/dist/src/run-control.js +0 -7
  459. package/dist/src/run-progress.d.ts +0 -170
  460. package/dist/src/run-progress.js +0 -285
  461. package/dist/src/run-records.d.ts +0 -443
  462. package/dist/src/run-records.js +44 -678
  463. package/dist/src/run-temp.d.ts +12 -0
  464. package/dist/src/run-temp.js +50 -0
  465. package/dist/src/runtime.d.ts +11 -227
  466. package/dist/src/runtime.js +0 -127
  467. package/dist/src/sandbox-child.js +0 -1
  468. package/dist/src/save-lock.d.ts +0 -12
  469. package/dist/src/save-lock.js +0 -28
  470. package/dist/src/screen-selection.d.ts +0 -23
  471. package/dist/src/screen-selection.js +0 -22
  472. package/dist/src/secret-redaction.d.ts +0 -12
  473. package/dist/src/secret-redaction.js +0 -45
  474. package/dist/src/session-changes.d.ts +4 -80
  475. package/dist/src/session-changes.js +25 -130
  476. package/dist/src/session-goal.d.ts +129 -0
  477. package/dist/src/session-goal.js +230 -0
  478. package/dist/src/session-monitor.d.ts +1 -10
  479. package/dist/src/session-monitor.js +2 -39
  480. package/dist/src/session-reaper.d.ts +0 -15
  481. package/dist/src/session-reaper.js +0 -14
  482. package/dist/src/session-skills.d.ts +15 -44
  483. package/dist/src/session-skills.js +75 -60
  484. package/dist/src/session-summary.d.ts +0 -26
  485. package/dist/src/session-summary.js +0 -32
  486. package/dist/src/session-title.d.ts +0 -1
  487. package/dist/src/session-title.js +0 -2
  488. package/dist/src/sessions.d.ts +2 -120
  489. package/dist/src/sessions.js +9 -178
  490. package/dist/src/shell.d.ts +3 -20
  491. package/dist/src/shell.js +8 -72
  492. package/dist/src/side-panel.d.ts +5 -99
  493. package/dist/src/side-panel.js +76 -133
  494. package/dist/src/sign-in-detection.d.ts +43 -0
  495. package/dist/src/sign-in-detection.js +154 -0
  496. package/dist/src/sign-in-offer.d.ts +17 -0
  497. package/dist/src/sign-in-offer.js +103 -0
  498. package/dist/src/skill-commands.d.ts +0 -1
  499. package/dist/src/skill-commands.js +1 -4
  500. package/dist/src/skills/bundled/control-browser/SKILL.md +1 -1
  501. package/dist/src/skills/bundled/graph-manager/SKILL.md +22 -4
  502. package/dist/src/skills/bundled/provenance.json +2 -2
  503. package/dist/src/skills/invocable-skills.d.ts +0 -18
  504. package/dist/src/skills/invocable-skills.js +0 -17
  505. package/dist/src/skills/project-skills.d.ts +0 -1
  506. package/dist/src/skills/project-skills.js +0 -3
  507. package/dist/src/skills/prompt-skills.js +0 -14
  508. package/dist/src/skills/runtime-skills.d.ts +1 -8
  509. package/dist/src/skills/runtime-skills.js +8 -32
  510. package/dist/src/stall-recovery.d.ts +0 -25
  511. package/dist/src/stall-recovery.js +0 -38
  512. package/dist/src/stray-files.d.ts +5 -0
  513. package/dist/src/stray-files.js +65 -0
  514. package/dist/src/structured-step.d.ts +0 -22
  515. package/dist/src/structured-step.js +0 -22
  516. package/dist/src/subagent-run.d.ts +0 -163
  517. package/dist/src/subagent-run.js +10 -374
  518. package/dist/src/subagent-tree.d.ts +32 -0
  519. package/dist/src/subagent-tree.js +128 -0
  520. package/dist/src/telemetry/aggregate.d.ts +0 -37
  521. package/dist/src/telemetry/aggregate.js +0 -40
  522. package/dist/src/telemetry/capture-core.d.ts +0 -87
  523. package/dist/src/telemetry/capture-core.js +0 -67
  524. package/dist/src/telemetry/capture.d.ts +0 -1
  525. package/dist/src/telemetry/capture.js +0 -3
  526. package/dist/src/telemetry/classify.d.ts +0 -58
  527. package/dist/src/telemetry/classify.js +0 -60
  528. package/dist/src/telemetry/decision-capture.d.ts +0 -1
  529. package/dist/src/telemetry/emitter.d.ts +0 -30
  530. package/dist/src/telemetry/emitter.js +1 -62
  531. package/dist/src/telemetry/gate.d.ts +0 -29
  532. package/dist/src/telemetry/gate.js +0 -22
  533. package/dist/src/telemetry/identity.d.ts +0 -13
  534. package/dist/src/telemetry/identity.js +0 -29
  535. package/dist/src/telemetry/outbox.d.ts +0 -64
  536. package/dist/src/telemetry/outbox.js +1 -108
  537. package/dist/src/telemetry/schema.d.ts +1 -49
  538. package/dist/src/telemetry/schema.js +1 -82
  539. package/dist/src/telemetry/state.d.ts +0 -53
  540. package/dist/src/telemetry/state.js +0 -64
  541. package/dist/src/telemetry/surface.d.ts +0 -31
  542. package/dist/src/telemetry/surface.js +1 -39
  543. package/dist/src/telemetry/uploader.d.ts +0 -11
  544. package/dist/src/telemetry/uploader.js +0 -46
  545. package/dist/src/telemetry/uploads.d.ts +0 -11
  546. package/dist/src/telemetry/uploads.js +0 -11
  547. package/dist/src/telemetry/version.d.ts +0 -4
  548. package/dist/src/telemetry/version.js +0 -14
  549. package/dist/src/telemetry/workspace.d.ts +0 -7
  550. package/dist/src/telemetry/workspace.js +1 -22
  551. package/dist/src/terminal-ui.d.ts +15 -524
  552. package/dist/src/terminal-ui.js +80 -876
  553. package/dist/src/test-edit-guard.d.ts +74 -0
  554. package/dist/src/test-edit-guard.js +269 -0
  555. package/dist/src/text.d.ts +0 -1
  556. package/dist/src/text.js +0 -1
  557. package/dist/src/time-limit.d.ts +0 -36
  558. package/dist/src/time-limit.js +0 -37
  559. package/dist/src/timers.d.ts +0 -161
  560. package/dist/src/timers.js +0 -126
  561. package/dist/src/todos.d.ts +0 -1
  562. package/dist/src/todos.js +0 -3
  563. package/dist/src/token-rate.d.ts +0 -94
  564. package/dist/src/token-rate.js +0 -154
  565. package/dist/src/tool-activity.d.ts +0 -6
  566. package/dist/src/tool-activity.js +1 -8
  567. package/dist/src/tool-availability.d.ts +0 -13
  568. package/dist/src/tool-availability.js +1 -14
  569. package/dist/src/tool-call-clock.d.ts +1 -4
  570. package/dist/src/tool-call-clock.js +0 -13
  571. package/dist/src/tool-catalog.d.ts +0 -11
  572. package/dist/src/tool-catalog.js +0 -23
  573. package/dist/src/tool-dependencies.d.ts +0 -5
  574. package/dist/src/tool-dependencies.js +0 -4
  575. package/dist/src/tool-diff-stats.d.ts +0 -23
  576. package/dist/src/tool-diff-stats.js +0 -49
  577. package/dist/src/tool-errors.d.ts +9 -7
  578. package/dist/src/tool-errors.js +13 -6
  579. package/dist/src/tool-failure-tracker.d.ts +3 -11
  580. package/dist/src/tool-failure-tracker.js +19 -27
  581. package/dist/src/tool-names.d.ts +0 -16
  582. package/dist/src/tool-names.js +0 -12
  583. package/dist/src/tool-profile.d.ts +6 -0
  584. package/dist/src/tool-profile.js +23 -0
  585. package/dist/src/tool-result-filter.d.ts +0 -19
  586. package/dist/src/tool-result-filter.js +1 -66
  587. package/dist/src/tool-schema-compatibility.d.ts +1 -2
  588. package/dist/src/tool-schema-compatibility.js +2 -7
  589. package/dist/src/tools.d.ts +0 -4
  590. package/dist/src/tools.js +11 -114
  591. package/dist/src/trajectory.d.ts +0 -13
  592. package/dist/src/trajectory.js +23 -79
  593. package/dist/src/transcript.d.ts +1 -37
  594. package/dist/src/transcript.js +11 -61
  595. package/dist/src/types.d.ts +2 -167
  596. package/dist/src/untracked-file-removal.d.ts +3 -0
  597. package/dist/src/untracked-file-removal.js +105 -0
  598. package/dist/src/update-check.d.ts +0 -14
  599. package/dist/src/update-check.js +2 -16
  600. package/dist/src/update.d.ts +4 -29
  601. package/dist/src/update.js +20 -98
  602. package/dist/src/usage-analytics.d.ts +17 -17
  603. package/dist/src/usage-analytics.js +168 -209
  604. package/dist/src/web-search.d.ts +0 -23
  605. package/dist/src/web-search.js +1 -27
  606. package/dist/src/widgets.d.ts +0 -25
  607. package/dist/src/widgets.js +0 -24
  608. package/dist/src/workspace-facts.d.ts +0 -12
  609. package/dist/src/workspace-facts.js +1 -18
  610. package/dist/src/workspace-git-metadata.d.ts +4 -5
  611. package/dist/src/workspace-git-metadata.js +37 -9
  612. package/dist/src/workspace-instructions.d.ts +3 -15
  613. package/dist/src/workspace-instructions.js +7 -20
  614. package/package.json +2 -2
@@ -1,23 +1,9 @@
1
1
  import type { Config } from './config.js';
2
2
  export declare function currentGraphSubject(): Promise<string | undefined>;
3
- /**
4
- * Whether the identity a choice was made under is still the one on this machine.
5
- *
6
- * A choice made while signed out was made under no identity, and a sign-in that lands while the
7
- * choice is still being prepared must not own it: the write would land on the account that just
8
- * signed in, over whatever it had chosen for itself. A client that names no identity at all is a
9
- * client from before the field, and its choice is written as it always was.
10
- */
11
3
  export declare function identityStillHolds(declared: {
12
4
  subject?: string;
13
5
  signedOut?: boolean;
14
6
  }, current: string | undefined): boolean;
15
- /** Legacy installation-wide selections have no reliable owner. Require explicit reselection. */
16
7
  export declare function configuredGraphSelection(config: Config, subject?: string): string;
17
8
  export declare function saveGraphSelection(config: Config, graph: string, subject?: string): void;
18
- /**
19
- * A deleted graph must not stay an account's configured editor default: startup selects it, and
20
- * the preflight falls back only for a membership refusal, so its missing file would abort the
21
- * launch. Point the account back at the bundled preset; other accounts keep their selections.
22
- */
23
9
  export declare function resetDeletedGraphSelection(config: Config, subject: string, graph: string): Config | undefined;
@@ -3,14 +3,6 @@ export async function currentGraphSubject() {
3
3
  const status = await getAuthStatus().catch(() => ({ signedIn: false, subject: undefined }));
4
4
  return status.signedIn && status.subject && /^[A-Za-z0-9-]{1,128}$/.test(status.subject) ? status.subject : undefined;
5
5
  }
6
- /**
7
- * Whether the identity a choice was made under is still the one on this machine.
8
- *
9
- * A choice made while signed out was made under no identity, and a sign-in that lands while the
10
- * choice is still being prepared must not own it: the write would land on the account that just
11
- * signed in, over whatever it had chosen for itself. A client that names no identity at all is a
12
- * client from before the field, and its choice is written as it always was.
13
- */
14
6
  export function identityStillHolds(declared, current) {
15
7
  if (declared.subject !== undefined)
16
8
  return current === declared.subject;
@@ -18,7 +10,6 @@ export function identityStillHolds(declared, current) {
18
10
  return current === undefined;
19
11
  return true;
20
12
  }
21
- /** Legacy installation-wide selections have no reliable owner. Require explicit reselection. */
22
13
  export function configuredGraphSelection(config, subject) {
23
14
  return subject && Object.hasOwn(config.graphSelections ?? {}, subject) ? config.graphSelections[subject] : 'default';
24
15
  }
@@ -29,11 +20,6 @@ export function saveGraphSelection(config, graph, subject) {
29
20
  config.graphSelections = { ...config.graphSelections, [subject]: graph };
30
21
  delete config.graph;
31
22
  }
32
- /**
33
- * A deleted graph must not stay an account's configured editor default: startup selects it, and
34
- * the preflight falls back only for a membership refusal, so its missing file would abort the
35
- * launch. Point the account back at the bundled preset; other accounts keep their selections.
36
- */
37
23
  export function resetDeletedGraphSelection(config, subject, graph) {
38
24
  if (config.graphSelections?.[subject] !== graph)
39
25
  return undefined;
@@ -2,29 +2,21 @@ import { type Config } from './config.js';
2
2
  import { type Membership } from './membership.js';
3
3
  import { GraphSync } from './graph-sync.js';
4
4
  import { GraphManagerChat, type ManagerGraphRevision } from './graph-manager-chat.js';
5
- /** What the Graph Manager routes need of the chat; a test supplies a stand-in for the engine-backed one. */
6
- /**
7
- * What the Graph Manager chat reads after each `graphs` call: the graph's latest stored revision, and
8
- * whether it is the one a deletion publishes. Undefined for a graph with nothing stored.
9
- */
10
5
  export declare function readManagerGraphRevision(id: string, graphDirectory: string): Promise<ManagerGraphRevision | undefined>;
11
6
  export type GraphManagerChatSession = Pick<GraphManagerChat, 'subscribe' | 'send' | 'approve' | 'answer' | 'cancel' | 'reset' | 'close'>;
12
7
  export declare function createGraphSessionCheck(subject: string | undefined, status?: (signal?: AbortSignal) => Promise<import("./auth/types.js").AuthStatus>, membership?: (signal?: AbortSignal, home?: string) => Promise<Membership>): () => Promise<void>;
8
+ export declare const EDITOR_MEMBERSHIP_TTL_MS = 30000;
9
+ export declare function sharedRead<T>(read: () => Promise<T>, ttlMs: number, now?: () => number): () => Promise<T>;
13
10
  export declare function requireGraphProviders(directory?: string): Promise<Config>;
14
11
  export declare function startGraphServer(directory?: string, checkMembership?: () => Promise<unknown>, options?: {
15
12
  membership?: () => Promise<Membership>;
16
13
  sync?: GraphSync;
17
- managerChat?: (directory: string) => GraphManagerChatSession;
14
+ managerChat?: (directory: string, graphId: string) => GraphManagerChatSession;
18
15
  }): Promise<{
19
16
  url: string;
20
17
  origin: string;
21
18
  token: string;
22
19
  close: () => Promise<void>;
23
20
  }>;
24
- /**
25
- * Reset the configured selection only after the deletion succeeds. Otherwise a graph-lock
26
- * timeout would change the next CLI launch even though the graph still exists. A crash
27
- * between removal and reset is handled by the CLI's missing-selection fallback.
28
- */
29
21
  export declare function deleteGraphWithTombstone(id: string, graphDirectory: string, directory: string, subject: string | undefined, sync: Pick<GraphSync, 'forgetGraph'> | undefined): Promise<void>;
30
22
  export declare function launchGraphEditor(noOpen?: boolean): Promise<void>;
@@ -6,7 +6,7 @@ import { execFile } from 'node:child_process';
6
6
  import { changeConfigFile, configDirectory, loadConfig, validateConfig } from './config.js';
7
7
  import { stampGraphProviderProfiles } from './graph-provider-portability.js';
8
8
  import { resetDeletedGraphSelection } from './graph-selection.js';
9
- import { listGraphs, loadGraph, saveGraph, validateGraph, migrateGraphForEditor, deleteGraph, isDeletedGraph, withoutDeletedGraphs, GRAPH_MANAGER_GRAPH_ID, reservedGraphId } from './graphs.js';
9
+ import { listGraphs, loadGraph, saveGraph, saveGraphOrder, validateGraph, migrateGraphForEditor, deleteGraph, isDeletedGraph, withoutDeletedGraphs, GRAPH_MANAGER_GRAPH_ID, reservedGraphId } from './graphs.js';
10
10
  import { createTools } from './tools.js';
11
11
  import { AutomationStore } from './automations.js';
12
12
  import { deleteAgentDefinition, exportAgentDefinition, importAgentDefinition, listAgentDefinitions, readAgentDefinition, saveAgentDefinition, validateAgentDefinition } from './agent-definitions.js';
@@ -22,23 +22,14 @@ import { GraphSync } from './graph-sync.js';
22
22
  import { editorSkillCatalog } from './skills/invocable-skills.js';
23
23
  import { graphRevisionHistory, previewGraphRoutes, studioRuns, studioRunEvents } from './graph-studio-features.js';
24
24
  import { GraphManagerChat } from './graph-manager-chat.js';
25
- /** What the Graph Manager routes need of the chat; a test supplies a stand-in for the engine-backed one. */
26
- /**
27
- * What the Graph Manager chat reads after each `graphs` call: the graph's latest stored revision, and
28
- * whether it is the one a deletion publishes. Undefined for a graph with nothing stored.
29
- */
30
25
  export function readManagerGraphRevision(id, graphDirectory) {
31
26
  return loadGraph(id, undefined, graphDirectory).then(graph => ({ revision: graph.revision, deleted: isDeletedGraph(graph) }), () => undefined);
32
27
  }
33
- /** The largest request body the editor accepts for a graph, whether it is being saved or sent to Graph Manager. */
28
+ const MANAGER_GRAPH_ID = /^[\w-]{1,120}$/;
34
29
  const GRAPH_BODY_LIMIT = 512 * 1024;
30
+ const PROVIDER_GLYPHS = ['alibaba-cloud', 'anthropic', 'aws-bedrock', 'claude', 'deepseek', 'fireworks', 'kimi', 'minimax', 'openai', 'opencode', 'openrouter', 'xai', 'xiaomi-mimo', 'zai'];
35
31
  const MANAGER_TOO_LARGE = 'This graph is too large to send to Graph Manager.';
36
32
  const MANAGER_PING_MS = 15_000;
37
- /**
38
- * Reads a request body of at most `limit` bytes; undefined when it is larger. An oversized body is
39
- * read to its end without being kept: leaving the loop early would destroy the request, and the
40
- * connection with it, before the refusal could be delivered.
41
- */
42
33
  async function readBody(req, limit) {
43
34
  let size = 0;
44
35
  let chunks = [];
@@ -65,13 +56,25 @@ export function createGraphSessionCheck(subject, status = getAuthStatus, members
65
56
  revoked = true;
66
57
  throw new PaidMembershipRequiredError();
67
58
  }
68
- // A free account keeps its editor: the free allowance is enforced on save, not by revoking the session.
69
59
  if (!access.paid && !access.unavailable && !access.subject) {
70
60
  revoked = true;
71
61
  throw new PaidMembershipRequiredError();
72
62
  }
73
63
  };
74
64
  }
65
+ // One editor page load is about thirty requests, each of which checks the session. Callers that
66
+ // arrive together share one read, and an answer is reused for `ttlMs` (0 shares in-flight reads only).
67
+ export const EDITOR_MEMBERSHIP_TTL_MS = 30_000;
68
+ export function sharedRead(read, ttlMs, now = Date.now) {
69
+ let pending;
70
+ let held;
71
+ return () => {
72
+ if (held && now() - held.at < ttlMs)
73
+ return Promise.resolve(held.value);
74
+ pending ??= read().then(value => { held = { at: now(), value }; return value; }).finally(() => { pending = undefined; });
75
+ return pending;
76
+ };
77
+ }
75
78
  export async function requireGraphProviders(directory = configDirectory()) {
76
79
  let value;
77
80
  try {
@@ -90,11 +93,8 @@ export async function requireGraphProviders(directory = configDirectory()) {
90
93
  catch {
91
94
  throw new Error('Invalid provider configuration. Run `andorra` and open `/providers` to repair it.');
92
95
  }
93
- // Loaded through the configuration reader so saved API keys come back from the OS credential store;
94
- // a store that cannot be read says so rather than passing for an invalid file.
95
96
  return await loadConfig(directory);
96
97
  }
97
- /** Graph editing may be provider-free, but invalid config keeps actionable repair guidance. */
98
98
  async function editorConfig(directory) {
99
99
  try {
100
100
  return await loadConfig(directory);
@@ -106,18 +106,17 @@ async function editorConfig(directory) {
106
106
  export async function startGraphServer(directory = configDirectory(), checkMembership = readGraphMembership, options = {}) {
107
107
  await editorConfig(directory);
108
108
  const startup = await checkMembership();
109
- // A caller supplying its own authorization check has no production account binding.
110
109
  const account = checkMembership === readGraphMembership ? await getAuthStatus() : { signedIn: false, subject: undefined };
111
110
  const graphDirectory = account.subject ? await graphStorageDirectory(directory, account.subject, true) : directory;
112
- // A caller may bring its own store of drafts: a test has no signed-in account to bind one to.
113
111
  const sync = options.sync ?? (account.subject ? new GraphSync(graphDirectory, account.subject) : undefined);
114
112
  await sync?.start();
115
- const checkSession = checkMembership === readGraphMembership ? createGraphSessionCheck(account.subject) : checkMembership;
116
- // Whether this account is held to the free allowance. A membership answer that could not be read
117
- // keeps the last verdict, so an outage neither lifts the allowance nor locks a paid account out. The
118
- // first verdict is the one startup read; with no verdict at all the allowance applies, because a
119
- // paid plan is never assumed.
120
- const readMembership = options.membership ?? (checkMembership === readGraphMembership ? getMembership : undefined);
113
+ // The sign-in state is local and read on every request, so signing out or switching accounts
114
+ // ends the session at once; the account service's answer is a network call and is reused briefly.
115
+ const sessionMembership = sharedRead(() => getMembership(), EDITOR_MEMBERSHIP_TTL_MS);
116
+ const checkSession = checkMembership === readGraphMembership
117
+ ? createGraphSessionCheck(account.subject, sharedRead(() => getAuthStatus(), 0), sessionMembership)
118
+ : checkMembership;
119
+ const readMembership = options.membership ?? (checkMembership === readGraphMembership ? sessionMembership : undefined);
121
120
  const seeded = checkMembership === readGraphMembership ? startup : undefined;
122
121
  let lastPaid = seeded && !seeded.unavailable ? seeded.paid : undefined;
123
122
  const freeTier = async () => {
@@ -130,21 +129,24 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
130
129
  };
131
130
  await freeTier();
132
131
  const token = randomBytes(32).toString('hex');
133
- // The Graph Manager chat owns a child engine, so it exists only once a panel asks for it. Revisions
134
- // are read from the folder this account's graphs are saved in, which is where the agent's saves land.
135
- const createManagerChat = options.managerChat ?? ((home) => new GraphManagerChat({
132
+ const createManagerChat = options.managerChat ?? ((home, _graphId) => new GraphManagerChat({
136
133
  directory: home,
137
134
  readRevision: id => readManagerGraphRevision(id, graphDirectory),
138
135
  }));
139
- let manager;
136
+ const managers = new Map();
140
137
  let closing = false;
141
- const managerChat = () => {
142
- // A request that outlives close() must not start an engine nothing would stop.
138
+ const managerChat = (graph) => {
143
139
  if (closing)
144
140
  throw new Error('The editor is closing.');
145
- return manager ??= createManagerChat(directory);
141
+ if (typeof graph !== 'string' || !MANAGER_GRAPH_ID.test(graph))
142
+ throw new Error('Graph Manager needs the id of the open graph.');
143
+ let chat = managers.get(graph);
144
+ if (!chat) {
145
+ chat = createManagerChat(directory, graph);
146
+ managers.set(graph, chat);
147
+ }
148
+ return chat;
146
149
  };
147
- /** Ends each open Graph Manager stream, so closing the server never waits on one. */
148
150
  const managerStreams = new Set();
149
151
  let origin = '';
150
152
  const assets = {
@@ -165,29 +167,23 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
165
167
  '/icons.js': ['icons.js', 'text/javascript; charset=utf-8'],
166
168
  '/controls.js': ['controls.js', 'text/javascript; charset=utf-8'],
167
169
  '/skill-picker.js': ['skill-picker.js', 'text/javascript; charset=utf-8'],
170
+ '/model-picker.js': ['model-picker.js', 'text/javascript; charset=utf-8'],
168
171
  '/controls.css': ['controls.css', 'text/css; charset=utf-8'],
169
172
  '/style.css': ['style.css', 'text/css; charset=utf-8'],
170
173
  '/library.css': ['library.css', 'text/css; charset=utf-8'],
171
174
  '/tokens.css': ['tokens.css', 'text/css; charset=utf-8'],
172
175
  '/theme.js': ['theme.js', 'text/javascript; charset=utf-8'],
173
- // The editor renders the desktop client's face, so it serves the same font files from its own
174
- // origin rather than falling back to the system's.
175
176
  '/fonts/geist-sans-latin-400-normal.woff2': ['fonts/geist-sans-latin-400-normal.woff2', 'font/woff2'],
176
177
  '/fonts/geist-sans-latin-500-normal.woff2': ['fonts/geist-sans-latin-500-normal.woff2', 'font/woff2'],
177
178
  '/fonts/geist-mono-latin-400-normal.woff2': ['fonts/geist-mono-latin-400-normal.woff2', 'font/woff2'],
178
179
  '/andorra-logo.png': ['andorra-logo.png', 'image/png'],
179
180
  };
181
+ for (const logo of PROVIDER_GLYPHS)
182
+ assets[`/provider-glyphs/${logo}.png`] = [`provider-glyphs/${logo}.png`, 'image/png'];
180
183
  const reply = (res, status, value) => {
181
184
  res.writeHead(status, { 'Content-Type': 'application/json; charset=utf-8' });
182
185
  res.end(JSON.stringify(value));
183
186
  };
184
- // The editor's provider registry payload. `baseUrl` is included deliberately: it is the one
185
- // non-secret field that distinguishes a provider whose id, type, active model, and configured
186
- // models are otherwise unchanged, and the client's applyProviderRegistry invalidates its
187
- // per-provider model-discovery caches only when this payload differs — an endpoint swap must
188
- // be visible to it, or the editor keeps serving the previous endpoint's catalog. `label` is
189
- // derived from the whole list, so a second Codex account also reaches the editor as a change.
190
- // Credentials (apiKey, apiKeyEnv) stay out.
191
187
  const providerRegistryPayload = (providers) => providers.map(provider => ({ id: provider.id, model: provider.model, models: provider.models, type: provider.type, baseUrl: provider.baseUrl, label: providerLabel(provider, providers) }));
192
188
  const liveEditorState = async () => {
193
189
  const [{ pid: _pid, ...status }, config] = await Promise.all([readActivity(directory), editorConfig(directory)]);
@@ -201,16 +197,12 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
201
197
  res.setHeader('Cache-Control', 'no-store');
202
198
  res.setHeader('X-Content-Type-Options', 'nosniff');
203
199
  res.setHeader('Referrer-Policy', 'no-referrer');
204
- // The editor may be framed only by our packaged Tauri window (macOS custom protocol and
205
- // Windows/Linux virtual host) or the fixed local Tauri dev server. Arbitrary websites remain
206
- // unable to frame the token-gated editing UI; origin/host checks still protect every request.
207
200
  res.setHeader('Content-Security-Policy', "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; connect-src 'self'; frame-ancestors tauri://localhost http://tauri.localhost http://127.0.0.1:7347; base-uri 'none'; form-action 'none'");
208
201
  try {
209
202
  if (req.headers.host !== new URL(origin).host || (req.headers.origin && req.headers.origin !== origin)) {
210
203
  reply(res, 403, { error: 'Untrusted origin' });
211
204
  return;
212
205
  }
213
- // Re-check even after launch: logout or removal from the paid group revokes this editor session.
214
206
  if (sync?.accessDenied)
215
207
  throw new PaidMembershipRequiredError();
216
208
  await checkSession();
@@ -218,8 +210,6 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
218
210
  if (path.startsWith('/api/')) {
219
211
  const expected = Buffer.from(`Bearer ${token}`);
220
212
  const authorized = (value) => { const supplied = Buffer.from(value); return supplied.length === expected.length && timingSafeEqual(supplied, expected); };
221
- // EventSource cannot send an Authorization header, so the two event streams alone also
222
- // accept the session token in the query string.
223
213
  const streamQuery = path === '/api/activity/stream' || path === '/api/manager/stream' ? `Bearer ${new URL(req.url, origin).searchParams.get('token') ?? ''}` : undefined;
224
214
  if (!authorized(req.headers.authorization ?? '') && !(streamQuery !== undefined && authorized(streamQuery))) {
225
215
  reply(res, 401, { error: 'Reopen the editor using andorra graph.' });
@@ -245,10 +235,6 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
245
235
  return;
246
236
  inFlight = true;
247
237
  try {
248
- // Re-check even mid-stream: logout or a membership downgrade revokes an open feed the
249
- // same way it revokes any other editor request. Checked every 5 s rather than every
250
- // tick to match the page's own polling cadence; a definitive revocation closes the
251
- // stream, and the client clears its state once reconnect attempts have failed.
252
238
  if (ticks > 0 && ticks % 5 === 0) {
253
239
  try {
254
240
  if (sync?.accessDenied)
@@ -260,7 +246,7 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
260
246
  try {
261
247
  res.end();
262
248
  }
263
- catch { /* The socket is already gone. */ }
249
+ catch { }
264
250
  return;
265
251
  }
266
252
  }
@@ -279,7 +265,7 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
279
265
  res.write(': ping\n\n');
280
266
  ticks++;
281
267
  }
282
- catch { /* Keep streaming the last known activity. */ }
268
+ catch { }
283
269
  }
284
270
  finally {
285
271
  inFlight = false;
@@ -290,7 +276,7 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
290
276
  return;
291
277
  }
292
278
  if (req.method === 'GET' && path === '/api/manager/stream') {
293
- const chat = managerChat();
279
+ const chat = managerChat(new URL(req.url, origin).searchParams.get('graph'));
294
280
  res.writeHead(200, { 'Content-Type': 'text/event-stream; charset=utf-8', 'Cache-Control': 'no-store' });
295
281
  res.flushHeaders?.();
296
282
  let open = true;
@@ -306,9 +292,8 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
306
292
  const end = () => { finish(); try {
307
293
  res.end();
308
294
  }
309
- catch { /* The socket is already gone. */ } };
295
+ catch { } };
310
296
  const timer = setInterval(() => {
311
- // Logout or a membership downgrade revokes an open stream like any other editor request.
312
297
  void (async () => { if (sync?.accessDenied)
313
298
  throw new PaidMembershipRequiredError(); await checkSession(); })()
314
299
  .then(() => { if (open && !res.destroyed)
@@ -317,7 +302,6 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
317
302
  managerStreams.add(end);
318
303
  req.on('close', finish);
319
304
  res.on('close', finish);
320
- // The chat hands over the conversation so far as a snapshot before anything else.
321
305
  unsubscribe = chat.subscribe(event => { if (open && !res.destroyed)
322
306
  res.write(`data: ${JSON.stringify(event)}\n\n`); });
323
307
  if (!open)
@@ -326,18 +310,8 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
326
310
  }
327
311
  if (req.method === 'POST' && path.startsWith('/api/manager/')) {
328
312
  const action = path.slice('/api/manager/'.length);
329
- // The chat reports what goes wrong on the engine's side as an `error` event on the stream,
330
- // and a message can take as long as an engine start, so no route waits for its outcome.
331
313
  const accepted = (work) => { void work.catch(() => { }); reply(res, 200, { ok: true }); };
332
- if (action === 'cancel') {
333
- accepted(managerChat().cancel());
334
- return;
335
- }
336
- if (action === 'reset') {
337
- accepted(managerChat().reset());
338
- return;
339
- }
340
- if (action === 'message' || action === 'approve' || action === 'answer') {
314
+ if (action === 'cancel' || action === 'reset' || action === 'message' || action === 'approve' || action === 'answer') {
341
315
  if (!req.headers['content-type']?.startsWith('application/json')) {
342
316
  reply(res, 415, { error: 'Expected application/json' });
343
317
  return;
@@ -349,16 +323,25 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
349
323
  }
350
324
  const parsed = JSON.parse(body.toString('utf8'));
351
325
  const value = parsed !== null && typeof parsed === 'object' && !Array.isArray(parsed) ? parsed : {};
326
+ const graphId = action === 'message' ? value.graph?.id : value.graphId;
327
+ if (action === 'cancel') {
328
+ accepted(managerChat(graphId).cancel());
329
+ return;
330
+ }
331
+ if (action === 'reset') {
332
+ accepted(managerChat(graphId).reset());
333
+ return;
334
+ }
352
335
  if (action === 'approve') {
353
336
  if (!filled(value.id) || typeof value.approved !== 'boolean')
354
337
  throw new Error('An approval needs its id and a decision.');
355
- accepted(managerChat().approve(value.id, value.approved));
338
+ accepted(managerChat(graphId).approve(value.id, value.approved));
356
339
  return;
357
340
  }
358
341
  if (action === 'answer') {
359
342
  if (!filled(value.id) || typeof value.value !== 'string')
360
343
  throw new Error('An answer needs the question id and a value.');
361
- accepted(managerChat().answer(value.id, value.value));
344
+ accepted(managerChat(graphId).answer(value.id, value.value));
362
345
  return;
363
346
  }
364
347
  const graph = value.graph;
@@ -368,7 +351,7 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
368
351
  throw new Error('Write a message for Graph Manager.');
369
352
  if (graph === null || typeof graph !== 'object' || Array.isArray(graph) || typeof graph.id !== 'string' || typeof graph.name !== 'string')
370
353
  throw new Error('A message to Graph Manager needs the open graph.');
371
- accepted(managerChat().send({
354
+ accepted(managerChat(graphId).send({
372
355
  provider: value.provider, model: value.model, text: value.text,
373
356
  graph: graph, saved: value.saved === true,
374
357
  ...(typeof value.revision === 'number' && Number.isInteger(value.revision) && value.revision >= 0 ? { revision: value.revision } : {}),
@@ -381,7 +364,6 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
381
364
  reply(res, 200, sync?.status ?? { state: 'pending', detail: 'Saved locally' });
382
365
  return;
383
366
  }
384
- // The prompt fields' `/` picker, and the names they warn about: this machine's skills.
385
367
  if (req.method === 'GET' && path === '/api/skills') {
386
368
  reply(res, 200, await editorSkillCatalog(config, AbortSignal.timeout(MODEL_LISTING_TIMEOUT_MS), directory));
387
369
  return;
@@ -411,9 +393,6 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
411
393
  const provider = config.providers.find(item => item.id === (params.get('provider') || config.provider));
412
394
  if (!provider)
413
395
  throw new Error('Choose a configured model profile.');
414
- // The saved configuration knows only the models the user typed; the endpoint knows every
415
- // model it serves, which is what lets the studio offer the whole catalog, not just the
416
- // active model.
417
396
  const discovered = await discoverModelMetadata(provider, AbortSignal.timeout(MODEL_LISTING_TIMEOUT_MS));
418
397
  reply(res, 200, { provider: provider.id, models: [...new Set(discovered.map(item => item.id).filter(Boolean))] });
419
398
  return;
@@ -438,20 +417,11 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
438
417
  const model = typeof value.model === 'string' ? value.model.trim() : '';
439
418
  if (!model || model.length > 500)
440
419
  throw new Error('Model name must be within 500 characters.');
441
- // Selecting a suggested model records it with the provider, mirroring what /model does on
442
- // selection. Execution validates a node's explicit model against the provider's configured
443
- // models (graph-provider-portability), so a discovered pick has to reach the same list the
444
- // endpoint offered it from, or the saved graph would refuse to run. The change is applied
445
- // under the configuration lock against the file as it is now, not the snapshot read when
446
- // the request opened: two overlapping recordings merge instead of the later write dropping
447
- // the earlier selection, and provider edits made in between survive.
448
420
  const saved = await changeConfigFile(directory, current => {
449
421
  const target = current.providers.find(item => item.id === requested);
450
422
  if (!target)
451
423
  throw new Error('Choose a configured model profile.');
452
424
  recordProviderModel(target, model);
453
- // validateConfig rejects an external-subagent pair whose provider has an explicit model
454
- // list that omits the pair's model, so materializing the list must carry it along.
455
425
  const pair = current.externalSubagent;
456
426
  if (pair && pair.provider === target.id && target.models && !target.models.includes(pair.model))
457
427
  target.models.push(pair.model);
@@ -468,7 +438,6 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
468
438
  graphMigrationErrors.push({ id, name: id, error: error instanceof Error ? error.message : 'Graph load failed' });
469
439
  });
470
440
  const free = await freeTier();
471
- // Deleted graphs stay out of the editor; restoring one goes through the graph MCP server.
472
441
  for (const saved of withoutDeletedGraphs(savedGraphs)) {
473
442
  try {
474
443
  graphs.push(migrateGraphForEditor(saved, { addOrchestrator: !free }));
@@ -480,7 +449,7 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
480
449
  const plan = free
481
450
  ? { paid: false, customGraphLimit: FREE_CUSTOM_GRAPH_LIMIT, nodeLimit: FREE_GRAPH_NODE_LIMIT, ...await readGraphQuota(graphDirectory, savedGraphs) }
482
451
  : { paid: true };
483
- reply(res, 200, { plan, graphs, graphMigrationErrors, definitions: await listAgentDefinitions(directory), defaultProvider: config.provider, providers: providerRegistryPayload(config.providers), tools: [...createTools().filter(tool => tool.providerVisible !== false).map(tool => tool.name), 'git_read', 'read_artifact', 'write_artifact', 'repo_explore', 'memory_search', 'read_skill_resource', 'browser.panel', 'browser.incognito'], runtime: { spawnAvailable: true, rawShellForSubagents: false, browser: true, deployment: false } });
452
+ reply(res, 200, { plan, graphs, graphMigrationErrors, definitions: await listAgentDefinitions(directory), defaultProvider: config.provider, providers: providerRegistryPayload(config.providers), tools: [...createTools().filter(tool => tool.providerVisible !== false).map(tool => tool.name), 'git_read', 'read_artifact', 'write_artifact', 'repo_explore', 'memory_search', 'read_skill_resource', 'browser.panel', 'browser.incognito', 'browser.extensions'], runtime: { spawnAvailable: true, rawShellForSubagents: false, browser: true, deployment: false } });
484
453
  return;
485
454
  }
486
455
  if (req.method === 'GET' && /^\/api\/graphs\/[\w-]+\/revisions$/.test(path)) {
@@ -491,11 +460,23 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
491
460
  if (req.method === 'GET' && /^\/api\/graphs\/[\w-]+\/revisions\/[1-9]\d*$/.test(path)) {
492
461
  const segments = path.split('/');
493
462
  const graph = await loadGraph(segments[3], Number(segments[5]), graphDirectory);
494
- // Immutable snapshots remain untouched on disk; return an editor-ready
495
- // copy so historical restore does not resave an obsolete schema.
496
463
  reply(res, 200, migrateGraphForEditor(graph, { addOrchestrator: !await freeTier() }));
497
464
  return;
498
465
  }
466
+ if (req.method === 'PUT' && path === '/api/graph-order') {
467
+ if (!req.headers['content-type']?.startsWith('application/json')) {
468
+ reply(res, 415, { error: 'Expected application/json' });
469
+ return;
470
+ }
471
+ const body = await readBody(req, GRAPH_BODY_LIMIT);
472
+ if (!body) {
473
+ reply(res, 413, { error: 'Request exceeds 512 KiB' });
474
+ return;
475
+ }
476
+ const value = JSON.parse(body.toString('utf8'));
477
+ reply(res, 200, { order: await saveGraphOrder(value?.order, graphDirectory) });
478
+ return;
479
+ }
499
480
  if (req.method === 'GET' && path === '/api/runs') {
500
481
  const id = new URL(req.url, origin).searchParams.get('graph') || '';
501
482
  if (!account.subject && checkMembership === readGraphMembership)
@@ -517,8 +498,6 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
517
498
  }
518
499
  if (req.method === 'DELETE' && /^\/api\/graphs\/[\w-]+$/.test(path)) {
519
500
  const id = path.split('/').at(-1);
520
- // The preset is bundled with the CLI: it has no storage to remove, and hiding it would
521
- // only last until the next launch.
522
501
  if (id === 'default') {
523
502
  reply(res, 400, { error: 'The bundled default graph cannot be deleted.' });
524
503
  return;
@@ -527,8 +506,6 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
527
506
  reply(res, 400, { error: reservedGraphId(id).message });
528
507
  return;
529
508
  }
530
- // forgetGraph schedules the post-delete sync pass itself; scheduling another here
531
- // would bump the pass generation and traverse the whole history twice per delete.
532
509
  await deleteGraphWithTombstone(id, graphDirectory, directory, account.subject, sync);
533
510
  reply(res, 200, { deleted: id });
534
511
  return;
@@ -554,8 +531,6 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
554
531
  return;
555
532
  }
556
533
  const value = JSON.parse(body.toString('utf8'));
557
- // The deletion marker is set only through the graph MCP server's delete tool, which confirms
558
- // with the person and checks automations first; an ordinary save may not carry it.
559
534
  if (path === '/api/graphs' && value && typeof value === 'object' && value.metadata && typeof value.metadata === 'object' && Object.hasOwn(value.metadata, 'deletedAt')) {
560
535
  reply(res, 400, { error: 'metadata.deletedAt is reserved for deleting a graph through the graph MCP server.' });
561
536
  return;
@@ -575,7 +550,6 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
575
550
  return;
576
551
  }
577
552
  if (path === '/api/definitions/import') {
578
- // The client mints the new id, so a retry after a lost response confirms its earlier write.
579
553
  if (!value || typeof value !== 'object' || typeof value.id !== 'string')
580
554
  throw new Error('Import needs a new Agent id and the shared Agent file.');
581
555
  reply(res, 200, await importAgentDefinition(value.file, value.id, { providers: config.providers, defaultProvider: config.provider, spawnAvailable: true }, directory));
@@ -602,7 +576,6 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
602
576
  reply(res, 200, { graph });
603
577
  return;
604
578
  }
605
- // Stamping can add profile entries after the streamed body already passed the limit.
606
579
  const stamped = stampGraphProviderProfiles(graph, config);
607
580
  if (Buffer.byteLength(JSON.stringify(stamped)) > GRAPH_BODY_LIMIT) {
608
581
  reply(res, 413, { error: 'Graph exceeds 512 KiB' });
@@ -610,8 +583,6 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
610
583
  }
611
584
  const expected = graph.revision === 0 ? null : graph.revision;
612
585
  const saved = await freeTier() ? await saveFreeTierGraph(stamped, expected, graphDirectory) : await saveGraph(stamped, expected, graphDirectory);
613
- // Do not claim a successful re-creation while its tombstone still excludes cloud
614
- // uploads and drafts. reviveGraph retries account-lock contention and reports errors.
615
586
  await sync?.reviveGraph(saved.id);
616
587
  void sync?.sync();
617
588
  reply(res, 200, saved);
@@ -630,7 +601,6 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
630
601
  res.end(content);
631
602
  }
632
603
  catch (error) {
633
- // A free-tier refusal is an answer to this request, not a revoked session, so it is not a 403.
634
604
  if (error instanceof FreeTierLimitError) {
635
605
  reply(res, 422, { error: error.message, code: error.code });
636
606
  return;
@@ -649,9 +619,8 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
649
619
  closing = true;
650
620
  for (const end of [...managerStreams])
651
621
  end();
652
- // The server goes down even when the chat's engine does not stop cleanly.
653
622
  try {
654
- await manager?.close();
623
+ await Promise.all([...managers.values()].map(chat => chat.close()));
655
624
  }
656
625
  finally {
657
626
  await sync?.close();
@@ -659,25 +628,15 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
659
628
  }
660
629
  } };
661
630
  }
662
- /**
663
- * Reset the configured selection only after the deletion succeeds. Otherwise a graph-lock
664
- * timeout would change the next CLI launch even though the graph still exists. A crash
665
- * between removal and reset is handled by the CLI's missing-selection fallback.
666
- */
667
631
  export async function deleteGraphWithTombstone(id, graphDirectory, directory, subject, sync) {
668
- // The signed-in path never reaches deleteGraph, so the built-in graph is refused here for both.
669
632
  if (id === GRAPH_MANAGER_GRAPH_ID)
670
633
  throw reservedGraphId(id);
671
- // An automation would fail at its next run; the user decides what it runs instead. The graph
672
- // MCP server's delete tool applies the same check, so the editor cannot bypass it.
673
634
  const users = (await new AutomationStore(directory).list()).filter(job => job.execution?.graph === id);
674
635
  if (users.length)
675
636
  throw new Error('Graph ' + id + ' is run by automation'
676
637
  + (users.length === 1 ? ' ' : 's ') + users.map(job => '"' + job.name + '"').join(', ')
677
638
  + '. Change or remove ' + (users.length === 1 ? 'it' : 'them') + ' first.');
678
639
  if (sync) {
679
- // forgetGraph already detaches the old folder under the graph lock. A second removal
680
- // here could erase a new graph that was saved under the same id after that detach.
681
640
  await sync.forgetGraph(id);
682
641
  }
683
642
  else {
@@ -1,5 +1,4 @@
1
1
  import { type Graph } from './graphs.js';
2
- /** All Studio previews are read-only. No graph runner, shell, or action tools are invoked here. */
3
2
  export interface RouteChoice {
4
3
  outcome?: string;
5
4
  output?: Record<string, unknown>;
@@ -18,9 +17,7 @@ export interface RoutePreview {
18
17
  completed: string[];
19
18
  truncated: boolean;
20
19
  }
21
- /** A conservative connectivity walkthrough, not a substitute for a real Agent/Join/Loop run. */
22
20
  export declare function previewGraphRoutes(graph: Graph, choices?: Record<string, RouteChoice>): RoutePreview;
23
- /** Saved revisions are immutable; restoring one means editing it as a new revision. */
24
21
  export declare function graphRevisionHistory(id: string, directory: string): Promise<{
25
22
  revision: number;
26
23
  name: string;
@@ -28,7 +25,6 @@ export declare function graphRevisionHistory(id: string, directory: string): Pro
28
25
  edgeCount: number;
29
26
  updatedAt: string | null;
30
27
  }[]>;
31
- /** Returns only recent, same-graph run summaries. A run's events are fetched separately. */
32
28
  export declare function studioRuns(directory: string, graphId: string, accountSubject?: string): Promise<{
33
29
  id: string;
34
30
  status: string;
@@ -36,7 +32,6 @@ export declare function studioRuns(directory: string, graphId: string, accountSu
36
32
  graphRevision: number | null;
37
33
  toolCalls: number | null;
38
34
  }[]>;
39
- /** Read a bounded tail: large coding runs must not make the local editor unresponsive. */
40
35
  export declare function studioRunEvents(directory: string, runId: string, graphId: string, accountSubject?: string): Promise<{
41
36
  status: string;
42
37
  truncated: boolean;