@andorra-labs/code 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/THIRD_PARTY_NOTICES.md +2 -1
  2. package/dist/src/account-presentation.d.ts +11 -0
  3. package/dist/src/account-presentation.js +29 -2
  4. package/dist/src/agent-execution.js +37 -4
  5. package/dist/src/agent-mcp.d.ts +12 -0
  6. package/dist/src/agent-mcp.js +81 -2
  7. package/dist/src/app-server/protocol.d.ts +12 -0
  8. package/dist/src/app-server/reasoning.d.ts +0 -8
  9. package/dist/src/app-server/reasoning.js +15 -28
  10. package/dist/src/app-server.d.ts +7 -0
  11. package/dist/src/app-server.js +59 -11
  12. package/dist/src/auth/AuthManager.d.ts +15 -0
  13. package/dist/src/auth/AuthManager.js +66 -7
  14. package/dist/src/browser-runner.js +1 -2
  15. package/dist/src/browser-server.js +10 -2
  16. package/dist/src/browser-session.js +6 -2
  17. package/dist/src/browser-stealth.d.ts +29 -0
  18. package/dist/src/browser-stealth.js +166 -0
  19. package/dist/src/browser-ui/app.js +108 -13
  20. package/dist/src/browser-ui/icons/chevron-right.svg +8 -0
  21. package/dist/src/browser-ui/index.html +8 -8
  22. package/dist/src/browser-ui/style.css +199 -171
  23. package/dist/src/browser-ui/tokens.css +198 -0
  24. package/dist/src/browser-view.d.ts +57 -9
  25. package/dist/src/browser-view.js +187 -36
  26. package/dist/src/cli.js +21 -4
  27. package/dist/src/coding-tools.js +9 -5
  28. package/dist/src/command-screens.js +4 -4
  29. package/dist/src/commands.d.ts +1 -1
  30. package/dist/src/commands.js +2 -1
  31. package/dist/src/completion-gates.d.ts +35 -0
  32. package/dist/src/completion-gates.js +25 -0
  33. package/dist/src/completion.d.ts +6 -0
  34. package/dist/src/completion.js +36 -3
  35. package/dist/src/config.d.ts +1 -1
  36. package/dist/src/config.js +2 -2
  37. package/dist/src/context-budget.d.ts +11 -0
  38. package/dist/src/context-budget.js +13 -0
  39. package/dist/src/decision/DecisionEngine.d.ts +5 -1
  40. package/dist/src/decision/DecisionManager.d.ts +1 -0
  41. package/dist/src/decision/DecisionManager.js +14 -3
  42. package/dist/src/decision/FactContinuations.d.ts +6 -0
  43. package/dist/src/decision/FactContinuations.js +9 -1
  44. package/dist/src/decision/FactServiceGate.js +1 -1
  45. package/dist/src/decision/hostedSkills.d.ts +37 -0
  46. package/dist/src/decision/hostedSkills.js +64 -0
  47. package/dist/src/decision/providers/AndorraDecisionProvider.d.ts +10 -2
  48. package/dist/src/decision/providers/AndorraDecisionProvider.js +121 -10
  49. package/dist/src/default-graph.d.ts +11 -0
  50. package/dist/src/default-graph.js +20 -0
  51. package/dist/src/duration.d.ts +13 -2
  52. package/dist/src/duration.js +27 -3
  53. package/dist/src/graph-manager-chat.d.ts +302 -0
  54. package/dist/src/graph-manager-chat.js +940 -0
  55. package/dist/src/graph-runner.js +6 -0
  56. package/dist/src/graph-server.d.ts +9 -0
  57. package/dist/src/graph-server.js +167 -16
  58. package/dist/src/graph-studio-features.js +2 -2
  59. package/dist/src/graph-sync.js +5 -2
  60. package/dist/src/graph-ui/app.js +252 -71
  61. package/dist/src/graph-ui/controls.css +55 -32
  62. package/dist/src/graph-ui/controls.js +85 -9
  63. package/dist/src/graph-ui/edge-router.js +114 -13
  64. package/dist/src/graph-ui/embed.js +23 -8
  65. package/dist/src/graph-ui/index.html +3 -3
  66. package/dist/src/graph-ui/library.css +4 -10
  67. package/dist/src/graph-ui/manager-markdown.js +155 -0
  68. package/dist/src/graph-ui/manager-state.js +191 -0
  69. package/dist/src/graph-ui/manager.css +161 -0
  70. package/dist/src/graph-ui/manager.js +700 -0
  71. package/dist/src/graph-ui/studio-canvas.js +2 -0
  72. package/dist/src/graph-ui/studio.css +24 -23
  73. package/dist/src/graph-ui/studio.js +29 -8
  74. package/dist/src/graph-ui/style.css +125 -92
  75. package/dist/src/graph-ui/tokens.css +217 -151
  76. package/dist/src/graphs.d.ts +69 -1
  77. package/dist/src/graphs.js +160 -7
  78. package/dist/src/hardened-runtime.js +8 -2
  79. package/dist/src/membership-errors.d.ts +14 -0
  80. package/dist/src/membership-errors.js +24 -1
  81. package/dist/src/membership.d.ts +20 -0
  82. package/dist/src/membership.js +45 -16
  83. package/dist/src/palette.d.ts +25 -8
  84. package/dist/src/palette.js +26 -8
  85. package/dist/src/provider-engine.d.ts +4 -4
  86. package/dist/src/provider-engine.js +39 -22
  87. package/dist/src/providers.d.ts +24 -0
  88. package/dist/src/providers.js +47 -2
  89. package/dist/src/qa/guidance.d.ts +26 -0
  90. package/dist/src/qa/guidance.js +59 -0
  91. package/dist/src/qa/index.d.ts +1 -6
  92. package/dist/src/qa/index.js +1 -14
  93. package/dist/src/qa/runtime/ProcessManager.d.ts +20 -2
  94. package/dist/src/qa/runtime/ProcessManager.js +69 -13
  95. package/dist/src/react-runtime.d.ts +11 -0
  96. package/dist/src/react-runtime.js +190 -51
  97. package/dist/src/remote/engine-pool.js +4 -1
  98. package/dist/src/run-progress.d.ts +6 -0
  99. package/dist/src/run-progress.js +7 -0
  100. package/dist/src/runtime.d.ts +8 -0
  101. package/dist/src/session-skills.d.ts +75 -0
  102. package/dist/src/session-skills.js +151 -0
  103. package/dist/src/side-panel.d.ts +1 -1
  104. package/dist/src/side-panel.js +6 -12
  105. package/dist/src/skill-commands.js +1 -1
  106. package/dist/src/skills/bundled/control-browser/SKILL.md +9 -1
  107. package/dist/src/skills/bundled/graph-manager/SKILL.md +8 -0
  108. package/dist/src/skills/bundled/provenance.json +3 -3
  109. package/dist/src/skills/bundled/web-gui-tester/SKILL.md +1 -1
  110. package/dist/src/stall-recovery.d.ts +22 -0
  111. package/dist/src/stall-recovery.js +71 -0
  112. package/dist/src/subagent-run.js +1 -2
  113. package/dist/src/terminal-ui.d.ts +2 -2
  114. package/dist/src/terminal-ui.js +18 -13
  115. package/dist/src/transcript.js +9 -1
  116. package/dist/src/types.d.ts +18 -4
  117. package/dist/src/usage-analytics.d.ts +7 -0
  118. package/dist/src/usage-analytics.js +55 -15
  119. package/docs/concepts/README.md +1 -1
  120. package/docs/concepts/limits.md +9 -0
  121. package/docs/guides/desktop-app.md +1 -1
  122. package/docs/guides/graph-builder.md +16 -1
  123. package/docs/reference/slash-commands.md +2 -1
  124. package/docs/superpowers/plans/2026-11-13-graph-manager-chat.md +203 -0
  125. package/docs/superpowers/plans/2026-11-14-jev-fair-use-pricing.md +79 -0
  126. package/docs/superpowers/specs/2026-11-13-graph-manager-chat-design.md +182 -0
  127. package/docs/superpowers/specs/2026-11-14-jev-fair-use-pricing-design.md +156 -0
  128. package/package.json +1 -1
  129. package/tests/chat-side-panel-test-plan.md +1 -1
