mixdog 0.9.63 → 0.9.64
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.
- package/README.md +3 -0
- package/package.json +9 -2
- package/scripts/code-graph-description-contract.mjs +3 -3
- package/scripts/verify-release-assets.mjs +2 -2
- package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch.mjs +11 -14
- package/src/runtime/agent/orchestrator/agent-runtime/agent-progress-watchdog.mjs +6 -6
- package/src/runtime/agent/orchestrator/agent-runtime/cache-strategy.mjs +2 -2
- package/src/runtime/agent/orchestrator/agent-trace-format.mjs +1 -0
- package/src/runtime/agent/orchestrator/config.mjs +19 -124
- package/src/runtime/agent/orchestrator/context/collect.mjs +6 -6
- package/src/runtime/agent/orchestrator/dispatch-persist.mjs +2 -2
- package/src/runtime/agent/orchestrator/internal-agents.mjs +2 -2
- package/src/runtime/agent/orchestrator/mcp/child-tree.mjs +1 -1
- package/src/runtime/agent/orchestrator/mcp/client.mjs +4 -4
- package/src/runtime/agent/orchestrator/providers/admission-scheduler.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/anthropic-betas.mjs +4 -4
- package/src/runtime/agent/orchestrator/providers/anthropic-effort.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/anthropic-max-tokens.mjs +4 -4
- package/src/runtime/agent/orchestrator/providers/anthropic-messages.mjs +333 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-model-resolve.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-credentials.mjs +4 -4
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/anthropic.mjs +3 -277
- package/src/runtime/agent/orchestrator/providers/codex-client-meta.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/custom-tool-wire.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/gemini-cache.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/gemini-stream.mjs +6 -6
- package/src/runtime/agent/orchestrator/providers/grok-oauth-login.mjs +196 -0
- package/src/runtime/agent/orchestrator/providers/grok-oauth-tokens.mjs +460 -0
- package/src/runtime/agent/orchestrator/providers/grok-oauth.mjs +14 -593
- package/src/runtime/agent/orchestrator/providers/lib/anthropic-request-utils.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/media-normalization.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/openai-compat-wire.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/openai-compat-xai.mjs +4 -4
- package/src/runtime/agent/orchestrator/providers/openai-oauth-ws.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/openai-oauth.mjs +5 -280
- package/src/runtime/agent/orchestrator/providers/openai-responses-payload.mjs +357 -0
- package/src/runtime/agent/orchestrator/providers/openai-ws-headers.mjs +216 -0
- package/src/runtime/agent/orchestrator/providers/openai-ws-pool.mjs +2 -188
- package/src/runtime/agent/orchestrator/providers/openai-ws-stream.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/openai-ws.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/opencode-go.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/provider-catalog-cache.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/registry.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/retry-classifier.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/statusline-route-meta.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/cache/prefetch-cache.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/cache/scoped-cache.mjs +3 -3
- package/src/runtime/agent/orchestrator/session/compact/budget.mjs +2 -2
- package/src/runtime/agent/orchestrator/session/compact/file-reattach.mjs +2 -2
- package/src/runtime/agent/orchestrator/session/compact/summary-schema.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/compact/summary.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/compact/text-utils.mjs +2 -2
- package/src/runtime/agent/orchestrator/session/context-utils.mjs +4 -4
- package/src/runtime/agent/orchestrator/session/loop/deferred-call-through.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/loop/pre-dispatch-deny.mjs +17 -0
- package/src/runtime/agent/orchestrator/session/loop/steering.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/loop/stored-tool-args.mjs +18 -26
- package/src/runtime/agent/orchestrator/session/loop/termination.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/loop/tool-classify.mjs +3 -3
- package/src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs +1 -0
- package/src/runtime/agent/orchestrator/session/manager/context-meta.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/manager/delivered-completions.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/manager/status-telemetry.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/store/live-state.mjs +49 -0
- package/src/runtime/agent/orchestrator/session/store/load-cache.mjs +49 -0
- package/src/runtime/agent/orchestrator/session/store/save-worker.mjs +260 -0
- package/src/runtime/agent/orchestrator/session/store/serialize.mjs +72 -0
- package/src/runtime/agent/orchestrator/session/store/summary-cache.mjs +163 -0
- package/src/runtime/agent/orchestrator/session/store/write-guards.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/store-summary-index.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/store-summary-reader.mjs +4 -1
- package/src/runtime/agent/orchestrator/session/store.mjs +9 -561
- package/src/runtime/agent/orchestrator/session/tool-envelope.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/tool-result-offload.mjs +2 -2
- package/src/runtime/agent/orchestrator/stall-policy.mjs +11 -11
- package/src/runtime/agent/orchestrator/tools/bash-policy-scan.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/bash-session.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/advisory-lock.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/arg-guard.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/atomic-write.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool.mjs +2 -154
- package/src/runtime/agent/orchestrator/tools/builtin/cache-layers.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/cwd-utils.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/fs-reachability.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/fuzzy-match.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/glob-walk.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/path-locks.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/path-utils.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/read-args.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/read-formatting.mjs +2 -3
- package/src/runtime/agent/orchestrator/tools/builtin/read-image-resize.mjs +4 -4
- package/src/runtime/agent/orchestrator/tools/builtin/read-open.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/read-streaming.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/rg-runner.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/search-path-diagnostics.mjs +5 -5
- package/src/runtime/agent/orchestrator/tools/builtin/shell-analysis.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/shell-job-paths.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/shell-job-process.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/shell-job-spawn.mjs +519 -0
- package/src/runtime/agent/orchestrator/tools/builtin/shell-jobs.mjs +5 -449
- package/src/runtime/agent/orchestrator/tools/builtin/snapshot-helpers.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/task-tool.mjs +212 -0
- package/src/runtime/agent/orchestrator/tools/builtin.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/code-graph/build.mjs +1 -7
- package/src/runtime/agent/orchestrator/tools/code-graph/disk-cache.mjs +9 -36
- package/src/runtime/agent/orchestrator/tools/code-graph/dispatch.mjs +15 -3
- package/src/runtime/agent/orchestrator/tools/code-graph/search-references.mjs +429 -0
- package/src/runtime/agent/orchestrator/tools/code-graph/search.mjs +2 -395
- package/src/runtime/agent/orchestrator/tools/code-graph/symbol-index.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/code-graph/text-mask.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/code-graph/trusted-roots.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/code-graph-prewarm-worker.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/code-graph-state.mjs +3 -3
- package/src/runtime/agent/orchestrator/tools/mutation-planner.mjs +5 -5
- package/src/runtime/agent/orchestrator/tools/next-call-utils.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/patch/dispatch.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/patch/matcher.mjs +7 -7
- package/src/runtime/agent/orchestrator/tools/patch/orchestrator.mjs +72 -9
- package/src/runtime/agent/orchestrator/tools/patch/parsing.mjs +4 -4
- package/src/runtime/agent/orchestrator/tools/patch/paths.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/patch/v4a-convert.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/patch-tool-defs.mjs +4 -4
- package/src/runtime/agent/orchestrator/tools/patch.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/result-compression.mjs +3 -3
- package/src/runtime/agent/orchestrator/tools/shell-command.mjs +2 -444
- package/src/runtime/agent/orchestrator/tools/shell-exec-output.mjs +505 -0
- package/src/runtime/agent/orchestrator/tools/shell-exec-policy.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/shell-snapshot.mjs +1 -1
- package/src/runtime/channels/lib/backend-dispatch.mjs +20 -5
- package/src/runtime/channels/lib/scheduler.mjs +1 -1
- package/src/runtime/channels/lib/telegram-format.mjs +1 -1
- package/src/runtime/channels/lib/voice-runtime-fetcher.mjs +4 -4
- package/src/runtime/channels/tool-defs.mjs +2 -3
- package/src/runtime/memory/index.mjs +1 -5
- package/src/runtime/memory/lib/core-memory-candidates.mjs +357 -0
- package/src/runtime/memory/lib/core-memory-store.mjs +7 -357
- package/src/runtime/memory/lib/cycle-signatures.mjs +1 -1
- package/src/runtime/memory/lib/embedding-model-config.mjs +1 -1
- package/src/runtime/memory/lib/embedding-provider.mjs +1 -5
- package/src/runtime/memory/lib/embedding-worker.mjs +1 -5
- package/src/runtime/memory/lib/ko-morph.mjs +2 -2
- package/src/runtime/memory/lib/memory-config-flags.mjs +2 -5
- package/src/runtime/memory/lib/memory-cycle-requests.mjs +3 -7
- package/src/runtime/memory/lib/memory-cycle1.mjs +4 -8
- package/src/runtime/memory/lib/memory-cycle2-gate.mjs +1 -1
- package/src/runtime/memory/lib/memory-cycle2-mutations.mjs +1 -1
- package/src/runtime/memory/lib/memory-cycle2-shared.mjs +2 -5
- package/src/runtime/memory/lib/memory-cycle3.mjs +1 -5
- package/src/runtime/memory/lib/memory-embed.mjs +2 -6
- package/src/runtime/memory/lib/memory-log.mjs +8 -0
- package/src/runtime/memory/lib/memory-ops-policy.mjs +4 -8
- package/src/runtime/memory/lib/memory-recall-scope-filter.mjs +1 -1
- package/src/runtime/memory/lib/memory-recall-store.mjs +2 -193
- package/src/runtime/memory/lib/memory-score.mjs +1 -1
- package/src/runtime/memory/lib/memory-text-utils.mjs +2 -2
- package/src/runtime/memory/lib/memory.mjs +2 -6
- package/src/runtime/memory/lib/pg/adapter.mjs +2 -6
- package/src/runtime/memory/lib/pg/process.mjs +1 -5
- package/src/runtime/memory/lib/pg/supervisor.mjs +1 -5
- package/src/runtime/memory/lib/recall-format.mjs +2 -2
- package/src/runtime/memory/lib/recall-scoring.mjs +195 -0
- package/src/runtime/memory/lib/runtime-fetcher.mjs +1 -5
- package/src/runtime/memory/lib/trace-store.mjs +2 -6
- package/src/runtime/search/lib/http-fetch.mjs +6 -6
- package/src/runtime/search/lib/web-tools.mjs +2 -2
- package/src/runtime/shared/buffered-appender.mjs +1 -1
- package/src/runtime/shared/child-guardian.mjs +1 -1
- package/src/runtime/shared/child-spawn-gate.mjs +1 -1
- package/src/runtime/shared/config.mjs +4 -4
- package/src/runtime/shared/launcher-control.mjs +9 -10
- package/src/runtime/shared/llm/index.mjs +5 -20
- package/src/runtime/shared/markdown-frontmatter.mjs +1 -1
- package/src/runtime/shared/memory-snapshot.mjs +4 -4
- package/src/runtime/shared/pristine-execution.mjs +1 -1
- package/src/runtime/shared/process-lifecycle.mjs +0 -1
- package/src/runtime/shared/process-shutdown.mjs +1 -1
- package/src/runtime/shared/resource-admission.mjs +2 -2
- package/src/runtime/shared/schedule-session-run.mjs +1 -1
- package/src/runtime/shared/schedules-db.mjs +1 -1
- package/src/runtime/shared/service-discovery.mjs +2 -2
- package/src/runtime/shared/staged-update.mjs +6 -6
- package/src/runtime/shared/tool-execution-contract.mjs +1 -1
- package/src/runtime/shared/tool-primitives.mjs +1 -1
- package/src/runtime/shared/tool-surface.mjs +2 -2
- package/src/runtime/shared/update-checker.mjs +1 -1
- package/src/runtime/shared/user-cwd.mjs +3 -3
- package/src/runtime/shared/user-data-guard.mjs +4 -4
- package/src/runtime/shared/workspace-router.mjs +5 -5
- package/src/session-runtime/config-helpers.mjs +2 -3
- package/src/session-runtime/config-lifecycle.mjs +1 -1
- package/src/session-runtime/hitch-profile.mjs +1 -1
- package/src/session-runtime/lifecycle-api.mjs +6 -4
- package/src/session-runtime/model-recency.mjs +5 -5
- package/src/session-runtime/plugin-mcp.mjs +1 -1
- package/src/session-runtime/provider-request-snapshot.mjs +338 -0
- package/src/session-runtime/session-text.mjs +4 -4
- package/src/session-runtime/tool-catalog-schema.mjs +197 -0
- package/src/session-runtime/tool-catalog.mjs +6 -483
- package/src/session-runtime/tool-defs.mjs +1 -1
- package/src/standalone/agent-task-status.mjs +1 -1
- package/src/standalone/agent-tool/helpers.mjs +2 -2
- package/src/standalone/channel-admin.mjs +4 -4
- package/src/standalone/explore-tool.mjs +3 -3
- package/src/standalone/hook-bus/config.mjs +1 -1
- package/src/standalone/hook-bus/constants.mjs +1 -1
- package/src/standalone/hook-bus/rules.mjs +1 -1
- package/src/standalone/projects.mjs +1 -1
- package/src/standalone/provider-admin.mjs +2 -2
- package/src/tui/app/app-format.mjs +2 -2
- package/src/tui/app/clipboard.mjs +3 -3
- package/src/tui/app/input-parsers.mjs +1 -1
- package/src/tui/app/text-layout.mjs +1 -1
- package/src/tui/app/transcript-row-estimate.mjs +360 -0
- package/src/tui/app/transcript-window.mjs +5 -347
- package/src/tui/app/use-mouse-input.mjs +1 -1
- package/src/tui/app/use-prompt-handlers.mjs +1 -1
- package/src/tui/components/tool-execution/surface-detail.mjs +9 -9
- package/src/tui/components/tool-execution/text-format.mjs +2 -2
- package/src/tui/components/tool-output-format.mjs +7 -7
- package/src/tui/display-width.mjs +4 -4
- package/src/tui/dist/index.mjs +63 -97
- package/src/tui/engine/agent-envelope.mjs +5 -5
- package/src/tui/engine/notification-plan.mjs +1 -1
- package/src/tui/engine/queue-helpers.mjs +3 -3
- package/src/tui/engine/render-timing.mjs +4 -5
- package/src/tui/engine/session-api-ext.mjs +3 -3
- package/src/tui/engine/tool-result-status.mjs +5 -5
- package/src/tui/engine/tool-result-text.mjs +1 -1
- package/src/tui/engine/transcript-spill.mjs +585 -0
- package/src/tui/engine/tui-steering-persist.mjs +1 -1
- package/src/tui/engine.mjs +2 -474
- package/src/tui/lib/voice-setup.mjs +1 -1
- package/src/tui/markdown/format-token.mjs +1 -1
- package/src/tui/markdown/render-ansi.mjs +1 -1
- package/src/tui/markdown/table-layout.mjs +4 -4
- package/src/tui/paste-attachments.mjs +1 -1
- package/src/tui/prompt-history-store.mjs +3 -3
- package/src/tui/statusline-ansi-bridge.mjs +2 -2
- package/src/tui/theme.mjs +1 -1
- package/src/tui/transcript-tool-failures.mjs +2 -2
- package/src/ui/ansi.mjs +0 -9
- package/src/ui/statusline-format.mjs +2 -4
- package/scripts/_bench-cwc.json +0 -20
- package/scripts/_jitter-fuzz.jsx +0 -42
- package/scripts/_jitter-fuzz2.jsx +0 -30
- package/scripts/_jitter-probe.jsx +0 -35
- package/scripts/_jp2.jsx +0 -16
- package/scripts/_smoke_wd.mjs +0 -7
- package/scripts/abort-recovery-test.mjs +0 -175
- package/scripts/agent-dispatch-abort-compose-test.mjs +0 -31
- package/scripts/agent-live-arg-guard-smoke.mjs +0 -20
- package/scripts/agent-live-path-suffix-smoke.mjs +0 -34
- package/scripts/agent-live-toolcall-args-smoke.mjs +0 -45
- package/scripts/agent-loop-policy-test.mjs +0 -37
- package/scripts/agent-model-liveness-test.mjs +0 -763
- package/scripts/agent-parallel-smoke.mjs +0 -435
- package/scripts/agent-route-batch-test.mjs +0 -40
- package/scripts/agent-tag-reuse-smoke.mjs +0 -441
- package/scripts/agent-terminal-reap-test.mjs +0 -252
- package/scripts/agent-trace-io-test.mjs +0 -133
- package/scripts/ansi-color-capability-test.mjs +0 -90
- package/scripts/anthropic-admission-retry-integration-test.mjs +0 -119
- package/scripts/anthropic-maxtokens-test.mjs +0 -119
- package/scripts/anthropic-oauth-refresh-race-test.mjs +0 -397
- package/scripts/anthropic-transport-policy-test.mjs +0 -726
- package/scripts/apply-patch-edit-smoke.mjs +0 -71
- package/scripts/arg-guard-test.mjs +0 -93
- package/scripts/async-notify-settlement-test.mjs +0 -99
- package/scripts/atomic-lock-tryonce-test.mjs +0 -125
- package/scripts/background-task-meta-smoke.mjs +0 -38
- package/scripts/bench-run.mjs +0 -508
- package/scripts/boot-smoke.mjs +0 -137
- package/scripts/build-runtime-windows.ps1 +0 -242
- package/scripts/channel-daemon-smoke.mjs +0 -1103
- package/scripts/code-graph-aggregate-cwd-test.mjs +0 -158
- package/scripts/code-graph-disk-hit-test.mjs +0 -290
- package/scripts/code-graph-dispatch-test.mjs +0 -96
- package/scripts/code-graph-root-federation-test.mjs +0 -273
- package/scripts/compact-active-turn-test.mjs +0 -68
- package/scripts/compact-file-reattach-test.mjs +0 -88
- package/scripts/compact-pressure-test.mjs +0 -788
- package/scripts/compact-prior-context-flatten-test.mjs +0 -252
- package/scripts/compact-recall-digest-test.mjs +0 -57
- package/scripts/compact-smoke.mjs +0 -1017
- package/scripts/compact-trigger-migration-smoke.mjs +0 -261
- package/scripts/compacted-placeholder-scrub-test.mjs +0 -63
- package/scripts/context-mcp-metering-test.mjs +0 -1406
- package/scripts/debounced-skills-async-save-test.mjs +0 -57
- package/scripts/deferred-tool-loading-test.mjs +0 -250
- package/scripts/desktop-session-bridge-test.mjs +0 -1013
- package/scripts/dispatch-persist-recovery-test.mjs +0 -141
- package/scripts/embedding-worker-exit-test.mjs +0 -76
- package/scripts/execution-completion-dedup-test.mjs +0 -205
- package/scripts/execution-pending-resume-kick-test.mjs +0 -151
- package/scripts/execution-resume-esc-integration-test.mjs +0 -176
- package/scripts/explore-bench-tmp.mjs +0 -36
- package/scripts/explore-bench.mjs +0 -248
- package/scripts/explore-prompt-policy-test.mjs +0 -256
- package/scripts/explore-timeout-cancel-test.mjs +0 -345
- package/scripts/find-fuzzy-hidden-test.mjs +0 -267
- package/scripts/forwarder-rebind-tail-test.mjs +0 -67
- package/scripts/freevar-smoke.mjs +0 -98
- package/scripts/gemini-provider-test.mjs +0 -1448
- package/scripts/generate-oc-icons.mjs +0 -11
- package/scripts/grok-oauth-refresh-race-test.mjs +0 -273
- package/scripts/headless-pristine-execution-test.mjs +0 -614
- package/scripts/hook-bus-test.mjs +0 -552
- package/scripts/ingest-pure-conversation-smoke.mjs +0 -175
- package/scripts/internal-comms-bench-test.mjs +0 -226
- package/scripts/internal-comms-bench.mjs +0 -853
- package/scripts/internal-comms-smoke.mjs +0 -277
- package/scripts/internal-tools-normalization-test.mjs +0 -62
- package/scripts/interrupted-turn-history-test.mjs +0 -399
- package/scripts/lead-workflow-smoke.mjs +0 -592
- package/scripts/lifecycle-api-test.mjs +0 -137
- package/scripts/live-share-test.mjs +0 -148
- package/scripts/live-worker-smoke.mjs +0 -333
- package/scripts/log-writer-guard-smoke.mjs +0 -131
- package/scripts/maintenance-default-routes-test.mjs +0 -164
- package/scripts/max-output-recovery-persist-test.mjs +0 -81
- package/scripts/max-output-recovery-test.mjs +0 -368
- package/scripts/mcp-client-normalization-test.mjs +0 -45
- package/scripts/mcp-grace-deferred-test.mjs +0 -225
- package/scripts/memory-core-input-test.mjs +0 -167
- package/scripts/memory-cycle-routing-test.mjs +0 -111
- package/scripts/memory-meta-concurrency-test.mjs +0 -20
- package/scripts/memory-pg-recovery-test.mjs +0 -59
- package/scripts/memory-rule-contract-test.mjs +0 -93
- package/scripts/model-list-sanitize-test.mjs +0 -37
- package/scripts/mouse-tracking-restore-smoke.mjs +0 -107
- package/scripts/native-edit-wire-test.mjs +0 -152
- package/scripts/notify-completion-mirror-test.mjs +0 -73
- package/scripts/openai-oauth-refresh-race-test.mjs +0 -120
- package/scripts/openai-oauth-ws-1006-retry-test.mjs +0 -954
- package/scripts/openai-ws-early-settle-test.mjs +0 -216
- package/scripts/output-style-bench.mjs +0 -292
- package/scripts/output-style-smoke.mjs +0 -145
- package/scripts/parent-abort-link-test.mjs +0 -90
- package/scripts/patch-binary-cache-test.mjs +0 -181
- package/scripts/path-suffix-test.mjs +0 -57
- package/scripts/pending-completion-drop-test.mjs +0 -239
- package/scripts/pending-messages-lock-nonblocking-test.mjs +0 -62
- package/scripts/pretool-ask-runtime-test.mjs +0 -54
- package/scripts/process-lifecycle-test.mjs +0 -461
- package/scripts/prompt-immediate-render-test.mjs +0 -89
- package/scripts/prompt-input-parity-test.mjs +0 -145
- package/scripts/provider-admission-scheduler-test.mjs +0 -681
- package/scripts/provider-contract-test.mjs +0 -632
- package/scripts/provider-stream-stall-test.mjs +0 -276
- package/scripts/provider-toolcall-test.mjs +0 -3063
- package/scripts/reactive-compact-persist-smoke.mjs +0 -203
- package/scripts/recall-bench.mjs +0 -359
- package/scripts/resource-admission-test.mjs +0 -792
- package/scripts/result-classification-test.mjs +0 -75
- package/scripts/rg-runner-test.mjs +0 -240
- package/scripts/routing-corpus-test.mjs +0 -349
- package/scripts/sanitize-tool-pairs-test.mjs +0 -260
- package/scripts/session-bench-cache-break-test.mjs +0 -102
- package/scripts/session-bench.mjs +0 -1708
- package/scripts/session-context-bench.mjs +0 -344
- package/scripts/session-heartbeat-lifecycle-test.mjs +0 -68
- package/scripts/session-ingest-compaction-smoke.mjs +0 -279
- package/scripts/session-ingest-smoke.mjs +0 -177
- package/scripts/session-orphan-sweep-test.mjs +0 -109
- package/scripts/set-effort-config-test.mjs +0 -41
- package/scripts/shell-failure-diagnostics-test.mjs +0 -280
- package/scripts/shell-hardening-test.mjs +0 -209
- package/scripts/shell-jobs-windows-hide-test.mjs +0 -164
- package/scripts/ship-mode-test.mjs +0 -98
- package/scripts/smoke-loop-failure-summary-test.mjs +0 -38
- package/scripts/smoke-loop-failure-summary.mjs +0 -16
- package/scripts/smoke-loop-report.mjs +0 -221
- package/scripts/smoke-loop.mjs +0 -202
- package/scripts/smoke-runtime-negative.ps1 +0 -106
- package/scripts/statusline-quota-hysteresis-test.mjs +0 -62
- package/scripts/steering-drain-buckets-test.mjs +0 -467
- package/scripts/steering-fold-provenance-test.mjs +0 -71
- package/scripts/streaming-tail-window-test.mjs +0 -175
- package/scripts/submit-commandbusy-race-test.mjs +0 -257
- package/scripts/task-bench.mjs +0 -205
- package/scripts/terminal-bench-isolation-guards-test.mjs +0 -102
- package/scripts/termio-input-smoke.mjs +0 -199
- package/scripts/tool-result-hook-test.mjs +0 -48
- package/scripts/tool-smoke.mjs +0 -2453
- package/scripts/tool-tui-presentation-test.mjs +0 -286
- package/scripts/toolcall-args-test.mjs +0 -239
- package/scripts/tui-ambiguous-width-test.mjs +0 -113
- package/scripts/tui-background-failure-smoke.mjs +0 -73
- package/scripts/tui-perf-run.ps1 +0 -26
- package/scripts/tui-render-smoke.mjs +0 -90
- package/scripts/tui-runtime-load-bench-entry.jsx +0 -608
- package/scripts/tui-runtime-load-bench.mjs +0 -50
- package/scripts/tui-store-frame-batch-test.mjs +0 -99
- package/scripts/tui-transcript-jitter-harness-entry.jsx +0 -383
- package/scripts/tui-transcript-perf-test.mjs +0 -934
- package/scripts/usage-metrics-epoch-smoke.mjs +0 -114
- package/scripts/verify-release-assets-test.mjs +0 -281
- package/scripts/web-fetch-routing-test.mjs +0 -158
- package/scripts/webhook-smoke.mjs +0 -201
- package/scripts/windows-hide-spawn-options-test.mjs +0 -19
- package/scripts/worker-notify-rejection-test.mjs +0 -51
- package/scripts/write-backpressure-test.mjs +0 -147
|
@@ -1,286 +0,0 @@
|
|
|
1
|
-
import test from 'node:test';
|
|
2
|
-
import assert from 'node:assert/strict';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
aggregateToolCategoryEntry,
|
|
6
|
-
formatAggregateHeader,
|
|
7
|
-
summarizeToolArgs,
|
|
8
|
-
toolWorkUnit,
|
|
9
|
-
} from '../src/runtime/shared/tool-surface.mjs';
|
|
10
|
-
import {
|
|
11
|
-
normalizeToolTerminalStatus,
|
|
12
|
-
toolResultTerminalStatus,
|
|
13
|
-
} from '../src/runtime/shared/tool-status.mjs';
|
|
14
|
-
import {
|
|
15
|
-
aggregateBucketForCategory,
|
|
16
|
-
toolCallOutcome,
|
|
17
|
-
} from '../src/tui/engine/tool-result-status.mjs';
|
|
18
|
-
import { createToolCardResults } from '../src/tui/engine/tool-card-results.mjs';
|
|
19
|
-
import {
|
|
20
|
-
appendAgentResponseTail,
|
|
21
|
-
formatAgentResponseRaw,
|
|
22
|
-
} from '../src/tui/engine/agent-response-tail.mjs';
|
|
23
|
-
import {
|
|
24
|
-
agentArgsWithResultMetadata,
|
|
25
|
-
parseAgentJob,
|
|
26
|
-
} from '../src/tui/engine/agent-envelope.mjs';
|
|
27
|
-
import {
|
|
28
|
-
agentActionTitle,
|
|
29
|
-
toolSearchLoadedSummary,
|
|
30
|
-
} from '../src/tui/components/tool-execution/surface-detail.mjs';
|
|
31
|
-
|
|
32
|
-
test('tool action copy keeps Add/Delete patch verbs and human read offsets', () => {
|
|
33
|
-
assert.equal(
|
|
34
|
-
toolWorkUnit('apply_patch', { patch: '*** Begin Patch\n*** Add File: new.mjs\n+x\n*** End Patch' }).done,
|
|
35
|
-
'Created',
|
|
36
|
-
);
|
|
37
|
-
assert.equal(
|
|
38
|
-
toolWorkUnit('apply_patch', { patch: '*** Begin Patch\n*** Delete File: old.mjs\n*** End Patch' }).active,
|
|
39
|
-
'Deleting',
|
|
40
|
-
);
|
|
41
|
-
assert.match(summarizeToolArgs('read', { path: 'a.mjs', offset: 0, limit: 10 }), /lines 1-10/);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
test('load_tool presentation distinguishes first load from already-active repeats', () => {
|
|
45
|
-
assert.equal(
|
|
46
|
-
toolSearchLoadedSummary('Loaded deferred tools: shell\nAlready active: task'),
|
|
47
|
-
'Loaded: shell · Already active: task',
|
|
48
|
-
);
|
|
49
|
-
assert.equal(
|
|
50
|
-
toolSearchLoadedSummary(JSON.stringify({
|
|
51
|
-
selected: { tools: { added: [], already: ['shell', 'task'] } },
|
|
52
|
-
})),
|
|
53
|
-
'Already active: shell, task',
|
|
54
|
-
);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
test('Agent aggregation is batch-scoped and keeps category action wording', () => {
|
|
58
|
-
const entry = aggregateToolCategoryEntry('agent', { type: 'spawn' }, 'Agent');
|
|
59
|
-
assert.equal(formatAggregateHeader({ [entry.key]: { ...entry, count: 2 } }, { pending: false }), 'Called 2 agents');
|
|
60
|
-
assert.notEqual(
|
|
61
|
-
aggregateBucketForCategory('Agent', { agentBatch: 1 }),
|
|
62
|
-
aggregateBucketForCategory('Agent', { agentBatch: 2 }),
|
|
63
|
-
);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
test('agent spawn cards retain resolved model metadata from split result envelopes', () => {
|
|
67
|
-
const parsed = parseAgentJob([
|
|
68
|
-
'agent task: task_worker_1',
|
|
69
|
-
'status: running',
|
|
70
|
-
'type: spawn',
|
|
71
|
-
'target: worker sess_worker_1',
|
|
72
|
-
'agent: worker',
|
|
73
|
-
'provider: openai-oauth',
|
|
74
|
-
'model: gpt-5.6-terra',
|
|
75
|
-
'preset: agent-worker',
|
|
76
|
-
'effort: high',
|
|
77
|
-
].join('\n'));
|
|
78
|
-
const args = agentArgsWithResultMetadata({ type: 'spawn', agent: 'worker' }, parsed);
|
|
79
|
-
|
|
80
|
-
assert.equal(args.tag, 'worker');
|
|
81
|
-
assert.equal(args.provider, 'openai-oauth');
|
|
82
|
-
assert.equal(args.model, 'gpt-5.6-terra');
|
|
83
|
-
assert.equal(args.effort, 'high');
|
|
84
|
-
assert.equal(agentActionTitle(args), 'Spawn Worker (GPT-5.6-Terra, worker)');
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
test('agent model enrichment preserves explicit args and combined envelopes', () => {
|
|
88
|
-
const combined = parseAgentJob([
|
|
89
|
-
'agent task: task_worker_2',
|
|
90
|
-
'type: spawn',
|
|
91
|
-
'model: openai-oauth/gpt-5.6-terra',
|
|
92
|
-
].join('\n'));
|
|
93
|
-
assert.equal(combined.provider, 'openai-oauth');
|
|
94
|
-
assert.equal(combined.model, 'gpt-5.6-terra');
|
|
95
|
-
|
|
96
|
-
const split = parseAgentJob([
|
|
97
|
-
'agent task: task_worker_3',
|
|
98
|
-
'provider: openai-oauth',
|
|
99
|
-
'model: gpt-5.6-terra',
|
|
100
|
-
].join('\n'));
|
|
101
|
-
const explicit = agentArgsWithResultMetadata({
|
|
102
|
-
provider: 'anthropic',
|
|
103
|
-
model: 'claude-opus-4-6',
|
|
104
|
-
}, split);
|
|
105
|
-
assert.equal(explicit.provider, 'anthropic');
|
|
106
|
-
assert.equal(explicit.model, 'claude-opus-4-6');
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
test('non-agent task diagnostics do not enrich model args', () => {
|
|
110
|
-
const shellDiagnostics = parseAgentJob([
|
|
111
|
-
'task_id: shell_task_1',
|
|
112
|
-
'provider: openai-oauth',
|
|
113
|
-
'model: gpt-5.6-terra',
|
|
114
|
-
].join('\n'));
|
|
115
|
-
const args = agentArgsWithResultMetadata({ type: 'shell' }, shellDiagnostics);
|
|
116
|
-
|
|
117
|
-
assert.equal(args.provider, undefined);
|
|
118
|
-
assert.equal(args.model, undefined);
|
|
119
|
-
|
|
120
|
-
const shellCombinedDiagnostics = parseAgentJob([
|
|
121
|
-
'task_id: shell_task_2',
|
|
122
|
-
'model: openai-oauth/gpt-5.6-terra',
|
|
123
|
-
].join('\n'));
|
|
124
|
-
const combinedArgs = agentArgsWithResultMetadata({ type: 'shell' }, shellCombinedDiagnostics);
|
|
125
|
-
assert.equal(combinedArgs.provider, undefined);
|
|
126
|
-
assert.equal(combinedArgs.model, undefined);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
test('terminal result statuses stay separate from tool-call failure accounting', () => {
|
|
130
|
-
assert.equal(normalizeToolTerminalStatus('denied'), 'denied');
|
|
131
|
-
assert.equal(toolResultTerminalStatus('[status: cancelled]\n'), 'cancelled');
|
|
132
|
-
|
|
133
|
-
const state = {
|
|
134
|
-
items: [{
|
|
135
|
-
id: 'aggregate',
|
|
136
|
-
kind: 'tool',
|
|
137
|
-
result: null,
|
|
138
|
-
count: 1,
|
|
139
|
-
completedCount: 0,
|
|
140
|
-
}],
|
|
141
|
-
};
|
|
142
|
-
const aggregate = {
|
|
143
|
-
itemId: 'aggregate',
|
|
144
|
-
calls: new Map([['call_1', { name: 'web_fetch', args: {}, category: 'Web Research' }]]),
|
|
145
|
-
nextSummarySeq: 0,
|
|
146
|
-
ensureVisible: () => {},
|
|
147
|
-
};
|
|
148
|
-
const { patchToolCardResult } = createToolCardResults({
|
|
149
|
-
getState: () => state,
|
|
150
|
-
set: () => {},
|
|
151
|
-
patchItem: (id, patch) => {
|
|
152
|
-
const index = state.items.findIndex((item) => item.id === id);
|
|
153
|
-
state.items[index] = { ...state.items[index], ...patch };
|
|
154
|
-
return true;
|
|
155
|
-
},
|
|
156
|
-
markToolCallDone: () => {},
|
|
157
|
-
updateAgentJobCard: () => {},
|
|
158
|
-
buildAgentJobCardPatch: () => ({}),
|
|
159
|
-
agentStatusState: () => ({}),
|
|
160
|
-
});
|
|
161
|
-
const card = { itemId: 'aggregate', callId: 'call_1', done: false, aggregate };
|
|
162
|
-
assert.equal(patchToolCardResult(card, {
|
|
163
|
-
tool_call_id: 'call_1',
|
|
164
|
-
content: 'status: failed\nHTTP 404 Not Found',
|
|
165
|
-
}, new Map(), new Set()), true);
|
|
166
|
-
assert.equal(state.items[0].errorCount, 0);
|
|
167
|
-
assert.equal(state.items[0].callErrorCount, 0);
|
|
168
|
-
assert.equal(aggregate.calls.get('call_1').isError, false);
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
function patchAggregate(messages) {
|
|
172
|
-
const state = { items: [{ id: 'aggregate', kind: 'tool', result: null, count: messages.length, completedCount: 0 }] };
|
|
173
|
-
const aggregate = {
|
|
174
|
-
itemId: 'aggregate',
|
|
175
|
-
calls: new Map(messages.map((message) => [message.tool_call_id, {
|
|
176
|
-
name: 'shell',
|
|
177
|
-
args: {},
|
|
178
|
-
category: 'Shell',
|
|
179
|
-
}])),
|
|
180
|
-
nextSummarySeq: 0,
|
|
181
|
-
ensureVisible: () => {},
|
|
182
|
-
};
|
|
183
|
-
const { patchToolCardResult } = createToolCardResults({
|
|
184
|
-
getState: () => state,
|
|
185
|
-
set: () => {},
|
|
186
|
-
patchItem: (id, patch) => {
|
|
187
|
-
const index = state.items.findIndex((item) => item.id === id);
|
|
188
|
-
state.items[index] = { ...state.items[index], ...patch };
|
|
189
|
-
return true;
|
|
190
|
-
},
|
|
191
|
-
markToolCallDone: () => {},
|
|
192
|
-
updateAgentJobCard: () => {},
|
|
193
|
-
buildAgentJobCardPatch: () => ({}),
|
|
194
|
-
agentStatusState: () => ({}),
|
|
195
|
-
});
|
|
196
|
-
for (const message of messages) {
|
|
197
|
-
patchToolCardResult(
|
|
198
|
-
{ itemId: 'aggregate', callId: message.tool_call_id, done: false, aggregate },
|
|
199
|
-
message,
|
|
200
|
-
new Map(),
|
|
201
|
-
new Set(),
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
return state.items[0];
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
test('exit detail stays successful and does not inflate Ok or Failed counts', () => {
|
|
208
|
-
const exit = 'Error: [shell-run-failed] [exit code: 1]\ncommand output';
|
|
209
|
-
const exitOnly = patchAggregate([{ tool_call_id: 'exit', content: exit, toolKind: 'error' }]);
|
|
210
|
-
assert.equal(exitOnly.errorCount, 0);
|
|
211
|
-
assert.equal(exitOnly.callErrorCount, 0);
|
|
212
|
-
assert.equal(exitOnly.exitErrorCount, 1);
|
|
213
|
-
assert.equal(exitOnly.result, 'Exit 1');
|
|
214
|
-
|
|
215
|
-
const mixed = patchAggregate([
|
|
216
|
-
{ tool_call_id: 'failed', content: 'transport unavailable', isError: true },
|
|
217
|
-
{ tool_call_id: 'exit', content: exit, isError: true },
|
|
218
|
-
]);
|
|
219
|
-
assert.equal(mixed.errorCount, 1);
|
|
220
|
-
assert.equal(mixed.callErrorCount, 1);
|
|
221
|
-
assert.equal(mixed.exitErrorCount, 1);
|
|
222
|
-
assert.equal(mixed.result, '1 Failed · 1 Exit');
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
test('eager call outcome uses only envelope failure metadata', () => {
|
|
226
|
-
const exit = 'Error: [shell-run-failed] [exit code: 1]';
|
|
227
|
-
assert.equal(toolCallOutcome({ content: 'Error: domain failure' }, 'Error: domain failure').isCallError, false);
|
|
228
|
-
assert.equal(toolCallOutcome({ isError: true, content: 'ok-looking body' }, 'ok-looking body').isCallError, true);
|
|
229
|
-
assert.deepEqual(toolCallOutcome({ toolKind: 'error' }, exit), { isCallError: false, isExitError: true, exitCode: 1 });
|
|
230
|
-
assert.deepEqual(toolCallOutcome({ isError: true }, exit), { isCallError: false, isExitError: true, exitCode: 1 });
|
|
231
|
-
assert.equal(toolCallOutcome({ isError: true }, 'Error: [shell-run-failed] [timeout: 1s]').isCallError, true);
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
test('tail response aggregation is ordered, idempotent, and boundary-safe', () => {
|
|
235
|
-
const first = {
|
|
236
|
-
kind: 'tool',
|
|
237
|
-
agentDirection: 'inbound',
|
|
238
|
-
agentResponseKey: 'one',
|
|
239
|
-
agentResponseHasBody: true,
|
|
240
|
-
agentResponseEntries: [{ key: 'one', raw: 'body one', result: 'one', hasBody: true, isError: false }],
|
|
241
|
-
};
|
|
242
|
-
const secondPatch = appendAgentResponseTail(first, {
|
|
243
|
-
key: 'two', args: { type: 'result' }, rawResult: 'body two', result: 'two', hasBody: true,
|
|
244
|
-
}, 1);
|
|
245
|
-
const second = { ...first, ...secondPatch };
|
|
246
|
-
const thirdPatch = appendAgentResponseTail(second, {
|
|
247
|
-
key: 'three', args: { type: 'result' }, rawResult: 'body three', result: 'three', hasBody: true,
|
|
248
|
-
}, 2);
|
|
249
|
-
assert.equal(thirdPatch.count, 3);
|
|
250
|
-
assert.equal(
|
|
251
|
-
thirdPatch.rawResult,
|
|
252
|
-
'1. agent\nbody one\n\n2. agent\nbody two\n\n3. agent\nbody three',
|
|
253
|
-
);
|
|
254
|
-
const retryPatch = appendAgentResponseTail({ ...second, ...thirdPatch }, {
|
|
255
|
-
key: 'two', args: { type: 'result' }, rawResult: 'body two retry', result: 'two retry', hasBody: true,
|
|
256
|
-
}, 3);
|
|
257
|
-
assert.equal(retryPatch.count, 3);
|
|
258
|
-
assert.match(retryPatch.rawResult, /2\. agent\nbody two retry/);
|
|
259
|
-
assert.equal(appendAgentResponseTail({ kind: 'user' }, {
|
|
260
|
-
key: 'four', rawResult: 'body four', result: 'four', hasBody: true,
|
|
261
|
-
}), null);
|
|
262
|
-
assert.equal(formatAgentResponseRaw(retryPatch.agentResponseEntries).match(/\d+\. agent/g).length, 3);
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
test('failure preview upgrades its tail entry, but a boundary forces a new body card', () => {
|
|
266
|
-
const failurePreview = {
|
|
267
|
-
kind: 'tool',
|
|
268
|
-
agentDirection: 'inbound',
|
|
269
|
-
agentResponseKey: 'task_1',
|
|
270
|
-
agentResponseHasBody: false,
|
|
271
|
-
agentResponseEntries: [{
|
|
272
|
-
key: 'task_1', raw: 'failed preview', result: 'failed', hasBody: false, isError: true,
|
|
273
|
-
}],
|
|
274
|
-
};
|
|
275
|
-
const upgrade = appendAgentResponseTail(failurePreview, {
|
|
276
|
-
key: 'task_1', args: { type: 'result' }, rawResult: 'final body', result: 'final', hasBody: true, isError: false,
|
|
277
|
-
}, 1);
|
|
278
|
-
assert.equal(upgrade.count, 1);
|
|
279
|
-
assert.equal(upgrade.rawResult, '1. agent\nfinal body');
|
|
280
|
-
assert.equal(upgrade.isError, false);
|
|
281
|
-
|
|
282
|
-
const boundary = appendAgentResponseTail({ kind: 'assistant', text: 'intervening text' }, {
|
|
283
|
-
key: 'task_1', args: { type: 'result' }, rawResult: 'final body', result: 'final', hasBody: true,
|
|
284
|
-
});
|
|
285
|
-
assert.equal(boundary, null);
|
|
286
|
-
});
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Regression tests pinning the native-provider (OpenAI-compat / claude-code / opencode)
|
|
3
|
-
// tool_call arguments contract: completed-but-malformed arguments JSON is NEVER
|
|
4
|
-
// thrown (which would kill the turn) NOR silently swallowed to {}. With a finish
|
|
5
|
-
// signal observed it is surfaced as an invalid-args MARKER carried on the
|
|
6
|
-
// arguments slot, so the dispatch loop feeds the parse error back to the model
|
|
7
|
-
// as an is_error tool_result and the model self-corrects in the SAME turn.
|
|
8
|
-
// Without a finish signal (mid-stream truncation) it remains a retryable
|
|
9
|
-
// TruncatedStreamError — that transient behavior is deliberately preserved.
|
|
10
|
-
// Unit-test style: synthetic inputs fed
|
|
11
|
-
// directly to the exported parser, asserting the resulting outcome — no
|
|
12
|
-
// network, no model.
|
|
13
|
-
import test from 'node:test';
|
|
14
|
-
import assert from 'node:assert/strict';
|
|
15
|
-
import { readFileSync } from 'node:fs';
|
|
16
|
-
import { fileURLToPath } from 'node:url';
|
|
17
|
-
import { dirname, resolve } from 'node:path';
|
|
18
|
-
import {
|
|
19
|
-
parseCompletedToolCallArgumentsJson,
|
|
20
|
-
toolCallsFromStreamAcc,
|
|
21
|
-
isInvalidToolArgsMarker,
|
|
22
|
-
formatInvalidToolArgsResult,
|
|
23
|
-
} from '../src/runtime/agent/orchestrator/providers/openai-compat-stream.mjs';
|
|
24
|
-
import { parseSSEStream } from '../src/runtime/agent/orchestrator/providers/anthropic-oauth.mjs';
|
|
25
|
-
import { classifyError } from '../src/runtime/agent/orchestrator/providers/retry-classifier.mjs';
|
|
26
|
-
|
|
27
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
28
|
-
const STREAM_SRC = resolve(__dirname, '../src/runtime/agent/orchestrator/providers/openai-compat-stream.mjs');
|
|
29
|
-
const UTF8 = new TextEncoder();
|
|
30
|
-
|
|
31
|
-
// Captures the synchronous throw of `fn` and returns the Error, failing if none.
|
|
32
|
-
function captureThrow(fn) {
|
|
33
|
-
try {
|
|
34
|
-
const v = fn();
|
|
35
|
-
assert.fail(`expected throw, got resolved value: ${JSON.stringify(v)}`);
|
|
36
|
-
} catch (err) {
|
|
37
|
-
assert.ok(err instanceof Error, 'thrown value must be an Error');
|
|
38
|
-
return err;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
test('A: valid arguments JSON parses to the intended object', () => {
|
|
43
|
-
const out = parseCompletedToolCallArgumentsJson(
|
|
44
|
-
'{"pattern":"x","path":"src"}', 'test', { finishReason: 'stop' });
|
|
45
|
-
assert.deepEqual(out, { pattern: 'x', path: 'src' });
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
test('B: empty/missing arguments default to {}', () => {
|
|
49
|
-
assert.deepEqual(parseCompletedToolCallArgumentsJson('', 'test', { finishReason: 'stop' }), {});
|
|
50
|
-
assert.deepEqual(parseCompletedToolCallArgumentsJson(null, 'test', { finishReason: 'stop' }), {});
|
|
51
|
-
assert.deepEqual(parseCompletedToolCallArgumentsJson(undefined, 'test'), {});
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
test('C: bareword JSON with finishReason → invalid-args marker (no throw, no salvage)', () => {
|
|
55
|
-
const bareword = '{"pattern": dispatchAiWrapped, "path": "src/agent"}';
|
|
56
|
-
const out = parseCompletedToolCallArgumentsJson(bareword, 'test', { finishReason: 'stop' });
|
|
57
|
-
assert.equal(isInvalidToolArgsMarker(out), true);
|
|
58
|
-
assert.equal(out.__invalidToolArgs, true);
|
|
59
|
-
assert.equal(out.__rawArguments, bareword);
|
|
60
|
-
assert.equal(typeof out.__parseError, 'string');
|
|
61
|
-
assert.ok(out.__parseError.length > 0, 'parse error message must be carried');
|
|
62
|
-
// Model-facing tool_result text uses the shared invalid-args template.
|
|
63
|
-
const msg = formatInvalidToolArgsResult({ name: 'grep', arguments: out });
|
|
64
|
-
assert.match(msg, /invalid JSON/);
|
|
65
|
-
assert.match(msg, /Re-issue this tool call with valid JSON arguments/);
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
test('C: bareword JSON without finishReason → retryable TruncatedStreamError', () => {
|
|
69
|
-
const bareword = '{"pattern": dispatchAiWrapped, "path": "src/agent"}';
|
|
70
|
-
// meta omitted entirely
|
|
71
|
-
const err1 = captureThrow(() => parseCompletedToolCallArgumentsJson(bareword, 'test'));
|
|
72
|
-
assert.equal(err1.name, 'TruncatedStreamError');
|
|
73
|
-
assert.equal(err1.code, 'TRUNCATED_STREAM');
|
|
74
|
-
assert.equal(err1.truncatedStream, true);
|
|
75
|
-
// meta present but finishReason unset
|
|
76
|
-
const err2 = captureThrow(() =>
|
|
77
|
-
parseCompletedToolCallArgumentsJson(bareword, 'test', { id: 'call_1', name: 'grep' }));
|
|
78
|
-
assert.equal(err2.name, 'TruncatedStreamError');
|
|
79
|
-
assert.equal(err2.code, 'TRUNCATED_STREAM');
|
|
80
|
-
assert.equal(err2.truncatedStream, true);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
test('D: fully malformed "{" splits on finishReason just like bareword', () => {
|
|
84
|
-
const marker = parseCompletedToolCallArgumentsJson('{', 'test', { finishReason: 'stop' });
|
|
85
|
-
assert.equal(isInvalidToolArgsMarker(marker), true);
|
|
86
|
-
assert.equal(marker.__rawArguments, '{');
|
|
87
|
-
|
|
88
|
-
const transient = captureThrow(() =>
|
|
89
|
-
parseCompletedToolCallArgumentsJson('{', 'test'));
|
|
90
|
-
assert.equal(transient.name, 'TruncatedStreamError');
|
|
91
|
-
assert.equal(transient.code, 'TRUNCATED_STREAM');
|
|
92
|
-
assert.equal(transient.truncatedStream, true);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
test('E: source no longer contains any salvageBarewordJson reference', () => {
|
|
96
|
-
const src = readFileSync(STREAM_SRC, 'utf8');
|
|
97
|
-
assert.equal(src.includes('salvageBarewordJson'), false,
|
|
98
|
-
'salvage helper must be fully removed');
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
// Stream-accumulation path: synthetic per-index accumulator + a parseToolCalls
|
|
102
|
-
// shim that delegates to the real parser (same wiring as openai-compat.mjs).
|
|
103
|
-
function parseToolCallsShim(choice, label) {
|
|
104
|
-
const calls = choice.message?.tool_calls;
|
|
105
|
-
if (!calls?.length) return undefined;
|
|
106
|
-
const finishReason = choice.finish_reason || null;
|
|
107
|
-
return calls
|
|
108
|
-
.filter((tc) => tc.type === 'function')
|
|
109
|
-
.map((tc) => ({
|
|
110
|
-
id: tc.id,
|
|
111
|
-
name: tc.function.name,
|
|
112
|
-
arguments: parseCompletedToolCallArgumentsJson(
|
|
113
|
-
tc.function.arguments, label,
|
|
114
|
-
{ id: tc.id, name: tc.function.name, finishReason }),
|
|
115
|
-
}));
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
test('stream acc: valid accumulated arguments parse through to a tool call', () => {
|
|
119
|
-
const acc = new Map();
|
|
120
|
-
acc.set('n:0', {
|
|
121
|
-
id: 'call_a', type: 'function',
|
|
122
|
-
function: { name: 'grep', arguments: '{"pattern":"x","path":"src"}' },
|
|
123
|
-
_order: 1,
|
|
124
|
-
});
|
|
125
|
-
const out = toolCallsFromStreamAcc(acc, parseToolCallsShim, 'test', 'stop');
|
|
126
|
-
assert.deepEqual(out, [{ id: 'call_a', name: 'grep', arguments: { pattern: 'x', path: 'src' } }]);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
test('stream acc: bareword with finish_reason → invalid-args marker on the call (no throw)', () => {
|
|
130
|
-
const acc = new Map();
|
|
131
|
-
acc.set('n:0', {
|
|
132
|
-
id: 'call_b', type: 'function',
|
|
133
|
-
function: { name: 'grep', arguments: '{"pattern": dispatchAiWrapped, "path": "src/agent"}' },
|
|
134
|
-
_order: 1,
|
|
135
|
-
});
|
|
136
|
-
const out = toolCallsFromStreamAcc(acc, parseToolCallsShim, 'test', 'stop');
|
|
137
|
-
assert.equal(Array.isArray(out), true);
|
|
138
|
-
assert.equal(out.length, 1);
|
|
139
|
-
assert.equal(out[0].id, 'call_b');
|
|
140
|
-
assert.equal(out[0].name, 'grep');
|
|
141
|
-
assert.equal(isInvalidToolArgsMarker(out[0].arguments), true);
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
test('retry-classifier: truncated stream (no finish) → transient (preserved behavior)', () => {
|
|
145
|
-
// The invalid-args marker is no longer a thrown Error, so there is nothing
|
|
146
|
-
// for classifyError to route — the dispatch loop handles it as a
|
|
147
|
-
// tool_result. Only the mid-stream truncation path still throws, and it
|
|
148
|
-
// must remain transient/retryable.
|
|
149
|
-
const transient = captureThrow(() =>
|
|
150
|
-
parseCompletedToolCallArgumentsJson('{', 'test'));
|
|
151
|
-
assert.equal(classifyError(transient), 'transient');
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
function responseFromSseText(text) {
|
|
155
|
-
return {
|
|
156
|
-
body: new ReadableStream({
|
|
157
|
-
start(controller) {
|
|
158
|
-
controller.enqueue(UTF8.encode(text));
|
|
159
|
-
controller.close();
|
|
160
|
-
},
|
|
161
|
-
}),
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
function livePingOnlyResponse(intervalMs = 5) {
|
|
166
|
-
let timer = null;
|
|
167
|
-
return {
|
|
168
|
-
body: new ReadableStream({
|
|
169
|
-
start(controller) {
|
|
170
|
-
timer = setInterval(() => {
|
|
171
|
-
try { controller.enqueue(UTF8.encode(':ping\n\n')); }
|
|
172
|
-
catch { if (timer) clearInterval(timer); }
|
|
173
|
-
}, intervalMs);
|
|
174
|
-
},
|
|
175
|
-
cancel() {
|
|
176
|
-
if (timer) clearInterval(timer);
|
|
177
|
-
},
|
|
178
|
-
}),
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
test('anthropic SSE: comments do not count as stream progress', async () => {
|
|
183
|
-
const state = { firstMessageTimeoutMs: 100 };
|
|
184
|
-
const progressKinds = [];
|
|
185
|
-
const result = await parseSSEStream(
|
|
186
|
-
responseFromSseText([
|
|
187
|
-
':ping',
|
|
188
|
-
'',
|
|
189
|
-
'event: message_start',
|
|
190
|
-
'data: {"type":"message_start","message":{"model":"claude-test","usage":{"input_tokens":1}}}',
|
|
191
|
-
'',
|
|
192
|
-
'event: content_block_delta',
|
|
193
|
-
'data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"hi"}}',
|
|
194
|
-
'',
|
|
195
|
-
'event: message_stop',
|
|
196
|
-
'data: {"type":"message_stop"}',
|
|
197
|
-
'',
|
|
198
|
-
].join('\n')),
|
|
199
|
-
null,
|
|
200
|
-
null,
|
|
201
|
-
(kind) => progressKinds.push(kind),
|
|
202
|
-
null,
|
|
203
|
-
state,
|
|
204
|
-
null,
|
|
205
|
-
);
|
|
206
|
-
assert.equal(result.content, 'hi');
|
|
207
|
-
assert.deepEqual(
|
|
208
|
-
progressKinds,
|
|
209
|
-
['transport', 'semantic', 'text'],
|
|
210
|
-
'the comment emits nothing; message_start and text each report only their exact kinds',
|
|
211
|
-
);
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
test('anthropic SSE: ping-only stream times out before empty-stream guard can hang', async () => {
|
|
215
|
-
const controller = new AbortController();
|
|
216
|
-
const progressKinds = [];
|
|
217
|
-
await assert.rejects(
|
|
218
|
-
() => parseSSEStream(
|
|
219
|
-
livePingOnlyResponse(),
|
|
220
|
-
controller.signal,
|
|
221
|
-
(reason) => controller.abort(reason),
|
|
222
|
-
(kind) => progressKinds.push(kind),
|
|
223
|
-
null,
|
|
224
|
-
{ firstMessageTimeoutMs: 30 },
|
|
225
|
-
null,
|
|
226
|
-
),
|
|
227
|
-
(err) => {
|
|
228
|
-
assert.equal(err.code, 'EEMPTYSTREAM');
|
|
229
|
-
assert.equal(err.isEmptyStream, true);
|
|
230
|
-
assert.equal(err.firstByteTimeout, true);
|
|
231
|
-
return true;
|
|
232
|
-
},
|
|
233
|
-
);
|
|
234
|
-
assert.deepEqual(
|
|
235
|
-
progressKinds,
|
|
236
|
-
[],
|
|
237
|
-
'ping-only SSE must emit no transport, semantic, or content progress',
|
|
238
|
-
);
|
|
239
|
-
});
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import test from 'node:test';
|
|
2
|
-
import assert from 'node:assert/strict';
|
|
3
|
-
import sliceAnsi from 'slice-ansi';
|
|
4
|
-
import stringWidth from 'string-width';
|
|
5
|
-
|
|
6
|
-
// Make the Windows Terminal policy deterministic on every test host. Dynamic
|
|
7
|
-
// imports matter because both policy copies resolve the gate once at load.
|
|
8
|
-
process.env.MIXDOG_TUI_AMBIGUOUS_WIDE = '1';
|
|
9
|
-
|
|
10
|
-
const [{ displayStringWidth }, {
|
|
11
|
-
default: wrapText,
|
|
12
|
-
sliceTextByDisplayWidth,
|
|
13
|
-
sliceTextByDisplayWidthWithPolicy,
|
|
14
|
-
}, { default: Output }] = await Promise.all([
|
|
15
|
-
import('../vendor/ink/build/display-width.js'),
|
|
16
|
-
import('../vendor/ink/build/wrap-text.js'),
|
|
17
|
-
import('../vendor/ink/build/output.js'),
|
|
18
|
-
]);
|
|
19
|
-
|
|
20
|
-
const BODY = '①첫째 ②둘째 ③셋째 한국어 본문 텍스트가 이어집니다';
|
|
21
|
-
|
|
22
|
-
test('Windows Terminal wide glyph wrapping keeps every transcript body line in budget', () => {
|
|
23
|
-
const budget = 12;
|
|
24
|
-
const lines = wrapText(BODY, budget, 'wrap').split('\n');
|
|
25
|
-
assert.ok(lines.length > 1, 'harness input must wrap');
|
|
26
|
-
for (const line of lines) {
|
|
27
|
-
assert.ok(
|
|
28
|
-
displayStringWidth(line) <= budget,
|
|
29
|
-
`${JSON.stringify(line)} is ${displayStringWidth(line)} cells (budget ${budget})`,
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
test('Output materializes the reserved cell after a policy-widened glyph', () => {
|
|
35
|
-
const text = '②{ M }';
|
|
36
|
-
assert.equal(stringWidth(text), 6, 'plain/native cursor advance is the broken 1-cell baseline');
|
|
37
|
-
assert.equal(displayStringWidth(text), 7, 'Ink layout reserves two cells for ②');
|
|
38
|
-
|
|
39
|
-
const output = new Output({ width: 20, height: 1 });
|
|
40
|
-
output.write(0, 0, text, { transformers: [] });
|
|
41
|
-
const rendered = output.get().output;
|
|
42
|
-
|
|
43
|
-
assert.equal(rendered, '② { M }', 'serialized bytes must advance over the reserved cell');
|
|
44
|
-
assert.equal(stringWidth(rendered), 7, 'emitted terminal cursor width matches the 7-cell layout');
|
|
45
|
-
|
|
46
|
-
const excluded = new Output({ width: 20, height: 1 });
|
|
47
|
-
excluded.write(0, 0, '└A ←B ↻C', { transformers: [] });
|
|
48
|
-
assert.equal(excluded.get().output, '└A ←B ↻C', 'box/figure glyphs must not gain padding');
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
test('horizontal output clipping uses the wide-glyph display columns', () => {
|
|
52
|
-
const budget = 12;
|
|
53
|
-
const output = new Output({ width: 40, height: 1 });
|
|
54
|
-
output.clip({ x1: 0, x2: budget });
|
|
55
|
-
output.write(0, 0, BODY, { transformers: [] });
|
|
56
|
-
output.unclip();
|
|
57
|
-
|
|
58
|
-
const rendered = output.get().output;
|
|
59
|
-
assert.ok(
|
|
60
|
-
stringWidth(rendered) <= budget,
|
|
61
|
-
`${JSON.stringify(rendered)} escaped clip at ${stringWidth(rendered)} emitted cells`,
|
|
62
|
-
);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
test('left-edge clipping drops a glyph intersected by x1 and keeps mixed Korean text aligned', () => {
|
|
66
|
-
const output = new Output({ width: 40, height: 1 });
|
|
67
|
-
output.clip({ x1: 3, x2: 15 });
|
|
68
|
-
output.write(0, 0, '가①나②다③ 한국어', { transformers: [] });
|
|
69
|
-
output.unclip();
|
|
70
|
-
|
|
71
|
-
const rendered = output.get().output;
|
|
72
|
-
assert.ok(rendered.startsWith(' 나'), JSON.stringify(rendered));
|
|
73
|
-
assert.ok(stringWidth(rendered) <= 15);
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
test('one-cell clip drops a two-cell circled digit instead of crossing x2', () => {
|
|
77
|
-
const output = new Output({ width: 10, height: 1 });
|
|
78
|
-
output.clip({ x1: 0, x2: 1 });
|
|
79
|
-
output.write(0, 0, '①A', { transformers: [] });
|
|
80
|
-
output.unclip();
|
|
81
|
-
|
|
82
|
-
const rendered = output.get().output;
|
|
83
|
-
assert.equal(rendered, '');
|
|
84
|
-
assert.ok(displayStringWidth(rendered) <= 1);
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
test('policy-off and no-problem slices preserve upstream slice-ansi bytes', () => {
|
|
88
|
-
const styledProblem = '\x1b[31m①AB\x1b[39m';
|
|
89
|
-
assert.equal(
|
|
90
|
-
sliceTextByDisplayWidthWithPolicy(styledProblem, 0, 2, false),
|
|
91
|
-
sliceAnsi(styledProblem, 0, 2),
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
const styledPlain = '\x1b[31mplain\x1b[39m';
|
|
95
|
-
assert.equal(
|
|
96
|
-
sliceTextByDisplayWidth(styledPlain, 1, 4),
|
|
97
|
-
sliceAnsi(styledPlain, 1, 4),
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
const excludedArrows = '\x1b[36m←↑→↓ ↻ tail\x1b[39m';
|
|
101
|
-
assert.equal(
|
|
102
|
-
sliceTextByDisplayWidth(excludedArrows, 1, 7),
|
|
103
|
-
sliceAnsi(excludedArrows, 1, 7),
|
|
104
|
-
);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
test('left clipping re-opens parameterized OSC 8 hyperlinks', () => {
|
|
108
|
-
const open = '\x1b]8;id=x;https://example.test\x07';
|
|
109
|
-
const linked = `${open}가①나\x1b]8;;\x07`;
|
|
110
|
-
const sliced = sliceTextByDisplayWidth(linked, 2, 6);
|
|
111
|
-
assert.ok(sliced.startsWith(open), JSON.stringify(sliced));
|
|
112
|
-
assert.match(sliced, /①나/);
|
|
113
|
-
});
|