@cortexkit/opencode-antigravity-auth 3.0.5 → 3.0.6

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 (370) hide show
  1. package/README.md +38 -352
  2. package/dist/cli.js +9199 -8799
  3. package/dist/cli.js.map +4 -4
  4. package/dist/cli.meta.json +1286 -1064
  5. package/dist/index.js +13641 -14559
  6. package/dist/index.js.map +4 -4
  7. package/dist/index.meta.json +1333 -1342
  8. package/dist/server.js +10618 -11080
  9. package/dist/server.js.map +4 -4
  10. package/dist/server.meta.json +1 -1
  11. package/dist/src/auth-method-labels.d.ts +3 -0
  12. package/dist/src/auth-method-labels.d.ts.map +1 -0
  13. package/dist/src/auth-method-labels.js +5 -0
  14. package/dist/src/auth-method-labels.js.map +1 -0
  15. package/dist/src/cli.d.ts +3 -1
  16. package/dist/src/cli.d.ts.map +1 -1
  17. package/dist/src/cli.js +98 -12
  18. package/dist/src/cli.js.map +1 -1
  19. package/dist/src/common-auth-embedded/claustrum/consumer.d.ts +33 -3
  20. package/dist/src/common-auth-embedded/claustrum/consumer.js +96 -1
  21. package/dist/src/common-auth-embedded/claustrum/custody.d.ts +4 -1
  22. package/dist/src/common-auth-embedded/claustrum/enrollment.d.ts +6 -1
  23. package/dist/src/common-auth-embedded/claustrum/enrollment.js +6 -1
  24. package/dist/src/common-auth-embedded/claustrum/index.d.ts +2 -1
  25. package/dist/src/common-auth-embedded/claustrum/index.js +5 -3
  26. package/dist/src/common-auth-embedded/claustrum/insula.d.ts +69 -0
  27. package/dist/src/common-auth-embedded/claustrum/insula.js +152 -0
  28. package/dist/src/common-auth-embedded/claustrum/roster.d.ts +13 -0
  29. package/dist/src/common-auth-embedded/claustrum/roster.js +33 -3
  30. package/dist/src/common-auth-embedded/fs/refresh-file-lock.js +20 -11
  31. package/dist/src/common-auth-embedded/quota/codec.d.ts +2 -0
  32. package/dist/src/common-auth-embedded/quota/codec.js +2 -1
  33. package/dist/src/common-auth-embedded/quota/format.d.ts +26 -0
  34. package/dist/src/common-auth-embedded/quota/format.js +78 -42
  35. package/dist/src/common-auth-embedded/quota/index.d.ts +4 -4
  36. package/dist/src/common-auth-embedded/quota/index.js +2 -2
  37. package/dist/src/common-auth-embedded/quota/map.d.ts +11 -0
  38. package/dist/src/common-auth-embedded/quota/map.js +36 -1
  39. package/dist/src/common-auth-embedded/quota/merge.d.ts +3 -1
  40. package/dist/src/common-auth-embedded/quota/merge.js +21 -5
  41. package/dist/src/common-auth-embedded/quota/projection.d.ts +2 -1
  42. package/dist/src/common-auth-embedded/quota/projection.js +3 -1
  43. package/dist/src/common-auth-embedded/setup/command-runner.js +49 -0
  44. package/dist/src/common-auth-embedded/setup/command.d.ts +3 -0
  45. package/dist/src/common-auth-embedded/setup/command.js +215 -0
  46. package/dist/src/common-auth-embedded/setup/config-write.js +60 -0
  47. package/dist/src/common-auth-embedded/setup/detect.d.ts +6 -0
  48. package/dist/src/common-auth-embedded/setup/detect.js +224 -0
  49. package/dist/src/common-auth-embedded/setup/enroll.js +70 -0
  50. package/dist/src/common-auth-embedded/setup/index.d.ts +5 -0
  51. package/dist/src/common-auth-embedded/setup/index.js +4 -0
  52. package/dist/src/common-auth-embedded/setup/paths.js +33 -0
  53. package/dist/src/common-auth-embedded/setup/process-fence.d.ts +43 -0
  54. package/dist/src/common-auth-embedded/setup/process-fence.js +270 -0
  55. package/dist/src/common-auth-embedded/setup/prompts.js +26 -0
  56. package/dist/src/common-auth-embedded/setup/register.d.ts +11 -0
  57. package/dist/src/common-auth-embedded/setup/register.js +130 -0
  58. package/dist/src/common-auth-embedded/setup/types.d.ts +136 -0
  59. package/dist/src/common-auth-embedded/source-output.json +228 -80
  60. package/dist/src/common-auth-embedded/store/schema.d.ts +2 -0
  61. package/dist/src/common-auth-embedded/store/schema.js +3 -2
  62. package/dist/src/ga/rpc/protocol.d.ts +4 -7
  63. package/dist/src/ga/rpc/protocol.d.ts.map +1 -1
  64. package/dist/src/ga/rpc/protocol.js +5 -13
  65. package/dist/src/ga/rpc/protocol.js.map +1 -1
  66. package/dist/src/ga/server/auth.d.ts +8 -3
  67. package/dist/src/ga/server/auth.d.ts.map +1 -1
  68. package/dist/src/ga/server/auth.js +25 -9
  69. package/dist/src/ga/server/auth.js.map +1 -1
  70. package/dist/src/ga/server/index.d.ts +39 -12
  71. package/dist/src/ga/server/index.d.ts.map +1 -1
  72. package/dist/src/ga/server/index.js +214 -53
  73. package/dist/src/ga/server/index.js.map +1 -1
  74. package/dist/src/ga/server/pool-login.d.ts +22 -0
  75. package/dist/src/ga/server/pool-login.d.ts.map +1 -0
  76. package/dist/src/ga/server/pool-login.js +150 -0
  77. package/dist/src/ga/server/pool-login.js.map +1 -0
  78. package/dist/src/ga/tui/host-ga.d.ts +2 -5
  79. package/dist/src/ga/tui/host-ga.d.ts.map +1 -1
  80. package/dist/src/ga/tui/host-ga.js +17 -49
  81. package/dist/src/ga/tui/host-ga.js.map +1 -1
  82. package/dist/src/plugin/accounts.d.ts +1 -1
  83. package/dist/src/plugin/accounts.d.ts.map +1 -1
  84. package/dist/src/plugin/accounts.js +1 -0
  85. package/dist/src/plugin/accounts.js.map +1 -1
  86. package/dist/src/plugin/background-vault-quota-refresh.d.ts +2 -0
  87. package/dist/src/plugin/background-vault-quota-refresh.d.ts.map +1 -1
  88. package/dist/src/plugin/background-vault-quota-refresh.js +125 -10
  89. package/dist/src/plugin/background-vault-quota-refresh.js.map +1 -1
  90. package/dist/src/plugin/command-apply.d.ts +2 -2
  91. package/dist/src/plugin/command-apply.d.ts.map +1 -1
  92. package/dist/src/plugin/command-apply.js +3 -10
  93. package/dist/src/plugin/command-apply.js.map +1 -1
  94. package/dist/src/plugin/commands.d.ts +1 -0
  95. package/dist/src/plugin/commands.d.ts.map +1 -1
  96. package/dist/src/plugin/commands.js +2 -2
  97. package/dist/src/plugin/commands.js.map +1 -1
  98. package/dist/src/plugin/config/operator-settings-schema.d.ts +0 -4
  99. package/dist/src/plugin/config/operator-settings-schema.d.ts.map +1 -1
  100. package/dist/src/plugin/config/operator-settings-schema.js +0 -5
  101. package/dist/src/plugin/config/operator-settings-schema.js.map +1 -1
  102. package/dist/src/plugin/config/schema.d.ts +0 -7
  103. package/dist/src/plugin/config/schema.d.ts.map +1 -1
  104. package/dist/src/plugin/config/schema.js +0 -43
  105. package/dist/src/plugin/config/schema.js.map +1 -1
  106. package/dist/src/plugin/config/writer.d.ts +1 -1
  107. package/dist/src/plugin/config/writer.js +1 -1
  108. package/dist/src/plugin/fetch/retry-state.d.ts +19 -3
  109. package/dist/src/plugin/fetch/retry-state.d.ts.map +1 -1
  110. package/dist/src/plugin/fetch/retry-state.js +0 -6
  111. package/dist/src/plugin/fetch/retry-state.js.map +1 -1
  112. package/dist/src/plugin/fetch-interceptor.d.ts.map +1 -1
  113. package/dist/src/plugin/fetch-interceptor.js +0 -3
  114. package/dist/src/plugin/fetch-interceptor.js.map +1 -1
  115. package/dist/src/plugin/fetch-routing.d.ts +0 -16
  116. package/dist/src/plugin/fetch-routing.d.ts.map +1 -1
  117. package/dist/src/plugin/fetch-routing.js +0 -49
  118. package/dist/src/plugin/fetch-routing.js.map +1 -1
  119. package/dist/src/plugin/ga-location-services.d.ts +14 -9
  120. package/dist/src/plugin/ga-location-services.d.ts.map +1 -1
  121. package/dist/src/plugin/ga-location-services.js +120 -40
  122. package/dist/src/plugin/ga-location-services.js.map +1 -1
  123. package/dist/src/plugin/google-origin.d.ts +7 -0
  124. package/dist/src/plugin/google-origin.d.ts.map +1 -0
  125. package/dist/src/plugin/google-origin.js +14 -0
  126. package/dist/src/plugin/google-origin.js.map +1 -0
  127. package/dist/src/plugin/index.d.ts.map +1 -1
  128. package/dist/src/plugin/index.js +15 -4
  129. package/dist/src/plugin/index.js.map +1 -1
  130. package/dist/src/plugin/oauth-methods.d.ts.map +1 -1
  131. package/dist/src/plugin/oauth-methods.js +0 -33
  132. package/dist/src/plugin/oauth-methods.js.map +1 -1
  133. package/dist/src/plugin/operator-settings.d.ts +1 -1
  134. package/dist/src/plugin/operator-settings.d.ts.map +1 -1
  135. package/dist/src/plugin/operator-settings.js +1 -8
  136. package/dist/src/plugin/operator-settings.js.map +1 -1
  137. package/dist/src/plugin/quota.d.ts +11 -7
  138. package/dist/src/plugin/quota.d.ts.map +1 -1
  139. package/dist/src/plugin/quota.js +128 -102
  140. package/dist/src/plugin/quota.js.map +1 -1
  141. package/dist/src/plugin/request.d.ts +5 -3
  142. package/dist/src/plugin/request.d.ts.map +1 -1
  143. package/dist/src/plugin/request.js +87 -168
  144. package/dist/src/plugin/request.js.map +1 -1
  145. package/dist/src/plugin/server.d.ts.map +1 -1
  146. package/dist/src/plugin/server.js +60 -53
  147. package/dist/src/plugin/server.js.map +1 -1
  148. package/dist/src/plugin/shared/advisory-repository.d.ts +20 -0
  149. package/dist/src/plugin/shared/advisory-repository.d.ts.map +1 -0
  150. package/dist/src/plugin/shared/advisory-repository.js +91 -0
  151. package/dist/src/plugin/shared/advisory-repository.js.map +1 -0
  152. package/dist/src/plugin/shared/request-services.d.ts +19 -25
  153. package/dist/src/plugin/shared/request-services.d.ts.map +1 -1
  154. package/dist/src/plugin/shared/request-services.js +105 -188
  155. package/dist/src/plugin/shared/request-services.js.map +1 -1
  156. package/dist/src/plugin/shared/runtime.js +4 -2
  157. package/dist/src/plugin/shared/runtime.js.map +1 -1
  158. package/dist/src/plugin/shared/vault-request-credentials.d.ts +4 -1
  159. package/dist/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
  160. package/dist/src/plugin/shared/vault-request-credentials.js +41 -7
  161. package/dist/src/plugin/shared/vault-request-credentials.js.map +1 -1
  162. package/dist/src/plugin/storage.d.ts +2 -2
  163. package/dist/src/plugin/storage.d.ts.map +1 -1
  164. package/dist/src/plugin/storage.js.map +1 -1
  165. package/dist/src/plugin/vault-custody.d.ts.map +1 -1
  166. package/dist/src/plugin/vault-custody.js +147 -35
  167. package/dist/src/plugin/vault-custody.js.map +1 -1
  168. package/dist/src/plugin/vault-quota-outcome.d.ts +19 -0
  169. package/dist/src/plugin/vault-quota-outcome.d.ts.map +1 -0
  170. package/dist/src/plugin/vault-quota-outcome.js +47 -0
  171. package/dist/src/plugin/vault-quota-outcome.js.map +1 -0
  172. package/dist/src/quota-presentation.d.ts +29 -1
  173. package/dist/src/quota-presentation.d.ts.map +1 -1
  174. package/dist/src/quota-presentation.js +52 -17
  175. package/dist/src/quota-presentation.js.map +1 -1
  176. package/dist/src/setup.d.ts +15 -0
  177. package/dist/src/setup.d.ts.map +1 -0
  178. package/dist/src/setup.js +320 -0
  179. package/dist/src/setup.js.map +1 -0
  180. package/dist/src/sidebar-projection.d.ts +1 -1
  181. package/dist/src/sidebar-projection.d.ts.map +1 -1
  182. package/dist/src/sidebar-state.d.ts +1 -1
  183. package/dist/src/sidebar-state.d.ts.map +1 -1
  184. package/dist/src/sidebar-state.js +19 -1
  185. package/dist/src/sidebar-state.js.map +1 -1
  186. package/dist/src/tui.d.ts.map +1 -1
  187. package/dist/src/tui.js +205 -110
  188. package/dist/src/tui.js.map +1 -1
  189. package/dist/tui-build-map.json +37 -37
  190. package/dist/tui-ga-build-map.json +33 -33
  191. package/dist/types/src/auth-method-labels.d.ts +3 -0
  192. package/dist/types/src/auth-method-labels.d.ts.map +1 -0
  193. package/dist/types/src/cli.d.ts +3 -1
  194. package/dist/types/src/cli.d.ts.map +1 -1
  195. package/dist/types/src/common-auth-embedded/auth-menu/terminal.d.ts +43 -0
  196. package/dist/types/src/common-auth-embedded/claustrum/consumer.d.ts +132 -0
  197. package/dist/types/src/common-auth-embedded/claustrum/custody.d.ts +178 -0
  198. package/dist/types/src/common-auth-embedded/claustrum/enrollment.d.ts +164 -0
  199. package/dist/types/src/common-auth-embedded/claustrum/errors.d.ts +16 -0
  200. package/dist/types/src/common-auth-embedded/claustrum/host-slot.d.ts +39 -0
  201. package/dist/types/src/common-auth-embedded/claustrum/index.d.ts +19 -0
  202. package/dist/types/src/common-auth-embedded/claustrum/insula.d.ts +69 -0
  203. package/dist/types/src/common-auth-embedded/claustrum/interlock.d.ts +27 -0
  204. package/dist/types/src/common-auth-embedded/claustrum/roster.d.ts +221 -0
  205. package/dist/types/src/common-auth-embedded/opencode2/errors.d.ts +25 -0
  206. package/dist/types/src/common-auth-embedded/opencode2/index.d.ts +8 -0
  207. package/dist/types/src/common-auth-embedded/opencode2/install.d.ts +55 -0
  208. package/dist/types/src/common-auth-embedded/opencode2/integration.d.ts +112 -0
  209. package/dist/types/src/common-auth-embedded/opencode2/sse.d.ts +12 -0
  210. package/dist/types/src/common-auth-embedded/opencode2/types.d.ts +413 -0
  211. package/dist/types/src/common-auth-embedded/quota/codec.d.ts +2 -0
  212. package/dist/types/src/common-auth-embedded/quota/format.d.ts +26 -0
  213. package/dist/types/src/common-auth-embedded/quota/index.d.ts +4 -4
  214. package/dist/types/src/common-auth-embedded/quota/map.d.ts +11 -0
  215. package/dist/types/src/common-auth-embedded/quota/merge.d.ts +3 -1
  216. package/dist/types/src/common-auth-embedded/quota/projection.d.ts +2 -1
  217. package/dist/types/src/common-auth-embedded/routing/admission.d.ts +93 -0
  218. package/dist/types/src/common-auth-embedded/routing/index.d.ts +8 -0
  219. package/dist/types/src/common-auth-embedded/routing/ordered.d.ts +47 -0
  220. package/dist/types/src/common-auth-embedded/routing/pins.d.ts +22 -0
  221. package/dist/types/src/common-auth-embedded/routing/sticky.d.ts +158 -0
  222. package/dist/types/src/common-auth-embedded/setup/command.d.ts +3 -0
  223. package/dist/types/src/common-auth-embedded/setup/detect.d.ts +6 -0
  224. package/dist/types/src/common-auth-embedded/setup/index.d.ts +5 -0
  225. package/dist/types/src/common-auth-embedded/setup/process-fence.d.ts +43 -0
  226. package/dist/types/src/common-auth-embedded/setup/register.d.ts +11 -0
  227. package/dist/types/src/common-auth-embedded/setup/types.d.ts +136 -0
  228. package/dist/types/src/common-auth-embedded/store/schema.d.ts +2 -0
  229. package/dist/types/src/ga/rpc/protocol.d.ts +4 -7
  230. package/dist/types/src/ga/rpc/protocol.d.ts.map +1 -1
  231. package/dist/types/src/ga/server/auth.d.ts +8 -3
  232. package/dist/types/src/ga/server/auth.d.ts.map +1 -1
  233. package/dist/types/src/ga/server/index.d.ts +39 -12
  234. package/dist/types/src/ga/server/index.d.ts.map +1 -1
  235. package/dist/types/src/ga/server/pool-login.d.ts +22 -0
  236. package/dist/types/src/ga/server/pool-login.d.ts.map +1 -0
  237. package/dist/types/src/plugin/accounts.d.ts +1 -1
  238. package/dist/types/src/plugin/accounts.d.ts.map +1 -1
  239. package/dist/types/src/plugin/background-vault-quota-refresh.d.ts +2 -0
  240. package/dist/types/src/plugin/background-vault-quota-refresh.d.ts.map +1 -1
  241. package/dist/types/src/plugin/command-apply.d.ts +2 -2
  242. package/dist/types/src/plugin/command-apply.d.ts.map +1 -1
  243. package/dist/types/src/plugin/commands.d.ts +1 -0
  244. package/dist/types/src/plugin/commands.d.ts.map +1 -1
  245. package/dist/types/src/plugin/config/operator-settings-schema.d.ts +0 -4
  246. package/dist/types/src/plugin/config/operator-settings-schema.d.ts.map +1 -1
  247. package/dist/types/src/plugin/config/schema.d.ts +0 -7
  248. package/dist/types/src/plugin/config/schema.d.ts.map +1 -1
  249. package/dist/types/src/plugin/config/writer.d.ts +1 -1
  250. package/dist/types/src/plugin/fetch/retry-state.d.ts +19 -3
  251. package/dist/types/src/plugin/fetch/retry-state.d.ts.map +1 -1
  252. package/dist/types/src/plugin/fetch-interceptor.d.ts.map +1 -1
  253. package/dist/types/src/plugin/fetch-routing.d.ts +0 -16
  254. package/dist/types/src/plugin/fetch-routing.d.ts.map +1 -1
  255. package/dist/types/src/plugin/ga-location-services.d.ts +14 -9
  256. package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -1
  257. package/dist/types/src/plugin/google-origin.d.ts +7 -0
  258. package/dist/types/src/plugin/google-origin.d.ts.map +1 -0
  259. package/dist/types/src/plugin/index.d.ts.map +1 -1
  260. package/dist/types/src/plugin/oauth-methods.d.ts.map +1 -1
  261. package/dist/types/src/plugin/operator-settings.d.ts +1 -1
  262. package/dist/types/src/plugin/operator-settings.d.ts.map +1 -1
  263. package/dist/types/src/plugin/quota.d.ts +11 -7
  264. package/dist/types/src/plugin/quota.d.ts.map +1 -1
  265. package/dist/types/src/plugin/request.d.ts +5 -3
  266. package/dist/types/src/plugin/request.d.ts.map +1 -1
  267. package/dist/types/src/plugin/server.d.ts.map +1 -1
  268. package/dist/types/src/plugin/shared/advisory-repository.d.ts +20 -0
  269. package/dist/types/src/plugin/shared/advisory-repository.d.ts.map +1 -0
  270. package/dist/types/src/plugin/shared/request-services.d.ts +19 -25
  271. package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -1
  272. package/dist/types/src/plugin/shared/vault-request-credentials.d.ts +4 -1
  273. package/dist/types/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
  274. package/dist/types/src/plugin/storage.d.ts +2 -2
  275. package/dist/types/src/plugin/storage.d.ts.map +1 -1
  276. package/dist/types/src/plugin/vault-custody.d.ts.map +1 -1
  277. package/dist/types/src/plugin/vault-quota-outcome.d.ts +19 -0
  278. package/dist/types/src/plugin/vault-quota-outcome.d.ts.map +1 -0
  279. package/dist/types/src/setup.d.ts +15 -0
  280. package/dist/types/src/setup.d.ts.map +1 -0
  281. package/dist/types/src/sidebar-state.d.ts +1 -1
  282. package/dist/types/src/sidebar-state.d.ts.map +1 -1
  283. package/package.json +5 -4
  284. package/src/common-auth-embedded/claustrum/consumer.d.ts +33 -3
  285. package/src/common-auth-embedded/claustrum/consumer.js +96 -1
  286. package/src/common-auth-embedded/claustrum/custody.d.ts +4 -1
  287. package/src/common-auth-embedded/claustrum/enrollment.d.ts +6 -1
  288. package/src/common-auth-embedded/claustrum/enrollment.js +6 -1
  289. package/src/common-auth-embedded/claustrum/index.d.ts +2 -1
  290. package/src/common-auth-embedded/claustrum/index.js +5 -3
  291. package/src/common-auth-embedded/claustrum/insula.d.ts +69 -0
  292. package/src/common-auth-embedded/claustrum/insula.js +152 -0
  293. package/src/common-auth-embedded/claustrum/roster.d.ts +13 -0
  294. package/src/common-auth-embedded/claustrum/roster.js +33 -3
  295. package/src/common-auth-embedded/fs/refresh-file-lock.js +20 -11
  296. package/src/common-auth-embedded/quota/codec.d.ts +2 -0
  297. package/src/common-auth-embedded/quota/codec.js +2 -1
  298. package/src/common-auth-embedded/quota/format.d.ts +26 -0
  299. package/src/common-auth-embedded/quota/format.js +78 -42
  300. package/src/common-auth-embedded/quota/index.d.ts +4 -4
  301. package/src/common-auth-embedded/quota/index.js +2 -2
  302. package/src/common-auth-embedded/quota/map.d.ts +11 -0
  303. package/src/common-auth-embedded/quota/map.js +36 -1
  304. package/src/common-auth-embedded/quota/merge.d.ts +3 -1
  305. package/src/common-auth-embedded/quota/merge.js +21 -5
  306. package/src/common-auth-embedded/quota/projection.d.ts +2 -1
  307. package/src/common-auth-embedded/quota/projection.js +3 -1
  308. package/src/common-auth-embedded/setup/command-runner.js +49 -0
  309. package/src/common-auth-embedded/setup/command.d.ts +3 -0
  310. package/src/common-auth-embedded/setup/command.js +215 -0
  311. package/src/common-auth-embedded/setup/config-write.js +60 -0
  312. package/src/common-auth-embedded/setup/detect.d.ts +6 -0
  313. package/src/common-auth-embedded/setup/detect.js +224 -0
  314. package/src/common-auth-embedded/setup/enroll.js +70 -0
  315. package/src/common-auth-embedded/setup/index.d.ts +5 -0
  316. package/src/common-auth-embedded/setup/index.js +4 -0
  317. package/src/common-auth-embedded/setup/paths.js +33 -0
  318. package/src/common-auth-embedded/setup/process-fence.d.ts +43 -0
  319. package/src/common-auth-embedded/setup/process-fence.js +270 -0
  320. package/src/common-auth-embedded/setup/prompts.js +26 -0
  321. package/src/common-auth-embedded/setup/register.d.ts +11 -0
  322. package/src/common-auth-embedded/setup/register.js +130 -0
  323. package/src/common-auth-embedded/setup/types.d.ts +136 -0
  324. package/src/common-auth-embedded/source-output.json +228 -80
  325. package/src/common-auth-embedded/store/schema.d.ts +2 -0
  326. package/src/common-auth-embedded/store/schema.js +3 -2
  327. package/src/sidebar-state.ts +19 -2
  328. package/src/tui-compiled/common-auth-embedded/quota/codec.js +2 -1
  329. package/src/tui-compiled/common-auth-embedded/quota/format.js +78 -42
  330. package/src/tui-compiled/common-auth-embedded/quota/index.js +2 -2
  331. package/src/tui-compiled/common-auth-embedded/quota/map.js +36 -1
  332. package/src/tui-compiled/common-auth-embedded/quota/merge.js +21 -5
  333. package/src/tui-compiled/common-auth-embedded/quota/projection.js +3 -1
  334. package/src/tui-compiled/quota-presentation.js +42 -9
  335. package/src/tui-compiled/sidebar-state.js +15 -1
  336. package/src/tui-compiled/tui.js +516 -334
  337. package/src/tui-ga-compiled/host-ga.js +11 -38
  338. package/src/tui-ga-compiled/shared/1ff34afa7c42d196-projection.js +3 -1
  339. package/src/tui-ga-compiled/shared/77138df80c7ae006-map.js +36 -1
  340. package/src/tui-ga-compiled/shared/98cc0c186c46c42d-quota-presentation.js +42 -9
  341. package/src/tui-ga-compiled/shared/aef2402f8fc342f0-format.js +78 -42
  342. package/src/tui-ga-compiled/shared/bf17cbee28e58197-index.js +2 -2
  343. package/src/tui-ga-compiled/shared/ca21dc417b36dc5d-codec.js +2 -1
  344. package/src/tui-ga-compiled/shared/ecc214300932dfb6-merge.js +21 -5
  345. package/src/tui-ga-raw/host-ga.tsx +31 -62
  346. package/src/tui-ga-raw/shared/1ff34afa7c42d196-projection.js +3 -1
  347. package/src/tui-ga-raw/shared/77138df80c7ae006-map.js +36 -1
  348. package/src/tui-ga-raw/shared/98cc0c186c46c42d-quota-presentation.js +42 -9
  349. package/src/tui-ga-raw/shared/aef2402f8fc342f0-format.js +78 -42
  350. package/src/tui-ga-raw/shared/bf17cbee28e58197-index.js +2 -2
  351. package/src/tui-ga-raw/shared/ca21dc417b36dc5d-codec.js +2 -1
  352. package/src/tui-ga-raw/shared/ecc214300932dfb6-merge.js +21 -5
  353. package/src/tui-raw/common-auth-embedded/quota/codec.js +2 -1
  354. package/src/tui-raw/common-auth-embedded/quota/format.js +78 -42
  355. package/src/tui-raw/common-auth-embedded/quota/index.js +2 -2
  356. package/src/tui-raw/common-auth-embedded/quota/map.js +36 -1
  357. package/src/tui-raw/common-auth-embedded/quota/merge.js +21 -5
  358. package/src/tui-raw/common-auth-embedded/quota/projection.js +3 -1
  359. package/src/tui-raw/quota-presentation.js +42 -9
  360. package/src/tui-raw/sidebar-state.js +15 -1
  361. package/src/tui-raw/tui.tsx +423 -218
  362. package/src/tui.tsx +423 -218
  363. package/dist/src/tui/vault-setup.d.ts +0 -98
  364. package/dist/src/tui/vault-setup.d.ts.map +0 -1
  365. package/dist/src/tui/vault-setup.js +0 -198
  366. package/dist/src/tui/vault-setup.js.map +0 -1
  367. package/dist/types/src/plugin/transform/model-resolver.d.ts +0 -2
  368. package/dist/types/src/plugin/transform/model-resolver.d.ts.map +0 -1
  369. package/dist/types/src/quota-presentation.d.ts +0 -18
  370. package/dist/types/src/quota-presentation.d.ts.map +0 -1
