@herbertgao/pi-extensions 2026.9.6 → 2026.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -8
- package/THIRD_PARTY_NOTICES.md +0 -4
- package/node_modules/@narumitw/pi-btw/README.md +2 -0
- package/node_modules/@narumitw/pi-btw/dist/index.ts +284 -365
- package/node_modules/@narumitw/pi-btw/dist/index.ts.map +3 -3
- package/node_modules/@narumitw/pi-btw/package.json +52 -53
- package/node_modules/@narumitw/pi-btw/src/bring-to-main.ts +494 -547
- package/node_modules/@narumitw/pi-btw/src/btw.ts +814 -856
- package/node_modules/@narumitw/pi-btw/src/fullscreen-ui.ts +673 -674
- package/node_modules/@narumitw/pi-btw/src/keybindings.ts +228 -270
- package/node_modules/@narumitw/pi-btw/src/main-tree-picker.ts +309 -318
- package/node_modules/@narumitw/pi-btw/src/menu.ts +416 -454
- package/node_modules/@narumitw/pi-btw/src/settings.ts +203 -219
- package/node_modules/@narumitw/pi-btw/src/side-thread.ts +173 -201
- package/node_modules/@narumitw/pi-btw/src/text.ts +21 -23
- package/node_modules/@narumitw/pi-btw/src/transcript-markdown.ts +65 -0
- package/node_modules/@narumitw/pi-btw/src/transcript-pager.ts +611 -662
- package/node_modules/grok-mermaid/CHANGELOG.md +46 -0
- package/node_modules/grok-mermaid/LICENSE +205 -0
- package/node_modules/grok-mermaid/README.md +191 -0
- package/node_modules/grok-mermaid/dist/ansi.d.ts +16 -0
- package/node_modules/grok-mermaid/dist/ansi.d.ts.map +1 -0
- package/node_modules/grok-mermaid/dist/ansi.js +23 -0
- package/node_modules/grok-mermaid/dist/ansi.js.map +1 -0
- package/node_modules/grok-mermaid/dist/canvas.d.ts +87 -0
- package/node_modules/grok-mermaid/dist/canvas.d.ts.map +1 -0
- package/node_modules/grok-mermaid/dist/canvas.js +366 -0
- package/node_modules/grok-mermaid/dist/canvas.js.map +1 -0
- package/node_modules/grok-mermaid/dist/graph.d.ts +74 -0
- package/node_modules/grok-mermaid/dist/graph.d.ts.map +1 -0
- package/node_modules/grok-mermaid/dist/graph.js +91 -0
- package/node_modules/grok-mermaid/dist/graph.js.map +1 -0
- package/node_modules/grok-mermaid/dist/index.d.ts +32 -0
- package/node_modules/grok-mermaid/dist/index.d.ts.map +1 -0
- package/node_modules/grok-mermaid/dist/index.js +100 -0
- package/node_modules/grok-mermaid/dist/index.js.map +1 -0
- package/node_modules/grok-mermaid/dist/labels.d.ts +62 -0
- package/node_modules/grok-mermaid/dist/labels.d.ts.map +1 -0
- package/node_modules/grok-mermaid/dist/labels.js +324 -0
- package/node_modules/grok-mermaid/dist/labels.js.map +1 -0
- package/node_modules/grok-mermaid/dist/layout-seq.d.ts +12 -0
- package/node_modules/grok-mermaid/dist/layout-seq.d.ts.map +1 -0
- package/node_modules/grok-mermaid/dist/layout-seq.js +194 -0
- package/node_modules/grok-mermaid/dist/layout-seq.js.map +1 -0
- package/node_modules/grok-mermaid/dist/layout.d.ts +87 -0
- package/node_modules/grok-mermaid/dist/layout.d.ts.map +1 -0
- package/node_modules/grok-mermaid/dist/layout.js +881 -0
- package/node_modules/grok-mermaid/dist/layout.js.map +1 -0
- package/node_modules/grok-mermaid/dist/parse.d.ts +83 -0
- package/node_modules/grok-mermaid/dist/parse.d.ts.map +1 -0
- package/node_modules/grok-mermaid/dist/parse.js +1151 -0
- package/node_modules/grok-mermaid/dist/parse.js.map +1 -0
- package/node_modules/grok-mermaid/dist/source-box.d.ts +18 -0
- package/node_modules/grok-mermaid/dist/source-box.d.ts.map +1 -0
- package/node_modules/grok-mermaid/dist/source-box.js +78 -0
- package/node_modules/grok-mermaid/dist/source-box.js.map +1 -0
- package/node_modules/grok-mermaid/dist/types.d.ts +42 -0
- package/node_modules/grok-mermaid/dist/types.d.ts.map +1 -0
- package/node_modules/grok-mermaid/dist/types.js +1 -0
- package/node_modules/grok-mermaid/dist/types.js.map +1 -0
- package/node_modules/grok-mermaid/dist/width-data.d.ts +2 -0
- package/node_modules/grok-mermaid/dist/width-data.d.ts.map +1 -0
- package/node_modules/grok-mermaid/dist/width-data.js +994 -0
- package/node_modules/grok-mermaid/dist/width-data.js.map +1 -0
- package/node_modules/grok-mermaid/dist/width.d.ts +18 -0
- package/node_modules/grok-mermaid/dist/width.d.ts.map +1 -0
- package/node_modules/grok-mermaid/dist/width.js +76 -0
- package/node_modules/grok-mermaid/dist/width.js.map +1 -0
- package/node_modules/grok-mermaid/package.json +49 -0
- package/node_modules/grok-mermaid/src/ansi.ts +34 -0
- package/node_modules/grok-mermaid/src/canvas.ts +373 -0
- package/node_modules/grok-mermaid/src/graph.ts +142 -0
- package/node_modules/grok-mermaid/src/index.ts +104 -0
- package/node_modules/grok-mermaid/src/labels.ts +326 -0
- package/node_modules/grok-mermaid/src/layout-seq.ts +203 -0
- package/node_modules/grok-mermaid/src/layout.ts +1015 -0
- package/node_modules/grok-mermaid/src/parse.ts +1189 -0
- package/node_modules/grok-mermaid/src/source-box.ts +89 -0
- package/node_modules/grok-mermaid/src/types.ts +43 -0
- package/node_modules/grok-mermaid/src/width-data.ts +993 -0
- package/node_modules/grok-mermaid/src/width.ts +74 -0
- package/node_modules/pi-lens/CHANGELOG.md +239 -0
- package/node_modules/pi-lens/config/dependency-cruiser-eager-allowlist.json +3 -0
- package/node_modules/pi-lens/dist/clients/actionable-warnings.js +30 -4
- package/node_modules/pi-lens/dist/clients/agent-behavior-client.js +2 -0
- package/node_modules/pi-lens/dist/clients/bash-file-access.js +26 -0
- package/node_modules/pi-lens/dist/clients/biome-client.js +1 -1
- package/node_modules/pi-lens/dist/clients/blocker-freshness.js +403 -35
- package/node_modules/pi-lens/dist/clients/bootstrap.js +6 -1
- package/node_modules/pi-lens/dist/clients/cascade-format.js +200 -4
- package/node_modules/pi-lens/dist/clients/code-quality-warnings.js +10 -2
- package/node_modules/pi-lens/dist/clients/degradation-ledger.js +16 -1
- package/node_modules/pi-lens/dist/clients/diagnostic-dispositions.js +12 -1
- package/node_modules/pi-lens/dist/clients/dispatch/ast-grep-catalog.js +65 -0
- package/node_modules/pi-lens/dist/clients/dispatch/auxiliary-lsp.js +28 -0
- package/node_modules/pi-lens/dist/clients/dispatch/dispatcher.js +9 -2
- package/node_modules/pi-lens/dist/clients/dispatch/finding-policy.js +222 -0
- package/node_modules/pi-lens/dist/clients/dispatch/indent-detect.js +389 -13
- package/node_modules/pi-lens/dist/clients/dispatch/integration.js +175 -25
- package/node_modules/pi-lens/dist/clients/dispatch/rule-ignores.js +62 -0
- package/node_modules/pi-lens/dist/clients/dispatch/runners/ast-grep-napi.js +21 -41
- package/node_modules/pi-lens/dist/clients/dispatch/runners/biome-check.js +6 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/rust-clippy.js +7 -7
- package/node_modules/pi-lens/dist/clients/dispatch/runners/shfmt.js +2 -12
- package/node_modules/pi-lens/dist/clients/dispatch/runners/tree-sitter.js +2 -21
- package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/runner-helpers.js +1 -1
- package/node_modules/pi-lens/dist/clients/dispatch/types.js +4 -1
- package/node_modules/pi-lens/dist/clients/disposition-publish.js +1 -0
- package/node_modules/pi-lens/dist/clients/effective-config.js +1 -1
- package/node_modules/pi-lens/dist/clients/file-kinds.js +26 -1
- package/node_modules/pi-lens/dist/clients/file-role.js +21 -21
- package/node_modules/pi-lens/dist/clients/file-utils.js +156 -10
- package/node_modules/pi-lens/dist/clients/finding-delivery-gate.js +56 -9
- package/node_modules/pi-lens/dist/clients/format-service.js +39 -21
- package/node_modules/pi-lens/dist/clients/formatters.js +60 -13
- package/node_modules/pi-lens/dist/clients/generation-guard.js +2 -2
- package/node_modules/pi-lens/dist/clients/git-guard.js +11 -3
- package/node_modules/pi-lens/dist/clients/indent-retarget.js +78 -8
- package/node_modules/pi-lens/dist/clients/installer/index.js +333 -114
- package/node_modules/pi-lens/dist/clients/instance-reaper-state.js +7 -0
- package/node_modules/pi-lens/dist/clients/instance-reaper.js +20 -10
- package/node_modules/pi-lens/dist/clients/language-profile.js +23 -1
- package/node_modules/pi-lens/dist/clients/language-registry.js +5 -1
- package/node_modules/pi-lens/dist/clients/latency-logger.js +4 -1
- package/node_modules/pi-lens/dist/clients/lens-engine.js +12 -3
- package/node_modules/pi-lens/dist/clients/lens-events.js +2 -1
- package/node_modules/pi-lens/dist/clients/lens-flag-registry.js +79 -0
- package/node_modules/pi-lens/dist/clients/live-bus-emitter.js +2 -1
- package/node_modules/pi-lens/dist/clients/lsp/client.js +25 -21
- package/node_modules/pi-lens/dist/clients/lsp/config.js +2 -2
- package/node_modules/pi-lens/dist/clients/lsp/index.js +7 -0
- package/node_modules/pi-lens/dist/clients/lsp/launch.js +16 -4
- package/node_modules/pi-lens/dist/clients/lsp/server.js +19 -2
- package/node_modules/pi-lens/dist/clients/lsp/workspace-diagnostics-cache.js +2 -1
- package/node_modules/pi-lens/dist/clients/lsp-mutation.js +5 -3
- package/node_modules/pi-lens/dist/clients/map-with-concurrency.js +12 -8
- package/node_modules/pi-lens/dist/clients/mcp/session.js +36 -4
- package/node_modules/pi-lens/dist/clients/ndjson-logger.js +24 -7
- package/node_modules/pi-lens/dist/clients/observed-mutation.js +40 -2
- package/node_modules/pi-lens/dist/clients/opaque-mutation-scan.js +23 -3
- package/node_modules/pi-lens/dist/clients/opengrep-client.js +110 -15
- package/node_modules/pi-lens/dist/clients/path-utils.js +123 -3
- package/node_modules/pi-lens/dist/clients/performance-report.js +5 -1
- package/node_modules/pi-lens/dist/clients/php-cs-fixer-config.js +1 -1
- package/node_modules/pi-lens/dist/clients/pipeline.js +74 -5
- package/node_modules/pi-lens/dist/clients/project-diagnostics/cache.js +37 -5
- package/node_modules/pi-lens/dist/clients/project-diagnostics/fresh-fetch.js +145 -18
- package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/dead-code.js +4 -1
- package/node_modules/pi-lens/dist/clients/project-diagnostics/scanner.js +59 -3
- package/node_modules/pi-lens/dist/clients/project-lens-config.js +45 -2
- package/node_modules/pi-lens/dist/clients/read-guard.js +70 -11
- package/node_modules/pi-lens/dist/clients/resource-sampler.js +147 -9
- package/node_modules/pi-lens/dist/clients/ruff-client.js +1 -1
- package/node_modules/pi-lens/dist/clients/runtime-agent-end.js +33 -5
- package/node_modules/pi-lens/dist/clients/runtime-context.js +6 -2
- package/node_modules/pi-lens/dist/clients/runtime-coordinator.js +77 -7
- package/node_modules/pi-lens/dist/clients/runtime-session.js +21 -2
- package/node_modules/pi-lens/dist/clients/runtime-tool-call.js +43 -12
- package/node_modules/pi-lens/dist/clients/runtime-tool-result.js +330 -85
- package/node_modules/pi-lens/dist/clients/runtime-turn.js +147 -17
- package/node_modules/pi-lens/dist/clients/safe-spawn.js +258 -5
- package/node_modules/pi-lens/dist/clients/scratch-tree-policy.js +6 -0
- package/node_modules/pi-lens/dist/clients/session-event-guard.js +50 -5
- package/node_modules/pi-lens/dist/clients/sg-runner.js +23 -11
- package/node_modules/pi-lens/dist/clients/sgconfig.js +79 -2
- package/node_modules/pi-lens/dist/clients/test-runner-client.js +6 -41
- package/node_modules/pi-lens/dist/clients/test-runner-delivery.js +43 -0
- package/node_modules/pi-lens/dist/clients/tool-agreement.js +423 -0
- package/node_modules/pi-lens/dist/clients/tool-config.js +50 -0
- package/node_modules/pi-lens/dist/clients/tool-cwd.js +47 -76
- package/node_modules/pi-lens/dist/clients/tool-policy.js +163 -7
- package/node_modules/pi-lens/dist/clients/tree-sitter-client.js +120 -0
- package/node_modules/pi-lens/dist/clients/tree-sitter-query-loader.js +127 -189
- package/node_modules/pi-lens/dist/clients/widget-state.js +98 -0
- package/node_modules/pi-lens/dist/clients/word-index.js +5 -2
- package/node_modules/pi-lens/dist/clients/write-ordering-guard.js +7 -0
- package/node_modules/pi-lens/dist/index.js +27416 -24153
- package/node_modules/pi-lens/dist/mcp/server.js +5 -2
- package/node_modules/pi-lens/dist/tools/lens-diagnostic-mark.js +7 -1
- package/node_modules/pi-lens/dist/tools/lens-diagnostics.js +168 -53
- package/node_modules/pi-lens/dist/tools/lsp-diagnostics.js +244 -72
- package/node_modules/pi-lens/docs/audit1.md +5 -5
- package/node_modules/pi-lens/docs/dependencies.md +11 -0
- package/node_modules/pi-lens/docs/dispositions.md +52 -0
- package/node_modules/pi-lens/docs/environment-variables.md +2 -2
- package/node_modules/pi-lens/docs/features.md +4 -4
- package/node_modules/pi-lens/docs/globalconfig.md +3 -1
- package/node_modules/pi-lens/docs/language-coverage.md +1 -0
- package/node_modules/pi-lens/docs/pi-lens-fixer.md +53 -94
- package/node_modules/pi-lens/docs/pi-lens-investigator.md +43 -38
- package/node_modules/pi-lens/docs/pi-lens-retro.md +97 -0
- package/node_modules/pi-lens/docs/pi-lens-reviewer.md +53 -66
- package/node_modules/pi-lens/docs/release-qa-baseline.md +22 -0
- package/node_modules/pi-lens/docs/settings.md +7 -4
- package/node_modules/pi-lens/docs/tree-sitter_rules_catalog.md +1 -1
- package/node_modules/pi-lens/docs/usage.md +2 -0
- package/node_modules/pi-lens/package.json +1 -1
- package/node_modules/pi-lens/rules/tree-sitter-queries/typescript/sql-injection.yml +24 -12
- package/node_modules/pi-lens/scripts/analyze-pi-lens-logs.mjs +40 -0
- package/node_modules/pi-lens/skills/pi-lens-ast-grep/SKILL.md +15 -0
- package/node_modules/pi-lens/skills/pi-lens-lsp-navigation/SKILL.md +7 -0
- package/package.json +6 -11
- package/node_modules/@luxusai/pi-hindsight/CHANGELOG.md +0 -376
- package/node_modules/@luxusai/pi-hindsight/README.md +0 -92
- package/node_modules/@luxusai/pi-hindsight/docs/adr/001-memory-lifecycle-and-scope.md +0 -56
- package/node_modules/@luxusai/pi-hindsight/docs/adr/002-explicit-routing-strategy-seam.md +0 -169
- package/node_modules/@luxusai/pi-hindsight/docs/adr/003-tui-memory-mode-vocabulary.md +0 -107
- package/node_modules/@luxusai/pi-hindsight/docs/adr/004-lifeos-dual-bank-design.md +0 -89
- package/node_modules/@luxusai/pi-hindsight/docs/adr/005-domain-banks-and-agent-first-surface.md +0 -189
- package/node_modules/@luxusai/pi-hindsight/docs/assets/logos/pi-hindsight-logo-dark.webp +0 -0
- package/node_modules/@luxusai/pi-hindsight/docs/assets/logos/pi-hindsight-logo-dark@2x.webp +0 -0
- package/node_modules/@luxusai/pi-hindsight/docs/coding-memory-evaluation.md +0 -54
- package/node_modules/@luxusai/pi-hindsight/docs/compatibility.md +0 -75
- package/node_modules/@luxusai/pi-hindsight/docs/hindsight-core-functions.md +0 -300
- package/node_modules/@luxusai/pi-hindsight/docs/mission-and-mental-model-quality.md +0 -158
- package/node_modules/@luxusai/pi-hindsight/docs/next-opt-out-design.md +0 -164
- package/node_modules/@luxusai/pi-hindsight/docs/risky-memory-modes.md +0 -139
- package/node_modules/@luxusai/pi-hindsight/docs/starter-mental-model-suggestions.md +0 -74
- package/node_modules/@luxusai/pi-hindsight/docs/surface-reference.md +0 -261
- package/node_modules/@luxusai/pi-hindsight/extensions/banks/bank-operations.ts +0 -151
- package/node_modules/@luxusai/pi-hindsight/extensions/banks/bank-selection.ts +0 -18
- package/node_modules/@luxusai/pi-hindsight/extensions/banks/bank-settings-presenter.ts +0 -46
- package/node_modules/@luxusai/pi-hindsight/extensions/banks/bank-templates.ts +0 -383
- package/node_modules/@luxusai/pi-hindsight/extensions/banks/banking.ts +0 -240
- package/node_modules/@luxusai/pi-hindsight/extensions/banks/knowledge-page-seed.ts +0 -176
- package/node_modules/@luxusai/pi-hindsight/extensions/banks/retain-strategies.ts +0 -178
- package/node_modules/@luxusai/pi-hindsight/extensions/client/client-retry.ts +0 -41
- package/node_modules/@luxusai/pi-hindsight/extensions/client/client.ts +0 -386
- package/node_modules/@luxusai/pi-hindsight/extensions/client/fetch-compat.ts +0 -39
- package/node_modules/@luxusai/pi-hindsight/extensions/client/timeout.ts +0 -34
- package/node_modules/@luxusai/pi-hindsight/extensions/config/config-defaults.ts +0 -140
- package/node_modules/@luxusai/pi-hindsight/extensions/config/config-editing-model.ts +0 -61
- package/node_modules/@luxusai/pi-hindsight/extensions/config/config-editing-registry.ts +0 -925
- package/node_modules/@luxusai/pi-hindsight/extensions/config/config-field-paths.ts +0 -247
- package/node_modules/@luxusai/pi-hindsight/extensions/config/config-normalize.ts +0 -547
- package/node_modules/@luxusai/pi-hindsight/extensions/config/config-writer.ts +0 -480
- package/node_modules/@luxusai/pi-hindsight/extensions/config/config.ts +0 -182
- package/node_modules/@luxusai/pi-hindsight/extensions/config/setup-gate.ts +0 -86
- package/node_modules/@luxusai/pi-hindsight/extensions/imports/import-execute.ts +0 -1010
- package/node_modules/@luxusai/pi-hindsight/extensions/imports/import-parse.ts +0 -175
- package/node_modules/@luxusai/pi-hindsight/extensions/imports/import-plan.ts +0 -425
- package/node_modules/@luxusai/pi-hindsight/extensions/imports/import-presentation.ts +0 -210
- package/node_modules/@luxusai/pi-hindsight/extensions/imports/import-sessions.ts +0 -817
- package/node_modules/@luxusai/pi-hindsight/extensions/index.ts +0 -25
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/git-seed.ts +0 -319
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/memory-lifecycle-recall.ts +0 -196
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/memory-lifecycle-retain.ts +0 -189
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/memory-lifecycle-runtime.ts +0 -65
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/memory-lifecycle.ts +0 -260
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/mental-models.ts +0 -244
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/observation-scopes.ts +0 -59
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/recall-cleanup.ts +0 -82
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/recall-visibility.ts +0 -45
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/recall.ts +0 -331
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/retain-cursor.ts +0 -354
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/retain-job-builder.ts +0 -66
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/retain-receipts.ts +0 -132
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/retain.ts +0 -228
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-bank-template-operations.ts +0 -74
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-config-operations.ts +0 -16
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-control-operations.ts +0 -648
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-diagnostics-operations.ts +0 -105
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-identity.ts +0 -68
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-operation-service.ts +0 -71
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-operation-types.ts +0 -13
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-recall-operations.ts +0 -162
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-retain-operations.ts +0 -131
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-scope.ts +0 -104
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-session-operations.ts +0 -37
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/operation-catalog.ts +0 -893
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/reflect-presenter.ts +0 -35
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/scope-migrate.ts +0 -177
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/tools.ts +0 -7
- package/node_modules/@luxusai/pi-hindsight/extensions/queue/flush-presenter.ts +0 -21
- package/node_modules/@luxusai/pi-hindsight/extensions/queue/jsonl-queue-store.ts +0 -112
- package/node_modules/@luxusai/pi-hindsight/extensions/queue/queue-delivery.ts +0 -111
- package/node_modules/@luxusai/pi-hindsight/extensions/queue/queue-lock.ts +0 -214
- package/node_modules/@luxusai/pi-hindsight/extensions/queue/queue-operations.ts +0 -70
- package/node_modules/@luxusai/pi-hindsight/extensions/queue/queue.ts +0 -392
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/bank-template-presentation.ts +0 -45
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/commands.ts +0 -9
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/guided-setup.ts +0 -860
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/prefill-input.ts +0 -105
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/setup-flow.ts +0 -189
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/setup-server-probe.ts +0 -299
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/setup-tui-actions.ts +0 -201
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/setup-tui-facts.ts +0 -47
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/setup-tui-render.ts +0 -239
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/setup-tui-types.ts +0 -50
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/setup-tui.ts +0 -259
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/tool-presenters.ts +0 -77
- package/node_modules/@luxusai/pi-hindsight/extensions/types.ts +0 -534
- package/node_modules/@luxusai/pi-hindsight/extensions/utils/diagnostics.ts +0 -319
- package/node_modules/@luxusai/pi-hindsight/extensions/utils/messages.ts +0 -325
- package/node_modules/@luxusai/pi-hindsight/extensions/utils/sanitize.ts +0 -42
- package/node_modules/@luxusai/pi-hindsight/extensions/utils/session-memory-meta.ts +0 -244
- package/node_modules/@luxusai/pi-hindsight/extensions/utils/session-operations.ts +0 -56
- package/node_modules/@luxusai/pi-hindsight/extensions/utils/session.ts +0 -50
- package/node_modules/@luxusai/pi-hindsight/extensions/utils/status-fields.ts +0 -167
- package/node_modules/@luxusai/pi-hindsight/extensions/utils/status-health.ts +0 -207
- package/node_modules/@luxusai/pi-hindsight/extensions/utils/status.ts +0 -120
- package/node_modules/@luxusai/pi-hindsight/extensions/version.ts +0 -8
- package/node_modules/@luxusai/pi-hindsight/package.json +0 -118
- package/node_modules/@luxusai/pi-hindsight/skills/hindsight-memory-doctor/SKILL.md +0 -75
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
isKeyRelease,
|
|
3
|
+
isKittyProtocolActive,
|
|
4
|
+
KeybindingsManager,
|
|
5
|
+
type KeyId,
|
|
6
|
+
matchesKey,
|
|
7
|
+
type TUI,
|
|
8
|
+
TUI_KEYBINDINGS,
|
|
9
9
|
} from "@earendil-works/pi-tui";
|
|
10
10
|
import { formatKeyLabel } from "./text.js";
|
|
11
11
|
|
|
@@ -16,315 +16,273 @@ export type BtwKeybindingOverrides = Partial<Record<BtwShortcutAction, string>>;
|
|
|
16
16
|
const MODIFIERS = ["shift", "alt", "ctrl", "super"] as const;
|
|
17
17
|
const SYMBOLS = "`-=[]\\;',./!@#$%^&*()_|~{}:<>?";
|
|
18
18
|
const SPECIAL: Record<string, number> = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
19
|
+
escape: 27,
|
|
20
|
+
tab: 9,
|
|
21
|
+
enter: 13,
|
|
22
|
+
space: 32,
|
|
23
|
+
backspace: 127,
|
|
24
|
+
insert: 57425,
|
|
25
|
+
delete: 57426,
|
|
26
|
+
home: 57423,
|
|
27
|
+
end: 57424,
|
|
28
|
+
pageup: 57421,
|
|
29
|
+
pagedown: 57422,
|
|
30
|
+
left: 57417,
|
|
31
|
+
right: 57418,
|
|
32
|
+
up: 57419,
|
|
33
|
+
down: 57420,
|
|
34
34
|
};
|
|
35
|
-
const FUNCTION_INPUTS = [
|
|
36
|
-
"OP",
|
|
37
|
-
"OQ",
|
|
38
|
-
"OR",
|
|
39
|
-
"OS",
|
|
40
|
-
"[15~",
|
|
41
|
-
"[17~",
|
|
42
|
-
"[18~",
|
|
43
|
-
"[19~",
|
|
44
|
-
"[20~",
|
|
45
|
-
"[21~",
|
|
46
|
-
"[23~",
|
|
47
|
-
"[24~",
|
|
48
|
-
];
|
|
35
|
+
const FUNCTION_INPUTS = ["OP", "OQ", "OR", "OS", "[15~", "[17~", "[18~", "[19~", "[20~", "[21~", "[23~", "[24~"];
|
|
49
36
|
// All cross-identity legacy collisions in Pi's matchesKey(): raw Ctrl bytes,
|
|
50
37
|
// ESC-prefixed bytes (including Alt+arrows), BS/DEL, Enter and Shift+Tab.
|
|
51
38
|
// CSI-u, keypad, lock bits, shifted letters and modifyOtherKeys normalize to
|
|
52
39
|
// the same key+modifiers; probe that identity instead of duplicating the parser.
|
|
53
40
|
const LEGACY_INPUTS = [
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
41
|
+
...Array.from({ length: 128 }, (_, code) => String.fromCharCode(code)),
|
|
42
|
+
...Array.from({ length: 128 }, (_, code) => `\u001b${String.fromCharCode(code)}`),
|
|
43
|
+
"\u001b[Z",
|
|
44
|
+
"\u001bOM",
|
|
45
|
+
"\u001b[E",
|
|
46
|
+
"\u001b[e",
|
|
47
|
+
"\u001bOe",
|
|
48
|
+
...FUNCTION_INPUTS.map((suffix) => `\u001b${suffix}`),
|
|
62
49
|
];
|
|
63
50
|
|
|
64
51
|
/** Strict settings syntax; Pi itself ignores unknown/duplicate modifier tokens. */
|
|
65
52
|
export function normalizeBtwKey(value: unknown): string | undefined {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return undefined;
|
|
86
|
-
if (
|
|
87
|
-
base === "clear" &&
|
|
88
|
-
(parts.length > 1 || (parts.length === 1 && !["ctrl", "shift"].includes(parts[0] ?? "")))
|
|
89
|
-
)
|
|
90
|
-
return undefined;
|
|
91
|
-
return [...MODIFIERS.filter((part) => parts.includes(part)), base].join("+");
|
|
53
|
+
if (typeof value !== "string" || value.length > 80 || /[\s\p{Cc}]/u.test(value)) return undefined;
|
|
54
|
+
const parts = value.toLowerCase().split("+");
|
|
55
|
+
let base = parts.pop();
|
|
56
|
+
if (!base) return undefined;
|
|
57
|
+
if (base === "esc") base = "escape";
|
|
58
|
+
if (base === "return") base = "enter";
|
|
59
|
+
if (new Set(parts).size !== parts.length || parts.some((part) => !MODIFIERS.includes(part as never)))
|
|
60
|
+
return undefined;
|
|
61
|
+
if (
|
|
62
|
+
!Object.hasOwn(SPECIAL, base) &&
|
|
63
|
+
base !== "clear" &&
|
|
64
|
+
!/^f(?:[1-9]|1[0-2])$/u.test(base) &&
|
|
65
|
+
!(base.length === 1 && (/^[a-z0-9]$/u.test(base) || SYMBOLS.includes(base)))
|
|
66
|
+
)
|
|
67
|
+
return undefined;
|
|
68
|
+
if ((base === "escape" || (base.startsWith("f") && base.length > 1)) && parts.length) return undefined;
|
|
69
|
+
if (base === "clear" && (parts.length > 1 || (parts.length === 1 && !["ctrl", "shift"].includes(parts[0] ?? ""))))
|
|
70
|
+
return undefined;
|
|
71
|
+
return [...MODIFIERS.filter((part) => parts.includes(part)), base].join("+");
|
|
92
72
|
}
|
|
93
73
|
|
|
94
74
|
/** Representative inputs are checked by Pi, including its live terminal-mode branches. */
|
|
95
75
|
function inputsFor(key: string): string[] {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
const code = SPECIAL[base] ?? (base.length === 1 ? base.charCodeAt(0) : undefined);
|
|
103
|
-
const inputs =
|
|
104
|
-
code === undefined ? LEGACY_INPUTS : [...LEGACY_INPUTS, `\u001b[${code};${modifier + 1}u`];
|
|
105
|
-
return inputs.filter((input) => matchesKey(input, key as KeyId));
|
|
76
|
+
const parts = key.split("+");
|
|
77
|
+
const base = parts.pop() ?? "";
|
|
78
|
+
const modifier = MODIFIERS.reduce((mask, part, bit) => mask | (parts.includes(part) ? 1 << bit : 0), 0);
|
|
79
|
+
const code = SPECIAL[base] ?? (base.length === 1 ? base.charCodeAt(0) : undefined);
|
|
80
|
+
const inputs = code === undefined ? LEGACY_INPUTS : [...LEGACY_INPUTS, `\u001b[${code};${modifier + 1}u`];
|
|
81
|
+
return inputs.filter((input) => matchesKey(input, key as KeyId));
|
|
106
82
|
}
|
|
107
83
|
|
|
108
84
|
export function btwKeysOverlap(first: string, second: string): boolean {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
normalized !== undefined &&
|
|
112
|
-
inputsFor(normalized).some((input) => matchesKey(input, second as KeyId))
|
|
113
|
-
);
|
|
85
|
+
const normalized = normalizeBtwKey(first);
|
|
86
|
+
return normalized !== undefined && inputsFor(normalized).some((input) => matchesKey(input, second as KeyId));
|
|
114
87
|
}
|
|
115
88
|
|
|
116
89
|
export interface BtwShortcuts {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
90
|
+
keys: Record<BtwShortcutAction, readonly string[]>;
|
|
91
|
+
warnings: readonly string[];
|
|
92
|
+
matches(data: string, action: BtwShortcutAction): boolean;
|
|
93
|
+
label(action: BtwShortcutAction): string;
|
|
121
94
|
}
|
|
122
95
|
|
|
123
96
|
function reservedKeys(keybindings: KeybindingsManager, copyOnSelect: boolean): string[] {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
...(!copyOnSelect ? keybindings.getKeys("app.message.copy") : []),
|
|
147
|
-
];
|
|
97
|
+
// Editor has no autocomplete provider here. Select bindings are still reserved
|
|
98
|
+
// because exit also applies to BTW-owned nested review/menu components.
|
|
99
|
+
return [
|
|
100
|
+
"ctrl+c",
|
|
101
|
+
"shift+backspace",
|
|
102
|
+
"shift+delete",
|
|
103
|
+
"shift+space",
|
|
104
|
+
// Exact-range review uses these fixed selection actions even if Editor is remapped.
|
|
105
|
+
"shift+left",
|
|
106
|
+
"shift+right",
|
|
107
|
+
"shift+up",
|
|
108
|
+
"shift+down",
|
|
109
|
+
"left",
|
|
110
|
+
"right",
|
|
111
|
+
"enter",
|
|
112
|
+
"alt+enter",
|
|
113
|
+
"ctrl+j",
|
|
114
|
+
"pageUp",
|
|
115
|
+
"pageDown",
|
|
116
|
+
...Object.keys(TUI_KEYBINDINGS).flatMap((id) => keybindings.getKeys(id as keyof typeof TUI_KEYBINDINGS)),
|
|
117
|
+
...(!copyOnSelect ? keybindings.getKeys("app.message.copy") : []),
|
|
118
|
+
];
|
|
148
119
|
}
|
|
149
120
|
|
|
150
121
|
function isTextKey(key: string): boolean {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
(base.length === 1 || base === "space") &&
|
|
155
|
-
!parts.some((part) => ["ctrl", "alt", "super"].includes(part))
|
|
156
|
-
);
|
|
122
|
+
const parts = key.split("+");
|
|
123
|
+
const base = parts.at(-1) ?? "";
|
|
124
|
+
return (base.length === 1 || base === "space") && !parts.some((part) => ["ctrl", "alt", "super"].includes(part));
|
|
157
125
|
}
|
|
158
126
|
|
|
159
127
|
export function resolveBtwShortcuts(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
128
|
+
overrides: BtwKeybindingOverrides = {},
|
|
129
|
+
keybindings: KeybindingsManager,
|
|
130
|
+
copyOnSelect = true,
|
|
163
131
|
): BtwShortcuts {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
132
|
+
let mode = isKittyProtocolActive();
|
|
133
|
+
let snapshot = resolveShortcutSnapshot(overrides, keybindings, copyOnSelect);
|
|
134
|
+
const current = () => {
|
|
135
|
+
if (mode !== isKittyProtocolActive()) {
|
|
136
|
+
mode = isKittyProtocolActive();
|
|
137
|
+
snapshot = resolveShortcutSnapshot(overrides, keybindings, copyOnSelect);
|
|
138
|
+
}
|
|
139
|
+
return snapshot;
|
|
140
|
+
};
|
|
141
|
+
// ProcessTerminal negotiates Kitty asynchronously after the dedicated TUI starts.
|
|
142
|
+
// Hints and matching must use the same policy after that mode transition.
|
|
143
|
+
return {
|
|
144
|
+
get keys() {
|
|
145
|
+
return current().keys;
|
|
146
|
+
},
|
|
147
|
+
get warnings() {
|
|
148
|
+
return current().warnings;
|
|
149
|
+
},
|
|
150
|
+
matches: (data, action) => current().matches(data, action),
|
|
151
|
+
label: (action) => current().label(action),
|
|
152
|
+
};
|
|
185
153
|
}
|
|
186
154
|
|
|
187
155
|
function resolveShortcutSnapshot(
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
156
|
+
overrides: BtwKeybindingOverrides = {},
|
|
157
|
+
keybindings: KeybindingsManager,
|
|
158
|
+
copyOnSelect = true,
|
|
191
159
|
): BtwShortcuts {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
}
|
|
266
|
-
return {
|
|
267
|
-
keys,
|
|
268
|
-
warnings,
|
|
269
|
-
matches: (data, action) =>
|
|
270
|
-
!isKeyRelease(data) && keys[action].some((key) => matchesKey(data, key as KeyId)),
|
|
271
|
-
label: (action) =>
|
|
272
|
-
keys[action].length ? formatKeyLabel(keys[action][0] ?? "") : "Unavailable",
|
|
273
|
-
};
|
|
160
|
+
const reserved = reservedKeys(keybindings, copyOnSelect);
|
|
161
|
+
const keys: BtwShortcuts["keys"] = { exit: ["ctrl+c"], cycleThinkingLevel: [], bringToMain: [] };
|
|
162
|
+
const warnings: string[] = [];
|
|
163
|
+
const defaults: Record<BtwShortcutAction, readonly string[]> = {
|
|
164
|
+
exit: ["ctrl+c"],
|
|
165
|
+
cycleThinkingLevel: keybindings.getKeys("app.thinking.cycle"),
|
|
166
|
+
bringToMain: ["ctrl+r"],
|
|
167
|
+
};
|
|
168
|
+
const usable = (action: BtwShortcutAction, candidate: string, inherited = false): string | undefined => {
|
|
169
|
+
const key = normalizeBtwKey(candidate);
|
|
170
|
+
if (!key || (!inherited && isTextKey(key))) return undefined;
|
|
171
|
+
const inputs = inputsFor(key);
|
|
172
|
+
if (!inputs.length) return undefined;
|
|
173
|
+
if (action === "exit" && key === "ctrl+c") return key;
|
|
174
|
+
if (
|
|
175
|
+
reserved.some((other) => typeof other === "string" && inputs.some((input) => matchesKey(input, other as KeyId)))
|
|
176
|
+
)
|
|
177
|
+
return undefined;
|
|
178
|
+
return key;
|
|
179
|
+
};
|
|
180
|
+
const candidates: BtwKeybindingOverrides = {};
|
|
181
|
+
const availableDefaults = { ...defaults };
|
|
182
|
+
for (const action of BTW_SHORTCUT_ACTIONS) {
|
|
183
|
+
availableDefaults[action] = defaults[action]
|
|
184
|
+
.map((key) => usable(action, key, action === "cycleThinkingLevel"))
|
|
185
|
+
.filter((key): key is string => key !== undefined);
|
|
186
|
+
const override = overrides[action];
|
|
187
|
+
if (override !== undefined) candidates[action] = usable(action, override);
|
|
188
|
+
}
|
|
189
|
+
// Compare the complete proposal, not only actions visited earlier. Reject conflicts
|
|
190
|
+
// together, then repeat because a rejected override restores its default bindings.
|
|
191
|
+
for (;;) {
|
|
192
|
+
const rejected = BTW_SHORTCUT_ACTIONS.filter((action) => {
|
|
193
|
+
const candidate = candidates[action];
|
|
194
|
+
return (
|
|
195
|
+
candidate !== undefined &&
|
|
196
|
+
BTW_SHORTCUT_ACTIONS.some(
|
|
197
|
+
(other) =>
|
|
198
|
+
other !== action &&
|
|
199
|
+
(candidates[other] ? [candidates[other]] : availableDefaults[other]).some((key) =>
|
|
200
|
+
btwKeysOverlap(candidate, key),
|
|
201
|
+
),
|
|
202
|
+
)
|
|
203
|
+
);
|
|
204
|
+
});
|
|
205
|
+
if (!rejected.length) break;
|
|
206
|
+
for (const action of rejected) delete candidates[action];
|
|
207
|
+
}
|
|
208
|
+
for (const action of BTW_SHORTCUT_ACTIONS) {
|
|
209
|
+
const override = overrides[action];
|
|
210
|
+
const selected = candidates[action];
|
|
211
|
+
if (override !== undefined && !selected)
|
|
212
|
+
warnings.push(
|
|
213
|
+
`${action}: configured shortcut is invalid or conflicts with a reserved action; using an available default.`,
|
|
214
|
+
);
|
|
215
|
+
const effective = selected
|
|
216
|
+
? [selected]
|
|
217
|
+
: availableDefaults[action].filter(
|
|
218
|
+
(key) =>
|
|
219
|
+
!BTW_SHORTCUT_ACTIONS.some(
|
|
220
|
+
(other) => other !== action && keys[other].some((used) => btwKeysOverlap(key, used)),
|
|
221
|
+
),
|
|
222
|
+
);
|
|
223
|
+
keys[action] = action === "exit" ? [...new Set([...effective, "ctrl+c"])] : effective;
|
|
224
|
+
if (!keys[action].length && (override !== undefined || defaults[action].length > 0))
|
|
225
|
+
warnings.push(`${action}: no usable shortcut; change Pi BTW Settings or Pi keybindings.`);
|
|
226
|
+
}
|
|
227
|
+
return {
|
|
228
|
+
keys,
|
|
229
|
+
warnings,
|
|
230
|
+
matches: (data, action) => !isKeyRelease(data) && keys[action].some((key) => matchesKey(data, key as KeyId)),
|
|
231
|
+
label: (action) => (keys[action].length ? formatKeyLabel(keys[action][0] ?? "") : "Unavailable"),
|
|
232
|
+
};
|
|
274
233
|
}
|
|
275
234
|
|
|
276
235
|
export function validateBtwShortcutEdit(
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
236
|
+
action: BtwShortcutAction,
|
|
237
|
+
value: string | undefined,
|
|
238
|
+
overrides: BtwKeybindingOverrides,
|
|
239
|
+
keybindings: KeybindingsManager,
|
|
240
|
+
copyOnSelect: boolean,
|
|
282
241
|
): string | undefined {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
return undefined;
|
|
242
|
+
// Reset must remain available even when several existing overrides conflict.
|
|
243
|
+
if (value === undefined) return undefined;
|
|
244
|
+
if (!normalizeBtwKey(value)) return "Invalid key combination. Use a Pi key name such as ctrl+q or f6.";
|
|
245
|
+
const next = { ...overrides, [action]: value };
|
|
246
|
+
const resolved = resolveBtwShortcuts(next, keybindings, copyOnSelect);
|
|
247
|
+
const previous = resolveBtwShortcuts(overrides, keybindings, copyOnSelect);
|
|
248
|
+
// Reject edits that disable another binding as well as the edited binding.
|
|
249
|
+
for (const item of BTW_SHORTCUT_ACTIONS) {
|
|
250
|
+
if (
|
|
251
|
+
(item === action && !resolved.keys[item].includes(normalizeBtwKey(value) ?? "")) ||
|
|
252
|
+
(item !== action && previous.keys[item].some((key) => !resolved.keys[item].includes(key)))
|
|
253
|
+
) {
|
|
254
|
+
return `${item} conflicts with another BTW shortcut, editing, selection, search, scrolling, or copying. Choose a different key.`;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return undefined;
|
|
300
258
|
}
|
|
301
259
|
|
|
302
260
|
const bindingsByTui = new WeakMap<TUI, BtwShortcuts>();
|
|
303
261
|
export function setBtwShortcuts(tui: TUI, shortcuts: BtwShortcuts): void {
|
|
304
|
-
|
|
262
|
+
bindingsByTui.set(tui, shortcuts);
|
|
305
263
|
}
|
|
306
264
|
export function getBtwShortcuts(tui: TUI, keybindings?: KeybindingsManager): BtwShortcuts {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
265
|
+
return (
|
|
266
|
+
bindingsByTui.get(tui) ??
|
|
267
|
+
resolveBtwShortcuts(
|
|
268
|
+
{},
|
|
269
|
+
keybindings ??
|
|
270
|
+
new KeybindingsManager({
|
|
271
|
+
...TUI_KEYBINDINGS,
|
|
272
|
+
"app.thinking.cycle": { defaultKeys: "shift+tab" },
|
|
273
|
+
}),
|
|
274
|
+
)
|
|
275
|
+
);
|
|
318
276
|
}
|
|
319
277
|
|
|
320
278
|
/** Keep split bracketed-paste payloads away from screen-level shortcuts. */
|
|
321
279
|
export class BtwPasteGuard {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
280
|
+
private active = false;
|
|
281
|
+
consume(data: string): boolean {
|
|
282
|
+
const wasActive = this.active;
|
|
283
|
+
const starts = data.includes("\u001b[200~");
|
|
284
|
+
if (starts) this.active = true;
|
|
285
|
+
if (this.active && data.includes("\u001b[201~")) this.active = false;
|
|
286
|
+
return wasActive || starts;
|
|
287
|
+
}
|
|
330
288
|
}
|