sidekick-shared 0.28.2 → 0.28.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +29 -13
  3. package/dist/browser.d.ts +2 -0
  4. package/dist/browser.js +10 -1
  5. package/dist/codexQuota.js +17 -4
  6. package/dist/esm/browser.js +2 -0
  7. package/dist/esm/codexQuota.js +18 -5
  8. package/dist/esm/index.js +3 -3
  9. package/dist/esm/multiProviderQuotaService.js +1 -1
  10. package/dist/esm/quota.js +356 -24
  11. package/dist/esm/quotaHistory.js +33 -8
  12. package/dist/esm/quotaPoller.js +5 -2
  13. package/dist/esm/quotaResolver.js +31 -6
  14. package/dist/esm/quotaSnapshots.js +65 -10
  15. package/dist/esm/quotaThresholds.js +7 -2
  16. package/dist/esm/schemas/index.js +2 -2
  17. package/dist/esm/schemas/quota.js +30 -0
  18. package/dist/esm/schemas/quotaHistory.js +10 -2
  19. package/dist/esm/schemas/stateFile.js +9 -0
  20. package/dist/esm/stateFile.js +18 -3
  21. package/dist/esm/statusline/claudeStatuslinePayload.js +16 -4
  22. package/dist/esm/statusline/formatter.js +57 -18
  23. package/dist/esm/statusline/index.js +2 -2
  24. package/dist/esm/zaiQuotaApi.js +4 -2
  25. package/dist/index.d.ts +6 -6
  26. package/dist/index.js +18 -5
  27. package/dist/multiProviderQuotaService.js +1 -1
  28. package/dist/quota.d.ts +131 -1
  29. package/dist/quota.js +366 -24
  30. package/dist/quotaHistory.d.ts +10 -0
  31. package/dist/quotaHistory.js +34 -8
  32. package/dist/quotaPoller.d.ts +11 -3
  33. package/dist/quotaPoller.js +5 -2
  34. package/dist/quotaResolver.js +30 -5
  35. package/dist/quotaSnapshots.js +64 -9
  36. package/dist/quotaThresholds.js +7 -2
  37. package/dist/schemas/index.d.ts +3 -3
  38. package/dist/schemas/index.js +5 -2
  39. package/dist/schemas/quota.d.ts +258 -0
  40. package/dist/schemas/quota.js +31 -1
  41. package/dist/schemas/quotaHistory.d.ts +2 -0
  42. package/dist/schemas/quotaHistory.js +10 -2
  43. package/dist/schemas/stateFile.d.ts +34 -0
  44. package/dist/schemas/stateFile.js +10 -1
  45. package/dist/stateFile.d.ts +18 -0
  46. package/dist/stateFile.js +17 -2
  47. package/dist/statusline/claudeStatuslinePayload.d.ts +4 -3
  48. package/dist/statusline/claudeStatuslinePayload.js +16 -4
  49. package/dist/statusline/formatter.d.ts +5 -0
  50. package/dist/statusline/formatter.js +56 -17
  51. package/dist/statusline/index.d.ts +4 -4
  52. package/dist/statusline/index.js +5 -1
  53. package/dist/zaiQuotaApi.js +3 -1
  54. package/package.json +1 -1
@@ -42,6 +42,7 @@ var __importStar = (this && this.__importStar) || (function () {
42
42
  })();
43
43
  Object.defineProperty(exports, "__esModule", { value: true });
44
44
  exports.getWorkspaceIdFromPath = getWorkspaceIdFromPath;
45
+ exports.quotaHistoryWindow = quotaHistoryWindow;
45
46
  exports.appendQuotaHistorySample = appendQuotaHistorySample;
46
47
  exports.readQuotaHistoryRange = readQuotaHistoryRange;
47
48
  exports.readQuotaHistoryDailyBuckets = readQuotaHistoryDailyBuckets;
@@ -200,11 +201,26 @@ function pruneFileSync(filePath, retentionDays) {
200
201
  }
201
202
  return { kept: keptLines.length, pruned };
202
203
  }
