mixdog 1.4.2 → 1.4.4

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 (474) hide show
  1. package/package.json +2 -2
  2. package/scripts/build-shipped-history.mjs +15 -5
  3. package/scripts/gate-local.mjs +65 -19
  4. package/scripts/graph-parity.mjs +8 -3
  5. package/scripts/lib/gate-scheduler.mjs +2 -1
  6. package/scripts/lib/run-node-tests.mjs +17 -5
  7. package/scripts/lib/test-failure-summary.mjs +1 -8
  8. package/scripts/lib/test-spawn-ledger.mjs +33 -2
  9. package/scripts/post-release-check.mjs +26 -16
  10. package/scripts/provider-pingpong-live.mjs +1 -1
  11. package/scripts/prune-embedding-runtime.mjs +3 -1
  12. package/scripts/release-paths.mjs +7 -1
  13. package/src/defaults/shipped-history.json +24 -0
  14. package/src/defaults/skills/computer-use/SKILL.md +14 -3
  15. package/src/defaults/skills/memory-management/SKILL.md +10 -5
  16. package/src/defaults/skills/setup/SKILL.md +2 -2
  17. package/src/defaults/skills/setup/references/actions.md +17 -4
  18. package/src/defaults/skills/setup/references/surfaces.md +3 -0
  19. package/src/defaults/skills/setup-guide/SKILL.md +6 -1
  20. package/src/lib/instruction-text.cjs +36 -0
  21. package/src/lib/rules-builder.cjs +34 -20
  22. package/src/orchestration/balanced.md +23 -0
  23. package/src/orchestration/focused.md +22 -0
  24. package/src/orchestration/none.md +5 -0
  25. package/src/orchestration/swarm.md +24 -0
  26. package/src/rules/agent-mode/AGENT_MODE.md +3 -1
  27. package/src/rules/agent-mode/MIXY.md +5 -3
  28. package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch/session-prep.mjs +3 -3
  29. package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch.mjs +0 -1
  30. package/src/runtime/agent/orchestrator/agent-runtime/agent-progress-watchdog.mjs +4 -2
  31. package/src/runtime/agent/orchestrator/agent-runtime/cache-strategy.mjs +0 -9
  32. package/src/runtime/agent/orchestrator/agent-runtime/heartbeat-completion.mjs +2 -2
  33. package/src/runtime/agent/orchestrator/agent-runtime/session-builder.mjs +67 -0
  34. package/src/runtime/agent/orchestrator/agent-trace-format.mjs +1 -0
  35. package/src/runtime/agent/orchestrator/context/role-instructions.mjs +4 -4
  36. package/src/runtime/agent/orchestrator/mcp/agent-connectors.mjs +3 -1
  37. package/src/runtime/agent/orchestrator/mcp/child-tree.mjs +199 -46
  38. package/src/runtime/agent/orchestrator/mcp/client-config.mjs +3 -5
  39. package/src/runtime/agent/orchestrator/mcp/client-transport.mjs +9 -3
  40. package/src/runtime/agent/orchestrator/mcp/client.mjs +3 -5
  41. package/src/runtime/agent/orchestrator/mcp/oauth-client.mjs +1 -1
  42. package/src/runtime/agent/orchestrator/mcp/oauth-credentials.mjs +8 -2
  43. package/src/runtime/agent/orchestrator/mcp/oauth-probe.mjs +1 -1
  44. package/src/runtime/agent/orchestrator/mcp/oauth-provider.mjs +14 -0
  45. package/src/runtime/agent/orchestrator/mcp/oauth.mjs +1 -1
  46. package/src/runtime/agent/orchestrator/providers/admission-scheduler.mjs +2 -1
  47. package/src/runtime/agent/orchestrator/providers/anthropic-api-request.mjs +11 -1
  48. package/src/runtime/agent/orchestrator/providers/anthropic-oauth-client-version.mjs +1 -1
  49. package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn/turn-events/content-block-start.mjs +4 -0
  50. package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn/turn-events/content-block-stop.mjs +3 -3
  51. package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn/turn-outcome.mjs +2 -0
  52. package/src/runtime/agent/orchestrator/providers/anthropic-turn-result.mjs +2 -0
  53. package/src/runtime/agent/orchestrator/providers/anthropic.mjs +2 -0
  54. package/src/runtime/agent/orchestrator/providers/codex-client-meta.mjs +1 -1
  55. package/src/runtime/agent/orchestrator/providers/custom-provider-config.mjs +121 -9
  56. package/src/runtime/agent/orchestrator/providers/custom-provider.mjs +4 -1
  57. package/src/runtime/agent/orchestrator/providers/gemini-thinking.mjs +2 -2
  58. package/src/runtime/agent/orchestrator/providers/lib/generation-window.mjs +9 -0
  59. package/src/runtime/agent/orchestrator/providers/openai-compat-chat-send.mjs +9 -1
  60. package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream/stream-result.mjs +2 -0
  61. package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream/stream-state.mjs +5 -0
  62. package/src/runtime/agent/orchestrator/providers/openai-compat-options.mjs +3 -0
  63. package/src/runtime/agent/orchestrator/providers/openai-compat-response-normalization.mjs +6 -6
  64. package/src/runtime/agent/orchestrator/providers/openai-compat-responses-head-parity.json +2784 -2872
  65. package/src/runtime/agent/orchestrator/providers/openai-compat-responses.mjs +10 -1
  66. package/src/runtime/agent/orchestrator/providers/openai-compat-xai.mjs +5 -8
  67. package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-events.mjs +3 -0
  68. package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-outcome.mjs +2 -0
  69. package/src/runtime/agent/orchestrator/providers/openai-responses-payload-parity.fixture.json +288 -300
  70. package/src/runtime/agent/orchestrator/providers/openai-ws-response-state.mjs +9 -2
  71. package/src/runtime/agent/orchestrator/providers/openrouter-provider-routing.mjs +28 -0
  72. package/src/runtime/agent/orchestrator/providers/openrouter.mjs +4 -1
  73. package/src/runtime/agent/orchestrator/providers/registry.mjs +30 -25
  74. package/src/runtime/agent/orchestrator/providers/vertex-ai.mjs +10 -1
  75. package/src/runtime/agent/orchestrator/providers/xai-tool-search-head-parity.json +10 -30
  76. package/src/runtime/agent/orchestrator/runtime-core/ask-user-result.mjs +66 -0
  77. package/src/runtime/agent/orchestrator/runtime-core/builtin-features.mjs +30 -0
  78. package/src/runtime/agent/orchestrator/runtime-core/config-helpers.mjs +0 -11
  79. package/src/runtime/agent/orchestrator/runtime-core/deferred-tool-availability.mjs +8 -0
  80. package/src/runtime/agent/orchestrator/runtime-core/deferred-tool-delta.mjs +17 -3
  81. package/src/runtime/agent/orchestrator/runtime-core/goal-control.mjs +47 -27
  82. package/src/runtime/agent/orchestrator/runtime-core/goal-deadlines.mjs +141 -10
  83. package/src/runtime/agent/orchestrator/runtime-core/goal-mutations.mjs +26 -63
  84. package/src/runtime/agent/orchestrator/runtime-core/goal-reminder.mjs +28 -3
  85. package/src/runtime/agent/orchestrator/runtime-core/goal-runtime.mjs +36 -11
  86. package/src/runtime/agent/orchestrator/runtime-core/goal-state.mjs +88 -56
  87. package/src/runtime/agent/orchestrator/runtime-core/goal-storage.mjs +4 -1
  88. package/src/runtime/agent/orchestrator/runtime-core/goal-store.mjs +51 -32
  89. package/src/runtime/agent/orchestrator/runtime-core/goal-text.mjs +45 -145
  90. package/src/runtime/agent/orchestrator/runtime-core/goal-tool-defs.mjs +15 -98
  91. package/src/runtime/agent/orchestrator/runtime-core/goal-tool-exec.mjs +32 -99
  92. package/src/runtime/agent/orchestrator/runtime-core/goal-turns.mjs +23 -78
  93. package/src/runtime/agent/orchestrator/runtime-core/orchestration.mjs +69 -48
  94. package/src/runtime/agent/orchestrator/runtime-core/todo-list.mjs +367 -0
  95. package/src/runtime/agent/orchestrator/runtime-core/todo-tool-defs.mjs +47 -0
  96. package/src/runtime/agent/orchestrator/runtime-core/tool-availability.mjs +155 -0
  97. package/src/runtime/agent/orchestrator/runtime-core/tool-catalog-data.mjs +9 -0
  98. package/src/runtime/agent/orchestrator/runtime-core/tool-catalog.mjs +119 -35
  99. package/src/runtime/agent/orchestrator/runtime-core/tool-defs.mjs +1 -1
  100. package/src/runtime/agent/orchestrator/runtime-core/workflow/context.mjs +1 -1
  101. package/src/runtime/agent/orchestrator/session/agent-loop.mjs +28 -22
  102. package/src/runtime/agent/orchestrator/session/agent-pool-progress.mjs +30 -0
  103. package/src/runtime/agent/orchestrator/session/attachment-preflight.mjs +1 -1
  104. package/src/runtime/agent/orchestrator/session/cache-warm.mjs +2 -2
  105. package/src/runtime/agent/orchestrator/session/catalog-db/index.mjs +2 -2
  106. package/src/runtime/agent/orchestrator/session/catalog-db/schema.mjs +1 -1
  107. package/src/runtime/agent/orchestrator/session/compact/execution-tail.mjs +1 -1
  108. package/src/runtime/agent/orchestrator/session/compact/runner.mjs +3 -0
  109. package/src/runtime/agent/orchestrator/session/compact/summary-route.mjs +1 -1
  110. package/src/runtime/agent/orchestrator/session/context-utils.mjs +8 -12
  111. package/src/runtime/agent/orchestrator/session/conversation-import/claude.mjs +1 -1
  112. package/src/runtime/agent/orchestrator/session/conversation-import/codex.mjs +1 -1
  113. package/src/runtime/agent/orchestrator/session/conversation-import/convert.mjs +1 -1
  114. package/src/runtime/agent/orchestrator/session/conversation-import/imported-session.mjs +7 -3
  115. package/src/runtime/agent/orchestrator/session/human-gate/held-message.mjs +1 -1
  116. package/src/runtime/agent/orchestrator/session/human-gate/requests.mjs +1 -2
  117. package/src/runtime/agent/orchestrator/session/human-gate/run-policy.mjs +1 -1
  118. package/src/runtime/agent/orchestrator/session/image-strip-recovery.mjs +1 -1
  119. package/src/runtime/agent/orchestrator/session/loop/completion-guards.mjs +11 -1
  120. package/src/runtime/agent/orchestrator/session/loop/context-overflow.mjs +1 -1
  121. package/src/runtime/agent/orchestrator/session/loop/loop-state.mjs +8 -1
  122. package/src/runtime/agent/orchestrator/session/loop/no-tool-turn/todo-check.mjs +196 -0
  123. package/src/runtime/agent/orchestrator/session/loop/no-tool-turn.mjs +116 -50
  124. package/src/runtime/agent/orchestrator/session/loop/pre-dispatch-deny.mjs +8 -1
  125. package/src/runtime/agent/orchestrator/session/loop/provider-tool-exclusions.mjs +1 -1
  126. package/src/runtime/agent/orchestrator/session/loop/route-fallback.mjs +1 -1
  127. package/src/runtime/agent/orchestrator/session/loop/steering.mjs +3 -1
  128. package/src/runtime/agent/orchestrator/session/loop/stored-tool-args.mjs +5 -6
  129. package/src/runtime/agent/orchestrator/session/loop/tool-exec/before-hook.mjs +6 -1
  130. package/src/runtime/agent/orchestrator/session/loop/tool-exec/dispatch.mjs +16 -2
  131. package/src/runtime/agent/orchestrator/session/loop/turn-report.mjs +35 -0
  132. package/src/runtime/agent/orchestrator/session/loop/usage.mjs +1 -1
  133. package/src/runtime/agent/orchestrator/session/manager/ask-session.mjs +57 -26
  134. package/src/runtime/agent/orchestrator/session/manager/ask-turn-auto-effort.mjs +9 -7
  135. package/src/runtime/agent/orchestrator/session/manager/ask-turn-execute.mjs +21 -3
  136. package/src/runtime/agent/orchestrator/session/manager/ask-turn-failure.mjs +27 -11
  137. package/src/runtime/agent/orchestrator/session/manager/ask-turn-open.mjs +37 -34
  138. package/src/runtime/agent/orchestrator/session/manager/ask-turn-prepare.mjs +15 -0
  139. package/src/runtime/agent/orchestrator/session/manager/ask-turn-settle.mjs +25 -15
  140. package/src/runtime/agent/orchestrator/session/manager/ask-turn-state.mjs +79 -24
  141. package/src/runtime/agent/orchestrator/session/manager/ask-turn-steering-drain.mjs +3 -0
  142. package/src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs +12 -1
  143. package/src/runtime/agent/orchestrator/session/manager/context-meta.mjs +1 -1
  144. package/src/runtime/agent/orchestrator/session/manager/idle-cleanup.mjs +6 -1
  145. package/src/runtime/agent/orchestrator/session/manager/pending-messages.mjs +9 -1
  146. package/src/runtime/agent/orchestrator/session/manager/pending-spool-path.mjs +2 -2
  147. package/src/runtime/agent/orchestrator/session/manager/pending-spool-shard.mjs +1 -1
  148. package/src/runtime/agent/orchestrator/session/manager/prompt-settings.mjs +598 -0
  149. package/src/runtime/agent/orchestrator/session/manager/prompt-utils.mjs +19 -0
  150. package/src/runtime/agent/orchestrator/session/manager/rules-cache.mjs +19 -10
  151. package/src/runtime/agent/orchestrator/session/manager/runtime-liveness.mjs +8 -1
  152. package/src/runtime/agent/orchestrator/session/manager/session-close.mjs +5 -0
  153. package/src/runtime/agent/orchestrator/session/manager/session-fallback-title.mjs +1 -1
  154. package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.mjs +31 -0
  155. package/src/runtime/agent/orchestrator/session/manager/session-lock.mjs +31 -0
  156. package/src/runtime/agent/orchestrator/session/manager/session-prompt-composition.mjs +42 -6
  157. package/src/runtime/agent/orchestrator/session/manager/session-record.mjs +2 -0
  158. package/src/runtime/agent/orchestrator/session/manager/tool-resolution.mjs +11 -1
  159. package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint-context.mjs +8 -9
  160. package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint-journal.mjs +339 -88
  161. package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint-recovery.mjs +135 -11
  162. package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint.mjs +377 -104
  163. package/src/runtime/agent/orchestrator/session/manager/turn-durability.mjs +144 -0
  164. package/src/runtime/agent/orchestrator/session/manager/turn-interruption.mjs +1 -1
  165. package/src/runtime/agent/orchestrator/session/manager/usage-metrics.mjs +4 -0
  166. package/src/runtime/agent/orchestrator/session/manager.mjs +6 -0
  167. package/src/runtime/agent/orchestrator/session/mixy-name.mjs +1 -1
  168. package/src/runtime/agent/orchestrator/session/pre-send-compact.mjs +8 -1
  169. package/src/runtime/agent/orchestrator/session/save-session-worker.mjs +5 -1
  170. package/src/runtime/agent/orchestrator/session/store/canonical-reader.mjs +1 -1
  171. package/src/runtime/agent/orchestrator/session/store/liveness-veto.mjs +2 -2
  172. package/src/runtime/agent/orchestrator/session/store/save-worker.mjs +23 -2
  173. package/src/runtime/agent/orchestrator/session/store/sweep/sub-agent-retention.mjs +3 -3
  174. package/src/runtime/agent/orchestrator/session/store/transcript-durability.mjs +88 -0
  175. package/src/runtime/agent/orchestrator/session/store-agent-worker-rows.mjs +5 -0
  176. package/src/runtime/agent/orchestrator/session/store-summary-log.mjs +1 -1
  177. package/src/runtime/agent/orchestrator/session/store-transcript-projection.mjs +14 -5
  178. package/src/runtime/agent/orchestrator/session/store-transcript-worker.mjs +2 -2
  179. package/src/runtime/agent/orchestrator/session/store.mjs +17 -6
  180. package/src/runtime/agent/orchestrator/session/synthetic-user-envelope.mjs +7 -1
  181. package/src/runtime/agent/orchestrator/session/tail-reminder-rules.mjs +9 -1
  182. package/src/runtime/agent/orchestrator/session/transcript-restore/agent-envelope.mjs +1 -1
  183. package/src/runtime/agent/orchestrator/session/transcript-restore/restore.mjs +3 -1
  184. package/src/runtime/agent/orchestrator/session/transcript-restore/user-text.mjs +2 -2
  185. package/src/runtime/agent/orchestrator/stall-policy.mjs +3 -5
  186. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/backgrounded-result.mjs +4 -1
  187. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/misuse-guard.mjs +21 -3
  188. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/result-format.mjs +1 -1
  189. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/worktree-add-guard.mjs +77 -0
  190. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool.mjs +0 -1
  191. package/src/runtime/agent/orchestrator/tools/builtin/git-command-tool.mjs +7 -3
  192. package/src/runtime/agent/orchestrator/tools/builtin/git-worktree-tool.mjs +27 -9
  193. package/src/runtime/agent/orchestrator/tools/builtin/lib/search-input-helpers.mjs +2 -2
  194. package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-output-silence.mjs +64 -0
  195. package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-task-output.mjs +20 -6
  196. package/src/runtime/agent/orchestrator/tools/builtin/read-range-index.mjs +1 -1
  197. package/src/runtime/agent/orchestrator/tools/builtin/read-single-fast-paths.mjs +0 -1
  198. package/src/runtime/agent/orchestrator/tools/builtin/search-tool.mjs +0 -10
  199. package/src/runtime/agent/orchestrator/tools/builtin/shell-jobs.mjs +1 -2
  200. package/src/runtime/agent/orchestrator/tools/builtin/task-tool.mjs +12 -1
  201. package/src/runtime/agent/orchestrator/tools/builtin.mjs +1 -24
  202. package/src/runtime/agent/orchestrator/tools/code-graph/graph-binary/child-kill.mjs +4 -3
  203. package/src/runtime/agent/orchestrator/tools/code-graph/graph-binary.mjs +1 -2
  204. package/src/runtime/agent/orchestrator/tools/code-graph/modes/calls.mjs +1 -1
  205. package/src/runtime/agent/orchestrator/tools/code-graph/modes/symbols.mjs +2 -2
  206. package/src/runtime/agent/orchestrator/tools/code-graph/search.mjs +4 -5
  207. package/src/runtime/agent/orchestrator/tools/code-graph/symbol-index.mjs +3 -4
  208. package/src/runtime/agent/orchestrator/tools/code-graph.mjs +4 -22
  209. package/src/runtime/agent/orchestrator/tools/lib/shell-descendants.mjs +2 -2
  210. package/src/runtime/agent/orchestrator/tools/lib/shell-run-state.mjs +1 -1
  211. package/src/runtime/agent/orchestrator/tools/shell-command.mjs +0 -4
  212. package/src/runtime/agent/orchestrator/tools/shell-policy.mjs +0 -1
  213. package/src/runtime/attachments/attachment-reference.mjs +1 -1
  214. package/src/runtime/attachments/pdf-extract.mjs +1 -1
  215. package/src/runtime/attachments/store.d.mts +1 -0
  216. package/src/runtime/attachments/store.mjs +2 -2
  217. package/src/runtime/channels/lib/config-reload-watch.mjs +42 -0
  218. package/src/runtime/channels/lib/owned-runtime/config-reload.mjs +29 -9
  219. package/src/runtime/channels/lib/routines-db.mjs +35 -0
  220. package/src/runtime/channels/lib/scheduler.mjs +33 -0
  221. package/src/runtime/channels/lib/schedules-db.mjs +15 -4
  222. package/src/runtime/channels/lib/webhook/session-dispatch.mjs +4 -1
  223. package/src/runtime/channels/lib/webhooks-db.mjs +13 -3
  224. package/src/runtime/channels/lib/whisper-server.mjs +12 -12
  225. package/src/runtime/channels/lib/worker-main.mjs +9 -31
  226. package/src/runtime/computer-bridge/action-schema.mjs +2 -2
  227. package/src/runtime/computer-bridge/core-actions.mjs +16 -2
  228. package/src/runtime/computer-bridge/linux-readiness.mjs +10 -14
  229. package/src/runtime/computer-bridge/result-canonical.mjs +6 -0
  230. package/src/runtime/connectors/connector-accounts-mcp.mjs +169 -33
  231. package/src/runtime/connectors/gmail-app-password.mjs +2 -2
  232. package/src/runtime/connectors/google-mcp.mjs +1 -1
  233. package/src/runtime/effort-judge/judge-client.mjs +2 -2
  234. package/src/runtime/effort-judge/judge-input.mjs +4 -4
  235. package/src/runtime/explore/explorer.mjs +0 -5
  236. package/src/runtime/explore/tool.mjs +3 -3
  237. package/src/runtime/local-provider/hardware.mjs +1 -1
  238. package/src/runtime/media/adapters/codex-image.mjs +3 -3
  239. package/src/runtime/media/adapters/gemini-video.mjs +1 -1
  240. package/src/runtime/media/media-usage.mjs +1 -1
  241. package/src/runtime/media/store.mjs +1 -1
  242. package/src/runtime/memory/index.mjs +11 -1
  243. package/src/runtime/memory/lib/embedding-reindex.mjs +27 -0
  244. package/src/runtime/memory/lib/memory-embed.mjs +83 -14
  245. package/src/runtime/memory/lib/memory-process-lock.mjs +159 -36
  246. package/src/runtime/memory/lib/memory-text-utils.mjs +6 -1
  247. package/src/runtime/memory/lib/memory.mjs +17 -0
  248. package/src/runtime/memory/lib/pg/process.mjs +1 -1
  249. package/src/runtime/memory/lib/pg/supervisor.mjs +16 -96
  250. package/src/runtime/memory/lib/recall-hybrid/hybrid-sql.mjs +12 -3
  251. package/src/runtime/memory/tool-defs.mjs +1 -1
  252. package/src/runtime/office/authoring/docx-html-runner.mjs +1 -1
  253. package/src/runtime/office/authoring/pptx-author-action.mjs +1 -1
  254. package/src/runtime/office/authoring/xlsx-html-build.mjs +1 -1
  255. package/src/runtime/office/authoring/xlsx-html-runner.mjs +1 -1
  256. package/src/runtime/office/capabilities.mjs +1 -1
  257. package/src/runtime/office/core/office-core.mjs +1 -1
  258. package/src/runtime/office/design/content-model.mjs +3 -3
  259. package/src/runtime/office/design/docx/design-docx/section.mjs +6 -6
  260. package/src/runtime/office/design/xlsx/design-xlsx-components.mjs +1 -1
  261. package/src/runtime/office/design/xlsx/design-xlsx.mjs +1 -1
  262. package/src/runtime/office/pdf/ocr-engine.mjs +1 -1
  263. package/src/runtime/office/pdf/pdf-writer.mjs +4 -4
  264. package/src/runtime/office/portable/portable-docx-operations.mjs +2 -2
  265. package/src/runtime/office/portable/portable-soffice.mjs +8 -6
  266. package/src/runtime/office/portable/xlsx-contract.mjs +1 -1
  267. package/src/runtime/shared/atomic-file.d.mts +8 -0
  268. package/src/runtime/shared/background-tasks.mjs +22 -4
  269. package/src/runtime/shared/background-wait.mjs +66 -0
  270. package/src/runtime/shared/child-guardian.mjs +17 -7
  271. package/src/runtime/shared/config.mjs +313 -16
  272. package/src/runtime/shared/connector-catalog.d.mts +4 -5
  273. package/src/runtime/shared/connector-catalog.mjs +11 -1
  274. package/src/runtime/shared/file-lock.mjs +8 -3
  275. package/src/runtime/shared/git-runner.mjs +7 -2
  276. package/src/runtime/shared/idle-gc.mjs +30 -7
  277. package/src/runtime/shared/llm/http-agent.mjs +8 -5
  278. package/src/runtime/shared/llm/system-proxy.mjs +2 -1
  279. package/src/runtime/shared/llm/usage-accounting.mjs +110 -19
  280. package/src/runtime/shared/llm/usage-context.mjs +1 -1
  281. package/src/runtime/shared/llm/usage-ledger-quota.mjs +33 -12
  282. package/src/runtime/shared/llm/usage-ledger-requests.mjs +183 -0
  283. package/src/runtime/shared/llm/usage-ledger-rollup.mjs +90 -10
  284. package/src/runtime/shared/llm/usage-ledger-worker.mjs +2 -0
  285. package/src/runtime/shared/llm/usage-ledger.mjs +60 -1
  286. package/src/runtime/shared/llm/usage-request-status.mjs +48 -0
  287. package/src/runtime/shared/llm/usage-rollup.mjs +48 -0
  288. package/src/runtime/shared/maintenance-schedule.mjs +109 -0
  289. package/src/runtime/shared/process-runner.mjs +8 -4
  290. package/src/runtime/shared/routine-trigger.d.mts +13 -0
  291. package/src/runtime/shared/routine-trigger.mjs +34 -0
  292. package/src/runtime/shared/run-child.d.mts +2 -1
  293. package/src/runtime/shared/run-child.mjs +70 -18
  294. package/src/runtime/shared/session-scratch.mjs +14 -2
  295. package/src/runtime/shared/shipped-definitions.mjs +7 -1
  296. package/src/runtime/shared/tool-card-model.golden.json +3 -12
  297. package/src/runtime/shared/tool-execution-contract.mjs +2 -0
  298. package/src/runtime/shared/tool-result-summary.mjs +1 -1
  299. package/src/runtime/shared/tool-work-units.mjs +31 -6
  300. package/src/runtime/shared/turn-snapshot.mjs +26 -4
  301. package/src/runtime/shared/turn-worktree-snapshot.mjs +6 -11
  302. package/src/runtime/shared/worker-requests.mjs +17 -3
  303. package/src/runtime/shared/worktrees/branch-management.mjs +1 -5
  304. package/src/runtime/shared/worktrees/contract.mjs +16 -6
  305. package/src/runtime/shared/worktrees/dependencies.mjs +127 -89
  306. package/src/runtime/shared/worktrees/disk.mjs +79 -2
  307. package/src/runtime/shared/worktrees/git.mjs +44 -11
  308. package/src/runtime/shared/worktrees/include.mjs +6 -4
  309. package/src/runtime/shared/worktrees/maintenance.mjs +422 -30
  310. package/src/runtime/shared/worktrees/manager.mjs +772 -75
  311. package/src/runtime/shared/worktrees/settings.mjs +33 -7
  312. package/src/runtime/shared/worktrees/test-support.mjs +5 -1
  313. package/src/runtime/shared/worktrees/worker-snapshots.mjs +82 -0
  314. package/src/runtime/tidy/process.mjs +2 -1
  315. package/src/runtime/web-search/index.mjs +3 -22
  316. package/src/runtime/web-search/lib/web-tools.mjs +2 -2
  317. package/src/runtime/web-search/tool-defs.mjs +17 -26
  318. package/src/session-runtime/agent-home-delivery.mjs +76 -8
  319. package/src/session-runtime/agent-profile-changes.mjs +55 -4
  320. package/src/session-runtime/agent-task-sessions.mjs +63 -22
  321. package/src/session-runtime/boot/apis.mjs +42 -4
  322. package/src/session-runtime/boot/begin.mjs +2 -0
  323. package/src/session-runtime/boot/config.mjs +10 -1
  324. package/src/session-runtime/boot/facade.mjs +1 -0
  325. package/src/session-runtime/boot/providers.mjs +70 -3
  326. package/src/session-runtime/boot/session.mjs +2 -0
  327. package/src/session-runtime/boot/tools.mjs +75 -25
  328. package/src/session-runtime/channel-config-api.mjs +1 -0
  329. package/src/session-runtime/config-change-effects.mjs +179 -0
  330. package/src/session-runtime/config-lifecycle/config-writers.mjs +1 -0
  331. package/src/session-runtime/config-lifecycle.mjs +160 -24
  332. package/src/session-runtime/conversation-import/discovery.mjs +86 -7
  333. package/src/session-runtime/conversation-import/service.mjs +3 -2
  334. package/src/session-runtime/goal-facade-api.mjs +49 -3
  335. package/src/session-runtime/internal-tool-executor/ask-user-tool.mjs +5 -57
  336. package/src/session-runtime/internal-tool-executor/bridge-tools.mjs +3 -2
  337. package/src/session-runtime/internal-tool-executor/feature-tools.mjs +3 -11
  338. package/src/session-runtime/internal-tool-executor/workspace-tools.mjs +18 -4
  339. package/src/session-runtime/internal-tool-executor.mjs +12 -19
  340. package/src/session-runtime/lifecycle/cold-heir.mjs +7 -0
  341. package/src/session-runtime/lifecycle/memory-ingest.mjs +3 -3
  342. package/src/session-runtime/lifecycle/session-switch/session-delete.mjs +53 -5
  343. package/src/session-runtime/lifecycle/session-switch.mjs +13 -2
  344. package/src/session-runtime/lifecycle/teardown/session-close.mjs +4 -4
  345. package/src/session-runtime/lifecycle-api.mjs +1 -0
  346. package/src/session-runtime/mcp-glue/server-catalog.mjs +14 -3
  347. package/src/session-runtime/mcp-glue/server-connection.mjs +34 -8
  348. package/src/session-runtime/model-route/route-persist.mjs +12 -4
  349. package/src/session-runtime/model-route/set-route.mjs +40 -7
  350. package/src/session-runtime/native-web-search/routes.mjs +3 -3
  351. package/src/session-runtime/provider-auth/refresh.mjs +6 -3
  352. package/src/session-runtime/provider-auth/setup.mjs +1 -1
  353. package/src/session-runtime/provider-models/row-hydration.mjs +2 -0
  354. package/src/session-runtime/provider-readiness.mjs +53 -4
  355. package/src/session-runtime/resource-api.mjs +1 -1
  356. package/src/session-runtime/resource-extension-sync.mjs +4 -8
  357. package/src/session-runtime/resource-mcp-connector-accounts.mjs +5 -1
  358. package/src/session-runtime/resource-mcp-secrets.mjs +3 -3
  359. package/src/session-runtime/resource-plugins-api.mjs +4 -0
  360. package/src/session-runtime/routine-executor.mjs +152 -0
  361. package/src/session-runtime/routine-home-turn.mjs +46 -5
  362. package/src/session-runtime/routine-owner.mjs +9 -3
  363. package/src/session-runtime/runtime-facade.mjs +5 -0
  364. package/src/session-runtime/runtime-feature-gates.mjs +2 -11
  365. package/src/session-runtime/schedule-session-run.mjs +1 -0
  366. package/src/session-runtime/services/agent-task-status.mjs +29 -1
  367. package/src/session-runtime/services/agent-tool/job-task-reconcile.mjs +6 -1
  368. package/src/session-runtime/services/agent-tool/job-views/session-progress.mjs +10 -0
  369. package/src/session-runtime/services/agent-tool/render.mjs +6 -1
  370. package/src/session-runtime/services/agent-tool/send-flow.mjs +110 -6
  371. package/src/session-runtime/services/agent-tool/spawn-flow/job-start.mjs +12 -0
  372. package/src/session-runtime/services/agent-tool/spawn-flow/spawn-plan.mjs +5 -0
  373. package/src/session-runtime/services/agent-tool/spawn-flow/spawn-run.mjs +24 -6
  374. package/src/session-runtime/services/agent-tool.mjs +51 -1
  375. package/src/session-runtime/services/channel-admin.mjs +62 -3
  376. package/src/session-runtime/services/hook-bus/command-handler.mjs +7 -11
  377. package/src/session-runtime/services/plugin-admin.mjs +50 -7
  378. package/src/session-runtime/services/provider-admin.mjs +5 -0
  379. package/src/session-runtime/services/seeds.mjs +7 -0
  380. package/src/session-runtime/services/usage-stats-model.mjs +32 -11
  381. package/src/session-runtime/session-create/materialize.mjs +4 -2
  382. package/src/session-runtime/session-create/session-options.mjs +2 -0
  383. package/src/session-runtime/settings-builtin-tools-api.mjs +1 -9
  384. package/src/session-runtime/setup-tool/agent-settings-actions.mjs +1 -1
  385. package/src/session-runtime/setup-tool/connector-widen-approval.mjs +1 -1
  386. package/src/session-runtime/setup-tool/executor.mjs +9 -2
  387. package/src/session-runtime/setup-tool/extended-actions.mjs +3 -1
  388. package/src/session-runtime/setup-tool/settings-contract.mjs +30 -2
  389. package/src/session-runtime/setup-tool/tool-defs.mjs +26 -1
  390. package/src/session-runtime/tool-policy/agent-profile-fold.mjs +40 -43
  391. package/src/session-runtime/tool-policy/mode-switch.mjs +1 -1
  392. package/src/session-runtime/tool-policy/policy-stage.mjs +106 -8
  393. package/src/session-runtime/tool-policy/workflow-overlay.mjs +2 -1
  394. package/src/session-runtime/tool-policy-refresh.mjs +182 -5
  395. package/src/session-runtime/tool-surface.mjs +38 -1
  396. package/src/session-runtime/turn/agent-ops.mjs +10 -2
  397. package/src/session-runtime/turn/session-ops.mjs +2 -0
  398. package/src/session-runtime/turn/turn-run/turn-prepare.mjs +5 -0
  399. package/src/session-runtime/turn/turn-run.mjs +1 -1
  400. package/src/session-runtime/usage-stats-api.mjs +117 -1
  401. package/src/session-runtime/webhook-session-run.mjs +2 -0
  402. package/src/session-runtime/workflow-agents-api/agent-connectors.mjs +37 -33
  403. package/src/session-runtime/workflow-agents-api/agent-editor.mjs +183 -23
  404. package/src/session-runtime/workflow-agents-api/agent-route.mjs +3 -10
  405. package/src/session-runtime/workflow-agents-api/instruction-files.mjs +165 -0
  406. package/src/session-runtime/workflow-agents-api/style-and-mode.mjs +5 -4
  407. package/src/session-runtime/workflow-agents-api/workflow-packs.mjs +2 -3
  408. package/src/session-runtime/workflow-agents-api.mjs +2 -0
  409. package/src/session-runtime/workspace/project-branches.mjs +1 -1
  410. package/src/session-runtime/workspace/session-view.mjs +1 -1
  411. package/src/session-runtime/workspace/transitions.mjs +20 -4
  412. package/src/session-runtime/workspace/worktree-maintenance.mjs +126 -6
  413. package/src/session-runtime/workspace/worktree-setup.mjs +13 -1
  414. package/src/session-runtime/workspace/worktree-tool.mjs +16 -0
  415. package/src/standalone/daemon-agent-control.mjs +25 -8
  416. package/src/standalone/daemon-desktop-runtime.mjs +6 -2
  417. package/src/standalone/daemon-lag-profiler.mjs +7 -7
  418. package/src/standalone/daemon.mjs +54 -2
  419. package/src/standalone/local-session-runtime.mjs +16 -0
  420. package/src/standalone/session-client/daemon-unavailable.mjs +1 -1
  421. package/src/standalone/session-protocol.mjs +12 -0
  422. package/src/standalone/session-service/agent-route-follow.mjs +23 -20
  423. package/src/standalone/session-service/agent-tree/agent-turns.mjs +18 -6
  424. package/src/standalone/session-service/quota-resume.mjs +9 -0
  425. package/src/standalone/session-service/retention/busy.mjs +3 -2
  426. package/src/standalone/session-service/session-calls/session-action.mjs +51 -1
  427. package/src/standalone/session-service/session-calls/session-turns.mjs +37 -18
  428. package/src/standalone/session-service/session-calls/turn-gate.mjs +34 -0
  429. package/src/standalone/session-service/session-calls.mjs +2 -1
  430. package/src/tui/App.jsx +8 -0
  431. package/src/tui/app/clipboard.mjs +1 -1
  432. package/src/tui/app/create-app-pickers.mjs +2 -0
  433. package/src/tui/app/doctor.mjs +2 -2
  434. package/src/tui/app/model-picker/model-footer.mjs +1 -1
  435. package/src/tui/app/model-picker/provider-models-list.mjs +7 -3
  436. package/src/tui/app/model-picker/route-selection/fast-parameters.mjs +23 -3
  437. package/src/tui/app/model-picker/route-selection.mjs +1 -0
  438. package/src/tui/app/panel-signature.mjs +1 -1
  439. package/src/tui/app/settings-picker.mjs +53 -8
  440. package/src/tui/app/shell-layout/row-budgets.mjs +2 -2
  441. package/src/tui/app/slash-commands.mjs +1 -1
  442. package/src/tui/app/slash-dispatch/route-commands.mjs +1 -1
  443. package/src/tui/app/slash-dispatch/session-commands.mjs +1 -1
  444. package/src/tui/app/use-prompt-queue-history.mjs +2 -2
  445. package/src/tui/app/use-transcript-activity.mjs +1 -1
  446. package/src/tui/app/use-transcript-window/geometry.mjs +1 -1
  447. package/src/tui/components/prompt-input/escape-policy.d.mts +0 -1
  448. package/src/tui/components/prompt-input/escape-policy.mjs +1 -1
  449. package/src/tui/components/question-panel-model.mjs +4 -4
  450. package/src/tui/components/tool-execution/standard-card.jsx +3 -4
  451. package/src/tui/components/user-message-skills.mjs +1 -1
  452. package/src/tui/dist/index.mjs +350 -37
  453. package/src/tui/markdown/render-ansi.mjs +1 -1
  454. package/src/tui/session/agent-job-feed/notification-router.mjs +10 -0
  455. package/src/tui/session/agent-job-feed.mjs +2 -0
  456. package/src/tui/session/context-state.mjs +3 -0
  457. package/src/tui/session/quota-resume.mjs +1 -1
  458. package/src/tui/session/session-api/integrations.mjs +3 -0
  459. package/src/tui/session/session-api/lifecycle/dispose.mjs +1 -0
  460. package/src/tui/session/session-api/lifecycle/session-reset.mjs +7 -0
  461. package/src/tui/session/session-api/routes-agent-definitions.mjs +5 -0
  462. package/src/tui/session/session-api/worktree.mjs +13 -1
  463. package/src/tui/session/session-flow/drain.mjs +11 -14
  464. package/src/tui/session/tool-approval-settle.mjs +24 -4
  465. package/src/tui/session/tool-approval.mjs +35 -10
  466. package/src/tui/session/tool-card-results/grouped-result.mjs +2 -2
  467. package/src/tui/session/turn-quiet.mjs +1 -1
  468. package/src/tui/session/turn.mjs +3 -0
  469. package/src/tui/session/worktree-setup-notice.mjs +1 -1
  470. package/src/tui/spinner-meta.mjs +3 -3
  471. package/src/tui/spinner-verbs.mjs +2 -2
  472. package/src/defaults/skills/goal-management/SKILL.md +0 -169
  473. package/src/runtime/agent/orchestrator/runtime-core/goal-tasks.mjs +0 -156
  474. package/src/session-runtime/goal-tasks.mjs +0 -1
