mixdog 0.8.0 → 0.9.0
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 +47 -23
- package/package.json +33 -27
- package/scripts/_test-folder-dialog.mjs +30 -0
- package/scripts/agent-parallel-smoke.mjs +388 -0
- package/scripts/agent-tag-reuse-smoke.mjs +183 -0
- package/scripts/background-task-meta-smoke.mjs +38 -0
- package/scripts/boot-smoke.mjs +52 -9
- package/scripts/build-runtime-linux.sh +348 -0
- package/scripts/build-runtime-macos.sh +217 -0
- package/scripts/build-runtime-windows.ps1 +242 -0
- package/scripts/compact-active-turn-test.mjs +68 -0
- package/scripts/compact-smoke.mjs +859 -129
- package/scripts/compact-trigger-migration-smoke.mjs +187 -0
- package/scripts/fix-brief-fn.mjs +35 -0
- package/scripts/fix-format-tool-surface.mjs +24 -0
- package/scripts/fix-tool-exec-visible.mjs +42 -0
- package/scripts/generate-runtime-manifest.mjs +166 -0
- package/scripts/hook-bus-test.mjs +330 -0
- package/scripts/lead-workflow-smoke.mjs +33 -39
- package/scripts/live-worker-smoke.mjs +43 -37
- package/scripts/llm-trace-summary.mjs +315 -0
- package/scripts/memory-meta-concurrency-test.mjs +20 -0
- package/scripts/output-style-smoke.mjs +56 -15
- package/scripts/parent-abort-link-test.mjs +44 -0
- package/scripts/patch-agent-brief.mjs +48 -0
- package/scripts/patch-app.mjs +21 -0
- package/scripts/patch-app2.mjs +18 -0
- package/scripts/patch-dist-brief.mjs +96 -0
- package/scripts/patch-tool-exec.mjs +70 -0
- package/scripts/pretool-ask-runtime-test.mjs +54 -0
- package/scripts/provider-toolcall-test.mjs +376 -0
- package/scripts/reactive-compact-persist-smoke.mjs +124 -0
- package/scripts/sanitize-tool-pairs-test.mjs +260 -0
- package/scripts/session-context-bench.mjs +344 -0
- package/scripts/session-ingest-smoke.mjs +177 -0
- package/scripts/set-effort-config-test.mjs +41 -0
- package/scripts/smoke-runtime-negative.ps1 +106 -0
- package/scripts/smoke-runtime-negative.sh +97 -0
- package/scripts/smoke.mjs +25 -0
- package/scripts/tool-result-hook-test.mjs +48 -0
- package/scripts/tool-smoke.mjs +1223 -95
- package/scripts/toolcall-args-test.mjs +150 -0
- package/scripts/tui-background-failure-smoke.mjs +73 -0
- package/scripts/usage-metrics-epoch-smoke.mjs +114 -0
- package/src/agents/debugger/AGENT.md +8 -0
- package/src/agents/explore/AGENT.md +4 -0
- package/src/agents/heavy-worker/AGENT.md +9 -3
- package/src/agents/maintainer/AGENT.md +4 -0
- package/src/agents/reviewer/AGENT.md +8 -0
- package/src/agents/scheduler-task/AGENT.md +12 -0
- package/src/agents/scheduler-task/agent.json +6 -0
- package/src/agents/webhook-handler/AGENT.md +12 -0
- package/src/agents/webhook-handler/agent.json +6 -0
- package/src/agents/worker/AGENT.md +9 -3
- package/src/app.mjs +77 -3
- package/src/defaults/hidden-roles.json +17 -12
- package/src/headless-role.mjs +117 -0
- package/src/help.mjs +30 -0
- package/src/hooks/lib/permission-evaluator.cjs +11 -475
- package/src/lib/keychain-cjs.cjs +9 -1
- package/src/lib/mixdog-debug.cjs +0 -7
- package/src/lib/rules-builder.cjs +240 -96
- package/src/lib/text-utils.cjs +1 -1
- package/src/mixdog-session-runtime.mjs +2325 -450
- package/src/output-styles/default.md +12 -28
- package/src/output-styles/extreme-simple.md +9 -6
- package/src/output-styles/simple.md +22 -9
- package/src/repl.mjs +118 -59
- package/src/rules/agent/00-common.md +15 -0
- package/src/rules/{bridge → agent}/20-skip-protocol.md +1 -2
- package/src/rules/agent/30-explorer.md +22 -0
- package/src/rules/{bridge → agent}/40-cycle1-agent.md +7 -0
- package/src/rules/{bridge → agent}/41-cycle2-agent.md +7 -0
- package/src/rules/{bridge → agent}/42-cycle3-agent.md +7 -0
- package/src/rules/lead/01-general.md +9 -5
- package/src/rules/lead/04-workflow.md +51 -12
- package/src/rules/lead/lead-tool.md +6 -0
- package/src/rules/shared/01-tool.md +12 -1
- package/src/runtime/agent/orchestrator/activity-bus.mjs +7 -18
- package/src/runtime/agent/orchestrator/agent-owner.mjs +11 -0
- package/src/runtime/agent/orchestrator/{smart-bridge/bridge-llm.mjs → agent-runtime/agent-dispatch.mjs} +138 -111
- package/src/runtime/agent/orchestrator/agent-runtime/agent-progress-watchdog.mjs +94 -0
- package/src/runtime/agent/orchestrator/{smart-bridge → agent-runtime}/cache-strategy.mjs +32 -23
- package/src/runtime/agent/orchestrator/{smart-bridge → agent-runtime}/session-builder.mjs +33 -27
- package/src/runtime/agent/orchestrator/{bridge-trace.mjs → agent-trace.mjs} +132 -81
- package/src/runtime/agent/orchestrator/cache-mtime.mjs +0 -21
- package/src/runtime/agent/orchestrator/config.mjs +174 -55
- package/src/runtime/agent/orchestrator/context/collect.mjs +195 -487
- package/src/runtime/agent/orchestrator/dispatch-persist.mjs +1 -1
- package/src/runtime/agent/orchestrator/internal-roles.mjs +77 -29
- package/src/runtime/agent/orchestrator/internal-tools.mjs +5 -6
- package/src/runtime/agent/orchestrator/mcp/client.mjs +15 -9
- package/src/runtime/agent/orchestrator/providers/anthropic-betas.mjs +7 -1
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth.mjs +377 -243
- package/src/runtime/agent/orchestrator/providers/anthropic.mjs +146 -93
- package/src/runtime/agent/orchestrator/providers/api-usage.mjs +236 -4
- package/src/runtime/agent/orchestrator/providers/custom-tool-wire.mjs +49 -0
- package/src/runtime/agent/orchestrator/providers/gemini.mjs +58 -13
- package/src/runtime/agent/orchestrator/providers/grok-oauth.mjs +67 -149
- package/src/runtime/agent/orchestrator/providers/media-normalization.mjs +132 -2
- package/src/runtime/agent/orchestrator/providers/model-catalog.mjs +4 -1
- package/src/runtime/agent/orchestrator/providers/oauth-credential-probes.mjs +45 -0
- package/src/runtime/agent/orchestrator/providers/oauth-usage.mjs +61 -116
- package/src/runtime/agent/orchestrator/providers/openai-compat-presets.mjs +25 -0
- package/src/runtime/agent/orchestrator/providers/openai-compat-stream.mjs +79 -255
- package/src/runtime/agent/orchestrator/providers/openai-compat.mjs +221 -70
- package/src/runtime/agent/orchestrator/providers/openai-oauth-ws.mjs +477 -147
- package/src/runtime/agent/orchestrator/providers/openai-oauth.mjs +343 -496
- package/src/runtime/agent/orchestrator/providers/openai-ws.mjs +6 -6
- package/src/runtime/agent/orchestrator/providers/registry.mjs +88 -51
- package/src/runtime/agent/orchestrator/providers/retry-classifier.mjs +31 -11
- package/src/runtime/agent/orchestrator/providers/statusline-route-meta.mjs +41 -8
- package/src/runtime/agent/orchestrator/session/cache/post-edit-marks.mjs +4 -4
- package/src/runtime/agent/orchestrator/session/cache/read-cache.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/compact.mjs +1173 -267
- package/src/runtime/agent/orchestrator/session/context-utils.mjs +199 -36
- package/src/runtime/agent/orchestrator/session/loop.mjs +851 -674
- package/src/runtime/agent/orchestrator/session/manager.mjs +1593 -466
- package/src/runtime/agent/orchestrator/session/manager.reactive-persist.test.mjs +107 -0
- package/src/runtime/agent/orchestrator/session/store.mjs +291 -46
- package/src/runtime/agent/orchestrator/session/tool-result-offload.mjs +2 -2
- package/src/runtime/agent/orchestrator/stall-policy.mjs +31 -16
- package/src/runtime/agent/orchestrator/tool-loop-guard.mjs +3 -219
- package/src/runtime/agent/orchestrator/tools/bash-session.mjs +34 -7
- package/src/runtime/agent/orchestrator/tools/builtin/advisory-lock.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/arg-guard.mjs +19 -0
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool.mjs +9 -9
- package/src/runtime/agent/orchestrator/tools/builtin/builtin-tools.mjs +60 -37
- package/src/runtime/agent/orchestrator/tools/builtin/cache-layers.mjs +21 -2
- package/src/runtime/agent/orchestrator/tools/builtin/device-paths.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/diagnostics-tool.mjs +0 -7
- package/src/runtime/agent/orchestrator/tools/builtin/glob-walk.mjs +1 -3
- package/src/runtime/agent/orchestrator/tools/builtin/list-tool.mjs +36 -12
- package/src/runtime/agent/orchestrator/tools/builtin/read-args.mjs +2 -0
- package/src/runtime/agent/orchestrator/tools/builtin/read-constants.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/read-formatting.mjs +5 -12
- package/src/runtime/agent/orchestrator/tools/builtin/read-image-resize.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/read-single-tool.mjs +4 -36
- package/src/runtime/agent/orchestrator/tools/builtin/read-tool.mjs +2 -40
- package/src/runtime/agent/orchestrator/tools/builtin/rg-runner.mjs +148 -27
- package/src/runtime/agent/orchestrator/tools/builtin/search-builders.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/search-tool.mjs +43 -75
- package/src/runtime/agent/orchestrator/tools/builtin/shell-jobs.mjs +90 -20
- package/src/runtime/agent/orchestrator/tools/builtin/snapshot-store.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin.mjs +59 -5
- package/src/runtime/agent/orchestrator/tools/code-graph-state.mjs +86 -0
- package/src/runtime/agent/orchestrator/tools/code-graph-tool-defs.mjs +11 -11
- package/src/runtime/agent/orchestrator/tools/code-graph.mjs +4106 -4019
- package/src/runtime/agent/orchestrator/tools/patch-tool-defs.mjs +33 -4
- package/src/runtime/agent/orchestrator/tools/patch.mjs +90 -6
- package/src/runtime/agent/orchestrator/tools/progress-message.mjs +6 -4
- package/src/runtime/agent/orchestrator/tools/result-compression.mjs +4 -4
- package/src/runtime/agent/orchestrator/tools/shell-command.mjs +8 -1
- package/src/runtime/agent/orchestrator/tools/shell-snapshot.mjs +4 -4
- package/src/runtime/channels/index.mjs +152 -24
- package/src/runtime/channels/lib/scheduler.mjs +18 -14
- package/src/runtime/channels/lib/session-discovery.mjs +3 -2
- package/src/runtime/channels/lib/tool-format.mjs +0 -2
- package/src/runtime/channels/lib/transcript-discovery.mjs +3 -2
- package/src/runtime/channels/lib/webhook.mjs +1 -1
- package/src/runtime/channels/tool-defs.mjs +29 -29
- package/src/runtime/memory/index.mjs +635 -107
- package/src/runtime/memory/lib/agent-ipc.mjs +29 -12
- package/src/runtime/memory/lib/core-memory-store.mjs +2 -2
- package/src/runtime/memory/lib/embedding-model-config.mjs +55 -0
- package/src/runtime/memory/lib/embedding-provider.mjs +31 -4
- package/src/runtime/memory/lib/embedding-worker.mjs +19 -10
- package/src/runtime/memory/lib/memory-cycle1.mjs +38 -17
- package/src/runtime/memory/lib/memory-cycle2.mjs +6 -7
- package/src/runtime/memory/lib/memory-cycle3.mjs +4 -4
- package/src/runtime/memory/lib/memory-ops-policy.mjs +2 -1
- package/src/runtime/memory/lib/memory-session-merge.mjs +38 -0
- package/src/runtime/memory/lib/memory.mjs +88 -9
- package/src/runtime/memory/lib/model-profile.mjs +1 -1
- package/src/runtime/memory/lib/pg/adapter.mjs +15 -1
- package/src/runtime/memory/lib/pg/supervisor.mjs +12 -0
- package/src/runtime/memory/lib/runtime-fetcher.mjs +37 -3
- package/src/runtime/memory/lib/session-ingest.mjs +194 -0
- package/src/runtime/memory/lib/trace-store.mjs +96 -51
- package/src/runtime/memory/tool-defs.mjs +46 -37
- package/src/runtime/search/index.mjs +102 -466
- package/src/runtime/search/lib/web-tools.mjs +45 -25
- package/src/runtime/search/tool-defs.mjs +16 -23
- package/src/runtime/shared/abort-controller.mjs +1 -1
- package/src/runtime/shared/atomic-file.mjs +4 -3
- package/src/runtime/shared/background-tasks.mjs +122 -11
- package/src/runtime/shared/child-spawn-gate.mjs +145 -0
- package/src/runtime/shared/config.mjs +7 -4
- package/src/runtime/shared/err-text.mjs +131 -4
- package/src/runtime/shared/llm/cost.mjs +2 -2
- package/src/runtime/shared/llm/http-agent.mjs +23 -7
- package/src/runtime/shared/llm/index.mjs +34 -11
- package/src/runtime/shared/llm/usage-log.mjs +4 -4
- package/src/runtime/shared/markdown-frontmatter.mjs +56 -0
- package/src/runtime/shared/singleton-owner.mjs +104 -0
- package/src/runtime/shared/tool-execution-contract.mjs +199 -20
- package/src/runtime/shared/tool-execution-contract.test.mjs +183 -0
- package/src/runtime/shared/tool-surface.mjs +624 -98
- package/src/runtime/shared/user-data-guard.mjs +0 -2
- package/src/standalone/agent-task-status.mjs +203 -0
- package/src/standalone/agent-task-status.test.mjs +76 -0
- package/src/standalone/agent-tool.mjs +1913 -0
- package/src/standalone/channel-worker.mjs +370 -14
- package/src/standalone/explore-tool.mjs +165 -70
- package/src/standalone/folder-dialog.mjs +314 -0
- package/src/standalone/hook-bus.mjs +898 -22
- package/src/standalone/memory-runtime-proxy.mjs +320 -0
- package/src/standalone/projects.mjs +226 -0
- package/src/standalone/provider-admin.mjs +41 -24
- package/src/standalone/seeds.mjs +2 -69
- package/src/standalone/usage-dashboard.mjs +96 -8
- package/src/tui/App.jsx +4798 -2153
- package/src/tui/components/AnsiText.jsx +39 -28
- package/src/tui/components/ContextPanel.jsx +87 -29
- package/src/tui/components/Markdown.jsx +43 -77
- package/src/tui/components/MarkdownTable.jsx +9 -184
- package/src/tui/components/Message.jsx +28 -11
- package/src/tui/components/Picker.jsx +95 -56
- package/src/tui/components/PromptInput.jsx +367 -239
- package/src/tui/components/QueuedCommands.jsx +1 -1
- package/src/tui/components/SlashCommandPalette.jsx +27 -21
- package/src/tui/components/Spinner.jsx +67 -38
- package/src/tui/components/StatusLine.jsx +606 -38
- package/src/tui/components/TextEntryPanel.jsx +128 -9
- package/src/tui/components/ToolExecution.jsx +617 -368
- package/src/tui/components/TurnDone.jsx +3 -3
- package/src/tui/components/UsagePanel.jsx +3 -5
- package/src/tui/components/tool-output-format.mjs +365 -0
- package/src/tui/components/tool-output-format.test.mjs +220 -0
- package/src/tui/dist/index.mjs +8915 -2418
- package/src/tui/engine-runtime-notification.test.mjs +115 -0
- package/src/tui/engine-tool-result-text.test.mjs +75 -0
- package/src/tui/engine.mjs +1455 -279
- package/src/tui/figures.mjs +21 -40
- package/src/tui/index.jsx +75 -31
- package/src/tui/input-editing.mjs +25 -0
- package/src/tui/markdown/format-token.mjs +511 -68
- package/src/tui/markdown/format-token.test.mjs +216 -0
- package/src/tui/markdown/render-ansi.mjs +94 -0
- package/src/tui/markdown/render-ansi.test.mjs +108 -0
- package/src/tui/markdown/stream-fence.mjs +34 -0
- package/src/tui/markdown/stream-fence.test.mjs +26 -0
- package/src/tui/markdown/table-layout.mjs +250 -0
- package/src/tui/paste-attachments.mjs +0 -7
- package/src/tui/spinner-verbs.mjs +1 -2
- package/src/tui/statusline-ansi-bridge.mjs +172 -0
- package/src/tui/statusline-ansi-bridge.test.mjs +159 -0
- package/src/tui/theme.mjs +746 -24
- package/src/tui/time-format.mjs +1 -1
- package/src/tui/transcript-tool-failures.mjs +67 -0
- package/src/tui/transcript-tool-failures.test.mjs +111 -0
- package/src/ui/ansi.mjs +1 -2
- package/src/ui/markdown.mjs +85 -26
- package/src/ui/markdown.test.mjs +70 -0
- package/src/ui/model-display.mjs +121 -0
- package/src/ui/session-stats.mjs +44 -0
- package/src/ui/statusline-context-label.test.mjs +15 -0
- package/src/ui/statusline.mjs +386 -178
- package/src/ui/tool-card.mjs +3 -16
- package/src/vendor/statusline/bin/statusline-lib.mjs +8 -4
- package/src/vendor/statusline/bin/statusline-route.mjs +169 -37
- package/src/vendor/statusline/bin/statusline-route.test.mjs +80 -0
- package/src/vendor/statusline/scripts/lib/gateway-settings.mjs +3 -3
- package/src/vendor/statusline/src/gateway/claude-current.mjs +1 -1
- package/src/vendor/statusline/src/gateway/route-meta.mjs +44 -6
- package/src/vendor/statusline/src/gateway/session-routes.mjs +1 -1
- package/src/workflows/default/WORKFLOW.md +12 -5
- package/src/workflows/default/workflow.json +0 -1
- package/src/workflows/solo/WORKFLOW.md +15 -0
- package/src/workflows/solo/workflow.json +7 -0
- package/vendor/ink/build/output.js +6 -1
- package/src/agents/scheduler-task.md +0 -3
- package/src/agents/web-researcher/AGENT.md +0 -3
- package/src/agents/web-researcher/agent.json +0 -6
- package/src/agents/webhook-handler.md +0 -3
- package/src/rules/bridge/00-common.md +0 -5
- package/src/rules/bridge/30-explorer.md +0 -4
- package/src/rules/lead/00-tool-lead.md +0 -5
- package/src/rules/shared/00-language.md +0 -3
- package/src/runtime/agent/orchestrator/tools/builtin/native-edit-runner.mjs +0 -110
- package/src/runtime/agent/orchestrator/tools/mutation-content-cache.mjs +0 -67
- package/src/runtime/memory/lib/bridge-trace-queries.mjs +0 -120
- package/src/runtime/shared/llm/pid-cleanup.mjs +0 -27
- package/src/standalone/bridge-tool.mjs +0 -1414
- package/src/tui/runtime/shared/process-shutdown.mjs +0 -1
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Focused coverage for the legacy derived full-window autoCompactTokenLimit
|
|
3
|
+
// migration and the buffer-config preservation fix. No provider / network /
|
|
4
|
+
// disk-store dependency — pure function assertions on the manager helpers.
|
|
5
|
+
import {
|
|
6
|
+
_resolveSessionContextMeta as resolveSessionContextMeta,
|
|
7
|
+
_compactTriggerForSession as compactTriggerForSession,
|
|
8
|
+
_preserveBufferConfigFields as preserveBufferConfigFields,
|
|
9
|
+
} from '../src/runtime/agent/orchestrator/session/manager.mjs';
|
|
10
|
+
import { _autoCompactTokenLimit as routeMetaAutoCompactTokenLimit } from '../src/vendor/statusline/src/gateway/route-meta.mjs';
|
|
11
|
+
import {
|
|
12
|
+
_routeContextMeta as routeContextMeta,
|
|
13
|
+
_resolveStatusAutoCompactTokenLimit as resolveStatusAutoCompactTokenLimit,
|
|
14
|
+
} from '../src/vendor/statusline/bin/statusline-route.mjs';
|
|
15
|
+
|
|
16
|
+
function assert(condition, message) {
|
|
17
|
+
if (!condition) throw new Error(message);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// 1) A legacy seed where autoCompactTokenLimit == contextWindow/boundary must
|
|
21
|
+
// NOT be re-accepted as an explicit limit; it is dropped to null so the
|
|
22
|
+
// trigger falls back to the default boundary trigger.
|
|
23
|
+
{
|
|
24
|
+
const seed = {
|
|
25
|
+
contextWindow: 200000,
|
|
26
|
+
rawContextWindow: 200000,
|
|
27
|
+
effectiveContextWindowPercent: 100,
|
|
28
|
+
autoCompactTokenLimit: 200000, // legacy derived full-window value
|
|
29
|
+
compactBoundaryTokens: 200000,
|
|
30
|
+
};
|
|
31
|
+
const meta = resolveSessionContextMeta(null, 'claude-haiku-4-5-20251001', seed);
|
|
32
|
+
assert(meta.autoCompactTokenLimit === null,
|
|
33
|
+
`legacy full-window autoCompactTokenLimit should drop to null, got ${meta.autoCompactTokenLimit}`);
|
|
34
|
+
assert(meta.compactBoundaryTokens === 200000,
|
|
35
|
+
`boundary should stay full window, got ${meta.compactBoundaryTokens}`);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// 2) A genuinely-lower explicit limit (< boundary) is preserved.
|
|
39
|
+
{
|
|
40
|
+
const seed = {
|
|
41
|
+
contextWindow: 200000,
|
|
42
|
+
rawContextWindow: 200000,
|
|
43
|
+
effectiveContextWindowPercent: 100,
|
|
44
|
+
autoCompactTokenLimit: 120000,
|
|
45
|
+
compactBoundaryTokens: 200000,
|
|
46
|
+
};
|
|
47
|
+
const meta = resolveSessionContextMeta(null, 'claude-haiku-4-5-20251001', seed);
|
|
48
|
+
assert(meta.autoCompactTokenLimit === 120000,
|
|
49
|
+
`sub-boundary explicit limit should be preserved, got ${meta.autoCompactTokenLimit}`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// 3) compactTriggerForSession ignores a boundary-equal stored autoCompactTokenLimit
|
|
53
|
+
// (legacy artifact) and applies the default 10% buffer; honors a sub-boundary one.
|
|
54
|
+
{
|
|
55
|
+
const boundary = 200000;
|
|
56
|
+
const legacy = compactTriggerForSession({ autoCompactTokenLimit: boundary, compaction: {} }, boundary);
|
|
57
|
+
assert(legacy === 180000, `legacy boundary-equal limit should yield default 10% trigger 180000, got ${legacy}`);
|
|
58
|
+
const explicit = compactTriggerForSession({ autoCompactTokenLimit: 150000, compaction: {} }, boundary);
|
|
59
|
+
assert(explicit === 150000, `sub-boundary explicit limit should be the trigger, got ${explicit}`);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// 4) A configured bufferPercent flows into the trigger via session.compaction.
|
|
63
|
+
{
|
|
64
|
+
const boundary = 200000;
|
|
65
|
+
// bufferPercent: 5 → 5% → trigger 190000.
|
|
66
|
+
const trigger = compactTriggerForSession({ compaction: { bufferPercent: 5 } }, boundary);
|
|
67
|
+
assert(trigger === 190000, `bufferPercent 5 should yield trigger 190000, got ${trigger}`);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// 5) Legacy telemetry from the old default 10% buffer is non-config and reapplies
|
|
71
|
+
// the current default 10% headroom (trigger 180000). Persisted zero-buffer
|
|
72
|
+
// telemetry migrates the same way.
|
|
73
|
+
{
|
|
74
|
+
const boundary = 200000;
|
|
75
|
+
const legacyTelemetry = compactTriggerForSession({
|
|
76
|
+
compaction: {
|
|
77
|
+
boundaryTokens: boundary,
|
|
78
|
+
triggerTokens: 180000,
|
|
79
|
+
bufferTokens: 20000,
|
|
80
|
+
bufferRatio: 0.1,
|
|
81
|
+
},
|
|
82
|
+
}, boundary);
|
|
83
|
+
assert(legacyTelemetry === 180000,
|
|
84
|
+
`legacy default buffer telemetry should yield 10% headroom trigger 180000, got ${legacyTelemetry}`);
|
|
85
|
+
const zeroTelemetry = compactTriggerForSession({
|
|
86
|
+
compaction: {
|
|
87
|
+
boundaryTokens: boundary,
|
|
88
|
+
triggerTokens: boundary,
|
|
89
|
+
bufferTokens: 0,
|
|
90
|
+
bufferRatio: 0,
|
|
91
|
+
},
|
|
92
|
+
}, boundary);
|
|
93
|
+
assert(zeroTelemetry === 180000,
|
|
94
|
+
`persisted zero-buffer telemetry should restore default 10% trigger 180000, got ${zeroTelemetry}`);
|
|
95
|
+
const explicitTokens = compactTriggerForSession({ compaction: { bufferTokens: 10000 } }, boundary);
|
|
96
|
+
assert(explicitTokens === 190000,
|
|
97
|
+
`explicit bufferTokens should still lower trigger to 190000, got ${explicitTokens}`);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// 6) preserveBufferConfigFields copies only finite-positive percent/ratio fields.
|
|
101
|
+
{
|
|
102
|
+
const out = preserveBufferConfigFields({ bufferPercent: 5, bufferRatio: 0.02, bufferFraction: 0, bufferPct: undefined, other: 9 });
|
|
103
|
+
assert(out.bufferPercent === 5 && out.bufferRatio === 0.02, 'should copy positive percent/ratio fields');
|
|
104
|
+
assert(!('bufferFraction' in out), 'zero buffer field should be dropped');
|
|
105
|
+
assert(!('bufferPct' in out), 'undefined buffer field should be dropped');
|
|
106
|
+
assert(!('other' in out), 'non-buffer fields should not be copied');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// 7) route-meta.autoCompactTokenLimit(): legacy seed/info value == boundary/window
|
|
110
|
+
// returns null; value >= window returns null; sub-window explicit preserved;
|
|
111
|
+
// no boundary keeps positive explicit; never derives.
|
|
112
|
+
{
|
|
113
|
+
// explicit == contextWindow (boundary) → null
|
|
114
|
+
assert(routeMetaAutoCompactTokenLimit('openai-oauth', 272000, 244800, {}, { autoCompactTokenLimit: 244800 }) === null,
|
|
115
|
+
'route-meta: explicit == contextWindow should be null');
|
|
116
|
+
// explicit == rawContextWindow (above effective boundary) → null
|
|
117
|
+
assert(routeMetaAutoCompactTokenLimit('openai-oauth', 272000, 244800, {}, { autoCompactTokenLimit: 272000 }) === null,
|
|
118
|
+
'route-meta: explicit >= boundary should be null');
|
|
119
|
+
// sub-boundary explicit preserved
|
|
120
|
+
assert(routeMetaAutoCompactTokenLimit('openai-oauth', 272000, 244800, {}, { autoCompactTokenLimit: 150000 }) === 150000,
|
|
121
|
+
'route-meta: sub-boundary explicit should be preserved');
|
|
122
|
+
// no explicit → null (never derived)
|
|
123
|
+
assert(routeMetaAutoCompactTokenLimit('openai-oauth', 272000, 244800, {}, {}) === null,
|
|
124
|
+
'route-meta: no explicit should be null (never derived)');
|
|
125
|
+
// no boundary known, positive explicit → kept
|
|
126
|
+
assert(routeMetaAutoCompactTokenLimit('local', 0, 0, {}, { autoCompactTokenLimit: 60000 }) === 60000,
|
|
127
|
+
'route-meta: positive explicit with no boundary should be kept');
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// 8) statusline-route.routeContextMeta(): same explicit-only sanitization.
|
|
131
|
+
{
|
|
132
|
+
// inherited full-window autoCompactTokenLimit (== rawContextWindow) → null
|
|
133
|
+
const legacy = routeContextMeta('anthropic-oauth', { contextWindow: 200000 }, { autoCompactTokenLimit: 200000 });
|
|
134
|
+
assert(legacy.autoCompactTokenLimit === null,
|
|
135
|
+
`statusline-route: full-window inherited limit should be null, got ${legacy.autoCompactTokenLimit}`);
|
|
136
|
+
assert(legacy.contextWindow > 0, 'statusline-route: contextWindow display should remain');
|
|
137
|
+
// sub-boundary explicit preserved (effective window = 200000*0.9 = 180000)
|
|
138
|
+
const lower = routeContextMeta('anthropic-oauth', { contextWindow: 200000 }, { autoCompactTokenLimit: 120000 });
|
|
139
|
+
assert(lower.autoCompactTokenLimit === 120000,
|
|
140
|
+
`statusline-route: sub-boundary explicit should be preserved, got ${lower.autoCompactTokenLimit}`);
|
|
141
|
+
// no explicit → null (never derived from window)
|
|
142
|
+
const none = routeContextMeta('anthropic-oauth', { contextWindow: 200000 }, {});
|
|
143
|
+
assert(none.autoCompactTokenLimit === null,
|
|
144
|
+
`statusline-route: no explicit should be null, got ${none.autoCompactTokenLimit}`);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// 9) loadGatewayStatus auto-compact resolver: a stale active full-window limit
|
|
148
|
+
// must be validated against the ACTIVE window, not the (larger) configured
|
|
149
|
+
// window. Configured contextWindow=244800 > active gateway_context_window=200000,
|
|
150
|
+
// active gateway_auto_compact_token_limit=200000 (== active window) => null.
|
|
151
|
+
{
|
|
152
|
+
const active = {
|
|
153
|
+
gateway_context_window: 200000,
|
|
154
|
+
gateway_raw_context_window: 200000,
|
|
155
|
+
gateway_auto_compact_token_limit: 200000, // stale full-window (== active window)
|
|
156
|
+
};
|
|
157
|
+
// No configured route → active value is sanitized against the active window.
|
|
158
|
+
const activeOnly = resolveStatusAutoCompactTokenLimit(null, active, null);
|
|
159
|
+
assert(activeOnly === null,
|
|
160
|
+
`status: stale active full-window limit should be null vs active window, got ${activeOnly}`);
|
|
161
|
+
|
|
162
|
+
// Configured route present with a LARGER window must not validate the stale
|
|
163
|
+
// active value; the configured route's own (here absent) explicit limit wins.
|
|
164
|
+
const configuredLarger = { contextWindow: 244800, autoCompactTokenLimit: null };
|
|
165
|
+
const withConfigured = resolveStatusAutoCompactTokenLimit(configuredLarger, active, null);
|
|
166
|
+
assert(withConfigured === null,
|
|
167
|
+
`status: configured larger window must not validate stale active limit, got ${withConfigured}`);
|
|
168
|
+
|
|
169
|
+
// A lower active explicit value (below the active window) is preserved when
|
|
170
|
+
// there is no configured route.
|
|
171
|
+
const lowerActive = resolveStatusAutoCompactTokenLimit(null, {
|
|
172
|
+
gateway_context_window: 200000,
|
|
173
|
+
gateway_raw_context_window: 200000,
|
|
174
|
+
gateway_auto_compact_token_limit: 150000,
|
|
175
|
+
}, null);
|
|
176
|
+
assert(lowerActive === 150000,
|
|
177
|
+
`status: sub-active-boundary explicit should be preserved, got ${lowerActive}`);
|
|
178
|
+
|
|
179
|
+
// A configured route's own sanitized explicit limit is surfaced.
|
|
180
|
+
const configuredExplicit = resolveStatusAutoCompactTokenLimit(
|
|
181
|
+
{ contextWindow: 244800, autoCompactTokenLimit: 120000 }, active, null,
|
|
182
|
+
);
|
|
183
|
+
assert(configuredExplicit === 120000,
|
|
184
|
+
`status: configured explicit limit should surface, got ${configuredExplicit}`);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
process.stdout.write('compact-trigger-migration smoke passed ✓\n');
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
const p = "src/runtime/shared/tool-surface.mjs";
|
|
3
|
+
let s = fs.readFileSync(p, "utf8");
|
|
4
|
+
const start = s.indexOf("export function summarizeAgentSurfaceBrief");
|
|
5
|
+
const end = s.indexOf("function pluralize", start);
|
|
6
|
+
if (start < 0 || end < 0) throw new Error("markers");
|
|
7
|
+
const clean = `export function summarizeAgentSurfaceBrief(name, args, resultText, { isError = false, isResponse = false } = {}) {
|
|
8
|
+
const a = parseToolArgs(args);
|
|
9
|
+
const action = String(a?.type || a?.action || "").toLowerCase();
|
|
10
|
+
const text = String(resultText ?? "").trim();
|
|
11
|
+
|
|
12
|
+
if (isResponse && text) {
|
|
13
|
+
const fromResult = summarizeToolResult(name, args, text, isError);
|
|
14
|
+
if (fromResult) return truncateAgentSurfaceBrief(stripInlineMarkdown(fromResult));
|
|
15
|
+
const line = firstAgentResultLine(text);
|
|
16
|
+
if (line) return truncateAgentSurfaceBrief(stripInlineMarkdown(line));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const outbound = firstText(a?.prompt, a?.message);
|
|
20
|
+
if (outbound && (action === "spawn" || action === "send" || !action)) {
|
|
21
|
+
return truncateAgentSurfaceBrief(outbound);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if ((action === "spawn" || action === "send") && text && !isResponse) {
|
|
25
|
+
const fromResult = summarizeToolResult(name, args, text, isError);
|
|
26
|
+
if (fromResult) return truncateAgentSurfaceBrief(stripInlineMarkdown(fromResult));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return "";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
`;
|
|
33
|
+
s = s.slice(0, start) + clean + s.slice(end);
|
|
34
|
+
fs.writeFileSync(p, s);
|
|
35
|
+
console.log("summarizeAgentSurfaceBrief cleaned");
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
const p = "src/runtime/shared/tool-surface.mjs";
|
|
3
|
+
let s = fs.readFileSync(p, "utf8");
|
|
4
|
+
const block = `export function formatToolSurface(name, args, opts = {}) {
|
|
5
|
+
const parsed = parseToolArgs(args);
|
|
6
|
+
return {
|
|
7
|
+
label: displayToolName(name, parsed),
|
|
8
|
+
summary: summarizeToolArgs(name, parsed, opts),
|
|
9
|
+
normalizedName: normalizeToolName(name),
|
|
10
|
+
args: parsed,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
`;
|
|
15
|
+
while (s.includes(block)) {
|
|
16
|
+
s = s.replace(block, "");
|
|
17
|
+
}
|
|
18
|
+
const anchor = `/** Collapsed agent/worker surface card: one-line brief under the header (30-40 chars). */`;
|
|
19
|
+
if (!s.includes(anchor)) throw new Error("anchor missing");
|
|
20
|
+
if (!s.includes("export function formatToolSurface")) {
|
|
21
|
+
s = s.replace(anchor, block + anchor);
|
|
22
|
+
}
|
|
23
|
+
fs.writeFileSync(p, s);
|
|
24
|
+
console.log("fixed formatToolSurface");
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
const p = "src/tui/components/ToolExecution.jsx";
|
|
3
|
+
let s = fs.readFileSync(p, "utf8");
|
|
4
|
+
const bad = ` let visibleDetailLines = detailLines;
|
|
5
|
+
if (isSkillSurface && !showRawResult) {
|
|
6
|
+
visibleDetailLines = [];
|
|
7
|
+
} else if (isAgentSurfaceCard && !showRawResult) {
|
|
8
|
+
if (agentSurfaceBrief) {
|
|
9
|
+
visibleDetailLines = [agentSurfaceBrief];
|
|
10
|
+
} else if (pending) {
|
|
11
|
+
visibleDetailLines = [pendingDetailPlaceholder || 'Running'];
|
|
12
|
+
} else {
|
|
13
|
+
visibleDetailLines = [];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
} else if (isAgentSurfaceCard && !showRawResult) {
|
|
17
|
+
} else if (isAgentSurfaceCard && !showRawResult) {
|
|
18
|
+
const agentDetailFallback = collapsedDetail
|
|
19
|
+
|| (pending ? (pendingDetailPlaceholder || 'Running') : 'Finished');
|
|
20
|
+
const agentDetailLine = agentSurfaceBrief
|
|
21
|
+
|| truncateToWidth(String(agentDetailFallback), Math.min(AGENT_SURFACE_BRIEF_MAX, maxResultChars));
|
|
22
|
+
visibleDetailLines = [agentDetailLine];
|
|
23
|
+
}`;
|
|
24
|
+
const good = ` let visibleDetailLines = detailLines;
|
|
25
|
+
if (isSkillSurface && !showRawResult) {
|
|
26
|
+
visibleDetailLines = [];
|
|
27
|
+
} else if (isAgentSurfaceCard && !showRawResult) {
|
|
28
|
+
const agentDetailFallback = collapsedDetail
|
|
29
|
+
|| (pending ? (pendingDetailPlaceholder || 'Running') : 'Finished');
|
|
30
|
+
const agentDetailLine = agentSurfaceBrief
|
|
31
|
+
|| truncateToWidth(String(agentDetailFallback), Math.min(AGENT_SURFACE_BRIEF_MAX, maxResultChars));
|
|
32
|
+
visibleDetailLines = [agentDetailLine];
|
|
33
|
+
}`;
|
|
34
|
+
if (s.includes(bad)) {
|
|
35
|
+
s = s.replace(bad, good);
|
|
36
|
+
fs.writeFileSync(p, s);
|
|
37
|
+
console.log("ToolExecution fixed");
|
|
38
|
+
} else if (s.includes("agentDetailFallback")) {
|
|
39
|
+
console.log("ToolExecution already ok");
|
|
40
|
+
} else {
|
|
41
|
+
throw new Error("ToolExecution pattern not found");
|
|
42
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// generate-runtime-manifest.mjs
|
|
3
|
+
// Aggregator step run after all matrix build jobs succeed.
|
|
4
|
+
// Reads release assets via gh CLI, filters mixdog-runtime-*.tar.gz,
|
|
5
|
+
// fetches sha256 from .sha256 sidecar files, and emits runtime-manifest.json
|
|
6
|
+
// to both dist/ and src/runtime/memory/data/ (for the auto-PR).
|
|
7
|
+
//
|
|
8
|
+
// Environment:
|
|
9
|
+
// GITHUB_TOKEN — PAT or GITHUB_TOKEN secret with contents:read
|
|
10
|
+
// RELEASE_TAG — e.g. "runtime-v0.4.0" (falls back to process.argv[2])
|
|
11
|
+
// GITHUB_REPOSITORY — auto-set by Actions (e.g. "owner/repo")
|
|
12
|
+
// RUNTIME_RELEASE_REPOSITORY — override repo for gh commands (legacy trib-plugin/mixdog)
|
|
13
|
+
|
|
14
|
+
import { execSync } from 'node:child_process';
|
|
15
|
+
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
16
|
+
import { dirname, resolve } from 'node:path';
|
|
17
|
+
import { fileURLToPath } from 'node:url';
|
|
18
|
+
import { tmpdir } from 'node:os';
|
|
19
|
+
|
|
20
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
21
|
+
const ROOT = resolve(__dirname, '..');
|
|
22
|
+
|
|
23
|
+
const RELEASE_TAG = process.env.RELEASE_TAG ?? process.argv[2];
|
|
24
|
+
const REPO = process.env.RUNTIME_RELEASE_REPOSITORY || process.env.GITHUB_REPOSITORY || '';
|
|
25
|
+
|
|
26
|
+
if (!RELEASE_TAG) {
|
|
27
|
+
console.error('ERROR: RELEASE_TAG env var or argv[2] required');
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
// 1. List release assets via gh CLI
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
console.log(`Listing assets for release: ${RELEASE_TAG} (repo: ${REPO})`);
|
|
35
|
+
|
|
36
|
+
let assetsJson;
|
|
37
|
+
try {
|
|
38
|
+
assetsJson = execSync(
|
|
39
|
+
`gh release view ${RELEASE_TAG} --repo ${REPO} --json assets`,
|
|
40
|
+
{ encoding: 'utf8', env: process.env }
|
|
41
|
+
);
|
|
42
|
+
} catch (err) {
|
|
43
|
+
console.error('gh release view failed:', err.message);
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const { assets } = JSON.parse(assetsJson);
|
|
48
|
+
|
|
49
|
+
// Filter tarball assets
|
|
50
|
+
const tarballs = assets.filter(a => /^mixdog-runtime-.+\.tar\.gz$/.test(a.name));
|
|
51
|
+
console.log(`Found ${tarballs.length} tarball(s):`, tarballs.map(a => a.name));
|
|
52
|
+
|
|
53
|
+
if (tarballs.length === 0) {
|
|
54
|
+
console.error('No mixdog-runtime-*.tar.gz assets found on release.');
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// ---------------------------------------------------------------------------
|
|
59
|
+
// 2. Parse version strings from a filename
|
|
60
|
+
// Format: mixdog-runtime-{os}-{arch}-pg{major}.{minor}-pgvector{vec}.tar.gz
|
|
61
|
+
// ---------------------------------------------------------------------------
|
|
62
|
+
const PG_RE = /pg(\d+)\.(\d+)/;
|
|
63
|
+
const VEC_RE = /pgvector(\d+(?:\.\d+)+)/;
|
|
64
|
+
|
|
65
|
+
let pgMajor = 16, pgMinor = 4, pgvectorVersion = '0.7.4';
|
|
66
|
+
for (const t of tarballs) {
|
|
67
|
+
const pgM = PG_RE.exec(t.name);
|
|
68
|
+
const vM = VEC_RE.exec(t.name);
|
|
69
|
+
if (pgM) { pgMajor = parseInt(pgM[1], 10); pgMinor = parseInt(pgM[2], 10); }
|
|
70
|
+
if (vM) { pgvectorVersion = vM[1]; }
|
|
71
|
+
break; // all tarballs share the same version; just read the first
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// ---------------------------------------------------------------------------
|
|
75
|
+
// 3. Fetch sha256 sidecar content for each tarball
|
|
76
|
+
// ---------------------------------------------------------------------------
|
|
77
|
+
async function fetchSha256(sha256AssetName, _downloadUrl) {
|
|
78
|
+
// Try matching .sha256 sidecar from the asset list first
|
|
79
|
+
const sidecar = assets.find(a => a.name === sha256AssetName);
|
|
80
|
+
if (sidecar) {
|
|
81
|
+
// Download the sidecar file text
|
|
82
|
+
try {
|
|
83
|
+
const tmpDir = resolve(tmpdir(), 'mixdog-manifest-sha256');
|
|
84
|
+
mkdirSync(tmpDir, { recursive: true });
|
|
85
|
+
execSync(
|
|
86
|
+
`gh release download ${RELEASE_TAG} --repo ${REPO} --pattern ${sha256AssetName} --dir "${tmpDir}" --clobber`,
|
|
87
|
+
{ encoding: 'utf8', env: process.env }
|
|
88
|
+
);
|
|
89
|
+
const content = readFileSync(resolve(tmpDir, sha256AssetName), 'utf8').trim();
|
|
90
|
+
// Format: "<hex> <filename>"
|
|
91
|
+
return content.split(/\s+/)[0];
|
|
92
|
+
} catch (e) {
|
|
93
|
+
console.warn(`Could not download sidecar ${sha256AssetName}: ${e.message}`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return 'TBD'; // fallback if sidecar not present
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// ---------------------------------------------------------------------------
|
|
100
|
+
// 4. Build asset map
|
|
101
|
+
// ---------------------------------------------------------------------------
|
|
102
|
+
const PLATFORM_RE = /mixdog-runtime-([a-z0-9]+)-([a-z0-9]+)-/;
|
|
103
|
+
|
|
104
|
+
const assetsMap = {};
|
|
105
|
+
|
|
106
|
+
for (const tarball of tarballs) {
|
|
107
|
+
const m = PLATFORM_RE.exec(tarball.name);
|
|
108
|
+
if (!m) { console.warn(`Skipping unrecognised tarball: ${tarball.name}`); continue; }
|
|
109
|
+
const key = `${m[1]}-${m[2]}`; // e.g. "linux-x64"
|
|
110
|
+
|
|
111
|
+
const sha256Key = `${tarball.name}.sha256`;
|
|
112
|
+
const sha256 = await fetchSha256(sha256Key, tarball.url);
|
|
113
|
+
|
|
114
|
+
assetsMap[key] = {
|
|
115
|
+
url: tarball.url,
|
|
116
|
+
sha256,
|
|
117
|
+
size: tarball.size ?? 0,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Ensure all expected platforms are present (fill missing with TBD)
|
|
122
|
+
const EXPECTED = ['linux-x64', 'linux-arm64', 'darwin-x64', 'darwin-arm64', 'win32-x64'];
|
|
123
|
+
for (const p of EXPECTED) {
|
|
124
|
+
if (!assetsMap[p]) {
|
|
125
|
+
console.warn(`WARNING: No asset found for platform ${p} — filling with TBD`);
|
|
126
|
+
assetsMap[p] = { url: 'TBD', sha256: 'TBD', size: 0 };
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// ---------------------------------------------------------------------------
|
|
131
|
+
// 5. Assemble manifest
|
|
132
|
+
// ---------------------------------------------------------------------------
|
|
133
|
+
const manifest = {
|
|
134
|
+
schema_version: 1,
|
|
135
|
+
generated_at: new Date().toISOString(),
|
|
136
|
+
release_tag: RELEASE_TAG,
|
|
137
|
+
pg: {
|
|
138
|
+
major: pgMajor,
|
|
139
|
+
minor: pgMinor,
|
|
140
|
+
},
|
|
141
|
+
pgvector: {
|
|
142
|
+
version: pgvectorVersion,
|
|
143
|
+
},
|
|
144
|
+
assets: assetsMap,
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const manifestJson = JSON.stringify(manifest, null, 2) + '\n';
|
|
148
|
+
console.log('Manifest:', manifestJson);
|
|
149
|
+
|
|
150
|
+
// ---------------------------------------------------------------------------
|
|
151
|
+
// 6. Write outputs
|
|
152
|
+
// ---------------------------------------------------------------------------
|
|
153
|
+
const distDir = resolve(ROOT, 'dist');
|
|
154
|
+
mkdirSync(distDir, { recursive: true });
|
|
155
|
+
|
|
156
|
+
const distPath = resolve(distDir, 'runtime-manifest.json');
|
|
157
|
+
const bundledPath = resolve(ROOT, 'src', 'runtime', 'memory', 'data', 'runtime-manifest.json');
|
|
158
|
+
|
|
159
|
+
writeFileSync(distPath, manifestJson);
|
|
160
|
+
console.log(`Written: ${distPath}`);
|
|
161
|
+
|
|
162
|
+
mkdirSync(dirname(bundledPath), { recursive: true });
|
|
163
|
+
writeFileSync(bundledPath, manifestJson);
|
|
164
|
+
console.log(`Written: ${bundledPath}`);
|
|
165
|
+
|
|
166
|
+
console.log('generate-runtime-manifest.mjs complete.');
|