@cortexkit/pi-openai-auth 1.1.0 → 1.2.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/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
2
  import "@cortexkit/private-files";
3
3
  import { ClaustrumClient, EnrollmentPollOutcome } from "@cortexkit/claustrum-client";
4
4
  import { Api, AssistantMessageEventStream, Context, Model, SimpleStreamOptions } from "@earendil-works/pi-ai";
5
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/pi-slot/slot.d.ts
5
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/pi-slot/slot.d.ts
6
6
  interface PiSlotInspection {
7
7
  slot: 'original' | 'placeholder' | 'foreign' | 'empty';
8
8
  stash: 'valid' | 'missing';
@@ -13,7 +13,7 @@ interface PiSlot {
13
13
  exitVault(): Promise<'restored' | 'conflict' | 'nothing-to-do'>;
14
14
  }
15
15
  //#endregion
16
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/schema.d.ts
16
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/store/schema.d.ts
17
17
  type OAuthCredential = {
18
18
  type: 'oauth';
19
19
  access?: string;
@@ -202,7 +202,7 @@ interface PoolRow {
202
202
  unbound?: true;
203
203
  }
204
204
  //#endregion
205
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/errors.d.ts
205
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/store/errors.d.ts
206
206
  /** Every library operation that can fail, as named in the failure value. */
207
207
  type PoolOperation = 'initialize' | 'add' | 'replace' | 'rotate' | 'disable' | 'enable' | 'remove' | 'reorder' | 'updateSettings' | 'recordIdentity' | 'updateProviderState' | 'refresh' | 'pull' | 'publishRoster';
208
208
  /**
@@ -249,12 +249,12 @@ declare class PoolOperationError extends Error {
249
249
  });
250
250
  }
251
251
  //#endregion
252
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/hooks.d.ts
252
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/store/hooks.d.ts
253
253
  interface PoolLogger {
254
254
  warn(message: string, data?: unknown): void;
255
255
  }
256
256
  //#endregion
257
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/fs/refresh-file-lock.d.ts
257
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/fs/refresh-file-lock.d.ts
258
258
  interface LockLoss {
259
259
  readonly reason: 'taken-over' | 'expired' | 'unreadable' | 'renewal-failed' | 'marker-lost';
260
260
  readonly expectedOwnerId: string;
@@ -289,7 +289,7 @@ type RefreshFileLockOptions = {
289
289
  /** Filesystem leases share wall time across all callers and processes. */
290
290
  declare function acquireRefreshFileLock(options: RefreshFileLockOptions): Promise<RefreshFileLock | null>;
291
291
  //#endregion
292
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/refresh-lock.d.ts
292
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/store/refresh-lock.d.ts
293
293
  type LockStep = NonNullable<Parameters<typeof acquireRefreshFileLock>[0]['onStep']> extends ((step: infer S) => unknown) ? S : never;
294
294
  /** Tuning shared by every lock the store takes; each field is overridable. */
295
295
  interface PoolLockOptions {
@@ -321,7 +321,7 @@ interface LockEnvironment {
321
321
  }, event: 'scheduled' | 'cancelled') => void;
322
322
  }
323
323
  //#endregion
324
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/mutate.d.ts
324
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/store/mutate.d.ts
325
325
  /** Named points on the write path, for crash and ownership injection. */
326
326
  type WriteStep = 'before-config-write' | 'after-config-write' | 'before-state-write' | 'after-state-write';
327
327
  /** Awaitable pause points on the pull and refresh paths. */
@@ -356,11 +356,11 @@ interface StoreContext {
356
356
  /** What `initializePool` did. */
357
357
  type InitializeOutcome = 'initialized' | 'already-ready';
358
358
  //#endregion
359
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/runtime.d.ts
359
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/store/runtime.d.ts
360
360
  /** Where a pull was fired from; `load` fires at most once per process per row. */
361
361
  type PullReason = 'load' | 'add' | 'replace' | 'admission';
362
362
  //#endregion
363
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/attribution.d.ts
363
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/store/attribution.d.ts
364
364
  /**
365
365
  * What a pull or refresh captured about its row (named by id alongside) when
366
366
  * it was issued. A result applies only while the row with that id still has
@@ -383,7 +383,7 @@ interface Attribution {
383
383
  identity?: string;
384
384
  }
385
385
  //#endregion
386
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/rows.d.ts
386
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/store/rows.d.ts
387
387
  type FailureHook = (rowId: string, error: PoolOperationError) => void | Promise<void>;
388
388
  interface RowOperationOptions {
389
389
  /** Called once, awaited, on every non-success path, before locks release. */
@@ -599,7 +599,7 @@ interface RowTransitionResult {
599
599
  providerState?: unknown;
600
600
  }
601
601
  //#endregion
602
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/provider-state.d.ts
602
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/store/provider-state.d.ts
603
603
  /**
604
604
  * Receives a private copy of the row's provider state (undefined when the row
605
605
  * shows none) and the row as loaded under the locks, and returns the next
@@ -635,7 +635,7 @@ declare const DECLINE_TRANSITION: unique symbol;
635
635
  */
636
636
  type RowTransitionMutator = (current: unknown | undefined, row: PoolRow) => unknown | typeof DECLINE_TRANSITION | Promise<unknown | typeof DECLINE_TRANSITION>;
637
637
  //#endregion
638
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/publication.d.ts
638
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/store/publication.d.ts
639
639
  interface PublishPlan {
640
640
  operationId: string;
641
641
  remove: Array<{
@@ -678,7 +678,7 @@ interface PublishResult {
678
678
  receipt: PublicationReceipt;
679
679
  }
680
680
  //#endregion
681
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/pull.d.ts
681
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/store/pull.d.ts
682
682
  /** What a pull is issued with: the credential and its attribution tuple. */
683
683
  interface PullRequest {
684
684
  id: string;
@@ -689,7 +689,7 @@ interface PullRequest {
689
689
  }
690
690
  type PullHook = (request: PullRequest) => Promise<unknown>;
691
691
  //#endregion
692
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/refresh.d.ts
692
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/store/refresh.d.ts
693
693
  /** What the injected provider refresh function returns. */
694
694
  interface ProviderRefreshResult {
695
695
  access: string;
@@ -752,7 +752,7 @@ type RefreshOutcome = {
752
752
  reason: string;
753
753
  };
754
754
  //#endregion
755
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/settings.d.ts
755
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/store/settings.d.ts
756
756
  /** The plugin's settings: every top-level config key except the pool-owned ones. */
757
757
  type PoolSettings = Record<string, unknown>;
758
758
  type SettingsRead = {
@@ -796,7 +796,7 @@ type UpdateSettingsResult = {
796
796
  outcome: 'updated' | 'unchanged';
797
797
  };
798
798
  //#endregion
799
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/pool.d.ts
799
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/store/pool.d.ts
800
800
  interface OpenPoolStoreOptions {
801
801
  /** The provider every row of this pool belongs to; keys the provider-wide lock. */
802
802
  provider: string;
@@ -1202,14 +1202,14 @@ interface RefreshAllQuotaResult {
1202
1202
  permanent?: boolean;
1203
1203
  }
1204
1204
  //#endregion
1205
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/claustrum/insula.d.ts
1205
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/claustrum/insula.d.ts
1206
1206
  /** Optional transport for custom scoped clients; getUsage must not retry refusals. */
1207
1207
  interface InsulaUsageTransport {
1208
1208
  connectionFile: string;
1209
1209
  getUsage(): Promise<unknown>;
1210
1210
  }
1211
1211
  //#endregion
1212
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/claustrum/custody.d.ts
1212
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/claustrum/custody.d.ts
1213
1213
  type ClaustrumScopedClient = Pick<ClaustrumClient, 'listScoped' | 'getScoped' | 'reportAuthFailureScoped' | 'close'> & {
1214
1214
  insula?: InsulaUsageTransport;
1215
1215
  };
@@ -1229,6 +1229,30 @@ interface SkippedVaultRecord {
1229
1229
  readonly credentialId?: string;
1230
1230
  readonly reason: SkippedVaultReason;
1231
1231
  }
1232
+ /**
1233
+ * One grant this consumer's enrollment holds, as the vault's list reply names
1234
+ * it: for example `{ selectorKind: 'category', selector: 'openai-native',
1235
+ * operation: 'read' }`. `selectorKind` is `exact` (the selector is a credential
1236
+ * id) or `category` (a bare category name); both open strings.
1237
+ */
1238
+ interface VaultGrantTuple {
1239
+ readonly selectorKind: string;
1240
+ readonly selector: string;
1241
+ readonly operation: string;
1242
+ }
1243
+ /**
1244
+ * What this consumer is granted, independent of what those grants currently
1245
+ * reach. It is what tells two empty listings apart: no rows with `grants === 0`
1246
+ * means no grant at all (the fix is `ck auth grant`), while no rows with
1247
+ * `grants > 0` means a grant that reaches no credential, usually logins that
1248
+ * lack the category (`ck auth reclassify --from-registry`); `tuples` names the
1249
+ * selector that matched nothing. Never written to the roster file.
1250
+ */
1251
+ interface VaultGrantReach {
1252
+ /** How many grants the consumer holds, deposit grants excluded. */
1253
+ readonly grants: number;
1254
+ readonly tuples: readonly VaultGrantTuple[];
1255
+ }
1232
1256
  /**
1233
1257
  * Where a receipt's `accountIdentity` came from: the vault asserted it in the
1234
1258
  * served reply, the plugin's `parseIdentity` read it from the served token, or
@@ -1275,7 +1299,7 @@ interface ClaustrumScopedAttempt {
1275
1299
  readonly expiresAtMs: number | null;
1276
1300
  }
1277
1301
  //#endregion
1278
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/quota/map.d.ts
1302
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/quota/map.d.ts
1279
1303
  interface QuotaReadingEntry {
1280
1304
  scope: string;
1281
1305
  label: string;
@@ -1330,7 +1354,7 @@ interface QuotaMap {
1330
1354
  counters?: Record<string, QuotaCounter>;
1331
1355
  }
1332
1356
  //#endregion
1333
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/quota/merge.d.ts
1357
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/quota/merge.d.ts
1334
1358
  interface ObservedReading {
1335
1359
  /** Defaults to `all`. */
1336
1360
  scope?: string;
@@ -1368,7 +1392,7 @@ interface QuotaObservation {
1368
1392
  counters?: Record<string, QuotaCounter>;
1369
1393
  }
1370
1394
  //#endregion
1371
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/claustrum/interlock.d.ts
1395
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/claustrum/interlock.d.ts
1372
1396
  /**
1373
1397
  * The declined-account interlock: the user's "do not use this vault account",
1374
1398
  * kept on the consumer side because the vault has no notion of it.
@@ -1387,7 +1411,7 @@ interface DeclinedAccount {
1387
1411
  readonly accountIdentity?: string;
1388
1412
  }
1389
1413
  //#endregion
1390
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/claustrum/roster.d.ts
1414
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/claustrum/roster.d.ts
1391
1415
  /**
1392
1416
  * One vault account as the pool sees it. It carries no bearer material: the
1393
1417
  * access token is fetched from the vault for every send. Several vault
@@ -1442,7 +1466,7 @@ interface VaultRosterFile {
1442
1466
  */
1443
1467
  type QuotaReceipt = Pick<ClaustrumScopedAttempt, 'credentialId' | 'accountIdentity' | 'accountIdentitySource' | 'expectedAccountIdentity'>;
1444
1468
  //#endregion
1445
- //#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/claustrum/enrollment.d.ts
1469
+ //#region ../../node_modules/.bun/@cortexkit+common-auth@0.19.0+eac60b769bf9196b/node_modules/@cortexkit/common-auth/dist/claustrum/enrollment.d.ts
1446
1470
  interface ClaustrumEnrollmentClient {
1447
1471
  enrollPropose(input: {
1448
1472
  name: string;
@@ -1588,6 +1612,12 @@ declare class OpenAiVault {
1588
1612
  */
1589
1613
  refresh(): Promise<VaultRosterFile | undefined>;
1590
1614
  snapshot(): VaultRosterFile | undefined;
1615
+ /**
1616
+ * What the vault says this host is granted, from the latest list, without
1617
+ * any I/O. Undefined is unknown (a vault that does not report grants, or
1618
+ * nothing listed yet), never zero grants.
1619
+ */
1620
+ grantReach(): VaultGrantReach | undefined;
1591
1621
  /** Whether the vault serves this host any account (whatever its state). */
1592
1622
  serves(): boolean;
1593
1623
  /**