mixdog 0.9.63 → 0.9.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/package.json +9 -2
- package/scripts/code-graph-description-contract.mjs +3 -3
- package/scripts/verify-release-assets.mjs +2 -2
- package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch.mjs +11 -14
- package/src/runtime/agent/orchestrator/agent-runtime/agent-progress-watchdog.mjs +6 -6
- package/src/runtime/agent/orchestrator/agent-runtime/cache-strategy.mjs +2 -2
- package/src/runtime/agent/orchestrator/agent-trace-format.mjs +1 -0
- package/src/runtime/agent/orchestrator/config.mjs +19 -124
- package/src/runtime/agent/orchestrator/context/collect.mjs +6 -6
- package/src/runtime/agent/orchestrator/dispatch-persist.mjs +2 -2
- package/src/runtime/agent/orchestrator/internal-agents.mjs +2 -2
- package/src/runtime/agent/orchestrator/mcp/child-tree.mjs +1 -1
- package/src/runtime/agent/orchestrator/mcp/client.mjs +4 -4
- package/src/runtime/agent/orchestrator/providers/admission-scheduler.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/anthropic-betas.mjs +4 -4
- package/src/runtime/agent/orchestrator/providers/anthropic-effort.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/anthropic-max-tokens.mjs +4 -4
- package/src/runtime/agent/orchestrator/providers/anthropic-messages.mjs +333 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-model-resolve.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-credentials.mjs +4 -4
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/anthropic.mjs +3 -277
- package/src/runtime/agent/orchestrator/providers/codex-client-meta.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/custom-tool-wire.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/gemini-cache.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/gemini-stream.mjs +6 -6
- package/src/runtime/agent/orchestrator/providers/grok-oauth-login.mjs +196 -0
- package/src/runtime/agent/orchestrator/providers/grok-oauth-tokens.mjs +460 -0
- package/src/runtime/agent/orchestrator/providers/grok-oauth.mjs +14 -593
- package/src/runtime/agent/orchestrator/providers/lib/anthropic-request-utils.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/media-normalization.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/openai-compat-wire.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/openai-compat-xai.mjs +4 -4
- package/src/runtime/agent/orchestrator/providers/openai-oauth-ws.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/openai-oauth.mjs +5 -280
- package/src/runtime/agent/orchestrator/providers/openai-responses-payload.mjs +357 -0
- package/src/runtime/agent/orchestrator/providers/openai-ws-headers.mjs +216 -0
- package/src/runtime/agent/orchestrator/providers/openai-ws-pool.mjs +2 -188
- package/src/runtime/agent/orchestrator/providers/openai-ws-stream.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/openai-ws.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/opencode-go.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/provider-catalog-cache.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/registry.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/retry-classifier.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/statusline-route-meta.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/cache/prefetch-cache.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/cache/scoped-cache.mjs +3 -3
- package/src/runtime/agent/orchestrator/session/compact/budget.mjs +2 -2
- package/src/runtime/agent/orchestrator/session/compact/file-reattach.mjs +2 -2
- package/src/runtime/agent/orchestrator/session/compact/summary-schema.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/compact/summary.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/compact/text-utils.mjs +2 -2
- package/src/runtime/agent/orchestrator/session/context-utils.mjs +4 -4
- package/src/runtime/agent/orchestrator/session/loop/deferred-call-through.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/loop/pre-dispatch-deny.mjs +17 -0
- package/src/runtime/agent/orchestrator/session/loop/steering.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/loop/stored-tool-args.mjs +18 -26
- package/src/runtime/agent/orchestrator/session/loop/termination.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/loop/tool-classify.mjs +3 -3
- package/src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs +1 -0
- package/src/runtime/agent/orchestrator/session/manager/context-meta.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/manager/delivered-completions.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/manager/status-telemetry.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/store/live-state.mjs +49 -0
- package/src/runtime/agent/orchestrator/session/store/load-cache.mjs +49 -0
- package/src/runtime/agent/orchestrator/session/store/save-worker.mjs +260 -0
- package/src/runtime/agent/orchestrator/session/store/serialize.mjs +72 -0
- package/src/runtime/agent/orchestrator/session/store/summary-cache.mjs +163 -0
- package/src/runtime/agent/orchestrator/session/store/write-guards.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/store-summary-index.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/store-summary-reader.mjs +4 -1
- package/src/runtime/agent/orchestrator/session/store.mjs +9 -561
- package/src/runtime/agent/orchestrator/session/tool-envelope.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/tool-result-offload.mjs +2 -2
- package/src/runtime/agent/orchestrator/stall-policy.mjs +11 -11
- package/src/runtime/agent/orchestrator/tools/bash-policy-scan.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/bash-session.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/advisory-lock.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/arg-guard.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/atomic-write.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool.mjs +2 -154
- package/src/runtime/agent/orchestrator/tools/builtin/cache-layers.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/cwd-utils.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/fs-reachability.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/fuzzy-match.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/glob-walk.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/path-locks.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/path-utils.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/read-args.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/read-formatting.mjs +2 -3
- package/src/runtime/agent/orchestrator/tools/builtin/read-image-resize.mjs +4 -4
- package/src/runtime/agent/orchestrator/tools/builtin/read-open.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/read-streaming.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/rg-runner.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/search-path-diagnostics.mjs +5 -5
- package/src/runtime/agent/orchestrator/tools/builtin/shell-analysis.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/shell-job-paths.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/shell-job-process.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/shell-job-spawn.mjs +519 -0
- package/src/runtime/agent/orchestrator/tools/builtin/shell-jobs.mjs +5 -449
- package/src/runtime/agent/orchestrator/tools/builtin/snapshot-helpers.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/task-tool.mjs +212 -0
- package/src/runtime/agent/orchestrator/tools/builtin.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/code-graph/build.mjs +1 -7
- package/src/runtime/agent/orchestrator/tools/code-graph/disk-cache.mjs +9 -36
- package/src/runtime/agent/orchestrator/tools/code-graph/dispatch.mjs +15 -3
- package/src/runtime/agent/orchestrator/tools/code-graph/search-references.mjs +429 -0
- package/src/runtime/agent/orchestrator/tools/code-graph/search.mjs +2 -395
- package/src/runtime/agent/orchestrator/tools/code-graph/symbol-index.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/code-graph/text-mask.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/code-graph/trusted-roots.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/code-graph-prewarm-worker.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/code-graph-state.mjs +3 -3
- package/src/runtime/agent/orchestrator/tools/mutation-planner.mjs +5 -5
- package/src/runtime/agent/orchestrator/tools/next-call-utils.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/patch/dispatch.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/patch/matcher.mjs +7 -7
- package/src/runtime/agent/orchestrator/tools/patch/orchestrator.mjs +72 -9
- package/src/runtime/agent/orchestrator/tools/patch/parsing.mjs +4 -4
- package/src/runtime/agent/orchestrator/tools/patch/paths.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/patch/v4a-convert.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/patch-tool-defs.mjs +4 -4
- package/src/runtime/agent/orchestrator/tools/patch.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/result-compression.mjs +3 -3
- package/src/runtime/agent/orchestrator/tools/shell-command.mjs +2 -444
- package/src/runtime/agent/orchestrator/tools/shell-exec-output.mjs +505 -0
- package/src/runtime/agent/orchestrator/tools/shell-exec-policy.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/shell-snapshot.mjs +1 -1
- package/src/runtime/channels/lib/backend-dispatch.mjs +20 -5
- package/src/runtime/channels/lib/scheduler.mjs +1 -1
- package/src/runtime/channels/lib/telegram-format.mjs +1 -1
- package/src/runtime/channels/lib/voice-runtime-fetcher.mjs +4 -4
- package/src/runtime/channels/tool-defs.mjs +2 -3
- package/src/runtime/memory/index.mjs +1 -5
- package/src/runtime/memory/lib/core-memory-candidates.mjs +357 -0
- package/src/runtime/memory/lib/core-memory-store.mjs +7 -357
- package/src/runtime/memory/lib/cycle-signatures.mjs +1 -1
- package/src/runtime/memory/lib/embedding-model-config.mjs +1 -1
- package/src/runtime/memory/lib/embedding-provider.mjs +1 -5
- package/src/runtime/memory/lib/embedding-worker.mjs +1 -5
- package/src/runtime/memory/lib/ko-morph.mjs +2 -2
- package/src/runtime/memory/lib/memory-config-flags.mjs +2 -5
- package/src/runtime/memory/lib/memory-cycle-requests.mjs +3 -7
- package/src/runtime/memory/lib/memory-cycle1.mjs +4 -8
- package/src/runtime/memory/lib/memory-cycle2-gate.mjs +1 -1
- package/src/runtime/memory/lib/memory-cycle2-mutations.mjs +1 -1
- package/src/runtime/memory/lib/memory-cycle2-shared.mjs +2 -5
- package/src/runtime/memory/lib/memory-cycle3.mjs +1 -5
- package/src/runtime/memory/lib/memory-embed.mjs +2 -6
- package/src/runtime/memory/lib/memory-log.mjs +8 -0
- package/src/runtime/memory/lib/memory-ops-policy.mjs +4 -8
- package/src/runtime/memory/lib/memory-recall-scope-filter.mjs +1 -1
- package/src/runtime/memory/lib/memory-recall-store.mjs +2 -193
- package/src/runtime/memory/lib/memory-score.mjs +1 -1
- package/src/runtime/memory/lib/memory-text-utils.mjs +2 -2
- package/src/runtime/memory/lib/memory.mjs +2 -6
- package/src/runtime/memory/lib/pg/adapter.mjs +2 -6
- package/src/runtime/memory/lib/pg/process.mjs +1 -5
- package/src/runtime/memory/lib/pg/supervisor.mjs +1 -5
- package/src/runtime/memory/lib/recall-format.mjs +2 -2
- package/src/runtime/memory/lib/recall-scoring.mjs +195 -0
- package/src/runtime/memory/lib/runtime-fetcher.mjs +1 -5
- package/src/runtime/memory/lib/trace-store.mjs +2 -6
- package/src/runtime/search/lib/http-fetch.mjs +6 -6
- package/src/runtime/search/lib/web-tools.mjs +2 -2
- package/src/runtime/shared/buffered-appender.mjs +1 -1
- package/src/runtime/shared/child-guardian.mjs +1 -1
- package/src/runtime/shared/child-spawn-gate.mjs +1 -1
- package/src/runtime/shared/config.mjs +4 -4
- package/src/runtime/shared/launcher-control.mjs +9 -10
- package/src/runtime/shared/llm/index.mjs +5 -20
- package/src/runtime/shared/markdown-frontmatter.mjs +1 -1
- package/src/runtime/shared/memory-snapshot.mjs +4 -4
- package/src/runtime/shared/pristine-execution.mjs +1 -1
- package/src/runtime/shared/process-lifecycle.mjs +0 -1
- package/src/runtime/shared/process-shutdown.mjs +1 -1
- package/src/runtime/shared/resource-admission.mjs +2 -2
- package/src/runtime/shared/schedule-session-run.mjs +1 -1
- package/src/runtime/shared/schedules-db.mjs +1 -1
- package/src/runtime/shared/service-discovery.mjs +2 -2
- package/src/runtime/shared/staged-update.mjs +6 -6
- package/src/runtime/shared/tool-execution-contract.mjs +1 -1
- package/src/runtime/shared/tool-primitives.mjs +1 -1
- package/src/runtime/shared/tool-surface.mjs +2 -2
- package/src/runtime/shared/update-checker.mjs +1 -1
- package/src/runtime/shared/user-cwd.mjs +3 -3
- package/src/runtime/shared/user-data-guard.mjs +4 -4
- package/src/runtime/shared/workspace-router.mjs +5 -5
- package/src/session-runtime/config-helpers.mjs +2 -3
- package/src/session-runtime/config-lifecycle.mjs +1 -1
- package/src/session-runtime/hitch-profile.mjs +1 -1
- package/src/session-runtime/lifecycle-api.mjs +6 -4
- package/src/session-runtime/model-recency.mjs +5 -5
- package/src/session-runtime/plugin-mcp.mjs +1 -1
- package/src/session-runtime/provider-request-snapshot.mjs +338 -0
- package/src/session-runtime/session-text.mjs +4 -4
- package/src/session-runtime/tool-catalog-schema.mjs +197 -0
- package/src/session-runtime/tool-catalog.mjs +6 -483
- package/src/session-runtime/tool-defs.mjs +1 -1
- package/src/standalone/agent-task-status.mjs +1 -1
- package/src/standalone/agent-tool/helpers.mjs +2 -2
- package/src/standalone/channel-admin.mjs +4 -4
- package/src/standalone/explore-tool.mjs +3 -3
- package/src/standalone/hook-bus/config.mjs +1 -1
- package/src/standalone/hook-bus/constants.mjs +1 -1
- package/src/standalone/hook-bus/rules.mjs +1 -1
- package/src/standalone/projects.mjs +1 -1
- package/src/standalone/provider-admin.mjs +2 -2
- package/src/tui/app/app-format.mjs +2 -2
- package/src/tui/app/clipboard.mjs +3 -3
- package/src/tui/app/input-parsers.mjs +1 -1
- package/src/tui/app/text-layout.mjs +1 -1
- package/src/tui/app/transcript-row-estimate.mjs +360 -0
- package/src/tui/app/transcript-window.mjs +5 -347
- package/src/tui/app/use-mouse-input.mjs +1 -1
- package/src/tui/app/use-prompt-handlers.mjs +1 -1
- package/src/tui/components/tool-execution/surface-detail.mjs +9 -9
- package/src/tui/components/tool-execution/text-format.mjs +2 -2
- package/src/tui/components/tool-output-format.mjs +7 -7
- package/src/tui/display-width.mjs +4 -4
- package/src/tui/dist/index.mjs +63 -97
- package/src/tui/engine/agent-envelope.mjs +5 -5
- package/src/tui/engine/notification-plan.mjs +1 -1
- package/src/tui/engine/queue-helpers.mjs +3 -3
- package/src/tui/engine/render-timing.mjs +4 -5
- package/src/tui/engine/session-api-ext.mjs +3 -3
- package/src/tui/engine/tool-result-status.mjs +5 -5
- package/src/tui/engine/tool-result-text.mjs +1 -1
- package/src/tui/engine/transcript-spill.mjs +585 -0
- package/src/tui/engine/tui-steering-persist.mjs +1 -1
- package/src/tui/engine.mjs +2 -474
- package/src/tui/lib/voice-setup.mjs +1 -1
- package/src/tui/markdown/format-token.mjs +1 -1
- package/src/tui/markdown/render-ansi.mjs +1 -1
- package/src/tui/markdown/table-layout.mjs +4 -4
- package/src/tui/paste-attachments.mjs +1 -1
- package/src/tui/prompt-history-store.mjs +3 -3
- package/src/tui/statusline-ansi-bridge.mjs +2 -2
- package/src/tui/theme.mjs +1 -1
- package/src/tui/transcript-tool-failures.mjs +2 -2
- package/src/ui/ansi.mjs +0 -9
- package/src/ui/statusline-format.mjs +2 -4
- package/scripts/_bench-cwc.json +0 -20
- package/scripts/_jitter-fuzz.jsx +0 -42
- package/scripts/_jitter-fuzz2.jsx +0 -30
- package/scripts/_jitter-probe.jsx +0 -35
- package/scripts/_jp2.jsx +0 -16
- package/scripts/_smoke_wd.mjs +0 -7
- package/scripts/abort-recovery-test.mjs +0 -175
- package/scripts/agent-dispatch-abort-compose-test.mjs +0 -31
- package/scripts/agent-live-arg-guard-smoke.mjs +0 -20
- package/scripts/agent-live-path-suffix-smoke.mjs +0 -34
- package/scripts/agent-live-toolcall-args-smoke.mjs +0 -45
- package/scripts/agent-loop-policy-test.mjs +0 -37
- package/scripts/agent-model-liveness-test.mjs +0 -763
- package/scripts/agent-parallel-smoke.mjs +0 -435
- package/scripts/agent-route-batch-test.mjs +0 -40
- package/scripts/agent-tag-reuse-smoke.mjs +0 -441
- package/scripts/agent-terminal-reap-test.mjs +0 -252
- package/scripts/agent-trace-io-test.mjs +0 -133
- package/scripts/ansi-color-capability-test.mjs +0 -90
- package/scripts/anthropic-admission-retry-integration-test.mjs +0 -119
- package/scripts/anthropic-maxtokens-test.mjs +0 -119
- package/scripts/anthropic-oauth-refresh-race-test.mjs +0 -397
- package/scripts/anthropic-transport-policy-test.mjs +0 -726
- package/scripts/apply-patch-edit-smoke.mjs +0 -71
- package/scripts/arg-guard-test.mjs +0 -93
- package/scripts/async-notify-settlement-test.mjs +0 -99
- package/scripts/atomic-lock-tryonce-test.mjs +0 -125
- package/scripts/background-task-meta-smoke.mjs +0 -38
- package/scripts/bench-run.mjs +0 -508
- package/scripts/boot-smoke.mjs +0 -137
- package/scripts/build-runtime-windows.ps1 +0 -242
- package/scripts/channel-daemon-smoke.mjs +0 -1103
- package/scripts/code-graph-aggregate-cwd-test.mjs +0 -158
- package/scripts/code-graph-disk-hit-test.mjs +0 -290
- package/scripts/code-graph-dispatch-test.mjs +0 -96
- package/scripts/code-graph-root-federation-test.mjs +0 -273
- package/scripts/compact-active-turn-test.mjs +0 -68
- package/scripts/compact-file-reattach-test.mjs +0 -88
- package/scripts/compact-pressure-test.mjs +0 -788
- package/scripts/compact-prior-context-flatten-test.mjs +0 -252
- package/scripts/compact-recall-digest-test.mjs +0 -57
- package/scripts/compact-smoke.mjs +0 -1017
- package/scripts/compact-trigger-migration-smoke.mjs +0 -261
- package/scripts/compacted-placeholder-scrub-test.mjs +0 -63
- package/scripts/context-mcp-metering-test.mjs +0 -1406
- package/scripts/debounced-skills-async-save-test.mjs +0 -57
- package/scripts/deferred-tool-loading-test.mjs +0 -250
- package/scripts/desktop-session-bridge-test.mjs +0 -1013
- package/scripts/dispatch-persist-recovery-test.mjs +0 -141
- package/scripts/embedding-worker-exit-test.mjs +0 -76
- package/scripts/execution-completion-dedup-test.mjs +0 -205
- package/scripts/execution-pending-resume-kick-test.mjs +0 -151
- package/scripts/execution-resume-esc-integration-test.mjs +0 -176
- package/scripts/explore-bench-tmp.mjs +0 -36
- package/scripts/explore-bench.mjs +0 -248
- package/scripts/explore-prompt-policy-test.mjs +0 -256
- package/scripts/explore-timeout-cancel-test.mjs +0 -345
- package/scripts/find-fuzzy-hidden-test.mjs +0 -267
- package/scripts/forwarder-rebind-tail-test.mjs +0 -67
- package/scripts/freevar-smoke.mjs +0 -98
- package/scripts/gemini-provider-test.mjs +0 -1448
- package/scripts/generate-oc-icons.mjs +0 -11
- package/scripts/grok-oauth-refresh-race-test.mjs +0 -273
- package/scripts/headless-pristine-execution-test.mjs +0 -614
- package/scripts/hook-bus-test.mjs +0 -552
- package/scripts/ingest-pure-conversation-smoke.mjs +0 -175
- package/scripts/internal-comms-bench-test.mjs +0 -226
- package/scripts/internal-comms-bench.mjs +0 -853
- package/scripts/internal-comms-smoke.mjs +0 -277
- package/scripts/internal-tools-normalization-test.mjs +0 -62
- package/scripts/interrupted-turn-history-test.mjs +0 -399
- package/scripts/lead-workflow-smoke.mjs +0 -592
- package/scripts/lifecycle-api-test.mjs +0 -137
- package/scripts/live-share-test.mjs +0 -148
- package/scripts/live-worker-smoke.mjs +0 -333
- package/scripts/log-writer-guard-smoke.mjs +0 -131
- package/scripts/maintenance-default-routes-test.mjs +0 -164
- package/scripts/max-output-recovery-persist-test.mjs +0 -81
- package/scripts/max-output-recovery-test.mjs +0 -368
- package/scripts/mcp-client-normalization-test.mjs +0 -45
- package/scripts/mcp-grace-deferred-test.mjs +0 -225
- package/scripts/memory-core-input-test.mjs +0 -167
- package/scripts/memory-cycle-routing-test.mjs +0 -111
- package/scripts/memory-meta-concurrency-test.mjs +0 -20
- package/scripts/memory-pg-recovery-test.mjs +0 -59
- package/scripts/memory-rule-contract-test.mjs +0 -93
- package/scripts/model-list-sanitize-test.mjs +0 -37
- package/scripts/mouse-tracking-restore-smoke.mjs +0 -107
- package/scripts/native-edit-wire-test.mjs +0 -152
- package/scripts/notify-completion-mirror-test.mjs +0 -73
- package/scripts/openai-oauth-refresh-race-test.mjs +0 -120
- package/scripts/openai-oauth-ws-1006-retry-test.mjs +0 -954
- package/scripts/openai-ws-early-settle-test.mjs +0 -216
- package/scripts/output-style-bench.mjs +0 -292
- package/scripts/output-style-smoke.mjs +0 -145
- package/scripts/parent-abort-link-test.mjs +0 -90
- package/scripts/patch-binary-cache-test.mjs +0 -181
- package/scripts/path-suffix-test.mjs +0 -57
- package/scripts/pending-completion-drop-test.mjs +0 -239
- package/scripts/pending-messages-lock-nonblocking-test.mjs +0 -62
- package/scripts/pretool-ask-runtime-test.mjs +0 -54
- package/scripts/process-lifecycle-test.mjs +0 -461
- package/scripts/prompt-immediate-render-test.mjs +0 -89
- package/scripts/prompt-input-parity-test.mjs +0 -145
- package/scripts/provider-admission-scheduler-test.mjs +0 -681
- package/scripts/provider-contract-test.mjs +0 -632
- package/scripts/provider-stream-stall-test.mjs +0 -276
- package/scripts/provider-toolcall-test.mjs +0 -3063
- package/scripts/reactive-compact-persist-smoke.mjs +0 -203
- package/scripts/recall-bench.mjs +0 -359
- package/scripts/resource-admission-test.mjs +0 -792
- package/scripts/result-classification-test.mjs +0 -75
- package/scripts/rg-runner-test.mjs +0 -240
- package/scripts/routing-corpus-test.mjs +0 -349
- package/scripts/sanitize-tool-pairs-test.mjs +0 -260
- package/scripts/session-bench-cache-break-test.mjs +0 -102
- package/scripts/session-bench.mjs +0 -1708
- package/scripts/session-context-bench.mjs +0 -344
- package/scripts/session-heartbeat-lifecycle-test.mjs +0 -68
- package/scripts/session-ingest-compaction-smoke.mjs +0 -279
- package/scripts/session-ingest-smoke.mjs +0 -177
- package/scripts/session-orphan-sweep-test.mjs +0 -109
- package/scripts/set-effort-config-test.mjs +0 -41
- package/scripts/shell-failure-diagnostics-test.mjs +0 -280
- package/scripts/shell-hardening-test.mjs +0 -209
- package/scripts/shell-jobs-windows-hide-test.mjs +0 -164
- package/scripts/ship-mode-test.mjs +0 -98
- package/scripts/smoke-loop-failure-summary-test.mjs +0 -38
- package/scripts/smoke-loop-failure-summary.mjs +0 -16
- package/scripts/smoke-loop-report.mjs +0 -221
- package/scripts/smoke-loop.mjs +0 -202
- package/scripts/smoke-runtime-negative.ps1 +0 -106
- package/scripts/statusline-quota-hysteresis-test.mjs +0 -62
- package/scripts/steering-drain-buckets-test.mjs +0 -467
- package/scripts/steering-fold-provenance-test.mjs +0 -71
- package/scripts/streaming-tail-window-test.mjs +0 -175
- package/scripts/submit-commandbusy-race-test.mjs +0 -257
- package/scripts/task-bench.mjs +0 -205
- package/scripts/terminal-bench-isolation-guards-test.mjs +0 -102
- package/scripts/termio-input-smoke.mjs +0 -199
- package/scripts/tool-result-hook-test.mjs +0 -48
- package/scripts/tool-smoke.mjs +0 -2453
- package/scripts/tool-tui-presentation-test.mjs +0 -286
- package/scripts/toolcall-args-test.mjs +0 -239
- package/scripts/tui-ambiguous-width-test.mjs +0 -113
- package/scripts/tui-background-failure-smoke.mjs +0 -73
- package/scripts/tui-perf-run.ps1 +0 -26
- package/scripts/tui-render-smoke.mjs +0 -90
- package/scripts/tui-runtime-load-bench-entry.jsx +0 -608
- package/scripts/tui-runtime-load-bench.mjs +0 -50
- package/scripts/tui-store-frame-batch-test.mjs +0 -99
- package/scripts/tui-transcript-jitter-harness-entry.jsx +0 -383
- package/scripts/tui-transcript-perf-test.mjs +0 -934
- package/scripts/usage-metrics-epoch-smoke.mjs +0 -114
- package/scripts/verify-release-assets-test.mjs +0 -281
- package/scripts/web-fetch-routing-test.mjs +0 -158
- package/scripts/webhook-smoke.mjs +0 -201
- package/scripts/windows-hide-spawn-options-test.mjs +0 -19
- package/scripts/worker-notify-rejection-test.mjs +0 -51
- package/scripts/write-backpressure-test.mjs +0 -147
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import test from 'node:test';
|
|
3
|
-
import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from 'node:fs';
|
|
4
|
-
import { tmpdir } from 'node:os';
|
|
5
|
-
import { join } from 'node:path';
|
|
6
|
-
import { fuzzyRank } from '../src/runtime/agent/orchestrator/tools/builtin/fuzzy-match.mjs';
|
|
7
|
-
import { executeFuzzyFindTool } from '../src/runtime/agent/orchestrator/tools/builtin/list-tool.mjs';
|
|
8
|
-
import { runRg } from '../src/runtime/agent/orchestrator/tools/builtin/rg-runner.mjs';
|
|
9
|
-
|
|
10
|
-
// ── fuzzyRank score floor ────────────────────────────────────────────────
|
|
11
|
-
|
|
12
|
-
test('fuzzyRank keeps an exact basename/substring hit and drops scattered noise', () => {
|
|
13
|
-
const items = [
|
|
14
|
-
{ path: '.mixdog/data/tool-events.log' },
|
|
15
|
-
// subsequence-only junk: the query chars appear in order but scattered
|
|
16
|
-
// mid-word across dirs, no contiguity or word boundaries.
|
|
17
|
-
{ path: 'pgadmin/xtx/oxoxl/exvxexnxtx/sxlxoxg/records.dat' },
|
|
18
|
-
];
|
|
19
|
-
const ranked = fuzzyRank('tool-events.log', items);
|
|
20
|
-
assert.ok(ranked.length >= 1, 'the real file must survive the floor');
|
|
21
|
-
assert.equal(ranked[0].item.path, '.mixdog/data/tool-events.log');
|
|
22
|
-
assert.ok(
|
|
23
|
-
!ranked.some((r) => r.item.path.startsWith('pgadmin/')),
|
|
24
|
-
'scattered subsequence junk must be filtered out',
|
|
25
|
-
);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
test('fuzzyRank floor drops a purely scattered subsequence but keeps a substring', () => {
|
|
29
|
-
const strong = { path: 'src/abcdef.txt' };
|
|
30
|
-
const junk = { path: 'xax/xbxcx/xdxexfx/z.bin' };
|
|
31
|
-
const ranked = fuzzyRank('abcdef', [strong, junk]);
|
|
32
|
-
assert.deepEqual(ranked.map((r) => r.item.path), ['src/abcdef.txt']);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
// Frozen copy of the pre-optimization scorer: this must not call production
|
|
36
|
-
// fuzzy helpers, so rank parity also detects scoring regressions.
|
|
37
|
-
function legacyFuzzyScore(query, str) {
|
|
38
|
-
if (!query) return 0;
|
|
39
|
-
const normalizedQuery = String(query).replace(/[\/\\_.\-\s]+/g, '');
|
|
40
|
-
if (!normalizedQuery) return 0;
|
|
41
|
-
const q = normalizedQuery.toLowerCase();
|
|
42
|
-
const s = str.toLowerCase();
|
|
43
|
-
const qlen = q.length;
|
|
44
|
-
const slen = s.length;
|
|
45
|
-
if (qlen === 0) return 0;
|
|
46
|
-
if (qlen > slen) return null;
|
|
47
|
-
|
|
48
|
-
const lastSep = Math.max(str.lastIndexOf('/'), str.lastIndexOf('\\'));
|
|
49
|
-
let score = 0;
|
|
50
|
-
let si = 0;
|
|
51
|
-
let prevMatch = -2;
|
|
52
|
-
let firstMatchIdx = -1;
|
|
53
|
-
for (let qi = 0; qi < qlen; qi++) {
|
|
54
|
-
const qc = q[qi];
|
|
55
|
-
let found = -1;
|
|
56
|
-
for (let k = si; k < slen; k++) {
|
|
57
|
-
if (s[k] === qc) { found = k; break; }
|
|
58
|
-
}
|
|
59
|
-
if (found === -1) return null;
|
|
60
|
-
if (firstMatchIdx === -1) firstMatchIdx = found;
|
|
61
|
-
score += 1;
|
|
62
|
-
if (found === prevMatch + 1) score += 5;
|
|
63
|
-
const prevCh = found > 0 ? str[found - 1] : undefined;
|
|
64
|
-
if (prevCh === undefined
|
|
65
|
-
|| prevCh === '/' || prevCh === '\\' || prevCh === '_' || prevCh === '-'
|
|
66
|
-
|| prevCh === '.' || prevCh === ' '
|
|
67
|
-
|| (/[a-z0-9]/.test(prevCh) && /[A-Z]/.test(str[found]))) {
|
|
68
|
-
score += 8;
|
|
69
|
-
}
|
|
70
|
-
if (str[found] === normalizedQuery[qi]) score += 1;
|
|
71
|
-
prevMatch = found;
|
|
72
|
-
si = found + 1;
|
|
73
|
-
}
|
|
74
|
-
if (firstMatchIdx > lastSep) score += 10;
|
|
75
|
-
score -= Math.floor(slen / 16);
|
|
76
|
-
score -= Math.floor(firstMatchIdx / 8);
|
|
77
|
-
return score;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function referenceFuzzyRank(query, items, limit = 0) {
|
|
81
|
-
const normQuery = String(query || '').toLowerCase().replace(/[\/\\_.\-\s]+/g, '');
|
|
82
|
-
const floor = normQuery.length * 4;
|
|
83
|
-
const scored = [];
|
|
84
|
-
for (const item of items) {
|
|
85
|
-
const p = String(item.path || '');
|
|
86
|
-
const pathScore = legacyFuzzyScore(query, p);
|
|
87
|
-
const base = p.split(/[\\/]/).pop() || '';
|
|
88
|
-
const baseScore = legacyFuzzyScore(query, base);
|
|
89
|
-
const score = Math.max(pathScore ?? -Infinity, baseScore === null ? -Infinity : baseScore + 40);
|
|
90
|
-
if (!Number.isFinite(score)) continue;
|
|
91
|
-
const strong = normQuery.length > 0
|
|
92
|
-
&& (String(base || '').toLowerCase().replace(/[\/\\_.\-\s]+/g, '').includes(normQuery)
|
|
93
|
-
|| String(p || '').toLowerCase().replace(/[\/\\_.\-\s]+/g, '').includes(normQuery));
|
|
94
|
-
if (!strong && score < floor) continue;
|
|
95
|
-
scored.push({ item, score });
|
|
96
|
-
}
|
|
97
|
-
scored.sort((a, b) => (b.score - a.score)
|
|
98
|
-
|| (a.item.path < b.item.path ? -1 : a.item.path > b.item.path ? 1 : 0));
|
|
99
|
-
return limit > 0 ? scored.slice(0, limit) : scored;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
test('fuzzyRank exactly matches the frozen legacy full-sort reference ranker', () => {
|
|
103
|
-
const fragments = ['alpha', 'Beta', 'tool-events', 'src', 'x_y', 'log', 'camelCase', 'archive'];
|
|
104
|
-
const items = Array.from({ length: 1200 }, (_, i) => ({
|
|
105
|
-
path: i % 97 === 0
|
|
106
|
-
? 'duplicate/tool-events.log'
|
|
107
|
-
: `${fragments[i % fragments.length]}/${fragments[(i * 7) % fragments.length]}-${i}.mjs`,
|
|
108
|
-
}));
|
|
109
|
-
for (const query of ['', 'tool', 'ToolEvents', 'a_b', 'camel']) {
|
|
110
|
-
for (const limit of [-5, 0, 0.5, 1, 2, 25, 300, 2000]) {
|
|
111
|
-
const expected = referenceFuzzyRank(query, items, limit);
|
|
112
|
-
const actual = fuzzyRank(query, items, limit);
|
|
113
|
-
assert.deepEqual(
|
|
114
|
-
actual.map(({ item, score }) => ({ index: items.findIndex((candidate) => candidate === item), score })),
|
|
115
|
-
expected.map(({ item, score }) => ({ index: items.findIndex((candidate) => candidate === item), score })),
|
|
116
|
-
`query=${JSON.stringify(query)}, limit=${limit}`,
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
// ── hidden-directory discovery via the find tool ─────────────────────────
|
|
123
|
-
|
|
124
|
-
function makeRepo() {
|
|
125
|
-
const root = mkdtempSync(join(tmpdir(), 'mixdog-find-hidden-'));
|
|
126
|
-
mkdirSync(join(root, '.mixdog', 'data'), { recursive: true });
|
|
127
|
-
writeFileSync(join(root, '.mixdog', 'data', 'tool-events.log'), 'x\n');
|
|
128
|
-
mkdirSync(join(root, 'src'), { recursive: true });
|
|
129
|
-
writeFileSync(join(root, 'src', 'unrelated.txt'), 'x\n');
|
|
130
|
-
// .git noise must stay pruned even with hidden default true.
|
|
131
|
-
mkdirSync(join(root, '.git'), { recursive: true });
|
|
132
|
-
writeFileSync(join(root, '.git', 'tool-events.log'), 'x\n');
|
|
133
|
-
return root;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
test('find surfaces a file under a dot-directory top-ranked (hidden default true)', async () => {
|
|
137
|
-
const root = makeRepo();
|
|
138
|
-
try {
|
|
139
|
-
const out = await executeFuzzyFindTool({ query: 'tool-events.log' }, root);
|
|
140
|
-
const lines = out.split('\n').filter(Boolean);
|
|
141
|
-
assert.ok(lines.length >= 1, `expected a hit, got: ${out}`);
|
|
142
|
-
assert.equal(lines[0], '.mixdog/data/tool-events.log');
|
|
143
|
-
assert.ok(!out.includes('.git/'), '.git must stay pruned as noise');
|
|
144
|
-
} finally {
|
|
145
|
-
rmSync(root, { recursive: true, force: true });
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
test('find hidden:false skips dot-directories', async () => {
|
|
150
|
-
const root = makeRepo();
|
|
151
|
-
try {
|
|
152
|
-
const out = await executeFuzzyFindTool({ query: 'tool-events.log', hidden: false }, root);
|
|
153
|
-
assert.ok(!out.includes('.mixdog'), `hidden:false must not descend dot-dirs: ${out}`);
|
|
154
|
-
} finally {
|
|
155
|
-
rmSync(root, { recursive: true, force: true });
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
test('find respects .gitignore on the common path, then deterministically falls back for an exact ignored filename', async () => {
|
|
160
|
-
const root = mkdtempSync(join(tmpdir(), 'mixdog-find-gitignore-'));
|
|
161
|
-
try {
|
|
162
|
-
writeFileSync(join(root, '.gitignore'), 'ignored-tree/\n');
|
|
163
|
-
mkdirSync(join(root, 'src'), { recursive: true });
|
|
164
|
-
mkdirSync(join(root, 'ignored-tree'), { recursive: true });
|
|
165
|
-
writeFileSync(join(root, 'src', 'common-visible.mjs'), 'x\n');
|
|
166
|
-
writeFileSync(join(root, 'ignored-tree', 'common-ignored.mjs'), 'x\n');
|
|
167
|
-
writeFileSync(join(root, 'src', 'needle-target.mjs.bak'), 'x\n');
|
|
168
|
-
writeFileSync(join(root, 'ignored-tree', 'needle-target.mjs'), 'x\n');
|
|
169
|
-
writeFileSync(join(root, 'ignored-tree', 'LICENSE'), 'x\n');
|
|
170
|
-
writeFileSync(join(root, 'ignored-tree', '[slug].tsx'), 'x\n');
|
|
171
|
-
writeFileSync(join(root, 'ignored-tree', 'my file.txt'), 'x\n');
|
|
172
|
-
|
|
173
|
-
const common = await executeFuzzyFindTool({ query: 'common-visible.mjs', head_limit: 1 }, root);
|
|
174
|
-
assert.ok(common.includes('src/common-visible.mjs'), `common path must keep visible files: ${common}`);
|
|
175
|
-
assert.ok(!common.includes('ignored-tree/common-ignored.mjs'), `common path must skip .gitignored trees: ${common}`);
|
|
176
|
-
assert.ok(common.includes('[gitignored trees not searched; retry with include_noise:true]'), `filled common path must disclose skipped trees: ${common}`);
|
|
177
|
-
|
|
178
|
-
const exact = await executeFuzzyFindTool({ query: 'needle-target.mjs' }, root);
|
|
179
|
-
assert.ok(exact.includes('src/needle-target.mjs.bak'), `visible fuzzy decoy must remain in pass one: ${exact}`);
|
|
180
|
-
assert.ok(exact.includes('ignored-tree/needle-target.mjs'), `exact ignored filename must trigger fallback: ${exact}`);
|
|
181
|
-
assert.ok(!exact.includes('[gitignored trees not searched'), `fallback result must not claim ignored trees were skipped: ${exact}`);
|
|
182
|
-
|
|
183
|
-
const extensionless = await executeFuzzyFindTool({ query: 'LICENSE' }, root);
|
|
184
|
-
assert.ok(extensionless.includes('ignored-tree/LICENSE'), `extensionless exact filename must trigger fallback: ${extensionless}`);
|
|
185
|
-
const literalGlob = await executeFuzzyFindTool({ query: '[slug].tsx' }, root);
|
|
186
|
-
assert.ok(literalGlob.includes('ignored-tree/[slug].tsx'), `literal-glob exact filename must trigger fallback: ${literalGlob}`);
|
|
187
|
-
const spaced = await executeFuzzyFindTool({ query: 'my file.txt' }, root);
|
|
188
|
-
assert.ok(spaced.includes('ignored-tree/my file.txt'), `space-containing exact filename must trigger fallback: ${spaced}`);
|
|
189
|
-
} finally {
|
|
190
|
-
rmSync(root, { recursive: true, force: true });
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
// ── narrowed-pass merge / dedup backstop ─────────────────────────────────
|
|
195
|
-
|
|
196
|
-
test('exact-name hit survives among many decoys and is not duplicated', async () => {
|
|
197
|
-
const root = mkdtempSync(join(tmpdir(), 'mixdog-find-merge-'));
|
|
198
|
-
try {
|
|
199
|
-
// A deep exact-name target plus a pile of unrelated decoys. The target
|
|
200
|
-
// matches both the broad enumeration and the query-narrowed pass, so it
|
|
201
|
-
// exercises the merge+dedup path.
|
|
202
|
-
mkdirSync(join(root, 'deep', 'nested', 'here'), { recursive: true });
|
|
203
|
-
writeFileSync(join(root, 'deep', 'nested', 'here', 'tool-events.log'), 'x\n');
|
|
204
|
-
mkdirSync(join(root, 'noise'), { recursive: true });
|
|
205
|
-
for (let i = 0; i < 200; i++) {
|
|
206
|
-
writeFileSync(join(root, 'noise', `decoy-${i}.bin`), 'x\n');
|
|
207
|
-
}
|
|
208
|
-
const out = await executeFuzzyFindTool({ query: 'tool-events.log' }, root);
|
|
209
|
-
const lines = out.split('\n').filter(Boolean);
|
|
210
|
-
assert.equal(lines[0], 'deep/nested/here/tool-events.log');
|
|
211
|
-
const hits = lines.filter((l) => l === 'deep/nested/here/tool-events.log');
|
|
212
|
-
assert.equal(hits.length, 1, `merge must dedup, got ${hits.length}: ${out}`);
|
|
213
|
-
} finally {
|
|
214
|
-
rmSync(root, { recursive: true, force: true });
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
// ── truncation warning surfaces when the broad pass reports .truncated ────
|
|
219
|
-
|
|
220
|
-
test('truncated broad enumeration emits a visible warning, still ranks the exact hit, and is not cached', async () => {
|
|
221
|
-
const root = makeRepo();
|
|
222
|
-
try {
|
|
223
|
-
// Test-only seam: wrap the real runRg so the BROAD pass (the one without
|
|
224
|
-
// `--iglob`) reports truncation via the boxed-String contract the tool
|
|
225
|
-
// relies on (.truncated=true), while the narrowed pass is left intact.
|
|
226
|
-
// Production options never carry __runRg, so the real path is unchanged.
|
|
227
|
-
const truncatingRunRg = async (argsList, execOptions) => {
|
|
228
|
-
const out = await runRg(argsList, execOptions);
|
|
229
|
-
if (argsList.includes('--iglob')) return out; // narrowed backstop unchanged
|
|
230
|
-
const boxed = new String(String(out));
|
|
231
|
-
boxed.truncated = true;
|
|
232
|
-
return boxed;
|
|
233
|
-
};
|
|
234
|
-
const out = await executeFuzzyFindTool(
|
|
235
|
-
{ query: 'tool-events.log' }, root, { __runRg: truncatingRunRg },
|
|
236
|
-
);
|
|
237
|
-
assert.ok(out.includes('[warning]'), `truncated broad pass must warn: ${out}`);
|
|
238
|
-
assert.ok(out.includes('truncated at 20MB cap'), `warning text must surface: ${out}`);
|
|
239
|
-
const lines = out.split('\n').filter(Boolean);
|
|
240
|
-
assert.equal(lines[0], '.mixdog/data/tool-events.log', 'exact hit must still rank first');
|
|
241
|
-
// Not cached: a normal follow-up run (no injected truncation) must NOT
|
|
242
|
-
// return the warning — proving the truncated result was never cached.
|
|
243
|
-
const out2 = await executeFuzzyFindTool({ query: 'tool-events.log' }, root);
|
|
244
|
-
assert.ok(!out2.includes('[warning]'), `truncated result must not be cached/served: ${out2}`);
|
|
245
|
-
} finally {
|
|
246
|
-
rmSync(root, { recursive: true, force: true });
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
// ── narrowed backstop treats the query as a literal (glob metachars) ──────
|
|
251
|
-
|
|
252
|
-
test('a query with glob metachars still gets the narrowed backstop', async () => {
|
|
253
|
-
const root = mkdtempSync(join(tmpdir(), 'mixdog-find-glob-'));
|
|
254
|
-
try {
|
|
255
|
-
// "[slug].tsx" contains a character-class metachar; a raw *[slug].tsx*
|
|
256
|
-
// iglob would match one of s/l/u/g, not the literal filename. The tool
|
|
257
|
-
// must escape it so the exact-name file is still surfaced.
|
|
258
|
-
mkdirSync(join(root, 'app'), { recursive: true });
|
|
259
|
-
writeFileSync(join(root, 'app', '[slug].tsx'), 'x\n');
|
|
260
|
-
writeFileSync(join(root, 'app', 'slug.tsx'), 'x\n'); // class-match decoy
|
|
261
|
-
const out = await executeFuzzyFindTool({ query: '[slug].tsx' }, root);
|
|
262
|
-
const lines = out.split('\n').filter(Boolean);
|
|
263
|
-
assert.ok(lines.includes('app/[slug].tsx'), `literal metachar hit must surface: ${out}`);
|
|
264
|
-
} finally {
|
|
265
|
-
rmSync(root, { recursive: true, force: true });
|
|
266
|
-
}
|
|
267
|
-
});
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
// Regression: on channel connect/change/rebind, OutputForwarder.setContext must
|
|
2
|
-
// NOT pull the read cursor back to a prior/unrelated transcript's tail. Only a
|
|
3
|
-
// genuinely-unsynced tail of the SAME transcript (crash recovery) is recovered;
|
|
4
|
-
// a fresh binding to a DIFFERENT transcript stays at EOF so only outputs created
|
|
5
|
-
// after the new binding are forwarded (never the old tail).
|
|
6
|
-
import test from 'node:test';
|
|
7
|
-
import assert from 'node:assert/strict';
|
|
8
|
-
import { mkdtempSync, rmSync, writeFileSync, statSync } from 'node:fs';
|
|
9
|
-
import { tmpdir } from 'node:os';
|
|
10
|
-
import { join } from 'node:path';
|
|
11
|
-
import { OutputForwarder } from '../src/runtime/channels/lib/output-forwarder.mjs';
|
|
12
|
-
|
|
13
|
-
function jsonl(...entries) {
|
|
14
|
-
return entries.map((e) => JSON.stringify(e)).join('\n') + '\n';
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const USER = { type: 'user', message: { content: [{ type: 'text', text: 'hi' }] } };
|
|
18
|
-
const ASSISTANT = { type: 'assistant', message: { content: [{ type: 'text', text: 'old reply tail' }] } };
|
|
19
|
-
|
|
20
|
-
function makeForwarder(persisted) {
|
|
21
|
-
// statusState stub: setContext only reads via this.statusState.read().
|
|
22
|
-
return new OutputForwarder(() => {}, { read: () => persisted });
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
test('rebind to a DIFFERENT transcript never recovers the old tail (cursor stays at EOF)', () => {
|
|
26
|
-
const dir = mkdtempSync(join(tmpdir(), 'fwd-rebind-'));
|
|
27
|
-
try {
|
|
28
|
-
const bound = join(dir, 'new-session.jsonl');
|
|
29
|
-
const prior = join(dir, 'prior-session.jsonl');
|
|
30
|
-
writeFileSync(bound, jsonl(USER, ASSISTANT));
|
|
31
|
-
const size = statSync(bound).size;
|
|
32
|
-
// Persisted status points at a DIFFERENT (prior) transcript, no send evidence.
|
|
33
|
-
const fwd = makeForwarder({
|
|
34
|
-
transcriptPath: prior,
|
|
35
|
-
lastFileSize: 0,
|
|
36
|
-
sentCount: 0,
|
|
37
|
-
lastSentTime: 0,
|
|
38
|
-
lastSentHash: '',
|
|
39
|
-
});
|
|
40
|
-
fwd.setContext('chan-1', bound, { catchUpFromPersisted: true, recoverUnsyncedTail: true });
|
|
41
|
-
assert.equal(fwd.lastFileSize, size, 'cursor must be at EOF — old tail of a fresh binding is not forwarded');
|
|
42
|
-
assert.equal(fwd.readFileSize, size);
|
|
43
|
-
} finally {
|
|
44
|
-
rmSync(dir, { recursive: true, force: true });
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
test('SAME-transcript unsynced tail (no send evidence) is still recovered', () => {
|
|
49
|
-
const dir = mkdtempSync(join(tmpdir(), 'fwd-same-'));
|
|
50
|
-
try {
|
|
51
|
-
const bound = join(dir, 'session.jsonl');
|
|
52
|
-
writeFileSync(bound, jsonl(USER, ASSISTANT));
|
|
53
|
-
const size = statSync(bound).size;
|
|
54
|
-
// Persisted status is the SAME transcript, fully synced size, no send evidence.
|
|
55
|
-
const fwd = makeForwarder({
|
|
56
|
-
transcriptPath: bound,
|
|
57
|
-
lastFileSize: size,
|
|
58
|
-
sentCount: 0,
|
|
59
|
-
lastSentTime: 0,
|
|
60
|
-
lastSentHash: '',
|
|
61
|
-
});
|
|
62
|
-
fwd.setContext('chan-1', bound, { catchUpFromPersisted: true, recoverUnsyncedTail: true });
|
|
63
|
-
assert.ok(fwd.lastFileSize < size, 'same-session unsynced tail must be recovered (cursor before EOF)');
|
|
64
|
-
} finally {
|
|
65
|
-
rmSync(dir, { recursive: true, force: true });
|
|
66
|
-
}
|
|
67
|
-
});
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* scripts/freevar-smoke.mjs — undeclared-identifier gate for runtime source.
|
|
4
|
-
*
|
|
5
|
-
* Same engine as tui-render-smoke.mjs (acorn + eslint-scope) but pointed at
|
|
6
|
-
* the plain-ESM runtime sources instead of the TUI bundle. Any reference that
|
|
7
|
-
* resolves to no binding and is not a known Node global is a guaranteed
|
|
8
|
-
* ReferenceError on that code path — exactly the class of bug that section
|
|
9
|
-
* extractions leave behind on cold paths (missed import, orphaned helper).
|
|
10
|
-
*
|
|
11
|
-
* Run: node scripts/freevar-smoke.mjs (or `npm run smoke:freevars`)
|
|
12
|
-
* Exit: 0 = clean, 1 = undeclared identifiers found / parse failure.
|
|
13
|
-
*/
|
|
14
|
-
import { readFileSync, readdirSync, statSync } from 'node:fs';
|
|
15
|
-
import { dirname, join, relative } from 'node:path';
|
|
16
|
-
import { fileURLToPath } from 'node:url';
|
|
17
|
-
import { parse } from 'acorn';
|
|
18
|
-
import { analyze } from 'eslint-scope';
|
|
19
|
-
|
|
20
|
-
const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');
|
|
21
|
-
// Plain .mjs source roots. src/tui is covered by smoke:tui on the BUILT
|
|
22
|
-
// bundle (App.jsx is JSX — acorn can't parse it raw); vendor is third-party.
|
|
23
|
-
const SCAN_ROOTS = ['src/runtime', 'src/session-runtime', 'src/standalone', 'src/shared', 'scripts'].map(p => join(ROOT, p));
|
|
24
|
-
const ROOT_RUNTIME_FACADES = readdirSync(join(ROOT, 'src'), { withFileTypes: true })
|
|
25
|
-
.filter(entry => entry.isFile() && entry.name.endsWith('.mjs'))
|
|
26
|
-
.map(entry => join(ROOT, 'src', entry.name));
|
|
27
|
-
const SKIP_DIRS = new Set(['node_modules', 'dist', 'vendor', '.git']);
|
|
28
|
-
|
|
29
|
-
const KNOWN_GLOBALS = new Set([
|
|
30
|
-
'Array', 'ArrayBuffer', 'Atomics', 'BigInt', 'BigInt64Array', 'BigUint64Array', 'Boolean',
|
|
31
|
-
'DataView', 'Date', 'Error', 'EvalError', 'FinalizationRegistry', 'Float32Array',
|
|
32
|
-
'Float64Array', 'Function', 'Infinity', 'Int8Array', 'Int16Array', 'Int32Array',
|
|
33
|
-
'Intl', 'JSON', 'Map', 'Math', 'NaN', 'Number', 'Object', 'Promise', 'Proxy',
|
|
34
|
-
'RangeError', 'ReferenceError', 'Reflect', 'RegExp', 'Set', 'SharedArrayBuffer',
|
|
35
|
-
'String', 'Symbol', 'SyntaxError', 'TypeError', 'URIError', 'Uint8Array',
|
|
36
|
-
'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', 'WeakRef', 'WeakSet',
|
|
37
|
-
'decodeURI', 'decodeURIComponent', 'encodeURI', 'encodeURIComponent', 'eval',
|
|
38
|
-
'globalThis', 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'undefined',
|
|
39
|
-
'AbortController', 'AbortSignal', 'Blob', 'Buffer', 'ByteLengthQueuingStrategy',
|
|
40
|
-
'CompressionStream', 'CountQueuingStrategy', 'Crypto', 'CryptoKey', 'CustomEvent',
|
|
41
|
-
'DecompressionStream', 'Event', 'EventTarget', 'File', 'FormData', 'Headers',
|
|
42
|
-
'MessageChannel', 'MessageEvent', 'MessagePort', 'Navigator', 'PerformanceEntry',
|
|
43
|
-
'PerformanceObserver', 'ReadableStream', 'ReadableStreamDefaultReader', 'Request',
|
|
44
|
-
'Response', 'SubtleCrypto', 'TextDecoder', 'TextDecoderStream', 'TextEncoder',
|
|
45
|
-
'TextEncoderStream', 'TransformStream', 'URL', 'URLSearchParams', 'WebAssembly',
|
|
46
|
-
'WebSocket', 'WritableStream', 'atob', 'btoa', 'clearImmediate', 'clearInterval',
|
|
47
|
-
'clearTimeout', 'console', 'crypto', 'fetch', 'navigator', 'performance',
|
|
48
|
-
'process', 'queueMicrotask', 'require', 'setImmediate', 'setInterval',
|
|
49
|
-
'setTimeout', 'structuredClone', 'reportError',
|
|
50
|
-
// Browser globals: legal inside puppeteer page.evaluate() callbacks, which
|
|
51
|
-
// execute in the BROWSER context (web-tools.mjs scrapers).
|
|
52
|
-
'document', 'window',
|
|
53
|
-
]);
|
|
54
|
-
|
|
55
|
-
function* walk(dir) {
|
|
56
|
-
for (const name of readdirSync(dir)) {
|
|
57
|
-
if (SKIP_DIRS.has(name)) continue;
|
|
58
|
-
const p = join(dir, name);
|
|
59
|
-
const st = statSync(p);
|
|
60
|
-
if (st.isDirectory()) yield* walk(p);
|
|
61
|
-
else if (name.endsWith('.mjs')) yield p;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
let failures = 0;
|
|
66
|
-
let scanned = 0;
|
|
67
|
-
for (const root of [...SCAN_ROOTS, ...ROOT_RUNTIME_FACADES]) {
|
|
68
|
-
let files;
|
|
69
|
-
try { files = statSync(root).isDirectory() ? [...walk(root)] : [root]; } catch { continue; }
|
|
70
|
-
for (const file of files) {
|
|
71
|
-
scanned++;
|
|
72
|
-
const source = readFileSync(file, 'utf8');
|
|
73
|
-
let ast;
|
|
74
|
-
try {
|
|
75
|
-
ast = parse(source, { ecmaVersion: 'latest', sourceType: 'module', locations: true, ranges: true });
|
|
76
|
-
} catch (err) {
|
|
77
|
-
failures++;
|
|
78
|
-
console.error(`freevar-smoke: PARSE FAIL ${relative(ROOT, file)}: ${err.message}`);
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
const scopeManager = analyze(ast, { ecmaVersion: 2022, sourceType: 'module' });
|
|
82
|
-
const seen = new Set();
|
|
83
|
-
for (const ref of scopeManager.globalScope.through) {
|
|
84
|
-
const { name } = ref.identifier;
|
|
85
|
-
if (KNOWN_GLOBALS.has(name) || seen.has(name)) continue;
|
|
86
|
-
seen.add(name);
|
|
87
|
-
failures++;
|
|
88
|
-
const loc = ref.identifier.loc?.start;
|
|
89
|
-
console.error(`freevar-smoke: FAIL ${relative(ROOT, file)}:${loc ? `${loc.line}:${loc.column}` : '?'} — undeclared identifier \`${name}\``);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (failures > 0) {
|
|
95
|
-
console.error(`freevar-smoke: ${failures} problem(s) across ${scanned} files — these are ReferenceErrors waiting on their code path.`);
|
|
96
|
-
process.exit(1);
|
|
97
|
-
}
|
|
98
|
-
console.log(`freevar-smoke: ok — ${scanned} files, no undeclared identifiers`);
|