@@ -5,6 +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, stealthContextOptions, stealthLaunchArgs } from './browser-stealth.js';
8
9
  export const VIEW_TAB_LIMIT = 6;
9
10
  export const VIEW_SESSION_LIMIT = 4;
10
11
  export const VIEW_IDLE_CLOSE_MS = 10 * 60 * 1000;
@@ -13,8 +14,40 @@ export const VIEW_FRAME_MIN_INTERVAL_MS = 16;
13
14
  export const VIEW_GOTO_TIMEOUT_MS = 30_000;
14
15
  /** The viewport Mobile mode simulates, in CSS pixels: an iPhone-class layout. */
15
16
  export const VIEW_MOBILE_VIEWPORT = { width: 390, height: 844 };
17
+ /** The pixel density Mobile mode emulates: a current phone's. */
18
+ const VIEW_MOBILE_SCALE = 3;
16
19
  /** The JPEG quality stream frames use; agent screenshots keep their own setting. */
17
- export const VIEW_STREAM_QUALITY = 75;
20
+ export const VIEW_STREAM_QUALITY = 90;
21
+ /**
22
+ * The largest display pixel ratio a desktop-mode page renders at. A 4K laptop
23
+ * panel at 300% scaling is the densest display Windows ships with; past that
24
+ * the frames only cost bandwidth the pane cannot show.
25
+ */
26
+ export const VIEW_MAX_SCALE = 3;
27
+ /**
28
+ * The largest frame the desktop accepts, in base64 characters (`parseFrameEvent`
29
+ * in desktop/src/engine/browserView.ts drops anything bigger). A dropped frame
30
+ * leaves the pane frozen, so a frame over this is never sent: the stream steps
31
+ * its quality and then its size down until the page's frames fit.
32
+ */
33
+ export const VIEW_FRAME_LIMIT = 4 * 1024 * 1024;
34
+ /** The lowest JPEG quality the frame budget steps down to before it shrinks frames instead. */
35
+ const VIEW_BUDGET_QUALITY_FLOOR = 50;
36
+ /**
37
+ * The next, smaller frame budget after a frame came out over the limit: quality
38
+ * first, in steps of 20 down to 50, then the frame size in steps of a quarter,
39
+ * down to the page's CSS size. Undefined when there is nothing left to give up.
40
+ */
41
+ export function nextFrameBudget(budget, scale) {
42
+ if (budget.quality > VIEW_BUDGET_QUALITY_FLOOR)
43
+ return { quality: Math.max(VIEW_BUDGET_QUALITY_FLOOR, budget.quality - 20), size: budget.size };
44
+ const floor = 1 / Math.max(1, scale);
45
+ if (budget.size > floor)
46
+ return { quality: budget.quality, size: Math.max(floor, budget.size * 0.75) };
47
+ return undefined;
48
+ }
49
+ /** The largest viewport `clampViewport` allows, in CSS pixels. */
50
+ const VIEW_MAX_VIEWPORT = { width: 1600, height: 2200 };
18
51
  /**
19
52
  * The mobile Chrome UA Mobile mode presents. A Chromium engine claiming to be
20
53
  * iOS Safari confuses sites that branch on it, so the UA names the platform the
@@ -87,7 +120,19 @@ const CURSOR_AT = `((point) => {
87
120
  }
88
121
  export function clampViewport(width, height) {
89
122
  const value = (input, min, max, fallback) => Number.isSafeInteger(input) ? Math.max(min, Math.min(max, input)) : fallback;
90
- return { width: value(width, 280, 1600, 900), height: value(height, 240, 2200, 700) };
123
+ return { width: value(width, 280, VIEW_MAX_VIEWPORT.width, 900), height: value(height, 240, VIEW_MAX_VIEWPORT.height, 700) };
124
+ }
125
+ /**
126
+ * The pane's display pixel ratio, which sizes its frames (and the factor a
127
+ * browser launched for it runs at), so one frame pixel is one screen pixel and
128
+ * the pane never stretches a frame rendered at CSS size. Anything that is not a finite number is the plain 1×
129
+ * an old panel (which sends none) has always had; the value is rounded to
130
+ * hundredths so a ratio like 1.2500000001 does not count as a change.
131
+ */
132
+ export function clampScale(value) {
133
+ if (typeof value !== 'number' || !Number.isFinite(value))
134
+ return 1;
135
+ return Math.round(Math.max(1, Math.min(VIEW_MAX_SCALE, value)) * 100) / 100;
91
136
  }
92
137
  /**
93
138
  * JPEG dimensions straight from the SOF markers, without decoding pixels.
@@ -228,11 +273,18 @@ export function macEditingCommands(key, modifiers) {
228
273
  * screencast carries pixels only, so the page's own audio output on the engine's
229
274
  * machine is the only sound the panel has.
230
275
  */
