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
@@ -23551,7 +23551,12 @@ async function runAsync(steps) {
23551
23551
  }
23552
23552
  function* readLockOwner(lockPath) {
23553
23553
  try {
23554
- const parts = String(yield ["read", lockPath]).trim().split(/\s+/);
23554
+ const text = String(yield ["read", lockPath]).trim();
23555
+ if (text.startsWith("{")) {
23556
+ const legacyPid = Number(JSON.parse(text)?.pid);
23557
+ return { pid: Number.isInteger(legacyPid) && legacyPid > 0 ? legacyPid : null, token: null };
23558
+ }
23559
+ const parts = text.split(/\s+/);
23555
23560
  const pid = Number.parseInt(parts[0], 10);
23556
23561
  return {
23557
23562
  pid: Number.isFinite(pid) && pid > 0 ? pid : null,
@@ -24031,6 +24036,19 @@ function settlesWithin(promise, ms) {
24031
24036
  });
24032
24037
  return Promise.race([promise.then(() => true), bound]).finally(() => clearTimeout(timer2));
24033
24038
  }
24039
+ async function readTarget(path2, read) {
24040
+ const key = targetKey(path2);
24041
+ let use = useOf(key);
24042
+ while (use.renaming) use = await outwaitRename(key, use);
24043
+ use.reads += 1;
24044
+ try {
24045
+ return await read();
24046
+ } finally {
24047
+ use.reads -= 1;
24048
+ if (use.reads === 0) for (const done of use.drained.splice(0)) done();
24049
+ forgetIfIdle(key, use);
24050
+ }
24051
+ }
24034
24052
  async function renameOver(src, dst) {
24035
24053
  const key = targetKey(dst);
24036
24054
  let use = useOf(key);
@@ -24256,6 +24274,14 @@ function readContentOrNullSync(filePath) {
24256
24274
  throw err;
24257
24275
  }
24258
24276
  }
24277
+ async function readContentOrNullAsync(filePath) {
24278
+ try {
24279
+ return await readTarget(filePath, () => readFileAsync3(filePath));
24280
+ } catch (err) {
24281
+ if (err?.code === "ENOENT") return null;
24282
+ throw err;
24283
+ }
24284
+ }
24259
24285
  function reportDamaged(filePath, error, outcome) {
24260
24286
  const reason = String(error?.message || error).replace(/[\0-\x1f]/g, (c) => `\\x${c.charCodeAt(0).toString(16)}`);
24261
24287
  process.stderr.write(`[state] ${filePath} is damaged (${reason}); ${outcome}
@@ -24275,6 +24301,20 @@ function recoverDamagedSync(filePath, parse, opts) {
24275
24301
  reportDamaged(filePath, current.error, recoveredOutcome(aside, backup));
24276
24302
  return backup.state === "ok" ? backup : { state: "absent" };
24277
24303
  }
24304
+ async function recoverDamagedAsync(filePath, parse, opts) {
24305
+ const current = parse(await readContentOrNullAsync(filePath));
24306
+ if (current.state !== "damaged") return current;
24307
+ const backup = opts.restoreBackup === false ? NO_BACKUP : parse(await readContentOrNullAsync(`${filePath}.bak`));
24308
+ if (backup.state !== "ok" && opts.keepWithoutBackup) {
24309
+ reportDamaged(filePath, current.error, KEPT_IN_PLACE);
24310
+ return { state: "absent" };
24311
+ }
24312
+ const aside = quarantinePath(filePath);
24313
+ await renameWithRetry(filePath, aside, opts);
24314
+ if (backup.state === "ok") await publishFileAsync(filePath, backup.content, restoreOpts(opts));
24315
+ reportDamaged(filePath, current.error, recoveredOutcome(aside, backup));
24316
+ return backup.state === "ok" ? backup : { state: "absent" };
24317
+ }
24278
24318
  function readJsonStateSync(filePath, { validate: validate2, decode, fallback = null, ...opts } = {}) {
24279
24319
  const parse = stateParser(validate2, decode);
24280
24320
  const first = parse(readContentOrNullSync(filePath));
@@ -24290,6 +24330,13 @@ function readJsonStateSync(filePath, { validate: validate2, decode, fallback = n
24290
24330
  }
24291
24331
  return recovered.state === "ok" ? recovered.value : fallback;
24292
24332
  }
24333
+ async function readForMutationAsync(filePath, opts) {
24334
+ const current = parseAnyJson(await readContentOrNullAsync(filePath));
24335
+ if (current.state === "ok") return current.value;
24336
+ if (current.state === "absent") return null;
24337
+ const recovered = await recoverDamagedAsync(filePath, parseAnyJson, opts);
24338
+ return recovered.state === "ok" ? recovered.value : null;
24339
+ }
24293
24340
  async function writeFileAtomicAsync(filePath, data, opts = {}) {
24294
24341
  assertTestSecretWriteSafe(filePath, opts);
24295
24342
  const run = () => publishFileAsync(filePath, data, opts);
@@ -24356,6 +24403,20 @@ function writeJsonAtomicAsync(filePath, value, opts = {}) {
24356
24403
  return writeFileAtomicAsync(filePath, `${JSON.stringify(value, null, opts.compact ? 0 : 2)}
24357
24404
  `, jsonBackupOpts(opts));
24358
24405
  }
24406
+ async function updateJsonAtomic(filePath, mutator, opts = {}) {
24407
+ const { lock: _lock, ...writeOpts } = opts;
24408
+ return withFileLock(
24409
+ `${filePath}.lock`,
24410
+ async () => {
24411
+ const cur = await readForMutationAsync(filePath, writeOpts);
24412
+ const next = mutator(cur);
24413
+ if (next === void 0) return cur;
24414
+ await writeJsonAtomicAsync(filePath, next, { ...writeOpts, lock: false });
24415
+ return next;
24416
+ },
24417
+ opts
24418
+ );
24419
+ }
24359
24420
  var _ioCeiling, _ioLimit, _ioActive, _ioFastStreak, _ioQueue, RETRY_CODES, RENAME_READ_WAIT_MS, targetUse, targetKey, FILE_FSYNC_TOLERATED, DIR_FSYNC_TOLERATED, keepsAsBackup, backupWriteOpts, jsonBackupOpts, quarantinePath, LOCK_BUSY_CODES, STATE_UNSUPPORTED, acceptAny, utf8Text, stateParser, restoreOpts, KEPT_IN_PLACE, NO_BACKUP, recoveredOutcome, parseAnyJson;
24360
24421
  var init_atomic_file = __esm({
24361
24422
  "src/runtime/shared/atomic-file.mjs"() {
@@ -36033,7 +36094,7 @@ var SLASH_COMMANDS = [
36033
36094
  {
36034
36095
  name: "goal",
36035
36096
  usage: "/goal",
36036
- params: "[objective --time 1h --time-mode max|status|pause|resume|edit|stop]",
36097
+ params: "[objective --time 1h|status|pause|resume|edit|stop]",
36037
36098
  description: "Run and manage a durable session Goal"
36038
36099
  },
36039
36100
  {
@@ -40596,7 +40657,7 @@ function textBetweenTag(text, tag) {
40596
40657
  function stripInlineMarkdown(value) {
40597
40658
  return String(value ?? "").replace(/^\s{0,3}(?:#{1,6}\s+|>\s+|[-*+]\s+|\d+\.\s+)/, "").replace(/\*\*([^*]+)\*\*/g, "$1").replace(/__([^_]+)__/g, "$1").replace(/(?<!\*)\*(?!\*)([^*]+)\*(?!\*)/g, "$1").replace(/`([^`]+)`/g, "$1").trim();
40598
40659
  }
40599
- var ENVELOPE_FIELD_LINE_RE = /^(?:agent task|background task|status|type|target|role|agent|preset|model|effort|fast|limits|session|task-id|task_id|surface|operation|label|exit_code|timed_out|signal|notification|queueDepth|worker|worker_stage|last_progress|silent_for|watchdog|queued_followups|diagnostic|started|finished|elapsed|reused|result|message|output|protocol|version):\s*/i;
40660
+ var ENVELOPE_FIELD_LINE_RE = /^(?:agent task|background task|status|type|target|role|agent|preset|model|effort|fast|limits|session|task-id|task_id|surface|operation|label|exit_code|timed_out|signal|notification|queueDepth|worker|worker_stage|last_progress|silent_for|tool_silent_for|watchdog|queued_followups|diagnostic|started|finished|elapsed|reused|result|message|output|protocol|version):\s*/i;
40600
40661
  var ENVELOPE_HEADER_LINE_RE = /^(?:agent result|background task)\b/i;
40601
40662
  var BRACKETED_FIELD_LINE_RE = /^\[[a-z-]+:\s*[^\]]*\]$/i;
40602
40663
  function firstAgentResultLine(text) {
@@ -41346,13 +41407,8 @@ function goalUnit(a) {
41346
41407
  const verbs = {
41347
41408
  status: ["Checking", "Checked"],
41348
41409
  create: ["Creating", "Created"],
41349
- pause: ["Pausing", "Paused"],
41350
- resume: ["Resuming", "Resumed"],
41351
- set_tasks: ["Planning", "Planned"],
41352
- update_tasks: ["Updating", "Updated"],
41353
41410
  complete: ["Completing", "Completed"],
41354
- block: ["Blocking", "Blocked"],
41355
- abandon: ["Abandoning", "Abandoned"]
41411
+ block: ["Blocking", "Blocked"]
41356
41412
  }[action] || ["Updating", "Updated"];
41357
41413
  return unitDescriptor("Setup", {
41358
41414
  count: 1,
@@ -41442,6 +41498,12 @@ function agentUnit(a) {
41442
41498
  if (/^(?:status|read|list)$/.test(type)) {
41443
41499
  return unitDescriptor("Agent", { count, active: "Checking", done: "Checked", noun: "agent" });
41444
41500
  }
41501
+ if (type === "cancel") {
41502
+ return unitDescriptor("Agent", { count, active: "Cancelling", done: "Cancelled", noun: "agent", effect: true });
41503
+ }
41504
+ if (type === "close") {
41505
+ return unitDescriptor("Agent", { count, active: "Ending", done: "Ended", noun: "agent", effect: true });
41506
+ }
41445
41507
  return unitDescriptor("Agent", { count, noun: "agent" });
41446
41508
  }
41447
41509
  function taskUnit(a) {
@@ -41533,6 +41595,25 @@ function cwdUnit(a) {
41533
41595
  pluralNoun: "working directories"
41534
41596
  });
41535
41597
  }
41598
+ function sessionUnit(a) {
41599
+ const action = String(a.action || a.type || "").toLowerCase();
41600
+ if (action === "create") {
41601
+ return unitDescriptor("Setup", { active: "Creating", done: "Created", noun: "session", effect: true });
41602
+ }
41603
+ if (action === "send") {
41604
+ return unitDescriptor("Setup", { active: "Sending to", done: "Sent to", noun: "session", effect: true });
41605
+ }
41606
+ if (action === "cancel") {
41607
+ return unitDescriptor("Setup", { active: "Cancelling", done: "Cancelled", noun: "session", effect: true });
41608
+ }
41609
+ if (action === "delete") {
41610
+ return unitDescriptor("Setup", { active: "Deleting", done: "Deleted", noun: "session", effect: true });
41611
+ }
41612
+ if (/^(?:list|bots|read|suggest)$/.test(action)) {
41613
+ return unitDescriptor("Setup", { active: "Checking", done: "Checked", noun: "session" });
41614
+ }
41615
+ return cwdUnit(a);
41616
+ }
41536
41617
  var TOOL_UNITS = /* @__PURE__ */ new Map([
41537
41618
  [
41538
41619
  "read",
@@ -41643,7 +41724,7 @@ var TOOL_UNITS = /* @__PURE__ */ new Map([
41643
41724
  ],
41644
41725
  ["cwd", cwdUnit],
41645
41726
  // legacy: old transcripts
41646
- ["session", cwdUnit]
41727
+ ["session", sessionUnit]
41647
41728
  ]);
41648
41729
  function mcpUnit(name, a) {
41649
41730
  const mcp = parseMcpToolName(name);
@@ -50908,8 +50989,8 @@ function buildSpinnerMeta({
50908
50989
  thinkingParts,
50909
50990
  tokensText: tokens > 0 ? `${formatSpinnerTokens(tokens)} tokens` : "",
50910
50991
  // The count appears with the FIRST token (user: 30초가 아니라 바로).
50911
- // Elapsed was never gated, so the byline used to grow a second field
50912
- // mid-turn for no reason the reader could see; now both arrive together.
50992
+ // Elapsed is never gated, so showing tokens with the first token keeps the
50993
+ // byline from growing a second field mid-turn; both arrive together.
50913
50994
  showTokens: tokens > 0,
50914
50995
  thinkingText,
50915
50996
  thinkingActive: Boolean(thinking || Number(thinkingSince) > 0),
@@ -61535,7 +61616,7 @@ function modelFooter(selection, model = null) {
61535
61616
  return {
61536
61617
  glyph: "\u25C7",
61537
61618
  color: theme.inactive,
61538
- text: `${parameter.label}: ${parameter.options?.find((option) => option.value === value)?.label || value} \xB7 T Toggle`
61619
+ text: `${parameter.label}: ${parameter.options?.find((option) => option.value === value)?.label || value} \xB7 ${parameter.id === "providerSort" ? "R Cycle" : "T Toggle"}`
61539
61620
  };
61540
61621
  });
61541
61622
  if (!values.length)
@@ -61589,6 +61670,20 @@ function createContextSelection({ state, currentRoute, isCurrentRoute, isStateRo
61589
61670
  return { contextSelectionFor, stepContext };
61590
61671
  }
61591
61672
 
61673
+ // src/runtime/agent/orchestrator/providers/openrouter-provider-routing.mjs
61674
+ var OPENROUTER_SORT_PARAMETER = "providerSort";
61675
+ var OPENROUTER_SORT_OPTION = Object.freeze({
61676
+ id: OPENROUTER_SORT_PARAMETER,
61677
+ label: "Routing",
61678
+ kind: "enum",
61679
+ options: [
61680
+ { value: "auto", label: "Auto" },
61681
+ { value: "price", label: "Price first" },
61682
+ { value: "throughput", label: "Speed first" },
61683
+ { value: "latency", label: "Latency first" }
61684
+ ]
61685
+ });
61686
+
61592
61687
  // src/tui/app/model-picker/route-selection/fast-parameters.mjs
61593
61688
  var TOGGLE_PARAMETER_IDS = /* @__PURE__ */ new Set(["thinking", DAYBREAK_PARAMETER_ID]);
61594
61689
  function createFastParameterSelection({ state, currentRoute, isCurrentRoute, isStateRoute, getSelectedEffort }) {
@@ -61654,8 +61749,7 @@ function createFastParameterSelection({ state, currentRoute, isCurrentRoute, isS
61654
61749
  else setSpeed(model, false, "priority");
61655
61750
  return true;
61656
61751
  };
61657
- const cycleThinking = (model) => {
61658
- const definition = (model.modelParameterOptions || []).find((parameter) => TOGGLE_PARAMETER_IDS.has(parameter.id));
61752
+ const cycleParameter = (model, definition) => {
61659
61753
  if (!definition?.options?.length) return false;
61660
61754
  const wanted = definition.id;
61661
61755
  const parameters = modelParametersFor(model);
@@ -61668,7 +61762,23 @@ function createFastParameterSelection({ state, currentRoute, isCurrentRoute, isS
61668
61762
  if (!fastAvailableFor(model)) selectedFast.set(modelKey(model), false);
61669
61763
  return true;
61670
61764
  };
61671
- return { modelParametersFor, fastAvailableFor, getSelectedFast, isUltrafast, toggleFast, cycleThinking };
61765
+ const cycleThinking = (model) => cycleParameter(
61766
+ model,
61767
+ (model.modelParameterOptions || []).find((parameter) => TOGGLE_PARAMETER_IDS.has(parameter.id))
61768
+ );
61769
+ const cycleRouting = (model) => cycleParameter(
61770
+ model,
61771
+ (model.modelParameterOptions || []).find((parameter) => parameter.id === OPENROUTER_SORT_PARAMETER)
61772
+ );
61773
+ return {
61774
+ modelParametersFor,
61775
+ fastAvailableFor,
61776
+ getSelectedFast,
61777
+ isUltrafast,
61778
+ toggleFast,
61779
+ cycleThinking,
61780
+ cycleRouting
61781
+ };
61672
61782
  }
61673
61783
 
61674
61784
  // src/tui/app/model-picker/route-selection.mjs
@@ -61711,12 +61821,13 @@ function createRouteSelection({ providerModels, state, currentRoute }) {
61711
61821
  toggleFast: fast.toggleFast,
61712
61822
  cycleEffort: effort.cycleEffort,
61713
61823
  cycleThinking: fast.cycleThinking,
61824
+ cycleRouting: fast.cycleRouting,
61714
61825
  routeInputFor
61715
61826
  };
61716
61827
  }
61717
61828
 
61718
61829
  // src/tui/app/model-picker/provider-models-list.mjs
61719
- var MODEL_LIST_HELP = "\u2191/\u2193 Select \xB7 \u2190/\u2192 Effort \xB7 C/Shift+C Context \xB7 Tab Fast \xB7 T Thinking \xB7 Enter Save";
61830
+ var MODEL_LIST_HELP = "\u2191/\u2193 Select \xB7 \u2190/\u2192 Effort \xB7 C/Shift+C Context \xB7 Tab Fast \xB7 T Thinking \xB7 R Routing \xB7 Enter Save";
61720
61831
  function saveSelectedRoute({
61721
61832
  store,
61722
61833
  options,
@@ -61792,11 +61903,15 @@ function openProviderModelsPicker({ view, provider, onBack, saveRoute }) {
61792
61903
  },
61793
61904
  onKey: (input, _key, item) => {
61794
61905
  const model = item?._model;
61795
- if (!model || !["c", "C", "t", "T"].includes(input)) return;
61906
+ if (!model || !["c", "C", "t", "T", "r", "R"].includes(input)) return;
61796
61907
  if (input.toLowerCase() === "c") {
61797
61908
  if (selection.stepContext(model, input === "C" ? -1 : 1)) render2();
61798
61909
  return;
61799
61910
  }
61911
+ if (input.toLowerCase() === "r") {
61912
+ if (selection.cycleRouting(model)) render2();
61913
+ return;
61914
+ }
61800
61915
  if (selection.cycleThinking(model)) render2();
61801
61916
  },
61802
61917
  onCancel: () => {
@@ -62370,6 +62485,7 @@ function createSettingsNavigation({ openers, openSettingsPicker, setSettingsProm
62370
62485
  import { readFileSync as readFileSync11, readdirSync as readdirSync2, statSync as statSync5, mkdirSync as mkdirSync5, existsSync as existsSync10, watch as fsWatch } from "node:fs";
62371
62486
  import { basename as basename6, join as join12, dirname as dirname9 } from "node:path";
62372
62487
  import { createRequire as createRequire3 } from "node:module";
62488
+ import { randomUUID as randomUUID2 } from "node:crypto";
62373
62489
 
62374
62490
  // src/runtime/shared/object.mjs
62375
62491
  function hasOwn(value, key) {
@@ -62837,6 +62953,7 @@ var AGENT_PROVIDER_ENV_ALIASES = Object.freeze({
62837
62953
 
62838
62954
  // src/runtime/shared/config.mjs
62839
62955
  var _require = createRequire3(import.meta.url);
62956
+ var _keychain = _require("../../lib/keychain-cjs.cjs");
62840
62957
  var {
62841
62958
  getSecret: _getSecret,
62842
62959
  setSecret: _setSecret,
@@ -62848,8 +62965,9 @@ var {
62848
62965
  keychainStatus: _keychainStatus,
62849
62966
  retryKeychain: _retryKeychain,
62850
62967
  refreshKeychainStatus: _refreshKeychainStatus,
62851
- onKeychainRecovered: _onKeychainRecovered
62852
- } = _require("../../lib/keychain-cjs.cjs");
62968
+ onKeychainRecovered: _onKeychainRecovered,
62969
+ prewarmSecrets: _prewarmSecrets
62970
+ } = _keychain;
62853
62971
  function configPath() {
62854
62972
  return join12(resolvePluginData(), "mixdog-config.json");
62855
62973
  }
@@ -62865,6 +62983,7 @@ function withFreshDefaultsVersion(fresh, root) {
62865
62983
  return root;
62866
62984
  }
62867
62985
  var _configReadCache = null;
62986
+ var _inNotificationPass = false;
62868
62987
  var CONFIG_READ_TTL_MS = (() => {
62869
62988
  const n = Number(process.env.MIXDOG_CONFIG_READ_TTL_MS);
62870
62989
  return Number.isFinite(n) && n >= 0 ? n : 0;
@@ -62872,6 +62991,9 @@ var CONFIG_READ_TTL_MS = (() => {
62872
62991
  function invalidateConfigReadCache() {
62873
62992
  _configReadCache = null;
62874
62993
  }
62994
+ function statKey(st) {
62995
+ return `${st.mtimeMs}:${st.ctimeMs}:${st.size}:${st.ino}`;
62996
+ }
62875
62997
  function readConfigRawCached() {
62876
62998
  const now = Date.now();
62877
62999
  if (_configReadCache && _configReadCache.path !== configPath()) _configReadCache = null;
@@ -62881,7 +63003,7 @@ function readConfigRawCached() {
62881
63003
  }
62882
63004
  try {
62883
63005
  const st2 = statSync5(configPath());
62884
- if (st2.mtimeMs === _configReadCache.mtimeMs && st2.size === _configReadCache.size) {
63006
+ if (statKey(st2) === _configReadCache.stat) {
62885
63007
  _configReadCache.atMs = now;
62886
63008
  return _configReadCache.raw;
62887
63009
  }
@@ -62912,7 +63034,7 @@ function readConfigRawCached() {
62912
63034
  `);
62913
63035
  throw err;
62914
63036
  }
62915
- _configReadCache = { raw, path: configPath(), mtimeMs: st.mtimeMs, size: st.size, atMs: now };
63037
+ _configReadCache = { raw, path: configPath(), stat: statKey(st), atMs: now };
62916
63038
  return raw;
62917
63039
  }
62918
63040
  function canonicalizeStoredChannelsConfig(value = {}) {
@@ -62965,6 +63087,7 @@ function readConfigFile() {
62965
63087
  return parseJsonText(raw);
62966
63088
  } catch (err) {
62967
63089
  invalidateConfigReadCache();
63090
+ if (_inNotificationPass) throw configMidWriteError(err);
62968
63091
  quarantineMalformedConfig(err);
62969
63092
  return null;
62970
63093
  }
@@ -63108,24 +63231,164 @@ function readAllForRmW() {
63108
63231
  if (!isPlainObject(parsed)) throw new SyntaxError("config root must be a JSON object");
63109
63232
  return parsed;
63110
63233
  } catch (parseErr) {
63234
+ if (_inNotificationPass) throw configMidWriteError(parseErr);
63111
63235
  return restoreAllForRmWOrThrow(parseErr.message, quarantineMalformedConfig(parseErr));
63112
63236
  }
63113
63237
  }
63238
+ var SECRETS_MARKER_FILE = "mixdog-secrets-changed.json";
63239
+ var SECRET_DELETED_KEY = "#deleted";
63240
+ var _secretsSeen = null;
63241
+ var _secretsSeenPath = "";
63242
+ var _secretsMarkerStat = "";
63243
+ function secretsMarkerPath() {
63244
+ return join12(dirname9(configPath()), SECRETS_MARKER_FILE);
63245
+ }
63246
+ function secretsMarkerStat(path2) {
63247
+ try {
63248
+ const stat2 = statSync5(path2);
63249
+ return `${stat2.mtimeMs}:${stat2.size}:${stat2.ino}`;
63250
+ } catch {
63251
+ return "missing";
63252
+ }
63253
+ }
63254
+ function readSecretsMarker() {
63255
+ try {
63256
+ const parsed = parseJsonText(readFileSync11(secretsMarkerPath(), "utf8"));
63257
+ return isPlainObject(parsed) ? parsed : {};
63258
+ } catch {
63259
+ return {};
63260
+ }
63261
+ }
63262
+ function syncSecretsMarker() {
63263
+ const path2 = secretsMarkerPath();
63264
+ if (_secretsSeenPath !== path2) {
63265
+ _secretsSeen = null;
63266
+ _secretsSeenPath = path2;
63267
+ }
63268
+ _secretsMarkerStat = secretsMarkerStat(path2);
63269
+ const marker = readSecretsMarker();
63270
+ if (_secretsSeen === null) {
63271
+ _secretsSeen = marker;
63272
+ return [];
63273
+ }
63274
+ const seen = _secretsSeen;
63275
+ const changed = [.../* @__PURE__ */ new Set([...Object.keys(seen), ...Object.keys(marker)])].filter(
63276
+ (account) => seen[account] !== marker[account]
63277
+ );
63278
+ _secretsSeen = marker;
63279
+ if (changed.includes(SECRET_DELETED_KEY)) _keychain.invalidateSecretCache?.();
63280
+ else for (const account of changed) if (!account.startsWith("#")) _keychain.invalidateSecretCache?.(account);
63281
+ return changed;
63282
+ }
63283
+ function syncSecretsMarkerIfMoved() {
63284
+ if (_secretsSeen !== null && _secretsSeenPath === secretsMarkerPath()) {
63285
+ if (secretsMarkerStat(_secretsSeenPath) === _secretsMarkerStat) return;
63286
+ }
63287
+ syncSecretsMarker();
63288
+ }
63289
+ var secretChangeToken = () => `${process.pid}:${Date.now()}:${randomUUID2()}`;
63290
+ function withSecretChange(marker, account, token, deleted) {
63291
+ const next = { ...isPlainObject(marker) ? marker : {} };
63292
+ if (deleted) {
63293
+ delete next[account];
63294
+ next[SECRET_DELETED_KEY] = token;
63295
+ } else {
63296
+ next[account] = token;
63297
+ }
63298
+ return next;
63299
+ }
63300
+ function beginSecretChange() {
63301
+ syncSecretsMarker();
63302
+ return secretChangeToken();
63303
+ }
63304
+ function finishSecretChange(account, token, deleted) {
63305
+ _secretsSeen = withSecretChange(_secretsSeen, account, token, deleted);
63306
+ _secretsMarkerStat = secretsMarkerStat(secretsMarkerPath());
63307
+ notifyConfigChanged();
63308
+ }
63309
+ var secretMarkerFailure = (err) => process.stderr.write(`[config] secret change marker write failed: ${err?.message || err}
63310
+ `);
63311
+ async function publishSecretChangeAsync(account, deleted = false) {
63312
+ const token = beginSecretChange();
63313
+ try {
63314
+ mkdirSync5(dirname9(secretsMarkerPath()), { recursive: true, mode: 448 });
63315
+ await updateJsonAtomic(secretsMarkerPath(), (marker) => withSecretChange(marker, account, token, deleted), {
63316
+ mode: 384
63317
+ });
63318
+ } catch (err) {
63319
+ secretMarkerFailure(err);
63320
+ }
63321
+ finishSecretChange(account, token, deleted);
63322
+ }
63114
63323
  var CONFIG_CHANGE_DEBOUNCE_MS = 100;
63324
+ var WATCHED_FILES = /* @__PURE__ */ new Set(["mixdog-config.json", SECRETS_MARKER_FILE]);
63115
63325
  var _configChangeListeners = /* @__PURE__ */ new Set();
63116
63326
  var _configChangeTimer = null;
63117
- function notifyConfigChanged() {
63118
- if (!_configChangeListeners.size) return;
63119
- if (_configChangeTimer) clearTimeout(_configChangeTimer);
63120
- _configChangeTimer = setTimeout(() => {
63121
- _configChangeTimer = null;
63122
- invalidateConfigReadCache();
63327
+ var _configChangeForced = false;
63328
+ var _watchedContent = null;
63329
+ function watchedContent() {
63330
+ const dir = dirname9(configPath());
63331
+ return [...WATCHED_FILES].map((file) => {
63332
+ try {
63333
+ return readFileSync11(join12(dir, file), "latin1");
63334
+ } catch {
63335
+ return null;
63336
+ }
63337
+ });
63338
+ }
63339
+ var CONFIG_SETTLE_RETRY_MS = 300;
63340
+ var _configSettleTimer = null;
63341
+ var _configSettleRetried = false;
63342
+ function configMidWriteError(parseErr) {
63343
+ _configChangeForced = true;
63344
+ if (!_configSettleRetried && !_configSettleTimer && _configChangeListeners.size) {
63345
+ _configSettleTimer = setTimeout(() => {
63346
+ _configSettleTimer = null;
63347
+ _configSettleRetried = true;
63348
+ void runConfigChangeListeners();
63349
+ }, CONFIG_SETTLE_RETRY_MS);
63350
+ _configSettleTimer.unref?.();
63351
+ }
63352
+ const error = new Error(
63353
+ `[config] mixdog-config.json does not parse yet (${parseErr.message}); keeping the current config`
63354
+ );
63355
+ error.code = "ECONFIG_MID_WRITE";
63356
+ return error;
63357
+ }
63358
+ async function runConfigChangeListeners() {
63359
+ const forced = _configChangeForced;
63360
+ _configChangeForced = false;
63361
+ const content = watchedContent();
63362
+ const last = _watchedContent;
63363
+ if (!forced && Array.isArray(last) && last.every((value, index) => value === content[index])) return;
63364
+ _watchedContent = content;
63365
+ invalidateConfigReadCache();
63366
+ if (syncSecretsMarker().length && process.platform === "linux") {
63367
+ try {
63368
+ await _prewarmSecrets?.();
63369
+ } catch {
63370
+ }
63371
+ }
63372
+ _inNotificationPass = true;
63373
+ try {
63123
63374
  for (const listener of [..._configChangeListeners]) {
63124
63375
  try {
63125
63376
  listener();
63126
63377
  } catch {
63127
63378
  }
63128
63379
  }
63380
+ } finally {
63381
+ _inNotificationPass = false;
63382
+ }
63383
+ }
63384
+ function notifyConfigChanged({ fromWatch = false } = {}) {
63385
+ if (!_configChangeListeners.size) return;
63386
+ if (!fromWatch) _configChangeForced = true;
63387
+ _configSettleRetried = false;
63388
+ if (_configChangeTimer) clearTimeout(_configChangeTimer);
63389
+ _configChangeTimer = setTimeout(() => {
63390
+ _configChangeTimer = null;
63391
+ void runConfigChangeListeners();
63129
63392
  }, CONFIG_CHANGE_DEBOUNCE_MS);
63130
63393
  _configChangeTimer.unref?.();
63131
63394
  }
@@ -63190,6 +63453,21 @@ var SECRET_ACCOUNTS = Object.freeze({
63190
63453
  agentApiKey: (provider) => `agent.${provider}.apiKey`,
63191
63454
  openaiUsageSessionKey: "agent.openai.usageSessionKey"
63192
63455
  });
63456
+ var keychainSecretStore = Object.freeze({
63457
+ getSecretAsync(account) {
63458
+ syncSecretsMarkerIfMoved();
63459
+ return _keychain.getSecretAsync(account);
63460
+ },
63461
+ invalidateSecretCache: (account) => _keychain.invalidateSecretCache?.(account),
63462
+ async setSecretAsync(account, value, { announce = true } = {}) {
63463
+ await _keychain.setSecretAsync(account, value);
63464
+ if (announce) await publishSecretChangeAsync(account);
63465
+ },
63466
+ async deleteSecretAsync(account, { announce = true } = {}) {
63467
+ await _keychain.deleteSecretAsync(account);
63468
+ if (announce) await publishSecretChangeAsync(account, true);
63469
+ }
63470
+ });
63193
63471
 
63194
63472
  // src/runtime/channels/lib/voice-setup.mjs
63195
63473
  var _voiceRuntimeFetcherPromise = null;
@@ -63704,6 +63982,11 @@ function createSettingsToggles({
63704
63982
  }
63705
63983
 
63706
63984
  // src/tui/app/settings-picker.mjs
63985
+ var heavyGates = /* @__PURE__ */ new WeakMap();
63986
+ var heavyGateOf = (cacheRef) => {
63987
+ if (!heavyGates.has(cacheRef)) heavyGates.set(cacheRef, { running: false, queued: false, freshWrites: 0 });
63988
+ return heavyGates.get(cacheRef);
63989
+ };
63707
63990
  function createSettingsPicker({
63708
63991
  store,
63709
63992
  state,
@@ -63712,6 +63995,7 @@ function createSettingsPicker({
63712
63995
  setSettingsPrompt,
63713
63996
  settingsHeavyCacheRef,
63714
63997
  settingsRequestRef,
63998
+ settingsLiveRefreshRef,
63715
63999
  formatDuration: formatDuration2,
63716
64000
  displayModelName: displayModelName3,
63717
64001
  routeModelLabel: routeModelLabel2,
@@ -63730,10 +64014,18 @@ function createSettingsPicker({
63730
64014
  const own = surface.claim();
63731
64015
  const light = opts.light === true;
63732
64016
  if (!light && !own.paint(settingsHandoffPanel())) return;
63733
- const heavyCache = light ? settingsHeavyCacheRef.current : null;
64017
+ const heavyCache = light && opts.heavy !== true ? settingsHeavyCacheRef.current : null;
64018
+ const gate = heavyGateOf(settingsHeavyCacheRef);
64019
+ const freshWritesAtStart = gate.freshWrites;
63734
64020
  const snapshot = await store.getSettingsSnapshot?.({ heavy: !heavyCache }) || {};
63735
64021
  const view = readSettingsView({ snapshot, heavyCache, state });
64022
+ if (!isCurrentSettingsRequest(requestId)) {
64023
+ if (!heavyCache && own.owns() && gate.freshWrites === freshWritesAtStart) gate.queued = true;
64024
+ return;
64025
+ }
64026
+ if (!own.owns()) return;
63736
64027
  settingsHeavyCacheRef.current = { mcp: view.mcp, plugins: view.plugins, skills: view.skills };
64028
+ if (!heavyCache) gate.freshWrites += 1;
63737
64029
  const toggles = createSettingsToggles({
63738
64030
  store,
63739
64031
  view,
@@ -63758,8 +64050,6 @@ function createSettingsPicker({
63758
64050
  routeModelLabel: routeModelLabel2,
63759
64051
  workflowDisplayName: workflowDisplayName2
63760
64052
  });
63761
- if (!isCurrentSettingsRequest(requestId)) return;
63762
- if (!own.owns()) return;
63763
64053
  setProviderPrompt(null);
63764
64054
  setSettingsPrompt(null);
63765
64055
  own.paint({
@@ -63784,6 +64074,7 @@ function createSettingsPicker({
63784
64074
  own.close();
63785
64075
  }
63786
64076
  });
64077
+ if (settingsLiveRefreshRef) settingsLiveRefreshRef.current = own.defer(() => refreshSettings({ heavy: true }));
63787
64078
  };
63788
64079
  const openSettingsPicker = async (opts = {}) => {
63789
64080
  const requestId = nextSettingsRequest();
@@ -63793,8 +64084,23 @@ function createSettingsPicker({
63793
64084
  store.pushNotice(`settings unavailable: ${error?.message || error}`, "error");
63794
64085
  }
63795
64086
  };
63796
- const refreshSettings = () => {
63797
- void openSettingsPicker({ light: true });
64087
+ const refreshHeavy = () => {
64088
+ const gate = heavyGateOf(settingsHeavyCacheRef);
64089
+ if (gate.running) {
64090
+ gate.queued = true;
64091
+ return;
64092
+ }
64093
+ gate.running = true;
64094
+ void openSettingsPicker({ light: true, heavy: true }).finally(() => {
64095
+ gate.running = false;
64096
+ if (!gate.queued) return;
64097
+ gate.queued = false;
64098
+ settingsLiveRefreshRef?.current?.();
64099
+ });
64100
+ };
64101
+ const refreshSettings = ({ heavy = false } = {}) => {
64102
+ if (heavy) refreshHeavy();
64103
+ else void openSettingsPicker({ light: true });
63798
64104
  };
63799
64105
  const navigation = createSettingsNavigation({ openers, openSettingsPicker, setSettingsPrompt });
63800
64106
  return { openSettingsPicker };
@@ -64104,7 +64410,7 @@ var sessionCommands = {
64104
64410
  store.pushNotice("Goal is unavailable.", "warn");
64105
64411
  return;
64106
64412
  }
64107
- store.pushNotice(result.message || "Goal updated.", "info");
64413
+ store.pushNotice(result.message || "Goal updated.", result.ok === false ? "warn" : "info");
64108
64414
  }).catch((error) => store.pushNotice(`Goal failed: ${error?.message || error}`, "error"));
64109
64415
  return true;
64110
64416
  },
@@ -64298,6 +64604,7 @@ function createAppPickers({
64298
64604
  onboardingPrefetchSeqRef,
64299
64605
  settingsHeavyCacheRef,
64300
64606
  settingsRequestRef,
64607
+ settingsLiveRefreshRef,
64301
64608
  livePickerRef,
64302
64609
  disabledSkills,
64303
64610
  setDisabledSkills,
@@ -64418,6 +64725,7 @@ function createAppPickers({
64418
64725
  setSettingsPrompt,
64419
64726
  settingsHeavyCacheRef,
64420
64727
  settingsRequestRef,
64728
+ settingsLiveRefreshRef,
64421
64729
  formatDuration,
64422
64730
  displayModelName,
64423
64731
  routeModelLabel,
@@ -64903,15 +65211,15 @@ import { join as join16 } from "node:path";
64903
65211
  import { Worker as Worker2 } from "node:worker_threads";
64904
65212
 
64905
65213
  // src/tui/session/transcript-spill/spill-dir.mjs
64906
- import { randomUUID as randomUUID2 } from "node:crypto";
65214
+ import { randomUUID as randomUUID3 } from "node:crypto";
64907
65215
  import { mkdtempSync, readdirSync as readdirSync5, readFileSync as readFileSync14, rmSync as rmSync5, statSync as statSync7, writeFileSync as writeFileSync4 } from "node:fs";
64908
65216
  import { tmpdir as tmpdir3 } from "node:os";
64909
65217
  import { join as join15 } from "node:path";
64910
65218
  var STALE_MS = 24 * 60 * 60 * 1e3;
64911
- var PROCESS_NONCE = randomUUID2();
65219
+ var PROCESS_NONCE = randomUUID3();
64912
65220
 
64913
65221
  // src/tui/session/transcript-spill/spill-writer.mjs
64914
- import { randomUUID as randomUUID3 } from "node:crypto";
65222
+ import { randomUUID as randomUUID4 } from "node:crypto";
64915
65223
  import { mkdirSync as mkdirSync8 } from "node:fs";
64916
65224
  import { dirname as dirname11 } from "node:path";
64917
65225
 
@@ -66506,6 +66814,10 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
66506
66814
  const { btwPanel, btw } = useBtwPanel({ store, sessionId: state.sessionId });
66507
66815
  const settingsHeavyCacheRef = useRef33(null);
66508
66816
  const settingsRequestRef = useRef33(0);
66817
+ const settingsLiveRefreshRef = useRef33(null);
66818
+ useEffect36(() => {
66819
+ if (state.setupChanged) settingsLiveRefreshRef.current?.();
66820
+ }, [state.setupChanged]);
66509
66821
  const [providerPrompt, setProviderPrompt] = useState26(null);
66510
66822
  const oauthSubmitRef = useRef33(false);
66511
66823
  const [settingsPrompt, setSettingsPrompt] = useState26(null);
@@ -66617,6 +66929,7 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
66617
66929
  onboardingPrefetchSeqRef,
66618
66930
  settingsHeavyCacheRef,
66619
66931
  settingsRequestRef,
66932
+ settingsLiveRefreshRef,
66620
66933
  livePickerRef,
66621
66934
  disabledSkills,
66622
66935
  setDisabledSkills,