@songsid/agend 2.4.0-beta.18 → 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 (377) 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 +23 -3
  14. package/dist/backend/claude-code.js.map +1 -1
  15. package/dist/backend/codex-precaution.js +3 -2
  16. package/dist/backend/codex-precaution.js.map +1 -1
  17. package/dist/backend/codex.js +1 -1
  18. package/dist/backend/codex.js.map +1 -1
  19. package/dist/backend/types.d.ts +6 -0
  20. package/dist/backend/types.js.map +1 -1
  21. package/dist/build-provenance.json +1 -1
  22. package/dist/channel/mcp-server.js +8 -2
  23. package/dist/channel/mcp-server.js.map +1 -1
  24. package/dist/channel/mcp-tools.d.ts +27 -1
  25. package/dist/channel/mcp-tools.js +77 -7
  26. package/dist/channel/mcp-tools.js.map +1 -1
  27. package/dist/chat-task-refs.d.ts +61 -0
  28. package/dist/chat-task-refs.js +112 -0
  29. package/dist/chat-task-refs.js.map +1 -0
  30. package/dist/classic-channel-manager.d.ts +1 -1
  31. package/dist/classic-channel-manager.js +6 -2
  32. package/dist/classic-channel-manager.js.map +1 -1
  33. package/dist/claude-credential-launch.d.ts +6 -0
  34. package/dist/claude-credential-launch.js +16 -3
  35. package/dist/claude-credential-launch.js.map +1 -1
  36. package/dist/claude-credential-runner.js +3 -1
  37. package/dist/claude-credential-runner.js.map +1 -1
  38. package/dist/claude-setup-token-transport.js +25 -3
  39. package/dist/claude-setup-token-transport.js.map +1 -1
  40. package/dist/cli-audited.js +5 -5
  41. package/dist/cli-audited.js.map +1 -1
  42. package/dist/composite-tools.d.ts +11 -0
  43. package/dist/composite-tools.js +29 -0
  44. package/dist/composite-tools.js.map +1 -0
  45. package/dist/config-validator.js +22 -1
  46. package/dist/config-validator.js.map +1 -1
  47. package/dist/config.js +11 -0
  48. package/dist/config.js.map +1 -1
  49. package/dist/contact-auth-policy.d.ts +1 -0
  50. package/dist/contact-auth-policy.js +2 -1
  51. package/dist/contact-auth-policy.js.map +1 -1
  52. package/dist/contact-auth-service.js +2 -0
  53. package/dist/contact-auth-service.js.map +1 -1
  54. package/dist/contact-auth-store.js +21 -6
  55. package/dist/contact-auth-store.js.map +1 -1
  56. package/dist/contact-auth-types.d.ts +2 -0
  57. package/dist/contact-auth-types.js.map +1 -1
  58. package/dist/daemon.js +4 -0
  59. package/dist/daemon.js.map +1 -1
  60. package/dist/darwin-memory.js +2 -1
  61. package/dist/darwin-memory.js.map +1 -1
  62. package/dist/dashboard-permissions.d.ts +1 -8
  63. package/dist/dashboard-permissions.js +8 -9
  64. package/dist/dashboard-permissions.js.map +1 -1
  65. package/dist/delivery-outbox.d.ts +0 -6
  66. package/dist/delivery-outbox.js +0 -25
  67. package/dist/delivery-outbox.js.map +1 -1
  68. package/dist/delivery-outbox.test.js +132 -96
  69. package/dist/delivery-outbox.test.js.map +1 -1
  70. package/dist/fleet-manager.d.ts +45 -7
  71. package/dist/fleet-manager.js +309 -99
  72. package/dist/fleet-manager.js.map +1 -1
  73. package/dist/fleet-windows-runtime.d.ts +1 -1
  74. package/dist/fleet-windows-runtime.js +8 -1
  75. package/dist/fleet-windows-runtime.js.map +1 -1
  76. package/dist/fleet-yaml-stringify.d.ts +1 -1
  77. package/dist/fleet-yaml-stringify.js +64 -11
  78. package/dist/fleet-yaml-stringify.js.map +1 -1
  79. package/dist/general-knowledge/skills/concepts/SKILL.md +53 -4
  80. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +4 -0
  81. package/dist/general-knowledge/skills/fleet-config/SKILL.md +21 -1
  82. package/dist/general-knowledge/skills/hub/SKILL.md +2 -0
  83. package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +5 -1
  84. package/dist/general-knowledge/skills/model-discovery/SKILL.md +3 -2
  85. package/dist/general-knowledge/skills/persona-emoji/SKILL.md +3 -0
  86. package/dist/general-knowledge/skills/task-board/SKILL.md +63 -0
  87. package/dist/general-knowledge/skills/web-appearance/SKILL.md +25 -2
  88. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +38 -9
  89. package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +4 -0
  90. package/dist/general-knowledge/steering/core-rules.md +15 -78
  91. package/dist/general-role-block.d.ts +19 -0
  92. package/dist/general-role-block.js +56 -0
  93. package/dist/general-role-block.js.map +1 -0
  94. package/dist/general-role.d.ts +1 -1
  95. package/dist/general-role.js +1 -0
  96. package/dist/general-role.js.map +1 -1
  97. package/dist/host-memory.d.ts +3 -0
  98. package/dist/host-memory.js.map +1 -1
  99. package/dist/host-monitoring/darwin/collector.d.ts +18 -0
  100. package/dist/host-monitoring/darwin/collector.js +65 -0
  101. package/dist/host-monitoring/darwin/collector.js.map +1 -0
  102. package/dist/host-monitoring/darwin/defaults.d.ts +2 -0
  103. package/dist/host-monitoring/darwin/defaults.js +9 -0
  104. package/dist/host-monitoring/darwin/defaults.js.map +1 -0
  105. package/dist/host-monitoring/darwin/interpretation.d.ts +20 -0
  106. package/dist/host-monitoring/darwin/interpretation.js +73 -0
  107. package/dist/host-monitoring/darwin/interpretation.js.map +1 -0
  108. package/dist/host-monitoring/linux/collector.d.ts +17 -0
  109. package/dist/host-monitoring/linux/collector.js +55 -0
  110. package/dist/host-monitoring/linux/collector.js.map +1 -0
  111. package/dist/host-monitoring/linux/defaults.d.ts +2 -0
  112. package/dist/host-monitoring/linux/defaults.js +9 -0
  113. package/dist/host-monitoring/linux/defaults.js.map +1 -0
  114. package/dist/host-monitoring/linux/interpretation.d.ts +22 -0
  115. package/dist/host-monitoring/linux/interpretation.js +76 -0
  116. package/dist/host-monitoring/linux/interpretation.js.map +1 -0
  117. package/dist/host-monitoring/transport.d.ts +42 -0
  118. package/dist/host-monitoring/transport.js +101 -0
  119. package/dist/host-monitoring/transport.js.map +1 -0
  120. package/dist/host-monitoring/wsl/collector.d.ts +19 -0
  121. package/dist/host-monitoring/wsl/collector.js +72 -0
  122. package/dist/host-monitoring/wsl/collector.js.map +1 -0
  123. package/dist/host-monitoring/wsl/defaults.d.ts +2 -0
  124. package/dist/host-monitoring/wsl/defaults.js +9 -0
  125. package/dist/host-monitoring/wsl/defaults.js.map +1 -0
  126. package/dist/host-monitoring/wsl/interpretation.d.ts +22 -0
  127. package/dist/host-monitoring/wsl/interpretation.js +77 -0
  128. package/dist/host-monitoring/wsl/interpretation.js.map +1 -0
  129. package/dist/host-monitoring-alert-policy.d.ts +2 -0
  130. package/dist/host-monitoring-alert-policy.js +4 -2
  131. package/dist/host-monitoring-alert-policy.js.map +1 -1
  132. package/dist/host-monitoring-alert-settings.d.ts +3 -1
  133. package/dist/host-monitoring-alert-settings.js +7 -2
  134. package/dist/host-monitoring-alert-settings.js.map +1 -1
  135. package/dist/host-monitoring-alerts.d.ts +3 -0
  136. package/dist/host-monitoring-alerts.js +18 -3
  137. package/dist/host-monitoring-alerts.js.map +1 -1
  138. package/dist/host-monitoring-defaults.d.ts +19 -0
  139. package/dist/host-monitoring-defaults.js +10 -0
  140. package/dist/host-monitoring-defaults.js.map +1 -0
  141. package/dist/host-monitoring-platform.d.ts +18 -70
  142. package/dist/host-monitoring-platform.js +14 -269
  143. package/dist/host-monitoring-platform.js.map +1 -1
  144. package/dist/host-monitoring.d.ts +13 -0
  145. package/dist/host-monitoring.js.map +1 -1
  146. package/dist/hub/agent-catalog-model.d.ts +21 -0
  147. package/dist/hub/agent-catalog-model.js +9 -1
  148. package/dist/hub/agent-catalog-model.js.map +1 -1
  149. package/dist/hub/agent-catalog.d.ts +4 -1
  150. package/dist/hub/agent-catalog.js +11 -0
  151. package/dist/hub/agent-catalog.js.map +1 -1
  152. package/dist/hub/catalog.js +12 -0
  153. package/dist/hub/catalog.js.map +1 -1
  154. package/dist/hub/client.js +4 -1
  155. package/dist/hub/client.js.map +1 -1
  156. package/dist/hub/compose/member.d.ts +5 -0
  157. package/dist/hub/compose/member.js +25 -5
  158. package/dist/hub/compose/member.js.map +1 -1
  159. package/dist/hub/compose/server.d.ts +2 -0
  160. package/dist/hub/compose/server.js +4 -2
  161. package/dist/hub/compose/server.js.map +1 -1
  162. package/dist/hub/http/compose.d.ts +5 -0
  163. package/dist/hub/http/compose.js +25 -2
  164. package/dist/hub/http/compose.js.map +1 -1
  165. package/dist/hub/http/deps.d.ts +2 -0
  166. package/dist/hub/http/schema.js +4 -0
  167. package/dist/hub/http/schema.js.map +1 -1
  168. package/dist/hub/lapse-carry.d.ts +45 -0
  169. package/dist/hub/lapse-carry.js +62 -0
  170. package/dist/hub/lapse-carry.js.map +1 -0
  171. package/dist/hub/member/agent-catalog.d.ts +4 -1
  172. package/dist/hub/member/agent-catalog.js +15 -4
  173. package/dist/hub/member/agent-catalog.js.map +1 -1
  174. package/dist/hub/member/agent-intro.d.ts +4 -3
  175. package/dist/hub/member/agent-intro.js +7 -0
  176. package/dist/hub/member/agent-intro.js.map +1 -1
  177. package/dist/hub/member/exposure-api.d.ts +2 -0
  178. package/dist/hub/member/exposure-api.js +8 -1
  179. package/dist/hub/member/exposure-api.js.map +1 -1
  180. package/dist/hub/member/room-post.d.ts +34 -6
  181. package/dist/hub/member/room-post.js +30 -0
  182. package/dist/hub/member/room-post.js.map +1 -1
  183. package/dist/hub/member/sharing.d.ts +2 -0
  184. package/dist/hub/member/sharing.js +9 -2
  185. package/dist/hub/member/sharing.js.map +1 -1
  186. package/dist/hub/protocol.d.ts +2 -0
  187. package/dist/hub/room-brief-model.js +2 -1
  188. package/dist/hub/room-brief-model.js.map +1 -1
  189. package/dist/hub/rooms/agents.d.ts +2 -0
  190. package/dist/hub/rooms/agents.js +16 -2
  191. package/dist/hub/rooms/agents.js.map +1 -1
  192. package/dist/hub/rooms/office.d.ts +82 -0
  193. package/dist/hub/rooms/office.js +46 -0
  194. package/dist/hub/rooms/office.js.map +1 -0
  195. package/dist/hub/rooms/service.d.ts +66 -1
  196. package/dist/hub/rooms/service.js +67 -11
  197. package/dist/hub/rooms/service.js.map +1 -1
  198. package/dist/hub/rooms/types.d.ts +4 -0
  199. package/dist/hub/runtime.d.ts +1 -1
  200. package/dist/hub/server.js +9 -2
  201. package/dist/hub/server.js.map +1 -1
  202. package/dist/hub/sharing-requests.d.ts +5 -2
  203. package/dist/hub/sharing-requests.js +19 -4
  204. package/dist/hub/sharing-requests.js.map +1 -1
  205. package/dist/instance-config-impact.js +1 -1
  206. package/dist/instance-config-impact.js.map +1 -1
  207. package/dist/instance-lifecycle.js +6 -7
  208. package/dist/instance-lifecycle.js.map +1 -1
  209. package/dist/instruction-file-sizes.d.ts +46 -0
  210. package/dist/instruction-file-sizes.js +115 -0
  211. package/dist/instruction-file-sizes.js.map +1 -0
  212. package/dist/instructions.d.ts +35 -1
  213. package/dist/instructions.js +59 -33
  214. package/dist/instructions.js.map +1 -1
  215. package/dist/locale.js +16 -4
  216. package/dist/locale.js.map +1 -1
  217. package/dist/log-steps.d.ts +5 -0
  218. package/dist/log-steps.js +6 -2
  219. package/dist/log-steps.js.map +1 -1
  220. package/dist/memory-guidance.d.ts +5 -0
  221. package/dist/memory-guidance.js +14 -0
  222. package/dist/memory-guidance.js.map +1 -0
  223. package/dist/model-defaults.d.ts +5 -0
  224. package/dist/model-defaults.js +6 -0
  225. package/dist/model-defaults.js.map +1 -0
  226. package/dist/native-mcp.d.ts +2 -0
  227. package/dist/native-mcp.js +16 -6
  228. package/dist/native-mcp.js.map +1 -1
  229. package/dist/needs-you-hub.d.ts +2 -0
  230. package/dist/needs-you-hub.js +6 -1
  231. package/dist/needs-you-hub.js.map +1 -1
  232. package/dist/needs-you.d.ts +13 -1
  233. package/dist/needs-you.js +5 -0
  234. package/dist/needs-you.js.map +1 -1
  235. package/dist/outbound-handlers.d.ts +3 -3
  236. package/dist/outbound-schemas.d.ts +3 -0
  237. package/dist/outbound-schemas.js +27 -26
  238. package/dist/outbound-schemas.js.map +1 -1
  239. package/dist/quickstart.d.ts +1 -1
  240. package/dist/quickstart.js +2 -3
  241. package/dist/quickstart.js.map +1 -1
  242. package/dist/remote-card-prompt.d.ts +1 -0
  243. package/dist/remote-card-prompt.js +1 -1
  244. package/dist/remote-card-prompt.js.map +1 -1
  245. package/dist/runtime-build-info.js +1 -1
  246. package/dist/runtime-build-info.js.map +1 -1
  247. package/dist/runtime-cli-install.js +5 -5
  248. package/dist/runtime-cli-install.js.map +1 -1
  249. package/dist/runtime-pane-mcp.js +7 -3
  250. package/dist/runtime-pane-mcp.js.map +1 -1
  251. package/dist/runtime-pane-native.js +2 -1
  252. package/dist/runtime-pane-native.js.map +1 -1
  253. package/dist/scheduler/db.js +2 -0
  254. package/dist/scheduler/db.js.map +1 -1
  255. package/dist/scheduler/task-board-mentions.d.ts +32 -0
  256. package/dist/scheduler/task-board-mentions.js +97 -0
  257. package/dist/scheduler/task-board-mentions.js.map +1 -0
  258. package/dist/scheduler/task-board-text.js +3 -0
  259. package/dist/scheduler/task-board-text.js.map +1 -1
  260. package/dist/scheduler/task-board.d.ts +199 -3
  261. package/dist/scheduler/task-board.js +492 -7
  262. package/dist/scheduler/task-board.js.map +1 -1
  263. package/dist/settings-api.d.ts +3 -1
  264. package/dist/settings-api.js +23 -4
  265. package/dist/settings-api.js.map +1 -1
  266. package/dist/settings-change.js +4 -2
  267. package/dist/settings-change.js.map +1 -1
  268. package/dist/settings-effect.js +1 -1
  269. package/dist/settings-effect.js.map +1 -1
  270. package/dist/settings-instance-patch.js +3 -1
  271. package/dist/settings-instance-patch.js.map +1 -1
  272. package/dist/setup-host.d.ts +2 -3
  273. package/dist/setup-host.js +3 -5
  274. package/dist/setup-host.js.map +1 -1
  275. package/dist/setup-wizard.js +0 -2
  276. package/dist/setup-wizard.js.map +1 -1
  277. package/dist/shared-default-adoption.d.ts +24 -0
  278. package/dist/shared-default-adoption.js +73 -0
  279. package/dist/shared-default-adoption.js.map +1 -0
  280. package/dist/subagent-records.d.ts +2 -0
  281. package/dist/subagent-records.js +11 -1
  282. package/dist/subagent-records.js.map +1 -1
  283. package/dist/subagent-service.d.ts +3 -0
  284. package/dist/subagent-service.js +24 -4
  285. package/dist/subagent-service.js.map +1 -1
  286. package/dist/task-board-tool.d.ts +31 -0
  287. package/dist/task-board-tool.js +31 -0
  288. package/dist/task-board-tool.js.map +1 -1
  289. package/dist/task-board-waker.d.ts +23 -30
  290. package/dist/task-board-waker.js +136 -97
  291. package/dist/task-board-waker.js.map +1 -1
  292. package/dist/types.d.ts +23 -0
  293. package/dist/ui/agent-details-settings.js +2 -2
  294. package/dist/ui/agent-export-dialog.js +4 -3
  295. package/dist/ui/agent-export-strings.js +4 -4
  296. package/dist/ui/agent-page-strings.js +18 -0
  297. package/dist/ui/chat-activity-groups.js +1 -1
  298. package/dist/ui/chat-activity.js +17 -0
  299. package/dist/ui/chat-store.js +13 -4
  300. package/dist/ui/chat-task-ref-strings.js +24 -0
  301. package/dist/ui/chat-task-refs.js +129 -0
  302. package/dist/ui/claude-setup-token.js +3 -3
  303. package/dist/ui/contact-auth-strings.js +33 -3
  304. package/dist/ui/contact-authorizations.js +17 -24
  305. package/dist/ui/contact-grant-editor.js +50 -0
  306. package/dist/ui/contact-permissions.js +21 -8
  307. package/dist/ui/fleet-office-card.js +18 -14
  308. package/dist/ui/fleet-office.js +29 -17
  309. package/dist/ui/fleet-task-activity.js +362 -0
  310. package/dist/ui/fleet-task-card.js +317 -314
  311. package/dist/ui/fleet-task-common.js +99 -9
  312. package/dist/ui/fleet-task-create.js +67 -0
  313. package/dist/ui/fleet-task-edit.js +204 -0
  314. package/dist/ui/fleet-task-follow.js +123 -0
  315. package/dist/ui/fleet-task-menu.js +1 -1
  316. package/dist/ui/fleet-task-owner.js +252 -0
  317. package/dist/ui/fleet-task-run.js +257 -0
  318. package/dist/ui/fleet-task-view.js +178 -39
  319. package/dist/ui/fleet-task-work.js +2 -2
  320. package/dist/ui/fleet-tasks.js +258 -130
  321. package/dist/ui/host-health.js +9 -6
  322. package/dist/ui/host-monitoring-darwin.js +6 -0
  323. package/dist/ui/host-monitoring-help.js +7 -0
  324. package/dist/ui/host-monitoring-linux.js +6 -0
  325. package/dist/ui/host-monitoring-wsl.js +6 -0
  326. package/dist/ui/hub-agent-copy.js +2 -0
  327. package/dist/ui/hub-client.js +4 -0
  328. package/dist/ui/hub-my-agents-strings.js +2 -0
  329. package/dist/ui/hub-my-agents.js +17 -1
  330. package/dist/ui/hub-room-composer.js +108 -5
  331. package/dist/ui/hub-room-members-strings.js +9 -2
  332. package/dist/ui/hub-room-members.js +72 -15
  333. package/dist/ui/hub-room-office.js +191 -0
  334. package/dist/ui/hub-room-purpose.js +18 -2
  335. package/dist/ui/hub-room-settings.js +8 -1
  336. package/dist/ui/hub-room-strings.js +15 -0
  337. package/dist/ui/hub-room-thread.js +51 -15
  338. package/dist/ui/hub-strings.js +1 -1
  339. package/dist/ui/log-row.js +7 -5
  340. package/dist/ui/native-instance-settings.js +4 -2
  341. package/dist/ui/panel-chat.js +96 -17
  342. package/dist/ui/panel-details.js +17 -0
  343. package/dist/ui/panel-fleet.js +1 -1
  344. package/dist/ui/panel-hub.js +4 -1
  345. package/dist/ui/panel-needs.js +11 -2
  346. package/dist/ui/panel-settings.js +57 -13
  347. package/dist/ui/settings-apply.js +8 -3
  348. package/dist/ui/settings-default-model-scope.js +40 -0
  349. package/dist/ui/settings-default-model-strings.js +43 -0
  350. package/dist/ui/settings-dialogs.js +9 -5
  351. package/dist/ui/settings-host-alerts.js +4 -3
  352. package/dist/ui/settings-host-monitoring.js +2 -1
  353. package/dist/ui/settings-hub.js +1 -1
  354. package/dist/ui/settings-layout.js +7 -2
  355. package/dist/ui/settings-model.js +9 -5
  356. package/dist/ui/settings-quota-notice.js +3 -3
  357. package/dist/ui/settings-registry.js +3 -0
  358. package/dist/ui/settings-shared-strings.js +22 -0
  359. package/dist/ui/settings-shared.js +59 -12
  360. package/dist/ui/settings-strings.js +2 -4
  361. package/dist/ui/shared/app-i18n.js +2 -2
  362. package/dist/ui/shared/app.css +124 -46
  363. package/dist/ui/shared/chat-composer.js +7 -6
  364. package/dist/ui/shared/chat-render.js +39 -1
  365. package/dist/ui/shared/chat-thread.js +8 -3
  366. package/dist/ui/shared/composer-focus.js +21 -0
  367. package/dist/ui/shared/hub-chat.css +30 -2
  368. package/dist/ui/shared/hub-rooms-u2.css +17 -0
  369. package/dist/ui/shared/task-board.css +406 -8
  370. package/dist/ui/trigger-complete.js +71 -0
  371. package/dist/web-api.d.ts +9 -0
  372. package/dist/web-api.js +128 -13
  373. package/dist/web-api.js.map +1 -1
  374. package/dist/windows-native-mcp.js +5 -2
  375. package/dist/windows-native-mcp.js.map +1 -1
  376. package/dist/workflow-templates/default.md +4 -6
  377. package/package.json +1 -1
