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
package/src/ui/ansi.mjs CHANGED
@@ -151,18 +151,9 @@ export const gray = sgr('38;2;198;198;198');
151
151
  export const grey = gray;
152
152
 
153
153
  // Bright variants (used sparingly for headings / accents).
154
- export const brightRed = sgr('38;2;220;70;88');
155
154
  export const brightGreen = sgr('38;2;0;185;88');
156
- export const brightYellow = sgr('38;2;255;210;80');
157
- export const brightBlue = sgr('38;2;93;173;255');
158
- export const brightMagenta = sgr('38;2;190;150;230');
159
- export const brightCyan = sgr('38;2;168;168;168');
160
- export const brightWhite = sgr('38;2;220;220;220');
161
155
 
162
156
  // --- Background colors ------------------------------------------------------
163
- export const bgGray = sgr('100');
164
- export const bgBlack = sgr('40');
165
- export const bgBlue = sgr('44');
166
157
 
167
158
  // --- RGB colors --------------------------------------------------------------
168
159
  // Emit 24-bit SGR where supported, otherwise use the nearest 256-color entry.
@@ -15,7 +15,6 @@ import { getModelMetadataSync } from '../runtime/agent/orchestrator/providers/mo
15
15
  export const FALLBACK_CONTEXT_WINDOW = 200000;
16
16
  export const statusText = rgb(198, 198, 198);
17
17
  export const statusSubtle = rgb(136, 136, 136);
18
- export const statusAccent = rgb(215, 119, 87);
19
18
 
