@andorra-labs/code 0.1.12 → 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 (592) hide show
  1. package/dist/src/account-presentation.d.ts +1 -37
  2. package/dist/src/account-presentation.js +2 -42
  3. package/dist/src/activity.d.ts +0 -25
  4. package/dist/src/activity.js +1 -23
  5. package/dist/src/agent-definitions.d.ts +0 -26
  6. package/dist/src/agent-definitions.js +0 -43
  7. package/dist/src/agent-execution.d.ts +0 -2
  8. package/dist/src/agent-execution.js +49 -416
  9. package/dist/src/agent-mcp-catalog.d.ts +0 -8
  10. package/dist/src/agent-mcp-catalog.js +0 -2
  11. package/dist/src/agent-mcp.d.ts +0 -56
  12. package/dist/src/agent-mcp.js +9 -153
  13. package/dist/src/agent-modifiers.d.ts +0 -1
  14. package/dist/src/agent-modifiers.js +25 -68
  15. package/dist/src/analytics.d.ts +0 -66
  16. package/dist/src/analytics.js +0 -45
  17. package/dist/src/anthropic-console-auth.d.ts +0 -24
  18. package/dist/src/anthropic-console-auth.js +0 -37
  19. package/dist/src/anthropic-credentials.d.ts +0 -25
  20. package/dist/src/anthropic-credentials.js +0 -28
  21. package/dist/src/app-server/protocol.d.ts +13 -245
  22. package/dist/src/app-server/protocol.js +1 -132
  23. package/dist/src/app-server/reasoning.d.ts +0 -31
  24. package/dist/src/app-server/reasoning.js +0 -54
  25. package/dist/src/app-server/terminal.d.ts +0 -36
  26. package/dist/src/app-server/terminal.js +3 -39
  27. package/dist/src/app-server/workspace.d.ts +0 -167
  28. package/dist/src/app-server/workspace.js +4 -406
  29. package/dist/src/app-server.d.ts +27 -927
  30. package/dist/src/app-server.js +537 -2992
  31. package/dist/src/artifacts.d.ts +0 -10
  32. package/dist/src/artifacts.js +1 -11
  33. package/dist/src/attachments.d.ts +4 -98
  34. package/dist/src/attachments.js +10 -130
  35. package/dist/src/auth/AuthManager.d.ts +0 -93
  36. package/dist/src/auth/AuthManager.js +3 -165
  37. package/dist/src/auth/callback-page.d.ts +0 -1
  38. package/dist/src/auth/callback-page.js +0 -4
  39. package/dist/src/auth/callback.d.ts +0 -25
  40. package/dist/src/auth/callback.js +1 -29
  41. package/dist/src/auth/deployment.d.ts +0 -16
  42. package/dist/src/auth/deployment.js +0 -16
  43. package/dist/src/auth/index.d.ts +0 -11
  44. package/dist/src/auth/index.js +0 -11
  45. package/dist/src/auth/lock.d.ts +0 -1
  46. package/dist/src/auth/lock.js +0 -1
  47. package/dist/src/auth/store.d.ts +7 -108
  48. package/dist/src/auth/store.js +21 -129
  49. package/dist/src/auth/types.d.ts +0 -8
  50. package/dist/src/auth-commands.d.ts +0 -5
  51. package/dist/src/auth-commands.js +0 -1
  52. package/dist/src/automation-runner.d.ts +0 -9
  53. package/dist/src/automation-runner.js +0 -11
  54. package/dist/src/automation-service.d.ts +0 -10
  55. package/dist/src/automation-service.js +3 -17
  56. package/dist/src/automation-tool.js +0 -5
  57. package/dist/src/automation-worker-shutdown.d.ts +0 -1
  58. package/dist/src/automation-worker-shutdown.js +0 -3
  59. package/dist/src/automations.d.ts +23 -2
  60. package/dist/src/automations.js +91 -12
  61. package/dist/src/background-tasks.d.ts +0 -23
  62. package/dist/src/background-tasks.js +0 -11
  63. package/dist/src/boot-trace.d.ts +0 -13
  64. package/dist/src/boot-trace.js +1 -14
  65. package/dist/src/browser-activity.js +0 -2
  66. package/dist/src/browser-bridge.d.ts +0 -2
  67. package/dist/src/browser-bridge.js +0 -27
  68. package/dist/src/browser-captcha-tool.d.ts +0 -13
  69. package/dist/src/browser-captcha-tool.js +3 -35
  70. package/dist/src/browser-extensions-tool.d.ts +24 -0
  71. package/dist/src/browser-extensions-tool.js +137 -0
  72. package/dist/src/browser-extensions.d.ts +127 -0
  73. package/dist/src/browser-extensions.js +729 -0
  74. package/dist/src/browser-observation.d.ts +0 -15
  75. package/dist/src/browser-observation.js +1 -22
  76. package/dist/src/browser-panel-tool.d.ts +1 -37
  77. package/dist/src/browser-panel-tool.js +3 -73
  78. package/dist/src/browser-runner.d.ts +0 -1
  79. package/dist/src/browser-runner.js +4 -45
  80. package/dist/src/browser-server.d.ts +0 -6
  81. package/dist/src/browser-server.js +6 -229
  82. package/dist/src/browser-session.d.ts +0 -25
  83. package/dist/src/browser-session.js +1 -71
  84. package/dist/src/browser-stealth.d.ts +0 -12
  85. package/dist/src/browser-stealth.js +0 -36
  86. package/dist/src/browser-ui/app.js +7 -174
  87. package/dist/src/browser-ui/style.css +0 -68
  88. package/dist/src/browser-ui/tokens.css +11 -93
  89. package/dist/src/browser-view.d.ts +47 -301
  90. package/dist/src/browser-view.js +333 -582
  91. package/dist/src/capabilities.d.ts +0 -8
  92. package/dist/src/capabilities.js +0 -29
  93. package/dist/src/capsolver.d.ts +0 -13
  94. package/dist/src/capsolver.js +0 -15
  95. package/dist/src/clarification-ui.d.ts +0 -7
  96. package/dist/src/clarification-ui.js +0 -8
  97. package/dist/src/claude-executable.d.ts +0 -1
  98. package/dist/src/claude-executable.js +1 -2
  99. package/dist/src/claude-provider.d.ts +6 -19
  100. package/dist/src/claude-provider.js +155 -63
  101. package/dist/src/cli-executable.d.ts +0 -16
  102. package/dist/src/cli-executable.js +0 -7
  103. package/dist/src/cli-process.d.ts +0 -26
  104. package/dist/src/cli-process.js +0 -18
  105. package/dist/src/cli-sign-in.d.ts +0 -20
  106. package/dist/src/cli-sign-in.js +1 -17
  107. package/dist/src/cli.d.ts +1 -55
  108. package/dist/src/cli.js +80 -721
  109. package/dist/src/code-intelligence/CodeIntelligenceManager.d.ts +4 -59
  110. package/dist/src/code-intelligence/CodeIntelligenceManager.js +26 -99
  111. package/dist/src/code-intelligence/ContextLedger.d.ts +0 -4
  112. package/dist/src/code-intelligence/ContextLedger.js +0 -10
  113. package/dist/src/code-intelligence/ContextRouter.d.ts +0 -6
  114. package/dist/src/code-intelligence/ContextRouter.js +0 -8
  115. package/dist/src/code-intelligence/codegraph/CodeGraphProjectSession.d.ts +0 -2
  116. package/dist/src/code-intelligence/codegraph/CodeGraphProjectSession.js +5 -12
  117. package/dist/src/code-intelligence/codegraph/CodeGraphProvider.d.ts +0 -6
  118. package/dist/src/code-intelligence/codegraph/CodeGraphProvider.js +0 -6
  119. package/dist/src/code-intelligence/codegraph/CodeGraphSyncBarrier.d.ts +0 -5
  120. package/dist/src/code-intelligence/codegraph/CodeGraphSyncBarrier.js +1 -17
  121. package/dist/src/code-intelligence/codegraph/repoExploreTool.d.ts +0 -5
  122. package/dist/src/code-intelligence/codegraph/repoExploreTool.js +0 -5
  123. package/dist/src/code-intelligence/repository.d.ts +0 -9
  124. package/dist/src/code-intelligence/repository.js +1 -11
  125. package/dist/src/code-intelligence/types.d.ts +0 -8
  126. package/dist/src/codex-auth.d.ts +0 -44
  127. package/dist/src/codex-auth.js +0 -45
  128. package/dist/src/codex-browser-auth.d.ts +0 -13
  129. package/dist/src/codex-browser-auth.js +3 -20
  130. package/dist/src/codex-errors.js +0 -2
  131. package/dist/src/codex-executable.d.ts +0 -2
  132. package/dist/src/codex-executable.js +1 -7
  133. package/dist/src/codex-provider.d.ts +0 -13
  134. package/dist/src/codex-provider.js +0 -28
  135. package/dist/src/codex-rpc.d.ts +0 -10
  136. package/dist/src/codex-rpc.js +0 -12
  137. package/dist/src/coding-tools.d.ts +4 -26
  138. package/dist/src/coding-tools.js +161 -181
  139. package/dist/src/command-metrics.d.ts +0 -4
  140. package/dist/src/command-output-tap.d.ts +0 -11
  141. package/dist/src/command-output-tap.js +0 -3
  142. package/dist/src/command-screens.d.ts +24 -0
  143. package/dist/src/command-screens.js +132 -100
  144. package/dist/src/commands.d.ts +6 -63
  145. package/dist/src/commands.js +20 -100
  146. package/dist/src/completion-gates.d.ts +0 -47
  147. package/dist/src/completion-gates.js +0 -14
  148. package/dist/src/completion.d.ts +0 -98
  149. package/dist/src/completion.js +2 -239
  150. package/dist/src/config.d.ts +11 -116
  151. package/dist/src/config.js +39 -171
  152. package/dist/src/context-budget.d.ts +0 -22
  153. package/dist/src/context-budget.js +0 -44
  154. package/dist/src/context-compaction.d.ts +29 -6
  155. package/dist/src/context-compaction.js +94 -25
  156. package/dist/src/context-selection.d.ts +0 -24
  157. package/dist/src/context-selection.js +0 -34
  158. package/dist/src/dashboard-view.d.ts +0 -2
  159. package/dist/src/dashboard-view.js +0 -35
  160. package/dist/src/dashboard.d.ts +0 -2
  161. package/dist/src/dashboard.js +0 -9
  162. package/dist/src/deadline.d.ts +0 -45
  163. package/dist/src/deadline.js +0 -54
  164. package/dist/src/decision/ContinuationAdapter.d.ts +0 -5
  165. package/dist/src/decision/ContinuationAdapter.js +0 -5
  166. package/dist/src/decision/DecisionEngine.d.ts +0 -4
  167. package/dist/src/decision/DecisionManager.d.ts +0 -1
  168. package/dist/src/decision/DecisionManager.js +2 -7
  169. package/dist/src/decision/DecisionPolicy.d.ts +0 -1
  170. package/dist/src/decision/DecisionPolicy.js +0 -1
  171. package/dist/src/decision/FactContinuations.d.ts +11 -43
  172. package/dist/src/decision/FactContinuations.js +126 -95
  173. package/dist/src/decision/FactServiceGate.d.ts +0 -1
  174. package/dist/src/decision/FactServiceGate.js +0 -4
  175. package/dist/src/decision/PreparedSteps.d.ts +0 -15
  176. package/dist/src/decision/PreparedSteps.js +0 -10
  177. package/dist/src/decision/applyToolMenu.d.ts +0 -1
  178. package/dist/src/decision/applyToolMenu.js +1 -5
  179. package/dist/src/decision/checks.d.ts +15 -28
  180. package/dist/src/decision/checks.js +118 -49
  181. package/dist/src/decision/facts.d.ts +0 -16
  182. package/dist/src/decision/facts.js +0 -30
  183. package/dist/src/decision/guidancePolicy.js +0 -1
  184. package/dist/src/decision/hostedPolicy.d.ts +0 -6
  185. package/dist/src/decision/hostedPolicy.js +0 -7
  186. package/dist/src/decision/hostedSkills.d.ts +0 -19
  187. package/dist/src/decision/hostedSkills.js +0 -19
  188. package/dist/src/decision/optimizationPolicy.d.ts +0 -3
  189. package/dist/src/decision/optimizationPolicy.js +1 -4
  190. package/dist/src/decision/providers/AndorraDecisionProvider.d.ts +0 -7
  191. package/dist/src/decision/providers/AndorraDecisionProvider.js +4 -27
  192. package/dist/src/decision/providers/HttpDecisionProvider.d.ts +0 -2
  193. package/dist/src/decision/providers/HttpDecisionProvider.js +0 -6
  194. package/dist/src/decision/routeTools.d.ts +0 -8
  195. package/dist/src/decision/routeTools.js +1 -8
  196. package/dist/src/decision/toolFamilies.d.ts +0 -1
  197. package/dist/src/decision/toolFamilies.js +0 -1
  198. package/dist/src/decision/toolMenu.d.ts +0 -3
  199. package/dist/src/decision/toolMenu.js +0 -4
  200. package/dist/src/decision/types.d.ts +0 -6
  201. package/dist/src/default-graph.d.ts +0 -9
  202. package/dist/src/default-graph.js +0 -9
  203. package/dist/src/delegation-changes.d.ts +0 -56
  204. package/dist/src/delegation-changes.js +4 -130
  205. package/dist/src/diff-preview.d.ts +0 -1
  206. package/dist/src/diff-preview.js +0 -17
  207. package/dist/src/duration.d.ts +0 -50
  208. package/dist/src/duration.js +0 -50
  209. package/dist/src/efficiency.d.ts +0 -39
  210. package/dist/src/efficiency.js +0 -16
  211. package/dist/src/engine/protocol.d.ts +0 -2
  212. package/dist/src/engine/protocol.js +0 -2
  213. package/dist/src/engine-streams.d.ts +0 -9
  214. package/dist/src/extensions.d.ts +3 -2
  215. package/dist/src/extensions.js +63 -35
  216. package/dist/src/favicons.d.ts +0 -26
  217. package/dist/src/favicons.js +0 -34
  218. package/dist/src/file-diff.d.ts +2 -58
  219. package/dist/src/file-diff.js +0 -32
  220. package/dist/src/file-read-key.d.ts +0 -7
  221. package/dist/src/file-read-key.js +0 -7
  222. package/dist/src/file-read-state.d.ts +0 -1
  223. package/dist/src/file-read-state.js +0 -4
  224. package/dist/src/firefox-cookies.d.ts +0 -34
  225. package/dist/src/firefox-cookies.js +1 -55
  226. package/dist/src/git-identity-audit.d.ts +27 -0
  227. package/dist/src/git-identity-audit.js +286 -0
  228. package/dist/src/git-identity-guard.d.ts +4 -0
  229. package/dist/src/git-identity-guard.js +998 -0
  230. package/dist/src/git-identity-hold.d.ts +12 -0
  231. package/dist/src/git-identity-hold.js +81 -0
  232. package/dist/src/git-summary.d.ts +0 -58
  233. package/dist/src/git-summary.js +2 -212
  234. package/dist/src/goal-completion-verification.d.ts +2 -2
  235. package/dist/src/goal-completion-verification.js +3 -6
  236. package/dist/src/graph-account.d.ts +0 -21
  237. package/dist/src/graph-account.js +0 -17
  238. package/dist/src/graph-editor-session.d.ts +0 -1
  239. package/dist/src/graph-editor-session.js +0 -3
  240. package/dist/src/graph-health.d.ts +0 -63
  241. package/dist/src/graph-health.js +0 -57
  242. package/dist/src/graph-manager-chat.d.ts +5 -155
  243. package/dist/src/graph-manager-chat.js +2 -177
  244. package/dist/src/graph-provider-portability.d.ts +1 -21
  245. package/dist/src/graph-provider-portability.js +6 -45
  246. package/dist/src/graph-quota.d.ts +0 -33
  247. package/dist/src/graph-quota.js +1 -44
  248. package/dist/src/graph-runner.d.ts +0 -1
  249. package/dist/src/graph-runner.js +31 -391
  250. package/dist/src/graph-selection.d.ts +0 -14
  251. package/dist/src/graph-selection.js +0 -14
  252. package/dist/src/graph-server.d.ts +2 -10
  253. package/dist/src/graph-server.js +39 -101
  254. package/dist/src/graph-studio-features.d.ts +0 -5
  255. package/dist/src/graph-studio-features.js +2 -42
  256. package/dist/src/graph-sync.d.ts +0 -78
  257. package/dist/src/graph-sync.js +5 -201
  258. package/dist/src/graph-tool.d.ts +0 -18
  259. package/dist/src/graph-tool.js +0 -27
  260. package/dist/src/graph-ui/app.js +152 -491
  261. package/dist/src/graph-ui/compat.js +0 -7
  262. package/dist/src/graph-ui/controls.css +0 -48
  263. package/dist/src/graph-ui/controls.js +0 -88
  264. package/dist/src/graph-ui/drafts.js +0 -12
  265. package/dist/src/graph-ui/edge-router.js +0 -62
  266. package/dist/src/graph-ui/embed.js +0 -59
  267. package/dist/src/graph-ui/icons.js +0 -8
  268. package/dist/src/graph-ui/library.css +0 -5
  269. package/dist/src/graph-ui/manager-markdown.js +0 -11
  270. package/dist/src/graph-ui/manager-state.js +1 -78
  271. package/dist/src/graph-ui/manager.css +0 -18
  272. package/dist/src/graph-ui/manager.js +3 -180
  273. package/dist/src/graph-ui/model-picker.js +0 -29
  274. package/dist/src/graph-ui/sidebar.js +2 -3
  275. package/dist/src/graph-ui/skill-picker.js +373 -39
  276. package/dist/src/graph-ui/studio-canvas.js +3 -38
  277. package/dist/src/graph-ui/studio.css +0 -18
  278. package/dist/src/graph-ui/studio.js +3 -71
  279. package/dist/src/graph-ui/style.css +11 -134
  280. package/dist/src/graph-ui/theme.js +1 -26
  281. package/dist/src/graph-ui/tokens.css +15 -114
  282. package/dist/src/graphs.d.ts +6 -157
  283. package/dist/src/graphs.js +65 -266
  284. package/dist/src/grep-regex-worker.js +0 -2
  285. package/dist/src/grep-regex.d.ts +1 -5
  286. package/dist/src/grep-regex.js +6 -8
  287. package/dist/src/grok-provider.d.ts +0 -17
  288. package/dist/src/grok-provider.js +1 -26
  289. package/dist/src/handoffs.d.ts +0 -11
  290. package/dist/src/handoffs.js +0 -13
  291. package/dist/src/hardened-runtime.d.ts +0 -10
  292. package/dist/src/hardened-runtime.js +8 -46
  293. package/dist/src/harness-home.d.ts +21 -0
  294. package/dist/src/harness-home.js +87 -0
  295. package/dist/src/host-process-guard.d.ts +0 -50
  296. package/dist/src/host-process-guard.js +0 -641
  297. package/dist/src/limits.d.ts +0 -64
  298. package/dist/src/limits.js +0 -62
  299. package/dist/src/managed-sign-in.d.ts +0 -12
  300. package/dist/src/managed-sign-in.js +0 -16
  301. package/dist/src/markdown.d.ts +0 -28
  302. package/dist/src/markdown.js +1 -175
  303. package/dist/src/mcp.d.ts +0 -99
  304. package/dist/src/mcp.js +4 -170
  305. package/dist/src/membership-errors.d.ts +0 -14
  306. package/dist/src/membership-errors.js +0 -13
  307. package/dist/src/membership.d.ts +2 -60
  308. package/dist/src/membership.js +0 -85
  309. package/dist/src/memory/LocalToolMemory.d.ts +0 -1
  310. package/dist/src/memory/LocalToolMemory.js +2 -7
  311. package/dist/src/memory/MemoryDistiller.js +0 -15
  312. package/dist/src/memory/MemoryManager.d.ts +0 -3
  313. package/dist/src/memory/MemoryManager.js +6 -18
  314. package/dist/src/memory/MemoryPolicy.d.ts +0 -2
  315. package/dist/src/memory/MemoryPolicy.js +0 -2
  316. package/dist/src/memory/MemoryProvider.d.ts +0 -6
  317. package/dist/src/memory/MemoryRetriever.js +0 -7
  318. package/dist/src/memory/PermissionMemoryProvider.d.ts +0 -1
  319. package/dist/src/memory/PermissionMemoryProvider.js +0 -1
  320. package/dist/src/memory/ProjectMemory.d.ts +5 -40
  321. package/dist/src/memory/ProjectMemory.js +22 -47
  322. package/dist/src/memory/ToolFailureLessons.d.ts +0 -3
  323. package/dist/src/memory/ToolFailureLessons.js +0 -6
  324. package/dist/src/memory/providers/NoOpMemoryProvider.d.ts +0 -1
  325. package/dist/src/memory/providers/NoOpMemoryProvider.js +0 -1
  326. package/dist/src/memory/redaction.d.ts +0 -5
  327. package/dist/src/memory/redaction.js +0 -11
  328. package/dist/src/memory/repository.d.ts +0 -6
  329. package/dist/src/memory/repository.js +2 -12
  330. package/dist/src/memory/types.d.ts +0 -1
  331. package/dist/src/model-health-cache.d.ts +0 -38
  332. package/dist/src/model-health-cache.js +1 -49
  333. package/dist/src/model-metadata.d.ts +0 -18
  334. package/dist/src/model-metadata.js +2 -42
  335. package/dist/src/model-override.d.ts +0 -36
  336. package/dist/src/model-override.js +0 -43
  337. package/dist/src/model-tiers.d.ts +0 -13
  338. package/dist/src/model-tiers.js +0 -23
  339. package/dist/src/opencode-catalog.d.ts +0 -2
  340. package/dist/src/opencode-catalog.js +0 -11
  341. package/dist/src/opencode-cli-provider.d.ts +0 -35
  342. package/dist/src/opencode-cli-provider.js +1 -44
  343. package/dist/src/opencode-provider.d.ts +0 -2
  344. package/dist/src/opencode-provider.js +1 -16
  345. package/dist/src/package-name.d.ts +0 -2
  346. package/dist/src/package-name.js +0 -2
  347. package/dist/src/paged-transcript.d.ts +0 -11
  348. package/dist/src/paged-transcript.js +2 -20
  349. package/dist/src/palette.d.ts +0 -63
  350. package/dist/src/palette.js +0 -63
  351. package/dist/src/permissions.d.ts +0 -15
  352. package/dist/src/permissions.js +0 -17
  353. package/dist/src/powershell-pool.d.ts +0 -9
  354. package/dist/src/powershell-pool.js +3 -26
  355. package/dist/src/process-warnings.d.ts +4 -0
  356. package/dist/src/process-warnings.js +103 -0
  357. package/dist/src/profile.d.ts +0 -43
  358. package/dist/src/profile.js +0 -43
  359. package/dist/src/project-reservation.d.ts +11 -0
  360. package/dist/src/project-reservation.js +143 -0
  361. package/dist/src/provider-connection.d.ts +0 -18
  362. package/dist/src/provider-connection.js +0 -39
  363. package/dist/src/provider-engine.d.ts +0 -21
  364. package/dist/src/provider-engine.js +1 -96
  365. package/dist/src/provider-import.d.ts +0 -49
  366. package/dist/src/provider-import.js +0 -60
  367. package/dist/src/provider-keys.d.ts +1 -36
  368. package/dist/src/provider-keys.js +5 -48
  369. package/dist/src/provider-settings.d.ts +0 -2
  370. package/dist/src/provider-settings.js +0 -32
  371. package/dist/src/providers.d.ts +0 -217
  372. package/dist/src/providers.js +0 -315
  373. package/dist/src/pull-requests.d.ts +0 -173
  374. package/dist/src/pull-requests.js +5 -195
  375. package/dist/src/qa/browser/PlaywrightRunner.d.ts +0 -7
  376. package/dist/src/qa/browser/PlaywrightRunner.js +2 -16
  377. package/dist/src/qa/command-policy.d.ts +0 -23
  378. package/dist/src/qa/command-policy.js +0 -30
  379. package/dist/src/qa/guidance.d.ts +0 -21
  380. package/dist/src/qa/guidance.js +0 -20
  381. package/dist/src/qa/profile/ProjectInspector.d.ts +0 -4
  382. package/dist/src/qa/profile/ProjectInspector.js +0 -6
  383. package/dist/src/qa/profile/QaConfigLoader.d.ts +0 -7
  384. package/dist/src/qa/profile/QaConfigLoader.js +0 -6
  385. package/dist/src/qa/profile/QaProfile.d.ts +0 -7
  386. package/dist/src/qa/profile/QaProfile.js +0 -7
  387. package/dist/src/qa/profile/yaml.d.ts +0 -9
  388. package/dist/src/qa/profile/yaml.js +0 -13
  389. package/dist/src/qa/qa-authorize.d.ts +0 -19
  390. package/dist/src/qa/qa-authorize.js +4 -11
  391. package/dist/src/qa/runtime/ProcessManager.d.ts +0 -31
  392. package/dist/src/qa/runtime/ProcessManager.js +4 -41
  393. package/dist/src/qa/runtime/PtyManager.d.ts +0 -4
  394. package/dist/src/qa/runtime/PtyManager.js +1 -7
  395. package/dist/src/qa/runtime/changes.d.ts +0 -11
  396. package/dist/src/qa/runtime/changes.js +1 -3
  397. package/dist/src/qa/tools.d.ts +0 -10
  398. package/dist/src/qa/tools.js +0 -12
  399. package/dist/src/qa/types.d.ts +0 -13
  400. package/dist/src/react-runtime.d.ts +2 -21
  401. package/dist/src/react-runtime.js +95 -415
  402. package/dist/src/read-document-doc.d.ts +0 -6
  403. package/dist/src/read-document-doc.js +0 -55
  404. package/dist/src/read-document-docx.d.ts +0 -16
  405. package/dist/src/read-document-docx.js +2 -69
  406. package/dist/src/read-document-text.d.ts +0 -17
  407. package/dist/src/read-document-text.js +0 -22
  408. package/dist/src/read-document-tool.d.ts +0 -31
  409. package/dist/src/read-document-tool.js +0 -30
  410. package/dist/src/read-document.d.ts +0 -49
  411. package/dist/src/read-document.js +1 -67
  412. package/dist/src/read-image.d.ts +0 -32
  413. package/dist/src/read-image.js +0 -33
  414. package/dist/src/remote/cert.d.ts +0 -18
  415. package/dist/src/remote/cert.js +0 -44
  416. package/dist/src/remote/client.d.ts +0 -70
  417. package/dist/src/remote/client.js +1 -116
  418. package/dist/src/remote/command.js +0 -17
  419. package/dist/src/remote/engine-pool.d.ts +0 -152
  420. package/dist/src/remote/engine-pool.js +17 -335
  421. package/dist/src/remote/errors.d.ts +0 -15
  422. package/dist/src/remote/errors.js +0 -7
  423. package/dist/src/remote/network.d.ts +0 -26
  424. package/dist/src/remote/network.js +1 -34
  425. package/dist/src/remote/pairing.d.ts +16 -51
  426. package/dist/src/remote/pairing.js +50 -57
  427. package/dist/src/remote/pem.d.ts +0 -4
  428. package/dist/src/remote/pem.js +0 -4
  429. package/dist/src/remote/roots.d.ts +0 -20
  430. package/dist/src/remote/roots.js +0 -8
  431. package/dist/src/remote/serve.d.ts +0 -47
  432. package/dist/src/remote/serve.js +0 -30
  433. package/dist/src/remote/server.d.ts +0 -14
  434. package/dist/src/remote/server.js +1 -79
  435. package/dist/src/remote/types.d.ts +1 -32
  436. package/dist/src/remote/types.js +0 -10
  437. package/dist/src/run-control.d.ts +0 -7
  438. package/dist/src/run-control.js +0 -7
  439. package/dist/src/run-progress.d.ts +0 -170
  440. package/dist/src/run-progress.js +0 -285
  441. package/dist/src/run-records.d.ts +0 -443
  442. package/dist/src/run-records.js +14 -687
  443. package/dist/src/run-temp.d.ts +12 -0
  444. package/dist/src/run-temp.js +50 -0
  445. package/dist/src/runtime.d.ts +10 -228
  446. package/dist/src/runtime.js +0 -127
  447. package/dist/src/sandbox-child.js +0 -1
  448. package/dist/src/save-lock.d.ts +0 -12
  449. package/dist/src/save-lock.js +0 -28
  450. package/dist/src/screen-selection.d.ts +0 -23
  451. package/dist/src/screen-selection.js +0 -22
  452. package/dist/src/secret-redaction.d.ts +0 -12
  453. package/dist/src/secret-redaction.js +0 -45
  454. package/dist/src/session-changes.d.ts +4 -80
  455. package/dist/src/session-changes.js +25 -130
  456. package/dist/src/session-goal.d.ts +129 -0
  457. package/dist/src/session-goal.js +230 -0
  458. package/dist/src/session-monitor.d.ts +1 -10
  459. package/dist/src/session-monitor.js +2 -39
  460. package/dist/src/session-reaper.d.ts +0 -15
  461. package/dist/src/session-reaper.js +0 -14
  462. package/dist/src/session-skills.d.ts +15 -44
  463. package/dist/src/session-skills.js +75 -60
  464. package/dist/src/session-summary.d.ts +0 -26
  465. package/dist/src/session-summary.js +0 -32
  466. package/dist/src/session-title.d.ts +0 -1
  467. package/dist/src/session-title.js +0 -2
  468. package/dist/src/sessions.d.ts +2 -122
  469. package/dist/src/sessions.js +7 -178
  470. package/dist/src/shell.d.ts +3 -20
  471. package/dist/src/shell.js +8 -72
  472. package/dist/src/side-panel.d.ts +5 -99
  473. package/dist/src/side-panel.js +76 -133
  474. package/dist/src/sign-in-detection.d.ts +0 -39
  475. package/dist/src/sign-in-detection.js +0 -43
  476. package/dist/src/sign-in-offer.d.ts +1 -19
  477. package/dist/src/sign-in-offer.js +0 -13
  478. package/dist/src/skill-commands.d.ts +0 -1
  479. package/dist/src/skill-commands.js +1 -4
  480. package/dist/src/skills/bundled/control-browser/SKILL.md +1 -1
  481. package/dist/src/skills/bundled/provenance.json +1 -1
  482. package/dist/src/skills/invocable-skills.d.ts +0 -18
  483. package/dist/src/skills/invocable-skills.js +0 -17
  484. package/dist/src/skills/project-skills.d.ts +0 -1
  485. package/dist/src/skills/project-skills.js +0 -3
  486. package/dist/src/skills/prompt-skills.js +0 -14
  487. package/dist/src/skills/runtime-skills.d.ts +0 -13
  488. package/dist/src/skills/runtime-skills.js +0 -37
  489. package/dist/src/stall-recovery.d.ts +0 -25
  490. package/dist/src/stall-recovery.js +0 -38
  491. package/dist/src/stray-files.d.ts +0 -9
  492. package/dist/src/stray-files.js +0 -16
  493. package/dist/src/structured-step.d.ts +0 -22
  494. package/dist/src/structured-step.js +0 -22
  495. package/dist/src/subagent-run.d.ts +0 -163
  496. package/dist/src/subagent-run.js +4 -373
  497. package/dist/src/subagent-tree.d.ts +32 -0
  498. package/dist/src/subagent-tree.js +128 -0
  499. package/dist/src/telemetry/aggregate.d.ts +0 -37
  500. package/dist/src/telemetry/aggregate.js +0 -40
  501. package/dist/src/telemetry/capture-core.d.ts +0 -87
  502. package/dist/src/telemetry/capture-core.js +0 -67
  503. package/dist/src/telemetry/capture.d.ts +0 -1
  504. package/dist/src/telemetry/capture.js +0 -3
  505. package/dist/src/telemetry/classify.d.ts +0 -58
  506. package/dist/src/telemetry/classify.js +0 -60
  507. package/dist/src/telemetry/decision-capture.d.ts +0 -1
  508. package/dist/src/telemetry/emitter.d.ts +0 -30
  509. package/dist/src/telemetry/emitter.js +1 -62
  510. package/dist/src/telemetry/gate.d.ts +0 -29
  511. package/dist/src/telemetry/gate.js +0 -22
  512. package/dist/src/telemetry/identity.d.ts +0 -13
  513. package/dist/src/telemetry/identity.js +0 -29
  514. package/dist/src/telemetry/outbox.d.ts +0 -64
  515. package/dist/src/telemetry/outbox.js +1 -108
  516. package/dist/src/telemetry/schema.d.ts +1 -49
  517. package/dist/src/telemetry/schema.js +1 -82
  518. package/dist/src/telemetry/state.d.ts +0 -53
  519. package/dist/src/telemetry/state.js +0 -64
  520. package/dist/src/telemetry/surface.d.ts +0 -31
  521. package/dist/src/telemetry/surface.js +1 -39
  522. package/dist/src/telemetry/uploader.d.ts +0 -11
  523. package/dist/src/telemetry/uploader.js +0 -46
  524. package/dist/src/telemetry/uploads.d.ts +0 -11
  525. package/dist/src/telemetry/uploads.js +0 -11
  526. package/dist/src/telemetry/version.d.ts +0 -4
  527. package/dist/src/telemetry/version.js +0 -14
  528. package/dist/src/telemetry/workspace.d.ts +0 -7
  529. package/dist/src/telemetry/workspace.js +1 -22
  530. package/dist/src/terminal-ui.d.ts +14 -523
  531. package/dist/src/terminal-ui.js +74 -876
  532. package/dist/src/test-edit-guard.d.ts +74 -0
  533. package/dist/src/test-edit-guard.js +269 -0
  534. package/dist/src/text.d.ts +0 -1
  535. package/dist/src/text.js +0 -1
  536. package/dist/src/time-limit.d.ts +0 -36
  537. package/dist/src/time-limit.js +0 -37
  538. package/dist/src/timers.d.ts +0 -161
  539. package/dist/src/timers.js +0 -126
  540. package/dist/src/todos.d.ts +0 -1
  541. package/dist/src/todos.js +0 -3
  542. package/dist/src/token-rate.d.ts +0 -94
  543. package/dist/src/token-rate.js +0 -154
  544. package/dist/src/tool-activity.d.ts +0 -6
  545. package/dist/src/tool-activity.js +0 -7
  546. package/dist/src/tool-availability.d.ts +0 -13
  547. package/dist/src/tool-availability.js +1 -14
  548. package/dist/src/tool-call-clock.d.ts +1 -4
  549. package/dist/src/tool-call-clock.js +0 -13
  550. package/dist/src/tool-catalog.d.ts +0 -11
  551. package/dist/src/tool-catalog.js +0 -23
  552. package/dist/src/tool-dependencies.d.ts +0 -5
  553. package/dist/src/tool-dependencies.js +0 -4
  554. package/dist/src/tool-diff-stats.d.ts +0 -23
  555. package/dist/src/tool-diff-stats.js +0 -49
  556. package/dist/src/tool-errors.d.ts +9 -7
  557. package/dist/src/tool-errors.js +13 -6
  558. package/dist/src/tool-failure-tracker.d.ts +3 -11
  559. package/dist/src/tool-failure-tracker.js +19 -27
  560. package/dist/src/tool-names.d.ts +0 -16
  561. package/dist/src/tool-names.js +0 -12
  562. package/dist/src/tool-profile.d.ts +6 -0
  563. package/dist/src/tool-profile.js +23 -0
  564. package/dist/src/tool-result-filter.d.ts +0 -19
  565. package/dist/src/tool-result-filter.js +1 -66
  566. package/dist/src/tool-schema-compatibility.d.ts +0 -6
  567. package/dist/src/tool-schema-compatibility.js +0 -9
  568. package/dist/src/tools.d.ts +0 -4
  569. package/dist/src/tools.js +11 -114
  570. package/dist/src/trajectory.d.ts +0 -13
  571. package/dist/src/trajectory.js +23 -79
  572. package/dist/src/transcript.d.ts +0 -41
  573. package/dist/src/transcript.js +2 -60
  574. package/dist/src/types.d.ts +1 -168
  575. package/dist/src/untracked-file-removal.js +0 -20
  576. package/dist/src/update-check.d.ts +0 -14
  577. package/dist/src/update-check.js +1 -15
  578. package/dist/src/update.d.ts +0 -35
  579. package/dist/src/update.js +0 -100
  580. package/dist/src/usage-analytics.d.ts +17 -17
  581. package/dist/src/usage-analytics.js +168 -209
  582. package/dist/src/web-search.d.ts +0 -23
  583. package/dist/src/web-search.js +1 -27
  584. package/dist/src/widgets.d.ts +0 -25
  585. package/dist/src/widgets.js +0 -24
  586. package/dist/src/workspace-facts.d.ts +0 -12
  587. package/dist/src/workspace-facts.js +1 -18
  588. package/dist/src/workspace-git-metadata.d.ts +0 -16
  589. package/dist/src/workspace-git-metadata.js +0 -21
  590. package/dist/src/workspace-instructions.d.ts +3 -15
  591. package/dist/src/workspace-instructions.js +6 -19
  592. package/package.json +2 -2
