mixdog 0.9.63 → 0.9.65

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 (408) hide show
  1. package/README.md +3 -0
  2. package/package.json +9 -2
  3. package/scripts/code-graph-description-contract.mjs +3 -3
  4. package/scripts/verify-release-assets.mjs +2 -2
  5. package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch.mjs +11 -14
  6. package/src/runtime/agent/orchestrator/agent-runtime/agent-progress-watchdog.mjs +6 -6
  7. package/src/runtime/agent/orchestrator/agent-runtime/cache-strategy.mjs +2 -2
  8. package/src/runtime/agent/orchestrator/agent-trace-format.mjs +1 -0
  9. package/src/runtime/agent/orchestrator/config.mjs +19 -124
  10. package/src/runtime/agent/orchestrator/context/collect.mjs +6 -6
  11. package/src/runtime/agent/orchestrator/dispatch-persist.mjs +2 -2
  12. package/src/runtime/agent/orchestrator/internal-agents.mjs +2 -2
  13. package/src/runtime/agent/orchestrator/mcp/child-tree.mjs +1 -1
  14. package/src/runtime/agent/orchestrator/mcp/client.mjs +4 -4
  15. package/src/runtime/agent/orchestrator/providers/admission-scheduler.mjs +2 -2
  16. package/src/runtime/agent/orchestrator/providers/anthropic-betas.mjs +4 -4
  17. package/src/runtime/agent/orchestrator/providers/anthropic-effort.mjs +2 -2
  18. package/src/runtime/agent/orchestrator/providers/anthropic-max-tokens.mjs +4 -4
  19. package/src/runtime/agent/orchestrator/providers/anthropic-messages.mjs +333 -0
  20. package/src/runtime/agent/orchestrator/providers/anthropic-model-resolve.mjs +2 -2
  21. package/src/runtime/agent/orchestrator/providers/anthropic-oauth-credentials.mjs +4 -4
  22. package/src/runtime/agent/orchestrator/providers/anthropic-oauth.mjs +1 -1
  23. package/src/runtime/agent/orchestrator/providers/anthropic.mjs +3 -277
  24. package/src/runtime/agent/orchestrator/providers/codex-client-meta.mjs +2 -2
  25. package/src/runtime/agent/orchestrator/providers/custom-tool-wire.mjs +1 -1
  26. package/src/runtime/agent/orchestrator/providers/gemini-cache.mjs +2 -2
  27. package/src/runtime/agent/orchestrator/providers/gemini-stream.mjs +6 -6
  28. package/src/runtime/agent/orchestrator/providers/grok-oauth-login.mjs +196 -0
  29. package/src/runtime/agent/orchestrator/providers/grok-oauth-tokens.mjs +460 -0
  30. package/src/runtime/agent/orchestrator/providers/grok-oauth.mjs +14 -593
  31. package/src/runtime/agent/orchestrator/providers/lib/anthropic-request-utils.mjs +1 -1
  32. package/src/runtime/agent/orchestrator/providers/media-normalization.mjs +1 -1
  33. package/src/runtime/agent/orchestrator/providers/openai-compat-wire.mjs +1 -1
  34. package/src/runtime/agent/orchestrator/providers/openai-compat-xai.mjs +4 -4
  35. package/src/runtime/agent/orchestrator/providers/openai-oauth-ws.mjs +2 -2
  36. package/src/runtime/agent/orchestrator/providers/openai-oauth.mjs +5 -280
  37. package/src/runtime/agent/orchestrator/providers/openai-responses-payload.mjs +357 -0
  38. package/src/runtime/agent/orchestrator/providers/openai-ws-headers.mjs +216 -0
  39. package/src/runtime/agent/orchestrator/providers/openai-ws-pool.mjs +2 -188
  40. package/src/runtime/agent/orchestrator/providers/openai-ws-stream.mjs +2 -2
  41. package/src/runtime/agent/orchestrator/providers/openai-ws.mjs +2 -2
  42. package/src/runtime/agent/orchestrator/providers/opencode-go.mjs +1 -1
  43. package/src/runtime/agent/orchestrator/providers/provider-catalog-cache.mjs +1 -1
  44. package/src/runtime/agent/orchestrator/providers/registry.mjs +1 -1
  45. package/src/runtime/agent/orchestrator/providers/retry-classifier.mjs +2 -2
  46. package/src/runtime/agent/orchestrator/providers/statusline-route-meta.mjs +1 -1
  47. package/src/runtime/agent/orchestrator/session/cache/prefetch-cache.mjs +1 -1
  48. package/src/runtime/agent/orchestrator/session/cache/scoped-cache.mjs +3 -3
  49. package/src/runtime/agent/orchestrator/session/compact/budget.mjs +2 -2
  50. package/src/runtime/agent/orchestrator/session/compact/file-reattach.mjs +2 -2
  51. package/src/runtime/agent/orchestrator/session/compact/summary-schema.mjs +1 -1
  52. package/src/runtime/agent/orchestrator/session/compact/summary.mjs +1 -1
  53. package/src/runtime/agent/orchestrator/session/compact/text-utils.mjs +2 -2
  54. package/src/runtime/agent/orchestrator/session/context-utils.mjs +4 -4
  55. package/src/runtime/agent/orchestrator/session/loop/deferred-call-through.mjs +1 -1
  56. package/src/runtime/agent/orchestrator/session/loop/pre-dispatch-deny.mjs +17 -0
  57. package/src/runtime/agent/orchestrator/session/loop/steering.mjs +1 -1
  58. package/src/runtime/agent/orchestrator/session/loop/stored-tool-args.mjs +18 -26
  59. package/src/runtime/agent/orchestrator/session/loop/termination.mjs +1 -1
  60. package/src/runtime/agent/orchestrator/session/loop/tool-classify.mjs +3 -3
  61. package/src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs +1 -0
  62. package/src/runtime/agent/orchestrator/session/manager/context-meta.mjs +1 -1
  63. package/src/runtime/agent/orchestrator/session/manager/delivered-completions.mjs +1 -1
  64. package/src/runtime/agent/orchestrator/session/manager/status-telemetry.mjs +1 -1
  65. package/src/runtime/agent/orchestrator/session/store/live-state.mjs +49 -0
  66. package/src/runtime/agent/orchestrator/session/store/load-cache.mjs +49 -0
  67. package/src/runtime/agent/orchestrator/session/store/save-worker.mjs +260 -0
  68. package/src/runtime/agent/orchestrator/session/store/serialize.mjs +72 -0
  69. package/src/runtime/agent/orchestrator/session/store/summary-cache.mjs +163 -0
  70. package/src/runtime/agent/orchestrator/session/store/write-guards.mjs +1 -1
  71. package/src/runtime/agent/orchestrator/session/store-summary-index.mjs +1 -1
  72. package/src/runtime/agent/orchestrator/session/store-summary-reader.mjs +4 -1
  73. package/src/runtime/agent/orchestrator/session/store.mjs +9 -561
  74. package/src/runtime/agent/orchestrator/session/tool-envelope.mjs +1 -1
  75. package/src/runtime/agent/orchestrator/session/tool-result-offload.mjs +2 -2
  76. package/src/runtime/agent/orchestrator/stall-policy.mjs +11 -11
  77. package/src/runtime/agent/orchestrator/tools/bash-policy-scan.mjs +1 -1
  78. package/src/runtime/agent/orchestrator/tools/bash-session.mjs +2 -2
  79. package/src/runtime/agent/orchestrator/tools/builtin/advisory-lock.mjs +1 -1
  80. package/src/runtime/agent/orchestrator/tools/builtin/arg-guard.mjs +2 -2
  81. package/src/runtime/agent/orchestrator/tools/builtin/atomic-write.mjs +1 -1
  82. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool.mjs +2 -154
  83. package/src/runtime/agent/orchestrator/tools/builtin/cache-layers.mjs +1 -1
  84. package/src/runtime/agent/orchestrator/tools/builtin/cwd-utils.mjs +1 -1
  85. package/src/runtime/agent/orchestrator/tools/builtin/fs-reachability.mjs +1 -1
  86. package/src/runtime/agent/orchestrator/tools/builtin/fuzzy-match.mjs +1 -1
  87. package/src/runtime/agent/orchestrator/tools/builtin/glob-walk.mjs +1 -1
  88. package/src/runtime/agent/orchestrator/tools/builtin/path-locks.mjs +1 -1
  89. package/src/runtime/agent/orchestrator/tools/builtin/path-utils.mjs +1 -1
  90. package/src/runtime/agent/orchestrator/tools/builtin/read-args.mjs +2 -2
  91. package/src/runtime/agent/orchestrator/tools/builtin/read-formatting.mjs +2 -3
  92. package/src/runtime/agent/orchestrator/tools/builtin/read-image-resize.mjs +4 -4
  93. package/src/runtime/agent/orchestrator/tools/builtin/read-open.mjs +1 -1
  94. package/src/runtime/agent/orchestrator/tools/builtin/read-streaming.mjs +1 -1
  95. package/src/runtime/agent/orchestrator/tools/builtin/rg-runner.mjs +2 -2
  96. package/src/runtime/agent/orchestrator/tools/builtin/search-path-diagnostics.mjs +5 -5
  97. package/src/runtime/agent/orchestrator/tools/builtin/shell-analysis.mjs +1 -1
  98. package/src/runtime/agent/orchestrator/tools/builtin/shell-job-paths.mjs +2 -2
  99. package/src/runtime/agent/orchestrator/tools/builtin/shell-job-process.mjs +2 -2
  100. package/src/runtime/agent/orchestrator/tools/builtin/shell-job-spawn.mjs +519 -0
  101. package/src/runtime/agent/orchestrator/tools/builtin/shell-jobs.mjs +5 -449
  102. package/src/runtime/agent/orchestrator/tools/builtin/snapshot-helpers.mjs +1 -1
  103. package/src/runtime/agent/orchestrator/tools/builtin/task-tool.mjs +212 -0
  104. package/src/runtime/agent/orchestrator/tools/builtin.mjs +1 -1
  105. package/src/runtime/agent/orchestrator/tools/code-graph/build.mjs +1 -7
  106. package/src/runtime/agent/orchestrator/tools/code-graph/disk-cache.mjs +9 -36
  107. package/src/runtime/agent/orchestrator/tools/code-graph/dispatch.mjs +15 -3
  108. package/src/runtime/agent/orchestrator/tools/code-graph/search-references.mjs +429 -0
  109. package/src/runtime/agent/orchestrator/tools/code-graph/search.mjs +2 -395
  110. package/src/runtime/agent/orchestrator/tools/code-graph/symbol-index.mjs +2 -2
  111. package/src/runtime/agent/orchestrator/tools/code-graph/text-mask.mjs +1 -1
  112. package/src/runtime/agent/orchestrator/tools/code-graph/trusted-roots.mjs +1 -1
  113. package/src/runtime/agent/orchestrator/tools/code-graph-prewarm-worker.mjs +1 -1
  114. package/src/runtime/agent/orchestrator/tools/code-graph-state.mjs +3 -3
  115. package/src/runtime/agent/orchestrator/tools/mutation-planner.mjs +5 -5
  116. package/src/runtime/agent/orchestrator/tools/next-call-utils.mjs +1 -1
  117. package/src/runtime/agent/orchestrator/tools/patch/dispatch.mjs +1 -1
  118. package/src/runtime/agent/orchestrator/tools/patch/matcher.mjs +7 -7
  119. package/src/runtime/agent/orchestrator/tools/patch/orchestrator.mjs +72 -9
  120. package/src/runtime/agent/orchestrator/tools/patch/parsing.mjs +4 -4
  121. package/src/runtime/agent/orchestrator/tools/patch/paths.mjs +1 -1
  122. package/src/runtime/agent/orchestrator/tools/patch/v4a-convert.mjs +1 -1
  123. package/src/runtime/agent/orchestrator/tools/patch-tool-defs.mjs +4 -4
  124. package/src/runtime/agent/orchestrator/tools/patch.mjs +1 -1
  125. package/src/runtime/agent/orchestrator/tools/result-compression.mjs +3 -3
  126. package/src/runtime/agent/orchestrator/tools/shell-command.mjs +2 -444
  127. package/src/runtime/agent/orchestrator/tools/shell-exec-output.mjs +505 -0
  128. package/src/runtime/agent/orchestrator/tools/shell-exec-policy.mjs +2 -2
  129. package/src/runtime/agent/orchestrator/tools/shell-snapshot.mjs +1 -1
  130. package/src/runtime/channels/lib/backend-dispatch.mjs +20 -5
  131. package/src/runtime/channels/lib/scheduler.mjs +1 -1
  132. package/src/runtime/channels/lib/telegram-format.mjs +1 -1
  133. package/src/runtime/channels/lib/voice-runtime-fetcher.mjs +4 -4
  134. package/src/runtime/channels/tool-defs.mjs +2 -3
  135. package/src/runtime/memory/index.mjs +1 -5
  136. package/src/runtime/memory/lib/core-memory-candidates.mjs +357 -0
  137. package/src/runtime/memory/lib/core-memory-store.mjs +7 -357
  138. package/src/runtime/memory/lib/cycle-signatures.mjs +1 -1
  139. package/src/runtime/memory/lib/embedding-model-config.mjs +1 -1
  140. package/src/runtime/memory/lib/embedding-provider.mjs +1 -5
  141. package/src/runtime/memory/lib/embedding-worker.mjs +1 -5
  142. package/src/runtime/memory/lib/ko-morph.mjs +2 -2
  143. package/src/runtime/memory/lib/memory-config-flags.mjs +2 -5
  144. package/src/runtime/memory/lib/memory-cycle-requests.mjs +3 -7
  145. package/src/runtime/memory/lib/memory-cycle1.mjs +4 -8
  146. package/src/runtime/memory/lib/memory-cycle2-gate.mjs +1 -1
  147. package/src/runtime/memory/lib/memory-cycle2-mutations.mjs +1 -1
  148. package/src/runtime/memory/lib/memory-cycle2-shared.mjs +2 -5
  149. package/src/runtime/memory/lib/memory-cycle3.mjs +1 -5
  150. package/src/runtime/memory/lib/memory-embed.mjs +2 -6
  151. package/src/runtime/memory/lib/memory-log.mjs +8 -0
  152. package/src/runtime/memory/lib/memory-ops-policy.mjs +4 -8
  153. package/src/runtime/memory/lib/memory-recall-scope-filter.mjs +1 -1
  154. package/src/runtime/memory/lib/memory-recall-store.mjs +2 -193
  155. package/src/runtime/memory/lib/memory-score.mjs +1 -1
  156. package/src/runtime/memory/lib/memory-text-utils.mjs +2 -2
  157. package/src/runtime/memory/lib/memory.mjs +2 -6
  158. package/src/runtime/memory/lib/pg/adapter.mjs +2 -6
  159. package/src/runtime/memory/lib/pg/process.mjs +1 -5
  160. package/src/runtime/memory/lib/pg/supervisor.mjs +1 -5
  161. package/src/runtime/memory/lib/recall-format.mjs +2 -2
  162. package/src/runtime/memory/lib/recall-scoring.mjs +195 -0
  163. package/src/runtime/memory/lib/runtime-fetcher.mjs +1 -5
  164. package/src/runtime/memory/lib/trace-store.mjs +2 -6
  165. package/src/runtime/search/lib/http-fetch.mjs +6 -6
  166. package/src/runtime/search/lib/web-tools.mjs +2 -2
  167. package/src/runtime/shared/buffered-appender.mjs +1 -1
  168. package/src/runtime/shared/child-guardian.mjs +1 -1
  169. package/src/runtime/shared/child-spawn-gate.mjs +1 -1
  170. package/src/runtime/shared/config.mjs +4 -4
  171. package/src/runtime/shared/launcher-control.mjs +9 -10
  172. package/src/runtime/shared/llm/index.mjs +5 -20
  173. package/src/runtime/shared/markdown-frontmatter.mjs +1 -1
  174. package/src/runtime/shared/memory-snapshot.mjs +4 -4
  175. package/src/runtime/shared/pristine-execution.mjs +1 -1
  176. package/src/runtime/shared/process-lifecycle.mjs +0 -1
  177. package/src/runtime/shared/process-shutdown.mjs +1 -1
  178. package/src/runtime/shared/resource-admission.mjs +2 -2
  179. package/src/runtime/shared/schedule-session-run.mjs +1 -1
  180. package/src/runtime/shared/schedules-db.mjs +1 -1
  181. package/src/runtime/shared/service-discovery.mjs +2 -2
  182. package/src/runtime/shared/staged-update.mjs +6 -6
  183. package/src/runtime/shared/tool-execution-contract.mjs +1 -1
  184. package/src/runtime/shared/tool-primitives.mjs +1 -1
  185. package/src/runtime/shared/tool-surface.mjs +2 -2
  186. package/src/runtime/shared/turn-snapshot.mjs +184 -0
  187. package/src/runtime/shared/update-checker.mjs +1 -1
  188. package/src/runtime/shared/user-cwd.mjs +3 -3
  189. package/src/runtime/shared/user-data-guard.mjs +4 -4
  190. package/src/runtime/shared/workspace-router.mjs +5 -5
  191. package/src/session-runtime/config-helpers.mjs +2 -3
  192. package/src/session-runtime/config-lifecycle.mjs +1 -1
  193. package/src/session-runtime/hitch-profile.mjs +1 -1
  194. package/src/session-runtime/lifecycle-api.mjs +6 -4
  195. package/src/session-runtime/model-recency.mjs +5 -5
  196. package/src/session-runtime/plugin-mcp.mjs +1 -1
  197. package/src/session-runtime/provider-request-snapshot.mjs +338 -0
  198. package/src/session-runtime/runtime-core.mjs +4 -0
  199. package/src/session-runtime/session-text.mjs +4 -4
  200. package/src/session-runtime/session-turn-api.mjs +7 -0
  201. package/src/session-runtime/tool-catalog-schema.mjs +197 -0
  202. package/src/session-runtime/tool-catalog.mjs +6 -483
  203. package/src/session-runtime/tool-defs.mjs +1 -1
  204. package/src/standalone/agent-task-status.mjs +1 -1
  205. package/src/standalone/agent-tool/helpers.mjs +2 -2
  206. package/src/standalone/channel-admin.mjs +4 -4
  207. package/src/standalone/explore-tool.mjs +3 -3
  208. package/src/standalone/hook-bus/config.mjs +1 -1
  209. package/src/standalone/hook-bus/constants.mjs +1 -1
  210. package/src/standalone/hook-bus/rules.mjs +1 -1
  211. package/src/standalone/projects.mjs +1 -1
  212. package/src/standalone/provider-admin.mjs +2 -2
  213. package/src/tui/App.jsx +1 -1
  214. package/src/tui/app/app-format.mjs +2 -2
  215. package/src/tui/app/clipboard.mjs +3 -3
  216. package/src/tui/app/input-parsers.mjs +1 -1
  217. package/src/tui/app/text-layout.mjs +1 -1
  218. package/src/tui/app/transcript-row-estimate.mjs +360 -0
  219. package/src/tui/app/transcript-window.mjs +5 -347
  220. package/src/tui/app/use-mouse-input.mjs +1 -1
  221. package/src/tui/app/use-prompt-handlers.mjs +1 -1
  222. package/src/tui/components/tool-execution/surface-detail.mjs +9 -9
  223. package/src/tui/components/tool-execution/text-format.mjs +2 -2
  224. package/src/tui/components/tool-output-format.mjs +7 -7
  225. package/src/tui/display-width.mjs +4 -4
  226. package/src/tui/dist/index.mjs +187 -99
  227. package/src/tui/engine/agent-envelope.mjs +5 -5
  228. package/src/tui/engine/live-share.mjs +100 -0
  229. package/src/tui/engine/notification-plan.mjs +1 -1
  230. package/src/tui/engine/queue-helpers.mjs +3 -3
  231. package/src/tui/engine/render-timing.mjs +4 -5
  232. package/src/tui/engine/session-api-ext.mjs +6 -3
  233. package/src/tui/engine/tool-result-status.mjs +5 -5
  234. package/src/tui/engine/tool-result-text.mjs +1 -1
  235. package/src/tui/engine/transcript-spill.mjs +585 -0
  236. package/src/tui/engine/tui-steering-persist.mjs +1 -1
  237. package/src/tui/engine.mjs +29 -474
  238. package/src/tui/lib/voice-setup.mjs +1 -1
  239. package/src/tui/markdown/format-token.mjs +1 -1
  240. package/src/tui/markdown/render-ansi.mjs +1 -1
  241. package/src/tui/markdown/table-layout.mjs +4 -4
  242. package/src/tui/paste-attachments.mjs +1 -1
  243. package/src/tui/prompt-history-store.mjs +3 -3
  244. package/src/tui/statusline-ansi-bridge.mjs +2 -2
  245. package/src/tui/theme.mjs +1 -1
  246. package/src/tui/transcript-tool-failures.mjs +2 -2
  247. package/src/ui/ansi.mjs +0 -9
  248. package/src/ui/statusline-format.mjs +2 -4
  249. package/scripts/_bench-cwc.json +0 -20
  250. package/scripts/_jitter-fuzz.jsx +0 -42
  251. package/scripts/_jitter-fuzz2.jsx +0 -30
  252. package/scripts/_jitter-probe.jsx +0 -35
  253. package/scripts/_jp2.jsx +0 -16
  254. package/scripts/_smoke_wd.mjs +0 -7
  255. package/scripts/abort-recovery-test.mjs +0 -175
  256. package/scripts/agent-dispatch-abort-compose-test.mjs +0 -31
  257. package/scripts/agent-live-arg-guard-smoke.mjs +0 -20
  258. package/scripts/agent-live-path-suffix-smoke.mjs +0 -34
  259. package/scripts/agent-live-toolcall-args-smoke.mjs +0 -45
  260. package/scripts/agent-loop-policy-test.mjs +0 -37
  261. package/scripts/agent-model-liveness-test.mjs +0 -763
  262. package/scripts/agent-parallel-smoke.mjs +0 -435
  263. package/scripts/agent-route-batch-test.mjs +0 -40
  264. package/scripts/agent-tag-reuse-smoke.mjs +0 -441
  265. package/scripts/agent-terminal-reap-test.mjs +0 -252
  266. package/scripts/agent-trace-io-test.mjs +0 -133
  267. package/scripts/ansi-color-capability-test.mjs +0 -90
  268. package/scripts/anthropic-admission-retry-integration-test.mjs +0 -119
  269. package/scripts/anthropic-maxtokens-test.mjs +0 -119
  270. package/scripts/anthropic-oauth-refresh-race-test.mjs +0 -397
  271. package/scripts/anthropic-transport-policy-test.mjs +0 -726
  272. package/scripts/apply-patch-edit-smoke.mjs +0 -71
  273. package/scripts/arg-guard-test.mjs +0 -93
  274. package/scripts/async-notify-settlement-test.mjs +0 -99
  275. package/scripts/atomic-lock-tryonce-test.mjs +0 -125
  276. package/scripts/background-task-meta-smoke.mjs +0 -38
  277. package/scripts/bench-run.mjs +0 -508
  278. package/scripts/boot-smoke.mjs +0 -137
  279. package/scripts/build-runtime-windows.ps1 +0 -242
  280. package/scripts/channel-daemon-smoke.mjs +0 -1103
  281. package/scripts/code-graph-aggregate-cwd-test.mjs +0 -158
  282. package/scripts/code-graph-disk-hit-test.mjs +0 -290
  283. package/scripts/code-graph-dispatch-test.mjs +0 -96
  284. package/scripts/code-graph-root-federation-test.mjs +0 -273
  285. package/scripts/compact-active-turn-test.mjs +0 -68
  286. package/scripts/compact-file-reattach-test.mjs +0 -88
  287. package/scripts/compact-pressure-test.mjs +0 -788
  288. package/scripts/compact-prior-context-flatten-test.mjs +0 -252
  289. package/scripts/compact-recall-digest-test.mjs +0 -57
  290. package/scripts/compact-smoke.mjs +0 -1017
  291. package/scripts/compact-trigger-migration-smoke.mjs +0 -261
  292. package/scripts/compacted-placeholder-scrub-test.mjs +0 -63
  293. package/scripts/context-mcp-metering-test.mjs +0 -1406
  294. package/scripts/debounced-skills-async-save-test.mjs +0 -57
  295. package/scripts/deferred-tool-loading-test.mjs +0 -250
  296. package/scripts/desktop-session-bridge-test.mjs +0 -1013
  297. package/scripts/dispatch-persist-recovery-test.mjs +0 -141
  298. package/scripts/embedding-worker-exit-test.mjs +0 -76
  299. package/scripts/execution-completion-dedup-test.mjs +0 -205
  300. package/scripts/execution-pending-resume-kick-test.mjs +0 -151
  301. package/scripts/execution-resume-esc-integration-test.mjs +0 -176
  302. package/scripts/explore-bench-tmp.mjs +0 -36
  303. package/scripts/explore-bench.mjs +0 -248
  304. package/scripts/explore-prompt-policy-test.mjs +0 -256
  305. package/scripts/explore-timeout-cancel-test.mjs +0 -345
  306. package/scripts/find-fuzzy-hidden-test.mjs +0 -267
  307. package/scripts/forwarder-rebind-tail-test.mjs +0 -67
  308. package/scripts/freevar-smoke.mjs +0 -98
  309. package/scripts/gemini-provider-test.mjs +0 -1448
  310. package/scripts/generate-oc-icons.mjs +0 -11
  311. package/scripts/grok-oauth-refresh-race-test.mjs +0 -273
  312. package/scripts/headless-pristine-execution-test.mjs +0 -614
  313. package/scripts/hook-bus-test.mjs +0 -552
  314. package/scripts/ingest-pure-conversation-smoke.mjs +0 -175
  315. package/scripts/internal-comms-bench-test.mjs +0 -226
  316. package/scripts/internal-comms-bench.mjs +0 -853
  317. package/scripts/internal-comms-smoke.mjs +0 -277
  318. package/scripts/internal-tools-normalization-test.mjs +0 -62
  319. package/scripts/interrupted-turn-history-test.mjs +0 -399
  320. package/scripts/lead-workflow-smoke.mjs +0 -592
  321. package/scripts/lifecycle-api-test.mjs +0 -137
  322. package/scripts/live-share-test.mjs +0 -148
  323. package/scripts/live-worker-smoke.mjs +0 -333
  324. package/scripts/log-writer-guard-smoke.mjs +0 -131
  325. package/scripts/maintenance-default-routes-test.mjs +0 -164
  326. package/scripts/max-output-recovery-persist-test.mjs +0 -81
  327. package/scripts/max-output-recovery-test.mjs +0 -368
  328. package/scripts/mcp-client-normalization-test.mjs +0 -45
  329. package/scripts/mcp-grace-deferred-test.mjs +0 -225
  330. package/scripts/memory-core-input-test.mjs +0 -167
  331. package/scripts/memory-cycle-routing-test.mjs +0 -111
  332. package/scripts/memory-meta-concurrency-test.mjs +0 -20
  333. package/scripts/memory-pg-recovery-test.mjs +0 -59
  334. package/scripts/memory-rule-contract-test.mjs +0 -93
  335. package/scripts/model-list-sanitize-test.mjs +0 -37
  336. package/scripts/mouse-tracking-restore-smoke.mjs +0 -107
  337. package/scripts/native-edit-wire-test.mjs +0 -152
  338. package/scripts/notify-completion-mirror-test.mjs +0 -73
  339. package/scripts/openai-oauth-refresh-race-test.mjs +0 -120
  340. package/scripts/openai-oauth-ws-1006-retry-test.mjs +0 -954
  341. package/scripts/openai-ws-early-settle-test.mjs +0 -216
  342. package/scripts/output-style-bench.mjs +0 -292
  343. package/scripts/output-style-smoke.mjs +0 -145
  344. package/scripts/parent-abort-link-test.mjs +0 -90
  345. package/scripts/patch-binary-cache-test.mjs +0 -181
  346. package/scripts/path-suffix-test.mjs +0 -57
  347. package/scripts/pending-completion-drop-test.mjs +0 -239
  348. package/scripts/pending-messages-lock-nonblocking-test.mjs +0 -62
  349. package/scripts/pretool-ask-runtime-test.mjs +0 -54
  350. package/scripts/process-lifecycle-test.mjs +0 -461
  351. package/scripts/prompt-immediate-render-test.mjs +0 -89
  352. package/scripts/prompt-input-parity-test.mjs +0 -145
  353. package/scripts/provider-admission-scheduler-test.mjs +0 -681
  354. package/scripts/provider-contract-test.mjs +0 -632
  355. package/scripts/provider-stream-stall-test.mjs +0 -276
  356. package/scripts/provider-toolcall-test.mjs +0 -3063
  357. package/scripts/reactive-compact-persist-smoke.mjs +0 -203
  358. package/scripts/recall-bench.mjs +0 -359
  359. package/scripts/resource-admission-test.mjs +0 -792
  360. package/scripts/result-classification-test.mjs +0 -75
  361. package/scripts/rg-runner-test.mjs +0 -240
  362. package/scripts/routing-corpus-test.mjs +0 -349
  363. package/scripts/sanitize-tool-pairs-test.mjs +0 -260
  364. package/scripts/session-bench-cache-break-test.mjs +0 -102
  365. package/scripts/session-bench.mjs +0 -1708
  366. package/scripts/session-context-bench.mjs +0 -344
  367. package/scripts/session-heartbeat-lifecycle-test.mjs +0 -68
  368. package/scripts/session-ingest-compaction-smoke.mjs +0 -279
  369. package/scripts/session-ingest-smoke.mjs +0 -177
  370. package/scripts/session-orphan-sweep-test.mjs +0 -109
  371. package/scripts/set-effort-config-test.mjs +0 -41
  372. package/scripts/shell-failure-diagnostics-test.mjs +0 -280
  373. package/scripts/shell-hardening-test.mjs +0 -209
  374. package/scripts/shell-jobs-windows-hide-test.mjs +0 -164
  375. package/scripts/ship-mode-test.mjs +0 -98
  376. package/scripts/smoke-loop-failure-summary-test.mjs +0 -38
  377. package/scripts/smoke-loop-failure-summary.mjs +0 -16
  378. package/scripts/smoke-loop-report.mjs +0 -221
  379. package/scripts/smoke-loop.mjs +0 -202
  380. package/scripts/smoke-runtime-negative.ps1 +0 -106
  381. package/scripts/statusline-quota-hysteresis-test.mjs +0 -62
  382. package/scripts/steering-drain-buckets-test.mjs +0 -467
  383. package/scripts/steering-fold-provenance-test.mjs +0 -71
  384. package/scripts/streaming-tail-window-test.mjs +0 -175
  385. package/scripts/submit-commandbusy-race-test.mjs +0 -257
  386. package/scripts/task-bench.mjs +0 -205
  387. package/scripts/terminal-bench-isolation-guards-test.mjs +0 -102
  388. package/scripts/termio-input-smoke.mjs +0 -199
  389. package/scripts/tool-result-hook-test.mjs +0 -48
  390. package/scripts/tool-smoke.mjs +0 -2453
  391. package/scripts/tool-tui-presentation-test.mjs +0 -286
  392. package/scripts/toolcall-args-test.mjs +0 -239
  393. package/scripts/tui-ambiguous-width-test.mjs +0 -113
  394. package/scripts/tui-background-failure-smoke.mjs +0 -73
  395. package/scripts/tui-perf-run.ps1 +0 -26
  396. package/scripts/tui-render-smoke.mjs +0 -90
  397. package/scripts/tui-runtime-load-bench-entry.jsx +0 -608
  398. package/scripts/tui-runtime-load-bench.mjs +0 -50
  399. package/scripts/tui-store-frame-batch-test.mjs +0 -99
  400. package/scripts/tui-transcript-jitter-harness-entry.jsx +0 -383
  401. package/scripts/tui-transcript-perf-test.mjs +0 -934
  402. package/scripts/usage-metrics-epoch-smoke.mjs +0 -114
  403. package/scripts/verify-release-assets-test.mjs +0 -281
  404. package/scripts/web-fetch-routing-test.mjs +0 -158
  405. package/scripts/webhook-smoke.mjs +0 -201
  406. package/scripts/windows-hide-spawn-options-test.mjs +0 -19
  407. package/scripts/worker-notify-rejection-test.mjs +0 -51
  408. package/scripts/write-backpressure-test.mjs +0 -147
