@herbertgao/pi-extensions 2026.9.16 → 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 (267) 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/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/extension.ts +11 -53
  11. package/node_modules/@juicesharp/rpiv-ask-user-question/package.json +99 -99
  12. package/node_modules/@pi-plugins/fast-mode/package.json +1 -1
  13. package/node_modules/@tifan/pi-handoff/package.json +1 -1
  14. package/node_modules/@tifan/pi-handoff/src/index.ts +56 -26
  15. package/node_modules/@tifan/pi-mermaid-open/package.json +1 -1
  16. package/node_modules/@tifan/pi-preferred-thinking/package.json +1 -1
  17. package/node_modules/@tifan/pi-recap/package.json +1 -1
  18. package/node_modules/@tifan/pi-rename/package.json +1 -1
  19. package/node_modules/pi-antigravity/package.json +2 -2
  20. package/node_modules/pi-lens/package.json +158 -158
  21. package/node_modules/pi-multi-account/package.json +2 -2
  22. package/node_modules/pi-typesafe/README.md +1 -1
  23. package/node_modules/pi-typesafe/dist/auth.d.ts +9 -5
  24. package/node_modules/pi-typesafe/dist/auth.js +7 -3
  25. package/node_modules/pi-typesafe/dist/backends.d.ts +33 -3
  26. package/node_modules/pi-typesafe/dist/backends.js +95 -1
  27. package/node_modules/pi-typesafe/dist/client.d.ts +5 -5
  28. package/node_modules/pi-typesafe/dist/client.js +12 -9
  29. package/node_modules/pi-typesafe/dist/credentials.d.ts +14 -8
  30. package/node_modules/pi-typesafe/dist/credentials.js +10 -7
  31. package/node_modules/pi-typesafe/dist/errors.d.ts +2 -2
  32. package/node_modules/pi-typesafe/dist/index.d.ts +2 -2
  33. package/node_modules/pi-typesafe/dist/index.js +1 -1
  34. package/node_modules/pi-typesafe/dist/login.d.ts +2 -2
  35. package/node_modules/pi-typesafe/dist/login.js +2 -2
  36. package/node_modules/pi-typesafe/package.json +5 -5
  37. package/node_modules/pi-web-access/package.json +2 -2
  38. package/node_modules/remote-pi/package.json +5 -1
  39. package/package.json +16 -28
  40. package/node_modules/pi-mcp-adapter/CHANGELOG.md +0 -1013
  41. package/node_modules/pi-mcp-adapter/LICENSE +0 -21
  42. package/node_modules/pi-mcp-adapter/OAUTH.md +0 -369
  43. package/node_modules/pi-mcp-adapter/README.md +0 -1021
  44. package/node_modules/pi-mcp-adapter/abort.ts +0 -34
  45. package/node_modules/pi-mcp-adapter/agent-dir.ts +0 -68
  46. package/node_modules/pi-mcp-adapter/agent-plugin-loader.ts +0 -416
  47. package/node_modules/pi-mcp-adapter/agent-plugin-provenance.ts +0 -36
  48. package/node_modules/pi-mcp-adapter/app-bridge.bundle.js +0 -67
  49. package/node_modules/pi-mcp-adapter/banner.png +0 -0
  50. package/node_modules/pi-mcp-adapter/bearer-command-resolver.ts +0 -193
  51. package/node_modules/pi-mcp-adapter/claude-plugin-loader.ts +0 -365
  52. package/node_modules/pi-mcp-adapter/cli.js +0 -454
  53. package/node_modules/pi-mcp-adapter/commands.ts +0 -861
  54. package/node_modules/pi-mcp-adapter/config.ts +0 -1565
  55. package/node_modules/pi-mcp-adapter/consent-manager.ts +0 -95
  56. package/node_modules/pi-mcp-adapter/direct-tool-surface.ts +0 -244
  57. package/node_modules/pi-mcp-adapter/direct-tools.ts +0 -428
  58. package/node_modules/pi-mcp-adapter/dist/abort.d.ts +0 -2
  59. package/node_modules/pi-mcp-adapter/dist/abort.js +0 -36
  60. package/node_modules/pi-mcp-adapter/dist/abort.js.map +0 -1
  61. package/node_modules/pi-mcp-adapter/dist/agent-dir.d.ts +0 -10
  62. package/node_modules/pi-mcp-adapter/dist/agent-dir.js +0 -63
  63. package/node_modules/pi-mcp-adapter/dist/agent-dir.js.map +0 -1
  64. package/node_modules/pi-mcp-adapter/dist/agent-plugin-loader.d.ts +0 -8
  65. package/node_modules/pi-mcp-adapter/dist/agent-plugin-loader.js +0 -398
  66. package/node_modules/pi-mcp-adapter/dist/agent-plugin-loader.js.map +0 -1
  67. package/node_modules/pi-mcp-adapter/dist/agent-plugin-provenance.d.ts +0 -1
  68. package/node_modules/pi-mcp-adapter/dist/agent-plugin-provenance.js +0 -31
  69. package/node_modules/pi-mcp-adapter/dist/agent-plugin-provenance.js.map +0 -1
  70. package/node_modules/pi-mcp-adapter/dist/bearer-command-resolver.d.ts +0 -6
  71. package/node_modules/pi-mcp-adapter/dist/bearer-command-resolver.js +0 -194
  72. package/node_modules/pi-mcp-adapter/dist/bearer-command-resolver.js.map +0 -1
  73. package/node_modules/pi-mcp-adapter/dist/claude-plugin-loader.d.ts +0 -9
  74. package/node_modules/pi-mcp-adapter/dist/claude-plugin-loader.js +0 -362
  75. package/node_modules/pi-mcp-adapter/dist/claude-plugin-loader.js.map +0 -1
  76. package/node_modules/pi-mcp-adapter/dist/config.d.ts +0 -134
  77. package/node_modules/pi-mcp-adapter/dist/config.js +0 -1361
  78. package/node_modules/pi-mcp-adapter/dist/config.js.map +0 -1
  79. package/node_modules/pi-mcp-adapter/dist/consent-manager.d.ts +0 -18
  80. package/node_modules/pi-mcp-adapter/dist/consent-manager.js +0 -88
  81. package/node_modules/pi-mcp-adapter/dist/consent-manager.js.map +0 -1
  82. package/node_modules/pi-mcp-adapter/dist/elicitation-handler.d.ts +0 -17
  83. package/node_modules/pi-mcp-adapter/dist/elicitation-handler.js +0 -316
  84. package/node_modules/pi-mcp-adapter/dist/elicitation-handler.js.map +0 -1
  85. package/node_modules/pi-mcp-adapter/dist/errors.d.ts +0 -131
  86. package/node_modules/pi-mcp-adapter/dist/errors.js +0 -278
  87. package/node_modules/pi-mcp-adapter/dist/errors.js.map +0 -1
  88. package/node_modules/pi-mcp-adapter/dist/http-ca.d.ts +0 -8
  89. package/node_modules/pi-mcp-adapter/dist/http-ca.js +0 -88
  90. package/node_modules/pi-mcp-adapter/dist/http-ca.js.map +0 -1
  91. package/node_modules/pi-mcp-adapter/dist/jev-client.d.ts +0 -14
  92. package/node_modules/pi-mcp-adapter/dist/jev-client.js +0 -367
  93. package/node_modules/pi-mcp-adapter/dist/jev-client.js.map +0 -1
  94. package/node_modules/pi-mcp-adapter/dist/jev-contracts.d.ts +0 -77
  95. package/node_modules/pi-mcp-adapter/dist/jev-contracts.js +0 -2
  96. package/node_modules/pi-mcp-adapter/dist/jev-contracts.js.map +0 -1
  97. package/node_modules/pi-mcp-adapter/dist/jev-key-store.d.ts +0 -51
  98. package/node_modules/pi-mcp-adapter/dist/jev-key-store.js +0 -205
  99. package/node_modules/pi-mcp-adapter/dist/jev-key-store.js.map +0 -1
  100. package/node_modules/pi-mcp-adapter/dist/json-schema-validator.d.ts +0 -2
  101. package/node_modules/pi-mcp-adapter/dist/json-schema-validator.js +0 -68
  102. package/node_modules/pi-mcp-adapter/dist/json-schema-validator.js.map +0 -1
  103. package/node_modules/pi-mcp-adapter/dist/lifecycle.d.ts +0 -56
  104. package/node_modules/pi-mcp-adapter/dist/lifecycle.js +0 -410
  105. package/node_modules/pi-mcp-adapter/dist/lifecycle.js.map +0 -1
  106. package/node_modules/pi-mcp-adapter/dist/logger.d.ts +0 -51
  107. package/node_modules/pi-mcp-adapter/dist/logger.js +0 -131
  108. package/node_modules/pi-mcp-adapter/dist/logger.js.map +0 -1
  109. package/node_modules/pi-mcp-adapter/dist/mcp-auth-fetch.d.ts +0 -26
  110. package/node_modules/pi-mcp-adapter/dist/mcp-auth-fetch.js +0 -103
  111. package/node_modules/pi-mcp-adapter/dist/mcp-auth-fetch.js.map +0 -1
  112. package/node_modules/pi-mcp-adapter/dist/mcp-auth-flow.d.ts +0 -118
  113. package/node_modules/pi-mcp-adapter/dist/mcp-auth-flow.js +0 -1097
  114. package/node_modules/pi-mcp-adapter/dist/mcp-auth-flow.js.map +0 -1
  115. package/node_modules/pi-mcp-adapter/dist/mcp-auth.d.ts +0 -170
  116. package/node_modules/pi-mcp-adapter/dist/mcp-auth.js +0 -1142
  117. package/node_modules/pi-mcp-adapter/dist/mcp-auth.js.map +0 -1
  118. package/node_modules/pi-mcp-adapter/dist/mcp-bearer-store.d.ts +0 -24
  119. package/node_modules/pi-mcp-adapter/dist/mcp-bearer-store.js +0 -203
  120. package/node_modules/pi-mcp-adapter/dist/mcp-bearer-store.js.map +0 -1
  121. package/node_modules/pi-mcp-adapter/dist/mcp-callback-server.d.ts +0 -53
  122. package/node_modules/pi-mcp-adapter/dist/mcp-callback-server.js +0 -441
  123. package/node_modules/pi-mcp-adapter/dist/mcp-callback-server.js.map +0 -1
  124. package/node_modules/pi-mcp-adapter/dist/mcp-oauth-provider.d.ts +0 -148
  125. package/node_modules/pi-mcp-adapter/dist/mcp-oauth-provider.js +0 -689
  126. package/node_modules/pi-mcp-adapter/dist/mcp-oauth-provider.js.map +0 -1
  127. package/node_modules/pi-mcp-adapter/dist/mcp-probe.d.ts +0 -6
  128. package/node_modules/pi-mcp-adapter/dist/mcp-probe.js +0 -166
  129. package/node_modules/pi-mcp-adapter/dist/mcp-probe.js.map +0 -1
  130. package/node_modules/pi-mcp-adapter/dist/mcp-tasks.d.ts +0 -102
  131. package/node_modules/pi-mcp-adapter/dist/mcp-tasks.js +0 -369
  132. package/node_modules/pi-mcp-adapter/dist/mcp-tasks.js.map +0 -1
  133. package/node_modules/pi-mcp-adapter/dist/mcp-trace.d.ts +0 -95
  134. package/node_modules/pi-mcp-adapter/dist/mcp-trace.js +0 -242
  135. package/node_modules/pi-mcp-adapter/dist/mcp-trace.js.map +0 -1
  136. package/node_modules/pi-mcp-adapter/dist/metadata-cache.d.ts +0 -19
  137. package/node_modules/pi-mcp-adapter/dist/metadata-cache.js +0 -301
  138. package/node_modules/pi-mcp-adapter/dist/metadata-cache.js.map +0 -1
  139. package/node_modules/pi-mcp-adapter/dist/npx-resolver.d.ts +0 -6
  140. package/node_modules/pi-mcp-adapter/dist/npx-resolver.js +0 -505
  141. package/node_modules/pi-mcp-adapter/dist/npx-resolver.js.map +0 -1
  142. package/node_modules/pi-mcp-adapter/dist/package-mcp-loader.d.ts +0 -2
  143. package/node_modules/pi-mcp-adapter/dist/package-mcp-loader.js +0 -144
  144. package/node_modules/pi-mcp-adapter/dist/package-mcp-loader.js.map +0 -1
  145. package/node_modules/pi-mcp-adapter/dist/request-headers-command.d.ts +0 -10
  146. package/node_modules/pi-mcp-adapter/dist/request-headers-command.js +0 -312
  147. package/node_modules/pi-mcp-adapter/dist/request-headers-command.js.map +0 -1
  148. package/node_modules/pi-mcp-adapter/dist/resource-tools.d.ts +0 -1
  149. package/node_modules/pi-mcp-adapter/dist/resource-tools.js +0 -15
  150. package/node_modules/pi-mcp-adapter/dist/resource-tools.js.map +0 -1
  151. package/node_modules/pi-mcp-adapter/dist/runtime-owner.d.ts +0 -13
  152. package/node_modules/pi-mcp-adapter/dist/runtime-owner.js +0 -97
  153. package/node_modules/pi-mcp-adapter/dist/runtime-owner.js.map +0 -1
  154. package/node_modules/pi-mcp-adapter/dist/sampling-handler.d.ts +0 -17
  155. package/node_modules/pi-mcp-adapter/dist/sampling-handler.js +0 -203
  156. package/node_modules/pi-mcp-adapter/dist/sampling-handler.js.map +0 -1
  157. package/node_modules/pi-mcp-adapter/dist/secure-keyring.d.ts +0 -11
  158. package/node_modules/pi-mcp-adapter/dist/secure-keyring.js +0 -172
  159. package/node_modules/pi-mcp-adapter/dist/secure-keyring.js.map +0 -1
  160. package/node_modules/pi-mcp-adapter/dist/server-manager.d.ts +0 -157
  161. package/node_modules/pi-mcp-adapter/dist/server-manager.js +0 -1745
  162. package/node_modules/pi-mcp-adapter/dist/server-manager.js.map +0 -1
  163. package/node_modules/pi-mcp-adapter/dist/session-approvals.d.ts +0 -34
  164. package/node_modules/pi-mcp-adapter/dist/session-approvals.js +0 -140
  165. package/node_modules/pi-mcp-adapter/dist/session-approvals.js.map +0 -1
  166. package/node_modules/pi-mcp-adapter/dist/session-recovery.d.ts +0 -26
  167. package/node_modules/pi-mcp-adapter/dist/session-recovery.js +0 -142
  168. package/node_modules/pi-mcp-adapter/dist/session-recovery.js.map +0 -1
  169. package/node_modules/pi-mcp-adapter/dist/state.d.ts +0 -73
  170. package/node_modules/pi-mcp-adapter/dist/state.js +0 -2
  171. package/node_modules/pi-mcp-adapter/dist/state.js.map +0 -1
  172. package/node_modules/pi-mcp-adapter/dist/types.d.ts +0 -642
  173. package/node_modules/pi-mcp-adapter/dist/types.js +0 -331
  174. package/node_modules/pi-mcp-adapter/dist/types.js.map +0 -1
  175. package/node_modules/pi-mcp-adapter/dist/ui-app-bridge-helpers.d.ts +0 -6
  176. package/node_modules/pi-mcp-adapter/dist/ui-app-bridge-helpers.js +0 -37
  177. package/node_modules/pi-mcp-adapter/dist/ui-app-bridge-helpers.js.map +0 -1
  178. package/node_modules/pi-mcp-adapter/dist/ui-resource-handler.d.ts +0 -17
  179. package/node_modules/pi-mcp-adapter/dist/ui-resource-handler.js +0 -219
  180. package/node_modules/pi-mcp-adapter/dist/ui-resource-handler.js.map +0 -1
  181. package/node_modules/pi-mcp-adapter/dist/ui-stream-types.d.ts +0 -104
  182. package/node_modules/pi-mcp-adapter/dist/ui-stream-types.js +0 -59
  183. package/node_modules/pi-mcp-adapter/dist/ui-stream-types.js.map +0 -1
  184. package/node_modules/pi-mcp-adapter/dist/ui-tool-visibility.d.ts +0 -4
  185. package/node_modules/pi-mcp-adapter/dist/ui-tool-visibility.js +0 -27
  186. package/node_modules/pi-mcp-adapter/dist/ui-tool-visibility.js.map +0 -1
  187. package/node_modules/pi-mcp-adapter/dist/unix-socket-transport.d.ts +0 -15
  188. package/node_modules/pi-mcp-adapter/dist/unix-socket-transport.js +0 -85
  189. package/node_modules/pi-mcp-adapter/dist/unix-socket-transport.js.map +0 -1
  190. package/node_modules/pi-mcp-adapter/dist/utils.d.ts +0 -41
  191. package/node_modules/pi-mcp-adapter/dist/utils.js +0 -417
  192. package/node_modules/pi-mcp-adapter/dist/utils.js.map +0 -1
  193. package/node_modules/pi-mcp-adapter/elicitation-handler.ts +0 -358
  194. package/node_modules/pi-mcp-adapter/error-signal.ts +0 -32
  195. package/node_modules/pi-mcp-adapter/errors.ts +0 -364
  196. package/node_modules/pi-mcp-adapter/examples/jev-accessibility-loop.mjs +0 -85
  197. package/node_modules/pi-mcp-adapter/examples/jev-semantic-filter.mjs +0 -34
  198. package/node_modules/pi-mcp-adapter/failure-backoff.ts +0 -23
  199. package/node_modules/pi-mcp-adapter/glimpse-ui.ts +0 -80
  200. package/node_modules/pi-mcp-adapter/host-html-template.ts +0 -515
  201. package/node_modules/pi-mcp-adapter/http-ca.ts +0 -84
  202. package/node_modules/pi-mcp-adapter/index.ts +0 -2106
  203. package/node_modules/pi-mcp-adapter/init.ts +0 -721
  204. package/node_modules/pi-mcp-adapter/jev-client.ts +0 -300
  205. package/node_modules/pi-mcp-adapter/jev-contracts.ts +0 -53
  206. package/node_modules/pi-mcp-adapter/jev-key-store.ts +0 -192
  207. package/node_modules/pi-mcp-adapter/json-schema-validator.ts +0 -83
  208. package/node_modules/pi-mcp-adapter/lazy-loader.ts +0 -7
  209. package/node_modules/pi-mcp-adapter/lifecycle.ts +0 -457
  210. package/node_modules/pi-mcp-adapter/logger.ts +0 -169
  211. package/node_modules/pi-mcp-adapter/mcp-auth-fetch.ts +0 -113
  212. package/node_modules/pi-mcp-adapter/mcp-auth-flow.ts +0 -1296
  213. package/node_modules/pi-mcp-adapter/mcp-auth.ts +0 -1287
  214. package/node_modules/pi-mcp-adapter/mcp-bearer-store.ts +0 -250
  215. package/node_modules/pi-mcp-adapter/mcp-callback-server.ts +0 -534
  216. package/node_modules/pi-mcp-adapter/mcp-code.ts +0 -495
  217. package/node_modules/pi-mcp-adapter/mcp-install.ts +0 -60
  218. package/node_modules/pi-mcp-adapter/mcp-keyring-helper.cjs +0 -89
  219. package/node_modules/pi-mcp-adapter/mcp-oauth-provider.ts +0 -819
  220. package/node_modules/pi-mcp-adapter/mcp-output-guard.ts +0 -511
  221. package/node_modules/pi-mcp-adapter/mcp-panel-theme.ts +0 -104
  222. package/node_modules/pi-mcp-adapter/mcp-panel.ts +0 -1099
  223. package/node_modules/pi-mcp-adapter/mcp-probe.ts +0 -201
  224. package/node_modules/pi-mcp-adapter/mcp-references.ts +0 -373
  225. package/node_modules/pi-mcp-adapter/mcp-script-worker.mjs +0 -137
  226. package/node_modules/pi-mcp-adapter/mcp-setup-panel.ts +0 -747
  227. package/node_modules/pi-mcp-adapter/mcp-status.ts +0 -105
  228. package/node_modules/pi-mcp-adapter/mcp-tasks.ts +0 -467
  229. package/node_modules/pi-mcp-adapter/mcp-trace.ts +0 -306
  230. package/node_modules/pi-mcp-adapter/metadata-cache.ts +0 -362
  231. package/node_modules/pi-mcp-adapter/namespace-tools.ts +0 -334
  232. package/node_modules/pi-mcp-adapter/npx-resolver.ts +0 -543
  233. package/node_modules/pi-mcp-adapter/oauth-handler.ts +0 -30
  234. package/node_modules/pi-mcp-adapter/oauth.ts +0 -52
  235. package/node_modules/pi-mcp-adapter/onboarding-state.ts +0 -76
  236. package/node_modules/pi-mcp-adapter/package-mcp-loader.ts +0 -156
  237. package/node_modules/pi-mcp-adapter/package.json +0 -219
  238. package/node_modules/pi-mcp-adapter/panel-keys.ts +0 -53
  239. package/node_modules/pi-mcp-adapter/prompts.ts +0 -385
  240. package/node_modules/pi-mcp-adapter/proxy-modes.ts +0 -1735
  241. package/node_modules/pi-mcp-adapter/request-headers-command.ts +0 -333
  242. package/node_modules/pi-mcp-adapter/resource-tools.ts +0 -17
  243. package/node_modules/pi-mcp-adapter/runtime-owner.ts +0 -106
  244. package/node_modules/pi-mcp-adapter/sampling-handler.ts +0 -261
  245. package/node_modules/pi-mcp-adapter/sandbox-proxy-template.ts +0 -144
  246. package/node_modules/pi-mcp-adapter/search-ranking.ts +0 -309
  247. package/node_modules/pi-mcp-adapter/secure-keyring.ts +0 -170
  248. package/node_modules/pi-mcp-adapter/semantic-search.ts +0 -186
  249. package/node_modules/pi-mcp-adapter/server-manager.ts +0 -2088
  250. package/node_modules/pi-mcp-adapter/session-approvals.ts +0 -201
  251. package/node_modules/pi-mcp-adapter/session-recovery.ts +0 -158
  252. package/node_modules/pi-mcp-adapter/skills/mcp-scripting/SKILL.md +0 -49
  253. package/node_modules/pi-mcp-adapter/state.ts +0 -71
  254. package/node_modules/pi-mcp-adapter/tool-approval.ts +0 -205
  255. package/node_modules/pi-mcp-adapter/tool-metadata.ts +0 -302
  256. package/node_modules/pi-mcp-adapter/tool-registrar.ts +0 -255
  257. package/node_modules/pi-mcp-adapter/tool-result-renderer.ts +0 -573
  258. package/node_modules/pi-mcp-adapter/ts-shape.ts +0 -149
  259. package/node_modules/pi-mcp-adapter/types.ts +0 -1120
  260. package/node_modules/pi-mcp-adapter/ui-app-bridge-helpers.ts +0 -40
  261. package/node_modules/pi-mcp-adapter/ui-resource-handler.ts +0 -266
  262. package/node_modules/pi-mcp-adapter/ui-server.ts +0 -993
  263. package/node_modules/pi-mcp-adapter/ui-session.ts +0 -624
  264. package/node_modules/pi-mcp-adapter/ui-stream-types.ts +0 -89
  265. package/node_modules/pi-mcp-adapter/ui-tool-visibility.ts +0 -25
  266. package/node_modules/pi-mcp-adapter/unix-socket-transport.ts +0 -85
  267. package/node_modules/pi-mcp-adapter/utils.ts +0 -464
