@songsid/agend 2.4.0-beta.17 → 2.4.0-beta.19

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 (431) hide show
  1. package/dist/agent-cli-instructions.md +13 -7
  2. package/dist/agent-cli.js +149 -49
  3. package/dist/agent-cli.js.map +1 -1
  4. package/dist/agent-export.d.ts +3 -1
  5. package/dist/agent-export.js +18 -1
  6. package/dist/agent-export.js.map +1 -1
  7. package/dist/agent-whats-new.js +9 -0
  8. package/dist/agent-whats-new.js.map +1 -1
  9. package/dist/apply-job.d.ts +2 -2
  10. package/dist/auth-api.js +1 -1
  11. package/dist/auth-api.js.map +1 -1
  12. package/dist/backend/claude-code.d.ts +0 -6
  13. package/dist/backend/claude-code.js +29 -5
  14. package/dist/backend/claude-code.js.map +1 -1
  15. package/dist/backend/claude-transcript-errors.d.ts +4 -0
  16. package/dist/backend/claude-transcript-errors.js +5 -1
  17. package/dist/backend/claude-transcript-errors.js.map +1 -1
  18. package/dist/backend/codex-precaution.js +3 -2
  19. package/dist/backend/codex-precaution.js.map +1 -1
  20. package/dist/backend/codex.js +1 -1
  21. package/dist/backend/codex.js.map +1 -1
  22. package/dist/backend/types.d.ts +6 -0
  23. package/dist/backend/types.js.map +1 -1
  24. package/dist/build-provenance.json +1 -1
  25. package/dist/channel/mcp-server.js +8 -2
  26. package/dist/channel/mcp-server.js.map +1 -1
  27. package/dist/channel/mcp-tools.d.ts +27 -1
  28. package/dist/channel/mcp-tools.js +77 -7
  29. package/dist/channel/mcp-tools.js.map +1 -1
  30. package/dist/chat-task-refs.d.ts +61 -0
  31. package/dist/chat-task-refs.js +112 -0
  32. package/dist/chat-task-refs.js.map +1 -0
  33. package/dist/classic-channel-manager.d.ts +1 -1
  34. package/dist/classic-channel-manager.js +6 -2
  35. package/dist/classic-channel-manager.js.map +1 -1
  36. package/dist/claude-credential-launch.d.ts +6 -0
  37. package/dist/claude-credential-launch.js +16 -3
  38. package/dist/claude-credential-launch.js.map +1 -1
  39. package/dist/claude-credential-runner.js +3 -1
  40. package/dist/claude-credential-runner.js.map +1 -1
  41. package/dist/claude-setup-token-transport.js +25 -3
  42. package/dist/claude-setup-token-transport.js.map +1 -1
  43. package/dist/cli-audited.js +9 -8
  44. package/dist/cli-audited.js.map +1 -1
  45. package/dist/composite-tools.d.ts +11 -0
  46. package/dist/composite-tools.js +29 -0
  47. package/dist/composite-tools.js.map +1 -0
  48. package/dist/config-validator.js +22 -1
  49. package/dist/config-validator.js.map +1 -1
  50. package/dist/config.js +11 -0
  51. package/dist/config.js.map +1 -1
  52. package/dist/contact-auth-policy.d.ts +1 -0
  53. package/dist/contact-auth-policy.js +2 -1
  54. package/dist/contact-auth-policy.js.map +1 -1
  55. package/dist/contact-auth-service.js +2 -0
  56. package/dist/contact-auth-service.js.map +1 -1
  57. package/dist/contact-auth-store.js +21 -6
  58. package/dist/contact-auth-store.js.map +1 -1
  59. package/dist/contact-auth-types.d.ts +2 -0
  60. package/dist/contact-auth-types.js.map +1 -1
  61. package/dist/daemon.d.ts +8 -0
  62. package/dist/daemon.js +66 -13
  63. package/dist/daemon.js.map +1 -1
  64. package/dist/darwin-memory.js +2 -1
  65. package/dist/darwin-memory.js.map +1 -1
  66. package/dist/dashboard-permissions.d.ts +1 -8
  67. package/dist/dashboard-permissions.js +8 -9
  68. package/dist/dashboard-permissions.js.map +1 -1
  69. package/dist/delivery-outbox.d.ts +0 -6
  70. package/dist/delivery-outbox.js +0 -25
  71. package/dist/delivery-outbox.js.map +1 -1
  72. package/dist/delivery-outbox.test.js +132 -96
  73. package/dist/delivery-outbox.test.js.map +1 -1
  74. package/dist/fleet-context.d.ts +1 -0
  75. package/dist/fleet-manager.d.ts +60 -8
  76. package/dist/fleet-manager.js +404 -107
  77. package/dist/fleet-manager.js.map +1 -1
  78. package/dist/fleet-windows-runtime.d.ts +2 -2
  79. package/dist/fleet-windows-runtime.js +9 -2
  80. package/dist/fleet-windows-runtime.js.map +1 -1
  81. package/dist/fleet-yaml-stringify.d.ts +3 -0
  82. package/dist/fleet-yaml-stringify.js +132 -0
  83. package/dist/fleet-yaml-stringify.js.map +1 -0
  84. package/dist/general-knowledge/skills/concepts/SKILL.md +53 -4
  85. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +4 -0
  86. package/dist/general-knowledge/skills/fleet-config/SKILL.md +21 -1
  87. package/dist/general-knowledge/skills/hub/SKILL.md +2 -0
  88. package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +5 -1
  89. package/dist/general-knowledge/skills/model-discovery/SKILL.md +3 -2
  90. package/dist/general-knowledge/skills/persona-emoji/SKILL.md +3 -0
  91. package/dist/general-knowledge/skills/task-board/SKILL.md +63 -0
  92. package/dist/general-knowledge/skills/web-appearance/SKILL.md +25 -2
  93. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +48 -11
  94. package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +4 -0
  95. package/dist/general-knowledge/steering/core-rules.md +15 -78
  96. package/dist/general-role-block.d.ts +19 -0
  97. package/dist/general-role-block.js +56 -0
  98. package/dist/general-role-block.js.map +1 -0
  99. package/dist/general-role.d.ts +1 -1
  100. package/dist/general-role.js +1 -0
  101. package/dist/general-role.js.map +1 -1
  102. package/dist/host-memory.d.ts +3 -0
  103. package/dist/host-memory.js.map +1 -1
  104. package/dist/host-monitoring/darwin/collector.d.ts +18 -0
  105. package/dist/host-monitoring/darwin/collector.js +65 -0
  106. package/dist/host-monitoring/darwin/collector.js.map +1 -0
  107. package/dist/host-monitoring/darwin/defaults.d.ts +2 -0
  108. package/dist/host-monitoring/darwin/defaults.js +9 -0
  109. package/dist/host-monitoring/darwin/defaults.js.map +1 -0
  110. package/dist/host-monitoring/darwin/interpretation.d.ts +20 -0
  111. package/dist/host-monitoring/darwin/interpretation.js +73 -0
  112. package/dist/host-monitoring/darwin/interpretation.js.map +1 -0
  113. package/dist/host-monitoring/linux/collector.d.ts +17 -0
  114. package/dist/host-monitoring/linux/collector.js +55 -0
  115. package/dist/host-monitoring/linux/collector.js.map +1 -0
  116. package/dist/host-monitoring/linux/defaults.d.ts +2 -0
  117. package/dist/host-monitoring/linux/defaults.js +9 -0
  118. package/dist/host-monitoring/linux/defaults.js.map +1 -0
  119. package/dist/host-monitoring/linux/interpretation.d.ts +22 -0
  120. package/dist/host-monitoring/linux/interpretation.js +76 -0
  121. package/dist/host-monitoring/linux/interpretation.js.map +1 -0
  122. package/dist/host-monitoring/transport.d.ts +42 -0
  123. package/dist/host-monitoring/transport.js +101 -0
  124. package/dist/host-monitoring/transport.js.map +1 -0
  125. package/dist/host-monitoring/wsl/collector.d.ts +19 -0
  126. package/dist/host-monitoring/wsl/collector.js +72 -0
  127. package/dist/host-monitoring/wsl/collector.js.map +1 -0
  128. package/dist/host-monitoring/wsl/defaults.d.ts +2 -0
  129. package/dist/host-monitoring/wsl/defaults.js +9 -0
  130. package/dist/host-monitoring/wsl/defaults.js.map +1 -0
  131. package/dist/host-monitoring/wsl/interpretation.d.ts +22 -0
  132. package/dist/host-monitoring/wsl/interpretation.js +77 -0
  133. package/dist/host-monitoring/wsl/interpretation.js.map +1 -0
  134. package/dist/host-monitoring-alert-policy.d.ts +73 -0
  135. package/dist/host-monitoring-alert-policy.js +152 -0
  136. package/dist/host-monitoring-alert-policy.js.map +1 -0
  137. package/dist/host-monitoring-alert-resources.d.ts +11 -0
  138. package/dist/host-monitoring-alert-resources.js +16 -0
  139. package/dist/host-monitoring-alert-resources.js.map +1 -0
  140. package/dist/host-monitoring-alert-settings.d.ts +16 -0
  141. package/dist/host-monitoring-alert-settings.js +68 -0
  142. package/dist/host-monitoring-alert-settings.js.map +1 -0
  143. package/dist/host-monitoring-alert-store.d.ts +49 -0
  144. package/dist/host-monitoring-alert-store.js +228 -0
  145. package/dist/host-monitoring-alert-store.js.map +1 -0
  146. package/dist/host-monitoring-alert-text.d.ts +7 -0
  147. package/dist/host-monitoring-alert-text.js +10 -0
  148. package/dist/host-monitoring-alert-text.js.map +1 -0
  149. package/dist/host-monitoring-alerts.d.ts +79 -0
  150. package/dist/host-monitoring-alerts.js +276 -0
  151. package/dist/host-monitoring-alerts.js.map +1 -0
  152. package/dist/host-monitoring-defaults.d.ts +19 -0
  153. package/dist/host-monitoring-defaults.js +10 -0
  154. package/dist/host-monitoring-defaults.js.map +1 -0
  155. package/dist/host-monitoring-footprint-policy.d.ts +45 -0
  156. package/dist/host-monitoring-footprint-policy.js +150 -0
  157. package/dist/host-monitoring-footprint-policy.js.map +1 -0
  158. package/dist/host-monitoring-footprint.d.ts +42 -0
  159. package/dist/host-monitoring-footprint.js +169 -0
  160. package/dist/host-monitoring-footprint.js.map +1 -0
  161. package/dist/host-monitoring-history-policy.d.ts +2 -0
  162. package/dist/host-monitoring-history-policy.js +16 -2
  163. package/dist/host-monitoring-history-policy.js.map +1 -1
  164. package/dist/host-monitoring-history-store.js +8 -6
  165. package/dist/host-monitoring-history-store.js.map +1 -1
  166. package/dist/host-monitoring-history-worker.js +19 -3
  167. package/dist/host-monitoring-history-worker.js.map +1 -1
  168. package/dist/host-monitoring-history.d.ts +9 -0
  169. package/dist/host-monitoring-history.js +45 -9
  170. package/dist/host-monitoring-history.js.map +1 -1
  171. package/dist/host-monitoring-platform.d.ts +18 -70
  172. package/dist/host-monitoring-platform.js +14 -269
  173. package/dist/host-monitoring-platform.js.map +1 -1
  174. package/dist/host-monitoring-process-identity.d.ts +8 -0
  175. package/dist/host-monitoring-process-identity.js +81 -0
  176. package/dist/host-monitoring-process-identity.js.map +1 -0
  177. package/dist/host-monitoring-runtime.d.ts +8 -0
  178. package/dist/host-monitoring-runtime.js +18 -3
  179. package/dist/host-monitoring-runtime.js.map +1 -1
  180. package/dist/host-monitoring.d.ts +15 -0
  181. package/dist/host-monitoring.js.map +1 -1
  182. package/dist/hub/agent-catalog-model.d.ts +21 -0
  183. package/dist/hub/agent-catalog-model.js +9 -1
  184. package/dist/hub/agent-catalog-model.js.map +1 -1
  185. package/dist/hub/agent-catalog.d.ts +4 -1
  186. package/dist/hub/agent-catalog.js +11 -0
  187. package/dist/hub/agent-catalog.js.map +1 -1
  188. package/dist/hub/catalog.js +12 -0
  189. package/dist/hub/catalog.js.map +1 -1
  190. package/dist/hub/client.js +4 -1
  191. package/dist/hub/client.js.map +1 -1
  192. package/dist/hub/compose/member.d.ts +5 -0
  193. package/dist/hub/compose/member.js +25 -5
  194. package/dist/hub/compose/member.js.map +1 -1
  195. package/dist/hub/compose/server.d.ts +2 -0
  196. package/dist/hub/compose/server.js +4 -2
  197. package/dist/hub/compose/server.js.map +1 -1
  198. package/dist/hub/http/compose.d.ts +5 -0
  199. package/dist/hub/http/compose.js +25 -2
  200. package/dist/hub/http/compose.js.map +1 -1
  201. package/dist/hub/http/deps.d.ts +2 -0
  202. package/dist/hub/http/schema.js +4 -0
  203. package/dist/hub/http/schema.js.map +1 -1
  204. package/dist/hub/lapse-carry.d.ts +45 -0
  205. package/dist/hub/lapse-carry.js +62 -0
  206. package/dist/hub/lapse-carry.js.map +1 -0
  207. package/dist/hub/member/agent-catalog.d.ts +4 -1
  208. package/dist/hub/member/agent-catalog.js +15 -4
  209. package/dist/hub/member/agent-catalog.js.map +1 -1
  210. package/dist/hub/member/agent-intro.d.ts +4 -3
  211. package/dist/hub/member/agent-intro.js +7 -0
  212. package/dist/hub/member/agent-intro.js.map +1 -1
  213. package/dist/hub/member/exposure-api.d.ts +2 -0
  214. package/dist/hub/member/exposure-api.js +8 -1
  215. package/dist/hub/member/exposure-api.js.map +1 -1
  216. package/dist/hub/member/room-post.d.ts +34 -6
  217. package/dist/hub/member/room-post.js +30 -0
  218. package/dist/hub/member/room-post.js.map +1 -1
  219. package/dist/hub/member/sharing.d.ts +2 -0
  220. package/dist/hub/member/sharing.js +9 -2
  221. package/dist/hub/member/sharing.js.map +1 -1
  222. package/dist/hub/protocol.d.ts +2 -0
  223. package/dist/hub/room-brief-model.js +2 -1
  224. package/dist/hub/room-brief-model.js.map +1 -1
  225. package/dist/hub/rooms/agents.d.ts +2 -0
  226. package/dist/hub/rooms/agents.js +16 -2
  227. package/dist/hub/rooms/agents.js.map +1 -1
  228. package/dist/hub/rooms/office.d.ts +82 -0
  229. package/dist/hub/rooms/office.js +46 -0
  230. package/dist/hub/rooms/office.js.map +1 -0
  231. package/dist/hub/rooms/service.d.ts +66 -1
  232. package/dist/hub/rooms/service.js +67 -11
  233. package/dist/hub/rooms/service.js.map +1 -1
  234. package/dist/hub/rooms/types.d.ts +4 -0
  235. package/dist/hub/runtime.d.ts +1 -1
  236. package/dist/hub/server.js +9 -2
  237. package/dist/hub/server.js.map +1 -1
  238. package/dist/hub/sharing-requests.d.ts +5 -2
  239. package/dist/hub/sharing-requests.js +19 -4
  240. package/dist/hub/sharing-requests.js.map +1 -1
  241. package/dist/instance-config-impact.js +1 -1
  242. package/dist/instance-config-impact.js.map +1 -1
  243. package/dist/instance-lifecycle.js +8 -9
  244. package/dist/instance-lifecycle.js.map +1 -1
  245. package/dist/instruction-file-sizes.d.ts +46 -0
  246. package/dist/instruction-file-sizes.js +115 -0
  247. package/dist/instruction-file-sizes.js.map +1 -0
  248. package/dist/instructions.d.ts +35 -1
  249. package/dist/instructions.js +59 -33
  250. package/dist/instructions.js.map +1 -1
  251. package/dist/locale.js +16 -4
  252. package/dist/locale.js.map +1 -1
  253. package/dist/log-steps.d.ts +5 -0
  254. package/dist/log-steps.js +6 -2
  255. package/dist/log-steps.js.map +1 -1
  256. package/dist/memory-guidance.d.ts +5 -0
  257. package/dist/memory-guidance.js +14 -0
  258. package/dist/memory-guidance.js.map +1 -0
  259. package/dist/model-defaults.d.ts +5 -0
  260. package/dist/model-defaults.js +6 -0
  261. package/dist/model-defaults.js.map +1 -0
  262. package/dist/native-mcp.d.ts +2 -0
  263. package/dist/native-mcp.js +16 -6
  264. package/dist/native-mcp.js.map +1 -1
  265. package/dist/needs-you-hub.d.ts +3 -0
  266. package/dist/needs-you-hub.js +7 -1
  267. package/dist/needs-you-hub.js.map +1 -1
  268. package/dist/needs-you.d.ts +15 -2
  269. package/dist/needs-you.js +6 -0
  270. package/dist/needs-you.js.map +1 -1
  271. package/dist/outbound-handlers.d.ts +3 -3
  272. package/dist/outbound-schemas.d.ts +3 -0
  273. package/dist/outbound-schemas.js +27 -26
  274. package/dist/outbound-schemas.js.map +1 -1
  275. package/dist/public-web-gateway.js +7 -1
  276. package/dist/public-web-gateway.js.map +1 -1
  277. package/dist/quickstart.d.ts +1 -1
  278. package/dist/quickstart.js +2 -3
  279. package/dist/quickstart.js.map +1 -1
  280. package/dist/remote-card-prompt.d.ts +1 -0
  281. package/dist/remote-card-prompt.js +1 -1
  282. package/dist/remote-card-prompt.js.map +1 -1
  283. package/dist/runtime-build-info.js +1 -1
  284. package/dist/runtime-build-info.js.map +1 -1
  285. package/dist/runtime-cli-install.js +9 -9
  286. package/dist/runtime-cli-install.js.map +1 -1
  287. package/dist/runtime-pane-mcp.js +7 -3
  288. package/dist/runtime-pane-mcp.js.map +1 -1
  289. package/dist/runtime-pane-native.js +2 -1
  290. package/dist/runtime-pane-native.js.map +1 -1
  291. package/dist/scheduler/db.js +2 -0
  292. package/dist/scheduler/db.js.map +1 -1
  293. package/dist/scheduler/task-board-mentions.d.ts +32 -0
  294. package/dist/scheduler/task-board-mentions.js +97 -0
  295. package/dist/scheduler/task-board-mentions.js.map +1 -0
  296. package/dist/scheduler/task-board-text.js +3 -0
  297. package/dist/scheduler/task-board-text.js.map +1 -1
  298. package/dist/scheduler/task-board.d.ts +199 -3
  299. package/dist/scheduler/task-board.js +492 -7
  300. package/dist/scheduler/task-board.js.map +1 -1
  301. package/dist/settings-api.d.ts +5 -1
  302. package/dist/settings-api.js +77 -2
  303. package/dist/settings-api.js.map +1 -1
  304. package/dist/settings-baseline.js +5 -4
  305. package/dist/settings-baseline.js.map +1 -1
  306. package/dist/settings-change.js +4 -2
  307. package/dist/settings-change.js.map +1 -1
  308. package/dist/settings-effect.d.ts +2 -0
  309. package/dist/settings-effect.js +20 -1
  310. package/dist/settings-effect.js.map +1 -1
  311. package/dist/settings-instance-patch.js +3 -1
  312. package/dist/settings-instance-patch.js.map +1 -1
  313. package/dist/setup-host.d.ts +2 -3
  314. package/dist/setup-host.js +3 -5
  315. package/dist/setup-host.js.map +1 -1
  316. package/dist/setup-wizard.js +0 -2
  317. package/dist/setup-wizard.js.map +1 -1
  318. package/dist/shared-default-adoption.d.ts +24 -0
  319. package/dist/shared-default-adoption.js +73 -0
  320. package/dist/shared-default-adoption.js.map +1 -0
  321. package/dist/subagent-records.d.ts +2 -0
  322. package/dist/subagent-records.js +11 -1
  323. package/dist/subagent-records.js.map +1 -1
  324. package/dist/subagent-service.d.ts +3 -0
  325. package/dist/subagent-service.js +24 -4
  326. package/dist/subagent-service.js.map +1 -1
  327. package/dist/task-board-tool.d.ts +31 -0
  328. package/dist/task-board-tool.js +31 -0
  329. package/dist/task-board-tool.js.map +1 -1
  330. package/dist/task-board-waker.d.ts +23 -30
  331. package/dist/task-board-waker.js +136 -97
  332. package/dist/task-board-waker.js.map +1 -1
  333. package/dist/topic-commands.js +4 -0
  334. package/dist/topic-commands.js.map +1 -1
  335. package/dist/types.d.ts +23 -0
  336. package/dist/ui/agent-details-settings.js +2 -2
  337. package/dist/ui/agent-export-dialog.js +4 -3
  338. package/dist/ui/agent-export-strings.js +4 -4
  339. package/dist/ui/agent-page-strings.js +18 -0
  340. package/dist/ui/chat-activity-groups.js +1 -1
  341. package/dist/ui/chat-activity.js +17 -0
  342. package/dist/ui/chat-store.js +34 -8
  343. package/dist/ui/chat-task-ref-strings.js +24 -0
  344. package/dist/ui/chat-task-refs.js +129 -0
  345. package/dist/ui/claude-setup-token.js +3 -3
  346. package/dist/ui/contact-auth-strings.js +33 -3
  347. package/dist/ui/contact-authorizations.js +17 -24
  348. package/dist/ui/contact-grant-editor.js +50 -0
  349. package/dist/ui/contact-permissions.js +21 -8
  350. package/dist/ui/fleet-office-card.js +18 -14
  351. package/dist/ui/fleet-office.js +29 -17
  352. package/dist/ui/fleet-task-activity.js +362 -0
  353. package/dist/ui/fleet-task-card.js +317 -314
  354. package/dist/ui/fleet-task-common.js +99 -9
  355. package/dist/ui/fleet-task-create.js +67 -0
  356. package/dist/ui/fleet-task-edit.js +204 -0
  357. package/dist/ui/fleet-task-follow.js +123 -0
  358. package/dist/ui/fleet-task-menu.js +1 -1
  359. package/dist/ui/fleet-task-owner.js +252 -0
  360. package/dist/ui/fleet-task-run.js +257 -0
  361. package/dist/ui/fleet-task-view.js +178 -39
  362. package/dist/ui/fleet-task-work.js +2 -2
  363. package/dist/ui/fleet-tasks.js +258 -130
  364. package/dist/ui/host-alerts.js +23 -0
  365. package/dist/ui/host-footprint.js +17 -0
  366. package/dist/ui/host-health.js +24 -16
  367. package/dist/ui/host-monitoring-darwin.js +6 -0
  368. package/dist/ui/host-monitoring-help.js +7 -0
  369. package/dist/ui/host-monitoring-linux.js +6 -0
  370. package/dist/ui/host-monitoring-wsl.js +6 -0
  371. package/dist/ui/host-time.js +5 -0
  372. package/dist/ui/hub-agent-copy.js +2 -0
  373. package/dist/ui/hub-client.js +4 -0
  374. package/dist/ui/hub-my-agents-strings.js +2 -0
  375. package/dist/ui/hub-my-agents.js +17 -1
  376. package/dist/ui/hub-room-composer.js +108 -5
  377. package/dist/ui/hub-room-members-strings.js +9 -2
  378. package/dist/ui/hub-room-members.js +72 -15
  379. package/dist/ui/hub-room-office.js +191 -0
  380. package/dist/ui/hub-room-purpose.js +18 -2
  381. package/dist/ui/hub-room-settings.js +8 -1
  382. package/dist/ui/hub-room-strings.js +15 -0
  383. package/dist/ui/hub-room-thread.js +51 -15
  384. package/dist/ui/hub-strings.js +1 -1
  385. package/dist/ui/log-row.js +7 -5
  386. package/dist/ui/native-instance-settings.js +4 -2
  387. package/dist/ui/panel-chat.js +98 -17
  388. package/dist/ui/panel-details.js +17 -0
  389. package/dist/ui/panel-fleet.js +1 -1
  390. package/dist/ui/panel-hub.js +4 -1
  391. package/dist/ui/panel-needs.js +38 -18
  392. package/dist/ui/panel-settings.js +58 -13
  393. package/dist/ui/settings-apply.js +8 -3
  394. package/dist/ui/settings-default-model-scope.js +40 -0
  395. package/dist/ui/settings-default-model-strings.js +43 -0
  396. package/dist/ui/settings-dialogs.js +9 -5
  397. package/dist/ui/settings-host-alerts.js +23 -0
  398. package/dist/ui/settings-host-monitoring.js +10 -8
  399. package/dist/ui/settings-hub.js +1 -1
  400. package/dist/ui/settings-layout.js +7 -2
  401. package/dist/ui/settings-model.js +9 -5
  402. package/dist/ui/settings-quota-notice.js +3 -3
  403. package/dist/ui/settings-registry.js +3 -0
  404. package/dist/ui/settings-shared-strings.js +22 -0
  405. package/dist/ui/settings-shared.js +59 -12
  406. package/dist/ui/settings-strings.js +2 -4
  407. package/dist/ui/shared/app-i18n.js +2 -2
  408. package/dist/ui/shared/app.css +169 -50
  409. package/dist/ui/shared/chat-composer.js +7 -6
  410. package/dist/ui/shared/chat-render.js +63 -10
  411. package/dist/ui/shared/chat-strings.js +2 -2
  412. package/dist/ui/shared/chat-thread.js +10 -3
  413. package/dist/ui/shared/composer-focus.js +21 -0
  414. package/dist/ui/shared/hub-chat.css +30 -2
  415. package/dist/ui/shared/hub-rooms-u2.css +17 -0
  416. package/dist/ui/shared/task-board.css +406 -8
  417. package/dist/ui/trigger-complete.js +71 -0
  418. package/dist/web-api.d.ts +11 -1
  419. package/dist/web-api.js +324 -18
  420. package/dist/web-api.js.map +1 -1
  421. package/dist/web-chat-history.d.ts +40 -1
  422. package/dist/web-chat-history.js +131 -9
  423. package/dist/web-chat-history.js.map +1 -1
  424. package/dist/web-guest-access.js +4 -4
  425. package/dist/web-guest-access.js.map +1 -1
  426. package/dist/web-upload.d.ts +1 -1
  427. package/dist/web-upload.js.map +1 -1
  428. package/dist/windows-native-mcp.js +5 -2
  429. package/dist/windows-native-mcp.js.map +1 -1
  430. package/dist/workflow-templates/default.md +4 -6
  431. package/package.json +1 -1
