@andorra-labs/code 0.1.12 → 0.1.13

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