@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.
Files changed (263) hide show
  1. package/README.md +19 -14
  2. package/THIRD_PARTY_NOTICES.md +0 -1
  3. package/node_modules/@czottmann/pi-automode/CHANGELOG.md +19 -0
  4. package/node_modules/@czottmann/pi-automode/README.md +5 -1
  5. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/classifier.ts +126 -13
  6. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/config.ts +7 -3
  7. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/constants.ts +2 -0
  8. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/hard-deny.ts +134 -23
  9. package/node_modules/@czottmann/pi-automode/package.json +1 -1
  10. package/node_modules/@herbertgao/{pi-stash → pi-bark}/LICENSE +4 -5
  11. package/node_modules/@herbertgao/pi-bark/README.md +44 -0
  12. package/node_modules/@herbertgao/pi-bark/assets/pi-icon.png +0 -0
  13. package/node_modules/@herbertgao/pi-bark/package.json +53 -0
  14. package/node_modules/@herbertgao/pi-bark/src/index.ts +178 -0
  15. package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +1 -1
  16. package/node_modules/@herbertgao/pi-cc-extensions/README.md +1 -1
  17. package/node_modules/@herbertgao/pi-cc-extensions/package.json +3 -3
  18. package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +6 -0
  19. package/node_modules/@herbertgao/pi-subagents/package.json +2 -1
  20. package/node_modules/@herbertgao/pi-subagents/src/ui/conversation-viewer.ts +8 -1
  21. package/node_modules/@juicesharp/rpiv-ask-user-question/package.json +2 -2
  22. package/node_modules/@narumitw/pi-btw/README.md +125 -88
  23. package/node_modules/@narumitw/pi-btw/dist/index.ts +140 -45
  24. package/node_modules/@narumitw/pi-btw/dist/index.ts.map +2 -2
  25. package/node_modules/@narumitw/pi-btw/package.json +5 -8
  26. package/node_modules/@narumitw/pi-btw/src/btw.ts +31 -26
  27. package/node_modules/@narumitw/pi-btw/src/fullscreen-ui.ts +106 -17
  28. package/node_modules/@narumitw/pi-btw/src/menu.ts +34 -2
  29. package/node_modules/@narumitw/pi-btw/src/settings.ts +16 -0
  30. package/node_modules/@tifan/pi-handoff/README.md +36 -13
  31. package/node_modules/@tifan/pi-handoff/package.json +2 -2
  32. package/node_modules/@tifan/pi-handoff/src/index.ts +160 -4
  33. package/node_modules/@tifan/pi-preferred-thinking/README.md +1 -1
  34. package/node_modules/@tifan/pi-preferred-thinking/package.json +1 -1
  35. package/node_modules/@tifan/pi-preferred-thinking/src/index.ts +15 -2
  36. package/node_modules/@tifan/pi-recap/README.md +1 -1
  37. package/node_modules/@tifan/pi-recap/package.json +2 -2
  38. package/node_modules/@tifan/pi-recap/src/index.ts +15 -0
  39. package/node_modules/@tifan/pi-rename/README.md +42 -21
  40. package/node_modules/@tifan/pi-rename/package.json +1 -1
  41. package/node_modules/@tifan/pi-rename/src/index.ts +62 -11
  42. package/node_modules/@tifan/pi-rename/src/language.ts +18 -0
  43. package/node_modules/@tifan/pi-rename/src/models.ts +69 -13
  44. package/node_modules/@tifan/pi-rename/src/naming.ts +36 -7
  45. package/node_modules/@tifan/pi-rename/src/sanitize.ts +22 -14
  46. package/node_modules/pi-lens/CHANGELOG.md +320 -0
  47. package/node_modules/pi-lens/config/dependency-cruiser-eager-allowlist.json +79 -0
  48. package/node_modules/pi-lens/dist/clients/actionable-warnings-logger.js +16 -1
  49. package/node_modules/pi-lens/dist/clients/ast-grep-client.js +13 -6
  50. package/node_modules/pi-lens/dist/clients/availability-probe-flight.js +12 -0
  51. package/node_modules/pi-lens/dist/clients/biome-client.js +7 -0
  52. package/node_modules/pi-lens/dist/clients/blocker-freshness.js +20 -0
  53. package/node_modules/pi-lens/dist/clients/bounded-telemetry.js +56 -19
  54. package/node_modules/pi-lens/dist/clients/build-identity.js +95 -0
  55. package/node_modules/pi-lens/dist/clients/bus-publish.js +3 -0
  56. package/node_modules/pi-lens/dist/clients/cache/rule-cache.js +2 -1
  57. package/node_modules/pi-lens/dist/clients/cache-observability.js +2 -1
  58. package/node_modules/pi-lens/dist/clients/cascade-logger.js +15 -1
  59. package/node_modules/pi-lens/dist/clients/dead-code-client.js +14 -11
  60. package/node_modules/pi-lens/dist/clients/degradation-ledger.js +56 -4
  61. package/node_modules/pi-lens/dist/clients/demoted-finding-render.js +14 -0
  62. package/node_modules/pi-lens/dist/clients/dependency-checker.js +20 -3
  63. package/node_modules/pi-lens/dist/clients/deps/minimatch.js +1 -1
  64. package/node_modules/pi-lens/dist/clients/dispatch/collect-later-tier.js +39 -0
  65. package/node_modules/pi-lens/dist/clients/dispatch/dispatcher.js +150 -9
  66. package/node_modules/pi-lens/dist/clients/dispatch/fact-store.js +231 -9
  67. package/node_modules/pi-lens/dist/clients/dispatch/integration.js +205 -100
  68. package/node_modules/pi-lens/dist/clients/dispatch/pending-runner-findings.js +87 -0
  69. package/node_modules/pi-lens/dist/clients/dispatch/plan.js +21 -5
  70. package/node_modules/pi-lens/dist/clients/dispatch/runners/ast-grep-napi.js +174 -55
  71. package/node_modules/pi-lens/dist/clients/dispatch/runners/eslint.js +5 -1
  72. package/node_modules/pi-lens/dist/clients/dispatch/runners/helm-lint.js +16 -3
  73. package/node_modules/pi-lens/dist/clients/dispatch/runners/helm-render.js +54 -9
  74. package/node_modules/pi-lens/dist/clients/dispatch/runners/index.js +1 -3
  75. package/node_modules/pi-lens/dist/clients/dispatch/runners/lsp.js +37 -1
  76. package/node_modules/pi-lens/dist/clients/dispatch/runners/markdownlint.js +4 -1
  77. package/node_modules/pi-lens/dist/clients/dispatch/runners/oxlint.js +11 -4
  78. package/node_modules/pi-lens/dist/clients/dispatch/runners/psscriptanalyzer.js +4 -0
  79. package/node_modules/pi-lens/dist/clients/dispatch/runners/rust-clippy.js +8 -3
  80. package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/runner-helpers.js +76 -25
  81. package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/spawn-outcome.js +4 -0
  82. package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/tool-failure.js +19 -7
  83. package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/toolchain-availability.js +7 -13
  84. package/node_modules/pi-lens/dist/clients/dispatch/runners/yaml-rule-parser.js +51 -17
  85. package/node_modules/pi-lens/dist/clients/event-loop-monitor.js +66 -1
  86. package/node_modules/pi-lens/dist/clients/file-utils.js +157 -7
  87. package/node_modules/pi-lens/dist/clients/finding-delivery-gate.js +5 -0
  88. package/node_modules/pi-lens/dist/clients/formatters.js +28 -3
  89. package/node_modules/pi-lens/dist/clients/git-guard.js +197 -47
  90. package/node_modules/pi-lens/dist/clients/git-tracked-ignore.js +32 -1
  91. package/node_modules/pi-lens/dist/clients/govulncheck-client.js +5 -1
  92. package/node_modules/pi-lens/dist/clients/gzip-stage-write.js +7 -0
  93. package/node_modules/pi-lens/dist/clients/installer/index.js +131 -34
  94. package/node_modules/pi-lens/dist/clients/installer/managed-tool-refresh.js +3 -1
  95. package/node_modules/pi-lens/dist/clients/instance-reaper.js +4 -13
  96. package/node_modules/pi-lens/dist/clients/instance-registry-lock.js +145 -0
  97. package/node_modules/pi-lens/dist/clients/instance-registry.js +432 -122
  98. package/node_modules/pi-lens/dist/clients/jscpd-client.js +6 -1
  99. package/node_modules/pi-lens/dist/clients/language-profile.js +4 -2
  100. package/node_modules/pi-lens/dist/clients/latency-logger.js +19 -1
  101. package/node_modules/pi-lens/dist/clients/lens-flag-registry.js +8 -0
  102. package/node_modules/pi-lens/dist/clients/lens-map.js +3 -1
  103. package/node_modules/pi-lens/dist/clients/lsp/cascade-tier.js +4 -0
  104. package/node_modules/pi-lens/dist/clients/lsp/client.js +516 -31
  105. package/node_modules/pi-lens/dist/clients/lsp/config.js +25 -2
  106. package/node_modules/pi-lens/dist/clients/lsp/diagnostic-binding.js +9 -4
  107. package/node_modules/pi-lens/dist/clients/lsp/index.js +509 -182
  108. package/node_modules/pi-lens/dist/clients/lsp/jvm-runtime.js +5 -0
  109. package/node_modules/pi-lens/dist/clients/lsp/launch.js +36 -8
  110. package/node_modules/pi-lens/dist/clients/lsp/pending-aux-coverage.js +116 -4
  111. package/node_modules/pi-lens/dist/clients/lsp/server.js +142 -13
  112. package/node_modules/pi-lens/dist/clients/lsp/session-roots.js +99 -0
  113. package/node_modules/pi-lens/dist/clients/lsp/workspace-diagnostics-cache.js +16 -6
  114. package/node_modules/pi-lens/dist/clients/lsp/workspace-sweep-hold.js +32 -23
  115. package/node_modules/pi-lens/dist/clients/lsp-mutation.js +16 -2
  116. package/node_modules/pi-lens/dist/clients/mcp/analyze.js +12 -6
  117. package/node_modules/pi-lens/dist/clients/mcp/session.js +14 -1
  118. package/node_modules/pi-lens/dist/clients/memory-sampler.js +23 -1
  119. package/node_modules/pi-lens/dist/clients/message-end-attribution.js +30 -0
  120. package/node_modules/pi-lens/dist/clients/metrics-history.js +21 -4
  121. package/node_modules/pi-lens/dist/clients/opaque-mutation-scan.js +232 -18
  122. package/node_modules/pi-lens/dist/clients/package-manager.js +6 -18
  123. package/node_modules/pi-lens/dist/clients/path-keyed-map.js +14 -1
  124. package/node_modules/pi-lens/dist/clients/path-utils.js +32 -0
  125. package/node_modules/pi-lens/dist/clients/pipeline.js +0 -8
  126. package/node_modules/pi-lens/dist/clients/process-singletons.js +210 -0
  127. package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/madge.js +2 -1
  128. package/node_modules/pi-lens/dist/clients/project-diagnostics/scanner.js +10 -4
  129. package/node_modules/pi-lens/dist/clients/project-snapshot.js +33 -11
  130. package/node_modules/pi-lens/dist/clients/read-guard-logger.js +24 -2
  131. package/node_modules/pi-lens/dist/clients/read-guard.js +74 -7
  132. package/node_modules/pi-lens/dist/clients/recent-touches.js +17 -5
  133. package/node_modules/pi-lens/dist/clients/review-graph/builder.js +639 -62
  134. package/node_modules/pi-lens/dist/clients/review-graph/tsconfig-paths.js +5 -1
  135. package/node_modules/pi-lens/dist/clients/review-graph-logger.js +21 -1
  136. package/node_modules/pi-lens/dist/clients/runtime-coordinator.js +68 -0
  137. package/node_modules/pi-lens/dist/clients/runtime-session.js +30 -12
  138. package/node_modules/pi-lens/dist/clients/runtime-tool-call.js +15 -0
  139. package/node_modules/pi-lens/dist/clients/runtime-tool-result.js +106 -7
  140. package/node_modules/pi-lens/dist/clients/runtime-turn.js +242 -27
  141. package/node_modules/pi-lens/dist/clients/safe-spawn.js +158 -18
  142. package/node_modules/pi-lens/dist/clients/security-scan-client.js +48 -17
  143. package/node_modules/pi-lens/dist/clients/session-lifecycle.js +238 -42
  144. package/node_modules/pi-lens/dist/clients/sg-runner.js +27 -15
  145. package/node_modules/pi-lens/dist/clients/shared-checkout-guard.js +338 -0
  146. package/node_modules/pi-lens/dist/clients/spawn-output-cap.js +37 -0
  147. package/node_modules/pi-lens/dist/clients/spawn-timeout-cooldown.js +15 -1
  148. package/node_modules/pi-lens/dist/clients/startup-scan.js +6 -7
  149. package/node_modules/pi-lens/dist/clients/startup-timing.js +69 -4
  150. package/node_modules/pi-lens/dist/clients/string-utils.js +20 -0
  151. package/node_modules/pi-lens/dist/clients/test-runner-client.js +419 -88
  152. package/node_modules/pi-lens/dist/clients/tool-policy.js +1 -1
  153. package/node_modules/pi-lens/dist/clients/tree-sitter-client.js +11 -5
  154. package/node_modules/pi-lens/dist/clients/tree-sitter-logger.js +17 -1
  155. package/node_modules/pi-lens/dist/clients/warm-attach.js +8 -10
  156. package/node_modules/pi-lens/dist/clients/word-index-logger.js +13 -1
  157. package/node_modules/pi-lens/dist/clients/word-index-store.js +448 -0
  158. package/node_modules/pi-lens/dist/clients/word-index.js +582 -104
  159. package/node_modules/pi-lens/dist/clients/workspace-topology.js +17 -0
  160. package/node_modules/pi-lens/dist/clients/zizmor-config.js +26 -6
  161. package/node_modules/pi-lens/dist/index.js +11243 -6651
  162. package/node_modules/pi-lens/dist/mcp/build-staleness.js +8 -7
  163. package/node_modules/pi-lens/dist/mcp/cli.js +3 -1
  164. package/node_modules/pi-lens/dist/mcp/server.js +6 -1
  165. package/node_modules/pi-lens/dist/tools/lens-diagnostics.js +4 -0
  166. package/node_modules/pi-lens/dist/tools/lsp-diagnostics.js +14 -5
  167. package/node_modules/pi-lens/dist/tools/lsp-navigation.js +3 -1
  168. package/node_modules/pi-lens/docs/agent-guide.md +4 -2
  169. package/node_modules/pi-lens/docs/ast-grep_rules_catalog.md +41 -10
  170. package/node_modules/pi-lens/docs/astplayground.md +26 -17
  171. package/node_modules/pi-lens/package.json +5 -1
  172. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/c-no-malloc-free-test.yml +20 -0
  173. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/cpp-no-malloc-free-test.yml +25 -0
  174. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/cpp-no-printf-test.yml +19 -0
  175. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/go-no-fmt-println-test.yml +19 -0
  176. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/go-no-panic-in-lib-test.yml +17 -0
  177. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/go-no-underscore-func-name-test.yml +18 -0
  178. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/go-prefer-errors-is-test.yml +15 -0
  179. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/go-prefer-string-builder-test.yml +21 -0
  180. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/hyphenated-svg-attribute-test.yml +11 -0
  181. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/kotlin-no-lateinit-test.yml +17 -0
  182. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/kotlin-no-nullable-boolean-test.yml +15 -0
  183. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/kotlin-no-println-test.yml +19 -0
  184. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/kotlin-no-unnecessary-let-test.yml +7 -0
  185. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/kotlin-no-unsafe-cast-test.yml +7 -0
  186. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/kotlin-no-var-test.yml +7 -0
  187. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/kotlin-prefer-data-class-test.yml +25 -0
  188. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/kotlin-prefer-is-empty-test.yml +11 -0
  189. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-important-test.yml +21 -0
  190. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-raw-types-test.yml +30 -0
  191. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-string-concat-in-loop-test.yml +100 -0
  192. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-system-out-println-test.yml +7 -0
  193. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/prefer-string-is-empty-test.yml +7 -0
  194. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/python-optional-type-test.yml +9 -0
  195. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/reducible-list-comprehension-test.yml +11 -0
  196. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/ruby-symbol-to-proc-candidate-test.yml +10 -0
  197. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/rust-no-chars-enumerate-test.yml +7 -0
  198. package/node_modules/pi-lens/rules/ast-grep-rules/rules/c-no-malloc-free.yml +39 -0
  199. package/node_modules/pi-lens/rules/ast-grep-rules/rules/cpp-no-malloc-free.yml +45 -0
  200. package/node_modules/pi-lens/rules/ast-grep-rules/rules/cpp-no-printf.yml +41 -0
  201. package/node_modules/pi-lens/rules/ast-grep-rules/rules/go-no-fmt-println.yml +43 -0
  202. package/node_modules/pi-lens/rules/ast-grep-rules/rules/go-no-panic-in-lib.yml +41 -0
  203. package/node_modules/pi-lens/rules/ast-grep-rules/rules/go-no-underscore-func-name.yml +35 -0
  204. package/node_modules/pi-lens/rules/ast-grep-rules/rules/go-prefer-errors-is.yml +40 -0
  205. package/node_modules/pi-lens/rules/ast-grep-rules/rules/go-prefer-string-builder.yml +43 -0
  206. package/node_modules/pi-lens/rules/ast-grep-rules/rules/hyphenated-svg-attribute.yml +32 -0
  207. package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-no-lateinit.yml +37 -0
  208. package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-no-nullable-boolean.yml +33 -0
  209. package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-no-println.yml +42 -0
  210. package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-no-unnecessary-let.yml +28 -0
  211. package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-no-unsafe-cast.yml +28 -0
  212. package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-no-var.yml +35 -0
  213. package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-prefer-data-class.yml +66 -0
  214. package/node_modules/pi-lens/rules/ast-grep-rules/rules/kotlin-prefer-is-empty.yml +35 -0
  215. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-important.yml +21 -0
  216. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-raw-types.yml +33 -0
  217. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-string-concat-in-loop.yml +90 -0
  218. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-system-out-println.yml +16 -0
  219. package/node_modules/pi-lens/rules/ast-grep-rules/rules/prefer-string-is-empty.yml +11 -0
  220. package/node_modules/pi-lens/rules/ast-grep-rules/rules/python-optional-type.yml +22 -0
  221. package/node_modules/pi-lens/rules/ast-grep-rules/rules/reducible-list-comprehension.yml +29 -0
  222. package/node_modules/pi-lens/rules/ast-grep-rules/rules/ruby-symbol-to-proc-candidate.yml +25 -0
  223. package/node_modules/pi-lens/rules/ast-grep-rules/rules/rust-no-chars-enumerate.yml +19 -0
  224. package/node_modules/pi-mcp-adapter/CHANGELOG.md +35 -0
  225. package/node_modules/pi-mcp-adapter/README.md +5 -2
  226. package/node_modules/pi-mcp-adapter/cli.js +4 -4
  227. package/node_modules/pi-mcp-adapter/commands.ts +1 -1
  228. package/node_modules/pi-mcp-adapter/config.ts +1 -0
  229. package/node_modules/pi-mcp-adapter/dist/config.js +1 -0
  230. package/node_modules/pi-mcp-adapter/dist/config.js.map +1 -1
  231. package/node_modules/pi-mcp-adapter/dist/mcp-bearer-store.d.ts +24 -0
  232. package/node_modules/pi-mcp-adapter/dist/mcp-bearer-store.js +336 -0
  233. package/node_modules/pi-mcp-adapter/dist/mcp-bearer-store.js.map +1 -0
  234. package/node_modules/pi-mcp-adapter/dist/types.d.ts +3 -1
  235. package/node_modules/pi-mcp-adapter/dist/types.js.map +1 -1
  236. package/node_modules/pi-mcp-adapter/index.ts +90 -6
  237. package/node_modules/pi-mcp-adapter/mcp-auth-flow.ts +124 -32
  238. package/node_modules/pi-mcp-adapter/mcp-bearer-store.ts +0 -2
  239. package/node_modules/pi-mcp-adapter/mcp-oauth-provider.ts +89 -0
  240. package/node_modules/pi-mcp-adapter/mcp-references.ts +9 -1
  241. package/node_modules/pi-mcp-adapter/package.json +1 -1
  242. package/node_modules/pi-mcp-adapter/proxy-modes.ts +62 -22
  243. package/node_modules/pi-mcp-adapter/request-headers-command.ts +1 -1
  244. package/node_modules/pi-mcp-adapter/server-manager.ts +6 -0
  245. package/node_modules/pi-mcp-adapter/types.ts +3 -1
  246. package/node_modules/pi-web-access/CHANGELOG.md +42 -0
  247. package/node_modules/pi-web-access/README.md +26 -10
  248. package/node_modules/pi-web-access/curator-page.ts +12 -3
  249. package/node_modules/pi-web-access/curator-server.ts +3 -1
  250. package/node_modules/pi-web-access/extract.ts +88 -13
  251. package/node_modules/pi-web-access/gemini-search.ts +10 -5
  252. package/node_modules/pi-web-access/github-extract.ts +47 -3
  253. package/node_modules/pi-web-access/index.ts +40 -40
  254. package/node_modules/pi-web-access/package.json +1 -1
  255. package/node_modules/pi-web-access/page-query.ts +61 -8
  256. package/node_modules/pi-web-access/xcrawl.ts +264 -0
  257. package/package.json +19 -22
  258. package/node_modules/@herbertgao/pi-stash/README.md +0 -34
  259. package/node_modules/@herbertgao/pi-stash/package.json +0 -51
  260. package/node_modules/@herbertgao/pi-stash/src/index.ts +0 -118
  261. package/node_modules/@tifan/pi-titlebar-spinner/README.md +0 -24
  262. package/node_modules/@tifan/pi-titlebar-spinner/package.json +0 -39
  263. 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