@@ -1,9 +1,15 @@
1
- import { isPermissionMode, permissionLabel, workspacePermissionKey } from './permissions.js';
1
+ import { isPermissionMode, permissionLabel, PERMISSION_OPTIONS, workspacePermissionKey } from './permissions.js';
2
+ export function permissionChoices(current) {
3
+ const width = Math.max(...PERMISSION_OPTIONS.map(option => option.id.length));
4
+ const rows = PERMISSION_OPTIONS.map(option => `${option.id === current ? '●' : ' '} ${option.id.padEnd(width)} ${option.label}${option.id === current ? ' (current)' : ''}: ${option.description}`);
5
+ return [`Permissions: ${permissionLabel(current)}`, 'Change with /permissions <mode>:', ...rows].join('\n');
6
+ }
2
7
  import { graphStorageDirectory } from './graph-account.js';
3
8
  import { configuredGraphSelection, currentGraphSubject, saveGraphSelection } from './graph-selection.js';
4
9
  import { loadAccessibleGraph, requireGraphMembership } from './membership.js';
5
10
  import { GraphProviderUnavailableError } from './graph-provider-portability.js';
6
11
  import { confirmAndApplyModelOverride } from './model-override.js';
12
+ import { applyGoalCommand } from './session-goal.js';
7
13
  import { changeConfigFile, configDirectory, loadConfig, loadSavedAnalytics } from './config.js';
