@cortexkit/opencode-openai-auth 1.23.0 → 1.23.2

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 (234) hide show
  1. package/dist/bin.js +8 -8
  2. package/dist/{index-897br01q.js → index-49ncs7dr.js} +1 -1
  3. package/dist/{index-s7dwe5n8.js → index-by5wfvqm.js} +20 -20
  4. package/dist/{index-bbrpg1ms.js → index-drm4dk5y.js} +1 -1
  5. package/dist/index-nd2ks7er.js +2 -0
  6. package/dist/index-t876xhkr.js +60 -0
  7. package/dist/{index-fasy4end.js → index-td4g5dc9.js} +1 -1
  8. package/dist/{index-7hcv94as.js → index-v8w8j1wx.js} +1 -1
  9. package/dist/{index-r31f36mn.js → index-v8wrmhyp.js} +1 -1
  10. package/dist/{index-bpx4spyr.js → index-wjp3q15r.js} +1 -1
  11. package/dist/{index-f340dq90.js → index-x00sxt2w.js} +10 -10
  12. package/dist/index.d.ts +4 -3
  13. package/dist/index.js +1 -1
  14. package/dist/{runtime-layout-B07ApQZL.d.ts → internal-DacVgEWs.d.ts} +86 -663
  15. package/dist/rpc/port-file.js +1 -1
  16. package/dist/rpc/protocol.js +1 -1
  17. package/dist/rpc/rpc-client.js +1 -1
  18. package/dist/runtime-layout-Dcbj_Rq3.d.ts +650 -0
  19. package/dist/{sidebar-state--OTpRzFd.d.ts → sidebar-state-L--CdbLi.d.ts} +4 -15
  20. package/dist/sidebar-state.d.ts +1 -1
  21. package/dist/sidebar-state.js +1 -1
  22. package/dist/tui-preferences.js +1 -1
  23. package/dist/tui.d.ts +5 -2
  24. package/dist/v2/server.d.ts +2 -1
  25. package/dist/v2/server.js +4 -4
  26. package/package.json +6 -6
  27. package/src/tui-compiled/raw/shared/054118b2705fdc20-ansi.js +98 -0
  28. package/src/tui-compiled/raw/shared/0895e780489c494d-window.js +33 -0
  29. package/src/tui-compiled/raw/shared/0b7d24474e2f33e9-credential-redaction.js +424 -0
  30. package/src/tui-compiled/raw/shared/0c9533222cb4380c-namespace.js +224 -0
  31. package/src/tui-compiled/raw/shared/112607e46a5b5f58-accounts.js +393 -0
  32. package/src/tui-compiled/raw/shared/136fa4abe48ad69d-cachekeep.js +411 -0
  33. package/src/tui-compiled/raw/shared/1547bd74f4214d2d-index.js +28 -0
  34. package/src/tui-compiled/raw/shared/1567207f323dc733-codex-http.js +44 -0
  35. package/src/tui-compiled/raw/shared/15f402885cbb2fb3-envelope-loss.js +151 -0
  36. package/src/tui-compiled/raw/shared/18df43cab4563acf-families.js +149 -0
  37. package/src/tui-compiled/raw/shared/1a4c289eec261e04-codex-instructions.js +59 -0
  38. package/src/tui-compiled/raw/shared/1afd446e190ef85c-vault-messages.js +12 -0
  39. package/src/tui-compiled/raw/shared/1b06ec96856ff8b9-codex-endpoint.js +17 -0
  40. package/src/tui-compiled/raw/shared/1e2f1a89bb34a773-vault-adapter.js +110 -0
  41. package/src/tui-compiled/raw/shared/2194fb8e8b42d7d5-insula-quota.js +73 -0
  42. package/src/tui-compiled/raw/shared/22b2bce42f2d6806-handle.js +10 -0
  43. package/src/tui-compiled/raw/shared/2577ec69f9973ae9-quota-normalize.js +13 -14
  44. package/src/tui-compiled/raw/shared/26055d4e5ad5e71f-codex-request.js +198 -0
  45. package/src/tui-compiled/raw/shared/26b57ac4c3b0c3f6-unconfirmed-retain-counter.js +41 -0
  46. package/src/tui-compiled/raw/shared/2bb681e99c2721d7-registry.js +538 -0
  47. package/src/tui-compiled/raw/shared/2dce6e9613993329-quota-manager.js +13 -20
  48. package/src/tui-compiled/raw/shared/2ec33b3e2b8ac38a-terminal.js +168 -0
  49. package/src/tui-compiled/raw/shared/30bcca1d1b4240a0-pool-session-pins.js +32 -0
  50. package/src/tui-compiled/raw/shared/3af9a210aa2ccdf2-codex-call-status.js +21 -0
  51. package/src/tui-compiled/raw/shared/3b31b36bf0877602-wording.js +120 -0
  52. package/src/tui-compiled/raw/shared/3c4c1a2d3fc92726-failure.js +59 -0
  53. package/src/tui-compiled/raw/shared/3dfe71eec6e0487d-presets.js +240 -0
  54. package/src/tui-compiled/raw/shared/43de3a5c4845cfc1-pool-adapter.js +149 -0
  55. package/src/tui-compiled/raw/shared/49353b63a833c8fb-session-cache-policy.js +60 -0
  56. package/src/tui-compiled/raw/shared/4adf46e07e025363-axes.js +7 -0
  57. package/src/tui-compiled/raw/shared/4ba847b77580b1eb-confirm.js +21 -0
  58. package/src/tui-compiled/raw/shared/4d05c2d7a531aece-oauth.js +48 -36
  59. package/src/tui-compiled/raw/shared/5018d4665e969588-limit-policy.js +159 -0
  60. package/src/tui-compiled/raw/shared/595bdf3fff13ba79-limit-identity.js +49 -0
  61. package/src/tui-compiled/raw/shared/59def9e82b61204a-session-cache-activity.js +35 -0
  62. package/src/tui-compiled/raw/shared/5d806e1a305d14f5-commands.js +879 -0
  63. package/src/tui-compiled/raw/shared/5fc39320fa8bd3a0-limit-registry.js +473 -0
  64. package/src/tui-compiled/raw/shared/63c1ee7e70e85e8d-vault.js +1 -0
  65. package/src/tui-compiled/raw/shared/6545ab7f757314b7-refresh-all-quota.js +237 -0
  66. package/src/tui-compiled/raw/shared/66937534c260d20b-stable-json.js +11 -0
  67. package/src/tui-compiled/raw/shared/7056acef1b021f19-bridge.js +10 -0
  68. package/src/tui-compiled/raw/shared/72d2ca42883809b4-marker.js +107 -0
  69. package/src/tui-compiled/raw/shared/775431e21f469203-record.js +3 -0
  70. package/src/tui-compiled/raw/shared/799f3ade4efbd1ea-opencode-v1.js +47 -0
  71. package/src/tui-compiled/raw/shared/7b2a0471b29e4f5e-wake.js +47 -0
  72. package/src/tui-compiled/raw/shared/7b5d6afff4ff32b9-select.js +159 -0
  73. package/src/tui-compiled/raw/shared/7bf96bf4d9249b3d-vault-billing.js +108 -0
  74. package/src/tui-compiled/raw/shared/7c98bde36aad4819-input-transformations.js +34 -0
  75. package/src/tui-compiled/raw/shared/7fb0418303f20a10-index.js +3 -0
  76. package/src/tui-compiled/raw/shared/806e12ccbad34388-pi-wait.js +51 -0
  77. package/src/tui-compiled/raw/shared/81ae201b724cac14-menu.js +73 -0
  78. package/src/tui-compiled/raw/shared/8349ed25dc629e97-scope.js +10 -0
  79. package/src/tui-compiled/raw/shared/86da3379973780b9-limit-provenance.js +60 -0
  80. package/src/tui-compiled/raw/shared/8aba66ed486d30a7-decide.js +425 -0
  81. package/src/tui-compiled/raw/shared/8c0c8df25a5dca1f-manager.js +735 -0
  82. package/src/tui-compiled/raw/shared/8c42bbec02f59636-vault-routing.js +212 -0
  83. package/src/tui-compiled/raw/shared/8ca6175bfae53e13-envelope.js +123 -0
  84. package/src/tui-compiled/raw/shared/8d0245e41049d83f-header-classifier.js +121 -0
  85. package/src/tui-compiled/raw/shared/9c162809179c7560-login.js +89 -0
  86. package/src/tui-compiled/raw/shared/a1f495296a4b756f-frame-turn.js +72 -0
  87. package/src/tui-compiled/raw/shared/a37138dcbd893f55-hold-bounds.js +5 -0
  88. package/src/tui-compiled/raw/shared/aa7fb10d77a2cccd-vault-account-menu.js +133 -0
  89. package/src/tui-compiled/raw/shared/adc5eeb5a8d28280-persistence.js +9 -0
  90. package/src/tui-compiled/raw/shared/b301c79e6378d1fb-vault.js +678 -0
  91. package/src/tui-compiled/raw/shared/b3c11de5f36e617a-reset.js +44 -0
  92. package/src/tui-compiled/raw/shared/ba6535c610d1edb3-pool-source-state.js +100 -0
  93. package/src/tui-compiled/raw/shared/bd4aef685681048c-duration.js +20 -0
  94. package/src/tui-compiled/raw/shared/bd5977eca210d2b8-index.js +662 -0
  95. package/src/tui-compiled/raw/shared/bfc46d34f4c9db33-limit-recovery.js +127 -0
  96. package/src/tui-compiled/raw/shared/c66495424ad84aee-hold.js +25 -0
  97. package/src/tui-compiled/raw/shared/c6a67b836bd5afcd-vault-command-menu.js +300 -0
  98. package/src/tui-compiled/raw/shared/c9340fb545c4e5de-internal.js +73 -0
  99. package/src/tui-compiled/raw/shared/c954c6447b7b9b64-activity.js +52 -0
  100. package/src/tui-compiled/raw/shared/cba8b0aee46b8526-codex-lite.js +85 -0
  101. package/src/tui-compiled/raw/shared/cec39ccddab4fe9c-labels.js +11 -0
  102. package/src/tui-compiled/raw/shared/cef0f2346957e83c-index.js +552 -0
  103. package/src/tui-compiled/raw/shared/cf7dedf24f902d68-dump-size.js +41 -0
  104. package/src/tui-compiled/raw/shared/d422d6dbc4e35199-background-quota-refresh.js +107 -0
  105. package/src/tui-compiled/raw/shared/d5b268767d330507-doctor.js +81 -0
  106. package/src/tui-compiled/raw/shared/d7ac5ca41f49121b-index.js +12 -0
  107. package/src/tui-compiled/raw/shared/d7fa77560855dee2-jitter.js +9 -0
  108. package/src/tui-compiled/raw/shared/de7f7d8803624369-path.js +31 -0
  109. package/src/tui-compiled/raw/shared/df0bdc74fb0c0db0-limit-mark.js +27 -0
  110. package/src/tui-compiled/raw/shared/e26c2bb5722ab047-routing-hold.js +23 -0
  111. package/src/tui-compiled/raw/shared/e2ae081583adfce3-dump.js +80 -0
  112. package/src/tui-compiled/raw/shared/e44ba1b3a9903f5d-reset-credits.js +483 -0
  113. package/src/tui-compiled/raw/shared/e5229952fc12f647-codex-models.js +34 -0
  114. package/src/tui-compiled/raw/shared/e8fda84e90176436-uuid-v7.js +13 -0
  115. package/src/tui-compiled/raw/shared/ea56007991dbf068-terminal.js +19 -0
  116. package/src/tui-compiled/raw/shared/ec6f1d96e7d70174-quota-refusal.js +145 -0
  117. package/src/tui-compiled/raw/shared/f03d7b43a214a4a1-canonical-input.js +42 -0
  118. package/src/tui-compiled/raw/shared/f1012265b3a768c7-merge-laws.js +31 -0
  119. package/src/tui-compiled/raw/shared/f2ca864fe967415a-cache-policy.js +198 -0
  120. package/src/tui-compiled/raw/shared/f317a4740f9d76f8-identity.js +21 -0
  121. package/src/tui-compiled/raw/shared/f607353c4126272a-routing-wait.js +19 -0
  122. package/src/tui-compiled/raw/shared/f6189f5c9aee31eb-decision.js +55 -0
  123. package/src/tui-compiled/raw/shared/f6d728f5e601f98b-request-history.js +120 -0
  124. package/src/tui-compiled/raw/shared/f981e6b15fb76cdb-codex-body.js +28 -0
  125. package/src/tui-compiled/raw/shared/fda579e5a0a54165-codex-effort.js +60 -0
  126. package/src/tui-compiled/raw/sidebar-state.js +54 -4
  127. package/src/tui-compiled/raw/tui/v2-dialog.js +1 -1
  128. package/src/tui-compiled/raw/tui.tsx +27 -5
  129. package/src/tui-compiled/runtime/shared/054118b2705fdc20-ansi.js +98 -0
  130. package/src/tui-compiled/runtime/shared/0895e780489c494d-window.js +33 -0
  131. package/src/tui-compiled/runtime/shared/0b7d24474e2f33e9-credential-redaction.js +424 -0
  132. package/src/tui-compiled/runtime/shared/0c9533222cb4380c-namespace.js +224 -0
  133. package/src/tui-compiled/runtime/shared/112607e46a5b5f58-accounts.js +393 -0
  134. package/src/tui-compiled/runtime/shared/136fa4abe48ad69d-cachekeep.js +411 -0
  135. package/src/tui-compiled/runtime/shared/1547bd74f4214d2d-index.js +28 -0
  136. package/src/tui-compiled/runtime/shared/1567207f323dc733-codex-http.js +44 -0
  137. package/src/tui-compiled/runtime/shared/15f402885cbb2fb3-envelope-loss.js +151 -0
  138. package/src/tui-compiled/runtime/shared/18df43cab4563acf-families.js +149 -0
  139. package/src/tui-compiled/runtime/shared/1a4c289eec261e04-codex-instructions.js +59 -0
  140. package/src/tui-compiled/runtime/shared/1afd446e190ef85c-vault-messages.js +12 -0
  141. package/src/tui-compiled/runtime/shared/1b06ec96856ff8b9-codex-endpoint.js +17 -0
  142. package/src/tui-compiled/runtime/shared/1e2f1a89bb34a773-vault-adapter.js +110 -0
  143. package/src/tui-compiled/runtime/shared/2194fb8e8b42d7d5-insula-quota.js +73 -0
  144. package/src/tui-compiled/runtime/shared/22b2bce42f2d6806-handle.js +10 -0
  145. package/src/tui-compiled/runtime/shared/2577ec69f9973ae9-quota-normalize.js +13 -14
  146. package/src/tui-compiled/runtime/shared/26055d4e5ad5e71f-codex-request.js +198 -0
  147. package/src/tui-compiled/runtime/shared/26b57ac4c3b0c3f6-unconfirmed-retain-counter.js +41 -0
  148. package/src/tui-compiled/runtime/shared/2bb681e99c2721d7-registry.js +538 -0
  149. package/src/tui-compiled/runtime/shared/2dce6e9613993329-quota-manager.js +13 -20
  150. package/src/tui-compiled/runtime/shared/2ec33b3e2b8ac38a-terminal.js +168 -0
  151. package/src/tui-compiled/runtime/shared/30bcca1d1b4240a0-pool-session-pins.js +32 -0
  152. package/src/tui-compiled/runtime/shared/3af9a210aa2ccdf2-codex-call-status.js +21 -0
  153. package/src/tui-compiled/runtime/shared/3b31b36bf0877602-wording.js +120 -0
  154. package/src/tui-compiled/runtime/shared/3c4c1a2d3fc92726-failure.js +59 -0
  155. package/src/tui-compiled/runtime/shared/3dfe71eec6e0487d-presets.js +240 -0
  156. package/src/tui-compiled/runtime/shared/43de3a5c4845cfc1-pool-adapter.js +149 -0
  157. package/src/tui-compiled/runtime/shared/49353b63a833c8fb-session-cache-policy.js +60 -0
  158. package/src/tui-compiled/runtime/shared/4adf46e07e025363-axes.js +7 -0
  159. package/src/tui-compiled/runtime/shared/4ba847b77580b1eb-confirm.js +21 -0
  160. package/src/tui-compiled/runtime/shared/4d05c2d7a531aece-oauth.js +48 -36
  161. package/src/tui-compiled/runtime/shared/5018d4665e969588-limit-policy.js +159 -0
  162. package/src/tui-compiled/runtime/shared/595bdf3fff13ba79-limit-identity.js +49 -0
  163. package/src/tui-compiled/runtime/shared/59def9e82b61204a-session-cache-activity.js +35 -0
  164. package/src/tui-compiled/runtime/shared/5d806e1a305d14f5-commands.js +879 -0
  165. package/src/tui-compiled/runtime/shared/5fc39320fa8bd3a0-limit-registry.js +473 -0
  166. package/src/tui-compiled/runtime/shared/63c1ee7e70e85e8d-vault.js +1 -0
  167. package/src/tui-compiled/runtime/shared/6545ab7f757314b7-refresh-all-quota.js +237 -0
  168. package/src/tui-compiled/runtime/shared/66937534c260d20b-stable-json.js +11 -0
  169. package/src/tui-compiled/runtime/shared/7056acef1b021f19-bridge.js +10 -0
  170. package/src/tui-compiled/runtime/shared/72d2ca42883809b4-marker.js +107 -0
  171. package/src/tui-compiled/runtime/shared/775431e21f469203-record.js +3 -0
  172. package/src/tui-compiled/runtime/shared/799f3ade4efbd1ea-opencode-v1.js +47 -0
  173. package/src/tui-compiled/runtime/shared/7b2a0471b29e4f5e-wake.js +47 -0
  174. package/src/tui-compiled/runtime/shared/7b5d6afff4ff32b9-select.js +159 -0
  175. package/src/tui-compiled/runtime/shared/7bf96bf4d9249b3d-vault-billing.js +108 -0
  176. package/src/tui-compiled/runtime/shared/7c98bde36aad4819-input-transformations.js +34 -0
  177. package/src/tui-compiled/runtime/shared/7fb0418303f20a10-index.js +3 -0
  178. package/src/tui-compiled/runtime/shared/806e12ccbad34388-pi-wait.js +51 -0
  179. package/src/tui-compiled/runtime/shared/81ae201b724cac14-menu.js +73 -0
  180. package/src/tui-compiled/runtime/shared/8349ed25dc629e97-scope.js +10 -0
  181. package/src/tui-compiled/runtime/shared/86da3379973780b9-limit-provenance.js +60 -0
  182. package/src/tui-compiled/runtime/shared/8aba66ed486d30a7-decide.js +425 -0
  183. package/src/tui-compiled/runtime/shared/8c0c8df25a5dca1f-manager.js +735 -0
  184. package/src/tui-compiled/runtime/shared/8c42bbec02f59636-vault-routing.js +212 -0
  185. package/src/tui-compiled/runtime/shared/8ca6175bfae53e13-envelope.js +123 -0
  186. package/src/tui-compiled/runtime/shared/8d0245e41049d83f-header-classifier.js +121 -0
  187. package/src/tui-compiled/runtime/shared/9c162809179c7560-login.js +89 -0
  188. package/src/tui-compiled/runtime/shared/a1f495296a4b756f-frame-turn.js +72 -0
  189. package/src/tui-compiled/runtime/shared/a37138dcbd893f55-hold-bounds.js +5 -0
  190. package/src/tui-compiled/runtime/shared/aa7fb10d77a2cccd-vault-account-menu.js +133 -0
  191. package/src/tui-compiled/runtime/shared/adc5eeb5a8d28280-persistence.js +9 -0
  192. package/src/tui-compiled/runtime/shared/b301c79e6378d1fb-vault.js +678 -0
  193. package/src/tui-compiled/runtime/shared/b3c11de5f36e617a-reset.js +44 -0
  194. package/src/tui-compiled/runtime/shared/ba6535c610d1edb3-pool-source-state.js +100 -0
  195. package/src/tui-compiled/runtime/shared/bd4aef685681048c-duration.js +20 -0
  196. package/src/tui-compiled/runtime/shared/bd5977eca210d2b8-index.js +662 -0
  197. package/src/tui-compiled/runtime/shared/bfc46d34f4c9db33-limit-recovery.js +127 -0
  198. package/src/tui-compiled/runtime/shared/c66495424ad84aee-hold.js +25 -0
  199. package/src/tui-compiled/runtime/shared/c6a67b836bd5afcd-vault-command-menu.js +300 -0
  200. package/src/tui-compiled/runtime/shared/c9340fb545c4e5de-internal.js +73 -0
  201. package/src/tui-compiled/runtime/shared/c954c6447b7b9b64-activity.js +52 -0
  202. package/src/tui-compiled/runtime/shared/cba8b0aee46b8526-codex-lite.js +85 -0
  203. package/src/tui-compiled/runtime/shared/cec39ccddab4fe9c-labels.js +11 -0
  204. package/src/tui-compiled/runtime/shared/cef0f2346957e83c-index.js +552 -0
  205. package/src/tui-compiled/runtime/shared/cf7dedf24f902d68-dump-size.js +41 -0
  206. package/src/tui-compiled/runtime/shared/d422d6dbc4e35199-background-quota-refresh.js +107 -0
  207. package/src/tui-compiled/runtime/shared/d5b268767d330507-doctor.js +81 -0
  208. package/src/tui-compiled/runtime/shared/d7ac5ca41f49121b-index.js +12 -0
  209. package/src/tui-compiled/runtime/shared/d7fa77560855dee2-jitter.js +9 -0
  210. package/src/tui-compiled/runtime/shared/de7f7d8803624369-path.js +31 -0
  211. package/src/tui-compiled/runtime/shared/df0bdc74fb0c0db0-limit-mark.js +27 -0
  212. package/src/tui-compiled/runtime/shared/e26c2bb5722ab047-routing-hold.js +23 -0
  213. package/src/tui-compiled/runtime/shared/e2ae081583adfce3-dump.js +80 -0
  214. package/src/tui-compiled/runtime/shared/e44ba1b3a9903f5d-reset-credits.js +483 -0
  215. package/src/tui-compiled/runtime/shared/e5229952fc12f647-codex-models.js +34 -0
  216. package/src/tui-compiled/runtime/shared/e8fda84e90176436-uuid-v7.js +13 -0
  217. package/src/tui-compiled/runtime/shared/ea56007991dbf068-terminal.js +19 -0
  218. package/src/tui-compiled/runtime/shared/ec6f1d96e7d70174-quota-refusal.js +145 -0
  219. package/src/tui-compiled/runtime/shared/f03d7b43a214a4a1-canonical-input.js +42 -0
  220. package/src/tui-compiled/runtime/shared/f1012265b3a768c7-merge-laws.js +31 -0
  221. package/src/tui-compiled/runtime/shared/f2ca864fe967415a-cache-policy.js +198 -0
  222. package/src/tui-compiled/runtime/shared/f317a4740f9d76f8-identity.js +21 -0
  223. package/src/tui-compiled/runtime/shared/f607353c4126272a-routing-wait.js +19 -0
  224. package/src/tui-compiled/runtime/shared/f6189f5c9aee31eb-decision.js +55 -0
  225. package/src/tui-compiled/runtime/shared/f6d728f5e601f98b-request-history.js +120 -0
  226. package/src/tui-compiled/runtime/shared/f981e6b15fb76cdb-codex-body.js +28 -0
  227. package/src/tui-compiled/runtime/shared/fda579e5a0a54165-codex-effort.js +60 -0
  228. package/src/tui-compiled/runtime/sidebar-state.js +54 -4
  229. package/src/tui-compiled/runtime/tui/v2-dialog.js +1 -1
  230. package/src/tui-compiled/runtime/tui.js +11 -4
  231. package/dist/index-2z4dbnsf.js +0 -60
  232. package/dist/index-x25m9spd.js +0 -2
  233. package/dist/map-D5PHhv4z.d.ts +0 -72
  234. /package/dist/{index-sx9jjkry.js → index-4ktepxn1.js} +0 -0