@@ -1,3 +1,6 @@
1
+ import { detectMonitoringPlatform } from './host-monitoring-defaults.js';
2
+ import { SharedDefaultAdoption } from "./shared-default-adoption.js";
3
+ import { scopedDefaultModel } from "./model-defaults.js";
1
4
  import { HostFootprint } from "./host-monitoring-footprint.js";
2
5
  import { hostAlertSummary } from './host-monitoring-alert-text.js';
3
6
  import { HostMonitoringAlerts } from './host-monitoring-alerts.js';
@@ -26,6 +29,7 @@ import { settingsSummary, translatedSummary } from "./settings-summary.js";
26
29
  import { readInstalledBuild } from "./build-provenance.js";
27
30
  import { buildNativeFleetInstructions } from "./instructions.js";
28
31
  import { GENERAL_ROLE_INSTRUCTIONS } from "./general-role.js";
32
+ import { placeGeneralRole } from "./general-role-block.js";
29
33
  import { NativePaneRecoveryError } from "./native-pane-recovery.js";
30
34
  import { nativePaneToolAvailable, nativePaneToolRefusal } from "./native-pane-tools.js";
31
35
  import { windowsAgentsFor } from "./windows-agents.js";
@@ -159,8 +163,8 @@ import { createLogger, rotateLogIfNeeded } from "./logger.js";
159
163
  import { processAttachments } from "./channel/attachment-handler.js";
