@herbertgao/pi-extensions 2026.9.17 → 2026.9.18

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 (266) hide show
  1. package/README.md +14 -15
  2. package/node_modules/@herbertgao/pi-bark/package.json +2 -2
  3. package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +4 -1
  4. package/node_modules/@herbertgao/pi-cc-extensions/README.md +4 -1
  5. package/node_modules/@herbertgao/pi-cc-extensions/package.json +75 -75
  6. package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +6 -0
  7. package/node_modules/@herbertgao/pi-subagents/package.json +7 -7
  8. package/node_modules/@herbertgao/resume-from/package.json +4 -2
  9. package/node_modules/@herbertgao/sol-pi/package.json +6 -6
  10. package/node_modules/@juicesharp/rpiv-ask-user-question/package.json +99 -99
  11. package/node_modules/@pi-plugins/fast-mode/package.json +1 -1
  12. package/node_modules/@tifan/pi-handoff/package.json +1 -1
  13. package/node_modules/@tifan/pi-handoff/src/index.ts +56 -26
  14. package/node_modules/@tifan/pi-mermaid-open/package.json +1 -1
  15. package/node_modules/@tifan/pi-preferred-thinking/package.json +1 -1
  16. package/node_modules/@tifan/pi-recap/package.json +1 -1
  17. package/node_modules/@tifan/pi-rename/package.json +1 -1
  18. package/node_modules/pi-antigravity/package.json +2 -2
  19. package/node_modules/pi-lens/package.json +158 -158
  20. package/node_modules/pi-multi-account/package.json +2 -2
  21. package/node_modules/pi-typesafe/README.md +1 -1
  22. package/node_modules/pi-typesafe/dist/auth.d.ts +9 -5
  23. package/node_modules/pi-typesafe/dist/auth.js +7 -3
  24. package/node_modules/pi-typesafe/dist/backends.d.ts +33 -3
  25. package/node_modules/pi-typesafe/dist/backends.js +95 -1
  26. package/node_modules/pi-typesafe/dist/client.d.ts +5 -5
  27. package/node_modules/pi-typesafe/dist/client.js +12 -9
  28. package/node_modules/pi-typesafe/dist/credentials.d.ts +14 -8
  29. package/node_modules/pi-typesafe/dist/credentials.js +10 -7
  30. package/node_modules/pi-typesafe/dist/errors.d.ts +2 -2
  31. package/node_modules/pi-typesafe/dist/index.d.ts +2 -2
  32. package/node_modules/pi-typesafe/dist/index.js +1 -1
  33. package/node_modules/pi-typesafe/dist/login.d.ts +2 -2
  34. package/node_modules/pi-typesafe/dist/login.js +2 -2
  35. package/node_modules/pi-typesafe/package.json +5 -5
  36. package/node_modules/pi-web-access/package.json +2 -2
  37. package/node_modules/remote-pi/package.json +5 -1
  38. package/package.json +16 -28
  39. package/node_modules/pi-mcp-adapter/CHANGELOG.md +0 -1013
  40. package/node_modules/pi-mcp-adapter/LICENSE +0 -21
  41. package/node_modules/pi-mcp-adapter/OAUTH.md +0 -369
  42. package/node_modules/pi-mcp-adapter/README.md +0 -1021
  43. package/node_modules/pi-mcp-adapter/abort.ts +0 -34
  44. package/node_modules/pi-mcp-adapter/agent-dir.ts +0 -68
  45. package/node_modules/pi-mcp-adapter/agent-plugin-loader.ts +0 -416
  46. package/node_modules/pi-mcp-adapter/agent-plugin-provenance.ts +0 -36
  47. package/node_modules/pi-mcp-adapter/app-bridge.bundle.js +0 -67
  48. package/node_modules/pi-mcp-adapter/banner.png +0 -0
  49. package/node_modules/pi-mcp-adapter/bearer-command-resolver.ts +0 -193
  50. package/node_modules/pi-mcp-adapter/claude-plugin-loader.ts +0 -365
  51. package/node_modules/pi-mcp-adapter/cli.js +0 -454
  52. package/node_modules/pi-mcp-adapter/commands.ts +0 -861
  53. package/node_modules/pi-mcp-adapter/config.ts +0 -1565
  54. package/node_modules/pi-mcp-adapter/consent-manager.ts +0 -95
  55. package/node_modules/pi-mcp-adapter/direct-tool-surface.ts +0 -244
  56. package/node_modules/pi-mcp-adapter/direct-tools.ts +0 -428
  57. package/node_modules/pi-mcp-adapter/dist/abort.d.ts +0 -2
  58. package/node_modules/pi-mcp-adapter/dist/abort.js +0 -36
  59. package/node_modules/pi-mcp-adapter/dist/abort.js.map +0 -1
  60. package/node_modules/pi-mcp-adapter/dist/agent-dir.d.ts +0 -10
  61. package/node_modules/pi-mcp-adapter/dist/agent-dir.js +0 -63
  62. package/node_modules/pi-mcp-adapter/dist/agent-dir.js.map +0 -1
  63. package/node_modules/pi-mcp-adapter/dist/agent-plugin-loader.d.ts +0 -8
  64. package/node_modules/pi-mcp-adapter/dist/agent-plugin-loader.js +0 -398
  65. package/node_modules/pi-mcp-adapter/dist/agent-plugin-loader.js.map +0 -1
  66. package/node_modules/pi-mcp-adapter/dist/agent-plugin-provenance.d.ts +0 -1
  67. package/node_modules/pi-mcp-adapter/dist/agent-plugin-provenance.js +0 -31
  68. package/node_modules/pi-mcp-adapter/dist/agent-plugin-provenance.js.map +0 -1
  69. package/node_modules/pi-mcp-adapter/dist/bearer-command-resolver.d.ts +0 -6
  70. package/node_modules/pi-mcp-adapter/dist/bearer-command-resolver.js +0 -194
  71. package/node_modules/pi-mcp-adapter/dist/bearer-command-resolver.js.map +0 -1
  72. package/node_modules/pi-mcp-adapter/dist/claude-plugin-loader.d.ts +0 -9
  73. package/node_modules/pi-mcp-adapter/dist/claude-plugin-loader.js +0 -362
  74. package/node_modules/pi-mcp-adapter/dist/claude-plugin-loader.js.map +0 -1
  75. package/node_modules/pi-mcp-adapter/dist/config.d.ts +0 -134
  76. package/node_modules/pi-mcp-adapter/dist/config.js +0 -1361
  77. package/node_modules/pi-mcp-adapter/dist/config.js.map +0 -1
  78. package/node_modules/pi-mcp-adapter/dist/consent-manager.d.ts +0 -18
  79. package/node_modules/pi-mcp-adapter/dist/consent-manager.js +0 -88
  80. package/node_modules/pi-mcp-adapter/dist/consent-manager.js.map +0 -1
  81. package/node_modules/pi-mcp-adapter/dist/elicitation-handler.d.ts +0 -17
  82. package/node_modules/pi-mcp-adapter/dist/elicitation-handler.js +0 -316
  83. package/node_modules/pi-mcp-adapter/dist/elicitation-handler.js.map +0 -1
  84. package/node_modules/pi-mcp-adapter/dist/errors.d.ts +0 -131
  85. package/node_modules/pi-mcp-adapter/dist/errors.js +0 -278
  86. package/node_modules/pi-mcp-adapter/dist/errors.js.map +0 -1
  87. package/node_modules/pi-mcp-adapter/dist/http-ca.d.ts +0 -8
  88. package/node_modules/pi-mcp-adapter/dist/http-ca.js +0 -88
  89. package/node_modules/pi-mcp-adapter/dist/http-ca.js.map +0 -1
  90. package/node_modules/pi-mcp-adapter/dist/jev-client.d.ts +0 -14
  91. package/node_modules/pi-mcp-adapter/dist/jev-client.js +0 -367
  92. package/node_modules/pi-mcp-adapter/dist/jev-client.js.map +0 -1
  93. package/node_modules/pi-mcp-adapter/dist/jev-contracts.d.ts +0 -77
  94. package/node_modules/pi-mcp-adapter/dist/jev-contracts.js +0 -2
  95. package/node_modules/pi-mcp-adapter/dist/jev-contracts.js.map +0 -1
  96. package/node_modules/pi-mcp-adapter/dist/jev-key-store.d.ts +0 -51
  97. package/node_modules/pi-mcp-adapter/dist/jev-key-store.js +0 -205
  98. package/node_modules/pi-mcp-adapter/dist/jev-key-store.js.map +0 -1
  99. package/node_modules/pi-mcp-adapter/dist/json-schema-validator.d.ts +0 -2
  100. package/node_modules/pi-mcp-adapter/dist/json-schema-validator.js +0 -68
  101. package/node_modules/pi-mcp-adapter/dist/json-schema-validator.js.map +0 -1
  102. package/node_modules/pi-mcp-adapter/dist/lifecycle.d.ts +0 -56
  103. package/node_modules/pi-mcp-adapter/dist/lifecycle.js +0 -410
  104. package/node_modules/pi-mcp-adapter/dist/lifecycle.js.map +0 -1
  105. package/node_modules/pi-mcp-adapter/dist/logger.d.ts +0 -51
  106. package/node_modules/pi-mcp-adapter/dist/logger.js +0 -131
  107. package/node_modules/pi-mcp-adapter/dist/logger.js.map +0 -1
  108. package/node_modules/pi-mcp-adapter/dist/mcp-auth-fetch.d.ts +0 -26
  109. package/node_modules/pi-mcp-adapter/dist/mcp-auth-fetch.js +0 -103
  110. package/node_modules/pi-mcp-adapter/dist/mcp-auth-fetch.js.map +0 -1
  111. package/node_modules/pi-mcp-adapter/dist/mcp-auth-flow.d.ts +0 -118
  112. package/node_modules/pi-mcp-adapter/dist/mcp-auth-flow.js +0 -1097
  113. package/node_modules/pi-mcp-adapter/dist/mcp-auth-flow.js.map +0 -1
  114. package/node_modules/pi-mcp-adapter/dist/mcp-auth.d.ts +0 -170
  115. package/node_modules/pi-mcp-adapter/dist/mcp-auth.js +0 -1142
  116. package/node_modules/pi-mcp-adapter/dist/mcp-auth.js.map +0 -1
  117. package/node_modules/pi-mcp-adapter/dist/mcp-bearer-store.d.ts +0 -24
  118. package/node_modules/pi-mcp-adapter/dist/mcp-bearer-store.js +0 -203
  119. package/node_modules/pi-mcp-adapter/dist/mcp-bearer-store.js.map +0 -1
  120. package/node_modules/pi-mcp-adapter/dist/mcp-callback-server.d.ts +0 -53
  121. package/node_modules/pi-mcp-adapter/dist/mcp-callback-server.js +0 -441
  122. package/node_modules/pi-mcp-adapter/dist/mcp-callback-server.js.map +0 -1
  123. package/node_modules/pi-mcp-adapter/dist/mcp-oauth-provider.d.ts +0 -148
  124. package/node_modules/pi-mcp-adapter/dist/mcp-oauth-provider.js +0 -689
  125. package/node_modules/pi-mcp-adapter/dist/mcp-oauth-provider.js.map +0 -1
  126. package/node_modules/pi-mcp-adapter/dist/mcp-probe.d.ts +0 -6
  127. package/node_modules/pi-mcp-adapter/dist/mcp-probe.js +0 -166
  128. package/node_modules/pi-mcp-adapter/dist/mcp-probe.js.map +0 -1
  129. package/node_modules/pi-mcp-adapter/dist/mcp-tasks.d.ts +0 -102
  130. package/node_modules/pi-mcp-adapter/dist/mcp-tasks.js +0 -369
  131. package/node_modules/pi-mcp-adapter/dist/mcp-tasks.js.map +0 -1
  132. package/node_modules/pi-mcp-adapter/dist/mcp-trace.d.ts +0 -95
  133. package/node_modules/pi-mcp-adapter/dist/mcp-trace.js +0 -242
  134. package/node_modules/pi-mcp-adapter/dist/mcp-trace.js.map +0 -1
  135. package/node_modules/pi-mcp-adapter/dist/metadata-cache.d.ts +0 -19
  136. package/node_modules/pi-mcp-adapter/dist/metadata-cache.js +0 -301
  137. package/node_modules/pi-mcp-adapter/dist/metadata-cache.js.map +0 -1
  138. package/node_modules/pi-mcp-adapter/dist/npx-resolver.d.ts +0 -6
  139. package/node_modules/pi-mcp-adapter/dist/npx-resolver.js +0 -505
  140. package/node_modules/pi-mcp-adapter/dist/npx-resolver.js.map +0 -1
  141. package/node_modules/pi-mcp-adapter/dist/package-mcp-loader.d.ts +0 -2
  142. package/node_modules/pi-mcp-adapter/dist/package-mcp-loader.js +0 -144
  143. package/node_modules/pi-mcp-adapter/dist/package-mcp-loader.js.map +0 -1
  144. package/node_modules/pi-mcp-adapter/dist/request-headers-command.d.ts +0 -10
  145. package/node_modules/pi-mcp-adapter/dist/request-headers-command.js +0 -312
  146. package/node_modules/pi-mcp-adapter/dist/request-headers-command.js.map +0 -1
  147. package/node_modules/pi-mcp-adapter/dist/resource-tools.d.ts +0 -1
  148. package/node_modules/pi-mcp-adapter/dist/resource-tools.js +0 -15
  149. package/node_modules/pi-mcp-adapter/dist/resource-tools.js.map +0 -1
  150. package/node_modules/pi-mcp-adapter/dist/runtime-owner.d.ts +0 -13
  151. package/node_modules/pi-mcp-adapter/dist/runtime-owner.js +0 -97
  152. package/node_modules/pi-mcp-adapter/dist/runtime-owner.js.map +0 -1
  153. package/node_modules/pi-mcp-adapter/dist/sampling-handler.d.ts +0 -17
  154. package/node_modules/pi-mcp-adapter/dist/sampling-handler.js +0 -203
  155. package/node_modules/pi-mcp-adapter/dist/sampling-handler.js.map +0 -1
  156. package/node_modules/pi-mcp-adapter/dist/secure-keyring.d.ts +0 -11
  157. package/node_modules/pi-mcp-adapter/dist/secure-keyring.js +0 -172
  158. package/node_modules/pi-mcp-adapter/dist/secure-keyring.js.map +0 -1
  159. package/node_modules/pi-mcp-adapter/dist/server-manager.d.ts +0 -157
  160. package/node_modules/pi-mcp-adapter/dist/server-manager.js +0 -1745
  161. package/node_modules/pi-mcp-adapter/dist/server-manager.js.map +0 -1
  162. package/node_modules/pi-mcp-adapter/dist/session-approvals.d.ts +0 -34
  163. package/node_modules/pi-mcp-adapter/dist/session-approvals.js +0 -140
  164. package/node_modules/pi-mcp-adapter/dist/session-approvals.js.map +0 -1
  165. package/node_modules/pi-mcp-adapter/dist/session-recovery.d.ts +0 -26
  166. package/node_modules/pi-mcp-adapter/dist/session-recovery.js +0 -142
  167. package/node_modules/pi-mcp-adapter/dist/session-recovery.js.map +0 -1
  168. package/node_modules/pi-mcp-adapter/dist/state.d.ts +0 -73
  169. package/node_modules/pi-mcp-adapter/dist/state.js +0 -2
  170. package/node_modules/pi-mcp-adapter/dist/state.js.map +0 -1
  171. package/node_modules/pi-mcp-adapter/dist/types.d.ts +0 -642
  172. package/node_modules/pi-mcp-adapter/dist/types.js +0 -331
  173. package/node_modules/pi-mcp-adapter/dist/types.js.map +0 -1
  174. package/node_modules/pi-mcp-adapter/dist/ui-app-bridge-helpers.d.ts +0 -6
  175. package/node_modules/pi-mcp-adapter/dist/ui-app-bridge-helpers.js +0 -37
  176. package/node_modules/pi-mcp-adapter/dist/ui-app-bridge-helpers.js.map +0 -1
  177. package/node_modules/pi-mcp-adapter/dist/ui-resource-handler.d.ts +0 -17
  178. package/node_modules/pi-mcp-adapter/dist/ui-resource-handler.js +0 -219
  179. package/node_modules/pi-mcp-adapter/dist/ui-resource-handler.js.map +0 -1
  180. package/node_modules/pi-mcp-adapter/dist/ui-stream-types.d.ts +0 -104
  181. package/node_modules/pi-mcp-adapter/dist/ui-stream-types.js +0 -59
  182. package/node_modules/pi-mcp-adapter/dist/ui-stream-types.js.map +0 -1
  183. package/node_modules/pi-mcp-adapter/dist/ui-tool-visibility.d.ts +0 -4
  184. package/node_modules/pi-mcp-adapter/dist/ui-tool-visibility.js +0 -27
  185. package/node_modules/pi-mcp-adapter/dist/ui-tool-visibility.js.map +0 -1
  186. package/node_modules/pi-mcp-adapter/dist/unix-socket-transport.d.ts +0 -15
  187. package/node_modules/pi-mcp-adapter/dist/unix-socket-transport.js +0 -85
  188. package/node_modules/pi-mcp-adapter/dist/unix-socket-transport.js.map +0 -1
  189. package/node_modules/pi-mcp-adapter/dist/utils.d.ts +0 -41
  190. package/node_modules/pi-mcp-adapter/dist/utils.js +0 -417
  191. package/node_modules/pi-mcp-adapter/dist/utils.js.map +0 -1
  192. package/node_modules/pi-mcp-adapter/elicitation-handler.ts +0 -358
  193. package/node_modules/pi-mcp-adapter/error-signal.ts +0 -32
  194. package/node_modules/pi-mcp-adapter/errors.ts +0 -364
  195. package/node_modules/pi-mcp-adapter/examples/jev-accessibility-loop.mjs +0 -85
  196. package/node_modules/pi-mcp-adapter/examples/jev-semantic-filter.mjs +0 -34
  197. package/node_modules/pi-mcp-adapter/failure-backoff.ts +0 -23
  198. package/node_modules/pi-mcp-adapter/glimpse-ui.ts +0 -80
  199. package/node_modules/pi-mcp-adapter/host-html-template.ts +0 -515
  200. package/node_modules/pi-mcp-adapter/http-ca.ts +0 -84
  201. package/node_modules/pi-mcp-adapter/index.ts +0 -2106
  202. package/node_modules/pi-mcp-adapter/init.ts +0 -721
  203. package/node_modules/pi-mcp-adapter/jev-client.ts +0 -300
  204. package/node_modules/pi-mcp-adapter/jev-contracts.ts +0 -53
  205. package/node_modules/pi-mcp-adapter/jev-key-store.ts +0 -192
  206. package/node_modules/pi-mcp-adapter/json-schema-validator.ts +0 -83
  207. package/node_modules/pi-mcp-adapter/lazy-loader.ts +0 -7
  208. package/node_modules/pi-mcp-adapter/lifecycle.ts +0 -457
  209. package/node_modules/pi-mcp-adapter/logger.ts +0 -169
  210. package/node_modules/pi-mcp-adapter/mcp-auth-fetch.ts +0 -113
  211. package/node_modules/pi-mcp-adapter/mcp-auth-flow.ts +0 -1296
  212. package/node_modules/pi-mcp-adapter/mcp-auth.ts +0 -1287
  213. package/node_modules/pi-mcp-adapter/mcp-bearer-store.ts +0 -250
  214. package/node_modules/pi-mcp-adapter/mcp-callback-server.ts +0 -534
  215. package/node_modules/pi-mcp-adapter/mcp-code.ts +0 -495
  216. package/node_modules/pi-mcp-adapter/mcp-install.ts +0 -60
  217. package/node_modules/pi-mcp-adapter/mcp-keyring-helper.cjs +0 -89
  218. package/node_modules/pi-mcp-adapter/mcp-oauth-provider.ts +0 -819
  219. package/node_modules/pi-mcp-adapter/mcp-output-guard.ts +0 -511
  220. package/node_modules/pi-mcp-adapter/mcp-panel-theme.ts +0 -104
  221. package/node_modules/pi-mcp-adapter/mcp-panel.ts +0 -1099
  222. package/node_modules/pi-mcp-adapter/mcp-probe.ts +0 -201
  223. package/node_modules/pi-mcp-adapter/mcp-references.ts +0 -373
  224. package/node_modules/pi-mcp-adapter/mcp-script-worker.mjs +0 -137
  225. package/node_modules/pi-mcp-adapter/mcp-setup-panel.ts +0 -747
  226. package/node_modules/pi-mcp-adapter/mcp-status.ts +0 -105
  227. package/node_modules/pi-mcp-adapter/mcp-tasks.ts +0 -467
  228. package/node_modules/pi-mcp-adapter/mcp-trace.ts +0 -306
  229. package/node_modules/pi-mcp-adapter/metadata-cache.ts +0 -362
  230. package/node_modules/pi-mcp-adapter/namespace-tools.ts +0 -334
  231. package/node_modules/pi-mcp-adapter/npx-resolver.ts +0 -543
  232. package/node_modules/pi-mcp-adapter/oauth-handler.ts +0 -30
  233. package/node_modules/pi-mcp-adapter/oauth.ts +0 -52
  234. package/node_modules/pi-mcp-adapter/onboarding-state.ts +0 -76
  235. package/node_modules/pi-mcp-adapter/package-mcp-loader.ts +0 -156
  236. package/node_modules/pi-mcp-adapter/package.json +0 -219
  237. package/node_modules/pi-mcp-adapter/panel-keys.ts +0 -53
  238. package/node_modules/pi-mcp-adapter/prompts.ts +0 -385
  239. package/node_modules/pi-mcp-adapter/proxy-modes.ts +0 -1735
  240. package/node_modules/pi-mcp-adapter/request-headers-command.ts +0 -333
  241. package/node_modules/pi-mcp-adapter/resource-tools.ts +0 -17
  242. package/node_modules/pi-mcp-adapter/runtime-owner.ts +0 -106
  243. package/node_modules/pi-mcp-adapter/sampling-handler.ts +0 -261
  244. package/node_modules/pi-mcp-adapter/sandbox-proxy-template.ts +0 -144
  245. package/node_modules/pi-mcp-adapter/search-ranking.ts +0 -309
  246. package/node_modules/pi-mcp-adapter/secure-keyring.ts +0 -170
  247. package/node_modules/pi-mcp-adapter/semantic-search.ts +0 -186
  248. package/node_modules/pi-mcp-adapter/server-manager.ts +0 -2088
  249. package/node_modules/pi-mcp-adapter/session-approvals.ts +0 -201
  250. package/node_modules/pi-mcp-adapter/session-recovery.ts +0 -158
  251. package/node_modules/pi-mcp-adapter/skills/mcp-scripting/SKILL.md +0 -49
  252. package/node_modules/pi-mcp-adapter/state.ts +0 -71
  253. package/node_modules/pi-mcp-adapter/tool-approval.ts +0 -205
  254. package/node_modules/pi-mcp-adapter/tool-metadata.ts +0 -302
  255. package/node_modules/pi-mcp-adapter/tool-registrar.ts +0 -255
  256. package/node_modules/pi-mcp-adapter/tool-result-renderer.ts +0 -573
  257. package/node_modules/pi-mcp-adapter/ts-shape.ts +0 -149
  258. package/node_modules/pi-mcp-adapter/types.ts +0 -1120
  259. package/node_modules/pi-mcp-adapter/ui-app-bridge-helpers.ts +0 -40
  260. package/node_modules/pi-mcp-adapter/ui-resource-handler.ts +0 -266
  261. package/node_modules/pi-mcp-adapter/ui-server.ts +0 -993
  262. package/node_modules/pi-mcp-adapter/ui-session.ts +0 -624
  263. package/node_modules/pi-mcp-adapter/ui-stream-types.ts +0 -89
  264. package/node_modules/pi-mcp-adapter/ui-tool-visibility.ts +0 -25
  265. package/node_modules/pi-mcp-adapter/unix-socket-transport.ts +0 -85
  266. package/node_modules/pi-mcp-adapter/utils.ts +0 -464