@@ -24,7 +24,9 @@ import {
24
24
  setEndpointEnabled as dbSetEndpointEnabled,
25
25
  } from '../../runtime/channels/lib/webhooks-db.mjs';
26
26
  import { normalizeAutomationAttachments } from '../../runtime/shared/automation-attachments.mjs';
27
- import { assertRoutineOwner, routineOwnerProblem } from '../routine-owner.mjs';
27
+ import { ROUTINE_OWNER_PROBLEMS, assertRoutineOwner, routineOwnerProblem } from '../routine-owner.mjs';
28
+ import { MIXY_BOT_ID } from '../../runtime/shared/agent-store.mjs';
29
+ import { assertRoutineExecutor } from '../routine-executor.mjs';
28
30
  import { hasEnabledAutomation } from '../../runtime/shared/automation-presence.mjs';
29
31
  import { resolveScheduleTimezone, validateScheduleCron } from '../../runtime/shared/schedule-time.mjs';
30
32
  import { scheduleNameTakenError, scheduleRenameRunningError } from '../../runtime/channels/lib/schedule-errors.mjs';
@@ -203,6 +205,8 @@ function scheduleToDisplay(s, ownerProblem = '') {
203
205
  instructions: s.prompt,
204
206
  // The bot it belongs to: each run is a turn in that bot's chat.
205
207
  owner: s.ownerAgentId || MIXY_AGENT_ID,
208
+ // The sub-agent that carries each fire out first (routine-executor.mjs); null = the bot itself.
209
+ executorAgentId: s.executorAgentId || null,
206
210
  // Why it is paused for its owner (routine-owner.mjs); absent when it runs.
207
211
  ...(ownerProblem ? { ownerProblem } : {}),
208
212
  nextFireAt: isoOrUndefined(s.nextFireAt),
@@ -250,6 +254,13 @@ function scheduleOwner(owner, existing) {
250
254
  return existing?.ownerAgentId || MIXY_AGENT_ID;
251
255
  }
252
256
 
257
+ // A save's executor: `executorAgentId` undefined keeps the saved one on an
258
+ // overwrite; null or '' clears it; an id must be a delegatable sub-agent.
259
+ async function routineExecutor(executorAgentId, existing) {
260
+ if (executorAgentId === undefined) return existing?.executorAgentId || null;
261
+ return assertRoutineExecutor(executorAgentId);
262
+ }
263
+
253
264
  /** Each owner's problem (routine-owner.mjs) for its stored rows, probed once
254
265
  * per owner. */
255
266
  function ownerProblems() {
@@ -268,9 +279,13 @@ function ownerProblems() {
268
279
  export async function listSchedules() {
269
280
  const rows = await dbListSchedules();
270
281
  const problemOf = ownerProblems();
271
- return Promise.all(rows.map(async (row) => scheduleToDisplay(row, await problemOf(row.ownerAgentId))));
282
+ const listed = await Promise.all(rows.map(async (row) => scheduleToDisplay(row, await problemOf(row.ownerAgentId))));
283
+ return listed.filter(shownRoutine);
272
284
  }
273
285
 
286
+ // An archived bot's routines are hidden until it is restored (routine-owner.mjs).
287
+ const shownRoutine = (row) => row.ownerProblem !== 'owner-archived';
288
+
274
289
  /**
275
290
  * Run `step` (the move of schedule `name`'s row) with `name` reserved against
276
291
  * runs in this process (the app's "Run now"). Refused when one is in flight.
@@ -319,6 +334,7 @@ export async function saveSchedule(
319
334
  enabled,
320
335
  instructions,
321
336
  owner,
337
+ executorAgentId,
322
338
  overwrite = false,
323
339
  newName,
324
340
  } = {},
@@ -340,6 +356,7 @@ export async function saveSchedule(
340
356
  }
341
357
  const ownerAgentId = scheduleOwner(owner, existing);
342
358
  await assertRoutineOwner(ownerAgentId);
359
+ const executor = await routineExecutor(executorAgentId, existing);
343
360
  const whenCron = hasTime ? validateScheduleCron(foldDaysIntoCron(normalizeCron(time), days)) : null;
344
361
  const whenAt = hasAt ? parseAtDatetime(at) : null;
345
362
  const scheduleTimezone = hasTime ? resolveScheduleTimezone(timezone) : null;
@@ -356,6 +373,7 @@ export async function saveSchedule(
356
373
  enabled: enabled !== false,
357
374
  nextFireAt: whenAt,
358
375
  ownerAgentId,
376
+ executorAgentId: executor,
359
377
  };
360
378
  let saved;
361
379
  if (renaming) {
@@ -367,6 +385,7 @@ export async function saveSchedule(
367
385
  saved = await upsertSchedule(def);
368
386
  }
369
387
  automationProbe.invalidate();
388
+ await refuseIfOwnerDeleted(ownerAgentId);
370
389
  return scheduleToDisplay(saved);
371
390
  }
372
391
 
@@ -393,7 +412,7 @@ async function listWebhooks() {
393
412
  const endpoints = await dbListEndpoints();
394
413
  const problemOf = ownerProblems();
395
414
  const problems = await Promise.all(endpoints.map((ep) => problemOf(ep.ownerAgentId)));
396
- return endpoints.map((ep, index) => ({
415
+ const listed = endpoints.map((ep, index) => ({
397
416
  name: ep.name,
398
417
  description: ep.description || '',
399
418
  parser: ep.parser || 'github',
@@ -407,6 +426,7 @@ async function listWebhooks() {
407
426
  instructions: ep.instructions,
408
427
  // The bot it belongs to: each run is a turn in that bot's chat.
409
428
  owner: ep.ownerAgentId || MIXY_AGENT_ID,
429
+ executorAgentId: ep.executorAgentId || null,
410
430
  ...(problems[index] ? { ownerProblem: problems[index] } : {}),
411
431
  lastEventAt: isoOrUndefined(ep.lastEventAt),
412
432
  lastSuccessAt: isoOrUndefined(ep.lastSuccessAt),
@@ -416,6 +436,7 @@ async function listWebhooks() {
416
436
  hasLastPayload: ep.hasLastPayload === true,
417
437
  ...routineHealth(ep),
418
438
  }));
439
+ return listed.filter(shownRoutine);
419
440
  }
420
441
 
421
442
  export async function saveWebhook({
@@ -428,6 +449,7 @@ export async function saveWebhook({
428
449
  enabled,
429
450
  instructions,
430
451
  owner,
452
+ executorAgentId,
431
453
  overwrite = false,
432
454
  } = {}) {
433
455
  const id = assertName(name, 'webhook name');
@@ -445,6 +467,7 @@ export async function saveWebhook({
445
467
  }
446
468
  const ownerAgentId = scheduleOwner(owner, existing);
447
469
  await assertRoutineOwner(ownerAgentId);
470
+ const executor = await routineExecutor(executorAgentId, existing);
448
471
  // Secret semantics: an explicit value always wins; an EMPTY value on an
449
472
  // overwrite PRESERVES the stored secret (editing instructions must not
450
473
  // silently rotate the key the external service was configured with); only
@@ -464,11 +487,14 @@ export async function saveWebhook({
464
487
  instructions: body,
465
488
  enabled: enabled !== false,
466
489
  ownerAgentId,
490
+ executorAgentId: executor,
467
491
  });
468
492
  automationProbe.invalidate();
493
+ await refuseIfOwnerDeleted(ownerAgentId);
469
494
  return {
470
495
  name: id,
471
496
  owner: saved.ownerAgentId || ownerAgentId,
497
+ executorAgentId: saved.executorAgentId || null,
472
498
  description: saved.description,
473
499
  parser: saved.parser,
474
500
  ...(saved.cwd ? { cwd: saved.cwd } : {}),
@@ -486,6 +512,39 @@ export async function deleteWebhook(name) {
486
512
  return { name: id, deleted: true };
487
513
  }
488
514
 
515
+ /**
516
+ * Delete every schedule and webhook `agentId` currently owns, as its bot is
517
+ * deleted for good (agent-editor.mjs): all of them in one statement, or none
518
+ * (routines-db.mjs). Resolves the names removed. Mixy is never a target.
519
+ * Without a PostgreSQL cluster none exists, and none is started.
520
+ */
521
+ export async function deleteOwnedRoutines(agentId) {
522
+ if (!agentHomeSessionId(agentId) || agentId === MIXY_AGENT_ID || agentId === MIXY_BOT_ID) {
523
+ throw new Error(`the routines of "${agentId}" cannot be deleted with a bot`);
524
+ }
525
+ if (!pgClusterExists(resolvePluginData())) return { schedules: [], webhooks: [] };
526
+ // Loaded on use: the stores' own modules stay the only imports of every reader.
527
+ const { deleteRoutinesOwnedBy } = await import('../../runtime/channels/lib/routines-db.mjs');
528
+ const removed = await deleteRoutinesOwnedBy(agentId);
529
+ automationProbe.invalidate();
530
+ return removed;
531
+ }
532
+
533
+ /**
534
+ * After a save: the owner it checked may have been deleted for good meanwhile,
535
+ * its routines purged before this row landed. Then the row goes the way of
536
+ * the bot's others (deleteOwnedRoutines) and the save is refused. The delete
537
+ * purges again once the bot's folder is gone, so either a purge sees this row
538
+ * or this check sees the bot gone. An owner archived meanwhile keeps the row,
539
+ * hidden with its others until a restore, as if saved just before.
540
+ */
541
+ async function refuseIfOwnerDeleted(ownerAgentId) {
542
+ const problem = await routineOwnerProblem(ownerAgentId).catch(() => '');
543
+ if (problem !== 'owner-deleted') return;
544
+ await deleteOwnedRoutines(ownerAgentId);
545
+ throw new Error(ROUTINE_OWNER_PROBLEMS[problem]);
546
+ }
547
+
489
548
  export async function setWebhookEnabled(name, enabled) {
490
549
  const id = assertName(name, 'webhook name');
491
550
  const updated = await dbSetEndpointEnabled(id, enabled !== false);
@@ -1,9 +1,10 @@
1
1
  import { existsSync } from 'node:fs';
2
- import { spawn, spawnSync } from 'node:child_process';
2
+ import { spawn } from 'node:child_process';
3
3
  import { MAX_BUFFER_BYTES } from './constants.mjs';
4
4
  import { handlerTimeoutS } from './handler-timeout.mjs';
5
5
  import { abortReason, throwIfAborted } from '../../../runtime/shared/abort-race.mjs';
6
6
  import { scrubRuntimeRootVars } from '../../../runtime/agent/orchestrator/tools/env-scrub.mjs';
7
+ import { spawnTreeKill } from '../../../runtime/agent/orchestrator/mcp/child-tree.mjs';
7
8
 
8
9
  function resolvePlaceholders(str, projectDir, pluginData, pluginRoot = null) {
9
10
  if (typeof str !== 'string') return str;
@@ -23,17 +24,13 @@ export function defaultShellKind() {
23
24
  return process.platform === 'win32' ? 'powershell' : 'bash';
24
25
  }
25
26
 
26
- // POSIX children share a detached process group; Windows taskkill owns the tree.
27
+ // POSIX children share a detached process group; on Windows the shared
28
+ // creation-checked tree kill owns the tree, off the event loop.
27
29
  function killProcessTree(child, signal = 'SIGTERM') {
28
30
  if (!child || child.pid == null) return;
29
31
  if (process.platform === 'win32') {
30
- try {
31
- spawnSync('taskkill', ['/pid', String(child.pid), '/T', '/F'], { windowsHide: true });
32
- } catch {
33
- try {
34
- child.kill(signal);
35
- } catch {}
36
- }
32
+ if (child.exitCode !== null || child.signalCode !== null) return;
33
+ spawnTreeKill([child.pid], { root: child });
37
34
  return;
38
35
  }
39
36
  try {
@@ -48,8 +45,7 @@ function killProcessTree(child, signal = 'SIGTERM') {
48
45
  const KILL_GRACE_MS = 2000;
49
46
  function terminateTree(child) {
50
47
  killProcessTree(child, 'SIGTERM');
51
- // /F is already a hard termination. A later Windows retry could address a
52
- // recycled PID instead of the process this handler created.
48
+ // The Windows tree kill is already a hard termination.
53
49
  if (process.platform === 'win32') return;
54
50
  const timer = setTimeout(() => killProcessTree(child, 'SIGKILL'), KILL_GRACE_MS);
55
51
  timer.unref?.();
@@ -1,9 +1,10 @@
1
1
  import { spawnSync } from 'node:child_process';
2
- import { existsSync, mkdirSync, readdirSync, renameSync, rmSync } from 'node:fs';
2
+ import { chmodSync, existsSync, lstatSync, mkdirSync, readdirSync, renameSync, rmSync, unlinkSync } from 'node:fs';
3
3
  import { basename, dirname, join, resolve } from 'node:path';
4
4
  import { homedir } from 'node:os';
5
5
  import { createHash, randomUUID } from 'node:crypto';
6
6
  import { readJsonStateSync, updateJsonAtomicSync, withFileLockSync } from '../../runtime/shared/atomic-file.mjs';
7
+ import { announceStoredStateChange } from '../../runtime/shared/config.mjs';
7
8
  import { resolvePluginData } from '../../runtime/shared/plugin-paths.mjs';
8
9
  import { pluginManifest } from '../../runtime/shared/plugin-manifest.mjs';
9
10
  import { pluginMetadata } from '../../runtime/shared/plugin-metadata.mjs';
@@ -60,6 +61,9 @@ function mutateRegistry(dataDir, mutator) {
60
61
  },
61
62
  { secret: true, fsyncDir: true, backup: true }
62
63
  );
64
+ // Other processes connect or drop the plugin's MCP servers on this (the
65
+ // live install's registry only; an explicit dataDir is a separate store).
66
+ if (resolve(dataDir) === resolve(resolvePluginData())) announceStoredStateChange('plugins');
63
67
  return result;
64
68
  }
65
69
 
@@ -164,6 +168,45 @@ function withPluginMutation(dataDir, id, operation) {
164
168
  });
165
169
  }
166
170
 
171
+ // Node 24 on Windows (Electron) makes rmSync follow junctions into their targets,
172
+ // so every link is detached first and never chmod-ed or recursed into. It also
173
+ // fails with EPERM on read-only files such as git pack files; clear the read-only
174
+ // bit and retry once. Each entry is lstat-ed right before it is acted on, not
175
+ // trusted from the listing, so a directory swapped for a link after the listing
176
+ // is detached instead of entered. What remains is the instant between that
177
+ // lstat and the next readdir/chmod, which no portable fs call can close. A file
178
+ // with other names (link count > 1) shares its mode with them, so `onFile` is
179
+ // told its stat and the chmod recovery skips it.
180
+ function walkTree(dir, onFile) {
181
+ for (const name of readdirSync(dir)) {
182
+ const full = join(dir, name);
183
+ const stat = lstatSync(full, { throwIfNoEntry: false });
184
+ if (!stat) continue;
185
+ if (stat.isSymbolicLink()) unlinkSync(full);
186
+ else if (stat.isDirectory()) walkTree(full, onFile);
187
+ else onFile?.(full, stat);
188
+ }
189
+ }
190
+
191
+ function removeTree(path) {
192
+ const stat = lstatSync(path, { throwIfNoEntry: false });
193
+ if (!stat) return;
194
+ if (stat.isSymbolicLink()) return unlinkSync(path);
195
+ const options = { recursive: true, force: true };
196
+ if (stat.isDirectory()) walkTree(path);
197
+ try {
198
+ rmSync(path, options);
199
+ } catch (error) {
200
+ if (error?.code !== 'EPERM') throw error;
201
+ if (stat.isDirectory()) {
202
+ walkTree(path, (file, fileStat) => {
203
+ if (fileStat.nlink === 1) chmodSync(file, 0o666);
204
+ });
205
+ }
206
+ rmSync(path, options);
207
+ }
208
+ }
209
+
167
210
  function cleanupManagedPartials(root) {
168
211
  const parent = dirname(root);
169
212
  const prefix = `${basename(root)}.tmp-`;
@@ -171,7 +214,7 @@ function cleanupManagedPartials(root) {
171
214
  for (const entry of readdirSync(parent)) {
172
215
  if (!entry.startsWith(prefix)) continue;
173
216
  try {
174
- rmSync(join(parent, entry), { recursive: true, force: true });
217
+ removeTree(join(parent, entry));
175
218
  } catch {}
176
219
  }
177
220
  }
@@ -181,7 +224,7 @@ function recoverManagedPluginRoot(root) {
181
224
  if (!existsSync(root) && existsSync(backupRoot)) {
182
225
  renameSync(backupRoot, root);
183
226
  } else if (existsSync(root) && existsSync(backupRoot)) {
184
- rmSync(backupRoot, { recursive: true, force: true });
227
+ removeTree(backupRoot);
185
228
  }
186
229
  return backupRoot;
187
230
  }
@@ -206,7 +249,7 @@ export function _publishManagedPluginRoot(root, tempRoot) {
206
249
  throw error;
207
250
  }
208
251
  try {
209
- rmSync(backupRoot, { recursive: true, force: true });
252
+ removeTree(backupRoot);
210
253
  } catch {}
211
254
  }
212
255
 
@@ -224,7 +267,7 @@ function materializePlugin(normalized, id, dataDir) {
224
267
  _publishManagedPluginRoot(root, tempRoot);
225
268
  } catch (error) {
226
269
  try {
227
- rmSync(tempRoot, { recursive: true, force: true });
270
+ removeTree(tempRoot);
228
271
  } catch {}
229
272
  throw error;
230
273
  } finally {
@@ -370,8 +413,8 @@ export function removePlugin(idOrName, { dataDir = resolvePluginData() } = {}) {
370
413
  });
371
414
  if (entry.managed !== false && entry.root) {
372
415
  ensureInside(installRoot(dataDir), entry.root);
373
- rmSync(entry.root, { recursive: true, force: true });
374
- rmSync(`${entry.root}.backup`, { recursive: true, force: true });
416
+ removeTree(entry.root);
417
+ removeTree(`${entry.root}.backup`);
375
418
  cleanupManagedPartials(entry.root);
376
419
  }
377
420
  return { ...entry, removed: true };
@@ -598,6 +598,7 @@ function publicCustomModelRows(rows) {
598
598
  if (out > 0) model.maxOutputTokens = Math.floor(out);
599
599
  model.hidden = item.hidden === true;
600
600
  model.manual = item.manual === true;
601
+ if (item.inherited) model.inherited = structuredClone(item.inherited);
601
602
  for (const key of [
602
603
  'supportsVision',
603
604
  'supportsReasoning',
@@ -660,6 +661,7 @@ function customProviderRow(id, entry, checkSecrets = true) {
660
661
  row.discovery = structuredClone(config?.discovery ?? entry.discovery ?? { newModelsHidden: false });
661
662
  row.modelOverrides = structuredClone(config?.modelOverrides ?? entry.modelOverrides ?? {});
662
663
  if (config?.headers) row.headers = { ...config.headers };
664
+ if (config?.requestBody) row.requestBody = structuredClone(config.requestBody);
663
665
  if (config?.wires) row.wires = [...config.wires];
664
666
  if (config?.modelWires) row.modelWires = { ...config.modelWires };
665
667
  // Additional API keys by id only; their values never leave the keychain.
@@ -1308,6 +1310,7 @@ function withStoredSettings(input, entry) {
1308
1310
  if (out.modelOverrides === undefined) out.modelOverrides = stored.modelOverrides;
1309
1311
  // `headers: {}` clears them; an omitted field keeps the stored ones.
1310
1312
  if (out.headers === undefined && stored.headers) out.headers = stored.headers;
1313
+ if (out.requestBody === undefined && stored.requestBody) out.requestBody = stored.requestBody;
1311
1314
  // Served wires and per-model wires have no setup field yet: an edit on
1312
1315
  // the same protocol keeps them (another protocol serves other wires).
1313
1316
  if ((out.protocol ?? stored.protocol) === stored.protocol) {
@@ -1472,6 +1475,8 @@ const MODEL_PATCH_KEYS = new Set([
1472
1475
  'maxOutputTokens',
1473
1476
  'supportsVision',
1474
1477
  'reasoning',
1478
+ 'requestBody',
1479
+ 'requestHeaders',
1475
1480
  ]);
1476
1481
  const REASONING_PATCH_KEYS = new Set(['levels', 'wireFormat', 'wireValues', 'replay']);
1477
1482
 
@@ -127,6 +127,13 @@ export function retireSeededPackCopies({ rootDir, dataDir, backup = makeBackup(d
127
127
  if (![bundled, ...(history.outputStyles[name] || [])].includes(fileHash(copy))) continue;
128
128
  if (backup.move(copy)) retired.push(`output-styles/${name}`);
129
129
  }
130
+ for (const name of childNames(join(dataDir, 'orchestration'), 'md')) {
131
+ const bundled = fileHash(join(rootDir, 'orchestration', name));
132
+ if (!bundled) continue;
133
+ const copy = join(dataDir, 'orchestration', name);
134
+ if (![bundled, ...(history.orchestration[name] || [])].includes(fileHash(copy))) continue;
135
+ if (backup.move(copy)) retired.push(`orchestration/${name}`);
136
+ }
130
137
  return retired;
131
138
  }
132
139
 
@@ -24,8 +24,11 @@
24
24
  import { billableInputTokensForProvider } from '../../runtime/shared/llm/cost.mjs';
25
25
  import { hourlySeries } from './usage-stats-hours.mjs';
26
26
  import {
27
+ FAST_KEY,
27
28
  isConversationUsageSource,
29
+ isFastCall,
28
30
  knownCostTurns,
31
+ sortFastBesideModel,
29
32
  usageRollupDayKey,
30
33
  } from '../../runtime/shared/llm/usage-rollup.mjs';
31
34
 
@@ -132,11 +135,14 @@ function providerBucket(state, provider, kind) {
132
135
  return bucket;
133
136
  }
134
137
 
135
- function modelBucket(provider, model) {
136
- let bucket = provider.models.get(model);
138
+ // A model's Fast-mode calls are their own row beside its normal row.
139
+ function modelBucket(provider, model, fast = false) {
140
+ const key = fast ? model + FAST_KEY : model;
141
+ let bucket = provider.models.get(key);
137
142
  if (!bucket) {
138
143
  bucket = {
139
144
  model,
145
+ fast,
140
146
  turns: 0,
141
147
  input: 0,
142
148
  output: 0,
@@ -146,7 +152,7 @@ function modelBucket(provider, model) {
146
152
  sessions: new Set(),
147
153
  sessionsComplete: true,
148
154
  };
149
- provider.models.set(model, bucket);
155
+ provider.models.set(key, bucket);
150
156
  }
151
157
  return bucket;
152
158
  }
@@ -166,9 +172,9 @@ function addUsage(target, usage) {
166
172
  target.speedMs = (target.speedMs || 0) + (usage.speedMs || 0);
167
173
  }
168
174
 
169
- function foldRoute(state, providerId, modelId, kind, usage) {
175
+ function foldRoute(state, providerId, modelId, kind, usage, fast = false) {
170
176
  const provider = providerBucket(state, providerId, kind);
171
- const model = modelBucket(provider, modelId);
177
+ const model = modelBucket(provider, modelId, fast);
172
178
  for (const bucket of [provider, model]) {
173
179
  addUsage(bucket, usage);
174
180
  if (usage.turns > 0 && (!usage.sessions || usage.sessionsComplete === false)) {
@@ -258,7 +264,7 @@ function foldRollupDay(state, key, day, conversationOnly) {
258
264
  speedOutput: num(raw?.speedOutput),
259
265
  speedMs: num(raw?.speedMs),
260
266
  };
261
- foldRoute(state, providerId, modelId, text(raw?.kind), usage);
267
+ foldRoute(state, providerId, modelId, text(raw?.kind), usage, raw?.fast === true);
262
268
  addDaily(state, key, usage, providerId);
263
269
  }
264
270
 
@@ -313,7 +319,14 @@ function foldEvent(state, key, event, conversationOnly) {
313
319
  speedOutput: timed ? output : 0,
314
320
  speedMs: timed ? durationMs : 0,
315
321
  };
316
- foldRoute(state, providerId, modelId, text(event?.providerKind), usage);
322
+ // Tiers are kept on the record's rates (see makeUsageRecord), not top level.
323
+ const kind = text(event?.providerKind);
324
+ const fast = isFastCall({
325
+ kind,
326
+ requestServiceTier: event?.rates?.requestServiceTier,
327
+ serviceTier: event?.rates?.serviceTier,
328
+ });
329
+ foldRoute(state, providerId, modelId, kind, usage, fast);
317
330
  addDaily(state, key, usage, providerId);
318
331
 
319
332
  if (durationMs > 0) {
@@ -513,9 +526,12 @@ function exportRoute(bucket, totalTokens) {
513
526
  function exportProviders(state, { totalTokens, modelLimit }) {
514
527
  return [...state.providers.values()]
515
528
  .map((bucket) => {
516
- const models = [...bucket.models.values()]
517
- .map((model) => ({ model: model.model, ...exportRoute(model, totalTokens) }))
518
- .sort((a, b) => b.tokens - a.tokens || b.costUsd - a.costUsd);
529
+ const exported = [...bucket.models.values()].map((model) => ({
530
+ model: model.model,
531
+ ...(model.fast ? { fast: true } : {}),
532
+ ...exportRoute(model, totalTokens),
533
+ }));
534
+ const models = sortFastBesideModel(exported, (row) => row.model, ['tokens', 'costUsd']);
519
535
  return {
520
536
  provider: bucket.provider,
521
537
  providerKind: bucket.providerKind,
@@ -535,7 +551,12 @@ function exportUnpricedModels(state) {
535
551
  const rows = [];
536
552
  for (const provider of state.providers.values()) {
537
553
  for (const model of provider.models.values()) {
538
- if (model.turns > 0 && model.costKnownTurns < model.turns)
554
+ // A model's Fast bucket is the same identity as its normal one.
555
+ if (
556
+ model.turns > 0 &&
557
+ model.costKnownTurns < model.turns &&
558
+ !rows.some((row) => row.provider === provider.provider && row.model === model.model)
559
+ )
539
560
  rows.push({ provider: provider.provider, model: model.model });
540
561
  }
541
562
  }
@@ -12,7 +12,7 @@ import { sessionOptions } from './session-options.mjs';
12
12
  * time. A boot connect still mid-handshake is caught on the first user
13
13
  * turn by refreshInitialDeferredMcpSurface (session-turn-api), which
14
14
  * re-folds the live registry before the prompt renders. */
15
- function seedToolSurface(deps, reason) {
15
+ function seedToolSurface(deps, reason, coreMemoryContext) {
16
16
  const { rt, mcpClient, modelStandaloneTools, applyPreSessionToolSelection } = deps;
17
17
  let connectedMcpTools = [];
18
18
  try {
@@ -37,6 +37,8 @@ function seedToolSurface(deps, reason) {
37
37
  // process-wide firstTurnCompleted.
38
38
  rt.session.deferredInitialRefreshPending = !/resume/i.test(String(reason || ''));
39
39
  applyPreSessionToolSelection();
40
+ // Built from the settings as they stand: its first turn need not rebuild it.
41
+ deps.noteToolAvailability?.(rt.session, coreMemoryContext);
40
42
  }
41
43
 
42
44
  /** Adopt the provider session and publish it to hooks and statusline. */
@@ -45,7 +47,7 @@ export function materializeSession(deps, reason, coreMemoryContext) {
45
47
  // adoptSession attaches the hook bridge (boot/infrastructure.mjs sessionAdopter).
46
48
  adoptSession(mgr.createSession(sessionOptions(deps, coreMemoryContext)));
47
49
  rt.reservedSessionId = null;
48
- seedToolSurface(deps, reason);
50
+ seedToolSurface(deps, reason, coreMemoryContext);
49
51
  writeStatuslineRoute(statusRoutes, rt.session, rt.route);
50
52
  hooks.emit('session:create', {
51
53
  sessionId: rt.session.id,
@@ -111,6 +111,8 @@ export function sessionOptions(deps, coreMemoryContext) {
111
111
  cwd: rt.currentCwd,
112
112
  ...(rt.desktopSession && typeof rt.desktopSession === 'object' ? { desktopSession: rt.desktopSession } : {}),
113
113
  coreMemoryContext,
114
+ // Prompt settings from the in-memory config (its disk copy trails it).
115
+ promptConfig: rt.config,
114
116
  workflow,
115
117
  workflowContext,
116
118
  ...(leadWorkflowParts ? { leadWorkflowParts } : {}),
@@ -67,7 +67,6 @@ export function createBuiltinToolSettings(
67
67
  webSearchEnabled,
68
68
  invalidateContextStatusCache,
69
69
  invalidatePreSessionToolSurface,
70
- refreshEmptySessionToolPolicy,
71
70
  },
72
71
  localSettings
73
72
  ) {
@@ -201,19 +200,15 @@ export function createBuiltinToolSettings(
201
200
  async setWebSearchEnabled(enabled) {
202
201
  const config = getConfig();
203
202
  saveConfigAndAdopt(setModuleEnabledInConfig({ ...config }, 'webSearch', enabled !== false));
204
- // Empty/reserved sessions rebuild now so session entry does not still
205
- // advertise web_search. A conversation keeps its frozen schema.
206
- await refreshEmptySessionToolPolicy?.();
207
203
  return this.getToolModuleSettings();
208
204
  },
209
205
  /** Which user instruction files (AGENTS.md / CLAUDE.md) new sessions load:
210
- * 'all' | 'agents' | 'claude' | 'off'. The empty session rebuilds now. */
206
+ * 'all' | 'agents' | 'claude' | 'off'. An empty session rebuilds at its next turn. */
211
207
  async setInstructionFiles(mode) {
212
208
  if (!INSTRUCTION_FILES_MODES.includes(mode)) {
213
209
  throw new TypeError(`Instruction files must be one of ${INSTRUCTION_FILES_MODES.join(', ')}.`);
214
210
  }
215
211
  saveConfigAndAdopt({ ...getConfig(), instructionFiles: mode });
216
- await refreshEmptySessionToolPolicy?.();
217
212
  return this.getToolModuleSettings();
218
213
  },
219
214
  /** The global "Auto reasoning base": the effort Auto works around. */
@@ -238,7 +233,6 @@ export function createBuiltinToolSettings(
238
233
  if (memoryEnabled) nextConfig = setBuiltinInstalledInConfig(nextConfig, 'memory', true);
239
234
  saveConfigAndAdopt(nextConfig);
240
235
  invalidateContextStatusCache();
241
- await refreshEmptySessionToolPolicy?.();
242
236
  return this.getToolModuleSettings();
243
237
  },
244
238
  async setBuiltinToolEnabled(name, enabled) {
@@ -268,7 +262,6 @@ export function createBuiltinToolSettings(
268
262
  }
269
263
  // Turning Auto on loads nothing: the judge starts on its first turn.
270
264
  if (name === 'autoEffort' && enabled === false) await shutdownEffortJudge();
271
- await refreshEmptySessionToolPolicy?.();
272
265
  return this.getToolModuleSettings();
273
266
  },
274
267
  /** Extensions → Built-in Install: run the feature's preparation adapter
@@ -300,7 +293,6 @@ export function createBuiltinToolSettings(
300
293
  await syncLocalProviderRegistry?.(true);
301
294
  }
302
295
  if (name === 'memory') invalidateContextStatusCache();
303
- await refreshEmptySessionToolPolicy?.();
304
296
  return this.getToolModuleSettings();
305
297
  },
306
298
  /** Extensions → Code Tidy: which engines exist, where each one comes from,
@@ -66,7 +66,7 @@ export const AGENT_SETTINGS_HANDLERS = {
66
66
  }
67
67
  const name = requireText(args.name, 'name');
68
68
  await rt.restoreAgentDefinition(name);
69
- return { restored: name, note: 'Its chat is back; its routines stay off until they are turned on.' };
69
+ return { restored: name, note: 'Its chat is back, and its routines run again as they were.' };
70
70
  },
71
71
  set_bot_order: (rt, args) => ({ botOrder: rt.setBotOrder(args.botOrder).order }),
72
72
  set_cache_warming_enabled: (rt, args) => ({
@@ -93,4 +93,4 @@ export async function askToWidenConnectorTool(
93
93
  permission: level,
94
94
  note: `The user approved on the card; ${tool} is now ${level}.`,
95
95
  };
96
- }
96
+ }
@@ -79,7 +79,7 @@ const ACTION_APPLIES_TO = {
79
79
  set_agent_connector: "that agent's next connector tool call, in every session",
80
80
  set_agent_connector_tool: "that agent's next call of the tool, in every session",
81
81
  set_project_connector: 'the next connector tool call of sessions in that Project',
82
- restore_definition: 'now: the bot and its chat return; its routines stay off',
82
+ restore_definition: 'now: the bot, its chat and its routines (as they were) return',
83
83
  set_bot_order: 'the Bots page and the Sessions bot section on every device',
84
84
  set_orchestration_mode:
85
85
  "new sessions and an empty current one (the default mode); a conversation keeps its own mode until it is switched with the composer's mode selector",
@@ -92,7 +92,14 @@ const ACTION_APPLIES_TO = {
92
92
  set_heartbeat_interval:
93
93
  "Mixy's heartbeat from the next tick: the next check is due the new interval after the last one; no restart required",
94
94
  set_reactions_enabled:
95
- "bots' chats; while off a reaction is refused at once and new chats are not offered the tool; reactions already left stay visible",
95
+ "bots' chats, this conversation included, from their next turn; while off a reaction is refused at once; reactions already left stay visible",
96
+ set_profile: 'every conversation, this one included, from its next turn',
97
+ set_instruction_files: 'every conversation, this one included, from its next turn',
98
+ set_memory_enabled: 'every conversation, this one included, from its next turn',
99
+ set_web_search_enabled: 'every conversation, this one included, from its next turn',
100
+ set_builtin_enabled: 'every conversation, this one included, from its next turn',
101
+ install_builtin: 'every conversation, this one included, from its next turn',
102
+ set_output_style: 'every conversation, this one included, from its next turn',
96
103
  set_worktree_settings: 'new tasks and worktrees created afterwards; existing worktrees are unchanged',
97
104
  set_system_shell: 'subsequent shell calls',
98
105
  save_automation: 'the automation worker; scheduled runs follow the saved timing',
@@ -284,7 +284,7 @@ export const EXTENDED_SETUP_HANDLERS = Object.freeze({
284
284
  recovery:
285
285
  args.definitionKind === 'workflow'
286
286
  ? 'User-authored definition files are deleted. A built-in override may revert to its built-in definition.'
287
- : 'A custom agent or bot is archived with its chat and its routines are switched off; the user can restore it from Sessions → Archived, or delete it there for good. A built-in override reverts to its built-in definition.',
287
+ : 'A custom agent or bot is archived with its chat; its schedules and webhooks are paused and hidden, unchanged. The user can restore it, routines included, from Sessions → Archived, or delete it there for good, which deletes its routines too. A built-in override reverts to its built-in definition.',
288
288
  };
289
289
  },
290
290
  async save_automation(rt, args, context = {}) {
@@ -307,6 +307,8 @@ export const EXTENDED_SETUP_HANDLERS = Object.freeze({
307
307
  owner: input.owner,
308
308
  });
309
309
  const next = { ...pick(previous, entryKeys), ...input };
310
+ // Omitted keeps the saved executor without checking it again (channel-admin.mjs).
311
+ if (!own(input, 'executorAgentId')) delete next.executorAgentId;
310
312
  if (kind === 'schedule') {
311
313
  if (previous.whenAt && !own(input, 'time') && !own(input, 'at')) {
312
314
  next.at = new Date(previous.whenAt).toISOString();