mixdog 0.9.174 → 1.0.0

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 (935) hide show
  1. package/README.md +11 -12
  2. package/package.json +2 -2
  3. package/scripts/agent-turn-trace-probe.mjs +1 -1
  4. package/scripts/build-ffmpeg-runtime.sh +16 -0
  5. package/scripts/build-runtime-linux.sh +8 -2
  6. package/scripts/build-runtime-macos.sh +8 -2
  7. package/scripts/computer-task-cost-report.mjs +1 -9
  8. package/scripts/context-renewal-live-check.mjs +2 -1
  9. package/scripts/graph-parity.mjs +78 -55
  10. package/scripts/lib/bench-sandbox.mjs +67 -0
  11. package/scripts/lib/bench-sandbox.test.mjs +54 -0
  12. package/scripts/lib/coverage.mjs +2 -4
  13. package/scripts/lib/run-node-tests.mjs +24 -1
  14. package/scripts/lib/session-bench-fmt.mjs +65 -0
  15. package/scripts/lib/session-bench-render.mjs +394 -0
  16. package/scripts/lib/smoke-loop-shared.mjs +28 -0
  17. package/scripts/lib/smoke-loop-shared.test.mjs +22 -0
  18. package/scripts/lib/trace-row.mjs +40 -0
  19. package/scripts/lib/trace-row.test.mjs +47 -0
  20. package/scripts/lib/trace-stats.mjs +7 -0
  21. package/scripts/lib/trace-stats.test.mjs +7 -1
  22. package/scripts/llm-trace-summary.mjs +2 -44
  23. package/scripts/memory-chunk-quality.mjs +1 -1
  24. package/scripts/memory-layer2-check.mjs +1 -1
  25. package/scripts/pg-memory-diet.mjs +1 -1
  26. package/scripts/plan-runtime-release-tag.mjs +57 -0
  27. package/scripts/prepare-native-assets.mjs +1 -1
  28. package/scripts/provider-contract-test-env.mjs +21 -0
  29. package/scripts/release-paths.mjs +1 -0
  30. package/scripts/routing-corpus.mjs +1 -11
  31. package/scripts/session-diag.mjs +2 -44
  32. package/scripts/smoke-runtime-negative.sh +7 -1
  33. package/scripts/test-data-dir.mjs +19 -0
  34. package/scripts/tidy/sync-engines-manifest.mjs +8 -10
  35. package/scripts/tool-efficiency-diag.mjs +1 -4
  36. package/scripts/voice-runtime-config.json +1 -1
  37. package/src/app.mjs +1 -1
  38. package/src/defaults/skills/code-tidy/SKILL.md +5 -2
  39. package/src/defaults/skills/pptx/SKILL.md +1 -1
  40. package/src/defaults/skills/pptx/references/pictures.md +1 -1
  41. package/src/defaults/skills/pptx/scripts/review-deck.mjs +13 -4
  42. package/src/defaults/skills/skill-creator/scripts/validate-skill.mjs +40 -40
  43. package/src/defaults/skills/xlsx/SKILL.md +1 -0
  44. package/src/headless-exec.mjs +4 -2
  45. package/src/headless-role.mjs +81 -68
  46. package/src/lib/keychain-cjs.cjs +26 -49
  47. package/src/lib/mixdog-debug.cjs +1 -1
  48. package/src/lib/rules-builder.cjs +4 -3
  49. package/src/mixdog-session-runtime.mjs +2 -2
  50. package/src/repl/slash-commands.mjs +1 -1
  51. package/src/repl/stream-sink.mjs +1 -1
  52. package/src/repl/turn-output.mjs +2 -2
  53. package/src/repl.mjs +1 -1
  54. package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch/session-prep.mjs +1 -1
  55. package/src/runtime/agent/orchestrator/agent-runtime/cache-strategy.mjs +20 -16
  56. package/src/runtime/agent/orchestrator/agent-runtime/session-builder.mjs +0 -3
  57. package/src/runtime/agent/orchestrator/agent-trace-format.mjs +23 -22
  58. package/src/runtime/agent/orchestrator/context/skill-catalog.mjs +2 -2
  59. package/src/runtime/{shared/llm/index.mjs → agent/orchestrator/maintenance-preset.mjs} +2 -2
  60. package/src/runtime/agent/orchestrator/mcp/client-config.mjs +2 -1
  61. package/src/runtime/agent/orchestrator/mcp/client-transport.mjs +7 -36
  62. package/src/runtime/agent/orchestrator/mcp/client.mjs +28 -2
  63. package/src/runtime/agent/orchestrator/providers/admission-scheduler.mjs +1 -1
  64. package/src/runtime/agent/orchestrator/providers/anthropic-api-transport.mjs +6 -1
  65. package/src/runtime/agent/orchestrator/providers/anthropic-betas.mjs +1 -47
  66. package/src/runtime/agent/orchestrator/providers/anthropic-effort.mjs +1 -383
  67. package/src/runtime/agent/orchestrator/providers/anthropic-messages.mjs +2 -59
  68. package/src/runtime/agent/orchestrator/providers/anthropic-midstream-recovery.mjs +32 -31
  69. package/src/runtime/agent/orchestrator/providers/anthropic-model-resolve.mjs +2 -2
  70. package/src/runtime/agent/orchestrator/providers/anthropic-oauth-client-version.mjs +10 -1
  71. package/src/runtime/agent/orchestrator/providers/anthropic-oauth-credentials.mjs +12 -61
  72. package/src/runtime/agent/orchestrator/providers/anthropic-oauth-request/gzip-post.mjs +2 -1
  73. package/src/runtime/agent/orchestrator/providers/anthropic-oauth-request.mjs +2 -0
  74. package/src/runtime/agent/orchestrator/providers/anthropic-oauth.mjs +30 -67
  75. package/src/runtime/agent/orchestrator/providers/anthropic-recovery-guards.mjs +9 -12
  76. package/src/runtime/agent/orchestrator/providers/anthropic-server-fallback.mjs +3 -1
  77. package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn/leak-guard.mjs +1 -1
  78. package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn/turn-events/content-block-stop.mjs +20 -12
  79. package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn/turn-events.mjs +12 -2
  80. package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn/turn-outcome.mjs +4 -3
  81. package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn.mjs +5 -1
  82. package/src/runtime/agent/orchestrator/providers/anthropic-sse-watchdogs.mjs +18 -10
  83. package/src/runtime/agent/orchestrator/providers/anthropic-sse.mjs +20 -16
  84. package/src/runtime/agent/orchestrator/providers/anthropic-thinking-contract.mjs +1 -26
  85. package/src/runtime/agent/orchestrator/providers/anthropic.mjs +9 -13
  86. package/src/runtime/agent/orchestrator/providers/antigravity-oauth-catalog.mjs +8 -3
  87. package/src/runtime/agent/orchestrator/providers/antigravity-oauth-login.mjs +4 -8
  88. package/src/runtime/agent/orchestrator/providers/antigravity-oauth-tokens.mjs +21 -30
  89. package/src/runtime/agent/orchestrator/providers/antigravity-response.mjs +1 -1
  90. package/src/runtime/agent/orchestrator/providers/antigravity-stream.mjs +4 -2
  91. package/src/runtime/agent/orchestrator/providers/api-usage.mjs +10 -8
  92. package/src/runtime/agent/orchestrator/providers/cursor-auth.mjs +13 -10
  93. package/src/runtime/agent/orchestrator/providers/cursor-client-version.mjs +29 -0
  94. package/src/runtime/agent/orchestrator/providers/cursor-wire-guards.mjs +0 -1
  95. package/src/runtime/agent/orchestrator/providers/cursor-wire-protobuf.mjs +10 -26
  96. package/src/runtime/agent/orchestrator/providers/cursor-wire-stream-bridge.mjs +2 -3
  97. package/src/runtime/agent/orchestrator/providers/cursor-wire-transport.mjs +7 -3
  98. package/src/runtime/agent/orchestrator/providers/cursor-wire.mjs +9 -15
  99. package/src/runtime/agent/orchestrator/providers/cursor.mjs +31 -5
  100. package/src/runtime/agent/orchestrator/providers/gemini-cache-policy.mjs +1 -2
  101. package/src/runtime/agent/orchestrator/providers/gemini-cache.mjs +1 -4
  102. package/src/runtime/agent/orchestrator/providers/gemini-response.mjs +2 -2
  103. package/src/runtime/agent/orchestrator/providers/gemini-schema.mjs +48 -46
  104. package/src/runtime/agent/orchestrator/providers/gemini-stream.mjs +18 -19
  105. package/src/runtime/agent/orchestrator/providers/gemini.mjs +3 -26
  106. package/src/runtime/agent/orchestrator/providers/grok-client-version.mjs +41 -0
  107. package/src/runtime/agent/orchestrator/providers/grok-oauth-login.mjs +5 -19
  108. package/src/runtime/agent/orchestrator/providers/grok-oauth-tokens.mjs +16 -83
  109. package/src/runtime/agent/orchestrator/providers/grok-oauth.mjs +26 -8
  110. package/src/runtime/agent/orchestrator/providers/lib/anthropic-models.mjs +8 -0
  111. package/src/runtime/agent/orchestrator/providers/lib/anthropic-request-utils.mjs +30 -1
  112. package/src/runtime/agent/orchestrator/providers/lib/anthropic-stream-labels.mjs +6 -0
  113. package/src/runtime/agent/orchestrator/providers/lib/anthropic-system-blocks.mjs +17 -0
  114. package/src/runtime/agent/orchestrator/providers/{anthropic-leaked-toolcall.mjs → lib/leaked-toolcall.mjs} +7 -7
  115. package/src/runtime/agent/orchestrator/providers/lib/oauth-token-utils.mjs +44 -0
  116. package/src/runtime/agent/orchestrator/providers/lib/send-callbacks.mjs +12 -0
  117. package/src/runtime/agent/orchestrator/providers/lib/sse-framing.mjs +9 -8
  118. package/src/runtime/agent/orchestrator/providers/lib/transport-fallback-trace.mjs +25 -0
  119. package/src/runtime/agent/orchestrator/providers/model-catalog-projection.mjs +1 -181
  120. package/src/runtime/agent/orchestrator/providers/model-catalog.mjs +1 -796
  121. package/src/runtime/agent/orchestrator/providers/model-pricing-rates.mjs +1 -71
  122. package/src/runtime/agent/orchestrator/providers/npm-cli-version.mjs +87 -0
  123. package/src/runtime/agent/orchestrator/providers/oauth-usage.mjs +4 -5
  124. package/src/runtime/agent/orchestrator/providers/openai-codex-metadata.mjs +4 -5
  125. package/src/runtime/agent/orchestrator/providers/openai-compat-chat-send.mjs +2 -21
  126. package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream/stream-result.mjs +1 -1
  127. package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream/stream-state.mjs +2 -3
  128. package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream/tool-call-acc.mjs +1 -2
  129. package/src/runtime/agent/orchestrator/providers/openai-compat-options.mjs +4 -8
  130. package/src/runtime/agent/orchestrator/providers/openai-compat-response-normalization.mjs +45 -32
  131. package/src/runtime/agent/orchestrator/providers/openai-compat-responses-events.mjs +2 -2
  132. package/src/runtime/agent/orchestrator/providers/openai-compat-responses-state.mjs +2 -2
  133. package/src/runtime/agent/orchestrator/providers/openai-compat-responses.mjs +6 -12
  134. package/src/runtime/agent/orchestrator/providers/openai-compat-stream-common.mjs +2 -2
  135. package/src/runtime/agent/orchestrator/providers/openai-compat-trace.mjs +2 -2
  136. package/src/runtime/agent/orchestrator/providers/openai-compat-wire.mjs +14 -22
  137. package/src/runtime/agent/orchestrator/providers/openai-compat-xai-send.mjs +25 -34
  138. package/src/runtime/agent/orchestrator/providers/openai-compat-xai.mjs +14 -14
  139. package/src/runtime/agent/orchestrator/providers/openai-http-sse-request.mjs +3 -1
  140. package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-events/terminal-frames.mjs +2 -2
  141. package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-items.mjs +1 -1
  142. package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-outcome.mjs +2 -13
  143. package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-state.mjs +1 -1
  144. package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/text-relay.mjs +1 -1
  145. package/src/runtime/agent/orchestrator/providers/openai-oauth-login.mjs +2 -2
  146. package/src/runtime/agent/orchestrator/providers/openai-oauth-tokens.mjs +2 -44
  147. package/src/runtime/agent/orchestrator/providers/openai-oauth-ws.mjs +2 -16
  148. package/src/runtime/agent/orchestrator/providers/openai-oauth.mjs +6 -5
  149. package/src/runtime/agent/orchestrator/providers/openai-responses-input.mjs +4 -1
  150. package/src/runtime/agent/orchestrator/providers/openai-ws-pool.mjs +3 -2
  151. package/src/runtime/agent/orchestrator/providers/openai-ws-response-state/tool-calls.mjs +2 -2
  152. package/src/runtime/agent/orchestrator/providers/openai-ws-text-relay.mjs +1 -1
  153. package/src/runtime/agent/orchestrator/providers/openai-ws.mjs +6 -4
  154. package/src/runtime/agent/orchestrator/providers/opencode-go-usage.mjs +2 -1
  155. package/src/runtime/agent/orchestrator/providers/opencode-go.mjs +2 -2
  156. package/src/runtime/agent/orchestrator/providers/provider-catalog-cache.mjs +1 -130
  157. package/src/runtime/agent/orchestrator/providers/registry.mjs +20 -16
  158. package/src/runtime/agent/orchestrator/providers/retry-classification.mjs +21 -20
  159. package/src/runtime/agent/orchestrator/providers/retry-executor.mjs +17 -17
  160. package/src/runtime/agent/orchestrator/runtime-core/builtin-features.mjs +193 -0
  161. package/src/runtime/agent/orchestrator/runtime-core/config-helpers.mjs +421 -0
  162. package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/context-inspection.mjs +17 -17
  163. package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/context-status-inspection.mjs +1 -1
  164. package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/context-status-shape.mjs +3 -3
  165. package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/context-status.mjs +1 -1
  166. package/src/runtime/agent/orchestrator/runtime-core/deferred-tool-delta.mjs +101 -0
  167. package/src/runtime/agent/orchestrator/runtime-core/effort.mjs +145 -0
  168. package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/extension-scopes.mjs +5 -5
  169. package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/fs-utils.mjs +1 -1
  170. package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/goal-control.mjs +2 -2
  171. package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/goal-mutations.mjs +2 -2
  172. package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/goal-reminder.mjs +1 -1
  173. package/src/runtime/agent/orchestrator/runtime-core/goal-state.mjs +326 -0
  174. package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/goal-storage.mjs +2 -2
  175. package/src/runtime/agent/orchestrator/runtime-core/goal-tasks.mjs +148 -0
  176. package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/goal-title.mjs +2 -2
  177. package/src/runtime/agent/orchestrator/runtime-core/goal-tool-defs.mjs +140 -0
  178. package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/goal-turns.mjs +1 -1
  179. package/src/runtime/agent/orchestrator/runtime-core/model-capabilities.mjs +140 -0
  180. package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/orchestration.mjs +1 -1
  181. package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/plugin-mcp.mjs +2 -2
  182. package/src/runtime/agent/orchestrator/runtime-core/session-id.mjs +2 -0
  183. package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/session-route-policy.mjs +2 -2
  184. package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/session-text.mjs +3 -3
  185. package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/session-title.mjs +1 -2
  186. package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/skill-tool-loading.mjs +1 -1
  187. package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/tool-catalog-schema.mjs +1 -1
  188. package/src/runtime/agent/orchestrator/runtime-core/tool-catalog.mjs +747 -0
  189. package/src/runtime/agent/orchestrator/runtime-core/tool-defs.mjs +149 -0
  190. package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/workflow/agents.mjs +11 -7
  191. package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/workflow/context.mjs +6 -4
  192. package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/workflow/packs.mjs +2 -3
  193. package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/workflow-ids.mjs +1 -1
  194. package/src/runtime/agent/orchestrator/runtime-core/workflow.mjs +255 -0
  195. package/src/runtime/agent/orchestrator/session/agent-loop.mjs +3 -4
  196. package/src/runtime/agent/orchestrator/session/cache/prefetch-cache.mjs +2 -4
  197. package/src/runtime/agent/orchestrator/session/cache/read-cache.mjs +1 -1
  198. package/src/runtime/agent/orchestrator/session/context-identity-writer.mjs +162 -0
  199. package/src/runtime/agent/orchestrator/session/context-tool-pairs.mjs +2 -2
  200. package/src/runtime/agent/orchestrator/session/context-tool-schema.mjs +87 -0
  201. package/src/runtime/agent/orchestrator/session/context-utils.mjs +3 -245
  202. package/src/runtime/agent/orchestrator/session/eager-dispatch/admission.mjs +2 -3
  203. package/src/runtime/agent/orchestrator/session/eager-dispatch/mutation-paths.mjs +54 -0
  204. package/src/runtime/agent/orchestrator/session/eager-dispatch.mjs +1 -1
  205. package/src/runtime/agent/orchestrator/session/lifecycle-scan.mjs +1 -16
  206. package/src/runtime/agent/orchestrator/session/loop/arg-schema-coerce.mjs +2 -2
  207. package/src/runtime/agent/orchestrator/session/loop/compact-policy.mjs +13 -1
  208. package/src/runtime/agent/orchestrator/session/loop/completion-guards.mjs +3 -3
  209. package/src/runtime/agent/orchestrator/session/loop/deferred-call-through.mjs +4 -4
  210. package/src/runtime/agent/orchestrator/session/loop/fresh-context.mjs +1 -1
  211. package/src/runtime/agent/orchestrator/session/loop/loop-state.mjs +2 -2
  212. package/src/runtime/agent/orchestrator/session/loop/no-tool-turn/continuation.mjs +1 -1
  213. package/src/runtime/agent/orchestrator/session/loop/pre-dispatch-deny.mjs +2 -3
  214. package/src/runtime/agent/orchestrator/session/loop/request-boundary.mjs +2 -2
  215. package/src/runtime/agent/orchestrator/session/loop/send-phase.mjs +6 -3
  216. package/src/runtime/agent/orchestrator/session/loop/tool-classify.mjs +1 -1
  217. package/src/runtime/agent/orchestrator/session/loop/tool-exec/call-prep.mjs +3 -2
  218. package/src/runtime/agent/orchestrator/session/loop/tool-exec/dispatch.mjs +6 -10
  219. package/src/runtime/agent/orchestrator/session/loop/tool-exec.mjs +2 -2
  220. package/src/runtime/agent/orchestrator/session/loop/tool-helpers.mjs +1 -1
  221. package/src/runtime/agent/orchestrator/session/loop.mjs +5 -6
  222. package/src/runtime/agent/orchestrator/session/manager/ask-turn-commit.mjs +1 -1
  223. package/src/runtime/agent/orchestrator/session/manager/ask-turn-prepare.mjs +2 -2
  224. package/src/runtime/agent/orchestrator/session/manager/ask-turn-settle.mjs +2 -2
  225. package/src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs +5 -5
  226. package/src/runtime/agent/orchestrator/session/manager/foreign-pending-messages.mjs +40 -64
  227. package/src/runtime/agent/orchestrator/session/manager/pending-lifecycle-epoch.mjs +2 -2
  228. package/src/runtime/agent/orchestrator/session/manager/pending-messages.mjs +24 -16
  229. package/src/runtime/agent/orchestrator/session/manager/pending-persist-queue.mjs +1 -1
  230. package/src/runtime/agent/orchestrator/session/manager/pending-spool-file.mjs +7 -13
  231. package/src/runtime/agent/orchestrator/session/manager/pending-spool-path.mjs +17 -2
  232. package/src/runtime/agent/orchestrator/session/manager/pending-spool-shard.mjs +139 -0
  233. package/src/runtime/agent/orchestrator/session/manager/pending-spool-sweep.mjs +34 -14
  234. package/src/runtime/agent/orchestrator/session/manager/prefetch-bridge/file-prefetch.mjs +1 -1
  235. package/src/runtime/agent/orchestrator/session/manager/prompt-utils.mjs +4 -18
  236. package/src/runtime/agent/orchestrator/session/manager/runtime-liveness.mjs +1 -1
  237. package/src/runtime/agent/orchestrator/session/manager/session-close.mjs +10 -18
  238. package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.mjs +1 -1
  239. package/src/runtime/agent/orchestrator/session/manager/session-record.mjs +2 -2
  240. package/src/runtime/agent/orchestrator/session/manager/session-tool-surface.mjs +1 -1
  241. package/src/runtime/agent/orchestrator/session/manager/tool-resolution.mjs +2 -2
  242. package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint.mjs +6 -10
  243. package/src/runtime/agent/orchestrator/session/manager.mjs +1 -2
  244. package/src/runtime/agent/orchestrator/session/pre-send-compact.mjs +11 -6
  245. package/src/runtime/agent/orchestrator/session/result-classification.mjs +1 -1
  246. package/src/runtime/agent/orchestrator/session/send-instrumentation.mjs +194 -0
  247. package/src/runtime/agent/orchestrator/session/send-with-recovery.mjs +6 -198
  248. package/src/runtime/agent/orchestrator/session/store/canonical-reader.mjs +7 -7
  249. package/src/runtime/agent/orchestrator/session/store/fs-probe.mjs +0 -19
  250. package/src/runtime/agent/orchestrator/session/store/lifecycle-barriers.mjs +15 -8
  251. package/src/runtime/agent/orchestrator/session/store/listing.mjs +18 -29
  252. package/src/runtime/agent/orchestrator/session/store/load-cache.mjs +6 -36
  253. package/src/runtime/agent/orchestrator/session/store/save-delta.mjs +148 -0
  254. package/src/runtime/agent/orchestrator/session/store/save-fault.mjs +3 -3
  255. package/src/runtime/agent/orchestrator/session/store/save-worker.mjs +15 -142
  256. package/src/runtime/agent/orchestrator/session/store/summary-cache.mjs +3 -3
  257. package/src/runtime/agent/orchestrator/session/store/sweep/stale-sweep.mjs +4 -2
  258. package/src/runtime/agent/orchestrator/session/store/sweep/sweep-finish.mjs +1 -1
  259. package/src/runtime/agent/orchestrator/session/store/sweep/sweep-row.mjs +3 -2
  260. package/src/runtime/agent/orchestrator/session/store/write-admission.mjs +9 -22
  261. package/src/runtime/agent/orchestrator/session/store-agent-worker-rows.mjs +14 -6
  262. package/src/runtime/agent/orchestrator/session/store-summary-index.mjs +200 -52
  263. package/src/runtime/agent/orchestrator/session/store-summary-log.mjs +81 -0
  264. package/src/runtime/agent/orchestrator/session/store-summary-reader.mjs +38 -4
  265. package/src/runtime/agent/orchestrator/session/store-transcript-cache.mjs +5 -2
  266. package/src/runtime/agent/orchestrator/session/store-transcript-projection.mjs +3 -5
  267. package/src/runtime/agent/orchestrator/session/store-transcript-worker.mjs +54 -0
  268. package/src/runtime/agent/orchestrator/session/store.mjs +5 -9
  269. package/src/runtime/agent/orchestrator/session/tool-batch/execute-call.mjs +19 -8
  270. package/src/runtime/agent/orchestrator/session/tool-batch/flush.mjs +1 -1
  271. package/src/runtime/agent/orchestrator/session/tool-batch/pre-dispatch.mjs +2 -2
  272. package/src/runtime/agent/orchestrator/session/tool-batch/record-outcome.mjs +2 -1
  273. package/src/runtime/agent/orchestrator/session/transcript-restore/agent-envelope.mjs +489 -0
  274. package/src/runtime/agent/orchestrator/session/transcript-restore/restore.mjs +419 -0
  275. package/src/runtime/agent/orchestrator/session/transcript-restore/tool-result-status.mjs +358 -0
  276. package/src/runtime/agent/orchestrator/session/transcript-restore/tool-result-text.mjs +157 -0
  277. package/src/runtime/agent/orchestrator/tools/bash-policy-scan.mjs +2 -3
  278. package/src/runtime/agent/orchestrator/tools/builtin/arg-guard.mjs +32 -11
  279. package/src/runtime/agent/orchestrator/tools/builtin/atomic-write.mjs +1 -31
  280. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/benign-exit.mjs +7 -3
  281. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/deadline-plan.mjs +11 -3
  282. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/spawn-env.mjs +4 -0
  283. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool.mjs +13 -7
  284. package/src/runtime/agent/orchestrator/tools/builtin/binary-file.mjs +6 -3
  285. package/src/runtime/agent/orchestrator/tools/builtin/builtin-tools.mjs +11 -5
  286. package/src/runtime/agent/orchestrator/tools/builtin/device-paths.mjs +1 -206
  287. package/src/runtime/agent/orchestrator/tools/builtin/find-files-tool.mjs +1 -1
  288. package/src/runtime/agent/orchestrator/tools/builtin/git-command-tool.mjs +39 -3
  289. package/src/runtime/agent/orchestrator/tools/builtin/lib/grep-path-fanout.mjs +5 -7
  290. package/src/runtime/agent/orchestrator/tools/builtin/lib/grep-request.mjs +7 -25
  291. package/src/runtime/agent/orchestrator/tools/builtin/lib/list-helpers.mjs +27 -1
  292. package/src/runtime/agent/orchestrator/tools/builtin/lib/search-input-helpers.mjs +37 -0
  293. package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-job-insights.mjs +1 -1
  294. package/src/runtime/agent/orchestrator/tools/builtin/list-tool.mjs +28 -18
  295. package/src/runtime/agent/orchestrator/tools/builtin/native-search-client.mjs +6 -10
  296. package/src/runtime/agent/orchestrator/tools/builtin/path-utils.mjs +15 -17
  297. package/src/runtime/agent/orchestrator/tools/builtin/read-formatting.mjs +3 -3
  298. package/src/runtime/agent/orchestrator/tools/builtin/read-image-resize.mjs +1 -399
  299. package/src/runtime/agent/orchestrator/tools/builtin/read-line-collector.mjs +3 -2
  300. package/src/runtime/agent/orchestrator/tools/builtin/read-office-files.mjs +8 -15
  301. package/src/runtime/agent/orchestrator/tools/builtin/read-range-index.mjs +5 -8
  302. package/src/runtime/agent/orchestrator/tools/builtin/read-single-render.mjs +3 -2
  303. package/src/runtime/agent/orchestrator/tools/builtin/read-source-windows.mjs +2 -2
  304. package/src/runtime/agent/orchestrator/tools/builtin/read-streaming.mjs +6 -5
  305. package/src/runtime/agent/orchestrator/tools/builtin/read-tool/batch-dispatch.mjs +50 -5
  306. package/src/runtime/agent/orchestrator/tools/builtin/read-tool/batch-render.mjs +1 -1
  307. package/src/runtime/agent/orchestrator/tools/builtin/read-tool/batch-snapshot.mjs +2 -5
  308. package/src/runtime/agent/orchestrator/tools/builtin/read-tool.mjs +11 -1
  309. package/src/runtime/agent/orchestrator/tools/builtin/runtime-capabilities.mjs +1 -1
  310. package/src/runtime/agent/orchestrator/tools/builtin/search-glob-tool.mjs +3 -35
  311. package/src/runtime/agent/orchestrator/tools/builtin/search-grep-tool.mjs +0 -12
  312. package/src/runtime/agent/orchestrator/tools/builtin/shell-analysis.mjs +50 -0
  313. package/src/runtime/agent/orchestrator/tools/builtin/shell-jobs.mjs +9 -26
  314. package/src/runtime/agent/orchestrator/tools/builtin/shell-lossless-compact.mjs +2 -1
  315. package/src/runtime/agent/orchestrator/tools/builtin/shell-output.mjs +6 -5
  316. package/src/runtime/agent/orchestrator/tools/builtin/snapshot-helpers.mjs +8 -3
  317. package/src/runtime/agent/orchestrator/tools/builtin/snapshot-store.mjs +6 -14
  318. package/src/runtime/agent/orchestrator/tools/builtin/snapshot-validation.mjs +3 -9
  319. package/src/runtime/agent/orchestrator/tools/builtin/tool-output-limit.mjs +1 -60
  320. package/src/runtime/agent/orchestrator/tools/builtin.mjs +10 -32
  321. package/src/runtime/agent/orchestrator/tools/code-graph/disk-cache.mjs +2 -2
  322. package/src/runtime/agent/orchestrator/tools/code-graph/modes/calls.mjs +3 -3
  323. package/src/runtime/agent/orchestrator/tools/code-graph/project-root.mjs +3 -7
  324. package/src/runtime/agent/orchestrator/tools/code-graph/search-references.mjs +15 -10
  325. package/src/runtime/agent/orchestrator/tools/code-graph/search.mjs +6 -10
  326. package/src/runtime/agent/orchestrator/tools/code-graph/symbol-index.mjs +4 -0
  327. package/src/runtime/agent/orchestrator/tools/code-graph/text-columns.mjs +3 -3
  328. package/src/runtime/agent/orchestrator/tools/code-graph/trusted-roots.mjs +3 -7
  329. package/src/runtime/agent/orchestrator/tools/code-graph-state.mjs +1 -84
  330. package/src/runtime/agent/orchestrator/tools/destructive-warning.mjs +11 -11
  331. package/src/runtime/agent/orchestrator/tools/graph-manifest.json +13 -13
  332. package/src/runtime/agent/orchestrator/tools/io-trace.mjs +28 -0
  333. package/src/runtime/agent/orchestrator/tools/lib/shell-run-spawn.mjs +38 -5
  334. package/src/runtime/agent/orchestrator/tools/lib/shell-warm-standby.mjs +10 -4
  335. package/src/runtime/agent/orchestrator/tools/patch/apply-patch/codex-batch.mjs +6 -26
  336. package/src/runtime/agent/orchestrator/tools/patch/apply-patch/request.mjs +0 -3
  337. package/src/runtime/agent/orchestrator/tools/patch/dispatch/native-report.mjs +2 -1
  338. package/src/runtime/agent/orchestrator/tools/patch/dispatch.mjs +3 -10
  339. package/src/runtime/agent/orchestrator/tools/patch/matcher.mjs +1 -1
  340. package/src/runtime/agent/orchestrator/tools/patch/mutation-output.mjs +6 -19
  341. package/src/runtime/agent/orchestrator/tools/patch/native-server.mjs +5 -15
  342. package/src/runtime/agent/orchestrator/tools/patch/orchestrator.mjs +1 -3
  343. package/src/runtime/agent/orchestrator/tools/patch/paths.mjs +4 -0
  344. package/src/runtime/agent/orchestrator/tools/patch/sequence/run.mjs +1 -3
  345. package/src/runtime/agent/orchestrator/tools/patch/sequence/units.mjs +4 -10
  346. package/src/runtime/agent/orchestrator/tools/patch/sequence.mjs +1 -2
  347. package/src/runtime/agent/orchestrator/tools/patch/v4a-convert.mjs +5 -11
  348. package/src/runtime/agent/orchestrator/tools/patch-binary-fetcher.mjs +1 -2
  349. package/src/runtime/agent/orchestrator/tools/patch-manifest-path.mjs +3 -0
  350. package/src/runtime/agent/orchestrator/tools/patch-manifest.json +12 -12
  351. package/src/runtime/agent/orchestrator/tools/shell-command.mjs +87 -12
  352. package/src/runtime/agent/orchestrator/tools/shell-exec-output.mjs +6 -3
  353. package/src/runtime/agent/orchestrator/tools/shell-exec-policy.mjs +1 -1
  354. package/src/runtime/agent/orchestrator/tools/shell-policy.mjs +15 -25
  355. package/src/runtime/agent/orchestrator/tools/spawn-manifest.json +13 -13
  356. package/src/runtime/{shared/llm → agent/orchestrator}/usage-log.mjs +1 -1
  357. package/src/runtime/attachments/pdf-extract.mjs +32 -29
  358. package/src/runtime/attachments/store.mjs +2 -1
  359. package/src/runtime/browser-bridge/browser-action-contract.d.mts +0 -2
  360. package/src/runtime/browser-bridge/client.mjs +30 -9
  361. package/src/runtime/channels/data/voice-runtime-manifest.json +21 -21
  362. package/src/runtime/channels/lib/config.mjs +4 -4
  363. package/src/runtime/channels/lib/event-pipeline.mjs +3 -3
  364. package/src/runtime/channels/lib/event-queue.mjs +1 -0
  365. package/src/runtime/channels/lib/executor.mjs +3 -25
  366. package/src/runtime/channels/lib/runtime-paths.mjs +36 -41
  367. package/src/runtime/channels/lib/scheduler.mjs +28 -44
  368. package/src/runtime/{shared → channels/lib}/schedules-db.mjs +3 -3
  369. package/src/runtime/channels/lib/tool-dispatch.mjs +3 -8
  370. package/src/runtime/channels/lib/voice-runtime-fetcher.mjs +19 -23
  371. package/src/runtime/channels/lib/voice-transcription.mjs +13 -9
  372. package/src/runtime/channels/lib/webhook/log.mjs +2 -29
  373. package/src/runtime/channels/lib/webhook/request-handler.mjs +4 -5
  374. package/src/runtime/channels/lib/webhook/session-dispatch.mjs +8 -12
  375. package/src/runtime/channels/lib/webhook/signature.mjs +15 -19
  376. package/src/runtime/channels/lib/webhook/untrusted-fence.mjs +9 -0
  377. package/src/runtime/channels/lib/webhook.mjs +1 -1
  378. package/src/runtime/{shared → channels/lib}/webhooks-db.mjs +3 -3
  379. package/src/runtime/channels/lib/whisper-server.mjs +3 -2
  380. package/src/runtime/channels/lib/worker-bootstrap.mjs +19 -21
  381. package/src/runtime/channels/lib/worker-main.mjs +49 -58
  382. package/src/runtime/computer-bridge/client.mjs +7 -10
  383. package/src/runtime/computer-bridge/core-actions.mjs +1 -1
  384. package/src/runtime/computer-bridge/limits.d.mts +0 -1
  385. package/src/runtime/github/client.mjs +11 -6
  386. package/src/runtime/github/commands.mjs +4 -2
  387. package/src/runtime/github/contract.mjs +3 -1
  388. package/src/runtime/local-provider/hugging-face.mjs +3 -3
  389. package/src/runtime/local-provider/registered-models.mjs +3 -1
  390. package/src/runtime/local-provider/request-queue.mjs +24 -29
  391. package/src/runtime/local-provider/serial-chain.mjs +19 -0
  392. package/src/runtime/local-provider/server-process.mjs +2 -10
  393. package/src/runtime/media/adapters/antigravity-image.mjs +2 -2
  394. package/src/runtime/media/adapters/codex-image.mjs +2 -2
  395. package/src/runtime/media/adapters/gemini-image.mjs +2 -1
  396. package/src/runtime/media/adapters/gemini-video.mjs +3 -7
  397. package/src/runtime/media/adapters/xai-media.mjs +3 -7
  398. package/src/runtime/media/bounded-signal.mjs +13 -0
  399. package/src/runtime/media/store.mjs +9 -3
  400. package/src/runtime/memory/data/runtime-manifest.json +11 -11
  401. package/src/runtime/memory/index.mjs +6 -21
  402. package/src/runtime/memory/lib/core-memory-file.mjs +1 -1
  403. package/src/runtime/memory/lib/cycle-scheduler/backlog-probe.mjs +2 -1
  404. package/src/runtime/memory/lib/cycle1/cycle1-plan.mjs +1 -1
  405. package/src/runtime/memory/lib/embedding-idle-lease.mjs +18 -0
  406. package/src/runtime/memory/lib/embedding-provider.mjs +13 -0
  407. package/src/runtime/memory/lib/embedding-worker.mjs +12 -1
  408. package/src/runtime/memory/lib/http-router/ingest-routes.mjs +1 -1
  409. package/src/runtime/memory/lib/http-router/session-routes.mjs +1 -1
  410. package/src/runtime/memory/lib/ingest/transcript-discovery.mjs +1 -1
  411. package/src/runtime/memory/lib/memory-action-handlers/manage-actions.mjs +1 -1
  412. package/src/runtime/memory/lib/memory-cycle1.mjs +24 -1
  413. package/src/runtime/memory/lib/memory-cycle2-quarantine.mjs +99 -0
  414. package/src/runtime/memory/lib/memory-cycle2-review.mjs +8 -2
  415. package/src/runtime/memory/lib/memory-cycle2.mjs +49 -9
  416. package/src/runtime/memory/lib/memory-embed.mjs +3 -2
  417. package/src/runtime/memory/lib/memory-extraction.mjs +1 -2
  418. package/src/runtime/memory/lib/memory-fingerprint.mjs +1 -1
  419. package/src/runtime/memory/lib/memory-ops-policy.mjs +18 -2
  420. package/src/runtime/memory/lib/memory-retrievers.mjs +2 -2
  421. package/src/runtime/memory/lib/memory-text-utils.mjs +1 -1
  422. package/src/runtime/memory/lib/pg/adapter.mjs +3 -3
  423. package/src/runtime/memory/lib/pg/process.mjs +2 -2
  424. package/src/runtime/memory/lib/pg/supervisor.mjs +1 -2
  425. package/src/runtime/memory/lib/query-ranking.mjs +2 -2
  426. package/src/runtime/memory/lib/query-search-plan.mjs +1 -1
  427. package/src/runtime/memory/lib/recall-format.mjs +3 -4
  428. package/src/runtime/memory/lib/runtime-fetcher.mjs +94 -23
  429. package/src/runtime/memory/lib/session-ingest-runtime.mjs +1 -1
  430. package/src/runtime/memory/lib/trace-store.mjs +6 -2
  431. package/src/runtime/office/authoring/pptx-author-action.mjs +8 -3
  432. package/src/runtime/office/authoring/pptx-brief.mjs +3 -3
  433. package/src/runtime/office/authoring/pptx-html-build.mjs +109 -37
  434. package/src/runtime/office/authoring/pptx-html-geometry.mjs +188 -46
  435. package/src/runtime/office/authoring/pptx-html-measure.mjs +60 -21
  436. package/src/runtime/office/authoring/pptx-html-runner.mjs +83 -29
  437. package/src/runtime/office/authoring/pptx-script-normalize.mjs +156 -16
  438. package/src/runtime/office/bench/polish-benchmark.mjs +204 -201
  439. package/src/runtime/office/bench/quality-live-benchmark.mjs +8 -4
  440. package/src/runtime/office/capabilities-catalog.mjs +12 -1
  441. package/src/runtime/office/capabilities-signatures.mjs +31 -11
  442. package/src/runtime/office/capabilities.mjs +39 -20
  443. package/src/runtime/office/com/com-adapter.mjs +16 -14
  444. package/src/runtime/office/com/office-com-host.ps1 +118 -140
  445. package/src/runtime/office/core/excel-snapshot-normalize.mjs +149 -0
  446. package/src/runtime/office/core/office-actions-batch.mjs +4 -7
  447. package/src/runtime/office/core/office-actions-inspect.mjs +17 -14
  448. package/src/runtime/office/core/office-actions-open.mjs +1 -6
  449. package/src/runtime/office/core/office-core.mjs +107 -49
  450. package/src/runtime/office/core/office-finalize/review-stage.mjs +4 -1
  451. package/src/runtime/office/core/office-qa/design-review-stage.mjs +2 -9
  452. package/src/runtime/office/core/office-qa/review-assembly.mjs +9 -7
  453. package/src/runtime/office/core/office-sessions.mjs +10 -149
  454. package/src/runtime/office/design/composition-system.mjs +5 -10
  455. package/src/runtime/office/design/design-system.mjs +1 -2
  456. package/src/runtime/office/design/docx/design-docx/section.mjs +1 -1
  457. package/src/runtime/office/design/docx/design-docx-components.mjs +2 -1
  458. package/src/runtime/office/design/docx/design-docx.mjs +2 -2
  459. package/src/runtime/office/design/xlsx/design-xlsx.mjs +6 -2
  460. package/src/runtime/office/pdf/pdf-analysis.mjs +39 -32
  461. package/src/runtime/office/pdf/pdf-batch-content.mjs +1 -1
  462. package/src/runtime/office/pdf/pdf-writer.mjs +26 -22
  463. package/src/runtime/office/portable/docx-tracked-edits.mjs +6 -6
  464. package/src/runtime/office/portable/font-provisioner.mjs +37 -11
  465. package/src/runtime/office/portable/portable-cells.mjs +2 -6
  466. package/src/runtime/office/portable/portable-chart.mjs +6 -6
  467. package/src/runtime/office/portable/portable-docx-edits.mjs +4 -9
  468. package/src/runtime/office/portable/portable-docx-operations.mjs +16 -13
  469. package/src/runtime/office/portable/portable-docx-parts.mjs +7 -2
  470. package/src/runtime/office/portable/portable-docx-xml.mjs +36 -28
  471. package/src/runtime/office/portable/portable-opc.mjs +11 -13
  472. package/src/runtime/office/portable/portable-package.mjs +3 -4
  473. package/src/runtime/office/portable/portable-pivot.mjs +7 -3
  474. package/src/runtime/office/portable/portable-pptx-charts.mjs +59 -42
  475. package/src/runtime/office/portable/portable-pptx-core.mjs +14 -4
  476. package/src/runtime/office/portable/portable-pptx-package.mjs +5 -4
  477. package/src/runtime/office/portable/portable-pptx-shapes.mjs +25 -8
  478. package/src/runtime/office/portable/portable-sheet-audits.mjs +4 -8
  479. package/src/runtime/office/portable/portable-sheet-page.mjs +2 -2
  480. package/src/runtime/office/portable/portable-sheet-xml.mjs +1 -1
  481. package/src/runtime/office/portable/portable-snapshot-docx.mjs +2 -3
  482. package/src/runtime/office/portable/portable-snapshot-pptx.mjs +3 -1
  483. package/src/runtime/office/portable/portable-soffice.mjs +27 -22
  484. package/src/runtime/office/portable/portable-validation-package.mjs +1 -2
  485. package/src/runtime/office/portable/portable-validation.mjs +9 -3
  486. package/src/runtime/office/portable/portable-xlsx-operations.mjs +2 -49
  487. package/src/runtime/office/portable/portable-xlsx-pivot-ops.mjs +10 -5
  488. package/src/runtime/office/portable/portable-xlsx-range-layout.mjs +3 -2
  489. package/src/runtime/office/portable/portable-xlsx-reference-shift.mjs +189 -98
  490. package/src/runtime/office/portable/portable-xlsx-sheet-edits.mjs +26 -6
  491. package/src/runtime/office/portable/portable-xml.mjs +1 -4
  492. package/src/runtime/office/portable/text-metrics.mjs +14 -17
  493. package/src/runtime/office/portable/xlsx-contract.mjs +37 -3
  494. package/src/runtime/office/portable/xlsx-formula-engine.mjs +7 -1
  495. package/src/runtime/office/quality/assurance-checklist.mjs +1 -1
  496. package/src/runtime/office/quality/assurance-rendered.mjs +1 -1
  497. package/src/runtime/office/quality/assurance-structure-pptx.mjs +17 -8
  498. package/src/runtime/office/quality/assurance-structure.mjs +0 -2
  499. package/src/runtime/office/quality/design-aesthetics.mjs +2 -9
  500. package/src/runtime/office/quality/design-deck-diversity.mjs +2 -9
  501. package/src/runtime/office/quality/design-review.mjs +3 -3
  502. package/src/runtime/office/quality/pptx-slide-roles.mjs +3 -3
  503. package/src/runtime/office/shared/line-breaks.mjs +3 -1
  504. package/src/runtime/office/tool-defs.mjs +2 -2
  505. package/src/runtime/shared/async-log-appender.mjs +83 -0
  506. package/src/runtime/shared/automation-presence.mjs +9 -0
  507. package/src/runtime/shared/buffered-appender.mjs +10 -7
  508. package/src/runtime/shared/child-spawn-gate.mjs +2 -37
  509. package/src/runtime/shared/code-graph-state.mjs +84 -0
  510. package/src/runtime/shared/config.mjs +71 -89
  511. package/src/runtime/shared/context-inspection.mjs +56 -0
  512. package/src/runtime/shared/context-measurement.mjs +83 -0
  513. package/src/runtime/shared/device-paths.mjs +206 -0
  514. package/src/{standalone → runtime/shared}/fair-call-scheduler/owner-groups.mjs +1 -1
  515. package/src/runtime/shared/fair-call-scheduler.mjs +198 -0
  516. package/src/runtime/shared/file-lock.mjs +85 -55
  517. package/src/runtime/shared/http-request-body.mjs +3 -1
  518. package/src/runtime/shared/llm/anthropic-betas.mjs +46 -0
  519. package/src/runtime/shared/llm/anthropic-effort.mjs +378 -0
  520. package/src/runtime/shared/llm/anthropic-thinking-contract.mjs +29 -0
  521. package/src/runtime/shared/llm/cost.mjs +19 -10
  522. package/src/runtime/shared/llm/model-catalog-projection.mjs +182 -0
  523. package/src/runtime/shared/llm/model-catalog.mjs +799 -0
  524. package/src/runtime/shared/llm/model-pricing-rates.mjs +78 -0
  525. package/src/runtime/shared/llm/provider-catalog-cache.mjs +130 -0
  526. package/src/runtime/shared/llm/usage-accounting.mjs +12 -11
  527. package/src/runtime/shared/llm/usage-context.mjs +7 -0
  528. package/src/runtime/shared/llm/usage-ledger-import.mjs +14 -3
  529. package/src/runtime/shared/llm/usage-ledger-quota.mjs +97 -37
  530. package/src/runtime/shared/llm/usage-ledger-repair.mjs +3 -1
  531. package/src/runtime/shared/llm/usage-ledger-rollup.mjs +6 -10
  532. package/src/runtime/shared/llm/usage-ledger.mjs +6 -7
  533. package/src/runtime/shared/llm/usage-pricing-refresh.mjs +1 -1
  534. package/src/runtime/shared/llm/usage-rollup.mjs +0 -1
  535. package/src/runtime/shared/model-display.mjs +178 -0
  536. package/src/runtime/shared/notify-trace.mjs +14 -3
  537. package/src/runtime/shared/owner-fair-gate.mjs +1 -1
  538. package/src/runtime/shared/pending-json-projection.mjs +17 -0
  539. package/src/runtime/shared/pristine-execution.mjs +4 -3
  540. package/src/runtime/shared/process-lifecycle.mjs +18 -7
  541. package/src/runtime/shared/read-image-resize.mjs +399 -0
  542. package/src/runtime/shared/schedule-model-ref.mjs +2 -2
  543. package/src/runtime/shared/staged-update.mjs +7 -36
  544. package/src/runtime/shared/statusline/ansi.mjs +161 -0
  545. package/src/{ui → runtime/shared/statusline}/statusline-format.mjs +5 -5
  546. package/src/{ui → runtime/shared/statusline}/statusline-segments.mjs +54 -50
  547. package/src/runtime/shared/tool-card-model/background-task.mjs +1 -1
  548. package/src/runtime/shared/tool-card-model/card-detail.mjs +2 -2
  549. package/src/runtime/shared/tool-card-model/card-status.mjs +7 -5
  550. package/src/runtime/shared/tool-card-model/git-result.mjs +10 -0
  551. package/src/runtime/shared/tool-card-model/terminal-status.mjs +6 -2
  552. package/src/runtime/shared/tool-card-model.golden-cases.mjs +2 -1
  553. package/src/runtime/shared/tool-output-limit.mjs +60 -0
  554. package/src/runtime/shared/tool-primitives.mjs +1 -1
  555. package/src/runtime/shared/tool-result-summary.mjs +1 -0
  556. package/src/runtime/shared/tool-status.mjs +35 -2
  557. package/src/runtime/shared/transcript-metadata.mjs +1 -1
  558. package/src/runtime/shared/transcript-writer/transcript-file.mjs +1 -2
  559. package/src/runtime/shared/turn-snapshot-store.mjs +23 -17
  560. package/src/runtime/shared/turn-worktree-snapshot.mjs +8 -4
  561. package/src/runtime/shared/update-checker.mjs +1 -3
  562. package/src/runtime/tidy/apply.mjs +2 -2
  563. package/src/runtime/tidy/function-length.mjs +63 -0
  564. package/src/runtime/tidy/report.mjs +6 -3
  565. package/src/runtime/tidy/runners/shared.mjs +1 -0
  566. package/src/runtime/tidy/runners/shellcheck.mjs +1 -1
  567. package/src/runtime/tidy/tool.mjs +10 -3
  568. package/src/runtime/web-search/index.mjs +6 -17
  569. package/src/runtime/web-search/lib/cache.mjs +8 -54
  570. package/src/runtime/web-search/lib/config.mjs +2 -6
  571. package/src/runtime/web-search/lib/debounced-json-writer.mjs +62 -0
  572. package/src/runtime/web-search/lib/http-fetch.mjs +24 -112
  573. package/src/runtime/web-search/lib/package-version.mjs +10 -0
  574. package/src/runtime/web-search/lib/ssrf-guard.mjs +34 -28
  575. package/src/runtime/web-search/lib/state.mjs +8 -53
  576. package/src/runtime/web-search/lib/web-tools.mjs +5 -5
  577. package/src/session-runtime/agent-tool-routing.mjs +3 -9
  578. package/src/{runtime/shared → session-runtime}/automation-workflow.mjs +4 -4
  579. package/src/session-runtime/boot/apis.mjs +4 -5
  580. package/src/session-runtime/boot/begin.mjs +1 -1
  581. package/src/session-runtime/boot/config.mjs +2 -2
  582. package/src/session-runtime/boot/facade.mjs +2 -2
  583. package/src/session-runtime/boot/infrastructure.mjs +4 -4
  584. package/src/session-runtime/boot/providers.mjs +6 -6
  585. package/src/session-runtime/boot/session.mjs +1 -1
  586. package/src/session-runtime/boot/shared.mjs +5 -7
  587. package/src/session-runtime/boot/tools.mjs +6 -6
  588. package/src/session-runtime/bridge-first-use-gate.mjs +1 -1
  589. package/src/session-runtime/builtin-features.mjs +1 -193
  590. package/src/session-runtime/channel-config-api.mjs +3 -3
  591. package/src/session-runtime/config-helpers.mjs +1 -420
  592. package/src/session-runtime/config-lifecycle.mjs +2 -2
  593. package/src/session-runtime/cwd-plugins/core-memory-context.mjs +2 -2
  594. package/src/session-runtime/cwd-plugins/plugin-status.mjs +1 -1
  595. package/src/session-runtime/deferred-tool-delta.mjs +1 -101
  596. package/src/session-runtime/effort.mjs +1 -145
  597. package/src/session-runtime/goal-facade-api.mjs +1 -1
  598. package/src/session-runtime/goal-state.mjs +1 -325
  599. package/src/session-runtime/goal-tasks.mjs +1 -137
  600. package/src/session-runtime/goal-tool-defs.mjs +1 -140
  601. package/src/session-runtime/hook-payload.mjs +4 -5
  602. package/src/session-runtime/internal-tool-executor/bridge-tools.mjs +3 -3
  603. package/src/session-runtime/internal-tool-executor/caller-context.mjs +8 -0
  604. package/src/session-runtime/internal-tool-executor/feature-tools.mjs +3 -2
  605. package/src/session-runtime/internal-tool-executor/knowledge-tools.mjs +4 -6
  606. package/src/session-runtime/internal-tool-executor/workspace-tools.mjs +2 -2
  607. package/src/session-runtime/internal-tool-executor.mjs +1 -1
  608. package/src/session-runtime/lifecycle/inheritance.mjs +1 -1
  609. package/src/session-runtime/lifecycle/session-catalog.mjs +3 -3
  610. package/src/session-runtime/lifecycle/session-switch/resume.mjs +2 -2
  611. package/src/session-runtime/lifecycle/session-switch/session-delete.mjs +1 -1
  612. package/src/session-runtime/lifecycle/session-switch.mjs +1 -1
  613. package/src/session-runtime/lifecycle/shared.mjs +1 -1
  614. package/src/session-runtime/mcp-glue/connect.mjs +1 -1
  615. package/src/session-runtime/mcp-glue/server-catalog.mjs +1 -1
  616. package/src/session-runtime/mcp-glue/server-input.mjs +1 -1
  617. package/src/session-runtime/model-capabilities.mjs +1 -140
  618. package/src/session-runtime/model-recency.mjs +1 -1
  619. package/src/session-runtime/model-route/route-persist.mjs +2 -2
  620. package/src/session-runtime/model-route/route-tuning.mjs +3 -3
  621. package/src/session-runtime/model-route/set-route.mjs +6 -6
  622. package/src/session-runtime/model-route/web-search-route.mjs +5 -5
  623. package/src/session-runtime/model-route-api.mjs +1 -1
  624. package/src/session-runtime/native-web-search/routes.mjs +1 -1
  625. package/src/session-runtime/native-web-search/tool-shape.mjs +2 -2
  626. package/src/session-runtime/output-styles.mjs +2 -2
  627. package/src/session-runtime/prewarm/channel-start.mjs +1 -0
  628. package/src/session-runtime/provider-auth/accounts.mjs +7 -2
  629. package/src/session-runtime/provider-auth/login.mjs +1 -1
  630. package/src/session-runtime/provider-auth-api.mjs +1 -1
  631. package/src/session-runtime/provider-models/model-meta.mjs +1 -1
  632. package/src/session-runtime/provider-models/row-hydration.mjs +3 -3
  633. package/src/session-runtime/provider-usage.mjs +2 -2
  634. package/src/session-runtime/quick-model-rows/model-meta.mjs +1 -1
  635. package/src/session-runtime/quick-model-rows/provider-rows.mjs +1 -1
  636. package/src/session-runtime/quick-model-rows/web-search-rows.mjs +2 -2
  637. package/src/session-runtime/resource-api.mjs +2 -2
  638. package/src/session-runtime/resource-mcp-api.mjs +3 -3
  639. package/src/session-runtime/resource-plugins-api.mjs +3 -3
  640. package/src/session-runtime/resource-recall-api.mjs +2 -2
  641. package/src/session-runtime/resource-scope-decorate.mjs +2 -2
  642. package/src/session-runtime/route-resolution.mjs +3 -3
  643. package/src/session-runtime/route-state.mjs +4 -4
  644. package/src/session-runtime/runtime-bootstrap.mjs +1 -1
  645. package/src/session-runtime/runtime-facade.mjs +1 -1
  646. package/src/session-runtime/runtime-feature-gates.mjs +2 -2
  647. package/src/session-runtime/runtime-modules.mjs +3 -3
  648. package/src/session-runtime/runtime-paths.mjs +6 -2
  649. package/src/session-runtime/runtime-tool-routing.mjs +2 -2
  650. package/src/{runtime/shared → session-runtime}/schedule-session-run.mjs +5 -5
  651. package/src/{standalone → session-runtime/services}/agent-task-status.mjs +1 -1
  652. package/src/{standalone → session-runtime/services}/agent-tool/close-flow/close-all.mjs +2 -2
  653. package/src/{standalone → session-runtime/services}/agent-tool/close-flow.mjs +1 -1
  654. package/src/{standalone → session-runtime/services}/agent-tool/execute.mjs +1 -1
  655. package/src/{standalone → session-runtime/services}/agent-tool/helpers.mjs +6 -6
  656. package/src/session-runtime/services/agent-tool/index-write-queue.mjs +209 -0
  657. package/src/{standalone → session-runtime/services}/agent-tool/job-task-reconcile.mjs +2 -2
  658. package/src/{standalone → session-runtime/services}/agent-tool/job-views/job-lookup.mjs +5 -1
  659. package/src/{standalone → session-runtime/services}/agent-tool/job-views/job-render.mjs +1 -1
  660. package/src/session-runtime/services/agent-tool/job-views/session-progress.mjs +101 -0
  661. package/src/{standalone → session-runtime/services}/agent-tool/job-views/spawn-meta.mjs +1 -1
  662. package/src/session-runtime/services/agent-tool/job-views.mjs +59 -0
  663. package/src/session-runtime/services/agent-tool/lead-worker-index/index-file.mjs +48 -0
  664. package/src/{standalone → session-runtime/services}/agent-tool/lead-worker-index/row-settlement.mjs +3 -3
  665. package/src/{standalone → session-runtime/services}/agent-tool/lead-worker-index.mjs +10 -2
  666. package/src/{standalone → session-runtime/services}/agent-tool/notify/early-completion.mjs +2 -2
  667. package/src/{standalone → session-runtime/services}/agent-tool/notify.mjs +4 -4
  668. package/src/{standalone → session-runtime/services}/agent-tool/render.mjs +2 -2
  669. package/src/{standalone → session-runtime/services}/agent-tool/send-flow.mjs +6 -2
  670. package/src/{standalone → session-runtime/services}/agent-tool/spawn-flow/job-start.mjs +2 -2
  671. package/src/{standalone → session-runtime/services}/agent-tool/spawn-flow/spawn-plan.mjs +3 -3
  672. package/src/{standalone → session-runtime/services}/agent-tool/spawn-flow/spawn-prep.mjs +3 -3
  673. package/src/{standalone → session-runtime/services}/agent-tool/spawn-flow/spawn-run.mjs +3 -3
  674. package/src/{standalone → session-runtime/services}/agent-tool/spawn-preset.mjs +1 -1
  675. package/src/session-runtime/services/agent-tool/tag-registry.mjs +121 -0
  676. package/src/{standalone → session-runtime/services}/agent-tool/terminal-reaper/reap-timers.mjs +1 -1
  677. package/src/{standalone → session-runtime/services}/agent-tool/terminal-reaper/scan-admission.mjs +1 -1
  678. package/src/{standalone → session-runtime/services}/agent-tool/terminal-reaper/stale-rows.mjs +1 -1
  679. package/src/{standalone → session-runtime/services}/agent-tool/terminal-reaper/tombstones.mjs +5 -2
  680. package/src/session-runtime/services/agent-tool/tool-def.mjs +60 -0
  681. package/src/{standalone → session-runtime/services}/agent-tool/turn-review.mjs +1 -1
  682. package/src/{standalone → session-runtime/services}/agent-tool/worker-index/row-liveness.mjs +1 -1
  683. package/src/{standalone → session-runtime/services}/agent-tool/worker-index/row-store.mjs +46 -20
  684. package/src/{standalone → session-runtime/services}/agent-tool/worker-index.mjs +8 -1
  685. package/src/{standalone → session-runtime/services}/agent-tool/worker-rows.mjs +1 -1
  686. package/src/session-runtime/services/agent-tool.mjs +151 -0
  687. package/src/{standalone → session-runtime/services}/agent-watchdog-registry.mjs +1 -1
  688. package/src/{standalone → session-runtime/services}/channel-admin.mjs +8 -10
  689. package/src/{standalone → session-runtime/services}/channel-client.mjs +1 -1
  690. package/src/{standalone → session-runtime/services}/channel-session-router.mjs +1 -1
  691. package/src/{standalone → session-runtime/services}/channel-worker/client-heartbeat.mjs +1 -1
  692. package/src/{standalone → session-runtime/services}/channel-worker/daemon-attach.mjs +1 -1
  693. package/src/{standalone → session-runtime/services}/channel-worker/daemon-spawn.mjs +5 -5
  694. package/src/session-runtime/services/channel-worker.mjs +140 -0
  695. package/src/session-runtime/services/daemon-crash-capture/daemon-exit-record.mjs +189 -0
  696. package/src/{standalone → session-runtime/services}/daemon-crash-capture/retention.mjs +1 -1
  697. package/src/{standalone → session-runtime/services}/daemon-crash-capture/spawn-capture.mjs +12 -1
  698. package/src/{standalone → session-runtime/services}/daemon-crash-capture.mjs +6 -0
  699. package/src/{standalone → session-runtime/services}/hook-bus/command-handler.mjs +1 -1
  700. package/src/{standalone → session-runtime/services}/hook-bus/event-runner.mjs +1 -1
  701. package/src/{standalone → session-runtime/services}/hook-bus/handler-dispatch.mjs +1 -1
  702. package/src/{standalone → session-runtime/services}/hook-bus/handlers.mjs +5 -4
  703. package/src/{standalone → session-runtime/services}/hook-bus/rule-file.mjs +2 -2
  704. package/src/{standalone → session-runtime/services}/hook-bus/tool-gate.mjs +1 -1
  705. package/src/{standalone → session-runtime/services}/memory-runtime-proxy/client-registry.mjs +1 -1
  706. package/src/{standalone → session-runtime/services}/memory-runtime-proxy/daemon-spawn.mjs +4 -4
  707. package/src/{standalone → session-runtime/services}/memory-runtime-proxy/discovery.mjs +5 -5
  708. package/src/{standalone → session-runtime/services}/memory-runtime-proxy/owner-claim.mjs +2 -2
  709. package/src/{standalone → session-runtime/services}/memory-runtime-proxy/rpc.mjs +0 -4
  710. package/src/{standalone → session-runtime/services}/memory-runtime-proxy/start.mjs +1 -1
  711. package/src/{standalone → session-runtime/services}/memory-runtime-proxy/tool-wire.mjs +1 -1
  712. package/src/session-runtime/services/memory-runtime-proxy.mjs +130 -0
  713. package/src/{standalone → session-runtime/services}/plugin-admin.mjs +6 -6
  714. package/src/session-runtime/services/provider-admin.mjs +576 -0
  715. package/src/{standalone → session-runtime/services}/seeds.mjs +3 -3
  716. package/src/{standalone → session-runtime/services}/usage-dashboard-model.mjs +1 -1
  717. package/src/session-runtime/services/usage-dashboard.mjs +278 -0
  718. package/src/{standalone → session-runtime/services}/usage-stats-hours.mjs +1 -1
  719. package/src/session-runtime/services/usage-stats-model.mjs +657 -0
  720. package/src/session-runtime/services/usage-stats-period.mjs +178 -0
  721. package/src/session-runtime/session-create/materialize.mjs +3 -3
  722. package/src/session-runtime/session-create/session-options.mjs +14 -7
  723. package/src/session-runtime/session-lifecycle.mjs +2 -2
  724. package/src/session-runtime/settings-builtin-tools-api.mjs +1 -1
  725. package/src/session-runtime/setup-tool/executor.mjs +2 -2
  726. package/src/session-runtime/skills-api.mjs +2 -2
  727. package/src/session-runtime/statusline-route.mjs +1 -1
  728. package/src/session-runtime/tool-catalog.mjs +1 -753
  729. package/src/session-runtime/tool-defs.mjs +1 -149
  730. package/src/session-runtime/tool-policy-refresh.mjs +7 -5
  731. package/src/session-runtime/tool-surface.mjs +5 -5
  732. package/src/session-runtime/turn/agent-ops.mjs +2 -2
  733. package/src/session-runtime/turn/session-ops.mjs +2 -2
  734. package/src/session-runtime/turn/share-ops.mjs +4 -3
  735. package/src/session-runtime/turn/turn-run/turn-prepare.mjs +1 -1
  736. package/src/session-runtime/turn/turn-run/turn-settle.mjs +4 -4
  737. package/src/session-runtime/usage-stats-api.mjs +18 -2
  738. package/src/session-runtime/warmup/statusline-usage-warmup.mjs +2 -2
  739. package/src/{runtime/shared → session-runtime}/webhook-session-run.mjs +5 -5
  740. package/src/session-runtime/workflow-agents-api/agent-editor.mjs +2 -2
  741. package/src/session-runtime/workflow-agents-api/agent-route.mjs +4 -4
  742. package/src/session-runtime/workflow-agents-api/onboarding.mjs +2 -2
  743. package/src/session-runtime/workflow-agents-api/shared.mjs +4 -6
  744. package/src/session-runtime/workflow-agents-api/workflow-packs.mjs +1 -1
  745. package/src/session-runtime/workflow.mjs +1 -255
  746. package/src/standalone/agent-tool/job-views/session-progress.mjs +1 -101
  747. package/src/standalone/agent-tool/job-views.mjs +1 -59
  748. package/src/standalone/agent-tool/tag-registry.mjs +1 -121
  749. package/src/standalone/agent-tool/tool-def.mjs +1 -60
  750. package/src/standalone/agent-tool.mjs +1 -151
  751. package/src/standalone/channel-worker.mjs +1 -140
  752. package/src/standalone/daemon-agent-control.mjs +1 -1
  753. package/src/standalone/daemon-desktop-runtime.mjs +2 -2
  754. package/src/standalone/daemon-stored-session-views.mjs +1 -1
  755. package/src/standalone/daemon.mjs +38 -5
  756. package/src/standalone/fair-call-scheduler.mjs +1 -198
  757. package/src/standalone/folder-dialog.mjs +12 -8
  758. package/src/standalone/memory-runtime-proxy.mjs +1 -130
  759. package/src/standalone/provider-admin.mjs +1 -576
  760. package/src/standalone/session-client/frame-stream.mjs +1 -1
  761. package/src/standalone/session-client.mjs +2 -2
  762. package/src/standalone/session-service/agent-tree/agent-child.mjs +1 -1
  763. package/src/standalone/session-service/projection/transcript-window.mjs +2 -2
  764. package/src/standalone/usage-dashboard.mjs +1 -278
  765. package/src/standalone/usage-stats-model.mjs +1 -653
  766. package/src/standalone/usage-stats-period.mjs +1 -178
  767. package/src/tui/App.jsx +107 -256
  768. package/src/tui/app/app-view/floating-panel.jsx +3 -12
  769. package/src/tui/app/app-view/welcome-banner.jsx +36 -0
  770. package/src/tui/app/app-view.jsx +18 -45
  771. package/src/tui/app/create-app-pickers.mjs +1 -1
  772. package/src/tui/app/doctor.mjs +15 -1
  773. package/src/tui/app/extension-pickers/mcp-servers-picker.mjs +7 -3
  774. package/src/tui/app/maintenance-pickers/auto-clear-picker.mjs +5 -8
  775. package/src/tui/app/model-options.mjs +2 -3
  776. package/src/tui/app/model-picker/model-footer.mjs +1 -1
  777. package/src/tui/app/model-picker/route-selection.mjs +1 -3
  778. package/src/tui/app/mouse-input/button-gestures.mjs +13 -31
  779. package/src/tui/app/mouse-input/wheel-router.mjs +22 -32
  780. package/src/tui/app/picker-enter-latch.mjs +21 -0
  781. package/src/tui/app/picker-index-mode.mjs +34 -0
  782. package/src/tui/app/shell-layout/panel-transition.mjs +7 -12
  783. package/src/tui/app/shell-layout/row-budgets.mjs +4 -9
  784. package/src/tui/app/slash-palette.mjs +31 -0
  785. package/src/tui/app/text-layout.mjs +1 -1
  786. package/src/tui/app/theme-effort-pickers.mjs +1 -1
  787. package/src/tui/app/transcript-window.mjs +1 -5
  788. package/src/tui/app/usage-context-panels/context-model.mjs +1 -1
  789. package/src/tui/app/use-global-key-input.mjs +0 -1
  790. package/src/tui/app/use-interaction-refs.mjs +55 -0
  791. package/src/tui/app/use-onboarding-start.mjs +45 -0
  792. package/src/tui/app/use-panel-transition.mjs +40 -0
  793. package/src/tui/app/use-prompt-draft-flow.mjs +4 -13
  794. package/src/tui/app/use-prompt-layout-rows.mjs +39 -0
  795. package/src/tui/app/use-prompt-queue-history/prompt-history.mjs +1 -1
  796. package/src/tui/app/use-prompt-state.mjs +40 -0
  797. package/src/tui/app/use-selection-paint.mjs +9 -5
  798. package/src/tui/app/use-transcript-scroll-state.mjs +61 -0
  799. package/src/tui/app/use-transcript-window.mjs +0 -1
  800. package/src/tui/app/use-ui-open-request.mjs +18 -0
  801. package/src/tui/app/use-workflow-tab-cycle.mjs +39 -0
  802. package/src/tui/components/ContextInspector.jsx +1 -1
  803. package/src/tui/components/ContextPanel.jsx +1 -1
  804. package/src/tui/components/Picker.jsx +41 -322
  805. package/src/tui/components/PromptInput.jsx +34 -468
  806. package/src/tui/components/StatusLine.jsx +8 -555
  807. package/src/tui/components/TextEntryPanel.jsx +25 -211
  808. package/src/tui/components/ToolExecution.jsx +43 -328
  809. package/src/tui/components/UsagePanel.jsx +1 -1
  810. package/src/tui/components/picker/PickerItemRow.jsx +85 -0
  811. package/src/tui/components/picker/picker-layout.mjs +46 -0
  812. package/src/tui/components/picker/use-picker-input.mjs +165 -0
  813. package/src/tui/components/picker/use-picker-selection.mjs +67 -0
  814. package/src/tui/components/prompt-input/edit-chords.mjs +87 -0
  815. package/src/tui/components/prompt-input/edit-helpers.mjs +15 -12
  816. package/src/tui/components/prompt-input/escape-key.mjs +87 -0
  817. package/src/tui/components/prompt-input/key-handler.mjs +364 -0
  818. package/src/tui/components/status-line/boot-schedule.mjs +83 -0
  819. package/src/tui/components/status-line/local-line.mjs +213 -0
  820. package/src/tui/components/status-line/use-statusline-text.mjs +319 -0
  821. package/src/tui/components/statusline-module-loader.mjs +21 -0
  822. package/src/tui/components/text-entry-layout.mjs +104 -0
  823. package/src/tui/components/text-entry-value.jsx +47 -0
  824. package/src/tui/components/tool-execution/aggregate-card.jsx +141 -0
  825. package/src/tui/components/tool-execution/pending-placeholder.jsx +24 -0
  826. package/src/tui/components/tool-execution/standard-card.jsx +229 -0
  827. package/src/tui/components/tool-output-format.mjs +3 -5
  828. package/src/tui/dist/index.mjs +3616 -3022
  829. package/src/tui/index.jsx +85 -66
  830. package/src/tui/markdown/format-token.mjs +3 -3
  831. package/src/tui/paste-attachments.mjs +1 -1
  832. package/src/tui/prompt-history-store.mjs +17 -6
  833. package/src/tui/session/agent-envelope.mjs +1 -489
  834. package/src/tui/session/context-state.mjs +2 -2
  835. package/src/tui/session/goal-continuation/continuation-queue.mjs +1 -1
  836. package/src/tui/session/goal-continuation/deadline-delivery.mjs +1 -1
  837. package/src/tui/session/goal-continuation/goal-visibility.mjs +1 -1
  838. package/src/tui/session/initial-state.mjs +1 -1
  839. package/src/tui/session/live-share/wire.mjs +3 -0
  840. package/src/tui/session/oauth-flows.mjs +1 -7
  841. package/src/tui/session/session-api/commands.mjs +5 -3
  842. package/src/tui/session/session-api/controls.mjs +1 -1
  843. package/src/tui/session/session-api/intake/submission.mjs +8 -3
  844. package/src/tui/session/session-api/integrations.mjs +1 -1
  845. package/src/tui/session/session-api/routes.mjs +9 -8
  846. package/src/tui/session/session-api/settings.mjs +24 -23
  847. package/src/tui/session/session-api/shared.mjs +13 -2
  848. package/src/tui/session/session-api-ext.mjs +7 -415
  849. package/src/tui/session/session-flow/drain.mjs +86 -82
  850. package/src/tui/session/session-flow/queue.mjs +3 -1
  851. package/src/tui/session/tool-result-status.mjs +1 -354
  852. package/src/tui/session/tool-result-text.mjs +1 -157
  853. package/src/tui/session/transcript-intake.mjs +1 -1
  854. package/src/tui/session/transcript-spill/spill-dir.mjs +4 -1
  855. package/src/tui/session/transcript-spill/spill-writer.mjs +1 -1
  856. package/src/tui/session/tui-steering-persist.mjs +44 -86
  857. package/src/tui/session-local.mjs +8 -5
  858. package/src/tui/statusline-ansi-bridge.mjs +1 -1
  859. package/src/tui/theme.mjs +1 -1
  860. package/src/ui/ansi.mjs +1 -161
  861. package/src/ui/context-inspection.mjs +1 -56
  862. package/src/ui/context-measurement.mjs +1 -83
  863. package/src/ui/markdown.mjs +3 -3
  864. package/src/ui/model-display.mjs +1 -173
  865. package/src/ui/statusline-agents.mjs +22 -21
  866. package/src/ui/statusline.mjs +21 -24
  867. package/src/ui/stream-finalize.mjs +1 -1
  868. package/src/ui/tool-card.mjs +1 -1
  869. package/src/vendor/statusline/src/gateway/route-meta.mjs +157 -29
  870. package/scripts/fixtures/spawn-lease-child-harness.mjs +0 -8
  871. package/scripts/fixtures/spawn-lease-fixture-worker.mjs +0 -37
  872. package/src/runtime/agent/orchestrator/activity-bus.mjs +0 -31
  873. package/src/runtime/shared/child-spawn-remote.mjs +0 -210
  874. package/src/runtime/shared/session-runtime-health.mjs +0 -201
  875. package/src/standalone/agent-tool/lead-worker-index/index-file.mjs +0 -45
  876. package/src/standalone/session-runtime-agent-control-client.mjs +0 -117
  877. package/src/standalone/session-runtime-agent-control.mjs +0 -85
  878. package/src/standalone/session-runtime-host-factory.mjs +0 -22
  879. package/src/standalone/session-runtime-host.mjs +0 -742
  880. package/src/standalone/session-runtime-provider-cooldown.mjs +0 -78
  881. package/src/standalone/session-runtime-proxy.mjs +0 -164
  882. package/src/standalone/session-runtime-record.mjs +0 -18
  883. package/src/standalone/session-runtime-shard-router.mjs +0 -151
  884. package/src/standalone/session-runtime-spawn-leases.mjs +0 -82
  885. package/src/standalone/session-runtime-worker.mjs +0 -678
  886. package/src/standalone/session-runtime-workload.mjs +0 -98
  887. /package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/context-status-cache.mjs +0 -0
  888. /package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/deferred-tool-availability.mjs +0 -0
  889. /package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/goal-deadlines.mjs +0 -0
  890. /package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/goal-runtime.mjs +0 -0
  891. /package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/goal-store.mjs +0 -0
  892. /package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/goal-text.mjs +0 -0
  893. /package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/goal-tool-exec.mjs +0 -0
  894. /package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/provider-request-snapshot.mjs +0 -0
  895. /package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/provider-request-tools.mjs +0 -0
  896. /package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/tool-catalog-data.mjs +0 -0
  897. /package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/tool-profile.mjs +0 -0
  898. /package/src/{session-runtime → runtime/agent/orchestrator/runtime-core}/workflow/shared-scan-cache.mjs +0 -0
  899. /package/src/{standalone → runtime/shared}/fair-call-scheduler/queue-item.mjs +0 -0
  900. /package/src/runtime/{agent/orchestrator/providers → shared/llm}/provider-model-identities.mjs +0 -0
  901. /package/src/{standalone → runtime/shared}/projects.mjs +0 -0
  902. /package/src/{standalone → session-runtime/services}/agent-tool/execute-send.mjs +0 -0
  903. /package/src/{standalone → session-runtime/services}/agent-tool/execute-spawn.mjs +0 -0
  904. /package/src/{standalone → session-runtime/services}/agent-tool/job-views/agent-list.mjs +0 -0
  905. /package/src/{standalone → session-runtime/services}/agent-tool/lead-worker-index/lead-rows.mjs +0 -0
  906. /package/src/{standalone → session-runtime/services}/agent-tool/lead-worker-index/reap-timers.mjs +0 -0
  907. /package/src/{standalone → session-runtime/services}/agent-tool/provider-init.mjs +0 -0
  908. /package/src/{standalone → session-runtime/services}/agent-tool/spawn-flow/deferred-spawn.mjs +0 -0
  909. /package/src/{standalone → session-runtime/services}/agent-tool/spawn-flow.mjs +0 -0
  910. /package/src/{standalone → session-runtime/services}/agent-tool/tag-maps.mjs +0 -0
  911. /package/src/{standalone → session-runtime/services}/agent-tool/tag-registry/tag-lookup.mjs +0 -0
  912. /package/src/{standalone → session-runtime/services}/agent-tool/tag-registry/tag-refresh.mjs +0 -0
  913. /package/src/{standalone → session-runtime/services}/agent-tool/terminal-reaper/row-helpers.mjs +0 -0
  914. /package/src/{standalone → session-runtime/services}/agent-tool/terminal-reaper.mjs +0 -0
  915. /package/src/{standalone → session-runtime/services}/agent-tool/terminal-trace.mjs +0 -0
  916. /package/src/{standalone → session-runtime/services}/agent-tool/worker-index/mutation-batch.mjs +0 -0
  917. /package/src/{standalone → session-runtime/services}/agent-tool/worker-index/row-shape.mjs +0 -0
  918. /package/src/{standalone → session-runtime/services}/channel-client/daemon-request.mjs +0 -0
  919. /package/src/{standalone → session-runtime/services}/channel-client/notify-stream.mjs +0 -0
  920. /package/src/{standalone → session-runtime/services}/channel-client/reconnect.mjs +0 -0
  921. /package/src/{standalone → session-runtime/services}/channel-client/registration.mjs +0 -0
  922. /package/src/{standalone → session-runtime/services}/daemon-candidate.mjs +0 -0
  923. /package/src/{standalone → session-runtime/services}/daemon-crash-capture/paths.mjs +0 -0
  924. /package/src/{standalone → session-runtime/services}/hook-bus/config-loader.mjs +0 -0
  925. /package/src/{standalone → session-runtime/services}/hook-bus/config.mjs +0 -0
  926. /package/src/{standalone → session-runtime/services}/hook-bus/constants.mjs +0 -0
  927. /package/src/{standalone → session-runtime/services}/hook-bus/event-log.mjs +0 -0
  928. /package/src/{standalone → session-runtime/services}/hook-bus/handler-timeout.mjs +0 -0
  929. /package/src/{standalone → session-runtime/services}/hook-bus/payload.mjs +0 -0
  930. /package/src/{standalone → session-runtime/services}/hook-bus/rule-store.mjs +0 -0
  931. /package/src/{standalone → session-runtime/services}/hook-bus/rules.mjs +0 -0
  932. /package/src/{standalone → session-runtime/services}/hook-bus.mjs +0 -0
  933. /package/src/{standalone → session-runtime/services}/memory-runtime-proxy/calls.mjs +0 -0
  934. /package/src/{standalone → session-runtime/services}/memory-runtime-proxy/state.mjs +0 -0
  935. /package/src/{standalone → session-runtime/services}/sse-frames.mjs +0 -0