8
14
  import { applyModelContextWindow, providerLabel, recordProviderModel, REASONING_EFFORTS } from './providers.js';
9
15
  import { resolveRepositoryId } from './code-intelligence/repository.js';
@@ -23,7 +29,7 @@ export const HELP = `Commands:
23
29
  /login [--no-browser] Sign in or create an Andorra account (prints the address over SSH)
24
30
  /auth logout Remove this machine's saved Andorra account session
25
31
  /auth status Show Andorra account session status
26
- /model [model-id] Open model selection or select a model directly; with a graph that pins node models, asks whether to override them
32
+ /model [model-id] Open the provider/model tree (→ expands, ← collapses) or select a model directly; with a graph that pins node models, asks whether to override them
27
33
  /model list Discover models from the active provider
28
34
  /providers [id] Choose providers; Right/e edits; Add provider configures
29
35
  /subagent [id [model]] Set the provider/model external hosts (Claude/Codex CLI) must use for Andorra subagent runs; off clears it
@@ -49,6 +55,7 @@ export const HELP = `Commands:
49
55
  /status Show workspace and current settings
50
56
  /clear Clear the conversation on screen and the retained context (session usage is retained)
51
57
  /compact Compact retained conversation history to free context
58
+ /goal [text|clear] Set, show or clear the session goal; a run keeps working until a completion check agrees the goal is met
52
59
  /help Show commands
