@cortexkit/opencode-openai-auth 1.0.3 → 1.0.4
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/README.md +12 -60
- package/dist/bin.js +13 -0
- package/dist/index-2hch7e8n.js +8 -0
- package/dist/{index-766sfrh5.js → index-45qgkb0m.js} +1 -1
- package/dist/index-5dg931q0.js +65 -0
- package/dist/index-99esnzg0.js +157 -0
- package/dist/index-9reyazwh.js +2 -0
- package/dist/index-bgq9d21h.js +2 -0
- package/dist/index-dryydk6b.js +2 -0
- package/dist/index-egrty6tz.js +12 -0
- package/dist/index-envpbt0k.js +3 -0
- package/dist/index-jye6vccc.js +2 -0
- package/dist/index-k4eacw7x.js +2 -0
- package/dist/{index-hy9030jh.js → index-yeyp8t0k.js} +1 -1
- package/dist/index-yf6arn5w.js +2 -0
- package/dist/index.d.ts +2 -56
- package/dist/index.js +1 -1
- package/dist/map-CCbSZIhT.d.ts +56 -0
- package/dist/{pool-lifecycle-YLz2B8A5.d.ts → pool-lifecycle-DqKq8Eej.d.ts} +99 -789
- package/dist/{port-file-Do3lQIEk.d.ts → port-file-CZ9MIdy2.d.ts} +1 -1
- package/dist/{protocol-BOBdkqqm.d.ts → protocol-CSIDDBDf.d.ts} +1 -1
- package/dist/rpc/port-file.d.ts +1 -1
- 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 +3 -3
- package/dist/rpc/rpc-client.js +1 -1
- package/dist/rpc/rpc-dir.js +1 -1
- package/dist/{sidebar-state-D6cUKgkm.d.ts → sidebar-state-BCxFpH68.d.ts} +5 -3
- package/dist/sidebar-state.d.ts +1 -1
- package/dist/sidebar-state.js +1 -1
- package/dist/token-util-gmn5yaqc.js +1 -0
- package/dist/{token-ypk61xj0.js → token-vykm9bxh.js} +1 -1
- package/dist/tui-preferences.d.ts +2 -1
- package/dist/tui-preferences.js +3 -3
- package/dist/tui.d.ts +2 -2
- package/dist/v2/server.d.ts +1 -1
- package/dist/v2/server.js +3 -4
- package/package.json +13 -8
- package/src/tui-compiled/raw/logger.js +10 -2
- package/src/tui-compiled/raw/shared/053cc17b5419261e-codec.js +2 -1
- package/src/tui-compiled/raw/shared/0766d78c6f481f18-watcher.js +26 -10
- package/src/tui-compiled/raw/shared/375d9cca2def037d-private-files.js +302 -0
- package/src/tui-compiled/raw/shared/39c3cb05738fcf6d-projection.js +3 -1
- package/src/tui-compiled/raw/shared/43fc9e6b994519c7-refresh-lock.js +5 -0
- package/src/tui-compiled/raw/shared/458b934e92490331-mutate.js +2 -2
- package/src/tui-compiled/raw/shared/4825e03209d6ae3e-with-lock.js +4 -0
- package/src/tui-compiled/raw/shared/4f36d333d081d040-merge.js +21 -5
- package/src/tui-compiled/raw/shared/7211cfec06a298bc-atomic-write.js +21 -0
- package/src/tui-compiled/raw/shared/905bffc0220f43d0-map.js +36 -1
- package/src/tui-compiled/raw/shared/a09b6a533c11858f-tui-preferences.js +6 -4
- package/src/tui-compiled/raw/shared/c14988621dc60a75-port-file.js +30 -8
- package/src/tui-compiled/raw/shared/c64d7afbc14ca125-sidebar-file.js +17 -8
- package/src/tui-compiled/raw/shared/c852a15cfe489d12-pool.js +3 -0
- package/src/tui-compiled/raw/shared/cd94316a888b0a8e-schema.js +3 -2
- package/src/tui-compiled/raw/shared/d5a8f1061ee2f114-index.js +1 -1
- package/src/tui-compiled/raw/shared/d7dcba96fea1685c-engine.js +126 -11
- package/src/tui-compiled/raw/shared/e8cd4929507508d8-refresh-file-lock.js +254 -37
- package/src/tui-compiled/raw/shared/ec971142548df90e-index.js +1 -0
- package/src/tui-compiled/raw/shared/fbcdcd0f925e74c0-rpc-client.js +15 -1
- package/src/tui-compiled/runtime/logger.js +10 -2
- package/src/tui-compiled/runtime/shared/053cc17b5419261e-codec.js +2 -1
- package/src/tui-compiled/runtime/shared/0766d78c6f481f18-watcher.js +26 -10
- package/src/tui-compiled/runtime/shared/375d9cca2def037d-private-files.js +302 -0
- package/src/tui-compiled/runtime/shared/39c3cb05738fcf6d-projection.js +3 -1
- package/src/tui-compiled/runtime/shared/43fc9e6b994519c7-refresh-lock.js +5 -0
- package/src/tui-compiled/runtime/shared/458b934e92490331-mutate.js +2 -2
- package/src/tui-compiled/runtime/shared/4825e03209d6ae3e-with-lock.js +4 -0
- package/src/tui-compiled/runtime/shared/4f36d333d081d040-merge.js +21 -5
- package/src/tui-compiled/runtime/shared/7211cfec06a298bc-atomic-write.js +21 -0
- package/src/tui-compiled/runtime/shared/905bffc0220f43d0-map.js +36 -1
- package/src/tui-compiled/runtime/shared/a09b6a533c11858f-tui-preferences.js +6 -4
- package/src/tui-compiled/runtime/shared/c14988621dc60a75-port-file.js +30 -8
- package/src/tui-compiled/runtime/shared/c64d7afbc14ca125-sidebar-file.js +17 -8
- package/src/tui-compiled/runtime/shared/c852a15cfe489d12-pool.js +3 -0
- package/src/tui-compiled/runtime/shared/cd94316a888b0a8e-schema.js +3 -2
- package/src/tui-compiled/runtime/shared/d5a8f1061ee2f114-index.js +1 -1
- package/src/tui-compiled/runtime/shared/d7dcba96fea1685c-engine.js +126 -11
- package/src/tui-compiled/runtime/shared/e8cd4929507508d8-refresh-file-lock.js +254 -37
- package/src/tui-compiled/runtime/shared/ec971142548df90e-index.js +1 -0
- package/src/tui-compiled/runtime/shared/fbcdcd0f925e74c0-rpc-client.js +15 -1
- package/dist/index-8kj7sa1p.js +0 -12
- package/dist/index-b3q3j39x.js +0 -2
- package/dist/index-bmd7x5aq.js +0 -2
- package/dist/index-ff1jy44a.js +0 -222
- package/dist/index-jyr8y8k4.js +0 -7
- package/dist/index-rv08jmd4.js +0 -2
- package/dist/index-sjx8t1nr.js +0 -2
- package/dist/token-util-wdza526f.js +0 -1
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { n as QuotaMap } from "./map-CCbSZIhT.js";
|
|
2
|
+
import { ClaustrumClient, EnrollmentPollOutcome } from "@cortexkit/claustrum-client";
|
|
3
|
+
import "@cortexkit/private-files";
|
|
4
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.17.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/schema.d.ts
|
|
2
5
|
type OAuthCredential = {
|
|
3
6
|
type: 'oauth';
|
|
4
7
|
access?: string;
|
|
@@ -27,6 +30,8 @@ type StoredCredential = (OAuthCredential & {
|
|
|
27
30
|
/** Quota codec supplied by `/quota`: the store never interprets the map itself. */
|
|
28
31
|
interface QuotaCodec {
|
|
29
32
|
validate(value: unknown): boolean;
|
|
33
|
+
/** Normalize persisted quota before validation, when the codec supports it. */
|
|
34
|
+
decode?(value: unknown): unknown;
|
|
30
35
|
merge(stored: unknown | undefined, observation: unknown): unknown;
|
|
31
36
|
}
|
|
32
37
|
/**
|
|
@@ -185,7 +190,7 @@ interface PoolRow {
|
|
|
185
190
|
unbound?: true;
|
|
186
191
|
}
|
|
187
192
|
//#endregion
|
|
188
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
193
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.17.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/errors.d.ts
|
|
189
194
|
/** Every library operation that can fail, as named in the failure value. */
|
|
190
195
|
type PoolOperation = 'initialize' | 'add' | 'replace' | 'rotate' | 'disable' | 'enable' | 'remove' | 'reorder' | 'updateSettings' | 'recordIdentity' | 'updateProviderState' | 'refresh' | 'pull' | 'publishRoster';
|
|
191
196
|
/**
|
|
@@ -232,12 +237,12 @@ declare class PoolOperationError extends Error {
|
|
|
232
237
|
});
|
|
233
238
|
}
|
|
234
239
|
//#endregion
|
|
235
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
240
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.17.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/hooks.d.ts
|
|
236
241
|
interface PoolLogger {
|
|
237
242
|
warn(message: string, data?: unknown): void;
|
|
238
243
|
}
|
|
239
244
|
//#endregion
|
|
240
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
245
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.17.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/fs/refresh-file-lock.d.ts
|
|
241
246
|
interface LockLoss {
|
|
242
247
|
readonly reason: 'taken-over' | 'expired' | 'unreadable' | 'renewal-failed' | 'marker-lost';
|
|
243
248
|
readonly expectedOwnerId: string;
|
|
@@ -268,10 +273,10 @@ declare function acquireRefreshFileLock(options: {
|
|
|
268
273
|
onContended?: () => void;
|
|
269
274
|
/** Synchronous, never awaited; throws and returned promise/thenable rejections are isolated. */
|
|
270
275
|
onRenewalTimer?: (event: 'scheduled' | 'cancelled') => void;
|
|
271
|
-
onStep?: (step: 'stale-marker-stat' | 'stale-marker-claimed' | 'stale-lock-observed' | 'stale-lock-confirmed' | 'stale-lock-removed' | 'stale-lock-recreated' | 'eviction-marker-acquired' | 'renewal-owner-confirmed' | 'renewal-marker-unavailable' | 'renewal-write-fenced' | 'renewal-write-ready' | 'relinquish-read' | 'renewal-finished' | 'release-owner-confirmed') => void | Promise<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>;
|
|
272
277
|
}): Promise<RefreshFileLock | null>;
|
|
273
278
|
//#endregion
|
|
274
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
279
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.17.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/refresh-lock.d.ts
|
|
275
280
|
type LockStep = NonNullable<Parameters<typeof acquireRefreshFileLock>[0]['onStep']> extends ((step: infer S) => unknown) ? S : never;
|
|
276
281
|
/** Tuning shared by every lock the store takes; each field is overridable. */
|
|
277
282
|
interface PoolLockOptions {
|
|
@@ -298,9 +303,13 @@ interface LockEnvironment {
|
|
|
298
303
|
name: string;
|
|
299
304
|
path: string;
|
|
300
305
|
}, step: LockStep) => void | Promise<void>;
|
|
306
|
+
onRenewalTimer?: (lock: {
|
|
307
|
+
name: string;
|
|
308
|
+
path: string;
|
|
309
|
+
}, event: 'scheduled' | 'cancelled') => void;
|
|
301
310
|
}
|
|
302
311
|
//#endregion
|
|
303
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
312
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.17.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/mutate.d.ts
|
|
304
313
|
/** Named points on the write path, for crash and ownership injection. */
|
|
305
314
|
type WriteStep = 'before-config-write' | 'after-config-write' | 'before-state-write' | 'after-state-write';
|
|
306
315
|
/** Awaitable pause points on the pull and refresh paths. */
|
|
@@ -335,11 +344,11 @@ interface StoreContext {
|
|
|
335
344
|
/** What `initializePool` did. */
|
|
336
345
|
type InitializeOutcome = 'initialized' | 'already-ready';
|
|
337
346
|
//#endregion
|
|
338
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
347
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.17.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/runtime.d.ts
|
|
339
348
|
/** Where a pull was fired from; `load` fires at most once per process per row. */
|
|
340
349
|
type PullReason = 'load' | 'add' | 'replace' | 'admission';
|
|
341
350
|
//#endregion
|
|
342
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
351
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.17.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/attribution.d.ts
|
|
343
352
|
/**
|
|
344
353
|
* What a pull or refresh captured about its row (named by id alongside) when
|
|
345
354
|
* it was issued. A result applies only while the row with that id still has
|
|
@@ -362,7 +371,7 @@ interface Attribution {
|
|
|
362
371
|
identity?: string;
|
|
363
372
|
}
|
|
364
373
|
//#endregion
|
|
365
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
374
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.17.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/rows.d.ts
|
|
366
375
|
type FailureHook = (rowId: string, error: PoolOperationError) => void | Promise<void>;
|
|
367
376
|
interface RowOperationOptions {
|
|
368
377
|
/** Called once, awaited, on every non-success path, before locks release. */
|
|
@@ -578,7 +587,7 @@ interface RowTransitionResult {
|
|
|
578
587
|
providerState?: unknown;
|
|
579
588
|
}
|
|
580
589
|
//#endregion
|
|
581
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
590
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.17.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/provider-state.d.ts
|
|
582
591
|
/**
|
|
583
592
|
* Receives a private copy of the row's provider state (undefined when the row
|
|
584
593
|
* shows none) and the row as loaded under the locks, and returns the next
|
|
@@ -614,7 +623,7 @@ declare const DECLINE_TRANSITION: unique symbol;
|
|
|
614
623
|
*/
|
|
615
624
|
type RowTransitionMutator = (current: unknown | undefined, row: PoolRow) => unknown | typeof DECLINE_TRANSITION | Promise<unknown | typeof DECLINE_TRANSITION>;
|
|
616
625
|
//#endregion
|
|
617
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
626
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.17.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/publication.d.ts
|
|
618
627
|
interface PublishPlan {
|
|
619
628
|
operationId: string;
|
|
620
629
|
remove: Array<{
|
|
@@ -657,7 +666,7 @@ interface PublishResult {
|
|
|
657
666
|
receipt: PublicationReceipt;
|
|
658
667
|
}
|
|
659
668
|
//#endregion
|
|
660
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
669
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.17.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/pull.d.ts
|
|
661
670
|
/** What a pull is issued with: the credential and its attribution tuple. */
|
|
662
671
|
interface PullRequest {
|
|
663
672
|
id: string;
|
|
@@ -668,7 +677,7 @@ interface PullRequest {
|
|
|
668
677
|
}
|
|
669
678
|
type PullHook = (request: PullRequest) => Promise<unknown>;
|
|
670
679
|
//#endregion
|
|
671
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
680
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.17.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/refresh.d.ts
|
|
672
681
|
/** What the injected provider refresh function returns. */
|
|
673
682
|
interface ProviderRefreshResult {
|
|
674
683
|
access: string;
|
|
@@ -731,7 +740,7 @@ type RefreshOutcome = {
|
|
|
731
740
|
reason: string;
|
|
732
741
|
};
|
|
733
742
|
//#endregion
|
|
734
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
743
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.17.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/settings.d.ts
|
|
735
744
|
/** The plugin's settings: every top-level config key except the pool-owned ones. */
|
|
736
745
|
type PoolSettings = Record<string, unknown>;
|
|
737
746
|
type SettingsRead = {
|
|
@@ -775,7 +784,7 @@ type UpdateSettingsResult = {
|
|
|
775
784
|
outcome: 'updated' | 'unchanged';
|
|
776
785
|
};
|
|
777
786
|
//#endregion
|
|
778
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
787
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.17.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/store/pool.d.ts
|
|
779
788
|
interface OpenPoolStoreOptions {
|
|
780
789
|
/** The provider every row of this pool belongs to; keys the provider-wide lock. */
|
|
781
790
|
provider: string;
|
|
@@ -832,6 +841,7 @@ interface OpenPoolStoreOptions {
|
|
|
832
841
|
hold?: (point: HoldPoint, rowId: string) => void | Promise<void>;
|
|
833
842
|
onLockEvent?: LockEnvironment['onLockEvent'];
|
|
834
843
|
onLockStep?: LockEnvironment['onLockStep'];
|
|
844
|
+
onRenewalTimer?: LockEnvironment['onRenewalTimer'];
|
|
835
845
|
}
|
|
836
846
|
type PoolLoad = {
|
|
837
847
|
status: 'ready';
|
|
@@ -1048,728 +1058,17 @@ interface BeginAccountLoginResult {
|
|
|
1048
1058
|
*/
|
|
1049
1059
|
declare function beginAccountLogin(opts: BeginAccountLoginOptions): Promise<BeginAccountLoginResult>;
|
|
1050
1060
|
//#endregion
|
|
1051
|
-
//#region ../../node_modules/.bun/@cortexkit+
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
port: number;
|
|
1055
|
-
}
|
|
1056
|
-
interface ConnectionInfo {
|
|
1057
|
-
schema: number;
|
|
1058
|
-
endpoints: Endpoint[];
|
|
1059
|
-
/** Transport key bytes. Serialized on disk as a JSON array of numbers. */
|
|
1060
|
-
key: Uint8Array;
|
|
1061
|
-
/** 16-byte daemon identity. Serialized on disk as a JSON array of numbers. */
|
|
1062
|
-
daemonId: Uint8Array;
|
|
1063
|
-
pid: number;
|
|
1064
|
-
daemonVer: string;
|
|
1065
|
-
}
|
|
1066
|
-
//#endregion
|
|
1067
|
-
//#region ../../node_modules/.bun/@cortexkit+subc-client@0.16.1/node_modules/@cortexkit/subc-client/dist/envelope.d.ts
|
|
1068
|
-
/** Scheduling priority carried in flags bits 1-2. */
|
|
1069
|
-
declare enum Priority {
|
|
1070
|
-
Passive = 0,
|
|
1071
|
-
Interactive = 1,
|
|
1072
|
-
Background = 2
|
|
1073
|
-
}
|
|
1074
|
-
/** Admission behavior carried in flags bits 4-5. */
|
|
1075
|
-
declare enum AdmissionClass {
|
|
1076
|
-
Normal = 0,
|
|
1077
|
-
Expedite = 1,
|
|
1078
|
-
Sheddable = 2
|
|
1079
|
-
}
|
|
1080
|
-
//#endregion
|
|
1081
|
-
//#region ../../node_modules/.bun/@cortexkit+subc-client@0.16.1/node_modules/@cortexkit/subc-client/dist/route-handle.d.ts
|
|
1082
|
-
interface ReverseRequestContext {
|
|
1083
|
-
readonly corr: bigint;
|
|
1084
|
-
readonly method: string;
|
|
1085
|
-
}
|
|
1086
|
-
type ReverseRequestHandler = (body: Uint8Array, ctx: ReverseRequestContext) => Promise<Uint8Array> | Uint8Array;
|
|
1087
|
-
/**
|
|
1088
|
-
* Mutable handler registry prepared before route.open. The client derives
|
|
1089
|
-
* consumer_capabilities from its method families and seals that set when the
|
|
1090
|
-
* route opens; handlers for declared families may still be replaced afterward.
|
|
1091
|
-
*/
|
|
1092
|
-
declare class ReverseRequestRegistry {
|
|
1093
|
-
private readonly handlers;
|
|
1094
|
-
private declaredFamilies;
|
|
1095
|
-
onRequest(methodFamily: string, handler: ReverseRequestHandler): void;
|
|
1096
|
-
/** @internal */
|
|
1097
|
-
capabilities(): string[];
|
|
1098
|
-
/** @internal */
|
|
1099
|
-
handler(methodFamily: string): ReverseRequestHandler | undefined;
|
|
1100
|
-
/** @internal */
|
|
1101
|
-
seal(): void;
|
|
1102
|
-
}
|
|
1103
|
-
/**
|
|
1104
|
-
* Immutable identity for one route binding on one live socket. Only channel and
|
|
1105
|
-
* epoch cross the wire; the connection token remains private to this SDK.
|
|
1106
|
-
*/
|
|
1107
|
-
declare class RouteHandle {
|
|
1108
|
-
readonly channel: number;
|
|
1109
|
-
readonly epoch: number;
|
|
1110
|
-
private constructor();
|
|
1111
|
-
/** Replace the handler for a capability declared when this route opened. */
|
|
1112
|
-
onRequest(methodFamily: string, handler: ReverseRequestHandler): void;
|
|
1113
|
-
private static create;
|
|
1114
|
-
}
|
|
1115
|
-
//#endregion
|
|
1116
|
-
//#region ../../node_modules/.bun/@cortexkit+subc-client@0.16.1/node_modules/@cortexkit/subc-client/dist/client.d.ts
|
|
1117
|
-
interface BindIdentity {
|
|
1118
|
-
project_root: string;
|
|
1119
|
-
harness: string;
|
|
1120
|
-
session: string;
|
|
1121
|
-
}
|
|
1122
|
-
type RouteTarget = {
|
|
1123
|
-
kind: "tool_provider";
|
|
1124
|
-
module_id: string;
|
|
1125
|
-
} | {
|
|
1126
|
-
kind: "management_surface";
|
|
1127
|
-
module_id: string;
|
|
1128
|
-
} | {
|
|
1129
|
-
kind: "internal_service";
|
|
1130
|
-
module_id: string;
|
|
1131
|
-
service_id: string;
|
|
1132
|
-
};
|
|
1133
|
-
type ManagedRouteKind = "management_surface" | "tool_provider";
|
|
1134
|
-
interface ConsumerIdentity {
|
|
1135
|
-
module_id: string;
|
|
1136
|
-
launch_nonce: string;
|
|
1137
|
-
}
|
|
1138
|
-
interface RouteOpenOptions {
|
|
1139
|
-
/** Optional override for the consumer identity; by default the SUBC_MODULE_ID and SUBC_LAUNCH_NONCE environment variables are used when both are non-empty. Set null to send route.open without consumer_identity. */
|
|
1140
|
-
consumerIdentity?: ConsumerIdentity | null;
|
|
1141
|
-
/**
|
|
1142
|
-
* Handlers prepared before route.open. The client derives consumer_capabilities
|
|
1143
|
-
* from this registry; callers cannot declare a capability without a handler.
|
|
1144
|
-
*/
|
|
1145
|
-
reverseRequests?: ReverseRequestRegistry;
|
|
1146
|
-
}
|
|
1147
|
-
interface CatalogCapabilityRequirement {
|
|
1148
|
-
capability: string;
|
|
1149
|
-
need: "required" | "optional";
|
|
1150
|
-
}
|
|
1151
|
-
interface CatalogCapabilities {
|
|
1152
|
-
provides: string[];
|
|
1153
|
-
requires: CatalogCapabilityRequirement[];
|
|
1154
|
-
must_never_reach: string[];
|
|
1155
|
-
}
|
|
1156
|
-
/** A self-signal's anchor relative to the external surface it shapes. */
|
|
1157
|
-
type CatalogSignalAnchor = "fixed_interval" | {
|
|
1158
|
-
event: {
|
|
1159
|
-
event: string;
|
|
1160
|
-
};
|
|
1161
|
-
};
|
|
1162
|
-
/** The source of a self-signal's effective cadence. */
|
|
1163
|
-
type CatalogSignalCadence = {
|
|
1164
|
-
literal: {
|
|
1165
|
-
interval_ms: number;
|
|
1166
|
-
};
|
|
1167
|
-
} | {
|
|
1168
|
-
derived: {
|
|
1169
|
-
source: string;
|
|
1170
|
-
};
|
|
1171
|
-
};
|
|
1172
|
-
/** A self-signal declaration mirrored from a registered module manifest. */
|
|
1173
|
-
interface CatalogSelfSignalDeclaration {
|
|
1174
|
-
name: string;
|
|
1175
|
-
/** Open string for forward-compatible self-signal kinds. */
|
|
1176
|
-
kind: string;
|
|
1177
|
-
effect: "observe" | "mutate";
|
|
1178
|
-
anchored_to: CatalogSignalAnchor;
|
|
1179
|
-
cadence?: CatalogSignalCadence | null;
|
|
1180
|
-
domain?: string | null;
|
|
1181
|
-
note?: string | null;
|
|
1182
|
-
}
|
|
1183
|
-
interface CatalogEntry {
|
|
1184
|
-
module_id: string;
|
|
1185
|
-
roles: unknown[];
|
|
1186
|
-
control_ops: string[];
|
|
1187
|
-
/** Static capability claims mirrored from the registered module manifest. */
|
|
1188
|
-
capabilities?: CatalogCapabilities | null;
|
|
1189
|
-
/** Self-signal declarations mirrored verbatim from the registered manifest. */
|
|
1190
|
-
self_signals?: CatalogSelfSignalDeclaration[] | null;
|
|
1191
|
-
}
|
|
1192
|
-
interface RequestOptions {
|
|
1193
|
-
priority?: Priority;
|
|
1194
|
-
admissionClass?: AdmissionClass;
|
|
1195
|
-
timeoutMs?: number;
|
|
1196
|
-
/**
|
|
1197
|
-
* Set when the request body is opaque bytes rather than JSON. This flag is the
|
|
1198
|
-
* receiver's only signal about the body representation; reply decoding follows
|
|
1199
|
-
* the response frame's flag instead of this request option.
|
|
1200
|
-
*/
|
|
1201
|
-
binary?: boolean;
|
|
1202
|
-
/** Called for each interim PUSH / StreamData frame before the terminal reply. */
|
|
1203
|
-
onProgress?: (body: Uint8Array) => void;
|
|
1204
|
-
/**
|
|
1205
|
-
* Abort the request: when this fires while the request is still in flight, the
|
|
1206
|
-
* client emits a CANCEL frame carrying that request's own corr.
|
|
1207
|
-
*
|
|
1208
|
-
* The signal exists instead of exposing corr because corr lifetime is already
|
|
1209
|
-
* tracked here to settle replies; handing it out would make every caller keep a
|
|
1210
|
-
* second map that can disagree with this one, and would let a caller cancel a
|
|
1211
|
-
* corr it does not own.
|
|
1212
|
-
*
|
|
1213
|
-
* Cancellation is best-effort by the wire's construction: the daemon forwards
|
|
1214
|
-
* the frame on a live route and silently drops it on a departed one, and no
|
|
1215
|
-
* acknowledgement exists at any layer. Only the module's own reply proves what
|
|
1216
|
-
* happened, so the promise is NOT rejected here -- it settles however the module
|
|
1217
|
-
* answers, which may be a normal completion that beat the cancel.
|
|
1218
|
-
*/
|
|
1219
|
-
signal?: AbortSignal;
|
|
1220
|
-
}
|
|
1221
|
-
interface ManagedCallOptions extends RequestOptions {
|
|
1222
|
-
/** Overrides the per-client identity used for route.open before this call. */
|
|
1223
|
-
identity?: BindIdentity;
|
|
1224
|
-
/** Defaults to management_surface, matching the store/host management APIs. */
|
|
1225
|
-
targetKind?: ManagedRouteKind;
|
|
1226
|
-
/** Optional override for the consumer identity; by default the SUBC_MODULE_ID and SUBC_LAUNCH_NONCE environment variables are used when both are non-empty. Set null to send route.open without consumer_identity. */
|
|
1227
|
-
consumerIdentity?: ConsumerIdentity | null;
|
|
1228
|
-
/** Reverse-request handlers used by the managed route and all of its reconnect reopens. */
|
|
1229
|
-
reverseRequests?: ReverseRequestRegistry;
|
|
1230
|
-
}
|
|
1231
|
-
interface SubscribeOptions {
|
|
1232
|
-
priority?: Priority;
|
|
1233
|
-
admissionClass?: AdmissionClass;
|
|
1234
|
-
}
|
|
1235
|
-
type RoutePollKind = "status" | "liveness";
|
|
1236
|
-
interface RoutePollResult {
|
|
1237
|
-
route_channel: number;
|
|
1238
|
-
route_epoch: number;
|
|
1239
|
-
status: string | null;
|
|
1240
|
-
live: boolean | null;
|
|
1241
|
-
}
|
|
1242
|
-
interface CloseRouteOptions {
|
|
1243
|
-
/**
|
|
1244
|
-
* Await in-flight UNARY requests on the route to settle before tearing it down.
|
|
1245
|
-
* Subscriptions are always aborted (a held-open stream cannot be drained).
|
|
1246
|
-
* Defaults to false: close immediately, aborting everything in flight.
|
|
1247
|
-
*/
|
|
1248
|
-
drain?: boolean;
|
|
1249
|
-
}
|
|
1250
|
-
interface ManagedCloseRouteOptions extends CloseRouteOptions {
|
|
1251
|
-
/** Consumer identity used by the cached managed route. */
|
|
1252
|
-
consumerIdentity?: ConsumerIdentity | null;
|
|
1253
|
-
/** The registry whose derived capability set identifies the cached route. */
|
|
1254
|
-
reverseRequests?: ReverseRequestRegistry;
|
|
1255
|
-
}
|
|
1256
|
-
/**
|
|
1257
|
-
* Capped exponential reconnect backoff. maxAttempts includes the first immediate
|
|
1258
|
-
* reconnect attempt; sleeps happen only between failed transient attempts.
|
|
1259
|
-
*/
|
|
1260
|
-
interface ReconnectBackoff {
|
|
1261
|
-
/** First retry delay. */
|
|
1262
|
-
baseMs: number;
|
|
1263
|
-
/** Delay ceiling (doubling is capped here). */
|
|
1264
|
-
capMs: number;
|
|
1265
|
-
/** Max attempts (including the first) before giving up. */
|
|
1266
|
-
maxAttempts: number;
|
|
1267
|
-
}
|
|
1268
|
-
/**
|
|
1269
|
-
* A live subscription to a provider's event stream, riding a single held-open
|
|
1270
|
-
* request. `onEvent` fires for each StreamData frame; `closed` resolves when the
|
|
1271
|
-
* provider ends the stream (StreamEnd) or the consumer unsubscribes, and rejects on
|
|
1272
|
-
* an Error terminal or a route GOODBYE. `unsubscribe` cancels the held-open request
|
|
1273
|
-
* so the provider unwinds.
|
|
1274
|
-
*/
|
|
1275
|
-
interface Subscription {
|
|
1276
|
-
/** Cancel the subscription: sends Cancel on the held-open request; idempotent. */
|
|
1277
|
-
unsubscribe(): void;
|
|
1278
|
-
/** Resolves on StreamEnd or local unsubscribe; rejects on an Error terminal or route close. */
|
|
1279
|
-
readonly closed: Promise<void>;
|
|
1280
|
-
}
|
|
1281
|
-
interface ConnectOptions {
|
|
1061
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.17.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/claustrum/insula.d.ts
|
|
1062
|
+
/** Optional transport for custom scoped clients; getUsage must not retry refusals. */
|
|
1063
|
+
interface InsulaUsageTransport {
|
|
1282
1064
|
connectionFile: string;
|
|
1283
|
-
|
|
1284
|
-
/** Default route identity used by managed call(); can be overridden per call. */
|
|
1285
|
-
identity?: BindIdentity;
|
|
1286
|
-
/** Default route target kind used by managed call(); defaults to management_surface. */
|
|
1287
|
-
targetKind?: ManagedRouteKind;
|
|
1288
|
-
/** Backoff for managed reconnect after a connection drop. */
|
|
1289
|
-
reconnectBackoff?: ReconnectBackoff;
|
|
1290
|
-
/** Injectable sleep for timer-free reconnect tests. */
|
|
1291
|
-
sleep?: (ms: number) => Promise<void>;
|
|
1292
|
-
/**
|
|
1293
|
-
* How long managed calls keep retrying route.open in-place on retryable
|
|
1294
|
-
* refusals (module_reloading, module_warming, target_unavailable, …) before
|
|
1295
|
-
* settling not_sent. This deadline is the ONLY binder on those retries —
|
|
1296
|
-
* module reloads legitimately take tens of seconds (the daemon's drain alone
|
|
1297
|
-
* defaults to 30s), so the default matches the daemon's drain ceiling.
|
|
1298
|
-
*/
|
|
1299
|
-
routeOpenRetryDeadlineMs?: number;
|
|
1300
|
-
/**
|
|
1301
|
-
* Window the post-deadline liveness probe waits for ANY inbound frame after
|
|
1302
|
-
* sending its channel-0 Ping before convicting the socket as half-open.
|
|
1303
|
-
* Genuine event-loop starvation self-protects at any setting: a loop starved
|
|
1304
|
-
* enough to delay the probe's check also delays the read loop, and when it
|
|
1305
|
-
* wakes the buffered Pong dispatches first. Exposed for deterministic tests.
|
|
1306
|
-
*/
|
|
1307
|
-
livenessProbeWindowMs?: number;
|
|
1308
|
-
/**
|
|
1309
|
-
* Hard cap on the timeout-arbitration grace window (see
|
|
1310
|
-
* TIMEOUT_ARBITRATION_GRACE_MS). A reply whose bytes are actively arriving when
|
|
1311
|
-
* the request deadline fires is given up to this long to finish dispatching
|
|
1312
|
-
* before the call settles as a timeout. Bounded and never a deadline extension;
|
|
1313
|
-
* exposed mainly so tests can prove the arbitration deterministically.
|
|
1314
|
-
*/
|
|
1315
|
-
timeoutArbitrationGraceMs?: number;
|
|
1316
|
-
/**
|
|
1317
|
-
* Observer for daemon-originated channel-0 control pushes (`route.closing`,
|
|
1318
|
-
* `route.closed`, and any op added later). Purely advisory: the daemon's
|
|
1319
|
-
* load-bearing route-death signal remains the GOODBYE frame, and nothing in
|
|
1320
|
-
* the client's own route lifecycle consumes these. The contract is the wire
|
|
1321
|
-
* contract verbatim -- unrecognized ops still arrive here (callers ignore
|
|
1322
|
-
* what they don't know, per the MUST-ignore clause), a push that fails to
|
|
1323
|
-
* parse as JSON is dropped without surfacing, and an observer throw is
|
|
1324
|
-
* swallowed like every other caller callback so it cannot fail the read loop
|
|
1325
|
-
* or unrelated requests.
|
|
1326
|
-
*/
|
|
1327
|
-
onControlPush?: (push: ControlPush) => void;
|
|
1328
|
-
}
|
|
1329
|
-
/** A parsed daemon-originated channel-0 control push. */
|
|
1330
|
-
interface ControlPush {
|
|
1331
|
-
/** The push discriminator, e.g. "route.closing" | "route.closed". */
|
|
1332
|
-
op: string;
|
|
1333
|
-
/** The full parsed body, `op` included, for op-specific fields. */
|
|
1334
|
-
body: Record<string, unknown>;
|
|
1335
|
-
}
|
|
1336
|
-
declare class SubcClient {
|
|
1337
|
-
private sock;
|
|
1338
|
-
private currentConn;
|
|
1339
|
-
private readonly opts;
|
|
1340
|
-
private nextCorr;
|
|
1341
|
-
private readonly pending;
|
|
1342
|
-
private readonly lateResponses;
|
|
1343
|
-
private readonly routes;
|
|
1344
|
-
private readonly liveRoutes;
|
|
1345
|
-
private connectionToken;
|
|
1346
|
-
private ingressEpochDropCount;
|
|
1347
|
-
private closedErr;
|
|
1348
|
-
private closeStarted;
|
|
1349
|
-
private reconnecting;
|
|
1350
|
-
private generation;
|
|
1351
|
-
private readerActive;
|
|
1352
|
-
private constructor();
|
|
1353
|
-
get conn(): ConnectionInfo;
|
|
1354
|
-
/** Read the connection file, connect, authenticate, and start the read loop. */
|
|
1355
|
-
static connect(opts: ConnectOptions): Promise<SubcClient>;
|
|
1356
|
-
/** List modules subc knows about (channel-0 catalog.list). */
|
|
1357
|
-
catalogList(moduleId?: string): Promise<CatalogEntry[]>;
|
|
1358
|
-
/**
|
|
1359
|
-
* Resolve the sole catalog claimant for a capability.
|
|
1360
|
-
*
|
|
1361
|
-
* This expresses singular intent even when the fleet permits plural claims;
|
|
1362
|
-
* ambiguity is returned instead of selecting an arbitrary module.
|
|
1363
|
-
*/
|
|
1364
|
-
resolveProvider(capability: string): Promise<string>;
|
|
1365
|
-
/** Resolve every catalog claimant in deterministic module-id order. */
|
|
1366
|
-
resolveProviders(capability: string): Promise<string[]>;
|
|
1367
|
-
/** Open a route and return its connection-bound immutable handle. */
|
|
1368
|
-
routeOpen(target: RouteTarget, identity: BindIdentity, opts?: RouteOpenOptions): Promise<RouteHandle>;
|
|
1369
|
-
/** Send a data-plane request on exactly the supplied route generation. */
|
|
1370
|
-
request(handle: RouteHandle, body: unknown, opts?: RequestOptions): Promise<unknown>;
|
|
1371
|
-
/**
|
|
1372
|
-
* Managed route + request convenience. Opens and caches a route for the module,
|
|
1373
|
-
* reconnecting and re-opening cached routes after connection drops.
|
|
1374
|
-
*/
|
|
1375
|
-
call<Response = unknown>(moduleId: string, method: string, params?: unknown, opts?: ManagedCallOptions): Promise<Response>;
|
|
1376
|
-
/**
|
|
1377
|
-
* Managed route + raw opaque-body request convenience. Unlike call(), this
|
|
1378
|
-
* sends bytes without a JSON method envelope because the BINARY flag is the
|
|
1379
|
-
* receiver's only signal that the body is not JSON. A BINARY reply resolves
|
|
1380
|
-
* to Uint8Array; a non-binary reply is decoded as JSON.
|
|
1381
|
-
*/
|
|
1382
|
-
callBinary(moduleId: string, body: Uint8Array, opts?: ManagedCallOptions): Promise<Uint8Array | unknown>;
|
|
1383
|
-
private managedCall;
|
|
1384
|
-
/** Open a held request on exactly one route generation. */
|
|
1385
|
-
subscribe(handle: RouteHandle, body: unknown, onEvent: (event: Uint8Array) => void, opts?: SubscribeOptions): Subscription;
|
|
1386
|
-
/**
|
|
1387
|
-
* Emit CANCEL for one in-flight request when its caller's signal fires.
|
|
1388
|
-
*
|
|
1389
|
-
* Emits only while the request is unsettled by this client's own book, which is
|
|
1390
|
-
* a fact it owns and can check without racing. It deliberately does NOT check
|
|
1391
|
-
* whether the route still exists: that would be a guess, and a wrong guess turns
|
|
1392
|
-
* a frame the daemon would harmlessly drop into a frame never sent -- removing
|
|
1393
|
-
* the caller's only chance at the cost of saving nothing.
|
|
1394
|
-
*/
|
|
1395
|
-
private attachCancelSignal;
|
|
1396
|
-
/** Send a pure-header cancellation for an in-flight request. */
|
|
1397
|
-
cancel(handle: RouteHandle, corr: bigint, priority?: Priority): void;
|
|
1398
|
-
/** Poll status or liveness for exactly the supplied route generation. */
|
|
1399
|
-
routePoll(handle: RouteHandle, kind: RoutePollKind): Promise<RoutePollResult>;
|
|
1400
|
-
/** Tear down exactly the supplied route generation. */
|
|
1401
|
-
closeRoute(handle: RouteHandle, opts?: CloseRouteOptions): Promise<void>;
|
|
1402
|
-
/** Close a cached managed route by its route-open identity tuple. */
|
|
1403
|
-
closeManagedRoute(target: Extract<RouteTarget, {
|
|
1404
|
-
kind: ManagedRouteKind;
|
|
1405
|
-
}>, identity: BindIdentity, opts?: ManagedCloseRouteOptions): Promise<void>;
|
|
1406
|
-
/** Alias retained for callers that name the operation by protocol channel; it still requires a full handle. */
|
|
1407
|
-
closeRouteChannel(handle: RouteHandle, opts?: CloseRouteOptions): Promise<void>;
|
|
1408
|
-
close(): void;
|
|
1409
|
-
private drainUnaryOnHandle;
|
|
1410
|
-
private sendRouteGoodbye;
|
|
1411
|
-
private static openConnection;
|
|
1412
|
-
private controlRpc;
|
|
1413
|
-
private send;
|
|
1414
|
-
/**
|
|
1415
|
-
* A request-deadline timer has fired. Before settling as a timeout, arbitrate
|
|
1416
|
-
* the timer-vs-poll race: a reply may already be in the socket buffer, unread
|
|
1417
|
-
* only because the loop was starved. Yield one check phase (setImmediate) so a
|
|
1418
|
-
* fully-buffered reply dispatches and wins via settle()'s identity guard; then,
|
|
1419
|
-
* only while the reader is actively draining THIS socket (a frame mid-arrival),
|
|
1420
|
-
* grant a single hard-capped grace before finally settling. Absent replies
|
|
1421
|
-
* still settle right after the check phase. The settle carries the deadline
|
|
1422
|
-
* marker so the managed classifier reports deadline-not-drop.
|
|
1423
|
-
*/
|
|
1424
|
-
private arbitrateTimeout;
|
|
1425
|
-
private managedRequest;
|
|
1426
|
-
private sendManaged;
|
|
1427
|
-
private cachedRouteHandle;
|
|
1428
|
-
private openCachedRoute;
|
|
1429
|
-
private lastInboundAtMs;
|
|
1430
|
-
private livenessProbe;
|
|
1431
|
-
/**
|
|
1432
|
-
* Discriminate event-loop starvation from a half-open socket after a
|
|
1433
|
-
* deadline-no-drop settle. The arbitration deliberately keeps the socket on
|
|
1434
|
-
* that verdict (a late-read reply under load must not cost a healthy
|
|
1435
|
-
* connection), but a half-open socket — peer vanished with no FIN/RST, as
|
|
1436
|
-
* after host sleep/wake — yields the SAME verdict forever, so the keep
|
|
1437
|
-
* becomes a permanent pin to a dead transport. The discriminator is
|
|
1438
|
-
* socket-level liveness evidence: send a channel-0 Ping (the daemon always
|
|
1439
|
-
* answers — subc-core control.rs) and require ANY inbound frame within the
|
|
1440
|
-
* window; the Pong suffices, and a busy socket's other traffic proves the
|
|
1441
|
-
* link just as well. Silence convicts: the socket is failed with a named
|
|
1442
|
-
* cause and closed, so the ordinary drop path (pending rejection now,
|
|
1443
|
-
* reconnect on the next call) takes over.
|
|
1444
|
-
*
|
|
1445
|
-
* Starvation cannot be falsely convicted by a short window: a loop starved
|
|
1446
|
-
* enough to delay the read loop delays this probe's own timer identically,
|
|
1447
|
-
* and when both wake the buffered Pong dispatches before the check runs.
|
|
1448
|
-
*
|
|
1449
|
-
* A PENDING CHANNEL-0 REQUEST SUSPENDS THE PROBE (both at launch and at the
|
|
1450
|
-
* conviction check). The daemon's connection loop handles frames one at a
|
|
1451
|
-
* time, and some channel-0 ops legally park it for seconds — route.open
|
|
1452
|
-
* awaits the module's bind ack inline for up to route_bind_relay_timeout
|
|
1453
|
-
* (~12s in production) — during which OUR Ping sits unread in the daemon's
|
|
1454
|
-
* socket buffer. On an otherwise-quiet connection that silence is fully
|
|
1455
|
-
* explained by our own in-flight control op, and convicting on it would
|
|
1456
|
-
* tear down a healthy connection mid-bind (BROCA's Athena panel flagged
|
|
1457
|
-
* this exact premise; the FIFO fact is verified in subc-core server.rs
|
|
1458
|
-
* connection_loop + control.rs handle_route_open). The client always knows
|
|
1459
|
-
* its own channel-0 pendings, so the gate is local and exact: no probe
|
|
1460
|
-
* while one is in flight, no conviction if one appeared during the window.
|
|
1461
|
-
*
|
|
1462
|
-
* Scope: hooked from the managed-call path only. Control-plane requests
|
|
1463
|
-
* (route.open, catalog.list) are short-lived and their failures already
|
|
1464
|
-
* escalate through reconnect classification; the managed path is where a
|
|
1465
|
-
* plugin lives for hours and where the pin was observed in production.
|
|
1466
|
-
*/
|
|
1467
|
-
/** Any in-flight channel-0 request (pendings keyed without a route handle). */
|
|
1468
|
-
private hasControlPending;
|
|
1469
|
-
private probeLivenessAfterDeadline;
|
|
1470
|
-
private ensureConnectedForManaged;
|
|
1471
|
-
private scheduleReconnectAfterDrop;
|
|
1472
|
-
private reconnectAfterDrop;
|
|
1473
|
-
private reconnectWithRetry;
|
|
1474
|
-
private replaceConnection;
|
|
1475
|
-
private reopenCachedRoutes;
|
|
1476
|
-
private timeoutMessage;
|
|
1477
|
-
private routeClosedDuringOpen;
|
|
1478
|
-
private readLoop;
|
|
1479
|
-
private dispatch;
|
|
1480
|
-
/**
|
|
1481
|
-
* Settle a pending exactly once. The object-identity guard (the map still
|
|
1482
|
-
* holds THIS pending under `key`) is the single-winner primitive: whichever of
|
|
1483
|
-
* dispatch, a timeout, fail(), failChannel(), a GOODBYE, or a deferred timeout
|
|
1484
|
-
* arbitration reaches it first wins, and every later caller no-ops. This is what
|
|
1485
|
-
* makes the deferred-timeout arbitration safe — it cannot double-settle, reject
|
|
1486
|
-
* an already-resolved promise, or delete a pending re-created for a later corr.
|
|
1487
|
-
* Returns true when this call was the settler.
|
|
1488
|
-
*/
|
|
1489
|
-
private settle;
|
|
1490
|
-
private rejectPending;
|
|
1491
|
-
private dispatchReverseRequest;
|
|
1492
|
-
private sendReverseError;
|
|
1493
|
-
private sendReverseReply;
|
|
1494
|
-
private errorFromFrame;
|
|
1495
|
-
private evictRouteHandle;
|
|
1496
|
-
private failHandle;
|
|
1497
|
-
private fail;
|
|
1498
|
-
private notSentCallError;
|
|
1499
|
-
private outcomeUnknownCallError;
|
|
1500
|
-
private terminalCallError;
|
|
1501
|
-
private notSentRecoveryError;
|
|
1502
|
-
/** Number of nonzero-channel ingress frames dropped by endpoint epoch validation. */
|
|
1503
|
-
get droppedIngressFrames(): number;
|
|
1504
|
-
private installRoute;
|
|
1505
|
-
private isLiveHandle;
|
|
1506
|
-
private assertLiveConnection;
|
|
1507
|
-
private assertLiveHandle;
|
|
1508
|
-
private allocateCorr;
|
|
1509
|
-
private closeConnectionAfterCleanupFailure;
|
|
1510
|
-
private encode;
|
|
1511
|
-
/** Decode a terminal response according to the representation on the wire. */
|
|
1512
|
-
private decodeReply;
|
|
1513
|
-
private parseJson;
|
|
1065
|
+
getUsage(): Promise<unknown>;
|
|
1514
1066
|
}
|
|
1515
1067
|
//#endregion
|
|
1516
|
-
//#region ../../node_modules/.bun/@cortexkit+
|
|
1517
|
-
type
|
|
1518
|
-
|
|
1519
|
-
handshakeTimeoutMs?: number;
|
|
1520
|
-
}) => Promise<SubcClient>;
|
|
1521
|
-
type ClaustrumClientOptions = {
|
|
1522
|
-
connectionFile?: string;
|
|
1523
|
-
handshakeTimeoutMs?: number;
|
|
1524
|
-
projectRoot?: string;
|
|
1525
|
-
storagePath?: string;
|
|
1526
|
-
identity?: BindIdentity;
|
|
1527
|
-
connector?: ClaustrumConnector;
|
|
1528
|
-
logger?: (errorClass: string) => void;
|
|
1068
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.17.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/claustrum/custody.d.ts
|
|
1069
|
+
type ClaustrumScopedClient = Pick<ClaustrumClient, 'listScoped' | 'getScoped' | 'reportAuthFailureScoped' | 'close'> & {
|
|
1070
|
+
insula?: InsulaUsageTransport;
|
|
1529
1071
|
};
|
|
1530
|
-
/**
|
|
1531
|
-
* Credential material plus optional non-secret identity metadata. Missing wire fields remain
|
|
1532
|
-
* `undefined`; a present non-string identity value rejects the response as invalid.
|
|
1533
|
-
*
|
|
1534
|
-
* An absent identity field means the vault had nothing to assert — NOT that identity failed.
|
|
1535
|
-
* Consumers must not collapse absence into mismatch: assert on presence, refuse on a present
|
|
1536
|
-
* difference, and serve (log, if it matters) when the field is missing. Absence proves neither
|
|
1537
|
-
* the right identity nor the wrong one, so treating it as a failure converts a vault that could
|
|
1538
|
-
* not answer into a consumer that cannot serve. The vault records no per-read success (at most
|
|
1539
|
-
* the first scoped read per principal), and nothing at all when a consumer declines to serve, so
|
|
1540
|
-
* an outage caused that way is visible only to the consumer that caused it.
|
|
1541
|
-
*/
|
|
1542
|
-
type ServedCredential = {
|
|
1543
|
-
material: string;
|
|
1544
|
-
recordVersion: number;
|
|
1545
|
-
expiresAtMs: number | null;
|
|
1546
|
-
/**
|
|
1547
|
-
* Operator-chosen record label for verifying a caller-held binding. It is not a routing key:
|
|
1548
|
-
* account-scoped routing joins `accountId` with `recordVersion`.
|
|
1549
|
-
*/
|
|
1550
|
-
credentialId?: string;
|
|
1551
|
-
/** Non-secret Code Assist project identity, present only for antigravity credentials. */
|
|
1552
|
-
projectId?: string;
|
|
1553
|
-
/**
|
|
1554
|
-
* Provider account identity the served token executes under. Account-scoped routing joins this
|
|
1555
|
-
* value with `recordVersion`; it is neither the operator's credential label nor the bearer handle.
|
|
1556
|
-
*
|
|
1557
|
-
* BEST-EFFORT, NEVER GUARANTEED, including for JWT providers. The vault parses the claim live
|
|
1558
|
-
* from the served access token and falls back to stored login-time identity; both legs can be
|
|
1559
|
-
* empty, and the serve path yields nothing rather than fabricating an id. It is absent when the
|
|
1560
|
-
* provider has no known claim, the token does not carry one, or no identity was captured at
|
|
1561
|
-
* login. Do not gate serving on its presence.
|
|
1562
|
-
*/
|
|
1563
|
-
accountId?: string;
|
|
1564
|
-
/** Non-secret account display metadata captured at login. */
|
|
1565
|
-
email?: string;
|
|
1566
|
-
/** Non-secret organization or workspace display metadata captured at login. */
|
|
1567
|
-
orgName?: string;
|
|
1568
|
-
};
|
|
1569
|
-
/**
|
|
1570
|
-
* Non-secret health for one handle, read without minting anything.
|
|
1571
|
-
*
|
|
1572
|
-
* An unresolved handle (unknown or revoked) is an ordinary answer, not an error: it decodes
|
|
1573
|
-
* as `ready: false, lastErrorCode: 'not_found'` with `credentialId`, `recordVersion` and
|
|
1574
|
-
* `stalePending` all absent. The vault omits them on purpose so a probe learns nothing about
|
|
1575
|
-
* what exists and no placeholder value is asserted about a record it never saw.
|
|
1576
|
-
*/
|
|
1577
|
-
type CredentialStatus = {
|
|
1578
|
-
ready: boolean;
|
|
1579
|
-
lastErrorCode: string | null;
|
|
1580
|
-
leaseHeld: boolean;
|
|
1581
|
-
/**
|
|
1582
|
-
* Operator-chosen record label the handle resolved to, for verifying a binding the caller
|
|
1583
|
-
* already holds. Not a routing key. Absent when the handle did not resolve.
|
|
1584
|
-
*/
|
|
1585
|
-
credentialId?: string;
|
|
1586
|
-
/**
|
|
1587
|
-
* The record's change cursor, present only when the handle resolved to a record.
|
|
1588
|
-
*
|
|
1589
|
-
* Optional, and OMITTED from the object rather than defaulted, because there is no honest
|
|
1590
|
-
* default: 0 or -1 would compare as older than every real version, so a poller would read a
|
|
1591
|
-
* revoked handle as a change it had yet to see, forever. With the key absent, TypeScript
|
|
1592
|
-
* refuses arithmetic or ordering on it until the caller has handled `undefined`, and
|
|
1593
|
-
* `'recordVersion' in status` is false. Never replace absence with a number (`?? 0`).
|
|
1594
|
-
*/
|
|
1595
|
-
recordVersion?: number;
|
|
1596
|
-
stalePending?: boolean;
|
|
1597
|
-
};
|
|
1598
|
-
type ClaustrumReporterSource = 'direct' | 'relay_status_field' | 'relay_message_parse';
|
|
1599
|
-
declare class ClaustrumClient {
|
|
1600
|
-
#private;
|
|
1601
|
-
private constructor();
|
|
1602
|
-
static connect(options?: ClaustrumClientOptions): Promise<ClaustrumClient>;
|
|
1603
|
-
getCredential(handle: string, minTtlMs?: number): Promise<ServedCredential>;
|
|
1604
|
-
statusCredential(handle: string): Promise<CredentialStatus>;
|
|
1605
|
-
reportAuthFailure(input: {
|
|
1606
|
-
handle: string;
|
|
1607
|
-
providerStatus: number;
|
|
1608
|
-
recordVersion: number;
|
|
1609
|
-
reporterSource: ClaustrumReporterSource;
|
|
1610
|
-
}): Promise<void>;
|
|
1611
|
-
/**
|
|
1612
|
-
* Enumerate what this caller's grants cover.
|
|
1613
|
-
*
|
|
1614
|
-
* `params` is `{}` and must be PRESENT: the vault rejects an absent or null params
|
|
1615
|
-
* object, so a caller cannot ask a different question by omitting it.
|
|
1616
|
-
*/
|
|
1617
|
-
listScoped(enrollmentToken?: string): Promise<ScopedInventory>;
|
|
1618
|
-
/**
|
|
1619
|
-
* Fetch by credential id, authorized by a grant rather than a bearer handle.
|
|
1620
|
-
*
|
|
1621
|
-
* `minTtlMs` is a DEMAND, not a hint: if a real upstream exchange still cannot satisfy
|
|
1622
|
-
* it, the vault refuses with `ttl_unsatisfiable` (class `context_overflow`) rather than
|
|
1623
|
-
* serving a token that will die inside the caller's own margin. That class means
|
|
1624
|
-
* reduce-and-retry, never wait-and-retry.
|
|
1625
|
-
*/
|
|
1626
|
-
getScoped(input: {
|
|
1627
|
-
credentialId: string;
|
|
1628
|
-
enrollmentToken?: string;
|
|
1629
|
-
minTtlMs?: number;
|
|
1630
|
-
}): Promise<ServedCredential>;
|
|
1631
|
-
/**
|
|
1632
|
-
* Report a served credential dead, addressed by id rather than by handle.
|
|
1633
|
-
*
|
|
1634
|
-
* VERSION-FENCED: `recordVersion` must be the one this caller was SERVED. A report
|
|
1635
|
-
* against a since-refreshed version is accepted and does nothing, which is the point --
|
|
1636
|
-
* a stale report must not kill a fresh token. `accepted: true` is the receipt that the
|
|
1637
|
-
* report was taken, never evidence that it applied.
|
|
1638
|
-
*/
|
|
1639
|
-
reportAuthFailureScoped(input: {
|
|
1640
|
-
credentialId: string;
|
|
1641
|
-
enrollmentToken?: string;
|
|
1642
|
-
providerStatus: number;
|
|
1643
|
-
recordVersion: number;
|
|
1644
|
-
reporterSource: ClaustrumReporterSource;
|
|
1645
|
-
}): Promise<void>;
|
|
1646
|
-
/**
|
|
1647
|
-
* Propose an enrollment. The consumer mints `requestSecret` itself and sends only its
|
|
1648
|
-
* hash; the raw secret NEVER leaves the process, and it is what authorizes the poll.
|
|
1649
|
-
*
|
|
1650
|
-
* IDEMPOTENT ON (name, secret): re-proposing with the same secret returns the SAME
|
|
1651
|
-
* `requestId`. That exists because `requestId` is minted server-side, so a consumer
|
|
1652
|
-
* cannot persist it before proposing -- a crash in that window would otherwise leave it
|
|
1653
|
-
* holding a secret it cannot poll with and a name held until TTL. Persist the secret
|
|
1654
|
-
* BEFORE calling this, and a crash costs nothing.
|
|
1655
|
-
*
|
|
1656
|
-
* A different secret on the same name is a different caller and is refused.
|
|
1657
|
-
*/
|
|
1658
|
-
enrollPropose(input: {
|
|
1659
|
-
name: string;
|
|
1660
|
-
requestSecretHash: string;
|
|
1661
|
-
}): Promise<{
|
|
1662
|
-
requestId: string;
|
|
1663
|
-
}>;
|
|
1664
|
-
/**
|
|
1665
|
-
* Poll a proposal. Returns `pending` until an operator decides, then exactly once
|
|
1666
|
-
* returns the token.
|
|
1667
|
-
*
|
|
1668
|
-
* THE TOKEN IS RETURNED ONCE. Persist it before doing anything else with it; a lost
|
|
1669
|
-
* token needs a fresh ceremony, not a second poll.
|
|
1670
|
-
*/
|
|
1671
|
-
enrollPoll(input: {
|
|
1672
|
-
requestId: string;
|
|
1673
|
-
requestSecret: string;
|
|
1674
|
-
}): Promise<EnrollmentPollOutcome>;
|
|
1675
|
-
/**
|
|
1676
|
-
* Exchange a live token for its successor. The old token dies when the new one is issued.
|
|
1677
|
-
*
|
|
1678
|
-
* `expectedTokenGeneration` IS REQUIRED AND IS A FENCE, not bookkeeping: it must be the
|
|
1679
|
-
* generation this caller currently holds. Two rotations racing — a retry after an
|
|
1680
|
-
* uncertain reply, or two instances of the same consumer — would otherwise each mint a
|
|
1681
|
-
* successor and each invalidate the other's, leaving a consumer holding a token the
|
|
1682
|
-
* vault has already replaced. The vault refuses a rotation whose expectation does not
|
|
1683
|
-
* match, so the loser learns it lost instead of discovering it on a later spend.
|
|
1684
|
-
*/
|
|
1685
|
-
enrollRotate(input: {
|
|
1686
|
-
token: string;
|
|
1687
|
-
expectedTokenGeneration: number;
|
|
1688
|
-
}): Promise<{
|
|
1689
|
-
token: string;
|
|
1690
|
-
tokenGeneration: number;
|
|
1691
|
-
}>;
|
|
1692
|
-
close(): void;
|
|
1693
|
-
}
|
|
1694
|
-
/**
|
|
1695
|
-
* A row from the caller's own grant-covered inventory.
|
|
1696
|
-
*
|
|
1697
|
-
* Selection fields answer different questions. Pick by what you are about
|
|
1698
|
-
* to do with the token:
|
|
1699
|
-
*
|
|
1700
|
-
* - `providerIds` — operator-assigned catalog provider ids; match exactly, with no fallback.
|
|
1701
|
-
* - `authMethod` — the closed authentication method derived from the unsealed record,
|
|
1702
|
-
* not the id spelling. Absent on sign/open-only rows or when no method is defined.
|
|
1703
|
-
*
|
|
1704
|
-
* - `refreshAdapter` — whose PROTOCOL the credential speaks. Use it when the token
|
|
1705
|
-
* goes to a provider's own endpoints. Anything else is invalid there.
|
|
1706
|
-
* - `serves` — which model VENDORS are reachable through it. Use it when choosing
|
|
1707
|
-
* where a model can be served from, and the protocol is not yours to care about.
|
|
1708
|
-
*
|
|
1709
|
-
* Never infer these fields from the id spelling. A credential reaching Anthropic models
|
|
1710
|
-
* through OpenRouter still speaks OpenRouter's protocol, not Anthropic's.
|
|
1711
|
-
*/
|
|
1712
|
-
interface ScopedInventoryRow {
|
|
1713
|
-
readonly id: string;
|
|
1714
|
-
readonly categories: readonly string[];
|
|
1715
|
-
readonly credentialType: string;
|
|
1716
|
-
readonly serves: readonly string[];
|
|
1717
|
-
/**
|
|
1718
|
-
* Operator-assigned catalog ids; empty when none are set. Always present on this type.
|
|
1719
|
-
* A daemon older than the field omits it from the wire, and that decodes as empty,
|
|
1720
|
-
* which is also what an unmapped credential reports.
|
|
1721
|
-
*/
|
|
1722
|
-
readonly providerIds: readonly string[];
|
|
1723
|
-
readonly authMethod?: 'apikey' | 'chatgpt' | 'antigravity' | 'oauth';
|
|
1724
|
-
/**
|
|
1725
|
-
* Which provider protocol this credential speaks. Absent for static keys.
|
|
1726
|
-
*
|
|
1727
|
-
* SELECT ON THIS, NOT ON `serves`, WHEN THE TOKEN GOES TO A PROVIDER'S OWN ENDPOINTS.
|
|
1728
|
-
* Measured on a live vault: eight rows serve Anthropic models and only five are Claude
|
|
1729
|
-
* OAuth -- openrouter, antigravity and cursor reach Anthropic models through their own
|
|
1730
|
-
* APIs. The id spelling does not separate them either: two contain no "anthropic" at
|
|
1731
|
-
* all, and `credentialType === 'oauth'` catches antigravity and cursor too.
|
|
1732
|
-
*/
|
|
1733
|
-
readonly refreshAdapter?: string;
|
|
1734
|
-
readonly state: string;
|
|
1735
|
-
readonly recordVersion: number;
|
|
1736
|
-
readonly operations: readonly string[];
|
|
1737
|
-
/**
|
|
1738
|
-
* NOT SERVED TODAY. The field is absent from `ListScopedCredential`, so this is always
|
|
1739
|
-
* null; it is declared because a consumer's discovery high-water mark needs it and the
|
|
1740
|
-
* absence should be visible in the type rather than discovered at runtime.
|
|
1741
|
-
*/
|
|
1742
|
-
readonly createdAtMs: number | null;
|
|
1743
|
-
readonly accountId?: string;
|
|
1744
|
-
readonly email?: string;
|
|
1745
|
-
readonly orgName?: string;
|
|
1746
|
-
}
|
|
1747
|
-
/**
|
|
1748
|
-
* An inventory reply: the covered rows, plus the cursor that says whether they moved.
|
|
1749
|
-
*
|
|
1750
|
-
* `view` is a DIGEST OVER WHAT THIS CALLER CAN SEE — ids, categories, state, operations —
|
|
1751
|
-
* and deliberately NOT over `record_version`, so a routine token refresh does not move it.
|
|
1752
|
-
* Compare it against the previous call's to decide whether to reconcile at all; it is an
|
|
1753
|
-
* opaque string and nothing but equality is defined on it.
|
|
1754
|
-
*/
|
|
1755
|
-
interface ScopedInventory {
|
|
1756
|
-
readonly rows: readonly ScopedInventoryRow[];
|
|
1757
|
-
readonly view: string;
|
|
1758
|
-
}
|
|
1759
|
-
/** What a poll found. `pending` is not an error: the operator has not decided yet. */
|
|
1760
|
-
type EnrollmentPollOutcome = {
|
|
1761
|
-
readonly status: 'pending';
|
|
1762
|
-
} | {
|
|
1763
|
-
readonly status: 'approved';
|
|
1764
|
-
readonly name: string;
|
|
1765
|
-
readonly token: string;
|
|
1766
|
-
readonly tokenGeneration: number;
|
|
1767
|
-
} | {
|
|
1768
|
-
readonly status: 'denied';
|
|
1769
|
-
};
|
|
1770
|
-
//#endregion
|
|
1771
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.14.2+49be191d46b46482/node_modules/@cortexkit/common-auth/dist/claustrum/custody.d.ts
|
|
1772
|
-
type ClaustrumScopedClient = Pick<ClaustrumClient, 'listScoped' | 'getScoped' | 'reportAuthFailureScoped' | 'close'>;
|
|
1773
1072
|
/** The two credential types a plugin's family can hold; routing differs by type. */
|
|
1774
1073
|
type VaultCredentialType = 'oauth' | 'api_key';
|
|
1775
1074
|
/**
|
|
@@ -1832,56 +1131,7 @@ interface ClaustrumScopedAttempt {
|
|
|
1832
1131
|
readonly expiresAtMs: number | null;
|
|
1833
1132
|
}
|
|
1834
1133
|
//#endregion
|
|
1835
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
1836
|
-
interface QuotaReadingEntry {
|
|
1837
|
-
scope: string;
|
|
1838
|
-
label: string;
|
|
1839
|
-
kind: 'reading';
|
|
1840
|
-
checkedAt: number;
|
|
1841
|
-
usedPercent: number;
|
|
1842
|
-
/** ISO timestamp at which the window resets, as the provider reported it. */
|
|
1843
|
-
resetsAt?: string;
|
|
1844
|
-
/** Window length in minutes, when the provider reported one. */
|
|
1845
|
-
windowMinutes?: number;
|
|
1846
|
-
}
|
|
1847
|
-
interface QuotaRetiredEntry {
|
|
1848
|
-
scope: string;
|
|
1849
|
-
label: string;
|
|
1850
|
-
kind: 'retired';
|
|
1851
|
-
retiredAt: number;
|
|
1852
|
-
}
|
|
1853
|
-
interface QuotaAbsentEntry {
|
|
1854
|
-
scope: string;
|
|
1855
|
-
label: string;
|
|
1856
|
-
kind: 'absent';
|
|
1857
|
-
checkedAt: number;
|
|
1858
|
-
}
|
|
1859
|
-
type QuotaEntry = QuotaReadingEntry | QuotaRetiredEntry | QuotaAbsentEntry;
|
|
1860
|
-
interface CreditBudgetReading {
|
|
1861
|
-
kind: 'reading';
|
|
1862
|
-
checkedAt: number;
|
|
1863
|
-
/** The provider's own verdict that the budget is spent. */
|
|
1864
|
-
reached: boolean;
|
|
1865
|
-
remainingPercent?: number;
|
|
1866
|
-
usedPercent?: number;
|
|
1867
|
-
resetsAt?: string;
|
|
1868
|
-
limit?: number;
|
|
1869
|
-
used?: number;
|
|
1870
|
-
remaining?: number;
|
|
1871
|
-
unit?: string;
|
|
1872
|
-
}
|
|
1873
|
-
interface CreditBudgetCleared {
|
|
1874
|
-
kind: 'cleared';
|
|
1875
|
-
checkedAt: number;
|
|
1876
|
-
}
|
|
1877
|
-
type CreditBudgetEntry = CreditBudgetReading | CreditBudgetCleared;
|
|
1878
|
-
interface QuotaMap {
|
|
1879
|
-
limits: QuotaEntry[];
|
|
1880
|
-
/** Absent means no observation has reported on the budget yet. */
|
|
1881
|
-
budget?: CreditBudgetEntry;
|
|
1882
|
-
}
|
|
1883
|
-
//#endregion
|
|
1884
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.14.2+49be191d46b46482/node_modules/@cortexkit/common-auth/dist/claustrum/interlock.d.ts
|
|
1134
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.17.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/claustrum/interlock.d.ts
|
|
1885
1135
|
/**
|
|
1886
1136
|
* The declined-account interlock: the user's "do not use this vault account",
|
|
1887
1137
|
* kept on the consumer side because the vault has no notion of it.
|
|
@@ -1900,7 +1150,7 @@ interface DeclinedAccount {
|
|
|
1900
1150
|
readonly accountIdentity?: string;
|
|
1901
1151
|
}
|
|
1902
1152
|
//#endregion
|
|
1903
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
1153
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.17.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/claustrum/roster.d.ts
|
|
1904
1154
|
/**
|
|
1905
1155
|
* One vault account as the pool sees it. It carries no bearer material: the
|
|
1906
1156
|
* access token is fetched from the vault for every send. Several vault
|
|
@@ -1955,7 +1205,7 @@ interface VaultRosterFile {
|
|
|
1955
1205
|
*/
|
|
1956
1206
|
type QuotaReceipt = Pick<ClaustrumScopedAttempt, 'credentialId' | 'accountIdentity' | 'accountIdentitySource' | 'expectedAccountIdentity'>;
|
|
1957
1207
|
//#endregion
|
|
1958
|
-
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.
|
|
1208
|
+
//#region ../../node_modules/.bun/@cortexkit+common-auth@0.17.0+0d2d5e37d881ac14/node_modules/@cortexkit/common-auth/dist/claustrum/enrollment.d.ts
|
|
1959
1209
|
interface ClaustrumEnrollmentClient {
|
|
1960
1210
|
enrollPropose(input: {
|
|
1961
1211
|
name: string;
|
|
@@ -2084,6 +1334,12 @@ declare class OpenAiVault {
|
|
|
2084
1334
|
* `VAULT_REQUEST_ROSTER_WAIT_MS`.
|
|
2085
1335
|
*/
|
|
2086
1336
|
firstRoster(): Promise<void>;
|
|
1337
|
+
/**
|
|
1338
|
+
* Readies a current vault roster before request routing. The startup
|
|
1339
|
+
* discovery may have settled while this host was local, so firstRoster()
|
|
1340
|
+
* alone cannot tell a vault-mode request that it has a roster to use.
|
|
1341
|
+
*/
|
|
1342
|
+
awaitRequestRoster(): Promise<void>;
|
|
2087
1343
|
/**
|
|
2088
1344
|
* Re-reads the accounts from the vault now. Never rejects. It resolves only
|
|
2089
1345
|
* after a discovery that began after this call: one already in flight (the
|
|
@@ -2149,8 +1405,8 @@ declare class OpenAiVault {
|
|
|
2149
1405
|
* the background; a failure is logged.
|
|
2150
1406
|
*/
|
|
2151
1407
|
recordSnapshot(routeId: string, snapshot: unknown, complete: boolean, receipt: QuotaReceipt): Promise<void>;
|
|
2152
|
-
/** Joins
|
|
2153
|
-
pollQuota(routeId: string): Promise<{
|
|
1408
|
+
/** Joins a quota poll; current insula quota for the same account replaces a background ChatGPT wham/usage request. */
|
|
1409
|
+
pollQuota(routeId: string, background?: boolean): Promise<{
|
|
2154
1410
|
ok: boolean;
|
|
2155
1411
|
error?: string;
|
|
2156
1412
|
}>;
|
|
@@ -2199,6 +1455,60 @@ declare class OpenAiVault {
|
|
|
2199
1455
|
close(): void;
|
|
2200
1456
|
}
|
|
2201
1457
|
//#endregion
|
|
1458
|
+
//#region ../core/dist/commands.d.ts
|
|
1459
|
+
/**
|
|
1460
|
+
* The prompt-cache manager, as the Cache section uses it.
|
|
1461
|
+
*
|
|
1462
|
+
* Declared structurally rather than imported: the manager itself is tied to
|
|
1463
|
+
* one host's live request loader and stays there. Only the members the Cache
|
|
1464
|
+
* section and the host's session cleanup reach appear here.
|
|
1465
|
+
*/
|
|
1466
|
+
interface CacheKeepManager {
|
|
1467
|
+
status(): {
|
|
1468
|
+
running: boolean;
|
|
1469
|
+
sustain: boolean;
|
|
1470
|
+
window?: {
|
|
1471
|
+
startHour: number;
|
|
1472
|
+
endHour: number;
|
|
1473
|
+
} | undefined;
|
|
1474
|
+
tracked: number;
|
|
1475
|
+
generatedAt: number;
|
|
1476
|
+
ttlMs: number;
|
|
1477
|
+
leadMs: number;
|
|
1478
|
+
maxIdleWarmMs: number;
|
|
1479
|
+
maxSubagentIdleMs: number;
|
|
1480
|
+
targets: ReadonlyArray<{
|
|
1481
|
+
sessionKey: string;
|
|
1482
|
+
accountId?: string;
|
|
1483
|
+
cacheExpiresAt: number;
|
|
1484
|
+
lastWarmedAt?: number;
|
|
1485
|
+
backoffUntil?: number;
|
|
1486
|
+
}>;
|
|
1487
|
+
};
|
|
1488
|
+
start(): void;
|
|
1489
|
+
stop(): void;
|
|
1490
|
+
remove(sessionKey: string): void;
|
|
1491
|
+
}
|
|
1492
|
+
interface ResetTargetIdentity {
|
|
1493
|
+
accountKey: string;
|
|
1494
|
+
label: string;
|
|
1495
|
+
accessToken: string;
|
|
1496
|
+
chatgptAccountId?: string;
|
|
1497
|
+
onAuthFailure?: (status: number) => Promise<void>;
|
|
1498
|
+
}
|
|
1499
|
+
/** One live process, on an older version, that keeps the accounts from moving to the account pool. */
|
|
1500
|
+
interface MigrationBlocker {
|
|
1501
|
+
/** `'unknown'` when the directory of process heartbeats could not be read. */
|
|
1502
|
+
pid: number | 'unknown';
|
|
1503
|
+
version: string;
|
|
1504
|
+
}
|
|
1505
|
+
type MenuMigrationState = {
|
|
1506
|
+
migrated: true;
|
|
1507
|
+
} | {
|
|
1508
|
+
migrated: false;
|
|
1509
|
+
blockers: readonly MigrationBlocker[];
|
|
1510
|
+
};
|
|
1511
|
+
//#endregion
|
|
2202
1512
|
//#region src/core/version-fence.d.ts
|
|
2203
1513
|
/** One live process that keeps the fence shut. */
|
|
2204
1514
|
interface VersionFenceBlocker {
|
|
@@ -2431,4 +1741,4 @@ interface PoolLifecycleDeps {
|
|
|
2431
1741
|
paused?: () => boolean | Promise<boolean>;
|
|
2432
1742
|
}
|
|
2433
1743
|
//#endregion
|
|
2434
|
-
export {
|
|
1744
|
+
export { ResetTargetIdentity as a, BeginAccountLoginOptions as c, TokenResponse as d, beginAccountLogin as f, PoolStore as g, AccountPaths as h, MenuMigrationState as i, BeginAccountLoginResult as l, parseJwtClaims as m, HostSlotAdapter as n, OpenAiVault as o, extractAccountIdFromClaims as p, CacheKeepManager as r, OpenAiVaultOptions as s, PoolLifecycleDeps as t, IdTokenClaims as u };
|