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,33 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import {
|
|
3
|
-
mkdtempSync,
|
|
4
|
-
readFileSync,
|
|
5
|
-
readdirSync,
|
|
6
|
-
rmSync,
|
|
7
|
-
} from 'node:fs';
|
|
8
|
-
import { tmpdir } from 'node:os';
|
|
9
|
-
import { join } from 'node:path';
|
|
10
|
-
import { test } from 'node:test';
|
|
11
|
-
|
|
12
|
-
test('update checks publish one parseable atomic cache file', async () => {
|
|
13
|
-
const root = mkdtempSync(join(tmpdir(), 'mixdog-update-cache-'));
|
|
14
|
-
const previousFetch = globalThis.fetch;
|
|
15
|
-
globalThis.fetch = async () => ({
|
|
16
|
-
ok: true,
|
|
17
|
-
json: async () => ({ version: '999.0.0' }),
|
|
18
|
-
});
|
|
19
|
-
try {
|
|
20
|
-
const checker = await import(`./update-checker.mjs?test=${Date.now()}`);
|
|
21
|
-
const result = await checker.checkLatestVersion({ force: true, dataDir: root });
|
|
22
|
-
assert.equal(result.latestVersion, '999.0.0');
|
|
23
|
-
const names = readdirSync(root);
|
|
24
|
-
assert.deepEqual(names, ['update-check-cache.json']);
|
|
25
|
-
assert.deepEqual(
|
|
26
|
-
JSON.parse(readFileSync(join(root, 'update-check-cache.json'), 'utf8')),
|
|
27
|
-
{ latestVersion: '999.0.0', lastCheckedAt: result.lastCheckedAt },
|
|
28
|
-
);
|
|
29
|
-
} finally {
|
|
30
|
-
globalThis.fetch = previousFetch;
|
|
31
|
-
rmSync(root, { recursive: true, force: true });
|
|
32
|
-
}
|
|
33
|
-
});
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import { mkdtempSync, mkdirSync, 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 {
|
|
8
|
-
explicitSessionCwd,
|
|
9
|
-
pwd,
|
|
10
|
-
runWithCwdOverride,
|
|
11
|
-
updateCurrentCwdOverride,
|
|
12
|
-
} from './user-cwd.mjs';
|
|
13
|
-
|
|
14
|
-
test('cwd overrides stay isolated across concurrent inline sessions', async () => {
|
|
15
|
-
const root = mkdtempSync(join(tmpdir(), 'mixdog-user-cwd-'));
|
|
16
|
-
const a = join(root, 'a');
|
|
17
|
-
const b = join(root, 'b');
|
|
18
|
-
const next = join(root, 'next');
|
|
19
|
-
mkdirSync(a);
|
|
20
|
-
mkdirSync(b);
|
|
21
|
-
mkdirSync(next);
|
|
22
|
-
try {
|
|
23
|
-
await Promise.all([
|
|
24
|
-
runWithCwdOverride(a, async () => {
|
|
25
|
-
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
26
|
-
assert.equal(pwd(), a);
|
|
27
|
-
assert.equal(explicitSessionCwd(), a);
|
|
28
|
-
assert.equal(updateCurrentCwdOverride(next), true);
|
|
29
|
-
await new Promise((resolve) => setImmediate(resolve));
|
|
30
|
-
assert.equal(pwd(), next);
|
|
31
|
-
assert.equal(explicitSessionCwd(), next);
|
|
32
|
-
}),
|
|
33
|
-
runWithCwdOverride(b, async () => {
|
|
34
|
-
assert.equal(pwd(), b);
|
|
35
|
-
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
36
|
-
assert.equal(pwd(), b);
|
|
37
|
-
assert.equal(explicitSessionCwd(), b);
|
|
38
|
-
}),
|
|
39
|
-
]);
|
|
40
|
-
} finally {
|
|
41
|
-
rmSync(root, { recursive: true, force: true });
|
|
42
|
-
}
|
|
43
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import test from 'node:test';
|
|
3
|
-
|
|
4
|
-
import { previewSessionTools } from '../agent/orchestrator/session/manager/tool-resolution.mjs';
|
|
5
|
-
import { WEBHOOK_SESSION_TOOLS } from './webhook-session-run.mjs';
|
|
6
|
-
|
|
7
|
-
test('webhook sessions expose only the deterministic read-only tool bundle', () => {
|
|
8
|
-
assert.deepEqual(WEBHOOK_SESSION_TOOLS, ['tools:readonly']);
|
|
9
|
-
const names = previewSessionTools(WEBHOOK_SESSION_TOOLS, []).map((tool) => tool.name);
|
|
10
|
-
assert.deepEqual(names, ['find', 'glob', 'list', 'grep', 'code_graph', 'read']);
|
|
11
|
-
for (const forbidden of ['shell', 'task', 'git', 'apply_patch', 'agent', 'memory']) {
|
|
12
|
-
assert.equal(names.includes(forbidden), false, `${forbidden} must stay unavailable to webhook sessions`);
|
|
13
|
-
}
|
|
14
|
-
});
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
// "Not used" is a first-class agent state: the role must disappear from the
|
|
2
|
-
// Lead surface, refuse maintenance dispatch, and keep its stored model so
|
|
3
|
-
// switching it back on restores the user's pick. Web Search is the only route
|
|
4
|
-
// that still means "follow the Main Model" when left unset.
|
|
5
|
-
import test from 'node:test';
|
|
6
|
-
import assert from 'node:assert/strict';
|
|
7
|
-
import { mkdirSync, mkdtempSync, writeFileSync } from 'node:fs';
|
|
8
|
-
import { tmpdir } from 'node:os';
|
|
9
|
-
import { join } from 'node:path';
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
canonicalizeAgentRouteStorage,
|
|
13
|
-
disabledAgentIds,
|
|
14
|
-
isAgentDisabled,
|
|
15
|
-
withAgentDisabled,
|
|
16
|
-
} from '../runtime/shared/agent-route-config.mjs';
|
|
17
|
-
import {
|
|
18
|
-
createWorkflowHelpers,
|
|
19
|
-
isDefaultWebSearchRouteConfig,
|
|
20
|
-
isWebSearchCapableProvider,
|
|
21
|
-
normalizeWebSearchProviderId,
|
|
22
|
-
normalizeWebSearchRouteConfig,
|
|
23
|
-
} from './workflow.mjs';
|
|
24
|
-
import { createNativeWebSearch } from './native-web-search.mjs';
|
|
25
|
-
import { resolveMaintenanceRoute } from '../runtime/agent/orchestrator/agent-runtime/maintenance-route.mjs';
|
|
26
|
-
|
|
27
|
-
function fixture(agentIds = ['worker', 'reviewer']) {
|
|
28
|
-
const root = mkdtempSync(join(tmpdir(), 'mixdog-agent-off-'));
|
|
29
|
-
const data = join(root, 'data');
|
|
30
|
-
mkdirSync(join(root, 'workflows', 'default'), { recursive: true });
|
|
31
|
-
writeFileSync(join(root, 'workflows', 'default', 'WORKFLOW.md'), '# Default\n\nLead delegates.\n');
|
|
32
|
-
for (const id of agentIds) {
|
|
33
|
-
mkdirSync(join(root, 'agents', id), { recursive: true });
|
|
34
|
-
writeFileSync(join(root, 'agents', id, 'AGENT.md'), `# ${id}\n\nDoes ${id} work.\n`);
|
|
35
|
-
}
|
|
36
|
-
mkdirSync(data, { recursive: true });
|
|
37
|
-
const helpers = createWorkflowHelpers({
|
|
38
|
-
rootDir: root,
|
|
39
|
-
dataDir: data,
|
|
40
|
-
readMarkdownDocument: (text) => ({ body: String(text || ''), frontmatter: {} }),
|
|
41
|
-
normalizeAgentPermissionOrNone: () => null,
|
|
42
|
-
});
|
|
43
|
-
return { root, data, helpers };
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
test('disabled agents are stored apart from the route and survive canonicalization', () => {
|
|
47
|
-
const config = { agents: { worker: { provider: 'anthropic-oauth', model: 'claude-opus-5' } } };
|
|
48
|
-
const off = canonicalizeAgentRouteStorage(withAgentDisabled(config, 'worker', true));
|
|
49
|
-
assert.deepEqual(disabledAgentIds(off), ['worker']);
|
|
50
|
-
assert.equal(isAgentDisabled(off, 'worker'), true);
|
|
51
|
-
// The pinned model is retained, so turning the agent back on restores it.
|
|
52
|
-
assert.deepEqual(off.agents.worker, { provider: 'anthropic-oauth', model: 'claude-opus-5' });
|
|
53
|
-
|
|
54
|
-
const on = canonicalizeAgentRouteStorage(withAgentDisabled(off, 'worker', false));
|
|
55
|
-
assert.equal(isAgentDisabled(on, 'worker'), false);
|
|
56
|
-
assert.equal(Object.prototype.hasOwnProperty.call(on, 'disabledAgents'), false);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
test('a disabled agent leaves the Lead prompt and the delegation surface', () => {
|
|
60
|
-
const { data, helpers } = fixture(['worker', 'reviewer']);
|
|
61
|
-
// The shipped fallback is Solo, so a delegating pack is selected explicitly.
|
|
62
|
-
const cowork = (extra = {}) => ({ workflow: { active: 'default' }, ...extra });
|
|
63
|
-
const enabled = helpers.activeWorkflowContext(cowork(), data);
|
|
64
|
-
assert.match(enabled.context, /# Available Agents/);
|
|
65
|
-
assert.match(enabled.context, /\(worker\)/);
|
|
66
|
-
assert.equal(enabled.summary.delegatesAgents, true);
|
|
67
|
-
|
|
68
|
-
const partial = helpers.activeWorkflowContext(cowork({ disabledAgents: ['worker'] }), data);
|
|
69
|
-
assert.equal(partial.context.includes('(worker)'), false);
|
|
70
|
-
assert.match(partial.context, /\(reviewer\)/);
|
|
71
|
-
assert.equal(partial.summary.delegatesAgents, true);
|
|
72
|
-
|
|
73
|
-
// Nobody left to delegate to: the agent tool drops exactly as it does for a
|
|
74
|
-
// non-delegating pack.
|
|
75
|
-
const none = helpers.activeWorkflowContext(cowork({ disabledAgents: ['worker', 'reviewer'] }), data);
|
|
76
|
-
assert.equal(none.context.includes('# Available Agents'), false);
|
|
77
|
-
assert.equal(none.summary.delegatesAgents, false);
|
|
78
|
-
assert.deepEqual(helpers.delegatableAgentIds({ disabledAgents: ['worker'] }, data), ['reviewer']);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
test('a disabled maintainer stops maintenance dispatch instead of falling back to Main', () => {
|
|
82
|
-
const base = {
|
|
83
|
-
default: { provider: 'anthropic-oauth', model: 'claude-opus-5' },
|
|
84
|
-
agents: { maintainer: { provider: 'gemini', model: 'gemini-3-pro' } },
|
|
85
|
-
};
|
|
86
|
-
assert.deepEqual(
|
|
87
|
-
resolveMaintenanceRoute({ agent: 'title-agent', config: base }),
|
|
88
|
-
{ provider: 'gemini', model: 'gemini-3-pro', effort: undefined, fast: false },
|
|
89
|
-
);
|
|
90
|
-
assert.equal(
|
|
91
|
-
resolveMaintenanceRoute({ agent: 'title-agent', config: withAgentDisabled(base, 'maintainer', true) }),
|
|
92
|
-
null,
|
|
93
|
-
);
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
test('an unset web-search route resolves to the Main Model instead of failing', async () => {
|
|
97
|
-
const route = { provider: 'anthropic-oauth', model: 'claude-opus-5', effort: 'xhigh' };
|
|
98
|
-
let stored = null;
|
|
99
|
-
const { nativeWebSearchRoutes } = createNativeWebSearch({
|
|
100
|
-
getRoute: () => route,
|
|
101
|
-
getWebSearchRoute: () => stored,
|
|
102
|
-
setWebSearchRoute: (next) => { stored = next; },
|
|
103
|
-
getConfig: () => ({}),
|
|
104
|
-
getSession: () => null,
|
|
105
|
-
getReg: () => ({}),
|
|
106
|
-
ensureFullConfig: () => ({}),
|
|
107
|
-
awaitKeychainPrewarm: async () => {},
|
|
108
|
-
ensureProvidersReady: async () => {},
|
|
109
|
-
ensureProviderEnabled: (config) => config,
|
|
110
|
-
normalizeWebSearchProviderId,
|
|
111
|
-
normalizeWebSearchRouteConfig,
|
|
112
|
-
isDefaultWebSearchRouteConfig,
|
|
113
|
-
isWebSearchCapableProvider,
|
|
114
|
-
webSearchCapableFor: () => true,
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
const candidates = await nativeWebSearchRoutes();
|
|
118
|
-
assert.equal(candidates.length, 1);
|
|
119
|
-
assert.equal(candidates[0].source, 'default-web-search-route');
|
|
120
|
-
assert.equal(candidates[0].provider, 'anthropic-oauth');
|
|
121
|
-
assert.equal(candidates[0].model, 'claude-opus-5');
|
|
122
|
-
assert.equal(isDefaultWebSearchRouteConfig(stored), true);
|
|
123
|
-
});
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import { mkdtempSync, mkdirSync, rmSync, statSync } from 'node:fs';
|
|
3
|
-
import { tmpdir } from 'node:os';
|
|
4
|
-
import { resolve, join } from 'node:path';
|
|
5
|
-
import test from 'node:test';
|
|
6
|
-
|
|
7
|
-
import { createCwdPlugins } from './cwd-plugins.mjs';
|
|
8
|
-
|
|
9
|
-
test('explicit cwd selection persists execution cwd and desktop project metadata together', () => {
|
|
10
|
-
const root = mkdtempSync(join(tmpdir(), 'mixdog-cwd-persist-'));
|
|
11
|
-
const before = join(root, 'before');
|
|
12
|
-
const after = join(root, 'after');
|
|
13
|
-
mkdirSync(before);
|
|
14
|
-
mkdirSync(after);
|
|
15
|
-
let currentCwd = before;
|
|
16
|
-
let desktopSession = { classification: 'project', projectPath: before };
|
|
17
|
-
const session = {
|
|
18
|
-
id: 'sess-cwd-persist',
|
|
19
|
-
cwd: before,
|
|
20
|
-
desktopSession,
|
|
21
|
-
clientHostPid: 4321,
|
|
22
|
-
};
|
|
23
|
-
const persisted = [];
|
|
24
|
-
const sentinels = [];
|
|
25
|
-
const overrides = [];
|
|
26
|
-
try {
|
|
27
|
-
const { applyResolvedCwd } = createCwdPlugins({
|
|
28
|
-
getCurrentCwd: () => currentCwd,
|
|
29
|
-
setCurrentCwd: (next) => { currentCwd = next; },
|
|
30
|
-
getConfig: () => ({}),
|
|
31
|
-
getSession: () => session,
|
|
32
|
-
getDesktopSession: () => desktopSession,
|
|
33
|
-
setDesktopSession: (next) => { desktopSession = next; },
|
|
34
|
-
getRoute: () => ({}),
|
|
35
|
-
isCodeGraphPrewarmLazy: () => true,
|
|
36
|
-
isCodeGraphFirstTurnPrewarmDone: () => false,
|
|
37
|
-
getCodeGraphPrewarmDelayMs: () => 0,
|
|
38
|
-
setSessionNeedsCwdRefresh: () => {},
|
|
39
|
-
scheduleCodeGraphPrewarm: () => {},
|
|
40
|
-
hooks: { dispatch: async () => {} },
|
|
41
|
-
hookCommonPayload: (value) => value,
|
|
42
|
-
bootProfile: () => {},
|
|
43
|
-
getMemoryModule: async () => null,
|
|
44
|
-
listRegisteredPlugins: () => [],
|
|
45
|
-
pluginAdminStatus: () => ({}),
|
|
46
|
-
pluginManifest: () => ({}),
|
|
47
|
-
pluginMcpServerName: () => '',
|
|
48
|
-
mcpScriptForPlugin: () => '',
|
|
49
|
-
countSkillFiles: () => 0,
|
|
50
|
-
writeLastSessionCwd: (cwd, pid) => sentinels.push({ cwd, pid }),
|
|
51
|
-
updateCurrentCwdOverride: (cwd) => overrides.push(cwd),
|
|
52
|
-
persistSession: (value) => persisted.push(structuredClone(value)),
|
|
53
|
-
clean: (value) => String(value || '').trim(),
|
|
54
|
-
resolve,
|
|
55
|
-
statSync,
|
|
56
|
-
existsSync: () => false,
|
|
57
|
-
cfgMod: {},
|
|
58
|
-
STANDALONE_DATA_DIR: root,
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
applyResolvedCwd(after, { persistProjectSelection: true });
|
|
62
|
-
|
|
63
|
-
assert.equal(currentCwd, after);
|
|
64
|
-
assert.equal(session.cwd, after);
|
|
65
|
-
assert.deepEqual(desktopSession, { classification: 'project', projectPath: after });
|
|
66
|
-
assert.deepEqual(session.desktopSession, desktopSession);
|
|
67
|
-
assert.equal(persisted.length, 1);
|
|
68
|
-
assert.equal(persisted[0].cwd, after);
|
|
69
|
-
assert.deepEqual(persisted[0].desktopSession, desktopSession);
|
|
70
|
-
assert.deepEqual(sentinels, [{ cwd: after, pid: 4321 }]);
|
|
71
|
-
assert.deepEqual(overrides, [after]);
|
|
72
|
-
} finally {
|
|
73
|
-
rmSync(root, { recursive: true, force: true });
|
|
74
|
-
}
|
|
75
|
-
});
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import { mkdtempSync, mkdirSync, rmSync } from 'node:fs';
|
|
3
|
-
import { tmpdir } from 'node:os';
|
|
4
|
-
import { join } from 'node:path';
|
|
5
|
-
import test from 'node:test';
|
|
6
|
-
import { createMixdogSessionRuntime } from './runtime-core.mjs';
|
|
7
|
-
import { executeTool } from '../runtime/agent/orchestrator/session/loop/tool-exec.mjs';
|
|
8
|
-
|
|
9
|
-
test('cwd internal tool stays bound to its caller when another runtime owns the shared executor', async (t) => {
|
|
10
|
-
const root = mkdtempSync(join(tmpdir(), 'mixdog-cwd-routing-'));
|
|
11
|
-
const cwdA = join(root, 'a');
|
|
12
|
-
const cwdB = join(root, 'b');
|
|
13
|
-
const cwdNext = join(root, 'next');
|
|
14
|
-
mkdirSync(cwdA);
|
|
15
|
-
mkdirSync(cwdB);
|
|
16
|
-
mkdirSync(cwdNext);
|
|
17
|
-
const previousProcessCwd = process.env.MIXDOG_SESSION_CWD;
|
|
18
|
-
process.env.MIXDOG_SESSION_CWD = 'process-global-must-not-change';
|
|
19
|
-
|
|
20
|
-
const runtimeA = await createMixdogSessionRuntime({ cwd: cwdA, toolMode: 'full' });
|
|
21
|
-
const runtimeB = await createMixdogSessionRuntime({ cwd: cwdB, toolMode: 'full' });
|
|
22
|
-
t.after(async () => {
|
|
23
|
-
await Promise.allSettled([
|
|
24
|
-
runtimeA.close('cwd-routing-test', { waitForExit: false }),
|
|
25
|
-
runtimeB.close('cwd-routing-test', { waitForExit: false }),
|
|
26
|
-
]);
|
|
27
|
-
if (previousProcessCwd === undefined) delete process.env.MIXDOG_SESSION_CWD;
|
|
28
|
-
else process.env.MIXDOG_SESSION_CWD = previousProcessCwd;
|
|
29
|
-
rmSync(root, { recursive: true, force: true });
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
// runtimeB registered the process-global internal-tool executor last. The
|
|
33
|
-
// call still belongs to runtimeA and must neither report nor mutate B.
|
|
34
|
-
const callerSession = {
|
|
35
|
-
id: 'sess_cwd_caller_a',
|
|
36
|
-
cwd: cwdA,
|
|
37
|
-
_applyResolvedCwdForCaller: (nextCwd) => runtimeA.setCwd(nextCwd),
|
|
38
|
-
};
|
|
39
|
-
const getResult = JSON.parse(await executeTool(
|
|
40
|
-
'cwd',
|
|
41
|
-
{},
|
|
42
|
-
cwdA,
|
|
43
|
-
callerSession.id,
|
|
44
|
-
callerSession,
|
|
45
|
-
));
|
|
46
|
-
assert.equal(getResult.cwd, cwdA);
|
|
47
|
-
assert.equal(getResult.sessionId, callerSession.id);
|
|
48
|
-
|
|
49
|
-
const setResult = JSON.parse(await executeTool(
|
|
50
|
-
'cwd',
|
|
51
|
-
{ path: cwdNext },
|
|
52
|
-
cwdA,
|
|
53
|
-
callerSession.id,
|
|
54
|
-
callerSession,
|
|
55
|
-
));
|
|
56
|
-
assert.equal(setResult.cwd, cwdNext);
|
|
57
|
-
assert.equal(setResult.sessionId, callerSession.id);
|
|
58
|
-
assert.equal(runtimeA.cwd, cwdNext);
|
|
59
|
-
assert.equal(runtimeB.cwd, cwdB);
|
|
60
|
-
assert.equal(process.env.MIXDOG_SESSION_CWD, 'process-global-must-not-change');
|
|
61
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import test from 'node:test';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
publishGlobalExtensionChange,
|
|
6
|
-
subscribeGlobalExtensionChanges,
|
|
7
|
-
} from './global-extensions.mjs';
|
|
8
|
-
|
|
9
|
-
test('global extension changes fan out to every runtime except the writer', async () => {
|
|
10
|
-
const events = [];
|
|
11
|
-
const writer = subscribeGlobalExtensionChanges((kind) => events.push(['writer', kind]));
|
|
12
|
-
const peer = subscribeGlobalExtensionChanges((kind) => events.push(['peer', kind]));
|
|
13
|
-
try {
|
|
14
|
-
await publishGlobalExtensionChange('mcp', writer.id);
|
|
15
|
-
assert.deepEqual(events, [['peer', 'mcp']]);
|
|
16
|
-
} finally {
|
|
17
|
-
writer.unsubscribe();
|
|
18
|
-
peer.unsubscribe();
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
test('unsubscribed runtimes stop receiving global extension changes', async () => {
|
|
23
|
-
const events = [];
|
|
24
|
-
const runtime = subscribeGlobalExtensionChanges((kind) => events.push(kind));
|
|
25
|
-
runtime.unsubscribe();
|
|
26
|
-
await publishGlobalExtensionChange('skills');
|
|
27
|
-
assert.deepEqual(events, []);
|
|
28
|
-
});
|
|
@@ -1,108 +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 {
|
|
8
|
-
createGoalRuntime,
|
|
9
|
-
DEFAULT_GOAL_TIME_LIMIT_MS,
|
|
10
|
-
parseGoalDuration,
|
|
11
|
-
} from './goal-runtime.mjs';
|
|
12
|
-
|
|
13
|
-
test('Goal runtime persists criteria, enforces completion evidence, and archives after user input', async () => {
|
|
14
|
-
const dataDir = mkdtempSync(join(tmpdir(), 'mixdog-goal-'));
|
|
15
|
-
let clock = 1_800_000_000_000;
|
|
16
|
-
const runtime = createGoalRuntime({ dataDir, now: () => clock });
|
|
17
|
-
try {
|
|
18
|
-
const created = await runtime.control('sess_goal_main', {
|
|
19
|
-
command: 'Ship Goal mode --time 2h',
|
|
20
|
-
});
|
|
21
|
-
assert.equal(created.goal.status, 'active');
|
|
22
|
-
assert.equal(created.goal.timeLimitMs, 2 * 60 * 60 * 1000);
|
|
23
|
-
assert.equal(created.goal.criteriaTotal, 0);
|
|
24
|
-
|
|
25
|
-
const criteria = [
|
|
26
|
-
{ text: 'State is durable', satisfied: true, evidence: 'persistence test passed' },
|
|
27
|
-
{ text: 'Idle continuation works', satisfied: false, evidence: '' },
|
|
28
|
-
];
|
|
29
|
-
await runtime.executeTool('update_goal', {
|
|
30
|
-
success_criteria: criteria,
|
|
31
|
-
progress_summary: 'State complete; continuation remains.',
|
|
32
|
-
}, { callerSessionId: 'sess_goal_main' });
|
|
33
|
-
|
|
34
|
-
await assert.rejects(
|
|
35
|
-
runtime.executeTool('update_goal', {
|
|
36
|
-
status: 'complete',
|
|
37
|
-
completion_evidence: 'partial evidence',
|
|
38
|
-
}, { callerSessionId: 'sess_goal_main' }),
|
|
39
|
-
/success criteria remain unsatisfied/,
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
clock += 12 * 60 * 1000;
|
|
43
|
-
const completedCriteria = criteria.map((criterion) => ({
|
|
44
|
-
...criterion,
|
|
45
|
-
satisfied: true,
|
|
46
|
-
evidence: criterion.evidence || 'continuation test passed',
|
|
47
|
-
}));
|
|
48
|
-
const completedText = await runtime.executeTool('update_goal', {
|
|
49
|
-
success_criteria: completedCriteria,
|
|
50
|
-
status: 'complete',
|
|
51
|
-
completion_evidence: 'All required checks passed.',
|
|
52
|
-
}, { callerSessionId: 'sess_goal_main' });
|
|
53
|
-
const completed = JSON.parse(completedText).goal;
|
|
54
|
-
assert.equal(completed.status, 'complete');
|
|
55
|
-
assert.equal(completed.criteriaCompleted, 2);
|
|
56
|
-
assert.equal(completed.timeUsedMs, 12 * 60 * 1000);
|
|
57
|
-
|
|
58
|
-
await runtime.archiveCompletedOnUserInput('sess_goal_main');
|
|
59
|
-
assert.equal(runtime.snapshot('sess_goal_main'), null);
|
|
60
|
-
assert.equal(runtime.storedSnapshot('sess_goal_main').status, 'complete');
|
|
61
|
-
|
|
62
|
-
const reloaded = createGoalRuntime({ dataDir, now: () => clock });
|
|
63
|
-
try {
|
|
64
|
-
assert.equal(reloaded.snapshot('sess_goal_main'), null);
|
|
65
|
-
assert.equal(reloaded.storedSnapshot('sess_goal_main').completionEvidence, 'All required checks passed.');
|
|
66
|
-
} finally {
|
|
67
|
-
reloaded.close();
|
|
68
|
-
}
|
|
69
|
-
} finally {
|
|
70
|
-
runtime.close();
|
|
71
|
-
rmSync(dataDir, { recursive: true, force: true });
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
test('Goal continuation parks only for active agent work and the deadline limits new turns', async () => {
|
|
76
|
-
const dataDir = mkdtempSync(join(tmpdir(), 'mixdog-goal-limit-'));
|
|
77
|
-
let clock = 1_900_000_000_000;
|
|
78
|
-
const runtime = createGoalRuntime({ dataDir, now: () => clock });
|
|
79
|
-
try {
|
|
80
|
-
await runtime.control('sess_goal_limit', { action: 'create', objective: 'Finish the objective' });
|
|
81
|
-
const parked = runtime.continuation('sess_goal_limit', {
|
|
82
|
-
agentStatus: { agentJobs: [{ status: 'running' }] },
|
|
83
|
-
});
|
|
84
|
-
assert.equal(parked.run, false);
|
|
85
|
-
assert.equal(parked.reason, 'agent-running');
|
|
86
|
-
|
|
87
|
-
const shellIgnored = runtime.continuation('sess_goal_limit', {
|
|
88
|
-
agentStatus: { agentJobs: [], shellJobs: [{ status: 'running' }] },
|
|
89
|
-
});
|
|
90
|
-
assert.equal(shellIgnored.run, true);
|
|
91
|
-
assert.match(shellIgnored.prompt, /Active Goal/);
|
|
92
|
-
|
|
93
|
-
clock += DEFAULT_GOAL_TIME_LIMIT_MS + 1;
|
|
94
|
-
const limited = runtime.snapshot('sess_goal_limit');
|
|
95
|
-
assert.equal(limited.status, 'budget_limited');
|
|
96
|
-
assert.equal(runtime.continuation('sess_goal_limit').run, false);
|
|
97
|
-
} finally {
|
|
98
|
-
runtime.close();
|
|
99
|
-
rmSync(dataDir, { recursive: true, force: true });
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
test('Goal duration parser accepts compound limits and rejects unsafe values', () => {
|
|
104
|
-
assert.equal(parseGoalDuration('1h30m'), 90 * 60 * 1000);
|
|
105
|
-
assert.equal(parseGoalDuration('2d 4h'), (2 * 24 + 4) * 60 * 60 * 1000);
|
|
106
|
-
assert.throws(() => parseGoalDuration('30s'), /at least 1 minute/);
|
|
107
|
-
assert.throws(() => parseGoalDuration('8d'), /exceeds 7 days/);
|
|
108
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import test from 'node:test';
|
|
3
|
-
|
|
4
|
-
import { resolveResumeCwd } from './lifecycle-api.mjs';
|
|
5
|
-
|
|
6
|
-
test('project resume prefers canonical session cwd over stale desktop metadata', () => {
|
|
7
|
-
assert.equal(resolveResumeCwd({
|
|
8
|
-
cwd: 'C:\\Project\\mixdog',
|
|
9
|
-
desktopSession: {
|
|
10
|
-
classification: 'project',
|
|
11
|
-
projectPath: 'C:\\Project\\GamerScroll',
|
|
12
|
-
},
|
|
13
|
-
}, 'C:\\fallback'), 'C:\\Project\\mixdog');
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
test('unclassified desktop task resume stays in its host-managed workspace', () => {
|
|
17
|
-
assert.equal(resolveResumeCwd({
|
|
18
|
-
cwd: 'C:\\old-transient',
|
|
19
|
-
desktopSession: { classification: 'task', projectPath: null },
|
|
20
|
-
}, 'C:\\task-workspace'), 'C:\\task-workspace');
|
|
21
|
-
});
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import { test } from 'node:test';
|
|
3
|
-
import { saveModelSettings } from './model-capabilities.mjs';
|
|
4
|
-
import { createModelRouteApi } from './model-route-api.mjs';
|
|
5
|
-
|
|
6
|
-
test('saveModelSettings updates modelSettings without a sync config write', () => {
|
|
7
|
-
let saveCalls = 0;
|
|
8
|
-
const cfgMod = {
|
|
9
|
-
loadConfig() {
|
|
10
|
-
return { modelSettings: {} };
|
|
11
|
-
},
|
|
12
|
-
saveConfig() {
|
|
13
|
-
saveCalls += 1;
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
const next = saveModelSettings(cfgMod, {
|
|
17
|
-
provider: 'openai',
|
|
18
|
-
model: 'gpt-5.4',
|
|
19
|
-
effort: 'high',
|
|
20
|
-
fast: true,
|
|
21
|
-
modelParameters: { context: '1m' },
|
|
22
|
-
contextPercent: 70,
|
|
23
|
-
}, { fastCapable: true, baseConfig: cfgMod.loadConfig() });
|
|
24
|
-
assert.equal(saveCalls, 0);
|
|
25
|
-
assert.deepEqual(next.modelSettings['openai/gpt-5.4'], {
|
|
26
|
-
effort: 'high',
|
|
27
|
-
fast: true,
|
|
28
|
-
modelParameters: { context: '1m' },
|
|
29
|
-
contextPercent: 70,
|
|
30
|
-
});
|
|
31
|
-
assert.equal(next.fastModels, undefined);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
function stubRouteApi({ persistLeadRoute, saveConfigAndAdopt, cfgMod }) {
|
|
35
|
-
let config = { modelSettings: {} };
|
|
36
|
-
let route = { provider: 'openai', model: 'gpt-5.4', effort: 'high', fast: false };
|
|
37
|
-
return createModelRouteApi({
|
|
38
|
-
getConfig: () => config,
|
|
39
|
-
getRoute: () => route,
|
|
40
|
-
setRouteState: (next) => { route = next; },
|
|
41
|
-
getSession: () => null,
|
|
42
|
-
setSession: () => {},
|
|
43
|
-
getConfigHasSecrets: () => false,
|
|
44
|
-
getWebSearchRouteState: () => null,
|
|
45
|
-
setWebSearchRouteState: () => {},
|
|
46
|
-
cfgMod,
|
|
47
|
-
reg: {},
|
|
48
|
-
mgr: {},
|
|
49
|
-
statusRoutes: {},
|
|
50
|
-
resolveRoute: (_cfg, requested) => ({ ...route, ...requested }),
|
|
51
|
-
webSearchCapableFor: () => false,
|
|
52
|
-
lookupModelMeta: async () => ({ id: 'gpt-5.4' }),
|
|
53
|
-
adoptConfig: (next) => { config = next; return next; },
|
|
54
|
-
saveConfigAndAdopt,
|
|
55
|
-
ensureFullConfig: () => config,
|
|
56
|
-
awaitKeychainPrewarm: async () => {},
|
|
57
|
-
ensureProvidersReady: async () => {},
|
|
58
|
-
persistLeadRoute,
|
|
59
|
-
refreshRouteEffort: async () => {},
|
|
60
|
-
refreshStatuslineUsageSnapshot: () => {},
|
|
61
|
-
scheduleStatuslineUsageRefresh: () => {},
|
|
62
|
-
invalidateContextStatusCache: () => {},
|
|
63
|
-
invalidateProviderCaches: () => {},
|
|
64
|
-
createCurrentSession: async () => {},
|
|
65
|
-
invalidatePreSessionToolSurface: () => {},
|
|
66
|
-
collectWebSearchProviderModels: async () => [],
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
test('setFast persists through the debounce path, never cfgMod.saveConfig', async () => {
|
|
71
|
-
let saveCalls = 0;
|
|
72
|
-
let persistLeadCalls = 0;
|
|
73
|
-
let debounceCalls = 0;
|
|
74
|
-
const api = stubRouteApi({
|
|
75
|
-
cfgMod: {
|
|
76
|
-
loadConfig() { return { modelSettings: {} }; },
|
|
77
|
-
saveConfig() { saveCalls += 1; },
|
|
78
|
-
},
|
|
79
|
-
persistLeadRoute: (route) => {
|
|
80
|
-
persistLeadCalls += 1;
|
|
81
|
-
return { provider: route.provider, model: route.model };
|
|
82
|
-
},
|
|
83
|
-
saveConfigAndAdopt: () => { debounceCalls += 1; },
|
|
84
|
-
});
|
|
85
|
-
await api.setFast(true);
|
|
86
|
-
assert.equal(saveCalls, 0);
|
|
87
|
-
assert.equal(persistLeadCalls, 1);
|
|
88
|
-
assert.equal(debounceCalls, 0);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
test('setFast debounce-persists modelSettings when the lead preset cannot be written', async () => {
|
|
92
|
-
let saveCalls = 0;
|
|
93
|
-
let debounceCalls = 0;
|
|
94
|
-
const api = stubRouteApi({
|
|
95
|
-
cfgMod: {
|
|
96
|
-
loadConfig() { return { modelSettings: {} }; },
|
|
97
|
-
saveConfig() { saveCalls += 1; },
|
|
98
|
-
},
|
|
99
|
-
persistLeadRoute: () => null,
|
|
100
|
-
saveConfigAndAdopt: () => { debounceCalls += 1; },
|
|
101
|
-
});
|
|
102
|
-
await api.setFast(true);
|
|
103
|
-
assert.equal(saveCalls, 0);
|
|
104
|
-
assert.equal(debounceCalls, 1);
|
|
105
|
-
});
|