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

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 (2016) 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 +121 -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 +249 -3
  242. package/dist/daemon.js +1730 -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 +1399 -29
  273. package/dist/fleet-manager.js +8192 -619
  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/admission.d.ts +2 -0
  402. package/dist/hub/admission.js +13 -0
  403. package/dist/hub/admission.js.map +1 -1
  404. package/dist/hub/agent-catalog-model.d.ts +297 -0
  405. package/dist/hub/agent-catalog-model.js +57 -0
  406. package/dist/hub/agent-catalog-model.js.map +1 -0
  407. package/dist/hub/agent-catalog.d.ts +140 -0
  408. package/dist/hub/agent-catalog.js +130 -0
  409. package/dist/hub/agent-catalog.js.map +1 -0
  410. package/dist/hub/agent-intro-model.d.ts +38 -0
  411. package/dist/hub/agent-intro-model.js +14 -0
  412. package/dist/hub/agent-intro-model.js.map +1 -0
  413. package/dist/hub/agent-intro-tool.d.ts +35 -0
  414. package/dist/hub/agent-intro-tool.js +83 -0
  415. package/dist/hub/agent-intro-tool.js.map +1 -0
  416. package/dist/hub/agent-intro.d.ts +31 -0
  417. package/dist/hub/agent-intro.js +51 -0
  418. package/dist/hub/agent-intro.js.map +1 -0
  419. package/dist/hub/agent-pictures-model.d.ts +275 -0
  420. package/dist/hub/agent-pictures-model.js +103 -0
  421. package/dist/hub/agent-pictures-model.js.map +1 -0
  422. package/dist/hub/agent-pictures.d.ts +64 -0
  423. package/dist/hub/agent-pictures.js +256 -0
  424. package/dist/hub/agent-pictures.js.map +1 -0
  425. package/dist/hub/attachments/store.d.ts +2 -0
  426. package/dist/hub/attachments/store.js +6 -0
  427. package/dist/hub/attachments/store.js.map +1 -1
  428. package/dist/hub/audit/index.d.ts +5 -1
  429. package/dist/hub/audit/index.js +43 -3
  430. package/dist/hub/audit/index.js.map +1 -1
  431. package/dist/hub/buttons.js +3 -1
  432. package/dist/hub/buttons.js.map +1 -1
  433. package/dist/hub/catalog.d.ts +19 -6
  434. package/dist/hub/catalog.js +102 -27
  435. package/dist/hub/catalog.js.map +1 -1
  436. package/dist/hub/client.d.ts +30 -0
  437. package/dist/hub/client.js +293 -14
  438. package/dist/hub/client.js.map +1 -1
  439. package/dist/hub/compose/member.d.ts +67 -9
  440. package/dist/hub/compose/member.js +423 -36
  441. package/dist/hub/compose/member.js.map +1 -1
  442. package/dist/hub/compose/server.d.ts +30 -5
  443. package/dist/hub/compose/server.js +140 -20
  444. package/dist/hub/compose/server.js.map +1 -1
  445. package/dist/hub/direct-posts-model.d.ts +1 -0
  446. package/dist/hub/direct-posts-model.js +2 -0
  447. package/dist/hub/direct-posts-model.js.map +1 -0
  448. package/dist/hub/direct-posts.d.ts +36 -0
  449. package/dist/hub/direct-posts.js +145 -0
  450. package/dist/hub/direct-posts.js.map +1 -0
  451. package/dist/hub/directory/directory.js +27 -7
  452. package/dist/hub/directory/directory.js.map +1 -1
  453. package/dist/hub/directory/types.d.ts +10 -4
  454. package/dist/hub/directory/types.js.map +1 -1
  455. package/dist/hub/display-name.d.ts +10 -0
  456. package/dist/hub/display-name.js +35 -0
  457. package/dist/hub/display-name.js.map +1 -0
  458. package/dist/hub/execution/service.d.ts +2 -1
  459. package/dist/hub/execution/service.js +2 -1
  460. package/dist/hub/execution/service.js.map +1 -1
  461. package/dist/hub/fleet-info.d.ts +12 -0
  462. package/dist/hub/fleet-info.js +14 -0
  463. package/dist/hub/fleet-info.js.map +1 -0
  464. package/dist/hub/fleet-update-model.d.ts +100 -0
  465. package/dist/hub/fleet-update-model.js +15 -0
  466. package/dist/hub/fleet-update-model.js.map +1 -0
  467. package/dist/hub/fleet-updates.d.ts +46 -0
  468. package/dist/hub/fleet-updates.js +284 -0
  469. package/dist/hub/fleet-updates.js.map +1 -0
  470. package/dist/hub/fleet-versions.d.ts +28 -0
  471. package/dist/hub/fleet-versions.js +81 -0
  472. package/dist/hub/fleet-versions.js.map +1 -0
  473. package/dist/hub/group-policy/admin-api.d.ts +1 -0
  474. package/dist/hub/group-policy/admin-api.js +10 -1
  475. package/dist/hub/group-policy/admin-api.js.map +1 -1
  476. package/dist/hub/group-policy/admin-control.d.ts +1 -0
  477. package/dist/hub/group-policy/admin-control.js +13 -4
  478. package/dist/hub/group-policy/admin-control.js.map +1 -1
  479. package/dist/hub/group-policy/admin-dto.d.ts +39 -1
  480. package/dist/hub/group-policy/admin-dto.js.map +1 -1
  481. package/dist/hub/group-policy/admin-facts.d.ts +4 -2
  482. package/dist/hub/group-policy/admin-facts.js +17 -2
  483. package/dist/hub/group-policy/admin-facts.js.map +1 -1
  484. package/dist/hub/group-policy/admin-impact.d.ts +36 -6
  485. package/dist/hub/group-policy/admin-impact.js +21 -7
  486. package/dist/hub/group-policy/admin-impact.js.map +1 -1
  487. package/dist/hub/group-policy/admin-inventory.d.ts +2 -0
  488. package/dist/hub/group-policy/admin-inventory.js +13 -4
  489. package/dist/hub/group-policy/admin-inventory.js.map +1 -1
  490. package/dist/hub/group-policy/admin-search.d.ts +2 -1
  491. package/dist/hub/group-policy/admin-search.js +56 -7
  492. package/dist/hub/group-policy/admin-search.js.map +1 -1
  493. package/dist/hub/group-policy/authorization.d.ts +2 -0
  494. package/dist/hub/group-policy/authorization.js +7 -2
  495. package/dist/hub/group-policy/authorization.js.map +1 -1
  496. package/dist/hub/group-policy/impact-inventory.d.ts +4 -1
  497. package/dist/hub/group-policy/impact-inventory.js +23 -2
  498. package/dist/hub/group-policy/impact-inventory.js.map +1 -1
  499. package/dist/hub/group-policy/model.d.ts +52 -1
  500. package/dist/hub/group-policy/model.js +20 -7
  501. package/dist/hub/group-policy/model.js.map +1 -1
  502. package/dist/hub/group-policy/resources.d.ts +2 -0
  503. package/dist/hub/group-policy/resources.js +12 -1
  504. package/dist/hub/group-policy/resources.js.map +1 -1
  505. package/dist/hub/group-policy/store.js +22 -3
  506. package/dist/hub/group-policy/store.js.map +1 -1
  507. package/dist/hub/group-policy/team-subjects.d.ts +16 -0
  508. package/dist/hub/group-policy/team-subjects.js +32 -0
  509. package/dist/hub/group-policy/team-subjects.js.map +1 -0
  510. package/dist/hub/http/compose.d.ts +17 -0
  511. package/dist/hub/http/compose.js +903 -100
  512. package/dist/hub/http/compose.js.map +1 -1
  513. package/dist/hub/http/core.d.ts +11 -1
  514. package/dist/hub/http/core.js +70 -10
  515. package/dist/hub/http/core.js.map +1 -1
  516. package/dist/hub/http/deps.d.ts +21 -0
  517. package/dist/hub/http/schema.js +54 -1
  518. package/dist/hub/http/schema.js.map +1 -1
  519. package/dist/hub/identity.d.ts +2 -0
  520. package/dist/hub/identity.js +5 -2
  521. package/dist/hub/identity.js.map +1 -1
  522. package/dist/hub/init/text.js +1 -1
  523. package/dist/hub/invitations.js +15 -7
  524. package/dist/hub/invitations.js.map +1 -1
  525. package/dist/hub/join/client.js +75 -42
  526. package/dist/hub/join/client.js.map +1 -1
  527. package/dist/hub/join/service.d.ts +9 -1
  528. package/dist/hub/join/service.js +17 -3
  529. package/dist/hub/join/service.js.map +1 -1
  530. package/dist/hub/lapse-carry.d.ts +45 -0
  531. package/dist/hub/lapse-carry.js +62 -0
  532. package/dist/hub/lapse-carry.js.map +1 -0
  533. package/dist/hub/mcp/auth-schema.d.ts +7 -0
  534. package/dist/hub/mcp/auth-schema.js +31 -0
  535. package/dist/hub/mcp/auth-schema.js.map +1 -0
  536. package/dist/hub/mcp/auth.d.ts +89 -0
  537. package/dist/hub/mcp/auth.js +374 -0
  538. package/dist/hub/mcp/auth.js.map +1 -0
  539. package/dist/hub/mcp/catalog.d.ts +44 -0
  540. package/dist/hub/mcp/catalog.js +31 -0
  541. package/dist/hub/mcp/catalog.js.map +1 -0
  542. package/dist/hub/mcp/door-schema.d.ts +7 -0
  543. package/dist/hub/mcp/door-schema.js +20 -0
  544. package/dist/hub/mcp/door-schema.js.map +1 -0
  545. package/dist/hub/mcp/http.d.ts +25 -0
  546. package/dist/hub/mcp/http.js +259 -0
  547. package/dist/hub/mcp/http.js.map +1 -0
  548. package/dist/hub/mcp/policy.d.ts +65 -0
  549. package/dist/hub/mcp/policy.js +153 -0
  550. package/dist/hub/mcp/policy.js.map +1 -0
  551. package/dist/hub/mcp/server.d.ts +3 -0
  552. package/dist/hub/mcp/server.js +32 -0
  553. package/dist/hub/mcp/server.js.map +1 -0
  554. package/dist/hub/mcp/tools.d.ts +31 -0
  555. package/dist/hub/mcp/tools.js +177 -0
  556. package/dist/hub/mcp/tools.js.map +1 -0
  557. package/dist/hub/member/agent-catalog.d.ts +31 -0
  558. package/dist/hub/member/agent-catalog.js +91 -0
  559. package/dist/hub/member/agent-catalog.js.map +1 -0
  560. package/dist/hub/member/agent-intro.d.ts +29 -0
  561. package/dist/hub/member/agent-intro.js +73 -0
  562. package/dist/hub/member/agent-intro.js.map +1 -0
  563. package/dist/hub/member/agent-pictures.d.ts +76 -0
  564. package/dist/hub/member/agent-pictures.js +196 -0
  565. package/dist/hub/member/agent-pictures.js.map +1 -0
  566. package/dist/hub/member/direct-rooms.d.ts +9 -0
  567. package/dist/hub/member/direct-rooms.js +14 -0
  568. package/dist/hub/member/direct-rooms.js.map +1 -0
  569. package/dist/hub/member/display-name.d.ts +9 -0
  570. package/dist/hub/member/display-name.js +71 -0
  571. package/dist/hub/member/display-name.js.map +1 -0
  572. package/dist/hub/member/exposure-api.d.ts +11 -3
  573. package/dist/hub/member/exposure-api.js +24 -10
  574. package/dist/hub/member/exposure-api.js.map +1 -1
  575. package/dist/hub/member/exposures.d.ts +16 -4
  576. package/dist/hub/member/exposures.js +47 -13
  577. package/dist/hub/member/exposures.js.map +1 -1
  578. package/dist/hub/member/pairing-api.js +3 -2
  579. package/dist/hub/member/pairing-api.js.map +1 -1
  580. package/dist/hub/member/recommendations.d.ts +37 -0
  581. package/dist/hub/member/recommendations.js +129 -0
  582. package/dist/hub/member/recommendations.js.map +1 -0
  583. package/dist/hub/member/room-ask.d.ts +104 -6
  584. package/dist/hub/member/room-ask.js +505 -34
  585. package/dist/hub/member/room-ask.js.map +1 -1
  586. package/dist/hub/member/room-asker-store.d.ts +48 -0
  587. package/dist/hub/member/room-asker-store.js +181 -0
  588. package/dist/hub/member/room-asker-store.js.map +1 -0
  589. package/dist/hub/member/room-context-budget.d.ts +5 -0
  590. package/dist/hub/member/room-context-budget.js +34 -0
  591. package/dist/hub/member/room-context-budget.js.map +1 -0
  592. package/dist/hub/member/room-mention-feedback.d.ts +46 -0
  593. package/dist/hub/member/room-mention-feedback.js +121 -0
  594. package/dist/hub/member/room-mention-feedback.js.map +1 -0
  595. package/dist/hub/member/room-notification.d.ts +9 -0
  596. package/dist/hub/member/room-notification.js +2 -0
  597. package/dist/hub/member/room-notification.js.map +1 -0
  598. package/dist/hub/member/room-post-answers.d.ts +48 -0
  599. package/dist/hub/member/room-post-answers.js +152 -0
  600. package/dist/hub/member/room-post-answers.js.map +1 -0
  601. package/dist/hub/member/room-post-receipt.d.ts +21 -0
  602. package/dist/hub/member/room-post-receipt.js +49 -0
  603. package/dist/hub/member/room-post-receipt.js.map +1 -0
  604. package/dist/hub/member/room-post.d.ts +144 -0
  605. package/dist/hub/member/room-post.js +339 -0
  606. package/dist/hub/member/room-post.js.map +1 -0
  607. package/dist/hub/member/room-reaction-acks.d.ts +12 -0
  608. package/dist/hub/member/room-reaction-acks.js +44 -0
  609. package/dist/hub/member/room-reaction-acks.js.map +1 -0
  610. package/dist/hub/member/sharing-journal.d.ts +252 -0
  611. package/dist/hub/member/sharing-journal.js +212 -0
  612. package/dist/hub/member/sharing-journal.js.map +1 -0
  613. package/dist/hub/member/sharing-link.d.ts +25 -0
  614. package/dist/hub/member/sharing-link.js +68 -0
  615. package/dist/hub/member/sharing-link.js.map +1 -0
  616. package/dist/hub/member/sharing-result.d.ts +6 -0
  617. package/dist/hub/member/sharing-result.js +46 -0
  618. package/dist/hub/member/sharing-result.js.map +1 -0
  619. package/dist/hub/member/sharing.d.ts +39 -0
  620. package/dist/hub/member/sharing.js +188 -0
  621. package/dist/hub/member/sharing.js.map +1 -0
  622. package/dist/hub/member/updates.d.ts +98 -0
  623. package/dist/hub/member/updates.js +322 -0
  624. package/dist/hub/member/updates.js.map +1 -0
  625. package/dist/hub/member-journal.d.ts +6 -0
  626. package/dist/hub/member-journal.js +36 -0
  627. package/dist/hub/member-journal.js.map +1 -1
  628. package/dist/hub/pairing.d.ts +15 -1
  629. package/dist/hub/pairing.js +33 -2
  630. package/dist/hub/pairing.js.map +1 -1
  631. package/dist/hub/personal/owner-host.d.ts +146 -0
  632. package/dist/hub/personal/owner-host.js +289 -0
  633. package/dist/hub/personal/owner-host.js.map +1 -0
  634. package/dist/hub/personal/refusals.d.ts +11 -0
  635. package/dist/hub/personal/refusals.js +33 -0
  636. package/dist/hub/personal/refusals.js.map +1 -0
  637. package/dist/hub/personal/runtime-host.d.ts +26 -0
  638. package/dist/hub/personal/runtime-host.js +51 -0
  639. package/dist/hub/personal/runtime-host.js.map +1 -0
  640. package/dist/hub/personal/schema.d.ts +4 -0
  641. package/dist/hub/personal/schema.js +54 -0
  642. package/dist/hub/personal/schema.js.map +1 -0
  643. package/dist/hub/personal/turns.d.ts +39 -0
  644. package/dist/hub/personal/turns.js +221 -0
  645. package/dist/hub/personal/turns.js.map +1 -0
  646. package/dist/hub/personal/types.d.ts +42 -0
  647. package/dist/hub/personal/types.js +2 -0
  648. package/dist/hub/personal/types.js.map +1 -0
  649. package/dist/hub/policy.d.ts +15 -4
  650. package/dist/hub/policy.js +110 -24
  651. package/dist/hub/policy.js.map +1 -1
  652. package/dist/hub/protocol.d.ts +1481 -49
  653. package/dist/hub/protocol.js +130 -17
  654. package/dist/hub/protocol.js.map +1 -1
  655. package/dist/hub/published-version.d.ts +3 -0
  656. package/dist/hub/published-version.js +35 -0
  657. package/dist/hub/published-version.js.map +1 -0
  658. package/dist/hub/question-close-model.d.ts +17 -0
  659. package/dist/hub/question-close-model.js +7 -0
  660. package/dist/hub/question-close-model.js.map +1 -0
  661. package/dist/hub/quota.d.ts +2 -2
  662. package/dist/hub/quota.js +9 -5
  663. package/dist/hub/quota.js.map +1 -1
  664. package/dist/hub/read-statement.d.ts +6 -0
  665. package/dist/hub/read-statement.js +33 -0
  666. package/dist/hub/read-statement.js.map +1 -0
  667. package/dist/hub/recommendation-model.d.ts +36 -0
  668. package/dist/hub/recommendation-model.js +9 -0
  669. package/dist/hub/recommendation-model.js.map +1 -0
  670. package/dist/hub/recommendations.d.ts +58 -0
  671. package/dist/hub/recommendations.js +212 -0
  672. package/dist/hub/recommendations.js.map +1 -0
  673. package/dist/hub/representative.d.ts +59 -0
  674. package/dist/hub/representative.js +261 -20
  675. package/dist/hub/representative.js.map +1 -1
  676. package/dist/hub/roles/admin-control.d.ts +29 -0
  677. package/dist/hub/roles/admin-control.js +187 -0
  678. package/dist/hub/roles/admin-control.js.map +1 -0
  679. package/dist/hub/roles/admin-types.d.ts +72 -0
  680. package/dist/hub/roles/admin-types.js +2 -0
  681. package/dist/hub/roles/admin-types.js.map +1 -0
  682. package/dist/hub/roles/allowed-list-control.d.ts +34 -0
  683. package/dist/hub/roles/allowed-list-control.js +179 -0
  684. package/dist/hub/roles/allowed-list-control.js.map +1 -0
  685. package/dist/hub/roles/allowed-list.d.ts +8 -0
  686. package/dist/hub/roles/allowed-list.js +49 -0
  687. package/dist/hub/roles/allowed-list.js.map +1 -0
  688. package/dist/hub/roles/audit-details.d.ts +146 -0
  689. package/dist/hub/roles/audit-details.js +26 -0
  690. package/dist/hub/roles/audit-details.js.map +1 -0
  691. package/dist/hub/roles/authority.d.ts +20 -3
  692. package/dist/hub/roles/authority.js +165 -87
  693. package/dist/hub/roles/authority.js.map +1 -1
  694. package/dist/hub/roles/change.d.ts +3 -1
  695. package/dist/hub/roles/change.js +7 -2
  696. package/dist/hub/roles/change.js.map +1 -1
  697. package/dist/hub/roles/clock.d.ts +4 -1
  698. package/dist/hub/roles/clock.js +15 -12
  699. package/dist/hub/roles/clock.js.map +1 -1
  700. package/dist/hub/roles/convert.js +1 -1
  701. package/dist/hub/roles/convert.js.map +1 -1
  702. package/dist/hub/roles/cutover-clock-facts.d.ts +13 -0
  703. package/dist/hub/roles/cutover-clock-facts.js +25 -0
  704. package/dist/hub/roles/cutover-clock-facts.js.map +1 -0
  705. package/dist/hub/roles/cutover-inventory.d.ts +5 -0
  706. package/dist/hub/roles/cutover-inventory.js +27 -4
  707. package/dist/hub/roles/cutover-inventory.js.map +1 -1
  708. package/dist/hub/roles/cutover-marker.d.ts +18 -2
  709. package/dist/hub/roles/cutover-marker.js +6 -2
  710. package/dist/hub/roles/cutover-marker.js.map +1 -1
  711. package/dist/hub/roles/cutover.d.ts +2 -2
  712. package/dist/hub/roles/cutover.js +3 -4
  713. package/dist/hub/roles/cutover.js.map +1 -1
  714. package/dist/hub/roles/delegation.d.ts +4 -1
  715. package/dist/hub/roles/delegation.js +9 -4
  716. package/dist/hub/roles/delegation.js.map +1 -1
  717. package/dist/hub/roles/evaluate.d.ts +2 -1
  718. package/dist/hub/roles/evaluate.js +14 -0
  719. package/dist/hub/roles/evaluate.js.map +1 -1
  720. package/dist/hub/roles/expiry-effects.d.ts +8 -0
  721. package/dist/hub/roles/expiry-effects.js +50 -0
  722. package/dist/hub/roles/expiry-effects.js.map +1 -0
  723. package/dist/hub/roles/migrations.d.ts +7 -0
  724. package/dist/hub/roles/migrations.js +44 -0
  725. package/dist/hub/roles/migrations.js.map +1 -0
  726. package/dist/hub/roles/model.d.ts +30 -2
  727. package/dist/hub/roles/model.js +14 -7
  728. package/dist/hub/roles/model.js.map +1 -1
  729. package/dist/hub/roles/overview.d.ts +8 -0
  730. package/dist/hub/roles/overview.js +15 -0
  731. package/dist/hub/roles/overview.js.map +1 -0
  732. package/dist/hub/roles/read.d.ts +4 -0
  733. package/dist/hub/roles/read.js +37 -7
  734. package/dist/hub/roles/read.js.map +1 -1
  735. package/dist/hub/roles/resource-effects.d.ts +17 -0
  736. package/dist/hub/roles/resource-effects.js +62 -0
  737. package/dist/hub/roles/resource-effects.js.map +1 -0
  738. package/dist/hub/roles/review.d.ts +16 -0
  739. package/dist/hub/roles/review.js +42 -0
  740. package/dist/hub/roles/review.js.map +1 -0
  741. package/dist/hub/roles/writer.d.ts +14 -3
  742. package/dist/hub/roles/writer.js +64 -16
  743. package/dist/hub/roles/writer.js.map +1 -1
  744. package/dist/hub/room-agent-discovery-model.d.ts +29 -0
  745. package/dist/hub/room-agent-discovery-model.js +33 -0
  746. package/dist/hub/room-agent-discovery-model.js.map +1 -0
  747. package/dist/hub/room-agent-discovery.d.ts +14 -0
  748. package/dist/hub/room-agent-discovery.js +65 -0
  749. package/dist/hub/room-agent-discovery.js.map +1 -0
  750. package/dist/hub/room-agent-requests.d.ts +71 -0
  751. package/dist/hub/room-agent-requests.js +377 -0
  752. package/dist/hub/room-agent-requests.js.map +1 -0
  753. package/dist/hub/room-answer-status-model.d.ts +3 -0
  754. package/dist/hub/room-answer-status-model.js +4 -0
  755. package/dist/hub/room-answer-status-model.js.map +1 -0
  756. package/dist/hub/room-asker-identity-model.d.ts +53 -0
  757. package/dist/hub/room-asker-identity-model.js +14 -0
  758. package/dist/hub/room-asker-identity-model.js.map +1 -0
  759. package/dist/hub/room-asker-identity.d.ts +22 -0
  760. package/dist/hub/room-asker-identity.js +43 -0
  761. package/dist/hub/room-asker-identity.js.map +1 -0
  762. package/dist/hub/room-brief-model.d.ts +30 -0
  763. package/dist/hub/room-brief-model.js +38 -0
  764. package/dist/hub/room-brief-model.js.map +1 -0
  765. package/dist/hub/room-context-model.d.ts +45 -0
  766. package/dist/hub/room-context-model.js +12 -0
  767. package/dist/hub/room-context-model.js.map +1 -0
  768. package/dist/hub/room-history-model.d.ts +87 -0
  769. package/dist/hub/room-history-model.js +14 -0
  770. package/dist/hub/room-history-model.js.map +1 -0
  771. package/dist/hub/room-members-model.d.ts +63 -0
  772. package/dist/hub/room-members-model.js +7 -0
  773. package/dist/hub/room-members-model.js.map +1 -0
  774. package/dist/hub/room-mention-feedback-model.d.ts +12 -0
  775. package/dist/hub/room-mention-feedback-model.js +12 -0
  776. package/dist/hub/room-mention-feedback-model.js.map +1 -0
  777. package/dist/hub/room-react-ack-model.d.ts +2 -0
  778. package/dist/hub/room-react-ack-model.js +3 -0
  779. package/dist/hub/room-react-ack-model.js.map +1 -0
  780. package/dist/hub/rooms/admin.d.ts +6 -0
  781. package/dist/hub/rooms/admin.js +33 -0
  782. package/dist/hub/rooms/admin.js.map +1 -1
  783. package/dist/hub/rooms/agents.d.ts +52 -11
  784. package/dist/hub/rooms/agents.js +418 -37
  785. package/dist/hub/rooms/agents.js.map +1 -1
  786. package/dist/hub/rooms/asker-identity.d.ts +21 -0
  787. package/dist/hub/rooms/asker-identity.js +86 -0
  788. package/dist/hub/rooms/asker-identity.js.map +1 -0
  789. package/dist/hub/rooms/assistant.d.ts +1 -6
  790. package/dist/hub/rooms/assistant.js +7 -2
  791. package/dist/hub/rooms/assistant.js.map +1 -1
  792. package/dist/hub/rooms/automation.d.ts +24 -0
  793. package/dist/hub/rooms/automation.js +66 -0
  794. package/dist/hub/rooms/automation.js.map +1 -0
  795. package/dist/hub/rooms/brief.d.ts +18 -0
  796. package/dist/hub/rooms/brief.js +39 -0
  797. package/dist/hub/rooms/brief.js.map +1 -0
  798. package/dist/hub/rooms/buttons.d.ts +85 -0
  799. package/dist/hub/rooms/buttons.js +62 -0
  800. package/dist/hub/rooms/buttons.js.map +1 -0
  801. package/dist/hub/rooms/context-cursor.d.ts +18 -0
  802. package/dist/hub/rooms/context-cursor.js +61 -0
  803. package/dist/hub/rooms/context-cursor.js.map +1 -0
  804. package/dist/hub/rooms/context.d.ts +1 -1
  805. package/dist/hub/rooms/context.js +4 -4
  806. package/dist/hub/rooms/context.js.map +1 -1
  807. package/dist/hub/rooms/direct-view.d.ts +12 -3
  808. package/dist/hub/rooms/direct-view.js +26 -10
  809. package/dist/hub/rooms/direct-view.js.map +1 -1
  810. package/dist/hub/rooms/directory.d.ts +13 -0
  811. package/dist/hub/rooms/directory.js +12 -3
  812. package/dist/hub/rooms/directory.js.map +1 -1
  813. package/dist/hub/rooms/history.d.ts +8 -0
  814. package/dist/hub/rooms/history.js +31 -0
  815. package/dist/hub/rooms/history.js.map +1 -0
  816. package/dist/hub/rooms/members-page.d.ts +33 -0
  817. package/dist/hub/rooms/members-page.js +37 -0
  818. package/dist/hub/rooms/members-page.js.map +1 -0
  819. package/dist/hub/rooms/mentions.d.ts +15 -0
  820. package/dist/hub/rooms/mentions.js +43 -0
  821. package/dist/hub/rooms/mentions.js.map +1 -0
  822. package/dist/hub/rooms/office.d.ts +141 -0
  823. package/dist/hub/rooms/office.js +81 -0
  824. package/dist/hub/rooms/office.js.map +1 -0
  825. package/dist/hub/rooms/post-replies.d.ts +23 -0
  826. package/dist/hub/rooms/post-replies.js +114 -0
  827. package/dist/hub/rooms/post-replies.js.map +1 -0
  828. package/dist/hub/rooms/purpose.d.ts +7 -0
  829. package/dist/hub/rooms/purpose.js +14 -0
  830. package/dist/hub/rooms/purpose.js.map +1 -0
  831. package/dist/hub/rooms/schema.d.ts +16 -0
  832. package/dist/hub/rooms/schema.js +56 -0
  833. package/dist/hub/rooms/schema.js.map +1 -1
  834. package/dist/hub/rooms/service.d.ts +400 -8
  835. package/dist/hub/rooms/service.js +1231 -72
  836. package/dist/hub/rooms/service.js.map +1 -1
  837. package/dist/hub/rooms/types.d.ts +48 -4
  838. package/dist/hub/rooms.d.ts +33 -6
  839. package/dist/hub/rooms.js +236 -51
  840. package/dist/hub/rooms.js.map +1 -1
  841. package/dist/hub/runtime.d.ts +1 -1
  842. package/dist/hub/runtime.js +17 -4
  843. package/dist/hub/runtime.js.map +1 -1
  844. package/dist/hub/send-timing.d.ts +6 -0
  845. package/dist/hub/send-timing.js +39 -0
  846. package/dist/hub/send-timing.js.map +1 -0
  847. package/dist/hub/server.d.ts +8 -1
  848. package/dist/hub/server.js +187 -7
  849. package/dist/hub/server.js.map +1 -1
  850. package/dist/hub/session-directory-transition.d.ts +3 -1
  851. package/dist/hub/session-directory-transition.js +25 -12
  852. package/dist/hub/session-directory-transition.js.map +1 -1
  853. package/dist/hub/session-epoch.js +2 -1
  854. package/dist/hub/session-epoch.js.map +1 -1
  855. package/dist/hub/session-limits.d.ts +58 -0
  856. package/dist/hub/session-limits.js +121 -0
  857. package/dist/hub/session-limits.js.map +1 -0
  858. package/dist/hub/sessions.d.ts +5 -2
  859. package/dist/hub/sessions.js +84 -12
  860. package/dist/hub/sessions.js.map +1 -1
  861. package/dist/hub/settings-commit.d.ts +32 -1
  862. package/dist/hub/settings-commit.js +11 -4
  863. package/dist/hub/settings-commit.js.map +1 -1
  864. package/dist/hub/settings-directory-ca.js +1 -1
  865. package/dist/hub/settings-directory-ca.js.map +1 -1
  866. package/dist/hub/settings-directory-control.js +7 -7
  867. package/dist/hub/settings-directory-control.js.map +1 -1
  868. package/dist/hub/settings-directory-decision.js +15 -8
  869. package/dist/hub/settings-directory-decision.js.map +1 -1
  870. package/dist/hub/settings-directory-http.d.ts +2 -0
  871. package/dist/hub/settings-directory-http.js +21 -6
  872. package/dist/hub/settings-directory-http.js.map +1 -1
  873. package/dist/hub/settings-directory-proof.d.ts +5 -1
  874. package/dist/hub/settings-directory-proof.js +49 -10
  875. package/dist/hub/settings-directory-proof.js.map +1 -1
  876. package/dist/hub/settings-directory-recovery.js +2 -1
  877. package/dist/hub/settings-directory-recovery.js.map +1 -1
  878. package/dist/hub/settings-directory-save.d.ts +2 -0
  879. package/dist/hub/settings-directory-save.js +9 -6
  880. package/dist/hub/settings-directory-save.js.map +1 -1
  881. package/dist/hub/settings-member-address-decision.js +3 -2
  882. package/dist/hub/settings-member-address-decision.js.map +1 -1
  883. package/dist/hub/settings-web-address-decision.js +2 -1
  884. package/dist/hub/settings-web-address-decision.js.map +1 -1
  885. package/dist/hub/sharing-previous-access.d.ts +22 -0
  886. package/dist/hub/sharing-previous-access.js +93 -0
  887. package/dist/hub/sharing-previous-access.js.map +1 -0
  888. package/dist/hub/sharing-requests.d.ts +174 -0
  889. package/dist/hub/sharing-requests.js +326 -0
  890. package/dist/hub/sharing-requests.js.map +1 -0
  891. package/dist/hub/sharing-retention.d.ts +47 -0
  892. package/dist/hub/sharing-retention.js +83 -0
  893. package/dist/hub/sharing-retention.js.map +1 -0
  894. package/dist/hub/sharing-withdrawal.d.ts +14 -0
  895. package/dist/hub/sharing-withdrawal.js +28 -0
  896. package/dist/hub/sharing-withdrawal.js.map +1 -0
  897. package/dist/hub/sharing.js +2 -2
  898. package/dist/hub/sharing.js.map +1 -1
  899. package/dist/hub/socket.d.ts +1 -0
  900. package/dist/hub/socket.js +39 -2
  901. package/dist/hub/socket.js.map +1 -1
  902. package/dist/hub/store.d.ts +5 -0
  903. package/dist/hub/store.js +28 -5
  904. package/dist/hub/store.js.map +1 -1
  905. package/dist/hub/teams/index.d.ts +8 -3
  906. package/dist/hub/teams/index.js +106 -31
  907. package/dist/hub/teams/index.js.map +1 -1
  908. package/dist/hub/teams/store.d.ts +5 -1
  909. package/dist/hub/teams/store.js +25 -2
  910. package/dist/hub/teams/store.js.map +1 -1
  911. package/dist/hub/teams/types.d.ts +19 -2
  912. package/dist/hub/types.d.ts +176 -5
  913. package/dist/hub-agent-incarnation-record.d.ts +24 -0
  914. package/dist/hub-agent-incarnation-record.js +46 -0
  915. package/dist/hub-agent-incarnation-record.js.map +1 -0
  916. package/dist/hub-character-plan.d.ts +47 -0
  917. package/dist/hub-character-plan.js +70 -0
  918. package/dist/hub-character-plan.js.map +1 -0
  919. package/dist/hub-classic-private.d.ts +19 -0
  920. package/dist/hub-classic-private.js +64 -0
  921. package/dist/hub-classic-private.js.map +1 -0
  922. package/dist/hub-contact-windows.d.ts +23 -0
  923. package/dist/hub-contact-windows.js +89 -0
  924. package/dist/hub-contact-windows.js.map +1 -0
  925. package/dist/hub-page-sharing-settings.d.ts +6 -0
  926. package/dist/hub-page-sharing-settings.js +19 -0
  927. package/dist/hub-page-sharing-settings.js.map +1 -0
  928. package/dist/hub-pairing-summary.d.ts +1 -1
  929. package/dist/hub-picture-reduce.d.ts +34 -0
  930. package/dist/hub-picture-reduce.js +101 -0
  931. package/dist/hub-picture-reduce.js.map +1 -0
  932. package/dist/hub-picture-worker.d.ts +1 -0
  933. package/dist/hub-picture-worker.js +19 -0
  934. package/dist/hub-picture-worker.js.map +1 -0
  935. package/dist/hub-report-target.d.ts +6 -0
  936. package/dist/hub-report-target.js +6 -0
  937. package/dist/hub-report-target.js.map +1 -1
  938. package/dist/hub-room-conversation.d.ts +14 -0
  939. package/dist/hub-room-conversation.js +60 -0
  940. package/dist/hub-room-conversation.js.map +1 -0
  941. package/dist/hub-room-reply-warning.d.ts +2 -0
  942. package/dist/hub-room-reply-warning.js +16 -0
  943. package/dist/hub-room-reply-warning.js.map +1 -0
  944. package/dist/hub-sharing-notice.d.ts +43 -0
  945. package/dist/hub-sharing-notice.js +34 -0
  946. package/dist/hub-sharing-notice.js.map +1 -0
  947. package/dist/hub-update-notice.d.ts +12 -0
  948. package/dist/hub-update-notice.js +35 -0
  949. package/dist/hub-update-notice.js.map +1 -0
  950. package/dist/human-delivery-receipts.d.ts +27 -5
  951. package/dist/human-delivery-receipts.js +52 -8
  952. package/dist/human-delivery-receipts.js.map +1 -1
  953. package/dist/install-lock.d.ts +15 -1
  954. package/dist/install-lock.js +16 -8
  955. package/dist/install-lock.js.map +1 -1
  956. package/dist/install-ownership.d.ts +165 -0
  957. package/dist/install-ownership.js +404 -0
  958. package/dist/install-ownership.js.map +1 -0
  959. package/dist/instance-config-impact.js +7 -2
  960. package/dist/instance-config-impact.js.map +1 -1
  961. package/dist/instance-lifecycle.d.ts +32 -4
  962. package/dist/instance-lifecycle.js +111 -25
  963. package/dist/instance-lifecycle.js.map +1 -1
  964. package/dist/instruction-file-sizes.d.ts +46 -0
  965. package/dist/instruction-file-sizes.js +115 -0
  966. package/dist/instruction-file-sizes.js.map +1 -0
  967. package/dist/instructions.d.ts +40 -2
  968. package/dist/instructions.js +68 -34
  969. package/dist/instructions.js.map +1 -1
  970. package/dist/local-pane-endpoint.d.ts +18 -1
  971. package/dist/local-pane-endpoint.js +44 -2
  972. package/dist/local-pane-endpoint.js.map +1 -1
  973. package/dist/locale.d.ts +2 -0
  974. package/dist/locale.js +956 -295
  975. package/dist/locale.js.map +1 -1
  976. package/dist/log-steps.d.ts +5 -0
  977. package/dist/log-steps.js +6 -2
  978. package/dist/log-steps.js.map +1 -1
  979. package/dist/login-controller.d.ts +45 -2
  980. package/dist/login-controller.js +98 -10
  981. package/dist/login-controller.js.map +1 -1
  982. package/dist/login-flows.js +1 -1
  983. package/dist/login-flows.js.map +1 -1
  984. package/dist/ls-rows.d.ts +2 -0
  985. package/dist/ls-rows.js.map +1 -1
  986. package/dist/memory-guidance.d.ts +5 -0
  987. package/dist/memory-guidance.js +14 -0
  988. package/dist/memory-guidance.js.map +1 -0
  989. package/dist/memory-pressure.js +8 -1
  990. package/dist/memory-pressure.js.map +1 -1
  991. package/dist/model-defaults.d.ts +5 -0
  992. package/dist/model-defaults.js +6 -0
  993. package/dist/model-defaults.js.map +1 -0
  994. package/dist/native-agent-admission.d.ts +7 -0
  995. package/dist/native-agent-admission.js +55 -3
  996. package/dist/native-agent-admission.js.map +1 -1
  997. package/dist/native-exec-context.d.ts +11 -0
  998. package/dist/native-exec-context.js +18 -0
  999. package/dist/native-exec-context.js.map +1 -0
  1000. package/dist/native-exec-input.d.ts +56 -0
  1001. package/dist/native-exec-input.js +89 -0
  1002. package/dist/native-exec-input.js.map +1 -0
  1003. package/dist/native-mcp.d.ts +26 -1
  1004. package/dist/native-mcp.js +85 -18
  1005. package/dist/native-mcp.js.map +1 -1
  1006. package/dist/native-model-catalog.d.ts +15 -0
  1007. package/dist/native-model-catalog.js +43 -3
  1008. package/dist/native-model-catalog.js.map +1 -1
  1009. package/dist/native-pane-lifecycle.d.ts +12 -0
  1010. package/dist/native-pane-lifecycle.js +28 -2
  1011. package/dist/native-pane-lifecycle.js.map +1 -1
  1012. package/dist/native-pane-manager.d.ts +37 -6
  1013. package/dist/native-pane-manager.js +160 -8
  1014. package/dist/native-pane-manager.js.map +1 -1
  1015. package/dist/native-pane-tools.js +3 -0
  1016. package/dist/native-pane-tools.js.map +1 -1
  1017. package/dist/needs-you-hub.d.ts +7 -0
  1018. package/dist/needs-you-hub.js +48 -7
  1019. package/dist/needs-you-hub.js.map +1 -1
  1020. package/dist/needs-you.d.ts +66 -2
  1021. package/dist/needs-you.js +26 -1
  1022. package/dist/needs-you.js.map +1 -1
  1023. package/dist/office-share-page.js +5 -5
  1024. package/dist/office-share-page.js.map +1 -1
  1025. package/dist/office-share.js +2 -1
  1026. package/dist/office-share.js.map +1 -1
  1027. package/dist/outbound-handlers.d.ts +49 -4
  1028. package/dist/outbound-handlers.js +263 -20
  1029. package/dist/outbound-handlers.js.map +1 -1
  1030. package/dist/outbound-schemas.d.ts +44 -0
  1031. package/dist/outbound-schemas.js +56 -30
  1032. package/dist/outbound-schemas.js.map +1 -1
  1033. package/dist/package-preimage.js +4 -0
  1034. package/dist/package-preimage.js.map +1 -1
  1035. package/dist/pane-port.d.ts +3 -0
  1036. package/dist/pause-marker.d.ts +1 -1
  1037. package/dist/pause-marker.js +1 -1
  1038. package/dist/pause-marker.js.map +1 -1
  1039. package/dist/plist-args.d.ts +9 -0
  1040. package/dist/plist-args.js +22 -0
  1041. package/dist/plist-args.js.map +1 -0
  1042. package/dist/profile-signins.d.ts +1 -0
  1043. package/dist/profile-signins.js +3 -1
  1044. package/dist/profile-signins.js.map +1 -1
  1045. package/dist/public-preview.d.ts +4 -6
  1046. package/dist/public-preview.js +5 -2
  1047. package/dist/public-preview.js.map +1 -1
  1048. package/dist/public-web-gateway.d.ts +20 -0
  1049. package/dist/public-web-gateway.js +262 -9
  1050. package/dist/public-web-gateway.js.map +1 -1
  1051. package/dist/public-web-link.d.ts +34 -3
  1052. package/dist/public-web-link.js +50 -3
  1053. package/dist/public-web-link.js.map +1 -1
  1054. package/dist/queued-handoffs.d.ts +16 -4
  1055. package/dist/queued-handoffs.js +18 -1
  1056. package/dist/queued-handoffs.js.map +1 -1
  1057. package/dist/quickstart-api.d.ts +0 -1
  1058. package/dist/quickstart-api.js +8 -1
  1059. package/dist/quickstart-api.js.map +1 -1
  1060. package/dist/quickstart.d.ts +1 -1
  1061. package/dist/quickstart.js +2 -3
  1062. package/dist/quickstart.js.map +1 -1
  1063. package/dist/recover.cjs +2639 -0
  1064. package/dist/remote-card-answer.d.ts +1 -1
  1065. package/dist/remote-card-answer.js +8 -1
  1066. package/dist/remote-card-answer.js.map +1 -1
  1067. package/dist/remote-card-prompt.d.ts +7 -2
  1068. package/dist/remote-card-prompt.js +13 -4
  1069. package/dist/remote-card-prompt.js.map +1 -1
  1070. package/dist/reply-buttons-controller.d.ts +3 -1
  1071. package/dist/reply-buttons-controller.js +1 -1
  1072. package/dist/reply-buttons-controller.js.map +1 -1
  1073. package/dist/reply-dedup.js +3 -1
  1074. package/dist/reply-dedup.js.map +1 -1
  1075. package/dist/reply-draft.d.ts +12 -0
  1076. package/dist/reply-draft.js +81 -0
  1077. package/dist/reply-draft.js.map +1 -0
  1078. package/dist/reply-preview-files.d.ts +38 -0
  1079. package/dist/reply-preview-files.js +142 -0
  1080. package/dist/reply-preview-files.js.map +1 -0
  1081. package/dist/reply-preview-spec.d.ts +18 -0
  1082. package/dist/reply-preview-spec.js +27 -0
  1083. package/dist/reply-preview-spec.js.map +1 -0
  1084. package/dist/request-contact-api.d.ts +15 -0
  1085. package/dist/request-contact-api.js +120 -0
  1086. package/dist/request-contact-api.js.map +1 -0
  1087. package/dist/request-contact-card.d.ts +36 -0
  1088. package/dist/request-contact-card.js +206 -0
  1089. package/dist/request-contact-card.js.map +1 -0
  1090. package/dist/request-contact-gate.d.ts +81 -0
  1091. package/dist/request-contact-gate.js +267 -0
  1092. package/dist/request-contact-gate.js.map +1 -0
  1093. package/dist/request-contact-native.d.ts +52 -0
  1094. package/dist/request-contact-native.js +87 -0
  1095. package/dist/request-contact-native.js.map +1 -0
  1096. package/dist/request-contact-types.d.ts +86 -0
  1097. package/dist/request-contact-types.js +7 -0
  1098. package/dist/request-contact-types.js.map +1 -0
  1099. package/dist/request-context-activation.d.ts +29 -0
  1100. package/dist/request-context-activation.js +85 -0
  1101. package/dist/request-context-activation.js.map +1 -0
  1102. package/dist/request-context-admission.d.ts +22 -0
  1103. package/dist/request-context-admission.js +12 -0
  1104. package/dist/request-context-admission.js.map +1 -0
  1105. package/dist/request-context-boot.d.ts +35 -0
  1106. package/dist/request-context-boot.js +97 -0
  1107. package/dist/request-context-boot.js.map +1 -0
  1108. package/dist/request-context-call-protocol.d.ts +12 -0
  1109. package/dist/request-context-call-protocol.js +14 -0
  1110. package/dist/request-context-call-protocol.js.map +1 -0
  1111. package/dist/request-context-call.d.ts +25 -0
  1112. package/dist/request-context-call.js +35 -0
  1113. package/dist/request-context-call.js.map +1 -0
  1114. package/dist/request-context-compatibility.d.ts +20 -0
  1115. package/dist/request-context-compatibility.js +82 -0
  1116. package/dist/request-context-compatibility.js.map +1 -0
  1117. package/dist/request-context-continuation.d.ts +6 -0
  1118. package/dist/request-context-continuation.js +24 -0
  1119. package/dist/request-context-continuation.js.map +1 -0
  1120. package/dist/request-context-control-api.d.ts +119 -0
  1121. package/dist/request-context-control-api.js +179 -0
  1122. package/dist/request-context-control-api.js.map +1 -0
  1123. package/dist/request-context-control-copy.d.ts +3 -0
  1124. package/dist/request-context-control-copy.js +7 -0
  1125. package/dist/request-context-control-copy.js.map +1 -0
  1126. package/dist/request-context-controller.d.ts +44 -0
  1127. package/dist/request-context-controller.js +129 -0
  1128. package/dist/request-context-controller.js.map +1 -0
  1129. package/dist/request-context-delivery-resolver.d.ts +13 -0
  1130. package/dist/request-context-delivery-resolver.js +30 -0
  1131. package/dist/request-context-delivery-resolver.js.map +1 -0
  1132. package/dist/request-context-drain-projection.d.ts +8 -0
  1133. package/dist/request-context-drain-projection.js +40 -0
  1134. package/dist/request-context-drain-projection.js.map +1 -0
  1135. package/dist/request-context-drain.d.ts +61 -0
  1136. package/dist/request-context-drain.js +291 -0
  1137. package/dist/request-context-drain.js.map +1 -0
  1138. package/dist/request-context-enable-offer.d.ts +13 -0
  1139. package/dist/request-context-enable-offer.js +31 -0
  1140. package/dist/request-context-enable-offer.js.map +1 -0
  1141. package/dist/request-context-exec-owner.d.ts +39 -0
  1142. package/dist/request-context-exec-owner.js +128 -0
  1143. package/dist/request-context-exec-owner.js.map +1 -0
  1144. package/dist/request-context-fence.d.ts +28 -0
  1145. package/dist/request-context-fence.js +58 -0
  1146. package/dist/request-context-fence.js.map +1 -0
  1147. package/dist/request-context-go-back-view.d.ts +1 -0
  1148. package/dist/request-context-go-back-view.js +17 -0
  1149. package/dist/request-context-go-back-view.js.map +1 -0
  1150. package/dist/request-context-helper-readiness.d.ts +14 -0
  1151. package/dist/request-context-helper-readiness.js +23 -0
  1152. package/dist/request-context-helper-readiness.js.map +1 -0
  1153. package/dist/request-context-helper.d.ts +20 -0
  1154. package/dist/request-context-helper.js +41 -0
  1155. package/dist/request-context-helper.js.map +1 -0
  1156. package/dist/request-context-hub-resolver.d.ts +29 -0
  1157. package/dist/request-context-hub-resolver.js +90 -0
  1158. package/dist/request-context-hub-resolver.js.map +1 -0
  1159. package/dist/request-context-human-resolver.d.ts +20 -0
  1160. package/dist/request-context-human-resolver.js +77 -0
  1161. package/dist/request-context-human-resolver.js.map +1 -0
  1162. package/dist/request-context-human.d.ts +112 -0
  1163. package/dist/request-context-human.js +176 -0
  1164. package/dist/request-context-human.js.map +1 -0
  1165. package/dist/request-context-inputs.d.ts +21 -0
  1166. package/dist/request-context-inputs.js +63 -0
  1167. package/dist/request-context-inputs.js.map +1 -0
  1168. package/dist/request-context-installation.d.ts +117 -0
  1169. package/dist/request-context-installation.js +328 -0
  1170. package/dist/request-context-installation.js.map +1 -0
  1171. package/dist/request-context-knowledge.d.ts +5 -0
  1172. package/dist/request-context-knowledge.js +32 -0
  1173. package/dist/request-context-knowledge.js.map +1 -0
  1174. package/dist/request-context-migration.d.ts +75 -0
  1175. package/dist/request-context-migration.js +171 -0
  1176. package/dist/request-context-migration.js.map +1 -0
  1177. package/dist/request-context-native-human.d.ts +20 -0
  1178. package/dist/request-context-native-human.js +91 -0
  1179. package/dist/request-context-native-human.js.map +1 -0
  1180. package/dist/request-context-native-output.d.ts +15 -0
  1181. package/dist/request-context-native-output.js +46 -0
  1182. package/dist/request-context-native-output.js.map +1 -0
  1183. package/dist/request-context-native-result.d.ts +15 -0
  1184. package/dist/request-context-native-result.js +46 -0
  1185. package/dist/request-context-native-result.js.map +1 -0
  1186. package/dist/request-context-off.d.ts +22 -0
  1187. package/dist/request-context-off.js +77 -0
  1188. package/dist/request-context-off.js.map +1 -0
  1189. package/dist/request-context-outside-label.d.ts +5 -0
  1190. package/dist/request-context-outside-label.js +28 -0
  1191. package/dist/request-context-outside-label.js.map +1 -0
  1192. package/dist/request-context-pane.d.ts +33 -0
  1193. package/dist/request-context-pane.js +67 -0
  1194. package/dist/request-context-pane.js.map +1 -0
  1195. package/dist/request-context-pending-work.d.ts +11 -0
  1196. package/dist/request-context-pending-work.js +43 -0
  1197. package/dist/request-context-pending-work.js.map +1 -0
  1198. package/dist/request-context-policy.d.ts +90 -0
  1199. package/dist/request-context-policy.js +194 -0
  1200. package/dist/request-context-policy.js.map +1 -0
  1201. package/dist/request-context-protocol.d.ts +137 -0
  1202. package/dist/request-context-protocol.js +38 -0
  1203. package/dist/request-context-protocol.js.map +1 -0
  1204. package/dist/request-context-readiness.d.ts +49 -0
  1205. package/dist/request-context-readiness.js +64 -0
  1206. package/dist/request-context-readiness.js.map +1 -0
  1207. package/dist/request-context-recovery.d.ts +18 -0
  1208. package/dist/request-context-recovery.js +81 -0
  1209. package/dist/request-context-recovery.js.map +1 -0
  1210. package/dist/request-context-relay.d.ts +19 -0
  1211. package/dist/request-context-relay.js +63 -0
  1212. package/dist/request-context-relay.js.map +1 -0
  1213. package/dist/request-context-reply-pending.d.ts +16 -0
  1214. package/dist/request-context-reply-pending.js +77 -0
  1215. package/dist/request-context-reply-pending.js.map +1 -0
  1216. package/dist/request-context-resolution.d.ts +35 -0
  1217. package/dist/request-context-resolution.js +86 -0
  1218. package/dist/request-context-resolution.js.map +1 -0
  1219. package/dist/request-context-retirement.d.ts +21 -0
  1220. package/dist/request-context-retirement.js +16 -0
  1221. package/dist/request-context-retirement.js.map +1 -0
  1222. package/dist/request-context-returns.d.ts +67 -0
  1223. package/dist/request-context-returns.js +211 -0
  1224. package/dist/request-context-returns.js.map +1 -0
  1225. package/dist/request-context-start.d.ts +15 -0
  1226. package/dist/request-context-start.js +2 -0
  1227. package/dist/request-context-start.js.map +1 -0
  1228. package/dist/request-context-store.d.ts +26 -0
  1229. package/dist/request-context-store.js +144 -0
  1230. package/dist/request-context-store.js.map +1 -0
  1231. package/dist/request-context-turns.d.ts +99 -0
  1232. package/dist/request-context-turns.js +216 -0
  1233. package/dist/request-context-turns.js.map +1 -0
  1234. package/dist/request-context-unproved-label.d.ts +4 -0
  1235. package/dist/request-context-unproved-label.js +25 -0
  1236. package/dist/request-context-unproved-label.js.map +1 -0
  1237. package/dist/request-context-update-guard.d.ts +15 -0
  1238. package/dist/request-context-update-guard.js +54 -0
  1239. package/dist/request-context-update-guard.js.map +1 -0
  1240. package/dist/request-context-view.d.ts +33 -0
  1241. package/dist/request-context-view.js +36 -0
  1242. package/dist/request-context-view.js.map +1 -0
  1243. package/dist/request-context-work.d.ts +50 -0
  1244. package/dist/request-context-work.js +178 -0
  1245. package/dist/request-context-work.js.map +1 -0
  1246. package/dist/request-hub-context.d.ts +131 -0
  1247. package/dist/request-hub-context.js +89 -0
  1248. package/dist/request-hub-context.js.map +1 -0
  1249. package/dist/request-hub-output.d.ts +13 -0
  1250. package/dist/request-hub-output.js +33 -0
  1251. package/dist/request-hub-output.js.map +1 -0
  1252. package/dist/restart-progress.d.ts +6 -0
  1253. package/dist/restart-progress.js +5 -0
  1254. package/dist/restart-progress.js.map +1 -1
  1255. package/dist/retained-human-control.d.ts +11 -0
  1256. package/dist/retained-human-control.js +11 -0
  1257. package/dist/retained-human-control.js.map +1 -0
  1258. package/dist/runtime-api.js +10 -2
  1259. package/dist/runtime-api.js.map +1 -1
  1260. package/dist/runtime-build-info.js +2 -1
  1261. package/dist/runtime-build-info.js.map +1 -1
  1262. package/dist/runtime-cli-install.js +20 -14
  1263. package/dist/runtime-cli-install.js.map +1 -1
  1264. package/dist/runtime-cli.js +31 -5
  1265. package/dist/runtime-cli.js.map +1 -1
  1266. package/dist/runtime-client-store.d.ts +5 -0
  1267. package/dist/runtime-client-store.js +35 -1
  1268. package/dist/runtime-client-store.js.map +1 -1
  1269. package/dist/runtime-client.d.ts +6 -0
  1270. package/dist/runtime-client.js +63 -15
  1271. package/dist/runtime-client.js.map +1 -1
  1272. package/dist/runtime-coordinator.d.ts +31 -3
  1273. package/dist/runtime-coordinator.js +145 -12
  1274. package/dist/runtime-coordinator.js.map +1 -1
  1275. package/dist/runtime-install.d.ts +6 -1
  1276. package/dist/runtime-install.js +12 -4
  1277. package/dist/runtime-install.js.map +1 -1
  1278. package/dist/runtime-pane-assets.d.ts +1 -1
  1279. package/dist/runtime-pane-assets.js +1 -1
  1280. package/dist/runtime-pane-assets.js.map +1 -1
  1281. package/dist/runtime-pane-host.d.ts +3 -0
  1282. package/dist/runtime-pane-host.js +39 -21
  1283. package/dist/runtime-pane-host.js.map +1 -1
  1284. package/dist/runtime-pane-link.d.ts +6 -2
  1285. package/dist/runtime-pane-link.js +17 -4
  1286. package/dist/runtime-pane-link.js.map +1 -1
  1287. package/dist/runtime-pane-mcp-relay.d.ts +11 -1
  1288. package/dist/runtime-pane-mcp-relay.js +69 -3
  1289. package/dist/runtime-pane-mcp-relay.js.map +1 -1
  1290. package/dist/runtime-pane-mcp.d.ts +37 -1
  1291. package/dist/runtime-pane-mcp.js +120 -19
  1292. package/dist/runtime-pane-mcp.js.map +1 -1
  1293. package/dist/runtime-pane-native.js +5 -2
  1294. package/dist/runtime-pane-native.js.map +1 -1
  1295. package/dist/runtime-pane-port.d.ts +6 -0
  1296. package/dist/runtime-pane-port.js +23 -4
  1297. package/dist/runtime-pane-port.js.map +1 -1
  1298. package/dist/runtime-pane-protocol.d.ts +4 -0
  1299. package/dist/runtime-pane-protocol.js +11 -4
  1300. package/dist/runtime-pane-protocol.js.map +1 -1
  1301. package/dist/runtime-pane-service.d.ts +1 -0
  1302. package/dist/runtime-pane-service.js +25 -9
  1303. package/dist/runtime-pane-service.js.map +1 -1
  1304. package/dist/runtime-pane-stdio-protocol.d.ts +4 -0
  1305. package/dist/runtime-pane-stdio-protocol.js +12 -5
  1306. package/dist/runtime-pane-stdio-protocol.js.map +1 -1
  1307. package/dist/runtime-pane-stdio.js +5 -5
  1308. package/dist/runtime-pane-stdio.js.map +1 -1
  1309. package/dist/runtime-personal-answer-only-probe.d.ts +3 -0
  1310. package/dist/runtime-personal-answer-only-probe.js +134 -0
  1311. package/dist/runtime-personal-answer-only-probe.js.map +1 -0
  1312. package/dist/runtime-personal-answer-only.d.ts +16 -0
  1313. package/dist/runtime-personal-answer-only.js +54 -0
  1314. package/dist/runtime-personal-answer-only.js.map +1 -0
  1315. package/dist/runtime-personal-answer.d.ts +30 -0
  1316. package/dist/runtime-personal-answer.js +124 -0
  1317. package/dist/runtime-personal-answer.js.map +1 -0
  1318. package/dist/runtime-personal-preflight.d.ts +8 -0
  1319. package/dist/runtime-personal-preflight.js +103 -0
  1320. package/dist/runtime-personal-preflight.js.map +1 -0
  1321. package/dist/runtime-personal-profile.d.ts +40 -0
  1322. package/dist/runtime-personal-profile.js +81 -0
  1323. package/dist/runtime-personal-profile.js.map +1 -0
  1324. package/dist/runtime-personal-protocol.d.ts +10 -0
  1325. package/dist/runtime-personal-protocol.js +15 -0
  1326. package/dist/runtime-personal-protocol.js.map +1 -0
  1327. package/dist/runtime-personal-stage.d.ts +37 -0
  1328. package/dist/runtime-personal-stage.js +167 -0
  1329. package/dist/runtime-personal-stage.js.map +1 -0
  1330. package/dist/runtime-protocol.d.ts +7 -0
  1331. package/dist/runtime-protocol.js.map +1 -1
  1332. package/dist/runtime-update-controller.js +1 -1
  1333. package/dist/runtime-update-controller.js.map +1 -1
  1334. package/dist/runtime-windows-bridge.d.ts +8 -0
  1335. package/dist/runtime-windows-bridge.js +50 -3
  1336. package/dist/runtime-windows-bridge.js.map +1 -1
  1337. package/dist/scheduler/db.js +37 -0
  1338. package/dist/scheduler/db.js.map +1 -1
  1339. package/dist/scheduler/scheduler.d.ts +15 -0
  1340. package/dist/scheduler/scheduler.js +45 -1
  1341. package/dist/scheduler/scheduler.js.map +1 -1
  1342. package/dist/scheduler/scheduler.test.js +17 -0
  1343. package/dist/scheduler/scheduler.test.js.map +1 -1
  1344. package/dist/scheduler/task-board-mentions.d.ts +32 -0
  1345. package/dist/scheduler/task-board-mentions.js +97 -0
  1346. package/dist/scheduler/task-board-mentions.js.map +1 -0
  1347. package/dist/scheduler/task-board-text.d.ts +5 -6
  1348. package/dist/scheduler/task-board-text.js +30 -10
  1349. package/dist/scheduler/task-board-text.js.map +1 -1
  1350. package/dist/scheduler/task-board-unread.d.ts +90 -0
  1351. package/dist/scheduler/task-board-unread.js +192 -0
  1352. package/dist/scheduler/task-board-unread.js.map +1 -0
  1353. package/dist/scheduler/task-board.d.ts +628 -10
  1354. package/dist/scheduler/task-board.js +1496 -48
  1355. package/dist/scheduler/task-board.js.map +1 -1
  1356. package/dist/scheduler/task-files.d.ts +80 -0
  1357. package/dist/scheduler/task-files.js +357 -0
  1358. package/dist/scheduler/task-files.js.map +1 -0
  1359. package/dist/scheduler/types.d.ts +1 -1
  1360. package/dist/service-activation.js +3 -13
  1361. package/dist/service-activation.js.map +1 -1
  1362. package/dist/service-install-handover.d.ts +52 -0
  1363. package/dist/service-install-handover.js +50 -0
  1364. package/dist/service-install-handover.js.map +1 -0
  1365. package/dist/service-installer.d.ts +12 -0
  1366. package/dist/service-installer.js +24 -10
  1367. package/dist/service-installer.js.map +1 -1
  1368. package/dist/service-lock.d.ts +28 -0
  1369. package/dist/service-lock.js +85 -0
  1370. package/dist/service-lock.js.map +1 -0
  1371. package/dist/settings-api.d.ts +46 -1
  1372. package/dist/settings-api.js +642 -97
  1373. package/dist/settings-api.js.map +1 -1
  1374. package/dist/settings-baseline.d.ts +6 -0
  1375. package/dist/settings-baseline.js +11 -8
  1376. package/dist/settings-baseline.js.map +1 -1
  1377. package/dist/settings-change.js +60 -7
  1378. package/dist/settings-change.js.map +1 -1
  1379. package/dist/settings-confirmation.d.ts +2 -0
  1380. package/dist/settings-confirmation.js +6 -0
  1381. package/dist/settings-confirmation.js.map +1 -1
  1382. package/dist/settings-effect.d.ts +11 -0
  1383. package/dist/settings-effect.js +154 -7
  1384. package/dist/settings-effect.js.map +1 -1
  1385. package/dist/settings-http-confirmation.d.ts +3 -0
  1386. package/dist/settings-http-confirmation.js +46 -43
  1387. package/dist/settings-http-confirmation.js.map +1 -1
  1388. package/dist/settings-instance-patch.js +3 -1
  1389. package/dist/settings-instance-patch.js.map +1 -1
  1390. package/dist/settings-route-lifetime.d.ts +3 -1
  1391. package/dist/settings-route-lifetime.js +15 -5
  1392. package/dist/settings-route-lifetime.js.map +1 -1
  1393. package/dist/settings-transaction.d.ts +3 -2
  1394. package/dist/settings-transaction.js.map +1 -1
  1395. package/dist/setup-form.js +10 -0
  1396. package/dist/setup-form.js.map +1 -1
  1397. package/dist/setup-host.d.ts +2 -3
  1398. package/dist/setup-host.js +3 -5
  1399. package/dist/setup-host.js.map +1 -1
  1400. package/dist/setup-i18n.js +2 -2
  1401. package/dist/setup-i18n.js.map +1 -1
  1402. package/dist/setup-wizard.js +0 -2
  1403. package/dist/setup-wizard.js.map +1 -1
  1404. package/dist/shared-default-adoption.d.ts +24 -0
  1405. package/dist/shared-default-adoption.js +73 -0
  1406. package/dist/shared-default-adoption.js.map +1 -0
  1407. package/dist/state-lease.d.ts +24 -0
  1408. package/dist/state-lease.js +103 -0
  1409. package/dist/state-lease.js.map +1 -0
  1410. package/dist/subagent-records.d.ts +2 -0
  1411. package/dist/subagent-records.js +64 -12
  1412. package/dist/subagent-records.js.map +1 -1
  1413. package/dist/subagent-service.d.ts +3 -0
  1414. package/dist/subagent-service.js +27 -5
  1415. package/dist/subagent-service.js.map +1 -1
  1416. package/dist/task-attach-client.d.ts +43 -0
  1417. package/dist/task-attach-client.js +125 -0
  1418. package/dist/task-attach-client.js.map +1 -0
  1419. package/dist/task-board-tool.d.ts +60 -0
  1420. package/dist/task-board-tool.js +216 -11
  1421. package/dist/task-board-tool.js.map +1 -1
  1422. package/dist/task-board-waker.d.ts +75 -31
  1423. package/dist/task-board-waker.js +311 -101
  1424. package/dist/task-board-waker.js.map +1 -1
  1425. package/dist/task-file-limits.d.ts +15 -0
  1426. package/dist/task-file-limits.js +21 -0
  1427. package/dist/task-file-limits.js.map +1 -0
  1428. package/dist/tips.js +4 -4
  1429. package/dist/tips.js.map +1 -1
  1430. package/dist/tmux-binary.js +1 -1
  1431. package/dist/tmux-binary.js.map +1 -1
  1432. package/dist/tmux-manager.d.ts +2 -0
  1433. package/dist/tmux-manager.js +2 -0
  1434. package/dist/tmux-manager.js.map +1 -1
  1435. package/dist/tool-permissions.d.ts +32 -0
  1436. package/dist/tool-permissions.js +68 -2
  1437. package/dist/tool-permissions.js.map +1 -1
  1438. package/dist/tool-progress.d.ts +9 -0
  1439. package/dist/tool-progress.js +141 -32
  1440. package/dist/tool-progress.js.map +1 -1
  1441. package/dist/tool-receipt-output.d.ts +8 -6
  1442. package/dist/topic-commands.d.ts +7 -1
  1443. package/dist/topic-commands.js +124 -92
  1444. package/dist/topic-commands.js.map +1 -1
  1445. package/dist/transcript-monitor.d.ts +7 -1
  1446. package/dist/transcript-monitor.js +79 -3
  1447. package/dist/transcript-monitor.js.map +1 -1
  1448. package/dist/transcript-turns.d.ts +3 -0
  1449. package/dist/transcript-turns.js +5 -0
  1450. package/dist/transcript-turns.js.map +1 -1
  1451. package/dist/tunnel/lease.d.ts +14 -0
  1452. package/dist/tunnel/lease.js +23 -0
  1453. package/dist/tunnel/lease.js.map +1 -1
  1454. package/dist/tunnel/named-link-test.d.ts +27 -0
  1455. package/dist/tunnel/named-link-test.js +41 -0
  1456. package/dist/tunnel/named-link-test.js.map +1 -1
  1457. package/dist/turn-reply-guard.d.ts +18 -3
  1458. package/dist/turn-reply-guard.js +23 -5
  1459. package/dist/turn-reply-guard.js.map +1 -1
  1460. package/dist/types.d.ts +50 -2
  1461. package/dist/ui/accounts-keepalive.js +4 -2
  1462. package/dist/ui/accounts-view.js +18 -9
  1463. package/dist/ui/agent-details-settings.js +11 -7
  1464. package/dist/ui/agent-export-dialog.js +4 -3
  1465. package/dist/ui/agent-export-strings.js +5 -5
  1466. package/dist/ui/agent-page-strings.js +23 -5
  1467. package/dist/ui/agent-who-can-use-strings.js +125 -0
  1468. package/dist/ui/agent-who-can-use.js +238 -0
  1469. package/dist/ui/app.html +2 -2
  1470. package/dist/ui/backend-signin.js +94 -23
  1471. package/dist/ui/chat-activity-groups.js +42 -9
  1472. package/dist/ui/chat-activity.js +24 -4
  1473. package/dist/ui/chat-commands.js +2 -0
  1474. package/dist/ui/chat-mentions.js +13 -0
  1475. package/dist/ui/chat-msg-actions.js +3 -222
  1476. package/dist/ui/chat-pins.js +107 -0
  1477. package/dist/ui/chat-popout-header.js +2 -2
  1478. package/dist/ui/chat-popout-transport.js +49 -19
  1479. package/dist/ui/chat-popout.js +15 -1
  1480. package/dist/ui/chat-quote.js +3 -261
  1481. package/dist/ui/chat-store.js +182 -19
  1482. package/dist/ui/chat-task-ref-strings.js +24 -0
  1483. package/dist/ui/chat-task-refs.js +131 -0
  1484. package/dist/ui/chat-tour.js +1 -1
  1485. package/dist/ui/chat-workspace.js +3 -3
  1486. package/dist/ui/claude-credentials.js +124 -0
  1487. package/dist/ui/claude-setup-token.js +36 -0
  1488. package/dist/ui/contact-auth-client.js +55 -0
  1489. package/dist/ui/contact-auth-strings.js +272 -0
  1490. package/dist/ui/contact-authorizations.js +159 -0
  1491. package/dist/ui/contact-grant-editor.js +110 -0
  1492. package/dist/ui/contact-needs.js +124 -0
  1493. package/dist/ui/contact-permissions.js +278 -0
  1494. package/dist/ui/contact-ticket-badge.js +54 -0
  1495. package/dist/ui/contact-tool-groups.js +39 -0
  1496. package/dist/ui/contact-verify-need.js +46 -0
  1497. package/dist/ui/fleet-cache.js +7 -6
  1498. package/dist/ui/fleet-canvas.js +21 -8
  1499. package/dist/ui/fleet-office-card.js +505 -45
  1500. package/dist/ui/fleet-office-carousel.d.ts +14 -0
  1501. package/dist/ui/fleet-office-carousel.js +95 -0
  1502. package/dist/ui/fleet-office-dialogue.d.ts +6 -3
  1503. package/dist/ui/fleet-office-dialogue.js +16 -6
  1504. package/dist/ui/fleet-office-editor.js +11 -6
  1505. package/dist/ui/fleet-office-layout.js +15 -15
  1506. package/dist/ui/fleet-office-model.js +5 -3
  1507. package/dist/ui/fleet-office-overview.js +1 -1
  1508. package/dist/ui/fleet-office-pack.d.ts +92 -5
  1509. package/dist/ui/fleet-office-pack.js +596 -50
  1510. package/dist/ui/fleet-office-play.js +498 -0
  1511. package/dist/ui/fleet-office-skin.js +360 -52
  1512. package/dist/ui/fleet-office-store.js +121 -5
  1513. package/dist/ui/fleet-office-talk.js +423 -0
  1514. package/dist/ui/fleet-office-vehicles.js +147 -0
  1515. package/dist/ui/fleet-office-view.js +58 -17
  1516. package/dist/ui/fleet-office-zones.js +174 -39
  1517. package/dist/ui/fleet-office.js +1462 -188
  1518. package/dist/ui/fleet-org.js +9 -4
  1519. package/dist/ui/fleet-route.js +44 -6
  1520. package/dist/ui/fleet-tab-icons.js +19 -0
  1521. package/dist/ui/fleet-task-activity.js +430 -0
  1522. package/dist/ui/fleet-task-archive.js +111 -0
  1523. package/dist/ui/fleet-task-card.js +386 -317
  1524. package/dist/ui/fleet-task-common.js +117 -13
  1525. package/dist/ui/fleet-task-create.js +67 -0
  1526. package/dist/ui/fleet-task-edit.js +211 -0
  1527. package/dist/ui/fleet-task-files.js +196 -0
  1528. package/dist/ui/fleet-task-flow.js +353 -0
  1529. package/dist/ui/fleet-task-follow.js +123 -0
  1530. package/dist/ui/fleet-task-md.js +98 -0
  1531. package/dist/ui/fleet-task-menu.js +2 -2
  1532. package/dist/ui/fleet-task-owner.js +252 -0
  1533. package/dist/ui/fleet-task-run.js +333 -0
  1534. package/dist/ui/fleet-task-sort.js +88 -0
  1535. package/dist/ui/fleet-task-stats.js +2 -2
  1536. package/dist/ui/fleet-task-thread.js +245 -0
  1537. package/dist/ui/fleet-task-unread.js +100 -0
  1538. package/dist/ui/fleet-task-view.js +221 -46
  1539. package/dist/ui/fleet-task-wake.js +140 -0
  1540. package/dist/ui/fleet-task-work.js +2 -2
  1541. package/dist/ui/fleet-tasks.js +336 -145
  1542. package/dist/ui/fleet-usage.js +8 -7
  1543. package/dist/ui/host-alerts.js +23 -0
  1544. package/dist/ui/host-footprint.js +17 -0
  1545. package/dist/ui/host-health-model.js +42 -0
  1546. package/dist/ui/host-health.js +82 -0
  1547. package/dist/ui/host-install.js +87 -7
  1548. package/dist/ui/host-monitoring-darwin.js +6 -0
  1549. package/dist/ui/host-monitoring-help.js +7 -0
  1550. package/dist/ui/host-monitoring-linux.js +6 -0
  1551. package/dist/ui/host-monitoring-wsl.js +6 -0
  1552. package/dist/ui/host-time.js +5 -0
  1553. package/dist/ui/hub-admin-overview.js +190 -0
  1554. package/dist/ui/hub-admin-rooms-strings.js +6 -2
  1555. package/dist/ui/hub-admin-rooms.js +4 -2
  1556. package/dist/ui/hub-agent-copy.js +8 -2
  1557. package/dist/ui/hub-agent-intro.js +36 -0
  1558. package/dist/ui/hub-ai-apps-strings.js +6 -0
  1559. package/dist/ui/hub-ai-apps.js +84 -0
  1560. package/dist/ui/hub-assistant-admin.js +2 -1
  1561. package/dist/ui/hub-attachments.js +81 -3
  1562. package/dist/ui/hub-chat-store.js +4 -3
  1563. package/dist/ui/hub-chat-strings.js +14 -4
  1564. package/dist/ui/hub-client.js +126 -12
  1565. package/dist/ui/hub-directory-editor-strings.js +2 -2
  1566. package/dist/ui/hub-directory-editor.js +1 -0
  1567. package/dist/ui/hub-directory-notices.js +2 -1
  1568. package/dist/ui/hub-enrolment-code.js +2 -1
  1569. package/dist/ui/hub-fleet-versions.js +393 -0
  1570. package/dist/ui/hub-grant-picker.js +28 -47
  1571. package/dist/ui/hub-group-policy.js +26 -13
  1572. package/dist/ui/hub-group-search.js +2 -2
  1573. package/dist/ui/hub-group-strings.js +28 -18
  1574. package/dist/ui/hub-intro-notice.js +16 -0
  1575. package/dist/ui/hub-invitations.js +5 -1
  1576. package/dist/ui/hub-join-steps.js +27 -15
  1577. package/dist/ui/hub-my-agents-model.js +42 -0
  1578. package/dist/ui/hub-my-agents-strings.js +20 -0
  1579. package/dist/ui/hub-my-agents.js +170 -0
  1580. package/dist/ui/hub-notify-keep.js +49 -0
  1581. package/dist/ui/hub-owner-strings.js +9 -8
  1582. package/dist/ui/hub-personal-agent-strings.js +246 -0
  1583. package/dist/ui/hub-personal-agent.js +119 -0
  1584. package/dist/ui/hub-policy-subjects.js +35 -0
  1585. package/dist/ui/hub-quick-pairing.js +9 -3
  1586. package/dist/ui/hub-quota.js +2 -1
  1587. package/dist/ui/hub-role-audit.js +40 -0
  1588. package/dist/ui/hub-role-forms.js +100 -0
  1589. package/dist/ui/hub-role-notices.js +11 -0
  1590. package/dist/ui/hub-role-view.js +87 -0
  1591. package/dist/ui/hub-roles-strings.js +444 -0
  1592. package/dist/ui/hub-roles.js +84 -0
  1593. package/dist/ui/hub-room-agent-strings.js +29 -0
  1594. package/dist/ui/hub-room-composer.js +174 -17
  1595. package/dist/ui/hub-room-list.js +8 -5
  1596. package/dist/ui/hub-room-members-strings.js +11 -4
  1597. package/dist/ui/hub-room-members.js +134 -18
  1598. package/dist/ui/hub-room-new-strings.js +2 -1
  1599. package/dist/ui/hub-room-new.js +17 -7
  1600. package/dist/ui/hub-room-notify.js +162 -0
  1601. package/dist/ui/hub-room-office.js +271 -0
  1602. package/dist/ui/hub-room-owner-requests-strings.js +114 -0
  1603. package/dist/ui/hub-room-owner-requests.js +265 -0
  1604. package/dist/ui/hub-room-pins.js +44 -0
  1605. package/dist/ui/hub-room-presence.js +19 -2
  1606. package/dist/ui/hub-room-purpose.js +35 -0
  1607. package/dist/ui/hub-room-search.js +126 -0
  1608. package/dist/ui/hub-room-settings-strings.js +8 -0
  1609. package/dist/ui/hub-room-settings.js +110 -3
  1610. package/dist/ui/hub-room-source-strings.js +17 -0
  1611. package/dist/ui/hub-room-source.js +37 -0
  1612. package/dist/ui/hub-room-strings.js +102 -7
  1613. package/dist/ui/hub-room-thread.js +522 -69
  1614. package/dist/ui/hub-room-unread.js +2 -1
  1615. package/dist/ui/hub-room-working.js +37 -0
  1616. package/dist/ui/hub-session-limits.js +79 -0
  1617. package/dist/ui/hub-strings.js +23 -10
  1618. package/dist/ui/hub-subject-picker.js +58 -0
  1619. package/dist/ui/hub-switcher.js +2 -2
  1620. package/dist/ui/hub-teams-strings.js +10 -6
  1621. package/dist/ui/hub-teams.js +58 -29
  1622. package/dist/ui/hub-this-hub.js +2 -2
  1623. package/dist/ui/hub-welcome.js +122 -75
  1624. package/dist/ui/icons/hub-apple-touch-icon.png +0 -0
  1625. package/dist/ui/icons/hub-favicon.ico +0 -0
  1626. package/dist/ui/icons/hub-favicon.svg +10 -0
  1627. package/dist/ui/icons/hub-icon-192.png +0 -0
  1628. package/dist/ui/icons/hub-icon-512.png +0 -0
  1629. package/dist/ui/icons/hub-icon-maskable-192.png +0 -0
  1630. package/dist/ui/icons/hub-icon-maskable-512.png +0 -0
  1631. package/dist/ui/icons/hub-maskable.svg +12 -0
  1632. package/dist/ui/image-annotate.js +2 -283
  1633. package/dist/ui/image-lightbox.js +2 -176
  1634. package/dist/ui/image-zoom.js +2 -242
  1635. package/dist/ui/log-row.js +11 -8
  1636. package/dist/ui/model-picker.js +7 -3
  1637. package/dist/ui/native-instance-settings.js +4 -2
  1638. package/dist/ui/notice-hub-sharing.js +81 -0
  1639. package/dist/ui/notice-hub-update.js +94 -0
  1640. package/dist/ui/office-share-dialog.js +4 -3
  1641. package/dist/ui/office-share-page.js +7 -2
  1642. package/dist/ui/page-share-dialog.js +3 -2
  1643. package/dist/ui/panel-chat.js +515 -81
  1644. package/dist/ui/panel-details.js +27 -3
  1645. package/dist/ui/panel-fleet.js +61 -21
  1646. package/dist/ui/panel-hub.js +478 -135
  1647. package/dist/ui/panel-log.js +7 -7
  1648. package/dist/ui/panel-needs.js +139 -28
  1649. package/dist/ui/panel-notices.js +6 -2
  1650. package/dist/ui/panel-runtimes.js +6 -4
  1651. package/dist/ui/panel-settings.js +150 -61
  1652. package/dist/ui/panel-windows-cli.js +4 -3
  1653. package/dist/ui/preview-panel.js +3 -1
  1654. package/dist/ui/preview-popout.js +134 -0
  1655. package/dist/ui/reply-file-preview.js +65 -0
  1656. package/dist/ui/request-contact-card.js +287 -0
  1657. package/dist/ui/request-contact-client.js +83 -0
  1658. package/dist/ui/request-contact-page.js +78 -0
  1659. package/dist/ui/request-context-control.js +209 -0
  1660. package/dist/ui/runtime-cli-install.js +3 -2
  1661. package/dist/ui/runtime-commands.d.ts +2 -2
  1662. package/dist/ui/runtime-commands.js +7 -4
  1663. package/dist/ui/runtime-update-status.js +1 -1
  1664. package/dist/ui/search-dialog.js +8 -1
  1665. package/dist/ui/settings-access-overview.js +5 -4
  1666. package/dist/ui/settings-access-strings.js +1 -1
  1667. package/dist/ui/settings-appearance.js +15 -12
  1668. package/dist/ui/settings-apply.js +8 -3
  1669. package/dist/ui/settings-archive-files.js +109 -0
  1670. package/dist/ui/settings-build-version.js +2 -2
  1671. package/dist/ui/settings-capabilities.js +2 -0
  1672. package/dist/ui/settings-catalog.js +22 -0
  1673. package/dist/ui/settings-connector-strings.js +23 -0
  1674. package/dist/ui/settings-connector.js +40 -0
  1675. package/dist/ui/settings-default-model-scope.js +40 -0
  1676. package/dist/ui/settings-default-model-strings.js +43 -0
  1677. package/dist/ui/settings-dialogs.js +9 -5
  1678. package/dist/ui/settings-guests-entries.js +16 -0
  1679. package/dist/ui/settings-guests.js +61 -18
  1680. package/dist/ui/settings-host-alerts.js +23 -0
  1681. package/dist/ui/settings-host-monitoring.js +71 -0
  1682. package/dist/ui/settings-hub-connection.js +6 -7
  1683. package/dist/ui/settings-hub-member-address.js +2 -1
  1684. package/dist/ui/settings-hub-membership.js +6 -7
  1685. package/dist/ui/settings-hub-page-sharing.js +52 -0
  1686. package/dist/ui/settings-hub-section.js +2 -4
  1687. package/dist/ui/settings-hub-setup-strings.js +1 -1
  1688. package/dist/ui/settings-hub-setup.js +4 -2
  1689. package/dist/ui/settings-hub-updates.js +67 -0
  1690. package/dist/ui/settings-hub-web-address.js +2 -1
  1691. package/dist/ui/settings-hub.js +37 -8
  1692. package/dist/ui/settings-layout.js +18 -15
  1693. package/dist/ui/settings-model.js +9 -5
  1694. package/dist/ui/settings-named-test.js +16 -16
  1695. package/dist/ui/settings-preview-address.js +156 -0
  1696. package/dist/ui/settings-public-session-strings.js +2 -2
  1697. package/dist/ui/settings-quota-notice.js +3 -3
  1698. package/dist/ui/settings-registry.js +32 -5
  1699. package/dist/ui/settings-revoke-strings.js +1 -1
  1700. package/dist/ui/settings-shared-strings.js +35 -2
  1701. package/dist/ui/settings-shared.js +67 -14
  1702. package/dist/ui/settings-strings.js +58 -49
  1703. package/dist/ui/settings-update.js +28 -7
  1704. package/dist/ui/settings-web-authority.js +9 -6
  1705. package/dist/ui/shared/access-overview.css +2 -2
  1706. package/dist/ui/shared/accounts-keepalive.css +1 -1
  1707. package/dist/ui/shared/accounts.css +9 -5
  1708. package/dist/ui/shared/agent-sheet.js +121 -0
  1709. package/dist/ui/shared/agent-widget.js +1 -2
  1710. package/dist/ui/shared/app-i18n.js +12 -4
  1711. package/dist/ui/shared/app-install.js +123 -0
  1712. package/dist/ui/shared/app-nav.js +9 -5
  1713. package/dist/ui/shared/app-needs.js +8 -1
  1714. package/dist/ui/shared/app-prefs.js +9 -3
  1715. package/dist/ui/shared/app-route.js +5 -3
  1716. package/dist/ui/shared/app-session.js +4 -3
  1717. package/dist/ui/shared/app-shell.js +218 -46
  1718. package/dist/ui/shared/app-store.js +7 -3
  1719. package/dist/ui/shared/app-stream.js +11 -2
  1720. package/dist/ui/shared/app-swipe.js +3 -1
  1721. package/dist/ui/shared/app-themes.js +3 -5
  1722. package/dist/ui/shared/app-update.js +107 -10
  1723. package/dist/ui/shared/app.css +1398 -275
  1724. package/dist/ui/shared/app.js +34 -5
  1725. package/dist/ui/shared/asset-url.d.ts +2 -0
  1726. package/dist/ui/shared/asset-url.js +20 -0
  1727. package/dist/ui/shared/chat-composer.js +30 -8
  1728. package/dist/ui/shared/chat-msg-actions.js +233 -0
  1729. package/dist/ui/shared/chat-quote.js +285 -0
  1730. package/dist/ui/shared/chat-render.js +63 -10
  1731. package/dist/ui/shared/chat-strings.js +49 -24
  1732. package/dist/ui/shared/chat-table-select.js +175 -0
  1733. package/dist/ui/shared/chat-thread.js +181 -29
  1734. package/dist/ui/shared/chat-time.js +7 -4
  1735. package/dist/ui/shared/chat-work-bar.css +97 -15
  1736. package/dist/ui/shared/clock-text.js +57 -0
  1737. package/dist/ui/shared/composer-focus.js +21 -0
  1738. package/dist/ui/shared/connector-prompt.d.ts +3 -0
  1739. package/dist/ui/shared/connector-prompt.js +20 -0
  1740. package/dist/ui/shared/device-roles.js +6 -5
  1741. package/dist/ui/shared/hub-ai-apps.css +12 -0
  1742. package/dist/ui/shared/hub-chat.css +114 -4
  1743. package/dist/ui/shared/hub-groups.css +19 -15
  1744. package/dist/ui/shared/hub-my-agents.css +41 -0
  1745. package/dist/ui/shared/hub-owner.css +123 -3
  1746. package/dist/ui/shared/hub-roles.css +99 -0
  1747. package/dist/ui/shared/hub-rooms-u2.css +98 -0
  1748. package/dist/ui/shared/hub-signin.css +2 -0
  1749. package/dist/ui/shared/hub.css +23 -5
  1750. package/dist/ui/shared/image-annotate.css +22 -3
  1751. package/dist/ui/shared/image-annotate.js +416 -0
  1752. package/dist/ui/shared/image-lightbox.js +218 -0
  1753. package/dist/ui/shared/image-zoom.js +316 -0
  1754. package/dist/ui/shared/info-tip.js +64 -0
  1755. package/dist/ui/shared/instance-nav.js +197 -21
  1756. package/dist/ui/shared/jump-idle.js +36 -0
  1757. package/dist/ui/shared/loading.css +1 -1
  1758. package/dist/ui/shared/model-picker.css +28 -1
  1759. package/dist/ui/shared/module-warm.d.ts +3 -0
  1760. package/dist/ui/shared/module-warm.js +39 -0
  1761. package/dist/ui/shared/office-dialogue.css +122 -0
  1762. package/dist/ui/shared/owner-css.js +1 -1
  1763. package/dist/ui/shared/panel-view.js +7 -1
  1764. package/dist/ui/shared/preview-panel-actions.js +1 -1
  1765. package/dist/ui/shared/preview-panel.js +51 -21
  1766. package/dist/ui/shared/preview-popout.css +11 -0
  1767. package/dist/ui/shared/preview.js +11 -2
  1768. package/dist/ui/shared/reply-previews.css +4 -0
  1769. package/dist/ui/shared/runtime-install.css +5 -0
  1770. package/dist/ui/shared/settings-connector.css +7 -0
  1771. package/dist/ui/shared/signin.js +27 -12
  1772. package/dist/ui/shared/task-board.css +733 -11
  1773. package/dist/ui/shared/text-undo.js +17 -3
  1774. package/dist/ui/shared/theme-picker.js +46 -0
  1775. package/dist/ui/shared/theme.js +101 -2
  1776. package/dist/ui/shared/tokens.css +318 -13
  1777. package/dist/ui/shared/ui-confirm.js +10 -5
  1778. package/dist/ui/shared/ui-icons.js +7 -0
  1779. package/dist/ui/shared/ui-menu.js +17 -11
  1780. package/dist/ui/shared/ui-states.js +9 -2
  1781. package/dist/ui/shared/ui-toast.js +4 -4
  1782. package/dist/ui/shared/update-card-ui.js +586 -0
  1783. package/dist/ui/shared/usage-dialog.js +90 -18
  1784. package/dist/ui/shared/view-history.js +2 -1
  1785. package/dist/ui/shared/view-strings.js +57 -13
  1786. package/dist/ui/shared/web-authorize.js +6 -5
  1787. package/dist/ui/shared/workspace.css +7 -0
  1788. package/dist/ui/signin.html +4 -2
  1789. package/dist/ui/structured-signin.js +64 -12
  1790. package/dist/ui/subagent-row.js +5 -3
  1791. package/dist/ui/task-unread.js +70 -0
  1792. package/dist/ui/trigger-complete.js +71 -0
  1793. package/dist/ui/usage-credits-card.js +84 -0
  1794. package/dist/ui/usage-pool.js +2 -1
  1795. package/dist/ui/web-terminal/terminal.css +1 -1
  1796. package/dist/ui/windows-cli-catalog.js +33 -6
  1797. package/dist/ui/workspace-ignored-strings.js +16 -0
  1798. package/dist/ui/workspace-panel.js +21 -10
  1799. package/dist/update-abandon.d.ts +26 -0
  1800. package/dist/update-abandon.js +111 -0
  1801. package/dist/update-abandon.js.map +1 -0
  1802. package/dist/update-card.d.ts +193 -0
  1803. package/dist/update-card.js +620 -0
  1804. package/dist/update-card.js.map +1 -0
  1805. package/dist/update-dispatch.d.ts +24 -2
  1806. package/dist/update-dispatch.js +28 -5
  1807. package/dist/update-dispatch.js.map +1 -1
  1808. package/dist/update-fix.d.ts +66 -0
  1809. package/dist/update-fix.js +67 -0
  1810. package/dist/update-fix.js.map +1 -0
  1811. package/dist/update-forward.d.ts +59 -0
  1812. package/dist/update-forward.js +227 -0
  1813. package/dist/update-forward.js.map +1 -0
  1814. package/dist/update-goback.d.ts +90 -0
  1815. package/dist/update-goback.js +272 -0
  1816. package/dist/update-goback.js.map +1 -0
  1817. package/dist/update-idle.d.ts +66 -0
  1818. package/dist/update-idle.js +199 -0
  1819. package/dist/update-idle.js.map +1 -0
  1820. package/dist/update-install.d.ts +2 -1
  1821. package/dist/update-install.js +18 -10
  1822. package/dist/update-install.js.map +1 -1
  1823. package/dist/update-journal.d.ts +359 -0
  1824. package/dist/update-journal.js +723 -0
  1825. package/dist/update-journal.js.map +1 -0
  1826. package/dist/update-launch.d.ts +1 -1
  1827. package/dist/update-launch.js +10 -3
  1828. package/dist/update-launch.js.map +1 -1
  1829. package/dist/update-npm-env.d.ts +45 -12
  1830. package/dist/update-npm-env.js +48 -0
  1831. package/dist/update-npm-env.js.map +1 -1
  1832. package/dist/update-package-restore.d.ts +84 -0
  1833. package/dist/update-package-restore.js +329 -0
  1834. package/dist/update-package-restore.js.map +1 -0
  1835. package/dist/update-quiescence.d.ts +221 -0
  1836. package/dist/update-quiescence.js +370 -0
  1837. package/dist/update-quiescence.js.map +1 -0
  1838. package/dist/update-readiness-host.d.ts +61 -0
  1839. package/dist/update-readiness-host.js +297 -0
  1840. package/dist/update-readiness-host.js.map +1 -0
  1841. package/dist/update-readiness.d.ts +85 -0
  1842. package/dist/update-readiness.js +463 -0
  1843. package/dist/update-readiness.js.map +1 -0
  1844. package/dist/update-recovery/kit.d.ts +35 -0
  1845. package/dist/update-recovery/kit.js +99 -0
  1846. package/dist/update-recovery/kit.js.map +1 -0
  1847. package/dist/update-recovery/pre-start.d.ts +34 -0
  1848. package/dist/update-recovery/pre-start.js +103 -0
  1849. package/dist/update-recovery/pre-start.js.map +1 -0
  1850. package/dist/update-recovery/recover-main.d.ts +1 -0
  1851. package/dist/update-recovery/recover-main.js +4 -0
  1852. package/dist/update-recovery/recover-main.js.map +1 -0
  1853. package/dist/update-recovery/recover.d.ts +22 -0
  1854. package/dist/update-recovery/recover.js +134 -0
  1855. package/dist/update-recovery/recover.js.map +1 -0
  1856. package/dist/update-recovery/route.d.ts +53 -0
  1857. package/dist/update-recovery/route.js +262 -0
  1858. package/dist/update-recovery/route.js.map +1 -0
  1859. package/dist/update-recovery/runner.d.ts +62 -0
  1860. package/dist/update-recovery/runner.js +229 -0
  1861. package/dist/update-recovery/runner.js.map +1 -0
  1862. package/dist/update-recovery/service-manager.d.ts +39 -0
  1863. package/dist/update-recovery/service-manager.js +57 -0
  1864. package/dist/update-recovery/service-manager.js.map +1 -0
  1865. package/dist/update-restore.d.ts +50 -0
  1866. package/dist/update-restore.js +360 -0
  1867. package/dist/update-restore.js.map +1 -0
  1868. package/dist/update-retained.d.ts +65 -0
  1869. package/dist/update-retained.js +116 -0
  1870. package/dist/update-retained.js.map +1 -0
  1871. package/dist/update-rollback.d.ts +74 -0
  1872. package/dist/update-rollback.js +221 -0
  1873. package/dist/update-rollback.js.map +1 -0
  1874. package/dist/update-settings.d.ts +63 -0
  1875. package/dist/update-settings.js +162 -0
  1876. package/dist/update-settings.js.map +1 -0
  1877. package/dist/update-snapshot-manifest.d.ts +32 -0
  1878. package/dist/update-snapshot-manifest.js +65 -0
  1879. package/dist/update-snapshot-manifest.js.map +1 -0
  1880. package/dist/update-snapshot-scope.d.ts +67 -0
  1881. package/dist/update-snapshot-scope.js +174 -0
  1882. package/dist/update-snapshot-scope.js.map +1 -0
  1883. package/dist/update-snapshot.d.ts +34 -0
  1884. package/dist/update-snapshot.js +246 -0
  1885. package/dist/update-snapshot.js.map +1 -0
  1886. package/dist/update-writers.d.ts +71 -0
  1887. package/dist/update-writers.js +235 -0
  1888. package/dist/update-writers.js.map +1 -0
  1889. package/dist/usage/i18n-keys.d.ts +1 -1
  1890. package/dist/usage/i18n-keys.js +10 -1
  1891. package/dist/usage/i18n-keys.js.map +1 -1
  1892. package/dist/usage/profile-timeline.d.ts +2 -0
  1893. package/dist/usage/profile-timeline.js +4 -0
  1894. package/dist/usage/profile-timeline.js.map +1 -1
  1895. package/dist/usage/providers.d.ts +4 -11
  1896. package/dist/usage/providers.js +109 -134
  1897. package/dist/usage/providers.js.map +1 -1
  1898. package/dist/usage/usage-api.js +5 -2
  1899. package/dist/usage/usage-api.js.map +1 -1
  1900. package/dist/wake-coordinator.js +3 -2
  1901. package/dist/wake-coordinator.js.map +1 -1
  1902. package/dist/web-api.d.ts +132 -9
  1903. package/dist/web-api.js +1468 -242
  1904. package/dist/web-api.js.map +1 -1
  1905. package/dist/web-asset-version.d.ts +65 -0
  1906. package/dist/web-asset-version.js +259 -0
  1907. package/dist/web-asset-version.js.map +1 -0
  1908. package/dist/web-backend-login.d.ts +5 -1
  1909. package/dist/web-backend-login.js +8 -2
  1910. package/dist/web-backend-login.js.map +1 -1
  1911. package/dist/web-chat-archive.d.ts +147 -0
  1912. package/dist/web-chat-archive.js +530 -0
  1913. package/dist/web-chat-archive.js.map +1 -0
  1914. package/dist/web-chat-history.d.ts +137 -2
  1915. package/dist/web-chat-history.js +335 -12
  1916. package/dist/web-chat-history.js.map +1 -1
  1917. package/dist/web-claude-credentials.d.ts +31 -0
  1918. package/dist/web-claude-credentials.js +138 -0
  1919. package/dist/web-claude-credentials.js.map +1 -0
  1920. package/dist/web-commands.d.ts +9 -5
  1921. package/dist/web-commands.js +7 -4
  1922. package/dist/web-commands.js.map +1 -1
  1923. package/dist/web-guest-access.d.ts +3 -0
  1924. package/dist/web-guest-access.js +8 -4
  1925. package/dist/web-guest-access.js.map +1 -1
  1926. package/dist/web-host-guard.js +3 -1
  1927. package/dist/web-host-guard.js.map +1 -1
  1928. package/dist/web-host-install.d.ts +30 -3
  1929. package/dist/web-host-install.js +50 -4
  1930. package/dist/web-host-install.js.map +1 -1
  1931. package/dist/web-icons.d.ts +20 -3
  1932. package/dist/web-icons.js +79 -10
  1933. package/dist/web-icons.js.map +1 -1
  1934. package/dist/web-login.d.ts +13 -1
  1935. package/dist/web-login.js +16 -4
  1936. package/dist/web-login.js.map +1 -1
  1937. package/dist/web-mentions.d.ts +29 -8
  1938. package/dist/web-mentions.js +128 -1
  1939. package/dist/web-mentions.js.map +1 -1
  1940. package/dist/web-notices.d.ts +20 -0
  1941. package/dist/web-notices.js +64 -8
  1942. package/dist/web-notices.js.map +1 -1
  1943. package/dist/web-office-acts.d.ts +16 -0
  1944. package/dist/web-office-acts.js +30 -9
  1945. package/dist/web-office-acts.js.map +1 -1
  1946. package/dist/web-office-pack-read.js +1 -1
  1947. package/dist/web-office-pack-read.js.map +1 -1
  1948. package/dist/web-office-skins.d.ts +19 -6
  1949. package/dist/web-office-skins.js +85 -36
  1950. package/dist/web-office-skins.js.map +1 -1
  1951. package/dist/web-office-store.d.ts +2 -0
  1952. package/dist/web-office-store.js +20 -6
  1953. package/dist/web-office-store.js.map +1 -1
  1954. package/dist/web-pin-store.d.ts +58 -0
  1955. package/dist/web-pin-store.js +170 -0
  1956. package/dist/web-pin-store.js.map +1 -0
  1957. package/dist/web-prefs.js +5 -1
  1958. package/dist/web-prefs.js.map +1 -1
  1959. package/dist/web-preview.d.ts +5 -0
  1960. package/dist/web-preview.js +1 -1
  1961. package/dist/web-preview.js.map +1 -1
  1962. package/dist/web-reply-files.d.ts +1 -0
  1963. package/dist/web-reply-files.js +2 -0
  1964. package/dist/web-reply-files.js.map +1 -1
  1965. package/dist/web-session-authorization.d.ts +27 -0
  1966. package/dist/web-session-authorization.js +32 -0
  1967. package/dist/web-session-authorization.js.map +1 -1
  1968. package/dist/web-session.d.ts +26 -5
  1969. package/dist/web-session.js +32 -3
  1970. package/dist/web-session.js.map +1 -1
  1971. package/dist/web-settings-patch.d.ts +51 -3
  1972. package/dist/web-settings-patch.js +124 -1
  1973. package/dist/web-settings-patch.js.map +1 -1
  1974. package/dist/web-shell-routes.d.ts +2 -2
  1975. package/dist/web-shell-routes.js +3 -2
  1976. package/dist/web-shell-routes.js.map +1 -1
  1977. package/dist/web-terminal.d.ts +9 -0
  1978. package/dist/web-terminal.js +27 -1
  1979. package/dist/web-terminal.js.map +1 -1
  1980. package/dist/web-theme.js +2 -2
  1981. package/dist/web-update.d.ts +30 -1
  1982. package/dist/web-upload.d.ts +37 -1
  1983. package/dist/web-upload.js +105 -5
  1984. package/dist/web-upload.js.map +1 -1
  1985. package/dist/windows-agents.d.ts +36 -2
  1986. package/dist/windows-agents.js +115 -4
  1987. package/dist/windows-agents.js.map +1 -1
  1988. package/dist/windows-cli-api.d.ts +10 -7
  1989. package/dist/windows-cli-api.js +17 -14
  1990. package/dist/windows-cli-api.js.map +1 -1
  1991. package/dist/windows-cli-worker.d.ts +10 -0
  1992. package/dist/windows-cli-worker.js +118 -15
  1993. package/dist/windows-cli-worker.js.map +1 -1
  1994. package/dist/windows-cli.d.ts +65 -2
  1995. package/dist/windows-cli.js +192 -28
  1996. package/dist/windows-cli.js.map +1 -1
  1997. package/dist/windows-native-mcp.js +5 -2
  1998. package/dist/windows-native-mcp.js.map +1 -1
  1999. package/dist/windows-shortcuts.d.ts +3 -22
  2000. package/dist/windows-shortcuts.js +5 -45
  2001. package/dist/windows-shortcuts.js.map +1 -1
  2002. package/dist/workflow-templates/default.md +8 -8
  2003. package/dist/wsl-host.d.ts +52 -0
  2004. package/dist/wsl-host.js +97 -0
  2005. package/dist/wsl-host.js.map +1 -0
  2006. package/launcher/agend +4 -1
  2007. package/launcher/agend-agent +4 -1
  2008. package/launcher/agend-install.cjs +63 -14
  2009. package/launcher/install-admission.d.cts +8 -0
  2010. package/launcher/npm-allow-scripts.cjs +72 -0
  2011. package/launcher/npm-global-prefix.cjs +81 -0
  2012. package/launcher/postinstall.cjs +9 -8
  2013. package/launcher/runtime-select.cjs +8 -2
  2014. package/package.json +4 -3
  2015. package/scripts/preinstall-guard.cjs +1 -1
  2016. 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().
