mixdog 0.9.152 → 0.9.154
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/LICENSES/browser-import-NOTICE.txt +11 -0
- package/NOTICE.md +11 -0
- package/README.md +8 -10
- package/package.json +19 -3
- package/scripts/computer-task-cost-report.mjs +144 -0
- package/scripts/run-office-live-tests.mjs +32 -0
- package/src/agents/front-worker/AGENT.md +13 -0
- package/src/agents/front-worker/agent.json +6 -0
- package/src/agents/heavy-worker/AGENT.md +10 -11
- package/src/agents/heavy-worker/agent.json +1 -1
- package/src/agents/maintainer/AGENT.md +0 -2
- package/src/agents/reviewer/AGENT.md +9 -13
- package/src/agents/reviewer/agent.json +1 -1
- package/src/agents/security/AGENT.md +14 -0
- package/src/agents/security/agent.json +6 -0
- package/src/agents/worker/AGENT.md +8 -8
- package/src/agents/worker/agent.json +1 -1
- package/src/agents/writer/AGENT.md +14 -0
- package/src/agents/writer/agent.json +6 -0
- package/src/rules/agent/00-common.md +4 -7
- package/src/rules/lead/01-general.md +0 -3
- package/src/rules/shared/10-tool-workflow.md +10 -2
- package/src/rules/shared/60-verification.md +2 -0
- package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch.mjs +183 -26
- package/src/runtime/agent/orchestrator/agent-runtime/session-builder.mjs +4 -0
- package/src/runtime/agent/orchestrator/cache-break-trace.mjs +109 -0
- package/src/runtime/agent/orchestrator/config.mjs +7 -2
- package/src/runtime/agent/orchestrator/providers/admission-scheduler.mjs +16 -3
- package/src/runtime/agent/orchestrator/providers/lib/anthropic-request-utils.mjs +9 -1
- package/src/runtime/agent/orchestrator/providers/media-normalization.mjs +30 -9
- package/src/runtime/agent/orchestrator/providers/openai-codex-metadata.mjs +18 -26
- package/src/runtime/agent/orchestrator/providers/openai-oauth-http-sse.mjs +25 -2
- package/src/runtime/agent/orchestrator/providers/openai-oauth-ws.mjs +103 -10
- package/src/runtime/agent/orchestrator/providers/openai-turn-state.mjs +68 -0
- package/src/runtime/agent/orchestrator/providers/openai-ws-delta.mjs +36 -11
- package/src/runtime/agent/orchestrator/providers/openai-ws-pool.mjs +140 -86
- package/src/runtime/agent/orchestrator/providers/openai-ws-stream.mjs +9 -13
- package/src/runtime/agent/orchestrator/session/agent-loop.mjs +72 -4
- package/src/runtime/agent/orchestrator/session/browser-snapshot-supersession.mjs +61 -0
- package/src/runtime/agent/orchestrator/session/compact/handoff.mjs +0 -22
- package/src/runtime/agent/orchestrator/session/compact/messages.mjs +2 -2
- package/src/runtime/agent/orchestrator/session/compact/runner.mjs +11 -23
- package/src/runtime/agent/orchestrator/session/compact/summary.mjs +28 -269
- package/src/runtime/agent/orchestrator/session/compact.mjs +0 -6
- package/src/runtime/agent/orchestrator/session/context-utils.mjs +86 -11
- package/src/runtime/agent/orchestrator/session/eager-dispatch.mjs +17 -1
- package/src/runtime/agent/orchestrator/session/image-strip-recovery.mjs +12 -8
- package/src/runtime/agent/orchestrator/session/loop/compact-policy.mjs +110 -2
- package/src/runtime/agent/orchestrator/session/loop/pre-dispatch-deny.mjs +3 -16
- package/src/runtime/agent/orchestrator/session/loop/recall-fasttrack.mjs +80 -18
- package/src/runtime/agent/orchestrator/session/loop/steering.mjs +6 -0
- package/src/runtime/agent/orchestrator/session/loop/tool-exec.mjs +3 -0
- package/src/runtime/agent/orchestrator/session/loop/tool-helpers.mjs +6 -0
- package/src/runtime/agent/orchestrator/session/manager/ask-session.mjs +80 -21
- package/src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs +33 -72
- package/src/runtime/agent/orchestrator/session/manager/session-crud.mjs +21 -2
- package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.mjs +25 -51
- package/src/runtime/agent/orchestrator/session/manager/status-telemetry.mjs +3 -0
- package/src/runtime/agent/orchestrator/session/manager/tool-resolution.mjs +4 -110
- package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint-journal.mjs +39 -15
- package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint.mjs +14 -4
- package/src/runtime/agent/orchestrator/session/pre-send-compact.mjs +41 -8
- package/src/runtime/agent/orchestrator/session/provider-prefix-guard.mjs +129 -12
- package/src/runtime/agent/orchestrator/session/send-with-recovery.mjs +2 -2
- package/src/runtime/agent/orchestrator/session/store/listing.mjs +8 -1
- package/src/runtime/agent/orchestrator/session/store/save-worker.mjs +15 -1
- package/src/runtime/agent/orchestrator/session/store-summary-index.mjs +36 -2
- package/src/runtime/agent/orchestrator/session/store-summary-reader.mjs +157 -30
- package/src/runtime/agent/orchestrator/session/store-summary-visibility.mjs +57 -0
- package/src/runtime/agent/orchestrator/session/store.mjs +3 -1
- package/src/runtime/agent/orchestrator/session/tool-batch.mjs +22 -0
- package/src/runtime/agent/orchestrator/tools/builtin/read-special-files.mjs +6 -6
- package/src/runtime/agent/orchestrator/tools/progress-message.mjs +4 -0
- package/src/runtime/attachments/pdf-extract.mjs +3 -0
- package/src/runtime/attachments/pdfjs-runtime.mjs +13 -0
- package/src/runtime/browser-bridge/action-schema.mjs +251 -0
- package/src/runtime/browser-bridge/client.mjs +75 -26
- package/src/runtime/browser-bridge/tool-defs.mjs +132 -15
- package/src/runtime/computer-bridge/action-schema.mjs +653 -0
- package/src/runtime/computer-bridge/client.mjs +211 -28
- package/src/runtime/computer-bridge/tool-defs.mjs +25 -45
- package/src/runtime/office/assurance-benchmark.mjs +358 -0
- package/src/runtime/office/assurance.mjs +833 -0
- package/src/runtime/office/benchmark.mjs +496 -0
- package/src/runtime/office/capabilities.mjs +551 -0
- package/src/runtime/office/com-adapter.mjs +283 -0
- package/src/runtime/office/content-model.mjs +183 -0
- package/src/runtime/office/contract-benchmark.mjs +105 -0
- package/src/runtime/office/design-library.mjs +1562 -0
- package/src/runtime/office/design-system.mjs +1966 -0
- package/src/runtime/office/index.mjs +2413 -0
- package/src/runtime/office/journal.mjs +82 -0
- package/src/runtime/office/office-com-host.ps1 +3781 -0
- package/src/runtime/office/office-com-session-host.ps1 +855 -0
- package/src/runtime/office/ooxml-validator.mjs +271 -0
- package/src/runtime/office/pagination.mjs +132 -0
- package/src/runtime/office/pdf-adapter.mjs +591 -0
- package/src/runtime/office/pdf-analysis.mjs +372 -0
- package/src/runtime/office/pdf-render.mjs +167 -0
- package/src/runtime/office/pdf-security.mjs +63 -0
- package/src/runtime/office/polish-benchmark.mjs +190 -0
- package/src/runtime/office/portable-ooxml.mjs +1867 -0
- package/src/runtime/office/quality-live-benchmark.mjs +486 -0
- package/src/runtime/office/quality-pipeline.mjs +136 -0
- package/src/runtime/office/tabular.mjs +302 -0
- package/src/runtime/office/templates/mixdog-executive.pptx +0 -0
- package/src/runtime/office/templates/mixdog-executive.pptx.mixdog.json +190 -0
- package/src/runtime/office/tool-defs.mjs +113 -0
- package/src/runtime/office/visual-diff.mjs +89 -0
- package/src/runtime/office/xlsx-assertions.mjs +172 -0
- package/src/runtime/office/xlsx-contract.mjs +147 -0
- package/src/runtime/shared/agent-route-config.mjs +9 -0
- package/src/runtime/shared/tool-execution-contract.mjs +16 -0
- package/src/runtime/shared/tool-surface.mjs +9 -0
- package/src/session-runtime/context-status.mjs +9 -3
- package/src/session-runtime/deferred-tool-delta.mjs +104 -0
- package/src/session-runtime/goal-runtime.mjs +617 -197
- package/src/session-runtime/lifecycle-api.mjs +50 -8
- package/src/session-runtime/provider-request-snapshot.mjs +33 -9
- package/src/session-runtime/resource-api.mjs +31 -94
- package/src/session-runtime/runtime-core.mjs +78 -26
- package/src/session-runtime/session-lifecycle.mjs +34 -12
- package/src/session-runtime/session-title.mjs +2 -2
- package/src/session-runtime/session-turn-api.mjs +15 -14
- package/src/session-runtime/tool-catalog-data.mjs +1 -1
- package/src/session-runtime/tool-catalog.mjs +38 -99
- package/src/session-runtime/tool-defs.mjs +6 -1
- package/src/session-runtime/tool-surface.mjs +18 -8
- package/src/session-runtime/workflow-agents-api.mjs +8 -25
- package/src/session-runtime/workflow.mjs +8 -6
- package/src/standalone/agent-tool/helpers.mjs +2 -2
- package/src/standalone/agent-tool/job-views.mjs +3 -1
- package/src/standalone/agent-tool/notify.mjs +5 -1
- package/src/standalone/agent-tool/render.mjs +3 -0
- package/src/standalone/agent-tool/spawn-flow.mjs +61 -16
- package/src/standalone/agent-tool/tool-def.mjs +1 -1
- package/src/standalone/agent-tool/worker-index.mjs +123 -0
- package/src/standalone/agent-tool/worker-rows.mjs +2 -1
- package/src/standalone/agent-tool.mjs +57 -10
- package/src/standalone/daemon.mjs +105 -6
- package/src/standalone/session-runtime-host.mjs +61 -48
- package/src/standalone/session-runtime-inline-host.mjs +34 -127
- package/src/standalone/session-runtime-worker.mjs +20 -198
- package/src/standalone/session-service.mjs +632 -7
- package/src/tui/dist/index.mjs +24 -1
- package/src/tui/lib/voice-setup.mjs +4 -1
- package/src/tui/session/context-state.mjs +2 -13
- package/src/tui/session/goal-continuation.mjs +38 -7
- package/src/tui/session/session-api-ext.mjs +9 -0
- package/src/tui/session/session-api.mjs +15 -1
- package/src/tui/session/session-flow.mjs +25 -1
- package/src/tui/session/turn.mjs +88 -16
- package/src/tui/session-local.mjs +25 -3
- package/src/vendor/statusline/src/gateway/route-meta.mjs +31 -0
- package/scripts/generate-voice-runtime-manifest.test.mjs +0 -135
- package/scripts/native-binary-arch.test.mjs +0 -111
- package/scripts/patch-replay.test.mjs +0 -94
- package/src/headless-exec.test.mjs +0 -539
- package/src/runtime/agent/orchestrator/agent-trace-timing.test.mjs +0 -57
- package/src/runtime/agent/orchestrator/context/collect-skills.test.mjs +0 -153
- package/src/runtime/agent/orchestrator/mcp/cancellation.test.mjs +0 -139
- package/src/runtime/agent/orchestrator/mcp/features.test.mjs +0 -66
- package/src/runtime/agent/orchestrator/mcp/security.test.mjs +0 -80
- package/src/runtime/agent/orchestrator/providers/anthropic-fast-mode.test.mjs +0 -90
- package/src/runtime/agent/orchestrator/providers/anthropic-server-fallback.test.mjs +0 -215
- package/src/runtime/agent/orchestrator/providers/antigravity-oauth.test.mjs +0 -165
- package/src/runtime/agent/orchestrator/providers/media-parity.test.mjs +0 -142
- package/src/runtime/agent/orchestrator/providers/openai-codex-identity.test.mjs +0 -153
- package/src/runtime/agent/orchestrator/providers/openai-codex-model.test.mjs +0 -24
- package/src/runtime/agent/orchestrator/providers/openai-ws-delta-parity.test.mjs +0 -190
- package/src/runtime/agent/orchestrator/providers/provider-replay.test.mjs +0 -235
- package/src/runtime/agent/orchestrator/providers/sse-framing.test.mjs +0 -719
- package/src/runtime/agent/orchestrator/session/cache/prefetch-cache.test.mjs +0 -40
- package/src/runtime/agent/orchestrator/session/compact-policy.test.mjs +0 -176
- package/src/runtime/agent/orchestrator/session/compaction-read-reset.test.mjs +0 -161
- package/src/runtime/agent/orchestrator/session/eager-dispatch.test.mjs +0 -115
- package/src/runtime/agent/orchestrator/session/evidence-union.test.mjs +0 -228
- package/src/runtime/agent/orchestrator/session/image-strip-recovery.test.mjs +0 -245
- package/src/runtime/agent/orchestrator/session/lossless-tool-output.test.mjs +0 -125
- package/src/runtime/agent/orchestrator/session/manager/pending-messages-persistence.test.mjs +0 -325
- package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.test.mjs +0 -70
- package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint-journal.test.mjs +0 -457
- package/src/runtime/agent/orchestrator/session/provider-prefix-guard.test.mjs +0 -117
- package/src/runtime/agent/orchestrator/session/reduction-metrics.test.mjs +0 -87
- package/src/runtime/agent/orchestrator/session/store/serialize.test.mjs +0 -60
- package/src/runtime/agent/orchestrator/session/store-summary-reader.test.mjs +0 -583
- package/src/runtime/agent/orchestrator/session/task-wait-control.test.mjs +0 -78
- package/src/runtime/agent/orchestrator/tools/builtin/absence-absorption.test.mjs +0 -43
- package/src/runtime/agent/orchestrator/tools/builtin/absolute-glob-expand.test.mjs +0 -63
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool-cwd-env.test.mjs +0 -14
- package/src/runtime/agent/orchestrator/tools/builtin/edit-encoding-eol.test.mjs +0 -224
- package/src/runtime/agent/orchestrator/tools/builtin/edit-sequential-occupation.test.mjs +0 -224
- package/src/runtime/agent/orchestrator/tools/builtin/enoent-outside-project.test.mjs +0 -56
- package/src/runtime/agent/orchestrator/tools/builtin/find-search-budget.test.mjs +0 -103
- package/src/runtime/agent/orchestrator/tools/builtin/git-command-policy.test.mjs +0 -30
- package/src/runtime/agent/orchestrator/tools/builtin/git-command-tool.test.mjs +0 -390
- package/src/runtime/agent/orchestrator/tools/builtin/git-repo-rw-lock.test.mjs +0 -83
- package/src/runtime/agent/orchestrator/tools/builtin/grep-output-budget.test.mjs +0 -31
- package/src/runtime/agent/orchestrator/tools/builtin/grep-single-file-rescue.test.mjs +0 -106
- package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-job-records.test.mjs +0 -102
- package/src/runtime/agent/orchestrator/tools/builtin/list-tool-integrity.test.mjs +0 -152
- package/src/runtime/agent/orchestrator/tools/builtin/native-search-health.test.mjs +0 -24
- package/src/runtime/agent/orchestrator/tools/builtin/native-search-transport.test.mjs +0 -24
- package/src/runtime/agent/orchestrator/tools/builtin/noise-dir-visibility.test.mjs +0 -69
- package/src/runtime/agent/orchestrator/tools/builtin/read-glob-survey.test.mjs +0 -71
- package/src/runtime/agent/orchestrator/tools/builtin/runtime-capabilities.test.mjs +0 -56
- package/src/runtime/agent/orchestrator/tools/builtin/search-builders.test.mjs +0 -16
- package/src/runtime/agent/orchestrator/tools/builtin/search-glob-top-k.test.mjs +0 -39
- package/src/runtime/agent/orchestrator/tools/builtin/write-symlink.test.mjs +0 -153
- package/src/runtime/agent/orchestrator/tools/code-graph/aggregate-anchor-relocation.test.mjs +0 -55
- package/src/runtime/agent/orchestrator/tools/code-graph/dispatch.test.mjs +0 -88
- package/src/runtime/agent/orchestrator/tools/code-graph/loose-file-target.test.mjs +0 -72
- package/src/runtime/agent/orchestrator/tools/code-graph/memory-cache.test.mjs +0 -54
- package/src/runtime/agent/orchestrator/tools/code-graph/search-references.test.mjs +0 -20
- package/src/runtime/agent/orchestrator/tools/code-graph/symbol-search-scope.test.mjs +0 -55
- package/src/runtime/agent/orchestrator/tools/code-graph/text-span-mask.test.mjs +0 -268
- package/src/runtime/agent/orchestrator/tools/env-scrub.test.mjs +0 -57
- package/src/runtime/agent/orchestrator/tools/graph-binary-fetcher.test.mjs +0 -19
- package/src/runtime/agent/orchestrator/tools/lib/native-spawn-client.test.mjs +0 -104
- package/src/runtime/agent/orchestrator/tools/patch/engine-contract-gate.test.mjs +0 -661
- package/src/runtime/agent/orchestrator/tools/patch/patch-codec-eol.test.mjs +0 -552
- package/src/runtime/agent/orchestrator/tools/patch/patch-symlink.test.mjs +0 -141
- package/src/runtime/agent/orchestrator/tools/patch/v4a-pure-move.test.mjs +0 -57
- package/src/runtime/agent/orchestrator/tools/patch/v4a-section-coalesce.test.mjs +0 -81
- package/src/runtime/agent/orchestrator/tools/spawn-binary-fetcher.test.mjs +0 -52
- package/src/runtime/attachments/store.test.mjs +0 -209
- package/src/runtime/channels/lib/voice-runtime-fetcher.test.mjs +0 -17
- package/src/runtime/channels/lib/webhook/deliveries.test.mjs +0 -18
- package/src/runtime/channels/lib/webhook/relay-tunnel.test.mjs +0 -68
- package/src/runtime/media/adapters/codex-image.test.mjs +0 -22
- package/src/runtime/media/download.test.mjs +0 -52
- package/src/runtime/media/renditions.test.mjs +0 -99
- package/src/runtime/media/store.test.mjs +0 -159
- package/src/runtime/memory/lib/archive-security.test.mjs +0 -128
- package/src/runtime/memory/lib/embedding-model-config.test.mjs +0 -33
- package/src/runtime/memory/lib/http-wire.test.mjs +0 -15
- package/src/runtime/memory/lib/memory-cycle-packets.test.mjs +0 -49
- package/src/runtime/memory/lib/memory-cycle2-shared.test.mjs +0 -78
- package/src/runtime/memory/lib/memory-embedding-migration.test.mjs +0 -50
- package/src/runtime/memory/lib/pg/process.test.mjs +0 -36
- package/src/runtime/memory/lib/trace-store.test.mjs +0 -57
- package/src/runtime/memory/lib/transcript-ingest.test.mjs +0 -52
- package/src/runtime/shared/background-tasks.test.mjs +0 -78
- package/src/runtime/shared/bounded-download.test.mjs +0 -41
- package/src/runtime/shared/channel-notification-routing.test.mjs +0 -25
- package/src/runtime/shared/child-spawn-remote.test.mjs +0 -124
- package/src/runtime/shared/remote-intent.test.mjs +0 -40
- package/src/runtime/shared/resource-admission.test.mjs +0 -43
- package/src/runtime/shared/runtime-root.test.mjs +0 -34
- package/src/runtime/shared/schedule-time.test.mjs +0 -29
- package/src/runtime/shared/session-runtime-health.test.mjs +0 -83
- package/src/runtime/shared/skill-document.test.mjs +0 -81
- package/src/runtime/shared/tool-surface.test.mjs +0 -87
- package/src/runtime/shared/update-checker.test.mjs +0 -33
- package/src/runtime/shared/user-cwd.test.mjs +0 -43
- package/src/runtime/shared/webhook-session-run.test.mjs +0 -14
- package/src/session-runtime/agent-disable.test.mjs +0 -123
- package/src/session-runtime/cwd-plugins.test.mjs +0 -75
- package/src/session-runtime/cwd-tool-routing.test.mjs +0 -61
- package/src/session-runtime/global-extensions.test.mjs +0 -28
- package/src/session-runtime/goal-runtime.test.mjs +0 -108
- package/src/session-runtime/lifecycle-api.test.mjs +0 -21
- package/src/session-runtime/model-settings-persist.test.mjs +0 -105
- package/src/session-runtime/notification-bus.test.mjs +0 -148
- package/src/session-runtime/plugin-mcp-standard.test.mjs +0 -177
- package/src/session-runtime/prewarm.test.mjs +0 -52
- package/src/session-runtime/provider-request-snapshot.test.mjs +0 -37
- package/src/session-runtime/resource-api-global.test.mjs +0 -69
- package/src/session-runtime/session-lifecycle.test.mjs +0 -125
- package/src/session-runtime/session-title.test.mjs +0 -36
- package/src/session-runtime/skills-api.test.mjs +0 -99
- package/src/session-runtime/tool-policy-surface.test.mjs +0 -331
- package/src/standalone/agent-tool/helpers.test.mjs +0 -62
- package/src/standalone/agent-tool/notify.test.mjs +0 -37
- package/src/standalone/agent-tool/spawn-flow.test.mjs +0 -63
- package/src/standalone/channel-restart.test.mjs +0 -145
- package/src/standalone/channel-session-router.test.mjs +0 -37
- package/src/standalone/channel-worker-heartbeat.test.mjs +0 -30
- package/src/standalone/hook-bus/handlers.test.mjs +0 -88
- package/src/standalone/plugin-admin.test.mjs +0 -173
- package/src/standalone/session-runtime-agent-control-client.test.mjs +0 -71
- package/src/standalone/session-runtime-dispatch-cancel.test.mjs +0 -139
- package/src/standalone/session-runtime-host-factory.test.mjs +0 -31
- package/src/standalone/session-runtime-host-health.test.mjs +0 -160
- package/src/standalone/session-runtime-inline-host.test.mjs +0 -83
- package/src/standalone/session-runtime-provider-cooldown.test.mjs +0 -80
- package/src/standalone/session-runtime-shard-host.test.mjs +0 -569
- package/src/standalone/session-runtime-shard-router.test.mjs +0 -101
- package/src/tui/app/live-spinner-visibility.test.mjs +0 -44
- package/src/tui/app/panel-epoch.test.mjs +0 -1009
- package/src/tui/app/panel-handoff.test.mjs +0 -311
- package/src/tui/app/prompt-submit.test.mjs +0 -206
- package/src/tui/session/completion-card-restore.test.mjs +0 -111
- package/src/tui/session/goal-continuation.test.mjs +0 -84
- package/src/tui/session/oauth-flows.test.mjs +0 -134
- package/src/tui/session/queue-helpers.test.mjs +0 -46
- package/src/tui/session/session-action-surface.test.mjs +0 -108
- package/src/tui/session/task-wait-submit.test.mjs +0 -80
- package/src/tui/session/tool-result-status.test.mjs +0 -131
- package/src/tui/session/tui-steering-persist.test.mjs +0 -104
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import test from 'node:test';
|
|
3
|
-
|
|
4
|
-
import { createNotificationBus } from './notification-bus.mjs';
|
|
5
|
-
|
|
6
|
-
const completionText = [
|
|
7
|
-
'background task',
|
|
8
|
-
'task_id: task-agent-1',
|
|
9
|
-
'surface: agent',
|
|
10
|
-
'status: completed',
|
|
11
|
-
'',
|
|
12
|
-
'agent result tag=review agent=worker',
|
|
13
|
-
'worker handoff',
|
|
14
|
-
].join('\n');
|
|
15
|
-
|
|
16
|
-
const completionMeta = {
|
|
17
|
-
type: 'agent_task_result',
|
|
18
|
-
execution_surface: 'agent',
|
|
19
|
-
execution_id: 'task-agent-1',
|
|
20
|
-
status: 'completed',
|
|
21
|
-
instruction: 'Async agent task task-agent-1 (completed) finished.',
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
test('session-id authority delivers to only the requested Lead among simultaneous listeners', () => {
|
|
25
|
-
const enqueued = [];
|
|
26
|
-
const deliveries = { a: [], b: [] };
|
|
27
|
-
const mgr = {
|
|
28
|
-
enqueuePendingMessage(sessionId, message) {
|
|
29
|
-
enqueued.push({ sessionId, message });
|
|
30
|
-
return 1;
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
const busA = createNotificationBus({ listeners: new Set(), mgr });
|
|
34
|
-
const busB = createNotificationBus({ listeners: new Set(), mgr });
|
|
35
|
-
busA.subscribeRuntimeNotification('lead-a', (event) => {
|
|
36
|
-
deliveries.a.push(event);
|
|
37
|
-
event.modelVisibleDelivered = true;
|
|
38
|
-
return true;
|
|
39
|
-
});
|
|
40
|
-
busB.subscribeRuntimeNotification('lead-b', (event) => {
|
|
41
|
-
deliveries.b.push(event);
|
|
42
|
-
event.modelVisibleDelivered = true;
|
|
43
|
-
return true;
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
const delivered = busB.notifySessionCompletion('lead-a', completionText, {
|
|
47
|
-
...completionMeta,
|
|
48
|
-
caller_session_id: 'lead-b',
|
|
49
|
-
routing_session_id: 'lead-b',
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
assert.equal(delivered, true);
|
|
53
|
-
assert.equal(deliveries.a.length, 1);
|
|
54
|
-
assert.equal(deliveries.b.length, 0);
|
|
55
|
-
assert.equal(deliveries.a[0].meta.caller_session_id, 'lead-a');
|
|
56
|
-
assert.equal(Object.hasOwn(deliveries.a[0].meta, 'routing_session_id'), false);
|
|
57
|
-
assert.equal(enqueued.length, 0);
|
|
58
|
-
busA.clearRuntimeNotifications();
|
|
59
|
-
busB.clearRuntimeNotifications();
|
|
60
|
-
busB.notifySessionCompletion('lead-a', completionText, {
|
|
61
|
-
...completionMeta,
|
|
62
|
-
execution_id: 'task-agent-after-close',
|
|
63
|
-
});
|
|
64
|
-
assert.equal(deliveries.a.length, 1);
|
|
65
|
-
assert.equal(deliveries.b.length, 0);
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
test('session-id authority queues an unobserved completion only for its owner', () => {
|
|
69
|
-
const enqueued = [];
|
|
70
|
-
const secondText = completionText.replaceAll('task-agent-1', 'task-agent-2');
|
|
71
|
-
const bus = createNotificationBus({
|
|
72
|
-
listeners: new Set(),
|
|
73
|
-
mgr: {
|
|
74
|
-
enqueuePendingMessage(sessionId, message) {
|
|
75
|
-
enqueued.push({ sessionId, message });
|
|
76
|
-
return 1;
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
const delivered = bus.notifyFnForSession('lead-owner')(
|
|
82
|
-
secondText,
|
|
83
|
-
{
|
|
84
|
-
...completionMeta,
|
|
85
|
-
execution_id: 'task-agent-2',
|
|
86
|
-
caller_session_id: 'wrong-session',
|
|
87
|
-
routing_session_id: 'wrong-session',
|
|
88
|
-
},
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
assert.equal(delivered, true);
|
|
92
|
-
assert.equal(enqueued.length, 1);
|
|
93
|
-
assert.equal(enqueued[0].sessionId, 'lead-owner');
|
|
94
|
-
assert.match(String(enqueued[0].message?.content || enqueued[0].message), /worker handoff/);
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
test('runtime notifications stay live before session materialization and bind on reservation', () => {
|
|
98
|
-
const received = [];
|
|
99
|
-
const bus = createNotificationBus({
|
|
100
|
-
listeners: new Set(),
|
|
101
|
-
mgr: { enqueuePendingMessage() { return 1; } },
|
|
102
|
-
});
|
|
103
|
-
const unsubscribe = bus.subscribeRuntimeNotification('', (event) => {
|
|
104
|
-
received.push(event.content);
|
|
105
|
-
event.modelVisibleDelivered = true;
|
|
106
|
-
return true;
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
assert.equal(bus.emitRuntimeNotification('discord-before-first-chat').handled, true);
|
|
110
|
-
assert.deepEqual(received, ['discord-before-first-chat']);
|
|
111
|
-
|
|
112
|
-
assert.equal(bus.bindRuntimeNotificationSession('lead-reserved'), true);
|
|
113
|
-
assert.equal(bus.notifySession('lead-reserved', 'discord-targeted'), true);
|
|
114
|
-
assert.equal(bus.notifySessionCompletion('lead-reserved', completionText, {
|
|
115
|
-
...completionMeta,
|
|
116
|
-
execution_id: 'task-agent-reserved',
|
|
117
|
-
}), true);
|
|
118
|
-
assert.equal(received.length, 3);
|
|
119
|
-
unsubscribe();
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
test('unobserved completion fallback queues and wakes exactly once', () => {
|
|
123
|
-
const enqueued = [];
|
|
124
|
-
const wakeups = [];
|
|
125
|
-
const bus = createNotificationBus({
|
|
126
|
-
listeners: new Set(),
|
|
127
|
-
mgr: {
|
|
128
|
-
enqueuePendingMessage(sessionId, message) {
|
|
129
|
-
enqueued.push({ sessionId, message });
|
|
130
|
-
return 1;
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
onCompletionQueued(info) {
|
|
134
|
-
wakeups.push(info);
|
|
135
|
-
},
|
|
136
|
-
});
|
|
137
|
-
const meta = {
|
|
138
|
-
...completionMeta,
|
|
139
|
-
execution_id: 'task-agent-idempotent',
|
|
140
|
-
};
|
|
141
|
-
const uniqueCompletionText = completionText.replaceAll('task-agent-1', 'task-agent-idempotent');
|
|
142
|
-
assert.equal(bus.notifySessionCompletion('lead-idempotent', uniqueCompletionText, meta), true);
|
|
143
|
-
assert.equal(bus.notifySessionCompletion('lead-idempotent', uniqueCompletionText, meta), true);
|
|
144
|
-
assert.equal(enqueued.length, 1);
|
|
145
|
-
assert.equal(wakeups.length, 1);
|
|
146
|
-
assert.equal(wakeups[0].sessionId, 'lead-idempotent');
|
|
147
|
-
assert.match(enqueued[0].message.id, /^completion_[a-f0-9]{24}$/);
|
|
148
|
-
});
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
3
|
-
import { tmpdir } from 'node:os';
|
|
4
|
-
import { join } from 'node:path';
|
|
5
|
-
import test from 'node:test';
|
|
6
|
-
|
|
7
|
-
import { createMcpGlue } from './mcp-glue.mjs';
|
|
8
|
-
import { createResourceApi } from './resource-api.mjs';
|
|
9
|
-
import {
|
|
10
|
-
mergeMcpServerConfig,
|
|
11
|
-
readProjectMcpServerConfig,
|
|
12
|
-
saveProjectMcpServer,
|
|
13
|
-
} from './plugin-mcp.mjs';
|
|
14
|
-
|
|
15
|
-
test('project MCP edits preserve document shape and unknown fields', () => {
|
|
16
|
-
const cwd = mkdtempSync(join(tmpdir(), 'mixdog-mcp-standard-'));
|
|
17
|
-
try {
|
|
18
|
-
const path = join(cwd, '.mcp.json');
|
|
19
|
-
writeFileSync(path, `${JSON.stringify({
|
|
20
|
-
projectMetadata: { owner: 'test' },
|
|
21
|
-
mcpServers: {
|
|
22
|
-
demo: {
|
|
23
|
-
type: 'stdio',
|
|
24
|
-
command: 'old-command',
|
|
25
|
-
args: ['--old'],
|
|
26
|
-
vendorExtension: { keep: true },
|
|
27
|
-
},
|
|
28
|
-
sibling: { url: 'https://example.com/mcp', custom: 7 },
|
|
29
|
-
},
|
|
30
|
-
}, null, 2)}\n`);
|
|
31
|
-
|
|
32
|
-
saveProjectMcpServer(cwd, {
|
|
33
|
-
originalName: 'demo',
|
|
34
|
-
name: 'renamed',
|
|
35
|
-
config: {
|
|
36
|
-
type: 'http',
|
|
37
|
-
url: 'https://example.com/new-mcp',
|
|
38
|
-
headers: { Authorization: '${MCP_TOKEN}' },
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
const saved = JSON.parse(readFileSync(path, 'utf8'));
|
|
43
|
-
assert.deepEqual(saved.projectMetadata, { owner: 'test' });
|
|
44
|
-
assert.deepEqual(saved.mcpServers.sibling, {
|
|
45
|
-
url: 'https://example.com/mcp',
|
|
46
|
-
custom: 7,
|
|
47
|
-
});
|
|
48
|
-
assert.equal(saved.mcpServers.demo, undefined);
|
|
49
|
-
assert.deepEqual(saved.mcpServers.renamed, {
|
|
50
|
-
vendorExtension: { keep: true },
|
|
51
|
-
type: 'http',
|
|
52
|
-
url: 'https://example.com/new-mcp',
|
|
53
|
-
headers: { Authorization: '${MCP_TOKEN}' },
|
|
54
|
-
});
|
|
55
|
-
assert.deepEqual(readProjectMcpServerConfig(cwd, 'renamed')?.config, saved.mcpServers.renamed);
|
|
56
|
-
} finally {
|
|
57
|
-
rmSync(cwd, { recursive: true, force: true });
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
test('MCP transport edits drop stale transport fields but retain extensions', () => {
|
|
62
|
-
assert.deepEqual(mergeMcpServerConfig({
|
|
63
|
-
type: 'http',
|
|
64
|
-
url: 'https://example.com/mcp',
|
|
65
|
-
headers: { Authorization: 'secret' },
|
|
66
|
-
bearer_token_env_var: 'MCP_TOKEN',
|
|
67
|
-
env_http_headers: { 'X-API-Key': 'MCP_API_KEY' },
|
|
68
|
-
env_vars: ['STALE_STDIO_VALUE'],
|
|
69
|
-
startupTimeoutSec: 20,
|
|
70
|
-
}, {
|
|
71
|
-
type: 'stdio',
|
|
72
|
-
command: 'server',
|
|
73
|
-
args: [],
|
|
74
|
-
}), {
|
|
75
|
-
startupTimeoutSec: 20,
|
|
76
|
-
type: 'stdio',
|
|
77
|
-
command: 'server',
|
|
78
|
-
args: [],
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
test('plugin-disabled MCP cannot be re-enabled by a stale project override', () => {
|
|
83
|
-
const cwd = mkdtempSync(join(tmpdir(), 'mixdog-mcp-plugin-off-'));
|
|
84
|
-
try {
|
|
85
|
-
const config = {
|
|
86
|
-
mcpServers: {
|
|
87
|
-
plugin: {
|
|
88
|
-
command: 'server',
|
|
89
|
-
_mixdogPluginDisabled: true,
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
mcpProjectOverrides: {
|
|
93
|
-
[cwd]: {
|
|
94
|
-
plugin: { enabled: true },
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
};
|
|
98
|
-
const glue = createMcpGlue({
|
|
99
|
-
mcpClient: {
|
|
100
|
-
resolveMcpTransportKind: () => 'stdio',
|
|
101
|
-
getMcpServerStatus: () => [],
|
|
102
|
-
},
|
|
103
|
-
getConfig: () => config,
|
|
104
|
-
getCurrentCwd: () => cwd,
|
|
105
|
-
state: {
|
|
106
|
-
mcpFailures: [],
|
|
107
|
-
mcpConnectGeneration: 0,
|
|
108
|
-
mcpConnectInFlight: null,
|
|
109
|
-
},
|
|
110
|
-
});
|
|
111
|
-
assert.equal(glue.mcpStatus().servers[0]?.enabled, false);
|
|
112
|
-
} finally {
|
|
113
|
-
rmSync(cwd, { recursive: true, force: true });
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
test('MCP toggle updates the global server and ignores project config and overrides', async () => {
|
|
118
|
-
const cwd = mkdtempSync(join(tmpdir(), 'mixdog-mcp-override-'));
|
|
119
|
-
try {
|
|
120
|
-
const path = join(cwd, '.mcp.json');
|
|
121
|
-
writeFileSync(path, `${JSON.stringify({
|
|
122
|
-
mcpServers: {
|
|
123
|
-
local: { command: 'server', enabled: false, extension: 'kept' },
|
|
124
|
-
},
|
|
125
|
-
}, null, 2)}\n`);
|
|
126
|
-
const before = readFileSync(path, 'utf8');
|
|
127
|
-
let config = {
|
|
128
|
-
mcpServers: {
|
|
129
|
-
local: { command: 'global-server', enabled: false, extension: 'kept' },
|
|
130
|
-
},
|
|
131
|
-
mcpProjectOverrides: {
|
|
132
|
-
[cwd]: {
|
|
133
|
-
local: { enabled: false },
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
};
|
|
137
|
-
const api = createResourceApi({
|
|
138
|
-
getConfig: () => config,
|
|
139
|
-
getSession: () => null,
|
|
140
|
-
getCurrentCwd: () => cwd,
|
|
141
|
-
cfgMod: {},
|
|
142
|
-
mgr: {},
|
|
143
|
-
saveConfigAndAdopt: (next) => { config = next; },
|
|
144
|
-
connectConfiguredMcp: async () => ({ servers: [] }),
|
|
145
|
-
invalidatePreSessionToolSurface: () => {},
|
|
146
|
-
recreateCurrentSessionIfReady: async () => {},
|
|
147
|
-
mcpStatus: () => ({ servers: [{ name: 'local', source: 'config' }] }),
|
|
148
|
-
getActiveTurnCount: () => 0,
|
|
149
|
-
});
|
|
150
|
-
await api.setMcpServerEnabled('local', true);
|
|
151
|
-
assert.equal(config.mcpServers.local.enabled, true);
|
|
152
|
-
assert.equal(config.mcpServers.local.extension, 'kept');
|
|
153
|
-
assert.equal(config.mcpProjectOverrides, undefined);
|
|
154
|
-
|
|
155
|
-
const glue = createMcpGlue({
|
|
156
|
-
mcpClient: {
|
|
157
|
-
resolveMcpTransportKind: () => 'stdio',
|
|
158
|
-
getMcpServerStatus: () => [],
|
|
159
|
-
},
|
|
160
|
-
getConfig: () => config,
|
|
161
|
-
getCurrentCwd: () => cwd,
|
|
162
|
-
state: {
|
|
163
|
-
mcpFailures: [],
|
|
164
|
-
mcpConnectGeneration: 0,
|
|
165
|
-
mcpConnectInFlight: null,
|
|
166
|
-
},
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
const row = glue.mcpStatus().servers.find((server) => server.name === 'local');
|
|
170
|
-
assert.equal(row?.source, 'config');
|
|
171
|
-
assert.equal(row?.enabled, true);
|
|
172
|
-
assert.equal(glue.getMcpServerConfig('local').config.command, 'global-server');
|
|
173
|
-
assert.equal(readFileSync(path, 'utf8'), before);
|
|
174
|
-
} finally {
|
|
175
|
-
rmSync(cwd, { recursive: true, force: true });
|
|
176
|
-
}
|
|
177
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import test from 'node:test';
|
|
3
|
-
|
|
4
|
-
import { createPrewarmSchedulers } from './prewarm.mjs';
|
|
5
|
-
|
|
6
|
-
test('first-visible code graph prewarm overlaps an active turn', async () => {
|
|
7
|
-
const timers = {};
|
|
8
|
-
const calls = [];
|
|
9
|
-
const profiles = [];
|
|
10
|
-
const cwd = process.cwd();
|
|
11
|
-
const schedulers = createPrewarmSchedulers({
|
|
12
|
-
timers,
|
|
13
|
-
bootProfile: (event, detail) => profiles.push([event, detail]),
|
|
14
|
-
getCurrentCwd: () => cwd,
|
|
15
|
-
isCloseRequested: () => false,
|
|
16
|
-
getActiveTurnCount: () => 1,
|
|
17
|
-
getSessionCreatePromise: () => null,
|
|
18
|
-
getSession: () => null,
|
|
19
|
-
channelsEnabled: () => false,
|
|
20
|
-
hasActiveAutomation: () => false,
|
|
21
|
-
getCodeGraphModule: async () => ({
|
|
22
|
-
prewarmCodeGraphIfProject(root) {
|
|
23
|
-
calls.push(root);
|
|
24
|
-
return true;
|
|
25
|
-
},
|
|
26
|
-
}),
|
|
27
|
-
createCurrentSession: async () => null,
|
|
28
|
-
channels: {},
|
|
29
|
-
envFlag: () => false,
|
|
30
|
-
delays: {
|
|
31
|
-
codeGraphPrewarmDelayMs: 0,
|
|
32
|
-
channelStartDelayMs: 0,
|
|
33
|
-
backgroundBusyRetryMs: 50,
|
|
34
|
-
},
|
|
35
|
-
flags: { codeGraphPrewarmEnabled: true },
|
|
36
|
-
state: {
|
|
37
|
-
codeGraphPrewarmQueuedCwd: '',
|
|
38
|
-
codeGraphPrewarmInFlight: false,
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
schedulers.scheduleCodeGraphPrewarm(100, 'cwd');
|
|
43
|
-
schedulers.scheduleCodeGraphPrewarm(0, 'first-visible');
|
|
44
|
-
await new Promise((resolve) => setTimeout(resolve, 25));
|
|
45
|
-
|
|
46
|
-
assert.deepEqual(calls, [cwd]);
|
|
47
|
-
assert.equal(
|
|
48
|
-
profiles.some(([event, detail]) =>
|
|
49
|
-
event === 'code-graph:prewarm-deferred' && detail?.reason === 'turn-active'),
|
|
50
|
-
false,
|
|
51
|
-
);
|
|
52
|
-
});
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import test from 'node:test';
|
|
3
|
-
import { snapshotProviderRequestTools } from './provider-request-snapshot.mjs';
|
|
4
|
-
|
|
5
|
-
test('Anthropic deferred tool surface is complete and byte-stable from the first send', () => {
|
|
6
|
-
const session = {
|
|
7
|
-
provider: 'anthropic-oauth',
|
|
8
|
-
deferredNativeTools: true,
|
|
9
|
-
deferredToolCatalog: [
|
|
10
|
-
{ name: 'shell', inputSchema: { type: 'object', properties: {} } },
|
|
11
|
-
{ name: 'recall', inputSchema: { type: 'object', properties: {} } },
|
|
12
|
-
],
|
|
13
|
-
};
|
|
14
|
-
const tools = [{ name: 'load_tool', inputSchema: { type: 'object', properties: {} } }];
|
|
15
|
-
const first = snapshotProviderRequestTools({
|
|
16
|
-
provider: session.provider,
|
|
17
|
-
tools,
|
|
18
|
-
messages: [],
|
|
19
|
-
session,
|
|
20
|
-
});
|
|
21
|
-
const later = snapshotProviderRequestTools({
|
|
22
|
-
provider: session.provider,
|
|
23
|
-
tools,
|
|
24
|
-
messages: [{
|
|
25
|
-
role: 'tool',
|
|
26
|
-
nativeToolSearch: {
|
|
27
|
-
provider: 'anthropic-oauth',
|
|
28
|
-
toolReferences: ['shell'],
|
|
29
|
-
},
|
|
30
|
-
}],
|
|
31
|
-
session,
|
|
32
|
-
});
|
|
33
|
-
assert.deepEqual(JSON.parse(JSON.stringify(later)), JSON.parse(JSON.stringify(first)));
|
|
34
|
-
assert.deepEqual(first.map((tool) => tool.name), ['load_tool', 'shell', 'recall']);
|
|
35
|
-
assert.equal(first[1].deferLoading, true);
|
|
36
|
-
assert.equal(first[2].deferLoading, true);
|
|
37
|
-
});
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import test from 'node:test';
|
|
3
|
-
|
|
4
|
-
import { createResourceApi } from './resource-api.mjs';
|
|
5
|
-
|
|
6
|
-
function resourceApi(overrides = {}) {
|
|
7
|
-
return createResourceApi({
|
|
8
|
-
getConfig: () => ({}),
|
|
9
|
-
getSession: () => null,
|
|
10
|
-
getCurrentCwd: () => process.cwd(),
|
|
11
|
-
cfgMod: {},
|
|
12
|
-
mgr: {},
|
|
13
|
-
hooks: {},
|
|
14
|
-
saveConfigAndAdopt: () => {},
|
|
15
|
-
connectConfiguredMcp: async () => ({ servers: [] }),
|
|
16
|
-
invalidatePreSessionToolSurface: () => {},
|
|
17
|
-
recreateCurrentSessionIfReady: async () => {},
|
|
18
|
-
normalizeMcpServerInput: () => {
|
|
19
|
-
throw new Error('not used');
|
|
20
|
-
},
|
|
21
|
-
mcpStatus: () => ({ servers: [] }),
|
|
22
|
-
skillsStatus: () => ({ skills: [] }),
|
|
23
|
-
pluginsStatus: () => ({ plugins: [] }),
|
|
24
|
-
reloadFullConfig: () => {},
|
|
25
|
-
getActiveTurnCount: () => 0,
|
|
26
|
-
...overrides,
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
test('a global MCP toggle reloads and reconnects peer session runtimes', async () => {
|
|
31
|
-
let persisted = {
|
|
32
|
-
mcpServers: {
|
|
33
|
-
demo: { type: 'stdio', command: 'demo', enabled: true },
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
let writerConfig = structuredClone(persisted);
|
|
37
|
-
let peerConfig = structuredClone(persisted);
|
|
38
|
-
let peerReloads = 0;
|
|
39
|
-
let peerConnects = 0;
|
|
40
|
-
const writer = resourceApi({
|
|
41
|
-
getConfig: () => writerConfig,
|
|
42
|
-
saveConfigAndAdopt: (next) => {
|
|
43
|
-
writerConfig = structuredClone(next);
|
|
44
|
-
persisted = structuredClone(next);
|
|
45
|
-
},
|
|
46
|
-
mcpStatus: () => ({ servers: [{ name: 'demo', source: 'config' }] }),
|
|
47
|
-
});
|
|
48
|
-
const peer = resourceApi({
|
|
49
|
-
getConfig: () => peerConfig,
|
|
50
|
-
reloadFullConfig: () => {
|
|
51
|
-
peerReloads += 1;
|
|
52
|
-
peerConfig = structuredClone(persisted);
|
|
53
|
-
},
|
|
54
|
-
connectConfiguredMcp: async () => {
|
|
55
|
-
peerConnects += 1;
|
|
56
|
-
return { servers: [] };
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
try {
|
|
60
|
-
await writer.setMcpServerEnabled('demo', false);
|
|
61
|
-
assert.equal(writerConfig.mcpServers.demo.enabled, false);
|
|
62
|
-
assert.equal(peerConfig.mcpServers.demo.enabled, false);
|
|
63
|
-
assert.equal(peerReloads, 1);
|
|
64
|
-
assert.equal(peerConnects, 1);
|
|
65
|
-
} finally {
|
|
66
|
-
writer.disposeGlobalExtensionSubscription();
|
|
67
|
-
peer.disposeGlobalExtensionSubscription();
|
|
68
|
-
}
|
|
69
|
-
});
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import { test } from 'node:test';
|
|
3
|
-
import { makeResolveRoute } from './config-helpers.mjs';
|
|
4
|
-
import { resolveRouteContextState, resolveRouteEffortState } from './session-lifecycle.mjs';
|
|
5
|
-
import { inheritanceContextFit } from './lifecycle-api.mjs';
|
|
6
|
-
|
|
7
|
-
test('cold route metadata preserves persisted effort and enabled Fast mode', () => {
|
|
8
|
-
assert.deepEqual(resolveRouteEffortState({
|
|
9
|
-
provider: 'cursor-oauth',
|
|
10
|
-
model: 'kimi-k3',
|
|
11
|
-
effort: 'high',
|
|
12
|
-
fast: true,
|
|
13
|
-
}, {
|
|
14
|
-
id: 'kimi-k3',
|
|
15
|
-
provider: 'cursor-oauth',
|
|
16
|
-
}), {
|
|
17
|
-
effectiveEffort: 'high',
|
|
18
|
-
fastCapable: true,
|
|
19
|
-
metadataResolved: false,
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
test('resolved route metadata remains authoritative for effort and Fast support', () => {
|
|
24
|
-
assert.deepEqual(resolveRouteEffortState({
|
|
25
|
-
provider: 'cursor-oauth',
|
|
26
|
-
model: 'kimi-k3',
|
|
27
|
-
effort: 'max',
|
|
28
|
-
fast: true,
|
|
29
|
-
}, {
|
|
30
|
-
id: 'kimi-k3',
|
|
31
|
-
provider: 'cursor-oauth',
|
|
32
|
-
reasoningLevels: ['high'],
|
|
33
|
-
fastCapable: false,
|
|
34
|
-
fastEfforts: [],
|
|
35
|
-
}), {
|
|
36
|
-
effectiveEffort: 'high',
|
|
37
|
-
fastCapable: false,
|
|
38
|
-
metadataResolved: true,
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
test('resolved Cursor parameter variants validate Fast for the selected effort', () => {
|
|
43
|
-
assert.deepEqual(resolveRouteEffortState({
|
|
44
|
-
provider: 'cursor-oauth',
|
|
45
|
-
model: 'gpt-5.6-sol',
|
|
46
|
-
effort: 'high',
|
|
47
|
-
fast: true,
|
|
48
|
-
modelParameters: { context: '272k' },
|
|
49
|
-
}, {
|
|
50
|
-
id: 'gpt-5.6-sol',
|
|
51
|
-
provider: 'cursor-oauth',
|
|
52
|
-
reasoningLevels: ['high', 'max'],
|
|
53
|
-
fastCapable: true,
|
|
54
|
-
fastEfforts: ['high'],
|
|
55
|
-
parameterVariants: [
|
|
56
|
-
{ effort: 'high', fast: 'true', context: '272k' },
|
|
57
|
-
{ effort: 'max', fast: 'false', context: '272k' },
|
|
58
|
-
],
|
|
59
|
-
}), {
|
|
60
|
-
effectiveEffort: 'high',
|
|
61
|
-
fastCapable: true,
|
|
62
|
-
metadataResolved: true,
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
test('context percentage uses a model default and ten-point steps', () => {
|
|
67
|
-
assert.deepEqual(resolveRouteContextState({}, {
|
|
68
|
-
contextWindow: 200_000,
|
|
69
|
-
maxContextWindow: 1_000_000,
|
|
70
|
-
}), {
|
|
71
|
-
contextPercent: 20,
|
|
72
|
-
contextDefaultPercent: 20,
|
|
73
|
-
selectedContextWindow: 200_000,
|
|
74
|
-
});
|
|
75
|
-
assert.deepEqual(resolveRouteContextState({ contextPercent: 34 }, {
|
|
76
|
-
contextWindow: 200_000,
|
|
77
|
-
maxContextWindow: 1_000_000,
|
|
78
|
-
}), {
|
|
79
|
-
contextPercent: 30,
|
|
80
|
-
contextDefaultPercent: 20,
|
|
81
|
-
selectedContextWindow: 300_000,
|
|
82
|
-
});
|
|
83
|
-
assert.deepEqual(resolveRouteContextState({ contextPercent: null }, {
|
|
84
|
-
contextWindow: 200_000,
|
|
85
|
-
maxContextWindow: 1_000_000,
|
|
86
|
-
}), {
|
|
87
|
-
contextPercent: 20,
|
|
88
|
-
contextDefaultPercent: 20,
|
|
89
|
-
selectedContextWindow: 200_000,
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
test('route config treats a cleared context percentage as model-default intent', () => {
|
|
94
|
-
const resolveRoute = makeResolveRoute(() => 'cursor-oauth');
|
|
95
|
-
assert.equal(resolveRoute({
|
|
96
|
-
modelSettings: {
|
|
97
|
-
'cursor-oauth/gpt-5.4': { contextPercent: null },
|
|
98
|
-
},
|
|
99
|
-
}, {
|
|
100
|
-
provider: 'cursor-oauth',
|
|
101
|
-
model: 'gpt-5.4',
|
|
102
|
-
}).contextPercent, undefined);
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
test('session inheritance uses the selected model compaction boundary as its fit guard', () => {
|
|
106
|
-
assert.deepEqual(inheritanceContextFit({
|
|
107
|
-
usedTokens: 80_000,
|
|
108
|
-
contextWindow: 200_000,
|
|
109
|
-
compaction: {
|
|
110
|
-
pressureTokens: 95_000,
|
|
111
|
-
triggerTokens: 100_000,
|
|
112
|
-
},
|
|
113
|
-
}), {
|
|
114
|
-
known: true,
|
|
115
|
-
fits: true,
|
|
116
|
-
used: 95_000,
|
|
117
|
-
limit: 100_000,
|
|
118
|
-
});
|
|
119
|
-
assert.equal(inheritanceContextFit({
|
|
120
|
-
compaction: {
|
|
121
|
-
pressureTokens: 100_000,
|
|
122
|
-
triggerTokens: 100_000,
|
|
123
|
-
},
|
|
124
|
-
}).fits, false);
|
|
125
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import test from 'node:test';
|
|
3
|
-
|
|
4
|
-
import { createSessionTitleController } from './session-title.mjs';
|
|
5
|
-
|
|
6
|
-
test('first-turn LLM title waits until visible assistant progress', async () => {
|
|
7
|
-
let release;
|
|
8
|
-
const after = new Promise((resolve) => { release = resolve; });
|
|
9
|
-
const generated = [];
|
|
10
|
-
const promoted = [];
|
|
11
|
-
const controller = createSessionTitleController({
|
|
12
|
-
dataRoot: () => '',
|
|
13
|
-
generateSessionTitle: async (source) => {
|
|
14
|
-
generated.push(source);
|
|
15
|
-
return 'Deferred title';
|
|
16
|
-
},
|
|
17
|
-
promoteGeneratedTitle: async (...args) => {
|
|
18
|
-
promoted.push(args);
|
|
19
|
-
return true;
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
assert.equal(controller.scheduleFirst(
|
|
24
|
-
{ id: 'session-title-deferred', messages: [] },
|
|
25
|
-
'Investigate cold-start latency',
|
|
26
|
-
{ after },
|
|
27
|
-
), true);
|
|
28
|
-
await Promise.resolve();
|
|
29
|
-
assert.deepEqual(generated, []);
|
|
30
|
-
|
|
31
|
-
release();
|
|
32
|
-
await new Promise((resolve) => setImmediate(resolve));
|
|
33
|
-
assert.deepEqual(generated, ['Investigate cold-start latency']);
|
|
34
|
-
assert.deepEqual(promoted, [['session-title-deferred', 'Deferred title', 'first']]);
|
|
35
|
-
controller.disposeAll();
|
|
36
|
-
});
|