@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,12 +1,16 @@
|
|
|
1
1
|
import type { ITypedRequest } from '@api.global/typedrequest-interfaces';
|
|
2
2
|
import * as plugins from './plugins.js';
|
|
3
3
|
import type {
|
|
4
|
-
IAuthSwitchAccountEvent, IAuthSwitchSnapshot, IReq_AuthSwitchBeginAdd,
|
|
5
|
-
IReq_AuthSwitchBeginReauth, IReq_AuthSwitchCancelOperation,
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
IAuthSwitchAccountEvent, IAuthSwitchSnapshot, IReq_AuthSwitchBeginAdd, IReq_AuthSwitchDoctor,
|
|
5
|
+
IReq_AuthSwitchBeginReauth, IReq_AuthSwitchCancelOperation,
|
|
6
|
+
IReq_AuthSwitchClaudeNativeHandoff, IReq_AuthSwitchClaudeNativeHandoffs,
|
|
7
|
+
IReq_AuthSwitchSwitchClaudeNative, IReq_AuthSwitchEvents,
|
|
8
|
+
IReq_AuthSwitchGetOperation, IReq_AuthSwitchListOperations, IReq_AuthSwitchRemoveAccount, IReq_AuthSwitchRenameAccount,
|
|
9
|
+
IReq_AuthSwitchCancelPreuse, IReq_AuthSwitchGetPreuse, IReq_AuthSwitchSnapshot,
|
|
10
|
+
IReq_AuthSwitchStartPreuse, IReq_AuthSwitchUsage,
|
|
8
11
|
} from './authority-contract.js';
|
|
9
|
-
import type { IReq_AuthSwitchBindAccount,
|
|
12
|
+
import type { IReq_AuthSwitchBindAccount, IReq_AuthSwitchReleaseBinding,
|
|
13
|
+
IReq_AuthSwitchResolveAccess } from './authority-runtime-contract.js';
|
|
10
14
|
import { AuthSwitchAuthorityFrameReader, authSwitchAuthorityFrameBytes,
|
|
11
15
|
maxAuthSwitchAuthorityFrameBytes } from './classes.authorityframing.js';
|
|
12
16
|
|
|
@@ -47,6 +51,21 @@ const post = (path: string, payload: ITypedRequest, signal?: AbortSignal): Promi
|
|
|
47
51
|
});
|
|
48
52
|
};
|
|
49
53
|
|
|
54
|
+
/** A snapshot is usable only while state is current; lastVerifiedAt is the last successful daemon proof. */
|
|
55
|
+
export interface IAuthSwitchSubscriptionStatus {
|
|
56
|
+
state: 'current' | 'unavailable' | 'closed';
|
|
57
|
+
reason: 'initial' | 'snapshot' | 'event' | 'heartbeat' | 'disconnect' | 'resync' | 'abort' | 'consumer_error';
|
|
58
|
+
epoch: string | null;
|
|
59
|
+
revision: number | null;
|
|
60
|
+
lastVerifiedAt: string | null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface IAuthSwitchSubscriptionOptions {
|
|
64
|
+
onStatus?: (status: IAuthSwitchSubscriptionStatus) => void | Promise<void>;
|
|
65
|
+
/** Bounded long-poll interval; defaults to 30 seconds. */
|
|
66
|
+
heartbeatMs?: number;
|
|
67
|
+
}
|
|
68
|
+
|
|
50
69
|
/** Node-only client for the per-user daemon. Each request has its own bounded Unix connection. */
|
|
51
70
|
export class AuthSwitchClient {
|
|
52
71
|
private readonly target: plugins.typedrequest.TypedTarget;
|
|
@@ -73,28 +92,41 @@ export class AuthSwitchClient {
|
|
|
73
92
|
return (await this.request<IReq_AuthSwitchSnapshot>('authswitch.authority.snapshot', options, 35_000, false, signal)).snapshot;
|
|
74
93
|
}
|
|
75
94
|
|
|
95
|
+
/** One independently stamped diagnostic page; callers may continue with its independent cursors. */
|
|
96
|
+
public async doctorPage(options: IReq_AuthSwitchDoctor['request'] = {}, signal?: AbortSignal): Promise<IReq_AuthSwitchDoctor['response']['page']> {
|
|
97
|
+
return (await this.request<IReq_AuthSwitchDoctor>('authswitch.authority.doctor', options, 35_000, false, signal)).page;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
public async getUsage(accountId: string, loginId: string, force = false): Promise<IReq_AuthSwitchUsage['response']['usage']> {
|
|
101
|
+
return (await this.request<IReq_AuthSwitchUsage>('authswitch.authority.usage',
|
|
102
|
+
{ accountId, loginId, force })).usage;
|
|
103
|
+
}
|
|
104
|
+
|
|
76
105
|
/** Assemble a consistent view from bounded database pages; restart if a writer changes the revision. */
|
|
77
106
|
public async snapshotAll(options: { limit?: number; signal?: AbortSignal } = {}): Promise<IAuthSwitchSnapshot> {
|
|
78
107
|
while (true) {
|
|
79
108
|
if (options.signal?.aborted) throw options.signal.reason ?? new Error('Account snapshot cancelled.');
|
|
80
109
|
let accountAfter: string | undefined;
|
|
110
|
+
let loginAfter: string | undefined;
|
|
81
111
|
let bindingAfter: string | undefined;
|
|
82
112
|
let aggregate: IAuthSwitchSnapshot | undefined;
|
|
83
113
|
let changed = false;
|
|
84
114
|
while (true) {
|
|
85
|
-
const page = await this.snapshot({ accountAfter, bindingAfter, limit: options.limit }, options.signal);
|
|
86
|
-
if (!aggregate) aggregate = { ...page, accounts: [...page.accounts], bindings: [...page.bindings] };
|
|
115
|
+
const page = await this.snapshot({ accountAfter, loginAfter, bindingAfter, limit: options.limit }, options.signal);
|
|
116
|
+
if (!aggregate) aggregate = { ...page, accounts: [...page.accounts], logins: [...page.logins], bindings: [...page.bindings] };
|
|
87
117
|
else if (aggregate.epoch !== page.epoch || aggregate.revision !== page.revision) {
|
|
88
118
|
changed = true;
|
|
89
119
|
break;
|
|
90
120
|
} else {
|
|
91
121
|
aggregate.accounts.push(...page.accounts);
|
|
122
|
+
aggregate.logins.push(...page.logins);
|
|
92
123
|
aggregate.bindings.push(...page.bindings);
|
|
93
124
|
}
|
|
94
125
|
accountAfter = page.nextAccountCursor ?? accountAfter ?? page.accounts.at(-1)?.id;
|
|
126
|
+
loginAfter = page.nextLoginCursor ?? loginAfter ?? page.logins.at(-1)?.id;
|
|
95
127
|
bindingAfter = page.nextBindingCursor ?? bindingAfter ?? page.bindings.at(-1)?.id;
|
|
96
|
-
if (!page.nextAccountCursor && !page.nextBindingCursor) {
|
|
97
|
-
return { ...aggregate, nextAccountCursor: null, nextBindingCursor: null };
|
|
128
|
+
if (!page.nextAccountCursor && !page.nextLoginCursor && !page.nextBindingCursor) {
|
|
129
|
+
return { ...aggregate, nextAccountCursor: null, nextLoginCursor: null, nextBindingCursor: null };
|
|
98
130
|
}
|
|
99
131
|
}
|
|
100
132
|
if (!changed) throw new Error('Authority snapshot could not complete.');
|
|
@@ -105,53 +137,130 @@ export class AuthSwitchClient {
|
|
|
105
137
|
return this.request<IReq_AuthSwitchEvents>('authswitch.authority.events', { epoch, afterRevision, waitMs }, waitMs + 5_000, false, signal);
|
|
106
138
|
}
|
|
107
139
|
|
|
108
|
-
/**
|
|
140
|
+
/** Snapshot callback runs after every known change; onStatus invalidates it on disconnect, resync or abort. */
|
|
109
141
|
public async subscribe(onSnapshot: (snapshot: IAuthSwitchSnapshot) => void | Promise<void>,
|
|
110
|
-
onEvent: (event: IAuthSwitchAccountEvent) => void | Promise<void>, signal: AbortSignal
|
|
142
|
+
onEvent: (event: IAuthSwitchAccountEvent) => void | Promise<void>, signal: AbortSignal,
|
|
143
|
+
options: IAuthSwitchSubscriptionOptions = {}): Promise<void> {
|
|
144
|
+
const heartbeatMs = options.heartbeatMs ?? 30_000;
|
|
145
|
+
if (!Number.isSafeInteger(heartbeatMs) || heartbeatMs < 50 || heartbeatMs > 30_000) {
|
|
146
|
+
throw new Error('Authswitch subscription heartbeat must be 50–30000 ms.');
|
|
147
|
+
}
|
|
111
148
|
const retry = () => new Promise<void>(resolve => {
|
|
112
149
|
const timer = setTimeout(() => { signal.removeEventListener('abort', aborted); resolve(); }, 250);
|
|
113
150
|
const aborted = () => { clearTimeout(timer); resolve(); };
|
|
114
151
|
signal.addEventListener('abort', aborted, { once: true });
|
|
115
152
|
});
|
|
116
153
|
let snapshot: IAuthSwitchSnapshot | undefined;
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
154
|
+
let available = false;
|
|
155
|
+
let lastVerifiedAt: string | null = null;
|
|
156
|
+
let lastEpoch: string | null = null;
|
|
157
|
+
let lastRevision: number | null = null;
|
|
158
|
+
const status = async (state: IAuthSwitchSubscriptionStatus['state'],
|
|
159
|
+
reason: IAuthSwitchSubscriptionStatus['reason']): Promise<void> => {
|
|
160
|
+
await options.onStatus?.({ state, reason, epoch: lastEpoch, revision: lastRevision, lastVerifiedAt });
|
|
161
|
+
};
|
|
162
|
+
const invalidate = async (reason: 'disconnect' | 'resync'): Promise<void> => {
|
|
163
|
+
snapshot = undefined;
|
|
164
|
+
if (available) { available = false; await status('unavailable', reason); }
|
|
165
|
+
};
|
|
166
|
+
try {
|
|
167
|
+
if (!signal.aborted) await status('unavailable', 'initial');
|
|
168
|
+
while (!signal.aborted) {
|
|
169
|
+
if (!snapshot) {
|
|
170
|
+
let fresh: IAuthSwitchSnapshot;
|
|
171
|
+
try { fresh = await this.snapshotAll({ signal }); }
|
|
172
|
+
catch {
|
|
173
|
+
if (signal.aborted) break;
|
|
174
|
+
await invalidate('disconnect');
|
|
175
|
+
await retry();
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
snapshot = fresh;
|
|
179
|
+
await onSnapshot(fresh);
|
|
180
|
+
available = true;
|
|
181
|
+
lastEpoch = fresh.epoch;
|
|
182
|
+
lastRevision = fresh.revision;
|
|
183
|
+
lastVerifiedAt = new Date().toISOString();
|
|
184
|
+
await status('current', 'snapshot');
|
|
185
|
+
}
|
|
186
|
+
let result: IReq_AuthSwitchEvents['response'];
|
|
187
|
+
try { result = await this.events(snapshot.epoch, snapshot.revision, heartbeatMs, signal); }
|
|
120
188
|
catch {
|
|
121
189
|
if (signal.aborted) break;
|
|
190
|
+
await invalidate('disconnect');
|
|
122
191
|
await retry();
|
|
123
192
|
continue;
|
|
124
193
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
if (
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
194
|
+
if (result.resyncRequired || result.epoch !== snapshot.epoch
|
|
195
|
+
|| (result.events.length === 0 && result.revision !== snapshot.revision)) {
|
|
196
|
+
await invalidate('resync');
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
if (result.events.length) {
|
|
200
|
+
let fresh: IAuthSwitchSnapshot;
|
|
201
|
+
try { fresh = await this.snapshotAll({ signal }); }
|
|
202
|
+
catch {
|
|
203
|
+
if (signal.aborted) break;
|
|
204
|
+
await invalidate('disconnect');
|
|
205
|
+
await retry();
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
if (fresh.epoch !== result.epoch || fresh.revision < result.revision) {
|
|
209
|
+
await invalidate('resync');
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
snapshot = fresh;
|
|
213
|
+
await onSnapshot(fresh);
|
|
214
|
+
for (const event of result.events) await onEvent(event);
|
|
215
|
+
lastEpoch = fresh.epoch;
|
|
216
|
+
lastRevision = fresh.revision;
|
|
217
|
+
lastVerifiedAt = new Date().toISOString();
|
|
218
|
+
await status('current', 'event');
|
|
219
|
+
} else {
|
|
220
|
+
lastVerifiedAt = new Date().toISOString();
|
|
221
|
+
await status('current', 'heartbeat');
|
|
222
|
+
}
|
|
138
223
|
}
|
|
139
|
-
|
|
140
|
-
|
|
224
|
+
} finally {
|
|
225
|
+
available = false;
|
|
226
|
+
await status('closed', signal.aborted ? 'abort' : 'consumer_error');
|
|
141
227
|
}
|
|
142
228
|
}
|
|
143
229
|
|
|
144
|
-
public async beginAddOpenAi(): Promise<IReq_AuthSwitchBeginAdd['response']['operation']> {
|
|
145
|
-
return (await this.request<IReq_AuthSwitchBeginAdd>('authswitch.authority.add',
|
|
230
|
+
public async beginAddOpenAi(operationId: string, signal?: AbortSignal): Promise<IReq_AuthSwitchBeginAdd['response']['operation']> {
|
|
231
|
+
return (await this.request<IReq_AuthSwitchBeginAdd>('authswitch.authority.add',
|
|
232
|
+
{ operationId, providerId: 'openai', flow: 'device' }, 35_000, false, signal)).operation;
|
|
233
|
+
}
|
|
234
|
+
public async beginReauthOpenAi(operationId: string, accountId: string, loginId: string,
|
|
235
|
+
purpose: 'openai_managed', signal?: AbortSignal): Promise<IReq_AuthSwitchBeginReauth['response']['operation']> {
|
|
236
|
+
return (await this.request<IReq_AuthSwitchBeginReauth>('authswitch.authority.reauth',
|
|
237
|
+
{ operationId, accountId, loginId, purpose, flow: 'device' }, 35_000, false, signal)).operation;
|
|
238
|
+
}
|
|
239
|
+
public listOperations(after?: string, limit?: number): Promise<IReq_AuthSwitchListOperations['response']> {
|
|
240
|
+
return this.request<IReq_AuthSwitchListOperations>('authswitch.authority.operations', { after, limit });
|
|
241
|
+
}
|
|
242
|
+
public async getOperation(operationId: string, signal?: AbortSignal): Promise<IReq_AuthSwitchGetOperation['response']['operation']> {
|
|
243
|
+
return (await this.request<IReq_AuthSwitchGetOperation>('authswitch.authority.operation',
|
|
244
|
+
{ operationId }, 35_000, false, signal)).operation;
|
|
146
245
|
}
|
|
147
|
-
public async
|
|
148
|
-
return (await this.request<
|
|
246
|
+
public async cancelOperation(operationId: string, signal?: AbortSignal): Promise<IReq_AuthSwitchCancelOperation['response']['operation']> {
|
|
247
|
+
return (await this.request<IReq_AuthSwitchCancelOperation>('authswitch.authority.cancel',
|
|
248
|
+
{ operationId }, 35_000, false, signal)).operation;
|
|
149
249
|
}
|
|
150
|
-
public async
|
|
151
|
-
|
|
250
|
+
public async startPreuse(input: IReq_AuthSwitchStartPreuse['request'],
|
|
251
|
+
signal?: AbortSignal): Promise<IReq_AuthSwitchStartPreuse['response']['operation']> {
|
|
252
|
+
return (await this.request<IReq_AuthSwitchStartPreuse>(
|
|
253
|
+
'authswitch.authority.preuse.start', input, 35_000, false, signal)).operation;
|
|
152
254
|
}
|
|
153
|
-
public async
|
|
154
|
-
|
|
255
|
+
public async getPreuse(operationId: string,
|
|
256
|
+
signal?: AbortSignal): Promise<IReq_AuthSwitchGetPreuse['response']['operation']> {
|
|
257
|
+
return (await this.request<IReq_AuthSwitchGetPreuse>(
|
|
258
|
+
'authswitch.authority.preuse.operation', { operationId }, 35_000, false, signal)).operation;
|
|
259
|
+
}
|
|
260
|
+
public async cancelPreuse(operationId: string,
|
|
261
|
+
signal?: AbortSignal): Promise<IReq_AuthSwitchCancelPreuse['response']['operation']> {
|
|
262
|
+
return (await this.request<IReq_AuthSwitchCancelPreuse>(
|
|
263
|
+
'authswitch.authority.preuse.cancel', { operationId }, 35_000, false, signal)).operation;
|
|
155
264
|
}
|
|
156
265
|
public async renameAccount(accountId: string, expectedRevision: number, label: string): Promise<IReq_AuthSwitchRenameAccount['response']['account']> {
|
|
157
266
|
return (await this.request<IReq_AuthSwitchRenameAccount>('authswitch.authority.rename', { accountId, expectedRevision, label })).account;
|
|
@@ -159,15 +268,28 @@ export class AuthSwitchClient {
|
|
|
159
268
|
public async removeAccount(accountId: string, expectedRevision: number): Promise<IReq_AuthSwitchRemoveAccount['response']['account']> {
|
|
160
269
|
return (await this.request<IReq_AuthSwitchRemoveAccount>('authswitch.authority.remove', { accountId, expectedRevision })).account;
|
|
161
270
|
}
|
|
271
|
+
public async switchClaudeNative(accountId: string, loginId: string): Promise<IReq_AuthSwitchSwitchClaudeNative['response']['handoff']> {
|
|
272
|
+
return (await this.request<IReq_AuthSwitchSwitchClaudeNative>('authswitch.authority.claude.switch',
|
|
273
|
+
{ accountId, loginId, purpose: 'claude_host_native' })).handoff;
|
|
274
|
+
}
|
|
275
|
+
public async getClaudeNativeHandoff(operationId: string): Promise<IReq_AuthSwitchClaudeNativeHandoff['response']['handoff']> {
|
|
276
|
+
return (await this.request<IReq_AuthSwitchClaudeNativeHandoff>('authswitch.authority.claude.handoff', { operationId })).handoff;
|
|
277
|
+
}
|
|
278
|
+
public listClaudeNativeHandoffs(after?: string, limit?: number): Promise<IReq_AuthSwitchClaudeNativeHandoffs['response']> {
|
|
279
|
+
return this.request<IReq_AuthSwitchClaudeNativeHandoffs>('authswitch.authority.claude.handoffs', { after, limit });
|
|
280
|
+
}
|
|
162
281
|
public bindAccount(input: IReq_AuthSwitchBindAccount['request']): Promise<IReq_AuthSwitchBindAccount['response']> {
|
|
163
282
|
return this.request<IReq_AuthSwitchBindAccount>('authswitch.authority.bind', input);
|
|
164
283
|
}
|
|
165
284
|
public resolveAccess(input: IReq_AuthSwitchResolveAccess['request']): Promise<IReq_AuthSwitchResolveAccess['response']> {
|
|
166
285
|
return this.request<IReq_AuthSwitchResolveAccess>('authswitch.authority.resolveAccess', input, 35_000, true);
|
|
167
286
|
}
|
|
287
|
+
public releaseBinding(input: IReq_AuthSwitchReleaseBinding['request'], signal?: AbortSignal): Promise<IReq_AuthSwitchReleaseBinding['response']> {
|
|
288
|
+
return this.request<IReq_AuthSwitchReleaseBinding>('authswitch.authority.release', input, 35_000, true, signal);
|
|
289
|
+
}
|
|
168
290
|
}
|
|
169
291
|
|
|
170
|
-
/** Container-facing client. It can only resolve a previously issued binding capability. */
|
|
292
|
+
/** Container-facing client. It can only resolve or release a previously issued binding capability. */
|
|
171
293
|
export class AuthSwitchRuntimeClient {
|
|
172
294
|
private readonly target: plugins.typedrequest.TypedTarget;
|
|
173
295
|
constructor(runtimeSocketPath: string) {
|
|
@@ -180,4 +302,8 @@ export class AuthSwitchRuntimeClient {
|
|
|
180
302
|
return new plugins.typedrequest.TypedRequest<IReq_AuthSwitchResolveAccess>(this.target,
|
|
181
303
|
'authswitch.authority.resolveAccess').fire(input, { timeoutMs: 35_000, maxRetries: 0 });
|
|
182
304
|
}
|
|
305
|
+
public releaseBinding(input: IReq_AuthSwitchReleaseBinding['request'], signal?: AbortSignal): Promise<IReq_AuthSwitchReleaseBinding['response']> {
|
|
306
|
+
return new plugins.typedrequest.TypedRequest<IReq_AuthSwitchReleaseBinding>(this.target,
|
|
307
|
+
'authswitch.authority.release').fire(input, { timeoutMs: 35_000, maxRetries: 0, abortSignal: signal });
|
|
308
|
+
}
|
|
183
309
|
}
|