mixdog 0.9.172 → 0.9.173
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/scripts/code-graph-description-contract.mjs +1 -2
- package/scripts/context-renewal-live-check.mjs +1 -1
- package/scripts/coverage-query.mjs +27 -0
- package/scripts/generate-runtime-manifest.mjs +12 -16
- package/scripts/graph-parity.mjs +108 -75
- package/scripts/lib/coverage.mjs +309 -0
- package/scripts/lib/embedding-model-bench-core.mjs +4 -2
- package/scripts/lib/recall-bench-eval.mjs +4 -4
- package/scripts/lib/run-node-tests.mjs +137 -13
- package/scripts/lib/test-failure-records.mjs +46 -0
- package/scripts/lib/test-failure-summary.mjs +59 -0
- package/scripts/lib/test-summary-reporter.mjs +7 -3
- package/scripts/mouse-probe.mjs +1 -3
- package/scripts/office/build-pptx-icons.mjs +0 -1
- package/scripts/perf/transcript-runtime-probe.mjs +20 -4
- package/scripts/pg-memory-diet.mjs +2 -4
- package/scripts/routing-corpus.mjs +0 -2
- package/scripts/session-diag.mjs +0 -7
- package/scripts/session-sweep.mjs +102 -56
- package/scripts/test.mjs +113 -37
- package/scripts/tui-frame-harness.mjs +1 -1
- package/src/app.mjs +79 -74
- package/src/cli.mjs +0 -2
- package/src/defaults/skills/browser-use/SKILL.md +8 -6
- package/src/defaults/skills/code-tidy/SKILL.md +67 -17
- package/src/defaults/skills/code-tidy/references/agent-cleanup.md +26 -3
- package/src/defaults/skills/computer-use/SKILL.md +12 -5
- package/src/defaults/skills/goal-management/SKILL.md +16 -9
- package/src/defaults/skills/pdf/SKILL.md +2 -1
- package/src/defaults/skills/xlsx/SKILL.md +3 -3
- package/src/headless-exec.mjs +1 -2
- package/src/help.mjs +2 -2
- package/src/lib/rules-builder.cjs +0 -23
- package/src/repl/slash-commands.mjs +1 -5
- package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch/turn.mjs +4 -4
- package/src/runtime/agent/orchestrator/agent-runtime/cache-strategy.mjs +25 -41
- package/src/runtime/agent/orchestrator/agent-trace-format.mjs +25 -24
- package/src/runtime/agent/orchestrator/agent-trace-io.mjs +15 -22
- package/src/runtime/agent/orchestrator/agent-trace.mjs +0 -22
- package/src/runtime/agent/orchestrator/config-providers-merge.mjs +56 -0
- package/src/runtime/agent/orchestrator/config.mjs +34 -76
- package/src/runtime/agent/orchestrator/context/role-instructions.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/admission-scheduler.mjs +40 -39
- package/src/runtime/agent/orchestrator/providers/anthropic-api-recovery.mjs +75 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-api-request.mjs +152 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-api-transport.mjs +168 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-messages.mjs +2 -1
- package/src/runtime/agent/orchestrator/providers/anthropic-midstream-recovery.mjs +248 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-midstream.mjs +16 -206
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-recovery.mjs +11 -63
- package/src/runtime/agent/orchestrator/providers/anthropic-recovery-guards.mjs +86 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-turn-result.mjs +88 -0
- package/src/runtime/agent/orchestrator/providers/anthropic.mjs +87 -591
- package/src/runtime/agent/orchestrator/providers/antigravity-oauth.mjs +32 -288
- package/src/runtime/agent/orchestrator/providers/antigravity-response.mjs +101 -0
- package/src/runtime/agent/orchestrator/providers/antigravity-stream.mjs +161 -0
- package/src/runtime/agent/orchestrator/providers/antigravity-transport.mjs +114 -0
- package/src/runtime/agent/orchestrator/providers/gemini-cache-policy.mjs +266 -0
- package/src/runtime/agent/orchestrator/providers/gemini-request-body.mjs +54 -0
- package/src/runtime/agent/orchestrator/providers/gemini-response.mjs +145 -0
- package/src/runtime/agent/orchestrator/providers/gemini-schema.mjs +56 -39
- package/src/runtime/agent/orchestrator/providers/gemini-sdk-request.mjs +107 -0
- package/src/runtime/agent/orchestrator/providers/gemini.mjs +23 -533
- package/src/runtime/agent/orchestrator/providers/lib/anthropic-request-utils.mjs +10 -4
- package/src/runtime/agent/orchestrator/providers/media-normalization.mjs +83 -32
- package/src/runtime/agent/orchestrator/providers/openai-compat-responses.mjs +41 -25
- package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-outcome.mjs +4 -98
- package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-stamps.mjs +114 -0
- package/src/runtime/agent/orchestrator/providers/openai-oauth-dispatch.mjs +258 -0
- package/src/runtime/agent/orchestrator/providers/openai-oauth.mjs +48 -214
- package/src/runtime/agent/orchestrator/providers/openai-responses-input.mjs +80 -60
- package/src/runtime/agent/orchestrator/providers/openai-ws-handshake.mjs +108 -0
- package/src/runtime/agent/orchestrator/providers/openai-ws-pool.mjs +8 -87
- package/src/runtime/agent/orchestrator/providers/openai-ws-send-outcome.mjs +52 -293
- package/src/runtime/agent/orchestrator/providers/openai-ws-send-trace.mjs +316 -0
- package/src/runtime/agent/orchestrator/providers/opencode-go-usage.mjs +76 -253
- package/src/runtime/agent/orchestrator/session/cache/scoped-cache.mjs +1 -7
- package/src/runtime/agent/orchestrator/session/compact/budget.mjs +17 -16
- package/src/runtime/agent/orchestrator/session/compact/runner.mjs +6 -4
- package/src/runtime/agent/orchestrator/session/compact/summary-schema.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/context-compaction-policy.mjs +9 -13
- package/src/runtime/agent/orchestrator/session/context-utils.mjs +1 -2
- package/src/runtime/agent/orchestrator/session/evidence-union.mjs +6 -9
- package/src/runtime/agent/orchestrator/session/loop/compact-policy.mjs +2 -3
- package/src/runtime/agent/orchestrator/session/loop/diagnostics.mjs +1 -8
- package/src/runtime/agent/orchestrator/session/loop/tool-classify.mjs +1 -3
- package/src/runtime/agent/orchestrator/session/loop/tool-exec/call-prep.mjs +1 -5
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-execute.mjs +0 -1
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-loop-options.mjs +4 -55
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-steering-drain.mjs +63 -0
- package/src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/manager/foreign-pending-messages.mjs +80 -65
- package/src/runtime/agent/orchestrator/session/manager/pending-claim-ledger.mjs +68 -0
- package/src/runtime/agent/orchestrator/session/manager/pending-delivered-ledger.mjs +56 -0
- package/src/runtime/agent/orchestrator/session/manager/pending-lifecycle-epoch.mjs +84 -0
- package/src/runtime/agent/orchestrator/session/manager/pending-messages.mjs +51 -651
- package/src/runtime/agent/orchestrator/session/manager/pending-persist-queue.mjs +264 -0
- package/src/runtime/agent/orchestrator/session/manager/pending-spool-file.mjs +131 -0
- package/src/runtime/agent/orchestrator/session/manager/pending-spool-sweep.mjs +73 -0
- package/src/runtime/agent/orchestrator/session/manager/prepared-resume-cache.mjs +122 -0
- package/src/runtime/agent/orchestrator/session/manager/prompt-utils.mjs +2 -1
- package/src/runtime/agent/orchestrator/session/manager/runtime-liveness.mjs +5 -4
- package/src/runtime/agent/orchestrator/session/manager/session-close.mjs +60 -35
- package/src/runtime/agent/orchestrator/session/manager/session-crud.mjs +3 -2
- package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.mjs +22 -646
- package/src/runtime/agent/orchestrator/session/manager/session-owner-liveness.mjs +135 -0
- package/src/runtime/agent/orchestrator/session/manager/session-prompt-composition.mjs +150 -0
- package/src/runtime/agent/orchestrator/session/manager/session-record.mjs +154 -0
- package/src/runtime/agent/orchestrator/session/manager/session-tool-surface.mjs +135 -0
- package/src/runtime/agent/orchestrator/session/manager/tool-resolution.mjs +4 -11
- package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint-journal.mjs +0 -6
- package/src/runtime/agent/orchestrator/session/manager/usage-metrics.mjs +1 -3
- package/src/runtime/agent/orchestrator/session/pre-send-compact.mjs +11 -12
- package/src/runtime/agent/orchestrator/session/provider-prefix-guard.mjs +23 -32
- package/src/runtime/agent/orchestrator/session/store/lifecycle-barriers.mjs +275 -0
- package/src/runtime/agent/orchestrator/session/store/lifecycle-read.mjs +67 -0
- package/src/runtime/agent/orchestrator/session/store/listing.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/store/live-cache-eviction.mjs +72 -0
- package/src/runtime/agent/orchestrator/session/store/liveness-veto.mjs +53 -0
- package/src/runtime/agent/orchestrator/session/store/load-session.mjs +60 -0
- package/src/runtime/agent/orchestrator/session/store/pending-saves.mjs +55 -0
- package/src/runtime/agent/orchestrator/session/store/serialize.mjs +7 -15
- package/src/runtime/agent/orchestrator/session/store/session-delete.mjs +149 -0
- package/src/runtime/agent/orchestrator/session/store/session-observers.mjs +55 -0
- package/src/runtime/agent/orchestrator/session/store/write-admission.mjs +108 -0
- package/src/runtime/agent/orchestrator/session/store-agent-worker-rows.mjs +531 -0
- package/src/runtime/agent/orchestrator/session/store-summary-archived-agent.mjs +126 -0
- package/src/runtime/agent/orchestrator/session/store-summary-fields.mjs +24 -0
- package/src/runtime/agent/orchestrator/session/store-summary-index.mjs +2 -10
- package/src/runtime/agent/orchestrator/session/store-summary-locations.mjs +46 -0
- package/src/runtime/agent/orchestrator/session/store-summary-reader.mjs +11 -791
- package/src/runtime/agent/orchestrator/session/store-transcript-projection.mjs +126 -0
- package/src/runtime/agent/orchestrator/session/store.mjs +33 -771
- package/src/runtime/agent/orchestrator/session/tool-batch/finalize.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/tool-result-offload.mjs +13 -7
- package/src/runtime/agent/orchestrator/stable-hash-stringify.mjs +10 -0
- package/src/runtime/agent/orchestrator/tools/builtin/arg-guard.mjs +50 -75
- package/src/runtime/agent/orchestrator/tools/builtin/builtin-tools.mjs +2 -1
- package/src/runtime/agent/orchestrator/tools/builtin/cache-layers.mjs +22 -21
- package/src/runtime/agent/orchestrator/tools/builtin/external-tool-adapters.mjs +0 -2
- package/src/runtime/agent/orchestrator/tools/builtin/git-command-policy.mjs +44 -27
- package/src/runtime/agent/orchestrator/tools/builtin/git-command-tool.mjs +36 -54
- package/src/runtime/agent/orchestrator/tools/builtin/git-partial-stage.mjs +8 -5
- package/src/runtime/agent/orchestrator/tools/builtin/lib/grep-context-expander.mjs +8 -5
- package/src/runtime/agent/orchestrator/tools/builtin/lib/grep-output.mjs +18 -9
- package/src/runtime/agent/orchestrator/tools/builtin/lib/grep-request.mjs +2 -3
- package/src/runtime/agent/orchestrator/tools/builtin/lib/grep-single-file-rescue.mjs +80 -67
- package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-task-output.mjs +12 -4
- package/src/runtime/agent/orchestrator/tools/builtin/native-search-client.mjs +1 -4
- package/src/runtime/agent/orchestrator/tools/builtin/path-diagnostics.mjs +61 -72
- package/src/runtime/agent/orchestrator/tools/builtin/read-formatting.mjs +0 -5
- package/src/runtime/agent/orchestrator/tools/builtin/read-office-files.mjs +3 -3
- package/src/runtime/agent/orchestrator/tools/builtin/read-range-index.mjs +11 -14
- package/src/runtime/agent/orchestrator/tools/builtin/read-single-render.mjs +3 -6
- package/src/runtime/agent/orchestrator/tools/builtin/read-special-files.mjs +1 -2
- package/src/runtime/agent/orchestrator/tools/builtin/read-streaming.mjs +124 -94
- package/src/runtime/agent/orchestrator/tools/builtin/read-tool/batch-dispatch.mjs +6 -3
- package/src/runtime/agent/orchestrator/tools/builtin/read-tool/reach-preflight.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/read-tool.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/read-windows.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/search-builders.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/search-glob-tool.mjs +6 -6
- package/src/runtime/agent/orchestrator/tools/builtin/search-grep-tool.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/shell-analysis.mjs +21 -35
- package/src/runtime/agent/orchestrator/tools/builtin/shell-jobs.mjs +0 -3
- package/src/runtime/agent/orchestrator/tools/builtin/shell-lossless-compact.mjs +1 -3
- package/src/runtime/agent/orchestrator/tools/builtin/shell-output.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/shell-runtime.mjs +0 -2
- package/src/runtime/agent/orchestrator/tools/builtin/task-tool.mjs +4 -3
- package/src/runtime/agent/orchestrator/tools/builtin/text-stats.mjs +6 -3
- package/src/runtime/agent/orchestrator/tools/builtin.mjs +0 -4
- package/src/runtime/agent/orchestrator/tools/code-graph/aggregate-roots.mjs +7 -7
- package/src/runtime/agent/orchestrator/tools/code-graph/ast-calls.mjs +0 -3
- package/src/runtime/agent/orchestrator/tools/code-graph/build-file-infos.mjs +182 -0
- package/src/runtime/agent/orchestrator/tools/code-graph/build.mjs +14 -159
- package/src/runtime/agent/orchestrator/tools/code-graph/constants.mjs +2 -3
- package/src/runtime/agent/orchestrator/tools/code-graph/dispatch.mjs +21 -8
- package/src/runtime/agent/orchestrator/tools/code-graph/graph-binary.mjs +0 -3
- package/src/runtime/agent/orchestrator/tools/code-graph/search-references.mjs +5 -3
- package/src/runtime/agent/orchestrator/tools/code-graph/search.mjs +2 -3
- package/src/runtime/agent/orchestrator/tools/code-graph/symbol-index.mjs +1 -2
- package/src/runtime/agent/orchestrator/tools/code-graph/text-mask.golden.json +1 -1
- package/src/runtime/agent/orchestrator/tools/code-graph/text-mask.mjs +0 -1
- package/src/runtime/agent/orchestrator/tools/graph-manifest.json +11 -11
- package/src/runtime/agent/orchestrator/tools/lib/shell-run-state.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/lib/shell-warm-standby.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/patch/dispatch.mjs +3 -6
- package/src/runtime/agent/orchestrator/tools/patch/mutation-output.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/patch/native-server.mjs +25 -39
- package/src/runtime/agent/orchestrator/tools/patch/parsing.mjs +9 -14
- package/src/runtime/agent/orchestrator/tools/patch/paths.mjs +11 -6
- package/src/runtime/agent/orchestrator/tools/patch/replay-capture.mjs +5 -6
- package/src/runtime/agent/orchestrator/tools/patch/text-lines.mjs +4 -4
- package/src/runtime/agent/orchestrator/tools/patch/v4a-anchors.mjs +10 -7
- package/src/runtime/agent/orchestrator/tools/patch/v4a-convert.mjs +20 -30
- package/src/runtime/agent/orchestrator/tools/patch/v4a-windows.mjs +4 -19
- package/src/runtime/agent/orchestrator/tools/patch/wave.mjs +13 -2
- package/src/runtime/agent/orchestrator/tools/patch.mjs +0 -19
- package/src/runtime/agent/orchestrator/tools/shell-command.mjs +60 -36
- package/src/runtime/agent/orchestrator/tools/shell-exec-output.mjs +0 -4
- package/src/runtime/agent/orchestrator/tools/shell-policy.mjs +6 -7
- package/src/runtime/attachments/store.mjs +13 -12
- package/src/runtime/browser-bridge/client.mjs +19 -9
- package/src/runtime/channels/index.mjs +1 -1
- package/src/runtime/channels/lib/event-pipeline.mjs +8 -8
- package/src/runtime/channels/lib/event-queue.mjs +15 -20
- package/src/runtime/channels/lib/executor.mjs +10 -7
- package/src/runtime/channels/lib/owner-heartbeat.mjs +0 -4
- package/src/runtime/channels/lib/runtime-paths.mjs +30 -33
- package/src/runtime/channels/lib/scheduler.mjs +11 -20
- package/src/runtime/channels/lib/voice-runtime-fetcher.mjs +0 -4
- package/src/runtime/channels/lib/voice-transcription.mjs +127 -104
- package/src/runtime/channels/lib/webhook/verification.mjs +33 -20
- package/src/runtime/channels/lib/worker-bootstrap.mjs +0 -2
- package/src/runtime/channels/lib/worker-main.mjs +2 -2
- package/src/runtime/computer-bridge/action-schema.mjs +20 -0
- package/src/runtime/computer-bridge/core-actions.mjs +15 -0
- package/src/runtime/github/client.mjs +2 -3
- package/src/runtime/github/commands.mjs +9 -3
- package/src/runtime/github/contract.mjs +7 -0
- package/src/runtime/local-provider/catalog.mjs +4 -3
- package/src/runtime/local-provider/hardware.mjs +7 -20
- package/src/runtime/local-provider/resumable-installations.mjs +12 -19
- package/src/runtime/media/auth.mjs +16 -13
- package/src/runtime/media/catalog.mjs +14 -6
- package/src/runtime/media/lanes.mjs +2 -1
- package/src/runtime/memory/index.mjs +5 -10
- package/src/runtime/memory/lib/core-memory-store.mjs +3 -7
- package/src/runtime/memory/lib/embedding-provider.mjs +9 -19
- package/src/runtime/memory/lib/embedding-worker.mjs +24 -28
- package/src/runtime/memory/lib/http-router/admin-routes.mjs +5 -51
- package/src/runtime/memory/lib/http-router/admin-trace-routes.mjs +65 -0
- package/src/runtime/memory/lib/memory-action-handlers/cycle-actions.mjs +18 -143
- package/src/runtime/memory/lib/memory-action-handlers/cycle-backfill-action.mjs +84 -0
- package/src/runtime/memory/lib/memory-action-handlers/cycle-rebuild-action.mjs +94 -0
- package/src/runtime/memory/lib/memory-action-handlers/manage-actions.mjs +92 -53
- package/src/runtime/memory/lib/memory-categories.mjs +13 -0
- package/src/runtime/memory/lib/memory-chunk-quality.mjs +134 -74
- package/src/runtime/memory/lib/memory-cycle-requests.mjs +64 -70
- package/src/runtime/memory/lib/memory-cycle1.mjs +17 -33
- package/src/runtime/memory/lib/memory-embed.mjs +10 -2
- package/src/runtime/memory/lib/memory-ops-policy.mjs +3 -2
- package/src/runtime/memory/lib/memory-recall-scope-filter.mjs +1 -1
- package/src/runtime/memory/lib/memory.mjs +7 -35
- package/src/runtime/memory/lib/pg/adapter.mjs +3 -4
- package/src/runtime/memory/lib/pg/process.mjs +23 -28
- package/src/runtime/memory/lib/pg/supervisor.mjs +10 -11
- package/src/runtime/memory/lib/query-hybrid-search.mjs +2 -2
- package/src/runtime/memory/lib/query-maintenance-handlers.mjs +112 -89
- package/src/runtime/memory/lib/query-ranking.mjs +8 -11
- package/src/runtime/memory/lib/recall-format.mjs +6 -12
- package/src/runtime/memory/lib/recall-hybrid/plan.mjs +1 -1
- package/src/runtime/memory/lib/runtime-fetcher.mjs +73 -65
- package/src/runtime/memory/lib/trace-store.mjs +10 -19
- package/src/runtime/memory/lib/transcript-ingest.mjs +7 -4
- package/src/runtime/memory/tool-defs.mjs +5 -8
- package/src/runtime/office/authoring/pptx-author-action.mjs +2 -2
- package/src/runtime/office/authoring/pptx-author-session.mjs +6 -9
- package/src/runtime/office/authoring/pptx-brief.mjs +11 -4
- package/src/runtime/office/authoring/pptx-receipt.mjs +79 -60
- package/src/runtime/office/bench/benchmark.mjs +102 -82
- package/src/runtime/office/capabilities-catalog.mjs +2 -0
- package/src/runtime/office/capabilities-signatures.mjs +8 -0
- package/src/runtime/office/capabilities.mjs +3 -4
- package/src/runtime/office/com/com-adapter.mjs +13 -1
- package/src/runtime/office/com/office-com-host.ps1 +63 -1
- package/src/runtime/office/core/office-actions-batch.mjs +12 -12
- package/src/runtime/office/core/office-actions-open.mjs +2 -7
- package/src/runtime/office/core/office-core.mjs +20 -1
- package/src/runtime/office/core/office-finalize/session-save.mjs +9 -6
- package/src/runtime/office/core/office-session-dispatch.mjs +86 -0
- package/src/runtime/office/core/office-sessionless-actions.mjs +115 -0
- package/src/runtime/office/core/office-sessions.mjs +2 -2
- package/src/runtime/office/core/office-transactions.mjs +2 -4
- package/src/runtime/office/core/tabular.mjs +13 -16
- package/src/runtime/office/design/composition-system.mjs +32 -28
- package/src/runtime/office/design/content-model.mjs +2 -1
- package/src/runtime/office/design/design-art-direction.mjs +17 -14
- package/src/runtime/office/design/design-creative-director.mjs +1 -1
- package/src/runtime/office/design/design-discipline.mjs +8 -0
- package/src/runtime/office/design/design-tokens.mjs +9 -5
- package/src/runtime/office/design/docx/design-docx-components.mjs +88 -156
- package/src/runtime/office/design/library/design-library-pack.mjs +11 -23
- package/src/runtime/office/design/library/design-library.mjs +15 -37
- package/src/runtime/office/design/library/design-template-index.mjs +1 -9
- package/src/runtime/office/design/library/design-template-induct.mjs +2 -1
- package/src/runtime/office/design/native-design.mjs +2 -3
- package/src/runtime/office/index.mjs +7 -160
- package/src/runtime/office/pdf/pdf-adapter.mjs +17 -2
- package/src/runtime/office/pdf/pdf-ocr.mjs +2 -1
- package/src/runtime/office/pdf/pdf-render.mjs +12 -13
- package/src/runtime/office/pdf/pdf-writer.mjs +135 -6
- package/src/runtime/office/portable/docx-revisions.mjs +5 -5
- package/src/runtime/office/portable/docx-runs.mjs +4 -7
- package/src/runtime/office/portable/docx-tracked-edits.mjs +14 -9
- package/src/runtime/office/portable/font-provisioner.mjs +2 -2
- package/src/runtime/office/portable/ooxml-validator.mjs +4 -1
- package/src/runtime/office/portable/portable-docx-edits.mjs +61 -45
- package/src/runtime/office/portable/portable-docx-operations.mjs +13 -4
- package/src/runtime/office/portable/portable-docx-parts.mjs +59 -70
- package/src/runtime/office/portable/portable-docx-xml.mjs +3 -5
- package/src/runtime/office/portable/portable-opc.mjs +63 -39
- package/src/runtime/office/portable/portable-package.mjs +5 -23
- package/src/runtime/office/portable/portable-pptx-chart.mjs +7 -6
- package/src/runtime/office/portable/portable-pptx-charts.mjs +27 -20
- package/src/runtime/office/portable/portable-pptx-core.mjs +10 -21
- package/src/runtime/office/portable/portable-pptx-deck.mjs +5 -8
- package/src/runtime/office/portable/portable-pptx-package.mjs +23 -30
- package/src/runtime/office/portable/portable-pptx-shapes.mjs +21 -57
- package/src/runtime/office/portable/portable-sheet-audits.mjs +14 -36
- package/src/runtime/office/portable/portable-sheet-page.mjs +22 -23
- package/src/runtime/office/portable/portable-sheet-parts.mjs +4 -5
- package/src/runtime/office/portable/portable-sheet-styles.mjs +11 -19
- package/src/runtime/office/portable/portable-sheet-xml.mjs +15 -7
- package/src/runtime/office/portable/portable-slide-shapes.mjs +4 -0
- package/src/runtime/office/portable/portable-snapshot-pptx.mjs +2 -2
- package/src/runtime/office/portable/portable-snapshot-shared.mjs +1 -1
- package/src/runtime/office/portable/portable-snapshot-xlsx.mjs +16 -17
- package/src/runtime/office/portable/portable-soffice.mjs +176 -13
- package/src/runtime/office/portable/portable-validation-package.mjs +16 -18
- package/src/runtime/office/portable/portable-validation.mjs +57 -31
- package/src/runtime/office/portable/portable-xlsx-cell-values.mjs +15 -0
- package/src/runtime/office/portable/portable-xlsx-charts.mjs +192 -0
- package/src/runtime/office/portable/portable-xlsx-drawings.mjs +323 -0
- package/src/runtime/office/portable/portable-xlsx-operations.mjs +29 -627
- package/src/runtime/office/portable/portable-xlsx-pivot-ops.mjs +94 -0
- package/src/runtime/office/portable/portable-xlsx-range-layout.mjs +236 -0
- package/src/runtime/office/portable/portable-xlsx-sheet-edits.mjs +19 -14
- package/src/runtime/office/portable/portable-xlsx.mjs +32 -0
- package/src/runtime/office/portable/portable-xml.mjs +9 -0
- package/src/runtime/office/portable/pptx-relations.mjs +11 -0
- package/src/runtime/office/portable/pptx-targets.mjs +2 -1
- package/src/runtime/office/portable/review-editability.mjs +4 -11
- package/src/runtime/office/portable/text-metrics.mjs +35 -55
- package/src/runtime/office/portable/xlsx-assertions.mjs +2 -15
- package/src/runtime/office/portable/xlsx-audit-support.mjs +2 -6
- package/src/runtime/office/portable/xlsx-contract.mjs +4 -0
- package/src/runtime/office/portable/xlsx-formula-audit.mjs +11 -4
- package/src/runtime/office/portable/xlsx-recalculate.mjs +1 -1
- package/src/runtime/office/portable/xlsx-sheet-hygiene.mjs +5 -1
- package/src/runtime/office/quality/assurance-rendered.mjs +3 -2
- package/src/runtime/office/quality/assurance-structure-pptx.mjs +16 -15
- package/src/runtime/office/quality/assurance-trust.mjs +25 -10
- package/src/runtime/office/quality/design-aesthetics.mjs +172 -145
- package/src/runtime/office/quality/design-deck-diversity.mjs +2 -5
- package/src/runtime/office/quality/design-review-authored.mjs +2 -2
- package/src/runtime/office/quality/design-review-critique.mjs +36 -37
- package/src/runtime/office/quality/design-review.mjs +113 -96
- package/src/runtime/office/quality/document-acceptance.mjs +10 -3
- package/src/runtime/office/quality/inline-audit.mjs +7 -2
- package/src/runtime/office/quality/pptx-deck-rubric.mjs +14 -6
- package/src/runtime/office/quality/pptx-slide-roles.mjs +7 -9
- package/src/runtime/office/quality/presentation-acceptance.mjs +2 -6
- package/src/runtime/office/quality/quality-pipeline.mjs +21 -14
- package/src/runtime/office/quality/quality-score.mjs +2 -2
- package/src/runtime/office/quality/render-air.mjs +12 -5
- package/src/runtime/shared/atomic-file.mjs +19 -8
- package/src/runtime/shared/config.mjs +7 -13
- package/src/runtime/shared/err-text.mjs +11 -6
- package/src/runtime/shared/file-lock.mjs +10 -6
- package/src/runtime/shared/inline-file-kind.mjs +51 -0
- package/src/runtime/shared/llm/usage-accounting.mjs +9 -6
- package/src/runtime/shared/llm/usage-ledger-rollup.mjs +272 -0
- package/src/runtime/shared/llm/usage-ledger.mjs +8 -218
- package/src/runtime/shared/pristine-execution.mjs +2 -6
- package/src/runtime/shared/process-lifecycle.mjs +34 -52
- package/src/runtime/shared/process-shutdown.mjs +1 -1
- package/src/runtime/shared/schedule-model-ref.mjs +14 -0
- package/src/runtime/shared/schedule-session-run.mjs +3 -13
- package/src/runtime/shared/schedules-db.mjs +16 -39
- package/src/runtime/shared/staged-child-result.mjs +2 -7
- package/src/runtime/shared/staged-update.mjs +1 -5
- package/src/runtime/shared/tool-card-model/agent-surface.mjs +8 -3
- package/src/runtime/shared/tool-card-model/card-status.mjs +2 -1
- package/src/runtime/shared/tool-card-model/displayed-result.mjs +2 -3
- package/src/runtime/shared/tool-card-model/generic-detail.mjs +5 -3
- package/src/runtime/shared/tool-card-model.golden-cases.mjs +10 -2
- package/src/runtime/shared/tool-card-model.golden.json +3 -12
- package/src/runtime/shared/tool-execution-contract.mjs +22 -26
- package/src/runtime/shared/tool-result-summary.mjs +7 -14
- package/src/runtime/shared/tool-surface.mjs +30 -33
- package/src/runtime/shared/tool-work-units.mjs +12 -8
- package/src/runtime/shared/turn-snapshot-store.mjs +2 -4
- package/src/runtime/shared/turn-worktree-snapshot.mjs +13 -16
- package/src/runtime/shared/update-checker.mjs +5 -0
- package/src/runtime/shared/user-data-guard.mjs +10 -17
- package/src/runtime/shared/webhook-session-run.mjs +3 -15
- package/src/runtime/tidy/history-comment.mjs +32 -27
- package/src/runtime/tidy/process.mjs +18 -21
- package/src/runtime/tidy/report.mjs +50 -9
- package/src/runtime/tidy/resolve.mjs +13 -14
- package/src/runtime/tidy/runners/air.mjs +2 -20
- package/src/runtime/tidy/runners/biome.mjs +4 -6
- package/src/runtime/tidy/runners/dprint.mjs +2 -23
- package/src/runtime/tidy/runners/mago.mjs +2 -20
- package/src/runtime/tidy/runners/ruff.mjs +2 -8
- package/src/runtime/tidy/runners/shared.mjs +35 -9
- package/src/runtime/tidy/runners/stylua.mjs +2 -20
- package/src/runtime/tidy/shadow.mjs +138 -0
- package/src/runtime/tidy/tool.mjs +33 -0
- package/src/runtime/tidy/worktree.mjs +114 -0
- package/src/runtime/web-search/index.mjs +64 -68
- package/src/runtime/web-search/lib/http-fetch.mjs +39 -54
- package/src/runtime/web-search/lib/ssrf-guard.mjs +19 -52
- package/src/runtime/web-search/lib/web-tools.mjs +2 -2
- package/src/session-runtime/config-helpers.mjs +9 -9
- package/src/session-runtime/context-inspection.mjs +64 -23
- package/src/session-runtime/context-status-cache.mjs +0 -2
- package/src/session-runtime/context-status-inspection.mjs +54 -25
- package/src/session-runtime/context-status-shape.mjs +1 -18
- package/src/session-runtime/goal-facade-api.mjs +15 -12
- package/src/session-runtime/goal-mutations.mjs +4 -3
- package/src/session-runtime/goal-runtime.mjs +5 -0
- package/src/session-runtime/goal-tasks.mjs +5 -10
- package/src/session-runtime/goal-text.mjs +46 -9
- package/src/session-runtime/goal-tool-defs.mjs +7 -8
- package/src/session-runtime/goal-tool-exec.mjs +1 -1
- package/src/session-runtime/goal-turns.mjs +54 -3
- package/src/session-runtime/hook-payload.mjs +2 -1
- package/src/session-runtime/inheritance-fit.mjs +3 -3
- package/src/session-runtime/lifecycle/teardown.mjs +9 -1
- package/src/session-runtime/mcp-glue/server-catalog.mjs +4 -6
- package/src/session-runtime/model-capabilities.mjs +1 -3
- package/src/session-runtime/notification-bus.mjs +30 -7
- package/src/session-runtime/plugin-mcp.mjs +0 -2
- package/src/session-runtime/provider-auth/accounts.mjs +2 -2
- package/src/session-runtime/provider-auth/login.mjs +0 -7
- package/src/session-runtime/provider-usage.mjs +1 -1
- package/src/session-runtime/runtime-paths.mjs +1 -3
- package/src/session-runtime/session-hooks.mjs +37 -96
- package/src/session-runtime/statusline-route.mjs +1 -4
- package/src/session-runtime/tool-catalog-schema.mjs +0 -6
- package/src/session-runtime/tool-catalog.mjs +10 -15
- package/src/session-runtime/workflow-ids.mjs +1 -2
- package/src/standalone/agent-task-status.mjs +1 -2
- package/src/standalone/agent-tool/close-flow/close-all.mjs +67 -0
- package/src/standalone/agent-tool/close-flow.mjs +2 -58
- package/src/standalone/agent-tool/execute-send.mjs +91 -0
- package/src/standalone/agent-tool/execute-spawn.mjs +76 -0
- package/src/standalone/agent-tool/execute.mjs +7 -147
- package/src/standalone/agent-tool/helpers.mjs +3 -6
- package/src/standalone/agent-tool/notify/early-completion.mjs +58 -0
- package/src/standalone/agent-tool/notify.mjs +7 -55
- package/src/standalone/agent-tool/provider-init.mjs +73 -64
- package/src/standalone/agent-tool/render.mjs +123 -115
- package/src/standalone/agent-tool/spawn-flow/spawn-plan.mjs +89 -0
- package/src/standalone/agent-tool/spawn-flow/spawn-prep.mjs +16 -75
- package/src/standalone/agent-tool/spawn-flow/spawn-run.mjs +1 -1
- package/src/standalone/agent-tool/worker-rows.mjs +0 -7
- package/src/standalone/channel-admin.mjs +13 -18
- package/src/standalone/channel-transport/remote-binding.mjs +10 -79
- package/src/standalone/channel-transport/remote-intent.mjs +52 -0
- package/src/standalone/channel-transport/remote-notify.mjs +15 -107
- package/src/standalone/channel-transport/remote-pointer.mjs +124 -0
- package/src/standalone/channel-transport/remote-state.mjs +47 -0
- package/src/standalone/daemon-agent-control.mjs +65 -0
- package/src/standalone/daemon-channels-loader.mjs +60 -0
- package/src/standalone/daemon-desktop-runtime.mjs +28 -0
- package/src/standalone/daemon-local-session-bridge.mjs +62 -0
- package/src/standalone/daemon-stored-session-views.mjs +55 -0
- package/src/standalone/daemon.mjs +175 -320
- package/src/standalone/desktop-service-registry.mjs +9 -7
- package/src/standalone/folder-dialog.mjs +11 -12
- package/src/standalone/hook-bus/command-handler.mjs +60 -49
- package/src/standalone/hook-bus/event-runner.mjs +7 -74
- package/src/standalone/hook-bus/handler-dispatch.mjs +75 -0
- package/src/standalone/provider-admin.mjs +14 -35
- package/src/standalone/session-client/attachment-calls.mjs +67 -0
- package/src/standalone/session-client/stream-link.mjs +85 -0
- package/src/standalone/session-client.mjs +31 -106
- package/src/standalone/session-frame-stream.mjs +4 -2
- package/src/standalone/session-protocol.mjs +0 -1
- package/src/standalone/session-runtime-agent-control-client.mjs +11 -27
- package/src/standalone/session-runtime-agent-control.mjs +85 -0
- package/src/standalone/session-runtime-host.mjs +30 -472
- package/src/standalone/session-runtime-inline-host/telemetry.mjs +38 -0
- package/src/standalone/session-runtime-inline-host.mjs +6 -37
- package/src/standalone/session-runtime-proxy.mjs +164 -0
- package/src/standalone/session-runtime-shard-router.mjs +4 -7
- package/src/standalone/session-runtime-spawn-leases.mjs +82 -0
- package/src/standalone/session-runtime-worker.mjs +27 -7
- package/src/standalone/session-service/agent-tree/agent-child.mjs +59 -0
- package/src/standalone/session-service/agent-tree/agent-turns.mjs +4 -55
- package/src/standalone/session-service/agent-tree.mjs +3 -1
- package/src/standalone/session-service/entries/disposal.mjs +72 -0
- package/src/standalone/session-service/entries/external-binding.mjs +6 -3
- package/src/standalone/session-service/entries/lifecycle.mjs +15 -59
- package/src/standalone/session-service/retention/busy.mjs +50 -0
- package/src/standalone/session-service/retention.mjs +5 -44
- package/src/standalone/session-service/session-calls/goal-recovery.mjs +44 -0
- package/src/standalone/session-service/session-calls/session-action.mjs +5 -8
- package/src/standalone/session-service/session-calls/session-turns.mjs +12 -42
- package/src/standalone/session-service/session-calls/session-views.mjs +8 -8
- package/src/standalone/session-transport/stack.mjs +131 -0
- package/src/standalone/session-transport.mjs +10 -103
- package/src/standalone/usage-dashboard.mjs +167 -165
- package/src/standalone/usage-stats-model.mjs +117 -97
- package/src/tui/App.jsx +27 -210
- package/src/tui/app/app-format.mjs +7 -0
- package/src/tui/app/app-view/floating-panel.jsx +229 -0
- package/src/tui/app/app-view/text-entry-labels.mjs +81 -0
- package/src/tui/app/app-view/transcript-viewport/trailing-bands.jsx +94 -0
- package/src/tui/app/app-view/transcript-viewport/transcript-rows.jsx +87 -0
- package/src/tui/app/app-view/transcript-viewport.jsx +74 -0
- package/src/tui/app/app-view.jsx +12 -450
- package/src/tui/app/core-memory-picker/core-rows.mjs +32 -0
- package/src/tui/app/core-memory-picker/entry-prompts.mjs +45 -0
- package/src/tui/app/core-memory-picker/list-panels.mjs +75 -0
- package/src/tui/app/core-memory-picker.mjs +26 -120
- package/src/tui/app/doctor.mjs +17 -12
- package/src/tui/app/extension-pickers/skills-pickers/project-skills.mjs +38 -0
- package/src/tui/app/extension-pickers/skills-pickers/skill-detail.mjs +80 -0
- package/src/tui/app/extension-pickers/skills-pickers/skill-items.mjs +44 -0
- package/src/tui/app/extension-pickers/skills-pickers.mjs +31 -137
- package/src/tui/app/model-picker/route-selection/context-window.mjs +47 -0
- package/src/tui/app/model-picker/route-selection/effort.mjs +87 -0
- package/src/tui/app/model-picker/route-selection/fast-parameters.mjs +84 -0
- package/src/tui/app/model-picker/route-selection/model-key.mjs +5 -0
- package/src/tui/app/model-picker/route-selection.mjs +34 -200
- package/src/tui/app/mouse-input/edge-autoscroll.mjs +53 -0
- package/src/tui/app/mouse-input/geometry.mjs +109 -0
- package/src/tui/app/mouse-input/sgr-buttons.mjs +14 -0
- package/src/tui/app/mouse-input/wheel-router.mjs +96 -0
- package/src/tui/app/panel-signature.mjs +58 -0
- package/src/tui/app/project-picker/project-service.mjs +3 -7
- package/src/tui/app/prompt-submit.mjs +2 -7
- package/src/tui/app/provider-setup/api-key-actions.mjs +7 -80
- package/src/tui/app/provider-setup/oauth-actions.mjs +2 -10
- package/src/tui/app/provider-setup/provider-items.mjs +20 -3
- package/src/tui/app/settings-picker/settings-toggles/cycled.mjs +4 -0
- package/src/tui/app/settings-picker/settings-toggles/listed-cyclers.mjs +77 -0
- package/src/tui/app/settings-picker/settings-toggles/store-toggles.mjs +61 -0
- package/src/tui/app/settings-picker/settings-toggles/theme-cycler.mjs +36 -0
- package/src/tui/app/settings-picker/settings-toggles.mjs +21 -149
- package/src/tui/app/slash-commands.mjs +14 -4
- package/src/tui/app/store-service-call.mjs +17 -0
- package/src/tui/app/text-entry-policy.mjs +1 -3
- package/src/tui/app/transcript-row-estimate.mjs +31 -91
- package/src/tui/app/transcript-window.mjs +19 -0
- package/src/tui/app/use-disabled-skills.mjs +52 -0
- package/src/tui/app/use-global-key-input/copy-first.mjs +43 -0
- package/src/tui/app/use-global-key-input/shift-arrow.mjs +30 -0
- package/src/tui/app/use-global-key-input.mjs +10 -67
- package/src/tui/app/use-model-catalog-cache.mjs +86 -0
- package/src/tui/app/use-mouse-input.mjs +64 -218
- package/src/tui/app/use-pasted-buffers.mjs +55 -81
- package/src/tui/app/use-prompt-draft-flow/draft-change.mjs +66 -0
- package/src/tui/app/use-prompt-draft-flow/prompt-cancels.mjs +40 -0
- package/src/tui/app/use-prompt-draft-flow.mjs +38 -77
- package/src/tui/app/use-prompt-queue-history/prompt-history.mjs +22 -0
- package/src/tui/app/use-prompt-queue-history/restore-to-prompt.mjs +147 -0
- package/src/tui/app/use-prompt-queue-history.mjs +20 -117
- package/src/tui/app/use-selection-focus.mjs +2 -1
- package/src/tui/app/use-selection-geometry.mjs +9 -12
- package/src/tui/app/use-selection-paint/paint-queue.mjs +90 -0
- package/src/tui/app/use-selection-paint/selection-clip.mjs +33 -0
- package/src/tui/app/use-selection-paint.mjs +31 -102
- package/src/tui/app/use-transcript-activity.mjs +1 -1
- package/src/tui/app/use-transcript-window/instance-state.mjs +1 -1
- package/src/tui/app/use-welcome-prompt-hint.mjs +1 -1
- package/src/tui/app/workflow-cycle.mjs +63 -0
- package/src/tui/components/AnsiText.jsx +47 -15
- package/src/tui/components/ItemRightHintOverprint.jsx +2 -15
- package/src/tui/components/Picker.jsx +9 -23
- package/src/tui/components/PromptInput.jsx +89 -335
- package/src/tui/components/QueuedCommands.jsx +1 -3
- package/src/tui/components/Spinner.jsx +1 -2
- package/src/tui/components/StatusLine.jsx +11 -21
- package/src/tui/components/TextEntryPanel.jsx +5 -52
- package/src/tui/components/ToolExecution.jsx +5 -14
- package/src/tui/components/TranscriptItem.jsx +0 -2
- package/src/tui/components/TurnDone.jsx +2 -14
- package/src/tui/components/prompt-input/cursor-anchor.mjs +65 -0
- package/src/tui/components/prompt-input/edit-helpers.mjs +1 -2
- package/src/tui/components/prompt-input/key-signals.mjs +122 -0
- package/src/tui/components/prompt-input/mouse-selection.mjs +114 -0
- package/src/tui/components/prompt-input/restore-policy.d.mts +0 -1
- package/src/tui/components/prompt-input/restore-policy.mjs +3 -8
- package/src/tui/components/prompt-input/selected-text.jsx +25 -0
- package/src/tui/components/prompt-input/undo-stack.mjs +75 -0
- package/src/tui/components/tool-output-format.mjs +1 -2
- package/src/tui/dist/index.mjs +2841 -2469
- package/src/tui/index.jsx +2 -2
- package/src/tui/markdown/measure-rendered-rows.mjs +8 -33
- package/src/tui/markdown/render-ansi.mjs +5 -5
- package/src/tui/markdown/table-layout/box-lines.mjs +46 -0
- package/src/tui/markdown/table-layout/cells.mjs +23 -0
- package/src/tui/markdown/table-layout/column-widths.mjs +65 -0
- package/src/tui/markdown/table-layout/vertical-lines.mjs +46 -0
- package/src/tui/markdown/table-layout.mjs +21 -151
- package/src/tui/prompt-history-store.mjs +0 -9
- package/src/tui/session/active-tool-summary.mjs +19 -27
- package/src/tui/session/agent-envelope.mjs +9 -9
- package/src/tui/session/live-share/owner.mjs +9 -7
- package/src/tui/session/live-share/retry.mjs +15 -0
- package/src/tui/session/live-share/viewer/frame-router.mjs +32 -0
- package/src/tui/session/live-share/viewer/pipe-client.mjs +108 -0
- package/src/tui/session/live-share/viewer.mjs +23 -114
- package/src/tui/session/notice-surface.mjs +1 -1
- package/src/tui/session/notice-text.mjs +21 -17
- package/src/tui/session/queue-helpers.mjs +12 -14
- package/src/tui/session/session-api/intake/submission.mjs +3 -8
- package/src/tui/session/session-api/integrations.mjs +0 -11
- package/src/tui/session/session-api/lifecycle/session-reset.mjs +76 -74
- package/src/tui/session/session-flow/drain.mjs +18 -5
- package/src/tui/session/session-flow/queue/entry-shape.mjs +53 -0
- package/src/tui/session/session-flow/queue/take-entries.mjs +82 -0
- package/src/tui/session/session-flow/queue.mjs +10 -112
- package/src/tui/session/session-flow/session-reset.mjs +2 -7
- package/src/tui/session/tool-approval.mjs +13 -17
- package/src/tui/session/tool-result-text.mjs +16 -28
- package/src/tui/session/transcript-spill.mjs +3 -7
- package/src/tui/session/transcript-store/replace-items.mjs +66 -0
- package/src/tui/session/transcript-store/streaming-tail.mjs +49 -0
- package/src/tui/session/transcript-store.mjs +16 -95
- package/src/tui/statusline-ansi-bridge.mjs +1 -40
- package/src/ui/markdown.mjs +3 -2
- package/src/ui/statusline-agents.mjs +9 -14
- package/src/ui/statusline.mjs +4 -4
- package/src/runtime/channels/lib/cli-worker-host.mjs +0 -2
- package/src/runtime/memory/lib/llm-worker-host.mjs +0 -11
- package/src/standalone/opencode-go-login.mjs +0 -140
|
@@ -2,15 +2,12 @@
|
|
|
2
2
|
// two-phase exit (final frame flush, store dispose race, hard-exit timer),
|
|
3
3
|
// queued-message restore into the draft, the engine-published prompt
|
|
4
4
|
// history with its local-scan fallback, and history-nav reset.
|
|
5
|
+
// The restore flow itself lives in use-prompt-queue-history/restore-to-prompt.mjs
|
|
6
|
+
// and the local history scan in use-prompt-queue-history/prompt-history.mjs;
|
|
7
|
+
// this file owns the hooks and their dependencies.
|
|
5
8
|
import { useCallback, useMemo, useRef } from 'react';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
mergeQueuedRestoreDraft,
|
|
10
|
-
queuedRestorePrefix,
|
|
11
|
-
queuedRestoreProjection,
|
|
12
|
-
replaceQueuedRestorePrefix,
|
|
13
|
-
} from '../components/prompt-input/restore-policy.mjs';
|
|
9
|
+
import { scanPromptHistory } from './use-prompt-queue-history/prompt-history.mjs';
|
|
10
|
+
import { runRestoreQueuedToPrompt } from './use-prompt-queue-history/restore-to-prompt.mjs';
|
|
14
11
|
|
|
15
12
|
export function usePromptQueueHistory({
|
|
16
13
|
store,
|
|
@@ -59,102 +56,20 @@ export function usePromptQueueHistory({
|
|
|
59
56
|
}, [store, exit]);
|
|
60
57
|
|
|
61
58
|
const restoreQueuedToPrompt = useCallback(
|
|
62
|
-
(options = {}) =>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
cursor: String(currentText ?? '').length,
|
|
77
|
-
selectionAnchor: null,
|
|
78
|
-
};
|
|
79
|
-
let lastPublishedDraft = before;
|
|
80
|
-
const publishDraft = (next) => {
|
|
81
|
-
lastPublishedDraft = next;
|
|
82
|
-
promptValueRef.current = next.value;
|
|
83
|
-
syncPromptLayoutRows(next.value);
|
|
84
|
-
setPromptDraftOverride({ id: Date.now(), ...next });
|
|
85
|
-
};
|
|
86
|
-
const optimisticDraft = mergeQueuedRestoreDraft(projection.text, before);
|
|
87
|
-
const optimisticPrefix = queuedRestorePrefix(projection.text, before.value);
|
|
88
|
-
if (restoreDraft && optimisticPrefix) publishDraft(optimisticDraft);
|
|
89
|
-
const currentDraft = () => {
|
|
90
|
-
const latest = options.getCurrentDraft?.();
|
|
91
|
-
const refValue = String(promptValueRef.current ?? '');
|
|
92
|
-
if (latest && typeof latest === 'object' && String(latest.value ?? '') === refValue) return latest;
|
|
93
|
-
if (String(lastPublishedDraft.value ?? '') === refValue) return lastPublishedDraft;
|
|
94
|
-
return { value: refValue, cursor: refValue.length, selectionAnchor: null };
|
|
95
|
-
};
|
|
96
|
-
const reconcile = (authoritativeText = '') => {
|
|
97
|
-
if (!restoreDraft) return true;
|
|
98
|
-
const authoritativePrefix = queuedRestorePrefix(authoritativeText, before.value);
|
|
99
|
-
const next = replaceQueuedRestorePrefix(optimisticPrefix, authoritativePrefix, currentDraft());
|
|
100
|
-
if (!next.replaced) return false;
|
|
101
|
-
if (
|
|
102
|
-
next.value !== promptValueRef.current ||
|
|
103
|
-
next.cursor !== currentDraft().cursor ||
|
|
104
|
-
next.selectionAnchor !== currentDraft().selectionAnchor
|
|
105
|
-
) {
|
|
106
|
-
publishDraft(next);
|
|
107
|
-
}
|
|
108
|
-
return true;
|
|
109
|
-
};
|
|
110
|
-
const apply = (restored) => {
|
|
111
|
-
if (!restored || restored.count === 0) {
|
|
112
|
-
reconcile('');
|
|
113
|
-
if (showHint) showPromptHint('No queued messages to restore.', 'info');
|
|
114
|
-
return false;
|
|
115
|
-
}
|
|
116
|
-
if (restoreDraft) {
|
|
117
|
-
if (restored.pastedImages) installPastedImages(restored.pastedImages, { merge: true });
|
|
118
|
-
if (restored.pastedTexts) installPastedTexts(restored.pastedTexts, { merge: true });
|
|
119
|
-
reconcile(restored.text);
|
|
120
|
-
}
|
|
121
|
-
if (showHint) {
|
|
122
|
-
showPromptHint(`restored ${restored.count} queued message${restored.count === 1 ? '' : 's'}`, 'info');
|
|
123
|
-
} else {
|
|
124
|
-
clearPromptHint();
|
|
125
|
-
}
|
|
126
|
-
return true;
|
|
127
|
-
};
|
|
128
|
-
// Paint the published local-queue projection before
|
|
129
|
-
// asking the daemon to retire it, then reconcile attachments/text on ack.
|
|
130
|
-
let restored;
|
|
131
|
-
try {
|
|
132
|
-
restored = store.restoreQueued?.('');
|
|
133
|
-
} catch {
|
|
134
|
-
reconcile('');
|
|
135
|
-
if (showHint) showPromptHint('Could not restore queued messages.', 'error');
|
|
136
|
-
return true;
|
|
137
|
-
}
|
|
138
|
-
// A daemon-backed store answers this as an ASYNC remote call, so the
|
|
139
|
-
// payload (and with it the queued text) only exists a tick later. Reading
|
|
140
|
-
// `.count`/`.text` off the promise dropped the popped entries on the floor —
|
|
141
|
-
// the queued message vanished instead of returning to the draft. Decide the
|
|
142
|
-
// synchronous verdict from the published queue and fill the draft on settle.
|
|
143
|
-
if (restored && typeof restored.then === 'function') {
|
|
144
|
-
queuedRestoreInFlightRef.current = true;
|
|
145
|
-
void Promise.resolve(restored)
|
|
146
|
-
.then(apply)
|
|
147
|
-
.catch(() => {
|
|
148
|
-
reconcile('');
|
|
149
|
-
if (showHint) showPromptHint('Could not restore queued messages.', 'error');
|
|
150
|
-
})
|
|
151
|
-
.finally(() => {
|
|
152
|
-
queuedRestoreInFlightRef.current = false;
|
|
153
|
-
});
|
|
154
|
-
return queuedCount > 0;
|
|
155
|
-
}
|
|
156
|
-
return apply(restored);
|
|
157
|
-
},
|
|
59
|
+
(options = {}) =>
|
|
60
|
+
runRestoreQueuedToPrompt(options, {
|
|
61
|
+
store,
|
|
62
|
+
queued: state?.queued,
|
|
63
|
+
promptDraft,
|
|
64
|
+
promptValueRef,
|
|
65
|
+
inFlightRef: queuedRestoreInFlightRef,
|
|
66
|
+
showPromptHint,
|
|
67
|
+
clearPromptHint,
|
|
68
|
+
installPastedImages,
|
|
69
|
+
installPastedTexts,
|
|
70
|
+
syncPromptLayoutRows,
|
|
71
|
+
setPromptDraftOverride,
|
|
72
|
+
}),
|
|
158
73
|
[
|
|
159
74
|
store,
|
|
160
75
|
state?.queued,
|
|
@@ -174,19 +89,7 @@ export function usePromptQueueHistory({
|
|
|
174
89
|
// rescans all items on every transcript change. Fall back to a local scan
|
|
175
90
|
// only if the engine did not publish it (older snapshot).
|
|
176
91
|
if (Array.isArray(state.promptHistoryList)) return state.promptHistoryList;
|
|
177
|
-
|
|
178
|
-
const seen = new Set();
|
|
179
|
-
const history = [];
|
|
180
|
-
for (let i = items.length - 1; i >= 0 && history.length < PROMPT_HISTORY_LIMIT; i -= 1) {
|
|
181
|
-
const item = items[i];
|
|
182
|
-
if (item?.kind !== 'user') continue;
|
|
183
|
-
const text = String(item.text || '').trim();
|
|
184
|
-
const key = promptHistoryKey(text);
|
|
185
|
-
if (!key || seen.has(key)) continue;
|
|
186
|
-
seen.add(key);
|
|
187
|
-
history.push(text);
|
|
188
|
-
}
|
|
189
|
-
return history;
|
|
92
|
+
return scanPromptHistory(Array.isArray(state.items) ? state.items : []);
|
|
190
93
|
}, [state.promptHistoryList, state.items]);
|
|
191
94
|
|
|
192
95
|
const resetPromptHistoryNav = useCallback(() => {
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* edge-drag auto-scroll) instead of clamping the selection in place.
|
|
6
6
|
*/
|
|
7
7
|
import { useCallback } from 'react';
|
|
8
|
+
import { selectionRectIsDegenerate } from './transcript-window.mjs';
|
|
8
9
|
|
|
9
10
|
export function useSelectionFocusMove({
|
|
10
11
|
dragRef,
|
|
@@ -40,7 +41,7 @@ export function useSelectionFocusMove({
|
|
|
40
41
|
if (region !== 'transcript' && region !== 'status') return false;
|
|
41
42
|
const rect = drag.rect;
|
|
42
43
|
if (!rect) return false;
|
|
43
|
-
if (rect
|
|
44
|
+
if (selectionRectIsDegenerate(rect)) return false;
|
|
44
45
|
|
|
45
46
|
let anchor = { x: rect.x1, y: rect.y1 };
|
|
46
47
|
let col = rect.x2;
|
|
@@ -5,7 +5,12 @@
|
|
|
5
5
|
* column of a row, and the synchronous "is a grid selection live" predicate.
|
|
6
6
|
*/
|
|
7
7
|
import { useCallback, useRef } from 'react';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
compareCellOrder,
|
|
10
|
+
selectionRectIsDegenerate,
|
|
11
|
+
statusBandRowRange,
|
|
12
|
+
transcriptViewportRowRange,
|
|
13
|
+
} from './transcript-window.mjs';
|
|
9
14
|
|
|
10
15
|
export function useSelectionGeometry({
|
|
11
16
|
store,
|
|
@@ -63,17 +68,9 @@ export function useSelectionGeometry({
|
|
|
63
68
|
[store, frameColumns, selectionPointAtCurrentScroll]
|
|
64
69
|
);
|
|
65
70
|
|
|
66
|
-
const transcriptViewportRows = useCallback(() =>
|
|
67
|
-
const top = Math.max(0, Number(transcriptViewportRef.current?.top) || 0);
|
|
68
|
-
const bottom = Math.max(top, Number(transcriptViewportRef.current?.bottom) || top);
|
|
69
|
-
return { top, bottom };
|
|
70
|
-
}, []);
|
|
71
|
+
const transcriptViewportRows = useCallback(() => transcriptViewportRowRange(transcriptViewportRef.current), []);
|
|
71
72
|
|
|
72
|
-
const statusBandRows = useCallback(() =>
|
|
73
|
-
const rows = Math.max(1, Number(frameRowsRef.current) || 24);
|
|
74
|
-
const top = Math.max(0, rows - statuslineBandRows);
|
|
75
|
-
return { top, bottom: Math.max(top, rows - 1) };
|
|
76
|
-
}, []);
|
|
73
|
+
const statusBandRows = useCallback(() => statusBandRowRange(frameRowsRef.current, statuslineBandRows), []);
|
|
77
74
|
|
|
78
75
|
const selectionMaxColAtRow = useCallback(
|
|
79
76
|
(row) => {
|
|
@@ -94,7 +91,7 @@ export function useSelectionGeometry({
|
|
|
94
91
|
if (!drag || drag.active) return false;
|
|
95
92
|
if (drag.region !== 'transcript' && drag.region !== 'status') return false;
|
|
96
93
|
const rect = drag.rect;
|
|
97
|
-
return Boolean(rect) && !(rect
|
|
94
|
+
return Boolean(rect) && !selectionRectIsDegenerate(rect);
|
|
98
95
|
});
|
|
99
96
|
|
|
100
97
|
return {
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// use-selection-paint/paint-queue.mjs
|
|
2
|
+
// The paint state machine behind useSelectionPaint: publishing a rect to the
|
|
3
|
+
// renderer, and the motion throttle (SELECTION_PAINT_INTERVAL_MS) with its
|
|
4
|
+
// cancel/flush guards. Every helper takes the paint-state REF, so a pending
|
|
5
|
+
// timer reads the same live state the hook's callbacks do.
|
|
6
|
+
import { SELECTION_PAINT_INTERVAL_MS, selectionRectsEqual } from '../transcript-window.mjs';
|
|
7
|
+
|
|
8
|
+
/** Publishes `clippedRect` (or the null clear) and returns whether it painted. */
|
|
9
|
+
export function publishSelectionRect(
|
|
10
|
+
stateRef,
|
|
11
|
+
clippedRect,
|
|
12
|
+
{ store, rememberText, rememberSelectionTextSoon, harvestStitchRowsSoon }
|
|
13
|
+
) {
|
|
14
|
+
const nextRect = clippedRect || null;
|
|
15
|
+
const state = stateRef.current;
|
|
16
|
+
if (selectionRectsEqual(state.rect, nextRect)) {
|
|
17
|
+
const needsCapture = nextRect && rememberText && nextRect.captureText !== false;
|
|
18
|
+
if (!needsCapture) return false;
|
|
19
|
+
// Keep selection refreshes on Ink's normal maxFps render path. The
|
|
20
|
+
// selection rect itself is published synchronously by setSelection.
|
|
21
|
+
store.setRenderSelection?.(nextRect);
|
|
22
|
+
rememberSelectionTextSoon();
|
|
23
|
+
harvestStitchRowsSoon();
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
state.rect = nextRect;
|
|
27
|
+
state.t = Date.now();
|
|
28
|
+
store.setRenderSelection?.(nextRect);
|
|
29
|
+
if (nextRect && rememberText && nextRect.captureText !== false) rememberSelectionTextSoon();
|
|
30
|
+
if (nextRect) harvestStitchRowsSoon();
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Shared guard for EVERY direct (non-coalesced) paint path: a pending
|
|
35
|
+
// throttled repaint (state.timer/state.pending, armed by
|
|
36
|
+
// scheduleThrottledPaint) would fire AFTER a direct paint and stamp a stale
|
|
37
|
+
// pre-scroll/pre-direction rect over the current one — surfacing as two
|
|
38
|
+
// coexisting highlights. Cancel it before any direct paint.
|
|
39
|
+
export function cancelPendingPaint(stateRef) {
|
|
40
|
+
const state = stateRef.current;
|
|
41
|
+
if (state.timer) {
|
|
42
|
+
clearTimeout(state.timer);
|
|
43
|
+
state.timer = null;
|
|
44
|
+
}
|
|
45
|
+
state.pending = null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Publish an armed-but-unpainted coalesced rect NOW, so the throttled Ink
|
|
49
|
+
// render can consume the newest fast-drag rect. Paths that read the
|
|
50
|
+
// rendered selection (the pre-scroll stitch harvest) see the newest fast-drag
|
|
51
|
+
// rect rather than the previous rendered one. Cancel-only would drop the
|
|
52
|
+
// pending rect and lose rows it covered that scroll off before the rebuild.
|
|
53
|
+
export function flushPendingPaint(stateRef, paint) {
|
|
54
|
+
const state = stateRef.current;
|
|
55
|
+
if (!state.timer && !state.pending) return;
|
|
56
|
+
const pending = state.pending;
|
|
57
|
+
if (state.timer) {
|
|
58
|
+
clearTimeout(state.timer);
|
|
59
|
+
state.timer = null;
|
|
60
|
+
}
|
|
61
|
+
state.pending = null;
|
|
62
|
+
if (pending) paint(pending, { rememberText: false });
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Paints now when the interval has elapsed, otherwise arms the trailing timer. */
|
|
66
|
+
export function scheduleThrottledPaint(stateRef, clippedRect, { paint, cancelPending }) {
|
|
67
|
+
const state = stateRef.current;
|
|
68
|
+
if (selectionRectsEqual(state.rect, clippedRect)) return;
|
|
69
|
+
const now = Date.now();
|
|
70
|
+
const elapsed = now - state.t;
|
|
71
|
+
if (elapsed >= SELECTION_PAINT_INTERVAL_MS) {
|
|
72
|
+
cancelPending();
|
|
73
|
+
paint(clippedRect, { rememberText: false });
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
state.pending = clippedRect || null;
|
|
77
|
+
if (!state.timer) {
|
|
78
|
+
state.timer = setTimeout(
|
|
79
|
+
() => {
|
|
80
|
+
const current = stateRef.current;
|
|
81
|
+
const pending = current.pending;
|
|
82
|
+
current.timer = null;
|
|
83
|
+
current.pending = null;
|
|
84
|
+
paint(pending, { rememberText: false });
|
|
85
|
+
},
|
|
86
|
+
Math.max(1, SELECTION_PAINT_INTERVAL_MS - elapsed)
|
|
87
|
+
);
|
|
88
|
+
state.timer.unref?.();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// use-selection-paint/selection-clip.mjs
|
|
2
|
+
// Where a selection rect is allowed to paint, and the theme colours it carries
|
|
3
|
+
// to the renderer.
|
|
4
|
+
import { theme } from '../../theme.mjs';
|
|
5
|
+
import { statusBandRowRange, transcriptViewportRowRange } from '../transcript-window.mjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The row band of the region being dragged. The status-bar grid selection
|
|
9
|
+
* lives in the bottom statusline band, not the transcript viewport — clip
|
|
10
|
+
* there so the highlight cannot spill into the prompt/transcript rows.
|
|
11
|
+
* Everything else (transcript, word-select) keeps the transcript-viewport clip.
|
|
12
|
+
*/
|
|
13
|
+
export function selectionClipBand({ dragRef, frameRowsRef, transcriptViewportRef, statuslineBandRows }) {
|
|
14
|
+
const band =
|
|
15
|
+
dragRef.current.region === 'status'
|
|
16
|
+
? statusBandRowRange(frameRowsRef.current, statuslineBandRows)
|
|
17
|
+
: transcriptViewportRowRange(transcriptViewportRef.current);
|
|
18
|
+
return { y1: band.top, y2: band.bottom };
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** The rect as the renderer takes it: clipped to `clip` and themed. */
|
|
22
|
+
export function clipSelectionRect(rect, clip, options = {}) {
|
|
23
|
+
if (!rect) return null;
|
|
24
|
+
const clipped = {
|
|
25
|
+
...rect,
|
|
26
|
+
clipY1: clip.y1,
|
|
27
|
+
clipY2: Math.max(clip.y1, clip.y2),
|
|
28
|
+
selectionForeground: theme.selectionHighlightText || theme.selectionText,
|
|
29
|
+
selectionBackground: theme.selectionHighlightBackground || theme.selectionBackground,
|
|
30
|
+
};
|
|
31
|
+
if (options.captureText === false) clipped.captureText = false;
|
|
32
|
+
return clipped;
|
|
33
|
+
}
|
|
@@ -5,9 +5,15 @@
|
|
|
5
5
|
* with its cancel/flush guards. The stitch harvest hooks in on every paint.
|
|
6
6
|
*/
|
|
7
7
|
import { useCallback, useEffect, useRef } from 'react';
|
|
8
|
-
import {
|
|
9
|
-
import { SELECTION_PAINT_INTERVAL_MS, selectionRectsEqual } from './transcript-window.mjs';
|
|
8
|
+
import { selectionRectsEqual } from './transcript-window.mjs';
|
|
10
9
|
import { yieldToRenderer } from '../session/render-timing.mjs';
|
|
10
|
+
import {
|
|
11
|
+
cancelPendingPaint,
|
|
12
|
+
flushPendingPaint,
|
|
13
|
+
publishSelectionRect,
|
|
14
|
+
scheduleThrottledPaint,
|
|
15
|
+
} from './use-selection-paint/paint-queue.mjs';
|
|
16
|
+
import { clipSelectionRect, selectionClipBand } from './use-selection-paint/selection-clip.mjs';
|
|
11
17
|
|
|
12
18
|
export function useSelectionPaint({
|
|
13
19
|
store,
|
|
@@ -46,93 +52,35 @@ export function useSelectionPaint({
|
|
|
46
52
|
});
|
|
47
53
|
}, [store]);
|
|
48
54
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (dragRef.current.region === 'status') {
|
|
55
|
-
const rows = Math.max(1, Number(frameRowsRef.current) || 24);
|
|
56
|
-
const top = Math.max(0, rows - statuslineBandRows);
|
|
57
|
-
return { y1: top, y2: Math.max(top, rows - 1) };
|
|
58
|
-
}
|
|
59
|
-
return {
|
|
60
|
-
y1: Math.max(0, Number(transcriptViewportRef.current?.top) || 0),
|
|
61
|
-
y2: Math.max(0, Number(transcriptViewportRef.current?.bottom) || 0),
|
|
62
|
-
};
|
|
63
|
-
}, []);
|
|
55
|
+
// Clip band + theming: use-selection-paint/selection-clip.mjs.
|
|
56
|
+
const selectionClip = useCallback(
|
|
57
|
+
() => selectionClipBand({ dragRef, frameRowsRef, transcriptViewportRef, statuslineBandRows }),
|
|
58
|
+
[]
|
|
59
|
+
);
|
|
64
60
|
|
|
65
61
|
const withSelectionClip = useCallback(
|
|
66
|
-
(rect, options = {}) =>
|
|
67
|
-
if (!rect) return null;
|
|
68
|
-
const clip = selectionClip();
|
|
69
|
-
const clipped = {
|
|
70
|
-
...rect,
|
|
71
|
-
clipY1: clip.y1,
|
|
72
|
-
clipY2: Math.max(clip.y1, clip.y2),
|
|
73
|
-
selectionForeground: theme.selectionHighlightText || theme.selectionText,
|
|
74
|
-
selectionBackground: theme.selectionHighlightBackground || theme.selectionBackground,
|
|
75
|
-
};
|
|
76
|
-
if (options.captureText === false) clipped.captureText = false;
|
|
77
|
-
return clipped;
|
|
78
|
-
},
|
|
62
|
+
(rect, options = {}) => (rect ? clipSelectionRect(rect, selectionClip(), options) : null),
|
|
79
63
|
[selectionClip]
|
|
80
64
|
);
|
|
81
65
|
|
|
66
|
+
// Publish + throttle state machine: use-selection-paint/paint-queue.mjs.
|
|
82
67
|
const paintSelectionRect = useCallback(
|
|
83
|
-
(clippedRect, { rememberText = true } = {}) =>
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
// selection rect itself is published synchronously by setSelection.
|
|
91
|
-
store.setRenderSelection?.(nextRect);
|
|
92
|
-
rememberSelectionTextSoon();
|
|
93
|
-
harvestStitchRowsSoon();
|
|
94
|
-
return true;
|
|
95
|
-
}
|
|
96
|
-
state.rect = nextRect;
|
|
97
|
-
state.t = Date.now();
|
|
98
|
-
store.setRenderSelection?.(nextRect);
|
|
99
|
-
if (nextRect && rememberText && nextRect.captureText !== false) rememberSelectionTextSoon();
|
|
100
|
-
if (nextRect) harvestStitchRowsSoon();
|
|
101
|
-
return true;
|
|
102
|
-
},
|
|
68
|
+
(clippedRect, { rememberText = true } = {}) =>
|
|
69
|
+
publishSelectionRect(selectionPaintRef, clippedRect, {
|
|
70
|
+
store,
|
|
71
|
+
rememberText,
|
|
72
|
+
rememberSelectionTextSoon,
|
|
73
|
+
harvestStitchRowsSoon,
|
|
74
|
+
}),
|
|
103
75
|
[store, rememberSelectionTextSoon, harvestStitchRowsSoon]
|
|
104
76
|
);
|
|
105
77
|
|
|
106
|
-
|
|
107
|
-
// throttled repaint (state.timer/state.pending, armed by
|
|
108
|
-
// applySelectionRectThrottled) would fire AFTER a direct paint and stamp a
|
|
109
|
-
// stale pre-scroll/pre-direction rect over the current one — surfacing as two
|
|
110
|
-
// coexisting highlights. Cancel it before any direct paint.
|
|
111
|
-
const cancelPendingSelectionPaint = useCallback(() => {
|
|
112
|
-
const state = selectionPaintRef.current;
|
|
113
|
-
if (state.timer) {
|
|
114
|
-
clearTimeout(state.timer);
|
|
115
|
-
state.timer = null;
|
|
116
|
-
}
|
|
117
|
-
state.pending = null;
|
|
118
|
-
}, []);
|
|
78
|
+
const cancelPendingSelectionPaint = useCallback(() => cancelPendingPaint(selectionPaintRef), []);
|
|
119
79
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
// pending rect and lose rows it covered that scroll off before the rebuild.
|
|
125
|
-
const flushPendingSelectionPaint = useCallback(() => {
|
|
126
|
-
const state = selectionPaintRef.current;
|
|
127
|
-
if (!state.timer && !state.pending) return;
|
|
128
|
-
const pending = state.pending;
|
|
129
|
-
if (state.timer) {
|
|
130
|
-
clearTimeout(state.timer);
|
|
131
|
-
state.timer = null;
|
|
132
|
-
}
|
|
133
|
-
state.pending = null;
|
|
134
|
-
if (pending) paintSelectionRect(pending, { rememberText: false });
|
|
135
|
-
}, [paintSelectionRect]);
|
|
80
|
+
const flushPendingSelectionPaint = useCallback(
|
|
81
|
+
() => flushPendingPaint(selectionPaintRef, paintSelectionRect),
|
|
82
|
+
[paintSelectionRect]
|
|
83
|
+
);
|
|
136
84
|
|
|
137
85
|
const applySelectionRect = useCallback(
|
|
138
86
|
(rect) => {
|
|
@@ -154,29 +102,10 @@ export function useSelectionPaint({
|
|
|
154
102
|
const clippedRect = withSelectionClip(rect, { captureText: false });
|
|
155
103
|
if (selectionRectsEqual(dragRef.current.rect, clippedRect)) return;
|
|
156
104
|
dragRef.current.rect = clippedRect || null;
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
if (elapsed >= SELECTION_PAINT_INTERVAL_MS) {
|
|
162
|
-
cancelPendingSelectionPaint();
|
|
163
|
-
paintSelectionRect(clippedRect, { rememberText: false });
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
state.pending = clippedRect || null;
|
|
167
|
-
if (!state.timer) {
|
|
168
|
-
state.timer = setTimeout(
|
|
169
|
-
() => {
|
|
170
|
-
const current = selectionPaintRef.current;
|
|
171
|
-
const pending = current.pending;
|
|
172
|
-
current.timer = null;
|
|
173
|
-
current.pending = null;
|
|
174
|
-
paintSelectionRect(pending, { rememberText: false });
|
|
175
|
-
},
|
|
176
|
-
Math.max(1, SELECTION_PAINT_INTERVAL_MS - elapsed)
|
|
177
|
-
);
|
|
178
|
-
state.timer.unref?.();
|
|
179
|
-
}
|
|
105
|
+
scheduleThrottledPaint(selectionPaintRef, clippedRect, {
|
|
106
|
+
paint: paintSelectionRect,
|
|
107
|
+
cancelPending: cancelPendingSelectionPaint,
|
|
108
|
+
});
|
|
180
109
|
},
|
|
181
110
|
[paintSelectionRect, withSelectionClip, cancelPendingSelectionPaint]
|
|
182
111
|
);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { useLayoutEffect, useRef } from 'react';
|
|
6
6
|
import { createMeasureState, resetMeasureState } from '../transcript-measure.mjs';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
function freshViewportGeom() {
|
|
9
9
|
return { contentHeight: 0, floatingPanelRows: 0 };
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -23,7 +23,7 @@ export function useWelcomePromptHint({ store, state, toastErrorSignature }) {
|
|
|
23
23
|
const welcomePromptHintVisibleRef = useRef(false);
|
|
24
24
|
const dismissWelcomePromptHint = useCallback(() => {
|
|
25
25
|
if (!welcomePromptHintVisibleRef.current) return;
|
|
26
|
-
setWelcomePromptHintDismissed(
|
|
26
|
+
setWelcomePromptHintDismissed(true);
|
|
27
27
|
}, []);
|
|
28
28
|
|
|
29
29
|
useEffect(() => {
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* workflow-cycle.mjs — Tab at the prompt advances to the next workflow.
|
|
3
|
+
*
|
|
4
|
+
* Holding Tab can generate key-repeat faster than a workflow switch can
|
|
5
|
+
* settle. Without a prompt-local guard every repeat starts (or rejects) an
|
|
6
|
+
* async switch and pushes a toast, producing a rapid bottom-layout repaint
|
|
7
|
+
* storm that can visually tear the prompt box in Windows Terminal.
|
|
8
|
+
*
|
|
9
|
+
* Called from App.jsx's cycleWorkflowFromPrompt useCallback, which owns the
|
|
10
|
+
* guard ref and the surface-busy inputs; this module owns the cycle itself.
|
|
11
|
+
*/
|
|
12
|
+
import { workflowDisplayName, workflowSwitchNotice } from './app-format.mjs';
|
|
13
|
+
|
|
14
|
+
const REPEAT_GUARD_MS = 300;
|
|
15
|
+
|
|
16
|
+
/** Answers true either way: the key stays consumed by the prompt. */
|
|
17
|
+
export function cycleWorkflowFromPrompt({ store, state, cycleGuard }) {
|
|
18
|
+
const now = Date.now();
|
|
19
|
+
if (state.commandBusy || cycleGuard.pending || now - cycleGuard.lastAt < REPEAT_GUARD_MS) {
|
|
20
|
+
cycleGuard.lastAt = now;
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
cycleGuard.lastAt = now;
|
|
24
|
+
cycleGuard.pending = true;
|
|
25
|
+
// listWorkflows is a remote call on a daemon-backed store, so the whole
|
|
26
|
+
// cycle runs off its resolution; the handler still answers `true` at once
|
|
27
|
+
// so the key stays consumed.
|
|
28
|
+
void Promise.resolve(store.listWorkflows?.())
|
|
29
|
+
.then((list) => {
|
|
30
|
+
const workflows = Array.isArray(list) ? list : [];
|
|
31
|
+
if (!workflows.length) {
|
|
32
|
+
store.pushNotice('no workflows available', 'warn');
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const workflow = state.workflow || {};
|
|
36
|
+
if (workflows.length < 2) {
|
|
37
|
+
store.pushNotice(`Workflow: ${workflowDisplayName(workflows[0] || workflow)}`, 'info');
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const activeIndex = workflows.findIndex((item) => item.active);
|
|
41
|
+
const currentIndex =
|
|
42
|
+
activeIndex >= 0
|
|
43
|
+
? activeIndex
|
|
44
|
+
: Math.max(
|
|
45
|
+
0,
|
|
46
|
+
workflows.findIndex((item) => item.id === workflow.id)
|
|
47
|
+
);
|
|
48
|
+
const next = workflows[(currentIndex + 1 + workflows.length) % workflows.length];
|
|
49
|
+
return store.setWorkflow?.(next.id);
|
|
50
|
+
})
|
|
51
|
+
.then((result) => {
|
|
52
|
+
if (!result) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
store.pushNotice(workflowSwitchNotice(result), 'info', { ttlMs: 1200 });
|
|
56
|
+
})
|
|
57
|
+
.catch((e) => store.pushNotice(`Couldn’t switch workflow: ${e?.message || e}`, 'error'))
|
|
58
|
+
.finally(() => {
|
|
59
|
+
cycleGuard.pending = false;
|
|
60
|
+
cycleGuard.lastAt = Date.now();
|
|
61
|
+
});
|
|
62
|
+
return true;
|
|
63
|
+
}
|