@modelprofile.com/authswitch 6.5.0 → 8.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.
Files changed (95) hide show
  1. package/dist_ts/00_commitinfo_data.js +1 -1
  2. package/dist_ts/authority-contract.d.ts +300 -6
  3. package/dist_ts/authority-contract.js +1 -1
  4. package/dist_ts/authority-runtime-contract.d.ts +13 -0
  5. package/dist_ts/classes.accountlist.js +4 -3
  6. package/dist_ts/classes.authoritybroker.d.ts +25 -5
  7. package/dist_ts/classes.authoritybroker.js +388 -123
  8. package/dist_ts/classes.authoritycli.d.ts +24 -0
  9. package/dist_ts/classes.authoritycli.js +675 -0
  10. package/dist_ts/classes.authorityclient.d.ts +19 -7
  11. package/dist_ts/classes.authorityclient.js +51 -14
  12. package/dist_ts/classes.authoritydaemon.d.ts +28 -1
  13. package/dist_ts/classes.authoritydaemon.js +477 -36
  14. package/dist_ts/classes.authoritydatabase.d.ts +155 -11
  15. package/dist_ts/classes.authoritydatabase.js +1037 -69
  16. package/dist_ts/classes.authoritymodels.d.ts +229 -23
  17. package/dist_ts/classes.authoritymodels.js +867 -128
  18. package/dist_ts/classes.authoritypreuse.d.ts +47 -0
  19. package/dist_ts/classes.authoritypreuse.js +277 -0
  20. package/dist_ts/classes.authorityregistry.d.ts +9 -0
  21. package/dist_ts/classes.authorityregistry.js +32 -0
  22. package/dist_ts/classes.authoritysecrets.d.ts +1 -1
  23. package/dist_ts/classes.authoritysecrets.js +2 -2
  24. package/dist_ts/classes.authorityusage.d.ts +160 -0
  25. package/dist_ts/classes.authorityusage.js +429 -0
  26. package/dist_ts/classes.claudeauthority.d.ts +66 -0
  27. package/dist_ts/classes.claudeauthority.js +528 -0
  28. package/dist_ts/classes.claudecodeharness.js +3 -2
  29. package/dist_ts/classes.claudecodelocks.d.ts +13 -0
  30. package/dist_ts/classes.claudecodelocks.js +75 -3
  31. package/dist_ts/classes.claudenative.d.ts +130 -0
  32. package/dist_ts/classes.claudenative.js +708 -0
  33. package/dist_ts/classes.claudestatus.d.ts +9 -0
  34. package/dist_ts/classes.claudestatus.js +26 -9
  35. package/dist_ts/classes.claudetokenrefresh.d.ts +15 -1
  36. package/dist_ts/classes.claudetokenrefresh.js +74 -21
  37. package/dist_ts/classes.codexharness.js +4 -2
  38. package/dist_ts/classes.codexmanaged.d.ts +12 -1
  39. package/dist_ts/classes.codexmanaged.js +75 -14
  40. package/dist_ts/classes.codexpreuse.d.ts +8 -0
  41. package/dist_ts/classes.codexpreuse.js +24 -6
  42. package/dist_ts/classes.fileharness.d.ts +2 -0
  43. package/dist_ts/classes.fileharness.js +6 -4
  44. package/dist_ts/classes.limits.js +12 -7
  45. package/dist_ts/classes.opencodeharness.js +2 -2
  46. package/dist_ts/claudehttp.d.ts +10 -0
  47. package/dist_ts/claudehttp.js +29 -3
  48. package/dist_ts/index.d.ts +1 -0
  49. package/dist_ts/index.js +7 -1
  50. package/dist_ts/interfaces.harness.d.ts +6 -0
  51. package/dist_ts/interfaces.list.d.ts +9 -3
  52. package/dist_ts/plugins.d.ts +6 -3
  53. package/dist_ts/plugins.js +8 -4
  54. package/dist_ts/ts_migration/0001_authority_meta.d.ts +13 -0
  55. package/dist_ts/ts_migration/0001_authority_meta.js +44 -0
  56. package/dist_ts/ts_migration/0002_remove_backup_records.d.ts +17 -0
  57. package/dist_ts/ts_migration/0002_remove_backup_records.js +48 -0
  58. package/dist_ts/ts_migration/index.d.ts +6 -0
  59. package/dist_ts/ts_migration/index.js +12 -0
  60. package/package.json +3 -3
  61. package/readme.md +177 -14
  62. package/ts/00_commitinfo_data.ts +1 -1
  63. package/ts/authority-contract.ts +262 -9
  64. package/ts/authority-runtime-contract.ts +14 -0
  65. package/ts/classes.accountlist.ts +3 -2
  66. package/ts/classes.authoritybroker.ts +385 -121
  67. package/ts/classes.authoritycli.ts +719 -0
  68. package/ts/classes.authorityclient.ts +75 -18
  69. package/ts/classes.authoritydaemon.ts +444 -36
  70. package/ts/classes.authoritydatabase.ts +1076 -75
  71. package/ts/classes.authoritymodels.ts +642 -144
  72. package/ts/classes.authoritypreuse.ts +296 -0
  73. package/ts/classes.authorityregistry.ts +47 -0
  74. package/ts/classes.authoritysecrets.ts +1 -1
  75. package/ts/classes.authorityusage.ts +527 -0
  76. package/ts/classes.claudeauthority.ts +537 -0
  77. package/ts/classes.claudecodeharness.ts +2 -1
  78. package/ts/classes.claudecodelocks.ts +70 -1
  79. package/ts/classes.claudenative.ts +785 -0
  80. package/ts/classes.claudestatus.ts +38 -9
  81. package/ts/classes.claudetokenrefresh.ts +82 -19
  82. package/ts/classes.codexharness.ts +3 -1
  83. package/ts/classes.codexmanaged.ts +76 -13
  84. package/ts/classes.codexpreuse.ts +33 -5
  85. package/ts/classes.fileharness.ts +7 -3
  86. package/ts/classes.limits.ts +11 -6
  87. package/ts/classes.opencodeharness.ts +1 -1
  88. package/ts/claudehttp.ts +31 -2
  89. package/ts/index.ts +6 -0
  90. package/ts/interfaces.harness.ts +6 -0
  91. package/ts/interfaces.list.ts +9 -3
  92. package/ts/plugins.ts +8 -3
  93. package/ts/ts_migration/0001_authority_meta.ts +45 -0
  94. package/ts/ts_migration/0002_remove_backup_records.ts +49 -0
  95. package/ts/ts_migration/index.ts +12 -0
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@modelprofile.com/authswitch',
6
- version: '6.5.0',
6
+ version: '8.0.0',
7
7
  description: 'Manage Codex, OpenCode and Claude Code accounts with guided switching and live usage status'
