mixdog 1.2.4 → 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 (292) 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/mobile-release.mjs +5 -4
  5. package/scripts/provider-pingpong-live.mjs +9 -9
  6. package/src/agents/advisor/AGENT.md +4 -4
  7. package/src/agents/advisor/agent.json +1 -1
  8. package/src/agents/reviewer/AGENT.md +2 -3
  9. package/src/agents/reviewer/agent.json +1 -1
  10. package/src/defaults/shipped-history.json +11 -0
  11. package/src/defaults/skills/browser-use/SKILL.md +2 -1
  12. package/src/defaults/skills/computer-use/SKILL.md +3 -1
  13. package/src/defaults/skills/visualize/SKILL.md +3 -2
  14. package/src/lib/rules-builder.cjs +1 -1
  15. package/src/output-styles/common.md +22 -5
  16. package/src/output-styles/detailed.md +7 -5
  17. package/src/output-styles/minimal.md +7 -3
  18. package/src/output-styles/simple.md +2 -3
  19. package/src/rules/agent/AGENT.md +3 -1
  20. package/src/rules/lead/LEAD.md +10 -7
  21. package/src/rules/shared/10-tool-workflow.md +2 -1
  22. package/src/rules/shared/60-verification.md +4 -5
  23. package/src/runtime/agent/orchestrator/agent-runtime/cache-strategy.mjs +2 -1
  24. package/src/runtime/agent/orchestrator/config.mjs +6 -0
  25. package/src/runtime/agent/orchestrator/context/skill-catalog.mjs +1 -1
  26. package/src/runtime/agent/orchestrator/internal-agents.mjs +10 -0
  27. package/src/runtime/agent/orchestrator/mcp/child-tree.mjs +53 -60
  28. package/src/runtime/agent/orchestrator/mcp/client.mjs +7 -4
  29. package/src/runtime/agent/orchestrator/mcp/oauth-callback.mjs +2 -3
  30. package/src/runtime/agent/orchestrator/providers/account-pool.mjs +9 -2
  31. package/src/runtime/agent/orchestrator/providers/anthropic-oauth-credentials.mjs +40 -19
  32. package/src/runtime/agent/orchestrator/providers/anthropic-oauth.mjs +3 -2
  33. package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn/turn-events/content-block-start.mjs +4 -1
  34. package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn/turn-events.mjs +2 -0
  35. package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn.mjs +3 -0
  36. package/src/runtime/agent/orchestrator/providers/anthropic-sse.mjs +2 -1
  37. package/src/runtime/agent/orchestrator/providers/anthropic.mjs +3 -1
  38. package/src/runtime/agent/orchestrator/providers/antigravity-oauth-login.mjs +1 -2
  39. package/src/runtime/agent/orchestrator/providers/catalog-deadline.mjs +163 -0
  40. package/src/runtime/agent/orchestrator/providers/catalog-failures.mjs +34 -0
  41. package/src/runtime/agent/orchestrator/providers/grok-oauth-login.mjs +38 -14
  42. package/src/runtime/agent/orchestrator/providers/lib/oauth-page.mjs +100 -26
  43. package/src/runtime/agent/orchestrator/providers/lib/send-callbacks.mjs +24 -0
  44. package/src/runtime/agent/orchestrator/providers/oauth-credential-probes.mjs +13 -0
  45. package/src/runtime/agent/orchestrator/providers/oauth-usage.mjs +2 -1
  46. package/src/runtime/agent/orchestrator/providers/openai-compat-chat-send.mjs +1 -0
  47. package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream/chunk-events.mjs +4 -0
  48. package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream/stream-state.mjs +3 -1
  49. package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream.mjs +2 -0
  50. package/src/runtime/agent/orchestrator/providers/openai-compat-models.mjs +49 -4
  51. package/src/runtime/agent/orchestrator/providers/openai-compat-presets.mjs +0 -7
  52. package/src/runtime/agent/orchestrator/providers/openai-compat-responses-events.mjs +7 -1
  53. package/src/runtime/agent/orchestrator/providers/openai-compat-responses.mjs +1 -0
  54. package/src/runtime/agent/orchestrator/providers/openai-compat-stream.mjs +2 -0
  55. package/src/runtime/agent/orchestrator/providers/openai-compat-xai-send.mjs +1 -0
  56. package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-events.mjs +5 -1
  57. package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state.mjs +11 -2
  58. package/src/runtime/agent/orchestrator/providers/openai-oauth-http-sse.mjs +1 -0
  59. package/src/runtime/agent/orchestrator/providers/openai-oauth-login.mjs +45 -16
  60. package/src/runtime/agent/orchestrator/providers/openai-oauth-ws.mjs +1 -0
  61. package/src/runtime/agent/orchestrator/providers/openai-ws-connect.mjs +196 -0
  62. package/src/runtime/agent/orchestrator/providers/openai-ws-pool.mjs +74 -9
  63. package/src/runtime/agent/orchestrator/providers/openai-ws-stream/event-switch.mjs +14 -1
  64. package/src/runtime/agent/orchestrator/providers/openai-ws-stream.mjs +2 -0
  65. package/src/runtime/agent/orchestrator/providers/opencode-go-oauth-login.mjs +194 -0
  66. package/src/runtime/agent/orchestrator/providers/opencode-go-oauth-tokens.mjs +353 -0
  67. package/src/runtime/agent/orchestrator/providers/opencode-go-oauth.mjs +293 -0
  68. package/src/runtime/agent/orchestrator/providers/opencode-go-usage.mjs +33 -100
  69. package/src/runtime/agent/orchestrator/providers/opencode-go.mjs +23 -14
  70. package/src/runtime/agent/orchestrator/providers/registry.mjs +41 -27
  71. package/src/runtime/agent/orchestrator/runtime-core/ask-user-tool-defs.mjs +2 -3
  72. package/src/runtime/agent/orchestrator/runtime-core/orchestration.mjs +3 -8
  73. package/src/runtime/agent/orchestrator/session/agent-pool-progress.mjs +15 -3
  74. package/src/runtime/agent/orchestrator/session/compact/execution-tail.mjs +74 -13
  75. package/src/runtime/agent/orchestrator/session/compact/forked-summary.mjs +102 -0
  76. package/src/runtime/agent/orchestrator/session/compact/runner.mjs +8 -2
  77. package/src/runtime/agent/orchestrator/session/compact/summary.mjs +16 -0
  78. package/src/runtime/agent/orchestrator/session/lifecycle-scan.mjs +9 -0
  79. package/src/runtime/agent/orchestrator/session/loop/fresh-context.mjs +39 -2
  80. package/src/runtime/agent/orchestrator/session/loop/tool-exec/before-hook.mjs +9 -19
  81. package/src/runtime/agent/orchestrator/session/loop/tool-exec.mjs +2 -3
  82. package/src/runtime/agent/orchestrator/session/manager/ask-turn-loop-options.mjs +3 -0
  83. package/src/runtime/agent/orchestrator/session/manager/ask-turn-steering-drain.mjs +13 -5
  84. package/src/runtime/agent/orchestrator/session/manager/pending-message-entry.mjs +10 -7
  85. package/src/runtime/agent/orchestrator/session/manager/pending-messages.mjs +62 -22
  86. package/src/runtime/agent/orchestrator/session/manager/runtime-liveness.mjs +23 -1
  87. package/src/runtime/agent/orchestrator/session/manager/session-close.mjs +81 -34
  88. package/src/runtime/agent/orchestrator/session/manager.mjs +2 -2
  89. package/src/runtime/agent/orchestrator/session/request-fork.mjs +47 -0
  90. package/src/runtime/agent/orchestrator/session/side-question-store.mjs +16 -1
  91. package/src/runtime/agent/orchestrator/session/side-question.mjs +5 -43
  92. package/src/runtime/agent/orchestrator/session/store/fs-probe.mjs +10 -0
  93. package/src/runtime/agent/orchestrator/session/store/lifecycle-barriers.mjs +73 -6
  94. package/src/runtime/agent/orchestrator/session/store/load-session.mjs +40 -0
  95. package/src/runtime/agent/orchestrator/session/store/save-fault.mjs +15 -0
  96. package/src/runtime/agent/orchestrator/session/store/session-paths.mjs +12 -0
  97. package/src/runtime/agent/orchestrator/session/store-agent-worker-header.mjs +36 -0
  98. package/src/runtime/agent/orchestrator/session/store-agent-worker-rows.mjs +255 -32
  99. package/src/runtime/agent/orchestrator/session/store-record-strict-scan.mjs +306 -0
  100. package/src/runtime/agent/orchestrator/session/store-summary-catalog.mjs +70 -21
  101. package/src/runtime/agent/orchestrator/session/store-summary-reader.mjs +46 -30
  102. package/src/runtime/agent/orchestrator/session/store-transcript-cache.mjs +144 -45
  103. package/src/runtime/agent/orchestrator/session/store-transcript-projection.mjs +32 -13
  104. package/src/runtime/agent/orchestrator/session/store-transcript-worker.mjs +364 -38
  105. package/src/runtime/agent/orchestrator/session/store.mjs +9 -2
  106. package/src/runtime/agent/orchestrator/session/task-wait-control.mjs +43 -12
  107. package/src/runtime/agent/orchestrator/session/tool-result-offload.mjs +23 -6
  108. package/src/runtime/agent/orchestrator/tools/builtin/arg-guard.mjs +12 -6
  109. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/backgrounded-result.mjs +13 -7
  110. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/bashism-rewrite.mjs +1 -1
  111. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/benign-exit.mjs +7 -1
  112. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/completed-result.mjs +40 -7
  113. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/deadline-plan.mjs +37 -34
  114. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/inline-hoist.mjs +1 -1
  115. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/spawn-env.mjs +0 -4
  116. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool.mjs +6 -0
  117. package/src/runtime/agent/orchestrator/tools/builtin/builtin-tools.mjs +29 -27
  118. package/src/runtime/agent/orchestrator/tools/builtin/external-tool-adapters.mjs +1 -1
  119. package/src/runtime/agent/orchestrator/tools/builtin/find-files-tool.mjs +28 -11
  120. package/src/runtime/agent/orchestrator/tools/builtin/git-command-policy.mjs +12 -3
  121. package/src/runtime/agent/orchestrator/tools/builtin/git-command-tool.mjs +203 -101
  122. package/src/runtime/agent/orchestrator/tools/builtin/git-repo-rw-lock.mjs +90 -41
  123. package/src/runtime/agent/orchestrator/tools/builtin/lib/list-helpers.mjs +17 -1
  124. package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-delivery.mjs +199 -0
  125. package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-task-output.mjs +165 -39
  126. package/src/runtime/agent/orchestrator/tools/builtin/list-tool.mjs +25 -13
  127. package/src/runtime/agent/orchestrator/tools/builtin/read-batch.mjs +7 -6
  128. package/src/runtime/agent/orchestrator/tools/builtin/read-formatting.mjs +19 -4
  129. package/src/runtime/agent/orchestrator/tools/builtin/read-line-collector.mjs +5 -3
  130. package/src/runtime/agent/orchestrator/tools/builtin/read-single-render.mjs +25 -7
  131. package/src/runtime/agent/orchestrator/tools/builtin/read-special-files.mjs +2 -1
  132. package/src/runtime/agent/orchestrator/tools/builtin/read-tool/batch-render.mjs +3 -1
  133. package/src/runtime/agent/orchestrator/tools/builtin/search-glob-tool.mjs +12 -5
  134. package/src/runtime/agent/orchestrator/tools/builtin/search-grep-tool.mjs +61 -22
  135. package/src/runtime/agent/orchestrator/tools/builtin/search-path-diagnostics.mjs +32 -8
  136. package/src/runtime/agent/orchestrator/tools/builtin/shell-analysis.mjs +193 -19
  137. package/src/runtime/agent/orchestrator/tools/builtin/shell-direct-exe.mjs +57 -7
  138. package/src/runtime/agent/orchestrator/tools/builtin/shell-jobs.mjs +119 -32
  139. package/src/runtime/agent/orchestrator/tools/builtin/shell-lossless-compact.mjs +26 -1
  140. package/src/runtime/agent/orchestrator/tools/builtin/shell-output.mjs +13 -28
  141. package/src/runtime/agent/orchestrator/tools/builtin/task-tool.mjs +90 -11
  142. package/src/runtime/agent/orchestrator/tools/builtin/wait-budgets.mjs +23 -0
  143. package/src/runtime/agent/orchestrator/tools/builtin.mjs +54 -10
  144. package/src/runtime/agent/orchestrator/tools/code-graph/build.mjs +22 -28
  145. package/src/runtime/agent/orchestrator/tools/code-graph/dispatch.mjs +11 -7
  146. package/src/runtime/agent/orchestrator/tools/destructive-warning.mjs +126 -9
  147. package/src/runtime/agent/orchestrator/tools/graph-manifest.json +13 -13
  148. package/src/runtime/agent/orchestrator/tools/lib/owned-shell-trees.mjs +15 -6
  149. package/src/runtime/agent/orchestrator/tools/lib/shell-descendants.mjs +40 -2
  150. package/src/runtime/agent/orchestrator/tools/lib/shell-run-background/promote-job.mjs +2 -2
  151. package/src/runtime/agent/orchestrator/tools/lib/shell-run-background/promotion-results.mjs +13 -3
  152. package/src/runtime/agent/orchestrator/tools/lib/shell-run-settle.mjs +2 -0
  153. package/src/runtime/agent/orchestrator/tools/lib/shell-run-state.mjs +3 -1
  154. package/src/runtime/agent/orchestrator/tools/patch/v4a-convert.mjs +1 -1
  155. package/src/runtime/agent/orchestrator/tools/shell-command.mjs +35 -4
  156. package/src/runtime/agent/orchestrator/tools/shell-policy.mjs +7 -2
  157. package/src/runtime/agent/orchestrator/tools/shell-powershell.mjs +39 -23
  158. package/src/runtime/agent/orchestrator/tools/shell-snapshot.mjs +6 -2
  159. package/src/runtime/agent/orchestrator/tools/spawn-manifest.json +13 -13
  160. package/src/runtime/attachments/office-extract.mjs +11 -9
  161. package/src/runtime/memory/lib/embedding-tokenizer.mjs +32 -18
  162. package/src/runtime/memory/lib/runtime-fetcher.mjs +1 -1
  163. package/src/runtime/memory/lib/tool-call-handler.mjs +7 -5
  164. package/src/runtime/office/authoring/pptx-script-normalize.mjs +11 -8
  165. package/src/runtime/office/core/tabular.mjs +1 -1
  166. package/src/runtime/office/design/library/design-template-inspect.mjs +7 -4
  167. package/src/runtime/office/portable/docx-formatting.mjs +1 -1
  168. package/src/runtime/office/portable/docx-runs.mjs +1 -1
  169. package/src/runtime/office/portable/docx-tracked-edits.mjs +2 -2
  170. package/src/runtime/office/portable/portable-docx-edits.mjs +11 -10
  171. package/src/runtime/office/portable/portable-docx-operations.mjs +21 -17
  172. package/src/runtime/office/portable/portable-docx-parts.mjs +15 -9
  173. package/src/runtime/office/portable/portable-docx-styles.mjs +4 -1
  174. package/src/runtime/office/portable/portable-docx-xml.mjs +9 -9
  175. package/src/runtime/office/portable/portable-opc.mjs +27 -13
  176. package/src/runtime/office/portable/portable-pivot.mjs +3 -3
  177. package/src/runtime/office/portable/portable-pptx-chart.mjs +3 -3
  178. package/src/runtime/office/portable/portable-pptx-charts.mjs +24 -18
  179. package/src/runtime/office/portable/portable-pptx-core.mjs +5 -5
  180. package/src/runtime/office/portable/portable-pptx-deck.mjs +8 -4
  181. package/src/runtime/office/portable/portable-pptx-package.mjs +7 -4
  182. package/src/runtime/office/portable/portable-pptx-shapes.mjs +18 -9
  183. package/src/runtime/office/portable/portable-sheet-parts.mjs +9 -3
  184. package/src/runtime/office/portable/portable-sheet-xml.mjs +5 -5
  185. package/src/runtime/office/portable/portable-xlsx-charts.mjs +4 -1
  186. package/src/runtime/office/portable/portable-xlsx-drawings.mjs +10 -6
  187. package/src/runtime/office/portable/portable-xlsx-operations.mjs +8 -5
  188. package/src/runtime/office/portable/portable-xlsx-pivot-ops.mjs +1 -1
  189. package/src/runtime/office/portable/portable-xlsx-reference-shift.mjs +11 -7
  190. package/src/runtime/office/portable/portable-xlsx-sheet-edits.mjs +6 -3
  191. package/src/runtime/office/portable/portable-xml.mjs +1 -1
  192. package/src/runtime/shared/atomic-file.mjs +22 -13
  193. package/src/runtime/shared/background-tasks.mjs +60 -20
  194. package/src/runtime/shared/child-spawn-gate.mjs +26 -16
  195. package/src/runtime/shared/config.mjs +0 -10
  196. package/src/runtime/shared/file-lock.mjs +7 -1
  197. package/src/runtime/shared/file-permissions-worker.mjs +38 -0
  198. package/src/runtime/shared/file-permissions.d.mts +19 -4
  199. package/src/runtime/shared/file-permissions.mjs +310 -4
  200. package/src/runtime/shared/git-runner-worker.mjs +6 -78
  201. package/src/runtime/shared/llm/http-agent.mjs +7 -3
  202. package/src/runtime/shared/llm/provider-catalog-registry.mjs +10 -0
  203. package/src/runtime/shared/llm/usage-accounting.mjs +2 -0
  204. package/src/runtime/shared/llm/usage-ledger-import.mjs +32 -3
  205. package/src/runtime/shared/llm/usage-ledger-rollup.mjs +12 -5
  206. package/src/runtime/shared/llm/usage-ledger-worker.mjs +1 -1
  207. package/src/runtime/shared/llm/usage-ledger.mjs +20 -5
  208. package/src/runtime/shared/memory-snapshot.mjs +5 -1
  209. package/src/runtime/shared/notify-trace.mjs +8 -1
  210. package/src/runtime/shared/pristine-execution-contract.json +5 -1
  211. package/src/runtime/shared/process-runner-worker.mjs +7 -0
  212. package/src/runtime/shared/process-runner.mjs +38 -0
  213. package/src/runtime/shared/provider-accounts.mjs +2 -1
  214. package/src/runtime/shared/provider-api-key.mjs +0 -1
  215. package/src/runtime/shared/read-row-numbers.mjs +1 -1
  216. package/src/runtime/shared/resource-admission.mjs +60 -18
  217. package/src/runtime/shared/run-child.mjs +84 -0
  218. package/src/runtime/shared/session-activity-signal.mjs +23 -0
  219. package/src/runtime/shared/shell-output-summary.mjs +23 -0
  220. package/src/runtime/shared/singleton-owner.mjs +126 -42
  221. package/src/runtime/shared/tool-output-limit.mjs +4 -2
  222. package/src/runtime/shared/tool-output-marker.mjs +58 -0
  223. package/src/runtime/shared/user-data-guard.mjs +28 -9
  224. package/src/runtime/shared/worktrees/activity-gate.mjs +33 -8
  225. package/src/runtime/shared/worktrees/git-head.mjs +20 -2
  226. package/src/runtime/shared/worktrees/lock.mjs +3 -2
  227. package/src/runtime/terminal-bridge/tool-defs.mjs +1 -1
  228. package/src/runtime/tidy/runners/biome.mjs +3 -1
  229. package/src/runtime/tidy/shadow.mjs +2 -1
  230. package/src/runtime/web-search/index.mjs +5 -7
  231. package/src/runtime/web-search/lib/formatter.mjs +42 -6
  232. package/src/runtime/web-search/tool-defs.mjs +6 -1
  233. package/src/session-runtime/lifecycle/session-switch/context-switch.mjs +4 -3
  234. package/src/session-runtime/lifecycle/session-switch/resume.mjs +7 -4
  235. package/src/session-runtime/lifecycle/session-switch/session-delete.mjs +3 -3
  236. package/src/session-runtime/lifecycle/shared.mjs +19 -2
  237. package/src/session-runtime/lifecycle/teardown/session-close.mjs +2 -0
  238. package/src/session-runtime/lifecycle/teardown.mjs +5 -2
  239. package/src/session-runtime/lifecycle-api.mjs +3 -1
  240. package/src/session-runtime/provider-auth/login.mjs +10 -6
  241. package/src/session-runtime/provider-auth/setup.mjs +19 -2
  242. package/src/session-runtime/provider-catalog-cache.mjs +101 -25
  243. package/src/session-runtime/provider-models/catalog-load.mjs +14 -3
  244. package/src/session-runtime/provider-models/row-hydration.mjs +4 -0
  245. package/src/session-runtime/provider-models.mjs +76 -10
  246. package/src/session-runtime/provider-readiness.mjs +4 -0
  247. package/src/session-runtime/services/agent-tool/close-flow.mjs +2 -1
  248. package/src/session-runtime/services/agent-tool/job-views/agent-list.mjs +10 -2
  249. package/src/session-runtime/services/agent-tool/job-views/session-progress.mjs +13 -4
  250. package/src/session-runtime/services/agent-tool/notify.mjs +15 -4
  251. package/src/session-runtime/services/agent-tool/restart-notify.mjs +134 -0
  252. package/src/session-runtime/services/agent-tool/send-flow.mjs +24 -1
  253. package/src/session-runtime/services/agent-tool/spawn-flow/deferred-spawn.mjs +2 -1
  254. package/src/session-runtime/services/agent-tool/spawn-flow/job-start.mjs +4 -3
  255. package/src/session-runtime/services/agent-tool/spawn-flow/spawn-run.mjs +5 -1
  256. package/src/session-runtime/services/agent-tool/tag-registry/tag-lookup.mjs +8 -3
  257. package/src/session-runtime/services/agent-tool/tag-registry.mjs +3 -0
  258. package/src/session-runtime/services/agent-tool/worker-index/row-shape.mjs +4 -0
  259. package/src/session-runtime/services/agent-tool/worker-index.mjs +44 -10
  260. package/src/session-runtime/services/agent-tool.mjs +20 -0
  261. package/src/session-runtime/services/provider-admin.mjs +92 -20
  262. package/src/session-runtime/services/usage-dashboard-model.mjs +2 -2
  263. package/src/session-runtime/services/usage-dashboard.mjs +27 -69
  264. package/src/session-runtime/turn/session-ops.mjs +2 -2
  265. package/src/session-runtime/turn/turn-run/ask-callbacks.mjs +1 -0
  266. package/src/session-runtime/usage-stats-api.mjs +6 -1
  267. package/src/standalone/channel-transport/http-routes.mjs +10 -9
  268. package/src/standalone/daemon-desktop-runtime.mjs +20 -7
  269. package/src/standalone/daemon-owner.mjs +117 -25
  270. package/src/standalone/daemon.mjs +43 -13
  271. package/src/standalone/desktop-service-registry.mjs +32 -5
  272. package/src/standalone/session-call-cache.mjs +6 -0
  273. package/src/standalone/session-protocol.mjs +1 -1
  274. package/src/standalone/session-service/retention/busy.mjs +7 -2
  275. package/src/standalone/session-transport/routes.mjs +7 -6
  276. package/src/tui/app/model-options.mjs +39 -2
  277. package/src/tui/app/model-picker.mjs +16 -2
  278. package/src/tui/app/provider-setup-picker.mjs +1 -2
  279. package/src/tui/dist/index.mjs +436 -123
  280. package/src/tui/session/notice-text.mjs +0 -1
  281. package/src/tui/session/session-api/intake/submission.mjs +7 -13
  282. package/src/tui/session/session-api/integrations.mjs +1 -5
  283. package/src/tui/session/session-flow/drain.mjs +8 -0
  284. package/src/tui/session/session-flow/steering.mjs +46 -0
  285. package/src/tui/session/session-flow.mjs +2 -0
  286. package/src/tui/session/turn-stream.mjs +33 -0
  287. package/src/tui/session/turn.mjs +30 -3
  288. package/src/ui/statusline.mjs +1 -6
  289. package/src/ui/streaming-markdown-heal.mjs +94 -25
  290. package/src/vendor/statusline/bin/statusline-route.mjs +0 -1
  291. package/src/vendor/statusline/src/gateway/route-meta.mjs +0 -1
  292. 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) {
@@ -38488,19 +38702,34 @@ var HEALABLE_MARKDOWN_SYNTAX = /[`*_~[]/;
38488
38702
  function openFence(text) {
38489
38703
  let marker = "";
38490
38704
  let length = 0;
38705
+ let start = 0;
38706
+ let lineStart2 = 0;
38491
38707
  for (const rawLine of String(text ?? "").split("\n")) {
38492
38708
  const fence = FENCE_LINE.exec(rawLine.replace(/\r$/, ""));
38493
- if (!fence) continue;
38494
- const marks = fence[1];
38495
- if (!marker) {
38496
- marker = marks[0];
38497
- length = marks.length;
38498
- } else if (marks[0] === marker && marks.length >= length && !fence[2].trim()) {
38499
- marker = "";
38500
- length = 0;
38709
+ if (fence) {
38710
+ const marks = fence[1];
38711
+ if (!marker) {
38712
+ marker = marks[0];
38713
+ length = marks.length;
38714
+ start = lineStart2;
38715
+ } else if (marks[0] === marker && marks.length >= length && !fence[2].trim()) {
38716
+ marker = "";
38717
+ length = 0;
38718
+ }
38501
38719
  }
38720
+ lineStart2 += rawLine.length + 1;
38502
38721
  }
38503
- return marker ? { marker, length } : null;
38722
+ return marker ? { marker, length, start } : null;
38723
+ }
38724
+ function trimPartialOpeningFence(text, fence) {
38725
+ const lineEnd2 = text.indexOf("\n", fence.start);
38726
+ return lineEnd2 >= 0 && /\S/.test(text.slice(lineEnd2 + 1)) ? text : text.slice(0, fence.start);
38727
+ }
38728
+ var PENDING_BLOCK_MARKER_LINE = /(?:^|\n)[ \t]*(?:[-+*=_#>~`]+|\d{1,9}[.)]?)[ \t]*$/;
38729
+ function trimPendingBlockMarker(text) {
38730
+ const pending = PENDING_BLOCK_MARKER_LINE.exec(text);
38731
+ if (!pending) return text;
38732
+ return text.slice(0, pending.index + (pending[0].startsWith("\n") ? 1 : 0));
38504
38733
  }
