@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,221 @@
1
+ import { type QuotaMap, type QuotaObservation } from '../quota/index.js';
2
+ import type { RoutingRow } from '../routing/index.js';
3
+ import type { ClaustrumScopedAttempt, ClaustrumScopedCustody, SkippedVaultRecord, VaultCredential, VaultCredentialType, VaultInventory } from './custody.js';
4
+ import { type DeclinedAccount } from './interlock.js';
5
+ /**
6
+ * One vault account as the pool sees it. It carries no bearer material: the
7
+ * access token is fetched from the vault for every send. Several vault
8
+ * records logged into the same provider account collapse into one row, so
9
+ * duplicate logins never count as extra quota.
10
+ */
11
+ export interface VaultRosterRow {
12
+ routeId: string;
13
+ credentialId: string;
14
+ credentialType: VaultCredentialType;
15
+ accountIdentity?: string;
16
+ /** Other credential ids logged into the same provider account. */
17
+ aliases?: string[];
18
+ state: string;
19
+ label: string;
20
+ email?: string;
21
+ orgName?: string;
22
+ enabled: boolean;
23
+ addedAt: number;
24
+ quota?: QuotaMap;
25
+ /**
26
+ * The vault listed this record in a form this consumer could not use, so the
27
+ * row is the last good projection kept as it was rather than dropped.
28
+ */
29
+ stale?: true;
30
+ /**
31
+ * The vault's latest list named no account for `credentialId`, so
32
+ * `accountIdentity` is the last account that credential was known to log
33
+ * into, kept until the vault names one again. It proves neither that the
34
+ * credential still logs into that account nor that it changed accounts.
35
+ */
36
+ unclaimed?: true;
37
+ }
38
+ export interface VaultRosterFile {
39
+ version: 1;
40
+ view?: string;
41
+ /**
42
+ * False when the vault's reply carried records this consumer could not use.
43
+ * An incomplete reply never removes an account it may still hold: every
44
+ * previous member it does not account for is kept.
45
+ */
46
+ complete: boolean;
47
+ /** The unusable records of an incomplete reply: a safe id and a fixed reason. */
48
+ rejected?: SkippedVaultRecord[];
49
+ rows: VaultRosterRow[];
50
+ declined: DeclinedAccount[];
51
+ }
52
+ /** How a vault credential is presented in the pool. */
53
+ export type AccountMapper = (credential: VaultCredential) => {
54
+ label?: string;
55
+ };
56
+ export interface ProjectionOptions {
57
+ /** Ids already used by local rows; a vault route never takes one. */
58
+ reservedRouteIds?: ReadonlySet<string>;
59
+ /** Prefix for vault route ids, so they read differently from local ids. */
60
+ routePrefix?: string;
61
+ mapAccount?: AccountMapper;
62
+ now?: number;
63
+ }
64
+ export declare const DEFAULT_ROUTE_PREFIX = "vault:";
65
+ /**
66
+ * Project the vault's list onto the previous roster. Pure: callers serialize
67
+ * discovery and commit. Route ids, quota and the time an account was added
68
+ * survive for the same account; a credential that now logs into a different
69
+ * known account gets a new route id and no inherited quota.
70
+ *
71
+ * A record listed without an identity keeps the last account it was known to
72
+ * log into (the row is marked `unclaimed`). Dropping that binding would let a
73
+ * later different account look like an identity learned for the first time
74
+ * and inherit the first account's route and quota.
75
+ *
76
+ * A reply with unusable records is incomplete: a previous member it does not
77
+ * account for (its record was rejected, or a rejected record has no usable id
78
+ * and could be any of them) is kept, as an alias of its live account or as a
79
+ * `stale` row. Only a complete reply removes an account.
80
+ */
81
+ export declare function projectVaultRoster(previous: VaultRosterFile | undefined, inventory: VaultInventory, options?: ProjectionOptions): VaultRosterFile;
82
+ /**
83
+ * The rows `/routing` selects among. Only enabled, active accounts route;
84
+ * a declined or cold vault account stays listed for the menu but never
85
+ * reaches admission.
86
+ */
87
+ export declare function vaultRoutingRows(roster: VaultRosterFile | undefined): RoutingRow[];
88
+ export declare function readVaultRoster(path: string): Promise<VaultRosterFile | undefined>;
89
+ /** The ownership assertion available to a roster mutation callback. */
90
+ export interface VaultRosterLockContext {
91
+ assertOwned: () => Promise<void>;
92
+ }
93
+ export interface MutateVaultRosterOptions {
94
+ /**
95
+ * Runs when the new roster is fully staged on disk, immediately before the
96
+ * rename that publishes it, so a caller can confirm a lease of its own at
97
+ * the moment of publication rather than when `change` returned. If it
98
+ * throws, nothing is published and the staged file is removed. The
99
+ * roster's own write lock is reasserted right after it.
100
+ */
101
+ beforePublish?: () => Promise<void>;
102
+ }
103
+ /**
104
+ * Read, change and write the roster under its write lock. `change` returns
105
+ * undefined to leave the file as it is. Call `assertOwned()` immediately
106
+ * before any rename performed inside `change`; if it throws, do not rename.
107
+ */
108
+ export declare function mutateVaultRoster<T>(path: string, change: (current: VaultRosterFile | undefined, context: VaultRosterLockContext) => Promise<{
109
+ next?: VaultRosterFile;
110
+ result: T;
111
+ }> | {
112
+ next?: VaultRosterFile;
113
+ result: T;
114
+ }, options?: MutateVaultRosterOptions): Promise<T>;
115
+ /** Mark a vault account declined; it stays listed but never routes. */
116
+ export declare function declineVaultRoute(path: string, routeId: string): Promise<undefined>;
117
+ /** Lift the user's decline for a vault account and every alias of it. */
118
+ export declare function acceptVaultRoute(path: string, routeId: string): Promise<undefined>;
119
+ /**
120
+ * The receipt fields a quota or profile observation must carry to say which
121
+ * send (credential and account) it came from. Pass the
122
+ * `ClaustrumScopedAttempt` that send was authorized with.
123
+ */
124
+ export type QuotaReceipt = Pick<ClaustrumScopedAttempt, 'credentialId' | 'accountIdentity' | 'accountIdentitySource' | 'expectedAccountIdentity'>;
125
+ /**
126
+ * Merge a quota observation into a vault row through `/quota`'s merge. The
127
+ * write is fenced on the receipt the reading was taken with: it lands only
128
+ * while the row still holds that receipt's credential (as representative or
129
+ * alias) and account, so a slow read for a replaced account can never land on
130
+ * its successor. Returns whether the observation was kept.
131
+ */
132
+ export declare function recordVaultQuota(path: string, input: QuotaReceipt & {
133
+ routeId: string;
134
+ observation: QuotaObservation;
135
+ }): Promise<boolean>;
136
+ /**
137
+ * Merge a quota observation that belongs to an account rather than to a
138
+ * served credential, such as a background reading from insula. The write
139
+ * lands only while the row is still bound to that exact known account, so a
140
+ * reading taken before a replacement never reaches the successor. Unlike
141
+ * `recordVaultQuota` it never binds an account: a row without a known account
142
+ * is refused. Returns whether the observation was kept.
143
+ */
144
+ export declare function recordVaultAccountQuota(path: string, input: {
145
+ routeId: string;
146
+ accountIdentity: string;
147
+ observation: QuotaObservation;
148
+ }): Promise<boolean>;
149
+ /**
150
+ * Discover and commit the roster. The lease covers the list call and the
151
+ * commit, not just the write: an opaque view cannot tell a delayed old reply
152
+ * from a newer one, so a run that lost its lease is refused at commit. A
153
+ * failed list, or custody switching off mid-run, never writes anything; a
154
+ * peer holding the lease means its last committed roster is served instead.
155
+ */
156
+ export declare function refreshVaultRoster(options: {
157
+ path: string;
158
+ custody: Pick<ClaustrumScopedCustody, 'discover'>;
159
+ isActive?: () => boolean | Promise<boolean>;
160
+ signal?: AbortSignal;
161
+ projection?: ProjectionOptions | (() => ProjectionOptions);
162
+ }): Promise<VaultRosterFile | undefined>;
163
+ /**
164
+ * A host-owned main account as last verified from the vault: the plugin's
165
+ * logical route, the credential that serves it and the account it logs into.
166
+ */
167
+ export interface VaultPrimaryBinding {
168
+ routeId: string;
169
+ credentialId: string;
170
+ accountIdentity: string;
171
+ view: string;
172
+ }
173
+ export type VaultPrimaryUnavailableReason = 'malformed' | 'unclaimed' | 'incomplete' | 'identity-changed';
174
+ export type VaultPrimary =
175
+ /**
176
+ * Main is bound. `replaced` is the previous binding when it named a
177
+ * different account: everything owned by that account (quota, profile,
178
+ * backoff, cache affinity) must be dropped, and outstanding observations
179
+ * for it fenced, even though the logical route stays the same.
180
+ */
181
+ {
182
+ status: 'ready';
183
+ binding: VaultPrimaryBinding;
184
+ replaced?: VaultPrimaryBinding;
185
+ }
186
+ /** A complete reply lists no primary record: there is no main. */
187
+ | {
188
+ status: 'absent';
189
+ }
190
+ /**
191
+ * The reply cannot say who main is. Not the same as absent: the last
192
+ * verified binding is handed back untouched, and serving it still needs a
193
+ * fresh receipt that matches it.
194
+ */
195
+ | {
196
+ status: 'unavailable';
197
+ reason: VaultPrimaryUnavailableReason;
198
+ lastVerified?: VaultPrimaryBinding;
199
+ };
200
+ /**
201
+ * The seam for a plugin that keeps a main account: one fixed account the host
202
+ * owns under a logical route, outside the pool's rotating rows. The library
203
+ * has no main convention of its own: the plugin names the
204
+ * vault record that holds the role (`primaryCredentialId`) and its logical
205
+ * route. Main follows the account that record claims; another credential of
206
+ * that same account may serve it when the record itself is not active, but a
207
+ * credential of any other account is never promoted into main.
208
+ *
209
+ * Inputs are the plugin's filtered inventory, whether that inventory is
210
+ * complete (defaults to the reply having no unusable records; pass the
211
+ * roster's `complete` or false to override), the previous verified binding
212
+ * and, on the request path, the account the chosen request expects.
213
+ */
214
+ export declare function resolveVaultPrimary(input: {
215
+ inventory: VaultInventory;
216
+ complete?: boolean;
217
+ previous?: VaultPrimaryBinding;
218
+ expectedAccountIdentity?: string;
219
+ primaryCredentialId: string;
220
+ routeId: string;
221
+ }): VaultPrimary;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Why an OpenCode 2 auth hook refused a request.
3
+ *
4
+ * - `no-account`: the adapter had no account to offer for this request, so
5
+ * the request is stopped before the host picks a transport. Also used when
6
+ * session forgetting or installation disposal revokes an in-flight auth
7
+ * selection: that selection no longer has an account it may send under.
8
+ * - `host-credential-on-wire`: after every rewrite, a header still carried
9
+ * one of the host's placeholder credentials. Sending it would leak a
10
+ * non-routable value to the provider and fail with a confusing error.
11
+ */
12
+ export type OpenCode2AuthFailureKind = 'no-account' | 'host-credential-on-wire';
13
+ export declare class OpenCode2AuthError extends Error {
14
+ readonly kind: OpenCode2AuthFailureKind;
15
+ readonly providerID: string;
16
+ readonly sessionID: string;
17
+ readonly requestKind: string;
18
+ constructor(details: {
19
+ kind: OpenCode2AuthFailureKind;
20
+ providerID: string;
21
+ sessionID: string;
22
+ requestKind: string;
23
+ message?: string;
24
+ });
25
+ }
@@ -0,0 +1,8 @@
1
+ export type { OpenCode2AuthFailureKind } from './errors.js';
2
+ export { OpenCode2AuthError } from './errors.js';
3
+ export { ATTEMPT_HEADER, applyHeaderEdits, DEFAULT_MAX_RECORDS, installOpenCode2Auth, } from './install.js';
4
+ export type { FormAnswer, LoginContext, PoolAuthorization, PoolLoginMethod, RegisterOpenCode2AuthMethodsOptions, VaultActivationMethod, } from './integration.js';
5
+ export { isPlaceholderCredential, PLACEHOLDER_LIFETIME_MS, PLACEHOLDER_METADATA_KEY, PLACEHOLDER_PREFIX, placeholderCredential, placeholderSecret, registerOpenCode2AuthMethods, VAULT_ACTIVATION_INSTRUCTIONS, } from './integration.js';
6
+ export type { ServerSentEvent } from './sse.js';
7
+ export { watchServerSentEvents } from './sse.js';
8
+ export type { AccountHeadersResult, AccountRequest, Attempt, AttemptEndReason, AttemptOutcome, ChooseAccountInput, EventVerdict, HeaderEdits, HostError, InstallOpenCode2AuthOptions, LimitSignal, OpenCode2AuthAdapter, OpenCode2AuthEventName, OpenCode2AuthEvents, OpenCode2AuthInstallation, OpenCode2AuthLogger, OpenCode2HookContext, RequestKind, RequestScope, ResponseAccount, RetryReason, SelectingHook, Transport, } from './types.js';
@@ -0,0 +1,55 @@
1
+ import type { HeaderEdits, InstallOpenCode2AuthOptions, OpenCode2AuthAdapter, OpenCode2AuthInstallation, OpenCode2HookContext } from './types.js';
2
+ export declare const DEFAULT_MAX_RECORDS = 512;
3
+ /**
4
+ * The request header `model.request` sets to the attempt it started. The
5
+ * host builds the HTTP request and the WebSocket handshake from the headers
6
+ * `model.request` leaves, so `http.request` and `experimental.ws.handshake`
7
+ * read it to find their own attempt among several of one session and kind,
8
+ * and remove it: it never reaches the wire.
9
+ */
10
+ export declare const ATTEMPT_HEADER = "x-common-auth-attempt";
11
+ /** Applies edits to a plain header record, replacing every spelling of each name. */
12
+ export declare function applyHeaderEdits(target: Record<string, string>, edits: HeaderEdits): void;
13
+ /**
14
+ * Installs multi-account auth on OpenCode 2's own provider drivers. Every
15
+ * hook is scoped to `adapter.providerID`:
16
+ *
17
+ * - `model.request` picks the account for one model call of a session and
18
+ * request kind, which starts a new attempt, sets its headers and marks the
19
+ * request with the attempt (`ATTEMPT_HEADER`);
20
+ * - `http.request` and `experimental.ws.handshake` find the attempt by that
21
+ * mark, remove it and set the account headers again, because the host
22
+ * applies its own credential after `model.request`;
23
+ * - `experimental.ws.send` (only when the adapter rewrites frames) rewrites
24
+ * each outgoing frame;
25
+ * - `http.response` and `experimental.ws.receive` read quota, refusals,
26
+ * whether output has started and when the response ended, attributed to
27
+ * an attempt by the rules below;
28
+ * - `retry` asks the host to retry at once when an account was refused
29
+ * before any output, so `model.request` runs again and can pick another
30
+ * account, and refuses to retry once output has started.
31
+ *
32
+ * Attribution. A send belongs to the attempt named by the mark
33
+ * `model.request` left on it, so several attempts of one session and kind
34
+ * can be in flight at once, each on its own account. An HTTP response
35
+ * belongs to the attempt whose `http.request` produced its request object,
36
+ * and to nothing else. The host hands `http.response` the request object the
37
+ * `http.request` hooks left, so a different object means a later hook
38
+ * replaced it; nothing then proves which send the response answers, and its
39
+ * feedback is dropped rather than guessed by recency. A WebSocket frame
40
+ * names no attempt, so frames go to the newest open attempt of their session
41
+ * and kind that went out over WebSocket, and an older one is abandoned as
42
+ * soon as a newer attempt of that session and kind begins or goes out over
43
+ * WebSocket: the host runs one exchange at a time on a session's socket.
44
+ * Anything else is attributed to no attempt and reaches no adapter callback
45
+ * or listener.
46
+ *
47
+ * With `gateOnPlaceholder`, `model.request` is a no-op. Each transport hook
48
+ * compares the host-prepared secret exactly, then selects a fresh attempt only
49
+ * for an owned send. Request-object attribution therefore needs no attempt
50
+ * header. Frames are owned by the latest handshake of their session and kind;
51
+ * retry runs only when the session's latest transport was owned. The host's
52
+ * retry hook has no request identity, so concurrent mixed-ownership calls
53
+ * cannot be distinguished there; owned retries retain the heuristic above.
54
+ */
55
+ export declare function installOpenCode2Auth<Q, A = unknown>(ctx: OpenCode2HookContext, adapter: OpenCode2AuthAdapter<Q, A>, options?: InstallOpenCode2AuthOptions): Promise<OpenCode2AuthInstallation<Q, A>>;
@@ -0,0 +1,112 @@
1
+ import type { Credential, Plugin } from '@opencode/plugin';
2
+ import type { IntegrationOAuthMethod, IntegrationOAuthMethodRegistration } from '@opencode/plugin/promise/integration';
3
+ import type { Registration } from '@opencode/plugin/promise/registration';
4
+ /** The host's form answer handed to `authorize`. */
5
+ export type FormAnswer = Parameters<IntegrationOAuthMethodRegistration['authorize']>[0];
6
+ /**
7
+ * Prefix of every placeholder secret. No provider issues tokens of this
8
+ * shape, so a placeholder that escaped to the wire is refused by the
9
+ * provider and recognisable in any log.
10
+ */
11
+ export declare const PLACEHOLDER_PREFIX = "common-auth-placeholder";
12
+ /** How long a placeholder claims to be valid; refresh simply issues another. */
13
+ export declare const PLACEHOLDER_LIFETIME_MS: number;
14
+ /** Metadata key marking a host credential as a placeholder. */
15
+ export declare const PLACEHOLDER_METADATA_KEY = "commonAuthPlaceholder";
16
+ /** The non-routable secret the host holds for an integration. */
17
+ export declare function placeholderSecret(integrationID: string): string;
18
+ /**
19
+ * The credential the host stores for an integration whose real accounts live
20
+ * in the plugin's pool. It keeps the provider catalogued and usable in the
21
+ * host, and carries nothing that works against the provider.
22
+ */
23
+ export declare function placeholderCredential(input: {
24
+ integrationID: string;
25
+ methodID: string;
26
+ now: number;
27
+ }): Credential.OAuth;
28
+ /** Whether a host credential is a placeholder (for any integration, or the one named). */
29
+ export declare function isPlaceholderCredential(value: Credential.Value | undefined, integrationID?: string): boolean;
30
+ /**
31
+ * The plugin's half of an OAuth login. It has the same shape as the host's
32
+ * authorization, except that `callback` resolves to the plugin's own login
33
+ * result instead of a host credential.
34
+ */
35
+ export type PoolAuthorization<T> = {
36
+ readonly url: string;
37
+ readonly instructions: string;
38
+ readonly expiresAt?: number;
39
+ } & ({
40
+ readonly mode: 'auto';
41
+ readonly callback: Promise<T>;
42
+ } | {
43
+ readonly mode: 'code';
44
+ readonly callback: (code: string) => Promise<T>;
45
+ });
46
+ export interface PoolLoginMethod<T> {
47
+ readonly method: IntegrationOAuthMethod;
48
+ authorize(answer: FormAnswer): Promise<PoolAuthorization<T>>;
49
+ }
50
+ /** What `activate` and `onLogin` are told about the login they serve. */
51
+ export interface LoginContext {
52
+ readonly integrationID: string;
53
+ readonly methodID: string;
54
+ }
55
+ /**
56
+ * Shown by `opencode auth login` when the vault method starts. The host has no
57
+ * page to open for this method, so the text only says what happens instead.
58
+ */
59
+ export declare const VAULT_ACTIVATION_INSTRUCTIONS = "No browser sign-in: this connects the plugin to the accounts in its vault.";
60
+ /**
61
+ * A login method for a host whose accounts all come from a vault. Choosing it
62
+ * signs in to nothing and writes nothing to the plugin's pool: once
63
+ * `activate` resolves, the host only receives this integration's placeholder,
64
+ * which marks later requests as the plugin's to serve from the vault.
65
+ */
66
+ export interface VaultActivationMethod {
67
+ /** Must not share an ID with any of the pool login methods. */
68
+ readonly method: IntegrationOAuthMethod;
69
+ /**
70
+ * Confirms the host may use this method, normally by checking that
71
+ * `enrollmentAuthority` reports `'vault'`. Throw to refuse: the host shows
72
+ * the error's message and stores nothing, so it must be a fixed text that
73
+ * carries no credential.
74
+ */
75
+ activate(context: LoginContext): Promise<void> | void;
76
+ /** Replaces `VAULT_ACTIVATION_INSTRUCTIONS`. */
77
+ readonly instructions?: string;
78
+ }
79
+ export interface RegisterOpenCode2AuthMethodsOptions<T> {
80
+ readonly integrationID: string;
81
+ readonly methods: readonly PoolLoginMethod<T>[];
82
+ /**
83
+ * Adds a login method that activates the plugin for vault accounts without
84
+ * creating a local account. Leave it out when the plugin has no vault.
85
+ */
86
+ readonly vault?: VaultActivationMethod;
87
+ /**
88
+ * Writes a completed login into the plugin's pool. The host only receives
89
+ * a placeholder once this resolves; if it throws, the login fails in the
90
+ * host and nothing is stored there.
91
+ */
92
+ onLogin(result: T, context: LoginContext): Promise<void> | void;
93
+ /** Label the host shows for its (placeholder) connection. */
94
+ readonly label?: string;
95
+ readonly now?: () => number;
96
+ }
97
+ /**
98
+ * Registers the plugin's own login methods with the host so that a login lands
99
+ * in the plugin's pool and the host keeps only a placeholder credential.
100
+ *
101
+ * With `vault`, one more method lets a host whose accounts all live in a vault
102
+ * activate the plugin: it calls `activate`, writes nothing to the pool and
103
+ * hands the host the same placeholder under its own method ID.
104
+ *
105
+ * Host-driven refresh never reaches the pool: it renews only this integration's
106
+ * placeholder and refuses every other credential without replacing it. Plugins
107
+ * must register under their own method IDs; a plugin importing an existing
108
+ * host login should read it through `ctx.integration.connection` instead.
109
+ */
110
+ export declare function registerOpenCode2AuthMethods<T>(ctx: {
111
+ readonly integration: Pick<Plugin.Context['integration'], 'transform'>;
112
+ }, options: RegisterOpenCode2AuthMethodsOptions<T>): Promise<Registration>;
@@ -0,0 +1,12 @@
1
+ /** One server-sent event: its `event:` name, if any, and its joined `data:` lines. */
2
+ export interface ServerSentEvent {
3
+ readonly event?: string;
4
+ readonly data: string;
5
+ }
6
+ /**
7
+ * A pass-through stream that hands every complete server-sent event to
8
+ * `onEvent` while forwarding the original bytes unchanged, so the host still
9
+ * consumes the body exactly once. A throwing `onEvent` is reported to
10
+ * `onError` and never breaks the stream.
11
+ */
12
+ export declare function watchServerSentEvents(onEvent: (event: ServerSentEvent) => void, onError: (error: unknown) => void): TransformStream<Uint8Array, Uint8Array>;