@@ -33,14 +33,7 @@ import { applyParsedWave, isPatchErrorText } from '../wave.mjs';
33
33
  // Convert the body to a unified patch (V4A / bare-@@ / counted-unified
34
34
  // fallback), split it into unique-target waves and pre-validate each. Returns
35
35
  // { error } for the outcomes the tool reports as text; parse failures throw.
36
- export async function prepareCodexBatch({
37
- patchStr,
38
- requestedFormat,
39
- basePath,
40
- preParsedV4ASections,
41
- v4aConvertOpts,
42
- mutationPlan,
43
- }) {
36
+ export async function prepareCodexBatch({ patchStr, requestedFormat, basePath, preParsedV4ASections, v4aConvertOpts }) {
44
37
  let inputPatchStr = patchStr;
45
38
  let v4aRenamePlan = null;
46
39
  if (isV4APatchInput(patchStr, requestedFormat)) {
@@ -49,12 +42,6 @@ export async function prepareCodexBatch({
49
42
  const allSections = coalesceCompatibleV4ASections(parsedSections, basePath);
50
43
  v4aRenamePlan = await planV4ARenameSections(allSections, basePath);
51
44
  inputPatchStr = await convertV4ASectionsToUnifiedPatch(v4aRenamePlan.remainingSections, basePath, v4aConvertOpts);
52
- if (v4aRenamePlan.renameSections.length > 0) {
53
- mutationPlan =
54
- v4aRenamePlan.remainingSections.length > 0
55
- ? { sourceTool: 'apply_patch', engine: 'v4a-patch', reason: 'v4a-mixed' }
56
- : { sourceTool: 'apply_patch', engine: 'v4a-rename', reason: 'v4a-move' };
57
- }
58
45
  } catch (err) {
59
46
  throw new Error(`apply_patch: V4A parse failed — ${err?.message || String(err)}`);
60
47
  }
@@ -72,7 +59,6 @@ export async function prepareCodexBatch({
72
59
  waveDispatch: [],
73
60
  v4aRenamePlan,
74
61
  v4aRenameOnly,
75
- mutationPlan,
76
62
  lockPaths: renameLockPaths(v4aRenamePlan, basePath),
77
63
  };
78
64
  }
@@ -90,11 +76,6 @@ export async function prepareCodexBatch({
90
76
  const sections = rewriteV4AReadRedirects(parseUnifiedCountedAsV4APatch(patchStr), basePath);
91
77
  inputPatchStr = await convertV4ASectionsToUnifiedPatch(sections, basePath, v4aConvertOpts);
92
78
  parsed = parsePatch(prepareInput(inputPatchStr));
93
- mutationPlan = {
94
- sourceTool: 'apply_patch',
95
- engine: 'v4a-patch',
96
- reason: 'unified-count-fallback',
97
- };
98
79
  } catch (fallbackErr) {
99
80
  throw new Error(
100
81
  `apply_patch: parse failed — ${err?.message || String(err)}; V4A fallback failed — ${fallbackErr?.message || String(fallbackErr)}`
@@ -134,7 +115,7 @@ export async function prepareCodexBatch({
134
115
  ...new Set(waveDispatch.flatMap((wd) => wd.entries.map((entry) => entry.fullPath))),
135
116
  ...renameLockPaths(v4aRenamePlan, basePath),
136
117
  ];
137
- return { waveDispatch, v4aRenamePlan, v4aRenameOnly, mutationPlan, lockPaths };
118
+ return { waveDispatch, v4aRenamePlan, v4aRenameOnly, lockPaths };
138
119
  }
139
120
 
140
121
  function renameLockPaths(v4aRenamePlan, basePath) {
@@ -147,7 +128,7 @@ function renameLockPaths(v4aRenamePlan, basePath) {
147
128
  // Apply the validated batch in one shot: renames first, then the single wave
148
129
  // via applyParsedWave (native + JS split). Returns the model-surface text.
149
130
  export async function runCodexBatch({ batch, basePath, v4aConvertOpts, rejectedV4AHunks, waveOpts }) {
150
- const { waveDispatch, v4aRenamePlan, v4aRenameOnly, mutationPlan } = batch;
131
+ const { waveDispatch, v4aRenamePlan, v4aRenameOnly } = batch;
151
132
  let v4aRenameResults = [];
152
133
  if (v4aRenamePlan?.renameSections?.length) {
153
134
  v4aRenameResults = await applyV4ARenameSections(v4aRenamePlan.renameSections, basePath, v4aConvertOpts);
@@ -155,18 +136,17 @@ export async function runCodexBatch({ batch, basePath, v4aConvertOpts, rejectedV
155
136
  if (v4aRenameOnly) {
156
137
  const lines = formatV4ARenameSuccessLines(v4aRenameResults);
157
138
  if (lines.length === 0) return 'Error: patch contained no applicable file sections';
158
- return wrapPatchMutationOutput(`${lines.join('\n')}\n`, mutationPlan, { executor: 'v4a-rename' });
139
+ return wrapPatchMutationOutput(`${lines.join('\n')}\n`);
159
140
  }
160
141
  const res = await applyParsedWave(waveDispatch[0], basePath, waveOpts);
161
- const executor = res.executor;
162
- if (res.error) return wrapPatchMutationOutput(res.error, mutationPlan, { executor });
142
+ if (res.error) return wrapPatchMutationOutput(res.error);
163
143
  let combined = res.text;
164
144
  if (!isPatchErrorText(combined)) {
165
145
  const renameLines = formatV4ARenameSuccessLines(v4aRenameResults);
166
146
  if (renameLines.length > 0) combined = `${renameLines.join('\n')}\n${combined}`;
167
147
  combined += rejectedHunkTail(rejectedV4AHunks);
168
148
  }
169
- return wrapPatchMutationOutput(combined, mutationPlan, { executor });
149
+ return wrapPatchMutationOutput(combined);
170
150
  }
171
151
 
172
152
  // Codex mode applies the validated batch in one shot. A batch that mixes
@@ -1,7 +1,6 @@
1
1
  // apply_patch request intake: argument salvage, body/format validation, the
2
2
  // abort signal, base path and the option flags every execution path shares.
3
3
  import { getAbortSignalForSession } from '../../../session/abort-lookup.mjs';
4
- import { planApplyPatchMutationRoute } from '../mutation-output.mjs';
5
4
  import { isCompactedPlaceholderPatch, salvageV4AOpening } from '../parsing.mjs';
6
5
  import { resolveBasePath } from '../paths.mjs';
7
6
 
@@ -65,7 +64,6 @@ export async function resolveApplyPatchRequest(rawArgs, cwd, options = {}) {
65
64
  if (requestedFormat && requestedFormat !== 'unified' && requestedFormat !== 'v4a') {
66
65
  throw new Error('apply_patch: "format" must be "unified" or "v4a"');
67
66
  }
68
- const mutationPlan = options?.mutationPlan || planApplyPatchMutationRoute(args, patchStr, requestedFormat);
69
67
  const readStateScope = options?.readStateScope ?? options?.sessionId ?? null;
70
68
  let abortSignal = options?.signal || options?.abortSignal || null;
71
69
  if (!abortSignal && options?.sessionId) {
@@ -84,7 +82,6 @@ export async function resolveApplyPatchRequest(rawArgs, cwd, options = {}) {
84
82
  args,
85
83
  patchStr,
86
84
  requestedFormat,
87
- mutationPlan,
88
85
  readStateScope,
89
86
  abortSignal,
90
87
  basePath,
@@ -1,6 +1,7 @@
1
1
  // What a native apply reports: the io/patch trace lines and the human-readable
2
2
  // summary the model receives.
3
- import { ioTrace, nativePatchTraceEnabled, patchTraceEnabled } from '../native-server.mjs';
3
+ import { ioTrace } from '../../io-trace.mjs';
4
+ import { nativePatchTraceEnabled, patchTraceEnabled } from '../native-server.mjs';
4
5
 
5
6
  const ms = (value) => Number(value.toFixed(3));
6
7
 
@@ -26,6 +26,7 @@ import {
26
26
  parsedEntryResolvedPath,
27
27
  countHunkChanges,
28
28
  pathKey,
29
+ specialFilePatchMessage,
29
30
  } from './paths.mjs';
30
31
  import { NATIVE_PATCH_TRANSPORT_DEAD, runServerApply, scheduleNativePatchIdleClose } from './native-server.mjs';
31
32
  import {
@@ -270,11 +271,7 @@ function applyUnifiedHunksToLines(sourceLines, hunks, { fuzz, displayPath, eol }
270
271
 
271
272
  function lstatRegularPatchFile(fullPath, displayPath) {
272
273
  const st = lstatSync(fullPath);
273
- if (isSpecialFileStat(st)) {
274
- throw new Error(
275
- `apply_patch: cannot patch special file (FIFO / character / block device / socket): ${normalizeOutputPath(displayPath)}`
276
- );
277
- }
274
+ if (isSpecialFileStat(st)) throw new Error(specialFilePatchMessage(displayPath));
278
275
  return st;
279
276
  }
280
277
 
@@ -299,11 +296,7 @@ function resolvePatchWriteTarget(fullPath, displayPath, lst) {
299
296
  ` (${err?.code || err?.message || String(err)})`
300
297
  );
301
298
  }
302
- if (isSpecialFileStat(snapshotStat)) {
303
- throw new Error(
304
- `apply_patch: cannot patch special file (FIFO / character / block device / socket): ${normalizeOutputPath(displayPath)}`
305
- );
306
- }
299
+ if (isSpecialFileStat(snapshotStat)) throw new Error(specialFilePatchMessage(displayPath));
307
300
  if (!snapshotStat.isFile()) {
308
301
  throw new Error(`apply_patch: symlink target is not a regular file: ${normalizeOutputPath(displayPath)}`);
309
302
  }
@@ -658,7 +658,7 @@ function escapeNonAsciiForPatch(line) {
658
658
  return out;
659
659
  }
660
660
 
661
- export function findLineSequenceEscapeEquiv(sourceLines, pattern, minStart, _preferred) {
661
+ export function findLineSequenceEscapeEquiv(sourceLines, pattern, minStart) {
662
662
  if (!pattern || pattern.length === 0) return -1;
663
663
  const starts = [];
664
664
  const from = Math.max(0, Number.isFinite(minStart) ? minStart : 0);
@@ -1,24 +1,11 @@
1
- // Mutation-route planning and the model-surface output wrapper shared by the
2
- // Codex batch and the ordered sequence.
3
- import { hasUnifiedBareV4AHunk, isV4APatchInput } from './parsing.mjs';
1
+ // Model-surface output wrapper shared by the Codex batch and the ordered
2
+ // sequence.
4
3
  import { drainV4AAmbiguityNotices } from './v4a-convert.mjs';
5
4
 
6
- export function planApplyPatchMutationRoute(_args, patchStr, requestedFormat) {
7
- const v4aInput =
8
- isV4APatchInput(patchStr, requestedFormat) || (requestedFormat !== 'unified' && hasUnifiedBareV4AHunk(patchStr));
9
- return {
10
- sourceTool: 'apply_patch',
11
- engine: v4aInput ? 'v4a-patch' : 'unified-patch',
12
- reason: 'direct',
13
- };
14
- }
15
-
16
- // Model-surface success outputs deliberately DROP the `mutation_route:`
17
- // diagnostic header (the surface stays `Success. Updated the following files:`).
18
- // Errors were never wrapped, the UI diff side-channel is independent, and no
19
- // script/UI parses the header — measured saving ~30 tokens x ~125 successful
20
- // patch calls/day. Route diagnostics stay available via plan/extras callers.
21
- export function wrapPatchMutationOutput(text, _plan, _extras = {}) {
5
+ // Model-surface success outputs deliberately carry no `mutation_route:`
6
+ // diagnostic header (the surface stays `Success. Updated the following files:`);
7
+ // no script/UI parses one, and dropping it saves ~30 tokens per successful patch call.
8
+ export function wrapPatchMutationOutput(text) {
22
9
  // Per-file success rows already identify the edits; retain warnings/errors.
23
10
  text = text.replace(/^Applied \d+ Files? \((?:Native|JS)\)\r?\n(?= {2}OK )/gm, '');
24
11
  // Non-fatal duplicate-context notices ride the success output: the edit
@@ -17,7 +17,7 @@ import { performance } from 'node:perf_hooks';
17
17
  import { packageNativeToolPath } from '../../../../shared/native-tool-paths.mjs';
18
18
  import { getPluginData } from '../../config.mjs';
19
19
  import { ensurePatchBinary, findCachedPatchBinary } from '../patch-binary-fetcher.mjs';
20
- import { envFlag } from '../../../../shared/env.mjs';
20
+ import { ioTraceEnabled } from '../io-trace.mjs';
21
21
 
22
22
  const PLUGIN_ROOT =
23
23
  process.env.MIXDOG_ROOT ||
@@ -54,17 +54,6 @@ export function nativePatchTraceEnabled() {
54
54
  return /^(1|true|yes)$/i.test(process.env.MIXDOG_PATCH_NATIVE_TRACE || '');
55
55
  }
56
56
 
57
- function ioTraceEnabled() {
58
- return envFlag('MIXDOG_IO_TRACE');
59
- }
60
-
61
- export function ioTrace(event, fields = {}) {
62
- if (!ioTraceEnabled()) return;
63
- try {
64
- process.stderr.write(`[io-trace] ${JSON.stringify({ event, ts: Date.now(), ...fields })}\n`);
65
- } catch {}
66
- }
67
-
68
57
  export function patchTraceEnabled() {
69
58
  return (
70
59
  ioTraceEnabled() ||
@@ -92,9 +81,10 @@ function nativePatchPersistent() {
92
81
  // The engine contract is proven by the RUNNING SESSION, never by a separate
93
82
  // probe of a path: the process that will execute the work ANSWERS `CONTRACT`
94
83
  // over the real protocol — bytes that merely appear (a startup printer) are
95
- // not an answer, and the artifact judged is always the one about to run. A wrapper that prints the marker cannot serve the
96
- // protocol, a swapped artifact cannot change a process that is already
97
- // running, and one session means one verification for any number of callers.
84
+ // not an answer, and the artifact judged is always the one about to run. A
85
+ // wrapper that prints the marker cannot serve the protocol, a swapped artifact
86
+ // cannot change a process that is already running, and one session means one
87
+ // verification for any number of callers.
98
88
  // The marker search below is only a negative pre-filter (skip spawning an
99
89
  // artifact that cannot possibly answer); it is never the proof.
100
90
  export const NATIVE_PATCH_ENGINE_CONTRACT = 'mixdog-patch-engine-contract:3';
@@ -34,7 +34,7 @@ async function apply_patch(rawArgs, cwd, options = {}) {
34
34
  }
35
35
  const rejectedV4AHunks = [];
36
36
  const v4aConvertOpts = { rejectPartial, rejectedHunks: rejectedV4AHunks, fuzzy, dryRun, readStateScope };
37
- const route = selectApplyPatchRoute({ args, patchStr, requestedFormat, basePath, readStateScope });
37
+ const route = selectApplyPatchRoute({ args, patchStr, requestedFormat, basePath });
38
38
  if (route.useSequence) {
39
39
  const seqOut = await applyPatchSequence(patchStr, requestedFormat, basePath, {
40
40
  v4aConvertOpts,
@@ -44,7 +44,6 @@ async function apply_patch(rawArgs, cwd, options = {}) {
44
44
  rejectPartial,
45
45
  readStateScope,
46
46
  abortSignal,
47
- mutationPlan: request.mutationPlan,
48
47
  toolCallId: options?.toolCallId || null,
49
48
  sessionId: options?.sessionId || null,
50
49
  replayCapture: options?.replayCapture || null,
@@ -60,7 +59,6 @@ async function apply_patch(rawArgs, cwd, options = {}) {
60
59
  readStateScope,
61
60
  preParsedV4ASections: route.preParsedV4ASections,
62
61
  v4aConvertOpts,
63
- mutationPlan: request.mutationPlan,
64
62
  });
65
63
  if (batch.error) return batch.error;
66
64
  return applyCodexBatchWithRollback({
@@ -18,6 +18,10 @@ export function stripDiffPrefix(name) {
18
18
  return m ? m[1] : name;
19
19
  }
20
20
 
21
+ export function specialFilePatchMessage(displayPath) {
22
+ return `apply_patch: cannot patch special file (FIFO / character / block device / socket): ${normalizeOutputPath(displayPath)}`;
23
+ }
24
+
21
25
  export function resolveEntryPath(basePath, rawName) {
22
26
  // A parsed entry without a header path (jsdiff parses arbitrary non-diff
23
27
  // text into a headerless entry) must fail as a patch-format error, not as a
@@ -10,7 +10,6 @@ export async function runPatchUnits(units, basePath, { waveOpts, abortSignal, co
10
10
  const failures = [];
11
11
  let failed = null;
12
12
  let failedIndex = -1;
13
- let executor = 'native-patch';
14
13
  const noteFailure = (unit, index, error) => {
15
14
  const row = { displayPath: unit.displayPath, error, index };
16
15
  failures.push(row);
@@ -59,12 +58,11 @@ export async function runPatchUnits(units, basePath, { waveOpts, abortSignal, co
59
58
  continue;
60
59
  }
61
60
  const res = await applyParsedWave(wave, basePath, waveOpts);
62
- executor = res.executor;
63
61
  if (res.error) {
64
62
  noteFailure(unit, i, res.error);
65
63
  continue;
66
64
  }
67
65
  applied.push({ displayPath: unit.displayPath, text: res.text });
68
66
  }
69
- return { applied, skipped, failures, failed, failedIndex, executor };
67
+ return { applied, skipped, failures, failed, failedIndex };
70
68
  }
@@ -64,17 +64,11 @@ function sectionUnit(section, basePath, { v4aConvertOpts, readStateScope, dryRun
64
64
  }
65
65
 
66
66
  function parsedEntryUnit(entry, basePath) {
67
- const headerName = entryHeaderName(entry);
68
- if (!headerName) {
69
- throw new Error(
70
- 'apply_patch: a file section header could not be parsed (no target path) — the patch body is not a valid diff. ' +
71
- 'Each section must start with `*** Update File: <path>` / `*** Add File: <path>` / `*** Delete File: <path>` ' +
72
- '(V4A, wrapped in `*** Begin Patch` / `*** End Patch`), or a `--- a/<path>` + `+++ b/<path>` pair (unified).'
73
- );
74
- }
67
+ // Throws the "header could not be parsed (no target path)" error for a headerless entry.
68
+ const fullPath = parsedEntryResolvedPath(entry, basePath);
75
69
  return {
76
- displayPath: normalizeOutputPath(stripDiffPrefix(headerName)),
77
- fullPath: parsedEntryResolvedPath(entry, basePath),
70
+ displayPath: normalizeOutputPath(stripDiffPrefix(entryHeaderName(entry))),
71
+ fullPath,
78
72
  buildParsed: async () => [entry],
79
73
  };
80
74
  }
@@ -23,7 +23,6 @@ export async function applyPatchSequence(patchStr, requestedFormat, basePath, ct
23
23
  rejectPartial,
24
24
  readStateScope,
25
25
  abortSignal,
26
- mutationPlan,
27
26
  toolCallId,
28
27
  sessionId,
29
28
  replayCapture = null,
@@ -78,7 +77,7 @@ export async function applyPatchSequence(patchStr, requestedFormat, basePath, ct
78
77
  rejectedHunks: v4aConvertOpts?.rejectedHunks,
79
78
  continueAfterFailure,
80
79
  });
81
- return wrapPatchMutationOutput(report, mutationPlan, { executor: outcome.executor });
80
+ return wrapPatchMutationOutput(report);
82
81
  })
83
82
  );
84
83
  }
@@ -10,7 +10,7 @@ import { atomicWrite } from '../builtin/atomic-write.mjs';
10
10
  import { assertPathReachable, assertPathsReachable } from '../builtin/fs-reachability.mjs';
11
11
  import { markCodeGraphDirtyPaths } from '../code-graph-state.mjs';
12
12
  import { isSpecialFileStat } from '../builtin/device-paths.mjs';
13
- import { pathKey, resolveV4AEntryPath } from './paths.mjs';
13
+ import { pathKey, resolveV4AEntryPath, specialFilePatchMessage } from './paths.mjs';
14
14
  import { isV4AEndOfFileMarker } from './parsing.mjs';
15
15
  import {
16
16
  findLineSequence,
@@ -262,7 +262,7 @@ function recoverHunkWindow(sourceLines, hunk, stats, anchorLine, window, eof) {
262
262
  if (windowUnlocated(window)) {
263
263
  if (eof) window.eofSignalIgnored = true;
264
264
  const from = Math.max(0, anchorLine - 1);
265
- const alt = findLineSequenceEscapeEquiv(sourceLines, window.oldLinesPattern, from, from);
265
+ const alt = findLineSequenceEscapeEquiv(sourceLines, window.oldLinesPattern, from);
266
266
  if (alt >= 0) adoptRemappedWindow(sourceLines, window, alt);
267
267
  }
268
268
  // Context-tolerance tier: see findContextTolerantWindow. Tolerated context
@@ -494,15 +494,9 @@ function renameTargetsSamePhysicalFile(srcFull, destFull) {
494
494
  }
495
495
  }
496
496
 
497
- function v4aSpecialFileStatMessage(displayPath) {
498
- return `apply_patch: cannot patch special file (FIFO / character / block device / socket): ${normalizeOutputPath(displayPath)}`;
499
- }
500
-
501
497
  function lstatV4APatchTarget(fullPath, displayPath) {
502
498
  const st = lstatSync(fullPath);
503
- if (isSpecialFileStat(st)) {
504
- throw new Error(v4aSpecialFileStatMessage(displayPath));
505
- }
499
+ if (isSpecialFileStat(st)) throw new Error(specialFilePatchMessage(displayPath));
506
500
  return st;
507
501
  }
508
502
 
@@ -537,7 +531,7 @@ export function validateV4ARenameSection(section, basePath, seenDestKeys) {
537
531
  function v4aRenameSourceIssue(srcFull, displayPath) {
538
532
  try {
539
533
  const st = lstatSync(srcFull);
540
- if (isSpecialFileStat(st)) return v4aSpecialFileStatMessage(displayPath);
534
+ if (isSpecialFileStat(st)) return specialFilePatchMessage(displayPath);
541
535
  if (!st.isFile())
542
536
  return `apply_patch: V4A rename source is not a regular file: ${normalizeOutputPath(displayPath)}`;
543
537
  } catch (err) {
@@ -549,7 +543,7 @@ function v4aRenameSourceIssue(srcFull, displayPath) {
549
543
  function v4aRenameDestinationIssue(srcFull, destFull, displayPath, caseOnlyRename) {
550
544
  try {
551
545
  const destSt = lstatSync(destFull);
552
- if (isSpecialFileStat(destSt)) return v4aSpecialFileStatMessage(displayPath);
546
+ if (isSpecialFileStat(destSt)) return specialFilePatchMessage(displayPath);
553
547
  if (destSt.isDirectory()) {
554
548
  return `apply_patch: V4A rename destination is a directory: ${normalizeOutputPath(displayPath)}`;
555
549
  }
@@ -11,7 +11,7 @@
11
11
  // { bundledManifest, download }.
12
12
 
13
13
  import { join } from 'node:path';
14
- import { fileURLToPath } from 'node:url';
14
+ import { BUNDLED_PATCH_MANIFEST_PATH as BUNDLED_MANIFEST_PATH } from './patch-manifest-path.mjs';
15
15
  import {
16
16
  binSuffix,
17
17
  createBinaryDownloader,
@@ -28,7 +28,6 @@ import {
28
28
  validSha256,
29
29
  } from '../../../shared/native-asset.mjs';
30
30
 
31
- const BUNDLED_MANIFEST_PATH = fileURLToPath(new URL('./patch-manifest.json', import.meta.url));
32
31
  const MANIFEST_URL =
33
32
  'https://raw.githubusercontent.com/tribgames/mixdog/main/src/runtime/agent/orchestrator/tools/patch-manifest.json';
34
33
 
@@ -0,0 +1,3 @@
1
+ import { fileURLToPath } from 'node:url';
2
+
3
+ export const BUNDLED_PATCH_MANIFEST_PATH = fileURLToPath(new URL('./patch-manifest.json', import.meta.url));
@@ -1,30 +1,30 @@
1
1
  {
2
- "version": "0.7.32",
2
+ "version": "0.7.33",
3
3
  "_comment": "Rewritten by .github/workflows/patch-release.yml on each tagged release. assets maps platformKey (process.platform-process.arch, e.g. win32-x64, linux-x64, darwin-arm64) to { url, sha256 } of the mixdog-patch binary on the GitHub release. A local cargo build under native/mixdog-patch/target/release always takes precedence; otherwise the binary is fetched per this manifest into the data dir (apply is native-only — no JS apply engine).",
4
4
  "assets": {
5
5
  "darwin-arm64": {
6
- "url": "https://github.com/tribgames/mixdog/releases/download/patch-v0.7.32/mixdog-patch-darwin-arm64",
7
- "sha256": "56739a16777fa0823394b5df26b09a657f1f783dc53dfbb868b4bdc763b4b7f3"
6
+ "url": "https://github.com/tribgames/mixdog/releases/download/patch-v0.7.33/mixdog-patch-darwin-arm64",
7
+ "sha256": "c2cb3b4a7e519aa9ddf97537578cf31eae48c371453f46b4501f46b16311c0a5"
8
8
  },
9
9
  "darwin-x64": {
10
- "url": "https://github.com/tribgames/mixdog/releases/download/patch-v0.7.32/mixdog-patch-darwin-x64",
11
- "sha256": "b1fc701932f6305e918d9e868f0b11bcedac62db578e0b115fb956706337418a"
10
+ "url": "https://github.com/tribgames/mixdog/releases/download/patch-v0.7.33/mixdog-patch-darwin-x64",
11
+ "sha256": "a4a138765dfc76b39fa3ea20638c0526eb857a19f6d8ea59b0e02f3f552bbaf8"
12
12
  },
13
13
  "linux-arm64": {
14
- "url": "https://github.com/tribgames/mixdog/releases/download/patch-v0.7.32/mixdog-patch-linux-arm64",
14
+ "url": "https://github.com/tribgames/mixdog/releases/download/patch-v0.7.33/mixdog-patch-linux-arm64",
15
15
  "sha256": "8ba081125ab7658a3353ced9dd487d393dc8b252ac98636da3b8745724798e68"
16
16
  },
17
17
  "linux-x64": {
18
- "url": "https://github.com/tribgames/mixdog/releases/download/patch-v0.7.32/mixdog-patch-linux-x64",
19
- "sha256": "99701f20e073d7e27f9d9336a8a505467b593d9745c856a2f7765f2bc2ef813d"
18
+ "url": "https://github.com/tribgames/mixdog/releases/download/patch-v0.7.33/mixdog-patch-linux-x64",
19
+ "sha256": "bec7bdfc1129d5e99d15c7bc961a2b865868a68e0163a65b506be2aa70ad0bff"
20
20
  },
21
21
  "win32-arm64": {
22
- "url": "https://github.com/tribgames/mixdog/releases/download/patch-v0.7.32/mixdog-patch-win32-arm64.exe",
23
- "sha256": "f0a1b2088239da8cfbc5becdc8e06582ecead2d474c64835c44a98d7c398e129"
22
+ "url": "https://github.com/tribgames/mixdog/releases/download/patch-v0.7.33/mixdog-patch-win32-arm64.exe",
23
+ "sha256": "85374d85f5e966f9ba82f52ed58c799339d591a1afa32a4902ae0c8715506cb5"
24
24
  },
25
25
  "win32-x64": {
26
- "url": "https://github.com/tribgames/mixdog/releases/download/patch-v0.7.32/mixdog-patch-win32-x64.exe",
27
- "sha256": "22b9914b8288c93cd734e62859975fb57f81060c32b7411f169b83969842b6e0"
26
+ "url": "https://github.com/tribgames/mixdog/releases/download/patch-v0.7.33/mixdog-patch-win32-x64.exe",
27
+ "sha256": "b0826bb2e7462d072fdc2250fc42662d7da80589d0589a4c4781decc1fd5f008"
28
28
  }
29
29
  }
30
30
  }
@@ -15,6 +15,7 @@
15
15
  // (lib/shell-run-settle.mjs) and the auto-background promotion
16
16
  // (lib/shell-run-background.mjs). This module owns admission, preflight and
17
17
  // the wiring between those phases.
18
+ import { startBackgroundTask } from '../../../shared/background-tasks.mjs';
18
19
  import { resourceAdmission } from '../../../shared/resource-admission.mjs';
19
20
  import { ExecResult, treeKill } from './shell-exec-output.mjs';
20
21
  import {
@@ -70,6 +71,7 @@ function _admissionSaturationError(admission, waitMs) {
70
71
  'check task list, cancel stale tasks, kill lingering child processes, or restart the CLI.'
71
72
  );
72
73
  error.code = 'ERESOURCEPRESSURE';
74
+ error.admissionSaturated = true;
73
75
  return error;
74
76
  }
75
77
 
@@ -119,7 +121,7 @@ function _abortableDelay(ms, signal) {
119
121
  * guess. (A union of "plausible" families was worse than the ambiguity: it
120
122
  * rewrote a valid CMD `echo literal ^&` into `echo literal ^`.) */
121
123
  // Arguments are accepted for call-site convenience but never classify.
122
- export function _shellFamilyForSpawn({ shell = '', shellArg: _shellArg = '', shellArgs: _shellArgs = null } = {}) {
124
+ export function _shellFamilyForSpawn({ shell = '' } = {}) {
123
125
  const name = String(shell || '')
124
126
  .toLowerCase()
125
127
  .replace(/\.exe$/, '')
@@ -139,9 +141,9 @@ export function _shellFamilyForSpawn({ shell = '', shellArg: _shellArg = '', she
139
141
 
140
142
  async function acquireShellLeaseBounded(
141
143
  admission,
142
- { abortSignal, label, dependency = 'scoped', ownerKey = null } = {}
144
+ { abortSignal, label, dependency = 'scoped', ownerKey = null, waitMs = SHELL_ADMISSION_WAIT_MS } = {}
143
145
  ) {
144
- if (!(SHELL_ADMISSION_WAIT_MS > 0)) {
146
+ if (!(waitMs > 0)) {
145
147
  return admission.acquire('shell', {
146
148
  signal: abortSignal || null,
147
149
  label,
@@ -163,12 +165,12 @@ async function acquireShellLeaseBounded(
163
165
  if (abortSignal.aborted) onAbort();
164
166
  else abortSignal.addEventListener('abort', onAbort, { once: true });
165
167
  }
166
- const deadlineAt = Date.now() + SHELL_ADMISSION_WAIT_MS;
168
+ const deadlineAt = Date.now() + waitMs;
167
169
  const deadline = setTimeout(() => {
168
170
  try {
169
- ctl.abort(_admissionSaturationError(admission, SHELL_ADMISSION_WAIT_MS));
171
+ ctl.abort(_admissionSaturationError(admission, waitMs));
170
172
  } catch {}
171
- }, SHELL_ADMISSION_WAIT_MS);
173
+ }, waitMs);
172
174
  if (deadline.unref) deadline.unref();
173
175
  try {
174
176
  for (;;) {
@@ -215,11 +217,12 @@ const failedResult = (run, stderr, failureReason) =>
215
217
 
216
218
  // Admission lease, policy preflight, then the spawn. Resolves the run with a
217
219
  // tool-phase failure and returns false when the command never reaches a shell.
218
- async function admitAndSpawn(run, params) {
220
+ async function admitAndSpawn(run, params, { admissionWaitMs, onSaturated }) {
219
221
  const { admission, command, ownerSessionId, abortSignal } = params;
220
222
  try {
221
223
  run.resourceLease = await acquireShellLeaseBounded(admission, {
222
224
  abortSignal,
225
+ waitMs: admissionWaitMs,
223
226
  label: String(command || '').slice(0, 120),
224
227
  ownerKey: ownerSessionId,
225
228
  });
@@ -232,6 +235,7 @@ async function admitAndSpawn(run, params) {
232
235
  await spawnShellChild({ run, ...params });
233
236
  return true;
234
237
  } catch (err) {
238
+ if (err?.admissionSaturated && !abortSignal?.aborted && onSaturated(err)) return false;
235
239
  const cleanupError = await releaseResourceLease(run);
236
240
  const spawnText = String(err?.message || err);
237
241
  const cleanupText = cleanupError
@@ -248,6 +252,61 @@ async function admitAndSpawn(run, params) {
248
252
  }
249
253
  }
250
254
 
255
+ // A saturated shell lane must not fail the call: the command becomes a tracked
256
+ // background task that waits (no admission ceiling) for a lease, runs, and
257
+ // completes like any other task. The call returns its task_id immediately.
258
+ function queueSaturatedAsTask(run, saturation, spec) {
259
+ const queuedAbort = new AbortController();
260
+ let task;
261
+ try {
262
+ task = startBackgroundTask({
263
+ taskId: run.taskId,
264
+ surface: 'shell',
265
+ operation: 'shell',
266
+ label: String(spec.command || '').replace(/\s+/g, ' ').slice(0, 120),
267
+ context: { callerSessionId: spec.ownerSessionId, clientHostPid: spec.clientHostPid },
268
+ input: { command: spec.command, cwd: spec.cwd },
269
+ meta: { task_id: run.taskId, stdout: null, stderr: null, cwd: spec.cwd, timeoutMs: spec.timeoutMs },
270
+ resultType: 'shell_task_result',
271
+ cancel: () => queuedAbort.abort(),
272
+ run: async () => {
273
+ const result = await execShellCommand({
274
+ ...spec,
275
+ abortSignal: queuedAbort.signal,
276
+ autoBackgroundMs: 0,
277
+ backgroundOnTimeout: false,
278
+ admissionWaitMs: 0,
279
+ });
280
+ const output = [result.stdout, result.stderr].filter(Boolean).join('\n');
281
+ if (result.exitCode !== 0) {
282
+ throw new Error(`exit code ${result.exitCode ?? result.signal ?? 'unknown'}${output ? `\n${output}` : ''}`);
283
+ }
284
+ return { task_id: run.taskId, status: 'completed', exit_code: 0, output };
285
+ },
286
+ });
287
+ } catch {
288
+ return false;
289
+ }
290
+ detachAbortHandler(run);
291
+ const reason = String(saturation.message || '').split(' —')[0];
292
+ run.resolveResult(
293
+ new ExecResult({
294
+ stdout: '',
295
+ stderr: '',
296
+ exitCode: null,
297
+ signal: null,
298
+ taskId: run.taskId,
299
+ backgrounded: true,
300
+ partialOutput: true,
301
+ settled: task.promise,
302
+ backgroundMessage:
303
+ `${reason}; queued as background task [task_id: ${task.taskId}] that starts when an execution slot frees. ` +
304
+ 'Completion arrives automatically; call task wait (not task read polling) when the result is due.',
305
+ })
306
+ );
307
+ return true;
308
+ }
309
+
251
310
  // A fault in the wiring BELOW admitAndSpawn (capture, settle, deadlines) has
252
311
  // no phase of its own to report it: nothing is armed yet, so no timer, exit
253
312
  // handler or settle() can ever resolve the run. Tear the half-built run down
@@ -413,11 +472,8 @@ function armDeadlines(run, { timeoutMs, autoBackgroundMs, backgroundOnTimeout, a
413
472
  }
414
473
  }
415
474
 
416
- // Windows Defender intermittently fails node→PowerShell spawns with EPERM
417
- // while it scans the child image (see shell-runtime.mjs Trojan false-positive
418
- // note). The failure is at spawn() time — before any stdio/side effect — so a
419
- // short bounded retry is safe and never re-runs a command that already ran
420
- // (lib/shell-spawn-retry.mjs).
475
+ // Run one command to a terminal ExecResult. Spawn-time EPERM retries (Windows
476
+ // Defender scanning the child image) live in lib/shell-spawn-retry.mjs.
421
477
  export function execShellCommand({
422
478
  shell,
423
479
  shellArg,
@@ -435,6 +491,7 @@ export function execShellCommand({
435
491
  backgroundOnTimeout,
436
492
  promotedTimeoutMs = 0,
437
493
  backgroundDeadlineMs = 0,
494
+ admissionWaitMs = SHELL_ADMISSION_WAIT_MS,
438
495
  admission = resourceAdmission,
439
496
  directArgv = null,
440
497
  // What the shell PARSES, when that must differ from what the caller shows.
@@ -464,6 +521,24 @@ export function execShellCommand({
464
521
  execScript,
465
522
  ownerSessionId,
466
523
  clientHostPid,
524
+ }, {
525
+ admissionWaitMs,
526
+ onSaturated: (err) =>
527
+ backgroundOnTimeout &&
528
+ queueSaturatedAsTask(run, err, {
529
+ shell,
530
+ shellArg,
531
+ shellArgs,
532
+ command,
533
+ env,
534
+ cwd,
535
+ timeoutMs: backgroundDeadlineMs,
536
+ clientHostPid,
537
+ ownerSessionId,
538
+ admission,
539
+ directArgv,
540
+ execScript,
541
+ }),
467
542
  });
468
543
  if (!spawned) return;
469
544