38505
38734
  function trimPartialClosingFence(text, fence) {
38506
38735
  const partial = /(?:^|\r?\n) {0,3}([`~]+)$/.exec(text);
@@ -38531,7 +38760,7 @@ function closeInlineCode(text, isPendingLocalPath) {
38531
38760
  } else if (run === open) open = 0;
38532
38761
  index = end;
38533
38762
  }
38534
- if (open && isPendingLocalPath?.(text.slice(openIndex + open))) {
38763
+ if (open && (!text.slice(openIndex + open) || isPendingLocalPath?.(text.slice(openIndex + open)))) {
38535
38764
  return text.slice(0, openIndex);
38536
38765
  }
38537
38766
  return open > 0 ? `${text}${"`".repeat(open)}` : text;
@@ -38561,6 +38790,7 @@ function scanEmphasisRuns(masked) {
38561
38790
  let end = index + 1;
38562
38791
  while (masked[end] === marker) end += 1;
38563
38792
  const length = end - index;
38793
+ const at = index;
38564
38794
  const before = index > 0 ? masked[index - 1] : "";
38565
38795
  const after = end < masked.length ? masked[end] : "";
38566
38796
  const beforeSpace = isMarkdownSpace(before);
@@ -38570,16 +38800,25 @@ function scanEmphasisRuns(masked) {
38570
38800
  const left = !afterSpace && (!afterPunctuation || beforeSpace || beforePunctuation);
38571
38801
  const right = !beforeSpace && (!beforePunctuation || afterSpace || afterPunctuation);
38572
38802
  if (marker === "~") {
38573
- if (length >= 2) runs.push({ marker, length: 2, canOpen: left, canClose: right });
38803
+ runs.push({
38804
+ marker,
38805
+ length: Math.min(length, 2),
38806
+ canOpen: left && length >= 2,
38807
+ canClose: right && length >= 2,
38808
+ at,
38809
+ end
38810
+ });
38574
38811
  } else if (marker === "_") {
38575
38812
  runs.push({
38576
38813
  marker,
38577
38814
  length,
38578
38815
  canOpen: left && (!right || beforePunctuation),
38579
- canClose: right && (!left || afterPunctuation)
38816
+ canClose: right && (!left || afterPunctuation),
38817
+ at,
38818
+ end
38580
38819
  });
38581
38820
  } else {
38582
- runs.push({ marker, length, canOpen: left, canClose: right });
38821
+ runs.push({ marker, length, canOpen: left, canClose: right, at, end });
38583
38822
  }
38584
38823
  index = end;
38585
38824
  }
@@ -38587,7 +38826,9 @@ function scanEmphasisRuns(masked) {
38587
38826
  }
38588
38827
  function closeEmphasis(text) {
38589
38828
  const open = [];
38590
- for (const run of scanEmphasisRuns(maskCode(text))) {
38829
+ const runs = scanEmphasisRuns(maskCode(text));
38830
+ const last = runs[runs.length - 1];
38831
+ for (const run of runs) {
38591
38832
  let length = run.length;
38592
38833
  while (run.canClose && length > 0) {
38593
38834
  let match = -1;
@@ -38604,13 +38845,17 @@ function closeEmphasis(text) {
38604
38845
  length -= used;
38605
38846
  open.length = opener.length > 0 ? match + 1 : match;
38606
38847
  }
38848
+ if (run === last && run.end === text.length && length === run.length) {
38849
+ return closeEmphasis(text.slice(0, run.at));
38850
+ }
38607
38851
  if (length > 0 && run.canOpen) open.push({ marker: run.marker, length });
38608
38852
  }
38609
- let healed = text;
38853
+ const body = text.trimEnd();
38854
+ let closers = "";
38610
38855
  for (let index = open.length - 1; index >= 0; index -= 1) {
38611
- healed += open[index].marker.repeat(Math.min(open[index].length, 3));
38856
+ closers += open[index].marker.repeat(Math.min(open[index].length, 3));
38612
38857
  }
38613
- return healed;
38858
+ return closers ? `${body}${closers}${text.slice(body.length)}` : text;
38614
38859
  }
38615
38860
  function linkDestinationEnd(text, start) {
38616
38861
  let depth = 1;
@@ -38683,19 +38928,29 @@ function trimPendingTableHead(text) {
38683
38928
  for (const blank of text.matchAll(/\n[ \t]*\r?\n/g)) offset = blank.index + blank[0].length;
38684
38929
  const block = text.slice(offset);
38685
38930
  const lines = block.split("\n").map((line) => line.replace(/\r$/, ""));
38686
- if (lines.length === 0 || lines.length > 2 || !PIPE_ROW.test(lines[0])) return text;
38687
- if (lines.length === 2) {
38688
- const delimiter2 = lines[1];
38689
- if (!PARTIAL_DELIMITER_ROW.test(delimiter2)) return text;
38690
- if (DELIMITER_ROW.test(delimiter2) && tableCells(delimiter2) === tableCells(lines[0])) return text;
38691
- }
38692
- 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, ""));
38693
38947
  }
38694
38948
  function healStreamingMarkdownTail(text, isPendingLocalPath) {
38695
38949
  const source = String(text ?? "");
38696
38950
  const fence = source.includes("`") || source.includes("~") ? openFence(source) : null;
38697
- if (fence) return trimPartialClosingFence(source, fence);
38698
- const value = source.includes("|") ? trimPendingTableHead(source) : source;
38951
+ if (fence) return trimPartialOpeningFence(trimPartialClosingFence(source, fence), fence);
38952
+ const unmarked = trimPendingBlockMarker(source);
38953
+ const value = unmarked.includes("|") ? trimPendingTableHead(unmarked) : unmarked;
38699
38954
  const hasSyntax = HEALABLE_MARKDOWN_SYNTAX.test(value);
38700
38955
  if (!value || !hasSyntax && !isPendingLocalPath) return value;
38701
38956
  const healed = hasSyntax ? closeEmphasis(healIncompleteLink(closeInlineCode(value, isPendingLocalPath), isPendingLocalPath)) : value;
@@ -45942,8 +46197,8 @@ var notifyRenderFrame = (seq) => {
45942
46197
  for (const ack of acks) ack(seq);
45943
46198
  };
45944
46199
  var yieldToRenderer = ({ frames = 1 } = {}) => {
45945
- if (!hasRenderFrameSource()) return new Promise((resolve6) => setImmediate(resolve6));
45946
- return new Promise((resolve6) => {
46200
+ if (!hasRenderFrameSource()) return new Promise((resolve7) => setImmediate(resolve7));
46201
+ return new Promise((resolve7) => {
45947
46202
  const minSeq = renderAckSeq;
45948
46203
  let remainingFrames = Math.max(1, Math.floor(Number(frames) || 1));
45949
46204
  let settled = false;
@@ -45958,7 +46213,7 @@ var yieldToRenderer = ({ frames = 1 } = {}) => {
45958
46213
  releaseClosedListener();
45959
46214
  const idx = pendingRenderAcks.indexOf(onFrame);
45960
46215
  if (idx !== -1) pendingRenderAcks.splice(idx, 1);
45961
- resolve6();
46216
+ resolve7();
45962
46217
  };
45963
46218
  releaseClosedListener = onRenderFrameSourcesClosed(finish);
45964
46219
  const onTimeout = () => {
@@ -46758,13 +47013,13 @@ function nativeClipboardCommand(text) {
46758
47013
  function copyToClipboard(text) {
46759
47014
  const value = String(text ?? "");
46760
47015
  const wroteOsc52 = writeOsc52Clipboard(value);
46761
- return new Promise((resolve6, reject) => {
47016
+ return new Promise((resolve7, reject) => {
46762
47017
  const { cmd, args, input } = nativeClipboardCommand(value);
46763
47018
  let child;
46764
47019
  try {
46765
47020
  child = spawn2(cmd, args, { stdio: ["pipe", "ignore", "ignore"], windowsHide: true });
46766
47021
  } catch (e) {
46767
- if (wroteOsc52) resolve6();
47022
+ if (wroteOsc52) resolve7();
46768
47023
  else reject(clipboardHelperError(cmd, e));
46769
47024
  return;
46770
47025
  }
@@ -46773,7 +47028,7 @@ function copyToClipboard(text) {
46773
47028
  });
46774
47029
  if (!wroteOsc52) {
46775
47030
  child.on("close", (code) => {
46776
- if (code === 0) resolve6();
47031
+ if (code === 0) resolve7();
46777
47032
  else reject(new Error(`${cmd} exited with code ${code}`));
46778
47033
  });
46779
47034
  }
@@ -46782,7 +47037,7 @@ function copyToClipboard(text) {
46782
47037
  child.stdin.end(input);
46783
47038
  if (wroteOsc52) {
46784
47039
  child.unref?.();
46785
- resolve6();
47040
+ resolve7();
46786
47041
  }
46787
47042
  });
46788
47043
  }
@@ -47086,7 +47341,7 @@ function mimeForPath(path2) {
47086
47341
  return IMAGE_MIME[extname(String(path2 || "")).toLowerCase()] || null;
47087
47342
  }
47088
47343
  function execFileBuffer(cmd, args, options = {}) {
47089
- return new Promise((resolve6) => {
47344
+ return new Promise((resolve7) => {
47090
47345
  execFile(
47091
47346
  cmd,
47092
47347
  args,
@@ -47098,7 +47353,7 @@ function execFileBuffer(cmd, args, options = {}) {
47098
47353
  ...options
47099
47354
  },
47100
47355
  (error, stdout2, stderr) => {
47101
- resolve6({ ok: !error, code: error?.code ?? 0, stdout: stdout2, stderr, error });
47356
+ resolve7({ ok: !error, code: error?.code ?? 0, stdout: stdout2, stderr, error });
47102
47357
  }
47103
47358
  );
47104
47359
  });
@@ -48494,7 +48749,7 @@ function completeOAuthCode(ctx, target, commandText) {
48494
48749
  }
48495
48750
  oauthSubmitRef.current = true;
48496
48751
  setProviderPrompt((prompt) => prompt === target ? { ...prompt, submitting: true } : prompt);
48497
- 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"));
48498
48753
  void completion.then(() => {
48499
48754
  const successReturn = target.successReturn;
48500
48755
  const afterSave = target.afterSave;
@@ -49708,11 +49963,11 @@ init_atomic_file();
49708
49963
  init_json_file();
49709
49964
  import { existsSync as existsSync6, readFileSync as readFileSync6, realpathSync } from "node:fs";
49710
49965
  import { basename as basename4, delimiter, dirname as dirname6, join as join6 } from "node:path";
49711
- import { fileURLToPath as fileURLToPath2 } from "node:url";
49966
+ import { fileURLToPath as fileURLToPath3 } from "node:url";
49712
49967
  var PACKAGE_NAME = "mixdog";
49713
49968
  var REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}/latest`;
49714
49969
  var CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
49715
- var _MODULE_DIR = dirname6(fileURLToPath2(import.meta.url));
49970
+ var _MODULE_DIR = dirname6(fileURLToPath3(import.meta.url));
49716
49971
  var _PACKAGE_JSON_PATH = join6(_MODULE_DIR, "..", "..", "..", "package.json");
49717
49972
  var _PACKAGE_ROOT = dirname6(_PACKAGE_JSON_PATH);
49718
49973
  var _localVersionCache = null;
@@ -50698,7 +50953,17 @@ var PROVIDER_CATALOGS = Object.freeze({
50698
50953
  },
50699
50954
  "cursor-oauth": { relay: true },
50700
50955
  "cursor-api": { relay: true },
50701
- "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
+ }
50702
50967
  });
50703
50968
  var VERIFIED_CORRECTIONS = Object.freeze({
50704
50969
  "muse-code-oauth": Object.freeze({
@@ -51058,11 +51323,11 @@ function isPidAlive(value) {
51058
51323
 
51059
51324
  // src/runtime/shared/worktrees/git-head.mjs
51060
51325
  import { readFileSync as readFileSync9, statSync as statSync2, watch } from "node:fs";
51061
- import { dirname as dirname8, resolve as resolve4 } from "node:path";
51326
+ import { dirname as dirname8, resolve as resolve5 } from "node:path";
51062
51327
 
51063
51328
  // src/runtime/shared/worktrees/paths.mjs
51064
51329
  import { existsSync as existsSync9, realpathSync as realpathSync2 } from "node:fs";
51065
- 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";
51066
51331
 
51067
51332
  // src/runtime/shared/statusline/statusline-segments.mjs
51068
51333
  var DEFAULT_MIXDOG_HOME = process.env.MIXDOG_HOME || join10(homedir2(), ".mixdog");
@@ -55607,7 +55872,7 @@ function renderToolApproval({ toolApproval, store, frameColumns, expandedOptionP
55607
55872
  toolApproval.id
55608
55873
  );
55609
55874
  }
55610
- const resolve6 = (approved) => {
55875
+ const resolve7 = (approved) => {
55611
55876
  store.resolveToolApproval?.(toolApproval.id, {
55612
55877
  approved,
55613
55878
  reason: approved ? "approved by user" : "denied by user"
@@ -55632,12 +55897,12 @@ function renderToolApproval({ toolApproval, store, frameColumns, expandedOptionP
55632
55897
  description: "run this tool call"
55633
55898
  }
55634
55899
  ],
55635
- onSelect: (value) => resolve6(value === "approve"),
55636
- onCancel: () => resolve6(false),
55900
+ onSelect: (value) => resolve7(value === "approve"),
55901
+ onCancel: () => resolve7(false),
55637
55902
  onKey: (input) => {
55638
55903
  const value = String(input || "").trim().toLowerCase();
55639
- if (value === "a" || value === "y") resolve6(true);
55640
- 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);
55641
55906
  },
55642
55907
  title: "Tool approval",
55643
55908
  description: toolApprovalDescription(toolApproval),
@@ -59017,7 +59282,7 @@ var PROVIDER_DISPLAY_NAMES = /* @__PURE__ */ new Map([
59017
59282
  ["xai-api", "xAI API"],
59018
59283
  ["deepseek", "DeepSeek API"],
59019
59284
  ["deepseek-api", "DeepSeek API"],
59020
- ["opencode-go", "OpenCode Go API"],
59285
+ ["opencode-go-oauth", "OpenCode Go OAuth"],
59021
59286
  ["openrouter", "OpenRouter"],
59022
59287
  ["mixdog-local", "Local Provider"],
59023
59288
  ["default", "Default"]
@@ -59044,6 +59309,33 @@ var loadProviderDisplayNames = async (store) => {
59044
59309
  }
59045
59310
  return names;
59046
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
+ }));
59047
59339
  var PROVIDER_DISPLAY_RANKS = {
59048
59340
  default: 0,
59049
59341
  "openai-oauth": 10,
@@ -59054,7 +59346,7 @@ var PROVIDER_DISPLAY_RANKS = {
59054
59346
  "mimo-oauth": 34,
59055
59347
  "antigravity-oauth": 31,
59056
59348
  "cursor-oauth": 32,
59057
- "opencode-go": 35,
59349
+ "opencode-go-oauth": 34.5,
59058
59350
  openai: 40,
59059
59351
  "openai-api": 40,
59060
59352
  anthropic: 50,
@@ -59519,7 +59811,7 @@ function createOnboardingSteps({
59519
59811
  }
59520
59812
 
59521
59813
  // src/runtime/shared/open-url.mjs
59522
- import { spawn as spawn3 } from "node:child_process";
59814
+ import { spawn as spawn4 } from "node:child_process";
59523
59815
 
59524
59816
  // src/runtime/shared/wsl.mjs
59525
59817
  import { readFileSync as readFileSync10 } from "node:fs";
@@ -59577,7 +59869,7 @@ function tryOpenCandidates(candidates, index) {
59577
59869
  if (index >= candidates.length) return;
59578
59870
  const [cmd, args] = candidates[index];
59579
59871
  try {
59580
- const child = spawn3(cmd, args, { stdio: "ignore", ...detachedSpawnOpts });
59872
+ const child = spawn4(cmd, args, { stdio: "ignore", ...detachedSpawnOpts });
59581
59873
  child.on("error", () => {
59582
59874
  tryOpenCandidates(candidates, index + 1);
59583
59875
  });
@@ -59981,7 +60273,7 @@ function createProviderSetupPicker({
59981
60273
  }
59982
60274
  });
59983
60275
  try {
59984
- await new Promise((resolve6) => setTimeout(resolve6, 0));
60276
+ await new Promise((resolve7) => setTimeout(resolve7, 0));
59985
60277
  return await store.getProviderSetup(options.forceRefresh ? { force: true } : void 0);
59986
60278
  } catch (e) {
59987
60279
  store.pushNotice(`providers failed: ${e?.message || e}`, "error");
@@ -60103,7 +60395,7 @@ function createModelCatalog({ store, providerModelsCacheRef, webSearchModelsCach
60103
60395
  let renderedQuickModels = false;
60104
60396
  if (!providerModels.length || options.refreshModels === true) {
60105
60397
  paintLoading();
60106
- await new Promise((resolve6) => setTimeout(resolve6, 0));
60398
+ await new Promise((resolve7) => setTimeout(resolve7, 0));
60107
60399
  try {
60108
60400
  if (options.refreshModels !== true && options.cacheRef !== "webSearch") {
60109
60401
  refreshModelsPromise = Promise.resolve(loadModels({ force: false }));
@@ -60610,6 +60902,7 @@ function createModelPicker({
60610
60902
  }
60611
60903
  const models = normalizeModelOptions(providerModels);
60612
60904
  const providerNames = await loadProviderDisplayNames(store);
60905
+ const catalogFailures = await loadProviderCatalogFailures(store);
60613
60906
  const activeRoute = options.currentRoute || {
60614
60907
  provider: state.provider,
60615
60908
  model: state.model,
@@ -60647,7 +60940,10 @@ function createModelPicker({
60647
60940
  providerListHighlightProvider = renderOptions.highlightProvider;
60648
60941
  }
60649
60942
  const highlightProvider = renderOptions.highlightProvider || providerListHighlightProvider || null;
60650
- const providerItems = buildModelProviderItems(models, activeRoute, providerNames);
60943
+ const providerItems = [
60944
+ ...buildModelProviderItems(models, activeRoute, providerNames),
60945
+ ...buildCatalogFailureItems(catalogFailures, models, providerNames)
60946
+ ];
60651
60947
  const providerHighlight = highlightProvider || activeRoute?.provider || null;
60652
60948
  const providerInitialIndex = Math.max(
60653
60949
  0,
@@ -60664,6 +60960,10 @@ function createModelPicker({
60664
60960
  pickerKey: `model-picker:providers:${providerHighlight || "default"}`,
60665
60961
  items: providerItems,
60666
60962
  onSelect: (_value, item) => {
60963
+ if (item?._failure) {
60964
+ store.pushNotice(`${item.label}: ${item._failure}`, "warn");
60965
+ return;
60966
+ }
60667
60967
  if (!item?._provider) return;
60668
60968
  openProviderModelsPicker({
60669
60969
  view,
@@ -61137,7 +61437,7 @@ import {
61137
61437
  rm as rmP,
61138
61438
  stat as statP
61139
61439
  } from "node:fs/promises";
61140
- 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";
61141
61441
  import { homedir as homedir3 } from "node:os";
61142
61442
  import { createHash as createHash4, randomUUID } from "node:crypto";
61143
61443
  function getBackupRoot() {
@@ -61149,15 +61449,28 @@ var BACKUP_MANIFEST = "backup.json";
61149
61449
  var INIT_MARKER = ".mixdog-user-data.json";
61150
61450
  var SCOPE_PREFIX = "scope-";
61151
61451
  function normalizeDataDir(dataDir2) {
61152
- const full = resolve5(String(dataDir2));
61452
+ const full = resolve6(String(dataDir2));
61153
61453
  return process.platform === "win32" ? full.toLowerCase() : full;
61154
61454
  }
61155
61455
  function scopeDirFor(dataDir2) {
61156
61456
  const id = createHash4("sha256").update(normalizeDataDir(dataDir2)).digest("hex").slice(0, 16);
61157
61457
  return join11(getBackupRoot(), `${SCOPE_PREFIX}${id}`);
61158
61458
  }
61159
- function stamp() {
61160
- 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
+ }
61161
61474
  }
61162
61475
  function safeReason(reason) {
61163
61476
  return String(reason || "snapshot").replace(/[^a-z0-9_.-]+/gi, "-").slice(0, 48) || "snapshot";
@@ -61189,7 +61502,7 @@ function manifestDataDirMatches(backupDir, dataDirKey) {
61189
61502
  }
61190
61503
  function legacyMarkersFor(root, dataDir2, dataDirKey) {
61191
61504
  const hashed = new Set(
61192
- [String(dataDir2), resolve5(String(dataDir2))].map(
61505
+ [String(dataDir2), resolve6(String(dataDir2))].map(
61193
61506
  (value) => `.initialized-${createHash4("sha256").update(value).digest("hex").slice(0, 16)}.json`
61194
61507
  )
61195
61508
  );
@@ -61328,7 +61641,7 @@ function markUserDataInitialized(dataDir2) {
61328
61641
  writeFileSync4(
61329
61642
  join11(dataDir2, INIT_MARKER),
61330
61643
  `${JSON.stringify(
61331
- { instanceId: randomUUID(), dataDir: resolve5(dataDir2), createdAt: (/* @__PURE__ */ new Date()).toISOString() },
61644
+ { instanceId: randomUUID(), dataDir: resolve6(dataDir2), createdAt: (/* @__PURE__ */ new Date()).toISOString() },
61332
61645
  null,
61333
61646
  2
61334
61647
  )}
@@ -61351,16 +61664,12 @@ function ensureUserDataInitialized(dataDir2) {
61351
61664
  function skipBackups() {
61352
61665
  return process.env.MIXDOG_SKIP_USER_DATA_BACKUP === "1" || process.env.MIXDOG_SKIP_USER_DATA_BACKUP === "true";
61353
61666
  }
61354
- function backupTarget(dataDir2, reason) {
61355
- const scopeDir = scopeDirFor(dataDir2);
61356
- return { scopeDir, backupDir: join11(scopeDir, `${stamp()}-${safeReason(reason)}`) };
61357
- }
61358
61667
  function finishBackup(dataDir2, backupDir, reason) {
61359
61668
  const instanceId = markUserDataInitialized(dataDir2);
61360
61669
  writeFileSync4(
61361
61670
  join11(backupDir, BACKUP_MANIFEST),
61362
61671
  `${JSON.stringify(
61363
- { dataDir: resolve5(dataDir2), instanceId, reason, createdAt: (/* @__PURE__ */ new Date()).toISOString() },
61672
+ { dataDir: resolve6(dataDir2), instanceId, reason, createdAt: (/* @__PURE__ */ new Date()).toISOString() },
61364
61673
  null,
61365
61674
  2
61366
61675
  )}
@@ -61373,7 +61682,8 @@ function finishBackup(dataDir2, backupDir, reason) {
61373
61682
  function backupUserData(dataDir2, reason = "snapshot") {
61374
61683
  if (skipBackups()) return { dir: null, copied: [] };
61375
61684
  if (!dataDir2 || !existsSync10(dataDir2)) return { dir: null, copied: [] };
61376
- const { scopeDir, backupDir } = backupTarget(dataDir2, reason);
61685
+ const scopeDir = scopeDirFor(dataDir2);
61686
+ const backupDir = reserveBackupDir(scopeDir, reason);
61377
61687
  const copied = [];
61378
61688
  for (const rel of USER_DATA_FILES) {
61379
61689
  const src = join11(dataDir2, rel);
@@ -61390,6 +61700,8 @@ function backupUserData(dataDir2, reason = "snapshot") {
61390
61700
  process.stderr.write(`[user-data-backup] ${reason}: copied ${copied.length} file(s) to ${backupDir}
61391
61701
  `);
61392
61702
  }
61703
+ } else {
61704
+ rmSync(backupDir, { recursive: true, force: true });
61393
61705
  }
61394
61706
  return { dir: copied.length > 0 ? backupDir : null, copied };
61395
61707
  }
@@ -61423,7 +61735,8 @@ async function pruneBackupsAsync(scopeDir, keep = 40) {
61423
61735
  async function backupUserDataAsync(dataDir2, reason = "snapshot") {
61424
61736
  if (skipBackups()) return { dir: null, copied: [] };
61425
61737
  if (!dataDir2 || !existsSync10(dataDir2)) return { dir: null, copied: [] };
61426
- const { scopeDir, backupDir } = backupTarget(dataDir2, reason);
61738
+ const scopeDir = scopeDirFor(dataDir2);
61739
+ const backupDir = reserveBackupDir(scopeDir, reason);
61427
61740
  const copied = [];
61428
61741
  for (const rel of USER_DATA_FILES) {
61429
61742
  const src = join11(dataDir2, rel);
@@ -61440,6 +61753,8 @@ async function backupUserDataAsync(dataDir2, reason = "snapshot") {
61440
61753
  process.stderr.write(`[user-data-backup] ${reason}: copied ${copied.length} file(s) to ${backupDir}
61441
61754
  `);
61442
61755
  }
61756
+ } else {
61757
+ rmSync(backupDir, { recursive: true, force: true });
61443
61758
  }
61444
61759
  return { dir: copied.length > 0 ? backupDir : null, copied };
61445
61760
  }
@@ -61454,7 +61769,6 @@ var AGENT_PROVIDER_ENV = Object.freeze({
61454
61769
  gemini: "GEMINI_API_KEY",
61455
61770
  deepseek: "DEEPSEEK_API_KEY",
61456
61771
  xai: "XAI_API_KEY",
61457
- "opencode-go": "OPENCODE_API_KEY",
61458
61772
  openrouter: "OPENROUTER_API_KEY"
61459
61773
  });
61460
61774
  var AGENT_PROVIDER_ENV_ALIASES = Object.freeze({
@@ -61796,8 +62110,7 @@ function updateSectionAsync(section, updater) {
61796
62110
  }
61797
62111
  var SECRET_ACCOUNTS = Object.freeze({
61798
62112
  agentApiKey: (provider) => `agent.${provider}.apiKey`,
61799
- openaiUsageSessionKey: "agent.openai.usageSessionKey",
61800
- opencodeGoConsoleKey: "agent.opencode-go.consoleKey"
62113
+ openaiUsageSessionKey: "agent.openai.usageSessionKey"
61801
62114
  });
61802
62115
 
61803
62116
  // src/runtime/channels/lib/voice-setup.mjs
@@ -63250,8 +63563,8 @@ function usePromptQueueHistory({
63250
63563
  let timer2 = null;
63251
63564
  Promise.race([
63252
63565
  Promise.resolve(store.dispose?.("cli-react-exit", { detach: true })),
63253
- new Promise((resolve6) => {
63254
- timer2 = setTimeout(resolve6, 350);
63566
+ new Promise((resolve7) => {
63567
+ timer2 = setTimeout(resolve7, 350);
63255
63568
  })
63256
63569
  ]).finally(() => {
63257
63570
  if (timer2) clearTimeout(timer2);
@@ -63458,7 +63771,7 @@ import { useCallback as useCallback21, useEffect as useEffect27, useLayoutEffect
63458
63771
  // src/tui/session/transcript-spill.mjs
63459
63772
  import { readFileSync as readFileSync16 } from "node:fs";
63460
63773
  import { join as join16 } from "node:path";
63461
- import { Worker } from "node:worker_threads";
63774
+ import { Worker as Worker2 } from "node:worker_threads";
63462
63775
 
63463
63776
  // src/tui/session/transcript-spill/spill-dir.mjs
63464
63777
  import { randomUUID as randomUUID2 } from "node:crypto";
@@ -65838,8 +66151,8 @@ function waitWithTimeout(promise, ms) {
65838
66151
  let timer2 = null;
65839
66152
  return Promise.race([
65840
66153
  Promise.resolve(promise).then(() => true),
65841
- new Promise((resolve6) => {
65842
- timer2 = setTimeout(() => resolve6(false), ms);
66154
+ new Promise((resolve7) => {
66155
+ timer2 = setTimeout(() => resolve7(false), ms);
65843
66156
  })
65844
66157
  ]).finally(() => {
65845
66158
  if (timer2) clearTimeout(timer2);