8
8
  };
9
9
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSw4QkFBOEI7SUFDcEMsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLDZGQUE2RjtDQUMzRyxDQUFBIn0=
@@ -1,20 +1,38 @@
1
1
  import type { ITypedRequest } from '@api.global/typedrequest-interfaces';
2
+ import type { IAuthSwitchUsageSnapshot } from './classes.authorityusage.js';
3
+ export type { IAuthSwitchUsageSnapshot } from './classes.authorityusage.js';
2
4
  /** Credential-free account management contract. Safe to import in browser code. */
3
- export type TAuthSwitchAccountHealth = 'ready' | 'refreshing' | 'retry_wait' | 'needs_reauth' | 'native' | 'legacy_native_pending' | 'removed';
5
+ export type TAuthSwitchLoginPurpose = 'openai_managed' | 'claude_host_native' | 'claude_container_setup' | 'opencode_native';
6
+ export type TAuthSwitchLoginHealth = 'ready' | 'refreshing' | 'retry_wait' | 'needs_reauth' | 'unverified' | 'pending_handoff' | 'handoff_quarantined' | 'removed';
4
7
  export interface IAuthSwitchAccount {
5
8
  id: string;
6
9
  providerId: string;
7
10
  label: string;
8
11
  email: string | null;
9
12
  plan: string | null;
10
- health: TAuthSwitchAccountHealth;
13
+ removed: boolean;
14
+ revision: number;
15
+ statusObservedAt: string;
16
+ }
17
+ /** One independently owned login. Native ownership does not imply observed health. */
18
+ export interface IAuthSwitchLogin {
19
+ id: string;
20
+ accountId: string;
21
+ providerId: string;
22
+ purpose: TAuthSwitchLoginPurpose;
11
23
  owner: 'daemon' | 'claude_native' | 'legacy_native' | 'none';
24
+ health: TAuthSwitchLoginHealth;
25
+ problem: 'none' | 'provider_unavailable' | 'exchange_uncertain' | 'provider_rejected' | 'native_owner';
12
26
  grantGeneration: number;
13
27
  revision: number;
14
28
  accessExpiresAt: string | null;
15
29
  retryAt: string | null;
16
- problem: 'none' | 'provider_unavailable' | 'exchange_uncertain' | 'provider_rejected' | 'native_owner';
17
30
  statusObservedAt: string;
31
+ capabilities: {
32
+ canReauthenticate: boolean;
33
+ canBind: boolean;
34
+ canPreuse: boolean;
35
+ };
18
36
  }
