@cortexkit/opencode-openai-auth 1.6.2 → 1.8.0

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 (77) hide show
  1. package/dist/bin.js +9 -9
  2. package/dist/{codex-request-D_In8uaR.d.ts → codex-request-DohnbsFR.d.ts} +66 -848
  3. package/dist/index-3v868rnp.js +63 -0
  4. package/dist/{index-b0ty9qam.js → index-5d4y47h8.js} +2 -2
  5. package/dist/{index-7nmdsmpp.js → index-5dxpsa3t.js} +2 -2
  6. package/dist/{index-8xq099qf.js → index-8pk9savd.js} +6 -6
  7. package/dist/{index-jkpg9d1p.js → index-cbcka7sa.js} +1 -1
  8. package/dist/{index-79y7w9bz.js → index-cxstwq02.js} +1 -1
  9. package/dist/{index-x9nffaye.js → index-dtwgf694.js} +1 -1
  10. package/dist/index-dzaqj248.js +2 -0
  11. package/dist/index-g3d50jz0.js +74 -0
  12. package/dist/{index-1qxz4s8a.js → index-n7fxqgfb.js} +2 -2
  13. package/dist/{index-rf0ht3gc.js → index-th47aqez.js} +2 -2
  14. package/dist/index-tvban5vp.js +91 -0
  15. package/dist/{index-ya9c5e4m.js → index-x7jzcvqy.js} +1 -1
  16. package/dist/index.d.ts +6 -79
  17. package/dist/index.js +1 -1
  18. package/dist/{port-file-8ElfwDcq.d.ts → port-file-DQ7-ItDK.d.ts} +1 -1
  19. package/dist/{model-D22uj0OB.d.ts → protocol-CVQK-d3j.d.ts} +25 -67
  20. package/dist/rpc/port-file.d.ts +4 -2
  21. package/dist/rpc/port-file.js +1 -1
  22. package/dist/rpc/protocol.d.ts +1 -1
  23. package/dist/rpc/protocol.js +1 -1
  24. package/dist/rpc/rpc-client.d.ts +2 -12
  25. package/dist/rpc/rpc-client.js +1 -1
  26. package/dist/rpc/rpc-dir.js +1 -1
  27. package/dist/rpc-client-BQfIKrXI.d.ts +13 -0
  28. package/dist/{sidebar-state-Bb9L9oPq.d.ts → sidebar-state-B1cq68UB.d.ts} +5 -7
  29. package/dist/sidebar-state.d.ts +2 -2
  30. package/dist/sidebar-state.js +1 -1
  31. package/dist/{token-xtq3457d.js → token-gy442bba.js} +1 -1
  32. package/dist/token-util-rxy0p234.js +1 -0
  33. package/dist/tui-preferences.js +1 -1
  34. package/dist/tui.d.ts +11 -2
  35. package/dist/v2/server.d.ts +15 -7
  36. package/dist/v2/server.js +2 -2
  37. package/package.json +2 -2
  38. package/src/tui-compiled/raw/shared/0f77ebc3c914c9c6-custody.js +95 -11
  39. package/src/tui-compiled/raw/shared/169b2b4bf30909bc-consumer.js +320 -35
  40. package/src/tui-compiled/raw/shared/30f5bc480f31f51c-roster.js +187 -12
  41. package/src/tui-compiled/raw/shared/352d228be2832bd4-hub.js +988 -0
  42. package/src/tui-compiled/raw/shared/458b934e92490331-mutate.js +4 -0
  43. package/src/tui-compiled/raw/shared/81dddd203f1b92a3-quota-writer.js +34 -12
  44. package/src/tui-compiled/raw/shared/836fc615de6afbd9-settings.js +16 -6
  45. package/src/tui-compiled/raw/shared/88b7fc40900fb003-commit-interval.js +18 -0
  46. package/src/tui-compiled/raw/shared/92e38944b51b2405-file-read-cache.js +57 -0
  47. package/src/tui-compiled/raw/shared/a670cb7f5987bc1b-shutdown.js +42 -0
  48. package/src/tui-compiled/raw/shared/b9588ad4725c1d10-enrollment.js +37 -12
  49. package/src/tui-compiled/raw/shared/c852a15cfe489d12-pool.js +1 -1
  50. package/src/tui-compiled/raw/shared/c911dbb64c9d85c7-quota-writer.js +27 -13
  51. package/src/tui-compiled/raw/shared/e8cd4929507508d8-refresh-file-lock.js +20 -11
  52. package/src/tui-compiled/raw/shared/e8d3c8da776ef9cd-index.js +37 -4
  53. package/src/tui-compiled/raw/tui/v2.tsx +88 -6
  54. package/src/tui-compiled/raw/tui.tsx +45 -3
  55. package/src/tui-compiled/runtime/shared/0f77ebc3c914c9c6-custody.js +95 -11
  56. package/src/tui-compiled/runtime/shared/169b2b4bf30909bc-consumer.js +320 -35
  57. package/src/tui-compiled/runtime/shared/30f5bc480f31f51c-roster.js +187 -12
  58. package/src/tui-compiled/runtime/shared/352d228be2832bd4-hub.js +988 -0
  59. package/src/tui-compiled/runtime/shared/458b934e92490331-mutate.js +4 -0
  60. package/src/tui-compiled/runtime/shared/81dddd203f1b92a3-quota-writer.js +34 -12
  61. package/src/tui-compiled/runtime/shared/836fc615de6afbd9-settings.js +16 -6
  62. package/src/tui-compiled/runtime/shared/88b7fc40900fb003-commit-interval.js +18 -0
  63. package/src/tui-compiled/runtime/shared/92e38944b51b2405-file-read-cache.js +57 -0
  64. package/src/tui-compiled/runtime/shared/a670cb7f5987bc1b-shutdown.js +42 -0
  65. package/src/tui-compiled/runtime/shared/b9588ad4725c1d10-enrollment.js +37 -12
  66. package/src/tui-compiled/runtime/shared/c852a15cfe489d12-pool.js +1 -1
  67. package/src/tui-compiled/runtime/shared/c911dbb64c9d85c7-quota-writer.js +27 -13
  68. package/src/tui-compiled/runtime/shared/e8cd4929507508d8-refresh-file-lock.js +20 -11
  69. package/src/tui-compiled/runtime/shared/e8d3c8da776ef9cd-index.js +37 -4
  70. package/src/tui-compiled/runtime/tui/v2.js +66 -5
  71. package/src/tui-compiled/runtime/tui.js +32 -3
  72. package/dist/index-ge60xry3.js +0 -90
  73. package/dist/index-k5anexvs.js +0 -69
  74. package/dist/index-xpc2hm9h.js +0 -65
  75. package/dist/index-z8bptbrk.js +0 -2
  76. package/dist/protocol-CK9guiFy.d.ts +0 -29
  77. package/dist/token-util-nyvn9866.js +0 -1
@@ -1,8 +1,7 @@
1
- import { a as KnobValues, c as PluginExtraSection, i as CommandInvocation, l as PluginSection, o as MenuKnob, t as CommandApplyRequest } from "./model-D22uj0OB.js";
2
- import { _t as QuotaMap } from "./sidebar-state-Bb9L9oPq.js";
1
+ import { gt as QuotaMap } from "./sidebar-state-B1cq68UB.js";
3
2
  import { ClaustrumClient, EnrollmentPollOutcome } from "@cortexkit/claustrum-client";
4
3
  import "@cortexkit/private-files";