@@ -139,6 +139,39 @@ function getCommandError(stdout: string, stderr: string): string {
139
139
  return stderr.trim() || stdout.trim() || "unknown error"
140
140
  }
141
141
 
142
+ type HerdrCommandResult = {
143
+ code: number
144
+ stdout: string
145
+ stderr: string
146
+ }
147
+
148
+ const HERDR_AGENT_START_ATTEMPTS = 20
149
+ const HERDR_AGENT_START_RETRY_DELAY_MS = 250
150
+
151
+ export function startHerdrAgentWithRetry(
152
+ start: () => Promise<HerdrCommandResult>,
153
+ ): Promise<void> {
154
+ async function attemptStart(attempt: number): Promise<void> {
155
+ const result = await start()
156
+ if (result.code === 0) return
157
+
158
+ const error = getCommandError(result.stdout, result.stderr)
159
+ if (
160
+ !error.includes("agent_pane_busy") ||
161
+ attempt === HERDR_AGENT_START_ATTEMPTS - 1
162
+ ) {
163
+ throw new Error(`Could not start Pi in Herdr tab: ${error}`)
164
+ }
165
+
166
+ await new Promise<void>((resolve) => {
167
+ setTimeout(resolve, HERDR_AGENT_START_RETRY_DELAY_MS)
168
+ })
169
+ return attemptStart(attempt + 1)
170
+ }
171
+
172
+ return attemptStart(0)
173
+ }
174
+
142
175
  async function startHandoffInHerdr(options: {
143
176
  pi: ExtensionAPI
144
177
  ctx: ExtensionCommandContext
@@ -192,33 +225,30 @@ async function startHandoffInHerdr(options: {
192
225
  const agentName = `handoff-${randomUUID().slice(0, 8)}`
193
226
  const model = options.ctx.model!
194
227
 
195
- const startedAgent = await options.pi.exec(
196
- "herdr",
197
- [
198
- "agent",
199
- "start",
200
- agentName,
201
- "--kind",
202
- "pi",
203
- "--pane",
204
- rootPaneId,
205
- "--",
206
- "--session",
207
- childSessionPath,
208
- "--name",
209
- options.sessionName,
210
- "--provider",
211
- model.provider,
212
- "--model",
213
- model.id,
214
- ],
215
- { timeout: 35_000 },
228
+ await startHerdrAgentWithRetry(() =>
229
+ options.pi.exec(
230
+ "herdr",
231
+ [
232
+ "agent",
233
+ "start",
234
+ agentName,
235
+ "--kind",
236
+ "pi",
237
+ "--pane",
238
+ rootPaneId,
239
+ "--",
240
+ "--session",
241
+ childSessionPath,
242
+ "--name",
243
+ options.sessionName,
244
+ "--provider",
245
+ model.provider,
246
+ "--model",
247
+ model.id,
248
+ ],
249
+ { timeout: 35_000 },
250
+ ),
216
251
  )
217
- if (startedAgent.code !== 0) {
218
- throw new Error(
219
- `Could not start Pi in Herdr tab: ${getCommandError(startedAgent.stdout, startedAgent.stderr)}`,
220
- )
221
- }
222
252
 
223
253
  const promptedAgent = await options.pi.exec("herdr", [
224
254
  "agent",
@@ -33,7 +33,7 @@
33
33
  "grok-mermaid": "0.2.2"
34
34
  },
35
35
  "peerDependencies": {
36
- "@earendil-works/pi-tui": ">=0.84.0"
36
+ "@earendil-works/pi-tui": "*"
37
37
  },
38
38
  "engines": {
39
39
  "node": ">=20"
@@ -29,7 +29,7 @@
29
29
  "provenance": true
30
30
  },
31
31
  "peerDependencies": {
32
- "@earendil-works/pi-coding-agent": ">=0.84.2"
32
+ "@earendil-works/pi-coding-agent": "*"
33
33
  },
34
34
  "engines": {
35
35
  "node": ">=20"
@@ -29,7 +29,7 @@
29
29
  "provenance": true
30
30
  },
31
31
  "peerDependencies": {
32
- "@earendil-works/pi-coding-agent": ">=0.84.3"
32
+ "@earendil-works/pi-coding-agent": "*"
33
33
  },
34
34
  "engines": {
35
35
  "node": ">=20"
@@ -34,7 +34,7 @@
34
34
  "provenance": true
35
35
  },
36
36
  "peerDependencies": {
37
- "@earendil-works/pi-coding-agent": ">=0.84.2"
37
+ "@earendil-works/pi-coding-agent": "*"
38
38
  },
39
39
  "engines": {
40
40
  "node": ">=20"
@@ -47,8 +47,8 @@
47
47
  ]
48
48
  },
49
49
  "peerDependencies": {
50
- "@earendil-works/pi-ai": ">=0.80.0",
51
- "@earendil-works/pi-coding-agent": ">=0.80.0"
50
+ "@earendil-works/pi-ai": "*",
51
+ "@earendil-works/pi-coding-agent": "*"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@earendil-works/pi-ai": "^0.84.2",
@@ -1,160 +1,160 @@
1
1
  {
2
- "name": "pi-lens",
3
- "version": "4.3.0",
4
- "type": "module",
5
- "description": "Real-time code feedback for pi — LSP, linters, formatters, type-checking, structural analysis & booboo",
6
- "repository": {
7
- "type": "git",
8
- "url": "git+https://github.com/apmantza/pi-lens.git"
9
- },
10
- "main": "./dist/index.js",
11
- "bin": {
12
- "pi-lens": "dist/mcp/cli.js",
13
- "pi-lens-mcp": "dist/mcp/server.js",
14
- "pi-lens-analyze": "dist/mcp/analyze-cli.js"
15
- },
16
- "scripts": {
17
- "build": "tsc --project tsconfig.build.json",
18
- "build:dist": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && node scripts/build-dist-tsc.mjs tsconfig.dist.json && npm run bundle:dist",
19
- "bundle:dist": "node scripts/bundle-dist.mjs",
20
- "prepare": "npm run build:dist && node scripts/download-grammars.js --core --dest grammars && node scripts/setup-git-hooks.mjs && node scripts/warm-loader-cache.mjs",
21
- "prepack": "node scripts/strip-dev-deps-for-pack.mjs --strip",
22
- "postpack": "node scripts/strip-dev-deps-for-pack.mjs --restore",
23
- "lint": "tsc --project tsconfig.json && npm run lint:js && npm run lint:js:tests",
24
- "lint:js": "oxlint --deny-warnings --import-plugin --promise-plugin -D block-scoped-var -D import/default -D import/namespace -D import/no-absolute-path -D import/no-empty-named-blocks -D import/no-named-as-default -D import/no-self-import -D no-extend-native -D no-extra-bind -D no-implied-eval -D no-new -D no-unexpected-multiline -D no-useless-constructor -D oxc/approx-constant -D oxc/misrefactored-assign-op -D oxc/no-accumulating-spread -D oxc/no-async-endpoint-handlers -D oxc/no-this-in-exported-function -D promise/no-callback-in-promise -D promise/no-multiple-resolved -D promise/no-new-statics -D promise/valid-params -D typescript/no-confusing-non-null-assertion -D typescript/no-extraneous-class -D typescript/no-unnecessary-type-constraint -D typescript/no-unsafe-enum-comparison -D unicorn/no-accessor-recursion -D unicorn/no-array-fill-with-reference-type -D unicorn/no-confusing-array-with -D unicorn/no-instanceof-builtins -D unicorn/prefer-array-flat-map -D unicorn/require-module-specifiers --ignore-pattern \"tests/**/*.ts\" --ignore-pattern \"tests/**/*.tsx\" --ignore-pattern \"**/*.d.mts\" --ignore-pattern \"tests/fixtures/autofix-smoke/**\" --ignore-pattern \"tests/fixtures/format-smoke/**\" --ignore-pattern \"tests/fixtures/tool-smoke/**\" --ignore-pattern \"tests/fixtures/call-graph/javascript/**\" --ignore-pattern \"tests/fixtures/function-facts/javascript-parameter.js\" .",
25
- "lint:js:advisory": "node scripts/lint-js-advisory.mjs --deny-warnings --format unix -D correctness -D suspicious -D perf --import-plugin --promise-plugin --type-aware -A no-underscore-dangle -A no-await-in-loop -A unicorn/no-array-sort -A unicorn/consistent-function-scoping -A promise/no-promise-in-callback -A no-useless-call -A import/no-unassigned-import -A no-unmodified-loop-condition --ignore-pattern \"**/*.d.mts\" --ignore-pattern \"tests/fixtures/autofix-smoke/**\" --ignore-pattern \"tests/fixtures/format-smoke/**\" --ignore-pattern \"tests/fixtures/tool-smoke/**\" --ignore-pattern \"tests/fixtures/call-graph/javascript/**\" --ignore-pattern \"tests/fixtures/function-facts/javascript-parameter.js\" .",
26
- "lint:js:tests": "node scripts/lint-js-advisory.mjs --deny-warnings --format unix --type-aware -A correctness -A suspicious -A perf --ignore-pattern \"tests/fixtures/**\" tests",
27
- "depcruise:check": "depcruise --validate --config .dependency-cruiser.cjs --ignore-known .dependency-cruiser-known-violations.json --output-type err index.ts \"clients/**/*.ts\"",
28
- "fmt": "oxfmt",
29
- "fmt:check": "oxfmt --check",
30
- "taplo": "taplo check $(git ls-files '*.toml' ':!tests/fixtures/**') && taplo fmt --check $(git ls-files '*.toml' ':!tests/fixtures/**' ':!config/ruff/core.toml') # taplo 0.7.0 panics on this file's comments; lint it above",
31
- "watch": "tsc --watch",
32
- "test": "node scripts/with-test-lock.mjs -- vitest run",
33
- "test:unit": "node scripts/with-test-lock.mjs -- vitest run",
34
- "test:integration": "node scripts/with-test-lock.mjs -- vitest run tests/index-integration.test.ts tests/clients/lsp/integration.test.ts",
35
- "test:targeted": "node scripts/with-test-lock.mjs --shared -- vitest run",
36
- "test:watch": "vitest",
37
- "test:real-harness": "node scripts/with-test-lock.mjs --shared -- vitest run",
38
- "mutation:diff": "node scripts/stryker-diff.mjs --base origin/master --max-files 6",
39
- "hygiene": "node scripts/prune-agent-worktrees.mjs",
40
- "check": "node scripts/check-extensions.mjs",
41
- "selftest:install": "node scripts/install-selftest.mjs",
42
- "check:lockfile": "node scripts/check-lockfile-sync.mjs",
43
- "preflight": "node scripts/pr-preflight.mjs",
44
- "knip": "node scripts/run-knip.mjs",
45
- "check:grammars": "node scripts/check-grammar-provenance.mjs",
46
- "check:grammar-load": "node scripts/check-grammar-load.mjs",
47
- "audit:tree-sitter": "node scripts/audit-tree-sitter-rules.mjs",
48
- "audit:rule-catalog": "node scripts/validate-rule-catalog.mjs",
49
- "audit:astgrep-rule-pairs": "node scripts/audit-astgrep-rule-pairs.mjs",
50
- "astgrep:self-scan": "node scripts/run-astgrep-pi-lens.mjs",
51
- "astgrep:self-scan:update-baseline": "node scripts/run-astgrep-pi-lens.mjs --update-baseline",
52
- "audit:playground": "node scripts/playground-verify-rule.mjs",
53
- "bench:cascade-budget": "node scripts/bench-cascade-budget.mjs",
54
- "bench:word-index-replacement": "node scripts/bench-word-index-replacement.mjs",
55
- "logs:smells": "node scripts/analyze-pi-lens-logs.mjs",
56
- "complexity": "node scripts/complexity-report.mjs",
57
- "changelog:check": "node scripts/rollup-changelog.mjs --check",
58
- "test:regen": "node scripts/regen-test-baseline.mjs",
59
- "changelog:release": "node scripts/changelog-release.mjs",
60
- "changelog:extract": "node scripts/changelog-extract.mjs",
61
- "release:backfill-notes": "node scripts/backfill-github-releases.mjs",
62
- "release:backfill-thanks": "node scripts/backfill-release-thanks.mjs",
63
- "docs:rule-catalogs": "node scripts/gen-rule-catalogs.mjs",
64
- "banner": "npx -y sharp-cli --input banner.svg --output banner.png resize 2200 620",
65
- "download-grammars": "node scripts/download-grammars.js",
66
- "harness:poc": "node scripts/run-harness.mjs cases/ts/pipeline-dispatch-poc",
67
- "harness:python-poc": "node scripts/run-harness.mjs cases/python/pipeline-dispatch-poc",
68
- "harness:ts-format-poc": "node scripts/run-harness.mjs cases/ts/format-default-poc",
69
- "harness:python-autofix-poc": "node scripts/run-harness.mjs cases/python/autofix-default-poc",
70
- "harness:go-poc": "node scripts/run-harness.mjs cases/go/pipeline-dispatch-poc"
71
- },
72
- "keywords": [
73
- "pi",
74
- "pi-extension",
75
- "pi-package",
76
- "linter",
77
- "biome",
78
- "ast-grep",
79
- "ruff",
80
- "typescript",
81
- "code-quality",
82
- "feedback",
83
- "type-coverage",
84
- "jscpd",
85
- "knip"
86
- ],
87
- "author": "Apostolos Mantzaris",
88
- "license": "MIT",
89
- "engines": {
90
- "node": ">=22.19.0"
91
- },
92
- "packageManager": "npm@11.18.0",
93
- "files": [
94
- "dist/",
95
- "docs/",
96
- "grammars/",
97
- "vendor/grammars/",
98
- "config/",
99
- "rules/",
100
- "skills/",
101
- "scripts/download-grammars.js",
102
- "scripts/grammars.lock.json",
103
- "scripts/analyze-pi-lens-logs.mjs",
104
- "scripts/install-selftest.mjs",
105
- "scripts/lib/host-provided-deps.mjs",
106
- "scripts/lib/skills-predicate.mjs",
107
- "scripts/lib/web-tree-sitter-dir.mjs",
108
- "scripts/lib/warm-loader-cache.mjs",
109
- "scripts/warm-loader-cache.mjs",
110
- "scripts/rpc-load-check.mjs",
111
- "README.md",
112
- "CHANGELOG.md",
113
- "banner.svg",
114
- "banner.png"
115
- ],
116
- "dependencies": {
117
- "@ast-grep/cli": "^0.45.0",
118
- "@ast-grep/napi": "^0.45.0",
119
- "js-yaml": "^5.2.2",
120
- "minimatch": "^10.2.6",
121
- "pidusage": "^4.0.1",
122
- "vscode-jsonrpc": "^9.0.0"
123
- },
124
- "peerDependencies": {
125
- "@earendil-works/pi-coding-agent": "*",
126
- "@earendil-works/pi-tui": "^0.84.1 || ^0.85.0",
127
- "typebox": "^1.0.0"
128
- },
129
- "peerDependenciesMeta": {
130
- "@earendil-works/pi-coding-agent": {
131
- "optional": true
132
- },
133
- "@earendil-works/pi-tui": {
134
- "optional": true
135
- },
136
- "typebox": {
137
- "optional": true
138
- }
139
- },
140
- "optionalDependencies": {
141
- "jiti": "^2.7.0",
142
- "web-tree-sitter": "0.25.10"
143
- },
144
- "pi": {
145
- "extensions": [
146
- "./dist/index.js"
147
- ],
148
- "skills": [
149
- "./skills"
150
- ]
151
- },
152
- "allowScripts": {
153
- "@ast-grep/cli@0.45.3": true,
154
- "@google/genai@1.52.0": true,
155
- "protobufjs@7.6.5": true
156
- },
157
- "overrides": {
158
- "qs": "^6.15.4"
159
- }
2
+ "name": "pi-lens",
3
+ "version": "4.3.0",
4
+ "type": "module",
5
+ "description": "Real-time code feedback for pi — LSP, linters, formatters, type-checking, structural analysis & booboo",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/apmantza/pi-lens.git"
9
+ },
10
+ "main": "./dist/index.js",
11
+ "bin": {
12
+ "pi-lens": "dist/mcp/cli.js",
13
+ "pi-lens-mcp": "dist/mcp/server.js",
14
+ "pi-lens-analyze": "dist/mcp/analyze-cli.js"
15
+ },
16
+ "scripts": {
17
+ "build": "tsc --project tsconfig.build.json",
18
+ "build:dist": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && node scripts/build-dist-tsc.mjs tsconfig.dist.json && npm run bundle:dist",
19
+ "bundle:dist": "node scripts/bundle-dist.mjs",
20
+ "prepare": "npm run build:dist && node scripts/download-grammars.js --core --dest grammars && node scripts/setup-git-hooks.mjs && node scripts/warm-loader-cache.mjs",
21
+ "prepack": "node scripts/strip-dev-deps-for-pack.mjs --strip",
22
+ "postpack": "node scripts/strip-dev-deps-for-pack.mjs --restore",
23
+ "lint": "tsc --project tsconfig.json && npm run lint:js && npm run lint:js:tests",
24
+ "lint:js": "oxlint --deny-warnings --import-plugin --promise-plugin -D block-scoped-var -D import/default -D import/namespace -D import/no-absolute-path -D import/no-empty-named-blocks -D import/no-named-as-default -D import/no-self-import -D no-extend-native -D no-extra-bind -D no-implied-eval -D no-new -D no-unexpected-multiline -D no-useless-constructor -D oxc/approx-constant -D oxc/misrefactored-assign-op -D oxc/no-accumulating-spread -D oxc/no-async-endpoint-handlers -D oxc/no-this-in-exported-function -D promise/no-callback-in-promise -D promise/no-multiple-resolved -D promise/no-new-statics -D promise/valid-params -D typescript/no-confusing-non-null-assertion -D typescript/no-extraneous-class -D typescript/no-unnecessary-type-constraint -D typescript/no-unsafe-enum-comparison -D unicorn/no-accessor-recursion -D unicorn/no-array-fill-with-reference-type -D unicorn/no-confusing-array-with -D unicorn/no-instanceof-builtins -D unicorn/prefer-array-flat-map -D unicorn/require-module-specifiers --ignore-pattern \"tests/**/*.ts\" --ignore-pattern \"tests/**/*.tsx\" --ignore-pattern \"**/*.d.mts\" --ignore-pattern \"tests/fixtures/autofix-smoke/**\" --ignore-pattern \"tests/fixtures/format-smoke/**\" --ignore-pattern \"tests/fixtures/tool-smoke/**\" --ignore-pattern \"tests/fixtures/call-graph/javascript/**\" --ignore-pattern \"tests/fixtures/function-facts/javascript-parameter.js\" .",
25
+ "lint:js:advisory": "node scripts/lint-js-advisory.mjs --deny-warnings --format unix -D correctness -D suspicious -D perf --import-plugin --promise-plugin --type-aware -A no-underscore-dangle -A no-await-in-loop -A unicorn/no-array-sort -A unicorn/consistent-function-scoping -A promise/no-promise-in-callback -A no-useless-call -A import/no-unassigned-import -A no-unmodified-loop-condition --ignore-pattern \"**/*.d.mts\" --ignore-pattern \"tests/fixtures/autofix-smoke/**\" --ignore-pattern \"tests/fixtures/format-smoke/**\" --ignore-pattern \"tests/fixtures/tool-smoke/**\" --ignore-pattern \"tests/fixtures/call-graph/javascript/**\" --ignore-pattern \"tests/fixtures/function-facts/javascript-parameter.js\" .",
26
+ "lint:js:tests": "node scripts/lint-js-advisory.mjs --deny-warnings --format unix --type-aware -A correctness -A suspicious -A perf --ignore-pattern \"tests/fixtures/**\" tests",
27
+ "depcruise:check": "depcruise --validate --config .dependency-cruiser.cjs --ignore-known .dependency-cruiser-known-violations.json --output-type err index.ts \"clients/**/*.ts\"",
28
+ "fmt": "oxfmt",
29
+ "fmt:check": "oxfmt --check",
30
+ "taplo": "taplo check $(git ls-files '*.toml' ':!tests/fixtures/**') && taplo fmt --check $(git ls-files '*.toml' ':!tests/fixtures/**' ':!config/ruff/core.toml') # taplo 0.7.0 panics on this file's comments; lint it above",
31
+ "watch": "tsc --watch",
32
+ "test": "node scripts/with-test-lock.mjs -- vitest run",
33
+ "test:unit": "node scripts/with-test-lock.mjs -- vitest run",
34
+ "test:integration": "node scripts/with-test-lock.mjs -- vitest run tests/index-integration.test.ts tests/clients/lsp/integration.test.ts",
35
+ "test:targeted": "node scripts/with-test-lock.mjs --shared -- vitest run",
36
+ "test:watch": "vitest",
37
+ "test:real-harness": "node scripts/with-test-lock.mjs --shared -- vitest run",
38
+ "mutation:diff": "node scripts/stryker-diff.mjs --base origin/master --max-files 6",
39
+ "hygiene": "node scripts/prune-agent-worktrees.mjs",
40
+ "check": "node scripts/check-extensions.mjs",
41
+ "selftest:install": "node scripts/install-selftest.mjs",
42
+ "check:lockfile": "node scripts/check-lockfile-sync.mjs",
43
+ "preflight": "node scripts/pr-preflight.mjs",
44
+ "knip": "node scripts/run-knip.mjs",
45
+ "check:grammars": "node scripts/check-grammar-provenance.mjs",
46
+ "check:grammar-load": "node scripts/check-grammar-load.mjs",
47
+ "audit:tree-sitter": "node scripts/audit-tree-sitter-rules.mjs",
48
+ "audit:rule-catalog": "node scripts/validate-rule-catalog.mjs",
49
+ "audit:astgrep-rule-pairs": "node scripts/audit-astgrep-rule-pairs.mjs",
50
+ "astgrep:self-scan": "node scripts/run-astgrep-pi-lens.mjs",
51
+ "astgrep:self-scan:update-baseline": "node scripts/run-astgrep-pi-lens.mjs --update-baseline",
52
+ "audit:playground": "node scripts/playground-verify-rule.mjs",
53
+ "bench:cascade-budget": "node scripts/bench-cascade-budget.mjs",
54
+ "bench:word-index-replacement": "node scripts/bench-word-index-replacement.mjs",
55
+ "logs:smells": "node scripts/analyze-pi-lens-logs.mjs",
56
+ "complexity": "node scripts/complexity-report.mjs",
57
+ "changelog:check": "node scripts/rollup-changelog.mjs --check",
58
+ "test:regen": "node scripts/regen-test-baseline.mjs",
59
+ "changelog:release": "node scripts/changelog-release.mjs",
60
+ "changelog:extract": "node scripts/changelog-extract.mjs",
61
+ "release:backfill-notes": "node scripts/backfill-github-releases.mjs",
62
+ "release:backfill-thanks": "node scripts/backfill-release-thanks.mjs",
63
+ "docs:rule-catalogs": "node scripts/gen-rule-catalogs.mjs",
64
+ "banner": "npx -y sharp-cli --input banner.svg --output banner.png resize 2200 620",
65
+ "download-grammars": "node scripts/download-grammars.js",
66
+ "harness:poc": "node scripts/run-harness.mjs cases/ts/pipeline-dispatch-poc",
67
+ "harness:python-poc": "node scripts/run-harness.mjs cases/python/pipeline-dispatch-poc",
68
+ "harness:ts-format-poc": "node scripts/run-harness.mjs cases/ts/format-default-poc",
69
+ "harness:python-autofix-poc": "node scripts/run-harness.mjs cases/python/autofix-default-poc",
70
+ "harness:go-poc": "node scripts/run-harness.mjs cases/go/pipeline-dispatch-poc"
71
+ },
72
+ "keywords": [
73
+ "pi",
74
+ "pi-extension",
75
+ "pi-package",
76
+ "linter",
77
+ "biome",
78
+ "ast-grep",
79
+ "ruff",
80
+ "typescript",
81
+ "code-quality",
82
+ "feedback",
83
+ "type-coverage",
84
+ "jscpd",
85
+ "knip"
86
+ ],
87
+ "author": "Apostolos Mantzaris",
88
+ "license": "MIT",
89
+ "engines": {
90
+ "node": ">=22.19.0"
91
+ },
92
+ "packageManager": "npm@11.18.0",
93
+ "files": [
94
+ "dist/",
95
+ "docs/",
96
+ "grammars/",
97
+ "vendor/grammars/",
98
+ "config/",
99
+ "rules/",
100
+ "skills/",
101
+ "scripts/download-grammars.js",
102
+ "scripts/grammars.lock.json",
103
+ "scripts/analyze-pi-lens-logs.mjs",
104
+ "scripts/install-selftest.mjs",
105
+ "scripts/lib/host-provided-deps.mjs",
106
+ "scripts/lib/skills-predicate.mjs",
107
+ "scripts/lib/web-tree-sitter-dir.mjs",
108
+ "scripts/lib/warm-loader-cache.mjs",
109
+ "scripts/warm-loader-cache.mjs",
110
+ "scripts/rpc-load-check.mjs",
111
+ "README.md",
112
+ "CHANGELOG.md",
113
+ "banner.svg",
114
+ "banner.png"
115
+ ],
116
+ "dependencies": {
117
+ "@ast-grep/cli": "^0.45.0",
118
+ "@ast-grep/napi": "^0.45.0",
119
+ "js-yaml": "^5.2.2",
120
+ "minimatch": "^10.2.6",
121
+ "pidusage": "^4.0.1",
122
+ "vscode-jsonrpc": "^9.0.0"
123
+ },
124
+ "peerDependencies": {
125
+ "@earendil-works/pi-coding-agent": "*",
126
+ "@earendil-works/pi-tui": "*",
127
+ "typebox": "*"
128
+ },
129
+ "peerDependenciesMeta": {
130
+ "@earendil-works/pi-coding-agent": {
131
+ "optional": true
132
+ },
133
+ "@earendil-works/pi-tui": {
134
+ "optional": true
135
+ },
136
+ "typebox": {
137
+ "optional": true
138
+ }
139
+ },
140
+ "optionalDependencies": {
141
+ "jiti": "^2.7.0",
142
+ "web-tree-sitter": "0.25.10"
143
+ },
144
+ "pi": {
145
+ "extensions": [
146
+ "./dist/index.js"
147
+ ],
148
+ "skills": [
149
+ "./skills"
150
+ ]
151
+ },
152
+ "allowScripts": {
153
+ "@ast-grep/cli@0.45.3": true,
154
+ "@google/genai@1.52.0": true,
155
+ "protobufjs@7.6.5": true
156
+ },
157
+ "overrides": {
158
+ "qs": "^6.15.4"
159
+ }
160
160
  }
@@ -78,7 +78,8 @@
78
78
  "access": "public"
79
79
  },
80
80
  "peerDependencies": {
81
- "@earendil-works/pi-coding-agent": ">=0.85.1 <0.88.0"
81
+ "@earendil-works/pi-coding-agent": "*",
82
+ "@earendil-works/pi-ai": "*"
82
83
  },
83
84
  "devDependencies": {
84
85
  "@earendil-works/pi-coding-agent": "0.85.1",
@@ -93,7 +94,6 @@
93
94
  },
94
95
  "dependencies": {
95
96
  "@bufbuild/protobuf": "^2.14.0",
96
- "@earendil-works/pi-ai": ">=0.85.1 <0.88.0",
97
97
  "proper-lockfile": "4.1.2"
98
98
  },
99
99
  "overrides": {
@@ -140,7 +140,7 @@ if (!answer.ok) return { skipped: answer.errorCode === "budget" }; // never thr
140
140
 
141
141
  Your extension owns its own user consent and budget; `/typesafe enable` applies only to this package's tool. Check `authState()` rather than your own consent flag before you report that judgments are on.
142
142
 
143
- Judgments can also go through OpenRouter: `createTypeSafe({ backend: "openrouter" })` sends them to `openrouter.ai` with the key from `OPENROUTER_API_KEY`. That backend has no login store, so `/typesafe login` does not apply to it. Pass the same `backend` to `authState`, `keySituation`, and `ensureApiKey`, or the status you report describes the TypeSafe key while the requests use another one. The `/typesafe` commands and the `typesafe_evaluate` tool always use the TypeSafe backend. Every export — the client, `ask`, batching, the usage ledger, auth state, and the `pi-typesafe/calibrate` and `pi-typesafe/ui` entry points — is in [docs/api.md](docs/api.md).
143
+ Judgments can also go through OpenRouter: `createTypeSafe({ backend: "openrouter" })` sends them to `openrouter.ai` with the key from `OPENROUTER_API_KEY`. Command Code serves the same protocol: `createTypeSafe({ backend: "commandcode" })` sends them to `api.commandcode.ai` with the key from `COMMANDCODE_API_KEY` and the model `typesafe/jev`. Or pass a `BackendEndpoint` object as `backend` to name any host that serves the protocol: it brings its own key variable, never reads `TYPESAFE_API_KEY`, and `backendHost()` reports its destination host for your consent text. These backends have no login store, so `/typesafe login` does not apply to them. Pass the same `backend` to `authState`, `keySituation`, and `ensureApiKey`, or the status you report describes the TypeSafe key while the requests use another one. The `/typesafe` commands and the `typesafe_evaluate` tool always use the TypeSafe backend. Every export — the client, `ask`, batching, the usage ledger, auth state, and the `pi-typesafe/calibrate` and `pi-typesafe/ui` entry points — is in [docs/api.md](docs/api.md).
144
144
 
145
145
  ## Development
146
146
 
@@ -1,4 +1,4 @@
1
- import type { TypeSafeBackend } from "./backends.js";
1
+ import type { BackendSpec } from "./backends.js";
2
2
  import type { KeySource } from "./credentials.js";
3
3
  import { TypeSafeIntegrationError } from "./errors.js";
4
4
  import type { IntegrationErrorCode } from "./errors.js";
@@ -15,8 +15,8 @@ export interface AuthFailure {
15
15
  * that judgments will happen — an enabled extension with no key used to look identical to a working one.
16
16
  */
17
17
  export interface AuthState {
18
- /** The judgment backend this state describes; each backend has its own key. */
19
- readonly backend: TypeSafeBackend;
18
+ /** The judgment backend this state describes; each backend has its own key. Holds the value the caller passed. */
19
+ readonly backend: BackendSpec;
20
20
  /** Same kinds as KeySituation: where the key in effect comes from. */
21
21
  readonly kind: "environment" | "stored" | "missing" | "unusable";
22
22
  readonly source?: KeySource;
@@ -39,10 +39,14 @@ export interface AuthState {
39
39
  }
40
40
  /** The auth-state file: one small, owner-only record that outlives the process that wrote it. */
41
41
  export declare function authStatePath(): string;
42
- /** What the key situation, the last outcome, and the clock add up to for one backend. Never throws. */
42
+ /**
43
+ * What the key situation, the last outcome, and the clock add up to for a valid backend; it never throws for one. An
44
+ * invalid backend throws the same `configuration` error as resolveBackend(), so validate a user-supplied endpoint
45
+ * with resolveBackend() first.
46
+ */
43
47
  export declare function authState(options?: {
44
48
  path?: string;
45
- backend?: TypeSafeBackend;
49
+ backend?: BackendSpec;
46
50
  }): AuthState;
47
51
  /** Record that the key was accepted: login verification, or any successful request. Clears the last failure. */
48
52
  export declare function recordAuthVerified(at?: Date): void;
@@ -1,6 +1,6 @@
1
1
  import { chmodSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
- import { DEFAULT_BACKEND, TYPESAFE_KEY_ENV, backendConfig, usesTypesafeKey } from "./backends.js";
3
+ import { DEFAULT_BACKEND, TYPESAFE_KEY_ENV, resolveBackend, usesTypesafeKey } from "./backends.js";
4
4
  import { credentialsPath, keySituation, keySourceLabel, piTypesafeDir } from "./credentials.js";
5
5
  import { TypeSafeIntegrationError } from "./errors.js";
6
6
  const AUTH_VERSION = 1;
@@ -50,7 +50,11 @@ function writeState(path, state) {
50
50
  catch { /* best-effort cleanup only */ }
51
51
  }
52
52
  }
53
- /** What the key situation, the last outcome, and the clock add up to for one backend. Never throws. */
53
+ /**
54
+ * What the key situation, the last outcome, and the clock add up to for a valid backend; it never throws for one. An
55
+ * invalid backend throws the same `configuration` error as resolveBackend(), so validate a user-supplied endpoint
56
+ * with resolveBackend() first.
57
+ */
54
58
  export function authState(options = {}) {
55
59
  const path = options.path ?? authStatePath();
56
60
  const backend = options.backend ?? DEFAULT_BACKEND;
@@ -99,7 +103,7 @@ export function clearAuthState() {
99
103
  * state instead of reporting "enabled".
100
104
  */
101
105
  export function describeAuth(state = authState()) {
102
- const config = backendConfig(state.backend ?? DEFAULT_BACKEND);
106
+ const config = resolveBackend(state.backend);
103
107
  const label = `${config.label} key`;
104
108
  const since = state.lastFailure ? ` Last failure: ${state.lastFailure.message}${state.lastFailure.at ? ` (${state.lastFailure.at})` : ""}` : "";
105
109
  if (state.kind === "missing") {
@@ -1,6 +1,6 @@
1
- export type TypeSafeBackend = "typesafe" | "openrouter";
1
+ export type TypeSafeBackend = "typesafe" | "openrouter" | "commandcode";
2
2
  export interface BackendConfig {
3
- /** Human name for status lines: "TypeSafe", "OpenRouter". */
3
+ /** Human name for status lines: "TypeSafe", "OpenRouter", "Command Code". */
4
4
  label: string;
5
5
  host: string;
6
6
  /** The environment variable that carries this backend's key. Absent means the TypeSafe key resolution applies. */
@@ -16,11 +16,32 @@ export interface BackendConfig {
16
16
  /** Whether the model list checks the key. A public list accepts any key, so it proves nothing. Absent means it does. */
17
17
  modelsVerifyKey?: boolean;
18
18
  }
19
+ /** A caller-supplied endpoint that serves the Jev decisions protocol. Passed per call; never added to the registry. */
20
+ export interface BackendEndpoint extends BackendConfig {
21
+ /** Required. The environment variable with this endpoint's key. Must not be TYPESAFE_API_KEY. */
22
+ readonly keyEnv: string;
23
+ /** Model sent when the caller names none. Without it, `model` must be passed to createTypeSafe. */
24
+ readonly defaultModel?: string;
25
+ }
26
+ /** A registry name or a caller-supplied endpoint. */
27
+ export type BackendSpec = TypeSafeBackend | BackendEndpoint;
28
+ /** A backend resolved and validated: what the client will actually use. */
29
+ export interface ResolvedBackend extends BackendConfig {
30
+ /** Registry name, absent for a caller-supplied endpoint. */
31
+ readonly name?: TypeSafeBackend;
32
+ /** Origin only: scheme, host, and port. */
33
+ readonly host: string;
34
+ readonly keyEnv: string;
35
+ /** The model id sent when the caller names none, already in the backend's form. Absent when the endpoint names none. */
36
+ readonly defaultModel?: string;
37
+ /** Always explicit after resolution. */
38
+ readonly modelsVerifyKey: boolean;
39
+ }
19
40
  /** The backend every key and auth function assumes when none is named. */
20
41
  export declare const DEFAULT_BACKEND: TypeSafeBackend;
21
42
  /** The environment variable and login store that the default backend reads. */
22
43
  export declare const TYPESAFE_KEY_ENV = "TYPESAFE_API_KEY";
23
- /** Registry of known judgment backends. Extendable by callers. */
44
+ /** Registry of known judgment backends. Callers pass a `BackendEndpoint` for a host this registry does not name. */
24
45
  export declare const DECISIONS_BACKENDS: Record<TypeSafeBackend, BackendConfig>;
25
46
  /** The registry entry for a backend name; a `configuration` error for a name the registry does not know. */
26
47
  export declare function backendConfig(name: TypeSafeBackend): BackendConfig;
@@ -39,3 +60,12 @@ export declare function defaultModelId(backend: TypeSafeBackend): string;
39
60
  * its own environment variable. Only the TypeSafe backend has a login store; every other backend is environment-only.
40
61
  */
41
62
  export declare function usesTypesafeKey(backend: BackendConfig): boolean;
63
+ /**
64
+ * Resolve a registry name or a caller-supplied endpoint into the validated form the client uses. A name resolves to
65
+ * its registry entry unchanged; an endpoint is validated field by field and returned as a fresh object whose `host`
66
+ * is origin-only. Messages never quote a caller value — a host can carry credentials in its user info — except the
67
+ * label, and only after it is validated. Validation runs on every call; nothing is cached.
68
+ */
69
+ export declare function resolveBackend(backend?: BackendSpec): ResolvedBackend;
70
+ /** The destination host only — scheme, host, and port, e.g. `api.commandcode.ai` — for consent text. */
71
+ export declare function backendHost(backend?: BackendSpec): string;