204
+ function historyWindowToQuota(window) {
205
+ return {
206
+ utilization: window.utilization,
207
+ resetsAt: window.resetsAt,
208
+ ...(window.absent ? { absent: true } : {}),
209
+ };
210
+ }
211
+ /**
212
+ * Project a quota window onto the history-sample shape, keeping the `absent`
213
+ * marker so summaries and the derived snapshot do not mistake "no such
214
+ * window" for "0% used".
215
+ */
216
+ function quotaHistoryWindow(window) {
217
+ return historyWindowToQuota(window);
218
+ }
203
219
  function sampleToQuotaState(sample) {
204
220
  const providerId = runtimeProviderToSnapshotProvider(sample.runtimeProvider);
205
221
  return {
206
- fiveHour: { utilization: sample.fiveHour.utilization, resetsAt: sample.fiveHour.resetsAt },
207
- sevenDay: { utilization: sample.sevenDay.utilization, resetsAt: sample.sevenDay.resetsAt },
222
+ fiveHour: historyWindowToQuota(sample.fiveHour),
223
+ sevenDay: historyWindowToQuota(sample.sevenDay),
208
224
  available: sample.available,
209
225
  error: sample.error,
210
226
  providerId,
@@ -370,12 +386,22 @@ async function readQuotaHistoryDailyBuckets(options) {
370
386
  let maxSeven = 0;
371
387
  let sumFive = 0;
372
388
  let sumSeven = 0;
389
+ // Averages count only samples where the window exists, so a plan without
390
+ // a five-hour limit does not drag the five-hour average toward zero.
391
+ let fiveCount = 0;
392
+ let sevenCount = 0;
373
393
  let anyUnavailable = false;
374
394
  for (const s of daySamples) {
375
- maxFive = Math.max(maxFive, s.fiveHour.utilization);
376
- maxSeven = Math.max(maxSeven, s.sevenDay.utilization);
377
- sumFive += s.fiveHour.utilization;
378
- sumSeven += s.sevenDay.utilization;
395
+ if (!s.fiveHour.absent) {
396
+ maxFive = Math.max(maxFive, s.fiveHour.utilization);
397
+ sumFive += s.fiveHour.utilization;
398
+ fiveCount += 1;
399
+ }
400
+ if (!s.sevenDay.absent) {
401
+ maxSeven = Math.max(maxSeven, s.sevenDay.utilization);
402
+ sumSeven += s.sevenDay.utilization;
403
+ sevenCount += 1;
404
+ }
379
405
  if (!s.available)
380
406
  anyUnavailable = true;
381
407
  }
@@ -385,8 +411,8 @@ async function readQuotaHistoryDailyBuckets(options) {
385
411
  samples: n,
386
412
  maxUtilizationFiveHour: maxFive,
387
413
  maxUtilizationSevenDay: maxSeven,
388
- avgUtilizationFiveHour: Math.round((sumFive / n) * 100) / 100,
389
- avgUtilizationSevenDay: Math.round((sumSeven / n) * 100) / 100,
414
+ avgUtilizationFiveHour: fiveCount ? Math.round((sumFive / fiveCount) * 100) / 100 : 0,
415
+ avgUtilizationSevenDay: sevenCount ? Math.round((sumSeven / sevenCount) * 100) / 100 : 0,
390
416
  anyUnavailable,
391
417
  });
392
418
  }
@@ -6,13 +6,17 @@
6
6
  *
7
7
  * @module quotaPoller
8
8
  */
9
- import type { QuotaState } from './quota';
9
+ import type { ClaudePlanInfo, QuotaState } from './quota';
10
10
  import { type AccountsChangedEvent } from './accountChanges';
11
11
  /** Disposable subscription handle. */
12
12
  export interface Disposable {
13
13
  dispose(): void;
14
14
  }
15
15
  /** Options for QuotaPoller construction. */
16
+ /** Credential fields the poller reads when `getAccessToken` returns a record. */
17
+ export interface QuotaPollerCredentials extends ClaudePlanInfo {
18
+ accessToken: string;
19
+ }
16
20
  export interface QuotaPollerOptions {
17
21
  /** Polling interval when actively monitored (ms). Default: 60_000 (1 minute). */
18
22
  activeIntervalMs?: number;
@@ -20,8 +24,12 @@ export interface QuotaPollerOptions {
20
24
  idleIntervalMs?: number;
21
25
  /** Maximum backoff delay for retries (ms). Default: 120_000 (2 minutes). */
22
26
  maxBackoffMs?: number;
23
- /** Returns the current access token. Called before each fetch. */
24
- getAccessToken: () => Promise<string | null | undefined>;
27
+ /**
28
+ * Returns the current access token, or the credentials record itself so the
29
+ * poller can also stamp the subscription plan (`planLabel`, e.g. `Ultra`).
30
+ * Called before each fetch.
31
+ */
32
+ getAccessToken: () => Promise<string | QuotaPollerCredentials | null | undefined>;
25
33
  /** Optional cheap account-presence check performed before credential access. */
26
34
  hasAccount?: () => boolean | Promise<boolean>;
27
35
  /** Override the process-wide login/logout signal (primarily for embedded hosts/tests). */
@@ -128,7 +128,8 @@ class QuotaPoller {
128
128
  this.dormant = true;
129
129
  return;
130
130
  }
131
- const token = await this.getAccessToken();
131
+ const credentials = await this.getAccessToken();
132
+ const token = typeof credentials === 'string' ? credentials : credentials?.accessToken;
132
133
  if (!token) {
133
134
  if (this.hasAccount) {
134
135
  // The account exists but its token was unreadable (locked keychain,
@@ -144,7 +145,9 @@ class QuotaPoller {
144
145
  }
145
146
  return;
146
147
  }
147
- const state = await (0, quota_1.fetchQuota)(token);
148
+ const state = await (0, quota_1.fetchQuota)(token, {
149
+ plan: typeof credentials === 'object' && credentials !== null ? credentials : null,
150
+ });
148
151
  if (state.available) {
149
152
  this.latest = state;
150
153
  this.consecutiveFailures = 0;
@@ -66,9 +66,18 @@ function resolveIdentity(options) {
66
66
  return { accountId: options.accountId ?? ZAI_DEFAULT_ACCOUNT_ID, codexAccount: null };
67
67
  }
68
68
  }
69
- async function defaultClaudeAccessToken() {
69
+ /** Token plus the plan facts stored beside it (the plan label needs no extra read). */
70
+ async function claudeTokenAndPlan(options) {
71
+ if (options.getClaudeAccessToken) {
72
+ return { token: await options.getClaudeAccessToken(), plan: null };
73
+ }
70
74
  const credentials = await (0, credentials_1.readClaudeMaxCredentials)();
71
- return credentials?.accessToken ?? null;
75
+ return {
76
+ token: credentials?.accessToken ?? null,
77
+ plan: credentials
78
+ ? { subscriptionType: credentials.subscriptionType, rateLimitTier: credentials.rateLimitTier }
79
+ : null,
80
+ };
72
81
  }
73
82
  function zeroWindows() {
74
83
  return { fiveHour: { utilization: 0, resetsAt: '' }, sevenDay: { utilization: 0, resetsAt: '' } };
@@ -87,7 +96,7 @@ function unavailableState(providerId, error, capturedAt) {
87
96
  async function fetchFromApi(options, identity, capturedAt) {
88
97
  switch (options.providerId) {
89
98
  case 'claude-code': {
90
- const token = await (options.getClaudeAccessToken ?? defaultClaudeAccessToken)();
99
+ const { token, plan } = await claudeTokenAndPlan(options);
91
100
  if (!token) {
92
101
  return {
93
102
  ...zeroWindows(),
@@ -99,7 +108,7 @@ async function fetchFromApi(options, identity, capturedAt) {
99
108
  capturedAt,
100
109
  };
101
110
  }
102
- const state = await (0, quota_1.fetchQuota)(token, { fetchImpl: options.fetchImpl });
111
+ const state = await (0, quota_1.fetchQuota)(token, { fetchImpl: options.fetchImpl, plan });
103
112
  return { ...state, providerId: 'claude-code', source: 'api', capturedAt };
104
113
  }
105
114
  case 'codex':
@@ -181,7 +190,10 @@ async function resolveQuota(options) {
181
190
  const stored = identity.accountId
182
191
  ? readSnapshot(snapshotProviderId(providerId), identity.accountId, now)
183
192
  : null;
184
- const snapshot = stored?.available ? stored : null;
193
+ // A sample whose every window has reset since says nothing about current
194
+ // usage; it is reported as expired instead of being shown as live numbers.
195
+ const storedExpired = Boolean(stored?.available && (0, quota_1.quotaSampleExpired)(stored, now.getTime()));
196
+ const snapshot = stored?.available && !storedExpired ? stored : null;
185
197
  if (preferFresh && snapshot && snapshot.freshness === 'fresh') {
186
198
  return finish(snapshot, 'snapshot-fresh');
187
199
  }
@@ -227,8 +239,21 @@ async function resolveQuota(options) {
227
239
  const fallback = finish(snapshot, snapshotResolution(snapshot));
228
240
  return apiState ? { ...fallback, failure: (0, quotaPresentation_1.describeQuotaFailure)(apiState) } : fallback;
229
241
  }
242
+ if (storedExpired && stored) {
243
+ const expired = unavailableState(providerId, expiredSampleMessage(stored, now), capturedAt);
244
+ return apiState
245
+ ? { ...finish(expired, 'unavailable'), failure: (0, quotaPresentation_1.describeQuotaFailure)(apiState) }
246
+ : finish(expired, 'unavailable');
247
+ }
230
248
  return finish(apiState ??
231
249
  unavailableState(providerId, stored
232
250
  ? 'The last persisted quota sample was unavailable.'
233
251
  : 'No quota data is available yet; run the provider once so a sample can be recorded.', capturedAt), 'unavailable');
234
252
  }
253
+ function expiredSampleMessage(stored, now) {
254
+ const capturedMs = stored.capturedAt ? Date.parse(stored.capturedAt) : NaN;
255
+ const when = Number.isFinite(capturedMs)
256
+ ? ` from ${new Date(capturedMs).toISOString().slice(0, 10)} (${(0, quota_1.formatQuotaAge)(now.getTime() - capturedMs)})`
257
+ : '';
258
+ return `The last quota sample${when} has expired: every window has reset since. No current data.`;
259
+ }
@@ -83,6 +83,27 @@ function windowResetMs(value) {
83
83
  const ms = Date.parse(value);
84
84
  return Number.isFinite(ms) ? ms : 0;
85
85
  }
86
+ /**
87
+ * Rank two samples by one window's reset time. A later reset means a newer
88
+ * window, so it wins — except that an existing window which had already reset
89
+ * by the time the newer sample was captured is obsolete and always yields.
90
+ * Without that exception a pre-reset sample outranks every later sample whose
91
+ * window has not started yet (empty reset), and the snapshot freezes.
92
+ * Returns `undefined` when the reset times tie.
93
+ */
94
+ function compareWindowResets(existing, next, asOfMs) {
95
+ const existingReset = windowResetMs(existing.resetsAt);
96
+ const nextReset = windowResetMs(next.resetsAt);
97
+ if (existingReset === nextReset)
98
+ return undefined;
99
+ if (existingReset > 0 && asOfMs > 0 && existingReset <= asOfMs)
100
+ return false;
101
+ return existingReset > nextReset;
102
+ }
103
+ function windowPresenceChanged(existing, next) {
104
+ return (Boolean(existing.fiveHour.absent) !== Boolean(next.fiveHour.absent) ||
105
+ Boolean(existing.sevenDay.absent) !== Boolean(next.sevenDay.absent));
106
+ }
86
107
  // Preserve the best-known same-window snapshot while still allowing lower
87
108
  // utilization after Codex advances to a newer reset window.
88
109
  function shouldKeepExistingSnapshot(existing, next) {
@@ -95,20 +116,50 @@ function shouldKeepExistingSnapshot(existing, next) {
95
116
  const nextAggregate = (0, codex_1.isAggregateCodexLimit)(next.limitId);
96
117
  if (existingAggregate !== nextAggregate)
97
118
  return existingAggregate;
98
- const existingPrimaryReset = windowResetMs(existing.fiveHour.resetsAt);
99
- const nextPrimaryReset = windowResetMs(next.fiveHour.resetsAt);
100
- if (existingPrimaryReset !== nextPrimaryReset)
101
- return existingPrimaryReset > nextPrimaryReset;
102
- const existingSecondaryReset = windowResetMs(existing.sevenDay.resetsAt);
103
- const nextSecondaryReset = windowResetMs(next.sevenDay.resetsAt);
104
- if (existingSecondaryReset !== nextSecondaryReset)
105
- return existingSecondaryReset > nextSecondaryReset;
119
+ // The plan's window layout changed (a window appeared or disappeared): the
120
+ // reset times are not comparable, so the newer capture wins.
121
+ if (windowPresenceChanged(existing, next)) {
122
+ return snapshotTimeMs(existing) > snapshotTimeMs(next);
123
+ }
124
+ const asOfMs = snapshotTimeMs(next);
125
+ const primary = compareWindowResets(existing.fiveHour, next.fiveHour, asOfMs);
126
+ if (primary !== undefined)
127
+ return primary;
128
+ const secondary = compareWindowResets(existing.sevenDay, next.sevenDay, asOfMs);
129
+ if (secondary !== undefined)
130
+ return secondary;
106
131
  const existingUtilization = existing.fiveHour.utilization + existing.sevenDay.utilization;
107
132
  const nextUtilization = next.fiveHour.utilization + next.sevenDay.utilization;
108
133
  if (existingUtilization !== nextUtilization)
109
134
  return existingUtilization > nextUtilization;
110
135
  return snapshotTimeMs(existing) > snapshotTimeMs(next);
111
136
  }
137
+ /**
138
+ * Status-line and history samples only know the two headline windows. Keep
139
+ * the plan label, extra usage, and still-running extra meters (e.g. a Fable
140
+ * weekly cap) an earlier API sample recorded, so a fresh status-line write
141
+ * does not erase them from every snapshot reader.
142
+ */
143
+ function carryApiOnlyFields(existing, next) {
144
+ const merged = { ...next };
145
+ if (merged.planLabel === undefined && existing.planLabel !== undefined) {
146
+ merged.planLabel = existing.planLabel;
147
+ }
148
+ if (merged.planType === undefined && existing.planType !== undefined) {
149
+ merged.planType = existing.planType;
150
+ }
151
+ if (merged.extraUsage === undefined && existing.extraUsage !== undefined) {
152
+ merged.extraUsage = existing.extraUsage;
153
+ }
154
+ if (merged.limits === undefined && existing.limits !== undefined) {
155
+ const asOfMs = snapshotTimeMs(next);
156
+ // Headline meters duplicate the fresher windows on `next`; carry only the extras.
157
+ const running = (0, quota_1.extraQuotaRows)(existing).filter((row) => windowResetMs(row.resetsAt) > asOfMs);
158
+ if (running.length > 0)
159
+ merged.limits = running;
160
+ }
161
+ return merged;
162
+ }
112
163
  function writeQuotaSnapshot(providerId, accountId, quota) {
113
164
  withSnapshotStoreLock(() => {
114
165
  const store = readStore();
@@ -130,7 +181,11 @@ function writeQuotaSnapshot(providerId, accountId, quota) {
130
181
  };
131
182
  if (index >= 0 && shouldKeepExistingSnapshot(store.snapshots[index].quota, snapshot))
132
183
  return;
133
- const record = { providerId, accountId, quota: snapshot };
184
+ const record = {
185
+ providerId,
186
+ accountId,
187
+ quota: existingQuota ? carryApiOnlyFields(existingQuota, snapshot) : snapshot,
188
+ };
134
189
  if (index >= 0)
135
190
  store.snapshots[index] = record;
136
191
  else
@@ -55,8 +55,13 @@ function evaluateWindow(window, quota, thresholds, previous) {
55
55
  function evaluateQuotaThresholds(quota, config = exports.DEFAULT_QUOTA_THRESHOLDS, memory = {}) {
56
56
  if (!quota.available)
57
57
  return { alerts: [], memory };
58
- const fiveHour = evaluateWindow('fiveHour', quota.fiveHour, config.fiveHour, memory.fiveHour);
59
- const sevenDay = evaluateWindow('sevenDay', quota.sevenDay, config.sevenDay, memory.sevenDay);
58
+ // A window the plan does not have (Ultra's missing five-hour limit) never alerts.
59
+ const fiveHour = quota.fiveHour.absent
60
+ ? { alert: null, memory: memory.fiveHour ?? { resetsAt: '', level: 0 } }
61
+ : evaluateWindow('fiveHour', quota.fiveHour, config.fiveHour, memory.fiveHour);
62
+ const sevenDay = quota.sevenDay.absent
63
+ ? { alert: null, memory: memory.sevenDay ?? { resetsAt: '', level: 0 } }
64
+ : evaluateWindow('sevenDay', quota.sevenDay, config.sevenDay, memory.sevenDay);
60
65
  return {
61
66
  alerts: [fiveHour.alert, sevenDay.alert].filter((alert) => alert !== null),
62
67
  memory: { fiveHour: fiveHour.memory, sevenDay: sevenDay.memory },
@@ -23,7 +23,7 @@ export { transcriptSourceProvenanceSchema, canonicalTranscriptBlockSchema, canon
23
23
  export type { CanonicalSessionTranscript, CanonicalTranscriptMessage, CanonicalToolCall, TranscriptSourceProvenance, } from '../transcript';
24
24
  export { observationProvenanceV1Schema, observedAgentSessionV1Schema, observedValueV1Schema, pendingUserRequestV1Schema, providerCapabilitiesV1Schema, providerSessionAdapterV1Schema, sessionEvidenceRefV1Schema, } from './observedSessionV1';
25
25
  export type { ObservationProvenanceV1, ObservedAgentSessionV1, ObservedValueV1, PendingUserRequestV1, ProviderCapabilitiesV1, ProviderSessionAdapterV1, SessionEvidenceRefV1, } from '../types/observedSessionV1';
26
- export { quotaWindowSchema, quotaStateSchema, quotaFailureKindSchema, quotaProviderIdSchema, quotaSourceSchema, codexResetCreditSchema, codexResetCreditsSnapshotSchema, peakHoursStateSchema, quotaFailureDescriptorSchema, runtimeQuotaProviderSchema, providerQuotaStateSchema, claudeProviderQuotaStateSchema, codexProviderQuotaStateSchema, zaiProviderQuotaStateSchema, providerQuotaMapSchema, } from './quota';
26
+ export { quotaWindowSchema, quotaStateSchema, quotaLimitRowSchema, quotaExtraUsageSchema, quotaFailureKindSchema, quotaProviderIdSchema, quotaSourceSchema, codexResetCreditSchema, codexResetCreditsSnapshotSchema, peakHoursStateSchema, quotaFailureDescriptorSchema, runtimeQuotaProviderSchema, providerQuotaStateSchema, claudeProviderQuotaStateSchema, codexProviderQuotaStateSchema, zaiProviderQuotaStateSchema, providerQuotaMapSchema, } from './quota';
27
27
  export type { CodexResetCredit, CodexResetCreditsSnapshot, QuotaWindow, QuotaState, } from '../quota';
28
28
  export type { PeakHoursState } from '../peakHours';
29
29
  export type { QuotaFailureDescriptor } from '../quotaPresentation';
@@ -43,5 +43,5 @@ export type { AccountLaunchEnv } from '../accountLaunch';
43
43
  export type { RunningAccountConsumer, RunningProcess } from '../processDetection';
44
44
  export { assistantTurnEventSchema, assistantTurnEventTypeSchema, assistantTurnNarrationStepSchema, assistantTurnProcessSchema, assistantTurnProcessStepSchema, assistantTurnProjectionSchema, assistantTurnReasoningTimelineItemSchema, assistantTurnSubagentSchema, assistantTurnSubagentStatusSchema, assistantTurnTimelineItemSchema, assistantTurnToolGroupStepSchema, assistantTurnToolRefSchema, } from './assistantTurn';
45
45
  export type { AssistantTurnEvent, AssistantTurnEventType, AssistantTurnProcess, AssistantTurnProcessStep, AssistantTurnProjection, AssistantTurnSubagent, AssistantTurnSubagentStatus, AssistantTurnTimelineItem, AssistantTurnToolRef, } from '../turns/assistantTurn';
46
- export { sidekickStateFileSchema, stateFileAccountSchema, stateFileBillingBlockSchema, stateFileContextSchema, stateFileQuotaSchema, stateFileQuotaWindowSchema, stateFileSessionSchema, stateFileWriterSchema, } from './stateFile';
47
- export type { SidekickStateFile, StateFileAccount, StateFileBillingBlock, StateFileContext, StateFileQuota, StateFileQuotaWindow, StateFileSession, StateFileWriter, } from '../stateFile';
46
+ export { sidekickStateFileSchema, stateFileAccountSchema, stateFileBillingBlockSchema, stateFileContextSchema, stateFileQuotaSchema, stateFileQuotaWindowSchema, stateFileQuotaLimitSchema, stateFileSessionSchema, stateFileWriterSchema, } from './stateFile';
47
+ export type { SidekickStateFile, StateFileAccount, StateFileBillingBlock, StateFileContext, StateFileQuota, StateFileQuotaWindow, StateFileQuotaLimit, StateFileSession, StateFileWriter, } from '../stateFile';
@@ -12,8 +12,8 @@
12
12
  * subpath is self-sufficient for boundary-validation modules.
13
13
  */
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.quotaHistoryRuntimeProviderSchema = exports.providerQuotaMapSchema = exports.zaiProviderQuotaStateSchema = exports.codexProviderQuotaStateSchema = exports.claudeProviderQuotaStateSchema = exports.providerQuotaStateSchema = exports.runtimeQuotaProviderSchema = exports.quotaFailureDescriptorSchema = exports.peakHoursStateSchema = exports.codexResetCreditsSnapshotSchema = exports.codexResetCreditSchema = exports.quotaSourceSchema = exports.quotaProviderIdSchema = exports.quotaFailureKindSchema = exports.quotaStateSchema = exports.quotaWindowSchema = exports.sessionEvidenceRefV1Schema = exports.providerSessionAdapterV1Schema = exports.providerCapabilitiesV1Schema = exports.pendingUserRequestV1Schema = exports.observedValueV1Schema = exports.observedAgentSessionV1Schema = exports.observationProvenanceV1Schema = exports.canonicalSessionTranscriptSchema = exports.canonicalTranscriptMessageSchema = exports.canonicalToolCallSchema = exports.canonicalTranscriptBlockSchema = exports.transcriptSourceProvenanceSchema = exports.providerFailureDiagnosisSchema = exports.providerRetryAfterSchema = exports.providerFailureEvidenceSchema = exports.providerAuthenticationEvidenceSchema = exports.tokenEstimateSchema = exports.normalizedUsageCostSchema = exports.normalizedUsageSchema = exports.toolResultSessionEventSchema = exports.toolUseSessionEventSchema = exports.systemSessionEventSchema = exports.summarySessionEventSchema = exports.assistantSessionEventSchema = exports.userSessionEventSchema = exports.extractSessionEvents = exports.permissionModeSchema = exports.sessionEventSchema = exports.sessionMessageSchema = exports.messageUsageSchema = exports.SESSION_PROVIDER_IDS = exports.RUNTIME_QUOTA_PROVIDER_IDS = exports.QUOTA_PROVIDER_IDS = exports.ACCOUNT_PROVIDER_IDS = void 0;
16
- exports.stateFileWriterSchema = exports.stateFileSessionSchema = exports.stateFileQuotaWindowSchema = exports.stateFileQuotaSchema = exports.stateFileContextSchema = exports.stateFileBillingBlockSchema = exports.stateFileAccountSchema = exports.sidekickStateFileSchema = exports.assistantTurnToolRefSchema = exports.assistantTurnToolGroupStepSchema = exports.assistantTurnTimelineItemSchema = exports.assistantTurnSubagentStatusSchema = exports.assistantTurnSubagentSchema = exports.assistantTurnReasoningTimelineItemSchema = exports.assistantTurnProjectionSchema = exports.assistantTurnProcessStepSchema = exports.assistantTurnProcessSchema = exports.assistantTurnNarrationStepSchema = exports.assistantTurnEventTypeSchema = exports.assistantTurnEventSchema = exports.accountLaunchEnvSchema = exports.syncReportSchema = exports.providerSyncReportSchema = exports.lastSwitchRecordSchema = exports.switchAccountResultSchema = exports.runningAccountConsumerSchema = exports.accountConsumerKindSchema = exports.runningProcessSchema = exports.accountViewSchema = exports.accountHealthSchema = exports.accountHealthSidecarSchema = exports.accountHealthSourceSchema = exports.accountHealthStateSchema = exports.listAllAccountsResultSchema = exports.savedAccountProfileSchema = exports.accountEntrySchema = exports.accountLoginStatusSchema = exports.beginAccountLoginResultSchema = exports.accountManagerResultSchema = exports.accountProviderIdSchema = exports.activeAccountStatusSchema = exports.activeProviderAccountStatusSchema = exports.quotaHistoryDailyBucketSchema = exports.quotaHistorySampleSchema = void 0;
15
+ exports.zaiProviderQuotaStateSchema = exports.codexProviderQuotaStateSchema = exports.claudeProviderQuotaStateSchema = exports.providerQuotaStateSchema = exports.runtimeQuotaProviderSchema = exports.quotaFailureDescriptorSchema = exports.peakHoursStateSchema = exports.codexResetCreditsSnapshotSchema = exports.codexResetCreditSchema = exports.quotaSourceSchema = exports.quotaProviderIdSchema = exports.quotaFailureKindSchema = exports.quotaExtraUsageSchema = exports.quotaLimitRowSchema = exports.quotaStateSchema = exports.quotaWindowSchema = exports.sessionEvidenceRefV1Schema = exports.providerSessionAdapterV1Schema = exports.providerCapabilitiesV1Schema = exports.pendingUserRequestV1Schema = exports.observedValueV1Schema = exports.observedAgentSessionV1Schema = exports.observationProvenanceV1Schema = exports.canonicalSessionTranscriptSchema = exports.canonicalTranscriptMessageSchema = exports.canonicalToolCallSchema = exports.canonicalTranscriptBlockSchema = exports.transcriptSourceProvenanceSchema = exports.providerFailureDiagnosisSchema = exports.providerRetryAfterSchema = exports.providerFailureEvidenceSchema = exports.providerAuthenticationEvidenceSchema = exports.tokenEstimateSchema = exports.normalizedUsageCostSchema = exports.normalizedUsageSchema = exports.toolResultSessionEventSchema = exports.toolUseSessionEventSchema = exports.systemSessionEventSchema = exports.summarySessionEventSchema = exports.assistantSessionEventSchema = exports.userSessionEventSchema = exports.extractSessionEvents = exports.permissionModeSchema = exports.sessionEventSchema = exports.sessionMessageSchema = exports.messageUsageSchema = exports.SESSION_PROVIDER_IDS = exports.RUNTIME_QUOTA_PROVIDER_IDS = exports.QUOTA_PROVIDER_IDS = exports.ACCOUNT_PROVIDER_IDS = void 0;
16
+ exports.stateFileWriterSchema = exports.stateFileSessionSchema = exports.stateFileQuotaLimitSchema = exports.stateFileQuotaWindowSchema = exports.stateFileQuotaSchema = exports.stateFileContextSchema = exports.stateFileBillingBlockSchema = exports.stateFileAccountSchema = exports.sidekickStateFileSchema = exports.assistantTurnToolRefSchema = exports.assistantTurnToolGroupStepSchema = exports.assistantTurnTimelineItemSchema = exports.assistantTurnSubagentStatusSchema = exports.assistantTurnSubagentSchema = exports.assistantTurnReasoningTimelineItemSchema = exports.assistantTurnProjectionSchema = exports.assistantTurnProcessStepSchema = exports.assistantTurnProcessSchema = exports.assistantTurnNarrationStepSchema = exports.assistantTurnEventTypeSchema = exports.assistantTurnEventSchema = exports.accountLaunchEnvSchema = exports.syncReportSchema = exports.providerSyncReportSchema = exports.lastSwitchRecordSchema = exports.switchAccountResultSchema = exports.runningAccountConsumerSchema = exports.accountConsumerKindSchema = exports.runningProcessSchema = exports.accountViewSchema = exports.accountHealthSchema = exports.accountHealthSidecarSchema = exports.accountHealthSourceSchema = exports.accountHealthStateSchema = exports.listAllAccountsResultSchema = exports.savedAccountProfileSchema = exports.accountEntrySchema = exports.accountLoginStatusSchema = exports.beginAccountLoginResultSchema = exports.accountManagerResultSchema = exports.accountProviderIdSchema = exports.activeAccountStatusSchema = exports.activeProviderAccountStatusSchema = exports.quotaHistoryDailyBucketSchema = exports.quotaHistorySampleSchema = exports.quotaHistoryRuntimeProviderSchema = exports.providerQuotaMapSchema = void 0;
17
17
  var providerIds_1 = require("../providerIds");
18
18
  Object.defineProperty(exports, "ACCOUNT_PROVIDER_IDS", { enumerable: true, get: function () { return providerIds_1.ACCOUNT_PROVIDER_IDS; } });
19
19
  Object.defineProperty(exports, "QUOTA_PROVIDER_IDS", { enumerable: true, get: function () { return providerIds_1.QUOTA_PROVIDER_IDS; } });
@@ -58,6 +58,8 @@ Object.defineProperty(exports, "sessionEvidenceRefV1Schema", { enumerable: true,
58
58
  var quota_1 = require("./quota");
59
59
  Object.defineProperty(exports, "quotaWindowSchema", { enumerable: true, get: function () { return quota_1.quotaWindowSchema; } });
60
60
  Object.defineProperty(exports, "quotaStateSchema", { enumerable: true, get: function () { return quota_1.quotaStateSchema; } });
61
+ Object.defineProperty(exports, "quotaLimitRowSchema", { enumerable: true, get: function () { return quota_1.quotaLimitRowSchema; } });
62
+ Object.defineProperty(exports, "quotaExtraUsageSchema", { enumerable: true, get: function () { return quota_1.quotaExtraUsageSchema; } });
61
63
  Object.defineProperty(exports, "quotaFailureKindSchema", { enumerable: true, get: function () { return quota_1.quotaFailureKindSchema; } });
62
64
  Object.defineProperty(exports, "quotaProviderIdSchema", { enumerable: true, get: function () { return quota_1.quotaProviderIdSchema; } });
63
65
  Object.defineProperty(exports, "quotaSourceSchema", { enumerable: true, get: function () { return quota_1.quotaSourceSchema; } });
@@ -119,5 +121,6 @@ Object.defineProperty(exports, "stateFileBillingBlockSchema", { enumerable: true
119
121
  Object.defineProperty(exports, "stateFileContextSchema", { enumerable: true, get: function () { return stateFile_1.stateFileContextSchema; } });
120
122
  Object.defineProperty(exports, "stateFileQuotaSchema", { enumerable: true, get: function () { return stateFile_1.stateFileQuotaSchema; } });
121
123
  Object.defineProperty(exports, "stateFileQuotaWindowSchema", { enumerable: true, get: function () { return stateFile_1.stateFileQuotaWindowSchema; } });
124
+ Object.defineProperty(exports, "stateFileQuotaLimitSchema", { enumerable: true, get: function () { return stateFile_1.stateFileQuotaLimitSchema; } });
122
125
  Object.defineProperty(exports, "stateFileSessionSchema", { enumerable: true, get: function () { return stateFile_1.stateFileSessionSchema; } });
123
126
  Object.defineProperty(exports, "stateFileWriterSchema", { enumerable: true, get: function () { return stateFile_1.stateFileWriterSchema; } });