- const config: RenameConfig = {
96
- model: formatRenameModelKey(modelPreference),
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
- mkdirSync(CONFIG_DIR, { recursive: true })
99
- writeFileSync(CONFIG_PATH, `${JSON.stringify(config, null, 2)}\n`, "utf-8")
142
+
143
+ writeConfig(config)
100
144
  }
101
145
 
102
- export function deleteRenameConfig(): void {
103
- rmSync(CONFIG_PATH, { force: true })
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 resolveInitialModelConfig(): RenameModelConfig {
107
- if (!existsSync(CONFIG_PATH)) return { kind: "missing" }
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
- if (typeof config.model !== "string") return { kind: "invalid" }
112
-
113
- const model = parseModelSpec(config.model)
114
- return model ? { kind: "configured", model } : { kind: "invalid" }
164
+ return {
165
+ modelConfig: resolveModelConfig(config),
166
+ language: parseRenameLanguage(config.language) ?? DEFAULT_RENAME_LANGUAGE,
167
+ }
115
168
  } catch {
116
- return { kind: "invalid" }
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: RENAME_SYSTEM_PROMPT,
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(extractModelText(response.content))
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 = 60
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
- return raw
20
- .trim()
21
- .replace(/^```(?:\w+)?/u, "")
22
- .replace(/```$/u, "")
23
- .replace(/^name\s*:\s*/iu, "")
24
- .replace(/^title\s*:\s*/iu, "")
25
- .replace(/^[-*•]\s*/u, "")
26
- .replace(/["'`]/gu, "")
27
- .replace(/[^a-z0-9]+/giu, "-")
28
- .replace(/-+/gu, "-")
29
- .replace(/^-|-$/gu, "")
30
- .toLowerCase()
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
  }