mixdog 0.9.62 → 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,252 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import { existsSync, mkdtempSync, mkdirSync, readFileSync, rmSync, utimesSync, writeFileSync } from 'node:fs';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
import { tmpdir } from 'node:os';
|
|
5
|
-
import {
|
|
6
|
-
AUTO_CLEAR_PROVIDER_IDLE_MS,
|
|
7
|
-
resolveAgentTerminalReapMs,
|
|
8
|
-
} from '../src/session-runtime/config-helpers.mjs';
|
|
9
|
-
|
|
10
|
-
const root = mkdtempSync(join(tmpdir(), 'mixdog-agent-terminal-reap-'));
|
|
11
|
-
process.env.MIXDOG_DATA_DIR = root;
|
|
12
|
-
process.env.MIXDOG_AGENT_TERMINAL_REAP_MS = '1';
|
|
13
|
-
|
|
14
|
-
function assertEqual(actual, expected, label) {
|
|
15
|
-
assert.equal(actual, expected, `${label}: expected ${expected}, got ${actual}`);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
try {
|
|
19
|
-
const builtIns = Object.entries(AUTO_CLEAR_PROVIDER_IDLE_MS).filter(([provider]) => provider !== 'default');
|
|
20
|
-
for (const [provider, idleMs] of builtIns) {
|
|
21
|
-
assertEqual(resolveAgentTerminalReapMs({ autoClear: {} }, provider), idleMs, `${provider} built-in`);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const overrideConfig = {
|
|
25
|
-
autoClear: {
|
|
26
|
-
idleMs: 12 * 60 * 60 * 1000,
|
|
27
|
-
providerIdleMs: { 'openai-oauth': 60_000, default: 90_000, unlisted: 60_000 },
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
assertEqual(resolveAgentTerminalReapMs(overrideConfig, 'openai-oauth'), 60_000, 'provider override');
|
|
31
|
-
assertEqual(
|
|
32
|
-
resolveAgentTerminalReapMs(overrideConfig, 'anthropic'),
|
|
33
|
-
AUTO_CLEAR_PROVIDER_IDLE_MS.anthropic,
|
|
34
|
-
'global idleMs and default row are ignored for listed providers',
|
|
35
|
-
);
|
|
36
|
-
assert.equal(resolveAgentTerminalReapMs(overrideConfig, 'default'), 90_000, 'default row applies to default provider');
|
|
37
|
-
assert.equal(resolveAgentTerminalReapMs(overrideConfig, 'unlisted'), 90_000, 'default row applies to unlisted provider');
|
|
38
|
-
assert.equal(resolveAgentTerminalReapMs({ autoClear: {} }, 'unknown'), AUTO_CLEAR_PROVIDER_IDLE_MS.default, 'unknown provider uses built-in default');
|
|
39
|
-
|
|
40
|
-
mkdirSync(join(root, 'sessions'), { recursive: true });
|
|
41
|
-
writeFileSync(join(root, 'mixdog-config.json'), JSON.stringify({
|
|
42
|
-
agent: { autoClear: overrideConfig.autoClear },
|
|
43
|
-
}));
|
|
44
|
-
const {
|
|
45
|
-
deleteSession,
|
|
46
|
-
markSessionClosed,
|
|
47
|
-
saveSession,
|
|
48
|
-
sweepStaleSessions,
|
|
49
|
-
} = await import('../src/runtime/agent/orchestrator/session/store.mjs');
|
|
50
|
-
const old = Date.now() - 181_000;
|
|
51
|
-
const known = {
|
|
52
|
-
id: 'sess_known_reap',
|
|
53
|
-
owner: 'agent',
|
|
54
|
-
status: 'idle',
|
|
55
|
-
provider: 'openai-oauth',
|
|
56
|
-
createdAt: old,
|
|
57
|
-
updatedAt: old,
|
|
58
|
-
messages: [],
|
|
59
|
-
};
|
|
60
|
-
const shortOverride = {
|
|
61
|
-
id: 'sess_short_override',
|
|
62
|
-
owner: 'agent',
|
|
63
|
-
status: 'idle',
|
|
64
|
-
provider: 'openai-oauth',
|
|
65
|
-
createdAt: Date.now() - 120_000,
|
|
66
|
-
updatedAt: Date.now() - 120_000,
|
|
67
|
-
messages: [],
|
|
68
|
-
};
|
|
69
|
-
const unknown = {
|
|
70
|
-
id: 'sess_unknown_keep',
|
|
71
|
-
owner: 'agent',
|
|
72
|
-
status: 'idle',
|
|
73
|
-
provider: 'unlisted',
|
|
74
|
-
createdAt: old,
|
|
75
|
-
updatedAt: old,
|
|
76
|
-
messages: [],
|
|
77
|
-
};
|
|
78
|
-
writeFileSync(join(root, 'sessions', `${known.id}.json`), JSON.stringify(known));
|
|
79
|
-
writeFileSync(join(root, 'sessions', `${shortOverride.id}.json`), JSON.stringify(shortOverride));
|
|
80
|
-
writeFileSync(join(root, 'sessions', `${unknown.id}.json`), JSON.stringify(unknown));
|
|
81
|
-
for (const id of [known.id, unknown.id]) utimesSync(join(root, 'sessions', `${id}.json`), old / 1000, old / 1000);
|
|
82
|
-
utimesSync(join(root, 'sessions', `${shortOverride.id}.json`), shortOverride.updatedAt / 1000, shortOverride.updatedAt / 1000);
|
|
83
|
-
const defaultSweep = sweepStaleSessions({ retainOpenSessions: false });
|
|
84
|
-
assert.ok(
|
|
85
|
-
defaultSweep.details.some((detail) => detail.id === shortOverride.id),
|
|
86
|
-
'short provider override bypasses the default sweep freshness gate',
|
|
87
|
-
);
|
|
88
|
-
assert.ok(defaultSweep.details.some((detail) => detail.id === known.id), 'store reaps a listed provider at its Advanced duration');
|
|
89
|
-
assert.ok(defaultSweep.details.some((detail) => detail.id === unknown.id), 'store reaps an unlisted provider at the default duration');
|
|
90
|
-
|
|
91
|
-
const locallyLive = {
|
|
92
|
-
...known,
|
|
93
|
-
id: 'sess_locally_live_keep',
|
|
94
|
-
};
|
|
95
|
-
writeFileSync(join(root, 'sessions', `${locallyLive.id}.json`), JSON.stringify(locallyLive));
|
|
96
|
-
utimesSync(join(root, 'sessions', `${locallyLive.id}.json`), old / 1000, old / 1000);
|
|
97
|
-
const protectedSweep = sweepStaleSessions({
|
|
98
|
-
retainOpenSessions: false,
|
|
99
|
-
isSessionLive: (id) => id === locallyLive.id,
|
|
100
|
-
});
|
|
101
|
-
assert.ok(!protectedSweep.details.some((detail) => detail.id === locallyLive.id), 'store does not reap a locally live stale session');
|
|
102
|
-
assert.notEqual(JSON.parse(readFileSync(join(root, 'sessions', `${locallyLive.id}.json`), 'utf8')).closed, true);
|
|
103
|
-
const settledSweep = sweepStaleSessions({ retainOpenSessions: false });
|
|
104
|
-
assert.ok(settledSweep.details.some((detail) => detail.id === locallyLive.id), 'store reaps the session once local work settles');
|
|
105
|
-
|
|
106
|
-
const heartbeatRace = {
|
|
107
|
-
...known,
|
|
108
|
-
id: 'sess_heartbeat_race_keep',
|
|
109
|
-
};
|
|
110
|
-
const heartbeatRacePath = join(root, 'sessions', `${heartbeatRace.id}.json`);
|
|
111
|
-
writeFileSync(heartbeatRacePath, JSON.stringify(heartbeatRace));
|
|
112
|
-
utimesSync(heartbeatRacePath, old / 1000, old / 1000);
|
|
113
|
-
let livenessChecks = 0;
|
|
114
|
-
const heartbeatRaceSweep = sweepStaleSessions({
|
|
115
|
-
retainOpenSessions: false,
|
|
116
|
-
isSessionLive: (id) => {
|
|
117
|
-
if (id !== heartbeatRace.id) return false;
|
|
118
|
-
livenessChecks++;
|
|
119
|
-
if (livenessChecks === 3) {
|
|
120
|
-
writeFileSync(join(root, 'sessions', `${id}.hb`), '');
|
|
121
|
-
}
|
|
122
|
-
return false;
|
|
123
|
-
},
|
|
124
|
-
});
|
|
125
|
-
assert.ok(livenessChecks >= 3, 'store performs the final runtime probe before taking the close lock');
|
|
126
|
-
assert.ok(!heartbeatRaceSweep.details.some((detail) => detail.id === heartbeatRace.id), 'heartbeat landing before the locked re-stat vetoes close');
|
|
127
|
-
assert.notEqual(JSON.parse(readFileSync(heartbeatRacePath, 'utf8')).closed, true);
|
|
128
|
-
|
|
129
|
-
const retentionHeartbeat = {
|
|
130
|
-
...known,
|
|
131
|
-
id: 'sess_retention_heartbeat_keep',
|
|
132
|
-
createdAt: Date.now() - 1_000,
|
|
133
|
-
updatedAt: Date.now() - 1_000,
|
|
134
|
-
};
|
|
135
|
-
const retentionPath = join(root, 'sessions', `${retentionHeartbeat.id}.json`);
|
|
136
|
-
writeFileSync(retentionPath, JSON.stringify(retentionHeartbeat));
|
|
137
|
-
let retentionLivenessChecks = 0;
|
|
138
|
-
const retentionSweep = sweepStaleSessions({
|
|
139
|
-
ttlMs: 60_000,
|
|
140
|
-
openMaxAgeMs: 24 * 60 * 60 * 1000,
|
|
141
|
-
openMaxCount: 0,
|
|
142
|
-
isSessionLive: (id) => {
|
|
143
|
-
if (id !== retentionHeartbeat.id) return false;
|
|
144
|
-
retentionLivenessChecks++;
|
|
145
|
-
if (retentionLivenessChecks === 2) {
|
|
146
|
-
writeFileSync(join(root, 'sessions', `${id}.hb`), '');
|
|
147
|
-
}
|
|
148
|
-
return false;
|
|
149
|
-
},
|
|
150
|
-
});
|
|
151
|
-
assert.ok(retentionLivenessChecks >= 2, 'retention performs its runtime probe before taking the delete lock');
|
|
152
|
-
assert.ok(!retentionSweep.openPrunedDetails.some((detail) => detail.id === retentionHeartbeat.id), 'commit-edge heartbeat vetoes retention hard-delete');
|
|
153
|
-
assert.ok(existsSync(retentionPath), 'heartbeating retention candidate survives');
|
|
154
|
-
|
|
155
|
-
const pendingClose = { ...known, id: 'sess_vetoed_close_pending', messages: [] };
|
|
156
|
-
const pendingDelete = { ...known, id: 'sess_vetoed_delete_pending', messages: [] };
|
|
157
|
-
for (const session of [pendingClose, pendingDelete]) {
|
|
158
|
-
writeFileSync(join(root, 'sessions', `${session.id}.json`), JSON.stringify(session));
|
|
159
|
-
saveSession({ ...session, messages: [{ role: 'user', content: 'pending save survived' }] });
|
|
160
|
-
}
|
|
161
|
-
assert.equal(markSessionClosed(pendingClose.id, 'idle-sweep', { isSessionLive: () => true }), null);
|
|
162
|
-
assert.equal(deleteSession(pendingDelete.id, { isSessionLive: () => true }), false);
|
|
163
|
-
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
164
|
-
for (const session of [pendingClose, pendingDelete]) {
|
|
165
|
-
const saved = JSON.parse(readFileSync(join(root, 'sessions', `${session.id}.json`), 'utf8'));
|
|
166
|
-
assert.equal(saved.messages[0]?.content, 'pending save survived', 'veto leaves debounce persistence intact');
|
|
167
|
-
assert.notEqual(saved.closed, true);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
const {
|
|
171
|
-
_clearSessionRuntime,
|
|
172
|
-
_getRuntimeEntry,
|
|
173
|
-
markSessionAskStart,
|
|
174
|
-
} = await import('../src/runtime/agent/orchestrator/session/manager/runtime-liveness.mjs');
|
|
175
|
-
const {
|
|
176
|
-
_finalizeSweptSessionRuntime,
|
|
177
|
-
_runCleanupCycle,
|
|
178
|
-
} = await import('../src/runtime/agent/orchestrator/session/manager/idle-cleanup.mjs');
|
|
179
|
-
|
|
180
|
-
const busy = {
|
|
181
|
-
...known,
|
|
182
|
-
id: 'sess_unrelated_busy_keep',
|
|
183
|
-
status: 'running',
|
|
184
|
-
};
|
|
185
|
-
const terminalDuringBusy = {
|
|
186
|
-
...known,
|
|
187
|
-
id: 'sess_terminal_during_busy_reap',
|
|
188
|
-
};
|
|
189
|
-
for (const session of [busy, terminalDuringBusy]) {
|
|
190
|
-
const path = join(root, 'sessions', `${session.id}.json`);
|
|
191
|
-
writeFileSync(path, JSON.stringify(session));
|
|
192
|
-
utimesSync(path, old / 1000, old / 1000);
|
|
193
|
-
}
|
|
194
|
-
markSessionAskStart(busy.id);
|
|
195
|
-
const busyEntry = _getRuntimeEntry(busy.id);
|
|
196
|
-
busyEntry.controller = new AbortController();
|
|
197
|
-
_runCleanupCycle();
|
|
198
|
-
assert.notEqual(JSON.parse(readFileSync(join(root, 'sessions', `${busy.id}.json`), 'utf8')).closed, true, 'unrelated busy runtime survives idle cleanup');
|
|
199
|
-
assert.equal(JSON.parse(readFileSync(join(root, 'sessions', `${terminalDuringBusy.id}.json`), 'utf8')).closed, true, 'terminal session is reaped while unrelated runtime is busy');
|
|
200
|
-
|
|
201
|
-
const postScanRaceId = 'sess_post_scan_active_veto';
|
|
202
|
-
markSessionAskStart(postScanRaceId);
|
|
203
|
-
const postScanEntry = _getRuntimeEntry(postScanRaceId);
|
|
204
|
-
postScanEntry.controller = new AbortController();
|
|
205
|
-
assert.equal(_finalizeSweptSessionRuntime({ id: postScanRaceId }), false, 'post-scan activity vetoes runtime cleanup');
|
|
206
|
-
assert.equal(postScanEntry.controller.signal.aborted, false, 'post-scan controller is not aborted');
|
|
207
|
-
assert.equal(_getRuntimeEntry(postScanRaceId), postScanEntry, 'post-scan runtime remains owned');
|
|
208
|
-
_clearSessionRuntime(busy.id);
|
|
209
|
-
_clearSessionRuntime(postScanRaceId);
|
|
210
|
-
|
|
211
|
-
const dataDir = join(root, 'worker-index');
|
|
212
|
-
mkdirSync(dataDir, { recursive: true });
|
|
213
|
-
writeFileSync(join(dataDir, 'agent-workers.json'), JSON.stringify({
|
|
214
|
-
workers: {
|
|
215
|
-
known: {
|
|
216
|
-
tag: 'known',
|
|
217
|
-
sessionId: 'sess_known_row',
|
|
218
|
-
provider: 'openai-oauth',
|
|
219
|
-
status: 'idle',
|
|
220
|
-
updatedAt: new Date(old).toISOString(),
|
|
221
|
-
},
|
|
222
|
-
unknown: {
|
|
223
|
-
tag: 'unknown',
|
|
224
|
-
sessionId: 'sess_unknown_row',
|
|
225
|
-
provider: 'unlisted',
|
|
226
|
-
status: 'idle',
|
|
227
|
-
updatedAt: new Date(old).toISOString(),
|
|
228
|
-
},
|
|
229
|
-
},
|
|
230
|
-
}));
|
|
231
|
-
const { createStandaloneAgent } = await import('../src/standalone/agent-tool.mjs');
|
|
232
|
-
const agent = createStandaloneAgent({
|
|
233
|
-
cfgMod: {
|
|
234
|
-
loadConfig: () => overrideConfig,
|
|
235
|
-
resolveRuntimeSpec: () => ({ lane: 'agent', scopeKey: 'terminal-reap', provider: 'openai-oauth', model: 'test' }),
|
|
236
|
-
},
|
|
237
|
-
reg: {},
|
|
238
|
-
mgr: { listSessions: () => [], getSession: () => null },
|
|
239
|
-
dataDir,
|
|
240
|
-
cwd: root,
|
|
241
|
-
});
|
|
242
|
-
const workers = agent.getStatus().workers;
|
|
243
|
-
assert.ok(!workers.some((worker) => worker.tag === 'known'), 'worker row expires at the provider duration');
|
|
244
|
-
assert.ok(!workers.some((worker) => worker.tag === 'unknown'), 'unlisted worker row expires at the default duration');
|
|
245
|
-
agent.closeAll('agent-terminal-reap-test');
|
|
246
|
-
|
|
247
|
-
process.stdout.write(`agent terminal reap test passed (${builtIns.length} providers)\n`);
|
|
248
|
-
} finally {
|
|
249
|
-
delete process.env.MIXDOG_AGENT_TERMINAL_REAP_MS;
|
|
250
|
-
delete process.env.MIXDOG_DATA_DIR;
|
|
251
|
-
rmSync(root, { recursive: true, force: true });
|
|
252
|
-
}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import { spawn, spawnSync } from 'node:child_process';
|
|
3
|
-
import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
4
|
-
import { tmpdir } from 'node:os';
|
|
5
|
-
import { dirname, join, resolve } from 'node:path';
|
|
6
|
-
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
7
|
-
import test from 'node:test';
|
|
8
|
-
|
|
9
|
-
const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
10
|
-
const traceModuleUrl = pathToFileURL(join(root, 'src/runtime/agent/orchestrator/agent-trace-io.mjs')).href;
|
|
11
|
-
|
|
12
|
-
test('drainAgentTrace awaits delayed local JSONL append without a memory service', () => {
|
|
13
|
-
const dir = mkdtempSync(join(tmpdir(), 'mixdog-agent-trace-io-test-'));
|
|
14
|
-
const traceParent = join(dir, 'nested');
|
|
15
|
-
const tracePath = join(traceParent, 'history', 'agent-trace.jsonl');
|
|
16
|
-
const loaderPath = join(dir, 'loader.mjs');
|
|
17
|
-
const delayedFsPath = join(dir, 'delayed-fs-promises.mjs');
|
|
18
|
-
try {
|
|
19
|
-
writeFileSync(delayedFsPath, `
|
|
20
|
-
import { appendFile as realAppendFile } from 'node:fs/promises';
|
|
21
|
-
export async function appendFile(...args) {
|
|
22
|
-
await new Promise((resolve) => setTimeout(resolve, Number(process.env.TRACE_APPEND_DELAY_MS)));
|
|
23
|
-
return realAppendFile(...args);
|
|
24
|
-
}
|
|
25
|
-
`);
|
|
26
|
-
writeFileSync(loaderPath, `
|
|
27
|
-
export async function resolve(specifier, context, nextResolve) {
|
|
28
|
-
if (specifier === 'fs/promises' && context.parentURL === ${JSON.stringify(traceModuleUrl)}) {
|
|
29
|
-
return { url: new URL('./delayed-fs-promises.mjs', import.meta.url).href, shortCircuit: true };
|
|
30
|
-
}
|
|
31
|
-
return nextResolve(specifier, context);
|
|
32
|
-
}
|
|
33
|
-
`);
|
|
34
|
-
const child = spawnSync(process.execPath, [
|
|
35
|
-
'--experimental-loader',
|
|
36
|
-
pathToFileURL(loaderPath).href,
|
|
37
|
-
'--input-type=module',
|
|
38
|
-
'-e',
|
|
39
|
-
`
|
|
40
|
-
import { readFileSync, rmSync } from 'node:fs';
|
|
41
|
-
import { appendAgentTrace, drainAgentTrace } from ${JSON.stringify(traceModuleUrl)};
|
|
42
|
-
appendAgentTrace({ kind: 'delayed-local-test', session_id: 'sess_delayed' });
|
|
43
|
-
rmSync(process.env.TRACE_PARENT, { recursive: true, force: true });
|
|
44
|
-
const started = Date.now();
|
|
45
|
-
await drainAgentTrace();
|
|
46
|
-
const rows = readFileSync(process.env.MIXDOG_AGENT_TRACE_PATH, 'utf8').trim().split(/\\r?\\n/).map(JSON.parse);
|
|
47
|
-
process.stdout.write(JSON.stringify({ elapsed: Date.now() - started, rows }));
|
|
48
|
-
`,
|
|
49
|
-
], {
|
|
50
|
-
encoding: 'utf8',
|
|
51
|
-
env: {
|
|
52
|
-
...process.env,
|
|
53
|
-
MIXDOG_AGENT_TRACE_PATH: tracePath,
|
|
54
|
-
MIXDOG_AGENT_TRACE_DISABLE: '',
|
|
55
|
-
MIXDOG_AGENT_TRACE_LOCAL_DISABLE: '',
|
|
56
|
-
MIXDOG_RUNTIME_ROOT: join(dir, 'no-service'),
|
|
57
|
-
TRACE_PARENT: traceParent,
|
|
58
|
-
TRACE_APPEND_DELAY_MS: '75',
|
|
59
|
-
},
|
|
60
|
-
timeout: 5000,
|
|
61
|
-
});
|
|
62
|
-
assert.equal(child.status, 0, child.stderr || child.stdout);
|
|
63
|
-
const result = JSON.parse(child.stdout);
|
|
64
|
-
assert.ok(result.elapsed >= 60, `drain returned before delayed append (${result.elapsed}ms)`);
|
|
65
|
-
assert.equal(result.rows.length, 1);
|
|
66
|
-
assert.equal(result.rows[0].kind, 'delayed-local-test');
|
|
67
|
-
assert.equal(result.rows[0].session_id, 'sess_delayed');
|
|
68
|
-
assert.match(readFileSync(tracePath, 'utf8'), /"kind":"delayed-local-test"/);
|
|
69
|
-
} finally {
|
|
70
|
-
rmSync(dir, { recursive: true, force: true });
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
test('explicit trace path stays append-only across concurrent writers', async () => {
|
|
75
|
-
const dir = mkdtempSync(join(tmpdir(), 'mixdog-agent-trace-multiwriter-test-'));
|
|
76
|
-
const tracePath = join(dir, 'agent-trace.jsonl');
|
|
77
|
-
const writerCount = 4;
|
|
78
|
-
const rowsPerWriter = 20;
|
|
79
|
-
try {
|
|
80
|
-
// Start above the normal rotation threshold. An explicit shared sink must
|
|
81
|
-
// retain this row in the live file while every child appends to it.
|
|
82
|
-
writeFileSync(tracePath, `${JSON.stringify({
|
|
83
|
-
kind: 'multiwriter-seed',
|
|
84
|
-
session_id: 'sess_seed',
|
|
85
|
-
payload: 'x'.repeat(10 * 1024 * 1024),
|
|
86
|
-
})}\n`);
|
|
87
|
-
const childSource = `
|
|
88
|
-
import { appendAgentTrace, drainAgentTrace } from ${JSON.stringify(traceModuleUrl)};
|
|
89
|
-
for (let i = 0; i < Number(process.env.ROWS_PER_WRITER); i += 1) {
|
|
90
|
-
appendAgentTrace({
|
|
91
|
-
kind: 'multiwriter',
|
|
92
|
-
session_id: 'sess_writer_' + process.env.WRITER_ID,
|
|
93
|
-
payload: { writer: Number(process.env.WRITER_ID), index: i },
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
await drainAgentTrace();
|
|
97
|
-
`;
|
|
98
|
-
await Promise.all(Array.from({ length: writerCount }, (_, writer) => new Promise((resolveChild, rejectChild) => {
|
|
99
|
-
const child = spawn(process.execPath, ['--input-type=module', '-e', childSource], {
|
|
100
|
-
cwd: root,
|
|
101
|
-
env: {
|
|
102
|
-
...process.env,
|
|
103
|
-
MIXDOG_AGENT_TRACE_PATH: tracePath,
|
|
104
|
-
MIXDOG_AGENT_TRACE_DISABLE: '',
|
|
105
|
-
MIXDOG_AGENT_TRACE_LOCAL_DISABLE: '',
|
|
106
|
-
MIXDOG_RUNTIME_ROOT: join(dir, `no-service-${writer}`),
|
|
107
|
-
ROWS_PER_WRITER: String(rowsPerWriter),
|
|
108
|
-
WRITER_ID: String(writer),
|
|
109
|
-
},
|
|
110
|
-
stdio: ['ignore', 'ignore', 'pipe'],
|
|
111
|
-
});
|
|
112
|
-
let stderr = '';
|
|
113
|
-
child.stderr.setEncoding('utf8');
|
|
114
|
-
child.stderr.on('data', (chunk) => { stderr += chunk; });
|
|
115
|
-
child.on('error', rejectChild);
|
|
116
|
-
child.on('exit', (code) => {
|
|
117
|
-
if (code === 0) resolveChild();
|
|
118
|
-
else rejectChild(new Error(`writer ${writer} exited ${code}: ${stderr}`));
|
|
119
|
-
});
|
|
120
|
-
})));
|
|
121
|
-
assert.equal(existsSync(`${tracePath}.1`), false);
|
|
122
|
-
const rows = readFileSync(tracePath, 'utf8').trim().split(/\r?\n/).map(JSON.parse);
|
|
123
|
-
assert.equal(rows[0].kind, 'multiwriter-seed');
|
|
124
|
-
const written = rows.filter((row) => row.kind === 'multiwriter');
|
|
125
|
-
assert.equal(written.length, writerCount * rowsPerWriter);
|
|
126
|
-
assert.deepEqual(
|
|
127
|
-
[...new Set(written.map((row) => row.session_id))].sort(),
|
|
128
|
-
Array.from({ length: writerCount }, (_, writer) => `sess_writer_${writer}`),
|
|
129
|
-
);
|
|
130
|
-
} finally {
|
|
131
|
-
rmSync(dir, { recursive: true, force: true });
|
|
132
|
-
}
|
|
133
|
-
});
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import test from 'node:test';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
brightGreen,
|
|
6
|
-
refreshColorSupport,
|
|
7
|
-
rgb,
|
|
8
|
-
rgbBg,
|
|
9
|
-
rgbSgr,
|
|
10
|
-
rgbToAnsi256,
|
|
11
|
-
supportsTruecolor,
|
|
12
|
-
} from '../src/ui/ansi.mjs';
|
|
13
|
-
import {
|
|
14
|
-
remapCanonicalStatuslineTruecolor,
|
|
15
|
-
STATUSLINE_CANONICAL_TRUECOLOR,
|
|
16
|
-
} from '../src/tui/statusline-ansi-bridge.mjs';
|
|
17
|
-
|
|
18
|
-
const savedEnv = {
|
|
19
|
-
COLORTERM: process.env.COLORTERM,
|
|
20
|
-
FORCE_COLOR: process.env.FORCE_COLOR,
|
|
21
|
-
NO_COLOR: process.env.NO_COLOR,
|
|
22
|
-
TERM: process.env.TERM,
|
|
23
|
-
TERM_PROGRAM: process.env.TERM_PROGRAM,
|
|
24
|
-
WT_SESSION: process.env.WT_SESSION,
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
function restoreEnv() {
|
|
28
|
-
for (const [key, value] of Object.entries(savedEnv)) {
|
|
29
|
-
if (value === undefined) delete process.env[key];
|
|
30
|
-
else process.env[key] = value;
|
|
31
|
-
}
|
|
32
|
-
refreshColorSupport();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
test.after(restoreEnv);
|
|
36
|
-
|
|
37
|
-
test('truecolor capability detection preserves known positives and defaults unknown to truecolor', () => {
|
|
38
|
-
assert.equal(supportsTruecolor({ TERM_PROGRAM: 'Apple_Terminal', COLORTERM: 'truecolor' }, 'darwin'), false);
|
|
39
|
-
assert.equal(supportsTruecolor({ COLORTERM: 'truecolor' }, 'darwin'), true);
|
|
40
|
-
assert.equal(supportsTruecolor({ COLORTERM: '24bit' }, 'linux'), true);
|
|
41
|
-
assert.equal(supportsTruecolor({ WT_SESSION: 'abc' }, 'linux'), true);
|
|
42
|
-
assert.equal(supportsTruecolor({ TERM_PROGRAM: 'iTerm.app' }, 'darwin'), true);
|
|
43
|
-
assert.equal(supportsTruecolor({ TERM_PROGRAM: 'WezTerm' }, 'darwin'), true);
|
|
44
|
-
assert.equal(supportsTruecolor({ TERM_PROGRAM: 'ghostty' }, 'darwin'), true);
|
|
45
|
-
assert.equal(supportsTruecolor({ TERM_PROGRAM: 'vscode' }, 'darwin'), true);
|
|
46
|
-
assert.equal(supportsTruecolor({ TERM: 'xterm-direct' }, 'linux'), true);
|
|
47
|
-
assert.equal(supportsTruecolor({}, 'win32'), true);
|
|
48
|
-
assert.equal(supportsTruecolor({}, 'linux'), true);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
test('RGB helpers are byte-identical in truecolor mode and downsample foreground/background on Apple Terminal', () => {
|
|
52
|
-
process.env.FORCE_COLOR = '1';
|
|
53
|
-
delete process.env.NO_COLOR;
|
|
54
|
-
process.env.COLORTERM = 'truecolor';
|
|
55
|
-
delete process.env.TERM_PROGRAM;
|
|
56
|
-
refreshColorSupport();
|
|
57
|
-
|
|
58
|
-
assert.equal(rgb(215, 119, 87)('x'), '\x1b[38;2;215;119;87mx\x1b[0m');
|
|
59
|
-
assert.equal(rgbBg(55, 55, 55)('x'), '\x1b[48;2;55;55;55mx\x1b[0m');
|
|
60
|
-
|
|
61
|
-
process.env.TERM_PROGRAM = 'Apple_Terminal';
|
|
62
|
-
assert.equal(rgbSgr(215, 119, 87), '\x1b[38;5;173m');
|
|
63
|
-
assert.equal(rgb(215, 119, 87)('x'), '\x1b[38;5;173mx\x1b[0m');
|
|
64
|
-
assert.equal(rgbBg(55, 55, 55)('x'), '\x1b[48;5;237mx\x1b[0m');
|
|
65
|
-
assert.equal(brightGreen('x'), '\x1b[38;5;35mx\x1b[0m');
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
test('RGB to ANSI-256 conversion selects the nearest cube or grayscale entry', () => {
|
|
69
|
-
assert.equal(rgbToAnsi256(0, 170, 75), 35);
|
|
70
|
-
assert.equal(rgbToAnsi256(198, 198, 198), 251);
|
|
71
|
-
assert.equal(rgbToAnsi256(136, 136, 136), 102);
|
|
72
|
-
assert.equal(rgbToAnsi256(255, 255, 255), 231);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
test('statusline theme remap recognizes canonical 256-color variants', () => {
|
|
76
|
-
const colors = {
|
|
77
|
-
STATUS: '<status>',
|
|
78
|
-
SUBTLE: '<subtle>',
|
|
79
|
-
SUCCESS: '<success>',
|
|
80
|
-
WARNING: '<warning>',
|
|
81
|
-
ERROR: '<error>',
|
|
82
|
-
};
|
|
83
|
-
const success256 = `\x1b[38;5;${rgbToAnsi256(...STATUSLINE_CANONICAL_TRUECOLOR.success)}m`;
|
|
84
|
-
const warning256 = `\x1b[38;5;${rgbToAnsi256(...STATUSLINE_CANONICAL_TRUECOLOR.warningBright)}m`;
|
|
85
|
-
const input = `${success256}ok ${warning256}warn`;
|
|
86
|
-
assert.equal(
|
|
87
|
-
remapCanonicalStatuslineTruecolor(input, colors),
|
|
88
|
-
'<success>ok <warning>warn',
|
|
89
|
-
);
|
|
90
|
-
});
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import test from 'node:test';
|
|
2
|
-
import assert from 'node:assert/strict';
|
|
3
|
-
|
|
4
|
-
import { AnthropicProvider } from '../src/runtime/agent/orchestrator/providers/anthropic.mjs';
|
|
5
|
-
import {
|
|
6
|
-
ProviderAdmissionScheduler,
|
|
7
|
-
wrapProviderAdmission,
|
|
8
|
-
} from '../src/runtime/agent/orchestrator/providers/admission-scheduler.mjs';
|
|
9
|
-
|
|
10
|
-
const encoder = new TextEncoder();
|
|
11
|
-
|
|
12
|
-
function sseResponse(events, headers = new Map()) {
|
|
13
|
-
const bytes = encoder.encode(events.map((event) => (
|
|
14
|
-
`event: ${event.type}\ndata: ${JSON.stringify(event)}\n\n`
|
|
15
|
-
)).join(''));
|
|
16
|
-
let sent = false;
|
|
17
|
-
return {
|
|
18
|
-
ok: true,
|
|
19
|
-
status: 200,
|
|
20
|
-
headers,
|
|
21
|
-
body: { getReader: () => ({
|
|
22
|
-
async read() {
|
|
23
|
-
if (sent) return { done: true };
|
|
24
|
-
sent = true;
|
|
25
|
-
return { done: false, value: bytes };
|
|
26
|
-
},
|
|
27
|
-
async cancel() {},
|
|
28
|
-
releaseLock() {},
|
|
29
|
-
}) },
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
test('real wrapped Anthropic retries report HTTP and SSE 429 before eventual success', async () => {
|
|
34
|
-
let now = 10_000;
|
|
35
|
-
const scheduled = [];
|
|
36
|
-
const scheduler = new ProviderAdmissionScheduler({
|
|
37
|
-
concurrency: 4,
|
|
38
|
-
now: () => now,
|
|
39
|
-
setTimer(fn, delay) {
|
|
40
|
-
const timer = { fn, delay };
|
|
41
|
-
scheduled.push(timer);
|
|
42
|
-
return timer;
|
|
43
|
-
},
|
|
44
|
-
clearTimer() {},
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
const provider = Object.create(AnthropicProvider.prototype);
|
|
48
|
-
provider.name = 'anthropic';
|
|
49
|
-
provider.config = { apiKey: 'fixture-key' };
|
|
50
|
-
provider.fastModeBetaHeaderLatched = false;
|
|
51
|
-
let attempts = 0;
|
|
52
|
-
provider.client = { messages: { create() {
|
|
53
|
-
attempts += 1;
|
|
54
|
-
return { async asResponse() {
|
|
55
|
-
if (attempts === 1) {
|
|
56
|
-
return {
|
|
57
|
-
ok: false,
|
|
58
|
-
status: 429,
|
|
59
|
-
headers: new Map([['retry-after-ms', '7']]),
|
|
60
|
-
async text() { return 'limited'; },
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
if (attempts === 2) {
|
|
64
|
-
return sseResponse([
|
|
65
|
-
{ type: 'error', error: { type: 'rate_limit_error', message: 'rate limit' } },
|
|
66
|
-
], new Map([['retry-after-ms', '11']]));
|
|
67
|
-
}
|
|
68
|
-
return sseResponse([
|
|
69
|
-
{ type: 'message_start', message: { model: 'claude', usage: { input_tokens: 1 } } },
|
|
70
|
-
{ type: 'content_block_start', index: 0, content_block: { type: 'text' } },
|
|
71
|
-
{ type: 'content_block_delta', index: 0, delta: { type: 'text_delta', text: 'ok' } },
|
|
72
|
-
{ type: 'message_delta', delta: { stop_reason: 'end_turn' }, usage: { output_tokens: 1 } },
|
|
73
|
-
{ type: 'message_stop' },
|
|
74
|
-
]);
|
|
75
|
-
} };
|
|
76
|
-
} } };
|
|
77
|
-
|
|
78
|
-
wrapProviderAdmission(provider, 'anthropic', scheduler);
|
|
79
|
-
const result = await provider.send([], 'claude-sonnet-4-5', [], {});
|
|
80
|
-
assert.equal(result.content, 'ok');
|
|
81
|
-
assert.equal(attempts, 3);
|
|
82
|
-
|
|
83
|
-
const lane = [...scheduler.lanes.values()][0];
|
|
84
|
-
assert.equal(lane.limit, 1, 'each internally recovered 429 adapts the lane');
|
|
85
|
-
assert.equal(lane.cooldownUntil, now + 11, 'full SSE Retry-After reaches admission');
|
|
86
|
-
assert.ok(scheduled.some((timer) => timer.delay === 7));
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
test('terminal Anthropic 429 is adapted once by admission, not provider retry notification', async () => {
|
|
90
|
-
const previous = process.env.CLAUDE_CODE_MAX_RETRIES;
|
|
91
|
-
process.env.CLAUDE_CODE_MAX_RETRIES = '0';
|
|
92
|
-
try {
|
|
93
|
-
const scheduler = new ProviderAdmissionScheduler({
|
|
94
|
-
concurrency: 4,
|
|
95
|
-
setTimer() { return { unref() {} }; },
|
|
96
|
-
clearTimer() {},
|
|
97
|
-
});
|
|
98
|
-
const provider = Object.create(AnthropicProvider.prototype);
|
|
99
|
-
provider.name = 'anthropic';
|
|
100
|
-
provider.config = { apiKey: 'fixture-key' };
|
|
101
|
-
provider.fastModeBetaHeaderLatched = false;
|
|
102
|
-
provider.client = { messages: { create() {
|
|
103
|
-
return { async asResponse() {
|
|
104
|
-
return {
|
|
105
|
-
ok: false,
|
|
106
|
-
status: 429,
|
|
107
|
-
headers: new Map([['retry-after-ms', '20']]),
|
|
108
|
-
async text() { return 'terminal'; },
|
|
109
|
-
};
|
|
110
|
-
} };
|
|
111
|
-
} } };
|
|
112
|
-
wrapProviderAdmission(provider, 'anthropic', scheduler);
|
|
113
|
-
await assert.rejects(provider.send([], 'claude-sonnet-4-5', [], {}), (err) => err?.status === 429);
|
|
114
|
-
assert.equal([...scheduler.lanes.values()][0]?.limit, 2);
|
|
115
|
-
} finally {
|
|
116
|
-
if (previous == null) delete process.env.CLAUDE_CODE_MAX_RETRIES;
|
|
117
|
-
else process.env.CLAUDE_CODE_MAX_RETRIES = previous;
|
|
118
|
-
}
|
|
119
|
-
});
|