mixdog 1.2.5 → 1.2.6

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 (290) hide show
  1. package/package.json +1 -1
  2. package/scripts/lib/gate-scheduler.mjs +2 -2
  3. package/scripts/lib/run-node-tests.mjs +5 -14
  4. package/scripts/provider-pingpong-live.mjs +9 -9
  5. package/src/agents/advisor/AGENT.md +4 -4
  6. package/src/agents/advisor/agent.json +1 -1
  7. package/src/agents/reviewer/AGENT.md +2 -3
  8. package/src/agents/reviewer/agent.json +1 -1
  9. package/src/defaults/shipped-history.json +10 -0
  10. package/src/defaults/skills/browser-use/SKILL.md +2 -1
  11. package/src/defaults/skills/computer-use/SKILL.md +3 -1
  12. package/src/defaults/skills/visualize/SKILL.md +3 -2
  13. package/src/lib/rules-builder.cjs +1 -1
  14. package/src/output-styles/common.md +22 -6
  15. package/src/output-styles/detailed.md +7 -5
  16. package/src/output-styles/minimal.md +7 -3
  17. package/src/output-styles/simple.md +2 -3
  18. package/src/rules/agent/AGENT.md +3 -1
  19. package/src/rules/lead/LEAD.md +4 -3
  20. package/src/rules/shared/10-tool-workflow.md +2 -1
  21. package/src/rules/shared/60-verification.md +4 -5
  22. package/src/runtime/agent/orchestrator/agent-runtime/cache-strategy.mjs +2 -1
  23. package/src/runtime/agent/orchestrator/config.mjs +6 -0
  24. package/src/runtime/agent/orchestrator/context/skill-catalog.mjs +1 -1
  25. package/src/runtime/agent/orchestrator/internal-agents.mjs +10 -0
  26. package/src/runtime/agent/orchestrator/mcp/child-tree.mjs +53 -60
  27. package/src/runtime/agent/orchestrator/mcp/client.mjs +7 -4
  28. package/src/runtime/agent/orchestrator/mcp/oauth-callback.mjs +2 -3
  29. package/src/runtime/agent/orchestrator/providers/account-pool.mjs +9 -2
  30. package/src/runtime/agent/orchestrator/providers/anthropic-oauth-credentials.mjs +40 -19
  31. package/src/runtime/agent/orchestrator/providers/anthropic-oauth.mjs +3 -2
  32. package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn/turn-events/content-block-start.mjs +4 -1
  33. package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn/turn-events.mjs +2 -0
  34. package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn.mjs +3 -0
  35. package/src/runtime/agent/orchestrator/providers/anthropic-sse.mjs +2 -1
  36. package/src/runtime/agent/orchestrator/providers/anthropic.mjs +3 -1
  37. package/src/runtime/agent/orchestrator/providers/antigravity-oauth-login.mjs +1 -2
  38. package/src/runtime/agent/orchestrator/providers/catalog-deadline.mjs +163 -0
  39. package/src/runtime/agent/orchestrator/providers/catalog-failures.mjs +34 -0
  40. package/src/runtime/agent/orchestrator/providers/grok-oauth-login.mjs +38 -14
  41. package/src/runtime/agent/orchestrator/providers/lib/oauth-page.mjs +100 -26
  42. package/src/runtime/agent/orchestrator/providers/lib/send-callbacks.mjs +24 -0
  43. package/src/runtime/agent/orchestrator/providers/oauth-credential-probes.mjs +13 -0
  44. package/src/runtime/agent/orchestrator/providers/oauth-usage.mjs +2 -1
  45. package/src/runtime/agent/orchestrator/providers/openai-compat-chat-send.mjs +1 -0
  46. package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream/chunk-events.mjs +4 -0
  47. package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream/stream-state.mjs +3 -1
  48. package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream.mjs +2 -0
  49. package/src/runtime/agent/orchestrator/providers/openai-compat-models.mjs +49 -4
  50. package/src/runtime/agent/orchestrator/providers/openai-compat-presets.mjs +0 -7
  51. package/src/runtime/agent/orchestrator/providers/openai-compat-responses-events.mjs +7 -1
  52. package/src/runtime/agent/orchestrator/providers/openai-compat-responses.mjs +1 -0
  53. package/src/runtime/agent/orchestrator/providers/openai-compat-stream.mjs +2 -0
  54. package/src/runtime/agent/orchestrator/providers/openai-compat-xai-send.mjs +1 -0
  55. package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-events.mjs +5 -1
  56. package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state.mjs +11 -2
  57. package/src/runtime/agent/orchestrator/providers/openai-oauth-http-sse.mjs +1 -0
  58. package/src/runtime/agent/orchestrator/providers/openai-oauth-login.mjs +45 -16
  59. package/src/runtime/agent/orchestrator/providers/openai-oauth-ws.mjs +1 -0
  60. package/src/runtime/agent/orchestrator/providers/openai-ws-connect.mjs +196 -0
  61. package/src/runtime/agent/orchestrator/providers/openai-ws-pool.mjs +74 -9
  62. package/src/runtime/agent/orchestrator/providers/openai-ws-stream/event-switch.mjs +14 -1
  63. package/src/runtime/agent/orchestrator/providers/openai-ws-stream.mjs +2 -0
  64. package/src/runtime/agent/orchestrator/providers/opencode-go-oauth-login.mjs +194 -0
  65. package/src/runtime/agent/orchestrator/providers/opencode-go-oauth-tokens.mjs +353 -0
  66. package/src/runtime/agent/orchestrator/providers/opencode-go-oauth.mjs +293 -0
  67. package/src/runtime/agent/orchestrator/providers/opencode-go-usage.mjs +33 -100
  68. package/src/runtime/agent/orchestrator/providers/opencode-go.mjs +23 -14
  69. package/src/runtime/agent/orchestrator/providers/registry.mjs +41 -27
  70. package/src/runtime/agent/orchestrator/runtime-core/ask-user-tool-defs.mjs +2 -3
  71. package/src/runtime/agent/orchestrator/runtime-core/orchestration.mjs +3 -8
  72. package/src/runtime/agent/orchestrator/session/agent-pool-progress.mjs +15 -3
  73. package/src/runtime/agent/orchestrator/session/compact/execution-tail.mjs +74 -13
  74. package/src/runtime/agent/orchestrator/session/compact/forked-summary.mjs +102 -0
  75. package/src/runtime/agent/orchestrator/session/compact/runner.mjs +8 -2
  76. package/src/runtime/agent/orchestrator/session/compact/summary.mjs +16 -0
  77. package/src/runtime/agent/orchestrator/session/lifecycle-scan.mjs +9 -0
  78. package/src/runtime/agent/orchestrator/session/loop/fresh-context.mjs +39 -2
  79. package/src/runtime/agent/orchestrator/session/loop/tool-exec/before-hook.mjs +9 -19
  80. package/src/runtime/agent/orchestrator/session/loop/tool-exec.mjs +2 -3
  81. package/src/runtime/agent/orchestrator/session/manager/ask-turn-loop-options.mjs +3 -0
  82. package/src/runtime/agent/orchestrator/session/manager/ask-turn-steering-drain.mjs +13 -5
  83. package/src/runtime/agent/orchestrator/session/manager/pending-message-entry.mjs +10 -7
  84. package/src/runtime/agent/orchestrator/session/manager/pending-messages.mjs +62 -22
  85. package/src/runtime/agent/orchestrator/session/manager/runtime-liveness.mjs +23 -1
  86. package/src/runtime/agent/orchestrator/session/manager/session-close.mjs +81 -34
  87. package/src/runtime/agent/orchestrator/session/manager.mjs +2 -2
  88. package/src/runtime/agent/orchestrator/session/request-fork.mjs +47 -0
  89. package/src/runtime/agent/orchestrator/session/side-question-store.mjs +16 -1
  90. package/src/runtime/agent/orchestrator/session/side-question.mjs +5 -43
  91. package/src/runtime/agent/orchestrator/session/store/fs-probe.mjs +10 -0
  92. package/src/runtime/agent/orchestrator/session/store/lifecycle-barriers.mjs +73 -6
  93. package/src/runtime/agent/orchestrator/session/store/load-session.mjs +40 -0
  94. package/src/runtime/agent/orchestrator/session/store/save-fault.mjs +15 -0
  95. package/src/runtime/agent/orchestrator/session/store/session-paths.mjs +12 -0
  96. package/src/runtime/agent/orchestrator/session/store-agent-worker-header.mjs +36 -0
  97. package/src/runtime/agent/orchestrator/session/store-agent-worker-rows.mjs +258 -43
  98. package/src/runtime/agent/orchestrator/session/store-record-strict-scan.mjs +306 -0
  99. package/src/runtime/agent/orchestrator/session/store-summary-catalog.mjs +70 -21
  100. package/src/runtime/agent/orchestrator/session/store-summary-reader.mjs +46 -30
  101. package/src/runtime/agent/orchestrator/session/store-transcript-cache.mjs +144 -45
  102. package/src/runtime/agent/orchestrator/session/store-transcript-projection.mjs +32 -13
  103. package/src/runtime/agent/orchestrator/session/store-transcript-worker.mjs +364 -38
  104. package/src/runtime/agent/orchestrator/session/store.mjs +9 -2
  105. package/src/runtime/agent/orchestrator/session/task-wait-control.mjs +43 -12
  106. package/src/runtime/agent/orchestrator/session/tool-result-offload.mjs +23 -6
  107. package/src/runtime/agent/orchestrator/tools/builtin/arg-guard.mjs +12 -6
  108. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/backgrounded-result.mjs +13 -7
  109. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/bashism-rewrite.mjs +1 -1
  110. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/benign-exit.mjs +7 -1
  111. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/completed-result.mjs +40 -7
  112. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/deadline-plan.mjs +37 -34
  113. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/inline-hoist.mjs +1 -1
  114. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/spawn-env.mjs +0 -4
  115. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool.mjs +6 -0
  116. package/src/runtime/agent/orchestrator/tools/builtin/builtin-tools.mjs +29 -27
  117. package/src/runtime/agent/orchestrator/tools/builtin/external-tool-adapters.mjs +1 -1
  118. package/src/runtime/agent/orchestrator/tools/builtin/find-files-tool.mjs +28 -11
  119. package/src/runtime/agent/orchestrator/tools/builtin/git-command-policy.mjs +12 -3
  120. package/src/runtime/agent/orchestrator/tools/builtin/git-command-tool.mjs +203 -101
  121. package/src/runtime/agent/orchestrator/tools/builtin/git-repo-rw-lock.mjs +90 -41
  122. package/src/runtime/agent/orchestrator/tools/builtin/lib/list-helpers.mjs +17 -1
  123. package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-delivery.mjs +199 -0
  124. package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-task-output.mjs +165 -39
  125. package/src/runtime/agent/orchestrator/tools/builtin/list-tool.mjs +25 -13
  126. package/src/runtime/agent/orchestrator/tools/builtin/read-batch.mjs +7 -6
  127. package/src/runtime/agent/orchestrator/tools/builtin/read-formatting.mjs +19 -4
  128. package/src/runtime/agent/orchestrator/tools/builtin/read-line-collector.mjs +5 -3
  129. package/src/runtime/agent/orchestrator/tools/builtin/read-single-render.mjs +25 -7
  130. package/src/runtime/agent/orchestrator/tools/builtin/read-special-files.mjs +2 -1
  131. package/src/runtime/agent/orchestrator/tools/builtin/read-tool/batch-render.mjs +3 -1
  132. package/src/runtime/agent/orchestrator/tools/builtin/search-glob-tool.mjs +12 -5
  133. package/src/runtime/agent/orchestrator/tools/builtin/search-grep-tool.mjs +61 -22
  134. package/src/runtime/agent/orchestrator/tools/builtin/search-path-diagnostics.mjs +32 -8
  135. package/src/runtime/agent/orchestrator/tools/builtin/shell-analysis.mjs +193 -19
  136. package/src/runtime/agent/orchestrator/tools/builtin/shell-direct-exe.mjs +57 -7
  137. package/src/runtime/agent/orchestrator/tools/builtin/shell-jobs.mjs +119 -32
  138. package/src/runtime/agent/orchestrator/tools/builtin/shell-lossless-compact.mjs +26 -1
  139. package/src/runtime/agent/orchestrator/tools/builtin/shell-output.mjs +13 -28
  140. package/src/runtime/agent/orchestrator/tools/builtin/task-tool.mjs +90 -11
  141. package/src/runtime/agent/orchestrator/tools/builtin/wait-budgets.mjs +23 -0
  142. package/src/runtime/agent/orchestrator/tools/builtin.mjs +54 -10
  143. package/src/runtime/agent/orchestrator/tools/code-graph/build.mjs +22 -28
  144. package/src/runtime/agent/orchestrator/tools/code-graph/dispatch.mjs +11 -7
  145. package/src/runtime/agent/orchestrator/tools/destructive-warning.mjs +126 -9
  146. package/src/runtime/agent/orchestrator/tools/graph-manifest.json +13 -13
  147. package/src/runtime/agent/orchestrator/tools/lib/owned-shell-trees.mjs +15 -6
  148. package/src/runtime/agent/orchestrator/tools/lib/shell-descendants.mjs +40 -2
  149. package/src/runtime/agent/orchestrator/tools/lib/shell-run-background/promote-job.mjs +2 -2
  150. package/src/runtime/agent/orchestrator/tools/lib/shell-run-background/promotion-results.mjs +13 -3
  151. package/src/runtime/agent/orchestrator/tools/lib/shell-run-settle.mjs +2 -0
  152. package/src/runtime/agent/orchestrator/tools/lib/shell-run-state.mjs +3 -1
  153. package/src/runtime/agent/orchestrator/tools/patch/v4a-convert.mjs +1 -1
  154. package/src/runtime/agent/orchestrator/tools/shell-command.mjs +35 -4
  155. package/src/runtime/agent/orchestrator/tools/shell-policy.mjs +7 -2
  156. package/src/runtime/agent/orchestrator/tools/shell-powershell.mjs +39 -23
  157. package/src/runtime/agent/orchestrator/tools/shell-snapshot.mjs +6 -2
  158. package/src/runtime/agent/orchestrator/tools/spawn-manifest.json +13 -13
  159. package/src/runtime/attachments/office-extract.mjs +11 -9
  160. package/src/runtime/memory/lib/embedding-tokenizer.mjs +32 -18
  161. package/src/runtime/memory/lib/runtime-fetcher.mjs +1 -1
  162. package/src/runtime/memory/lib/tool-call-handler.mjs +7 -5
  163. package/src/runtime/office/authoring/pptx-script-normalize.mjs +11 -8
  164. package/src/runtime/office/core/tabular.mjs +1 -1
  165. package/src/runtime/office/design/library/design-template-inspect.mjs +7 -4
  166. package/src/runtime/office/portable/docx-formatting.mjs +1 -1
  167. package/src/runtime/office/portable/docx-runs.mjs +1 -1
  168. package/src/runtime/office/portable/docx-tracked-edits.mjs +2 -2
  169. package/src/runtime/office/portable/portable-docx-edits.mjs +11 -10
  170. package/src/runtime/office/portable/portable-docx-operations.mjs +21 -17
  171. package/src/runtime/office/portable/portable-docx-parts.mjs +15 -9
  172. package/src/runtime/office/portable/portable-docx-styles.mjs +4 -1
  173. package/src/runtime/office/portable/portable-docx-xml.mjs +9 -9
  174. package/src/runtime/office/portable/portable-opc.mjs +27 -13
  175. package/src/runtime/office/portable/portable-pivot.mjs +3 -3
  176. package/src/runtime/office/portable/portable-pptx-chart.mjs +3 -3
  177. package/src/runtime/office/portable/portable-pptx-charts.mjs +24 -18
  178. package/src/runtime/office/portable/portable-pptx-core.mjs +5 -5
  179. package/src/runtime/office/portable/portable-pptx-deck.mjs +8 -4
  180. package/src/runtime/office/portable/portable-pptx-package.mjs +7 -4
  181. package/src/runtime/office/portable/portable-pptx-shapes.mjs +18 -9
  182. package/src/runtime/office/portable/portable-sheet-parts.mjs +9 -3
  183. package/src/runtime/office/portable/portable-sheet-xml.mjs +5 -5
  184. package/src/runtime/office/portable/portable-xlsx-charts.mjs +4 -1
  185. package/src/runtime/office/portable/portable-xlsx-drawings.mjs +10 -6
  186. package/src/runtime/office/portable/portable-xlsx-operations.mjs +8 -5
  187. package/src/runtime/office/portable/portable-xlsx-pivot-ops.mjs +1 -1
  188. package/src/runtime/office/portable/portable-xlsx-reference-shift.mjs +11 -7
  189. package/src/runtime/office/portable/portable-xlsx-sheet-edits.mjs +6 -3
  190. package/src/runtime/office/portable/portable-xml.mjs +1 -1
  191. package/src/runtime/shared/atomic-file.mjs +22 -13
  192. package/src/runtime/shared/background-tasks.mjs +60 -20
  193. package/src/runtime/shared/child-spawn-gate.mjs +26 -16
  194. package/src/runtime/shared/config.mjs +0 -10
  195. package/src/runtime/shared/file-lock.mjs +7 -1
  196. package/src/runtime/shared/file-permissions-worker.mjs +38 -0
  197. package/src/runtime/shared/file-permissions.d.mts +19 -4
  198. package/src/runtime/shared/file-permissions.mjs +310 -4
  199. package/src/runtime/shared/git-runner-worker.mjs +6 -78
  200. package/src/runtime/shared/llm/http-agent.mjs +7 -3
  201. package/src/runtime/shared/llm/provider-catalog-registry.mjs +10 -0
  202. package/src/runtime/shared/llm/usage-accounting.mjs +2 -0
  203. package/src/runtime/shared/llm/usage-ledger-import.mjs +32 -3
  204. package/src/runtime/shared/llm/usage-ledger-rollup.mjs +12 -5
  205. package/src/runtime/shared/llm/usage-ledger-worker.mjs +1 -1
  206. package/src/runtime/shared/llm/usage-ledger.mjs +20 -5
  207. package/src/runtime/shared/memory-snapshot.mjs +5 -1
  208. package/src/runtime/shared/notify-trace.mjs +8 -1
  209. package/src/runtime/shared/pristine-execution-contract.json +5 -1
  210. package/src/runtime/shared/process-runner-worker.mjs +7 -0
  211. package/src/runtime/shared/process-runner.mjs +38 -0
  212. package/src/runtime/shared/provider-accounts.mjs +2 -1
  213. package/src/runtime/shared/provider-api-key.mjs +0 -1
  214. package/src/runtime/shared/read-row-numbers.mjs +1 -1
  215. package/src/runtime/shared/resource-admission.mjs +60 -18
  216. package/src/runtime/shared/run-child.mjs +84 -0
  217. package/src/runtime/shared/session-activity-signal.mjs +23 -0
  218. package/src/runtime/shared/shell-output-summary.mjs +23 -0
  219. package/src/runtime/shared/singleton-owner.mjs +126 -42
  220. package/src/runtime/shared/tool-output-limit.mjs +4 -2
  221. package/src/runtime/shared/tool-output-marker.mjs +58 -0
  222. package/src/runtime/shared/user-data-guard.mjs +28 -9
  223. package/src/runtime/shared/worktrees/activity-gate.mjs +33 -8
  224. package/src/runtime/shared/worktrees/git-head.mjs +20 -2
  225. package/src/runtime/shared/worktrees/lock.mjs +3 -2
  226. package/src/runtime/terminal-bridge/tool-defs.mjs +1 -1
  227. package/src/runtime/tidy/runners/biome.mjs +3 -1
  228. package/src/runtime/tidy/shadow.mjs +2 -1
  229. package/src/runtime/web-search/index.mjs +5 -7
  230. package/src/runtime/web-search/lib/formatter.mjs +42 -6
  231. package/src/runtime/web-search/tool-defs.mjs +6 -1
  232. package/src/session-runtime/lifecycle/session-switch/context-switch.mjs +4 -3
  233. package/src/session-runtime/lifecycle/session-switch/resume.mjs +7 -4
  234. package/src/session-runtime/lifecycle/session-switch/session-delete.mjs +3 -3
  235. package/src/session-runtime/lifecycle/shared.mjs +19 -2
  236. package/src/session-runtime/lifecycle/teardown/session-close.mjs +2 -0
  237. package/src/session-runtime/lifecycle/teardown.mjs +5 -2
  238. package/src/session-runtime/lifecycle-api.mjs +3 -1
  239. package/src/session-runtime/provider-auth/login.mjs +10 -6
  240. package/src/session-runtime/provider-auth/setup.mjs +19 -2
  241. package/src/session-runtime/provider-catalog-cache.mjs +101 -25
  242. package/src/session-runtime/provider-models/catalog-load.mjs +14 -3
  243. package/src/session-runtime/provider-models/row-hydration.mjs +4 -0
  244. package/src/session-runtime/provider-models.mjs +76 -10
  245. package/src/session-runtime/provider-readiness.mjs +4 -0
  246. package/src/session-runtime/services/agent-tool/close-flow.mjs +2 -1
  247. package/src/session-runtime/services/agent-tool/job-views/agent-list.mjs +10 -2
  248. package/src/session-runtime/services/agent-tool/job-views/session-progress.mjs +13 -4
  249. package/src/session-runtime/services/agent-tool/notify.mjs +15 -4
  250. package/src/session-runtime/services/agent-tool/restart-notify.mjs +134 -0
  251. package/src/session-runtime/services/agent-tool/send-flow.mjs +24 -1
  252. package/src/session-runtime/services/agent-tool/spawn-flow/deferred-spawn.mjs +2 -1
  253. package/src/session-runtime/services/agent-tool/spawn-flow/job-start.mjs +4 -3
  254. package/src/session-runtime/services/agent-tool/spawn-flow/spawn-run.mjs +5 -1
  255. package/src/session-runtime/services/agent-tool/tag-registry/tag-lookup.mjs +8 -3
  256. package/src/session-runtime/services/agent-tool/tag-registry.mjs +3 -0
  257. package/src/session-runtime/services/agent-tool/worker-index/row-shape.mjs +4 -0
  258. package/src/session-runtime/services/agent-tool/worker-index.mjs +44 -10
  259. package/src/session-runtime/services/agent-tool.mjs +20 -0
  260. package/src/session-runtime/services/provider-admin.mjs +92 -20
  261. package/src/session-runtime/services/usage-dashboard-model.mjs +2 -2
  262. package/src/session-runtime/services/usage-dashboard.mjs +27 -69
  263. package/src/session-runtime/turn/session-ops.mjs +2 -2
  264. package/src/session-runtime/turn/turn-run/ask-callbacks.mjs +1 -0
  265. package/src/session-runtime/usage-stats-api.mjs +6 -1
  266. package/src/standalone/channel-transport/http-routes.mjs +10 -9
  267. package/src/standalone/daemon-desktop-runtime.mjs +20 -7
  268. package/src/standalone/daemon-owner.mjs +117 -25
  269. package/src/standalone/daemon.mjs +43 -13
  270. package/src/standalone/session-call-cache.mjs +6 -0
  271. package/src/standalone/session-protocol.mjs +1 -1
  272. package/src/standalone/session-service/retention/busy.mjs +7 -2
  273. package/src/standalone/session-transport/routes.mjs +7 -6
  274. package/src/tui/app/model-options.mjs +39 -2
  275. package/src/tui/app/model-picker.mjs +16 -2
  276. package/src/tui/app/provider-setup-picker.mjs +1 -2
  277. package/src/tui/dist/index.mjs +385 -104
  278. package/src/tui/session/notice-text.mjs +0 -1
  279. package/src/tui/session/session-api/intake/submission.mjs +7 -13
  280. package/src/tui/session/session-api/integrations.mjs +1 -5
  281. package/src/tui/session/session-flow/drain.mjs +8 -0
  282. package/src/tui/session/session-flow/steering.mjs +46 -0
  283. package/src/tui/session/session-flow.mjs +2 -0
  284. package/src/tui/session/turn-stream.mjs +33 -0
  285. package/src/tui/session/turn.mjs +30 -3
  286. package/src/ui/statusline.mjs +1 -6
  287. package/src/ui/streaming-markdown-heal.mjs +24 -7
  288. package/src/vendor/statusline/bin/statusline-route.mjs +0 -1
  289. package/src/vendor/statusline/src/gateway/route-meta.mjs +0 -1
  290. package/src/workflows/default/WORKFLOW.md +9 -13
