mixdog 0.9.63 → 0.9.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/turn-snapshot.mjs +184 -0
- 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/runtime-core.mjs +4 -0
- package/src/session-runtime/session-text.mjs +4 -4
- package/src/session-runtime/session-turn-api.mjs +7 -0
- 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.jsx +1 -1
- 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 +187 -99
- package/src/tui/engine/agent-envelope.mjs +5 -5
- package/src/tui/engine/live-share.mjs +100 -0
- 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 +6 -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 +29 -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,158 +0,0 @@
|
|
|
1
|
-
import test from 'node:test';
|
|
2
|
-
import assert from 'node:assert/strict';
|
|
3
|
-
import { mkdtemp, mkdir, rm, writeFile } from 'node:fs/promises';
|
|
4
|
-
import { join, parse, relative } from 'node:path';
|
|
5
|
-
import { homedir, tmpdir } from 'node:os';
|
|
6
|
-
import { findCachedGraphBinary } from '../src/runtime/agent/orchestrator/tools/graph-binary-fetcher.mjs';
|
|
7
|
-
|
|
8
|
-
const previousDataDir = process.env.MIXDOG_DATA_DIR;
|
|
9
|
-
const previousHome = process.env.MIXDOG_HOME;
|
|
10
|
-
const previousGraphBin = process.env.MIXDOG_GRAPH_BIN;
|
|
11
|
-
const ambientDataDir = previousDataDir || join(process.env.MIXDOG_HOME || join(homedir(), '.mixdog'), 'data');
|
|
12
|
-
const ambientGraphBin = findCachedGraphBinary(ambientDataDir);
|
|
13
|
-
const isolatedDataDir = await mkdtemp(join(tmpdir(), 'mixdog-code-graph-test-data-'));
|
|
14
|
-
process.env.MIXDOG_DATA_DIR = isolatedDataDir;
|
|
15
|
-
process.env.MIXDOG_HOME = isolatedDataDir;
|
|
16
|
-
if (!previousGraphBin && ambientGraphBin) process.env.MIXDOG_GRAPH_BIN = ambientGraphBin;
|
|
17
|
-
const { executeCodeGraphTool } = await import('../src/runtime/agent/orchestrator/tools/code-graph/dispatch.mjs');
|
|
18
|
-
const { drainCodeGraphCache } = await import('../src/runtime/agent/orchestrator/tools/code-graph/disk-cache.mjs');
|
|
19
|
-
let testTail = Promise.resolve();
|
|
20
|
-
|
|
21
|
-
function serialTest(name, fn) {
|
|
22
|
-
test(name, async (t) => {
|
|
23
|
-
const previous = testTail;
|
|
24
|
-
let release;
|
|
25
|
-
testTail = new Promise((resolve) => { release = resolve; });
|
|
26
|
-
await previous;
|
|
27
|
-
try {
|
|
28
|
-
await fn(t);
|
|
29
|
-
} finally {
|
|
30
|
-
release();
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
async function makeProject() {
|
|
36
|
-
const root = await mkdtemp(join(tmpdir(), 'mixdog-code-graph-project-'));
|
|
37
|
-
await mkdir(join(root, 'src'));
|
|
38
|
-
await writeFile(join(root, 'package.json'), '{}');
|
|
39
|
-
await writeFile(join(root, 'src', 'one.mjs'), 'export const one = 1;\n');
|
|
40
|
-
await writeFile(join(root, 'src', 'two.mjs'), 'export const two = 2;\n');
|
|
41
|
-
return root;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const primaryProject = await makeProject();
|
|
45
|
-
await writeFile(join(isolatedDataDir, 'projects.json'), JSON.stringify({
|
|
46
|
-
projects: [{ name: 'primary', path: primaryProject, addedAt: 1 }],
|
|
47
|
-
}));
|
|
48
|
-
|
|
49
|
-
test.after(async () => {
|
|
50
|
-
drainCodeGraphCache();
|
|
51
|
-
await Promise.all([
|
|
52
|
-
rm(primaryProject, { recursive: true, force: true }),
|
|
53
|
-
rm(isolatedDataDir, { recursive: true, force: true }),
|
|
54
|
-
]);
|
|
55
|
-
if (previousDataDir === undefined) delete process.env.MIXDOG_DATA_DIR;
|
|
56
|
-
else process.env.MIXDOG_DATA_DIR = previousDataDir;
|
|
57
|
-
if (previousHome === undefined) delete process.env.MIXDOG_HOME;
|
|
58
|
-
else process.env.MIXDOG_HOME = previousHome;
|
|
59
|
-
if (previousGraphBin === undefined) delete process.env.MIXDOG_GRAPH_BIN;
|
|
60
|
-
else process.env.MIXDOG_GRAPH_BIN = previousGraphBin;
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
serialTest('aggregate file anchors recover an invalid cwd only for one project root', async () => {
|
|
64
|
-
const project = primaryProject;
|
|
65
|
-
const invalidCwd = parse(project).root;
|
|
66
|
-
const files = [join(project, 'src', 'one.mjs'), join(project, 'src', 'two.mjs')];
|
|
67
|
-
const relativeFiles = files.map((file) => relative(invalidCwd, file));
|
|
68
|
-
const result = await executeCodeGraphTool('code_graph', { mode: 'overview', files }, invalidCwd);
|
|
69
|
-
assert.match(result, new RegExp(`# overview ${files[0].replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}`));
|
|
70
|
-
assert.match(result, new RegExp(`# overview ${files[1].replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}`));
|
|
71
|
-
|
|
72
|
-
const relativeResult = await executeCodeGraphTool('code_graph', { mode: 'overview', files: relativeFiles }, invalidCwd);
|
|
73
|
-
assert.match(relativeResult, /file: src\/one\.mjs/);
|
|
74
|
-
assert.match(relativeResult, /file: src\/two\.mjs/);
|
|
75
|
-
drainCodeGraphCache();
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
serialTest('singleton JSON files retain aggregate cwd provenance', async () => {
|
|
79
|
-
const project = primaryProject;
|
|
80
|
-
const invalidCwd = parse(project).root;
|
|
81
|
-
const file = join(project, 'src', 'one.mjs');
|
|
82
|
-
const result = await executeCodeGraphTool(
|
|
83
|
-
'code_graph',
|
|
84
|
-
{ mode: 'overview', files: JSON.stringify([file]), cwd: invalidCwd },
|
|
85
|
-
project,
|
|
86
|
-
);
|
|
87
|
-
assert.doesNotMatch(result, /^Error:/);
|
|
88
|
-
const missingAggregate = await executeCodeGraphTool(
|
|
89
|
-
'code_graph',
|
|
90
|
-
{ mode: 'overview', files: JSON.stringify([join(project, 'missing.mjs')]), cwd: invalidCwd },
|
|
91
|
-
project,
|
|
92
|
-
);
|
|
93
|
-
assert.match(missingAggregate, /^Error: code_graph: file not found:/);
|
|
94
|
-
const scalarResult = await executeCodeGraphTool(
|
|
95
|
-
'code_graph',
|
|
96
|
-
{ mode: 'overview', file: join(project, 'missing.mjs'), cwd: invalidCwd },
|
|
97
|
-
project,
|
|
98
|
-
);
|
|
99
|
-
assert.match(scalarResult, /^Error: code_graph: file not found:/);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
serialTest('aggregate cwd recovery rejects missing and multi-root anchors', async () => {
|
|
103
|
-
const first = await makeProject();
|
|
104
|
-
const second = await makeProject();
|
|
105
|
-
const invalidCwd = parse(first).root;
|
|
106
|
-
const relativeFirst = relative(invalidCwd, join(first, 'src', 'one.mjs'));
|
|
107
|
-
const relativeSecond = relative(invalidCwd, join(second, 'src', 'one.mjs'));
|
|
108
|
-
try {
|
|
109
|
-
for (const filesArg of [
|
|
110
|
-
[join(first, 'src', 'one.mjs'), join(first, 'missing.mjs')],
|
|
111
|
-
[relativeFirst, relative(invalidCwd, join(first, 'missing.mjs'))],
|
|
112
|
-
]) {
|
|
113
|
-
assert.match(
|
|
114
|
-
await executeCodeGraphTool('code_graph', { mode: 'overview', files: filesArg }, invalidCwd),
|
|
115
|
-
/^Error: code_graph: file not found:/,
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
for (const filesArg of [
|
|
119
|
-
[join(first, 'src', 'one.mjs'), join(second, 'src', 'one.mjs')],
|
|
120
|
-
[relativeFirst, relativeSecond],
|
|
121
|
-
]) {
|
|
122
|
-
assert.match(
|
|
123
|
-
await executeCodeGraphTool('code_graph', { mode: 'overview', files: filesArg }, invalidCwd),
|
|
124
|
-
/^Error: code_graph: file anchor is not owned by a trusted project:/,
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
} finally {
|
|
128
|
-
await Promise.all([rm(first, { recursive: true, force: true }), rm(second, { recursive: true, force: true })]);
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
serialTest('aggregate cwd recovery rejects capped, comma-delimited, and wildcard anchors', async () => {
|
|
133
|
-
const project = await makeProject();
|
|
134
|
-
const invalidCwd = parse(project).root;
|
|
135
|
-
const cappedFiles = await Promise.all(Array.from({ length: 21 }, async (_, index) => {
|
|
136
|
-
const file = join(project, 'src', `anchor-${index}.mjs`);
|
|
137
|
-
await writeFile(file, `export const anchor${index} = ${index};\n`);
|
|
138
|
-
return file;
|
|
139
|
-
}));
|
|
140
|
-
const literalWildcard = join(project, 'src', 'literal[glob].mjs');
|
|
141
|
-
await writeFile(literalWildcard, 'export const wildcard = true;\n');
|
|
142
|
-
try {
|
|
143
|
-
assert.match(
|
|
144
|
-
await executeCodeGraphTool('code_graph', { mode: 'overview', files: cappedFiles }, invalidCwd),
|
|
145
|
-
/file list exceeds cap/,
|
|
146
|
-
);
|
|
147
|
-
assert.match(
|
|
148
|
-
await executeCodeGraphTool('code_graph', { mode: 'overview', files: `${join(project, 'src', 'one.mjs')},${join(project, 'src', 'two.mjs')}` }, invalidCwd),
|
|
149
|
-
/^Error: code_graph: file anchor is not owned by a trusted project:/,
|
|
150
|
-
);
|
|
151
|
-
assert.match(
|
|
152
|
-
await executeCodeGraphTool('code_graph', { mode: 'overview', files: [literalWildcard] }, invalidCwd),
|
|
153
|
-
/wildcard-shaped file anchors/,
|
|
154
|
-
);
|
|
155
|
-
} finally {
|
|
156
|
-
await rm(project, { recursive: true, force: true });
|
|
157
|
-
}
|
|
158
|
-
});
|
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
import test from 'node:test';
|
|
2
|
-
import assert from 'node:assert/strict';
|
|
3
|
-
import {
|
|
4
|
-
_codeGraphWorkerFailure,
|
|
5
|
-
_isCompatibleDiskCodeGraphEntry,
|
|
6
|
-
_postCodeGraphWorkerSuccess,
|
|
7
|
-
_prewarmCodeGraph,
|
|
8
|
-
_prepareDiskCodeGraphFastPath,
|
|
9
|
-
_runDiskCodeGraphFastPath,
|
|
10
|
-
_spawnCodeGraphWorker,
|
|
11
|
-
_validateDiskCodeGraphHit,
|
|
12
|
-
} from '../src/runtime/agent/orchestrator/tools/code-graph/build.mjs';
|
|
13
|
-
import { CODE_GRAPH_MAX_FILES } from '../src/runtime/agent/orchestrator/tools/code-graph/constants.mjs';
|
|
14
|
-
import { _serializeGraph } from '../src/runtime/agent/orchestrator/tools/code-graph/graph-model.mjs';
|
|
15
|
-
import { _persistDiskCodeGraphCacheNow } from '../src/runtime/agent/orchestrator/tools/code-graph/disk-cache.mjs';
|
|
16
|
-
|
|
17
|
-
function workerMessage(message, hooks = {}) {
|
|
18
|
-
return _spawnCodeGraphWorker('/worker', '/worker', 0, null, () => {}, null, null, {
|
|
19
|
-
createWorker: () => ({
|
|
20
|
-
once(event, listener) {
|
|
21
|
-
if (event === 'message') queueMicrotask(() => listener(message));
|
|
22
|
-
},
|
|
23
|
-
terminate() {},
|
|
24
|
-
}),
|
|
25
|
-
getGeneration: () => 0,
|
|
26
|
-
setMemoryCache: () => {},
|
|
27
|
-
setDiskCache: () => {},
|
|
28
|
-
...hooks,
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
test('Worker message path preserves success and validates failure text', async () => {
|
|
33
|
-
const graph = { signature: 'success', nodes: new Map() };
|
|
34
|
-
const memory = [];
|
|
35
|
-
const disk = [];
|
|
36
|
-
assert.equal(await workerMessage({ ok: true, signature: 'success', graph }, {
|
|
37
|
-
setMemoryCache: (cwd, entry) => memory.push({ cwd, entry }),
|
|
38
|
-
setDiskCache: (cwd, entry) => disk.push({ cwd, entry }),
|
|
39
|
-
}), graph);
|
|
40
|
-
assert.deepEqual(memory, [{ cwd: '/worker', entry: { ts: memory[0].entry.ts, signature: 'success', graph } }]);
|
|
41
|
-
assert.deepEqual(disk, [{ cwd: '/worker', entry: graph }]);
|
|
42
|
-
await assert.rejects(workerMessage({ ok: false, error: ' worker build failed ' }), /worker build failed/);
|
|
43
|
-
for (const message of [{ ok: false }, { ok: false, error: ' \t ' }, null]) {
|
|
44
|
-
await assert.rejects(workerMessage(message), /code-graph prewarm worker failed/);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
test('worker failure protocol trims its error text', () => {
|
|
49
|
-
assert.equal(
|
|
50
|
-
_codeGraphWorkerFailure({ ok: false, error: ' disk cache flush failed ' }).message,
|
|
51
|
-
'disk cache flush failed',
|
|
52
|
-
);
|
|
53
|
-
for (const message of [{ ok: false }, { ok: false, error: '' }, { ok: false, error: ' \t ' }]) {
|
|
54
|
-
assert.equal(_codeGraphWorkerFailure(message).message, 'code-graph prewarm worker failed');
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
test('best-effort prewarm swallows build failures', () => {
|
|
59
|
-
let swallowed = false;
|
|
60
|
-
_prewarmCodeGraph('/worker', () => ({
|
|
61
|
-
catch(handler) {
|
|
62
|
-
swallowed = true;
|
|
63
|
-
handler(new Error('worker build failed'));
|
|
64
|
-
},
|
|
65
|
-
}));
|
|
66
|
-
assert.equal(swallowed, true);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
test('signature-validated disk hit restores memory without a Worker build', async () => {
|
|
70
|
-
const graph = { nodes: new Map() };
|
|
71
|
-
let restored = null;
|
|
72
|
-
const result = await _validateDiskCodeGraphHit({
|
|
73
|
-
graphCwd: '/project',
|
|
74
|
-
diskEntry: { signature: 'sig', maxFiles: CODE_GRAPH_MAX_FILES },
|
|
75
|
-
genAtStart: 4,
|
|
76
|
-
now: 123,
|
|
77
|
-
runManifest: async () => [{ rel: 'a.mjs', fp: '1' }],
|
|
78
|
-
computeSignature: () => 'sig',
|
|
79
|
-
deserializeGraph: () => graph,
|
|
80
|
-
getGeneration: () => 4,
|
|
81
|
-
setMemoryCache: (cwd, entry) => { restored = { cwd, entry }; },
|
|
82
|
-
});
|
|
83
|
-
assert.equal(result.graph, graph);
|
|
84
|
-
assert.deepEqual(restored, {
|
|
85
|
-
cwd: '/project',
|
|
86
|
-
entry: { ts: 123, signature: 'sig', graph },
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
test('disk mismatch hands one manifest to the isolated rebuild without restoring stale data', async () => {
|
|
91
|
-
let deserialized = false;
|
|
92
|
-
const manifest = [{ rel: 'changed.mjs', fp: '2' }];
|
|
93
|
-
const result = await _validateDiskCodeGraphHit({
|
|
94
|
-
graphCwd: '/project',
|
|
95
|
-
diskEntry: { signature: 'old', maxFiles: CODE_GRAPH_MAX_FILES },
|
|
96
|
-
genAtStart: 1,
|
|
97
|
-
runManifest: async () => manifest,
|
|
98
|
-
computeSignature: () => 'new',
|
|
99
|
-
deserializeGraph: () => { deserialized = true; },
|
|
100
|
-
});
|
|
101
|
-
assert.equal(result.graph, null);
|
|
102
|
-
assert.equal(result.manifest, manifest);
|
|
103
|
-
assert.equal(result.signature, 'new');
|
|
104
|
-
assert.equal(deserialized, false);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
test('generation change rejects a validated stale disk graph', async () => {
|
|
108
|
-
const result = await _validateDiskCodeGraphHit({
|
|
109
|
-
graphCwd: '/project',
|
|
110
|
-
diskEntry: { signature: 'sig', maxFiles: CODE_GRAPH_MAX_FILES },
|
|
111
|
-
genAtStart: 1,
|
|
112
|
-
runManifest: async () => [],
|
|
113
|
-
computeSignature: () => 'sig',
|
|
114
|
-
deserializeGraph: () => ({ nodes: new Map() }),
|
|
115
|
-
getGeneration: () => 2,
|
|
116
|
-
});
|
|
117
|
-
assert.deepEqual(result, { invalidated: true });
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
function fastProbe(overrides = {}) {
|
|
121
|
-
return { isFastPathEligible: true, maxFiles: CODE_GRAPH_MAX_FILES, bytes: 1, ...overrides };
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
test('validated hit releases its pre-acquired slot exactly once', async () => {
|
|
125
|
-
let releases = 0;
|
|
126
|
-
let workers = 0;
|
|
127
|
-
const result = await _runDiskCodeGraphFastPath({
|
|
128
|
-
graphCwd: '/project',
|
|
129
|
-
diskProbe: fastProbe(),
|
|
130
|
-
genAtStart: 1,
|
|
131
|
-
loadDiskEntry: () => ({ maxFiles: CODE_GRAPH_MAX_FILES }),
|
|
132
|
-
acquireSlot: async () => () => { releases++; },
|
|
133
|
-
validateDiskHit: async () => ({ graph: 'hit' }),
|
|
134
|
-
spawnWorker: () => { workers++; },
|
|
135
|
-
});
|
|
136
|
-
assert.equal(result, 'hit');
|
|
137
|
-
assert.equal(releases, 1);
|
|
138
|
-
assert.equal(workers, 0);
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
test('validation errors release the pre-acquired slot', async () => {
|
|
142
|
-
let releases = 0;
|
|
143
|
-
await assert.rejects(_runDiskCodeGraphFastPath({
|
|
144
|
-
graphCwd: '/project',
|
|
145
|
-
diskProbe: fastProbe(),
|
|
146
|
-
genAtStart: 1,
|
|
147
|
-
loadDiskEntry: () => ({ maxFiles: CODE_GRAPH_MAX_FILES }),
|
|
148
|
-
acquireSlot: async () => () => { releases++; },
|
|
149
|
-
validateDiskHit: async () => { throw new Error('manifest failed'); },
|
|
150
|
-
spawnWorker: () => assert.fail('Worker must not start'),
|
|
151
|
-
}), /manifest failed/);
|
|
152
|
-
assert.equal(releases, 1);
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
test('validated miss hands its slot to Worker exactly once', async () => {
|
|
156
|
-
let releases = 0;
|
|
157
|
-
let receivedRelease = null;
|
|
158
|
-
const result = await _runDiskCodeGraphFastPath({
|
|
159
|
-
graphCwd: '/project',
|
|
160
|
-
diskProbe: fastProbe(),
|
|
161
|
-
genAtStart: 1,
|
|
162
|
-
loadDiskEntry: () => ({ maxFiles: CODE_GRAPH_MAX_FILES }),
|
|
163
|
-
acquireSlot: async () => () => { releases++; },
|
|
164
|
-
validateDiskHit: async () => ({ graph: null, manifest: ['one'], signature: 'new' }),
|
|
165
|
-
spawnWorker: (release, manifest, signature) => {
|
|
166
|
-
receivedRelease = release;
|
|
167
|
-
assert.deepEqual(manifest, ['one']);
|
|
168
|
-
assert.equal(signature, 'new');
|
|
169
|
-
return 'worker-result';
|
|
170
|
-
},
|
|
171
|
-
});
|
|
172
|
-
assert.equal(result, 'worker-result');
|
|
173
|
-
assert.equal(releases, 0);
|
|
174
|
-
receivedRelease();
|
|
175
|
-
assert.equal(releases, 1);
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
test('abort after slot acquisition or validation releases the slot and never starts a Worker', async () => {
|
|
179
|
-
for (const abortAt of ['acquire', 'validate']) {
|
|
180
|
-
const controller = new AbortController();
|
|
181
|
-
let releases = 0;
|
|
182
|
-
let workers = 0;
|
|
183
|
-
await assert.rejects(_runDiskCodeGraphFastPath({
|
|
184
|
-
graphCwd: '/project',
|
|
185
|
-
diskProbe: fastProbe(),
|
|
186
|
-
genAtStart: 1,
|
|
187
|
-
signal: controller.signal,
|
|
188
|
-
loadDiskEntry: () => ({ maxFiles: CODE_GRAPH_MAX_FILES }),
|
|
189
|
-
acquireSlot: async () => {
|
|
190
|
-
if (abortAt === 'acquire') controller.abort();
|
|
191
|
-
return () => { releases++; };
|
|
192
|
-
},
|
|
193
|
-
validateDiskHit: async () => {
|
|
194
|
-
if (abortAt === 'validate') controller.abort();
|
|
195
|
-
return { graph: 'hit' };
|
|
196
|
-
},
|
|
197
|
-
spawnWorker: () => { workers++; },
|
|
198
|
-
}), /aborted/);
|
|
199
|
-
assert.equal(releases, 1, abortAt);
|
|
200
|
-
assert.equal(workers, 0, abortAt);
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
test('oversized or maxFiles-incompatible entries bypass main-thread load and use Worker', async () => {
|
|
205
|
-
for (const probe of [fastProbe({ isFastPathEligible: false }), fastProbe({ maxFiles: null })]) {
|
|
206
|
-
let loaded = 0;
|
|
207
|
-
let acquired = 0;
|
|
208
|
-
const result = await _runDiskCodeGraphFastPath({
|
|
209
|
-
graphCwd: '/project',
|
|
210
|
-
diskProbe: probe,
|
|
211
|
-
genAtStart: 1,
|
|
212
|
-
loadDiskEntry: () => { loaded++; return { maxFiles: CODE_GRAPH_MAX_FILES }; },
|
|
213
|
-
acquireSlot: async () => { acquired++; return () => {}; },
|
|
214
|
-
spawnWorker: (release) => ({ release }),
|
|
215
|
-
});
|
|
216
|
-
assert.deepEqual(result, { release: null });
|
|
217
|
-
assert.equal(loaded, 0);
|
|
218
|
-
assert.equal(acquired, 0);
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
test('persisted entries require matching maxFiles in both cache paths', () => {
|
|
223
|
-
assert.equal(_isCompatibleDiskCodeGraphEntry({ maxFiles: CODE_GRAPH_MAX_FILES }), true);
|
|
224
|
-
assert.equal(_isCompatibleDiskCodeGraphEntry({}), false);
|
|
225
|
-
assert.equal(_isCompatibleDiskCodeGraphEntry({ maxFiles: CODE_GRAPH_MAX_FILES - 1 }), false);
|
|
226
|
-
assert.equal(_serializeGraph({ nodes: new Map() }).maxFiles, CODE_GRAPH_MAX_FILES);
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
test('large legacy cache bypasses parent migration/parser and routes directly to Worker', () => {
|
|
230
|
-
let migrationOrParserCalls = 0;
|
|
231
|
-
let probeCalls = 0;
|
|
232
|
-
const result = _prepareDiskCodeGraphFastPath({
|
|
233
|
-
graphCwd: '/project',
|
|
234
|
-
hasLegacyCache: () => true,
|
|
235
|
-
ensureDiskLoaded: () => { migrationOrParserCalls++; },
|
|
236
|
-
probeDiskEntry: () => { probeCalls++; return assert.fail('legacy probe must not run'); },
|
|
237
|
-
runFastPath: (probe) => ({ probe, route: 'worker' }),
|
|
238
|
-
});
|
|
239
|
-
assert.deepEqual(result, { probe: null, route: 'worker' });
|
|
240
|
-
assert.equal(migrationOrParserCalls, 0);
|
|
241
|
-
assert.equal(probeCalls, 0);
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
test('Worker drains all migrated cache entries before posting success', () => {
|
|
245
|
-
const migratedEntries = new Map([
|
|
246
|
-
['/requested', { signature: 'requested' }],
|
|
247
|
-
['/legacy-project', { signature: 'legacy' }],
|
|
248
|
-
]);
|
|
249
|
-
const events = [];
|
|
250
|
-
_postCodeGraphWorkerSuccess(
|
|
251
|
-
{ signature: 'requested', nodes: new Map() },
|
|
252
|
-
(message) => {
|
|
253
|
-
events.push('post');
|
|
254
|
-
assert.equal(migratedEntries.size, 2);
|
|
255
|
-
assert.equal(message.ok, true);
|
|
256
|
-
},
|
|
257
|
-
() => {
|
|
258
|
-
events.push('drain');
|
|
259
|
-
assert.deepEqual([...migratedEntries.keys()], ['/requested', '/legacy-project']);
|
|
260
|
-
},
|
|
261
|
-
);
|
|
262
|
-
assert.deepEqual(events, ['drain', 'post']);
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
test('cache-disabled scoped Worker posts success without touching disk-cache state', () => {
|
|
266
|
-
const events = [];
|
|
267
|
-
_postCodeGraphWorkerSuccess(
|
|
268
|
-
{ signature: 'scoped', nodes: new Map() },
|
|
269
|
-
(message) => events.push(message.ok ? 'post' : 'bad-post'),
|
|
270
|
-
() => events.push('drain'),
|
|
271
|
-
{ cache: false },
|
|
272
|
-
);
|
|
273
|
-
assert.deepEqual(events, ['post']);
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
test('strict persistence failure prevents Worker success post', () => {
|
|
277
|
-
let posted = false;
|
|
278
|
-
assert.throws(
|
|
279
|
-
() => _postCodeGraphWorkerSuccess(
|
|
280
|
-
{ signature: 'requested' },
|
|
281
|
-
() => { posted = true; },
|
|
282
|
-
() => _persistDiskCodeGraphCacheNow({
|
|
283
|
-
strict: true,
|
|
284
|
-
writeJson: () => { throw new Error('persist failed'); },
|
|
285
|
-
}),
|
|
286
|
-
),
|
|
287
|
-
/persist failed/,
|
|
288
|
-
);
|
|
289
|
-
assert.equal(posted, false);
|
|
290
|
-
});
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import test from 'node:test';
|
|
2
|
-
import assert from 'node:assert/strict';
|
|
3
|
-
import { mkdtemp, mkdir, rm, writeFile } from 'node:fs/promises';
|
|
4
|
-
import { join } from 'node:path';
|
|
5
|
-
import { homedir, tmpdir } from 'node:os';
|
|
6
|
-
import { findCachedGraphBinary } from '../src/runtime/agent/orchestrator/tools/graph-binary-fetcher.mjs';
|
|
7
|
-
|
|
8
|
-
const previousDataDir = process.env.MIXDOG_DATA_DIR;
|
|
9
|
-
const previousGraphBin = process.env.MIXDOG_GRAPH_BIN;
|
|
10
|
-
const ambientDataDir = previousDataDir || join(process.env.MIXDOG_HOME || join(homedir(), '.mixdog'), 'data');
|
|
11
|
-
const ambientGraphBin = findCachedGraphBinary(ambientDataDir);
|
|
12
|
-
const isolatedDataDir = await mkdtemp(join(tmpdir(), 'mixdog-code-graph-dispatch-data-'));
|
|
13
|
-
process.env.MIXDOG_DATA_DIR = isolatedDataDir;
|
|
14
|
-
if (!previousGraphBin && ambientGraphBin) process.env.MIXDOG_GRAPH_BIN = ambientGraphBin;
|
|
15
|
-
|
|
16
|
-
const { executeCodeGraphTool } = await import('../src/runtime/agent/orchestrator/tools/code-graph/dispatch.mjs');
|
|
17
|
-
const { drainCodeGraphCache } = await import('../src/runtime/agent/orchestrator/tools/code-graph/disk-cache.mjs');
|
|
18
|
-
const project = await mkdtemp(join(tmpdir(), 'mixdog-code-graph-dispatch-project-'));
|
|
19
|
-
const sourceDir = join(project, 'src');
|
|
20
|
-
await mkdir(sourceDir);
|
|
21
|
-
await writeFile(join(project, 'package.json'), '{}');
|
|
22
|
-
await writeFile(join(sourceDir, 'one.mjs'), [
|
|
23
|
-
'export function alpha() { return beta(); }',
|
|
24
|
-
'export function beta() { return 2; }',
|
|
25
|
-
'',
|
|
26
|
-
].join('\n'));
|
|
27
|
-
await writeFile(join(sourceDir, 'two.mjs'), [
|
|
28
|
-
"import { alpha } from './one.mjs';",
|
|
29
|
-
'export function gamma() { return alpha(); }',
|
|
30
|
-
'',
|
|
31
|
-
].join('\n'));
|
|
32
|
-
|
|
33
|
-
test.after(async () => {
|
|
34
|
-
drainCodeGraphCache();
|
|
35
|
-
await Promise.all([
|
|
36
|
-
rm(project, { recursive: true, force: true }),
|
|
37
|
-
rm(isolatedDataDir, { recursive: true, force: true }),
|
|
38
|
-
]);
|
|
39
|
-
if (previousDataDir === undefined) delete process.env.MIXDOG_DATA_DIR;
|
|
40
|
-
else process.env.MIXDOG_DATA_DIR = previousDataDir;
|
|
41
|
-
if (previousGraphBin === undefined) delete process.env.MIXDOG_GRAPH_BIN;
|
|
42
|
-
else process.env.MIXDOG_GRAPH_BIN = previousGraphBin;
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
test('dispatch partitions every file and symbol mode by its supported target array', async () => {
|
|
46
|
-
const files = ['src/one.mjs', 'src/two.mjs'];
|
|
47
|
-
const assertNoErrorBody = (mode, result) => {
|
|
48
|
-
assert.doesNotMatch(result, /(?:^|\n)Error:/i, `${mode} returned a caught/error body`);
|
|
49
|
-
};
|
|
50
|
-
const fileModeEvidence = {
|
|
51
|
-
overview: [/file: src\/one\.mjs/, /file: src\/two\.mjs/, /symbols:.*alpha/, /symbols:.*gamma/],
|
|
52
|
-
imports: [/# imports src\/two\.mjs[\s\S]*src\/one\.mjs/],
|
|
53
|
-
dependents: [/# dependents src\/one\.mjs[\s\S]*src\/two\.mjs/],
|
|
54
|
-
related: [/file\tsrc\/one\.mjs/, /file\tsrc\/two\.mjs/, /# related/],
|
|
55
|
-
impact: [/file\tsrc\/one\.mjs/, /file\tsrc\/two\.mjs/, /external_callers\t\d+/],
|
|
56
|
-
symbols: [/function alpha \(L1\)/, /function beta \(L2\)/, /function gamma \(L2\)/],
|
|
57
|
-
};
|
|
58
|
-
for (const mode of ['overview', 'imports', 'dependents', 'related', 'impact', 'symbols']) {
|
|
59
|
-
const result = await executeCodeGraphTool('code_graph', { mode, files }, project);
|
|
60
|
-
assertNoErrorBody(mode, result);
|
|
61
|
-
for (const file of files) assert.match(result, new RegExp(`# ${mode} ${file.replace('.', '\\.')}`));
|
|
62
|
-
for (const evidence of fileModeEvidence[mode]) assert.match(result, evidence);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const exactModeEvidence = {
|
|
66
|
-
find_symbol: [/src\/one\.mjs:1/, /src\/one\.mjs:2/, /# candidates/],
|
|
67
|
-
references: [/src\/two\.mjs:2:\d+\s+export function gamma\(\) \{ return alpha\(\); \}/, /src\/one\.mjs:1:\d+\s+export function alpha\(\) \{ return beta\(\); \}/],
|
|
68
|
-
callers: [/caller=gamma/, /caller=alpha/],
|
|
69
|
-
callees: [/# callees/, /\bbeta\b/, /\(no callees\)/],
|
|
70
|
-
};
|
|
71
|
-
for (const mode of ['find_symbol', 'references', 'callers', 'callees']) {
|
|
72
|
-
const result = await executeCodeGraphTool('code_graph', {
|
|
73
|
-
mode,
|
|
74
|
-
symbols: ['alpha', 'beta'],
|
|
75
|
-
body: false,
|
|
76
|
-
}, project);
|
|
77
|
-
assertNoErrorBody(mode, result);
|
|
78
|
-
assert.match(result, new RegExp(`# ${mode} alpha\\b`));
|
|
79
|
-
assert.match(result, new RegExp(`# ${mode} beta\\b`));
|
|
80
|
-
for (const evidence of exactModeEvidence[mode]) assert.match(result, evidence);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
for (const mode of ['symbol_search', 'search']) {
|
|
84
|
-
const result = await executeCodeGraphTool('code_graph', {
|
|
85
|
-
mode,
|
|
86
|
-
symbols: ['alp', 'bet'],
|
|
87
|
-
body: false,
|
|
88
|
-
}, project);
|
|
89
|
-
const routedMode = mode === 'search' ? 'symbol_search' : mode;
|
|
90
|
-
assertNoErrorBody(mode, result);
|
|
91
|
-
assert.match(result, new RegExp(`# ${routedMode} alp\\b`));
|
|
92
|
-
assert.match(result, new RegExp(`# ${routedMode} bet\\b`));
|
|
93
|
-
assert.match(result, /# search keyword=alp matches=\d+ shown=\d+[\s\S]*\balpha\b/);
|
|
94
|
-
assert.match(result, /# search keyword=bet matches=\d+ shown=\d+[\s\S]*\bbeta\b/);
|
|
95
|
-
}
|
|
96
|
-
});
|