@songsid/agend 2.4.0-beta.3 → 2.4.0-beta.30

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 (2007) hide show
  1. package/README.md +11 -1
  2. package/README.zh-TW.md +11 -1
  3. package/dist/accounts-profiles.d.ts +1 -1
  4. package/dist/accounts-view.d.ts +32 -0
  5. package/dist/accounts-view.js +2 -14
  6. package/dist/accounts-view.js.map +1 -1
  7. package/dist/agend-home.js +5 -5
  8. package/dist/agend-home.js.map +1 -1
  9. package/dist/agent-cli-instructions.md +19 -7
  10. package/dist/agent-cli.js +199 -51
  11. package/dist/agent-cli.js.map +1 -1
  12. package/dist/agent-endpoint.d.ts +5 -1
  13. package/dist/agent-endpoint.js +62 -11
  14. package/dist/agent-endpoint.js.map +1 -1
  15. package/dist/agent-export.d.ts +3 -1
  16. package/dist/agent-export.js +18 -1
  17. package/dist/agent-export.js.map +1 -1
  18. package/dist/agent-file-read.js +3 -3
  19. package/dist/agent-file-read.js.map +1 -1
  20. package/dist/agent-whats-new.js +35 -0
  21. package/dist/agent-whats-new.js.map +1 -1
  22. package/dist/agent-workspace.d.ts +18 -2
  23. package/dist/agent-workspace.js +15 -4
  24. package/dist/agent-workspace.js.map +1 -1
  25. package/dist/app-message-origin.d.ts +2 -0
  26. package/dist/app-message-origin.js +3 -0
  27. package/dist/app-message-origin.js.map +1 -0
  28. package/dist/apply-job.d.ts +2 -2
  29. package/dist/auth-api.d.ts +12 -0
  30. package/dist/auth-api.js +87 -5
  31. package/dist/auth-api.js.map +1 -1
  32. package/dist/authority/authority-state.d.ts +7 -0
  33. package/dist/authority/authority-state.js +17 -2
  34. package/dist/authority/authority-state.js.map +1 -1
  35. package/dist/authority/web-authority.d.ts +28 -4
  36. package/dist/authority/web-authority.js +67 -4
  37. package/dist/authority/web-authority.js.map +1 -1
  38. package/dist/backend/agy-model-switch.d.ts +22 -0
  39. package/dist/backend/agy-model-switch.js +62 -0
  40. package/dist/backend/agy-model-switch.js.map +1 -0
  41. package/dist/backend/antigravity.d.ts +9 -2
  42. package/dist/backend/antigravity.js +82 -13
  43. package/dist/backend/antigravity.js.map +1 -1
  44. package/dist/backend/claude-carry.d.ts +11 -0
  45. package/dist/backend/claude-carry.js +88 -6
  46. package/dist/backend/claude-carry.js.map +1 -1
  47. package/dist/backend/claude-code.d.ts +39 -7
  48. package/dist/backend/claude-code.js +234 -32
  49. package/dist/backend/claude-code.js.map +1 -1
  50. package/dist/backend/claude-mcp-carry.d.ts +63 -0
  51. package/dist/backend/claude-mcp-carry.js +242 -0
  52. package/dist/backend/claude-mcp-carry.js.map +1 -0
  53. package/dist/backend/claude-transcript-errors.d.ts +4 -0
  54. package/dist/backend/claude-transcript-errors.js +5 -1
  55. package/dist/backend/claude-transcript-errors.js.map +1 -1
  56. package/dist/backend/claude-usage-credits.d.ts +8 -0
  57. package/dist/backend/claude-usage-credits.js +121 -0
  58. package/dist/backend/claude-usage-credits.js.map +1 -0
  59. package/dist/backend/cli-env-probe.js +1 -1
  60. package/dist/backend/cli-env-probe.js.map +1 -1
  61. package/dist/backend/cli-runtime-switch.d.ts +90 -0
  62. package/dist/backend/cli-runtime-switch.js +273 -0
  63. package/dist/backend/cli-runtime-switch.js.map +1 -0
  64. package/dist/backend/codex-footer-hints.d.ts +1 -0
  65. package/dist/backend/codex-footer-hints.js +15 -0
  66. package/dist/backend/codex-footer-hints.js.map +1 -1
  67. package/dist/backend/codex-model-switch.d.ts +41 -0
  68. package/dist/backend/codex-model-switch.js +170 -0
  69. package/dist/backend/codex-model-switch.js.map +1 -0
  70. package/dist/backend/codex-precaution.d.ts +7 -0
  71. package/dist/backend/codex-precaution.js +103 -0
  72. package/dist/backend/codex-precaution.js.map +1 -0
  73. package/dist/backend/codex.d.ts +7 -4
  74. package/dist/backend/codex.js +56 -10
  75. package/dist/backend/codex.js.map +1 -1
  76. package/dist/backend/grok-model-switch.d.ts +16 -0
  77. package/dist/backend/grok-model-switch.js +45 -0
  78. package/dist/backend/grok-model-switch.js.map +1 -0
  79. package/dist/backend/grok.js +33 -7
  80. package/dist/backend/grok.js.map +1 -1
  81. package/dist/backend/kiro-auth-store.d.ts +15 -2
  82. package/dist/backend/kiro-auth-store.js +64 -0
  83. package/dist/backend/kiro-auth-store.js.map +1 -1
  84. package/dist/backend/kiro.js +10 -5
  85. package/dist/backend/kiro.js.map +1 -1
  86. package/dist/backend/muse.d.ts +2 -0
  87. package/dist/backend/muse.js +7 -3
  88. package/dist/backend/muse.js.map +1 -1
  89. package/dist/backend/native-pane.js +1 -1
  90. package/dist/backend/native-pane.js.map +1 -1
  91. package/dist/backend/types.d.ts +59 -2
  92. package/dist/backend/types.js.map +1 -1
  93. package/dist/backend-availability.d.ts +23 -16
  94. package/dist/backend-availability.js +73 -93
  95. package/dist/backend-availability.js.map +1 -1
  96. package/dist/backend-command.d.ts +4 -2
  97. package/dist/backend-command.js +3 -0
  98. package/dist/backend-command.js.map +1 -1
  99. package/dist/backend-signin-guide.js +1 -1
  100. package/dist/backend-signin-guide.js.map +1 -1
  101. package/dist/backend-version-static.d.ts +15 -0
  102. package/dist/backend-version-static.js +95 -0
  103. package/dist/backend-version-static.js.map +1 -0
  104. package/dist/browser-backend-signins.d.ts +1 -0
  105. package/dist/browser-backend-signins.js +3 -1
  106. package/dist/browser-backend-signins.js.map +1 -1
  107. package/dist/build-provenance.json +1 -1
  108. package/dist/cache-ledger.d.ts +23 -21
  109. package/dist/cache-ledger.js +70 -6
  110. package/dist/cache-ledger.js.map +1 -1
  111. package/dist/cache-prices.d.ts +8 -6
  112. package/dist/cache-prices.js +12 -5
  113. package/dist/cache-prices.js.map +1 -1
  114. package/dist/cache-service.d.ts +9 -5
  115. package/dist/cache-service.js +202 -50
  116. package/dist/cache-service.js.map +1 -1
  117. package/dist/channel/adapters/discord.d.ts +23 -1
  118. package/dist/channel/adapters/discord.js +97 -26
  119. package/dist/channel/adapters/discord.js.map +1 -1
  120. package/dist/channel/adapters/telegram.d.ts +2 -0
  121. package/dist/channel/adapters/telegram.js +9 -4
  122. package/dist/channel/adapters/telegram.js.map +1 -1
  123. package/dist/channel/ipc-bridge.d.ts +7 -0
  124. package/dist/channel/ipc-bridge.js +45 -11
  125. package/dist/channel/ipc-bridge.js.map +1 -1
  126. package/dist/channel/mcp-server.js +39 -5
  127. package/dist/channel/mcp-server.js.map +1 -1
  128. package/dist/channel/mcp-tools.d.ts +27 -1
  129. package/dist/channel/mcp-tools.js +107 -14
  130. package/dist/channel/mcp-tools.js.map +1 -1
  131. package/dist/channel/tool-router.d.ts +4 -0
  132. package/dist/channel/tool-router.js +51 -19
  133. package/dist/channel/tool-router.js.map +1 -1
  134. package/dist/channel/types.d.ts +10 -0
  135. package/dist/chat-task-refs.d.ts +61 -0
  136. package/dist/chat-task-refs.js +112 -0
  137. package/dist/chat-task-refs.js.map +1 -0
  138. package/dist/classic-channel-manager.d.ts +6 -2
  139. package/dist/classic-channel-manager.js +29 -4
  140. package/dist/classic-channel-manager.js.map +1 -1
  141. package/dist/classic-cli-guard.d.ts +66 -0
  142. package/dist/classic-cli-guard.js +209 -0
  143. package/dist/classic-cli-guard.js.map +1 -0
  144. package/dist/claude-credential-change.d.ts +22 -0
  145. package/dist/claude-credential-change.js +47 -0
  146. package/dist/claude-credential-change.js.map +1 -0
  147. package/dist/claude-credential-launch.d.ts +69 -0
  148. package/dist/claude-credential-launch.js +328 -0
  149. package/dist/claude-credential-launch.js.map +1 -0
  150. package/dist/claude-credential-runner.d.ts +1 -0
  151. package/dist/claude-credential-runner.js +58 -0
  152. package/dist/claude-credential-runner.js.map +1 -0
  153. package/dist/claude-credential-vault.d.ts +57 -0
  154. package/dist/claude-credential-vault.js +277 -0
  155. package/dist/claude-credential-vault.js.map +1 -0
  156. package/dist/claude-install-kind.d.ts +19 -0
  157. package/dist/claude-install-kind.js +54 -0
  158. package/dist/claude-install-kind.js.map +1 -0
  159. package/dist/claude-request-observation.d.ts +7 -0
  160. package/dist/claude-request-observation.js +26 -0
  161. package/dist/claude-request-observation.js.map +1 -0
  162. package/dist/claude-setup-token-transport.d.ts +9 -0
  163. package/dist/claude-setup-token-transport.js +104 -0
  164. package/dist/claude-setup-token-transport.js.map +1 -0
  165. package/dist/claude-setup-token.d.ts +51 -0
  166. package/dist/claude-setup-token.js +83 -0
  167. package/dist/claude-setup-token.js.map +1 -0
  168. package/dist/claude-turn-boundaries.d.ts +15 -0
  169. package/dist/claude-turn-boundaries.js +88 -0
  170. package/dist/claude-turn-boundaries.js.map +1 -0
  171. package/dist/cli-audited.js +30 -17
  172. package/dist/cli-audited.js.map +1 -1
  173. package/dist/cli-capability.d.ts +3 -0
  174. package/dist/cli-capability.js.map +1 -1
  175. package/dist/cli-registry-check.js +1 -1
  176. package/dist/cli-registry-check.js.map +1 -1
  177. package/dist/cli-registry.d.ts +1 -0
  178. package/dist/cli-spec-antigravity.d.ts +1 -0
  179. package/dist/cli-spec-antigravity.js +3 -1
  180. package/dist/cli-spec-antigravity.js.map +1 -1
  181. package/dist/cli.js +231 -24
  182. package/dist/cli.js.map +1 -1
  183. package/dist/command-report.d.ts +11 -0
  184. package/dist/command-report.js +2 -0
  185. package/dist/command-report.js.map +1 -0
  186. package/dist/composite-tools.d.ts +11 -0
  187. package/dist/composite-tools.js +29 -0
  188. package/dist/composite-tools.js.map +1 -0
  189. package/dist/config-validator.js +69 -3
  190. package/dist/config-validator.js.map +1 -1
  191. package/dist/config.js +17 -2
  192. package/dist/config.js.map +1 -1
  193. package/dist/connect/control.d.ts +20 -0
  194. package/dist/connect/control.js +236 -0
  195. package/dist/connect/control.js.map +1 -0
  196. package/dist/connect/install.d.ts +13 -0
  197. package/dist/connect/install.js +12 -0
  198. package/dist/connect/install.js.map +1 -0
  199. package/dist/connect/mcp.d.ts +9 -0
  200. package/dist/connect/mcp.js +10 -0
  201. package/dist/connect/mcp.js.map +1 -0
  202. package/dist/connect/protocol.d.ts +38 -0
  203. package/dist/connect/protocol.js +36 -0
  204. package/dist/connect/protocol.js.map +1 -0
  205. package/dist/connect/service.d.ts +19 -0
  206. package/dist/connect/service.js +79 -0
  207. package/dist/connect/service.js.map +1 -0
  208. package/dist/connect/stdio-entry.d.ts +1 -0
  209. package/dist/connect/stdio-entry.js +6 -0
  210. package/dist/connect/stdio-entry.js.map +1 -0
  211. package/dist/connect/stdio.d.ts +5 -0
  212. package/dist/connect/stdio.js +33 -0
  213. package/dist/connect/stdio.js.map +1 -0
  214. package/dist/contact-auth-api.d.ts +17 -0
  215. package/dist/contact-auth-api.js +90 -0
  216. package/dist/contact-auth-api.js.map +1 -0
  217. package/dist/contact-auth-files.d.ts +6 -0
  218. package/dist/contact-auth-files.js +29 -0
  219. package/dist/contact-auth-files.js.map +1 -0
  220. package/dist/contact-auth-policy.d.ts +81 -0
  221. package/dist/contact-auth-policy.js +26 -0
  222. package/dist/contact-auth-policy.js.map +1 -0
  223. package/dist/contact-auth-service.d.ts +32 -0
  224. package/dist/contact-auth-service.js +110 -0
  225. package/dist/contact-auth-service.js.map +1 -0
  226. package/dist/contact-auth-store.d.ts +149 -0
  227. package/dist/contact-auth-store.js +573 -0
  228. package/dist/contact-auth-store.js.map +1 -0
  229. package/dist/contact-auth-types.d.ts +202 -0
  230. package/dist/contact-auth-types.js +7 -0
  231. package/dist/contact-auth-types.js.map +1 -0
  232. package/dist/contact-change-proposals.d.ts +98 -0
  233. package/dist/contact-change-proposals.js +166 -0
  234. package/dist/contact-change-proposals.js.map +1 -0
  235. package/dist/contact-state-view.d.ts +103 -0
  236. package/dist/contact-state-view.js +80 -0
  237. package/dist/contact-state-view.js.map +1 -0
  238. package/dist/cross-instance-notice.d.ts +1 -0
  239. package/dist/cross-instance-notice.js +9 -8
  240. package/dist/cross-instance-notice.js.map +1 -1
  241. package/dist/daemon.d.ts +247 -3
  242. package/dist/daemon.js +1714 -181
  243. package/dist/daemon.js.map +1 -1
  244. package/dist/darwin-memory.js +2 -1
  245. package/dist/darwin-memory.js.map +1 -1
  246. package/dist/dashboard-permissions.d.ts +23 -8
  247. package/dist/dashboard-permissions.js +33 -10
  248. package/dist/dashboard-permissions.js.map +1 -1
  249. package/dist/delivery-consumed-watch.js +3 -0
  250. package/dist/delivery-consumed-watch.js.map +1 -1
  251. package/dist/delivery-outbox.d.ts +213 -10
  252. package/dist/delivery-outbox.js +664 -49
  253. package/dist/delivery-outbox.js.map +1 -1
  254. package/dist/delivery-outbox.test.js +132 -96
  255. package/dist/delivery-outbox.test.js.map +1 -1
  256. package/dist/detached-fleet-stop.d.ts +40 -0
  257. package/dist/detached-fleet-stop.js +126 -0
  258. package/dist/detached-fleet-stop.js.map +1 -0
  259. package/dist/dispatcher-liveness.d.ts +51 -1
  260. package/dist/dispatcher-liveness.js +94 -4
  261. package/dist/dispatcher-liveness.js.map +1 -1
  262. package/dist/event-log.d.ts +12 -0
  263. package/dist/event-log.js +40 -0
  264. package/dist/event-log.js.map +1 -1
  265. package/dist/fleet-context.d.ts +9 -0
  266. package/dist/fleet-level-config.d.ts +1 -1
  267. package/dist/fleet-level-config.js +1 -0
  268. package/dist/fleet-level-config.js.map +1 -1
  269. package/dist/fleet-lock.d.ts +88 -2
  270. package/dist/fleet-lock.js +296 -3
  271. package/dist/fleet-lock.js.map +1 -1
  272. package/dist/fleet-manager.d.ts +1397 -29
  273. package/dist/fleet-manager.js +8180 -623
  274. package/dist/fleet-manager.js.map +1 -1
  275. package/dist/fleet-windows-runtime.d.ts +59 -4
  276. package/dist/fleet-windows-runtime.js +307 -40
  277. package/dist/fleet-windows-runtime.js.map +1 -1
  278. package/dist/fleet-yaml-stringify.d.ts +3 -0
  279. package/dist/fleet-yaml-stringify.js +132 -0
  280. package/dist/fleet-yaml-stringify.js.map +1 -0
  281. package/dist/general-knowledge/skills/admin/SKILL.md +52 -0
  282. package/dist/general-knowledge/skills/concepts/SKILL.md +106 -23
  283. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +19 -1
  284. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +68 -1
  285. package/dist/general-knowledge/skills/fleet-config/SKILL.md +24 -4
  286. package/dist/general-knowledge/skills/fleet-health/SKILL.md +9 -1
  287. package/dist/general-knowledge/skills/hub/SKILL.md +393 -27
  288. package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +6 -2
  289. package/dist/general-knowledge/skills/model-discovery/SKILL.md +7 -2
  290. package/dist/general-knowledge/skills/persona-emoji/SKILL.md +3 -0
  291. package/dist/general-knowledge/skills/task-board/SKILL.md +98 -0
  292. package/dist/general-knowledge/skills/web-appearance/SKILL.md +35 -3
  293. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +391 -70
  294. package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +7 -1
  295. package/dist/general-knowledge/steering/core-rules.md +15 -78
  296. package/dist/general-role-block.d.ts +19 -0
  297. package/dist/general-role-block.js +56 -0
  298. package/dist/general-role-block.js.map +1 -0
  299. package/dist/general-role.d.ts +1 -1
  300. package/dist/general-role.js +2 -0
  301. package/dist/general-role.js.map +1 -1
  302. package/dist/home-update-lock.d.ts +35 -0
  303. package/dist/home-update-lock.js +81 -0
  304. package/dist/home-update-lock.js.map +1 -0
  305. package/dist/host-memory.d.ts +24 -1
  306. package/dist/host-memory.js +30 -4
  307. package/dist/host-memory.js.map +1 -1
  308. package/dist/host-monitoring/darwin/collector.d.ts +18 -0
  309. package/dist/host-monitoring/darwin/collector.js +65 -0
  310. package/dist/host-monitoring/darwin/collector.js.map +1 -0
  311. package/dist/host-monitoring/darwin/defaults.d.ts +2 -0
  312. package/dist/host-monitoring/darwin/defaults.js +9 -0
  313. package/dist/host-monitoring/darwin/defaults.js.map +1 -0
  314. package/dist/host-monitoring/darwin/interpretation.d.ts +20 -0
  315. package/dist/host-monitoring/darwin/interpretation.js +73 -0
  316. package/dist/host-monitoring/darwin/interpretation.js.map +1 -0
  317. package/dist/host-monitoring/linux/collector.d.ts +17 -0
  318. package/dist/host-monitoring/linux/collector.js +55 -0
  319. package/dist/host-monitoring/linux/collector.js.map +1 -0
  320. package/dist/host-monitoring/linux/defaults.d.ts +2 -0
  321. package/dist/host-monitoring/linux/defaults.js +9 -0
  322. package/dist/host-monitoring/linux/defaults.js.map +1 -0
  323. package/dist/host-monitoring/linux/interpretation.d.ts +22 -0
  324. package/dist/host-monitoring/linux/interpretation.js +76 -0
  325. package/dist/host-monitoring/linux/interpretation.js.map +1 -0
  326. package/dist/host-monitoring/transport.d.ts +42 -0
  327. package/dist/host-monitoring/transport.js +101 -0
  328. package/dist/host-monitoring/transport.js.map +1 -0
  329. package/dist/host-monitoring/wsl/collector.d.ts +19 -0
  330. package/dist/host-monitoring/wsl/collector.js +72 -0
  331. package/dist/host-monitoring/wsl/collector.js.map +1 -0
  332. package/dist/host-monitoring/wsl/defaults.d.ts +2 -0
  333. package/dist/host-monitoring/wsl/defaults.js +9 -0
  334. package/dist/host-monitoring/wsl/defaults.js.map +1 -0
  335. package/dist/host-monitoring/wsl/interpretation.d.ts +22 -0
  336. package/dist/host-monitoring/wsl/interpretation.js +77 -0
  337. package/dist/host-monitoring/wsl/interpretation.js.map +1 -0
  338. package/dist/host-monitoring-alert-policy.d.ts +73 -0
  339. package/dist/host-monitoring-alert-policy.js +152 -0
  340. package/dist/host-monitoring-alert-policy.js.map +1 -0
  341. package/dist/host-monitoring-alert-resources.d.ts +11 -0
  342. package/dist/host-monitoring-alert-resources.js +16 -0
  343. package/dist/host-monitoring-alert-resources.js.map +1 -0
  344. package/dist/host-monitoring-alert-settings.d.ts +16 -0
  345. package/dist/host-monitoring-alert-settings.js +68 -0
  346. package/dist/host-monitoring-alert-settings.js.map +1 -0
  347. package/dist/host-monitoring-alert-store.d.ts +49 -0
  348. package/dist/host-monitoring-alert-store.js +228 -0
  349. package/dist/host-monitoring-alert-store.js.map +1 -0
  350. package/dist/host-monitoring-alert-text.d.ts +7 -0
  351. package/dist/host-monitoring-alert-text.js +10 -0
  352. package/dist/host-monitoring-alert-text.js.map +1 -0
  353. package/dist/host-monitoring-alerts.d.ts +79 -0
  354. package/dist/host-monitoring-alerts.js +276 -0
  355. package/dist/host-monitoring-alerts.js.map +1 -0
  356. package/dist/host-monitoring-config.d.ts +15 -0
  357. package/dist/host-monitoring-config.js +36 -0
  358. package/dist/host-monitoring-config.js.map +1 -0
  359. package/dist/host-monitoring-defaults.d.ts +19 -0
  360. package/dist/host-monitoring-defaults.js +10 -0
  361. package/dist/host-monitoring-defaults.js.map +1 -0
  362. package/dist/host-monitoring-footprint-policy.d.ts +45 -0
  363. package/dist/host-monitoring-footprint-policy.js +150 -0
  364. package/dist/host-monitoring-footprint-policy.js.map +1 -0
  365. package/dist/host-monitoring-footprint.d.ts +42 -0
  366. package/dist/host-monitoring-footprint.js +169 -0
  367. package/dist/host-monitoring-footprint.js.map +1 -0
  368. package/dist/host-monitoring-history-files.d.ts +2 -0
  369. package/dist/host-monitoring-history-files.js +16 -0
  370. package/dist/host-monitoring-history-files.js.map +1 -0
  371. package/dist/host-monitoring-history-policy.d.ts +57 -0
  372. package/dist/host-monitoring-history-policy.js +107 -0
  373. package/dist/host-monitoring-history-policy.js.map +1 -0
  374. package/dist/host-monitoring-history-store.d.ts +52 -0
  375. package/dist/host-monitoring-history-store.js +178 -0
  376. package/dist/host-monitoring-history-store.js.map +1 -0
  377. package/dist/host-monitoring-history-worker.d.ts +1 -0
  378. package/dist/host-monitoring-history-worker.js +66 -0
  379. package/dist/host-monitoring-history-worker.js.map +1 -0
  380. package/dist/host-monitoring-history.d.ts +80 -0
  381. package/dist/host-monitoring-history.js +301 -0
  382. package/dist/host-monitoring-history.js.map +1 -0
  383. package/dist/host-monitoring-platform.d.ts +21 -0
  384. package/dist/host-monitoring-platform.js +18 -0
  385. package/dist/host-monitoring-platform.js.map +1 -0
  386. package/dist/host-monitoring-process-identity.d.ts +8 -0
  387. package/dist/host-monitoring-process-identity.js +81 -0
  388. package/dist/host-monitoring-process-identity.js.map +1 -0
  389. package/dist/host-monitoring-runtime.d.ts +42 -0
  390. package/dist/host-monitoring-runtime.js +95 -0
  391. package/dist/host-monitoring-runtime.js.map +1 -0
  392. package/dist/host-monitoring-settings-store.d.ts +5 -0
  393. package/dist/host-monitoring-settings-store.js +49 -0
  394. package/dist/host-monitoring-settings-store.js.map +1 -0
  395. package/dist/host-monitoring.d.ts +123 -0
  396. package/dist/host-monitoring.js +157 -0
  397. package/dist/host-monitoring.js.map +1 -0
  398. package/dist/hub/admin-dashboard.d.ts +85 -0
  399. package/dist/hub/admin-dashboard.js +177 -0
  400. package/dist/hub/admin-dashboard.js.map +1 -0
  401. package/dist/hub/agent-catalog-model.d.ts +297 -0
  402. package/dist/hub/agent-catalog-model.js +57 -0
  403. package/dist/hub/agent-catalog-model.js.map +1 -0
  404. package/dist/hub/agent-catalog.d.ts +140 -0
  405. package/dist/hub/agent-catalog.js +130 -0
  406. package/dist/hub/agent-catalog.js.map +1 -0
  407. package/dist/hub/agent-intro-model.d.ts +38 -0
  408. package/dist/hub/agent-intro-model.js +14 -0
  409. package/dist/hub/agent-intro-model.js.map +1 -0
  410. package/dist/hub/agent-intro-tool.d.ts +35 -0
  411. package/dist/hub/agent-intro-tool.js +83 -0
  412. package/dist/hub/agent-intro-tool.js.map +1 -0
  413. package/dist/hub/agent-intro.d.ts +31 -0
  414. package/dist/hub/agent-intro.js +51 -0
  415. package/dist/hub/agent-intro.js.map +1 -0
  416. package/dist/hub/agent-pictures-model.d.ts +275 -0
  417. package/dist/hub/agent-pictures-model.js +103 -0
  418. package/dist/hub/agent-pictures-model.js.map +1 -0
  419. package/dist/hub/agent-pictures.d.ts +64 -0
  420. package/dist/hub/agent-pictures.js +256 -0
  421. package/dist/hub/agent-pictures.js.map +1 -0
  422. package/dist/hub/attachments/store.d.ts +2 -0
  423. package/dist/hub/attachments/store.js +6 -0
  424. package/dist/hub/attachments/store.js.map +1 -1
  425. package/dist/hub/audit/index.d.ts +5 -1
  426. package/dist/hub/audit/index.js +43 -3
  427. package/dist/hub/audit/index.js.map +1 -1
  428. package/dist/hub/buttons.js +3 -1
  429. package/dist/hub/buttons.js.map +1 -1
  430. package/dist/hub/catalog.d.ts +19 -6
  431. package/dist/hub/catalog.js +102 -27
  432. package/dist/hub/catalog.js.map +1 -1
  433. package/dist/hub/client.d.ts +20 -0
  434. package/dist/hub/client.js +175 -12
  435. package/dist/hub/client.js.map +1 -1
  436. package/dist/hub/compose/member.d.ts +65 -8
  437. package/dist/hub/compose/member.js +404 -35
  438. package/dist/hub/compose/member.js.map +1 -1
  439. package/dist/hub/compose/server.d.ts +30 -5
  440. package/dist/hub/compose/server.js +140 -20
  441. package/dist/hub/compose/server.js.map +1 -1
  442. package/dist/hub/direct-posts-model.d.ts +1 -0
  443. package/dist/hub/direct-posts-model.js +2 -0
  444. package/dist/hub/direct-posts-model.js.map +1 -0
  445. package/dist/hub/direct-posts.d.ts +36 -0
  446. package/dist/hub/direct-posts.js +145 -0
  447. package/dist/hub/direct-posts.js.map +1 -0
  448. package/dist/hub/directory/directory.js +27 -7
  449. package/dist/hub/directory/directory.js.map +1 -1
  450. package/dist/hub/directory/types.d.ts +10 -4
  451. package/dist/hub/directory/types.js.map +1 -1
  452. package/dist/hub/display-name.d.ts +10 -0
  453. package/dist/hub/display-name.js +35 -0
  454. package/dist/hub/display-name.js.map +1 -0
  455. package/dist/hub/execution/service.d.ts +2 -1
  456. package/dist/hub/execution/service.js +2 -1
  457. package/dist/hub/execution/service.js.map +1 -1
  458. package/dist/hub/fleet-info.d.ts +12 -0
  459. package/dist/hub/fleet-info.js +14 -0
  460. package/dist/hub/fleet-info.js.map +1 -0
  461. package/dist/hub/fleet-update-model.d.ts +100 -0
  462. package/dist/hub/fleet-update-model.js +15 -0
  463. package/dist/hub/fleet-update-model.js.map +1 -0
  464. package/dist/hub/fleet-updates.d.ts +46 -0
  465. package/dist/hub/fleet-updates.js +284 -0
  466. package/dist/hub/fleet-updates.js.map +1 -0
  467. package/dist/hub/fleet-versions.d.ts +28 -0
  468. package/dist/hub/fleet-versions.js +81 -0
  469. package/dist/hub/fleet-versions.js.map +1 -0
  470. package/dist/hub/group-policy/admin-api.d.ts +1 -0
  471. package/dist/hub/group-policy/admin-api.js +10 -1
  472. package/dist/hub/group-policy/admin-api.js.map +1 -1
  473. package/dist/hub/group-policy/admin-control.d.ts +1 -0
  474. package/dist/hub/group-policy/admin-control.js +13 -4
  475. package/dist/hub/group-policy/admin-control.js.map +1 -1
  476. package/dist/hub/group-policy/admin-dto.d.ts +39 -1
  477. package/dist/hub/group-policy/admin-dto.js.map +1 -1
  478. package/dist/hub/group-policy/admin-facts.d.ts +4 -2
  479. package/dist/hub/group-policy/admin-facts.js +17 -2
  480. package/dist/hub/group-policy/admin-facts.js.map +1 -1
  481. package/dist/hub/group-policy/admin-impact.d.ts +36 -6
  482. package/dist/hub/group-policy/admin-impact.js +21 -7
  483. package/dist/hub/group-policy/admin-impact.js.map +1 -1
  484. package/dist/hub/group-policy/admin-inventory.d.ts +2 -0
  485. package/dist/hub/group-policy/admin-inventory.js +13 -4
  486. package/dist/hub/group-policy/admin-inventory.js.map +1 -1
  487. package/dist/hub/group-policy/admin-search.d.ts +2 -1
  488. package/dist/hub/group-policy/admin-search.js +56 -7
  489. package/dist/hub/group-policy/admin-search.js.map +1 -1
  490. package/dist/hub/group-policy/authorization.d.ts +2 -0
  491. package/dist/hub/group-policy/authorization.js +7 -2
  492. package/dist/hub/group-policy/authorization.js.map +1 -1
  493. package/dist/hub/group-policy/impact-inventory.d.ts +4 -1
  494. package/dist/hub/group-policy/impact-inventory.js +23 -2
  495. package/dist/hub/group-policy/impact-inventory.js.map +1 -1
  496. package/dist/hub/group-policy/model.d.ts +52 -1
  497. package/dist/hub/group-policy/model.js +20 -7
  498. package/dist/hub/group-policy/model.js.map +1 -1
  499. package/dist/hub/group-policy/resources.d.ts +2 -0
  500. package/dist/hub/group-policy/resources.js +12 -1
  501. package/dist/hub/group-policy/resources.js.map +1 -1
  502. package/dist/hub/group-policy/store.js +22 -3
  503. package/dist/hub/group-policy/store.js.map +1 -1
  504. package/dist/hub/group-policy/team-subjects.d.ts +16 -0
  505. package/dist/hub/group-policy/team-subjects.js +32 -0
  506. package/dist/hub/group-policy/team-subjects.js.map +1 -0
  507. package/dist/hub/http/compose.d.ts +17 -0
  508. package/dist/hub/http/compose.js +903 -100
  509. package/dist/hub/http/compose.js.map +1 -1
  510. package/dist/hub/http/core.d.ts +11 -1
  511. package/dist/hub/http/core.js +70 -10
  512. package/dist/hub/http/core.js.map +1 -1
  513. package/dist/hub/http/deps.d.ts +21 -0
  514. package/dist/hub/http/schema.js +54 -1
  515. package/dist/hub/http/schema.js.map +1 -1
  516. package/dist/hub/init/text.js +1 -1
  517. package/dist/hub/invitations.js +15 -7
  518. package/dist/hub/invitations.js.map +1 -1
  519. package/dist/hub/join/client.js +75 -42
  520. package/dist/hub/join/client.js.map +1 -1
  521. package/dist/hub/join/service.d.ts +9 -1
  522. package/dist/hub/join/service.js +17 -3
  523. package/dist/hub/join/service.js.map +1 -1
  524. package/dist/hub/lapse-carry.d.ts +45 -0
  525. package/dist/hub/lapse-carry.js +62 -0
  526. package/dist/hub/lapse-carry.js.map +1 -0
  527. package/dist/hub/mcp/auth-schema.d.ts +7 -0
  528. package/dist/hub/mcp/auth-schema.js +31 -0
  529. package/dist/hub/mcp/auth-schema.js.map +1 -0
  530. package/dist/hub/mcp/auth.d.ts +89 -0
  531. package/dist/hub/mcp/auth.js +374 -0
  532. package/dist/hub/mcp/auth.js.map +1 -0
  533. package/dist/hub/mcp/catalog.d.ts +44 -0
  534. package/dist/hub/mcp/catalog.js +31 -0
  535. package/dist/hub/mcp/catalog.js.map +1 -0
  536. package/dist/hub/mcp/door-schema.d.ts +7 -0
  537. package/dist/hub/mcp/door-schema.js +20 -0
  538. package/dist/hub/mcp/door-schema.js.map +1 -0
  539. package/dist/hub/mcp/http.d.ts +25 -0
  540. package/dist/hub/mcp/http.js +259 -0
  541. package/dist/hub/mcp/http.js.map +1 -0
  542. package/dist/hub/mcp/policy.d.ts +65 -0
  543. package/dist/hub/mcp/policy.js +153 -0
  544. package/dist/hub/mcp/policy.js.map +1 -0
  545. package/dist/hub/mcp/server.d.ts +3 -0
  546. package/dist/hub/mcp/server.js +32 -0
  547. package/dist/hub/mcp/server.js.map +1 -0
  548. package/dist/hub/mcp/tools.d.ts +31 -0
  549. package/dist/hub/mcp/tools.js +177 -0
  550. package/dist/hub/mcp/tools.js.map +1 -0
  551. package/dist/hub/member/agent-catalog.d.ts +31 -0
  552. package/dist/hub/member/agent-catalog.js +91 -0
  553. package/dist/hub/member/agent-catalog.js.map +1 -0
  554. package/dist/hub/member/agent-intro.d.ts +29 -0
  555. package/dist/hub/member/agent-intro.js +73 -0
  556. package/dist/hub/member/agent-intro.js.map +1 -0
  557. package/dist/hub/member/agent-pictures.d.ts +76 -0
  558. package/dist/hub/member/agent-pictures.js +196 -0
  559. package/dist/hub/member/agent-pictures.js.map +1 -0
  560. package/dist/hub/member/direct-rooms.d.ts +9 -0
  561. package/dist/hub/member/direct-rooms.js +14 -0
  562. package/dist/hub/member/direct-rooms.js.map +1 -0
  563. package/dist/hub/member/display-name.d.ts +9 -0
  564. package/dist/hub/member/display-name.js +71 -0
  565. package/dist/hub/member/display-name.js.map +1 -0
  566. package/dist/hub/member/exposure-api.d.ts +11 -3
  567. package/dist/hub/member/exposure-api.js +24 -10
  568. package/dist/hub/member/exposure-api.js.map +1 -1
  569. package/dist/hub/member/exposures.d.ts +16 -4
  570. package/dist/hub/member/exposures.js +47 -13
  571. package/dist/hub/member/exposures.js.map +1 -1
  572. package/dist/hub/member/pairing-api.js +3 -2
  573. package/dist/hub/member/pairing-api.js.map +1 -1
  574. package/dist/hub/member/recommendations.d.ts +37 -0
  575. package/dist/hub/member/recommendations.js +129 -0
  576. package/dist/hub/member/recommendations.js.map +1 -0
  577. package/dist/hub/member/room-ask.d.ts +104 -6
  578. package/dist/hub/member/room-ask.js +505 -34
  579. package/dist/hub/member/room-ask.js.map +1 -1
  580. package/dist/hub/member/room-asker-store.d.ts +48 -0
  581. package/dist/hub/member/room-asker-store.js +181 -0
  582. package/dist/hub/member/room-asker-store.js.map +1 -0
  583. package/dist/hub/member/room-context-budget.d.ts +5 -0
  584. package/dist/hub/member/room-context-budget.js +34 -0
  585. package/dist/hub/member/room-context-budget.js.map +1 -0
  586. package/dist/hub/member/room-mention-feedback.d.ts +46 -0
  587. package/dist/hub/member/room-mention-feedback.js +121 -0
  588. package/dist/hub/member/room-mention-feedback.js.map +1 -0
  589. package/dist/hub/member/room-notification.d.ts +9 -0
  590. package/dist/hub/member/room-notification.js +2 -0
  591. package/dist/hub/member/room-notification.js.map +1 -0
  592. package/dist/hub/member/room-post-answers.d.ts +48 -0
  593. package/dist/hub/member/room-post-answers.js +152 -0
  594. package/dist/hub/member/room-post-answers.js.map +1 -0
  595. package/dist/hub/member/room-post-receipt.d.ts +21 -0
  596. package/dist/hub/member/room-post-receipt.js +49 -0
  597. package/dist/hub/member/room-post-receipt.js.map +1 -0
  598. package/dist/hub/member/room-post.d.ts +144 -0
  599. package/dist/hub/member/room-post.js +339 -0
  600. package/dist/hub/member/room-post.js.map +1 -0
  601. package/dist/hub/member/room-reaction-acks.d.ts +12 -0
  602. package/dist/hub/member/room-reaction-acks.js +44 -0
  603. package/dist/hub/member/room-reaction-acks.js.map +1 -0
  604. package/dist/hub/member/sharing-journal.d.ts +252 -0
  605. package/dist/hub/member/sharing-journal.js +212 -0
  606. package/dist/hub/member/sharing-journal.js.map +1 -0
  607. package/dist/hub/member/sharing-link.d.ts +25 -0
  608. package/dist/hub/member/sharing-link.js +68 -0
  609. package/dist/hub/member/sharing-link.js.map +1 -0
  610. package/dist/hub/member/sharing-result.d.ts +6 -0
  611. package/dist/hub/member/sharing-result.js +46 -0
  612. package/dist/hub/member/sharing-result.js.map +1 -0
  613. package/dist/hub/member/sharing.d.ts +39 -0
  614. package/dist/hub/member/sharing.js +188 -0
  615. package/dist/hub/member/sharing.js.map +1 -0
  616. package/dist/hub/member/updates.d.ts +98 -0
  617. package/dist/hub/member/updates.js +322 -0
  618. package/dist/hub/member/updates.js.map +1 -0
  619. package/dist/hub/pairing.d.ts +15 -1
  620. package/dist/hub/pairing.js +33 -2
  621. package/dist/hub/pairing.js.map +1 -1
  622. package/dist/hub/personal/owner-host.d.ts +146 -0
  623. package/dist/hub/personal/owner-host.js +289 -0
  624. package/dist/hub/personal/owner-host.js.map +1 -0
  625. package/dist/hub/personal/refusals.d.ts +11 -0
  626. package/dist/hub/personal/refusals.js +33 -0
  627. package/dist/hub/personal/refusals.js.map +1 -0
  628. package/dist/hub/personal/runtime-host.d.ts +26 -0
  629. package/dist/hub/personal/runtime-host.js +51 -0
  630. package/dist/hub/personal/runtime-host.js.map +1 -0
  631. package/dist/hub/personal/schema.d.ts +4 -0
  632. package/dist/hub/personal/schema.js +54 -0
  633. package/dist/hub/personal/schema.js.map +1 -0
  634. package/dist/hub/personal/turns.d.ts +39 -0
  635. package/dist/hub/personal/turns.js +221 -0
  636. package/dist/hub/personal/turns.js.map +1 -0
  637. package/dist/hub/personal/types.d.ts +42 -0
  638. package/dist/hub/personal/types.js +2 -0
  639. package/dist/hub/personal/types.js.map +1 -0
  640. package/dist/hub/policy.d.ts +12 -3
  641. package/dist/hub/policy.js +107 -23
  642. package/dist/hub/policy.js.map +1 -1
  643. package/dist/hub/protocol.d.ts +1481 -49
  644. package/dist/hub/protocol.js +130 -17
  645. package/dist/hub/protocol.js.map +1 -1
  646. package/dist/hub/published-version.d.ts +3 -0
  647. package/dist/hub/published-version.js +35 -0
  648. package/dist/hub/published-version.js.map +1 -0
  649. package/dist/hub/question-close-model.d.ts +17 -0
  650. package/dist/hub/question-close-model.js +7 -0
  651. package/dist/hub/question-close-model.js.map +1 -0
  652. package/dist/hub/quota.d.ts +2 -2
  653. package/dist/hub/quota.js +9 -5
  654. package/dist/hub/quota.js.map +1 -1
  655. package/dist/hub/read-statement.d.ts +6 -0
  656. package/dist/hub/read-statement.js +33 -0
  657. package/dist/hub/read-statement.js.map +1 -0
  658. package/dist/hub/recommendation-model.d.ts +36 -0
  659. package/dist/hub/recommendation-model.js +9 -0
  660. package/dist/hub/recommendation-model.js.map +1 -0
  661. package/dist/hub/recommendations.d.ts +58 -0
  662. package/dist/hub/recommendations.js +212 -0
  663. package/dist/hub/recommendations.js.map +1 -0
  664. package/dist/hub/representative.d.ts +57 -0
  665. package/dist/hub/representative.js +239 -19
  666. package/dist/hub/representative.js.map +1 -1
  667. package/dist/hub/roles/admin-control.d.ts +29 -0
  668. package/dist/hub/roles/admin-control.js +187 -0
  669. package/dist/hub/roles/admin-control.js.map +1 -0
  670. package/dist/hub/roles/admin-types.d.ts +72 -0
  671. package/dist/hub/roles/admin-types.js +2 -0
  672. package/dist/hub/roles/admin-types.js.map +1 -0
  673. package/dist/hub/roles/allowed-list-control.d.ts +34 -0
  674. package/dist/hub/roles/allowed-list-control.js +179 -0
  675. package/dist/hub/roles/allowed-list-control.js.map +1 -0
  676. package/dist/hub/roles/allowed-list.d.ts +8 -0
  677. package/dist/hub/roles/allowed-list.js +49 -0
  678. package/dist/hub/roles/allowed-list.js.map +1 -0
  679. package/dist/hub/roles/audit-details.d.ts +146 -0
  680. package/dist/hub/roles/audit-details.js +26 -0
  681. package/dist/hub/roles/audit-details.js.map +1 -0
  682. package/dist/hub/roles/authority.d.ts +20 -3
  683. package/dist/hub/roles/authority.js +165 -87
  684. package/dist/hub/roles/authority.js.map +1 -1
  685. package/dist/hub/roles/change.d.ts +3 -1
  686. package/dist/hub/roles/change.js +7 -2
  687. package/dist/hub/roles/change.js.map +1 -1
  688. package/dist/hub/roles/clock.d.ts +4 -1
  689. package/dist/hub/roles/clock.js +15 -12
  690. package/dist/hub/roles/clock.js.map +1 -1
  691. package/dist/hub/roles/convert.js +1 -1
  692. package/dist/hub/roles/convert.js.map +1 -1
  693. package/dist/hub/roles/cutover-clock-facts.d.ts +13 -0
  694. package/dist/hub/roles/cutover-clock-facts.js +25 -0
  695. package/dist/hub/roles/cutover-clock-facts.js.map +1 -0
  696. package/dist/hub/roles/cutover-inventory.d.ts +5 -0
  697. package/dist/hub/roles/cutover-inventory.js +27 -4
  698. package/dist/hub/roles/cutover-inventory.js.map +1 -1
  699. package/dist/hub/roles/cutover-marker.d.ts +18 -2
  700. package/dist/hub/roles/cutover-marker.js +6 -2
  701. package/dist/hub/roles/cutover-marker.js.map +1 -1
  702. package/dist/hub/roles/cutover.d.ts +2 -2
  703. package/dist/hub/roles/cutover.js +3 -4
  704. package/dist/hub/roles/cutover.js.map +1 -1
  705. package/dist/hub/roles/delegation.d.ts +4 -1
  706. package/dist/hub/roles/delegation.js +9 -4
  707. package/dist/hub/roles/delegation.js.map +1 -1
  708. package/dist/hub/roles/evaluate.d.ts +2 -1
  709. package/dist/hub/roles/evaluate.js +14 -0
  710. package/dist/hub/roles/evaluate.js.map +1 -1
  711. package/dist/hub/roles/expiry-effects.d.ts +8 -0
  712. package/dist/hub/roles/expiry-effects.js +50 -0
  713. package/dist/hub/roles/expiry-effects.js.map +1 -0
  714. package/dist/hub/roles/migrations.d.ts +7 -0
  715. package/dist/hub/roles/migrations.js +44 -0
  716. package/dist/hub/roles/migrations.js.map +1 -0
  717. package/dist/hub/roles/model.d.ts +30 -2
  718. package/dist/hub/roles/model.js +14 -7
  719. package/dist/hub/roles/model.js.map +1 -1
  720. package/dist/hub/roles/overview.d.ts +8 -0
  721. package/dist/hub/roles/overview.js +15 -0
  722. package/dist/hub/roles/overview.js.map +1 -0
  723. package/dist/hub/roles/read.d.ts +4 -0
  724. package/dist/hub/roles/read.js +37 -7
  725. package/dist/hub/roles/read.js.map +1 -1
  726. package/dist/hub/roles/resource-effects.d.ts +17 -0
  727. package/dist/hub/roles/resource-effects.js +62 -0
  728. package/dist/hub/roles/resource-effects.js.map +1 -0
  729. package/dist/hub/roles/review.d.ts +16 -0
  730. package/dist/hub/roles/review.js +42 -0
  731. package/dist/hub/roles/review.js.map +1 -0
  732. package/dist/hub/roles/writer.d.ts +14 -3
  733. package/dist/hub/roles/writer.js +64 -16
  734. package/dist/hub/roles/writer.js.map +1 -1
  735. package/dist/hub/room-agent-discovery-model.d.ts +29 -0
  736. package/dist/hub/room-agent-discovery-model.js +33 -0
  737. package/dist/hub/room-agent-discovery-model.js.map +1 -0
  738. package/dist/hub/room-agent-discovery.d.ts +14 -0
  739. package/dist/hub/room-agent-discovery.js +65 -0
  740. package/dist/hub/room-agent-discovery.js.map +1 -0
  741. package/dist/hub/room-agent-requests.d.ts +71 -0
  742. package/dist/hub/room-agent-requests.js +377 -0
  743. package/dist/hub/room-agent-requests.js.map +1 -0
  744. package/dist/hub/room-answer-status-model.d.ts +3 -0
  745. package/dist/hub/room-answer-status-model.js +4 -0
  746. package/dist/hub/room-answer-status-model.js.map +1 -0
  747. package/dist/hub/room-asker-identity-model.d.ts +53 -0
  748. package/dist/hub/room-asker-identity-model.js +14 -0
  749. package/dist/hub/room-asker-identity-model.js.map +1 -0
  750. package/dist/hub/room-asker-identity.d.ts +22 -0
  751. package/dist/hub/room-asker-identity.js +43 -0
  752. package/dist/hub/room-asker-identity.js.map +1 -0
  753. package/dist/hub/room-brief-model.d.ts +30 -0
  754. package/dist/hub/room-brief-model.js +38 -0
  755. package/dist/hub/room-brief-model.js.map +1 -0
  756. package/dist/hub/room-context-model.d.ts +45 -0
  757. package/dist/hub/room-context-model.js +12 -0
  758. package/dist/hub/room-context-model.js.map +1 -0
  759. package/dist/hub/room-history-model.d.ts +87 -0
  760. package/dist/hub/room-history-model.js +14 -0
  761. package/dist/hub/room-history-model.js.map +1 -0
  762. package/dist/hub/room-members-model.d.ts +63 -0
  763. package/dist/hub/room-members-model.js +7 -0
  764. package/dist/hub/room-members-model.js.map +1 -0
  765. package/dist/hub/room-mention-feedback-model.d.ts +12 -0
  766. package/dist/hub/room-mention-feedback-model.js +12 -0
  767. package/dist/hub/room-mention-feedback-model.js.map +1 -0
  768. package/dist/hub/room-react-ack-model.d.ts +2 -0
  769. package/dist/hub/room-react-ack-model.js +3 -0
  770. package/dist/hub/room-react-ack-model.js.map +1 -0
  771. package/dist/hub/rooms/admin.d.ts +6 -0
  772. package/dist/hub/rooms/admin.js +33 -0
  773. package/dist/hub/rooms/admin.js.map +1 -1
  774. package/dist/hub/rooms/agents.d.ts +52 -11
  775. package/dist/hub/rooms/agents.js +418 -37
  776. package/dist/hub/rooms/agents.js.map +1 -1
  777. package/dist/hub/rooms/asker-identity.d.ts +21 -0
  778. package/dist/hub/rooms/asker-identity.js +86 -0
  779. package/dist/hub/rooms/asker-identity.js.map +1 -0
  780. package/dist/hub/rooms/assistant.d.ts +1 -6
  781. package/dist/hub/rooms/assistant.js +7 -2
  782. package/dist/hub/rooms/assistant.js.map +1 -1
  783. package/dist/hub/rooms/automation.d.ts +24 -0
  784. package/dist/hub/rooms/automation.js +66 -0
  785. package/dist/hub/rooms/automation.js.map +1 -0
  786. package/dist/hub/rooms/brief.d.ts +18 -0
  787. package/dist/hub/rooms/brief.js +39 -0
  788. package/dist/hub/rooms/brief.js.map +1 -0
  789. package/dist/hub/rooms/buttons.d.ts +85 -0
  790. package/dist/hub/rooms/buttons.js +62 -0
  791. package/dist/hub/rooms/buttons.js.map +1 -0
  792. package/dist/hub/rooms/context-cursor.d.ts +18 -0
  793. package/dist/hub/rooms/context-cursor.js +61 -0
  794. package/dist/hub/rooms/context-cursor.js.map +1 -0
  795. package/dist/hub/rooms/context.d.ts +1 -1
  796. package/dist/hub/rooms/context.js +4 -4
  797. package/dist/hub/rooms/context.js.map +1 -1
  798. package/dist/hub/rooms/direct-view.d.ts +12 -3
  799. package/dist/hub/rooms/direct-view.js +26 -10
  800. package/dist/hub/rooms/direct-view.js.map +1 -1
  801. package/dist/hub/rooms/directory.d.ts +13 -0
  802. package/dist/hub/rooms/directory.js +12 -3
  803. package/dist/hub/rooms/directory.js.map +1 -1
  804. package/dist/hub/rooms/history.d.ts +8 -0
  805. package/dist/hub/rooms/history.js +31 -0
  806. package/dist/hub/rooms/history.js.map +1 -0
  807. package/dist/hub/rooms/members-page.d.ts +33 -0
  808. package/dist/hub/rooms/members-page.js +37 -0
  809. package/dist/hub/rooms/members-page.js.map +1 -0
  810. package/dist/hub/rooms/mentions.d.ts +15 -0
  811. package/dist/hub/rooms/mentions.js +43 -0
  812. package/dist/hub/rooms/mentions.js.map +1 -0
  813. package/dist/hub/rooms/office.d.ts +141 -0
  814. package/dist/hub/rooms/office.js +81 -0
  815. package/dist/hub/rooms/office.js.map +1 -0
  816. package/dist/hub/rooms/post-replies.d.ts +23 -0
  817. package/dist/hub/rooms/post-replies.js +114 -0
  818. package/dist/hub/rooms/post-replies.js.map +1 -0
  819. package/dist/hub/rooms/purpose.d.ts +7 -0
  820. package/dist/hub/rooms/purpose.js +14 -0
  821. package/dist/hub/rooms/purpose.js.map +1 -0
  822. package/dist/hub/rooms/schema.d.ts +16 -0
  823. package/dist/hub/rooms/schema.js +56 -0
  824. package/dist/hub/rooms/schema.js.map +1 -1
  825. package/dist/hub/rooms/service.d.ts +400 -8
  826. package/dist/hub/rooms/service.js +1231 -72
  827. package/dist/hub/rooms/service.js.map +1 -1
  828. package/dist/hub/rooms/types.d.ts +48 -4
  829. package/dist/hub/rooms.d.ts +33 -6
  830. package/dist/hub/rooms.js +236 -51
  831. package/dist/hub/rooms.js.map +1 -1
  832. package/dist/hub/runtime.d.ts +1 -1
  833. package/dist/hub/runtime.js +17 -4
  834. package/dist/hub/runtime.js.map +1 -1
  835. package/dist/hub/send-timing.d.ts +6 -0
  836. package/dist/hub/send-timing.js +39 -0
  837. package/dist/hub/send-timing.js.map +1 -0
  838. package/dist/hub/server.d.ts +8 -1
  839. package/dist/hub/server.js +187 -7
  840. package/dist/hub/server.js.map +1 -1
  841. package/dist/hub/session-directory-transition.d.ts +3 -1
  842. package/dist/hub/session-directory-transition.js +25 -12
  843. package/dist/hub/session-directory-transition.js.map +1 -1
  844. package/dist/hub/session-epoch.js +2 -1
  845. package/dist/hub/session-epoch.js.map +1 -1
  846. package/dist/hub/session-limits.d.ts +58 -0
  847. package/dist/hub/session-limits.js +121 -0
  848. package/dist/hub/session-limits.js.map +1 -0
  849. package/dist/hub/sessions.d.ts +5 -2
  850. package/dist/hub/sessions.js +84 -12
  851. package/dist/hub/sessions.js.map +1 -1
  852. package/dist/hub/settings-commit.d.ts +32 -1
  853. package/dist/hub/settings-commit.js +11 -4
  854. package/dist/hub/settings-commit.js.map +1 -1
  855. package/dist/hub/settings-directory-ca.js +1 -1
  856. package/dist/hub/settings-directory-ca.js.map +1 -1
  857. package/dist/hub/settings-directory-control.js +7 -7
  858. package/dist/hub/settings-directory-control.js.map +1 -1
  859. package/dist/hub/settings-directory-decision.js +15 -8
  860. package/dist/hub/settings-directory-decision.js.map +1 -1
  861. package/dist/hub/settings-directory-http.d.ts +2 -0
  862. package/dist/hub/settings-directory-http.js +21 -6
  863. package/dist/hub/settings-directory-http.js.map +1 -1
  864. package/dist/hub/settings-directory-proof.d.ts +5 -1
  865. package/dist/hub/settings-directory-proof.js +49 -10
  866. package/dist/hub/settings-directory-proof.js.map +1 -1
  867. package/dist/hub/settings-directory-recovery.js +2 -1
  868. package/dist/hub/settings-directory-recovery.js.map +1 -1
  869. package/dist/hub/settings-directory-save.d.ts +2 -0
  870. package/dist/hub/settings-directory-save.js +9 -6
  871. package/dist/hub/settings-directory-save.js.map +1 -1
  872. package/dist/hub/settings-member-address-decision.js +3 -2
  873. package/dist/hub/settings-member-address-decision.js.map +1 -1
  874. package/dist/hub/settings-web-address-decision.js +2 -1
  875. package/dist/hub/settings-web-address-decision.js.map +1 -1
  876. package/dist/hub/sharing-previous-access.d.ts +22 -0
  877. package/dist/hub/sharing-previous-access.js +93 -0
  878. package/dist/hub/sharing-previous-access.js.map +1 -0
  879. package/dist/hub/sharing-requests.d.ts +174 -0
  880. package/dist/hub/sharing-requests.js +326 -0
  881. package/dist/hub/sharing-requests.js.map +1 -0
  882. package/dist/hub/sharing-retention.d.ts +47 -0
  883. package/dist/hub/sharing-retention.js +83 -0
  884. package/dist/hub/sharing-retention.js.map +1 -0
  885. package/dist/hub/sharing-withdrawal.d.ts +14 -0
  886. package/dist/hub/sharing-withdrawal.js +28 -0
  887. package/dist/hub/sharing-withdrawal.js.map +1 -0
  888. package/dist/hub/sharing.js +2 -2
  889. package/dist/hub/sharing.js.map +1 -1
  890. package/dist/hub/socket.d.ts +1 -0
  891. package/dist/hub/socket.js +39 -2
  892. package/dist/hub/socket.js.map +1 -1
  893. package/dist/hub/store.d.ts +5 -0
  894. package/dist/hub/store.js +28 -5
  895. package/dist/hub/store.js.map +1 -1
  896. package/dist/hub/teams/index.d.ts +8 -3
  897. package/dist/hub/teams/index.js +106 -31
  898. package/dist/hub/teams/index.js.map +1 -1
  899. package/dist/hub/teams/store.d.ts +5 -1
  900. package/dist/hub/teams/store.js +25 -2
  901. package/dist/hub/teams/store.js.map +1 -1
  902. package/dist/hub/teams/types.d.ts +19 -2
  903. package/dist/hub/types.d.ts +176 -5
  904. package/dist/hub-agent-incarnation-record.d.ts +24 -0
  905. package/dist/hub-agent-incarnation-record.js +46 -0
  906. package/dist/hub-agent-incarnation-record.js.map +1 -0
  907. package/dist/hub-character-plan.d.ts +47 -0
  908. package/dist/hub-character-plan.js +70 -0
  909. package/dist/hub-character-plan.js.map +1 -0
  910. package/dist/hub-classic-private.d.ts +19 -0
  911. package/dist/hub-classic-private.js +64 -0
  912. package/dist/hub-classic-private.js.map +1 -0
  913. package/dist/hub-contact-windows.d.ts +23 -0
  914. package/dist/hub-contact-windows.js +89 -0
  915. package/dist/hub-contact-windows.js.map +1 -0
  916. package/dist/hub-page-sharing-settings.d.ts +6 -0
  917. package/dist/hub-page-sharing-settings.js +19 -0
  918. package/dist/hub-page-sharing-settings.js.map +1 -0
  919. package/dist/hub-pairing-summary.d.ts +1 -1
  920. package/dist/hub-picture-reduce.d.ts +34 -0
  921. package/dist/hub-picture-reduce.js +101 -0
  922. package/dist/hub-picture-reduce.js.map +1 -0
  923. package/dist/hub-picture-worker.d.ts +1 -0
  924. package/dist/hub-picture-worker.js +19 -0
  925. package/dist/hub-picture-worker.js.map +1 -0
  926. package/dist/hub-report-target.d.ts +6 -0
  927. package/dist/hub-report-target.js +6 -0
  928. package/dist/hub-report-target.js.map +1 -1
  929. package/dist/hub-room-conversation.d.ts +14 -0
  930. package/dist/hub-room-conversation.js +60 -0
  931. package/dist/hub-room-conversation.js.map +1 -0
  932. package/dist/hub-room-reply-warning.d.ts +2 -0
  933. package/dist/hub-room-reply-warning.js +16 -0
  934. package/dist/hub-room-reply-warning.js.map +1 -0
  935. package/dist/hub-sharing-notice.d.ts +43 -0
  936. package/dist/hub-sharing-notice.js +34 -0
  937. package/dist/hub-sharing-notice.js.map +1 -0
  938. package/dist/hub-update-notice.d.ts +12 -0
  939. package/dist/hub-update-notice.js +35 -0
  940. package/dist/hub-update-notice.js.map +1 -0
  941. package/dist/human-delivery-receipts.d.ts +27 -5
  942. package/dist/human-delivery-receipts.js +52 -8
  943. package/dist/human-delivery-receipts.js.map +1 -1
  944. package/dist/install-lock.d.ts +15 -1
  945. package/dist/install-lock.js +16 -8
  946. package/dist/install-lock.js.map +1 -1
  947. package/dist/install-ownership.d.ts +165 -0
  948. package/dist/install-ownership.js +404 -0
  949. package/dist/install-ownership.js.map +1 -0
  950. package/dist/instance-config-impact.js +7 -2
  951. package/dist/instance-config-impact.js.map +1 -1
  952. package/dist/instance-lifecycle.d.ts +32 -4
  953. package/dist/instance-lifecycle.js +111 -25
  954. package/dist/instance-lifecycle.js.map +1 -1
  955. package/dist/instruction-file-sizes.d.ts +46 -0
  956. package/dist/instruction-file-sizes.js +115 -0
  957. package/dist/instruction-file-sizes.js.map +1 -0
  958. package/dist/instructions.d.ts +40 -2
  959. package/dist/instructions.js +68 -34
  960. package/dist/instructions.js.map +1 -1
  961. package/dist/local-pane-endpoint.d.ts +18 -1
  962. package/dist/local-pane-endpoint.js +44 -2
  963. package/dist/local-pane-endpoint.js.map +1 -1
  964. package/dist/locale.d.ts +2 -0
  965. package/dist/locale.js +956 -295
  966. package/dist/locale.js.map +1 -1
  967. package/dist/log-steps.d.ts +5 -0
  968. package/dist/log-steps.js +6 -2
  969. package/dist/log-steps.js.map +1 -1
  970. package/dist/login-controller.d.ts +45 -2
  971. package/dist/login-controller.js +98 -10
  972. package/dist/login-controller.js.map +1 -1
  973. package/dist/login-flows.js +1 -1
  974. package/dist/login-flows.js.map +1 -1
  975. package/dist/ls-rows.d.ts +2 -0
  976. package/dist/ls-rows.js.map +1 -1
  977. package/dist/memory-guidance.d.ts +5 -0
  978. package/dist/memory-guidance.js +14 -0
  979. package/dist/memory-guidance.js.map +1 -0
  980. package/dist/memory-pressure.js +8 -1
  981. package/dist/memory-pressure.js.map +1 -1
  982. package/dist/model-defaults.d.ts +5 -0
  983. package/dist/model-defaults.js +6 -0
  984. package/dist/model-defaults.js.map +1 -0
  985. package/dist/native-agent-admission.d.ts +7 -0
  986. package/dist/native-agent-admission.js +55 -3
  987. package/dist/native-agent-admission.js.map +1 -1
  988. package/dist/native-exec-context.d.ts +11 -0
  989. package/dist/native-exec-context.js +18 -0
  990. package/dist/native-exec-context.js.map +1 -0
  991. package/dist/native-exec-input.d.ts +56 -0
  992. package/dist/native-exec-input.js +89 -0
  993. package/dist/native-exec-input.js.map +1 -0
  994. package/dist/native-mcp.d.ts +26 -1
  995. package/dist/native-mcp.js +85 -18
  996. package/dist/native-mcp.js.map +1 -1
  997. package/dist/native-model-catalog.d.ts +15 -0
  998. package/dist/native-model-catalog.js +43 -3
  999. package/dist/native-model-catalog.js.map +1 -1
  1000. package/dist/native-pane-lifecycle.d.ts +12 -0
  1001. package/dist/native-pane-lifecycle.js +28 -2
  1002. package/dist/native-pane-lifecycle.js.map +1 -1
  1003. package/dist/native-pane-manager.d.ts +37 -6
  1004. package/dist/native-pane-manager.js +160 -8
  1005. package/dist/native-pane-manager.js.map +1 -1
  1006. package/dist/native-pane-tools.js +3 -0
  1007. package/dist/native-pane-tools.js.map +1 -1
  1008. package/dist/needs-you-hub.d.ts +7 -0
  1009. package/dist/needs-you-hub.js +48 -7
  1010. package/dist/needs-you-hub.js.map +1 -1
  1011. package/dist/needs-you.d.ts +66 -2
  1012. package/dist/needs-you.js +26 -1
  1013. package/dist/needs-you.js.map +1 -1
  1014. package/dist/office-share-page.js +5 -5
  1015. package/dist/office-share-page.js.map +1 -1
  1016. package/dist/office-share.js +2 -1
  1017. package/dist/office-share.js.map +1 -1
  1018. package/dist/outbound-handlers.d.ts +49 -4
  1019. package/dist/outbound-handlers.js +263 -20
  1020. package/dist/outbound-handlers.js.map +1 -1
  1021. package/dist/outbound-schemas.d.ts +44 -0
  1022. package/dist/outbound-schemas.js +56 -30
  1023. package/dist/outbound-schemas.js.map +1 -1
  1024. package/dist/package-preimage.js +4 -0
  1025. package/dist/package-preimage.js.map +1 -1
  1026. package/dist/pane-port.d.ts +3 -0
  1027. package/dist/pause-marker.d.ts +1 -1
  1028. package/dist/pause-marker.js +1 -1
  1029. package/dist/pause-marker.js.map +1 -1
  1030. package/dist/plist-args.d.ts +9 -0
  1031. package/dist/plist-args.js +22 -0
  1032. package/dist/plist-args.js.map +1 -0
  1033. package/dist/profile-signins.d.ts +1 -0
  1034. package/dist/profile-signins.js +3 -1
  1035. package/dist/profile-signins.js.map +1 -1
  1036. package/dist/public-preview.d.ts +4 -6
  1037. package/dist/public-preview.js +5 -2
  1038. package/dist/public-preview.js.map +1 -1
  1039. package/dist/public-web-gateway.d.ts +20 -0
  1040. package/dist/public-web-gateway.js +262 -9
  1041. package/dist/public-web-gateway.js.map +1 -1
  1042. package/dist/public-web-link.d.ts +34 -3
  1043. package/dist/public-web-link.js +50 -3
  1044. package/dist/public-web-link.js.map +1 -1
  1045. package/dist/queued-handoffs.d.ts +16 -4
  1046. package/dist/queued-handoffs.js +18 -1
  1047. package/dist/queued-handoffs.js.map +1 -1
  1048. package/dist/quickstart-api.d.ts +0 -1
  1049. package/dist/quickstart-api.js +8 -1
  1050. package/dist/quickstart-api.js.map +1 -1
  1051. package/dist/quickstart.d.ts +1 -1
  1052. package/dist/quickstart.js +2 -3
  1053. package/dist/quickstart.js.map +1 -1
  1054. package/dist/recover.cjs +2639 -0
  1055. package/dist/remote-card-answer.d.ts +1 -1
  1056. package/dist/remote-card-answer.js +8 -1
  1057. package/dist/remote-card-answer.js.map +1 -1
  1058. package/dist/remote-card-prompt.d.ts +7 -2
  1059. package/dist/remote-card-prompt.js +13 -4
  1060. package/dist/remote-card-prompt.js.map +1 -1
  1061. package/dist/reply-buttons-controller.d.ts +3 -1
  1062. package/dist/reply-buttons-controller.js +1 -1
  1063. package/dist/reply-buttons-controller.js.map +1 -1
  1064. package/dist/reply-dedup.js +3 -1
  1065. package/dist/reply-dedup.js.map +1 -1
  1066. package/dist/reply-draft.d.ts +12 -0
  1067. package/dist/reply-draft.js +81 -0
  1068. package/dist/reply-draft.js.map +1 -0
  1069. package/dist/reply-preview-files.d.ts +38 -0
  1070. package/dist/reply-preview-files.js +142 -0
  1071. package/dist/reply-preview-files.js.map +1 -0
  1072. package/dist/reply-preview-spec.d.ts +18 -0
  1073. package/dist/reply-preview-spec.js +27 -0
  1074. package/dist/reply-preview-spec.js.map +1 -0
  1075. package/dist/request-contact-api.d.ts +15 -0
  1076. package/dist/request-contact-api.js +120 -0
  1077. package/dist/request-contact-api.js.map +1 -0
  1078. package/dist/request-contact-card.d.ts +36 -0
  1079. package/dist/request-contact-card.js +206 -0
  1080. package/dist/request-contact-card.js.map +1 -0
  1081. package/dist/request-contact-gate.d.ts +81 -0
  1082. package/dist/request-contact-gate.js +267 -0
  1083. package/dist/request-contact-gate.js.map +1 -0
  1084. package/dist/request-contact-native.d.ts +52 -0
  1085. package/dist/request-contact-native.js +87 -0
  1086. package/dist/request-contact-native.js.map +1 -0
  1087. package/dist/request-contact-types.d.ts +86 -0
  1088. package/dist/request-contact-types.js +7 -0
  1089. package/dist/request-contact-types.js.map +1 -0
  1090. package/dist/request-context-activation.d.ts +29 -0
  1091. package/dist/request-context-activation.js +85 -0
  1092. package/dist/request-context-activation.js.map +1 -0
  1093. package/dist/request-context-admission.d.ts +22 -0
  1094. package/dist/request-context-admission.js +12 -0
  1095. package/dist/request-context-admission.js.map +1 -0
  1096. package/dist/request-context-boot.d.ts +35 -0
  1097. package/dist/request-context-boot.js +97 -0
  1098. package/dist/request-context-boot.js.map +1 -0
  1099. package/dist/request-context-call-protocol.d.ts +12 -0
  1100. package/dist/request-context-call-protocol.js +14 -0
  1101. package/dist/request-context-call-protocol.js.map +1 -0
  1102. package/dist/request-context-call.d.ts +25 -0
  1103. package/dist/request-context-call.js +35 -0
  1104. package/dist/request-context-call.js.map +1 -0
  1105. package/dist/request-context-compatibility.d.ts +20 -0
  1106. package/dist/request-context-compatibility.js +82 -0
  1107. package/dist/request-context-compatibility.js.map +1 -0
  1108. package/dist/request-context-continuation.d.ts +6 -0
  1109. package/dist/request-context-continuation.js +24 -0
  1110. package/dist/request-context-continuation.js.map +1 -0
  1111. package/dist/request-context-control-api.d.ts +119 -0
  1112. package/dist/request-context-control-api.js +179 -0
  1113. package/dist/request-context-control-api.js.map +1 -0
  1114. package/dist/request-context-control-copy.d.ts +3 -0
  1115. package/dist/request-context-control-copy.js +7 -0
  1116. package/dist/request-context-control-copy.js.map +1 -0
  1117. package/dist/request-context-controller.d.ts +44 -0
  1118. package/dist/request-context-controller.js +129 -0
  1119. package/dist/request-context-controller.js.map +1 -0
  1120. package/dist/request-context-delivery-resolver.d.ts +13 -0
  1121. package/dist/request-context-delivery-resolver.js +30 -0
  1122. package/dist/request-context-delivery-resolver.js.map +1 -0
  1123. package/dist/request-context-drain-projection.d.ts +8 -0
  1124. package/dist/request-context-drain-projection.js +40 -0
  1125. package/dist/request-context-drain-projection.js.map +1 -0
  1126. package/dist/request-context-drain.d.ts +61 -0
  1127. package/dist/request-context-drain.js +291 -0
  1128. package/dist/request-context-drain.js.map +1 -0
  1129. package/dist/request-context-enable-offer.d.ts +13 -0
  1130. package/dist/request-context-enable-offer.js +31 -0
  1131. package/dist/request-context-enable-offer.js.map +1 -0
  1132. package/dist/request-context-exec-owner.d.ts +39 -0
  1133. package/dist/request-context-exec-owner.js +128 -0
  1134. package/dist/request-context-exec-owner.js.map +1 -0
  1135. package/dist/request-context-fence.d.ts +28 -0
  1136. package/dist/request-context-fence.js +58 -0
  1137. package/dist/request-context-fence.js.map +1 -0
  1138. package/dist/request-context-go-back-view.d.ts +1 -0
  1139. package/dist/request-context-go-back-view.js +17 -0
  1140. package/dist/request-context-go-back-view.js.map +1 -0
  1141. package/dist/request-context-helper-readiness.d.ts +14 -0
  1142. package/dist/request-context-helper-readiness.js +23 -0
  1143. package/dist/request-context-helper-readiness.js.map +1 -0
  1144. package/dist/request-context-helper.d.ts +20 -0
  1145. package/dist/request-context-helper.js +41 -0
  1146. package/dist/request-context-helper.js.map +1 -0
  1147. package/dist/request-context-hub-resolver.d.ts +29 -0
  1148. package/dist/request-context-hub-resolver.js +90 -0
  1149. package/dist/request-context-hub-resolver.js.map +1 -0
  1150. package/dist/request-context-human-resolver.d.ts +20 -0
  1151. package/dist/request-context-human-resolver.js +77 -0
  1152. package/dist/request-context-human-resolver.js.map +1 -0
  1153. package/dist/request-context-human.d.ts +112 -0
  1154. package/dist/request-context-human.js +176 -0
  1155. package/dist/request-context-human.js.map +1 -0
  1156. package/dist/request-context-inputs.d.ts +21 -0
  1157. package/dist/request-context-inputs.js +63 -0
  1158. package/dist/request-context-inputs.js.map +1 -0
  1159. package/dist/request-context-installation.d.ts +117 -0
  1160. package/dist/request-context-installation.js +328 -0
  1161. package/dist/request-context-installation.js.map +1 -0
  1162. package/dist/request-context-knowledge.d.ts +5 -0
  1163. package/dist/request-context-knowledge.js +32 -0
  1164. package/dist/request-context-knowledge.js.map +1 -0
  1165. package/dist/request-context-migration.d.ts +75 -0
  1166. package/dist/request-context-migration.js +171 -0
  1167. package/dist/request-context-migration.js.map +1 -0
  1168. package/dist/request-context-native-human.d.ts +20 -0
  1169. package/dist/request-context-native-human.js +91 -0
  1170. package/dist/request-context-native-human.js.map +1 -0
  1171. package/dist/request-context-native-output.d.ts +15 -0
  1172. package/dist/request-context-native-output.js +46 -0
  1173. package/dist/request-context-native-output.js.map +1 -0
  1174. package/dist/request-context-native-result.d.ts +15 -0
  1175. package/dist/request-context-native-result.js +46 -0
  1176. package/dist/request-context-native-result.js.map +1 -0
  1177. package/dist/request-context-off.d.ts +22 -0
  1178. package/dist/request-context-off.js +77 -0
  1179. package/dist/request-context-off.js.map +1 -0
  1180. package/dist/request-context-outside-label.d.ts +5 -0
  1181. package/dist/request-context-outside-label.js +28 -0
  1182. package/dist/request-context-outside-label.js.map +1 -0
  1183. package/dist/request-context-pane.d.ts +33 -0
  1184. package/dist/request-context-pane.js +67 -0
  1185. package/dist/request-context-pane.js.map +1 -0
  1186. package/dist/request-context-pending-work.d.ts +11 -0
  1187. package/dist/request-context-pending-work.js +43 -0
  1188. package/dist/request-context-pending-work.js.map +1 -0
  1189. package/dist/request-context-policy.d.ts +90 -0
  1190. package/dist/request-context-policy.js +194 -0
  1191. package/dist/request-context-policy.js.map +1 -0
  1192. package/dist/request-context-protocol.d.ts +137 -0
  1193. package/dist/request-context-protocol.js +38 -0
  1194. package/dist/request-context-protocol.js.map +1 -0
  1195. package/dist/request-context-readiness.d.ts +49 -0
  1196. package/dist/request-context-readiness.js +64 -0
  1197. package/dist/request-context-readiness.js.map +1 -0
  1198. package/dist/request-context-recovery.d.ts +18 -0
  1199. package/dist/request-context-recovery.js +81 -0
  1200. package/dist/request-context-recovery.js.map +1 -0
  1201. package/dist/request-context-relay.d.ts +19 -0
  1202. package/dist/request-context-relay.js +63 -0
  1203. package/dist/request-context-relay.js.map +1 -0
  1204. package/dist/request-context-reply-pending.d.ts +16 -0
  1205. package/dist/request-context-reply-pending.js +77 -0
  1206. package/dist/request-context-reply-pending.js.map +1 -0
  1207. package/dist/request-context-resolution.d.ts +35 -0
  1208. package/dist/request-context-resolution.js +86 -0
  1209. package/dist/request-context-resolution.js.map +1 -0
  1210. package/dist/request-context-retirement.d.ts +21 -0
  1211. package/dist/request-context-retirement.js +16 -0
  1212. package/dist/request-context-retirement.js.map +1 -0
  1213. package/dist/request-context-returns.d.ts +67 -0
  1214. package/dist/request-context-returns.js +211 -0
  1215. package/dist/request-context-returns.js.map +1 -0
  1216. package/dist/request-context-start.d.ts +15 -0
  1217. package/dist/request-context-start.js +2 -0
  1218. package/dist/request-context-start.js.map +1 -0
  1219. package/dist/request-context-store.d.ts +26 -0
  1220. package/dist/request-context-store.js +144 -0
  1221. package/dist/request-context-store.js.map +1 -0
  1222. package/dist/request-context-turns.d.ts +99 -0
  1223. package/dist/request-context-turns.js +216 -0
  1224. package/dist/request-context-turns.js.map +1 -0
  1225. package/dist/request-context-unproved-label.d.ts +4 -0
  1226. package/dist/request-context-unproved-label.js +25 -0
  1227. package/dist/request-context-unproved-label.js.map +1 -0
  1228. package/dist/request-context-update-guard.d.ts +15 -0
  1229. package/dist/request-context-update-guard.js +54 -0
  1230. package/dist/request-context-update-guard.js.map +1 -0
  1231. package/dist/request-context-view.d.ts +33 -0
  1232. package/dist/request-context-view.js +36 -0
  1233. package/dist/request-context-view.js.map +1 -0
  1234. package/dist/request-context-work.d.ts +50 -0
  1235. package/dist/request-context-work.js +178 -0
  1236. package/dist/request-context-work.js.map +1 -0
  1237. package/dist/request-hub-context.d.ts +131 -0
  1238. package/dist/request-hub-context.js +89 -0
  1239. package/dist/request-hub-context.js.map +1 -0
  1240. package/dist/request-hub-output.d.ts +13 -0
  1241. package/dist/request-hub-output.js +33 -0
  1242. package/dist/request-hub-output.js.map +1 -0
  1243. package/dist/restart-progress.d.ts +6 -0
  1244. package/dist/restart-progress.js +5 -0
  1245. package/dist/restart-progress.js.map +1 -1
  1246. package/dist/retained-human-control.d.ts +11 -0
  1247. package/dist/retained-human-control.js +11 -0
  1248. package/dist/retained-human-control.js.map +1 -0
  1249. package/dist/runtime-api.js +10 -2
  1250. package/dist/runtime-api.js.map +1 -1
  1251. package/dist/runtime-build-info.js +2 -1
  1252. package/dist/runtime-build-info.js.map +1 -1
  1253. package/dist/runtime-cli-install.js +20 -14
  1254. package/dist/runtime-cli-install.js.map +1 -1
  1255. package/dist/runtime-cli.js +31 -5
  1256. package/dist/runtime-cli.js.map +1 -1
  1257. package/dist/runtime-client-store.d.ts +5 -0
  1258. package/dist/runtime-client-store.js +35 -1
  1259. package/dist/runtime-client-store.js.map +1 -1
  1260. package/dist/runtime-client.d.ts +6 -0
  1261. package/dist/runtime-client.js +63 -15
  1262. package/dist/runtime-client.js.map +1 -1
  1263. package/dist/runtime-coordinator.d.ts +31 -3
  1264. package/dist/runtime-coordinator.js +145 -12
  1265. package/dist/runtime-coordinator.js.map +1 -1
  1266. package/dist/runtime-install.d.ts +6 -1
  1267. package/dist/runtime-install.js +12 -4
  1268. package/dist/runtime-install.js.map +1 -1
  1269. package/dist/runtime-pane-assets.d.ts +1 -1
  1270. package/dist/runtime-pane-assets.js +1 -1
  1271. package/dist/runtime-pane-assets.js.map +1 -1
  1272. package/dist/runtime-pane-host.d.ts +3 -0
  1273. package/dist/runtime-pane-host.js +39 -21
  1274. package/dist/runtime-pane-host.js.map +1 -1
  1275. package/dist/runtime-pane-link.d.ts +6 -2
  1276. package/dist/runtime-pane-link.js +17 -4
  1277. package/dist/runtime-pane-link.js.map +1 -1
  1278. package/dist/runtime-pane-mcp-relay.d.ts +11 -1
  1279. package/dist/runtime-pane-mcp-relay.js +69 -3
  1280. package/dist/runtime-pane-mcp-relay.js.map +1 -1
  1281. package/dist/runtime-pane-mcp.d.ts +37 -1
  1282. package/dist/runtime-pane-mcp.js +120 -19
  1283. package/dist/runtime-pane-mcp.js.map +1 -1
  1284. package/dist/runtime-pane-native.js +5 -2
  1285. package/dist/runtime-pane-native.js.map +1 -1
  1286. package/dist/runtime-pane-port.d.ts +6 -0
  1287. package/dist/runtime-pane-port.js +23 -4
  1288. package/dist/runtime-pane-port.js.map +1 -1
  1289. package/dist/runtime-pane-protocol.d.ts +4 -0
  1290. package/dist/runtime-pane-protocol.js +11 -4
  1291. package/dist/runtime-pane-protocol.js.map +1 -1
  1292. package/dist/runtime-pane-service.d.ts +1 -0
  1293. package/dist/runtime-pane-service.js +25 -9
  1294. package/dist/runtime-pane-service.js.map +1 -1
  1295. package/dist/runtime-pane-stdio-protocol.d.ts +4 -0
  1296. package/dist/runtime-pane-stdio-protocol.js +12 -5
  1297. package/dist/runtime-pane-stdio-protocol.js.map +1 -1
  1298. package/dist/runtime-pane-stdio.js +5 -5
  1299. package/dist/runtime-pane-stdio.js.map +1 -1
  1300. package/dist/runtime-personal-answer-only-probe.d.ts +3 -0
  1301. package/dist/runtime-personal-answer-only-probe.js +134 -0
  1302. package/dist/runtime-personal-answer-only-probe.js.map +1 -0
  1303. package/dist/runtime-personal-answer-only.d.ts +16 -0
  1304. package/dist/runtime-personal-answer-only.js +54 -0
  1305. package/dist/runtime-personal-answer-only.js.map +1 -0
  1306. package/dist/runtime-personal-answer.d.ts +30 -0
  1307. package/dist/runtime-personal-answer.js +124 -0
  1308. package/dist/runtime-personal-answer.js.map +1 -0
  1309. package/dist/runtime-personal-preflight.d.ts +8 -0
  1310. package/dist/runtime-personal-preflight.js +103 -0
  1311. package/dist/runtime-personal-preflight.js.map +1 -0
  1312. package/dist/runtime-personal-profile.d.ts +40 -0
  1313. package/dist/runtime-personal-profile.js +81 -0
  1314. package/dist/runtime-personal-profile.js.map +1 -0
  1315. package/dist/runtime-personal-protocol.d.ts +10 -0
  1316. package/dist/runtime-personal-protocol.js +15 -0
  1317. package/dist/runtime-personal-protocol.js.map +1 -0
  1318. package/dist/runtime-personal-stage.d.ts +37 -0
  1319. package/dist/runtime-personal-stage.js +167 -0
  1320. package/dist/runtime-personal-stage.js.map +1 -0
  1321. package/dist/runtime-protocol.d.ts +7 -0
  1322. package/dist/runtime-protocol.js.map +1 -1
  1323. package/dist/runtime-update-controller.js +1 -1
  1324. package/dist/runtime-update-controller.js.map +1 -1
  1325. package/dist/runtime-windows-bridge.d.ts +8 -0
  1326. package/dist/runtime-windows-bridge.js +50 -3
  1327. package/dist/runtime-windows-bridge.js.map +1 -1
  1328. package/dist/scheduler/db.js +37 -0
  1329. package/dist/scheduler/db.js.map +1 -1
  1330. package/dist/scheduler/scheduler.d.ts +15 -0
  1331. package/dist/scheduler/scheduler.js +45 -1
  1332. package/dist/scheduler/scheduler.js.map +1 -1
  1333. package/dist/scheduler/scheduler.test.js +17 -0
  1334. package/dist/scheduler/scheduler.test.js.map +1 -1
  1335. package/dist/scheduler/task-board-mentions.d.ts +32 -0
  1336. package/dist/scheduler/task-board-mentions.js +97 -0
  1337. package/dist/scheduler/task-board-mentions.js.map +1 -0
  1338. package/dist/scheduler/task-board-text.d.ts +5 -6
  1339. package/dist/scheduler/task-board-text.js +30 -10
  1340. package/dist/scheduler/task-board-text.js.map +1 -1
  1341. package/dist/scheduler/task-board-unread.d.ts +90 -0
  1342. package/dist/scheduler/task-board-unread.js +192 -0
  1343. package/dist/scheduler/task-board-unread.js.map +1 -0
  1344. package/dist/scheduler/task-board.d.ts +628 -10
  1345. package/dist/scheduler/task-board.js +1496 -48
  1346. package/dist/scheduler/task-board.js.map +1 -1
  1347. package/dist/scheduler/task-files.d.ts +80 -0
  1348. package/dist/scheduler/task-files.js +357 -0
  1349. package/dist/scheduler/task-files.js.map +1 -0
  1350. package/dist/scheduler/types.d.ts +1 -1
  1351. package/dist/service-activation.js +3 -13
  1352. package/dist/service-activation.js.map +1 -1
  1353. package/dist/service-install-handover.d.ts +52 -0
  1354. package/dist/service-install-handover.js +50 -0
  1355. package/dist/service-install-handover.js.map +1 -0
  1356. package/dist/service-installer.d.ts +12 -0
  1357. package/dist/service-installer.js +24 -10
  1358. package/dist/service-installer.js.map +1 -1
  1359. package/dist/service-lock.d.ts +28 -0
  1360. package/dist/service-lock.js +85 -0
  1361. package/dist/service-lock.js.map +1 -0
  1362. package/dist/settings-api.d.ts +46 -1
  1363. package/dist/settings-api.js +642 -97
  1364. package/dist/settings-api.js.map +1 -1
  1365. package/dist/settings-baseline.d.ts +6 -0
  1366. package/dist/settings-baseline.js +11 -8
  1367. package/dist/settings-baseline.js.map +1 -1
  1368. package/dist/settings-change.js +60 -7
  1369. package/dist/settings-change.js.map +1 -1
  1370. package/dist/settings-confirmation.d.ts +2 -0
  1371. package/dist/settings-confirmation.js +6 -0
  1372. package/dist/settings-confirmation.js.map +1 -1
  1373. package/dist/settings-effect.d.ts +11 -0
  1374. package/dist/settings-effect.js +154 -7
  1375. package/dist/settings-effect.js.map +1 -1
  1376. package/dist/settings-http-confirmation.d.ts +3 -0
  1377. package/dist/settings-http-confirmation.js +46 -43
  1378. package/dist/settings-http-confirmation.js.map +1 -1
  1379. package/dist/settings-instance-patch.js +3 -1
  1380. package/dist/settings-instance-patch.js.map +1 -1
  1381. package/dist/settings-route-lifetime.d.ts +3 -1
  1382. package/dist/settings-route-lifetime.js +15 -5
  1383. package/dist/settings-route-lifetime.js.map +1 -1
  1384. package/dist/settings-transaction.d.ts +3 -2
  1385. package/dist/settings-transaction.js.map +1 -1
  1386. package/dist/setup-form.js +10 -0
  1387. package/dist/setup-form.js.map +1 -1
  1388. package/dist/setup-host.d.ts +2 -3
  1389. package/dist/setup-host.js +3 -5
  1390. package/dist/setup-host.js.map +1 -1
  1391. package/dist/setup-i18n.js +2 -2
  1392. package/dist/setup-i18n.js.map +1 -1
  1393. package/dist/setup-wizard.js +0 -2
  1394. package/dist/setup-wizard.js.map +1 -1
  1395. package/dist/shared-default-adoption.d.ts +24 -0
  1396. package/dist/shared-default-adoption.js +73 -0
  1397. package/dist/shared-default-adoption.js.map +1 -0
  1398. package/dist/state-lease.d.ts +24 -0
  1399. package/dist/state-lease.js +103 -0
  1400. package/dist/state-lease.js.map +1 -0
  1401. package/dist/subagent-records.d.ts +2 -0
  1402. package/dist/subagent-records.js +64 -12
  1403. package/dist/subagent-records.js.map +1 -1
  1404. package/dist/subagent-service.d.ts +3 -0
  1405. package/dist/subagent-service.js +27 -5
  1406. package/dist/subagent-service.js.map +1 -1
  1407. package/dist/task-attach-client.d.ts +43 -0
  1408. package/dist/task-attach-client.js +125 -0
  1409. package/dist/task-attach-client.js.map +1 -0
  1410. package/dist/task-board-tool.d.ts +60 -0
  1411. package/dist/task-board-tool.js +216 -11
  1412. package/dist/task-board-tool.js.map +1 -1
  1413. package/dist/task-board-waker.d.ts +75 -31
  1414. package/dist/task-board-waker.js +311 -101
  1415. package/dist/task-board-waker.js.map +1 -1
  1416. package/dist/task-file-limits.d.ts +15 -0
  1417. package/dist/task-file-limits.js +21 -0
  1418. package/dist/task-file-limits.js.map +1 -0
  1419. package/dist/tips.js +4 -4
  1420. package/dist/tips.js.map +1 -1
  1421. package/dist/tmux-binary.js +1 -1
  1422. package/dist/tmux-binary.js.map +1 -1
  1423. package/dist/tmux-manager.d.ts +2 -0
  1424. package/dist/tmux-manager.js +2 -0
  1425. package/dist/tmux-manager.js.map +1 -1
  1426. package/dist/tool-permissions.d.ts +32 -0
  1427. package/dist/tool-permissions.js +68 -2
  1428. package/dist/tool-permissions.js.map +1 -1
  1429. package/dist/tool-progress.d.ts +9 -0
  1430. package/dist/tool-progress.js +141 -32
  1431. package/dist/tool-progress.js.map +1 -1
  1432. package/dist/tool-receipt-output.d.ts +8 -6
  1433. package/dist/topic-commands.d.ts +7 -1
  1434. package/dist/topic-commands.js +124 -92
  1435. package/dist/topic-commands.js.map +1 -1
  1436. package/dist/transcript-monitor.d.ts +7 -1
  1437. package/dist/transcript-monitor.js +79 -3
  1438. package/dist/transcript-monitor.js.map +1 -1
  1439. package/dist/transcript-turns.d.ts +3 -0
  1440. package/dist/transcript-turns.js +5 -0
  1441. package/dist/transcript-turns.js.map +1 -1
  1442. package/dist/tunnel/lease.d.ts +14 -0
  1443. package/dist/tunnel/lease.js +23 -0
  1444. package/dist/tunnel/lease.js.map +1 -1
  1445. package/dist/tunnel/named-link-test.d.ts +27 -0
  1446. package/dist/tunnel/named-link-test.js +41 -0
  1447. package/dist/tunnel/named-link-test.js.map +1 -1
  1448. package/dist/turn-reply-guard.d.ts +18 -3
  1449. package/dist/turn-reply-guard.js +23 -5
  1450. package/dist/turn-reply-guard.js.map +1 -1
  1451. package/dist/types.d.ts +50 -2
  1452. package/dist/ui/accounts-keepalive.js +4 -2
  1453. package/dist/ui/accounts-view.js +18 -9
  1454. package/dist/ui/agent-details-settings.js +11 -7
  1455. package/dist/ui/agent-export-dialog.js +4 -3
  1456. package/dist/ui/agent-export-strings.js +5 -5
  1457. package/dist/ui/agent-page-strings.js +23 -5
  1458. package/dist/ui/agent-who-can-use-strings.js +125 -0
  1459. package/dist/ui/agent-who-can-use.js +238 -0
  1460. package/dist/ui/app.html +2 -2
  1461. package/dist/ui/backend-signin.js +94 -23
  1462. package/dist/ui/chat-activity-groups.js +42 -9
  1463. package/dist/ui/chat-activity.js +24 -4
  1464. package/dist/ui/chat-commands.js +2 -0
  1465. package/dist/ui/chat-mentions.js +13 -0
  1466. package/dist/ui/chat-msg-actions.js +3 -222
  1467. package/dist/ui/chat-pins.js +107 -0
  1468. package/dist/ui/chat-popout-header.js +2 -2
  1469. package/dist/ui/chat-popout-transport.js +49 -19
  1470. package/dist/ui/chat-popout.js +15 -1
  1471. package/dist/ui/chat-quote.js +3 -261
  1472. package/dist/ui/chat-store.js +182 -19
  1473. package/dist/ui/chat-task-ref-strings.js +24 -0
  1474. package/dist/ui/chat-task-refs.js +131 -0
  1475. package/dist/ui/chat-tour.js +1 -1
  1476. package/dist/ui/chat-workspace.js +3 -3
  1477. package/dist/ui/claude-credentials.js +124 -0
  1478. package/dist/ui/claude-setup-token.js +36 -0
  1479. package/dist/ui/contact-auth-client.js +55 -0
  1480. package/dist/ui/contact-auth-strings.js +272 -0
  1481. package/dist/ui/contact-authorizations.js +159 -0
  1482. package/dist/ui/contact-grant-editor.js +110 -0
  1483. package/dist/ui/contact-needs.js +124 -0
  1484. package/dist/ui/contact-permissions.js +278 -0
  1485. package/dist/ui/contact-ticket-badge.js +54 -0
  1486. package/dist/ui/contact-tool-groups.js +39 -0
  1487. package/dist/ui/contact-verify-need.js +46 -0
  1488. package/dist/ui/fleet-cache.js +7 -6
  1489. package/dist/ui/fleet-canvas.js +21 -8
  1490. package/dist/ui/fleet-office-card.js +505 -45
  1491. package/dist/ui/fleet-office-carousel.d.ts +14 -0
  1492. package/dist/ui/fleet-office-carousel.js +95 -0
  1493. package/dist/ui/fleet-office-dialogue.d.ts +6 -3
  1494. package/dist/ui/fleet-office-dialogue.js +16 -6
  1495. package/dist/ui/fleet-office-editor.js +11 -6
  1496. package/dist/ui/fleet-office-layout.js +15 -15
  1497. package/dist/ui/fleet-office-model.js +5 -3
  1498. package/dist/ui/fleet-office-overview.js +1 -1
  1499. package/dist/ui/fleet-office-pack.d.ts +92 -5
  1500. package/dist/ui/fleet-office-pack.js +596 -50
  1501. package/dist/ui/fleet-office-play.js +498 -0
  1502. package/dist/ui/fleet-office-skin.js +360 -52
  1503. package/dist/ui/fleet-office-store.js +121 -5
  1504. package/dist/ui/fleet-office-talk.js +423 -0
  1505. package/dist/ui/fleet-office-vehicles.js +147 -0
  1506. package/dist/ui/fleet-office-view.js +58 -17
  1507. package/dist/ui/fleet-office-zones.js +174 -39
  1508. package/dist/ui/fleet-office.js +1462 -188
  1509. package/dist/ui/fleet-org.js +9 -4
  1510. package/dist/ui/fleet-route.js +44 -6
  1511. package/dist/ui/fleet-tab-icons.js +19 -0
  1512. package/dist/ui/fleet-task-activity.js +430 -0
  1513. package/dist/ui/fleet-task-archive.js +111 -0
  1514. package/dist/ui/fleet-task-card.js +386 -317
  1515. package/dist/ui/fleet-task-common.js +117 -13
  1516. package/dist/ui/fleet-task-create.js +67 -0
  1517. package/dist/ui/fleet-task-edit.js +211 -0
  1518. package/dist/ui/fleet-task-files.js +196 -0
  1519. package/dist/ui/fleet-task-flow.js +353 -0
  1520. package/dist/ui/fleet-task-follow.js +123 -0
  1521. package/dist/ui/fleet-task-md.js +98 -0
  1522. package/dist/ui/fleet-task-menu.js +2 -2
  1523. package/dist/ui/fleet-task-owner.js +252 -0
  1524. package/dist/ui/fleet-task-run.js +333 -0
  1525. package/dist/ui/fleet-task-sort.js +88 -0
  1526. package/dist/ui/fleet-task-stats.js +2 -2
  1527. package/dist/ui/fleet-task-thread.js +245 -0
  1528. package/dist/ui/fleet-task-unread.js +100 -0
  1529. package/dist/ui/fleet-task-view.js +221 -46
  1530. package/dist/ui/fleet-task-wake.js +140 -0
  1531. package/dist/ui/fleet-task-work.js +2 -2
  1532. package/dist/ui/fleet-tasks.js +336 -145
  1533. package/dist/ui/fleet-usage.js +8 -7
  1534. package/dist/ui/host-alerts.js +23 -0
  1535. package/dist/ui/host-footprint.js +17 -0
  1536. package/dist/ui/host-health-model.js +42 -0
  1537. package/dist/ui/host-health.js +82 -0
  1538. package/dist/ui/host-install.js +87 -7
  1539. package/dist/ui/host-monitoring-darwin.js +6 -0
  1540. package/dist/ui/host-monitoring-help.js +7 -0
  1541. package/dist/ui/host-monitoring-linux.js +6 -0
  1542. package/dist/ui/host-monitoring-wsl.js +6 -0
  1543. package/dist/ui/host-time.js +5 -0
  1544. package/dist/ui/hub-admin-overview.js +190 -0
  1545. package/dist/ui/hub-admin-rooms-strings.js +6 -2
  1546. package/dist/ui/hub-admin-rooms.js +4 -2
  1547. package/dist/ui/hub-agent-copy.js +8 -2
  1548. package/dist/ui/hub-agent-intro.js +36 -0
  1549. package/dist/ui/hub-ai-apps-strings.js +6 -0
  1550. package/dist/ui/hub-ai-apps.js +84 -0
  1551. package/dist/ui/hub-assistant-admin.js +2 -1
  1552. package/dist/ui/hub-attachments.js +81 -3
  1553. package/dist/ui/hub-chat-store.js +4 -3
  1554. package/dist/ui/hub-chat-strings.js +14 -4
  1555. package/dist/ui/hub-client.js +126 -12
  1556. package/dist/ui/hub-directory-editor-strings.js +2 -2
  1557. package/dist/ui/hub-directory-editor.js +1 -0
  1558. package/dist/ui/hub-directory-notices.js +2 -1
  1559. package/dist/ui/hub-enrolment-code.js +2 -1
  1560. package/dist/ui/hub-fleet-versions.js +393 -0
  1561. package/dist/ui/hub-grant-picker.js +28 -47
  1562. package/dist/ui/hub-group-policy.js +26 -13
  1563. package/dist/ui/hub-group-search.js +2 -2
  1564. package/dist/ui/hub-group-strings.js +28 -18
  1565. package/dist/ui/hub-intro-notice.js +16 -0
  1566. package/dist/ui/hub-invitations.js +5 -1
  1567. package/dist/ui/hub-join-steps.js +27 -15
  1568. package/dist/ui/hub-my-agents-model.js +42 -0
  1569. package/dist/ui/hub-my-agents-strings.js +20 -0
  1570. package/dist/ui/hub-my-agents.js +170 -0
  1571. package/dist/ui/hub-notify-keep.js +49 -0
  1572. package/dist/ui/hub-owner-strings.js +9 -8
  1573. package/dist/ui/hub-personal-agent-strings.js +246 -0
  1574. package/dist/ui/hub-personal-agent.js +119 -0
  1575. package/dist/ui/hub-policy-subjects.js +35 -0
  1576. package/dist/ui/hub-quick-pairing.js +9 -3
  1577. package/dist/ui/hub-quota.js +2 -1
  1578. package/dist/ui/hub-role-audit.js +40 -0
  1579. package/dist/ui/hub-role-forms.js +100 -0
  1580. package/dist/ui/hub-role-notices.js +11 -0
  1581. package/dist/ui/hub-role-view.js +87 -0
  1582. package/dist/ui/hub-roles-strings.js +444 -0
  1583. package/dist/ui/hub-roles.js +84 -0
  1584. package/dist/ui/hub-room-agent-strings.js +29 -0
  1585. package/dist/ui/hub-room-composer.js +174 -17
  1586. package/dist/ui/hub-room-list.js +8 -5
  1587. package/dist/ui/hub-room-members-strings.js +11 -4
  1588. package/dist/ui/hub-room-members.js +134 -18
  1589. package/dist/ui/hub-room-new-strings.js +2 -1
  1590. package/dist/ui/hub-room-new.js +17 -7
  1591. package/dist/ui/hub-room-notify.js +162 -0
  1592. package/dist/ui/hub-room-office.js +271 -0
  1593. package/dist/ui/hub-room-owner-requests-strings.js +114 -0
  1594. package/dist/ui/hub-room-owner-requests.js +265 -0
  1595. package/dist/ui/hub-room-pins.js +44 -0
  1596. package/dist/ui/hub-room-presence.js +19 -2
  1597. package/dist/ui/hub-room-purpose.js +35 -0
  1598. package/dist/ui/hub-room-search.js +126 -0
  1599. package/dist/ui/hub-room-settings-strings.js +8 -0
  1600. package/dist/ui/hub-room-settings.js +110 -3
  1601. package/dist/ui/hub-room-source-strings.js +17 -0
  1602. package/dist/ui/hub-room-source.js +37 -0
  1603. package/dist/ui/hub-room-strings.js +102 -7
  1604. package/dist/ui/hub-room-thread.js +522 -69
  1605. package/dist/ui/hub-room-unread.js +2 -1
  1606. package/dist/ui/hub-room-working.js +37 -0
  1607. package/dist/ui/hub-session-limits.js +79 -0
  1608. package/dist/ui/hub-strings.js +23 -10
  1609. package/dist/ui/hub-subject-picker.js +58 -0
  1610. package/dist/ui/hub-switcher.js +2 -2
  1611. package/dist/ui/hub-teams-strings.js +10 -6
  1612. package/dist/ui/hub-teams.js +58 -29
  1613. package/dist/ui/hub-this-hub.js +2 -2
  1614. package/dist/ui/hub-welcome.js +122 -75
  1615. package/dist/ui/icons/hub-apple-touch-icon.png +0 -0
  1616. package/dist/ui/icons/hub-favicon.ico +0 -0
  1617. package/dist/ui/icons/hub-favicon.svg +10 -0
  1618. package/dist/ui/icons/hub-icon-192.png +0 -0
  1619. package/dist/ui/icons/hub-icon-512.png +0 -0
  1620. package/dist/ui/icons/hub-icon-maskable-192.png +0 -0
  1621. package/dist/ui/icons/hub-icon-maskable-512.png +0 -0
  1622. package/dist/ui/icons/hub-maskable.svg +12 -0
  1623. package/dist/ui/image-annotate.js +2 -283
  1624. package/dist/ui/image-lightbox.js +2 -176
  1625. package/dist/ui/image-zoom.js +2 -242
  1626. package/dist/ui/log-row.js +11 -8
  1627. package/dist/ui/model-picker.js +7 -3
  1628. package/dist/ui/native-instance-settings.js +4 -2
  1629. package/dist/ui/notice-hub-sharing.js +81 -0
  1630. package/dist/ui/notice-hub-update.js +94 -0
  1631. package/dist/ui/office-share-dialog.js +4 -3
  1632. package/dist/ui/office-share-page.js +7 -2
  1633. package/dist/ui/page-share-dialog.js +3 -2
  1634. package/dist/ui/panel-chat.js +515 -81
  1635. package/dist/ui/panel-details.js +27 -3
  1636. package/dist/ui/panel-fleet.js +61 -21
  1637. package/dist/ui/panel-hub.js +478 -135
  1638. package/dist/ui/panel-log.js +7 -7
  1639. package/dist/ui/panel-needs.js +139 -28
  1640. package/dist/ui/panel-notices.js +6 -2
  1641. package/dist/ui/panel-runtimes.js +6 -4
  1642. package/dist/ui/panel-settings.js +150 -61
  1643. package/dist/ui/panel-windows-cli.js +4 -3
  1644. package/dist/ui/preview-panel.js +3 -1
  1645. package/dist/ui/preview-popout.js +134 -0
  1646. package/dist/ui/reply-file-preview.js +65 -0
  1647. package/dist/ui/request-contact-card.js +287 -0
  1648. package/dist/ui/request-contact-client.js +83 -0
  1649. package/dist/ui/request-contact-page.js +78 -0
  1650. package/dist/ui/request-context-control.js +209 -0
  1651. package/dist/ui/runtime-cli-install.js +3 -2
  1652. package/dist/ui/runtime-commands.d.ts +2 -2
  1653. package/dist/ui/runtime-commands.js +7 -4
  1654. package/dist/ui/runtime-update-status.js +1 -1
  1655. package/dist/ui/search-dialog.js +8 -1
  1656. package/dist/ui/settings-access-overview.js +5 -4
  1657. package/dist/ui/settings-access-strings.js +1 -1
  1658. package/dist/ui/settings-appearance.js +15 -12
  1659. package/dist/ui/settings-apply.js +8 -3
  1660. package/dist/ui/settings-archive-files.js +109 -0
  1661. package/dist/ui/settings-build-version.js +2 -2
  1662. package/dist/ui/settings-capabilities.js +2 -0
  1663. package/dist/ui/settings-catalog.js +22 -0
  1664. package/dist/ui/settings-connector-strings.js +23 -0
  1665. package/dist/ui/settings-connector.js +40 -0
  1666. package/dist/ui/settings-default-model-scope.js +40 -0
  1667. package/dist/ui/settings-default-model-strings.js +43 -0
  1668. package/dist/ui/settings-dialogs.js +9 -5
  1669. package/dist/ui/settings-guests-entries.js +16 -0
  1670. package/dist/ui/settings-guests.js +61 -18
  1671. package/dist/ui/settings-host-alerts.js +23 -0
  1672. package/dist/ui/settings-host-monitoring.js +71 -0
  1673. package/dist/ui/settings-hub-connection.js +6 -7
  1674. package/dist/ui/settings-hub-member-address.js +2 -1
  1675. package/dist/ui/settings-hub-membership.js +6 -7
  1676. package/dist/ui/settings-hub-page-sharing.js +52 -0
  1677. package/dist/ui/settings-hub-section.js +2 -4
  1678. package/dist/ui/settings-hub-setup-strings.js +1 -1
  1679. package/dist/ui/settings-hub-setup.js +4 -2
  1680. package/dist/ui/settings-hub-updates.js +67 -0
  1681. package/dist/ui/settings-hub-web-address.js +2 -1
  1682. package/dist/ui/settings-hub.js +37 -8
  1683. package/dist/ui/settings-layout.js +18 -15
  1684. package/dist/ui/settings-model.js +9 -5
  1685. package/dist/ui/settings-named-test.js +16 -16
  1686. package/dist/ui/settings-preview-address.js +156 -0
  1687. package/dist/ui/settings-public-session-strings.js +2 -2
  1688. package/dist/ui/settings-quota-notice.js +3 -3
  1689. package/dist/ui/settings-registry.js +32 -5
  1690. package/dist/ui/settings-revoke-strings.js +1 -1
  1691. package/dist/ui/settings-shared-strings.js +35 -2
  1692. package/dist/ui/settings-shared.js +67 -14
  1693. package/dist/ui/settings-strings.js +58 -49
  1694. package/dist/ui/settings-update.js +28 -7
  1695. package/dist/ui/settings-web-authority.js +9 -6
  1696. package/dist/ui/shared/access-overview.css +2 -2
  1697. package/dist/ui/shared/accounts-keepalive.css +1 -1
  1698. package/dist/ui/shared/accounts.css +9 -5
  1699. package/dist/ui/shared/agent-sheet.js +121 -0
  1700. package/dist/ui/shared/agent-widget.js +1 -2
  1701. package/dist/ui/shared/app-i18n.js +12 -4
  1702. package/dist/ui/shared/app-install.js +123 -0
  1703. package/dist/ui/shared/app-nav.js +9 -5
  1704. package/dist/ui/shared/app-needs.js +8 -1
  1705. package/dist/ui/shared/app-prefs.js +9 -3
  1706. package/dist/ui/shared/app-route.js +5 -3
  1707. package/dist/ui/shared/app-session.js +4 -3
  1708. package/dist/ui/shared/app-shell.js +218 -46
  1709. package/dist/ui/shared/app-store.js +7 -3
  1710. package/dist/ui/shared/app-stream.js +11 -2
  1711. package/dist/ui/shared/app-swipe.js +3 -1
  1712. package/dist/ui/shared/app-themes.js +3 -5
  1713. package/dist/ui/shared/app-update.js +107 -10
  1714. package/dist/ui/shared/app.css +1398 -275
  1715. package/dist/ui/shared/app.js +34 -5
  1716. package/dist/ui/shared/asset-url.d.ts +2 -0
  1717. package/dist/ui/shared/asset-url.js +20 -0
  1718. package/dist/ui/shared/chat-composer.js +30 -8
  1719. package/dist/ui/shared/chat-msg-actions.js +233 -0
  1720. package/dist/ui/shared/chat-quote.js +285 -0
  1721. package/dist/ui/shared/chat-render.js +63 -10
  1722. package/dist/ui/shared/chat-strings.js +49 -24
  1723. package/dist/ui/shared/chat-table-select.js +175 -0
  1724. package/dist/ui/shared/chat-thread.js +181 -29
  1725. package/dist/ui/shared/chat-time.js +7 -4
  1726. package/dist/ui/shared/chat-work-bar.css +97 -15
  1727. package/dist/ui/shared/clock-text.js +57 -0
  1728. package/dist/ui/shared/composer-focus.js +21 -0
  1729. package/dist/ui/shared/connector-prompt.d.ts +3 -0
  1730. package/dist/ui/shared/connector-prompt.js +20 -0
  1731. package/dist/ui/shared/device-roles.js +6 -5
  1732. package/dist/ui/shared/hub-ai-apps.css +12 -0
  1733. package/dist/ui/shared/hub-chat.css +114 -4
  1734. package/dist/ui/shared/hub-groups.css +19 -15
  1735. package/dist/ui/shared/hub-my-agents.css +41 -0
  1736. package/dist/ui/shared/hub-owner.css +123 -3
  1737. package/dist/ui/shared/hub-roles.css +99 -0
  1738. package/dist/ui/shared/hub-rooms-u2.css +98 -0
  1739. package/dist/ui/shared/hub-signin.css +2 -0
  1740. package/dist/ui/shared/hub.css +23 -5
  1741. package/dist/ui/shared/image-annotate.css +22 -3
  1742. package/dist/ui/shared/image-annotate.js +416 -0
  1743. package/dist/ui/shared/image-lightbox.js +218 -0
  1744. package/dist/ui/shared/image-zoom.js +316 -0
  1745. package/dist/ui/shared/info-tip.js +64 -0
  1746. package/dist/ui/shared/instance-nav.js +197 -21
  1747. package/dist/ui/shared/jump-idle.js +36 -0
  1748. package/dist/ui/shared/loading.css +1 -1
  1749. package/dist/ui/shared/model-picker.css +28 -1
  1750. package/dist/ui/shared/module-warm.d.ts +3 -0
  1751. package/dist/ui/shared/module-warm.js +39 -0
  1752. package/dist/ui/shared/office-dialogue.css +122 -0
  1753. package/dist/ui/shared/owner-css.js +1 -1
  1754. package/dist/ui/shared/panel-view.js +7 -1
  1755. package/dist/ui/shared/preview-panel-actions.js +1 -1
  1756. package/dist/ui/shared/preview-panel.js +51 -21
  1757. package/dist/ui/shared/preview-popout.css +11 -0
  1758. package/dist/ui/shared/preview.js +11 -2
  1759. package/dist/ui/shared/reply-previews.css +4 -0
  1760. package/dist/ui/shared/runtime-install.css +5 -0
  1761. package/dist/ui/shared/settings-connector.css +7 -0
  1762. package/dist/ui/shared/signin.js +27 -12
  1763. package/dist/ui/shared/task-board.css +733 -11
  1764. package/dist/ui/shared/text-undo.js +17 -3
  1765. package/dist/ui/shared/theme-picker.js +46 -0
  1766. package/dist/ui/shared/theme.js +101 -2
  1767. package/dist/ui/shared/tokens.css +318 -13
  1768. package/dist/ui/shared/ui-confirm.js +10 -5
  1769. package/dist/ui/shared/ui-icons.js +7 -0
  1770. package/dist/ui/shared/ui-menu.js +17 -11
  1771. package/dist/ui/shared/ui-states.js +9 -2
  1772. package/dist/ui/shared/ui-toast.js +4 -4
  1773. package/dist/ui/shared/update-card-ui.js +586 -0
  1774. package/dist/ui/shared/usage-dialog.js +90 -18
  1775. package/dist/ui/shared/view-history.js +2 -1
  1776. package/dist/ui/shared/view-strings.js +57 -13
  1777. package/dist/ui/shared/web-authorize.js +6 -5
  1778. package/dist/ui/shared/workspace.css +7 -0
  1779. package/dist/ui/signin.html +4 -2
  1780. package/dist/ui/structured-signin.js +64 -12
  1781. package/dist/ui/subagent-row.js +5 -3
  1782. package/dist/ui/task-unread.js +70 -0
  1783. package/dist/ui/trigger-complete.js +71 -0
  1784. package/dist/ui/usage-credits-card.js +84 -0
  1785. package/dist/ui/usage-pool.js +2 -1
  1786. package/dist/ui/web-terminal/terminal.css +1 -1
  1787. package/dist/ui/windows-cli-catalog.js +33 -6
  1788. package/dist/ui/workspace-ignored-strings.js +16 -0
  1789. package/dist/ui/workspace-panel.js +21 -10
  1790. package/dist/update-abandon.d.ts +26 -0
  1791. package/dist/update-abandon.js +111 -0
  1792. package/dist/update-abandon.js.map +1 -0
  1793. package/dist/update-card.d.ts +193 -0
  1794. package/dist/update-card.js +620 -0
  1795. package/dist/update-card.js.map +1 -0
  1796. package/dist/update-dispatch.d.ts +24 -2
  1797. package/dist/update-dispatch.js +28 -5
  1798. package/dist/update-dispatch.js.map +1 -1
  1799. package/dist/update-fix.d.ts +66 -0
  1800. package/dist/update-fix.js +67 -0
  1801. package/dist/update-fix.js.map +1 -0
  1802. package/dist/update-forward.d.ts +59 -0
  1803. package/dist/update-forward.js +227 -0
  1804. package/dist/update-forward.js.map +1 -0
  1805. package/dist/update-goback.d.ts +90 -0
  1806. package/dist/update-goback.js +272 -0
  1807. package/dist/update-goback.js.map +1 -0
  1808. package/dist/update-idle.d.ts +66 -0
  1809. package/dist/update-idle.js +199 -0
  1810. package/dist/update-idle.js.map +1 -0
  1811. package/dist/update-install.d.ts +2 -1
  1812. package/dist/update-install.js +18 -10
  1813. package/dist/update-install.js.map +1 -1
  1814. package/dist/update-journal.d.ts +359 -0
  1815. package/dist/update-journal.js +723 -0
  1816. package/dist/update-journal.js.map +1 -0
  1817. package/dist/update-launch.d.ts +1 -1
  1818. package/dist/update-launch.js +10 -3
  1819. package/dist/update-launch.js.map +1 -1
  1820. package/dist/update-npm-env.d.ts +45 -12
  1821. package/dist/update-npm-env.js +48 -0
  1822. package/dist/update-npm-env.js.map +1 -1
  1823. package/dist/update-package-restore.d.ts +84 -0
  1824. package/dist/update-package-restore.js +329 -0
  1825. package/dist/update-package-restore.js.map +1 -0
  1826. package/dist/update-quiescence.d.ts +221 -0
  1827. package/dist/update-quiescence.js +370 -0
  1828. package/dist/update-quiescence.js.map +1 -0
  1829. package/dist/update-readiness-host.d.ts +61 -0
  1830. package/dist/update-readiness-host.js +297 -0
  1831. package/dist/update-readiness-host.js.map +1 -0
  1832. package/dist/update-readiness.d.ts +85 -0
  1833. package/dist/update-readiness.js +463 -0
  1834. package/dist/update-readiness.js.map +1 -0
  1835. package/dist/update-recovery/kit.d.ts +35 -0
  1836. package/dist/update-recovery/kit.js +99 -0
  1837. package/dist/update-recovery/kit.js.map +1 -0
  1838. package/dist/update-recovery/pre-start.d.ts +34 -0
  1839. package/dist/update-recovery/pre-start.js +103 -0
  1840. package/dist/update-recovery/pre-start.js.map +1 -0
  1841. package/dist/update-recovery/recover-main.d.ts +1 -0
  1842. package/dist/update-recovery/recover-main.js +4 -0
  1843. package/dist/update-recovery/recover-main.js.map +1 -0
  1844. package/dist/update-recovery/recover.d.ts +22 -0
  1845. package/dist/update-recovery/recover.js +134 -0
  1846. package/dist/update-recovery/recover.js.map +1 -0
  1847. package/dist/update-recovery/route.d.ts +53 -0
  1848. package/dist/update-recovery/route.js +262 -0
  1849. package/dist/update-recovery/route.js.map +1 -0
  1850. package/dist/update-recovery/runner.d.ts +62 -0
  1851. package/dist/update-recovery/runner.js +229 -0
  1852. package/dist/update-recovery/runner.js.map +1 -0
  1853. package/dist/update-recovery/service-manager.d.ts +39 -0
  1854. package/dist/update-recovery/service-manager.js +57 -0
  1855. package/dist/update-recovery/service-manager.js.map +1 -0
  1856. package/dist/update-restore.d.ts +50 -0
  1857. package/dist/update-restore.js +360 -0
  1858. package/dist/update-restore.js.map +1 -0
  1859. package/dist/update-retained.d.ts +65 -0
  1860. package/dist/update-retained.js +116 -0
  1861. package/dist/update-retained.js.map +1 -0
  1862. package/dist/update-rollback.d.ts +74 -0
  1863. package/dist/update-rollback.js +221 -0
  1864. package/dist/update-rollback.js.map +1 -0
  1865. package/dist/update-settings.d.ts +63 -0
  1866. package/dist/update-settings.js +162 -0
  1867. package/dist/update-settings.js.map +1 -0
  1868. package/dist/update-snapshot-manifest.d.ts +32 -0
  1869. package/dist/update-snapshot-manifest.js +65 -0
  1870. package/dist/update-snapshot-manifest.js.map +1 -0
  1871. package/dist/update-snapshot-scope.d.ts +67 -0
  1872. package/dist/update-snapshot-scope.js +174 -0
  1873. package/dist/update-snapshot-scope.js.map +1 -0
  1874. package/dist/update-snapshot.d.ts +34 -0
  1875. package/dist/update-snapshot.js +246 -0
  1876. package/dist/update-snapshot.js.map +1 -0
  1877. package/dist/update-writers.d.ts +71 -0
  1878. package/dist/update-writers.js +235 -0
  1879. package/dist/update-writers.js.map +1 -0
  1880. package/dist/usage/i18n-keys.d.ts +1 -1
  1881. package/dist/usage/i18n-keys.js +10 -1
  1882. package/dist/usage/i18n-keys.js.map +1 -1
  1883. package/dist/usage/profile-timeline.d.ts +2 -0
  1884. package/dist/usage/profile-timeline.js +4 -0
  1885. package/dist/usage/profile-timeline.js.map +1 -1
  1886. package/dist/usage/providers.d.ts +4 -11
  1887. package/dist/usage/providers.js +109 -134
  1888. package/dist/usage/providers.js.map +1 -1
  1889. package/dist/usage/usage-api.js +5 -2
  1890. package/dist/usage/usage-api.js.map +1 -1
  1891. package/dist/wake-coordinator.js +3 -2
  1892. package/dist/wake-coordinator.js.map +1 -1
  1893. package/dist/web-api.d.ts +132 -9
  1894. package/dist/web-api.js +1468 -242
  1895. package/dist/web-api.js.map +1 -1
  1896. package/dist/web-asset-version.d.ts +65 -0
  1897. package/dist/web-asset-version.js +259 -0
  1898. package/dist/web-asset-version.js.map +1 -0
  1899. package/dist/web-backend-login.d.ts +5 -1
  1900. package/dist/web-backend-login.js +8 -2
  1901. package/dist/web-backend-login.js.map +1 -1
  1902. package/dist/web-chat-archive.d.ts +147 -0
  1903. package/dist/web-chat-archive.js +530 -0
  1904. package/dist/web-chat-archive.js.map +1 -0
  1905. package/dist/web-chat-history.d.ts +137 -2
  1906. package/dist/web-chat-history.js +335 -12
  1907. package/dist/web-chat-history.js.map +1 -1
  1908. package/dist/web-claude-credentials.d.ts +31 -0
  1909. package/dist/web-claude-credentials.js +138 -0
  1910. package/dist/web-claude-credentials.js.map +1 -0
  1911. package/dist/web-commands.d.ts +9 -5
  1912. package/dist/web-commands.js +7 -4
  1913. package/dist/web-commands.js.map +1 -1
  1914. package/dist/web-guest-access.d.ts +3 -0
  1915. package/dist/web-guest-access.js +8 -4
  1916. package/dist/web-guest-access.js.map +1 -1
  1917. package/dist/web-host-guard.js +3 -1
  1918. package/dist/web-host-guard.js.map +1 -1
  1919. package/dist/web-host-install.d.ts +30 -3
  1920. package/dist/web-host-install.js +50 -4
  1921. package/dist/web-host-install.js.map +1 -1
  1922. package/dist/web-icons.d.ts +20 -3
  1923. package/dist/web-icons.js +79 -10
  1924. package/dist/web-icons.js.map +1 -1
  1925. package/dist/web-login.d.ts +13 -1
  1926. package/dist/web-login.js +16 -4
  1927. package/dist/web-login.js.map +1 -1
  1928. package/dist/web-mentions.d.ts +29 -8
  1929. package/dist/web-mentions.js +128 -1
  1930. package/dist/web-mentions.js.map +1 -1
  1931. package/dist/web-notices.d.ts +20 -0
  1932. package/dist/web-notices.js +64 -8
  1933. package/dist/web-notices.js.map +1 -1
  1934. package/dist/web-office-acts.d.ts +16 -0
  1935. package/dist/web-office-acts.js +30 -9
  1936. package/dist/web-office-acts.js.map +1 -1
  1937. package/dist/web-office-pack-read.js +1 -1
  1938. package/dist/web-office-pack-read.js.map +1 -1
  1939. package/dist/web-office-skins.d.ts +19 -6
  1940. package/dist/web-office-skins.js +85 -36
  1941. package/dist/web-office-skins.js.map +1 -1
  1942. package/dist/web-office-store.d.ts +2 -0
  1943. package/dist/web-office-store.js +20 -6
  1944. package/dist/web-office-store.js.map +1 -1
  1945. package/dist/web-pin-store.d.ts +58 -0
  1946. package/dist/web-pin-store.js +170 -0
  1947. package/dist/web-pin-store.js.map +1 -0
  1948. package/dist/web-prefs.js +5 -1
  1949. package/dist/web-prefs.js.map +1 -1
  1950. package/dist/web-preview.d.ts +5 -0
  1951. package/dist/web-preview.js +1 -1
  1952. package/dist/web-preview.js.map +1 -1
  1953. package/dist/web-reply-files.d.ts +1 -0
  1954. package/dist/web-reply-files.js +2 -0
  1955. package/dist/web-reply-files.js.map +1 -1
  1956. package/dist/web-session-authorization.d.ts +27 -0
  1957. package/dist/web-session-authorization.js +32 -0
  1958. package/dist/web-session-authorization.js.map +1 -1
  1959. package/dist/web-session.d.ts +26 -5
  1960. package/dist/web-session.js +32 -3
  1961. package/dist/web-session.js.map +1 -1
  1962. package/dist/web-settings-patch.d.ts +51 -3
  1963. package/dist/web-settings-patch.js +124 -1
  1964. package/dist/web-settings-patch.js.map +1 -1
  1965. package/dist/web-shell-routes.d.ts +2 -2
  1966. package/dist/web-shell-routes.js +3 -2
  1967. package/dist/web-shell-routes.js.map +1 -1
  1968. package/dist/web-terminal.d.ts +9 -0
  1969. package/dist/web-terminal.js +27 -1
  1970. package/dist/web-terminal.js.map +1 -1
  1971. package/dist/web-theme.js +2 -2
  1972. package/dist/web-update.d.ts +30 -1
  1973. package/dist/web-upload.d.ts +37 -1
  1974. package/dist/web-upload.js +105 -5
  1975. package/dist/web-upload.js.map +1 -1
  1976. package/dist/windows-agents.d.ts +36 -2
  1977. package/dist/windows-agents.js +115 -4
  1978. package/dist/windows-agents.js.map +1 -1
  1979. package/dist/windows-cli-api.d.ts +10 -7
  1980. package/dist/windows-cli-api.js +17 -14
  1981. package/dist/windows-cli-api.js.map +1 -1
  1982. package/dist/windows-cli-worker.d.ts +10 -0
  1983. package/dist/windows-cli-worker.js +118 -15
  1984. package/dist/windows-cli-worker.js.map +1 -1
  1985. package/dist/windows-cli.d.ts +65 -2
  1986. package/dist/windows-cli.js +192 -28
  1987. package/dist/windows-cli.js.map +1 -1
  1988. package/dist/windows-native-mcp.js +5 -2
  1989. package/dist/windows-native-mcp.js.map +1 -1
  1990. package/dist/windows-shortcuts.d.ts +3 -22
  1991. package/dist/windows-shortcuts.js +5 -45
  1992. package/dist/windows-shortcuts.js.map +1 -1
  1993. package/dist/workflow-templates/default.md +8 -8
  1994. package/dist/wsl-host.d.ts +52 -0
  1995. package/dist/wsl-host.js +97 -0
  1996. package/dist/wsl-host.js.map +1 -0
  1997. package/launcher/agend +4 -1
  1998. package/launcher/agend-agent +4 -1
  1999. package/launcher/agend-install.cjs +63 -14
  2000. package/launcher/install-admission.d.cts +8 -0
  2001. package/launcher/npm-allow-scripts.cjs +72 -0
  2002. package/launcher/npm-global-prefix.cjs +81 -0
  2003. package/launcher/postinstall.cjs +9 -8
  2004. package/launcher/runtime-select.cjs +8 -2
  2005. package/package.json +4 -3
  2006. package/scripts/preinstall-guard.cjs +1 -1
  2007. package/templates/runtime-install/install.ps1 +24 -4
package/dist/daemon.js CHANGED
@@ -1,5 +1,20 @@
1
+ import { RequestContextPendingReplies } from "./request-context-reply-pending.js";
2
+ import { expandCompositeCall as expandReplyWaitCall } from "./channel/mcp-tools.js";
3
+ import { RequestContextHelperAdmission } from "./request-context-helper.js";
4
+ import { requestContextDigest } from "./request-context-store.js";
5
+ import { RequestContextPendingWork } from "./request-context-pending-work.js";
6
+ import { requestContextProcessGroupGone } from "./request-context-retirement.js";
7
+ import { ReplyDraft } from "./reply-draft.js";
8
+ import { requireRequestContextPolicy, requestContextInstructionMode } from "./request-context-policy.js";
9
+ import { RequestContextReferenceMap } from "./request-context-fence.js";
10
+ import { managedClaudeBinding } from "./claude-credential-launch.js";
11
+ import { HUB_REPORT_TARGET } from "./hub-report-target.js";
12
+ import { atomicWriteFileSync } from "./atomic-write.js";
13
+ import { RoomConversationGeneration, roomContextInputMarker } from "./hub-room-conversation.js";
1
14
  import { checkpointGrokDelivery } from "./grok-delivery-proof.js";
2
15
  import { nativePaneToolRefusal } from "./native-pane-tools.js";
16
+ import { classicGuardInventory, classicPlanDigest, invalidateClassicGuard } from "./classic-cli-guard.js";
17
+ import { CLASSIC_RESTRICTED_TOOLS } from "./contact-auth-types.js";
3
18
  import { generalByName } from "./general-instance.js";
4
19
  import { ClaudeModelObserver, normalizeClaudeModel } from "./claude-model-observation.js";
5
20
  import { codexMetadataHomes } from "./backend/codex-metadata.js";
@@ -15,6 +30,7 @@ import { join, dirname, basename, resolve } from "node:path";
15
30
  import { checkoutTarget, readCheckouts, releaseCandidate, reposRoot, verifyWorktree, writeCheckouts } from "./repo-worktree-guard.js";
16
31
  import { mkdirSync, writeFileSync, readFileSync, readdirSync, existsSync, unlinkSync, rmSync, appendFileSync, statSync, renameSync } from "node:fs";
17
32
  import { COMPACT_WATCH_TIMEOUT_MS, launchIdentity } from "./compact-watch.js";
33
+ import { TurnWatch } from "./dispatcher-liveness.js";
18
34
  import { KIRO_COMPACT_PANE_LINES, KiroCompactPaneFollower } from "./kiro-compact-pane.js";
19
35
  import { clearKiroSessionProof, proveKiroSessionId, recordKiroSessionProof } from "./kiro-session-proof.js";
20
36
  import { fileURLToPath } from "node:url";
@@ -43,6 +59,7 @@ import { legacyTmuxSocket, tmuxSocket } from "./tmux-binary.js";
43
59
  import { migrateLegacyWindow, tagWindowId } from "./tmux-legacy.js";
44
60
  import { scopedFleetConfigEnvironment } from "./web-experimental.js";
45
61
  import { readAgentFile } from "./agent-file-read.js";
62
+ import { sendTaskWrite } from "./task-attach-client.js";
46
63
  import { ASSET_UPLOAD_MAX_BYTES, receivePreview, sendAssetInParts, writePreview } from "./web-asset-parts.js";
47
64
  import { LOGIN_FLOWS } from "./login-flows.js";
48
65
  import { ProgressAccumulator, isSearchProgram, summarizeProgress } from "./tool-progress.js";
@@ -52,6 +69,7 @@ import { ContextGuardian } from "./context-guardian.js";
52
69
  import { IpcServer } from "./channel/ipc-bridge.js";
53
70
  import { daemonBudgetMs } from "./channel/ipc-timeouts.js";
54
71
  import { MessageBus } from "./channel/message-bus.js";
72
+ import { captureRequestContextCall } from "./request-context-call.js";
55
73
  import { shellQuote, KiroCompatibilityError, UnsupportedCliError, ResumeBlockedError } from "./backend/types.js";
56
74
  import { getTmuxSession } from "./config.js";
57
75
  import { routeToolCall } from "./channel/tool-router.js";
@@ -62,7 +80,7 @@ import { PaneWriteLock } from "./pane-write-lock.js";
62
80
  import { answerRemoteCard } from "./remote-card-answer.js";
63
81
  import { tmuxPaneHost } from "./tmux-pane-host.js";
64
82
  import { buildFleetInstructions, INBOUND_HEADER_RULE } from "./instructions.js";
65
- import { formatHumanInboundMessage, prepareDeliveryWire, steerInboundEnvelope, BTW_INBOUND_PREFIX, humanBodyHash, humanOwnerObjectId } from "./human-delivery-receipts.js";
83
+ import { formatHumanInboundMessage, prepareDeliveryWire, steerInboundEnvelope, btwInboundEnvelope, humanBodyHash, humanOwnerObjectId } from "./human-delivery-receipts.js";
66
84
  import { formatCrossInstanceInboundMessage, renderCrossInstanceHandoffMetadata, } from "./cross-instance-envelope.js";
67
85
  import { agendMessageInInput, bottomRowIsReady, inputAreaText, inputShowsPastedText, pastedTextSignature, pasteLeftInInput, strandedAgendMessageInInput } from "./pane-input-residue.js";
68
86
  import { TurnReplyGuard, formatReplyDropDetection, turnExpectsPersonReply } from "./turn-reply-guard.js";
@@ -79,10 +97,13 @@ import { QUEUED_HANDOFF_MAX_REDELIVERIES, QueuedHandoffStore } from "./queued-ha
79
97
  import { measureSyncWork, noteSyncWork } from "./sync-work-attribution.js";
80
98
  import { TranscriptDeltaReader } from "./transcript-delta-reader.js";
81
99
  import { checkpointCodexPane } from "./codex-pane-ownership.js";
100
+ import { codexAppliedFromRollout, codexRunningVersion, codexSupportsInlineModel, codexSwitchAnswerCount, codexSwitchFromPane, readFrom } from "./backend/codex-model-switch.js";
101
+ import { CLI_RUNTIME_SWITCH, cliRunningVersion, cliSwitchAllowed } from "./backend/cli-runtime-switch.js";
82
102
  import { buildResumeContinuation, clearInFlightTurnMarker, consumeInFlightTurnMarker, decideTurnResume, normalizeResumeBackend, readResumeFingerprint, RESUME_BLOCKING_DELIVERY_STATES, writeInFlightTurnMarker, } from "./turn-resume.js";
83
103
  import { codexLiveRowMatches } from "./backend/codex.js";
84
104
  import { codexPackageProblemMessage } from "./backend/codex-package.js";
85
- import { claudeConfigDirFor, claudeProfileConfigDir, claudeProjectKey, claudeSwitchDialog, claudeSwitchTargetMatches } from "./backend/claude-code.js";
105
+ import { claudeConfigDirFor, claudeJsonPath, claudeProfileConfigDir, claudeProjectKey, claudeSwitchDialog, claudeSwitchTargetMatches } from "./backend/claude-code.js";
106
+ import { checkClaudeMcpAtLaunch, dismissClaudeMcpMissing } from "./backend/claude-mcp-carry.js";
86
107
  import { MuseBackend } from "./backend/muse.js";
87
108
  import { BACKEND_LABELS, InteractionObservation, INTERACTION_CONFIRM_MS, sameInteractionOwner } from "./interaction-observation.js";
88
109
  import { unrecognisedPromptShape } from "./unrecognised-prompt.js";
@@ -109,7 +130,7 @@ const WEB_THEME_IPC = Object.freeze({
109
130
  });
110
131
  /** The largest picture any slot may take (a card slot's ceiling; the fleet checks the limit in force): read no more. */
111
132
  const WEB_THEME_ASSET_MAX_BYTES = ASSET_UPLOAD_MAX_BYTES;
112
- const CROSS_INSTANCE_TOOLS = new Set(["send_to_instance", "broadcast", "list_instances", "start_instance", "restart_instance", "create_instance", "delete_instance", "replace_instance", "request_information", "delegate_task", "report_result", "delivery_status", "describe_instance"]);
133
+ const CROSS_INSTANCE_TOOLS = new Set(["hub_set_intro", "hub_room_status", "hub_room_list", "hub_room_post", "hub_room_history", "hub_room_members", "hub_people_search", "send_to_instance", "broadcast", "list_instances", "start_instance", "restart_instance", "create_instance", "delete_instance", "replace_instance", "request_information", "delegate_task", "report_result", "delivery_status", "describe_instance"]);
113
134
  const SCHEDULE_TOOLS = new Set(["create_schedule", "list_schedules", "update_schedule", "delete_schedule"]);
114
135
  const DECISION_TOOLS = new Set(["post_decision", "list_decisions", "update_decision"]);
115
136
  const TASK_TOOL = "task";
@@ -155,6 +176,10 @@ export const DEFAULT_STATE_IDLE_DEBOUNCE_MS = 2_000;
155
176
  export const DEFAULT_STATE_SAFETY_SWEEP_MS = 60_000;
156
177
  /** Coalesce one cosmetic-redraw burst before comparing the visible pane. */
157
178
  export const PERIODIC_REDRAW_PROBE_MS = 25;
179
+ /** M-3239: a turn's progress reaches the fleet at most this often while it runs. */
180
+ const TURN_ACTIVITY_REPORT_MS = 30_000;
181
+ /** M-3239: after the idle edge, the transcript's last lines (the final answer) are read within this. */
182
+ const TURN_END_SETTLE_MS = 5_000;
158
183
  /** Board 907c7899: how often a kiro /compact's pane is read (TUI V2's "too short" shows for about ten seconds). */
159
184
  const KIRO_COMPACT_PANE_POLL_MS = 1_000;
160
185
  /** Do not turn a streaming Codex turn into one capture-pane per burst. */
@@ -563,6 +588,13 @@ const STARTUP_DIALOG_BUDGET_MS = 30_000;
563
588
  export const OWN_SWITCH_WAIT_MS = 6_000;
564
589
  /** #1690: after an answer to that dialog, how long it gets to go away. */
565
590
  const OWN_SWITCH_SETTLE_MS = 3_000;
591
+ /** M-3175: how long a codex switch waits for the pane to be idle before it is not typed (the fleet then restarts instead). */
592
+ const CODEX_SWITCH_IDLE_MS = 60_000;
593
+ /** M-3175: how long codex gets to record the switch (rollout) or answer it (pane) after it is typed. */
594
+ const CODEX_SWITCH_VERIFY_MS = 10_000;
595
+ /** M-3175: the scrollback read around a codex switch (codex's answer rows are counted in it) and the most of a rollout delta read. */
596
+ const CODEX_SWITCH_HISTORY_LINES = 200;
597
+ const CODEX_SWITCH_ROLLOUT_READ = 4 * 1024 * 1024;
566
598
  /** A blocking dialog still on screen this long after first being seen is reported for a human. */
567
599
  const DIALOG_PARKED_NOTIFY_MS = 60_000;
568
600
  /** #2675: a card a person can answer from the chat is posted once it has been on screen, unchanged, this long. */
@@ -660,7 +692,7 @@ const INPUT_TRANSIENT_STALL_MS = 30_000;
660
692
  */
661
693
  const INPUT_TRANSIENT_WAIT_MS = 10 * 60_000;
662
694
  const INPUT_TRANSIENT_POLL_MS = 250;
663
- /** Max "stranded text → submit → wait for prompt → re-check" rounds per delivery; each may send one recovery Enter. */
695
+ /** Max actual stranded-text recovery Enters per delivery; a busy observation spends none. */
664
696
  const STRANDED_INPUT_MAX_ROUNDS = 3;
665
697
  /** The Claude phrasing every backend was judged by before #1217; still the default for a backend that names none. */
666
698
  const LEGACY_NO_CONVERSATION = /no conversation found|no conversation to (continue|resume)|no previous (session|conversation)/i;
@@ -676,6 +708,8 @@ const INPUT_RESIDUE_POLL_MS = 100;
676
708
  const RECENT_PASTES_KEPT = 8;
677
709
  /** Build a status holder from channel metadata, keeping chat and thread apart. */
678
710
  export function channelStatus(meta) {
711
+ if (meta.source === "app")
712
+ return undefined; // no platform post exists to react to
679
713
  const chatId = meta.chat_id;
680
714
  const messageId = meta.message_id;
681
715
  // A web chat message has no platform chat when the fleet has no channel, and still gets its reports:
@@ -1120,6 +1154,33 @@ const FLEET_RESPONSE_TYPES = new Set([
1120
1154
  "fleet_schedule_response", "fleet_outbound_response", "fleet_decision_response", "fleet_task_response",
1121
1155
  "fleet_display_name_response", "fleet_description_response", "fleet_persona_emoji_response", "fleet_web_theme_response",
1122
1156
  ]);
1157
+ /** null: no record (no turn). "unknown": a record that cannot be read or makes no sense — a turn may be running. */
1158
+ function readHubAnswerTurn(file) {
1159
+ let text;
1160
+ try {
1161
+ text = readFileSync(file, "utf8");
1162
+ }
1163
+ catch (err) {
1164
+ return err.code === "ENOENT" ? null : "unknown";
1165
+ }
1166
+ try {
1167
+ const r = JSON.parse(text);
1168
+ if (!r || typeof r.correlationId !== "string" || !/^hub-[A-Za-z0-9-]+$/.test(r.correlationId))
1169
+ return "unknown";
1170
+ return { correlationId: r.correlationId, contactLimit: r.contactLimit !== false, sawWorking: true, restored: true };
1171
+ }
1172
+ catch {
1173
+ return "unknown";
1174
+ }
1175
+ }
1176
+ /**
1177
+ * M-3660: a question from the Hub (a representative or room ask) that the agent answers with report_result to agend-hub.
1178
+ * It trusts the meta: only the fleet writes fleet_inbound, and from_instance "agend-hub" is its reserved sender — an
1179
+ * agent's send_to_instance is stamped with the agent's own name.
1180
+ */
1181
+ export function isHubQuestionMeta(meta) {
1182
+ return meta.from_instance === HUB_REPORT_TARGET && meta.request_kind === "query" && /^hub-[A-Za-z0-9-]+$/.test(meta.correlation_id ?? "");
1183
+ }
1123
1184
  export class Daemon extends EventEmitter {
1124
1185
  name;
1125
1186
  config;
@@ -1186,6 +1247,14 @@ export class Daemon extends EventEmitter {
1186
1247
  }
1187
1248
  guardian = null;
1188
1249
  adapter = null;
1250
+ requestContextAdmission;
1251
+ /** Input fencing may attach to a legacy owner; it does not bind C or reinterpret an existing turn. */
1252
+ setRequestContextAdmission(port) {
1253
+ if (this.requestContextAdmission && this.requestContextAdmission !== port)
1254
+ throw Error("Request-context admission owner differs");
1255
+ this.requestContextAdmission = port;
1256
+ }
1257
+ requestContextPendingWork = new RequestContextPendingWork();
1189
1258
  pendingIpcRequests = new Map();
1190
1259
  /**
1191
1260
  * Daemon-global request sequence. MCP request ids are only process-local:
@@ -1550,6 +1619,8 @@ export class Daemon extends EventEmitter {
1550
1619
  * instance is still auth-broken and must not resume raising alarms.
1551
1620
  */
1552
1621
  authFailureUnresolved = false;
1622
+ /** A process-local login failure cannot be repaired by a valid auth file or idle chrome. */
1623
+ staleAuth = null;
1553
1624
  /** One login-screen auth report per spawn — the screen persists across polls. */
1554
1625
  loginScreenReported = false;
1555
1626
  /** #2795: the auth pattern match the token-free check is still to judge; it arms nothing until confirmAuthFailure(). */
@@ -1843,7 +1914,7 @@ export class Daemon extends EventEmitter {
1843
1914
  if (!["codex", "grok"].includes(this.backend?.binaryName ?? ""))
1844
1915
  return [];
1845
1916
  const patterns = this.backend?.getErrorPatterns?.() ?? [];
1846
- return this.backend?.binaryName === "codex" ? patterns.filter(ep => Daemon.isCodexUsageLimitPause(ep)) : patterns.filter(ep => ep.type === "quota");
1917
+ return this.backend?.binaryName === "codex" ? patterns.filter(ep => Daemon.isCodexUsageLimitPause(ep) || ep.type === "stale_auth") : patterns.filter(ep => ep.type === "quota");
1847
1918
  }
1848
1919
  async prepareQuotaReplayHistory(reuseWindow) {
1849
1920
  this.quotaReplay = null;
@@ -1867,7 +1938,20 @@ export class Daemon extends EventEmitter {
1867
1938
  if (!current())
1868
1939
  return;
1869
1940
  const patterns = this.paneQuotaPatterns();
1870
- const messages = oldPane.split(/\r?\n/).filter(row => patterns.some(ep => ep.pattern.test(row)));
1941
+ // A quota frame can span several wrapped rows. Keep the complete rows
1942
+ // each actual match covered, rather than testing the rows independently.
1943
+ // Exact spans dedupe overlapping rules without collapsing repeated hits.
1944
+ const spans = new Map();
1945
+ for (const ep of patterns) {
1946
+ const flags = ep.pattern.flags.includes("g") ? ep.pattern.flags : ep.pattern.flags + "g";
1947
+ for (const match of oldPane.matchAll(new RegExp(ep.pattern.source, flags))) {
1948
+ const start = oldPane.lastIndexOf("\n", match.index) + 1;
1949
+ const newline = oldPane.indexOf("\n", match.index + match[0].length);
1950
+ const end = newline < 0 ? oldPane.length : newline;
1951
+ spans.set(`${start}:${end}`, oldPane.slice(start, end));
1952
+ }
1953
+ }
1954
+ const messages = [...spans.values()];
1871
1955
  this.quotaReplay = { messages, current: () => true, spawn, fence, attempt };
1872
1956
  }
1873
1957
  }
@@ -1883,7 +1967,13 @@ export class Daemon extends EventEmitter {
1883
1967
  this.quotaReplay = null;
1884
1968
  if (history.spawn !== this.spawnGeneration || history.fence !== this.launchFenceEpoch || history.attempt !== this.launchAttempt || !history.current())
1885
1969
  return;
1886
- for (const ep of this.paneQuotaPatterns()) {
1970
+ const patterns = this.paneQuotaPatterns();
1971
+ // Grok's old quota frame can also contain a 401. That same proven frame
1972
+ // must not arm the auth gate after its quota was absorbed as history.
1973
+ if (this.backend?.binaryName === "grok") {
1974
+ patterns.push(...(this.backend.getErrorPatterns?.() ?? []).filter(ep => ep.type === "auth_error"));
1975
+ }
1976
+ for (const ep of patterns) {
1887
1977
  const count = Math.min(Daemon.countOccurrences(ep.pattern, pane), quotaHistoryCount(pane, ep.pattern, history.messages));
1888
1978
  if (!count)
1889
1979
  continue;
@@ -1905,7 +1995,7 @@ export class Daemon extends EventEmitter {
1905
1995
  this.quotaInput = history.marker && history.occurrences === 0 ? { history, reported: new Map() } : null;
1906
1996
  }
1907
1997
  quotaOccurrencesAfterInput(pane, ep) {
1908
- if (!(this.backend?.binaryName === "codex" && Daemon.isCodexUsageLimitPause(ep)
1998
+ if (!(this.backend?.binaryName === "codex" && (Daemon.isCodexUsageLimitPause(ep) || ep.type === "stale_auth")
1909
1999
  || this.backend?.binaryName === "grok" && ep.type === "quota"))
1910
2000
  return null;
1911
2001
  const input = this.quotaInput, history = input?.history;
@@ -1929,6 +2019,42 @@ export class Daemon extends EventEmitter {
1929
2019
  transcriptEventSeq = 0;
1930
2020
  usageLimitErrorSeq = 0;
1931
2021
  static MODEL_USAGE_LIMIT = CLAUDE_MODEL_USAGE_LIMIT;
2022
+ /** M-3749: the MCP servers missing since a profile switch — Needs you lists them until they are back or dismissed. */
2023
+ mcpMissingState = null;
2024
+ mcpMissing() {
2025
+ return this.mcpMissingState ? { ...this.mcpMissingState, names: [...this.mcpMissingState.names] } : null;
2026
+ }
2027
+ /** M-3749: a person dismissed the missing-MCP list (Needs you → Acknowledge). false: nothing was outstanding. */
2028
+ dismissMcpMissing() {
2029
+ dismissClaudeMcpMissing(this.instanceDir);
2030
+ if (!this.mcpMissingState)
2031
+ return false;
2032
+ this.mcpMissingState = null;
2033
+ this.emit("mcp_missing", { name: this.name, missing: null });
2034
+ return true;
2035
+ }
2036
+ /**
2037
+ * M-3749: at each Claude launch, the user/local-scope MCP servers it had before a credential-profile switch and does not
2038
+ * have now (outstanding until back or dismissed). Never fails a launch; names only, never an entry.
2039
+ */
2040
+ checkClaudeMcpServers(backendConfig) {
2041
+ const before = this.mcpMissingState;
2042
+ this.mcpMissingState = null;
2043
+ if ((this.config.backend ?? "claude-code") === "claude-code") {
2044
+ try {
2045
+ const profileDir = claudeProfileConfigDir(backendConfig.backendOptions);
2046
+ this.mcpMissingState = checkClaudeMcpAtLaunch({ instanceDir: this.instanceDir, configDir: claudeConfigDirFor(profileDir),
2047
+ jsonPath: claudeJsonPath(profileDir), workingDirectory: this.config.working_directory });
2048
+ }
2049
+ catch (err) {
2050
+ this.logger.debug({ err }, "MCP server check at launch skipped");
2051
+ }
2052
+ }
2053
+ if (this.mcpMissingState)
2054
+ this.logger.warn({ missing: this.mcpMissingState.names }, "MCP servers from the previous credential profile are not in this one");
2055
+ if (before || this.mcpMissingState)
2056
+ this.emit("mcp_missing", { name: this.name, missing: this.mcpMissing() });
2057
+ }
1932
2058
  /** #2822: the usage-limit hold, while it lasts — Needs you lists it. */
1933
2059
  usageHold() {
1934
2060
  return this.usageLimitHold ? { ...this.usageLimitHold } : null;
@@ -2069,6 +2195,10 @@ export class Daemon extends EventEmitter {
2069
2195
  }
2070
2196
  return super.emit(event, ...args);
2071
2197
  }
2198
+ /** Attention remains active for General/busy agents too, until a new launch takes ownership. */
2199
+ staleAuthIssue() {
2200
+ return this.staleAuth?.generation === this.spawnGeneration ? { since: this.staleAuth.since } : null;
2201
+ }
2072
2202
  /**
2073
2203
  * Undo an auth suspicion once the backend's token-free probe has said the credentials are fine. Since #2795 a pane
2074
2204
  * pattern match arms nothing before that probe (its pending match is just dropped); what is left to undo is a
@@ -2077,6 +2207,8 @@ export class Daemon extends EventEmitter {
2077
2207
  * is still live and stays.
2078
2208
  */
2079
2209
  clearSuspectedAuthFailure() {
2210
+ if (this.staleAuthIssue())
2211
+ return false;
2080
2212
  this.unverifiedAuthMatch = null;
2081
2213
  if (!this.authFailureUnresolved && !this.loginScreenReported)
2082
2214
  return false;
@@ -2140,6 +2272,7 @@ export class Daemon extends EventEmitter {
2140
2272
  guardGeneration: turn?.generation ?? null, guardPhase: turn?.phase ?? null }, "Native pane tool operation failed");
2141
2273
  }
2142
2274
  nativePaneCurrent() { return this.nativePaneLifecycle?.current() ?? false; }
2275
+ nativePaneRequestContextTransportCurrent() { return this.nativePaneLifecycle?.requestContextTransportCurrent?.() === true; }
2143
2276
  nativeEnterHold = null;
2144
2277
  /** Per-launch attention for a native delivery whose bounded input attempts were refused or uncertain, including non-outbox input. */
2145
2278
  nativeDeliveryHold() {
@@ -2194,14 +2327,435 @@ export class Daemon extends EventEmitter {
2194
2327
  fleetTransportAvailable() {
2195
2328
  return this.nativePaneLifecycle ? !!this.nativeFleetBridge?.current() && !this.runtimeMonitorsFrozen : !!this.ipcServer;
2196
2329
  }
2330
+ classicRestriction;
2331
+ classicRestrictionFailed = false;
2332
+ classicRestrictionNeedsRestart = false;
2333
+ setClassicRestriction(input) {
2334
+ if (this.runtimeIdentity?.kind !== "classic") {
2335
+ if (input?.mode === "legacy")
2336
+ return; // The optional adapter also sees existing/default-kind starts.
2337
+ throw Error("Classic restriction requires a Classic room");
2338
+ }
2339
+ try {
2340
+ if (!input || !["legacy", "restricted"].includes(input.mode))
2341
+ throw Error("invalid-policy");
2342
+ const next = input.mode === "restricted" ? { roomKey: this.name, policyRevision: input.policyRevision ?? 0,
2343
+ publicRead: input.roomTools.publicRead, allowedMcpTools: structuredClone(input.roomTools.allowedMcpTools),
2344
+ allowedAgendTools: [...CLASSIC_RESTRICTED_TOOLS] } : undefined;
2345
+ // A1's revision also changes for contact grants and approvers. Validate it,
2346
+ // but preserve the frozen launch when the native tool policy is unchanged.
2347
+ if (next)
2348
+ classicPlanDigest(next);
2349
+ const before = this.classicRestriction ? classicPlanDigest({ ...this.classicRestriction, policyRevision: 0 }) : null;
2350
+ const after = next ? classicPlanDigest({ ...next, policyRevision: 0 }) : null;
2351
+ if (before !== after) {
2352
+ invalidateClassicGuard(this.instanceDir);
2353
+ if (this.classicRestriction && !next && this.processStatus === "running")
2354
+ this.classicRestrictionNeedsRestart = true;
2355
+ this.classicRestriction = next;
2356
+ }
2357
+ this.classicRestrictionFailed = false;
2358
+ }
2359
+ catch {
2360
+ this.classicRestrictionFailed = true;
2361
+ try {
2362
+ invalidateClassicGuard(this.instanceDir);
2363
+ }
2364
+ catch { /* failed remains visible and refuses the next launch */ }
2365
+ }
2366
+ }
2367
+ assertClassicRestrictionLaunch(expected) {
2368
+ const current = this.classicRestriction ? classicPlanDigest(this.classicRestriction) : null;
2369
+ if (this.classicRestrictionFailed || current !== expected)
2370
+ throw Error("Restricted room policy changed while CLI launch was being prepared");
2371
+ }
2372
+ classicNativeGuard() {
2373
+ const backend = this.config.backend ?? this.backend?.binaryName ?? "unknown";
2374
+ if (this.classicRestrictionFailed)
2375
+ return classicGuardInventory({ state: "failed", backend, reason: "guard-unavailable" });
2376
+ if (!this.classicRestriction)
2377
+ return classicGuardInventory(this.classicRestrictionNeedsRestart
2378
+ ? { state: "restart-required", backend, reason: "stale-policy" }
2379
+ : { state: "not-covered", backend, reason: "legacy-mode" });
2380
+ if (this.nativePaneLifecycle)
2381
+ return classicGuardInventory({ state: "not-covered", backend, reason: "unsupported-platform" });
2382
+ const status = this.backend?.classicNativeGuard?.(this.classicRestriction)
2383
+ ?? { state: "not-covered", backend, reason: "unsupported-backend" };
2384
+ return classicGuardInventory(status.state === "ready" && this.processStatus !== "running"
2385
+ ? { state: "restart-required", backend, reason: "not-running" } : status);
2386
+ }
2387
+ /** Internal local-lifecycle port only. No config, IPC or MCP setter; production stays unbound until cutover. */
2388
+ requestContextLifecycle;
2389
+ requestContextWrite;
2390
+ requestContextPolicy;
2391
+ bindRequestContextPolicy(policy) { if (this.requestContextPolicy || !this.requestContextLifecycle)
2392
+ throw Error("request-context policy requires its owned turn binding"); this.requestContextPolicy = policy; }
2393
+ requestContextCalls = new RequestContextReferenceMap(call => call.admission.coverage === "covered" ? call.admission.lease.snapshot.context.ref.rootContextId : null, call => `local-call:${call.id}`);
2394
+ requestContextQueuedWork = new RequestContextReferenceMap(row => row.root, (_row, id) => `queued-recovery:${id}`);
2395
+ get requestContextQueuedWorkDrainRevision() { return this.requestContextQueuedWork.revision; }
2396
+ requestContextQueuedWorkDrainView(rootId) { return this.requestContextQueuedWork.view(rootId); }
2397
+ requestContextPendingReplies = new RequestContextPendingReplies();
2398
+ requestContextHumanReplies = new Map();
2399
+ requestContextInterruptedLaunch;
2400
+ requestContextLaunch() { return JSON.stringify([this.bootId, this.spawnGeneration, this.nativePaneLifecycle?.snapshot?.()?.launchId ?? null]); }
2401
+ /** First local owned hop only. No lookup at a later Fleet receipt may retag this call. */
2402
+ beginRequestContextCall(socket) {
2403
+ if (!this.requestContextLifecycle)
2404
+ return;
2405
+ if (this.requestContextCalls.size >= 128)
2406
+ throw Error("Request context call admission backlog");
2407
+ const launch = this.requestContextLaunch();
2408
+ const snapshot = socket && this.socketSessionNames.get(socket) === this.name ? this.requestContextTurnSnapshot() : null;
2409
+ const reason = this.requestContextInterruptedLaunch === launch ? "interrupted-launch" : "unbound-input";
2410
+ const admission = snapshot && reason !== "interrupted-launch"
2411
+ ? { coverage: "covered", lease: captureRequestContextCall(snapshot, captured => this.requestContextTurnCurrent(captured)) }
2412
+ : { coverage: "not-covered", reason };
2413
+ const reply = this.requestContextCapturedReply(admission);
2414
+ const call = Object.freeze({ id: randomUUID(), admission: Object.freeze(admission),
2415
+ get replyRoute() { return reply.route(); }, waitForReplyRoute: reply.wait,
2416
+ current: () => reply.current() && !this.deliveryWritesStopping && this.requestContextLaunch() === launch
2417
+ && (admission.coverage !== "covered" || admission.lease.current()) });
2418
+ this.requestContextCalls.set(call.id, call);
2419
+ return call;
2420
+ }
2421
+ /** Capture the scheduling record now; waiting never looks up a newer input. */
2422
+ requestContextCapturedReply(admission) {
2423
+ const snapshot = admission.coverage === "covered" ? admission.lease.snapshot : null;
2424
+ let deadline = Infinity;
2425
+ let route = snapshot ? this.captureRequestContextReplyRoute(snapshot) : undefined;
2426
+ const pending = snapshot && !route ? this.requestContextPendingReplies.capture(snapshot) : undefined;
2427
+ return { route: () => route, current: () => performance.now() < deadline, wait: pending ? async (budgetMs) => {
2428
+ deadline = Math.min(deadline, performance.now() + budgetMs);
2429
+ const confirmed = await pending.wait(budgetMs);
2430
+ if (confirmed && snapshot && performance.now() < deadline && admission.coverage === "covered" && admission.lease.current()) {
2431
+ const checked = this.captureRequestContextReplyRoute(snapshot);
2432
+ if (checked && checked.generation === confirmed.generation && requestContextDigest(checked.target) === requestContextDigest(confirmed.target))
2433
+ route = Object.freeze({ ...checked, current: () => performance.now() < deadline && checked.current() });
2434
+ }
2435
+ } : undefined };
2436
+ }
2437
+ /** Bind the original call to a delivered target, with the original human admission rechecked at commit. */
2438
+ captureRequestContextReplyRoute(snapshot) {
2439
+ const route = this.turnReplyGuard?.captureReplyRoute(snapshot.token);
2440
+ if (!route)
2441
+ return;
2442
+ const current = () => {
2443
+ try {
2444
+ return route.current() && this.requestContextTurnCurrent(snapshot)
2445
+ && requestContextDigest(this.requestContextLifecycle?.replyTarget?.(snapshot)) === requestContextDigest(route.target);
2446
+ }
2447
+ catch {
2448
+ return false;
2449
+ }
2450
+ };
2451
+ return current() ? Object.freeze({ ...route, current }) : undefined;
2452
+ }
2453
+ /** Internal Fleet accessor, paired with the current daemon/IPC connection; returns original scope or nothing. */
2454
+ requestContextCall(callId) {
2455
+ const call = this.requestContextCalls.get(callId);
2456
+ return call?.current() ? call : null;
2457
+ }
2458
+ requestContextCallsRequired() { return this.requestContextLifecycle !== undefined; }
2459
+ get requestContextCallDrainRevision() { return this.requestContextCalls.revision; }
2460
+ requestContextCallDrainView(rootId) { return this.requestContextCalls.view(rootId); }
2461
+ requestContextTurnDrainView(rootId) {
2462
+ const view = this.requestContextLifecycle?.turns.drainView(rootId);
2463
+ if (!view)
2464
+ return null;
2465
+ const write = this.requestContextWrite;
2466
+ return { ...view, revision: this.requestContextTurnDrainRevision, references: [...view.references,
2467
+ ...(write?.unknownEnd && write.snapshot.context.ref.rootContextId === rootId
2468
+ ? [`unknown-end:${this.name}:${write.unknownEnd}`] : [])] };
2469
+ }
2470
+ get requestContextTurnDrainRevision() {
2471
+ return JSON.stringify([
2472
+ this.requestContextLifecycle?.turns.drainRevision ?? "unavailable",
2473
+ this.requestContextWrite?.unknownEnd ?? null
2474
+ ]);
2475
+ }
2476
+ handleOwnedToolCall(message, socket) {
2477
+ let call;
2478
+ try {
2479
+ call = this.beginRequestContextCall(socket);
2480
+ this.handleToolCall(message, socket, undefined, call);
2481
+ }
2482
+ catch {
2483
+ if (call)
2484
+ this.requestContextCalls.delete(call.id);
2485
+ this.ipcServer?.send(socket, { requestId: message.requestId, result: null, error: "Request context call admission is unavailable" });
2486
+ }
2487
+ }
2488
+ /** New replacement only; an old launch never acquires C by reseeding its counters. */
2489
+ seedRequestContextReplacement(previous) {
2490
+ if (this.tmux || this.ipcServer || this.nativePaneLifecycle || this.requestContextLifecycle
2491
+ || ![previous.spawnGeneration, previous.launchFenceEpoch].every(n => Number.isSafeInteger(n) && n >= 0 && n < Number.MAX_SAFE_INTEGER)) {
2492
+ throw Error("Request-context replacement must be prepared before startup");
2493
+ }
2494
+ this.spawnGeneration = previous.spawnGeneration + 1;
2495
+ this.launchFenceEpoch = previous.launchFenceEpoch + 1;
2496
+ }
2497
+ /** Read-only first-On inventory. Idle alone is never a legacy-work drain proof. */
2498
+ requestContextLaunchObservation() {
2499
+ return Object.freeze({ daemonBootId: this.bootId, spawnGeneration: this.spawnGeneration,
2500
+ launchFenceEpoch: this.launchFenceEpoch, observation: this.getWorkingStateObservation(),
2501
+ pendingCalls: this.requestContextPendingWork.count(this.name), responseWaiters: this.pendingIpcRequests.size,
2502
+ paneWriteBusy: this.paneWriteLock.isBusy, queuedInputs: this.pasteQueueDepth,
2503
+ transcriptOpen: this.transcriptTurns.openSince() !== null,
2504
+ starting: this.spawning, stopping: this.deliveryWritesStopping || this.startupAborted,
2505
+ replacementRequired: !this.requestContextLifecycle || this.requestContextInterruptedLaunch === this.requestContextLaunch() });
2506
+ }
2507
+ requestContextHelper;
2508
+ requestContextStartupResources;
2509
+ /** Candidate-only physical resource receipt, installed before startup. Used even when startup rejects.
2510
+ * No stop result, timeout, removed metadata or empty supervisor map proves retirement.
2511
+ */
2512
+ prepareRequestContextStartupRetirement() {
2513
+ if (this.tmux || this.ipcServer || this.nativePaneLifecycle || this.requestContextStartupResources)
2514
+ throw Error("Request startup retirement must precede launch");
2515
+ const resources = { pending: 0, unknown: false, windows: [], ipc: new Set(), native: [] };
2516
+ this.requestContextStartupResources = resources;
2517
+ return Object.freeze({ retired: async () => {
2518
+ try {
2519
+ if (this.requestContextStartupResources !== resources || !this.startupAborted && !this.deliveryWritesStopping || this.spawning
2520
+ || resources.pending || resources.unknown || [...resources.ipc].some(ipc => !ipc.retired()))
2521
+ return false;
2522
+ for (const row of resources.native) {
2523
+ const snapshot = row.owner.snapshot?.();
2524
+ if (!snapshot || snapshot.state !== "exited" || JSON.stringify([snapshot.hostBootId, snapshot.paneId, snapshot.launchId, snapshot.agentId, snapshot.instance]) !== row.identity)
2525
+ return false;
2526
+ }
2527
+ for (const row of resources.windows) {
2528
+ const windows = await TmuxManager.listWindowsStrict(row.session);
2529
+ if (resources.pending || resources.unknown || windows.some(window => window.id === row.window) || !requestContextProcessGroupGone(row.pid))
2530
+ return false;
2531
+ }
2532
+ return this.requestContextStartupResources === resources && !resources.pending && !resources.unknown && [...resources.ipc].every(ipc => ipc.retired());
2533
+ }
2534
+ catch {
2535
+ return false;
2536
+ }
2537
+ } });
2538
+ }
2539
+ requestContextHelperReadiness() {
2540
+ if (!this.requestContextLifecycle)
2541
+ return null;
2542
+ if (this.nativePaneLifecycle) {
2543
+ const snapshot = this.nativePaneLifecycle.snapshot?.();
2544
+ if (!snapshot)
2545
+ return null;
2546
+ // Output/sequence changes are observations, not a new admitting launch. Bind the actual owner tuple.
2547
+ return { version: 1, generation: JSON.stringify([this.bootId, this.spawnGeneration, this.launchFenceEpoch, snapshot.hostBootId, snapshot.paneId, snapshot.launchId, snapshot.agentId]),
2548
+ ready: snapshot.state === "running" && this.nativePaneLifecycle.requestContextTransportCurrent?.() === true };
2549
+ }
2550
+ return this.requestContextHelper ? { version: 1, generation: `${this.bootId}:${this.requestContextHelper.revision}`, ready: this.requestContextHelper.ready() } : null;
2551
+ }
2552
+ getRequestContextLaunchSpec() {
2553
+ const kind = this.runtimeIdentity?.kind;
2554
+ if (kind !== "classic" && kind !== "fleet-topic")
2555
+ throw Error("Request launch kind unavailable");
2556
+ return Object.freeze({ config: this.getConfigSnapshot(), topicMode: this.topicMode, kind });
2557
+ }
2558
+ /** First-On uses a real bounded pane read, not the cached idle badge; admission must already be fenced. */
2559
+ async captureRequestContextIdle() {
2560
+ const admission = this.requestContextAdmission;
2561
+ if (!admission || admission.available())
2562
+ return null;
2563
+ // Capture before waiting for the write lock: a replaced/respawned owner cannot inherit this request.
2564
+ const tmux = this.tmux, ipc = this.ipcServer, owner = JSON.stringify(this.interactionOwner());
2565
+ const daemonBootId = this.bootId, spawnGeneration = this.spawnGeneration, launchFenceEpoch = this.launchFenceEpoch, deliveryEpoch = this.deliveryEpoch;
2566
+ const pendingRevision = this.requestContextPendingWork.revision, turn = this.turnReplyGuard.snapshot();
2567
+ return this.paneWriteLock.run(async () => {
2568
+ const stable = () => {
2569
+ const observed = this.requestContextLaunchObservation(), now = this.turnReplyGuard.snapshot();
2570
+ return this.requestContextAdmission === admission && !admission.available()
2571
+ && this.tmux === tmux && this.ipcServer === ipc && JSON.stringify(this.interactionOwner()) === owner
2572
+ && this.deliveryEpoch === deliveryEpoch && this.requestContextPendingWork.revision === pendingRevision
2573
+ && observed.pendingCalls === 0 && observed.responseWaiters === 0 && observed.queuedInputs === 0
2574
+ && !observed.transcriptOpen && !observed.starting && !observed.stopping && !this.runtimeMonitorsFrozen
2575
+ && observed.observation.processStatus === "running" && observed.observation.executionState === "idle"
2576
+ && (!this.backend?.backgroundWorkRunning || observed.observation.backgroundWork !== true)
2577
+ && now?.generation === turn?.generation
2578
+ && (!now || now.cancelledByUser || now.completionDelivered);
2579
+ };
2580
+ if (!tmux || !stable())
2581
+ return null;
2582
+ let pane;
2583
+ try {
2584
+ pane = await tmux.capturePane(2000);
2585
+ }
2586
+ catch {
2587
+ return null;
2588
+ }
2589
+ if (!stable() || !this.paneAuthoritativelyIdle(pane) || this.inputTransientInPane(pane)
2590
+ || this.backend?.backgroundWorkRunning && this.backend.backgroundWorkRunning(pane) !== false)
2591
+ return null;
2592
+ // The owning gate still checks its durable rows and producer revision. A late handler, queue, turn,
2593
+ // IPC replacement or owner change invalidates this proof even if it later looks idle again.
2594
+ return Object.freeze({ daemonBootId, spawnGeneration, launchFenceEpoch, deliveryEpoch,
2595
+ current: () => !this.paneWriteLock.isBusy && stable() });
2596
+ });
2597
+ }
2598
+ /** Capture the exact old resources BEFORE stop removes metadata; this proof never kills or signals anything. */
2599
+ async captureRequestContextRetirement() {
2600
+ const tmux = this.tmux, windowId = tmux?.getWindowId(), native = this.nativePaneLifecycle, ipc = this.ipcServer;
2601
+ const spawnGeneration = this.spawnGeneration, launchFenceEpoch = this.launchFenceEpoch, daemonBootId = this.bootId;
2602
+ if (!tmux || !windowId)
2603
+ throw Error("Owned launch unavailable for retirement");
2604
+ const owned = () => this.bootId === daemonBootId && this.spawnGeneration === spawnGeneration
2605
+ && this.tmux === tmux && tmux.getWindowId() === windowId && this.nativePaneLifecycle === native
2606
+ && (this.ipcServer === ipc || this.ipcServer === null && ipc?.retired() === true);
2607
+ const captured = native?.snapshot?.();
2608
+ const panePid = native ? null : await this.paneHost.getPanePid(this.tmuxSessionName, windowId);
2609
+ if (!owned() || !native && (!panePid || !Number.isSafeInteger(panePid) || panePid <= 1)
2610
+ || native && (!captured || captured.instance !== this.name || captured.paneId !== windowId))
2611
+ throw Error("Owned launch changed during retirement capture");
2612
+ let observedRetired = false;
2613
+ const retiredCurrent = () => {
2614
+ if (!observedRetired || !owned() || ipc && !ipc.retired())
2615
+ return false;
2616
+ if (native) {
2617
+ const now = native.snapshot?.();
2618
+ return !!now && now.state === "exited" && ["hostBootId", "paneId", "launchId", "agentId", "instance"].every(k => now[k] === captured[k]);
2619
+ }
2620
+ return requestContextProcessGroupGone(panePid);
2621
+ };
2622
+ return Object.freeze({ daemonBootId, spawnGeneration, launchFenceEpoch, windowId, panePid, retiredCurrent, retired: async () => {
2623
+ try {
2624
+ if (!owned() || ipc && !ipc.retired())
2625
+ return false;
2626
+ if (native) {
2627
+ const now = native.snapshot?.();
2628
+ const gone = !!now && now.state === "exited" && ["hostBootId", "paneId", "launchId", "agentId", "instance"].every(k => now[k] === captured[k]) && owned();
2629
+ if (gone)
2630
+ observedRetired = true;
2631
+ return gone;
2632
+ }
2633
+ const windows = await TmuxManager.listWindowsStrict(this.tmuxSessionName);
2634
+ const gone = owned() && (!ipc || ipc.retired()) && !windows.some(w => w.id === windowId) && requestContextProcessGroupGone(panePid);
2635
+ if (gone)
2636
+ observedRetired = true;
2637
+ return gone;
2638
+ }
2639
+ catch {
2640
+ return false;
2641
+ }
2642
+ } });
2643
+ }
2644
+ setRequestContextLocalLifecycle(turns, identity, newWork, replyTarget, continuation) {
2645
+ if (this.tmux || this.ipcServer || this.requestContextLifecycle || this.nativePaneLifecycle && !this.nativePaneLifecycle.requestContextAvailable?.())
2646
+ throw Error("Request context must be bound before a supported daemon startup");
2647
+ this.requestContextCalls.installRegistration(turns.registrationGate ?? undefined);
2648
+ this.requestContextQueuedWork.installRegistration(turns.registrationGate ?? undefined);
2649
+ this.requestContextHelper = new RequestContextHelperAdmission();
2650
+ this.requestContextLifecycle = { turns, identity, newWork, replyTarget, continuation };
2651
+ }
2652
+ /** Authoritative fresh-launch boundary only; session discovery and a merely written clear command do not prove it. */
2653
+ requestContextNewWork(reason) {
2654
+ const lifecycle = this.requestContextLifecycle;
2655
+ if (!lifecycle?.newWork)
2656
+ return;
2657
+ const owner = this.requestContextOwner(), previous = owner ? lifecycle.turns.current(owner) : null;
2658
+ lifecycle.newWork(reason);
2659
+ if (owner && previous)
2660
+ lifecycle.turns.ended(previous, owner);
2661
+ this.requestContextWrite = undefined;
2662
+ this.requestContextPendingReplies.clear();
2663
+ this.requestContextHumanReplies.clear();
2664
+ }
2665
+ requestContextOwner() {
2666
+ const lifecycle = this.requestContextLifecycle;
2667
+ return lifecycle ? { ...lifecycle.identity(), instance: this.name, daemonBootId: this.bootId,
2668
+ spawnGeneration: this.spawnGeneration, launchFenceEpoch: this.launchFenceEpoch, deliveryEpoch: this.deliveryEpoch } : null;
2669
+ }
2670
+ /** Trusted installer/resolver observation only; no turn token or authority is granted. */
2671
+ captureRequestContextOwner() {
2672
+ const owner = this.requestContextOwner();
2673
+ return owner ? Object.freeze(owner) : null;
2674
+ }
2675
+ requestContextTurnSnapshot() {
2676
+ const owner = this.requestContextOwner();
2677
+ return owner ? this.requestContextLifecycle.turns.current(owner) : null;
2678
+ }
2679
+ requestContextTurnCurrent(snapshot) {
2680
+ const owner = this.requestContextOwner();
2681
+ return !!owner && this.requestContextLifecycle.turns.isCurrent(snapshot, owner);
2682
+ }
2683
+ bindRequestContextWrite(inputId, text, queued, recovery) {
2684
+ const owner = this.requestContextOwner();
2685
+ if (!owner)
2686
+ return;
2687
+ // Ordinary queues are never evidence of consumption. Only a proven steer can join the EXISTING turn.
2688
+ if (queued && recovery)
2689
+ throw Error("request-context queued input consumption is not covered yet");
2690
+ if (recovery && !recovery.current())
2691
+ throw Error("request-context recovery job is no longer current");
2692
+ const previous = this.requestContextTurnSnapshot();
2693
+ const snapshot = queued ? this.requestContextLifecycle.turns.beforeQueuedSteer(inputId, deliveryContentDigest(text), owner)
2694
+ : recovery ? this.requestContextLifecycle.turns.beforeRecoveryWrite(recovery.inputId, deliveryContentDigest(text), owner, recovery.parent)
2695
+ : this.requestContextLifecycle.turns.beforeWrite(inputId, deliveryContentDigest(text), owner);
2696
+ try {
2697
+ this.nativePaneLifecycle?.stageRequestContext?.(snapshot, deliveryContentDigest(text), () => this.requestContextTurnCurrent(snapshot), this.requestContextInterruptedLaunch === this.requestContextLaunch());
2698
+ }
2699
+ catch (error) {
2700
+ if (snapshot !== previous)
2701
+ this.requestContextLifecycle.turns.ended(snapshot, owner);
2702
+ throw error;
2703
+ }
2704
+ if (this.requestContextWrite?.snapshot.token !== snapshot.token) {
2705
+ const id = snapshot.inputId;
2706
+ const humanId = id.startsWith("human:") ? id.slice(6) : null;
2707
+ const deliveryId = /^delivery:([^:]+):[0-9]+$/.exec(id)?.[1];
2708
+ const endAnchor = !!humanId && /^[A-Za-z0-9_-]+$/.test(humanId) && text.split("\n").some(line => line.startsWith(`[hid:${humanId}]`) || line.startsWith(`[agend-human-id:${humanId}]`))
2709
+ || !!deliveryId && text.startsWith(`[agend-delivery-id:${deliveryId}]\n`)
2710
+ || /^hub-input:[a-f0-9-]{36}$/.test(id) && /^\[agend-room-input:hub-room-[a-f0-9-]{36}\]\n/.test(text)
2711
+ || /^[A-Za-z0-9:_-]+$/.test(id) && text.startsWith(`[agend-request-input:${id}]\n`);
2712
+ this.requestContextWrite = { snapshot, text, at: Date.now(), ledger: new TranscriptTurnLedger(), endAnchor };
2713
+ }
2714
+ }
2715
+ /** A reset withdraws proof; it never silently retires C or admits the next root. */
2716
+ observeRequestContextTranscript(events) {
2717
+ const write = this.requestContextWrite;
2718
+ if (!write)
2719
+ return;
2720
+ for (const event of events) {
2721
+ if (event.kind !== "retract")
2722
+ continue;
2723
+ // Ask before withdrawing the row. A foreign transcript turn cannot turn
2724
+ // this owned input into an unknown-end blocker.
2725
+ if (write.ledger.matchesInputTurn(event.turnId, write.text, write.at))
2726
+ write.unknownEnd = event.reason ?? "reset";
2727
+ }
2728
+ write.ledger.observe(events, performance.now());
2729
+ this.settleRequestContextFromTranscript();
2730
+ }
2731
+ settleRequestContextFromTranscript() {
2732
+ const write = this.requestContextWrite, owner = this.requestContextOwner();
2733
+ if (!write || write.unknownEnd || !write.endAnchor || !owner || !this.requestContextLifecycle.turns.isCurrent(write.snapshot, owner))
2734
+ return;
2735
+ const verdict = write.ledger.verdict(write.text, write.at);
2736
+ if (verdict === "ended" || verdict === "aborted" || verdict === "error") {
2737
+ if (verdict !== "ended")
2738
+ this.requestContextInterruptedLaunch = this.requestContextLaunch();
2739
+ this.requestContextLifecycle.turns.ended(write.snapshot, owner);
2740
+ this.requestContextWrite = undefined;
2741
+ this.requestContextPendingReplies.clear();
2742
+ }
2743
+ }
2197
2744
  /** Internal lifecycle injection, before start. Native paths and provider files stay on their runner. */
2198
2745
  setNativePaneLifecycle(native) {
2199
- if (this.tmux || this.ipcServer || this.nativePaneLifecycle)
2200
- throw Error("Native pane adapter must be bound before daemon startup");
2746
+ if (this.tmux || this.ipcServer || this.nativePaneLifecycle || this.requestContextLifecycle && !native.requestContextAvailable?.())
2747
+ throw Error("Native pane adapter must be bound before daemon startup with a supported request-context producer");
2201
2748
  this.nativePaneLifecycle = native;
2202
2749
  this.backend = native.backend;
2203
2750
  this.paneTransport = native.host;
2204
2751
  this.controlClient = native.observation;
2752
+ if (this.requestContextStartupResources) {
2753
+ const snapshot = native.snapshot?.();
2754
+ if (!snapshot)
2755
+ this.requestContextStartupResources.unknown = true;
2756
+ else
2757
+ this.requestContextStartupResources.native.push({ owner: native, identity: JSON.stringify([snapshot.hostBootId, snapshot.paneId, snapshot.launchId, snapshot.agentId, snapshot.instance]) });
2758
+ }
2205
2759
  }
2206
2760
  constructor(name, config, instanceDir, topicMode = false, backend, controlClient, rootLogger, runtimeIdentity, spawnGate, stormWindow,
2207
2761
  /** Fleet-level "is this CLI's backend down?" memory — see backend-outage.ts. */
@@ -2249,6 +2803,7 @@ export class Daemon extends EventEmitter {
2249
2803
  // deliberately NOT hooked: stop/spawn abandon the in-memory turn while
2250
2804
  // the on-disk interruption must survive for the resume gate.
2251
2805
  this.turnReplyGuard.onComplete = () => {
2806
+ this.replyDraft.reset();
2252
2807
  clearInFlightTurnMarker(this.instanceDir);
2253
2808
  this.publishWorkingState("turn_closed");
2254
2809
  };
@@ -2279,12 +2834,68 @@ export class Daemon extends EventEmitter {
2279
2834
  setStatusEmojiAvoidList(list) {
2280
2835
  this.statusEmojiAvoidList = list;
2281
2836
  }
2837
+ credentialChangeIncarnation = null;
2838
+ /** Claim an idle local Claude pane for an account change; queued input cannot race the final capture. */
2839
+ async quiesceClaudeCredential() {
2840
+ const spawn = this.spawnGeneration, fence = this.launchFenceEpoch;
2841
+ return this.paneWriteLock.run(async () => {
2842
+ const turn = this.turnReplyGuard.snapshot(), deliveryEpoch = this.deliveryEpoch;
2843
+ if (turn && !turn.cancelledByUser && !turn.completionDelivered)
2844
+ return false;
2845
+ if (this.backend?.binaryName !== "claude" || this.usesNativePane() || this.spawning || this.healthCheckPaused || this.deliveryWritesStopping || this.startupAborted || this.isPaused)
2846
+ return false;
2847
+ if (!await this.isPaneAuthoritativelyIdle())
2848
+ return false;
2849
+ const windowId = this.tmux?.getWindowId();
2850
+ if (!windowId)
2851
+ return false;
2852
+ let pid = null;
2853
+ try {
2854
+ pid = await this.paneHost.getPanePid(this.tmuxSessionName, windowId);
2855
+ }
2856
+ catch {
2857
+ return false;
2858
+ }
2859
+ if (pid === null || !Number.isSafeInteger(pid) || pid <= 1 || windowId !== this.tmux?.getWindowId())
2860
+ return false;
2861
+ // A tool pause can look idle. Re-read the owned logical turn after both
2862
+ // pane awaits; new input or another turn must not inherit this idle proof.
2863
+ const currentTurn = this.turnReplyGuard.snapshot();
2864
+ if ((currentTurn && !currentTurn.cancelledByUser && !currentTurn.completionDelivered) || currentTurn?.generation !== turn?.generation || deliveryEpoch !== this.deliveryEpoch)
2865
+ return false;
2866
+ if (spawn !== this.spawnGeneration || fence !== this.launchFenceEpoch || this.spawning || this.healthCheckPaused || this.deliveryWritesStopping || this.startupAborted || this.isPaused)
2867
+ return false;
2868
+ this.credentialChangeIncarnation = { windowId, pid };
2869
+ this.fenceDeliveryWritesForStop();
2870
+ return true;
2871
+ });
2872
+ }
2873
+ /** Read-only proof for the exact pane captured above; never kill a replacement window. */
2874
+ async claudeCredentialRetired() {
2875
+ const inc = this.credentialChangeIncarnation;
2876
+ if (!inc)
2877
+ return false;
2878
+ try {
2879
+ const windows = await TmuxManager.listWindowsStrict(this.tmuxSessionName);
2880
+ if (!windows.some(window => window.id === inc.windowId))
2881
+ return true;
2882
+ const pid = await this.paneHost.getPanePid(this.tmuxSessionName, inc.windowId);
2883
+ return pid !== null && pid !== inc.pid;
2884
+ }
2885
+ catch {
2886
+ return false;
2887
+ }
2888
+ }
2282
2889
  /** Fence pane writers before lifecycle captures pre-kill reconciliation evidence. */
2283
2890
  fenceDeliveryWritesForStop() {
2284
2891
  if (this.deliveryWritesStopping)
2285
2892
  return;
2286
2893
  this.deliveryWritesStopping = true;
2894
+ this.requestContextAdmission?.changed();
2287
2895
  this.deliveryEpoch++;
2896
+ this.replyDraft.reset();
2897
+ this.requestContextLifecycle?.turns.fence();
2898
+ this.requestContextCalls.clear();
2288
2899
  }
2289
2900
  /** Bounded drain: timeout remains safe because Enter has a write-ahead fence. */
2290
2901
  waitForDeliveryWritesToDrain(timeoutMs) {
@@ -2371,7 +2982,13 @@ export class Daemon extends EventEmitter {
2371
2982
  // not — a pre-write failure never gets here; it is retried before begin.
2372
2983
  if (outcome !== "failed")
2373
2984
  this.noteWorkActivity();
2374
- this.deliveryOutbox?.complete(delivery.deliveryId, this.bootId, delivery.attemptNo, outcome, evidence);
2985
+ const accepted = this.deliveryOutbox?.complete(delivery.deliveryId, this.bootId, delivery.attemptNo, outcome, evidence);
2986
+ if (verdict?.pendingReply) {
2987
+ if (accepted && outcome === "delivered" && !["unverified", "output-edge", "unverifiable"].includes(verdict.proof ?? ""))
2988
+ verdict.pendingReply.confirm();
2989
+ else
2990
+ verdict.pendingReply.refuse();
2991
+ }
2375
2992
  if (verdict && outcome !== "failed")
2376
2993
  this.startConsumedWatch(delivery, verdict, outcome);
2377
2994
  }
@@ -2455,25 +3072,26 @@ export class Daemon extends EventEmitter {
2455
3072
  if (!["claude-code", "codex"].includes(backend))
2456
3073
  return;
2457
3074
  const marker = durableAttempt ? `[agend-delivery-id:${durableAttempt.deliveryId}]`
2458
- : humanVerificationId ? verdict.humanReceipt?.marker ?? `[agend-human-id:${humanVerificationId}]` : null;
3075
+ : humanVerificationId ? verdict.humanReceipt?.marker ?? `[agend-human-id:${humanVerificationId}]` : roomContextInputMarker(track.meta);
2459
3076
  if (!marker || !formatted.startsWith(marker))
2460
3077
  return;
2461
3078
  let found = verdict.transcriptCheckpoint ?? null;
2462
3079
  if (!found) {
2463
3080
  try {
2464
- found = await this.transcriptMonitor?.reconciliationCheckpoint() ?? null;
3081
+ // M-2403: a native or remote pane checkpoints its runtime transcript (no local file); a local CLI, its file.
3082
+ const runtime = this.nativePaneLifecycle ? await this.transcriptMonitor?.reconciliationRuntimeCheckpoint() ?? null : null;
3083
+ found = runtime ? { runtime } : await this.transcriptMonitor?.reconciliationCheckpoint() ?? null;
2465
3084
  }
2466
3085
  catch (err) {
2467
3086
  this.logger.debug({ err }, "Could not checkpoint the transcript before a queued hand-off");
2468
3087
  }
2469
3088
  }
2470
- // main→alpha sync: a hand-off record is judged against a local transcript file. A native or remote runtime's
2471
- // transcript (no local path) has none: it runs as before (✅ at the hand-off), as with no checkpoint at all.
2472
- const checkpoint = found && typeof found.path === "string" && typeof found.offset === "number" ? { path: found.path, offset: found.offset } : null;
3089
+ const checkpoint = found?.runtime ? { runtime: found.runtime }
3090
+ : found && typeof found.path === "string" && typeof found.offset === "number" ? { path: found.path, offset: found.offset } : null;
2473
3091
  if (!checkpoint)
2474
3092
  return; // nothing could judge it later: it runs as before (✅ at the hand-off)
2475
3093
  const entry = {
2476
- id: track.id ?? randomUUID(), marker, backend, path: checkpoint.path, offset: checkpoint.offset,
3094
+ id: track.id ?? randomUUID(), marker, backend, ...checkpoint,
2477
3095
  content: track.content, meta: track.meta, wire: formatted, holder: this.handoffHolder(), createdAt: Date.now(),
2478
3096
  redeliveries: track.redeliveries ?? 0,
2479
3097
  };
@@ -2504,6 +3122,8 @@ export class Daemon extends EventEmitter {
2504
3122
  this.dropQueuedHandoff(verdict);
2505
3123
  return;
2506
3124
  }
3125
+ if (sent && !verdict.roomInputQueued && meta.hub_room_context_generation)
3126
+ this.roomInputHandedOff(meta);
2507
3127
  const id = meta.handoff_redelivery;
2508
3128
  if (!id)
2509
3129
  return;
@@ -2545,12 +3165,24 @@ export class Daemon extends EventEmitter {
2545
3165
  */
2546
3166
  watchQueuedHandoff(entry) {
2547
3167
  const spawn = this.spawnGeneration, fence = this.launchFenceEpoch, epoch = this.deliveryEpoch;
3168
+ // M-2403: a native or remote pane's record is read through its runner (the runtime reader), a local one from its file.
3169
+ let source;
3170
+ if (entry.runtime) {
3171
+ try {
3172
+ source = { reader: this.nativeTranscriptReader(entry.runtime, { marker: entry.marker, ...(entry.wire !== undefined ? { wire: entry.wire } : {}) }) };
3173
+ }
3174
+ catch (err) {
3175
+ this.logger.debug({ err, handoff: entry.id }, "Queued hand-off: its pane's transcript is not readable now");
3176
+ return this.settleQueuedHandoff(entry, "unverifiable", "transcript:unavailable");
3177
+ }
3178
+ }
3179
+ else
3180
+ source = { path: entry.path, offset: entry.offset };
2548
3181
  const started = consumedWatches.start({
2549
3182
  deliveryId: `handoff:${entry.id}`,
2550
3183
  attemptNo: entry.redeliveries,
2551
3184
  backend: entry.backend,
2552
- path: entry.path,
2553
- offset: entry.offset,
3185
+ ...source,
2554
3186
  marker: entry.marker,
2555
3187
  ...(entry.wire !== undefined ? { wire: entry.wire } : {}),
2556
3188
  // A cancel or stop moves the epoch: the watch ends quietly (a cancel cleared the record, a stop leaves it).
@@ -2581,6 +3213,8 @@ export class Daemon extends EventEmitter {
2581
3213
  const meta = entry.meta;
2582
3214
  const status = channelStatus(meta);
2583
3215
  if (outcome === "taken") {
3216
+ if (meta.hub_room_context_generation)
3217
+ this.roomInputHandedOff(meta);
2584
3218
  this.logger.info({ handoff: entry.id, proof, redeliveries: entry.redeliveries }, "Queued hand-off taken by the CLI");
2585
3219
  if (status)
2586
3220
  this.emit("message_confirmed", status);
@@ -2628,8 +3262,20 @@ export class Daemon extends EventEmitter {
2628
3262
  const spawn = this.spawnGeneration, fence = this.launchFenceEpoch, epoch = this.deliveryEpoch;
2629
3263
  const fresh = () => spawn === this.spawnGeneration && fence === this.launchFenceEpoch && epoch === this.deliveryEpoch
2630
3264
  && !this.deliveryWritesStopping;
2631
- let redelivered = 0, taken = 0, unverifiable = 0;
3265
+ let redelivered = 0, taken = 0, unverifiable = 0, watching = 0;
2632
3266
  for (const entry of entries) {
3267
+ if (entry.runtime) {
3268
+ const outcome = await this.reconcileRuntimeHandoff(entry, holder, fresh);
3269
+ if (outcome === "stale")
3270
+ return;
3271
+ if (outcome === "taken")
3272
+ taken++;
3273
+ else if (outcome === "unverifiable")
3274
+ unverifiable++;
3275
+ else if (outcome === "watching")
3276
+ watching++;
3277
+ continue;
3278
+ }
2633
3279
  const kind = await scanTranscriptForDeliveryMarker(entry.path, entry.offset, entry.backend, { marker: entry.marker, ...(entry.wire !== undefined ? { wire: entry.wire } : {}) });
2634
3280
  // This CLI is gone already, or a cancel came: the next CLI settles them (a cancel cleared them).
2635
3281
  if (!fresh())
@@ -2669,7 +3315,71 @@ export class Daemon extends EventEmitter {
2669
3315
  this.pushChannelMessage(entry.content, { ...meta, handoff_redelivery: entry.id,
2670
3316
  handoff_redeliveries: String(next.redeliveries), handoff_holder: next.holder }, undefined, epoch);
2671
3317
  }
2672
- this.logger.info({ instance: this.name, redelivered, taken, unverifiable, proof: "transcript" }, "Queued hand-offs left by the previous CLI settled");
3318
+ this.logger.info({ instance: this.name, redelivered, taken, unverifiable, watching, proof: "transcript" }, "Queued hand-offs left by the previous CLI settled");
3319
+ }
3320
+ /**
3321
+ * M-2403: a native or remote pane's record, after this daemon came up. Its runner may have kept the CLI (and its queue)
3322
+ * across the coordinator's restart, so nothing here proves the queue is gone, and a runtime record is never
3323
+ * redelivered. Read through the runner from its checkpoint (bounded, as reconcileNativePaneTarget): taken → ✅; the
3324
+ * same launch still current with the marker not taken yet → watched again under this CLI; that launch gone, or its
3325
+ * transcript unreadable → unverifiable (reported, never pasted again).
3326
+ */
3327
+ async reconcileRuntimeHandoff(entry, holder, fresh) {
3328
+ const still = () => {
3329
+ let current;
3330
+ try {
3331
+ current = this.handoffStore().get(entry.id);
3332
+ }
3333
+ catch {
3334
+ current = undefined;
3335
+ }
3336
+ return !!current && current.holder === entry.holder && current.redeliveries === entry.redeliveries;
3337
+ };
3338
+ const native = this.nativePaneLifecycle;
3339
+ let kind = null;
3340
+ if (native?.current(entry.runtime)) {
3341
+ let reader;
3342
+ try {
3343
+ reader = this.nativeTranscriptReader(entry.runtime, { marker: entry.marker, ...(entry.wire !== undefined ? { wire: entry.wire } : {}) });
3344
+ for (let n = 0; n < 8; n++) {
3345
+ const before = reader.readPosition, look = await reader.look();
3346
+ if (!fresh())
3347
+ return "stale";
3348
+ kind = look;
3349
+ if (markerConsumed(look) || look === "unavailable" || look === "pending" || reader.readPosition === before)
3350
+ break;
3351
+ }
3352
+ }
3353
+ catch {
3354
+ kind = "unavailable";
3355
+ }
3356
+ finally {
3357
+ reader?.close?.();
3358
+ }
3359
+ }
3360
+ if (!fresh())
3361
+ return "stale";
3362
+ if (!still())
3363
+ return "skipped";
3364
+ if (kind && markerConsumed(kind)) {
3365
+ this.settleQueuedHandoff(entry, "taken", `restart-transcript:${kind}`);
3366
+ return "taken";
3367
+ }
3368
+ if (kind === null || kind === "unavailable" || !native?.current(entry.runtime)) {
3369
+ this.settleQueuedHandoff(entry, "unverifiable", "restart-transcript:unavailable");
3370
+ return "unverifiable";
3371
+ }
3372
+ // The same launch still holds it in its queue: this CLI watches it from where the read stopped.
3373
+ const next = { ...entry, holder };
3374
+ try {
3375
+ this.handoffStore().put(next);
3376
+ }
3377
+ catch (err) {
3378
+ this.logger.warn({ err, handoff: entry.id }, "Could not update a queued hand-off record");
3379
+ return "skipped";
3380
+ }
3381
+ this.watchQueuedHandoff(next);
3382
+ return "watching";
2673
3383
  }
2674
3384
  finishDurableSubmission(delivery, verdict) {
2675
3385
  // Legacy backends may accept a pane write without enough pane evidence to
@@ -2859,6 +3569,8 @@ export class Daemon extends EventEmitter {
2859
3569
  const oomStop = readSessionOomStop(this.instanceDir);
2860
3570
  if (oomStop.blocked)
2861
3571
  return sessionOomStopHint(oomStop);
3572
+ if (this.staleAuthIssue())
3573
+ return t("inst.codex_stale_auth");
2862
3574
  if (this.pauseWakeState !== "active")
2863
3575
  return t("delivery.hold_state", this.pauseWakeState);
2864
3576
  if (this.inputBlockedDialogKey !== null)
@@ -2985,6 +3697,14 @@ export class Daemon extends EventEmitter {
2985
3697
  // 1. IPC server — bridge between MCP server (Claude's child) and daemon
2986
3698
  const sockPath = join(this.instanceDir, "channel.sock");
2987
3699
  this.ipcServer = new IpcServer(sockPath, this.logger);
3700
+ this.requestContextStartupResources?.ipc.add(this.ipcServer);
3701
+ if (this.requestContextHelper)
3702
+ this.ipcServer.setMessageAdmission((message, socket) => {
3703
+ const admitted = this.requestContextHelper.admit(message, socket);
3704
+ if (!admitted)
3705
+ this.logger.warn({ instance: this.name }, "old_launch_helper_refused");
3706
+ return admitted;
3707
+ });
2988
3708
  // Forward IPC server errors as daemon events (prevents unhandled 'error' crash).
2989
3709
  // Guard: only forward post-listen errors — startup errors are handled by listen() rejection.
2990
3710
  let ipcListening = false;
@@ -3005,7 +3725,7 @@ export class Daemon extends EventEmitter {
3005
3725
  this.ipcServer.on("message", (msg, socket) => {
3006
3726
  if (msg.type === "tool_call") {
3007
3727
  // MCP server forwarding a Claude tool call (reply, react, edit, download)
3008
- this.handleToolCall(msg, socket);
3728
+ this.handleOwnedToolCall(msg, socket);
3009
3729
  }
3010
3730
  else if (msg.type === "mcp_ready") {
3011
3731
  this.handleMcpReady(msg, socket);
@@ -3026,6 +3746,7 @@ export class Daemon extends EventEmitter {
3026
3746
  }
3027
3747
  // Batch response for prune path
3028
3748
  this.ipcServer?.send(socket, { type: "query_sessions_response", sessions });
3749
+ this.ipcServer?.send(socket, this.hubAnswerTurnStateMessage()); // M-3660: a fresh connection learns the current turn
3029
3750
  }
3030
3751
  else
3031
3752
  this.handleFleetMessage(msg, reply => { this.ipcServer?.send(socket, reply); });
@@ -3051,6 +3772,11 @@ export class Daemon extends EventEmitter {
3051
3772
  // bounded dialog/readiness scan as local startup. An already-running reattachment may be busy: do not
3052
3773
  // wait for that work to finish or inject a startup key into it.
3053
3774
  if (acquired.disposition === "reattached") {
3775
+ // A surviving process predates this daemon's first-hop binding. Its queued helper bytes
3776
+ // cannot prove a turn, even after a later input installs a new proof on that launch.
3777
+ // Keep the one-contact approval fallback until a genuinely new process is launched.
3778
+ if (this.requestContextLifecycle)
3779
+ this.requestContextInterruptedLaunch = this.requestContextLaunch();
3054
3780
  if (this.backend?.binaryName === "codex") {
3055
3781
  const native = this.nativePaneLifecycle, spawn = this.spawnGeneration, fence = this.launchFenceEpoch, attempt = this.launchAttempt;
3056
3782
  try {
@@ -3133,6 +3859,10 @@ export class Daemon extends EventEmitter {
3133
3859
  }
3134
3860
  if (nativeDisposition)
3135
3861
  this.isNewSession = nativeDisposition === "fresh";
3862
+ if (nativeDisposition === "fresh")
3863
+ this.requestContextNewWork("fresh");
3864
+ this.resetRoomConversation(nativeDisposition === "reattached");
3865
+ this.settleHubAnswerTurnAtLaunch(nativeDisposition === "reattached");
3136
3866
  // #1209: conditional continuation for the turn interrupted by the last
3137
3867
  // restart, if the gates allow. Detached; the gate
3138
3868
  // consumes its one-shot marker first and never throws into boot.
@@ -3712,9 +4442,12 @@ export class Daemon extends EventEmitter {
3712
4442
  return;
3713
4443
  }
3714
4444
  const native = this.nativePaneLifecycle, pane = this.tmux;
4445
+ const footprintObservedAt = this.footprintEnabled ? Date.now() : 0, footprintOwner = this.footprintEnabled ? JSON.stringify(this.interactionOwner()) : null;
3715
4446
  const status = await pane?.getPaneStatus();
3716
4447
  if (this.runtimeMonitorsFrozen || native !== this.nativePaneLifecycle || pane !== this.tmux)
3717
4448
  return;
4449
+ if (this.footprintEnabled && status?.alive && status.pid && footprintOwner === JSON.stringify(this.interactionOwner()))
4450
+ this.footprintPane = { pid: status.pid, owner: footprintOwner, observedAt: footprintObservedAt, pane };
3718
4451
  const snapshot = native.snapshot?.();
3719
4452
  if (status?.alive === false && snapshot?.state === "exited") {
3720
4453
  this.healthCheckPaused = true;
@@ -3755,12 +4488,15 @@ export class Daemon extends EventEmitter {
3755
4488
  scheduleNext();
3756
4489
  return true;
3757
4490
  };
4491
+ const footprintObservedAt = this.footprintEnabled ? Date.now() : 0;
3758
4492
  let paneStatus = await healthTmux.getPaneStatus();
3759
4493
  // Auto-pause intentionally exits the pane process. A health tick that
3760
4494
  // began just before pause must not classify that exit as a crash.
3761
4495
  if (discardStaleHealth())
3762
4496
  return;
3763
4497
  if (paneStatus?.alive) {
4498
+ if (this.footprintEnabled && footprintObservedAt > 0 && paneStatus.pid)
4499
+ this.footprintPane = { pid: paneStatus.pid, owner: JSON.stringify(healthOwner), observedAt: footprintObservedAt, pane: healthTmux };
3764
4500
  // A CLI shutdown also closes its MCP children. Revive tools only for
3765
4501
  // a positively live pane, never while its exit is being classified.
3766
4502
  measureSyncWork("daemon.healthCheck", () => this.checkMcpServerAlive());
@@ -4367,7 +5103,7 @@ export class Daemon extends EventEmitter {
4367
5103
  const loginFlow = LOGIN_FLOWS[this.config.backend ?? "claude-code"];
4368
5104
  if (loginFlow?.loginScreenActive && this.reportLoginScreen(pane))
4369
5105
  return;
4370
- const interactivePrompt = this.interactivePromptDetector.observe(pane, Date.now(), this.instanceStateLastOutputAt);
5106
+ const interactivePrompt = dialogs.some(d => d.humanOnly && Daemon.dialogMatches(d, pane)) ? null : this.interactivePromptDetector.observe(pane, Date.now(), this.instanceStateLastOutputAt);
4371
5107
  if (interactivePrompt) {
4372
5108
  this.logger.warn(interactivePrompt, "Interactive terminal prompt is waiting for human input");
4373
5109
  // M-2269: the prompt as it was on screen, from this capture, for the Log.
@@ -4602,6 +5338,8 @@ export class Daemon extends EventEmitter {
4602
5338
  }
4603
5339
  /** Evaluate one pane snapshot. Kept synchronous so state-machine edges are unit-testable. */
4604
5340
  evaluateErrorPatterns(pane, patterns, readyPattern, now = Date.now(), busyPattern = null) {
5341
+ if (this.staleAuthIssue())
5342
+ return; // Ready chrome and recovery deadlines cannot repair this process.
4605
5343
  // Count occurrences across the WHOLE pane (not just text after the last
4606
5344
  // ready prompt). One shared counter (the static below): arm requires
4607
5345
  // count > baseline, so a drifted clone here would silently gate nudges.
@@ -4712,7 +5450,7 @@ export class Daemon extends EventEmitter {
4712
5450
  // composer to establish its baseline; later appended occurrences remain eligible.
4713
5451
  if ((ep.type === "rate_limit" && ep.action === "nudge_continue") || ep.historyUntilLiveComposer) {
4714
5452
  const baseline = this.nudgeBaselines?.get(key);
4715
- if (baseline === undefined || count <= baseline) {
5453
+ if ((baseline === undefined || count <= baseline) && !(ep.type === "stale_auth" && newQuotaAfterInput)) {
4716
5454
  if (baseline !== undefined)
4717
5455
  this.lastErrorCount.set(key, count);
4718
5456
  continue;
@@ -4810,6 +5548,10 @@ export class Daemon extends EventEmitter {
4810
5548
  });
4811
5549
  return;
4812
5550
  }
5551
+ if (ep.type === "stale_auth") {
5552
+ this.staleAuth = { generation: this.spawnGeneration, since: now };
5553
+ this.authFailureUnresolved = true;
5554
+ }
4813
5555
  // #2795: auth text on the pane proves nothing about the credentials (22 of 22 such matches on the main host were
4814
5556
  // conversation text). It arms nothing here; it only asks the lifecycle's token-free check, and a failing check
4815
5557
  // arms the auth state through confirmAuthFailure().
@@ -4888,7 +5630,7 @@ export class Daemon extends EventEmitter {
4888
5630
  const screen = await tmux.capturePane().catch(() => null);
4889
5631
  if (screen === null)
4890
5632
  return;
4891
- await tmux.sendSpecialKey(cancelKey, undefined, { kind: "dialog", screen });
5633
+ await tmux.sendSpecialKey(cancelKey, undefined, { kind: "dialog", screen, cancelTurn: true });
4892
5634
  return;
4893
5635
  }
4894
5636
  await tmux.sendSpecialKey(cancelKey);
@@ -4904,6 +5646,7 @@ export class Daemon extends EventEmitter {
4904
5646
  // current human turn; leave already-forwarded tool requests to settle.
4905
5647
  this.recoveryCancelled = true;
4906
5648
  this.turnReplyGuard.cancelByUser();
5649
+ this.replyDraft.reset();
4907
5650
  // #1241: a cancelled turn never confirms — its next edge completes it as
4908
5651
  // intentional. Drop a pending confirmation so it cannot promote afterwards.
4909
5652
  this.clearReplyGuardConfirm();
@@ -5037,6 +5780,8 @@ export class Daemon extends EventEmitter {
5037
5780
  return;
5038
5781
  }
5039
5782
  const verdict = { reached: false };
5783
+ let codexBefore = null;
5784
+ let cliBefore = null;
5040
5785
  try {
5041
5786
  await this.wake();
5042
5787
  if (!this.isDeliveryEpochCurrent(deliveryEpoch)) {
@@ -5046,6 +5791,27 @@ export class Daemon extends EventEmitter {
5046
5791
  tellWritten(false);
5047
5792
  return;
5048
5793
  }
5794
+ // M-3175: a codex switch is typed only into an idle pane of a codex known to take it, with the rollout's end taken first.
5795
+ if (ownSwitch?.codex) {
5796
+ const gate = await this.codexSwitchGate();
5797
+ if ("blocked" in gate) {
5798
+ this.logger.info({ requested: ownSwitch.codex, reason: gate.blocked, version: gate.version }, "Codex runtime switch not typed");
5799
+ reportSwitch({ outcome: "not_sent", reason: gate.blocked, version: gate.version ?? null });
5800
+ tellWritten(false);
5801
+ return;
5802
+ }
5803
+ codexBefore = gate;
5804
+ }
5805
+ if (ownSwitch?.cli) {
5806
+ const gate = await this.cliSwitchGate(ownSwitch.cli);
5807
+ if ("blocked" in gate) {
5808
+ this.logger.info({ requested: ownSwitch.cli, reason: gate.blocked, version: gate.version }, "CLI runtime switch not typed");
5809
+ reportSwitch({ outcome: "not_sent", reason: gate.blocked, version: gate.version ?? null });
5810
+ tellWritten(false);
5811
+ return;
5812
+ }
5813
+ cliBefore = gate;
5814
+ }
5049
5815
  // Board 907c7899: the pane just before this attempt's paste — after its readiness wait, last capture and fence,
5050
5816
  // under the paste lock (no other input lands in between). Each attempt looks again.
5051
5817
  const lookBefore = async () => {
@@ -5060,8 +5826,10 @@ export class Daemon extends EventEmitter {
5060
5826
  preserveExactBytes: true,
5061
5827
  // #1690: our own /model holds every other delivery from its write on — before the lock is released, so a steer
5062
5828
  // or /btw waiting on it cannot type into the gap before claude paints "Switch model?" (default cursor: Yes).
5063
- ...(ownSwitch || notifyWritten || contextReset ? { onPaneWritten: () => { if (contextReset)
5064
- this.resetInboundPresentation(); if (ownSwitch) {
5829
+ ...(ownSwitch || notifyWritten || contextReset ? { onPaneWritten: () => { if (contextReset) {
5830
+ this.resetInboundPresentation();
5831
+ this.resetRoomConversation();
5832
+ } if (ownSwitch) {
5065
5833
  this.ownSwitch = ownSwitch;
5066
5834
  if (currentModelOwner())
5067
5835
  modelObserver?.ownIntent(ownSwitch.requested);
@@ -5115,7 +5883,7 @@ export class Daemon extends EventEmitter {
5115
5883
  reportSwitch({ outcome: "not_sent" }); // its write never began
5116
5884
  else {
5117
5885
  try {
5118
- reportSwitch(await this.answerOwnSwitchDialog(ownSwitch));
5886
+ reportSwitch(ownSwitch.codex ? await this.verifyCodexSwitch(ownSwitch.codex, codexBefore) : ownSwitch.cli ? await this.verifyCliSwitch(ownSwitch.cli, cliBefore) : await this.answerOwnSwitchDialog(ownSwitch));
5119
5887
  }
5120
5888
  catch (err) {
5121
5889
  this.logger.warn({ err: err.message }, "Answering our own model switch failed");
@@ -5145,11 +5913,118 @@ export class Daemon extends EventEmitter {
5145
5913
  return;
5146
5914
  }
5147
5915
  const sw = msg.runtime_switch;
5148
- const ownSwitch = sw && typeof sw.id === "string" && sw.kind === "model" && typeof sw.requested === "string"
5149
- ? { id: sw.id, kind: "model", requested: sw.requested } : undefined;
5916
+ const codexPart = (v) => v === null ? null : typeof v === "string" && v ? v : undefined;
5917
+ const codex = sw?.codex && typeof sw.codex === "object" ? { model: codexPart(sw.codex.model), effort: codexPart(sw.codex.effort) } : undefined;
5918
+ // M-3180: one generic spec for the CLIs of CLI_RUNTIME_SWITCH — a known backend and one command (which may carry both model and effort).
5919
+ const rawCli = sw?.cli;
5920
+ const cli = rawCli && typeof rawCli === "object" && typeof rawCli.backend === "string" && Object.hasOwn(CLI_RUNTIME_SWITCH, rawCli.backend)
5921
+ ? { backend: rawCli.backend, model: codexPart(rawCli.model), effort: codexPart(rawCli.effort) } : rawCli === undefined ? undefined : null;
5922
+ const cliOk = !cli || (cli.model !== undefined && cli.effort !== undefined && (cli.model !== null || cli.effort !== null)
5923
+ && CLI_RUNTIME_SWITCH[cli.backend].command({ model: cli.model, effort: cli.effort }) === msg.content);
5924
+ // A malformed switch must not downgrade into an ungated legacy raw paste.
5925
+ if (rawCli !== undefined && (cli === null || !cliOk || codex || !sw || typeof sw.id !== "string" || sw.kind !== "model" || typeof sw.requested !== "string")) {
5926
+ if (typeof sw?.id === "string")
5927
+ this.broadcastFleetMessage({ type: "runtime_switch_result", id: sw.id, outcome: "not_sent", reason: "command" });
5928
+ return;
5929
+ }
5930
+ const ownSwitch = sw && typeof sw.id === "string" && sw.kind === "model" && typeof sw.requested === "string" && cli !== null && cliOk && !(codex && cli)
5931
+ && (!codex || (codex.model !== undefined && codex.effort !== undefined && (codex.model !== null || codex.effort !== null)))
5932
+ ? { id: sw.id, kind: "model", requested: sw.requested,
5933
+ ...(codex ? { codex: { model: codex.model, effort: codex.effort } } : {}),
5934
+ ...(cli ? { cli: { backend: cli.backend, model: cli.model, effort: cli.effort } } : {}) } : undefined;
5150
5935
  const notifyWritten = typeof msg.notify_written === "string" && /^[0-9a-f]{16}$/.test(msg.notify_written) ? msg.notify_written : undefined;
5151
5936
  this.queueRawPaste(msg.content, this.captureDeliveryEpoch(msg.delivery_epoch), msg.confirm_clear === true, durableAttempt ? { ...durableAttempt, submissionMode: "raw_paste", silentSchedule: msg.silent_schedule === true } : undefined, ownSwitch, notifyWritten, msg.context_reset === "clear" || msg.context_reset === "compact" ? msg.context_reset : undefined);
5152
5937
  }
5938
+ /**
5939
+ * M-3175: before typing a codex `/model … --reasoning=…`: the pane authoritatively idle (bounded), the RUNNING codex at a
5940
+ * version that has the inline form (an older one would send the line to the model as a prompt), and what the switch is
5941
+ * verified against afterwards — the rollout's end when the session has one, and the count of codex's answers on the pane.
5942
+ */
5943
+ async codexSwitchGate() {
5944
+ const tmux = this.tmux;
5945
+ if (!tmux || !await this.waitForAuthoritativePaneIdle(CODEX_SWITCH_IDLE_MS, 500) || this.tmux !== tmux)
5946
+ return { blocked: "busy" };
5947
+ const pid = await tmux.getPanePid?.() ?? null;
5948
+ const version = pid ? await codexRunningVersion(pid) : null;
5949
+ if (!codexSupportsInlineModel(version))
5950
+ return { blocked: "version", version };
5951
+ const pane = await tmux.capturePaneWithHistory(CODEX_SWITCH_HISTORY_LINES).catch(() => "");
5952
+ let rollout = null;
5953
+ const session = this.backend?.readRawPasteSession?.(pane);
5954
+ if (session) {
5955
+ const file = await checkpointCodexPane(session.sessionsDir, session.sessionId, this.config.working_directory || process.cwd()).catch(() => null);
5956
+ if (file)
5957
+ rollout = { path: file.path, offset: file.offset };
5958
+ }
5959
+ return { rollout, answers: codexSwitchAnswerCount(pane), version };
5960
+ }
5961
+ /**
5962
+ * M-3180: before typing a CLI_RUNTIME_SWITCH step: the pane authoritatively idle (bounded), the RUNNING binary at the entry's minimum
5963
+ * for this step, and what the verdict compares against — the scrollback before the command and the entry's record checkpoint.
5964
+ */
5965
+ async cliSwitchGate(step) {
5966
+ const tmux = this.tmux, entry = CLI_RUNTIME_SWITCH[step.backend];
5967
+ if (!entry || !tmux || !await this.waitForAuthoritativePaneIdle(CODEX_SWITCH_IDLE_MS, 500) || this.tmux !== tmux)
5968
+ return { blocked: "busy" };
5969
+ const pid = await tmux.getPanePid?.() ?? null;
5970
+ const version = pid ? await cliRunningVersion(pid, { backend: step.backend, matchExe: entry.matchExe, versionFromExe: entry.versionFromExe }) : null;
5971
+ if (!cliSwitchAllowed(entry, step, version))
5972
+ return { blocked: "version", version };
5973
+ const pane = await tmux.capturePaneWithHistory(CODEX_SWITCH_HISTORY_LINES).catch(() => "");
5974
+ const record = entry.checkpoint ? await entry.checkpoint(pane, this.config.working_directory || process.cwd(), pid).catch(() => undefined) : undefined;
5975
+ return { pane, ...(record !== undefined ? { record } : {}) };
5976
+ }
5977
+ /** M-3180: the entry's verdict on the scrollback after the step, against the one before it; nothing in time is not confirmed. */
5978
+ async verifyCliSwitch(step, before) {
5979
+ const tmux = this.tmux, entry = CLI_RUNTIME_SWITCH[step.backend];
5980
+ if (!tmux || !before || !entry)
5981
+ return { outcome: "not_confirmed" };
5982
+ const deadline = performance.now() + CODEX_SWITCH_VERIFY_MS;
5983
+ while (performance.now() < deadline && this.tmux === tmux) {
5984
+ const pane = await tmux.capturePaneWithHistory(CODEX_SWITCH_HISTORY_LINES).catch(() => "");
5985
+ const verdict = await entry.verify({ model: step.model, effort: step.effort }, before, { pane });
5986
+ if (verdict?.outcome === "switched")
5987
+ return { outcome: "switched", confirmed: true, shown: verdict.shown };
5988
+ if (verdict?.outcome === "mismatch")
5989
+ return { outcome: "mismatch", shown: verdict.shown, answered: true };
5990
+ await new Promise(resolve => setTimeout(resolve, 200));
5991
+ }
5992
+ return { outcome: "not_confirmed" };
5993
+ }
5994
+ /**
5995
+ * M-3175: what our codex switch came to. The rollout's `thread_settings_applied` written after our checkpoint is the proof
5996
+ * (codex writes it at once once the session has a rollout); a session with none yet has codex's own answer on the pane —
5997
+ * a NEW `• Model changed to … for this session only` (or `■` refusal) after the ones counted before the line was typed.
5998
+ * Anything that does not name what was asked is a mismatch; no answer in time is not confirmed. The fleet restarts on both.
5999
+ */
6000
+ async verifyCodexSwitch(want, before) {
6001
+ const tmux = this.tmux;
6002
+ if (!tmux || !before)
6003
+ return { outcome: "not_confirmed" };
6004
+ const fits = (model, effort) => (want.model === null || model === want.model) && (want.effort === null || effort === want.effort);
6005
+ const deadline = performance.now() + CODEX_SWITCH_VERIFY_MS;
6006
+ while (performance.now() < deadline && this.tmux === tmux) {
6007
+ if (before.rollout) {
6008
+ const applied = codexAppliedFromRollout(await readFrom(before.rollout.path, before.rollout.offset, CODEX_SWITCH_ROLLOUT_READ));
6009
+ if (applied) {
6010
+ const shown = `${applied.model} ${applied.effort ?? "default"}`;
6011
+ return fits(applied.model, applied.effort) ? { outcome: "switched", confirmed: true, shown } : { outcome: "mismatch", shown, answered: true };
6012
+ }
6013
+ }
6014
+ const pane = await tmux.capturePaneWithHistory(CODEX_SWITCH_HISTORY_LINES).catch(() => "");
6015
+ if (codexSwitchAnswerCount(pane) > before.answers) {
6016
+ const answer = codexSwitchFromPane(pane);
6017
+ if (answer?.kind === "refused")
6018
+ return { outcome: "mismatch", shown: answer.text, answered: true };
6019
+ if (answer?.kind === "switched" && !before.rollout) {
6020
+ const shown = `${answer.model} ${answer.effort}`;
6021
+ return fits(answer.model, answer.effort) ? { outcome: "switched", confirmed: true, shown } : { outcome: "mismatch", shown, answered: true };
6022
+ }
6023
+ }
6024
+ await new Promise(resolve => setTimeout(resolve, 200));
6025
+ }
6026
+ return { outcome: "not_confirmed" };
6027
+ }
5153
6028
  /**
5154
6029
  * #1690 (the user's choice A): after AgEnD's own `/model <name>`, claude may ask "Switch model?" (a warm cache for
5155
6030
  * another model). When the model it names is the one asked for, answer Yes; otherwise No (Escape — `Kept model as …`),
@@ -5513,6 +6388,7 @@ export class Daemon extends EventEmitter {
5513
6388
  this.logger.info("Stopping daemon instance");
5514
6389
  this.clearQuitRelaunchWatch();
5515
6390
  this.fenceDeliveryWritesForStop();
6391
+ this.requestContextHelper?.revoke();
5516
6392
  this.turnReplyGuard.reset();
5517
6393
  this.clearReplyGuardConfirm();
5518
6394
  this.sawBlockedInput = false;
@@ -5534,6 +6410,7 @@ export class Daemon extends EventEmitter {
5534
6410
  this.healthCheckPaused = true;
5535
6411
  this.saveSessionId();
5536
6412
  await this.nativePaneLifecycle.release(options.nativePane ?? "detach");
6413
+ await this.ipcServer?.close();
5537
6414
  try {
5538
6415
  unlinkSync(join(this.instanceDir, "daemon.pid"));
5539
6416
  }
@@ -5607,7 +6484,7 @@ export class Daemon extends EventEmitter {
5607
6484
  await this.ipcServer?.close();
5608
6485
  // Clean up backend config files
5609
6486
  if (this.backend?.cleanup) {
5610
- this.backend.cleanup(this.buildBackendConfig());
6487
+ this.backend.cleanup(this.buildBackendConfig(false));
5611
6488
  }
5612
6489
  // Clean up checked-out repos
5613
6490
  try {
@@ -5660,6 +6537,16 @@ export class Daemon extends EventEmitter {
5660
6537
  }
5661
6538
  return { ...snapshot, interaction: this.getInteractionSnapshot() };
5662
6539
  }
6540
+ footprintEnabled = false;
6541
+ footprintPane = null;
6542
+ setHostFootprintEnabled(enabled) { this.footprintEnabled = enabled; if (!enabled)
6543
+ this.footprintPane = null; }
6544
+ hostFootprintRoot() {
6545
+ const cached = this.footprintPane;
6546
+ if (!this.footprintEnabled || !cached || cached.pane !== this.tmux || cached.owner !== JSON.stringify(this.interactionOwner()) || this.isPaused || this.spawning || this.healthCheckPaused || this.runtimeMonitorsFrozen || Date.now() - cached.observedAt > 120000)
6547
+ return null;
6548
+ return { pid: cached.pid, owner: cached.owner, observedAt: cached.observedAt };
6549
+ }
5663
6550
  interactionOwner() {
5664
6551
  return { bootId: this.bootId, spawnGeneration: this.spawnGeneration,
5665
6552
  launchAttempt: this.launchAttempt, launchFenceEpoch: this.launchFenceEpoch };
@@ -5708,13 +6595,17 @@ export class Daemon extends EventEmitter {
5708
6595
  /** Local system work: no user turn, channel reply target, wake or replay of an original request. */
5709
6596
  async deliverWorkingRecovery(content, delivery, admitted) {
5710
6597
  const tmux = this.tmux, owner = JSON.stringify(this.interactionOwner()), epoch = this.deliveryEpoch;
5711
- const current = () => this.tmux === tmux && owner === JSON.stringify(this.interactionOwner())
6598
+ let begun = false;
6599
+ const current = () => (begun || !this.requestContextAdmission || this.requestContextAdmission.available()) && this.tmux === tmux && owner === JSON.stringify(this.interactionOwner())
5712
6600
  && this.deliveryEpoch === epoch && !this.deliveryWritesStopping && !this.runtimeMonitorsFrozen
5713
6601
  && !this.spawning && !this.startupAborted && !this.isPaused && !this.healthCheckPaused
5714
6602
  && this.processStatus === "running" && this.pasteQueueDepth === 0
5715
6603
  && (this.workingRecoveryInputOwner === owner || this.instanceState === "idle" && !this.recoveryNativeWork)
5716
6604
  && this.recoveryBootSettled && !this.recoveryCancelled && !this.isSessionOomStopped() && admitted();
5717
- let begun = false;
6605
+ const heldCurrent = () => this.tmux === tmux && owner === JSON.stringify(this.interactionOwner())
6606
+ && this.deliveryEpoch === epoch && !this.deliveryWritesStopping && !this.startupAborted && admitted();
6607
+ if (this.requestContextAdmission && !await this.requestContextAdmission.wait(heldCurrent))
6608
+ return;
5718
6609
  try {
5719
6610
  await this.paneWriteLock.run(async () => {
5720
6611
  if (!tmux || !current())
@@ -5773,6 +6664,7 @@ export class Daemon extends EventEmitter {
5773
6664
  }
5774
6665
  }
5775
6666
  workingTurnDelivery = null;
6667
+ workingTurnRequestContext = null;
5776
6668
  workingBackgroundObservation = null;
5777
6669
  /** Pure metadata read: never discovers sessions, captures a pane or reads backend files. */
5778
6670
  getWorkingStateObservation() {
@@ -5910,8 +6802,13 @@ export class Daemon extends EventEmitter {
5910
6802
  }
5911
6803
  /** Shared Fleet inputs: socket and native transports retain the same wake, epoch and raw-paste semantics. */
5912
6804
  handleFleetMessage(msg, send, current = () => true) {
6805
+ if (msg.type === "hub_room_tools_changed") {
6806
+ this.ipcServer?.broadcast({ type: "hub_room_tools_changed" });
6807
+ return true;
6808
+ }
5913
6809
  if (msg.type === "query_sessions") {
5914
6810
  send({ type: "query_sessions_response", sessions: [] });
6811
+ send(this.hubAnswerTurnStateMessage()); // M-3660
5915
6812
  }
5916
6813
  else if (msg.type === "fleet_inbound") {
5917
6814
  const meta = msg.meta;
@@ -5922,7 +6819,11 @@ export class Daemon extends EventEmitter {
5922
6819
  this.deferDurableDelivery(meta, "native channel owner changed before pane submission");
5923
6820
  return;
5924
6821
  }
5925
- this.pushChannelMessage(msg.content, meta, targetSession, deliveryEpoch);
6822
+ const inputId = this.requestContextLifecycle && isHubQuestionMeta(meta) && typeof msg.request_context_input_id === "string" ? msg.request_context_input_id : undefined;
6823
+ if (inputId)
6824
+ this.pushChannelMessage(msg.content, meta, targetSession, deliveryEpoch, inputId);
6825
+ else
6826
+ this.pushChannelMessage(msg.content, meta, targetSession, deliveryEpoch);
5926
6827
  }).catch(err => {
5927
6828
  this.deferDurableDelivery(meta, `target wake failed before pane submission: ${err.message}`);
5928
6829
  this.logger.error({ err: err.message }, "Wake failed for inbound delivery");
@@ -6058,7 +6959,7 @@ export class Daemon extends EventEmitter {
6058
6959
  this.pauseRequested = false;
6059
6960
  return false;
6060
6961
  }
6061
- if (!ready() || admission && !admission.accepts(text) || this.backend?.backgroundWorkRunning?.(text)
6962
+ if (!ready() || admission && !admission.accepts(text) || this.backend?.isDraftIdlePane?.(text) === true || this.backend?.backgroundWorkRunning?.(text)
6062
6963
  || !allowStuck && !this.paneAuthoritativelyIdle(text)) {
6063
6964
  this.pauseRequested = false;
6064
6965
  return false;
@@ -6216,7 +7117,8 @@ export class Daemon extends EventEmitter {
6216
7117
  // auth pause — otherwise the instance would pause again the moment it idles.
6217
7118
  this.pausePending = false;
6218
7119
  this.pauseReconfirmAuth = false;
6219
- this.authFailureUnresolved = false;
7120
+ if (!this.staleAuthIssue())
7121
+ this.authFailureUnresolved = false;
6220
7122
  this.unverifiedAuthMatch = null;
6221
7123
  this.loginScreenReported = false;
6222
7124
  this.fatalStartupReported = false;
@@ -6446,7 +7348,9 @@ export class Daemon extends EventEmitter {
6446
7348
  this.logStateEdge(previous, snapshot);
6447
7349
  this.publishWorkingState("execution");
6448
7350
  this.emit("instance_state", { name: this.name, ...snapshot });
6449
- this.broadcastFleetMessage({ type: "instance_state", instanceName: this.name, ...snapshot });
7351
+ this.broadcastFleetMessage({ type: "instance_state", instanceName: this.name, ...snapshot,
7352
+ turnEvidence: this.turnEvidence(), turnActivityAt: this.turnWatch.activityAt });
7353
+ this.noteTurnEdge(snapshot.state);
6450
7354
  if (snapshot.state === "stuck" && pane && this.instanceStateReadyPattern) {
6451
7355
  this.handleStuckTransition(pane, snapshot, this.instanceStateReadyPattern);
6452
7356
  }
@@ -6498,11 +7402,14 @@ export class Daemon extends EventEmitter {
6498
7402
  * message can arrive mid-turn and sit queued, and marking at arrival would let
6499
7403
  * the PREVIOUS turn's idle edge consume (and reset) the new turn's state.
6500
7404
  */
6501
- markTurnStarted(meta, deliveredText, deliveryEpoch = this.deliveryEpoch, queuedHandoff = false) {
7405
+ markTurnStarted(meta, deliveredText, deliveryEpoch = this.deliveryEpoch, queuedHandoff = false, verdict) {
6502
7406
  // Cancel may have interrupted an in-flight paste before its promise settled.
6503
7407
  // Its late success must not re-arm the turn that the user just cancelled.
6504
7408
  if (!this.isDeliveryEpochCurrent(deliveryEpoch))
6505
7409
  return;
7410
+ // New input, including a peer/system input, cannot inherit an earlier draft.
7411
+ // If its transcript was already polled before paste confirmation, prefer a generic recovery.
7412
+ this.replyDraft.reset();
6506
7413
  // Channel turns started by a person. Cross-instance, schedules (silent or
6507
7414
  // not), and AgEnD system notices must not expect a reply to a person (#2544):
6508
7415
  // a proxy or recovery notice would land in the last USER topic, or flag a
@@ -6510,7 +7417,9 @@ export class Daemon extends EventEmitter {
6510
7417
  // chat platform has no chat_id (its reply goes to the web chat through the
6511
7418
  // fleet's web-only sink), but it is a person waiting for an answer all the
6512
7419
  // same: the guard arms for it (alpha.2).
6513
- if (!turnExpectsPersonReply(meta)) {
7420
+ const requestContext = this.requestContextTurnSnapshot();
7421
+ const ownedReplyTarget = requestContext ? this.requestContextLifecycle?.replyTarget?.(requestContext) : null;
7422
+ if (!turnExpectsPersonReply(meta) && !ownedReplyTarget) {
6514
7423
  this.logger.debug({
6515
7424
  source: meta.source || null,
6516
7425
  user: meta.user || null,
@@ -6530,12 +7439,21 @@ export class Daemon extends EventEmitter {
6530
7439
  threadId: meta.thread_id || undefined,
6531
7440
  messageId: meta.message_id || undefined,
6532
7441
  correlationId: meta.correlation_id || undefined,
7442
+ ...(ownedReplyTarget ?? {}),
6533
7443
  inboundMarker,
6534
7444
  deliveredText,
6535
7445
  deliveredAt,
6536
- }, this.pendingWork.lastInboundTimestamp());
7446
+ }, this.pendingWork.lastInboundTimestamp(), requestContext && ownedReplyTarget ? { binding: requestContext.token, target: ownedReplyTarget } : undefined);
7447
+ if (requestContext && verdict?.pendingReply) {
7448
+ const route = this.captureRequestContextReplyRoute(requestContext);
7449
+ if (route)
7450
+ verdict.pendingReply.arm(route);
7451
+ else
7452
+ verdict.pendingReply.refuse();
7453
+ }
6537
7454
  const armed = this.turnReplyGuard.snapshot();
6538
7455
  this.workingTurnDelivery = { generation: armed.generation, deliveryId: meta.delivery_id || null };
7456
+ this.workingTurnRequestContext = requestContext ? { generation: armed.generation, snapshot: requestContext } : null;
6539
7457
  this.publishWorkingState("turn_started");
6540
7458
  // #1209: persist the in-flight turn with a seam checkpoint. A marker
6541
7459
  // that survives a restart is an interrupted turn by construction —
@@ -6887,10 +7805,176 @@ export class Daemon extends EventEmitter {
6887
7805
  * This launch's transcript monitor. #1510: its turn boundaries feed the reply guard's ledger, which starts empty
6888
7806
  * with it — a new monitor re-baselines at the transcript's end, so nothing the old one read can be attributed.
6889
7807
  */
7808
+ /** M-3239: this launch's turn as its transcript tells it (dispatcher-liveness.ts). */
7809
+ turnWatch = new TurnWatch();
7810
+ turnActivitySentAt = 0;
7811
+ hubRoomInputEpoch = 0;
7812
+ hubRoomTranscriptActivity = 0;
7813
+ hubRoomTurnActivityStart = null;
7814
+ hubRoomTurnBoot = randomUUID();
7815
+ hubRoomTurnSequence = 0;
7816
+ turnEndTimer = null;
7817
+ /**
7818
+ * M-3660: the Hub question this pane is answering as a turn of its own — from just before its write until the idle edge
7819
+ * after that turn's work (or the next write into the idle pane). The fleet keeps the agent's contact window for exactly
7820
+ * this turn: hub_question_input opens it, hub_question_turn_ended closes it.
7821
+ */
7822
+ // It is kept on disk too (hub-answer-turn.json): a daemon restarted mid-turn takes it up again, so deliveries keep
7823
+ // waiting behind it and its end is still announced; the fleet is told the current state again on every (re)connect.
7824
+ hubAnswerTurnState;
7825
+ /** Prism #4420 P2-2: the turn record exists but cannot be read — a turn may be running; fail closed until an idle edge. */
7826
+ hubAnswerTurnUnknown = false;
7827
+ get hubAnswerTurn() {
7828
+ if (this.hubAnswerTurnState === undefined) {
7829
+ const file = this.hubAnswerTurnFile(), read = file ? readHubAnswerTurn(file) : null;
7830
+ this.hubAnswerTurnUnknown = read === "unknown";
7831
+ this.hubAnswerTurnState = read === "unknown" ? null : read;
7832
+ }
7833
+ return this.hubAnswerTurnState;
7834
+ }
7835
+ /** M-3660: a turn is running, or may be (an unreadable record): nothing is handed into it. */
7836
+ hubAnswerTurnMayRun() { return this.hubAnswerTurn !== null || this.hubAnswerTurnUnknown; }
7837
+ /** The unknown is resolved (an idle edge, a write into the idle pane): no turn runs; the fleet is told "none". */
7838
+ resolveUnknownHubAnswerTurn() {
7839
+ if (!this.hubAnswerTurnUnknown)
7840
+ return;
7841
+ this.hubAnswerTurnUnknown = false;
7842
+ const file = this.hubAnswerTurnFile();
7843
+ try {
7844
+ if (file)
7845
+ rmSync(file, { force: true });
7846
+ }
7847
+ catch (err) {
7848
+ this.logger.warn({ err }, "Unreadable Hub answer turn record could not be removed");
7849
+ }
7850
+ this.broadcastFleetMessage({ type: "hub_question_turn_state", correlationId: null });
7851
+ }
7852
+ hubAnswerTurnFile() { return typeof this.instanceDir === "string" ? join(this.instanceDir, "hub-answer-turn.json") : null; }
7853
+ /** A turn's end is always kept in memory; a record that cannot be removed is read as a restored turn later (fail closed). */
7854
+ setHubAnswerTurn(turn) {
7855
+ this.hubAnswerTurnState = turn;
7856
+ const file = this.hubAnswerTurnFile();
7857
+ if (!file)
7858
+ return;
7859
+ try {
7860
+ if (turn)
7861
+ atomicWriteFileSync(file, JSON.stringify({ correlationId: turn.correlationId, contactLimit: turn.contactLimit }), { mode: 0o600 });
7862
+ else
7863
+ rmSync(file, { force: true });
7864
+ }
7865
+ catch (err) {
7866
+ // Prism #4420 P2-2: a turn that cannot be recorded is not begun — its question is not written (the caller throws).
7867
+ if (turn) {
7868
+ this.hubAnswerTurnState = null;
7869
+ throw err;
7870
+ }
7871
+ this.logger.warn({ err }, "Hub answer turn end could not be saved; a restart reads it as a turn that ends at its first idle edge");
7872
+ }
7873
+ }
7874
+ hubAnswerTurnBegins(correlationId, contactLimit = true) {
7875
+ if (correlationId !== undefined && this.hubAnswerTurn?.correlationId === correlationId)
7876
+ return; // a retried write
7877
+ this.resolveUnknownHubAnswerTurn(); // written into the idle pane: whatever might have run is over
7878
+ this.endHubAnswerTurn();
7879
+ if (correlationId === undefined)
7880
+ return;
7881
+ // Throws when the turn cannot be recorded: the question is then not written, and its delivery fails (reported).
7882
+ this.setHubAnswerTurn({ correlationId, contactLimit, sawWorking: false, restored: false });
7883
+ this.broadcastFleetMessage({ type: "hub_question_input", correlationId, contactLimit });
7884
+ }
7885
+ endHubAnswerTurn() {
7886
+ const turn = this.hubAnswerTurn;
7887
+ if (!turn)
7888
+ return;
7889
+ this.setHubAnswerTurn(null);
7890
+ this.broadcastFleetMessage({ type: "hub_question_turn_ended", correlationId: turn.correlationId });
7891
+ }
7892
+ /**
7893
+ * Lumen #4420 R2-A: a turn taken up from the record outlives nothing but the pane it ran in. A launch that starts a new
7894
+ * CLI (every launch but a native reattach) ends it, and an unreadable record resolves to "none", at once.
7895
+ */
7896
+ settleHubAnswerTurnAtLaunch(reattached) {
7897
+ if (reattached)
7898
+ return;
7899
+ if (this.hubAnswerTurn?.restored)
7900
+ this.endHubAnswerTurn();
7901
+ this.resolveUnknownHubAnswerTurn();
7902
+ }
7903
+ /** M-3660: the current Hub answer turn, told to a fleet connection when it (re)connects (a signal may have been lost). */
7904
+ hubAnswerTurnStateMessage() {
7905
+ const turn = this.hubAnswerTurn;
7906
+ if (!turn && this.hubAnswerTurnUnknown)
7907
+ return { type: "hub_question_turn_state", correlationId: null, unknown: true };
7908
+ return { type: "hub_question_turn_state", correlationId: turn?.correlationId ?? null, ...(turn ? { contactLimit: turn.contactLimit } : {}) };
7909
+ }
7910
+ /** M-3239: Claude's and Codex's transcripts tell each tool call and answer; their pane's spinner alone is not a turn. */
7911
+ turnEvidence() {
7912
+ const bin = this.backend?.binaryName;
7913
+ return (bin === "claude" || bin === "codex") && this.transcriptMonitor?.following() === true;
7914
+ }
7915
+ /** M-3239: progress for the board's quiet clock, at most every 30 s while a turn runs (the idle edge carries the last). */
7916
+ reportTurnActivity() {
7917
+ const now = Date.now();
7918
+ if (now - this.turnActivitySentAt < TURN_ACTIVITY_REPORT_MS)
7919
+ return;
7920
+ this.turnActivitySentAt = now;
7921
+ this.broadcastFleetMessage({ type: "turn_activity", instanceName: this.name, at: now });
7922
+ }
7923
+ /**
7924
+ * M-3239: on the pane's idle edge, after a moment for the transcript's last lines: the turn's final text, when it
7925
+ * messaged no one — the fleet tells the dispatcher of a claimed card if that text asks a question.
7926
+ */
7927
+ noteTurnEdge(state) {
7928
+ if (state !== "idle") {
7929
+ if (this.turnEndTimer) {
7930
+ clearTimeout(this.turnEndTimer);
7931
+ this.turnEndTimer = null;
7932
+ }
7933
+ if (state === "working") {
7934
+ this.turnWatch.begin(Date.now());
7935
+ this.hubRoomTurnActivityStart ??= this.hubRoomTranscriptActivity;
7936
+ {
7937
+ const hubTurn = this.hubAnswerTurn;
7938
+ if (hubTurn)
7939
+ hubTurn.sawWorking = true;
7940
+ }
7941
+ }
7942
+ return;
7943
+ }
7944
+ // Lumen #4420 R2-A: a turn taken up from the record ends on the first idle state, at once (no settle wait, no work proof).
7945
+ if (this.hubAnswerTurn?.restored)
7946
+ this.endHubAnswerTurn();
7947
+ if (this.turnEndTimer)
7948
+ return;
7949
+ const roomGeneration = this.roomConversationState ? this.roomConversationGeneration() : null, roomInputEpoch = this.hubRoomInputEpoch;
7950
+ this.turnEndTimer = setTimeout(() => {
7951
+ this.turnEndTimer = null; // a working edge before this cancels it: the turn went on
7952
+ const turn = this.turnWatch.end();
7953
+ // A Claude/Codex compaction spinner is not a completed model turn. Require fresh tool/text evidence.
7954
+ const bin = this.backend?.binaryName, needsTranscript = bin === "claude" || bin === "codex";
7955
+ const realWork = !needsTranscript || this.hubRoomTurnActivityStart !== null && this.hubRoomTranscriptActivity > this.hubRoomTurnActivityStart;
7956
+ this.hubRoomTurnActivityStart = null;
7957
+ // M-3660: the Hub answer turn ends only on real work (a compaction spinner is not its end: realWork needs a fresh
7958
+ // working edge AND transcript activity since it, so a flicker leaves the turn running until real work then idle) —
7959
+ // or, taken up again after a daemon restart, on the first idle edge.
7960
+ const hubTurn = this.hubAnswerTurn;
7961
+ if (hubTurn?.sawWorking && (realWork || hubTurn.restored))
7962
+ this.endHubAnswerTurn();
7963
+ else if (!hubTurn)
7964
+ this.resolveUnknownHubAnswerTurn(); // an unreadable record: the pane is idle now, nothing runs
7965
+ if (turn && realWork && roomGeneration && roomGeneration === this.roomConversationGeneration() && roomInputEpoch === this.hubRoomInputEpoch)
7966
+ this.broadcastFleetMessage({ type: "hub_room_turn_ended", generation: roomGeneration, turn: `${this.hubRoomTurnBoot}:${++this.hubRoomTurnSequence}` });
7967
+ if (!turn || turn.messaged || !turn.text.trim() || !this.turnEvidence())
7968
+ return;
7969
+ this.broadcastFleetMessage({ type: "turn_ended", instanceName: this.name, startedAt: turn.startedAt, text: turn.text.slice(-4000) });
7970
+ }, TURN_END_SETTLE_MS);
7971
+ this.turnEndTimer.unref?.();
7972
+ }
6890
7973
  buildTranscriptMonitor(source) {
6891
7974
  this.followLog.reset();
7975
+ this.replyDraft.reset();
6892
7976
  const modelLaunch = this.backend?.modelObservationLaunch?.();
6893
- const monitor = new TranscriptMonitor(this.instanceDir, this.logger, source, () => modelLaunch);
7977
+ const monitor = new TranscriptMonitor(this.instanceDir, this.logger, source, () => modelLaunch, !!this.requestContextLifecycle);
6894
7978
  let savedModel;
6895
7979
  try {
6896
7980
  const path = join(this.instanceDir, "claude-model-observation.json");
@@ -6905,6 +7989,12 @@ export class Daemon extends EventEmitter {
6905
7989
  this.claudeModelObserver = modelObserver;
6906
7990
  this.modelObservationBound = false;
6907
7991
  const owner = launchIdentity(this.interactionOwner());
7992
+ const credentialLaunch = source || !this.isClaudeCodeBackend() ? null : this.backend?.credentialObservationLaunch?.();
7993
+ monitor.on("claude_request", (record, launchId) => {
7994
+ if (!credentialLaunch || credentialLaunch.binding.kind === "subscription" || this.transcriptMonitor !== monitor || owner !== launchIdentity(this.interactionOwner()) || this.deliveryWritesStopping || this.startupAborted || launchId !== credentialLaunch.launch.id || this.backend?.credentialObservationLaunch?.()?.launch.id !== launchId || record.at < credentialLaunch.launch.startedAt || !credentialLaunch.sourceCurrent())
7995
+ return;
7996
+ this.emit("claude_credential_request", { binding: credentialLaunch.binding, record, owner: this.interactionOwner() });
7997
+ });
6908
7998
  let reminderSession = modelObserver?.checkpoint().sessionId ?? null;
6909
7999
  const observeReminderBoundary = (sessionId, before, after) => {
6910
8000
  const selected = (s) => normalizeClaudeModel(s.session ?? s.launch);
@@ -6940,6 +8030,23 @@ export class Daemon extends EventEmitter {
6940
8030
  if (changed)
6941
8031
  this.emit("model_observation");
6942
8032
  });
8033
+ monitor.on("reply_draft_record", (entry) => {
8034
+ if (this.transcriptMonitor === monitor && owner === launchIdentity(this.interactionOwner())) {
8035
+ const turn = this.turnReplyGuard?.snapshot();
8036
+ if (turn)
8037
+ this.replyDraft.observe(entry, turn.generation);
8038
+ else
8039
+ this.replyDraft.reset();
8040
+ }
8041
+ });
8042
+ for (const event of ["reset", "workspace_reset", "context_reset"])
8043
+ monitor.on(event, () => {
8044
+ if (this.transcriptMonitor === monitor) {
8045
+ this.replyDraft.reset();
8046
+ if (event !== "workspace_reset" && this.requestContextWrite)
8047
+ this.requestContextWrite.unknownEnd = "reset";
8048
+ }
8049
+ });
6943
8050
  this.transcriptTurns.reset();
6944
8051
  this.transcriptActivityAt = 0;
6945
8052
  // Monotonic: a wall-clock correction must neither end nor extend the open-turn hold (#1641 R1).
@@ -6947,6 +8054,9 @@ export class Daemon extends EventEmitter {
6947
8054
  monitor.on("turns", (turns) => {
6948
8055
  this.transcriptTurns.observe(turns, performance.now());
6949
8056
  touch();
8057
+ if (this.transcriptMonitor === monitor && owner === launchIdentity(this.interactionOwner())) {
8058
+ this.observeRequestContextTranscript(turns);
8059
+ }
6950
8060
  });
6951
8061
  // #3160: the files this turn reads, edits and searches, for the Files & changes panel's Follow (a few string checks;
6952
8062
  // nothing is read from disk until someone asks). Claude's turn boundary is its next prompt.
@@ -6969,6 +8079,23 @@ export class Daemon extends EventEmitter {
6969
8079
  });
6970
8080
  for (const event of ["tool_use", "tool_result", "assistant_text"])
6971
8081
  monitor.on(event, touch);
8082
+ // M-3239: the turn as the transcript tells it — progress for the board's quiet clock, and the question a turn ends on.
8083
+ const mine = () => this.transcriptMonitor === monitor;
8084
+ monitor.on("tool_use", (name, input) => { if (mine()) {
8085
+ this.hubRoomTranscriptActivity++;
8086
+ this.turnWatch.tool(name, input, Date.now());
8087
+ this.reportTurnActivity();
8088
+ } });
8089
+ monitor.on("tool_result", () => { if (mine()) {
8090
+ this.hubRoomTranscriptActivity++;
8091
+ this.turnWatch.result(Date.now());
8092
+ this.reportTurnActivity();
8093
+ } });
8094
+ monitor.on("assistant_text", (text) => { if (mine()) {
8095
+ this.hubRoomTranscriptActivity++;
8096
+ this.turnWatch.text(text, Date.now());
8097
+ this.reportTurnActivity();
8098
+ } });
6972
8099
  return monitor;
6973
8100
  }
6974
8101
  /**
@@ -7056,8 +8183,26 @@ export class Daemon extends EventEmitter {
7056
8183
  message: formatReplyDropDetection(turn, reason),
7057
8184
  });
7058
8185
  }
8186
+ _replyDraft;
8187
+ /** Also supports existing prototype-based lifecycle harnesses without constructor state. */
8188
+ get replyDraft() { return this._replyDraft ??= new ReplyDraft(); }
7059
8189
  queueReplyRecoveryPrompt(turn) {
7060
8190
  const deliveryEpoch = this.deliveryEpoch;
8191
+ const parent = this.workingTurnRequestContext?.generation === turn.generation ? this.workingTurnRequestContext.snapshot : null;
8192
+ const recoveryInputId = `reply-recovery:${this.bootId}:${turn.generation}:${deliveryEpoch}`;
8193
+ const registered = parent && this.requestContextLifecycle ? { root: parent.context.ref.rootContextId } : null;
8194
+ if (registered) {
8195
+ if (this.requestContextQueuedWork.has(recoveryInputId))
8196
+ return;
8197
+ try {
8198
+ this.requestContextQueuedWork.set(recoveryInputId, registered);
8199
+ }
8200
+ catch {
8201
+ this.turnReplyGuard.complete(turn.generation);
8202
+ this.reportUnrecoveredReplyDrop(turn, "recovery_prompt_delivery_failed");
8203
+ return;
8204
+ }
8205
+ }
7061
8206
  this.pasteQueueDepth++;
7062
8207
  this.pasteLock = this.pasteLock.then(async () => {
7063
8208
  try {
@@ -7073,8 +8218,16 @@ export class Daemon extends EventEmitter {
7073
8218
  });
7074
8219
  return;
7075
8220
  }
7076
- const delivered = await this.deliverMessage(REPLY_RECOVERY_PROMPT, undefined, {
8221
+ let prompt = REPLY_RECOVERY_PROMPT;
8222
+ try {
8223
+ prompt = this.replyDraft.recoveryPrompt(current, REPLY_RECOVERY_PROMPT);
8224
+ }
8225
+ catch { /* Draft evidence is best-effort; keep the existing generic recovery. */ }
8226
+ const recoveryText = parent && this.requestContextLifecycle ? `[agend-request-input:${recoveryInputId}]\n${prompt}` : prompt;
8227
+ const delivered = await this.deliverMessage(recoveryText, undefined, {
7077
8228
  deliveryEpoch,
8229
+ ...(parent ? { requestContextRecovery: { inputId: recoveryInputId, parent,
8230
+ current: () => !!this.currentReplyRecovery(turn.generation, deliveryEpoch) } } : {}),
7078
8231
  });
7079
8232
  if (!this.currentReplyRecovery(turn.generation, deliveryEpoch))
7080
8233
  return;
@@ -7092,7 +8245,8 @@ export class Daemon extends EventEmitter {
7092
8245
  return;
7093
8246
  this.turnReplyGuard.complete(turn.generation);
7094
8247
  this.reportUnrecoveredReplyDrop(turn, "recovery_prompt_delivery_failed");
7095
- });
8248
+ }).finally(() => { if (registered && this.requestContextQueuedWork.get(recoveryInputId) === registered)
8249
+ this.requestContextQueuedWork.delete(recoveryInputId); });
7096
8250
  }
7097
8251
  /** Recheck after queue waits and IO; cancellation must not become a failure notice. */
7098
8252
  currentReplyRecovery(generation, deliveryEpoch) {
@@ -7182,6 +8336,10 @@ export class Daemon extends EventEmitter {
7182
8336
  }
7183
8337
  /** Context-bound reply path shared by dead-MCP and malformed-call recovery. */
7184
8338
  deliverDaemonReply(body, requestPrefix, logLabel, target) {
8339
+ // System proxy text has no originating call lease. Until its final-output generation proof is
8340
+ // installed, it cannot borrow a live turn or lastChat; proven-parent model recovery uses C instead.
8341
+ if (this.requestContextLifecycle)
8342
+ return Promise.resolve(false);
7185
8343
  const args = { text: body };
7186
8344
  const chatId = target?.chatId ?? this.lastChatId;
7187
8345
  const threadId = target?.threadId ?? this.lastThreadId;
@@ -7398,7 +8556,7 @@ export class Daemon extends EventEmitter {
7398
8556
  // work cannot hide behind this: it changes the layout, the next
7399
8557
  // output arms another probe, and the debounce capture still fires.
7400
8558
  // #1641: never while the transcript shows a turn running — that idle-looking screen is mid-turn.
7401
- if (this.instanceState === "idle" && this.backend?.isPeriodicRedrawIdlePane?.(pane) === true
8559
+ if (this.instanceState === "idle" && this.executionIdleProof()?.(pane) === true
7402
8560
  && this.transcriptTurnState() !== "open")
7403
8561
  return;
7404
8562
  // A second burst overtook the probe. Do not bless its stale capture as
@@ -7435,7 +8593,7 @@ export class Daemon extends EventEmitter {
7435
8593
  // observe twice, which silently disabled the "content moved" branch.
7436
8594
  if (this.backend?.periodicRedrawFrom)
7437
8595
  this.periodicRedrawLayout = this.backend.periodicRedrawFrom(pane);
7438
- const structuredPeriodicIdle = this.periodicIdleProof();
8596
+ const structuredPeriodicIdle = this.executionIdleProof();
7439
8597
  // #1641: the transcript outranks the pane: while it shows the turn running, no reading of this pane is idle (codex
7440
8598
  // hides its status row while streaming, leaving the idle composer and footer in view mid-turn).
7441
8599
  const transcriptTurn = this.transcriptTurnState();
@@ -7665,6 +8823,13 @@ export class Daemon extends EventEmitter {
7665
8823
  return undefined;
7666
8824
  return proof;
7667
8825
  }
8826
+ /** Draft text can be execution-idle, but must not become empty-composer proof for delivery, pause or nudges. */
8827
+ executionIdleProof() {
8828
+ const empty = this.periodicIdleProof(), draft = this.backend?.isDraftIdlePane;
8829
+ if (!empty && !draft)
8830
+ return undefined;
8831
+ return pane => empty?.call(this.backend, pane) === true || draft?.call(this.backend, pane) === true;
8832
+ }
7668
8833
  bindInstanceStateOutputListener(windowId) {
7669
8834
  if (!this.controlClient || !this.instanceStateMonitorActive)
7670
8835
  return;
@@ -7770,6 +8935,7 @@ export class Daemon extends EventEmitter {
7770
8935
  this.cancelCapacityNudge("the instance was stopped, paused or respawned");
7771
8936
  this.runtimeMonitorsFrozen = true;
7772
8937
  this.launchFenceEpoch++;
8938
+ this.requestContextAdmission?.changed();
7773
8939
  this.interactionObservation.reset(this.interactionOwner());
7774
8940
  this.clearInteractionConfirmation();
7775
8941
  if (this.healthCheckTimer) {
@@ -8140,7 +9306,7 @@ export class Daemon extends EventEmitter {
8140
9306
  if (kind === "steer")
8141
9307
  wire = Daemon.steerEnvelope(wire);
8142
9308
  else if (kind === "btw")
8143
- wire = BTW_INBOUND_PREFIX + wire;
9309
+ wire = btwInboundEnvelope(wire, meta.delivery_id);
8144
9310
  return prepareDeliveryWire(wire, kind === "raw_paste");
8145
9311
  }
8146
9312
  humanReceiptAttempt(meta, wire) {
@@ -8198,10 +9364,22 @@ export class Daemon extends EventEmitter {
8198
9364
  if (meta.human_prepare_token)
8199
9365
  this.humanPreparations.delete(meta.human_prepare_token);
8200
9366
  this.humanReminderAttempts.delete(meta.human_receipt_id);
9367
+ const pending = this.requestContextHumanReplies?.get(meta.human_receipt_id);
9368
+ if (pending && !pending.accepted)
9369
+ pending.pending.refuse();
9370
+ this.requestContextHumanReplies?.delete(meta.human_receipt_id);
8201
9371
  }
8202
9372
  }
8203
9373
  /** Synchronous acknowledgement from the manager after the existing receipt owner/authority checks. */
8204
9374
  noteHumanReceiptSettlement(id, positive) {
9375
+ const pending = this.requestContextHumanReplies?.get(id);
9376
+ if (pending) {
9377
+ pending.accepted = positive;
9378
+ if (positive)
9379
+ pending.pending.confirm();
9380
+ else
9381
+ pending.pending.refuse();
9382
+ }
8205
9383
  const stamp = this.humanReminderAttempts?.get(id);
8206
9384
  if (!stamp || !positive || !this.humanReminders.current(stamp))
8207
9385
  return;
@@ -8235,7 +9413,7 @@ export class Daemon extends EventEmitter {
8235
9413
  // terminal state is announced by the outbox only after its retry/TTL policy
8236
9414
  // is exhausted; emitting ❌ here would expose a transient gate timeout.
8237
9415
  if (status && !verdict.durableAttempt)
8238
- this.emit("message_failed", status); // ❌
9416
+ this.emit("message_failed", { ...status, phase, proof }); // ❌
8239
9417
  return false;
8240
9418
  }
8241
9419
  /** Tell the fleet when an already-accepted cross-instance pane write failed. */
@@ -8318,7 +9496,7 @@ export class Daemon extends EventEmitter {
8318
9496
  })) {
8319
9497
  delivered = true;
8320
9498
  this.finishDurableSubmission(durableAttempt, verdict);
8321
- this.markTurnStarted(meta, formatted, deliveryEpoch);
9499
+ this.markTurnStarted(meta, formatted, deliveryEpoch, false, verdict);
8322
9500
  }
8323
9501
  else if (durableAttempt && verdict.paneWriteStarted) {
8324
9502
  this.finishDurableDelivery(durableAttempt, "uncertain", `${verdict.phase ?? "post-submit"}:${verdict.proof ?? "unproven"}`, verdict);
@@ -8372,37 +9550,75 @@ export class Daemon extends EventEmitter {
8372
9550
  this.updateLastChat(meta.chat_id, meta.thread_id, meta.adapter_id);
8373
9551
  this.pendingWork.recordInbound();
8374
9552
  this.recordRecentUserMessage(content, meta);
8375
- const formatted = BTW_INBOUND_PREFIX + this.formatInboundMessage(content, meta);
9553
+ const formatted = btwInboundEnvelope(this.formatInboundMessage(content, meta), meta.delivery_id);
8376
9554
  const status = channelStatus(meta);
9555
+ const durableAttempt = this.durableDeliveryAttempt(meta, content);
9556
+ if (durableAttempt === false) {
9557
+ this.deferDurableDelivery(meta, "invalid durable delivery attempt metadata");
9558
+ return;
9559
+ }
8377
9560
  this.steerLock = this.steerLock.then(async () => {
8378
9561
  if (!this.isDeliveryEpochCurrent(deliveryEpoch)) {
8379
- this.finishHumanReceipt(meta, { reached: false });
9562
+ this.deferDurableDelivery(meta, "delivery epoch changed before steer began");
8380
9563
  this.noteCancelledHuman(meta);
8381
9564
  return;
8382
9565
  }
8383
9566
  await this.wake();
8384
9567
  if (!this.isDeliveryEpochCurrent(deliveryEpoch)) {
8385
- this.finishHumanReceipt(meta, { reached: false });
9568
+ this.deferDurableDelivery(meta, "delivery epoch changed while waking for steer");
8386
9569
  this.noteCancelledHuman(meta);
8387
9570
  return;
8388
9571
  }
8389
9572
  const verdict = { reached: false, humanReceipt: this.humanReceiptAttempt(meta, formatted) };
8390
9573
  let delivered = false;
8391
9574
  try {
8392
- if (await this.deliverMessage(formatted, status, { steer: true, deliveryEpoch, submissionId: meta.message_id,
8393
- ...(meta.verification_id ? { humanVerificationId: meta.verification_id, humanMeta: meta } : {}), verdict })) {
9575
+ if (await this.deliverMessage(formatted, status, {
9576
+ steer: true,
9577
+ deliveryEpoch,
9578
+ submissionId: meta.message_id,
9579
+ ...(meta.verification_id ? { humanVerificationId: meta.verification_id, humanMeta: meta } : {}),
9580
+ verdict,
9581
+ durableAttempt: durableAttempt || undefined,
9582
+ })) {
8394
9583
  delivered = true;
8395
- this.markTurnStarted(meta, formatted, deliveryEpoch);
9584
+ this.finishDurableSubmission(durableAttempt, verdict);
9585
+ this.markTurnStarted(meta, formatted, deliveryEpoch, false, verdict);
9586
+ }
9587
+ else if (durableAttempt && verdict.paneWriteStarted) {
9588
+ this.finishDurableDelivery(durableAttempt, "uncertain", `${verdict.phase ?? "post-submit"}:${verdict.proof ?? "unproven"}`, verdict);
9589
+ }
9590
+ else if (durableAttempt && verdict.durableBeginCommitted) {
9591
+ this.abortDurableDelivery(durableAttempt, `${verdict.phase ?? "delivery"}:${verdict.proof ?? "no-pane-write"}`);
9592
+ }
9593
+ else if (durableAttempt) {
9594
+ this.retryDurableDeliveryBeforeBegin(durableAttempt, `${verdict.phase ?? "delivery"}:${verdict.proof ?? "deferred"}`);
9595
+ }
9596
+ else if (verdict.reached && this.isDeliveryEpochCurrent(deliveryEpoch)) {
9597
+ // Legacy non-outbox path retains its existing failure surface.
9598
+ this.reportCrossInstanceDeliveryFailure(meta, verdict);
8396
9599
  }
8397
9600
  }
9601
+ catch (err) {
9602
+ // The verdict goes along: a write that started and then threw is still a hand-off the CLI may consume (#1201).
9603
+ if (durableAttempt && verdict.paneWriteStarted)
9604
+ this.finishDurableDelivery(durableAttempt, "uncertain", err.message, verdict);
9605
+ else if (durableAttempt && verdict.durableBeginCommitted)
9606
+ this.abortDurableDelivery(durableAttempt, err.message);
9607
+ else if (durableAttempt)
9608
+ this.retryDurableDeliveryBeforeBegin(durableAttempt, err.message);
9609
+ throw err;
9610
+ }
8398
9611
  finally {
8399
9612
  this.finishHumanReceipt(meta, verdict);
8400
9613
  if (!delivered && !verdict.paneWriteStarted && !this.isDeliveryEpochCurrent(deliveryEpoch))
8401
9614
  this.noteCancelledHuman(meta);
8402
9615
  }
8403
9616
  }).catch(err => {
8404
- this.finishHumanReceipt(meta, { reached: false });
9617
+ this.deferDurableDelivery(meta, `target wake/side-question failed before pane submission: ${err.message}`);
8405
9618
  this.logger.warn({ err: err.message }, "btw delivery error");
9619
+ if (!durableAttempt && this.isDeliveryEpochCurrent(deliveryEpoch)) {
9620
+ this.reportCrossInstanceDeliveryFailure(meta, undefined, err.message);
9621
+ }
8406
9622
  });
8407
9623
  }
8408
9624
  /**
@@ -8410,7 +9626,9 @@ export class Daemon extends EventEmitter {
8410
9626
  * If targetSession is provided, only send to the matching socket.
8411
9627
  * Otherwise send to the instance's own session (this.name).
8412
9628
  */
8413
- pushChannelMessage(content, meta, _targetSession, deliveryEpoch = this.deliveryEpoch) {
9629
+ pushChannelMessage(content, meta, _targetSession, deliveryEpoch = this.deliveryEpoch, requestContextInputId) {
9630
+ if (requestContextInputId && !/^hub-input:[a-f0-9-]{36}$/.test(requestContextInputId))
9631
+ throw Error("Hub request input id is unavailable");
8414
9632
  if (!this.isDeliveryEpochCurrent(deliveryEpoch)) {
8415
9633
  this.logger.info("Pending channel delivery dropped by user cancel");
8416
9634
  this.deferDurableDelivery(meta, "delivery epoch changed before queue admission");
@@ -8498,7 +9716,10 @@ export class Daemon extends EventEmitter {
8498
9716
  // byte for byte (its proof is the wire's hash), so the notice waits for the next delivery without one.
8499
9717
  const whatsNew = this.pendingWhatsNew && !meta.human_receipt_id && !meta.handoff_redelivery
8500
9718
  ? this.currentWhatsNew(this.pendingWhatsNew) : null;
8501
- const pasted = whatsNew ? withWhatsNew(formatted, whatsNew.notice) : formatted;
9719
+ const body = whatsNew ? withWhatsNew(formatted, whatsNew.notice) : formatted;
9720
+ const roomMarker = roomContextInputMarker(meta);
9721
+ const unmarked = roomMarker ? `${roomMarker}\n${body}` : body;
9722
+ const pasted = requestContextInputId && !roomMarker ? `[agend-request-input:${requestContextInputId}]\n${unmarked}` : unmarked;
8502
9723
  const status = channelStatus(meta);
8503
9724
  // A fresh delivery begins a fresh turn — its bubble must not inherit
8504
9725
  // the previous turn's tool list.
@@ -8516,6 +9737,10 @@ export class Daemon extends EventEmitter {
8516
9737
  this.logger.info({ handoff: meta.handoff_redelivery }, "Queued hand-off redelivery dropped: its CLI was replaced before the write");
8517
9738
  return;
8518
9739
  }
9740
+ if (meta.hub_room_context_generation && meta.hub_room_context_generation !== this.roomConversationGeneration()) {
9741
+ this.reportCrossInstanceDeliveryFailure(meta, { reached: true, phase: "room-context", proof: "stale-generation" });
9742
+ return;
9743
+ }
8519
9744
  const durableAttempt = this.durableDeliveryAttempt(meta, content);
8520
9745
  if (durableAttempt === false) {
8521
9746
  this.deferDurableDelivery(meta, "invalid durable delivery attempt metadata");
@@ -8527,6 +9752,9 @@ export class Daemon extends EventEmitter {
8527
9752
  sent = await this.deliverMessage(pasted, status, {
8528
9753
  deliveryEpoch,
8529
9754
  submissionId: meta.message_id,
9755
+ ...(requestContextInputId ? { requestContextInputId } : {}),
9756
+ ...(isHubQuestionMeta(meta) ? { hubQuestion: meta.correlation_id, hubContactLimit: meta.hub_contact_limit !== "off" } : {}),
9757
+ ...(meta.hub_room_context_generation ? { roomContextGeneration: meta.hub_room_context_generation } : {}),
8530
9758
  ...(meta.verification_id ? { humanVerificationId: meta.verification_id, humanMeta: meta } : {}),
8531
9759
  verdict,
8532
9760
  durableAttempt: durableAttempt || undefined,
@@ -8542,7 +9770,7 @@ export class Daemon extends EventEmitter {
8542
9770
  if (sent) {
8543
9771
  delivered = true;
8544
9772
  this.finishDurableSubmission(durable, verdict);
8545
- this.markTurnStarted(meta, formatted, deliveryEpoch, !!verdict.handoff);
9773
+ this.markTurnStarted(meta, formatted, deliveryEpoch, !!verdict.handoff, verdict);
8546
9774
  }
8547
9775
  else if (durableAttempt && verdict.paneWriteStarted) {
8548
9776
  this.finishDurableDelivery(durable, "uncertain", `${verdict.phase ?? "post-submit"}:${verdict.proof ?? "unproven"}`, verdict);
@@ -8620,10 +9848,25 @@ export class Daemon extends EventEmitter {
8620
9848
  const verdict = opts?.verdict ?? { reached: false };
8621
9849
  if (opts?.durableAttempt)
8622
9850
  verdict.durableAttempt = true;
8623
- const cancelled = () => opts?.deliveryEpoch !== undefined
8624
- && !this.isDeliveryEpochCurrent(opts.deliveryEpoch);
9851
+ const cancelled = () => (opts?.deliveryEpoch !== undefined && !this.isDeliveryEpochCurrent(opts.deliveryEpoch))
9852
+ || (!!opts?.roomContextGeneration && opts.roomContextGeneration !== this.roomConversationGeneration());
8625
9853
  if (cancelled() || this.stormWindow?.isStopped())
8626
9854
  return false;
9855
+ const admittedReceiptId = opts?.humanMeta?.verification_id ?? opts?.humanVerificationId;
9856
+ const admittedInputId = opts?.requestContextInputId ?? (admittedReceiptId ? `human:${admittedReceiptId}` : opts?.durableAttempt ? `delivery:${opts.durableAttempt.deliveryId}:${opts.durableAttempt.attemptNo}` : null);
9857
+ // Captured once for this input, before waiting. An ended steer never turns into a fresh owner root.
9858
+ const continuation = this.requestContextLifecycle?.continuation?.(admittedInputId, opts?.requestContextRecovery);
9859
+ let heldOwner;
9860
+ const admissionCurrent = () => !cancelled() && !this.deliveryWritesStopping && !this.startupAborted
9861
+ && (heldOwner === undefined || heldOwner === JSON.stringify(this.interactionOwner()));
9862
+ const waitAdmission = async () => {
9863
+ const port = this.requestContextAdmission;
9864
+ if (!port.available(continuation))
9865
+ heldOwner ??= JSON.stringify(this.interactionOwner());
9866
+ return await port.wait(admissionCurrent, continuation) && admissionCurrent();
9867
+ };
9868
+ if (this.requestContextAdmission && !await waitAdmission())
9869
+ return false;
8627
9870
  formatted = prepareDeliveryWire(formatted, opts?.preserveExactBytes);
8628
9871
  // Direct paths such as /steer, /btw, /raw and schedules do not pass the
8629
9872
  // FleetManager idle gate. Hold them at the final common pane-write path so
@@ -8648,7 +9891,7 @@ export class Daemon extends EventEmitter {
8648
9891
  const settleFence = this.launchFenceEpoch;
8649
9892
  if (cancelled())
8650
9893
  return false;
8651
- if (this.refuseFatalStartupDelivery(verdict, status))
9894
+ if (this.refuseBlockedDelivery(verdict, status))
8652
9895
  return false;
8653
9896
  let windowId = this.getWindowId();
8654
9897
  const supportsQueuedInput = this.backend?.supportsQueuedInput?.() === true;
@@ -8659,7 +9902,10 @@ export class Daemon extends EventEmitter {
8659
9902
  // normal Enter input has steering/interrupt semantics in several other CLIs.
8660
9903
  let readiness = "ready";
8661
9904
  const gateWindowId = windowId;
8662
- const handOffEligible = !!(supportsQueuedInput || opts?.steer || composerQueue);
9905
+ // M-3660: a Hub question is never handed into a running turn (Claude would merge it into that turn's work), and while
9906
+ // a Hub answer turn runs, nothing else is handed into it: each waits for the idle pane and becomes a turn of its own.
9907
+ const exclusiveTurn = opts?.hubQuestion !== undefined || this.hubAnswerTurnMayRun();
9908
+ const handOffEligible = !exclusiveTurn && (!this.requestContextLifecycle || opts?.steer === true) && !!(supportsQueuedInput || opts?.steer || composerQueue);
8663
9909
  const handOffAdmissible = async () => (await this.probeBlockingDialog()).state === "clear"
8664
9910
  && await this.hasPositiveDeliveryInput(true)
8665
9911
  && ((!opts?.steer && !composerQueue) || (this.launchTakesSteer() && await this.steerComposerAdmits(false, opts?.steer === true)));
@@ -8731,29 +9977,50 @@ export class Daemon extends EventEmitter {
8731
9977
  // must come back AND the check runs again — the stranded text may still
8732
9978
  // be there. "failed" (the Enter could not be sent) fails the delivery:
8733
9979
  // pasting now would submit both messages as one.
8734
- for (let round = 0;; round++) {
8735
- // Budget check BEFORE the next mutating call: each round may send one
8736
- // recovery Enter, so exactly STRANDED_INPUT_MAX_ROUNDS of them go out.
8737
- if (round >= STRANDED_INPUT_MAX_ROUNDS) {
8738
- this.logger.error({ round }, "Input row still not clear after the stranded-text recovery budget — reporting delivery failure");
8739
- return this.failDelivery(verdict, status, "stranded-input", "retry-budget-exhausted");
9980
+ const inputDeadline = Date.now() + 30 * 60_000;
9981
+ let submissions = 0;
9982
+ let unavailableProbes = 0;
9983
+ for (;;) {
9984
+ if (cancelled())
9985
+ return false;
9986
+ if (Date.now() >= inputDeadline) {
9987
+ this.logger.error("Input row stayed unavailable until the delivery deadline");
9988
+ return this.failDelivery(verdict, status, "stranded-input", "input-not-clear-timeout");
8740
9989
  }
8741
- const stranded = await this.submitStrandedInputIfAny(windowId);
9990
+ // Only actual recovery Enters spend the submission budget. A live pane's
9991
+ // unreadable/changing composer may need time, not three synchronous probes.
9992
+ const stranded = await this.submitStrandedInputIfAny(windowId, submissions < STRANDED_INPUT_MAX_ROUNDS);
8742
9993
  if (cancelled())
8743
9994
  return false;
8744
9995
  if (stranded === "idle")
8745
9996
  break;
9997
+ if (stranded === "exhausted") {
9998
+ this.logger.error({ submissions }, "Input row still not clear after the stranded-text recovery budget — reporting delivery failure");
9999
+ return this.failDelivery(verdict, status, "stranded-input", "retry-budget-exhausted");
10000
+ }
8746
10001
  if (stranded === "failed") {
8747
- this.logger.error({ round }, "Could not submit the stranded text — reporting delivery failure");
10002
+ this.logger.error({ submissions }, "Could not submit the stranded text — reporting delivery failure");
8748
10003
  return this.failDelivery(verdict, status, "stranded-input", "enter-failed");
8749
10004
  }
8750
- const readyAgain = await this.waitForPaneReadyForDelivery(windowId);
10005
+ if (stranded === "submitted")
10006
+ submissions++;
10007
+ // Only the proven empty unknown-footer candidate needs the timed
10008
+ // fallback. Preserve the existing bounded refusal for other unsafe
10009
+ // input (including a stranded draft whose footer cannot be proved).
10010
+ if (stranded === "busy" && this.footerFallbackPaneKey === null && ++unavailableProbes >= STRANDED_INPUT_MAX_ROUNDS) {
10011
+ return this.failDelivery(verdict, status, "stranded-input", "input-not-clear");
10012
+ }
10013
+ const readyAgain = await this.waitForPaneReadyForDelivery(windowId, inputDeadline - Date.now());
8751
10014
  if (cancelled())
8752
10015
  return false;
8753
10016
  if (!readyAgain) {
8754
- this.logger.error("Pane never returned to its prompt after submitting stranded input — reporting delivery failure");
10017
+ this.logger.error("Pane never returned to its prompt after checking stranded input — reporting delivery failure");
8755
10018
  return this.failDelivery(verdict, status, "stranded-input", "prompt-timeout");
8756
10019
  }
10020
+ // After startup, the general idle gate can pass while the stricter input
10021
+ // proof is still collecting a stable composer. Yield before re-reading it.
10022
+ if (stranded === "busy")
10023
+ await new Promise(resolve => setTimeout(resolve, BOTTOM_READY_POLL_MS));
8757
10024
  }
8758
10025
  }
8759
10026
  // Everything above is *waiting*; everything below owns the write lock.
@@ -8764,6 +10031,8 @@ export class Daemon extends EventEmitter {
8764
10031
  const outcome = await this.paneWriteLock.run(async () => {
8765
10032
  if (cancelled())
8766
10033
  return false;
10034
+ if (this.requestContextAdmission && !this.requestContextAdmission.available(continuation) && !verdict.paneWriteStarted && !verdict.durableBeginCommitted)
10035
+ return "request-context-held";
8767
10036
  // A spawn that started after the settle wait above invalidates the
8768
10037
  // window id and every readiness verdict since: the pane about to be
8769
10038
  // written may already belong to a replacement process. The same holds
@@ -8773,7 +10042,7 @@ export class Daemon extends EventEmitter {
8773
10042
  // delivery from the top, where the settle wait runs again outside it.
8774
10043
  if (!settledClean || settleGeneration !== this.spawnGeneration || this.spawning)
8775
10044
  return "spawn-started";
8776
- if (this.refuseFatalStartupDelivery(verdict, status))
10045
+ if (this.refuseBlockedDelivery(verdict, status))
8777
10046
  return false;
8778
10047
  // A passive startup phase may paint after the outer readiness probe.
8779
10048
  // It clears without input, so waiting under the pane lock cannot starve
@@ -8807,18 +10076,47 @@ export class Daemon extends EventEmitter {
8807
10076
  // same process, a pause/stop/respawn is not (launchFenceEpoch moves even
8808
10077
  // when a failed pause resumes the monitors).
8809
10078
  const writeCurrent = () => !cancelled()
10079
+ && (!this.requestContextAdmission || admissionCurrent() && (this.requestContextAdmission.available(continuation) || !!verdict.paneWriteStarted || !!verdict.durableBeginCommitted))
10080
+ && !this.staleAuthIssue()
8810
10081
  && !this.deliveryWritesStopping
8811
10082
  && !this.runtimeMonitorsFrozen
8812
10083
  && !this.spawning
8813
10084
  && settleGeneration === this.spawnGeneration
8814
10085
  && settleFence === this.launchFenceEpoch;
8815
- const stale = () => (this.spawning || settleGeneration !== this.spawnGeneration ? "spawn-started" : false);
10086
+ const stale = () => this.requestContextAdmission && !this.requestContextAdmission.available(continuation) && !verdict.paneWriteStarted && !verdict.durableBeginCommitted
10087
+ ? "request-context-held" : this.spawning || settleGeneration !== this.spawnGeneration ? "spawn-started" : false;
8816
10088
  const residue = await this.clearRestoredInputDraft(handingOffToNativeQueue, writeCurrent);
8817
10089
  if (residue === "stale")
8818
10090
  return stale();
8819
10091
  if (residue !== "clear")
8820
10092
  return this.failDelivery(verdict, status, "input-residue", residue);
8821
- const written = await this.writeMessageToPane(formatted, windowId, handingOffToNativeQueue, status, opts?.submissionId, verdict, opts?.durableAttempt, opts?.steer === true, writeCurrent, opts?.humanVerificationId, opts?.beforePaneWrite, opts?.lookBeforePaneWrite, opts?.humanMeta);
10093
+ let newlyBound = null;
10094
+ const written = await this.writeMessageToPane(formatted, windowId, handingOffToNativeQueue, status, opts?.submissionId, verdict, opts?.durableAttempt, opts?.steer === true, writeCurrent, opts?.humanVerificationId,
10095
+ // M-3660: written into an idle pane, so whatever Hub answer turn ran is over; a Hub question begins its own.
10096
+ (wireText) => {
10097
+ const receiptId = opts?.humanMeta?.verification_id ?? opts?.humanVerificationId;
10098
+ const inputId = opts?.requestContextInputId ?? (receiptId ? `human:${receiptId}` : opts?.durableAttempt
10099
+ ? `delivery:${opts.durableAttempt.deliveryId}:${opts.durableAttempt.attemptNo}` : null);
10100
+ const prior = this.requestContextTurnSnapshot();
10101
+ this.bindRequestContextWrite(inputId, wireText, handingOffToNativeQueue, opts?.requestContextRecovery);
10102
+ const after = this.requestContextTurnSnapshot();
10103
+ if (after && after !== prior)
10104
+ newlyBound = after;
10105
+ if (after && inputId && (/^human:hmsg-/.test(inputId) || /^delivery:/.test(inputId))) {
10106
+ verdict.pendingReply = this.requestContextPendingReplies.stage(after, inputId, deliveryContentDigest(wireText), () => this.requestContextTurnCurrent(after));
10107
+ const humanId = opts?.humanMeta?.human_receipt_id;
10108
+ if (humanId && verdict.pendingReply)
10109
+ this.requestContextHumanReplies.set(humanId, { pending: verdict.pendingReply, accepted: false });
10110
+ }
10111
+ if (!handingOffToNativeQueue)
10112
+ this.hubAnswerTurnBegins(opts?.hubQuestion, opts?.hubContactLimit !== false);
10113
+ opts?.beforePaneWrite?.();
10114
+ }, opts?.lookBeforePaneWrite, opts?.humanMeta);
10115
+ if (written === false && newlyBound && this.nativePaneLifecycle?.lastInputWasNotSent?.()) {
10116
+ const owner = this.requestContextOwner();
10117
+ if (owner && this.requestContextLifecycle.turns.ended(newlyBound, owner))
10118
+ this.requestContextWrite = undefined;
10119
+ }
8822
10120
  // #1690: still under the lock — whatever waits on it next must already see what this write started.
8823
10121
  if (verdict.paneWriteStarted)
8824
10122
  opts?.onPaneWritten?.();
@@ -8828,9 +10126,18 @@ export class Daemon extends EventEmitter {
8828
10126
  // M-2267: the pane is in a tmux mode: nothing written — wait for readiness (it holds while the mode lasts), retry.
8829
10127
  if (written === "pane-in-mode")
8830
10128
  return "dialog";
10129
+ // A publication fence before input keeps this attempt at its producer; never turn the wait into failure.
10130
+ if (written === false && this.requestContextAdmission && !this.requestContextAdmission.available(continuation) && !verdict.paneWriteStarted && !verdict.durableBeginCommitted)
10131
+ return "request-context-held";
8831
10132
  // Fenced before its first write: not attempted — redo after a spawn, else drop without a ❌.
8832
10133
  return written === false && verdict.fenced ? stale() : written;
8833
10134
  });
10135
+ if (outcome === "request-context-held") {
10136
+ if (!this.requestContextAdmission || !await waitAdmission())
10137
+ return false;
10138
+ round--;
10139
+ continue; // Waiting on admission consumes neither a dialog retry nor any input intent.
10140
+ }
8834
10141
  if (outcome === "spawn-started") {
8835
10142
  // The pane changed under this delivery: its queued paste must not land
8836
10143
  // in the replacement process's first screen. Redo the whole delivery
@@ -9666,7 +10973,7 @@ export class Daemon extends EventEmitter {
9666
10973
  locked: fn => this.paneWriteLock.run(fn),
9667
10974
  // An unreadable screen (a failed capture, another spawn's pane) is unknown — never "the card closed".
9668
10975
  read: async () => answerScreen = this.tmux === tmux ? await tmux.capturePane().catch(() => null) : null,
9669
- key: key => this.tmux !== tmux || answerScreen === null ? Promise.resolve(false) : key === "Space" ? (this.nativePaneLifecycle ? tmux.sendKeys(" ", { kind: "dialog", screen: answerScreen }) : tmux.sendKeys(" ")) : (this.nativePaneLifecycle ? tmux.sendSpecialKey(key, undefined, { kind: "dialog", screen: answerScreen }) : tmux.sendSpecialKey(key)),
10976
+ key: key => this.tmux !== tmux || answerScreen === null ? Promise.resolve(false) : (key === "Space" || key === "q") ? (this.nativePaneLifecycle ? tmux.sendKeys(key === "q" ? "q" : " ", { kind: "dialog", screen: answerScreen }) : tmux.sendKeys(key === "q" ? "q" : " ")) : (this.nativePaneLifecycle ? tmux.sendSpecialKey(key, undefined, { kind: "dialog", screen: answerScreen }) : tmux.sendSpecialKey(key)),
9670
10977
  paste: text => this.tmux !== tmux || answerScreen === null ? Promise.resolve(false) : this.nativePaneLifecycle ? tmux.pasteBuffer(text, { proof: { kind: "dialog", screen: answerScreen } }) : tmux.pasteBuffer(text),
9671
10978
  sleep: ms => new Promise(resolve => setTimeout(resolve, ms)),
9672
10979
  now: () => performance.now(),
@@ -10041,6 +11348,10 @@ export class Daemon extends EventEmitter {
10041
11348
  * pane proves nothing. The silence gate comes first and costs no capture.
10042
11349
  */
10043
11350
  async paneReadinessForDelivery(windowId) {
11351
+ if (this.staleAuthIssue()) {
11352
+ this.resetFooterFallback();
11353
+ return "dialog";
11354
+ }
10044
11355
  // Each early return below is the pane seen outside the footer-fallback
10045
11356
  // candidate state, and never reaches deliveryInputReadyPane: reset here.
10046
11357
  if (!this.isPaneIdleForDelivery(windowId)) {
@@ -10313,7 +11624,7 @@ export class Daemon extends EventEmitter {
10313
11624
  this.logger.error({ rows: rows.length }, "The input box did not empty — not writing this delivery onto it");
10314
11625
  return "not-cleared";
10315
11626
  }
10316
- async submitStrandedInputIfAny(windowId) {
11627
+ async submitStrandedInputIfAny(windowId, allowSubmit = true) {
10317
11628
  if (!this.tmux || !this.backend)
10318
11629
  return "idle";
10319
11630
  const prompt = this.backend.getBottomReadyPattern?.();
@@ -10344,6 +11655,8 @@ export class Daemon extends EventEmitter {
10344
11655
  return "idle";
10345
11656
  if (state !== "stranded")
10346
11657
  return "busy"; // busy, or unreadable: no evidence the prompt is free
11658
+ if (!allowSubmit)
11659
+ return "exhausted"; // a final clear check is allowed, a fourth recovery Enter is not
10347
11660
  const sent = await this.sendDeliveryEnter("stranded-input-submit");
10348
11661
  return sent ? "submitted" : "failed";
10349
11662
  });
@@ -10366,10 +11679,24 @@ export class Daemon extends EventEmitter {
10366
11679
  return "busy";
10367
11680
  if (this.backend?.getBusyPattern?.()?.test(pane))
10368
11681
  return "busy";
11682
+ // The timed footer fallback is valid only in a live raw TUI, even
11683
+ // after the startup guard has retired. Historical shell scrollback is not
11684
+ // evidence that a composer still owns the terminal.
11685
+ const known = this.backend?.isDeliveryInputReadyPane?.(pane);
11686
+ if (known === false && this.backend?.isStableUnknownLayoutIdlePane?.(pane)) {
11687
+ if (this.nativePaneLifecycle || await this.tmux?.getPaneInputMode?.() !== "raw") {
11688
+ this.resetFooterFallback();
11689
+ return "busy";
11690
+ }
11691
+ }
10369
11692
  if (!this.deliveryInputReadyPane(pane))
10370
11693
  return "busy";
10371
- if (strandedAgendMessageInInput(pane, prompt))
11694
+ if (strandedAgendMessageInInput(pane, prompt)) {
11695
+ // A cancelled human turn can restore its text here. Idle observation must not let a later delivery submit it.
11696
+ if (this.backend?.binaryName === "codex" && /\[user:/.test(inputAreaText(pane, prompt) ?? ""))
11697
+ return "busy";
10372
11698
  return "stranded";
11699
+ }
10373
11700
  // Kiro uses the bottom row; Codex's positive prompt/footer check above
10374
11701
  // rules out a historical transcript echo or a transition/modal screen.
10375
11702
  return !requireBottomReady || bottomRowIsReady(pane, prompt) ? "clear" : "busy";
@@ -10561,6 +11888,7 @@ export class Daemon extends EventEmitter {
10561
11888
  }
10562
11889
  }
10563
11890
  /**
11891
+ * A stale process login refuses delivery before any write; durable attempts stay retryable.
10564
11892
  * While the CLI is parked on a fatal startup screen (see fatalStartupBlocked),
10565
11893
  * no pane write may happen: paste+Enter into the corrupt-config modal would
10566
11894
  * confirm "Exit and fix manually" and exit the CLI. The message is failed (❌)
@@ -10568,7 +11896,11 @@ export class Daemon extends EventEmitter {
10568
11896
  * what to fix, and holding would only build a queue that floods the pane the
10569
11897
  * moment the flag clears.
10570
11898
  */
10571
- refuseFatalStartupDelivery(verdict, status) {
11899
+ refuseBlockedDelivery(verdict, status) {
11900
+ if (this.staleAuthIssue()) {
11901
+ this.failDelivery(verdict, status, "pre-write", "stale-auth");
11902
+ return true;
11903
+ }
10572
11904
  if (!this.fatalStartupBlocked && !this.modelMinimumBlocked)
10573
11905
  return false;
10574
11906
  this.logger.error("Delivery refused — CLI startup or model-version repair is held");
@@ -10926,6 +12258,8 @@ export class Daemon extends EventEmitter {
10926
12258
  catch {
10927
12259
  return hold("check_failed");
10928
12260
  }
12261
+ if (this.codexInputOccupied(screen))
12262
+ return hold("input_occupied");
10929
12263
  if (!current())
10930
12264
  return false;
10931
12265
  if (performance.now() >= deadline)
@@ -10984,12 +12318,27 @@ export class Daemon extends EventEmitter {
10984
12318
  signature.takenMarker = leadMarker;
10985
12319
  const rawPaste = durableAttempt?.submissionMode === "raw_paste";
10986
12320
  const humanAttempt = verdict.humanReceipt;
12321
+ verdict.roomInputQueued = handingOffToNativeQueue || steer;
10987
12322
  const humanMode = rawPaste ? "raw_paste" : steer ? "steer"
10988
12323
  : handingOffToNativeQueue ? "native_queue_handoff" : "idle_submit";
10989
- if (humanAttempt && signature.unique && signature.value === humanReceiptMarker(humanAttempt.verificationId, humanDialect).slice(1, -1)
12324
+ // Retained controls lead with the delivery marker for strict transcript/restart proof. That marker is
12325
+ // usable for a human receipt only through the outbox's exact control/receipt/owner/wire join, never text lookup.
12326
+ const controlMarker = durableAttempt ? `[agend-delivery-id:${durableAttempt.deliveryId}]` : null;
12327
+ const ownsControlReceipt = () => !!humanAttempt && !!durableAttempt && !rawPaste
12328
+ && this.deliveryOutbox?.ownsHumanControlReceipt?.(durableAttempt.deliveryId, this.bootId, durableAttempt.attemptNo, humanAttempt.receiptId, humanAttempt.ownerKey, humanAttempt.expectedWireHash) === true;
12329
+ const controlAlias = !!controlMarker && !!humanAttempt
12330
+ && [`${controlMarker}\n${humanAttempt.marker}\n`,
12331
+ Daemon.steerEnvelope(`${controlMarker}\n${humanAttempt.marker}\n`),
12332
+ btwInboundEnvelope(`${controlMarker}\n${humanAttempt.marker}\n`, durableAttempt.deliveryId)].some(prefix => formatted.startsWith(prefix))
12333
+ && ownsControlReceipt();
12334
+ if (controlAlias) {
12335
+ signature.value = controlMarker.slice(1, -1);
12336
+ signature.takenMarker = controlMarker;
12337
+ }
12338
+ if (humanAttempt && signature.unique && (controlAlias || signature.value === humanReceiptMarker(humanAttempt.verificationId, humanDialect).slice(1, -1))
10990
12339
  && humanBodyHash(formatted) === humanAttempt.expectedWireHash) {
10991
12340
  signature.humanPositive = tag => {
10992
- if (!humanAttempt.current() || (stillCurrent && !stillCurrent()))
12341
+ if (!humanAttempt.current() || (stillCurrent && !stillCurrent()) || controlAlias && !ownsControlReceipt())
10993
12342
  return;
10994
12343
  humanAttempt.proof = {
10995
12344
  receipt_id: humanAttempt.receiptId, verification_id: humanAttempt.verificationId,
@@ -11024,6 +12373,8 @@ export class Daemon extends EventEmitter {
11024
12373
  verdict.fenced = !verdict.durableBeginCommitted;
11025
12374
  return false;
11026
12375
  }
12376
+ if (pasteBaseline?.unsubmittedAgendInput)
12377
+ return this.failDelivery(verdict, status, "input-residue", "occupied-codex-composer");
11027
12378
  // M-2267: the pane went into a tmux mode after the readiness wait. Nothing begun or written: the caller waits for
11028
12379
  // readiness (which holds while it lasts) and tries again — as for a dialog that appeared before the write.
11029
12380
  if (!verdict.durableBeginCommitted && await this.paneInTmuxMode("paste"))
@@ -11172,7 +12523,7 @@ export class Daemon extends EventEmitter {
11172
12523
  return this.failDelivery(verdict, status, "paste", "pane-in-tmux-mode");
11173
12524
  }
11174
12525
  const pasteGeneration = this.spawnGeneration;
11175
- beforePaste?.();
12526
+ beforePaste?.(formatted);
11176
12527
  const pasted = await this.sendDeliveryPaste(formatted, nativeOwner);
11177
12528
  if (!pasted && this.nativePaneLifecycle) {
11178
12529
  // The native write attempt is retained as uncertain, including exhausted positive refusals. Never route an
@@ -11260,7 +12611,7 @@ export class Daemon extends EventEmitter {
11260
12611
  if (!this.steerPasteIsOurs(before.pane, formatted))
11261
12612
  return this.failDelivery(verdict, status, "steer-paste", "box-not-this-paste");
11262
12613
  const shown = this.backend?.readSteerComposerText?.(before.pane)?.replace(/\s+/g, " ").trim();
11263
- humanComposerOwned = !!humanAttempt && shown === (humanAttempt.marker ?? "[agend-human-id:" + humanAttempt.verificationId + "]");
12614
+ humanComposerOwned = !!humanAttempt && shown === (controlAlias ? controlMarker : humanAttempt.marker ?? "[agend-human-id:" + humanAttempt.verificationId + "]");
11264
12615
  // …and so is the Enter: the key is sent only while the reading is still within it.
11265
12616
  steerEnterDeadline = deadline;
11266
12617
  }
@@ -11349,6 +12700,7 @@ export class Daemon extends EventEmitter {
11349
12700
  : after === "queue" ? "composer-empty-queue" : "composer-empty-idle");
11350
12701
  verdict.phase = steer ? "steer-accepted" : "composer-accepted";
11351
12702
  verdict.proof = `${steer ? "steer" : "handoff"}-composer-${after}`;
12703
+ verdict.roomInputQueued = after === "queue";
11352
12704
  if (status)
11353
12705
  this.emit("message_confirmed", status); // ✅ taken from the box
11354
12706
  return true;
@@ -11424,6 +12776,7 @@ export class Daemon extends EventEmitter {
11424
12776
  if (verdict.handoff && !verdict.trackHandoff?.id)
11425
12777
  this.dropQueuedHandoff(verdict);
11426
12778
  verdict.handoff = undefined;
12779
+ verdict.roomInputQueued = false;
11427
12780
  if (windowId && this.controlClient && !(await this.controlClient.waitUntilIdle(windowId))) {
11428
12781
  verdict.phase = "native-queue-idle-wait";
11429
12782
  verdict.proof = "idle-wait-failed";
@@ -12030,6 +13383,7 @@ export class Daemon extends EventEmitter {
12030
13383
  // Grok cuts an echo to three rows, so the trailing message_id never shows after Enter; the marker always does.
12031
13384
  // Placed after the strand checks: text of ours still in the box (or its collapsed paste) outranks it.
12032
13385
  if (signature.takenMarker && after.inputReadable && this.backend?.readTakenMarkers?.(pane).includes(signature.takenMarker)) {
13386
+ signature.humanPositive?.("unique-id-pane");
12033
13387
  return this.submittedProof();
12034
13388
  }
12035
13389
  // 2. Positive evidence. A unique signature needs no baseline: no earlier
@@ -12101,6 +13455,11 @@ export class Daemon extends EventEmitter {
12101
13455
  * paste and once after, so confirmSubmitted can require a NEW marker or a NEW
12102
13456
  * echo rather than accepting whatever was already there.
12103
13457
  */
13458
+ codexInputOccupied(pane) {
13459
+ const backend = this.backend, prompt = backend?.getBottomReadyPattern?.();
13460
+ return backend?.binaryName === "codex" && backend.ownsComposerRows?.(pane) === true && !!prompt
13461
+ && strandedAgendMessageInInput(pane, prompt);
13462
+ }
12104
13463
  async capturePaneEvidence(signature) {
12105
13464
  if (!this.tmux)
12106
13465
  return null;
@@ -12111,6 +13470,8 @@ export class Daemon extends EventEmitter {
12111
13470
  try {
12112
13471
  const pane = await this.tmux.capturePane();
12113
13472
  const evidence = this.paneEvidence(pane, signature);
13473
+ if (this.codexInputOccupied(pane))
13474
+ evidence.unsubmittedAgendInput = true;
12114
13475
  if (owner === this.tmux && window === owner.getWindowId?.() && spawn === this.spawnGeneration && fence === this.launchFenceEpoch && launch === this.launchAttempt) {
12115
13476
  const counts = this.paneQuotaPatterns().map(ep => ({ key: Daemon.errorPatternKey(ep), count: Daemon.countOccurrences(ep.pattern, pane) }));
12116
13477
  if (counts.length)
@@ -12118,10 +13479,7 @@ export class Daemon extends EventEmitter {
12118
13479
  }
12119
13480
  const input = this.inputRegion(pane);
12120
13481
  if (input && agendMessageInInput(input.text)) {
12121
- // Whatever we paste now lands after it, and one Enter submits both as
12122
- // a single message. Nothing here can undo that; saying so beats
12123
- // letting two messages silently merge.
12124
- this.logger.warn("An unsubmitted message is already in the input row — this delivery will be appended to it");
13482
+ this.logger.warn("An unsubmitted message is already in the input row");
12125
13483
  }
12126
13484
  return evidence;
12127
13485
  }
@@ -12459,11 +13817,17 @@ export class Daemon extends EventEmitter {
12459
13817
  const current = () => lease.current() && lease.allowed(input.tool, input.args) && !this.deliveryWritesStopping && fence === this.launchFenceEpoch;
12460
13818
  return new Promise(resolve => {
12461
13819
  let settled = false;
13820
+ let call;
12462
13821
  const finish = (value) => { if (settled)
12463
- return; settled = true; clearTimeout(timer); resolve(value); };
13822
+ return; settled = true; if (call)
13823
+ this.requestContextCalls.delete(call.id); clearTimeout(timer); resolve(value); };
12464
13824
  const timer = setTimeout(() => finish({ result: null, error: "Pane tool result is unconfirmed; inspect its operation before retrying" }), daemonBudgetMs(input.tool) + 1000);
12465
13825
  timer.unref?.();
12466
13826
  try {
13827
+ const reply = lease.requestContext ? this.requestContextCapturedReply(lease.requestContext) : undefined;
13828
+ call = lease.requestContext ? Object.freeze({ id: randomUUID(), admission: lease.requestContext, get replyRoute() { return reply?.route(); }, waitForReplyRoute: reply?.wait, current: () => current() && (!reply || reply.current()) }) : undefined;
13829
+ if (call)
13830
+ this.requestContextCalls.set(call.id, call);
12467
13831
  this.handleToolCall({ ...input, requestId: ++this.fleetRequestSeq }, undefined, {
12468
13832
  current,
12469
13833
  dispatch: (tool, args, respond) => {
@@ -12483,7 +13847,7 @@ export class Daemon extends EventEmitter {
12483
13847
  ...(typeof value.errorCode === "string" || typeof value.errorCode === "number" ? { errorCode: value.errorCode } : {}) });
12484
13848
  return false;
12485
13849
  },
12486
- });
13850
+ }, call);
12487
13851
  }
12488
13852
  catch {
12489
13853
  finish({ result: null, error: "Pane tool operation failed" });
@@ -12496,7 +13860,26 @@ export class Daemon extends EventEmitter {
12496
13860
  return;
12497
13861
  this.emit("mcp_tool_response_written", { operationId, daemonBootId: this.bootId });
12498
13862
  }
12499
- handleToolCall(msg, socket, peer) {
13863
+ handleToolCall(msg, socket, peer, originatingCall) {
13864
+ const finish = this.requestContextPendingWork?.begin(this.name);
13865
+ const dispatch = () => Daemon.prototype.handleTrackedToolCall.call(this, msg, socket, peer, originatingCall, finish);
13866
+ const expanded = originatingCall?.waitForReplyRoute ? expandReplyWaitCall(String(msg.tool), (msg.args ?? {})) : null;
13867
+ if (originatingCall?.waitForReplyRoute && expanded && !("error" in expanded) && ["reply", "edit_message", "react"].includes(expanded.name)) {
13868
+ // Submission proof progresses independently. No policy, adapter effect or
13869
+ // Fleet forward runs before this original call's delivery and arm settle.
13870
+ void originatingCall.waitForReplyRoute(daemonBudgetMs(expanded.name)).then(dispatch, dispatch).catch(() => finish?.());
13871
+ return;
13872
+ }
13873
+ try {
13874
+ dispatch();
13875
+ }
13876
+ catch (error) {
13877
+ finish?.();
13878
+ throw error;
13879
+ }
13880
+ }
13881
+ handleTrackedToolCall(msg, socket, peer, originatingCall, finish) {
13882
+ const runLocal = (work) => this.requestContextPendingWork ? this.requestContextPendingWork.run(this.name, work) : work();
12500
13883
  const tool = msg.tool;
12501
13884
  const args = (msg.args ?? {});
12502
13885
  const requestId = msg.requestId;
@@ -12518,68 +13901,108 @@ export class Daemon extends EventEmitter {
12518
13901
  : null;
12519
13902
  // For now, log and respond. Full adapter routing will be wired in fleet manager.
12520
13903
  const respond = (result, error, errorCode) => {
12521
- // A message that verifiably went out stands down the dead-MCP proxy reply
12522
- // for this turn: the agent proved it can still speak for itself.
12523
- if (!error && result != null && TURN_OUTBOUND_TOOLS.has(tool)) {
12524
- this.turnReplyGuard.settleToolAttempt(replyAttempt, true);
12525
- // #1209 P2: the user got an answer — the turn is over for resume
12526
- // purposes even before the idle edge completes the guard. Without
12527
- // this, a restart in the reply-to-idle window would re-inject a
12528
- // continuation for an already-answered turn.
12529
- if (replyAttempt?.completionAction) {
12530
- clearInFlightTurnMarker(this.instanceDir);
12531
- this.publishWorkingState("completion_delivered");
12532
- }
12533
- // #1377: a confirmed completion action (reply/react/edit_message) ends
12534
- // the human-facing obligation immediately — the idle edge does not need
12535
- // to confirm it. Clear any pending confirmation window so a later
12536
- // cross-instance busy→idle cycle cannot re-arm and fire false recovery.
12537
- // The guard itself completes on the next steady-idle tick via
12538
- // maybeConfirmReplyGuardIdle (which checks completionDelivered when
12539
- // replyGuardIdleConfirm is null) or at the next busy→idle edge.
12540
- // Cancelled turns are excluded: their completion semantics are handled
12541
- // by the idle edge's cancelledByUser check.
12542
- // An older reply that satisfied an earlier obligation but not the latest
12543
- // one (latestObligation > token.obligation) leaves completionDelivered
12544
- // false and must not clear the window either.
12545
- if (replyAttempt?.completionAction) {
12546
- const snap = this.turnReplyGuard.snapshot();
12547
- // generation 0 is a pre-arm token applied to the live generation (#2544).
12548
- if (snap && (snap.generation === replyAttempt.generation || replyAttempt.generation === 0)
12549
- && snap.phase === "awaiting"
12550
- && snap.completionDelivered && !snap.cancelledByUser) {
12551
- this.clearReplyGuardConfirm();
13904
+ try {
13905
+ if (originatingCall && !originatingCall.current()) {
13906
+ result = null;
13907
+ error = `Tool outcome is unconfirmed. ${operationId ? `Inspect operation ${operationId}` : "Inspect the tool operation status"}; do not repeat it.`;
13908
+ }
13909
+ if (originatingCall)
13910
+ this.requestContextCalls.delete(originatingCall.id);
13911
+ // A message that verifiably went out stands down the dead-MCP proxy reply
13912
+ // for this turn: the agent proved it can still speak for itself.
13913
+ if (!error && result != null && TURN_OUTBOUND_TOOLS.has(tool)) {
13914
+ this.turnReplyGuard.settleToolAttempt(replyAttempt, true);
13915
+ // #1209 P2: the user got an answer — the turn is over for resume
13916
+ // purposes even before the idle edge completes the guard. Without
13917
+ // this, a restart in the reply-to-idle window would re-inject a
13918
+ // continuation for an already-answered turn.
13919
+ if (replyAttempt?.completionAction) {
13920
+ clearInFlightTurnMarker(this.instanceDir);
13921
+ this.publishWorkingState("completion_delivered");
12552
13922
  }
13923
+ // #1377: a confirmed completion action (reply/react/edit_message) ends
13924
+ // the human-facing obligation immediately — the idle edge does not need
13925
+ // to confirm it. Clear any pending confirmation window so a later
13926
+ // cross-instance busy→idle cycle cannot re-arm and fire false recovery.
13927
+ // The guard itself completes on the next steady-idle tick via
13928
+ // maybeConfirmReplyGuardIdle (which checks completionDelivered when
13929
+ // replyGuardIdleConfirm is null) or at the next busy→idle edge.
13930
+ // Cancelled turns are excluded: their completion semantics are handled
13931
+ // by the idle edge's cancelledByUser check.
13932
+ // An older reply that satisfied an earlier obligation but not the latest
13933
+ // one (latestObligation > token.obligation) leaves completionDelivered
13934
+ // false and must not clear the window either.
13935
+ if (replyAttempt?.completionAction) {
13936
+ const snap = this.turnReplyGuard.snapshot();
13937
+ // generation 0 is a pre-arm token applied to the live generation (#2544).
13938
+ if (snap && (snap.generation === replyAttempt.generation || replyAttempt.generation === 0)
13939
+ && snap.phase === "awaiting"
13940
+ && snap.completionDelivered && !snap.cancelledByUser) {
13941
+ this.clearReplyGuardConfirm();
13942
+ }
13943
+ }
13944
+ }
13945
+ else if ((error || result == null) && replyAttempt?.reply && TURN_OUTBOUND_TOOLS.has(tool)) {
13946
+ // #1377: the adapter returned a definitive error — record this so the
13947
+ // confirm window can distinguish "in-flight" (unknown) from "known
13948
+ // failed" and report unknown immediately rather than starting recovery.
13949
+ this.turnReplyGuard.settleToolAttempt(replyAttempt, false);
13950
+ }
13951
+ const packet = { requestId, result, error, operationId, ...(errorCode !== undefined ? { errorCode } : {}) };
13952
+ const sent = peer ? peer.current() && peer.send(packet) : socket ? this.ipcServer?.send(socket, packet) ?? false : false;
13953
+ if (!sent) {
13954
+ if (peer)
13955
+ this.logger.debug({ tool, requestId }, "Native MCP result awaits transport-written confirmation");
13956
+ else
13957
+ this.logger.warn({ tool, requestId }, "Tool result could not be returned — originating MCP socket is closed");
13958
+ }
13959
+ else if (operationId) {
13960
+ this.emit("mcp_tool_response_written", { operationId, daemonBootId: this.bootId });
12553
13961
  }
12554
13962
  }
12555
- else if ((error || result == null) && replyAttempt?.reply && TURN_OUTBOUND_TOOLS.has(tool)) {
12556
- // #1377: the adapter returned a definitive error — record this so the
12557
- // confirm window can distinguish "in-flight" (unknown) from "known
12558
- // failed" and report unknown immediately rather than starting recovery.
12559
- this.turnReplyGuard.settleToolAttempt(replyAttempt, false);
13963
+ finally {
13964
+ finish?.();
12560
13965
  }
12561
- const packet = { requestId, result, error, operationId, ...(errorCode !== undefined ? { errorCode } : {}) };
12562
- const sent = peer ? peer.current() && peer.send(packet) : socket ? this.ipcServer?.send(socket, packet) ?? false : false;
12563
- if (!sent) {
12564
- if (peer)
12565
- this.logger.debug({ tool, requestId }, "Native MCP result awaits transport-written confirmation");
13966
+ };
13967
+ const sendFleet = (message) => {
13968
+ if (originatingCall && !originatingCall.current()) {
13969
+ const id = String(message.fleetRequestId ?? ""), callback = this.pendingIpcRequests.get(id);
13970
+ this.pendingIpcRequests.delete(id);
13971
+ if (callback)
13972
+ callback({ error: "Originating request context is no longer current" });
12566
13973
  else
12567
- this.logger.warn({ tool, requestId }, "Tool result could not be returned — originating MCP socket is closed");
12568
- }
12569
- else if (operationId) {
12570
- this.emit("mcp_tool_response_written", { operationId, daemonBootId: this.bootId });
13974
+ respond(null, "Originating request context is no longer current");
13975
+ return;
12571
13976
  }
13977
+ this.broadcastFleetMessage(originatingCall ? { ...message, requestContextCallId: originatingCall.id, sourceDaemonBootId: this.bootId } : message);
12572
13978
  };
13979
+ try {
13980
+ if (this.requestContextPolicy)
13981
+ requireRequestContextPolicy(this, this.name, tool, args, originatingCall?.admission, originatingCall?.replyRoute);
13982
+ }
13983
+ catch (error) {
13984
+ respond(null, error.message);
13985
+ return;
13986
+ }
13987
+ if (this.requestContextLifecycle && !peer && !originatingCall || originatingCall && !originatingCall.current()) {
13988
+ respond(null, "Originating request context is unavailable");
13989
+ return;
13990
+ }
13991
+ // These local shell mutations have no scoped admission boundary yet (F); never imply coverage.
13992
+ if (originatingCall && (tool === "checkout_repo" || tool === "release_repo")) {
13993
+ respond(null, "This operation is not covered by request-context admission");
13994
+ return;
13995
+ }
12573
13996
  // Native Fleet/task operations carry their lease to the existing dispatcher mutation admission points.
12574
13997
  if (peer?.dispatch?.(tool, args, respond))
12575
13998
  return;
12576
13999
  // Repo checkout — handled locally in daemon (no fleet-manager)
12577
14000
  if (tool === "checkout_repo") {
12578
- this.handleCheckoutRepo(args, respond);
14001
+ void runLocal(() => this.handleCheckoutRepo(args, respond));
12579
14002
  return;
12580
14003
  }
12581
14004
  if (tool === "release_repo") {
12582
- this.handleReleaseRepo(args, respond);
14005
+ void runLocal(() => this.handleReleaseRepo(args, respond));
12583
14006
  return;
12584
14007
  }
12585
14008
  if (tool === "set_display_name" || tool === "set_description" || tool === "list_emojis" || tool === "set_persona_emoji" || tool === "preview_emojis"
@@ -12601,7 +14024,7 @@ export class Daemon extends EventEmitter {
12601
14024
  clearTimeout(timeout);
12602
14025
  respond(respMsg.result, respMsg.error);
12603
14026
  });
12604
- this.broadcastFleetMessage({
14027
+ sendFleet({
12605
14028
  type,
12606
14029
  payload: args,
12607
14030
  meta: { instance_name: this.name },
@@ -12627,9 +14050,9 @@ export class Daemon extends EventEmitter {
12627
14050
  clearTimeout(timeout);
12628
14051
  resolve({ result: respMsg.result, error: respMsg.error });
12629
14052
  });
12630
- this.broadcastFleetMessage({ type: WEB_THEME_IPC[tool], payload, meta: { instance_name: this.name }, fleetRequestId: fleetReqId });
14053
+ sendFleet({ type: WEB_THEME_IPC[tool], payload, meta: { instance_name: this.name }, fleetRequestId: fleetReqId });
12631
14054
  });
12632
- void (async () => {
14055
+ void runLocal(async () => {
12633
14056
  if (tool === "preview_web_appearance") {
12634
14057
  // The fleet builds the SVGs (whole, or in parts); they are written here, in the working directory.
12635
14058
  const first = await ask({ ...(args.modes !== undefined ? { modes: args.modes } : {}) });
@@ -12691,25 +14114,37 @@ export class Daemon extends EventEmitter {
12691
14114
  return (r.result && typeof r.result === "object" ? r.result : {});
12692
14115
  });
12693
14116
  reply(failed ? null : answer, failed);
12694
- })().catch((err) => reply(null, `${tool} failed: ${err instanceof Error ? err.message : "error"}`));
14117
+ }).catch((err) => reply(null, `${tool} failed: ${err instanceof Error ? err.message : "error"}`));
12695
14118
  return;
12696
14119
  }
12697
14120
  if (tool === TASK_TOOL) {
12698
- const fleetReqId = `task_${++this.fleetRequestSeq}_${requestId}`;
12699
- const timeout = setTimeout(() => {
12700
- this.pendingIpcRequests.delete(fleetReqId);
12701
- respond(null, `Task operation timed out after ${daemonBudgetMs(tool) / 1000}s`);
12702
- }, daemonBudgetMs(tool));
12703
- this.pendingIpcRequests.set(fleetReqId, (respMsg) => {
12704
- clearTimeout(timeout);
12705
- respond(respMsg.result, respMsg.error);
12706
- });
12707
- this.broadcastFleetMessage({
12708
- type: "fleet_task",
12709
- payload: args,
12710
- meta: { instance_name: this.name },
12711
- fleetRequestId: fleetReqId,
14121
+ // One call to the fleet's task tool; resolves with its answer or an error string (never rejects).
14122
+ const askTask = (payload) => new Promise((resolve) => {
14123
+ const fleetReqId = `task_${++this.fleetRequestSeq}_${requestId}`;
14124
+ const timeout = setTimeout(() => {
14125
+ this.pendingIpcRequests.delete(fleetReqId);
14126
+ resolve({ error: `Task operation timed out after ${daemonBudgetMs(tool) / 1000}s` });
14127
+ }, daemonBudgetMs(tool));
14128
+ this.pendingIpcRequests.set(fleetReqId, (respMsg) => {
14129
+ clearTimeout(timeout);
14130
+ resolve({ result: respMsg.result, error: respMsg.error });
14131
+ });
14132
+ sendFleet({
14133
+ type: "fleet_task",
14134
+ payload,
14135
+ meta: { instance_name: this.name },
14136
+ fleetRequestId: fleetReqId,
14137
+ });
12712
14138
  });
14139
+ // files named in `attach` are read HERE, on the agent's side (its working directory, no symlink, size-capped),
14140
+ // and staged on the fleet in parts; the write itself then carries their ids. The fleet never opens a workspace path.
14141
+ void runLocal(async () => {
14142
+ const sent = await sendTaskWrite(args, { workspace: this.config.working_directory, configuredWorkspace: this.config.working_directory, stateDir: getAgendHome(), instance: this.name }, askTask);
14143
+ if (sent.staging)
14144
+ respond(null, sent.error);
14145
+ else
14146
+ respond(sent.answer.result, sent.answer.error);
14147
+ }).catch((err) => respond(null, `task failed: ${err instanceof Error ? err.message : "error"}`));
12713
14148
  return;
12714
14149
  }
12715
14150
  if (DECISION_TOOLS.has(tool)) {
@@ -12727,7 +14162,7 @@ export class Daemon extends EventEmitter {
12727
14162
  clearTimeout(timeout);
12728
14163
  respond(respMsg.result, respMsg.error);
12729
14164
  });
12730
- this.broadcastFleetMessage({
14165
+ sendFleet({
12731
14166
  type: typeMap[tool],
12732
14167
  payload: args,
12733
14168
  meta: { instance_name: this.name, working_directory: this.config.working_directory },
@@ -12754,7 +14189,7 @@ export class Daemon extends EventEmitter {
12754
14189
  clearTimeout(timeout);
12755
14190
  respond(respMsg.result, respMsg.error);
12756
14191
  });
12757
- this.broadcastFleetMessage({
14192
+ sendFleet({
12758
14193
  type: typeMap[tool],
12759
14194
  payload: args,
12760
14195
  meta: {
@@ -12785,11 +14220,11 @@ export class Daemon extends EventEmitter {
12785
14220
  clearTimeout(timeout);
12786
14221
  respond(respMsg.result, respMsg.error);
12787
14222
  });
12788
- this.broadcastFleetMessage({
14223
+ sendFleet({
12789
14224
  type: "fleet_outbound",
12790
14225
  tool,
12791
14226
  args,
12792
- ...(operationId ? { operationId, sourceDaemonBootId: this.bootId } : {}),
14227
+ ...((operationId || (tool.startsWith("hub_room_") || tool === "hub_people_search")) ? { ...(operationId ? { operationId } : {}), sourceDaemonBootId: this.bootId } : {}),
12793
14228
  fleetRequestId: fleetReqId,
12794
14229
  senderSessionName,
12795
14230
  });
@@ -12802,7 +14237,19 @@ export class Daemon extends EventEmitter {
12802
14237
  // Context-bound routing: reply/react/edit_message always use the daemon's last known context.
12803
14238
  // chat_id and thread_id are not exposed in the tool schema — daemon is solely responsible for routing.
12804
14239
  // Must run before IPC forwarding so topic-mode (fleet manager) also receives the correct chat_id.
12805
- if (["reply", "react", "edit_message"].includes(tool)) {
14240
+ const ownedReplyRoute = this.requestContextPolicy && ["reply", "react", "edit_message"].includes(tool) ? originatingCall?.replyRoute : undefined;
14241
+ if (ownedReplyRoute) {
14242
+ if (!ownedReplyRoute.current()) {
14243
+ respond(null, "Originating request context is no longer current");
14244
+ return;
14245
+ }
14246
+ args.chat_id = ownedReplyRoute.target.chatId;
14247
+ if (ownedReplyRoute.target.threadId)
14248
+ args.thread_id = ownedReplyRoute.target.threadId;
14249
+ else
14250
+ delete args.thread_id;
14251
+ }
14252
+ if (!ownedReplyRoute && ["reply", "react", "edit_message"].includes(tool)) {
12806
14253
  const adapters = this.messageBus.getAllAdapters();
12807
14254
  const isTopicMode = adapters.length === 0;
12808
14255
  if (!this.lastChatId && !isTopicMode) {
@@ -12844,7 +14291,7 @@ export class Daemon extends EventEmitter {
12844
14291
  // Register the waiter before broadcasting. A fast/mock adapter can settle
12845
14292
  // immediately; broadcasting first left a response-before-registration
12846
14293
  // window that degraded into a timeout despite a completed POST.
12847
- this.broadcastFleetMessage({
14294
+ sendFleet({
12848
14295
  type: "fleet_outbound",
12849
14296
  tool,
12850
14297
  args,
@@ -12853,15 +14300,16 @@ export class Daemon extends EventEmitter {
12853
14300
  // Preserve the exact adapter world that supplied the chat context. An
12854
14301
  // instance binding is only a fallback: persisted/runtime context can be
12855
14302
  // from a secondary world, and message ids are not portable across bots.
12856
- adapterId: this.lastAdapterId,
14303
+ adapterId: ownedReplyRoute ? ownedReplyRoute.target.adapterId : this.lastAdapterId,
12857
14304
  });
12858
14305
  return;
12859
14306
  }
12860
14307
  // Same rule as deliverDaemonReply: one adapter is unambiguous, several with
12861
14308
  // no bound world is a routing failure rather than a first-wins guess.
12862
- const adapter = this.lastAdapterId
12863
- ? this.messageBus.getAdapter(this.lastAdapterId) ?? (adapters.length === 1 ? adapters[0] : undefined)
12864
- : (adapters.length === 1 ? adapters[0] : undefined);
14309
+ const selectedAdapter = ownedReplyRoute ? ownedReplyRoute.target.adapterId : this.lastAdapterId;
14310
+ const adapter = selectedAdapter
14311
+ ? this.messageBus.getAdapter(selectedAdapter) ?? (!ownedReplyRoute && adapters.length === 1 ? adapters[0] : undefined)
14312
+ : (!ownedReplyRoute && adapters.length === 1 ? adapters[0] : undefined);
12865
14313
  if (!adapter) {
12866
14314
  respond(null, "No channel world bound to this chat context — awaiting an inbound message to establish it");
12867
14315
  return;
@@ -12884,7 +14332,8 @@ export class Daemon extends EventEmitter {
12884
14332
  delete routed.buttons;
12885
14333
  }
12886
14334
  }
12887
- if (!routeToolCall(adapter, tool, routed, this.lastThreadId, respond)) {
14335
+ if (!routeToolCall(adapter, tool, routed, ownedReplyRoute ? ownedReplyRoute.target.threadId : this.lastThreadId, respond, ownedReplyRoute ? { beforeSend: () => { if (!originatingCall?.current() || !ownedReplyRoute.current() || !selectedAdapter || this.messageBus.getAdapter(selectedAdapter) !== adapter)
14336
+ throw Error("Originating request context is no longer current"); } } : {})) {
12888
14337
  respond(null, `Unknown tool: ${tool}`);
12889
14338
  }
12890
14339
  }
@@ -12909,7 +14358,7 @@ export class Daemon extends EventEmitter {
12909
14358
  };
12910
14359
  }
12911
14360
  /** Build config object for the CLI backend */
12912
- buildBackendConfig() {
14361
+ buildBackendConfig(forLaunch = true) {
12913
14362
  // Antigravity 1.1.17 has no per-workspace MCP config, but its global MCP
12914
14363
  // children inherit the CLI process environment. The backend installs one
12915
14364
  // environment-selecting launcher, so MCP is now the safe default here too.
@@ -12988,6 +14437,11 @@ export class Daemon extends EventEmitter {
12988
14437
  ? resolveToolSet(this.config, this.name, "general")
12989
14438
  : resolveToolSet(this.config, this.name);
12990
14439
  mcpEnv.AGEND_TOOL_SET = toolSet;
14440
+ if (this.classicRestriction)
14441
+ mcpEnv.AGEND_CLASSIC_ALLOWED_TOOLS = JSON.stringify(this.classicRestriction.allowedAgendTools);
14442
+ const helperLaunch = this.requestContextHelper?.environment();
14443
+ if (helperLaunch)
14444
+ mcpEnv.AGEND_LAUNCH_TOKEN = helperLaunch;
12991
14445
  // The dashboard features the person switched off: out of the tool menu from this start (the fleet refuses them
12992
14446
  // at once, whatever the menu still shows).
12993
14447
  const dashboardOff = dashboardFeaturesOff(dashboardAccessOf(this.config));
@@ -13024,13 +14478,17 @@ export class Daemon extends EventEmitter {
13024
14478
  }
13025
14479
  catch { /* fallback to empty */ }
13026
14480
  instructions = buildFleetInstructions({
14481
+ ...(requestContextInstructionMode(this.requestContextPolicy) !== null && this.requestContextLifecycle && (!this.nativePaneLifecycle || this.nativePaneLifecycle.requestContextAvailable?.() === true)
14482
+ ? { requestContextPolicyInstalled: true } : {}),
13027
14483
  instanceName: this.name,
13028
14484
  taskBoard: !dashboardOff.includes("task_board"),
13029
14485
  workingDirectory: this.config.working_directory,
13030
14486
  runtimeIdentity: this.runtimeIdentity,
14487
+ restrictedClassic: !!this.classicRestriction,
13031
14488
  displayName: this.config.display_name,
13032
14489
  description: this.config.description,
13033
14490
  customPrompt: resolvedCustomPrompt,
14491
+ operations: this.config.operations,
13034
14492
  workflow: resolvedWorkflow,
13035
14493
  decisions,
13036
14494
  statusEmojis,
@@ -13039,13 +14497,17 @@ export class Daemon extends EventEmitter {
13039
14497
  }
13040
14498
  else {
13041
14499
  instructions = buildFleetInstructions({
14500
+ ...(requestContextInstructionMode(this.requestContextPolicy) !== null && this.requestContextLifecycle && (!this.nativePaneLifecycle || this.nativePaneLifecycle.requestContextAvailable?.() === true)
14501
+ ? { requestContextPolicyInstalled: true } : {}),
13042
14502
  instanceName: this.name,
13043
14503
  taskBoard: !dashboardOff.includes("task_board"),
13044
14504
  workingDirectory: this.config.working_directory,
13045
14505
  runtimeIdentity: this.runtimeIdentity,
14506
+ restrictedClassic: !!this.classicRestriction,
13046
14507
  displayName: this.config.display_name,
13047
14508
  description: this.config.description,
13048
14509
  customPrompt: resolvedCustomPrompt,
14510
+ operations: this.config.operations,
13049
14511
  workflow: resolvedWorkflow,
13050
14512
  decisions,
13051
14513
  statusEmojis,
@@ -13054,7 +14516,11 @@ export class Daemon extends EventEmitter {
13054
14516
  const agentPort = parseInt(process.env.AGEND_PORT ?? "19280", 10);
13055
14517
  const backendName = this.config.backend ?? "claude-code";
13056
14518
  const backendOptions = this.config.backend_options?.[backendName];
14519
+ const managedClaudeCredential = forLaunch && backendName === "claude-code"
14520
+ ? managedClaudeBinding(resolve(this.instanceDir, "..", ".."), resolveCredentialProfile(backendOptions)) : null;
13057
14521
  return {
14522
+ ...(managedClaudeCredential ? { managedClaudeCredential } : {}),
14523
+ ...(this.classicRestriction ? { classicRestriction: this.classicRestriction } : {}),
13058
14524
  workingDirectory: this.config.working_directory,
13059
14525
  instanceDir: this.instanceDir,
13060
14526
  instanceName: this.name,
@@ -13168,6 +14634,7 @@ export class Daemon extends EventEmitter {
13168
14634
  this.humanReminderAttempts?.clear();
13169
14635
  this.cliOomObservation = null;
13170
14636
  this.spawnGeneration++;
14637
+ this.requestContextAdmission?.changed();
13171
14638
  this.interactionObservation.reset(this.interactionOwner());
13172
14639
  this.clearInteractionConfirmation();
13173
14640
  this.inputTransientGuardGeneration = (this.backend?.getInputUnavailableTransients?.().length ?? 0) > 0
@@ -13549,6 +15016,8 @@ export class Daemon extends EventEmitter {
13549
15016
  finally {
13550
15017
  this.endSpawn();
13551
15018
  }
15019
+ if (!resumedSuccessfully)
15020
+ this.requestContextNewWork("fresh");
13552
15021
  return resumedSuccessfully;
13553
15022
  }
13554
15023
  /** The whole agent switch after a resume, on the monotonic clock (#906 §3). */
@@ -14016,6 +15485,7 @@ export class Daemon extends EventEmitter {
14016
15485
  if (this.startupAborted)
14017
15486
  return;
14018
15487
  this.startupAborted = true;
15488
+ this.requestContextHelper?.revoke();
14019
15489
  this.freezeRuntimeMonitors();
14020
15490
  this.pendingIpcRequests.clear();
14021
15491
  if (this.museUsageRelay) {
@@ -14432,12 +15902,20 @@ export class Daemon extends EventEmitter {
14432
15902
  if (this.nativePaneLifecycle)
14433
15903
  throw Error("Native relaunch requires its owned exit and a new lifecycle reservation");
14434
15904
  let expectedAttempt = this.launchAttempt;
14435
- const admit = () => { this.startupAdmission?.(); if (repairAdmission && !repairAdmission(expectedAttempt))
14436
- throw new Error("CLI repair superseded by another launch, pause or stop"); };
15905
+ const restrictionStamp = this.classicRestriction ? classicPlanDigest(this.classicRestriction) : null;
15906
+ const admit = () => {
15907
+ this.startupAdmission?.();
15908
+ this.assertClassicRestrictionLaunch(restrictionStamp);
15909
+ if (repairAdmission && !repairAdmission(expectedAttempt))
15910
+ throw new Error("CLI repair superseded by another launch, pause or stop");
15911
+ };
14437
15912
  this.assertSessionOomAdmission();
14438
15913
  admit();
14439
15914
  const launchFence = this.launchFenceEpoch;
14440
- const backendConfig = this.buildBackendConfig();
15915
+ const helperLaunch = this.requestContextHelper?.begin();
15916
+ const backendConfig = this.buildBackendConfig(true);
15917
+ if (this.classicRestrictionFailed)
15918
+ throw Error("Restricted room policy is unavailable");
14441
15919
  // A compatibility refusal is not a failed resume: no configuration, pin, history or pane may change.
14442
15920
  if (this.backend?.assertLaunchSupported) {
14443
15921
  this.backend.assertLaunchSupported(backendConfig);
@@ -14467,6 +15945,7 @@ export class Daemon extends EventEmitter {
14467
15945
  if (launchFence !== this.launchFenceEpoch)
14468
15946
  throw new Error("Launch cancelled: the instance was stopped or paused while the launch was being prepared");
14469
15947
  this.backend.writeConfig(backendConfig);
15948
+ this.classicRestrictionNeedsRestart = false;
14470
15949
  if (freshInboundInstructions)
14471
15950
  this.installCompactInboundInstructions();
14472
15951
  else {
@@ -14475,6 +15954,7 @@ export class Daemon extends EventEmitter {
14475
15954
  this.resetInboundPresentation();
14476
15955
  }
14477
15956
  this.backend.preTrust?.(this.config.working_directory, backendConfig);
15957
+ this.checkClaudeMcpServers(backendConfig);
14478
15958
  // Resolve working directory (e.g. symlink for hidden paths)
14479
15959
  const resolvedCwd = this.backend.resolveWorkingDirectory?.(this.config.working_directory, this.name) ?? this.config.working_directory;
14480
15960
  // Generate a fresh per-instance agent token each spawn. agent-cli reads
@@ -14562,20 +16042,42 @@ export class Daemon extends EventEmitter {
14562
16042
  admit();
14563
16043
  let windowId;
14564
16044
  this.assertSessionOomAdmission();
14565
- if (reuseWindow) {
14566
- this.controlClient?.unregisterWindow(this.tmux.getWindowId());
14567
- await this.tmux.respawnWindow(cmd, resolvedCwd, repairAdmission ? admit : undefined);
14568
- windowId = this.tmux.getWindowId();
16045
+ const retirementResources = this.requestContextStartupResources;
16046
+ if (retirementResources)
16047
+ retirementResources.pending++;
16048
+ try {
16049
+ if (reuseWindow) {
16050
+ this.controlClient?.unregisterWindow(this.tmux.getWindowId());
16051
+ await this.tmux.respawnWindow(cmd, resolvedCwd, repairAdmission ? admit : undefined);
16052
+ windowId = this.tmux.getWindowId();
16053
+ }
16054
+ else {
16055
+ // A crash respawn makes a brand new window. The dead one stays registered
16056
+ // unless we say so — the respawn branch above already does.
16057
+ const retired = this.tmux.getWindowId();
16058
+ windowId = await this.tmux.createWindow(cmd, resolvedCwd, this.name);
16059
+ if (retired && retired !== windowId)
16060
+ this.controlClient?.unregisterWindow(retired);
16061
+ }
16062
+ if (retirementResources) {
16063
+ const pid = await this.paneHost.getPanePid(this.tmuxSessionName, windowId);
16064
+ if (!pid || !Number.isSafeInteger(pid) || pid <= 1)
16065
+ throw Error("Request startup process identity unavailable");
16066
+ retirementResources.windows.push({ session: this.tmuxSessionName, window: windowId, pid });
16067
+ }
14569
16068
  }
14570
- else {
14571
- // A crash respawn makes a brand new window. The dead one stays registered
14572
- // unless we say so — the respawn branch above already does.
14573
- const retired = this.tmux.getWindowId();
14574
- windowId = await this.tmux.createWindow(cmd, resolvedCwd, this.name);
14575
- if (retired && retired !== windowId)
14576
- this.controlClient?.unregisterWindow(retired);
16069
+ catch (error) {
16070
+ if (retirementResources)
16071
+ retirementResources.unknown = true;
16072
+ throw error;
16073
+ }
16074
+ finally {
16075
+ if (retirementResources)
16076
+ retirementResources.pending--;
14577
16077
  }
14578
16078
  admit();
16079
+ if (helperLaunch)
16080
+ this.requestContextHelper.confirm(helperLaunch);
14579
16081
  this.writeWindowId(windowId);
14580
16082
  // Enable remain-on-exit to capture exit codes on crash
14581
16083
  await this.tmux.setRemainOnExit().catch(err => {
@@ -15041,11 +16543,41 @@ export class Daemon extends EventEmitter {
15041
16543
  this.lastIdleSessionRefreshAt = now;
15042
16544
  void refresh.call(this.backend).then(() => this.saveSessionId(), () => { });
15043
16545
  }
16546
+ roomConversationState = null;
16547
+ roomConversationGeneration() {
16548
+ try {
16549
+ // Local non-Claude backends checkpoint their own session below; do not replace it with a Claude-only field.
16550
+ if (this.nativePaneLifecycle || (this.config.backend ?? "claude-code") === "claude-code")
16551
+ this.roomConversationState?.observeSession(this.ownedWorkingSession);
16552
+ }
16553
+ catch (err) {
16554
+ this.logger.warn({ err }, "Room conversation checkpoint failed");
16555
+ return null;
16556
+ }
16557
+ return this.roomConversationState?.current() ?? null;
16558
+ }
16559
+ resetRoomConversation(reattached = false) {
16560
+ this.roomConversationState ??= new RoomConversationGeneration(this.instanceDir);
16561
+ try {
16562
+ this.roomConversationState.start(reattached);
16563
+ }
16564
+ catch (err) {
16565
+ this.logger.warn({ err }, "Room conversation generation is unconfirmed");
16566
+ }
16567
+ }
16568
+ roomInputHandedOff(meta) {
16569
+ const generation = meta.hub_room_context_generation;
16570
+ if (meta.from_instance !== HUB_REPORT_TARGET || !generation || generation !== this.roomConversationGeneration())
16571
+ return;
16572
+ this.hubRoomInputEpoch++;
16573
+ this.broadcastFleetMessage({ type: "hub_room_input", correlationId: meta.correlation_id, generation });
16574
+ }
15044
16575
  saveSessionId() {
15045
16576
  if (this.nativePaneLifecycle) {
15046
16577
  try {
15047
16578
  this.nativePaneLifecycle.checkpointSession();
15048
16579
  this.ownedWorkingSession = this.backend?.getSessionId() ?? null;
16580
+ this.roomConversationState?.observeSession(this.ownedWorkingSession);
15049
16581
  }
15050
16582
  catch (err) {
15051
16583
  this.logger.warn({ err }, "Native conversation checkpoint is unconfirmed");
@@ -15060,6 +16592,7 @@ export class Daemon extends EventEmitter {
15060
16592
  const sid = this.backend?.getSessionId();
15061
16593
  if (!sid)
15062
16594
  return;
16595
+ this.roomConversationState?.observeSession(sid);
15063
16596
  if ((this.config.backend ?? "claude-code") === "claude-code" && Buffer.byteLength(sid) <= 256
15064
16597
  && !/[\u0000-\u001f\u007f]/.test(sid) && this.ownedWorkingSession !== sid) {
15065
16598
  this.ownedWorkingSession = sid;