@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
package/README.md CHANGED
@@ -8,33 +8,38 @@ Aggregate installer for HerbertGao-maintained Pi extensions and pinned upstream
8
8
  pi install npm:@herbertgao/pi-extensions
9
9
  ```
10
10
 
11
- Requires Node.js 24 or newer.
11
+ Requires Node.js 24 or newer and Pi 0.84.4 or newer.
12
12
 
13
- The package bundles 4 active `@herbertgao/*` child packages—`pi-cc-extensions`, `resume-from`, `pi-stash`, and `pi-subagents`—plus the following upstream packages under their original names:
13
+ The package bundles 4 active `@herbertgao/*` child packages—`pi-bark`, `pi-cc-extensions`, `resume-from`, and `pi-subagents`—plus the following upstream packages under their original names:
14
14
 
15
15
  - `@dietrichgebert/ponytail@4.9.0`
16
- - `@juicesharp/rpiv-ask-user-question@2.7.1`
16
+ - `@juicesharp/rpiv-ask-user-question@2.8.0`
17
17
  - `@luxusai/pi-hindsight@0.12.0`
18
- - `@narumitw/pi-btw@0.55.4`
18
+ - `@narumitw/pi-btw@0.56.0`
19
19
  - `@pi-plugins/fast-mode@0.1.10`
20
20
  - `@tifan/pi-copy-response@0.2.6`
21
- - `@tifan/pi-handoff@2.0.1`
21
+ - `@tifan/pi-handoff@2.2.0`
22
22
  - `@tifan/pi-inline-skills@1.0.5`
23
23
  - `@tifan/pi-mermaid-open@0.2.0`
24
- - `@tifan/pi-preferred-thinking@1.0.0`
25
- - `@tifan/pi-recap@0.4.5`
26
- - `@tifan/pi-rename@0.5.1`
27
- - `@tifan/pi-titlebar-spinner@0.1.3`
28
- - `pi-mcp-adapter@2.29.0`
24
+ - `@tifan/pi-preferred-thinking@1.0.1`
25
+ - `@tifan/pi-recap@0.4.6`
26
+ - `@tifan/pi-rename@0.6.0`
27
+ - `pi-mcp-adapter@2.31.0`
29
28
  - `pi-footer@0.5.1`
30
- - `pi-lens@4.1.2`
31
- - `pi-web-access@0.25.0`
29
+ - `pi-lens@4.1.3`
30
+ - `pi-web-access@0.27.0`
32
31
  - `remote-pi@0.7.0`
33
- - `@czottmann/pi-automode@1.13.0`
32
+ - `@czottmann/pi-automode@1.15.0`
34
33
 
35
34
  Pi loads their extensions and skills through `node_modules/` paths inside one package root. The upstream companions are pinned and bundled, not forked or renamed.
36
35
 
37
- `@herbertgao/resume-from@0.2.0` keeps Claude Code sessions associated with their original repository when the active transcript later moves into a nested cwd. `pi-lens@4.1.2` improves delayed LSP diagnostics, stale-result cleanup, process cleanup, and snapshot completeness. `pi-automode@1.13.0` parses shell commands before applying policy and migrates legacy configuration safely. `pi-web-access@0.25.0` adds opt-in proxy and cloud-auth providers plus GitHub-aware fetching and a Defuddle extraction fallback.
36
+ ### Bark notifications
37
+
38
+ `@herbertgao/pi-bark` sends localized Bark pushes when a user-facing Pi run fully settles or `@juicesharp/rpiv-ask-user-question` needs an answer. Notifications include emoji-labeled machine/path metadata and support the bundled official Pi badge through Bark's `icon` parameter. Configure it in `$PI_CODING_AGENT_DIR/bark.json` (normally `~/.pi/agent/bark.json`); see the [package README](../pi-bark/README.md). Without a valid endpoint it stays inactive.
39
+
40
+ `@herbertgao/resume-from@0.2.0` keeps Claude Code sessions associated with their original repository when the active transcript later moves into a nested cwd. `pi-lens@4.1.3` expands language routing and bounds retained diagnostic facts across multi-root sessions. `pi-automode@1.15.0` preserves dynamic providers on legacy registries. `pi-web-access@0.27.0` adds configurable fetch deadlines and answer models plus isolated GitHub clone runtimes. Preferred Thinking 1.0.1 preserves an explicit subagent `--thinking` choice. Deprecated `@tifan/pi-titlebar-spinner` is no longer bundled; Rename remains the single owner of Herdr tab naming.
41
+
42
+ `pi-stash` is no longer bundled: `/btw` already preserves the main editor draft while handling side questions outside the main conversation. Prior `@herbertgao/pi-stash` releases remain available but are no longer maintained here.
38
43
 
39
44
  If `pi-footer` was installed separately before upgrading to an aggregate release that includes it, remove the standalone source shown by `pi list` so only the bundled copy loads. For the pinned standalone install used while preparing this integration:
40
45
 
@@ -9,7 +9,6 @@ The aggregate package bundles the following packages from [tifandotme/pi-extensi
9
9
  - `@tifan/pi-preferred-thinking`
10
10
  - `@tifan/pi-recap`
11
11
  - `@tifan/pi-rename`
12
- - `@tifan/pi-titlebar-spinner`
13
12
 
14
13
  They are distributed under the following MIT license:
15
14
 
@@ -2,6 +2,22 @@
2
2
 
3
3
  All notable changes to this project are documented in this file.
4
4
 
5
+ ## [Unreleased]
6
+
7
+ ## [1.15.0] - 2026-08-28
8
+
9
+ ## Bug fixes
10
+
11
+ - **OMP 18 classifier compatibility** — Support OMP 18 model registries that lack `complete()` and `getProvider()`. Load the legacy completion API only for these registries. Keep current Pi on its runtime registry path so extension-registered providers remain available. Thanks, @NarryG! (#29)
12
+
13
+ ## [1.14.0] - 2026-08-27
14
+
15
+ ## Bug fixes
16
+
17
+ - **Classifier stream timeout** — Apply `classifierTimeoutMs` to the full response stream. Provider behavior cannot keep classifier calls pending after the deadline. Parent cancellation remains active. Reject values above the Node.js timer limit. (#30)
18
+ - **OS temp-directory deletes** — Stop hard-denying recursive-delete subtrees under `os.tmpdir()` and `/tmp`. On macOS these resolve into `/private/tmp` and `/private/var/folders`, which matched the `/private` system root and blocked every temp cleanup. Deleting a temp root itself stays blocked. (#31)
19
+ - **Validated temp-root declarations** — Derive the exempt temp roots only from launcher-declared values that stay safe: reject values such as `/`, empty strings, aliases of `HOME`, `/`, or a system root, and ancestors of `HOME`. Without validation, a malformed `TMPDIR` could disable deterministic denials for protected targets, and a broad `permissions.allow` rule could then allow the action without classifier review. Recompute candidates when the effective tmpdir changes. (#31)
20
+
5
21
  ## [1.13.0] - 2026-08-25
6
22
 
7
23
  ## New features
@@ -35,5 +51,8 @@ All notable changes to this project are documented in this file.
35
51
  - **Project config trust gate** — Ignore `.pi/automode.local.json` and `.pi/automode.json` until Pi trusts the project. Apply the trust gate during startup and config reloads. (#16)
36
52
  - **In-memory observability logs** — Write logs to an extension-owned directory (`~/.pi/agent/extensions/pi-automode/logs/`) instead of the launching project directory. Thanks, @HerbertGao! (#13)
37
53
 
54
+ [Unreleased]: https://github.com/czottmann/pi-automode/compare/v1.15.0...HEAD
55
+ [1.15.0]: https://github.com/czottmann/pi-automode/compare/v1.14.0...v1.15.0
56
+ [1.14.0]: https://github.com/czottmann/pi-automode/compare/v1.13.0...v1.14.0
38
57
  [1.13.0]: https://github.com/czottmann/pi-automode/compare/v1.12.0...v1.13.0
39
58
  [1.12.0]: https://github.com/czottmann/pi-automode/compare/v1.11.0...v1.12.0
@@ -8,6 +8,10 @@ It is not a sandbox. Extensions run in the Pi process. A malicious extension can
8
8
 
9
9
  Pi-automode does not guard user `!` or `!!` shell commands. It guards only agent tool calls. Use it to reduce unsafe autonomous tool use. Do not use it as an OS security boundary.
10
10
 
11
+ ## Compatibility
12
+
13
+ Pi-automode supports Pi and Oh My Pi (OMP) 18. It automatically uses OMP's legacy completion API. The integration needs no OMP-specific configuration.
14
+
11
15
  ## Install
12
16
 
13
17
  From npm:
@@ -101,7 +105,7 @@ The extension blocks these before any allow or classifier decision:
101
105
  - SSH `authorized_keys` writes
102
106
  - cron, launch agent, and system service persistence
103
107
  - TLS/certificate/auth weakening patterns
104
- - root, home, and system-path destructive deletes
108
+ - root, home, and system-path destructive deletes. Subtrees of validated launcher-declared temp directories are treated as disposable. Declared roots that alias `HOME`, `/`, or a system root, or that contain `HOME`, are rejected instead.
105
109
  - edits to `.pi/automode*`, `.pi` auto-mode files, and this extension's safety-control files
106
110
 
107
111
  After these checks, pi-automode applies `permissions.allow`. Protected `write` and `edit` targets continue to the classifier.
@@ -84,10 +84,9 @@ async function resolveClassifier(
84
84
  };
85
85
  }
86
86
 
87
- const rawComplete: ClassifierCompletionFn = (callModel, context, options) =>
88
- ctx.modelRegistry.complete(callModel, context, options);
89
- const simpleComplete: ClassifierCompletionFn = (callModel, context, options) =>
90
- completeSimpleWithRegistry(ctx, callModel, context, options);
87
+ const { rawComplete, simpleComplete } = createRegistryCompletionFns(
88
+ ctx.modelRegistry,
89
+ );
91
90
  const completionPlan = createClassifierCompletionPlan(
92
91
  model,
93
92
  config.classifierReasoningLevel,
@@ -125,6 +124,70 @@ export type ClassifierCompletionFn = (
125
124
  },
126
125
  ) => Promise<AssistantMessage>;
127
126
 
127
+ type RegistryCompletionApi = {
128
+ complete?: ClassifierCompletionFn;
129
+ getProvider?: (provider: string) => {
130
+ streamSimple: (
131
+ model: Model<any>,
132
+ context: { systemPrompt: string; messages: UserMessage[] },
133
+ options: Parameters<ClassifierCompletionFn>[2],
134
+ ) => { result: () => Promise<AssistantMessage> };
135
+ } | undefined;
136
+ };
137
+ type ClassifierCompletionFallbacks = {
138
+ rawComplete: ClassifierCompletionFn;
139
+ simpleComplete: ClassifierCompletionFn;
140
+ };
141
+
142
+ type ClassifierCompletionFallbackLoader =
143
+ () => Promise<ClassifierCompletionFallbacks>;
144
+
145
+ // Static import would initialize deprecated compat registries on current Pi;
146
+ // OMP rewrites this literal dynamic import to its native pi-ai module.
147
+ async function loadCompatCompletionFns(): Promise<ClassifierCompletionFallbacks> {
148
+ const { complete, completeSimple } = await import(
149
+ "@earendil-works/pi-ai/compat"
150
+ );
151
+ return {
152
+ rawComplete: complete as ClassifierCompletionFn,
153
+ simpleComplete: completeSimple as ClassifierCompletionFn,
154
+ };
155
+ }
156
+
157
+ /**
158
+ * Prefer the current runtime registry so extension-registered providers remain
159
+ * visible. Older Pi-family runtimes (including OMP 18) expose neither
160
+ * `complete` nor `getProvider`; lazily load the compat API they already use.
161
+ */
162
+ export function createRegistryCompletionFns(
163
+ registry: RegistryCompletionApi,
164
+ fallbackLoader: ClassifierCompletionFallbackLoader =
165
+ loadCompatCompletionFns,
166
+ ): ClassifierCompletionFallbacks {
167
+ let fallbackPromise: Promise<ClassifierCompletionFallbacks> | undefined;
168
+ const rawComplete: ClassifierCompletionFn =
169
+ typeof registry.complete === "function"
170
+ ? (model, context, options) =>
171
+ registry.complete!.call(registry, model, context, options)
172
+ : async (model, context, options) =>
173
+ (await (fallbackPromise ??= fallbackLoader())).rawComplete(
174
+ model,
175
+ context,
176
+ options,
177
+ );
178
+ const simpleComplete: ClassifierCompletionFn =
179
+ typeof registry.getProvider === "function"
180
+ ? (model, context, options) =>
181
+ completeSimpleWithRegistry(registry, model, context, options)
182
+ : async (model, context, options) =>
183
+ (await (fallbackPromise ??= fallbackLoader())).simpleComplete(
184
+ model,
185
+ context,
186
+ options,
187
+ );
188
+ return { rawComplete, simpleComplete };
189
+ }
190
+
128
191
  export type RetryOptions = {
129
192
  maxAttempts?: number;
130
193
  maxTokens?: number;
@@ -155,19 +218,67 @@ export type ClassifierCompletionPlan = {
155
218
  reasoningLevel?: Exclude<EffectiveClassifierReasoningLevel, "off">;
156
219
  };
157
220
 
221
+ async function completeClassifierAttempt(
222
+ completeFn: ClassifierCompletionFn,
223
+ model: Model<any>,
224
+ prompt: Parameters<ClassifierCompletionFn>[1],
225
+ parentSignal: AbortSignal | undefined,
226
+ options: Omit<Parameters<ClassifierCompletionFn>[2], "signal">,
227
+ ): Promise<AssistantMessage> {
228
+ if (options.timeoutMs === undefined) {
229
+ return completeFn(model, prompt, {
230
+ ...options,
231
+ ...(parentSignal === undefined ? {} : { signal: parentSignal }),
232
+ });
233
+ }
234
+
235
+ const controller = new AbortController();
236
+ const onParentAbort = () => controller.abort(parentSignal?.reason);
237
+ if (parentSignal?.aborted) onParentAbort();
238
+ else parentSignal?.addEventListener("abort", onParentAbort, { once: true });
239
+
240
+ let onAbort: (() => void) | undefined;
241
+ const aborted = new Promise<never>((_resolve, reject) => {
242
+ onAbort = () => {
243
+ const reason = controller.signal.reason;
244
+ reject(reason instanceof Error ? reason : new Error("Classifier request aborted."));
245
+ };
246
+ if (controller.signal.aborted) onAbort();
247
+ else controller.signal.addEventListener("abort", onAbort, { once: true });
248
+ });
249
+ const timer = setTimeout(() => {
250
+ controller.abort(
251
+ new Error(`Classifier request timed out after ${options.timeoutMs} ms.`),
252
+ );
253
+ }, options.timeoutMs);
254
+
255
+ try {
256
+ return await Promise.race([
257
+ completeFn(model, prompt, {
258
+ ...options,
259
+ signal: controller.signal,
260
+ }),
261
+ aborted,
262
+ ]);
263
+ } finally {
264
+ clearTimeout(timer);
265
+ if (onAbort) controller.signal.removeEventListener("abort", onAbort);
266
+ parentSignal?.removeEventListener("abort", onParentAbort);
267
+ }
268
+ }
269
+
158
270
  /**
159
271
  * Run normalized Pi AI completion through the provider in Pi's runtime registry.
160
- * This temporary bridge is only valid until Pi exposes
161
- * `ctx.modelRegistry.completeSimple(...)` natively. Replace this function with
162
- * that API when the project's minimum supported Pi version includes it.
272
+ * Callers use this only when the registry exposes `getProvider`; legacy
273
+ * registries take the compat completion path instead.
163
274
  */
164
275
  async function completeSimpleWithRegistry(
165
- ctx: ExtensionContext,
276
+ registry: RegistryCompletionApi,
166
277
  model: Model<any>,
167
278
  context: { systemPrompt: string; messages: UserMessage[] },
168
279
  options: Parameters<ClassifierCompletionFn>[2],
169
280
  ): Promise<AssistantMessage> {
170
- const provider = ctx.modelRegistry.getProvider(model.provider);
281
+ const provider = registry.getProvider?.(model.provider);
171
282
  if (!provider) throw new Error(`Unknown provider: ${model.provider}`);
172
283
  return provider.streamSimple(model, context, options).result();
173
284
  }
@@ -435,14 +546,15 @@ export async function classifyWithRetry(
435
546
  const started = Date.now();
436
547
  let response: AssistantMessage;
437
548
  try {
438
- response = await completeFn(
549
+ response = await completeClassifierAttempt(
550
+ completeFn,
439
551
  classifier.model,
440
552
  prompt,
553
+ signal,
441
554
  {
442
555
  apiKey: classifier.apiKey,
443
556
  headers: classifier.headers,
444
557
  env: classifier.env,
445
- signal,
446
558
  maxTokens,
447
559
  ...(temperature === undefined ? {} : { temperature }),
448
560
  ...(options.timeoutMs === undefined ? {} : { timeoutMs: options.timeoutMs }),
@@ -505,7 +617,8 @@ export async function classifyInStages(
505
617
  const fastStarted = Date.now();
506
618
  let fastResponse: AssistantMessage;
507
619
  try {
508
- fastResponse = await completeFn(
620
+ fastResponse = await completeClassifierAttempt(
621
+ completeFn,
509
622
  classifier.model,
510
623
  {
511
624
  systemPrompt: prompt.systemPrompt,
@@ -515,11 +628,11 @@ export async function classifyInStages(
515
628
  stageMessage(CLASSIFIER_FAST_INSTRUCTION),
516
629
  ],
517
630
  },
631
+ signal,
518
632
  {
519
633
  apiKey: classifier.apiKey,
520
634
  headers: classifier.headers,
521
635
  env: classifier.env,
522
- signal,
523
636
  // Reasoning and OpenAI-compatible models may consume hidden reasoning,
524
637
  // control, and EOS tokens before emitting the required visible digit.
525
638
  maxTokens: options.fastClassifierMaxTokens ??
@@ -22,6 +22,7 @@ import {
22
22
  DEFAULT_MAX_USER_TRANSCRIPT_TOKENS,
23
23
  DEFAULT_PROTECTED_PATHS,
24
24
  DEFAULT_SOFT_DENY,
25
+ MAX_CLASSIFIER_TIMEOUT_MS,
25
26
  PI_GLOBAL_SETTINGS,
26
27
  PI_LEGACY_GLOBAL_SETTINGS,
27
28
  PI_PROJECT_LOCAL_SETTINGS,
@@ -324,10 +325,11 @@ export function validateSettingsFile(
324
325
  if (
325
326
  hasOwn(autoMode, "classifierTimeoutMs") &&
326
327
  (!Number.isInteger(autoMode.classifierTimeoutMs) ||
327
- (autoMode.classifierTimeoutMs as number) < 1000)
328
+ (autoMode.classifierTimeoutMs as number) < 1000 ||
329
+ (autoMode.classifierTimeoutMs as number) > MAX_CLASSIFIER_TIMEOUT_MS)
328
330
  ) {
329
331
  diagnostics.push(
330
- `${source}: autoMode.classifierTimeoutMs must be an integer of at least 1000`,
332
+ `${source}: autoMode.classifierTimeoutMs must be an integer from 1000 through ${MAX_CLASSIFIER_TIMEOUT_MS}`,
331
333
  );
332
334
  }
333
335
  if (
@@ -591,7 +593,9 @@ function validFastClassifierBudget(value: unknown): value is number {
591
593
  }
592
594
 
593
595
  function validClassifierTimeout(value: unknown): value is number {
594
- return Number.isInteger(value) && Number(value) >= 1000;
596
+ return Number.isInteger(value) &&
597
+ Number(value) >= 1000 &&
598
+ Number(value) <= MAX_CLASSIFIER_TIMEOUT_MS;
595
599
  }
596
600
 
597
601
  function applyAutoModeScalars(
@@ -61,6 +61,8 @@ export const DENIAL_HISTORY_LIMIT = 12;
61
61
 
62
62
  /** Per-request timeout for classifier completions (fast and detailed stages). */
63
63
  export const DEFAULT_CLASSIFIER_TIMEOUT_MS = 20_000;
64
+ /** Largest timeout that Node can represent without reducing it to 1 ms. */
65
+ export const MAX_CLASSIFIER_TIMEOUT_MS = 2_147_483_647;
64
66
 
65
67
  /** Built-in trusted environment. Users extend this with `$defaults`. */
66
68
  export const DEFAULT_ENVIRONMENT = [
@@ -1,4 +1,5 @@
1
1
  import { statSync } from "node:fs";
2
+ import { tmpdir } from "node:os";
2
3
  import { resolve } from "node:path";
3
4
  import {
4
5
  analyzeBash,
@@ -77,9 +78,115 @@ function matchesPathRoot(path: string, root: string): boolean {
77
78
  return isSameExistingPath(path.slice(0, root.length), root);
78
79
  }
79
80
 
81
+ /**
82
+ * Top-level directories whose deletion or wholesale modification is a
83
+ * system-wide event. Shared between candidate validation and path
84
+ * classification; do not inline copies.
85
+ */
86
+ const SYSTEM_ROOTS: ReadonlyArray<string> = [
87
+ "/bin",
88
+ "/boot",
89
+ "/dev",
90
+ "/etc",
91
+ "/home",
92
+ "/lib",
93
+ "/lib64",
94
+ "/Library",
95
+ "/private",
96
+ "/proc",
97
+ "/root",
98
+ "/run",
99
+ "/sbin",
100
+ "/sys",
101
+ "/System",
102
+ "/usr",
103
+ "/var",
104
+ ];
105
+
106
+ /**
107
+ * Normalize a proposed temp-root value into a comparable absolute path.
108
+ * Returns undefined for values that cannot denote a subdirectory: the
109
+ * empty string, `/`, and slash-only artifacts.
110
+ */
111
+ function normalizeRootCandidate(value: string): string | undefined {
112
+ const stripped = value.replace(/\/+$/, "");
113
+ // An empty stripped value must not fall through to `resolve()`, which
114
+ // would silently turn `/` into the process working directory.
115
+ if (!stripped) return undefined;
116
+ const normalized = resolve(stripped);
117
+ if (normalized === "/") return undefined;
118
+ return normalized;
119
+ }
120
+
121
+ /**
122
+ * True when a candidate temp root would weaken the deterministic deny tiers:
123
+ * it aliases (exact, case-folded, or dev/inode) `HOME`, `/`, or any system
124
+ * root, or it is a proper ancestor of the canonical home directory.
125
+ *
126
+ * Dev/inode identity covers symlinked spellings of existing directories;
127
+ * string comparison alone handles candidates that do not exist yet. See
128
+ * issue #31: without these guards, `TMPDIR=/` reduced every absolute path
129
+ * below an empty-string prefix match, and `TMPDIR=/private` made
130
+ * `/private/etc/**` disposable.
131
+ */
132
+ function conflictsWithProtectedRoots(candidate: string, home: string): boolean {
133
+ if (candidate === "/") return true;
134
+ for (const protectedRoot of ["/", home, ...SYSTEM_ROOTS]) {
135
+ const canonical = resolve(protectedRoot);
136
+ if (
137
+ candidate === canonical ||
138
+ candidate.toLowerCase() === canonical.toLowerCase()
139
+ ) {
140
+ return true;
141
+ }
142
+ if (isSameExistingPath(candidate, canonical)) return true;
143
+ }
144
+ const homeCanonical = resolvePathForPolicy(home) ?? resolve(home);
145
+ return homeCanonical.toLowerCase().startsWith(`${candidate.toLowerCase()}/`);
146
+ }
147
+
148
+ let cachedTempRoots: ReadonlyArray<string> | undefined;
149
+ let cachedTmpdirValue: string | undefined;
150
+
151
+ /**
152
+ * Validated launcher-declared temp-dir roots whose subtrees are treated as
153
+ * disposable by `isRootHomeOrSystemPath`: the platform tmpdir, plus `/tmp` on
154
+ * macOS where it exists independently of `os.tmpdir()`. Each root appears in
155
+ * canonical and resolved spelling because callers pass symlink-resolved
156
+ * policy paths (`/tmp` → `/private/tmp` on macOS) and unresolved fallbacks
157
+ * alike. Values from `os.tmpdir()` are not trusted blindly; see
158
+ * `conflictsWithProtectedRoots`. The roots themselves are never exempt:
159
+ * deleting one is a system-wide delete.
160
+ *
161
+ * The memoization keys on the effective `os.tmpdir()` return value so tests
162
+ * can mutate `TMPDIR`, `TMP`, or `TEMP` between calls.
163
+ */
164
+ export function tempRootCandidates(): ReadonlyArray<string> {
165
+ const currentTmpdir = tmpdir();
166
+ if (cachedTempRoots && cachedTmpdirValue === currentTmpdir) {
167
+ return cachedTempRoots;
168
+ }
169
+ cachedTmpdirValue = currentTmpdir;
170
+ cachedTempRoots = (() => {
171
+ const roots = new Set<string>();
172
+ const consider = (value: string) => {
173
+ const candidate = normalizeRootCandidate(value);
174
+ if (!candidate || conflictsWithProtectedRoots(candidate, HOME)) return;
175
+ roots.add(candidate);
176
+ const resolved = resolvePathForPolicy(candidate);
177
+ if (resolved) roots.add(resolved);
178
+ };
179
+ consider(currentTmpdir);
180
+ if (process.platform === "darwin") consider("/tmp");
181
+ return [...roots];
182
+ })();
183
+ return cachedTempRoots;
184
+ }
185
+
80
186
  /**
81
187
  * True for `/`, the user's home root, or a top-level system root such as
82
- * `/etc`, `/usr`, or `/var`. Excludes the home *subtree*.
188
+ * `/etc`, `/usr`, or `/var`. Excludes the home *subtree* and the subtrees of
189
+ * platform temp directories (`os.tmpdir()` and `/tmp` on macOS).
83
190
  *
84
191
  * On some distros (e.g. Fedora Silverblue) HOME lives under `/var`, which is
85
192
  * in `systemRoots`. Without the subtree exemption, `path.startsWith("/var/")`
@@ -87,32 +194,36 @@ function matchesPathRoot(path: string, root: string): boolean {
87
194
  * `rm -rf ~/...`. HOME itself is still matched below, so `rm -rf ~` stays
88
195
  * blocked. `home` is a parameter so this can be unit-tested with a synthetic
89
196
  * `/var/home/...` value.
197
+ *
198
+ * The temp exemption mirrors the home one and covers cleanup of directories
199
+ * created with `mktemp`, `os.tmpdir()`, or plain `/tmp` paths. On macOS these
200
+ * resolve into `/private/tmp` or `/private/var/folders`, which used to match
201
+ * the `/private` system root and hard-deny every temp cleanup. Deleting a
202
+ * temp root itself still returns true; `tempRoots` is injectable for tests.
203
+ *
204
+ * Protection order matters (issue #31): exact `/`, the exact home root, and
205
+ * system roots win over every exemption. Injected `tempRoots` values are
206
+ * validated per call so hostile or malformed candidates cannot weaken the
207
+ * deterministic tiers.
90
208
  */
91
- export function isRootHomeOrSystemPath(path: string, home: string): boolean {
92
- const systemRoots = [
93
- "/bin",
94
- "/boot",
95
- "/dev",
96
- "/etc",
97
- "/home",
98
- "/lib",
99
- "/lib64",
100
- "/Library",
101
- "/private",
102
- "/proc",
103
- "/root",
104
- "/run",
105
- "/sbin",
106
- "/sys",
107
- "/System",
108
- "/usr",
109
- "/var",
110
- ];
209
+ export function isRootHomeOrSystemPath(
210
+ path: string,
211
+ home: string,
212
+ tempRoots: ReadonlyArray<string> = tempRootCandidates(),
213
+ ): boolean {
214
+ if (path === "/") return true;
215
+ if (path === home || isSameExistingPath(path, home)) return true;
111
216
  if (matchesPathRoot(path, home) && path.length > home.length) return false;
217
+ for (const root of tempRoots) {
218
+ const candidate = normalizeRootCandidate(root);
219
+ if (!candidate || conflictsWithProtectedRoots(candidate, home)) continue;
220
+ if (!matchesPathRoot(path, candidate)) continue;
221
+ // Subtree: disposable. Exact match: the temp root stays protected.
222
+ return path.length > candidate.length ? false : true;
223
+ }
112
224
  return (
113
- path === "/" ||
114
225
  matchesPathRoot(path, home) ||
115
- systemRoots.some((root) => matchesPathRoot(path, root))
226
+ SYSTEM_ROOTS.some((root) => matchesPathRoot(path, root))
116
227
  );
117
228
  }
118
229
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@czottmann/pi-automode",
3
- "version": "1.13.0",
3
+ "version": "1.15.0",
4
4
  "description": "Claude Code-style auto mode guardrail for pi.",
5
5
  "repository": {
6
6
  "url": "https://github.com/czottmann/pi-automode"
@@ -1,6 +1,5 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Tifan Dwi Avianto
4
3
  Copyright (c) 2026 Herbert Gao
5
4
 
6
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -10,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
9
  copies of the Software, and to permit persons to whom the Software is
11
10
  furnished to do so, subject to the following conditions:
12
11
 
13
- The above copyright notice and this permission notice shall be included in
14
- all copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
15
14
 
16
15
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
16
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
17
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- THE SOFTWARE.
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,44 @@
1
+ # @herbertgao/pi-bark
2
+
3
+ Bark notifications for user-facing Pi sessions. It sends a notification when Pi fully settles and when [`@juicesharp/rpiv-ask-user-question`](https://github.com/juicesharp/rpiv-mono) opens a questionnaire. Requests follow Bark's official [POST form API](https://github.com/Finb/Bark/blob/master/docs/en-us/tutorial.md#request-methods).
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pi install npm:@herbertgao/pi-bark
9
+ ```
10
+
11
+ The extension is also included in `@herbertgao/pi-extensions`.
12
+
13
+ ## Configure
14
+
15
+ Create `$PI_CODING_AGENT_DIR/bark.json` (normally `~/.pi/agent/bark.json`):
16
+
17
+ ```json
18
+ {
19
+ "endpoint": "https://api.day.app/your-device-key",
20
+ "machine": "MacBook Pro M1 Max",
21
+ "locale": "zh-CN",
22
+ "events": {
23
+ "agentSettled": true,
24
+ "askUserQuestion": true
25
+ },
26
+ "params": {
27
+ "group": "pi",
28
+ "icon": "https://raw.githubusercontent.com/HerbertGao/pi-extensions/master/packages/pi-bark/assets/pi-icon.png"
29
+ },
30
+ "timeoutMs": 4000
31
+ }
32
+ ```
33
+
34
+ `endpoint` is required. `locale` accepts `auto` (default), `zh-CN`, `zh-TW`, or `en`; unsupported languages fall back to English. `params` accepts additional Bark POST parameters such as `group`, `sound`, `icon`, and `level`; dynamic `title` and `body` values always take precedence. Set `"enabled": false` to disable all notifications without removing the package.
35
+
36
+ The notification body uses `💻` for the configured machine name and `📁` for Pi's full working directory. Questionnaire text is intentionally not sent because it may contain sensitive context. Only sessions with a user-facing UI notify, so nested `pi-subagents` sessions do not create duplicate pushes.
37
+
38
+ The bundled [`assets/pi-icon.png`](assets/pi-icon.png) is a 512×512 rasterization of Pi's official [square badge](https://pi.dev/favicon.svg) from the [Pi Press Kit](https://pi.dev/press-kit), suitable for Bark's iOS 15+ `icon` parameter.
39
+
40
+ Keep `bark.json` private because the endpoint normally contains the Bark device key. Restart Pi or run `/reload` after changing it.
41
+
42
+ ## License
43
+
44
+ [MIT](LICENSE)