@agentdeck/bridge 1.1.0 → 1.2.1
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/README.md +14 -6
- package/assets/fonts/NOTICE-PocketSansWorld.md +10 -0
- package/assets/fonts/OFL-PocketSansWorld.txt +93 -0
- package/assets/fonts/PocketSansWorld_12.cpfont +0 -0
- package/assets/fonts/pocket-sans-world.manifest.json +49 -0
- package/assets/learning/LICENSE-CC-BY-SA-4.0.txt +10 -0
- package/assets/learning/NOTICE.md +33 -0
- package/assets/learning/jp-n3-ko.manifest.json +27 -0
- package/assets/learning/jp-n3-ko.pdl +0 -0
- package/dist/agent-cli-diagnostics.d.ts +20 -0
- package/dist/agent-cli-diagnostics.d.ts.map +1 -0
- package/dist/agent-cli-diagnostics.js +100 -0
- package/dist/agent-cli-diagnostics.js.map +1 -0
- package/dist/apme/classifier.d.ts.map +1 -1
- package/dist/apme/classifier.js +18 -10
- package/dist/apme/classifier.js.map +1 -1
- package/dist/apme/claude-transcript-reader.d.ts +36 -0
- package/dist/apme/claude-transcript-reader.d.ts.map +1 -1
- package/dist/apme/claude-transcript-reader.js +78 -2
- package/dist/apme/claude-transcript-reader.js.map +1 -1
- package/dist/apme/collector.d.ts +126 -3
- package/dist/apme/collector.d.ts.map +1 -1
- package/dist/apme/collector.js +450 -41
- package/dist/apme/collector.js.map +1 -1
- package/dist/apme/dashboard-html.d.ts.map +1 -1
- package/dist/apme/dashboard-html.js +278 -36
- package/dist/apme/dashboard-html.js.map +1 -1
- package/dist/apme/graph.d.ts +1 -1
- package/dist/apme/graph.d.ts.map +1 -1
- package/dist/apme/graph.js +51 -1
- package/dist/apme/graph.js.map +1 -1
- package/dist/apme/http.d.ts.map +1 -1
- package/dist/apme/http.js +37 -5
- package/dist/apme/http.js.map +1 -1
- package/dist/apme/index.d.ts +4 -0
- package/dist/apme/index.d.ts.map +1 -1
- package/dist/apme/index.js +19 -3
- package/dist/apme/index.js.map +1 -1
- package/dist/apme/runner.d.ts +90 -0
- package/dist/apme/runner.d.ts.map +1 -1
- package/dist/apme/runner.js +524 -48
- package/dist/apme/runner.js.map +1 -1
- package/dist/apme/sample-to-timeline.d.ts.map +1 -1
- package/dist/apme/sample-to-timeline.js +5 -0
- package/dist/apme/sample-to-timeline.js.map +1 -1
- package/dist/apme/settings.d.ts +8 -0
- package/dist/apme/settings.d.ts.map +1 -1
- package/dist/apme/settings.js +4 -0
- package/dist/apme/settings.js.map +1 -1
- package/dist/apme/store.d.ts +118 -9
- package/dist/apme/store.d.ts.map +1 -1
- package/dist/apme/store.js +342 -44
- package/dist/apme/store.js.map +1 -1
- package/dist/apme/task-gradeability.d.ts +82 -0
- package/dist/apme/task-gradeability.d.ts.map +1 -0
- package/dist/apme/task-gradeability.js +126 -0
- package/dist/apme/task-gradeability.js.map +1 -0
- package/dist/awaiting-overlay.d.ts +13 -26
- package/dist/awaiting-overlay.d.ts.map +1 -1
- package/dist/awaiting-overlay.js +7 -40
- package/dist/awaiting-overlay.js.map +1 -1
- package/dist/bridge-core.d.ts +15 -0
- package/dist/bridge-core.d.ts.map +1 -1
- package/dist/bridge-core.js +30 -4
- package/dist/bridge-core.js.map +1 -1
- package/dist/claude-permission-rules.d.ts +20 -32
- package/dist/claude-permission-rules.d.ts.map +1 -1
- package/dist/claude-permission-rules.js +19 -102
- package/dist/claude-permission-rules.js.map +1 -1
- package/dist/claude-usage-recovery.d.ts +54 -0
- package/dist/claude-usage-recovery.d.ts.map +1 -0
- package/dist/claude-usage-recovery.js +200 -0
- package/dist/claude-usage-recovery.js.map +1 -0
- package/dist/cli.d.ts +11 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +81 -14
- package/dist/cli.js.map +1 -1
- package/dist/codex-rate-limits-live.d.ts +180 -10
- package/dist/codex-rate-limits-live.d.ts.map +1 -1
- package/dist/codex-rate-limits-live.js +475 -22
- package/dist/codex-rate-limits-live.js.map +1 -1
- package/dist/codex-rollout-response.d.ts +43 -0
- package/dist/codex-rollout-response.d.ts.map +1 -1
- package/dist/codex-rollout-response.js +67 -0
- package/dist/codex-rollout-response.js.map +1 -1
- package/dist/coordination-evidence.d.ts +150 -0
- package/dist/coordination-evidence.d.ts.map +1 -0
- package/dist/coordination-evidence.js +455 -0
- package/dist/coordination-evidence.js.map +1 -0
- package/dist/daemon-server.d.ts.map +1 -1
- package/dist/daemon-server.js +592 -35
- package/dist/daemon-server.js.map +1 -1
- package/dist/daemon-ws-client.d.ts +1 -0
- package/dist/daemon-ws-client.d.ts.map +1 -1
- package/dist/daemon-ws-client.js +25 -16
- package/dist/daemon-ws-client.js.map +1 -1
- package/dist/daemon.js +1 -1
- package/dist/deferred-reply-read.d.ts +24 -0
- package/dist/deferred-reply-read.d.ts.map +1 -0
- package/dist/deferred-reply-read.js +42 -0
- package/dist/deferred-reply-read.js.map +1 -0
- package/dist/esp32-serial.d.ts +15 -0
- package/dist/esp32-serial.d.ts.map +1 -1
- package/dist/esp32-serial.js +61 -2
- package/dist/esp32-serial.js.map +1 -1
- package/dist/font-pack.d.ts +15 -0
- package/dist/font-pack.d.ts.map +1 -0
- package/dist/font-pack.js +75 -0
- package/dist/font-pack.js.map +1 -0
- package/dist/glance-frame.d.ts.map +1 -1
- package/dist/glance-frame.js +2 -0
- package/dist/glance-frame.js.map +1 -1
- package/dist/hook-codex-sessions.d.ts +9 -0
- package/dist/hook-codex-sessions.d.ts.map +1 -1
- package/dist/hook-codex-sessions.js +35 -2
- package/dist/hook-codex-sessions.js.map +1 -1
- package/dist/hook-opencode-sessions.d.ts +62 -0
- package/dist/hook-opencode-sessions.d.ts.map +1 -0
- package/dist/hook-opencode-sessions.js +180 -0
- package/dist/hook-opencode-sessions.js.map +1 -0
- package/dist/hook-response-source.d.ts +40 -0
- package/dist/hook-response-source.d.ts.map +1 -0
- package/dist/hook-response-source.js +31 -0
- package/dist/hook-response-source.js.map +1 -0
- package/dist/http-auth-gate.d.ts.map +1 -1
- package/dist/http-auth-gate.js +9 -1
- package/dist/http-auth-gate.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/learning-pack.d.ts +24 -0
- package/dist/learning-pack.d.ts.map +1 -0
- package/dist/learning-pack.js +125 -0
- package/dist/learning-pack.js.map +1 -0
- package/dist/mdns.js +1 -1
- package/dist/mdns.js.map +1 -1
- package/dist/native-dependency-diagnostics.d.ts +29 -0
- package/dist/native-dependency-diagnostics.d.ts.map +1 -0
- package/dist/native-dependency-diagnostics.js +95 -0
- package/dist/native-dependency-diagnostics.js.map +1 -0
- package/dist/observed-steering.d.ts +4 -4
- package/dist/observed-steering.d.ts.map +1 -1
- package/dist/observed-steering.js +28 -32
- package/dist/observed-steering.js.map +1 -1
- package/dist/openclaw-gateway-stability.d.ts +94 -0
- package/dist/openclaw-gateway-stability.d.ts.map +1 -0
- package/dist/openclaw-gateway-stability.js +176 -0
- package/dist/openclaw-gateway-stability.js.map +1 -0
- package/dist/pairing-knocks.d.ts +80 -0
- package/dist/pairing-knocks.d.ts.map +1 -0
- package/dist/pairing-knocks.js +312 -0
- package/dist/pairing-knocks.js.map +1 -0
- package/dist/passive-observer.d.ts +5 -0
- package/dist/passive-observer.d.ts.map +1 -1
- package/dist/passive-observer.js +6 -0
- package/dist/passive-observer.js.map +1 -1
- package/dist/pixoo/micro-glyphs.d.ts +4 -0
- package/dist/pixoo/micro-glyphs.d.ts.map +1 -1
- package/dist/pixoo/micro-glyphs.js +29 -0
- package/dist/pixoo/micro-glyphs.js.map +1 -1
- package/dist/pixoo/pixoo-font.d.ts.map +1 -1
- package/dist/pixoo/pixoo-font.js +3 -1
- package/dist/pixoo/pixoo-font.js.map +1 -1
- package/dist/pixoo/pixoo-renderer.d.ts +1 -1
- package/dist/pixoo/pixoo-renderer.d.ts.map +1 -1
- package/dist/pixoo/pixoo-renderer.js +17 -2
- package/dist/pixoo/pixoo-renderer.js.map +1 -1
- package/dist/pty-manager.d.ts +9 -0
- package/dist/pty-manager.d.ts.map +1 -1
- package/dist/pty-manager.js +63 -4
- package/dist/pty-manager.js.map +1 -1
- package/dist/relayed-usage.d.ts +30 -0
- package/dist/relayed-usage.d.ts.map +1 -1
- package/dist/relayed-usage.js +25 -2
- package/dist/relayed-usage.js.map +1 -1
- package/dist/review-runner.js +1 -1
- package/dist/subagent-timeline.d.ts +27 -0
- package/dist/subagent-timeline.d.ts.map +1 -1
- package/dist/subagent-timeline.js +52 -5
- package/dist/subagent-timeline.js.map +1 -1
- package/dist/surface-protocol.d.ts.map +1 -1
- package/dist/surface-protocol.js +2 -0
- package/dist/surface-protocol.js.map +1 -1
- package/dist/tui/dashboard.d.ts.map +1 -1
- package/dist/tui/dashboard.js +8 -1
- package/dist/tui/dashboard.js.map +1 -1
- package/dist/usage-api.d.ts +3 -0
- package/dist/usage-api.d.ts.map +1 -1
- package/dist/usage-api.js +101 -36
- package/dist/usage-api.js.map +1 -1
- package/dist/usage-event.d.ts.map +1 -1
- package/dist/usage-event.js +2 -1
- package/dist/usage-event.js.map +1 -1
- package/dist/ws-server.d.ts +18 -0
- package/dist/ws-server.d.ts.map +1 -1
- package/dist/ws-server.js +40 -2
- package/dist/ws-server.js.map +1 -1
- package/package.json +6 -5
- package/src/timebox/sync_ble.py +35 -16
|
@@ -29,15 +29,44 @@ interface RawLiveRateLimits {
|
|
|
29
29
|
*/
|
|
30
30
|
export declare function parseLiveCodexRateLimits(result: unknown, capturedAt: string): CodexRateLimits | null;
|
|
31
31
|
/**
|
|
32
|
-
* The account-wide limit block among what `account/rateLimits/read` returned
|
|
32
|
+
* The account-wide limit block among what `account/rateLimits/read` returned,
|
|
33
|
+
* plus the id it should be recorded under.
|
|
33
34
|
*
|
|
34
|
-
* Prefers the top-level `rateLimits`
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
35
|
+
* Prefers the top-level `rateLimits` — what the Codex CLI itself shows, and
|
|
36
|
+
* measured correct on 2026-08-27 at the exact moment the rollout was lying (the
|
|
37
|
+
* account at 100% up there, the Spark pool only under its own map key). Falls
|
|
38
|
+
* back to an unnamed entry of `rateLimitsByLimitId`, windowed before windowless
|
|
39
|
+
* so a `premium` credit block cannot be handed back ahead of a real windowed
|
|
40
|
+
* `codex` entry on iteration order alone. Returns null when every family is
|
|
41
|
+
* model-scoped: "no account-wide reading" is the honest answer, and the caller
|
|
42
|
+
* then keeps whatever the rollout path found rather than adopting one model's
|
|
43
|
+
* quota as the account's.
|
|
44
|
+
*
|
|
45
|
+
* ## What this deliberately does NOT do any more
|
|
46
|
+
*
|
|
47
|
+
* Three successive review rounds found HIGH-severity defects in machinery added
|
|
48
|
+
* here to defend a shape that has never been observed: a top-level block that
|
|
49
|
+
* mislabels itself the way the ROLLOUT does. The defence fingerprinted every
|
|
50
|
+
* candidate against the weekly resets of the response's own named pools, and
|
|
51
|
+
* each version of it failed in a new direction — handing back a block it had
|
|
52
|
+
* just identified as a pool, admitting a pool through a rung that dropped the
|
|
53
|
+
* key test, and finally refusing everything, because the response mirrors its
|
|
54
|
+
* top-level block into the map under its own key and any account id outside a
|
|
55
|
+
* hardcoded allow-list therefore fingerprint-matched ITSELF (`codex_pro` →
|
|
56
|
+
* `null` → no live read at all, which disables the 100%-wall detection this
|
|
57
|
+
* whole path exists for, pins the mid-turn spawn skip open, and leaves the relay
|
|
58
|
+
* guard permanently unarmed).
|
|
59
|
+
*
|
|
60
|
+
* The measured discriminators are `limitName` (non-empty ⇒ scoped, across 823
|
|
61
|
+
* rollouts and every live sample) and the map key, and they are enough. Guessing
|
|
62
|
+
* at a failure the producer has not shown produced three real ones. If the live
|
|
63
|
+
* top level is ever seen mislabelling itself, the fix belongs here — with that
|
|
64
|
+
* observation attached.
|
|
39
65
|
*/
|
|
40
|
-
export declare function pickAccountWideLiveLimits(top?: RawLiveRateLimits | null, byLimitId?: Record<string, RawLiveRateLimits> | null):
|
|
66
|
+
export declare function pickAccountWideLiveLimits(top?: RawLiveRateLimits | null, byLimitId?: Record<string, RawLiveRateLimits> | null): {
|
|
67
|
+
limits: RawLiveRateLimits;
|
|
68
|
+
limitId?: string;
|
|
69
|
+
} | null;
|
|
41
70
|
/**
|
|
42
71
|
* How to hand the Codex binary to `spawn`.
|
|
43
72
|
*
|
|
@@ -65,6 +94,58 @@ export declare function queryCodexRateLimitsLive(opts?: {
|
|
|
65
94
|
args?: string[];
|
|
66
95
|
timeoutMs?: number;
|
|
67
96
|
}): Promise<CodexRateLimits | null>;
|
|
97
|
+
/**
|
|
98
|
+
* Whether the live reading contradicts the passive one about WHOSE quota it is.
|
|
99
|
+
* The picker uses it to prefer the live snapshot; the throttle uses its negation
|
|
100
|
+
* to decide whether the passive snapshot's freshness may suppress the next
|
|
101
|
+
* query. One expression, because written as two they drifted immediately: the
|
|
102
|
+
* throttle compared families against a cached live snapshot with no bound at
|
|
103
|
+
* all, so once that snapshot's window elapsed the mid-turn skip was lifted
|
|
104
|
+
* permanently while the picker had already stopped honouring the same
|
|
105
|
+
* fingerprint.
|
|
106
|
+
*
|
|
107
|
+
* The two consumers still REACH it differently, and that is deliberate rather
|
|
108
|
+
* than drift. The picker settles plan disagreement first and never asks this at
|
|
109
|
+
* all when the classes differ; the throttle asks it regardless, because a cached
|
|
110
|
+
* live snapshot minted under a retired plan is itself a reason to spend a query
|
|
111
|
+
* — the answer that replaces it is the only thing that can end the disagreement.
|
|
112
|
+
* The cost is bounded by the same spawn throttles as everything else here.
|
|
113
|
+
*
|
|
114
|
+
* The throttle must NOT reuse this predicate, and that is the whole point of
|
|
115
|
+
* `liveCorroboratesPassiveFamily` below. Exported for unit testing.
|
|
116
|
+
*/
|
|
117
|
+
export declare function liveRejectsPassiveFamily(passive?: CodexRateLimits | null, live?: CodexRateLimits | null, nowMs?: number): boolean;
|
|
118
|
+
/**
|
|
119
|
+
* True when two snapshots describe the same limit FAMILY — or when there is not
|
|
120
|
+
* enough information to say they do not.
|
|
121
|
+
*
|
|
122
|
+
* `isModelScopedCodexLimit` reads the family off the snapshot's own `limit_name`,
|
|
123
|
+
* and that discriminator stopped being reliable on the rollout path. Measured
|
|
124
|
+
* 2026-08-27, inside a single rollout file, after the account's weekly quota was
|
|
125
|
+
* exhausted:
|
|
126
|
+
*
|
|
127
|
+
* ...T20:59:45Z limit_id "codex" limit_name null weekly resets 1788274890 (the account)
|
|
128
|
+
* ...T20:59:46Z limit_id "premium" limit_name null no windows at all
|
|
129
|
+
* ...T13:01:31Z limit_id "codex" limit_name null 5h + weekly resets 1788440488
|
|
130
|
+
*
|
|
131
|
+
* That third shape is `codex_bengalfox` ("GPT-5.3-Codex-Spark") wearing the
|
|
132
|
+
* account's id: `account/rateLimits/read` returned the SAME two reset instants
|
|
133
|
+
* under `rateLimitsByLimitId.codex_bengalfox` at that moment, while the account
|
|
134
|
+
* family sat at 100% with `rateLimitReachedType: "rate_limit_reached"`. So once
|
|
135
|
+
* the account limit is reached and Codex serves the turn from a per-model pool,
|
|
136
|
+
* the rollout records that pool's numbers under an unnamed `codex` label and the
|
|
137
|
+
* name-based filter admits them: the deck read 54% / 24% for an exhausted week.
|
|
138
|
+
*
|
|
139
|
+
* The live read is the only source that keys families correctly, so it is what
|
|
140
|
+
* the passive reading is checked against. Two rules keep the check honest:
|
|
141
|
+
* an unknown on either side is "no information" and matches (a pre-`limit_id`
|
|
142
|
+
* rollout, a credit plan with no weekly window), and a mismatch is resolved by
|
|
143
|
+
* preferring the LIVE snapshot rather than by dropping both — the mismatch also
|
|
144
|
+
* arises legitimately for a few minutes after the account's weekly window rolls
|
|
145
|
+
* over, and there the live answer is merely stale, never wrong about whose
|
|
146
|
+
* quota it is. Exported for unit testing.
|
|
147
|
+
*/
|
|
148
|
+
export declare function codexSnapshotsShareLimitFamily(a?: CodexRateLimits | null, b?: CodexRateLimits | null): boolean;
|
|
68
149
|
/**
|
|
69
150
|
* Choose between the passive rollout reading and the live app-server reading.
|
|
70
151
|
*
|
|
@@ -75,9 +156,34 @@ export declare function queryCodexRateLimitsLive(opts?: {
|
|
|
75
156
|
* current, and the ONLY source carrying the new tier — lost every comparison and
|
|
76
157
|
* was then voided as a mismatch. A snapshot with no `capturedAt` at all loses to
|
|
77
158
|
* a stamped one within its match class; ties keep the passive reading, which is
|
|
78
|
-
* the on-disk ground truth.
|
|
159
|
+
* the on-disk ground truth.
|
|
160
|
+
*
|
|
161
|
+
* Family agreement is a tie-break WITHIN the plan class, and settled before
|
|
162
|
+
* recency, which cannot see it: the rollout is appended every couple of seconds
|
|
163
|
+
* while Codex works, so a snapshot describing a per-model pool under the
|
|
164
|
+
* account's id (see `codexSnapshotsShareLimitFamily`) wins every recency
|
|
165
|
+
* comparison for as long as the session runs, and the true account reading only
|
|
166
|
+
* surfaces in the gaps where the live query gets to fire. That is the
|
|
167
|
+
* oscillation this guard removes — the same gauge alternating between an
|
|
168
|
+
* exhausted week and a half-used one depending on which source answered last.
|
|
169
|
+
*
|
|
170
|
+
* It must stay UNDER the plan test, because a plan change moves the weekly reset
|
|
171
|
+
* instant too (`1787805401` under `plus` → `1787934975` under `prolite`, same
|
|
172
|
+
* `limit_id: "codex"`, both verbatim in `codex-rate-limits.test.ts`). Ranked
|
|
173
|
+
* above it, the family guard would answer a plan change by handing back the
|
|
174
|
+
* retired-plan live snapshot — which `normalizeCodexRateLimits` then voids to a
|
|
175
|
+
* windowless block, blanking every Codex gauge for up to the failure backoff.
|
|
176
|
+
* That is precisely the regression `codexSnapshotOutranks` exists to prevent,
|
|
177
|
+
* reintroduced through the door next to it.
|
|
178
|
+
*
|
|
179
|
+
* Only a live snapshot whose own weekly window exists AND is still running gets
|
|
180
|
+
* to reject anything (`familyFingerprintCanReject`) — an expired or absent
|
|
181
|
+
* fingerprint is not evidence about which family the current window belongs to.
|
|
182
|
+
* Exported for unit testing; `nowMs` is injectable for the same reason.
|
|
79
183
|
*/
|
|
80
|
-
export declare function pickBestCodexRateLimits(passive: CodexRateLimits | null, live: CodexRateLimits | null, accountPlan?: string
|
|
184
|
+
export declare function pickBestCodexRateLimits(passive: CodexRateLimits | null, live: CodexRateLimits | null, accountPlan?: string, nowMs?: number, opts?: {
|
|
185
|
+
liveOwnsFamilyAuthority?: boolean;
|
|
186
|
+
}): CodexRateLimits | null;
|
|
81
187
|
/** Throttle policy, kept pure so the cadence is testable without spawning. */
|
|
82
188
|
export declare function shouldQueryCodexRateLimitsLive(input: {
|
|
83
189
|
nowMs: number;
|
|
@@ -88,7 +194,58 @@ export declare function shouldQueryCodexRateLimitsLive(input: {
|
|
|
88
194
|
* longer holds — i.e. it is about to be voided and carries no usable number.
|
|
89
195
|
* Defaults to true so callers that know no account tier behave as before. */
|
|
90
196
|
passivePlanMatchesAccount?: boolean;
|
|
197
|
+
/** False when the passive snapshot describes a different limit family from the
|
|
198
|
+
* last live answer — it is then a different QUANTITY, not a fresher reading of
|
|
199
|
+
* the same one, so its freshness must not suppress the query that carries the
|
|
200
|
+
* account's number. Defaults to true (no live answer yet ⇒ nothing to compare
|
|
201
|
+
* against). */
|
|
202
|
+
passiveMatchesAccountFamily?: boolean;
|
|
91
203
|
}): boolean;
|
|
204
|
+
/**
|
|
205
|
+
* Whether a published Codex block may speak for the account's limit FAMILY —
|
|
206
|
+
* the question the relay path has to answer before it lets that block reject a
|
|
207
|
+
* session bridge's.
|
|
208
|
+
*
|
|
209
|
+
* It is deliberately NOT "did the live snapshot win the last pick". Identity
|
|
210
|
+
* with the pick is false in the ordinary good case: when the two readings agree
|
|
211
|
+
* on family the picker keeps the fresher rollout, which while Codex is working
|
|
212
|
+
* is every single build. Read that way, the guard switched itself off exactly
|
|
213
|
+
* when the daemon did hold a verified baseline — and a bridge sampling a
|
|
214
|
+
* mislabelled pool line a second later then won on recency, which is the
|
|
215
|
+
* oscillation this whole change removes, surviving at the one call site that
|
|
216
|
+
* had no other defence.
|
|
217
|
+
*
|
|
218
|
+
* The real question is whether a live answer exists, carries a fingerprint that
|
|
219
|
+
* may reject (`familyFingerprintCanReject`), and agrees with what was published.
|
|
220
|
+
* A plan-voided live snapshot fails the second test rather than lending its
|
|
221
|
+
* authority to a passive block that outranked it for unrelated reasons.
|
|
222
|
+
*
|
|
223
|
+
* Takes the live block rather than reading the module cache, so the rule can be
|
|
224
|
+
* driven directly instead of only through a spawn, and answers with the instant
|
|
225
|
+
* the authority lapses rather than a yes/no read against the caller's clock.
|
|
226
|
+
*/
|
|
227
|
+
export declare function codexLiveFamilyAuthorityExpiry(published?: CodexRateLimits | null, live?: CodexRateLimits | null): number | null;
|
|
228
|
+
/**
|
|
229
|
+
* Whether the cached live answer positively vouches for the passive reading's
|
|
230
|
+
* family — the THROTTLE's question, and deliberately not the picker's.
|
|
231
|
+
*
|
|
232
|
+
* Routing the throttle through `liveRejectsPassiveFamily` deadlocked the two
|
|
233
|
+
* bounds against each other on exactly the busy machine this change is for. The
|
|
234
|
+
* skip suppresses queries while the rollout is fresh, so under continuous Codex
|
|
235
|
+
* use the cached answer is never refreshed; fifteen minutes in it loses its
|
|
236
|
+
* authority; and from then on a disagreement could no longer be REPORTED as one,
|
|
237
|
+
* because the age bound lives inside the rejection test. `passiveMatchesAccountFamily`
|
|
238
|
+
* stayed true, the skip stayed engaged, no query ever fired, and the picker fell
|
|
239
|
+
* through to recency — publishing the mislabelled pool reading for the rest of
|
|
240
|
+
* the run.
|
|
241
|
+
*
|
|
242
|
+
* So the polarity is inverted here on purpose: the skip is earned by a live
|
|
243
|
+
* answer that is present, still able to arbitrate, and in agreement. Anything
|
|
244
|
+
* else — no answer, a stale one, a disagreeing one — is a REASON to spend a
|
|
245
|
+
* query, never a reason to skip one. The spawn throttles bound the cost either
|
|
246
|
+
* way. Exported for unit testing.
|
|
247
|
+
*/
|
|
248
|
+
export declare function liveCorroboratesPassiveFamily(passive?: CodexRateLimits | null, live?: CodexRateLimits | null, nowMs?: number): boolean;
|
|
92
249
|
/** Last live snapshot, or null if none has been obtained. */
|
|
93
250
|
export declare function getLiveCodexRateLimits(): CodexRateLimits | null;
|
|
94
251
|
/**
|
|
@@ -101,9 +258,22 @@ export declare function getLiveCodexRateLimits(): CodexRateLimits | null;
|
|
|
101
258
|
* `accountPlan` is the live tier from `auth.json`. Passing it is what lets both
|
|
102
259
|
* halves of this function tell "old" from "void"; omitting it keeps the previous
|
|
103
260
|
* newest-wins behaviour.
|
|
261
|
+
*
|
|
262
|
+
* The third axis needs no argument: the last live answer is itself the record of
|
|
263
|
+
* which limit family belongs to the account, so a passive snapshot describing a
|
|
264
|
+
* different one is neither preferred nor allowed to throttle the next query
|
|
265
|
+
* (`codexSnapshotsShareLimitFamily`).
|
|
104
266
|
*/
|
|
105
267
|
export declare function codexRateLimitsWithLiveRefresh(passive: CodexRateLimits | null, accountPlan?: string): CodexRateLimits | null;
|
|
106
268
|
/** Test hook — clears the module-level cache and throttle state. */
|
|
107
|
-
export declare function __resetCodexRateLimitsLiveForTest(
|
|
269
|
+
export declare function __resetCodexRateLimitsLiveForTest(seed?: {
|
|
270
|
+
cachedLive?: CodexRateLimits | null;
|
|
271
|
+
lastAttemptMs?: number;
|
|
272
|
+
}): void;
|
|
273
|
+
/** Throttle state, so a test can tell "a query was spent" from "the skip held".
|
|
274
|
+
* `lastAttemptMs` moves synchronously, before any subprocess exists. */
|
|
275
|
+
export declare function __peekCodexRateLimitsLiveForTest(): {
|
|
276
|
+
lastAttemptMs: number;
|
|
277
|
+
};
|
|
108
278
|
export {};
|
|
109
279
|
//# sourceMappingURL=codex-rate-limits-live.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex-rate-limits-live.d.ts","sourceRoot":"","sources":["../src/codex-rate-limits-live.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAgB,eAAe,EAAwB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"codex-rate-limits-live.d.ts","sourceRoot":"","sources":["../src/codex-rate-limits-live.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAgB,eAAe,EAAwB,MAAM,mBAAmB,CAAC;AAwD7F,UAAU,aAAa;IACrB,W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