20
19
  function sgr(code) {
21
20
  return colorEnabled() ? `\x1b[${code}m` : '';
@@ -27,7 +26,6 @@ export const D = colorEnabled() ? rgbSgr(136, 136, 136) : '';
27
26
  export const GRN = colorEnabled() ? rgbSgr(0, 170, 75) : '';
28
27
  export const YLW = colorEnabled() ? rgbSgr(255, 193, 7) : '';
29
28
  export const RED = colorEnabled() ? rgbSgr(220, 70, 88) : '';
30
- export const CYN = colorEnabled() ? rgbSgr(136, 136, 136) : '';
31
29
  export const GREY = colorEnabled() ? rgbSgr(136, 136, 136) : '';
32
30
 
33
31
  export function terminalColumns() {
@@ -80,7 +78,7 @@ export function formatContextSegment(ctxPct, cols) {
80
78
  return `${fill}${filled}${R}${D}${empty}${R} ${label}%`;
81
79
  }
82
80
 
83
- export function makeBar(pct, cells) {
81
+ function makeBar(pct, cells) {
84
82
  let filled = Math.floor((Number(pct) || 0) * cells / 100);
85
83
  if (filled < 0) filled = 0;
86
84
  if (filled > cells) filled = cells;
@@ -105,7 +103,7 @@ export function num(v) {
105
103
  return Number.isFinite(n) ? n : 0;
106
104
  }
107
105
 
108
- export function clampPct(v) {
106
+ function clampPct(v) {
109
107
  const n = Number(v);
110
108
  if (!Number.isFinite(n)) return 0;
111
109
  return Math.max(0, Math.min(100, n));
@@ -1,20 +0,0 @@
1
- [
2
- {
3
- "id": "cwc-hookflow",
4
- "agent": "worker",
5
- "prompt": "In this repo (mixdog), what happens to a tool call when no hooks are configured? Verify the default observer/bypass path: where beforeTool() is invoked, what it returns with no configured rules, and where a configured custom hook rule could instead deny the call. Give file paths and function names. Do not modify anything.",
6
- "cwd": "."
7
- },
8
- {
9
- "id": "cwc-cacheusage",
10
- "agent": "worker",
11
- "prompt": "In this repo (mixdog), how are cached token counts recorded and surfaced in usage metrics? Find where cached_tokens comes from and how it flows into the usage record. Give file paths and function names. Do not modify anything.",
12
- "cwd": "."
13
- },
14
- {
15
- "id": "cwc-compacttrigger",
16
- "agent": "worker",
17
- "prompt": "In this repo (mixdog), what triggers a context compaction and where is that threshold decided? Trace the trigger condition to the compaction entry point. Give file paths and function names. Do not modify anything.",
18
- "cwd": "."
19
- }
20
- ]
@@ -1,42 +0,0 @@
1
- import React from 'react';
2
- import { Box, renderToString } from 'ink';
3
- import { ToolExecution } from '../src/tui/components/ToolExecution.jsx';
4
- import { estimateTranscriptItemRowsCached } from '../src/tui/app/transcript-window.mjs';
5
- function renderRows(item,COLUMNS){
6
- const node=React.createElement(Box,{flexDirection:'column',flexShrink:0,width:COLUMNS},
7
- React.createElement(ToolExecution,{name:item.name,args:item.args,result:item.result,rawResult:item.rawResult,isError:item.isError,errorCount:item.errorCount,expanded:!!item.expanded,columns:COLUMNS,attached:false,count:item.count,completedCount:item.completedCount,startedAt:item.startedAt,completedAt:item.completedAt,aggregate:item.aggregate,categories:item.categories,doneCategories:item.doneCategories,headerFinalized:item.headerFinalized,deferredDisplayReady:item.deferredDisplayReady}));
8
- const out=renderToString(node,{columns:COLUMNS});
9
- return out===''?0:out.split('\n').length;
10
- }
11
- const now=Date.now();
12
- const longLine='x'.repeat(200);
13
- const items=[];
14
- const names=['read','grep','glob','shell','code_graph','explore','search','web_fetch','agent','Skill','view_image','recall','remember','task','list'];
15
- const results=[null,'','ok','No matches','line1\nline2','line1\nline2\nline3',longLine, longLine+'\n'+longLine, '[status: cancelled]\nbody', 'Error: boom'];
16
- let id=0;
17
- for(const name of names){
18
- for(const result of results){
19
- for(const completed of [0,1]){
20
- for(const isError of [false,true]){
21
- for(const expanded of [false,true]){
22
- items.push({name,args:{path:'a/b/c.js',pattern:'foo',command:'ls -la',mode:'search',symbols:'X',action:'spawn',status: completed?'completed':'',name:'setup'},result,count:1,completedCount:completed,isError,expanded,startedAt:now-2000,completedAt:completed?now:0,headerFinalized:completed===1,deferredDisplayReady:true,rawResult: expanded?(result||'raw body\nl2'):null,__id:id++});
23
- }
24
- }
25
- }
26
- }
27
- }
28
- const COLS=[40,60,80,100,120];
29
- let bad=0,total=0;
30
- const seen=new Set();
31
- for(const COLUMNS of COLS){
32
- for(const it of items){
33
- total++;
34
- const est=estimateTranscriptItemRowsCached({kind:'tool',...it},COLUMNS,false);
35
- let ren; try{ren=renderRows(it,COLUMNS);}catch(e){ren='ERR:'+e.message;}
36
- if(est!==ren){bad++;
37
- const key=`${it.name}|res=${JSON.stringify(it.result)}|c=${it.completedCount}|e=${it.isError}|x=${it.expanded}|col=${COLUMNS}`;
38
- if(bad<=40) console.log(`DIFF est=${est} ren=${ren} ${key}`);
39
- }
40
- }
41
- }
42
- console.log('total',total,'mismatches',bad);
@@ -1,30 +0,0 @@
1
- import React from 'react';
2
- import { Box, renderToString } from 'ink';
3
- import { ToolExecution } from '../src/tui/components/ToolExecution.jsx';
4
- import { estimateTranscriptItemRowsCached } from '../src/tui/app/transcript-window.mjs';
5
- import { shouldSuppressFullyFailedToolItem } from '../src/tui/transcript-tool-failures.mjs';
6
- function renderRows(item,COLUMNS){
7
- const node=React.createElement(Box,{flexDirection:'column',flexShrink:0,width:COLUMNS},
8
- React.createElement(ToolExecution,{name:item.name,args:item.args,result:item.result,rawResult:item.rawResult,isError:item.isError,errorCount:item.errorCount,expanded:!!item.expanded,columns:COLUMNS,attached:false,count:item.count,completedCount:item.completedCount,startedAt:item.startedAt,completedAt:item.completedAt,aggregate:item.aggregate,categories:item.categories,doneCategories:item.doneCategories,headerFinalized:item.headerFinalized,deferredDisplayReady:item.deferredDisplayReady}));
9
- const out=renderToString(node,{columns:COLUMNS});
10
- return out===''?0:out.split('\n').length;
11
- }
12
- const now=Date.now();
13
- const names=['read','grep','glob','shell','code_graph','explore','search','web_fetch','agent','Skill','view_image','recall','list','fetch','load_tool'];
14
- const results=['ok','No matches','line1\nline2','line1\nline2\nline3','done · 3 items','Failed', 'Read 40 lines'];
15
- const cases=[];
16
- let id=0;
17
- for(const name of names) for(const result of results) for(const completed of [0,1]) for(const isError of [false,true]){
18
- cases.push({name,args:{path:'a/b/c.js',pattern:'foo',command:'ls -la',mode:'search',symbols:'X',action:'response',status: completed?'completed':'',name:'setup'},result: completed?result:null,count:1,completedCount:completed,isError,expanded:false,startedAt:now-2000,completedAt:completed?now:0,headerFinalized:completed===1,deferredDisplayReady:true,rawResult:null,__id:id++});
19
- }
20
- const COLS=[60,80,100,120];
21
- let bad=0,total=0;
22
- for(const COLUMNS of COLS) for(const it of cases){
23
- const full={kind:'tool',...it};
24
- if(shouldSuppressFullyFailedToolItem(full)) continue; // real app renders nothing
25
- total++;
26
- const est=estimateTranscriptItemRowsCached(full,COLUMNS,false);
27
- let ren; try{ren=renderRows(it,COLUMNS);}catch(e){ren='ERR:'+e.message;}
28
- if(est!==ren){bad++; if(bad<=60) console.log(`DIFF est=${est} ren=${ren} ${it.name}|res=${JSON.stringify(it.result)}|c=${it.completedCount}|e=${it.isError}|col=${COLUMNS}`);}
29
- }
30
- console.log('total',total,'mismatches',bad);
@@ -1,35 +0,0 @@
1
- import React from 'react';
2
- import { Box, renderToString } from 'ink';
3
- import { ToolExecution } from '../src/tui/components/ToolExecution.jsx';
4
- import { estimateTranscriptItemRowsCached } from '../src/tui/app/transcript-window.mjs';
5
- const COLUMNS=80;
6
- function renderRows(item){
7
- const node=React.createElement(Box,{flexDirection:'column',flexShrink:0,width:COLUMNS},
8
- React.createElement(ToolExecution,{name:item.name,args:item.args,result:item.result,rawResult:item.rawResult,isError:item.isError,errorCount:item.errorCount,expanded:!!item.expanded,columns:COLUMNS,attached:false,count:item.count,completedCount:item.completedCount,startedAt:item.startedAt,completedAt:item.completedAt,aggregate:item.aggregate,categories:item.categories,doneCategories:item.doneCategories,headerFinalized:item.headerFinalized,deferredDisplayReady:item.deferredDisplayReady}));
9
- const out=renderToString(node,{columns:COLUMNS});
10
- return out===''?0:out.split('\n').length;
11
- }
12
- const now=Date.now();
13
- const F=[
14
- ['read pending',{name:'read',args:{path:'a.js'},result:null,count:1,completedCount:0,startedAt:now-2000,deferredDisplayReady:true,headerFinalized:false}],
15
- ['read settled',{name:'read',args:{path:'a.js'},result:'Read 40 lines',count:1,completedCount:1,startedAt:now-2000,completedAt:now,deferredDisplayReady:true,headerFinalized:true}],
16
- ['grep settled 0',{name:'grep',args:{pattern:'foo'},result:'No matches',count:1,completedCount:1,startedAt:now-1000,completedAt:now,headerFinalized:true}],
17
- ['shell pending',{name:'shell',args:{command:'ls'},result:null,count:1,completedCount:0,startedAt:now-2000,deferredDisplayReady:true}],
18
- ['shell settled',{name:'shell',args:{command:'ls'},result:'file1\nfile2',count:1,completedCount:1,startedAt:now-2000,completedAt:now,headerFinalized:true}],
19
- ['shell settled empty',{name:'shell',args:{command:'ls'},result:'',count:1,completedCount:1,startedAt:now,completedAt:now,headerFinalized:true}],
20
- ['agent pending',{name:'agent',args:{action:'spawn'},result:null,count:1,completedCount:0,startedAt:now-2000,deferredDisplayReady:true}],
21
- ['agent settled resp',{name:'agent',args:{action:'response',status:'completed'},result:'Agent reply body here',count:1,completedCount:1,startedAt:now,completedAt:now,headerFinalized:true}],
22
- ['skill settled',{name:'Skill',args:{name:'setup'},result:'loaded body\nmore',count:1,completedCount:1,startedAt:now,completedAt:now,headerFinalized:true}],
23
- ['code_graph settled',{name:'code_graph',args:{mode:'search',symbols:'x'},result:'3 results',count:1,completedCount:1,startedAt:now,completedAt:now,headerFinalized:true}],
24
- ['aggregate pending',{name:'read',args:{categoryOrder:['read']},aggregate:true,result:null,count:3,completedCount:0,startedAt:now-2000,categories:{read:{count:3}},deferredDisplayReady:true}],
25
- ['aggregate settled',{name:'read',args:{categoryOrder:['read']},aggregate:true,result:'Read 3 files',count:3,completedCount:3,startedAt:now-2000,completedAt:now,categories:{read:{count:3}},doneCategories:{read:{count:3}},headerFinalized:true}],
26
- ];
27
- let bad=0;
28
- for(const [label,item] of F){
29
- const est=estimateTranscriptItemRowsCached({kind:'tool',...item},COLUMNS,false);
30
- const ren=renderRows(item);
31
- const m=est===ren?'ok ':'DIFF';
32
- if(est!==ren)bad++;
33
- console.log(`${m} est=${est} render=${ren} ${label}`);
34
- }
35
- console.log('mismatches:',bad);
package/scripts/_jp2.jsx DELETED
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- import { Box } from 'ink';
3
- import { render } from 'ink';
4
- import stripAnsi from 'strip-ansi';
5
- import { ToolExecution } from '../src/tui/components/ToolExecution.jsx';
6
- const COLUMNS=80;
7
- let buf='';
8
- const stdout={columns:COLUMNS,rows:200,write:(s)=>{buf+=s;return true;},on(){},off(){},removeListener(){}};
9
- const item={ name:'read', args:{path:'a.js'}, result:'Read 40 lines', count:1, completedCount:1, startedAt:Date.now()-2000, completedAt:Date.now(), deferredDisplayReady:true, headerFinalized:true };
10
- const node=React.createElement(Box,{flexDirection:'column',flexShrink:0,width:COLUMNS},React.createElement(ToolExecution,{name:item.name,args:item.args,result:item.result,columns:COLUMNS,count:1,completedCount:1,startedAt:item.startedAt,completedAt:item.completedAt,headerFinalized:true,deferredDisplayReady:true}));
11
- const inst=render(node,{stdout,patchConsole:false});
12
- await new Promise(r=>setTimeout(r,60));
13
- console.log('RAW len',buf.length);
14
- console.log(JSON.stringify(buf));
15
- inst.unmount();
16
- process.exit(0);
@@ -1,7 +0,0 @@
1
- const wd = setTimeout(() => {
2
- console.error('=== WATCHDOG 45s: active resources:', JSON.stringify(process.getActiveResourcesInfo()));
3
- process.exit(99);
4
- }, 45000);
5
- await import('./compact-smoke.mjs');
6
- clearTimeout(wd);
7
- console.error('=== script import completed normally');
@@ -1,175 +0,0 @@
1
- #!/usr/bin/env node
2
- // Regression: bounded manual-abort recovery. Esc calls runtime.abort(), which
3
- // normally rejects the in-flight runtime.ask() so the turn's finally clears
4
- // busy. If that unwind is STARVED (provider abort never settles after a
5
- // post-tool fetch stall), busy must not stay true forever — a short grace timer
6
- // hard-releases the store and re-kicks drain. A normal abort that settles in
7
- // time must NOT be masked by the recovery.
8
- import test from 'node:test';
9
- import assert from 'node:assert/strict';
10
- import { createSessionFlow } from '../src/tui/engine/session-flow.mjs';
11
- import { createEngineApiA } from '../src/tui/engine/session-api.mjs';
12
-
13
- const wait = (ms) => new Promise((r) => setTimeout(r, ms));
14
-
15
- // Minimal engine bag exercising only the abort() recovery path. `abortSettles`
16
- // models whether runtime.abort() actually unwinds the turn (clears busy) — the
17
- // starved case leaves busy=true so the recovery timer must fire.
18
- function makeEngine({ abortSettles = false, recoveryMs = 30 } = {}) {
19
- let seq = 0;
20
- const notices = [];
21
- const requeued = [];
22
- const discardedCompletionKeys = [];
23
- const abortReasons = [];
24
- let drainCount = 0;
25
- let state = { items: [], queued: [], busy: false, commandBusy: false, spinner: null, thinking: null, lastTurn: null };
26
- const bag = {
27
- runtime: {
28
- id: null,
29
- consumePendingSessionReset: () => null,
30
- abort: (reason) => {
31
- abortReasons.push(reason);
32
- if (abortSettles) bag.set({ busy: false, spinner: null, thinking: null, lastTurn: null });
33
- return true;
34
- },
35
- },
36
- nextId: () => `id_${++seq}`,
37
- tuiDebug: () => {},
38
- flags: { leadTurnEpoch: 1, disposed: false, draining: false, activePromptRestore: null, manualAbortRecoveryMs: recoveryMs },
39
- pending: [],
40
- listeners: new Set(),
41
- getState: () => state,
42
- set: (patch) => {
43
- if (!patch || typeof patch !== 'object') return false;
44
- state = { ...state, ...patch };
45
- return true;
46
- },
47
- pushItem: () => {},
48
- patchItem: () => {},
49
- replaceItems: (x) => x,
50
- pushNotice: (text, level) => { notices.push({ text, level }); },
51
- pushUserOrSyntheticItem: () => {},
52
- autoClearState: () => ({ enabled: false }),
53
- agentStatusState: () => ({}),
54
- routeState: () => ({}),
55
- syncContextStats: () => {},
56
- denyAllToolApprovals: () => {},
57
- updateAgentJobCard: () => {},
58
- requeueEntriesFront: (entries) => { requeued.push(...entries); },
59
- resetStatsAndSyncContext: () => {},
60
- flushDeferredExecutionPendingResumeKick: () => {},
61
- discardExecutionPendingResume: (keys) => { discardedCompletionKeys.push(...keys); },
62
- drain: async () => { drainCount += 1; },
63
- runTurn: async () => 'ok',
64
- };
65
- Object.assign(bag, createSessionFlow(bag));
66
- bag.drain = async () => { drainCount += 1; };
67
- const api = createEngineApiA(bag);
68
- return {
69
- api,
70
- bag,
71
- getNotices: () => notices,
72
- getDrainCount: () => drainCount,
73
- getRequeued: () => requeued,
74
- getDiscardedCompletionKeys: () => discardedCompletionKeys,
75
- getAbortReasons: () => abortReasons,
76
- };
77
- }
78
-
79
- test('Esc uses Claude-compatible user-cancel and queued interrupt reasons', () => {
80
- const normal = makeEngine({ abortSettles: true });
81
- normal.bag.set({ busy: true });
82
- normal.api.abort();
83
- assert.deepEqual(normal.getAbortReasons(), ['user-cancel']);
84
-
85
- const queued = makeEngine({ abortSettles: true });
86
- queued.bag.set({ busy: true });
87
- queued.bag.pending.push({ kind: 'prompt', text: 'queued redirect' });
88
- queued.api.abort();
89
- assert.deepEqual(queued.getAbortReasons(), ['interrupt']);
90
- });
91
-
92
- test('starved abort → bounded recovery hard-releases busy and re-kicks drain', async () => {
93
- const { api, bag, getNotices, getDrainCount } = makeEngine({ abortSettles: false, recoveryMs: 25 });
94
- bag.set({ busy: true, spinner: { active: true } });
95
- bag.pending.push({ kind: 'prompt', text: 'queued next' });
96
- const res = api.abort();
97
- assert.equal(res.aborted, true, 'abort dispatched to runtime');
98
- assert.equal(bag.getState().busy, true, 'still busy immediately after abort (unwind pending)');
99
- await wait(60);
100
- assert.equal(bag.getState().busy, false, 'recovery timer force-releases busy');
101
- assert.equal(bag.getState().spinner, null, 'spinner cleared on recovery');
102
- assert.equal(bag.flags.leadTurnEpoch, 2, 'epoch bumped so stuck turn finally becomes a no-op');
103
- assert.equal(getDrainCount() >= 1, true, 'drain re-kicked so queued prompt runs');
104
- assert.equal(getNotices().some((n) => /did not settle/i.test(n.text)), true, 'user told input was restored');
105
- });
106
-
107
- test('starved abort abandons old drain owner before re-kicking drain', async () => {
108
- const { api, bag, getDrainCount } = makeEngine({ abortSettles: false, recoveryMs: 25 });
109
- bag.flags.draining = true;
110
- bag.flags.drainEpoch = 10;
111
- bag.set({ busy: true, spinner: { active: true } });
112
- bag.pending.push({ kind: 'prompt', text: 'queued next' });
113
-
114
- api.abort();
115
- await wait(60);
116
-
117
- assert.equal(bag.getState().busy, false);
118
- assert.equal(bag.flags.draining, false, 'stuck drain lock was released only after epoch abandonment');
119
- assert.equal(bag.flags.drainEpoch > 10, true, 'old drain owner invalidated');
120
- assert.equal(getDrainCount() >= 1, true, 'new drain kick requested for pending work');
121
- });
122
-
123
- test('abort that settles in time is NOT masked by recovery', async () => {
124
- const { api, bag, getNotices } = makeEngine({ abortSettles: true, recoveryMs: 25 });
125
- bag.set({ busy: true, spinner: { active: true } });
126
- const res = api.abort();
127
- assert.equal(res.aborted, true);
128
- assert.equal(bag.getState().busy, false, 'settled abort cleared busy synchronously');
129
- const epochAfter = bag.flags.leadTurnEpoch;
130
- await wait(60);
131
- assert.equal(bag.flags.leadTurnEpoch, epochAfter, 'recovery no-ops (no epoch bump) when busy already cleared');
132
- assert.equal(getNotices().some((n) => /did not settle/i.test(n.text)), false, 'no spurious recovery notice');
133
- });
134
-
135
- test('recovery no-ops if a newer turn already owns the store', async () => {
136
- const { api, bag } = makeEngine({ abortSettles: false, recoveryMs: 25 });
137
- bag.set({ busy: true });
138
- api.abort();
139
- bag.flags.leadTurnEpoch = 5;
140
- bag.set({ busy: true, spinner: { active: true, verb: 'new turn' } });
141
- await wait(60);
142
- assert.equal(bag.flags.leadTurnEpoch, 5, 'recovery must not touch a newer turn epoch');
143
- assert.equal(bag.getState().busy, true, 'newer turn stays busy — not force-released');
144
- });
145
-
146
- for (const phase of ['before first delta', 'after response progress']) {
147
- test(`Esc ${phase} abandons the active completion resume`, () => {
148
- const {
149
- api, bag, getRequeued, getDiscardedCompletionKeys,
150
- } = makeEngine({ abortSettles: true });
151
- bag.flags.activePromptRestore = {
152
- text: 'completion response',
153
- restorable: false,
154
- committed: false,
155
- requeueEntries: [{
156
- mode: 'pending-resume',
157
- text: 'completion response',
158
- abortDiscardOnAbort: true,
159
- }],
160
- discardExecutionPendingResumeKeys: ['execution_A'],
161
- };
162
- bag.set({
163
- busy: true,
164
- spinner: { active: true, responseLength: phase === 'after response progress' ? 24 : 0 },
165
- thinking: phase === 'after response progress' ? { text: 'working' } : null,
166
- });
167
-
168
- assert.equal(api.abort().aborted, true);
169
- assert.equal(bag.getState().busy, false, 'Esc releases the active completion turn');
170
- assert.equal(bag.getState().spinner, null, 'spinner is cleared');
171
- assert.equal(bag.getState().thinking, null, 'thinking is cleared');
172
- assert.deepEqual(getRequeued(), [], 'the completion resume is not requeued');
173
- assert.deepEqual(getDiscardedCompletionKeys(), ['execution_A'], 'its completion ownership is retired');
174
- });
175
- }
@@ -1,31 +0,0 @@
1
- #!/usr/bin/env node
2
- import test from 'node:test';
3
- import assert from 'node:assert/strict';
4
- import { composeAgentDispatchAbortSignal } from '../src/runtime/agent/orchestrator/agent-runtime/agent-dispatch.mjs';
5
-
6
- test('explore cancellation survives an active idle watchdog composite link', () => {
7
- const factory = new AbortController();
8
- const explore = new AbortController();
9
- const idleWatchdog = new AbortController();
10
- const linked = composeAgentDispatchAbortSignal([
11
- factory.signal,
12
- explore.signal,
13
- idleWatchdog.signal,
14
- ]);
15
- const reason = new Error('explore ESC');
16
- explore.abort(reason);
17
- assert.equal(linked.signal.aborted, true);
18
- assert.equal(linked.signal.reason, reason, 'per-call explore reason reaches the one session link');
19
- assert.equal(idleWatchdog.signal.aborted, false, 'watchdog remains independently active');
20
- linked.dispose();
21
- });
22
-
23
- test('an already-aborted parent reason is retained before the askSession controller swap', () => {
24
- const factory = new AbortController();
25
- const reason = new Error('factory canceled first');
26
- factory.abort(reason);
27
- const linked = composeAgentDispatchAbortSignal([factory.signal, new AbortController().signal]);
28
- assert.equal(linked.signal.aborted, true);
29
- assert.equal(linked.signal.reason, reason);
30
- linked.dispose();
31
- });
@@ -1,20 +0,0 @@
1
- // Standalone regression smoke for validateBuiltinArgs guard behavior.
2
- // Mirrors arg-guard-test.mjs style; runs with `node --test`.
3
- import test from 'node:test';
4
- import assert from 'node:assert/strict';
5
- import { validateBuiltinArgs } from '../src/runtime/agent/orchestrator/tools/builtin/arg-guard.mjs';
6
-
7
- test('smoke: valid read args pass and numeric strings coerce', () => {
8
- const a = { path: 'x.mjs', offset: '2', limit: '10' };
9
- assert.equal(validateBuiltinArgs('read', a), null);
10
- assert.equal(a.offset, 2);
11
- assert.equal(a.limit, 10);
12
- });
13
-
14
- test('smoke: non-numeric arg still errors', () => {
15
- assert.match(validateBuiltinArgs('read', { path: 'x.mjs', limit: 'nope' }), /must be an integer/);
16
- });
17
-
18
- test('smoke: below-min arg still errors', () => {
19
- assert.match(validateBuiltinArgs('read', { path: 'x.mjs', offset: -1 }), /must be >= 0/);
20
- });
@@ -1,34 +0,0 @@
1
- import test from 'node:test';
2
- import assert from 'node:assert/strict';
3
- import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from 'node:fs';
4
- import { tmpdir } from 'node:os';
5
- import { join } from 'node:path';
6
- import { findBySuffixStrip } from '../src/runtime/agent/orchestrator/tools/builtin/path-diagnostics.mjs';
7
-
8
- function makeRepo() {
9
- const root = mkdtempSync(join(tmpdir(), 'mixdog-suffix-smoke-'));
10
- mkdirSync(join(root, 'src', 'tui'), { recursive: true });
11
- writeFileSync(join(root, 'src', 'tui', 'input-editing.mjs'), '// real file\n');
12
- return root;
13
- }
14
-
15
- test('smoke: hallucinated absolute prefix resolves to the real repo-relative file', () => {
16
- const root = makeRepo();
17
- try {
18
- const hallucinated = '/Users/nobody/Elsewhere/Project/ink/src/tui/input-editing.mjs';
19
- const hit = findBySuffixStrip(root, hallucinated);
20
- assert.equal(hit, 'src/tui/input-editing.mjs');
21
- } finally {
22
- rmSync(root, { recursive: true, force: true });
23
- }
24
- });
25
-
26
- test('smoke: a non-existent tail resolves to null', () => {
27
- const root = makeRepo();
28
- try {
29
- const hit = findBySuffixStrip(root, '/Users/nobody/Elsewhere/Project/does/not/here.mjs');
30
- assert.equal(hit, null);
31
- } finally {
32
- rmSync(root, { recursive: true, force: true });
33
- }
34
- });
@@ -1,45 +0,0 @@
1
- #!/usr/bin/env node
2
- // Standalone regression smoke pinning the tool_call arguments contract used by
3
- // the native providers (see scripts/toolcall-args-test.mjs for the full suite).
4
- // Same unit-test style: synthetic inputs fed to the exported parser, asserting
5
- // the outcome — no network, no model. Kept minimal so it can run in isolation
6
- // via `node --test scripts/agent-live-toolcall-args-smoke.mjs`.
7
- import test from 'node:test';
8
- import assert from 'node:assert/strict';
9
- import {
10
- parseCompletedToolCallArgumentsJson,
11
- isInvalidToolArgsMarker,
12
- formatInvalidToolArgsResult,
13
- } from '../src/runtime/agent/orchestrator/providers/openai-compat-stream.mjs';
14
-
15
- test('smoke: valid arguments JSON parses to the intended object', () => {
16
- const out = parseCompletedToolCallArgumentsJson(
17
- '{"pattern":"x","path":"src"}', 'smoke', { finishReason: 'stop' });
18
- assert.deepEqual(out, { pattern: 'x', path: 'src' });
19
- });
20
-
21
- test('smoke: empty/missing arguments default to {}', () => {
22
- assert.deepEqual(parseCompletedToolCallArgumentsJson('', 'smoke', { finishReason: 'stop' }), {});
23
- assert.deepEqual(parseCompletedToolCallArgumentsJson(undefined, 'smoke'), {});
24
- });
25
-
26
- test('smoke: malformed args with finishReason → invalid-args marker (no throw)', () => {
27
- const bareword = '{"pattern": dispatchAiWrapped, "path": "src/agent"}';
28
- const out = parseCompletedToolCallArgumentsJson(bareword, 'smoke', { finishReason: 'stop' });
29
- assert.equal(isInvalidToolArgsMarker(out), true);
30
- assert.equal(out.__rawArguments, bareword);
31
- const msg = formatInvalidToolArgsResult({ name: 'grep', arguments: out });
32
- assert.match(msg, /Re-issue this tool call with valid JSON arguments/);
33
- });
34
-
35
- test('smoke: malformed args without finishReason → retryable TruncatedStreamError', () => {
36
- let threw;
37
- try {
38
- parseCompletedToolCallArgumentsJson('{', 'smoke');
39
- } catch (err) {
40
- threw = err;
41
- }
42
- assert.ok(threw instanceof Error, 'must throw on mid-stream truncation');
43
- assert.equal(threw.code, 'TRUNCATED_STREAM');
44
- assert.equal(threw.truncatedStream, true);
45
- });
@@ -1,37 +0,0 @@
1
- #!/usr/bin/env node
2
- import test from 'node:test';
3
- import assert from 'node:assert/strict';
4
- import {
5
- resolveSessionMaxLoopIterations,
6
- LEAD_MAX_LOOP_ITERATIONS,
7
- } from '../src/runtime/agent/orchestrator/agent-runtime/agent-loop-policy.mjs';
8
-
9
- // No low per-agent caps: every public/delegated agent shares the single high
10
- // runaway guard (LEAD_MAX_LOOP_ITERATIONS) unless a session pins its own value.
11
- test('agent owner session falls through to the shared runaway guard when unset', () => {
12
- const cap = resolveSessionMaxLoopIterations({
13
- owner: 'agent',
14
- agent: 'heavy-worker',
15
- permission: 'read-write',
16
- maxLoopIterations: null,
17
- });
18
- assert.equal(cap, LEAD_MAX_LOOP_ITERATIONS);
19
- });
20
-
21
- test('lead session keeps the same shared ceiling when unset', () => {
22
- assert.equal(resolveSessionMaxLoopIterations({ owner: 'user', agent: null }), LEAD_MAX_LOOP_ITERATIONS);
23
- });
24
-
25
- test('a session-pinned maxLoopIterations is honored', () => {
26
- assert.equal(
27
- resolveSessionMaxLoopIterations({ owner: 'agent', agent: 'heavy-worker', maxLoopIterations: 4 }),
28
- 4,
29
- );
30
- });
31
-
32
- test('explicit override wins over everything', () => {
33
- assert.equal(
34
- resolveSessionMaxLoopIterations({ owner: 'agent', agent: 'heavy-worker', maxLoopIterations: 4 }, 50),
35
- 50,
36
- );
37
- });