@herbertgao/pi-extensions 2026.8.13 → 2026.8.15
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 +19 -14
- package/THIRD_PARTY_NOTICES.md +0 -1
- package/node_modules/@czottmann/pi-automode/CHANGELOG.md +19 -0
- package/node_modules/@czottmann/pi-automode/README.md +5 -1
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/classifier.ts +126 -13
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/config.ts +7 -3
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/constants.ts +2 -0
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/hard-deny.ts +134 -23
- package/node_modules/@czottmann/pi-automode/package.json +1 -1
- package/node_modules/@herbertgao/{pi-stash → pi-bark}/LICENSE +4 -5
- package/node_modules/@herbertgao/pi-bark/README.md +44 -0
- package/node_modules/@herbertgao/pi-bark/assets/pi-icon.png +0 -0
- package/node_modules/@herbertgao/pi-bark/package.json +53 -0
- package/node_modules/@herbertgao/pi-bark/src/index.ts +178 -0
- package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/README.md +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +3 -3
- package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +6 -0
- package/node_modules/@herbertgao/pi-subagents/package.json +2 -1
- package/node_modules/@herbertgao/pi-subagents/src/ui/conversation-viewer.ts +8 -1
- package/node_modules/@juicesharp/rpiv-ask-user-question/package.json +2 -2
- package/node_modules/@narumitw/pi-btw/README.md +125 -88
- package/node_modules/@narumitw/pi-btw/dist/index.ts +140 -45
- package/node_modules/@narumitw/pi-btw/dist/index.ts.map +2 -2
- package/node_modules/@narumitw/pi-btw/package.json +5 -8
- package/node_modules/@narumitw/pi-btw/src/btw.ts +31 -26
- package/node_modules/@narumitw/pi-btw/src/fullscreen-ui.ts +106 -17
- package/node_modules/@narumitw/pi-btw/src/menu.ts +34 -2
- package/node_modules/@narumitw/pi-btw/src/settings.ts +16 -0
- package/node_modules/@tifan/pi-handoff/README.md +36 -13
- package/node_modules/@tifan/pi-handoff/package.json +2 -2
- package/node_modules/@tifan/pi-handoff/src/index.ts +160 -4
- package/node_modules/@tifan/pi-preferred-thinking/README.md +1 -1
- package/node_modules/@tifan/pi-preferred-thinking/package.json +1 -1
- package/node_modules/@tifan/pi-preferred-thinking/src/index.ts +15 -2
- package/node_modules/@tifan/pi-recap/README.md +1 -1
- package/node_modules/@tifan/pi-recap/package.json +2 -2
- package/node_modules/@tifan/pi-recap/src/index.ts +15 -0
- package/node_modules/@tifan/pi-rename/README.md +42 -21
- package/node_modules/@tifan/pi-rename/package.json +1 -1
- package/node_modules/@tifan/pi-rename/src/index.ts +62 -11
- package/node_modules/@tifan/pi-rename/src/language.ts +18 -0
- package/node_modules/@tifan/pi-rename/src/models.ts +69 -13
- package/node_modules/@tifan/pi-rename/src/naming.ts +36 -7
- package/node_modules/@tifan/pi-rename/src/sanitize.ts +22 -14
- package/node_modules/pi-lens/CHANGELOG.md +320 -0
- package/node_modules/pi-lens/config/dependency-cruiser-eager-allowlist.json +79 -0
- package/node_modules/pi-lens/dist/clients/actionable-warnings-logger.js +16 -1
- package/node_modules/pi-lens/dist/clients/ast-grep-client.js +13 -6
- package/node_modules/pi-lens/dist/clients/availability-probe-flight.js +12 -0
- package/node_modules/pi-lens/dist/clients/biome-client.js +7 -0
- package/node_modules/pi-lens/dist/clients/blocker-freshness.js +20 -0
- package/node_modules/pi-lens/dist/clients/bounded-telemetry.js +56 -19
- package/node_modules/pi-lens/dist/clients/build-identity.js +95 -0
- package/node_modules/pi-lens/dist/clients/bus-publish.js +3 -0
- package/node_modules/pi-lens/dist/clients/cache/rule-cache.js +2 -1
- package/node_modules/pi-lens/dist/clients/cache-observability.js +2 -1
- package/node_modules/pi-lens/dist/clients/cascade-logger.js +15 -1
- package/node_modules/pi-lens/dist/clients/dead-code-client.js +14 -11
- package/node_modules/pi-lens/dist/clients/degradation-ledger.js +56 -4
- package/node_modules/pi-lens/dist/clients/demoted-finding-render.js +14 -0
- package/node_modules/pi-lens/dist/clients/dependency-checker.js +20 -3
- package/node_modules/pi-lens/dist/clients/deps/minimatch.js +1 -1
- package/node_modules/pi-lens/dist/clients/dispatch/collect-later-tier.js +39 -0
- package/node_modules/pi-lens/dist/clients/dispatch/dispatcher.js +150 -9
- package/node_modules/pi-lens/dist/clients/dispatch/fact-store.js +231 -9
- package/node_modules/pi-lens/dist/clients/dispatch/integration.js +205 -100
- package/node_modules/pi-lens/dist/clients/dispatch/pending-runner-findings.js +87 -0
- package/node_modules/pi-lens/dist/clients/dispatch/plan.js +21 -5
- package/node_modules/pi-lens/dist/clients/dispatch/runners/ast-grep-napi.js +174 -55
- package/node_modules/pi-lens/dist/clients/dispatch/runners/eslint.js +5 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/helm-lint.js +16 -3
- package/node_modules/pi-lens/dist/clients/dispatch/runners/helm-render.js +54 -9
- package/node_modules/pi-lens/dist/clients/dispatch/runners/index.js +1 -3
- package/node_modules/pi-lens/dist/clients/dispatch/runners/lsp.js +37 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/markdownlint.js +4 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/oxlint.js +11 -4
- package/node_modules/pi-lens/dist/clients/dispatch/runners/psscriptanalyzer.js +4 -0
- package/node_modules/pi-lens/dist/clients/dispatch/runners/rust-clippy.js +8 -3
- package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/runner-helpers.js +76 -25
- package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/spawn-outcome.js +4 -0
- package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/tool-failure.js +19 -7
- package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/toolchain-availability.js +7 -13
- package/node_modules/pi-lens/dist/clients/dispatch/runners/yaml-rule-parser.js +51 -17
- package/node_modules/pi-lens/dist/clients/event-loop-monitor.js +66 -1
- package/node_modules/pi-lens/dist/clients/file-utils.js +157 -7
- package/node_modules/pi-lens/dist/clients/finding-delivery-gate.js +5 -0
- package/node_modules/pi-lens/dist/clients/formatters.js +28 -3
- package/node_modules/pi-lens/dist/clients/git-guard.js +197 -47
- package/node_modules/pi-lens/dist/clients/git-tracked-ignore.js +32 -1
- package/node_modules/pi-lens/dist/clients/govulncheck-client.js +5 -1
- package/node_modules/pi-lens/dist/clients/gzip-stage-write.js +7 -0
- package/node_modules/pi-lens/dist/clients/installer/index.js +131 -34
- package/node_modules/pi-lens/dist/clients/installer/managed-tool-refresh.js +3 -1
- package/node_modules/pi-lens/dist/clients/instance-reaper.js +4 -13
- package/node_modules/pi-lens/dist/clients/instance-registry-lock.js +145 -0
- package/node_modules/pi-lens/dist/clients/instance-registry.js +432 -122
- package/node_modules/pi-lens/dist/clients/jscpd-client.js +6 -1
- package/node_modules/pi-lens/dist/clients/language-profile.js +4 -2
- package/node_modules/pi-lens/dist/clients/latency-logger.js +19 -1
- package/node_modules/pi-lens/dist/clients/lens-flag-registry.js +8 -0
- package/node_modules/pi-lens/dist/clients/lens-map.js +3 -1
- package/node_modules/pi-lens/dist/clients/lsp/cascade-tier.js +4 -0
- package/node_modules/pi-lens/dist/clients/lsp/client.js +516 -31
- package/node_modules/pi-lens/dist/clients/lsp/config.js +25 -2
- package/node_modules/pi-lens/dist/clients/lsp/diagnostic-binding.js +9 -4
- package/node_modules/pi-lens/dist/clients/lsp/index.js +509 -182
- package/node_modules/pi-lens/dist/clients/lsp/jvm-runtime.js +5 -0
- package/node_modules/pi-lens/dist/clients/lsp/launch.js +36 -8
- package/node_modules/pi-lens/dist/clients/lsp/pending-aux-coverage.js +116 -4
- package/node_modules/pi-lens/dist/clients/lsp/server.js +142 -13
- package/node_modules/pi-lens/dist/clients/lsp/session-roots.js +99 -0
- package/node_modules/pi-lens/dist/clients/lsp/workspace-diagnostics-cache.js +16 -6
- package/node_modules/pi-lens/dist/clients/lsp/workspace-sweep-hold.js +32 -23
- package/node_modules/pi-lens/dist/clients/lsp-mutation.js +16 -2
- package/node_modules/pi-lens/dist/clients/mcp/analyze.js +12 -6
- package/node_modules/pi-lens/dist/clients/mcp/session.js +14 -1
- package/node_modules/pi-lens/dist/clients/memory-sampler.js +23 -1
- package/node_modules/pi-lens/dist/clients/message-end-attribution.js +30 -0
- package/node_modules/pi-lens/dist/clients/metrics-history.js +21 -4
- package/node_modules/pi-lens/dist/clients/opaque-mutation-scan.js +232 -18
- package/node_modules/pi-lens/dist/clients/package-manager.js +6 -18
- package/node_modules/pi-lens/dist/clients/path-keyed-map.js +14 -1
- package/node_modules/pi-lens/dist/clients/path-utils.js +32 -0
- package/node_modules/pi-lens/dist/clients/pipeline.js +0 -8
- package/node_modules/pi-lens/dist/clients/process-singletons.js +210 -0
- package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/madge.js +2 -1
- package/node_modules/pi-lens/dist/clients/project-diagnostics/scanner.js +10 -4
- package/node_modules/pi-lens/dist/clients/project-snapshot.js +33 -11
- package/node_modules/pi-lens/dist/clients/read-guard-logger.js +24 -2
- package/node_modules/pi-lens/dist/clients/read-guard.js +74 -7
- package/node_modules/pi-lens/dist/clients/recent-touches.js +17 -5
- package/node_modules/pi-lens/dist/clients/review-graph/builder.js +639 -62
- package/node_modules/pi-lens/dist/clients/review-graph/tsconfig-paths.js +5 -1
- package/node_modules/pi-lens/dist/clients/review-graph-logger.js +21 -1
- package/node_modules/pi-lens/dist/clients/runtime-coordinator.js +68 -0
- package/node_modules/pi-lens/dist/clients/runtime-session.js +30 -12
- package/node_modules/pi-lens/dist/clients/runtime-tool-call.js +15 -0
- package/node_modules/pi-lens/dist/clients/runtime-tool-result.js +106 -7
- package/node_modules/pi-lens/dist/clients/runtime-turn.js +242 -27
- package/node_modules/pi-lens/dist/clients/safe-spawn.js +158 -18
- package/node_modules/pi-lens/dist/clients/security-scan-client.js +48 -17
- package/node_modules/pi-lens/dist/clients/session-lifecycle.js +238 -42
- package/node_modules/pi-lens/dist/clients/sg-runner.js +27 -15
- package/node_modules/pi-lens/dist/clients/shared-checkout-guard.js +338 -0
- package/node_modules/pi-lens/dist/clients/spawn-output-cap.js +37 -0
- package/node_modules/pi-lens/dist/clients/spawn-timeout-cooldown.js +15 -1
- package/node_modules/pi-lens/dist/clients/startup-scan.js +6 -7
- package/node_modules/pi-lens/dist/clients/startup-timing.js +69 -4
- package/node_modules/pi-lens/dist/clients/string-utils.js +20 -0
- package/node_modules/pi-lens/dist/clients/test-runner-client.js +419 -88
- package/node_modules/pi-lens/dist/clients/tool-policy.js +1 -1
- package/node_modules/pi-lens/dist/clients/tree-sitter-client.js +11 -5
- package/node_modules/pi-lens/dist/clients/tree-sitter-logger.js +17 -1
- package/node_modules/pi-lens/dist/clients/warm-attach.js +8 -10
- package/node_modules/pi-lens/dist/clients/word-index-logger.js +13 -1
- package/node_modules/pi-lens/dist/clients/word-index-store.js +448 -0
- package/node_modules/pi-lens/dist/clients/word-index.js +582 -104
- package/node_modules/pi-lens/dist/clients/workspace-topology.js +17 -0
- package/node_modules/pi-lens/dist/clients/zizmor-config.js +26 -6
- package/node_modules/pi-lens/dist/index.js +11243 -6651
- package/node_modules/pi-lens/dist/mcp/build-staleness.js +8 -7
- package/node_modules/pi-lens/dist/mcp/cli.js +3 -1
- package/node_modules/pi-lens/dist/mcp/server.js +6 -1
- package/node_modules/pi-lens/dist/tools/lens-diagnostics.js +4 -0
- package/node_modules/pi-lens/dist/tools/lsp-diagnostics.js +14 -5
- package/node_modules/pi-lens/dist/tools/lsp-navigation.js +3 -1
- package/node_modules/pi-lens/docs/agent-guide.md +4 -2
- package/node_modules/pi-lens/docs/ast-grep_rules_catalog.md +41 -10
- package/node_modules/pi-lens/docs/astplayground.md +26 -17
- package/node_modules/pi-lens/package.json +5 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/c-no-malloc-free-test.yml +20 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/cpp-no-malloc-free-test.yml +25 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/cpp-no-printf-test.yml +19 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/go-no-fmt-println-test.yml +19 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/go-no-panic-in-lib-test.yml +17 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/go-no-underscore-func-name-test.yml +18 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/go-prefer-errors-is-test.yml +15 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/go-prefer-string-builder-test.yml +21 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/hyphenated-svg-attribute-test.yml +11 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/kotlin-no-lateinit-test.yml +17 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/kotlin-no-nullable-boolean-test.yml +15 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/kotlin-no-println-test.yml +19 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/kotlin-no-unnecessary-let-test.yml +7 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/kotlin-no-unsafe-cast-test.yml +7 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/kotlin-no-var-test.yml +7 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/kotlin-prefer-data-class-test.yml +25 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/kotlin-prefer-is-empty-test.yml +11 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-important-test.yml +21 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-raw-types-test.yml +30 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-string-concat-in-loop-test.yml +100 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-system-out-println-test.yml +7 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/prefer-string-is-empty-test.yml +7 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/python-optional-type-test.yml +9 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/reducible-list-comprehension-test.yml +11 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/ruby-symbol-to-proc-candidate-test.yml +10 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/rust-no-chars-enumerate-test.yml +7 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/c-no-malloc-free.yml +39 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/cpp-no-malloc-free.yml +45 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/cpp-no-printf.yml +41 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/go-no-fmt-println.yml +43 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/go-no-panic-in-lib.yml +41 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/go-no-underscore-func-name.yml +35 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/go-prefer-errors-is.yml +40 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/go-prefer-string-builder.yml +43 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/hyphenated-svg-attribute.yml +32 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-no-lateinit.yml +37 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-no-nullable-boolean.yml +33 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-no-println.yml +42 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-no-unnecessary-let.yml +28 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-no-unsafe-cast.yml +28 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-no-var.yml +35 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-prefer-data-class.yml +66 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-prefer-is-empty.yml +35 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-important.yml +21 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-raw-types.yml +33 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-string-concat-in-loop.yml +90 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-system-out-println.yml +16 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/prefer-string-is-empty.yml +11 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/python-optional-type.yml +22 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/reducible-list-comprehension.yml +29 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/ruby-symbol-to-proc-candidate.yml +25 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/rust-no-chars-enumerate.yml +19 -0
- package/node_modules/pi-mcp-adapter/CHANGELOG.md +35 -0
- package/node_modules/pi-mcp-adapter/README.md +5 -2
- package/node_modules/pi-mcp-adapter/cli.js +4 -4
- package/node_modules/pi-mcp-adapter/commands.ts +1 -1
- package/node_modules/pi-mcp-adapter/config.ts +1 -0
- package/node_modules/pi-mcp-adapter/dist/config.js +1 -0
- package/node_modules/pi-mcp-adapter/dist/config.js.map +1 -1
- package/node_modules/pi-mcp-adapter/dist/mcp-bearer-store.d.ts +24 -0
- package/node_modules/pi-mcp-adapter/dist/mcp-bearer-store.js +336 -0
- package/node_modules/pi-mcp-adapter/dist/mcp-bearer-store.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/types.d.ts +3 -1
- package/node_modules/pi-mcp-adapter/dist/types.js.map +1 -1
- package/node_modules/pi-mcp-adapter/index.ts +90 -6
- package/node_modules/pi-mcp-adapter/mcp-auth-flow.ts +124 -32
- package/node_modules/pi-mcp-adapter/mcp-bearer-store.ts +0 -2
- package/node_modules/pi-mcp-adapter/mcp-oauth-provider.ts +89 -0
- package/node_modules/pi-mcp-adapter/mcp-references.ts +9 -1
- package/node_modules/pi-mcp-adapter/package.json +1 -1
- package/node_modules/pi-mcp-adapter/proxy-modes.ts +62 -22
- package/node_modules/pi-mcp-adapter/request-headers-command.ts +1 -1
- package/node_modules/pi-mcp-adapter/server-manager.ts +6 -0
- package/node_modules/pi-mcp-adapter/types.ts +3 -1
- package/node_modules/pi-web-access/CHANGELOG.md +42 -0
- package/node_modules/pi-web-access/README.md +26 -10
- package/node_modules/pi-web-access/curator-page.ts +12 -3
- package/node_modules/pi-web-access/curator-server.ts +3 -1
- package/node_modules/pi-web-access/extract.ts +88 -13
- package/node_modules/pi-web-access/gemini-search.ts +10 -5
- package/node_modules/pi-web-access/github-extract.ts +47 -3
- package/node_modules/pi-web-access/index.ts +40 -40
- package/node_modules/pi-web-access/package.json +1 -1
- package/node_modules/pi-web-access/page-query.ts +61 -8
- package/node_modules/pi-web-access/xcrawl.ts +264 -0
- package/package.json +19 -22
- package/node_modules/@herbertgao/pi-stash/README.md +0 -34
- package/node_modules/@herbertgao/pi-stash/package.json +0 -51
- package/node_modules/@herbertgao/pi-stash/src/index.ts +0 -118
- package/node_modules/@tifan/pi-titlebar-spinner/README.md +0 -24
- package/node_modules/@tifan/pi-titlebar-spinner/package.json +0 -39
- package/node_modules/@tifan/pi-titlebar-spinner/src/index.ts +0 -49
|
@@ -11,6 +11,11 @@ import {
|
|
|
11
11
|
getAgentDir,
|
|
12
12
|
type ExtensionContext,
|
|
13
13
|
} from "@earendil-works/pi-coding-agent"
|
|
14
|
+
import {
|
|
15
|
+
DEFAULT_RENAME_LANGUAGE,
|
|
16
|
+
parseRenameLanguage,
|
|
17
|
+
type RenameLanguage,
|
|
18
|
+
} from "./language.js"
|
|
14
19
|
|
|
15
20
|
const CONFIG_PATH = path.join(getAgentDir(), "extensions", "pi-rename.json")
|
|
16
21
|
const CONFIG_DIR = path.dirname(CONFIG_PATH)
|
|
@@ -49,6 +54,12 @@ export const DEFAULT_RENAME_MODEL: RenameModelPreference = {
|
|
|
49
54
|
|
|
50
55
|
interface RenameConfig extends Record<string, unknown> {
|
|
51
56
|
model?: unknown
|
|
57
|
+
language?: unknown
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface InitialRenameConfig {
|
|
61
|
+
readonly modelConfig: RenameModelConfig
|
|
62
|
+
readonly language: RenameLanguage
|
|
52
63
|
}
|
|
53
64
|
|
|
54
65
|
export function formatModelPreference(config: RenameModelConfig): string {
|
|
@@ -89,31 +100,76 @@ function readConfig(): RenameConfig {
|
|
|
89
100
|
: {}
|
|
90
101
|
}
|
|
91
102
|
|
|
103
|
+
function writeConfig(config: RenameConfig): void {
|
|
104
|
+
mkdirSync(CONFIG_DIR, { recursive: true })
|
|
105
|
+
writeFileSync(CONFIG_PATH, `${JSON.stringify(config, null, 2)}\n`, "utf-8")
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function readConfigForUpdate(): RenameConfig {
|
|
109
|
+
if (!existsSync(CONFIG_PATH)) return {}
|
|
110
|
+
|
|
111
|
+
try {
|
|
112
|
+
return readConfig()
|
|
113
|
+
} catch (error) {
|
|
114
|
+
if (error instanceof SyntaxError) return {}
|
|
115
|
+
throw error
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function updateConfig(update: Partial<RenameConfig>): void {
|
|
120
|
+
writeConfig({ ...readConfigForUpdate(), ...update })
|
|
121
|
+
}
|
|
122
|
+
|
|
92
123
|
export function saveModelPreference(
|
|
93
124
|
modelPreference: RenameModelPreference,
|
|
94
125
|
): void {
|
|
95
|
-
|
|
96
|
-
|
|
126
|
+
updateConfig({ model: formatRenameModelKey(modelPreference) })
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export function saveRenameLanguage(language: RenameLanguage): void {
|
|
130
|
+
updateConfig({ language })
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function deleteModelPreference(): void {
|
|
134
|
+
if (!existsSync(CONFIG_PATH)) return
|
|
135
|
+
|
|
136
|
+
const config = readConfigForUpdate()
|
|
137
|
+
delete config.model
|
|
138
|
+
if (Object.keys(config).length === 0) {
|
|
139
|
+
rmSync(CONFIG_PATH)
|
|
140
|
+
return
|
|
97
141
|
}
|
|
98
|
-
|
|
99
|
-
|
|
142
|
+
|
|
143
|
+
writeConfig(config)
|
|
100
144
|
}
|
|
101
145
|
|
|
102
|
-
|
|
103
|
-
|
|
146
|
+
function resolveModelConfig(config: RenameConfig): RenameModelConfig {
|
|
147
|
+
if (config.model === undefined) return { kind: "missing" }
|
|
148
|
+
if (typeof config.model !== "string") return { kind: "invalid" }
|
|
149
|
+
|
|
150
|
+
const model = parseModelSpec(config.model)
|
|
151
|
+
return model ? { kind: "configured", model } : { kind: "invalid" }
|
|
104
152
|
}
|
|
105
153
|
|
|
106
|
-
export function
|
|
107
|
-
if (!existsSync(CONFIG_PATH))
|
|
154
|
+
export function resolveInitialRenameConfig(): InitialRenameConfig {
|
|
155
|
+
if (!existsSync(CONFIG_PATH)) {
|
|
156
|
+
return {
|
|
157
|
+
modelConfig: { kind: "missing" },
|
|
158
|
+
language: DEFAULT_RENAME_LANGUAGE,
|
|
159
|
+
}
|
|
160
|
+
}
|
|
108
161
|
|
|
109
162
|
try {
|
|
110
163
|
const config = readConfig()
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
164
|
+
return {
|
|
165
|
+
modelConfig: resolveModelConfig(config),
|
|
166
|
+
language: parseRenameLanguage(config.language) ?? DEFAULT_RENAME_LANGUAGE,
|
|
167
|
+
}
|
|
115
168
|
} catch {
|
|
116
|
-
return {
|
|
169
|
+
return {
|
|
170
|
+
modelConfig: { kind: "invalid" },
|
|
171
|
+
language: DEFAULT_RENAME_LANGUAGE,
|
|
172
|
+
}
|
|
117
173
|
}
|
|
118
174
|
}
|
|
119
175
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { AgentMessage } from "@earendil-works/pi-agent-core"
|
|
2
2
|
import type { Message } from "@earendil-works/pi-ai"
|
|
3
3
|
import type { ExtensionContext } from "@earendil-works/pi-coding-agent"
|
|
4
|
+
import type { RenameLanguage } from "./language.js"
|
|
4
5
|
import {
|
|
5
6
|
formatRenameModelKey,
|
|
6
7
|
getRenameModelAuth,
|
|
8
|
+
resolveInitialRenameConfig,
|
|
7
9
|
type RenameModelConfig,
|
|
8
10
|
} from "./models.js"
|
|
9
11
|
import { redactSecrets, sanitizeRenameText } from "./sanitize.js"
|
|
@@ -11,12 +13,34 @@ import { redactSecrets, sanitizeRenameText } from "./sanitize.js"
|
|
|
11
13
|
export const RENAME_MAX_TOKENS = 80
|
|
12
14
|
export const RENAME_REQUEST_TIMEOUT_MS = 30_000
|
|
13
15
|
|
|
16
|
+
export function resolveInitialModelConfig(): RenameModelConfig {
|
|
17
|
+
return resolveInitialRenameConfig().modelConfig
|
|
18
|
+
}
|
|
19
|
+
|
|
14
20
|
export const RENAME_SYSTEM_PROMPT = `Name this coding-agent session.
|
|
15
21
|
|
|
16
22
|
Return one lowercase hyphen-separated session name only.
|
|
17
23
|
Use plain text, no quotes, no markdown, no trailing punctuation.
|
|
18
24
|
Prefer an action-oriented task name like fix-auth-callback or design-pi-rename.
|
|
25
|
+
Stay under 30 characters.`
|
|
26
|
+
|
|
27
|
+
export function buildRenameSystemPrompt(language: RenameLanguage): string {
|
|
28
|
+
if (/^en(?:-|$)/iu.test(language)) return RENAME_SYSTEM_PROMPT
|
|
29
|
+
|
|
30
|
+
const languageInstruction =
|
|
31
|
+
language === "auto"
|
|
32
|
+
? "Use language of latest user message."
|
|
33
|
+
: `Use language identified by BCP 47 tag ${language}.`
|
|
34
|
+
|
|
35
|
+
return `Name this coding-agent session.
|
|
36
|
+
|
|
37
|
+
${languageInstruction}
|
|
38
|
+
Return one hyphen-separated session name only.
|
|
39
|
+
Use plain text, no quotes, no markdown, no trailing punctuation.
|
|
40
|
+
Use lowercase when selected language has case.
|
|
41
|
+
Prefer an action-oriented task name.
|
|
19
42
|
Stay under 60 characters.`
|
|
43
|
+
}
|
|
20
44
|
|
|
21
45
|
export interface UserMessageContext {
|
|
22
46
|
readonly first: string
|
|
@@ -109,15 +133,17 @@ function extractModelText(
|
|
|
109
133
|
|
|
110
134
|
export function fallbackRenameName(
|
|
111
135
|
context: UserMessageContext,
|
|
136
|
+
language: RenameLanguage = "en",
|
|
112
137
|
): string | undefined {
|
|
113
138
|
const latest = context.recent.at(-1) ?? context.first
|
|
114
|
-
return sanitizeRenameText(latest)
|
|
139
|
+
return sanitizeRenameText(latest, language)
|
|
115
140
|
}
|
|
116
141
|
|
|
117
142
|
export async function generateRename(
|
|
118
143
|
ctx: ExtensionContext,
|
|
119
144
|
modelConfig: RenameModelConfig,
|
|
120
145
|
context: UserMessageContext,
|
|
146
|
+
language: RenameLanguage = "en",
|
|
121
147
|
): Promise<RenameResult | undefined> {
|
|
122
148
|
try {
|
|
123
149
|
const modelAuth = await getRenameModelAuth(ctx, modelConfig)
|
|
@@ -126,7 +152,7 @@ export async function generateRename(
|
|
|
126
152
|
const response = await ctx.modelRegistry.complete(
|
|
127
153
|
modelAuth.auth.model,
|
|
128
154
|
{
|
|
129
|
-
systemPrompt:
|
|
155
|
+
systemPrompt: buildRenameSystemPrompt(language),
|
|
130
156
|
messages: [buildRenamePrompt(context)],
|
|
131
157
|
},
|
|
132
158
|
{
|
|
@@ -138,11 +164,14 @@ export async function generateRename(
|
|
|
138
164
|
)
|
|
139
165
|
|
|
140
166
|
if (response.stopReason === "stop") {
|
|
141
|
-
const name = sanitizeRenameText(
|
|
167
|
+
const name = sanitizeRenameText(
|
|
168
|
+
extractModelText(response.content),
|
|
169
|
+
language,
|
|
170
|
+
)
|
|
142
171
|
if (name) return { source: "model", name }
|
|
143
172
|
}
|
|
144
173
|
|
|
145
|
-
const name = fallbackRenameName(context)
|
|
174
|
+
const name = fallbackRenameName(context, language)
|
|
146
175
|
return name
|
|
147
176
|
? {
|
|
148
177
|
source: "fallback",
|
|
@@ -152,7 +181,7 @@ export async function generateRename(
|
|
|
152
181
|
: undefined
|
|
153
182
|
}
|
|
154
183
|
|
|
155
|
-
const name = fallbackRenameName(context)
|
|
184
|
+
const name = fallbackRenameName(context, language)
|
|
156
185
|
if (!name) return undefined
|
|
157
186
|
|
|
158
187
|
if (modelAuth.status === "invalid-config") {
|
|
@@ -172,11 +201,11 @@ export async function generateRename(
|
|
|
172
201
|
reason: `rename model is not authenticated: ${modelName}`,
|
|
173
202
|
}
|
|
174
203
|
} catch (error) {
|
|
175
|
-
const name = fallbackRenameName(context)
|
|
204
|
+
const name = fallbackRenameName(context, language)
|
|
176
205
|
if (!name) return undefined
|
|
177
206
|
const reason = error instanceof Error ? error.message : String(error)
|
|
178
207
|
return { source: "fallback", name, reason }
|
|
179
208
|
}
|
|
180
209
|
}
|
|
181
210
|
|
|
182
|
-
export { redactSecrets, sanitizeRenameText }
|
|
211
|
+
export { redactSecrets, resolveInitialRenameConfig, sanitizeRenameText }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const MAX_RENAME_CHARS =
|
|
1
|
+
export const MAX_RENAME_CHARS = 30
|
|
2
2
|
|
|
3
3
|
export function redactSecrets(text: string): string {
|
|
4
4
|
return text
|
|
@@ -15,19 +15,27 @@ export function redactSecrets(text: string): string {
|
|
|
15
15
|
)
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
export function sanitizeRenameText(raw: string): string {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
export function sanitizeRenameText(raw: string, language = "en"): string {
|
|
19
|
+
const allowUnicode = !/^en(?:-|$)/iu.test(language)
|
|
20
|
+
const disallowedCharacters = allowUnicode
|
|
21
|
+
? /[^\p{L}\p{M}\p{N}]+/gu
|
|
22
|
+
: /[^a-z0-9]+/giu
|
|
23
|
+
|
|
24
|
+
return Array.from(
|
|
25
|
+
raw
|
|
26
|
+
.trim()
|
|
27
|
+
.replace(/^```(?:\w+)?/u, "")
|
|
28
|
+
.replace(/```$/u, "")
|
|
29
|
+
.replace(/^name\s*:\s*/iu, "")
|
|
30
|
+
.replace(/^title\s*:\s*/iu, "")
|
|
31
|
+
.replace(/^[-*•]\s*/u, "")
|
|
32
|
+
.replace(/["'`]/gu, "")
|
|
33
|
+
.replace(disallowedCharacters, "-")
|
|
34
|
+
.replace(/-+/gu, "-")
|
|
35
|
+
.replace(/^-|-$/gu, "")
|
|
36
|
+
.toLowerCase(),
|
|
37
|
+
)
|
|
31
38
|
.slice(0, MAX_RENAME_CHARS)
|
|
39
|
+
.join("")
|
|
32
40
|
.replace(/-$/u, "")
|
|
33
41
|
}
|