231
- export function viewLaunchOptions(channel, executablePath) {
276
+ export function viewLaunchOptions(channel, executablePath, scale = 1) {
232
277
  return {
233
278
  headless: true,
234
279
  ...(channel === 'chromium' ? { executablePath } : { channel }),
235
280
  ignoreDefaultArgs: ['--mute-audio'],
281
+ // The panel's automation markers (see browser-stealth) must not reach the page.
282
+ // A screencast captures the browser's own surface, which is CSS size at the
283
+ // browser's real device scale factor; an emulated ratio alone renders the
284
+ // page at that ratio and then shrinks it into a 1× surface (verified live:
285
+ // 800×600 frames with devicePixelRatio 2). The real factor is what puts
286
+ // screen-resolution pixels into the frames.
287
+ args: [...stealthLaunchArgs(), ...(scale !== 1 ? [`--force-device-scale-factor=${scale}`] : [])],
236
288
  timeout: 20_000,
237
289
  };
238
290
  }
@@ -288,6 +340,12 @@ export class BrowserViewManager {
288
340
  * resumes streaming without another round trip.
289
341
  */
290
342
  desired = new Map();
343
+ /**
344
+ * The display ratio a pane most recently reported, for any session. A browser
345
+ * an agent opens while its pane is collapsed has no request of its own to read
346
+ * a ratio from; the machine's display is the best answer there is.
347
+ */
348
+ displayScale = 1;
291
349
  /** Launches in flight per session, so concurrent opens share one browser. */
292
350
  launching = new Map();
293
351
  runtime = { state: 'checking' };
@@ -427,10 +485,10 @@ export class BrowserViewManager {
427
485
  this.installTask = run().finally(() => { this.installTask = undefined; });
428
486
  return this.installTask;
429
487
  }
430
- async launch() {
488
+ async launch(scale) {
431
489
  // Tests supply a fake browser; production launches the real one below.
432
490
  if (this.launchBrowser)
433
- return await this.launchBrowser();
491
+ return await this.launchBrowser(scale);
434
492
  const { chromium } = await import('playwright-core');
435
493
  const failures = [];
436
494
  // The probe's candidates in the probe's order. The bundled Chromium is launched
@@ -445,7 +503,7 @@ export class BrowserViewManager {
445
503
  if (!candidate || !existsSync(candidate))
446
504
  continue;
447
505
  try {
448
- return await chromium.launch(viewLaunchOptions(channel, candidate));
506
+ return await chromium.launch(viewLaunchOptions(channel, candidate, scale));
449
507
  }
450
508
  catch (error) {
451
509
  failures.push((error instanceof Error ? error.message : String(error)).split('\n')[0]);
@@ -454,9 +512,9 @@ export class BrowserViewManager {
454
512
  throw new Error(`Browser runtime is not usable: ${failures.join('; ').slice(0, 1000)}`);
455
513
  }
456
514
  /** Launch Chromium on a project's profile folder, with the same candidates as `launch`. */
457
- async launchPersistent(directory, viewport) {
515
+ async launchPersistent(directory, viewport, scale) {
458
516
  if (this.options.launchProfile)
459
- return await this.options.launchProfile(directory, viewport);
517
+ return await this.options.launchProfile(directory, viewport, scale);
460
518
  await mkdir(directory, { recursive: true });
461
519
  const { chromium } = await import('playwright-core');
462
520
  const failures = [];
@@ -467,7 +525,9 @@ export class BrowserViewManager {
467
525
  if (!candidate || !existsSync(candidate))
468
526
  continue;
469
527
  try {
470
- return await chromium.launchPersistentContext(directory, { ...viewLaunchOptions(channel, candidate), viewport: { ...viewport }, acceptDownloads: false });
528
+ const context = await chromium.launchPersistentContext(directory, { ...viewLaunchOptions(channel, candidate, scale), ...stealthContextOptions(), viewport: { ...viewport }, acceptDownloads: false });
529
+ await hardenContext(context);
530
+ return context;
471
531
  }
472
532
  catch (error) {
473
533
  failures.push((error instanceof Error ? error.message : String(error)).split('\n')[0]);
@@ -481,7 +541,7 @@ export class BrowserViewManager {
481
541
  * A profile that is still closing is waited out rather than reopened beside it:
482
542
  * two processes on one profile folder is exactly what Chromium refuses.
483
543
  */
484
- async acquireProfile(owner, profile, viewport) {
544
+ async acquireProfile(owner, profile, viewport, scale) {
485
545
  for (;;) {
486
546
  const current = this.profiles.get(profile.key);
487
547
  if (current?.closing) {
@@ -492,7 +552,11 @@ export class BrowserViewManager {
492
552
  if (!current)
493
553
  this.profiles.set(profile.key, host);
494
554
  host.users.add(owner);
495
- host.starting ??= this.launchPersistent(profile.directory, viewport).then(async (context) => {
555
+ // A profile already running keeps the factor it was launched with: one
556
+ // process, one surface scale, shared by every session of the project.
557
+ if (!host.starting)
558
+ host.scale = scale;
559
+ host.starting ??= this.launchPersistent(profile.directory, viewport, scale).then(async (context) => {
496
560
  // A persistent launch opens with a blank page of its own; every tab the
497
561
  // panel shows is one a session asked for.
498
562
  for (const page of context.pages?.() ?? [])
@@ -503,7 +567,7 @@ export class BrowserViewManager {
503
567
  return context;
504
568
  });
505
569
  try {
506
- return await host.starting;
570
+ return { context: await host.starting, scale: host.scale ?? 1 };
507
571
  }
508
572
  catch (error) {
509
573
  // A failed launch is not cached: the next open tries the profile again.
@@ -537,14 +601,14 @@ export class BrowserViewManager {
537
601
  * Open the browser a new session's pages will live in: its project's profile,
538
602
  * or a throwaway browser when the session is incognito or has no usable profile.
539
603
  */
540
- async openBrowserFor(sessionId, viewport) {
604
+ async openBrowserFor(sessionId, viewport, scale) {
541
605
  if (!this.incognito.has(sessionId)) {
542
606
  const profile = this.options.profileFor ? await this.options.profileFor(sessionId).catch(() => undefined) : undefined;
543
607
  if (profile) {
544
608
  try {
545
609
  const owner = {};
546
- const context = await this.acquireProfile(owner, profile, viewport);
547
- return { context, profileKey: profile.key, profileOwner: owner, profile: 'project' };
610
+ const acquired = await this.acquireProfile(owner, profile, viewport, scale);
611
+ return { context: acquired.context, profileKey: profile.key, profileOwner: owner, profile: 'project', renderScale: acquired.scale };
548
612
  }
549
613
  catch (error) {
550
614
  if (this.closed)
@@ -554,7 +618,7 @@ export class BrowserViewManager {
554
618
  }
555
619
  }
556
620
  }
557
- return { browser: await this.launch(), profile: this.incognito.has(sessionId) ? 'incognito' : 'isolated' };
621
+ return { browser: await this.launch(scale), profile: this.incognito.has(sessionId) ? 'incognito' : 'isolated', renderScale: scale };
558
622
  }
559
623
  /** Close a session's browser, or only its pages when they live in a shared project profile. */
560
624
  async disposeBrowser(session) {
@@ -636,11 +700,11 @@ export class BrowserViewManager {
636
700
  * respected, with a phone's pixel density — a mobile Chrome user agent, and
637
701
  * touch events, so the sites the pane shows answer with their mobile layouts
638
702
  * and hover-dependent UIs behave like they do on a phone. Leaving Mobile
639
- * clears the metrics and resets the user agent with an empty override —
640
- * Chromium answers that with the page's own browser UA (verified live), so
641
- * nothing about the page before the switch needs remembering. A switch
642
- * changes the page's size, so the caller restarts the screencast for the new
643
- * capture scale.
703
+ * clears the metrics and applies the desktop spoof identity (see
704
+ * browser-stealth), so the page presents as a normal desktop browser rather
705
+ * than the headless automation UA a reset would expose. A switch changes the
706
+ * page's size, so the caller restarts the screencast for the new capture
707
+ * scale.
644
708
  *
645
709
  * Calls for one tab are serialized by `queueViewportMode`: each applies
646
710
  * whatever the session's mode is at its turn, so a rapid toggle cannot leave
@@ -656,21 +720,32 @@ export class BrowserViewManager {
656
720
  // authority (verified live: the metrics override yields exactly
657
721
  // 390×844 screencast frames at a phone's pixel density).
658
722
  await tab.cdp.send('Emulation.setDeviceMetricsOverride', {
659
- width: VIEW_MOBILE_VIEWPORT.width, height: VIEW_MOBILE_VIEWPORT.height, deviceScaleFactor: 3, mobile: true,
723
+ width: VIEW_MOBILE_VIEWPORT.width, height: VIEW_MOBILE_VIEWPORT.height, deviceScaleFactor: VIEW_MOBILE_SCALE, mobile: true,
660
724
  });
661
725
  }
662
726
  else {
663
727
  if (tab.emulated)
664
728
  await tab.cdp.send('Emulation.clearDeviceMetricsOverride');
665
729
  await tab.page.setViewportSize(session.viewport).catch(() => { });
730
+ // Playwright sizes the page at 1×, which on a browser launched at a
731
+ // higher factor renders at 1× and stretches into the surface — the blur
732
+ // this exists to remove. The page renders at the browser's real factor
733
+ // instead, as a native window on that display would, sharp text and
734
+ // `srcset` images included. The override is sent every time and after
735
+ // Playwright's: Playwright skips a size it believes it already applied,
736
+ // so it cannot be relied on to put back a ratio this override replaced.
737
+ await tab.cdp.send('Emulation.setDeviceMetricsOverride', {
738
+ width: session.viewport.width, height: session.viewport.height, deviceScaleFactor: session.renderScale, mobile: false,
739
+ });
666
740
  }
667
741
  if (mobile === Boolean(tab.emulated))
668
742
  return;
669
743
  tab.emulated = mobile;
670
744
  await tab.cdp.send('Emulation.setUserAgentOverride', mobile
671
745
  ? { userAgent: VIEW_MOBILE_USER_AGENT }
672
- // An empty user agent resets the page to its own browser's UA.
673
- : { userAgent: '' });
746
+ // Desktop presents the spoofed identity too: an empty override would
747
+ // expose the headless browser's own UA to every site the panel shows.
748
+ : desktopUaOverride());
674
749
  await tab.cdp.send('Emulation.setTouchEmulationEnabled', { enabled: mobile, ...(mobile ? { maxTouchPoints: 5 } : {}) });
675
750
  }
676
751
  catch { /* The page is gone; the next activation retries. */ }
@@ -685,6 +760,10 @@ export class BrowserViewManager {
685
760
  // Frames still in flight from a replaced browser belong to nobody.
686
761
  if (session.closing || this.sessions.get(sessionId) !== session)
687
762
  return;
763
+ if (payload.data.length > VIEW_FRAME_LIMIT) {
764
+ void this.shrinkStream(session, tab);
765
+ return;
766
+ }
688
767
  const size = jpegSize(Buffer.from(payload.data, 'base64'));
689
768
  if (!size)
690
769
  return;
@@ -703,14 +782,17 @@ export class BrowserViewManager {
703
782
  return;
704
783
  tab.streaming = true;
705
784
  tab.lastEmitAt = undefined;
785
+ const budget = tab.budget ?? { quality: session.quality, size: 1 };
706
786
  try {
707
787
  await tab.cdp.send('Page.startScreencast', {
708
- format: 'jpeg', quality: session.quality,
709
- // The viewport clamp's maxima, fixed rather than sized to the current
710
- // viewport: no legal resize exceeds them, so frames are never scaled
711
- // down by the caps and a resize only ever needs the restart for the new
712
- // capture scale, not new caps.
713
- maxWidth: 1600, maxHeight: 2200,
788
+ format: 'jpeg', quality: Math.min(session.quality, budget.quality),
789
+ // The viewport at the pane's ratio: one frame pixel per screen pixel.
790
+ // A browser launched at that ratio fills it exactly; one launched
791
+ // denser (the window moved to a lower-density monitor) is scaled down
792
+ // to it once, and the caps never scale a frame up. A page whose frames
793
+ // outgrew the payload limit runs at a reduced size until it changes.
794
+ maxWidth: Math.ceil(session.viewport.width * session.scale * budget.size),
795
+ maxHeight: Math.ceil(session.viewport.height * session.scale * budget.size),
714
796
  everyNthFrame: 1,
715
797
  });
716
798
  }
@@ -718,6 +800,34 @@ export class BrowserViewManager {
718
800
  tab.streaming = false;
719
801
  }
720
802
  }
803
+ /**
804
+ * Step one tab's frame budget down after a frame came out over the limit, and
805
+ * restart its stream at it. The oversized frame itself is not sent; the pane
806
+ * keeps its previous frame until the smaller stream delivers.
807
+ */
808
+ async shrinkStream(session, tab) {
809
+ if (tab.shrinking || !tab.streaming)
810
+ return;
811
+ const next = nextFrameBudget(tab.budget ?? { quality: session.quality, size: 1 }, session.scale);
812
+ if (!next)
813
+ return;
814
+ tab.budget = next;
815
+ await this.restartStream(session, tab);
816
+ }
817
+ /** Stop and start one tab's stream, keeping it only while it still owns the pane. */
818
+ async restartStream(session, tab) {
819
+ if (tab.shrinking)
820
+ return;
821
+ tab.shrinking = true;
822
+ try {
823
+ await this.stopScreencast(tab);
824
+ if (session.activeTabId === tab.id && !session.closing)
825
+ await this.startScreencast(session, tab);
826
+ }
827
+ finally {
828
+ tab.shrinking = false;
829
+ }
830
+ }
721
831
  wireTab(sessionId, session, page, cdp) {
722
832
  const tab = {
723
833
  id: randomUUID(), page, cdp, url: '', title: '', loading: false,
@@ -748,6 +858,13 @@ export class BrowserViewManager {
748
858
  if (newDocument) {
749
859
  tab.loading = true;
750
860
  tab.title = '';
861
+ // The budget was earned by the previous document's content; the next
862
+ // page gets full quality and size again.
863
+ if (tab.budget) {
864
+ tab.budget = undefined;
865
+ if (tab.streaming)
866
+ void this.restartStream(session, tab);
867
+ }
751
868
  }
752
869
  publish();
753
870
  });
@@ -931,7 +1048,7 @@ export class BrowserViewManager {
931
1048
  const starting = (async () => {
932
1049
  const desired = this.desired.get(sessionId);
933
1050
  const viewport = desired?.viewport ?? clampViewport(undefined, undefined);
934
- const opened = await this.openBrowserFor(sessionId, viewport);
1051
+ const opened = await this.openBrowserFor(sessionId, viewport, desired?.scale ?? this.displayScale);
935
1052
  // Shutdown may have finished while the launch was in flight: the browser
936
1053
  // that arrived late belongs to nobody, so it is closed here rather than
937
1054
  // inserted into a manager that has already visited its sessions.
@@ -954,6 +1071,7 @@ export class BrowserViewManager {
954
1071
  ...opened, tabs: new Map(), activeTabId: undefined, pendingTabs: 0,
955
1072
  viewport: current?.viewport ?? viewport,
956
1073
  mode: current?.mode ?? 'desktop',
1074
+ scale: current?.scale ?? this.displayScale,
957
1075
  streaming: current !== undefined, quality: current?.quality ?? VIEW_STREAM_QUALITY, idleTimer: undefined,
958
1076
  };
959
1077
  this.sessions.set(sessionId, session);
@@ -980,8 +1098,8 @@ export class BrowserViewManager {
980
1098
  if (session.context)
981
1099
  return session.context;
982
1100
  session.contextTask ??= Promise.resolve()
983
- .then(() => session.browser.newContext({ viewport: { ...session.viewport }, acceptDownloads: false }))
984
- .then((context) => { session.context = context; return context; });
1101
+ .then(() => session.browser.newContext({ viewport: { ...session.viewport }, acceptDownloads: false, ...stealthContextOptions() }))
1102
+ .then(async (context) => { await hardenContext(context); session.context = context; return context; });
985
1103
  return await session.contextTask;
986
1104
  }
987
1105
  async openTab(sessionId, url, signal) {
@@ -1309,21 +1427,33 @@ export class BrowserViewManager {
1309
1427
  const mode = options.mode === 'mobile' ? 'mobile' : 'desktop';
1310
1428
  const viewport = mode === 'mobile' ? { ...VIEW_MOBILE_VIEWPORT } : clampViewport(options.viewportWidth, options.viewportHeight);
1311
1429
  const quality = Number.isSafeInteger(options.quality) ? Math.max(30, Math.min(90, options.quality)) : VIEW_STREAM_QUALITY;
1312
- this.desired.set(sessionId, { viewport, quality, mode });
1430
+ const scale = clampScale(options.scale);
1431
+ // Only a panel that sends a ratio speaks for the display; an old one that
1432
+ // sends none must not reset what a current one reported.
1433
+ if (options.scale !== undefined)
1434
+ this.displayScale = scale;
1435
+ this.desired.set(sessionId, { viewport, quality, mode, scale });
1313
1436
  const session = this.sessions.get(sessionId);
1314
1437
  if (!session)
1315
1438
  return;
1316
1439
  session.streaming = true;
1317
1440
  const modeChanged = mode !== session.mode;
1318
- const resized = viewport.width !== session.viewport.width || viewport.height !== session.viewport.height;
1441
+ // A new display ratio (the window moved to another monitor, or the system
1442
+ // scaling changed) sizes the frames differently, and the screencast bakes
1443
+ // its frame size in at start, so it restarts like a resize does.
1444
+ const resized = viewport.width !== session.viewport.width || viewport.height !== session.viewport.height
1445
+ || scale !== session.scale;
1319
1446
  session.mode = mode;
1320
1447
  session.viewport = viewport;
1321
1448
  session.quality = quality;
1449
+ session.scale = scale;
1322
1450
  this.scheduleIdleClose(sessionId, session);
1323
1451
  const active = session.activeTabId ? session.tabs.get(session.activeTabId) : undefined;
1324
1452
  if (!active)
1325
1453
  return;
1326
1454
  if (resized || modeChanged) {
1455
+ // A new geometry changes every frame's size; the reduced budget belonged to the old one.
1456
+ active.budget = undefined;
1327
1457
  // A mode switch is more than a resize: the page is put into or taken out
1328
1458
  // of the phone's emulation.
1329
1459
  await this.queueViewportMode(session, active);
@@ -1629,7 +1759,28 @@ export class BrowserViewManager {
1629
1759
  }
1630
1760
  async agentScreenshot(sessionId, tabId, signal) {
1631
1761
  const { session, tab } = this.agentTarget(sessionId, tabId);
1632
- const capture = tab.page.screenshot({ type: 'jpeg', quality: 60, timeout: 10_000 });
1762
+ // The agent reads this image against the CSS-pixel size returned with it, but
1763
+ // the page renders at the browser's launch factor (or Mobile's 3×). That ratio
1764
+ // is applied over this manager's own CDP session, so Playwright still believes
1765
+ // the page is 1×, and its `scale: 'css'` would return device pixels; the
1766
+ // capture is made here instead, scaled down by the ratio actually in effect.
1767
+ const ratio = tab.emulated ? VIEW_MOBILE_SCALE : session.renderScale;
1768
+ const capture = (async () => {
1769
+ const metrics = await tab.cdp.send('Page.getLayoutMetrics').catch(() => undefined);
1770
+ const visual = metrics?.cssVisualViewport;
1771
+ const clip = visual && Number.isFinite(visual.clientWidth) && visual.clientWidth > 0
1772
+ ? { x: visual.pageX, y: visual.pageY, width: visual.clientWidth, height: visual.clientHeight }
1773
+ : { x: 0, y: 0, width: session.viewport.width, height: session.viewport.height };
1774
+ // A Mobile page without a meta viewport lays out at ~980 CSS px and the
1775
+ // phone shows it zoomed out to its 390: the visual viewport's scale (0.398
1776
+ // there, measured) is what brings that wider clip back to the size the
1777
+ // agent is told.
1778
+ const zoom = visual && Number.isFinite(visual.scale) && visual.scale > 0 ? visual.scale : 1;
1779
+ const shot = await tab.cdp.send('Page.captureScreenshot', { format: 'jpeg', quality: 60, clip: { ...clip, scale: zoom / ratio } });
1780
+ if (typeof shot?.data !== 'string')
1781
+ throw new Error('Browser screenshot returned no image.');
1782
+ return Buffer.from(shot.data, 'base64');
1783
+ })();
1633
1784
  const data = await this.boundedAgentOperation(signal, capture, 'Browser screenshot exceeded the 10-second timeout.');
1634
1785
  return { tabId: tab.id, data, width: session.viewport.width, height: session.viewport.height };
1635
1786
  }
package/dist/src/cli.js CHANGED
@@ -15,7 +15,7 @@ import { configDirectory, loadConfig, resolveCodeIntelConfig, resolveConfiguredL
15
15
  import { compactHistory, compactedContextEstimate, executeCommand, HELP } from './commands.js';
16
16
  import { applyModelContextWindow, createAdapter, providerSecrets, recordProviderModel } from './providers.js';
17
17
  import { createTools } from './tools.js';
18
- import { QA_SYSTEM_GUIDANCE, disposeAllQaProcesses, disposeAllQaPtys, getQaPtyManager } from './qa/index.js';
18
+ import { disposeAllQaProcesses, disposeAllQaPtys, getQaPtyManager } from './qa/index.js';
19
19
  import { disposePooledPowerShell } from './powershell-pool.js';
20
20
  import { loadWorkspaceInstructions } from './workspace-instructions.js';
21
21
  import { runGraph, stopReasonPhrase } from './runtime.js';
@@ -62,6 +62,7 @@ import { CodeIntelligenceManager } from './code-intelligence/CodeIntelligenceMan
62
62
  import { ToolActivity, activityForRuntimeEvent } from './tool-activity.js';
63
63
  import { extensionSnapshot, resolveSkillInvocation } from './extensions.js';
64
64
  import { isBuiltinSlashCommand } from './skill-commands.js';
65
+ import { copySessionSkill, removeSessionSkill, sessionSkillCommand, skillForRun } from './session-skills.js';
65
66
  import { executeAuthCommand } from './auth-commands.js';
66
67
  import { setAuthSignOutReporter } from './auth/index.js';
67
68
  import { getAccountPresentation } from './account-presentation.js';
@@ -1621,10 +1622,15 @@ export async function main(argv = process.argv.slice(2), dependencies = {}) {
1621
1622
  // QA workflow guidance rides the same channel as the workspace guide; it is
1622
1623
  // guidance only — permission gates and the command policy still enforce.
1623
1624
  const invocation = isBuiltinSlashCommand(task) ? undefined : await preflight(signal => resolveSkillInvocation(task, config, signal, directory));
1624
- const snapshot = await preflight(signal => extensionSnapshot(config, signal, directory, invocation?.id));
1625
+ // A slash invocation becomes the session's skill; a later message without one inherits it
1626
+ // until the user turns it off with /skill off (see `src/session-skills.ts`).
1627
+ const runSkill = await preflight(signal => skillForRun({ invocation, home: directory, sessionId: savedSession?.id, config, signal }));
1628
+ if (runSkill.notice)
1629
+ terminal ? terminal.print(runSkill.notice) : process.stderr.write(safeTerminal(runSkill.notice) + '\n');
1630
+ const snapshot = await preflight(signal => extensionSnapshot(config, signal, directory, runSkill.skill?.id));
1625
1631
  for (const notice of snapshot.notices)
1626
1632
  terminal ? terminal.print(notice) : process.stderr.write(safeTerminal(notice) + '\n');
1627
- const instructions = `${workspaceGuidance}\n${QA_SYSTEM_GUIDANCE}${snapshot.instructions}`;
1633
+ const instructions = `${workspaceGuidance}${snapshot.instructions}`;
1628
1634
  const resolvedModels = new Map();
1629
1635
  const onRunEvent = async (event) => {
1630
1636
  if (!/reasoning|thinking\.delta/.test(event.type))
@@ -1739,7 +1745,7 @@ export async function main(argv = process.argv.slice(2), dependencies = {}) {
1739
1745
  terminal?.setStatus({ graph, jevEnabled });
1740
1746
  const commandMemory = config.commandMemory === false ? undefined : await LocalToolMemory.open({ workspace, directory });
1741
1747
  const execute = (options) => runGraph(graph, { ...options, runInput, runState, commandMemory, todoStore,
1742
- ...(invocation ? { inheritedSkills: [invocation.id], skillInvocationInstruction: invocation.task } : {}),
1748
+ ...(runSkill.skill ? { inheritedSkills: [runSkill.skill.id], skillInvocationInstruction: runSkill.skill.instruction } : {}),
1743
1749
  resolveModel: (id, model) => {
1744
1750
  const provider = config.providers.find(item => item.id === id);
1745
1751
  if (!provider)
@@ -2282,6 +2288,8 @@ export async function main(argv = process.argv.slice(2), dependencies = {}) {
2282
2288
  // The conversation that is being replaced keeps the log it was written to, and this one
2283
2289
  // takes a log of its own, so neither session shows the other's records.
2284
2290
  await openSessionTrajectory(savedSession.id);
2291
+ // The resumed conversation keeps following the skill its source was.
2292
+ await copySessionSkill(directory, record.id, savedSession.id).catch(() => { });
2285
2293
  await trajectory.record('session.resumed', { resumedSessionId: savedSession.id, sourceSessionId: record.id });
2286
2294
  sessionArchive = structuredClone(record.history);
2287
2295
  state.history = structuredClone(record.contextHistory ?? record.history).slice(-6);
@@ -2356,6 +2364,12 @@ export async function main(argv = process.argv.slice(2), dependencies = {}) {
2356
2364
  const skillInvocation = line.startsWith('/') && !isBuiltinSlashCommand(line)
2357
2365
  ? await resolveSkillInvocation(line, config, undefined, directory) : undefined;
2358
2366
  if (line.startsWith('/') && !skillInvocation) {
2367
+ // The session's active skill is the conversation's, so its controls answer here rather than
2368
+ // in `executeCommand`, which knows nothing of the session.
2369
+ if (/^\/skill(?:\s|$)/.test(line.trim())) {
2370
+ print(await sessionSkillCommand(directory, savedSession?.id, line));
2371
+ continue;
2372
+ }
2359
2373
  let command;
2360
2374
  if (/^\/codegraph\s+rebuild\s*$|^\/(login|logout|auth)(?:\s|$)/.test(line.trim())) {
2361
2375
  active = new AbortController();
@@ -2393,6 +2407,9 @@ export async function main(argv = process.argv.slice(2), dependencies = {}) {
2393
2407
  browserBridge?.startRun();
2394
2408
  terminal?.setStatus({ contextUsed: 0 });
2395
2409
  }
2410
+ // A cleared conversation starts over, without the skill the old one was following.
2411
+ if (line.trim() === '/clear' && savedSession)
2412
+ await removeSessionSkill(directory, savedSession.id).catch(() => { });
2396
2413
  if (command.compact && state.history?.length) {
2397
2414
  state.history = compactHistory(state.history);
2398
2415
  // Until the next request reports the real input size, show the compacted
@@ -10,7 +10,7 @@ import { defaultShellKind, runShell, runNativeProcess } from './shell.js';
10
10
  import { commandTimingSummary } from './command-metrics.js';
11
11
  import { runPooledPowerShell } from './powershell-pool.js';
12
12
  import { assertNotHostKill, assertNotHostKillArgv, hostShellOf } from './host-process-guard.js';
13
- import { getQaProcessManager } from './qa/runtime/ProcessManager.js';
13
+ import { getQaProcessManager, PERSISTENT_JOBS_SUPPORTED } from './qa/runtime/ProcessManager.js';
14
14
  import { clipText } from './text.js';
15
15
  import { matchesFileRead, storeFileRead } from './file-read-state.js';
16
16
  import { FileReadRequiredError } from './tool-errors.js';
@@ -848,9 +848,9 @@ export function createCodingTools(policy) {
848
848
  const canonicalShell = (name, kind) => {
849
849
  const actual = kind === 'powershell' ? 'PowerShell' : 'Bash';
850
850
  const syntax = kind === 'powershell'
851
- ? 'PowerShell syntax; use & before a quoted executable path. No cmd.exe substitution. Do not pipe a running child into Select-Object -First: it terminates the pipeline before the child completes and can cause exit 4294967295. Host output is already tail-bounded; use Select-Object -Last if further filtering is needed. Prefer file-written scripts over nested quoting for multiline Python/JavaScript. Prefer direct invocation (& $exe @args) for child processes: Windows PowerShell Start-Process -ArgumentList flattens arrays and can split a multi-word argument unless it is quoted manually.'
851
+ ? 'PowerShell syntax; use & before a quoted executable path. No cmd.exe substitution. Do not pipe a running child into Select-Object -First: it terminates the pipeline before the child completes and can cause exit 4294967295. Host output is already tail-bounded; use Select-Object -Last if further filtering is needed. Prefer file-written scripts over nested quoting for multiline Python/JavaScript. Prefer direct invocation (& $exe @args) for child processes: Windows PowerShell Start-Process -ArgumentList flattens arrays and can split a multi-word argument unless it is quoted manually. Windows PowerShell also alters what it hands a native program: piping a string into one (ssh, wsl, bash -s, docker exec) appends CRLF after the last line, so a remote shell runs that line with a stray \r, and double quotes inside a native argument are dropped. Send a multi-line script to a remote or POSIX shell as base64 instead: $b = [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(($script -replace "`r", "") + "`n")); & ssh host "echo $b | base64 -d | bash".'
852
852
  : 'Bash syntax (Git Bash on Windows).';
853
- const tool = zTool(name, `Execute a foreground ${actual} command in the workspace. The working directory is the workspace; ${syntax} Output is tail-bounded. Commands follow the current workspace permissions. Restricted modes use the Codex OS sandbox and block network/outside writes; explicit escalation requires justification and approval. Credential environment variables are excluded; credential files remain accessible. This uses the compact command/timeout/description contract while retaining Pi/Andorra process-tree cleanup. Background execution is not exposed.`, { type: 'object', properties: {
853
+ const tool = zTool(name, `Execute a foreground ${actual} command in the workspace. The working directory is the workspace; ${syntax} Output is tail-bounded. Commands follow the current workspace permissions. Restricted modes use the Codex OS sandbox and block network/outside writes; explicit escalation requires justification and approval. Credential environment variables are excluded; credential files remain accessible. This uses the compact command/timeout/description contract while retaining Pi/Andorra process-tree cleanup. Background execution is not exposed${kind === 'powershell' ? '' : ': a command that leaves a job running (cmd &) waits for that job, and the timeout then stops it'}. Start long-running work with AsyncProcess instead${PERSISTENT_JOBS_SUPPORTED ? ', with persist: true for a service the user needs left running after you finish' : ''}.`, { type: 'object', properties: {
854
854
  command: { type: 'string', description: 'Command to execute' },
855
855
  timeout: { type: 'integer', minimum: 1, maximum: 600000, description: 'Timeout in milliseconds; default 30000' },
856
856
  description: { type: 'string', description: 'Short active-voice description of what the command does' },
@@ -1025,9 +1025,12 @@ export function createCodingTools(policy) {
1025
1025
  throw new Error('Native executable is not installed');
1026
1026
  return nativeObservation(await runNativeProcess(executable, argv, cwd, timeout, context.signal, launchPolicy), true);
1027
1027
  });
1028
- const AsyncProcess = zTool('AsyncProcess', 'Start a shell command in the background and return immediately; inspect status/logs, wait for completion without polling, or stop it. Use for independent builds, test suites, and dev servers so other agent work can continue. Each job has a generated ID. Jobs are killed when the owning CLI exits. Full Access or explicit escalation is required to start; sandbox restrictions are never bypassed.', { type: 'object', properties: {
1028
+ const AsyncProcess = zTool('AsyncProcess', `Start a shell command in the background and return immediately; inspect status/logs, wait for completion without polling, or stop it. Use for independent builds, test suites, and dev servers so other agent work can continue. Each job has a generated ID. ${PERSISTENT_JOBS_SUPPORTED
1029
+ ? 'Jobs are killed when the owning CLI exits unless started with persist: true. When the task is to leave a service running for the user (a web server, daemon or listener they will use after you finish), start it with persist: true and do not stop it before you finish.'
1030
+ : 'Jobs are killed when the owning CLI exits.'} Full Access or explicit escalation is required to start; sandbox restrictions are never bypassed.`, { type: 'object', properties: {
1029
1031
  action: { type: 'string', enum: ['start', 'status', 'logs', 'wait', 'stop'] },
1030
1032
  command: { type: 'string', description: 'Shell command; only for start' },
1033
+ ...(PERSISTENT_JOBS_SUPPORTED ? { persist: { type: 'boolean', description: 'Only for start. Keep the job running after this session ends, for a service the user needs left running. Default false: the job is stopped when the CLI exits.' } } : {}),
1031
1034
  id: { type: 'string', description: 'Job ID returned by start; required otherwise' },
1032
1035
  timeout: { type: 'integer', minimum: 1, maximum: 600000, description: 'Maximum wait in milliseconds; does not kill unfinished jobs' },
1033
1036
  ...sandboxFields,
@@ -1043,7 +1046,8 @@ export function createCodingTools(policy) {
1043
1046
  assertNotHostKill(command, hostShellOf(defaultShellKind));
1044
1047
  const launchPolicy = await shellPermission(policy, 'AsyncProcess', args, context);
1045
1048
  const id = `agent-${randomUUID()}`;
1046
- return JSON.stringify(await manager.start({ id, command, launchPolicy, signal: context.signal }));
1049
+ const persist = boolArg(args, 'persist') === true;
1050
+ return JSON.stringify(await manager.start({ id, command, launchPolicy, signal: context.signal, persist }));
1047
1051
  }
1048
1052
  const id = stringArg(args, 'id');
1049
1053
  if (!/^agent-[a-f0-9-]{36}$/.test(id))
@@ -4,7 +4,7 @@ import { editProviderSettings } from './provider-settings.js';
4
4
  import { retireRemovedCodexAccounts, retireUnsavedCodexAccounts } from './codex-auth.js';
5
5
  import { droppedAnthropicAccounts, retireAnthropicAccounts } from './anthropic-console-auth.js';
6
6
  import { importProvidersFromRemote } from './provider-import.js';
7
- import { DEFAULT_HARNESS, listGraphs, withoutDeletedGraphs } from './graphs.js';
7
+ import { DEFAULT_GRAPH, listGraphs, withoutDeletedGraphs } from './graphs.js';
8
8
  import { graphStorageDirectory } from './graph-account.js';
9
9
  import { configuredGraphSelection, currentGraphSubject, saveGraphSelection } from './graph-selection.js';
10
10
  import { getMembership, loadAccessibleGraph, requireGraphMembership, ANDORRA_GRAPH_SELECTION } from './membership.js';
@@ -314,12 +314,12 @@ export async function runCommandScreen(line, state, ui, persist, signal, adapter
314
314
  const free = access !== undefined && !access.paid && !access.unavailable && access.subject !== undefined;
315
315
  const atLimit = free && (await readGraphQuota(directory, saved)).customGraphs >= FREE_CUSTOM_GRAPH_LIMIT;
316
316
  const items = [{
317
- id: DEFAULT_HARNESS.id,
317
+ id: DEFAULT_GRAPH.id,
318
318
  label: 'Default',
319
319
  description: 'Andorra Agent only. Reads project instructions and completes the task without an Orchestrator.',
320
320
  }, { id: ANDORRA_GRAPH_SELECTION, label: 'Andorra', description: free ? 'Premium workflow: Orchestrator -> Andorra Agent -> Done' : 'Paid workflow: Orchestrator -> Andorra Agent -> Done' }, ...withoutDeletedGraphs(saved).filter(graph => graph.id !== 'default').map(graph => ({ id: graph.id, label: `${graph.name} (${graph.id}@${graph.revision})`, description: 'Saved custom graph' })), { id: ':divider', label: '', separator: true }, { id: ':create', label: 'Create new graph', description: atLimit ? 'Free tier includes 1 custom graph. Upgrade to Premium for more graphs.' : 'Open the web graph builder' }, { id: ':edit', label: 'Edit Graphs', bold: true, description: 'Open saved graphs in the web graph builder' }];
321
321
  while (!signal.aborted) {
322
- const selected = await ui.select('Graph', items, { selectedId: state.graph ?? DEFAULT_HARNESS.id, description: 'Choose and save your default graph for this account, or create one in the web builder. After saving, reopen /graph to select it.', signal });
322
+ const selected = await ui.select('Graph', items, { selectedId: state.graph ?? DEFAULT_GRAPH.id, description: 'Choose and save your default graph for this account, or create one in the web builder. After saving, reopen /graph to select it.', signal });
323
323
  if (selected === undefined || signal.aborted)
324
324
  return unchanged;
325
325
  if (selected === ':create' && atLimit) {
@@ -338,7 +338,7 @@ export async function runCommandScreen(line, state, ui, persist, signal, adapter
338
338
  // never asks and never clears.
339
339
  const changed = selected !== (state.graph ?? 'default');
340
340
  if (changed) {
341
- const name = selected === 'default' ? DEFAULT_HARNESS.name
341
+ const name = selected === 'default' ? DEFAULT_GRAPH.name
342
342
  : selected === ANDORRA_GRAPH_SELECTION ? 'Andorra'
343
343
  : saved.find(graph => graph.id === selected).name;
344
344
  const confirmation = await ui.select(`Switch to ${name}?`, [
@@ -6,7 +6,7 @@ import type { Completion, RunResult } from './runtime.js';
6
6
  import type { Usage } from './types.js';
7
7
  import type { CodeIntelligenceManager } from './code-intelligence/CodeIntelligenceManager.js';
8
8
  import { logoutCodex } from './codex-auth.js';
9
- export declare const HELP = "Commands:\n /browser Open the browser workspace (CLI stays available)\n /session Browse and resume saved sessions (newest first)\n /login [--no-browser] Sign in or create an Andorra account (prints the address over SSH)\n /auth logout Remove this machine's saved Andorra account session\n /auth status Show Andorra account session status\n /model [model-id] Open model selection or select a model directly; with a graph that pins node models, asks whether to override them\n /model list Discover models from the active provider\n /providers [id] Choose providers; Right/e edits; Add provider configures\n /subagent [id [model]] Set the provider/model external hosts (Claude/Codex CLI) must use for Andorra subagent runs; off clears it\n /reasoning <level> Set default|none|minimal|low|medium|high|xhigh|max\n /graph [id] Select a graph or open the web graph builder\n /codegraph <action> Code intelligence: status|enable|disable|rebuild; enable|disable --global sets the default for every project\n /dashboard Toggle live dashboard and transcript (TTY only)\n /attach <path> Attach a file or folder to your next task (large pastes and dropped files attach automatically)\n /usage Open session usage (Escape to return)\n /permissions [mode] Choose and remember workspace permissions\n /jev <on|off|status> Turn Jev on or off for nodes that enable it, or show its setting\n /feedback <on|off|status> Show the anonymous-feedback setting; Paid accounts can turn it off\n /yolo <on|off> Turn session-wide Full Access on or off (host files and network)\n /tools List available coding tools\n /skills List, install, enable, disable or remove skills\n /<skillname> [args] Apply an enabled imported skill; qualify duplicate names by catalog ID\n /plugins List, install, enable, disable or remove plugins\n /mcp Add, edit, enable, disable or delete MCP servers\n /logout Sign out of your Andorra account (then /login to switch accounts)\n /logout --all Sign out, and delete every other Andorra sign-in saved on this machine\n /logout codex Sign out of every configured Codex (ChatGPT) account\n /status Show workspace and current settings\n /clear Clear the conversation on screen and the retained context (session usage is retained)\n /compact Compact retained conversation history to free context\n /help Show commands\n /exit Quit\nSelection screens: Up/Down to browse, Enter or Space to select, Escape to return.\nCtrl+B toggles dashboard; Ctrl+G pages its graph; Ctrl+N cycles dashboard model statistics (display only).\nCtrl+T expands/collapses todos; Ctrl+O expands/collapses tool details; Ctrl+Y collapses/expands live thinking.\nShift+Arrow/Home/End selects prompt text; Ctrl+C copies and Ctrl+X cuts a selection. The wheel scrolls; Up/Down recall prompts. Shift+drag selects transcript text.\nCtrl+C stops an interactive run; send direction to resume, or press Ctrl+C again to exit (idle Ctrl+C exits too). /yolo on|off applies immediately, including at approvals. /exit quits. Headless Ctrl+C cancels the run; a second press exits.";
9
+ export declare const HELP = "Commands:\n /browser Open the browser workspace (CLI stays available)\n /session Browse and resume saved sessions (newest first)\n /login [--no-browser] Sign in or create an Andorra account (prints the address over SSH)\n /auth logout Remove this machine's saved Andorra account session\n /auth status Show Andorra account session status\n /model [model-id] Open model selection or select a model directly; with a graph that pins node models, asks whether to override them\n /model list Discover models from the active provider\n /providers [id] Choose providers; Right/e edits; Add provider configures\n /subagent [id [model]] Set the provider/model external hosts (Claude/Codex CLI) must use for Andorra subagent runs; off clears it\n /reasoning <level> Set default|none|minimal|low|medium|high|xhigh|max\n /graph [id] Select a graph or open the web graph builder\n /codegraph <action> Code intelligence: status|enable|disable|rebuild; enable|disable --global sets the default for every project\n /dashboard Toggle live dashboard and transcript (TTY only)\n /attach <path> Attach a file or folder to your next task (large pastes and dropped files attach automatically)\n /usage Open session usage (Escape to return)\n /permissions [mode] Choose and remember workspace permissions\n /jev <on|off|status> Turn Jev on or off for nodes that enable it, or show its setting\n /feedback <on|off|status> Show the anonymous-feedback setting; Paid accounts can turn it off\n /yolo <on|off> Turn session-wide Full Access on or off (host files and network)\n /tools List available coding tools\n /skills List, install, enable, disable or remove skills\n /<skillname> [args] Apply an enabled imported skill to this and every later message; qualify duplicate names by catalog ID\n /skill [on|off|remove] Show, pause, resume or end the session's active skill\n /plugins List, install, enable, disable or remove plugins\n /mcp Add, edit, enable, disable or delete MCP servers\n /logout Sign out of your Andorra account (then /login to switch accounts)\n /logout --all Sign out, and delete every other Andorra sign-in saved on this machine\n /logout codex Sign out of every configured Codex (ChatGPT) account\n /status Show workspace and current settings\n /clear Clear the conversation on screen and the retained context (session usage is retained)\n /compact Compact retained conversation history to free context\n /help Show commands\n /exit Quit\nSelection screens: Up/Down to browse, Enter or Space to select, Escape to return.\nCtrl+B toggles dashboard; Ctrl+G pages its graph; Ctrl+N cycles dashboard model statistics (display only).\nCtrl+T expands/collapses todos; Ctrl+O expands/collapses tool details; Ctrl+Y collapses/expands live thinking.\nShift+Arrow/Home/End selects prompt text; Ctrl+C copies and Ctrl+X cuts a selection. The wheel scrolls; Up/Down recall prompts. Shift+drag selects transcript text.\nCtrl+C stops an interactive run; send direction to resume, or press Ctrl+C again to exit (idle Ctrl+C exits too). /yolo on|off applies immediately, including at approvals. /exit quits. Headless Ctrl+C cancels the run; a second press exits.";
10
10
  export interface CommandState {
11
11
  config: Config;
12
12
  yolo: boolean;
@@ -39,7 +39,8 @@ export const HELP = `Commands:
39
39
  /yolo <on|off> Turn session-wide Full Access on or off (host files and network)
40
40
  /tools List available coding tools
41
41
  /skills List, install, enable, disable or remove skills
42
- /<skillname> [args] Apply an enabled imported skill; qualify duplicate names by catalog ID
42
+ /<skillname> [args] Apply an enabled imported skill to this and every later message; qualify duplicate names by catalog ID
43
+ /skill [on|off|remove] Show, pause, resume or end the session's active skill
43
44
  /plugins List, install, enable, disable or remove plugins
44
45
  /mcp Add, edit, enable, disable or delete MCP servers
45
46
  /logout Sign out of your Andorra account (then /login to switch accounts)