19
37
  export interface IAuthSwitchBinding {
20
38
  id: string;
@@ -25,15 +43,140 @@ export interface IAuthSwitchBinding {
25
43
  revision: number;
26
44
  }
27
45
  export interface IAuthSwitchSnapshot {
28
- schemaVersion: 1;
46
+ schemaVersion: 2;
29
47
  epoch: string;
30
48
  revision: number;
31
49
  generatedAt: string;
32
50
  accounts: IAuthSwitchAccount[];
51
+ logins: IAuthSwitchLogin[];
33
52
  bindings: IAuthSwitchBinding[];
34
53
  nextAccountCursor: string | null;
54
+ nextLoginCursor: string | null;
35
55
  nextBindingCursor: string | null;
36
56
  }
57
+ /** Persisted account evidence. No provider request is made while collecting diagnostics. */
58
+ export interface IAuthSwitchDoctorAccountEvidence {
59
+ id: string;
60
+ providerId: string;
61
+ removed: boolean;
62
+ statusObservedAt: string;
63
+ evidence: 'stored';
64
+ liveCheck: 'not_checked';
65
+ }
66
+ /** Persisted login evidence. Stored readiness is not a live provider-health claim. */
67
+ export interface IAuthSwitchDoctorLoginEvidence {
68
+ id: string;
69
+ accountId: string;
70
+ providerId: string;
71
+ purpose: TAuthSwitchLoginPurpose;
72
+ owner: 'daemon' | 'claude_native' | 'legacy_native' | 'none';
73
+ state: 'ready' | 'exchange_may_have_been_sent' | 'retry_wait' | 'needs_reauth' | 'native' | 'legacy_native_pending' | 'handoff_pending' | 'handoff_quarantined' | 'removed';
74
+ problem: 'none' | 'provider_unavailable' | 'exchange_uncertain' | 'provider_rejected' | 'native_owner';
75
+ grantGeneration: number;
76
+ authorizationGeneration: number;
77
+ accessExpiresAt: string | null;
78
+ retryAt: string | null;
79
+ statusObservedAt: string;
80
+ evidence: 'stored';
81
+ liveCheck: 'not_checked';
82
+ }
83
+ export interface IAuthSwitchDoctorManagedCodex {
84
+ homeId: string;
85
+ accountId: string;
86
+ loginId: string;
87
+ scopeId: string;
88
+ health: 'healthy' | 'degraded' | 'unknown';
89
+ durable: {
90
+ state: 'idle' | 'launch_prepared' | 'registered';
91
+ runId: string | null;
92
+ pid: number | null;
93
+ startedAt: string | null;
94
+ };
95
+ daemon: {
96
+ state: 'untracked' | 'starting' | 'ready' | 'stopping' | 'degraded';
97
+ assignment: 'untracked' | 'matches' | 'mismatch';
98
+ };
99
+ process: {
100
+ state: 'not_expected' | 'absent' | 'observed' | 'unknown';
101
+ identity: 'not_applicable' | 'unregistered' | 'matches' | 'mismatch' | 'unknown';
102
+ pid: number | null;
103
+ startedAt: string | null;
104
+ observedAt: string;
105
+ problem: 'none' | 'inspection_failed' | 'multiple_claimants';
106
+ };
107
+ }
108
+ export interface IAuthSwitchDoctorClaudeHome {
109
+ id: string;
110
+ activeAccountId: string;
111
+ activeLoginId: string;
112
+ pendingOperationId: string | null;
113
+ status: 'ready' | 'quarantined';
114
+ revision: number;
115
+ createdAt: string;
116
+ }
117
+ export interface IAuthSwitchDoctorClaudeHandoff {
118
+ id: string;
119
+ homeId: string;
120
+ outgoingAccountId: string;
121
+ outgoingLoginId: string;
122
+ incomingAccountId: string;
123
+ incomingLoginId: string;
124
+ phase: 'reserved' | 'prepared' | 'committed' | 'aborted' | 'quarantined';
125
+ problem: 'none' | 'native_uncertain' | 'foreign_or_torn' | 'unsupported_effective_auth' | 'database_uncertain';
126
+ runningEffectiveAuth: 'no_scoped_sessions' | 'unsupported_effective_auth' | null;
127
+ startedAt: string;
128
+ updatedAt: string;
129
+ revision: number;
130
+ }
131
+ export interface IAuthSwitchDoctorNativeHandoff {
132
+ id: string;
133
+ accountId: string;
134
+ loginId: string;
135
+ nativeHomeId: string;
136
+ direction: 'to_native' | 'to_daemon';
137
+ phase: 'prepared' | 'source_stopped' | 'target_written' | 'verified' | 'committed' | 'needs_reauth' | 'aborted';
138
+ operationId: string;
139
+ revision: number;
140
+ statusObservedAt: string;
141
+ }
142
+ export interface IAuthSwitchDoctorMigration {
143
+ id: string;
144
+ sourceKind: 'authswitch_stash' | 'authswitch_backup' | 'agl_flex' | 'codex_native' | 'opencode_native' | 'claude_native';
145
+ status: 'pending_native_owner' | 'prepared' | 'verified' | 'complete' | 'quarantined';
146
+ accountId: string | null;
147
+ loginId: string | null;
148
+ revision: number;
149
+ statusObservedAt: string;
150
+ }
151
+ /** One independently observed diagnostic page. Separate pages are not one atomic global snapshot. */
152
+ export interface IAuthSwitchDoctorPage {
153
+ observedAt: string;
154
+ daemon: {
155
+ state: 'ready' | 'closing';
156
+ claudeNativeAuthority: 'configured' | 'not_configured';
157
+ observedAt: string;
158
+ };
159
+ database: {
160
+ state: 'available';
161
+ observedAt: string;
162
+ epoch: string;
163
+ revision: number;
164
+ };
165
+ accounts: IAuthSwitchDoctorAccountEvidence[];
166
+ logins: IAuthSwitchDoctorLoginEvidence[];
167
+ managedCodex: IAuthSwitchDoctorManagedCodex[];
168
+ claudeHomes: IAuthSwitchDoctorClaudeHome[];
169
+ claudeHandoffs: IAuthSwitchDoctorClaudeHandoff[];
170
+ nativeHandoffs: IAuthSwitchDoctorNativeHandoff[];
171
+ migrations: IAuthSwitchDoctorMigration[];
172
+ nextAccountCursor: string | null;
173
+ nextLoginCursor: string | null;
174
+ nextCodexHomeCursor: string | null;
175
+ nextClaudeHomeCursor: string | null;
176
+ nextClaudeHandoffCursor: string | null;
177
+ nextNativeHandoffCursor: string | null;
178
+ nextMigrationCursor: string | null;
179
+ }
37
180
  export interface IAuthSwitchAccountEvent {
38
181
  epoch: string;
39
182
  revision: number;
@@ -50,15 +193,91 @@ export type TAuthSwitchLoginPrompt = {
50
193
  };
51
194
  export interface IAuthSwitchOperation {
52
195
  id: string;
53
- state: 'pending' | 'complete' | 'failed' | 'cancelled';
196
+ kind: 'add_openai' | 'reauth_openai';
197
+ purpose: 'openai_managed';
198
+ targetAccountId: string | null;
199
+ targetLoginId: string | null;
200
+ state: 'starting' | 'pending' | 'committing' | 'complete' | 'failed' | 'cancelled' | 'interrupted' | 'outcome_unknown';
54
201
  prompt: TAuthSwitchLoginPrompt | null;
55
- account: IAuthSwitchAccount | null;
202
+ result: {
203
+ accountId: string;
204
+ loginId: string;
205
+ accountRevision: number;
206
+ loginGeneration: number;
207
+ } | null;
56
208
  error: string | null;
209
+ createdAt: string;
210
+ updatedAt: string;
211
+ finishedAt: string | null;
212
+ revision: number;
213
+ }
214
+ /** Credential-free receipt for one exact, never-replayed quota-consuming request. */
215
+ export interface IAuthSwitchPreuseOperation {
216
+ id: string;
217
+ accountId: string;
218
+ loginId: string;
219
+ purpose: 'openai_managed';
220
+ requestedModel: string | null;
221
+ model: string | null;
222
+ state: 'preparing' | 'request_may_have_started' | 'complete' | 'not_sent' | 'outcome_unknown';
223
+ result: {
224
+ inputTokens: number | null;
225
+ outputTokens: number | null;
226
+ totalTokens: number | null;
227
+ } | null;
228
+ problem: 'none' | 'target_unavailable' | 'access_unavailable' | 'catalog_unavailable' | 'account_busy' | 'cancelled' | 'authority_closing' | 'interrupted' | 'request_uncertain';
229
+ createdAt: string;
230
+ updatedAt: string;
231
+ finishedAt: string | null;
232
+ revision: number;
233
+ }
234
+ /** Credential-free native file ownership result. It makes no claim about a running session's active request. */
235
+ export interface IAuthSwitchClaudeNativeHandoff {
236
+ id: string;
237
+ homeId: string;
238
+ outgoingAccountId: string;
239
+ incomingAccountId: string;
240
+ phase: 'reserved' | 'prepared' | 'committed' | 'aborted' | 'quarantined';
241
+ problem: 'none' | 'native_uncertain' | 'foreign_or_torn' | 'unsupported_effective_auth' | 'database_uncertain';
242
+ runningEffectiveAuth: 'no_scoped_sessions' | 'unsupported_effective_auth' | null;
243
+ updatedAt: string;
244
+ }
245
+ export interface IReq_AuthSwitchSwitchClaudeNative extends ITypedRequest {
246
+ method: 'authswitch.authority.claude.switch';
247
+ request: {
248
+ accountId: string;
249
+ loginId: string;
250
+ purpose: 'claude_host_native';
251
+ };
252
+ response: {
253
+ handoff: IAuthSwitchClaudeNativeHandoff;
254
+ };
255
+ }
256
+ export interface IReq_AuthSwitchClaudeNativeHandoff extends ITypedRequest {
257
+ method: 'authswitch.authority.claude.handoff';
258
+ request: {
259
+ operationId: string;
260
+ };
261
+ response: {
262
+ handoff: IAuthSwitchClaudeNativeHandoff;
263
+ };
264
+ }
265
+ export interface IReq_AuthSwitchClaudeNativeHandoffs extends ITypedRequest {
266
+ method: 'authswitch.authority.claude.handoffs';
267
+ request: {
268
+ after?: string;
269
+ limit?: number;
270
+ };
271
+ response: {
272
+ handoffs: IAuthSwitchClaudeNativeHandoff[];
273
+ nextCursor: string | null;
274
+ };
57
275
  }
58
276
  export interface IReq_AuthSwitchSnapshot extends ITypedRequest {
59
277
  method: 'authswitch.authority.snapshot';
60
278
  request: {
61
279
  accountAfter?: string;
280
+ loginAfter?: string;
62
281
  bindingAfter?: string;
63
282
  limit?: number;
64
283
  };
@@ -66,6 +285,34 @@ export interface IReq_AuthSwitchSnapshot extends ITypedRequest {
66
285
  snapshot: IAuthSwitchSnapshot;
67
286
  };
68
287
  }
288
+ export interface IReq_AuthSwitchDoctor extends ITypedRequest {
289
+ method: 'authswitch.authority.doctor';
290
+ request: {
291
+ accountAfter?: string;
292
+ loginAfter?: string;
293
+ codexHomeAfter?: string;
294
+ claudeHomeAfter?: string;
295
+ claudeHandoffAfter?: string;
296
+ nativeHandoffAfter?: string;
297
+ migrationAfter?: string;
298
+ limit?: number;
299
+ };
300
+ response: {
301
+ page: IAuthSwitchDoctorPage;
302
+ };
303
+ }
304
+ /** Management-only usage read. The DTO contains no access or refresh credential. */
305
+ export interface IReq_AuthSwitchUsage extends ITypedRequest {
306
+ method: 'authswitch.authority.usage';
307
+ request: {
308
+ accountId: string;
309
+ loginId: string;
310
+ force?: boolean;
311
+ };
312
+ response: {
313
+ usage: IAuthSwitchUsageSnapshot;
314
+ };
315
+ }
69
316
  export interface IReq_AuthSwitchEvents extends ITypedRequest {
70
317
  method: 'authswitch.authority.events';
71
318
  request: {
@@ -83,6 +330,7 @@ export interface IReq_AuthSwitchEvents extends ITypedRequest {
83
330
  export interface IReq_AuthSwitchBeginAdd extends ITypedRequest {
84
331
  method: 'authswitch.authority.add';
85
332
  request: {
333
+ operationId: string;
86
334
  providerId: 'openai';
87
335
  flow: 'device';
88
336
  };
@@ -93,13 +341,27 @@ export interface IReq_AuthSwitchBeginAdd extends ITypedRequest {
93
341
  export interface IReq_AuthSwitchBeginReauth extends ITypedRequest {
94
342
  method: 'authswitch.authority.reauth';
95
343
  request: {
344
+ operationId: string;
96
345
  accountId: string;
346
+ loginId: string;
347
+ purpose: 'openai_managed';
97
348
  flow: 'device';
98
349
  };
99
350
  response: {
100
351
  operation: IAuthSwitchOperation;
101
352
  };
102
353
  }
354
+ export interface IReq_AuthSwitchListOperations extends ITypedRequest {
355
+ method: 'authswitch.authority.operations';
356
+ request: {
357
+ after?: string;
358
+ limit?: number;
359
+ };
360
+ response: {
361
+ operations: IAuthSwitchOperation[];
362
+ nextCursor: string | null;
363
+ };
364
+ }
103
365
  export interface IReq_AuthSwitchGetOperation extends ITypedRequest {
104
366
  method: 'authswitch.authority.operation';
105
367
  request: {
@@ -118,6 +380,38 @@ export interface IReq_AuthSwitchCancelOperation extends ITypedRequest {
118
380
  operation: IAuthSwitchOperation;
119
381
  };
120
382
  }
383
+ export interface IReq_AuthSwitchStartPreuse extends ITypedRequest {
384
+ method: 'authswitch.authority.preuse.start';
385
+ request: {
386
+ operationId: string;
387
+ accountId: string;
388
+ loginId: string;
389
+ purpose: 'openai_managed';
390
+ prompt: string;
391
+ model?: string;
392
+ };
393
+ response: {
394
+ operation: IAuthSwitchPreuseOperation;
395
+ };
396
+ }
397
+ export interface IReq_AuthSwitchGetPreuse extends ITypedRequest {
398
+ method: 'authswitch.authority.preuse.operation';
399
+ request: {
400
+ operationId: string;
401
+ };
402
+ response: {
403
+ operation: IAuthSwitchPreuseOperation;
404
+ };
405
+ }
406
+ export interface IReq_AuthSwitchCancelPreuse extends ITypedRequest {
407
+ method: 'authswitch.authority.preuse.cancel';
408
+ request: {
409
+ operationId: string;
410
+ };
411
+ response: {
412
+ operation: IAuthSwitchPreuseOperation;
413
+ };
414
+ }
121
415
  export interface IReq_AuthSwitchRenameAccount extends ITypedRequest {
122
416
  method: 'authswitch.authority.rename';
123
417
  request: {
@@ -1,3 +1,3 @@
1
1
  export {};
2
2
  /** Runtime capability is returned only to trusted backend callers; do not expose this response in a browser API. */
3
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0aG9yaXR5LWNvbnRyYWN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvYXV0aG9yaXR5LWNvbnRyYWN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUE0R0Esb0hBQW9IIn0=
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0aG9yaXR5LWNvbnRyYWN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvYXV0aG9yaXR5LWNvbnRyYWN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUF5V0Esb0hBQW9IIn0=
@@ -5,6 +5,8 @@ export interface IReq_AuthSwitchBindAccount extends ITypedRequest {
5
5
  method: 'authswitch.authority.bind';
6
6
  request: {
7
7
  accountId: string;
8
+ loginId: string;
9
+ purpose: 'openai_managed';
8
10
  runtime: IAuthSwitchBinding['runtime'];
9
11
  scopeId: string;
10
12
  incarnationId: string;
@@ -32,3 +34,14 @@ export interface IReq_AuthSwitchResolveAccess extends ITypedRequest {
32
34
  grantGeneration: number;
33
35
  };
34
36
  }
37
+ /** Backend-only release for one exact external runtime capability. */
38
+ export interface IReq_AuthSwitchReleaseBinding extends ITypedRequest {
39
+ method: 'authswitch.authority.release';
40
+ request: {
41
+ bindingId: string;
42
+ capability: string;
43
+ };
44
+ response: {
45
+ state: 'released' | 'inactive';
46
+ };
47
+ }
@@ -25,7 +25,8 @@ export const readAccountList = async (harnessesArg) => {
25
25
  result.saveUnavailableReason = state.saveUnavailableReason;
26
26
  result.credentialDrift = state.credentialDrift ?? [];
27
27
  result.accounts = rows.map(({ account, status }) => ({
28
- id: account.id, label: account.label, isActive: account.isActive, isStashed: account.isStashed,
28
+ id: account.id, providerAccountId: account.providerAccountId, label: account.label,
29
+ isActive: account.isActive, isStashed: account.isStashed,
29
30
  savedAt: account.savedAt, details: [...account.details], ...(account.slotId === undefined ? {} : { slotId: account.slotId }),
30
31
  status: publicStatus(status),
31
32
  }));
@@ -36,9 +37,9 @@ export const readAccountList = async (harnessesArg) => {
36
37
  harnesses.push(result);
37
38
  }
38
39
  return {
39
- schemaVersion: 2, generatedAt: new Date().toISOString(),
40
+ schemaVersion: 3, generatedAt: new Date().toISOString(),
40
41
  complete: harnesses.every(harness => !harness.problems.length && harness.accounts.every(account => !account.status.problems.length)),
41
42
  harnesses,
42
43
  };
43
44
  };
44
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xhc3Nlcy5hY2NvdW50bGlzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2NsYXNzZXMuYWNjb3VudGxpc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGVBQWUsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUloRCx5R0FBeUc7QUFDekcsTUFBTSxZQUFZLEdBQUcsQ0FBQyxTQUFnQyxFQUF5QixFQUFFO0lBQy9FLE1BQU0sT0FBTyxHQUFHLFNBQVMsQ0FBQyxPQUFPLENBQUM7SUFDbEMsT0FBTztRQUNMLEtBQUssRUFBRSxTQUFTLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUFDLEVBQUUsS0FBSyxFQUFFLEtBQUssRUFBRSxPQUFPLEVBQUUsVUFBVSxFQUFFLEVBQUUsRUFBRSxDQUFDLENBQUMsRUFBRSxLQUFLLEVBQUUsS0FBSyxFQUFFLE9BQU8sRUFBRSxVQUFVLEVBQUUsQ0FBQyxDQUFDO1FBQzlHLFF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QyJ9
@@ -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,18 +57,25 @@ export declare class AuthSwitchAuthorityBroker {
48
57
  private identity;
49
58
  private sealCredential;
50
59
  private unsealCredential;
51
- beginAddOpenAi(): Promise<IAuthSwitchOperation>;
52
- beginReauthOpenAi(accountId: string): Promise<IAuthSwitchOperation>;
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;
65
+ getOperation(operationId: string): Promise<IAuthSwitchOperation>;
66
+ listOperations(after: string | null, limit?: number): Promise<{
67
+ operations: IAuthSwitchOperation[];
68
+ nextCursor: string | null;
69
+ }>;
55
70
  /** Trusted daemon lifecycle hook: hold new managed runtimes out until targeted reauth settles. */
56
71
  waitOperation(operationId: string): Promise<void>;
57
- private pruneOperations;
58
72
  cancelOperation(operationId: string): Promise<IAuthSwitchOperation>;
59
73
  renameAccount(accountId: string, expectedRevision: number, label: string): Promise<IAuthSwitchAccount>;
60
74
  removeAccount(accountId: string, expectedRevision: number): Promise<IAuthSwitchAccount>;
61
75
  bindAccount(input: {
62
76
  accountId: string;
77
+ loginId: string;
78
+ purpose: 'openai_managed';
63
79
  runtime: IAuthSwitchBinding['runtime'];
64
80
  scopeId: string;
65
81
  incarnationId: string;
@@ -68,7 +84,11 @@ export declare class AuthSwitchAuthorityBroker {
68
84
  capability: string;
69
85
  }>;
70
86
  revokeBinding(bindingId: string, capability: string): Promise<boolean>;
87
+ releaseExternalBinding(bindingId: string, capability: string): Promise<'released' | 'inactive'>;
71
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;
72
92
  private refreshAccount;
73
93
  private performRefresh;
74
94
  close(): Promise<void>;