@@ -1,592 +0,0 @@
1
- import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
2
- import { tmpdir } from 'node:os';
3
- import { join } from 'node:path';
4
- import { performance } from 'node:perf_hooks';
5
-
6
- import { createMixdogSessionRuntime } from '../src/mixdog-session-runtime.mjs';
7
-
8
- const args = parseArgs(process.argv.slice(2));
9
- const timeoutMs = Number(args.get('timeout-ms') || 480000);
10
- const keep = args.get('keep') === true;
11
- const selectedScenario = String(args.get('scenario') || 'explicit-parallel');
12
-
13
- const SCENARIOS = {
14
- 'explicit-parallel': {
15
- description: 'Explicit worker/debugger/reviewer parallel delegation.',
16
- setup: setupMultiFileProject,
17
- prompt: (projectDir) => `
18
- This is an actual lead workflow smoke test for Mixdog CLI.
19
-
20
- Work inside this temporary project only:
21
- ${projectDir}
22
-
23
- Goal: validate how the lead plans and batches independent work. Do not solve everything directly in the lead.
24
-
25
- Please use the agent tool with async workers for the independent sections below. Spawn distinct tags early so the work can overlap, then wait for completion notifications and make a concise final report.
26
-
27
- Independent sections:
28
- 1. worker: update src/math.mjs to export subtract(a, b).
29
- 2. debugger: diagnose and fix src/format.mjs so titleCase(" hello mixdog ") returns "Hello Mixdog".
30
- 3. reviewer: review src/policy.mjs and the small smoke scope for obvious risk; report only, no edit unless a clear bug is found.
31
-
32
- Use minimal exploration. Prefer grep/code_graph/apply_patch over broad reading. Keep each worker brief: maxLoopIterations 4 and idleTimeoutMs 120000 are enough.
33
- After worker results return, run npm run smoke in ${projectDir} if needed, then summarize:
34
- - whether agent workers were used
35
- - which agents/tags ran
36
- - whether the smoke passed
37
- `.trim(),
38
- validate: validateMultiFileProject,
39
- expect: {
40
- minSpawns: 3,
41
- minFirstIterAgentCalls: 2,
42
- requiredRoles: ['worker', 'debugger', 'reviewer'],
43
- requireFilesOk: true,
44
- },
45
- },
46
- 'natural-multifile': {
47
- description: 'Natural multi-file task with no hard agent command; should still delegate useful independent work.',
48
- setup: setupMultiFileProject,
49
- prompt: (projectDir) => `
50
- Work in this temporary project only:
51
- ${projectDir}
52
-
53
- The smoke test is failing. Please get it passing and do a quick risk check of the tiny policy file. Use the normal Mixdog workflow for a small multi-file fix: keep lead context small, split independent investigation/implementation/review work when useful, then report the final result.
54
-
55
- Targets:
56
- - src/math.mjs is missing the operation used by src/smoke.mjs.
57
- - src/format.mjs mishandles extra whitespace.
58
- - src/policy.mjs only needs a quick risk review unless you find a real bug.
59
-
60
- Keep exploration tight and verify with npm run smoke.
61
- `.trim(),
62
- validate: validateMultiFileProject,
63
- expect: {
64
- minSpawns: 2,
65
- minFirstIterAgentCalls: 1,
66
- minPreEditImplementationSpawns: 1,
67
- requiredAnyRoles: ['worker', 'debugger', 'reviewer'],
68
- requireFilesOk: true,
69
- },
70
- },
71
- 'tiny-direct': {
72
- description: 'Tiny single-file edit; should avoid unnecessary worker spawn.',
73
- setup: setupTinyProject,
74
- prompt: (projectDir) => `
75
- Work in this temporary project only:
76
- ${projectDir}
77
-
78
- Tiny direct fix: update src/clamp.mjs so clamp(12, 0, 10) returns 10 and clamp(-1, 0, 10) returns 0. This is intentionally a one-file change; handle it directly unless a worker is truly necessary. Verify with npm run smoke and report briefly.
79
- `.trim(),
80
- validate: validateTinyProject,
81
- expect: {
82
- maxSpawns: 0,
83
- requireFilesOk: true,
84
- },
85
- },
86
- 'broad-locator-explore': {
87
- description: 'Broad unrelated locator questions should use explore rather than reading many files in Lead.',
88
- setup: setupLocatorProject,
89
- prompt: (projectDir) => `
90
- Work in this temporary project only:
91
- ${projectDir}
92
-
93
- I need file:line candidates only. I do not know exact symbols or file names.
94
- Find likely places for these unrelated concerns:
95
- - where startup/bootstrap orchestration happens
96
- - where saved user preferences are loaded
97
- - where async queue draining is coordinated
98
-
99
- Use the normal Mixdog broad locator workflow. Do not edit files and do not prove root cause; just return concise candidates.
100
- `.trim(),
101
- validate: validateReadOnlyProject,
102
- expect: {
103
- minToolCalls: { explore: 1 },
104
- maxMutations: 0,
105
- requireFilesOk: true,
106
- },
107
- },
108
- 'known-symbol-direct': {
109
- description: 'Known symbol/file clue should use direct code tools, not explore.',
110
- setup: setupLocatorProject,
111
- prompt: (projectDir) => `
112
- Work in this temporary project only:
113
- ${projectDir}
114
-
115
- Where is the function loadUserPreferences defined? Give the file:line candidate only. This is a known symbol lookup; keep it minimal and do not edit.
116
- `.trim(),
117
- validate: validateReadOnlyProject,
118
- expect: {
119
- minToolCallsAny: ['code_graph', 'grep'],
120
- maxToolCalls: { explore: 0 },
121
- maxMutations: 0,
122
- requireFilesOk: true,
123
- },
124
- },
125
- 'memory-recall': {
126
- description: 'Prior-decision question should use recall.',
127
- setup: setupLocatorProject,
128
- prepare: async (runtime) => {
129
- return await runtime.memoryControl({
130
- action: 'core',
131
- op: 'add',
132
- project_id: 'common',
133
- category: 'decision',
134
- element: 'lead workflow smoke sentinel',
135
- summary: 'For Mixdog retrieval smoke, the chosen sentinel color is cobalt and the routing keyword is otterglass.',
136
- });
137
- },
138
- prompt: (projectDir) => `
139
- Work in this temporary project only:
140
- ${projectDir}
141
-
142
- We decided a sentinel color and routing keyword earlier for the Mixdog retrieval smoke. Please check memory/previous decisions and tell me the color and keyword. Do not inspect source files.
143
- `.trim(),
144
- validate: validateReadOnlyProject,
145
- expect: {
146
- minToolCalls: { recall: 1 },
147
- maxMutations: 0,
148
- finalTextIncludes: ['cobalt', 'otterglass'],
149
- requireFilesOk: true,
150
- },
151
- },
152
- 'web-search': {
153
- description: 'External current-info question should use search.',
154
- setup: setupLocatorProject,
155
- prompt: (projectDir) => `
156
- Work in this temporary project only:
157
- ${projectDir}
158
-
159
- What is the current official Node.js LTS major version? This requires current external information, so use web search. Answer with one concise sentence and cite the source title/URL if available. Do not edit files.
160
- `.trim(),
161
- validate: validateReadOnlyProject,
162
- expect: {
163
- minToolCalls: { search: 1 },
164
- maxMutations: 0,
165
- requireFilesOk: true,
166
- allowToolErrors: args.get('allow-search-error') === true,
167
- },
168
- },
169
- };
170
-
171
- function parseArgs(argv) {
172
- const out = new Map();
173
- for (let i = 0; i < argv.length; i += 1) {
174
- const key = argv[i];
175
- if (!key.startsWith('--')) continue;
176
- const next = argv[i + 1];
177
- if (next && !next.startsWith('--')) {
178
- out.set(key.slice(2), next);
179
- i += 1;
180
- } else {
181
- out.set(key.slice(2), true);
182
- }
183
- }
184
- return out;
185
- }
186
-
187
- function writeLines(path, lines) {
188
- writeFileSync(path, `${lines.join('\n')}\n`);
189
- }
190
-
191
- function setupPackage(projectDir) {
192
- writeFileSync(join(projectDir, 'package.json'), JSON.stringify({
193
- name: 'mixdog-lead-workflow-smoke',
194
- private: true,
195
- type: 'module',
196
- scripts: { smoke: 'node src/smoke.mjs' },
197
- }, null, 2) + '\n');
198
- }
199
-
200
- function setupMultiFileProject(projectDir) {
201
- mkdirSync(join(projectDir, 'src'), { recursive: true });
202
- setupPackage(projectDir);
203
- writeLines(join(projectDir, 'src', 'math.mjs'), [
204
- 'export function add(a, b) {',
205
- ' return a + b;',
206
- '}',
207
- '',
208
- ]);
209
- writeLines(join(projectDir, 'src', 'format.mjs'), [
210
- 'export function titleCase(value) {',
211
- ' return String(value).split(" ").map((part) => part[0].toUpperCase() + part.slice(1)).join(" ");',
212
- '}',
213
- '',
214
- ]);
215
- writeLines(join(projectDir, 'src', 'policy.mjs'), [
216
- 'export const policy = {',
217
- ' retries: 2,',
218
- ' timeoutMs: 1500,',
219
- '};',
220
- '',
221
- ]);
222
- writeLines(join(projectDir, 'src', 'smoke.mjs'), [
223
- 'import { add, subtract } from "./math.mjs";',
224
- 'import { titleCase } from "./format.mjs";',
225
- '',
226
- 'if (add(2, 3) !== 5) throw new Error("add failed");',
227
- 'if (subtract(5, 2) !== 3) throw new Error("subtract failed");',
228
- 'if (titleCase(" hello mixdog ") !== "Hello Mixdog") throw new Error("titleCase failed");',
229
- 'console.log("ok");',
230
- '',
231
- ]);
232
- }
233
-
234
- function setupTinyProject(projectDir) {
235
- mkdirSync(join(projectDir, 'src'), { recursive: true });
236
- setupPackage(projectDir);
237
- writeLines(join(projectDir, 'src', 'clamp.mjs'), [
238
- 'export function clamp(value, min, max) {',
239
- ' return value;',
240
- '}',
241
- '',
242
- ]);
243
- writeLines(join(projectDir, 'src', 'smoke.mjs'), [
244
- 'import { clamp } from "./clamp.mjs";',
245
- '',
246
- 'if (clamp(5, 0, 10) !== 5) throw new Error("middle failed");',
247
- 'if (clamp(12, 0, 10) !== 10) throw new Error("upper failed");',
248
- 'if (clamp(-1, 0, 10) !== 0) throw new Error("lower failed");',
249
- 'console.log("ok");',
250
- '',
251
- ]);
252
- }
253
-
254
- function setupLocatorProject(projectDir) {
255
- mkdirSync(join(projectDir, 'src'), { recursive: true });
256
- setupPackage(projectDir);
257
- writeLines(join(projectDir, 'src', 'boot-orchestrator.mjs'), [
258
- 'export function startBootstrapSequence() {',
259
- ' return ["config", "providers", "workers"];',
260
- '}',
261
- '',
262
- ]);
263
- writeLines(join(projectDir, 'src', 'preferences-store.mjs'), [
264
- 'export function loadUserPreferences() {',
265
- ' return { theme: "dark", fastMode: false };',
266
- '}',
267
- '',
268
- ]);
269
- writeLines(join(projectDir, 'src', 'queue-drain.mjs'), [
270
- 'export function drainAsyncQueue(queue) {',
271
- ' while (queue.length > 0) queue.shift()();',
272
- '}',
273
- '',
274
- ]);
275
- writeLines(join(projectDir, 'src', 'smoke.mjs'), [
276
- 'console.log("ok");',
277
- '',
278
- ]);
279
- }
280
-
281
- function validateMultiFileProject(projectDir) {
282
- const math = readFileSync(join(projectDir, 'src', 'math.mjs'), 'utf8');
283
- const format = readFileSync(join(projectDir, 'src', 'format.mjs'), 'utf8');
284
- return {
285
- mathHasSubtract: /export\s+function\s+subtract/.test(math),
286
- formatHandlesWhitespace: /trim\(\)/.test(format) || /filter\(/.test(format) || /\\s\+/.test(format),
287
- smokeFileExists: existsSync(join(projectDir, 'src', 'smoke.mjs')),
288
- };
289
- }
290
-
291
- function validateTinyProject(projectDir) {
292
- const clamp = readFileSync(join(projectDir, 'src', 'clamp.mjs'), 'utf8');
293
- return {
294
- clampUsesBounds: /Math\.min|Math\.max|if\s*\(|<\s*min|>\s*max/.test(clamp),
295
- smokeFileExists: existsSync(join(projectDir, 'src', 'smoke.mjs')),
296
- };
297
- }
298
-
299
- function validateReadOnlyProject(projectDir) {
300
- return {
301
- bootFileExists: existsSync(join(projectDir, 'src', 'boot-orchestrator.mjs')),
302
- prefsFileExists: existsSync(join(projectDir, 'src', 'preferences-store.mjs')),
303
- queueFileExists: existsSync(join(projectDir, 'src', 'queue-drain.mjs')),
304
- };
305
- }
306
-
307
- function compact(value, max = 700) {
308
- const raw = typeof value === 'string' ? value : JSON.stringify(value);
309
- return raw.length > max ? `${raw.slice(0, max)}...` : raw;
310
- }
311
-
312
- function agentSummary(call) {
313
- const input = call?.input || call?.arguments || call?.args || {};
314
- return {
315
- id: call?.id || call?.callId || null,
316
- name: call?.name || call?.toolName || 'tool',
317
- type: input?.type || input?.action || null,
318
- agent: input?.agent || null,
319
- tag: input?.tag || null,
320
- mode: input?.mode || null,
321
- wait: input?.wait ?? null,
322
- input: compact(input, 500),
323
- };
324
- }
325
-
326
- function evaluate(summary, scenario) {
327
- const expect = scenario.expect || {};
328
- const failures = [];
329
- const maxToolErrors = expect.allowToolErrors ? Infinity : (Number.isFinite(expect.maxToolErrors) ? expect.maxToolErrors : 0);
330
- if (!summary.ok) failures.push(summary.timedOut ? 'turn timed out' : 'turn failed');
331
- if (summary.toolErrors.length > maxToolErrors) {
332
- failures.push(`expected at most ${maxToolErrors} tool errors, got ${summary.toolErrors.length}`);
333
- }
334
- for (const [toolName, minCount] of Object.entries(expect.minToolCalls || {})) {
335
- const actual = summary.tools.counts[toolName] || 0;
336
- if (actual < minCount) failures.push(`expected ${toolName} >= ${minCount}, got ${actual}`);
337
- }
338
- for (const [toolName, maxCount] of Object.entries(expect.maxToolCalls || {})) {
339
- const actual = summary.tools.counts[toolName] || 0;
340
- if (actual > maxCount) failures.push(`expected ${toolName} <= ${maxCount}, got ${actual}`);
341
- }
342
- if (Array.isArray(expect.minToolCallsAny) && expect.minToolCallsAny.length > 0) {
343
- const hit = expect.minToolCallsAny.some((toolName) => (summary.tools.counts[toolName] || 0) > 0);
344
- if (!hit) failures.push(`expected at least one tool call from ${expect.minToolCallsAny.join(', ')}`);
345
- }
346
- if (Number.isFinite(expect.maxMutations) && summary.tools.mutations > expect.maxMutations) {
347
- failures.push(`expected mutations <= ${expect.maxMutations}, got ${summary.tools.mutations}`);
348
- }
349
- if (Number.isFinite(expect.minSpawns) && summary.agent.spawns < expect.minSpawns) {
350
- failures.push(`expected at least ${expect.minSpawns} agent spawns, got ${summary.agent.spawns}`);
351
- }
352
- if (Number.isFinite(expect.maxSpawns) && summary.agent.spawns > expect.maxSpawns) {
353
- failures.push(`expected at most ${expect.maxSpawns} agent spawns, got ${summary.agent.spawns}`);
354
- }
355
- if (Number.isFinite(expect.minFirstIterAgentCalls) && summary.agent.firstIterAgentCount < expect.minFirstIterAgentCalls) {
356
- failures.push(`expected at least ${expect.minFirstIterAgentCalls} agent calls in first agent iteration, got ${summary.agent.firstIterAgentCount}`);
357
- }
358
- if (Number.isFinite(expect.minPreEditImplementationSpawns) && summary.agent.preEditImplementationSpawns < expect.minPreEditImplementationSpawns) {
359
- failures.push(`expected at least ${expect.minPreEditImplementationSpawns} pre-edit implementation/debug agent spawns, got ${summary.agent.preEditImplementationSpawns}`);
360
- }
361
- for (const role of expect.requiredRoles || []) {
362
- if (!summary.agent.roles.includes(role)) failures.push(`missing agent role ${role}`);
363
- }
364
- if (Array.isArray(expect.requiredAnyRoles) && expect.requiredAnyRoles.length > 0) {
365
- const hasAny = expect.requiredAnyRoles.some((role) => summary.agent.roles.includes(role));
366
- if (!hasAny) failures.push(`missing any agent role from ${expect.requiredAnyRoles.join(', ')}`);
367
- }
368
- if (expect.requireFilesOk && !Object.values(summary.files || {}).every(Boolean)) {
369
- failures.push(`file validation failed: ${JSON.stringify(summary.files)}`);
370
- }
371
- for (const needle of expect.finalTextIncludes || []) {
372
- if (!String(summary.finalText || '').toLowerCase().includes(String(needle).toLowerCase())) {
373
- failures.push(`final text missing ${JSON.stringify(needle)}`);
374
- }
375
- }
376
- return failures;
377
- }
378
-
379
- function summarizeToolResult(resultPayload) {
380
- const content = typeof resultPayload?.content === 'string'
381
- ? resultPayload.content
382
- : compact(resultPayload);
383
- const toolKind = resultPayload?.toolKind
384
- || (/^Error:/i.test(content) ? 'error' : 'normal');
385
- return {
386
- toolCallId: resultPayload?.toolCallId || null,
387
- toolKind,
388
- content: compact(content, 700),
389
- };
390
- }
391
-
392
- async function runScenario(name) {
393
- const scenario = SCENARIOS[name];
394
- if (!scenario) throw new Error(`unknown scenario: ${name}. Available: ${Object.keys(SCENARIOS).join(', ')}, all`);
395
-
396
- const tempRoot = mkdtempSync(join(tmpdir(), `mixdog-lead-${name}-`));
397
- const projectDir = join(tempRoot, 'project');
398
- mkdirSync(projectDir, { recursive: true });
399
- scenario.setup(projectDir);
400
-
401
- const events = [];
402
- const toolCalls = [];
403
- const toolResults = [];
404
- const prepareResults = [];
405
- let text = '';
406
- let reasoning = '';
407
- let timedOut = false;
408
-
409
- function record(kind, payload) {
410
- events.push({ t: Math.round(performance.now()), kind, payload });
411
- }
412
-
413
- const runtime = await createMixdogSessionRuntime({
414
- provider: args.get('provider') || undefined,
415
- model: args.get('model') || undefined,
416
- cwd: projectDir,
417
- toolMode: 'full',
418
- });
419
-
420
- if (args.get('effort')) {
421
- try { await runtime.setEffort(args.get('effort')); } catch (error) { record('setEffort:error', error?.message || String(error)); }
422
- }
423
- if (args.has('fast')) {
424
- try { await runtime.setFast(args.get('fast') !== 'off'); } catch (error) { record('setFast:error', error?.message || String(error)); }
425
- }
426
- if (typeof scenario.prepare === 'function') {
427
- const prepareResult = await scenario.prepare(runtime, projectDir);
428
- prepareResults.push(prepareResult);
429
- record('prepare', compact(prepareResult, 700));
430
- }
431
-
432
- const startedAt = performance.now();
433
- record('runtime', {
434
- provider: runtime.provider,
435
- model: runtime.model,
436
- effort: runtime.effort,
437
- fast: runtime.fast,
438
- cwd: runtime.cwd,
439
- });
440
-
441
- const timer = setTimeout(() => {
442
- timedOut = true;
443
- try { runtime.abort(`lead-workflow-smoke-timeout:${name}`); } catch {}
444
- }, timeoutMs);
445
- timer.unref?.();
446
-
447
- try {
448
- const { result } = await runtime.ask(scenario.prompt(projectDir), {
449
- onToolCall(iter, calls) {
450
- for (const call of calls || []) {
451
- const summary = agentSummary(call);
452
- toolCalls.push({ iter, ...summary });
453
- record('toolCall', { iter, ...summary });
454
- }
455
- },
456
- onToolResult(resultPayload) {
457
- const summarized = summarizeToolResult(resultPayload);
458
- toolResults.push(summarized);
459
- record('toolResult', summarized);
460
- },
461
- onTextDelta(chunk) {
462
- text += chunk || '';
463
- },
464
- onReasoningDelta(chunk) {
465
- reasoning += chunk || '';
466
- },
467
- onStageChange(stage) {
468
- record('stage', stage);
469
- },
470
- });
471
- text = result?.content || text;
472
- } catch (error) {
473
- record('ask:error', error?.message || String(error));
474
- if (!timedOut) throw error;
475
- } finally {
476
- clearTimeout(timer);
477
- try { await runtime.close(`lead-workflow-smoke-done:${name}`); } catch {}
478
- }
479
-
480
- const elapsedMs = Math.round(performance.now() - startedAt);
481
- const agentCalls = toolCalls.filter((call) => call.name === 'agent');
482
- const toolCounts = {};
483
- for (const call of toolCalls) {
484
- toolCounts[call.name] = (toolCounts[call.name] || 0) + 1;
485
- }
486
- const mutationCount = toolCalls.filter((call) => call.name === 'apply_patch').length;
487
- const spawnCalls = agentCalls.filter((call) => call.type === 'spawn' || call.type === null);
488
- const mutationIters = toolCalls
489
- .filter((call) => call.name === 'apply_patch')
490
- .map((call) => Number(call.iter))
491
- .filter(Number.isFinite);
492
- const firstMutationIter = mutationIters.length ? Math.min(...mutationIters) : null;
493
- const implementationSpawnCalls = spawnCalls.filter((call) => {
494
- const agent = String(call.agent || '').toLowerCase();
495
- const tag = String(call.tag || '').toLowerCase();
496
- if (!['worker', 'heavy-worker', 'debugger'].includes(agent)) return false;
497
- return !/(verify|smoke|review|policy)/.test(tag);
498
- });
499
- const preEditImplementationSpawns = firstMutationIter == null
500
- ? implementationSpawnCalls.length
501
- : implementationSpawnCalls.filter((call) => Number(call.iter) < firstMutationIter).length;
502
- const distinctRoles = [...new Set(agentCalls.map((call) => call.agent).filter(Boolean))];
503
- const distinctTags = [...new Set(agentCalls.map((call) => call.tag).filter(Boolean))];
504
- const firstAgentIter = Math.min(...agentCalls.map((call) => Number(call.iter)).filter(Number.isFinite));
505
- const firstIterAgentCount = Number.isFinite(firstAgentIter)
506
- ? agentCalls.filter((call) => Number(call.iter) === firstAgentIter).length
507
- : 0;
508
-
509
- const summary = {
510
- scenario: name,
511
- description: scenario.description,
512
- ok: !timedOut,
513
- timedOut,
514
- elapsedMs,
515
- tempRoot,
516
- projectDir,
517
- route: events.find((e) => e.kind === 'runtime')?.payload || null,
518
- prepareResults,
519
- agent: {
520
- calls: agentCalls.length,
521
- spawns: spawnCalls.length,
522
- firstAgentIter: Number.isFinite(firstAgentIter) ? firstAgentIter : null,
523
- firstIterAgentCount,
524
- firstMutationIter,
525
- implementationSpawns: implementationSpawnCalls.length,
526
- preEditImplementationSpawns,
527
- roles: distinctRoles,
528
- tags: distinctTags,
529
- },
530
- tools: {
531
- counts: toolCounts,
532
- mutations: mutationCount,
533
- retrievalCalls: ['explore', 'recall', 'search', 'web_fetch'].reduce((out, name) => {
534
- out[name] = toolCounts[name] || 0;
535
- return out;
536
- }, {}),
537
- },
538
- files: scenario.validate(projectDir),
539
- finalText: compact(text, 1600),
540
- recentEvents: events.slice(-40),
541
- allToolCalls: toolCalls,
542
- toolErrors: toolResults.filter((result) => result.toolKind === 'error'),
543
- toolResultCount: toolResults.length,
544
- reasoningChars: reasoning.length,
545
- };
546
-
547
- summary.failures = evaluate(summary, scenario);
548
- summary.passed = summary.failures.length === 0;
549
-
550
- if (!keep) {
551
- try { rmSync(tempRoot, { recursive: true, force: true }); } catch {}
552
- }
553
-
554
- return summary;
555
- }
556
-
557
- async function main() {
558
- const names = selectedScenario === 'all'
559
- ? Object.keys(SCENARIOS)
560
- : selectedScenario.split(',').map((part) => part.trim()).filter(Boolean);
561
- const summaries = [];
562
- for (const name of names) {
563
- const summary = await runScenario(name);
564
- summaries.push(summary);
565
- console.log(JSON.stringify(summary, null, 2));
566
- }
567
- const passed = summaries.every((summary) => summary.passed);
568
- if (summaries.length > 1) {
569
- console.log(JSON.stringify({
570
- passed,
571
- scenarios: summaries.map((summary) => ({
572
- scenario: summary.scenario,
573
- passed: summary.passed,
574
- elapsedMs: summary.elapsedMs,
575
- spawns: summary.agent.spawns,
576
- firstIterAgentCount: summary.agent.firstIterAgentCount,
577
- roles: summary.agent.roles,
578
- failures: summary.failures,
579
- })),
580
- }, null, 2));
581
- }
582
- process.exitCode = passed ? 0 : 1;
583
- }
584
-
585
- main()
586
- .then(() => {
587
- process.exit(process.exitCode || 0);
588
- })
589
- .catch((error) => {
590
- console.error(error?.stack || error?.message || String(error));
591
- process.exit(1);
592
- });