53
60
  /exit Quit
54
61
  Selection screens: Up/Down to browse, Enter or Space to select, Escape to return.
@@ -56,17 +63,6 @@ Ctrl+B toggles dashboard; Ctrl+G pages its graph; Ctrl+N cycles dashboard model
56
63
  Ctrl+T expands/collapses todos; Ctrl+O expands/collapses tool details; Ctrl+Y collapses/expands live thinking.
57
64
  Shift+Arrow/Home/End selects prompt text; Ctrl+C copies and Ctrl+X cuts a selection. The wheel scrolls; Up/Down recall prompts. Drag selects and copies transcript text; double-click copies a word.
58
65
  Ctrl+C stops an interactive run; send direction to resume, or press Ctrl+C again to exit (idle Ctrl+C exits too). /yolo on|off applies immediately, including at approvals. /exit quits. Headless Ctrl+C cancels the run; a second press exits.`;
59
- /**
60
- * Collapse retained turns into a single summary entry so the next request sends one
61
- * condensed user/assistant pair instead of every full completion.
62
- *
63
- * Compaction is deterministic and local: each turn keeps its task and outcome summary
64
- * (clipped) and loses test lists and structured detail. A continued turn also keeps its
65
- * direction as its own clipped part — folding it into the task's clip could cut it away
66
- * entirely, and `/compact` erasing what the user sent after a stop is exactly what a
67
- * summary must not do. The caller still holds the turns; replacing them is the CLI's
68
- * decision, reported through the `compact` result flag.
69
- */
70
66
  export function compactHistory(turns) {
71
67
  const clip = (text, limit) => { const flat = text.replace(/\s+/g, ' ').trim(); return flat.length > limit ? flat.slice(0, limit - 1) + '…' : flat; };
72
68
  const lines = turns.map((turn, index) => `${index + 1}. ${clip(turn.task, 160)}${turn.direction === undefined ? '' : ` (continued with: ${clip(turn.direction, 160)})`} → ${clip(turn.completion.summary, 240)}`);
@@ -75,20 +71,10 @@ export function compactHistory(turns) {
75
71
  completion: { summary: lines.join('\n'), tests: [] },
76
72
  }];
77
73
  }
78
- /**
79
- * Estimate the context the compacted history will occupy, in tokens, so the footer can
80
- * drop the moment `/compact` runs. This is a character-based approximation (the same
81
- * seed text measured at ~4 characters per token); the next model request replaces it with
82
- * the provider-reported input size.
83
- */
84
74
  export function compactedContextEstimate(turns) {
85
75
  return Math.ceil(JSON.stringify(turns).length / 4);
86
76
  }
87
77
  const CODEGRAPH_USAGE = 'Usage: /codegraph status|enable|disable|rebuild. Add --global to enable|disable to set the saved default for every project (this clears per-repository overrides).';
88
- /**
89
- * `/codegraph`. `enable|disable` alone records an override for the current repository; with
90
- * `--global` it sets the saved default that every project and every later session starts from.
91
- */
92
78
  async function codegraphCommand(action, scope, state, signal) {
93
79
  const manager = state.codeIntel;
94
80
  if (!manager)
@@ -100,7 +86,7 @@ async function codegraphCommand(action, scope, state, signal) {
100
86
  const status = await manager.getStatus();
101
87
  const indexed = status.stats?.lastIndexedAt ? new Date(status.stats.lastIndexedAt).toLocaleString() : 'never';
102
88
  const repositoryId = await resolveRepositoryId(state.workspace).catch(() => undefined);
103
- const saved = state.config.codeIntel?.enabled !== false;
89
+ const saved = state.config.codeIntel?.enabled === true;
104
90
  const override = !repositoryId ? ''
105
91
  : (state.config.codeIntel?.enabledRepos ?? []).includes(repositoryId) ? '; this repository is enabled by override'
106
92
  : (state.config.codeIntel?.disabledRepos ?? []).includes(repositoryId) ? '; this repository is disabled by override'
@@ -111,17 +97,12 @@ async function codegraphCommand(action, scope, state, signal) {
111
97
  case 'disable': {
112
98
  const enable = action === 'enable';
113
99
  if (scope === 'global') {
114
- // The global toggle is the newest statement of intent, so it resets the per-repository
115
- // exceptions: after it, every project follows the saved default until a plain
116
- // `/codegraph enable|disable` records a new override.
117
100
  const cleared = (state.config.codeIntel?.enabledRepos?.length ?? 0) + (state.config.codeIntel?.disabledRepos?.length ?? 0);
118
101
  state.config.codeIntel = { ...state.config.codeIntel, enabled: enable, enabledRepos: [], disabledRepos: [] };
119
102
  return { text: `Code intelligence ${enable ? 'enabled' : 'disabled'} for every project; new sessions in other projects start with it ${enable ? 'on' : 'off'}.${cleared ? ` ${cleared} per-repository override${cleared === 1 ? ' was' : 's were'} cleared.` : ''} /codegraph ${enable ? 'disable' : 'enable'} without --global overrides this for one repository.`, save: true };
120
103
  }
121
104
  const repositoryId = await resolveRepositoryId(state.workspace).catch(() => undefined);
122
105
  if (repositoryId) {
123
- // Per-repository override: never touch the global enabled flag, so a
124
- // global disable survives enabling one repository (and vice versa).
125
106
  const disabled = new Set(state.config.codeIntel?.disabledRepos ?? []);
126
107
  const enabledRepos = new Set(state.config.codeIntel?.enabledRepos ?? []);
127
108
  const target = enable ? enabledRepos : disabled;
@@ -141,7 +122,6 @@ async function codegraphCommand(action, scope, state, signal) {
141
122
  else {
142
123
  state.config.codeIntel = { ...state.config.codeIntel, enabled: enable };
143
124
  }
144
- // The live manager is updated by executeCommand only after persistence succeeds.
145
125
  return { text: `Code intelligence ${enable ? 'enabled' : 'disabled'}${repositoryId ? ' for this repository' : ''}.`, save: true };
146
126
  }
147
127
  case 'rebuild':
@@ -160,12 +140,6 @@ async function codegraphCommand(action, scope, state, signal) {
160
140
  return { text: CODEGRAPH_USAGE };
161
141
  }
162
142
  }
163
- /**
164
- * Copy a configuration over the live one, deletions included.
165
- *
166
- * `Object.assign` only adds and replaces, so a setting another writer deleted would stay in the
167
- * live configuration and be resurrected by the next command that saves the whole snapshot.
168
- */
169
143
  function syncConfig(target, source) {
170
144
  for (const key of Object.keys(target)) {
171
145
  if (!(key in source))
@@ -173,11 +147,9 @@ function syncConfig(target, source) {
173
147
  }
174
148
  Object.assign(target, source);
175
149
  }
176
- /** What the command says after it changed the preference. */
177
150
  function feedbackChangedText(enabled) {
178
151
  return `Anonymous feedback ${enabled ? 'on' : 'off'}. Setting saved for this machine.${enabled ? ' It never includes your code, prompts, or API keys.' : ' No anonymous product data will be reported from this installation.'}`;
179
152
  }
180
- /** The line shown for a plan that collects as a condition of the plan. */
181
153
  function includedWithPlanText(plan) {
182
154
  if (plan === 'legacy')
183
155
  return 'on (included with the Legacy plan)';
@@ -185,33 +157,20 @@ function includedWithPlanText(plan) {
185
157
  return 'on (included with the Free plan)';
186
158
  return 'on (included with your plan until this account\'s plan is confirmed)';
187
159
  }
188
- /** Why a plan that cannot opt out refuses `/feedback off`. */
189
160
  function optOutRefusedText(plan) {
190
161
  const named = plan === 'free' ? 'Free' : plan === 'legacy' ? 'Legacy' : 'current';
191
162
  return `Anonymous feedback stays on: collection is included with the ${named} plan. Upgrade to Paid to turn it off.`;
192
163
  }
193
- /**
194
- * Whether a `/subagent off` invocation clears the saved pair.
195
- *
196
- * A provider may legally be named "off", and a selection of a real provider must not delete the
197
- * configuration: the clear applies only when nothing is configured under that name.
198
- */
199
164
  export function subagentClearRequested(line, providers) {
200
165
  return /^\/subagent\s+off\s*$/.test(line.trim()) && !providers.some(provider => provider.id === 'off');
201
166
  }
202
- /** Commit selection changes only after persistence succeeds; callers render the returned result afterward. */
203
167
  export async function executeCommand(line, state, persist, signal, graphAccess = { load: loadAccessibleGraph, requirePaid: requireGraphMembership }, graphSubject = currentGraphSubject, logout = logoutCodex) {
204
- // `/logout` is the Andorra account's sign-out, the counterpart of `/login`; a provider's managed
205
- // sign-in is named explicitly, so signing out of the account never touches provider sessions.
206
168
  if (/^\/logout\s+\S/.test(line.trim()) && !/^\/logout\s+--all$/.test(line.trim())) {
207
169
  if (!/^\/logout\s+codex$/.test(line.trim()))
208
170
  return { text: 'Usage: /logout [--all] | /logout codex' };
209
171
  const codex = state.config.providers.filter(candidate => candidate.type === 'codex');
210
172
  if (!codex.length)
211
173
  return { text: 'No Codex provider is configured, so there is no Codex sign-in to log out of. Use /logout to sign out of your Andorra account.' };
212
- // Each configured account has its own home, so all of them leave together: signing out one
213
- // alone would leave the others' sessions live under entries the person believes are gone.
214
- // Slot-less providers share the default home, which is signed out once.
215
174
  const homes = [];
216
175
  for (const item of codex) {
217
176
  const home = codexAccountHome(item.codexAccount);
@@ -234,23 +193,14 @@ export async function executeCommand(line, state, persist, signal, graphAccess =
234
193
  return { text: 'Signed out of every configured Codex account. Provider settings are retained; use /providers to sign in again.', exit: true, clear: true };
235
194
  }
236
195
  const draft = { ...state, config: structuredClone(state.config) };
237
- // The feedback preference belongs to the installation rather than to this process: the desktop
238
- // app and another CLI write the same file, so the answer this command reports and the value it
239
- // changes are the ones saved now, not the snapshot this process loaded when it started. The bare
240
- // form only reports, like `status`.
241
196
  const feedbackWrite = /^\/feedback(?:\s+(?:on|off|status))?$/.test(line.trim());
242
197
  if (feedbackWrite)
243
198
  draft.config.analytics = await loadSavedAnalytics();
244
- // The plan gate is resolved before the command runs, so `/feedback off` refuses rather than
245
- // writes a value that only looks stored.
246
199
  if (feedbackWrite) {
247
- // Read the preference from the file, not this process's snapshot: another writer may have
248
- // changed it since the run started.
249
200
  const gate = await telemetryGate({ home: configDirectory(), config: await loadConfig(configDirectory()), subject: await graphSubject().catch(() => undefined) });
250
201
  draft.analytics = { plan: gate.plan, canOptOut: gate.canOptOut };
251
202
  }
252
203
  const graphCommand = /^\/graph\s+(\S+)\s*$/.exec(line.trim());
253
- // A second word is only ever `--global`; a bare `/codegraph --global` or a misspelt flag reaches the usage text.
254
204
  const codegraph = /^\/codegraph(?:\s+(\S+))?(?:\s+(\S+))?\s*$/.exec(line.trim());
255
205
  const codegraphScope = codegraph?.[2] === undefined ? 'repository' : codegraph[2] === '--global' ? 'global' : undefined;
256
206
  let result;
@@ -271,10 +221,6 @@ export async function executeCommand(line, state, persist, signal, graphAccess =
271
221
  try {
272
222
  signal?.throwIfAborted();
273
223
  const subject = await graphSubject();
274
- // A graph that cannot bind to this machine's providers stays selectable: the choice names
275
- // what a task will run, and it is the run that refuses those references. The graph is read
276
- // once more without binding so the answer can still name it; membership and storage errors
277
- // keep refusing the selection outright.
278
224
  let graph;
279
225
  let unavailable;
280
226
  try {
@@ -297,8 +243,6 @@ export async function executeCommand(line, state, persist, signal, graphAccess =
297
243
  delete draft.graph;
298
244
  else
299
245
  draft.graph = id;
300
- // This form has no UI to confirm on, so the warning that the switch starts fresh travels
301
- // in the returned text; an unchanged graph clears nothing and carries no warning.
302
246
  result = { text: `Graph: ${id === 'default' ? 'Default' : graph.name} (${id === 'default' ? 'Andorra Agent only' : `${graph.id}@${graph.revision}`})${changed ? ". This session's context is cleared and the new graph starts fresh." : ''}${unavailable ? ` ${unavailable} The graph is selected anyway; a task on it starts only once it can run on this machine, or after /model overrides every node with one provider you have.` : ''}`, clear: changed, save };
303
247
  }
304
248
  catch (error) {
@@ -311,13 +255,10 @@ export async function executeCommand(line, state, persist, signal, graphAccess =
311
255
  const modelDirect = /^\/model\s+(\S+)$/.exec(line.trim());
312
256
  const activeProvider = draft.config.providers.find(p => p.id === draft.config.provider);
313
257
  if (modelDirect && modelDirect[1] !== 'list' && draft.graph && activeProvider && state.confirmModelOverride) {
314
- // The graph is saved before the config: a declined or failed override leaves both untouched.
315
258
  const outcome = await confirmAndApplyModelOverride({
316
259
  graphId: draft.graph,
317
260
  target: { provider: activeProvider.id, model: modelDirect[1] },
318
261
  configProviders: draft.config.providers.map(p => ({ id: p.id, type: p.type, model: p.model })),
319
- // Same rule as the /model screen: the override rewrites every provider reference, so the
320
- // graph is read without binding — binding is what refuses a graph whose providers are gone.
321
262
  loadGraph: (id, graphSignal) => graphAccess.load(id, graphSignal, undefined, { bindProviders: false }),
322
263
  resolveDirectory: async () => graphStorageDirectory(undefined, await graphSubject()),
323
264
  confirm: state.confirmModelOverride,
@@ -335,53 +276,39 @@ export async function executeCommand(line, state, persist, signal, graphAccess =
335
276
  result = handleCommand(line, draft);
336
277
  }
337
278
  const permissionsChanged = draft.permissions !== state.permissions;
338
- // Cache writes must stop before Read Only or Plan is persisted or exposed to the run.
339
279
  if (permissionsChanged && (draft.permissions === 'read-only' || draft.permissions === 'plan'))
340
280
  await state.codeIntel?.setPermissions(draft.permissions);
341
281
  if (result.save && feedbackWrite) {
342
- // The preference belongs to the installation, so its change is written to the file's current
343
- // content under the configuration's lock: saving this process's snapshot would revert a
344
- // provider, a limit or a permission that another writer changed while it was running.
345
- // Every event already queued under the old preference is discarded only when reporting actually
346
- // turns off. Repeating `/feedback off` on an installation that is already off keeps the
347
- // generation, so purging again would delete events another process legitimately queued since —
348
- // on a shared home, a plan that cannot opt out still reports. The purge is decided inside the
349
- // locked update so it sees the state the write replaced.
350
282
  let preferenceTurnedOff = false;
351
283
  const saved = await changeConfigFile(configDirectory(), current => {
352
284
  const enabled = draft.config.analytics?.enabled !== false;
353
285
  preferenceTurnedOff = resolveAnalyticsConfig(current).enabled && !enabled;
354
286
  return { ...current, analytics: { ...draft.config.analytics, generation: analyticsGenerationFor(current.analytics, enabled) } };
355
287
  });
356
- // The generation bump closes the race against a task engine that appends just after this purge.
357
288
  if (preferenceTurnedOff)
358
289
  await purgeOutbox(telemetryDirectory());
359
290
  if (saved.analytics !== undefined) {
360
291
  await recordPreference({ subject: await graphSubject().catch(() => undefined), preference: saved.analytics.enabled === false ? 'off' : 'on' }).catch(() => { });
361
292
  }
362
- // The live configuration follows the file, not the snapshot this process started with.
363
293
  draft.config = saved;
364
294
  }
365
295
  else if (result.save)
366
296
  await persist(draft.config);
367
- // Preserve the config object shared by the CLI's run callback, and the deletions another writer
368
- // made in it: a setting that is gone from the file must be gone from the live configuration too.
369
297
  syncConfig(state.config, draft.config);
370
298
  if (graphCommand && result.save)
371
299
  delete state.config.graph;
372
- // A cleared subagent pair is a delete on the draft, which Object.assign cannot carry back. A
373
- // provider named "off" is a selection, not a clear, so it leaves the setting alone.
374
300
  if (subagentClearRequested(line, state.config.providers) && result.save)
375
301
  delete state.config.externalSubagent;
376
302
  state.yolo = draft.yolo;
377
303
  state.permissions = draft.permissions;
304
+ if (result.goalChanged)
305
+ state.goal = draft.goal;
378
306
  if (permissionsChanged && draft.permissions !== 'read-only' && draft.permissions !== 'plan')
379
307
  await state.codeIntel?.setPermissions(draft.permissions);
380
308
  if (draft.graph === undefined)
381
309
  delete state.graph;
382
310
  else
383
311
  state.graph = draft.graph;
384
- // Live manager changes follow persistence, never precede it.
385
312
  if (codegraph && result.save && (codegraph[1] === 'enable' || codegraph[1] === 'disable')) {
386
313
  await state.codeIntel?.setEnabled(codegraph[1] === 'enable');
387
314
  }
@@ -404,6 +331,12 @@ export function handleCommand(line, state) {
404
331
  return { text: 'Nothing to compact: no conversation history is retained yet.' };
405
332
  return { text: `Compacted ${turns.length} retained turn${turns.length === 1 ? '' : 's'} into one summary entry. The next request sends the condensed history; session usage totals are unchanged.`, compact: true };
406
333
  }
334
+ case '/goal': {
335
+ const outcome = applyGoalCommand(line, state.goal);
336
+ if (outcome.changed)
337
+ state.goal = outcome.goal;
338
+ return { text: outcome.text, ...(outcome.changed ? { goalChanged: true } : {}) };
339
+ }
407
340
  case '/model':
408
341
  if (arg === 'list')
409
342
  return { text: '', discover: true };
@@ -433,8 +366,6 @@ export function handleCommand(line, state) {
433
366
  return { text: setting
434
367
  ? `External subagent: ${setting.provider}/${setting.model}. Claude CLI and Codex CLI subagent runs use this pair.`
435
368
  : 'External subagent: not set. External hosts cannot start an Andorra subagent run until a provider/model is picked; they receive a PROVIDER_NOT_SET error listing the options. Use /subagent <provider> [model], or /subagent to pick.' };
436
- // A provider may legally be named "off", so the clear applies only when nothing is
437
- // configured under that name: a selection of a real provider must not delete the setting.
438
369
  if (arg === 'off' && !state.config.providers.some(provider => provider.id === 'off')) {
439
370
  if (!setting)
440
371
  return { text: 'External subagent: already not set.' };
@@ -477,15 +408,14 @@ export function handleCommand(line, state) {
477
408
  return { text: 'Graph: Default - Andorra Agent only. Use the graph selector for the paid Andorra graph or custom graphs.' };
478
409
  case '/permissions':
479
410
  if (!arg)
480
- return { text: `Permissions: ${permissionLabel(state.permissions ?? (state.yolo ? 'full-access' : 'ask-for-approval'))}` };
411
+ return { text: permissionChoices(state.permissions ?? (state.yolo ? 'full-access' : 'ask-for-approval')) };
481
412
  if (!isPermissionMode(arg))
482
- return { text: 'Usage: /permissions read-only|plan|ask-for-approval|approve-for-me|full-access' };
413
+ return { text: `Unknown permission mode "${arg}".\n${permissionChoices(state.permissions ?? (state.yolo ? 'full-access' : 'ask-for-approval'))}` };
483
414
  state.config.workspacePermissions = { ...state.config.workspacePermissions, [workspacePermissionKey(state.workspace)]: arg };
484
415
  state.permissions = arg;
485
416
  state.yolo = arg === 'full-access';
486
417
  return { text: `Permissions: ${permissionLabel(arg)} (remembered for this workspace).`, save: true };
487
418
  case '/yolo':
488
- // The bare form reports and changes nothing: a stray Enter must never flip approvals.
489
419
  if (!arg)
490
420
  return { text: `YOLO: ${state.yolo ? 'on' : 'off'}.\nUsage: /yolo on|off` };
491
421
  if (!['on', 'off'].includes(arg))
@@ -512,14 +442,9 @@ export function handleCommand(line, state) {
512
442
  case '/feedback': {
513
443
  if (args.length > 1 || (arg && !['on', 'off', 'status'].includes(arg)))
514
444
  return { text: 'Usage: /feedback on|off|status' };
515
- // The saved answer is the effective one, not the raw stored field: a configuration that
516
- // never mentioned the setting still reports on, and the status line has to say so.
517
- // The stored preference, not the effective reporting answer: a never-confirmed installation
518
- // collects even with the preference off, and the status line still has to say what was saved.
519
445
  const enabled = resolveAnalyticsConfig(state.config).enabled;
520
446
  const plan = state.analytics?.plan ?? 'unknown';
521
447
  const canOptOut = state.analytics?.canOptOut ?? true;
522
- // The bare form reports, like `status`: a stray Enter must never change the preference.
523
448
  if (arg === 'status' || !arg) {
524
449
  const usage = arg ? '' : '\nUsage: /feedback on|off|status';
525
450
  if (!canOptOut)
@@ -527,17 +452,12 @@ export function handleCommand(line, state) {
527
452
  return { text: `Anonymous feedback: ${enabled ? 'on' : 'off'} (saved preference). It never includes your code, prompts, or API keys.${usage}` };
528
453
  }
529
454
  const next = arg === 'on';
530
- // A switch that silently does nothing is worse than one that is not offered: a plan that
531
- // cannot opt out refuses the change and says why.
532
455
  if (!next && !canOptOut)
533
456
  return { text: optOutRefusedText(plan) };
534
457
  state.config.analytics = { ...state.config.analytics, enabled: next };
535
458
  return { text: feedbackChangedText(next), save: true };
536
459
  }
537
460
  case '/usage': {
538
- // Cache traffic renders only when reported, mirroring the usage screen: an
539
- // unreported read is omitted rather than shown as a measured zero, and the
540
- // hit-rate percentage needs a positive input total to mean anything.
541
461
  const read = state.usage.cacheRead ?? 0, write = state.usage.cacheWrite ?? 0;
542
462
  const cache = read > 0 || write > 0
543
463
  ? `, ${[read > 0 ? `${read} cache-read${state.usage.inputTokens > 0 ? ` (${Math.round(read / state.usage.inputTokens * 100)}% of input)` : ''}` : '',
@@ -1,70 +1,23 @@
1
1
  import type { TodoItem } from './todos.js';
2
- /**
3
- * Checks on the completion that ends a run, made by the host before it accepts the handoff.
4
- *
5
- * A model's own `complete_agent` call was the only thing that ended a run on the default graph: no
6
- * guard, no verifier. A live run ended that way with its plan still "in progress" and an envelope
7
- * that carried no summary, so the transcript closed on the raw output object and a finished-looking
8
- * turn read as a run cut off halfway. Both conditions are facts the host already holds, so they are
9
- * checked in code rather than left to the prompt.
10
- *
11
- * The `summary` and `todos` gates each send the handoff back at most `MAX_GATE_ASKS` times and are
12
- * waived after that. A gate never spends a completion repair and never fails the run.
13
- *
14
- * The `unfinished` gate is different in kind. It fires when the completion itself says the task is
15
- * not done: a non-empty `remaining` list, or a "Not done" section in the summary. A run must not end
16
- * on its own with work it can still do. In a benchmark trial with a fifteen-minute limit the agent
17
- * had a build that booted but drew no frame, was told a quarter of its time was left, and completed
18
- * two steps later with "frame output still missing" in its own summary and two minutes unused; the
19
- * host accepted it, and the trial failed. So a completion that reports unfinished work is sent back
20
- * to keep working for as long as the agent does work in between, with no cap on how often. It is
21
- * accepted only when sending it back cannot help: the agent has twice in a row answered the
22
- * send-back with the same report and no tool call (there is nothing more it can do without the
23
- * user), the attempt's clock has all but run out, or it is on its last allowed iteration. Each of
24
- * those is recorded as a waiver with its reason.
25
- *
26
- * Earlier the "Not done" section was the way a completion with open plan items got through at once.
27
- * That made the honest report an exit, and the trial above took it.
28
- */
29
2
  export type FinalAnswerGateId = 'summary' | 'todos' | 'unfinished';
30
3
  export declare const MAX_GATE_ASKS = 2;
31
- /** Consecutive send-backs the agent may answer with no tool call before an unfinished report is accepted. */
32
4
  export declare const MAX_IDLE_UNFINISHED_ASKS = 2;
33
- /** With less than this left on the attempt's clock, another turn could not do any work. */
34
5
  export declare const UNFINISHED_MIN_TIME_MS = 20000;
35
6
  export type UnfinishedWaiver = 'noFurtherWork' | 'outOfTime';
36
7
  export interface FinalAnswerGateInput {
37
- /** The envelope had no summary, so the serialized output is what the user would read. */
38
8
  summaryStoodIn: boolean;
39
- /** The run's plan as it stands after any update sent beside the completion. */
40
9
  todos: readonly TodoItem[];
41
- /** The summary as the user will read it; a "Not done" section in it reports unfinished work. */
42
10
  summary?: string;
43
- /** The completion's own list of what the task still lacks; empty or absent when it claims to be done. */
44
11
  remaining?: readonly string[];
45
- /** How many times the summary and plan gates have already sent a handoff back in this run. */
46
12
  asked?: Partial<Record<FinalAnswerGateId, number>>;
47
- /** Send-backs for unfinished work, in a row, that the agent answered without running any tool. */
48
13
  idleUnfinishedAsks?: number;
49
- /** Time left on the attempt's wall clock; undefined when the attempt has none. */
50
14
  timeLeftMs?: number;
51
15
  }
52
16
  export interface FinalAnswerGateResult {
53
- /** Gates that send this handoff back. Empty when every failed gate is waived. */
54
17
  gates: FinalAnswerGateId[];
55
- /** Gates that failed but let the handoff through; the handoff is accepted despite them. */
56
18
  waived: FinalAnswerGateId[];
57
- /** What the model is told. Empty when nothing is sent back. */
58
19
  message: string;
59
- /** Why an unfinished report was let through, when `waived` includes `unfinished`. */
60
20
  unfinishedWaiver?: UnfinishedWaiver;
61
21
  }
62
- /**
63
- * Whether the summary has a section that reports unfinished work: a markdown heading, or a line
64
- * that is only a bold or plain label, reading "Not done" (also "Not completed", "Not finished",
65
- * "Unfinished", "Remaining work", "Incomplete"). A sentence that merely contains the words does not
66
- * count: a summary may say "nothing was left not done".
67
- */
68
22
  export declare function declaresUnfinishedWork(summary: string | undefined): boolean;
69
- /** Undefined when the handoff passes every gate. */
70
23
  export declare function finalAnswerGate(input: FinalAnswerGateInput): FinalAnswerGateResult | undefined;
@@ -1,19 +1,10 @@
1
1
  export const MAX_GATE_ASKS = 2;
2
- /** Consecutive send-backs the agent may answer with no tool call before an unfinished report is accepted. */
3
2
  export const MAX_IDLE_UNFINISHED_ASKS = 2;
4
- /** With less than this left on the attempt's clock, another turn could not do any work. */
5
3
  export const UNFINISHED_MIN_TIME_MS = 20_000;
6
- /** Plan items and remaining items named in the message; a longer list is counted, not listed. */
7
4
  const MAX_NAMED_TODOS = 8;
8
5
  const MAX_NAMED_REMAINING = 5;
9
6
  const MAX_REMAINING_CHARS = 160;
10
7
  const UNFINISHED_SECTION = /^[ \t]*(?:#{1,6}[ \t]+|\*\*|__)?(?:not (?:done|completed?|finished)|unfinished(?: work)?|remaining work|incomplete)(?:\*\*|__)?[ \t]*:?[ \t]*(?:\*\*|__)?[ \t]*$/im;
11
- /**
12
- * Whether the summary has a section that reports unfinished work: a markdown heading, or a line
13
- * that is only a bold or plain label, reading "Not done" (also "Not completed", "Not finished",
14
- * "Unfinished", "Remaining work", "Incomplete"). A sentence that merely contains the words does not
15
- * count: a summary may say "nothing was left not done".
16
- */
17
8
  export function declaresUnfinishedWork(summary) {
18
9
  return !!summary && UNFINISHED_SECTION.test(summary);
19
10
  }
@@ -24,14 +15,10 @@ function timeLeftPhrase(ms) {
24
15
  const minutes = Math.round(seconds / 60);
25
16
  return minutes < 90 ? `about ${minutes} minutes` : `about ${Math.round(minutes / 6) / 10} hours`;
26
17
  }
27
- /** Undefined when the handoff passes every gate. */
28
18
  export function finalAnswerGate(input) {
29
19
  const open = input.todos.filter(todo => todo.status !== 'completed');
30
20
  const remaining = (input.remaining ?? []).filter(item => item.trim());
31
- // A stand-in summary is the serialized output, never the model's own account of the work.
32
21
  const reportsUnfinished = !input.summaryStoodIn && (remaining.length > 0 || declaresUnfinishedWork(input.summary));
33
- // Open plan items the completion accounts for as unfinished belong to the unfinished gate; the
34
- // plan gate is for a plan left open under a completion that claims to be done.
35
22
  const failed = [
36
23
  ...(input.summaryStoodIn ? ['summary'] : []),
37
24
  ...(reportsUnfinished ? ['unfinished'] : open.length ? ['todos'] : []),
@@ -51,7 +38,6 @@ export function finalAnswerGate(input) {
51
38
  parts.push('It has no summary. The summary is the final answer the user reads; without one they see only the raw output object. Send summary as markdown (the outcome first, then what changed, how it was verified, and anything not done) and tests as one line per check that ran, or [] when none did, beside outcome and output.');
52
39
  }
53
40
  if (gates.includes('todos')) {
54
- // Ids and statuses only: the plan's text is model-authored and is already in the todo snapshot.
55
41
  const named = open.slice(0, MAX_NAMED_TODOS).map(todo => `${todo.id} (${todo.status})`).join(', ');
56
42
  const more = open.length > MAX_NAMED_TODOS ? `, and ${open.length - MAX_NAMED_TODOS} more` : '';
57
43
  parts.push(`The plan still lists ${open.length} unfinished ${open.length === 1 ? 'item' : 'items'}: ${named}${more}. Do the work that is left, using tools. For work that is already done, send update_todos with the true statuses in the same batch as complete_agent. Do not close an item, or ship a change you do not believe in, only to make the plan read as finished.`);
@@ -2,118 +2,20 @@ import type { Completion, RunOptions } from './runtime.js';
2
2
  import type { ModelResponse, ToolSchema } from './types.js';
3
3
  export declare const COMPLETION_TOOL = "complete_agent";
4
4
  export declare const FINAL_RESPONSE_GUIDANCE = "Only when this node is responsible for producing the final user answer, its summary must satisfy the user's response requirements: include complete requested files and exact formatting, including requested code fences, without abbreviation, path substitution, or offers to provide content later. Each fence opens and closes on its own line; a file written to the workspace that the user did not ask to see in the answer is named by path, not reproduced. Intermediate intake, research, and delegation nodes must instead keep a concise handoff and preserve these final-answer acceptance requirements in the downstream task instruction or output; do not implement or reproduce the final deliverable before handing off.";
5
- /**
6
- * How the model lays out text a person reads: the handoff summary and any prose answer. The
7
- * transcript renders markdown (headings, lists, fenced code), so the structure it asks for is
8
- * what the user actually sees; a single unbroken paragraph is what this guidance exists to prevent.
9
- */
10
5
  export declare const RESPONSE_STRUCTURE_GUIDANCE = "Write user-facing text, including the final summary, as structured markdown rather than one unbroken paragraph. Lead with the outcome in one or two sentences. Match the length to the work: a small change or a short answer is a few sentences or bullets with no headings; larger work uses short headings (## What changed, ## Not done) and bullet lists for parallel items. Do not list the checks again in the summary, because the tests array is shown beside it. Throughout, put every command, file content, and code sample in a fenced code block whose fences sit on their own lines; keep sentences short and omit filler. Inside a JSON string the line breaks are written as \\n escapes, and they are expected: never flatten the summary into one line to keep the JSON valid. In the tests array, write one short line per check: the check that ran, then its outcome.";
11
- /**
12
- * The summary is the user's final answer and the transcript renders it as markdown. Weak models
13
- * read "valid JSON" as "no newlines" and return one unbroken line, so the field itself says the
14
- * breaks are wanted, next to the value they shape.
15
- */
16
6
  export declare const SUMMARY_DESCRIPTION = "Markdown shown to the user as the final answer. Write line breaks as \\n escapes: lead with the outcome, then short headings and bullet lists, and open and close each fenced code block on its own line. Never one unbroken paragraph.";
17
- /** Entries kept from a completion's `remaining` list. */
18
7
  export declare const REMAINING_LIMIT = 20;
19
- /**
20
- * The completion states, as data rather than somewhere in its prose, what the task still lacks.
21
- * A summary that said "frame output still missing" ended a run with time on the clock, because
22
- * nothing the host could read told it the task was unfinished (completion-gates.ts).
23
- */
24
8
  export declare const REMAINING_DESCRIPTION = "Everything the task asks for that is still missing, failing or unverified, one short entry each. [] only when every requirement is met and you have checked it. Be exact: this is read by the runtime, not only by the user.";
25
9
  export declare const COMPLETION_GUIDANCE = "Finish with complete_agent alone or final JSON. Todos/artifacts do not finish a node. Compare deliverables and verification evidence with acceptance criteria. Fulfill assigned requirements: intake/research nodes hand off downstream work; implementation nodes finish implementation and verification, not a progress checkpoint. Continue available work. For a concrete external blocker, report the blocker and unfinished work honestly. Use a blocked outcome if available; otherwise the sole outcome permits a terminal report, not a claim that the task is done. Only when this node is responsible for producing the final user answer, its summary must satisfy the user's response requirements: include complete requested files and exact formatting, including requested code fences, without abbreviation, path substitution, or offers to provide content later. Each fence opens and closes on its own line; a file written to the workspace that the user did not ask to see in the answer is named by path, not reproduced. Intermediate intake, research, and delegation nodes must instead keep a concise handoff and preserve these final-answer acceptance requirements in the downstream task instruction or output; do not implement or reproduce the final deliverable before handing off. Preserve required fields and valid JSON; escape quotes and Windows backslashes or use C:/repo/file.ts, and write each summary line break as \\n rather than dropping it. Never claim unperformed work.";
26
- /** Control-plane completion remains available when the execution-tool budget is exhausted. */
27
10
  export declare function completionTool(options: RunOptions): ToolSchema;
28
- /**
29
- * Recorded when an envelope carried no summary and its serialized output is shown as the answer.
30
- * The node that ends a run sends such a handoff back for a real summary (completion-gates.ts); a
31
- * handoff between nodes keeps the stand-in, since the next node reads the output itself.
32
- */
33
11
  export declare const OUTPUT_STOOD_IN_NOTE = "completion had no summary; its serialized output stands in as the answer";
34
12
  export declare const COMPLETION_ALONE_ERROR = "complete_agent must be called alone; no tools in this batch were executed.";
35
- /**
36
- * Only a direct, sole model control call can request completion, never a tool observation.
37
- *
38
- * The one companion allowed is `update_todos`: closing the plan and handing off in the same batch is
39
- * the natural last move, and it changes no workspace state. Rejecting it threw the todo update away
40
- * too, so every repair prompt then showed the model a plan that still said "in progress" for work it
41
- * had finished, and the model spent its repairs arguing with that stale list. The todo calls are
42
- * returned for the runtime to apply before it judges the handoff; anything else still voids the batch.
43
- */
44
13
  export declare function completionResponse(response: ModelResponse): ModelResponse & {
45
14
  completionError?: string;
46
15
  completionSource: 'complete_agent' | 'final_text';
47
16
  completionTodoCalls?: ModelResponse['toolCalls'];
48
17
  };
49
- /**
50
- * Undo one extra layer of string escaping in a summary. Some models JSON-escape the summary again
51
- * inside already-JSON tool arguments, so the parsed text holds a backslash and an "n" where its
52
- * line breaks belong, and the transcript draws its markdown as one literal paragraph.
53
- *
54
- * Two shapes are decoded. A summary escaped throughout has no real line break and at least two
55
- * escaped paragraph breaks, or at least two escaped breaks outside code that open markdown
56
- * structure (one paragraph break and a list is enough); every escape in it is undone. A model can also switch to the extra
57
- * escaping partway through, leaving a few real line breaks and the rest escaped: one `## heading`
58
- * then swallows everything after it. That mixed summary is decoded only when at least two escaped
59
- * breaks outside code open markdown structure (a heading, list item, quote, table, fence, or a
60
- * paragraph break before text). Only its `\"` outside code, and its `\n` outside code on the lines
61
- * holding that structure, are undone, so inline code, real fenced blocks and the lines the model
62
- * wrote correctly keep the escapes and Windows paths they show. A summary that merely mentions an
63
- * escape sequence, or a Windows path, is left as written.
64
- * Sessions saved before this decode ran still hold the escaped text, so their readers apply it too
65
- * (`displayHistory` in sessions.ts).
66
- */
67
18
  export declare function decodeDoubleEscapedSummary(summary: string, notes?: string[]): string;
68
- /**
69
- * Replace a completion envelope a model wrote as message text, so the transcript never shows raw
70
- * JSON. Two live shapes, both glm-5.3-flash on GX10:
71
- * - Run 3a8378f0 ended a QA report with "Submitting the report." and then the whole envelope as
72
- * text, `{"summary":"…\n\n## 1. Target…","tests":[…],"prUrl":"…"}`, about 12 KB, instead of
73
- * calling complete_agent. The runtime rightly sent it back; the caller passes a `note` saying so,
74
- * which stands in for the envelope (the report itself arrives later through complete_agent).
75
- * - Session bbedcfbf narrated beside its tool calls as `{"summary":"Starting the PR comment fixer
76
- * round…","tests":[]}`. With no `note`, the envelope's summary stands in for it, decoded like a
77
- * completion's, so the narration still reads as prose.
78
- *
79
- * Only an envelope that ends the text is replaced: a JSON object whose `summary` is a string, which
80
- * parses on its own from its opening brace to the end of the text (closing brackets the model left
81
- * off are supplied, as for a completion), bare or as the whole of a final fenced block. One shown in
82
- * inline code, one followed by more prose, and otherwise malformed JSON are left as written.
83
- */
84
19
  export declare function withoutTrailingEnvelope(text: string, note?: string): string;
85
- /**
86
- * Remove the completion fields a model copied into the end of its summary as text. Some models
87
- * call complete_agent with every field set and then also write the same fields out under the
88
- * answer:
89
- *
90
- * Browser is open.
91
- *
92
- * summary: Browser panel opened successfully on example.com.
93
- * tests: none — no checks were required.
94
- * outcome: completed
95
- * output: {}
96
- *
97
- * The transcript draws the summary as the answer, so those lines reached the user as a raw field
98
- * dump. Unlike an embedded JSON envelope (`rejectEmbeddedEnvelope`), the arguments themselves are
99
- * intact, so there is nothing for a retry to repair: the trailing block is dropped and recorded.
100
- *
101
- * Only a block at the very end is touched, outside code, after a blank line (or making up the whole
102
- * summary), in which every line is a field line or continues one, and which holds an `outcome:` line
103
- * and at least one other field. When the completion carries an outcome, the echoed line must name
104
- * that same outcome, so an answer that ends on "Tests: 12 passed" and "Output: dist/" is not an echo.
105
- * A summary that shows the fields in a code block is left as written. When the block is the whole
106
- * summary, its `summary:` field, with the lines under it, becomes the answer.
107
- */
108
20
  export declare function stripEchoedEnvelope(summary: string, outcome: string | undefined, notes?: string[]): string;
109
- /**
110
- * Parse one completion, accepting mechanically imperfect envelopes that are semantically correct.
111
- *
112
- * `notes`, when provided, collects each host-side coercion ("output arrived as a JSON-encoded
113
- * string", "dropped artifacts entries the runtime did not issue"). Those repairs are
114
- * deterministic transforms the model cannot achieve by retrying: the artifacts channel can never
115
- * hold a pull-request URL, and a model that double-encodes `output` once will do it again. A
116
- * rejection for either burns a repair on a coin flip and can end a node whose work is already
117
- * done, so they are coerced and recorded instead.
118
- */
119
21
  export declare function parseCompletion(text: string, options: RunOptions, reject: (reason: string) => void, notes?: string[], stopReason?: string): Completion | undefined;