@andorra-labs/code 0.1.13 → 0.1.15
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/src/account-presentation.js +4 -1
- package/dist/src/acp-agent.d.ts +54 -0
- package/dist/src/acp-agent.js +991 -0
- package/dist/src/agent-execution.js +304 -140
- package/dist/src/agent-mcp-catalog.js +2 -0
- package/dist/src/agent-mcp.d.ts +2 -0
- package/dist/src/agent-mcp.js +86 -4
- package/dist/src/andorra/endpoint.d.ts +7 -0
- package/dist/src/andorra/endpoint.js +46 -0
- package/dist/src/andorra/entry.d.ts +21 -0
- package/dist/src/andorra/entry.js +118 -0
- package/dist/src/andorra/errors.d.ts +2 -0
- package/dist/src/andorra/errors.js +39 -0
- package/dist/src/andorra/hosted.d.ts +55 -0
- package/dist/src/andorra/hosted.js +130 -0
- package/dist/src/andorra/monitor.d.ts +151 -0
- package/dist/src/andorra/monitor.js +393 -0
- package/dist/src/andorra/notices.d.ts +16 -0
- package/dist/src/andorra/notices.js +38 -0
- package/dist/src/andorra/opt-in.d.ts +58 -0
- package/dist/src/andorra/opt-in.js +112 -0
- package/dist/src/andorra/request-watch.d.ts +6 -0
- package/dist/src/andorra/request-watch.js +10 -0
- package/dist/src/andorra/state.d.ts +86 -0
- package/dist/src/andorra/state.js +238 -0
- package/dist/src/andorra/terminal.d.ts +70 -0
- package/dist/src/andorra/terminal.js +125 -0
- package/dist/src/andorra/usage-format.d.ts +9 -0
- package/dist/src/andorra/usage-format.js +19 -0
- package/dist/src/anthropic-credentials.js +9 -1
- package/dist/src/app-server/protocol.d.ts +10 -2
- package/dist/src/app-server/protocol.js +1 -1
- package/dist/src/app-server/workspace.d.ts +1 -0
- package/dist/src/app-server/workspace.js +141 -10
- package/dist/src/app-server.d.ts +35 -0
- package/dist/src/app-server.js +377 -124
- package/dist/src/auth/AuthManager.d.ts +9 -0
- package/dist/src/auth/AuthManager.js +164 -24
- package/dist/src/auth/deployment.d.ts +1 -0
- package/dist/src/auth/deployment.js +1 -0
- package/dist/src/auth/index.d.ts +1 -1
- package/dist/src/auth/index.js +1 -1
- package/dist/src/auth/store.d.ts +26 -0
- package/dist/src/auth/store.js +34 -1
- package/dist/src/browser-bridge.d.ts +1 -0
- package/dist/src/browser-bridge.js +5 -2
- package/dist/src/browser-external-app.d.ts +27 -0
- package/dist/src/browser-external-app.js +60 -0
- package/dist/src/browser-panel-tool.d.ts +6 -0
- package/dist/src/browser-panel-tool.js +36 -0
- package/dist/src/browser-runner.js +1 -1
- package/dist/src/browser-server.d.ts +5 -0
- package/dist/src/browser-server.js +27 -3
- package/dist/src/browser-stealth.d.ts +19 -1
- package/dist/src/browser-stealth.js +23 -3
- package/dist/src/browser-ui/tokens.css +4 -4
- package/dist/src/browser-view.d.ts +81 -0
- package/dist/src/browser-view.js +289 -18
- package/dist/src/bug-report.d.ts +81 -0
- package/dist/src/bug-report.js +235 -0
- package/dist/src/claude-provider.d.ts +2 -1
- package/dist/src/claude-provider.js +10 -8
- package/dist/src/cli-sign-in.d.ts +3 -1
- package/dist/src/cli-sign-in.js +4 -1
- package/dist/src/cli.js +205 -58
- package/dist/src/coding-tools.js +7 -7
- package/dist/src/command-screens.d.ts +26 -3
- package/dist/src/command-screens.js +323 -85
- package/dist/src/commands.d.ts +7 -1
- package/dist/src/commands.js +79 -27
- package/dist/src/completion-gates.d.ts +22 -0
- package/dist/src/completion-gates.js +11 -0
- package/dist/src/config.d.ts +11 -1
- package/dist/src/config.js +134 -3
- package/dist/src/dashboard-view.d.ts +2 -0
- package/dist/src/dashboard-view.js +11 -2
- package/dist/src/decision/PreparedSteps.js +1 -1
- package/dist/src/decision/applyToolMenu.js +1 -1
- package/dist/src/decision/toolFamilies.js +1 -1
- package/dist/src/decision/types.d.ts +1 -0
- package/dist/src/google-provider.d.ts +31 -0
- package/dist/src/google-provider.js +153 -0
- package/dist/src/graph-health.d.ts +11 -0
- package/dist/src/graph-health.js +36 -4
- package/dist/src/graph-manager-chat.d.ts +33 -0
- package/dist/src/graph-manager-chat.js +165 -6
- package/dist/src/graph-runner.js +27 -0
- package/dist/src/graph-selection.js +2 -1
- package/dist/src/graph-sync.d.ts +1 -0
- package/dist/src/graph-sync.js +93 -34
- package/dist/src/graph-tool.d.ts +2 -0
- package/dist/src/graph-tool.js +2 -2
- package/dist/src/graph-ui/app.js +92 -10
- package/dist/src/graph-ui/edge-router.js +121 -53
- package/dist/src/graph-ui/manager.js +40 -5
- package/dist/src/graph-ui/style.css +5 -2
- package/dist/src/graph-ui/tokens.css +4 -4
- package/dist/src/graph-visibility.d.ts +31 -0
- package/dist/src/graph-visibility.js +102 -0
- package/dist/src/graphs.js +1 -3
- package/dist/src/hardened-runtime.js +1 -1
- package/dist/src/live-model.d.ts +24 -0
- package/dist/src/live-model.js +37 -0
- package/dist/src/managed-sign-in.d.ts +1 -0
- package/dist/src/managed-sign-in.js +13 -0
- package/dist/src/membership-errors.d.ts +2 -0
- package/dist/src/membership-errors.js +6 -2
- package/dist/src/membership.d.ts +13 -2
- package/dist/src/membership.js +39 -8
- package/dist/src/model-context-windows.d.ts +2 -0
- package/dist/src/model-context-windows.js +24 -0
- package/dist/src/model-health-cache.js +1 -1
- package/dist/src/model-metadata.d.ts +1 -0
- package/dist/src/model-metadata.js +47 -3
- package/dist/src/paged-transcript.d.ts +2 -0
- package/dist/src/paged-transcript.js +16 -0
- package/dist/src/palette.d.ts +1 -0
- package/dist/src/palette.js +1 -1
- package/dist/src/permissions.js +17 -4
- package/dist/src/provider-connection.js +32 -0
- package/dist/src/provider-engine.d.ts +5 -0
- package/dist/src/provider-engine.js +3 -3
- package/dist/src/provider-import.js +3 -1
- package/dist/src/provider-settings.d.ts +16 -1
- package/dist/src/provider-settings.js +50 -22
- package/dist/src/providers.d.ts +29 -3
- package/dist/src/providers.js +100 -18
- package/dist/src/react-runtime.js +33 -12
- package/dist/src/read-document-tool.d.ts +2 -0
- package/dist/src/read-document-tool.js +6 -6
- package/dist/src/remote/engine-pool.js +31 -6
- package/dist/src/run-control.d.ts +2 -2
- package/dist/src/run-control.js +9 -6
- package/dist/src/runtime-environment.d.ts +1 -0
- package/dist/src/runtime-environment.js +13 -0
- package/dist/src/runtime.d.ts +2 -0
- package/dist/src/runtime.js +2 -1
- package/dist/src/save-lock.js +14 -7
- package/dist/src/session-title.d.ts +3 -0
- package/dist/src/session-title.js +5 -2
- package/dist/src/sessions.d.ts +1 -0
- package/dist/src/sessions.js +4 -2
- package/dist/src/sign-in-detection.d.ts +1 -1
- package/dist/src/sign-in-detection.js +10 -3
- package/dist/src/sign-in-offer.js +1 -1
- package/dist/src/skill-commands.js +1 -1
- package/dist/src/skills/bundled/bug-report/SKILL.md +80 -0
- package/dist/src/skills/bundled/graph-manager/SKILL.md +9 -1
- package/dist/src/skills/bundled/graph-manager/errors.md +2 -1
- package/dist/src/skills/bundled/provenance.json +743 -738
- package/dist/src/skills/runtime-skills.js +1 -0
- package/dist/src/subagent-run.d.ts +2 -0
- package/dist/src/subagent-run.js +14 -3
- package/dist/src/telemetry/schema.d.ts +1 -1
- package/dist/src/telemetry/schema.js +2 -2
- package/dist/src/telemetry/uploader.d.ts +7 -1
- package/dist/src/telemetry/uploader.js +11 -2
- package/dist/src/terminal-links.d.ts +16 -0
- package/dist/src/terminal-links.js +113 -0
- package/dist/src/terminal-ui.d.ts +29 -1
- package/dist/src/terminal-ui.js +113 -24
- package/dist/src/tool-catalog.js +1 -1
- package/dist/src/trajectory.js +6 -1
- package/dist/src/transcript.d.ts +2 -0
- package/dist/src/transcript.js +5 -1
- package/dist/src/types.d.ts +5 -0
- package/dist/src/workspace-instructions.js +1 -1
- package/package.json +13 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AuthError, type AuthConfiguration, type AuthStatus, type CredentialStore } from './types.js';
|
|
2
|
+
import { type CredentialJournal } from './store.js';
|
|
2
3
|
export interface OtherSignIn {
|
|
3
4
|
read(): Promise<string | undefined>;
|
|
4
5
|
remove(): Promise<void>;
|
|
@@ -13,10 +14,14 @@ export declare class AuthManager {
|
|
|
13
14
|
private readonly store;
|
|
14
15
|
private readonly fetch;
|
|
15
16
|
private readonly keys;
|
|
17
|
+
private readonly journal?;
|
|
16
18
|
private unsaved?;
|
|
19
|
+
private unsavedIsShared;
|
|
20
|
+
private unsavedRetires;
|
|
17
21
|
constructor(options: {
|
|
18
22
|
config: AuthConfiguration;
|
|
19
23
|
store?: CredentialStore;
|
|
24
|
+
journal?: CredentialJournal;
|
|
20
25
|
fetch?: typeof fetch;
|
|
21
26
|
openBrowser?: (url: string) => Promise<void>;
|
|
22
27
|
lockPort?: number;
|
|
@@ -49,6 +54,10 @@ export declare class AuthManager {
|
|
|
49
54
|
revoked: boolean;
|
|
50
55
|
};
|
|
51
56
|
}>;
|
|
57
|
+
private journalled;
|
|
58
|
+
private pending;
|
|
59
|
+
private forget;
|
|
60
|
+
private ensureSavable;
|
|
52
61
|
private rotate;
|
|
53
62
|
private current;
|
|
54
63
|
private refreshTokens;
|
|
@@ -2,9 +2,17 @@ import { randomBytes, randomUUID, createHash, timingSafeEqual } from 'node:crypt
|
|
|
2
2
|
import { resolve } from 'node:path';
|
|
3
3
|
import { createRemoteJWKSet, customFetch, jwtVerify } from 'jose';
|
|
4
4
|
import { AuthError } from './types.js';
|
|
5
|
-
import { createCredentialStore, credentialScope, KeyringAbsentError, KeyringCredentialStore, keyringScopes } from './store.js';
|
|
5
|
+
import { createCredentialJournal, createCredentialStore, credentialScope, KeyringAbsentError, KeyringCredentialStore, keyringScopes } from './store.js';
|
|
6
6
|
import { withAuthLock } from './lock.js';
|
|
7
7
|
import { browserUnavailableReason, openBrowser, receiveAuthorizationCode } from './callback.js';
|
|
8
|
+
const tokenDigest = (token) => token === undefined ? '' : createHash('sha256').update(token).digest('hex');
|
|
9
|
+
function validSession(s) {
|
|
10
|
+
const v = s;
|
|
11
|
+
return Boolean(v && typeof v === 'object' && typeof v.accessToken === 'string' && v.accessToken && typeof v.refreshToken === 'string' && v.refreshToken && v.refreshToken.length <= 16000 && typeof v.subject === 'string' && v.subject && typeof v.nonce === 'string' && Number.isFinite(v.expiresAt) && Number.isFinite(v.refreshExpiresAt));
|
|
12
|
+
}
|
|
13
|
+
class UnsavableSessionError extends AuthError {
|
|
14
|
+
constructor(options) { super('storage', 'You are still signed in, but the refreshed sign-in cannot be saved on this machine, so it was not refreshed. Free disk space and room in the OS credential store, then retry.', options); this.name = 'UnsavableSessionError'; }
|
|
15
|
+
}
|
|
8
16
|
async function otherKeyringSignIns(currentScope) {
|
|
9
17
|
let scopes;
|
|
10
18
|
try {
|
|
@@ -102,12 +110,16 @@ export class AuthManager {
|
|
|
102
110
|
store;
|
|
103
111
|
fetch;
|
|
104
112
|
keys;
|
|
113
|
+
journal;
|
|
105
114
|
unsaved;
|
|
115
|
+
unsavedIsShared = false;
|
|
116
|
+
unsavedRetires = '';
|
|
106
117
|
constructor(options) {
|
|
107
118
|
this.options = options;
|
|
108
119
|
validateAuthConfiguration(options.config);
|
|
109
120
|
this.config = { ...options.config };
|
|
110
121
|
this.store = options.store ?? createCredentialStore(credentialIdentity(this.config));
|
|
122
|
+
this.journal = options.journal ?? (options.store ? undefined : createCredentialJournal(credentialIdentity(this.config)));
|
|
111
123
|
this.fetch = options.fetch ?? globalThis.fetch;
|
|
112
124
|
this.keys = createRemoteJWKSet(new URL(`${this.config.issuer}/.well-known/jwks.json`), { timeoutDuration: 5000, [customFetch]: (url, init) => this.fetch(url, init) });
|
|
113
125
|
}
|
|
@@ -134,21 +146,29 @@ export class AuthManager {
|
|
|
134
146
|
try {
|
|
135
147
|
return await this.fetch(`${this.config.domain}${path}`, { method: 'POST', headers: { 'content-type': 'application/x-www-form-urlencoded' }, body, redirect: 'error', signal: signal ? AbortSignal.any([signal, deadline]) : deadline });
|
|
136
148
|
}
|
|
137
|
-
catch {
|
|
149
|
+
catch (error) {
|
|
138
150
|
if (signal?.aborted)
|
|
139
151
|
throw new AuthError('cancelled', 'Authentication cancelled.');
|
|
140
152
|
if (deadline.aborted)
|
|
141
|
-
throw new AuthError('network', 'The account service did not respond in time. Retry shortly.');
|
|
142
|
-
throw new AuthError('network', 'The account service is unavailable. Retry shortly.');
|
|
153
|
+
throw new AuthError('network', 'The account service did not respond in time. Retry shortly.', { cause: error });
|
|
154
|
+
throw new AuthError('network', 'The account service is unavailable. Retry shortly.', { cause: error });
|
|
143
155
|
}
|
|
144
156
|
}
|
|
145
157
|
async tokenResponse(body, signal) {
|
|
146
158
|
const response = await this.post('/oauth2/token', body, signal);
|
|
147
159
|
if (!response.ok) {
|
|
148
|
-
|
|
149
|
-
|
|
160
|
+
if (response.status !== 400 && response.status !== 401) {
|
|
161
|
+
await response.body?.cancel().catch(() => { });
|
|
162
|
+
throw new AuthError('network', 'The account service is unavailable. Retry shortly.', { cause: Object.assign(new Error(`HTTP ${response.status}`), { code: `HTTP_${response.status}` }) });
|
|
163
|
+
}
|
|
164
|
+
let refusal;
|
|
165
|
+
try {
|
|
166
|
+
refusal = JSON.parse((await response.text()).slice(0, 4000))?.error;
|
|
167
|
+
}
|
|
168
|
+
catch { }
|
|
169
|
+
if (refusal === 'invalid_grant')
|
|
150
170
|
throw new AuthError('login_required', 'Your Andorra session has expired or was revoked. Please sign in again.');
|
|
151
|
-
throw new AuthError('network', 'The account service
|
|
171
|
+
throw new AuthError('network', 'The account service did not accept the request. Retry shortly.');
|
|
152
172
|
}
|
|
153
173
|
let reader;
|
|
154
174
|
try {
|
|
@@ -254,6 +274,7 @@ export class AuthManager {
|
|
|
254
274
|
throw new AuthError('cancelled', 'Authentication cancelled.');
|
|
255
275
|
}
|
|
256
276
|
replacedToken = current.session?.refreshToken;
|
|
277
|
+
await this.forget();
|
|
257
278
|
}, signal);
|
|
258
279
|
}
|
|
259
280
|
catch (error) {
|
|
@@ -294,11 +315,20 @@ export class AuthManager {
|
|
|
294
315
|
}
|
|
295
316
|
if (signal?.aborted)
|
|
296
317
|
throw new AuthError('cancelled', 'Authentication cancelled.');
|
|
318
|
+
const journalled = (await this.journalled())?.session.refreshToken;
|
|
319
|
+
const unsaved = this.unsaved?.session.refreshToken;
|
|
297
320
|
await this.store.clear(JSON.stringify({ version: 1, generation: randomUUID() }));
|
|
298
321
|
this.unsaved = undefined;
|
|
299
|
-
|
|
322
|
+
let cleanup;
|
|
323
|
+
try {
|
|
324
|
+
await this.journal?.remove();
|
|
325
|
+
}
|
|
326
|
+
catch (error) {
|
|
327
|
+
cleanup = error;
|
|
328
|
+
}
|
|
329
|
+
const own = [...new Set([token, previous, journalled, unsaved].filter((value) => Boolean(value)))];
|
|
300
330
|
if (!options.everywhere)
|
|
301
|
-
return { own };
|
|
331
|
+
return { own, cleanup };
|
|
302
332
|
let others;
|
|
303
333
|
try {
|
|
304
334
|
others = await abortable((this.options.otherSignIns ?? otherKeyringSignIns)(credentialScope(credentialIdentity(this.config))), signal);
|
|
@@ -306,7 +336,7 @@ export class AuthManager {
|
|
|
306
336
|
catch (failure) {
|
|
307
337
|
if (signal?.aborted || (failure instanceof AuthError && failure.code === 'cancelled'))
|
|
308
338
|
throw new AuthError('cancelled', 'Authentication cancelled.');
|
|
309
|
-
return { own, foreign: [], removed: 0, failure };
|
|
339
|
+
return { own, foreign: [], removed: 0, failure, cleanup };
|
|
310
340
|
}
|
|
311
341
|
const foreign = [];
|
|
312
342
|
let failure;
|
|
@@ -330,27 +360,104 @@ export class AuthManager {
|
|
|
330
360
|
failure ??= error;
|
|
331
361
|
}
|
|
332
362
|
}
|
|
333
|
-
return { own, foreign, removed: others.length, ...(failure === undefined ? {} : { failure }) };
|
|
363
|
+
return { own, foreign, removed: others.length, cleanup, ...(failure === undefined ? {} : { failure }) };
|
|
334
364
|
}, signal);
|
|
335
365
|
const results = await Promise.all(tokens.own.map(token => this.revoke(token, signal).catch(() => false)));
|
|
336
|
-
if (tokens.removed === undefined)
|
|
366
|
+
if (tokens.removed === undefined) {
|
|
367
|
+
if (tokens.cleanup !== undefined)
|
|
368
|
+
throw tokens.cleanup;
|
|
337
369
|
return { revoked: results.every(Boolean) };
|
|
370
|
+
}
|
|
338
371
|
const foreign = await Promise.all((tokens.foreign ?? []).map(token => this.revoke(token, signal).catch(() => false)));
|
|
339
372
|
if (tokens.failure !== undefined)
|
|
340
373
|
throw tokens.failure;
|
|
374
|
+
if (tokens.cleanup !== undefined)
|
|
375
|
+
throw tokens.cleanup;
|
|
341
376
|
return { revoked: results.every(Boolean), others: { removed: tokens.removed, revoked: foreign.every(Boolean) } };
|
|
342
377
|
}
|
|
378
|
+
async journalled(known) {
|
|
379
|
+
if (!this.journal)
|
|
380
|
+
return;
|
|
381
|
+
try {
|
|
382
|
+
const text = known ?? await this.journal.read();
|
|
383
|
+
if (!text)
|
|
384
|
+
return;
|
|
385
|
+
const value = JSON.parse(text);
|
|
386
|
+
if (typeof value.generation !== 'string' || value.generation.length > 100 || typeof value.replaces !== 'string' || !validSession(value.session))
|
|
387
|
+
return;
|
|
388
|
+
return { generation: value.generation, replaces: value.replaces, session: value.session };
|
|
389
|
+
}
|
|
390
|
+
catch {
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
async pending() {
|
|
395
|
+
if (!this.journal)
|
|
396
|
+
return this.unsaved;
|
|
397
|
+
let text;
|
|
398
|
+
try {
|
|
399
|
+
text = await this.journal.read();
|
|
400
|
+
}
|
|
401
|
+
catch {
|
|
402
|
+
return this.unsaved;
|
|
403
|
+
}
|
|
404
|
+
const shared = await this.journalled(text);
|
|
405
|
+
if (shared && this.unsaved && !this.unsavedIsShared && shared.generation === this.unsaved.generation && tokenDigest(shared.session.refreshToken) === this.unsavedRetires)
|
|
406
|
+
return this.unsaved;
|
|
407
|
+
if (shared) {
|
|
408
|
+
this.unsaved = undefined;
|
|
409
|
+
return shared;
|
|
410
|
+
}
|
|
411
|
+
if (this.unsaved && this.unsavedIsShared)
|
|
412
|
+
this.unsaved = undefined;
|
|
413
|
+
return this.unsaved;
|
|
414
|
+
}
|
|
415
|
+
async forget() {
|
|
416
|
+
this.unsaved = undefined;
|
|
417
|
+
await this.journal?.remove().catch(() => { });
|
|
418
|
+
}
|
|
419
|
+
async ensureSavable(current, pending) {
|
|
420
|
+
if (!this.journal)
|
|
421
|
+
return pending;
|
|
422
|
+
try {
|
|
423
|
+
await this.journal.write(JSON.stringify(pending ? { version: 1, ...pending } : { version: 1, generation: current.generation, probe: true }));
|
|
424
|
+
return pending;
|
|
425
|
+
}
|
|
426
|
+
catch { }
|
|
427
|
+
try {
|
|
428
|
+
await this.store.write(JSON.stringify(current));
|
|
429
|
+
await this.forget();
|
|
430
|
+
return undefined;
|
|
431
|
+
}
|
|
432
|
+
catch (error) {
|
|
433
|
+
throw new UnsavableSessionError({ cause: error });
|
|
434
|
+
}
|
|
435
|
+
}
|
|
343
436
|
async rotate(current, session) {
|
|
344
|
-
const
|
|
345
|
-
|
|
437
|
+
const held = await this.pending();
|
|
438
|
+
const pending = await this.ensureSavable(current, held && held.generation === current.generation && held.session.refreshToken === session.refreshToken ? held : undefined);
|
|
439
|
+
let tokens;
|
|
440
|
+
try {
|
|
441
|
+
tokens = await this.refreshTokens(session.refreshToken);
|
|
442
|
+
}
|
|
443
|
+
catch (error) {
|
|
444
|
+
if (!pending && !this.unsaved)
|
|
445
|
+
await this.journal?.remove().catch(() => { });
|
|
446
|
+
throw error;
|
|
447
|
+
}
|
|
448
|
+
let stored = pending?.replaces ?? tokenDigest(session.refreshToken);
|
|
346
449
|
const persist = async (rotated) => {
|
|
347
450
|
try {
|
|
348
451
|
await this.store.write(JSON.stringify({ ...current, session: rotated }));
|
|
349
|
-
|
|
350
|
-
|
|
452
|
+
stored = tokenDigest(rotated.refreshToken);
|
|
453
|
+
await this.forget();
|
|
351
454
|
}
|
|
352
455
|
catch {
|
|
353
456
|
this.unsaved = { generation: current.generation, replaces: stored, session: rotated };
|
|
457
|
+
this.unsavedIsShared = false;
|
|
458
|
+
this.unsavedRetires = tokenDigest(session.refreshToken);
|
|
459
|
+
if (this.journal)
|
|
460
|
+
this.unsavedIsShared = await this.journal.write(JSON.stringify({ version: 1, ...this.unsaved }), { inPlace: true }).then(() => true, () => false);
|
|
354
461
|
}
|
|
355
462
|
};
|
|
356
463
|
const interim = interimSession(tokens, session);
|
|
@@ -366,20 +473,20 @@ export class AuthManager {
|
|
|
366
473
|
stored = await abortable(this.read(), signal);
|
|
367
474
|
}
|
|
368
475
|
catch (error) {
|
|
369
|
-
if (
|
|
476
|
+
if (signal?.aborted || !(error instanceof AuthError && error.code === 'storage') || !(await this.pending()))
|
|
370
477
|
throw error;
|
|
371
478
|
}
|
|
372
|
-
const pending = this.
|
|
479
|
+
const pending = await this.pending();
|
|
373
480
|
if (!pending)
|
|
374
481
|
return stored;
|
|
375
|
-
if (stored && (stored.generation !== pending.generation || stored.session?.refreshToken !== pending.replaces)) {
|
|
376
|
-
this.
|
|
482
|
+
if (stored && (stored.generation !== pending.generation || tokenDigest(stored.session?.refreshToken) !== pending.replaces)) {
|
|
483
|
+
await this.forget();
|
|
377
484
|
return stored;
|
|
378
485
|
}
|
|
379
486
|
const recovered = { version: 1, generation: pending.generation, session: pending.session };
|
|
380
487
|
try {
|
|
381
488
|
await this.store.write(JSON.stringify(recovered));
|
|
382
|
-
this.
|
|
489
|
+
await this.forget();
|
|
383
490
|
}
|
|
384
491
|
catch { }
|
|
385
492
|
return recovered;
|
|
@@ -399,7 +506,7 @@ export class AuthManager {
|
|
|
399
506
|
}
|
|
400
507
|
async clearRejectedCredential(rejection) {
|
|
401
508
|
let failure;
|
|
402
|
-
this.
|
|
509
|
+
await this.forget();
|
|
403
510
|
try {
|
|
404
511
|
await this.store.clear(JSON.stringify({ version: 1, generation: randomUUID() }));
|
|
405
512
|
}
|
|
@@ -443,9 +550,42 @@ export class AuthManager {
|
|
|
443
550
|
return { token: next.accessToken, subject: next.subject };
|
|
444
551
|
}
|
|
445
552
|
catch (error) {
|
|
446
|
-
if (error instanceof
|
|
553
|
+
if (error instanceof UnsavableSessionError && session.expiresAt > Date.now() + 5000) {
|
|
554
|
+
const payload = await this.verify(session.accessToken, 'access', signal);
|
|
555
|
+
if (payload.sub === session.subject)
|
|
556
|
+
return { token: session.accessToken, subject: session.subject };
|
|
557
|
+
}
|
|
558
|
+
if (!(error instanceof AuthError) || error.code !== 'login_required')
|
|
559
|
+
throw error;
|
|
560
|
+
let latest;
|
|
561
|
+
try {
|
|
562
|
+
latest = await this.current(signal);
|
|
563
|
+
}
|
|
564
|
+
catch (failure) {
|
|
565
|
+
if (signal?.aborted)
|
|
566
|
+
throw failure;
|
|
567
|
+
throw new AuthError('storage', 'The sign-in could not be refreshed, and the stored sign-in could not be read to confirm it. Retry shortly.', { cause: failure });
|
|
568
|
+
}
|
|
569
|
+
const other = latest.session;
|
|
570
|
+
if (!other || other.refreshToken === session.refreshToken)
|
|
447
571
|
throw await this.clearRejectedCredential(error);
|
|
448
|
-
|
|
572
|
+
if (other.expiresAt > Date.now() + 60000) {
|
|
573
|
+
const payload = await this.verify(other.accessToken, 'access', signal);
|
|
574
|
+
if (payload.sub !== other.subject)
|
|
575
|
+
throw new AuthError('invalid_token', 'Stored account identity did not match.');
|
|
576
|
+
return { token: other.accessToken, subject: other.subject };
|
|
577
|
+
}
|
|
578
|
+
try {
|
|
579
|
+
const next = await this.rotate(latest, other);
|
|
580
|
+
if (signal?.aborted)
|
|
581
|
+
throw new AuthError('cancelled', 'Authentication cancelled.');
|
|
582
|
+
return { token: next.accessToken, subject: next.subject };
|
|
583
|
+
}
|
|
584
|
+
catch (second) {
|
|
585
|
+
if (second instanceof AuthError && second.code === 'login_required')
|
|
586
|
+
throw await this.clearRejectedCredential(second);
|
|
587
|
+
throw second;
|
|
588
|
+
}
|
|
449
589
|
}
|
|
450
590
|
}
|
|
451
591
|
async getAccessToken(signal) {
|
|
@@ -4,5 +4,6 @@ export const AUTH_DEPLOYMENT = {
|
|
|
4
4
|
domain: 'https://auth.andorracode.com',
|
|
5
5
|
apiBaseUrl: 'https://g2jkeh2w1k.execute-api.us-east-2.amazonaws.com/v1',
|
|
6
6
|
telemetryBaseUrl: 'https://98m5jdbcf0.execute-api.us-east-2.amazonaws.com/v1',
|
|
7
|
+
inferenceBaseUrl: 'https://inference.andorracode.com',
|
|
7
8
|
redirectUri: 'http://localhost:43187/callback',
|
|
8
9
|
};
|
package/dist/src/auth/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { AuthConfiguration, AuthError } from './types.js';
|
|
|
3
3
|
export * from './types.js';
|
|
4
4
|
export { AuthManager, AUTH_REFRESH_BUDGET_MS } from './AuthManager.js';
|
|
5
5
|
export { credentialIdentity } from './AuthManager.js';
|
|
6
|
-
export { KeyringCredentialStore, KeyringAbsentError, KeyringUnreachableError, FileCredentialStore, FallbackCredentialStore, createCredentialStore } from './store.js';
|
|
6
|
+
export { KeyringCredentialStore, KeyringAbsentError, KeyringUnreachableError, FileCredentialStore, FallbackCredentialStore, FileCredentialJournal, createCredentialStore, createCredentialJournal, type CredentialJournal } from './store.js';
|
|
7
7
|
export declare function getAuthConfiguration(): AuthConfiguration;
|
|
8
8
|
export declare function setAuthSignOutReporter(reporter?: (error: AuthError) => void): void;
|
|
9
9
|
export declare const login: (options?: Parameters<AuthManager["login"]>[0]) => Promise<import("./types.js").AuthStatus>;
|
package/dist/src/auth/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { AuthManager } from './AuthManager.js';
|
|
|
3
3
|
export * from './types.js';
|
|
4
4
|
export { AuthManager, AUTH_REFRESH_BUDGET_MS } from './AuthManager.js';
|
|
5
5
|
export { credentialIdentity } from './AuthManager.js';
|
|
6
|
-
export { KeyringCredentialStore, KeyringAbsentError, KeyringUnreachableError, FileCredentialStore, FallbackCredentialStore, createCredentialStore } from './store.js';
|
|
6
|
+
export { KeyringCredentialStore, KeyringAbsentError, KeyringUnreachableError, FileCredentialStore, FallbackCredentialStore, FileCredentialJournal, createCredentialStore, createCredentialJournal } from './store.js';
|
|
7
7
|
export function getAuthConfiguration() { return { ...AUTH_DEPLOYMENT }; }
|
|
8
8
|
let manager;
|
|
9
9
|
let signOutReporter;
|
package/dist/src/auth/store.d.ts
CHANGED
|
@@ -70,5 +70,31 @@ export declare class FallbackCredentialStore implements CredentialStore {
|
|
|
70
70
|
clear(tombstone: string): Promise<void>;
|
|
71
71
|
location(): Promise<CredentialLocation>;
|
|
72
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Where a refreshed sign-in is kept when the credential store refuses it. The account service replaces the refresh token
|
|
75
|
+
* on every refresh and stops honouring the old one a minute later, so a refreshed sign-in that is saved nowhere is lost
|
|
76
|
+
* with the process that holds it, and the next process is signed out. This owner-only file next to the home's other
|
|
77
|
+
* files holds that sign-in until the store accepts it again; before a refresh it is written once without a secret, to
|
|
78
|
+
* prove a refreshed sign-in will have somewhere to go.
|
|
79
|
+
*/
|
|
80
|
+
export interface CredentialJournal {
|
|
81
|
+
read(): Promise<string | undefined>;
|
|
82
|
+
write(value: string, options?: {
|
|
83
|
+
inPlace?: boolean;
|
|
84
|
+
}): Promise<void>;
|
|
85
|
+
remove(): Promise<void>;
|
|
86
|
+
}
|
|
87
|
+
export declare class FileCredentialJournal implements CredentialJournal {
|
|
88
|
+
readonly path: string;
|
|
89
|
+
private readonly writable;
|
|
90
|
+
private readonly file;
|
|
91
|
+
constructor(path: string, writable?: boolean);
|
|
92
|
+
read(): Promise<string | undefined>;
|
|
93
|
+
write(value: string, options?: {
|
|
94
|
+
inPlace?: boolean;
|
|
95
|
+
}): Promise<void>;
|
|
96
|
+
remove(): Promise<void>;
|
|
97
|
+
}
|
|
98
|
+
export declare function createCredentialJournal(identity: string, environment?: NodeJS.ProcessEnv): CredentialJournal;
|
|
73
99
|
export declare function createCredentialStore(identity: string, environment?: NodeJS.ProcessEnv): CredentialStore;
|
|
74
100
|
export {};
|
package/dist/src/auth/store.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHash, randomUUID } from 'node:crypto';
|
|
2
|
-
import { chmod, mkdir, open, readdir, readFile, rename, rm, stat } from 'node:fs/promises';
|
|
2
|
+
import { chmod, mkdir, open, readdir, readFile, rename, rm, stat, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { homedir, tmpdir } from 'node:os';
|
|
4
4
|
import { basename, dirname, isAbsolute, join, relative, resolve } from 'node:path';
|
|
5
5
|
import { AuthError } from './types.js';
|
|
@@ -323,6 +323,39 @@ function holdsSession(text) {
|
|
|
323
323
|
return true;
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
|
+
export class FileCredentialJournal {
|
|
327
|
+
path;
|
|
328
|
+
writable;
|
|
329
|
+
file;
|
|
330
|
+
constructor(path, writable = true) {
|
|
331
|
+
this.path = path;
|
|
332
|
+
this.writable = writable;
|
|
333
|
+
this.file = new FileCredentialStore(path);
|
|
334
|
+
}
|
|
335
|
+
read() { return this.file.read(); }
|
|
336
|
+
async write(value, options = {}) {
|
|
337
|
+
if (!this.writable)
|
|
338
|
+
throw new AuthError('storage', 'ANDORRA_CREDENTIAL_STORE=keyring forbids keeping a sign-in in a file.');
|
|
339
|
+
try {
|
|
340
|
+
await this.file.write(value);
|
|
341
|
+
}
|
|
342
|
+
catch (error) {
|
|
343
|
+
if (!options.inPlace)
|
|
344
|
+
throw error;
|
|
345
|
+
try {
|
|
346
|
+
await writeFile(this.path, value, { encoding: 'utf8', mode: 0o600 });
|
|
347
|
+
}
|
|
348
|
+
catch {
|
|
349
|
+
throw error;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
remove() { return this.file.remove(); }
|
|
354
|
+
}
|
|
355
|
+
export function createCredentialJournal(identity, environment = process.env) {
|
|
356
|
+
const home = environment.ANDORRACODE_HOME || join(homedir(), '.andorracode');
|
|
357
|
+
return new FileCredentialJournal(join(home, `credentials-${credentialScope(identity)}.pending.json`), credentialStoreMode(environment) !== 'keyring');
|
|
358
|
+
}
|
|
326
359
|
export function createCredentialStore(identity, environment = process.env) {
|
|
327
360
|
const home = environment.ANDORRACODE_HOME || join(homedir(), '.andorracode');
|
|
328
361
|
return new FallbackCredentialStore(new KeyringCredentialStore(identity), new FileCredentialStore(join(home, `credentials-${credentialScope(identity)}.json`)), credentialStoreMode(environment));
|
|
@@ -31,6 +31,7 @@ export interface BrowserSession extends SavedSession {
|
|
|
31
31
|
export declare function validBrowserSession(value: unknown): value is BrowserSession;
|
|
32
32
|
export declare function browserReply(res: ServerResponse, status: number, value: unknown): void;
|
|
33
33
|
export declare function browserBody(req: IncomingMessage): Promise<Record<string, unknown>>;
|
|
34
|
+
export declare function browserBearerMatches(req: IncomingMessage, token: string): boolean;
|
|
34
35
|
export declare function browserAuthorized(req: IncomingMessage, token: string, origin: string): boolean;
|
|
35
36
|
export interface BrowserBridgeActions {
|
|
36
37
|
prompt(text: string): void | Promise<void>;
|
|
@@ -35,10 +35,13 @@ export async function browserBody(req) {
|
|
|
35
35
|
throw new Error('Expected a JSON object');
|
|
36
36
|
return value;
|
|
37
37
|
}
|
|
38
|
-
export function
|
|
38
|
+
export function browserBearerMatches(req, token) {
|
|
39
39
|
const supplied = Buffer.from(req.headers.authorization || '');
|
|
40
40
|
const expected = Buffer.from(`Bearer ${token}`);
|
|
41
|
-
return
|
|
41
|
+
return supplied.length === expected.length && timingSafeEqual(supplied, expected);
|
|
42
|
+
}
|
|
43
|
+
export function browserAuthorized(req, token, origin) {
|
|
44
|
+
return req.headers.host === new URL(origin).host && (!req.headers.origin || req.headers.origin === origin) && browserBearerMatches(req, token);
|
|
42
45
|
}
|
|
43
46
|
export async function createBrowserBridge(directory, snapshot, actions, cancellation) {
|
|
44
47
|
const token = randomBytes(32).toString('hex');
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A page that navigates to an app link (slack://, zoommtg://, ms-teams:// …) makes
|
|
3
|
+
* a headed Chromium raise its "Open <app>?" prompt. The prompt is part of the
|
|
4
|
+
* browser window, not the page, so the panel's screencast never shows it, and
|
|
5
|
+
* while it is up Chromium drops every click and key sent to that tab. The panel
|
|
6
|
+
* runs its window offscreen, so the tab looks frozen for no visible reason.
|
|
7
|
+
*
|
|
8
|
+
* Two layers deal with it. The guard below runs in every frame and cancels the
|
|
9
|
+
* navigations it can see (location changes, link clicks, window.open), so no
|
|
10
|
+
* prompt appears. Chromium offers no way to cancel the rest (an iframe whose src
|
|
11
|
+
* is an app link, a server redirect, a form post), so the panel watches for the
|
|
12
|
+
* request instead and tells the user and the agent how to clear the prompt.
|
|
13
|
+
*/
|
|
14
|
+
/** The scheme of a URL that would be handed to another application, lower-cased and without the colon. */
|
|
15
|
+
export declare function externalAppScheme(url: unknown): string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Runs in the page, in every frame, before the page's own scripts. It only adds a
|
|
18
|
+
* listener to the Navigation API; nothing on the page is patched or replaced.
|
|
19
|
+
*/
|
|
20
|
+
export declare const EXTERNAL_APP_GUARD_SCRIPT: string;
|
|
21
|
+
export declare function guardExternalApps(context: any): Promise<void>;
|
|
22
|
+
export interface ExternalAppPrompt {
|
|
23
|
+
scheme: string;
|
|
24
|
+
at: number;
|
|
25
|
+
}
|
|
26
|
+
/** What the agent is told while a tab may be sitting behind the prompt. */
|
|
27
|
+
export declare function externalAppPromptNote(prompt: ExternalAppPrompt): string;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A page that navigates to an app link (slack://, zoommtg://, ms-teams:// …) makes
|
|
3
|
+
* a headed Chromium raise its "Open <app>?" prompt. The prompt is part of the
|
|
4
|
+
* browser window, not the page, so the panel's screencast never shows it, and
|
|
5
|
+
* while it is up Chromium drops every click and key sent to that tab. The panel
|
|
6
|
+
* runs its window offscreen, so the tab looks frozen for no visible reason.
|
|
7
|
+
*
|
|
8
|
+
* Two layers deal with it. The guard below runs in every frame and cancels the
|
|
9
|
+
* navigations it can see (location changes, link clicks, window.open), so no
|
|
10
|
+
* prompt appears. Chromium offers no way to cancel the rest (an iframe whose src
|
|
11
|
+
* is an app link, a server redirect, a form post), so the panel watches for the
|
|
12
|
+
* request instead and tells the user and the agent how to clear the prompt.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Schemes the browser handles itself or opens without asking. mailto/news/snews
|
|
16
|
+
* are on Chromium's own never-prompt list, so they cannot freeze a tab.
|
|
17
|
+
*/
|
|
18
|
+
const HANDLED_SCHEMES = [
|
|
19
|
+
'http', 'https', 'ws', 'wss', 'about', 'blob', 'data', 'javascript', 'file', 'filesystem',
|
|
20
|
+
'chrome', 'chrome-extension', 'chrome-untrusted', 'chrome-error', 'devtools', 'view-source',
|
|
21
|
+
'mailto', 'news', 'snews',
|
|
22
|
+
];
|
|
23
|
+
const HANDLED = new Set(HANDLED_SCHEMES);
|
|
24
|
+
/** The scheme of a URL that would be handed to another application, lower-cased and without the colon. */
|
|
25
|
+
export function externalAppScheme(url) {
|
|
26
|
+
if (typeof url !== 'string')
|
|
27
|
+
return undefined;
|
|
28
|
+
const match = /^\s*([a-z][a-z0-9+.-]*):/i.exec(url);
|
|
29
|
+
if (!match)
|
|
30
|
+
return undefined;
|
|
31
|
+
const scheme = match[1].toLowerCase();
|
|
32
|
+
// A one-letter scheme is a Windows drive path, which Chromium refuses outright.
|
|
33
|
+
return scheme.length < 2 || HANDLED.has(scheme) ? undefined : scheme.slice(0, 64);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Runs in the page, in every frame, before the page's own scripts. It only adds a
|
|
37
|
+
* listener to the Navigation API; nothing on the page is patched or replaced.
|
|
38
|
+
*/
|
|
39
|
+
export const EXTERNAL_APP_GUARD_SCRIPT = `(() => {
|
|
40
|
+
try {
|
|
41
|
+
const nav = globalThis.navigation;
|
|
42
|
+
if (!nav || typeof nav.addEventListener !== 'function') return;
|
|
43
|
+
const handled = new Set(${JSON.stringify(HANDLED_SCHEMES)});
|
|
44
|
+
nav.addEventListener('navigate', event => {
|
|
45
|
+
try {
|
|
46
|
+
const match = /^\\s*([a-z][a-z0-9+.-]*):/i.exec(String(event.destination && event.destination.url));
|
|
47
|
+
if (!match) return;
|
|
48
|
+
const scheme = match[1].toLowerCase();
|
|
49
|
+
if (scheme.length > 1 && !handled.has(scheme) && event.cancelable) event.preventDefault();
|
|
50
|
+
} catch { /* A hostile page must not break the browser. */ }
|
|
51
|
+
});
|
|
52
|
+
} catch { /* The Navigation API is missing; the panel still reports the prompt. */ }
|
|
53
|
+
})()`;
|
|
54
|
+
export async function guardExternalApps(context) {
|
|
55
|
+
await Promise.resolve().then(() => context?.addInitScript?.(EXTERNAL_APP_GUARD_SCRIPT)).catch(() => { });
|
|
56
|
+
}
|
|
57
|
+
/** What the agent is told while a tab may be sitting behind the prompt. */
|
|
58
|
+
export function externalAppPromptNote(prompt) {
|
|
59
|
+
return `This tab asked to open a desktop app (${prompt.scheme}://). The browser may be showing an "Open app?" prompt that screenshots and snapshots cannot see; while it is up the tab ignores clicks and keys, and reloading does not clear it. Do not keep retrying. Ask the user to click "Show the browser window" in the Browser panel and press Cancel on the prompt, or close this tab and open the page in a new one.`;
|
|
60
|
+
}
|
|
@@ -13,6 +13,12 @@ export interface PanelArguments {
|
|
|
13
13
|
deltaY?: number;
|
|
14
14
|
}
|
|
15
15
|
export declare function validatePanelArguments(args: Record<string, unknown>): PanelArguments;
|
|
16
|
+
/**
|
|
17
|
+
* Runs the operation, then says so when the tab may be sitting behind the
|
|
18
|
+
* browser's "Open app?" prompt. A snapshot or screenshot of such a tab looks
|
|
19
|
+
* normal and clicks on it appear to succeed, so without the warning the agent
|
|
20
|
+
* retries the same click with nothing to tell it why the page does not react.
|
|
21
|
+
*/
|
|
16
22
|
export declare function runPanelOperation(views: BrowserViewManager, sessionId: string, args: PanelArguments, signal: AbortSignal): Promise<{
|
|
17
23
|
result: string;
|
|
18
24
|
image?: ToolImage;
|
|
@@ -78,7 +78,43 @@ export function validatePanelArguments(args) {
|
|
|
78
78
|
...(args.deltaY === undefined ? {} : { deltaY: args.deltaY }),
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Runs the operation, then says so when the tab may be sitting behind the
|
|
83
|
+
* browser's "Open app?" prompt. A snapshot or screenshot of such a tab looks
|
|
84
|
+
* normal and clicks on it appear to succeed, so without the warning the agent
|
|
85
|
+
* retries the same click with nothing to tell it why the page does not react.
|
|
86
|
+
*/
|
|
81
87
|
export async function runPanelOperation(views, sessionId, args, signal) {
|
|
88
|
+
const warning = () => {
|
|
89
|
+
try {
|
|
90
|
+
return views.appPromptNote?.(sessionId, args.tabId);
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
let answer;
|
|
97
|
+
try {
|
|
98
|
+
answer = await performPanelOperation(views, sessionId, args, signal);
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
const note = signal.aborted ? undefined : warning();
|
|
102
|
+
if (note && error instanceof Error)
|
|
103
|
+
throw new Error(`${error.message} ${note}`, { cause: error });
|
|
104
|
+
throw error;
|
|
105
|
+
}
|
|
106
|
+
const note = warning();
|
|
107
|
+
if (!note)
|
|
108
|
+
return answer;
|
|
109
|
+
try {
|
|
110
|
+
const data = JSON.parse(answer.result);
|
|
111
|
+
if (data && typeof data === 'object' && !Array.isArray(data))
|
|
112
|
+
return { ...answer, result: JSON.stringify({ ...data, warning: note }) };
|
|
113
|
+
}
|
|
114
|
+
catch { /* A result that is not JSON is returned as it is. */ }
|
|
115
|
+
return answer;
|
|
116
|
+
}
|
|
117
|
+
async function performPanelOperation(views, sessionId, args, signal) {
|
|
82
118
|
const { operation, url, tabId, selector } = args;
|
|
83
119
|
if (operation === 'tabs')
|
|
84
120
|
return { result: panelTabsResult(views, sessionId) };
|
|
@@ -202,7 +202,7 @@ export async function runBrowserTask(session, task, control, options = {}) {
|
|
|
202
202
|
const homeWorkspace = workspace === await realpath(homedir()).catch(() => homedir());
|
|
203
203
|
codeIntel = await CodeIntelligenceManager.create({ workspace, permissions, onEvent,
|
|
204
204
|
config: homeWorkspace ? { ...resolveCodeIntelConfig(config), enabled: false, enabledRepos: [] } : resolveCodeIntelConfig(config) });
|
|
205
|
-
const adapters = (provider) => trajectory.wrap(createAdapter(provider), () => ({ runId, providerId: provider.id }));
|
|
205
|
+
const adapters = (provider) => trajectory.wrap(createAdapter(provider, { sessionId: session.id }), () => ({ runId, providerId: provider.id }));
|
|
206
206
|
const resolvedModels = new Map();
|
|
207
207
|
const refreshed = await refreshModelContext(selected, signal);
|
|
208
208
|
resolvedModels.set(JSON.stringify([selected.id, selected.model]), Promise.resolve({ model: refreshed.model,
|
|
@@ -22,4 +22,9 @@ export declare function startBrowserServer(options?: BrowserServerOptions): Prom
|
|
|
22
22
|
url: string;
|
|
23
23
|
close(): Promise<void>;
|
|
24
24
|
}>;
|
|
25
|
+
export declare function loopbackRequestOrigin(host: string | undefined): string | undefined;
|
|
26
|
+
export declare function browserLaunch(url: string, environment?: NodeJS.ProcessEnv): {
|
|
27
|
+
text: string;
|
|
28
|
+
open: boolean;
|
|
29
|
+
};
|
|
25
30
|
export declare function openBrowserUrl(url: string): void;
|