160
164
  import { routeToolCall } from "./channel/tool-router.js";
161
165
  import { Scheduler } from "./scheduler/index.js";
162
- import { boardActivity, boardCardLimit, boardToolAction } from "./task-board-tool.js";
163
- 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";
164
168
  import { DispatcherLiveness, LIVENESS_STARTUP_GRACE_MS, livenessSettings, questionNotices, turnQuestion } from "./dispatcher-liveness.js";
165
169
  import { TaskBoardError, waitsForPerson, wrapUpGap } from "./scheduler/task-board.js";
166
170
  import { escapeTelegramHtml, scheduleClock, scheduleRetryLabel } from "./scheduler/retry-label.js";
@@ -253,6 +257,7 @@ import { RuntimeCoordinator } from "./runtime-coordinator.js";
253
257
  import { runtimeUpdateAttention } from "./runtime-update-attention.js";
254
258
  import { RuntimeWindowsBridge } from "./runtime-windows-bridge.js";
255
259
  import { FleetWindowsRuntime } from "./fleet-windows-runtime.js";
260
+ import { INSTRUCTIONS_FILE } from "./instruction-file-sizes.js";
256
261
  import { NativeMcpSessions } from "./native-mcp.js";
257
262
  import { nativeProviderMcpSupported } from "./windows-cli-providers.js";
