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
|
@@ -104,7 +104,7 @@ function traceCompleted(batch, completed, result, postprocessStartedAt) {
|
|
|
104
104
|
telemetry: completed.resultTelemetry,
|
|
105
105
|
preOffloadBytes,
|
|
106
106
|
postOffloadBytes,
|
|
107
|
-
modelVisibleBytes:
|
|
107
|
+
modelVisibleBytes: postOffloadBytes,
|
|
108
108
|
offloaded,
|
|
109
109
|
resultKind: completed.resultKind,
|
|
110
110
|
});
|
|
@@ -123,11 +123,14 @@ function isAggregateOffloadEligible(toolName, result) {
|
|
|
123
123
|
|
|
124
124
|
function rankAggregateOffloadCandidates(entries) {
|
|
125
125
|
return entries
|
|
126
|
-
.map((entry, index) =>
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
126
|
+
.map((entry, index) => {
|
|
127
|
+
const length = offloadableTextLength(entry?.result);
|
|
128
|
+
return {
|
|
129
|
+
index,
|
|
130
|
+
length,
|
|
131
|
+
eligible: isAggregateOffloadEligible(entry?.toolName, entry?.result) && length > 0,
|
|
132
|
+
};
|
|
133
|
+
})
|
|
131
134
|
.filter((entry) => entry.eligible)
|
|
132
135
|
.sort((a, b) => b.length - a.length || b.index - a.index)
|
|
133
136
|
.map((entry) => entry.index);
|
|
@@ -238,7 +241,9 @@ export function persistToolResultArtifactSync({ sessionId, toolCallId, channel =
|
|
|
238
241
|
try {
|
|
239
242
|
if (fd !== undefined) closeSync(fd);
|
|
240
243
|
} catch {
|
|
241
|
-
|
|
244
|
+
// The artifact is already written and byte-verified above; a failed
|
|
245
|
+
// descriptor close is cleanup, not a failed persist, and must never
|
|
246
|
+
// replace the verified meta this function returns.
|
|
242
247
|
}
|
|
243
248
|
}
|
|
244
249
|
}
|
|
@@ -274,7 +279,8 @@ async function persistToolResultArtifact({ sessionId, toolCallId, channel = 'res
|
|
|
274
279
|
try {
|
|
275
280
|
await handle?.close();
|
|
276
281
|
} catch {
|
|
277
|
-
|
|
282
|
+
// See persistToolResultArtifactSync: the verified artifact stands even
|
|
283
|
+
// when releasing the handle fails, so cleanup never nulls the result.
|
|
278
284
|
}
|
|
279
285
|
}
|
|
280
286
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Key-sorted JSON, used purely as hash input: the same value must serialize to
|
|
2
|
+
// the same bytes in every process, so object key order can never leak into a
|
|
3
|
+
// prompt-cache key or a trace fingerprint. Kept deliberately minimal — cycles
|
|
4
|
+
// and other JSON.stringify refusals throw here and are caught by the hashers.
|
|
5
|
+
export function stableHashStringify(value) {
|
|
6
|
+
if (value === null || typeof value !== 'object') return JSON.stringify(value);
|
|
7
|
+
if (Array.isArray(value)) return `[${value.map((item) => stableHashStringify(item)).join(',')}]`;
|
|
8
|
+
const keys = Object.keys(value).sort();
|
|
9
|
+
return `{${keys.map((key) => `${JSON.stringify(key)}:${stableHashStringify(value[key])}`).join(',')}}`;
|
|
10
|
+
}
|
|
@@ -398,8 +398,6 @@ function coercePatternStringValues(v) {
|
|
|
398
398
|
return Array.isArray(v) ? v.map(coerce) : coerce(v);
|
|
399
399
|
}
|
|
400
400
|
|
|
401
|
-
// ---- per-tool guards ----
|
|
402
|
-
|
|
403
401
|
function guardGrep(a) {
|
|
404
402
|
for (const key of ['include_noise', 'text']) {
|
|
405
403
|
if (hasOwn(a, key) && typeof a[key] !== 'boolean') {
|
|
@@ -660,17 +658,14 @@ function guardRead(a) {
|
|
|
660
658
|
const publicError = normalizePublicReadTargets(a);
|
|
661
659
|
if (publicError) return publicError;
|
|
662
660
|
// Public targets are normalized above; legacy callers already use path.
|
|
663
|
-
|
|
664
|
-
if (!hasPath) {
|
|
661
|
+
if (!hasOwn(a, 'path')) {
|
|
665
662
|
return 'Error: read requires "path" (or alias file_path).';
|
|
666
663
|
}
|
|
667
664
|
// Some providers/models send a batched path array as a JSON string despite
|
|
668
665
|
// the schema (or path:"[]" meaning cwd). The executor coerces via
|
|
669
666
|
// coerceReadFamilyPathArg(); mirror that here so validation does not reject
|
|
670
667
|
// shapes the executor would absorb.
|
|
671
|
-
|
|
672
|
-
a.path = coerceReadFamilyPathArg(a.path);
|
|
673
|
-
}
|
|
668
|
+
a.path = coerceReadFamilyPathArg(a.path);
|
|
674
669
|
absorbReadEchoedPathInteger(a, 'offset');
|
|
675
670
|
absorbReadEchoedPathInteger(a, 'limit');
|
|
676
671
|
// Absorb: parallel/JSON-stringified offset+limit arrays paired with a
|
|
@@ -685,39 +680,36 @@ function guardRead(a) {
|
|
|
685
680
|
}
|
|
686
681
|
}
|
|
687
682
|
// path can be string | string[] | object[]; file_path is string
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
683
|
+
const p = a.path;
|
|
684
|
+
if (typeof p !== 'string' && !(Array.isArray(p) && p.length > 0)) {
|
|
685
|
+
return `Error: read arg "path" must be string, string[], or object[] (got ${describeType(p)})`;
|
|
686
|
+
}
|
|
687
|
+
if (Array.isArray(p)) {
|
|
688
|
+
// Absorb: a region array ({path,offset,limit}[]) carries its window
|
|
689
|
+
// per-entry; a top-level offset/limit becomes the default for any
|
|
690
|
+
// region missing its own window, then the top-level keys are dropped
|
|
691
|
+
// so they don't double-apply in the plain-read checks below.
|
|
692
|
+
const hasRegionObj = p.some((e) => e && typeof e === 'object' && !Array.isArray(e));
|
|
693
|
+
if (hasRegionObj && (isPresent(a, 'offset') || isPresent(a, 'limit'))) {
|
|
694
|
+
for (const e of p) {
|
|
695
|
+
if (!e || typeof e !== 'object' || Array.isArray(e)) continue;
|
|
696
|
+
if (isPresent(a, 'offset') && !isPresent(e, 'offset')) e.offset = a.offset;
|
|
697
|
+
if (isPresent(a, 'limit') && !isPresent(e, 'limit')) e.limit = a.limit;
|
|
698
|
+
}
|
|
699
|
+
delete a.offset;
|
|
700
|
+
delete a.limit;
|
|
693
701
|
}
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
const hasRegionObj = p.some((e) => e && typeof e === 'object' && !Array.isArray(e));
|
|
700
|
-
if (hasRegionObj && (isPresent(a, 'offset') || isPresent(a, 'limit'))) {
|
|
701
|
-
for (const e of p) {
|
|
702
|
-
if (!e || typeof e !== 'object' || Array.isArray(e)) continue;
|
|
703
|
-
if (isPresent(a, 'offset') && !isPresent(e, 'offset')) e.offset = a.offset;
|
|
704
|
-
if (isPresent(a, 'limit') && !isPresent(e, 'limit')) e.limit = a.limit;
|
|
705
|
-
}
|
|
706
|
-
delete a.offset;
|
|
707
|
-
delete a.limit;
|
|
702
|
+
for (let i = 0; i < p.length; i++) {
|
|
703
|
+
const entry = p[i];
|
|
704
|
+
if (typeof entry === 'string') continue;
|
|
705
|
+
if (!entry || typeof entry !== 'object' || Array.isArray(entry)) {
|
|
706
|
+
return `Error: read arg "path[${i}]" must be string or {path,offset,limit} object (got ${describeType(entry)})`;
|
|
708
707
|
}
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
}
|
|
715
|
-
const err = applyLineContextWindow(entry, `path[${i}].`);
|
|
716
|
-
if (err) return err;
|
|
717
|
-
for (const ek of ['offset', 'limit']) {
|
|
718
|
-
const eErr = checkIntInRange(entry, ek, 0, MAX_INT);
|
|
719
|
-
if (eErr) return eErr.replace(`"${ek}"`, `"path[${i}].${ek}"`);
|
|
720
|
-
}
|
|
708
|
+
const err = applyLineContextWindow(entry, `path[${i}].`);
|
|
709
|
+
if (err) return err;
|
|
710
|
+
for (const ek of ['offset', 'limit']) {
|
|
711
|
+
const eErr = checkIntInRange(entry, ek, 0, MAX_INT);
|
|
712
|
+
if (eErr) return eErr.replace(`"${ek}"`, `"path[${i}].${ek}"`);
|
|
721
713
|
}
|
|
722
714
|
}
|
|
723
715
|
}
|
|
@@ -820,6 +812,23 @@ function guardTask(a) {
|
|
|
820
812
|
return null;
|
|
821
813
|
}
|
|
822
814
|
|
|
815
|
+
// head_limit is spelled identically for list/find/glob: coerce a numeric
|
|
816
|
+
// string in place, then validate. 0 is the valid "no cap" sentinel; a negative
|
|
817
|
+
// value is nonsensical and downstream produces a degenerate window (clamps to
|
|
818
|
+
// 0 → empty).
|
|
819
|
+
function checkHeadLimit(a, toolName) {
|
|
820
|
+
if (!hasOwn(a, 'head_limit') || a.head_limit === undefined || a.head_limit === null) return null;
|
|
821
|
+
const coerced = coerceIntegerString(a.head_limit);
|
|
822
|
+
if (coerced !== null) a.head_limit = coerced;
|
|
823
|
+
if (!isFiniteInt(a.head_limit)) {
|
|
824
|
+
return `Error: ${toolName} arg "limit" must be a finite integer (got ${describeType(a.head_limit)})`;
|
|
825
|
+
}
|
|
826
|
+
if (a.head_limit < 0) {
|
|
827
|
+
return `Error: ${toolName} arg "limit" must be >= 0 (0 means no cap); got ${a.head_limit}`;
|
|
828
|
+
}
|
|
829
|
+
return null;
|
|
830
|
+
}
|
|
831
|
+
|
|
823
832
|
function guardList(a) {
|
|
824
833
|
if (hasOwn(a, 'path') && !isString(a.path)) {
|
|
825
834
|
return `Error: list arg "path" must be string (got ${describeType(a.path)})`;
|
|
@@ -842,19 +851,7 @@ function guardList(a) {
|
|
|
842
851
|
return `Error: list arg "offset" must be a non-negative integer (got ${describeType(a.offset)})`;
|
|
843
852
|
}
|
|
844
853
|
}
|
|
845
|
-
|
|
846
|
-
const coerced = coerceIntegerString(a.head_limit);
|
|
847
|
-
if (coerced !== null) a.head_limit = coerced;
|
|
848
|
-
if (!isFiniteInt(a.head_limit)) {
|
|
849
|
-
return `Error: list arg "limit" must be a finite integer (got ${describeType(a.head_limit)})`;
|
|
850
|
-
}
|
|
851
|
-
// 0 is the valid "no cap" sentinel; a negative value is nonsensical
|
|
852
|
-
// and downstream produces a degenerate window (clamps to 0 → empty).
|
|
853
|
-
if (a.head_limit < 0) {
|
|
854
|
-
return `Error: list arg "limit" must be >= 0 (0 means no cap); got ${a.head_limit}`;
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
return null;
|
|
854
|
+
return checkHeadLimit(a, 'list');
|
|
858
855
|
}
|
|
859
856
|
|
|
860
857
|
function guardFind(a) {
|
|
@@ -871,17 +868,7 @@ function guardFind(a) {
|
|
|
871
868
|
if (hasOwn(a, 'include_noise') && typeof a.include_noise !== 'boolean') {
|
|
872
869
|
return `Error: find arg "include_noise" must be a boolean (got ${describeType(a.include_noise)})`;
|
|
873
870
|
}
|
|
874
|
-
|
|
875
|
-
const coerced = coerceIntegerString(a.head_limit);
|
|
876
|
-
if (coerced !== null) a.head_limit = coerced;
|
|
877
|
-
if (!isFiniteInt(a.head_limit)) {
|
|
878
|
-
return `Error: find arg "limit" must be a finite integer (got ${describeType(a.head_limit)})`;
|
|
879
|
-
}
|
|
880
|
-
if (a.head_limit < 0) {
|
|
881
|
-
return `Error: find arg "limit" must be >= 0 (0 means no cap); got ${a.head_limit}`;
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
return null;
|
|
871
|
+
return checkHeadLimit(a, 'find');
|
|
885
872
|
}
|
|
886
873
|
|
|
887
874
|
function guardGlob(a) {
|
|
@@ -926,19 +913,7 @@ function guardGlob(a) {
|
|
|
926
913
|
return `Error: glob arg "sort" must be one of natural|mtime (got ${JSON.stringify(a.sort)})`;
|
|
927
914
|
}
|
|
928
915
|
}
|
|
929
|
-
|
|
930
|
-
const coerced = coerceIntegerString(a.head_limit);
|
|
931
|
-
if (coerced !== null) a.head_limit = coerced;
|
|
932
|
-
if (!isFiniteInt(a.head_limit)) {
|
|
933
|
-
return `Error: glob arg "limit" must be a finite integer (got ${describeType(a.head_limit)})`;
|
|
934
|
-
}
|
|
935
|
-
// 0 is the valid "no cap" sentinel; a negative value is nonsensical
|
|
936
|
-
// and downstream produces a degenerate window (clamps to 0 → empty).
|
|
937
|
-
if (a.head_limit < 0) {
|
|
938
|
-
return `Error: glob arg "limit" must be >= 0 (0 means no cap); got ${a.head_limit}`;
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
return null;
|
|
916
|
+
return checkHeadLimit(a, 'glob');
|
|
942
917
|
}
|
|
943
918
|
|
|
944
919
|
// Valid code_graph modes — mirrors the enum in code-graph-tool-defs.mjs.
|
|
@@ -214,7 +214,8 @@ export const BUILTIN_TOOLS = [
|
|
|
214
214
|
output: {
|
|
215
215
|
type: 'string',
|
|
216
216
|
enum: ['new', 'tail'],
|
|
217
|
-
description:
|
|
217
|
+
description:
|
|
218
|
+
'read/wait only. Default new; tail replays recent output after an interruption or context loss. Up to 8 KiB per stream while running, 12 KiB on completion or replay; original logs are preserved.',
|
|
218
219
|
},
|
|
219
220
|
},
|
|
220
221
|
required: ['action'],
|
|
@@ -232,37 +232,38 @@ export async function runResultCacheInFlight(key, compute, options = {}) {
|
|
|
232
232
|
return subscribeResultCacheInFlight(entry, subscriberSignal);
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
235
|
+
// A concurrent caller joins the read already in flight for this key instead
|
|
236
|
+
// of issuing a second syscall; a mutation bumps the path generation, so an
|
|
237
|
+
// entry recorded before it is never joined.
|
|
238
|
+
async function runInFlightForGeneration(inFlight, key, generation, start) {
|
|
239
|
+
const existing = inFlight.get(key);
|
|
239
240
|
if (existing?.generation === generation) return await existing.promise;
|
|
240
241
|
const promise = Promise.resolve()
|
|
241
|
-
.then(
|
|
242
|
+
.then(start)
|
|
242
243
|
.finally(() => {
|
|
243
|
-
if (
|
|
244
|
-
|
|
244
|
+
if (inFlight.get(key)?.promise === promise) {
|
|
245
|
+
inFlight.delete(key);
|
|
245
246
|
}
|
|
246
247
|
});
|
|
247
|
-
|
|
248
|
+
inFlight.set(key, { generation, promise });
|
|
248
249
|
return await promise;
|
|
249
250
|
}
|
|
250
251
|
|
|
252
|
+
export async function runRawContentInFlight(fullPath, loader = fsPromises.readFile) {
|
|
253
|
+
const key = canonicalCachePath(fullPath);
|
|
254
|
+
return await runInFlightForGeneration(RAW_CONTENT_INFLIGHT, key, getPathMutationGeneration(key), () =>
|
|
255
|
+
loader(fullPath)
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
|
|
251
259
|
export async function runReadOnlyStatInFlight(fullPath, loader = fsPromises.stat, kind = 'stat') {
|
|
252
260
|
const canonicalPath = canonicalCachePath(fullPath);
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
.finally(() => {
|
|
260
|
-
if (READ_ONLY_STAT_INFLIGHT.get(key)?.promise === promise) {
|
|
261
|
-
READ_ONLY_STAT_INFLIGHT.delete(key);
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
READ_ONLY_STAT_INFLIGHT.set(key, { generation, promise });
|
|
265
|
-
return await promise;
|
|
261
|
+
return await runInFlightForGeneration(
|
|
262
|
+
READ_ONLY_STAT_INFLIGHT,
|
|
263
|
+
`${kind}|${canonicalPath}`,
|
|
264
|
+
getPathMutationGeneration(canonicalPath),
|
|
265
|
+
() => loader(fullPath)
|
|
266
|
+
);
|
|
266
267
|
}
|
|
267
268
|
|
|
268
269
|
function rawContentCacheDelete(key) {
|
|
@@ -321,7 +321,6 @@ function applyFileQuoteStyle(actualSpan, replacement) {
|
|
|
321
321
|
return out.join('');
|
|
322
322
|
}
|
|
323
323
|
|
|
324
|
-
// ---------------------------------------------------------------------------
|
|
325
324
|
// Encoding / line-ending fidelity (Windows-first).
|
|
326
325
|
//
|
|
327
326
|
// The edit path used to decode every target as UTF-8 and hand the native
|
|
@@ -331,7 +330,6 @@ function applyFileQuoteStyle(actualSpan, replacement) {
|
|
|
331
330
|
// the file's BOM decides the codec, the file's dominant EOL decides the line
|
|
332
331
|
// endings of old_string/new_string, and non-UTF-8 targets are edited in-process
|
|
333
332
|
// (the native engine's payload is UTF-8 by protocol) and re-encoded in place.
|
|
334
|
-
// ---------------------------------------------------------------------------
|
|
335
333
|
const UTF8_BOM_BYTES = Buffer.from([0xef, 0xbb, 0xbf]);
|
|
336
334
|
const UTF16LE_BOM_BYTES = Buffer.from([0xff, 0xfe]);
|
|
337
335
|
const UTF16BE_BOM_BYTES = Buffer.from([0xfe, 0xff]);
|
|
@@ -40,7 +40,10 @@ const ALWAYS_READ = new Set([
|
|
|
40
40
|
]);
|
|
41
41
|
|
|
42
42
|
const SHELL_OPERATOR_CHARS = '|&;<>()';
|
|
43
|
-
|
|
43
|
+
// `git --version` / `-v` / `--help` / `-h` arrive in global-flag position; both
|
|
44
|
+
// the policy classifier and the git tool fold them onto their subcommand form,
|
|
45
|
+
// so the mapping is shared to keep the two from drifting apart.
|
|
46
|
+
export const OPERATION_ALIASES = new Map([
|
|
44
47
|
['--version', 'version'],
|
|
45
48
|
['-v', 'version'],
|
|
46
49
|
['--help', 'help'],
|
|
@@ -94,7 +97,7 @@ export function commandHasShellSyntax(command) {
|
|
|
94
97
|
return quote !== null;
|
|
95
98
|
}
|
|
96
99
|
|
|
97
|
-
|
|
100
|
+
function gitActionOf(operation, args) {
|
|
98
101
|
const first = args.find((value) => value && !value.startsWith('-'));
|
|
99
102
|
if (operation === 'stash') return first || 'push';
|
|
100
103
|
if (operation === 'worktree') return first || 'list';
|
|
@@ -151,42 +154,56 @@ export function gitPlanIsReadOnly(plan) {
|
|
|
151
154
|
return false;
|
|
152
155
|
}
|
|
153
156
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
157
|
+
const GIT_GLOBAL_VALUE_FLAGS = ['-c', '--config-env', '--git-dir', '--work-tree', '--namespace'];
|
|
158
|
+
const GIT_GLOBAL_BARE_FLAGS = [
|
|
159
|
+
'--no-pager',
|
|
160
|
+
'--paginate',
|
|
161
|
+
'--bare',
|
|
162
|
+
'--literal-pathspecs',
|
|
163
|
+
'--glob-pathspecs',
|
|
164
|
+
'--noglob-pathspecs',
|
|
165
|
+
'--icase-pathspecs',
|
|
166
|
+
];
|
|
167
|
+
|
|
168
|
+
// git's global flags sit between `git` and the subcommand, and every consumer
|
|
169
|
+
// has to step over exactly the same set to find that subcommand. Returns its
|
|
170
|
+
// index; the optional handlers let a caller capture what it skipped (the git
|
|
171
|
+
// tool keeps `-C` as its cwd and the rest as global args, and rejects a
|
|
172
|
+
// missing value) while a pure scan passes none.
|
|
173
|
+
export function skipGitGlobalFlags(tokens, { onChdir, onValueFlag, onBareFlag } = {}) {
|
|
158
174
|
let index = 1;
|
|
159
175
|
while (index < tokens.length) {
|
|
160
176
|
const token = tokens[index];
|
|
161
|
-
if (
|
|
162
|
-
|
|
163
|
-
token === '-c' ||
|
|
164
|
-
token === '--config-env' ||
|
|
165
|
-
token === '--git-dir' ||
|
|
166
|
-
token === '--work-tree' ||
|
|
167
|
-
token === '--namespace'
|
|
168
|
-
) {
|
|
177
|
+
if (token === '-C') {
|
|
178
|
+
onChdir?.(tokens[index + 1]);
|
|
169
179
|
index += 2;
|
|
170
180
|
continue;
|
|
171
181
|
}
|
|
172
|
-
if (
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
) {
|
|
182
|
+
if (/^-C.+/.test(token)) {
|
|
183
|
+
onChdir?.(token.slice(2));
|
|
184
|
+
index++;
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
if (GIT_GLOBAL_VALUE_FLAGS.includes(token)) {
|
|
188
|
+
onValueFlag?.(token, tokens[index + 1]);
|
|
189
|
+
index += 2;
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
if (/^--(?:git-dir|work-tree|namespace|config-env)=/.test(token) || GIT_GLOBAL_BARE_FLAGS.includes(token)) {
|
|
193
|
+
onBareFlag?.(token);
|
|
185
194
|
index++;
|
|
186
195
|
continue;
|
|
187
196
|
}
|
|
188
197
|
break;
|
|
189
198
|
}
|
|
199
|
+
return index;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function parsedGitOperation(command) {
|
|
203
|
+
if (commandHasShellSyntax(command)) return null;
|
|
204
|
+
const tokens = tokenizeDirectArgv(command);
|
|
205
|
+
if (!tokens?.length || !/(^|[\\/])git(?:\.exe)?$/i.test(tokens[0])) return null;
|
|
206
|
+
const index = skipGitGlobalFlags(tokens);
|
|
190
207
|
const rawOperation = String(tokens[index] || '').toLowerCase();
|
|
191
208
|
const operation = OPERATION_ALIASES.get(rawOperation) ?? rawOperation;
|
|
192
209
|
return operation ? { operation, args: tokens.slice(index + 1) } : null;
|
|
@@ -12,6 +12,8 @@ import { ensureNativeSpawnServer, tryNativeSpawn } from '../lib/native-spawn-cli
|
|
|
12
12
|
import {
|
|
13
13
|
commandHasShellSyntax,
|
|
14
14
|
gitPlanIsReadOnly as isReadOnly,
|
|
15
|
+
OPERATION_ALIASES,
|
|
16
|
+
skipGitGlobalFlags,
|
|
15
17
|
} from './git-command-policy.mjs';
|
|
16
18
|
import {
|
|
17
19
|
buildSelectedStagePatch,
|
|
@@ -58,12 +60,6 @@ const SERVER_OPERATIONS = new Set(['daemon', 'instaweb']);
|
|
|
58
60
|
// These answer anywhere: demanding a repository first turned an availability
|
|
59
61
|
// probe into `git rev-parse exited 128` inside a plain directory.
|
|
60
62
|
const REPO_FREE_OPERATIONS = new Set(['version', 'help']);
|
|
61
|
-
const OPERATION_ALIASES = new Map([
|
|
62
|
-
['--version', 'version'],
|
|
63
|
-
['-v', 'version'],
|
|
64
|
-
['--help', 'help'],
|
|
65
|
-
['-h', 'help'],
|
|
66
|
-
]);
|
|
67
63
|
|
|
68
64
|
export const GIT_TOOL_DEF = {
|
|
69
65
|
name: 'git',
|
|
@@ -102,7 +98,8 @@ export const GIT_TOOL_DEF = {
|
|
|
102
98
|
},
|
|
103
99
|
include_stage_ids: {
|
|
104
100
|
type: 'boolean',
|
|
105
|
-
description:
|
|
101
|
+
description:
|
|
102
|
+
'Include staging IDs outside the body cap for git diff or git diff -- <paths> only. Default false.',
|
|
106
103
|
},
|
|
107
104
|
diff_id: { type: 'string', description: 'stage: exact diff_id from git diff with include_stage_ids:true.' },
|
|
108
105
|
change_ids: {
|
|
@@ -173,7 +170,8 @@ function stageableDiffResult(plan, result, snapshot, limit) {
|
|
|
173
170
|
rendered.text = appendText(rendered.text, `file: ${JSON.stringify(change.path)}`);
|
|
174
171
|
previousPath = change.path;
|
|
175
172
|
}
|
|
176
|
-
const location =
|
|
173
|
+
const location =
|
|
174
|
+
change.kind || `@@ -${change.old_start},${change.deletions} +${change.new_start},${change.additions} @@`;
|
|
177
175
|
rendered.text = appendText(rendered.text, `change:${change.id} ${location}`);
|
|
178
176
|
}
|
|
179
177
|
return rendered;
|
|
@@ -206,52 +204,19 @@ function parseCommand(rawCommand, workDir) {
|
|
|
206
204
|
}
|
|
207
205
|
let cwd = resolve(workDir || process.cwd());
|
|
208
206
|
const globalArgs = [];
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
const token = tokens[index];
|
|
212
|
-
if (token === '-C') {
|
|
213
|
-
const path = tokens[++index];
|
|
207
|
+
const index = skipGitGlobalFlags(tokens, {
|
|
208
|
+
onChdir: (path) => {
|
|
214
209
|
if (!path) throw new Error('git -C requires a path');
|
|
215
210
|
cwd = resolve(cwd, path);
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
219
|
-
if (token.startsWith('-C') && token.length > 2) {
|
|
220
|
-
cwd = resolve(cwd, token.slice(2));
|
|
221
|
-
index++;
|
|
222
|
-
continue;
|
|
223
|
-
}
|
|
224
|
-
if (
|
|
225
|
-
token === '-c' ||
|
|
226
|
-
token === '--config-env' ||
|
|
227
|
-
token === '--git-dir' ||
|
|
228
|
-
token === '--work-tree' ||
|
|
229
|
-
token === '--namespace'
|
|
230
|
-
) {
|
|
231
|
-
const value = tokens[index + 1];
|
|
211
|
+
},
|
|
212
|
+
onValueFlag: (token, value) => {
|
|
232
213
|
if (!value) throw new Error(`${token} requires a value`);
|
|
233
214
|
globalArgs.push(token, value);
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}
|
|
237
|
-
if (
|
|
238
|
-
/^--(?:git-dir|work-tree|namespace|config-env)=/.test(token) ||
|
|
239
|
-
[
|
|
240
|
-
'--no-pager',
|
|
241
|
-
'--paginate',
|
|
242
|
-
'--bare',
|
|
243
|
-
'--literal-pathspecs',
|
|
244
|
-
'--glob-pathspecs',
|
|
245
|
-
'--noglob-pathspecs',
|
|
246
|
-
'--icase-pathspecs',
|
|
247
|
-
].includes(token)
|
|
248
|
-
) {
|
|
215
|
+
},
|
|
216
|
+
onBareFlag: (token) => {
|
|
249
217
|
globalArgs.push(token);
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}
|
|
253
|
-
break;
|
|
254
|
-
}
|
|
218
|
+
},
|
|
219
|
+
});
|
|
255
220
|
const rawOperation = String(tokens[index] || '').toLowerCase();
|
|
256
221
|
const operation = OPERATION_ALIASES.get(rawOperation) ?? rawOperation;
|
|
257
222
|
if (!operation) throw new Error('git requires a subcommand');
|
|
@@ -413,13 +378,30 @@ async function runStageableDiff(plan, argv, repo, signal) {
|
|
|
413
378
|
result.stdout = String(result.stdout);
|
|
414
379
|
result.stderr = String(result.stderr);
|
|
415
380
|
const paths = plan.args.slice(1);
|
|
416
|
-
const untracked = await runGit(
|
|
381
|
+
const untracked = await runGit(
|
|
382
|
+
plan,
|
|
383
|
+
['ls-files', '--others', '--exclude-standard', '--full-name', '-z', '--', ...paths],
|
|
384
|
+
{ signal }
|
|
385
|
+
);
|
|
417
386
|
if (!succeeded(untracked)) return untracked;
|
|
418
387
|
for (const path of String(untracked.stdout).split('\0').filter(Boolean)) {
|
|
419
|
-
const added = await runGit(
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
388
|
+
const added = await runGit(
|
|
389
|
+
{ ...plan, cwd: repo },
|
|
390
|
+
[
|
|
391
|
+
'diff',
|
|
392
|
+
'--no-index',
|
|
393
|
+
'--binary',
|
|
394
|
+
'--no-ext-diff',
|
|
395
|
+
'--no-textconv',
|
|
396
|
+
'--no-color',
|
|
397
|
+
'--src-prefix=a/',
|
|
398
|
+
'--dst-prefix=b/',
|
|
399
|
+
'--',
|
|
400
|
+
'/dev/null',
|
|
401
|
+
path,
|
|
402
|
+
],
|
|
403
|
+
{ signal }
|
|
404
|
+
);
|
|
423
405
|
// --no-index uses exit 1 for a successfully produced patch.
|
|
424
406
|
if (!succeeded({ ...added, exitCode: added.exitCode === 1 ? 0 : added.exitCode })) return added;
|
|
425
407
|
result.stdout = appendText(result.stdout, String(added.stdout));
|
|
@@ -15,7 +15,7 @@ function decodePath(path) {
|
|
|
15
15
|
const bytes = [];
|
|
16
16
|
for (const token of path.slice(1, -1).matchAll(/\\([0-7]{1,3}|.)|[^\\]+/g)) {
|
|
17
17
|
if (token[1] && /^[0-7]/.test(token[1])) bytes.push(Buffer.from([Number.parseInt(token[1], 8)]));
|
|
18
|
-
else bytes.push(Buffer.from(token[1] ? escapes[token[1]] ?? token[1] : token[0]));
|
|
18
|
+
else bytes.push(Buffer.from(token[1] ? (escapes[token[1]] ?? token[1]) : token[0]));
|
|
19
19
|
}
|
|
20
20
|
path = Buffer.concat(bytes).toString('utf8');
|
|
21
21
|
}
|
|
@@ -45,9 +45,7 @@ function finishFile(files, file) {
|
|
|
45
45
|
const pathLine = file.newLine === '+++ /dev/null' ? file.oldLine : file.newLine;
|
|
46
46
|
if (pathLine) file.path = decodePath(pathLine.slice(4).replace(/\t$/, ''));
|
|
47
47
|
file.stageable = Boolean(
|
|
48
|
-
file.diffLine &&
|
|
49
|
-
!file.blocked &&
|
|
50
|
-
(file.kind || (file.oldLine && file.newLine && file.hunks.length))
|
|
48
|
+
file.diffLine && !file.blocked && (file.kind || (file.oldLine && file.newLine && file.hunks.length))
|
|
51
49
|
);
|
|
52
50
|
files.push(file);
|
|
53
51
|
}
|
|
@@ -94,7 +92,12 @@ function parseFiles(raw) {
|
|
|
94
92
|
if (line.startsWith('--- ')) file.oldLine = line;
|
|
95
93
|
else if (line.startsWith('+++ ')) file.newLine = line;
|
|
96
94
|
else if (line.startsWith('new file mode ')) file.kind = 'new_file';
|
|
97
|
-
else if (
|
|
95
|
+
else if (
|
|
96
|
+
/^(deleted file mode |old mode |new mode |similarity index |rename from |rename to |copy from |copy to |GIT binary patch)/.test(
|
|
97
|
+
line
|
|
98
|
+
)
|
|
99
|
+
)
|
|
100
|
+
file.kind ||= 'file';
|
|
98
101
|
else if (line.startsWith('Binary files ')) file.blocked = true;
|
|
99
102
|
}
|
|
100
103
|
finishFile(files, file);
|
|
@@ -468,11 +468,7 @@ function renderFocusedContext(selected, sources, span, budget, notice) {
|
|
|
468
468
|
const anchors = compact.length
|
|
469
469
|
? `\n# Additional matches\n${compact.map((anchor) => `${anchor.path}:${anchor.lineNo}:${compactAnchorContent(anchor.content)} [${anchorRangeHint(anchor, span)}]`).join('\n')}`
|
|
470
470
|
: '';
|
|
471
|
-
const summary = compact.length
|
|
472
|
-
? notice
|
|
473
|
-
? notice.replace(/\]$/, `; ${rawBlocks.length} source spans, rest as path:line anchors]`)
|
|
474
|
-
: `\n[${rawBlocks.length} of ${ordered.length} shown; rest as path:line anchors]`
|
|
475
|
-
: notice;
|
|
471
|
+
const summary = compact.length ? anchorOverflowSummary(notice, rawBlocks.length, ordered.length) : notice;
|
|
476
472
|
const text = `${raw}${anchors}${summary}`;
|
|
477
473
|
return {
|
|
478
474
|
text,
|
|
@@ -481,6 +477,13 @@ function renderFocusedContext(selected, sources, span, budget, notice) {
|
|
|
481
477
|
};
|
|
482
478
|
}
|
|
483
479
|
|
|
480
|
+
// The overflow note extends an existing budget notice, or stands alone when the
|
|
481
|
+
// output was not otherwise trimmed.
|
|
482
|
+
function anchorOverflowSummary(notice, rawCount, totalCount) {
|
|
483
|
+
if (notice) return notice.replace(/\]$/, `; ${rawCount} source spans, rest as path:line anchors]`);
|
|
484
|
+
return `\n[${rawCount} of ${totalCount} shown; rest as path:line anchors]`;
|
|
485
|
+
}
|
|
486
|
+
|
|
484
487
|
export async function expandGrepAnchorContextOutput({
|
|
485
488
|
allLines,
|
|
486
489
|
workDir,
|