@@ -4826,6 +5568,7 @@ export class Daemon extends EventEmitter {
4826
5568
  const message = this.resolveErrorMessage(pane, ep);
4827
5569
  this.logger.warn({ errorType: ep.type, action: ep.action }, `PTY error detected: ${message}`);
4828
5570
  this.lastErrorEpisode = { key, pattern: ep.pattern, pane, spawn: this.spawnGeneration, fence: this.launchFenceEpoch };
5571
+ this.noteHubAnswerFailure();
4829
5572
  const { notice: noticeOf, ...rest } = ep;
4830
5573
  const notice = noticeOf ? this.resolveErrorNotice(pane, ep, noticeOf) : undefined;
4831
5574
  this.emit("pty_error", { name: this.name, ...rest, message, ...(notice ? { notice } : {}) });
@@ -4888,7 +5631,7 @@ export class Daemon extends EventEmitter {
4888
5631
  const screen = await tmux.capturePane().catch(() => null);
4889
5632
  if (screen === null)
4890
5633
  return;
4891
- await tmux.sendSpecialKey(cancelKey, undefined, { kind: "dialog", screen });
5634
+ await tmux.sendSpecialKey(cancelKey, undefined, { kind: "dialog", screen, cancelTurn: true });
4892
5635
  return;
4893
5636
  }
4894
5637
  await tmux.sendSpecialKey(cancelKey);
@@ -4903,7 +5646,9 @@ export class Daemon extends EventEmitter {
4903
5646
  // FleetManager calls this synchronously before sendEscape. Cancel only the
4904
5647
  // current human turn; leave already-forwarded tool requests to settle.
4905
5648
  this.recoveryCancelled = true;
5649
+ this.noteHubAnswerFailure();
4906
5650
  this.turnReplyGuard.cancelByUser();
5651
+ this.replyDraft.reset();
4907
5652
  // #1241: a cancelled turn never confirms — its next edge completes it as
4908
5653
  // intentional. Drop a pending confirmation so it cannot promote afterwards.
4909
5654
  this.clearReplyGuardConfirm();
@@ -5037,6 +5782,8 @@ export class Daemon extends EventEmitter {
5037
5782
  return;
5038
5783
  }
5039
5784
  const verdict = { reached: false };
5785
+ let codexBefore = null;
5786
+ let cliBefore = null;
5040
5787
  try {
5041
5788
  await this.wake();
5042
5789
  if (!this.isDeliveryEpochCurrent(deliveryEpoch)) {
@@ -5046,6 +5793,27 @@ export class Daemon extends EventEmitter {
5046
5793
  tellWritten(false);
5047
5794
  return;
5048
5795
  }
5796
+ // 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.
5797
+ if (ownSwitch?.codex) {
5798
+ const gate = await this.codexSwitchGate();
5799
+ if ("blocked" in gate) {
5800
+ this.logger.info({ requested: ownSwitch.codex, reason: gate.blocked, version: gate.version }, "Codex runtime switch not typed");
5801
+ reportSwitch({ outcome: "not_sent", reason: gate.blocked, version: gate.version ?? null });
5802
+ tellWritten(false);
5803
+ return;
5804
+ }
5805
+ codexBefore = gate;
5806
+ }
5807
+ if (ownSwitch?.cli) {
5808
+ const gate = await this.cliSwitchGate(ownSwitch.cli);
5809
+ if ("blocked" in gate) {
5810
+ this.logger.info({ requested: ownSwitch.cli, reason: gate.blocked, version: gate.version }, "CLI runtime switch not typed");
5811
+ reportSwitch({ outcome: "not_sent", reason: gate.blocked, version: gate.version ?? null });
5812
+ tellWritten(false);
5813
+ return;
5814
+ }
5815
+ cliBefore = gate;
5816
+ }
5049
5817
  // Board 907c7899: the pane just before this attempt's paste — after its readiness wait, last capture and fence,
5050
5818
  // under the paste lock (no other input lands in between). Each attempt looks again.
5051
5819
  const lookBefore = async () => {
@@ -5060,8 +5828,10 @@ export class Daemon extends EventEmitter {
5060
5828
  preserveExactBytes: true,
5061
5829
  // #1690: our own /model holds every other delivery from its write on — before the lock is released, so a steer
5062
5830
  // 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) {
5831
+ ...(ownSwitch || notifyWritten || contextReset ? { onPaneWritten: () => { if (contextReset) {
5832
+ this.resetInboundPresentation();
5833
+ this.resetRoomConversation();
5834
+ } if (ownSwitch) {
5065
5835
  this.ownSwitch = ownSwitch;
5066
5836
  if (currentModelOwner())
5067
5837
  modelObserver?.ownIntent(ownSwitch.requested);
@@ -5115,7 +5885,7 @@ export class Daemon extends EventEmitter {
5115
5885
  reportSwitch({ outcome: "not_sent" }); // its write never began
5116
5886
  else {
5117
5887
  try {
5118
- reportSwitch(await this.answerOwnSwitchDialog(ownSwitch));
5888
+ reportSwitch(ownSwitch.codex ? await this.verifyCodexSwitch(ownSwitch.codex, codexBefore) : ownSwitch.cli ? await this.verifyCliSwitch(ownSwitch.cli, cliBefore) : await this.answerOwnSwitchDialog(ownSwitch));
5119
5889
  }
5120
5890
  catch (err) {
5121
5891
  this.logger.warn({ err: err.message }, "Answering our own model switch failed");
@@ -5145,11 +5915,118 @@ export class Daemon extends EventEmitter {
5145
5915
  return;
5146
5916
  }
5147
5917
  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;
5918
+ const codexPart = (v) => v === null ? null : typeof v === "string" && v ? v : undefined;
5919
+ const codex = sw?.codex && typeof sw.codex === "object" ? { model: codexPart(sw.codex.model), effort: codexPart(sw.codex.effort) } : undefined;
5920
+ // 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).
5921
+ const rawCli = sw?.cli;
5922
+ const cli = rawCli && typeof rawCli === "object" && typeof rawCli.backend === "string" && Object.hasOwn(CLI_RUNTIME_SWITCH, rawCli.backend)
5923
+ ? { backend: rawCli.backend, model: codexPart(rawCli.model), effort: codexPart(rawCli.effort) } : rawCli === undefined ? undefined : null;
5924
+ const cliOk = !cli || (cli.model !== undefined && cli.effort !== undefined && (cli.model !== null || cli.effort !== null)
5925
+ && CLI_RUNTIME_SWITCH[cli.backend].command({ model: cli.model, effort: cli.effort }) === msg.content);
5926
+ // A malformed switch must not downgrade into an ungated legacy raw paste.
5927
+ if (rawCli !== undefined && (cli === null || !cliOk || codex || !sw || typeof sw.id !== "string" || sw.kind !== "model" || typeof sw.requested !== "string")) {
5928
+ if (typeof sw?.id === "string")
5929
+ this.broadcastFleetMessage({ type: "runtime_switch_result", id: sw.id, outcome: "not_sent", reason: "command" });
5930
+ return;
5931
+ }
5932
+ const ownSwitch = sw && typeof sw.id === "string" && sw.kind === "model" && typeof sw.requested === "string" && cli !== null && cliOk && !(codex && cli)
5933
+ && (!codex || (codex.model !== undefined && codex.effort !== undefined && (codex.model !== null || codex.effort !== null)))
5934
+ ? { id: sw.id, kind: "model", requested: sw.requested,
5935
+ ...(codex ? { codex: { model: codex.model, effort: codex.effort } } : {}),
5936
+ ...(cli ? { cli: { backend: cli.backend, model: cli.model, effort: cli.effort } } : {}) } : undefined;
5150
5937
  const notifyWritten = typeof msg.notify_written === "string" && /^[0-9a-f]{16}$/.test(msg.notify_written) ? msg.notify_written : undefined;
5151
5938
  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
5939
  }
5940
+ /**
5941
+ * M-3175: before typing a codex `/model … --reasoning=…`: the pane authoritatively idle (bounded), the RUNNING codex at a
5942
+ * version that has the inline form (an older one would send the line to the model as a prompt), and what the switch is
5943
+ * verified against afterwards — the rollout's end when the session has one, and the count of codex's answers on the pane.
5944
+ */
5945
+ async codexSwitchGate() {
5946
+ const tmux = this.tmux;
5947
+ if (!tmux || !await this.waitForAuthoritativePaneIdle(CODEX_SWITCH_IDLE_MS, 500) || this.tmux !== tmux)
5948
+ return { blocked: "busy" };
5949
+ const pid = await tmux.getPanePid?.() ?? null;
5950
+ const version = pid ? await codexRunningVersion(pid) : null;
5951
+ if (!codexSupportsInlineModel(version))
5952
+ return { blocked: "version", version };
5953
+ const pane = await tmux.capturePaneWithHistory(CODEX_SWITCH_HISTORY_LINES).catch(() => "");
5954
+ let rollout = null;
5955
+ const session = this.backend?.readRawPasteSession?.(pane);
5956
+ if (session) {
5957
+ const file = await checkpointCodexPane(session.sessionsDir, session.sessionId, this.config.working_directory || process.cwd()).catch(() => null);
5958
+ if (file)
5959
+ rollout = { path: file.path, offset: file.offset };
5960
+ }
5961
+ return { rollout, answers: codexSwitchAnswerCount(pane), version };
5962
+ }
5963
+ /**
5964
+ * M-3180: before typing a CLI_RUNTIME_SWITCH step: the pane authoritatively idle (bounded), the RUNNING binary at the entry's minimum
5965
+ * for this step, and what the verdict compares against — the scrollback before the command and the entry's record checkpoint.
5966
+ */
5967
+ async cliSwitchGate(step) {
5968
+ const tmux = this.tmux, entry = CLI_RUNTIME_SWITCH[step.backend];
5969
+ if (!entry || !tmux || !await this.waitForAuthoritativePaneIdle(CODEX_SWITCH_IDLE_MS, 500) || this.tmux !== tmux)
5970
+ return { blocked: "busy" };
5971
+ const pid = await tmux.getPanePid?.() ?? null;
5972
+ const version = pid ? await cliRunningVersion(pid, { backend: step.backend, matchExe: entry.matchExe, versionFromExe: entry.versionFromExe }) : null;
5973
+ if (!cliSwitchAllowed(entry, step, version))
5974
+ return { blocked: "version", version };
5975
+ const pane = await tmux.capturePaneWithHistory(CODEX_SWITCH_HISTORY_LINES).catch(() => "");
5976
+ const record = entry.checkpoint ? await entry.checkpoint(pane, this.config.working_directory || process.cwd(), pid).catch(() => undefined) : undefined;
5977
+ return { pane, ...(record !== undefined ? { record } : {}) };
5978
+ }
5979
+ /** M-3180: the entry's verdict on the scrollback after the step, against the one before it; nothing in time is not confirmed. */
5980
+ async verifyCliSwitch(step, before) {
5981
+ const tmux = this.tmux, entry = CLI_RUNTIME_SWITCH[step.backend];
5982
+ if (!tmux || !before || !entry)
5983
+ return { outcome: "not_confirmed" };
5984
+ const deadline = performance.now() + CODEX_SWITCH_VERIFY_MS;
5985
+ while (performance.now() < deadline && this.tmux === tmux) {
5986
+ const pane = await tmux.capturePaneWithHistory(CODEX_SWITCH_HISTORY_LINES).catch(() => "");
5987
+ const verdict = await entry.verify({ model: step.model, effort: step.effort }, before, { pane });
5988
+ if (verdict?.outcome === "switched")
5989
+ return { outcome: "switched", confirmed: true, shown: verdict.shown };
5990
+ if (verdict?.outcome === "mismatch")
5991
+ return { outcome: "mismatch", shown: verdict.shown, answered: true };
5992
+ await new Promise(resolve => setTimeout(resolve, 200));
5993
+ }
5994
+ return { outcome: "not_confirmed" };
5995
+ }
5996
+ /**
5997
+ * M-3175: what our codex switch came to. The rollout's `thread_settings_applied` written after our checkpoint is the proof
5998
+ * (codex writes it at once once the session has a rollout); a session with none yet has codex's own answer on the pane —
5999
+ * a NEW `• Model changed to … for this session only` (or `■` refusal) after the ones counted before the line was typed.
6000
+ * Anything that does not name what was asked is a mismatch; no answer in time is not confirmed. The fleet restarts on both.
6001
+ */
6002
+ async verifyCodexSwitch(want, before) {
6003
+ const tmux = this.tmux;
6004
+ if (!tmux || !before)
6005
+ return { outcome: "not_confirmed" };
6006
+ const fits = (model, effort) => (want.model === null || model === want.model) && (want.effort === null || effort === want.effort);
6007
+ const deadline = performance.now() + CODEX_SWITCH_VERIFY_MS;
6008
+ while (performance.now() < deadline && this.tmux === tmux) {
6009
+ if (before.rollout) {
6010
+ const applied = codexAppliedFromRollout(await readFrom(before.rollout.path, before.rollout.offset, CODEX_SWITCH_ROLLOUT_READ));
6011
+ if (applied) {
6012
+ const shown = `${applied.model} ${applied.effort ?? "default"}`;
6013
+ return fits(applied.model, applied.effort) ? { outcome: "switched", confirmed: true, shown } : { outcome: "mismatch", shown, answered: true };
6014
+ }
6015
+ }
6016
+ const pane = await tmux.capturePaneWithHistory(CODEX_SWITCH_HISTORY_LINES).catch(() => "");
6017
+ if (codexSwitchAnswerCount(pane) > before.answers) {
6018
+ const answer = codexSwitchFromPane(pane);
6019
+ if (answer?.kind === "refused")
6020
+ return { outcome: "mismatch", shown: answer.text, answered: true };
6021
+ if (answer?.kind === "switched" && !before.rollout) {
6022
+ const shown = `${answer.model} ${answer.effort}`;
6023
+ return fits(answer.model, answer.effort) ? { outcome: "switched", confirmed: true, shown } : { outcome: "mismatch", shown, answered: true };
6024
+ }
6025
+ }
6026
+ await new Promise(resolve => setTimeout(resolve, 200));
6027
+ }
6028
+ return { outcome: "not_confirmed" };
6029
+ }
5153
6030
  /**
5154
6031
  * #1690 (the user's choice A): after AgEnD's own `/model <name>`, claude may ask "Switch model?" (a warm cache for
5155
6032
  * another model). When the model it names is the one asked for, answer Yes; otherwise No (Escape — `Kept model as …`),
@@ -5513,6 +6390,7 @@ export class Daemon extends EventEmitter {
5513
6390
  this.logger.info("Stopping daemon instance");
5514
6391
  this.clearQuitRelaunchWatch();
5515
6392
  this.fenceDeliveryWritesForStop();
6393
+ this.requestContextHelper?.revoke();
5516
6394
  this.turnReplyGuard.reset();
5517
6395
  this.clearReplyGuardConfirm();
5518
6396
  this.sawBlockedInput = false;
@@ -5534,6 +6412,7 @@ export class Daemon extends EventEmitter {
5534
6412
  this.healthCheckPaused = true;
5535
6413
  this.saveSessionId();
5536
6414
  await this.nativePaneLifecycle.release(options.nativePane ?? "detach");
6415
+ await this.ipcServer?.close();
5537
6416
  try {
5538
6417
  unlinkSync(join(this.instanceDir, "daemon.pid"));
5539
6418
  }
@@ -5607,7 +6486,7 @@ export class Daemon extends EventEmitter {
5607
6486
  await this.ipcServer?.close();
5608
6487
  // Clean up backend config files
5609
6488
  if (this.backend?.cleanup) {
5610
- this.backend.cleanup(this.buildBackendConfig());
6489
+ this.backend.cleanup(this.buildBackendConfig(false));
5611
6490
  }
5612
6491
  // Clean up checked-out repos
5613
6492
  try {
@@ -5660,6 +6539,16 @@ export class Daemon extends EventEmitter {
5660
6539
  }
5661
6540
  return { ...snapshot, interaction: this.getInteractionSnapshot() };
5662
6541
  }
6542
+ footprintEnabled = false;
6543
+ footprintPane = null;
6544
+ setHostFootprintEnabled(enabled) { this.footprintEnabled = enabled; if (!enabled)
6545
+ this.footprintPane = null; }
6546
+ hostFootprintRoot() {
6547
+ const cached = this.footprintPane;
6548
+ 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)
6549
+ return null;
6550
+ return { pid: cached.pid, owner: cached.owner, observedAt: cached.observedAt };
6551
+ }
5663
6552
  interactionOwner() {
5664
6553
  return { bootId: this.bootId, spawnGeneration: this.spawnGeneration,
5665
6554
  launchAttempt: this.launchAttempt, launchFenceEpoch: this.launchFenceEpoch };
@@ -5708,13 +6597,17 @@ export class Daemon extends EventEmitter {
5708
6597
  /** Local system work: no user turn, channel reply target, wake or replay of an original request. */
5709
6598
  async deliverWorkingRecovery(content, delivery, admitted) {
5710
6599
  const tmux = this.tmux, owner = JSON.stringify(this.interactionOwner()), epoch = this.deliveryEpoch;
5711
- const current = () => this.tmux === tmux && owner === JSON.stringify(this.interactionOwner())
6600
+ let begun = false;
6601
+ const current = () => (begun || !this.requestContextAdmission || this.requestContextAdmission.available()) && this.tmux === tmux && owner === JSON.stringify(this.interactionOwner())
5712
6602
  && this.deliveryEpoch === epoch && !this.deliveryWritesStopping && !this.runtimeMonitorsFrozen
5713
6603
  && !this.spawning && !this.startupAborted && !this.isPaused && !this.healthCheckPaused
5714
6604
  && this.processStatus === "running" && this.pasteQueueDepth === 0
5715
6605
  && (this.workingRecoveryInputOwner === owner || this.instanceState === "idle" && !this.recoveryNativeWork)
5716
6606
  && this.recoveryBootSettled && !this.recoveryCancelled && !this.isSessionOomStopped() && admitted();
5717
- let begun = false;
6607
+ const heldCurrent = () => this.tmux === tmux && owner === JSON.stringify(this.interactionOwner())
6608
+ && this.deliveryEpoch === epoch && !this.deliveryWritesStopping && !this.startupAborted && admitted();
6609
+ if (this.requestContextAdmission && !await this.requestContextAdmission.wait(heldCurrent))
6610
+ return;
5718
6611
  try {
5719
6612
  await this.paneWriteLock.run(async () => {
5720
6613
  if (!tmux || !current())
@@ -5773,6 +6666,7 @@ export class Daemon extends EventEmitter {
5773
6666
  }
5774
6667
  }
5775
6668
  workingTurnDelivery = null;
6669
+ workingTurnRequestContext = null;
5776
6670
  workingBackgroundObservation = null;
5777
6671
  /** Pure metadata read: never discovers sessions, captures a pane or reads backend files. */
5778
6672
  getWorkingStateObservation() {
@@ -5910,8 +6804,13 @@ export class Daemon extends EventEmitter {
5910
6804
  }
5911
6805
  /** Shared Fleet inputs: socket and native transports retain the same wake, epoch and raw-paste semantics. */
5912
6806
  handleFleetMessage(msg, send, current = () => true) {
6807
+ if (msg.type === "hub_room_tools_changed") {
6808
+ this.ipcServer?.broadcast({ type: "hub_room_tools_changed" });
6809
+ return true;
6810
+ }
5913
6811
  if (msg.type === "query_sessions") {
5914
6812
  send({ type: "query_sessions_response", sessions: [] });
6813
+ send(this.hubAnswerTurnStateMessage()); // M-3660
5915
6814
  }
5916
6815
  else if (msg.type === "fleet_inbound") {
5917
6816
  const meta = msg.meta;
@@ -5922,7 +6821,11 @@ export class Daemon extends EventEmitter {
5922
6821
  this.deferDurableDelivery(meta, "native channel owner changed before pane submission");
5923
6822
  return;
5924
6823
  }
5925
- this.pushChannelMessage(msg.content, meta, targetSession, deliveryEpoch);
6824
+ const inputId = this.requestContextLifecycle && isHubQuestionMeta(meta) && typeof msg.request_context_input_id === "string" ? msg.request_context_input_id : undefined;
6825
+ if (inputId)
6826
+ this.pushChannelMessage(msg.content, meta, targetSession, deliveryEpoch, inputId);
6827
+ else
6828
+ this.pushChannelMessage(msg.content, meta, targetSession, deliveryEpoch);
5926
6829
  }).catch(err => {
5927
6830
  this.deferDurableDelivery(meta, `target wake failed before pane submission: ${err.message}`);
5928
6831
  this.logger.error({ err: err.message }, "Wake failed for inbound delivery");
@@ -6058,7 +6961,7 @@ export class Daemon extends EventEmitter {
6058
6961
  this.pauseRequested = false;
6059
6962
  return false;
6060
6963
  }
6061
- if (!ready() || admission && !admission.accepts(text) || this.backend?.backgroundWorkRunning?.(text)
6964
+ if (!ready() || admission && !admission.accepts(text) || this.backend?.isDraftIdlePane?.(text) === true || this.backend?.backgroundWorkRunning?.(text)
6062
6965
  || !allowStuck && !this.paneAuthoritativelyIdle(text)) {
6063
6966
  this.pauseRequested = false;
6064
6967
  return false;
@@ -6216,7 +7119,8 @@ export class Daemon extends EventEmitter {
6216
7119
  // auth pause — otherwise the instance would pause again the moment it idles.
6217
7120
  this.pausePending = false;
6218
7121
  this.pauseReconfirmAuth = false;
6219
- this.authFailureUnresolved = false;
7122
+ if (!this.staleAuthIssue())
7123
+ this.authFailureUnresolved = false;
6220
7124
  this.unverifiedAuthMatch = null;
6221
7125
  this.loginScreenReported = false;
6222
7126
  this.fatalStartupReported = false;
@@ -6446,7 +7350,9 @@ export class Daemon extends EventEmitter {
6446
7350
  this.logStateEdge(previous, snapshot);
6447
7351
  this.publishWorkingState("execution");
6448
7352
  this.emit("instance_state", { name: this.name, ...snapshot });
6449
- this.broadcastFleetMessage({ type: "instance_state", instanceName: this.name, ...snapshot });
7353
+ this.broadcastFleetMessage({ type: "instance_state", instanceName: this.name, ...snapshot,
7354
+ turnEvidence: this.turnEvidence(), turnActivityAt: this.turnWatch.activityAt });
7355
+ this.noteTurnEdge(snapshot.state);
6450
7356
  if (snapshot.state === "stuck" && pane && this.instanceStateReadyPattern) {
6451
7357
  this.handleStuckTransition(pane, snapshot, this.instanceStateReadyPattern);
6452
7358
  }
@@ -6498,11 +7404,14 @@ export class Daemon extends EventEmitter {
6498
7404
  * message can arrive mid-turn and sit queued, and marking at arrival would let
6499
7405
  * the PREVIOUS turn's idle edge consume (and reset) the new turn's state.
6500
7406
  */
6501
- markTurnStarted(meta, deliveredText, deliveryEpoch = this.deliveryEpoch, queuedHandoff = false) {
7407
+ markTurnStarted(meta, deliveredText, deliveryEpoch = this.deliveryEpoch, queuedHandoff = false, verdict) {
6502
7408
  // Cancel may have interrupted an in-flight paste before its promise settled.
6503
7409
  // Its late success must not re-arm the turn that the user just cancelled.
6504
7410
  if (!this.isDeliveryEpochCurrent(deliveryEpoch))
6505
7411
  return;
7412
+ // New input, including a peer/system input, cannot inherit an earlier draft.
7413
+ // If its transcript was already polled before paste confirmation, prefer a generic recovery.
7414
+ this.replyDraft.reset();
6506
7415
  // Channel turns started by a person. Cross-instance, schedules (silent or
6507
7416
  // not), and AgEnD system notices must not expect a reply to a person (#2544):
6508
7417
  // a proxy or recovery notice would land in the last USER topic, or flag a
@@ -6510,7 +7419,9 @@ export class Daemon extends EventEmitter {
6510
7419
  // chat platform has no chat_id (its reply goes to the web chat through the
6511
7420
  // fleet's web-only sink), but it is a person waiting for an answer all the
6512
7421
  // same: the guard arms for it (alpha.2).
6513
- if (!turnExpectsPersonReply(meta)) {
7422
+ const requestContext = this.requestContextTurnSnapshot();
7423
+ const ownedReplyTarget = requestContext ? this.requestContextLifecycle?.replyTarget?.(requestContext) : null;
7424
+ if (!turnExpectsPersonReply(meta) && !ownedReplyTarget) {
6514
7425
  this.logger.debug({
6515
7426
  source: meta.source || null,
6516
7427
  user: meta.user || null,
@@ -6530,12 +7441,21 @@ export class Daemon extends EventEmitter {
6530
7441
  threadId: meta.thread_id || undefined,
6531
7442
  messageId: meta.message_id || undefined,
6532
7443
  correlationId: meta.correlation_id || undefined,
7444
+ ...(ownedReplyTarget ?? {}),
6533
7445
  inboundMarker,
6534
7446
  deliveredText,
6535
7447
  deliveredAt,
6536
- }, this.pendingWork.lastInboundTimestamp());
7448
+ }, this.pendingWork.lastInboundTimestamp(), requestContext && ownedReplyTarget ? { binding: requestContext.token, target: ownedReplyTarget } : undefined);
7449
+ if (requestContext && verdict?.pendingReply) {
7450
+ const route = this.captureRequestContextReplyRoute(requestContext);
7451
+ if (route)
7452
+ verdict.pendingReply.arm(route);
7453
+ else
7454
+ verdict.pendingReply.refuse();
7455
+ }
6537
7456
  const armed = this.turnReplyGuard.snapshot();
6538
7457
  this.workingTurnDelivery = { generation: armed.generation, deliveryId: meta.delivery_id || null };
7458
+ this.workingTurnRequestContext = requestContext ? { generation: armed.generation, snapshot: requestContext } : null;
6539
7459
  this.publishWorkingState("turn_started");
6540
7460
  // #1209: persist the in-flight turn with a seam checkpoint. A marker
6541
7461
  // that survives a restart is an interrupted turn by construction —
@@ -6887,10 +7807,188 @@ export class Daemon extends EventEmitter {
6887
7807
  * This launch's transcript monitor. #1510: its turn boundaries feed the reply guard's ledger, which starts empty
6888
7808
  * with it — a new monitor re-baselines at the transcript's end, so nothing the old one read can be attributed.
6889
7809
  */
7810
+ /** M-3239: this launch's turn as its transcript tells it (dispatcher-liveness.ts). */
7811
+ turnWatch = new TurnWatch();
7812
+ turnActivitySentAt = 0;
7813
+ hubRoomInputEpoch = 0;
7814
+ hubRoomTranscriptActivity = 0;
7815
+ hubRoomTurnActivityStart = null;
7816
+ hubRoomTurnBoot = randomUUID();
7817
+ hubRoomTurnSequence = 0;
7818
+ turnEndTimer = null;
7819
+ /**
7820
+ * M-3660: the Hub question this pane is answering as a turn of its own — from just before its write until the idle edge
7821
+ * after that turn's work (or the next write into the idle pane). The fleet keeps the agent's contact window for exactly
7822
+ * this turn: hub_question_input opens it, hub_question_turn_ended closes it.
7823
+ */
7824
+ // It is kept on disk too (hub-answer-turn.json): a daemon restarted mid-turn takes it up again, so deliveries keep
7825
+ // waiting behind it and its end is still announced; the fleet is told the current state again on every (re)connect.
7826
+ hubAnswerTurnState;
7827
+ /** Prism #4420 P2-2: the turn record exists but cannot be read — a turn may be running; fail closed until an idle edge. */
7828
+ hubAnswerTurnUnknown = false;
7829
+ get hubAnswerTurn() {
7830
+ if (this.hubAnswerTurnState === undefined) {
7831
+ const file = this.hubAnswerTurnFile(), read = file ? readHubAnswerTurn(file) : null;
7832
+ this.hubAnswerTurnUnknown = read === "unknown";
7833
+ this.hubAnswerTurnState = read === "unknown" ? null : read;
7834
+ }
7835
+ return this.hubAnswerTurnState;
7836
+ }
7837
+ /** M-3660: a turn is running, or may be (an unreadable record): nothing is handed into it. */
7838
+ hubAnswerTurnMayRun() { return this.hubAnswerTurn !== null || this.hubAnswerTurnUnknown; }
7839
+ /** The unknown is resolved (an idle edge, a write into the idle pane): no turn runs; the fleet is told "none". */
7840
+ resolveUnknownHubAnswerTurn() {
7841
+ if (!this.hubAnswerTurnUnknown)
7842
+ return;
7843
+ this.hubAnswerTurnUnknown = false;
7844
+ const file = this.hubAnswerTurnFile();
7845
+ try {
7846
+ if (file)
7847
+ rmSync(file, { force: true });
7848
+ }
7849
+ catch (err) {
7850
+ this.logger.warn({ err }, "Unreadable Hub answer turn record could not be removed");
7851
+ }
7852
+ this.broadcastFleetMessage({ type: "hub_question_turn_state", correlationId: null });
7853
+ }
7854
+ hubAnswerTurnFile() { return typeof this.instanceDir === "string" ? join(this.instanceDir, "hub-answer-turn.json") : null; }
7855
+ /** A turn's end is always kept in memory; a record that cannot be removed is read as a restored turn later (fail closed). */
7856
+ setHubAnswerTurn(turn) {
7857
+ this.hubAnswerTurnState = turn;
7858
+ const file = this.hubAnswerTurnFile();
7859
+ if (!file)
7860
+ return;
7861
+ try {
7862
+ if (turn)
7863
+ atomicWriteFileSync(file, JSON.stringify({ correlationId: turn.correlationId, contactLimit: turn.contactLimit }), { mode: 0o600 });
7864
+ else
7865
+ rmSync(file, { force: true });
7866
+ }
7867
+ catch (err) {
7868
+ // Prism #4420 P2-2: a turn that cannot be recorded is not begun — its question is not written (the caller throws).
7869
+ if (turn) {
7870
+ this.hubAnswerTurnState = null;
7871
+ throw err;
7872
+ }
7873
+ 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");
7874
+ }
7875
+ }
7876
+ hubAnswerTurnBegins(correlationId, contactLimit = true) {
7877
+ if (correlationId !== undefined && this.hubAnswerTurn?.correlationId === correlationId)
7878
+ return; // a retried write
7879
+ this.resolveUnknownHubAnswerTurn(); // written into the idle pane: whatever might have run is over
7880
+ this.endHubAnswerTurn();
7881
+ if (correlationId === undefined)
7882
+ return;
7883
+ // Throws when the turn cannot be recorded: the question is then not written, and its delivery fails (reported).
7884
+ this.setHubAnswerTurn({ correlationId, contactLimit, sawWorking: false, restored: false, startedAt: Date.now() });
7885
+ this.broadcastFleetMessage({ type: "hub_question_input", correlationId, contactLimit });
7886
+ }
7887
+ /** Fresh current-source error or explicit cancel is turn evidence, but the next input still needs a proven idle pane. */
7888
+ noteHubAnswerFailure(at) {
7889
+ const turn = this.hubAnswerTurn;
7890
+ if (at !== undefined && (!Number.isFinite(at) || turn?.startedAt === undefined || at < turn.startedAt))
7891
+ return;
7892
+ if (turn) {
7893
+ turn.failed = true;
7894
+ turn.sawWorking = true;
7895
+ if (this.instanceState === "idle")
7896
+ this.noteTurnEdge("idle");
7897
+ }
7898
+ }
7899
+ endHubAnswerTurn() {
7900
+ const turn = this.hubAnswerTurn;
7901
+ if (!turn)
7902
+ return;
7903
+ this.setHubAnswerTurn(null);
7904
+ this.broadcastFleetMessage({ type: "hub_question_turn_ended", correlationId: turn.correlationId });
7905
+ }
7906
+ /**
7907
+ * 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
7908
+ * CLI (every launch but a native reattach) ends it, and an unreadable record resolves to "none", at once.
7909
+ */
7910
+ settleHubAnswerTurnAtLaunch(reattached) {
7911
+ if (reattached)
7912
+ return;
7913
+ if (this.hubAnswerTurn?.restored)
7914
+ this.endHubAnswerTurn();
7915
+ this.resolveUnknownHubAnswerTurn();
7916
+ }
7917
+ /** M-3660: the current Hub answer turn, told to a fleet connection when it (re)connects (a signal may have been lost). */
7918
+ hubAnswerTurnStateMessage() {
7919
+ const turn = this.hubAnswerTurn;
7920
+ if (!turn && this.hubAnswerTurnUnknown)
7921
+ return { type: "hub_question_turn_state", correlationId: null, unknown: true };
7922
+ return { type: "hub_question_turn_state", correlationId: turn?.correlationId ?? null, ...(turn ? { contactLimit: turn.contactLimit } : {}) };
7923
+ }
7924
+ /** M-3239: Claude's and Codex's transcripts tell each tool call and answer; their pane's spinner alone is not a turn. */
7925
+ turnEvidence() {
7926
+ const bin = this.backend?.binaryName;
7927
+ return (bin === "claude" || bin === "codex") && this.transcriptMonitor?.following() === true;
7928
+ }
7929
+ /** M-3239: progress for the board's quiet clock, at most every 30 s while a turn runs (the idle edge carries the last). */
7930
+ reportTurnActivity() {
7931
+ const now = Date.now();
7932
+ if (now - this.turnActivitySentAt < TURN_ACTIVITY_REPORT_MS)
7933
+ return;
7934
+ this.turnActivitySentAt = now;
7935
+ this.broadcastFleetMessage({ type: "turn_activity", instanceName: this.name, at: now });
7936
+ }
7937
+ /**
7938
+ * M-3239: on the pane's idle edge, after a moment for the transcript's last lines: the turn's final text, when it
7939
+ * messaged no one — the fleet tells the dispatcher of a claimed card if that text asks a question.
7940
+ */
7941
+ noteTurnEdge(state) {
7942
+ if (state !== "idle") {
7943
+ if (this.turnEndTimer) {
7944
+ clearTimeout(this.turnEndTimer);
7945
+ this.turnEndTimer = null;
7946
+ }
7947
+ if (state === "working") {
7948
+ this.turnWatch.begin(Date.now());
7949
+ this.hubRoomTurnActivityStart ??= this.hubRoomTranscriptActivity;
7950
+ {
7951
+ const hubTurn = this.hubAnswerTurn;
7952
+ if (hubTurn)
7953
+ hubTurn.sawWorking = true;
7954
+ }
7955
+ }
7956
+ return;
7957
+ }
7958
+ // 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).
7959
+ if (this.hubAnswerTurn?.restored)
7960
+ this.endHubAnswerTurn();
7961
+ if (this.turnEndTimer)
7962
+ return;
7963
+ const roomGeneration = this.roomConversationState ? this.roomConversationGeneration() : null, roomInputEpoch = this.hubRoomInputEpoch;
7964
+ this.turnEndTimer = setTimeout(() => {
7965
+ this.turnEndTimer = null; // a working edge before this cancels it: the turn went on
7966
+ const turn = this.turnWatch.end();
7967
+ // A Claude/Codex compaction spinner is not a completed model turn. Require fresh tool/text evidence.
7968
+ const bin = this.backend?.binaryName, needsTranscript = bin === "claude" || bin === "codex";
7969
+ const realWork = !needsTranscript || this.hubRoomTurnActivityStart !== null && this.hubRoomTranscriptActivity > this.hubRoomTurnActivityStart;
7970
+ this.hubRoomTurnActivityStart = null;
7971
+ // M-3660: the Hub answer turn ends only on real work (a compaction spinner is not its end: realWork needs a fresh
7972
+ // working edge AND transcript activity since it, so a flicker leaves the turn running until real work then idle) —
7973
+ // or, taken up again after a daemon restart, on the first idle edge.
7974
+ const hubTurn = this.hubAnswerTurn;
7975
+ if (hubTurn?.sawWorking && (realWork || hubTurn.restored || hubTurn.failed))
7976
+ this.endHubAnswerTurn();
7977
+ else if (!hubTurn)
7978
+ this.resolveUnknownHubAnswerTurn(); // an unreadable record: the pane is idle now, nothing runs
7979
+ if (turn && realWork && roomGeneration && roomGeneration === this.roomConversationGeneration() && roomInputEpoch === this.hubRoomInputEpoch)
7980
+ this.broadcastFleetMessage({ type: "hub_room_turn_ended", generation: roomGeneration, turn: `${this.hubRoomTurnBoot}:${++this.hubRoomTurnSequence}` });
7981
+ if (!turn || turn.messaged || !turn.text.trim() || !this.turnEvidence())
7982
+ return;
7983
+ this.broadcastFleetMessage({ type: "turn_ended", instanceName: this.name, startedAt: turn.startedAt, text: turn.text.slice(-4000) });
7984
+ }, TURN_END_SETTLE_MS);
7985
+ this.turnEndTimer.unref?.();
7986
+ }
6890
7987
  buildTranscriptMonitor(source) {
6891
7988
  this.followLog.reset();
7989
+ this.replyDraft.reset();
6892
7990
  const modelLaunch = this.backend?.modelObservationLaunch?.();
6893
- const monitor = new TranscriptMonitor(this.instanceDir, this.logger, source, () => modelLaunch);
7991
+ const monitor = new TranscriptMonitor(this.instanceDir, this.logger, source, () => modelLaunch, !!this.requestContextLifecycle);
6894
7992
  let savedModel;
6895
7993
  try {
6896
7994
  const path = join(this.instanceDir, "claude-model-observation.json");
@@ -6905,6 +8003,12 @@ export class Daemon extends EventEmitter {
6905
8003
  this.claudeModelObserver = modelObserver;
6906
8004
  this.modelObservationBound = false;
6907
8005
  const owner = launchIdentity(this.interactionOwner());
8006
+ const credentialLaunch = source || !this.isClaudeCodeBackend() ? null : this.backend?.credentialObservationLaunch?.();
8007
+ monitor.on("claude_request", (record, launchId) => {
8008
+ 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())
8009
+ return;
8010
+ this.emit("claude_credential_request", { binding: credentialLaunch.binding, record, owner: this.interactionOwner() });
8011
+ });
6908
8012
  let reminderSession = modelObserver?.checkpoint().sessionId ?? null;
6909
8013
  const observeReminderBoundary = (sessionId, before, after) => {
6910
8014
  const selected = (s) => normalizeClaudeModel(s.session ?? s.launch);
@@ -6940,6 +8044,23 @@ export class Daemon extends EventEmitter {
6940
8044
  if (changed)
6941
8045
  this.emit("model_observation");
6942
8046
  });
8047
+ monitor.on("reply_draft_record", (entry) => {
8048
+ if (this.transcriptMonitor === monitor && owner === launchIdentity(this.interactionOwner())) {
8049
+ const turn = this.turnReplyGuard?.snapshot();
8050
+ if (turn)
8051
+ this.replyDraft.observe(entry, turn.generation);
8052
+ else
8053
+ this.replyDraft.reset();
8054
+ }
8055
+ });
8056
+ for (const event of ["reset", "workspace_reset", "context_reset"])
8057
+ monitor.on(event, () => {
8058
+ if (this.transcriptMonitor === monitor) {
8059
+ this.replyDraft.reset();
8060
+ if (event !== "workspace_reset" && this.requestContextWrite)
8061
+ this.requestContextWrite.unknownEnd = "reset";
8062
+ }
8063
+ });
6943
8064
  this.transcriptTurns.reset();
6944
8065
  this.transcriptActivityAt = 0;
6945
8066
  // Monotonic: a wall-clock correction must neither end nor extend the open-turn hold (#1641 R1).
@@ -6947,6 +8068,9 @@ export class Daemon extends EventEmitter {
6947
8068
  monitor.on("turns", (turns) => {
6948
8069
  this.transcriptTurns.observe(turns, performance.now());
6949
8070
  touch();
8071
+ if (this.transcriptMonitor === monitor && owner === launchIdentity(this.interactionOwner())) {
8072
+ this.observeRequestContextTranscript(turns);
8073
+ }
6950
8074
  });
6951
8075
  // #3160: the files this turn reads, edits and searches, for the Files & changes panel's Follow (a few string checks;
6952
8076
  // nothing is read from disk until someone asks). Claude's turn boundary is its next prompt.
@@ -6969,6 +8093,25 @@ export class Daemon extends EventEmitter {
6969
8093
  });
6970
8094
  for (const event of ["tool_use", "tool_result", "assistant_text"])
6971
8095
  monitor.on(event, touch);
8096
+ monitor.on("api_error", (_text, _status, at) => { if (at !== null && this.transcriptMonitor === monitor && owner === launchIdentity(this.interactionOwner()))
8097
+ this.noteHubAnswerFailure(at); });
8098
+ // M-3239: the turn as the transcript tells it — progress for the board's quiet clock, and the question a turn ends on.
8099
+ const mine = () => this.transcriptMonitor === monitor;
8100
+ monitor.on("tool_use", (name, input) => { if (mine()) {
8101
+ this.hubRoomTranscriptActivity++;
8102
+ this.turnWatch.tool(name, input, Date.now());
8103
+ this.reportTurnActivity();
8104
+ } });
8105
+ monitor.on("tool_result", () => { if (mine()) {
8106
+ this.hubRoomTranscriptActivity++;
8107
+ this.turnWatch.result(Date.now());
8108
+ this.reportTurnActivity();
8109
+ } });
8110
+ monitor.on("assistant_text", (text) => { if (mine()) {
8111
+ this.hubRoomTranscriptActivity++;
8112
+ this.turnWatch.text(text, Date.now());
8113
+ this.reportTurnActivity();
8114
+ } });
6972
8115
  return monitor;
6973
8116
  }
6974
8117
  /**
@@ -7056,8 +8199,26 @@ export class Daemon extends EventEmitter {
7056
8199
  message: formatReplyDropDetection(turn, reason),
7057
8200
  });
7058
8201
  }
8202
+ _replyDraft;
8203
+ /** Also supports existing prototype-based lifecycle harnesses without constructor state. */
8204
+ get replyDraft() { return this._replyDraft ??= new ReplyDraft(); }
7059
8205
  queueReplyRecoveryPrompt(turn) {
7060
8206
  const deliveryEpoch = this.deliveryEpoch;
8207
+ const parent = this.workingTurnRequestContext?.generation === turn.generation ? this.workingTurnRequestContext.snapshot : null;
8208
+ const recoveryInputId = `reply-recovery:${this.bootId}:${turn.generation}:${deliveryEpoch}`;
8209
+ const registered = parent && this.requestContextLifecycle ? { root: parent.context.ref.rootContextId } : null;
8210
+ if (registered) {
8211
+ if (this.requestContextQueuedWork.has(recoveryInputId))
8212
+ return;
8213
+ try {
8214
+ this.requestContextQueuedWork.set(recoveryInputId, registered);
8215
+ }
8216
+ catch {
8217
+ this.turnReplyGuard.complete(turn.generation);
8218
+ this.reportUnrecoveredReplyDrop(turn, "recovery_prompt_delivery_failed");
8219
+ return;
8220
+ }
8221
+ }
7061
8222
  this.pasteQueueDepth++;
7062
8223
  this.pasteLock = this.pasteLock.then(async () => {
7063
8224
  try {
@@ -7073,8 +8234,16 @@ export class Daemon extends EventEmitter {
7073
8234
  });
7074
8235
  return;
7075
8236
  }
7076
- const delivered = await this.deliverMessage(REPLY_RECOVERY_PROMPT, undefined, {
8237
+ let prompt = REPLY_RECOVERY_PROMPT;
8238
+ try {
8239
+ prompt = this.replyDraft.recoveryPrompt(current, REPLY_RECOVERY_PROMPT);
8240
+ }
8241
+ catch { /* Draft evidence is best-effort; keep the existing generic recovery. */ }
8242
+ const recoveryText = parent && this.requestContextLifecycle ? `[agend-request-input:${recoveryInputId}]\n${prompt}` : prompt;
8243
+ const delivered = await this.deliverMessage(recoveryText, undefined, {
7077
8244
  deliveryEpoch,
8245
+ ...(parent ? { requestContextRecovery: { inputId: recoveryInputId, parent,
8246
+ current: () => !!this.currentReplyRecovery(turn.generation, deliveryEpoch) } } : {}),
7078
8247
  });
7079
8248
  if (!this.currentReplyRecovery(turn.generation, deliveryEpoch))
7080
8249
  return;
@@ -7092,7 +8261,8 @@ export class Daemon extends EventEmitter {
7092
8261
  return;
7093
8262
  this.turnReplyGuard.complete(turn.generation);
7094
8263
  this.reportUnrecoveredReplyDrop(turn, "recovery_prompt_delivery_failed");
7095
- });
8264
+ }).finally(() => { if (registered && this.requestContextQueuedWork.get(recoveryInputId) === registered)
8265
+ this.requestContextQueuedWork.delete(recoveryInputId); });
7096
8266
  }
7097
8267
  /** Recheck after queue waits and IO; cancellation must not become a failure notice. */
7098
8268
  currentReplyRecovery(generation, deliveryEpoch) {
@@ -7182,6 +8352,10 @@ export class Daemon extends EventEmitter {
7182
8352
  }
7183
8353
  /** Context-bound reply path shared by dead-MCP and malformed-call recovery. */
7184
8354
  deliverDaemonReply(body, requestPrefix, logLabel, target) {
8355
+ // System proxy text has no originating call lease. Until its final-output generation proof is
8356
+ // installed, it cannot borrow a live turn or lastChat; proven-parent model recovery uses C instead.
8357
+ if (this.requestContextLifecycle)
8358
+ return Promise.resolve(false);
7185
8359
  const args = { text: body };
7186
8360
  const chatId = target?.chatId ?? this.lastChatId;
7187
8361
  const threadId = target?.threadId ?? this.lastThreadId;
@@ -7398,7 +8572,7 @@ export class Daemon extends EventEmitter {
7398
8572
  // work cannot hide behind this: it changes the layout, the next
7399
8573
  // output arms another probe, and the debounce capture still fires.
7400
8574
  // #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
8575
+ if (this.instanceState === "idle" && this.executionIdleProof()?.(pane) === true
7402
8576
  && this.transcriptTurnState() !== "open")
7403
8577
  return;
7404
8578
  // A second burst overtook the probe. Do not bless its stale capture as
@@ -7435,7 +8609,7 @@ export class Daemon extends EventEmitter {
7435
8609
  // observe twice, which silently disabled the "content moved" branch.
7436
8610
  if (this.backend?.periodicRedrawFrom)
7437
8611
  this.periodicRedrawLayout = this.backend.periodicRedrawFrom(pane);
7438
- const structuredPeriodicIdle = this.periodicIdleProof();
8612
+ const structuredPeriodicIdle = this.executionIdleProof();
7439
8613
  // #1641: the transcript outranks the pane: while it shows the turn running, no reading of this pane is idle (codex
7440
8614
  // hides its status row while streaming, leaving the idle composer and footer in view mid-turn).
7441
8615
  const transcriptTurn = this.transcriptTurnState();
@@ -7665,6 +8839,13 @@ export class Daemon extends EventEmitter {
7665
8839
  return undefined;
7666
8840
  return proof;
7667
8841
  }
8842
+ /** Draft text can be execution-idle, but must not become empty-composer proof for delivery, pause or nudges. */
8843
+ executionIdleProof() {
8844
+ const empty = this.periodicIdleProof(), draft = this.backend?.isDraftIdlePane;
8845
+ if (!empty && !draft)
8846
+ return undefined;
8847
+ return pane => empty?.call(this.backend, pane) === true || draft?.call(this.backend, pane) === true;
8848
+ }
7668
8849
  bindInstanceStateOutputListener(windowId) {
7669
8850
  if (!this.controlClient || !this.instanceStateMonitorActive)
7670
8851
  return;
@@ -7770,6 +8951,7 @@ export class Daemon extends EventEmitter {
7770
8951
  this.cancelCapacityNudge("the instance was stopped, paused or respawned");
7771
8952
  this.runtimeMonitorsFrozen = true;
7772
8953
  this.launchFenceEpoch++;
8954
+ this.requestContextAdmission?.changed();
7773
8955
  this.interactionObservation.reset(this.interactionOwner());
7774
8956
  this.clearInteractionConfirmation();
7775
8957
  if (this.healthCheckTimer) {
@@ -8140,7 +9322,7 @@ export class Daemon extends EventEmitter {
8140
9322
  if (kind === "steer")
8141
9323
  wire = Daemon.steerEnvelope(wire);
8142
9324
  else if (kind === "btw")
8143
- wire = BTW_INBOUND_PREFIX + wire;
9325
+ wire = btwInboundEnvelope(wire, meta.delivery_id);
8144
9326
  return prepareDeliveryWire(wire, kind === "raw_paste");
8145
9327
  }
8146
9328
  humanReceiptAttempt(meta, wire) {
@@ -8198,10 +9380,22 @@ export class Daemon extends EventEmitter {
8198
9380
  if (meta.human_prepare_token)
8199
9381
  this.humanPreparations.delete(meta.human_prepare_token);
8200
9382
  this.humanReminderAttempts.delete(meta.human_receipt_id);
9383
+ const pending = this.requestContextHumanReplies?.get(meta.human_receipt_id);
9384
+ if (pending && !pending.accepted)
9385
+ pending.pending.refuse();
9386
+ this.requestContextHumanReplies?.delete(meta.human_receipt_id);
8201
9387
  }
8202
9388
  }
8203
9389
  /** Synchronous acknowledgement from the manager after the existing receipt owner/authority checks. */
8204
9390
  noteHumanReceiptSettlement(id, positive) {
9391
+ const pending = this.requestContextHumanReplies?.get(id);
9392
+ if (pending) {
9393
+ pending.accepted = positive;
9394
+ if (positive)
9395
+ pending.pending.confirm();
9396
+ else
9397
+ pending.pending.refuse();
9398
+ }
8205
9399
  const stamp = this.humanReminderAttempts?.get(id);
8206
9400
  if (!stamp || !positive || !this.humanReminders.current(stamp))
8207
9401
  return;
@@ -8235,7 +9429,7 @@ export class Daemon extends EventEmitter {
8235
9429
  // terminal state is announced by the outbox only after its retry/TTL policy
8236
9430
  // is exhausted; emitting ❌ here would expose a transient gate timeout.
8237
9431
  if (status && !verdict.durableAttempt)
8238
- this.emit("message_failed", status); // ❌
9432
+ this.emit("message_failed", { ...status, phase, proof }); // ❌
8239
9433
  return false;
8240
9434
  }
8241
9435
  /** Tell the fleet when an already-accepted cross-instance pane write failed. */
@@ -8318,7 +9512,7 @@ export class Daemon extends EventEmitter {
8318
9512
  })) {
8319
9513
  delivered = true;
8320
9514
  this.finishDurableSubmission(durableAttempt, verdict);
8321
- this.markTurnStarted(meta, formatted, deliveryEpoch);
9515
+ this.markTurnStarted(meta, formatted, deliveryEpoch, false, verdict);
8322
9516
  }
8323
9517
  else if (durableAttempt && verdict.paneWriteStarted) {
8324
9518
  this.finishDurableDelivery(durableAttempt, "uncertain", `${verdict.phase ?? "post-submit"}:${verdict.proof ?? "unproven"}`, verdict);
@@ -8372,37 +9566,75 @@ export class Daemon extends EventEmitter {
8372
9566
  this.updateLastChat(meta.chat_id, meta.thread_id, meta.adapter_id);
8373
9567
  this.pendingWork.recordInbound();
8374
9568
  this.recordRecentUserMessage(content, meta);
8375
- const formatted = BTW_INBOUND_PREFIX + this.formatInboundMessage(content, meta);
9569
+ const formatted = btwInboundEnvelope(this.formatInboundMessage(content, meta), meta.delivery_id);
8376
9570
  const status = channelStatus(meta);
9571
+ const durableAttempt = this.durableDeliveryAttempt(meta, content);
9572
+ if (durableAttempt === false) {
9573
+ this.deferDurableDelivery(meta, "invalid durable delivery attempt metadata");
9574
+ return;
9575
+ }
8377
9576
  this.steerLock = this.steerLock.then(async () => {
8378
9577
  if (!this.isDeliveryEpochCurrent(deliveryEpoch)) {
8379
- this.finishHumanReceipt(meta, { reached: false });
9578
+ this.deferDurableDelivery(meta, "delivery epoch changed before steer began");
8380
9579
  this.noteCancelledHuman(meta);
8381
9580
  return;
8382
9581
  }
8383
9582
  await this.wake();
8384
9583
  if (!this.isDeliveryEpochCurrent(deliveryEpoch)) {
8385
- this.finishHumanReceipt(meta, { reached: false });
9584
+ this.deferDurableDelivery(meta, "delivery epoch changed while waking for steer");
8386
9585
  this.noteCancelledHuman(meta);
8387
9586
  return;
8388
9587
  }
8389
9588
  const verdict = { reached: false, humanReceipt: this.humanReceiptAttempt(meta, formatted) };
8390
9589
  let delivered = false;
8391
9590
  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 })) {
9591
+ if (await this.deliverMessage(formatted, status, {
9592
+ steer: true,
9593
+ deliveryEpoch,
9594
+ submissionId: meta.message_id,
9595
+ ...(meta.verification_id ? { humanVerificationId: meta.verification_id, humanMeta: meta } : {}),
9596
+ verdict,
9597
+ durableAttempt: durableAttempt || undefined,
9598
+ })) {
8394
9599
  delivered = true;
8395
- this.markTurnStarted(meta, formatted, deliveryEpoch);
9600
+ this.finishDurableSubmission(durableAttempt, verdict);
9601
+ this.markTurnStarted(meta, formatted, deliveryEpoch, false, verdict);
9602
+ }
9603
+ else if (durableAttempt && verdict.paneWriteStarted) {
9604
+ this.finishDurableDelivery(durableAttempt, "uncertain", `${verdict.phase ?? "post-submit"}:${verdict.proof ?? "unproven"}`, verdict);
9605
+ }
9606
+ else if (durableAttempt && verdict.durableBeginCommitted) {
9607
+ this.abortDurableDelivery(durableAttempt, `${verdict.phase ?? "delivery"}:${verdict.proof ?? "no-pane-write"}`);
9608
+ }
9609
+ else if (durableAttempt) {
9610
+ this.retryDurableDeliveryBeforeBegin(durableAttempt, `${verdict.phase ?? "delivery"}:${verdict.proof ?? "deferred"}`);
9611
+ }
9612
+ else if (verdict.reached && this.isDeliveryEpochCurrent(deliveryEpoch)) {
9613
+ // Legacy non-outbox path retains its existing failure surface.
9614
+ this.reportCrossInstanceDeliveryFailure(meta, verdict);
8396
9615
  }
8397
9616
  }
9617
+ catch (err) {
9618
+ // The verdict goes along: a write that started and then threw is still a hand-off the CLI may consume (#1201).
9619
+ if (durableAttempt && verdict.paneWriteStarted)
9620
+ this.finishDurableDelivery(durableAttempt, "uncertain", err.message, verdict);
9621
+ else if (durableAttempt && verdict.durableBeginCommitted)
9622
+ this.abortDurableDelivery(durableAttempt, err.message);
9623
+ else if (durableAttempt)
9624
+ this.retryDurableDeliveryBeforeBegin(durableAttempt, err.message);
9625
+ throw err;
9626
+ }
8398
9627
  finally {
8399
9628
  this.finishHumanReceipt(meta, verdict);
8400
9629
  if (!delivered && !verdict.paneWriteStarted && !this.isDeliveryEpochCurrent(deliveryEpoch))
8401
9630
  this.noteCancelledHuman(meta);
8402
9631
  }
8403
9632
  }).catch(err => {
8404
- this.finishHumanReceipt(meta, { reached: false });
9633
+ this.deferDurableDelivery(meta, `target wake/side-question failed before pane submission: ${err.message}`);
8405
9634
  this.logger.warn({ err: err.message }, "btw delivery error");
9635
+ if (!durableAttempt && this.isDeliveryEpochCurrent(deliveryEpoch)) {
9636
+ this.reportCrossInstanceDeliveryFailure(meta, undefined, err.message);
9637
+ }
8406
9638
  });
8407
9639
  }
8408
9640
  /**
@@ -8410,7 +9642,9 @@ export class Daemon extends EventEmitter {
8410
9642
  * If targetSession is provided, only send to the matching socket.
8411
9643
  * Otherwise send to the instance's own session (this.name).
8412
9644
  */
8413
- pushChannelMessage(content, meta, _targetSession, deliveryEpoch = this.deliveryEpoch) {
9645
+ pushChannelMessage(content, meta, _targetSession, deliveryEpoch = this.deliveryEpoch, requestContextInputId) {
9646
+ if (requestContextInputId && !/^hub-input:[a-f0-9-]{36}$/.test(requestContextInputId))
9647
+ throw Error("Hub request input id is unavailable");
8414
9648
  if (!this.isDeliveryEpochCurrent(deliveryEpoch)) {
8415
9649
  this.logger.info("Pending channel delivery dropped by user cancel");
8416
9650
  this.deferDurableDelivery(meta, "delivery epoch changed before queue admission");
@@ -8498,7 +9732,10 @@ export class Daemon extends EventEmitter {
8498
9732
  // byte for byte (its proof is the wire's hash), so the notice waits for the next delivery without one.
8499
9733
  const whatsNew = this.pendingWhatsNew && !meta.human_receipt_id && !meta.handoff_redelivery
8500
9734
  ? this.currentWhatsNew(this.pendingWhatsNew) : null;
8501
- const pasted = whatsNew ? withWhatsNew(formatted, whatsNew.notice) : formatted;
9735
+ const body = whatsNew ? withWhatsNew(formatted, whatsNew.notice) : formatted;
9736
+ const roomMarker = roomContextInputMarker(meta);
9737
+ const unmarked = roomMarker ? `${roomMarker}\n${body}` : body;
9738
+ const pasted = requestContextInputId && !roomMarker ? `[agend-request-input:${requestContextInputId}]\n${unmarked}` : unmarked;
8502
9739
  const status = channelStatus(meta);
8503
9740
  // A fresh delivery begins a fresh turn — its bubble must not inherit
8504
9741
  // the previous turn's tool list.
@@ -8516,6 +9753,10 @@ export class Daemon extends EventEmitter {
8516
9753
  this.logger.info({ handoff: meta.handoff_redelivery }, "Queued hand-off redelivery dropped: its CLI was replaced before the write");
8517
9754
  return;
8518
9755
  }
9756
+ if (meta.hub_room_context_generation && meta.hub_room_context_generation !== this.roomConversationGeneration()) {
9757
+ this.reportCrossInstanceDeliveryFailure(meta, { reached: true, phase: "room-context", proof: "stale-generation" });
9758
+ return;
9759
+ }
8519
9760
  const durableAttempt = this.durableDeliveryAttempt(meta, content);
8520
9761
  if (durableAttempt === false) {
8521
9762
  this.deferDurableDelivery(meta, "invalid durable delivery attempt metadata");
@@ -8527,6 +9768,9 @@ export class Daemon extends EventEmitter {
8527
9768
  sent = await this.deliverMessage(pasted, status, {
8528
9769
  deliveryEpoch,
8529
9770
  submissionId: meta.message_id,
9771
+ ...(requestContextInputId ? { requestContextInputId } : {}),
9772
+ ...(isHubQuestionMeta(meta) ? { hubQuestion: meta.correlation_id, hubContactLimit: meta.hub_contact_limit !== "off" } : {}),
9773
+ ...(meta.hub_room_context_generation ? { roomContextGeneration: meta.hub_room_context_generation } : {}),
8530
9774
  ...(meta.verification_id ? { humanVerificationId: meta.verification_id, humanMeta: meta } : {}),
8531
9775
  verdict,
8532
9776
  durableAttempt: durableAttempt || undefined,
@@ -8542,7 +9786,7 @@ export class Daemon extends EventEmitter {
8542
9786
  if (sent) {
8543
9787
  delivered = true;
8544
9788
  this.finishDurableSubmission(durable, verdict);
8545
- this.markTurnStarted(meta, formatted, deliveryEpoch, !!verdict.handoff);
9789
+ this.markTurnStarted(meta, formatted, deliveryEpoch, !!verdict.handoff, verdict);
8546
9790
  }
8547
9791
  else if (durableAttempt && verdict.paneWriteStarted) {
8548
9792
  this.finishDurableDelivery(durable, "uncertain", `${verdict.phase ?? "post-submit"}:${verdict.proof ?? "unproven"}`, verdict);
@@ -8620,10 +9864,25 @@ export class Daemon extends EventEmitter {
8620
9864
  const verdict = opts?.verdict ?? { reached: false };
8621
9865
  if (opts?.durableAttempt)
8622
9866
  verdict.durableAttempt = true;
8623
- const cancelled = () => opts?.deliveryEpoch !== undefined
8624
- && !this.isDeliveryEpochCurrent(opts.deliveryEpoch);
9867
+ const cancelled = () => (opts?.deliveryEpoch !== undefined && !this.isDeliveryEpochCurrent(opts.deliveryEpoch))
9868
+ || (!!opts?.roomContextGeneration && opts.roomContextGeneration !== this.roomConversationGeneration());
8625
9869
  if (cancelled() || this.stormWindow?.isStopped())
8626
9870
  return false;
9871
+ const admittedReceiptId = opts?.humanMeta?.verification_id ?? opts?.humanVerificationId;
9872
+ const admittedInputId = opts?.requestContextInputId ?? (admittedReceiptId ? `human:${admittedReceiptId}` : opts?.durableAttempt ? `delivery:${opts.durableAttempt.deliveryId}:${opts.durableAttempt.attemptNo}` : null);
9873
+ // Captured once for this input, before waiting. An ended steer never turns into a fresh owner root.
9874
+ const continuation = this.requestContextLifecycle?.continuation?.(admittedInputId, opts?.requestContextRecovery);
9875
+ let heldOwner;
9876
+ const admissionCurrent = () => !cancelled() && !this.deliveryWritesStopping && !this.startupAborted
9877
+ && (heldOwner === undefined || heldOwner === JSON.stringify(this.interactionOwner()));
9878
+ const waitAdmission = async () => {
9879
+ const port = this.requestContextAdmission;
9880
+ if (!port.available(continuation))
9881
+ heldOwner ??= JSON.stringify(this.interactionOwner());
9882
+ return await port.wait(admissionCurrent, continuation) && admissionCurrent();
9883
+ };
9884
+ if (this.requestContextAdmission && !await waitAdmission())
9885
+ return false;
8627
9886
  formatted = prepareDeliveryWire(formatted, opts?.preserveExactBytes);
8628
9887
  // Direct paths such as /steer, /btw, /raw and schedules do not pass the
8629
9888
  // FleetManager idle gate. Hold them at the final common pane-write path so
@@ -8648,7 +9907,7 @@ export class Daemon extends EventEmitter {
8648
9907
  const settleFence = this.launchFenceEpoch;
8649
9908
  if (cancelled())
8650
9909
  return false;
8651
- if (this.refuseFatalStartupDelivery(verdict, status))
9910
+ if (this.refuseBlockedDelivery(verdict, status))
8652
9911
  return false;
8653
9912
  let windowId = this.getWindowId();
8654
9913
  const supportsQueuedInput = this.backend?.supportsQueuedInput?.() === true;
@@ -8659,7 +9918,10 @@ export class Daemon extends EventEmitter {
8659
9918
  // normal Enter input has steering/interrupt semantics in several other CLIs.
8660
9919
  let readiness = "ready";
8661
9920
  const gateWindowId = windowId;
8662
- const handOffEligible = !!(supportsQueuedInput || opts?.steer || composerQueue);
9921
+ // M-3660: a Hub question is never handed into a running turn (Claude would merge it into that turn's work), and while
9922
+ // a Hub answer turn runs, nothing else is handed into it: each waits for the idle pane and becomes a turn of its own.
9923
+ const exclusiveTurn = opts?.hubQuestion !== undefined || this.hubAnswerTurnMayRun();
9924
+ const handOffEligible = !exclusiveTurn && (!this.requestContextLifecycle || opts?.steer === true) && !!(supportsQueuedInput || opts?.steer || composerQueue);
8663
9925
  const handOffAdmissible = async () => (await this.probeBlockingDialog()).state === "clear"
8664
9926
  && await this.hasPositiveDeliveryInput(true)
8665
9927
  && ((!opts?.steer && !composerQueue) || (this.launchTakesSteer() && await this.steerComposerAdmits(false, opts?.steer === true)));
@@ -8731,29 +9993,50 @@ export class Daemon extends EventEmitter {
8731
9993
  // must come back AND the check runs again — the stranded text may still
8732
9994
  // be there. "failed" (the Enter could not be sent) fails the delivery:
8733
9995
  // 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");
9996
+ const inputDeadline = Date.now() + 30 * 60_000;
9997
+ let submissions = 0;
9998
+ let unavailableProbes = 0;
9999
+ for (;;) {
10000
+ if (cancelled())
10001
+ return false;
10002
+ if (Date.now() >= inputDeadline) {
10003
+ this.logger.error("Input row stayed unavailable until the delivery deadline");
10004
+ return this.failDelivery(verdict, status, "stranded-input", "input-not-clear-timeout");
8740
10005
  }
8741
- const stranded = await this.submitStrandedInputIfAny(windowId);
10006
+ // Only actual recovery Enters spend the submission budget. A live pane's
10007
+ // unreadable/changing composer may need time, not three synchronous probes.
10008
+ const stranded = await this.submitStrandedInputIfAny(windowId, submissions < STRANDED_INPUT_MAX_ROUNDS);
8742
10009
  if (cancelled())
8743
10010
  return false;
8744
10011
  if (stranded === "idle")
8745
10012
  break;
10013
+ if (stranded === "exhausted") {
10014
+ this.logger.error({ submissions }, "Input row still not clear after the stranded-text recovery budget — reporting delivery failure");
10015
+ return this.failDelivery(verdict, status, "stranded-input", "retry-budget-exhausted");
10016
+ }
8746
10017
  if (stranded === "failed") {
8747
- this.logger.error({ round }, "Could not submit the stranded text — reporting delivery failure");
10018
+ this.logger.error({ submissions }, "Could not submit the stranded text — reporting delivery failure");
8748
10019
  return this.failDelivery(verdict, status, "stranded-input", "enter-failed");
8749
10020
  }
8750
- const readyAgain = await this.waitForPaneReadyForDelivery(windowId);
10021
+ if (stranded === "submitted")
10022
+ submissions++;
10023
+ // Only the proven empty unknown-footer candidate needs the timed
10024
+ // fallback. Preserve the existing bounded refusal for other unsafe
10025
+ // input (including a stranded draft whose footer cannot be proved).
10026
+ if (stranded === "busy" && this.footerFallbackPaneKey === null && ++unavailableProbes >= STRANDED_INPUT_MAX_ROUNDS) {
10027
+ return this.failDelivery(verdict, status, "stranded-input", "input-not-clear");
10028
+ }
10029
+ const readyAgain = await this.waitForPaneReadyForDelivery(windowId, inputDeadline - Date.now());
8751
10030
  if (cancelled())
8752
10031
  return false;
8753
10032
  if (!readyAgain) {
8754
- this.logger.error("Pane never returned to its prompt after submitting stranded input — reporting delivery failure");
10033
+ this.logger.error("Pane never returned to its prompt after checking stranded input — reporting delivery failure");
8755
10034
  return this.failDelivery(verdict, status, "stranded-input", "prompt-timeout");
8756
10035
  }
10036
+ // After startup, the general idle gate can pass while the stricter input
10037
+ // proof is still collecting a stable composer. Yield before re-reading it.
10038
+ if (stranded === "busy")
10039
+ await new Promise(resolve => setTimeout(resolve, BOTTOM_READY_POLL_MS));
8757
10040
  }
8758
10041
  }
8759
10042
  // Everything above is *waiting*; everything below owns the write lock.
@@ -8764,6 +10047,8 @@ export class Daemon extends EventEmitter {
8764
10047
  const outcome = await this.paneWriteLock.run(async () => {
8765
10048
  if (cancelled())
8766
10049
  return false;
10050
+ if (this.requestContextAdmission && !this.requestContextAdmission.available(continuation) && !verdict.paneWriteStarted && !verdict.durableBeginCommitted)
10051
+ return "request-context-held";
8767
10052
  // A spawn that started after the settle wait above invalidates the
8768
10053
  // window id and every readiness verdict since: the pane about to be
8769
10054
  // written may already belong to a replacement process. The same holds
@@ -8773,7 +10058,7 @@ export class Daemon extends EventEmitter {
8773
10058
  // delivery from the top, where the settle wait runs again outside it.
8774
10059
  if (!settledClean || settleGeneration !== this.spawnGeneration || this.spawning)
8775
10060
  return "spawn-started";
8776
- if (this.refuseFatalStartupDelivery(verdict, status))
10061
+ if (this.refuseBlockedDelivery(verdict, status))
8777
10062
  return false;
8778
10063
  // A passive startup phase may paint after the outer readiness probe.
8779
10064
  // It clears without input, so waiting under the pane lock cannot starve
@@ -8807,18 +10092,47 @@ export class Daemon extends EventEmitter {
8807
10092
  // same process, a pause/stop/respawn is not (launchFenceEpoch moves even
8808
10093
  // when a failed pause resumes the monitors).
8809
10094
  const writeCurrent = () => !cancelled()
10095
+ && (!this.requestContextAdmission || admissionCurrent() && (this.requestContextAdmission.available(continuation) || !!verdict.paneWriteStarted || !!verdict.durableBeginCommitted))
10096
+ && !this.staleAuthIssue()
8810
10097
  && !this.deliveryWritesStopping
8811
10098
  && !this.runtimeMonitorsFrozen
8812
10099
  && !this.spawning
8813
10100
  && settleGeneration === this.spawnGeneration
8814
10101
  && settleFence === this.launchFenceEpoch;
8815
- const stale = () => (this.spawning || settleGeneration !== this.spawnGeneration ? "spawn-started" : false);
10102
+ const stale = () => this.requestContextAdmission && !this.requestContextAdmission.available(continuation) && !verdict.paneWriteStarted && !verdict.durableBeginCommitted
10103
+ ? "request-context-held" : this.spawning || settleGeneration !== this.spawnGeneration ? "spawn-started" : false;
8816
10104
  const residue = await this.clearRestoredInputDraft(handingOffToNativeQueue, writeCurrent);
8817
10105
  if (residue === "stale")
8818
10106
  return stale();
8819
10107
  if (residue !== "clear")
8820
10108
  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);
10109
+ let newlyBound = null;
10110
+ const written = await this.writeMessageToPane(formatted, windowId, handingOffToNativeQueue, status, opts?.submissionId, verdict, opts?.durableAttempt, opts?.steer === true, writeCurrent, opts?.humanVerificationId,
10111
+ // M-3660: written into an idle pane, so whatever Hub answer turn ran is over; a Hub question begins its own.
10112
+ (wireText) => {
10113
+ const receiptId = opts?.humanMeta?.verification_id ?? opts?.humanVerificationId;
10114
+ const inputId = opts?.requestContextInputId ?? (receiptId ? `human:${receiptId}` : opts?.durableAttempt
10115
+ ? `delivery:${opts.durableAttempt.deliveryId}:${opts.durableAttempt.attemptNo}` : null);
10116
+ const prior = this.requestContextTurnSnapshot();
10117
+ this.bindRequestContextWrite(inputId, wireText, handingOffToNativeQueue, opts?.requestContextRecovery);
10118
+ const after = this.requestContextTurnSnapshot();
10119
+ if (after && after !== prior)
10120
+ newlyBound = after;
10121
+ if (after && inputId && (/^human:hmsg-/.test(inputId) || /^delivery:/.test(inputId))) {
10122
+ verdict.pendingReply = this.requestContextPendingReplies.stage(after, inputId, deliveryContentDigest(wireText), () => this.requestContextTurnCurrent(after));
10123
+ const humanId = opts?.humanMeta?.human_receipt_id;
10124
+ if (humanId && verdict.pendingReply)
10125
+ this.requestContextHumanReplies.set(humanId, { pending: verdict.pendingReply, accepted: false });
10126
+ }
10127
+ if (!handingOffToNativeQueue)
10128
+ this.hubAnswerTurnBegins(opts?.hubQuestion, opts?.hubContactLimit !== false);
10129
+ opts?.beforePaneWrite?.();
10130
+ }, opts?.lookBeforePaneWrite, opts?.humanMeta);
10131
+ if (written === false && newlyBound && this.nativePaneLifecycle?.lastInputWasNotSent?.()) {
10132
+ const owner = this.requestContextOwner();
10133
+ if (owner && this.requestContextLifecycle.turns.ended(newlyBound, owner))
10134
+ this.requestContextWrite = undefined;
10135
+ }
8822
10136
  // #1690: still under the lock — whatever waits on it next must already see what this write started.
8823
10137
  if (verdict.paneWriteStarted)
8824
10138
  opts?.onPaneWritten?.();
@@ -8828,9 +10142,18 @@ export class Daemon extends EventEmitter {
8828
10142
  // M-2267: the pane is in a tmux mode: nothing written — wait for readiness (it holds while the mode lasts), retry.
8829
10143
  if (written === "pane-in-mode")
8830
10144
  return "dialog";
10145
+ // A publication fence before input keeps this attempt at its producer; never turn the wait into failure.
10146
+ if (written === false && this.requestContextAdmission && !this.requestContextAdmission.available(continuation) && !verdict.paneWriteStarted && !verdict.durableBeginCommitted)
10147
+ return "request-context-held";
8831
10148
  // Fenced before its first write: not attempted — redo after a spawn, else drop without a ❌.
8832
10149
  return written === false && verdict.fenced ? stale() : written;
8833
10150
  });
10151
+ if (outcome === "request-context-held") {
10152
+ if (!this.requestContextAdmission || !await waitAdmission())
10153
+ return false;
10154
+ round--;
10155
+ continue; // Waiting on admission consumes neither a dialog retry nor any input intent.
10156
+ }
8834
10157
  if (outcome === "spawn-started") {
8835
10158
  // The pane changed under this delivery: its queued paste must not land
8836
10159
  // in the replacement process's first screen. Redo the whole delivery
@@ -9666,7 +10989,7 @@ export class Daemon extends EventEmitter {
9666
10989
  locked: fn => this.paneWriteLock.run(fn),
9667
10990
  // An unreadable screen (a failed capture, another spawn's pane) is unknown — never "the card closed".
9668
10991
  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)),
10992
+ 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
10993
  paste: text => this.tmux !== tmux || answerScreen === null ? Promise.resolve(false) : this.nativePaneLifecycle ? tmux.pasteBuffer(text, { proof: { kind: "dialog", screen: answerScreen } }) : tmux.pasteBuffer(text),
9671
10994
  sleep: ms => new Promise(resolve => setTimeout(resolve, ms)),
9672
10995
  now: () => performance.now(),
@@ -10041,6 +11364,10 @@ export class Daemon extends EventEmitter {
10041
11364
  * pane proves nothing. The silence gate comes first and costs no capture.
10042
11365
  */
10043
11366
  async paneReadinessForDelivery(windowId) {
11367
+ if (this.staleAuthIssue()) {
11368
+ this.resetFooterFallback();
11369
+ return "dialog";
11370
+ }
10044
11371
  // Each early return below is the pane seen outside the footer-fallback
10045
11372
  // candidate state, and never reaches deliveryInputReadyPane: reset here.
10046
11373
  if (!this.isPaneIdleForDelivery(windowId)) {
@@ -10313,7 +11640,7 @@ export class Daemon extends EventEmitter {
10313
11640
  this.logger.error({ rows: rows.length }, "The input box did not empty — not writing this delivery onto it");
10314
11641
  return "not-cleared";
10315
11642
  }
10316
- async submitStrandedInputIfAny(windowId) {
11643
+ async submitStrandedInputIfAny(windowId, allowSubmit = true) {
10317
11644
  if (!this.tmux || !this.backend)
10318
11645
  return "idle";
10319
11646
  const prompt = this.backend.getBottomReadyPattern?.();
@@ -10344,6 +11671,8 @@ export class Daemon extends EventEmitter {
10344
11671
  return "idle";
10345
11672
  if (state !== "stranded")
10346
11673
  return "busy"; // busy, or unreadable: no evidence the prompt is free
11674
+ if (!allowSubmit)
11675
+ return "exhausted"; // a final clear check is allowed, a fourth recovery Enter is not
10347
11676
  const sent = await this.sendDeliveryEnter("stranded-input-submit");
10348
11677
  return sent ? "submitted" : "failed";
10349
11678
  });
@@ -10366,10 +11695,24 @@ export class Daemon extends EventEmitter {
10366
11695
  return "busy";
10367
11696
  if (this.backend?.getBusyPattern?.()?.test(pane))
10368
11697
  return "busy";
11698
+ // The timed footer fallback is valid only in a live raw TUI, even
11699
+ // after the startup guard has retired. Historical shell scrollback is not
11700
+ // evidence that a composer still owns the terminal.
11701
+ const known = this.backend?.isDeliveryInputReadyPane?.(pane);
11702
+ if (known === false && this.backend?.isStableUnknownLayoutIdlePane?.(pane)) {
11703
+ if (this.nativePaneLifecycle || await this.tmux?.getPaneInputMode?.() !== "raw") {
11704
+ this.resetFooterFallback();
11705
+ return "busy";
11706
+ }
11707
+ }
10369
11708
  if (!this.deliveryInputReadyPane(pane))
10370
11709
  return "busy";
10371
- if (strandedAgendMessageInInput(pane, prompt))
11710
+ if (strandedAgendMessageInInput(pane, prompt)) {
11711
+ // A cancelled human turn can restore its text here. Idle observation must not let a later delivery submit it.
11712
+ if (this.backend?.binaryName === "codex" && /\[user:/.test(inputAreaText(pane, prompt) ?? ""))
11713
+ return "busy";
10372
11714
  return "stranded";
11715
+ }
10373
11716
  // Kiro uses the bottom row; Codex's positive prompt/footer check above
10374
11717
  // rules out a historical transcript echo or a transition/modal screen.
10375
11718
  return !requireBottomReady || bottomRowIsReady(pane, prompt) ? "clear" : "busy";
@@ -10561,6 +11904,7 @@ export class Daemon extends EventEmitter {
10561
11904
  }
10562
11905
  }
10563
11906
  /**
11907
+ * A stale process login refuses delivery before any write; durable attempts stay retryable.
10564
11908
  * While the CLI is parked on a fatal startup screen (see fatalStartupBlocked),
10565
11909
  * no pane write may happen: paste+Enter into the corrupt-config modal would
10566
11910
  * confirm "Exit and fix manually" and exit the CLI. The message is failed (❌)
@@ -10568,7 +11912,11 @@ export class Daemon extends EventEmitter {
10568
11912
  * what to fix, and holding would only build a queue that floods the pane the
10569
11913
  * moment the flag clears.
10570
11914
  */
10571
- refuseFatalStartupDelivery(verdict, status) {
11915
+ refuseBlockedDelivery(verdict, status) {
11916
+ if (this.staleAuthIssue()) {
11917
+ this.failDelivery(verdict, status, "pre-write", "stale-auth");
11918
+ return true;
11919
+ }
10572
11920
  if (!this.fatalStartupBlocked && !this.modelMinimumBlocked)
10573
11921
  return false;
10574
11922
  this.logger.error("Delivery refused — CLI startup or model-version repair is held");
@@ -10926,6 +12274,8 @@ export class Daemon extends EventEmitter {
10926
12274
  catch {
10927
12275
  return hold("check_failed");
10928
12276
  }
12277
+ if (this.codexInputOccupied(screen))
12278
+ return hold("input_occupied");
10929
12279
  if (!current())
10930
12280
  return false;
10931
12281
  if (performance.now() >= deadline)
@@ -10984,12 +12334,27 @@ export class Daemon extends EventEmitter {
10984
12334
  signature.takenMarker = leadMarker;
10985
12335
  const rawPaste = durableAttempt?.submissionMode === "raw_paste";
10986
12336
  const humanAttempt = verdict.humanReceipt;
12337
+ verdict.roomInputQueued = handingOffToNativeQueue || steer;
10987
12338
  const humanMode = rawPaste ? "raw_paste" : steer ? "steer"
10988
12339
  : handingOffToNativeQueue ? "native_queue_handoff" : "idle_submit";
10989
- if (humanAttempt && signature.unique && signature.value === humanReceiptMarker(humanAttempt.verificationId, humanDialect).slice(1, -1)
12340
+ // Retained controls lead with the delivery marker for strict transcript/restart proof. That marker is
12341
+ // usable for a human receipt only through the outbox's exact control/receipt/owner/wire join, never text lookup.
12342
+ const controlMarker = durableAttempt ? `[agend-delivery-id:${durableAttempt.deliveryId}]` : null;
12343
+ const ownsControlReceipt = () => !!humanAttempt && !!durableAttempt && !rawPaste
12344
+ && this.deliveryOutbox?.ownsHumanControlReceipt?.(durableAttempt.deliveryId, this.bootId, durableAttempt.attemptNo, humanAttempt.receiptId, humanAttempt.ownerKey, humanAttempt.expectedWireHash) === true;
12345
+ const controlAlias = !!controlMarker && !!humanAttempt
12346
+ && [`${controlMarker}\n${humanAttempt.marker}\n`,
12347
+ Daemon.steerEnvelope(`${controlMarker}\n${humanAttempt.marker}\n`),
12348
+ btwInboundEnvelope(`${controlMarker}\n${humanAttempt.marker}\n`, durableAttempt.deliveryId)].some(prefix => formatted.startsWith(prefix))
12349
+ && ownsControlReceipt();
12350
+ if (controlAlias) {
12351
+ signature.value = controlMarker.slice(1, -1);
12352
+ signature.takenMarker = controlMarker;
12353
+ }
12354
+ if (humanAttempt && signature.unique && (controlAlias || signature.value === humanReceiptMarker(humanAttempt.verificationId, humanDialect).slice(1, -1))
10990
12355
  && humanBodyHash(formatted) === humanAttempt.expectedWireHash) {
10991
12356
  signature.humanPositive = tag => {
10992
- if (!humanAttempt.current() || (stillCurrent && !stillCurrent()))
12357
+ if (!humanAttempt.current() || (stillCurrent && !stillCurrent()) || controlAlias && !ownsControlReceipt())
10993
12358
  return;
10994
12359
  humanAttempt.proof = {
10995
12360
  receipt_id: humanAttempt.receiptId, verification_id: humanAttempt.verificationId,
@@ -11024,6 +12389,8 @@ export class Daemon extends EventEmitter {
11024
12389
  verdict.fenced = !verdict.durableBeginCommitted;
11025
12390
  return false;
11026
12391
  }
12392
+ if (pasteBaseline?.unsubmittedAgendInput)
12393
+ return this.failDelivery(verdict, status, "input-residue", "occupied-codex-composer");
11027
12394
  // M-2267: the pane went into a tmux mode after the readiness wait. Nothing begun or written: the caller waits for
11028
12395
  // readiness (which holds while it lasts) and tries again — as for a dialog that appeared before the write.
11029
12396
  if (!verdict.durableBeginCommitted && await this.paneInTmuxMode("paste"))
@@ -11172,7 +12539,7 @@ export class Daemon extends EventEmitter {
11172
12539
  return this.failDelivery(verdict, status, "paste", "pane-in-tmux-mode");
11173
12540
  }
11174
12541
  const pasteGeneration = this.spawnGeneration;
11175
- beforePaste?.();
12542
+ beforePaste?.(formatted);
11176
12543
  const pasted = await this.sendDeliveryPaste(formatted, nativeOwner);
11177
12544
  if (!pasted && this.nativePaneLifecycle) {
11178
12545
  // The native write attempt is retained as uncertain, including exhausted positive refusals. Never route an
@@ -11260,7 +12627,7 @@ export class Daemon extends EventEmitter {
11260
12627
  if (!this.steerPasteIsOurs(before.pane, formatted))
11261
12628
  return this.failDelivery(verdict, status, "steer-paste", "box-not-this-paste");
11262
12629
  const shown = this.backend?.readSteerComposerText?.(before.pane)?.replace(/\s+/g, " ").trim();
11263
- humanComposerOwned = !!humanAttempt && shown === (humanAttempt.marker ?? "[agend-human-id:" + humanAttempt.verificationId + "]");
12630
+ humanComposerOwned = !!humanAttempt && shown === (controlAlias ? controlMarker : humanAttempt.marker ?? "[agend-human-id:" + humanAttempt.verificationId + "]");
11264
12631
  // …and so is the Enter: the key is sent only while the reading is still within it.
11265
12632
  steerEnterDeadline = deadline;
11266
12633
  }
@@ -11349,6 +12716,7 @@ export class Daemon extends EventEmitter {
11349
12716
  : after === "queue" ? "composer-empty-queue" : "composer-empty-idle");
11350
12717
  verdict.phase = steer ? "steer-accepted" : "composer-accepted";
11351
12718
  verdict.proof = `${steer ? "steer" : "handoff"}-composer-${after}`;
12719
+ verdict.roomInputQueued = after === "queue";
11352
12720
  if (status)
11353
12721
  this.emit("message_confirmed", status); // ✅ taken from the box
11354
12722
  return true;
@@ -11424,6 +12792,7 @@ export class Daemon extends EventEmitter {
11424
12792
  if (verdict.handoff && !verdict.trackHandoff?.id)
11425
12793
  this.dropQueuedHandoff(verdict);
11426
12794
  verdict.handoff = undefined;
12795
+ verdict.roomInputQueued = false;
11427
12796
  if (windowId && this.controlClient && !(await this.controlClient.waitUntilIdle(windowId))) {
11428
12797
  verdict.phase = "native-queue-idle-wait";
11429
12798
  verdict.proof = "idle-wait-failed";
@@ -12030,6 +13399,7 @@ export class Daemon extends EventEmitter {
12030
13399
  // Grok cuts an echo to three rows, so the trailing message_id never shows after Enter; the marker always does.
12031
13400
  // Placed after the strand checks: text of ours still in the box (or its collapsed paste) outranks it.
12032
13401
  if (signature.takenMarker && after.inputReadable && this.backend?.readTakenMarkers?.(pane).includes(signature.takenMarker)) {
13402
+ signature.humanPositive?.("unique-id-pane");
12033
13403
  return this.submittedProof();
12034
13404
  }
12035
13405
  // 2. Positive evidence. A unique signature needs no baseline: no earlier
@@ -12101,6 +13471,11 @@ export class Daemon extends EventEmitter {
12101
13471
  * paste and once after, so confirmSubmitted can require a NEW marker or a NEW
12102
13472
  * echo rather than accepting whatever was already there.
12103
13473
  */
13474
+ codexInputOccupied(pane) {
13475
+ const backend = this.backend, prompt = backend?.getBottomReadyPattern?.();
13476
+ return backend?.binaryName === "codex" && backend.ownsComposerRows?.(pane) === true && !!prompt
13477
+ && strandedAgendMessageInInput(pane, prompt);
13478
+ }
12104
13479
  async capturePaneEvidence(signature) {
12105
13480
  if (!this.tmux)
12106
13481
  return null;
@@ -12111,6 +13486,8 @@ export class Daemon extends EventEmitter {
12111
13486
  try {
12112
13487
  const pane = await this.tmux.capturePane();
12113
13488
  const evidence = this.paneEvidence(pane, signature);
13489
+ if (this.codexInputOccupied(pane))
13490
+ evidence.unsubmittedAgendInput = true;
12114
13491
  if (owner === this.tmux && window === owner.getWindowId?.() && spawn === this.spawnGeneration && fence === this.launchFenceEpoch && launch === this.launchAttempt) {
12115
13492
  const counts = this.paneQuotaPatterns().map(ep => ({ key: Daemon.errorPatternKey(ep), count: Daemon.countOccurrences(ep.pattern, pane) }));
12116
13493
  if (counts.length)
@@ -12118,10 +13495,7 @@ export class Daemon extends EventEmitter {
12118
13495
  }
12119
13496
  const input = this.inputRegion(pane);
12120
13497
  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");
13498
+ this.logger.warn("An unsubmitted message is already in the input row");
12125
13499
  }
12126
13500
  return evidence;
12127
13501
  }
@@ -12459,11 +13833,17 @@ export class Daemon extends EventEmitter {
12459
13833
  const current = () => lease.current() && lease.allowed(input.tool, input.args) && !this.deliveryWritesStopping && fence === this.launchFenceEpoch;
12460
13834
  return new Promise(resolve => {
12461
13835
  let settled = false;
13836
+ let call;
12462
13837
  const finish = (value) => { if (settled)
12463
- return; settled = true; clearTimeout(timer); resolve(value); };
13838
+ return; settled = true; if (call)
13839
+ this.requestContextCalls.delete(call.id); clearTimeout(timer); resolve(value); };
12464
13840
  const timer = setTimeout(() => finish({ result: null, error: "Pane tool result is unconfirmed; inspect its operation before retrying" }), daemonBudgetMs(input.tool) + 1000);
12465
13841
  timer.unref?.();
12466
13842
  try {
13843
+ const reply = lease.requestContext ? this.requestContextCapturedReply(lease.requestContext) : undefined;
13844
+ call = lease.requestContext ? Object.freeze({ id: randomUUID(), admission: lease.requestContext, get replyRoute() { return reply?.route(); }, waitForReplyRoute: reply?.wait, current: () => current() && (!reply || reply.current()) }) : undefined;
13845
+ if (call)
13846
+ this.requestContextCalls.set(call.id, call);
12467
13847
  this.handleToolCall({ ...input, requestId: ++this.fleetRequestSeq }, undefined, {
12468
13848
  current,
12469
13849
  dispatch: (tool, args, respond) => {
@@ -12483,7 +13863,7 @@ export class Daemon extends EventEmitter {
12483
13863
  ...(typeof value.errorCode === "string" || typeof value.errorCode === "number" ? { errorCode: value.errorCode } : {}) });
12484
13864
  return false;
12485
13865
  },
12486
- });
13866
+ }, call);
12487
13867
  }
12488
13868
  catch {
12489
13869
  finish({ result: null, error: "Pane tool operation failed" });
@@ -12496,7 +13876,26 @@ export class Daemon extends EventEmitter {
12496
13876
  return;
12497
13877
  this.emit("mcp_tool_response_written", { operationId, daemonBootId: this.bootId });
12498
13878
  }
12499
- handleToolCall(msg, socket, peer) {
13879
+ handleToolCall(msg, socket, peer, originatingCall) {
13880
+ const finish = this.requestContextPendingWork?.begin(this.name);
13881
+ const dispatch = () => Daemon.prototype.handleTrackedToolCall.call(this, msg, socket, peer, originatingCall, finish);
13882
+ const expanded = originatingCall?.waitForReplyRoute ? expandReplyWaitCall(String(msg.tool), (msg.args ?? {})) : null;
13883
+ if (originatingCall?.waitForReplyRoute && expanded && !("error" in expanded) && ["reply", "edit_message", "react"].includes(expanded.name)) {
13884
+ // Submission proof progresses independently. No policy, adapter effect or
13885
+ // Fleet forward runs before this original call's delivery and arm settle.
13886
+ void originatingCall.waitForReplyRoute(daemonBudgetMs(expanded.name)).then(dispatch, dispatch).catch(() => finish?.());
13887
+ return;
13888
+ }
13889
+ try {
13890
+ dispatch();
13891
+ }
13892
+ catch (error) {
13893
+ finish?.();
13894
+ throw error;
13895
+ }
13896
+ }
13897
+ handleTrackedToolCall(msg, socket, peer, originatingCall, finish) {
13898
+ const runLocal = (work) => this.requestContextPendingWork ? this.requestContextPendingWork.run(this.name, work) : work();
12500
13899
  const tool = msg.tool;
12501
13900
  const args = (msg.args ?? {});
12502
13901
  const requestId = msg.requestId;
@@ -12518,68 +13917,108 @@ export class Daemon extends EventEmitter {
12518
13917
  : null;
12519
13918
  // For now, log and respond. Full adapter routing will be wired in fleet manager.
12520
13919
  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();
13920
+ try {
13921
+ if (originatingCall && !originatingCall.current()) {
13922
+ result = null;
13923
+ error = `Tool outcome is unconfirmed. ${operationId ? `Inspect operation ${operationId}` : "Inspect the tool operation status"}; do not repeat it.`;
13924
+ }
13925
+ if (originatingCall)
13926
+ this.requestContextCalls.delete(originatingCall.id);
13927
+ // A message that verifiably went out stands down the dead-MCP proxy reply
13928
+ // for this turn: the agent proved it can still speak for itself.
13929
+ if (!error && result != null && TURN_OUTBOUND_TOOLS.has(tool)) {
13930
+ this.turnReplyGuard.settleToolAttempt(replyAttempt, true);
13931
+ // #1209 P2: the user got an answer — the turn is over for resume
13932
+ // purposes even before the idle edge completes the guard. Without
13933
+ // this, a restart in the reply-to-idle window would re-inject a
13934
+ // continuation for an already-answered turn.
13935
+ if (replyAttempt?.completionAction) {
13936
+ clearInFlightTurnMarker(this.instanceDir);
13937
+ this.publishWorkingState("completion_delivered");
13938
+ }
13939
+ // #1377: a confirmed completion action (reply/react/edit_message) ends
13940
+ // the human-facing obligation immediately — the idle edge does not need
13941
+ // to confirm it. Clear any pending confirmation window so a later
13942
+ // cross-instance busy→idle cycle cannot re-arm and fire false recovery.
13943
+ // The guard itself completes on the next steady-idle tick via
13944
+ // maybeConfirmReplyGuardIdle (which checks completionDelivered when
13945
+ // replyGuardIdleConfirm is null) or at the next busy→idle edge.
13946
+ // Cancelled turns are excluded: their completion semantics are handled
13947
+ // by the idle edge's cancelledByUser check.
13948
+ // An older reply that satisfied an earlier obligation but not the latest
13949
+ // one (latestObligation > token.obligation) leaves completionDelivered
13950
+ // false and must not clear the window either.
13951
+ if (replyAttempt?.completionAction) {
13952
+ const snap = this.turnReplyGuard.snapshot();
13953
+ // generation 0 is a pre-arm token applied to the live generation (#2544).
13954
+ if (snap && (snap.generation === replyAttempt.generation || replyAttempt.generation === 0)
13955
+ && snap.phase === "awaiting"
13956
+ && snap.completionDelivered && !snap.cancelledByUser) {
13957
+ this.clearReplyGuardConfirm();
13958
+ }
12552
13959
  }
12553
13960
  }
13961
+ else if ((error || result == null) && replyAttempt?.reply && TURN_OUTBOUND_TOOLS.has(tool)) {
13962
+ // #1377: the adapter returned a definitive error — record this so the
13963
+ // confirm window can distinguish "in-flight" (unknown) from "known
13964
+ // failed" and report unknown immediately rather than starting recovery.
13965
+ this.turnReplyGuard.settleToolAttempt(replyAttempt, false);
13966
+ }
13967
+ const packet = { requestId, result, error, operationId, ...(errorCode !== undefined ? { errorCode } : {}) };
13968
+ const sent = peer ? peer.current() && peer.send(packet) : socket ? this.ipcServer?.send(socket, packet) ?? false : false;
13969
+ if (!sent) {
13970
+ if (peer)
13971
+ this.logger.debug({ tool, requestId }, "Native MCP result awaits transport-written confirmation");
13972
+ else
13973
+ this.logger.warn({ tool, requestId }, "Tool result could not be returned — originating MCP socket is closed");
13974
+ }
13975
+ else if (operationId) {
13976
+ this.emit("mcp_tool_response_written", { operationId, daemonBootId: this.bootId });
13977
+ }
12554
13978
  }
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);
13979
+ finally {
13980
+ finish?.();
12560
13981
  }
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");
13982
+ };
13983
+ const sendFleet = (message) => {
13984
+ if (originatingCall && !originatingCall.current()) {
13985
+ const id = String(message.fleetRequestId ?? ""), callback = this.pendingIpcRequests.get(id);
13986
+ this.pendingIpcRequests.delete(id);
13987
+ if (callback)
13988
+ callback({ error: "Originating request context is no longer current" });
12566
13989
  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 });
13990
+ respond(null, "Originating request context is no longer current");
13991
+ return;
12571
13992
  }
13993
+ this.broadcastFleetMessage(originatingCall ? { ...message, requestContextCallId: originatingCall.id, sourceDaemonBootId: this.bootId } : message);
12572
13994
  };
13995
+ try {
13996
+ if (this.requestContextPolicy)
13997
+ requireRequestContextPolicy(this, this.name, tool, args, originatingCall?.admission, originatingCall?.replyRoute);
13998
+ }
13999
+ catch (error) {
14000
+ respond(null, error.message);
14001
+ return;
14002
+ }
14003
+ if (this.requestContextLifecycle && !peer && !originatingCall || originatingCall && !originatingCall.current()) {
14004
+ respond(null, "Originating request context is unavailable");
14005
+ return;
14006
+ }
14007
+ // These local shell mutations have no scoped admission boundary yet (F); never imply coverage.
14008
+ if (originatingCall && (tool === "checkout_repo" || tool === "release_repo")) {
14009
+ respond(null, "This operation is not covered by request-context admission");
14010
+ return;
14011
+ }
12573
14012
  // Native Fleet/task operations carry their lease to the existing dispatcher mutation admission points.
12574
14013
  if (peer?.dispatch?.(tool, args, respond))
12575
14014
  return;
12576
14015
  // Repo checkout — handled locally in daemon (no fleet-manager)
12577
14016
  if (tool === "checkout_repo") {
12578
- this.handleCheckoutRepo(args, respond);
14017
+ void runLocal(() => this.handleCheckoutRepo(args, respond));
12579
14018
  return;
12580
14019
  }
12581
14020
  if (tool === "release_repo") {
12582
- this.handleReleaseRepo(args, respond);
14021
+ void runLocal(() => this.handleReleaseRepo(args, respond));
12583
14022
  return;
12584
14023
  }
12585
14024
  if (tool === "set_display_name" || tool === "set_description" || tool === "list_emojis" || tool === "set_persona_emoji" || tool === "preview_emojis"
@@ -12601,7 +14040,7 @@ export class Daemon extends EventEmitter {
12601
14040
  clearTimeout(timeout);
12602
14041
  respond(respMsg.result, respMsg.error);
12603
14042
  });
12604
- this.broadcastFleetMessage({
14043
+ sendFleet({
12605
14044
  type,
12606
14045
  payload: args,
12607
14046
  meta: { instance_name: this.name },
@@ -12627,9 +14066,9 @@ export class Daemon extends EventEmitter {
12627
14066
  clearTimeout(timeout);
12628
14067
  resolve({ result: respMsg.result, error: respMsg.error });
12629
14068
  });
12630
- this.broadcastFleetMessage({ type: WEB_THEME_IPC[tool], payload, meta: { instance_name: this.name }, fleetRequestId: fleetReqId });
14069
+ sendFleet({ type: WEB_THEME_IPC[tool], payload, meta: { instance_name: this.name }, fleetRequestId: fleetReqId });
12631
14070
  });
12632
- void (async () => {
14071
+ void runLocal(async () => {
12633
14072
  if (tool === "preview_web_appearance") {
12634
14073
  // The fleet builds the SVGs (whole, or in parts); they are written here, in the working directory.
12635
14074
  const first = await ask({ ...(args.modes !== undefined ? { modes: args.modes } : {}) });
@@ -12691,25 +14130,37 @@ export class Daemon extends EventEmitter {
12691
14130
  return (r.result && typeof r.result === "object" ? r.result : {});
12692
14131
  });
12693
14132
  reply(failed ? null : answer, failed);
12694
- })().catch((err) => reply(null, `${tool} failed: ${err instanceof Error ? err.message : "error"}`));
14133
+ }).catch((err) => reply(null, `${tool} failed: ${err instanceof Error ? err.message : "error"}`));
12695
14134
  return;
12696
14135
  }
12697
14136
  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,
14137
+ // One call to the fleet's task tool; resolves with its answer or an error string (never rejects).
14138
+ const askTask = (payload) => new Promise((resolve) => {
14139
+ const fleetReqId = `task_${++this.fleetRequestSeq}_${requestId}`;
14140
+ const timeout = setTimeout(() => {
14141
+ this.pendingIpcRequests.delete(fleetReqId);
14142
+ resolve({ error: `Task operation timed out after ${daemonBudgetMs(tool) / 1000}s` });
14143
+ }, daemonBudgetMs(tool));
14144
+ this.pendingIpcRequests.set(fleetReqId, (respMsg) => {
14145
+ clearTimeout(timeout);
14146
+ resolve({ result: respMsg.result, error: respMsg.error });
14147
+ });
14148
+ sendFleet({
14149
+ type: "fleet_task",
14150
+ payload,
14151
+ meta: { instance_name: this.name },
14152
+ fleetRequestId: fleetReqId,
14153
+ });
12712
14154
  });
14155
+ // files named in `attach` are read HERE, on the agent's side (its working directory, no symlink, size-capped),
14156
+ // and staged on the fleet in parts; the write itself then carries their ids. The fleet never opens a workspace path.
14157
+ void runLocal(async () => {
14158
+ const sent = await sendTaskWrite(args, { workspace: this.config.working_directory, configuredWorkspace: this.config.working_directory, stateDir: getAgendHome(), instance: this.name }, askTask);
14159
+ if (sent.staging)
14160
+ respond(null, sent.error);
14161
+ else
14162
+ respond(sent.answer.result, sent.answer.error);
14163
+ }).catch((err) => respond(null, `task failed: ${err instanceof Error ? err.message : "error"}`));
12713
14164
  return;
12714
14165
  }
12715
14166
  if (DECISION_TOOLS.has(tool)) {
@@ -12727,7 +14178,7 @@ export class Daemon extends EventEmitter {
12727
14178
  clearTimeout(timeout);
12728
14179
  respond(respMsg.result, respMsg.error);
12729
14180
  });
12730
- this.broadcastFleetMessage({
14181
+ sendFleet({
12731
14182
  type: typeMap[tool],
12732
14183
  payload: args,
12733
14184
  meta: { instance_name: this.name, working_directory: this.config.working_directory },
@@ -12754,7 +14205,7 @@ export class Daemon extends EventEmitter {
12754
14205
  clearTimeout(timeout);
12755
14206
  respond(respMsg.result, respMsg.error);
12756
14207
  });
12757
- this.broadcastFleetMessage({
14208
+ sendFleet({
12758
14209
  type: typeMap[tool],
12759
14210
  payload: args,
12760
14211
  meta: {
@@ -12785,11 +14236,11 @@ export class Daemon extends EventEmitter {
12785
14236
  clearTimeout(timeout);
12786
14237
  respond(respMsg.result, respMsg.error);
12787
14238
  });
12788
- this.broadcastFleetMessage({
14239
+ sendFleet({
12789
14240
  type: "fleet_outbound",
12790
14241
  tool,
12791
14242
  args,
12792
- ...(operationId ? { operationId, sourceDaemonBootId: this.bootId } : {}),
14243
+ ...((operationId || (tool.startsWith("hub_room_") || tool === "hub_people_search")) ? { ...(operationId ? { operationId } : {}), sourceDaemonBootId: this.bootId } : {}),
12793
14244
  fleetRequestId: fleetReqId,
12794
14245
  senderSessionName,
12795
14246
  });
@@ -12802,7 +14253,19 @@ export class Daemon extends EventEmitter {
12802
14253
  // Context-bound routing: reply/react/edit_message always use the daemon's last known context.
12803
14254
  // chat_id and thread_id are not exposed in the tool schema — daemon is solely responsible for routing.
12804
14255
  // Must run before IPC forwarding so topic-mode (fleet manager) also receives the correct chat_id.
12805
- if (["reply", "react", "edit_message"].includes(tool)) {
14256
+ const ownedReplyRoute = this.requestContextPolicy && ["reply", "react", "edit_message"].includes(tool) ? originatingCall?.replyRoute : undefined;
14257
+ if (ownedReplyRoute) {
14258
+ if (!ownedReplyRoute.current()) {
14259
+ respond(null, "Originating request context is no longer current");
14260
+ return;
14261
+ }
14262
+ args.chat_id = ownedReplyRoute.target.chatId;
14263
+ if (ownedReplyRoute.target.threadId)
14264
+ args.thread_id = ownedReplyRoute.target.threadId;
14265
+ else
14266
+ delete args.thread_id;
14267
+ }
14268
+ if (!ownedReplyRoute && ["reply", "react", "edit_message"].includes(tool)) {
12806
14269
  const adapters = this.messageBus.getAllAdapters();
12807
14270
  const isTopicMode = adapters.length === 0;
12808
14271
  if (!this.lastChatId && !isTopicMode) {
@@ -12844,7 +14307,7 @@ export class Daemon extends EventEmitter {
12844
14307
  // Register the waiter before broadcasting. A fast/mock adapter can settle
12845
14308
  // immediately; broadcasting first left a response-before-registration
12846
14309
  // window that degraded into a timeout despite a completed POST.
12847
- this.broadcastFleetMessage({
14310
+ sendFleet({
12848
14311
  type: "fleet_outbound",
12849
14312
  tool,
12850
14313
  args,
@@ -12853,15 +14316,16 @@ export class Daemon extends EventEmitter {
12853
14316
  // Preserve the exact adapter world that supplied the chat context. An
12854
14317
  // instance binding is only a fallback: persisted/runtime context can be
12855
14318
  // from a secondary world, and message ids are not portable across bots.
12856
- adapterId: this.lastAdapterId,
14319
+ adapterId: ownedReplyRoute ? ownedReplyRoute.target.adapterId : this.lastAdapterId,
12857
14320
  });
12858
14321
  return;
12859
14322
  }
12860
14323
  // Same rule as deliverDaemonReply: one adapter is unambiguous, several with
12861
14324
  // 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);
14325
+ const selectedAdapter = ownedReplyRoute ? ownedReplyRoute.target.adapterId : this.lastAdapterId;
14326
+ const adapter = selectedAdapter
14327
+ ? this.messageBus.getAdapter(selectedAdapter) ?? (!ownedReplyRoute && adapters.length === 1 ? adapters[0] : undefined)
14328
+ : (!ownedReplyRoute && adapters.length === 1 ? adapters[0] : undefined);
12865
14329
  if (!adapter) {
12866
14330
  respond(null, "No channel world bound to this chat context — awaiting an inbound message to establish it");
12867
14331
  return;
@@ -12884,7 +14348,8 @@ export class Daemon extends EventEmitter {
12884
14348
  delete routed.buttons;
12885
14349
  }
12886
14350
  }
12887
- if (!routeToolCall(adapter, tool, routed, this.lastThreadId, respond)) {
14351
+ 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)
14352
+ throw Error("Originating request context is no longer current"); } } : {})) {
12888
14353
  respond(null, `Unknown tool: ${tool}`);
12889
14354
  }
12890
14355
  }
@@ -12909,7 +14374,7 @@ export class Daemon extends EventEmitter {
12909
14374
  };
12910
14375
  }
12911
14376
  /** Build config object for the CLI backend */
12912
- buildBackendConfig() {
14377
+ buildBackendConfig(forLaunch = true) {
12913
14378
  // Antigravity 1.1.17 has no per-workspace MCP config, but its global MCP
12914
14379
  // children inherit the CLI process environment. The backend installs one
12915
14380
  // environment-selecting launcher, so MCP is now the safe default here too.
@@ -12988,6 +14453,11 @@ export class Daemon extends EventEmitter {
12988
14453
  ? resolveToolSet(this.config, this.name, "general")
12989
14454
  : resolveToolSet(this.config, this.name);
12990
14455
  mcpEnv.AGEND_TOOL_SET = toolSet;
14456
+ if (this.classicRestriction)
14457
+ mcpEnv.AGEND_CLASSIC_ALLOWED_TOOLS = JSON.stringify(this.classicRestriction.allowedAgendTools);
14458
+ const helperLaunch = this.requestContextHelper?.environment();
14459
+ if (helperLaunch)
14460
+ mcpEnv.AGEND_LAUNCH_TOKEN = helperLaunch;
12991
14461
  // The dashboard features the person switched off: out of the tool menu from this start (the fleet refuses them
12992
14462
  // at once, whatever the menu still shows).
12993
14463
  const dashboardOff = dashboardFeaturesOff(dashboardAccessOf(this.config));
@@ -13024,13 +14494,17 @@ export class Daemon extends EventEmitter {
13024
14494
  }
13025
14495
  catch { /* fallback to empty */ }
13026
14496
  instructions = buildFleetInstructions({
14497
+ ...(requestContextInstructionMode(this.requestContextPolicy) !== null && this.requestContextLifecycle && (!this.nativePaneLifecycle || this.nativePaneLifecycle.requestContextAvailable?.() === true)
14498
+ ? { requestContextPolicyInstalled: true } : {}),
13027
14499
  instanceName: this.name,
13028
14500
  taskBoard: !dashboardOff.includes("task_board"),
13029
14501
  workingDirectory: this.config.working_directory,
13030
14502
  runtimeIdentity: this.runtimeIdentity,
14503
+ restrictedClassic: !!this.classicRestriction,
13031
14504
  displayName: this.config.display_name,
13032
14505
  description: this.config.description,
13033
14506
  customPrompt: resolvedCustomPrompt,
14507
+ operations: this.config.operations,
13034
14508
  workflow: resolvedWorkflow,
13035
14509
  decisions,
13036
14510
  statusEmojis,
@@ -13039,13 +14513,17 @@ export class Daemon extends EventEmitter {
13039
14513
  }
13040
14514
  else {
13041
14515
  instructions = buildFleetInstructions({
14516
+ ...(requestContextInstructionMode(this.requestContextPolicy) !== null && this.requestContextLifecycle && (!this.nativePaneLifecycle || this.nativePaneLifecycle.requestContextAvailable?.() === true)
14517
+ ? { requestContextPolicyInstalled: true } : {}),
13042
14518
  instanceName: this.name,
13043
14519
  taskBoard: !dashboardOff.includes("task_board"),
13044
14520
  workingDirectory: this.config.working_directory,
13045
14521
  runtimeIdentity: this.runtimeIdentity,
14522
+ restrictedClassic: !!this.classicRestriction,
13046
14523
  displayName: this.config.display_name,
13047
14524
  description: this.config.description,
13048
14525
  customPrompt: resolvedCustomPrompt,
14526
+ operations: this.config.operations,
13049
14527
  workflow: resolvedWorkflow,
13050
14528
  decisions,
13051
14529
  statusEmojis,
@@ -13054,7 +14532,11 @@ export class Daemon extends EventEmitter {
13054
14532
  const agentPort = parseInt(process.env.AGEND_PORT ?? "19280", 10);
13055
14533
  const backendName = this.config.backend ?? "claude-code";
13056
14534
  const backendOptions = this.config.backend_options?.[backendName];
14535
+ const managedClaudeCredential = forLaunch && backendName === "claude-code"
14536
+ ? managedClaudeBinding(resolve(this.instanceDir, "..", ".."), resolveCredentialProfile(backendOptions)) : null;
13057
14537
  return {
14538
+ ...(managedClaudeCredential ? { managedClaudeCredential } : {}),
14539
+ ...(this.classicRestriction ? { classicRestriction: this.classicRestriction } : {}),
13058
14540
  workingDirectory: this.config.working_directory,
13059
14541
  instanceDir: this.instanceDir,
13060
14542
  instanceName: this.name,
@@ -13168,6 +14650,7 @@ export class Daemon extends EventEmitter {
13168
14650
  this.humanReminderAttempts?.clear();
13169
14651
  this.cliOomObservation = null;
13170
14652
  this.spawnGeneration++;
14653
+ this.requestContextAdmission?.changed();
13171
14654
  this.interactionObservation.reset(this.interactionOwner());
13172
14655
  this.clearInteractionConfirmation();
13173
14656
  this.inputTransientGuardGeneration = (this.backend?.getInputUnavailableTransients?.().length ?? 0) > 0
@@ -13549,6 +15032,8 @@ export class Daemon extends EventEmitter {
13549
15032
  finally {
13550
15033
  this.endSpawn();
13551
15034
  }
15035
+ if (!resumedSuccessfully)
15036
+ this.requestContextNewWork("fresh");
13552
15037
  return resumedSuccessfully;
13553
15038
  }
13554
15039
  /** The whole agent switch after a resume, on the monotonic clock (#906 §3). */
@@ -14016,6 +15501,7 @@ export class Daemon extends EventEmitter {
14016
15501
  if (this.startupAborted)
14017
15502
  return;
14018
15503
  this.startupAborted = true;
15504
+ this.requestContextHelper?.revoke();
14019
15505
  this.freezeRuntimeMonitors();
14020
15506
  this.pendingIpcRequests.clear();
14021
15507
  if (this.museUsageRelay) {
@@ -14432,12 +15918,20 @@ export class Daemon extends EventEmitter {
14432
15918
  if (this.nativePaneLifecycle)
14433
15919
  throw Error("Native relaunch requires its owned exit and a new lifecycle reservation");
14434
15920
  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"); };
15921
+ const restrictionStamp = this.classicRestriction ? classicPlanDigest(this.classicRestriction) : null;
15922
+ const admit = () => {
15923
+ this.startupAdmission?.();
15924
+ this.assertClassicRestrictionLaunch(restrictionStamp);
15925
+ if (repairAdmission && !repairAdmission(expectedAttempt))
15926
+ throw new Error("CLI repair superseded by another launch, pause or stop");
15927
+ };
14437
15928
  this.assertSessionOomAdmission();
14438
15929
  admit();
14439
15930
  const launchFence = this.launchFenceEpoch;
14440
- const backendConfig = this.buildBackendConfig();
15931
+ const helperLaunch = this.requestContextHelper?.begin();
15932
+ const backendConfig = this.buildBackendConfig(true);
15933
+ if (this.classicRestrictionFailed)
15934
+ throw Error("Restricted room policy is unavailable");
14441
15935
  // A compatibility refusal is not a failed resume: no configuration, pin, history or pane may change.
14442
15936
  if (this.backend?.assertLaunchSupported) {
14443
15937
  this.backend.assertLaunchSupported(backendConfig);
@@ -14467,6 +15961,7 @@ export class Daemon extends EventEmitter {
14467
15961
  if (launchFence !== this.launchFenceEpoch)
14468
15962
  throw new Error("Launch cancelled: the instance was stopped or paused while the launch was being prepared");
14469
15963
  this.backend.writeConfig(backendConfig);
15964
+ this.classicRestrictionNeedsRestart = false;
14470
15965
  if (freshInboundInstructions)
14471
15966
  this.installCompactInboundInstructions();
14472
15967
  else {
@@ -14475,6 +15970,7 @@ export class Daemon extends EventEmitter {
14475
15970
  this.resetInboundPresentation();
14476
15971
  }
14477
15972
  this.backend.preTrust?.(this.config.working_directory, backendConfig);
15973
+ this.checkClaudeMcpServers(backendConfig);
14478
15974
  // Resolve working directory (e.g. symlink for hidden paths)
14479
15975
  const resolvedCwd = this.backend.resolveWorkingDirectory?.(this.config.working_directory, this.name) ?? this.config.working_directory;
14480
15976
  // Generate a fresh per-instance agent token each spawn. agent-cli reads
@@ -14562,20 +16058,42 @@ export class Daemon extends EventEmitter {
14562
16058
  admit();
14563
16059
  let windowId;
14564
16060
  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();
16061
+ const retirementResources = this.requestContextStartupResources;
16062
+ if (retirementResources)
16063
+ retirementResources.pending++;
16064
+ try {
16065
+ if (reuseWindow) {
16066
+ this.controlClient?.unregisterWindow(this.tmux.getWindowId());
16067
+ await this.tmux.respawnWindow(cmd, resolvedCwd, repairAdmission ? admit : undefined);
16068
+ windowId = this.tmux.getWindowId();
16069
+ }
16070
+ else {
16071
+ // A crash respawn makes a brand new window. The dead one stays registered
16072
+ // unless we say so — the respawn branch above already does.
16073
+ const retired = this.tmux.getWindowId();
16074
+ windowId = await this.tmux.createWindow(cmd, resolvedCwd, this.name);
16075
+ if (retired && retired !== windowId)
16076
+ this.controlClient?.unregisterWindow(retired);
16077
+ }
16078
+ if (retirementResources) {
16079
+ const pid = await this.paneHost.getPanePid(this.tmuxSessionName, windowId);
16080
+ if (!pid || !Number.isSafeInteger(pid) || pid <= 1)
16081
+ throw Error("Request startup process identity unavailable");
16082
+ retirementResources.windows.push({ session: this.tmuxSessionName, window: windowId, pid });
16083
+ }
14569
16084
  }
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);
16085
+ catch (error) {
16086
+ if (retirementResources)
16087
+ retirementResources.unknown = true;
16088
+ throw error;
16089
+ }
16090
+ finally {
16091
+ if (retirementResources)
16092
+ retirementResources.pending--;
14577
16093
  }
14578
16094
  admit();
16095
+ if (helperLaunch)
16096
+ this.requestContextHelper.confirm(helperLaunch);
14579
16097
  this.writeWindowId(windowId);
14580
16098
  // Enable remain-on-exit to capture exit codes on crash
14581
16099
  await this.tmux.setRemainOnExit().catch(err => {
@@ -15041,11 +16559,41 @@ export class Daemon extends EventEmitter {
15041
16559
  this.lastIdleSessionRefreshAt = now;
15042
16560
  void refresh.call(this.backend).then(() => this.saveSessionId(), () => { });
15043
16561
  }
16562
+ roomConversationState = null;
16563
+ roomConversationGeneration() {
16564
+ try {
16565
+ // Local non-Claude backends checkpoint their own session below; do not replace it with a Claude-only field.
16566
+ if (this.nativePaneLifecycle || (this.config.backend ?? "claude-code") === "claude-code")
16567
+ this.roomConversationState?.observeSession(this.ownedWorkingSession);
16568
+ }
16569
+ catch (err) {
16570
+ this.logger.warn({ err }, "Room conversation checkpoint failed");
16571
+ return null;
16572
+ }
16573
+ return this.roomConversationState?.current() ?? null;
16574
+ }
16575
+ resetRoomConversation(reattached = false) {
16576
+ this.roomConversationState ??= new RoomConversationGeneration(this.instanceDir);
16577
+ try {
16578
+ this.roomConversationState.start(reattached);
16579
+ }
16580
+ catch (err) {
16581
+ this.logger.warn({ err }, "Room conversation generation is unconfirmed");
16582
+ }
16583
+ }
16584
+ roomInputHandedOff(meta) {
16585
+ const generation = meta.hub_room_context_generation;
16586
+ if (meta.from_instance !== HUB_REPORT_TARGET || !generation || generation !== this.roomConversationGeneration())
16587
+ return;
16588
+ this.hubRoomInputEpoch++;
16589
+ this.broadcastFleetMessage({ type: "hub_room_input", correlationId: meta.correlation_id, generation });
16590
+ }
15044
16591
  saveSessionId() {
15045
16592
  if (this.nativePaneLifecycle) {
15046
16593
  try {
15047
16594
  this.nativePaneLifecycle.checkpointSession();
15048
16595
  this.ownedWorkingSession = this.backend?.getSessionId() ?? null;
16596
+ this.roomConversationState?.observeSession(this.ownedWorkingSession);
15049
16597
  }
15050
16598
  catch (err) {
15051
16599
  this.logger.warn({ err }, "Native conversation checkpoint is unconfirmed");
@@ -15060,6 +16608,7 @@ export class Daemon extends EventEmitter {
15060
16608
  const sid = this.backend?.getSessionId();
15061
16609
  if (!sid)
15062
16610
  return;
16611
+ this.roomConversationState?.observeSession(sid);
15063
16612
  if ((this.config.backend ?? "claude-code") === "claude-code" && Buffer.byteLength(sid) <= 256
15064
16613
  && !/[\u0000-\u001f\u007f]/.test(sid) && this.ownedWorkingSession !== sid) {
15065
16614
  this.ownedWorkingSession = sid;