@@ -1825,8 +1825,8 @@ var require_react_reconciler_production = __commonJS({
1825
1825
  currentEntangledActionThenable = {
1826
1826
  status: "pending",
1827
1827
  value: void 0,
1828
- then: function(resolve6) {
1829
- entangledListeners.push(resolve6);
1828
+ then: function(resolve7) {
1829
+ entangledListeners.push(resolve7);
1830
1830
  }
1831
1831
  };
1832
1832
  }
@@ -1849,8 +1849,8 @@ var require_react_reconciler_production = __commonJS({
1849
1849
  status: "pending",
1850
1850
  value: null,
1851
1851
  reason: null,
1852
- then: function(resolve6) {
1853
- listeners.push(resolve6);
1852
+ then: function(resolve7) {
1853
+ listeners.push(resolve7);
1854
1854
  }
1855
1855
  };
1856
1856
  thenable.then(
@@ -11449,8 +11449,8 @@ var require_react_reconciler_development = __commonJS({
11449
11449
  currentEntangledActionThenable = {
11450
11450
  status: "pending",
11451
11451
  value: void 0,
11452
- then: function(resolve6) {
11453
- entangledListeners.push(resolve6);
11452
+ then: function(resolve7) {
11453
+ entangledListeners.push(resolve7);
11454
11454
  }
11455
11455
  };
11456
11456
  }
@@ -11473,8 +11473,8 @@ var require_react_reconciler_development = __commonJS({
11473
11473
  status: "pending",
11474
11474
  value: null,
11475
11475
  reason: null,
11476
- then: function(resolve6) {
11477
- listeners.push(resolve6);
11476
+ then: function(resolve7) {
11477
+ listeners.push(resolve7);
11478
11478
  }
11479
11479
  };
11480
11480
  thenable.then(
@@ -23114,9 +23114,194 @@ var require_stack_utils = __commonJS({
23114
23114
 
23115
23115
  // src/runtime/shared/file-permissions.mjs
23116
23116
  import { existsSync as existsSync4 } from "node:fs";
23117
- import { dirname as dirname3, join as join3 } from "node:path";
23118
- import { execFile as execFile2, execFileSync as execFileSync2 } from "node:child_process";
23119
- import { promisify } from "node:util";
23117
+ import { dirname as dirname3, join as join3, resolve as resolve3 } from "node:path";
23118
+ import { execFile as execFile2, execFileSync as execFileSync2, spawn as spawn3 } from "node:child_process";
23119
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
23120
+ import { MessageChannel as MessageChannel2, receiveMessageOnPort, SHARE_ENV, Worker } from "node:worker_threads";
23121
+ function execFileAsync(file, args, options) {
23122
+ return new Promise((done, fail) => {
23123
+ execFile2(file, args, options, (error, stdout2, stderr) => {
23124
+ if (error) fail(Object.assign(error, { stdout: stdout2, stderr }));
23125
+ else done({ stdout: stdout2, stderr });
23126
+ });
23127
+ });
23128
+ }
23129
+ function aclHelperScript(sid) {
23130
+ return [
23131
+ "$ErrorActionPreference = 'Stop';",
23132
+ `$sid = [System.Security.Principal.SecurityIdentifier]::new(${quoteForPowerShell(sid)});`,
23133
+ "$full = [System.Security.AccessControl.FileSystemRights]::FullControl;",
23134
+ "$utf8 = [System.Text.Encoding]::UTF8;",
23135
+ "$out = [Console]::Out;",
23136
+ "while ($null -ne ($line = [Console]::In.ReadLine())) {",
23137
+ "$parts = $line.Split(@([char]32), 2);",
23138
+ "if ($parts.Count -ne 2) { continue };",
23139
+ "try {",
23140
+ "$path = $utf8.GetString([Convert]::FromBase64String($parts[1]));",
23141
+ "$directory = [System.IO.Directory]::Exists($path);",
23142
+ "$current = if ($directory) { [System.IO.Directory]::GetAccessControl($path) }",
23143
+ "else { [System.IO.File]::GetAccessControl($path) };",
23144
+ "$rules = @($current.GetAccessRules($true, $true, [System.Security.Principal.SecurityIdentifier]));",
23145
+ "$ownerOnly = $current.AreAccessRulesProtected -and $rules.Count -eq 1 -and",
23146
+ "$rules[0].AccessControlType -eq 'Allow' -and $rules[0].IdentityReference -eq $sid -and",
23147
+ "$rules[0].FileSystemRights -eq $full;",
23148
+ "if ($ownerOnly) { $out.WriteLine($parts[0] + ' ok') } else {",
23149
+ "$acl = if ($directory) { [System.Security.AccessControl.DirectorySecurity]::new() }",
23150
+ "else { [System.Security.AccessControl.FileSecurity]::new() };",
23151
+ "$acl.SetAccessRuleProtection($true, $false);",
23152
+ "$acl.AddAccessRule([System.Security.AccessControl.FileSystemAccessRule]::new(",
23153
+ "$sid, $full, [System.Security.AccessControl.AccessControlType]::Allow));",
23154
+ "if ($directory) { [System.IO.Directory]::SetAccessControl($path, $acl) }",
23155
+ "else { [System.IO.File]::SetAccessControl($path, $acl) };",
23156
+ "$out.WriteLine($parts[0] + ' fixed') }",
23157
+ "} catch {",
23158
+ "$out.WriteLine($parts[0] + ' err ' + [Convert]::ToBase64String($utf8.GetBytes([string]$_.Exception.Message)))",
23159
+ "};",
23160
+ "$out.Flush() }"
23161
+ ].join(" ");
23162
+ }
23163
+ function startAclHelper(icacls, sid) {
23164
+ const now = Date.now();
23165
+ aclHelperStartTimes = aclHelperStartTimes.filter((at) => now - at < ACL_HELPER_START_WINDOW_MS);
23166
+ if (aclHelperStartTimes.length >= ACL_HELPER_MAX_STARTS) return null;
23167
+ aclHelperStartTimes.push(now);
23168
+ const command = powerShellCommand(icacls, aclHelperScript(sid));
23169
+ let child;
23170
+ try {
23171
+ child = spawn3(command.executable, command.args, {
23172
+ cwd: dirname3(icacls),
23173
+ stdio: ["pipe", "pipe", "ignore"],
23174
+ windowsHide: true
23175
+ });
23176
+ } catch {
23177
+ return null;
23178
+ }
23179
+ const helper = { child, pending: /* @__PURE__ */ new Map(), buffer: "", dead: false };
23180
+ helper.fail = (cause) => {
23181
+ if (aclHelper === helper) aclHelper = null;
23182
+ if (helper.dead) return;
23183
+ helper.dead = true;
23184
+ const lost = [...helper.pending.values()];
23185
+ helper.pending.clear();
23186
+ for (const request of lost) request.lost(cause);
23187
+ try {
23188
+ child.kill();
23189
+ } catch {
23190
+ }
23191
+ };
23192
+ child.on("error", helper.fail);
23193
+ child.on("exit", () => helper.fail(new Error("Windows ACL helper exited")));
23194
+ child.stdin.on("error", helper.fail);
23195
+ child.stdout.on("error", helper.fail);
23196
+ child.stdout.on("close", () => helper.fail(new Error("Windows ACL helper closed its output")));
23197
+ child.stdout.setEncoding("utf8");
23198
+ child.stdout.on("data", (chunk) => {
23199
+ helper.buffer += chunk;
23200
+ let newline = helper.buffer.indexOf("\n");
23201
+ while (newline >= 0) {
23202
+ const [id, status, detail = ""] = helper.buffer.slice(0, newline).trim().split(" ");
23203
+ helper.buffer = helper.buffer.slice(newline + 1);
23204
+ newline = helper.buffer.indexOf("\n");
23205
+ const request = helper.pending.get(id);
23206
+ if (!request) continue;
23207
+ helper.pending.delete(id);
23208
+ syncAclHelperRef(helper);
23209
+ request.answer(status, Buffer.from(detail, "base64").toString("utf8"));
23210
+ }
23211
+ });
23212
+ syncAclHelperRef(helper);
23213
+ return helper;
23214
+ }
23215
+ function syncAclHelperRef(helper) {
23216
+ const method = helper.pending.size > 0 ? "ref" : "unref";
23217
+ helper.child[method]();
23218
+ helper.child.stdin[method]?.();
23219
+ helper.child.stdout[method]?.();
23220
+ }
23221
+ function askAclHelper(targetPath, icacls, sid) {
23222
+ if (!aclHelper) aclHelper = startAclHelper(icacls, sid);
23223
+ const helper = aclHelper;
23224
+ if (!helper) return Promise.resolve({ lost: new Error("Windows ACL helper unavailable") });
23225
+ return new Promise((done) => {
23226
+ aclHelperSeq += 1;
23227
+ const id = String(aclHelperSeq);
23228
+ const timer2 = setTimeout(() => {
23229
+ helper.pending.delete(id);
23230
+ syncAclHelperRef(helper);
23231
+ done({ lost: new Error("Windows ACL helper timed out") });
23232
+ helper.fail(new Error("Windows ACL helper timed out"));
23233
+ }, ACL_HELPER_REQUEST_TIMEOUT_MS);
23234
+ helper.pending.set(id, {
23235
+ answer(status, detail) {
23236
+ clearTimeout(timer2);
23237
+ done({ status, detail });
23238
+ },
23239
+ lost(cause) {
23240
+ clearTimeout(timer2);
23241
+ done({ lost: cause });
23242
+ }
23243
+ });
23244
+ syncAclHelperRef(helper);
23245
+ helper.child.stdin.write(`${id} ${Buffer.from(targetPath, "utf8").toString("base64")}
23246
+ `);
23247
+ });
23248
+ }
23249
+ function syncBridge() {
23250
+ if (aclSyncBridge || aclSyncBridgeBroken) return aclSyncBridge;
23251
+ try {
23252
+ const url = new URL("./file-permissions-worker.mjs", import.meta.url);
23253
+ if (!existsSync4(fileURLToPath2(url))) throw new Error("Windows ACL bridge worker is not shipped here");
23254
+ const { port1, port2 } = new MessageChannel2();
23255
+ const signal = new Int32Array(new SharedArrayBuffer(12));
23256
+ const worker = new Worker(url, {
23257
+ env: SHARE_ENV,
23258
+ execArgv: [],
23259
+ workerData: { port: port2, signal },
23260
+ transferList: [port2]
23261
+ });
23262
+ const bridge = { worker, port: port1, signal, seq: 0, startedAt: Date.now() };
23263
+ const drop = () => {
23264
+ if (aclSyncBridge === bridge) aclSyncBridge = null;
23265
+ };
23266
+ worker.on("error", drop);
23267
+ worker.on("exit", drop);
23268
+ worker.unref();
23269
+ port1.unref?.();
23270
+ aclSyncBridge = bridge;
23271
+ } catch {
23272
+ aclSyncBridgeBroken = true;
23273
+ }
23274
+ return aclSyncBridge;
23275
+ }
23276
+ function dropSyncBridge(bridge) {
23277
+ if (aclSyncBridge !== bridge) return;
23278
+ aclSyncBridge = null;
23279
+ void bridge.worker.terminate();
23280
+ }
23281
+ function askSyncBridge(targetPath) {
23282
+ const bridge = syncBridge();
23283
+ if (!bridge) return { lost: new Error("Windows ACL bridge unavailable") };
23284
+ bridge.seq += 1;
23285
+ const id = bridge.seq;
23286
+ let seen = Atomics.load(bridge.signal, 0);
23287
+ bridge.port.postMessage({ id, path: targetPath });
23288
+ const deadline = Date.now() + ACL_SYNC_BRIDGE_TIMEOUT_MS;
23289
+ for (; ; ) {
23290
+ for (let received = receiveMessageOnPort(bridge.port); received; received = receiveMessageOnPort(bridge.port)) {
23291
+ if (received.message?.id === id) return received.message;
23292
+ }
23293
+ const now = Date.now();
23294
+ const ready = Atomics.load(bridge.signal, 2) === 1;
23295
+ if (Atomics.load(bridge.signal, 1) === 1 || !ready && now - bridge.startedAt >= ACL_SYNC_BRIDGE_READY_MS) {
23296
+ dropSyncBridge(bridge);
23297
+ return { lost: new Error("Windows ACL bridge exited") };
23298
+ }
23299
+ if (now >= deadline) return { timedOut: true };
23300
+ const wait = ready ? deadline - now : Math.min(deadline - now, bridge.startedAt + ACL_SYNC_BRIDGE_READY_MS - now);
23301
+ Atomics.wait(bridge.signal, 0, seen, Math.max(1, wait));
23302
+ seen = Atomics.load(bridge.signal, 0);
23303
+ }
23304
+ }
23120
23305
  function systemToolPath(name) {
23121
23306
  const systemRoot = process.env.SystemRoot || process.env.windir;
23122
23307
  return systemRoot ? join3(systemRoot, "System32", name) : null;
@@ -23216,6 +23401,14 @@ function aclFailure(targetPath, cause, label = "icacls") {
23216
23401
  function enforceOwnerOnlyAclWin32(targetPath, { fresh = false } = {}) {
23217
23402
  if (process.platform !== "win32") return;
23218
23403
  const icacls = icaclsPath();
23404
+ if (fresh) {
23405
+ const reply = askSyncBridge(resolve3(targetPath));
23406
+ if (reply.ok === true) return;
23407
+ if (reply.ok === false) throw Object.assign(new Error(reply.message), { code: reply.code || "EACLFAIL" });
23408
+ if (reply.timedOut) {
23409
+ throw aclFailure(targetPath, new Error("the Windows ACL bridge did not answer"), "Windows ACL helper");
23410
+ }
23411
+ }
23219
23412
  if (cachedUserSid === null) cachedUserSid = resolveCurrentUserPrincipal();
23220
23413
  const command = ownerOnlyAclCommand(targetPath, cachedUserSid, fresh, icacls);
23221
23414
  try {
@@ -23230,6 +23423,16 @@ function enforceOwnerOnlyAclWin32(targetPath, { fresh = false } = {}) {
23230
23423
  }
23231
23424
  async function enforceOwnerOnlyAclWin32Async(targetPath, { fresh = false } = {}) {
23232
23425
  if (process.platform !== "win32") return;
23426
+ const icacls = icaclsPath();
23427
+ if (cachedUserSid === null) cachedUserSid = await resolveCurrentUserPrincipalAsync();
23428
+ const reply = await askAclHelper(resolve3(targetPath), icacls, cachedUserSid);
23429
+ if (reply.status === "ok" || reply.status === "fixed") return;
23430
+ if (reply.status === "err") {
23431
+ throw aclFailure(targetPath, new Error(reply.detail || "unknown error"), "Windows ACL helper");
23432
+ }
23433
+ return applyOwnerOnlyAclAsync(targetPath, fresh);
23434
+ }
23435
+ async function applyOwnerOnlyAclAsync(targetPath, fresh) {
23233
23436
  const icacls = icaclsPath();
23234
23437
  if (cachedUserSid === null) cachedUserSid = await resolveCurrentUserPrincipalAsync();
23235
23438
  const command = ownerOnlyAclCommand(targetPath, cachedUserSid, fresh, icacls);
@@ -23239,11 +23442,20 @@ async function enforceOwnerOnlyAclWin32Async(targetPath, { fresh = false } = {})
23239
23442
  throw aclFailure(targetPath, error, command.label);
23240
23443
  }
23241
23444
  }
23242
- var execFileAsync, cachedUserSid, quoteForPowerShell;
23445
+ var cachedUserSid, ACL_HELPER_REQUEST_TIMEOUT_MS, ACL_HELPER_MAX_STARTS, ACL_HELPER_START_WINDOW_MS, aclHelper, aclHelperStartTimes, aclHelperSeq, ACL_SYNC_BRIDGE_READY_MS, ACL_SYNC_BRIDGE_TIMEOUT_MS, aclSyncBridge, aclSyncBridgeBroken, quoteForPowerShell;
23243
23446
  var init_file_permissions = __esm({
23244
23447
  "src/runtime/shared/file-permissions.mjs"() {
23245
- execFileAsync = promisify(execFile2);
23246
23448
  cachedUserSid = null;
23449
+ ACL_HELPER_REQUEST_TIMEOUT_MS = 15e3;
23450
+ ACL_HELPER_MAX_STARTS = 3;
23451
+ ACL_HELPER_START_WINDOW_MS = 10 * 6e4;
23452
+ aclHelper = null;
23453
+ aclHelperStartTimes = [];
23454
+ aclHelperSeq = 0;
23455
+ ACL_SYNC_BRIDGE_READY_MS = 1e4;
23456
+ ACL_SYNC_BRIDGE_TIMEOUT_MS = 2 * ACL_HELPER_REQUEST_TIMEOUT_MS + 5e3;
23457
+ aclSyncBridge = null;
23458
+ aclSyncBridgeBroken = false;
23247
23459
  quoteForPowerShell = (value) => `'${String(value).replaceAll("'", "''")}'`;
23248
23460
  }
23249
23461
  });
@@ -23274,7 +23486,7 @@ var init_keyed_serial_queue = __esm({
23274
23486
 
23275
23487
  // src/runtime/shared/sleep.mjs
23276
23488
  function sleep(ms) {
23277
- return new Promise((resolve6) => setTimeout(resolve6, ms));
23489
+ return new Promise((resolve7) => setTimeout(resolve7, ms));
23278
23490
  }
23279
23491
  function sleepSync(ms) {
23280
23492
  const buffer = new SharedArrayBuffer(4);
@@ -23671,14 +23883,15 @@ async function withOsFileLock(lockPath, fn, opts = {}, queueWaitMs = 0) {
23671
23883
  }
23672
23884
  }
23673
23885
  }
23674
- var LOCK_WAIT_CODES, DEFAULT_BACKOFFS_MS, configuredLockTimeoutMs, DEFAULT_LOCK_TIMEOUT_MS, OWNER_TOKEN, osHeldPaths, lockQueue, heldLockPaths, RECLAIM_GUARD_STALE_MS, LOCK_WAIT_WARN_MS, LOCK_WAIT_WARN_INTERVAL_MS, LOCK_HELD_WARN_MS, lockWaitWarnedAt, lockHeldWarnedAt, SYNC_IO, ASYNC_IO, STAGED_LOCK_FILE_STALE_MS, sweptLockPaths;
23886
+ var LOCK_WAIT_CODES, RETRY_MAX_MS, DEFAULT_BACKOFFS_MS, configuredLockTimeoutMs, DEFAULT_LOCK_TIMEOUT_MS, OWNER_TOKEN, osHeldPaths, lockQueue, heldLockPaths, RECLAIM_GUARD_STALE_MS, LOCK_WAIT_WARN_MS, LOCK_WAIT_WARN_INTERVAL_MS, LOCK_HELD_WARN_MS, lockWaitWarnedAt, lockHeldWarnedAt, SYNC_IO, ASYNC_IO, STAGED_LOCK_FILE_STALE_MS, sweptLockPaths;
23675
23887
  var init_file_lock = __esm({
23676
23888
  "src/runtime/shared/file-lock.mjs"() {
23677
23889
  init_file_permissions();
23678
23890
  init_keyed_serial_queue();
23679
23891
  init_sleep();
23680
23892
  LOCK_WAIT_CODES = /* @__PURE__ */ new Set(["EEXIST", "EPERM", "EACCES", "EBUSY"]);
23681
- DEFAULT_BACKOFFS_MS = Object.freeze([25, 50, 100, 200, 400, 800, 1200, 1600]);
23893
+ RETRY_MAX_MS = 200;
23894
+ DEFAULT_BACKOFFS_MS = Object.freeze([25, 50, 100, ...Array(20).fill(RETRY_MAX_MS)]);
23682
23895
  configuredLockTimeoutMs = Number(process.env.MIXDOG_LOCK_TIMEOUT_MS);
23683
23896
  DEFAULT_LOCK_TIMEOUT_MS = Number.isFinite(configuredLockTimeoutMs) && configuredLockTimeoutMs >= 0 ? configuredLockTimeoutMs : 2e3;
23684
23897
  OWNER_TOKEN = randomBytes2(12).toString("hex");
@@ -23765,8 +23978,8 @@ function _drainAdaptiveFileIo() {
23765
23978
  }
23766
23979
  }
23767
23980
  function _runAdaptiveFileIo(run) {
23768
- return new Promise((resolve6, reject) => {
23769
- _ioQueue.push({ run, resolve: resolve6, reject });
23981
+ return new Promise((resolve7, reject) => {
23982
+ _ioQueue.push({ run, resolve: resolve7, reject });
23770
23983
  _drainAdaptiveFileIo();
23771
23984
  });
23772
23985
  }
@@ -23777,21 +23990,22 @@ function nextRenameDelayMs(err, attempt, backoffs) {
23777
23990
  if (!RETRY_CODES.has(err?.code) || attempt >= backoffs.length) return null;
23778
23991
  return backoffs[attempt] + Math.floor(Math.random() * Math.min(50, Math.max(1, backoffs[attempt])));
23779
23992
  }
23993
+ function renameAttempt(src, dst, attempt, opts = {}) {
23994
+ try {
23995
+ renameSync3(src, dst);
23996
+ return null;
23997
+ } catch (err) {
23998
+ const delayMs = nextRenameDelayMs(err, attempt, renameBackoffs(opts));
23999
+ if (delayMs === null) throw err;
24000
+ return delayMs;
24001
+ }
24002
+ }
23780
24003
  function renameWithRetrySync(src, dst, opts = {}) {
23781
- const backoffs = renameBackoffs(opts);
23782
- let lastErr = null;
23783
- for (let attempt = 0; attempt <= backoffs.length; attempt++) {
23784
- try {
23785
- renameSync3(src, dst);
23786
- return true;
23787
- } catch (err) {
23788
- lastErr = err;
23789
- const delayMs = nextRenameDelayMs(err, attempt, backoffs);
23790
- if (delayMs === null) break;
23791
- sleepSync(delayMs);
23792
- }
24004
+ for (let attempt = 0; ; attempt++) {
24005
+ const delayMs = renameAttempt(src, dst, attempt, opts);
24006
+ if (delayMs === null) return true;
24007
+ sleepSync(delayMs);
23793
24008
  }
23794
- throw lastErr;
23795
24009
  }
23796
24010
  async function renameWithRetry(src, dst, opts = {}) {
23797
24011
  const backoffs = renameBackoffs(opts);
@@ -24160,7 +24374,7 @@ import {
24160
24374
  } from "node:fs";
24161
24375
  import { setTimeout as sleep2 } from "node:timers/promises";
24162
24376
  import { join as join14, dirname as dirname11 } from "node:path";
24163
- import { fileURLToPath as fileURLToPath3 } from "node:url";
24377
+ import { fileURLToPath as fileURLToPath4 } from "node:url";
24164
24378
  import { pipeline as pipeline2 } from "node:stream/promises";
24165
24379
  import { spawnSync } from "node:child_process";
24166
24380
  import { createGunzip } from "node:zlib";
@@ -24881,7 +25095,7 @@ var init_voice_runtime_fetcher = __esm({
24881
25095
  init_bounded_download();
24882
25096
  init_native_asset();
24883
25097
  init_windows_roots();
24884
- BUNDLED_MANIFEST_PATH = fileURLToPath3(new URL("../data/voice-runtime-manifest.json", import.meta.url));
25098
+ BUNDLED_MANIFEST_PATH = fileURLToPath4(new URL("../data/voice-runtime-manifest.json", import.meta.url));
24885
25099
  MANIFEST_URL = "https://raw.githubusercontent.com/tribgames/mixdog/main/src/runtime/channels/data/voice-runtime-manifest.json";
24886
25100
  LOCK_WAIT_CODES2 = /* @__PURE__ */ new Set(["EEXIST", "EPERM", "EACCES", "EBUSY"]);
24887
25101
  LOCK_MAX_AGE_MS = 30 * 60 * 1e3;
@@ -33876,8 +34090,8 @@ var App_default = App;
33876
34090
  var noop = () => {
33877
34091
  };
33878
34092
  var textEncoder = new TextEncoder();
33879
- var yieldImmediate = async () => new Promise((resolve6) => {
33880
- setImmediate(resolve6);
34093
+ var yieldImmediate = async () => new Promise((resolve7) => {
34094
+ setImmediate(resolve7);
33881
34095
  });
33882
34096
  var kittyQueryEscapeByte = 27;
33883
34097
  var kittyQueryOpenBracketByte = 91;
@@ -34132,8 +34346,8 @@ var Ink = class {
34132
34346
  };
34133
34347
  }
34134
34348
  this.initKittyKeyboard();
34135
- this.exitPromise = new Promise((resolve6, reject) => {
34136
- this.resolveExitPromise = resolve6;
34349
+ this.exitPromise = new Promise((resolve7, reject) => {
34350
+ this.resolveExitPromise = resolve7;
34137
34351
  this.rejectExitPromise = reject;
34138
34352
  });
34139
34353
  void this.exitPromise.catch(noop);
@@ -34573,9 +34787,9 @@ var Ink = class {
34573
34787
  settleThrottle(this.throttledOnRender, canWriteToStdout);
34574
34788
  settleThrottle(this.throttledLog, canWriteToStdout);
34575
34789
  if (canWriteToStdout && hasWritableState) {
34576
- await new Promise((resolve6) => {
34790
+ await new Promise((resolve7) => {
34577
34791
  this.options.stdout.write("", () => {
34578
- resolve6();
34792
+ resolve7();
34579
34793
  });
34580
34794
  });
34581
34795
  return;
@@ -34661,8 +34875,8 @@ var Ink = class {
34661
34875
  async awaitNextRender() {
34662
34876
  if (!this.nextRenderCommit) {
34663
34877
  let resolveRender;
34664
- const promise = new Promise((resolve6) => {
34665
- resolveRender = resolve6;
34878
+ const promise = new Promise((resolve7) => {
34879
+ resolveRender = resolve7;
34666
34880
  });
34667
34881
  this.nextRenderCommit = { promise, resolve: resolveRender };
34668
34882
  }
@@ -35133,12 +35347,12 @@ import { spawn } from "node:child_process";
35133
35347
  import path from "node:path";
35134
35348
  var DIALOG_TIMEOUT_MS = 5 * 60 * 1e3;
35135
35349
  function runCapture(cmd, args, { timeoutMs = DIALOG_TIMEOUT_MS } = {}) {
35136
- return new Promise((resolve6) => {
35350
+ return new Promise((resolve7) => {
35137
35351
  let child;
35138
35352
  try {
35139
35353
  child = spawn(cmd, args, { stdio: ["ignore", "pipe", "ignore"], windowsHide: true });
35140
35354
  } catch (error) {
35141
- resolve6({ ok: false, code: -1, stdout: "", error });
35355
+ resolve7({ ok: false, code: -1, stdout: "", error });
35142
35356
  return;
35143
35357
  }
35144
35358
  let stdout2 = "";
@@ -35150,7 +35364,7 @@ function runCapture(cmd, args, { timeoutMs = DIALOG_TIMEOUT_MS } = {}) {
35150
35364
  child.kill();
35151
35365
  } catch {
35152
35366
  }
35153
- resolve6({ ok: false, code: -1, stdout: "", error: new Error("dialog timed out") });
35367
+ resolve7({ ok: false, code: -1, stdout: "", error: new Error("dialog timed out") });
35154
35368
  }, timeoutMs);
35155
35369
  timer2.unref?.();
35156
35370
  child.stdout.on("data", (chunk) => {
@@ -35160,13 +35374,13 @@ function runCapture(cmd, args, { timeoutMs = DIALOG_TIMEOUT_MS } = {}) {
35160
35374
  if (settled) return;
35161
35375
  settled = true;
35162
35376
  clearTimeout(timer2);
35163
- resolve6({ ok: false, code: -1, stdout: "", error });
35377
+ resolve7({ ok: false, code: -1, stdout: "", error });
35164
35378
  });
35165
35379
  child.on("close", (code) => {
35166
35380
  if (settled) return;
35167
35381
  settled = true;
35168
35382
  clearTimeout(timer2);
35169
- resolve6({ ok: code === 0, code, stdout: stdout2 });
35383
+ resolve7({ ok: code === 0, code, stdout: stdout2 });
35170
35384
  });
35171
35385
  });
35172
35386
  }
@@ -35174,10 +35388,10 @@ function spawnFailed(result) {
35174
35388
  return !!result && result.code === -1;
35175
35389
  }
35176
35390
  function commandExists(cmd) {
35177
- return new Promise((resolve6) => {
35391
+ return new Promise((resolve7) => {
35178
35392
  const probe = process.platform === "win32" ? spawn("where", [cmd], { stdio: "ignore", windowsHide: true }) : spawn("which", [cmd], { stdio: "ignore" });
35179
- probe.on("error", () => resolve6(false));
35180
- probe.on("close", (code) => resolve6(code === 0));
35393
+ probe.on("error", () => resolve7(false));
35394
+ probe.on("close", (code) => resolve7(code === 0));
35181
35395
  });
35182
35396
  }
35183
35397
  function psSingleQuoted(value) {
@@ -38714,13 +38928,22 @@ function trimPendingTableHead(text) {
38714
38928
  for (const blank of text.matchAll(/\n[ \t]*\r?\n/g)) offset = blank.index + blank[0].length;
38715
38929
  const block = text.slice(offset);
38716
38930
  const lines = block.split("\n").map((line) => line.replace(/\r$/, ""));
38717
- if (lines.length === 0 || lines.length > 2 || !PIPE_ROW.test(lines[0])) return text;
38718
- if (lines.length === 2) {
38719
- const delimiter2 = lines[1];
38720
- if (!PARTIAL_DELIMITER_ROW.test(delimiter2)) return text;
38721
- if (DELIMITER_ROW.test(delimiter2) && tableCells(delimiter2) === tableCells(lines[0])) return text;
38722
- }
38723
- return text.slice(0, offset);
38931
+ let last = lines.length - 1;
38932
+ if (last >= 1 && !lines[last].trim()) last -= 1;
38933
+ let head = last;
38934
+ if (last >= 1 && PARTIAL_DELIMITER_ROW.test(lines[last]) && hasCellPipe(lines[last - 1])) {
38935
+ const delimiter2 = lines[last];
38936
+ if (DELIMITER_ROW.test(delimiter2) && tableCells(delimiter2) === tableCells(lines[last - 1])) return text;
38937
+ head = last - 1;
38938
+ }
38939
+ if (!(PIPE_ROW.test(lines[head]) || hasCellPipe(lines[head]))) return text;
38940
+ if (lines.slice(0, head).some((line) => DELIMITER_ROW.test(line))) return text;
38941
+ let start = offset;
38942
+ for (let index = 0; index < head; index += 1) start += lines[index].length + 1;
38943
+ return text.slice(0, start);
38944
+ }
38945
+ function hasCellPipe(line) {
38946
+ return /(?<!\\)\|/.test(line.replace(INLINE_CODE_SPAN, ""));
38724
38947
  }
38725
38948
  function healStreamingMarkdownTail(text, isPendingLocalPath) {
38726
38949
  const source = String(text ?? "");
@@ -45974,8 +46197,8 @@ var notifyRenderFrame = (seq) => {
45974
46197
  for (const ack of acks) ack(seq);
45975
46198
  };
45976
46199
  var yieldToRenderer = ({ frames = 1 } = {}) => {
45977
- if (!hasRenderFrameSource()) return new Promise((resolve6) => setImmediate(resolve6));
45978
- return new Promise((resolve6) => {
46200
+ if (!hasRenderFrameSource()) return new Promise((resolve7) => setImmediate(resolve7));
46201
+ return new Promise((resolve7) => {
45979
46202
  const minSeq = renderAckSeq;
45980
46203
  let remainingFrames = Math.max(1, Math.floor(Number(frames) || 1));
45981
46204
  let settled = false;
@@ -45990,7 +46213,7 @@ var yieldToRenderer = ({ frames = 1 } = {}) => {
45990
46213
  releaseClosedListener();
45991
46214
  const idx = pendingRenderAcks.indexOf(onFrame);
45992
46215
  if (idx !== -1) pendingRenderAcks.splice(idx, 1);
45993
- resolve6();
46216
+ resolve7();
45994
46217
  };
45995
46218
  releaseClosedListener = onRenderFrameSourcesClosed(finish);
45996
46219
  const onTimeout = () => {
@@ -46790,13 +47013,13 @@ function nativeClipboardCommand(text) {
46790
47013
  function copyToClipboard(text) {
46791
47014
  const value = String(text ?? "");
46792
47015
  const wroteOsc52 = writeOsc52Clipboard(value);
46793
- return new Promise((resolve6, reject) => {
47016
+ return new Promise((resolve7, reject) => {
46794
47017
  const { cmd, args, input } = nativeClipboardCommand(value);
46795
47018
  let child;
46796
47019
  try {
46797
47020
  child = spawn2(cmd, args, { stdio: ["pipe", "ignore", "ignore"], windowsHide: true });
46798
47021
  } catch (e) {
46799
- if (wroteOsc52) resolve6();
47022
+ if (wroteOsc52) resolve7();
46800
47023
  else reject(clipboardHelperError(cmd, e));
46801
47024
  return;
46802
47025
  }
@@ -46805,7 +47028,7 @@ function copyToClipboard(text) {
46805
47028
  });
46806
47029
  if (!wroteOsc52) {
46807
47030
  child.on("close", (code) => {
46808
- if (code === 0) resolve6();
47031
+ if (code === 0) resolve7();
46809
47032
  else reject(new Error(`${cmd} exited with code ${code}`));
46810
47033
  });
46811
47034
  }
@@ -46814,7 +47037,7 @@ function copyToClipboard(text) {
46814
47037
  child.stdin.end(input);
46815
47038
  if (wroteOsc52) {
46816
47039
  child.unref?.();
46817
- resolve6();
47040
+ resolve7();
46818
47041
  }
46819
47042
  });
46820
47043
  }
@@ -47118,7 +47341,7 @@ function mimeForPath(path2) {
47118
47341
  return IMAGE_MIME[extname(String(path2 || "")).toLowerCase()] || null;
47119
47342
  }
47120
47343
  function execFileBuffer(cmd, args, options = {}) {
47121
- return new Promise((resolve6) => {
47344
+ return new Promise((resolve7) => {
47122
47345
  execFile(
47123
47346
  cmd,
47124
47347
  args,
@@ -47130,7 +47353,7 @@ function execFileBuffer(cmd, args, options = {}) {
47130
47353
  ...options
47131
47354
  },
47132
47355
  (error, stdout2, stderr) => {
47133
- resolve6({ ok: !error, code: error?.code ?? 0, stdout: stdout2, stderr, error });
47356
+ resolve7({ ok: !error, code: error?.code ?? 0, stdout: stdout2, stderr, error });
47134
47357
  }
47135
47358
  );
47136
47359
  });
@@ -48526,7 +48749,7 @@ function completeOAuthCode(ctx, target, commandText) {
48526
48749
  }
48527
48750
  oauthSubmitRef.current = true;
48528
48751
  setProviderPrompt((prompt) => prompt === target ? { ...prompt, submitting: true } : prompt);
48529
- const completion = typeof target.login?.completeCode === "function" ? new Promise((resolve6) => resolve6(target.login.completeCode(commandText))) : Promise.reject(new Error("OAuth login is no longer active"));
48752
+ const completion = typeof target.login?.completeCode === "function" ? new Promise((resolve7) => resolve7(target.login.completeCode(commandText))) : Promise.reject(new Error("OAuth login is no longer active"));
48530
48753
  void completion.then(() => {
48531
48754
  const successReturn = target.successReturn;
48532
48755
  const afterSave = target.afterSave;
@@ -49740,11 +49963,11 @@ init_atomic_file();
49740
49963
  init_json_file();
49741
49964
  import { existsSync as existsSync6, readFileSync as readFileSync6, realpathSync } from "node:fs";
49742
49965
  import { basename as basename4, delimiter, dirname as dirname6, join as join6 } from "node:path";
49743
- import { fileURLToPath as fileURLToPath2 } from "node:url";
49966
+ import { fileURLToPath as fileURLToPath3 } from "node:url";
49744
49967
  var PACKAGE_NAME = "mixdog";
49745
49968
  var REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}/latest`;
49746
49969
  var CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
49747
- var _MODULE_DIR = dirname6(fileURLToPath2(import.meta.url));
49970
+ var _MODULE_DIR = dirname6(fileURLToPath3(import.meta.url));
49748
49971
  var _PACKAGE_JSON_PATH = join6(_MODULE_DIR, "..", "..", "..", "package.json");
49749
49972
  var _PACKAGE_ROOT = dirname6(_PACKAGE_JSON_PATH);
49750
49973
  var _localVersionCache = null;
@@ -50730,7 +50953,17 @@ var PROVIDER_CATALOGS = Object.freeze({
50730
50953
  },
50731
50954
  "cursor-oauth": { relay: true },
50732
50955
  "cursor-api": { relay: true },
50733
- "opencode-go": { relay: true }
50956
+ // The models.dev listing id of the Go gateway: a relay catalog, not a
50957
+ // selectable provider (the model lookup needs it flagged as a relay).
50958
+ "opencode-go": { relay: true },
50959
+ // The Go gateway through an OpenCode Console login; the organization
50960
+ // config's catalog is the live roster.
50961
+ "opencode-go-oauth": {
50962
+ modelsDev: "opencode-go",
50963
+ relay: true,
50964
+ rosterFiles: ["opencode-go-oauth-models.json"],
50965
+ rosterLimitsAuthoritative: true
50966
+ }
50734
50967
  });
50735
50968
  var VERIFIED_CORRECTIONS = Object.freeze({
50736
50969
  "muse-code-oauth": Object.freeze({
@@ -51090,11 +51323,11 @@ function isPidAlive(value) {
51090
51323
 
51091
51324
  // src/runtime/shared/worktrees/git-head.mjs
51092
51325
  import { readFileSync as readFileSync9, statSync as statSync2, watch } from "node:fs";
51093
- import { dirname as dirname8, resolve as resolve4 } from "node:path";
51326
+ import { dirname as dirname8, resolve as resolve5 } from "node:path";
51094
51327
 
51095
51328
  // src/runtime/shared/worktrees/paths.mjs
51096
51329
  import { existsSync as existsSync9, realpathSync as realpathSync2 } from "node:fs";
51097
- import { dirname as dirname7, isAbsolute as isAbsolute2, join as join9, relative, resolve as resolve3, sep } from "node:path";
51330
+ import { dirname as dirname7, isAbsolute as isAbsolute2, join as join9, relative, resolve as resolve4, sep } from "node:path";
51098
51331
 
51099
51332
  // src/runtime/shared/statusline/statusline-segments.mjs
51100
51333
  var DEFAULT_MIXDOG_HOME = process.env.MIXDOG_HOME || join10(homedir2(), ".mixdog");
@@ -55639,7 +55872,7 @@ function renderToolApproval({ toolApproval, store, frameColumns, expandedOptionP
55639
55872
  toolApproval.id
55640
55873
  );
55641
55874
  }
55642
- const resolve6 = (approved) => {
55875
+ const resolve7 = (approved) => {
55643
55876
  store.resolveToolApproval?.(toolApproval.id, {
55644
55877
  approved,
55645
55878
  reason: approved ? "approved by user" : "denied by user"
@@ -55664,12 +55897,12 @@ function renderToolApproval({ toolApproval, store, frameColumns, expandedOptionP
55664
55897
  description: "run this tool call"
55665
55898
  }
55666
55899
  ],
55667
- onSelect: (value) => resolve6(value === "approve"),
55668
- onCancel: () => resolve6(false),
55900
+ onSelect: (value) => resolve7(value === "approve"),
55901
+ onCancel: () => resolve7(false),
55669
55902
  onKey: (input) => {
55670
55903
  const value = String(input || "").trim().toLowerCase();
55671
- if (value === "a" || value === "y") resolve6(true);
55672
- else if (value === "d" || value === "n") resolve6(false);
55904
+ if (value === "a" || value === "y") resolve7(true);
55905
+ else if (value === "d" || value === "n") resolve7(false);
55673
55906
  },
55674
55907
  title: "Tool approval",
55675
55908
  description: toolApprovalDescription(toolApproval),
@@ -59049,7 +59282,7 @@ var PROVIDER_DISPLAY_NAMES = /* @__PURE__ */ new Map([
59049
59282
  ["xai-api", "xAI API"],
59050
59283
  ["deepseek", "DeepSeek API"],
59051
59284
  ["deepseek-api", "DeepSeek API"],
59052
- ["opencode-go", "OpenCode Go API"],
59285
+ ["opencode-go-oauth", "OpenCode Go OAuth"],
59053
59286
  ["openrouter", "OpenRouter"],
59054
59287
  ["mixdog-local", "Local Provider"],
59055
59288
  ["default", "Default"]
@@ -59076,6 +59309,33 @@ var loadProviderDisplayNames = async (store) => {
59076
59309
  }
59077
59310
  return names;
59078
59311
  };
59312
+ var loadProviderCatalogFailures = async (store) => {
59313
+ let setup = null;
59314
+ try {
59315
+ setup = await store?.getProviderSetup?.();
59316
+ } catch {
59317
+ return [];
59318
+ }
59319
+ const failures = [];
59320
+ for (const group of ["api", "oauth", "local"]) {
59321
+ for (const entry of Array.isArray(setup?.[group]) ? setup[group] : []) {
59322
+ const failure = entry?.catalogError;
59323
+ if (!failure?.message) continue;
59324
+ const { summary, recovery } = describeError({ message: failure.message, errorKind: failure.errorKind });
59325
+ failures.push({ id: String(entry.id || "").trim(), text: [summary, recovery].filter(Boolean).join(" ") });
59326
+ }
59327
+ }
59328
+ return failures;
59329
+ };
59330
+ var buildCatalogFailureItems = (failures, models, providerNames = null) => failures.filter(({ id }) => id && !models.some((model) => model.provider === id)).map(({ id, text }) => ({
59331
+ value: `provider-failed:${id}`,
59332
+ label: resolveProviderDisplayName(id, providerNames),
59333
+ marker: "!",
59334
+ markerColor: theme.error,
59335
+ description: text,
59336
+ _action: "catalog-failed",
59337
+ _failure: text
59338
+ }));
59079
59339
  var PROVIDER_DISPLAY_RANKS = {
59080
59340
  default: 0,
59081
59341
  "openai-oauth": 10,
@@ -59086,7 +59346,7 @@ var PROVIDER_DISPLAY_RANKS = {
59086
59346
  "mimo-oauth": 34,
59087
59347
  "antigravity-oauth": 31,
59088
59348
  "cursor-oauth": 32,
59089
- "opencode-go": 35,
59349
+ "opencode-go-oauth": 34.5,
59090
59350
  openai: 40,
59091
59351
  "openai-api": 40,
59092
59352
  anthropic: 50,
@@ -59551,7 +59811,7 @@ function createOnboardingSteps({
59551
59811
  }
59552
59812
 
59553
59813
  // src/runtime/shared/open-url.mjs
59554
- import { spawn as spawn3 } from "node:child_process";
59814
+ import { spawn as spawn4 } from "node:child_process";
59555
59815
 
59556
59816
  // src/runtime/shared/wsl.mjs
59557
59817
  import { readFileSync as readFileSync10 } from "node:fs";
@@ -59609,7 +59869,7 @@ function tryOpenCandidates(candidates, index) {
59609
59869
  if (index >= candidates.length) return;
59610
59870
  const [cmd, args] = candidates[index];
59611
59871
  try {
59612
- const child = spawn3(cmd, args, { stdio: "ignore", ...detachedSpawnOpts });
59872
+ const child = spawn4(cmd, args, { stdio: "ignore", ...detachedSpawnOpts });
59613
59873
  child.on("error", () => {
59614
59874
  tryOpenCandidates(candidates, index + 1);
59615
59875
  });
@@ -60013,7 +60273,7 @@ function createProviderSetupPicker({
60013
60273
  }
60014
60274
  });
60015
60275
  try {
60016
- await new Promise((resolve6) => setTimeout(resolve6, 0));
60276
+ await new Promise((resolve7) => setTimeout(resolve7, 0));
60017
60277
  return await store.getProviderSetup(options.forceRefresh ? { force: true } : void 0);
60018
60278
  } catch (e) {
60019
60279
  store.pushNotice(`providers failed: ${e?.message || e}`, "error");
@@ -60135,7 +60395,7 @@ function createModelCatalog({ store, providerModelsCacheRef, webSearchModelsCach
60135
60395
  let renderedQuickModels = false;
60136
60396
  if (!providerModels.length || options.refreshModels === true) {
60137
60397
  paintLoading();
60138
- await new Promise((resolve6) => setTimeout(resolve6, 0));
60398
+ await new Promise((resolve7) => setTimeout(resolve7, 0));
60139
60399
  try {
60140
60400
  if (options.refreshModels !== true && options.cacheRef !== "webSearch") {
60141
60401
  refreshModelsPromise = Promise.resolve(loadModels({ force: false }));
@@ -60642,6 +60902,7 @@ function createModelPicker({
60642
60902
  }
60643
60903
  const models = normalizeModelOptions(providerModels);
60644
60904
  const providerNames = await loadProviderDisplayNames(store);
60905
+ const catalogFailures = await loadProviderCatalogFailures(store);
60645
60906
  const activeRoute = options.currentRoute || {
60646
60907
  provider: state.provider,
60647
60908
  model: state.model,
@@ -60679,7 +60940,10 @@ function createModelPicker({
60679
60940
  providerListHighlightProvider = renderOptions.highlightProvider;
60680
60941
  }
60681
60942
  const highlightProvider = renderOptions.highlightProvider || providerListHighlightProvider || null;
60682
- const providerItems = buildModelProviderItems(models, activeRoute, providerNames);
60943
+ const providerItems = [
60944
+ ...buildModelProviderItems(models, activeRoute, providerNames),
60945
+ ...buildCatalogFailureItems(catalogFailures, models, providerNames)
60946
+ ];
60683
60947
  const providerHighlight = highlightProvider || activeRoute?.provider || null;
60684
60948
  const providerInitialIndex = Math.max(
60685
60949
  0,
@@ -60696,6 +60960,10 @@ function createModelPicker({
60696
60960
  pickerKey: `model-picker:providers:${providerHighlight || "default"}`,
60697
60961
  items: providerItems,
60698
60962
  onSelect: (_value, item) => {
60963
+ if (item?._failure) {
60964
+ store.pushNotice(`${item.label}: ${item._failure}`, "warn");
60965
+ return;
60966
+ }
60699
60967
  if (!item?._provider) return;
60700
60968
  openProviderModelsPicker({
60701
60969
  view,
@@ -61169,7 +61437,7 @@ import {
61169
61437
  rm as rmP,
61170
61438
  stat as statP
61171
61439
  } from "node:fs/promises";
61172
- import { basename as basename5, dirname as dirname9, join as join11, resolve as resolve5 } from "node:path";
61440
+ import { basename as basename5, dirname as dirname9, join as join11, resolve as resolve6 } from "node:path";
61173
61441
  import { homedir as homedir3 } from "node:os";
61174
61442
  import { createHash as createHash4, randomUUID } from "node:crypto";
61175
61443
  function getBackupRoot() {
@@ -61181,15 +61449,28 @@ var BACKUP_MANIFEST = "backup.json";
61181
61449
  var INIT_MARKER = ".mixdog-user-data.json";
61182
61450
  var SCOPE_PREFIX = "scope-";
61183
61451
  function normalizeDataDir(dataDir2) {
61184
- const full = resolve5(String(dataDir2));
61452
+ const full = resolve6(String(dataDir2));
61185
61453
  return process.platform === "win32" ? full.toLowerCase() : full;
61186
61454
  }
61187
61455
  function scopeDirFor(dataDir2) {
61188
61456
  const id = createHash4("sha256").update(normalizeDataDir(dataDir2)).digest("hex").slice(0, 16);
61189
61457
  return join11(getBackupRoot(), `${SCOPE_PREFIX}${id}`);
61190
61458
  }
61191
- function stamp() {
61192
- return (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
61459
+ var lastBackupMs = 0;
61460
+ var backupSeq = 0;
61461
+ function reserveBackupDir(scopeDir, reason) {
61462
+ mkdirSync4(scopeDir, { recursive: true });
61463
+ for (; ; ) {
61464
+ lastBackupMs = Math.max(Date.now(), lastBackupMs);
61465
+ const time = new Date(lastBackupMs).toISOString().replace(/[:.]/g, "-");
61466
+ const backupDir = join11(scopeDir, `${time}-${String(backupSeq++).padStart(10, "0")}-${safeReason(reason)}`);
61467
+ try {
61468
+ mkdirSync4(backupDir);
61469
+ return backupDir;
61470
+ } catch (error) {
61471
+ if (error?.code !== "EEXIST") throw error;
61472
+ }
61473
+ }
61193
61474
  }
61194
61475
  function safeReason(reason) {
61195
61476
  return String(reason || "snapshot").replace(/[^a-z0-9_.-]+/gi, "-").slice(0, 48) || "snapshot";
@@ -61221,7 +61502,7 @@ function manifestDataDirMatches(backupDir, dataDirKey) {
61221
61502
  }
61222
61503
  function legacyMarkersFor(root, dataDir2, dataDirKey) {
61223
61504
  const hashed = new Set(
61224
- [String(dataDir2), resolve5(String(dataDir2))].map(
61505
+ [String(dataDir2), resolve6(String(dataDir2))].map(
61225
61506
  (value) => `.initialized-${createHash4("sha256").update(value).digest("hex").slice(0, 16)}.json`
61226
61507
  )
61227
61508
  );
@@ -61360,7 +61641,7 @@ function markUserDataInitialized(dataDir2) {
61360
61641
  writeFileSync4(
61361
61642
  join11(dataDir2, INIT_MARKER),
61362
61643
  `${JSON.stringify(
61363
- { instanceId: randomUUID(), dataDir: resolve5(dataDir2), createdAt: (/* @__PURE__ */ new Date()).toISOString() },
61644
+ { instanceId: randomUUID(), dataDir: resolve6(dataDir2), createdAt: (/* @__PURE__ */ new Date()).toISOString() },
61364
61645
  null,
61365
61646
  2
61366
61647
  )}
@@ -61383,16 +61664,12 @@ function ensureUserDataInitialized(dataDir2) {
61383
61664
  function skipBackups() {
61384
61665
  return process.env.MIXDOG_SKIP_USER_DATA_BACKUP === "1" || process.env.MIXDOG_SKIP_USER_DATA_BACKUP === "true";
61385
61666
  }
61386
- function backupTarget(dataDir2, reason) {
61387
- const scopeDir = scopeDirFor(dataDir2);
61388
- return { scopeDir, backupDir: join11(scopeDir, `${stamp()}-${safeReason(reason)}`) };
61389
- }
61390
61667
  function finishBackup(dataDir2, backupDir, reason) {
61391
61668
  const instanceId = markUserDataInitialized(dataDir2);
61392
61669
  writeFileSync4(
61393
61670
  join11(backupDir, BACKUP_MANIFEST),
61394
61671
  `${JSON.stringify(
61395
- { dataDir: resolve5(dataDir2), instanceId, reason, createdAt: (/* @__PURE__ */ new Date()).toISOString() },
61672
+ { dataDir: resolve6(dataDir2), instanceId, reason, createdAt: (/* @__PURE__ */ new Date()).toISOString() },
61396
61673
  null,
61397
61674
  2
61398
61675
  )}
@@ -61405,7 +61682,8 @@ function finishBackup(dataDir2, backupDir, reason) {
61405
61682
  function backupUserData(dataDir2, reason = "snapshot") {
61406
61683
  if (skipBackups()) return { dir: null, copied: [] };
61407
61684
  if (!dataDir2 || !existsSync10(dataDir2)) return { dir: null, copied: [] };
61408
- const { scopeDir, backupDir } = backupTarget(dataDir2, reason);
61685
+ const scopeDir = scopeDirFor(dataDir2);
61686
+ const backupDir = reserveBackupDir(scopeDir, reason);
61409
61687
  const copied = [];
61410
61688
  for (const rel of USER_DATA_FILES) {
61411
61689
  const src = join11(dataDir2, rel);
@@ -61422,6 +61700,8 @@ function backupUserData(dataDir2, reason = "snapshot") {
61422
61700
  process.stderr.write(`[user-data-backup] ${reason}: copied ${copied.length} file(s) to ${backupDir}
61423
61701
  `);
61424
61702
  }
61703
+ } else {
61704
+ rmSync(backupDir, { recursive: true, force: true });
61425
61705
  }
61426
61706
  return { dir: copied.length > 0 ? backupDir : null, copied };
61427
61707
  }
@@ -61455,7 +61735,8 @@ async function pruneBackupsAsync(scopeDir, keep = 40) {
61455
61735
  async function backupUserDataAsync(dataDir2, reason = "snapshot") {
61456
61736
  if (skipBackups()) return { dir: null, copied: [] };
61457
61737
  if (!dataDir2 || !existsSync10(dataDir2)) return { dir: null, copied: [] };
61458
- const { scopeDir, backupDir } = backupTarget(dataDir2, reason);
61738
+ const scopeDir = scopeDirFor(dataDir2);
61739
+ const backupDir = reserveBackupDir(scopeDir, reason);
61459
61740
  const copied = [];
61460
61741
  for (const rel of USER_DATA_FILES) {
61461
61742
  const src = join11(dataDir2, rel);
@@ -61472,6 +61753,8 @@ async function backupUserDataAsync(dataDir2, reason = "snapshot") {
61472
61753
  process.stderr.write(`[user-data-backup] ${reason}: copied ${copied.length} file(s) to ${backupDir}
61473
61754
  `);
61474
61755
  }
61756
+ } else {
61757
+ rmSync(backupDir, { recursive: true, force: true });
61475
61758
  }
61476
61759
  return { dir: copied.length > 0 ? backupDir : null, copied };
61477
61760
  }
@@ -61486,7 +61769,6 @@ var AGENT_PROVIDER_ENV = Object.freeze({
61486
61769
  gemini: "GEMINI_API_KEY",
61487
61770
  deepseek: "DEEPSEEK_API_KEY",
61488
61771
  xai: "XAI_API_KEY",
61489
- "opencode-go": "OPENCODE_API_KEY",
61490
61772
  openrouter: "OPENROUTER_API_KEY"
61491
61773
  });
61492
61774
  var AGENT_PROVIDER_ENV_ALIASES = Object.freeze({
@@ -61828,8 +62110,7 @@ function updateSectionAsync(section, updater) {
61828
62110
  }
61829
62111
  var SECRET_ACCOUNTS = Object.freeze({
61830
62112
  agentApiKey: (provider) => `agent.${provider}.apiKey`,
61831
- openaiUsageSessionKey: "agent.openai.usageSessionKey",
61832
- opencodeGoConsoleKey: "agent.opencode-go.consoleKey"
62113
+ openaiUsageSessionKey: "agent.openai.usageSessionKey"
61833
62114
  });
61834
62115
 
61835
62116
  // src/runtime/channels/lib/voice-setup.mjs
@@ -63282,8 +63563,8 @@ function usePromptQueueHistory({
63282
63563
  let timer2 = null;
63283
63564
  Promise.race([
63284
63565
  Promise.resolve(store.dispose?.("cli-react-exit", { detach: true })),
63285
- new Promise((resolve6) => {
63286
- timer2 = setTimeout(resolve6, 350);
63566
+ new Promise((resolve7) => {
63567
+ timer2 = setTimeout(resolve7, 350);
63287
63568
  })
63288
63569
  ]).finally(() => {
63289
63570
  if (timer2) clearTimeout(timer2);
@@ -63490,7 +63771,7 @@ import { useCallback as useCallback21, useEffect as useEffect27, useLayoutEffect
63490
63771
  // src/tui/session/transcript-spill.mjs
63491
63772
  import { readFileSync as readFileSync16 } from "node:fs";
63492
63773
  import { join as join16 } from "node:path";
63493
- import { Worker } from "node:worker_threads";
63774
+ import { Worker as Worker2 } from "node:worker_threads";
63494
63775
 
63495
63776
  // src/tui/session/transcript-spill/spill-dir.mjs
63496
63777
  import { randomUUID as randomUUID2 } from "node:crypto";
@@ -65870,8 +66151,8 @@ function waitWithTimeout(promise, ms) {
65870
66151
  let timer2 = null;
65871
66152
  return Promise.race([
65872
66153
  Promise.resolve(promise).then(() => true),
65873
- new Promise((resolve6) => {
65874
- timer2 = setTimeout(() => resolve6(false), ms);
66154
+ new Promise((resolve7) => {
66155
+ timer2 = setTimeout(() => resolve7(false), ms);
65875
66156
  })
65876
66157
  ]).finally(() => {
65877
66158
  if (timer2) clearTimeout(timer2);