@@ -0,0 +1,178 @@
1
+ import { type ClaustrumClient, type ClaustrumReporterSource, type EnrollmentTokenFile } from '@cortexkit/claustrum-client';
2
+ import { type ClaustrumLogger } from './errors.js';
3
+ import type { InsulaUsageTransport } from './insula.js';
4
+ export type ClaustrumScopedClient = Pick<ClaustrumClient, 'listScoped' | 'getScoped' | 'reportAuthFailureScoped' | 'close'> & {
5
+ insula?: InsulaUsageTransport;
6
+ };
7
+ /** The two credential types a plugin's family can hold; routing differs by type. */
8
+ export type VaultCredentialType = 'oauth' | 'api_key';
9
+ /**
10
+ * Which vault rows belong to this plugin. `refreshAdapter` classifies an OAuth
11
+ * row by the protocol it speaks; `category` is the grant that authorizes this
12
+ * consumer to read it. Static API keys carry no refresh adapter, so they are
13
+ * admitted only when `apiKeys` is set and only by category.
14
+ */
15
+ export interface ClaustrumFamily {
16
+ refreshAdapter: string;
17
+ category: string;
18
+ apiKeys?: boolean;
19
+ }
20
+ /** One vault credential this consumer may serve. Never carries bearer material. */
21
+ export interface VaultCredential {
22
+ readonly credentialId: string;
23
+ readonly credentialType: VaultCredentialType;
24
+ /**
25
+ * The provider account the credential logs into, when the vault's adapter
26
+ * claims one. Absent means the adapter makes no claim, not a mismatch.
27
+ */
28
+ readonly accountIdentity?: string;
29
+ readonly state: string;
30
+ readonly email?: string;
31
+ readonly orgName?: string;
32
+ }
33
+ /**
34
+ * Why a listed vault record could not be used. A closed set of fixed codes, so
35
+ * a log line or a roster file that carries one never echoes vault data.
36
+ */
37
+ export type SkippedVaultReason = 'empty credential id' | 'duplicate credential id' | 'blank account identity' | 'empty state';
38
+ /**
39
+ * A vault record this consumer could not use. `credentialId` is absent when
40
+ * the record's id itself was unusable, so nothing can say which account the
41
+ * record was.
42
+ */
43
+ export interface SkippedVaultRecord {
44
+ readonly credentialId?: string;
45
+ readonly reason: SkippedVaultReason;
46
+ }
47
+ export interface VaultInventory {
48
+ /**
49
+ * The vault's change cursor: a digest over exactly what this consumer can see
50
+ * (ids, grants, state, identity), never over record versions, so a routine
51
+ * token refresh does not move it. Only equality is meaningful.
52
+ */
53
+ readonly view: string;
54
+ readonly credentials: readonly VaultCredential[];
55
+ readonly skipped: readonly SkippedVaultRecord[];
56
+ }
57
+ export interface ClaustrumScopedIdentity {
58
+ readonly credentialId: string;
59
+ readonly credentialType: VaultCredentialType;
60
+ readonly accountIdentity?: string;
61
+ }
62
+ /**
63
+ * Where a receipt's `accountIdentity` came from: the vault asserted it in the
64
+ * served reply, the plugin's `parseIdentity` read it from the served token, or
65
+ * neither did and it is only the roster's expectation (`none`: no identity at
66
+ * all).
67
+ */
68
+ export type AccountIdentitySource = 'asserted' | 'parsed' | 'expected' | 'none';
69
+ /**
70
+ * A receipt: what the vault served for one physical send. Each attempt gets
71
+ * its own. It records the exact record version served, because a 401 for
72
+ * this send is reported to the vault against that version.
73
+ */
74
+ export interface ClaustrumScopedAttempt {
75
+ readonly credentialId: string;
76
+ readonly credentialType: VaultCredentialType;
77
+ /**
78
+ * The account this receipt is bound to: the vault's assertion, else the
79
+ * plugin's parse of the token, else the roster's expectation. Check
80
+ * `accountIdentitySource` before treating it as proof.
81
+ */
82
+ readonly accountIdentity?: string;
83
+ readonly accountIdentitySource: AccountIdentitySource;
84
+ /** The account the roster row named when this receipt was requested. */
85
+ readonly expectedAccountIdentity?: string;
86
+ /** The credential id the vault itself put in the served reply, if any. */
87
+ readonly assertedCredentialId?: string;
88
+ /**
89
+ * The account the vault itself put in the served reply, if any. Never filled
90
+ * in from the roster or from a token parse.
91
+ */
92
+ readonly assertedAccountIdentity?: string;
93
+ /**
94
+ * The non-secret Google Cloud project id the vault served in get_scoped for
95
+ * this attempt, if any. Never filled in from list_scoped, the roster or a
96
+ * token parse. A project change in the vault takes effect on the next send.
97
+ */
98
+ readonly projectId?: string;
99
+ /**
100
+ * Kept in memory only and hidden from JSON.stringify and object spreads, so
101
+ * logging a receipt never leaks it. Authorize again for every dispatch and retry.
102
+ */
103
+ readonly accessToken: string;
104
+ readonly recordVersion: number;
105
+ readonly expiresAtMs: number | null;
106
+ }
107
+ /** Reads the provider identity a served token executes under, when the plugin can tell. */
108
+ export type IdentityParser = (accessToken: string) => string | undefined;
109
+ /** Only a new version of the same account may replace an in-flight 401. */
110
+ export declare function isScopedCredentialRotation(served: ClaustrumScopedAttempt, current: ClaustrumScopedAttempt | undefined): current is ClaustrumScopedAttempt;
111
+ /** Why a scoped 401 did or did not retry. Never carries credential material. */
112
+ export type ScopedRetryReason = 'rotated' | 'reauthorize-failed' | 'credential-changed' | 'account-changed' | 'version-unchanged';
113
+ /**
114
+ * Decide whether a request that got a 401 should retry with the freshly
115
+ * re-authorized receipt, and log the decision. The vault can refresh a
116
+ * credential between the send and the 401; the log line lets that refresh be
117
+ * matched against the consumer's retry. `site` names the kind of request.
118
+ */
119
+ export declare function decideScopedRetryAfter401(site: string, served: ClaustrumScopedAttempt, current: ClaustrumScopedAttempt | undefined, logger?: ClaustrumLogger): current is ClaustrumScopedAttempt;
120
+ /**
121
+ * How long a served OAuth token must stay valid after the vault hands it out,
122
+ * so it cannot expire while a long request is still using it.
123
+ */
124
+ export declare const SERVING_MARGIN_MS = 300000;
125
+ /**
126
+ * Reads this consumer's vault credentials (list, fetch, 401 report), with the
127
+ * enrollment token as authorization. Used by every host of a plugin. There is
128
+ * deliberately no credential cache and no single-flight of credential reads:
129
+ * each physical send is authorized by the vault, so a revoked enrollment or a
130
+ * changed record takes effect on the next send. The enrollment token is
131
+ * re-read per operation so an operator's reissue on disk is picked up.
132
+ */
133
+ export declare class ClaustrumScopedCustody {
134
+ #private;
135
+ constructor(options: {
136
+ client: ClaustrumScopedClient;
137
+ family: ClaustrumFamily;
138
+ tokenPath?: string;
139
+ readToken?: () => Promise<EnrollmentTokenFile>;
140
+ parseIdentity?: IdentityParser;
141
+ /**
142
+ * Issue a receipt only when the vault's served reply itself names the
143
+ * requested credential id and the roster's (known) account identity. For
144
+ * providers whose tokens are opaque, where nothing else can prove which
145
+ * account a token belongs to. Off by default: then an absent assertion is
146
+ * no claim, and the receipt says where its identity came from.
147
+ */
148
+ requireAssertion?: boolean;
149
+ now?: () => number;
150
+ logger?: ClaustrumLogger;
151
+ });
152
+ /**
153
+ * List this consumer's credentials. A record that cannot be used is skipped
154
+ * and warned about rather than failing the whole list, so one bad record
155
+ * never hides every other account. Records outside the family are not
156
+ * skipped records: they simply are not this consumer's.
157
+ */
158
+ discover(signal?: AbortSignal): Promise<VaultInventory>;
159
+ /**
160
+ * Fetch the credential for one physical send and wrap it in a fresh receipt.
161
+ * The vault's served identity (or, without one, the plugin's parse of the
162
+ * token) must equal the roster's when both are present. Without
163
+ * `requireAssertion`, absence on either side proves nothing and does not
164
+ * refuse; the receipt records what the vault asserted separately from what
165
+ * the roster expected. With it, a reply that does not itself name the
166
+ * credential id and the expected account is refused.
167
+ */
168
+ authorize(identity: ClaustrumScopedIdentity, signal?: AbortSignal): Promise<ClaustrumScopedAttempt>;
169
+ /**
170
+ * Report that a send this consumer actually made was rejected. Only a 401
171
+ * is reported (the vault refuses 429, 402 and 5xx reports), addressed by
172
+ * credential id with the exact record version that send was served, and
173
+ * signed with the enrollment token that authorized it. A receipt this
174
+ * custody did not issue is refused rather than reported.
175
+ */
176
+ reportFailure(attempt: ClaustrumScopedAttempt, status: number, reporterSource: ClaustrumReporterSource): Promise<void>;
177
+ close(): void;
178
+ }
@@ -0,0 +1,164 @@
1
+ import { type ClaustrumClientOptions as ClaustrumEnrollmentClientOptions, type EnrollmentPollOutcome, type EnrollmentTokenFile, writeEnrollmentTokenFile } from '@cortexkit/claustrum-client';
2
+ /**
3
+ * Codes the vault's closed enrollment-refusal vocabulary marks permanent. The
4
+ * client labels some module error frames transient/retry regardless, so the
5
+ * producer's code takes precedence over the client's action for these.
6
+ */
7
+ export declare const TERMINAL_ENROLLMENT_CODES: ReadonlySet<string>;
8
+ /** Codes that are always worth another ceremony tick, whatever the action says. */
9
+ export declare const RETRYABLE_ENROLLMENT_CODES: ReadonlySet<string>;
10
+ export type EnrollmentDisposition = 'terminal' | 'retry';
11
+ /**
12
+ * Classify an enrollment transport refusal as `(code, disposition)`. The
13
+ * vault's own code wins: a terminal code is terminal even when the client
14
+ * says retry, queue saturation is retryable even when it says gone, and any
15
+ * other code follows the client's action. Errors that are not producer
16
+ * refusals return undefined and are the caller's to rethrow.
17
+ */
18
+ export declare function classifyEnrollmentError(error: unknown): {
19
+ code: string;
20
+ disposition: EnrollmentDisposition;
21
+ } | undefined;
22
+ /**
23
+ * The name a plugin proposes for one host, for example `openai-auth-opencode`.
24
+ * Each host enrolls separately so the operator can revoke one without the other.
25
+ */
26
+ export declare function enrollmentName(plugin: string, host: string): string;
27
+ export interface ClaustrumEnrollmentClient {
28
+ enrollPropose(input: {
29
+ name: string;
30
+ requestSecretHash: string;
31
+ }): Promise<{
32
+ requestId: string;
33
+ }>;
34
+ enrollPoll(input: {
35
+ requestId: string;
36
+ requestSecret: string;
37
+ }): Promise<EnrollmentPollOutcome>;
38
+ }
39
+ export interface ClaustrumEnrollmentConnection extends ClaustrumEnrollmentClient {
40
+ close(): void;
41
+ }
42
+ /**
43
+ * Connect the enrollment ceremony. Setup calls this; the request path never
44
+ * does. `connectionFile` is required because this library reads no
45
+ * environment and knows no host paths.
46
+ */
47
+ export declare function connectClaustrumEnrollmentClient(options: ClaustrumEnrollmentClientOptions & {
48
+ connectionFile: string;
49
+ }): Promise<ClaustrumEnrollmentConnection>;
50
+ export type ClaustrumEnrollmentStatus = {
51
+ state: 'idle';
52
+ } | {
53
+ state: 'pending';
54
+ proposedName: string;
55
+ requestId?: string;
56
+ retryCode?: string;
57
+ } | {
58
+ state: 'approved';
59
+ proposedName: string;
60
+ approvedName?: string;
61
+ tokenGeneration: number;
62
+ } | {
63
+ state: 'denied';
64
+ proposedName: string;
65
+ } | {
66
+ state: 'blocked';
67
+ proposedName: string;
68
+ code: string;
69
+ } | {
70
+ state: 'unavailable';
71
+ proposedName: string;
72
+ code: string;
73
+ } | {
74
+ state: 'busy';
75
+ };
76
+ export interface ClaustrumEnrollmentPaths {
77
+ statePath: string;
78
+ tokenPath: string;
79
+ }
80
+ /** The ceremony state file sits next to the token: `x.json` pairs with `x-state.json`. */
81
+ export declare function getClaustrumEnrollmentPaths(tokenPath: string): ClaustrumEnrollmentPaths;
82
+ /**
83
+ * One host's token and state paths. Every host gets its own pair under the
84
+ * plugin's state directory, so an OpenCode enrollment and a Pi enrollment can
85
+ * be approved and revoked independently. A plugin-resolved override replaces
86
+ * the default token path; a relative override resolves against `cwd`.
87
+ */
88
+ export declare function hostEnrollmentPaths(input: {
89
+ stateDir: string;
90
+ host: string;
91
+ override?: string;
92
+ cwd?: string;
93
+ }): ClaustrumEnrollmentPaths;
94
+ /** Account-file paths are injectable for isolated setup tests; no environment overrides. */
95
+ export interface EnrollmentAncestorOptions {
96
+ passwdPath?: string;
97
+ groupPath?: string;
98
+ }
99
+ /**
100
+ * Protect setup writes from directory replacement. On POSIX, group write access
101
+ * is safe only when local records prove the effective user's group is private;
102
+ * sticky ancestors are accepted. Windows uses the shared safe-parent policy.
103
+ */
104
+ export declare function refuseWritableAncestor(parent: string, options?: EnrollmentAncestorOptions): Promise<void>;
105
+ export declare function readClaustrumEnrollmentStatus(paths: ClaustrumEnrollmentPaths, proposedName: string): Promise<ClaustrumEnrollmentStatus>;
106
+ /**
107
+ * Resolve the host's account mode from its enrollment files. It never changes
108
+ * their contents or the host's mode. On Windows, reading them may create a
109
+ * missing private state folder and tighten an enrollment file's permissions to
110
+ * owner-only, as every private-file read there does.
111
+ */
112
+ export declare function enrollmentAuthority(paths: ClaustrumEnrollmentPaths, proposedName: string): Promise<'vault' | 'local' | 'unreadable'>;
113
+ /**
114
+ * Read fresh bearer material for one scoped operation; never publish it.
115
+ * Re-reading per operation is what lets an operator reissue a token on disk.
116
+ */
117
+ export declare function readClaustrumEnrollmentToken(tokenPath: string): Promise<EnrollmentTokenFile>;
118
+ /**
119
+ * The enrollment ceremony for one host. Run it from setup only: it proposes,
120
+ * polls and persists, and every step can wait on an operator. The request
121
+ * path reads the resulting token and never calls into this class.
122
+ */
123
+ export declare class ClaustrumEnrollmentManager {
124
+ #private;
125
+ constructor(options: {
126
+ client: ClaustrumEnrollmentClient;
127
+ paths: ClaustrumEnrollmentPaths;
128
+ proposedName: string;
129
+ now?: () => number;
130
+ mintSecret?: () => string;
131
+ writeTokenFile?: typeof writeEnrollmentTokenFile;
132
+ ancestorOptions?: EnrollmentAncestorOptions;
133
+ });
134
+ status(): Promise<ClaustrumEnrollmentStatus>;
135
+ resetTerminal(): Promise<ClaustrumEnrollmentResetResult>;
136
+ reconcile(): Promise<ClaustrumEnrollmentStatus>;
137
+ }
138
+ export type ClaustrumEnrollmentResetResult = 'reset' | 'idle' | 'refused-pending' | 'refused-approved' | 'busy';
139
+ /** Reset local terminal metadata without connecting to the credential daemon. */
140
+ export declare function resetClaustrumEnrollmentState(paths: ClaustrumEnrollmentPaths, proposedName: string): Promise<ClaustrumEnrollmentResetResult>;
141
+ export type ClaustrumEnrollmentDisconnectResult = 'disconnected' | 'idle' | 'busy';
142
+ /**
143
+ * Disconnect this host from the vault on disk: remove its enrollment token,
144
+ * then its ceremony state, so `enrollmentAuthority` reports `local` again.
145
+ * This is the disconnect every plugin uses. Removing only the token is not
146
+ * enough: an approved state without a token is still vault mode and refuses,
147
+ * by design. It never contacts the credential daemon, so the enrollment stays
148
+ * approved in the vault until the operator revokes it there; a later Connect
149
+ * starts a new ceremony. A pending request is abandoned the same way.
150
+ *
151
+ * Takes the ceremony lock `reconcile()` and `resetClaustrumEnrollmentState`
152
+ * take, and returns `busy` without deleting anything while another process
153
+ * holds it. State naming another consumer refuses with `wrong-consumer` and
154
+ * both files stay. The token goes first: a crash between the two deletions
155
+ * leaves an approved state without a token, which is still vault mode (it
156
+ * refuses rather than falls back to local accounts), and calling this again
157
+ * finishes the job. Returns `idle` when neither file exists. Nothing else in
158
+ * the directory is touched. The token is removed without being parsed, so a
159
+ * corrupt token does not stand in the way. A malformed state file (bad JSON
160
+ * or wrong shape) is removed too, since it is what makes `enrollmentAuthority`
161
+ * report `unreadable`; a state file that fails the safety checks (symlink,
162
+ * wrong owner, not owner-only) refuses with `unsafe-file` and both files stay.
163
+ */
164
+ export declare function disconnectClaustrumEnrollment(paths: ClaustrumEnrollmentPaths, proposedName: string): Promise<ClaustrumEnrollmentDisconnectResult>;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Every refusal the `/claustrum` code raises itself. Refusals sent by the
3
+ * vault keep arriving as the client's own `ClaustrumCredentialError` (a
4
+ * `code`, a `class` and an `action`), so callers can tell the vault's verdict
5
+ * apart from a check made on this side.
6
+ */
7
+ export type ClaustrumConsumerFailureKind = 'closed' | 'not-enrolled' | 'invalid-token' | 'unavailable' | 'identity-changed' | 'identity-unasserted' | 'insufficient-validity' | 'invalid-material' | 'not-active' | 'route-unavailable' | 'route-declined' | 'no-receipt' | 'unsafe-file' | 'invalid-state' | 'wrong-consumer' | 'roster-busy' | 'host-slot-login' | 'host-slot-placeholder' | 'placeholder-refresh';
8
+ export declare class ClaustrumConsumerError extends Error {
9
+ readonly kind: ClaustrumConsumerFailureKind;
10
+ constructor(kind: ClaustrumConsumerFailureKind, message: string);
11
+ }
12
+ /** The structural logger every class here accepts; `/logger`'s `createLogger` satisfies it. */
13
+ export interface ClaustrumLogger {
14
+ warn(message: string, data?: unknown): void;
15
+ debug(message: string, data?: unknown): void;
16
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * The host's own auth slot (OpenCode's stored login for the provider, Pi's
3
+ * equivalent) must hold something, or the host drops the provider. Under
4
+ * custody it holds this placeholder: an OAuth-shaped value that is never a
5
+ * credential. Its empty access token also makes the vault's sealer refuse it,
6
+ * should it ever be offered for import.
7
+ */
8
+ export declare const CUSTODY_PLACEHOLDER_PREFIX = "claustrum-tombstone:v1:";
9
+ export declare function custodyPlaceholderKey(provider: string): string;
10
+ export declare function custodyPlaceholder(provider: string): {
11
+ type: 'oauth';
12
+ access: '';
13
+ refresh: string;
14
+ expires: 0;
15
+ };
16
+ export declare function isCustodyPlaceholderValue(value: unknown): value is string;
17
+ export declare function isCustodyPlaceholder(auth: unknown, provider: string): boolean;
18
+ /** What the host slot holds: the custody placeholder, a real login, or nothing usable. */
19
+ export type HostSlotContent = 'placeholder' | 'login' | 'empty';
20
+ export declare function classifyHostSlot(auth: unknown, provider: string): HostSlotContent;
21
+ /**
22
+ * Check the host slot against the plugin's mode before serving anything.
23
+ *
24
+ * - Custody mode with a real login in the slot fails closed: someone signed in
25
+ * through the host while the vault owns the accounts, and serving either the
26
+ * login or the vault would silently pick one. The plugin surfaces the error
27
+ * and the user chooses (leave custody, or remove the login).
28
+ * - Local mode with the placeholder in the slot also fails: there is no local
29
+ * credential to serve, and the user has to sign in.
30
+ *
31
+ * Returns the slot content when the combination is consistent.
32
+ */
33
+ export declare function assertHostSlotMatchesMode(input: {
34
+ mode: 'custody' | 'local';
35
+ auth: unknown;
36
+ provider: string;
37
+ }): HostSlotContent;
38
+ /** Refuse to run a local token refresh with the placeholder as the refresh token. */
39
+ export declare function assertNotCustodyPlaceholder(refreshToken: unknown, provider: string): void;
@@ -0,0 +1,19 @@
1
+ import { type ClaustrumClientOptions } from '@cortexkit/claustrum-client';
2
+ import type { ClaustrumScopedClient } from './custody.js';
3
+ export { ClaustrumCredentialError, type ClaustrumReporterSource, type EnrollmentTokenFile, } from '@cortexkit/claustrum-client';
4
+ export { ClaustrumConsumer, type ClaustrumConsumerOptions, type SendOptions, } from './consumer.js';
5
+ export { type AccountIdentitySource, type ClaustrumFamily, type ClaustrumScopedAttempt, type ClaustrumScopedClient, ClaustrumScopedCustody, type ClaustrumScopedIdentity, decideScopedRetryAfter401, type IdentityParser, isScopedCredentialRotation, type ScopedRetryReason, SERVING_MARGIN_MS, type SkippedVaultReason, type SkippedVaultRecord, type VaultCredential, type VaultCredentialType, type VaultInventory, } from './custody.js';
6
+ export { type ClaustrumEnrollmentClient, type ClaustrumEnrollmentConnection, type ClaustrumEnrollmentDisconnectResult, ClaustrumEnrollmentManager, type ClaustrumEnrollmentPaths, type ClaustrumEnrollmentResetResult, type ClaustrumEnrollmentStatus, classifyEnrollmentError, connectClaustrumEnrollmentClient, disconnectClaustrumEnrollment, type EnrollmentDisposition, enrollmentAuthority, enrollmentName, getClaustrumEnrollmentPaths, hostEnrollmentPaths, RETRYABLE_ENROLLMENT_CODES, readClaustrumEnrollmentStatus, readClaustrumEnrollmentToken, resetClaustrumEnrollmentState, TERMINAL_ENROLLMENT_CODES, } from './enrollment.js';
7
+ export { ClaustrumConsumerError, type ClaustrumConsumerFailureKind, type ClaustrumLogger, } from './errors.js';
8
+ export { assertHostSlotMatchesMode, assertNotCustodyPlaceholder, CUSTODY_PLACEHOLDER_PREFIX, classifyHostSlot, custodyPlaceholder, custodyPlaceholderKey, type HostSlotContent, isCustodyPlaceholder, isCustodyPlaceholderValue, } from './host-slot.js';
9
+ export type { InsulaQuotaContext, InsulaQuotaOptions, InsulaUsageEntry, InsulaUsageTransport, InsulaUsageWindow, } from './insula.js';
10
+ export { acceptAccount, type DeclinedAccount, declineAccount, isDeclined, } from './interlock.js';
11
+ export { type AccountMapper, acceptVaultRoute, DEFAULT_ROUTE_PREFIX, declineVaultRoute, type MutateVaultRosterOptions, mutateVaultRoster, type ProjectionOptions, projectVaultRoster, type QuotaReceipt, readVaultRoster, recordVaultAccountQuota, recordVaultQuota, refreshVaultRoster, resolveVaultPrimary, type VaultPrimary, type VaultPrimaryBinding, type VaultPrimaryUnavailableReason, type VaultRosterFile, type VaultRosterLockContext, type VaultRosterRow, vaultRoutingRows, } from './roster.js';
12
+ /**
13
+ * Connect the client that lists and fetches this consumer's vault credentials
14
+ * on the request path. `connectionFile` is required: this library
15
+ * reads no environment, so the plugin resolves the vault's connection file.
16
+ */
17
+ export declare function connectClaustrumScopedClient(options: ClaustrumClientOptions & {
18
+ connectionFile: string;
19
+ }): Promise<ClaustrumScopedClient>;
@@ -0,0 +1,69 @@
1
+ import type { ClaustrumClientOptions } from '@cortexkit/claustrum-client';
2
+ /** Insula's window fields are open: plugins choose which limits they understand. */
3
+ export interface InsulaUsageWindow {
4
+ usedPercent: number;
5
+ rawUsedPercent?: number;
6
+ resetsAt?: string;
7
+ windowMinutes?: number;
8
+ windowKind?: string;
9
+ [field: string]: unknown;
10
+ }
11
+ export interface InsulaUsageEntry {
12
+ provider: string;
13
+ account?: string;
14
+ fetchedAt?: string;
15
+ source?: string;
16
+ stale?: unknown;
17
+ errorClass?: unknown;
18
+ usage?: {
19
+ primary?: InsulaUsageWindow;
20
+ secondary?: InsulaUsageWindow;
21
+ tertiary?: InsulaUsageWindow;
22
+ extraRateWindows?: Array<{
23
+ id?: string;
24
+ title?: string;
25
+ window?: InsulaUsageWindow;
26
+ }>;
27
+ [field: string]: unknown;
28
+ };
29
+ [field: string]: unknown;
30
+ }
31
+ export interface InsulaQuotaContext {
32
+ /** Milliseconds since the epoch, parsed from the producer's fetchedAt. */
33
+ fetchedAt: number;
34
+ source?: string;
35
+ }
36
+ export interface InsulaQuotaOptions<Q> {
37
+ provider: 'codex' | 'claude' | 'antigravity';
38
+ /**
39
+ * Set every converted window's reading time to context.fetchedAt, not poll
40
+ * time. Return undefined for entries the plugin cannot use. Antigravity can
41
+ * receive its own sidebar reading back from insula: accept it only from the
42
+ * vault or when fetchedAt is newer than the plugin's last reading.
43
+ */
44
+ normalize: (entry: InsulaUsageEntry, context: InsulaQuotaContext) => Q | undefined;
45
+ }
46
+ /** Optional transport for custom scoped clients; getUsage must not retry refusals. */
47
+ export interface InsulaUsageTransport {
48
+ connectionFile: string;
49
+ getUsage(): Promise<unknown>;
50
+ }
51
+ /** Constructing this transport opens no connection; getUsage opens one per call. */
52
+ export declare function insulaUsageTransport(options: ClaustrumClientOptions & {
53
+ connectionFile: string;
54
+ }): InsulaUsageTransport;
55
+ export declare class InsulaQuotaSource {
56
+ #private;
57
+ private readonly transport;
58
+ private readonly key;
59
+ constructor(transport: InsulaUsageTransport, key: string);
60
+ refresh(now: number): Promise<void>;
61
+ current(provider: string, accountId: string, now: number): {
62
+ entry: InsulaUsageEntry;
63
+ context: InsulaQuotaContext;
64
+ } | undefined;
65
+ }
66
+ export declare function acquireInsulaQuotaSource(transport: InsulaUsageTransport, tokenPath: string): {
67
+ source: InsulaQuotaSource;
68
+ release(): void;
69
+ };
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The declined-account interlock: the user's "do not use this vault account",
3
+ * kept on the consumer side because the vault has no notion of it.
4
+ *
5
+ * A decline follows the provider account, not the vault record: an entry made
6
+ * while the account was known matches any credential id or alias that logs
7
+ * into that same account, so relabelling, adding an alias or removing and
8
+ * re-adding the account never lifts it. A credential id that now logs into a
9
+ * different known account does not match, because that account has its own
10
+ * policy. While either side's account is unknown the entry falls back to the
11
+ * credential id, so an adapter that makes no identity claim cannot slip past
12
+ * it. Never keyed on the record version, so a token refresh cannot lift it.
13
+ */
14
+ export interface DeclinedAccount {
15
+ readonly credentialId: string;
16
+ readonly accountIdentity?: string;
17
+ }
18
+ export declare function isDeclined(entries: readonly DeclinedAccount[], credentialId: string, accountIdentity?: string): boolean;
19
+ export declare function declineAccount(entries: readonly DeclinedAccount[], credentialId: string, accountIdentity?: string): DeclinedAccount[];
20
+ /**
21
+ * Lift every entry that declines a row: the row's credential ids (the
22
+ * representative and its aliases) under the row's account. An entry for a
23
+ * different known account is left alone even when it names one of these
24
+ * credential ids, so accepting a replacement never re-enables the account the
25
+ * user declined.
26
+ */
27
+ export declare function acceptAccount(entries: readonly DeclinedAccount[], credentialIds: readonly string[], accountIdentity?: string): DeclinedAccount[];