mixdog 0.9.173 → 0.9.174
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 +2 -2
- package/scripts/build-tui.mjs +32 -9
- package/scripts/computer-task-cost-report.mjs +4 -11
- package/scripts/graph-parity.mjs +2 -8
- package/scripts/lib/changed-tests.mjs +104 -0
- package/scripts/lib/cli-args.mjs +43 -0
- package/scripts/lib/cli-args.test.mjs +64 -0
- package/scripts/lib/embedding-model-bench-core.mjs +0 -7
- package/scripts/lib/run-node-tests.mjs +35 -2
- package/scripts/lib/trace-stats.mjs +38 -0
- package/scripts/lib/trace-stats.test.mjs +56 -0
- package/scripts/llm-trace-summary.mjs +2 -34
- package/scripts/native-tool-download.mjs +5 -0
- package/scripts/office/author-deck.mjs +8 -14
- package/scripts/patch-replay.mjs +1 -11
- package/scripts/perf/transcript-runtime-probe.mjs +2 -2
- package/scripts/pptx-kit-index.mjs +157 -0
- package/scripts/prepare-native-assets.mjs +4 -6
- package/scripts/routing-corpus.mjs +1 -11
- package/scripts/session-diag.mjs +2 -34
- package/scripts/suite-health.mjs +4 -0
- package/scripts/test.mjs +32 -2
- package/scripts/tidy/sync-engines-manifest.mjs +42 -9
- package/scripts/tool-failures.mjs +1 -8
- package/scripts/tool-stress.mjs +4 -8
- package/scripts/verify-release-assets.mjs +24 -7
- package/src/agents/reviewer/AGENT.md +2 -1
- package/src/agents/security/AGENT.md +2 -1
- package/src/defaults/agents.json +3 -3
- package/src/defaults/skills/browser-use/SKILL.md +67 -14
- package/src/defaults/skills/code-tidy/SKILL.md +37 -33
- package/src/defaults/skills/code-tidy/references/agent-cleanup.md +8 -119
- package/src/defaults/skills/code-tidy/references/cleanup-report.md +88 -0
- package/src/defaults/skills/code-tidy/references/dead-code.md +2 -7
- package/src/defaults/skills/code-tidy/references/test-suite-slop.md +31 -0
- package/src/defaults/skills/computer-use/SKILL.md +54 -33
- package/src/defaults/skills/docx/SKILL.md +5 -5
- package/src/defaults/skills/docx/references/native-authoring.md +86 -29
- package/src/defaults/skills/goal-management/SKILL.md +42 -21
- package/src/defaults/skills/image/SKILL.md +16 -16
- package/src/defaults/skills/local-provider/SKILL.md +1 -2
- package/src/defaults/skills/memory-management/SKILL.md +1 -2
- package/src/defaults/skills/pdf/SKILL.md +5 -5
- package/src/defaults/skills/pptx/SKILL.md +20 -14
- package/src/defaults/skills/pptx/references/charts.md +177 -28
- package/src/defaults/skills/pptx/references/composition.md +9 -9
- package/src/defaults/skills/pptx/references/direction.md +4 -4
- package/src/defaults/skills/pptx/references/html.md +108 -0
- package/src/defaults/skills/pptx/references/kit-index.md +839 -0
- package/src/defaults/skills/pptx/references/kit.md +239 -41
- package/src/defaults/skills/pptx/references/pictures.md +10 -2
- package/src/defaults/skills/pptx/references/review.md +0 -5
- package/src/defaults/skills/setup/SKILL.md +3 -2
- package/src/defaults/skills/setup/references/actions.md +16 -22
- package/src/defaults/skills/setup/references/surfaces.md +1 -2
- package/src/defaults/skills/skill-creator/SKILL.md +16 -19
- package/src/defaults/skills/skill-creator/references/design.md +13 -19
- package/src/defaults/skills/skill-creator/scripts/validate-skill.mjs +6 -2
- package/src/defaults/skills/video/SKILL.md +12 -13
- package/src/defaults/skills/xlsx/SKILL.md +9 -8
- package/src/defaults/skills/xlsx/references/model-conventions.md +1 -1
- package/src/defaults/skills/xlsx/references/report-design.md +14 -5
- package/src/lib/keychain-cjs.cjs +48 -69
- package/src/lib/rules-builder.cjs +1 -1
- package/src/repl/slash-commands.mjs +14 -2
- package/src/rules/agent/43-title-agent.md +1 -1
- package/src/rules/agent/AGENT.md +1 -1
- package/src/rules/lead/LEAD.md +3 -2
- package/src/rules/shared/05-tool-calls.md +11 -0
- package/src/rules/shared/10-tool-workflow.md +2 -3
- package/src/rules/shared/30-exploration.md +1 -2
- package/src/rules/shared/40-editing.md +1 -1
- package/src/rules/shared/45-destructive.md +3 -3
- package/src/rules/shared/70-delivery.md +5 -1
- package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch/turn.mjs +10 -14
- package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch.mjs +95 -95
- package/src/runtime/agent/orchestrator/agent-runtime/agent-progress-watchdog.mjs +19 -96
- package/src/runtime/agent/orchestrator/agent-runtime/cache-strategy.mjs +1 -4
- package/src/runtime/agent/orchestrator/agent-runtime/maintenance-route.mjs +1 -4
- package/src/runtime/agent/orchestrator/agent-runtime/session-builder.mjs +2 -20
- package/src/runtime/agent/orchestrator/agent-runtime/title-completion.mjs +3 -0
- package/src/runtime/agent/orchestrator/agent-trace-format.mjs +11 -8
- package/src/runtime/agent/orchestrator/agent-trace-io.mjs +2 -8
- package/src/runtime/agent/orchestrator/agent-trace.mjs +20 -20
- package/src/runtime/agent/orchestrator/cache-mtime.mjs +3 -1
- package/src/runtime/agent/orchestrator/config-storage.mjs +49 -51
- package/src/runtime/agent/orchestrator/config.mjs +10 -2
- package/src/runtime/agent/orchestrator/context/deferred-tools.mjs +9 -21
- package/src/runtime/agent/orchestrator/context/role-instructions.mjs +10 -6
- package/src/runtime/agent/orchestrator/context/skill-catalog.mjs +15 -32
- package/src/runtime/agent/orchestrator/internal-agents.mjs +26 -19
- package/src/runtime/agent/orchestrator/internal-tools.mjs +4 -4
- package/src/runtime/agent/orchestrator/mcp/child-tree.mjs +22 -37
- package/src/runtime/agent/orchestrator/mcp/client.mjs +48 -66
- package/src/runtime/agent/orchestrator/providers/anthropic-api-request.mjs +2 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-api-transport.mjs +23 -23
- package/src/runtime/agent/orchestrator/providers/anthropic-betas.mjs +8 -2
- package/src/runtime/agent/orchestrator/providers/anthropic-effort.mjs +19 -13
- package/src/runtime/agent/orchestrator/providers/anthropic-leaked-toolcall.mjs +0 -8
- package/src/runtime/agent/orchestrator/providers/anthropic-max-tokens.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/anthropic-messages.mjs +7 -27
- package/src/runtime/agent/orchestrator/providers/anthropic-midstream-recovery.mjs +74 -8
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-client-version.mjs +7 -1
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-credentials.mjs +26 -27
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-midstream.mjs +5 -1
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-request/gzip-post.mjs +9 -6
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-request.mjs +5 -2
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth.mjs +46 -101
- package/src/runtime/agent/orchestrator/providers/anthropic-recovery-guards.mjs +10 -3
- package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn/turn-events/content-block-delta.mjs +16 -1
- package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn/turn-events.mjs +10 -2
- package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn/turn-outcome.mjs +7 -3
- package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn/turn-state.mjs +4 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn.mjs +19 -2
- package/src/runtime/agent/orchestrator/providers/anthropic-sse.mjs +15 -3
- package/src/runtime/agent/orchestrator/providers/anthropic-thinking-contract.mjs +9 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-turn-result.mjs +1 -0
- package/src/runtime/agent/orchestrator/providers/anthropic.mjs +19 -33
- package/src/runtime/agent/orchestrator/providers/antigravity-oauth-login.mjs +1 -5
- package/src/runtime/agent/orchestrator/providers/antigravity-oauth.mjs +25 -32
- package/src/runtime/agent/orchestrator/providers/antigravity-transport.mjs +4 -8
- package/src/runtime/agent/orchestrator/providers/api-usage.mjs +6 -4
- package/src/runtime/agent/orchestrator/providers/codex-client-meta.mjs +17 -14
- package/src/runtime/agent/orchestrator/providers/compat-request-policy.mjs +14 -0
- package/src/runtime/agent/orchestrator/providers/cursor-auth.mjs +3 -3
- package/src/runtime/agent/orchestrator/providers/cursor-wire-exec.mjs +3 -2
- package/src/runtime/agent/orchestrator/providers/cursor-wire-guards.mjs +3 -33
- package/src/runtime/agent/orchestrator/providers/cursor-wire-interactions.mjs +20 -39
- package/src/runtime/agent/orchestrator/providers/cursor.mjs +2 -1
- package/src/runtime/agent/orchestrator/providers/custom-tool-wire.mjs +3 -34
- package/src/runtime/agent/orchestrator/providers/effort-configuration.mjs +5 -2
- package/src/runtime/agent/orchestrator/providers/gemini-cache.mjs +9 -11
- package/src/runtime/agent/orchestrator/providers/gemini-schema.mjs +8 -31
- package/src/runtime/agent/orchestrator/providers/gemini-sdk-request.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/gemini-stream.mjs +47 -12
- package/src/runtime/agent/orchestrator/providers/gemini.mjs +3 -3
- package/src/runtime/agent/orchestrator/providers/grok-oauth-tokens.mjs +9 -18
- package/src/runtime/agent/orchestrator/providers/grok-oauth.mjs +40 -43
- package/src/runtime/agent/orchestrator/providers/lib/anthropic-request-utils.mjs +5 -33
- package/src/runtime/agent/orchestrator/providers/lib/flat-schema-merge.mjs +37 -0
- package/src/runtime/agent/orchestrator/providers/lib/gemini-model-catalog.mjs +4 -4
- package/src/runtime/agent/orchestrator/providers/lib/quota-readings.mjs +24 -0
- package/src/runtime/agent/orchestrator/providers/media-normalization.mjs +63 -12
- package/src/runtime/agent/orchestrator/providers/model-catalog.mjs +62 -77
- package/src/runtime/agent/orchestrator/providers/model-list-sanitize.mjs +3 -0
- package/src/runtime/agent/orchestrator/providers/oauth-credential-probes.mjs +9 -15
- package/src/runtime/agent/orchestrator/providers/oauth-usage.mjs +2 -0
- package/src/runtime/agent/orchestrator/providers/openai-codex-metadata.mjs +13 -16
- package/src/runtime/agent/orchestrator/providers/openai-codex-model.mjs +10 -7
- package/src/runtime/agent/orchestrator/providers/openai-compat-chat-send.mjs +4 -29
- package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream/stream-result.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream/stream-state.mjs +6 -6
- package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream.mjs +4 -2
- package/src/runtime/agent/orchestrator/providers/openai-compat-response-normalization.mjs +23 -46
- package/src/runtime/agent/orchestrator/providers/openai-compat-responses-events.mjs +3 -12
- package/src/runtime/agent/orchestrator/providers/openai-compat-responses-state.mjs +9 -14
- package/src/runtime/agent/orchestrator/providers/openai-compat-responses.mjs +10 -30
- package/src/runtime/agent/orchestrator/providers/openai-compat-stream-common.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/openai-compat-stream.mjs +4 -4
- package/src/runtime/agent/orchestrator/providers/openai-compat-wire.mjs +2 -6
- package/src/runtime/agent/orchestrator/providers/openai-compat-xai-send.mjs +4 -24
- package/src/runtime/agent/orchestrator/providers/openai-compat-xai.mjs +13 -17
- package/src/runtime/agent/orchestrator/providers/openai-compat.mjs +24 -29
- package/src/runtime/agent/orchestrator/providers/openai-direct-request.mjs +11 -3
- package/src/runtime/agent/orchestrator/providers/openai-http-sse-request.mjs +3 -2
- package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-events.mjs +0 -2
- package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-outcome.mjs +5 -4
- package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-stamps.mjs +21 -8
- package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/text-relay.mjs +2 -8
- package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state.mjs +1 -2
- package/src/runtime/agent/orchestrator/providers/openai-oauth-catalog.mjs +8 -8
- package/src/runtime/agent/orchestrator/providers/openai-oauth-dispatch.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/openai-oauth-http-sse.mjs +4 -2
- package/src/runtime/agent/orchestrator/providers/openai-oauth.mjs +5 -8
- package/src/runtime/agent/orchestrator/providers/openai-responses-input.mjs +29 -7
- package/src/runtime/agent/orchestrator/providers/openai-responses-payload.mjs +3 -3
- package/src/runtime/agent/orchestrator/providers/openai-transport-policy.mjs +2 -6
- package/src/runtime/agent/orchestrator/providers/openai-turn-state.mjs +9 -11
- package/src/runtime/agent/orchestrator/providers/openai-ws-delta.mjs +20 -13
- package/src/runtime/agent/orchestrator/providers/openai-ws-pool.mjs +3 -2
- package/src/runtime/agent/orchestrator/providers/openai-ws-response-state/tool-calls.mjs +2 -4
- package/src/runtime/agent/orchestrator/providers/openai-ws-send-attempts/attempt-context.mjs +5 -2
- package/src/runtime/agent/orchestrator/providers/openai-ws-send-attempts/handshake-failure.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/openai-ws-send-attempts/stream-failure.mjs +9 -16
- package/src/runtime/agent/orchestrator/providers/openai-ws-send-attempts.mjs +0 -2
- package/src/runtime/agent/orchestrator/providers/openai-ws-send-outcome.mjs +14 -16
- package/src/runtime/agent/orchestrator/providers/openai-ws-stream/terminal-frames.mjs +0 -2
- package/src/runtime/agent/orchestrator/providers/openai-ws-stream.mjs +18 -23
- package/src/runtime/agent/orchestrator/providers/openai-ws-warmup.mjs +7 -13
- package/src/runtime/agent/orchestrator/providers/openai-ws.mjs +5 -16
- package/src/runtime/agent/orchestrator/providers/opencode-go-usage.mjs +3 -0
- package/src/runtime/agent/orchestrator/providers/opencode-go.mjs +1 -13
- package/src/runtime/agent/orchestrator/providers/provider-catalog-cache.mjs +3 -2
- package/src/runtime/agent/orchestrator/providers/provider-model-identities.mjs +6 -0
- package/src/runtime/agent/orchestrator/providers/registry.mjs +0 -24
- package/src/runtime/agent/orchestrator/providers/retry-backoff.mjs +3 -12
- package/src/runtime/agent/orchestrator/providers/retry-classification.mjs +132 -15
- package/src/runtime/agent/orchestrator/providers/retry-classifier.mjs +6 -12
- package/src/runtime/agent/orchestrator/providers/retry-executor.mjs +39 -0
- package/src/runtime/agent/orchestrator/providers/retry-midstream.mjs +16 -5
- package/src/runtime/agent/orchestrator/providers/statusline-route-meta.mjs +0 -7
- package/src/runtime/agent/orchestrator/providers/tool-stream-state.mjs +7 -6
- package/src/runtime/agent/orchestrator/session/cache/prefetch-cache.mjs +5 -8
- package/src/runtime/agent/orchestrator/session/cache/read-cache.mjs +2 -3
- package/src/runtime/agent/orchestrator/session/cache/scoped-cache.mjs +5 -102
- package/src/runtime/agent/orchestrator/session/compact/budget.mjs +3 -4
- package/src/runtime/agent/orchestrator/session/compact/constants.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/compact/execution-tail.mjs +148 -48
- package/src/runtime/agent/orchestrator/session/compact/json-byte-length.mjs +93 -0
- package/src/runtime/agent/orchestrator/session/compact/messages.mjs +1 -0
- package/src/runtime/agent/orchestrator/session/compact/observation-supersession.mjs +96 -0
- package/src/runtime/agent/orchestrator/session/compact/runner.mjs +33 -7
- package/src/runtime/agent/orchestrator/session/compact/summary-schema.mjs +23 -41
- package/src/runtime/agent/orchestrator/session/compact/summary.mjs +45 -33
- package/src/runtime/agent/orchestrator/session/compact/text-utils.mjs +2 -5
- package/src/runtime/agent/orchestrator/session/context-fingerprint.mjs +32 -1
- package/src/runtime/agent/orchestrator/session/context-tool-pairs.mjs +7 -7
- package/src/runtime/agent/orchestrator/session/context-utils.mjs +864 -109
- package/src/runtime/agent/orchestrator/session/eager-dispatch/admission.mjs +0 -1
- package/src/runtime/agent/orchestrator/session/eager-dispatch/entry.mjs +8 -7
- package/src/runtime/agent/orchestrator/session/explicit-skills.mjs +1 -4
- package/src/runtime/agent/orchestrator/session/image-strip-recovery.mjs +24 -15
- package/src/runtime/agent/orchestrator/session/loop/compact-debug.mjs +0 -14
- package/src/runtime/agent/orchestrator/session/loop/compact-policy.mjs +33 -13
- package/src/runtime/agent/orchestrator/session/loop/completion-guards.mjs +3 -3
- package/src/runtime/agent/orchestrator/session/loop/deferred-call-through.mjs +16 -0
- package/src/runtime/agent/orchestrator/session/loop/fresh-context.mjs +5 -2
- package/src/runtime/agent/orchestrator/session/loop/loop-state.mjs +3 -3
- package/src/runtime/agent/orchestrator/session/loop/no-tool-turn/empty-nudge.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/loop/no-tool-turn/output-limit.mjs +12 -6
- package/src/runtime/agent/orchestrator/session/loop/no-tool-turn.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/loop/pre-dispatch-deny.mjs +22 -10
- package/src/runtime/agent/orchestrator/session/loop/request-boundary.mjs +24 -24
- package/src/runtime/agent/orchestrator/session/loop/request-projection.mjs +6 -45
- package/src/runtime/agent/orchestrator/session/loop/send-phase.mjs +43 -30
- package/src/runtime/agent/orchestrator/session/loop/steering.mjs +57 -51
- package/src/runtime/agent/orchestrator/session/loop/stored-tool-args.mjs +8 -6
- package/src/runtime/agent/orchestrator/session/loop/termination.mjs +7 -10
- package/src/runtime/agent/orchestrator/session/loop/tool-classify.mjs +1 -6
- package/src/runtime/agent/orchestrator/session/loop/tool-helpers.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/loop/tool-phase.mjs +3 -0
- package/src/runtime/agent/orchestrator/session/loop/transcript-repair.mjs +7 -15
- package/src/runtime/agent/orchestrator/session/loop/usage.mjs +3 -1
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-commit.mjs +1 -0
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-failure.mjs +44 -20
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-settle.mjs +0 -1
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-state.mjs +5 -12
- package/src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs +192 -32
- package/src/runtime/agent/orchestrator/session/manager/context-meta.mjs +21 -82
- package/src/runtime/agent/orchestrator/session/manager/foreign-pending-messages.mjs +21 -29
- package/src/runtime/agent/orchestrator/session/manager/idle-cleanup.mjs +28 -27
- package/src/runtime/agent/orchestrator/session/manager/message-sanitize.mjs +1 -3
- package/src/runtime/agent/orchestrator/session/manager/pending-lifecycle-epoch.mjs +17 -6
- package/src/runtime/agent/orchestrator/session/manager/pending-messages.mjs +44 -30
- package/src/runtime/agent/orchestrator/session/manager/pending-persist-queue.mjs +4 -0
- package/src/runtime/agent/orchestrator/session/manager/pending-spool-file.mjs +3 -12
- package/src/runtime/agent/orchestrator/session/manager/pending-spool-path.mjs +16 -0
- package/src/runtime/agent/orchestrator/session/manager/prompt-utils.mjs +17 -14
- package/src/runtime/agent/orchestrator/session/manager/runtime-liveness.mjs +20 -34
- package/src/runtime/agent/orchestrator/session/manager/session-close.mjs +58 -47
- package/src/runtime/agent/orchestrator/session/manager/session-crud.mjs +16 -17
- package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.mjs +11 -13
- package/src/runtime/agent/orchestrator/session/manager/session-prompt-composition.mjs +2 -1
- package/src/runtime/agent/orchestrator/session/manager/session-tool-surface.mjs +0 -2
- package/src/runtime/agent/orchestrator/session/manager/status-telemetry.mjs +7 -7
- package/src/runtime/agent/orchestrator/session/manager/tool-resolution.mjs +11 -30
- package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint-journal.mjs +50 -20
- package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint.mjs +45 -42
- package/src/runtime/agent/orchestrator/session/manager/turn-interruption.mjs +29 -33
- package/src/runtime/agent/orchestrator/session/manager/usage-metrics.mjs +11 -15
- package/src/runtime/agent/orchestrator/session/pre-send-compact.mjs +8 -6
- package/src/runtime/agent/orchestrator/session/provider-prefix-guard.mjs +160 -17
- package/src/runtime/agent/orchestrator/session/reduction-metrics.mjs +19 -0
- package/src/runtime/agent/orchestrator/session/save-session-worker-stdio.mjs +28 -0
- package/src/runtime/agent/orchestrator/session/save-session-worker.mjs +29 -38
- package/src/runtime/agent/orchestrator/session/send-with-recovery.mjs +236 -72
- package/src/runtime/agent/orchestrator/session/store/canonical-reader.mjs +355 -27
- package/src/runtime/agent/orchestrator/session/store/fs-probe.mjs +10 -6
- package/src/runtime/agent/orchestrator/session/store/lifecycle-barriers.mjs +111 -98
- package/src/runtime/agent/orchestrator/session/store/lifecycle-read.mjs +10 -16
- package/src/runtime/agent/orchestrator/session/store/listing.mjs +92 -69
- package/src/runtime/agent/orchestrator/session/store/live-cache-eviction.mjs +5 -1
- package/src/runtime/agent/orchestrator/session/store/live-state.mjs +11 -14
- package/src/runtime/agent/orchestrator/session/store/liveness-veto.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/store/load-cache.mjs +246 -37
- package/src/runtime/agent/orchestrator/session/store/paths-heartbeat.mjs +58 -26
- package/src/runtime/agent/orchestrator/session/store/save-worker.mjs +202 -79
- package/src/runtime/agent/orchestrator/session/store/serialize.mjs +1 -5
- package/src/runtime/agent/orchestrator/session/store/summary-cache.mjs +12 -13
- package/src/runtime/agent/orchestrator/session/store/sweep/stale-sweep.mjs +2 -1
- package/src/runtime/agent/orchestrator/session/store/sweep/sweep-finish.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/store/sweep/sweep-record.mjs +100 -8
- package/src/runtime/agent/orchestrator/session/store/write-admission.mjs +59 -11
- package/src/runtime/agent/orchestrator/session/store/write-guards.mjs +17 -12
- package/src/runtime/agent/orchestrator/session/store-agent-worker-rows.mjs +14 -20
- package/src/runtime/agent/orchestrator/session/store-summary-fields.mjs +7 -0
- package/src/runtime/agent/orchestrator/session/store-summary-index.mjs +70 -14
- package/src/runtime/agent/orchestrator/session/store-summary-locations.mjs +2 -1
- package/src/runtime/agent/orchestrator/session/store-summary-reader.mjs +228 -68
- package/src/runtime/agent/orchestrator/session/store-summary-visibility.mjs +3 -3
- package/src/runtime/agent/orchestrator/session/store-transcript-cache.mjs +73 -20
- package/src/runtime/agent/orchestrator/session/store-transcript-projection.mjs +22 -21
- package/src/runtime/agent/orchestrator/session/store.mjs +168 -109
- package/src/runtime/agent/orchestrator/session/synthetic-user-envelope.mjs +6 -1
- package/src/runtime/agent/orchestrator/session/thinking-replay-recovery.mjs +18 -17
- package/src/runtime/agent/orchestrator/session/token-estimate-floors.mjs +134 -22
- package/src/runtime/agent/orchestrator/session/token-estimate.mjs +14 -1
- package/src/runtime/agent/orchestrator/session/tool-batch/execute-call.mjs +32 -39
- package/src/runtime/agent/orchestrator/session/tool-result-offload.mjs +32 -28
- package/src/runtime/agent/orchestrator/stall-policy.mjs +12 -10
- package/src/runtime/agent/orchestrator/tools/builtin/advisory-lock.mjs +7 -10
- package/src/runtime/agent/orchestrator/tools/builtin/arg-guard.mjs +73 -105
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/backgrounded-result.mjs +16 -8
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/completed-result.mjs +3 -8
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/result-format.mjs +12 -6
- package/src/runtime/agent/orchestrator/tools/builtin/builtin-tools.mjs +3 -17
- package/src/runtime/agent/orchestrator/tools/builtin/cache-layers.mjs +19 -18
- package/src/runtime/agent/orchestrator/tools/builtin/device-paths.mjs +5 -2
- package/src/runtime/agent/orchestrator/tools/builtin/external-tool-adapters.mjs +54 -46
- package/src/runtime/agent/orchestrator/tools/builtin/find-files-tool.mjs +14 -34
- package/src/runtime/agent/orchestrator/tools/builtin/git-command-policy.mjs +18 -15
- package/src/runtime/agent/orchestrator/tools/builtin/git-command-tool.mjs +96 -84
- package/src/runtime/agent/orchestrator/tools/builtin/glob-walk.mjs +9 -12
- package/src/runtime/agent/orchestrator/tools/builtin/lib/grep-chunk-merge.mjs +2 -13
- package/src/runtime/agent/orchestrator/tools/builtin/lib/grep-context-expander.mjs +14 -20
- package/src/runtime/agent/orchestrator/tools/builtin/lib/grep-output.mjs +6 -14
- package/src/runtime/agent/orchestrator/tools/builtin/lib/grep-path-fanout.mjs +0 -5
- package/src/runtime/agent/orchestrator/tools/builtin/lib/grep-pattern-fanout.mjs +8 -13
- package/src/runtime/agent/orchestrator/tools/builtin/lib/grep-request.mjs +2 -10
- package/src/runtime/agent/orchestrator/tools/builtin/lib/grep-single-file-rescue.mjs +3 -31
- package/src/runtime/agent/orchestrator/tools/builtin/lib/list-helpers.mjs +19 -4
- package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-job-records.mjs +17 -23
- package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-task-output.mjs +9 -4
- package/src/runtime/agent/orchestrator/tools/builtin/list-tool.mjs +7 -15
- package/src/runtime/agent/orchestrator/tools/builtin/native-search-client.mjs +45 -37
- package/src/runtime/agent/orchestrator/tools/builtin/native-search-runner.mjs +0 -4
- package/src/runtime/agent/orchestrator/tools/builtin/native-search-transport.mjs +12 -14
- package/src/runtime/agent/orchestrator/tools/builtin/path-diagnostics.mjs +12 -17
- package/src/runtime/agent/orchestrator/tools/builtin/path-locks.mjs +11 -11
- package/src/runtime/agent/orchestrator/tools/builtin/read-args.mjs +1 -2
- package/src/runtime/agent/orchestrator/tools/builtin/read-batch.mjs +10 -4
- package/src/runtime/agent/orchestrator/tools/builtin/read-formatting.mjs +11 -21
- package/src/runtime/agent/orchestrator/tools/builtin/read-image-resize.mjs +29 -16
- package/src/runtime/agent/orchestrator/tools/builtin/read-image.mjs +13 -34
- package/src/runtime/agent/orchestrator/tools/builtin/read-mode-tool.mjs +115 -193
- package/src/runtime/agent/orchestrator/tools/builtin/read-office-files.mjs +91 -92
- package/src/runtime/agent/orchestrator/tools/builtin/read-open.mjs +20 -38
- package/src/runtime/agent/orchestrator/tools/builtin/read-ranges.mjs +4 -8
- package/src/runtime/agent/orchestrator/tools/builtin/read-single-fast-paths.mjs +4 -1
- package/src/runtime/agent/orchestrator/tools/builtin/read-single-render.mjs +5 -13
- package/src/runtime/agent/orchestrator/tools/builtin/read-single-tool.mjs +10 -3
- package/src/runtime/agent/orchestrator/tools/builtin/read-snapshot-runtime.mjs +80 -72
- package/src/runtime/agent/orchestrator/tools/builtin/read-special-files.mjs +64 -53
- package/src/runtime/agent/orchestrator/tools/builtin/read-streaming.mjs +29 -63
- package/src/runtime/agent/orchestrator/tools/builtin/read-tool.mjs +14 -13
- package/src/runtime/agent/orchestrator/tools/builtin/runtime-capabilities.mjs +184 -15
- package/src/runtime/agent/orchestrator/tools/builtin/search-builders.mjs +34 -32
- package/src/runtime/agent/orchestrator/tools/builtin/search-glob-tool.mjs +4 -7
- package/src/runtime/agent/orchestrator/tools/builtin/search-grep-tool.mjs +0 -7
- package/src/runtime/agent/orchestrator/tools/builtin/search-path-diagnostics.mjs +4 -15
- package/src/runtime/agent/orchestrator/tools/builtin/shell-analysis.mjs +70 -86
- package/src/runtime/agent/orchestrator/tools/builtin/shell-jobs.mjs +12 -2
- package/src/runtime/agent/orchestrator/tools/builtin/shell-runtime.mjs +17 -14
- package/src/runtime/agent/orchestrator/tools/builtin/snapshot-helpers.mjs +17 -9
- package/src/runtime/agent/orchestrator/tools/builtin/snapshot-store.mjs +1 -76
- package/src/runtime/agent/orchestrator/tools/builtin/task-tool.mjs +121 -112
- package/src/runtime/agent/orchestrator/tools/builtin/tool-output-limit.mjs +10 -6
- package/src/runtime/agent/orchestrator/tools/builtin.mjs +27 -26
- package/src/runtime/agent/orchestrator/tools/code-graph/aggregate-roots.mjs +2 -11
- package/src/runtime/agent/orchestrator/tools/code-graph/ast-calls.mjs +2 -1
- package/src/runtime/agent/orchestrator/tools/code-graph/build.mjs +68 -103
- package/src/runtime/agent/orchestrator/tools/code-graph/constants.mjs +6 -29
- package/src/runtime/agent/orchestrator/tools/code-graph/disk-cache.mjs +15 -14
- package/src/runtime/agent/orchestrator/tools/code-graph/dispatch/federation.mjs +4 -3
- package/src/runtime/agent/orchestrator/tools/code-graph/dispatch/work.mjs +2 -1
- package/src/runtime/agent/orchestrator/tools/code-graph/dispatch.mjs +2 -11
- package/src/runtime/agent/orchestrator/tools/code-graph/graph-binary.mjs +9 -12
- package/src/runtime/agent/orchestrator/tools/code-graph/search-references.mjs +31 -29
- package/src/runtime/agent/orchestrator/tools/code-graph/search.mjs +74 -93
- package/src/runtime/agent/orchestrator/tools/code-graph/source-access.mjs +15 -12
- package/src/runtime/agent/orchestrator/tools/code-graph/symbol-index.mjs +3 -8
- package/src/runtime/agent/orchestrator/tools/code-graph/trusted-roots.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/code-graph-tool-defs.mjs +16 -16
- package/src/runtime/agent/orchestrator/tools/code-graph.mjs +6 -7
- package/src/runtime/agent/orchestrator/tools/destructive-warning.mjs +66 -80
- package/src/runtime/agent/orchestrator/tools/graph-binary-fetcher.mjs +7 -6
- package/src/runtime/agent/orchestrator/tools/graph-manifest.json +15 -11
- package/src/runtime/agent/orchestrator/tools/lib/native-spawn-client.mjs +37 -14
- package/src/runtime/agent/orchestrator/tools/lib/shell-descendants.mjs +4 -14
- package/src/runtime/agent/orchestrator/tools/lib/shell-run-background/promotion-results.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/lib/shell-run-settle.mjs +3 -4
- package/src/runtime/agent/orchestrator/tools/lib/shell-run-spawn.mjs +0 -3
- package/src/runtime/agent/orchestrator/tools/lib/shell-warm-standby.mjs +8 -12
- package/src/runtime/agent/orchestrator/tools/patch/apply-patch/codex-batch.mjs +62 -74
- package/src/runtime/agent/orchestrator/tools/patch/apply-patch/route.mjs +4 -9
- package/src/runtime/agent/orchestrator/tools/patch/dispatch/native-report.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/patch/dispatch.mjs +77 -82
- package/src/runtime/agent/orchestrator/tools/patch/matcher.mjs +7 -21
- package/src/runtime/agent/orchestrator/tools/patch/native-server.mjs +20 -54
- package/src/runtime/agent/orchestrator/tools/patch/orchestrator.mjs +1 -5
- package/src/runtime/agent/orchestrator/tools/patch/parsing.mjs +5 -5
- package/src/runtime/agent/orchestrator/tools/patch/paths.mjs +12 -10
- package/src/runtime/agent/orchestrator/tools/patch/post-patch-excerpts.mjs +4 -11
- package/src/runtime/agent/orchestrator/tools/patch/read-redirects.mjs +12 -20
- package/src/runtime/agent/orchestrator/tools/patch/section-coalesce.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/patch/sequence/report.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/patch/sequence/units.mjs +8 -9
- package/src/runtime/agent/orchestrator/tools/patch/ui-diff.mjs +6 -6
- package/src/runtime/agent/orchestrator/tools/patch/v4a-anchors.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/patch/v4a-convert.mjs +3 -18
- package/src/runtime/agent/orchestrator/tools/patch-binary-fetcher.mjs +15 -9
- package/src/runtime/agent/orchestrator/tools/patch-manifest.json +15 -11
- package/src/runtime/agent/orchestrator/tools/patch.mjs +6 -8
- package/src/runtime/agent/orchestrator/tools/shell-command.mjs +0 -14
- package/src/runtime/agent/orchestrator/tools/shell-exec-output.mjs +37 -20
- package/src/runtime/agent/orchestrator/tools/shell-policy-danger-target.mjs +14 -22
- package/src/runtime/agent/orchestrator/tools/shell-policy.mjs +19 -25
- package/src/runtime/agent/orchestrator/tools/shell-snapshot.mjs +48 -44
- package/src/runtime/agent/orchestrator/tools/spawn-binary-fetcher.mjs +3 -3
- package/src/runtime/agent/orchestrator/tools/spawn-manifest.json +15 -11
- package/src/runtime/attachments/store.mjs +188 -16
- package/src/runtime/browser-bridge/action-schema.mjs +11 -8
- package/src/runtime/browser-bridge/client.mjs +1 -0
- package/src/runtime/browser-bridge/tool-defs.mjs +3 -0
- package/src/runtime/channels/lib/event-queue.mjs +3 -9
- package/src/runtime/channels/lib/executor.mjs +11 -29
- package/src/runtime/channels/lib/owned-runtime.mjs +0 -6
- package/src/runtime/channels/lib/runtime-paths.mjs +17 -82
- package/src/runtime/channels/lib/scheduler.mjs +13 -15
- package/src/runtime/channels/lib/status-snapshot.mjs +1 -5
- package/src/runtime/channels/lib/voice-runtime-fetcher.mjs +27 -24
- package/src/runtime/channels/lib/voice-transcription.mjs +56 -29
- package/src/runtime/channels/lib/webhook/listener-lifecycle.mjs +1 -1
- package/src/runtime/channels/lib/webhook/relay-tunnel/leg-heartbeat.mjs +1 -2
- package/src/runtime/channels/lib/webhook/relay-tunnel/local-forward.mjs +1 -2
- package/src/runtime/channels/lib/webhook/relay-tunnel.mjs +13 -4
- package/src/runtime/channels/lib/webhook/request-handler.mjs +16 -6
- package/src/runtime/channels/lib/webhook/session-dispatch.mjs +1 -1
- package/src/runtime/channels/lib/webhook/signature.mjs +1 -1
- package/src/runtime/channels/lib/webhook.mjs +3 -13
- package/src/runtime/channels/lib/whisper-port.mjs +36 -15
- package/src/runtime/channels/lib/whisper-server.mjs +18 -28
- package/src/runtime/channels/lib/worker-ipc.mjs +2 -3
- package/src/runtime/channels/lib/worker-main.mjs +0 -11
- package/src/runtime/computer-bridge/action-schema.mjs +38 -18
- package/src/runtime/computer-bridge/actions.mjs +2 -0
- package/src/runtime/computer-bridge/client.mjs +134 -2
- package/src/runtime/computer-bridge/core-actions.mjs +14 -6
- package/src/runtime/computer-bridge/error-recovery.mjs +17 -0
- package/src/runtime/computer-bridge/pending-continuation.mjs +9 -4
- package/src/runtime/computer-bridge/tool-defs.mjs +4 -4
- package/src/runtime/github/contract.mjs +30 -30
- package/src/runtime/local-provider/context-settings.mjs +3 -1
- package/src/runtime/local-provider/data/manifest.json +2 -1
- package/src/runtime/local-provider/hugging-face.mjs +29 -25
- package/src/runtime/local-provider/managed-runtime.mjs +0 -2
- package/src/runtime/local-provider/registered-models.mjs +7 -1
- package/src/runtime/media/adapters/xai-media.mjs +14 -2
- package/src/runtime/media/catalog.mjs +8 -7
- package/src/runtime/media/jobs.mjs +63 -61
- package/src/runtime/media/lanes.mjs +2 -2
- package/src/runtime/media/store.mjs +53 -6
- package/src/runtime/media/tool.mjs +5 -3
- package/src/runtime/memory/index.mjs +12 -9
- package/src/runtime/memory/lib/agent-ipc.mjs +1 -5
- package/src/runtime/memory/lib/cycle1/cycle1-plan.mjs +2 -2
- package/src/runtime/memory/lib/embedding-provider.mjs +16 -20
- package/src/runtime/memory/lib/embedding-worker.mjs +19 -11
- package/src/runtime/memory/lib/http-router/session-routes.mjs +25 -4
- package/src/runtime/memory/lib/http-wire.mjs +3 -2
- package/src/runtime/memory/lib/ingest/transcript-rows.mjs +1 -1
- package/src/runtime/memory/lib/ingest/transcript-tail.mjs +3 -3
- package/src/runtime/memory/lib/ingest/transcript-watcher.mjs +2 -10
- package/src/runtime/memory/lib/light-ko-morph.mjs +43 -41
- package/src/runtime/memory/lib/memory-action-handlers/cycle-actions.mjs +1 -1
- package/src/runtime/memory/lib/memory-action-handlers/cycle-backfill-action.mjs +8 -9
- package/src/runtime/memory/lib/memory-action-handlers/cycle-rebuild-action.mjs +3 -3
- package/src/runtime/memory/lib/memory-cycle.mjs +0 -1
- package/src/runtime/memory/lib/memory-cycle1.mjs +3 -3
- package/src/runtime/memory/lib/memory-daemon-lifecycle.mjs +4 -12
- package/src/runtime/memory/lib/memory-embed.mjs +1 -8
- package/src/runtime/memory/lib/memory-ops-policy.mjs +4 -6
- package/src/runtime/memory/lib/memory-port-advertiser.mjs +3 -9
- package/src/runtime/memory/lib/memory-recall-scope-filter.mjs +8 -9
- package/src/runtime/memory/lib/memory-schema/score-params.mjs +1 -1
- package/src/runtime/memory/lib/memory-score.mjs +0 -13
- package/src/runtime/memory/lib/memory-session-merge.mjs +2 -16
- package/src/runtime/memory/lib/memory.mjs +27 -19
- package/src/runtime/memory/lib/pg/adapter.mjs +53 -69
- package/src/runtime/memory/lib/pg/process.mjs +3 -4
- package/src/runtime/memory/lib/pg/supervisor.mjs +7 -9
- package/src/runtime/memory/lib/query-handlers.mjs +2 -1
- package/src/runtime/memory/lib/query-hybrid-search.mjs +8 -23
- package/src/runtime/memory/lib/query-ranking.mjs +8 -11
- package/src/runtime/memory/lib/recall-embedding-readiness.mjs +3 -3
- package/src/runtime/memory/lib/recall-event-context.mjs +1 -1
- package/src/runtime/memory/lib/recall-hybrid/hybrid-sql.mjs +2 -2
- package/src/runtime/memory/lib/recall-hybrid/plan.mjs +2 -9
- package/src/runtime/memory/lib/recall-order.mjs +12 -0
- package/src/runtime/memory/lib/runtime-fetcher.mjs +1 -14
- package/src/runtime/memory/lib/session-ingest-runtime.mjs +2 -5
- package/src/runtime/memory/lib/trace-store/agent-call-rows.mjs +13 -5
- package/src/runtime/memory/lib/trace-store.mjs +15 -28
- package/src/runtime/memory/tool-defs.mjs +1 -1
- package/src/runtime/office/README.md +22 -3
- package/src/runtime/office/authoring/pptx-author-action.mjs +53 -11
- package/src/runtime/office/authoring/pptx-html-build.mjs +535 -0
- package/src/runtime/office/authoring/pptx-html-geometry.mjs +401 -0
- package/src/runtime/office/authoring/pptx-html-measure.mjs +587 -0
- package/src/runtime/office/authoring/pptx-html-runner.mjs +256 -0
- package/src/runtime/office/authoring/pptx-receipt.mjs +87 -28
- package/src/runtime/office/authoring/pptx-review-artifacts.mjs +17 -4
- package/src/runtime/office/authoring/pptx-script-normalize.mjs +211 -13
- package/src/runtime/office/bench/benchmark.mjs +2 -6
- package/src/runtime/office/bench/contract-benchmark.mjs +2 -1
- package/src/runtime/office/bench/polish-benchmark.mjs +3 -1
- package/src/runtime/office/bench/quality-live-benchmark.mjs +1 -3
- package/src/runtime/office/capabilities-aliases.mjs +16 -3
- package/src/runtime/office/capabilities-catalog.mjs +32 -5
- package/src/runtime/office/capabilities-signatures.mjs +150 -42
- package/src/runtime/office/capabilities.mjs +78 -22
- package/src/runtime/office/com/com-adapter.mjs +23 -24
- package/src/runtime/office/com/office-com-host.ps1 +2725 -521
- package/src/runtime/office/com/office-com-session-host.ps1 +117 -57
- package/src/runtime/office/com/office-word-formatting.ps1 +68 -10
- package/src/runtime/office/core/docx-toc-pages.mjs +23 -0
- package/src/runtime/office/core/office-actions-batch.mjs +327 -20
- package/src/runtime/office/core/office-actions-inspect.mjs +98 -50
- package/src/runtime/office/core/office-actions-open.mjs +9 -0
- package/src/runtime/office/core/office-actions-read.mjs +21 -2
- package/src/runtime/office/core/office-core.mjs +849 -12
- package/src/runtime/office/core/office-documents.mjs +2 -4
- package/src/runtime/office/core/office-finalize/commit-stage.mjs +3 -0
- package/src/runtime/office/core/office-finalize/review-stage.mjs +11 -2
- package/src/runtime/office/core/office-qa/fix-operations.mjs +8 -3
- package/src/runtime/office/core/office-qa/preview-stage.mjs +2 -1
- package/src/runtime/office/core/office-recalculation.mjs +1 -5
- package/src/runtime/office/core/office-render-preview.mjs +13 -1
- package/src/runtime/office/core/office-sessionless-actions.mjs +7 -1
- package/src/runtime/office/core/office-sessions.mjs +255 -9
- package/src/runtime/office/core/office-transactions.mjs +4 -15
- package/src/runtime/office/core/pptx-page-cache.mjs +1 -2
- package/src/runtime/office/core/snapshot-contract.mjs +4 -2
- package/src/runtime/office/core/tabular.mjs +21 -7
- package/src/runtime/office/design/composition-system.mjs +1 -1
- package/src/runtime/office/design/content-model.mjs +2 -5
- package/src/runtime/office/design/design-art-direction.mjs +2 -5
- package/src/runtime/office/design/design-discipline.mjs +18 -0
- package/src/runtime/office/design/design-system.mjs +13 -6
- package/src/runtime/office/design/design-tokens.mjs +1 -1
- package/src/runtime/office/design/docx/design-docx/front-matter.mjs +17 -2
- package/src/runtime/office/design/docx/design-docx/section.mjs +95 -15
- package/src/runtime/office/design/docx/design-docx/writer.mjs +2 -1
- package/src/runtime/office/design/docx/design-docx-components.mjs +86 -27
- package/src/runtime/office/design/docx/design-docx.mjs +5 -1
- package/src/runtime/office/design/docx/document-typography.mjs +36 -4
- package/src/runtime/office/design/library/design-library-core.mjs +8 -7
- package/src/runtime/office/design/library/design-library.mjs +39 -30
- package/src/runtime/office/design/library/design-template-fill.mjs +119 -6
- package/src/runtime/office/design/library/design-template-index.mjs +1 -2
- package/src/runtime/office/design/library/design-template-induct.mjs +74 -6
- package/src/runtime/office/design/library/design-template-inspect.mjs +8 -1
- package/src/runtime/office/design/library/templates/mixdog-executive.pptx +0 -0
- package/src/runtime/office/design/xlsx/design-xlsx-components.mjs +94 -29
- package/src/runtime/office/design/xlsx/design-xlsx.mjs +494 -83
- package/src/runtime/office/index.mjs +4 -11
- package/src/runtime/office/office-test-support.mjs +7 -0
- package/src/runtime/office/pdf/pdf-adapter.mjs +19 -8
- package/src/runtime/office/pdf/pdf-batch-content.mjs +17 -9
- package/src/runtime/office/pdf/pdf-batch-structure.mjs +171 -7
- package/src/runtime/office/pdf/pdf-document.mjs +1 -1
- package/src/runtime/office/pdf/pdf-draw.mjs +14 -29
- package/src/runtime/office/pdf/pdf-fonts.mjs +94 -28
- package/src/runtime/office/pdf/pdf-forms.mjs +45 -8
- package/src/runtime/office/pdf/pdf-ocr.mjs +16 -11
- package/src/runtime/office/pdf/pdf-render.mjs +75 -72
- package/src/runtime/office/pdf/pdf-search.mjs +3 -4
- package/src/runtime/office/pdf/pdf-writer.mjs +577 -108
- package/src/runtime/office/portable/docx-formatting.mjs +5 -0
- package/src/runtime/office/portable/docx-revisions.mjs +4 -5
- package/src/runtime/office/portable/docx-tracked-edits.mjs +45 -9
- package/src/runtime/office/portable/font-provisioner.mjs +28 -17
- package/src/runtime/office/portable/placeholder-scan.mjs +51 -0
- package/src/runtime/office/portable/portable-cells.mjs +52 -3
- package/src/runtime/office/portable/portable-chart.mjs +133 -24
- package/src/runtime/office/portable/portable-docx-edits.mjs +211 -63
- package/src/runtime/office/portable/portable-docx-operations.mjs +240 -61
- package/src/runtime/office/portable/portable-docx-parts.mjs +210 -35
- package/src/runtime/office/portable/portable-docx-styles.mjs +67 -0
- package/src/runtime/office/portable/portable-docx-xml.mjs +333 -35
- package/src/runtime/office/portable/portable-docx.mjs +17 -1
- package/src/runtime/office/portable/portable-opc.mjs +26 -5
- package/src/runtime/office/portable/portable-package.mjs +22 -3
- package/src/runtime/office/portable/portable-pivot.mjs +84 -19
- package/src/runtime/office/portable/portable-pptx-chart.mjs +40 -8
- package/src/runtime/office/portable/portable-pptx-charts.mjs +267 -22
- package/src/runtime/office/portable/portable-pptx-core.mjs +101 -14
- package/src/runtime/office/portable/portable-pptx-deck.mjs +12 -3
- package/src/runtime/office/portable/portable-pptx-package.mjs +81 -16
- package/src/runtime/office/portable/portable-pptx-shapes.mjs +154 -49
- package/src/runtime/office/portable/portable-pptx.mjs +3 -1
- package/src/runtime/office/portable/portable-sheet-audits.mjs +116 -51
- package/src/runtime/office/portable/portable-sheet-page.mjs +128 -29
- package/src/runtime/office/portable/portable-sheet-styles.mjs +35 -4
- package/src/runtime/office/portable/portable-sheet-xml.mjs +57 -8
- package/src/runtime/office/portable/portable-slide-shapes.mjs +211 -13
- package/src/runtime/office/portable/portable-snapshot-docx.mjs +150 -5
- package/src/runtime/office/portable/portable-snapshot-pptx.mjs +35 -4
- package/src/runtime/office/portable/portable-snapshot-shared.mjs +5 -3
- package/src/runtime/office/portable/portable-snapshot-xlsx.mjs +35 -7
- package/src/runtime/office/portable/portable-soffice.mjs +132 -118
- package/src/runtime/office/portable/portable-validation-package.mjs +115 -4
- package/src/runtime/office/portable/portable-validation.mjs +208 -106
- package/src/runtime/office/portable/portable-xlsx-cell-values.mjs +0 -2
- package/src/runtime/office/portable/portable-xlsx-charts.mjs +115 -27
- package/src/runtime/office/portable/portable-xlsx-drawings.mjs +32 -27
- package/src/runtime/office/portable/portable-xlsx-operations.mjs +19 -13
- package/src/runtime/office/portable/portable-xlsx-pivot-ops.mjs +76 -2
- package/src/runtime/office/portable/portable-xlsx-range-layout.mjs +97 -25
- package/src/runtime/office/portable/portable-xlsx-reference-shift.mjs +727 -0
- package/src/runtime/office/portable/portable-xlsx-sheet-edits.mjs +228 -72
- package/src/runtime/office/portable/portable-xlsx.mjs +5 -2
- package/src/runtime/office/portable/portable-xml.mjs +97 -2
- package/src/runtime/office/portable/pptx-table-fit.mjs +78 -0
- package/src/runtime/office/portable/text-metrics.mjs +102 -24
- package/src/runtime/office/portable/xlsx-assertions.mjs +142 -121
- package/src/runtime/office/portable/xlsx-audit-support.mjs +15 -12
- package/src/runtime/office/portable/xlsx-contract.mjs +52 -9
- package/src/runtime/office/portable/xlsx-formula-audit.mjs +36 -27
- package/src/runtime/office/portable/xlsx-formula-engine.mjs +38 -15
- package/src/runtime/office/portable/xlsx-recalculate.mjs +15 -17
- package/src/runtime/office/portable/xlsx-sheet-hygiene.mjs +38 -5
- package/src/runtime/office/quality/assurance-checklist.mjs +5 -2
- package/src/runtime/office/quality/assurance-structure-docx.mjs +13 -1
- package/src/runtime/office/quality/assurance-structure-pptx.mjs +77 -4
- package/src/runtime/office/quality/assurance-structure-xlsx.mjs +70 -18
- package/src/runtime/office/quality/design-aesthetics-metrics.mjs +1 -1
- package/src/runtime/office/quality/design-deck-diversity.mjs +6 -19
- package/src/runtime/office/quality/design-review-authored.mjs +25 -8
- package/src/runtime/office/quality/design-review-critique.mjs +34 -30
- package/src/runtime/office/quality/design-review.mjs +5 -8
- package/src/runtime/office/quality/inline-audit.mjs +40 -3
- package/src/runtime/office/quality/quality-pipeline.mjs +8 -0
- package/src/runtime/office/quality/quality-score.mjs +1 -0
- package/src/runtime/office/shared/column-alignments.mjs +30 -0
- package/src/runtime/office/shared/column-widths.mjs +45 -0
- package/src/runtime/office/shared/korean-particles.mjs +49 -0
- package/src/runtime/office/shared/labels.mjs +2 -0
- package/src/runtime/office/shared/line-breaks.mjs +34 -0
- package/src/runtime/office/shared/page-sizes.mjs +30 -0
- package/src/runtime/office/tool-defs.mjs +6 -4
- package/src/runtime/shared/agent-reap-state.mjs +8 -4
- package/src/runtime/shared/atomic-file.mjs +37 -52
- package/src/runtime/shared/background-tasks.mjs +22 -19
- package/src/runtime/shared/browser-launch.mjs +90 -0
- package/src/runtime/shared/buffered-appender.mjs +1 -2
- package/src/runtime/shared/child-spawn-gate.mjs +11 -15
- package/src/runtime/shared/child-spawn-remote.mjs +6 -8
- package/src/runtime/shared/clean.mjs +13 -0
- package/src/runtime/shared/compact-event-label.mjs +11 -0
- package/src/runtime/shared/config.mjs +1 -2
- package/src/runtime/shared/developer-options.mjs +88 -0
- package/src/runtime/shared/edit-tool-dialect.mjs +8 -8
- package/src/runtime/shared/err-text.mjs +12 -12
- package/src/runtime/shared/file-lock.mjs +260 -126
- package/src/runtime/shared/git-runner-worker.mjs +79 -0
- package/src/runtime/shared/git-runner.mjs +20 -0
- package/src/runtime/shared/idle-gc.mjs +30 -2
- package/src/runtime/shared/inline-file-kind.mjs +3 -1
- package/src/runtime/shared/listener-leak-warning.mjs +15 -0
- package/src/runtime/shared/llm/cost.mjs +15 -11
- package/src/runtime/shared/llm/usage-accounting.mjs +15 -6
- package/src/runtime/shared/llm/usage-ledger-quota.mjs +759 -0
- package/src/runtime/shared/llm/usage-ledger-repair.mjs +195 -98
- package/src/runtime/shared/llm/usage-ledger-rollup.mjs +6 -1
- package/src/runtime/shared/llm/usage-ledger-worker.mjs +72 -0
- package/src/runtime/shared/llm/usage-ledger.mjs +215 -3
- package/src/runtime/shared/llm/usage-log.mjs +13 -17
- package/src/runtime/shared/llm/usage-pricing-refresh.mjs +114 -16
- package/src/runtime/shared/llm/usage-rollup.mjs +4 -77
- package/src/runtime/shared/llm/usage-session-history.mjs +1 -231
- package/src/runtime/shared/llm/usage-test-support.mjs +33 -0
- package/src/runtime/shared/native-asset.mjs +22 -2
- package/src/runtime/shared/notify-trace.mjs +6 -3
- package/src/runtime/shared/object.mjs +7 -0
- package/src/runtime/shared/plugin-metadata.mjs +7 -10
- package/src/runtime/shared/plugin-paths.mjs +24 -2
- package/src/runtime/shared/pristine-execution.mjs +9 -10
- package/src/runtime/shared/process-shutdown.mjs +7 -6
- package/src/runtime/shared/read-row-numbers.mjs +63 -0
- package/src/runtime/shared/resource-admission.mjs +19 -23
- package/src/runtime/shared/service-discovery.mjs +3 -7
- package/src/runtime/shared/skill-document.mjs +5 -0
- package/src/runtime/shared/staged-update.mjs +3 -5
- package/src/runtime/shared/tool-card-model/agent-surface.mjs +15 -14
- package/src/runtime/shared/tool-card-model/background-task.mjs +4 -9
- package/src/runtime/shared/tool-card-model/displayed-result.mjs +3 -1
- package/src/runtime/shared/tool-card-model/inline-text.mjs +1 -3
- package/src/runtime/shared/tool-card-model/terminal-status.mjs +10 -8
- package/src/runtime/shared/tool-execution-contract.mjs +5 -11
- package/src/runtime/shared/tool-primitives.mjs +19 -42
- package/src/runtime/shared/tool-result-summary.mjs +7 -4
- package/src/runtime/shared/tool-surface.mjs +4 -5
- package/src/runtime/shared/tool-work-units.mjs +19 -27
- package/src/runtime/shared/transcript-writer/rotation.mjs +11 -14
- package/src/runtime/shared/turn-snapshot-store.mjs +14 -18
- package/src/runtime/shared/turn-snapshot.mjs +65 -62
- package/src/runtime/shared/turn-worktree-snapshot.mjs +12 -84
- package/src/runtime/shared/update-checker.mjs +3 -7
- package/src/runtime/shared/user-cwd.mjs +15 -23
- package/src/runtime/shared/user-data-guard.mjs +4 -4
- package/src/runtime/shared/worker-requests.mjs +114 -0
- package/src/runtime/tidy/apply.mjs +2 -2
- package/src/runtime/tidy/core-install.mjs +2 -3
- package/src/runtime/tidy/engines-manifest.json +6 -0
- package/src/runtime/tidy/history-comment.mjs +5 -5
- package/src/runtime/tidy/install.mjs +2 -2
- package/src/runtime/tidy/languages.mjs +13 -11
- package/src/runtime/tidy/process.mjs +2 -2
- package/src/runtime/tidy/report.mjs +141 -42
- package/src/runtime/tidy/resolve.mjs +14 -11
- package/src/runtime/tidy/runners/air.mjs +2 -2
- package/src/runtime/tidy/runners/biome.mjs +22 -5
- package/src/runtime/tidy/runners/clang-format.mjs +2 -2
- package/src/runtime/tidy/runners/dotnet-format.mjs +13 -11
- package/src/runtime/tidy/runners/dprint.mjs +2 -2
- package/src/runtime/tidy/runners/index.mjs +0 -2
- package/src/runtime/tidy/runners/mago.mjs +11 -9
- package/src/runtime/tidy/runners/ruff.mjs +2 -2
- package/src/runtime/tidy/runners/rustfmt.mjs +10 -9
- package/src/runtime/tidy/runners/shared.mjs +18 -2
- package/src/runtime/tidy/runners/shellcheck.mjs +1 -8
- package/src/runtime/tidy/runners/stylua.mjs +2 -2
- package/src/runtime/tidy/shadow.mjs +2 -10
- package/src/runtime/tidy/structural.mjs +5 -5
- package/src/runtime/tidy/tool-defs.mjs +3 -3
- package/src/runtime/tidy/worktree.mjs +1 -6
- package/src/runtime/web-search/index.mjs +134 -98
- package/src/runtime/web-search/lib/http-fetch.mjs +1 -1
- package/src/runtime/web-search/lib/ssrf-guard.mjs +49 -2
- package/src/runtime/web-search/lib/web-tools.mjs +7 -97
- package/src/runtime/web-search/tool-defs.mjs +2 -1
- package/src/session-runtime/boot/apis.mjs +29 -6
- package/src/session-runtime/boot/facade.mjs +2 -0
- package/src/session-runtime/boot/infrastructure.mjs +2 -7
- package/src/session-runtime/boot/providers.mjs +0 -2
- package/src/session-runtime/boot/session.mjs +0 -1
- package/src/session-runtime/config-lifecycle/config-writers.mjs +10 -11
- package/src/session-runtime/context-inspection.mjs +14 -9
- package/src/session-runtime/context-status-cache.mjs +10 -50
- package/src/session-runtime/context-status.mjs +3 -15
- package/src/session-runtime/cwd-plugins/core-memory-context.mjs +1 -4
- package/src/session-runtime/cwd-plugins.mjs +7 -8
- package/src/session-runtime/extension-scopes.mjs +2 -3
- package/src/session-runtime/fs-utils.mjs +1 -2
- package/src/session-runtime/goal-control.mjs +3 -4
- package/src/session-runtime/goal-deadlines.mjs +13 -24
- package/src/session-runtime/goal-mutations.mjs +6 -16
- package/src/session-runtime/goal-reminder.mjs +4 -4
- package/src/session-runtime/goal-runtime.mjs +5 -8
- package/src/session-runtime/goal-state.mjs +33 -1
- package/src/session-runtime/goal-storage.mjs +7 -2
- package/src/session-runtime/goal-tasks.mjs +7 -21
- package/src/session-runtime/goal-text.mjs +17 -7
- package/src/session-runtime/goal-tool-defs.mjs +11 -6
- package/src/session-runtime/goal-tool-exec.mjs +4 -10
- package/src/session-runtime/goal-turns.mjs +21 -4
- package/src/session-runtime/hook-payload.mjs +2 -1
- package/src/session-runtime/internal-tool-executor/feature-tools.mjs +4 -4
- package/src/session-runtime/internal-tool-executor/knowledge-tools.mjs +0 -2
- package/src/session-runtime/lifecycle/session-switch/resume.mjs +3 -6
- package/src/session-runtime/lifecycle/teardown.mjs +27 -3
- package/src/session-runtime/local-provider-settings.mjs +5 -1
- package/src/session-runtime/mcp-glue/server-catalog.mjs +2 -2
- package/src/session-runtime/mcp-glue/server-input.mjs +11 -14
- package/src/session-runtime/mcp-glue.mjs +0 -2
- package/src/session-runtime/media-api.mjs +3 -0
- package/src/session-runtime/model-capabilities.mjs +2 -6
- package/src/session-runtime/model-route/web-search-route.mjs +2 -4
- package/src/session-runtime/native-web-search/routes.mjs +2 -10
- package/src/session-runtime/notification-bus.mjs +3 -1
- package/src/session-runtime/plugin-mcp.mjs +13 -10
- package/src/session-runtime/prewarm/channel-start.mjs +6 -1
- package/src/session-runtime/provider-models.mjs +7 -1
- package/src/session-runtime/provider-readiness.mjs +19 -22
- package/src/session-runtime/provider-request-snapshot.mjs +220 -103
- package/src/session-runtime/provider-usage.mjs +81 -14
- package/src/session-runtime/quick-web-search-models.mjs +6 -6
- package/src/session-runtime/resource-mcp-api.mjs +1 -6
- package/src/session-runtime/resource-plugins-api.mjs +1 -2
- package/src/session-runtime/runtime-facade.mjs +3 -1
- package/src/session-runtime/runtime-modules.mjs +1 -0
- package/src/session-runtime/self-update.mjs +11 -13
- package/src/session-runtime/session-create/materialize.mjs +4 -10
- package/src/session-runtime/session-lifecycle.mjs +0 -2
- package/src/session-runtime/session-route-policy.mjs +2 -1
- package/src/session-runtime/session-text.mjs +6 -5
- package/src/session-runtime/session-title.mjs +6 -6
- package/src/session-runtime/settings-api.mjs +5 -3
- package/src/session-runtime/settings-developer-api.mjs +22 -0
- package/src/session-runtime/setup-tool/executor.mjs +16 -5
- package/src/session-runtime/setup-tool/ui-requests.mjs +14 -4
- package/src/session-runtime/skills-api.mjs +5 -5
- package/src/session-runtime/tool-catalog-data.mjs +4 -3
- package/src/session-runtime/tool-catalog.mjs +43 -50
- package/src/session-runtime/tool-defs.mjs +1 -1
- package/src/session-runtime/turn/turn-run/snapshot-tracker.mjs +6 -2
- package/src/session-runtime/turn/turn-run/transcript.mjs +1 -2
- package/src/session-runtime/usage-stats-api.mjs +75 -4
- package/src/session-runtime/workflow/agents.mjs +44 -24
- package/src/session-runtime/workflow/context.mjs +3 -1
- package/src/session-runtime/workflow/packs.mjs +49 -13
- package/src/session-runtime/workflow/shared-scan-cache.mjs +83 -0
- package/src/session-runtime/workflow-agents-api/agent-editor.mjs +2 -10
- package/src/session-runtime/workflow-agents-api/onboarding.mjs +7 -1
- package/src/session-runtime/workflow-agents-api/style-and-mode.mjs +2 -7
- package/src/standalone/agent-task-status.mjs +0 -17
- package/src/standalone/agent-tool/close-flow.mjs +2 -4
- package/src/standalone/agent-tool/execute-send.mjs +2 -13
- package/src/standalone/agent-tool/helpers.mjs +21 -18
- package/src/standalone/agent-tool/job-task-reconcile.mjs +14 -2
- package/src/standalone/agent-tool/job-views/session-progress.mjs +20 -0
- package/src/standalone/agent-tool/lead-worker-index/row-settlement.mjs +6 -25
- package/src/standalone/agent-tool/provider-init.mjs +2 -7
- package/src/standalone/agent-tool/render.mjs +3 -8
- package/src/standalone/agent-tool/send-flow.mjs +10 -9
- package/src/standalone/agent-tool/spawn-flow/spawn-run.mjs +10 -9
- package/src/standalone/agent-tool/tag-registry.mjs +1 -0
- package/src/standalone/agent-tool/terminal-reaper/tombstones.mjs +54 -5
- package/src/standalone/agent-tool/worker-index/mutation-batch.mjs +1 -5
- package/src/standalone/agent-tool.mjs +3 -2
- package/src/standalone/agent-watchdog-registry.mjs +28 -17
- package/src/standalone/channel-admin.mjs +64 -10
- package/src/standalone/channel-binding.mjs +6 -10
- package/src/standalone/channel-client/notify-stream.mjs +4 -11
- package/src/standalone/channel-client/reconnect.mjs +1 -3
- package/src/standalone/channel-transport/call-dispatch.mjs +2 -4
- package/src/standalone/channel-transport/client-registry/client-grace.mjs +1 -3
- package/src/standalone/channel-transport/client-registry/registration-replays.mjs +3 -7
- package/src/standalone/channel-transport/http-routes.mjs +2 -1
- package/src/standalone/channel-transport/remote-pointer.mjs +7 -10
- package/src/standalone/channel-worker/daemon-attach.mjs +1 -1
- package/src/standalone/channel-worker/daemon-spawn.mjs +14 -52
- package/src/standalone/daemon-candidate.mjs +81 -0
- package/src/standalone/daemon-channels-loader.mjs +4 -4
- package/src/standalone/daemon-lag-profiler.mjs +229 -0
- package/src/standalone/daemon-stored-session-views.mjs +10 -0
- package/src/standalone/daemon.mjs +44 -0
- package/src/standalone/folder-dialog.mjs +8 -3
- package/src/standalone/hook-bus/command-handler.mjs +1 -1
- package/src/standalone/hook-bus/config.mjs +27 -22
- package/src/standalone/hook-bus/handlers.mjs +40 -39
- package/src/standalone/memory-runtime-proxy/calls.mjs +7 -0
- package/src/standalone/memory-runtime-proxy/start.mjs +4 -9
- package/src/standalone/memory-runtime-proxy.mjs +1 -0
- package/src/standalone/provider-admin.mjs +83 -74
- package/src/standalone/seeds.mjs +1 -6
- package/src/standalone/session-client.mjs +32 -78
- package/src/standalone/session-frame-stream.mjs +43 -9
- package/src/standalone/session-protocol.mjs +5 -0
- package/src/standalone/session-proxy/projection.mjs +2 -11
- package/src/standalone/session-proxy/transport-calls.mjs +2 -5
- package/src/standalone/session-proxy.mjs +1 -4
- package/src/standalone/session-runtime-host.mjs +29 -46
- package/src/standalone/session-runtime-proxy.mjs +5 -5
- package/src/standalone/session-runtime-shard-router.mjs +1 -2
- package/src/standalone/session-service/agent-tree/agent-rehydrate.mjs +1 -1
- package/src/standalone/session-service/agent-tree/agent-turns.mjs +19 -0
- package/src/standalone/session-service/agent-tree.mjs +12 -1
- package/src/standalone/session-service/projection/address-index.mjs +5 -1
- package/src/standalone/session-service/projection/frames.mjs +24 -11
- package/src/standalone/session-service/projection/revisions.mjs +52 -16
- package/src/standalone/session-service/projection/transcript-window.mjs +258 -0
- package/src/standalone/session-service/projection.mjs +12 -2
- package/src/standalone/session-service/retention.mjs +44 -6
- package/src/standalone/session-service/session-calls/session-views.mjs +80 -16
- package/src/standalone/session-service/session-calls.mjs +3 -2
- package/src/standalone/session-service/stored-reader.mjs +107 -10
- package/src/standalone/session-service/viewers.mjs +73 -7
- package/src/standalone/session-service.mjs +9 -0
- package/src/standalone/session-state-patch.d.mts +7 -0
- package/src/standalone/session-state-patch.mjs +37 -9
- package/src/standalone/session-transport/call-lanes.mjs +2 -4
- package/src/standalone/usage-dashboard-model.mjs +2 -2
- package/src/standalone/usage-dashboard.mjs +1 -4
- package/src/tui/App.jsx +0 -1
- package/src/tui/app/app-format.mjs +3 -12
- package/src/tui/app/app-view/floating-panel.jsx +112 -109
- package/src/tui/app/app-view/transcript-viewport/trailing-bands.jsx +6 -12
- package/src/tui/app/app-view.jsx +47 -54
- package/src/tui/app/clipboard.mjs +16 -2
- package/src/tui/app/create-app-pickers.mjs +3 -1
- package/src/tui/app/doctor.mjs +157 -51
- package/src/tui/app/extension-pickers/skills-pickers/skill-items.mjs +1 -1
- package/src/tui/app/maintenance-pickers/developer-picker.mjs +168 -0
- package/src/tui/app/maintenance-pickers.mjs +12 -2
- package/src/tui/app/model-options.mjs +59 -66
- package/src/tui/app/model-picker/model-footer.mjs +21 -18
- package/src/tui/app/model-picker/route-selection/effort.mjs +2 -3
- package/src/tui/app/mouse-input/button-gestures.mjs +380 -0
- package/src/tui/app/onboarding/models-step.mjs +1 -1
- package/src/tui/app/onboarding/role-model-picker.mjs +2 -2
- package/src/tui/app/onboarding/step-data.mjs +1 -1
- package/src/tui/app/project-picker/create-flow.mjs +3 -3
- package/src/tui/app/project-picker/picker-state.mjs +1 -5
- package/src/tui/app/prompt-submit/provider-prompts.mjs +7 -2
- package/src/tui/app/provider-setup/provider-items.mjs +2 -6
- package/src/tui/app/provider-usable.mjs +16 -0
- package/src/tui/app/settings-picker/settings-navigation.mjs +1 -0
- package/src/tui/app/settings-picker/settings-rows.mjs +6 -0
- package/src/tui/app/settings-picker/settings-toggles.mjs +21 -14
- package/src/tui/app/shell-layout/surfaces.mjs +1 -14
- package/src/tui/app/shell-layout/viewport.mjs +1 -2
- package/src/tui/app/slash-dispatch/session-commands.mjs +2 -5
- package/src/tui/app/transcript-anchor-sync.mjs +1 -1
- package/src/tui/app/transcript-row-estimate.mjs +25 -32
- package/src/tui/app/transcript-window.mjs +2 -4
- package/src/tui/app/use-global-key-input.mjs +2 -8
- package/src/tui/app/use-mouse-input.mjs +30 -412
- package/src/tui/app/use-prompt-draft-flow.mjs +3 -3
- package/src/tui/app/use-prompt-handlers.mjs +1 -0
- package/src/tui/app/use-selection-focus.mjs +3 -9
- package/src/tui/app/use-selection-geometry.mjs +4 -4
- package/src/tui/app/use-selection-paint.mjs +1 -1
- package/src/tui/app/use-transcript-activity.mjs +31 -37
- package/src/tui/app/use-transcript-scroll.mjs +2 -4
- package/src/tui/app/use-transcript-window/selection-shift.mjs +2 -2
- package/src/tui/app/use-transcript-window/visible-items.mjs +0 -2
- package/src/tui/app/use-welcome-prompt-hint.mjs +11 -2
- package/src/tui/components/ContextPanel.jsx +8 -3
- package/src/tui/components/ItemRightHintOverprint.jsx +15 -13
- package/src/tui/components/Markdown.jsx +5 -20
- package/src/tui/components/MarkdownTable.jsx +4 -9
- package/src/tui/components/Message.jsx +1 -1
- package/src/tui/components/Picker.jsx +23 -25
- package/src/tui/components/PromptInput.jsx +35 -61
- package/src/tui/components/SlashCommandPalette.jsx +1 -1
- package/src/tui/components/Spinner.jsx +5 -6
- package/src/tui/components/StatusLine.jsx +34 -49
- package/src/tui/components/TextEntryPanel.jsx +24 -68
- package/src/tui/components/ToolExecution.jsx +8 -17
- package/src/tui/components/TurnDone.jsx +4 -17
- package/src/tui/components/UsagePanel.jsx +7 -31
- package/src/tui/components/prompt-input/cursor-anchor.mjs +6 -5
- package/src/tui/components/prompt-input/edit-helpers.mjs +46 -2
- package/src/tui/components/prompt-input/key-signals.mjs +6 -26
- package/src/tui/components/prompt-input/mouse-selection.mjs +9 -5
- package/src/tui/components/tool-execution/surface-detail.mjs +4 -29
- package/src/tui/components/tool-execution/text-format.mjs +9 -12
- package/src/tui/components/tool-output-format.mjs +3 -3
- package/src/tui/dist/index.mjs +35884 -2629
- package/src/tui/index.jsx +4 -5
- package/src/tui/markdown/format-token.mjs +9 -16
- package/src/tui/markdown/lru.mjs +14 -0
- package/src/tui/markdown/measure-rendered-rows.mjs +4 -14
- package/src/tui/markdown/render-ansi.mjs +3 -7
- package/src/tui/markdown/stream-fence.mjs +3 -7
- package/src/tui/markdown/streaming-markdown.mjs +8 -7
- package/src/tui/markdown/table-layout.mjs +1 -1
- package/src/tui/paste-attachments.mjs +6 -16
- package/src/tui/session/agent-envelope.mjs +14 -13
- package/src/tui/session/agent-job-feed/agent-job-card.mjs +2 -2
- package/src/tui/session/context-state.mjs +3 -1
- package/src/tui/session/cross-surface-share.mjs +15 -20
- package/src/tui/session/goal-continuation/continuation-queue.mjs +3 -3
- package/src/tui/session/goal-continuation/goal-visibility.mjs +4 -1
- package/src/tui/session/goal-continuation.mjs +7 -3
- package/src/tui/session/goal-turn-state.mjs +2 -2
- package/src/tui/session/initial-state.mjs +2 -1
- package/src/tui/session/labels.mjs +1 -10
- package/src/tui/session/live-share/delta.mjs +1 -1
- package/src/tui/session/notification-plan.mjs +8 -5
- package/src/tui/session/prompt-history.mjs +7 -5
- package/src/tui/session/render-timing.mjs +1 -1
- package/src/tui/session/session-api/commands.mjs +12 -15
- package/src/tui/session/session-api/controls.mjs +2 -1
- package/src/tui/session/session-api/intake/abort.mjs +7 -9
- package/src/tui/session/session-api/intake/rewind.mjs +2 -5
- package/src/tui/session/session-api/intake/submission.mjs +1 -1
- package/src/tui/session/session-api/integrations.mjs +60 -1
- package/src/tui/session/session-api/lifecycle/resume.mjs +7 -0
- package/src/tui/session/session-api/media.mjs +27 -14
- package/src/tui/session/session-api/settings.mjs +2 -0
- package/src/tui/session/session-api-ext.mjs +31 -51
- package/src/tui/session/session-flow/failed-turn-rewind.mjs +1 -7
- package/src/tui/session/session-flow/steering.mjs +10 -0
- package/src/tui/session/shared-dir-watch.mjs +69 -0
- package/src/tui/session/tool-approval.mjs +2 -3
- package/src/tui/session/tool-card-results/grouped-result.mjs +2 -2
- package/src/tui/session/tool-card-results/item-patch.mjs +8 -5
- package/src/tui/session/tool-result-status.mjs +52 -3
- package/src/tui/session/tool-result-text.mjs +0 -2
- package/src/tui/session/transcript-intake.mjs +1 -1
- package/src/tui/session/transcript-spill/spill-dir.mjs +7 -2
- package/src/tui/session/transcript-spill/spill-writer.mjs +45 -6
- package/src/tui/session/transcript-spill.mjs +20 -24
- package/src/tui/session/transcript-store.mjs +2 -8
- package/src/tui/session/tui-steering-persist.mjs +53 -57
- package/src/tui/session/turn-aggregate-cards/early-complete.mjs +4 -18
- package/src/tui/session/turn-stream.mjs +46 -2
- package/src/tui/session/turn-tool-cards.mjs +2 -10
- package/src/tui/session/turn.mjs +7 -2
- package/src/tui/session-local.mjs +71 -17
- package/src/tui/themes/onedark.mjs +4 -3
- package/src/ui/ansi.mjs +0 -2
- package/src/ui/model-display.mjs +1 -2
- package/src/ui/statusline-agents.mjs +1 -7
- package/src/ui/statusline-format.mjs +7 -0
- package/src/ui/statusline-segments.mjs +2 -11
- package/src/ui/statusline.mjs +1 -5
- package/src/ui/streaming-markdown-heal.mjs +16 -3
- package/src/vendor/statusline/src/gateway/route-meta.mjs +44 -13
- package/src/workflows/default/WORKFLOW.md +2 -1
- package/scripts/lib/isolated-root-cleanup.mjs +0 -25
- package/src/rules/shared/05-parallel-calls.md +0 -13
- package/src/runtime/agent/orchestrator/session/browser-snapshot-supersession.mjs +0 -61
- package/src/runtime/agent/orchestrator/session/evidence-union.mjs +0 -28
- package/src/runtime/agent/orchestrator/tools/builtin/diff-utils.mjs +0 -128
- package/src/session-runtime/memory-runtime-prewarm.mjs +0 -15
|
@@ -2,6 +2,12 @@ import { createCanvas, GlobalFonts } from '@napi-rs/canvas';
|
|
|
2
2
|
import { warmupInstalledOfficeFonts } from './font-provisioner.mjs';
|
|
3
3
|
import { bySlide, rectangleGap, reviewDeclaredRelations } from './pptx-relations.mjs';
|
|
4
4
|
|
|
5
|
+
// PowerPoint's single line spacing is 1.2 em for every face — probe 2026-09-04
|
|
6
|
+
// read BoundHeight / lines / size = 1.200 for Noto Sans KR, Noto Serif KR,
|
|
7
|
+
// Malgun Gothic, Noto Sans, Arial, and Calibri at 18 and 36 pt. The canvas's
|
|
8
|
+
// font bounding box (1.33 for Malgun, 1.44 for Noto Serif KR) is the face's own
|
|
9
|
+
// metric, not the pitch PowerPoint lays out, so it is not used. A percentage
|
|
10
|
+
// line spacing multiplies the 1.2.
|
|
5
11
|
const LINE_HEIGHT_RATIO = 1.2;
|
|
6
12
|
const CJK = /[\u1100-\u115F\u2E80-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]/;
|
|
7
13
|
// Families that carry their own Hangul / CJK glyphs. Any other face (Arial, Calibri, Noto Sans) hands
|
|
@@ -125,7 +131,7 @@ function fontAvailable(name) {
|
|
|
125
131
|
// Weight-suffixed families (Malgun Gothic Semilight, Segoe UI Semibold)
|
|
126
132
|
// often enumerate only under their base family; measure with that base
|
|
127
133
|
// instead of reporting the whole font missing.
|
|
128
|
-
const base = family.replace(
|
|
134
|
+
const base = family.replace(WEIGHT_SUFFIX, '');
|
|
129
135
|
return base !== family && (installedFonts.has(base) || Boolean(installedEquivalent(base)));
|
|
130
136
|
}
|
|
131
137
|
|
|
@@ -270,14 +276,34 @@ export function wrapParagraph(text, width, font = {}) {
|
|
|
270
276
|
return lines.length ? lines : [''];
|
|
271
277
|
}
|
|
272
278
|
|
|
273
|
-
//
|
|
274
|
-
//
|
|
275
|
-
//
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
279
|
+
// A paragraph whose text carries soft breaks ('\n') is laid out as one line group per break, each at the
|
|
280
|
+
// size of its own runs: "GPT-5.6 Sol" at 14 pt over "Codex CLI 대비" at 10 pt is two lines, not one
|
|
281
|
+
// unbroken word wrapped three times. Space before and after stay with the paragraph's first and last line.
|
|
282
|
+
function softBreakLines(paragraph) {
|
|
283
|
+
const text = String(paragraph.text ?? '');
|
|
284
|
+
if (!text.includes('\n')) return [paragraph];
|
|
285
|
+
const runs = Array.isArray(paragraph.runs) ? paragraph.runs : [{ text, fontSize: paragraph.fontSize }];
|
|
286
|
+
const lines = [[]];
|
|
287
|
+
for (const run of runs) {
|
|
288
|
+
String(run.text ?? '')
|
|
289
|
+
.split('\n')
|
|
290
|
+
.forEach((part, index) => {
|
|
291
|
+
if (index > 0) lines.push([]);
|
|
292
|
+
if (part) lines[lines.length - 1].push({ ...run, text: part });
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
const { runs: _runs, spaceBefore, spaceAfter, ...rest } = paragraph;
|
|
296
|
+
return lines.map((lineRuns, index) => {
|
|
297
|
+
const sizes = lineRuns.map((run) => Number(run.fontSize) || 0).filter(Boolean);
|
|
298
|
+
return {
|
|
299
|
+
...rest,
|
|
300
|
+
text: lineRuns.map((run) => run.text).join(''),
|
|
301
|
+
fontSize: sizes.length ? Math.max(...sizes) : paragraph.fontSize,
|
|
302
|
+
...(new Set(sizes).size > 1 ? { runs: lineRuns } : {}),
|
|
303
|
+
...(index === 0 && spaceBefore ? { spaceBefore } : {}),
|
|
304
|
+
...(index === lines.length - 1 && spaceAfter ? { spaceAfter } : {}),
|
|
305
|
+
};
|
|
306
|
+
});
|
|
281
307
|
}
|
|
282
308
|
|
|
283
309
|
// lineSpacing: the PowerPoint multiple (1.0 = single); a paragraph's own
|
|
@@ -291,7 +317,7 @@ export function measureTextBlock(paragraphs = [], { width = 0, lineSpacing = 1,
|
|
|
291
317
|
// wrap breaks such a run between characters, the laid-out width no longer
|
|
292
318
|
// shows that the measure is narrower than the text it has to carry.
|
|
293
319
|
let longestRun = 0;
|
|
294
|
-
for (const paragraph of paragraphs) {
|
|
320
|
+
for (const paragraph of paragraphs.flatMap(softBreakLines)) {
|
|
295
321
|
const font = {
|
|
296
322
|
fontName: paragraph.fontName,
|
|
297
323
|
fontSize: paragraph.fontSize,
|
|
@@ -299,6 +325,26 @@ export function measureTextBlock(paragraphs = [], { width = 0, lineSpacing = 1,
|
|
|
299
325
|
italic: paragraph.italic,
|
|
300
326
|
};
|
|
301
327
|
const size = Math.max(1, Number(paragraph.fontSize) || 18);
|
|
328
|
+
const multipleEarly =
|
|
329
|
+
Number(paragraph.lineSpacing) > 0 ? Number(paragraph.lineSpacing) : Math.max(0.5, Number(lineSpacing) || 1);
|
|
330
|
+
// Runs of different sizes ("+4.3" at 47 pt, "%p" at 19 pt) are measured each at its own size: read at the first
|
|
331
|
+
// run's size, a figure with its small unit was reported as breaking mid-word and overflowing its box. When the
|
|
332
|
+
// whole paragraph fits one line that way, it is one line.
|
|
333
|
+
const runs =
|
|
334
|
+
Array.isArray(paragraph.runs) && new Set(paragraph.runs.map((run) => run.fontSize)).size > 1
|
|
335
|
+
? paragraph.runs
|
|
336
|
+
: null;
|
|
337
|
+
if (runs) {
|
|
338
|
+
const total = runs.reduce((sum, run) => sum + measureTextWidth(run.text, { ...font, fontSize: run.fontSize }), 0);
|
|
339
|
+
if (!(width > 0) || total <= width) {
|
|
340
|
+
widest = Math.max(widest, total);
|
|
341
|
+
longestRun = Math.max(longestRun, total);
|
|
342
|
+
lines += 1;
|
|
343
|
+
height += size * (lineHeightRatio > 0 ? lineHeightRatio : LINE_HEIGHT_RATIO * multipleEarly);
|
|
344
|
+
height += Math.max(0, Number(paragraph.spaceBefore) || 0) + Math.max(0, Number(paragraph.spaceAfter) || 0);
|
|
345
|
+
continue;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
302
348
|
const wrapped = width > 0 ? wrapParagraph(paragraph.text, width, font) : [String(paragraph.text ?? '')];
|
|
303
349
|
for (const line of wrapped) widest = Math.max(widest, measureTextWidth(line, font));
|
|
304
350
|
for (const part of segments(paragraph.text)) {
|
|
@@ -307,7 +353,7 @@ export function measureTextBlock(paragraphs = [], { width = 0, lineSpacing = 1,
|
|
|
307
353
|
lines += wrapped.length;
|
|
308
354
|
const multiple =
|
|
309
355
|
Number(paragraph.lineSpacing) > 0 ? Number(paragraph.lineSpacing) : Math.max(0.5, Number(lineSpacing) || 1);
|
|
310
|
-
const pitch = lineHeightRatio > 0 ? lineHeightRatio :
|
|
356
|
+
const pitch = lineHeightRatio > 0 ? lineHeightRatio : LINE_HEIGHT_RATIO * multiple;
|
|
311
357
|
height += wrapped.length * size * pitch;
|
|
312
358
|
height += Math.max(0, Number(paragraph.spaceBefore) || 0);
|
|
313
359
|
height += Math.max(0, Number(paragraph.spaceAfter) || 0);
|
|
@@ -450,13 +496,18 @@ export function reviewCjkTracking(boxes = []) {
|
|
|
450
496
|
return issues;
|
|
451
497
|
}
|
|
452
498
|
|
|
499
|
+
// The largest type size a block of paragraphs sets, 0 when none states one.
|
|
500
|
+
function largestFontSize(paragraphs) {
|
|
501
|
+
return Math.max(0, ...paragraphs.map((paragraph) => Number(paragraph.fontSize) || 0));
|
|
502
|
+
}
|
|
503
|
+
|
|
453
504
|
// Two readings of the same fault: a box narrower than its longest word
|
|
454
505
|
// breaks mid-word, and a box only a little wider still leaves a ragged
|
|
455
506
|
// column of one or two words a line. Both are answered by widening the
|
|
456
507
|
// measure, so they share one code and report once.
|
|
457
508
|
function narrowBoxIssue(box, paragraphs, measured, usableWidth, path) {
|
|
458
509
|
if (box.wrap === false) return null;
|
|
459
|
-
const bodySize =
|
|
510
|
+
const bodySize = largestFontSize(paragraphs);
|
|
460
511
|
const longestRun = Number(measured.longestRun) || measured.width;
|
|
461
512
|
if (longestRun > usableWidth * 1.02) {
|
|
462
513
|
return {
|
|
@@ -574,7 +625,7 @@ function statementSlides(boxes = []) {
|
|
|
574
625
|
if (!text) continue;
|
|
575
626
|
const entry = perSlide.get(box.slide) || { count: 0, sizes: [], chars: 0 };
|
|
576
627
|
entry.count += 1;
|
|
577
|
-
entry.sizes.push(
|
|
628
|
+
entry.sizes.push(largestFontSize(paragraphs));
|
|
578
629
|
entry.chars += text.length;
|
|
579
630
|
perSlide.set(box.slide, entry);
|
|
580
631
|
}
|
|
@@ -629,6 +680,24 @@ function hollowBand(content = []) {
|
|
|
629
680
|
return { depth, top };
|
|
630
681
|
}
|
|
631
682
|
|
|
683
|
+
// A page the statement exemption covers that is no statement: a title in the top quarter, nothing at poster size,
|
|
684
|
+
// and a line of 14 pt or more (the takeaway) with a hollow band between them. A statement is one claim set large in
|
|
685
|
+
// its air; a title over an empty middle and a sentence at the foot is a content page whose content never came.
|
|
686
|
+
// The author may mean it, so it is information, not a target.
|
|
687
|
+
function titleLineHollow(slideBoxes, content, slideHeight) {
|
|
688
|
+
const texts = slideBoxes
|
|
689
|
+
.map((box) => ({ box, size: largestFontSize(Array.isArray(box.paragraphs) ? box.paragraphs : []) }))
|
|
690
|
+
.filter(({ box }) => (box.paragraphs || []).some((paragraph) => String(paragraph.text || '').trim()));
|
|
691
|
+
if (texts.length < 2) return null;
|
|
692
|
+
const title = texts.reduce((largest, entry) => (entry.size > largest.size ? entry : largest));
|
|
693
|
+
if (title.size < 24 || title.size >= 34 || !(Number(title.box.top) < slideHeight * 0.25)) return null;
|
|
694
|
+
const hollow = hollowBand(content);
|
|
695
|
+
if (hollow.depth <= HOLLOW_BAND || hollow.top < Number(title.box.top) + Number(title.box.height) - 1) return null;
|
|
696
|
+
const below = hollow.top + hollow.depth - 1;
|
|
697
|
+
if (!texts.some((entry) => entry !== title && entry.size >= 14 && Number(entry.box.top) >= below)) return null;
|
|
698
|
+
return hollow;
|
|
699
|
+
}
|
|
700
|
+
|
|
632
701
|
export function reviewVerticalBalance(bounds = [], { slideWidth = 0, slideHeight = 0, boxes = [] } = {}) {
|
|
633
702
|
if (!(slideHeight > 0) || !(slideWidth > 0)) return [];
|
|
634
703
|
const issues = [];
|
|
@@ -638,7 +707,24 @@ export function reviewVerticalBalance(bounds = [], { slideWidth = 0, slideHeight
|
|
|
638
707
|
(shape) => Math.max(0, shape.width) * Math.max(0, shape.height) < slideWidth * slideHeight * 0.8
|
|
639
708
|
);
|
|
640
709
|
if (!content.length) continue;
|
|
641
|
-
if (statements.has(slide) && !carriesObject(content))
|
|
710
|
+
if (statements.has(slide) && !carriesObject(content)) {
|
|
711
|
+
const hollow = titleLineHollow(
|
|
712
|
+
boxes.filter((box) => box.slide === slide),
|
|
713
|
+
content,
|
|
714
|
+
slideHeight
|
|
715
|
+
);
|
|
716
|
+
if (hollow) {
|
|
717
|
+
issues.push({
|
|
718
|
+
severity: 'info',
|
|
719
|
+
code: 'title_line_hollow',
|
|
720
|
+
path: `/slide[${slide}]`,
|
|
721
|
+
message: `Only a title and a line under it, with an empty band ${Math.round(hollow.depth)}pt deep between them. A statement page sets its claim large in the air; a content page brings its evidence into the band, or moves the line up under the title.`,
|
|
722
|
+
hollowBand: Math.round(hollow.depth),
|
|
723
|
+
hollowTop: Math.round(hollow.top),
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
continue;
|
|
727
|
+
}
|
|
642
728
|
const top = Math.min(...content.map((shape) => shape.top));
|
|
643
729
|
const bottom = Math.max(...content.map((shape) => shape.top + shape.height));
|
|
644
730
|
const topEmpty = Math.max(0, top);
|
|
@@ -685,21 +771,13 @@ export function reviewStatLabelProximity(boxes = [], { maximumGap = 36 } = {}) {
|
|
|
685
771
|
.map((paragraph) => String(paragraph.text ?? ''))
|
|
686
772
|
.join(' ')
|
|
687
773
|
.trim();
|
|
688
|
-
const size =
|
|
774
|
+
const size = largestFontSize(paragraphs);
|
|
689
775
|
if (size < 28 || !text || text.length > 16 || !/\d/.test(text)) continue;
|
|
690
776
|
const letters = (text.match(/\p{L}/gu) || []).length;
|
|
691
777
|
if (letters > text.replace(/\s/g, '').length * 0.5) continue;
|
|
692
778
|
const nearest = shapes
|
|
693
779
|
.filter((candidate) => candidate !== box)
|
|
694
|
-
.filter(
|
|
695
|
-
(candidate) =>
|
|
696
|
-
Math.max(
|
|
697
|
-
...(Array.isArray(candidate.paragraphs) ? candidate.paragraphs : []).map(
|
|
698
|
-
(paragraph) => Number(paragraph.fontSize) || 0
|
|
699
|
-
),
|
|
700
|
-
0
|
|
701
|
-
) <= 20
|
|
702
|
-
)
|
|
780
|
+
.filter((candidate) => largestFontSize(Array.isArray(candidate.paragraphs) ? candidate.paragraphs : []) <= 20)
|
|
703
781
|
.filter((candidate) => candidate.paragraphs?.some((paragraph) => String(paragraph.text || '').trim()))
|
|
704
782
|
.sort((first, second) => rectangleGap(box, first) - rectangleGap(box, second))[0];
|
|
705
783
|
if (!nearest) continue;
|
|
@@ -111,6 +111,144 @@ function issue(index, code, message, path = '/') {
|
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
// Each check reads one assertion against the workbook, records its issues, and
|
|
115
|
+
// answers whether the assertion held.
|
|
116
|
+
function checkCellValue({ assertion, assertionIndex, sheet, target, issues }) {
|
|
117
|
+
// A formula written without Excel carries no cached result until the
|
|
118
|
+
// workbook is recalculated. Compared anyway it reads as a wrong model —
|
|
119
|
+
// and against a zero expectation it used to read as a right one.
|
|
120
|
+
if (uncalculated(target)) {
|
|
121
|
+
issues.push(
|
|
122
|
+
issue(
|
|
123
|
+
assertionIndex,
|
|
124
|
+
'assertion_value_uncalculated',
|
|
125
|
+
`${sheet}!${assertion.cell} holds ${JSON.stringify(formulaText(target))} with no calculated result, so it cannot be compared with ${JSON.stringify(assertion.equals)}: ${UNCALCULATED_ROUTE}.`,
|
|
126
|
+
target?.path || `/sheet[${sheet}]/cell[${assertion.cell}]`
|
|
127
|
+
)
|
|
128
|
+
);
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
const passed = Boolean(target) && sameValue(target.value, assertion.equals, assertion.tolerance);
|
|
132
|
+
if (!passed) {
|
|
133
|
+
issues.push(
|
|
134
|
+
issue(
|
|
135
|
+
assertionIndex,
|
|
136
|
+
'assertion_value_mismatch',
|
|
137
|
+
`Expected ${sheet}!${assertion.cell} to equal ${JSON.stringify(assertion.equals)}; actual value is ${JSON.stringify(target?.value ?? null)}.`,
|
|
138
|
+
target?.path || `/sheet[${sheet}]/cell[${assertion.cell}]`
|
|
139
|
+
)
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
return passed;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function checkCellFormula({ assertion, assertionIndex, sheet, target, issues }) {
|
|
146
|
+
const actual = String(target?.formula || '');
|
|
147
|
+
const comparableActual = actual.replace(/^=/, '');
|
|
148
|
+
const comparableExpected = String(assertion.equals ?? '').replace(/^=/, '');
|
|
149
|
+
const passed =
|
|
150
|
+
Boolean(target) &&
|
|
151
|
+
(assertion.equals !== undefined
|
|
152
|
+
? comparableActual === comparableExpected
|
|
153
|
+
: new RegExp(String(assertion.matches || '')).test(actual));
|
|
154
|
+
if (!passed)
|
|
155
|
+
issues.push(
|
|
156
|
+
issue(
|
|
157
|
+
assertionIndex,
|
|
158
|
+
'assertion_formula_mismatch',
|
|
159
|
+
`Formula assertion failed for ${sheet}!${assertion.cell}; actual formula is ${JSON.stringify(actual)}.`,
|
|
160
|
+
target?.path || `/sheet[${sheet}]/cell[${assertion.cell}]`
|
|
161
|
+
)
|
|
162
|
+
);
|
|
163
|
+
return passed;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function checkTieOut({ assertion, assertionIndex, sheet, get, issues }) {
|
|
167
|
+
const left = get(assertion.left, sheet);
|
|
168
|
+
const right = get(assertion.right, sheet);
|
|
169
|
+
// Two sides that have not been calculated are both empty, and an empty
|
|
170
|
+
// pair used to tie out: the strictest check in the model answered "agreed"
|
|
171
|
+
// without a single number behind it.
|
|
172
|
+
const pending = [
|
|
173
|
+
[assertion.left, left],
|
|
174
|
+
[assertion.right, right],
|
|
175
|
+
].filter(([, cell]) => uncalculated(cell));
|
|
176
|
+
if (pending.length) {
|
|
177
|
+
issues.push(
|
|
178
|
+
issue(
|
|
179
|
+
assertionIndex,
|
|
180
|
+
'assertion_value_uncalculated',
|
|
181
|
+
`Tie-out cannot be read yet: ${pending.map(([reference, cell]) => `${JSON.stringify(reference)} holds ${JSON.stringify(formulaText(cell))} with no calculated result`).join(' and ')}; ${UNCALCULATED_ROUTE}.`,
|
|
182
|
+
pending[0][1]?.path || left?.path || right?.path || '/'
|
|
183
|
+
)
|
|
184
|
+
);
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
const passed = Boolean(left && right) && sameValue(left.value, right.value, assertion.tolerance);
|
|
188
|
+
if (!passed)
|
|
189
|
+
issues.push(
|
|
190
|
+
issue(
|
|
191
|
+
assertionIndex,
|
|
192
|
+
'assertion_tie_out_failed',
|
|
193
|
+
`Tie-out failed: ${JSON.stringify(assertion.left)}=${JSON.stringify(left?.value ?? null)} and ${JSON.stringify(assertion.right)}=${JSON.stringify(right?.value ?? null)}.`,
|
|
194
|
+
left?.path || right?.path || '/'
|
|
195
|
+
)
|
|
196
|
+
);
|
|
197
|
+
return passed;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function checkNoErrors({ document, assertion, assertionIndex, issues }) {
|
|
201
|
+
const failures = cellsForAssertion(document, assertion).filter((cell) => ERROR_VALUE.test(String(cell.value || '')));
|
|
202
|
+
for (const cell of failures.slice(0, 100))
|
|
203
|
+
issues.push(
|
|
204
|
+
issue(
|
|
205
|
+
assertionIndex,
|
|
206
|
+
'assertion_formula_error',
|
|
207
|
+
`Formula error ${cell.value} violates no-errors assertion.`,
|
|
208
|
+
cell.path
|
|
209
|
+
)
|
|
210
|
+
);
|
|
211
|
+
return failures.length === 0;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function checkFormulaConsistency({ document, assertion, assertionIndex, sheet, issues }) {
|
|
215
|
+
const formulas = cellsForAssertion(document, assertion).filter((cell) => cell.formula);
|
|
216
|
+
const patterns = new Map();
|
|
217
|
+
for (const cell of formulas) {
|
|
218
|
+
const pattern = relativeFormulaSignature(cell.formula, cell.ref);
|
|
219
|
+
patterns.set(pattern, (patterns.get(pattern) || 0) + 1);
|
|
220
|
+
}
|
|
221
|
+
const expected = [...patterns.entries()].sort((left, right) => right[1] - left[1])[0]?.[0] || '';
|
|
222
|
+
const inconsistent = formulas.filter((cell) => relativeFormulaSignature(cell.formula, cell.ref) !== expected);
|
|
223
|
+
if (!formulas.length)
|
|
224
|
+
issues.push(
|
|
225
|
+
issue(
|
|
226
|
+
assertionIndex,
|
|
227
|
+
'assertion_formula_missing',
|
|
228
|
+
'Formula-consistency assertion found no formulas.',
|
|
229
|
+
`/sheet[${assertion.sheet || sheet}]`
|
|
230
|
+
)
|
|
231
|
+
);
|
|
232
|
+
for (const cell of inconsistent.slice(0, 100))
|
|
233
|
+
issues.push(
|
|
234
|
+
issue(
|
|
235
|
+
assertionIndex,
|
|
236
|
+
'assertion_formula_inconsistent',
|
|
237
|
+
'Formula differs from the dominant pattern in the asserted region.',
|
|
238
|
+
cell.path
|
|
239
|
+
)
|
|
240
|
+
);
|
|
241
|
+
return formulas.length > 0 && inconsistent.length === 0;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
const ASSERTION_CHECKS = new Map([
|
|
245
|
+
['cell-value', checkCellValue],
|
|
246
|
+
['cell-formula', checkCellFormula],
|
|
247
|
+
['tie-out', checkTieOut],
|
|
248
|
+
['no-errors', checkNoErrors],
|
|
249
|
+
['formula-consistency', checkFormulaConsistency],
|
|
250
|
+
]);
|
|
251
|
+
|
|
114
252
|
export function evaluateXlsxAssertions(document, assertions = []) {
|
|
115
253
|
const index = cellIndex(document);
|
|
116
254
|
const issues = [];
|
|
@@ -125,128 +263,11 @@ export function evaluateXlsxAssertions(document, assertions = []) {
|
|
|
125
263
|
const kind = String(assertion?.kind || '').toLowerCase();
|
|
126
264
|
const sheet = String(assertion?.sheet || document?.sheets?.[0]?.name || '');
|
|
127
265
|
const target = assertion?.cell ? get({ sheet, cell: assertion.cell }) : null;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
// and against a zero expectation it used to read as a right one.
|
|
133
|
-
if (uncalculated(target)) {
|
|
134
|
-
passed = false;
|
|
135
|
-
issues.push(
|
|
136
|
-
issue(
|
|
137
|
-
assertionIndex,
|
|
138
|
-
'assertion_value_uncalculated',
|
|
139
|
-
`${sheet}!${assertion.cell} holds ${JSON.stringify(formulaText(target))} with no calculated result, so it cannot be compared with ${JSON.stringify(assertion.equals)}: ${UNCALCULATED_ROUTE}.`,
|
|
140
|
-
target?.path || `/sheet[${sheet}]/cell[${assertion.cell}]`
|
|
141
|
-
)
|
|
142
|
-
);
|
|
143
|
-
} else {
|
|
144
|
-
passed = Boolean(target) && sameValue(target.value, assertion.equals, assertion.tolerance);
|
|
145
|
-
if (!passed) {
|
|
146
|
-
issues.push(
|
|
147
|
-
issue(
|
|
148
|
-
assertionIndex,
|
|
149
|
-
'assertion_value_mismatch',
|
|
150
|
-
`Expected ${sheet}!${assertion.cell} to equal ${JSON.stringify(assertion.equals)}; actual value is ${JSON.stringify(target?.value ?? null)}.`,
|
|
151
|
-
target?.path || `/sheet[${sheet}]/cell[${assertion.cell}]`
|
|
152
|
-
)
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
} else if (kind === 'cell-formula') {
|
|
157
|
-
const actual = String(target?.formula || '');
|
|
158
|
-
const comparableActual = actual.replace(/^=/, '');
|
|
159
|
-
const comparableExpected = String(assertion.equals ?? '').replace(/^=/, '');
|
|
160
|
-
passed =
|
|
161
|
-
Boolean(target) &&
|
|
162
|
-
(assertion.equals !== undefined
|
|
163
|
-
? comparableActual === comparableExpected
|
|
164
|
-
: new RegExp(String(assertion.matches || '')).test(actual));
|
|
165
|
-
if (!passed)
|
|
166
|
-
issues.push(
|
|
167
|
-
issue(
|
|
168
|
-
assertionIndex,
|
|
169
|
-
'assertion_formula_mismatch',
|
|
170
|
-
`Formula assertion failed for ${sheet}!${assertion.cell}; actual formula is ${JSON.stringify(actual)}.`,
|
|
171
|
-
target?.path || `/sheet[${sheet}]/cell[${assertion.cell}]`
|
|
172
|
-
)
|
|
173
|
-
);
|
|
174
|
-
} else if (kind === 'tie-out') {
|
|
175
|
-
const left = get(assertion.left, sheet);
|
|
176
|
-
const right = get(assertion.right, sheet);
|
|
177
|
-
// Two sides that have not been calculated are both empty, and an empty
|
|
178
|
-
// pair used to tie out: the strictest check in the model answered "agreed"
|
|
179
|
-
// without a single number behind it.
|
|
180
|
-
const pending = [
|
|
181
|
-
[assertion.left, left],
|
|
182
|
-
[assertion.right, right],
|
|
183
|
-
].filter(([, cell]) => uncalculated(cell));
|
|
184
|
-
if (pending.length) {
|
|
185
|
-
passed = false;
|
|
186
|
-
issues.push(
|
|
187
|
-
issue(
|
|
188
|
-
assertionIndex,
|
|
189
|
-
'assertion_value_uncalculated',
|
|
190
|
-
`Tie-out cannot be read yet: ${pending.map(([reference, cell]) => `${JSON.stringify(reference)} holds ${JSON.stringify(formulaText(cell))} with no calculated result`).join(' and ')}; ${UNCALCULATED_ROUTE}.`,
|
|
191
|
-
pending[0][1]?.path || left?.path || right?.path || '/'
|
|
192
|
-
)
|
|
193
|
-
);
|
|
194
|
-
} else {
|
|
195
|
-
passed = Boolean(left && right) && sameValue(left.value, right.value, assertion.tolerance);
|
|
196
|
-
if (!passed)
|
|
197
|
-
issues.push(
|
|
198
|
-
issue(
|
|
199
|
-
assertionIndex,
|
|
200
|
-
'assertion_tie_out_failed',
|
|
201
|
-
`Tie-out failed: ${JSON.stringify(assertion.left)}=${JSON.stringify(left?.value ?? null)} and ${JSON.stringify(assertion.right)}=${JSON.stringify(right?.value ?? null)}.`,
|
|
202
|
-
left?.path || right?.path || '/'
|
|
203
|
-
)
|
|
204
|
-
);
|
|
205
|
-
}
|
|
206
|
-
} else if (kind === 'no-errors') {
|
|
207
|
-
const failures = cellsForAssertion(document, assertion).filter((cell) =>
|
|
208
|
-
ERROR_VALUE.test(String(cell.value || ''))
|
|
209
|
-
);
|
|
210
|
-
passed = failures.length === 0;
|
|
211
|
-
for (const cell of failures.slice(0, 100))
|
|
212
|
-
issues.push(
|
|
213
|
-
issue(
|
|
214
|
-
assertionIndex,
|
|
215
|
-
'assertion_formula_error',
|
|
216
|
-
`Formula error ${cell.value} violates no-errors assertion.`,
|
|
217
|
-
cell.path
|
|
218
|
-
)
|
|
219
|
-
);
|
|
220
|
-
} else if (kind === 'formula-consistency') {
|
|
221
|
-
const formulas = cellsForAssertion(document, assertion).filter((cell) => cell.formula);
|
|
222
|
-
const patterns = new Map();
|
|
223
|
-
for (const cell of formulas) {
|
|
224
|
-
const pattern = relativeFormulaSignature(cell.formula, cell.ref);
|
|
225
|
-
patterns.set(pattern, (patterns.get(pattern) || 0) + 1);
|
|
226
|
-
}
|
|
227
|
-
const expected = [...patterns.entries()].sort((left, right) => right[1] - left[1])[0]?.[0] || '';
|
|
228
|
-
const inconsistent = formulas.filter((cell) => relativeFormulaSignature(cell.formula, cell.ref) !== expected);
|
|
229
|
-
passed = formulas.length > 0 && inconsistent.length === 0;
|
|
230
|
-
if (!formulas.length)
|
|
231
|
-
issues.push(
|
|
232
|
-
issue(
|
|
233
|
-
assertionIndex,
|
|
234
|
-
'assertion_formula_missing',
|
|
235
|
-
'Formula-consistency assertion found no formulas.',
|
|
236
|
-
`/sheet[${assertion.sheet || sheet}]`
|
|
237
|
-
)
|
|
238
|
-
);
|
|
239
|
-
for (const cell of inconsistent.slice(0, 100))
|
|
240
|
-
issues.push(
|
|
241
|
-
issue(
|
|
242
|
-
assertionIndex,
|
|
243
|
-
'assertion_formula_inconsistent',
|
|
244
|
-
'Formula differs from the dominant pattern in the asserted region.',
|
|
245
|
-
cell.path
|
|
246
|
-
)
|
|
247
|
-
);
|
|
266
|
+
const check = ASSERTION_CHECKS.get(kind);
|
|
267
|
+
let passed = false;
|
|
268
|
+
if (check) {
|
|
269
|
+
passed = check({ document, assertion, assertionIndex, sheet, target, get, issues });
|
|
248
270
|
} else {
|
|
249
|
-
passed = false;
|
|
250
271
|
issues.push(
|
|
251
272
|
issue(assertionIndex, 'assertion_kind_unknown', `Unknown XLSX assertion kind: ${kind || '(missing)'}`)
|
|
252
273
|
);
|
|
@@ -93,17 +93,24 @@ export function hasVisibleStyle(style) {
|
|
|
93
93
|
return Number.isFinite(size) && size > 0 && size !== 11;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
// A range as an area bounded by both rows and columns, or null: a malformed
|
|
97
|
+
// range, or a whole-row or whole-column one, excludes nothing.
|
|
98
|
+
function boundedArea(range) {
|
|
99
|
+
try {
|
|
100
|
+
const area = parseAreaRange(String(range || '').replace(/\$/g, ''));
|
|
101
|
+
return area.startRow && area.startCol ? area : null;
|
|
102
|
+
} catch {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
96
107
|
// The Excel tables a sheet lists (both readers: `tables` [{ range }]), as
|
|
97
108
|
// areas; the body rows are records the table sources, not assumptions.
|
|
98
109
|
export function tableAreas(sheet) {
|
|
99
110
|
const areas = [];
|
|
100
111
|
for (const table of sheet?.tables || []) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
if (area.startRow && area.startCol) areas.push({ ...area, table });
|
|
104
|
-
} catch {
|
|
105
|
-
// A malformed range excludes nothing.
|
|
106
|
-
}
|
|
112
|
+
const area = boundedArea(table?.range);
|
|
113
|
+
if (area) areas.push({ ...area, table });
|
|
107
114
|
}
|
|
108
115
|
return areas;
|
|
109
116
|
}
|
|
@@ -113,12 +120,8 @@ export function tableAreas(sheet) {
|
|
|
113
120
|
export function mergedAreas(sheet) {
|
|
114
121
|
const areas = [];
|
|
115
122
|
for (const range of sheet?.mergedRanges || []) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
if (area.startRow && area.startCol) areas.push(area);
|
|
119
|
-
} catch {
|
|
120
|
-
// A malformed range excludes nothing.
|
|
121
|
-
}
|
|
123
|
+
const area = boundedArea(range);
|
|
124
|
+
if (area) areas.push(area);
|
|
122
125
|
}
|
|
123
126
|
return areas;
|
|
124
127
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { columnNumber } from './portable-cells.mjs';
|
|
2
|
-
import { quoteSheetName } from './portable-sheet-xml.mjs';
|
|
2
|
+
import { quoteSheetName, sheetQualifiedAreas } from './portable-sheet-xml.mjs';
|
|
3
3
|
import { escapeRegExp } from './xlsx-audit-support.mjs';
|
|
4
4
|
|
|
5
5
|
const XLSX_MAX_ROWS = 1_048_576;
|
|
@@ -293,6 +293,12 @@ function validateFreezePanes(operation) {
|
|
|
293
293
|
if (!Number.isInteger(column) || column < 0 || column > XLSX_MAX_COLUMNS) {
|
|
294
294
|
throw new Error(`XLSX freeze_panes column must be between 0 and ${XLSX_MAX_COLUMNS}`);
|
|
295
295
|
}
|
|
296
|
+
// row:1 read as "freeze one row" came back as a batch that changed nothing; it names the first row that scrolls.
|
|
297
|
+
if (row <= 1 && column <= 1) {
|
|
298
|
+
throw new Error(
|
|
299
|
+
'XLSX freeze_panes row and column name the first row and column that scroll, so this freezes nothing: row:2 keeps the header row (row 1) in view, column:2 keeps column A.'
|
|
300
|
+
);
|
|
301
|
+
}
|
|
296
302
|
}
|
|
297
303
|
|
|
298
304
|
function validateSortRange(operation) {
|
|
@@ -322,17 +328,50 @@ function validateConditionalFormat(operation) {
|
|
|
322
328
|
}
|
|
323
329
|
|
|
324
330
|
// A chart's source may be several areas joined by commas, the way Excel's
|
|
325
|
-
// Range("A7:A12,D7:D12") reads them; each one is a bounded range.
|
|
331
|
+
// Range("A7:A12,D7:D12") reads them; each one is a bounded range. The source
|
|
332
|
+
// may stand on another sheet ('월별 계산'!A1:A7,'월별 계산'!D1:D7), the way a
|
|
333
|
+
// summary sheet charts the calculation behind it — one sheet for every area.
|
|
326
334
|
function validateRangeOperation(operation, op) {
|
|
327
|
-
const parts =
|
|
328
|
-
op === 'add_chart'
|
|
329
|
-
? String(operation.range)
|
|
330
|
-
.split(',')
|
|
331
|
-
.map((part) => part.trim())
|
|
332
|
-
: [operation.range];
|
|
335
|
+
const parts = op === 'add_chart' ? chartSourceAreas(operation.range) : [operation.range];
|
|
333
336
|
const area = parseXlsxRange(parts[0]);
|
|
334
|
-
|
|
337
|
+
const areas = [area, ...parts.slice(1).map((part) => parseXlsxRange(part))];
|
|
335
338
|
if (op === 'set_range') validateRangeMatrix(operation, area);
|
|
339
|
+
if (op === 'add_chart') assertChartReadsItsData(operation, areas);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
function chartSourceAreas(range) {
|
|
343
|
+
const areas = sheetQualifiedAreas(range);
|
|
344
|
+
const named = new Set(areas.map((entry) => entry.sheet.toLowerCase()));
|
|
345
|
+
if (named.size > 1) {
|
|
346
|
+
throw new Error(
|
|
347
|
+
`XLSX add_chart ${range} names ${named.has('') ? 'a sheet on some areas and none on others' : 'more than one sheet'}; a chart reads one sheet, so name it on every area or on none`
|
|
348
|
+
);
|
|
349
|
+
}
|
|
350
|
+
return areas.map((entry) => entry.area);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// A chart read by columns takes its categories down the first column and a series from every other column. Given
|
|
354
|
+
// a row of periods (years across, one measure under them) it drew one category and a series per year — five bars
|
|
355
|
+
// in five colours over a single label, with no legend to say which year is which. That shape is refused with the
|
|
356
|
+
// reading it wanted named, before either backend draws it.
|
|
357
|
+
function assertChartReadsItsData(operation, areas) {
|
|
358
|
+
if (String(operation.plotBy || '').toLowerCase() === 'rows') {
|
|
359
|
+
// plotBy:'rows' turns one block a quarter: its first row the categories, its first column the series names.
|
|
360
|
+
// Given two areas joined by a comma, Excel drew a chart with no series while the portable writer refused them.
|
|
361
|
+
if (areas.length !== 1 || areas[0].rows < 2 || areas[0].columns < 2) {
|
|
362
|
+
throw new Error(
|
|
363
|
+
`XLSX add_chart ${operation.range}: plotBy:'rows' requires one bounded range whose first row holds the categories and whose first column names each series`
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
const rows = Math.max(...areas.map((part) => part.rows));
|
|
369
|
+
const columns = areas.reduce((total, part) => total + part.columns, 0);
|
|
370
|
+
if (rows === 2 && columns - 1 >= 3) {
|
|
371
|
+
throw new Error(
|
|
372
|
+
`XLSX add_chart ${operation.range} reads as ${columns - 1} series of one value each over a single category; a row of periods across the top wants plotBy:'rows' (the first row the categories, each row under it a series)`
|
|
373
|
+
);
|
|
374
|
+
}
|
|
336
375
|
}
|
|
337
376
|
|
|
338
377
|
function validateSpan(op, start, count, { field, limit, unit }) {
|
|
@@ -375,6 +414,10 @@ function validateXlsxOperation(operation) {
|
|
|
375
414
|
validateSpan(op, operation.row, operation.count ?? 1, { field: 'row', limit: XLSX_MAX_ROWS, unit: 'row' });
|
|
376
415
|
}
|
|
377
416
|
if (['insert_columns', 'delete_columns'].includes(op)) {
|
|
417
|
+
// A letter, as set_column_width and set_column_visibility take it, becomes the number both backends shift by.
|
|
418
|
+
if (typeof operation.column === 'string' && /^[A-Za-z]{1,3}$/.test(operation.column.trim())) {
|
|
419
|
+
operation.column = columnNumber(operation.column.trim().toUpperCase());
|
|
420
|
+
}
|
|
378
421
|
validateSpan(op, operation.column, operation.count ?? 1, {
|
|
379
422
|
field: 'column',
|
|
380
423
|
limit: XLSX_MAX_COLUMNS,
|