@claudexor/daemon 3.8.4 → 3.9.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/dist/index.d.ts CHANGED
@@ -20,6 +20,8 @@ export * from "./command-authority.js";
20
20
  export * from "./resource-store.js";
21
21
  export * from "./quota-registry.js";
22
22
  export * from "./quota-projection.js";
23
+ export * from "./quota-poll-lanes.js";
24
+ export { quotaPacerFileStore } from "./quota-poll-pacer.js";
23
25
  export * from "./credential-unusable-ledger.js";
24
26
  export * from "./project-partitions.js";
25
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC"}
package/dist/index.js CHANGED
@@ -20,6 +20,8 @@ export * from "./command-authority.js";
20
20
  export * from "./resource-store.js";
21
21
  export * from "./quota-registry.js";
22
22
  export * from "./quota-projection.js";
23
+ export * from "./quota-poll-lanes.js";
24
+ export { quotaPacerFileStore } from "./quota-poll-pacer.js";
23
25
  export * from "./credential-unusable-ledger.js";
24
26
  export * from "./project-partitions.js";
25
27
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1,100 @@
1
+ import type { QuotaAbsence, QuotaSnapshot, QuotaSubject } from "@claudexor/schema";
2
+ import { QuotaPollPacer, type QuotaPacerStateStore } from "./quota-poll-pacer.js";
3
+ /** One refresh cycle's fruit: the snapshots a source observed, plus the typed
4
+ * absences it CLAIMS for subjects it tried and could not observe. Absence is
5
+ * stated by the source, never inferred from an empty snapshot list. */
6
+ export interface QuotaRefreshResult {
7
+ snapshots: QuotaSnapshot[];
8
+ absences?: QuotaAbsence[];
9
+ }
10
+ export type QuotaRefresher = () => Promise<QuotaRefreshResult>;
11
+ /** A refresher bound to its vendor pacing lane. Refreshers of one vendor
12
+ * share ONE QuotaPollPacer, so a permanently unsatisfiable subject of one
13
+ * vendor backs off alone instead of pinning every vendor's cadence at the
14
+ * 15-minute ceiling. A bare QuotaRefresher (legacy embedders, tests) rides an
15
+ * anonymous lane with the pre-existing global-demand semantics. */
16
+ export interface QuotaVendorRefresher {
17
+ readonly vendor: string;
18
+ readonly refresh: QuotaRefresher;
19
+ }
20
+ export interface PacingLane {
21
+ readonly vendor: string | null;
22
+ readonly pacer: QuotaPollPacer;
23
+ }
24
+ export interface RefresherLanes {
25
+ /** Declaration-ordered refreshers, each bound to its pacing lane. */
26
+ readonly entries: ReadonlyArray<{
27
+ lane: PacingLane;
28
+ refresh: QuotaRefresher;
29
+ }>;
30
+ /** Distinct pacing lanes in first-appearance order. */
31
+ readonly lanes: readonly PacingLane[];
32
+ }
33
+ export declare function buildRefresherLanes(refreshers: readonly (QuotaRefresher | QuotaVendorRefresher)[], pacerStore?: QuotaPacerStateStore): RefresherLanes;
34
+ export interface PollSweepDeps {
35
+ readonly now: () => Date;
36
+ readonly publishClockTransition: () => void;
37
+ readonly laneHasDemand: (vendor: string | null, now: number) => boolean;
38
+ readonly currentGeneration: () => number;
39
+ readonly isCurrentGeneration: (generation: number) => boolean;
40
+ readonly runLaneCycle: (lane: PacingLane) => Promise<unknown>;
41
+ }
42
+ /** One background poll sweep: drive every vendor lane in order, running a
43
+ * coalesced cycle for each lane that is past its pacer gates and still has
44
+ * refresh demand, so one vendor's backoff never starves a sibling vendor's
45
+ * freshness. Resolves true when any lane refreshed. Single-flight of the
46
+ * sweep itself belongs to the caller. */
47
+ export declare function performPollSweep(lanes: readonly PacingLane[], deps: PollSweepDeps): Promise<boolean>;
48
+ /** Per-lane refresh demand: a vendor lane sees only its own subjects and
49
+ * snapshots; an anonymous lane keeps the pre-existing global semantics. */
50
+ export declare function laneHasDemand(vendor: string | null, snapshots: readonly QuotaSnapshot[], subjects?: readonly QuotaSubject[]): boolean;
51
+ export interface LaneCycleSelection {
52
+ readonly running: ReadonlyArray<{
53
+ lane: PacingLane;
54
+ refresh: QuotaRefresher;
55
+ }>;
56
+ readonly skipped: Array<{
57
+ vendor: string;
58
+ not_before: string;
59
+ }>;
60
+ }
61
+ /** Select which refreshers one cycle runs. A full (foreground) cycle honors
62
+ * each vendor lane's rate-limit floor: a vendor that just said 429 is not
63
+ * re-fanned-out by an explicit refresh — its skip is returned for additive
64
+ * disclosure. A poll-scoped cycle was already gated by the sweep. Anonymous
65
+ * lanes never carry a floor and always run. */
66
+ export declare function selectCycleEntries(refresherLanes: RefresherLanes, scope: PacingLane | null, nowMs: number): LaneCycleSelection;
67
+ /** Absence recomputation covers exactly the lanes that RAN: an anonymous
68
+ * lane's coverage is unknowable, so its cycle keeps the full rebuild. */
69
+ export declare function recomputeScopeFor(running: LaneCycleSelection["running"]): ReadonlySet<string> | null;
70
+ /** Derived `poll_paced` gap rows: while a vendor lane's rate-limit floor is
71
+ * active, every universe subject of that vendor lacking FRESH snapshot cover
72
+ * and lacking a stored absence row is stated as paused — a live projection
73
+ * (never journaled), stable per floor so the projection signature does not
74
+ * churn markers on every read. Keeps a suppressed vendor's subjects from
75
+ * falling silent (daemon restarts with a store-loaded floor included) and
76
+ * downstream exhaustion readers fail-open. */
77
+ export declare function derivePollPacedRows(lanes: readonly PacingLane[], subjects: readonly QuotaSubject[], existingRows: readonly QuotaAbsence[], freshCovered: ReadonlySet<string>, now: number): QuotaAbsence[];
78
+ /** Subject-identity cover sets over one active-snapshot view. Gap rows are
79
+ * silenced only by the FRESH set; every other reason by any active snapshot. */
80
+ export declare function subjectCoverSets(active: readonly QuotaSnapshot[]): {
81
+ covered: ReadonlySet<string>;
82
+ freshCovered: ReadonlySet<string>;
83
+ };
84
+ /** Pure absence fold for one cycle (V11a semantics): preserved out-of-scope
85
+ * rows first, then first-claim-wins claims, then `no_source` for uncovered
86
+ * in-scope universe subjects. Gap-representation claims ("deliberately not
87
+ * asked": rate_limited and its skip siblings) are silenced only by a FRESH
88
+ * snapshot — a stale one is exactly the state the gap row explains, and
89
+ * dropping the row there would let a stale spent window read as exhausted
90
+ * downstream. */
91
+ export declare function foldAbsenceClaims(input: {
92
+ claims: readonly QuotaAbsence[];
93
+ prior: readonly QuotaAbsence[];
94
+ rebuilt: (harness: string) => boolean;
95
+ covered: ReadonlySet<string>;
96
+ freshCovered: ReadonlySet<string>;
97
+ subjects: readonly QuotaSubject[];
98
+ now: number;
99
+ }): QuotaAbsence[];
100
+ //# sourceMappingURL=quota-poll-lanes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quota-poll-lanes.d.ts","sourceRoot":"","sources":["../src/quota-poll-lanes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAGlF;;uEAEuE;AACvE,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;CAC3B;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAE/D;;;;mEAImE;AACnE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC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AAO,CAAC;IACtC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7B,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC,QAAQ,EAAE,SAAS,YAAY,EAAE,CAAC;IAClC,GAAG,EAAE,MAAM,CAAC;CACb,GAAG,YAAY,EAAE,CAwBjB"}
@@ -0,0 +1,168 @@
1
+ import { QUOTA_GAP_ABSENCE_REASONS } from "@claudexor/schema";
2
+ import { QuotaPollPacer } from "./quota-poll-pacer.js";
3
+ import { quotaSubjectIdentity, remainingQuotaRefreshDemand } from "./quota-refresh-demand.js";
4
+ export function buildRefresherLanes(refreshers, pacerStore) {
5
+ const laneByVendor = new Map();
6
+ const entries = refreshers.map((registration) => {
7
+ if (typeof registration === "function") {
8
+ return { lane: { vendor: null, pacer: new QuotaPollPacer() }, refresh: registration };
9
+ }
10
+ let lane = laneByVendor.get(registration.vendor);
11
+ if (!lane) {
12
+ lane = {
13
+ vendor: registration.vendor,
14
+ pacer: new QuotaPollPacer(registration.vendor, pacerStore),
15
+ };
16
+ laneByVendor.set(registration.vendor, lane);
17
+ }
18
+ return { lane, refresh: registration.refresh };
19
+ });
20
+ return { entries, lanes: [...new Set(entries.map((entry) => entry.lane))] };
21
+ }
22
+ /** One background poll sweep: drive every vendor lane in order, running a
23
+ * coalesced cycle for each lane that is past its pacer gates and still has
24
+ * refresh demand, so one vendor's backoff never starves a sibling vendor's
25
+ * freshness. Resolves true when any lane refreshed. Single-flight of the
26
+ * sweep itself belongs to the caller. */
27
+ export async function performPollSweep(lanes, deps) {
28
+ deps.publishClockTransition();
29
+ let ran = false;
30
+ for (const lane of lanes) {
31
+ const now = deps.now().getTime();
32
+ if (!lane.pacer.pollEligible(now))
33
+ continue;
34
+ if (!deps.laneHasDemand(lane.vendor, now))
35
+ continue;
36
+ const generation = deps.currentGeneration();
37
+ try {
38
+ await deps.runLaneCycle(lane);
39
+ ran = true;
40
+ // A cycle fenced away by a credential change reports no pacing
41
+ // outcome: the fresh-generation poll re-decides from scratch.
42
+ if (!deps.isCurrentGeneration(generation))
43
+ continue;
44
+ const completedAt = deps.now().getTime();
45
+ lane.pacer.notePollSuccess(completedAt, deps.laneHasDemand(lane.vendor, completedAt));
46
+ }
47
+ catch {
48
+ if (deps.isCurrentGeneration(generation)) {
49
+ lane.pacer.notePollFailure(deps.now().getTime());
50
+ }
51
+ }
52
+ }
53
+ return ran;
54
+ }
55
+ /** Per-lane refresh demand: a vendor lane sees only its own subjects and
56
+ * snapshots; an anonymous lane keeps the pre-existing global semantics. */
57
+ export function laneHasDemand(vendor, snapshots, subjects) {
58
+ if (vendor === null)
59
+ return remainingQuotaRefreshDemand(snapshots, subjects).size > 0;
60
+ return (remainingQuotaRefreshDemand(snapshots.filter((snapshot) => snapshot.subject.harness === vendor), subjects?.filter((subject) => subject.harness === vendor)).size > 0);
61
+ }
62
+ /** Select which refreshers one cycle runs. A full (foreground) cycle honors
63
+ * each vendor lane's rate-limit floor: a vendor that just said 429 is not
64
+ * re-fanned-out by an explicit refresh — its skip is returned for additive
65
+ * disclosure. A poll-scoped cycle was already gated by the sweep. Anonymous
66
+ * lanes never carry a floor and always run. */
67
+ export function selectCycleEntries(refresherLanes, scope, nowMs) {
68
+ const skipped = scope === null
69
+ ? refresherLanes.lanes.flatMap((lane) => {
70
+ const until = lane.vendor === null ? null : lane.pacer.rateLimitCooldownUntil(nowMs);
71
+ return until === null
72
+ ? []
73
+ : [{ vendor: lane.vendor, not_before: new Date(until).toISOString() }];
74
+ })
75
+ : [];
76
+ const skippedVendors = new Set(skipped.map((row) => row.vendor));
77
+ const running = refresherLanes.entries.filter((entry) => scope === null
78
+ ? entry.lane.vendor === null || !skippedVendors.has(entry.lane.vendor)
79
+ : entry.lane === scope);
80
+ return { running, skipped };
81
+ }
82
+ /** Absence recomputation covers exactly the lanes that RAN: an anonymous
83
+ * lane's coverage is unknowable, so its cycle keeps the full rebuild. */
84
+ export function recomputeScopeFor(running) {
85
+ const ranLanes = [...new Set(running.map((entry) => entry.lane))];
86
+ return ranLanes.some((lane) => lane.vendor === null)
87
+ ? null
88
+ : new Set(ranLanes.map((lane) => lane.vendor));
89
+ }
90
+ /** Derived `poll_paced` gap rows: while a vendor lane's rate-limit floor is
91
+ * active, every universe subject of that vendor lacking FRESH snapshot cover
92
+ * and lacking a stored absence row is stated as paused — a live projection
93
+ * (never journaled), stable per floor so the projection signature does not
94
+ * churn markers on every read. Keeps a suppressed vendor's subjects from
95
+ * falling silent (daemon restarts with a store-loaded floor included) and
96
+ * downstream exhaustion readers fail-open. */
97
+ export function derivePollPacedRows(lanes, subjects, existingRows, freshCovered, now) {
98
+ const present = new Set(existingRows.map((row) => quotaSubjectIdentity(row.subject)));
99
+ const rows = [];
100
+ for (const lane of lanes) {
101
+ if (lane.vendor === null)
102
+ continue;
103
+ const until = lane.pacer.rateLimitCooldownUntil(now);
104
+ if (until === null)
105
+ continue;
106
+ for (const subject of subjects) {
107
+ if (subject.harness !== lane.vendor)
108
+ continue;
109
+ const key = quotaSubjectIdentity(subject);
110
+ if (freshCovered.has(key) || present.has(key))
111
+ continue;
112
+ present.add(key);
113
+ rows.push({
114
+ subject,
115
+ reason: "poll_paced",
116
+ detail: `vendor poll paused by rate-limit cooldown until ${new Date(until).toISOString()}`,
117
+ observed_at: new Date(lane.pacer.rateLimitObservedAt(now)).toISOString(),
118
+ });
119
+ }
120
+ }
121
+ return rows;
122
+ }
123
+ /** Subject-identity cover sets over one active-snapshot view. Gap rows are
124
+ * silenced only by the FRESH set; every other reason by any active snapshot. */
125
+ export function subjectCoverSets(active) {
126
+ return {
127
+ covered: new Set(active.map((snapshot) => quotaSubjectIdentity(snapshot.subject))),
128
+ freshCovered: new Set(active
129
+ .filter((snapshot) => snapshot.freshness === "fresh")
130
+ .map((snapshot) => quotaSubjectIdentity(snapshot.subject))),
131
+ };
132
+ }
133
+ /** Pure absence fold for one cycle (V11a semantics): preserved out-of-scope
134
+ * rows first, then first-claim-wins claims, then `no_source` for uncovered
135
+ * in-scope universe subjects. Gap-representation claims ("deliberately not
136
+ * asked": rate_limited and its skip siblings) are silenced only by a FRESH
137
+ * snapshot — a stale one is exactly the state the gap row explains, and
138
+ * dropping the row there would let a stale spent window read as exhausted
139
+ * downstream. */
140
+ export function foldAbsenceClaims(input) {
141
+ const preserved = input.prior.filter((absence) => !input.rebuilt(absence.subject.harness));
142
+ const result = [];
143
+ const claimed = new Set(preserved.map((item) => quotaSubjectIdentity(item.subject)));
144
+ for (const claim of input.claims) {
145
+ const key = quotaSubjectIdentity(claim.subject);
146
+ const cover = QUOTA_GAP_ABSENCE_REASONS.has(claim.reason) ? input.freshCovered : input.covered;
147
+ if (cover.has(key) || claimed.has(key))
148
+ continue;
149
+ claimed.add(key);
150
+ result.push(claim);
151
+ }
152
+ for (const subject of input.subjects) {
153
+ if (!input.rebuilt(subject.harness))
154
+ continue;
155
+ const key = quotaSubjectIdentity(subject);
156
+ if (input.covered.has(key) || claimed.has(key))
157
+ continue;
158
+ claimed.add(key);
159
+ result.push({
160
+ subject,
161
+ reason: "no_source",
162
+ detail: null,
163
+ observed_at: new Date(input.now).toISOString(),
164
+ });
165
+ }
166
+ return [...preserved, ...result];
167
+ }
168
+ //# sourceMappingURL=quota-poll-lanes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quota-poll-lanes.js","sourceRoot":"","sources":["../src/quota-poll-lanes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAE,cAAc,EAA6B,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAkC9F,MAAM,UAAU,mBAAmB,CACjC,UAA8D,EAC9D,UAAiC;IAEjC,MAAM,YAAY,GAAG,IAAI,GAAG,EAAsB,CAAC;IACnD,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE;QA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QACjC,MAAM,GAAG,GAAG,oBAAoB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAChD,MAAM,KAAK,GAAG,yBAAyB,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;QAC/F,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,SAAS;QACjD,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACjB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;IACD,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QACrC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;YAAE,SAAS;QAC9C,MAAM,GAAG,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAC1C,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,SAAS;QACzD,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACjB,MAAM,CAAC,IAAI,CAAC;YACV,OAAO;YACP,MAAM,EAAE,WAAW;YACnB,MAAM,EAAE,IAAI;YACZ,WAAW,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE;SAC/C,CAAC,CAAC;IACL,CAAC;IACD,OAAO,CAAC,GAAG,SAAS,EAAE,GAAG,MAAM,CAAC,CAAC;AACnC,CAAC"}
@@ -1,23 +1,71 @@
1
- export interface QuotaPollPacerDeps {
2
- readonly now: () => Date;
3
- readonly publishClockTransition: () => void;
4
- readonly hasDemand: (now: number) => boolean;
5
- readonly refresh: () => Promise<void>;
1
+ /**
2
+ * Daemon-private persistence for one pacer fact: the per-vendor rate-limit
3
+ * floor. Deliberately OUTSIDE the quota journal and every quota projection
4
+ * (owner decision 7=A): a throttled POLL is pacing state, never quota truth —
5
+ * journaling it as a cooldown would read as "window exhausted" to rotation
6
+ * and to external consumers of the quota surface.
7
+ */
8
+ export interface QuotaPacerStateStore {
9
+ /** Millisecond epoch before which the vendor must not be polled; 0 = none. */
10
+ load(vendor: string): number;
11
+ save(vendor: string, notBeforeMs: number): void;
6
12
  }
7
- /** Whole-lifecycle single-flight and completion-anchored pacing for the quota
8
- * registry. Evidence/demand semantics stay with QuotaRegistry; this helper
9
- * owns only scheduling state. */
13
+ /** File-backed store under the daemon dir. Best-effort durability: a missing,
14
+ * corrupt, or unwritable file only forgets the floor (fail-open to polling),
15
+ * it never breaks the poll cycle. */
16
+ export declare function quotaPacerFileStore(dir: string): QuotaPacerStateStore;
17
+ /**
18
+ * Completion-anchored poll pacing for ONE vendor lane of the quota registry
19
+ * (one instance per vendor with a registered refresher), so a permanently
20
+ * unsatisfiable subject of one vendor can no longer pin every other vendor's
21
+ * refresh cadence at the 15-minute ceiling. Two independent gates:
22
+ *
23
+ * - the credential-demand backoff (`failures`/`notBefore`): in-memory,
24
+ * exponential per unsatisfied cycle, reset by a credential change — the
25
+ * pre-existing semantics, now per lane;
26
+ * - the vendor rate-limit floor (`rateLimitedNotBefore`): armed when a cycle
27
+ * observes a typed `rate_limited` absence for this vendor, honoring the
28
+ * vendor's Retry-After when known (max with the exponential ladder, 60s
29
+ * minimum). Persisted through the daemon-private store so a restart is not
30
+ * a 429 amplifier, and deliberately NOT reset by a credential change —
31
+ * logging in again does not un-rate-limit the vendor endpoint.
32
+ *
33
+ * Evidence/demand semantics stay with QuotaRegistry; this class owns only
34
+ * scheduling state. Single-flight of the poll sweep also lives in the
35
+ * registry, which drives every lane from one sweep.
36
+ */
10
37
  export declare class QuotaPollPacer {
11
- private readonly deps;
38
+ private readonly vendor;
39
+ private readonly store?;
12
40
  private failures;
13
41
  private notBefore;
14
- private inFlight;
15
- /** Prevent an old-credential cycle from restoring backoff after a reset. */
16
- private credentialGeneration;
17
- constructor(deps: QuotaPollPacerDeps);
42
+ private rateLimitedNotBefore;
43
+ /** When the active floor was observed (0 = unknown, e.g. store-loaded). */
44
+ private rateLimitedSince;
45
+ constructor(vendor?: string | null, store?: QuotaPacerStateStore | undefined);
46
+ /** Credential/routability change: drop only the credential-demand backoff.
47
+ * The vendor rate-limit floor survives — it is about the vendor endpoint,
48
+ * not about which credentials exist (and a daemon restart or profile toggle
49
+ * must not become a 429 amplifier). */
18
50
  noteCredentialChange(): void;
19
- poll(): Promise<boolean>;
20
- private perform;
51
+ pollEligible(now: number): boolean;
52
+ /** The active vendor rate-limit floor, or null when none is in effect. */
53
+ rateLimitCooldownUntil(now: number): number | null;
54
+ /** Stable observation stamp for the ACTIVE floor's derived gap rows: the
55
+ * instant the floor was observed. A store-loaded floor (daemon restart)
56
+ * has no recorded observation, so the first read anchors it — stability of
57
+ * the projection signature matters more than the exact historical instant,
58
+ * and the anchor is honest ("known paused since at least then"). */
59
+ rateLimitObservedAt(now: number): number;
60
+ /** A cycle for this lane completed: reset on fully satisfied demand, else
61
+ * exponential backoff anchored at completion (never the stale start). */
62
+ notePollSuccess(completedAt: number, demandRemains: boolean): void;
63
+ notePollFailure(completedAt: number): void;
64
+ /** A cycle observed a typed `rate_limited` absence for this vendor: arm the
65
+ * floor at max(exponential ladder, vendor Retry-After), monotonic, and
66
+ * persist it (a null Retry-After — Anthropic does not always send one —
67
+ * still arms the exponential-derived floor). */
68
+ noteRateLimited(observedAt: number, retryAfterMs: number | null): void;
21
69
  private armBackoff;
22
70
  }
23
71
  //# sourceMappingURL=quota-poll-pacer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"quota-poll-pacer.d.ts","sourceRoot":"","sources":["../src/quota-poll-pacer.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,GAAG,EAAE,MAAM,IAAI,CAAC;IACzB,Q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B,MAAM,GAAE,MAAM,GAAG,IAAW,EAC5B,KAAK,CAAC,EAAE,oBAAoB,YAAA,EAS9C;IAED;;;2CAGuC;IACvC,oBAAoB,IAAI,IAAI,CAG3B;IAED,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEjC;IAED,0EAA0E;IAC1E,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEjD;IAED;;;;wEAIoE;IACpE,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGvC;IAED;6EACyE;IACzE,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,GAAG,IAAI,CAOjE;IAED,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAEzC;IAED;;;oDAGgD;IAChD,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAiBrE;IAED,OAAO,CAAC,UAAU;CAKnB"}
@@ -1,59 +1,143 @@
1
+ import { readFileSync, renameSync, writeFileSync } from "node:fs";
2
+ import { join } from "node:path";
1
3
  const POLL_BACKOFF_MS = 60_000;
2
4
  const MAX_POLL_BACKOFF_MS = 15 * 60_000;
3
- /** Whole-lifecycle single-flight and completion-anchored pacing for the quota
4
- * registry. Evidence/demand semantics stay with QuotaRegistry; this helper
5
- * owns only scheduling state. */
5
+ /** Ceiling on the vendor rate-limit floor (7 days, aligned with the
6
+ * Retry-After parser's clamp): valid long vendor floors are honored in full —
7
+ * the plan's max(exponential, retryAfterMs) — while a buggy or hostile value
8
+ * cannot silence a vendor's polling unboundedly. */
9
+ const MAX_RATE_LIMIT_FLOOR_MS = 7 * 24 * 60 * 60_000;
10
+ /** File-backed store under the daemon dir. Best-effort durability: a missing,
11
+ * corrupt, or unwritable file only forgets the floor (fail-open to polling),
12
+ * it never breaks the poll cycle. */
13
+ export function quotaPacerFileStore(dir) {
14
+ const path = join(dir, "quota-pacer-state.json");
15
+ const read = () => {
16
+ try {
17
+ const parsed = JSON.parse(readFileSync(path, "utf8"));
18
+ return parsed?.version === 1 &&
19
+ parsed.vendors !== null &&
20
+ typeof parsed.vendors === "object" &&
21
+ !Array.isArray(parsed.vendors)
22
+ ? parsed.vendors
23
+ : {};
24
+ }
25
+ catch {
26
+ return {};
27
+ }
28
+ };
29
+ return {
30
+ load(vendor) {
31
+ const iso = read()[vendor]?.not_before;
32
+ const at = typeof iso === "string" ? Date.parse(iso) : Number.NaN;
33
+ return Number.isFinite(at) ? at : 0;
34
+ },
35
+ save(vendor, notBeforeMs) {
36
+ const vendors = read();
37
+ vendors[vendor] = { not_before: new Date(notBeforeMs).toISOString() };
38
+ const tmp = `${path}.tmp.${process.pid}`;
39
+ writeFileSync(tmp, `${JSON.stringify({ version: 1, vendors }, null, 2)}\n`);
40
+ renameSync(tmp, path);
41
+ },
42
+ };
43
+ }
44
+ /**
45
+ * Completion-anchored poll pacing for ONE vendor lane of the quota registry
46
+ * (one instance per vendor with a registered refresher), so a permanently
47
+ * unsatisfiable subject of one vendor can no longer pin every other vendor's
48
+ * refresh cadence at the 15-minute ceiling. Two independent gates:
49
+ *
50
+ * - the credential-demand backoff (`failures`/`notBefore`): in-memory,
51
+ * exponential per unsatisfied cycle, reset by a credential change — the
52
+ * pre-existing semantics, now per lane;
53
+ * - the vendor rate-limit floor (`rateLimitedNotBefore`): armed when a cycle
54
+ * observes a typed `rate_limited` absence for this vendor, honoring the
55
+ * vendor's Retry-After when known (max with the exponential ladder, 60s
56
+ * minimum). Persisted through the daemon-private store so a restart is not
57
+ * a 429 amplifier, and deliberately NOT reset by a credential change —
58
+ * logging in again does not un-rate-limit the vendor endpoint.
59
+ *
60
+ * Evidence/demand semantics stay with QuotaRegistry; this class owns only
61
+ * scheduling state. Single-flight of the poll sweep also lives in the
62
+ * registry, which drives every lane from one sweep.
63
+ */
6
64
  export class QuotaPollPacer {
7
- deps;
65
+ vendor;
66
+ store;
8
67
  failures = 0;
9
68
  notBefore = 0;
10
- inFlight = null;
11
- /** Prevent an old-credential cycle from restoring backoff after a reset. */
12
- credentialGeneration = 0;
13
- constructor(deps) {
14
- this.deps = deps;
69
+ rateLimitedNotBefore = 0;
70
+ /** When the active floor was observed (0 = unknown, e.g. store-loaded). */
71
+ rateLimitedSince = 0;
72
+ constructor(vendor = null, store) {
73
+ this.vendor = vendor;
74
+ this.store = store;
75
+ if (this.vendor !== null && this.store) {
76
+ try {
77
+ this.rateLimitedNotBefore = this.store.load(this.vendor);
78
+ }
79
+ catch {
80
+ /* fail-open: a broken store never blocks polling */
81
+ }
82
+ }
15
83
  }
84
+ /** Credential/routability change: drop only the credential-demand backoff.
85
+ * The vendor rate-limit floor survives — it is about the vendor endpoint,
86
+ * not about which credentials exist (and a daemon restart or profile toggle
87
+ * must not become a 429 amplifier). */
16
88
  noteCredentialChange() {
17
- this.credentialGeneration += 1;
18
89
  this.failures = 0;
19
90
  this.notBefore = 0;
20
91
  }
21
- poll() {
22
- if (this.inFlight)
23
- return this.inFlight;
24
- const poll = this.perform().finally(() => {
25
- if (this.inFlight === poll)
26
- this.inFlight = null;
27
- });
28
- this.inFlight = poll;
29
- return poll;
92
+ pollEligible(now) {
93
+ return now >= this.notBefore && now >= this.rateLimitedNotBefore;
30
94
  }
31
- async perform() {
32
- const now = this.deps.now().getTime();
33
- this.deps.publishClockTransition();
34
- if (!this.deps.hasDemand(now))
35
- return false;
36
- if (now < this.notBefore)
37
- return false;
38
- const credentialGeneration = this.credentialGeneration;
39
- try {
40
- await this.deps.refresh();
41
- const completedAt = this.deps.now().getTime();
42
- if (this.credentialGeneration !== credentialGeneration)
43
- return true;
44
- if (!this.deps.hasDemand(completedAt)) {
45
- this.failures = 0;
46
- this.notBefore = 0;
47
- return true;
48
- }
49
- this.armBackoff(completedAt);
50
- return true;
95
+ /** The active vendor rate-limit floor, or null when none is in effect. */
96
+ rateLimitCooldownUntil(now) {
97
+ return now < this.rateLimitedNotBefore ? this.rateLimitedNotBefore : null;
98
+ }
99
+ /** Stable observation stamp for the ACTIVE floor's derived gap rows: the
100
+ * instant the floor was observed. A store-loaded floor (daemon restart)
101
+ * has no recorded observation, so the first read anchors it — stability of
102
+ * the projection signature matters more than the exact historical instant,
103
+ * and the anchor is honest ("known paused since at least then"). */
104
+ rateLimitObservedAt(now) {
105
+ if (this.rateLimitedSince === 0)
106
+ this.rateLimitedSince = now;
107
+ return this.rateLimitedSince;
108
+ }
109
+ /** A cycle for this lane completed: reset on fully satisfied demand, else
110
+ * exponential backoff anchored at completion (never the stale start). */
111
+ notePollSuccess(completedAt, demandRemains) {
112
+ if (!demandRemains) {
113
+ this.failures = 0;
114
+ this.notBefore = 0;
115
+ return;
51
116
  }
52
- catch {
53
- if (this.credentialGeneration === credentialGeneration) {
54
- this.armBackoff(this.deps.now().getTime());
117
+ this.armBackoff(completedAt);
118
+ }
119
+ notePollFailure(completedAt) {
120
+ this.armBackoff(completedAt);
121
+ }
122
+ /** A cycle observed a typed `rate_limited` absence for this vendor: arm the
123
+ * floor at max(exponential ladder, vendor Retry-After), monotonic, and
124
+ * persist it (a null Retry-After — Anthropic does not always send one —
125
+ * still arms the exponential-derived floor). */
126
+ noteRateLimited(observedAt, retryAfterMs) {
127
+ const exponential = Math.min(POLL_BACKOFF_MS * 2 ** Math.max(this.failures - 1, 0), MAX_POLL_BACKOFF_MS);
128
+ const floor = Math.max(exponential, Math.min(retryAfterMs ?? 0, MAX_RATE_LIMIT_FLOOR_MS));
129
+ const until = observedAt + floor;
130
+ if (until <= this.rateLimitedNotBefore)
131
+ return;
132
+ this.rateLimitedNotBefore = until;
133
+ this.rateLimitedSince = observedAt;
134
+ if (this.vendor !== null) {
135
+ try {
136
+ this.store?.save(this.vendor, until);
137
+ }
138
+ catch {
139
+ /* fail-open: losing the durable floor only re-allows polling */
55
140
  }
56
- return false;
57
141
  }
58
142
  }
59
143
  armBackoff(completedAt) {
@@ -1 +1 @@
1
- {"version":3,"file":"quota-poll-pacer.js","sourceR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AU,CAAC;QACnC,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;YACzB,IAAI,CAAC;gBACH,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YACvC,CAAC;YAAC,MAAM,CAAC;gBACP,gEAAgE;YAClE,CAAC;QACH,CAAC;IACH,CAAC;IAEO,UAAU,CAAC,WAAmB;QACpC,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC;QACnB,IAAI,CAAC,SAAS;YACZ,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,eAAe,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC;IAC5F,CAAC;CACF"}
@@ -1,6 +1,8 @@
1
1
  import type { DurableJournal } from "@claudexor/journal";
2
- import { QuotaRegistry, type QuotaRefresher, type QuotaSubjectUniverse } from "./quota-registry.js";
3
- export declare function quotaProjection(refreshers?: readonly QuotaRefresher[], subjects?: QuotaSubjectUniverse, now?: () => Date): {
2
+ import type { QuotaPacerStateStore } from "./quota-poll-pacer.js";
3
+ import type { QuotaRefresher, QuotaVendorRefresher } from "./quota-poll-lanes.js";
4
+ import { QuotaRegistry, type QuotaSubjectUniverse } from "./quota-registry.js";
5
+ export declare function quotaProjection(refreshers?: readonly (QuotaRefresher | QuotaVendorRefresher)[], subjects?: QuotaSubjectUniverse, now?: () => Date, pacerStore?: QuotaPacerStateStore): {
4
6
  name: string;
5
7
  create: (journal: DurableJournal) => QuotaRegistry;
6
8
  validate: (registry: QuotaRegistry) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"quota-projection.d.ts","sourceRoot":"","sources":["../src/quota-projection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEpG,wBAAgB,eAAe,CAC7B,UAAU,GAAE,SAAS,cAAc,EAAO,EAC1C,QAAQ,CAAC,EAAE,oBAAoB,EAC/B,GAAG,GAAE,MAAM,IAAuB;IAGhC,IAAI;IACJ,MAAM,YAAY,cAAc;IAChC,QAAQ,aAAa,aAAa;IAClC,OAAO,aAAa,aAAa;EAEpC"}
1
+ {"version":3,"file":"quota-projection.d.ts","sourceRoot":"","sources":["../src/quota-projection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE/E,wBAAgB,eAAe,CAC7B,UAAU,GAAE,SAAS,CAAC,cAAc,GAAG,oBAAoB,CAAC,EAAO,EACnE,QAAQ,CAAC,EAAE,oBAAoB,EAC/B,GAAG,GAAE,MAAM,IAAuB,EAClC,UAAU,CAAC,EAAE,oBAAoB;IAG/B,IAAI;IACJ,MAAM,YAAY,cAAc;IAEhC,QAAQ,aAAa,aAAa;IAClC,OAAO,aAAa,aAAa;EAEpC"}
@@ -1,8 +1,8 @@
1
1
  import { QuotaRegistry } from "./quota-registry.js";
2
- export function quotaProjection(refreshers = [], subjects, now = () => new Date()) {
2
+ export function quotaProjection(refreshers = [], subjects, now = () => new Date(), pacerStore) {
3
3
  return {
4
4
  name: "quota",
5
- create: (journal) => new QuotaRegistry(journal, refreshers, now, subjects),
5
+ create: (journal) => new QuotaRegistry(journal, refreshers, now, subjects, pacerStore),
6
6
  validate: (registry) => registry.validateProjection(),
7
7
  recover: (registry) => registry.recoverAfterStartup(),
8
8
  };
@@ -1 +1 @@
1
- {"version":3,"file":"quota-projection.js","sourceRoot":"","sources":["../src/quota-projection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAkD,MAAM,qBAAqB,CAAC;AAEpG,MAAM,UAAU,eAAe,CAC7B,UAAU,GAA8B,EAAE,EAC1C,QAA+B,EAC/B,GAAG,GAAe,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;IAElC,OAAO;QACL,IAAI,EAAE,OAAO;QACb,MAAM,EAAE,CAAC,OAAuB,EAAE,EAAE,CAAC,IAAI,aAAa,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,CAAC;QAC1F,QAAQ,EAAE,CAAC,QAAuB,EAAE,EAAE,CAAC,QAAQ,CAAC,kBAAkB,EAAE;QACpE,OAAO,EAAE,CAAC,QAAuB,EAAE,EAAE,CAAC,QAAQ,CAAC,mBAAmB,EAAE;KACrE,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"quota-projection.js","sourceRoot":"","sources":["../src/quota-projection.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAA6B,MAAM,qBAAqB,CAAC;AAE/E,MAAM,UAAU,eAAe,CAC7B,UAAU,GAAuD,EAAE,EACnE,QAA+B,EAC/B,GAAG,GAAe,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,EAClC,UAAiC;IAEjC,OAAO;QACL,IAAI,EAAE,OAAO;QACb,MAAM,EAAE,CAAC,OAAuB,EAAE,EAAE,CAClC,IAAI,aAAa,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,UAAU,CAAC;QACnE,QAAQ,EAAE,CAAC,QAAuB,EAAE,EAAE,CAAC,QAAQ,CAAC,kBAAkB,EAAE;QACpE,OAAO,EAAE,CAAC,QAAuB,EAAE,EAAE,CAAC,QAAQ,CAAC,mBAAmB,EAAE;KACrE,CAAC;AACJ,CAAC"}
@@ -4,6 +4,9 @@ export declare class QuotaRefreshCoordinator<T> {
4
4
  private inFlight;
5
5
  retireCredentialGeneration(): void;
6
6
  isCurrent(credentialGeneration: number): boolean;
7
+ /** The generation a caller should capture BEFORE a cycle to later ask
8
+ * whether a credential change intervened (per-lane pacing reads it). */
9
+ currentGeneration(): number;
7
10
  run(start: (credentialGeneration: number) => Promise<T>, followCredentialChanges?: boolean): Promise<T>;
8
11
  }
9
12
  //# sourceMappingURL=quota-refresh-coordinator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"quota-refresh-coordinator.d.ts","sourceRoot":"","sources":["../src/quota-refresh-coordinator.ts"],"names":[],"mappings":"AAKA,8EAA8E;AAC9E,qBAAa,uBAAuB,CAAC,CAAC;IACpC,OAAO,CAAC,oBAAoB,CAAK;IACjC,OAAO,CAAC,QAAQ,CAAgC;IAEhD,0BAA0B,IAAI,IAAI,CAEjC;IAED,SAAS,CAAC,oBAAoB,EAAE,MAAM,GAAG,OAAO,CAE/C;IAEK,GAAG,CACP,KAAK,EAAE,CAAC,oBAAoB,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,EACnD,uBAAuB,UAAO,GAC7B,OAAO,CAAC,CAAC,CAAC,CA6BZ;CACF"}
1
+ {"version":3,"file":"quota-refresh-coordinator.d.ts","sourceRoot":"","sources":["../src/quota-refresh-coordinator.ts"],"names":[],"mappings":"AAKA,8EAA8E;AAC9E,qBAAa,uBAAuB,CAAC,CAAC;IACpC,OAAO,CAAC,oBAAoB,CAAK;IACjC,OAAO,CAAC,QAAQ,CAAgC;IAEhD,0BAA0B,IAAI,IAAI,CAEjC;IAED,SAAS,CAAC,oBAAoB,EAAE,MAAM,GAAG,OAAO,CAE/C;IAED;4EACwE;IACxE,iBAAiB,IAAI,MAAM,CAE1B;IAEK,GAAG,CACP,KAAK,EAAE,CAAC,oBAAoB,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,EACnD,uBAAuB,UAAO,GAC7B,OAAO,CAAC,CAAC,CAAC,CA6BZ;CACF"}
@@ -8,6 +8,11 @@ export class QuotaRefreshCoordinator {
8
8
  isCurrent(credentialGeneration) {
9
9
  return credentialGeneration === this.credentialGeneration;
10
10
  }
11
+ /** The generation a caller should capture BEFORE a cycle to later ask
12
+ * whether a credential change intervened (per-lane pacing reads it). */
13
+ currentGeneration() {
14
+ return this.credentialGeneration;
15
+ }
11
16
  async run(start, followCredentialChanges = true) {
12
17
  const requestedGeneration = this.credentialGeneration;
13
18
  for (;;) {
@@ -1 +1 @@
1
- {"version":3,"file":"quota-refresh-coordinator.js","sourceRoot":"","sources":["../src/quota-refresh-coordinator.ts"],"names":[],"mappings":"AAKA,8EAA8E;AAC9E,MAAM,OAAO,uBAAuB;IAC1B,oBAAoB,GAAG,CAAC,CAAC;IACzB,QAAQ,GAA2B,IAAI,CAAC;IAEhD,0BAA0B;QACxB,IAAI,CAAC,oBAAoB,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,SAAS,CAAC,oBAA4B;QACpC,OAAO,oBAAoB,KAAK,IAAI,CAAC,oBAAoB,CAAC;IAC5D,CAAC;IAED,KAAK,CAAC,GAAG,CACP,KAAmD,EACnD,uBAAuB,GAAG,IAAI;QAE9B,MAAM,mBAAmB,GAAG,IAAI,CAAC,oBAAoB,CAAC;QACtD,SAAS,CAAC;YACR,MAAM,oBAAoB,GAAG,IAAI,CAAC,oBAAoB,CAAC;YACvD,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC;YAC1B,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;gBACnB,IAAI,OAAwB,CAAC;gBAC7B,MAAM,MAAM,GAAG,KAAK,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE;oBACtD,IAAI,IAAI,CAAC,QAAQ,KAAK,OAAO;wBAAE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;gBACtD,CAAC,CAAC,CAAC;gBACH,OAAO,GAAG,EAAE,oBAAoB,EAAE,MAAM,EAAE,CAAC;gBAC3C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;gBACxB,KAAK,GAAG,OAAO,C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;YACvD,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC;YAC1B,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;gBACnB,IAAI,OAAwB,CAAC;gBAC7B,MAAM,MAAM,GAAG,KAAK,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE;oBACtD,IAAI,IAAI,CAAC,QAAQ,KAAK,OAAO;wBAAE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;gBACtD,CAAC,CAAC,CAAC;gBACH,OAAO,GAAG,EAAE,oBAAoB,EAAE,MAAM,EAAE,CAAC;gBAC3C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;gBACxB,KAAK,GAAG,OAAO,CAAC;YAClB,CAAC;YACD,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC;gBAClC,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,oBAAoB,CAAC;oBAAE,OAAO,MAAM,CAAC;gBAC9D,IAAI,CAAC,uBAAuB,IAAI,KAAK,CAAC,oBAAoB,KAAK,mBAAmB,EAAE,CAAC;oBACnF,OAAO,MAAM,CAAC;gBAChB,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,oBAAoB,CAAC;oBAAE,MAAM,KAAK,CAAC;gBAC5D,IAAI,CAAC,uBAAuB,IAAI,KAAK,CAAC,oBAAoB,KAAK,mBAAmB,EAAE,CAAC;oBACnF,MAAM,KAAK,CAAC;gBACd,CAAC;YACH,CAAC;YACD,oEAAoE;YACpE,wEAAwE;QAC1E,CAAC;IACH,CAAC;CACF"}
@@ -1,13 +1,7 @@
1
1
  import type { DurableJournal } from "@claudexor/journal";
2
- import { type QuotaAbsence, type QuotaSnapshot, type QuotaSubject } from "@claudexor/schema";
3
- /** One refresh cycle's fruit: the snapshots a source observed, plus the typed
4
- * absences it CLAIMS for subjects it tried and could not observe. Absence is
5
- * stated by the source, never inferred from an empty snapshot list. */
6
- export interface QuotaRefreshResult {
7
- snapshots: QuotaSnapshot[];
8
- absences?: QuotaAbsence[];
9
- }
10
- export type QuotaRefresher = () => Promise<QuotaRefreshResult>;
2
+ import { type QuotaSnapshot, type QuotaSubject } from "@claudexor/schema";
3
+ import { type QuotaRefresher, type QuotaVendorRefresher } from "./quota-poll-lanes.js";
4
+ import type { QuotaPacerStateStore } from "./quota-poll-pacer.js";
11
5
  /** The registered subject UNIVERSE: every subject the daemon expects to hear
12
6
  * about, so a subject with neither snapshot nor a source claim still surfaces
13
7
  * a "no_source" absence instead of vanishing. */
@@ -15,7 +9,6 @@ export type QuotaSubjectUniverse = () => QuotaSubject[];
15
9
  /** Global-journal authority for vendor-owned quota snapshots. */
16
10
  export declare class QuotaRegistry {
17
11
  private readonly journal;
18
- private readonly refreshers;
19
12
  private readonly now;
20
13
  private readonly subjects?;
21
14
  private readonly snapshots;
@@ -28,9 +21,10 @@ export declare class QuotaRegistry {
28
21
  * consumed by snapshot-then-SSE clients. */
29
22
  private lastPublishedProjectionSignature;
30
23
  private readonly refreshCoordinator;
31
- private readonly pollPacer;
24
+ private readonly refresherLanes;
25
+ private pollSweepInFlight;
32
26
  private recoveryMarkerPending;
33
- constructor(journal: DurableJournal, refreshers?: readonly QuotaRefresher[], now?: () => Date, subjects?: QuotaSubjectUniverse | undefined);
27
+ constructor(journal: DurableJournal, refreshers?: readonly (QuotaRefresher | QuotaVendorRefresher)[], now?: () => Date, subjects?: QuotaSubjectUniverse | undefined, pacerStore?: QuotaPacerStateStore);
34
28
  /** Publish the recovered projection boundary only after bootstrap activation. */
35
29
  recoverAfterStartup(): void;
36
30
  read(): {
@@ -72,11 +66,16 @@ export declare class QuotaRegistry {
72
66
  plan_label: string | null;
73
67
  subject_id: string | null;
74
68
  };
75
- reason: "auth_revoked" | "credential_profile_ambiguous" | "no_source" | "not_logged_in" | "platform_unsupported" | "refresh_failed" | "transport_unavailable";
69
+ reason: "auth_revoked" | "credential_profile_ambiguous" | "no_source" | "not_logged_in" | "platform_unsupported" | "poll_paced" | "probe_skipped_rate_limited" | "rate_limited" | "refresh_failed" | "transport_unavailable";
76
70
  detail: string | null;
77
71
  observed_at: string;
72
+ retry_after_ms?: number | undefined;
78
73
  }[];
79
74
  refreshed_at: string | null;
75
+ refresh_skipped?: {
76
+ vendor: string;
77
+ not_before: string;
78
+ }[] | undefined;
80
79
  };
81
80
  /** Freshness-annotated snapshots with expired (>24h) observations pruned.
82
81
  * An old observation whose constraint still EXTENDS into the future (a
@@ -122,11 +121,16 @@ export declare class QuotaRegistry {
122
121
  plan_label: string | null;
123
122
  subject_id: string | null;
124
123
  };
125
- reason: "auth_revoked" | "credential_profile_ambiguous" | "no_source" | "not_logged_in" | "platform_unsupported" | "refresh_failed" | "transport_unavailable";
124
+ reason: "auth_revoked" | "credential_profile_ambiguous" | "no_source" | "not_logged_in" | "platform_unsupported" | "poll_paced" | "probe_skipped_rate_limited" | "rate_limited" | "refresh_failed" | "transport_unavailable";
126
125
  detail: string | null;
127
126
  observed_at: string;
127
+ retry_after_ms?: number | undefined;
128
128
  }[];
129
129
  refreshed_at: string | null;
130
+ refresh_skipped?: {
131
+ vendor: string;
132
+ not_before: string;
133
+ }[] | undefined;
130
134
  }>;
131
135
  /** Fresh quota plus the exact global-journal fence for snapshot-then-SSE.
132
136
  * The cursor is captured inside refreshCycle, synchronously with `response`,
@@ -171,35 +175,59 @@ export declare class QuotaRegistry {
171
175
  plan_label: string | null;
172
176
  subject_id: string | null;
173
177
  };
174
- reason: "auth_revoked" | "credential_profile_ambiguous" | "no_source" | "not_logged_in" | "platform_unsupported" | "refresh_failed" | "transport_unavailable";
178
+ reason: "auth_revoked" | "credential_profile_ambiguous" | "no_source" | "not_logged_in" | "platform_unsupported" | "poll_paced" | "probe_skipped_rate_limited" | "rate_limited" | "refresh_failed" | "transport_unavailable";
175
179
  detail: string | null;
176
180
  observed_at: string;
181
+ retry_after_ms?: number | undefined;
177
182
  }[];
178
183
  refreshed_at: string | null;
184
+ refresh_skipped?: {
185
+ vendor: string;
186
+ not_before: string;
187
+ }[] | undefined;
179
188
  };
180
189
  quotaEventCursor: string;
181
190
  }>;
182
- /** One coalesced atomic refresh cycle shared by foreground and background
183
- * callers; poll pacing derives from post-cycle demand, never shared counters. */
191
+ /** One coalesced atomic refresh cycle; a poll passes its lane so only that
192
+ * vendor's refreshers run. Join semantics are asymmetric on purpose: a poll
193
+ * joining a foreground FULL cycle keeps its (superset) result, but a FULL
194
+ * caller that joined a lane-SCOPED poll cycle re-runs a full cycle once it
195
+ * completes — an explicit refresh must not silently return with sibling
196
+ * vendors unre-fetched and undisclosed. Bounded retry; on exhaustion the
197
+ * last (complete-projection) result serves. */
184
198
  private refreshCycle;
185
199
  private performRefreshCycle;
186
200
  /** Aggregate one cycle's snapshots + absence claims against the subject
187
201
  * universe (V11a): a fresh-or-stale snapshot from ANY source means no
188
202
  * absence; else the first refresher-claimed absence wins; neither =>
189
203
  * "no_source". Identity is (harness, subject_id); route/source never split
190
- * a subject. */
204
+ * a subject.
205
+ *
206
+ * `scope` (a vendor-lane cycle) rebuilds only that vendor's rows plus every
207
+ * REFRESHERLESS harness's rows (those can only ever be `no_source`, and
208
+ * skipping them would leave e.g. a cursor subject silently unstated until
209
+ * the next full cycle); other vendors' claimed rows are preserved so a
210
+ * claude-only poll cannot degrade codex's typed reasons to no_source.
211
+ * `null` scope (a full cycle, or an anonymous-lane cycle whose coverage is
212
+ * unknowable) keeps the pre-existing full rebuild. */
191
213
  private recomputeAbsences;
192
214
  /** Absences whose subject is not (any longer) covered by an active snapshot —
193
- * a snapshot arriving via ingest between cycles silences its absence at once,
194
- * so read() never shows a subject with both a snapshot and an absence. */
215
+ * a snapshot arriving via ingest between cycles silences its absence at once.
216
+ * Gap honesty for suppressed polls: a GAP-representation row is silenced
217
+ * only by a FRESH snapshot (stale last-known data and the "not re-asked"
218
+ * fact stay visible together), and a floor-suppressed vendor's unstated
219
+ * subjects gain DERIVED `poll_paced` rows (see derivePollPacedRows). */
195
220
  private activeAbsences;
196
221
  /** Credential or routability state changed (login/profile/native/settings):
197
- * drop absence backoff so the next poll observes the new subject universe
198
- * instead of waiting out up to 15 minutes of old-state pacing. */
222
+ * drop the credential-demand backoff so the next poll observes the new
223
+ * subject universe instead of waiting out up to 15 minutes of old-state
224
+ * pacing. Each lane's vendor rate-limit floor deliberately survives — a
225
+ * login does not un-rate-limit the vendor endpoint. */
199
226
  noteCredentialChange(): void;
200
- /** Background official-source refresh for per-subject primary demand. The
201
- * whole decision + refresh + pacing update is single-flight, independent of
202
- * foreground refresh coalescing. */
227
+ /** Background official-source refresh for per-subject primary demand. One
228
+ * single-flight sweep drives every vendor lane in order; each eligible lane
229
+ * runs its own coalesced cycle, so one vendor's backoff never starves a
230
+ * sibling vendor's freshness. Resolves true when any lane refreshed. */
203
231
  pollStale(): Promise<boolean>;
204
232
  ingest(harnessId: string, value: unknown): void;
205
233
  upsert(value: QuotaSnapshot): void;
@@ -1 +1 @@
1
- {"version":3,"file":"quota-registry.d.ts","sourceRoot":"","sources":["../src/quota-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAQL,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,YAAY,EAClB,MAAM,mBAAmB,CAAC;AAoB3B;;uEAEuE;AACvE,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;CAC3B;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAE/D;;iDAEiD;AACjD,MAAM,MAAM,oBAAoB,GAAG,MAAM,YAAY,EAAE,CAAC;AAExD,iEAAiE;AACjE,qBAAa,aAAa;IAiBtB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,C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MAAM;CAUf"}
@@ -1,9 +1,9 @@
1
1
  import { hashJson } from "@claudexor/util";
2
- import { ControlQuotaResponse, HarnessEvent, QuotaAbsence as QuotaAbsenceSchema, QuotaSnapshot as QuotaSnapshotSchema, REACTIVE_COOLDOWN_SOURCE, vendorResetDayCooldownEnd, } from "@claudexor/schema";
2
+ import { ControlQuotaResponse, HarnessEvent, QUOTA_GAP_ABSENCE_REASONS, QuotaAbsence as QuotaAbsenceSchema, QuotaSnapshot as QuotaSnapshotSchema, REACTIVE_COOLDOWN_SOURCE, vendorResetDayCooldownEnd, } from "@claudexor/schema";
3
3
  import { isExpiredScopedCooldown, legacyV320Snapshot, snapshotKey, staleAt, withoutExpiredScopedCooldowns, } from "./quota-registry-support.js";
4
- import { QuotaPollPacer } from "./quota-poll-pacer.js";
4
+ import { buildRefresherLanes, derivePollPacedRows, foldAbsenceClaims, laneHasDemand, performPollSweep, recomputeScopeFor, selectCycleEntries, subjectCoverSets, } from "./quota-poll-lanes.js";
5
5
  import { QuotaRefreshCoordinator } from "./quota-refresh-coordinator.js";
6
- import { quotaSubjectIdentity, remainingQuotaRefreshDemand } from "./quota-refresh-demand.js";
6
+ import { quotaSubjectIdentity } from "./quota-refresh-demand.js";
7
7
  const UPSERTED = "quota.snapshot.upserted";
8
8
  const SCOPED_PREPARED = "quota.snapshot.scoped_prepared";
9
9
  const REMOVED = "quota.subject.removed";
@@ -14,7 +14,6 @@ const MAX_SNAPSHOT_AGE_MS = 24 * 60 * 60_000;
14
14
  /** Global-journal authority for vendor-owned quota snapshots. */
15
15
  export class QuotaRegistry {
16
16
  journal;
17
- refreshers;
18
17
  now;
19
18
  subjects;
20
19
  snapshots = new Map();
@@ -27,11 +26,11 @@ export class QuotaRegistry {
27
26
  * consumed by snapshot-then-SSE clients. */
28
27
  lastPublishedProjectionSignature = null;
29
28
  refreshCoordinator = new QuotaRefreshCoordinator();
30
- pollPacer;
29
+ refresherLanes;
30
+ pollSweepInFlight = null;
31
31
  recoveryMarkerPending = false;
32
- constructor(journal, refreshers = [], now = () => new Date(), subjects) {
32
+ constructor(journal, refreshers = [], now = () => new Date(), subjects, pacerStore) {
33
33
  this.journal = journal;
34
- this.refreshers = refreshers;
35
34
  this.now = now;
36
35
  this.subjects = subjects;
37
36
  let rawMutationAfterMarker = false;
@@ -93,14 +92,7 @@ export class QuotaRegistry {
93
92
  // already-subscribed clients permanently behind. Close the recovered
94
93
  // commit boundary synchronously before the projection becomes available.
95
94
  this.recoveryMarkerPending = rawMutationAfterMarker;
96
- this.pollPacer = new QuotaPollPacer({
97
- now: this.now,
98
- publishClockTransition: () => this.publishClockTransitionIfNeeded(),
99
- hasDemand: (now) => remainingQuotaRefreshDemand(this.activeSnapshots(now), this.subjects?.()).size > 0,
100
- refresh: async () => {
101
- await this.refreshCycle(false);
102
- },
103
- });
95
+ this.refresherLanes = buildRefresherLanes(refreshers, pacerStore);
104
96
  }
105
97
  /** Publish the recovered projection boundary only after bootstrap activation. */
106
98
  recoverAfterStartup() {
@@ -148,19 +140,31 @@ export class QuotaRegistry {
148
140
  const { response, quotaEventCursor } = await this.refreshCycle();
149
141
  return { response, quotaEventCursor };
150
142
  }
151
- /** One coalesced atomic refresh cycle shared by foreground and background
152
- * callers; poll pacing derives from post-cycle demand, never shared counters. */
153
- async refreshCycle(followCredentialChanges = true) {
154
- return this.refreshCoordinator.run((credentialGeneration) => this.performRefreshCycle(credentialGeneration), followCredentialChanges);
143
+ /** One coalesced atomic refresh cycle; a poll passes its lane so only that
144
+ * vendor's refreshers run. Join semantics are asymmetric on purpose: a poll
145
+ * joining a foreground FULL cycle keeps its (superset) result, but a FULL
146
+ * caller that joined a lane-SCOPED poll cycle re-runs a full cycle once it
147
+ * completes — an explicit refresh must not silently return with sibling
148
+ * vendors unre-fetched and undisclosed. Bounded retry; on exhaustion the
149
+ * last (complete-projection) result serves. */
150
+ async refreshCycle(followCredentialChanges = true, scope) {
151
+ for (let attempt = 0;; attempt += 1) {
152
+ const cycle = await this.refreshCoordinator.run((credentialGeneration) => this.performRefreshCycle(credentialGeneration, scope ?? null), followCredentialChanges);
153
+ if (scope !== undefined || !cycle.scoped || attempt > this.refresherLanes.lanes.length)
154
+ return cycle;
155
+ }
155
156
  }
156
- async performRefreshCycle(credentialGeneration) {
157
- if (this.refreshers.length === 0) {
157
+ async performRefreshCycle(credentialGeneration, scope) {
158
+ if (this.refresherLanes.entries.length === 0) {
158
159
  throw Object.assign(new Error("no live vendor-owned quota refresh source is available"), {
159
160
  code: "quota_refresh_unavailable",
160
161
  status: 503,
161
162
  });
162
163
  }
163
- const settled = await Promise.allSettled(this.refreshers.map(async (refresher) => refresher()));
164
+ // Foreground cycles honor each vendor lane's rate-limit cooldown; the
165
+ // skips serve last-known registry data and are disclosed additively.
166
+ const { running, skipped } = selectCycleEntries(this.refresherLanes, scope, this.now().getTime());
167
+ const settled = await Promise.allSettled(running.map(async ({ refresh }) => refresh()));
164
168
  const batches = [];
165
169
  const failures = [];
166
170
  // Validate EVERY fulfilled source batch before the first durable write.
@@ -183,7 +187,10 @@ export class QuotaRegistry {
183
187
  batches.push(null);
184
188
  }
185
189
  }
186
- if (batches.every((batch) => batch === null)) {
190
+ // An all-cooled full cycle (running empty, skips disclosed) is a served
191
+ // last-known response, not a failure; only attempted-and-failed sources
192
+ // make the cycle unavailable.
193
+ if (running.length > 0 && batches.every((batch) => batch === null)) {
187
194
  throw Object.assign(new Error(`quota refresh failed: ${failures.join("; ")}`), {
188
195
  code: "quota_refresh_unavailable",
189
196
  status: 503,
@@ -208,25 +215,48 @@ export class QuotaRegistry {
208
215
  claims.push(...batch.absences);
209
216
  }
210
217
  const now = this.now().getTime();
211
- this.recomputeAbsences(claims, now);
218
+ if (running.length > 0)
219
+ this.recomputeAbsences(claims, now, recomputeScopeFor(running));
220
+ // A typed rate_limited absence is PACING evidence (owner decision 7=A):
221
+ // arm the vendor lane's persisted floor — foreground cycles included, so
222
+ // an explicit refresh that got throttled also cools later fan-outs — and
223
+ // never journal it as a quota cooldown.
224
+ for (const claim of claims) {
225
+ if (claim.reason !== "rate_limited")
226
+ continue;
227
+ const lane = this.refresherLanes.lanes.find((item) => item.vendor === claim.subject.harness);
228
+ lane?.pacer.noteRateLimited(now, claim.retry_after_ms ?? null);
229
+ }
212
230
  const refreshedAt = this.now().toISOString();
213
231
  const response = ControlQuotaResponse.parse({
214
232
  snapshots: this.activeSnapshots(now),
215
233
  absences: this.activeAbsences(now),
216
234
  refreshed_at: refreshedAt,
235
+ ...(skipped.length > 0 ? { refresh_skipped: skipped } : {}),
217
236
  });
218
237
  // No await may appear between response construction and this marker/cursor.
219
238
  // The marker makes absence-only and identical refreshes observable; its own
220
239
  // cursor is the exact last event represented by this response.
221
240
  const quotaEventCursor = this.appendProjectionMarker("refresh", refreshedAt, response);
222
- return { response, quotaEventCursor };
241
+ // scoped: an unscoped joiner re-runs a full cycle on it (join semantics).
242
+ return { response, quotaEventCursor, scoped: scope !== null };
223
243
  }
224
244
  /** Aggregate one cycle's snapshots + absence claims against the subject
225
245
  * universe (V11a): a fresh-or-stale snapshot from ANY source means no
226
246
  * absence; else the first refresher-claimed absence wins; neither =>
227
247
  * "no_source". Identity is (harness, subject_id); route/source never split
228
- * a subject. */
229
- recomputeAbsences(claims, now) {
248
+ * a subject.
249
+ *
250
+ * `scope` (a vendor-lane cycle) rebuilds only that vendor's rows plus every
251
+ * REFRESHERLESS harness's rows (those can only ever be `no_source`, and
252
+ * skipping them would leave e.g. a cursor subject silently unstated until
253
+ * the next full cycle); other vendors' claimed rows are preserved so a
254
+ * claude-only poll cannot degrade codex's typed reasons to no_source.
255
+ * `null` scope (a full cycle, or an anonymous-lane cycle whose coverage is
256
+ * unknowable) keeps the pre-existing full rebuild. */
257
+ recomputeAbsences(claims, now, scope = null) {
258
+ const laneVendors = new Set(this.refresherLanes.lanes.map((lane) => lane.vendor).filter((vendor) => vendor !== null));
259
+ const rebuilt = (harness) => scope === null || scope.has(harness) || !laneVendors.has(harness);
230
260
  // Every other reason answers "why is there no snapshot", so a snapshot
231
261
  // silences it. `auth_revoked` says the vendor rejected the credential;
232
262
  // `credential_profile_ambiguous` says current platform policy forbids
@@ -245,49 +275,60 @@ export class QuotaRegistry {
245
275
  this.journal.append(REMOVED, { harness, subject_id });
246
276
  this.remove(harness, subject_id);
247
277
  }
248
- const covered = new Set(this.activeSnapshots(now).map((snapshot) => quotaSubjectIdentity(snapshot.subject)));
249
- const result = [];
250
- const claimed = new Set();
251
- for (const claim of claims) {
252
- const key = quotaSubjectIdentity(claim.subject);
253
- if (covered.has(key) || claimed.has(key))
254
- continue;
255
- claimed.add(key);
256
- result.push(claim);
257
- }
258
- for (const subject of this.subjects?.() ?? []) {
259
- const key = quotaSubjectIdentity(subject);
260
- if (covered.has(key) || claimed.has(key))
261
- continue;
262
- claimed.add(key);
263
- result.push({
264
- subject,
265
- reason: "no_source",
266
- detail: null,
267
- observed_at: new Date(now).toISOString(),
268
- });
269
- }
270
- this.absences = result;
278
+ const { covered, freshCovered } = subjectCoverSets(this.activeSnapshots(now));
279
+ this.absences = foldAbsenceClaims({
280
+ claims,
281
+ prior: this.absences,
282
+ rebuilt,
283
+ covered,
284
+ freshCovered,
285
+ subjects: this.subjects?.() ?? [],
286
+ now,
287
+ });
271
288
  }
272
289
  /** Absences whose subject is not (any longer) covered by an active snapshot —
273
- * a snapshot arriving via ingest between cycles silences its absence at once,
274
- * so read() never shows a subject with both a snapshot and an absence. */
290
+ * a snapshot arriving via ingest between cycles silences its absence at once.
291
+ * Gap honesty for suppressed polls: a GAP-representation row is silenced
292
+ * only by a FRESH snapshot (stale last-known data and the "not re-asked"
293
+ * fact stay visible together), and a floor-suppressed vendor's unstated
294
+ * subjects gain DERIVED `poll_paced` rows (see derivePollPacedRows). */
275
295
  activeAbsences(now) {
276
- const covered = new Set(this.activeSnapshots(now).map((snapshot) => quotaSubjectIdentity(snapshot.subject)));
277
- return this.absences.filter((absence) => !covered.has(quotaSubjectIdentity(absence.subject)));
296
+ const { covered, freshCovered } = subjectCoverSets(this.activeSnapshots(now));
297
+ const rows = this.absences.filter((absence) => !(QUOTA_GAP_ABSENCE_REASONS.has(absence.reason) ? freshCovered : covered).has(quotaSubjectIdentity(absence.subject)));
298
+ const subjects = this.subjects?.() ?? [];
299
+ const lanes = this.refresherLanes.lanes;
300
+ return rows.concat(derivePollPacedRows(lanes, subjects, rows, freshCovered, now));
278
301
  }
279
302
  /** Credential or routability state changed (login/profile/native/settings):
280
- * drop absence backoff so the next poll observes the new subject universe
281
- * instead of waiting out up to 15 minutes of old-state pacing. */
303
+ * drop the credential-demand backoff so the next poll observes the new
304
+ * subject universe instead of waiting out up to 15 minutes of old-state
305
+ * pacing. Each lane's vendor rate-limit floor deliberately survives — a
306
+ * login does not un-rate-limit the vendor endpoint. */
282
307
  noteCredentialChange() {
283
308
  this.refreshCoordinator.retireCredentialGeneration();
284
- this.pollPacer.noteCredentialChange();
309
+ for (const lane of this.refresherLanes.lanes)
310
+ lane.pacer.noteCredentialChange();
285
311
  }
286
- /** Background official-source refresh for per-subject primary demand. The
287
- * whole decision + refresh + pacing update is single-flight, independent of
288
- * foreground refresh coalescing. */
312
+ /** Background official-source refresh for per-subject primary demand. One
313
+ * single-flight sweep drives every vendor lane in order; each eligible lane
314
+ * runs its own coalesced cycle, so one vendor's backoff never starves a
315
+ * sibling vendor's freshness. Resolves true when any lane refreshed. */
289
316
  pollStale() {
290
- return this.pollPacer.poll();
317
+ if (this.pollSweepInFlight)
318
+ return this.pollSweepInFlight;
319
+ const sweep = performPollSweep(this.refresherLanes.lanes, {
320
+ now: this.now,
321
+ publishClockTransition: () => this.publishClockTransitionIfNeeded(),
322
+ laneHasDemand: (vendor, now) => laneHasDemand(vendor, this.activeSnapshots(now), this.subjects?.()),
323
+ currentGeneration: () => this.refreshCoordinator.currentGeneration(),
324
+ isCurrentGeneration: (generation) => this.refreshCoordinator.isCurrent(generation),
325
+ runLaneCycle: (lane) => this.refreshCycle(false, lane),
326
+ }).finally(() => {
327
+ if (this.pollSweepInFlight === sweep)
328
+ this.pollSweepInFlight = null;
329
+ });
330
+ this.pollSweepInFlight = sweep;
331
+ return sweep;
291
332
  }
292
333
  ingest(harnessId, value) {
293
334
  const event = HarnessEvent.safeParse(value);
@@ -1 +1 @@
1
- {"version":3,"file":"quota-registry.js","sourceRoot":"","sources":["../src/quota-registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,YAAY,IAAI,kBAAkB,EAClC,aAAa,IAAI,mBAAmB,EACpC,wBAAwB,EACxB,yBAAyB,GAK1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,WAAW,EACX,OAAO,EACP,6BAA6B,GAC9B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAE9F,MAAM,QAAQ,GAAG,yBAAyB,CAAC;AAC3C,MAAM,eAAe,GAAG,gCAAgC,CAAC;AACzD,MAAM,OAAO,GAAG,uBAAuB,CAAC;AACxC,MAAM,kBAAkB,GAAG,0BAA0B,CAAC;AACtD;oEACoE;AACpE,MAAM,mBAAmB,GAAG,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;AAiB7C,iEAAiE;AACjE,MAAM,OAAO,aAAa;IAiBL,OAAO;IACP,UAAU;IACV,GAAG;IACH,QAAQ;IAnBV,SAAS,GAAG,IAAI,GAAG,EAAyB,CAAC;IAC9D;;iDAE6C;IACrC,QAAQ,GAAmB,EAAE,CAAC;IACtC;;gDAE4C;IACpC,gCAAgC,GAAkB,IAAI,CAAC;IAC9C,kBAAkB,GAAG,IAAI,uBAAuB,EAE9D,CAAC;IACa,SAAS,CAAiB;I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CAAC,SAAS,EAAE,CAAC;YAC7C,IAAI,QAAQ,CAAC,OAAO,CAAC,OAAO,KAAK,OAAO,IAAI,QAAQ,CAAC,OAAO,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;gBACtF,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAC3B,OAAO,IAAI,CAAC,CAAC;YACf,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claudexor/daemon",
3
- "version": "3.8.4",
3
+ "version": "3.9.1",
4
4
  "license": "MIT",
5
5
  "description": "Managed local daemon: Unix-socket JSON-RPC, token auth, task queue. Runner injected (no second scheduler).",
6
6
  "type": "module",
@@ -17,10 +17,10 @@
17
17
  ],
18
18
  "dependencies": {
19
19
  "yaml": "^2.8.2",
20
- "@claudexor/core": "3.8.4",
21
- "@claudexor/util": "3.8.4",
22
- "@claudexor/journal": "3.8.4",
23
- "@claudexor/schema": "3.8.4"
20
+ "@claudexor/core": "3.9.1",
21
+ "@claudexor/journal": "3.9.1",
22
+ "@claudexor/schema": "3.9.1",
23
+ "@claudexor/util": "3.9.1"
24
24
  },
25
25
  "repository": {
26
26
  "type": "git",