@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.
- package/dist/bin.js +8 -8
- package/dist/{index-897br01q.js → index-49ncs7dr.js} +1 -1
- package/dist/{index-s7dwe5n8.js → index-by5wfvqm.js} +20 -20
- package/dist/{index-bbrpg1ms.js → index-drm4dk5y.js} +1 -1
- package/dist/index-nd2ks7er.js +2 -0
- package/dist/index-t876xhkr.js +60 -0
- package/dist/{index-fasy4end.js → index-td4g5dc9.js} +1 -1
- package/dist/{index-7hcv94as.js → index-v8w8j1wx.js} +1 -1
- package/dist/{index-r31f36mn.js → index-v8wrmhyp.js} +1 -1
- package/dist/{index-bpx4spyr.js → index-wjp3q15r.js} +1 -1
- package/dist/{index-f340dq90.js → index-x00sxt2w.js} +10 -10
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1 -1
- package/dist/{runtime-layout-B07ApQZL.d.ts → internal-DacVgEWs.d.ts} +86 -663
- package/dist/rpc/port-file.js +1 -1
- package/dist/rpc/protocol.js +1 -1
- package/dist/rpc/rpc-client.js +1 -1
- package/dist/runtime-layout-Dcbj_Rq3.d.ts +650 -0
- package/dist/{sidebar-state--OTpRzFd.d.ts → sidebar-state-L--CdbLi.d.ts} +4 -15
- package/dist/sidebar-state.d.ts +1 -1
- package/dist/sidebar-state.js +1 -1
- package/dist/tui-preferences.js +1 -1
- package/dist/tui.d.ts +5 -2
- package/dist/v2/server.d.ts +2 -1
- package/dist/v2/server.js +4 -4
- package/package.json +6 -6
- package/src/tui-compiled/raw/shared/054118b2705fdc20-ansi.js +98 -0
- package/src/tui-compiled/raw/shared/0895e780489c494d-window.js +33 -0
- package/src/tui-compiled/raw/shared/0b7d24474e2f33e9-credential-redaction.js +424 -0
- package/src/tui-compiled/raw/shared/0c9533222cb4380c-namespace.js +224 -0
- package/src/tui-compiled/raw/shared/112607e46a5b5f58-accounts.js +393 -0
- package/src/tui-compiled/raw/shared/136fa4abe48ad69d-cachekeep.js +411 -0
- package/src/tui-compiled/raw/shared/1547bd74f4214d2d-index.js +28 -0
- package/src/tui-compiled/raw/shared/1567207f323dc733-codex-http.js +44 -0
- package/src/tui-compiled/raw/shared/15f402885cbb2fb3-envelope-loss.js +151 -0
- package/src/tui-compiled/raw/shared/18df43cab4563acf-families.js +149 -0
- package/src/tui-compiled/raw/shared/1a4c289eec261e04-codex-instructions.js +59 -0
- package/src/tui-compiled/raw/shared/1afd446e190ef85c-vault-messages.js +12 -0
- package/src/tui-compiled/raw/shared/1b06ec96856ff8b9-codex-endpoint.js +17 -0
- package/src/tui-compiled/raw/shared/1e2f1a89bb34a773-vault-adapter.js +110 -0
- package/src/tui-compiled/raw/shared/2194fb8e8b42d7d5-insula-quota.js +73 -0
- package/src/tui-compiled/raw/shared/22b2bce42f2d6806-handle.js +10 -0
- package/src/tui-compiled/raw/shared/2577ec69f9973ae9-quota-normalize.js +13 -14
- package/src/tui-compiled/raw/shared/26055d4e5ad5e71f-codex-request.js +198 -0
- package/src/tui-compiled/raw/shared/26b57ac4c3b0c3f6-unconfirmed-retain-counter.js +41 -0
- package/src/tui-compiled/raw/shared/2bb681e99c2721d7-registry.js +538 -0
- package/src/tui-compiled/raw/shared/2dce6e9613993329-quota-manager.js +13 -20
- package/src/tui-compiled/raw/shared/2ec33b3e2b8ac38a-terminal.js +168 -0
- package/src/tui-compiled/raw/shared/30bcca1d1b4240a0-pool-session-pins.js +32 -0
- package/src/tui-compiled/raw/shared/3af9a210aa2ccdf2-codex-call-status.js +21 -0
- package/src/tui-compiled/raw/shared/3b31b36bf0877602-wording.js +120 -0
- package/src/tui-compiled/raw/shared/3c4c1a2d3fc92726-failure.js +59 -0
- package/src/tui-compiled/raw/shared/3dfe71eec6e0487d-presets.js +240 -0
- package/src/tui-compiled/raw/shared/43de3a5c4845cfc1-pool-adapter.js +149 -0
- package/src/tui-compiled/raw/shared/49353b63a833c8fb-session-cache-policy.js +60 -0
- package/src/tui-compiled/raw/shared/4adf46e07e025363-axes.js +7 -0
- package/src/tui-compiled/raw/shared/4ba847b77580b1eb-confirm.js +21 -0
- package/src/tui-compiled/raw/shared/4d05c2d7a531aece-oauth.js +48 -36
- package/src/tui-compiled/raw/shared/5018d4665e969588-limit-policy.js +159 -0
- package/src/tui-compiled/raw/shared/595bdf3fff13ba79-limit-identity.js +49 -0
- package/src/tui-compiled/raw/shared/59def9e82b61204a-session-cache-activity.js +35 -0
- package/src/tui-compiled/raw/shared/5d806e1a305d14f5-commands.js +879 -0
- package/src/tui-compiled/raw/shared/5fc39320fa8bd3a0-limit-registry.js +473 -0
- package/src/tui-compiled/raw/shared/63c1ee7e70e85e8d-vault.js +1 -0
- package/src/tui-compiled/raw/shared/6545ab7f757314b7-refresh-all-quota.js +237 -0
- package/src/tui-compiled/raw/shared/66937534c260d20b-stable-json.js +11 -0
- package/src/tui-compiled/raw/shared/7056acef1b021f19-bridge.js +10 -0
- package/src/tui-compiled/raw/shared/72d2ca42883809b4-marker.js +107 -0
- package/src/tui-compiled/raw/shared/775431e21f469203-record.js +3 -0
- package/src/tui-compiled/raw/shared/799f3ade4efbd1ea-opencode-v1.js +47 -0
- package/src/tui-compiled/raw/shared/7b2a0471b29e4f5e-wake.js +47 -0
- package/src/tui-compiled/raw/shared/7b5d6afff4ff32b9-select.js +159 -0
- package/src/tui-compiled/raw/shared/7bf96bf4d9249b3d-vault-billing.js +108 -0
- package/src/tui-compiled/raw/shared/7c98bde36aad4819-input-transformations.js +34 -0
- package/src/tui-compiled/raw/shared/7fb0418303f20a10-index.js +3 -0
- package/src/tui-compiled/raw/shared/806e12ccbad34388-pi-wait.js +51 -0
- package/src/tui-compiled/raw/shared/81ae201b724cac14-menu.js +73 -0
- package/src/tui-compiled/raw/shared/8349ed25dc629e97-scope.js +10 -0
- package/src/tui-compiled/raw/shared/86da3379973780b9-limit-provenance.js +60 -0
- package/src/tui-compiled/raw/shared/8aba66ed486d30a7-decide.js +425 -0
- package/src/tui-compiled/raw/shared/8c0c8df25a5dca1f-manager.js +735 -0
- package/src/tui-compiled/raw/shared/8c42bbec02f59636-vault-routing.js +212 -0
- package/src/tui-compiled/raw/shared/8ca6175bfae53e13-envelope.js +123 -0
- package/src/tui-compiled/raw/shared/8d0245e41049d83f-header-classifier.js +121 -0
- package/src/tui-compiled/raw/shared/9c162809179c7560-login.js +89 -0
- package/src/tui-compiled/raw/shared/a1f495296a4b756f-frame-turn.js +72 -0
- package/src/tui-compiled/raw/shared/a37138dcbd893f55-hold-bounds.js +5 -0
- package/src/tui-compiled/raw/shared/aa7fb10d77a2cccd-vault-account-menu.js +133 -0
- package/src/tui-compiled/raw/shared/adc5eeb5a8d28280-persistence.js +9 -0
- package/src/tui-compiled/raw/shared/b301c79e6378d1fb-vault.js +678 -0
- package/src/tui-compiled/raw/shared/b3c11de5f36e617a-reset.js +44 -0
- package/src/tui-compiled/raw/shared/ba6535c610d1edb3-pool-source-state.js +100 -0
- package/src/tui-compiled/raw/shared/bd4aef685681048c-duration.js +20 -0
- package/src/tui-compiled/raw/shared/bd5977eca210d2b8-index.js +662 -0
- package/src/tui-compiled/raw/shared/bfc46d34f4c9db33-limit-recovery.js +127 -0
- package/src/tui-compiled/raw/shared/c66495424ad84aee-hold.js +25 -0
- package/src/tui-compiled/raw/shared/c6a67b836bd5afcd-vault-command-menu.js +300 -0
- package/src/tui-compiled/raw/shared/c9340fb545c4e5de-internal.js +73 -0
- package/src/tui-compiled/raw/shared/c954c6447b7b9b64-activity.js +52 -0
- package/src/tui-compiled/raw/shared/cba8b0aee46b8526-codex-lite.js +85 -0
- package/src/tui-compiled/raw/shared/cec39ccddab4fe9c-labels.js +11 -0
- package/src/tui-compiled/raw/shared/cef0f2346957e83c-index.js +552 -0
- package/src/tui-compiled/raw/shared/cf7dedf24f902d68-dump-size.js +41 -0
- package/src/tui-compiled/raw/shared/d422d6dbc4e35199-background-quota-refresh.js +107 -0
- package/src/tui-compiled/raw/shared/d5b268767d330507-doctor.js +81 -0
- package/src/tui-compiled/raw/shared/d7ac5ca41f49121b-index.js +12 -0
- package/src/tui-compiled/raw/shared/d7fa77560855dee2-jitter.js +9 -0
- package/src/tui-compiled/raw/shared/de7f7d8803624369-path.js +31 -0
- package/src/tui-compiled/raw/shared/df0bdc74fb0c0db0-limit-mark.js +27 -0
- package/src/tui-compiled/raw/shared/e26c2bb5722ab047-routing-hold.js +23 -0
- package/src/tui-compiled/raw/shared/e2ae081583adfce3-dump.js +80 -0
- package/src/tui-compiled/raw/shared/e44ba1b3a9903f5d-reset-credits.js +483 -0
- package/src/tui-compiled/raw/shared/e5229952fc12f647-codex-models.js +34 -0
- package/src/tui-compiled/raw/shared/e8fda84e90176436-uuid-v7.js +13 -0
- package/src/tui-compiled/raw/shared/ea56007991dbf068-terminal.js +19 -0
- package/src/tui-compiled/raw/shared/ec6f1d96e7d70174-quota-refusal.js +145 -0
- package/src/tui-compiled/raw/shared/f03d7b43a214a4a1-canonical-input.js +42 -0
- package/src/tui-compiled/raw/shared/f1012265b3a768c7-merge-laws.js +31 -0
- package/src/tui-compiled/raw/shared/f2ca864fe967415a-cache-policy.js +198 -0
- package/src/tui-compiled/raw/shared/f317a4740f9d76f8-identity.js +21 -0
- package/src/tui-compiled/raw/shared/f607353c4126272a-routing-wait.js +19 -0
- package/src/tui-compiled/raw/shared/f6189f5c9aee31eb-decision.js +55 -0
- package/src/tui-compiled/raw/shared/f6d728f5e601f98b-request-history.js +120 -0
- package/src/tui-compiled/raw/shared/f981e6b15fb76cdb-codex-body.js +28 -0
- package/src/tui-compiled/raw/shared/fda579e5a0a54165-codex-effort.js +60 -0
- package/src/tui-compiled/raw/sidebar-state.js +54 -4
- package/src/tui-compiled/raw/tui/v2-dialog.js +1 -1
- package/src/tui-compiled/raw/tui.tsx +27 -5
- package/src/tui-compiled/runtime/shared/054118b2705fdc20-ansi.js +98 -0
- package/src/tui-compiled/runtime/shared/0895e780489c494d-window.js +33 -0
- package/src/tui-compiled/runtime/shared/0b7d24474e2f33e9-credential-redaction.js +424 -0
- package/src/tui-compiled/runtime/shared/0c9533222cb4380c-namespace.js +224 -0
- package/src/tui-compiled/runtime/shared/112607e46a5b5f58-accounts.js +393 -0
- package/src/tui-compiled/runtime/shared/136fa4abe48ad69d-cachekeep.js +411 -0
- package/src/tui-compiled/runtime/shared/1547bd74f4214d2d-index.js +28 -0
- package/src/tui-compiled/runtime/shared/1567207f323dc733-codex-http.js +44 -0
- package/src/tui-compiled/runtime/shared/15f402885cbb2fb3-envelope-loss.js +151 -0
- package/src/tui-compiled/runtime/shared/18df43cab4563acf-families.js +149 -0
- package/src/tui-compiled/runtime/shared/1a4c289eec261e04-codex-instructions.js +59 -0
- package/src/tui-compiled/runtime/shared/1afd446e190ef85c-vault-messages.js +12 -0
- package/src/tui-compiled/runtime/shared/1b06ec96856ff8b9-codex-endpoint.js +17 -0
- package/src/tui-compiled/runtime/shared/1e2f1a89bb34a773-vault-adapter.js +110 -0
- package/src/tui-compiled/runtime/shared/2194fb8e8b42d7d5-insula-quota.js +73 -0
- package/src/tui-compiled/runtime/shared/22b2bce42f2d6806-handle.js +10 -0
- package/src/tui-compiled/runtime/shared/2577ec69f9973ae9-quota-normalize.js +13 -14
- package/src/tui-compiled/runtime/shared/26055d4e5ad5e71f-codex-request.js +198 -0
- package/src/tui-compiled/runtime/shared/26b57ac4c3b0c3f6-unconfirmed-retain-counter.js +41 -0
- package/src/tui-compiled/runtime/shared/2bb681e99c2721d7-registry.js +538 -0
- package/src/tui-compiled/runtime/shared/2dce6e9613993329-quota-manager.js +13 -20
- package/src/tui-compiled/runtime/shared/2ec33b3e2b8ac38a-terminal.js +168 -0
- package/src/tui-compiled/runtime/shared/30bcca1d1b4240a0-pool-session-pins.js +32 -0
- package/src/tui-compiled/runtime/shared/3af9a210aa2ccdf2-codex-call-status.js +21 -0
- package/src/tui-compiled/runtime/shared/3b31b36bf0877602-wording.js +120 -0
- package/src/tui-compiled/runtime/shared/3c4c1a2d3fc92726-failure.js +59 -0
- package/src/tui-compiled/runtime/shared/3dfe71eec6e0487d-presets.js +240 -0
- package/src/tui-compiled/runtime/shared/43de3a5c4845cfc1-pool-adapter.js +149 -0
- package/src/tui-compiled/runtime/shared/49353b63a833c8fb-session-cache-policy.js +60 -0
- package/src/tui-compiled/runtime/shared/4adf46e07e025363-axes.js +7 -0
- package/src/tui-compiled/runtime/shared/4ba847b77580b1eb-confirm.js +21 -0
- package/src/tui-compiled/runtime/shared/4d05c2d7a531aece-oauth.js +48 -36
- package/src/tui-compiled/runtime/shared/5018d4665e969588-limit-policy.js +159 -0
- package/src/tui-compiled/runtime/shared/595bdf3fff13ba79-limit-identity.js +49 -0
- package/src/tui-compiled/runtime/shared/59def9e82b61204a-session-cache-activity.js +35 -0
- package/src/tui-compiled/runtime/shared/5d806e1a305d14f5-commands.js +879 -0
- package/src/tui-compiled/runtime/shared/5fc39320fa8bd3a0-limit-registry.js +473 -0
- package/src/tui-compiled/runtime/shared/63c1ee7e70e85e8d-vault.js +1 -0
- package/src/tui-compiled/runtime/shared/6545ab7f757314b7-refresh-all-quota.js +237 -0
- package/src/tui-compiled/runtime/shared/66937534c260d20b-stable-json.js +11 -0
- package/src/tui-compiled/runtime/shared/7056acef1b021f19-bridge.js +10 -0
- package/src/tui-compiled/runtime/shared/72d2ca42883809b4-marker.js +107 -0
- package/src/tui-compiled/runtime/shared/775431e21f469203-record.js +3 -0
- package/src/tui-compiled/runtime/shared/799f3ade4efbd1ea-opencode-v1.js +47 -0
- package/src/tui-compiled/runtime/shared/7b2a0471b29e4f5e-wake.js +47 -0
- package/src/tui-compiled/runtime/shared/7b5d6afff4ff32b9-select.js +159 -0
- package/src/tui-compiled/runtime/shared/7bf96bf4d9249b3d-vault-billing.js +108 -0
- package/src/tui-compiled/runtime/shared/7c98bde36aad4819-input-transformations.js +34 -0
- package/src/tui-compiled/runtime/shared/7fb0418303f20a10-index.js +3 -0
- package/src/tui-compiled/runtime/shared/806e12ccbad34388-pi-wait.js +51 -0
- package/src/tui-compiled/runtime/shared/81ae201b724cac14-menu.js +73 -0
- package/src/tui-compiled/runtime/shared/8349ed25dc629e97-scope.js +10 -0
- package/src/tui-compiled/runtime/shared/86da3379973780b9-limit-provenance.js +60 -0
- package/src/tui-compiled/runtime/shared/8aba66ed486d30a7-decide.js +425 -0
- package/src/tui-compiled/runtime/shared/8c0c8df25a5dca1f-manager.js +735 -0
- package/src/tui-compiled/runtime/shared/8c42bbec02f59636-vault-routing.js +212 -0
- package/src/tui-compiled/runtime/shared/8ca6175bfae53e13-envelope.js +123 -0
- package/src/tui-compiled/runtime/shared/8d0245e41049d83f-header-classifier.js +121 -0
- package/src/tui-compiled/runtime/shared/9c162809179c7560-login.js +89 -0
- package/src/tui-compiled/runtime/shared/a1f495296a4b756f-frame-turn.js +72 -0
- package/src/tui-compiled/runtime/shared/a37138dcbd893f55-hold-bounds.js +5 -0
- package/src/tui-compiled/runtime/shared/aa7fb10d77a2cccd-vault-account-menu.js +133 -0
- package/src/tui-compiled/runtime/shared/adc5eeb5a8d28280-persistence.js +9 -0
- package/src/tui-compiled/runtime/shared/b301c79e6378d1fb-vault.js +678 -0
- package/src/tui-compiled/runtime/shared/b3c11de5f36e617a-reset.js +44 -0
- package/src/tui-compiled/runtime/shared/ba6535c610d1edb3-pool-source-state.js +100 -0
- package/src/tui-compiled/runtime/shared/bd4aef685681048c-duration.js +20 -0
- package/src/tui-compiled/runtime/shared/bd5977eca210d2b8-index.js +662 -0
- package/src/tui-compiled/runtime/shared/bfc46d34f4c9db33-limit-recovery.js +127 -0
- package/src/tui-compiled/runtime/shared/c66495424ad84aee-hold.js +25 -0
- package/src/tui-compiled/runtime/shared/c6a67b836bd5afcd-vault-command-menu.js +300 -0
- package/src/tui-compiled/runtime/shared/c9340fb545c4e5de-internal.js +73 -0
- package/src/tui-compiled/runtime/shared/c954c6447b7b9b64-activity.js +52 -0
- package/src/tui-compiled/runtime/shared/cba8b0aee46b8526-codex-lite.js +85 -0
- package/src/tui-compiled/runtime/shared/cec39ccddab4fe9c-labels.js +11 -0
- package/src/tui-compiled/runtime/shared/cef0f2346957e83c-index.js +552 -0
- package/src/tui-compiled/runtime/shared/cf7dedf24f902d68-dump-size.js +41 -0
- package/src/tui-compiled/runtime/shared/d422d6dbc4e35199-background-quota-refresh.js +107 -0
- package/src/tui-compiled/runtime/shared/d5b268767d330507-doctor.js +81 -0
- package/src/tui-compiled/runtime/shared/d7ac5ca41f49121b-index.js +12 -0
- package/src/tui-compiled/runtime/shared/d7fa77560855dee2-jitter.js +9 -0
- package/src/tui-compiled/runtime/shared/de7f7d8803624369-path.js +31 -0
- package/src/tui-compiled/runtime/shared/df0bdc74fb0c0db0-limit-mark.js +27 -0
- package/src/tui-compiled/runtime/shared/e26c2bb5722ab047-routing-hold.js +23 -0
- package/src/tui-compiled/runtime/shared/e2ae081583adfce3-dump.js +80 -0
- package/src/tui-compiled/runtime/shared/e44ba1b3a9903f5d-reset-credits.js +483 -0
- package/src/tui-compiled/runtime/shared/e5229952fc12f647-codex-models.js +34 -0
- package/src/tui-compiled/runtime/shared/e8fda84e90176436-uuid-v7.js +13 -0
- package/src/tui-compiled/runtime/shared/ea56007991dbf068-terminal.js +19 -0
- package/src/tui-compiled/runtime/shared/ec6f1d96e7d70174-quota-refusal.js +145 -0
- package/src/tui-compiled/runtime/shared/f03d7b43a214a4a1-canonical-input.js +42 -0
- package/src/tui-compiled/runtime/shared/f1012265b3a768c7-merge-laws.js +31 -0
- package/src/tui-compiled/runtime/shared/f2ca864fe967415a-cache-policy.js +198 -0
- package/src/tui-compiled/runtime/shared/f317a4740f9d76f8-identity.js +21 -0
- package/src/tui-compiled/runtime/shared/f607353c4126272a-routing-wait.js +19 -0
- package/src/tui-compiled/runtime/shared/f6189f5c9aee31eb-decision.js +55 -0
- package/src/tui-compiled/runtime/shared/f6d728f5e601f98b-request-history.js +120 -0
- package/src/tui-compiled/runtime/shared/f981e6b15fb76cdb-codex-body.js +28 -0
- package/src/tui-compiled/runtime/shared/fda579e5a0a54165-codex-effort.js +60 -0
- package/src/tui-compiled/runtime/sidebar-state.js +54 -4
- package/src/tui-compiled/runtime/tui/v2-dialog.js +1 -1
- package/src/tui-compiled/runtime/tui.js +11 -4
- package/dist/index-2z4dbnsf.js +0 -60
- package/dist/index-x25m9spd.js +0 -2
- package/dist/map-D5PHhv4z.d.ts +0 -72
- /package/dist/{index-sx9jjkry.js → index-4ktepxn1.js} +0 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { effectiveCacheTtlMs } from "./c954c6447b7b9b64-activity.js";
|
|
2
|
+
import { MAX_SAME_ACCOUNT_HOLD_MS, readMaxSameAccountWait } from "./c66495424ad84aee-hold.js";
|
|
3
|
+
import { MAX_TERMINAL_HOLD_MS } from "./a37138dcbd893f55-hold-bounds.js";
|
|
4
|
+
import { sameAccount } from "./f6d728f5e601f98b-request-history.js";
|
|
5
|
+
import { scopeCovers } from "./8349ed25dc629e97-scope.js";
|
|
6
|
+
/**
|
|
7
|
+
* Take each account's latest blocking reset, then the earliest across accounts.
|
|
8
|
+
* A missing identity is compatible, but readings from before re-login are not.
|
|
9
|
+
*/
|
|
10
|
+
export function scanTerminalReset(input, now) {
|
|
11
|
+
return findTerminalReset(input, now, false);
|
|
12
|
+
}
|
|
13
|
+
function findTerminalReset(input, now, requireAll) {
|
|
14
|
+
if (!Number.isFinite(input.maxAgeMs) || input.maxAgeMs < 0)
|
|
15
|
+
return undefined;
|
|
16
|
+
let best;
|
|
17
|
+
for (const candidate of input.candidates) {
|
|
18
|
+
if (!sameAccount(candidate.account, candidate.readingAccount) ||
|
|
19
|
+
(candidate.identity !== undefined &&
|
|
20
|
+
candidate.readingIdentity !== undefined &&
|
|
21
|
+
candidate.identity !== candidate.readingIdentity)) {
|
|
22
|
+
if (requireAll)
|
|
23
|
+
return undefined;
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
const blockers = candidate.windows.filter((window) => window.blockedBy &&
|
|
27
|
+
scopeCovers(window.scope, input.effectiveModel, input.familyOf));
|
|
28
|
+
if (!blockers.length) {
|
|
29
|
+
if (requireAll)
|
|
30
|
+
return undefined;
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
const resets = blockers.map((window) => {
|
|
34
|
+
const reset = window.reset;
|
|
35
|
+
const capturedAt = reset?.observedAt ?? reset?.checkedAt;
|
|
36
|
+
return reset &&
|
|
37
|
+
capturedAt !== undefined &&
|
|
38
|
+
Number.isFinite(capturedAt) &&
|
|
39
|
+
now - capturedAt <= input.maxAgeMs &&
|
|
40
|
+
Number.isFinite(reset.at) &&
|
|
41
|
+
reset.at > now
|
|
42
|
+
? reset.at
|
|
43
|
+
: undefined;
|
|
44
|
+
});
|
|
45
|
+
// One unknown blocking window means this account has no known release time.
|
|
46
|
+
if (resets.some((reset) => reset === undefined)) {
|
|
47
|
+
if (requireAll)
|
|
48
|
+
return undefined;
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
const resetAt = Math.max(...resets);
|
|
52
|
+
if (best && best.resetAt <= resetAt)
|
|
53
|
+
continue;
|
|
54
|
+
const floorDefined = blockers.some((window) => window.blockedBy !== 'exhausted' && window.reset?.at === resetAt);
|
|
55
|
+
best = {
|
|
56
|
+
account: candidate.account,
|
|
57
|
+
resetAt,
|
|
58
|
+
checkpoint: {
|
|
59
|
+
accountKey: { ...candidate.account },
|
|
60
|
+
decidedAt: now,
|
|
61
|
+
blockers: floorDefined
|
|
62
|
+
? []
|
|
63
|
+
: blockers.flatMap((window) => window.blockedBy === 'exhausted' && window.reset
|
|
64
|
+
? [
|
|
65
|
+
{
|
|
66
|
+
window: window.window,
|
|
67
|
+
resetAt: window.reset.at,
|
|
68
|
+
},
|
|
69
|
+
]
|
|
70
|
+
: []),
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return best;
|
|
75
|
+
}
|
|
76
|
+
function settingCapApplies(metadata, axes) {
|
|
77
|
+
return (metadata.source === 'pool' &&
|
|
78
|
+
metadata.reason === 'quota' &&
|
|
79
|
+
axes.terminalMetadata === 'setting-capped-fresh');
|
|
80
|
+
}
|
|
81
|
+
function quotaResetWait(metadata, now) {
|
|
82
|
+
const scan = metadata.scan;
|
|
83
|
+
const jitterMs = scan?.waitForReset?.jitterMs;
|
|
84
|
+
if (metadata.reason !== 'quota' ||
|
|
85
|
+
!scan ||
|
|
86
|
+
jitterMs === undefined ||
|
|
87
|
+
!Number.isInteger(jitterMs) ||
|
|
88
|
+
jitterMs < 0)
|
|
89
|
+
return undefined;
|
|
90
|
+
// Do not commit to a full reset wait unless every account has a known release.
|
|
91
|
+
const kept = findTerminalReset(scan, now, true);
|
|
92
|
+
if (!kept)
|
|
93
|
+
return undefined;
|
|
94
|
+
return {
|
|
95
|
+
kept,
|
|
96
|
+
delayMs: Math.ceil((kept.resetAt - now) / 1000) * 1000 + jitterMs,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
export function terminalWaitDisabled(metadata, axes, now) {
|
|
100
|
+
return (settingCapApplies(metadata, axes) &&
|
|
101
|
+
readMaxSameAccountWait(metadata.scan?.maxSameAccountWait) === 0 &&
|
|
102
|
+
!quotaResetWait(metadata, now));
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* When no account is ready, an opt-in can wait for the full reset without a
|
|
106
|
+
* warm cache. Otherwise keep the preset's existing refusal and wait bounds.
|
|
107
|
+
*/
|
|
108
|
+
export function terminalRefusalDecision(facts, axes, history, metadata) {
|
|
109
|
+
const resetWait = quotaResetWait(metadata, facts.now);
|
|
110
|
+
if (!resetWait && !settingCapApplies(metadata, axes))
|
|
111
|
+
return undefined;
|
|
112
|
+
const scan = metadata.scan;
|
|
113
|
+
const setting = readMaxSameAccountWait(scan?.maxSameAccountWait);
|
|
114
|
+
const kept = resetWait?.kept ?? (scan && scanTerminalReset(scan, facts.now));
|
|
115
|
+
const base = kept ? kept.resetAt - facts.now : 300000;
|
|
116
|
+
const record = scan?.activity;
|
|
117
|
+
const account = scan?.accountKey ?? facts.attempted;
|
|
118
|
+
const ttl = record && account && sameAccount(record.accountKey, account)
|
|
119
|
+
? effectiveCacheTtlMs(record.ttlMs) || 300000
|
|
120
|
+
: 300000;
|
|
121
|
+
const delayMs = resetWait?.delayMs ?? Math.min(base, setting === 'max' ? ttl : 900000);
|
|
122
|
+
const final = (!resetWait && setting === 0) ||
|
|
123
|
+
(facts.host === 'pi' && facts.wake?.kind === 'terminal');
|
|
124
|
+
const retryAfterMs = final ? (kept ? base : undefined) : delayMs;
|
|
125
|
+
const policy = axes.refusals.quota[facts.host];
|
|
126
|
+
const refuse = {
|
|
127
|
+
action: 'refuse',
|
|
128
|
+
reason: 'quota',
|
|
129
|
+
family: facts.host === 'pi' ? 'pi-final' : final ? 'json-412' : policy.family,
|
|
130
|
+
messageKey: metadata.messageKey ?? policy.messageKey,
|
|
131
|
+
retryable: facts.host !== 'pi' && !final,
|
|
132
|
+
hostRetry: facts.host === 'pi' || final ? 'veto' : 'leave',
|
|
133
|
+
history,
|
|
134
|
+
...(retryAfterMs === undefined ? {} : { retryAfterMs }),
|
|
135
|
+
...(kept ? { resetAt: kept.resetAt } : {}),
|
|
136
|
+
};
|
|
137
|
+
if (!kept || final || facts.host === 'opencode1')
|
|
138
|
+
return refuse;
|
|
139
|
+
const wait = {
|
|
140
|
+
delayMs,
|
|
141
|
+
retryAfterMs: delayMs,
|
|
142
|
+
resetAt: kept.resetAt,
|
|
143
|
+
target: facts.now + delayMs,
|
|
144
|
+
checkpoint: kept.checkpoint,
|
|
145
|
+
waitKind: 'terminal',
|
|
146
|
+
reason: 'terminal-quota',
|
|
147
|
+
retryable: true,
|
|
148
|
+
hostRetry: 'leave',
|
|
149
|
+
history,
|
|
150
|
+
};
|
|
151
|
+
if (facts.host === 'pi')
|
|
152
|
+
return { ...wait, action: 'wait-then-reselect' };
|
|
153
|
+
if (facts.hostPhase !== 'retry')
|
|
154
|
+
return refuse;
|
|
155
|
+
if (facts.remainingRetries !== undefined && facts.remainingRetries < 1)
|
|
156
|
+
return {
|
|
157
|
+
action: 'pass',
|
|
158
|
+
reason: 'host-retries-exhausted',
|
|
159
|
+
retryable: true,
|
|
160
|
+
hostRetry: 'leave',
|
|
161
|
+
history,
|
|
162
|
+
};
|
|
163
|
+
if (facts.remainingRetries === undefined ||
|
|
164
|
+
(resetWait && Number.isNaN(facts.remainingRetries)) ||
|
|
165
|
+
delayMs > (resetWait ? MAX_TERMINAL_HOLD_MS : MAX_SAME_ACCOUNT_HOLD_MS))
|
|
166
|
+
return refuse;
|
|
167
|
+
return { ...wait, action: 'hold', account: kept.account };
|
|
168
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isPinValid,
|
|
3
|
+
pendingBytesForPins
|
|
4
|
+
} from "./3e7d45a77c6ad4d5-index.js";
|
|
5
|
+
export function placeStickyPin(pins, placement, set) {
|
|
6
|
+
const pin = pins.get(placement.sessionId), valid = new Set(placement.validPinnedAccountIds);
|
|
7
|
+
if (pin && !placement.excludeAccountIds.includes(pin.accountId) && isPinValid(pin, valid, placement.wireAccountIdByAccount[pin.accountId])) {
|
|
8
|
+
if (placement.persist) {
|
|
9
|
+
const quotaCheckedAt = placement.quotaCheckedAtByAccount[pin.accountId];
|
|
10
|
+
set(placement.sessionId, {
|
|
11
|
+
accountId: pin.accountId,
|
|
12
|
+
inputBytes: placement.requestBytes,
|
|
13
|
+
...pin.wireIdentity !== void 0 ? { wireIdentity: pin.wireIdentity } : {},
|
|
14
|
+
...quotaCheckedAt !== void 0 ? { quotaCheckedAt } : {}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return { accountId: pin.accountId };
|
|
18
|
+
}
|
|
19
|
+
const checkedAt = new Map(Object.entries(placement.quotaCheckedAtByAccount)), pending = pendingBytesForPins(pins, checkedAt, placement.sessionId), selection = placement.select(pending);
|
|
20
|
+
if (!selection)
|
|
21
|
+
return;
|
|
22
|
+
if (placement.persist) {
|
|
23
|
+
const wireIdentity = placement.wireAccountIdByAccount[selection.accountId];
|
|
24
|
+
set(placement.sessionId, {
|
|
25
|
+
accountId: selection.accountId,
|
|
26
|
+
inputBytes: placement.requestBytes,
|
|
27
|
+
...wireIdentity !== void 0 ? { wireIdentity } : {},
|
|
28
|
+
...selection.quotaCheckedAt !== void 0 ? { quotaCheckedAt: selection.quotaCheckedAt } : {}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return { accountId: selection.accountId };
|
|
32
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { gptModelVersion } from "./e5229952fc12f647-codex-models.js";
|
|
2
|
+
import { isRecord } from "./775431e21f469203-record.js";
|
|
3
|
+
export function restoreReplayedCallStatus(input, model) {
|
|
4
|
+
if (!Array.isArray(input) || typeof model !== "string")
|
|
5
|
+
return input;
|
|
6
|
+
const version = gptModelVersion(model);
|
|
7
|
+
if (!version)
|
|
8
|
+
return input;
|
|
9
|
+
const [major, minor = "0"] = version.split(".");
|
|
10
|
+
if (Number(major) < 6 || Number(major) === 6 && Number(minor) < 2)
|
|
11
|
+
return input;
|
|
12
|
+
let restored;
|
|
13
|
+
for (let index = 0;index < input.length; index++) {
|
|
14
|
+
const item = input[index];
|
|
15
|
+
if (!isRecord(item) || item.type !== "function_call" || Object.hasOwn(item, "status"))
|
|
16
|
+
continue;
|
|
17
|
+
restored ??= input.slice();
|
|
18
|
+
restored[index] = { ...item, status: "completed" };
|
|
19
|
+
}
|
|
20
|
+
return restored ?? input;
|
|
21
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// OpenCode 1 session/retry.ts, also recorded in src/redaction/index.ts. Body
|
|
2
|
+
// matches can trigger replay even when the error itself is non-retryable.
|
|
3
|
+
const openCode1Patterns = [
|
|
4
|
+
/429|500|502|503|504|524/i,
|
|
5
|
+
/rate increased too quickly|rate limit|rate-limit|rate_limit|too many requests/i,
|
|
6
|
+
/overloaded|service unavailable|service_unavailable|service-unavailable|internal error|internal_error|internal server error|server error|server_error|server-error|provider returned error|provider_returned_error|provider-returned-error/i,
|
|
7
|
+
/terminated|fetch failed|failed to fetch|network[-_\s]error|upstream connect|connection error|connection refused|connection lost|socket connection was closed|socket hang up|reset before headers|getaddrinfo|enotfound|eai_again|econnrefused|econnreset|etimedout/i,
|
|
8
|
+
/^timeout$|\b(?:request|response|connection|network|stream|read) (?:timeout|timed out|time out)\b/i,
|
|
9
|
+
/try your request again|retry your request|resource exhausted|resource_exhausted/i,
|
|
10
|
+
/\btry again (?:later|in\b)|\b(?:currently|temporarily) at capacity\b/i,
|
|
11
|
+
];
|
|
12
|
+
// @earendil-works/pi-ai@1.4.0, dist/utils/retry.js:26-106,
|
|
13
|
+
// RETRYABLE_PROVIDER_ERROR_PATTERN. Pin this independently of the dev peer.
|
|
14
|
+
const pi140Pattern = new RegExp([
|
|
15
|
+
'overloaded',
|
|
16
|
+
'server_busy',
|
|
17
|
+
'servers are currently busy',
|
|
18
|
+
'currently experiencing high demand',
|
|
19
|
+
'model is at capacity',
|
|
20
|
+
'rate.?limit',
|
|
21
|
+
'too many requests',
|
|
22
|
+
'(?<![a-z0-9])(?:429|500|502|503|504|520|524)(?![a-z0-9])',
|
|
23
|
+
'service.?(?:is.?)?(?:temporarily.?)?unavailable',
|
|
24
|
+
'server.?error',
|
|
25
|
+
'internal.?error',
|
|
26
|
+
'provider.?returned.?(?:an.?)?error',
|
|
27
|
+
'exceeded request buffer limit while retrying upstream',
|
|
28
|
+
'unable to forward upstream',
|
|
29
|
+
'upstream.?request.?failed',
|
|
30
|
+
'upstream_stream_read_error',
|
|
31
|
+
'stream was interrupted',
|
|
32
|
+
'http/?2 stream failed',
|
|
33
|
+
'network.?error',
|
|
34
|
+
'connection.?error',
|
|
35
|
+
'connection.?refused',
|
|
36
|
+
'connection.?lost',
|
|
37
|
+
'other side closed',
|
|
38
|
+
'fetch failed',
|
|
39
|
+
'request to \\S+ failed, reason:',
|
|
40
|
+
'getaddrinfo',
|
|
41
|
+
'ENOTFOUND',
|
|
42
|
+
'EAI_AGAIN',
|
|
43
|
+
'upstream.?connect',
|
|
44
|
+
'reset before headers',
|
|
45
|
+
'socket hang up',
|
|
46
|
+
'socket connection was closed',
|
|
47
|
+
'timed? out',
|
|
48
|
+
'timeout',
|
|
49
|
+
'terminated',
|
|
50
|
+
'websocket.?closed',
|
|
51
|
+
'websocket.?error',
|
|
52
|
+
'ended without',
|
|
53
|
+
'stream ended before message_stop',
|
|
54
|
+
'stream ended before a terminal response event',
|
|
55
|
+
'http2 request did not get a response',
|
|
56
|
+
'stream disconnected before completion',
|
|
57
|
+
'pending stream has been canceled',
|
|
58
|
+
'retry delay',
|
|
59
|
+
'you can retry your request',
|
|
60
|
+
'try your request again',
|
|
61
|
+
'please retry your request',
|
|
62
|
+
'ResourceExhausted',
|
|
63
|
+
'subscription_sharing_usage_unavailable',
|
|
64
|
+
'subscription_sharing_user_unavailable',
|
|
65
|
+
].join('|'), 'i');
|
|
66
|
+
export function hasUnsafeWording(text) {
|
|
67
|
+
// OpenCode 1's session/retry.ts non-API-error branch retries when any of
|
|
68
|
+
// these substrings occurs in the message, even without a retryable flag.
|
|
69
|
+
const lower = text.toLowerCase();
|
|
70
|
+
return (lower.includes('too_many_requests') ||
|
|
71
|
+
lower.includes('exhausted') ||
|
|
72
|
+
lower.includes('unavailable') ||
|
|
73
|
+
openCode1Patterns.some((pattern) => pattern.test(text)) ||
|
|
74
|
+
pi140Pattern.test(text));
|
|
75
|
+
}
|
|
76
|
+
export class UnsafeWordingError extends Error {
|
|
77
|
+
messageKey;
|
|
78
|
+
code = 'unsafe-wording';
|
|
79
|
+
constructor(messageKey) {
|
|
80
|
+
super(`Unsafe refusal template: ${messageKey}`);
|
|
81
|
+
this.messageKey = messageKey;
|
|
82
|
+
this.name = 'UnsafeWordingError';
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/** Registration rejects unsafe fixed text; actual substitutions are checked again. */
|
|
86
|
+
export function registerLimitMessages(options) {
|
|
87
|
+
const refusals = new Map(Object.entries(options.refusals ?? {}));
|
|
88
|
+
const retryable = new Map(Object.entries(options.retryable ?? {}));
|
|
89
|
+
for (const [key, template] of refusals) {
|
|
90
|
+
for (const reset of [
|
|
91
|
+
undefined,
|
|
92
|
+
'45s',
|
|
93
|
+
'2m',
|
|
94
|
+
'1h 30m',
|
|
95
|
+
'99d 23h 59m',
|
|
96
|
+
'over 99 days',
|
|
97
|
+
]) {
|
|
98
|
+
for (const labels of [[], ['this account']]) {
|
|
99
|
+
const parameters = Object.freeze({
|
|
100
|
+
labels: Object.freeze(labels),
|
|
101
|
+
reset,
|
|
102
|
+
});
|
|
103
|
+
let rendered;
|
|
104
|
+
try {
|
|
105
|
+
rendered = template(parameters);
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
throw new UnsafeWordingError(key);
|
|
109
|
+
}
|
|
110
|
+
if (typeof rendered !== 'string' || hasUnsafeWording(rendered)) {
|
|
111
|
+
throw new UnsafeWordingError(key);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return Object.freeze({
|
|
117
|
+
formatReset: options.formatReset,
|
|
118
|
+
render: (key, parameters, nonRetryable) => (nonRetryable ? refusals : retryable).get(key)?.(parameters),
|
|
119
|
+
});
|
|
120
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
const ERROR_NAMES = ['AbortError', 'TimeoutError', 'TypeError'];
|
|
2
|
+
const NETWORK_CODES = [
|
|
3
|
+
'ECONNRESET',
|
|
4
|
+
'ECONNREFUSED',
|
|
5
|
+
'ETIMEDOUT',
|
|
6
|
+
'EPIPE',
|
|
7
|
+
'ENOTFOUND',
|
|
8
|
+
'EAI_AGAIN',
|
|
9
|
+
'UND_ERR_CONNECT_TIMEOUT',
|
|
10
|
+
'UND_ERR_HEADERS_TIMEOUT',
|
|
11
|
+
'UND_ERR_HEADERS_OVERFLOW',
|
|
12
|
+
'UND_ERR_BODY_TIMEOUT',
|
|
13
|
+
'UND_ERR_RESPONSE_STATUS_CODE',
|
|
14
|
+
'UND_ERR_INVALID_ARG',
|
|
15
|
+
'UND_ERR_INVALID_RETURN_VALUE',
|
|
16
|
+
'UND_ERR_ABORTED',
|
|
17
|
+
'UND_ERR_CLIENT_DESTROYED',
|
|
18
|
+
'UND_ERR_CLIENT_CLOSED',
|
|
19
|
+
'UND_ERR_SOCKET',
|
|
20
|
+
'UND_ERR_NOT_SUPPORTED',
|
|
21
|
+
'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH',
|
|
22
|
+
'UND_ERR_RES_CONTENT_LENGTH_MISMATCH',
|
|
23
|
+
'UND_ERR_INFO',
|
|
24
|
+
'UND_ERR_RES_EXCEEDED_MAX_SIZE',
|
|
25
|
+
'UND_ERR_PRX_TLS',
|
|
26
|
+
];
|
|
27
|
+
function allowed(values, value) {
|
|
28
|
+
return typeof value === 'string' && values.includes(value);
|
|
29
|
+
}
|
|
30
|
+
/** Keep diagnostics useful without retaining provider text, credentials or error causes. */
|
|
31
|
+
export function classifyFailure(error, stage, status) {
|
|
32
|
+
try {
|
|
33
|
+
if (status !== undefined &&
|
|
34
|
+
Number.isInteger(status) &&
|
|
35
|
+
status >= 100 &&
|
|
36
|
+
status <= 599 &&
|
|
37
|
+
(status < 200 || status >= 300)) {
|
|
38
|
+
return { stage: 'response', class: status };
|
|
39
|
+
}
|
|
40
|
+
if (typeof error === 'object' && error !== null) {
|
|
41
|
+
const fields = error;
|
|
42
|
+
const name = fields.name;
|
|
43
|
+
if (name === 'AbortError' || name === 'TimeoutError')
|
|
44
|
+
return { stage, class: name };
|
|
45
|
+
const code = fields.code;
|
|
46
|
+
if (allowed(NETWORK_CODES, code))
|
|
47
|
+
return { stage, class: code };
|
|
48
|
+
const causeCode = fields.cause?.code;
|
|
49
|
+
if (allowed(NETWORK_CODES, causeCode))
|
|
50
|
+
return { stage, class: causeCode };
|
|
51
|
+
if (allowed(ERROR_NAMES, name))
|
|
52
|
+
return { stage, class: name };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
// Host errors can have throwing accessors; never inspect or stringify them further.
|
|
57
|
+
}
|
|
58
|
+
return { stage, class: 'unknown' };
|
|
59
|
+
}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { ANTIGRAVITY_FAILURE_LADDER } from "./72d2ca42883809b4-marker.js";
|
|
2
|
+
function immutable(value) {
|
|
3
|
+
if (value && typeof value === 'object') {
|
|
4
|
+
for (const child of Object.values(value))
|
|
5
|
+
immutable(child);
|
|
6
|
+
Object.freeze(value);
|
|
7
|
+
}
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
function hosts(value) {
|
|
11
|
+
return { opencode1: value, opencode2: value, pi: value };
|
|
12
|
+
}
|
|
13
|
+
const reselect = {
|
|
14
|
+
action: 'reselect',
|
|
15
|
+
affinity: 'always',
|
|
16
|
+
hint: 'none',
|
|
17
|
+
defaultMs: 60000,
|
|
18
|
+
};
|
|
19
|
+
const sticky = {
|
|
20
|
+
...reselect,
|
|
21
|
+
action: 'retain',
|
|
22
|
+
affinity: 'sticky',
|
|
23
|
+
};
|
|
24
|
+
const auth = {
|
|
25
|
+
family: 'local-auth',
|
|
26
|
+
messageKey: 'auth.no-account',
|
|
27
|
+
retryable: false,
|
|
28
|
+
hostRetry: 'leave',
|
|
29
|
+
};
|
|
30
|
+
function refusals(quota, incomplete) {
|
|
31
|
+
return {
|
|
32
|
+
auth: hosts(auth),
|
|
33
|
+
quota: hosts(quota),
|
|
34
|
+
incomplete: hosts(incomplete),
|
|
35
|
+
'model-unavailable': hosts({
|
|
36
|
+
family: 'json-412',
|
|
37
|
+
messageKey: 'model-unavailable',
|
|
38
|
+
retryable: false,
|
|
39
|
+
hostRetry: 'veto',
|
|
40
|
+
}),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const off = { kind: 'off' };
|
|
44
|
+
const strict = { requestEscape: 'off', retryExhaustion: 'terminal' };
|
|
45
|
+
const noAdvance = { statuses: [], attributedLimitOnly: true };
|
|
46
|
+
const engineQuota = {
|
|
47
|
+
family: 'json-412',
|
|
48
|
+
messageKey: 'quota.pool-exhausted',
|
|
49
|
+
retryable: false,
|
|
50
|
+
hostRetry: 'veto',
|
|
51
|
+
};
|
|
52
|
+
export const confirmedAffinity = immutable({
|
|
53
|
+
unconfirmedRetainLimit: 2,
|
|
54
|
+
evidence: 'per-field-overlay',
|
|
55
|
+
markers: hosts({
|
|
56
|
+
kind: 'reset',
|
|
57
|
+
mergeLaw: 'latest-evidence',
|
|
58
|
+
defaultMs: 60000,
|
|
59
|
+
}),
|
|
60
|
+
readingClearsCoveredScopes: 'on',
|
|
61
|
+
successClearsCoveredScopes: 'on',
|
|
62
|
+
unknown: {
|
|
63
|
+
opencode1: { ...reselect, action: 'retain', hint: 'minimum' },
|
|
64
|
+
opencode2: reselect,
|
|
65
|
+
pi: { ...reselect, action: 'pass' },
|
|
66
|
+
},
|
|
67
|
+
shortLimit: {
|
|
68
|
+
holdBound: 'cache-ttl',
|
|
69
|
+
preference: 'same-account-first',
|
|
70
|
+
jitter: 'session-sha256',
|
|
71
|
+
},
|
|
72
|
+
retainBound: 'none',
|
|
73
|
+
poolWaiting: off,
|
|
74
|
+
execution: 'host',
|
|
75
|
+
requestExclusion: 'off',
|
|
76
|
+
advance: hosts(noAdvance),
|
|
77
|
+
markedPool: strict,
|
|
78
|
+
terminalMetadata: 'setting-capped-fresh',
|
|
79
|
+
terminalPolicy: 'provided',
|
|
80
|
+
refusals: refusals({
|
|
81
|
+
family: 'claude-429',
|
|
82
|
+
messageKey: 'quota.all-accounts',
|
|
83
|
+
retryable: true,
|
|
84
|
+
hostRetry: 'leave',
|
|
85
|
+
}, {
|
|
86
|
+
family: 'claude-econnreset',
|
|
87
|
+
messageKey: 'incomplete.snapshot',
|
|
88
|
+
retryable: true,
|
|
89
|
+
hostRetry: 'leave',
|
|
90
|
+
}),
|
|
91
|
+
});
|
|
92
|
+
export const earliestPoolEngine = immutable({
|
|
93
|
+
evidence: 'typed',
|
|
94
|
+
markers: hosts(ANTIGRAVITY_FAILURE_LADDER),
|
|
95
|
+
readingClearsCoveredScopes: 'on',
|
|
96
|
+
successClearsCoveredScopes: 'off',
|
|
97
|
+
unknown: hosts(reselect),
|
|
98
|
+
shortLimit: {
|
|
99
|
+
holdBound: 'disabled',
|
|
100
|
+
preference: 'ready-alternative-first',
|
|
101
|
+
jitter: 'none',
|
|
102
|
+
},
|
|
103
|
+
retainBound: 'none',
|
|
104
|
+
poolWaiting: {
|
|
105
|
+
kind: 'earliest',
|
|
106
|
+
budgetMs: 300000,
|
|
107
|
+
requestDeadlineMs: 600000,
|
|
108
|
+
hardFallbackMs: 60000,
|
|
109
|
+
singleEligibleSoftExemption: true,
|
|
110
|
+
},
|
|
111
|
+
execution: 'engine',
|
|
112
|
+
requestExclusion: 'on',
|
|
113
|
+
advance: hosts({ statuses: [429, 503, 529], attributedLimitOnly: false }),
|
|
114
|
+
markedPool: strict,
|
|
115
|
+
terminalMetadata: 'baseline',
|
|
116
|
+
terminalPolicy: 'pool',
|
|
117
|
+
refusals: refusals(engineQuota, {
|
|
118
|
+
...engineQuota,
|
|
119
|
+
messageKey: 'incomplete.timeout',
|
|
120
|
+
}),
|
|
121
|
+
});
|
|
122
|
+
export const windowRouter = immutable({
|
|
123
|
+
evidence: 'named-window',
|
|
124
|
+
markers: {
|
|
125
|
+
opencode1: { kind: 'reset', mergeLaw: 'max-until', defaultMs: 60000 },
|
|
126
|
+
opencode2: { kind: 'reset', mergeLaw: 'max-until', defaultMs: 60000 },
|
|
127
|
+
pi: off,
|
|
128
|
+
},
|
|
129
|
+
readingClearsCoveredScopes: 'off',
|
|
130
|
+
successClearsCoveredScopes: 'off',
|
|
131
|
+
unknown: { opencode1: sticky, opencode2: reselect, pi: sticky },
|
|
132
|
+
shortLimit: {
|
|
133
|
+
holdBound: 'disabled',
|
|
134
|
+
preference: 'ready-alternative-first',
|
|
135
|
+
jitter: 'none',
|
|
136
|
+
},
|
|
137
|
+
retainBound: 'none',
|
|
138
|
+
poolWaiting: off,
|
|
139
|
+
execution: 'host',
|
|
140
|
+
requestExclusion: 'off',
|
|
141
|
+
advance: hosts({ statuses: [401, 403, 429], attributedLimitOnly: false }),
|
|
142
|
+
markedPool: {
|
|
143
|
+
requestEscape: 'ignore-timed-marks-if-all-marked',
|
|
144
|
+
retryExhaustion: 'same-host-delay',
|
|
145
|
+
},
|
|
146
|
+
terminalMetadata: 'baseline',
|
|
147
|
+
terminalPolicy: 'provided',
|
|
148
|
+
refusals: refusals({
|
|
149
|
+
family: 'openai-429',
|
|
150
|
+
messageKey: 'quota.no-route',
|
|
151
|
+
retryable: true,
|
|
152
|
+
hostRetry: 'leave',
|
|
153
|
+
}, {
|
|
154
|
+
family: 'openai-429',
|
|
155
|
+
messageKey: 'incomplete.snapshot',
|
|
156
|
+
retryable: true,
|
|
157
|
+
hostRetry: 'leave',
|
|
158
|
+
}),
|
|
159
|
+
});
|
|
160
|
+
export const statusVaultOrder = immutable({
|
|
161
|
+
evidence: 'hints-only',
|
|
162
|
+
markers: {
|
|
163
|
+
opencode1: {
|
|
164
|
+
kind: 'hint',
|
|
165
|
+
mergeLaw: 'overwrite',
|
|
166
|
+
defaultMs: 60000,
|
|
167
|
+
defaultMsByKind: { 'payment-balance': 300000 },
|
|
168
|
+
causes: ['rate-limit', 'payment-balance'],
|
|
169
|
+
ignoredKinds: ['payment-cap'],
|
|
170
|
+
minimumMs: 0,
|
|
171
|
+
zero: 'accept',
|
|
172
|
+
hintClock: 'signal',
|
|
173
|
+
},
|
|
174
|
+
opencode2: {
|
|
175
|
+
kind: 'hint',
|
|
176
|
+
mergeLaw: 'overwrite',
|
|
177
|
+
defaultMs: 60000,
|
|
178
|
+
defaultMsByKind: { 'payment-balance': 300000 },
|
|
179
|
+
causes: ['rate-limit', 'payment-balance'],
|
|
180
|
+
ignoredKinds: ['payment-cap'],
|
|
181
|
+
minimumMs: 0,
|
|
182
|
+
zero: 'accept',
|
|
183
|
+
hintClock: 'marker',
|
|
184
|
+
},
|
|
185
|
+
pi: {
|
|
186
|
+
kind: 'hint',
|
|
187
|
+
mergeLaw: 'overwrite',
|
|
188
|
+
defaultMs: 60000,
|
|
189
|
+
defaultMsByKind: { 'payment-balance': 300000 },
|
|
190
|
+
causes: ['rate-limit', 'payment-balance'],
|
|
191
|
+
ignoredKinds: ['payment-cap'],
|
|
192
|
+
minimumMs: 0,
|
|
193
|
+
zero: 'accept',
|
|
194
|
+
hintClock: 'signal',
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
readingClearsCoveredScopes: 'off',
|
|
198
|
+
successClearsCoveredScopes: 'off',
|
|
199
|
+
unknown: hosts(reselect),
|
|
200
|
+
shortLimit: {
|
|
201
|
+
holdBound: 'disabled',
|
|
202
|
+
preference: 'ready-alternative-first',
|
|
203
|
+
jitter: 'none',
|
|
204
|
+
},
|
|
205
|
+
retainBound: 'none',
|
|
206
|
+
poolWaiting: off,
|
|
207
|
+
execution: 'host',
|
|
208
|
+
requestExclusion: 'off',
|
|
209
|
+
advance: {
|
|
210
|
+
opencode1: { statuses: [401, 429], attributedLimitOnly: false },
|
|
211
|
+
opencode2: noAdvance,
|
|
212
|
+
pi: { statuses: [401, 429], attributedLimitOnly: false },
|
|
213
|
+
},
|
|
214
|
+
markedPool: {
|
|
215
|
+
requestEscape: 'ignore-timed-marks-if-all-marked',
|
|
216
|
+
retryExhaustion: 'host-delay',
|
|
217
|
+
},
|
|
218
|
+
terminalMetadata: 'baseline',
|
|
219
|
+
terminalPolicy: 'status-history',
|
|
220
|
+
terminalStatusHistory: {
|
|
221
|
+
minRetryMs: 1000,
|
|
222
|
+
defaultRetryMs: 60000,
|
|
223
|
+
paymentBalance: {
|
|
224
|
+
family: 'claustrum-402',
|
|
225
|
+
messageKey: 'payment.insufficient-balance',
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
refusals: refusals({
|
|
229
|
+
family: 'claustrum-429',
|
|
230
|
+
messageKey: 'quota.accounts-rate-limited',
|
|
231
|
+
retryable: true,
|
|
232
|
+
hostRetry: 'leave',
|
|
233
|
+
}, { ...auth, messageKey: 'incomplete.no-account' }),
|
|
234
|
+
});
|
|
235
|
+
export const limitPresets = immutable({
|
|
236
|
+
'confirmed-affinity': confirmedAffinity,
|
|
237
|
+
'earliest-pool-engine': earliestPoolEngine,
|
|
238
|
+
'window-router': windowRouter,
|
|
239
|
+
'status-vault-order': statusVaultOrder,
|
|
240
|
+
});
|