258
263
  import { cachedNativeModelCatalog, refreshNativeModelCatalogAfterSignIn } from "./native-model-catalog.js";
@@ -848,7 +853,7 @@ export class FleetManager {
848
853
  }
849
854
  }
850
855
  this.hostHistory ??= new HostMonitoringHistory({ path: join(this.dataDir, 'host-monitoring.sqlite'), incidents: true, incidentReady: () => this.hostAlerts?.ready(), unblocked: () => this.hostMonitor?.apply() });
851
- this.hostAlerts ??= new HostMonitoringAlerts({ persistence: this.hostHistory, changed: () => this.needsYou?.poke(), deliver: (changes, ack) => {
856
+ this.hostAlerts ??= new HostMonitoringAlerts({ platform: this.hostMonitoringPlatform(), persistence: this.hostHistory, changed: () => this.needsYou?.poke(), deliver: (changes, ack) => {
852
857
  return this.notifyFleetError(hostAlertSummary(changes, getLocale()), { throttle: false, ack });
853
858
  } });
854
859
  this.hostFootprint ??= new HostFootprint({ roots: () => this.hostFootprintRoots(), changed: () => this.hostHistory?.ingest(this.hostHealthSnapshotInternal()) });
@@ -870,6 +875,7 @@ export class FleetManager {
870
875
  this.hostMonitor.start();
871
876
  }
872
877
  hostHistoryQuery(range, series) { return this.hostHistory?.query(range, series) ?? Promise.resolve({ ok: false, reason: 'history_unavailable' }); }
878
+ hostMonitoringPlatform() { return this.hostHealthSnapshotInternal().platform ?? detectMonitoringPlatform(); }
873
879
  hostMonitoringAvailable() { return this.hostMonitor?.available() === true; }
874
880
  hostHealthSnapshotInternal() { return this.hostMonitor?.snapshot() ?? disabledHostHealth(); }
875
881
  hostHealthSnapshot(agentOffset = 0) {
@@ -1468,7 +1474,7 @@ export class FleetManager {
1468
1474
  if (!current())
1469
1475
  throw Error("Native settings authority expired");
1470
1476
  runtime.previewUpdate(name, patch);
1471
- 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] ?? ""));
1472
1478
  const running = this.daemons.get(name);
1473
1479
  if (cold) {
1474
1480
  if (running && !running.nativePaneHasExited() && (!await running.nativePauseReady({ current, accepts: () => true, revalidate: async () => current() }) || !running.nativePauseStillReady()))
@@ -1576,7 +1582,7 @@ export class FleetManager {
1576
1582
  const now = this.fleetConfig?.instances[name];
1577
1583
  if (this.shuttingDown || !isNativePaneInstance(now) || now?.native_agent_id !== config.native_agent_id
1578
1584
  || now?.machine_id !== config.machine_id || now?.working_directory !== config.working_directory || now?.backend !== config.backend
1579
- || 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
1580
1586
  || now?.general_topic !== config.general_topic || now?.native_general_binding !== config.native_general_binding
1581
1587
  || nativeCredentialProfile(now) !== nativeCredentialProfile(config))
1582
1588
  throw Error("Native pane configuration or lifetime changed");
@@ -1607,7 +1613,7 @@ export class FleetManager {
1607
1613
  epoch: () => hub.paneTransportEpoch(machineId), version: provider => hub.machine(machineId)?.inventory?.clis.find(row => row.id === provider && row.runnable)?.version ?? null };
1608
1614
  },
1609
1615
  instructions: (name, config) => buildNativeFleetInstructions({ instanceName: name, workingDirectory: config.working_directory,
1610
- displayName: config.display_name, description: config.description, customPrompt: config.systemPrompt,
1616
+ displayName: config.display_name, description: config.description, customPrompt: config.systemPrompt, operations: config.operations,
1611
1617
  workflow: config.workflow, taskBoard: !dashboardRefusalIn(this.fleetConfig, name, "task"),
1612
1618
  runtimeIdentity: { kind: "fleet-topic", backend: config.backend ?? "codex", model: config.model || "default" } }, config.general_topic === true),
1613
1619
  menu: name => TOOLS.filter(tool => allowed(name, tool.name)).map(tool => ({ ...tool })),
@@ -2794,6 +2800,7 @@ export class FleetManager {
2794
2800
  },
2795
2801
  attachAgentIntro: port => { this.hubAgentIntro = port; },
2796
2802
  attachAgentRooms: port => { this.hubAgentRooms = port; this.notifyHubRoomTools(); },
2803
+ attachShareLapse: port => { this.hubShareLapse = port; this.needsYou?.poke(); },
2797
2804
  roomToolsChanged: () => this.notifyHubRoomTools(),
2798
2805
  roomConversationGeneration: agent => this.daemons.get(agent)?.roomConversationGeneration() ?? null,
2799
2806
  attachRoomInputs: handler => { this.hubRoomInput = handler; },
@@ -3359,6 +3366,7 @@ export class FleetManager {
3359
3366
  return this.daemons.get(name)?.bootId ?? null;
3360
3367
  }
3361
3368
  rawFleetConfig = {};
3369
+ sharedDefaultAdoption = new SharedDefaultAdoption();
3362
3370
  /**
3363
3371
  * AGEND-163: one agent's own saved settings, as fleet.yaml has them — not `fleetConfig.instances[name]`, which has the fleet's
3364
3372
  * defaults merged in. Undefined when fleet.yaml has no such agent.
@@ -3414,6 +3422,40 @@ export class FleetManager {
3414
3422
  hubDeliveryFailed = null;
3415
3423
  /** The connected member adapter; never an agent-selectable identity. */
3416
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
+ } }
3417
3459
  hubAgentIntro = null;
3418
3460
  hubSetIntro(caller, text, operationId) { return this.hubAgentIntro?.set(caller, text, operationId) ?? Promise.resolve({ ok: false, code: "unavailable" }); }
3419
3461
  hubRoomToolsAvailable() { return this.hubAgentRooms?.available() === true; }
@@ -6184,8 +6226,18 @@ export class FleetManager {
6184
6226
  throw Error("invalid-approver");
6185
6227
  if ((input.mode || input.roomTools) && !before.canSetMode)
6186
6228
  throw Error("forbidden");
6187
- if (input.grants?.some(grant => grant.target !== name || !this.webChatOwner(grant.source)
6188
- || 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
+ }))
6189
6241
  throw Error("invalid-grant");
6190
6242
  // Configuration does not prove an external MCP's account independence. Preserve a conservative warning.
6191
6243
  if (input.roomTools)
@@ -7247,7 +7299,7 @@ export class FleetManager {
7247
7299
  * The returned promise is the caller's to handle; the stored one is already
7248
7300
  * handled, so a rejection never escapes as an unhandled rejection.
7249
7301
  */
7250
- startExclusiveReconcile(observer) {
7302
+ startExclusiveReconcile(observer, defaultConsent) {
7251
7303
  if (this.reconcileInFlight)
7252
7304
  return null;
7253
7305
  this.reloadPending = false;
@@ -7255,7 +7307,7 @@ export class FleetManager {
7255
7307
  const caller = new Promise((resolve, reject) => {
7256
7308
  settle = (err, outcome) => (err ? reject(err instanceof Error ? err : new Error(String(err))) : resolve(outcome ?? {}));
7257
7309
  });
7258
- this.reconcileInFlight = this.reconcileInstances(observer)
7310
+ this.reconcileInFlight = this.reconcileInstances(observer, defaultConsent)
7259
7311
  .then(outcome => settle(null, outcome), err => settle(err))
7260
7312
  .finally(() => {
7261
7313
  this.reconcileInFlight = null;
@@ -8188,14 +8240,15 @@ export class FleetManager {
8188
8240
  * setting as a value of its own rather than the shared login it would fall to.
8189
8241
  * A switch on the same backend that loses the conversation (kiro) starts fresh.
8190
8242
  */
8191
- classicProfileChange(name, backendChanged) {
8243
+ classicProfileChange(name, backendChanged, adoptedBackend) {
8192
8244
  const launched = this.classicLaunchedProfile(name);
8193
8245
  if (!launched || !this.classicChannels)
8194
8246
  return { changed: false, startsFresh: false };
8195
- 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);
8196
8249
  if (profileKey(launched) === profileKey(next))
8197
8250
  return { changed: false, startsFresh: false };
8198
- const backend = this.classicChannels.getBackendByInstance(name, this.fleetConfig?.defaults?.backend);
8251
+ const backend = adoptedBackend ?? this.classicChannels.getBackendByInstance(name, this.fleetConfig?.defaults?.backend);
8199
8252
  return {
8200
8253
  changed: true,
8201
8254
  // A backend change keeps its own (existing) restart semantics.
@@ -8310,7 +8363,7 @@ export class FleetManager {
8310
8363
  logSource(name) {
8311
8364
  const instances = this.fleetConfig?.instances ?? {};
8312
8365
  const config = Object.prototype.hasOwnProperty.call(instances, name) ? instances[name] : undefined;
8313
- 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";
8314
8367
  const live = this.lifecycle.daemons.get(name)?.logTranscriptPath() ?? null;
8315
8368
  if (backend === "claude-code") {
8316
8369
  let path = live;
@@ -9981,7 +10034,7 @@ export class FleetManager {
9981
10034
  check();
9982
10035
  if (this.lifecycle.epochOf(instanceName) !== stoppedEpoch)
9983
10036
  throw new Error("Classic restart superseded by stop");
9984
- 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);
9985
10038
  check();
9986
10039
  }
9987
10040
  /** Reload classicBot.yaml once. Kept callable so the periodic production
@@ -9998,8 +10051,9 @@ export class FleetManager {
9998
10051
  const oldToolProgress = new Map();
9999
10052
  const oldReplyGuard = new Map();
10000
10053
  for (const ch of this.classicChannels.getAll()) {
10001
- oldBackends.set(ch.instanceName, this.classicChannels.getBackendByInstance(ch.instanceName, fleetBackend));
10002
- 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));
10003
10057
  oldAutoPause.set(ch.instanceName, this.classicChannels.getAutoPauseAfter(ch.channelId, ch.adapterId, this.fleetConfig?.defaults?.auto_pause_after));
10004
10058
  oldToolProgress.set(ch.instanceName, this.classicChannels.getToolProgress(ch.channelId, ch.adapterId, this.fleetConfig?.defaults?.tool_progress));
10005
10059
  oldReplyGuard.set(ch.instanceName, this.classicChannels.getReplyCompletionGuard(ch.channelId, ch.adapterId, this.fleetConfig?.defaults?.reply_completion_guard));
@@ -10011,8 +10065,12 @@ export class FleetManager {
10011
10065
  this.reportClassicUnrecoverableIds();
10012
10066
  this.reregisterClassicChannels();
10013
10067
  for (const ch of this.classicChannels.getAll()) {
10014
- const newBackend = this.classicChannels.getBackendByInstance(ch.instanceName, fleetBackend);
10015
- 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;
10016
10074
  const newAutoPause = this.classicChannels.getAutoPauseAfter(ch.channelId, ch.adapterId, this.fleetConfig?.defaults?.auto_pause_after);
10017
10075
  const newToolProgress = this.classicChannels.getToolProgress(ch.channelId, ch.adapterId, this.fleetConfig?.defaults?.tool_progress);
10018
10076
  const newReplyGuard = this.classicChannels.getReplyCompletionGuard(ch.channelId, ch.adapterId, this.fleetConfig?.defaults?.reply_completion_guard);
@@ -10021,7 +10079,7 @@ export class FleetManager {
10021
10079
  const autoPauseChanged = oldAutoPause.get(ch.instanceName) !== newAutoPause;
10022
10080
  // #1220: a running CLI keeps the login it was launched with, so a new
10023
10081
  // credential_profile only takes effect through a restart.
10024
- 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);
10025
10083
  if (this.daemons.has(ch.instanceName) && (backendChanged || modelChanged || autoPauseChanged || profileChanged)) {
10026
10084
  this.logger.info({ instanceName: ch.instanceName, backendFrom: oldBackends.get(ch.instanceName), backendTo: newBackend, modelFrom: oldModels.get(ch.instanceName), modelTo: newModel,
10027
10085
  ...(profileChanged ? { profileFrom, profileTo } : {}) }, "Backend/model/profile changed — restarting");
@@ -10164,14 +10222,14 @@ export class FleetManager {
10164
10222
  }
10165
10223
  }
10166
10224
  else if (!isWindowsInstance(config) && kind === "classic") {
10167
- // #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
10168
10226
  // coordination playbooks (#557 kept those out of end-user bots) — and only into a workspace AgEnD manages: the
10169
10227
  // room's own folder under <AGEND_HOME>/workspaces/. Anywhere else, nothing is written; `agend-agent skill <name>`
10170
10228
  // reads any bundled skill on demand.
10171
10229
  try {
10172
10230
  const skillsWorkDir = this.resolveKnowledgeWorkDir(config.working_directory, backend, name);
10173
10231
  if (insideManagedWorkspaces(skillsWorkDir))
10174
- measureSyncWork("fleet.classicSkills", () => this.syncRoleSkills(skillsWorkDir, backend, "classic"));
10232
+ measureSyncWork("fleet.classicSkills", () => this.syncRoleSkills(skillsWorkDir, backend, "classic", undefined, this.classicContactRestricted(name)));
10175
10233
  else
10176
10234
  this.logger.debug({ name, skillsWorkDir }, "Classic workspace is not AgEnD-managed — no skills published");
10177
10235
  }
@@ -10249,7 +10307,7 @@ export class FleetManager {
10249
10307
  const channel = this.classicChannels?.getAll().find(item => item.instanceName === name);
10250
10308
  if (!channel || !this.classicChannels)
10251
10309
  throw new Error(`Paused instance '${name}' is no longer configured`);
10252
- 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);
10253
10311
  }
10254
10312
  /**
10255
10313
  * Start instances with configurable concurrency and stagger delay.
@@ -10625,7 +10683,7 @@ export class FleetManager {
10625
10683
  const channel = this.classicChannels?.getAll().find(item => item.instanceName === name);
10626
10684
  if (!channel || !this.classicChannels)
10627
10685
  throw new Error(`Instance '${name}' is no longer configured`);
10628
- 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));
10629
10687
  }
10630
10688
  /**
10631
10689
  * Unattended ClassicBot start (fleet startup batch, full-restart batch, the
@@ -10636,7 +10694,7 @@ export class FleetManager {
10636
10694
  */
10637
10695
  async startClassicInstanceUnattended(ch, what) {
10638
10696
  try {
10639
- 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));
10640
10698
  return this.daemons.has(ch.instanceName);
10641
10699
  }
10642
10700
  catch (err) {
@@ -10648,15 +10706,13 @@ export class FleetManager {
10648
10706
  }
10649
10707
  }
10650
10708
  backendNameOf(name) {
10709
+ const pending = this.pendingRuntimeIdentity(name);
10710
+ if (pending)
10711
+ return pending.backend || "claude-code";
10651
10712
  const fleetDefault = this.fleetConfig?.defaults?.backend;
10652
10713
  const fleetInstance = this.fleetConfig?.instances[name];
10653
- // A malformed/manual config can give a fleet and Classic entry the same
10654
- // instance name. Fleet ownership wins, including its inherited default;
10655
- // otherwise a Classic override could make backend-scoped recovery restart
10656
- // the shared process under the wrong login result.
10657
10714
  if (fleetInstance)
10658
10715
  return fleetInstance.backend ?? fleetDefault ?? "claude-code";
10659
- // ClassicBot channels pick their own backend; the fleet default is only the fallback.
10660
10716
  if (this.classicChannels?.getAll().some(channel => channel.instanceName === name)) {
10661
10717
  return this.classicChannels.getBackendByInstance(name, fleetDefault);
10662
10718
  }
@@ -11160,7 +11216,7 @@ export class FleetManager {
11160
11216
  const backend = this.classicChannels.getBackendByInstance(name, fleetBackend);
11161
11217
  return { backend, profile: credentialHomeSpec(backend) ? profileName(this.classicChannels.getCredentialProfileByInstance(name, this.fleetConfig?.defaults)) : null };
11162
11218
  });
11163
- 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));
11164
11220
  this.stormWindow.markRecovered(name);
11165
11221
  return;
11166
11222
  }
@@ -18165,6 +18221,7 @@ export class FleetManager {
18165
18221
  Object.assign(current, resolved);
18166
18222
  }
18167
18223
  const previousCatalogConfig = this.savedFleetConfigSnapshot;
18224
+ this.trackSharedDefaultChanges(previousCatalogConfig);
18168
18225
  this.savedFleetConfigSnapshot = structuredClone(this.fleetConfig);
18169
18226
  this.nativeMcpStore?.observePolicies();
18170
18227
  this.probeChangedCliEnvs(previousCatalogConfig);
@@ -18175,6 +18232,61 @@ export class FleetManager {
18175
18232
  this.observeHubSwitches(); // S-51: so does a saved Hub switch
18176
18233
  this.hostMonitor?.apply();
18177
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
+ }
18178
18290
  /** A permission tightening is effective when its save returns, independently of the later apply job or IPC. */
18179
18291
  refreshSavedDashboardPermissions() {
18180
18292
  if (!this.fleetConfig)
@@ -20359,7 +20471,7 @@ export class FleetManager {
20359
20471
  entry.web = {
20360
20472
  text: web.text,
20361
20473
  ...(links ? { links } : {}),
20362
- 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 }] : [])],
20363
20475
  expiresAt: Date.now() + (opts.timeoutMs ?? NONCE_BUTTON_TIMEOUT_MS),
20364
20476
  };
20365
20477
  this.emitSseEvent("prompt", { instance: entry.instanceName, nonce, ...entry.web });
@@ -20962,6 +21074,7 @@ export class FleetManager {
20962
21074
  backendSignIns: () => this.needsYouBackendSignIns(),
20963
21075
  signInKeepAlive: () => this.keepAliveAttention(),
20964
21076
  hubExecution: () => this.hubExecutionAttention?.() ?? [],
21077
+ hubShareLapses: () => this.hubShareLapses(),
20965
21078
  runtimeUpdates: () => remoteRuntimeEnabled() ? runtimeUpdateAttention(this.runtimeHub?.listMachines() ?? [], t, this.worlds.keys().next().value) : [],
20966
21079
  hubHolds: () => this.hubHolds.map(h => {
20967
21080
  // A provider hold carries a bounded setup reason; its guidance (S4b's copy) when present, else the code's text.
@@ -23159,9 +23272,7 @@ export class FleetManager {
23159
23272
  await data.respond(t("filename.invalid"));
23160
23273
  return;
23161
23274
  }
23162
- const backend = target.kind === "classic"
23163
- ? this.classicChannels.getBackendByInstance(target.name, this.fleetConfig?.defaults?.backend)
23164
- : (this.fleetConfig?.instances[target.name]?.backend ?? this.fleetConfig?.defaults?.backend ?? "claude-code");
23275
+ const backend = this.backendNameForInstance(target.name);
23165
23276
  // force (-f) is only meaningful for kiro/classic /chat save.
23166
23277
  const force = target.kind === "classic" && !!data.options?.force;
23167
23278
  const cmd = saveCommandForBackend(backend, filename, force);
@@ -24768,7 +24879,7 @@ export class FleetManager {
24768
24879
  const room = this.classicChannels?.getAll().find(room => room.instanceName === record.name);
24769
24880
  if (!room)
24770
24881
  throw new ClaudeCredentialError("conflict");
24771
- 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);
24772
24883
  }
24773
24884
  }
24774
24885
  finally {
@@ -26333,17 +26444,24 @@ export class FleetManager {
26333
26444
  db.board.setCardLimit((name) => boardCardLimit(this.fleetConfig, name));
26334
26445
  // An instance with the task board switched off is handed no cards and sent no notices (read at each write and wake).
26335
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));
26336
26460
  const waker = this.taskBoardWaker = new TaskBoardWaker({
26337
- 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),
26338
26463
  isInstance: (name) => this.fleetConfig?.instances?.[name] != null,
26339
26464
  boardOff: (name) => taskBoardOffIn(this.fleetConfig, name),
26340
- // #2785 (c), #2801: the maker's own message already told it; the board's line would repeat it.
26341
- messagedAbout: (from, to, codes, sinceMs) => {
26342
- const outbox = this.deliveryOutbox;
26343
- if (!outbox?.isOpen)
26344
- return false;
26345
- return outbox.recentTextsFrom(to, from, new Date(sinceMs).toISOString()).some((text) => codes.some((code) => namesCard(text, code)));
26346
- },
26347
26465
  // #2801: a notice still waiting whose cards have all changed again is not delivered.
26348
26466
  withdraw: (prefix, stale, reason) => {
26349
26467
  const outbox = this.deliveryOutbox;
@@ -26373,21 +26491,68 @@ export class FleetManager {
26373
26491
  this.observeWorkingState(name, "tasks");
26374
26492
  this.emitSseEvent("tasks", { rev, ids, projects });
26375
26493
  waker.changed(changed);
26376
- waker.note(wakes);
26494
+ waker.note(this.withWriterOrigins(wakes));
26377
26495
  // step 3: cards waiting for the person are Needs you items; #2355 review: a project's lead routes them too.
26378
26496
  if (ids.length || projects)
26379
26497
  this.needsYou?.poke();
26380
26498
  });
26381
26499
  }
26382
- /** A task board notice, as AgEnD's own (not a person's words): through the delivery outbox, held until delivered. */
26383
- 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 = {}) {
26384
26506
  this.ensureDeliveryOutbox();
26385
26507
  const outbox = this.deliveryOutbox;
26386
26508
  if (!outbox)
26387
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
+ }
26388
26516
  outbox.admitSystemNotice(instance, key, message, new Date());
26389
26517
  return true;
26390
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
+ }
26391
26556
  listClaimedTasks(assignee) {
26392
26557
  try {
26393
26558
  return this.scheduler?.db.listTasks({ assignee, status: "claimed" }) ?? [];
@@ -26489,19 +26654,8 @@ export class FleetManager {
26489
26654
  return true;
26490
26655
  }
26491
26656
  // ── Topic icon + auto-archive ─────────────────────────────────────────────
26492
- static INSTRUCTIONS_FILENAME = {
26493
- "claude-code": "CLAUDE.md",
26494
- "codex": "AGENTS.md",
26495
- "opencode": "AGENTS.md",
26496
- "kiro-cli": ".kiro/steering/project.md",
26497
- // Grok reads AGENTS.md project docs; agy reads .agents/AGENTS.md (board 0340ec89: not the lowercase name) — the
26498
- // same files their writeConfig() appends fleet instructions to.
26499
- "grok": "AGENTS.md",
26500
- // muse init scaffolds AGENTS.md and the binary reads it as project rules.
26501
- "muse": "AGENTS.md",
26502
- "antigravity": ".agents/AGENTS.md",
26503
- "mock": "CLAUDE.md",
26504
- };
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]));
26505
26659
  static GENERAL_INSTRUCTIONS = GENERAL_ROLE_INSTRUCTIONS;
26506
26660
  /** Ensure the general instance has its project instructions file + knowledge */
26507
26661
  ensureGeneralInstructions(workDir, backendName, instanceName) {
@@ -26520,9 +26674,27 @@ export class FleetManager {
26520
26674
  // #1914 review: a person's dangling symlink there is kept and not followed (nothing created where it points).
26521
26675
  this.logger.warn({ filePath }, "General's agy instructions file is a dangling symlink; left as it is, not written");
26522
26676
  }
26523
- else if (!existsSync(filePath)) {
26524
- writeFileSync(filePath, FleetManager.GENERAL_INSTRUCTIONS, "utf-8");
26525
- 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
+ }
26526
26698
  }
26527
26699
  // Sync bundled knowledge files to general's steering and skills directories.
26528
26700
  this.syncGeneralKnowledge(workDir, backend);
@@ -26571,7 +26743,7 @@ export class FleetManager {
26571
26743
  this.logger.debug({ knowledgeDir, workDir, backend }, "Synced general knowledge files");
26572
26744
  }
26573
26745
  /** Publish only the bundled skills eligible for an instance role. */
26574
- syncRoleSkills(workDir, backend, role, knowledgeDir) {
26746
+ syncRoleSkills(workDir, backend, role, knowledgeDir, restrictedClassic = false) {
26575
26747
  const skillSegments = FleetManager.SKILLS_DIR_SEGMENTS[backend];
26576
26748
  if (!skillSegments)
26577
26749
  return;
@@ -26586,7 +26758,7 @@ export class FleetManager {
26586
26758
  this.syncManagedSkills(join(workDir, ...skillSegments), join(root, "skills"), role, adoptLegacyUnmanaged,
26587
26759
  // #2163: a Classic bot's skills folder (or a skill in it) may be a link out of its workspace; every path is
26588
26760
  // checked where it really lands, just before it is written.
26589
- role === "classic" ? (path) => insideManagedWorkspaces(path) : undefined);
26761
+ role === "classic" ? (path) => insideManagedWorkspaces(path) : undefined, role === "classic" && restrictedClassic ? new Set(["persona-emoji", "web-appearance"]) : undefined);
26590
26762
  this.logger.debug({ workDir, backend, role }, "Synced role-based bundled skills");
26591
26763
  }
26592
26764
  /**
@@ -26713,7 +26885,7 @@ export class FleetManager {
26713
26885
  catch { /* said this time; said again next start */ }
26714
26886
  this.logger.warn({ skills: names, destSkills }, "Skipping bundled skills — skills of these names exist but were not published by AgEnD");
26715
26887
  }
26716
- syncManagedSkills(destSkills, srcSkills, role, adoptLegacyUnmanaged = false, confined) {
26888
+ syncManagedSkills(destSkills, srcSkills, role, adoptLegacyUnmanaged = false, confined, excluded) {
26717
26889
  if (!existsSync(srcSkills))
26718
26890
  return;
26719
26891
  const refuse = (path) => {
@@ -26756,6 +26928,8 @@ export class FleetManager {
26756
26928
  }
26757
26929
  }
26758
26930
  const eligible = bundled.filter(name => {
26931
+ if (excluded?.has(name))
26932
+ return false;
26759
26933
  const roles = this.readManagedSkillRoles(join(srcSkills, name, "SKILL.md"));
26760
26934
  // General is the coordinator and receives every playbook. Workers and Classic bots receive only skills
26761
26935
  // explicitly marked for their role (#2163).
@@ -27415,7 +27589,9 @@ export class FleetManager {
27415
27589
  */
27416
27590
  claudeModelKnown(instanceName, model,
27417
27591
  /** #1806: null on a switch INTO claude-code — the configured model then belongs to the backend being left. */
27418
- 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)) {
27419
27595
  const aliases = ["default", "sonnet", "opus", "haiku", "opusplan", "Fable"];
27420
27596
  const api = (this.webModelEnv("claude-code", instanceName)?.apiModels ?? []).map(m => m.id);
27421
27597
  const lower = model.trim().toLowerCase();
@@ -27437,9 +27613,12 @@ export class FleetManager {
27437
27613
  }
27438
27614
  /** Resolve the backend name configured for an instance (fleet or classic). */
27439
27615
  backendNameForInstance(instanceName) {
27616
+ const pending = this.pendingRuntimeIdentity(instanceName);
27617
+ if (pending)
27618
+ return pending.backend || "claude-code";
27440
27619
  const fleetCfg = this.fleetConfig?.instances[instanceName];
27441
- if (fleetCfg?.backend)
27442
- return fleetCfg.backend;
27620
+ if (fleetCfg)
27621
+ return fleetCfg.backend || this.fleetConfig?.defaults?.backend || "claude-code";
27443
27622
  const classic = this.classicChannels?.getChannelIdByInstance(instanceName) !== undefined
27444
27623
  ? this.classicChannels?.getBackendByInstance(instanceName, this.fleetConfig?.defaults?.backend)
27445
27624
  : undefined;
@@ -27640,19 +27819,29 @@ export class FleetManager {
27640
27819
  : source === "unresolved" ? `default (${reason ?? "unresolved"})`
27641
27820
  : model,
27642
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");
27643
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
+ }
27644
27831
  if (isWindowsInstance(fleetInstance))
27645
27832
  return fleetInstance.model?.trim() ? done(fleetInstance.model.trim(), "instance") : done("default", "unresolved", "this CLI does not report a default");
27646
27833
  if (fleetInstance) {
27647
- if (fleetInstance.model?.trim())
27648
- return done(fleetInstance.model.trim(), "instance");
27649
- 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);
27650
27839
  if (fleetDefault?.trim())
27651
27840
  return done(fleetDefault.trim(), "fleet-default");
27652
27841
  }
27653
27842
  const classic = this.classicChannels?.getAll().find(ch => ch.instanceName === instanceName);
27654
27843
  if (classic) {
27655
- 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);
27656
27845
  if (classicModel?.trim())
27657
27846
  return done(classicModel.trim(), "classic");
27658
27847
  }
@@ -29289,9 +29478,9 @@ export class FleetManager {
29289
29478
  const saved = await switchClassicRoomBackend(this, room, plan, from, stillCurrent);
29290
29479
  if (!saved.ok)
29291
29480
  return t("backend.failed", instanceName, plan.backend, saved.error);
29292
- return this.getInstanceStatus(instanceName) === "running"
29481
+ return this.withHubShareLapse(instanceName, this.getInstanceStatus(instanceName) === "running"
29293
29482
  ? t("backend.switched", instanceName, plan.backend, shown.model, shown.effort)
29294
- : 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)));
29295
29484
  }
29296
29485
  const { value, error } = await new Promise(resolve => {
29297
29486
  applyInstanceConfigPatch(this, instanceName, { backend: plan.backend, model: plan.model, effort: plan.effort }, (value, error) => resolve({ value, error }));
@@ -29302,8 +29491,12 @@ export class FleetManager {
29302
29491
  if (result.warning)
29303
29492
  return t("backend.restart_failed", instanceName, plan.backend, result.warning);
29304
29493
  if (result.restarted)
29305
- return t("backend.switched", instanceName, plan.backend, shown.model, shown.effort);
29306
- 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;
29307
29500
  }
29308
29501
  /** A step's buttons: index callbacks (a model id can be longer than Telegram's 64-byte callback data allows). */
29309
29502
  backendStepButtons(instanceName, nonce, step) {
@@ -29822,7 +30015,7 @@ export class FleetManager {
29822
30015
  await this.restartSingleInstance(instanceName, { explicit: true });
29823
30016
  }
29824
30017
  else {
29825
- 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));
29826
30019
  }
29827
30020
  this.reregisterClassicChannels();
29828
30021
  // Auto-enable collab for Discord classic channels (TG uses @mention directly without collab mode)
@@ -30394,7 +30587,7 @@ export class FleetManager {
30394
30587
  * Whitelisted runtime fields are pushed into live daemons; all other instance
30395
30588
  * fields, plus cold fleet-level settings, retain restart semantics.
30396
30589
  */
30397
- async reconcileInstances(observe) {
30590
+ async reconcileInstances(observe, defaultConsent) {
30398
30591
  if (!this.configPath)
30399
30592
  return {};
30400
30593
  const oldConfig = this.fleetConfig;
@@ -30467,8 +30660,8 @@ export class FleetManager {
30467
30660
  for (const ch of this.classicChannels.getAll()) {
30468
30661
  const runtimeConfig = this.daemons.get(ch.instanceName)?.getConfigSnapshot?.();
30469
30662
  oldClassicBehavior.set(ch.instanceName, {
30470
- backend: this.classicChannels.getBackend(ch.channelId, ch.adapterId, oldConfig?.defaults?.backend),
30471
- 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),
30472
30665
  autoPauseAfter: this.classicChannels.getAutoPauseAfter(ch.channelId, ch.adapterId, oldConfig?.defaults?.auto_pause_after),
30473
30666
  // Settings mutates FleetManager's in-memory defaults before SIGHUP.
30474
30667
  // The live daemon is therefore the authority for the previous hot
@@ -30536,7 +30729,12 @@ export class FleetManager {
30536
30729
  // complete snapshot: Settings mutates FleetManager's config before SIGHUP,
30537
30730
  // so an old/new diff alone can miss the live daemon's stale value.
30538
30731
  for (const [name, config] of Object.entries(newInstances)) {
30732
+ const adoption = this.sharedDefaultsView(name, config, defaultConsent);
30539
30733
  if (!this.daemons.has(name)) {
30734
+ if (adoption.deferred) {
30735
+ observe?.(name, "restart", "next-start");
30736
+ continue;
30737
+ }
30540
30738
  // New instance — startInstance already calls connectIpcToInstance. #2482: a paused one is not started (startInstance
30541
30739
  // returns at its pause); say so, quietly, instead of "starting" on every reload.
30542
30740
  if (this.lifecycle.isPaused(name)) {
@@ -30561,7 +30759,9 @@ export class FleetManager {
30561
30759
  else if (oldConfig?.instances[name]) {
30562
30760
  const daemon = this.daemons.get(name);
30563
30761
  const runtimeConfig = daemon.getConfigSnapshot?.() ?? oldConfig.instances[name];
30564
- const change = classifyInstanceChange(runtimeConfig, config);
30762
+ const change = classifyInstanceChange(runtimeConfig, adoption.config);
30763
+ if (adoption.deferred)
30764
+ observe?.(name, "restart", "next-start");
30565
30765
  // (b) The person switched its task board on: tell it (its tool list shows the `task` tool at once).
30566
30766
  if (taskBoardSwitchedOn(runtimeConfig.dashboard, config.dashboard)) {
30567
30767
  this.admitTaskBoardNotice(name, TASK_BOARD_ON_NOTICE, `task-board-on:${name}:${Date.now()}`);
@@ -30585,7 +30785,7 @@ export class FleetManager {
30585
30785
  this.logger.warn({ name }, "Config-update IPC unavailable — applied hot config in-process");
30586
30786
  }
30587
30787
  this.logger.info({ name, fields: [...HOT_INSTANCE_CONFIG_KEYS] }, "Instance hot config reloaded");
30588
- observe?.(name, "hot", "done");
30788
+ observe?.(name, "hot", adoption.deferred ? "next-start" : "done");
30589
30789
  }
30590
30790
  }
30591
30791
  }
@@ -30598,10 +30798,15 @@ export class FleetManager {
30598
30798
  const old = oldClassicBehavior.get(ch.instanceName);
30599
30799
  if (!old || !this.daemons.has(ch.instanceName))
30600
30800
  continue;
30601
- const backend = this.classicChannels.getBackend(ch.channelId, ch.adapterId, this.fleetConfig?.defaults?.backend);
30602
- 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");
30603
30808
  const autoPauseAfter = this.classicChannels.getAutoPauseAfter(ch.channelId, ch.adapterId, this.fleetConfig?.defaults?.auto_pause_after);
30604
- const profile = this.classicProfileChange(ch.instanceName, old.backend !== backend);
30809
+ const profile = this.classicProfileChange(ch.instanceName, old.backend !== backend, adoption.deferred ? backend : undefined);
30605
30810
  if (old.backend !== backend || old.model !== model || old.autoPauseAfter !== autoPauseAfter || profile.changed) {
30606
30811
  this.logger.info({ instanceName: ch.instanceName, ...(profile.changed ? { profileFrom: profile.from, profileTo: profile.to } : {}) }, "Classic cold config changed — restarting");
30607
30812
  observe?.(ch.instanceName, "restart", "running");
@@ -32040,7 +32245,7 @@ export class FleetManager {
32040
32245
  if (keys.has(key))
32041
32246
  process.env[key] = value;
32042
32247
  }
32043
- planConfigApply() {
32248
+ planConfigApply(defaultConsent) {
32044
32249
  const rows = [];
32045
32250
  const nextConfig = this.nextFleetConfig();
32046
32251
  const next = nextConfig?.instances ?? {};
@@ -32056,8 +32261,15 @@ export class FleetManager {
32056
32261
  rows.push({ target: name, kind: "restart" });
32057
32262
  continue;
32058
32263
  }
32059
- const change = classifyInstanceChange(runtime, config);
32060
- 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")
32061
32273
  rows.push({ target: name, kind: change === "restart" ? "restart" : "hot" });
32062
32274
  }
32063
32275
  for (const name of this.daemons.keys()) {
@@ -32077,7 +32289,8 @@ export class FleetManager {
32077
32289
  * the whole point: the retry after a lost response must not apply everything a
32078
32290
  * second time.
32079
32291
  */
32080
- startSettingsApply(key) {
32292
+ captureSharedDefaultsConsent() { return this.sharedDefaultAdoption.receipt(); }
32293
+ startSettingsApply(key, sharedDefaults = "next-start", restartTargets = [], receipt) {
32081
32294
  // The key is checked first on purpose: a retry of the apply that is running
32082
32295
  // right now must get its own job back, not "busy".
32083
32296
  const existing = this.applyJobs.findByKey(key);
@@ -32086,17 +32299,18 @@ export class FleetManager {
32086
32299
  if (this.reconcileInFlight || this.activeApplyJobId) {
32087
32300
  return { busy: this.activeApplyJobId ? this.applyJobs.get(this.activeApplyJobId) : null };
32088
32301
  }
32089
- 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));
32090
32304
  // Reserved synchronously: the work starts a microtask later, and a second
32091
32305
  // request arriving in that gap must see the slot taken.
32092
32306
  this.activeApplyJobId = job.id;
32093
32307
  // Start after the caller has its answer, so the first thing the page renders
32094
32308
  // is the whole plan with every row still pending — not a job the reconcile
32095
32309
  // has already half-finished synchronously.
32096
- queueMicrotask(() => void this.runSettingsApply(job.id));
32310
+ queueMicrotask(() => void this.runSettingsApply(job.id, defaultConsent));
32097
32311
  return { job, reused: false };
32098
32312
  }
32099
- async runSettingsApply(jobId) {
32313
+ async runSettingsApply(jobId, defaultConsent) {
32100
32314
  const emit = () => {
32101
32315
  const job = this.applyJobs.get(jobId);
32102
32316
  // An accelerator only: these frames carry no event id, so a client that
@@ -32122,7 +32336,7 @@ export class FleetManager {
32122
32336
  };
32123
32337
  emit();
32124
32338
  try {
32125
- const started = this.startExclusiveReconcile(observer);
32339
+ const started = this.startExclusiveReconcile(observer, defaultConsent);
32126
32340
  if (!started) {
32127
32341
  // The slot was reserved before the microtask, so this means a SIGHUP
32128
32342
  // reconcile started in between. Report it instead of applying twice.
@@ -33535,11 +33749,7 @@ export class FleetManager {
33535
33749
  const cost = isNativePaneInstance(nativeConfig) ? null : statusline?.cost?.total_cost_usd ?? 0;
33536
33750
  // Align with /ctx: statusline for claude-code, pane scrape for kiro/grok/codex.
33537
33751
  const classic = classicOnly.includes(name);
33538
- const backend = classic
33539
- ? this.classicChannels.getBackendByInstance(name, this.fleetConfig?.defaults?.backend)
33540
- : (this.fleetConfig?.instances[name]?.backend
33541
- ?? this.fleetConfig?.defaults?.backend
33542
- ?? "claude-code");
33752
+ const backend = this.backendNameForInstance(name);
33543
33753
  const { context } = isNativePaneInstance(nativeConfig) ? { context: null } : resolveInstanceContext(this.dataDir, name, backend, { source: this.getPaneContextSource(name), statusline });
33544
33754
  // context_pct: null when unavailable, not 0
33545
33755
  const context_pct = context ?? null;