@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,8 +1,10 @@
1
+ import { type Config } from './config.js';
1
2
  import { type ProviderConfig } from './providers.js';
2
3
  import { removeCodexAccount } from './codex-auth.js';
3
4
  import { CodexAccountAuth } from './codex-browser-auth.js';
4
5
  import { AnthropicConsoleAuth } from './anthropic-console-auth.js';
5
6
  import { OpenCodeSignIn } from './managed-sign-in.js';
7
+ import { type SignInProbes } from './sign-in-detection.js';
6
8
  import type { CliSignIn } from './cli-sign-in.js';
7
9
  import { checkGraphModelHealth } from './graph-health.js';
8
10
  import { loadAccessibleGraph } from './membership.js';
@@ -11,116 +13,40 @@ import { type GhRunner } from './pull-requests.js';
11
13
  import { type Completion, type RunResult } from './runtime.js';
12
14
  import { CodeIntelligenceManager } from './code-intelligence/CodeIntelligenceManager.js';
13
15
  import { type AppServerErrorCode } from './app-server/protocol.js';
14
- /**
15
- * `andorra app-server --stdio`: the engine a non-TUI client drives.
16
- *
17
- * The transport, the wire types, and the client-side mirror live in `./app-server/protocol.ts` and
18
- * `./app-server/workspace.ts`. This module owns the state a client cannot: the active run, the
19
- * approval and question exchanges inside it, open terminals, the graph editor server, and the
20
- * lazily created code-intelligence manager.
21
- *
22
- * One run at a time
23
- * -----------------
24
- * A process owns at most one run. The TUI is one run by construction and a second concurrent run
25
- * would need the durable multi-run runtime the roadmap defers, so `run.start` reports `busy`
26
- * instead of quietly interleaving two runs' approvals and journals.
27
- *
28
- * Nothing here prints to stdout except protocol lines: a stray write would corrupt the stream.
29
- * Diagnostics go to stderr.
30
- */
31
16
  declare class AppServerError extends Error {
32
17
  readonly code: AppServerErrorCode;
33
18
  constructor(code: AppServerErrorCode, message: string);
34
19
  }
35
20
  type ManagedSignInService = Pick<CliSignIn, 'start' | 'status' | 'cancel' | 'logout' | 'submitCode' | 'close'>;
36
21
  type OpenCodeSignInService = Pick<OpenCodeSignIn, 'start' | 'status' | 'cancel' | 'logout' | 'submitCode' | 'close'>;
37
- /**
38
- * Merge a client's provider list with the stored secrets.
39
- *
40
- * The client reads providers through `configView`, which deliberately omits every `apiKey`, so a
41
- * round trip that replaced the array wholesale would delete the credentials of every provider the
42
- * user did not retype: making another provider active or removing one would break the rest. An entry
43
- * that names no key therefore keeps the stored one, and an explicit `null` is how a client asks for
44
- * one to be removed. The configured model list is carried over the same way, because a client written
45
- * before that field existed reads an entry without it and cannot send back what it never saw.
46
- *
47
- * `streamIdleTimeoutMs` follows the same retain-on-omit rule, because a desktop build from before the
48
- * field exists cannot name it: reconstructing the provider from its entry alone would silently delete
49
- * the stored bound and restore the indefinite stall the field exists to prevent. A client that wants
50
- * the bound gone names it as `null` rather than leaving it out. The per-model context windows follow
51
- * that rule too: an older client's save must not erase the limits a newer one stored, and `null`
52
- * removes the map.
53
- *
54
- * Retention stops where the type cannot hold the value. Codex accepts neither a key nor a stream bound,
55
- * and the clients that leave both out rather than naming the removal — one built before the bound
56
- * existed cannot name it at all — are exactly the ones converting a provider to Codex. Carrying either
57
- * value into the new entry made `validateConfig` refuse the whole save over fields the type does not
58
- * have, so a Codex entry starts without them. A model list is not one of those: the configuration
59
- * allows it on Codex, so it is retained for that type like any other.
60
- *
61
- * A Codex entry's account slot and its recorded email follow the retain-on-omit rule with the same
62
- * urgency: a client that omits the slot has simply never seen it — the provider view does not report
63
- * it — and dropping it on save would silently point a second account at the default home's sign-in.
64
- */
22
+ export declare function rekeyProjectExtensions(config: Config, fromKey: string, toKey: string, merged: boolean): Config;
65
23
  export declare function mergeProviderSecrets(stored: ProviderConfig[], incoming: unknown[]): ProviderConfig[];
66
24
  export declare function isFinalWakeRefusal(error: unknown): boolean;
67
- /**
68
- * The account a finished run leaves on the session turn.
69
- *
70
- * A graph that finished one node before it was cancelled, exhausted, or failed in the next
71
- * returns that node's completion alongside the non-success status. The status is the attempt's
72
- * last word — the client branches on it to keep a stopped attempt's activity visible — so the
73
- * retained completion carries it too; without the stamp a stopped attempt folds like a done turn.
74
- *
75
- * `closedWithRun` says the abort came from the app going away rather than from a Stop. Closing is
76
- * not the person giving up on the attempt: it is recorded as `interrupted`, the same status startup
77
- * recovery gives a run whose engine was killed, so it reads as stopped work to resume (the row's
78
- * mark and the Resume control both key on it) instead of a stop that was asked for.
79
- */
80
25
  export declare function finalCompletion(result: RunResult | undefined, aborted: boolean, failure: unknown, closedWithRun?: boolean): Completion;
81
- /**
82
- * The session as it was before this run's in-flight marker: the marker turn out of both histories.
83
- *
84
- * The marker is written into history and contextHistory together - one is the transcript a client reads, the
85
- * other the model context a later run seeds from - so an abandoned start has to remove it from both. Stripping
86
- * only the transcript leaves the two disagreeing: the rail shows the session as it was, while the next attempt
87
- * seeds from a turn reporting work this run never did, and is free to repeat it.
88
- */
89
26
  export declare function withoutRunMarker(record: SavedSession, runId: string): SavedSession;
90
27
  export interface AppServerOptions {
91
28
  directory?: string;
92
29
  output?: NodeJS.WritableStream;
93
30
  error?: NodeJS.WritableStream;
94
- /** Overridable so a test can answer the model preflight without reaching a provider. */
95
31
  checkGraphHealth?: typeof checkGraphModelHealth;
96
- /** How long a model that answered the preflight is not asked again; `0` asks every model before every run. */
97
32
  modelHealthTtlMs?: number;
98
- /** Overridable so a test can watch the code-intelligence manager's mode without starting CodeGraph. */
99
33
  createCodeIntelligence?: typeof CodeIntelligenceManager.create;
100
- /** Overridable so a test can run a graph whose access rules it cannot meet. */
101
34
  loadGraph?: typeof loadAccessibleGraph;
102
- /** Provider authentication is owned here, independently of the Andorra account sign-in. */
103
35
  codexAuth?: Pick<CodexAccountAuth, 'start' | 'status' | 'cancel' | 'logout' | 'close'>;
104
- /** Overridable so a test can watch a retired slot without reaching the Codex CLI. */
105
36
  removeCodexAccount?: typeof removeCodexAccount;
106
- /** Claude Console sign-in for Anthropic providers; overridable so a test never spawns `ant`. */
107
37
  anthropicAuth?: Pick<AnthropicConsoleAuth, 'start' | 'status' | 'cancel' | 'logout' | 'discard' | 'close'>;
108
- /** Subscription sign-ins run through a vendor CLI; overridable so a test never spawns one. */
109
38
  managedSignIn?: {
110
39
  claude?: ManagedSignInService;
111
40
  grok?: ManagedSignInService;
112
41
  opencode?: OpenCodeSignInService;
113
42
  };
114
- /** Overridable so a test can answer `gh` without reaching GitHub. */
43
+ signInProbes?: Partial<SignInProbes>;
115
44
  gh?: GhRunner;
116
- /** How often the pull request watcher polls; a test shortens it. */
117
45
  pullRequestPollMs?: number;
118
46
  }
