mixdog 0.9.158 → 0.9.159
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/package.json +12 -7
- package/scripts/office-design-audit.mjs +43 -0
- package/scripts/release-paths.mjs +108 -0
- package/scripts/suite-health.mjs +102 -0
- package/src/defaults/skills/setup/SKILL.md +10 -11
- package/src/runtime/agent/orchestrator/agent-runtime/session-builder.mjs +12 -12
- package/src/runtime/agent/orchestrator/agent-trace-format.mjs +0 -4
- package/src/runtime/agent/orchestrator/config.mjs +8 -13
- package/src/runtime/agent/orchestrator/internal-tools.mjs +6 -1
- package/src/runtime/agent/orchestrator/providers/lib/anthropic-request-utils.mjs +52 -2
- package/src/runtime/agent/orchestrator/providers/openai-oauth-ws.mjs +2 -2
- package/src/runtime/agent/orchestrator/session/agent-loop.mjs +0 -9
- package/src/runtime/agent/orchestrator/session/compact/constants.mjs +8 -44
- package/src/runtime/agent/orchestrator/session/compact/continuation.mjs +55 -0
- package/src/runtime/agent/orchestrator/session/compact/messages.mjs +89 -4
- package/src/runtime/agent/orchestrator/session/compact/runner.mjs +227 -767
- package/src/runtime/agent/orchestrator/session/compact/summary-schema.mjs +4 -4
- package/src/runtime/agent/orchestrator/session/compact/summary.mjs +43 -50
- package/src/runtime/agent/orchestrator/session/compact.mjs +7 -21
- package/src/runtime/agent/orchestrator/session/eager-dispatch.mjs +1 -0
- package/src/runtime/agent/orchestrator/session/loop/compact-policy.mjs +35 -73
- package/src/runtime/agent/orchestrator/session/loop/context-overflow.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/loop/fresh-context.mjs +472 -0
- package/src/runtime/agent/orchestrator/session/loop/tool-exec.mjs +6 -2
- package/src/runtime/agent/orchestrator/session/manager/ask-session.mjs +16 -5
- package/src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs +66 -163
- package/src/runtime/agent/orchestrator/session/manager/context-meta.mjs +4 -20
- package/src/runtime/agent/orchestrator/session/manager/message-sanitize.mjs +8 -4
- package/src/runtime/agent/orchestrator/session/manager/session-crud.mjs +4 -23
- package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.mjs +3 -14
- package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint-context.mjs +0 -2
- package/src/runtime/agent/orchestrator/session/pre-send-compact.mjs +64 -195
- package/src/runtime/agent/orchestrator/session/tool-batch.mjs +1 -0
- package/src/runtime/agent/orchestrator/session/tool-envelope.mjs +18 -6
- package/src/runtime/browser-bridge/action-schema.mjs +19 -2
- package/src/runtime/browser-bridge/client.mjs +6 -2
- package/src/runtime/browser-bridge/tool-defs.mjs +6 -6
- package/src/runtime/computer-bridge/action-schema.mjs +85 -365
- package/src/runtime/computer-bridge/client.mjs +71 -6
- package/src/runtime/computer-bridge/core-actions.mjs +227 -0
- package/src/runtime/computer-bridge/error-recovery.mjs +105 -0
- package/src/runtime/computer-bridge/tool-defs.mjs +11 -12
- package/src/runtime/memory/index.mjs +2 -1
- package/src/runtime/memory/lib/compact-handoff.mjs +127 -0
- package/src/runtime/memory/lib/http-wire.mjs +1 -1
- package/src/runtime/memory/lib/memory-config-flags.mjs +10 -0
- package/src/runtime/memory/lib/query-handlers.mjs +16 -6
- package/src/runtime/memory/lib/recall-format.mjs +18 -41
- package/src/runtime/memory/lib/session-ingest-runtime.mjs +4 -2
- package/src/runtime/memory/lib/session-ingest.mjs +37 -9
- package/src/runtime/office/assurance-benchmark.mjs +68 -2
- package/src/runtime/office/assurance.mjs +82 -0
- package/src/runtime/office/capabilities.mjs +6 -6
- package/src/runtime/office/composition-system.mjs +5 -0
- package/src/runtime/office/content-model.mjs +1 -1
- package/src/runtime/office/design-aesthetics.mjs +460 -0
- package/src/runtime/office/design-art-direction.mjs +283 -0
- package/src/runtime/office/design-creative-director.mjs +170 -0
- package/src/runtime/office/design-deck-diversity.mjs +115 -0
- package/src/runtime/office/design-docx-components.mjs +60 -1
- package/src/runtime/office/design-docx.mjs +31 -3
- package/src/runtime/office/design-frontier-review.mjs +129 -0
- package/src/runtime/office/design-layout-grammar.mjs +134 -0
- package/src/runtime/office/design-pptx-plan.mjs +27 -2
- package/src/runtime/office/design-pptx-semantic-flow.mjs +111 -0
- package/src/runtime/office/design-pptx-semantic-visuals.mjs +885 -0
- package/src/runtime/office/design-pptx-stack.mjs +16 -8
- package/src/runtime/office/design-review.mjs +4 -0
- package/src/runtime/office/design-system.mjs +16 -4
- package/src/runtime/office/design-tokens.mjs +36 -8
- package/src/runtime/office/design-xlsx.mjs +28 -5
- package/src/runtime/office/index.mjs +2 -0
- package/src/runtime/office/office-actions.mjs +42 -3
- package/src/runtime/office/office-com-host.ps1 +99 -9
- package/src/runtime/office/office-com-session-host.ps1 +185 -2
- package/src/runtime/office/office-sessions.mjs +2 -0
- package/src/runtime/office/quality-live-benchmark.mjs +121 -67
- package/src/runtime/office/quality-pipeline.mjs +20 -0
- package/src/runtime/office/quality-score.mjs +84 -0
- package/src/runtime/office/tool-defs.mjs +1 -1
- package/src/session-runtime/config-helpers.mjs +16 -11
- package/src/session-runtime/goal-reminder.mjs +18 -0
- package/src/session-runtime/runtime-core.mjs +2 -2
- package/src/session-runtime/session-transcript.mjs +2 -2
- package/src/session-runtime/session-turn-api.mjs +5 -1
- package/src/session-runtime/settings-api.mjs +14 -12
- package/src/tui/App.jsx +1 -3
- package/src/tui/app/create-app-pickers.mjs +0 -4
- package/src/tui/app/extension-pickers.mjs +1 -56
- package/src/tui/app/input-parsers.mjs +1 -27
- package/src/tui/app/prompt-submit.mjs +2 -2
- package/src/tui/app/settings-picker.mjs +2 -43
- package/src/tui/app/slash-commands.mjs +0 -1
- package/src/tui/app/slash-dispatch.mjs +0 -4
- package/src/tui/app/usage-context-panels.mjs +0 -1
- package/src/tui/dist/index.mjs +4 -98
- package/src/tui/session/session-api.mjs +2 -3
- package/src/tui/session/session-flow.mjs +6 -11
- package/src/vendor/statusline/src/gateway/route-meta.mjs +2 -3
- package/src/runtime/agent/orchestrator/session/loop/recall-fasttrack.mjs +0 -245
package/README.md
CHANGED
|
@@ -191,7 +191,6 @@ stdout; diagnostics remain on stderr.
|
|
|
191
191
|
/mcp manage MCP servers and tools
|
|
192
192
|
/skills choose a skill for the next request
|
|
193
193
|
/plugins manage local plugin integrations
|
|
194
|
-
/hooks manage before-tool hooks and events
|
|
195
194
|
/setting open runtime settings
|
|
196
195
|
/profile set your title and response language
|
|
197
196
|
/update check for updates
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mixdog",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.159",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Standalone mixdog coding-agent CLI/TUI workspace.",
|
|
@@ -32,6 +32,10 @@
|
|
|
32
32
|
"!scripts/recall-bench-*.txt",
|
|
33
33
|
"!scripts/*-test.mjs",
|
|
34
34
|
"!scripts/*.test.mjs",
|
|
35
|
+
"!scripts/tool-contracts/",
|
|
36
|
+
"!scripts/provider-toolcall/",
|
|
37
|
+
"!scripts/session-transport/",
|
|
38
|
+
"!scripts/shellhardening/",
|
|
35
39
|
"!scripts/*-smoke.mjs",
|
|
36
40
|
"!scripts/smoke-loop*.mjs",
|
|
37
41
|
"!scripts/*-bench.mjs",
|
|
@@ -54,23 +58,23 @@
|
|
|
54
58
|
"smoke:all": "npm run smoke && npm run smoke:boot && npm run smoke:patch && npm run smoke:compact",
|
|
55
59
|
"smoke:boot": "node scripts/boot-smoke.mjs",
|
|
56
60
|
"smoke:compact": "node scripts/compact-smoke.mjs",
|
|
57
|
-
"test:compact": "node --test scripts/suite-compact-test.mjs src/runtime/agent/orchestrator/session/token-estimate.test.mjs",
|
|
61
|
+
"test:compact": "node --test scripts/suite-compact-test.mjs src/runtime/agent/orchestrator/session/compact-fresh-context.test.mjs src/runtime/agent/orchestrator/session/compaction-read-reset.test.mjs src/runtime/agent/orchestrator/session/token-estimate.test.mjs",
|
|
58
62
|
"test:markdown": "node --test scripts/markdown-surface-test.mjs",
|
|
59
63
|
"smoke:loop": "node scripts/smoke-loop.mjs",
|
|
60
64
|
"smoke:loop:final": "node scripts/smoke-loop-report.mjs --require-complete --min-elapsed 5h --min-iterations 400 --max-gap 60s --max-smoke-ms 10000 --max-avg-smoke-ms 8500 --max-step-ms smoke.mjs=4000 --max-step-ms boot-smoke.mjs=8000 --max-rss-mb 140 --max-rss-growth-mb 50",
|
|
61
65
|
"smoke:loop:report": "node scripts/smoke-loop-report.mjs",
|
|
62
66
|
"build:spawn:test": "cargo build --locked --manifest-path native/mixdog-spawn/Cargo.toml",
|
|
63
|
-
"test:tool-contracts": "npm run build:spawn:test && node scripts/tool-
|
|
67
|
+
"test:tool-contracts": "npm run build:spawn:test && node --test --test-force-exit \"scripts/tool-contracts/*.test.mjs\"",
|
|
64
68
|
"smoke:patch": "node scripts/apply-patch-edit-smoke.mjs",
|
|
65
|
-
"test:shellhardening": "npm run build:spawn:test && node --test scripts/
|
|
66
|
-
"test:providers": "node --test scripts/provider-toolcall
|
|
69
|
+
"test:shellhardening": "npm run build:spawn:test && node --test \"scripts/shellhardening/*.test.mjs\" scripts/suite-shell-direct-exe-test.mjs",
|
|
70
|
+
"test:providers": "node --test \"scripts/provider-toolcall/*.test.mjs\" scripts/provider-contract-test.mjs scripts/provider-stream-outcome-test.mjs scripts/cursor-provider-test.mjs src/runtime/agent/orchestrator/providers/openai-codex-identity.test.mjs src/runtime/agent/orchestrator/providers/openai-ws-delta-parity.test.mjs",
|
|
67
71
|
"test:embedding-runtime:warmup": "node scripts/verify-embedding-runtime.mjs --warmup",
|
|
68
72
|
"test:release-assets": "node --check scripts/verify-release-assets.mjs && node --check scripts/release-gate-test.mjs && node --check scripts/prepare-native-assets.mjs && node --test scripts/release-gate-test.mjs scripts/prepare-native-assets-test.mjs scripts/generate-voice-runtime-manifest.test.mjs",
|
|
69
73
|
"test:native-edit-wire": "node scripts/native-edit-wire-test.mjs",
|
|
70
74
|
"test:release-critical": "npm run test:release-assets && npm run smoke:patch && npm run test:providers",
|
|
71
75
|
"test:spec-advisory": "node scripts/advisory-spec-test.mjs && npm run test:spec-advisory --prefix apps/desktop",
|
|
72
|
-
"test:session-transport": "node --test scripts/session-transport
|
|
73
|
-
"test:session": "node --test scripts/runtime-turn-contract-test.mjs scripts/session-save-fault-store-test.mjs scripts/turn-review-revert-test.mjs src/runtime/shared/tool-surface.test.mjs src/runtime/bridge-clients.test.mjs",
|
|
76
|
+
"test:session-transport": "node --test \"scripts/session-transport/*.test.mjs\" scripts/daemon-bootstrap-test.mjs src/runtime/shared/child-spawn-remote.test.mjs src/standalone/session-runtime-agent-control-client.test.mjs src/standalone/session-runtime-dispatch-cancel.test.mjs src/standalone/session-runtime-host-factory.test.mjs src/standalone/session-runtime-inline-host.test.mjs src/standalone/session-runtime-provider-cooldown.test.mjs src/standalone/session-runtime-shard-host.test.mjs src/standalone/session-runtime-shard-router.test.mjs",
|
|
77
|
+
"test:session": "node --test scripts/runtime-turn-contract-test.mjs scripts/session-save-fault-store-test.mjs scripts/turn-review-revert-test.mjs src/runtime/shared/tool-surface.test.mjs src/runtime/bridge-clients.test.mjs src/runtime/computer-bridge/client-semantic-error.test.mjs src/runtime/agent/orchestrator/session/tool-envelope.test.mjs src/runtime/agent/orchestrator/session/eager-dispatch.test.mjs",
|
|
74
78
|
"test:quick": "npm run test:session && npm run test:session-transport && npm run test:desktop-main --prefix apps/desktop",
|
|
75
79
|
"test:office": "node --test scripts/run-office-live-tests.test.mjs src/runtime/office/office-runtime.test.mjs src/runtime/office/office-assurance.test.mjs src/runtime/office/portable-authoring.test.mjs src/runtime/office/slide-quality.test.mjs && npm run test:office-approval --prefix apps/desktop",
|
|
76
80
|
"test:office:live": "node scripts/run-office-live-tests.mjs",
|
|
@@ -91,6 +95,7 @@
|
|
|
91
95
|
"bench:recall": "node scripts/recall-bench.mjs",
|
|
92
96
|
"bench:recall:strict": "node scripts/recall-bench.mjs --strict",
|
|
93
97
|
"test:recall-validator": "node --test scripts/recall-bench-test.mjs",
|
|
98
|
+
"test:suite-health": "node --test scripts/suite-health.test.mjs",
|
|
94
99
|
"bench:tui-load": "node scripts/tui-runtime-load-bench.mjs",
|
|
95
100
|
"bench:output-style": "node scripts/output-style-bench.mjs",
|
|
96
101
|
"bench:session-context": "node scripts/session-context-bench.mjs",
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { basename, resolve } from 'node:path';
|
|
3
|
+
import { pathToFileURL } from 'node:url';
|
|
4
|
+
|
|
5
|
+
import { reviewRenderedOfficePages } from '../src/runtime/office/assurance.mjs';
|
|
6
|
+
|
|
7
|
+
function argumentValue(name) {
|
|
8
|
+
const index = process.argv.indexOf(name);
|
|
9
|
+
return index >= 0 ? process.argv[index + 1] : '';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function pageFromPath(path, fallback) {
|
|
13
|
+
const match = basename(path).match(/(?:page|slide)[-_ ]?(\d+)/i);
|
|
14
|
+
return match ? Number(match[1]) : fallback;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export async function auditOfficeDesignImages(paths, {
|
|
18
|
+
format = 'pptx',
|
|
19
|
+
} = {}) {
|
|
20
|
+
const images = await Promise.all(paths.map(async (path, index) => {
|
|
21
|
+
const absolute = resolve(path);
|
|
22
|
+
const data = await readFile(absolute);
|
|
23
|
+
return {
|
|
24
|
+
page: pageFromPath(absolute, index + 1),
|
|
25
|
+
path: absolute,
|
|
26
|
+
mimeType: 'image/png',
|
|
27
|
+
data: data.toString('base64'),
|
|
28
|
+
};
|
|
29
|
+
}));
|
|
30
|
+
images.sort((left, right) => left.page - right.page);
|
|
31
|
+
return reviewRenderedOfficePages(images, { format });
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
35
|
+
const format = argumentValue('--format') || 'pptx';
|
|
36
|
+
const paths = process.argv.slice(2).filter((entry, index, values) => (
|
|
37
|
+
entry !== '--format' && values[index - 1] !== '--format'
|
|
38
|
+
));
|
|
39
|
+
if (!paths.length) throw new Error('Pass rendered page image paths to audit.');
|
|
40
|
+
const report = await auditOfficeDesignImages(paths, { format });
|
|
41
|
+
process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
|
|
42
|
+
if (!report.ok) process.exitCode = 1;
|
|
43
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Single source of truth for CI/CD path selection.
|
|
3
|
+
//
|
|
4
|
+
// Consumers:
|
|
5
|
+
// - .github/workflows/release-gate.yml → `node scripts/release-paths.mjs desktop-regex|runtime-regex`
|
|
6
|
+
// (grep -E patterns selecting which incremental gates a change requires)
|
|
7
|
+
// - .github/workflows/deploy.yml → `import { RELEASE_CRITICAL_PATHS }`
|
|
8
|
+
// (git diff paths whose change invalidates the previous release's
|
|
9
|
+
// critical verification)
|
|
10
|
+
//
|
|
11
|
+
// Adding or renaming a release-relevant script means editing THIS file only;
|
|
12
|
+
// the workflows derive their patterns from it at run time.
|
|
13
|
+
|
|
14
|
+
export const PACKAGE_MANIFESTS = ['package.json', 'package-lock.json'];
|
|
15
|
+
|
|
16
|
+
// This module governs gate selection itself, so changing it must re-run
|
|
17
|
+
// every gate it feeds.
|
|
18
|
+
const GATE_SELECTION_SOURCES = ['scripts/release-paths.mjs'];
|
|
19
|
+
|
|
20
|
+
// Prefixes whose changes require the desktop bundle gate.
|
|
21
|
+
export const DESKTOP_GATE_PREFIXES = ['apps/desktop/', 'src/', 'vendor/', 'LICENSES/'];
|
|
22
|
+
export const DESKTOP_GATE_FILES = ['README.md', 'NOTICE.md', ...PACKAGE_MANIFESTS];
|
|
23
|
+
// Desktop packaging/postinstall scripts; `.test` companions ride along.
|
|
24
|
+
export const DESKTOP_GATE_SCRIPT_BASES = [
|
|
25
|
+
'scripts/prune-embedding-runtime',
|
|
26
|
+
'scripts/native-binary-arch',
|
|
27
|
+
'scripts/native-tool-download',
|
|
28
|
+
'scripts/runtime-dependency-cache-key',
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
// Prefixes whose changes require the runtime gate (the release-critical lane
|
|
32
|
+
// plus the tool-contract suites the gate also executes).
|
|
33
|
+
export const RUNTIME_GATE_PREFIXES = [
|
|
34
|
+
'.github/workflows/',
|
|
35
|
+
'native/',
|
|
36
|
+
'scripts/tool-contracts/',
|
|
37
|
+
'src/runtime/agent/orchestrator/',
|
|
38
|
+
'src/runtime/shared/',
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
// Everything `npm run test:release-critical` executes
|
|
42
|
+
// (test:release-assets + smoke:patch + test:providers).
|
|
43
|
+
export const RELEASE_CRITICAL_SCRIPTS = [
|
|
44
|
+
'scripts/verify-release-assets.mjs',
|
|
45
|
+
'scripts/release-gate-test.mjs',
|
|
46
|
+
'scripts/prepare-native-assets.mjs',
|
|
47
|
+
'scripts/prepare-native-assets-test.mjs',
|
|
48
|
+
'scripts/generate-voice-runtime-manifest.mjs',
|
|
49
|
+
'scripts/generate-voice-runtime-manifest.test.mjs',
|
|
50
|
+
'scripts/apply-patch-edit-smoke.mjs',
|
|
51
|
+
'scripts/provider-contract-test.mjs',
|
|
52
|
+
'scripts/provider-stream-outcome-test.mjs',
|
|
53
|
+
'scripts/cursor-provider-test.mjs',
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
// Directory-shaped suites the critical lane executes (test:providers runs
|
|
57
|
+
// scripts/provider-toolcall/*.test.mjs): deploy consumes these as git
|
|
58
|
+
// pathspecs, the gate regex as path prefixes.
|
|
59
|
+
export const RELEASE_CRITICAL_SUITE_DIRS = ['scripts/provider-toolcall'];
|
|
60
|
+
|
|
61
|
+
// Gate-only suite files the runtime job executes beyond the critical lane
|
|
62
|
+
// (test:compact); editing one must re-run the gate that executes it.
|
|
63
|
+
export const RUNTIME_GATE_SUITE_FILES = ['scripts/suite-compact-test.mjs'];
|
|
64
|
+
|
|
65
|
+
// deploy.yml plan: paths whose change since the published release tag marks
|
|
66
|
+
// the critical lane as unverified.
|
|
67
|
+
export const RELEASE_CRITICAL_PATHS = [
|
|
68
|
+
'native',
|
|
69
|
+
'src/runtime/agent/orchestrator',
|
|
70
|
+
'src/runtime/shared',
|
|
71
|
+
...RELEASE_CRITICAL_SCRIPTS,
|
|
72
|
+
...RELEASE_CRITICAL_SUITE_DIRS,
|
|
73
|
+
...PACKAGE_MANIFESTS,
|
|
74
|
+
];
|
|
75
|
+
|
|
76
|
+
const escapeRegex = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
77
|
+
|
|
78
|
+
export function desktopGateRegex() {
|
|
79
|
+
return `^(${[
|
|
80
|
+
...DESKTOP_GATE_PREFIXES.map(escapeRegex),
|
|
81
|
+
...DESKTOP_GATE_FILES.map((file) => `${escapeRegex(file)}$`),
|
|
82
|
+
...DESKTOP_GATE_SCRIPT_BASES.map((base) => `${escapeRegex(base)}(\\.test)?\\.mjs$`),
|
|
83
|
+
...GATE_SELECTION_SOURCES.map((file) => `${escapeRegex(file)}$`),
|
|
84
|
+
].join('|')})`;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function runtimeGateRegex() {
|
|
88
|
+
return `^(${[
|
|
89
|
+
...RUNTIME_GATE_PREFIXES.map(escapeRegex),
|
|
90
|
+
...RELEASE_CRITICAL_SCRIPTS.map((file) => `${escapeRegex(file)}$`),
|
|
91
|
+
...RELEASE_CRITICAL_SUITE_DIRS.map((dir) => `${escapeRegex(dir)}/`),
|
|
92
|
+
...RUNTIME_GATE_SUITE_FILES.map((file) => `${escapeRegex(file)}$`),
|
|
93
|
+
...DESKTOP_GATE_SCRIPT_BASES.map((base) => `${escapeRegex(base)}(\\.test)?\\.mjs$`),
|
|
94
|
+
...PACKAGE_MANIFESTS.map((file) => `${escapeRegex(file)}$`),
|
|
95
|
+
...GATE_SELECTION_SOURCES.map((file) => `${escapeRegex(file)}$`),
|
|
96
|
+
].join('|')})`;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const mode = process.argv[2];
|
|
100
|
+
if (mode) {
|
|
101
|
+
if (mode === 'desktop-regex') process.stdout.write(`${desktopGateRegex()}\n`);
|
|
102
|
+
else if (mode === 'runtime-regex') process.stdout.write(`${runtimeGateRegex()}\n`);
|
|
103
|
+
else if (mode === 'critical-paths') process.stdout.write(`${RELEASE_CRITICAL_PATHS.join('\n')}\n`);
|
|
104
|
+
else {
|
|
105
|
+
process.stderr.write(`unknown mode: ${mode} (expected desktop-regex|runtime-regex|critical-paths)\n`);
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Weekly opt-out sweep: run every test:*/smoke:* npm script in the repository
|
|
3
|
+
// so no locally-registered suite can rot silently (docs/testing.md, "A
|
|
4
|
+
// contract suite runs in CI or it drifts"). New scripts join automatically;
|
|
5
|
+
// exclusions are explicit, reasoned, and fail closed when they go stale.
|
|
6
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
7
|
+
import { join } from 'node:path';
|
|
8
|
+
import { pathToFileURL } from 'node:url';
|
|
9
|
+
import { spawnSync } from 'node:child_process';
|
|
10
|
+
|
|
11
|
+
export const WORKSPACES = [
|
|
12
|
+
{
|
|
13
|
+
dir: '.',
|
|
14
|
+
exclusions: {
|
|
15
|
+
'smoke:all': 'aggregate; its components run individually',
|
|
16
|
+
'smoke:loop': 'long-running local endurance harness',
|
|
17
|
+
'smoke:loop:final': 'endurance-harness gate, needs hours of loop data',
|
|
18
|
+
'smoke:loop:report': 'report reader, not a suite',
|
|
19
|
+
'test:release-critical': 'aggregate; the release gate owns it',
|
|
20
|
+
'test:quick': 'aggregate; its components run individually',
|
|
21
|
+
'test:office:live': 'drives real Office COM on a desktop machine',
|
|
22
|
+
'test:embedding-runtime:warmup': 'downloads the embedding runtime',
|
|
23
|
+
'test:spec-advisory': 'advisory by design (MIXDOG_TEST_ADVISORY)',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
dir: 'apps/desktop',
|
|
28
|
+
exclusions: {
|
|
29
|
+
'test:renderer:full': 'aggregate; its components run individually',
|
|
30
|
+
'test:fast-direct': 'dev-only deploy tool; real deploys are its verification',
|
|
31
|
+
'test:office-approval': 'runs through the root test:office chain',
|
|
32
|
+
'test:spec-advisory': 'advisory by design (MIXDOG_TEST_ADVISORY)',
|
|
33
|
+
'test:browser-host:integration': 'live desktop integration harness',
|
|
34
|
+
'test:browser-profile-import:integration': 'live desktop integration harness',
|
|
35
|
+
'test:computer-host:integration': 'live desktop integration harness',
|
|
36
|
+
'test:computer-host:scenarios': 'live desktop scenario harness',
|
|
37
|
+
'test:computer-host:repeats': 'live desktop scenario harness',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
export function selectSuiteScripts(scripts, exclusions) {
|
|
43
|
+
const names = Object.keys(scripts).filter((name) => /^(test|smoke)(:|$)/.test(name));
|
|
44
|
+
const stale = Object.keys(exclusions).filter((name) => !names.includes(name));
|
|
45
|
+
if (stale.length) {
|
|
46
|
+
throw new Error(`stale exclusions (script no longer exists): ${stale.join(', ')}`);
|
|
47
|
+
}
|
|
48
|
+
return names.filter((name) => !(name in exclusions));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function runSweep() {
|
|
52
|
+
const failures = [];
|
|
53
|
+
const reportLines = [];
|
|
54
|
+
for (const ws of WORKSPACES) {
|
|
55
|
+
const pkg = JSON.parse(readFileSync(join(ws.dir, 'package.json'), 'utf8'));
|
|
56
|
+
const names = selectSuiteScripts(pkg.scripts || {}, ws.exclusions);
|
|
57
|
+
for (const name of names) {
|
|
58
|
+
const label = ws.dir === '.' ? name : `${ws.dir} ${name}`;
|
|
59
|
+
const started = Date.now();
|
|
60
|
+
const args = ['run', name, ...(ws.dir === '.' ? [] : ['--prefix', ws.dir])];
|
|
61
|
+
const child = spawnSync(process.platform === 'win32' ? 'npm.cmd' : 'npm', args, {
|
|
62
|
+
encoding: 'utf8',
|
|
63
|
+
shell: process.platform === 'win32',
|
|
64
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
65
|
+
});
|
|
66
|
+
const seconds = ((Date.now() - started) / 1000).toFixed(1);
|
|
67
|
+
if (child.status === 0) {
|
|
68
|
+
reportLines.push(`- ${label}: OK (${seconds}s)`);
|
|
69
|
+
console.log(`${label}: OK (${seconds}s)`);
|
|
70
|
+
} else {
|
|
71
|
+
const tail = `${child.stdout || ''}\n${child.stderr || ''}`
|
|
72
|
+
.trim().split('\n').slice(-25).join('\n');
|
|
73
|
+
failures.push(`- ${label}: FAILED (${seconds}s)\n\n\`\`\`\n${tail}\n\`\`\``);
|
|
74
|
+
reportLines.push(`- ${label}: FAILED (${seconds}s)`);
|
|
75
|
+
console.error(`${label}: FAILED (${seconds}s)\n${tail}`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
console.log(`\n${reportLines.join('\n')}`);
|
|
80
|
+
if (failures.length > 0) {
|
|
81
|
+
const runUrl = process.env.GITHUB_RUN_ID
|
|
82
|
+
? `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`
|
|
83
|
+
: '(local run)';
|
|
84
|
+
const report = [
|
|
85
|
+
'# Weekly suite health sweep failed',
|
|
86
|
+
'',
|
|
87
|
+
`Checked: ${new Date().toISOString()}`,
|
|
88
|
+
`Workflow run: ${runUrl}`,
|
|
89
|
+
'',
|
|
90
|
+
...reportLines,
|
|
91
|
+
'',
|
|
92
|
+
...failures,
|
|
93
|
+
'',
|
|
94
|
+
].join('\n');
|
|
95
|
+
writeFileSync('suite-health-report.md', report);
|
|
96
|
+
process.exitCode = 1;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
101
|
+
runSweep();
|
|
102
|
+
}
|
|
@@ -18,7 +18,7 @@ description: Use this skill only to inspect or modify a Mixdog user's persisted
|
|
|
18
18
|
- 프로젝트 config: `<cwd>/.mixdog/hooks.json`
|
|
19
19
|
- TUI 명령 목록: `src/tui/app/slash-commands.mjs`
|
|
20
20
|
- TUI 설정 허브: `/setting` (별칭 `/settings`, `/config`) → `src/tui/app/settings-picker.mjs`
|
|
21
|
-
- Desktop 설정: `Ctrl+,` → General / Context / Output style / Providers / Git / Skills / MCP / Plugins /
|
|
21
|
+
- Desktop 설정: `Ctrl+,` → General / Context / Output style / Providers / Git / Skills / MCP / Plugins / Connection / System / Shortcuts / About
|
|
22
22
|
- Desktop rail: **Projects / Workflows / Schedules / Webhooks / Utilities**
|
|
23
23
|
|
|
24
24
|
사용자 경로와 지원 여부는 **현재 Desktop 구현을 최신 기준**으로 판정한다. TUI는 Desktop에 없는 고급 경로를 보완할 때만 사용하며, 저장만 왕복되고 실제 소비되지 않는 key는 사용자 옵션으로 설명하지 않는다.
|
|
@@ -219,7 +219,7 @@ API 키·토큰·OAuth 자격은 config에 쓰지 않는다.
|
|
|
219
219
|
|
|
220
220
|
1. **확인**: `/setting → Auto-compact`, Desktop **Settings → Context**, 디스크 `agent.compaction`.
|
|
221
221
|
2. **변경**: Auto-compact toggle → `setCompactionSettings({ auto })`.
|
|
222
|
-
3. **고정 계약**:
|
|
222
|
+
3. **고정 계약**: 모든 session은 하나의 fresh-context Compact를 사용한다. Main은 Memory handoff, Agent는 session-local handoff를 사용하며 type 선택 UI는 없다.
|
|
223
223
|
|
|
224
224
|
### Memory / Recap / Core Memory
|
|
225
225
|
|
|
@@ -260,7 +260,7 @@ TUI·Desktop interval 편집 UI는 없다.
|
|
|
260
260
|
|
|
261
261
|
---
|
|
262
262
|
|
|
263
|
-
## 4. MCP·Skills·Plugins·Hooks
|
|
263
|
+
## 4. MCP·Skills·Plugins·Hooks(내부)
|
|
264
264
|
|
|
265
265
|
### MCP 추가
|
|
266
266
|
|
|
@@ -319,14 +319,13 @@ UI 생성 액션은 없다.
|
|
|
319
319
|
|
|
320
320
|
Plugin toggle은 해당 Plugin의 Skills와 MCP를 전역으로 함께 활성화/비활성화한다. 개별 MCP와 Skill은 각 화면에서도 관리할 수 있다.
|
|
321
321
|
|
|
322
|
-
### Hooks
|
|
322
|
+
### Hooks (사용자 설정 UI 없음)
|
|
323
323
|
|
|
324
|
-
1.
|
|
325
|
-
2.
|
|
326
|
-
3.
|
|
327
|
-
4.
|
|
328
|
-
5.
|
|
329
|
-
6. **검증**: mtime 기반 자동 reload 후 Hooks 목록과 대상 event 발동을 확인한다.
|
|
324
|
+
1. **범위**: hook은 plugin·내부 연동 전용이다. Desktop 설정 화면과 `/hooks` 슬래시 명령은 제공하지 않으므로 사용자 옵션으로 안내하지 않는다.
|
|
325
|
+
2. **구성**: hook config 파일을 직접 편집하거나 runtime `addHookRule()` / `setHookRuleEnabled()` / `deleteHookRule()`을 사용한다.
|
|
326
|
+
3. **검색 경로**: `MIXDOG_HOOKS_FILE` → 프로젝트 `.mixdog/hooks.json`·`.mixdog/hooks/hooks.json` → 글로벌 `<mixdogData>/hooks.json`·`hooks/hooks.json` → plugin hooks.
|
|
327
|
+
4. **형식**: 표준 `{ "hooks": { "<Event>": [{ "matcher": "...", "hooks": [...] }] } }`; 레거시 before-tool 배열도 읽는다.
|
|
328
|
+
5. **검증**: mtime 기반 자동 reload 후 `/doctor`의 hooks 행과 대상 event 발동을 확인한다.
|
|
330
329
|
|
|
331
330
|
---
|
|
332
331
|
|
|
@@ -415,7 +414,7 @@ Desktop과 현재 runtime에서 소비되지 않는 아래 key는 사용자 옵
|
|
|
415
414
|
| `channels.webhook.ngrokDomain`, `channels.webhook.respectQuiet` | 제거; endpoint URL은 Desktop Webhooks가 발급 |
|
|
416
415
|
| `agent.outputStyle` | 제거 (이관 없음; 루트 `outputStyle`만 유효) |
|
|
417
416
|
|
|
418
|
-
다음 항목은 레거시처럼 보여도 현행이므로 유지한다: 루트 `outputStyle`, `agent.shell`, `agent.modules`, compaction의 `
|
|
417
|
+
다음 항목은 레거시처럼 보여도 현행이므로 유지한다: 루트 `outputStyle`, `agent.shell`, `agent.modules`, compaction의 `auto`, `summaryModel`, `timeoutMs`, `memoryTimeoutMs`, buffer/target fields.
|
|
419
418
|
|
|
420
419
|
---
|
|
421
420
|
|
|
@@ -23,22 +23,22 @@ import { resolveAgentSessionPermission } from '../internal-agents.mjs';
|
|
|
23
23
|
import { loadConfig } from '../config.mjs';
|
|
24
24
|
import { AGENT_OWNER } from '../agent-owner.mjs';
|
|
25
25
|
|
|
26
|
-
import {
|
|
27
|
-
COMPACT_TYPE_SEMANTIC,
|
|
28
|
-
normalizeCompactType,
|
|
29
|
-
} from '../session/compact.mjs';
|
|
30
|
-
|
|
31
26
|
function normalizeAgentCompactionConfig(value = {}) {
|
|
32
27
|
const raw = value && typeof value === 'object' ? value : {};
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
const next = { ...raw };
|
|
29
|
+
if (!next.summaryModel && raw.semanticModel) next.summaryModel = raw.semanticModel;
|
|
30
|
+
if (!next.memoryTimeoutMs && raw.recallMemoryTimeoutMs) next.memoryTimeoutMs = raw.recallMemoryTimeoutMs;
|
|
31
|
+
for (const key of [
|
|
32
|
+
'type', 'compactType', 'compact_type', 'semantic', 'semanticModel', 'prune', 'tailTurns',
|
|
33
|
+
'recallMemoryTimeoutMs', 'recallIngestLimit', 'recallChunkLimit', 'recallLimit',
|
|
34
|
+
'recallCycle1BatchSize', 'recallRowsPerSession', 'recallWindowSize',
|
|
35
|
+
'recallConcurrency', 'recallCycle1DeadlineMs',
|
|
36
|
+
]) {
|
|
37
|
+
delete next[key];
|
|
38
|
+
}
|
|
37
39
|
return {
|
|
38
|
-
...
|
|
40
|
+
...next,
|
|
39
41
|
auto: raw.auto !== false && raw.enabled !== false,
|
|
40
|
-
type: compactType,
|
|
41
|
-
compactType,
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -67,8 +67,6 @@ function traceAgentCompact({
|
|
|
67
67
|
iteration,
|
|
68
68
|
stage,
|
|
69
69
|
trigger,
|
|
70
|
-
compact_type,
|
|
71
|
-
prune_count,
|
|
72
70
|
compact_changed,
|
|
73
71
|
input_prefix_hash,
|
|
74
72
|
before_count,
|
|
@@ -97,8 +95,6 @@ function traceAgentCompact({
|
|
|
97
95
|
kind: 'compact_meta',
|
|
98
96
|
stage: stage || null,
|
|
99
97
|
trigger: trigger || null,
|
|
100
|
-
compact_type: compact_type || null,
|
|
101
|
-
prune_count: prune_count ?? 0,
|
|
102
98
|
compact_changed: !!compact_changed,
|
|
103
99
|
input_prefix_hash: input_prefix_hash || null,
|
|
104
100
|
before_count: before_count ?? null,
|
|
@@ -290,14 +290,6 @@ function nonEmptyConfigObject(value) {
|
|
|
290
290
|
return Object.keys(value).length > 0 ? value : undefined;
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
-
function normalizeStoredCompactionType(value) {
|
|
294
|
-
const raw = String(value ?? '').trim().toLowerCase().replace(/_/g, '-');
|
|
295
|
-
if (['1', 'type1', 'type-1', 'semantic', 'summary', 'default'].includes(raw)) return 'semantic';
|
|
296
|
-
if (['2', 'type2', 'type-2', 'recall', 'recall-fast', 'recall-fasttrack',
|
|
297
|
-
'recall-fast-track', 'fasttrack', 'fast-track'].includes(raw)) return 'recall-fasttrack';
|
|
298
|
-
return 'recall-fasttrack';
|
|
299
|
-
}
|
|
300
|
-
|
|
301
293
|
function canonicalizeAutoClearStorage(value) {
|
|
302
294
|
const raw = configObject(value);
|
|
303
295
|
const next = { ...raw };
|
|
@@ -331,15 +323,18 @@ function canonicalizeAutoClearStorage(value) {
|
|
|
331
323
|
function canonicalizeCompactionStorage(value) {
|
|
332
324
|
const raw = configObject(value);
|
|
333
325
|
const next = { ...raw };
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
if (hasType) next.type = normalizeStoredCompactionType(raw.type ?? raw.compactType ?? raw.compact_type);
|
|
326
|
+
if (!next.summaryModel && raw.semanticModel) next.summaryModel = raw.semanticModel;
|
|
327
|
+
if (!next.memoryTimeoutMs && raw.recallMemoryTimeoutMs) next.memoryTimeoutMs = raw.recallMemoryTimeoutMs;
|
|
337
328
|
if (Object.prototype.hasOwnProperty.call(raw, 'auto')
|
|
338
329
|
|| Object.prototype.hasOwnProperty.call(raw, 'enabled')) {
|
|
339
330
|
next.auto = raw.auto !== false && raw.enabled !== false;
|
|
340
331
|
}
|
|
341
|
-
|
|
342
|
-
|
|
332
|
+
for (const key of [
|
|
333
|
+
'type', 'compactType', 'compact_type', 'semantic', 'semanticModel', 'prune', 'tailTurns',
|
|
334
|
+
'recallMemoryTimeoutMs', 'recallIngestLimit', 'recallChunkLimit', 'recallLimit',
|
|
335
|
+
'recallCycle1BatchSize', 'recallRowsPerSession', 'recallWindowSize',
|
|
336
|
+
'recallConcurrency', 'recallCycle1DeadlineMs',
|
|
337
|
+
]) delete next[key];
|
|
343
338
|
delete next.enabled;
|
|
344
339
|
return nonEmptyConfigObject(next);
|
|
345
340
|
}
|
|
@@ -66,11 +66,16 @@ function _normalize(result) {
|
|
|
66
66
|
const normalized = normalizeToolEnvelope(_normalize(result.result));
|
|
67
67
|
return makeToolEnvelope(normalized.result, result.newMessages, {
|
|
68
68
|
explicitSuccess: normalized.explicitSuccess || result.explicitSuccess === true,
|
|
69
|
+
explicitFailure: normalized.explicitFailure || result.explicitFailure === true,
|
|
69
70
|
});
|
|
70
71
|
}
|
|
71
72
|
if (result && typeof result === 'object' && Array.isArray(result.content)) {
|
|
72
73
|
const hasStructuredMedia = result.content.some((part) => part && typeof part === 'object' && part.type !== 'text');
|
|
73
|
-
if (hasStructuredMedia
|
|
74
|
+
if (hasStructuredMedia) {
|
|
75
|
+
return result.isError === true
|
|
76
|
+
? makeToolEnvelope(result, [], { explicitFailure: true })
|
|
77
|
+
: result;
|
|
78
|
+
}
|
|
74
79
|
const text = result.content
|
|
75
80
|
.map((c) => (c?.type === 'text' ? c.text || '' : JSON.stringify(c)))
|
|
76
81
|
.join('\n');
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
anthropicFallbackProviderMetadata,
|
|
12
12
|
parseAnthropicFallbackBlock,
|
|
13
13
|
} from '../anthropic-server-fallback.mjs';
|
|
14
|
+
import { SUMMARY_PREFIX_ANCHOR } from '../../session/compact/constants.mjs';
|
|
14
15
|
|
|
15
16
|
export const ANTHROPIC_CACHE_TTL_STABLE = { type: 'ephemeral', ttl: '1h' };
|
|
16
17
|
export const ANTHROPIC_CACHE_TTL_VOLATILE = { type: 'ephemeral' };
|
|
@@ -294,6 +295,39 @@ export function normalizeAnthropicNonStreamingResponse(message, fallbackModel =
|
|
|
294
295
|
};
|
|
295
296
|
}
|
|
296
297
|
|
|
298
|
+
function mergeAnthropicFlatProperty(current, incoming) {
|
|
299
|
+
if (!current || typeof current !== 'object') return structuredClone(incoming);
|
|
300
|
+
if (!incoming || typeof incoming !== 'object') return structuredClone(current);
|
|
301
|
+
const merged = { ...structuredClone(incoming), ...structuredClone(current) };
|
|
302
|
+
if (Array.isArray(current.enum) || Array.isArray(incoming.enum)) {
|
|
303
|
+
merged.enum = [...new Set([
|
|
304
|
+
...(Array.isArray(current.enum) ? current.enum : []),
|
|
305
|
+
...(Array.isArray(incoming.enum) ? incoming.enum : []),
|
|
306
|
+
])];
|
|
307
|
+
}
|
|
308
|
+
if (current.properties || incoming.properties) {
|
|
309
|
+
merged.properties = {};
|
|
310
|
+
for (const [name, property] of Object.entries(current.properties || {})) {
|
|
311
|
+
merged.properties[name] = structuredClone(property);
|
|
312
|
+
}
|
|
313
|
+
for (const [name, property] of Object.entries(incoming.properties || {})) {
|
|
314
|
+
merged.properties[name] = mergeAnthropicFlatProperty(
|
|
315
|
+
merged.properties[name],
|
|
316
|
+
property,
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
if (Array.isArray(current.required) && Array.isArray(incoming.required)) {
|
|
321
|
+
const incomingRequired = new Set(incoming.required);
|
|
322
|
+
const sharedRequired = current.required.filter((name) => incomingRequired.has(name));
|
|
323
|
+
if (sharedRequired.length) merged.required = sharedRequired;
|
|
324
|
+
else delete merged.required;
|
|
325
|
+
} else {
|
|
326
|
+
delete merged.required;
|
|
327
|
+
}
|
|
328
|
+
return merged;
|
|
329
|
+
}
|
|
330
|
+
|
|
297
331
|
export function sanitizeAnthropicInputSchema(schema, toolName, logTag) {
|
|
298
332
|
if (!schema || typeof schema !== 'object') {
|
|
299
333
|
return { type: 'object', properties: {} };
|
|
@@ -304,7 +338,9 @@ export function sanitizeAnthropicInputSchema(schema, toolName, logTag) {
|
|
|
304
338
|
const branchDescs = [];
|
|
305
339
|
for (const branch of Array.isArray(compound) ? compound : []) {
|
|
306
340
|
if (branch && typeof branch === 'object' && branch.properties) {
|
|
307
|
-
Object.
|
|
341
|
+
for (const [name, property] of Object.entries(branch.properties)) {
|
|
342
|
+
mergedProps[name] = mergeAnthropicFlatProperty(mergedProps[name], property);
|
|
343
|
+
}
|
|
308
344
|
}
|
|
309
345
|
if (branch && typeof branch === 'object') {
|
|
310
346
|
const parts = [];
|
|
@@ -336,6 +372,10 @@ export function sanitizeAnthropicInputSchema(schema, toolName, logTag) {
|
|
|
336
372
|
type: 'object',
|
|
337
373
|
...(description ? { description } : {}),
|
|
338
374
|
properties: mergedProps,
|
|
375
|
+
...(Array.isArray(schema.required) && schema.required.length
|
|
376
|
+
? { required: [...schema.required] }
|
|
377
|
+
: {}),
|
|
378
|
+
...(schema.additionalProperties === false ? { additionalProperties: false } : {}),
|
|
339
379
|
};
|
|
340
380
|
}
|
|
341
381
|
|
|
@@ -470,10 +510,20 @@ export function applyAnthropicCacheMarkers(sanitizedMessages, {
|
|
|
470
510
|
const tailIdx = sanitizedMessages.length - 1;
|
|
471
511
|
return hasUserText(sanitizedMessages[tailIdx]) ? tailIdx : -1;
|
|
472
512
|
};
|
|
513
|
+
const compactSummaryIdx = () => {
|
|
514
|
+
for (let i = sanitizedMessages.length - 1; i >= 0; i--) {
|
|
515
|
+
const message = sanitizedMessages[i];
|
|
516
|
+
if (message?.role === 'user' && firstText(message.content).startsWith(SUMMARY_PREFIX_ANCHOR)) return i;
|
|
517
|
+
}
|
|
518
|
+
return -1;
|
|
519
|
+
};
|
|
473
520
|
if (messageTtl !== null) {
|
|
474
521
|
const slots = Math.max(0, Math.min(4, Number(messageSlots) || 0));
|
|
475
522
|
const marked = new Set();
|
|
476
|
-
|
|
523
|
+
// A post-compact summary is the largest stable session-specific prefix:
|
|
524
|
+
// reserve the first available message slot for it. Additional slots
|
|
525
|
+
// still advance through the normal live-tail candidates.
|
|
526
|
+
const candidates = [compactSummaryIdx(), currentTailUserIdx(), latestToolResultTailIdx(), previousUserTextAnchorIdx(), firstRequestUserPromptIdx()];
|
|
477
527
|
for (const idx of candidates) {
|
|
478
528
|
if (slots <= 0) break;
|
|
479
529
|
if (idx < 0 || marked.has(idx)) continue;
|
|
@@ -73,8 +73,8 @@ import {
|
|
|
73
73
|
import { resolveOpenAiTransportPolicy } from './openai-transport-policy.mjs';
|
|
74
74
|
import { envPositiveInt } from './lib/env-utils.mjs';
|
|
75
75
|
|
|
76
|
-
// Legacy import paths for
|
|
77
|
-
//
|
|
76
|
+
// Legacy import paths for mixdog-session-runtime.mjs (drainOpenaiWsPool),
|
|
77
|
+
// the scripts/provider-toolcall/ suites (parseToolSearchArgs,
|
|
78
78
|
// _logicalResponseItemMatch, _streamResponse) and other external callers.
|
|
79
79
|
export {
|
|
80
80
|
drainOpenaiWsPool,
|
|
@@ -7,13 +7,6 @@ import { traceAgentLoop, traceAgentTool, traceAgentToolFailure, traceAgentCompac
|
|
|
7
7
|
import { resolveSessionMaxLoopIterations } from '../agent-runtime/agent-loop-policy.mjs';
|
|
8
8
|
import { isAgentOwner } from '../agent-owner.mjs';
|
|
9
9
|
import { markSessionToolCall, updateSessionStage, SessionClosedError, bumpUsageMetricsEpoch } from './manager.mjs';
|
|
10
|
-
import {
|
|
11
|
-
pruneToolOutputs,
|
|
12
|
-
pruneToolOutputsUnanchored,
|
|
13
|
-
semanticCompactMessages,
|
|
14
|
-
effectiveBudget as compactEffectiveBudget,
|
|
15
|
-
DEFAULT_COMPACT_TYPE,
|
|
16
|
-
} from './compact.mjs';
|
|
17
10
|
import { isContextOverflowError } from '../providers/retry-classifier.mjs';
|
|
18
11
|
import { tryReadCached, setReadCached, invalidatePathForSession, clearReadDedupSession, extractTouchedPathsFromPatch, tryScopedToolCached, setScopedToolCached, clearScopedToolsForSession, clearScopedToolsForSessionPaths, invalidatePrefetchCache } from './read-dedup.mjs';
|
|
19
12
|
import { isInvalidToolArgsMarker, formatInvalidToolArgsResult } from '../providers/openai-compat-stream.mjs';
|
|
@@ -60,10 +53,8 @@ import {
|
|
|
60
53
|
compactionTelemetryPressureTokens,
|
|
61
54
|
compactTargetBudget,
|
|
62
55
|
shouldCompactForSession,
|
|
63
|
-
countPrunedToolOutputs,
|
|
64
56
|
rememberCompactTelemetry,
|
|
65
57
|
emitCompactEvent,
|
|
66
|
-
compactEventType,
|
|
67
58
|
} from './loop/compact-policy.mjs';
|
|
68
59
|
import {
|
|
69
60
|
isEagerDispatchable,
|