@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,2 +1,2 @@
1
- import{Ah as y,Ch as m,Eh as h,uh as K,xh as T,zh as A}from"./index-sx9jjkry.js";import{appendFileSync as r,chmodSync as i,existsSync as L,renameSync as F,statSync as e}from"node:fs";import{open as C0}from"node:fs/promises";import{dirname as G0,resolve as H0}from"node:path";var s=/^(authorization|x-api-key|cookie|set-cookie|refresh|access|token)$/i,o=/\b(Bearer\s+[\w.-]+|sk-[\w-]+|eyJ[\w.-]+)\b|ckh_[A-Za-z0-9_-]{20,}/g;function t(C){return C instanceof Error||Object.prototype.toString.call(C)==="[object Error]"}function q(C={}){let H=[o,...C.extraValuePatterns??[]].map((G)=>new RegExp(G.source,G.flags.includes("g")?G.flags:`${G.flags}g`));function $(G){let J=G.toLowerCase().replace(/[-_]/g,"");return s.test(G)||J.includes("apikey")||J.endsWith("secret")||J.endsWith("password")||J.endsWith("token")&&!J.endsWith("tokens")||!!C.extraSecretKeys?.(J)}function U(G){let J=G,Q=[["name",G.name],["message",G.message],["stack",G.stack]];for(let V of["code","status","cause"])if(J[V]!==void 0)Q.push([V,J[V]]);let N=new Set(Q.map(([V])=>V));for(let V of Object.entries(G))if(!N.has(V[0]))Q.push(V);return Q}function B(G,J,Q,N=0){if(typeof G==="string")return H.reduce((V,X)=>V.replace(X,"***REDACTED***"),G);if(!G||typeof G!=="object")return G;if(Q.has(G))return"[Circular]";Q.add(G);try{if(Array.isArray(G))return G.map((Y)=>B(Y,J,Q,N));let V=t(G);if(V&&N>=8)return"[Truncated]";let X=V?N+1:N;return Object.fromEntries((V?U(G):Object.entries(G)).map(([Y,O])=>[Y,J&&$(Y)?"***REDACTED***":B(O,J,Q,X)]))}finally{Q.delete(G)}}return{redact:(G)=>B(G,!0,new WeakSet),redactStrings:(G)=>B(G,!1,new WeakSet)}}var E=q(),n=E.redact,l=E.redactStrings;var R={error:0,warn:1,info:2,debug:3,trace:4},w=5242880,p=3;function P(C){try{i(C,384)}catch{}}function I0(C){try{if(!(L(C)&&e(C).size>=w))return;for(let $=p-1;$>=1;$--)if(L(`${C}.${$}`)){let U=`${C}.${$+1}`;F(`${C}.${$}`,U),P(U)}let H=`${C}.1`;F(C,H),P(H)}catch{}}async function M(C){let{file:H,handle:$}=C;if(C.file=void 0,C.handle=void 0,H&&$)await T(H,"log-close",()=>$.close())}async function g(C,H){await y(G0(H));try{await A(H,"file",!0)}catch($){if($.code!=="ENOENT")throw $;try{await m(H,"")}catch(U){if(U.code!=="EEXIST")throw U;await A(H,"file",!0)}}return C.handle=await T(H,"log-open",()=>C0(H,"a")),C.file=H,C.handle}async function J0(C,H,$){H=H0(H);try{if(C.file!==H)await M(C);let U=C.handle??await g(C,H);if((await T(H,"log-stat",()=>U.stat())).size>=w){await M(C);for(let G=p-1;G>=0;G--){let J=G===0?H:`${H}.${G}`,Q=`${H}.${G+1}`;try{await A(J,"file",!0)}catch(N){if(N.code==="ENOENT")continue;throw N}try{await A(Q,"file",!0)}catch(N){if(N.code!=="ENOENT")throw N}await h(J,Q),await A(Q,"file")}U=await g(C,H)}await T(H,"log-append",()=>U.appendFile($,"utf8"))}catch(U){throw await M(C).catch(()=>{}),U}}function Q0(C){try{return` ${JSON.stringify(C)}`}catch{return" [unserializable]"}}function Z0(C){let H,$,U,B=q(),G,J=[],Q,N=Promise.resolve(),V,X={};function Y(I){let Z=N.then(I);return N=Z.catch((j)=>{V=j}),Z}function O(I){if(K&&I.file!==H)Y(()=>M(X)).catch(()=>{});H=I.file,$=I.level,B=q(I),G=I.captureSink}function k(I){if(I===void 0||I in R)U=I}function v(){if(H===void 0)return;return(typeof H==="function"?H():H)||void 0}function c(){if(U)return U;let I=typeof $==="function"?$():$;if(I&&I in R)return I;return"info"}function D(I=!0){if(Q)clearTimeout(Q),Q=void 0;if(!J.length){if(K)return Y(async()=>{if(I)await M(X);if(V)throw V});return}let Z;try{Z=v()}catch{if(J=[],K&&I)return Y(()=>M(X));return}let j=J.join("");if(J=[],!Z){if(K&&I)return Y(()=>M(X));return}if(K)return Y(async()=>{try{await J0(X,Z,j)}finally{if(I)await M(X)}});try{if(I0(Z),L(Z))P(Z);r(Z,j,{encoding:"utf8",mode:384})}catch{}}function f(){if(!Q)Q=setTimeout(()=>{Q=void 0;let I=D(!1);if(I instanceof Promise)I.catch(()=>{})},500)}function z(I,Z,j,W){if(H===void 0&&G===void 0)return;try{if(R[Z]>R[c()])return;let b=B.redactStrings(j),x;try{x=B.redact(W)}catch{x="[unserializable]"}let a=`[${new Date().toISOString()}] ${Z.toUpperCase()} [${I}] ${b}`+(W===void 0?"":Q0(x))+`
1
+ import{Ah as y,Ch as m,Eh as h,uh as K,xh as T,zh as A}from"./index-4ktepxn1.js";import{appendFileSync as r,chmodSync as i,existsSync as L,renameSync as F,statSync as e}from"node:fs";import{open as C0}from"node:fs/promises";import{dirname as G0,resolve as H0}from"node:path";var s=/^(authorization|x-api-key|cookie|set-cookie|refresh|access|token)$/i,o=/\b(Bearer\s+[\w.-]+|sk-[\w-]+|eyJ[\w.-]+)\b|ckh_[A-Za-z0-9_-]{20,}/g;function t(C){return C instanceof Error||Object.prototype.toString.call(C)==="[object Error]"}function q(C={}){let H=[o,...C.extraValuePatterns??[]].map((G)=>new RegExp(G.source,G.flags.includes("g")?G.flags:`${G.flags}g`));function $(G){let J=G.toLowerCase().replace(/[-_]/g,"");return s.test(G)||J.includes("apikey")||J.endsWith("secret")||J.endsWith("password")||J.endsWith("token")&&!J.endsWith("tokens")||!!C.extraSecretKeys?.(J)}function U(G){let J=G,Q=[["name",G.name],["message",G.message],["stack",G.stack]];for(let V of["code","status","cause"])if(J[V]!==void 0)Q.push([V,J[V]]);let N=new Set(Q.map(([V])=>V));for(let V of Object.entries(G))if(!N.has(V[0]))Q.push(V);return Q}function B(G,J,Q,N=0){if(typeof G==="string")return H.reduce((V,X)=>V.replace(X,"***REDACTED***"),G);if(!G||typeof G!=="object")return G;if(Q.has(G))return"[Circular]";Q.add(G);try{if(Array.isArray(G))return G.map((Y)=>B(Y,J,Q,N));let V=t(G);if(V&&N>=8)return"[Truncated]";let X=V?N+1:N;return Object.fromEntries((V?U(G):Object.entries(G)).map(([Y,O])=>[Y,J&&$(Y)?"***REDACTED***":B(O,J,Q,X)]))}finally{Q.delete(G)}}return{redact:(G)=>B(G,!0,new WeakSet),redactStrings:(G)=>B(G,!1,new WeakSet)}}var E=q(),n=E.redact,l=E.redactStrings;var R={error:0,warn:1,info:2,debug:3,trace:4},w=5242880,p=3;function P(C){try{i(C,384)}catch{}}function I0(C){try{if(!(L(C)&&e(C).size>=w))return;for(let $=p-1;$>=1;$--)if(L(`${C}.${$}`)){let U=`${C}.${$+1}`;F(`${C}.${$}`,U),P(U)}let H=`${C}.1`;F(C,H),P(H)}catch{}}async function M(C){let{file:H,handle:$}=C;if(C.file=void 0,C.handle=void 0,H&&$)await T(H,"log-close",()=>$.close())}async function g(C,H){await y(G0(H));try{await A(H,"file",!0)}catch($){if($.code!=="ENOENT")throw $;try{await m(H,"")}catch(U){if(U.code!=="EEXIST")throw U;await A(H,"file",!0)}}return C.handle=await T(H,"log-open",()=>C0(H,"a")),C.file=H,C.handle}async function J0(C,H,$){H=H0(H);try{if(C.file!==H)await M(C);let U=C.handle??await g(C,H);if((await T(H,"log-stat",()=>U.stat())).size>=w){await M(C);for(let G=p-1;G>=0;G--){let J=G===0?H:`${H}.${G}`,Q=`${H}.${G+1}`;try{await A(J,"file",!0)}catch(N){if(N.code==="ENOENT")continue;throw N}try{await A(Q,"file",!0)}catch(N){if(N.code!=="ENOENT")throw N}await h(J,Q),await A(Q,"file")}U=await g(C,H)}await T(H,"log-append",()=>U.appendFile($,"utf8"))}catch(U){throw await M(C).catch(()=>{}),U}}function Q0(C){try{return` ${JSON.stringify(C)}`}catch{return" [unserializable]"}}function Z0(C){let H,$,U,B=q(),G,J=[],Q,N=Promise.resolve(),V,X={};function Y(I){let Z=N.then(I);return N=Z.catch((j)=>{V=j}),Z}function O(I){if(K&&I.file!==H)Y(()=>M(X)).catch(()=>{});H=I.file,$=I.level,B=q(I),G=I.captureSink}function k(I){if(I===void 0||I in R)U=I}function v(){if(H===void 0)return;return(typeof H==="function"?H():H)||void 0}function c(){if(U)return U;let I=typeof $==="function"?$():$;if(I&&I in R)return I;return"info"}function D(I=!0){if(Q)clearTimeout(Q),Q=void 0;if(!J.length){if(K)return Y(async()=>{if(I)await M(X);if(V)throw V});return}let Z;try{Z=v()}catch{if(J=[],K&&I)return Y(()=>M(X));return}let j=J.join("");if(J=[],!Z){if(K&&I)return Y(()=>M(X));return}if(K)return Y(async()=>{try{await J0(X,Z,j)}finally{if(I)await M(X)}});try{if(I0(Z),L(Z))P(Z);r(Z,j,{encoding:"utf8",mode:384})}catch{}}function f(){if(!Q)Q=setTimeout(()=>{Q=void 0;let I=D(!1);if(I instanceof Promise)I.catch(()=>{})},500)}function z(I,Z,j,W){if(H===void 0&&G===void 0)return;try{if(R[Z]>R[c()])return;let b=B.redactStrings(j),x;try{x=B.redact(W)}catch{x="[unserializable]"}let a=`[${new Date().toISOString()}] ${Z.toUpperCase()} [${I}] ${b}`+(W===void 0?"":Q0(x))+`
2
2
  `;try{G?.({channel:I,level:Z,message:b,data:x})}catch{}if(H===void 0)return;if(J.push(a),J.length>=50){let S=D(!1);if(S instanceof Promise)S.catch(()=>{})}else f()}catch{}}function u(I){return{error:(Z,j)=>z(I,"error",Z,j),warn:(Z,j)=>z(I,"warn",Z,j),info:(Z,j)=>z(I,"info",Z,j),debug:(Z,j)=>z(I,"debug",Z,j),trace:(Z,j)=>z(I,"trace",Z,j)}}function d(){if(K)Y(()=>M(X)).catch(()=>{});if(V=void 0,J=[],Q)clearTimeout(Q),Q=void 0;H=void 0,$=void 0,U=void 0,B=q(),G=void 0}if(C)O(C);return{configure:O,createLogger:u,setLogLevel:k,flushLogs:D,reset:d}}var _=Z0();function $0(C){_.configure(C);let{configure:H,createLogger:$,setLogLevel:U,flushLogs:B}=_;return{configure:H,createLogger:$,setLogLevel:U,flushLogs:B}}function U0(C){_.setLogLevel(C)}function V0(){return _.flushLogs()}function j0(C){return _.createLogger(C)}export{q as oh,n as ph,$0 as qh,U0 as rh,V0 as sh,j0 as th};
@@ -1,3 +1,3 @@
1
- import{Xc as X,Zc as V}from"./index-s7dwe5n8.js";import{randomUUID as Z}from"node:crypto";import{chmod as $,mkdir as G,readFile as H,rename as L,rm as T,stat as f,writeFile as g}from"node:fs/promises";import{dirname as k,resolve as w}from"node:path";var x="(no OpenCode 1 logins on this machine)";function C(b=process.env){return X(b)}async function Q(b){let z;try{z=await H(b,"utf8")}catch(q){if(q.code==="ENOENT")return;throw q}let j=JSON.parse(z);if(!j||typeof j!=="object"||Array.isArray(j))throw Error(`${b} does not hold a JSON object`);return j}function R(b){return b===void 0?void 0:JSON.stringify(b)}async function D(b){try{return(await f(b)).mode&511}catch(z){if(z.code==="ENOENT")return;throw z}}function _(b=C()){let z=new Map;return{path:w(b),async get(j){let q=(await Q(b))?.[j.path.id];return z.set(j.path.id,R(q)),q},async set(j){let q=j.path.id,W=await D(b),J=await Q(b)??{};if(!z.has(q)||z.get(q)!==R(J[q]))throw new V;J[q]=j.body,await G(k(b),{recursive:!0});let B=`${b}.${Z()}.tmp`;try{await g(B,`${JSON.stringify(J,null,2)}
1
+ import{Xc as X,Zc as V}from"./index-by5wfvqm.js";import{randomUUID as Z}from"node:crypto";import{chmod as $,mkdir as G,readFile as H,rename as L,rm as T,stat as f,writeFile as g}from"node:fs/promises";import{dirname as k,resolve as w}from"node:path";var x="(no OpenCode 1 logins on this machine)";function C(b=process.env){return X(b)}async function Q(b){let z;try{z=await H(b,"utf8")}catch(q){if(q.code==="ENOENT")return;throw q}let j=JSON.parse(z);if(!j||typeof j!=="object"||Array.isArray(j))throw Error(`${b} does not hold a JSON object`);return j}function R(b){return b===void 0?void 0:JSON.stringify(b)}async function D(b){try{return(await f(b)).mode&511}catch(z){if(z.code==="ENOENT")return;throw z}}function _(b=C()){let z=new Map;return{path:w(b),async get(j){let q=(await Q(b))?.[j.path.id];return z.set(j.path.id,R(q)),q},async set(j){let q=j.path.id,W=await D(b),J=await Q(b)??{};if(!z.has(q)||z.get(q)!==R(J[q]))throw new V;J[q]=j.body,await G(k(b),{recursive:!0});let B=`${b}.${Z()}.tmp`;try{await g(B,`${JSON.stringify(J,null,2)}
2
2
  `,{mode:W??384}),await $(B,W??384),await L(B,b)}catch(Y){throw await T(B,{force:!0}).catch(()=>{}),Y}return z.set(q,R(j.body)),!0},async all(){let j=await Q(b);if(!j||Object.keys(j).length===0)return{[x]:!0};return j}}}
3
3
  export{_ as c};
@@ -1,2 +1,2 @@
1
- import{$g as y,Zg as R,_g as T,ah as D}from"./index-bbrpg1ms.js";import{Bh as I,vh as v}from"./index-sx9jjkry.js";import{Hh as t}from"./index-j700j6at.js";class O extends Error{operation;constructor(f){super(`a ${f} on a strict notification scope needs a session id`);this.name="RpcSessionRequiredError",this.operation=f}}function S(f){return typeof f==="string"&&f.length>0}var g=new Map;function _(f){let x=JSON.stringify([f.rpcRoot,f.directoryPrefix,f.registrationSessionId,...f.requireSession===!0?["strict"]:[]]),P=g.get(x);if(!P)P={queue:[],nextId:1,lastDrainAtBySession:new Map,lastDrainAtAny:0},g.set(x,P);return P}var m=100,l=3000;function Vf(f,x,P){if(f.requireSession===!0&&!S(P))throw new O("push");let V=_(f);if(V.queue.push({id:V.nextId++,type:"open-dialog",payload:x,sessionId:P}),V.queue.length>m)V.queue=V.queue.slice(-m)}function Bf(f,x=0,P){if(f.requireSession===!0&&!S(P))throw new O("drain");let V=_(f),J=Date.now();if(V.lastDrainAtAny=J,P!==void 0)V.lastDrainAtBySession.set(P,J);let K=f.sessionlessDrain==="broadcast-only",H=(B)=>P===void 0?!K||B.sessionId===void 0:B.sessionId===void 0||B.sessionId===P;if(x>0)V.queue=V.queue.filter((B)=>{if(B.id>x)return!0;if(P===void 0)return!K||B.sessionId!==void 0;return B.sessionId!==P});return V.queue.filter((B)=>B.id>x&&H(B))}function Ff(f,x){let P=Date.now(),V=_(f),J=x!==void 0?V.lastDrainAtBySession.get(x)??0:f.sessionlessDrain==="broadcast-only"?V.lastDrainAtAny:0;return J>0&&P-J<l}import{randomBytes as a,timingSafeEqual as o}from"node:crypto";import{unlink as r}from"node:fs/promises";import{createServer as s}from"node:http";import{join as e}from"node:path";import{lstat as c}from"node:fs/promises";import{basename as d,dirname as i,resolve as k}from"node:path";var j=globalThis,w=Symbol.for("common-auth.rpc.startup-sweep");j[w]??={};var U=j[w],n=Date.now;async function q(f,x,P,V){let J=n();if(U.lastSweepAt!==void 0&&J-U.lastSweepAt<60000){let K=k(x);if(i(K)===k(f)&&P(d(K))&&(await c(K).catch((H)=>{if(H.code!=="ENOENT")throw H;return}))?.isDirectory())await D(K,V);return}U.lastSweepAt=J,await y(f,x,P,V)}class b extends Error{status;constructor(f,x){if(!Number.isInteger(f)||f<400||f>499)throw RangeError(`RpcRequestError status must be 4xx, got ${f}`);super(x);this.name="RpcRequestError",this.status=f}}var u=1e6;class E extends Error{declaredOversize;constructor(f){super("body too large");this.declaredOversize=f}}function ff(f){return new Promise((x,P)=>{let V=(B=!1)=>{f.removeAllListeners("data"),f.on("data",()=>{}),f.resume(),P(new E(B))},J=Number(f.headers["content-length"]);if(Number.isFinite(J)&&J>u){V(!0);return}let K=[],H=0;f.on("data",(B)=>{if(H+=B.length,H>u){V();return}K.push(B)}),f.on("end",()=>x(Buffer.concat(K).toString("utf8"))),f.on("error",P)})}class h extends Error{}async function xf(f,x){let P,V=new Promise((J,K)=>{P=setTimeout(()=>K(new h("apply deadline exceeded")),x),P.unref?.()});f.catch(()=>{});try{return await Promise.race([f,V])}finally{clearTimeout(P)}}function Pf(f,x){if(!f?.startsWith("Bearer "))return!1;let P=Buffer.from(f.slice(7)),V=Buffer.from(x);return P.length===V.length&&o(P,V)}async function Wf(f){if(typeof f.drain==="function"===(typeof f.drainAsync==="function"))throw TypeError("exactly one of drain or drainAsync must be provided");let x=f.log??{warn(){},debug(){}},P=a(32).toString("hex"),V=f.timeoutMs??90000,J=f.receiptTimeoutMs??2000,K=!1,H=new Set,B=s((z,G)=>{z.setTimeout(V,()=>{z.socket.destroy()}),M(z,G)});B.on("connection",(z)=>{H.add(z),z.once("close",()=>H.delete(z))}),B.requestTimeout=J,B.headersTimeout=J;async function M(z,G){let F=(X,W,C={})=>{if(G.headersSent||G.writableEnded||G.destroyed)return;G.writeHead(X,{"content-type":"application/json",...C}),G.end(JSON.stringify(W))};try{let X=new URL(z.url??"/","http://127.0.0.1").pathname;if(z.method==="GET"&&X==="/health")return F(200,{ok:!0});if(z.method!=="POST"||!X.startsWith("/rpc/"))return F(404,{error:"not found"});if(!Pf(z.headers.authorization,P))return F(401,{error:"unauthorized"});let W=X.slice(5),C;try{C=await ff(z)}catch(Y){if(!(Y instanceof E))throw Y;let Z=z.socket;if(G.once("finish",()=>{Z.end();let $=setTimeout(()=>Z.destroy(),2000);if($.unref(),z.once("end",()=>Z.destroy()),Z.once("close",()=>clearTimeout($)),z.complete)Z.destroy()}),!Y.declaredOversize&&!z.complete){if(G.headersSent||G.writableEnded||G.destroyed)return;let $=JSON.stringify({error:"body too large"});G.writeHead(413,{"content-type":"application/json","content-length":Buffer.byteLength($),connection:"close"}),G.write($),z.once("end",()=>G.end());return}return F(413,{error:"body too large"},{connection:"close"})}let Q;try{Q=JSON.parse(C||"{}")}catch{return F(400,{error:"invalid json"})}if(W==="pending-notifications"){let Y;try{if(f.parsePending)Y=f.parsePending(Q);else{if(!Q||typeof Q!=="object"||Array.isArray(Q))throw Error("invalid params");let L=Q;if(f.requireSession===!0&&!S(L.sessionId))return F(400,{error:"session required"});if("lastReceivedId"in L&&(typeof L.lastReceivedId!=="number"||!Number.isSafeInteger(L.lastReceivedId)||L.lastReceivedId<0)||"sessionId"in L&&typeof L.sessionId!=="string")throw Error("invalid params");Y={lastReceivedId:Number(L.lastReceivedId??0),sessionId:typeof L.sessionId==="string"?L.sessionId:void 0}}}catch(L){if(L instanceof b)throw L;return F(400,{error:"invalid params"})}let{lastReceivedId:Z,sessionId:$}=Y;if(f.requireSession===!0&&!S($))return F(400,{error:"session required"});if($===void 0&&!K)K=!0,x.warn("rpc notification drain missing session id",{pid:process.pid});let N;if(f.drainAsync)try{N=await f.drainAsync(Z,$)}catch(L){return x.warn("rpc notification drain failed",{pid:process.pid,error:L instanceof Error?L.message:String(L)}),F(500,{error:"drain failed"})}else N=f.drain?.(Z,$);return F(200,{messages:N})}if(W==="apply"){let Y=Promise.resolve(f.apply(Q)),Z=f.applyDeadlineMs===void 0?await Y:await xf(Y,f.applyDeadlineMs);return F(200,Z)}return F(404,{error:"unknown method"})}catch(X){if(X instanceof b)return x.debug("rpc request refused",{pid:process.pid,status:X.status}),F(X.status,{error:X.message});if(X instanceof h)return x.warn("rpc apply deadline exceeded",{pid:process.pid,deadlineMs:f.applyDeadlineMs}),F(504,{error:"handler deadline exceeded"});x.warn("rpc request failed",{pid:process.pid,error:X instanceof Error?X.message:String(X)}),F(500,{error:"internal error"})}}let A=await new Promise((z,G)=>{B.on("error",G),B.listen(0,"127.0.0.1",()=>{let F=B.address();if(F&&typeof F==="object")z(F.port);else G(Error("no port"))})});if(B.unref(),f.sweepRoot)try{await q(f.sweepRoot,f.dir,f.isManagedDir,x)}catch(z){x.warn("rpc state sweep failed",{pid:process.pid,error:z instanceof Error?z.message:String(z)})}try{await T(f.dir,{port:A,token:P,pid:process.pid},{secureDir:f.secureDir}),x.debug("rpc server pid",{pid:process.pid,rpcPort:A})}catch(z){throw await new Promise((G)=>B.close(()=>G())),z}return{port:A,token:P,async stop(){await new Promise((F)=>{B.closeAllConnections?.(),B.close(()=>F());for(let X of H)X.destroy()});let z=e(f.dir,`port-${process.pid}.json`),G=await I(z).then((F)=>JSON.parse(F)).catch((F)=>{if(F instanceof v&&F.code!=="ENOENT")throw F;return});if(G?.port===A&&G.token===P)await r(z).catch(()=>{})}}}async function Mf(f,x,P){let V=globalThis,J=Symbol.for(f),K=V[J]??{servers:new Map,pending:new Map};V[J]=K;let{servers:H,pending:B}=K,M=B.get(x)??Promise.resolve(),A,z=M.catch(()=>{}).then(async()=>{let F=H.get(x);if(F){if(await F.stop(),H.get(x)===F)H.delete(x)}A=await P(),H.set(x,A)});B.set(x,z);try{await z}finally{if(B.get(x)===z)B.delete(x)}let G=A;if(!G)throw Error("RPC server failed to start");return{server:G,release:async()=>{if(H.get(x)!==G)return;if(await G.stop(),H.get(x)===G)H.delete(x)}}}var p="1.23.0";function wf(f,x,P){let V={...x,version:p};return T(f,V,P)}var qf=R(t);
1
+ import{$g as y,Zg as R,_g as T,ah as D}from"./index-drm4dk5y.js";import{Bh as I,vh as v}from"./index-4ktepxn1.js";import{Hh as t}from"./index-j700j6at.js";class O extends Error{operation;constructor(f){super(`a ${f} on a strict notification scope needs a session id`);this.name="RpcSessionRequiredError",this.operation=f}}function S(f){return typeof f==="string"&&f.length>0}var g=new Map;function _(f){let x=JSON.stringify([f.rpcRoot,f.directoryPrefix,f.registrationSessionId,...f.requireSession===!0?["strict"]:[]]),P=g.get(x);if(!P)P={queue:[],nextId:1,lastDrainAtBySession:new Map,lastDrainAtAny:0},g.set(x,P);return P}var m=100,l=3000;function Vf(f,x,P){if(f.requireSession===!0&&!S(P))throw new O("push");let V=_(f);if(V.queue.push({id:V.nextId++,type:"open-dialog",payload:x,sessionId:P}),V.queue.length>m)V.queue=V.queue.slice(-m)}function Bf(f,x=0,P){if(f.requireSession===!0&&!S(P))throw new O("drain");let V=_(f),J=Date.now();if(V.lastDrainAtAny=J,P!==void 0)V.lastDrainAtBySession.set(P,J);let K=f.sessionlessDrain==="broadcast-only",H=(B)=>P===void 0?!K||B.sessionId===void 0:B.sessionId===void 0||B.sessionId===P;if(x>0)V.queue=V.queue.filter((B)=>{if(B.id>x)return!0;if(P===void 0)return!K||B.sessionId!==void 0;return B.sessionId!==P});return V.queue.filter((B)=>B.id>x&&H(B))}function Ff(f,x){let P=Date.now(),V=_(f),J=x!==void 0?V.lastDrainAtBySession.get(x)??0:f.sessionlessDrain==="broadcast-only"?V.lastDrainAtAny:0;return J>0&&P-J<l}import{randomBytes as a,timingSafeEqual as o}from"node:crypto";import{unlink as r}from"node:fs/promises";import{createServer as s}from"node:http";import{join as e}from"node:path";import{lstat as c}from"node:fs/promises";import{basename as d,dirname as i,resolve as k}from"node:path";var j=globalThis,w=Symbol.for("common-auth.rpc.startup-sweep");j[w]??={};var U=j[w],n=Date.now;async function q(f,x,P,V){let J=n();if(U.lastSweepAt!==void 0&&J-U.lastSweepAt<60000){let K=k(x);if(i(K)===k(f)&&P(d(K))&&(await c(K).catch((H)=>{if(H.code!=="ENOENT")throw H;return}))?.isDirectory())await D(K,V);return}U.lastSweepAt=J,await y(f,x,P,V)}class b extends Error{status;constructor(f,x){if(!Number.isInteger(f)||f<400||f>499)throw RangeError(`RpcRequestError status must be 4xx, got ${f}`);super(x);this.name="RpcRequestError",this.status=f}}var u=1e6;class E extends Error{declaredOversize;constructor(f){super("body too large");this.declaredOversize=f}}function ff(f){return new Promise((x,P)=>{let V=(B=!1)=>{f.removeAllListeners("data"),f.on("data",()=>{}),f.resume(),P(new E(B))},J=Number(f.headers["content-length"]);if(Number.isFinite(J)&&J>u){V(!0);return}let K=[],H=0;f.on("data",(B)=>{if(H+=B.length,H>u){V();return}K.push(B)}),f.on("end",()=>x(Buffer.concat(K).toString("utf8"))),f.on("error",P)})}class h extends Error{}async function xf(f,x){let P,V=new Promise((J,K)=>{P=setTimeout(()=>K(new h("apply deadline exceeded")),x),P.unref?.()});f.catch(()=>{});try{return await Promise.race([f,V])}finally{clearTimeout(P)}}function Pf(f,x){if(!f?.startsWith("Bearer "))return!1;let P=Buffer.from(f.slice(7)),V=Buffer.from(x);return P.length===V.length&&o(P,V)}async function Wf(f){if(typeof f.drain==="function"===(typeof f.drainAsync==="function"))throw TypeError("exactly one of drain or drainAsync must be provided");let x=f.log??{warn(){},debug(){}},P=a(32).toString("hex"),V=f.timeoutMs??90000,J=f.receiptTimeoutMs??2000,K=!1,H=new Set,B=s((z,G)=>{z.setTimeout(V,()=>{z.socket.destroy()}),M(z,G)});B.on("connection",(z)=>{H.add(z),z.once("close",()=>H.delete(z))}),B.requestTimeout=J,B.headersTimeout=J;async function M(z,G){let F=(X,W,C={})=>{if(G.headersSent||G.writableEnded||G.destroyed)return;G.writeHead(X,{"content-type":"application/json",...C}),G.end(JSON.stringify(W))};try{let X=new URL(z.url??"/","http://127.0.0.1").pathname;if(z.method==="GET"&&X==="/health")return F(200,{ok:!0});if(z.method!=="POST"||!X.startsWith("/rpc/"))return F(404,{error:"not found"});if(!Pf(z.headers.authorization,P))return F(401,{error:"unauthorized"});let W=X.slice(5),C;try{C=await ff(z)}catch(Y){if(!(Y instanceof E))throw Y;let Z=z.socket;if(G.once("finish",()=>{Z.end();let $=setTimeout(()=>Z.destroy(),2000);if($.unref(),z.once("end",()=>Z.destroy()),Z.once("close",()=>clearTimeout($)),z.complete)Z.destroy()}),!Y.declaredOversize&&!z.complete){if(G.headersSent||G.writableEnded||G.destroyed)return;let $=JSON.stringify({error:"body too large"});G.writeHead(413,{"content-type":"application/json","content-length":Buffer.byteLength($),connection:"close"}),G.write($),z.once("end",()=>G.end());return}return F(413,{error:"body too large"},{connection:"close"})}let Q;try{Q=JSON.parse(C||"{}")}catch{return F(400,{error:"invalid json"})}if(W==="pending-notifications"){let Y;try{if(f.parsePending)Y=f.parsePending(Q);else{if(!Q||typeof Q!=="object"||Array.isArray(Q))throw Error("invalid params");let L=Q;if(f.requireSession===!0&&!S(L.sessionId))return F(400,{error:"session required"});if("lastReceivedId"in L&&(typeof L.lastReceivedId!=="number"||!Number.isSafeInteger(L.lastReceivedId)||L.lastReceivedId<0)||"sessionId"in L&&typeof L.sessionId!=="string")throw Error("invalid params");Y={lastReceivedId:Number(L.lastReceivedId??0),sessionId:typeof L.sessionId==="string"?L.sessionId:void 0}}}catch(L){if(L instanceof b)throw L;return F(400,{error:"invalid params"})}let{lastReceivedId:Z,sessionId:$}=Y;if(f.requireSession===!0&&!S($))return F(400,{error:"session required"});if($===void 0&&!K)K=!0,x.warn("rpc notification drain missing session id",{pid:process.pid});let N;if(f.drainAsync)try{N=await f.drainAsync(Z,$)}catch(L){return x.warn("rpc notification drain failed",{pid:process.pid,error:L instanceof Error?L.message:String(L)}),F(500,{error:"drain failed"})}else N=f.drain?.(Z,$);return F(200,{messages:N})}if(W==="apply"){let Y=Promise.resolve(f.apply(Q)),Z=f.applyDeadlineMs===void 0?await Y:await xf(Y,f.applyDeadlineMs);return F(200,Z)}return F(404,{error:"unknown method"})}catch(X){if(X instanceof b)return x.debug("rpc request refused",{pid:process.pid,status:X.status}),F(X.status,{error:X.message});if(X instanceof h)return x.warn("rpc apply deadline exceeded",{pid:process.pid,deadlineMs:f.applyDeadlineMs}),F(504,{error:"handler deadline exceeded"});x.warn("rpc request failed",{pid:process.pid,error:X instanceof Error?X.message:String(X)}),F(500,{error:"internal error"})}}let A=await new Promise((z,G)=>{B.on("error",G),B.listen(0,"127.0.0.1",()=>{let F=B.address();if(F&&typeof F==="object")z(F.port);else G(Error("no port"))})});if(B.unref(),f.sweepRoot)try{await q(f.sweepRoot,f.dir,f.isManagedDir,x)}catch(z){x.warn("rpc state sweep failed",{pid:process.pid,error:z instanceof Error?z.message:String(z)})}try{await T(f.dir,{port:A,token:P,pid:process.pid},{secureDir:f.secureDir}),x.debug("rpc server pid",{pid:process.pid,rpcPort:A})}catch(z){throw await new Promise((G)=>B.close(()=>G())),z}return{port:A,token:P,async stop(){await new Promise((F)=>{B.closeAllConnections?.(),B.close(()=>F());for(let X of H)X.destroy()});let z=e(f.dir,`port-${process.pid}.json`),G=await I(z).then((F)=>JSON.parse(F)).catch((F)=>{if(F instanceof v&&F.code!=="ENOENT")throw F;return});if(G?.port===A&&G.token===P)await r(z).catch(()=>{})}}}async function Mf(f,x,P){let V=globalThis,J=Symbol.for(f),K=V[J]??{servers:new Map,pending:new Map};V[J]=K;let{servers:H,pending:B}=K,M=B.get(x)??Promise.resolve(),A,z=M.catch(()=>{}).then(async()=>{let F=H.get(x);if(F){if(await F.stop(),H.get(x)===F)H.delete(x)}A=await P(),H.set(x,A)});B.set(x,z);try{await z}finally{if(B.get(x)===z)B.delete(x)}let G=A;if(!G)throw Error("RPC server failed to start");return{server:G,release:async()=>{if(H.get(x)!==G)return;if(await G.stop(),H.get(x)===G)H.delete(x)}}}var p="1.23.2";function wf(f,x,P){let V={...x,version:p};return T(f,V,P)}var qf=R(t);
2
2
  export{Vf as Rg,Bf as Sg,Ff as Tg,Wf as Ug,Mf as Vg,p as Wg,wf as Xg,qf as Yg};
@@ -1 +1 @@
1
- import{oh as Q,qh as Y,rh as b,sh as J}from"./index-fasy4end.js";function Z(x){return x==="chatgptaccountid"||x==="email"||x==="orgname"||x==="organizationname"}var $=Q({extraSecretKeys:Z}),w=$.redact,C=$.redactStrings;function D(x){Y({...x,extraSecretKeys:Z})}var M=["error","warn","info","debug","trace"];function I(x){let T=x;return T&&M.includes(T)?T:void 0}function A(x,T){if(x!=="default")b(x);else if(T==="refresh")b(void 0)}var G=!1;function E(x){if(D(x),G)return;if(G=!0,process.once("beforeExit",async()=>{try{await J()}catch{process.emitWarning("OpenAI auth could not flush its log file at shutdown")}}),process.platform!=="win32")process.on("exit",()=>J())}function f(x){if(x instanceof Error)return x.message;if(typeof x==="string")return x;try{return JSON.stringify(x)}catch{return String(x)}}function y(x){return"notify"in x}import{basename as V,dirname as W,join as X}from"node:path";var k="openai-auth.json",F="openai-auth-state.json";function K(x){return V(x)===k?X(W(x),F):`${x}.state.json`}import{spawn as H}from"node:child_process";function h(x,T=process.platform,u=H){try{if(T==="win32"){let j=`Start-Process '${x.replaceAll("'","''")}'`,B=Buffer.from(j,"utf16le").toString("base64"),q=u("powershell.exe",["-NoProfile","-NonInteractive","-WindowStyle","Hidden","-EncodedCommand",B],{stdio:"ignore",windowsHide:!0});return q.on("error",()=>{}),q.unref(),q.pid!==void 0}let U=u(T==="darwin"?"open":"xdg-open",[x],{stdio:"ignore"});return U.on("error",()=>{}),U.unref(),U.pid!==void 0}catch{return!1}}export{C as eh,I as fh,A as gh,E as hh,k as ih,F as jh,K as kh,f as lh,y as mh,h as nh};
1
+ import{oh as Q,qh as Y,rh as b,sh as J}from"./index-td4g5dc9.js";function Z(x){return x==="chatgptaccountid"||x==="email"||x==="orgname"||x==="organizationname"}var $=Q({extraSecretKeys:Z}),w=$.redact,C=$.redactStrings;function D(x){Y({...x,extraSecretKeys:Z})}var M=["error","warn","info","debug","trace"];function I(x){let T=x;return T&&M.includes(T)?T:void 0}function A(x,T){if(x!=="default")b(x);else if(T==="refresh")b(void 0)}var G=!1;function E(x){if(D(x),G)return;if(G=!0,process.once("beforeExit",async()=>{try{await J()}catch{process.emitWarning("OpenAI auth could not flush its log file at shutdown")}}),process.platform!=="win32")process.on("exit",()=>J())}function f(x){if(x instanceof Error)return x.message;if(typeof x==="string")return x;try{return JSON.stringify(x)}catch{return String(x)}}function y(x){return"notify"in x}import{basename as V,dirname as W,join as X}from"node:path";var k="openai-auth.json",F="openai-auth-state.json";function K(x){return V(x)===k?X(W(x),F):`${x}.state.json`}import{spawn as H}from"node:child_process";function h(x,T=process.platform,u=H){try{if(T==="win32"){let j=`Start-Process '${x.replaceAll("'","''")}'`,B=Buffer.from(j,"utf16le").toString("base64"),q=u("powershell.exe",["-NoProfile","-NonInteractive","-WindowStyle","Hidden","-EncodedCommand",B],{stdio:"ignore",windowsHide:!0});return q.on("error",()=>{}),q.unref(),q.pid!==void 0}let U=u(T==="darwin"?"open":"xdg-open",[x],{stdio:"ignore"});return U.on("error",()=>{}),U.unref(),U.pid!==void 0}catch{return!1}}export{C as eh,I as fh,A as gh,E as hh,k as ih,F as jh,K as kh,f as lh,y as mh,h as nh};