@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
@@ -503,10 +503,13 @@ var FullscreenUiDisposedError = class extends Error {
503
503
  this.name = "FullscreenUiDisposedError";
504
504
  }
505
505
  };
506
- async function runBtwFullscreen(ctx, run, dependencies = {}) {
507
- const createTui = dependencies.createTui ?? ((parent, theme) => createBtwFullscreenTui(
506
+ async function runBtwFullscreen(ctx, run, options = {}, dependencies = {}) {
507
+ const createTui = dependencies.createTui ?? ((parent, theme, keybindings, fullscreenOptions) => createBtwFullscreenTui(
508
508
  parent,
509
509
  theme,
510
+ keybindings,
511
+ fullscreenOptions.copyOnSelect ?? true,
512
+ dependencies.manualSelectionCopySupported ?? hasManualSelectionCopyApi(),
510
513
  dependencies.openUrl ?? openUrlInBrowser,
511
514
  dependencies.copyToClipboard ?? copyToHostClipboard
512
515
  ));
@@ -529,7 +532,8 @@ async function runBtwFullscreen(ctx, run, dependencies = {}) {
529
532
  }
530
533
  done(value);
531
534
  },
532
- createTui
535
+ createTui,
536
+ options
533
537
  );
534
538
  return host;
535
539
  },
@@ -550,7 +554,7 @@ async function runBtwFullscreen(ctx, run, dependencies = {}) {
550
554
  var btwInputListeners = /* @__PURE__ */ new WeakMap();
551
555
  function dispatchBtwInput(listeners, data) {
552
556
  let current = data;
553
- for (const group of [listeners.beforeViewport, listeners.regular]) {
557
+ for (const group of [listeners.beforeAll, listeners.beforeViewport, listeners.regular]) {
554
558
  for (const listener of group) {
555
559
  const result = listener(current);
556
560
  if (result?.consume) return result;
@@ -560,10 +564,14 @@ function dispatchBtwInput(listeners, data) {
560
564
  return current === data ? void 0 : { data: current };
561
565
  }
562
566
  var BtwTuiAltScreen = class extends TuiAltScreen {
567
+ hasFocusedOverlay() {
568
+ return this.isOverlayFocused();
569
+ }
563
570
  addInputListener(listener) {
564
571
  let listeners = btwInputListeners.get(this);
565
572
  if (!listeners) {
566
573
  const registeredListeners = {
574
+ beforeAll: /* @__PURE__ */ new Set(),
567
575
  beforeViewport: /* @__PURE__ */ new Set(),
568
576
  regular: /* @__PURE__ */ new Set()
569
577
  };
@@ -574,6 +582,12 @@ var BtwTuiAltScreen = class extends TuiAltScreen {
574
582
  listeners.regular.add(listener);
575
583
  return () => listeners.regular.delete(listener);
576
584
  }
585
+ addInputListenerBeforeAll(listener) {
586
+ const listeners = btwInputListeners.get(this);
587
+ if (!listeners) return super.addInputListener(listener);
588
+ listeners.beforeAll.add(listener);
589
+ return () => listeners.beforeAll.delete(listener);
590
+ }
577
591
  addInputListenerBeforeViewport(listener) {
578
592
  const listeners = btwInputListeners.get(this);
579
593
  if (!listeners) return super.addInputListener(listener);
@@ -586,26 +600,64 @@ var BtwTuiAltScreen = class extends TuiAltScreen {
586
600
  super.removeInputListener(listener);
587
601
  return;
588
602
  }
603
+ listeners.beforeAll.delete(listener);
589
604
  listeners.beforeViewport.delete(listener);
590
605
  listeners.regular.delete(listener);
591
606
  }
592
607
  };
593
- function createBtwFullscreenTui(parent, theme, openUrl, copyToClipboard2) {
608
+ var BRACKETED_PASTE_START = "\x1B[200~";
609
+ var BRACKETED_PASTE_END = "\x1B[201~";
610
+ function hasManualSelectionCopyApi() {
611
+ return typeof TuiAltScreen.prototype.hasActiveSelection === "function" && typeof TuiAltScreen.prototype.copyActiveSelectionToClipboard === "function";
612
+ }
613
+ function createBtwFullscreenTui(parent, theme, keybindings, copyOnSelect, manualSelectionCopySupported, openUrl, copyToClipboard2) {
614
+ if (!copyOnSelect && !manualSelectionCopySupported) {
615
+ throw new Error(
616
+ "Manual fullscreen selection copying is unavailable in this Pi version; update Pi or enable automatic selection copying."
617
+ );
618
+ }
594
619
  const styleSearchMatch = (text) => theme.bg("searchMatchBg", theme.fg("searchMatchText", text));
595
- return new BtwTuiAltScreen(parent.terminal, parent.getShowHardwareCursor(), void 0, {
596
- mouse: true,
597
- searchMatchStyle: (text) => theme.underline(styleSearchMatch(text)),
598
- searchCurrentMatchStyle: (text) => theme.bold(theme.inverse(styleSearchMatch(text))),
599
- openUrl,
600
- copySelection: async (text) => {
601
- try {
602
- await copyToClipboard2(text);
603
- return true;
604
- } catch {
605
- return false;
620
+ const fullscreen = new BtwTuiAltScreen(
621
+ parent.terminal,
622
+ parent.getShowHardwareCursor(),
623
+ void 0,
624
+ {
625
+ mouse: true,
626
+ copyOnSelect,
627
+ searchMatchStyle: (text) => theme.underline(styleSearchMatch(text)),
628
+ searchCurrentMatchStyle: (text) => theme.bold(theme.inverse(styleSearchMatch(text))),
629
+ openUrl,
630
+ copySelection: async (text) => {
631
+ try {
632
+ await copyToClipboard2(text);
633
+ return true;
634
+ } catch {
635
+ return false;
636
+ }
606
637
  }
607
638
  }
608
- });
639
+ );
640
+ if (!copyOnSelect) {
641
+ let isInBracketedPaste = false;
642
+ fullscreen.addInputListenerBeforeViewport((data) => {
643
+ const wasInBracketedPaste = isInBracketedPaste;
644
+ const startsBracketedPaste = data.includes(BRACKETED_PASTE_START);
645
+ if (startsBracketedPaste) isInBracketedPaste = true;
646
+ if (isInBracketedPaste && data.includes(BRACKETED_PASTE_END)) {
647
+ isInBracketedPaste = false;
648
+ }
649
+ if (wasInBracketedPaste || startsBracketedPaste || fullscreen.hasFocusedOverlay() || isKeyRelease(data) || !keybindings.matches(data, "app.message.copy")) {
650
+ return void 0;
651
+ }
652
+ if (!fullscreen.hasActiveSelection()) {
653
+ fullscreen.flash("No selection to copy");
654
+ return { consume: true };
655
+ }
656
+ void fullscreen.copyActiveSelectionToClipboard().catch(() => fullscreen.flash("Copy failed"));
657
+ return { consume: true };
658
+ });
659
+ }
660
+ return fullscreen;
609
661
  }
610
662
  function openUrlInBrowser(target) {
611
663
  const [command, args] = process.platform === "darwin" ? ["open", [target]] : process.platform === "win32" ? ["rundll32", ["url.dll,FileProtocolHandler", target]] : ["xdg-open", [target]];
@@ -613,7 +665,7 @@ function openUrlInBrowser(target) {
613
665
  }).unref();
614
666
  }
615
667
  var BtwFullscreenHost = class {
616
- constructor(parent, theme, keybindings, ctx, run, done, createTui) {
668
+ constructor(parent, theme, keybindings, ctx, run, done, createTui, options) {
617
669
  this.parent = parent;
618
670
  this.theme = theme;
619
671
  this.keybindings = keybindings;
@@ -621,6 +673,7 @@ var BtwFullscreenHost = class {
621
673
  this.run = run;
622
674
  this.done = done;
623
675
  this.createTui = createTui;
676
+ this.options = options;
624
677
  queueMicrotask(() => void this.start());
625
678
  }
626
679
  parent;
@@ -630,6 +683,7 @@ var BtwFullscreenHost = class {
630
683
  run;
631
684
  done;
632
685
  createTui;
686
+ options;
633
687
  fullscreen;
634
688
  parentOverlay;
635
689
  cancelActiveCustom;
@@ -665,10 +719,10 @@ var BtwFullscreenHost = class {
665
719
  this.parent.stop({ preserveScreen: true });
666
720
  this.parentStopped = true;
667
721
  if (this.disposed) throw new FullscreenUiDisposedError();
668
- this.fullscreen = this.createTui(this.parent, this.theme);
722
+ this.fullscreen = this.createTui(this.parent, this.theme, this.keybindings, this.options);
669
723
  this.fullscreenCreated = true;
670
724
  this.fullscreen.start();
671
- const addHardCancelListener = this.fullscreen.addInputListenerBeforeViewport?.bind(this.fullscreen) ?? this.fullscreen.addInputListener.bind(this.fullscreen);
725
+ const addHardCancelListener = this.fullscreen.addInputListenerBeforeAll?.bind(this.fullscreen) ?? this.fullscreen.addInputListenerBeforeViewport?.bind(this.fullscreen) ?? this.fullscreen.addInputListener.bind(this.fullscreen);
672
726
  this.removeHardCancelListener = addHardCancelListener((data) => {
673
727
  if (isKeyRelease(data) || !matchesKey2(data, Key2.ctrl("c"))) return void 0;
674
728
  try {
@@ -1020,6 +1074,7 @@ Use the provided conversation context only as background. Answer the user's side
1020
1074
 
1021
1075
  // src/settings.ts
1022
1076
  var BTW_SETTINGS_FILE = "pi-btw.json";
1077
+ var DEFAULT_FULLSCREEN_COPY_ON_SELECT = true;
1023
1078
  var DEFAULT_REMEMBER_THINKING_LEVEL_CHANGES = true;
1024
1079
  var MAX_SETTINGS_BYTES = 64 * 1024;
1025
1080
  var mutationQueues = /* @__PURE__ */ new Map();
@@ -1044,6 +1099,11 @@ function normalizeBtwSettings(value) {
1044
1099
  if (typeof remember !== "boolean") return void 0;
1045
1100
  settings.rememberThinkingLevelChanges = remember;
1046
1101
  }
1102
+ if (Object.hasOwn(value, "fullscreenCopyOnSelect")) {
1103
+ const copyOnSelect = Reflect.get(value, "fullscreenCopyOnSelect");
1104
+ if (typeof copyOnSelect !== "boolean") return void 0;
1105
+ settings.fullscreenCopyOnSelect = copyOnSelect;
1106
+ }
1047
1107
  return settings;
1048
1108
  }
1049
1109
  function parseBtwModelReference(reference) {
@@ -1052,6 +1112,9 @@ function parseBtwModelReference(reference) {
1052
1112
  if (separator <= 0 || separator === reference.length - 1) return void 0;
1053
1113
  return { provider: reference.slice(0, separator), modelId: reference.slice(separator + 1) };
1054
1114
  }
1115
+ function effectiveFullscreenCopyOnSelect(settings) {
1116
+ return settings.fullscreenCopyOnSelect ?? DEFAULT_FULLSCREEN_COPY_ON_SELECT;
1117
+ }
1055
1118
  function effectiveRememberThinkingLevelChanges(settings) {
1056
1119
  return settings.rememberThinkingLevelChanges ?? DEFAULT_REMEMBER_THINKING_LEVEL_CHANGES;
1057
1120
  }
@@ -1189,6 +1252,10 @@ function applyBtwSettingsPatch(current, patch) {
1189
1252
  if (Object.hasOwn(patch, "rememberThinkingLevelChanges")) {
1190
1253
  updated.rememberThinkingLevelChanges = patch.rememberThinkingLevelChanges;
1191
1254
  }
1255
+ if (Object.hasOwn(patch, "fullscreenCopyOnSelect")) {
1256
+ if (patch.fullscreenCopyOnSelect === void 0) delete updated.fullscreenCopyOnSelect;
1257
+ else updated.fullscreenCopyOnSelect = patch.fullscreenCopyOnSelect;
1258
+ }
1192
1259
  return updated;
1193
1260
  }
1194
1261
  function isSettingsDocument(value) {
@@ -1246,7 +1313,8 @@ async function showBtwCommandMenu(ctx, options) {
1246
1313
  kind: "actions",
1247
1314
  title: "Pi BTW",
1248
1315
  lines: [
1249
- `Thinking: ${displayThinkingSummary(state.settings)} \xB7 Remember changes: ${displayRememberSummary(state.settings)}`
1316
+ `Thinking: ${displayThinkingSummary(state.settings)} \xB7 Remember changes: ${displayRememberSummary(state.settings)}`,
1317
+ `Copy on select: ${effectiveFullscreenCopyOnSelect(state.settings) ? "On" : "Off"}`
1250
1318
  ],
1251
1319
  items: [
1252
1320
  {
@@ -1272,7 +1340,7 @@ async function showBtwCommandMenu(ctx, options) {
1272
1340
  {
1273
1341
  id: "settings",
1274
1342
  label: "Settings",
1275
- description: "Choose pi-btw thinking level and fixed-level shortcut memory",
1343
+ description: "Choose thinking, shortcut memory, and selection copying",
1276
1344
  to: state.kind === "invalid" ? "invalid" : "settings"
1277
1345
  }
1278
1346
  ],
@@ -1311,6 +1379,14 @@ async function showBtwCommandMenu(ctx, options) {
1311
1379
  currentValue: effectiveRememberThinkingLevelChanges(state.settings) ? "On" : "Off",
1312
1380
  values: ["On", "Off"],
1313
1381
  action: "set-remember"
1382
+ },
1383
+ {
1384
+ id: "fullscreenCopyOnSelect",
1385
+ label: "Copy selection automatically",
1386
+ description: "Copy mouse selections immediately instead of with the configured copy key.",
1387
+ currentValue: effectiveFullscreenCopyOnSelect(state.settings) ? "On" : "Off",
1388
+ values: ["On", "Off"],
1389
+ action: "set-fullscreen-copy"
1314
1390
  }
1315
1391
  ]
1316
1392
  }),
@@ -1368,6 +1444,21 @@ async function showBtwCommandMenu(ctx, options) {
1368
1444
  if (!signal.aborted) notifySaveFailure(ctx, error);
1369
1445
  return { kind: "rejected" };
1370
1446
  }
1447
+ },
1448
+ "set-fullscreen-copy": async ({ value, signal }) => {
1449
+ if (value !== "On" && value !== "Off") return { kind: "rejected" };
1450
+ try {
1451
+ await updateSettings(
1452
+ { fullscreenCopyOnSelect: value === "On" },
1453
+ { settingsPath, signal }
1454
+ );
1455
+ if (signal.aborted) return { kind: "rejected" };
1456
+ notifySafely(ctx, `Copy selection automatically: ${value}.`, "info");
1457
+ return { kind: "stay" };
1458
+ } catch (error) {
1459
+ if (!signal.aborted) notifySaveFailure(ctx, error);
1460
+ return { kind: "rejected" };
1461
+ }
1371
1462
  }
1372
1463
  }
1373
1464
  });
@@ -2475,29 +2566,33 @@ function btw(pi, dependencies = {}) {
2475
2566
  }
2476
2567
  const startingTurnCount = state?.thread.turns.length ?? 0;
2477
2568
  try {
2478
- await runFullscreen(ctx, (fullscreenCtx) => {
2479
- if (!state) {
2480
- const createdAt = Date.now();
2481
- state = {
2482
- id: `btw-${nextThreadNumber}`,
2483
- thread: createSideThread(
2484
- selectedConversationContext ?? buildConversationContext(fullscreenCtx.sessionManager.getBranch())
2485
- ),
2486
- thinkingLevel: settings.thinkingLevel ?? pi.getThinkingLevel(),
2487
- createdAt,
2488
- updatedAt: createdAt
2489
- };
2490
- nextThreadNumber += 1;
2491
- }
2492
- return runThread({
2493
- initialQuestion: question || void 0,
2494
- selected: resolution.selected,
2495
- thinkingLevel: state.thinkingLevel,
2496
- rememberThinkingLevelChanges: !sameAsMainThinkingLevel && effectiveRememberThinkingLevelChanges(settings),
2497
- state,
2498
- ctx: fullscreenCtx
2499
- });
2500
- });
2569
+ await runFullscreen(
2570
+ ctx,
2571
+ (fullscreenCtx) => {
2572
+ if (!state) {
2573
+ const createdAt = Date.now();
2574
+ state = {
2575
+ id: `btw-${nextThreadNumber}`,
2576
+ thread: createSideThread(
2577
+ selectedConversationContext ?? buildConversationContext(fullscreenCtx.sessionManager.getBranch())
2578
+ ),
2579
+ thinkingLevel: settings.thinkingLevel ?? pi.getThinkingLevel(),
2580
+ createdAt,
2581
+ updatedAt: createdAt
2582
+ };
2583
+ nextThreadNumber += 1;
2584
+ }
2585
+ return runThread({
2586
+ initialQuestion: question || void 0,
2587
+ selected: resolution.selected,
2588
+ thinkingLevel: state.thinkingLevel,
2589
+ rememberThinkingLevelChanges: !sameAsMainThinkingLevel && effectiveRememberThinkingLevelChanges(settings),
2590
+ state,
2591
+ ctx: fullscreenCtx
2592
+ });
2593
+ },
2594
+ { copyOnSelect: effectiveFullscreenCopyOnSelect(settings) }
2595
+ );
2501
2596
  } finally {
2502
2597
  if (state?.title && state.thread.turns.length > 0) {
2503
2598
  if (state.thread.turns.length > startingTurnCount) {