@@ -1,3 +1,12 @@
1
+ import { detectMonitoringPlatform } from './host-monitoring-defaults.js';
2
+ import { SharedDefaultAdoption } from "./shared-default-adoption.js";
3
+ import { scopedDefaultModel } from "./model-defaults.js";
4
+ import { HostFootprint } from "./host-monitoring-footprint.js";
5
+ import { hostAlertSummary } from './host-monitoring-alert-text.js';
6
+ import { HostMonitoringAlerts } from './host-monitoring-alerts.js';
7
+ import { readHostAlertSettings, writeHostAlertSettings, defaultHostAlertSettings, parseHostAlertSettings } from './host-monitoring-alert-settings.js';
8
+ import { hostAlertResources } from './host-monitoring-alert-resources.js';
9
+ import { validateHostAlertRule } from './host-monitoring-alert-policy.js';
1
10
  import { readHostMonitoringDrive, writeHostMonitoringDrive, validMonitoringDrive } from './host-monitoring-settings-store.js';
2
11
  import { HostMonitoringHistory } from './host-monitoring-history.js';
3
12
  import { HostMonitoringRuntime } from "./host-monitoring-runtime.js";
@@ -20,6 +29,7 @@ import { settingsSummary, translatedSummary } from "./settings-summary.js";
20
29
  import { readInstalledBuild } from "./build-provenance.js";