5
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/store/schema.d.ts
4
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.27.1+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/store/schema.d.ts
6
5
  type OAuthCredential = {
7
6
  type: 'oauth';
8
7
  access?: string;
@@ -15,15 +14,6 @@ type ApiKeyCredential = {
15
14
  baseURL: string;
16
15
  authHeader?: 'authorization-bearer' | 'x-api-key';
17
16
  };
18
- type PoolCredential = OAuthCredential | ApiKeyCredential;
19
- /**
20
- * What `rotate` takes. Rotation refreshes the secret of the endpoint a row
21
- * already has, so an API key may leave out `baseURL` (and `authHeader`) to
22
- * keep the row's; one it gives must equal the row's.
23
- */
24
- type RotateCredential = OAuthCredential | (Omit<ApiKeyCredential, 'baseURL'> & {
25
- baseURL?: string;
26
- });
27
17
  /** A credential as stored: an OAuth credential also carries its refresh stamp. */
28
18
  type StoredCredential = (OAuthCredential & {
29
19
  lastRefreshedAt?: number;
@@ -86,112 +76,8 @@ interface ProviderStateCodec {
86
76
  */
87
77
  onReplace?(previous: unknown | undefined, replacement: ProviderStateReplacement): unknown | undefined;
88
78
  }
89
- /**
90
- * Why a row shows no provider state although the state file holds one for it.
91
- *
92
- * `uncovered`: the value's credential-bound part (see
93
- * `ProviderStateCodec.credentialBound`) is not the one this store last
94
- * wrote beside the row's credential at its credential epoch and recorded
95
- * identity. Another writer edited it, or
96
- * wrote the credential beside it without knowing about it (an older version
97
- * of this library, which drops the coverage, or a writer that does not know
98
- * the pool at all), or it belongs to an earlier credential of the row.
99
- * `invalid`: the value is covered but the codec rejects it, or the store was
100
- * opened without a provider-state codec.
101
- */
102
- type ProviderStateDrop = 'uncovered' | 'invalid';
103
- /**
104
- * What the stamp beside a row's credential proves (see `CredentialStamp`).
105
- *
106
- * `none`: the row holds no credential, so there is nothing to stamp.
107
- * `bound`: the stamp was written with this credential (its digest matches),
108
- * names the row's credential epoch (1 for a row without a per-row entry),
109
- * the identity it records (or its recording none) and any endpoint it
110
- * records are the row's, and its dispatch digest matches everything a
111
- * request would send (the OAuth access and refresh tokens and expiry; the API
112
- * key with its `baseURL` and `authHeader`).
113
- * `missing`: the credential carries no stamp (written by a writer that does
114
- * not know about stamps, or one that dropped it).
115
- * `malformed`: the stamp is not one this store writes (wrong shape, or an
116
- * epoch outside the positive safe integers).
117
- * `mismatched`: the stamp was written for another credential, epoch,
118
- * identity, endpoint, or token to send than the row now holds.
119
- * `legacy`: a well-formed stamp written with this credential's secret but
120
- * with no dispatch digest (written by 0.4.3 or earlier), so it proves
121
- * neither the token sent nor the account or endpoint it goes to.
122
- */
123
- type CredentialStampStatus = 'none' | 'bound' | 'missing' | 'malformed' | 'mismatched' | 'legacy';
124
- /** One row of the pool as loaded. */
125
- interface PoolRow {
126
- id: string;
127
- type: 'oauth' | 'api';
128
- label?: string;
129
- enabled: boolean;
130
- addedAt?: number;
131
- /** Recorded wire identity (the roster row's `accountId`), when known. */
132
- identity?: string;
133
- /** Undefined when the state file holds no usable credential for the row. */
134
- credential?: StoredCredential;
135
- /** Stable hash of the credential's secret material; never persisted. */
136
- fingerprint?: string;
137
- /** Undefined when the row has no per-row entry yet. */
138
- credentialEpoch?: number;
139
- needsFirstReading: boolean;
140
- disabledReason?: string;
141
- /** Store-owned reservation; only `publishRoster` releases it for ordinary use. */
142
- staged?: {
143
- reservation: string;
144
- };
145
- /** The opaque quota map, as validated by the codec. */
146
- quota?: unknown;
147
- /**
148
- * The opaque provider state kept beside the credential, as validated by
149
- * the provider-state codec. Absent when the row has none, or when the one
150
- * on disk is not shown (see `providerStateDropped`).
151
- */
152
- providerState?: unknown;
153
- /**
154
- * Set when the state file holds a provider state for the row that is not
155
- * shown, and why. The value stays on disk untouched until a write on the
156
- * row sets or clears it; the row itself stays usable.
157
- */
158
- providerStateDropped?: ProviderStateDrop;
159
- hasEntry: boolean;
160
- /** A row that may be refreshed, pulled for, or admitted. */
161
- candidate: boolean;
162
- /** Set when the roster row or the per-row entry failed validation. */
163
- invalid?: 'roster' | 'entry';
164
- /**
165
- * Set when a replace stopped between its two writes: the state file holds
166
- * the new credential, stamped with the epoch and the identity or endpoint
167
- * it belongs to, and the config still holds the replaced row. Also set when
168
- * a write that gives a row its first identity (`recordIdentity`, or a
169
- * `rotate` or refresh that learns one) stopped after stamping the identity
170
- * and before recording it in the config, and when an attributed `disable`
171
- * or `enable` that changed the provider state stopped after its state
172
- * write and before flipping the row in the config. The row is shown as the
173
- * write leaves it once completed, is never a candidate, and the next store
174
- * write on it writes the config to match.
175
- */
176
- torn?: true;
177
- /**
178
- * Whether the credential is the one the store last stamped for this row
179
- * (see `CredentialStampStatus`). Every row the store loads carries it; a
180
- * torn row reports the stamp of the row as it is shown completed. It is
181
- * optional only so that rows built by hand (test fixtures) still type.
182
- */
183
- stamp?: CredentialStampStatus;
184
- /**
185
- * Set only when the store was opened with `requireCredentialStamps` and
186
- * the row's `stamp` is not `bound`: the row is never a candidate, and
187
- * `refresh`, quota pulls, `recordQuota`, `recordIdentity`, `rotate` and a
188
- * re-`add` onto it refuse with `unbound-credential`. Only `replace` (or a
189
- * new row) makes it usable again.
190
- */
191
- unbound?: true;
192
- }
193
79
  //#endregion
194
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/store/errors.d.ts
80
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.27.1+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/store/errors.d.ts
195
81
  /** Every library operation that can fail, as named in the failure value. */
196
82
  type PoolOperation = 'initialize' | 'add' | 'replace' | 'rotate' | 'disable' | 'enable' | 'remove' | 'reorder' | 'updateSettings' | 'recordIdentity' | 'updateProviderState' | 'refresh' | 'pull' | 'publishRoster';
197
83
  /**
@@ -238,12 +124,12 @@ declare class PoolOperationError extends Error {
238
124
  });
239
125
  }
240
126
  //#endregion
241
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/store/hooks.d.ts
127
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.27.1+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/store/hooks.d.ts
242
128
  interface PoolLogger {
243
129
  warn(message: string, data?: unknown): void;
244
130
  }
245
131
  //#endregion
246
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/fs/refresh-file-lock.d.ts
132
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.27.1+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/fs/refresh-file-lock.d.ts
247
133
  interface LockLoss {
248
134
  readonly reason: 'taken-over' | 'expired' | 'unreadable' | 'renewal-failed' | 'marker-lost';
249
135
  readonly expectedOwnerId: string;
@@ -273,12 +159,12 @@ type RefreshFileLockOptions = {
273
159
  onContended?: () => void;
274
160
  /** Synchronous, never awaited; throws and returned promise/thenable rejections are isolated. */
275
161
  onRenewalTimer?: (event: 'scheduled' | 'cancelled') => void;
276
- onStep?: (step: 'stale-marker-stat' | 'stale-marker-claimed' | 'stale-lock-observed' | 'lock-read-ready' | 'lock-missing' | 'stale-lock-confirmed' | 'stale-lock-removed' | 'stale-lock-recreated' | 'eviction-marker-acquired' | 'renewal-owner-confirmed' | 'renewal-marker-unavailable' | 'renewal-write-fenced' | 'renewal-write-ready' | 'renewal-write-finished' | 'relinquish-read' | 'renewal-finished' | 'release-owner-confirmed') => void | Promise<void>;
162
+ onStep?: (step: 'stale-marker-stat' | 'stale-marker-claimed' | 'stale-lock-observed' | 'lease-contention-read-ready' | 'lock-read-ready' | 'lock-missing' | 'stale-lock-confirmed' | 'stale-lock-removed' | 'stale-lock-recreated' | 'eviction-marker-acquired' | 'renewal-owner-confirmed' | 'renewal-marker-unavailable' | 'renewal-write-fenced' | 'renewal-write-ready' | 'renewal-write-finished' | 'relinquish-read' | 'renewal-finished' | 'release-owner-confirmed') => void | Promise<void>;
277
163
  };
278
164
  /** Filesystem leases share wall time across all callers and processes. */
279
165
  declare function acquireRefreshFileLock(options: RefreshFileLockOptions): Promise<RefreshFileLock | null>;
280
166
  //#endregion
281
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/store/refresh-lock.d.ts
167
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.27.1+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/store/refresh-lock.d.ts
282
168
  type LockStep = NonNullable<Parameters<typeof acquireRefreshFileLock>[0]['onStep']> extends ((step: infer S) => unknown) ? S : never;
283
169
  /** Tuning shared by every lock the store takes; each field is overridable. */
284
170
  interface PoolLockOptions {
@@ -310,7 +196,7 @@ interface LockEnvironment {
310
196
  }, event: 'scheduled' | 'cancelled') => void;
311
197
  }
312
198
  //#endregion
313
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/store/mutate.d.ts
199
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.27.1+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/store/mutate.d.ts
314
200
  /** Named points on the write path, for crash and ownership injection. */
315
201
  type WriteStep = 'before-config-write' | 'after-config-write' | 'before-state-write' | 'after-state-write';
316
202
  /** Awaitable pause points on the pull and refresh paths. */
@@ -342,332 +228,21 @@ interface StoreContext {
342
228
  requireCredentialStamps?: boolean;
343
229
  requireRemovedFingerprint?: boolean;
344
230
  }
345
- /** What `initializePool` did. */
346
- type InitializeOutcome = 'initialized' | 'already-ready';
347
231
  //#endregion
348
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/store/runtime.d.ts
232
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.27.1+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/store/runtime.d.ts
349
233
  /** Where a pull was fired from; `load` fires at most once per process per row. */
350
234
  type PullReason = 'load' | 'add' | 'replace' | 'admission';
351
235
  //#endregion
352
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/store/attribution.d.ts
353
- /**
354
- * What a pull or refresh captured about its row (named by id alongside) when
355
- * it was issued. A result applies only while the row with that id still has
356
- * this credential epoch and this recorded identity; a replaced credential
357
- * bumps the epoch, so work issued for the old one is discarded.
358
- *
359
- * The epoch names one credential lineage of the row: a credential given by
360
- * `add` or `replace`, through every refresh and `rotate` of it, which keep
361
- * the epoch. Since 0.8.0 that holds across removal too: a row added under an
362
- * id the pool held before starts past every epoch that id held (the store
363
- * records them when it drops a row, in the config file, so every process
364
- * sees it), so an attribution taken for a removed row is refused once the id
365
- * is added again, even with the same identity. Writers older than 0.8.0
366
- * start a re-added id at epoch 1 again, and a writer that does not know the
367
- * pool can remove and re-add a row without the store seeing it; work
368
- * attributed across either may still apply to the new credential.
369
- */
370
- interface Attribution {
371
- credentialEpoch: number;
372
- identity?: string;
373
- }
374
- //#endregion
375
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/store/rows.d.ts
376
- type FailureHook = (rowId: string, error: PoolOperationError) => void | Promise<void>;
377
- interface RowOperationOptions {
378
- /** Called once, awaited, on every non-success path, before locks release. */
379
- onFailure?: FailureHook;
380
- /** The provider-wide lock, when an operation may change identity keying. */
381
- providerLock?: PoolLockSpec;
382
- /**
383
- * Further locks taken after the row lock and the provider-wide lock, in
384
- * this order, before the store locks: the same place `refresh` takes its
385
- * extra locks, so a caller holding legacy locks around a row write and a
386
- * refresh of that row acquire them in one order and cannot deadlock.
387
- */
388
- extraLocks?: readonly PoolLockSpec[];
389
- }
390
- interface RowProjection {
391
- id: string;
392
- type: 'oauth' | 'api';
393
- label?: string;
394
- enabled: boolean;
395
- disabledReason?: string;
396
- identity?: string;
397
- credentialEpoch?: number;
398
- stamp?: PoolRow['stamp'];
399
- staged?: {
400
- reservation: string;
236
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.27.1+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/quota/commit-interval.d.ts
237
+ interface QuotaCommitTimer {
238
+ now(): number;
239
+ schedule(delayMs: number, run: () => Promise<void>): {
240
+ cancel(): void;
241
+ unref?(): void;
401
242
  };
402
- torn?: true;
403
- invalid?: 'roster' | 'entry';
404
- }
405
- interface ProtectView {
406
- id: string;
407
- row?: RowProjection;
408
- rows: RowProjection[];
409
- config: Readonly<Record<string, unknown>>;
410
- }
411
- type ProtectFn = (view: ProtectView) => string | undefined | Promise<string | undefined>;
412
- interface AddOptions extends RowOperationOptions {
413
- onExisting?: 'rotate' | 'refuse' | 'stage-duplicate';
414
- protect?: ProtectFn;
415
- }
416
- /** Options of `replace` and `rotate`. Without `attribution` a call behaves as before. */
417
- interface RowWriteOptions extends RowOperationOptions {
418
- /**
419
- * The credential epoch and recorded identity the caller read the row at
420
- * when it decided on this write; an identity left out means the row had
421
- * none. Compared exactly, under the row and store locks, before any write
422
- * or replacement hook, including the completion of an interrupted replace.
423
- * The call is refused (`attribution`, retryable, nothing written) once the
424
- * row holds another epoch or identity, so a write decided on an older
425
- * credential never overwrites the one that replaced it. `disable`, `enable`,
426
- * `recordQuota` and `updateProviderState` take the same fence.
427
- */
428
- attribution?: Attribution;
429
- }
430
- /**
431
- * Options of `disable`, `enable` and `remove`. The provider-wide lock guards
432
- * changes to the recorded identity a row lock is named by; none of these
433
- * three records an identity, so none takes it. The extra locks are taken
434
- * where every other row write takes them, after the row lock and before the
435
- * store locks.
436
- */
437
- type RowToggleOptions = Pick<RowOperationOptions, 'onFailure' | 'extraLocks'>;
438
- /** What a `remove` protect predicate is shown, read under every lock. */
439
- interface RemoveView {
440
- /**
441
- * The row as loaded; undefined when the roster no longer holds the id and
442
- * only its state-file entry is left (an add or removal interrupted between writes).
443
- */
444
- row: PoolRow | undefined;
445
- /** The config file as read under the store locks. */
446
- config: Readonly<Record<string, unknown>>;
447
- /** The state file as read under the store locks. */
448
- state: Readonly<Record<string, unknown>>;
449
- }
450
- interface RemoveOptions extends RowToggleOptions {
451
- /** Exact reservation required to remove a row that is still staged. */
452
- staged?: {
453
- reservation: string;
454
- };
455
- /**
456
- * The credential the removal was decided for (since 0.11.7). Checked under
457
- * every lock, before `protect` and before anything is written or repaired:
458
- * - a roster row must be bound to its credential stamp, not torn, and hold
459
- * exactly this epoch and recorded identity (absence included);
460
- * - an orphan (only a state-file entry left, by a removal or add
461
- * interrupted between its writes) must carry a stamp this store can bind
462
- * to the credential beside it, and that stamp must name exactly this
463
- * epoch and identity.
464
- * Epochs only grow per id (a removal records the dropped epoch, and a later
465
- * add of the id starts past it), so an orphan an interrupted later add
466
- * left under the same id never matches the epoch of the row the caller
467
- * meant to remove. A mismatch refuses with kind `attribution`, an orphan
468
- * or row with no bindable stamp with kind `unbound-credential`; both leave
469
- * the files byte for byte unchanged. Without it, `remove` drops whatever
470
- * the id holds, as before.
471
- *
472
- * The epoch survives a refresh or `rotate`, so it names a credential
473
- * lineage, not one token: a caller that must remove only an exact token
474
- * still checks the loaded credential in `protect`.
475
- */
476
- attribution?: Attribution;
477
- /**
478
- * Awaited under every lock before anything is written; a reason refuses
479
- * the removal (kind `row-protected`) with both files unchanged. The store
480
- * keeps no record of a plugin's in-flight work, so this is where a plugin
481
- * refuses an id it reserves or one its own pending-operation record (kept
482
- * in the config or state file) still names: reading that record from the
483
- * locked files here cannot race a writer that holds the store locks.
484
- */
485
- protect?: (id: string, view: RemoveView) => string | undefined | Promise<string | undefined>;
486
- }
487
- type RemoveResult = {
488
- id: string;
489
- /**
490
- * `removed`: the roster row was dropped (and its state entry, if any).
491
- * `completed`: only a state-file entry was left, by a removal interrupted
492
- * between its config and state writes or an add interrupted before its
493
- * config write, and it is now dropped.
494
- */
495
- outcome: 'removed' | 'completed';
496
- };
497
- /**
498
- * Options of `reorder`. It names no row, so its failure hook is handed only
499
- * the failure; it takes no row lock and no provider-wide lock, so the extra
500
- * locks are taken first, then the store locks.
501
- */
502
- interface ReorderOptions {
503
- /** Called once, awaited, on every non-success path, before the extra locks release. */
504
- onFailure?: (error: PoolOperationError) => void | Promise<void>;
505
- /** Locks taken, in this order, before the store locks. */
506
- extraLocks?: readonly PoolLockSpec[];
507
- }
508
- type ReorderResult = {
509
- /** The roster order now on disk. */
510
- ids: string[];
511
- /** `unchanged` when the roster was already in this order; nothing was written. */
512
- outcome: 'reordered' | 'unchanged';
513
- };
514
- interface AddInput {
515
- id: string;
516
- credential: PoolCredential;
517
- identity?: string;
518
- label?: string;
519
- disabled?: {
520
- reason: string;
521
- };
522
- stage?: {
523
- reservation: string;
524
- };
525
- /**
526
- * Provider state for the credential, written in the same state write as
527
- * the credential (needs the store's provider-state codec). On an `add`
528
- * that rotates a row already holding this secret it is merged with the
529
- * row's value (`ProviderStateCodec.merge`); left out, that row keeps its
530
- * value.
531
- */
532
- providerState?: unknown;
533
- }
534
- /** What `replace` and `rotate` take beside the credential. */
535
- interface CredentialWriteInput {
536
- identity?: string;
537
- /**
538
- * Provider state written in the same state write as the credential. For
539
- * `rotate` it is merged with the row's value; left out, the row keeps its
540
- * value. For `replace` see `ProviderStateCodec.onReplace`.
541
- */
542
- providerState?: unknown;
543
- }
544
- type AddResult = {
545
- /** The row holding the credential; an existing row's id on a re-add. */
546
- id: string;
547
- outcome: 'added' | 'added-disabled' | 'completed' | 'rotated' | 'exists';
548
- credential: StoredCredential;
549
- credentialEpoch: number;
550
- };
551
- /**
552
- * Options of `disable` and `enable`. A call that passes neither
553
- * `attribution` nor `providerState` behaves exactly as it did before 0.7.0.
554
- */
555
- interface RowTransitionOptions extends RowToggleOptions {
556
- protect?: ProtectFn;
557
- /**
558
- * The credential epoch and recorded identity the caller's evidence for the
559
- * transition was obtained under (as `recordQuota`'s attribution: an
560
- * identity left out means the row had none). The call is refused
561
- * (`attribution`, retryable, nothing written) once the row holds another
562
- * epoch or identity, so a provider's late answer about a replaced
563
- * credential never disables, or switches back on, the row now holding its
564
- * successor.
565
- */
566
- attribution?: Attribution;
567
- /**
568
- * A provider-state change made in the same transaction as the transition,
569
- * under the rules of `updateProviderState` (codec validation, the stamp
570
- * rebound to the value, `unbound-credential` for a row no stamp of this
571
- * store can bind it to); it requires `attribution`. The value and the
572
- * enabled flag land together: no reader, and no crash at any write point,
573
- * shows one without the other. Returning `DECLINE_TRANSITION` declines the
574
- * whole call and writes nothing.
575
- */
576
- providerState?: RowTransitionMutator;
577
- }
578
- interface RowTransitionResult {
579
- id: string;
580
- /** The provider-state mutator declined: nothing was written. */
581
- declined?: true;
582
- /**
583
- * Set when a provider-state mutator ran and did not decline: what it did
584
- * to the value, as `updateProviderState` reports it.
585
- */
586
- providerStateOutcome?: UpdateProviderStateResult['outcome'];
587
- /** The provider state the row now holds, when a mutator ran and left one. */
588
- providerState?: unknown;
589
243
  }
590
244
  //#endregion
591
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/store/provider-state.d.ts
592
- /**
593
- * Receives a private copy of the row's provider state (undefined when the row
594
- * shows none) and the row as loaded under the locks, and returns the next
595
- * provider state; returning undefined clears it, so a mutator that means to
596
- * keep the value returns it. It runs under the row lock and the store locks,
597
- * so it must not call back into the store (`PoolReentryError`).
598
- */
599
- type ProviderStateMutator = (current: unknown | undefined, row: PoolRow) => unknown | Promise<unknown>;
600
- type UpdateProviderStateResult = {
601
- id: string;
602
- /** The provider state now on disk; absent when the row has none. */
603
- providerState?: unknown;
604
- /**
605
- * `unchanged`: the mutator returned what the row already shows (or cleared
606
- * a row that holds none); nothing was written.
607
- */
608
- outcome: 'updated' | 'cleared' | 'unchanged';
609
- };
610
- /**
611
- * Returned by the provider-state mutator of an attributed `disable` or
612
- * `enable` to decline the whole transition: nothing is written, neither the
613
- * provider state nor the row's enabled flag, and the call resolves with
614
- * `declined: true`. A mutator declines when the state it is shown is newer
615
- * than what its caller saw, such as an eligibility recorded after the
616
- * request whose refusal is being acted on. It is a value of its own because
617
- * `undefined` already means "clear the provider state". `Symbol.for` keeps it
618
- * equal across two copies of this module loaded in one process.
619
- */
620
- declare const DECLINE_TRANSITION: unique symbol;
621
- /**
622
- * The provider-state mutator of an attributed `disable` or `enable`: as
623
- * `ProviderStateMutator`, and it may also return `DECLINE_TRANSITION`.
624
- */
625
- type RowTransitionMutator = (current: unknown | undefined, row: PoolRow) => unknown | typeof DECLINE_TRANSITION | Promise<unknown | typeof DECLINE_TRANSITION>;
626
- //#endregion
627
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/store/publication.d.ts
628
- interface PublishPlan {
629
- operationId: string;
630
- remove: Array<{
631
- id: string;
632
- attribution: Attribution;
633
- fingerprint?: string;
634
- }>;
635
- finalize: Array<{
636
- id: string;
637
- attribution: Attribution;
638
- reservation: string;
639
- enabled: boolean;
640
- disabledReason?: string;
641
- }>;
642
- order: string[];
643
- }
644
- interface PublicationReceipt {
645
- operationId: string;
646
- planDigest: string;
647
- phase: 'committed' | 'cleaned';
648
- removed: Array<{
649
- id: string;
650
- credentialEpoch: number;
651
- }>;
652
- finalized: Array<{
653
- id: string;
654
- credentialEpoch: number;
655
- reservation: string;
656
- enabled: boolean;
657
- }>;
658
- }
659
- interface PublishOptions {
660
- protect?: ProtectFn;
661
- extraLocks?: PoolLockSpec[];
662
- providerLock?: PoolLockSpec;
663
- onFailure?: FailureHook;
664
- }
665
- interface PublishResult {
666
- outcome: 'published' | 'cleaned' | 'already-cleaned';
667
- receipt: PublicationReceipt;
668
- }
669
- //#endregion
670
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/store/pull.d.ts
245
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.27.1+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/store/pull.d.ts
671
246
  /** What a pull is issued with: the credential and its attribution tuple. */
672
247
  interface PullRequest {
673
248
  id: string;
@@ -678,114 +253,7 @@ interface PullRequest {
678
253
  }
679
254
  type PullHook = (request: PullRequest) => Promise<unknown>;
680
255
  //#endregion
681
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/store/refresh.d.ts
682
- /** What the injected provider refresh function returns. */
683
- interface ProviderRefreshResult {
684
- access: string;
685
- refresh: string;
686
- expires: number;
687
- expiresIn?: number;
688
- /** The account's wire identity, when the provider reports one. */
689
- identity?: string;
690
- /**
691
- * Provider state that changes with the new token (needs the store's
692
- * provider-state codec). It is merged with the row's value on disk
693
- * (`ProviderStateCodec.merge`) and written in the same state write as the
694
- * rotated credential, under the same commit fence. Left out, the row keeps
695
- * its value.
696
- */
697
- providerState?: unknown;
698
- }
699
- type ProviderRefresh = (credential: OAuthCredential & {
700
- lastRefreshedAt?: number;
701
- }, row: PoolRow) => Promise<ProviderRefreshResult>;
702
- interface RefreshOptions {
703
- /** The one provider-wide lock serialising every provider call. */
704
- providerLock?: PoolLockSpec;
705
- /** Taken after the provider-wide lock in this order, released in reverse. */
706
- extraLocks?: readonly PoolLockSpec[];
707
- /**
708
- * Awaited once an ordinary rotation is persisted and the store locks released.
709
- * Never called for `identity-contradicted`: its credential must not propagate
710
- * as the row's recorded account.
711
- */
712
- onPersisted?: (rowId: string, credential: StoredCredential) => void | Promise<void>;
713
- onFailure?: FailureHook;
714
- /**
715
- * Awaited before any lock is taken, on the locked re-read, and at commit
716
- * time under the store locks; a reason refuses the refresh there, leaving
717
- * the stored credential untouched and discarding any rotated material.
718
- */
719
- refuse?: (row: PoolRow) => string | undefined | Promise<string | undefined>;
720
- }
721
- type RefreshOutcome = {
722
- status: 'rotated';
723
- rowId: string;
724
- credential: StoredCredential;
725
- identity?: string;
726
- } |
727
- /**
728
- * The provider's successor credential is stored bound to expectedIdentity,
729
- * not returnedIdentity. The row stays disabled until the adapter supplies
730
- * an identity-validated replacement credential through replace.
731
- */
732
- {
733
- status: 'identity-contradicted';
734
- rowId: string;
735
- expectedIdentity: string;
736
- returnedIdentity: string;
737
- credential: StoredCredential;
738
- } | {
739
- status: 'refused';
740
- rowId: string;
741
- reason: string;
742
- };
743
- //#endregion
744
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/store/settings.d.ts
745
- /** The plugin's settings: every top-level config key except the pool-owned ones. */
746
- type PoolSettings = Record<string, unknown>;
747
- type SettingsRead = {
748
- status: 'ready';
749
- settings: PoolSettings;
750
- } |
751
- /**
752
- * The config still holds a legacy roster with no pool key. Its settings
753
- * read the same way; `updateSettings` refuses until the pool is initialized.
754
- */
755
- {
756
- status: 'pending-migration';
757
- settings: PoolSettings;
758
- } | {
759
- status: 'error';
760
- file: 'config' | 'state';
761
- reason: string;
762
- };
763
- /**
764
- * Receives a private copy of the current settings and either edits it in
765
- * place (returning nothing) or returns the complete next settings object.
766
- * It runs under the store locks, so it must not call back into the store:
767
- * a store operation called from inside it is refused (`PoolReentryError`).
768
- */
769
- type SettingsMutator = (settings: PoolSettings) => PoolSettings | undefined | Promise<PoolSettings | undefined>;
770
- /**
771
- * Options of `updateSettings`. It names no row, so its failure hook is
772
- * handed only the failure; like `reorder` it takes the extra locks, then the
773
- * store locks, and no row or provider-wide lock.
774
- */
775
- interface UpdateSettingsOptions {
776
- /** Called once, awaited, on every non-success path, before the extra locks release. */
777
- onFailure?: (error: PoolOperationError) => void | Promise<void>;
778
- /** Locks taken, in this order, before the store locks. */
779
- extraLocks?: readonly PoolLockSpec[];
780
- }
781
- type UpdateSettingsResult = {
782
- /** The settings now on disk. */
783
- settings: PoolSettings;
784
- /** `unchanged` when the mutator left the settings as they were; nothing was written. */
785
- outcome: 'updated' | 'unchanged';
786
- };
787
- //#endregion
788
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/store/pool.d.ts
256
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.27.1+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/store/pool.d.ts
789
257
  interface OpenPoolStoreOptions {
790
258
  /** The provider every row of this pool belongs to; keys the provider-wide lock. */
791
259
  provider: string;
@@ -800,11 +268,15 @@ interface OpenPoolStoreOptions {
800
268
  * older reading replaces. Accepted readings appear in read/load
801
269
  * immediately, merged the same way; the returned promise still rejects
802
270
  * current-row refusals before queueing. Await dispose or close at shutdown
803
- * to drain.
271
+ * to attempt a bounded drain; readings still pending at its timeout are
272
+ * discarded. Normal quota commits are at least 30 seconds apart; a full
273
+ * queue commits early so response handling never waits for that interval.
804
274
  */
805
275
  coalesceQuota?: boolean;
806
276
  /** Bounded quota drain on close/dispose, in milliseconds; defaults to 1,000. */
807
277
  quotaDrainTimeoutMs?: number;
278
+ /** Monotonic clock and scheduling seam for detached quota commits. */
279
+ quotaCommitTimer?: QuotaCommitTimer;
808
280
  /**
809
281
  * The codec of the provider state kept beside each row's credential (see
810
282
  * `ProviderStateCodec`). Without it no row shows a provider state, and
@@ -857,174 +329,6 @@ interface OpenPoolStoreOptions {
857
329
  onLockStep?: LockEnvironment['onLockStep'];
858
330
  onRenewalTimer?: LockEnvironment['onRenewalTimer'];
859
331
  }
860
- type PoolLoad = {
861
- status: 'ready';
862
- schemaVersion: number;
863
- rows: PoolRow[];
864
- } | {
865
- status: 'pending-migration';
866
- roster: unknown[];
867
- } | {
868
- status: 'error';
869
- file: 'config' | 'state';
870
- reason: string;
871
- kind?: 'snapshot-contended';
872
- retryable?: true;
873
- };
874
- interface PoolStore {
875
- /** Reads the pool and fires first-reading pulls; never writes a file itself. */
876
- load(): Promise<PoolLoad>;
877
- /** Reads the pool without firing anything. */
878
- read(): Promise<PoolLoad>;
879
- /**
880
- * Turns a pending-migration config into an empty pool (the pool key with no
881
- * row entries) in one locked config write, dropping the named top-level
882
- * keys and keeping the rest. The start of a plugin's migration; a ready
883
- * pool is left alone. Failures carry operation `initialize`.
884
- */
885
- initialize(input?: {
886
- dropKeys?: readonly string[];
887
- }): Promise<{
888
- status: InitializeOutcome;
889
- }>;
890
- /**
891
- * Adds a row, or completes or rotates the row already holding the id or
892
- * the secret. A new row starts at credential epoch 1; since 0.8.0 one
893
- * whose id the pool held before starts one past the highest epoch that id
894
- * held (see `Attribution`), and an id that held `Number.MAX_SAFE_INTEGER`
895
- * refuses (`id-removed`) before writing.
896
- */
897
- add(input: AddInput, options?: AddOptions): Promise<AddResult>;
898
- publishRoster(plan: PublishPlan, options?: PublishOptions): Promise<PublishResult>;
899
- publication(operationId: string): Promise<PublicationReceipt | undefined>;
900
- /**
901
- * Gives a row a new credential and a new credential epoch. Since 0.6.0 the
902
- * row's provider state is whatever `ProviderStateCodec.onReplace` returns;
903
- * without that hook it is `input.providerState`, else cleared.
904
- * Optional `attribution` fences the write on the prior credential under the
905
- * locks, before any write or replacement hook; see `RowWriteOptions`.
906
- */
907
- replace(id: string, credential: PoolCredential, input?: CredentialWriteInput, options?: RowWriteOptions): Promise<{
908
- id: string;
909
- credential: StoredCredential;
910
- credentialEpoch: number;
911
- }>;
912
- /**
913
- * Refreshes the secret a row holds without changing its account or
914
- * endpoint. Since 0.4.1 an API key may leave out `baseURL` and `authHeader`
915
- * to keep the row's, and one that gives another is refused
916
- * (`endpoint-mismatch`) before writing: that is a `replace`.
917
- * Takes the same optional attribution fence as `replace` (`RowWriteOptions`).
918
- */
919
- rotate(id: string, credential: RotateCredential, input?: CredentialWriteInput, options?: RowWriteOptions): Promise<{
920
- id: string;
921
- credential: StoredCredential;
922
- }>;
923
- /**
924
- * Changes a row's provider state without touching its credential (since
925
- * 0.6.0), under the row lock, `extraLocks` and the store locks. Refuses
926
- * (`attribution`) once the row has moved off the credential epoch or
927
- * identity in `fence`, and (`unknown-row`) once it is removed.
928
- */
929
- updateProviderState(id: string, fence: Attribution, mutator: ProviderStateMutator, options?: RowToggleOptions): Promise<UpdateProviderStateResult>;
930
- /**
931
- * Sets `enabled: false` and the entry's `disabledReason`. Takes the row
932
- * lock, then `extraLocks`, then the store locks (the row lock and
933
- * `extraLocks` since 0.2.3). Since 0.7.0 it may be fenced on the
934
- * credential the caller's evidence is about (`attribution`) and carry a
935
- * provider-state change that lands with it (`providerState`); see
936
- * `RowTransitionOptions`.
937
- */
938
- disable(id: string, reason: string, options?: RowTransitionOptions): Promise<RowTransitionResult>;
939
- /**
940
- * Clears `enabled: false` and `disabledReason` (since 0.2.3); refuses with
941
- * `duplicate-identity` when another enabled OAuth row holds the row's
942
- * identity. Locks as `disable`, and takes the same options since 0.7.0.
943
- */
944
- enable(id: string, options?: RowTransitionOptions): Promise<RowTransitionResult>;
945
- /**
946
- * Deletes the roster row, its per-row entry and its state-file credential
947
- * (since 0.2.3). Locks as `disable`; `protect` can refuse the id.
948
- */
949
- remove(id: string, options?: RemoveOptions): Promise<RemoveResult>;
950
- /**
951
- * Sets the roster order (since 0.2.4) in one config write. `ids` must name
952
- * every roster id exactly once; anything else refuses with `invalid-order`
953
- * and writes nothing. Takes `extraLocks`, then the store locks; no row or
954
- * provider-wide lock. Roster rows and their entries are left unchanged.
955
- */
956
- reorder(ids: readonly string[], options?: ReorderOptions): Promise<ReorderResult>;
957
- /**
958
- * The plugin's settings (since 0.2.6): every top-level key of the config
959
- * file except the pool-owned ones (`POOL_OWNED_KEYS`). Never writes.
960
- */
961
- readSettings(): Promise<SettingsRead>;
962
- /**
963
- * One locked write of the plugin's settings (since 0.2.6) beside the pool,
964
- * in the config file. Refuses a result that sets a pool-owned key
965
- * (`invalid-input`). Takes `extraLocks`, then the store locks.
966
- */
967
- updateSettings(mutator: SettingsMutator, options?: UpdateSettingsOptions): Promise<UpdateSettingsResult>;
968
- /**
969
- * Records the identity a lookup found for the row's credential. Since
970
- * 0.3.1 it takes the credential epoch the lookup was issued for, and
971
- * refuses a lookup that completes after the row was replaced
972
- * (`attribution`) or a row recorded for another account
973
- * (`identity-mismatch`).
974
- */
975
- recordIdentity(id: string, identity: string, attribution: Pick<Attribution, 'credentialEpoch'>, options?: RowOperationOptions): Promise<{
976
- id: string;
977
- disabled: string[];
978
- }>;
979
- refresh(id: string, provider: ProviderRefresh, options?: RefreshOptions): Promise<RefreshOutcome>;
980
- recordQuota(id: string, attribution: Attribution, observation: unknown): Promise<void>;
981
- /** Drain opted-in quota publication; subsequent coalesced readings refuse. Idempotent. */
982
- close(): Promise<void>;
983
- /** Same bounded quota drain as close(). Does not wait for provider pull hooks. */
984
- dispose(): Promise<void>;
985
- /** Fires a pull for a row admission refused for want of a reading. */
986
- requestReading(id: string): void;
987
- /** Resolves once every pull fired so far has settled. */
988
- pullsSettled(): Promise<void>;
989
- }
990
- //#endregion
991
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/commands/seam.d.ts
992
- /** Where a dropped field is reported. Names only, never values. */
993
- interface SeamLogger {
994
- warn(message: string, data?: unknown): void;
995
- }
996
- //#endregion
997
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/commands/builtins.d.ts
998
- /**
999
- * What a plugin's login hands back. `ready` adds the account now. `pending`
1000
- * means the user must finish somewhere else (a browser, a device code):
1001
- * `message` tells them how, and the account is added when `completion`
1002
- * settles, with the result sent to the invocation that started it.
1003
- */
1004
- type LoginOutcome = {
1005
- status: 'ready';
1006
- account: AddInput;
1007
- } | {
1008
- status: 'pending';
1009
- message: string;
1010
- /** Resolves with the account to add, or undefined when the user gave up. */
1011
- completion: Promise<AddInput | undefined>;
1012
- } | {
1013
- status: 'cancelled';
1014
- message?: string;
1015
- };
1016
- interface AccountsSectionOptions {
1017
- /** What to show as an account's identity; defaults to its recorded identity. */
1018
- describeIdentity?(row: PoolRow): string | undefined;
1019
- /** The plugin's login; without it the section offers no add action. */
1020
- login?: {
1021
- label?: string;
1022
- knobs?: MenuKnob[];
1023
- run(values: KnobValues, invocation: CommandInvocation): Promise<LoginOutcome>;
1024
- };
1025
- /** Passed to `store.remove`: a reason refuses removing that id. */
1026
- protect?: RemoveOptions['protect'];
1027
- }
1028
332
  //#endregion
1029
333
  //#region ../core/dist/paths.d.ts
1030
334
  /**
@@ -1096,25 +400,8 @@ interface BeginAccountLoginResult {
1096
400
  /** Resolves after the user completes the OAuth flow with a ready-to-ingest account. */
1097
401
  completion: Promise<IngestAccount>;
1098
402
  }
1099
- /**
1100
- * Split-return OAuth flow entry point.
1101
- *
1102
- * Browser flow (default):
1103
- * 1. Start OAuth server, generate PKCE, build authorize URL
1104
- * 2. Return { url, instructions, completion } — url is ready immediately
1105
- * 3. completion resolves after browser callback + token exchange
1106
- *
1107
- * Headless flow:
1108
- * 1. Begin device auth
1109
- * 2. Return { url, instructions, completion }
1110
- * 3. completion polls device endpoint + exchanges for tokens
1111
- *
1112
- * The split return allows the TUI command to show the URL before the
1113
- * (potentially 30-60s) wait, avoiding a deadlock.
1114
- */
1115
- declare function beginAccountLogin(opts: BeginAccountLoginOptions): Promise<BeginAccountLoginResult>;
1116
403
  //#endregion
1117
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/claustrum/watch.d.ts
404
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.27.1+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/claustrum/watch.d.ts
1118
405
  /**
1119
406
  * How a host currently learns about changes, for logs and status displays.
1120
407
  * `watching`: a watch was accepted and is open, so polling is reduced to a
@@ -1168,7 +455,7 @@ interface ScopedWatchSource {
1168
455
  }): ScopedWatchHandle;
1169
456
  }
1170
457
  //#endregion
1171
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/claustrum/insula.d.ts
458
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.27.1+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/claustrum/insula.d.ts
1172
459
  /**
1173
460
  * A held-open `usage.watch` stream. `closed` resolves when insula ends the
1174
461
  * stream (STREAM_END at shutdown, or a reply that ends it) or after `stop()`,
@@ -1192,7 +479,7 @@ interface InsulaUsageTransport {
1192
479
  watchUsage?(onNotice: (body: Uint8Array) => void): InsulaUsageWatch;
1193
480
  }
1194
481
  //#endregion
1195
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/claustrum/custody.d.ts
482
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.27.1+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/claustrum/custody.d.ts
1196
483
  /**
1197
484
  * `watchScoped` is present from claustrum-client 0.12.0. Hosts detect it at
1198
485
  * run time and keep polling without it.
@@ -1214,6 +501,7 @@ type SkippedVaultReason = 'empty credential id' | 'duplicate credential id' | 'b
1214
501
  */
1215
502
  interface SkippedVaultRecord {
1216
503
  readonly credentialId?: string;
504
+ readonly member?: string;
1217
505
  readonly reason: SkippedVaultReason;
1218
506
  }
1219
507
  /**
@@ -1297,7 +585,7 @@ interface KeptReceiptState {
1297
585
  readonly since: number | null;
1298
586
  }
1299
587
  //#endregion
1300
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/claustrum/interlock.d.ts
588
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.27.1+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/claustrum/interlock.d.ts
1301
589
  /**
1302
590
  * The declined-account interlock: the user's "do not use this vault account",
1303
591
  * kept on the consumer side because the vault has no notion of it.
@@ -1316,7 +604,7 @@ interface DeclinedAccount {
1316
604
  readonly accountIdentity?: string;
1317
605
  }
1318
606
  //#endregion
1319
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/claustrum/roster.d.ts
607
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.27.1+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/claustrum/roster.d.ts
1320
608
  /**
1321
609
  * One vault account as the pool sees it. It carries no bearer material: the
1322
610
  * access token is fetched from the vault for every send. Several vault
@@ -1377,7 +665,7 @@ interface ReorderVaultRosterResult {
1377
665
  */
1378
666
  type QuotaReceipt = Pick<ClaustrumScopedAttempt, 'credentialId' | 'accountIdentity' | 'accountIdentitySource' | 'expectedAccountIdentity'>;
1379
667
  //#endregion
1380
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/claustrum/consumer.d.ts
668
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.27.1+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/claustrum/consumer.d.ts
1381
669
  /**
1382
670
  * How a started consumer learns about changes, for logs and status displays.
1383
671
  * `insula` is present when the consumer was given an insula source. Never
@@ -1388,7 +676,7 @@ interface ClaustrumWatchState {
1388
676
  readonly insula?: WatchMode;
1389
677
  }
1390
678
  //#endregion
1391
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/claustrum/enrollment.d.ts
679
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.27.1+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/claustrum/enrollment.d.ts
1392
680
  interface ClaustrumEnrollmentClient {
1393
681
  enrollPropose(input: {
1394
682
  name: string;
@@ -1495,6 +783,11 @@ interface OpenAiVaultOptions {
1495
783
  */
1496
784
  setTimeoutImpl?: typeof setTimeout;
1497
785
  clearTimeoutImpl?: typeof clearTimeout;
786
+ /**
787
+ * Runs at the end of `disconnect`, after the token and state files are
788
+ * deleted, for host-specific cleanup of other enrollment files.
789
+ */
790
+ afterDisconnect?: () => Promise<void>;
1498
791
  }
1499
792
  /** One host's view of its OpenAI accounts in the vault. */
1500
793
  declare class OpenAiVault {
@@ -1668,43 +961,7 @@ declare class OpenAiVault {
1668
961
  close(): void;
1669
962
  }
1670
963
  //#endregion
1671
- //#region ../core/dist/vault-account-menu.d.ts
1672
- type MenuVault = Pick<OpenAiVault, 'authority' | 'refresh' | 'status' | 'identities' | 'routes' | 'pollQuota' | 'snapshot' | 'reorder'>;
1673
- //#endregion
1674
964
  //#region ../core/dist/commands.d.ts
1675
- /**
1676
- * The prompt-cache manager, as the Cache section uses it.
1677
- *
1678
- * Declared structurally rather than imported: the manager itself is tied to
1679
- * one host's live request loader and stays there. Only the members the Cache
1680
- * section and the host's session cleanup reach appear here.
1681
- */
1682
- interface CacheKeepManager {
1683
- status(): {
1684
- running: boolean;
1685
- sustain: boolean;
1686
- window?: {
1687
- startHour: number;
1688
- endHour: number;
1689
- } | undefined;
1690
- tracked: number;
1691
- generatedAt: number;
1692
- ttlMs: number;
1693
- leadMs: number;
1694
- maxIdleWarmMs: number;
1695
- maxSubagentIdleMs: number;
1696
- targets: ReadonlyArray<{
1697
- sessionKey: string;
1698
- accountId?: string;
1699
- cacheExpiresAt: number;
1700
- lastWarmedAt?: number;
1701
- backoffUntil?: number;
1702
- }>;
1703
- };
1704
- start(): void;
1705
- stop(): void;
1706
- remove(sessionKey: string): void;
1707
- }
1708
965
  interface ResetTargetIdentity {
1709
966
  accountKey: string;
1710
967
  label: string;
@@ -1712,81 +969,13 @@ interface ResetTargetIdentity {
1712
969
  chatgptAccountId?: string;
1713
970
  onAuthFailure?: (status: number) => Promise<void>;
1714
971
  }
1715
- interface AccountRules {
1716
- /**
1717
- * The legacy locks a write of row `id` holds besides the store's own: the
1718
- * locks an older openai-auth process holds while it refreshes that row.
1719
- * Taken by remove, enable, disable and replace (and by the replace a
1720
- * re-login becomes).
1721
- */
1722
- rowLocks?(id: string): readonly PoolLockSpec[];
1723
- }
1724
- /** One live process, on an older version, that keeps the accounts from moving to the account pool. */
1725
- interface MigrationBlocker {
1726
- /** `'unknown'` when the directory of process heartbeats could not be read. */
1727
- pid: number | 'unknown';
1728
- version: string;
1729
- }
1730
- type MenuMigrationState = {
1731
- migrated: true;
1732
- } | {
1733
- migrated: false;
1734
- blockers: readonly MigrationBlocker[];
1735
- };
1736
- /** A started OAuth login, as `beginAccountLogin` returns it. */
1737
- interface MenuLoginFlow {
1738
- url: string;
1739
- instructions: string;
1740
- completion: Promise<IngestAccount>;
1741
- }
1742
- interface MenuLoginDeps {
1743
- /** Starts a browser login, or a device-code login when `headless`. */
1744
- begin(options: {
1745
- label?: string;
1746
- headless: boolean;
1747
- }): Promise<MenuLoginFlow>;
1748
- /** The main account's ChatGPT identity; a login of that account is refused. */
1749
- mainIdentity?(): Promise<string | undefined>;
1750
- }
1751
- interface OpenAiMenuOptions {
1752
- store: PoolStore;
1753
- vault?: MenuVault;
1754
- /** Display the normal actions, but refuse all applies before running one. */
1755
- readOnly?: boolean;
1756
- /** A host capability fence, checked before the shared engine runs an action. */
1757
- allowAction?: (request: CommandApplyRequest) => boolean;
1758
- /** Keep unsupported host sections in their normal positions without actions. */
1759
- unavailableSections?: readonly ('cache' | 'diagnostics' | 'reset')[];
1760
- /**
1761
- * The legacy locks the menu's writes that name no single row take (the
1762
- * roster order, settings, a new account).
1763
- */
1764
- extraLocks?: readonly PoolLockSpec[];
1765
- /** The legacy locks a write of one row takes; see `AccountRules`. */
1766
- rowLocks?: AccountRules['rowLocks'];
1767
- /** Whether the install is migrated; absent means it always is (Pi). */
1768
- migration?(): Promise<MenuMigrationState>;
1769
- login?: MenuLoginDeps;
1770
- /** Passed to every removal: refuses row `main` and a pending transfer's row. */
1771
- protect?: RemoveOptions['protect'];
1772
- describeIdentity?: AccountsSectionOptions['describeIdentity'];
1773
- /** The plugin's "check quota now"; without it the store pulls each row. */
1774
- quotaCheck?(ids: readonly string[], invocation: CommandInvocation): Promise<void>;
1775
- cache?: PluginSection;
1776
- diagnostics?: PluginSection;
1777
- extras?: readonly PluginExtraSection[];
1778
- /** Runs after every successful apply (the host re-reads its rows). */
1779
- afterApply?(): unknown;
1780
- logger?: SeamLogger;
1781
- now?: () => number;
1782
- }
1783
972
  //#endregion
1784
973
  //#region src/core/version-fence.d.ts
1785
974
  /** One live process that keeps the fence shut. */
1786
975
  interface VersionFenceBlocker {
1787
976
  /** `'unknown'` when a whole directory could not be read. */
1788
977
  pid: number | 'unknown';
1789
- /** The version its heartbeat names, or `'unknown'`. */
978
+ /** The version its heartbeat or port file names, or `'unknown'`. */
1790
979
  version: string;
1791
980
  /** The file or directory that showed it. */
1792
981
  detail: string;
@@ -2015,6 +1204,35 @@ interface PoolLifecycleDeps {
2015
1204
  paused?: () => boolean | Promise<boolean>;
2016
1205
  }
2017
1206
  //#endregion
1207
+ //#region src/core/runtime-layout.d.ts
1208
+ interface RuntimeLayoutLogger {
1209
+ info(message: string, meta?: Record<string, unknown>): unknown;
1210
+ warn(message: string, meta?: Record<string, unknown>): unknown;
1211
+ }
1212
+ interface RuntimeLayoutOptions {
1213
+ /** This build's version, for the version fence. */
1214
+ version: string;
1215
+ log?: RuntimeLayoutLogger;
1216
+ /** Defaults to `migrationFenceOpen` for `version`, with the layout checks. */
1217
+ fence?: () => Promise<VersionFenceResult>;
1218
+ /**
1219
+ * Test seams, run at one step of the move. A step that throws stands in for
1220
+ * a crash there: nothing after it runs.
1221
+ */
1222
+ steps?: {
1223
+ afterCopy?: () => void | Promise<void>;
1224
+ afterMarker?: () => void | Promise<void>;
1225
+ /**
1226
+ * Runs right before each removal of an old file, of the move's
1227
+ * `layout-moving.json` and of the old vault folder, ahead of the lease
1228
+ * check that guards it.
1229
+ */
1230
+ beforeRemove?: (path: string) => void | Promise<void>;
1231
+ };
1232
+ /** Test seam: how long to wait for the layout lock. */
1233
+ layoutLockWaitMs?: number;
1234
+ }
1235
+ //#endregion
2018
1236
  //#region src/util/canonical-input.d.ts
2019
1237
  interface CanonicalInput {
2020
1238
  texts: string[];
@@ -2046,4 +1264,4 @@ interface CodexRequestRuntime {
2046
1264
  uuid: () => string;
2047
1265
  }
2048
1266
  //#endregion
2049
- export { PoolStore as S, TokenResponse as _, RESPONSES_LITE_MODELS as a, parseJwtClaims as b, CacheKeepManager as c, ResetTargetIdentity as d, OpenAiVault as f, IdTokenClaims as g, BeginAccountLoginResult as h, CodexSessionMetadata as i, MenuMigrationState as l, BeginAccountLoginOptions as m, CODEX_VERSION as n, PoolLifecycleDeps as o, OpenAiVaultOptions as p, CodexRequestRuntime as r, HostSlotAdapter as s, CODEX_USER_AGENT as t, OpenAiMenuOptions as u, beginAccountLogin as v, AccountPaths as x, extractAccountIdFromClaims as y };
1267
+ export { parseJwtClaims as _, RESPONSES_LITE_MODELS as a, HostSlotAdapter as c, OpenAiVaultOptions as d, BeginAccountLoginOptions as f, extractAccountIdFromClaims as g, TokenResponse as h, CodexSessionMetadata as i, ResetTargetIdentity as l, IdTokenClaims as m, CODEX_VERSION as n, RuntimeLayoutOptions as o, BeginAccountLoginResult as p, CodexRequestRuntime as r, PoolLifecycleDeps as s, CODEX_USER_AGENT as t, OpenAiVault as u, AccountPaths as v };