@@ -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;
@@ -3,7 +3,7 @@ import { TypeSafeIntegrationError } from "./errors.js";
3
3
  export const DEFAULT_BACKEND = "typesafe";
4
4
  /** The environment variable and login store that the default backend reads. */
5
5
  export const TYPESAFE_KEY_ENV = "TYPESAFE_API_KEY";
6
- /** Registry of known judgment backends. Extendable by callers. */
6
+ /** Registry of known judgment backends. Callers pass a `BackendEndpoint` for a host this registry does not name. */
7
7
  export const DECISIONS_BACKENDS = {
8
8
  typesafe: { label: "TypeSafe", host: "https://api.typesafe.ai", keyEnv: TYPESAFE_KEY_ENV },
9
9
  openrouter: {
@@ -16,6 +16,16 @@ export const DECISIONS_BACKENDS = {
16
16
  modelsIdField: "id",
17
17
  modelsVerifyKey: false,
18
18
  },
19
+ commandcode: {
20
+ label: "Command Code",
21
+ host: "https://api.commandcode.ai",
22
+ keyEnv: "COMMANDCODE_API_KEY",
23
+ path: "/provider/v1/systemone",
24
+ modelsPath: "/provider/v1/models",
25
+ modelsField: "data",
26
+ modelsIdField: "id",
27
+ modelsVerifyKey: false,
28
+ },
19
29
  };
20
30
  /** The registry entry for a backend name; a `configuration` error for a name the registry does not know. */
21
31
  export function backendConfig(name) {
@@ -28,6 +38,7 @@ export function backendConfig(name) {
28
38
  const DEFAULT_MODEL = {
29
39
  typesafe: "jev-latest",
30
40
  openrouter: "typesafe/jev-1.13",
41
+ commandcode: "typesafe/jev",
31
42
  };
32
43
  /**
33
44
  * The model id to send for a caller's `model` on this backend. OpenRouter routes a bare Jev id under the `typesafe`
@@ -57,3 +68,86 @@ export function defaultModelId(backend) {
57
68
  export function usesTypesafeKey(backend) {
58
69
  return (backend.keyEnv ?? TYPESAFE_KEY_ENV) === TYPESAFE_KEY_ENV;
59
70
  }
71
+ const KEY_ENV_MESSAGE = "Backend keyEnv must name an environment variable: letters, digits, and underscores, not starting with a digit.";
72
+ const HOST_MESSAGE = "Backend host must be an absolute https: URL with no user info, path, query, or fragment (http: is allowed only for localhost, 127.0.0.0/8, and [::1]).";
73
+ function refuse(message) {
74
+ throw new TypeSafeIntegrationError("configuration", message);
75
+ }
76
+ /** `https://gw.example.com?` and `https://gw.example.com#` parse clean, so the raw string itself must carry neither. */
77
+ function hasRawQueryOrFragment(value) {
78
+ return value.includes("?") || value.includes("#");
79
+ }
80
+ /**
81
+ * Resolve a registry name or a caller-supplied endpoint into the validated form the client uses. A name resolves to
82
+ * its registry entry unchanged; an endpoint is validated field by field and returned as a fresh object whose `host`
83
+ * is origin-only. Messages never quote a caller value — a host can carry credentials in its user info — except the
84
+ * label, and only after it is validated. Validation runs on every call; nothing is cached.
85
+ */
86
+ export function resolveBackend(backend) {
87
+ const spec = backend === undefined ? DEFAULT_BACKEND : backend;
88
+ if (typeof spec === "string") {
89
+ const entry = backendConfig(spec);
90
+ return {
91
+ ...entry,
92
+ name: spec,
93
+ host: entry.host,
94
+ keyEnv: entry.keyEnv ?? TYPESAFE_KEY_ENV,
95
+ defaultModel: defaultModelId(spec),
96
+ modelsVerifyKey: entry.modelsVerifyKey !== false,
97
+ };
98
+ }
99
+ if (spec === null || typeof spec !== "object") {
100
+ refuse("backend must be a registry name or a backend object.");
101
+ }
102
+ const label = typeof spec.label === "string" ? spec.label.trim() : "";
103
+ if (!label || label.length > 60)
104
+ refuse("Backend label must be a nonempty string of at most 60 characters.");
105
+ let host;
106
+ if (typeof spec.host !== "string" || hasRawQueryOrFragment(spec.host))
107
+ refuse(HOST_MESSAGE);
108
+ try {
109
+ host = new URL(spec.host);
110
+ }
111
+ catch {
112
+ refuse(HOST_MESSAGE);
113
+ }
114
+ const loopback = host.hostname === "localhost" || host.hostname === "[::1]" || /^127(?:\.\d{1,3}){3}$/.test(host.hostname);
115
+ if (host.protocol !== "https:" && !(host.protocol === "http:" && loopback))
116
+ refuse(HOST_MESSAGE);
117
+ if (host.username !== "" || host.password !== "" || host.pathname !== "/" || host.search !== "" || host.hash !== "")
118
+ refuse(HOST_MESSAGE);
119
+ for (const [field, message] of [["path", 'Backend path must be a string that starts with "/".'], ["modelsPath", 'Backend modelsPath must be a string that starts with "/".']]) {
120
+ const value = spec[field];
121
+ if (value !== undefined && (typeof value !== "string" || !value.startsWith("/") || hasRawQueryOrFragment(value)))
122
+ refuse(message);
123
+ }
124
+ if (spec.modelsField !== undefined && (typeof spec.modelsField !== "string" || !spec.modelsField))
125
+ refuse("Backend modelsField must be a nonempty string.");
126
+ if (spec.modelsIdField !== undefined && (typeof spec.modelsIdField !== "string" || !spec.modelsIdField))
127
+ refuse("Backend modelsIdField must be a nonempty string.");
128
+ if (spec.modelsVerifyKey !== undefined && typeof spec.modelsVerifyKey !== "boolean")
129
+ refuse("Backend modelsVerifyKey must be a boolean.");
130
+ if (typeof spec.keyEnv !== "string" || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(spec.keyEnv))
131
+ refuse(KEY_ENV_MESSAGE);
132
+ if (spec.keyEnv.toUpperCase() === TYPESAFE_KEY_ENV) {
133
+ refuse("Backend keyEnv must not be TYPESAFE_API_KEY: the TypeSafe key is only sent to the typesafe backend. Give this endpoint its own variable.");
134
+ }
135
+ if (spec.defaultModel !== undefined && (typeof spec.defaultModel !== "string" || !spec.defaultModel.trim() || spec.defaultModel.length > 100)) {
136
+ refuse("Backend defaultModel must be a nonempty string of at most 100 characters.");
137
+ }
138
+ return {
139
+ label,
140
+ host: host.origin,
141
+ keyEnv: spec.keyEnv,
142
+ modelsVerifyKey: spec.modelsVerifyKey === true,
143
+ ...(spec.path === undefined ? {} : { path: spec.path }),
144
+ ...(spec.modelsPath === undefined ? {} : { modelsPath: spec.modelsPath }),
145
+ ...(spec.modelsField === undefined ? {} : { modelsField: spec.modelsField }),
146
+ ...(spec.modelsIdField === undefined ? {} : { modelsIdField: spec.modelsIdField }),
147
+ ...(spec.defaultModel === undefined ? {} : { defaultModel: spec.defaultModel }),
148
+ };
149
+ }
150
+ /** The destination host only — scheme, host, and port, e.g. `api.commandcode.ai` — for consent text. */
151
+ export function backendHost(backend) {
152
+ return new URL(resolveBackend(backend).host).host;
153
+ }
@@ -1,14 +1,14 @@
1
1
  import type { Fetch, Questions, SystemOneRequest, SystemOneResult } from "@typesafe-ai/sdk";
2
- import type { TypeSafeBackend } from "./backends.js";
2
+ import type { BackendSpec } from "./backends.js";
3
3
  import type { BatchEvaluation, BatchOptions } from "./batch.js";
4
4
  import type { BlockedCap, SpendCaps, UsageLedger, UsageReport } from "./usage.js";
5
- export { DECISIONS_BACKENDS, DEFAULT_BACKEND } from "./backends.js";
6
- export type { BackendConfig, TypeSafeBackend } from "./backends.js";
5
+ export { backendHost, resolveBackend, DECISIONS_BACKENDS, DEFAULT_BACKEND } from "./backends.js";
6
+ export type { BackendConfig, BackendEndpoint, BackendSpec, ResolvedBackend, TypeSafeBackend } from "./backends.js";
7
7
  export interface TypeSafeOptions {
8
8
  /** Defaults to TYPESAFE_API_KEY, then the key saved by `/typesafe login`; never returned. */
9
9
  apiKey?: string;
10
- /** Judgment backend. When omitted, routes to the default TypeSafe host. */
11
- backend?: TypeSafeBackend;
10
+ /** Judgment backend: a registry name or a caller-supplied endpoint. When omitted, routes to the default TypeSafe host. */
11
+ backend?: BackendSpec;
12
12
  /** Defaults to the backend's own default (`jev-latest`, `typesafe/jev-1.13` on OpenRouter); a bare Jev id is mapped to the backend's id form before sending. No model is inferred from submitted content. */
13
13
  model?: string;
14
14
  /** Per request. Default: 15 seconds. No automatic retries. */