@@ -1 +1 @@
1
- import{Xg as b,Yg as c}from"../index-r31f36mn.js";import{bh as a}from"../index-bbrpg1ms.js";import"../index-sx9jjkry.js";import"../index-j700j6at.js";import"../index-q2czrasr.js";export{b as writePortFile,c as isOpenaiRpcStateDir,a as discoverPortFile};
1
+ import{Xg as b,Yg as c}from"../index-v8wrmhyp.js";import{bh as a}from"../index-drm4dk5y.js";import"../index-4ktepxn1.js";import"../index-j700j6at.js";import"../index-q2czrasr.js";export{b as writePortFile,c as isOpenaiRpcStateDir,a as discoverPortFile};
@@ -1 +1 @@
1
- import{mh as b}from"../index-bpx4spyr.js";import"../index-fasy4end.js";import"../index-sx9jjkry.js";import"../index-q2czrasr.js";export{b as isNotifyPayload};
1
+ import{mh as b}from"../index-wjp3q15r.js";import"../index-td4g5dc9.js";import"../index-4ktepxn1.js";import"../index-q2czrasr.js";export{b as isNotifyPayload};
@@ -1 +1 @@
1
- import{ch as F,dh as f}from"../index-bbrpg1ms.js";import"../index-sx9jjkry.js";import"../index-q2czrasr.js";function y(r,s,v){return f(r,s,v)}export{y as createRpcClient,F as DEFAULT_RPC_TIMEOUT_MS};
1
+ import{ch as F,dh as f}from"../index-drm4dk5y.js";import"../index-4ktepxn1.js";import"../index-q2czrasr.js";function y(r,s,v){return f(r,s,v)}export{y as createRpcClient,F as DEFAULT_RPC_TIMEOUT_MS};
@@ -0,0 +1,650 @@
1
+ import { f as AccountPaths } from "./internal-DacVgEWs.js";
2
+ interface LockLoss {
3
+ readonly reason: 'taken-over' | 'expired' | 'unreadable' | 'renewal-failed' | 'marker-lost';
4
+ readonly expectedOwnerId: string;
5
+ readonly observedOwnerId?: string;
6
+ readonly observedExpiresAt?: number;
7
+ }
8
+ interface RefreshFileLock {
9
+ readonly ownerId: string;
10
+ assertOwned(): Promise<void>;
11
+ /** Abort stops release retries; the unrenewed lease is left to expire by TTL. */
12
+ release(signal?: AbortSignal): Promise<void>;
13
+ /** Resolves once on detected loss; remains pending after an owner's release. */
14
+ whenLost(): Promise<LockLoss>;
15
+ hasLost(): boolean;
16
+ }
17
+ type RefreshFileLockOptions = {
18
+ name: string;
19
+ ttlMs: number;
20
+ /**
21
+ * File the lock is named after. Required: the lock and the write it guards
22
+ * must target the same file, and a default resolved in here could only ever
23
+ * be one host's path.
24
+ */
25
+ path: string;
26
+ renew?: boolean;
27
+ renewIntervalMs?: number;
28
+ /** Notifies a live-owner refusal without awaiting; observer failures are ignored. */
29
+ onContended?: () => void;
30
+ /** Synchronous, never awaited; throws and returned promise/thenable rejections are isolated. */
31
+ onRenewalTimer?: (event: 'scheduled' | 'cancelled') => void;
32
+ onStep?: (step: 'stale-marker-stat' | 'stale-marker-claimed' | 'stale-lock-observed' | 'lease-contention-read-ready' | 'lock-read-ready' | 'lock-missing' | 'stale-lock-confirmed' | 'stale-lock-removed' | 'stale-lock-recreated' | 'eviction-marker-acquired' | 'renewal-owner-confirmed' | 'renewal-marker-unavailable' | 'renewal-write-fenced' | 'renewal-write-ready' | 'renewal-write-finished' | 'relinquish-read' | 'renewal-finished' | 'release-owner-confirmed') => void | Promise<void>;
33
+ };
34
+ /** Filesystem leases share wall time across all callers and processes. */
35
+ declare function acquireRefreshFileLock(options: RefreshFileLockOptions): Promise<RefreshFileLock | null>;
36
+ interface QuotaCommitTimer {
37
+ now(): number;
38
+ schedule(delayMs: number, run: () => Promise<void>): {
39
+ cancel(): void;
40
+ unref?(): void;
41
+ };
42
+ }
43
+ type OAuthCredential = {
44
+ type: 'oauth';
45
+ access?: string;
46
+ refresh: string;
47
+ expires?: number;
48
+ };
49
+ type ApiKeyCredential = {
50
+ type: 'api';
51
+ apiKey: string;
52
+ baseURL: string;
53
+ authHeader?: 'authorization-bearer' | 'x-api-key';
54
+ };
55
+ /** A credential as stored: an OAuth credential also carries its refresh stamp. */
56
+ type StoredCredential = (OAuthCredential & {
57
+ lastRefreshedAt?: number;
58
+ }) | ApiKeyCredential;
59
+ /** Quota codec supplied by `/quota`: the store never interprets the map itself. */
60
+ interface QuotaCodec {
61
+ validate(value: unknown): boolean;
62
+ /** Normalize persisted quota before validation, when the codec supports it. */
63
+ decode?(value: unknown): unknown;
64
+ merge(stored: unknown | undefined, observation: unknown): unknown;
65
+ }
66
+ /**
67
+ * What `ProviderStateCodec.onReplace` is told about a replacement: the row id,
68
+ * the credential epoch the new credential starts, `previousIdentity` (the
69
+ * identity the locked row recorded before the replace), `identity` (the
70
+ * identity the replace records), and the provider state the caller handed to
71
+ * `replace`, if any. Each identity is absent when none was recorded.
72
+ */
73
+ interface ProviderStateReplacement {
74
+ id: string;
75
+ credentialEpoch: number;
76
+ previousIdentity?: string;
77
+ identity?: string;
78
+ incoming?: unknown;
79
+ }
80
+ /**
81
+ * Codec for the provider state a plugin keeps beside each row's credential
82
+ * (a project id, a device fingerprint, eligibility times: whatever belongs to
83
+ * that credential). The store never interprets the value: it stores it as
84
+ * JSON, asks `validate` before every write and on every load, and calls the
85
+ * hooks below where two values meet. Every hook is synchronous and runs
86
+ * under the store locks.
87
+ */
88
+ interface ProviderStateCodec {
89
+ validate(value: unknown): boolean;
90
+ /**
91
+ * The part of a (valid) value that belongs to the credential: what is true
92
+ * of the account the credential signs in to, such as a project id or a
93
+ * device fingerprint, as opposed to what the plugin merely tracks about
94
+ * its use, such as a cooldown or a cursor. The credential stamp covers the
95
+ * digest of exactly this projection, so a foreign edit of it hides the
96
+ * value, while the rest may change through `updateProviderState` without
97
+ * the stamp being rewritten. It must be a pure function of the value that
98
+ * returns JSON with a deterministic key order. Without it the whole value
99
+ * is credential-bound.
100
+ */
101
+ credentialBound?(value: unknown): unknown;
102
+ /**
103
+ * Combines the value on disk with one a write brings (`add` of a secret the
104
+ * pool already holds, `rotate`, or a refresh whose provider returned a
105
+ * state). Called only when the row has a value on disk; without it the
106
+ * incoming value replaces the stored one. Its result is validated.
107
+ */
108
+ merge?(onDisk: unknown, incoming: unknown): unknown;
109
+ /**
110
+ * The provider state of a row once `replace` gives it a new credential
111
+ * epoch. `previous` is the old credential's value (undefined when the row
112
+ * shows none). Returning undefined clears it. Without this hook a replace
113
+ * keeps the value handed to `replace` and otherwise clears the state.
114
+ */
115
+ onReplace?(previous: unknown | undefined, replacement: ProviderStateReplacement): unknown | undefined;
116
+ }
117
+ /** Every library operation that can fail, as named in the failure value. */
118
+ type PoolOperation = 'initialize' | 'add' | 'replace' | 'rotate' | 'disable' | 'enable' | 'remove' | 'reorder' | 'updateSettings' | 'updateLimitsNamespace' | 'recordIdentity' | 'updateProviderState' | 'refresh' | 'pull' | 'publishRoster';
119
+ /**
120
+ * How far an operation got before it failed.
121
+ *
122
+ * `before-first-write`: nothing was written; both files are as they were.
123
+ * `after-first-write`: the operation's first file write landed and a later one
124
+ * did not; what that first write left is on disk and is never rolled back
125
+ * (add: a state entry no roster row names, which no reader loads; replace:
126
+ * the new credential stamped ahead of the config, which readers show as a
127
+ * torn row and the next store write on it completes; rotate: the rotated
128
+ * credential beside the old per-row entry). `pull`: a quota pull, or the
129
+ * recording of its result, failed.
130
+ */
131
+ type PoolFailurePhase = 'before-first-write' | 'after-first-write' | 'pull';
132
+ /**
133
+ * Why an operation failed. `lock-contention` and `lock-ownership` are the two
134
+ * lock outcomes (a wait that ran out, and a lease found lost); the rest are
135
+ * refusals and failures of the operation itself.
136
+ */
137
+ type PoolFailureKind = 'lock-contention' | 'lock-ownership' | 'pending-migration' | 'load-error' | 'snapshot-contended' | 'publication-sync' | 'publication-incomplete' | 'unknown-row' | 'invalid-row' | 'invalid-input' | 'id-exists' | 'id-removed' | 'type-mismatch' | 'no-credential' | 'row-disabled' | 'row-protected' | 'row-staged' | 'credential-exists' | 'publication-mismatch' | 'duplicate-identity' | 'identity-mismatch' | 'identity-contradicted' | 'endpoint-mismatch' | 'row-key-changed' | 'invalid-order' | 'refresh-stamp-ahead' | 'unbound-credential' | 'attribution' | 'provider' | 'pull' | 'invalid-quota' | 'invalid-provider-state' | 'after-persist-hook' | 'unexpected';
138
+ /**
139
+ * The single failure value of every store operation. `committed` is present
140
+ * only when the operation had already written a credential to the state file
141
+ * before it failed (a partial rotation or refresh): it is the credential now
142
+ * on disk, so a caller never has to re-read the files to learn it.
143
+ */
144
+ declare class PoolOperationError extends Error {
145
+ readonly operation: PoolOperation;
146
+ readonly rowId: string | undefined;
147
+ readonly phase: PoolFailurePhase;
148
+ readonly retryable: boolean;
149
+ readonly kind: PoolFailureKind;
150
+ readonly committed: StoredCredential | undefined;
151
+ constructor(details: {
152
+ operation: PoolOperation;
153
+ rowId?: string;
154
+ phase: PoolFailurePhase;
155
+ retryable: boolean;
156
+ kind: PoolFailureKind;
157
+ committed?: StoredCredential;
158
+ message?: string;
159
+ cause?: unknown;
160
+ });
161
+ }
162
+ interface PoolLogger {
163
+ warn(message: string, data?: unknown): void;
164
+ }
165
+ type LockStep = NonNullable<Parameters<typeof acquireRefreshFileLock>[0]['onStep']> extends ((step: infer S) => unknown) ? S : never;
166
+ /** Tuning shared by every lock the store takes; each field is overridable. */
167
+ interface PoolLockOptions {
168
+ ttlMs: number;
169
+ timeoutMs: number;
170
+ retryMs: number;
171
+ renew: boolean;
172
+ renewIntervalMs?: number;
173
+ }
174
+ /** A lock: the (name, path) pair naming its file plus optional tuning. */
175
+ interface PoolLockSpec extends Partial<PoolLockOptions> {
176
+ name: string;
177
+ path: string;
178
+ }
179
+ type LockEvent = {
180
+ type: 'acquired' | 'released' | 'contended';
181
+ name: string;
182
+ path: string;
183
+ };
184
+ interface LockEnvironment {
185
+ onLockEvent?: (event: LockEvent) => void;
186
+ onLockStep?: (lock: {
187
+ name: string;
188
+ path: string;
189
+ }, step: LockStep) => void | Promise<void>;
190
+ onRenewalTimer?: (lock: {
191
+ name: string;
192
+ path: string;
193
+ }, event: 'scheduled' | 'cancelled') => void;
194
+ }
195
+ /** Named points on the write path, for crash and ownership injection. */
196
+ type WriteStep = 'before-config-write' | 'after-config-write' | 'before-state-write' | 'after-state-write';
197
+ /** Awaitable pause points on the pull and refresh paths. */
198
+ type HoldPoint = 'refresh-before-provider' | 'pull-before-request';
199
+ interface StoreContext {
200
+ provider: string;
201
+ configPath: string;
202
+ statePath: string;
203
+ codec: QuotaCodec;
204
+ /** The provider-state codec; without one no row shows a provider state. */
205
+ providerState?: ProviderStateCodec;
206
+ now: () => number;
207
+ storeLocks: readonly PoolLockSpec[];
208
+ lockDefaults: PoolLockOptions;
209
+ lockEnv: LockEnvironment;
210
+ logger?: PoolLogger;
211
+ onStep?: (step: WriteStep, info: {
212
+ operation: PoolOperation;
213
+ rowId: string | undefined;
214
+ }) => void | Promise<void>;
215
+ hold?: (point: HoldPoint, rowId: string) => void | Promise<void>;
216
+ /** Ids whose per-row entry a library write dropped in this process. */
217
+ removedIds: Set<string>;
218
+ /**
219
+ * When true, rows whose credential stamp is not bound load `unbound` and
220
+ * the operations that use a credential refuse them (see
221
+ * `OpenPoolStoreOptions.requireCredentialStamps`).
222
+ */
223
+ requireCredentialStamps?: boolean;
224
+ requireRemovedFingerprint?: boolean;
225
+ }
226
+ /** Where a pull was fired from; `load` fires at most once per process per row. */
227
+ type PullReason = 'load' | 'add' | 'replace' | 'admission';
228
+ /** What a pull is issued with: the credential and its attribution tuple. */
229
+ interface PullRequest {
230
+ id: string;
231
+ credential: StoredCredential;
232
+ credentialEpoch: number;
233
+ identity?: string;
234
+ reason: PullReason;
235
+ }
236
+ type PullHook = (request: PullRequest) => Promise<unknown>;
237
+ interface OpenPoolStoreOptions {
238
+ /** The provider every row of this pool belongs to; keys the provider-wide lock. */
239
+ provider: string;
240
+ configPath: string;
241
+ statePath: string;
242
+ quota: QuotaCodec;
243
+ /**
244
+ * Opt in to detached, coalesced quota publication, with any `quota` codec.
245
+ * Each accepted observation is queued whole for its row and binding, and
246
+ * the queue is applied in arrival order through `quota.merge` under the
247
+ * store locks, so the codec's own merge decides which fields a newer or
248
+ * older reading replaces. Accepted readings appear in read/load
249
+ * immediately, merged the same way; the returned promise still rejects
250
+ * current-row refusals before queueing. Await dispose or close at shutdown
251
+ * to attempt a bounded drain; readings still pending at its timeout are
252
+ * discarded. Normal quota commits are at least 30 seconds apart; a full
253
+ * queue commits early so response handling never waits for that interval.
254
+ */
255
+ coalesceQuota?: boolean;
256
+ /** Bounded quota drain on close/dispose, in milliseconds; defaults to 1,000. */
257
+ quotaDrainTimeoutMs?: number;
258
+ /** Monotonic clock and scheduling seam for detached quota commits. */
259
+ quotaCommitTimer?: QuotaCommitTimer;
260
+ /**
261
+ * The codec of the provider state kept beside each row's credential (see
262
+ * `ProviderStateCodec`). Without it no row shows a provider state, and
263
+ * every write that would set one refuses (`invalid-input`); writes that
264
+ * leave it alone keep the value on disk as it is, and `replace` clears it.
265
+ */
266
+ providerState?: ProviderStateCodec;
267
+ /**
268
+ * Refuse every credential this store did not stamp (default false, which
269
+ * loads unstamped and mis-stamped credentials as older writers left them).
270
+ * When true, a row whose `stamp` is not `bound` loads `unbound` and is no
271
+ * candidate, and every operation that would use or keep its credential or
272
+ * what was observed about it (`refresh`, quota pulls, `recordQuota`,
273
+ * `recordIdentity`, `rotate`, and an `add` of the same secret or onto the
274
+ * same credential-less row) refuses with `unbound-credential` before any
275
+ * provider call or write, checked again under the locks and at commit.
276
+ * Nothing makes such a row bound except `replace`, which starts a new
277
+ * credential epoch and drops what was observed about the old one.
278
+ * An interrupted add's state-only orphan is recovered only when its stamp
279
+ * binds the stored and incoming material, including a supplied identity and
280
+ * an API key's endpoint/header. Otherwise add refuses `unbound-credential`
281
+ * without writing; `remove(id)` explicitly discards the orphan.
282
+ */
283
+ requireCredentialStamps?: boolean;
284
+ /** Require an exact secret fingerprint for every roster-publication removal. */
285
+ requireRemovedFingerprint?: boolean;
286
+ /** Logical clock for refresh stamps and `addedAt`; filesystem leases always use wall time. */
287
+ now?: () => number;
288
+ /**
289
+ * Ordered store-lock list held across every read-modify-write. Defaults to
290
+ * the older writers' `save` lock at the config path, then at the state path.
291
+ */
292
+ storeLocks?: readonly PoolLockSpec[];
293
+ /** Defaults for every lock the store takes (see `POOL_LOCK_DEFAULTS`). */
294
+ lockOptions?: Partial<PoolLockOptions>;
295
+ /** Overrides for the row locks only. */
296
+ rowLockOptions?: Partial<PoolLockOptions>;
297
+ /** The provider-wide lock; defaults to `provider-<provider>` beside the state file. */
298
+ providerLock?: PoolLockSpec;
299
+ /** Quota pull hook, fired without being awaited. */
300
+ pull?: PullHook;
301
+ /** Receives every pull failure, since no caller awaits a pull. */
302
+ onPullFailure?: (rowId: string, error: PoolOperationError) => void | Promise<void>;
303
+ logger?: PoolLogger;
304
+ /** Named write steps, awaited; a test seam for crash and ownership rows. */
305
+ onStep?: StoreContext['onStep'];
306
+ /** Awaitable hold points on the refresh and pull paths; a test seam. */
307
+ hold?: (point: HoldPoint, rowId: string) => void | Promise<void>;
308
+ onLockEvent?: LockEnvironment['onLockEvent'];
309
+ onLockStep?: LockEnvironment['onLockStep'];
310
+ onRenewalTimer?: LockEnvironment['onRenewalTimer'];
311
+ }
312
+ interface CodexEffortState {
313
+ pinnedEffort?: string;
314
+ effortUpdates?: Array<{
315
+ anchor: number;
316
+ fingerprint: string;
317
+ effort: string;
318
+ }>;
319
+ }
320
+ interface CanonicalInput {
321
+ texts: string[];
322
+ snapshots: unknown[];
323
+ retainable: boolean;
324
+ }
325
+ declare const CODEX_VERSION = "0.166.0";
326
+ declare const CODEX_USER_AGENT = "codex_exec/0.166.0 (Debian 12.0.0; aarch64) unknown (codex_exec; 0.166.0)";
327
+ interface CodexSessionMetadata extends CodexEffortState {
328
+ threadID: string;
329
+ turnID: string;
330
+ windowID: string;
331
+ turnStartedAt?: number;
332
+ input?: unknown[];
333
+ canonicalInput?: CanonicalInput;
334
+ }
335
+ interface CodexRequestRuntime {
336
+ now: () => number;
337
+ uuid: () => string;
338
+ }
339
+ interface IdTokenClaims {
340
+ chatgpt_account_id?: string;
341
+ email?: string;
342
+ organizations?: Array<{
343
+ id: string;
344
+ }>;
345
+ 'https://api.openai.com/auth'?: {
346
+ chatgpt_account_id?: string;
347
+ };
348
+ }
349
+ declare function parseJwtClaims(token: string): IdTokenClaims | undefined;
350
+ declare function extractAccountIdFromClaims(claims: IdTokenClaims): string | undefined;
351
+ interface TokenResponse {
352
+ id_token: string;
353
+ access_token: string;
354
+ refresh_token: string;
355
+ expires_in?: number;
356
+ }
357
+ /**
358
+ * Minimal shape of a fallback OAuth account for ingestion. Matches the
359
+ * fields used by upsertAccount and beginAccountLogin, compatible with
360
+ * the full OAuthAccount type in accounts.ts.
361
+ */
362
+ interface IngestAccount {
363
+ id: string;
364
+ label?: string;
365
+ type: 'oauth';
366
+ access?: string;
367
+ refresh: string;
368
+ expires?: number;
369
+ enabled: boolean;
370
+ addedAt: number;
371
+ lastUsed: number;
372
+ /**
373
+ * When the token was obtained. Stamped at login so a freshly added account
374
+ * carries a refresh marker — without it, the runtime-state merge cannot tell a
375
+ * rotated token from a stale one (both default to 0) and a concurrent stale
376
+ * save could roll the token back.
377
+ */
378
+ lastRefreshedAt?: number;
379
+ /** Stable ChatGPT account identifier from the OAuth token claims. */
380
+ accountId?: string;
381
+ }
382
+ interface BeginAccountLoginOptions {
383
+ label?: string;
384
+ headless?: boolean;
385
+ signal?: AbortSignal;
386
+ /** Host package version, sent as the version half of the `User-Agent`. */
387
+ version: string;
388
+ }
389
+ interface BeginAccountLoginResult {
390
+ url: string;
391
+ instructions: string;
392
+ /** Resolves after the user completes the OAuth flow with a ready-to-ingest account. */
393
+ completion: Promise<IngestAccount>;
394
+ }
395
+ /** One live process that keeps the fence shut. */
396
+ interface VersionFenceBlocker {
397
+ /** `'unknown'` when a whole directory could not be read. */
398
+ pid: number | 'unknown';
399
+ /** The version its heartbeat or port file names, or `'unknown'`. */
400
+ version: string;
401
+ /** The file or directory that showed it. */
402
+ detail: string;
403
+ }
404
+ type VersionFenceResult = {
405
+ open: true;
406
+ } | {
407
+ open: false;
408
+ blockers: VersionFenceBlocker[];
409
+ };
410
+ /** The host login slot, shaped like the plugin's `client.auth`. */
411
+ interface HostSlotAdapter {
412
+ /** The shared auth.json path, independent of a plugin's config root. */
413
+ path?: string;
414
+ migrationDisabledReason?: () => string | undefined;
415
+ get(input: {
416
+ path: {
417
+ id: string;
418
+ };
419
+ }): Promise<unknown>;
420
+ set(input: {
421
+ path: {
422
+ id: string;
423
+ };
424
+ body: unknown;
425
+ }): Promise<unknown>;
426
+ all(): Promise<Record<string, unknown>>;
427
+ }
428
+ interface PoolMigrationLogger {
429
+ info(message: string, data?: Record<string, unknown>): void;
430
+ warn(message: string, data?: Record<string, unknown>): void;
431
+ }
432
+ /** Named points between this module's own writes; awaited, for crash tests. */
433
+ type PoolMigrationStep = 'after-pool-key-write' | 'after-record-write' | 'after-row-write' | 'after-verify' | 'after-carry-over' | 'before-placeholder-write' | 'after-placeholder-write' | 'after-record-clear' | 'after-marker-write';
434
+ /** Timing of the legacy file locks and of waits on them. */
435
+ interface LegacyLockOptions {
436
+ mainRefreshTtlMs: number;
437
+ fallbackTtlMs: number;
438
+ /** Lease of the `save` lock pair around this module's own config writes. */
439
+ saveTtlMs: number;
440
+ renew: boolean;
441
+ renewIntervalMs?: number;
442
+ /** How long to wait for a held legacy lock before giving up (real clock). */
443
+ timeoutMs: number;
444
+ retryMs: number;
445
+ }
446
+ interface PoolMigrationDeps {
447
+ paths: AccountPaths;
448
+ slot: HostSlotAdapter;
449
+ /** Stop waiting for transfer locks; a transfer already holding them finishes. */
450
+ signal?: AbortSignal;
451
+ now?: () => number;
452
+ sleep?: (ms: number) => Promise<void>;
453
+ /** Id for a new row whose login carries no usable wire identity. */
454
+ newId?: () => string;
455
+ log?: PoolMigrationLogger;
456
+ legacyLocks?: Partial<LegacyLockOptions>;
457
+ /** Bound and poll interval for waiting out an active legacy main lease. */
458
+ leaseWait?: {
459
+ timeoutMs: number;
460
+ pollMs: number;
461
+ };
462
+ /** Pass-through options for the pool store this module opens. */
463
+ store?: Partial<Pick<OpenPoolStoreOptions, 'lockOptions' | 'rowLockOptions' | 'providerLock' | 'storeLocks' | 'onStep' | 'onLockEvent'>>;
464
+ onStep?: (step: PoolMigrationStep) => void | Promise<void>;
465
+ /**
466
+ * Whether the Claustrum vault serves this host's accounts. The built-in
467
+ * adopter does not change course on it: a pool row for an account the
468
+ * vault also holds is skipped by the account source (`pool-account-source.ts`),
469
+ * which neither routes nor refreshes it locally, so adoption can safely
470
+ * move a slot login into the pool and put the placeholder back. The
471
+ * placeholder has to be back: OpenCode 1 installs the plugin's fetch only
472
+ * when its `openai` slot holds an OAuth value.
473
+ */
474
+ vaultServes?: () => boolean;
475
+ }
476
+ type SlotNothingKind = 'api' | 'placeholder' | 'empty' | 'tombstone' | 'slot-absent' | 'declined';
477
+ type PoolTransferOutcome = {
478
+ status: 'slot-read-only';
479
+ reason: string;
480
+ } |
481
+ /**
482
+ * The adoption left the slot alone because the vault serves this host's
483
+ * accounts. The built-in adopter (`adoptHostSlotLogin`) no longer returns
484
+ * this; it can still come from a custom adopter passed to the background
485
+ * runner (`adopt` in `pool-lifecycle.ts`).
486
+ */
487
+ {
488
+ status: 'vault-owns-accounts';
489
+ } |
490
+ /**
491
+ * An openai-auth process older than this one is running (see
492
+ * `version-fence.ts`); nothing was written. The migration runs once they
493
+ * are gone.
494
+ */
495
+ {
496
+ status: 'deferred';
497
+ reason: 'older-version-running';
498
+ blockers: VersionFenceBlocker[];
499
+ } |
500
+ /** Migration already recorded as done; nothing was imported. */
501
+ {
502
+ status: 'already-migrated';
503
+ } |
504
+ /**
505
+ * The slot holds the placeholder, but it was not this store that moved the
506
+ * login out of the slot. The transfer record below is the pending-transfer
507
+ * record in this store's config, written before a transfer touches a row.
508
+ * - `placeholder-without-main`: another store sharing this login slot
509
+ * moved the login, so the login is that store's. Either this store has
510
+ * no `main` row and no transfer record, and nothing is written; or this
511
+ * store's own transfer was under way and found the placeholder tagged
512
+ * with another config root, and only the copy that transfer had put into
513
+ * a row is removed (the other store holds the login now) and the record
514
+ * cleared.
515
+ * - `placeholder-origin-unknown`: this store has a transfer record, but
516
+ * the placeholder is untagged (it has no `accountId` naming the config
517
+ * root that wrote it; builds before this one wrote it that way). The
518
+ * row copy may be this store's only copy of the credential, so it is not
519
+ * deleted; another store may own the login, so the row is disabled
520
+ * rather than routed or refreshed. The record is cleared so that a later
521
+ * background run does not find it and disable the row again after
522
+ * someone has re-enabled it.
523
+ */
524
+ {
525
+ status: 'refused';
526
+ reason: 'placeholder-without-main' | 'placeholder-origin-unknown';
527
+ } |
528
+ /** Adoption asked for before the migration ran. */
529
+ {
530
+ status: 'not-migrated';
531
+ } | {
532
+ status: 'nothing-to-import';
533
+ slot: SlotNothingKind;
534
+ } | {
535
+ status: 'completed';
536
+ rowId: string;
537
+ operation: 'add' | 'rotate' | 'replace' | 'resumed';
538
+ /**
539
+ * `written`: the placeholder was written and read back.
540
+ * `already-present`: a resumed run found the placeholder in place.
541
+ * `slot-moved-on`: the slot changed to another value before the fence;
542
+ * it is left for the next adoption. (A placeholder replaced between its
543
+ * write and the readback ends the run as `retry`,
544
+ * `placeholder-overwritten`, not here.)
545
+ */
546
+ placeholder: 'written' | 'already-present' | 'slot-moved-on';
547
+ } |
548
+ /**
549
+ * An interrupted transfer's row holds neither its old credential nor the
550
+ * slot's: someone rotated it after the interruption, so the slot copy may
551
+ * be stale. The slot is left alone and this exact slot value is declined
552
+ * for adoption; the user's next login resolves it.
553
+ */
554
+ {
555
+ status: 'ambiguous';
556
+ rowId: string;
557
+ } | {
558
+ status: 'retry';
559
+ reason: 'host-slot-indeterminate' | 'legacy-refresh-in-progress' | 'lock-contention' | 'verify-failed' | 'torn-read' | 'slot-changed' |
560
+ /**
561
+ * Something replaced the placeholder between its write and the
562
+ * readback. The record and the shield stay, since the slot may hold
563
+ * the very token the row now holds; the next run reads the slot
564
+ * again and finishes the transfer from what it finds.
565
+ */
566
+ 'placeholder-overwritten' | 'unsettled' |
567
+ /**
568
+ * An adoption found the vault's first roster read still unfinished
569
+ * after its wait, so whether the vault serves this host was unknown;
570
+ * nothing was adopted.
571
+ */
572
+ 'vault-roster-pending' | `store-${string}`;
573
+ } | {
574
+ status: 'error';
575
+ reason: string;
576
+ };
577
+ /** What the migration needs beyond an adoption run. */
578
+ interface PoolMigrationFenceDeps {
579
+ /**
580
+ * The version fence (`migrationFenceOpen` in `version-fence.ts`, bound to
581
+ * this build's version). While it is shut the migration writes nothing.
582
+ */
583
+ fence: () => Promise<VersionFenceResult>;
584
+ }
585
+ /**
586
+ * One-time move of the host-slot credential into the pool row `main`
587
+ * (fallback rows are already pool rows: same ids, same files). It writes
588
+ * nothing while an older openai-auth process runs (`deferred`). A re-run
589
+ * after completion does nothing.
590
+ */
591
+ declare function migrateToPool(deps: PoolMigrationDeps & PoolMigrationFenceDeps): Promise<PoolTransferOutcome>;
592
+ /**
593
+ * After migration: a real login found in the host slot (someone ran
594
+ * `/login openai` in OpenCode) moves into the pool, matched by wire identity,
595
+ * and the placeholder goes back into the slot.
596
+ */
597
+ declare function adoptHostSlotLogin(deps: PoolMigrationDeps): Promise<PoolTransferOutcome>;
598
+ interface PoolLifecycleTimers {
599
+ set(run: () => void, ms: number): unknown;
600
+ clear(handle: unknown): void;
601
+ }
602
+ interface PoolLifecycleDeps {
603
+ /** Read at every run, so it follows the configured store path. */
604
+ paths: () => AccountPaths;
605
+ slot: HostSlotAdapter;
606
+ /** This build's version, for the version fence. */
607
+ version: string;
608
+ log?: PoolMigrationLogger;
609
+ /** Defaults to `migrationFenceOpen` for `version`. */
610
+ fence?: () => Promise<VersionFenceResult>;
611
+ migrate?: typeof migrateToPool;
612
+ adopt?: typeof adoptHostSlotLogin;
613
+ timers?: PoolLifecycleTimers;
614
+ random?: () => number;
615
+ /** Passed through to every migration and adoption run (tests). */
616
+ runDeps?: Partial<PoolMigrationDeps>;
617
+ /**
618
+ * True while no migration or adoption may run: the host is in vault mode,
619
+ * which writes no local account file. Read before every run.
620
+ */
621
+ paused?: () => boolean | Promise<boolean>;
622
+ }
623
+ interface RuntimeLayoutLogger {
624
+ info(message: string, meta?: Record<string, unknown>): unknown;
625
+ warn(message: string, meta?: Record<string, unknown>): unknown;
626
+ }
627
+ interface RuntimeLayoutOptions {
628
+ /** This build's version, for the version fence. */
629
+ version: string;
630
+ log?: RuntimeLayoutLogger;
631
+ /** Defaults to `migrationFenceOpen` for `version`, with the layout checks. */
632
+ fence?: () => Promise<VersionFenceResult>;
633
+ /**
634
+ * Test seams, run at one step of the move. A step that throws stands in for
635
+ * a crash there: nothing after it runs.
636
+ */
637
+ steps?: {
638
+ afterCopy?: () => void | Promise<void>;
639
+ afterMarker?: () => void | Promise<void>;
640
+ /**
641
+ * Runs right before each removal of an old file, of the move's
642
+ * `layout-moving.json` and of the old vault folder, ahead of the lease
643
+ * check that guards it.
644
+ */
645
+ beforeRemove?: (path: string) => void | Promise<void>;
646
+ };
647
+ /** Test seam: how long to wait for the layout lock. */
648
+ layoutLockWaitMs?: number;
649
+ }
650
+ export { BeginAccountLoginResult as a, extractAccountIdFromClaims as c, CODEX_VERSION as d, CodexRequestRuntime as f, BeginAccountLoginOptions as i, parseJwtClaims as l, PoolLifecycleDeps as n, IdTokenClaims as o, CodexSessionMetadata as p, HostSlotAdapter as r, TokenResponse as s, RuntimeLayoutOptions as t, CODEX_USER_AGENT as u };