@andorra-labs/code 0.1.13 → 0.1.14
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/agent-execution.js +300 -140
- package/dist/src/agent-mcp.js +2 -2
- 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 +100 -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 +52 -0
- package/dist/src/andorra/hosted.js +126 -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 +7 -0
- package/dist/src/andorra/notices.js +15 -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 +68 -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 +6 -2
- package/dist/src/app-server/protocol.js +1 -1
- package/dist/src/app-server.d.ts +27 -0
- package/dist/src/app-server.js +292 -85
- package/dist/src/auth/AuthManager.d.ts +9 -0
- package/dist/src/auth/AuthManager.js +161 -21
- 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-runner.js +1 -1
- 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 +65 -0
- package/dist/src/browser-view.js +229 -16
- package/dist/src/cli.js +43 -26
- package/dist/src/command-screens.d.ts +17 -1
- package/dist/src/command-screens.js +192 -21
- package/dist/src/commands.d.ts +7 -1
- package/dist/src/commands.js +78 -27
- package/dist/src/config.d.ts +6 -1
- package/dist/src/config.js +86 -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/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 +159 -5
- package/dist/src/graph-runner.js +27 -0
- package/dist/src/graph-selection.js +2 -1
- package/dist/src/graph-ui/app.js +25 -2
- 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/graphs.js +1 -3
- package/dist/src/hardened-runtime.js +1 -1
- package/dist/src/membership-errors.js +1 -1
- package/dist/src/membership.d.ts +10 -2
- package/dist/src/membership.js +20 -6
- 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 +40 -3
- 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 +15 -0
- package/dist/src/provider-settings.d.ts +16 -1
- package/dist/src/provider-settings.js +36 -20
- package/dist/src/providers.d.ts +14 -2
- package/dist/src/providers.js +69 -11
- package/dist/src/react-runtime.js +12 -7
- package/dist/src/remote/engine-pool.js +5 -4
- package/dist/src/run-control.d.ts +2 -2
- package/dist/src/run-control.js +9 -6
- package/dist/src/runtime.d.ts +2 -0
- package/dist/src/runtime.js +2 -1
- package/dist/src/sessions.d.ts +1 -0
- package/dist/src/sessions.js +4 -2
- package/dist/src/skills/bundled/graph-manager/errors.md +1 -1
- package/dist/src/skills/bundled/provenance.json +738 -738
- 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/terminal-ui.d.ts +21 -0
- package/dist/src/terminal-ui.js +73 -10
- package/dist/src/transcript.js +3 -0
- package/dist/src/types.d.ts +3 -0
- package/dist/src/workspace-instructions.js +1 -1
- package/package.json +12 -1
package/dist/src/browser-view.js
CHANGED
|
@@ -5,7 +5,7 @@ import { mkdir } from 'node:fs/promises';
|
|
|
5
5
|
import { dirname, join } from 'node:path';
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
7
|
import { observePage, observationResult } from './browser-observation.js';
|
|
8
|
-
import { desktopUaOverride, hardenContext,
|
|
8
|
+
import { desktopUaOverride, hardenContext, stealthLaunchArgs, STEALTH_LOCALE, userAgentMetadata } from './browser-stealth.js';
|
|
9
9
|
export const VIEW_TAB_LIMIT = 6;
|
|
10
10
|
export const VIEW_SESSION_LIMIT = 4;
|
|
11
11
|
export const VIEW_IDLE_CLOSE_MS = 10 * 60 * 1000;
|
|
@@ -28,8 +28,33 @@ export function nextFrameBudget(budget, scale) {
|
|
|
28
28
|
}
|
|
29
29
|
const VIEW_MAX_VIEWPORT = { width: 1600, height: 2200 };
|
|
30
30
|
export const VIEW_MOBILE_USER_AGENT = 'Mozilla/5.0 (Linux; Android 14; Pixel 8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Mobile Safari/537.36';
|
|
31
|
+
// Fallback for the mobile override when the running browser's version cannot be read.
|
|
31
32
|
const VIEW_URL_LIMIT = 2048;
|
|
32
33
|
const VIEW_CLIPBOARD_LIMIT = 1_000_000;
|
|
34
|
+
/**
|
|
35
|
+
* The panel browses with a real headed window so sites score it as a browser and
|
|
36
|
+
* not a bot, but the window is parked far offscreen: the pane shows the page by
|
|
37
|
+
* screencasting it, so the window does not need to be on screen or in the way.
|
|
38
|
+
* -32000 is the standard spot that Windows, macOS and Linux all keep off the
|
|
39
|
+
* visible desktop without clamping back.
|
|
40
|
+
*/
|
|
41
|
+
export const VIEW_OFFSCREEN_POSITION = { left: -32000, top: -32000 };
|
|
42
|
+
/** Where the window goes when the user asks to see it. */
|
|
43
|
+
export const VIEW_ONSCREEN_POSITION = { left: 80, top: 80 };
|
|
44
|
+
const VIEW_WINDOW_ARGS = [
|
|
45
|
+
`--window-position=${VIEW_OFFSCREEN_POSITION.left},${VIEW_OFFSCREEN_POSITION.top}`,
|
|
46
|
+
'--window-size=1600,1000',
|
|
47
|
+
];
|
|
48
|
+
/**
|
|
49
|
+
* The mobile emulation override is built from the running browser's real version,
|
|
50
|
+
* so the page never sees a version the browser itself does not have. Without a
|
|
51
|
+
* readable version the old constant stays the fallback.
|
|
52
|
+
*/
|
|
53
|
+
export function mobileUserAgent(version) {
|
|
54
|
+
if (!version || !/^\d+(\.\d+)*$/.test(version))
|
|
55
|
+
return VIEW_MOBILE_USER_AGENT;
|
|
56
|
+
return `Mozilla/5.0 (Linux; Android 14; Pixel 8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${version} Mobile Safari/537.36`;
|
|
57
|
+
}
|
|
33
58
|
const SELECTION_STATE = `(() => {
|
|
34
59
|
const active = document.activeElement;
|
|
35
60
|
const inFrame = !!active && (active.tagName === 'IFRAME' || active.tagName === 'FRAME');
|
|
@@ -194,6 +219,17 @@ export function viewLaunchOptions(channel, executablePath, scale = 1, extensionP
|
|
|
194
219
|
timeout: 20_000,
|
|
195
220
|
};
|
|
196
221
|
}
|
|
222
|
+
/**
|
|
223
|
+
* The options the panel actually launches with: the stealth launch options above,
|
|
224
|
+
* but headed, with the real window parked offscreen. A real window is what bot
|
|
225
|
+
* checks (Cloudflare's managed challenge among them) look for; the pane shows the
|
|
226
|
+
* page by screencasting it, so the window does not have to be visible or in the
|
|
227
|
+
* way. parkWindow re-asserts the offscreen position after the launch.
|
|
228
|
+
*/
|
|
229
|
+
export function headedViewLaunchOptions(channel, executablePath, scale = 1, extensionPaths = []) {
|
|
230
|
+
const base = viewLaunchOptions(channel, executablePath, scale, extensionPaths);
|
|
231
|
+
return { ...base, headless: false, args: [...base.args, ...VIEW_WINDOW_ARGS] };
|
|
232
|
+
}
|
|
197
233
|
export function frameGate(now, lastEmittedAt, minIntervalMs) {
|
|
198
234
|
return lastEmittedAt === undefined || now - lastEmittedAt >= minIntervalMs;
|
|
199
235
|
}
|
|
@@ -359,7 +395,7 @@ export class BrowserViewManager {
|
|
|
359
395
|
if (!candidate || !existsSync(candidate))
|
|
360
396
|
continue;
|
|
361
397
|
try {
|
|
362
|
-
return await chromium.launch(
|
|
398
|
+
return await chromium.launch(headedViewLaunchOptions(channel, candidate, scale));
|
|
363
399
|
}
|
|
364
400
|
catch (error) {
|
|
365
401
|
failures.push((error instanceof Error ? error.message : String(error)).split('\n')[0]);
|
|
@@ -392,7 +428,9 @@ export class BrowserViewManager {
|
|
|
392
428
|
if (!candidate || !existsSync(candidate))
|
|
393
429
|
continue;
|
|
394
430
|
const open = async (paths) => {
|
|
395
|
-
|
|
431
|
+
// Headed, so the browser's own identity goes through: no fake UA is set on
|
|
432
|
+
// the context. Only the locale stays as a stealth option.
|
|
433
|
+
const context = await chromium.launchPersistentContext(directory, { ...headedViewLaunchOptions(channel, candidate, scale, paths), locale: STEALTH_LOCALE, viewport: { ...viewport }, acceptDownloads: false });
|
|
396
434
|
await hardenContext(context);
|
|
397
435
|
return context;
|
|
398
436
|
};
|
|
@@ -446,6 +484,123 @@ export class BrowserViewManager {
|
|
|
446
484
|
}
|
|
447
485
|
this.options.extensions?.report(status);
|
|
448
486
|
}
|
|
487
|
+
/**
|
|
488
|
+
* Re-assert the offscreen position over the browser-level CDP connection after
|
|
489
|
+
* the launch. --window-position already asks for it at startup; this second
|
|
490
|
+
* pass catches window managers that clamp the window back on screen (macOS has
|
|
491
|
+
* done so with very large negative coordinates).
|
|
492
|
+
*/
|
|
493
|
+
parkWindow(browser) {
|
|
494
|
+
try {
|
|
495
|
+
const session = browser?.newBrowserCDPSession?.();
|
|
496
|
+
if (!session)
|
|
497
|
+
return;
|
|
498
|
+
void Promise.resolve().then(() => session).then(async (cdp) => {
|
|
499
|
+
const windowId = await this.windowIdFor(cdp, undefined);
|
|
500
|
+
if (windowId === undefined)
|
|
501
|
+
return;
|
|
502
|
+
await cdp.send('Browser.setWindowBounds', { windowId, bounds: { windowState: 'normal', ...VIEW_OFFSCREEN_POSITION } });
|
|
503
|
+
}).catch(() => { });
|
|
504
|
+
}
|
|
505
|
+
catch { /* same: never let window parking break the launch */ }
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Finds the id of the window that should be moved. The precise way is the target
|
|
509
|
+
* id of the tab the user is looking at; without one the browser target itself has
|
|
510
|
+
* no web contents to look a window up with, so the newest page target is used.
|
|
511
|
+
*/
|
|
512
|
+
async windowIdFor(cdp, targetId) {
|
|
513
|
+
if (targetId !== undefined) {
|
|
514
|
+
const direct = await this.lookupWindowId(cdp, { targetId });
|
|
515
|
+
if (direct !== undefined)
|
|
516
|
+
return direct;
|
|
517
|
+
}
|
|
518
|
+
const fallback = await this.lookupWindowId(cdp, {});
|
|
519
|
+
if (fallback !== undefined)
|
|
520
|
+
return fallback;
|
|
521
|
+
try {
|
|
522
|
+
const targets = await cdp.send('Target.getTargets');
|
|
523
|
+
const page = (targets?.targetInfos ?? []).find((info) => info.type === 'page' && typeof info.targetId === 'string');
|
|
524
|
+
if (page)
|
|
525
|
+
return await this.lookupWindowId(cdp, { targetId: page.targetId });
|
|
526
|
+
}
|
|
527
|
+
catch { /* nothing more to try */ }
|
|
528
|
+
return undefined;
|
|
529
|
+
}
|
|
530
|
+
async lookupWindowId(cdp, params) {
|
|
531
|
+
try {
|
|
532
|
+
const window = await cdp.send('Browser.getWindowForTarget', params);
|
|
533
|
+
return typeof window?.windowId === 'number' ? window.windowId : undefined;
|
|
534
|
+
}
|
|
535
|
+
catch {
|
|
536
|
+
return undefined;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
browserFor(session) {
|
|
540
|
+
if (session.profileKey !== undefined && session.profileOwner !== undefined) {
|
|
541
|
+
return this.profiles.get(session.profileKey)?.context?.browser?.() ?? session.browser;
|
|
542
|
+
}
|
|
543
|
+
return session.browser;
|
|
544
|
+
}
|
|
545
|
+
async browserCdpFor(session) {
|
|
546
|
+
if (session.profileKey !== undefined && session.profileOwner !== undefined) {
|
|
547
|
+
const host = this.profiles.get(session.profileKey);
|
|
548
|
+
if (!host)
|
|
549
|
+
throw new Error('The browser is closing; retry shortly');
|
|
550
|
+
host.browserCdp ??= Promise.resolve().then(() => {
|
|
551
|
+
const browser = this.browserFor(session);
|
|
552
|
+
if (!browser?.newBrowserCDPSession)
|
|
553
|
+
throw new Error('The panel browser cannot be moved on screen: it does not expose window control');
|
|
554
|
+
return browser.newBrowserCDPSession();
|
|
555
|
+
});
|
|
556
|
+
try {
|
|
557
|
+
return await host.browserCdp;
|
|
558
|
+
}
|
|
559
|
+
catch (error) {
|
|
560
|
+
if (this.profiles.get(session.profileKey)?.browserCdp === host.browserCdp)
|
|
561
|
+
host.browserCdp = undefined;
|
|
562
|
+
throw error;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
session.browserCdp ??= Promise.resolve().then(() => {
|
|
566
|
+
const browser = this.browserFor(session);
|
|
567
|
+
if (!browser?.newBrowserCDPSession)
|
|
568
|
+
throw new Error('The panel browser cannot be moved on screen: it does not expose window control');
|
|
569
|
+
return browser.newBrowserCDPSession();
|
|
570
|
+
});
|
|
571
|
+
try {
|
|
572
|
+
return await session.browserCdp;
|
|
573
|
+
}
|
|
574
|
+
catch (error) {
|
|
575
|
+
session.browserCdp = undefined;
|
|
576
|
+
throw error;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
async showWindow(sessionId) {
|
|
580
|
+
await this.moveWindow(sessionId, VIEW_ONSCREEN_POSITION, true);
|
|
581
|
+
}
|
|
582
|
+
async hideWindow(sessionId) {
|
|
583
|
+
await this.moveWindow(sessionId, VIEW_OFFSCREEN_POSITION, false);
|
|
584
|
+
}
|
|
585
|
+
async moveWindow(sessionId, position, activate) {
|
|
586
|
+
const session = this.sessions.get(sessionId);
|
|
587
|
+
if (!session || session.closing)
|
|
588
|
+
throw new Error('No browser tab is open for this session');
|
|
589
|
+
this.scheduleIdleClose(sessionId, session);
|
|
590
|
+
const cdp = await this.browserCdpFor(session);
|
|
591
|
+
const active = session.activeTabId ? session.tabs.get(session.activeTabId) : undefined;
|
|
592
|
+
const windowId = await this.windowIdFor(cdp, active?.targetId);
|
|
593
|
+
if (windowId === undefined)
|
|
594
|
+
throw new Error('The browser window could not be found to move');
|
|
595
|
+
await cdp.send('Browser.setWindowBounds', { windowId, bounds: { windowState: 'normal', ...position } });
|
|
596
|
+
if (activate) {
|
|
597
|
+
// Showing the window also raises the tab the panel is showing: the manager's
|
|
598
|
+
// selection and the native browser's selected tab are separate, so without
|
|
599
|
+
// this the real window can come up on a different tab than the one the user
|
|
600
|
+
// is interacting with (including while solving a challenge).
|
|
601
|
+
await Promise.resolve().then(() => active?.page?.bringToFront?.()).catch(() => { });
|
|
602
|
+
}
|
|
603
|
+
}
|
|
449
604
|
async restartForExtensions(force = false) {
|
|
450
605
|
if (this.closed)
|
|
451
606
|
return { restarted: 0, pending: [] };
|
|
@@ -622,24 +777,31 @@ export class BrowserViewManager {
|
|
|
622
777
|
await current.restarting;
|
|
623
778
|
continue;
|
|
624
779
|
}
|
|
625
|
-
const host = current ?? { users: new Set() };
|
|
780
|
+
const host = current ?? { users: new Set(), pendingBlanks: [] };
|
|
626
781
|
if (!current)
|
|
627
782
|
this.profiles.set(profile.key, host);
|
|
628
783
|
host.users.add(owner);
|
|
629
784
|
if (!host.starting)
|
|
630
785
|
host.scale = scale;
|
|
631
786
|
host.starting ??= this.launchPersistent(profile.directory, viewport, scale).then(async (context) => {
|
|
632
|
-
|
|
787
|
+
const pages = context.pages?.() ?? [];
|
|
788
|
+
const isBlank = (page) => {
|
|
633
789
|
const url = String(page.url?.() ?? '');
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
790
|
+
return !url || url === 'about:blank';
|
|
791
|
+
};
|
|
792
|
+
(host.unclaimed ??= []).push(...pages.filter(page => !isBlank(page)));
|
|
793
|
+
// Hold the leftover about:blank pages instead of closing them: under a headed
|
|
794
|
+
// launch the initial about:blank is the only tab of the real window, and
|
|
795
|
+
// closing it destroys the window, so every later Target.createTarget fails
|
|
796
|
+
// with "Failed to open a new tab". Headless tolerated that; a real window does
|
|
797
|
+
// not. The blanks are drained (drainPendingBlanks) as soon as the profile has
|
|
798
|
+
// a real page keeping the window alive.
|
|
799
|
+
host.pendingBlanks.push(...pages.filter(page => isBlank(page)));
|
|
639
800
|
context.on?.('page', (page) => { void this.claimExtensionPage(profile.key, page); });
|
|
640
801
|
context.on?.('close', () => { if (this.profiles.get(profile.key) === host)
|
|
641
802
|
this.profiles.delete(profile.key); });
|
|
642
803
|
host.context = context;
|
|
804
|
+
this.parkWindow(context?.browser?.());
|
|
643
805
|
return context;
|
|
644
806
|
});
|
|
645
807
|
try {
|
|
@@ -653,6 +815,19 @@ export class BrowserViewManager {
|
|
|
653
815
|
}
|
|
654
816
|
}
|
|
655
817
|
}
|
|
818
|
+
/**
|
|
819
|
+
* Closes the blank pages a persistent launch was left holding, once the profile
|
|
820
|
+
* has at least one real page: under a headed launch the initial about:blank is
|
|
821
|
+
* the only tab of the real window, and closing it while it is alone destroys the
|
|
822
|
+
* window, so the blanks are held until a real page keeps the window alive.
|
|
823
|
+
*/
|
|
824
|
+
async drainPendingBlanks(host) {
|
|
825
|
+
if (!host?.pendingBlanks?.length)
|
|
826
|
+
return;
|
|
827
|
+
const blanks = host.pendingBlanks.splice(0);
|
|
828
|
+
for (const blank of blanks)
|
|
829
|
+
await Promise.resolve().then(() => blank.close()).catch(() => { });
|
|
830
|
+
}
|
|
656
831
|
async claimExtensionPage(key, page) {
|
|
657
832
|
await new Promise(resolve => { const timer = setTimeout(resolve, EXTENSION_PAGE_CLAIM_MS); timer.unref?.(); });
|
|
658
833
|
if (this.claimedPages.has(page) || page.isClosed?.() === true || this.closed)
|
|
@@ -687,6 +862,8 @@ export class BrowserViewManager {
|
|
|
687
862
|
this.claimedPages.add(page);
|
|
688
863
|
void this.adoptPage(sessionId, session, page);
|
|
689
864
|
}
|
|
865
|
+
if (pages.length)
|
|
866
|
+
void this.drainPendingBlanks(host);
|
|
690
867
|
}
|
|
691
868
|
async releaseProfile(key, owner) {
|
|
692
869
|
const host = this.profiles.get(key);
|
|
@@ -721,7 +898,9 @@ export class BrowserViewManager {
|
|
|
721
898
|
}
|
|
722
899
|
}
|
|
723
900
|
}
|
|
724
|
-
|
|
901
|
+
const browser = await this.launch(scale);
|
|
902
|
+
this.parkWindow(browser);
|
|
903
|
+
return { browser, profile: this.incognito.has(sessionId) ? 'incognito' : 'isolated', renderScale: scale };
|
|
725
904
|
}
|
|
726
905
|
async disposeBrowser(session) {
|
|
727
906
|
if (session.profileKey === undefined || session.profileOwner === undefined) {
|
|
@@ -809,10 +988,17 @@ export class BrowserViewManager {
|
|
|
809
988
|
if (mobile === Boolean(tab.emulated))
|
|
810
989
|
return;
|
|
811
990
|
tab.emulated = mobile;
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
:
|
|
815
|
-
|
|
991
|
+
if (mobile) {
|
|
992
|
+
const version = this.browserVersion(session);
|
|
993
|
+
await tab.cdp.send('Emulation.setUserAgentOverride', { userAgent: mobileUserAgent(version), userAgentMetadata: userAgentMetadata(version, true) });
|
|
994
|
+
await tab.cdp.send('Emulation.setTouchEmulationEnabled', { enabled: true, maxTouchPoints: 5 });
|
|
995
|
+
}
|
|
996
|
+
else {
|
|
997
|
+
// Switching back to desktop re-applies the desktop identity: built from the
|
|
998
|
+
// real running version when it can be read, the stealth fallback otherwise.
|
|
999
|
+
await this.applyDesktopIdentity(session, tab);
|
|
1000
|
+
await tab.cdp.send('Emulation.setTouchEmulationEnabled', { enabled: false });
|
|
1001
|
+
}
|
|
816
1002
|
}
|
|
817
1003
|
catch { }
|
|
818
1004
|
}
|
|
@@ -821,6 +1007,22 @@ export class BrowserViewManager {
|
|
|
821
1007
|
tab.modeTask = tail.then(() => this.applyViewportMode(session, tab));
|
|
822
1008
|
return tab.modeTask;
|
|
823
1009
|
}
|
|
1010
|
+
browserVersion(session) {
|
|
1011
|
+
const context = session.context;
|
|
1012
|
+
const version = (context?.browser?.() ?? this.browserFor(session))?.version?.();
|
|
1013
|
+
return typeof version === 'string' && /^\d+(\.\d+)*$/.test(version) ? version : undefined;
|
|
1014
|
+
}
|
|
1015
|
+
/**
|
|
1016
|
+
* The desktop override after mobile emulation: built from the real running
|
|
1017
|
+
* browser version when it is readable, falling back to the stealth version when
|
|
1018
|
+
* it is not. A desktop UA carrying a version the running browser does not have
|
|
1019
|
+
* is exactly what fingerprinting checks catch, so the real one wins whenever it
|
|
1020
|
+
* is available.
|
|
1021
|
+
*/
|
|
1022
|
+
async applyDesktopIdentity(session, tab) {
|
|
1023
|
+
const version = this.browserVersion(session);
|
|
1024
|
+
await tab.cdp.send('Emulation.setUserAgentOverride', { ...desktopUaOverride(process.platform, version), userAgentMetadata: userAgentMetadata(version) }).catch(() => { });
|
|
1025
|
+
}
|
|
824
1026
|
emitFrame(sessionId, session, tab, payload) {
|
|
825
1027
|
if (session.closing || this.sessions.get(sessionId) !== session)
|
|
826
1028
|
return;
|
|
@@ -886,6 +1088,13 @@ export class BrowserViewManager {
|
|
|
886
1088
|
id: randomUUID(), page, cdp, url: '', title: '', loading: false,
|
|
887
1089
|
streaming: false, seq: 0, lastEmitAt: undefined, imageWidth: session.viewport.width, imageHeight: session.viewport.height,
|
|
888
1090
|
};
|
|
1091
|
+
// The target id ties window moves (show/hide) to the window that holds this
|
|
1092
|
+
// tab, so an extension popup opening its own window does not move the wrong one.
|
|
1093
|
+
void Promise.resolve().then(() => cdp.send('Target.getTargetInfo')).then((info) => {
|
|
1094
|
+
const id = info?.targetInfo?.targetId;
|
|
1095
|
+
if (typeof id === 'string' && id)
|
|
1096
|
+
tab.targetId = id;
|
|
1097
|
+
}).catch(() => { });
|
|
889
1098
|
const publish = () => this.publishTabs(sessionId, session);
|
|
890
1099
|
let documentRequest;
|
|
891
1100
|
page.on('request', (request) => {
|
|
@@ -1087,7 +1296,8 @@ export class BrowserViewManager {
|
|
|
1087
1296
|
if (session.context)
|
|
1088
1297
|
return session.context;
|
|
1089
1298
|
session.contextTask ??= Promise.resolve()
|
|
1090
|
-
|
|
1299
|
+
// Headed: the browser's own identity goes through, only the locale stays as a stealth option.
|
|
1300
|
+
.then(() => session.browser.newContext({ viewport: { ...session.viewport }, acceptDownloads: false, locale: STEALTH_LOCALE }))
|
|
1091
1301
|
.then(async (context) => { await hardenContext(context); session.context = context; return context; });
|
|
1092
1302
|
return await session.contextTask;
|
|
1093
1303
|
}
|
|
@@ -1193,6 +1403,9 @@ export class BrowserViewManager {
|
|
|
1193
1403
|
}
|
|
1194
1404
|
session.activeTabId = tab.id;
|
|
1195
1405
|
this.publishTabs(sessionId, session);
|
|
1406
|
+
// The profile now has a real page keeping the window alive: leftover launch
|
|
1407
|
+
// blanks can go. Awaited so the close is settled before the open reports.
|
|
1408
|
+
await this.drainPendingBlanks(session.profileKey === undefined ? undefined : this.profiles.get(session.profileKey));
|
|
1196
1409
|
try {
|
|
1197
1410
|
await page.goto(target, { waitUntil: 'domcontentloaded', timeout: VIEW_GOTO_TIMEOUT_MS });
|
|
1198
1411
|
}
|
package/dist/src/cli.js
CHANGED
|
@@ -14,7 +14,7 @@ import { homedir } from 'node:os';
|
|
|
14
14
|
import { workspacePermissionKey, permissionLabel } from './permissions.js';
|
|
15
15
|
import { configDirectory, loadConfig, resolveCodeIntelConfig, resolveConfiguredLimits, saveConfig } from './config.js';
|
|
16
16
|
import { compactHistory, compactedContextEstimate, executeCommand, HELP } from './commands.js';
|
|
17
|
-
import { applyModelContextWindow, createAdapter, providerSecrets, recordProviderModel } from './providers.js';
|
|
17
|
+
import { applyModelContextWindow, createAdapter, providerModelNames, providerSecrets, recordProviderModel } from './providers.js';
|
|
18
18
|
import { disposeAllQaProcesses, disposeAllQaPtys, getQaPtyManager } from './qa/index.js';
|
|
19
19
|
import { disposePooledPowerShell } from './powershell-pool.js';
|
|
20
20
|
import { loadWorkspaceInstructions, systemPromptOverrideFor } from './workspace-instructions.js';
|
|
@@ -22,7 +22,7 @@ import { runGraph, stopReasonPhrase } from './runtime.js';
|
|
|
22
22
|
import { GraphDeletedError, validateGraph } from './graphs.js';
|
|
23
23
|
import { checkGraphModelHealth, checkSessionModelHealth, formatGraphHealthFailure } from './graph-health.js';
|
|
24
24
|
import { ModelHealthCache } from './model-health-cache.js';
|
|
25
|
-
import { getMembership, loadAccessibleGraph, PaidMembershipRequiredError } from './membership.js';
|
|
25
|
+
import { currentGraphSelection, getMembership, loadAccessibleGraph, PaidMembershipRequiredError } from './membership.js';
|
|
26
26
|
import { configuredSurface, createRunHandle, drainTelemetry, graphShape, reportInterruptedRuns, reportRunFinished, reportRunStarted, reportSessionStarted } from './telemetry/surface.js';
|
|
27
27
|
import { createRunTelemetry, recordModelUse } from './telemetry/capture.js';
|
|
28
28
|
import { pricingFor } from './model-tiers.js';
|
|
@@ -75,6 +75,8 @@ import { createBrowserBridge } from './browser-bridge.js';
|
|
|
75
75
|
const loadTools = () => import('./tools.js');
|
|
76
76
|
import { enablePrivateRunTemp, removePrivateRunTemp } from './run-temp.js';
|
|
77
77
|
import { TOOL_PROFILES, isToolProfile } from './tool-profile.js';
|
|
78
|
+
import { andorraProviderIds, createTerminalAndorra } from './andorra/terminal.js';
|
|
79
|
+
import { watchRequests } from './andorra/request-watch.js';
|
|
78
80
|
const WARM_IDLE_MS = 400;
|
|
79
81
|
async function warmRunModules(lastInputAt, stop) {
|
|
80
82
|
for (const load of [loadTools, () => import('./engine-streams.js').then(module => module.loadEngineStreams()), () => import('typebox/compile')]) {
|
|
@@ -253,6 +255,8 @@ function reportSignOut(json, terminal, reason, journal) {
|
|
|
253
255
|
}
|
|
254
256
|
export async function main(argv = process.argv.slice(2), dependencies = {}) {
|
|
255
257
|
bootMark('cli.main');
|
|
258
|
+
// The terminal saves the config it holds in memory. saveConfig itself, under the save lock, drops an Andorra
|
|
259
|
+
// entry the user removed in another client, so such a save cannot bring it back.
|
|
256
260
|
const persistConfig = dependencies.saveConfig ?? saveConfig;
|
|
257
261
|
const loadGraph = dependencies.loadGraph ?? loadAccessibleGraph;
|
|
258
262
|
const checkGraphHealth = dependencies.checkGraphHealth ?? checkGraphModelHealth;
|
|
@@ -423,6 +427,8 @@ export async function main(argv = process.argv.slice(2), dependencies = {}) {
|
|
|
423
427
|
}
|
|
424
428
|
};
|
|
425
429
|
const startupReject = (message) => startupGuard(async () => { throw new Error(message); });
|
|
430
|
+
if (values.graph !== undefined)
|
|
431
|
+
values.graph = currentGraphSelection(values.graph);
|
|
426
432
|
if (values.graph && values.graph !== 'default')
|
|
427
433
|
await startupGuard(() => loadGraph(values.graph));
|
|
428
434
|
if (values.json && !values.prompt)
|
|
@@ -480,18 +486,10 @@ export async function main(argv = process.argv.slice(2), dependencies = {}) {
|
|
|
480
486
|
});
|
|
481
487
|
bootMark('cli.config');
|
|
482
488
|
const permissions = values.yolo ? 'full-access' : config.workspacePermissions?.[workspacePermissionKey(workspace)] ?? 'ask-for-approval';
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
const
|
|
486
|
-
|
|
487
|
-
if (!match || jevOverride === undefined)
|
|
488
|
-
return;
|
|
489
|
-
if (match[1] === 'on' || match[1] === 'off')
|
|
490
|
-
jevOverride = undefined;
|
|
491
|
-
else
|
|
492
|
-
result.text += `\nThis session started with --jev ${jevOverride ? 'on' : 'off'}, which overrides the saved preference until /jev on|off.`;
|
|
493
|
-
};
|
|
494
|
-
const state = await startupGuard(async () => ({ config, workspace, graph: values.graph ?? configuredGraphSelection(config, await currentGraphSubject()), permissions, yolo: permissions === 'full-access', usage: { inputTokens: 0, outputTokens: 0, requests: 0 }, notify: print, history: [], ...(startupGoal?.action === 'set' ? { goal: newSessionGoal(startupGoal.text) } : {}),
|
|
489
|
+
if (values.jev === 'on' && config.jevEnabled === false)
|
|
490
|
+
process.stderr.write('--jev on has no effect: the Global Jev switch is off. Turn it on with /jev global on or in Settings.\n');
|
|
491
|
+
const jevOn = () => config.jevEnabled !== false && state.jev !== false;
|
|
492
|
+
const state = await startupGuard(async () => ({ config, workspace, graph: values.graph ?? configuredGraphSelection(config, await currentGraphSubject()), permissions, yolo: permissions === 'full-access', usage: { inputTokens: 0, outputTokens: 0, requests: 0 }, notify: print, history: [], ...(values.jev === undefined ? {} : { jev: values.jev === 'on' }), ...(startupGoal?.action === 'set' ? { goal: newSessionGoal(startupGoal.text) } : {}),
|
|
495
493
|
readLine: async (prompt, signal) => {
|
|
496
494
|
if (!terminal)
|
|
497
495
|
throw new Error('No interactive terminal to read from.');
|
|
@@ -578,7 +576,7 @@ export async function main(argv = process.argv.slice(2), dependencies = {}) {
|
|
|
578
576
|
if (!savedSession)
|
|
579
577
|
return;
|
|
580
578
|
const pendingHistory = pendingTask ? [{ task: pendingTask, completion: { summary: RUNNING_TURN_SUMMARY, tests: [], status: 'running' }, ...(pendingRunId === undefined ? {} : { runId: pendingRunId }), ...(pendingAttachments?.length ? { attachments: pendingAttachments } : {}) }] : [];
|
|
581
|
-
savedSession = { projectId: savedSession.projectId ?? projectIdentity(workspace), ...savedSession, goal: state.goal, contextHistory: [...state.history ?? [], ...pendingHistory].slice(-6), updatedAt: new Date().toISOString(), history: [...sessionArchive, ...pendingHistory], usage: { ...state.usage }, trajectoryId: trajectory.sessionId };
|
|
579
|
+
savedSession = { projectId: savedSession.projectId ?? projectIdentity(workspace), ...savedSession, goal: state.goal, ...(state.jev === undefined ? {} : { jevEnabled: state.jev }), contextHistory: [...state.history ?? [], ...pendingHistory].slice(-6), updatedAt: new Date().toISOString(), history: [...sessionArchive, ...pendingHistory], usage: { ...state.usage }, trajectoryId: trajectory.sessionId };
|
|
582
580
|
const record = savedSession;
|
|
583
581
|
try {
|
|
584
582
|
let releaseRailLock;
|
|
@@ -757,7 +755,7 @@ export async function main(argv = process.argv.slice(2), dependencies = {}) {
|
|
|
757
755
|
await startupGuard(async () => {
|
|
758
756
|
const selected = config.providers.find(p => p.id === config.provider);
|
|
759
757
|
const codeIntelState = codeIntelLabel((await codeIntel.getStatus()).state);
|
|
760
|
-
terminal = new TerminalUI({ goal: state.goal, account: { label: 'Checking account...', notice: 'Checking member access. Local Andorra Agent remains available.' }, workspace, provider: selected?.id ?? 'No provider', model: selected?.model ?? '/providers to configure', providerModels: Object.fromEntries(config.providers.map(p => [p.id, p.model])), reasoningEffort: selected?.reasoningEffort, contextWindow: selected?.contextWindow, version: await cliVersion(), branch: await gitBranch(workspace), yolo: state.yolo, permissions: permissionLabel(state.permissions), graphSelection: state.graph ?? 'default',
|
|
758
|
+
terminal = new TerminalUI({ goal: state.goal, account: { label: 'Checking account...', notice: 'Checking member access. Local Andorra Agent remains available.' }, workspace, provider: selected?.id ?? 'No provider', model: selected?.model ?? '/providers to configure', providerModels: Object.fromEntries(config.providers.map(p => [p.id, p.model])), modelNames: providerModelNames(config.providers), andorraProviders: andorraProviderIds(config.providers), reasoningEffort: selected?.reasoningEffort, contextWindow: selected?.contextWindow, version: await cliVersion(), branch: await gitBranch(workspace), yolo: state.yolo, permissions: permissionLabel(state.permissions), graphSelection: state.graph ?? 'default',
|
|
761
759
|
graph: startupGraph ?? await loadGraph(state.graph ?? 'default').catch(() => undefined), ...(codeIntelState ? { codeIntel: codeIntelState } : {}), clipboardImageProbe: readClipboardImage, clipboardTextWriter: writeClipboardText });
|
|
762
760
|
offerSkillCommands(terminal, state.config, directory);
|
|
763
761
|
terminal.setLocalCommandHandler((input, mode, durationMs) => {
|
|
@@ -773,7 +771,7 @@ export async function main(argv = process.argv.slice(2), dependencies = {}) {
|
|
|
773
771
|
jevEnabled = jevOn();
|
|
774
772
|
const configured = config.providers.find(p => p.id === config.provider);
|
|
775
773
|
const selected = configured ? runtimeProvider(configured) : undefined;
|
|
776
|
-
terminal?.setStatus({ provider: selected?.id ?? 'No provider', model: selected?.model ?? '/providers to configure', providerModels: Object.fromEntries(config.providers.map(p => [p.id, p.model])), reasoningEffort: selected?.reasoningEffort, contextWindow: selected?.contextWindow, yolo: state.yolo, permissions: permissionLabel(state.permissions), jevEnabled, goal: state.goal, ...sessionUsage() });
|
|
774
|
+
terminal?.setStatus({ provider: selected?.id ?? 'No provider', model: selected?.model ?? '/providers to configure', providerModels: Object.fromEntries(config.providers.map(p => [p.id, p.model])), modelNames: providerModelNames(config.providers), andorraProviders: andorraProviderIds(config.providers), andorraUsage: state.andorra?.usage?.(), reasoningEffort: selected?.reasoningEffort, contextWindow: selected?.contextWindow, yolo: state.yolo, permissions: permissionLabel(state.permissions), jevEnabled, goal: state.goal, ...sessionUsage() });
|
|
777
775
|
};
|
|
778
776
|
let graphModelsHealthy = false;
|
|
779
777
|
const refreshGraphStatus = async (background) => {
|
|
@@ -815,8 +813,8 @@ export async function main(argv = process.argv.slice(2), dependencies = {}) {
|
|
|
815
813
|
await modelHealth.load();
|
|
816
814
|
const sessionOnly = (state.graph ?? 'default') === 'default' && checkSessionModel !== undefined;
|
|
817
815
|
const health = sessionOnly
|
|
818
|
-
? await checkSessionModel(config, controller.signal, { verified: modelHealth })
|
|
819
|
-
: await checkGraphHealth(graph, config, controller.signal, { verified: modelHealth });
|
|
816
|
+
? await checkSessionModel(config, controller.signal, { verified: modelHealth, andorra: () => state.andorra?.gate?.() })
|
|
817
|
+
: await checkGraphHealth(graph, config, controller.signal, { verified: modelHealth, andorra: () => state.andorra?.gate?.() });
|
|
820
818
|
graphModelsHealthy = health.healthy;
|
|
821
819
|
if (!health.healthy)
|
|
822
820
|
print(formatGraphHealthFailure(health, sessionOnly
|
|
@@ -843,6 +841,7 @@ export async function main(argv = process.argv.slice(2), dependencies = {}) {
|
|
|
843
841
|
let accountRefresh;
|
|
844
842
|
let accountRefreshTimer;
|
|
845
843
|
let accountPolling;
|
|
844
|
+
let andorraMonitor;
|
|
846
845
|
const refreshAccountStatus = async () => {
|
|
847
846
|
accountRefresh?.abort();
|
|
848
847
|
const request = accountRefresh = new AbortController();
|
|
@@ -1091,12 +1090,17 @@ export async function main(argv = process.argv.slice(2), dependencies = {}) {
|
|
|
1091
1090
|
return checkpointWrites;
|
|
1092
1091
|
};
|
|
1093
1092
|
let previewInFlight = false;
|
|
1094
|
-
|
|
1093
|
+
// Set by the first model request this run sends to an Andorra provider (the health probe's included): the
|
|
1094
|
+
// hosted usage is asked for again when such a run ends.
|
|
1095
|
+
let askedAndorra = false;
|
|
1096
|
+
const tracedAdapter = (provider, inSession = true) => {
|
|
1095
1097
|
if (provider.apiKey)
|
|
1096
1098
|
trajectory.addSecrets([provider.apiKey]);
|
|
1097
1099
|
if (provider.apiKeyEnv && process.env[provider.apiKeyEnv])
|
|
1098
1100
|
trajectory.addSecrets([process.env[provider.apiKeyEnv]]);
|
|
1099
|
-
const
|
|
1101
|
+
const created = createAdapter(provider, inSession ? { sessionId: savedSession?.id ?? trajectory.sessionId } : {});
|
|
1102
|
+
const watched = provider.type !== 'andorra' ? created : watchRequests(created, () => { askedAndorra = true; });
|
|
1103
|
+
const traced = trajectory.wrap(watched, () => ({ runId, providerId: provider.id }));
|
|
1100
1104
|
if (!terminal)
|
|
1101
1105
|
return traced;
|
|
1102
1106
|
return {
|
|
@@ -1221,7 +1225,8 @@ export async function main(argv = process.argv.slice(2), dependencies = {}) {
|
|
|
1221
1225
|
else {
|
|
1222
1226
|
const commandState = command === '/usage' ? { ...state, usage: sessionUsage() } : command === '/jev' ? { ...state, running: true } : state;
|
|
1223
1227
|
const result = await executeCommand(text, commandState, persistConfig);
|
|
1224
|
-
|
|
1228
|
+
if (command === '/jev')
|
|
1229
|
+
state.jev = commandState.jev;
|
|
1225
1230
|
if (runControl) {
|
|
1226
1231
|
runControl.yolo = state.yolo;
|
|
1227
1232
|
runControl.permissions = state.permissions;
|
|
@@ -1292,7 +1297,9 @@ export async function main(argv = process.argv.slice(2), dependencies = {}) {
|
|
|
1292
1297
|
}
|
|
1293
1298
|
probeModels.set(key, entry);
|
|
1294
1299
|
},
|
|
1295
|
-
|
|
1300
|
+
// The probe is not part of the session's conversation: it carries no session id.
|
|
1301
|
+
createAdapter: provider => tracedAdapter(provider, false),
|
|
1302
|
+
andorra: () => state.andorra?.gate?.(),
|
|
1296
1303
|
}));
|
|
1297
1304
|
graphModelsHealthy = health.healthy;
|
|
1298
1305
|
if (!health.healthy) {
|
|
@@ -1632,6 +1639,9 @@ export async function main(argv = process.argv.slice(2), dependencies = {}) {
|
|
|
1632
1639
|
throw error;
|
|
1633
1640
|
}
|
|
1634
1641
|
finally {
|
|
1642
|
+
// However the run ended, a run that spent from the hosted allowance asks for the new figure; never awaited.
|
|
1643
|
+
if (askedAndorra)
|
|
1644
|
+
void andorraMonitor?.check('run-end').catch(() => { });
|
|
1635
1645
|
browserDraining = true;
|
|
1636
1646
|
terminal?.setRunInputHandler(undefined);
|
|
1637
1647
|
livePicker.abort();
|
|
@@ -1808,6 +1818,10 @@ export async function main(argv = process.argv.slice(2), dependencies = {}) {
|
|
|
1808
1818
|
.then(() => bootMark('cli.warm'));
|
|
1809
1819
|
accountPolling = setInterval(scheduleAccountRefresh, 60_000);
|
|
1810
1820
|
accountPolling.unref?.();
|
|
1821
|
+
const andorra = createTerminalAndorra({ config: state.config, directory: configDirectory(), print, refreshStatus });
|
|
1822
|
+
const monitor = andorraMonitor = andorra.monitor;
|
|
1823
|
+
state.andorra = andorra.hooks;
|
|
1824
|
+
void monitor.start();
|
|
1811
1825
|
while (!exiting) {
|
|
1812
1826
|
let line;
|
|
1813
1827
|
try {
|
|
@@ -1867,7 +1881,11 @@ export async function main(argv = process.argv.slice(2), dependencies = {}) {
|
|
|
1867
1881
|
state.history = structuredClone(record.contextHistory ?? record.history).slice(-6);
|
|
1868
1882
|
state.usage = { ...record.usage };
|
|
1869
1883
|
state.goal = record.goal ? { ...record.goal } : undefined;
|
|
1870
|
-
|
|
1884
|
+
if (record.jevEnabled === undefined)
|
|
1885
|
+
delete state.jev;
|
|
1886
|
+
else
|
|
1887
|
+
state.jev = record.jevEnabled;
|
|
1888
|
+
terminal.setStatus({ goal: state.goal, jevEnabled: jevOn() });
|
|
1871
1889
|
terminal.resetDashboardSession(record.usage);
|
|
1872
1890
|
delete state.lastRun;
|
|
1873
1891
|
contextUsedTokens = compactedContextEstimate(state.history);
|
|
@@ -1954,7 +1972,6 @@ export async function main(argv = process.argv.slice(2), dependencies = {}) {
|
|
|
1954
1972
|
}
|
|
1955
1973
|
else
|
|
1956
1974
|
command = await executeCommand(line, state, persistConfig);
|
|
1957
|
-
afterJevCommand(line, command);
|
|
1958
1975
|
trajectory.addSecrets(providerSecrets(config.providers));
|
|
1959
1976
|
if (/^\/graph(?:\s|$)|^\/(?:auth\s+)?logout\s*$/.test(line) || command.clear && /^\/(providers|model)(?:\s|$)/.test(line))
|
|
1960
1977
|
await refreshGraphStatus();
|
|
@@ -2030,7 +2047,7 @@ export async function main(argv = process.argv.slice(2), dependencies = {}) {
|
|
|
2030
2047
|
() => sessionStarted,
|
|
2031
2048
|
() => trajectory.flush(),
|
|
2032
2049
|
() => { if (accountPolling)
|
|
2033
|
-
clearInterval(accountPolling); if (accountRefreshTimer)
|
|
2050
|
+
clearInterval(accountPolling); andorraMonitor?.stop(); if (accountRefreshTimer)
|
|
2034
2051
|
clearTimeout(accountRefreshTimer); accountRefresh?.abort(); process.off('SIGINT', interrupt); process.off('SIGTERM', teardown); },
|
|
2035
2052
|
() => terminal?.close(),
|
|
2036
2053
|
() => graphEditor.close(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { currentGraphSubject } from './graph-selection.js';
|
|
2
2
|
import { loadAccessibleGraph, type Membership } from './membership.js';
|
|
3
|
-
import type
|
|
3
|
+
import { type CommandState } from './commands.js';
|
|
4
4
|
import type { Config } from './config.js';
|
|
5
5
|
import { type ProviderConfig } from './providers.js';
|
|
6
6
|
import type { ModelAdapter } from './types.js';
|
|
@@ -33,6 +33,14 @@ export interface CommandScreenUI {
|
|
|
33
33
|
collapsePrefix?: string;
|
|
34
34
|
footer?: string;
|
|
35
35
|
yieldToQuestions?: boolean;
|
|
36
|
+
/** Rows that can change while the select is open: called with `redraw` when it opens, returns the cleanup for when it closes. */
|
|
37
|
+
refresh?: (redraw: (items: {
|
|
38
|
+
id: string;
|
|
39
|
+
label: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
bold?: boolean;
|
|
42
|
+
separator?: boolean;
|
|
43
|
+
}[]) => void) => () => void;
|
|
36
44
|
}): Promise<string | undefined>;
|
|
37
45
|
showScreen(title: string, lines: string[], options?: {
|
|
38
46
|
signal?: AbortSignal;
|
|
@@ -56,6 +64,14 @@ type ModelTreeRow = {
|
|
|
56
64
|
model?: string;
|
|
57
65
|
};
|
|
58
66
|
export declare const modelTreeId: (row: ModelTreeRow) => string;
|
|
67
|
+
/**
|
|
68
|
+
* The `refresh` option for a select whose rows depend on Andorra's state: while the select is open, every settled
|
|
69
|
+
* check (and an added or removed entry) builds the rows again, and the select is redrawn in place only when they
|
|
70
|
+
* differ from what is on screen. Empty when the client has no monitor to listen to.
|
|
71
|
+
*/
|
|
72
|
+
export declare function andorraRefresh<Row>(state: CommandState, rows: () => Row[]): {
|
|
73
|
+
refresh?: (redraw: (items: Row[]) => void) => () => void;
|
|
74
|
+
};
|
|
59
75
|
/**
|
|
60
76
|
* The /model screen: every configured provider as a collapsed row ending in `>`, with its models
|
|
61
77
|
* indented beneath once expanded (Right Arrow or Enter expands, Left Arrow collapses). A provider's
|