@herbertgao/pi-extensions 2026.8.11 → 2026.8.13
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 +23 -10
- package/{node_modules/@herbertgao/pi-mermaid-open/LICENSE → THIRD_PARTY_NOTICES.md} +19 -1
- package/node_modules/@czottmann/pi-automode/CHANGELOG.md +15 -0
- package/node_modules/@czottmann/pi-automode/README.md +5 -3
- package/node_modules/@czottmann/pi-automode/docs/adr/ADR-001-permission-precedence-and-trust-boundaries.md +2 -0
- package/node_modules/@czottmann/pi-automode/docs/adr/ADR-002-global-config-in-extension-data-directory.md +60 -0
- package/node_modules/@czottmann/pi-automode/docs/adr/INDEX.md +1 -0
- package/node_modules/@czottmann/pi-automode/docs/automode-classifier-flow.md +4 -4
- package/node_modules/@czottmann/pi-automode/docs/configuration.md +20 -4
- package/node_modules/@czottmann/pi-automode/docs/observability-logging.md +1 -1
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/bash.ts +692 -0
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/config.ts +181 -3
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/constants.ts +4 -1
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/extension.ts +143 -36
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/hard-deny.ts +103 -148
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/paths.ts +32 -6
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/permissions.ts +344 -22
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode.ts +1 -0
- package/node_modules/@czottmann/pi-automode/package.json +4 -1
- package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +2 -1
- package/node_modules/@herbertgao/pi-cc-extensions/README.md +2 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/config.ts +4 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +21 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/agent-summary/core.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/context.ts +19 -19
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +4 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/default-mode.ts +2 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +10 -2
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +3 -3
- package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +10 -0
- package/node_modules/@herbertgao/pi-subagents/README.md +21 -15
- package/node_modules/@herbertgao/pi-subagents/package.json +3 -3
- package/node_modules/@herbertgao/pi-subagents/src/agent-file-toggle.ts +11 -8
- package/node_modules/@herbertgao/pi-subagents/src/agent-manager.ts +184 -106
- package/node_modules/@herbertgao/pi-subagents/src/cross-extension-rpc.ts +31 -11
- package/node_modules/@herbertgao/pi-subagents/src/custom-agents.ts +9 -1
- package/node_modules/@herbertgao/pi-subagents/src/index.ts +156 -31
- package/node_modules/@herbertgao/pi-subagents/src/invocation-config.ts +17 -0
- package/node_modules/@herbertgao/pi-subagents/src/model-resolver.ts +14 -0
- package/node_modules/@herbertgao/pi-subagents/src/schedule.ts +8 -0
- package/node_modules/@herbertgao/pi-subagents/src/settings.ts +32 -1
- package/node_modules/@herbertgao/pi-subagents/src/types.ts +17 -2
- package/node_modules/@herbertgao/pi-subagents/src/ui/agent-widget.ts +23 -2
- package/node_modules/@herbertgao/pi-subagents/src/ui/conversation-viewer.ts +259 -24
- package/node_modules/@juicesharp/rpiv-ask-user-question/package.json +2 -2
- package/node_modules/@luxusai/pi-hindsight/CHANGELOG.md +376 -0
- package/node_modules/@luxusai/pi-hindsight/README.md +92 -0
- package/node_modules/@luxusai/pi-hindsight/docs/adr/001-memory-lifecycle-and-scope.md +56 -0
- package/node_modules/@luxusai/pi-hindsight/docs/adr/002-explicit-routing-strategy-seam.md +169 -0
- package/node_modules/@luxusai/pi-hindsight/docs/adr/003-tui-memory-mode-vocabulary.md +107 -0
- package/node_modules/@luxusai/pi-hindsight/docs/adr/004-lifeos-dual-bank-design.md +89 -0
- package/node_modules/@luxusai/pi-hindsight/docs/adr/005-domain-banks-and-agent-first-surface.md +189 -0
- 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 +54 -0
- package/node_modules/@luxusai/pi-hindsight/docs/compatibility.md +75 -0
- package/node_modules/@luxusai/pi-hindsight/docs/hindsight-core-functions.md +300 -0
- package/node_modules/@luxusai/pi-hindsight/docs/mission-and-mental-model-quality.md +158 -0
- package/node_modules/@luxusai/pi-hindsight/docs/next-opt-out-design.md +164 -0
- package/node_modules/@luxusai/pi-hindsight/docs/risky-memory-modes.md +139 -0
- package/node_modules/@luxusai/pi-hindsight/docs/starter-mental-model-suggestions.md +74 -0
- package/node_modules/@luxusai/pi-hindsight/docs/surface-reference.md +261 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/banks/bank-operations.ts +151 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/banks/bank-selection.ts +18 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/banks/bank-settings-presenter.ts +46 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/banks/bank-templates.ts +383 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/banks/banking.ts +240 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/banks/knowledge-page-seed.ts +176 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/banks/retain-strategies.ts +178 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/client/client-retry.ts +41 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/client/client.ts +386 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/client/fetch-compat.ts +39 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/client/timeout.ts +34 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/config/config-defaults.ts +140 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/config/config-editing-model.ts +61 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/config/config-editing-registry.ts +925 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/config/config-field-paths.ts +247 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/config/config-normalize.ts +547 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/config/config-writer.ts +480 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/config/config.ts +182 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/config/setup-gate.ts +86 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/imports/import-execute.ts +1010 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/imports/import-parse.ts +175 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/imports/import-plan.ts +425 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/imports/import-presentation.ts +210 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/imports/import-sessions.ts +817 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/index.ts +25 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/git-seed.ts +319 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/memory-lifecycle-recall.ts +196 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/memory-lifecycle-retain.ts +189 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/memory-lifecycle-runtime.ts +65 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/memory-lifecycle.ts +260 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/mental-models.ts +244 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/observation-scopes.ts +59 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/recall-cleanup.ts +82 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/recall-visibility.ts +45 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/recall.ts +331 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/retain-cursor.ts +354 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/retain-job-builder.ts +66 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/retain-receipts.ts +132 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/retain.ts +228 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-bank-template-operations.ts +74 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-config-operations.ts +16 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-control-operations.ts +648 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-diagnostics-operations.ts +105 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-identity.ts +68 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-operation-service.ts +71 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-operation-types.ts +13 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-recall-operations.ts +162 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-retain-operations.ts +131 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-scope.ts +104 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-session-operations.ts +37 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/operation-catalog.ts +893 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/reflect-presenter.ts +35 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/scope-migrate.ts +177 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/tools.ts +7 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/queue/flush-presenter.ts +21 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/queue/jsonl-queue-store.ts +112 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/queue/queue-delivery.ts +111 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/queue/queue-lock.ts +214 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/queue/queue-operations.ts +70 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/queue/queue.ts +392 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/bank-template-presentation.ts +45 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/commands.ts +9 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/guided-setup.ts +860 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/prefill-input.ts +105 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/setup-flow.ts +189 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/setup-server-probe.ts +299 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/setup-tui-actions.ts +201 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/setup-tui-facts.ts +47 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/setup-tui-render.ts +239 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/setup-tui-types.ts +50 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/setup-tui.ts +259 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/tool-presenters.ts +77 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/types.ts +534 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/utils/diagnostics.ts +319 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/utils/messages.ts +325 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/utils/sanitize.ts +42 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/utils/session-memory-meta.ts +244 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/utils/session-operations.ts +56 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/utils/session.ts +50 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/utils/status-fields.ts +167 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/utils/status-health.ts +207 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/utils/status.ts +120 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/version.ts +8 -0
- package/node_modules/@luxusai/pi-hindsight/package.json +118 -0
- package/node_modules/@luxusai/pi-hindsight/skills/hindsight-memory-doctor/SKILL.md +75 -0
- package/node_modules/@narumitw/pi-btw/dist/index.ts +143 -46
- package/node_modules/@narumitw/pi-btw/dist/index.ts.map +3 -3
- package/node_modules/@narumitw/pi-btw/package.json +6 -6
- package/node_modules/@narumitw/pi-btw/src/fullscreen-ui.ts +136 -22
- package/node_modules/{@herbertgao → @tifan}/pi-copy-response/README.md +2 -4
- package/node_modules/{@herbertgao → @tifan}/pi-copy-response/package.json +5 -15
- package/node_modules/{@herbertgao → @tifan}/pi-handoff/README.md +4 -6
- package/node_modules/@tifan/pi-handoff/package.json +43 -0
- package/node_modules/{@herbertgao → @tifan}/pi-handoff/src/index.ts +1 -1
- package/node_modules/{@herbertgao → @tifan}/pi-inline-skills/README.md +2 -4
- package/node_modules/{@herbertgao → @tifan}/pi-inline-skills/package.json +5 -15
- package/node_modules/{@herbertgao → @tifan}/pi-mermaid-open/README.md +5 -7
- package/node_modules/{@herbertgao → @tifan}/pi-mermaid-open/package.json +5 -19
- package/node_modules/{@herbertgao → @tifan}/pi-preferred-thinking/README.md +4 -6
- package/node_modules/{@herbertgao → @tifan}/pi-preferred-thinking/package.json +6 -16
- package/node_modules/{@herbertgao → @tifan}/pi-preferred-thinking/src/index.ts +1 -6
- package/node_modules/{@herbertgao → @tifan}/pi-recap/README.md +4 -6
- package/node_modules/@tifan/pi-recap/package.json +42 -0
- package/node_modules/{@herbertgao → @tifan}/pi-recap/src/models.ts +1 -6
- package/node_modules/{@herbertgao → @tifan}/pi-rename/README.md +13 -8
- package/node_modules/@tifan/pi-rename/package.json +47 -0
- package/node_modules/@tifan/pi-rename/src/herdr-label.ts +4 -0
- package/node_modules/{@herbertgao → @tifan}/pi-rename/src/index.ts +4 -16
- package/node_modules/{@herbertgao → @tifan}/pi-rename/src/models.ts +1 -6
- package/node_modules/{@herbertgao → @tifan}/pi-titlebar-spinner/README.md +2 -4
- package/node_modules/{@herbertgao → @tifan}/pi-titlebar-spinner/package.json +5 -15
- package/node_modules/pi-lens/CHANGELOG.md +96 -1
- package/node_modules/pi-lens/dist/clients/actionable-warnings-logger.js +2 -1
- package/node_modules/pi-lens/dist/clients/actionable-warnings.js +14 -5
- package/node_modules/pi-lens/dist/clients/advisory-provenance.js +48 -18
- package/node_modules/pi-lens/dist/clients/ast-grep-client.js +1 -3
- package/node_modules/pi-lens/dist/clients/atomic-write-staging.js +16 -4
- package/node_modules/pi-lens/dist/clients/bash-file-access.js +3 -1
- package/node_modules/pi-lens/dist/clients/biome-client.js +1 -3
- package/node_modules/pi-lens/dist/clients/blocker-freshness.js +21 -8
- package/node_modules/pi-lens/dist/clients/bounded-cache.js +24 -8
- package/node_modules/pi-lens/dist/clients/bounded-pid-file-lock.js +4 -3
- package/node_modules/pi-lens/dist/clients/cache-manager.js +6 -7
- package/node_modules/pi-lens/dist/clients/cache-observability.js +461 -66
- package/node_modules/pi-lens/dist/clients/call-graph.js +238 -63
- package/node_modules/pi-lens/dist/clients/codebase-model.js +13 -5
- package/node_modules/pi-lens/dist/clients/complexity-client.js +1 -3
- package/node_modules/pi-lens/dist/clients/dead-code-client.js +19 -8
- package/node_modules/pi-lens/dist/clients/dead-code-logger.js +1 -2
- package/node_modules/pi-lens/dist/clients/deadline-utils.js +3 -1
- package/node_modules/pi-lens/dist/clients/debug-heap.js +8 -1
- package/node_modules/pi-lens/dist/clients/degradation-ledger.js +1 -1
- package/node_modules/pi-lens/dist/clients/dependency-checker.js +11 -7
- package/node_modules/pi-lens/dist/clients/diagnostic-dispositions.js +39 -2
- package/node_modules/pi-lens/dist/clients/diagnostic-line-freshness.js +5 -1
- package/node_modules/pi-lens/dist/clients/dispatch/auxiliary-lsp.js +2 -3
- package/node_modules/pi-lens/dist/clients/dispatch/dispatcher.js +13 -1
- package/node_modules/pi-lens/dist/clients/dispatch/facts/function-facts.js +3 -1
- package/node_modules/pi-lens/dist/clients/dispatch/facts/import-facts.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/facts/tree-sitter-facts.js +1 -1
- package/node_modules/pi-lens/dist/clients/dispatch/integration.js +9 -4
- package/node_modules/pi-lens/dist/clients/dispatch/rules/error-swallowing.js +3 -1
- package/node_modules/pi-lens/dist/clients/dispatch/rules/pass-through-wrappers.js +6 -2
- package/node_modules/pi-lens/dist/clients/dispatch/rules/unsafe-boundary.js +31 -7
- package/node_modules/pi-lens/dist/clients/dispatch/runners/actionlint.js +5 -2
- package/node_modules/pi-lens/dist/clients/dispatch/runners/biome-check.js +10 -14
- package/node_modules/pi-lens/dist/clients/dispatch/runners/cpp-check.js +5 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/dotnet-build.js +1 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/elixir-check.js +3 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/eslint.js +25 -6
- package/node_modules/pi-lens/dist/clients/dispatch/runners/fish-indent.js +1 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/gleam-check.js +1 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/golangci-lint.js +3 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/hadolint.js +13 -8
- package/node_modules/pi-lens/dist/clients/dispatch/runners/helm-lint.js +4 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/htmlhint.js +25 -10
- package/node_modules/pi-lens/dist/clients/dispatch/runners/javac.js +1 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/ktlint.js +1 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/lsp.js +1 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/markdownlint.js +28 -4
- package/node_modules/pi-lens/dist/clients/dispatch/runners/mypy.js +6 -8
- package/node_modules/pi-lens/dist/clients/dispatch/runners/oxlint.js +212 -11
- package/node_modules/pi-lens/dist/clients/dispatch/runners/php-lint.js +1 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/phpstan.js +8 -4
- package/node_modules/pi-lens/dist/clients/dispatch/runners/psscriptanalyzer.js +10 -6
- package/node_modules/pi-lens/dist/clients/dispatch/runners/pyright.js +23 -14
- package/node_modules/pi-lens/dist/clients/dispatch/runners/rust-clippy.js +1 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/shellcheck.js +7 -9
- package/node_modules/pi-lens/dist/clients/dispatch/runners/shfmt.js +5 -2
- package/node_modules/pi-lens/dist/clients/dispatch/runners/sqlfluff.js +7 -7
- package/node_modules/pi-lens/dist/clients/dispatch/runners/stylelint.js +6 -8
- package/node_modules/pi-lens/dist/clients/dispatch/runners/terragrunt.js +13 -8
- package/node_modules/pi-lens/dist/clients/dispatch/runners/tflint.js +13 -8
- package/node_modules/pi-lens/dist/clients/dispatch/runners/tree-sitter.js +17 -3
- package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/candidate-probe.js +7 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/runner-helpers.js +24 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/tool-failure.js +35 -0
- package/node_modules/pi-lens/dist/clients/dispatch/runners/yaml-rule-parser.js +1 -3
- package/node_modules/pi-lens/dist/clients/dispatch/runners/yamllint.js +6 -8
- package/node_modules/pi-lens/dist/clients/dispatch/runners/zig-check.js +1 -1
- package/node_modules/pi-lens/dist/clients/dispatch/suppress-writer.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/types.js +6 -1
- package/node_modules/pi-lens/dist/clients/dispatch/utils/lsp-diagnostics.js +6 -2
- package/node_modules/pi-lens/dist/clients/extension-log.js +5 -3
- package/node_modules/pi-lens/dist/clients/feature-hints.js +8 -1
- package/node_modules/pi-lens/dist/clients/file-kinds.js +34 -129
- package/node_modules/pi-lens/dist/clients/file-utils.js +17 -1
- package/node_modules/pi-lens/dist/clients/finding-delivery-gate.js +57 -2
- package/node_modules/pi-lens/dist/clients/formatters.js +144 -27
- package/node_modules/pi-lens/dist/clients/freshness.js +38 -0
- package/node_modules/pi-lens/dist/clients/git-guard.js +43 -13
- package/node_modules/pi-lens/dist/clients/go-client.js +1 -3
- package/node_modules/pi-lens/dist/clients/grammar-source.js +1 -1
- package/node_modules/pi-lens/dist/clients/gzip-stage-write.js +30 -4
- package/node_modules/pi-lens/dist/clients/host-edit-normalize.js +1 -3
- package/node_modules/pi-lens/dist/clients/install-diagnostics.js +4 -2
- package/node_modules/pi-lens/dist/clients/installer/index.js +86 -77
- package/node_modules/pi-lens/dist/clients/instance-reaper.js +5 -2
- package/node_modules/pi-lens/dist/clients/instance-registry.js +4 -2
- package/node_modules/pi-lens/dist/clients/jscpd-client.js +6 -1
- package/node_modules/pi-lens/dist/clients/knip-client.js +29 -15
- package/node_modules/pi-lens/dist/clients/language-profile.js +4 -1
- package/node_modules/pi-lens/dist/clients/latency-logger.js +13 -2
- package/node_modules/pi-lens/dist/clients/lens-config.js +1 -1
- package/node_modules/pi-lens/dist/clients/lens-map.js +8 -3
- package/node_modules/pi-lens/dist/clients/live-bus-emitter.js +1 -1
- package/node_modules/pi-lens/dist/clients/lsp/config.js +4 -6
- package/node_modules/pi-lens/dist/clients/lsp/edits.js +119 -32
- package/node_modules/pi-lens/dist/clients/lsp/index.js +94 -35
- package/node_modules/pi-lens/dist/clients/lsp/inferred-project.js +2 -1
- package/node_modules/pi-lens/dist/clients/lsp/jvm-runtime.js +4 -1
- package/node_modules/pi-lens/dist/clients/lsp/launch.js +11 -3
- package/node_modules/pi-lens/dist/clients/lsp/pending-aux-coverage.js +152 -0
- package/node_modules/pi-lens/dist/clients/lsp/server.js +19 -7
- package/node_modules/pi-lens/dist/clients/lsp/tsserver-sync.js +10 -2
- package/node_modules/pi-lens/dist/clients/lsp/workspace-diagnostics-cache.js +9 -4
- package/node_modules/pi-lens/dist/clients/lsp-document-symbols.js +1 -3
- package/node_modules/pi-lens/dist/clients/lsp-mutation.js +10 -20
- package/node_modules/pi-lens/dist/clients/mcp/host-shim.js +1 -1
- package/node_modules/pi-lens/dist/clients/memory-sampler.js +73 -7
- package/node_modules/pi-lens/dist/clients/metrics-client.js +1 -3
- package/node_modules/pi-lens/dist/clients/middle-man-analysis.js +8 -3
- package/node_modules/pi-lens/dist/clients/module-report-lsp.js +7 -1
- package/node_modules/pi-lens/dist/clients/module-report.js +14 -17
- package/node_modules/pi-lens/dist/clients/ndjson-logger.js +3 -5
- package/node_modules/pi-lens/dist/clients/opaque-mutation-scan.js +220 -0
- package/node_modules/pi-lens/dist/clients/package-manager.js +6 -1
- package/node_modules/pi-lens/dist/clients/pipeline.js +57 -9
- package/node_modules/pi-lens/dist/clients/project-conventions.js +2 -8
- package/node_modules/pi-lens/dist/clients/project-diagnostics/cache.js +10 -7
- package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/call-graph-impact.js +2 -1
- package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/gitleaks.js +3 -1
- package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/runner-findings.js +13 -9
- package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/trivy.js +3 -1
- package/node_modules/pi-lens/dist/clients/project-diagnostics/scanner.js +5 -2
- package/node_modules/pi-lens/dist/clients/project-lens-config.js +12 -5
- package/node_modules/pi-lens/dist/clients/project-snapshot-fingerprint.js +48 -0
- package/node_modules/pi-lens/dist/clients/project-snapshot-persist-worker.js +15 -1
- package/node_modules/pi-lens/dist/clients/project-snapshot.js +472 -66
- package/node_modules/pi-lens/dist/clients/read-expansion.js +12 -2
- package/node_modules/pi-lens/dist/clients/read-guard-logger.js +5 -4
- package/node_modules/pi-lens/dist/clients/read-guard-tool-lines.js +5 -2
- package/node_modules/pi-lens/dist/clients/read-guard.js +1 -1
- package/node_modules/pi-lens/dist/clients/resource-sampler.js +1 -1
- package/node_modules/pi-lens/dist/clients/reverse-deps.js +6 -5
- package/node_modules/pi-lens/dist/clients/review-graph/builder.js +42 -17
- package/node_modules/pi-lens/dist/clients/review-graph/git-identity.js +8 -2
- package/node_modules/pi-lens/dist/clients/review-graph/import-resolvers.js +10 -1
- package/node_modules/pi-lens/dist/clients/review-graph/query.js +2 -1
- package/node_modules/pi-lens/dist/clients/review-graph/tsconfig-paths.js +4 -2
- package/node_modules/pi-lens/dist/clients/review-graph/workspace-modules.js +2 -2
- package/node_modules/pi-lens/dist/clients/ruff-client.js +6 -5
- package/node_modules/pi-lens/dist/clients/runtime-agent-end.js +63 -31
- package/node_modules/pi-lens/dist/clients/runtime-context.js +12 -4
- package/node_modules/pi-lens/dist/clients/runtime-coordinator.js +83 -4
- package/node_modules/pi-lens/dist/clients/runtime-session.js +14 -0
- package/node_modules/pi-lens/dist/clients/runtime-tool-call.js +59 -3
- package/node_modules/pi-lens/dist/clients/runtime-tool-result.js +148 -34
- package/node_modules/pi-lens/dist/clients/runtime-turn.js +147 -6
- package/node_modules/pi-lens/dist/clients/rust-client.js +1 -3
- package/node_modules/pi-lens/dist/clients/safe-spawn.js +150 -11
- package/node_modules/pi-lens/dist/clients/security-scan-client.js +1 -3
- package/node_modules/pi-lens/dist/clients/session-summary.js +3 -1
- package/node_modules/pi-lens/dist/clients/sg-runner.js +1 -3
- package/node_modules/pi-lens/dist/clients/source-filter.js +10 -6
- package/node_modules/pi-lens/dist/clients/source-walker.js +1 -1
- package/node_modules/pi-lens/dist/clients/spawn-timeout-cooldown.js +96 -0
- package/node_modules/pi-lens/dist/clients/startup-scan.js +4 -1
- package/node_modules/pi-lens/dist/clients/tool-definition.js +7 -0
- package/node_modules/pi-lens/dist/clients/tool-policy.js +26 -11
- package/node_modules/pi-lens/dist/clients/tool-render.js +2 -1
- package/node_modules/pi-lens/dist/clients/tree-sitter-client.js +10 -4
- package/node_modules/pi-lens/dist/clients/tree-sitter-logger.js +2 -2
- package/node_modules/pi-lens/dist/clients/tree-sitter-symbol-extractor.js +12 -5
- package/node_modules/pi-lens/dist/clients/warm-attach.js +12 -5
- package/node_modules/pi-lens/dist/clients/widget-state.js +27 -11
- package/node_modules/pi-lens/dist/clients/word-index.js +3 -1
- package/node_modules/pi-lens/dist/clients/workspace-topology.js +8 -2
- package/node_modules/pi-lens/dist/clients/zizmor-config.js +9 -1
- package/node_modules/pi-lens/dist/i18n.js +13 -5
- package/node_modules/pi-lens/dist/index.js +10797 -8627
- package/node_modules/pi-lens/dist/mcp/server.js +3 -1
- package/node_modules/pi-lens/dist/tools/ast-grep-replace.js +68 -12
- package/node_modules/pi-lens/dist/tools/lens-diagnostic-mark.js +21 -7
- package/node_modules/pi-lens/dist/tools/lens-diagnostics.js +164 -35
- package/node_modules/pi-lens/dist/tools/lsp-diagnostics.js +24 -7
- package/node_modules/pi-lens/dist/tools/lsp-navigation.js +3 -1
- package/node_modules/pi-lens/dist/tools/module-report.js +1 -1
- package/node_modules/pi-lens/dist/tools/project-report.js +1 -1
- package/node_modules/pi-lens/dist/tools/symbol-search.js +5 -2
- package/node_modules/pi-lens/docs/durable-store-audit-1202.md +1 -1
- package/node_modules/pi-lens/docs/servercapabilities.md +1 -1
- package/node_modules/pi-lens/package.json +160 -156
- package/node_modules/pi-lens/rules/typos/_typos.toml +2 -2
- package/node_modules/pi-lens/scripts/analyze-pi-lens-logs.mjs +31 -13
- package/node_modules/pi-lens/scripts/download-grammars.js +9 -3
- package/node_modules/pi-lens/scripts/rpc-load-check.mjs +30 -9
- package/node_modules/pi-mcp-adapter/CHANGELOG.md +47 -0
- package/node_modules/pi-mcp-adapter/README.md +42 -13
- package/node_modules/pi-mcp-adapter/commands.ts +4 -2
- package/node_modules/pi-mcp-adapter/config.ts +45 -5
- package/node_modules/pi-mcp-adapter/direct-tools.ts +103 -92
- package/node_modules/pi-mcp-adapter/dist/agent-dir.d.ts +10 -0
- package/node_modules/pi-mcp-adapter/dist/agent-dir.js +63 -0
- package/node_modules/pi-mcp-adapter/dist/agent-dir.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/agent-plugin-loader.d.ts +8 -0
- package/node_modules/pi-mcp-adapter/dist/agent-plugin-loader.js +356 -0
- package/node_modules/pi-mcp-adapter/dist/agent-plugin-loader.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/config.d.ts +123 -0
- package/node_modules/pi-mcp-adapter/dist/config.js +1087 -0
- package/node_modules/pi-mcp-adapter/dist/config.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/metadata-cache.d.ts +19 -0
- package/node_modules/pi-mcp-adapter/dist/metadata-cache.js +319 -0
- package/node_modules/pi-mcp-adapter/dist/metadata-cache.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/package-mcp-loader.d.ts +2 -0
- package/node_modules/pi-mcp-adapter/dist/package-mcp-loader.js +156 -0
- package/node_modules/pi-mcp-adapter/dist/package-mcp-loader.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/resource-tools.d.ts +1 -0
- package/node_modules/pi-mcp-adapter/dist/resource-tools.js +15 -0
- package/node_modules/pi-mcp-adapter/dist/resource-tools.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/types.d.ts +564 -0
- package/node_modules/pi-mcp-adapter/dist/types.js +287 -0
- package/node_modules/pi-mcp-adapter/dist/types.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/ui-app-bridge-helpers.d.ts +6 -0
- package/node_modules/pi-mcp-adapter/dist/ui-app-bridge-helpers.js +37 -0
- package/node_modules/pi-mcp-adapter/dist/ui-app-bridge-helpers.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/ui-stream-types.d.ts +104 -0
- package/node_modules/pi-mcp-adapter/dist/ui-stream-types.js +59 -0
- package/node_modules/pi-mcp-adapter/dist/ui-stream-types.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/ui-tool-visibility.d.ts +4 -0
- package/node_modules/pi-mcp-adapter/dist/ui-tool-visibility.js +27 -0
- package/node_modules/pi-mcp-adapter/dist/ui-tool-visibility.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/utils.d.ts +32 -0
- package/node_modules/pi-mcp-adapter/dist/utils.js +338 -0
- package/node_modules/pi-mcp-adapter/dist/utils.js.map +1 -0
- package/node_modules/pi-mcp-adapter/failure-backoff.ts +23 -0
- package/node_modules/pi-mcp-adapter/index.ts +204 -82
- package/node_modules/pi-mcp-adapter/init.ts +41 -30
- package/node_modules/pi-mcp-adapter/lifecycle.ts +16 -8
- package/node_modules/pi-mcp-adapter/mcp-code.ts +2 -0
- package/node_modules/pi-mcp-adapter/mcp-oauth-provider.ts +66 -16
- package/node_modules/pi-mcp-adapter/mcp-output-guard.ts +95 -7
- package/node_modules/pi-mcp-adapter/mcp-probe.ts +18 -4
- package/node_modules/pi-mcp-adapter/mcp-references.ts +368 -0
- package/node_modules/pi-mcp-adapter/mcp-status.ts +8 -19
- package/node_modules/pi-mcp-adapter/metadata-cache.ts +20 -12
- package/node_modules/pi-mcp-adapter/namespace-tools.ts +276 -0
- package/node_modules/pi-mcp-adapter/package.json +24 -6
- package/node_modules/pi-mcp-adapter/proxy-modes.ts +66 -10
- package/node_modules/pi-mcp-adapter/search-ranking.ts +2 -0
- package/node_modules/pi-mcp-adapter/server-manager.ts +63 -12
- package/node_modules/pi-mcp-adapter/state.ts +1 -3
- package/node_modules/pi-mcp-adapter/tool-result-renderer.ts +16 -2
- package/node_modules/pi-mcp-adapter/types.ts +48 -1
- package/node_modules/pi-mcp-adapter/ui-server.ts +3 -19
- package/node_modules/pi-mcp-adapter/ui-session.ts +2 -1
- package/node_modules/pi-mcp-adapter/utils.ts +21 -19
- package/node_modules/pi-web-access/CHANGELOG.md +26 -0
- package/node_modules/pi-web-access/README.md +71 -14
- package/node_modules/pi-web-access/chrome-cookies.ts +115 -35
- package/node_modules/pi-web-access/credential-source.ts +6 -2
- package/node_modules/pi-web-access/curator-page.ts +5 -3
- package/node_modules/pi-web-access/curator-server.ts +2 -1
- package/node_modules/pi-web-access/extract.ts +89 -9
- package/node_modules/pi-web-access/fetch-params.ts +13 -0
- package/node_modules/pi-web-access/gemini-adc.ts +298 -0
- package/node_modules/pi-web-access/gemini-api.ts +59 -15
- package/node_modules/pi-web-access/gemini-search.ts +58 -18
- package/node_modules/pi-web-access/gemini-url-context.ts +3 -2
- package/node_modules/pi-web-access/gemini-web-config.ts +57 -7
- package/node_modules/pi-web-access/gemini-web.ts +9 -3
- package/node_modules/pi-web-access/github-api.ts +5 -4
- package/node_modules/pi-web-access/github-issue-pr.ts +700 -0
- package/node_modules/pi-web-access/index.ts +403 -297
- package/node_modules/pi-web-access/kimi-search.ts +234 -0
- package/node_modules/pi-web-access/openai-search.ts +118 -21
- package/node_modules/pi-web-access/package.json +3 -2
- package/node_modules/pi-web-access/ssrf-protection.ts +4 -1
- package/node_modules/pi-web-access/utils.ts +307 -1
- package/node_modules/pi-web-access/youtube-extract.ts +2 -2
- package/package.json +46 -37
- package/node_modules/@herbertgao/pi-copy-response/CHANGELOG.md +0 -49
- package/node_modules/@herbertgao/pi-copy-response/LICENSE +0 -22
- package/node_modules/@herbertgao/pi-handoff/CHANGELOG.md +0 -83
- package/node_modules/@herbertgao/pi-handoff/LICENSE +0 -22
- package/node_modules/@herbertgao/pi-handoff/package.json +0 -60
- package/node_modules/@herbertgao/pi-inline-skills/CHANGELOG.md +0 -57
- package/node_modules/@herbertgao/pi-inline-skills/LICENSE +0 -22
- package/node_modules/@herbertgao/pi-mermaid-open/CHANGELOG.md +0 -39
- package/node_modules/@herbertgao/pi-preferred-thinking/CHANGELOG.md +0 -63
- package/node_modules/@herbertgao/pi-preferred-thinking/LICENSE +0 -22
- package/node_modules/@herbertgao/pi-recap/CHANGELOG.md +0 -101
- package/node_modules/@herbertgao/pi-recap/LICENSE +0 -22
- package/node_modules/@herbertgao/pi-recap/package.json +0 -55
- package/node_modules/@herbertgao/pi-rename/CHANGELOG.md +0 -49
- package/node_modules/@herbertgao/pi-rename/LICENSE +0 -22
- package/node_modules/@herbertgao/pi-rename/package.json +0 -63
- package/node_modules/@herbertgao/pi-titlebar-spinner/CHANGELOG.md +0 -25
- package/node_modules/@herbertgao/pi-titlebar-spinner/LICENSE +0 -22
- /package/node_modules/{@herbertgao → @tifan}/pi-copy-response/src/index.ts +0 -0
- /package/node_modules/{@herbertgao → @tifan}/pi-handoff/src/complete-text.ts +0 -0
- /package/node_modules/{@herbertgao → @tifan}/pi-handoff/src/session-query.ts +0 -0
- /package/node_modules/{@herbertgao → @tifan}/pi-inline-skills/src/index.ts +0 -0
- /package/node_modules/{@herbertgao → @tifan}/pi-mermaid-open/herdr-plugin/herdr-plugin.toml +0 -0
- /package/node_modules/{@herbertgao → @tifan}/pi-mermaid-open/herdr-plugin/viewer.mjs +0 -0
- /package/node_modules/{@herbertgao → @tifan}/pi-mermaid-open/src/index.ts +0 -0
- /package/node_modules/{@herbertgao → @tifan}/pi-recap/src/index.ts +0 -0
- /package/node_modules/{@herbertgao → @tifan}/pi-recap/src/model-picker.ts +0 -0
- /package/node_modules/{@herbertgao → @tifan}/pi-recap/src/sanitize.ts +0 -0
- /package/node_modules/{@herbertgao → @tifan}/pi-recap/src/tui.ts +0 -0
- /package/node_modules/{@herbertgao → @tifan}/pi-rename/src/model-picker.ts +0 -0
- /package/node_modules/{@herbertgao → @tifan}/pi-rename/src/naming.ts +0 -0
- /package/node_modules/{@herbertgao → @tifan}/pi-rename/src/sanitize.ts +0 -0
- /package/node_modules/{@herbertgao → @tifan}/pi-titlebar-spinner/src/index.ts +0 -0
|
@@ -0,0 +1,925 @@
|
|
|
1
|
+
import { DEFAULT_CONFIG } from "./config.js";
|
|
2
|
+
import type { ResolvedConfig } from "../types.js";
|
|
3
|
+
import {
|
|
4
|
+
DEFAULT_GLOBAL_BANK_ID,
|
|
5
|
+
type ConfigScope,
|
|
6
|
+
type ConfigSource,
|
|
7
|
+
type MemoryProfile,
|
|
8
|
+
type ProjectConfigPatchInput,
|
|
9
|
+
} from "./config-writer.js";
|
|
10
|
+
import {
|
|
11
|
+
CONFIG_FIELD_PATHS,
|
|
12
|
+
CONFIG_FIELD_RESET_KEYS,
|
|
13
|
+
CONFIG_RESET_PATHS,
|
|
14
|
+
type ConfigResetKey,
|
|
15
|
+
type FieldId,
|
|
16
|
+
} from "./config-field-paths.js";
|
|
17
|
+
|
|
18
|
+
export type { FieldId } from "./config-field-paths.js";
|
|
19
|
+
|
|
20
|
+
export type TabId = "Status" | "Connection" | "Banks" | "Recall" | "Retain" | "Import" | "UI";
|
|
21
|
+
|
|
22
|
+
export type ConfigEditingKind = "boolean" | "select" | "text" | "positive-int";
|
|
23
|
+
|
|
24
|
+
export type ConfigEditingField = {
|
|
25
|
+
id: FieldId;
|
|
26
|
+
tab: Exclude<TabId, "Status">;
|
|
27
|
+
label: string;
|
|
28
|
+
description: string;
|
|
29
|
+
value: string;
|
|
30
|
+
defaultValue: string;
|
|
31
|
+
projectValue?: string;
|
|
32
|
+
globalValue?: string;
|
|
33
|
+
envValue?: string;
|
|
34
|
+
source: ConfigSource;
|
|
35
|
+
editableScopes: ConfigScope[];
|
|
36
|
+
changed: boolean;
|
|
37
|
+
resetKey: ConfigResetKey;
|
|
38
|
+
kind: ConfigEditingKind;
|
|
39
|
+
choices?: string[];
|
|
40
|
+
advanced?: boolean;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type ConfigLayers = {
|
|
44
|
+
project: Record<string, unknown>;
|
|
45
|
+
global: Record<string, unknown>;
|
|
46
|
+
env: NodeJS.ProcessEnv;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export type ConfigEditingTab = {
|
|
50
|
+
id: TabId;
|
|
51
|
+
fields: ConfigEditingField[];
|
|
52
|
+
facts?: Array<[string, string]>;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export { CONFIG_FIELD_PATHS, CONFIG_FIELD_RESET_KEYS } from "./config-field-paths.js";
|
|
56
|
+
|
|
57
|
+
function memoryProfileLabel(config: ResolvedConfig): MemoryProfile {
|
|
58
|
+
if (config.recall.enabled && !config.retain.enabled) return "recall-only";
|
|
59
|
+
if (!config.banks.project.enabled) return "global-only";
|
|
60
|
+
if (config.banks.user.enabled) return "project+global";
|
|
61
|
+
return "project-only";
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function enabledDisabled(value: boolean): string {
|
|
65
|
+
return value ? "enabled" : "disabled";
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function changed(value: string, defaultValue: string): boolean {
|
|
69
|
+
return value !== defaultValue;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function apiKeyEnvName(config: ResolvedConfig): string {
|
|
73
|
+
return config.hindsight.apiKeyRef?.startsWith("env:")
|
|
74
|
+
? config.hindsight.apiKeyRef.slice(4)
|
|
75
|
+
: "not set";
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function apiKeySourceLabel(config: ResolvedConfig): string {
|
|
79
|
+
const envName = apiKeyEnvName(config);
|
|
80
|
+
if (envName !== "not set")
|
|
81
|
+
return config.hindsight.apiKey ? `${envName} (resolved)` : `${envName} (missing)`;
|
|
82
|
+
return config.hindsight.apiKey ? "set directly or HINDSIGHT_API_TOKEN/KEY env" : "not set";
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
type BaseConfigEditingField = Omit<
|
|
86
|
+
ConfigEditingField,
|
|
87
|
+
"projectValue" | "globalValue" | "envValue" | "source" | "editableScopes"
|
|
88
|
+
>;
|
|
89
|
+
|
|
90
|
+
type FieldTab = BaseConfigEditingField["tab"];
|
|
91
|
+
type FieldKind = BaseConfigEditingField["kind"];
|
|
92
|
+
|
|
93
|
+
type FieldArgs = {
|
|
94
|
+
id: FieldId;
|
|
95
|
+
tab: FieldTab;
|
|
96
|
+
label: string;
|
|
97
|
+
description: string;
|
|
98
|
+
value: string;
|
|
99
|
+
defaultValue: string;
|
|
100
|
+
changed?: boolean;
|
|
101
|
+
resetKey?: BaseConfigEditingField["resetKey"];
|
|
102
|
+
kind: FieldKind;
|
|
103
|
+
choices?: string[];
|
|
104
|
+
advanced?: boolean;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
function field(args: FieldArgs): BaseConfigEditingField {
|
|
108
|
+
return {
|
|
109
|
+
...args,
|
|
110
|
+
resetKey: args.resetKey ?? CONFIG_FIELD_RESET_KEYS[args.id],
|
|
111
|
+
changed: args.changed ?? changed(args.value, args.defaultValue),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function booleanField(
|
|
116
|
+
args: Omit<FieldArgs, "value" | "defaultValue" | "kind"> & {
|
|
117
|
+
value: boolean;
|
|
118
|
+
defaultValue: boolean;
|
|
119
|
+
},
|
|
120
|
+
): BaseConfigEditingField {
|
|
121
|
+
return field({
|
|
122
|
+
...args,
|
|
123
|
+
value: enabledDisabled(args.value),
|
|
124
|
+
defaultValue: enabledDisabled(args.defaultValue),
|
|
125
|
+
changed: args.value !== args.defaultValue,
|
|
126
|
+
kind: "boolean",
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function textField(args: Omit<FieldArgs, "kind">): BaseConfigEditingField {
|
|
131
|
+
return field({ ...args, kind: "text" });
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function positiveIntField(
|
|
135
|
+
args: Omit<FieldArgs, "value" | "defaultValue" | "kind"> & {
|
|
136
|
+
value: number;
|
|
137
|
+
defaultValue: number;
|
|
138
|
+
suffix?: string;
|
|
139
|
+
},
|
|
140
|
+
): BaseConfigEditingField {
|
|
141
|
+
const { suffix = "", ...fieldArgs } = args;
|
|
142
|
+
return field({
|
|
143
|
+
...fieldArgs,
|
|
144
|
+
value: `${args.value}${suffix}`,
|
|
145
|
+
defaultValue: `${args.defaultValue}${suffix}`,
|
|
146
|
+
changed: args.value !== args.defaultValue,
|
|
147
|
+
kind: "positive-int",
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function selectField(
|
|
152
|
+
args: Omit<FieldArgs, "kind"> & { choices: string[] },
|
|
153
|
+
): BaseConfigEditingField {
|
|
154
|
+
return field({ ...args, kind: "select" });
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function valueAt(config: Record<string, unknown>, path: readonly string[]): unknown {
|
|
158
|
+
let value: unknown = config;
|
|
159
|
+
for (const part of path) {
|
|
160
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return undefined;
|
|
161
|
+
value = (value as Record<string, unknown>)[part];
|
|
162
|
+
}
|
|
163
|
+
return value;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function displayLayerValue(fieldId: FieldId, value: unknown): string | undefined {
|
|
167
|
+
if (value === undefined) return undefined;
|
|
168
|
+
if (typeof value === "boolean") return enabledDisabled(value);
|
|
169
|
+
if (typeof value === "string") {
|
|
170
|
+
if (fieldId === "apiKeyEnv") return "direct key set (masked)";
|
|
171
|
+
if (fieldId === "apiKeyDirect") return value ? "[REDACTED_API_KEY]" : "not set";
|
|
172
|
+
return value;
|
|
173
|
+
}
|
|
174
|
+
if (typeof value === "number") return String(value);
|
|
175
|
+
if (
|
|
176
|
+
typeof value === "object" &&
|
|
177
|
+
value !== null &&
|
|
178
|
+
!Array.isArray(value) &&
|
|
179
|
+
(value as { source?: unknown }).source === "env" &&
|
|
180
|
+
typeof (value as { name?: unknown }).name === "string"
|
|
181
|
+
) {
|
|
182
|
+
return String((value as { name: string }).name);
|
|
183
|
+
}
|
|
184
|
+
return JSON.stringify(value);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function firstLayerValue(
|
|
188
|
+
config: Record<string, unknown>,
|
|
189
|
+
paths: ReadonlyArray<readonly string[]>,
|
|
190
|
+
): unknown {
|
|
191
|
+
for (const path of paths) {
|
|
192
|
+
const value = valueAt(config, path);
|
|
193
|
+
if (value !== undefined) return value;
|
|
194
|
+
}
|
|
195
|
+
return undefined;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function resetPathsForKey(resetKey: string | undefined): ReadonlyArray<readonly string[]> {
|
|
199
|
+
if (!resetKey) return [];
|
|
200
|
+
return CONFIG_RESET_PATHS[resetKey as keyof typeof CONFIG_RESET_PATHS] ?? [];
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function fieldSourcePaths(
|
|
204
|
+
fieldId: FieldId,
|
|
205
|
+
resetKey: string | undefined,
|
|
206
|
+
): ReadonlyArray<readonly string[]> {
|
|
207
|
+
const paths = [CONFIG_FIELD_PATHS[fieldId], ...resetPathsForKey(resetKey)];
|
|
208
|
+
const seen = new Set<string>();
|
|
209
|
+
return paths.filter((path) => {
|
|
210
|
+
const key = path.join(".");
|
|
211
|
+
if (seen.has(key)) return false;
|
|
212
|
+
seen.add(key);
|
|
213
|
+
return true;
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function sourceFor(
|
|
218
|
+
layers: { project: Record<string, unknown>; global: Record<string, unknown> },
|
|
219
|
+
paths: ReadonlyArray<readonly string[]>,
|
|
220
|
+
envValue?: string,
|
|
221
|
+
): ConfigSource {
|
|
222
|
+
if (envValue !== undefined) return "env";
|
|
223
|
+
if (firstLayerValue(layers.project, paths) !== undefined) return "project";
|
|
224
|
+
if (firstLayerValue(layers.global, paths) !== undefined) return "global";
|
|
225
|
+
return "default";
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export function buildBaseConfigEditingFields(
|
|
229
|
+
config: ResolvedConfig,
|
|
230
|
+
projectBankId: string,
|
|
231
|
+
): BaseConfigEditingField[] {
|
|
232
|
+
const defaults = DEFAULT_CONFIG;
|
|
233
|
+
const profile = memoryProfileLabel(config);
|
|
234
|
+
const defaultProfile = memoryProfileLabel(defaults);
|
|
235
|
+
const globalBankId = config.banks.user.bankId ?? "not set";
|
|
236
|
+
const defaultGlobalBankId = defaults.banks.user.bankId ?? "not set";
|
|
237
|
+
return [
|
|
238
|
+
booleanField({
|
|
239
|
+
id: "enabled",
|
|
240
|
+
tab: "Connection",
|
|
241
|
+
label: "Extension active",
|
|
242
|
+
description: "Master switch. When off, automatic recall and retain are skipped.",
|
|
243
|
+
value: config.enabled,
|
|
244
|
+
defaultValue: defaults.enabled,
|
|
245
|
+
resetKey: "enabled",
|
|
246
|
+
}),
|
|
247
|
+
textField({
|
|
248
|
+
id: "baseUrl",
|
|
249
|
+
tab: "Connection",
|
|
250
|
+
label: "Hindsight API URL",
|
|
251
|
+
description: "Server endpoint used for recall, retain, reflect, and bank setup.",
|
|
252
|
+
value: config.hindsight.baseUrl,
|
|
253
|
+
defaultValue: defaults.hindsight.baseUrl,
|
|
254
|
+
resetKey: "hindsight.baseUrl",
|
|
255
|
+
}),
|
|
256
|
+
textField({
|
|
257
|
+
id: "apiKeyEnv",
|
|
258
|
+
tab: "Connection",
|
|
259
|
+
label: "API key source",
|
|
260
|
+
description:
|
|
261
|
+
"Recommended: environment variable name that contains the API key. Editing writes a safe env SecretRef, not the raw secret.",
|
|
262
|
+
value: apiKeySourceLabel(config),
|
|
263
|
+
defaultValue: "not set",
|
|
264
|
+
resetKey: "hindsight.apiKey",
|
|
265
|
+
}),
|
|
266
|
+
textField({
|
|
267
|
+
id: "apiKeyDirect",
|
|
268
|
+
tab: "Connection",
|
|
269
|
+
label: "Direct API key (not recommended)",
|
|
270
|
+
description:
|
|
271
|
+
"Advanced. Writes raw API key only to user/global config. Prefer API key source/env var whenever possible.",
|
|
272
|
+
value: config.hindsight.apiKey && apiKeyEnvName(config) === "not set" ? "set" : "not set",
|
|
273
|
+
defaultValue: "not set",
|
|
274
|
+
resetKey: "hindsight.apiKey",
|
|
275
|
+
advanced: true,
|
|
276
|
+
}),
|
|
277
|
+
positiveIntField({
|
|
278
|
+
id: "timeoutMs",
|
|
279
|
+
tab: "Connection",
|
|
280
|
+
label: "Request timeout",
|
|
281
|
+
description: "Maximum time to wait for Hindsight network calls.",
|
|
282
|
+
value: config.hindsight.timeoutMs,
|
|
283
|
+
defaultValue: defaults.hindsight.timeoutMs,
|
|
284
|
+
suffix: " ms",
|
|
285
|
+
resetKey: "hindsight.timeoutMs",
|
|
286
|
+
}),
|
|
287
|
+
selectField({
|
|
288
|
+
id: "memoryProfile",
|
|
289
|
+
tab: "Banks",
|
|
290
|
+
label: "Memory scope",
|
|
291
|
+
description:
|
|
292
|
+
"Coding (project-only) is recommended: shared coding bank. Coding+Life (project+global) adds a personal bank. Isolated is a hard-wall escape hatch. Life-only / recall-only are special cases.",
|
|
293
|
+
value: profile,
|
|
294
|
+
defaultValue: defaultProfile,
|
|
295
|
+
resetKey: "banks.profile",
|
|
296
|
+
choices: ["project-only", "project+global", "global-only", "recall-only"],
|
|
297
|
+
}),
|
|
298
|
+
selectField({
|
|
299
|
+
id: "agentUse",
|
|
300
|
+
tab: "Banks",
|
|
301
|
+
label: "Agent use",
|
|
302
|
+
description:
|
|
303
|
+
"Selects starter mental-model sets. Coding: architecture/conventions/decisions. Conversation: goals, people/context, and life-task preferences.",
|
|
304
|
+
value: config.agentUse,
|
|
305
|
+
defaultValue: defaults.agentUse,
|
|
306
|
+
resetKey: "agentUse",
|
|
307
|
+
choices: ["coding", "conversation"],
|
|
308
|
+
}),
|
|
309
|
+
booleanField({
|
|
310
|
+
id: "mentalModelsInject",
|
|
311
|
+
tab: "Banks",
|
|
312
|
+
label: "Inject mental models",
|
|
313
|
+
description:
|
|
314
|
+
"When models exist on the active bank(s), inject their content into automatic context alongside recall.",
|
|
315
|
+
value: config.mentalModels.inject,
|
|
316
|
+
defaultValue: defaults.mentalModels.inject,
|
|
317
|
+
resetKey: "mentalModels.inject",
|
|
318
|
+
}),
|
|
319
|
+
textField({
|
|
320
|
+
id: "projectBankId",
|
|
321
|
+
tab: "Banks",
|
|
322
|
+
label: "Coding bank ID",
|
|
323
|
+
description:
|
|
324
|
+
"Shared coding bank for domain-tagged mode (prefer user/global config). Isolated mode may pin a per-repo bank.",
|
|
325
|
+
value: projectBankId,
|
|
326
|
+
defaultValue: "auto-derived",
|
|
327
|
+
changed: Boolean(config.banks.project.bankId),
|
|
328
|
+
resetKey: "banks.project.bankId",
|
|
329
|
+
}),
|
|
330
|
+
booleanField({
|
|
331
|
+
id: "globalBankEnabled",
|
|
332
|
+
tab: "Banks",
|
|
333
|
+
label: "User memory enabled",
|
|
334
|
+
description: "Allows cross-project recall from a shared bank.",
|
|
335
|
+
value: config.banks.user.enabled,
|
|
336
|
+
defaultValue: defaults.banks.user.enabled,
|
|
337
|
+
resetKey: "banks.global.enabled",
|
|
338
|
+
}),
|
|
339
|
+
textField({
|
|
340
|
+
id: "globalBankId",
|
|
341
|
+
tab: "Banks",
|
|
342
|
+
label: "User bank ID",
|
|
343
|
+
description: "Shared user bank used only when user memory is enabled.",
|
|
344
|
+
value: globalBankId,
|
|
345
|
+
defaultValue: defaultGlobalBankId,
|
|
346
|
+
resetKey: "banks.global.bankId",
|
|
347
|
+
}),
|
|
348
|
+
booleanField({
|
|
349
|
+
id: "recallEnabled",
|
|
350
|
+
tab: "Recall",
|
|
351
|
+
label: "Automatic recall",
|
|
352
|
+
description: "Looks up memory before answer generation and injects it ephemerally.",
|
|
353
|
+
value: config.recall.enabled,
|
|
354
|
+
defaultValue: defaults.recall.enabled,
|
|
355
|
+
resetKey: "recall.enabled",
|
|
356
|
+
}),
|
|
357
|
+
selectField({
|
|
358
|
+
id: "recallBudget",
|
|
359
|
+
tab: "Recall",
|
|
360
|
+
label: "Recall depth",
|
|
361
|
+
description: "Low, mid, or high retrieval effort.",
|
|
362
|
+
value: config.recall.budget,
|
|
363
|
+
defaultValue: defaults.recall.budget,
|
|
364
|
+
resetKey: "recall.budget",
|
|
365
|
+
choices: ["low", "mid", "high"],
|
|
366
|
+
}),
|
|
367
|
+
positiveIntField({
|
|
368
|
+
id: "recallMaxTokens",
|
|
369
|
+
tab: "Recall",
|
|
370
|
+
label: "Project Bank recall token limit",
|
|
371
|
+
description: "Maximum Project Bank memory tokens injected into context.",
|
|
372
|
+
value: config.recall.maxTokens,
|
|
373
|
+
defaultValue: defaults.recall.maxTokens,
|
|
374
|
+
resetKey: "recall.maxTokens",
|
|
375
|
+
}),
|
|
376
|
+
positiveIntField({
|
|
377
|
+
id: "recallUserMaxTokens",
|
|
378
|
+
tab: "Recall",
|
|
379
|
+
label: "User Bank recall token limit",
|
|
380
|
+
description:
|
|
381
|
+
"Maximum User Bank memory tokens injected into context, independent of the Project Bank limit.",
|
|
382
|
+
value: config.recall.userMaxTokens,
|
|
383
|
+
defaultValue: defaults.recall.userMaxTokens,
|
|
384
|
+
resetKey: "recall.userMaxTokens",
|
|
385
|
+
advanced: true,
|
|
386
|
+
}),
|
|
387
|
+
booleanField({
|
|
388
|
+
id: "recallStoreLast",
|
|
389
|
+
tab: "Recall",
|
|
390
|
+
label: "Store last recall snapshot",
|
|
391
|
+
description:
|
|
392
|
+
"Advanced. Writes the latest successful recall snapshot to a local sidecar under .pi/hindsight/ for debugging.",
|
|
393
|
+
value: config.recall.storeLastRecall,
|
|
394
|
+
defaultValue: defaults.recall.storeLastRecall,
|
|
395
|
+
resetKey: "recall.storeLastRecall",
|
|
396
|
+
advanced: true,
|
|
397
|
+
}),
|
|
398
|
+
booleanField({
|
|
399
|
+
id: "recallStoreFailures",
|
|
400
|
+
tab: "Recall",
|
|
401
|
+
label: "Store recall failures",
|
|
402
|
+
description:
|
|
403
|
+
"Advanced. Also records redacted failed recall attempts in the last-recall sidecar. Requires storing last recall snapshots.",
|
|
404
|
+
value: config.recall.storeLastRecallFailures,
|
|
405
|
+
defaultValue: defaults.recall.storeLastRecallFailures,
|
|
406
|
+
resetKey: "recall.storeLastRecallFailures",
|
|
407
|
+
advanced: true,
|
|
408
|
+
}),
|
|
409
|
+
booleanField({
|
|
410
|
+
id: "recallPreferObservations",
|
|
411
|
+
tab: "Recall",
|
|
412
|
+
label: "Prefer observations",
|
|
413
|
+
description:
|
|
414
|
+
"Advanced. When recalling raw facts together with observations, drop raw facts superseded by a returned observation.",
|
|
415
|
+
value: config.recall.preferObservations,
|
|
416
|
+
defaultValue: defaults.recall.preferObservations,
|
|
417
|
+
resetKey: "recall.preferObservations",
|
|
418
|
+
advanced: true,
|
|
419
|
+
}),
|
|
420
|
+
booleanField({
|
|
421
|
+
id: "retainEnabled",
|
|
422
|
+
tab: "Retain",
|
|
423
|
+
label: "Automatic retain",
|
|
424
|
+
description: "Stores raw structured conversation deltas after turns.",
|
|
425
|
+
value: config.retain.enabled,
|
|
426
|
+
defaultValue: defaults.retain.enabled,
|
|
427
|
+
resetKey: "retain.enabled",
|
|
428
|
+
}),
|
|
429
|
+
booleanField({
|
|
430
|
+
id: "retainAsync",
|
|
431
|
+
tab: "Retain",
|
|
432
|
+
label: "Queued retain writes",
|
|
433
|
+
description: "Writes retain jobs through durable queue instead of blocking UI.",
|
|
434
|
+
value: config.retain.async,
|
|
435
|
+
defaultValue: defaults.retain.async,
|
|
436
|
+
resetKey: "retain.async",
|
|
437
|
+
advanced: true,
|
|
438
|
+
}),
|
|
439
|
+
selectField({
|
|
440
|
+
id: "retainDelivery",
|
|
441
|
+
tab: "Retain",
|
|
442
|
+
label: "Retain delivery",
|
|
443
|
+
description:
|
|
444
|
+
"immediate flushes after every turn (default); coalesced merges compatible deltas and defers delivery to session end or periodic flush (retain.flushIntervalMs) to cut database write amplification.",
|
|
445
|
+
value: config.retain.delivery,
|
|
446
|
+
defaultValue: defaults.retain.delivery,
|
|
447
|
+
resetKey: "retain.delivery",
|
|
448
|
+
choices: ["immediate", "coalesced"],
|
|
449
|
+
advanced: true,
|
|
450
|
+
}),
|
|
451
|
+
textField({
|
|
452
|
+
id: "queuePath",
|
|
453
|
+
tab: "Retain",
|
|
454
|
+
label: "Retain queue file",
|
|
455
|
+
description: "JSONL retry queue used when Hindsight is unavailable.",
|
|
456
|
+
value: config.retain.queuePath,
|
|
457
|
+
defaultValue: defaults.retain.queuePath,
|
|
458
|
+
resetKey: "retain.queuePath",
|
|
459
|
+
advanced: true,
|
|
460
|
+
}),
|
|
461
|
+
selectField({
|
|
462
|
+
id: "globalRetainMode",
|
|
463
|
+
tab: "Retain",
|
|
464
|
+
label: "User retain mode",
|
|
465
|
+
description:
|
|
466
|
+
"Advanced. explicit-only keeps User Bank writes manual (the only supported mode).",
|
|
467
|
+
value: config.userRetain.mode,
|
|
468
|
+
defaultValue: defaults.userRetain.mode,
|
|
469
|
+
resetKey: "globalRetain.mode",
|
|
470
|
+
choices: ["explicit-only"],
|
|
471
|
+
advanced: true,
|
|
472
|
+
}),
|
|
473
|
+
selectField({
|
|
474
|
+
id: "importMode",
|
|
475
|
+
tab: "Import",
|
|
476
|
+
label: "Import mode",
|
|
477
|
+
description:
|
|
478
|
+
"Curated drops noisy successful tool results from preview metrics; raw keeps current raw branch import behavior; forensic preserves recall blocks too.",
|
|
479
|
+
value: config.import.mode,
|
|
480
|
+
defaultValue: defaults.import.mode,
|
|
481
|
+
resetKey: "import.mode",
|
|
482
|
+
choices: ["curated", "raw", "forensic"],
|
|
483
|
+
}),
|
|
484
|
+
selectField({
|
|
485
|
+
id: "importQualityProfile",
|
|
486
|
+
tab: "Import",
|
|
487
|
+
label: "Curated quality profile",
|
|
488
|
+
description:
|
|
489
|
+
"Compatible preserves current curated behavior; strict drops process/UI-like, oversized, or repeated successful tool output in curated mode.",
|
|
490
|
+
value: config.import.qualityProfile,
|
|
491
|
+
defaultValue: defaults.import.qualityProfile,
|
|
492
|
+
resetKey: "import.qualityProfile",
|
|
493
|
+
choices: ["compatible", "strict"],
|
|
494
|
+
}),
|
|
495
|
+
selectField({
|
|
496
|
+
id: "importBranches",
|
|
497
|
+
tab: "Import",
|
|
498
|
+
label: "Historical import scope",
|
|
499
|
+
description: "Import current branch only, or every leaf branch explicitly.",
|
|
500
|
+
value: config.import.includeBranches,
|
|
501
|
+
defaultValue: defaults.import.includeBranches,
|
|
502
|
+
resetKey: "import.includeBranches",
|
|
503
|
+
choices: ["current-only", "all-leaves"],
|
|
504
|
+
}),
|
|
505
|
+
selectField({
|
|
506
|
+
id: "importToolResults",
|
|
507
|
+
tab: "Import",
|
|
508
|
+
label: "Successful tool results",
|
|
509
|
+
description:
|
|
510
|
+
"Curated import defaults to errors-only; summary keeps bounded low-noise successful tool output; content keeps allowed full successful tool content.",
|
|
511
|
+
value: config.import.toolResults,
|
|
512
|
+
defaultValue: defaults.import.toolResults,
|
|
513
|
+
resetKey: "import.toolResults",
|
|
514
|
+
choices: ["errors-only", "summary", "content"],
|
|
515
|
+
}),
|
|
516
|
+
positiveIntField({
|
|
517
|
+
id: "importToolSummaryMaxChars",
|
|
518
|
+
tab: "Import",
|
|
519
|
+
label: "Tool summary max chars",
|
|
520
|
+
description: "Maximum characters kept for successful tool summaries in curated imports.",
|
|
521
|
+
value: config.import.toolResultSummaryMaxChars,
|
|
522
|
+
defaultValue: defaults.import.toolResultSummaryMaxChars,
|
|
523
|
+
resetKey: "import.toolResultSummaryMaxChars",
|
|
524
|
+
advanced: true,
|
|
525
|
+
}),
|
|
526
|
+
textField({
|
|
527
|
+
id: "importManifest",
|
|
528
|
+
tab: "Import",
|
|
529
|
+
label: "Import manifest file",
|
|
530
|
+
description: "Tracks imported sessions so reimports stay deterministic.",
|
|
531
|
+
value: config.import.manifestPath,
|
|
532
|
+
defaultValue: defaults.import.manifestPath,
|
|
533
|
+
resetKey: "import.manifestPath",
|
|
534
|
+
advanced: true,
|
|
535
|
+
}),
|
|
536
|
+
textField({
|
|
537
|
+
id: "importCheckpoint",
|
|
538
|
+
tab: "Import",
|
|
539
|
+
label: "Import checkpoint file",
|
|
540
|
+
description: "Tracks import progress so interrupted imports can resume safely.",
|
|
541
|
+
value: config.import.checkpointPath,
|
|
542
|
+
defaultValue: defaults.import.checkpointPath,
|
|
543
|
+
resetKey: "import.checkpointPath",
|
|
544
|
+
advanced: true,
|
|
545
|
+
}),
|
|
546
|
+
booleanField({
|
|
547
|
+
id: "importReplaceExisting",
|
|
548
|
+
tab: "Import",
|
|
549
|
+
label: "Replace existing import docs",
|
|
550
|
+
description:
|
|
551
|
+
"Uses deterministic replace mode for historical reimports instead of appending duplicates.",
|
|
552
|
+
value: config.import.replaceExistingImportedDocs,
|
|
553
|
+
defaultValue: defaults.import.replaceExistingImportedDocs,
|
|
554
|
+
resetKey: "import.replaceExistingImportedDocs",
|
|
555
|
+
advanced: true,
|
|
556
|
+
}),
|
|
557
|
+
booleanField({
|
|
558
|
+
id: "importResume",
|
|
559
|
+
tab: "Import",
|
|
560
|
+
label: "Resume interrupted imports",
|
|
561
|
+
description: "Skips completed import documents when checkpoint content hashes match.",
|
|
562
|
+
value: config.import.resume,
|
|
563
|
+
defaultValue: defaults.import.resume,
|
|
564
|
+
resetKey: "import.resume",
|
|
565
|
+
advanced: true,
|
|
566
|
+
}),
|
|
567
|
+
selectField({
|
|
568
|
+
id: "statusStyle",
|
|
569
|
+
tab: "UI",
|
|
570
|
+
label: "Footer status style",
|
|
571
|
+
description: "Off, plain text, emoji, or nerdfont symbols.",
|
|
572
|
+
value: config.status.style,
|
|
573
|
+
defaultValue: defaults.status.style,
|
|
574
|
+
resetKey: "status.style",
|
|
575
|
+
choices: ["off", "text", "emoji", "nerdfont"],
|
|
576
|
+
}),
|
|
577
|
+
selectField({
|
|
578
|
+
id: "statusDetail",
|
|
579
|
+
tab: "UI",
|
|
580
|
+
label: "Footer status detail",
|
|
581
|
+
description: "How much Hindsight info appears in Pi footer.",
|
|
582
|
+
value: config.status.detail,
|
|
583
|
+
defaultValue: defaults.status.detail,
|
|
584
|
+
resetKey: "status.detail",
|
|
585
|
+
choices: ["minimal", "project", "activity", "verbose"],
|
|
586
|
+
}),
|
|
587
|
+
positiveIntField({
|
|
588
|
+
id: "statusMaxLength",
|
|
589
|
+
tab: "UI",
|
|
590
|
+
label: "Footer max length",
|
|
591
|
+
description: "Maximum characters used by Hindsight footer status.",
|
|
592
|
+
value: config.status.maxLength,
|
|
593
|
+
defaultValue: defaults.status.maxLength,
|
|
594
|
+
resetKey: "status.maxLength",
|
|
595
|
+
}),
|
|
596
|
+
booleanField({
|
|
597
|
+
id: "statusActivity",
|
|
598
|
+
tab: "UI",
|
|
599
|
+
label: "Show live activity",
|
|
600
|
+
description: "Displays recall/retain activity in the status line.",
|
|
601
|
+
value: config.status.showActivity,
|
|
602
|
+
defaultValue: defaults.status.showActivity,
|
|
603
|
+
resetKey: "status.showActivity",
|
|
604
|
+
}),
|
|
605
|
+
booleanField({
|
|
606
|
+
id: "notifyStartup",
|
|
607
|
+
tab: "UI",
|
|
608
|
+
label: "Startup notification",
|
|
609
|
+
description: "Shows selected Hindsight bank when Pi session starts.",
|
|
610
|
+
value: config.notifications.startup,
|
|
611
|
+
defaultValue: defaults.notifications.startup,
|
|
612
|
+
resetKey: "notifications.startup",
|
|
613
|
+
}),
|
|
614
|
+
booleanField({
|
|
615
|
+
id: "notifyRecall",
|
|
616
|
+
tab: "UI",
|
|
617
|
+
label: "Recall notifications",
|
|
618
|
+
description: "Shows a toast when automatic recall runs.",
|
|
619
|
+
value: config.notifications.recall,
|
|
620
|
+
defaultValue: defaults.notifications.recall,
|
|
621
|
+
resetKey: "notifications.recall",
|
|
622
|
+
}),
|
|
623
|
+
booleanField({
|
|
624
|
+
id: "notifyRetain",
|
|
625
|
+
tab: "UI",
|
|
626
|
+
label: "Retain notifications",
|
|
627
|
+
description: "Shows a toast when automatic retain queues memory.",
|
|
628
|
+
value: config.notifications.retain,
|
|
629
|
+
defaultValue: defaults.notifications.retain,
|
|
630
|
+
resetKey: "notifications.retain",
|
|
631
|
+
}),
|
|
632
|
+
];
|
|
633
|
+
}
|
|
634
|
+
export const PROJECT_ONLY_FIELD_IDS = new Set<FieldId>([
|
|
635
|
+
// projectBankId is intentionally global+project: shared coding bank lives in user config.
|
|
636
|
+
"memoryProfile",
|
|
637
|
+
"agentUse",
|
|
638
|
+
"mentalModelsInject",
|
|
639
|
+
"queuePath",
|
|
640
|
+
"importMode",
|
|
641
|
+
"importQualityProfile",
|
|
642
|
+
"importBranches",
|
|
643
|
+
"importToolResults",
|
|
644
|
+
"importToolSummaryMaxChars",
|
|
645
|
+
"importManifest",
|
|
646
|
+
"importCheckpoint",
|
|
647
|
+
"importReplaceExisting",
|
|
648
|
+
"importResume",
|
|
649
|
+
]);
|
|
650
|
+
|
|
651
|
+
export function editableScopesForField(fieldId: FieldId): ConfigScope[] {
|
|
652
|
+
if (fieldId === "apiKeyDirect") return ["global"];
|
|
653
|
+
return PROJECT_ONLY_FIELD_IDS.has(fieldId) ? ["project"] : ["project", "global"];
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
export function configEnvValues(env: NodeJS.ProcessEnv): Partial<Record<FieldId, string>> {
|
|
657
|
+
const userBankId = env.PI_HINDSIGHT_USER_BANK_ID || env.PI_HINDSIGHT_GLOBAL_BANK_ID;
|
|
658
|
+
return {
|
|
659
|
+
...(env.PI_HINDSIGHT_ENABLED ? { enabled: env.PI_HINDSIGHT_ENABLED } : {}),
|
|
660
|
+
...(env.HINDSIGHT_BASE_URL ? { baseUrl: env.HINDSIGHT_BASE_URL } : {}),
|
|
661
|
+
...(env.HINDSIGHT_API_KEY_REF
|
|
662
|
+
? { apiKeyEnv: env.HINDSIGHT_API_KEY_REF }
|
|
663
|
+
: env.HINDSIGHT_API_TOKEN
|
|
664
|
+
? { apiKeyEnv: "HINDSIGHT_API_TOKEN" }
|
|
665
|
+
: env.HINDSIGHT_API_KEY
|
|
666
|
+
? { apiKeyEnv: "HINDSIGHT_API_KEY" }
|
|
667
|
+
: {}),
|
|
668
|
+
...(env.PI_HINDSIGHT_PROJECT_BANK_ID
|
|
669
|
+
? { projectBankId: env.PI_HINDSIGHT_PROJECT_BANK_ID }
|
|
670
|
+
: {}),
|
|
671
|
+
...(userBankId ? { globalBankId: userBankId, globalBankEnabled: "enabled" } : {}),
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
function layerField(
|
|
676
|
+
base: BaseConfigEditingField,
|
|
677
|
+
layers: { project: Record<string, unknown>; global: Record<string, unknown> },
|
|
678
|
+
envValue: string | undefined,
|
|
679
|
+
): ConfigEditingField {
|
|
680
|
+
const paths = fieldSourcePaths(base.id, base.resetKey);
|
|
681
|
+
const projectValue = displayLayerValue(base.id, firstLayerValue(layers.project, paths));
|
|
682
|
+
const globalValue = displayLayerValue(base.id, firstLayerValue(layers.global, paths));
|
|
683
|
+
const source = sourceFor(layers, paths, envValue);
|
|
684
|
+
return {
|
|
685
|
+
...base,
|
|
686
|
+
...(projectValue !== undefined ? { projectValue } : {}),
|
|
687
|
+
...(globalValue !== undefined ? { globalValue } : {}),
|
|
688
|
+
...(envValue !== undefined ? { envValue } : {}),
|
|
689
|
+
source,
|
|
690
|
+
editableScopes: editableScopesForField(base.id),
|
|
691
|
+
changed: source !== "default",
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
export function buildConfigEditingFieldsFromRegistry(
|
|
696
|
+
config: ResolvedConfig,
|
|
697
|
+
projectBankId: string,
|
|
698
|
+
layers: {
|
|
699
|
+
project: Record<string, unknown>;
|
|
700
|
+
global: Record<string, unknown>;
|
|
701
|
+
env: NodeJS.ProcessEnv;
|
|
702
|
+
},
|
|
703
|
+
): ConfigEditingField[] {
|
|
704
|
+
const envValues = configEnvValues(layers.env);
|
|
705
|
+
return buildBaseConfigEditingFields(config, projectBankId).map((base) =>
|
|
706
|
+
layerField(base, layers, envValues[base.id]),
|
|
707
|
+
);
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
export function parseConfigEditingFieldInput(
|
|
711
|
+
field: Pick<ConfigEditingField, "id" | "kind">,
|
|
712
|
+
value: string | undefined,
|
|
713
|
+
): string | undefined {
|
|
714
|
+
if (value === undefined || value.trim() === "") return undefined;
|
|
715
|
+
if (field.kind !== "positive-int") return value;
|
|
716
|
+
const parsed = Number(value.trim());
|
|
717
|
+
if (!Number.isInteger(parsed) || parsed <= 0)
|
|
718
|
+
throw new Error(`${field.id} must be a positive integer`);
|
|
719
|
+
return value;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
export function patchForConfigEditingField(
|
|
723
|
+
fieldId: FieldId,
|
|
724
|
+
value: string,
|
|
725
|
+
config: ResolvedConfig,
|
|
726
|
+
): ProjectConfigPatchInput | undefined {
|
|
727
|
+
switch (fieldId) {
|
|
728
|
+
case "enabled":
|
|
729
|
+
return { enabled: value === "Enable" };
|
|
730
|
+
case "baseUrl":
|
|
731
|
+
return { baseUrl: value.trim() };
|
|
732
|
+
case "apiKeyEnv":
|
|
733
|
+
return { apiKeyEnvVar: value.trim() };
|
|
734
|
+
case "apiKeyDirect":
|
|
735
|
+
return { directApiKey: value.trim() };
|
|
736
|
+
case "timeoutMs":
|
|
737
|
+
return { timeoutMs: Number(value) };
|
|
738
|
+
case "memoryProfile":
|
|
739
|
+
return {
|
|
740
|
+
memoryProfile: value as MemoryProfile,
|
|
741
|
+
globalBankId: config.banks.user.bankId ?? DEFAULT_GLOBAL_BANK_ID,
|
|
742
|
+
};
|
|
743
|
+
case "agentUse":
|
|
744
|
+
return { agentUse: value as "coding" | "conversation" };
|
|
745
|
+
case "mentalModelsInject":
|
|
746
|
+
return { mentalModelsInject: value === "Enable" };
|
|
747
|
+
case "projectBankId":
|
|
748
|
+
return { projectBankId: value.trim() };
|
|
749
|
+
case "projectRetainMission":
|
|
750
|
+
return { projectRetainMission: value.trim() };
|
|
751
|
+
case "projectReflectMission":
|
|
752
|
+
return { projectReflectMission: value.trim() };
|
|
753
|
+
case "projectObservationsMission":
|
|
754
|
+
return { projectObservationsMission: value.trim() };
|
|
755
|
+
case "globalBankEnabled":
|
|
756
|
+
return { enableGlobalBank: value === "Enable" };
|
|
757
|
+
case "globalBankId":
|
|
758
|
+
return { globalBankId: value.trim() };
|
|
759
|
+
case "globalRetainMission":
|
|
760
|
+
return { globalRetainMission: value.trim() };
|
|
761
|
+
case "globalReflectMission":
|
|
762
|
+
return { globalReflectMission: value.trim() };
|
|
763
|
+
case "globalObservationsMission":
|
|
764
|
+
return { globalObservationsMission: value.trim() };
|
|
765
|
+
case "globalRetainMode":
|
|
766
|
+
return { globalRetainMode: value as "explicit-only" };
|
|
767
|
+
case "recallEnabled":
|
|
768
|
+
return { recallEnabled: value === "Enable" };
|
|
769
|
+
case "recallBudget":
|
|
770
|
+
return { recallBudget: value as "low" | "mid" | "high" };
|
|
771
|
+
case "recallMaxTokens":
|
|
772
|
+
return { recallMaxTokens: Number(value) };
|
|
773
|
+
case "recallUserMaxTokens":
|
|
774
|
+
return { recallUserMaxTokens: Number(value) };
|
|
775
|
+
case "recallStoreLast":
|
|
776
|
+
return { recallStoreLast: value === "Enable" };
|
|
777
|
+
case "recallStoreFailures":
|
|
778
|
+
return { recallStoreFailures: value === "Enable" };
|
|
779
|
+
case "recallPreferObservations":
|
|
780
|
+
return { recallPreferObservations: value === "Enable" };
|
|
781
|
+
case "retainEnabled":
|
|
782
|
+
return { retainEnabled: value === "Enable" };
|
|
783
|
+
case "retainAsync":
|
|
784
|
+
return { retainAsync: value === "Enable" };
|
|
785
|
+
case "retainDelivery":
|
|
786
|
+
return { retainDelivery: value as "immediate" | "coalesced" };
|
|
787
|
+
case "queuePath":
|
|
788
|
+
return { queuePath: value.trim() };
|
|
789
|
+
case "importMode":
|
|
790
|
+
return { importMode: value as "curated" | "raw" | "forensic" };
|
|
791
|
+
case "importQualityProfile":
|
|
792
|
+
return { importQualityProfile: value as "compatible" | "strict" };
|
|
793
|
+
case "importBranches":
|
|
794
|
+
return { importIncludeBranches: value as "current-only" | "all-leaves" };
|
|
795
|
+
case "importToolResults":
|
|
796
|
+
return { importToolResults: value as "errors-only" | "summary" | "content" };
|
|
797
|
+
case "importToolSummaryMaxChars":
|
|
798
|
+
return { importToolResultSummaryMaxChars: Number(value) };
|
|
799
|
+
case "importManifest":
|
|
800
|
+
return { importManifestPath: value.trim() };
|
|
801
|
+
case "importCheckpoint":
|
|
802
|
+
return { importCheckpointPath: value.trim() };
|
|
803
|
+
case "importReplaceExisting":
|
|
804
|
+
return { importReplaceExistingDocs: value === "Enable" };
|
|
805
|
+
case "importResume":
|
|
806
|
+
return { importResume: value === "Enable" };
|
|
807
|
+
case "statusStyle":
|
|
808
|
+
return { statusStyle: value as "off" | "text" | "emoji" | "nerdfont" };
|
|
809
|
+
case "statusDetail":
|
|
810
|
+
return { statusDetail: value as "minimal" | "project" | "activity" | "verbose" };
|
|
811
|
+
case "statusMaxLength":
|
|
812
|
+
return { statusMaxLength: Number(value) };
|
|
813
|
+
case "statusActivity":
|
|
814
|
+
return { statusShowActivity: value === "Enable" };
|
|
815
|
+
case "notifyStartup":
|
|
816
|
+
return { notifyStartup: value === "Enable" };
|
|
817
|
+
case "notifyRecall":
|
|
818
|
+
return { notifyRecall: value === "Enable" };
|
|
819
|
+
case "notifyRetain":
|
|
820
|
+
return { notifyRetain: value === "Enable" };
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
export function inputDefaultForConfigEditingField(
|
|
825
|
+
fieldId: FieldId,
|
|
826
|
+
config: ResolvedConfig,
|
|
827
|
+
projectBankId: string,
|
|
828
|
+
): string {
|
|
829
|
+
switch (fieldId) {
|
|
830
|
+
case "apiKeyEnv":
|
|
831
|
+
return apiKeyEnvName(config) === "not set" ? "HINDSIGHT_API_TOKEN" : apiKeyEnvName(config);
|
|
832
|
+
case "apiKeyDirect":
|
|
833
|
+
return "";
|
|
834
|
+
case "projectBankId":
|
|
835
|
+
return projectBankId;
|
|
836
|
+
case "projectRetainMission":
|
|
837
|
+
return config.banks.project.retainMission ?? "";
|
|
838
|
+
case "projectReflectMission":
|
|
839
|
+
return config.banks.project.reflectMission ?? "";
|
|
840
|
+
case "projectObservationsMission":
|
|
841
|
+
return config.banks.project.observationsMission ?? "";
|
|
842
|
+
case "globalBankId":
|
|
843
|
+
return config.banks.user.bankId ?? DEFAULT_GLOBAL_BANK_ID;
|
|
844
|
+
case "globalRetainMission":
|
|
845
|
+
return config.banks.user.retainMission ?? "";
|
|
846
|
+
case "globalReflectMission":
|
|
847
|
+
return config.banks.user.reflectMission ?? "";
|
|
848
|
+
case "globalObservationsMission":
|
|
849
|
+
return config.banks.user.observationsMission ?? "";
|
|
850
|
+
case "globalRetainMode":
|
|
851
|
+
return config.userRetain.mode;
|
|
852
|
+
case "timeoutMs":
|
|
853
|
+
return String(config.hindsight.timeoutMs);
|
|
854
|
+
case "recallMaxTokens":
|
|
855
|
+
return String(config.recall.maxTokens);
|
|
856
|
+
case "recallUserMaxTokens":
|
|
857
|
+
return String(config.recall.userMaxTokens);
|
|
858
|
+
case "statusMaxLength":
|
|
859
|
+
return String(config.status.maxLength);
|
|
860
|
+
case "baseUrl":
|
|
861
|
+
return config.hindsight.baseUrl;
|
|
862
|
+
case "queuePath":
|
|
863
|
+
return config.retain.queuePath;
|
|
864
|
+
case "importToolSummaryMaxChars":
|
|
865
|
+
return String(config.import.toolResultSummaryMaxChars);
|
|
866
|
+
case "importQualityProfile":
|
|
867
|
+
return config.import.qualityProfile;
|
|
868
|
+
case "importManifest":
|
|
869
|
+
return config.import.manifestPath;
|
|
870
|
+
case "importCheckpoint":
|
|
871
|
+
return config.import.checkpointPath;
|
|
872
|
+
default:
|
|
873
|
+
return "";
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
export function buildStatusFacts(
|
|
878
|
+
config: ResolvedConfig,
|
|
879
|
+
projectBankId: string,
|
|
880
|
+
extraFacts: Array<[string, string]> = [],
|
|
881
|
+
): Array<[string, string]> {
|
|
882
|
+
const profile = memoryProfileLabel(config);
|
|
883
|
+
return [
|
|
884
|
+
...extraFacts,
|
|
885
|
+
["Extension", enabledDisabled(config.enabled)],
|
|
886
|
+
["Memory scope", profile],
|
|
887
|
+
["Agent use", config.agentUse],
|
|
888
|
+
[
|
|
889
|
+
"Mental models",
|
|
890
|
+
config.mentalModels.inject
|
|
891
|
+
? `inject on (budget ${config.mentalModels.maxChars}; apply with t; cache ${config.mentalModels.cacheTtlMs}ms)`
|
|
892
|
+
: "inject off",
|
|
893
|
+
],
|
|
894
|
+
["Active project bank", config.banks.project.enabled ? projectBankId : "disabled"],
|
|
895
|
+
[
|
|
896
|
+
"User bank",
|
|
897
|
+
config.banks.user.enabled ? (config.banks.user.bankId ?? "missing id") : "disabled",
|
|
898
|
+
],
|
|
899
|
+
...(config.banks.project.retainMission ||
|
|
900
|
+
config.banks.project.reflectMission ||
|
|
901
|
+
config.banks.project.observationsMission
|
|
902
|
+
? [
|
|
903
|
+
["Project mission overrides", "legacy local config; prefer Hindsight bank config"] as [
|
|
904
|
+
string,
|
|
905
|
+
string,
|
|
906
|
+
],
|
|
907
|
+
]
|
|
908
|
+
: []),
|
|
909
|
+
...(config.banks.user.retainMission ||
|
|
910
|
+
config.banks.user.reflectMission ||
|
|
911
|
+
config.banks.user.observationsMission
|
|
912
|
+
? [
|
|
913
|
+
["User mission overrides", "legacy local config; prefer Hindsight bank config"] as [
|
|
914
|
+
string,
|
|
915
|
+
string,
|
|
916
|
+
],
|
|
917
|
+
]
|
|
918
|
+
: []),
|
|
919
|
+
["User retain mode", config.userRetain.mode],
|
|
920
|
+
["Recall", enabledDisabled(config.recall.enabled)],
|
|
921
|
+
["Retain", enabledDisabled(config.retain.enabled)],
|
|
922
|
+
["Retain queue", config.retain.queuePath],
|
|
923
|
+
["Hindsight API", config.hindsight.baseUrl],
|
|
924
|
+
];
|
|
925
|
+
}
|