@cortexkit/opencode-openai-auth 1.6.1 → 1.7.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.
- package/dist/bin.js +8 -8
- package/dist/{codex-request-D_In8uaR.d.ts → codex-request-CN4rD2kf.d.ts} +2 -832
- package/dist/{index-z8bptbrk.js → index-0p3cbtwq.js} +2 -2
- package/dist/{index-1qxz4s8a.js → index-2e2kqmsy.js} +2 -2
- package/dist/{index-b0ty9qam.js → index-7zy4vdd3.js} +2 -2
- package/dist/{index-ge60xry3.js → index-apkavdvq.js} +2 -2
- package/dist/{index-rf0ht3gc.js → index-b5459de4.js} +2 -2
- package/dist/{index-8xq099qf.js → index-dr93b3g6.js} +2 -2
- package/dist/{index-jkpg9d1p.js → index-g08eptzm.js} +1 -1
- package/dist/{index-ya9c5e4m.js → index-jaqm1xda.js} +1 -1
- package/dist/{index-79y7w9bz.js → index-p9vnmnzr.js} +1 -1
- package/dist/index-qg2syg0r.js +65 -0
- package/dist/{index-x9nffaye.js → index-r4avvxf0.js} +1 -1
- package/dist/{index-k5anexvs.js → index-se9ykks8.js} +2 -2
- package/dist/{index-7nmdsmpp.js → index-yayz83vv.js} +2 -2
- package/dist/index.d.ts +4 -79
- package/dist/index.js +1 -1
- package/dist/{model-D22uj0OB.d.ts → protocol-BeeDdtpa.d.ts} +24 -66
- package/dist/rpc/port-file.js +1 -1
- package/dist/rpc/protocol.d.ts +1 -1
- package/dist/rpc/protocol.js +1 -1
- package/dist/rpc/rpc-client.d.ts +2 -12
- package/dist/rpc/rpc-client.js +1 -1
- package/dist/rpc/rpc-dir.js +1 -1
- package/dist/rpc-client-DlR9a0_7.d.ts +13 -0
- package/dist/{sidebar-state-Bb9L9oPq.d.ts → sidebar-state-DHsZ9axt.d.ts} +1 -3
- package/dist/sidebar-state.d.ts +2 -2
- package/dist/sidebar-state.js +1 -1
- package/dist/{token-xtq3457d.js → token-511npvw8.js} +1 -1
- package/dist/token-util-jsw1zdc6.js +1 -0
- package/dist/tui-preferences.js +1 -1
- package/dist/tui.d.ts +11 -2
- package/dist/v2/server.d.ts +2 -2
- package/dist/v2/server.js +2 -2
- package/package.json +1 -1
- package/src/tui-compiled/raw/tui/v2.tsx +88 -6
- package/src/tui-compiled/raw/tui.tsx +45 -3
- package/src/tui-compiled/runtime/tui/v2.js +66 -5
- package/src/tui-compiled/runtime/tui.js +32 -3
- package/dist/index-cv6aqcvk.js +0 -65
- package/dist/protocol-CK9guiFy.d.ts +0 -29
- package/dist/token-util-nyvn9866.js +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _t as QuotaMap } from "./sidebar-state-Bb9L9oPq.js";
|
|
1
|
+
import { gt as QuotaMap } from "./sidebar-state-DHsZ9axt.js";
|
|
3
2
|
import { ClaustrumClient, EnrollmentPollOutcome } from "@cortexkit/claustrum-client";
|
|
4
3
|
import "@cortexkit/private-files";
|
|
5
4
|
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/store/schema.d.ts
|
|
@@ -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,110 +76,6 @@ 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
80
|
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+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. */
|
|
@@ -342,331 +228,11 @@ 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
232
|
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+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;
|
|
401
|
-
};
|
|
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
|
-
}
|
|
590
|
-
//#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
236
|
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/store/pull.d.ts
|
|
671
237
|
/** What a pull is issued with: the credential and its attribution tuple. */
|
|
672
238
|
interface PullRequest {
|
|
@@ -678,113 +244,6 @@ interface PullRequest {
|
|
|
678
244
|
}
|
|
679
245
|
type PullHook = (request: PullRequest) => Promise<unknown>;
|
|
680
246
|
//#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
247
|
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/store/pool.d.ts
|
|
789
248
|
interface OpenPoolStoreOptions {
|
|
790
249
|
/** The provider every row of this pool belongs to; keys the provider-wide lock. */
|
|
@@ -857,174 +316,6 @@ interface OpenPoolStoreOptions {
|
|
|
857
316
|
onLockStep?: LockEnvironment['onLockStep'];
|
|
858
317
|
onRenewalTimer?: LockEnvironment['onRenewalTimer'];
|
|
859
318
|
}
|
|
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
319
|
//#endregion
|
|
1029
320
|
//#region ../core/dist/paths.d.ts
|
|
1030
321
|
/**
|
|
@@ -1096,23 +387,6 @@ interface BeginAccountLoginResult {
|
|
|
1096
387
|
/** Resolves after the user completes the OAuth flow with a ready-to-ingest account. */
|
|
1097
388
|
completion: Promise<IngestAccount>;
|
|
1098
389
|
}
|
|
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
390
|
//#endregion
|
|
1117
391
|
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.26.0+edd79cef82a5b402/node_modules/@cortexkit/common-auth/dist/claustrum/watch.d.ts
|
|
1118
392
|
/**
|
|
@@ -1668,43 +942,7 @@ declare class OpenAiVault {
|
|
|
1668
942
|
close(): void;
|
|
1669
943
|
}
|
|
1670
944
|
//#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
945
|
//#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
946
|
interface ResetTargetIdentity {
|
|
1709
947
|
accountKey: string;
|
|
1710
948
|
label: string;
|
|
@@ -1712,74 +950,6 @@ interface ResetTargetIdentity {
|
|
|
1712
950
|
chatgptAccountId?: string;
|
|
1713
951
|
onAuthFailure?: (status: number) => Promise<void>;
|
|
1714
952
|
}
|
|
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
953
|
//#endregion
|
|
1784
954
|
//#region src/core/version-fence.d.ts
|
|
1785
955
|
/** One live process that keeps the fence shut. */
|
|
@@ -2046,4 +1216,4 @@ interface CodexRequestRuntime {
|
|
|
2046
1216
|
uuid: () => string;
|
|
2047
1217
|
}
|
|
2048
1218
|
//#endregion
|
|
2049
|
-
export {
|
|
1219
|
+
export { AccountPaths as _, RESPONSES_LITE_MODELS as a, ResetTargetIdentity as c, BeginAccountLoginOptions as d, BeginAccountLoginResult as f, parseJwtClaims as g, extractAccountIdFromClaims as h, CodexSessionMetadata as i, OpenAiVault as l, TokenResponse as m, CODEX_VERSION as n, PoolLifecycleDeps as o, IdTokenClaims as p, CodexRequestRuntime as r, HostSlotAdapter as s, CODEX_USER_AGENT as t, OpenAiVaultOptions as u };
|