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,137 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import { mkdtempSync, rmSync } from 'node:fs';
|
|
3
|
-
import { tmpdir } from 'node:os';
|
|
4
|
-
import { join } from 'node:path';
|
|
5
|
-
import test from 'node:test';
|
|
6
|
-
|
|
7
|
-
import { createConfigLifecycle } from '../src/session-runtime/config-lifecycle.mjs';
|
|
8
|
-
import { createLifecycleApi } from '../src/session-runtime/lifecycle-api.mjs';
|
|
9
|
-
import {
|
|
10
|
-
_clearWebSocketPoolForTest,
|
|
11
|
-
_seedWebSocketEntryForTest,
|
|
12
|
-
closeOpenaiWsPoolForSession,
|
|
13
|
-
} from '../src/runtime/agent/orchestrator/providers/openai-ws-pool.mjs';
|
|
14
|
-
|
|
15
|
-
function socket() {
|
|
16
|
-
return {
|
|
17
|
-
closed: [],
|
|
18
|
-
close(_code, reason) {
|
|
19
|
-
this.closed.push(reason);
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function lifecycleFor(session, overrides = {}) {
|
|
25
|
-
let current = session;
|
|
26
|
-
return createLifecycleApi({
|
|
27
|
-
getSession: () => current,
|
|
28
|
-
setSession: (value) => { current = value; },
|
|
29
|
-
getRoute: () => ({}),
|
|
30
|
-
setRoute: () => {},
|
|
31
|
-
getConfig: () => ({}),
|
|
32
|
-
getMode: () => 'full',
|
|
33
|
-
getCurrentCwd: () => '/test',
|
|
34
|
-
setCloseRequested: () => {},
|
|
35
|
-
getMemoryModPromise: () => null,
|
|
36
|
-
setMemoryModPromise: () => {},
|
|
37
|
-
setSessionNeedsCwdRefresh: () => {},
|
|
38
|
-
hooks: { dispatch: () => {}, flushRules: () => {} },
|
|
39
|
-
hookCommonPayload: (payload) => payload,
|
|
40
|
-
mgr: {
|
|
41
|
-
closeSession: (id, reason) => {
|
|
42
|
-
closeOpenaiWsPoolForSession(id, `session-close:${reason}`);
|
|
43
|
-
return true;
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
statusRoutes: { clearGatewaySessionRoute: () => {} },
|
|
47
|
-
channels: { stop: () => null },
|
|
48
|
-
agentTool: { closeAll: () => {} },
|
|
49
|
-
mcpClient: { disconnectAll: () => null },
|
|
50
|
-
warmupTimers: {},
|
|
51
|
-
prewarmTimers: {},
|
|
52
|
-
flushAllConfigSavesAsync: async () => {},
|
|
53
|
-
withTeardownDeadline: (promise) => promise,
|
|
54
|
-
closePatchRuntimeIfLoaded: () => null,
|
|
55
|
-
invalidateContextStatusCache: () => {},
|
|
56
|
-
invalidatePreSessionToolSurface: () => {},
|
|
57
|
-
notificationListeners: { clear: () => {} },
|
|
58
|
-
remoteStateListeners: { clear: () => {} },
|
|
59
|
-
...overrides,
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
test('lifecycle drains the OpenAI WS pool only for process exit', async () => {
|
|
64
|
-
_clearWebSocketPoolForTest();
|
|
65
|
-
globalThis.__mixdogOpenaiWsRuntimeLoaded = true;
|
|
66
|
-
const replacementSocket = socket();
|
|
67
|
-
const retainedSocket = socket();
|
|
68
|
-
_seedWebSocketEntryForTest({ poolKey: 'replacement', auth: {}, cacheKey: '', entry: { socket: replacementSocket } });
|
|
69
|
-
_seedWebSocketEntryForTest({ poolKey: 'retained', auth: {}, cacheKey: '', entry: { socket: retainedSocket } });
|
|
70
|
-
|
|
71
|
-
await lifecycleFor({ id: 'replacement', messages: [], liveTurnMessages: [] }).close('engine-replace');
|
|
72
|
-
|
|
73
|
-
assert.deepEqual(replacementSocket.closed, ['session-close:engine-replace']);
|
|
74
|
-
assert.deepEqual(retainedSocket.closed, []);
|
|
75
|
-
|
|
76
|
-
await lifecycleFor({ id: 'exit-session', messages: [], liveTurnMessages: [] }).close('cli-exit');
|
|
77
|
-
|
|
78
|
-
assert.deepEqual(retainedSocket.closed, ['cli-exit']);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
test('lifecycle barrier drains a direct updateSectionAsync with no queued lifecycle save', async () => {
|
|
82
|
-
const dataDir = mkdtempSync(join(tmpdir(), 'mixdog-lifecycle-config-'));
|
|
83
|
-
const previousDataDir = process.env.MIXDOG_DATA_DIR;
|
|
84
|
-
const previousBackupRoot = process.env.MIXDOG_USER_DATA_BACKUP_ROOT;
|
|
85
|
-
process.env.MIXDOG_DATA_DIR = dataDir;
|
|
86
|
-
process.env.MIXDOG_USER_DATA_BACKUP_ROOT = join(dataDir, 'backups');
|
|
87
|
-
const sharedCfgMod = await import(`../src/runtime/shared/config.mjs?lifecycle-tail=${Date.now()}`);
|
|
88
|
-
const configLifecycle = createConfigLifecycle({
|
|
89
|
-
getConfig: () => ({}),
|
|
90
|
-
setConfig: () => {},
|
|
91
|
-
getSearchRoute: () => null,
|
|
92
|
-
setSearchRoute: () => {},
|
|
93
|
-
getConfigHasSecrets: () => false,
|
|
94
|
-
setConfigHasSecrets: () => {},
|
|
95
|
-
getRoute: () => ({}),
|
|
96
|
-
cfgMod: {
|
|
97
|
-
saveConfigAsync: async () => {},
|
|
98
|
-
patchSkillsDisabledAsync: async () => {},
|
|
99
|
-
getPluginData: () => dataDir,
|
|
100
|
-
},
|
|
101
|
-
sharedCfgMod,
|
|
102
|
-
setBackendAsync: async () => {},
|
|
103
|
-
setConfiguredShell: () => {},
|
|
104
|
-
normalizeSystemShellConfig: () => ({ command: '' }),
|
|
105
|
-
normalizeSearchRouteConfig: () => null,
|
|
106
|
-
outputStyleStatus: () => ({}),
|
|
107
|
-
LAZY_SECRET_PROVIDERS: new Set(),
|
|
108
|
-
clean: (value) => String(value || ''),
|
|
109
|
-
resolve: (value) => value,
|
|
110
|
-
STANDALONE_DATA_DIR: dataDir,
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
const events = [];
|
|
114
|
-
let directSettled = false;
|
|
115
|
-
try {
|
|
116
|
-
const directWrite = sharedCfgMod.updateSectionAsync('cycle3', () => ({ value: 'direct' }))
|
|
117
|
-
.finally(() => { directSettled = true; events.push('direct:settled'); });
|
|
118
|
-
assert.equal(directSettled, false);
|
|
119
|
-
|
|
120
|
-
const lifecycle = lifecycleFor(
|
|
121
|
-
{ id: 'tail-drain', messages: [], liveTurnMessages: [] },
|
|
122
|
-
{
|
|
123
|
-
flushAllConfigSavesAsync: configLifecycle.flushAllConfigSavesAsync,
|
|
124
|
-
closePatchRuntimeIfLoaded: async () => { events.push('teardown:continued'); },
|
|
125
|
-
},
|
|
126
|
-
);
|
|
127
|
-
await lifecycle.close('engine-replace');
|
|
128
|
-
await directWrite;
|
|
129
|
-
assert.deepEqual(events, ['direct:settled', 'teardown:continued']);
|
|
130
|
-
} finally {
|
|
131
|
-
if (previousDataDir == null) delete process.env.MIXDOG_DATA_DIR;
|
|
132
|
-
else process.env.MIXDOG_DATA_DIR = previousDataDir;
|
|
133
|
-
if (previousBackupRoot == null) delete process.env.MIXDOG_USER_DATA_BACKUP_ROOT;
|
|
134
|
-
else process.env.MIXDOG_USER_DATA_BACKUP_ROOT = previousBackupRoot;
|
|
135
|
-
rmSync(dataDir, { recursive: true, force: true });
|
|
136
|
-
}
|
|
137
|
-
});
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
// Integration test for src/tui/engine/live-share.mjs: a real owner pipe
|
|
2
|
-
// server and viewer client exchange full/delta/tail frames and submits over
|
|
3
|
-
// the platform transport (named pipe / unix socket).
|
|
4
|
-
import test from 'node:test';
|
|
5
|
-
import assert from 'node:assert/strict';
|
|
6
|
-
import { tmpdir } from 'node:os';
|
|
7
|
-
import { join } from 'node:path';
|
|
8
|
-
import { createLiveShare } from '../src/tui/engine/live-share.mjs';
|
|
9
|
-
|
|
10
|
-
const PIPE_ID = `livetest_${process.pid}_${Date.now()}`;
|
|
11
|
-
const pipePath = process.platform === 'win32'
|
|
12
|
-
? `\\\\.\\pipe\\mixdog-live-${PIPE_ID}`
|
|
13
|
-
: join(tmpdir(), `mixdog-live-${PIPE_ID}.sock`);
|
|
14
|
-
|
|
15
|
-
function waitFor(check, label, timeoutMs = 4000) {
|
|
16
|
-
return new Promise((resolvePromise, rejectPromise) => {
|
|
17
|
-
const startedAt = Date.now();
|
|
18
|
-
const tick = () => {
|
|
19
|
-
let result = false;
|
|
20
|
-
try { result = check(); } catch { result = false; }
|
|
21
|
-
if (result) return resolvePromise(result);
|
|
22
|
-
if (Date.now() - startedAt > timeoutMs) {
|
|
23
|
-
return rejectPromise(new Error(`timeout waiting for ${label}`));
|
|
24
|
-
}
|
|
25
|
-
setTimeout(tick, 20);
|
|
26
|
-
};
|
|
27
|
-
tick();
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function createViewerStore() {
|
|
32
|
-
const store = {
|
|
33
|
-
items: [{ id: 'disk-only', kind: 'user', text: 'persisted last user message' }],
|
|
34
|
-
streamingTail: null,
|
|
35
|
-
spinner: null,
|
|
36
|
-
};
|
|
37
|
-
return {
|
|
38
|
-
store,
|
|
39
|
-
apply: {
|
|
40
|
-
getState: () => store,
|
|
41
|
-
set: (patch) => Object.assign(store, patch),
|
|
42
|
-
replaceItems: (items) => { store.items = [...items]; },
|
|
43
|
-
patchItem: (id, patch) => {
|
|
44
|
-
const index = store.items.findIndex((item) => item?.id === id);
|
|
45
|
-
if (index < 0) return false;
|
|
46
|
-
store.items[index] = { ...store.items[index], ...patch };
|
|
47
|
-
return true;
|
|
48
|
-
},
|
|
49
|
-
appendItems: (items) => { store.items = [...store.items, ...items]; },
|
|
50
|
-
updateStreamingTail: (id, patch) => {
|
|
51
|
-
const current = store.streamingTail?.id === id ? store.streamingTail : { id, text: '' };
|
|
52
|
-
store.streamingTail = { ...current, ...patch, id };
|
|
53
|
-
},
|
|
54
|
-
clearStreamingTail: () => { store.streamingTail = null; },
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
test('live-share mirrors owner deltas and routes viewer submits', async () => {
|
|
60
|
-
const listeners = new Set();
|
|
61
|
-
let ownerState = {
|
|
62
|
-
items: [{ id: 'a1', kind: 'assistant', text: 'hello' }],
|
|
63
|
-
streamingTail: null,
|
|
64
|
-
spinner: null,
|
|
65
|
-
};
|
|
66
|
-
const receivedSubmits = [];
|
|
67
|
-
const owner = createLiveShare({
|
|
68
|
-
ownerSessionId: () => PIPE_ID,
|
|
69
|
-
viewerSessionId: () => '',
|
|
70
|
-
socketPathFor: () => pipePath,
|
|
71
|
-
getPublishedState: () => ownerState,
|
|
72
|
-
listeners,
|
|
73
|
-
onRemoteSubmit: (text) => receivedSubmits.push(text),
|
|
74
|
-
onOwnerClosed: () => {},
|
|
75
|
-
viewerApply: null,
|
|
76
|
-
});
|
|
77
|
-
const publish = (next) => {
|
|
78
|
-
ownerState = next;
|
|
79
|
-
for (const listener of listeners) listener();
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const viewer = createViewerStore();
|
|
83
|
-
let ownerClosedCount = 0;
|
|
84
|
-
const viewerShare = createLiveShare({
|
|
85
|
-
ownerSessionId: () => '',
|
|
86
|
-
viewerSessionId: () => PIPE_ID,
|
|
87
|
-
socketPathFor: () => pipePath,
|
|
88
|
-
getPublishedState: () => ({ items: [], streamingTail: null, spinner: null }),
|
|
89
|
-
listeners: new Set(),
|
|
90
|
-
onRemoteSubmit: () => {},
|
|
91
|
-
onOwnerClosed: () => { ownerClosedCount += 1; },
|
|
92
|
-
viewerApply: viewer.apply,
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
try {
|
|
96
|
-
owner.ensure();
|
|
97
|
-
const initialSync = viewerShare.waitForViewerSync(PIPE_ID, 1_000);
|
|
98
|
-
await waitFor(() => {
|
|
99
|
-
viewerShare.ensure();
|
|
100
|
-
return viewerShare.viewerConnected();
|
|
101
|
-
}, 'viewer connect');
|
|
102
|
-
// Initial full frame mirrors the owner transcript.
|
|
103
|
-
assert.equal(await initialSync, true);
|
|
104
|
-
await waitFor(() => viewer.store.items.length === 1
|
|
105
|
-
&& viewer.store.items[0].id === 'a1', 'initial full frame');
|
|
106
|
-
assert.equal(viewer.store.items.some((item) => item.id === 'disk-only'), false,
|
|
107
|
-
'the initial sync barrier must replace the incomplete persisted transcript');
|
|
108
|
-
|
|
109
|
-
// Appended item + streaming tail start.
|
|
110
|
-
publish({
|
|
111
|
-
...ownerState,
|
|
112
|
-
items: [...ownerState.items, { id: 'u1', kind: 'user', text: 'hi from owner side' }],
|
|
113
|
-
streamingTail: { kind: 'assistant', id: 't1', text: 'stream', streaming: true },
|
|
114
|
-
spinner: { active: true, mode: 'responding' },
|
|
115
|
-
});
|
|
116
|
-
await waitFor(() => viewer.store.items.length === 2
|
|
117
|
-
&& viewer.store.streamingTail?.text === 'stream'
|
|
118
|
-
&& viewer.store.spinner?.active === true, 'append + tail frame');
|
|
119
|
-
|
|
120
|
-
// Append-only tail growth rides the suffix protocol.
|
|
121
|
-
publish({
|
|
122
|
-
...ownerState,
|
|
123
|
-
streamingTail: { kind: 'assistant', id: 't1', text: 'streaming more', streaming: true },
|
|
124
|
-
});
|
|
125
|
-
await waitFor(() => viewer.store.streamingTail?.text === 'streaming more', 'tail suffix frame');
|
|
126
|
-
|
|
127
|
-
// Patched item (owner edited an existing row) arrives as a change.
|
|
128
|
-
publish({
|
|
129
|
-
...ownerState,
|
|
130
|
-
items: [{ ...ownerState.items[0], text: 'hello edited' }, ownerState.items[1]],
|
|
131
|
-
streamingTail: null,
|
|
132
|
-
});
|
|
133
|
-
await waitFor(() => viewer.store.items[0].text === 'hello edited'
|
|
134
|
-
&& viewer.store.streamingTail === null, 'patch + tail clear frame');
|
|
135
|
-
|
|
136
|
-
// Viewer submit reaches the owner queue.
|
|
137
|
-
assert.equal(viewerShare.sendSubmit('typed on viewer'), true);
|
|
138
|
-
await waitFor(() => receivedSubmits.length === 1, 'viewer submit');
|
|
139
|
-
assert.equal(receivedSubmits[0], 'typed on viewer');
|
|
140
|
-
|
|
141
|
-
// Owner shutdown notifies the viewer promotion path.
|
|
142
|
-
owner.dispose();
|
|
143
|
-
await waitFor(() => ownerClosedCount === 1, 'owner close notification');
|
|
144
|
-
} finally {
|
|
145
|
-
owner.dispose();
|
|
146
|
-
viewerShare.dispose();
|
|
147
|
-
}
|
|
148
|
-
});
|
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { mkdtempSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
import { tmpdir } from 'node:os';
|
|
5
|
-
import { AGENT_TOOL, createStandaloneAgent } from '../src/standalone/agent-tool.mjs';
|
|
6
|
-
import { executePatchTool } from '../src/runtime/agent/orchestrator/tools/patch.mjs';
|
|
7
|
-
import { executeBuiltinTool } from '../src/runtime/agent/orchestrator/tools/builtin.mjs';
|
|
8
|
-
import { initProviders } from '../src/runtime/agent/orchestrator/providers/registry.mjs';
|
|
9
|
-
import {
|
|
10
|
-
closeSession,
|
|
11
|
-
enqueuePendingMessage,
|
|
12
|
-
getSession,
|
|
13
|
-
getSessionLastProgressAt,
|
|
14
|
-
getSessionRuntime,
|
|
15
|
-
listSessions,
|
|
16
|
-
} from '../src/runtime/agent/orchestrator/session/manager.mjs';
|
|
17
|
-
|
|
18
|
-
const root = mkdtempSync(join(tmpdir(), 'mixdog-live-worker-'));
|
|
19
|
-
const dataDir = join(root, '.mixdog-data');
|
|
20
|
-
let activeAsks = 0;
|
|
21
|
-
let maxActiveAsks = 0;
|
|
22
|
-
let releaseBusyGate = null;
|
|
23
|
-
let busySafetyTimer = null;
|
|
24
|
-
let agentRunner = null;
|
|
25
|
-
let runnerClosed = false;
|
|
26
|
-
|
|
27
|
-
function assert(condition, message) {
|
|
28
|
-
if (!condition) throw new Error(message);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function sleep(ms) {
|
|
32
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function waitForBusyRelease() {
|
|
36
|
-
return new Promise((resolve) => {
|
|
37
|
-
const release = () => {
|
|
38
|
-
if (busySafetyTimer) clearTimeout(busySafetyTimer);
|
|
39
|
-
busySafetyTimer = null;
|
|
40
|
-
if (releaseBusyGate === release) releaseBusyGate = null;
|
|
41
|
-
resolve();
|
|
42
|
-
};
|
|
43
|
-
releaseBusyGate = release;
|
|
44
|
-
busySafetyTimer = setTimeout(release, 10_000);
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function releaseBusyWorker() {
|
|
49
|
-
const release = releaseBusyGate;
|
|
50
|
-
releaseBusyGate = null;
|
|
51
|
-
if (busySafetyTimer) clearTimeout(busySafetyTimer);
|
|
52
|
-
busySafetyTimer = null;
|
|
53
|
-
release?.();
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function closeAgentRunner() {
|
|
57
|
-
if (!agentRunner || runnerClosed) return;
|
|
58
|
-
runnerClosed = true;
|
|
59
|
-
agentRunner.closeAll('live-worker-smoke-end');
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function taskId(text) {
|
|
63
|
-
return String(text).match(/agent task: (\S+)/)?.[1] || null;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
async function main() {
|
|
67
|
-
const leadToolRules = readFileSync('src/rules/lead/lead-tool.md', 'utf8');
|
|
68
|
-
const workflowRules = readFileSync('src/workflows/default/WORKFLOW.md', 'utf8');
|
|
69
|
-
const soloRules = readFileSync('src/workflows/solo/WORKFLOW.md', 'utf8');
|
|
70
|
-
const compact = (text) => text.toLowerCase().replace(/\s+/g, ' ');
|
|
71
|
-
const hasAll = (text, ...terms) => terms.every((term) => text.includes(term));
|
|
72
|
-
const lead = compact(leadToolRules);
|
|
73
|
-
const workflow = compact(workflowRules);
|
|
74
|
-
const solo = compact(soloRules);
|
|
75
|
-
const reviewSkipViolation = (text) => compact(text)
|
|
76
|
-
.split(/[.!?]\s+|;|,\s+(?=(?:but|however|yet)\b)/)
|
|
77
|
-
.some((clause) => {
|
|
78
|
-
const hasReview = /\b(review|reviewer|verification)\b/.test(clause);
|
|
79
|
-
const hasSkip = /\b(skip|skipping|skipped|skippable|omit|omits|omitting|omitted)\b/.test(clause) ||
|
|
80
|
-
/\bwithout\s+(?:any\s+)?(?:a\s+)?(?:review|reviewer|verification)\b/.test(clause);
|
|
81
|
-
const weakRequirement = /\b(?:optional|unnecessary|not required|need not)\b/.test(clause);
|
|
82
|
-
const negated = /\b(?:never|(?:must|shall|may)\s+not|can(?:not|'t)|do\s+not|don't|not)\b[^;]{0,40}\b(?:skip|skipping|skipped|skippable|omit|omitting|omitted)\b/.test(clause) ||
|
|
83
|
-
/\b(?:skip|skipping|skipped|skippable|omit|omitting|omitted)\b[^;]{0,40}\b(?:not allowed|forbidden|prohibited)\b/.test(clause) ||
|
|
84
|
-
/\b(?:never|(?:must|shall|may)\s+not|can(?:not|'t)|do\s+not|don't|not)\b[^;]{0,40}\bwithout\s+(?:any\s+)?(?:a\s+)?(?:review|reviewer|verification)\b/.test(clause);
|
|
85
|
-
const negatedWeakRequirement = /\b(?:not|never)\s+(?:optional|unnecessary)\b/.test(clause);
|
|
86
|
-
const exception = /\b(?:unless|except(?:\s+when)?|only\s+if)\b/.test(clause);
|
|
87
|
-
return hasReview && ((hasSkip && (!negated || exception)) ||
|
|
88
|
-
(weakRequirement && (!negatedWeakRequirement || exception)));
|
|
89
|
-
});
|
|
90
|
-
for (const [phrase, expected] of [
|
|
91
|
-
['Never skip Reviewer verification', false],
|
|
92
|
-
['Reviewer verification must not be skipped', false],
|
|
93
|
-
['Must not proceed without review', false],
|
|
94
|
-
['Never skip risky review, but may skip simple review', true],
|
|
95
|
-
['Never skip review unless low-risk', true],
|
|
96
|
-
['Never skip review except when low-risk', true],
|
|
97
|
-
['Never skip review only if low-risk', true],
|
|
98
|
-
['May omit review', true],
|
|
99
|
-
['Proceed without review', true],
|
|
100
|
-
['Review is optional', true],
|
|
101
|
-
['Review is unnecessary', true],
|
|
102
|
-
['Review is not required', true],
|
|
103
|
-
['Review is skippable for low-risk work', true],
|
|
104
|
-
['Review is not optional', false],
|
|
105
|
-
['Review is not unnecessary', false],
|
|
106
|
-
]) assert(reviewSkipViolation(phrase) === expected, `review-skip detector case failed: ${phrase}`);
|
|
107
|
-
const skipsReview = reviewSkipViolation(workflow);
|
|
108
|
-
assert(hasAll(lead, 'write-role agents self-verify', 'cross-scope verification', 'benches', 'all git', 'current project/workspace'), 'lead tool rules must preserve verification, git, and workspace ownership');
|
|
109
|
-
assert(hasAll(workflow, 'before the user explicitly approves the latest plan', 'no edits, no state mutation, no delegation'), 'default workflow must require latest-plan approval before work');
|
|
110
|
-
assert(hasAll(workflow, 'on approval, fan out at maximum width', 'one agent per independent scope', 'all spawned in one turn', 'split the plan into as many scopes as possible', 'disjoint file/module sets are independent', 'merge only on a true output dependency', 'prefer parallel scopes over sequential slices in one agent'), 'default workflow must fan out independent scopes at maximum width');
|
|
111
|
-
assert(hasAll(workflow, 'simple, well-understood implementation goes to worker', 'complex or investigative implementation goes to heavy worker', 'lead itself edits only a local, one-turn configuration/git change', 'debugger only on a defect needing deep root-cause analysis or a bug surviving 2+ review/fix cycles'), 'default workflow must enforce role routing and Lead/Debugger limits');
|
|
112
|
-
assert(hasAll(workflow, 'every implementation gets its own reviewer, attached per scope', 'only the local lead-direct edits above are exempt', 'lead itself edits only a local, one-turn configuration/git change', 'keep the same reviewer through the fix loop', 'fix -> re-verify until clean', 'lead cross-verifies'), 'default workflow must require a Reviewer for every implementation except local Lead-direct one-turn config/git edits');
|
|
113
|
-
assert(hasAll(workflow, 'build, deploy, commit, and push happen only on an explicit user request', 'on direction change, pause and re-consult the user'), 'default workflow must require user authorization and re-consultation');
|
|
114
|
-
assert(!skipsReview, 'default workflow must not permit delegated-review skips');
|
|
115
|
-
assert(hasAll(solo, 'before the user explicitly approves the latest plan', 'read-only investigation and planning — no edits, no state mutation', 'a new or changed request resets planning; a scope change requires fresh approval'), 'Solo workflow must require latest-plan approval and reset it for request or scope changes');
|
|
116
|
-
assert(hasAll(solo, 'on approval, lead executes all work itself', 'never spawn, send, or delegate to agents', 'verify directly: check and fix until clean, or report the blocker'), 'Solo workflow must keep work with Lead, forbid delegation, and verify directly');
|
|
117
|
-
assert(hasAll(solo, 'build, deploy, commit, and push happen only on an explicit user request', 'on direction change, pause and re-consult the user'), 'Solo workflow must require user authorization and re-consultation');
|
|
118
|
-
assert(/always start background tasks/i.test(AGENT_TOOL.description || '') && /distinct tags?/i.test(AGENT_TOOL.description || '') && /completion notification/i.test(AGENT_TOOL.description || ''), 'agent tool description must expose async parallel tags');
|
|
119
|
-
|
|
120
|
-
mkdirSync(dataDir, { recursive: true });
|
|
121
|
-
await initProviders({ 'openai-oauth': { enabled: true } });
|
|
122
|
-
writeFileSync(join(root, 'feature.txt'), 'alpha\nbeta\n', 'utf8');
|
|
123
|
-
writeFileSync(join(root, 'notes.txt'), 'TODO investigate timeout\n', 'utf8');
|
|
124
|
-
|
|
125
|
-
const cfgMod = {
|
|
126
|
-
loadConfig() {
|
|
127
|
-
return {
|
|
128
|
-
providers: { 'openai-oauth': { enabled: true } },
|
|
129
|
-
agents: {
|
|
130
|
-
worker: { provider: 'openai-oauth', model: 'gpt-5.5', effort: 'medium', fast: true },
|
|
131
|
-
reviewer: { provider: 'openai-oauth', model: 'gpt-5.5', effort: 'low' },
|
|
132
|
-
debugger: { provider: 'openai-oauth', model: 'gpt-5.5', effort: 'low' },
|
|
133
|
-
},
|
|
134
|
-
presets: [
|
|
135
|
-
{ id: 'fake-worker', name: 'Fake Worker', provider: 'openai-oauth', model: 'gpt-5.5', tools: 'full', effort: 'medium', fast: true },
|
|
136
|
-
{ id: 'fake-reviewer', name: 'Fake Reviewer', provider: 'openai-oauth', model: 'gpt-5.5', tools: 'readonly', effort: 'low' },
|
|
137
|
-
{ id: 'fake-debugger', name: 'Fake Debugger', provider: 'openai-oauth', model: 'gpt-5.5', tools: 'readonly', effort: 'low' },
|
|
138
|
-
],
|
|
139
|
-
};
|
|
140
|
-
},
|
|
141
|
-
resolveRuntimeSpec(preset, ctx) {
|
|
142
|
-
return { lane: 'agent', scopeKey: `smoke:${ctx.agentId}`, provider: preset.provider, model: preset.model };
|
|
143
|
-
},
|
|
144
|
-
};
|
|
145
|
-
const reg = { initProviders };
|
|
146
|
-
|
|
147
|
-
async function fakeAskSession(sessionId, prompt, _context, _onToolCall, cwdOverride) {
|
|
148
|
-
const session = getSession(sessionId);
|
|
149
|
-
if (session) {
|
|
150
|
-
session.status = 'running';
|
|
151
|
-
session.lastStreamDeltaAt = Date.now();
|
|
152
|
-
}
|
|
153
|
-
activeAsks += 1;
|
|
154
|
-
maxActiveAsks = Math.max(maxActiveAsks, activeAsks);
|
|
155
|
-
try {
|
|
156
|
-
if (/parallel slow/i.test(prompt)) await sleep(600);
|
|
157
|
-
if (/long busy/i.test(prompt)) await waitForBusyRelease();
|
|
158
|
-
if (/write implementation/i.test(prompt)) {
|
|
159
|
-
const out = await executePatchTool('apply_patch', {
|
|
160
|
-
base_path: cwdOverride,
|
|
161
|
-
patch: `*** Begin Patch
|
|
162
|
-
*** Update File: feature.txt
|
|
163
|
-
@@
|
|
164
|
-
alpha
|
|
165
|
-
-beta
|
|
166
|
-
+beta from worker
|
|
167
|
-
*** End Patch
|
|
168
|
-
`,
|
|
169
|
-
}, cwdOverride);
|
|
170
|
-
return { content: `worker wrote feature\n${String(out).split(/\r?\n/)[0]}` };
|
|
171
|
-
}
|
|
172
|
-
if (/run verification/i.test(prompt)) {
|
|
173
|
-
const out = await executeBuiltinTool('shell', {
|
|
174
|
-
command: 'Get-Content feature.txt',
|
|
175
|
-
cwd: cwdOverride,
|
|
176
|
-
shell: 'powershell',
|
|
177
|
-
timeout: 30_000,
|
|
178
|
-
}, cwdOverride);
|
|
179
|
-
return { content: `verification\n${out}` };
|
|
180
|
-
}
|
|
181
|
-
if (/review/i.test(prompt)) {
|
|
182
|
-
const body = readFileSync(join(cwdOverride, 'feature.txt'), 'utf8');
|
|
183
|
-
return { content: body.includes('worker') ? 'reviewer ok' : 'reviewer missing worker change' };
|
|
184
|
-
}
|
|
185
|
-
if (/debug/i.test(prompt)) {
|
|
186
|
-
return { content: `debugger ${readFileSync(join(cwdOverride, 'notes.txt'), 'utf8').trim()}` };
|
|
187
|
-
}
|
|
188
|
-
return { content: `ack ${session?.agent || 'worker'}` };
|
|
189
|
-
} finally {
|
|
190
|
-
activeAsks -= 1;
|
|
191
|
-
if (session) {
|
|
192
|
-
session.status = 'idle';
|
|
193
|
-
session.lastUsedAt = new Date().toISOString();
|
|
194
|
-
session.lastStreamDeltaAt = Date.now();
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
const mgr = {
|
|
200
|
-
getSession,
|
|
201
|
-
listSessions,
|
|
202
|
-
closeSession,
|
|
203
|
-
getSessionRuntime,
|
|
204
|
-
enqueuePendingMessage,
|
|
205
|
-
getSessionLastProgressAt,
|
|
206
|
-
askSession: fakeAskSession,
|
|
207
|
-
};
|
|
208
|
-
agentRunner = createStandaloneAgent({ cfgMod, reg, mgr, dataDir, cwd: root, defaultMode: 'async' });
|
|
209
|
-
|
|
210
|
-
async function waitJob(out, pattern, label) {
|
|
211
|
-
const id = taskId(out);
|
|
212
|
-
assert(id, `missing task ID for ${label}: ${out}`);
|
|
213
|
-
let last = '';
|
|
214
|
-
for (let i = 0; i < 40; i += 1) {
|
|
215
|
-
last = await agentRunner.execute({ type: 'read', task_id: id }, { invocationSource: 'model-tool', cwd: root });
|
|
216
|
-
if (pattern.test(last)) return last;
|
|
217
|
-
if (/^Error[\s:[]/.test(last) || /status: error/.test(last)) break;
|
|
218
|
-
await sleep(100);
|
|
219
|
-
}
|
|
220
|
-
throw new Error(`${label} did not finish with ${pattern}: ${last}`);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
async function waitAgentTag(tag, label) {
|
|
224
|
-
for (let i = 0; i < 20; i += 1) {
|
|
225
|
-
if (agentRunner.getStatus({ cwd: root }).workers
|
|
226
|
-
.some((worker) => worker?.tag === tag && worker.status === 'running')) return;
|
|
227
|
-
await sleep(25);
|
|
228
|
-
}
|
|
229
|
-
throw new Error(`${label} did not start agent tag ${tag}`);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
const spawnOut = await agentRunner.execute({
|
|
233
|
-
type: 'spawn',
|
|
234
|
-
agent: 'worker',
|
|
235
|
-
tag: 'impl1',
|
|
236
|
-
cwd: root,
|
|
237
|
-
prompt: 'write implementation: update feature.txt with apply_patch',
|
|
238
|
-
}, { invocationSource: 'model-tool', cwd: root });
|
|
239
|
-
await waitJob(spawnOut, /worker wrote feature/, 'worker write');
|
|
240
|
-
|
|
241
|
-
const sendOut = await agentRunner.execute({
|
|
242
|
-
type: 'send',
|
|
243
|
-
tag: 'impl1',
|
|
244
|
-
message: 'run verification: inspect feature.txt using bash',
|
|
245
|
-
}, { invocationSource: 'model-tool', cwd: root });
|
|
246
|
-
assert(/agent task:/.test(sendOut), `completed worker send should be async task, got ${sendOut}`);
|
|
247
|
-
await waitJob(sendOut, /beta from worker/, 'worker verify');
|
|
248
|
-
|
|
249
|
-
const reviewOut = await agentRunner.execute({
|
|
250
|
-
type: 'spawn',
|
|
251
|
-
agent: 'reviewer',
|
|
252
|
-
tag: 'rev1',
|
|
253
|
-
cwd: root,
|
|
254
|
-
prompt: 'review feature.txt for the worker change',
|
|
255
|
-
}, { invocationSource: 'model-tool', cwd: root });
|
|
256
|
-
const debugOut = await agentRunner.execute({
|
|
257
|
-
type: 'spawn',
|
|
258
|
-
agent: 'debugger',
|
|
259
|
-
tag: 'dbg1',
|
|
260
|
-
cwd: root,
|
|
261
|
-
prompt: 'debug notes.txt timeout clue',
|
|
262
|
-
}, { invocationSource: 'model-tool', cwd: root });
|
|
263
|
-
await waitJob(reviewOut, /reviewer ok/, 'reviewer');
|
|
264
|
-
await waitJob(debugOut, /debugger TODO/, 'debugger');
|
|
265
|
-
|
|
266
|
-
const parallelSpawns = await Promise.all([
|
|
267
|
-
agentRunner.execute({
|
|
268
|
-
type: 'spawn',
|
|
269
|
-
agent: 'worker',
|
|
270
|
-
tag: 'parWorker',
|
|
271
|
-
cwd: root,
|
|
272
|
-
prompt: 'parallel slow worker task',
|
|
273
|
-
}, { invocationSource: 'model-tool', cwd: root }),
|
|
274
|
-
agentRunner.execute({
|
|
275
|
-
type: 'spawn',
|
|
276
|
-
agent: 'reviewer',
|
|
277
|
-
tag: 'parReviewer',
|
|
278
|
-
cwd: root,
|
|
279
|
-
prompt: 'parallel slow review task',
|
|
280
|
-
}, { invocationSource: 'model-tool', cwd: root }),
|
|
281
|
-
agentRunner.execute({
|
|
282
|
-
type: 'spawn',
|
|
283
|
-
agent: 'debugger',
|
|
284
|
-
tag: 'parDebugger',
|
|
285
|
-
cwd: root,
|
|
286
|
-
prompt: 'parallel slow debug task',
|
|
287
|
-
}, { invocationSource: 'model-tool', cwd: root }),
|
|
288
|
-
]);
|
|
289
|
-
assert(parallelSpawns.every((out) => /agent task:/.test(out)), `parallel spawns must return tasks: ${parallelSpawns.join('\n---\n')}`);
|
|
290
|
-
await Promise.all([
|
|
291
|
-
waitJob(parallelSpawns[0], /ack worker/, 'parallel worker'),
|
|
292
|
-
waitJob(parallelSpawns[1], /reviewer ok/, 'parallel reviewer'),
|
|
293
|
-
waitJob(parallelSpawns[2], /debugger TODO/, 'parallel debugger'),
|
|
294
|
-
]);
|
|
295
|
-
assert(maxActiveAsks >= 2, `agents did not overlap; maxActiveAsks=${maxActiveAsks}`);
|
|
296
|
-
|
|
297
|
-
const busyOut = await agentRunner.execute({
|
|
298
|
-
type: 'spawn',
|
|
299
|
-
agent: 'worker',
|
|
300
|
-
tag: 'busy1',
|
|
301
|
-
cwd: root,
|
|
302
|
-
prompt: 'long busy worker task',
|
|
303
|
-
}, { invocationSource: 'model-tool', cwd: root });
|
|
304
|
-
await waitAgentTag('busy1', 'busy worker');
|
|
305
|
-
const queued = await agentRunner.execute({
|
|
306
|
-
type: 'send',
|
|
307
|
-
tag: 'busy1',
|
|
308
|
-
message: 'follow-up while still busy',
|
|
309
|
-
}, { invocationSource: 'model-tool', cwd: root });
|
|
310
|
-
assert(/agent message queued/.test(queued), `busy send should queue, got ${queued}`);
|
|
311
|
-
releaseBusyWorker();
|
|
312
|
-
await waitJob(busyOut, /ack worker/, 'busy worker');
|
|
313
|
-
|
|
314
|
-
const missing = await agentRunner.execute({ type: 'read', task_id: 'task_missing_live_smoke' }, { invocationSource: 'model-tool', cwd: root });
|
|
315
|
-
assert(/^Error[\s:[]/.test(missing), 'missing agent task should be Error result');
|
|
316
|
-
assert(readFileSync(join(root, 'feature.txt'), 'utf8').includes('beta from worker'), 'final file missing worker edit');
|
|
317
|
-
closeAgentRunner();
|
|
318
|
-
process.stdout.write('live worker smoke passed\n');
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
try {
|
|
322
|
-
await main();
|
|
323
|
-
} finally {
|
|
324
|
-
try {
|
|
325
|
-
releaseBusyWorker();
|
|
326
|
-
} finally {
|
|
327
|
-
try {
|
|
328
|
-
closeAgentRunner();
|
|
329
|
-
} finally {
|
|
330
|
-
rmSync(root, { recursive: true, force: true });
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
}
|