21
30
  import { buildNativeFleetInstructions } from "./instructions.js";
22
31
  import { GENERAL_ROLE_INSTRUCTIONS } from "./general-role.js";
32
+ import { placeGeneralRole } from "./general-role-block.js";
23
33
  import { NativePaneRecoveryError } from "./native-pane-recovery.js";
24
34
  import { nativePaneToolAvailable, nativePaneToolRefusal } from "./native-pane-tools.js";
25
35
  import { windowsAgentsFor } from "./windows-agents.js";
@@ -108,6 +118,7 @@ import { MemoryPressure } from "./memory-pressure.js";
108
118
  import { replyDedupText, ReplyDeduper } from "./reply-dedup.js";
109
119
  import { isMap, isScalar, parseDocument } from "yaml";
110
120
  import { changedOutside, detachForWrite } from "./yaml-shared-nodes.js";
121
+ import { stringifyFleetYaml } from "./fleet-yaml-stringify.js";
111
122
  import { tmuxExecHelper } from "./tmux-exec-helper.js";
112
123
  import { kiroLogGate } from "./kiro-log-gate.js";
113
124
  const __filename = fileURLToPath(import.meta.url);
@@ -152,8 +163,8 @@ import { createLogger, rotateLogIfNeeded } from "./logger.js";
152
163
  import { processAttachments } from "./channel/attachment-handler.js";
153
164
  import { routeToolCall } from "./channel/tool-router.js";
154
165
  import { Scheduler } from "./scheduler/index.js";
155
- import { boardActivity, boardCardLimit, boardToolAction } from "./task-board-tool.js";
156
- import { TaskBoardWaker, namesCard } from "./task-board-waker.js";
166
+ import { boardActivity, boardCardLimit, boardCommentWakesOn, boardLeader, boardProgressWakesOn, boardToolAction } from "./task-board-tool.js";
167
+ import { TaskBoardWaker } from "./task-board-waker.js";
157
168
  import { DispatcherLiveness, LIVENESS_STARTUP_GRACE_MS, livenessSettings, questionNotices, turnQuestion } from "./dispatcher-liveness.js";
158
169
  import { TaskBoardError, waitsForPerson, wrapUpGap } from "./scheduler/task-board.js";
159
170
  import { escapeTelegramHtml, scheduleClock, scheduleRetryLabel } from "./scheduler/retry-label.js";
@@ -246,6 +257,7 @@ import { RuntimeCoordinator } from "./runtime-coordinator.js";
246
257
  import { runtimeUpdateAttention } from "./runtime-update-attention.js";
247
258
  import { RuntimeWindowsBridge } from "./runtime-windows-bridge.js";
248
259
  import { FleetWindowsRuntime } from "./fleet-windows-runtime.js";
260
+ import { INSTRUCTIONS_FILE } from "./instruction-file-sizes.js";
249
261
  import { NativeMcpSessions } from "./native-mcp.js";
250
262
  import { nativeProviderMcpSupported } from "./windows-cli-providers.js";
251
263
  import { cachedNativeModelCatalog, refreshNativeModelCatalogAfterSignIn } from "./native-model-catalog.js";
