mixdog 0.9.172 → 0.9.173
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/package.json +3 -3
- package/scripts/code-graph-description-contract.mjs +1 -2
- package/scripts/context-renewal-live-check.mjs +1 -1
- package/scripts/coverage-query.mjs +27 -0
- package/scripts/generate-runtime-manifest.mjs +12 -16
- package/scripts/graph-parity.mjs +108 -75
- package/scripts/lib/coverage.mjs +309 -0
- package/scripts/lib/embedding-model-bench-core.mjs +4 -2
- package/scripts/lib/recall-bench-eval.mjs +4 -4
- package/scripts/lib/run-node-tests.mjs +137 -13
- package/scripts/lib/test-failure-records.mjs +46 -0
- package/scripts/lib/test-failure-summary.mjs +59 -0
- package/scripts/lib/test-summary-reporter.mjs +7 -3
- package/scripts/mouse-probe.mjs +1 -3
- package/scripts/office/build-pptx-icons.mjs +0 -1
- package/scripts/perf/transcript-runtime-probe.mjs +20 -4
- package/scripts/pg-memory-diet.mjs +2 -4
- package/scripts/routing-corpus.mjs +0 -2
- package/scripts/session-diag.mjs +0 -7
- package/scripts/session-sweep.mjs +102 -56
- package/scripts/test.mjs +113 -37
- package/scripts/tui-frame-harness.mjs +1 -1
- package/src/app.mjs +79 -74
- package/src/cli.mjs +0 -2
- package/src/defaults/skills/browser-use/SKILL.md +8 -6
- package/src/defaults/skills/code-tidy/SKILL.md +67 -17
- package/src/defaults/skills/code-tidy/references/agent-cleanup.md +26 -3
- package/src/defaults/skills/computer-use/SKILL.md +12 -5
- package/src/defaults/skills/goal-management/SKILL.md +16 -9
- package/src/defaults/skills/pdf/SKILL.md +2 -1
- package/src/defaults/skills/xlsx/SKILL.md +3 -3
- package/src/headless-exec.mjs +1 -2
- package/src/help.mjs +2 -2
- package/src/lib/rules-builder.cjs +0 -23
- package/src/repl/slash-commands.mjs +1 -5
- package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch/turn.mjs +4 -4
- package/src/runtime/agent/orchestrator/agent-runtime/cache-strategy.mjs +25 -41
- package/src/runtime/agent/orchestrator/agent-trace-format.mjs +25 -24
- package/src/runtime/agent/orchestrator/agent-trace-io.mjs +15 -22
- package/src/runtime/agent/orchestrator/agent-trace.mjs +0 -22
- package/src/runtime/agent/orchestrator/config-providers-merge.mjs +56 -0
- package/src/runtime/agent/orchestrator/config.mjs +34 -76
- package/src/runtime/agent/orchestrator/context/role-instructions.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/admission-scheduler.mjs +40 -39
- package/src/runtime/agent/orchestrator/providers/anthropic-api-recovery.mjs +75 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-api-request.mjs +152 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-api-transport.mjs +168 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-messages.mjs +2 -1
- package/src/runtime/agent/orchestrator/providers/anthropic-midstream-recovery.mjs +248 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-midstream.mjs +16 -206
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-recovery.mjs +11 -63
- package/src/runtime/agent/orchestrator/providers/anthropic-recovery-guards.mjs +86 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-turn-result.mjs +88 -0
- package/src/runtime/agent/orchestrator/providers/anthropic.mjs +87 -591
- package/src/runtime/agent/orchestrator/providers/antigravity-oauth.mjs +32 -288
- package/src/runtime/agent/orchestrator/providers/antigravity-response.mjs +101 -0
- package/src/runtime/agent/orchestrator/providers/antigravity-stream.mjs +161 -0
- package/src/runtime/agent/orchestrator/providers/antigravity-transport.mjs +114 -0
- package/src/runtime/agent/orchestrator/providers/gemini-cache-policy.mjs +266 -0
- package/src/runtime/agent/orchestrator/providers/gemini-request-body.mjs +54 -0
- package/src/runtime/agent/orchestrator/providers/gemini-response.mjs +145 -0
- package/src/runtime/agent/orchestrator/providers/gemini-schema.mjs +56 -39
- package/src/runtime/agent/orchestrator/providers/gemini-sdk-request.mjs +107 -0
- package/src/runtime/agent/orchestrator/providers/gemini.mjs +23 -533
- package/src/runtime/agent/orchestrator/providers/lib/anthropic-request-utils.mjs +10 -4
- package/src/runtime/agent/orchestrator/providers/media-normalization.mjs +83 -32
- package/src/runtime/agent/orchestrator/providers/openai-compat-responses.mjs +41 -25
- package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-outcome.mjs +4 -98
- package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-stamps.mjs +114 -0
- package/src/runtime/agent/orchestrator/providers/openai-oauth-dispatch.mjs +258 -0
- package/src/runtime/agent/orchestrator/providers/openai-oauth.mjs +48 -214
- package/src/runtime/agent/orchestrator/providers/openai-responses-input.mjs +80 -60
- package/src/runtime/agent/orchestrator/providers/openai-ws-handshake.mjs +108 -0
- package/src/runtime/agent/orchestrator/providers/openai-ws-pool.mjs +8 -87
- package/src/runtime/agent/orchestrator/providers/openai-ws-send-outcome.mjs +52 -293
- package/src/runtime/agent/orchestrator/providers/openai-ws-send-trace.mjs +316 -0
- package/src/runtime/agent/orchestrator/providers/opencode-go-usage.mjs +76 -253
- package/src/runtime/agent/orchestrator/session/cache/scoped-cache.mjs +1 -7
- package/src/runtime/agent/orchestrator/session/compact/budget.mjs +17 -16
- package/src/runtime/agent/orchestrator/session/compact/runner.mjs +6 -4
- package/src/runtime/agent/orchestrator/session/compact/summary-schema.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/context-compaction-policy.mjs +9 -13
- package/src/runtime/agent/orchestrator/session/context-utils.mjs +1 -2
- package/src/runtime/agent/orchestrator/session/evidence-union.mjs +6 -9
- package/src/runtime/agent/orchestrator/session/loop/compact-policy.mjs +2 -3
- package/src/runtime/agent/orchestrator/session/loop/diagnostics.mjs +1 -8
- package/src/runtime/agent/orchestrator/session/loop/tool-classify.mjs +1 -3
- package/src/runtime/agent/orchestrator/session/loop/tool-exec/call-prep.mjs +1 -5
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-execute.mjs +0 -1
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-loop-options.mjs +4 -55
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-steering-drain.mjs +63 -0
- package/src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/manager/foreign-pending-messages.mjs +80 -65
- package/src/runtime/agent/orchestrator/session/manager/pending-claim-ledger.mjs +68 -0
- package/src/runtime/agent/orchestrator/session/manager/pending-delivered-ledger.mjs +56 -0
- package/src/runtime/agent/orchestrator/session/manager/pending-lifecycle-epoch.mjs +84 -0
- package/src/runtime/agent/orchestrator/session/manager/pending-messages.mjs +51 -651
- package/src/runtime/agent/orchestrator/session/manager/pending-persist-queue.mjs +264 -0
- package/src/runtime/agent/orchestrator/session/manager/pending-spool-file.mjs +131 -0
- package/src/runtime/agent/orchestrator/session/manager/pending-spool-sweep.mjs +73 -0
- package/src/runtime/agent/orchestrator/session/manager/prepared-resume-cache.mjs +122 -0
- package/src/runtime/agent/orchestrator/session/manager/prompt-utils.mjs +2 -1
- package/src/runtime/agent/orchestrator/session/manager/runtime-liveness.mjs +5 -4
- package/src/runtime/agent/orchestrator/session/manager/session-close.mjs +60 -35
- package/src/runtime/agent/orchestrator/session/manager/session-crud.mjs +3 -2
- package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.mjs +22 -646
- package/src/runtime/agent/orchestrator/session/manager/session-owner-liveness.mjs +135 -0
- package/src/runtime/agent/orchestrator/session/manager/session-prompt-composition.mjs +150 -0
- package/src/runtime/agent/orchestrator/session/manager/session-record.mjs +154 -0
- package/src/runtime/agent/orchestrator/session/manager/session-tool-surface.mjs +135 -0
- package/src/runtime/agent/orchestrator/session/manager/tool-resolution.mjs +4 -11
- package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint-journal.mjs +0 -6
- package/src/runtime/agent/orchestrator/session/manager/usage-metrics.mjs +1 -3
- package/src/runtime/agent/orchestrator/session/pre-send-compact.mjs +11 -12
- package/src/runtime/agent/orchestrator/session/provider-prefix-guard.mjs +23 -32
- package/src/runtime/agent/orchestrator/session/store/lifecycle-barriers.mjs +275 -0
- package/src/runtime/agent/orchestrator/session/store/lifecycle-read.mjs +67 -0
- package/src/runtime/agent/orchestrator/session/store/listing.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/store/live-cache-eviction.mjs +72 -0
- package/src/runtime/agent/orchestrator/session/store/liveness-veto.mjs +53 -0
- package/src/runtime/agent/orchestrator/session/store/load-session.mjs +60 -0
- package/src/runtime/agent/orchestrator/session/store/pending-saves.mjs +55 -0
- package/src/runtime/agent/orchestrator/session/store/serialize.mjs +7 -15
- package/src/runtime/agent/orchestrator/session/store/session-delete.mjs +149 -0
- package/src/runtime/agent/orchestrator/session/store/session-observers.mjs +55 -0
- package/src/runtime/agent/orchestrator/session/store/write-admission.mjs +108 -0
- package/src/runtime/agent/orchestrator/session/store-agent-worker-rows.mjs +531 -0
- package/src/runtime/agent/orchestrator/session/store-summary-archived-agent.mjs +126 -0
- package/src/runtime/agent/orchestrator/session/store-summary-fields.mjs +24 -0
- package/src/runtime/agent/orchestrator/session/store-summary-index.mjs +2 -10
- package/src/runtime/agent/orchestrator/session/store-summary-locations.mjs +46 -0
- package/src/runtime/agent/orchestrator/session/store-summary-reader.mjs +11 -791
- package/src/runtime/agent/orchestrator/session/store-transcript-projection.mjs +126 -0
- package/src/runtime/agent/orchestrator/session/store.mjs +33 -771
- package/src/runtime/agent/orchestrator/session/tool-batch/finalize.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/tool-result-offload.mjs +13 -7
- package/src/runtime/agent/orchestrator/stable-hash-stringify.mjs +10 -0
- package/src/runtime/agent/orchestrator/tools/builtin/arg-guard.mjs +50 -75
- package/src/runtime/agent/orchestrator/tools/builtin/builtin-tools.mjs +2 -1
- package/src/runtime/agent/orchestrator/tools/builtin/cache-layers.mjs +22 -21
- package/src/runtime/agent/orchestrator/tools/builtin/external-tool-adapters.mjs +0 -2
- package/src/runtime/agent/orchestrator/tools/builtin/git-command-policy.mjs +44 -27
- package/src/runtime/agent/orchestrator/tools/builtin/git-command-tool.mjs +36 -54
- package/src/runtime/agent/orchestrator/tools/builtin/git-partial-stage.mjs +8 -5
- package/src/runtime/agent/orchestrator/tools/builtin/lib/grep-context-expander.mjs +8 -5
- package/src/runtime/agent/orchestrator/tools/builtin/lib/grep-output.mjs +18 -9
- package/src/runtime/agent/orchestrator/tools/builtin/lib/grep-request.mjs +2 -3
- package/src/runtime/agent/orchestrator/tools/builtin/lib/grep-single-file-rescue.mjs +80 -67
- package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-task-output.mjs +12 -4
- package/src/runtime/agent/orchestrator/tools/builtin/native-search-client.mjs +1 -4
- package/src/runtime/agent/orchestrator/tools/builtin/path-diagnostics.mjs +61 -72
- package/src/runtime/agent/orchestrator/tools/builtin/read-formatting.mjs +0 -5
- package/src/runtime/agent/orchestrator/tools/builtin/read-office-files.mjs +3 -3
- package/src/runtime/agent/orchestrator/tools/builtin/read-range-index.mjs +11 -14
- package/src/runtime/agent/orchestrator/tools/builtin/read-single-render.mjs +3 -6
- package/src/runtime/agent/orchestrator/tools/builtin/read-special-files.mjs +1 -2
- package/src/runtime/agent/orchestrator/tools/builtin/read-streaming.mjs +124 -94
- package/src/runtime/agent/orchestrator/tools/builtin/read-tool/batch-dispatch.mjs +6 -3
- package/src/runtime/agent/orchestrator/tools/builtin/read-tool/reach-preflight.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/read-tool.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/read-windows.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/search-builders.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/search-glob-tool.mjs +6 -6
- package/src/runtime/agent/orchestrator/tools/builtin/search-grep-tool.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/shell-analysis.mjs +21 -35
- package/src/runtime/agent/orchestrator/tools/builtin/shell-jobs.mjs +0 -3
- package/src/runtime/agent/orchestrator/tools/builtin/shell-lossless-compact.mjs +1 -3
- package/src/runtime/agent/orchestrator/tools/builtin/shell-output.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/shell-runtime.mjs +0 -2
- package/src/runtime/agent/orchestrator/tools/builtin/task-tool.mjs +4 -3
- package/src/runtime/agent/orchestrator/tools/builtin/text-stats.mjs +6 -3
- package/src/runtime/agent/orchestrator/tools/builtin.mjs +0 -4
- package/src/runtime/agent/orchestrator/tools/code-graph/aggregate-roots.mjs +7 -7
- package/src/runtime/agent/orchestrator/tools/code-graph/ast-calls.mjs +0 -3
- package/src/runtime/agent/orchestrator/tools/code-graph/build-file-infos.mjs +182 -0
- package/src/runtime/agent/orchestrator/tools/code-graph/build.mjs +14 -159
- package/src/runtime/agent/orchestrator/tools/code-graph/constants.mjs +2 -3
- package/src/runtime/agent/orchestrator/tools/code-graph/dispatch.mjs +21 -8
- package/src/runtime/agent/orchestrator/tools/code-graph/graph-binary.mjs +0 -3
- package/src/runtime/agent/orchestrator/tools/code-graph/search-references.mjs +5 -3
- package/src/runtime/agent/orchestrator/tools/code-graph/search.mjs +2 -3
- package/src/runtime/agent/orchestrator/tools/code-graph/symbol-index.mjs +1 -2
- package/src/runtime/agent/orchestrator/tools/code-graph/text-mask.golden.json +1 -1
- package/src/runtime/agent/orchestrator/tools/code-graph/text-mask.mjs +0 -1
- package/src/runtime/agent/orchestrator/tools/graph-manifest.json +11 -11
- package/src/runtime/agent/orchestrator/tools/lib/shell-run-state.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/lib/shell-warm-standby.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/patch/dispatch.mjs +3 -6
- package/src/runtime/agent/orchestrator/tools/patch/mutation-output.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/patch/native-server.mjs +25 -39
- package/src/runtime/agent/orchestrator/tools/patch/parsing.mjs +9 -14
- package/src/runtime/agent/orchestrator/tools/patch/paths.mjs +11 -6
- package/src/runtime/agent/orchestrator/tools/patch/replay-capture.mjs +5 -6
- package/src/runtime/agent/orchestrator/tools/patch/text-lines.mjs +4 -4
- package/src/runtime/agent/orchestrator/tools/patch/v4a-anchors.mjs +10 -7
- package/src/runtime/agent/orchestrator/tools/patch/v4a-convert.mjs +20 -30
- package/src/runtime/agent/orchestrator/tools/patch/v4a-windows.mjs +4 -19
- package/src/runtime/agent/orchestrator/tools/patch/wave.mjs +13 -2
- package/src/runtime/agent/orchestrator/tools/patch.mjs +0 -19
- package/src/runtime/agent/orchestrator/tools/shell-command.mjs +60 -36
- package/src/runtime/agent/orchestrator/tools/shell-exec-output.mjs +0 -4
- package/src/runtime/agent/orchestrator/tools/shell-policy.mjs +6 -7
- package/src/runtime/attachments/store.mjs +13 -12
- package/src/runtime/browser-bridge/client.mjs +19 -9
- package/src/runtime/channels/index.mjs +1 -1
- package/src/runtime/channels/lib/event-pipeline.mjs +8 -8
- package/src/runtime/channels/lib/event-queue.mjs +15 -20
- package/src/runtime/channels/lib/executor.mjs +10 -7
- package/src/runtime/channels/lib/owner-heartbeat.mjs +0 -4
- package/src/runtime/channels/lib/runtime-paths.mjs +30 -33
- package/src/runtime/channels/lib/scheduler.mjs +11 -20
- package/src/runtime/channels/lib/voice-runtime-fetcher.mjs +0 -4
- package/src/runtime/channels/lib/voice-transcription.mjs +127 -104
- package/src/runtime/channels/lib/webhook/verification.mjs +33 -20
- package/src/runtime/channels/lib/worker-bootstrap.mjs +0 -2
- package/src/runtime/channels/lib/worker-main.mjs +2 -2
- package/src/runtime/computer-bridge/action-schema.mjs +20 -0
- package/src/runtime/computer-bridge/core-actions.mjs +15 -0
- package/src/runtime/github/client.mjs +2 -3
- package/src/runtime/github/commands.mjs +9 -3
- package/src/runtime/github/contract.mjs +7 -0
- package/src/runtime/local-provider/catalog.mjs +4 -3
- package/src/runtime/local-provider/hardware.mjs +7 -20
- package/src/runtime/local-provider/resumable-installations.mjs +12 -19
- package/src/runtime/media/auth.mjs +16 -13
- package/src/runtime/media/catalog.mjs +14 -6
- package/src/runtime/media/lanes.mjs +2 -1
- package/src/runtime/memory/index.mjs +5 -10
- package/src/runtime/memory/lib/core-memory-store.mjs +3 -7
- package/src/runtime/memory/lib/embedding-provider.mjs +9 -19
- package/src/runtime/memory/lib/embedding-worker.mjs +24 -28
- package/src/runtime/memory/lib/http-router/admin-routes.mjs +5 -51
- package/src/runtime/memory/lib/http-router/admin-trace-routes.mjs +65 -0
- package/src/runtime/memory/lib/memory-action-handlers/cycle-actions.mjs +18 -143
- package/src/runtime/memory/lib/memory-action-handlers/cycle-backfill-action.mjs +84 -0
- package/src/runtime/memory/lib/memory-action-handlers/cycle-rebuild-action.mjs +94 -0
- package/src/runtime/memory/lib/memory-action-handlers/manage-actions.mjs +92 -53
- package/src/runtime/memory/lib/memory-categories.mjs +13 -0
- package/src/runtime/memory/lib/memory-chunk-quality.mjs +134 -74
- package/src/runtime/memory/lib/memory-cycle-requests.mjs +64 -70
- package/src/runtime/memory/lib/memory-cycle1.mjs +17 -33
- package/src/runtime/memory/lib/memory-embed.mjs +10 -2
- package/src/runtime/memory/lib/memory-ops-policy.mjs +3 -2
- package/src/runtime/memory/lib/memory-recall-scope-filter.mjs +1 -1
- package/src/runtime/memory/lib/memory.mjs +7 -35
- package/src/runtime/memory/lib/pg/adapter.mjs +3 -4
- package/src/runtime/memory/lib/pg/process.mjs +23 -28
- package/src/runtime/memory/lib/pg/supervisor.mjs +10 -11
- package/src/runtime/memory/lib/query-hybrid-search.mjs +2 -2
- package/src/runtime/memory/lib/query-maintenance-handlers.mjs +112 -89
- package/src/runtime/memory/lib/query-ranking.mjs +8 -11
- package/src/runtime/memory/lib/recall-format.mjs +6 -12
- package/src/runtime/memory/lib/recall-hybrid/plan.mjs +1 -1
- package/src/runtime/memory/lib/runtime-fetcher.mjs +73 -65
- package/src/runtime/memory/lib/trace-store.mjs +10 -19
- package/src/runtime/memory/lib/transcript-ingest.mjs +7 -4
- package/src/runtime/memory/tool-defs.mjs +5 -8
- package/src/runtime/office/authoring/pptx-author-action.mjs +2 -2
- package/src/runtime/office/authoring/pptx-author-session.mjs +6 -9
- package/src/runtime/office/authoring/pptx-brief.mjs +11 -4
- package/src/runtime/office/authoring/pptx-receipt.mjs +79 -60
- package/src/runtime/office/bench/benchmark.mjs +102 -82
- package/src/runtime/office/capabilities-catalog.mjs +2 -0
- package/src/runtime/office/capabilities-signatures.mjs +8 -0
- package/src/runtime/office/capabilities.mjs +3 -4
- package/src/runtime/office/com/com-adapter.mjs +13 -1
- package/src/runtime/office/com/office-com-host.ps1 +63 -1
- package/src/runtime/office/core/office-actions-batch.mjs +12 -12
- package/src/runtime/office/core/office-actions-open.mjs +2 -7
- package/src/runtime/office/core/office-core.mjs +20 -1
- package/src/runtime/office/core/office-finalize/session-save.mjs +9 -6
- package/src/runtime/office/core/office-session-dispatch.mjs +86 -0
- package/src/runtime/office/core/office-sessionless-actions.mjs +115 -0
- package/src/runtime/office/core/office-sessions.mjs +2 -2
- package/src/runtime/office/core/office-transactions.mjs +2 -4
- package/src/runtime/office/core/tabular.mjs +13 -16
- package/src/runtime/office/design/composition-system.mjs +32 -28
- package/src/runtime/office/design/content-model.mjs +2 -1
- package/src/runtime/office/design/design-art-direction.mjs +17 -14
- package/src/runtime/office/design/design-creative-director.mjs +1 -1
- package/src/runtime/office/design/design-discipline.mjs +8 -0
- package/src/runtime/office/design/design-tokens.mjs +9 -5
- package/src/runtime/office/design/docx/design-docx-components.mjs +88 -156
- package/src/runtime/office/design/library/design-library-pack.mjs +11 -23
- package/src/runtime/office/design/library/design-library.mjs +15 -37
- package/src/runtime/office/design/library/design-template-index.mjs +1 -9
- package/src/runtime/office/design/library/design-template-induct.mjs +2 -1
- package/src/runtime/office/design/native-design.mjs +2 -3
- package/src/runtime/office/index.mjs +7 -160
- package/src/runtime/office/pdf/pdf-adapter.mjs +17 -2
- package/src/runtime/office/pdf/pdf-ocr.mjs +2 -1
- package/src/runtime/office/pdf/pdf-render.mjs +12 -13
- package/src/runtime/office/pdf/pdf-writer.mjs +135 -6
- package/src/runtime/office/portable/docx-revisions.mjs +5 -5
- package/src/runtime/office/portable/docx-runs.mjs +4 -7
- package/src/runtime/office/portable/docx-tracked-edits.mjs +14 -9
- package/src/runtime/office/portable/font-provisioner.mjs +2 -2
- package/src/runtime/office/portable/ooxml-validator.mjs +4 -1
- package/src/runtime/office/portable/portable-docx-edits.mjs +61 -45
- package/src/runtime/office/portable/portable-docx-operations.mjs +13 -4
- package/src/runtime/office/portable/portable-docx-parts.mjs +59 -70
- package/src/runtime/office/portable/portable-docx-xml.mjs +3 -5
- package/src/runtime/office/portable/portable-opc.mjs +63 -39
- package/src/runtime/office/portable/portable-package.mjs +5 -23
- package/src/runtime/office/portable/portable-pptx-chart.mjs +7 -6
- package/src/runtime/office/portable/portable-pptx-charts.mjs +27 -20
- package/src/runtime/office/portable/portable-pptx-core.mjs +10 -21
- package/src/runtime/office/portable/portable-pptx-deck.mjs +5 -8
- package/src/runtime/office/portable/portable-pptx-package.mjs +23 -30
- package/src/runtime/office/portable/portable-pptx-shapes.mjs +21 -57
- package/src/runtime/office/portable/portable-sheet-audits.mjs +14 -36
- package/src/runtime/office/portable/portable-sheet-page.mjs +22 -23
- package/src/runtime/office/portable/portable-sheet-parts.mjs +4 -5
- package/src/runtime/office/portable/portable-sheet-styles.mjs +11 -19
- package/src/runtime/office/portable/portable-sheet-xml.mjs +15 -7
- package/src/runtime/office/portable/portable-slide-shapes.mjs +4 -0
- package/src/runtime/office/portable/portable-snapshot-pptx.mjs +2 -2
- package/src/runtime/office/portable/portable-snapshot-shared.mjs +1 -1
- package/src/runtime/office/portable/portable-snapshot-xlsx.mjs +16 -17
- package/src/runtime/office/portable/portable-soffice.mjs +176 -13
- package/src/runtime/office/portable/portable-validation-package.mjs +16 -18
- package/src/runtime/office/portable/portable-validation.mjs +57 -31
- package/src/runtime/office/portable/portable-xlsx-cell-values.mjs +15 -0
- package/src/runtime/office/portable/portable-xlsx-charts.mjs +192 -0
- package/src/runtime/office/portable/portable-xlsx-drawings.mjs +323 -0
- package/src/runtime/office/portable/portable-xlsx-operations.mjs +29 -627
- package/src/runtime/office/portable/portable-xlsx-pivot-ops.mjs +94 -0
- package/src/runtime/office/portable/portable-xlsx-range-layout.mjs +236 -0
- package/src/runtime/office/portable/portable-xlsx-sheet-edits.mjs +19 -14
- package/src/runtime/office/portable/portable-xlsx.mjs +32 -0
- package/src/runtime/office/portable/portable-xml.mjs +9 -0
- package/src/runtime/office/portable/pptx-relations.mjs +11 -0
- package/src/runtime/office/portable/pptx-targets.mjs +2 -1
- package/src/runtime/office/portable/review-editability.mjs +4 -11
- package/src/runtime/office/portable/text-metrics.mjs +35 -55
- package/src/runtime/office/portable/xlsx-assertions.mjs +2 -15
- package/src/runtime/office/portable/xlsx-audit-support.mjs +2 -6
- package/src/runtime/office/portable/xlsx-contract.mjs +4 -0
- package/src/runtime/office/portable/xlsx-formula-audit.mjs +11 -4
- package/src/runtime/office/portable/xlsx-recalculate.mjs +1 -1
- package/src/runtime/office/portable/xlsx-sheet-hygiene.mjs +5 -1
- package/src/runtime/office/quality/assurance-rendered.mjs +3 -2
- package/src/runtime/office/quality/assurance-structure-pptx.mjs +16 -15
- package/src/runtime/office/quality/assurance-trust.mjs +25 -10
- package/src/runtime/office/quality/design-aesthetics.mjs +172 -145
- package/src/runtime/office/quality/design-deck-diversity.mjs +2 -5
- package/src/runtime/office/quality/design-review-authored.mjs +2 -2
- package/src/runtime/office/quality/design-review-critique.mjs +36 -37
- package/src/runtime/office/quality/design-review.mjs +113 -96
- package/src/runtime/office/quality/document-acceptance.mjs +10 -3
- package/src/runtime/office/quality/inline-audit.mjs +7 -2
- package/src/runtime/office/quality/pptx-deck-rubric.mjs +14 -6
- package/src/runtime/office/quality/pptx-slide-roles.mjs +7 -9
- package/src/runtime/office/quality/presentation-acceptance.mjs +2 -6
- package/src/runtime/office/quality/quality-pipeline.mjs +21 -14
- package/src/runtime/office/quality/quality-score.mjs +2 -2
- package/src/runtime/office/quality/render-air.mjs +12 -5
- package/src/runtime/shared/atomic-file.mjs +19 -8
- package/src/runtime/shared/config.mjs +7 -13
- package/src/runtime/shared/err-text.mjs +11 -6
- package/src/runtime/shared/file-lock.mjs +10 -6
- package/src/runtime/shared/inline-file-kind.mjs +51 -0
- package/src/runtime/shared/llm/usage-accounting.mjs +9 -6
- package/src/runtime/shared/llm/usage-ledger-rollup.mjs +272 -0
- package/src/runtime/shared/llm/usage-ledger.mjs +8 -218
- package/src/runtime/shared/pristine-execution.mjs +2 -6
- package/src/runtime/shared/process-lifecycle.mjs +34 -52
- package/src/runtime/shared/process-shutdown.mjs +1 -1
- package/src/runtime/shared/schedule-model-ref.mjs +14 -0
- package/src/runtime/shared/schedule-session-run.mjs +3 -13
- package/src/runtime/shared/schedules-db.mjs +16 -39
- package/src/runtime/shared/staged-child-result.mjs +2 -7
- package/src/runtime/shared/staged-update.mjs +1 -5
- package/src/runtime/shared/tool-card-model/agent-surface.mjs +8 -3
- package/src/runtime/shared/tool-card-model/card-status.mjs +2 -1
- package/src/runtime/shared/tool-card-model/displayed-result.mjs +2 -3
- package/src/runtime/shared/tool-card-model/generic-detail.mjs +5 -3
- package/src/runtime/shared/tool-card-model.golden-cases.mjs +10 -2
- package/src/runtime/shared/tool-card-model.golden.json +3 -12
- package/src/runtime/shared/tool-execution-contract.mjs +22 -26
- package/src/runtime/shared/tool-result-summary.mjs +7 -14
- package/src/runtime/shared/tool-surface.mjs +30 -33
- package/src/runtime/shared/tool-work-units.mjs +12 -8
- package/src/runtime/shared/turn-snapshot-store.mjs +2 -4
- package/src/runtime/shared/turn-worktree-snapshot.mjs +13 -16
- package/src/runtime/shared/update-checker.mjs +5 -0
- package/src/runtime/shared/user-data-guard.mjs +10 -17
- package/src/runtime/shared/webhook-session-run.mjs +3 -15
- package/src/runtime/tidy/history-comment.mjs +32 -27
- package/src/runtime/tidy/process.mjs +18 -21
- package/src/runtime/tidy/report.mjs +50 -9
- package/src/runtime/tidy/resolve.mjs +13 -14
- package/src/runtime/tidy/runners/air.mjs +2 -20
- package/src/runtime/tidy/runners/biome.mjs +4 -6
- package/src/runtime/tidy/runners/dprint.mjs +2 -23
- package/src/runtime/tidy/runners/mago.mjs +2 -20
- package/src/runtime/tidy/runners/ruff.mjs +2 -8
- package/src/runtime/tidy/runners/shared.mjs +35 -9
- package/src/runtime/tidy/runners/stylua.mjs +2 -20
- package/src/runtime/tidy/shadow.mjs +138 -0
- package/src/runtime/tidy/tool.mjs +33 -0
- package/src/runtime/tidy/worktree.mjs +114 -0
- package/src/runtime/web-search/index.mjs +64 -68
- package/src/runtime/web-search/lib/http-fetch.mjs +39 -54
- package/src/runtime/web-search/lib/ssrf-guard.mjs +19 -52
- package/src/runtime/web-search/lib/web-tools.mjs +2 -2
- package/src/session-runtime/config-helpers.mjs +9 -9
- package/src/session-runtime/context-inspection.mjs +64 -23
- package/src/session-runtime/context-status-cache.mjs +0 -2
- package/src/session-runtime/context-status-inspection.mjs +54 -25
- package/src/session-runtime/context-status-shape.mjs +1 -18
- package/src/session-runtime/goal-facade-api.mjs +15 -12
- package/src/session-runtime/goal-mutations.mjs +4 -3
- package/src/session-runtime/goal-runtime.mjs +5 -0
- package/src/session-runtime/goal-tasks.mjs +5 -10
- package/src/session-runtime/goal-text.mjs +46 -9
- package/src/session-runtime/goal-tool-defs.mjs +7 -8
- package/src/session-runtime/goal-tool-exec.mjs +1 -1
- package/src/session-runtime/goal-turns.mjs +54 -3
- package/src/session-runtime/hook-payload.mjs +2 -1
- package/src/session-runtime/inheritance-fit.mjs +3 -3
- package/src/session-runtime/lifecycle/teardown.mjs +9 -1
- package/src/session-runtime/mcp-glue/server-catalog.mjs +4 -6
- package/src/session-runtime/model-capabilities.mjs +1 -3
- package/src/session-runtime/notification-bus.mjs +30 -7
- package/src/session-runtime/plugin-mcp.mjs +0 -2
- package/src/session-runtime/provider-auth/accounts.mjs +2 -2
- package/src/session-runtime/provider-auth/login.mjs +0 -7
- package/src/session-runtime/provider-usage.mjs +1 -1
- package/src/session-runtime/runtime-paths.mjs +1 -3
- package/src/session-runtime/session-hooks.mjs +37 -96
- package/src/session-runtime/statusline-route.mjs +1 -4
- package/src/session-runtime/tool-catalog-schema.mjs +0 -6
- package/src/session-runtime/tool-catalog.mjs +10 -15
- package/src/session-runtime/workflow-ids.mjs +1 -2
- package/src/standalone/agent-task-status.mjs +1 -2
- package/src/standalone/agent-tool/close-flow/close-all.mjs +67 -0
- package/src/standalone/agent-tool/close-flow.mjs +2 -58
- package/src/standalone/agent-tool/execute-send.mjs +91 -0
- package/src/standalone/agent-tool/execute-spawn.mjs +76 -0
- package/src/standalone/agent-tool/execute.mjs +7 -147
- package/src/standalone/agent-tool/helpers.mjs +3 -6
- package/src/standalone/agent-tool/notify/early-completion.mjs +58 -0
- package/src/standalone/agent-tool/notify.mjs +7 -55
- package/src/standalone/agent-tool/provider-init.mjs +73 -64
- package/src/standalone/agent-tool/render.mjs +123 -115
- package/src/standalone/agent-tool/spawn-flow/spawn-plan.mjs +89 -0
- package/src/standalone/agent-tool/spawn-flow/spawn-prep.mjs +16 -75
- package/src/standalone/agent-tool/spawn-flow/spawn-run.mjs +1 -1
- package/src/standalone/agent-tool/worker-rows.mjs +0 -7
- package/src/standalone/channel-admin.mjs +13 -18
- package/src/standalone/channel-transport/remote-binding.mjs +10 -79
- package/src/standalone/channel-transport/remote-intent.mjs +52 -0
- package/src/standalone/channel-transport/remote-notify.mjs +15 -107
- package/src/standalone/channel-transport/remote-pointer.mjs +124 -0
- package/src/standalone/channel-transport/remote-state.mjs +47 -0
- package/src/standalone/daemon-agent-control.mjs +65 -0
- package/src/standalone/daemon-channels-loader.mjs +60 -0
- package/src/standalone/daemon-desktop-runtime.mjs +28 -0
- package/src/standalone/daemon-local-session-bridge.mjs +62 -0
- package/src/standalone/daemon-stored-session-views.mjs +55 -0
- package/src/standalone/daemon.mjs +175 -320
- package/src/standalone/desktop-service-registry.mjs +9 -7
- package/src/standalone/folder-dialog.mjs +11 -12
- package/src/standalone/hook-bus/command-handler.mjs +60 -49
- package/src/standalone/hook-bus/event-runner.mjs +7 -74
- package/src/standalone/hook-bus/handler-dispatch.mjs +75 -0
- package/src/standalone/provider-admin.mjs +14 -35
- package/src/standalone/session-client/attachment-calls.mjs +67 -0
- package/src/standalone/session-client/stream-link.mjs +85 -0
- package/src/standalone/session-client.mjs +31 -106
- package/src/standalone/session-frame-stream.mjs +4 -2
- package/src/standalone/session-protocol.mjs +0 -1
- package/src/standalone/session-runtime-agent-control-client.mjs +11 -27
- package/src/standalone/session-runtime-agent-control.mjs +85 -0
- package/src/standalone/session-runtime-host.mjs +30 -472
- package/src/standalone/session-runtime-inline-host/telemetry.mjs +38 -0
- package/src/standalone/session-runtime-inline-host.mjs +6 -37
- package/src/standalone/session-runtime-proxy.mjs +164 -0
- package/src/standalone/session-runtime-shard-router.mjs +4 -7
- package/src/standalone/session-runtime-spawn-leases.mjs +82 -0
- package/src/standalone/session-runtime-worker.mjs +27 -7
- package/src/standalone/session-service/agent-tree/agent-child.mjs +59 -0
- package/src/standalone/session-service/agent-tree/agent-turns.mjs +4 -55
- package/src/standalone/session-service/agent-tree.mjs +3 -1
- package/src/standalone/session-service/entries/disposal.mjs +72 -0
- package/src/standalone/session-service/entries/external-binding.mjs +6 -3
- package/src/standalone/session-service/entries/lifecycle.mjs +15 -59
- package/src/standalone/session-service/retention/busy.mjs +50 -0
- package/src/standalone/session-service/retention.mjs +5 -44
- package/src/standalone/session-service/session-calls/goal-recovery.mjs +44 -0
- package/src/standalone/session-service/session-calls/session-action.mjs +5 -8
- package/src/standalone/session-service/session-calls/session-turns.mjs +12 -42
- package/src/standalone/session-service/session-calls/session-views.mjs +8 -8
- package/src/standalone/session-transport/stack.mjs +131 -0
- package/src/standalone/session-transport.mjs +10 -103
- package/src/standalone/usage-dashboard.mjs +167 -165
- package/src/standalone/usage-stats-model.mjs +117 -97
- package/src/tui/App.jsx +27 -210
- package/src/tui/app/app-format.mjs +7 -0
- package/src/tui/app/app-view/floating-panel.jsx +229 -0
- package/src/tui/app/app-view/text-entry-labels.mjs +81 -0
- package/src/tui/app/app-view/transcript-viewport/trailing-bands.jsx +94 -0
- package/src/tui/app/app-view/transcript-viewport/transcript-rows.jsx +87 -0
- package/src/tui/app/app-view/transcript-viewport.jsx +74 -0
- package/src/tui/app/app-view.jsx +12 -450
- package/src/tui/app/core-memory-picker/core-rows.mjs +32 -0
- package/src/tui/app/core-memory-picker/entry-prompts.mjs +45 -0
- package/src/tui/app/core-memory-picker/list-panels.mjs +75 -0
- package/src/tui/app/core-memory-picker.mjs +26 -120
- package/src/tui/app/doctor.mjs +17 -12
- package/src/tui/app/extension-pickers/skills-pickers/project-skills.mjs +38 -0
- package/src/tui/app/extension-pickers/skills-pickers/skill-detail.mjs +80 -0
- package/src/tui/app/extension-pickers/skills-pickers/skill-items.mjs +44 -0
- package/src/tui/app/extension-pickers/skills-pickers.mjs +31 -137
- package/src/tui/app/model-picker/route-selection/context-window.mjs +47 -0
- package/src/tui/app/model-picker/route-selection/effort.mjs +87 -0
- package/src/tui/app/model-picker/route-selection/fast-parameters.mjs +84 -0
- package/src/tui/app/model-picker/route-selection/model-key.mjs +5 -0
- package/src/tui/app/model-picker/route-selection.mjs +34 -200
- package/src/tui/app/mouse-input/edge-autoscroll.mjs +53 -0
- package/src/tui/app/mouse-input/geometry.mjs +109 -0
- package/src/tui/app/mouse-input/sgr-buttons.mjs +14 -0
- package/src/tui/app/mouse-input/wheel-router.mjs +96 -0
- package/src/tui/app/panel-signature.mjs +58 -0
- package/src/tui/app/project-picker/project-service.mjs +3 -7
- package/src/tui/app/prompt-submit.mjs +2 -7
- package/src/tui/app/provider-setup/api-key-actions.mjs +7 -80
- package/src/tui/app/provider-setup/oauth-actions.mjs +2 -10
- package/src/tui/app/provider-setup/provider-items.mjs +20 -3
- package/src/tui/app/settings-picker/settings-toggles/cycled.mjs +4 -0
- package/src/tui/app/settings-picker/settings-toggles/listed-cyclers.mjs +77 -0
- package/src/tui/app/settings-picker/settings-toggles/store-toggles.mjs +61 -0
- package/src/tui/app/settings-picker/settings-toggles/theme-cycler.mjs +36 -0
- package/src/tui/app/settings-picker/settings-toggles.mjs +21 -149
- package/src/tui/app/slash-commands.mjs +14 -4
- package/src/tui/app/store-service-call.mjs +17 -0
- package/src/tui/app/text-entry-policy.mjs +1 -3
- package/src/tui/app/transcript-row-estimate.mjs +31 -91
- package/src/tui/app/transcript-window.mjs +19 -0
- package/src/tui/app/use-disabled-skills.mjs +52 -0
- package/src/tui/app/use-global-key-input/copy-first.mjs +43 -0
- package/src/tui/app/use-global-key-input/shift-arrow.mjs +30 -0
- package/src/tui/app/use-global-key-input.mjs +10 -67
- package/src/tui/app/use-model-catalog-cache.mjs +86 -0
- package/src/tui/app/use-mouse-input.mjs +64 -218
- package/src/tui/app/use-pasted-buffers.mjs +55 -81
- package/src/tui/app/use-prompt-draft-flow/draft-change.mjs +66 -0
- package/src/tui/app/use-prompt-draft-flow/prompt-cancels.mjs +40 -0
- package/src/tui/app/use-prompt-draft-flow.mjs +38 -77
- package/src/tui/app/use-prompt-queue-history/prompt-history.mjs +22 -0
- package/src/tui/app/use-prompt-queue-history/restore-to-prompt.mjs +147 -0
- package/src/tui/app/use-prompt-queue-history.mjs +20 -117
- package/src/tui/app/use-selection-focus.mjs +2 -1
- package/src/tui/app/use-selection-geometry.mjs +9 -12
- package/src/tui/app/use-selection-paint/paint-queue.mjs +90 -0
- package/src/tui/app/use-selection-paint/selection-clip.mjs +33 -0
- package/src/tui/app/use-selection-paint.mjs +31 -102
- package/src/tui/app/use-transcript-activity.mjs +1 -1
- package/src/tui/app/use-transcript-window/instance-state.mjs +1 -1
- package/src/tui/app/use-welcome-prompt-hint.mjs +1 -1
- package/src/tui/app/workflow-cycle.mjs +63 -0
- package/src/tui/components/AnsiText.jsx +47 -15
- package/src/tui/components/ItemRightHintOverprint.jsx +2 -15
- package/src/tui/components/Picker.jsx +9 -23
- package/src/tui/components/PromptInput.jsx +89 -335
- package/src/tui/components/QueuedCommands.jsx +1 -3
- package/src/tui/components/Spinner.jsx +1 -2
- package/src/tui/components/StatusLine.jsx +11 -21
- package/src/tui/components/TextEntryPanel.jsx +5 -52
- package/src/tui/components/ToolExecution.jsx +5 -14
- package/src/tui/components/TranscriptItem.jsx +0 -2
- package/src/tui/components/TurnDone.jsx +2 -14
- package/src/tui/components/prompt-input/cursor-anchor.mjs +65 -0
- package/src/tui/components/prompt-input/edit-helpers.mjs +1 -2
- package/src/tui/components/prompt-input/key-signals.mjs +122 -0
- package/src/tui/components/prompt-input/mouse-selection.mjs +114 -0
- package/src/tui/components/prompt-input/restore-policy.d.mts +0 -1
- package/src/tui/components/prompt-input/restore-policy.mjs +3 -8
- package/src/tui/components/prompt-input/selected-text.jsx +25 -0
- package/src/tui/components/prompt-input/undo-stack.mjs +75 -0
- package/src/tui/components/tool-output-format.mjs +1 -2
- package/src/tui/dist/index.mjs +2841 -2469
- package/src/tui/index.jsx +2 -2
- package/src/tui/markdown/measure-rendered-rows.mjs +8 -33
- package/src/tui/markdown/render-ansi.mjs +5 -5
- package/src/tui/markdown/table-layout/box-lines.mjs +46 -0
- package/src/tui/markdown/table-layout/cells.mjs +23 -0
- package/src/tui/markdown/table-layout/column-widths.mjs +65 -0
- package/src/tui/markdown/table-layout/vertical-lines.mjs +46 -0
- package/src/tui/markdown/table-layout.mjs +21 -151
- package/src/tui/prompt-history-store.mjs +0 -9
- package/src/tui/session/active-tool-summary.mjs +19 -27
- package/src/tui/session/agent-envelope.mjs +9 -9
- package/src/tui/session/live-share/owner.mjs +9 -7
- package/src/tui/session/live-share/retry.mjs +15 -0
- package/src/tui/session/live-share/viewer/frame-router.mjs +32 -0
- package/src/tui/session/live-share/viewer/pipe-client.mjs +108 -0
- package/src/tui/session/live-share/viewer.mjs +23 -114
- package/src/tui/session/notice-surface.mjs +1 -1
- package/src/tui/session/notice-text.mjs +21 -17
- package/src/tui/session/queue-helpers.mjs +12 -14
- package/src/tui/session/session-api/intake/submission.mjs +3 -8
- package/src/tui/session/session-api/integrations.mjs +0 -11
- package/src/tui/session/session-api/lifecycle/session-reset.mjs +76 -74
- package/src/tui/session/session-flow/drain.mjs +18 -5
- package/src/tui/session/session-flow/queue/entry-shape.mjs +53 -0
- package/src/tui/session/session-flow/queue/take-entries.mjs +82 -0
- package/src/tui/session/session-flow/queue.mjs +10 -112
- package/src/tui/session/session-flow/session-reset.mjs +2 -7
- package/src/tui/session/tool-approval.mjs +13 -17
- package/src/tui/session/tool-result-text.mjs +16 -28
- package/src/tui/session/transcript-spill.mjs +3 -7
- package/src/tui/session/transcript-store/replace-items.mjs +66 -0
- package/src/tui/session/transcript-store/streaming-tail.mjs +49 -0
- package/src/tui/session/transcript-store.mjs +16 -95
- package/src/tui/statusline-ansi-bridge.mjs +1 -40
- package/src/ui/markdown.mjs +3 -2
- package/src/ui/statusline-agents.mjs +9 -14
- package/src/ui/statusline.mjs +4 -4
- package/src/runtime/channels/lib/cli-worker-host.mjs +0 -2
- package/src/runtime/memory/lib/llm-worker-host.mjs +0 -11
- package/src/standalone/opencode-go-login.mjs +0 -140
|
@@ -29,10 +29,10 @@ function formatCompactElapsedSeconds(ms) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
// True when an abort explicitly opted into partial salvage — the error object
|
|
32
|
-
// or the abort reason carries `salvagePartial: true`. A
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
//
|
|
32
|
+
// or the abort reason carries `salvagePartial: true`. A hard deadline sets it
|
|
33
|
+
// so partial output the sub-agent already produced is returned instead of
|
|
34
|
+
// discarded; user cancellation (ESC) never sets it and keeps the
|
|
35
|
+
// throw-everything behaviour.
|
|
36
36
|
function salvagePartialRequested(error, signal) {
|
|
37
37
|
if (error && typeof error === 'object' && error.salvagePartial === true) return true;
|
|
38
38
|
const reason = signal?.reason;
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
*/
|
|
43
43
|
|
|
44
44
|
import { createHash } from 'node:crypto';
|
|
45
|
+
import { stableHashStringify } from '../stable-hash-stringify.mjs';
|
|
45
46
|
import { getHiddenAgent } from '../internal-agents.mjs';
|
|
46
47
|
import { nonNegativeInt, positiveInt } from '../../../shared/numbers.mjs';
|
|
47
48
|
|
|
@@ -60,6 +61,24 @@ function isOneShotMaintenanceAgent(agent) {
|
|
|
60
61
|
return Boolean(hidden && hidden.kind === 'maintenance' && hidden.toolSchemaProfile === 'none');
|
|
61
62
|
}
|
|
62
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Lead-session BP4 (messages tail) TTL, linked to the autoClear idle-sweep
|
|
66
|
+
* config (config.mjs `autoClear: { enabled, idleMs }`, normalized via
|
|
67
|
+
* session-runtime/config-helpers.mjs normalizeAutoClearConfig):
|
|
68
|
+
* - autoClear disabled → '1h' (session may live indefinitely;
|
|
69
|
+
* amortize the 2x write premium over a long-lived tail)
|
|
70
|
+
* - idleMs >= 1h (3_600_000ms) → '1h' (idle-sweep window is at least
|
|
71
|
+
* as long as the 1h TTL, so the longer TTL is never wasted)
|
|
72
|
+
* - otherwise (shorter idle-sweep) → '5m' (session reaps before a 1h
|
|
73
|
+
* write would ever be re-read; cheaper 5m write wins)
|
|
74
|
+
*/
|
|
75
|
+
export function resolveLeadMessagesTtl(autoClear) {
|
|
76
|
+
if (autoClear && autoClear.enabled === false) return '1h';
|
|
77
|
+
const idleMs = Number(autoClear?.idleMs);
|
|
78
|
+
if (Number.isFinite(idleMs) && idleMs >= 3_600_000) return '1h';
|
|
79
|
+
return '5m';
|
|
80
|
+
}
|
|
81
|
+
|
|
63
82
|
/**
|
|
64
83
|
* Return the layered cache policy for Anthropic-family providers.
|
|
65
84
|
*
|
|
@@ -94,25 +113,6 @@ function isOneShotMaintenanceAgent(agent) {
|
|
|
94
113
|
* the 1h TTL expiry (writes every run, 0 reads). All layers go 'none' for
|
|
95
114
|
* these roles — single-iteration calls pay the write premium with no reuse.
|
|
96
115
|
*/
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Lead-session BP4 (messages tail) TTL, linked to the autoClear idle-sweep
|
|
100
|
-
* config (config.mjs `autoClear: { enabled, idleMs }`, normalized via
|
|
101
|
-
* session-runtime/config-helpers.mjs normalizeAutoClearConfig):
|
|
102
|
-
* - autoClear disabled → '1h' (session may live indefinitely;
|
|
103
|
-
* amortize the 2x write premium over a long-lived tail)
|
|
104
|
-
* - idleMs >= 1h (3_600_000ms) → '1h' (idle-sweep window is at least
|
|
105
|
-
* as long as the 1h TTL, so the longer TTL is never wasted)
|
|
106
|
-
* - otherwise (shorter idle-sweep) → '5m' (session reaps before a 1h
|
|
107
|
-
* write would ever be re-read; cheaper 5m write wins)
|
|
108
|
-
*/
|
|
109
|
-
export function resolveLeadMessagesTtl(autoClear) {
|
|
110
|
-
if (autoClear && autoClear.enabled === false) return '1h';
|
|
111
|
-
const idleMs = Number(autoClear?.idleMs);
|
|
112
|
-
if (Number.isFinite(idleMs) && idleMs >= 3_600_000) return '1h';
|
|
113
|
-
return '5m';
|
|
114
|
-
}
|
|
115
|
-
|
|
116
116
|
export function resolveCacheStrategy(agent, { autoClear } = {}) {
|
|
117
117
|
if (isOneShotMaintenanceAgent(agent)) {
|
|
118
118
|
return { tools: 'none', system: 'none', tier3: 'none', messages: 'none' };
|
|
@@ -141,15 +141,6 @@ export function resolveCacheStrategy(agent, { autoClear } = {}) {
|
|
|
141
141
|
return applyEnv({ tools: 'none', system: '1h', tier3: '1h', messages: resolveLeadMessagesTtl(autoClear) });
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
/**
|
|
145
|
-
* Build provider-specific sendOpts.
|
|
146
|
-
*
|
|
147
|
-
* @param {string} provider
|
|
148
|
-
* @param {string} [sessionId]
|
|
149
|
-
* @param {string} [agent]
|
|
150
|
-
* @returns {object} partial sendOpts — spread into provider.send call
|
|
151
|
-
*/
|
|
152
|
-
|
|
153
144
|
// Provider cache capability kinds:
|
|
154
145
|
// 'explicit-breakpoint' — explicit provider-side cache_control writes
|
|
155
146
|
// 'key-prefix' — provider-managed shard keyed by cache key/session
|
|
@@ -211,15 +202,8 @@ export function resolveProviderCacheKey(opts, provider) {
|
|
|
211
202
|
);
|
|
212
203
|
}
|
|
213
204
|
|
|
214
|
-
function stableStringify(value) {
|
|
215
|
-
if (value === null || typeof value !== 'object') return JSON.stringify(value);
|
|
216
|
-
if (Array.isArray(value)) return `[${value.map((v) => stableStringify(v)).join(',')}]`;
|
|
217
|
-
const keys = Object.keys(value).sort();
|
|
218
|
-
return `{${keys.map((k) => `${JSON.stringify(k)}:${stableStringify(value[k])}`).join(',')}}`;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
205
|
function shortHash(value, chars = 18) {
|
|
222
|
-
return createHash('sha256').update(
|
|
206
|
+
return createHash('sha256').update(stableHashStringify(value)).digest('hex').slice(0, chars);
|
|
223
207
|
}
|
|
224
208
|
|
|
225
209
|
function cleanString(value) {
|
|
@@ -396,11 +380,6 @@ function assignPromptCacheLaneSlot(provider, opts, shards, seed, { auto = false
|
|
|
396
380
|
return slot;
|
|
397
381
|
}
|
|
398
382
|
|
|
399
|
-
/**
|
|
400
|
-
* Resolve an optional cache-lane slot for OpenAI-style prompt cache sharding.
|
|
401
|
-
* prompt_cache_key is not sharded by default, so every provider now gets
|
|
402
|
-
* one un-suffixed key unless an env/config override opts into shards.
|
|
403
|
-
*/
|
|
404
383
|
// The requested lane limit: 'auto' when any auto flag is set, else the lane
|
|
405
384
|
// SHARDS, requested either by their own name (`*CacheLaneShards`) or through
|
|
406
385
|
// the legacy `*CacheMaxParallel` / MIXDOG_*_CACHE_MAX_PARALLEL aliases. Those
|
|
@@ -444,6 +423,11 @@ function requestedPromptCacheLaneLimit(provider, opts, config) {
|
|
|
444
423
|
return rawShards ?? rawAlias;
|
|
445
424
|
}
|
|
446
425
|
|
|
426
|
+
/**
|
|
427
|
+
* Resolve an optional cache-lane slot for OpenAI-style prompt cache sharding.
|
|
428
|
+
* prompt_cache_key is not sharded by default, so every provider now gets
|
|
429
|
+
* one un-suffixed key unless an env/config override opts into shards.
|
|
430
|
+
*/
|
|
447
431
|
export function resolveProviderPromptCacheLane(provider, opts = {}, config = {}) {
|
|
448
432
|
const rawLimit = requestedPromptCacheLaneLimit(provider, opts, config);
|
|
449
433
|
const shards = parsePromptCacheLaneLimit(rawLimit);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
|
+
import { stableHashStringify } from './stable-hash-stringify.mjs';
|
|
2
3
|
import { countJsonNextCalls } from './tools/next-call-utils.mjs';
|
|
3
4
|
import { parseGrepContextHeader, splitGrepLinePrefix } from './tools/builtin/grep-formatting.mjs';
|
|
4
5
|
import { isReadOnlyNavigationMiss } from './session/result-classification.mjs';
|
|
@@ -142,23 +143,31 @@ const TOOL_ARG_KEYS = {
|
|
|
142
143
|
|
|
143
144
|
const REDACT_KEY_RE = /token|secret|password|passwd|credential|authorization|api[_-]?key/i;
|
|
144
145
|
const BODY_KEY_RE = /content|old_string|new_string|patch|rewrite/i;
|
|
146
|
+
// Secret shapes redacted from more than one surface (shell commands and log
|
|
147
|
+
// text). Each redaction keeps the matched prefix and drops the value.
|
|
148
|
+
const REDACTED = '$1[redacted]';
|
|
149
|
+
// Assignment RHS: PASSWORD=, SECRET=, TOKEN=, API_KEY=/APIKEY=.
|
|
150
|
+
const SECRET_ASSIGNMENT_RE = /((?:PASSWORD|SECRET|TOKEN|API_KEY|APIKEY)\s*=\s*)\S+/gi;
|
|
151
|
+
// Authorization: Bearer <token>.
|
|
152
|
+
const BEARER_HEADER_RE = /(Authorization:\s*Bearer\s+)\S+/gi;
|
|
153
|
+
// URL query params carrying tokens/keys.
|
|
154
|
+
const SECRET_QUERY_PARAM_RE = /([?&](?:token|api[-_]?key|access[-_]?token|auth|password|secret)=)[^&\s#]+/gi;
|
|
145
155
|
// Redact shell `command` values that look like they carry secrets. Covers
|
|
146
|
-
// assignment forms, Authorization headers, --password / -p flags,
|
|
156
|
+
// assignment forms, Authorization headers, --password / -p flags, URL
|
|
157
|
+
// userinfo and token query params. The shapes shared with log text are the
|
|
158
|
+
// named constants above; the rest are shell-only and stay inline.
|
|
147
159
|
function _redactShellCommand(cmd) {
|
|
148
160
|
if (typeof cmd !== 'string') return cmd;
|
|
149
161
|
let out = cmd;
|
|
150
|
-
|
|
151
|
-
out = out.replace(
|
|
152
|
-
// Authorization: Bearer <token>.
|
|
153
|
-
out = out.replace(/(Authorization:\s*Bearer\s+)\S+/gi, '$1[redacted]');
|
|
162
|
+
out = out.replace(SECRET_ASSIGNMENT_RE, REDACTED);
|
|
163
|
+
out = out.replace(BEARER_HEADER_RE, REDACTED);
|
|
154
164
|
// Long flags: --password <v> / --password=<v> (also --token, --secret, --api-key).
|
|
155
165
|
out = out.replace(/(--(?:password|token|secret|api[-_]?key)(?:\s+|=))\S+/gi, '$1[redacted]');
|
|
156
166
|
// Short -p <v> flag (mysql/psql/curl style).
|
|
157
167
|
out = out.replace(/((?:^|\s)-p(?:\s+|=))\S+/g, '$1[redacted]');
|
|
158
168
|
// URL userinfo: scheme://user:secret@host -> scheme://user:[redacted]@host.
|
|
159
169
|
out = out.replace(/(:\/\/[^:/\s@]+:)[^@\s]+(@)/g, '$1[redacted]$2');
|
|
160
|
-
|
|
161
|
-
out = out.replace(/([?&](?:token|api[-_]?key|access[-_]?token|auth|password|secret)=)[^&\s#]+/gi, '$1[redacted]');
|
|
170
|
+
out = out.replace(SECRET_QUERY_PARAM_RE, REDACTED);
|
|
162
171
|
return out;
|
|
163
172
|
}
|
|
164
173
|
|
|
@@ -205,17 +214,9 @@ function summarizeToolArgs(toolName, args) {
|
|
|
205
214
|
return Object.keys(out).length ? out : null;
|
|
206
215
|
}
|
|
207
216
|
|
|
208
|
-
function stableTraceStringify(value) {
|
|
209
|
-
if (value === null || value === undefined) return JSON.stringify(value);
|
|
210
|
-
if (typeof value !== 'object') return JSON.stringify(value);
|
|
211
|
-
if (Array.isArray(value)) return `[${value.map(stableTraceStringify).join(',')}]`;
|
|
212
|
-
const keys = Object.keys(value).sort();
|
|
213
|
-
return `{${keys.map((k) => `${JSON.stringify(k)}:${stableTraceStringify(value[k])}`).join(',')}}`;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
217
|
function hashTraceValue(value) {
|
|
217
218
|
try {
|
|
218
|
-
return createHash('sha256').update(
|
|
219
|
+
return createHash('sha256').update(stableHashStringify(value)).digest('hex').slice(0, 16);
|
|
219
220
|
} catch {
|
|
220
221
|
return null;
|
|
221
222
|
}
|
|
@@ -233,9 +234,9 @@ function _firstNonEmptyLine(text) {
|
|
|
233
234
|
function _redactLogText(text) {
|
|
234
235
|
if (typeof text !== 'string') return '';
|
|
235
236
|
let out = text;
|
|
236
|
-
out = out.replace(
|
|
237
|
-
out = out.replace(
|
|
238
|
-
out = out.replace(
|
|
237
|
+
out = out.replace(BEARER_HEADER_RE, REDACTED);
|
|
238
|
+
out = out.replace(SECRET_QUERY_PARAM_RE, REDACTED);
|
|
239
|
+
out = out.replace(SECRET_ASSIGNMENT_RE, REDACTED);
|
|
239
240
|
return out;
|
|
240
241
|
}
|
|
241
242
|
|
|
@@ -288,11 +289,6 @@ function parseGrepCoverage(resultText, toolName, toolArgs, resultKind) {
|
|
|
288
289
|
return out.length ? out : null;
|
|
289
290
|
}
|
|
290
291
|
|
|
291
|
-
// Patch failures all arrive as "apply_patch … failed" prose, but
|
|
292
|
-
// a malformed envelope, a rejected hunk, a preflight veto and a size/lock
|
|
293
|
-
// guard need different operator responses. Returning null means "nothing
|
|
294
|
-
// patch-specific here" and lets the generic rules (path/enoent, schema/args,
|
|
295
|
-
// runtime/failure) finish the classification.
|
|
296
292
|
// Emitted by the sequence/wave reporters whenever section writes reached disk
|
|
297
293
|
// and were NOT rolled back cleanly (committed-by-design, partial mode, or a
|
|
298
294
|
// rollback that itself failed). Any of these means the working tree state is
|
|
@@ -300,6 +296,11 @@ function parseGrepCoverage(resultText, toolName, toolArgs, resultKind) {
|
|
|
300
296
|
const PATCH_COMMITTED_WRITES_RE =
|
|
301
297
|
/already applied to disk \(writes committed\)|applied to disk \(committed\) and left in place|applied \(committed to disk\)|rollback was incomplete|--- rollback incomplete ---|patch partially (?:applied|created|updated|written)/;
|
|
302
298
|
|
|
299
|
+
// Patch failures all arrive as "apply_patch … failed" prose, but
|
|
300
|
+
// a malformed envelope, a rejected hunk, a preflight veto and a size/lock
|
|
301
|
+
// guard need different operator responses. Returning null means "nothing
|
|
302
|
+
// patch-specific here" and lets the generic rules (path/enoent, schema/args,
|
|
303
|
+
// runtime/failure) finish the classification.
|
|
303
304
|
function classifyPatchFailure(text) {
|
|
304
305
|
// Writes already committed outranks every other patch detail: the tree is
|
|
305
306
|
// no longer in its pre-patch state and needs inspection before a retry.
|
|
@@ -136,6 +136,19 @@ function _appendLocalTrace(row) {
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
// Throttle rotation stat checks to avoid unnecessary statSync calls
|
|
140
|
+
// on every flush. First flush (_lastRotateCheckMs === 0) always checks.
|
|
141
|
+
// Explicit sinks can have many short-lived headless writers. Keep that
|
|
142
|
+
// shared file append-only so no writer can rename it out from under a
|
|
143
|
+
// peer or from session-bench while scoring.
|
|
144
|
+
function _maybeRotateLocalTrace(path) {
|
|
145
|
+
if (_localTraceIsExplicit) return;
|
|
146
|
+
const now = Date.now();
|
|
147
|
+
if (_lastRotateCheckMs !== 0 && now - _lastRotateCheckMs < MIXDOG_AGENT_TRACE_ROTATE_CHECK_MS) return;
|
|
148
|
+
_rotateLocalTraceIfNeeded(path);
|
|
149
|
+
_lastRotateCheckMs = now;
|
|
150
|
+
}
|
|
151
|
+
|
|
139
152
|
function _flushLocalTrace() {
|
|
140
153
|
if (_localTraceTimer) {
|
|
141
154
|
clearTimeout(_localTraceTimer);
|
|
@@ -151,19 +164,7 @@ function _flushLocalTrace() {
|
|
|
151
164
|
_localTraceBuffer = [];
|
|
152
165
|
try {
|
|
153
166
|
_ensureLocalTraceDirectory(path);
|
|
154
|
-
|
|
155
|
-
// on every flush. First flush (_lastRotateCheckMs === 0) always checks.
|
|
156
|
-
const now = Date.now();
|
|
157
|
-
// Explicit sinks can have many short-lived headless writers. Keep that
|
|
158
|
-
// shared file append-only so no writer can rename it out from under a
|
|
159
|
-
// peer or from session-bench while scoring.
|
|
160
|
-
if (
|
|
161
|
-
!_localTraceIsExplicit &&
|
|
162
|
-
(_lastRotateCheckMs === 0 || now - _lastRotateCheckMs >= MIXDOG_AGENT_TRACE_ROTATE_CHECK_MS)
|
|
163
|
-
) {
|
|
164
|
-
_rotateLocalTraceIfNeeded(path);
|
|
165
|
-
_lastRotateCheckMs = now;
|
|
166
|
-
}
|
|
167
|
+
_maybeRotateLocalTrace(path);
|
|
167
168
|
} catch (err) {
|
|
168
169
|
warnAgentOnce('agent-trace:local-spool', `[agent-trace] local spool failed (${err?.message})`);
|
|
169
170
|
return;
|
|
@@ -199,14 +200,7 @@ function _flushLocalTraceSync() {
|
|
|
199
200
|
_localTraceBuffer = [];
|
|
200
201
|
try {
|
|
201
202
|
_ensureLocalTraceDirectory(path);
|
|
202
|
-
|
|
203
|
-
if (
|
|
204
|
-
!_localTraceIsExplicit &&
|
|
205
|
-
(_lastRotateCheckMs === 0 || now - _lastRotateCheckMs >= MIXDOG_AGENT_TRACE_ROTATE_CHECK_MS)
|
|
206
|
-
) {
|
|
207
|
-
_rotateLocalTraceIfNeeded(path);
|
|
208
|
-
_lastRotateCheckMs = now;
|
|
209
|
-
}
|
|
203
|
+
_maybeRotateLocalTrace(path);
|
|
210
204
|
appendFileSync(path, chunk, { encoding: 'utf8', mode: 0o600 });
|
|
211
205
|
} catch (err) {
|
|
212
206
|
warnAgentOnce('agent-trace:local-spool', `[agent-trace] local spool failed (${err?.message})`);
|
|
@@ -481,7 +475,6 @@ export {
|
|
|
481
475
|
drainAgentTrace,
|
|
482
476
|
normalizeSessionId,
|
|
483
477
|
warnAgentOnce,
|
|
484
|
-
_resolveLocalTracePath,
|
|
485
478
|
_resolveToolFailurePath,
|
|
486
479
|
_appendToolFailureRow,
|
|
487
480
|
};
|
|
@@ -77,26 +77,6 @@ function messagePrefixHash(messages) {
|
|
|
77
77
|
return null;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
function traceStreamStalled({ sessionId, info }) {
|
|
81
|
-
appendAgentTrace({
|
|
82
|
-
sessionId,
|
|
83
|
-
kind: 'stream_stalled',
|
|
84
|
-
stale_seconds: info.staleSeconds,
|
|
85
|
-
last_tool_call: info.lastToolCall,
|
|
86
|
-
stage: info.stage,
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function traceStreamAborted({ sessionId, info }) {
|
|
91
|
-
appendAgentTrace({
|
|
92
|
-
sessionId,
|
|
93
|
-
kind: 'stream_aborted',
|
|
94
|
-
stale_seconds: info.staleSeconds,
|
|
95
|
-
last_tool_call: info.lastToolCall,
|
|
96
|
-
stage: info.stage,
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
|
|
100
80
|
function traceAgentPreset({ sessionId, agent, presetName, model, provider, parentSessionId }) {
|
|
101
81
|
// Fires once per dispatch right after the preset has been resolved and
|
|
102
82
|
// its runtime spec (provider/model) assembled. Useful for after-the-fact
|
|
@@ -337,7 +317,5 @@ export {
|
|
|
337
317
|
traceAgentShellOutput,
|
|
338
318
|
traceAgentToolOutput,
|
|
339
319
|
traceAgentBatch,
|
|
340
|
-
traceStreamAborted,
|
|
341
|
-
traceStreamStalled,
|
|
342
320
|
warnAgentOnce,
|
|
343
321
|
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* config-providers-merge.mjs — how the stored `providers` section is folded
|
|
3
|
+
* onto the probe-built defaults: unknown per-provider keys survive the merge,
|
|
4
|
+
* a stored `enabled` outranks the credential probe, keychain API keys are
|
|
5
|
+
* overlaid onto the entries that own one, and the OAuth-only cursor-api entry
|
|
6
|
+
* is dropped.
|
|
7
|
+
*/
|
|
8
|
+
import { AGENT_PROVIDER_ENV, getAgentApiKey } from '../../shared/config.mjs';
|
|
9
|
+
import { OPENAI_COMPAT_PRESETS } from './providers/openai-compat-presets.mjs';
|
|
10
|
+
|
|
11
|
+
export function mergeStoredProviders({ raw, defaults, includeSecrets }) {
|
|
12
|
+
// Deep-merge provider subkeys: unknown per-provider values are
|
|
13
|
+
// preserved through save/load so future fields round-trip
|
|
14
|
+
// without schema updates here.
|
|
15
|
+
const mergedProviders = { ...defaults.providers };
|
|
16
|
+
if (raw.providers && typeof raw.providers === 'object') {
|
|
17
|
+
for (const [name, val] of Object.entries(raw.providers)) {
|
|
18
|
+
if (val && typeof val === 'object') {
|
|
19
|
+
mergedProviders[name] = { ...(mergedProviders[name] || {}), ...val };
|
|
20
|
+
// A STORED `enabled` is the user's own decision (setup
|
|
21
|
+
// UI disable / hand edit) and outranks the probe: keep
|
|
22
|
+
// it authoritative by dropping the probe-availability
|
|
23
|
+
// marker, so a disable still removes the provider even
|
|
24
|
+
// while its credential file happens to be unreadable.
|
|
25
|
+
if (Object.hasOwn(val, 'enabled')) {
|
|
26
|
+
delete mergedProviders[name].credentialProbeUnavailable;
|
|
27
|
+
}
|
|
28
|
+
} else {
|
|
29
|
+
mergedProviders[name] = val;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// Provider API keys live in the OS keychain (std env / MIXDOG_AGENT_*
|
|
34
|
+
// -> keychain), never plaintext in config. Overlay them so the
|
|
35
|
+
// provider clients see config.apiKey populated.
|
|
36
|
+
// AGENT_PROVIDER_ENV covers first-class key providers; OPENAI_COMPAT_PRESETS
|
|
37
|
+
// covers compat providers (opencode-go, …) whose key also lives in
|
|
38
|
+
// the keychain. Without the union, a compat provider with a valid
|
|
39
|
+
// stored key still ships 'no-key' → 401.
|
|
40
|
+
if (includeSecrets) {
|
|
41
|
+
for (const name of new Set([...Object.keys(AGENT_PROVIDER_ENV), ...Object.keys(OPENAI_COMPAT_PRESETS)])) {
|
|
42
|
+
const kc = getAgentApiKey(name);
|
|
43
|
+
if (kc) {
|
|
44
|
+
mergedProviders[name] = {
|
|
45
|
+
...(mergedProviders[name] || {}),
|
|
46
|
+
apiKey: kc,
|
|
47
|
+
enabled: raw.providers?.[name]?.enabled !== false,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// Cursor account access is OAuth-only. The dashboard's "API"
|
|
53
|
+
// meter is a quota bucket on that account, not a separate provider.
|
|
54
|
+
delete mergedProviders['cursor-api'];
|
|
55
|
+
return mergedProviders;
|
|
56
|
+
}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { resolvePluginData } from '../../shared/plugin-paths.mjs';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
updateSection,
|
|
5
|
-
updateSectionAsync,
|
|
6
|
-
getAgentApiKey,
|
|
7
|
-
AGENT_PROVIDER_ENV,
|
|
8
|
-
} from '../../shared/config.mjs';
|
|
2
|
+
import { readSection, updateSection, updateSectionAsync, AGENT_PROVIDER_ENV } from '../../shared/config.mjs';
|
|
3
|
+
import { mergeStoredProviders } from './config-providers-merge.mjs';
|
|
9
4
|
import { normalizeExtensionScopes } from '../../shared/extension-scopes.mjs';
|
|
10
5
|
import { applyConfigPatch, diffConfig } from '../../shared/config-patch.mjs';
|
|
11
6
|
import { normalizeWorkflowSelection } from '../../shared/orchestration.mjs';
|
|
@@ -23,7 +18,6 @@ import {
|
|
|
23
18
|
normalizeWebSearchRoute,
|
|
24
19
|
removeRetiredAgentFields,
|
|
25
20
|
} from './config-storage.mjs';
|
|
26
|
-
import { OPENAI_COMPAT_PRESETS } from './providers/openai-compat-presets.mjs';
|
|
27
21
|
import { oauthCredentialProbeState, isOAuthProviderAvailable } from './providers/oauth-credential-probes.mjs';
|
|
28
22
|
|
|
29
23
|
export const {
|
|
@@ -132,6 +126,36 @@ async function persistAgentConfigAsync(build) {
|
|
|
132
126
|
await updateSectionAsync('agent', (current) => build(hasKeys(current) ? current : {}));
|
|
133
127
|
}
|
|
134
128
|
|
|
129
|
+
// Self-ref guard: mcpServers.mixdog / mcpServers["trib-plugin"] would
|
|
130
|
+
// self-spawn through the in-process tool adapter. Strip on ingress so
|
|
131
|
+
// user-edited configs cannot brick the agent boot; the strip is also
|
|
132
|
+
// persisted so the bad entry does not survive the next save. Mutates `raw`
|
|
133
|
+
// (the read-time snapshot) to match what is returned.
|
|
134
|
+
function sanitizeStoredMcpServers(raw) {
|
|
135
|
+
const mcpServers = raw.mcpServers && typeof raw.mcpServers === 'object' ? { ...raw.mcpServers } : {};
|
|
136
|
+
if (!mcpServers.mixdog && !mcpServers['trib-plugin']) return mcpServers;
|
|
137
|
+
delete mcpServers.mixdog;
|
|
138
|
+
delete mcpServers['trib-plugin'];
|
|
139
|
+
raw.mcpServers = mcpServers;
|
|
140
|
+
try {
|
|
141
|
+
// Rebase the self-ref strip onto the in-lock current so a
|
|
142
|
+
// concurrent writer's unrelated edits are not reverted by
|
|
143
|
+
// this read-time sanitize.
|
|
144
|
+
persistAgentConfig((current) => {
|
|
145
|
+
const cur = { ...current };
|
|
146
|
+
// updateSection already supplies the agent section.
|
|
147
|
+
const curMcp = cur.mcpServers && typeof cur.mcpServers === 'object' ? { ...cur.mcpServers } : {};
|
|
148
|
+
delete curMcp.mixdog;
|
|
149
|
+
delete curMcp['trib-plugin'];
|
|
150
|
+
cur.mcpServers = curMcp;
|
|
151
|
+
return cur;
|
|
152
|
+
});
|
|
153
|
+
} catch (err) {
|
|
154
|
+
process.stderr.write(`[config] persist sanitized config failed: ${err?.message}\n`);
|
|
155
|
+
}
|
|
156
|
+
return mcpServers;
|
|
157
|
+
}
|
|
158
|
+
|
|
135
159
|
// Recap toggle (recap.enabled, default true) gates ONLY the background memory
|
|
136
160
|
// cycles. The memory module itself is always-on.
|
|
137
161
|
function normalizeRecapConfig(rawRecap) {
|
|
@@ -149,49 +173,7 @@ export function loadConfig(options = {}) {
|
|
|
149
173
|
const storageNeedsMigration = agentConfigStorageNeedsMigration(raw);
|
|
150
174
|
raw = canonicalizeAgentStorage(raw);
|
|
151
175
|
const defaults = buildDefaultConfig({ detectCredentials: includeSecrets });
|
|
152
|
-
|
|
153
|
-
// preserved through save/load so future fields round-trip
|
|
154
|
-
// without schema updates here.
|
|
155
|
-
const mergedProviders = { ...defaults.providers };
|
|
156
|
-
if (raw.providers && typeof raw.providers === 'object') {
|
|
157
|
-
for (const [name, val] of Object.entries(raw.providers)) {
|
|
158
|
-
if (val && typeof val === 'object') {
|
|
159
|
-
mergedProviders[name] = { ...(mergedProviders[name] || {}), ...val };
|
|
160
|
-
// A STORED `enabled` is the user's own decision (setup
|
|
161
|
-
// UI disable / hand edit) and outranks the probe: keep
|
|
162
|
-
// it authoritative by dropping the probe-availability
|
|
163
|
-
// marker, so a disable still removes the provider even
|
|
164
|
-
// while its credential file happens to be unreadable.
|
|
165
|
-
if (Object.hasOwn(val, 'enabled')) {
|
|
166
|
-
delete mergedProviders[name].credentialProbeUnavailable;
|
|
167
|
-
}
|
|
168
|
-
} else {
|
|
169
|
-
mergedProviders[name] = val;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
// Provider API keys live in the OS keychain (std env / MIXDOG_AGENT_*
|
|
174
|
-
// -> keychain), never plaintext in config. Overlay them so the
|
|
175
|
-
// provider clients see config.apiKey populated.
|
|
176
|
-
// AGENT_PROVIDER_ENV covers first-class key providers; OPENAI_COMPAT_PRESETS
|
|
177
|
-
// covers compat providers (opencode-go, …) whose key also lives in
|
|
178
|
-
// the keychain. Without the union, a compat provider with a valid
|
|
179
|
-
// stored key still ships 'no-key' → 401.
|
|
180
|
-
if (includeSecrets) {
|
|
181
|
-
for (const name of new Set([...Object.keys(AGENT_PROVIDER_ENV), ...Object.keys(OPENAI_COMPAT_PRESETS)])) {
|
|
182
|
-
const kc = getAgentApiKey(name);
|
|
183
|
-
if (kc) {
|
|
184
|
-
mergedProviders[name] = {
|
|
185
|
-
...(mergedProviders[name] || {}),
|
|
186
|
-
apiKey: kc,
|
|
187
|
-
enabled: raw.providers?.[name]?.enabled !== false,
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
// Cursor account access is OAuth-only. The dashboard's "API"
|
|
193
|
-
// meter is a quota bucket on that account, not a separate provider.
|
|
194
|
-
delete mergedProviders['cursor-api'];
|
|
176
|
+
const mergedProviders = mergeStoredProviders({ raw, defaults, includeSecrets });
|
|
195
177
|
// Drop unknown maintenance keys (e.g. truly legacy slot names from
|
|
196
178
|
// pre-removal installs). Every valid fallback slot lives in
|
|
197
179
|
// DEFAULT_MAINTENANCE, so the allow-list below is the single
|
|
@@ -202,31 +184,7 @@ export function loadConfig(options = {}) {
|
|
|
202
184
|
if (allowedMaintKeys.has(k)) rawMaint[k] = v;
|
|
203
185
|
}
|
|
204
186
|
|
|
205
|
-
|
|
206
|
-
// would self-spawn through the in-process tool adapter. Strip on
|
|
207
|
-
// ingress so user-edited configs cannot brick the agent boot.
|
|
208
|
-
const mcpServers = raw.mcpServers && typeof raw.mcpServers === 'object' ? { ...raw.mcpServers } : {};
|
|
209
|
-
if (mcpServers.mixdog || mcpServers['trib-plugin']) {
|
|
210
|
-
delete mcpServers.mixdog;
|
|
211
|
-
delete mcpServers['trib-plugin'];
|
|
212
|
-
raw.mcpServers = mcpServers;
|
|
213
|
-
try {
|
|
214
|
-
// Rebase the self-ref strip onto the in-lock current so a
|
|
215
|
-
// concurrent writer's unrelated edits are not reverted by
|
|
216
|
-
// this read-time sanitize.
|
|
217
|
-
persistAgentConfig((current) => {
|
|
218
|
-
const cur = { ...current };
|
|
219
|
-
// updateSection already supplies the agent section.
|
|
220
|
-
const curMcp = cur.mcpServers && typeof cur.mcpServers === 'object' ? { ...cur.mcpServers } : {};
|
|
221
|
-
delete curMcp.mixdog;
|
|
222
|
-
delete curMcp['trib-plugin'];
|
|
223
|
-
cur.mcpServers = curMcp;
|
|
224
|
-
return cur;
|
|
225
|
-
});
|
|
226
|
-
} catch (err) {
|
|
227
|
-
process.stderr.write(`[config] persist sanitized config failed: ${err?.message}\n`);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
187
|
+
const mcpServers = sanitizeStoredMcpServers(raw);
|
|
230
188
|
const recapConfig = normalizeRecapConfig(raw.recap);
|
|
231
189
|
|
|
232
190
|
const rawPresets = Array.isArray(raw.presets) ? raw.presets : [];
|
|
@@ -221,7 +221,7 @@ export function loadScopedRoleInstructions(agent, provider = null) {
|
|
|
221
221
|
|
|
222
222
|
// --- Compose system prompt — 4-BP cache layout ---
|
|
223
223
|
// Returns the three stable system blocks and the BP3 core used for refreshes.
|
|
224
|
-
// directly to the breakpoint plan:
|
|
224
|
+
// They map directly to the breakpoint plan:
|
|
225
225
|
// BP1 (1h, system block #1) = baseRules — shared tool policy
|
|
226
226
|
// BP2 (1h, system block #2) = stableSystemContext — profile, skills, deferred/MCP
|
|
227
227
|
// BP3 (1h, system block #3) = sessionMarker — workflow/role, memory, session/project environment
|
|
@@ -525,47 +525,48 @@ export function wrapProviderAdmission(provider, providerName, scheduler = provid
|
|
|
525
525
|
// Provider queueing and network wait consume no local CPU slot. The
|
|
526
526
|
// resource controller reacquires the agent lease before model output
|
|
527
527
|
// continues through local context/tool processing.
|
|
528
|
-
return resourceAdmission.runYielded(
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
opts.onStageChange?.('requesting');
|
|
537
|
-
} catch {}
|
|
538
|
-
const admittedOpts = {
|
|
539
|
-
...opts,
|
|
540
|
-
signal: admissionSignal,
|
|
541
|
-
_providerAdmission: admissionMetrics,
|
|
542
|
-
};
|
|
543
|
-
return accountProviderSend(
|
|
544
|
-
providerName,
|
|
545
|
-
this,
|
|
546
|
-
() => originalSend.call(this, messages, model, tools, admittedOpts),
|
|
547
|
-
model,
|
|
548
|
-
admittedOpts
|
|
549
|
-
);
|
|
550
|
-
},
|
|
551
|
-
{
|
|
552
|
-
signal,
|
|
553
|
-
ownerKey: opts.admissionOwner || opts.sessionId || null,
|
|
554
|
-
priority: opts.admissionPriority || 'user-visible',
|
|
555
|
-
onCooldownWait: (waitMs) => {
|
|
556
|
-
// Display-only: the TUI/desktop 'reconnecting' stage already
|
|
557
|
-
// renders a custom verb, so no new stage vocabulary is needed.
|
|
558
|
-
const secs = Math.max(1, Math.ceil(waitMs / 1000));
|
|
528
|
+
return resourceAdmission.runYielded(
|
|
529
|
+
() =>
|
|
530
|
+
scheduler.run(
|
|
531
|
+
key,
|
|
532
|
+
(admissionSignal, admissionMetrics) => {
|
|
533
|
+
// Admission is the common request-clock boundary for WS/SSE/HTTP.
|
|
534
|
+
// Queue wait therefore cannot consume first-byte or agent-watchdog
|
|
535
|
+
// time. Provider-local retry remains the sole retry owner.
|
|
559
536
|
try {
|
|
560
|
-
opts.onStageChange?.('
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
537
|
+
opts.onStageChange?.('requesting');
|
|
538
|
+
} catch {}
|
|
539
|
+
const admittedOpts = {
|
|
540
|
+
...opts,
|
|
541
|
+
signal: admissionSignal,
|
|
542
|
+
_providerAdmission: admissionMetrics,
|
|
543
|
+
};
|
|
544
|
+
return accountProviderSend(
|
|
545
|
+
providerName,
|
|
546
|
+
this,
|
|
547
|
+
() => originalSend.call(this, messages, model, tools, admittedOpts),
|
|
548
|
+
model,
|
|
549
|
+
admittedOpts
|
|
550
|
+
);
|
|
566
551
|
},
|
|
567
|
-
|
|
568
|
-
|
|
552
|
+
{
|
|
553
|
+
signal,
|
|
554
|
+
ownerKey: opts.admissionOwner || opts.sessionId || null,
|
|
555
|
+
priority: opts.admissionPriority || 'user-visible',
|
|
556
|
+
onCooldownWait: (waitMs) => {
|
|
557
|
+
// Display-only: the TUI/desktop 'reconnecting' stage already
|
|
558
|
+
// renders a custom verb, so no new stage vocabulary is needed.
|
|
559
|
+
const secs = Math.max(1, Math.ceil(waitMs / 1000));
|
|
560
|
+
try {
|
|
561
|
+
opts.onStageChange?.('reconnecting', {
|
|
562
|
+
message: `Rate-limited — waiting ~${secs}s for the provider window`,
|
|
563
|
+
});
|
|
564
|
+
} catch {
|
|
565
|
+
/* display-only */
|
|
566
|
+
}
|
|
567
|
+
},
|
|
568
|
+
}
|
|
569
|
+
),
|
|
569
570
|
{ signal, onRestoreWait: () => opts.onStageChange?.('resource_wait') }
|
|
570
571
|
);
|
|
571
572
|
};
|