119
47
  export declare class AppServer {
120
48
  private automationCheck?;
121
- /** The daily auto-archive pass; a change to the setting runs one immediately as well. */
122
49
  private autoArchiveCheck?;
123
- /** The tail of the auto-archive passes, so a settings change never runs one over another. */
124
50
  private autoArchivePass;
125
51
  private readonly automationTasks;
126
52
  private readonly manualAutomationTasks;
@@ -129,7 +55,6 @@ export declare class AppServer {
129
55
  private readonly output;
130
56
  private readonly error;
131
57
  private readonly checkGraphHealth;
132
- /** The models that answered recently, shared with the other engines on this home. */
133
58
  private readonly modelHealth;
134
59
  private readonly createCodeIntelligence;
135
60
  private readonly loadGraph;
@@ -138,265 +63,92 @@ export declare class AppServer {
138
63
  private readonly claudeSignIn;
139
64
  private readonly grokSignIn;
140
65
  private readonly openCodeSignIn;
141
- /** Retires a removed provider's slot home; a seam so a test never has to spawn the Codex CLI. */
66
+ private readonly signInProbes;
67
+ private readonly detectedSignIns;
142
68
  private readonly retireCodexAccount;
143
- /** The `gh` the pull request settings and watcher run through. */
144
69
  private readonly gh;
145
- /** Polls the PRs whose sessions asked for Auto-fix; one engine per home actually polls. */
146
70
  private readonly pullRequestWatcher;
147
- /** The files each session's agent changed since the person last reviewed them (Keep / Undo). */
148
71
  private readonly sessionChanges;
149
- /** The wakes this engine armed for Auto-fix, checked against the PR record again before delivery. */
150
72
  private readonly autoFixWakes;
151
- /**
152
- * A run of the session waiting inside the `pull_request` tool's `await_review` for its PR's next review, by
153
- * session: the review comments the watcher finds go to it instead of to a wake, and it hears when the PR is
154
- * merged, closed, dismissed or has Auto-fix switched off.
155
- */
156
73
  private readonly reviewWaiters;
157
- /** Sessions whose review wait is reserved and still being prepared (`awaitReview`). */
158
74
  private readonly reviewWaitsStarting;
159
- /**
160
- * The account's graph sync, so a graph saved on another machine is listed here too. A first pass that
161
- * outlasts the listing's bounded wait publishes `graphs.changed`: that listing already answered from
162
- * the copy on disk, and the surface behind it has to read again to see what the pass restored.
163
- */
164
75
  private readonly graphSync;
165
76
  private readonly terminals;
166
- /** Background jobs and QA terminals this engine holds, each with the session whose run started it. */
167
77
  private readonly backgroundTasks;
168
78
  private stopBackgroundWatch;
169
- /** Holds a flooding shell's output back while the protocol stream is behind. */
170
79
  private readonly flow;
171
- /** Panel browsers: interactive session-owned pages, separate from the agent's qa.browser_session tool. */
172
80
  private readonly browserViews;
173
- /** Pending approval and question exchanges, keyed by the id the client answers with. */
81
+ private readonly browserExtensions;
82
+ private extensionStatus;
174
83
  private readonly pending;
175
- /** Pending panel-browser relay exchanges, keyed by the id the desktop answers with. */
84
+ private readonly waiting;
176
85
  private readonly panelRelays;
177
- /** Panel operations executing on this engine, keyed by the relay that asked for them. */
178
86
  private readonly panelOperations;
179
- /**
180
- * The runs those operations answer with, keyed the same way.
181
- *
182
- * Every window attached to a paired machine receives the same request frame, so the same relay id
183
- * can arrive twice. A repeated id joins the run already going rather than pressing the key or
184
- * opening the tab a second time.
185
- */
186
87
  private readonly panelOperationRuns;
187
- /** Requests in flight: shutdown waits for them rather than exiting under their I/O. */
188
88
  private readonly requests;
189
89
  private run?;
190
90
  private readonly originalModelGraphs;
191
- /**
192
- * The attempt whose work is over and whose finalizer is still putting it away.
193
- *
194
- * The live-run slot is released before the terminal events go out — a client that chains runs sends
195
- * its next `run.start` the moment it sees `run.completed`, and that start must not meet `engine-busy`
196
- * while the engine is only tidying up — so during the tail `run` no longer names the attempt, but
197
- * its open claim still stands and the merged save has just landed. A rename that arrives in that
198
- * window belongs to this process all the same: naming the finishing attempt is how `renameSession`
199
- * keeps excusing its claim instead of refusing the user's own run as "another window".
200
- */
201
91
  private finishingRunId;
202
- /** The session the finishing attempt belongs to, so the excuse above is not handed to a stranger. */
203
92
  private finishingSessionId;
204
- /**
205
- * Why the active run's controller was aborted — finalization reads it to tell a Stop the person
206
- * pressed from the app being closed while the attempt was still running. Cleared when a run starts.
207
- */
208
93
  private runAbort?;
209
- /** Set synchronously while a start is being prepared, so two starts in one tick cannot both pass the guard. */
210
94
  private starting;
211
- /**
212
- * Self-wake registry for this engine, shared by the runs it serves.
213
- *
214
- * Engine-wide rather than per run on purpose: a wake armed by a task is expected to arrive after that
215
- * task is over, which is the entire point of arming one. Every wake carries the session that armed it, so
216
- * the prompt — and the wait a row draws for it — goes back to that session, not to whichever one happens
217
- * to be running: an engine serves many sessions over its life, and two of them can be waiting at once.
218
- * The CLI gets the same tool through a registry of its own; here the engine is also the deliverer,
219
- * because a window has no loop to carry a wake in.
220
- */
221
95
  private readonly timers;
222
- /** Engine timer for the next deadline, so a wake due while a run is in flight is retried. */
223
96
  private timerCheck?;
224
- /** One delivery pass at a time, so a due callback cannot start a second one. */
225
97
  private timerDeliveryTask?;
226
- /**
227
- * A branch switch in flight, held until it completes.
228
- *
229
- * Switching the tree and starting a run are separate requests, and the checkout awaits Git twice:
230
- * a start arriving in that window used to pass the busy guard, launch the agent, and then have the
231
- * tree switched underneath it — so the branch the changes land in is not the one the task started
232
- * on. The reservation is taken synchronously and refused, not queued: a run that waits would begin
233
- * against a repository whose branch the user has stopped describing.
234
- */
235
98
  private checkout?;
236
- /** Memoized creation of the run-record directory, which this mode must do for itself. */
237
99
  private runRecordsReady?;
238
- /**
239
- * The session a `run.resume` is preparing: the record is read and will be saved by the resumed
240
- * run, so a rename or delete accepted in that window is silently reverted. `this.run` does not
241
- * cover it yet — the run is installed only when preparation ends.
242
- */
243
100
  private startingSession?;
244
- /**
245
- * Each live run's journal writer. A writer holds the events its file refused and writes them once
246
- * appends succeed again, so it is also what knows, at finalization, whether the journal is a
247
- * complete account (the record and a marker file carry the answer past a crash).
248
- */
249
101
  private readonly journals;
250
- /**
251
- * The session trajectory of the run in flight: one sanitized debug log per session
252
- * (`trajectories/<sessionId>.jsonl` in this home), appended by every run and resume of that
253
- * session. Unlike the per-run journal it spans attempts, and it records the model calls
254
- * themselves — requests, responses, errors — where the journal stays the engine's own resume
255
- * record. Cleared when the run's final marker has been written and flushed.
256
- */
257
102
  private trajectory?;
258
- /** Tail of the configuration write queue; see `serializeConfig`. */
259
103
  private configWrites;
260
- /** Tail of each Codex slot home's lifecycle; a retirement and a sign-in on one slot never interleave. */
261
104
  private readonly slotWrites;
262
- /** The run in flight, retained so shutdown can wait for its bookkeeping instead of racing it. */
263
105
  private runTask?;
264
- /**
265
- * Resolvers waiting for a run's first provider answer — or for its end, whichever comes first.
266
- *
267
- * Automatic titling holds until then: the run's first request must reach a serializing endpoint
268
- * ahead of the naming request, and after that answer the run executes its turn's tools while the
269
- * provider is free. Waiting for the whole run instead would leave a session's name as the local
270
- * word-slice for the entire task, and a stopped task would never be named at all.
271
- */
272
106
  private readonly titleReleases;
273
- /** Automatic title requests on the wire, by session: new work must never queue behind one. */
274
107
  private readonly sessionTitles;
275
- /** Bumped whenever new work starts; a title begun under an older generation never runs. */
276
108
  private workGeneration;
277
- /** Sign-in and discovery controllers, aborted at shutdown so neither outlives the client. */
278
109
  private readonly operations;
279
- /** A start still being prepared, awaited and refused at shutdown. */
280
110
  private prepareTask?;
281
- /** The poll for runs whose holder was still shutting down when this engine started; see `watchForeignEngineShutdown`. */
282
111
  private foreignEngineWatch?;
283
112
  private editor?;
284
- /** The editor start in flight, so two opens cannot race into two servers. */
285
113
  private editorTask?;
286
114
  private codeIntel?;
287
- /** The tail of the manager openings, taken one at a time: a run and a warm-up can ask at once. */
288
115
  private codeIntelOpening;
289
- /**
290
- * The remote-serve outcome this engine holds: either the listener whose lock and descriptor are
291
- * ours to release at close, or the record that this installation has nothing to serve.
292
- */
293
116
  private remoteServe?;
294
- /**
295
- * Outbound engine links, one per paired workspace this engine relays for its client.
296
- *
297
- * A link is the long-lived event stream to the paired machine plus the connection id its requests
298
- * identify as; the frames it receives are re-emitted on this engine's own stream as
299
- * `remote.engine.event`, which is how a paired machine's engines reach the desktop without the
300
- * desktop ever speaking TLS itself.
301
- */
302
117
  private readonly engineLinks;
303
- /** The last grant each workspace's live probe reported, for offline views (see remoteWorkspaceState). */
304
118
  private readonly lastKnownGrants;
305
- /** Tail of the queue serializing serve/lock transitions; see `serializeRemote`. */
306
119
  private remoteOps;
307
120
  private closed;
308
- /**
309
- * Whether events still reach the protocol stream. Unlike `closed`, this stays open across the
310
- * shutdown wait: the run finalizer settles during that window, and a client that stayed connected
311
- * to ask for the stop — an engine stop with the app still running — is exactly the one that has
312
- * to hear the terminal story. What the finalizer emits is normalized to agree with the record it
313
- * just wrote, so the event and the next `runs.list` tell the same one.
314
- */
315
121
  private emitsStopped;
316
- /** The last run's finish enqueue; close() waits for it before draining the outbox. */
317
122
  private telemetrySettle;
318
123
  onStop?: () => void;
319
124
  constructor(options: AppServerOptions & {
320
125
  output: NodeJS.WritableStream;
321
126
  error: NodeJS.WritableStream;
322
127
  });
128
+ private extensionListing;
129
+ private agentExtensionListing;
130
+ private runExtensionStep;
131
+ private extensionsChanged;
323
132
  private emit;
324
133
  private log;
325
- /** The handshake every client waits for before it sends anything. */
326
134
  ready(): Promise<void>;
327
- /** Queue one auto-archive pass behind any pass still running. A failure is logged, never thrown. */
328
135
  private reapSessions;
329
- /**
330
- * Archive the sessions idle past the configured number of days, and return to the rail the ones a
331
- * previous pass archived that no longer qualify (the setting was raised or turned off). Sessions the
332
- * user archived by hand carry no reaper mark, so they are never returned.
333
- *
334
- * A session with a run in flight or a wake armed is skipped, for the reason `setSessionArchived`
335
- * refuses it: the run saves the record it captured and would revert the flag, and a filed row hides
336
- * the approval or the wake it is waiting on. A wake armed by another engine is invisible to this
337
- * process's registry, so the claim arming wrote — swept here once its owner is gone — is what holds
338
- * the session too. Every change is re-planned against the record and the setting read under the
339
- * session's mutation lock: another window's pass, a run that just started, a threshold another
340
- * engine saved (or the reaper another turned off) after this pass opened, or a manual filing that
341
- * landed since the list was read is never overwritten.
342
- */
343
136
  private autoArchiveSessions;
344
- /**
345
- * The handshake payload, built once for the `ready` event and `host.info` so the two cannot drift:
346
- * a client that read one and then the other would otherwise see different capabilities, and the
347
- * capability is what decides whether it offers a control at all.
348
- */
137
+ private currentRun;
349
138
  private hostInfo;
350
139
  private version;
351
- /**
352
- * Parse and answer one input line. Never throws: every failure becomes a response.
353
- *
354
- * The request is tracked while it runs, because lines are read concurrently and `close()` has to be able
355
- * to wait for the work a shutdown would otherwise cut through — a read still in progress when the process
356
- * exits, or a state-changing request finished after the client was told the engine had stopped.
357
- */
358
140
  handle(line: string): Promise<void>;
359
141
  private dispatchLine;
360
142
  private write;
361
143
  private dispatch;
362
144
  private store;
363
- /**
364
- * Canonicalize a workspace the way session records are stored.
365
- *
366
- * `sessions.create` and `run.start` record the real path, but `SessionStore.list` compares
367
- * lexically, so a project added through a symlink, a junction, or a differently cased Windows path
368
- * would list nothing even though its sessions exist. A folder that no longer exists is passed
369
- * through unchanged: it simply has no sessions.
370
- */
371
145
  private listableWorkspace;
372
- /**
373
- * The sessions a client's rail lists: one workspace, or several in one pass.
374
- *
375
- * Reading the store means reading and parsing every session record it holds, so a client that asked
376
- * once per project paid that whole scan per project — with P projects and S saved sessions, P × S
377
- * reads and parses to fill one tree. The batched form canonicalizes each requested path exactly as
378
- * the single form does, reads the store once, and answers with the same summaries grouped by the
379
- * path the client asked for, so it can file each group under its own row.
380
- */
381
146
  private listSessions;
382
- /**
383
- * Run a configuration change as a read-modify-write with nothing interleaved.
384
- *
385
- * Requests are answered concurrently by design, so two saves that each loaded the file and then
386
- * wrote their own merge would silently discard one another: toggling two settings in quick
387
- * succession would keep only the second. Every write to the configuration file goes through here.
388
- */
389
147
  private serializeConfig;
390
- /**
391
- * Run one Codex slot home's lifecycle step after every earlier one has settled.
392
- *
393
- * A slot home is created by a sign-in and deleted by a retirement, and the two requests can arrive
394
- * at once. Ordering them per slot is what keeps a retirement from deleting a home that a sign-in
395
- * began after the provider was re-created, without serializing unrelated accounts against each other.
396
- */
397
148
  private slotLock;
398
149
  private setConfig;
399
- /** Manage the extension folders shared by the CLI and desktop. */
150
+ private projectExtensionEntry;
151
+ private setProjectExtensionEntry;
400
152
  private extensionKind;
401
153
  private skillResources;
402
154
  private skillRead;
@@ -404,616 +156,127 @@ export declare class AppServer {
404
156
  private installExtension;
405
157
  private removeExtension;
406
158
  private setExtensionEnabled;
407
- /** Preserve MCP credentials when toggling or deleting an existing entry. */
408
159
  private mutateMcp;
409
- /**
410
- * One configured MCP server as an edit form can show it: the command and its arguments, or the
411
- * endpoint, and the *names* of its environment variables and headers. Their values are secrets
412
- * the engine never returns; an edit keeps a saved value by naming it (see mergeMcpEdit). The
413
- * endpoint is returned without its query string, which can hold a credential.
414
- */
415
160
  private mcpServerView;
416
- /**
417
- * Check one configured MCP server, on the person's explicit request ("Check Connection"): start
418
- * it, ask for its tools, stop it, and record the answer beside the ones tasks record. A server that
419
- * is turned off is reported off without being started. A stdio server starts in the workspace the
420
- * caller names, as it would for a task there, or the home folder. A page never calls this on its
421
- * own: a task asks before it connects a server, and opening Settings is not that consent.
422
- */
423
161
  private mcpStatus;
424
- /**
425
- * What each configured server last answered, without starting anything: the status a task's
426
- * connection or an explicit check recorded, while it still describes the server's current
427
- * definition. An edited server, and one never connected, has none ("Not checked").
428
- */
429
162
  private mcpStatuses;
430
- /**
431
- * Apply one provider change inside the serialized configuration transaction.
432
- *
433
- * A client cannot do this atomically for itself: it would read the configuration, change the list, and
434
- * write it back, and the engine treats a `providers` array as a replacement — so a change the CLI or
435
- * another window made between the two requests would be deleted by the write. The read-modify-write
436
- * happens here, under the same queue that orders every configuration write, which makes one provider
437
- * edit indivisible.
438
- *
439
- * Exactly one operation per call: `upsert` (one provider entry, by id), `remove` (an id), or
440
- * `clearKey` (drop one provider's saved secret). `active` may accompany an upsert.
441
- */
442
163
  private updateProviders;
443
- /**
444
- * Delete the Claude Console logins of providers a committed configuration no longer signs in.
445
- *
446
- * The configuration is read again first: an overlapping request can re-create the provider with
447
- * sign-in before this runs, and that provider's fresh login is not this removal's to delete.
448
- */
449
164
  private retireAnthropicAccounts;
450
- /**
451
- * Delete the slot homes a committed configuration no longer names.
452
- *
453
- * Each retirement takes the slot's lock, which a sign-in also takes, and re-reads the configuration
454
- * before deleting: an overlapping request can re-create the provider and sign the slot in before
455
- * this removal finishes, and that fresh session is not the retired one's to delete.
456
- */
457
165
  private retireSlots;
458
166
  private discoverModels;
459
- /** Local-client only. The remote engine relay deliberately does not admit these methods. */
167
+ private detectProviderSignIns;
168
+ private importProviderSignIns;
460
169
  private providerAuth;
461
- /**
462
- * Subscription sign-in through a vendor CLI's own login: Claude Code, Grok, or one of OpenCode's
463
- * upstream providers. Local-client only, like the others. Each of these logins belongs to the CLI
464
- * on this machine rather than to one provider entry, so the draft a person is adding can sign in
465
- * before it is saved; a providerId is accepted and ignored.
466
- */
467
170
  private managedProviderAuth;
468
- /**
469
- * Claude Console sign-in for one configured Anthropic provider. Local-client only, like Codex
470
- * sign-in: the remote engine relay does not admit these methods.
471
- */
472
171
  private anthropicProviderAuth;
473
- /**
474
- * Record the account email a sign-in just verified on the provider entry that names it.
475
- *
476
- * The label that tells two linked accounts apart is derived from this stored email, and a window
477
- * can sign in from the provider's detail panel where no form save follows. Best effort: a
478
- * configuration that cannot be written must not turn a completed sign-in into an error.
479
- */
480
172
  private recordCodexEmail;
481
- /**
482
- * Test one provider's connection exactly as configured, for the settings surface's Test button.
483
- *
484
- * `model` names one model to check instead of the provider's active one: the probe is the same
485
- * listing either way, and `modelAvailable` then answers whether that model is on offer. The
486
- * override never reaches the stored configuration.
487
- *
488
- * The probe is read-only and spends no tokens, and its deadline is the operation's own rather than
489
- * the client's request deadline: a test that outlives the window that asked for it is a test whose
490
- * answer the window can no longer show.
491
- */
492
173
  private testProviderEndpoint;
493
- /** Run one long operation whose cancellation shutdown owns, optionally with its own deadline. */
494
174
  private operation;
495
175
  private accountStatus;
496
- /**
497
- * The signed-in account's own profile.
498
- *
499
- * The profile lives in the account service, so it follows the account rather than the machine:
500
- * the same profile is the same on every installation that signs in.
501
- */
502
176
  private accountProfile;
503
- /** Save the profile fields the owner changed. */
504
177
  private updateAccountProfile;
505
- /** What this account has done on this machine, in totals. */
506
178
  private sessionStats;
507
179
  private signIn;
508
180
  private signOut;
509
181
  private publishAccount;
510
- /**
511
- * The log a session's conversation was written to.
512
- *
513
- * A session the window started writes to the log named after its own id. A session the terminal
514
- * created or continued writes to the log of that terminal's process, whose name is not the
515
- * session's id, and the record names that log. The name is a file stem, never a path, so it can
516
- * only name a log in this home.
517
- */
518
182
  private trajectoryIdOf;
519
183
  private readSession;
520
- /**
521
- * The session behind a due wake, or `undefined` only when its record is genuinely not there.
522
- *
523
- * `readSession` is written for a client asking about a session, so a missing file, a lock, a permission
524
- * problem and a half-written record all answer "that session no longer exists". For a delivery that answer
525
- * is destructive: the wake would be spent - and its prompt lost - on a condition that clears by itself.
526
- * Only a file that is not there is treated as a deleted session here; everything else is thrown so the
527
- * caller can put the wake back and try again on the retry the registry gives a wake already due.
528
- */
529
184
  private readSessionForWake;
185
+ private withSessionMutation;
186
+ /** The id a folder's project keeps across a rename, so a task started after the move shares the older tasks' browser profile. */
187
+ private configuredProjectId;
530
188
  /**
531
- * Run a session mutation as one step against every other writer of this home.
532
- *
533
- * A mutation is a read-modify-write of the whole record, so two that overlap lose one — and one
534
- * that lands after a delete recreates what the user removed. The lock spans exactly the busy
535
- * check, the fresh read, and the save; the check has to sit inside it, since the state it reads is
536
- * the state the mutation is about to overwrite. A session held by another writer past the wait is
537
- * answered `busy` rather than racing it.
189
+ * The id a task started in `root` is filed under: the one the project already answers to, otherwise the one its path
190
+ * derives. A path can outlive the project that was there: rename A to B and B keeps the identity it moved with, so a new
191
+ * folder created at A would derive that same identity and share B's browser profile and task grouping. The newcomer
192
+ * takes a fresh id instead, remembered so its later tasks keep it.
538
193
  */
539
- private withSessionMutation;
194
+ private projectIdFor;
540
195
  private createSession;
541
196
  private renameSession;
542
- /**
543
- * `/compact` for a client: fold the session's model context into one summary entry, the same
544
- * deterministic compaction the terminal's `/compact` applies (`compactHistory`). Only
545
- * `contextHistory` — what the next run seeds from — changes; `history`, the transcript a client
546
- * shows, keeps every turn. A run owns the record while it is live, and its finalizer would write
547
- * the uncompacted context back, so compaction waits for the session to be idle.
548
- */
197
+ private setSessionGoal;
198
+ private emitSessionGoal;
549
199
  private compactSession;
550
- /**
551
- * Persist a finished run's record without reverting what the user changed while it ran.
552
- *
553
- * The finalizer builds its record from the snapshot captured at startup, but a rename is now
554
- * accepted mid-run: a bare save would put the old name back, and dropping the `renamed` pin with
555
- * it would let the automatic title overwrite a name the user chose after the run settled. So the
556
- * save re-reads the record under the same per-session mutation lock the user's own renames take.
557
- * The fields this process owns — the turns, usage and widgets the run just produced — are written
558
- * from the captured record; everything the user can edit stays with what is on disk. A read that
559
- * finds nothing saves the captured record unchanged, as before: losing the finished turn would be
560
- * the worse outcome. The lock is taken with retries because a rename's critical section is one
561
- * small read-modify-write, and momentary contention must not turn a finished run into an unsaved
562
- * one.
563
- *
564
- * The finalizer's summary-carrying events publish through `publish`, inside the same critical
565
- * section as the save. Publishing after the lock would let a rename land in between: it would
566
- * save and publish its new name, and the finalizer would follow with the older snapshot it
567
- * holds, so the client's unconditional upsert would briefly revert the row the user just renamed.
568
- */
569
200
  private saveFinalizedSession;
570
- /**
571
- * Put a session away from (or back onto) the rail without deleting it.
572
- *
573
- * Archive is organization, not content: unlike rename it does not touch `updatedAt`, so archiving a
574
- * session never reorders the list a user is reading. It is refused while the session owns a run for
575
- * the same reason rename is — `executeRun` saves the record it captured at startup, which would
576
- * silently revert the flag when the run finished, and a row that vanished mid-run would strand the
577
- * approval it is waiting for.
578
- */
579
201
  private setSessionArchived;
580
202
  private deleteSession;
581
- /**
582
- * Start one run and answer immediately with its identity.
583
- *
584
- * The execution continues in the background and reports through events, so a client can cancel,
585
- * answer an approval, or open a terminal while the model works.
586
- */
587
203
  private startRun;
588
- /**
589
- * Resume a stopped attempt: a new run on the same session, continuing where the attempt stopped.
590
- *
591
- * The attempt being resumed has to be a recorded one whose process is gone: `succeeded` has
592
- * nothing left to do, and `running` with a live pid is the original still working, not a stopped
593
- * attempt. The session is not forked the way an explicit `run.start` resume-branch forks it:
594
- * a resumed attempt belongs on the same timeline as the attempt it continues, so both turns —
595
- * the stopped one and the new one — stay visible together. The new run gets its own id, its own
596
- * journal, and its own open record; `resumedFrom` on both records names the lineage. Everything
597
- * after this point is `run.start`'s own path — same events, same client run flow, one-run-per-
598
- * engine guard included.
599
- */
600
204
  private resumeRun;
601
- /**
602
- * Switch the working tree to a branch, holding the tree for the whole operation.
603
- *
604
- * One run at a time, in both directions: a switch is refused while a run or a prepared start
605
- * exists, and a start is refused while a switch is in flight. The reservation is taken before the
606
- * first await, because the workspace resolution in between is exactly the window a `run.start`
607
- * could otherwise slip through.
608
- */
609
205
  private switchBranch;
610
- /** Refuse to continue work whose engine is shutting down. */
611
206
  private assertRunning;
612
- /**
613
- * Start one run. `internal` is never client-supplied — it is how `run.resume` tells this
614
- * method to continue an existing session in place instead of forking, which stopped
615
- * attempt the new run continues, the message sent with that continuation, and the
616
- * attachments the continued message carried.
617
- *
618
- * The wrapper owns the spools this request created: attachment resolution spools pastes and
619
- * clipboard images before provider, permission, session, graph, and resume validation run. If any
620
- * later check refuses the start — most simply when no provider is configured — the request has
621
- * created no run and no persisted owner, and up to ~50 MB of the user's data would otherwise sit
622
- * in the spool until the retention prune. Every rejection below propagates through here, and
623
- * every spool this request wrote is deleted; a successful start owns its spools as part of the
624
- * run. `prepareRunValidated` is the body: the wrapper exists only to own that cleanup.
625
- */
626
207
  private prepareRun;
627
- /**
628
- * The graph this run executes, with the model's override applied when the run asked for one.
629
- *
630
- * The override rewrites the copy the run reads, never the saved graph: a run that overrides
631
- * every node must not change what the next run of the same graph does. Applying it here — where
632
- * the graph is loaded — is what keeps the runner, the resume guard and the health preflight from
633
- * disagreeing about the model a node runs, because all three read this same graph.
634
- */
635
208
  private graphForRun;
636
- /**
637
- * The graph a resume replays against, with carried node switches applied before its remaining
638
- * provider references are bound.
639
- *
640
- * A node moved to provider B survives provider A leaving the configuration: the carried provider
641
- * replaces the switched node's reference before the binder validates what is left, so the
642
- * obsolete pin cannot fail the load. The carried model travels after the bind — the binder offers
643
- * only models a provider's configuration lists, and a live switch may have named a model the
644
- * endpoint serves without the configuration listing it, which `resolveModel` accepted. A
645
- * whole-run override sets every reference aside instead, so it binds nothing, as before.
646
- */
647
209
  private loadResumeGraph;
648
210
  private prepareRunValidated;
649
- /**
650
- * Name a brand-new session from its first prompt with one bounded model request.
651
- *
652
- * The session already displays its local name, so this only upgrades it: any failure keeps the
653
- * local name and never touches the run. The request is queued behind the run's first provider
654
- * answer — the one inference turn a serializing endpoint must not be made to wait for — and goes
655
- * out while the run executes that turn's tools, so the row carries the real name for the task
656
- * instead of its first words cut off, and a task the user stops early is still named. The title
657
- * does not belong to the run's lifetime either: stopping the run leaves it generating.
658
- *
659
- * The record on disk is read back under the lock the user's own renames take, so a name chosen
660
- * once the run is over is never momentarily reverted, a session claimed by another run is left to
661
- * that run's snapshot, and a deleted session is never recreated on the rail. While this run is
662
- * still working, the save is written underneath it: the finalizer merges the record it finds, so
663
- * the finished attempt keeps the name this saved.
664
- */
665
211
  private titleSessionFromPrompt;
666
- /**
667
- * Let a title request that was waiting for its run go ahead: the run answered the provider for the
668
- * first time, or ended without ever doing so.
669
- */
670
212
  private releaseTitleWaiter;
671
- /** Abort title requests still on the wire: new work is about to need the provider itself. */
672
213
  private cancelSessionTitles;
673
214
  private executeRun;
674
- /**
675
- * The run's adapter, with each call's reasoning published to the connected window.
676
- *
677
- * Reasoning is display-only: those events go to the client and are deliberately never written to
678
- * the run journal, the session record, or the trajectory (see `app-server/reasoning.ts`). A call
679
- * made outside a run has no stream to publish into, so it is left as an adapter that simply does
680
- * not report reasoning.
681
- */
682
215
  private reasoningAdapter;
683
- /**
684
- * The adapter a run resolves, recorded into the session's trajectory: every model call of the
685
- * run — request, response, error — lands in the per-session debug log with the run and provider
686
- * that made it. The trajectory wrap sits outside the reasoning wrap for the same reason the
687
- * CLI's does: reasoning is display-only and never reaches records. Calls made outside a run
688
- * (no trajectory open) pass through unchanged.
689
- */
690
216
  private tracedAdapter;
691
- /**
692
- * Serialize all writes to a live run's JSON record, including the preflight shape stamp,
693
- * accepted model selections, and the terminal result. The recovery reader can then see
694
- * either the old selection or the fully durable new one, never an overlapping stale write.
695
- */
696
217
  private serializeRunRecordWrite;
697
- /** Change the next model turn without aborting a stream or replaying tools. */
698
218
  private setRunModel;
699
- /**
700
- * Change the permission mode a live attempt runs under, without interrupting it.
701
- *
702
- * The new mode reaches the attempt through its permission control (`ActiveRun.permissionControl`): a
703
- * tool call that has not decided yet decides under it, and every approval the attempt is waiting on
704
- * is handed back as `policy-changed`, so its tool decides again — a prompt the new mode answers goes
705
- * away, and one the new mode still requires is asked again. The mode is saved where the attempt read
706
- * it from, so the next task, a resume and a terminal on the same project agree with what is running.
707
- */
708
219
  private setRunPermissions;
709
220
  private applyRunPermissions;
710
- /**
711
- * Move a live run's control to `next` and journal the change, settling any prompt that waited
712
- * across it. Shared by the saved switch (`run.setPermissions`) and the run-scoped plan-approval
713
- * flip: neither re-asks a mode the run already has.
714
- */
715
221
  private switchLiveRunPermissions;
716
- /**
717
- * The plan-approval flip. Unlike `run.setPermissions` it is run-scoped only: approving a plan
718
- * never rewrites the saved workspace default, so the next task plans again. The run continues in
719
- * the workspace's saved default when that is an editing mode, and in Ask for approval otherwise.
720
- */
721
222
  private approvePlan;
722
- /** Save a live mode where the attempt reads it from: its own record when bound, the workspace default otherwise. */
723
223
  private saveRunPermissions;
724
- /**
725
- * Bring the workspace's code-intelligence manager, once it exists, to the mode the run holds for it.
726
- *
727
- * One change at a time, each reading the target when it runs, so the last one leaves the manager on
728
- * the latest target. A manager already on the target is left alone; one whose change failed is in an
729
- * unknown mode, so the next sync applies the target again rather than trusting it.
730
- */
731
224
  private syncCodeIntelPermissions;
732
225
  private resolveModel;
733
- /**
734
- * The client-visible configuration with the plan-aware analytics answer.
735
- *
736
- * Resolved on every read rather than cached: the account can sign in, sign out, or confirm a plan
737
- * between two reads, and a settings page that showed a stale opt-out is exactly the disagreement
738
- * the plan gate exists to remove.
739
- */
740
226
  private analyticsConfigView;
741
227
  private resolveProvider;
742
- /**
743
- * One code-intelligence manager per workspace, reused across runs and released at shutdown.
744
- *
745
- * Two guards come from the terminal path and exist for the same reasons here: Read Only mode
746
- * suspends indexing because the cache requires writes, and a project that *is* the user's home
747
- * directory never indexes automatically, because a desktop user can pick any folder and
748
- * recursively crawling a personal tree must not be an implicit side effect of opening the app.
749
- */
750
228
  private codeIntelligence;
751
229
  private openCodeIntelligence;
752
- /**
753
- * Prepare a workspace for the task its client expects to start in it.
754
- *
755
- * A client whose user has a project open, and an engine with nothing to do, knows where the
756
- * next task is likely to run before it is sent. What a first task in a workspace waits for at
757
- * its first node — opening the code index and synchronizing it with the files — is done here
758
- * instead, so the run finds the manager it would have created, in the state a previous task in
759
- * this engine would have left it in.
760
- *
761
- * Under the mode the task would run in: the one named, or the workspace's saved one. Read Only
762
- * and Plan prepare nothing, because the index is a cache the engine may not write there. An
763
- * engine that is running a task refuses, with the code that sends a start to another engine,
764
- * and so does one that accepted a task while this was waiting: the manager belongs to the run.
765
- * The answer does not wait for the synchronization, which carries on behind it.
766
- *
767
- * This is only worth doing while the engine is idle. The synchronization is work this process
768
- * does itself, so starting it once a run is being set up moves it from the first node into the
769
- * setup without shortening either: measured, the first model request arrives no sooner.
770
- */
771
230
  private warmWorkspace;
772
- /** Code-intelligence events belong to the active run's stream when one is running. */
773
231
  private runEvent;
774
- /** The journal writer of one run, created on its first event. */
775
232
  private journalFor;
776
- /**
777
- * Journal first, then the client: a client that missed an event can re-read the record.
778
- *
779
- * The writer creates `runs/` when the first append finds it missing: the terminal client creates
780
- * it during startup, and this mode returns before that code runs, so a fresh configuration home
781
- * would otherwise fail every append with ENOENT. Appends are ordered: the filesystem does not
782
- * finish concurrent appends in the order they were started.
783
- */
784
233
  private recordRunEvent;
785
234
  private ensureRunRecords;
786
235
  private interaction;
787
236
  private approve;
788
237
  private ask;
789
238
  private settleApproval;
790
- /**
791
- * How a run engine without the panel browser asks the desktop to run its
792
- * agent's panel operations on the engine that owns the panel. The request
793
- * travels as a `browser.panel.request` event and the desktop answers through
794
- * `browser.panel.result` — the same exchange shape an approval uses.
795
- */
796
239
  private panelBrowserRelayFor;
797
240
  private settlePanelRelay;
798
241
  private settleAnswer;
799
242
  private cancelRun;
800
- /**
801
- * Queue a message into the live attempt's steering channel.
802
- *
803
- * The runtime polls that channel at turn boundaries and injects each message into the node's own
804
- * conversation, so the attempt redirects without being cancelled and the node keeps the plan and
805
- * context it built. Nothing is delivered by this call: the answer says the message is queued, and
806
- * `run.steered` announces it so every window draws the user's own row immediately. What the run
807
- * never read is reported on its terminal event, so a message that arrived too late is returned
808
- * to the composer instead of disappearing.
809
- *
810
- * `runId` must name the attempt this engine is actually running. A message for any other attempt
811
- * — one that already finished, or another engine's — is refused rather than queued, because a
812
- * queue nobody polls would look exactly like a delivered message.
813
- */
814
243
  private steerRun;
815
- /**
816
- * The directory an account's graphs live in, with the identity it was chosen for.
817
- *
818
- * The two travel together because they are one decision: a caller that read the subject again afterwards
819
- * could label one account's names with another's identity if the credentials changed while the listing
820
- * was being read.
821
- *
822
- * The account's cloud copy is brought current first, the way the CLI's graph editor does it: a graph
823
- * saved on another machine reaches this one only through a sync, and the window lists graphs without
824
- * ever opening the editor. The wait is bounded and a sync that fails leaves the copy already here.
825
- *
826
- * Ownership is decided here too. A directory no account has claimed is shared, so a sync that ran
827
- * there would restore account A's cloud graphs into it and account B's install would then upload
828
- * them into B's account. `graphStorageAccess` claims an unclaimed directory for a confirmed account —
829
- * the account the builder claims it for — and reports the ones that are still shared.
830
- */
831
- /** Whether a stored graph selection names a graph whose latest revision is soft-deleted. */
832
244
  private selectionIsDeleted;
833
245
  private graphDirectory;
834
- /**
835
- * Whether the account service confirms this account, paid or free.
836
- *
837
- * The verdict is only definitive for the account it names: an answer that arrived while the
838
- * credentials changed describes the other account, and claiming this installation's graph directory
839
- * for it would bind legacy local graphs to an account that is no longer signed in.
840
- */
841
246
  private currentAccountIsConfirmed;
842
247
  private listGraphs;
843
- /**
844
- * The shareable file of one library Agent, for the desktop's Share action to write into the
845
- * user's Downloads folder. Agents live in this home's own library, not an account's graph
846
- * store, so no account attribution applies; only the id crosses from the editor frame.
847
- */
848
248
  private exportAgent;
849
249
  private getGraph;
850
- /**
851
- * Persist the installation's graph selection.
852
- *
853
- * The Andorra preset is selectable per run but not storable: the configuration schema admits only
854
- * word-character graph ids, so `:andorra` would make the next config load fail. The desktop keeps
855
- * that choice per project instead and passes it to `run.start`.
856
- */
857
250
  private selectGraph;
858
251
  private openEditor;
859
252
  private closeEditor;
860
- /**
861
- * Run a serve/lock transition behind every other one this process has queued.
862
- *
863
- * Two concurrent `remote.hosting.status` calls would otherwise race the same serve lock from one
864
- * process: the loser sees a busy lock whose descriptor the winner has not written yet and
865
- * reports the listener this engine is starting as a foreign one. `startRemoteServe` and the
866
- * status handler — the two paths that can start a listener — share this queue.
867
- */
868
253
  private serializeRemote;
869
- /**
870
- * Bring up or adopt this installation's remote listener, holding it until close.
871
- *
872
- * Called once at engine startup, after which a paired machine can reach this one while the
873
- * desktop is open. With no devices and no active invitation the ensure resolves to not-serving
874
- * without binding a port, so an unpaired install pays nothing; a later Settings-open grows the
875
- * listener through the status handler, which queues behind this one.
876
- */
877
254
  startRemoteServe(): Promise<void>;
878
- /** A peer-side failure as a wire error; the UI branches on `status`, not on these codes. */
879
255
  private remoteError;
880
- /** The failure kinds that mean "this address did not answer" — all others end the host sequence. */
881
256
  private remoteStatusFailure;
882
- /**
883
- * Run one peer call against the workspace's hosts in order, trying the next address only when
884
- * this one was unreachable. An identity or authorization answer is about the machine, not the
885
- * address: probing a second host would repeat it or paper over a certificate swap with an older
886
- * address that still answers.
887
- *
888
- * The failure is converted for RPC boundaries that throw it at the window. A liveness probe is
889
- * not one of those — it reads the failure's kind to report `offline`/`unauthorized`/
890
- * `identity-changed` — so it asks for the peer error itself via `preservePeerError`; converting
891
- * would flatten every kind into a generic network error and the status surface would never see a
892
- * state other than `unknown`.
893
- */
894
257
  private peerCall;
895
- /**
896
- * The peer target for a stored workspace, with the hosts to try in order: the operator's
897
- * host override first (moving the target without touching trust — identity is the pinned
898
- * fingerprint), then every address the pairing code advertised.
899
- */
900
258
  private remoteTarget;
901
- /** The stored workspace as the wire sees it: never the device token, never the certificate. */
902
259
  private remoteWorkspaceView;
903
- /**
904
- * The host-side Settings surface, and the call that starts hosting.
905
- *
906
- * The listener a status call starts belongs to this engine until close — that is what makes the
907
- * desktop closing read as offline to peers unless a standalone `andorra remote serve` owns the
908
- * lock; an adopted handle releases to nothing, so there is nothing to hold.
909
- */
910
260
  private remoteHostingStatus;
911
- /**
912
- * Replace the live invitation with a fresh one — the Settings page's "New code" action.
913
- *
914
- * The status call replaces an invitation only after it expires or is redeemed, so a code that was
915
- * pasted somewhere it should not have been stays redeemable for the rest of its ten minutes. This
916
- * is the explicit way to invalidate it: the previous token stops working the moment the new
917
- * invitation is written, and the answer is the same hosting snapshot the page already renders.
918
- */
919
261
  private remoteHostingInvitationFull;
920
262
  private remoteHostingInvitationRegenerate;
921
263
  private remoteShareAdd;
922
264
  private remoteShareRemove;
923
265
  private remoteDeviceRevoke;
924
- /**
925
- * Raise a paired device to full owner authority, and answer with the refreshed hosting snapshot.
926
- *
927
- * The grant is the Settings alternative to revoke-and-re-pair the product contract names; like a
928
- * full-scope invitation it is refused over cleartext hosting, because the token that would carry
929
- * the authority travels the wire unencrypted there.
930
- */
931
266
  private remoteDeviceGrant;
932
- /**
933
- * Open (or replace) this engine's relay link to one paired workspace.
934
- *
935
- * Idempotent per connection id — the desktop reconnects after its own restarts and must not pay
936
- * for a second stream while the first still runs. The answer carries what the peer's identity
937
- * probe said (including the engine capabilities its relay serves), which is what the desktop uses
938
- * to decide which controls the link can honor.
939
- */
940
267
  private remoteEngineConnect;
941
- /** End this engine's relay link to one workspace, if it holds one. */
942
268
  private remoteEngineDisconnect;
943
- /**
944
- * One workspace's event stream, held until the link is replaced or disconnected.
945
- *
946
- * A stream that ends is retried after a pause — a serve restarting, a machine rebooting — but only
947
- * while the stored pairing is still the one the link was opened for, and never for the verdicts a
948
- * retry would repeat forever: an identity change or a revocation is reported to the window as a
949
- * closed link instead.
950
- */
951
269
  private runEngineLink;
952
- /**
953
- * One relayed engine request: a full-grant pairing's client surface, proxied through the same
954
- * host walk every other peer call uses, with the caller's own deadline carried across so a slow
955
- * method keeps the budget the desktop granted it.
956
- */
957
270
  private remoteEngineRequest;
958
- /**
959
- * Every paired workspace with a live liveness probe.
960
- *
961
- * The probes run together because each is bounded by the client's own timeout; a workspace whose
962
- * machine is asleep costs one timeout, not one per remaining workspace. A successful probe also
963
- * refreshes the identity fields from the peer itself, so a rebuilt machine shows its new name.
964
- */
965
271
  private remoteWorkspacesList;
966
- /**
967
- * One workspace's state, probed against the peer addresses the listing would walk.
968
- *
969
- * Shared by the listing and the single-workspace re-check: a window watching a machine that is
970
- * not online asks for that one workspace, and must reach the same answer a full listing would
971
- * have produced for it — the same address order, the same failure kinds, the same identity fields.
972
- */
973
272
  private remoteWorkspaceState;
974
- /**
975
- * Re-probe one paired workspace.
976
- *
977
- * A missing id is the window's stale view of a pairing removed elsewhere, answered as not-found so
978
- * the client drops the row instead of treating an unknown workspace as an unreachable machine.
979
- */
980
273
  private remoteWorkspaceProbe;
981
- /**
982
- * The fields a probe answer depends on, as one comparable value.
983
- *
984
- * The cached identity fields are deliberately absent: they describe the machine as some earlier
985
- * answer saw it, not what this walk was asked to reach, and only pairing writes them. Everything
986
- * listed here is a fact about the target, so a difference means the answer above is not this row's.
987
- */
988
274
  private remoteProbeIdentity;
989
- /**
990
- * What a link's reconnect must agree on: trust and addressing. The display label is not among
991
- * them — a rename while a run's link is live is not a pairing replacement, and closing the link
992
- * for one would abandon work over a cosmetic edit.
993
- */
994
275
  private remoteTrustIdentity;
995
- /**
996
- * Redeem a pasted pairing code and store the workspace.
997
- *
998
- * The credential and the pinned certificate come back from the redemption itself; the invitation
999
- * is single-use, so the peer rejects a second redemption of the same code. Nothing here is
1000
- * retried against another host after a refusal: a refused invite stays refused.
1001
- */
1002
276
  private remoteWorkspaceAdd;
1003
277
  private remoteWorkspaceRemove;
1004
278
  private remoteWorkspaceRename;
1005
- /**
1006
- * Move a workspace's target address without touching its trust anchor.
1007
- *
1008
- * The override is what a DHCP lease change asks for: the fingerprint pin still decides which
1009
- * machine is the paired one, so pointing at a new address cannot adopt a different certificate.
1010
- * A null host removes the override and falls back to the advertised addresses.
1011
- */
1012
279
  private remoteWorkspaceSetHost;
1013
- /**
1014
- * Everything a peer will let this device browse: its registered projects and its explicit
1015
- * shares. Labels are the peer's chosen display names — absolute paths never cross the wire.
1016
- */
1017
280
  private remoteRootsList;
1018
281
  private remoteProjectsFetch;
1019
282
  private remoteBrowse;
@@ -1021,195 +284,47 @@ export declare class AppServer {
1021
284
  private remoteOwnerBrowse;
1022
285
  private remoteOwnerAddProject;
1023
286
  private listProjects;
1024
- /**
1025
- * Register a project folder, canonicalized so the registry and a peer's root ids agree.
1026
- *
1027
- * realpath makes `projects.add` idempotent across junctions, symlinks, and Windows drive-letter
1028
- * case, and it is the same canonical form `projectRootId` hashes — so the id a peer derives and
1029
- * the id this machine hosts cannot drift apart by spelling.
1030
- */
1031
287
  private addProject;
1032
288
  private removeProject;
1033
- /** The wakes one session is waiting on, in the shape a client draws them in. */
289
+ /** The browser profile a task browses on: its project identity when it carries one, otherwise its folder. */
290
+ private static panelProfileKey;
291
+ private relinkProject;
292
+ private changeProjectFolder;
1034
293
  private timersFor;
1035
- /**
1036
- * A session summary plus what only this process knows: the wakes it is holding, and whether a run of
1037
- * this session is in flight.
1038
- *
1039
- * A row reads its task's story off the saved record, and the saved record lags a live run — the turn
1040
- * being written is not in the file yet, so the last saved one still reads as finished. Naming the run
1041
- * here is what keeps a session that is working from being drawn as a task that is done with you.
1042
- */
1043
294
  private summary;
1044
- /**
1045
- * The summary a completed or failed run publishes, built without the live-run override.
1046
- *
1047
- * The terminal story is the saved record's: a completion says the session is done (or waiting on an
1048
- * armed wake), never running. Building the payload from the record alone keeps that true whatever
1049
- * the engine's live-run slot holds at the instant of the emit, rather than relying on the slot
1050
- * having been released a statement earlier in the finalizer.
1051
- */
1052
295
  private terminalSummary;
1053
- /**
1054
- * Every wake this process is holding, grouped by the session that armed it.
1055
- *
1056
- * The desktop runs one engine per task, so the wakes a session is waiting on can live in a process its
1057
- * `sessions.list` never reaches: the primary answers for every session on disk and knows only its own
1058
- * registry. This is how a window that has just reloaded asks each engine it reattached to what it is still
1059
- * holding — without it a row whose wake is alive loses its clock, and the user has no way to see that the
1060
- * task is still coming back.
1061
- */
1062
296
  private listTimers;
1063
- /** Tell every window the session's active skill changed; `null` means it has none now. */
1064
- private emitSessionSkill;
1065
- /**
1066
- * Pause, resume or remove the session's skill. It takes effect from the session's next message: a
1067
- * run already working read the skill when it started.
1068
- */
297
+ private emitSessionSkills;
1069
298
  private updateSessionSkill;
1070
- /** Say what a session is waiting on. An empty list is a real answer: it is what ends a wait. */
1071
299
  private emitPullRequest;
1072
- /**
1073
- * Hold the calling run until its PR's next review: the comments the watcher finds are handed to it as the Auto-fix
1074
- * prompt would be, instead of being armed as a wake. A wake already armed for comments it has not delivered is
1075
- * taken at once. `origin` (the waiting node) becomes the node later Auto-fix wakes go to, since it owns the loop.
1076
- */
1077
300
  private awaitReview;
1078
- /**
1079
- * What the session's PR record says a review wait should end with, handed to `deliver`: the PR is gone, finished or
1080
- * has Auto-fix off, or it holds comments found and not yet carried by a run. Those are taken under the lock, handed
1081
- * over first and only then marked handled, so a wait that ended meanwhile never loses them. A wake this engine is
1082
- * delivering now is left to that delivery.
1083
- */
1084
301
  private reviewWaitFromRecord;
1085
- /** A run now carries the Auto-fix prompt behind `wakeId`: its comments are handled. */
1086
302
  private recordAutoFixDelivered;
1087
- /** The pending set as a change left it, without diffs: a client reads those with `sessions.changes.list`. */
1088
303
  private emitSessionChanges;
1089
- /**
1090
- * Start tracking `ref` for the session. A PR already tracked under the same URL keeps its settings, so a
1091
- * repeated `gh pr create` (which reports the existing PR) never switches off what the user turned on.
1092
- */
1093
304
  private attachPullRequest;
1094
305
  private updatePullRequest;
1095
306
  private dismissPullRequest;
1096
- /**
1097
- * Withdraw an Auto-fix wake this engine holds. One held by another engine is not reachable from here; that
1098
- * engine checks the record again before it delivers (`deliverDueTimers`), and finds the wake unwanted.
1099
- */
1100
307
  private cancelAutoFixWake;
1101
- /** The `pull_request` tool's view of one session's PR; `carry` is the calling run's selections. */
1102
308
  private pullRequestControl;
1103
- /**
1104
- * Hand an Auto-fix prompt to the session through the same wake a `set_timer` arms, under the selections the
1105
- * session's PR was configured from: without them the continuation would run under whatever graph and model
1106
- * the configuration names today, with different tools than the work it is fixing. `origin` addresses the prompt to
1107
- * the graph node that switched Auto-fix on (`deliverDueTimers`), rather than to the graph's entry node.
1108
- */
1109
309
  private wakeForPullRequest;
1110
310
  private emitTimers;
1111
- /**
1112
- * Publish what a session whose run just ended is waiting on, and arm the next deadline.
1113
- *
1114
- * A wake still armed means the session is waiting rather than finished, and the engine is the only thing
1115
- * left that can deliver it. Nothing armed means the row is free to read as completed.
1116
- */
1117
311
  private settleSessionTimers;
1118
- /** Arm the next deadline check, across every session this engine holds wakes for. */
1119
312
  private armTimerCheck;
1120
- /**
1121
- * When this engine should next look for a due wake, across every session it holds wakes for.
1122
- *
1123
- * Not the same thing as the soonest deadline: a wake a delivery handed back is not looked at again until the
1124
- * beat it came back for has passed, which the registry records on the wake itself. One sweep serves every
1125
- * session this engine has served, so a sweep that read the floor as the deadline would keep arriving at the
1126
- * wake that cannot be delivered, and reach the ones that can only after it.
1127
- */
1128
313
  private nextWakeLook;
1129
- /** Begin a delivery pass when none is going. Called by the registry's due callback and by the check. */
1130
314
  private checkTimers;
1131
- /**
1132
- * Say a wake will never be delivered: drop it, publish the shorter wait list, and tell the user why.
1133
- *
1134
- * A wake is the agent's own reminder about work that is over or was replaced, and starting it as a new task
1135
- * would restart that work behind the user's back. Dropping it silently would hide a promise the agent made,
1136
- * so the reason goes out with `timers.spent` - which a window shows as a notice - and into the log.
1137
- */
1138
315
  private spendWake;
1139
- /**
1140
- * Whether a wake is a `set_timer` reminder a graph node set about the work it was doing. Those belong to that work:
1141
- * they are read by the node while its attempt runs, and spent once the node or the attempt is done with it.
1142
- *
1143
- * An Auto-fix wake also names a node (the one that switched Auto-fix on), but only as its address: review comments
1144
- * are new work that outlives the attempt that turned Auto-fix on, so they are never spent with it and always wait
1145
- * for the engine to be free (`deliverDueTimers`).
1146
- */
1147
316
  private nodeReminder;
1148
- /**
1149
- * Spend the session's node-armed wakes that belong to an attempt in `attempts` and satisfy `spent`.
1150
- *
1151
- * Wakes another surface is in the middle of delivering are left alone: that delivery decides what became of
1152
- * them. Wakes no graph node armed are never touched here.
1153
- */
1154
317
  private spendAttemptWakes;
1155
- /**
1156
- * Hand every due wake the live run itself armed (or an attempt that run continues) to that run, as a
1157
- * steering message its working node reads at the next turn boundary.
1158
- *
1159
- * The wake is settled once the message is queued: from there the run owns it. One the run ends before
1160
- * reading is put back on the registry by the finalizer, where the rules for a finished run decide it.
1161
- */
1162
318
  private steerDueWakes;
1163
- /**
1164
- * Where a node-armed wake goes once no run has the engine: the attempt to continue, a reason it is spent, or
1165
- * a reason to wait.
1166
- *
1167
- * It continues only the session's newest attempt, and only when that attempt is the one that armed it or a
1168
- * continuation of it, the attempt stopped without finishing, the user did not stop it, and the arming node
1169
- * has not finished since the wake was armed. Anything else means the work the reminder was about is over or
1170
- * was replaced by a newer turn, and it is spent.
1171
- */
1172
319
  private wakeContinuation;
1173
- /**
1174
- * Give every wake that has come due to the session that armed it, one run at a time.
1175
- *
1176
- * Each is started on the path a task submitted over the socket takes, so a client sees one lifecycle for
1177
- * both and the row moves from waiting to running on its own. A wake waits out a run that is already going:
1178
- * a deadline says the earliest a prompt may be given, not the moment it is, and a session whose engine is
1179
- * busy is not that moment. A wake whose session has been deleted is dropped — it has no conversation left
1180
- * to return to. A delivery the engine refuses because it is already busy is put back and tried again: that
1181
- * refusal describes the moment, not the task. Any other refusal is reported and left spent, rather than
1182
- * retried on a deadline forever; the row stops saying the session is waiting on it. A wake whose session
1183
- * cannot be read is put back for the beat its restore armed it for, and the pass carries on: one session's
1184
- * unreadable record says nothing about what another session is owed.
1185
- */
1186
320
  private deliverDueTimers;
1187
- /**
1188
- * Re-reconcile the runs a foreign engine still owned when this one started, once that engine exits.
1189
- *
1190
- * Startup recovery leaves an open record alone while its pid is alive, because a second engine on
1191
- * this home may genuinely be running it. In the close-and-immediately-reopen flow that holder is
1192
- * the engine that was shutting down: by the time it exits, this engine has already answered
1193
- * `sessions.list` with the stale `running`, and the rail reloads nothing on its own — so neither
1194
- * the spinner nor the interruption mark would show until the window reloads. Poll each holder, and
1195
- * as soon as one exits, re-run recovery scoped to exactly the records this watch captured
1196
- * (`onlyRunIds`), then republish the sessions those records name: a window already holding the
1197
- * stale row gets the correction as an ordinary `session.updated`, and a client that connects later
1198
- * reads the corrected record off disk. The scoping is what keeps this safe next to live work: this
1199
- * engine may have started its own run by the time a predecessor dies, and an unscoped sweep — whose
1200
- * pid check treats a record owned by this very process as stale — would stamp that active attempt
1201
- * `interrupted` and hand out a Resume for work that is still running. A holder that outlives the
1202
- * wait is accepted as a genuinely running engine — its work is left exactly as recovery intended.
1203
- */
1204
321
  watchForeignEngineShutdown(owners: {
1205
322
  runId: string;
1206
323
  pid: number;
1207
324
  sessionId: string | undefined;
1208
325
  }[]): void;
1209
- /** Release everything this process owns. Safe to call twice. */
1210
326
  close(): Promise<void>;
1211
327
  }
1212
- /** Run the engine until stdin closes or a client asks for shutdown. Returns the process exit code. */
1213
328
  export declare function runAppServer(options?: AppServerOptions & {
1214
329
  input?: NodeJS.ReadableStream;
1215
330
  }): Promise<number>;