@cortexkit/pi-openai-auth 1.0.4 → 1.1.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 +30 -28
- package/dist/index.js +27 -27
- package/package.json +2 -2
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.
|
|
5
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/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.
|
|
16
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/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.
|
|
205
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/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.
|
|
252
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/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.
|
|
257
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/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;
|
|
@@ -269,7 +269,7 @@ interface RefreshFileLock {
|
|
|
269
269
|
whenLost(): Promise<LockLoss>;
|
|
270
270
|
hasLost(): boolean;
|
|
271
271
|
}
|
|
272
|
-
|
|
272
|
+
type RefreshFileLockOptions = {
|
|
273
273
|
name: string;
|
|
274
274
|
ttlMs: number;
|
|
275
275
|
/**
|
|
@@ -278,7 +278,6 @@ declare function acquireRefreshFileLock(options: {
|
|
|
278
278
|
* be one host's path.
|
|
279
279
|
*/
|
|
280
280
|
path: string;
|
|
281
|
-
now?: () => number;
|
|
282
281
|
renew?: boolean;
|
|
283
282
|
renewIntervalMs?: number;
|
|
284
283
|
/** Notifies a live-owner refusal without awaiting; observer failures are ignored. */
|
|
@@ -286,9 +285,11 @@ declare function acquireRefreshFileLock(options: {
|
|
|
286
285
|
/** Synchronous, never awaited; throws and returned promise/thenable rejections are isolated. */
|
|
287
286
|
onRenewalTimer?: (event: 'scheduled' | 'cancelled') => void;
|
|
288
287
|
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>;
|
|
289
|
-
}
|
|
288
|
+
};
|
|
289
|
+
/** Filesystem leases share wall time across all callers and processes. */
|
|
290
|
+
declare function acquireRefreshFileLock(options: RefreshFileLockOptions): Promise<RefreshFileLock | null>;
|
|
290
291
|
//#endregion
|
|
291
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
292
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/refresh-lock.d.ts
|
|
292
293
|
type LockStep = NonNullable<Parameters<typeof acquireRefreshFileLock>[0]['onStep']> extends ((step: infer S) => unknown) ? S : never;
|
|
293
294
|
/** Tuning shared by every lock the store takes; each field is overridable. */
|
|
294
295
|
interface PoolLockOptions {
|
|
@@ -309,7 +310,6 @@ type LockEvent = {
|
|
|
309
310
|
path: string;
|
|
310
311
|
};
|
|
311
312
|
interface LockEnvironment {
|
|
312
|
-
now: () => number;
|
|
313
313
|
onLockEvent?: (event: LockEvent) => void;
|
|
314
314
|
onLockStep?: (lock: {
|
|
315
315
|
name: string;
|
|
@@ -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.
|
|
324
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/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.
|
|
359
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/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.
|
|
363
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/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.
|
|
386
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/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.
|
|
602
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/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.
|
|
638
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/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.
|
|
681
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/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.
|
|
692
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/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.
|
|
755
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/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.
|
|
799
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/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;
|
|
@@ -829,7 +829,7 @@ interface OpenPoolStoreOptions {
|
|
|
829
829
|
requireCredentialStamps?: boolean;
|
|
830
830
|
/** Require an exact secret fingerprint for every roster-publication removal. */
|
|
831
831
|
requireRemovedFingerprint?: boolean;
|
|
832
|
-
/**
|
|
832
|
+
/** Logical clock for refresh stamps and `addedAt`; filesystem leases always use wall time. */
|
|
833
833
|
now?: () => number;
|
|
834
834
|
/**
|
|
835
835
|
* Ordered store-lock list held across every read-modify-write. Defaults to
|
|
@@ -1202,14 +1202,14 @@ interface RefreshAllQuotaResult {
|
|
|
1202
1202
|
permanent?: boolean;
|
|
1203
1203
|
}
|
|
1204
1204
|
//#endregion
|
|
1205
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
1205
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/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.
|
|
1212
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/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
|
};
|
|
@@ -1275,7 +1275,7 @@ interface ClaustrumScopedAttempt {
|
|
|
1275
1275
|
readonly expiresAtMs: number | null;
|
|
1276
1276
|
}
|
|
1277
1277
|
//#endregion
|
|
1278
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
1278
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/quota/map.d.ts
|
|
1279
1279
|
interface QuotaReadingEntry {
|
|
1280
1280
|
scope: string;
|
|
1281
1281
|
label: string;
|
|
@@ -1330,7 +1330,7 @@ interface QuotaMap {
|
|
|
1330
1330
|
counters?: Record<string, QuotaCounter>;
|
|
1331
1331
|
}
|
|
1332
1332
|
//#endregion
|
|
1333
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
1333
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/quota/merge.d.ts
|
|
1334
1334
|
interface ObservedReading {
|
|
1335
1335
|
/** Defaults to `all`. */
|
|
1336
1336
|
scope?: string;
|
|
@@ -1368,7 +1368,7 @@ interface QuotaObservation {
|
|
|
1368
1368
|
counters?: Record<string, QuotaCounter>;
|
|
1369
1369
|
}
|
|
1370
1370
|
//#endregion
|
|
1371
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
1371
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/claustrum/interlock.d.ts
|
|
1372
1372
|
/**
|
|
1373
1373
|
* The declined-account interlock: the user's "do not use this vault account",
|
|
1374
1374
|
* kept on the consumer side because the vault has no notion of it.
|
|
@@ -1387,7 +1387,7 @@ interface DeclinedAccount {
|
|
|
1387
1387
|
readonly accountIdentity?: string;
|
|
1388
1388
|
}
|
|
1389
1389
|
//#endregion
|
|
1390
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
1390
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/claustrum/roster.d.ts
|
|
1391
1391
|
/**
|
|
1392
1392
|
* One vault account as the pool sees it. It carries no bearer material: the
|
|
1393
1393
|
* access token is fetched from the vault for every send. Several vault
|
|
@@ -1442,7 +1442,7 @@ interface VaultRosterFile {
|
|
|
1442
1442
|
*/
|
|
1443
1443
|
type QuotaReceipt = Pick<ClaustrumScopedAttempt, 'credentialId' | 'accountIdentity' | 'accountIdentitySource' | 'expectedAccountIdentity'>;
|
|
1444
1444
|
//#endregion
|
|
1445
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
1445
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.18.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/claustrum/enrollment.d.ts
|
|
1446
1446
|
interface ClaustrumEnrollmentClient {
|
|
1447
1447
|
enrollPropose(input: {
|
|
1448
1448
|
name: string;
|
|
@@ -1502,6 +1502,8 @@ interface VaultPaths extends ClaustrumEnrollmentPaths {
|
|
|
1502
1502
|
/** One vault account as routing sees it. */
|
|
1503
1503
|
interface VaultRoute {
|
|
1504
1504
|
id: string;
|
|
1505
|
+
/** The vault credential name, distinct from its stable routing id. */
|
|
1506
|
+
credentialId?: string;
|
|
1505
1507
|
kind: 'oauth' | 'api-key';
|
|
1506
1508
|
/** The ChatGPT account it signs in as, when the vault knows it. */
|
|
1507
1509
|
identity?: string;
|