@@ -809,12 +821,49 @@ export class FleetManager {
809
821
  stormWindow;
810
822
  spawnGate;
811
823
  memoryPressure;
824
+ hostFootprint = null;
825
+ hostFootprintEnabled = false;
826
+ hostFootprintLabels = new Map();
827
+ hostFootprintRoots() {
828
+ const roots = [];
829
+ this.hostFootprintLabels.clear();
830
+ for (const [name, daemon] of this.daemons) {
831
+ const root = daemon.hostFootprintRoot?.(), id = createHash("sha256").update(name).digest("hex").slice(0, 16);
832
+ roots.push({ id, pid: root?.pid ?? 0, owner: root?.owner ?? "unavailable", observedAt: root?.observedAt ?? 0, files: [join(this.getInstanceDir(name), "output.log")] });
833
+ if (roots.length > 128)
834
+ break;
835
+ this.hostFootprintLabels.set(id, this.fleetConfig?.instances[name]?.display_name ?? name);
836
+ }
837
+ return roots;
838
+ }
812
839
  hostMonitor = null;
813
840
  hostHistory = null;
841
+ hostAlerts = null;
842
+ hostAlertConfig = defaultHostAlertSettings();
843
+ hostAlertSettingsLoaded = false;
844
+ hostAlertSettingsFailed = false;
814
845
  startHostMonitoringRuntime() {
815
- this.hostHistory ??= new HostMonitoringHistory({ path: join(this.dataDir, 'host-monitoring.sqlite'), unblocked: () => this.hostMonitor?.apply() });
846
+ if (!this.hostAlertSettingsLoaded) {
847
+ this.hostAlertSettingsLoaded = true;
848
+ try {
849
+ this.hostAlertConfig = readHostAlertSettings(this.dataDir);
850
+ }
851
+ catch {
852
+ this.hostAlertSettingsFailed = true;
853
+ }
854
+ }
855
+ this.hostHistory ??= new HostMonitoringHistory({ path: join(this.dataDir, 'host-monitoring.sqlite'), incidents: true, incidentReady: () => this.hostAlerts?.ready(), unblocked: () => this.hostMonitor?.apply() });
856
+ this.hostAlerts ??= new HostMonitoringAlerts({ platform: this.hostMonitoringPlatform(), persistence: this.hostHistory, changed: () => this.needsYou?.poke(), deliver: (changes, ack) => {
857
+ return this.notifyFleetError(hostAlertSummary(changes, getLocale()), { throttle: false, ack });
858
+ } });
859
+ this.hostFootprint ??= new HostFootprint({ roots: () => this.hostFootprintRoots(), changed: () => this.hostHistory?.ingest(this.hostHealthSnapshotInternal()) });
816
860
  this.hostMonitor ??= new HostMonitoringRuntime({
861
+ footprint: this.hostFootprint,
862
+ footprintEnabled: enabled => { this.hostFootprintEnabled = enabled; for (const daemon of this.daemons.values())
863
+ daemon.setHostFootprintEnabled?.(enabled); },
817
864
  history: this.hostHistory,
865
+ alerts: { configure: enabled => { this.hostAlerts.configure(enabled, this.hostAlertConfig); if (this.hostAlertSettingsFailed)
866
+ this.hostAlerts.unavailable(); }, stop: () => this.hostAlerts.stop(), ingest: snapshot => this.hostAlerts.ingest(snapshot), snapshot: () => this.hostAlerts.snapshot() },
818
867
  supported: () => process.platform === "linux" || process.platform === "darwin",
819
868
  drive: () => readHostMonitoringDrive(this.dataDir),
820
869
  committed: () => monitoringConfig(this.fleetConfig?.monitoring),
@@ -826,8 +875,47 @@ export class FleetManager {
826
875
  this.hostMonitor.start();
827
876
  }
828
877
  hostHistoryQuery(range, series) { return this.hostHistory?.query(range, series) ?? Promise.resolve({ ok: false, reason: 'history_unavailable' }); }
878
+ hostMonitoringPlatform() { return this.hostHealthSnapshotInternal().platform ?? detectMonitoringPlatform(); }
829
879
  hostMonitoringAvailable() { return this.hostMonitor?.available() === true; }
830
- hostHealthSnapshot() { return this.hostMonitor?.snapshot() ?? disabledHostHealth(); }
880
+ hostHealthSnapshotInternal() { return this.hostMonitor?.snapshot() ?? disabledHostHealth(); }
881
+ hostHealthSnapshot(agentOffset = 0) {
882
+ const snapshot = this.hostHealthSnapshotInternal(), reading = snapshot.footprint?.reading;
883
+ if (reading) {
884
+ const labels = this.hostFootprintLabels;
885
+ reading.rows = reading.rows.slice(agentOffset, agentOffset + 50).map(row => ({ ...row, label: labels?.get(row.id) ?? 'Agent' }));
886
+ Object.assign(reading, { offset: agentOffset, hasMore: agentOffset + 50 < reading.total });
887
+ }
888
+ return snapshot;
889
+ }
890
+ hostAlertSettings() { return structuredClone(this.hostAlertConfig); }
891
+ saveHostAlertSettings(input) {
892
+ const next = parseHostAlertSettings(input), resources = hostAlertResources(this.hostHealthSnapshot(), Date.now());
893
+ for (const [key, rule] of Object.entries(next.rules)) {
894
+ const resource = resources.find(r => r.key === key);
895
+ if (!resource) {
896
+ if (JSON.stringify(rule) === JSON.stringify(this.hostAlertConfig.rules[key]))
897
+ continue;
898
+ throw Error('invalid_alert_resource');
899
+ }
900
+ if (resource.kind !== rule.kind)
901
+ throw Error('invalid_alert_resource');
902
+ validateHostAlertRule(rule, resource.capacity);
903
+ }
904
+ writeHostAlertSettings(this.dataDir, next);
905
+ this.hostAlertConfig = next;
906
+ this.hostAlertSettingsFailed = false;
907
+ this.hostAlerts?.configure(this.fleetConfig?.monitoring?.enabled === true, next);
908
+ return this.hostAlertSettings();
909
+ }
910
+ hostAlertAction(key, revision, actor, snoozeMs) { return this.hostAlerts?.act(key, revision, actor, snoozeMs) ?? Promise.resolve(false); }
911
+ hostNeedsYouItems() {
912
+ const alerts = this.hostAlerts?.snapshot();
913
+ if (!alerts || alerts.state === 'off' || !alerts.needsYou)
914
+ return [];
915
+ if (alerts.state === 'failed')
916
+ return [{ id: 'host:unavailable', type: 'host', reason: 'host_health', instance: '', detail: 'Host alerts unavailable. Open Host health.', since: 0 }];
917
+ return alerts.active.map(record => ({ id: `host:${record.key}:${record.openedAt}`, type: 'host', reason: 'host_health', instance: '', detail: `${record.level}: ${record.kind}`, since: record.openedAt, hostAlert: record }));
918
+ }
831
919
  /** Effective Settings view: the drive is intentionally outside FleetConfig/fleet.yaml. */
832
920
  hostMonitoringSettings() {
833
921
  const drive = readHostMonitoringDrive(this.dataDir);
@@ -1386,7 +1474,7 @@ export class FleetManager {
1386
1474
  if (!current())
1387
1475
  throw Error("Native settings authority expired");
1388
1476
  runtime.previewUpdate(name, patch);
1389
- const cold = ["working_directory", "model", "systemPrompt", "native_sandbox"].some(key => Object.hasOwn(patch, key) && (patch[key] ?? "") !== (before[key] ?? ""));
1477
+ const cold = ["working_directory", "model", "systemPrompt", "operations", "native_sandbox"].some(key => Object.hasOwn(patch, key) && (patch[key] ?? "") !== (before[key] ?? ""));
1390
1478
  const running = this.daemons.get(name);
1391
1479
  if (cold) {
1392
1480
  if (running && !running.nativePaneHasExited() && (!await running.nativePauseReady({ current, accepts: () => true, revalidate: async () => current() }) || !running.nativePauseStillReady()))
@@ -1494,7 +1582,7 @@ export class FleetManager {
1494
1582
  const now = this.fleetConfig?.instances[name];
1495
1583
  if (this.shuttingDown || !isNativePaneInstance(now) || now?.native_agent_id !== config.native_agent_id
1496
1584
  || now?.machine_id !== config.machine_id || now?.working_directory !== config.working_directory || now?.backend !== config.backend
1497
- || now?.model !== config.model || now?.native_sandbox !== config.native_sandbox || now?.systemPrompt !== config.systemPrompt || now?.workflow !== config.workflow
1585
+ || now?.model !== config.model || now?.native_sandbox !== config.native_sandbox || now?.systemPrompt !== config.systemPrompt || now?.operations !== config.operations || now?.workflow !== config.workflow
1498
1586
  || now?.general_topic !== config.general_topic || now?.native_general_binding !== config.native_general_binding
1499
1587
  || nativeCredentialProfile(now) !== nativeCredentialProfile(config))
1500
1588
  throw Error("Native pane configuration or lifetime changed");
@@ -1525,7 +1613,7 @@ export class FleetManager {
1525
1613
  epoch: () => hub.paneTransportEpoch(machineId), version: provider => hub.machine(machineId)?.inventory?.clis.find(row => row.id === provider && row.runnable)?.version ?? null };
1526
1614
  },
1527
1615
  instructions: (name, config) => buildNativeFleetInstructions({ instanceName: name, workingDirectory: config.working_directory,
1528
- displayName: config.display_name, description: config.description, customPrompt: config.systemPrompt,
1616
+ displayName: config.display_name, description: config.description, customPrompt: config.systemPrompt, operations: config.operations,
1529
1617
  workflow: config.workflow, taskBoard: !dashboardRefusalIn(this.fleetConfig, name, "task"),
1530
1618
  runtimeIdentity: { kind: "fleet-topic", backend: config.backend ?? "codex", model: config.model || "default" } }, config.general_topic === true),
1531
1619
  menu: name => TOOLS.filter(tool => allowed(name, tool.name)).map(tool => ({ ...tool })),
@@ -2712,6 +2800,7 @@ export class FleetManager {
2712
2800
  },
2713
2801
  attachAgentIntro: port => { this.hubAgentIntro = port; },
2714
2802
  attachAgentRooms: port => { this.hubAgentRooms = port; this.notifyHubRoomTools(); },
2803
+ attachShareLapse: port => { this.hubShareLapse = port; this.needsYou?.poke(); },
2715
2804
  roomToolsChanged: () => this.notifyHubRoomTools(),
2716
2805
  roomConversationGeneration: agent => this.daemons.get(agent)?.roomConversationGeneration() ?? null,
2717
2806
  attachRoomInputs: handler => { this.hubRoomInput = handler; },
@@ -3277,6 +3366,7 @@ export class FleetManager {
3277
3366
  return this.daemons.get(name)?.bootId ?? null;
3278
3367
  }
3279
3368
  rawFleetConfig = {};
3369
+ sharedDefaultAdoption = new SharedDefaultAdoption();
3280
3370
  /**
3281
3371
  * AGEND-163: one agent's own saved settings, as fleet.yaml has them — not `fleetConfig.instances[name]`, which has the fleet's
3282
3372
  * defaults merged in. Undefined when fleet.yaml has no such agent.
@@ -3332,6 +3422,40 @@ export class FleetManager {
3332
3422
  hubDeliveryFailed = null;
3333
3423
  /** The connected member adapter; never an agent-selectable identity. */
3334
3424
  hubAgentRooms = null;
3425
+ /** M-3543: which shared agents' Hub shares lapsed (backend/folder changed since they were shared; #3147). */
3426
+ hubShareLapse = null;
3427
+ /** M-3543: when each lapse (agent + its incarnation) was first seen — the Needs-you item's "since". */
3428
+ hubShareLapseSeen = new Map();
3429
+ /** M-3543: the shared agents whose Hub share lapsed, for Needs you: one per agent and incarnation, until shared again. */
3430
+ hubShareLapses() {
3431
+ let agents = [];
3432
+ try {
3433
+ agents = this.hubShareLapse?.agents() ?? [];
3434
+ }
3435
+ catch {
3436
+ agents = [];
3437
+ }
3438
+ const incarnations = agents.length ? this.readHubIncarnations() : {};
3439
+ const live = new Set();
3440
+ const out = agents.map(agent => {
3441
+ const key = (Object.hasOwn(incarnations, agent) ? incarnations[agent]?.id : undefined) ?? "-", id = `${agent}\u0000${key}`;
3442
+ live.add(id);
3443
+ if (!this.hubShareLapseSeen.has(id))
3444
+ this.hubShareLapseSeen.set(id, Date.now());
3445
+ return { agent, key, since: this.hubShareLapseSeen.get(id) };
3446
+ });
3447
+ for (const id of [...this.hubShareLapseSeen.keys()])
3448
+ if (!live.has(id))
3449
+ this.hubShareLapseSeen.delete(id);
3450
+ return out;
3451
+ }
3452
+ /** M-3543: is this agent's Hub share lapsed now (shared, but its consent no longer matches it)? */
3453
+ hubShareLapsed(agent) { try {
3454
+ return this.hubShareLapse?.lapsed(agent) === true;
3455
+ }
3456
+ catch {
3457
+ return false;
3458
+ } }
3335
3459
  hubAgentIntro = null;
3336
3460
  hubSetIntro(caller, text, operationId) { return this.hubAgentIntro?.set(caller, text, operationId) ?? Promise.resolve({ ok: false, code: "unavailable" }); }
3337
3461
  hubRoomToolsAvailable() { return this.hubAgentRooms?.available() === true; }
@@ -6102,8 +6226,18 @@ export class FleetManager {
6102
6226
  throw Error("invalid-approver");
6103
6227
  if ((input.mode || input.roomTools) && !before.canSetMode)
6104
6228
  throw Error("forbidden");
6105
- if (input.grants?.some(grant => grant.target !== name || !this.webChatOwner(grant.source)
6106
- || Date.parse(grant.expiresAt) <= Date.now()))
6229
+ // Replacing the table may retain expired historical rows unchanged while editing/revoking another row.
6230
+ // Only an exact retained image is exempt; new or changed permissions still need a live source and future expiry.
6231
+ const grantImage = (grant) => JSON.stringify([grant.person.platform, grant.person.adapterId, grant.person.userId, grant.person.label,
6232
+ grant.source, grant.target, grant.verbs, grant.expiresAt, grant.remainingUses]);
6233
+ if (input.grants?.some(grant => {
6234
+ if (grant.target !== name)
6235
+ return true;
6236
+ const previous = before.grants.find(row => row.id === grant.id);
6237
+ if (previous && grantImage(previous) === grantImage(grant))
6238
+ return false;
6239
+ return !this.webChatOwner(grant.source) || Date.parse(grant.expiresAt) <= Date.now();
6240
+ }))
6107
6241
  throw Error("invalid-grant");
6108
6242
  // Configuration does not prove an external MCP's account independence. Preserve a conservative warning.
6109
6243
  if (input.roomTools)
@@ -6360,6 +6494,7 @@ export class FleetManager {
6360
6494
  onDaemonReady(name, daemonBootId) {
6361
6495
  const daemon = this.daemons.get(name);
6362
6496
  if (daemon?.bootId === daemonBootId) {
6497
+ daemon.setHostFootprintEnabled?.(this.hostFootprintEnabled);
6363
6498
  this.listenForWorkingState(name, daemon);
6364
6499
  const cfg = this.fleetConfig?.instances[name];
6365
6500
  if (cfg?.general_topic && !this.generalLocationFlights.has(name) && daemon.getProcessStatus() === "running"
@@ -7164,7 +7299,7 @@ export class FleetManager {
7164
7299
  * The returned promise is the caller's to handle; the stored one is already
7165
7300
  * handled, so a rejection never escapes as an unhandled rejection.
7166
7301
  */
7167
- startExclusiveReconcile(observer) {
7302
+ startExclusiveReconcile(observer, defaultConsent) {
7168
7303
  if (this.reconcileInFlight)
7169
7304
  return null;
7170
7305
  this.reloadPending = false;
@@ -7172,7 +7307,7 @@ export class FleetManager {
7172
7307
  const caller = new Promise((resolve, reject) => {
7173
7308
  settle = (err, outcome) => (err ? reject(err instanceof Error ? err : new Error(String(err))) : resolve(outcome ?? {}));
7174
7309
  });
7175
- this.reconcileInFlight = this.reconcileInstances(observer)
7310
+ this.reconcileInFlight = this.reconcileInstances(observer, defaultConsent)
7176
7311
  .then(outcome => settle(null, outcome), err => settle(err))
7177
7312
  .finally(() => {
7178
7313
  this.reconcileInFlight = null;
@@ -8105,14 +8240,15 @@ export class FleetManager {
8105
8240
  * setting as a value of its own rather than the shared login it would fall to.
8106
8241
  * A switch on the same backend that loses the conversation (kiro) starts fresh.
8107
8242
  */
8108
- classicProfileChange(name, backendChanged) {
8243
+ classicProfileChange(name, backendChanged, adoptedBackend) {
8109
8244
  const launched = this.classicLaunchedProfile(name);
8110
8245
  if (!launched || !this.classicChannels)
8111
8246
  return { changed: false, startsFresh: false };
8112
- const next = this.classicChannels.getCredentialProfileByInstance(name, this.fleetConfig?.defaults);
8247
+ const defaults = adoptedBackend ? { ...this.fleetConfig?.defaults, backend: adoptedBackend } : this.fleetConfig?.defaults;
8248
+ const next = this.classicChannels.getCredentialProfileByInstance(name, defaults);
8113
8249
  if (profileKey(launched) === profileKey(next))
8114
8250
  return { changed: false, startsFresh: false };
8115
- const backend = this.classicChannels.getBackendByInstance(name, this.fleetConfig?.defaults?.backend);
8251
+ const backend = adoptedBackend ?? this.classicChannels.getBackendByInstance(name, this.fleetConfig?.defaults?.backend);
8116
8252
  return {
8117
8253
  changed: true,
8118
8254
  // A backend change keeps its own (existing) restart semantics.
@@ -8227,7 +8363,7 @@ export class FleetManager {
8227
8363
  logSource(name) {
8228
8364
  const instances = this.fleetConfig?.instances ?? {};
8229
8365
  const config = Object.prototype.hasOwnProperty.call(instances, name) ? instances[name] : undefined;
8230
- const backend = config?.backend ?? (config ? null : this.classicRoomFor(name)?.backend) ?? this.fleetConfig?.defaults?.backend ?? "claude-code";
8366
+ const backend = this.pendingRuntimeIdentity(name)?.backend ?? config?.backend ?? (config ? null : this.classicRoomFor(name)?.backend) ?? this.fleetConfig?.defaults?.backend ?? "claude-code";
8231
8367
  const live = this.lifecycle.daemons.get(name)?.logTranscriptPath() ?? null;
8232
8368
  if (backend === "claude-code") {
8233
8369
  let path = live;
@@ -9898,7 +10034,7 @@ export class FleetManager {
9898
10034
  check();
9899
10035
  if (this.lifecycle.epochOf(instanceName) !== stoppedEpoch)
9900
10036
  throw new Error("Classic restart superseded by stop");
9901
- await this.startClassicInstance(instanceName, this.classicChannels.getBackendByInstance(instanceName, this.fleetConfig?.defaults?.backend), this.classicChannels.getPreTaskCommand(channel.channelId, channel.adapterId), this.classicChannels.getModel(channel.channelId, channel.adapterId, this.fleetConfig?.defaults?.model), this.classicChannels.getAutoPauseAfter(channel.channelId, channel.adapterId, this.fleetConfig?.defaults?.auto_pause_after), transition, execution);
10037
+ await this.startClassicInstance(instanceName, this.classicChannels.getBackendByInstance(instanceName, this.fleetConfig?.defaults?.backend), this.classicChannels.getPreTaskCommand(channel.channelId, channel.adapterId), this.classicChannels.getModel(channel.channelId, channel.adapterId, this.fleetConfig?.defaults?.model, this.fleetConfig?.defaults?.backend), this.classicChannels.getAutoPauseAfter(channel.channelId, channel.adapterId, this.fleetConfig?.defaults?.auto_pause_after), transition, execution);
9902
10038
  check();
9903
10039
  }
9904
10040
  /** Reload classicBot.yaml once. Kept callable so the periodic production
@@ -9915,8 +10051,9 @@ export class FleetManager {
9915
10051
  const oldToolProgress = new Map();
9916
10052
  const oldReplyGuard = new Map();
9917
10053
  for (const ch of this.classicChannels.getAll()) {
9918
- oldBackends.set(ch.instanceName, this.classicChannels.getBackendByInstance(ch.instanceName, fleetBackend));
9919
- oldModels.set(ch.instanceName, this.classicChannels.getModel(ch.channelId, ch.adapterId, fleetModel));
10054
+ const pending = this.pendingRuntimeIdentity(ch.instanceName);
10055
+ oldBackends.set(ch.instanceName, pending ? pending.backend || "claude-code" : this.classicChannels.getBackendByInstance(ch.instanceName, fleetBackend));
10056
+ oldModels.set(ch.instanceName, pending ? pending.model : this.classicChannels.getModel(ch.channelId, ch.adapterId, fleetModel, fleetBackend));
9920
10057
  oldAutoPause.set(ch.instanceName, this.classicChannels.getAutoPauseAfter(ch.channelId, ch.adapterId, this.fleetConfig?.defaults?.auto_pause_after));
9921
10058
  oldToolProgress.set(ch.instanceName, this.classicChannels.getToolProgress(ch.channelId, ch.adapterId, this.fleetConfig?.defaults?.tool_progress));
9922
10059
  oldReplyGuard.set(ch.instanceName, this.classicChannels.getReplyCompletionGuard(ch.channelId, ch.adapterId, this.fleetConfig?.defaults?.reply_completion_guard));
@@ -9928,8 +10065,12 @@ export class FleetManager {
9928
10065
  this.reportClassicUnrecoverableIds();
9929
10066
  this.reregisterClassicChannels();
9930
10067
  for (const ch of this.classicChannels.getAll()) {
9931
- const newBackend = this.classicChannels.getBackendByInstance(ch.instanceName, fleetBackend);
9932
- const newModel = this.classicChannels.getModel(ch.channelId, ch.adapterId, fleetModel);
10068
+ const adoption = this.sharedDefaultsView(ch.instanceName, {
10069
+ backend: this.classicChannels.getBackendByInstance(ch.instanceName, fleetBackend),
10070
+ model: this.classicChannels.getModel(ch.channelId, ch.adapterId, fleetModel, fleetBackend),
10071
+ });
10072
+ const newBackend = adoption.config.backend;
10073
+ const newModel = adoption.config.model;
9933
10074
  const newAutoPause = this.classicChannels.getAutoPauseAfter(ch.channelId, ch.adapterId, this.fleetConfig?.defaults?.auto_pause_after);
9934
10075
  const newToolProgress = this.classicChannels.getToolProgress(ch.channelId, ch.adapterId, this.fleetConfig?.defaults?.tool_progress);
9935
10076
  const newReplyGuard = this.classicChannels.getReplyCompletionGuard(ch.channelId, ch.adapterId, this.fleetConfig?.defaults?.reply_completion_guard);
@@ -9938,7 +10079,7 @@ export class FleetManager {
9938
10079
  const autoPauseChanged = oldAutoPause.get(ch.instanceName) !== newAutoPause;
9939
10080
  // #1220: a running CLI keeps the login it was launched with, so a new
9940
10081
  // credential_profile only takes effect through a restart.
9941
- const { changed: profileChanged, startsFresh: profileSwitchStartsFresh, from: profileFrom, to: profileTo, carry: profileCarry } = this.classicProfileChange(ch.instanceName, backendChanged);
10082
+ const { changed: profileChanged, startsFresh: profileSwitchStartsFresh, from: profileFrom, to: profileTo, carry: profileCarry } = this.classicProfileChange(ch.instanceName, backendChanged, adoption.deferred ? newBackend : undefined);
9942
10083
  if (this.daemons.has(ch.instanceName) && (backendChanged || modelChanged || autoPauseChanged || profileChanged)) {
9943
10084
  this.logger.info({ instanceName: ch.instanceName, backendFrom: oldBackends.get(ch.instanceName), backendTo: newBackend, modelFrom: oldModels.get(ch.instanceName), modelTo: newModel,
9944
10085
  ...(profileChanged ? { profileFrom, profileTo } : {}) }, "Backend/model/profile changed — restarting");
@@ -10081,14 +10222,14 @@ export class FleetManager {
10081
10222
  }
10082
10223
  }
10083
10224
  else if (!isWindowsInstance(config) && kind === "classic") {
10084
- // #2163: a Classic bot gets only the skills marked `classic` (its own look, the dashboard) — never the fleet's
10225
+ // #2163: a Classic bot gets only the skills marked `classic` (appearance only in legacy rooms) — never the fleet's
10085
10226
  // coordination playbooks (#557 kept those out of end-user bots) — and only into a workspace AgEnD manages: the
10086
10227
  // room's own folder under <AGEND_HOME>/workspaces/. Anywhere else, nothing is written; `agend-agent skill <name>`
10087
10228
  // reads any bundled skill on demand.
10088
10229
  try {
10089
10230
  const skillsWorkDir = this.resolveKnowledgeWorkDir(config.working_directory, backend, name);
10090
10231
  if (insideManagedWorkspaces(skillsWorkDir))
10091
- measureSyncWork("fleet.classicSkills", () => this.syncRoleSkills(skillsWorkDir, backend, "classic"));
10232
+ measureSyncWork("fleet.classicSkills", () => this.syncRoleSkills(skillsWorkDir, backend, "classic", undefined, this.classicContactRestricted(name)));
10092
10233
  else
10093
10234
  this.logger.debug({ name, skillsWorkDir }, "Classic workspace is not AgEnD-managed — no skills published");
10094
10235
  }
@@ -10166,7 +10307,7 @@ export class FleetManager {
10166
10307
  const channel = this.classicChannels?.getAll().find(item => item.instanceName === name);
10167
10308
  if (!channel || !this.classicChannels)
10168
10309
  throw new Error(`Paused instance '${name}' is no longer configured`);
10169
- await this.startClassicInstance(name, this.classicChannels.getBackendByInstance(name, this.fleetConfig?.defaults?.backend), this.classicChannels.getPreTaskCommand(channel.channelId, channel.adapterId), this.classicChannels.getModel(channel.channelId, channel.adapterId, this.fleetConfig?.defaults?.model), this.classicChannels.getAutoPauseAfter(channel.channelId, channel.adapterId, this.fleetConfig?.defaults?.auto_pause_after), transition);
10310
+ await this.startClassicInstance(name, this.classicChannels.getBackendByInstance(name, this.fleetConfig?.defaults?.backend), this.classicChannels.getPreTaskCommand(channel.channelId, channel.adapterId), this.classicChannels.getModel(channel.channelId, channel.adapterId, this.fleetConfig?.defaults?.model, this.fleetConfig?.defaults?.backend), this.classicChannels.getAutoPauseAfter(channel.channelId, channel.adapterId, this.fleetConfig?.defaults?.auto_pause_after), transition);
10170
10311
  }
10171
10312
  /**
10172
10313
  * Start instances with configurable concurrency and stagger delay.
@@ -10542,7 +10683,7 @@ export class FleetManager {
10542
10683
  const channel = this.classicChannels?.getAll().find(item => item.instanceName === name);
10543
10684
  if (!channel || !this.classicChannels)
10544
10685
  throw new Error(`Instance '${name}' is no longer configured`);
10545
- await this.startClassicInstance(name, this.classicChannels.getBackendByInstance(name, this.fleetConfig?.defaults?.backend), this.classicChannels.getPreTaskCommand(channel.channelId, channel.adapterId), this.classicChannels.getModel(channel.channelId, channel.adapterId, this.fleetConfig?.defaults?.model), this.classicChannels.getAutoPauseAfter(channel.channelId, channel.adapterId, this.fleetConfig?.defaults?.auto_pause_after));
10686
+ await this.startClassicInstance(name, this.classicChannels.getBackendByInstance(name, this.fleetConfig?.defaults?.backend), this.classicChannels.getPreTaskCommand(channel.channelId, channel.adapterId), this.classicChannels.getModel(channel.channelId, channel.adapterId, this.fleetConfig?.defaults?.model, this.fleetConfig?.defaults?.backend), this.classicChannels.getAutoPauseAfter(channel.channelId, channel.adapterId, this.fleetConfig?.defaults?.auto_pause_after));
10546
10687
  }
10547
10688
  /**
10548
10689
  * Unattended ClassicBot start (fleet startup batch, full-restart batch, the
@@ -10553,7 +10694,7 @@ export class FleetManager {
10553
10694
  */
10554
10695
  async startClassicInstanceUnattended(ch, what) {
10555
10696
  try {
10556
- await this.startClassicInstance(ch.instanceName, this.classicChannels.getBackendByInstance(ch.instanceName, this.fleetConfig?.defaults?.backend), this.classicChannels.getPreTaskCommand(ch.channelId, ch.adapterId), this.classicChannels.getModel(ch.channelId, ch.adapterId, this.fleetConfig?.defaults?.model), this.classicChannels.getAutoPauseAfter(ch.channelId, ch.adapterId, this.fleetConfig?.defaults?.auto_pause_after));
10697
+ await this.startClassicInstance(ch.instanceName, this.classicChannels.getBackendByInstance(ch.instanceName, this.fleetConfig?.defaults?.backend), this.classicChannels.getPreTaskCommand(ch.channelId, ch.adapterId), this.classicChannels.getModel(ch.channelId, ch.adapterId, this.fleetConfig?.defaults?.model, this.fleetConfig?.defaults?.backend), this.classicChannels.getAutoPauseAfter(ch.channelId, ch.adapterId, this.fleetConfig?.defaults?.auto_pause_after));
10557
10698
  return this.daemons.has(ch.instanceName);
10558
10699
  }
10559
10700
  catch (err) {
@@ -10565,15 +10706,13 @@ export class FleetManager {
10565
10706
  }
10566
10707
  }
10567
10708
  backendNameOf(name) {
10709
+ const pending = this.pendingRuntimeIdentity(name);
10710
+ if (pending)
10711
+ return pending.backend || "claude-code";
10568
10712
  const fleetDefault = this.fleetConfig?.defaults?.backend;
10569
10713
  const fleetInstance = this.fleetConfig?.instances[name];
10570
- // A malformed/manual config can give a fleet and Classic entry the same
10571
- // instance name. Fleet ownership wins, including its inherited default;
10572
- // otherwise a Classic override could make backend-scoped recovery restart
10573
- // the shared process under the wrong login result.
10574
10714
  if (fleetInstance)
10575
10715
  return fleetInstance.backend ?? fleetDefault ?? "claude-code";
10576
- // ClassicBot channels pick their own backend; the fleet default is only the fallback.
10577
10716
  if (this.classicChannels?.getAll().some(channel => channel.instanceName === name)) {
10578
10717
  return this.classicChannels.getBackendByInstance(name, fleetDefault);
10579
10718
  }
@@ -11077,7 +11216,7 @@ export class FleetManager {
11077
11216
  const backend = this.classicChannels.getBackendByInstance(name, fleetBackend);
11078
11217
  return { backend, profile: credentialHomeSpec(backend) ? profileName(this.classicChannels.getCredentialProfileByInstance(name, this.fleetConfig?.defaults)) : null };
11079
11218
  });
11080
- await this.startAfterRestart(name, wasPaused, pausedAt, pauseReason, () => this.startClassicInstance(name, this.classicChannels.getBackendByInstance(name, fleetBackend), this.classicChannels.getPreTaskCommand(channelId, adapterId), this.classicChannels.getModel(channelId, adapterId, this.fleetConfig?.defaults?.model), this.classicChannels.getAutoPauseAfter(channelId, adapterId, this.fleetConfig?.defaults?.auto_pause_after), transition));
11219
+ await this.startAfterRestart(name, wasPaused, pausedAt, pauseReason, () => this.startClassicInstance(name, this.classicChannels.getBackendByInstance(name, fleetBackend), this.classicChannels.getPreTaskCommand(channelId, adapterId), this.classicChannels.getModel(channelId, adapterId, this.fleetConfig?.defaults?.model, this.fleetConfig?.defaults?.backend), this.classicChannels.getAutoPauseAfter(channelId, adapterId, this.fleetConfig?.defaults?.auto_pause_after), transition));
11081
11220
  this.stormWindow.markRecovered(name);
11082
11221
  return;
11083
11222
  }
@@ -18043,7 +18182,7 @@ export class FleetManager {
18043
18182
  if (stray)
18044
18183
  throw new Error(`Refusing to save fleet.yaml: this change would also change ${stray}, which shares a value with what it edits. Give each its own value in fleet.yaml.`);
18045
18184
  noteSettingsWrite(this.configPath, this.savedFleetConfigSnapshot, this.fleetConfig);
18046
- const output = String(this.rawFleetDocument);
18185
+ const output = stringifyFleetYaml(this.rawFleetDocument, source);
18047
18186
  if (redundantPaths.length > 0)
18048
18187
  this.writeFleetConfigBackup(source);
18049
18188
  // Atomic write with fsync. The beforeRename hook runs after fsync and
@@ -18082,6 +18221,7 @@ export class FleetManager {
18082
18221
  Object.assign(current, resolved);
18083
18222
  }
18084
18223
  const previousCatalogConfig = this.savedFleetConfigSnapshot;
18224
+ this.trackSharedDefaultChanges(previousCatalogConfig);
18085
18225
  this.savedFleetConfigSnapshot = structuredClone(this.fleetConfig);
18086
18226
  this.nativeMcpStore?.observePolicies();
18087
18227
  this.probeChangedCliEnvs(previousCatalogConfig);
@@ -18092,6 +18232,61 @@ export class FleetManager {
18092
18232
  this.observeHubSwitches(); // S-51: so does a saved Hub switch
18093
18233
  this.hostMonitor?.apply();
18094
18234
  }
18235
+ sharedIdentitySource(name) {
18236
+ const own = this.rawFleetConfig.instances?.[name];
18237
+ if (own || this.fleetConfig?.instances[name])
18238
+ return JSON.stringify([own?.backend ?? null, own?.model ?? null]);
18239
+ const ch = this.classicChannels?.getAll().find(c => c.instanceName === name);
18240
+ const defaults = this.classicChannels?.getDefaults();
18241
+ return JSON.stringify([ch?.backend ?? null, ch?.model ?? null, defaults?.backend ?? null, defaults?.model ?? null]);
18242
+ }
18243
+ sharedDefaultsView(name, config, consent) {
18244
+ return this.sharedDefaultAdoption.view(name, this.daemons.get(name), config, this.lifecycle.isPaused(name) ? undefined : consent, this.sharedIdentitySource(name), this.daemons.get(name)?.getConfigSnapshot?.());
18245
+ }
18246
+ pendingRuntimeIdentity(name) {
18247
+ if (!this.sharedDefaultAdoption?.has(name))
18248
+ return undefined;
18249
+ const daemon = this.daemons.get(name);
18250
+ if (!daemon)
18251
+ return undefined;
18252
+ let desired = this.fleetConfig?.instances[name];
18253
+ if (!desired) {
18254
+ const ch = this.classicChannels?.getAll().find(c => c.instanceName === name);
18255
+ if (!ch)
18256
+ return undefined;
18257
+ const defaults = this.fleetConfig?.defaults;
18258
+ const identity = { backend: this.classicChannels.getBackend(ch.channelId, ch.adapterId, defaults?.backend),
18259
+ model: this.classicChannels.getModel(ch.channelId, ch.adapterId, defaults?.model, defaults?.backend) };
18260
+ return this.sharedDefaultsView(name, identity).deferred ? daemon.getConfigSnapshot?.() : undefined;
18261
+ }
18262
+ return this.sharedDefaultsView(name, desired).deferred ? daemon.getConfigSnapshot?.() : undefined;
18263
+ }
18264
+ /** A save is not a restart consent. Remember shared identity edits until the
18265
+ * current runtime ends (or an apply explicitly chooses to restart it). */
18266
+ trackSharedDefaultChanges(previous) {
18267
+ const next = this.fleetConfig;
18268
+ if (!previous || !next || (previous.defaults.backend === next.defaults.backend
18269
+ && previous.defaults.model === next.defaults.model))
18270
+ return;
18271
+ for (const [name, config] of Object.entries(next.instances)) {
18272
+ const old = previous.instances[name];
18273
+ if (!old || (old.backend === config.backend && old.model === config.model))
18274
+ continue;
18275
+ const daemon = this.daemons.get(name);
18276
+ this.sharedDefaultAdoption.track(name, daemon, daemon?.getConfigSnapshot?.() ?? old, config, this.sharedIdentitySource(name));
18277
+ }
18278
+ for (const ch of this.classicChannels?.getAll() ?? []) {
18279
+ const values = (defaults) => ({
18280
+ backend: this.classicChannels.getBackend(ch.channelId, ch.adapterId, defaults.backend),
18281
+ model: this.classicChannels.getModel(ch.channelId, ch.adapterId, defaults.model, defaults.backend),
18282
+ });
18283
+ const old = values(previous.defaults), desired = values(next.defaults);
18284
+ if (old.backend === desired.backend && old.model === desired.model)
18285
+ continue;
18286
+ const daemon = this.daemons.get(ch.instanceName);
18287
+ this.sharedDefaultAdoption.track(ch.instanceName, daemon, daemon?.getConfigSnapshot?.() ?? old, desired, this.sharedIdentitySource(ch.instanceName));
18288
+ }
18289
+ }
18095
18290
  /** A permission tightening is effective when its save returns, independently of the later apply job or IPC. */
18096
18291
  refreshSavedDashboardPermissions() {
18097
18292
  if (!this.fleetConfig)
@@ -19471,7 +19666,7 @@ export class FleetManager {
19471
19666
  return;
19472
19667
  const m = this.webChatHistory.setDelivery(instanceName, messageId, status);
19473
19668
  if (m)
19474
- this.emitSseEvent("delivery", { instance: instanceName, messageId, delivery: m.delivery });
19669
+ this.emitSseEvent("delivery", { instance: instanceName, messageId, delivery: m.delivery, ...(m.retry ? { boot: m.boot, id: m.id, retry: m.retry } : {}) });
19475
19670
  }
19476
19671
  /**
19477
19672
  * Apply a terminal delivery verdict. On Telegram the built-in delivered is
@@ -20276,7 +20471,7 @@ export class FleetManager {
20276
20471
  entry.web = {
20277
20472
  text: web.text,
20278
20473
  ...(links ? { links } : {}),
20279
- actions: [...opts.choices.map(c => ({ id: c.action, label: c.label })), ...(opts.webInput ? [{ id: opts.webInput.action, label: opts.webInput.label, input: true }] : [])],
20474
+ actions: [...opts.choices.map(c => ({ id: c.action, label: c.label, ...(c.confirmation ? { confirmation: c.confirmation } : {}) })), ...(opts.webInput ? [{ id: opts.webInput.action, label: opts.webInput.label, input: true }] : [])],
20280
20475
  expiresAt: Date.now() + (opts.timeoutMs ?? NONCE_BUTTON_TIMEOUT_MS),
20281
20476
  };
20282
20477
  this.emitSseEvent("prompt", { instance: entry.instanceName, nonce, ...entry.web });
@@ -20832,6 +21027,7 @@ export class FleetManager {
20832
21027
  return owner !== undefined && this.worlds.has(owner) ? owner : undefined;
20833
21028
  };
20834
21029
  this.needsYou = new NeedsYouHub({
21030
+ hostAlerts: () => this.hostNeedsYouItems(),
20835
21031
  contactSuggestions: () => this.contactSuggestions(),
20836
21032
  dataDir: this.dataDir,
20837
21033
  now: () => Date.now(),
@@ -20840,10 +21036,10 @@ export class FleetManager {
20840
21036
  clearTimer: h => clearTimeout(h),
20841
21037
  prompts: () => this.needsYouPrompts(),
20842
21038
  instances: () => this.needsYouInstances(),
20843
- deliveries: since => (this.deliveryOutbox?.isOpen ? this.deliveryOutbox.needsAttention(since) : []).map(d => ({
20844
- deliveryId: d.deliveryId, state: d.state, source: d.sourceInstance, target: d.targetInstance, kind: d.kind,
20845
- finishedAt: Date.parse(d.finishedAt) || 0,
20846
- })),
21039
+ deliveries: since => [...(this.deliveryOutbox?.isOpen ? this.deliveryOutbox.needsAttention(since) : []).map(d => ({
21040
+ deliveryId: d.deliveryId, state: d.state, source: d.sourceInstance, target: d.targetInstance, kind: d.kind,
21041
+ finishedAt: Date.parse(d.finishedAt) || 0,
21042
+ })), ...this.webChatHistory.failedWebDeliveries(Date.parse(since) || 0)].sort((a, b) => b.finishedAt - a.finishedAt).slice(0, 50),
20847
21043
  ownerOf,
20848
21044
  worlds: () => [...this.worlds.values()].map((w) => ({ id: w.id, adapter: w.adapter, place: worldPlaceOf(w) })),
20849
21045
  noticeTarget: world => {
@@ -20864,6 +21060,8 @@ export class FleetManager {
20864
21060
  fleetAdmins: world => (this.getChannelConfig(world)?.access?.allowed_users ?? []).map(String),
20865
21061
  emitSse: (event, data) => this.emitSseEvent(event, data),
20866
21062
  acknowledge: (deliveryId, by) => {
21063
+ if (deliveryId.startsWith("web:"))
21064
+ return this.webChatHistory.acknowledgeWebDelivery(deliveryId);
20867
21065
  if (!this.deliveryOutbox?.isOpen)
20868
21066
  throw new Error("the delivery outbox is not open");
20869
21067
  return this.deliveryOutbox.acknowledge(deliveryId, by);
@@ -20876,6 +21074,7 @@ export class FleetManager {
20876
21074
  backendSignIns: () => this.needsYouBackendSignIns(),
20877
21075
  signInKeepAlive: () => this.keepAliveAttention(),
20878
21076
  hubExecution: () => this.hubExecutionAttention?.() ?? [],
21077
+ hubShareLapses: () => this.hubShareLapses(),
20879
21078
  runtimeUpdates: () => remoteRuntimeEnabled() ? runtimeUpdateAttention(this.runtimeHub?.listMachines() ?? [], t, this.worlds.keys().next().value) : [],
20880
21079
  hubHolds: () => this.hubHolds.map(h => {
20881
21080
  // A provider hold carries a bounded setup reason; its guidance (S4b's copy) when present, else the code's text.
@@ -23073,9 +23272,7 @@ export class FleetManager {
23073
23272
  await data.respond(t("filename.invalid"));
23074
23273
  return;
23075
23274
  }
23076
- const backend = target.kind === "classic"
23077
- ? this.classicChannels.getBackendByInstance(target.name, this.fleetConfig?.defaults?.backend)
23078
- : (this.fleetConfig?.instances[target.name]?.backend ?? this.fleetConfig?.defaults?.backend ?? "claude-code");
23275
+ const backend = this.backendNameForInstance(target.name);
23079
23276
  // force (-f) is only meaningful for kiro/classic /chat save.
23080
23277
  const force = target.kind === "classic" && !!data.options?.force;
23081
23278
  const cmd = saveCommandForBackend(backend, filename, force);
@@ -24682,7 +24879,7 @@ export class FleetManager {
24682
24879
  const room = this.classicChannels?.getAll().find(room => room.instanceName === record.name);
24683
24880
  if (!room)
24684
24881
  throw new ClaudeCredentialError("conflict");
24685
- await this.startClassicInstance(record.name, this.classicChannels.getBackendByInstance(record.name, this.fleetConfig?.defaults?.backend), this.classicChannels.getPreTaskCommand(room.channelId, room.adapterId), this.classicChannels.getModel(room.channelId, room.adapterId, this.fleetConfig?.defaults?.model), this.classicChannels.getAutoPauseAfter(room.channelId, room.adapterId, this.fleetConfig?.defaults?.auto_pause_after), handles.get(record.name), execution);
24882
+ await this.startClassicInstance(record.name, this.classicChannels.getBackendByInstance(record.name, this.fleetConfig?.defaults?.backend), this.classicChannels.getPreTaskCommand(room.channelId, room.adapterId), this.classicChannels.getModel(room.channelId, room.adapterId, this.fleetConfig?.defaults?.model, this.fleetConfig?.defaults?.backend), this.classicChannels.getAutoPauseAfter(room.channelId, room.adapterId, this.fleetConfig?.defaults?.auto_pause_after), handles.get(record.name), execution);
24686
24883
  }
24687
24884
  }
24688
24885
  finally {
@@ -26191,7 +26388,7 @@ export class FleetManager {
26191
26388
  /** Push an SSE event to all connected Web UI clients. */
26192
26389
  emitSseEvent(event, data) {
26193
26390
  // #1386: a prompt opened or closed, or an instance's state moved — "Needs you" may have changed.
26194
- if (event === "prompt" || event === "prompt_resolved" || event === "activity")
26391
+ if (event === "prompt" || event === "prompt_resolved" || event === "activity" || event === "delivery")
26195
26392
  this.needsYou?.poke();
26196
26393
  const onError = (err) => this.logger.debug({ err }, "SSE client write failed; evicting");
26197
26394
  if (event === "message" && data && typeof data === "object") {
@@ -26205,6 +26402,7 @@ export class FleetManager {
26205
26402
  messageId: typeof m.messageId === "string" ? m.messageId : undefined,
26206
26403
  anchor: typeof m.anchor === "string" ? m.anchor : undefined,
26207
26404
  role: typeof m.role === "string" ? m.role : undefined,
26405
+ retryOwner: m.retryOwner,
26208
26406
  buttons: m.buttons,
26209
26407
  previews: m.previews,
26210
26408
  click: m.click,
@@ -26246,17 +26444,24 @@ export class FleetManager {
26246
26444
  db.board.setCardLimit((name) => boardCardLimit(this.fleetConfig, name));
26247
26445
  // An instance with the task board switched off is handed no cards and sent no notices (read at each write and wake).
26248
26446
  db.board.setBoardOff((name) => taskBoardOffIn(this.fleetConfig, name));
26447
+ // Comments and @mentions wake (docs/design/task-board.md): the fleet's instance names, and its switch, read at each comment.
26448
+ db.board.setCommentRouting({
26449
+ instances: () => Object.keys(this.fleetConfig?.instances ?? {}),
26450
+ enabled: () => boardCommentWakesOn(this.fleetConfig),
26451
+ });
26452
+ // Following a card (docs/design/task-board.md): the switch and the board's leader, read at each write.
26453
+ db.board.setProgressRouting({
26454
+ enabled: () => boardProgressWakesOn(this.fleetConfig),
26455
+ leader: () => boardLeader(this.fleetConfig),
26456
+ });
26457
+ // An agent's words reach another instance by the board (a comment, an @mention, a follower's progress) only as its
26458
+ // contact rules allow, as a peer message does (M-3160 / M-3384): asked as it writes and again as the notice goes out.
26459
+ db.board.setContactGate((source, target) => this.taskBoardMayReach(source, target));
26249
26460
  const waker = this.taskBoardWaker = new TaskBoardWaker({
26250
- deliver: (instance, message, key) => this.admitTaskBoardNotice(instance, message, key),
26461
+ deliver: (instance, message, key, origins) => this.admitTaskBoardNotice(instance, message, key, origins),
26462
+ mayReach: (source, target) => this.taskBoardMayReach(source, target),
26251
26463
  isInstance: (name) => this.fleetConfig?.instances?.[name] != null,
26252
26464
  boardOff: (name) => taskBoardOffIn(this.fleetConfig, name),
26253
- // #2785 (c), #2801: the maker's own message already told it; the board's line would repeat it.
26254
- messagedAbout: (from, to, codes, sinceMs) => {
26255
- const outbox = this.deliveryOutbox;
26256
- if (!outbox?.isOpen)
26257
- return false;
26258
- return outbox.recentTextsFrom(to, from, new Date(sinceMs).toISOString()).some((text) => codes.some((code) => namesCard(text, code)));
26259
- },
26260
26465
  // #2801: a notice still waiting whose cards have all changed again is not delivered.
26261
26466
  withdraw: (prefix, stale, reason) => {
26262
26467
  const outbox = this.deliveryOutbox;
@@ -26286,21 +26491,68 @@ export class FleetManager {
26286
26491
  this.observeWorkingState(name, "tasks");
26287
26492
  this.emitSseEvent("tasks", { rev, ids, projects });
26288
26493
  waker.changed(changed);
26289
- waker.note(wakes);
26494
+ waker.note(this.withWriterOrigins(wakes));
26290
26495
  // step 3: cards waiting for the person are Needs you items; #2355 review: a project's lead routes them too.
26291
26496
  if (ids.length || projects)
26292
26497
  this.needsYou?.poke();
26293
26498
  });
26294
26499
  }
26295
- /** A task board notice, as AgEnD's own (not a person's words): through the delivery outbox, held until delivered. */
26296
- admitTaskBoardNotice(instance, message, key) {
26500
+ /**
26501
+ * A task board notice, as AgEnD's own: through the delivery outbox, held until delivered. `origins`: the writers whose
26502
+ * own words it carries (a comment, a mention, a follower's progress) with their contact origin as they wrote; the
26503
+ * instance inherits each, as admitDurableDelivery does for a peer's message, so the words do not shed the origin.
26504
+ */
26505
+ admitTaskBoardNotice(instance, message, key, origins = {}) {
26297
26506
  this.ensureDeliveryOutbox();
26298
26507
  const outbox = this.deliveryOutbox;
26299
26508
  if (!outbox)
26300
26509
  return false;
26510
+ const inherited = Object.values(origins).flat().filter((o) => !!o && typeof o === "object" && Array.isArray(o.chain));
26511
+ if (inherited.length) {
26512
+ const store = this.contactService().host.store;
26513
+ for (const origin of inherited)
26514
+ store.inheritOrigin(instance, { ...origin, chain: [...origin.chain, instance] });
26515
+ }
26301
26516
  outbox.admitSystemNotice(instance, key, message, new Date());
26302
26517
  return true;
26303
26518
  }
26519
+ /**
26520
+ * Whether `source`'s words may reach `target` by the task board on their own: the rules a peer message meets before it
26521
+ * is admitted — no active Hub contact restriction (M-3160: send_to_instance and broadcast refuse it, whatever the
26522
+ * origin; #4367 review) and no retained origin that needs a contact application (M-3384, ContactAuthService.
26523
+ * needsApplication). A board notice is never an application, so what needs one is not sent and its writer is told to
26524
+ * use send_to_instance. A standing grant is not read here: it is honoured there. Fails closed.
26525
+ */
26526
+ taskBoardMayReach(source, _target) {
26527
+ try {
26528
+ return !this.hubContactRestricted(source) && !this.contactService().needsApplication(source);
26529
+ }
26530
+ catch {
26531
+ return false;
26532
+ }
26533
+ }
26534
+ /** The board's wakes as the write commits, each writer whose words they carry stamped with its contact origin now. */
26535
+ withWriterOrigins(wakes) {
26536
+ if (!wakes.some((w) => w.principals?.length))
26537
+ return [...wakes];
26538
+ let service;
26539
+ try {
26540
+ service = this.contactService();
26541
+ }
26542
+ catch {
26543
+ return [...wakes];
26544
+ }
26545
+ return wakes.map((w) => {
26546
+ if (!w.principals?.length)
26547
+ return w;
26548
+ const origins = {};
26549
+ for (const p of w.principals) {
26550
+ const o = service.host.legacyClassic?.(p) ? undefined : service.origin(p);
26551
+ origins[p] = o ? [o] : [];
26552
+ }
26553
+ return { ...w, origins };
26554
+ });
26555
+ }
26304
26556
  listClaimedTasks(assignee) {
26305
26557
  try {
26306
26558
  return this.scheduler?.db.listTasks({ assignee, status: "claimed" }) ?? [];
@@ -26402,19 +26654,8 @@ export class FleetManager {
26402
26654
  return true;
26403
26655
  }
26404
26656
  // ── Topic icon + auto-archive ─────────────────────────────────────────────
26405
- static INSTRUCTIONS_FILENAME = {
26406
- "claude-code": "CLAUDE.md",
26407
- "codex": "AGENTS.md",
26408
- "opencode": "AGENTS.md",
26409
- "kiro-cli": ".kiro/steering/project.md",
26410
- // Grok reads AGENTS.md project docs; agy reads .agents/AGENTS.md (board 0340ec89: not the lowercase name) — the
26411
- // same files their writeConfig() appends fleet instructions to.
26412
- "grok": "AGENTS.md",
26413
- // muse init scaffolds AGENTS.md and the binary reads it as project rules.
26414
- "muse": "AGENTS.md",
26415
- "antigravity": ".agents/AGENTS.md",
26416
- "mock": "CLAUDE.md",
26417
- };
26657
+ /** Each CLI's project instructions file (one table, shared with the Details size card: instruction-file-sizes.ts). */
26658
+ static INSTRUCTIONS_FILENAME = Object.fromEntries(Object.entries(INSTRUCTIONS_FILE).map(([id, e]) => [id, e.file]));
26418
26659
  static GENERAL_INSTRUCTIONS = GENERAL_ROLE_INSTRUCTIONS;
26419
26660
  /** Ensure the general instance has its project instructions file + knowledge */
26420
26661
  ensureGeneralInstructions(workDir, backendName, instanceName) {
@@ -26433,9 +26674,27 @@ export class FleetManager {
26433
26674
  // #1914 review: a person's dangling symlink there is kept and not followed (nothing created where it points).
26434
26675
  this.logger.warn({ filePath }, "General's agy instructions file is a dangling symlink; left as it is, not written");
26435
26676
  }
26436
- else if (!existsSync(filePath)) {
26437
- writeFileSync(filePath, FleetManager.GENERAL_INSTRUCTIONS, "utf-8");
26438
- this.logger.info({ filePath }, "Created general instance instructions file");
26677
+ else {
26678
+ // M-3529: the role text is a managed block, replaced on every sync like the core rules, so existing Generals get
26679
+ // wording updates; AgEnD's earlier unmarked copy is adopted, and a person's own coordinator text is kept.
26680
+ let existing = null, readable = true;
26681
+ try {
26682
+ existing = existsSync(filePath) ? readFileSync(filePath, "utf-8") : null;
26683
+ }
26684
+ catch {
26685
+ readable = false;
26686
+ }
26687
+ if (!readable)
26688
+ this.logger.warn({ filePath }, "General's instructions file could not be read; its role text was left as it is");
26689
+ else {
26690
+ const { text, placement } = placeGeneralRole(existing, FleetManager.GENERAL_INSTRUCTIONS);
26691
+ if (text !== existing)
26692
+ writeFileSync(filePath, text, "utf-8");
26693
+ if (placement === "customized")
26694
+ this.logger.warn({ filePath }, "General's instructions file has its own coordinator text, so AgEnD's role block was not added; remove that text to receive role updates");
26695
+ else if (placement !== "unchanged")
26696
+ this.logger.info({ filePath, placement }, "General's role text synced");
26697
+ }
26439
26698
  }
26440
26699
  // Sync bundled knowledge files to general's steering and skills directories.
26441
26700
  this.syncGeneralKnowledge(workDir, backend);
@@ -26484,7 +26743,7 @@ export class FleetManager {
26484
26743
  this.logger.debug({ knowledgeDir, workDir, backend }, "Synced general knowledge files");
26485
26744
  }
26486
26745
  /** Publish only the bundled skills eligible for an instance role. */
26487
- syncRoleSkills(workDir, backend, role, knowledgeDir) {
26746
+ syncRoleSkills(workDir, backend, role, knowledgeDir, restrictedClassic = false) {
26488
26747
  const skillSegments = FleetManager.SKILLS_DIR_SEGMENTS[backend];
26489
26748
  if (!skillSegments)
26490
26749
  return;
@@ -26499,7 +26758,7 @@ export class FleetManager {
26499
26758
  this.syncManagedSkills(join(workDir, ...skillSegments), join(root, "skills"), role, adoptLegacyUnmanaged,
26500
26759
  // #2163: a Classic bot's skills folder (or a skill in it) may be a link out of its workspace; every path is
26501
26760
  // checked where it really lands, just before it is written.
26502
- role === "classic" ? (path) => insideManagedWorkspaces(path) : undefined);
26761
+ role === "classic" ? (path) => insideManagedWorkspaces(path) : undefined, role === "classic" && restrictedClassic ? new Set(["persona-emoji", "web-appearance"]) : undefined);
26503
26762
  this.logger.debug({ workDir, backend, role }, "Synced role-based bundled skills");
26504
26763
  }
26505
26764
  /**
@@ -26626,7 +26885,7 @@ export class FleetManager {
26626
26885
  catch { /* said this time; said again next start */ }
26627
26886
  this.logger.warn({ skills: names, destSkills }, "Skipping bundled skills — skills of these names exist but were not published by AgEnD");
26628
26887
  }
26629
- syncManagedSkills(destSkills, srcSkills, role, adoptLegacyUnmanaged = false, confined) {
26888
+ syncManagedSkills(destSkills, srcSkills, role, adoptLegacyUnmanaged = false, confined, excluded) {
26630
26889
  if (!existsSync(srcSkills))
26631
26890
  return;
26632
26891
  const refuse = (path) => {
@@ -26669,6 +26928,8 @@ export class FleetManager {
26669
26928
  }
26670
26929
  }
26671
26930
  const eligible = bundled.filter(name => {
26931
+ if (excluded?.has(name))
26932
+ return false;
26672
26933
  const roles = this.readManagedSkillRoles(join(srcSkills, name, "SKILL.md"));
26673
26934
  // General is the coordinator and receives every playbook. Workers and Classic bots receive only skills
26674
26935
  // explicitly marked for their role (#2163).
@@ -27328,7 +27589,9 @@ export class FleetManager {
27328
27589
  */
27329
27590
  claudeModelKnown(instanceName, model,
27330
27591
  /** #1806: null on a switch INTO claude-code — the configured model then belongs to the backend being left. */
27331
- configured = this.fleetConfig?.instances[instanceName]?.model ?? this.fleetConfig?.defaults?.model) {
27592
+ configured = this.pendingRuntimeIdentity(instanceName)
27593
+ ? this.pendingRuntimeIdentity(instanceName)?.model
27594
+ : this.fleetConfig?.instances[instanceName]?.model ?? scopedDefaultModel(this.backendNameForInstance(instanceName), this.fleetConfig?.defaults)) {
27332
27595
  const aliases = ["default", "sonnet", "opus", "haiku", "opusplan", "Fable"];
27333
27596
  const api = (this.webModelEnv("claude-code", instanceName)?.apiModels ?? []).map(m => m.id);
27334
27597
  const lower = model.trim().toLowerCase();
@@ -27350,9 +27613,12 @@ export class FleetManager {
27350
27613
  }
27351
27614
  /** Resolve the backend name configured for an instance (fleet or classic). */
27352
27615
  backendNameForInstance(instanceName) {
27616
+ const pending = this.pendingRuntimeIdentity(instanceName);
27617
+ if (pending)
27618
+ return pending.backend || "claude-code";
27353
27619
  const fleetCfg = this.fleetConfig?.instances[instanceName];
27354
- if (fleetCfg?.backend)
27355
- return fleetCfg.backend;
27620
+ if (fleetCfg)
27621
+ return fleetCfg.backend || this.fleetConfig?.defaults?.backend || "claude-code";
27356
27622
  const classic = this.classicChannels?.getChannelIdByInstance(instanceName) !== undefined
27357
27623
  ? this.classicChannels?.getBackendByInstance(instanceName, this.fleetConfig?.defaults?.backend)
27358
27624
  : undefined;
@@ -27553,19 +27819,29 @@ export class FleetManager {
27553
27819
  : source === "unresolved" ? `default (${reason ?? "unresolved"})`
27554
27820
  : model,
27555
27821
  });
27822
+ const pending = this.pendingRuntimeIdentity(instanceName);
27823
+ if (pending?.model)
27824
+ return done(pending.model, "fleet-default", "saved shared default waits for next restart");
27556
27825
  const fleetInstance = this.fleetConfig?.instances[instanceName];
27826
+ if (pending) {
27827
+ const cliEnv = this.readCliEnv(pending.backend || "claude-code");
27828
+ return cliEnv?.currentModel ? done(cliEnv.currentModel, "cli-default")
27829
+ : done("default", "unresolved", "saved shared default waits for next restart");
27830
+ }
27557
27831
  if (isWindowsInstance(fleetInstance))
27558
27832
  return fleetInstance.model?.trim() ? done(fleetInstance.model.trim(), "instance") : done("default", "unresolved", "this CLI does not report a default");
27559
27833
  if (fleetInstance) {
27560
- if (fleetInstance.model?.trim())
27561
- return done(fleetInstance.model.trim(), "instance");
27562
- const fleetDefault = this.fleetConfig?.defaults?.model;
27834
+ const own = this.rawFleetConfig.instances?.[instanceName];
27835
+ const model = own ? own.model : fleetInstance.model;
27836
+ if (model?.trim())
27837
+ return done(model.trim(), "instance");
27838
+ const fleetDefault = scopedDefaultModel(this.backendNameForInstance(instanceName), this.fleetConfig?.defaults);
27563
27839
  if (fleetDefault?.trim())
27564
27840
  return done(fleetDefault.trim(), "fleet-default");
27565
27841
  }
27566
27842
  const classic = this.classicChannels?.getAll().find(ch => ch.instanceName === instanceName);
27567
27843
  if (classic) {
27568
- const classicModel = this.classicChannels?.getModel(classic.channelId, classic.adapterId, this.fleetConfig?.defaults?.model);
27844
+ const classicModel = this.classicChannels?.getModel(classic.channelId, classic.adapterId, this.fleetConfig?.defaults?.model, this.fleetConfig?.defaults?.backend);
27569
27845
  if (classicModel?.trim())
27570
27846
  return done(classicModel.trim(), "classic");
27571
27847
  }
@@ -29202,9 +29478,9 @@ export class FleetManager {
29202
29478
  const saved = await switchClassicRoomBackend(this, room, plan, from, stillCurrent);
29203
29479
  if (!saved.ok)
29204
29480
  return t("backend.failed", instanceName, plan.backend, saved.error);
29205
- return this.getInstanceStatus(instanceName) === "running"
29481
+ return this.withHubShareLapse(instanceName, this.getInstanceStatus(instanceName) === "running"
29206
29482
  ? t("backend.switched", instanceName, plan.backend, shown.model, shown.effort)
29207
- : t("backend.switched_not_running", instanceName, plan.backend, shown.model, shown.effort, this.getInstanceStatus(instanceName));
29483
+ : t("backend.switched_not_running", instanceName, plan.backend, shown.model, shown.effort, this.getInstanceStatus(instanceName)));
29208
29484
  }
29209
29485
  const { value, error } = await new Promise(resolve => {
29210
29486
  applyInstanceConfigPatch(this, instanceName, { backend: plan.backend, model: plan.model, effort: plan.effort }, (value, error) => resolve({ value, error }));
@@ -29215,8 +29491,12 @@ export class FleetManager {
29215
29491
  if (result.warning)
29216
29492
  return t("backend.restart_failed", instanceName, plan.backend, result.warning);
29217
29493
  if (result.restarted)
29218
- return t("backend.switched", instanceName, plan.backend, shown.model, shown.effort);
29219
- return t("backend.switched_not_running", instanceName, plan.backend, shown.model, shown.effort, this.getInstanceStatus(instanceName));
29494
+ return this.withHubShareLapse(instanceName, t("backend.switched", instanceName, plan.backend, shown.model, shown.effort));
29495
+ return this.withHubShareLapse(instanceName, t("backend.switched_not_running", instanceName, plan.backend, shown.model, shown.effort, this.getInstanceStatus(instanceName)));
29496
+ }
29497
+ /** M-3543: a switched agent that is shared on the Hub needs sharing again (#3147: consent never carries over) — say so. */
29498
+ withHubShareLapse(instanceName, text) {
29499
+ return this.hubShareLapsed(instanceName) ? `${text}\n${t("backend.hub_share_lapsed", instanceName)}` : text;
29220
29500
  }
29221
29501
  /** A step's buttons: index callbacks (a model id can be longer than Telegram's 64-byte callback data allows). */
29222
29502
  backendStepButtons(instanceName, nonce, step) {
@@ -29735,7 +30015,7 @@ export class FleetManager {
29735
30015
  await this.restartSingleInstance(instanceName, { explicit: true });
29736
30016
  }
29737
30017
  else {
29738
- await this.startClassicInstance(instanceName, classicChannels.getBackend(channelId, adapterId, this.fleetConfig?.defaults?.backend), classicChannels.getPreTaskCommand(channelId, adapterId), classicChannels.getModel(channelId, adapterId, this.fleetConfig?.defaults?.model), classicChannels.getAutoPauseAfter(channelId, adapterId, this.fleetConfig?.defaults?.auto_pause_after));
30018
+ await this.startClassicInstance(instanceName, classicChannels.getBackend(channelId, adapterId, this.fleetConfig?.defaults?.backend), classicChannels.getPreTaskCommand(channelId, adapterId), classicChannels.getModel(channelId, adapterId, this.fleetConfig?.defaults?.model, this.fleetConfig?.defaults?.backend), classicChannels.getAutoPauseAfter(channelId, adapterId, this.fleetConfig?.defaults?.auto_pause_after));
29739
30019
  }
29740
30020
  this.reregisterClassicChannels();
29741
30021
  // Auto-enable collab for Discord classic channels (TG uses @mention directly without collab mode)
@@ -30307,7 +30587,7 @@ export class FleetManager {
30307
30587
  * Whitelisted runtime fields are pushed into live daemons; all other instance
30308
30588
  * fields, plus cold fleet-level settings, retain restart semantics.
30309
30589
  */
30310
- async reconcileInstances(observe) {
30590
+ async reconcileInstances(observe, defaultConsent) {
30311
30591
  if (!this.configPath)
30312
30592
  return {};
30313
30593
  const oldConfig = this.fleetConfig;
@@ -30380,8 +30660,8 @@ export class FleetManager {
30380
30660
  for (const ch of this.classicChannels.getAll()) {
30381
30661
  const runtimeConfig = this.daemons.get(ch.instanceName)?.getConfigSnapshot?.();
30382
30662
  oldClassicBehavior.set(ch.instanceName, {
30383
- backend: this.classicChannels.getBackend(ch.channelId, ch.adapterId, oldConfig?.defaults?.backend),
30384
- model: this.classicChannels.getModel(ch.channelId, ch.adapterId, oldConfig?.defaults?.model),
30663
+ backend: runtimeConfig?.backend ?? this.classicChannels.getBackend(ch.channelId, ch.adapterId, oldConfig?.defaults?.backend),
30664
+ model: runtimeConfig ? runtimeConfig.model : this.classicChannels.getModel(ch.channelId, ch.adapterId, oldConfig?.defaults?.model, oldConfig?.defaults?.backend),
30385
30665
  autoPauseAfter: this.classicChannels.getAutoPauseAfter(ch.channelId, ch.adapterId, oldConfig?.defaults?.auto_pause_after),
30386
30666
  // Settings mutates FleetManager's in-memory defaults before SIGHUP.
30387
30667
  // The live daemon is therefore the authority for the previous hot
@@ -30449,7 +30729,12 @@ export class FleetManager {
30449
30729
  // complete snapshot: Settings mutates FleetManager's config before SIGHUP,
30450
30730
  // so an old/new diff alone can miss the live daemon's stale value.
30451
30731
  for (const [name, config] of Object.entries(newInstances)) {
30732
+ const adoption = this.sharedDefaultsView(name, config, defaultConsent);
30452
30733
  if (!this.daemons.has(name)) {
30734
+ if (adoption.deferred) {
30735
+ observe?.(name, "restart", "next-start");
30736
+ continue;
30737
+ }
30453
30738
  // New instance — startInstance already calls connectIpcToInstance. #2482: a paused one is not started (startInstance
30454
30739
  // returns at its pause); say so, quietly, instead of "starting" on every reload.
30455
30740
  if (this.lifecycle.isPaused(name)) {
@@ -30474,7 +30759,9 @@ export class FleetManager {
30474
30759
  else if (oldConfig?.instances[name]) {
30475
30760
  const daemon = this.daemons.get(name);
30476
30761
  const runtimeConfig = daemon.getConfigSnapshot?.() ?? oldConfig.instances[name];
30477
- const change = classifyInstanceChange(runtimeConfig, config);
30762
+ const change = classifyInstanceChange(runtimeConfig, adoption.config);
30763
+ if (adoption.deferred)
30764
+ observe?.(name, "restart", "next-start");
30478
30765
  // (b) The person switched its task board on: tell it (its tool list shows the `task` tool at once).
30479
30766
  if (taskBoardSwitchedOn(runtimeConfig.dashboard, config.dashboard)) {
30480
30767
  this.admitTaskBoardNotice(name, TASK_BOARD_ON_NOTICE, `task-board-on:${name}:${Date.now()}`);
@@ -30498,7 +30785,7 @@ export class FleetManager {
30498
30785
  this.logger.warn({ name }, "Config-update IPC unavailable — applied hot config in-process");
30499
30786
  }
30500
30787
  this.logger.info({ name, fields: [...HOT_INSTANCE_CONFIG_KEYS] }, "Instance hot config reloaded");
30501
- observe?.(name, "hot", "done");
30788
+ observe?.(name, "hot", adoption.deferred ? "next-start" : "done");
30502
30789
  }
30503
30790
  }
30504
30791
  }
@@ -30511,10 +30798,15 @@ export class FleetManager {
30511
30798
  const old = oldClassicBehavior.get(ch.instanceName);
30512
30799
  if (!old || !this.daemons.has(ch.instanceName))
30513
30800
  continue;
30514
- const backend = this.classicChannels.getBackend(ch.channelId, ch.adapterId, this.fleetConfig?.defaults?.backend);
30515
- const model = this.classicChannels.getModel(ch.channelId, ch.adapterId, this.fleetConfig?.defaults?.model);
30801
+ const adoption = this.sharedDefaultsView(ch.instanceName, {
30802
+ backend: this.classicChannels.getBackend(ch.channelId, ch.adapterId, this.fleetConfig?.defaults?.backend),
30803
+ model: this.classicChannels.getModel(ch.channelId, ch.adapterId, this.fleetConfig?.defaults?.model, this.fleetConfig?.defaults?.backend),
30804
+ }, defaultConsent);
30805
+ const { backend, model } = adoption.config;
30806
+ if (adoption.deferred)
30807
+ observe?.(ch.instanceName, "restart", "next-start");
30516
30808
  const autoPauseAfter = this.classicChannels.getAutoPauseAfter(ch.channelId, ch.adapterId, this.fleetConfig?.defaults?.auto_pause_after);
30517
- const profile = this.classicProfileChange(ch.instanceName, old.backend !== backend);
30809
+ const profile = this.classicProfileChange(ch.instanceName, old.backend !== backend, adoption.deferred ? backend : undefined);
30518
30810
  if (old.backend !== backend || old.model !== model || old.autoPauseAfter !== autoPauseAfter || profile.changed) {
30519
30811
  this.logger.info({ instanceName: ch.instanceName, ...(profile.changed ? { profileFrom: profile.from, profileTo: profile.to } : {}) }, "Classic cold config changed — restarting");
30520
30812
  observe?.(ch.instanceName, "restart", "running");
@@ -31953,7 +32245,7 @@ export class FleetManager {
31953
32245
  if (keys.has(key))
31954
32246
  process.env[key] = value;
31955
32247
  }
31956
- planConfigApply() {
32248
+ planConfigApply(defaultConsent) {
31957
32249
  const rows = [];
31958
32250
  const nextConfig = this.nextFleetConfig();
31959
32251
  const next = nextConfig?.instances ?? {};
@@ -31969,8 +32261,15 @@ export class FleetManager {
31969
32261
  rows.push({ target: name, kind: "restart" });
31970
32262
  continue;
31971
32263
  }
31972
- const change = classifyInstanceChange(runtime, config);
31973
- if (change !== "none")
32264
+ const adoption = this.sharedDefaultsView(name, config, defaultConsent);
32265
+ if (adoption.deferred && !daemon) {
32266
+ rows.push({ target: name, kind: "next-start" });
32267
+ continue;
32268
+ }
32269
+ const change = classifyInstanceChange(runtime, adoption.config);
32270
+ if (change === "none" && adoption.deferred)
32271
+ rows.push({ target: name, kind: "next-start" });
32272
+ else if (change !== "none")
31974
32273
  rows.push({ target: name, kind: change === "restart" ? "restart" : "hot" });
31975
32274
  }
31976
32275
  for (const name of this.daemons.keys()) {
@@ -31990,7 +32289,8 @@ export class FleetManager {
31990
32289
  * the whole point: the retry after a lost response must not apply everything a
31991
32290
  * second time.
31992
32291
  */
31993
- startSettingsApply(key) {
32292
+ captureSharedDefaultsConsent() { return this.sharedDefaultAdoption.receipt(); }
32293
+ startSettingsApply(key, sharedDefaults = "next-start", restartTargets = [], receipt) {
31994
32294
  // The key is checked first on purpose: a retry of the apply that is running
31995
32295
  // right now must get its own job back, not "busy".
31996
32296
  const existing = this.applyJobs.findByKey(key);
@@ -31999,17 +32299,18 @@ export class FleetManager {
31999
32299
  if (this.reconcileInFlight || this.activeApplyJobId) {
32000
32300
  return { busy: this.activeApplyJobId ? this.applyJobs.get(this.activeApplyJobId) : null };
32001
32301
  }
32002
- const job = this.applyJobs.create(key, this.planConfigApply());
32302
+ const defaultConsent = sharedDefaults === "restart" ? this.sharedDefaultAdoption.fromReceipt(receipt, new Set(restartTargets)) : undefined;
32303
+ const job = this.applyJobs.create(key, this.planConfigApply(defaultConsent));
32003
32304
  // Reserved synchronously: the work starts a microtask later, and a second
32004
32305
  // request arriving in that gap must see the slot taken.
32005
32306
  this.activeApplyJobId = job.id;
32006
32307
  // Start after the caller has its answer, so the first thing the page renders
32007
32308
  // is the whole plan with every row still pending — not a job the reconcile
32008
32309
  // has already half-finished synchronously.
32009
- queueMicrotask(() => void this.runSettingsApply(job.id));
32310
+ queueMicrotask(() => void this.runSettingsApply(job.id, defaultConsent));
32010
32311
  return { job, reused: false };
32011
32312
  }
32012
- async runSettingsApply(jobId) {
32313
+ async runSettingsApply(jobId, defaultConsent) {
32013
32314
  const emit = () => {
32014
32315
  const job = this.applyJobs.get(jobId);
32015
32316
  // An accelerator only: these frames carry no event id, so a client that
@@ -32035,7 +32336,7 @@ export class FleetManager {
32035
32336
  };
32036
32337
  emit();
32037
32338
  try {
32038
- const started = this.startExclusiveReconcile(observer);
32339
+ const started = this.startExclusiveReconcile(observer, defaultConsent);
32039
32340
  if (!started) {
32040
32341
  // The slot was reserved before the microtask, so this means a SIGHUP
32041
32342
  // reconcile started in between. Report it instead of applying twice.
@@ -33448,11 +33749,7 @@ export class FleetManager {
33448
33749
  const cost = isNativePaneInstance(nativeConfig) ? null : statusline?.cost?.total_cost_usd ?? 0;
33449
33750
  // Align with /ctx: statusline for claude-code, pane scrape for kiro/grok/codex.
33450
33751
  const classic = classicOnly.includes(name);
33451
- const backend = classic
33452
- ? this.classicChannels.getBackendByInstance(name, this.fleetConfig?.defaults?.backend)
33453
- : (this.fleetConfig?.instances[name]?.backend
33454
- ?? this.fleetConfig?.defaults?.backend
33455
- ?? "claude-code");
33752
+ const backend = this.backendNameForInstance(name);
33456
33753
  const { context } = isNativePaneInstance(nativeConfig) ? { context: null } : resolveInstanceContext(this.dataDir, name, backend, { source: this.getPaneContextSource(name), statusline });
33457
33754
  // context_pct: null when unavailable, not 0
33458
33755
  const context_pct = context ?? null;