@modelprofile.com/authswitch 6.4.0 → 7.0.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_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/authority-contract.d.ts +302 -6
- package/dist_ts/authority-contract.js +1 -1
- package/dist_ts/authority-runtime-contract.d.ts +15 -0
- package/dist_ts/authorityrehearsal.child.d.ts +1 -0
- package/dist_ts/authorityrehearsal.child.js +395 -0
- package/dist_ts/classes.accountlist.js +4 -3
- package/dist_ts/classes.authoritybackup.d.ts +134 -0
- package/dist_ts/classes.authoritybackup.js +769 -0
- package/dist_ts/classes.authoritybroker.d.ts +29 -6
- package/dist_ts/classes.authoritybroker.js +413 -122
- package/dist_ts/classes.authoritycli.d.ts +24 -0
- package/dist_ts/classes.authoritycli.js +675 -0
- package/dist_ts/classes.authorityclient.d.ts +34 -9
- package/dist_ts/classes.authorityclient.js +136 -38
- package/dist_ts/classes.authoritydaemon.d.ts +47 -0
- package/dist_ts/classes.authoritydaemon.js +705 -16
- package/dist_ts/classes.authoritydatabase.d.ts +182 -8
- package/dist_ts/classes.authoritydatabase.js +1188 -41
- package/dist_ts/classes.authoritymodels.d.ts +247 -1
- package/dist_ts/classes.authoritymodels.js +870 -6
- package/dist_ts/classes.authoritypreuse.d.ts +47 -0
- package/dist_ts/classes.authoritypreuse.js +278 -0
- package/dist_ts/classes.authorityregistry.d.ts +24 -0
- package/dist_ts/classes.authorityregistry.js +88 -0
- package/dist_ts/classes.authorityrehearsal.d.ts +127 -0
- package/dist_ts/classes.authorityrehearsal.js +632 -0
- package/dist_ts/classes.authorityusage.d.ts +160 -0
- package/dist_ts/classes.authorityusage.js +429 -0
- package/dist_ts/classes.claudeauthority.d.ts +66 -0
- package/dist_ts/classes.claudeauthority.js +532 -0
- package/dist_ts/classes.claudecodeharness.js +3 -2
- package/dist_ts/classes.claudecodelocks.d.ts +13 -0
- package/dist_ts/classes.claudecodelocks.js +75 -3
- package/dist_ts/classes.claudenative.d.ts +137 -0
- package/dist_ts/classes.claudenative.js +731 -0
- package/dist_ts/classes.claudestatus.d.ts +9 -0
- package/dist_ts/classes.claudestatus.js +26 -9
- package/dist_ts/classes.claudetokenrefresh.d.ts +15 -1
- package/dist_ts/classes.claudetokenrefresh.js +74 -21
- package/dist_ts/classes.codexharness.js +4 -2
- package/dist_ts/classes.codexmanaged.d.ts +91 -0
- package/dist_ts/classes.codexmanaged.js +404 -0
- package/dist_ts/classes.codexpreuse.d.ts +8 -0
- package/dist_ts/classes.codexpreuse.js +24 -6
- package/dist_ts/classes.fileharness.d.ts +2 -0
- package/dist_ts/classes.fileharness.js +6 -4
- package/dist_ts/classes.limits.js +12 -7
- package/dist_ts/classes.opencodeharness.js +2 -2
- package/dist_ts/claudehttp.d.ts +10 -0
- package/dist_ts/claudehttp.js +29 -3
- package/dist_ts/index.d.ts +2 -0
- package/dist_ts/index.js +8 -1
- package/dist_ts/interfaces.harness.d.ts +6 -0
- package/dist_ts/interfaces.list.d.ts +9 -3
- package/dist_ts/plugins.d.ts +7 -3
- package/dist_ts/plugins.js +9 -4
- package/dist_ts/ts_migration/0001_authority_meta.d.ts +3 -0
- package/dist_ts/ts_migration/0001_authority_meta.js +32 -0
- package/dist_ts/ts_migration/index.d.ts +3 -0
- package/dist_ts/ts_migration/index.js +6 -0
- package/package.json +12 -2
- package/readme.md +205 -13
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/authority-contract.ts +264 -9
- package/ts/authority-runtime-contract.ts +21 -1
- package/ts/authorityrehearsal.child.ts +330 -0
- package/ts/classes.accountlist.ts +3 -2
- package/ts/classes.authoritybackup.ts +780 -0
- package/ts/classes.authoritybroker.ts +410 -120
- package/ts/classes.authoritycli.ts +719 -0
- package/ts/classes.authorityclient.ts +164 -38
- package/ts/classes.authoritydaemon.ts +614 -17
- package/ts/classes.authoritydatabase.ts +1229 -44
- package/ts/classes.authoritymodels.ts +579 -4
- package/ts/classes.authoritypreuse.ts +297 -0
- package/ts/classes.authorityregistry.ts +118 -0
- package/ts/classes.authorityrehearsal.ts +625 -0
- package/ts/classes.authorityusage.ts +527 -0
- package/ts/classes.claudeauthority.ts +541 -0
- package/ts/classes.claudecodeharness.ts +2 -1
- package/ts/classes.claudecodelocks.ts +70 -1
- package/ts/classes.claudenative.ts +816 -0
- package/ts/classes.claudestatus.ts +38 -9
- package/ts/classes.claudetokenrefresh.ts +82 -19
- package/ts/classes.codexharness.ts +3 -1
- package/ts/classes.codexmanaged.ts +402 -0
- package/ts/classes.codexpreuse.ts +33 -5
- package/ts/classes.fileharness.ts +7 -3
- package/ts/classes.limits.ts +11 -6
- package/ts/classes.opencodeharness.ts +1 -1
- package/ts/claudehttp.ts +31 -2
- package/ts/index.ts +7 -0
- package/ts/interfaces.harness.ts +6 -0
- package/ts/interfaces.list.ts +9 -3
- package/ts/plugins.ts +9 -3
- package/ts/ts_migration/0001_authority_meta.ts +33 -0
- package/ts/ts_migration/index.ts +7 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as plugins from './plugins.js';
|
|
2
2
|
import type { IAuthSwitchAccount, IAuthSwitchAccountEvent, IAuthSwitchBinding, IAuthSwitchOperation, IAuthSwitchSnapshot } from './authority-contract.js';
|
|
3
3
|
import { AuthSwitchAuthorityDatabase } from './classes.authoritydatabase.js';
|
|
4
|
+
import type { IAuthSwitchUsageContext } from './classes.authorityusage.js';
|
|
4
5
|
import { type IAuthSwitchSecretCodec } from './classes.authoritysecrets.js';
|
|
5
|
-
type TOpenAiProvider = Pick<plugins.flexAccounts.ISmartAiProviderAdapter, 'beginLogin' | 'refreshCredential' | 'inspectCredential' | 'dispose'>;
|
|
6
|
+
type TOpenAiProvider = Pick<plugins.flexAccounts.ISmartAiProviderAdapter, 'beginLogin' | 'refreshCredential' | 'inspectCredential' | 'getAccountRateLimits' | 'dispose'>;
|
|
6
7
|
export interface IAuthSwitchAuthorityBrokerOptions {
|
|
7
8
|
provider?: TOpenAiProvider;
|
|
8
9
|
secrets?: IAuthSwitchSecretCodec;
|
|
@@ -16,6 +17,7 @@ export interface IAuthSwitchResolvedAccess {
|
|
|
16
17
|
expiresAt: string;
|
|
17
18
|
grantGeneration: number;
|
|
18
19
|
}
|
|
20
|
+
export declare const authSwitchBindingCapabilityHash: (capability: string) => string;
|
|
19
21
|
/** One daemon-owned authority. No management DTO contains a refresh grant. */
|
|
20
22
|
export declare class AuthSwitchAuthorityBroker {
|
|
21
23
|
private readonly database;
|
|
@@ -23,12 +25,18 @@ export declare class AuthSwitchAuthorityBroker {
|
|
|
23
25
|
private readonly secrets;
|
|
24
26
|
private readonly now;
|
|
25
27
|
private readonly proactive;
|
|
28
|
+
private readonly starts;
|
|
26
29
|
private readonly operations;
|
|
27
30
|
private readonly refreshes;
|
|
28
31
|
private readonly listeners;
|
|
32
|
+
private claudeRefresh?;
|
|
33
|
+
private maintenance?;
|
|
29
34
|
private timer?;
|
|
30
35
|
private closed;
|
|
36
|
+
private closing?;
|
|
31
37
|
constructor(database: AuthSwitchAuthorityDatabase, options?: IAuthSwitchAuthorityBrokerOptions);
|
|
38
|
+
setClaudeRefresher(refresh: (grantId: string) => Promise<void>): void;
|
|
39
|
+
notifyChanged(): void;
|
|
32
40
|
start(): Promise<void>;
|
|
33
41
|
private schedule;
|
|
34
42
|
refreshDueAccounts(): Promise<void>;
|
|
@@ -36,6 +44,7 @@ export declare class AuthSwitchAuthorityBroker {
|
|
|
36
44
|
private publish;
|
|
37
45
|
snapshot(options?: {
|
|
38
46
|
accountAfter?: string;
|
|
47
|
+
loginAfter?: string;
|
|
39
48
|
bindingAfter?: string;
|
|
40
49
|
limit?: number;
|
|
41
50
|
}): Promise<IAuthSwitchSnapshot>;
|
|
@@ -48,16 +57,25 @@ export declare class AuthSwitchAuthorityBroker {
|
|
|
48
57
|
private identity;
|
|
49
58
|
private sealCredential;
|
|
50
59
|
private unsealCredential;
|
|
51
|
-
|
|
52
|
-
|
|
60
|
+
private startDeviceOperation;
|
|
61
|
+
private finishStartingOperation;
|
|
62
|
+
beginAddOpenAi(operationId: string): Promise<IAuthSwitchOperation>;
|
|
63
|
+
beginReauthOpenAi(operationId: string, accountId: string, loginId: string, purpose: 'openai_managed', beforeNew?: () => Promise<void>): Promise<IAuthSwitchOperation>;
|
|
53
64
|
private beginLogin;
|
|
54
|
-
getOperation(operationId: string): IAuthSwitchOperation
|
|
55
|
-
|
|
65
|
+
getOperation(operationId: string): Promise<IAuthSwitchOperation>;
|
|
66
|
+
listOperations(after: string | null, limit?: number): Promise<{
|
|
67
|
+
operations: IAuthSwitchOperation[];
|
|
68
|
+
nextCursor: string | null;
|
|
69
|
+
}>;
|
|
70
|
+
/** Trusted daemon lifecycle hook: hold new managed runtimes out until targeted reauth settles. */
|
|
71
|
+
waitOperation(operationId: string): Promise<void>;
|
|
56
72
|
cancelOperation(operationId: string): Promise<IAuthSwitchOperation>;
|
|
57
73
|
renameAccount(accountId: string, expectedRevision: number, label: string): Promise<IAuthSwitchAccount>;
|
|
58
74
|
removeAccount(accountId: string, expectedRevision: number): Promise<IAuthSwitchAccount>;
|
|
59
75
|
bindAccount(input: {
|
|
60
76
|
accountId: string;
|
|
77
|
+
loginId: string;
|
|
78
|
+
purpose: 'openai_managed';
|
|
61
79
|
runtime: IAuthSwitchBinding['runtime'];
|
|
62
80
|
scopeId: string;
|
|
63
81
|
incarnationId: string;
|
|
@@ -65,7 +83,12 @@ export declare class AuthSwitchAuthorityBroker {
|
|
|
65
83
|
binding: IAuthSwitchBinding;
|
|
66
84
|
capability: string;
|
|
67
85
|
}>;
|
|
68
|
-
|
|
86
|
+
revokeBinding(bindingId: string, capability: string): Promise<boolean>;
|
|
87
|
+
releaseExternalBinding(bindingId: string, capability: string): Promise<'released' | 'inactive'>;
|
|
88
|
+
resolveAccess(bindingId: string, capability: string, minValidityMs: number, rejectedGrantGeneration?: number): Promise<IAuthSwitchResolvedAccess>;
|
|
89
|
+
/** Backend-only access for usage; it never creates or bypasses a runtime binding. */
|
|
90
|
+
resolveUsageAccess(context: IAuthSwitchUsageContext, rejectedGrantGeneration: number | undefined, minValidityMs: number): Promise<IAuthSwitchResolvedAccess>;
|
|
91
|
+
private resolveManagedAccess;
|
|
69
92
|
private refreshAccount;
|
|
70
93
|
private performRefresh;
|
|
71
94
|
close(): Promise<void>;
|