@andorra-labs/code 0.1.14 → 0.1.16

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 (180) hide show
  1. package/dist/src/acp-agent.d.ts +54 -0
  2. package/dist/src/acp-agent.js +991 -0
  3. package/dist/src/agent-definitions.js +29 -6
  4. package/dist/src/agent-execution.js +8 -2
  5. package/dist/src/agent-mcp-catalog.js +2 -0
  6. package/dist/src/agent-mcp.d.ts +3 -1
  7. package/dist/src/agent-mcp.js +97 -11
  8. package/dist/src/andorra/entry.js +21 -3
  9. package/dist/src/andorra/hosted.d.ts +3 -0
  10. package/dist/src/andorra/hosted.js +5 -1
  11. package/dist/src/andorra/notices.d.ts +10 -1
  12. package/dist/src/andorra/notices.js +25 -2
  13. package/dist/src/andorra/terminal.d.ts +2 -0
  14. package/dist/src/andorra/terminal.js +2 -2
  15. package/dist/src/app-server/protocol.d.ts +9 -2
  16. package/dist/src/app-server/protocol.js +1 -1
  17. package/dist/src/app-server/workspace.d.ts +1 -0
  18. package/dist/src/app-server/workspace.js +141 -10
  19. package/dist/src/app-server.d.ts +115 -0
  20. package/dist/src/app-server.js +980 -63
  21. package/dist/src/auth/AuthManager.js +4 -4
  22. package/dist/src/auth/deployment.js +2 -2
  23. package/dist/src/browser-bridge.d.ts +1 -0
  24. package/dist/src/browser-bridge.js +5 -2
  25. package/dist/src/browser-external-app.d.ts +27 -0
  26. package/dist/src/browser-external-app.js +60 -0
  27. package/dist/src/browser-panel-tool.d.ts +6 -0
  28. package/dist/src/browser-panel-tool.js +36 -0
  29. package/dist/src/browser-runner.js +1 -0
  30. package/dist/src/browser-server.d.ts +5 -0
  31. package/dist/src/browser-server.js +27 -3
  32. package/dist/src/browser-ui/style.css +3 -3
  33. package/dist/src/browser-ui/tokens.css +27 -16
  34. package/dist/src/browser-view.d.ts +16 -0
  35. package/dist/src/browser-view.js +60 -2
  36. package/dist/src/bug-report.d.ts +81 -0
  37. package/dist/src/bug-report.js +235 -0
  38. package/dist/src/claude-provider.d.ts +2 -1
  39. package/dist/src/claude-provider.js +13 -9
  40. package/dist/src/cli-sign-in.d.ts +3 -1
  41. package/dist/src/cli-sign-in.js +4 -1
  42. package/dist/src/cli.js +184 -40
  43. package/dist/src/codex-errors.js +4 -1
  44. package/dist/src/coding-tools.js +7 -7
  45. package/dist/src/command-screens.d.ts +9 -2
  46. package/dist/src/command-screens.js +166 -97
  47. package/dist/src/commands.d.ts +3 -2
  48. package/dist/src/commands.js +1 -0
  49. package/dist/src/compaction-phrases.d.ts +4 -0
  50. package/dist/src/compaction-phrases.js +20 -0
  51. package/dist/src/completion-gates.d.ts +22 -0
  52. package/dist/src/completion-gates.js +11 -0
  53. package/dist/src/config.d.ts +5 -0
  54. package/dist/src/config.js +48 -0
  55. package/dist/src/context-compaction.js +2 -1
  56. package/dist/src/decision/DecisionManager.js +3 -2
  57. package/dist/src/decision/requestPhrases.d.ts +4 -0
  58. package/dist/src/decision/requestPhrases.js +23 -0
  59. package/dist/src/github-inbox.d.ts +55 -0
  60. package/dist/src/github-inbox.js +153 -0
  61. package/dist/src/google-provider.d.ts +31 -0
  62. package/dist/src/google-provider.js +153 -0
  63. package/dist/src/graph-health.js +8 -4
  64. package/dist/src/graph-manager-chat.js +6 -1
  65. package/dist/src/graph-provider-portability.js +32 -10
  66. package/dist/src/graph-quota.d.ts +29 -2
  67. package/dist/src/graph-quota.js +68 -10
  68. package/dist/src/graph-runner.js +24 -7
  69. package/dist/src/graph-server.d.ts +1 -1
  70. package/dist/src/graph-server.js +9 -7
  71. package/dist/src/graph-sync.d.ts +1 -0
  72. package/dist/src/graph-sync.js +93 -34
  73. package/dist/src/graph-tool.d.ts +2 -0
  74. package/dist/src/graph-tool.js +2 -2
  75. package/dist/src/graph-ui/app.js +177 -41
  76. package/dist/src/graph-ui/controls.css +1 -0
  77. package/dist/src/graph-ui/edge-router.js +121 -53
  78. package/dist/src/graph-ui/embed.js +2 -2
  79. package/dist/src/graph-ui/icons.js +1 -0
  80. package/dist/src/graph-ui/index.html +1 -1
  81. package/dist/src/graph-ui/manager.css +1 -1
  82. package/dist/src/graph-ui/manager.js +2 -2
  83. package/dist/src/graph-ui/sidebar.js +30 -0
  84. package/dist/src/graph-ui/studio-canvas.js +26 -13
  85. package/dist/src/graph-ui/studio.css +15 -7
  86. package/dist/src/graph-ui/studio.js +11 -4
  87. package/dist/src/graph-ui/style.css +77 -45
  88. package/dist/src/graph-ui/theme.js +3 -36
  89. package/dist/src/graph-ui/tokens.css +27 -19
  90. package/dist/src/graph-visibility.d.ts +31 -0
  91. package/dist/src/graph-visibility.js +102 -0
  92. package/dist/src/graphs.js +4 -3
  93. package/dist/src/live-model.d.ts +24 -0
  94. package/dist/src/live-model.js +37 -0
  95. package/dist/src/managed-sign-in.d.ts +1 -0
  96. package/dist/src/managed-sign-in.js +13 -0
  97. package/dist/src/membership-errors.d.ts +2 -0
  98. package/dist/src/membership-errors.js +5 -1
  99. package/dist/src/membership.d.ts +23 -1
  100. package/dist/src/membership.js +48 -6
  101. package/dist/src/model-health-cache.js +1 -1
  102. package/dist/src/model-metadata.d.ts +1 -1
  103. package/dist/src/model-metadata.js +12 -3
  104. package/dist/src/paged-transcript.d.ts +2 -0
  105. package/dist/src/paged-transcript.js +16 -0
  106. package/dist/src/plan-pass.d.ts +59 -0
  107. package/dist/src/plan-pass.js +165 -0
  108. package/dist/src/provider-connection.js +17 -0
  109. package/dist/src/provider-engine.d.ts +5 -0
  110. package/dist/src/provider-engine.js +6 -3
  111. package/dist/src/provider-import.js +3 -1
  112. package/dist/src/provider-settings.js +14 -2
  113. package/dist/src/providers.d.ts +33 -2
  114. package/dist/src/providers.js +101 -28
  115. package/dist/src/pull-request-checks.d.ts +26 -0
  116. package/dist/src/pull-request-checks.js +56 -0
  117. package/dist/src/pull-request-conversation.d.ts +134 -0
  118. package/dist/src/pull-request-conversation.js +221 -0
  119. package/dist/src/pull-request-create.d.ts +175 -0
  120. package/dist/src/pull-request-create.js +392 -0
  121. package/dist/src/pull-request-details.d.ts +242 -0
  122. package/dist/src/pull-request-details.js +614 -0
  123. package/dist/src/pull-request-edit.d.ts +23 -0
  124. package/dist/src/pull-request-edit.js +91 -0
  125. package/dist/src/pull-request-logs.d.ts +76 -0
  126. package/dist/src/pull-request-logs.js +172 -0
  127. package/dist/src/pull-request-merge.d.ts +112 -0
  128. package/dist/src/pull-request-merge.js +258 -0
  129. package/dist/src/pull-request-review.d.ts +137 -0
  130. package/dist/src/pull-request-review.js +401 -0
  131. package/dist/src/pull-requests.d.ts +43 -2
  132. package/dist/src/pull-requests.js +112 -21
  133. package/dist/src/react-runtime.js +58 -9
  134. package/dist/src/read-document-tool.d.ts +2 -0
  135. package/dist/src/read-document-tool.js +6 -6
  136. package/dist/src/remote/engine-pool.js +42 -6
  137. package/dist/src/run-control.d.ts +10 -0
  138. package/dist/src/run-control.js +24 -0
  139. package/dist/src/run-progress.d.ts +10 -0
  140. package/dist/src/run-progress.js +122 -0
  141. package/dist/src/run-records.d.ts +2 -2
  142. package/dist/src/runtime-environment.d.ts +1 -0
  143. package/dist/src/runtime-environment.js +13 -0
  144. package/dist/src/runtime.d.ts +5 -1
  145. package/dist/src/runtime.js +14 -2
  146. package/dist/src/save-lock.js +14 -7
  147. package/dist/src/session-title.d.ts +3 -0
  148. package/dist/src/session-title.js +5 -2
  149. package/dist/src/sign-in-detection.d.ts +1 -1
  150. package/dist/src/sign-in-detection.js +10 -3
  151. package/dist/src/sign-in-offer.js +1 -1
  152. package/dist/src/skill-commands.js +1 -1
  153. package/dist/src/skills/bundled/bug-report/SKILL.md +80 -0
  154. package/dist/src/skills/bundled/graph-manager/SKILL.md +9 -1
  155. package/dist/src/skills/bundled/graph-manager/errors.md +1 -0
  156. package/dist/src/skills/bundled/provenance.json +7 -2
  157. package/dist/src/skills/runtime-skills.js +1 -0
  158. package/dist/src/subagent-run.js +1 -0
  159. package/dist/src/telemetry/capture-core.d.ts +17 -0
  160. package/dist/src/telemetry/capture-core.js +59 -1
  161. package/dist/src/telemetry/classify.d.ts +3 -1
  162. package/dist/src/telemetry/classify.js +37 -0
  163. package/dist/src/telemetry/emitter.d.ts +2 -0
  164. package/dist/src/telemetry/emitter.js +42 -5
  165. package/dist/src/telemetry/schema.d.ts +22 -0
  166. package/dist/src/telemetry/schema.js +68 -1
  167. package/dist/src/telemetry/surface.d.ts +1 -0
  168. package/dist/src/telemetry/uploader.d.ts +12 -1
  169. package/dist/src/telemetry/uploader.js +30 -2
  170. package/dist/src/terminal-links.d.ts +16 -0
  171. package/dist/src/terminal-links.js +113 -0
  172. package/dist/src/terminal-ui.d.ts +8 -1
  173. package/dist/src/terminal-ui.js +40 -14
  174. package/dist/src/tool-catalog.js +1 -1
  175. package/dist/src/trajectory.js +6 -1
  176. package/dist/src/transcript.d.ts +2 -0
  177. package/dist/src/transcript.js +10 -3
  178. package/dist/src/types.d.ts +9 -0
  179. package/dist/src/usage-analytics.js +18 -10
  180. package/package.json +2 -1
@@ -4,10 +4,12 @@ import { PassThrough } from 'node:stream';
4
4
  import { StringDecoder } from 'node:string_decoder';
5
5
  import { stripVTControlCharacters } from 'node:util';
6
6
  import stringWidth from 'string-width';
7
+ import { hyperlinkRow, wrappedLinks } from './terminal-links.js';
7
8
  import { DashboardMetrics } from './dashboard.js';
8
9
  import { dashboardRows } from './dashboard-view.js';
9
10
  import { goalStatusLabel } from './session-goal.js';
10
11
  import { transcriptColor } from './transcript.js';
12
+ import { ANDORRA_BUBBLE_SPEAKER, ANDORRA_BUBBLE_TAIL } from './andorra/notices.js';
11
13
  import { ToolCallClock, toolHeaderRows } from './tool-call-clock.js';
12
14
  import { formatDuration, formatHms } from './duration.js';
13
15
  import { PagedTranscript } from './paged-transcript.js';
@@ -27,7 +29,7 @@ const SKILL_TOKEN = String.fromCodePoint(0x10FFFD);
27
29
  const composerGraphemes = (text) => graphemes(text).flatMap(part => isToken(part) && part.length > 2 ? [part.slice(0, 2), part.slice(2)] : [part]);
28
30
  const clean = (text) => stripVTControlCharacters(text).replace(/\r\n?/g, '\n').replace(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u202a-\u202e\u2066-\u2069]/g, '').replace(/[\u{100000}-\u{10FFFF}]/gu, '').replace(/\t/g, ' ');
29
31
  const oneLine = (text) => clean(text).replace(/\n/g, ' ');
30
- const commands = ['/model', '/providers', '/subagent', '/reasoning', '/graph', '/codegraph', '/dashboard', '/browser', '/attach', '/skills', '/skill', '/plugins', '/mcp', '/usage', '/permissions', '/yolo', '/jev', '/feedback', '/tools', '/session', '/status', '/clear', '/compact', '/goal', '/help', '/login', '/logout', '/auth status', '/auth logout', '/exit', '/quit'];
32
+ const commands = ['/model', '/providers', '/subagent', '/reasoning', '/graph', '/codegraph', '/dashboard', '/browser', '/attach', '/skills', '/skill', '/plugins', '/mcp', '/usage', '/permissions', '/yolo', '/jev', '/feedback', '/tools', '/session', '/resume', '/status', '/clear', '/compact', '/goal', '/help', '/login', '/logout', '/auth status', '/auth logout', '/exit', '/quit'];
31
33
  const argumentCompletions = {
32
34
  '/jev': ['/jev status', '/jev on', '/jev off', '/jev global on', '/jev global off'],
33
35
  '/feedback': ['/feedback status', '/feedback on', '/feedback off'],
@@ -59,7 +61,7 @@ const OVERRIDE_HINT = 'Choose a model to override the nodes with · /model';
59
61
  const commandDescriptions = {
60
62
  '/browser': 'Open the browser workspace',
61
63
  '/attach': 'Attach a file or folder to your next task',
62
- '/session': 'Browse and resume saved sessions',
64
+ '/session': 'Browse and resume saved sessions', '/resume': 'Browse and resume saved sessions',
63
65
  '/login': 'Sign in or create an Andorra account', '/logout': 'Sign out of the Andorra account', '/logout codex': 'Sign out of every Codex account', '/auth logout': 'Sign out of the Andorra account', '/auth status': 'Account and membership status',
64
66
  '/model': 'Choose a model', '/providers': 'Choose or edit providers',
65
67
  '/subagent': 'Choose the provider and model external hosts run Andorra with',
@@ -81,9 +83,9 @@ const submittedCommand = (value) => {
81
83
  const [token] = value.trim().split(/\s+/);
82
84
  return commands.some(command => command.split(/\s+/)[0] === token) ? token : undefined;
83
85
  };
84
- const workingCommandHint = (command) => `${command} doesn't run while a task is working. Press Ctrl+C to stop this task, then run ${command}.`
86
+ const workingCommandHint = (command) => `${command} doesn't run while a task is working. Run ${command} once this task has finished.`
85
87
  + (command === '/graph' ? ' Switching graphs clears the previous graph progress and starts fresh.' : '');
86
- const liveRunCommands = ['/browser', '/attach', '/yolo', '/permissions', '/jev', '/help', '/status', '/usage', '/tools', '/exit', '/quit'];
88
+ const liveRunCommands = ['/model', '/browser', '/attach', '/compact', '/yolo', '/permissions', '/jev', '/help', '/status', '/usage', '/tools', '/exit', '/quit'];
87
89
  const paint = (text, color = GRAY) => typeof color === 'number'
88
90
  ? `\x1b[38;5;${color}m${text}\x1b[0m`
89
91
  : `\x1b[${color}m${text}\x1b[0m`;
@@ -296,6 +298,7 @@ export class TerminalUI extends EventEmitter {
296
298
  finishTask() { this.runActive = false; this.dashboardMetrics.finishTask(); this.scheduleRender(); }
297
299
  resetDashboardSession(usage) { this.dashboardMetrics.resetSession(usage); this.dashboardModel = 0; this.dashboardGraphOffset = 0; this.nodeModels.clear(); this.dashboardNotices = []; this.scheduleRender(); }
298
300
  tokenClock;
301
+ sessionId;
299
302
  speedMeters = new Map();
300
303
  speedInvocations = new Map();
301
304
  activeSpeedNode;
@@ -553,6 +556,8 @@ export class TerminalUI extends EventEmitter {
553
556
  value = [];
554
557
  cursor = 0;
555
558
  transcript = new PagedTranscript();
559
+ /** The newest transcript entry, while it is one that a later print with the same key rewrites. */
560
+ replaceable;
556
561
  expandedTranscript = false;
557
562
  todos = [];
558
563
  expandedTodos = false;
@@ -654,6 +659,7 @@ export class TerminalUI extends EventEmitter {
654
659
  this.appName = oneLine(options.appName ?? 'ANDORRA CODE');
655
660
  this.status = { ...options };
656
661
  this.tokenClock = options.tokenClock;
662
+ this.sessionId = options.sessionId;
657
663
  this.clipboardImageProbe = options.clipboardImageProbe;
658
664
  this.clipboardTextWriter = options.clipboardTextWriter;
659
665
  emitKeypressEvents(this.keys);
@@ -810,6 +816,9 @@ export class TerminalUI extends EventEmitter {
810
816
  return Promise.reject(new Error('Terminal is closed'));
811
817
  if (this.modal)
812
818
  return Promise.reject(new Error('A terminal screen is already active'));
819
+ // A screen that yields to the run's questions never opens over one already asked: it yields at once.
820
+ if (options.yieldToQuestions && this.pending && !this.pending.conversationPrompt)
821
+ return Promise.reject(new DOMException('Screen yielded to a question', 'AbortError'));
813
822
  if (options.signal?.aborted)
814
823
  return Promise.reject(new DOMException('Screen aborted', 'AbortError'));
815
824
  if (!this.started)
@@ -845,7 +854,7 @@ export class TerminalUI extends EventEmitter {
845
854
  modal.resolve(value);
846
855
  this.scheduleRender();
847
856
  }
848
- print(text, detail, toolCall, conversation = false, notice = true, alignRight = false, clipRows = false) {
857
+ print(text, detail, toolCall, conversation = false, notice = true, alignRight = false, clipRows = false, replaceKey) {
849
858
  if (notice) {
850
859
  this.dashboardNotices.push(clean(String(text)).slice(0, 100_000));
851
860
  this.dashboardNotices = this.dashboardNotices.slice(-12);
@@ -855,9 +864,14 @@ export class TerminalUI extends EventEmitter {
855
864
  this.modal.lines = [...this.modal.lines, ...lines].slice(-100);
856
865
  const entry = { text: lines.join('\n'), ...(detail ? { detail: clean(detail) } : {}),
857
866
  ...(toolCall ? { toolCall, timing: this.toolClock.get(toolCall.key) } : {}), ...(conversation ? { conversation: true } : {}), ...(alignRight ? { alignRight: true } : {}), ...(clipRows && detail ? { clipRows: true } : {}) };
867
+ const replaced = replaceKey !== undefined && this.replaceable?.key === replaceKey ? this.replaceable.entry : undefined;
858
868
  if (this.scroll)
859
- this.scroll += this.transcriptRows(entry, this.chatColumns()).length;
860
- this.transcript.append(entry);
869
+ this.scroll = Math.max(0, this.scroll + this.transcriptRows(entry, this.chatColumns()).length - (replaced ? this.transcriptRows(replaced, this.chatColumns()).length : 0));
870
+ if (replaced)
871
+ this.transcript.replaceLast(entry);
872
+ else
873
+ this.transcript.append(entry);
874
+ this.replaceable = replaceKey === undefined ? undefined : { key: replaceKey, entry };
861
875
  this.scheduleRender();
862
876
  }
863
877
  printPrompt(text, title = '') {
@@ -901,6 +915,7 @@ export class TerminalUI extends EventEmitter {
901
915
  if (this.scroll)
902
916
  this.scroll += this.transcriptRows(entry, this.chatColumns()).length;
903
917
  this.transcript.append(entry);
918
+ this.replaceable = undefined;
904
919
  this.scheduleRender();
905
920
  }
906
921
  appendThinking(delta) {
@@ -922,6 +937,7 @@ export class TerminalUI extends EventEmitter {
922
937
  if (this.closed)
923
938
  return;
924
939
  this.transcript.clear();
940
+ this.replaceable = undefined;
925
941
  this.expandedTranscript = false;
926
942
  this.expandedPromptIds.clear();
927
943
  this.collapsedPromptIds.clear();
@@ -968,7 +984,8 @@ export class TerminalUI extends EventEmitter {
968
984
  this.visitedNodes.clear();
969
985
  this.stoppedNode = undefined;
970
986
  }
971
- this.status = { ...this.status, ...partial, ...(partial.activity !== undefined && partial.backgroundActivity === undefined ? { backgroundActivity: false } : {}) };
987
+ const jevSettingChanged = partial.jevEnabled !== undefined && partial.jevEnabled !== this.status.jevEnabled && partial.jevOffThisRun === undefined;
988
+ this.status = { ...this.status, ...partial, ...(partial.activity !== undefined && partial.backgroundActivity === undefined ? { backgroundActivity: false } : {}), ...(jevSettingChanged ? { jevOffThisRun: false } : {}) };
972
989
  if (partial.activity === 'Ready') {
973
990
  this.activeNodes.clear();
974
991
  this.toolClock.stop();
@@ -2359,7 +2376,8 @@ export class TerminalUI extends EventEmitter {
2359
2376
  modal.offset = Math.max(0, Math.min(modal.offset, Math.max(0, content.length - viewport)));
2360
2377
  const visible = content.slice(modal.offset, modal.offset + viewport);
2361
2378
  const title = clip(` ${modal.title} `, cardWidth - 2);
2362
- const rows = [paint(clip(`◈ ${this.appName}`, width), GRAY), '', paint(` ╭${title}${'─'.repeat(Math.max(0, cardWidth - 2 - stringWidth(title)))}╮`, GRAY)];
2379
+ const modalSession = oneLine(this.sessionId?.() ?? '');
2380
+ const rows = [paint(clip(`◈ ${this.appName}${modalSession ? ` ${modalSession}` : ''}`, width), GRAY), '', paint(` ╭${title}${'─'.repeat(Math.max(0, cardWidth - 2 - stringWidth(title)))}╮`, GRAY)];
2363
2381
  for (const line of description)
2364
2382
  rows.push(paint(' │ ', GRAY) + paint(pad(line, innerWidth), GRAY) + paint(' │', GRAY));
2365
2383
  for (let index = 0; index < viewport; index++) {
@@ -2390,10 +2408,15 @@ export class TerminalUI extends EventEmitter {
2390
2408
  const aligned = alignRight && stringWidth(line) <= allowance;
2391
2409
  const lead = diff || box || isBrand || aligned ? undefined : /^\s*(?:(?:[•◦└]|\d{1,3}[.)])\s+)?/u.exec(line)?.[0];
2392
2410
  const hang = lead ? stringWidth(lead) : 0;
2411
+ // The bubble's tail is part of its box; only the speaker's name keeps the text color.
2412
+ if (line === ANDORRA_BUBBLE_TAIL + ANDORRA_BUBBLE_SPEAKER)
2413
+ return [{ text: line, color, segments: [{ text: ANDORRA_BUBBLE_TAIL, color: GRAY }, { text: ANDORRA_BUBBLE_SPEAKER, color }] }];
2393
2414
  const rows = lead && hang > 0 && hang <= allowance / 2 && stringWidth(line) > allowance
2394
2415
  ? wrap(line.slice(lead.length), allowance - hang).map((text, index) => (index ? ' '.repeat(hang) : lead) + text)
2395
2416
  : wrap(line, allowance);
2396
- return rows.map(text => ({ text: aligned && text ? ' '.repeat(allowance - stringWidth(text)) + text : text, color }));
2417
+ const shown = rows.map(text => aligned && text ? ' '.repeat(allowance - stringWidth(text)) + text : text);
2418
+ const links = wrappedLinks(line, shown);
2419
+ return shown.map((text, index) => ({ text, color, ...(links[index] ? { links: links[index] } : {}) }));
2397
2420
  });
2398
2421
  }
2399
2422
  transcriptRows(entry, width) {
@@ -2424,7 +2447,8 @@ export class TerminalUI extends EventEmitter {
2424
2447
  const rows = text.split('\n');
2425
2448
  const elapsed = entry.timing ? formatDuration(this.toolClock.elapsed(entry.timing)) : undefined;
2426
2449
  const right = [entry.toolCall.timestamp, elapsed].filter(Boolean).join(' · ');
2427
- return [...toolHeaderRows(rows[0], right, Math.max(1, width - 4)), ...rows.slice(1), ''].flatMap(row => this.wrapTranscript(row, width));
2450
+ // No blank row after a call: its result is the next entry and reads as part of it.
2451
+ return [...toolHeaderRows(rows[0], right, Math.max(1, width - 4)), ...rows.slice(1)].flatMap(row => this.wrapTranscript(row, width));
2428
2452
  }
2429
2453
  render() {
2430
2454
  if (!this.started || this.closed)
@@ -2508,7 +2532,9 @@ export class TerminalUI extends EventEmitter {
2508
2532
  visible[0] = { text: `? Scrollback ? ${this.scroll} lines below ? Page Down to return`, color: DIM };
2509
2533
  this.expandedPromptVisible = visible.some(row => row.promptExpanded);
2510
2534
  const status = this.status;
2511
- const top = this.dashboard ? `\u25c8 ${this.appName} \u00b7 Dashboard \u00b7 Ctrl+B transcript` : `\u25c8 ${this.appName}`;
2535
+ const sessionId = oneLine(this.sessionId?.() ?? '');
2536
+ const title = sessionId ? `\u25c8 ${this.appName} ${sessionId}` : `\u25c8 ${this.appName}`;
2537
+ const top = this.dashboard ? `${title} \u00b7 Dashboard \u00b7 Ctrl+B transcript` : title;
2512
2538
  const version = clip(`v${this.version}`, Math.floor(width / 3));
2513
2539
  const header = paint(pad(top, width - stringWidth(version)), DIM) + paint(version, FAINT);
2514
2540
  const label = choices ? this.pending?.choiceTitle || 'Choose an answer' : this.pending?.title ? this.pending.title : this.pending && !this.pending.regular ? 'Your approval' : this.pending?.conversationPrompt && this.value[0] === '/' ? 'Commands · Enter runs · Tab completes' : this.steering && status.activity && status.activity !== 'Ready' ? status.activity === 'Paused' ? 'Paused - Send direction to resume' : 'Steer this run · Enter to send' : '';
@@ -2520,7 +2546,7 @@ export class TerminalUI extends EventEmitter {
2520
2546
  const workingLabel = clip(workingText, Math.max(0, width - 6));
2521
2547
  const wave = Math.floor(elapsed / 120) % 11;
2522
2548
  const topBorder = working && workingLabel ? paint('╭ ', GRAY) + [...workingLabel].map((character, index) => paint(character, index < 7 && Math.abs(index - wave) <= 1 ? 255 : GRAY)).join('') + paint(' ' + '─'.repeat(Math.max(0, width - 4 - stringWidth(workingLabel))) + '╮', GRAY) : paint('╭' + borderLabel + '─'.repeat(Math.max(0, width - 2 - stringWidth(borderLabel))) + '╮', GRAY);
2523
- const lines = [header, paint(clip(` ${status.account ? `Account: ${oneLine(status.account.label)} | ` : ''}${oneLine(this.workspace)}`, width), FAINT), ...visible.map(line => line.segments ? ' ' + line.segments.map(segment => paint(segment.text, segment.color ?? GRAY)).join('') : paint(' ' + clip(line.text, width - 2), line.color)), ...thinkingLines.map(line => paint(' ' + pad(line, width - 4), GRAY)), ...agentLines, ...todoLines.map(line => paint(' ' + clip(line, width - 2), GRAY))];
2549
+ const lines = [header, paint(clip(` ${status.account ? `Account: ${oneLine(status.account.label)} | ` : ''}${oneLine(this.workspace)}`, width), FAINT), ...visible.map(line => line.segments ? ' ' + line.segments.map(segment => paint(segment.text, segment.color ?? GRAY)).join('') : paint(' ' + hyperlinkRow(clip(line.text, width - 2), line.links), line.color)), ...thinkingLines.map(line => paint(' ' + pad(line, width - 4), GRAY)), ...agentLines, ...todoLines.map(line => paint(' ' + clip(line, width - 2), GRAY))];
2524
2550
  if (completion && popupRows) {
2525
2551
  const cardWidth = width - 4;
2526
2552
  const popupTitle = clip(' Commands · ↑↓ move · Enter runs · Tab completes ', cardWidth - 2);
@@ -2555,7 +2581,7 @@ export class TerminalUI extends EventEmitter {
2555
2581
  const model = oneLine(`${active.label} · Thinking: ${active.reasoningEffort ?? 'provider default'}`);
2556
2582
  const branch = oneLine(status.branch || 'no branch');
2557
2583
  const branchWidth = Math.min(Math.floor(width / 3), stringWidth(branch) + 3);
2558
- const jev = oneLine(status.account?.jevQuota ?? 'Jev unavailable').replace(/^Jev(?= )/, status.jevEnabled === false ? 'Jev [Disabled] ·' : status.jevEnabled === true ? 'Jev [Enabled] ·' : 'Jev');
2584
+ const jev = oneLine(status.account?.jevQuota ?? 'Jev unavailable').replace(/^Jev(?= )/, status.jevEnabled === false ? 'Jev [Disabled] ·' : status.jevEnabled === true ? (status.jevOffThisRun ? 'Jev [Off this run] ·' : 'Jev [Enabled] ·') : 'Jev');
2559
2585
  const jevWidth = Math.min(stringWidth(jev), width - 1);
2560
2586
  const andorraUsage = this.andorraSegment();
2561
2587
  const andorraText = andorraUsage?.forms.find(text => stringWidth(model) + 1 + stringWidth(text) + 3 + jevWidth <= width - 1);
@@ -1,7 +1,7 @@
1
1
  import { toolFamily } from './decision/toolFamilies.js';
2
2
  import { canonicalToolName } from './tool-names.js';
3
3
  import { identifierTokens } from './context-selection.js';
4
- const PROTECTED = new Set(['complete_agent', 'complete', 'complete_task', 'submit_completion', 'update_todos', 'ask_user', 'load_project_skill', 'restore_tools', 'prepare_steps', 'update_widget', 'Skill', 'read_skill_resource', 'expand_tool_output', 'read_artifact', 'write_artifact']);
4
+ const PROTECTED = new Set(['complete_agent', 'complete', 'complete_task', 'submit_completion', 'update_todos', 'ask_user', 'submit_bug_report', 'load_project_skill', 'restore_tools', 'prepare_steps', 'update_widget', 'Skill', 'read_skill_resource', 'expand_tool_output', 'read_artifact', 'write_artifact']);
5
5
  const GIT_WORDS = /\b(git|commit|branch|rebase|merge|stash|diff|blame|checkout|pull request|pr\b|push|history|log)\b/i;
6
6
  const MEMORY_WORDS = /\b(remember|recall|memory|previous(ly)?|last time|earlier|convention|decision history)\b/i;
7
7
  const WEB_WORDS = /\b(docs?|documentation|https?:\/\/|url|website|web|online|latest version|api reference|changelog|npm package|look up|search the)\b/i;
@@ -12,6 +12,10 @@ function capReply(reply) {
12
12
  return `[REDACTED: unparsable reply naming a browser tool, ${reply.length} characters]`;
13
13
  return reply.length <= UNPARSED_REPLY_LIMIT ? reply : `${reply.slice(0, UNPARSED_REPLY_LIMIT)}… [${reply.length - UNPARSED_REPLY_LIMIT} more characters]`;
14
14
  }
15
+ function connectionCauseOf(error) {
16
+ const cause = error?.connectionCause;
17
+ return typeof cause === 'string' && /^[A-Z][A-Z0-9_]{0,63}$/.test(cause) ? cause : undefined;
18
+ }
15
19
  function unparsedReplyOf(error) {
16
20
  const reply = error && typeof error === 'object' ? error.unparsedReply : undefined;
17
21
  return typeof reply === 'string' ? reply : undefined;
@@ -365,7 +369,7 @@ export async function createSessionTrajectory(options = {}) {
365
369
  const started = performance.now();
366
370
  const forward = request.onRetry;
367
371
  const onRetry = async ({ unparsedReply, ...retry }) => {
368
- await record('model.retry', { ...metadata, durationMs: performance.now() - started, retry: retry.retry, reason: retry.reason,
372
+ await record('model.retry', { ...metadata, durationMs: performance.now() - started, retry: retry.retry, reason: retry.reason, ...(retry.cause === undefined ? {} : { cause: retry.cause }),
369
373
  ...(unparsedReply === undefined ? {} : { unparsedReply: capReply(unparsedReply) }) });
370
374
  await forward?.(retry);
371
375
  };
@@ -379,6 +383,7 @@ export async function createSessionTrajectory(options = {}) {
379
383
  await record('model.error', {
380
384
  ...metadata, durationMs: performance.now() - started, aborted: request.signal.aborted,
381
385
  error: { name: error instanceof Error ? error.name : 'Error', message: error instanceof Error ? error.message : String(error),
386
+ ...(connectionCauseOf(error) === undefined ? {} : { connectionCause: connectionCauseOf(error) }),
382
387
  ...(unparsedReplyOf(error) === undefined ? {} : { unparsedReply: capReply(unparsedReplyOf(error)) }) },
383
388
  });
384
389
  throw error;
@@ -7,6 +7,8 @@ export interface TranscriptEntry {
7
7
  detail?: string;
8
8
  toolCall?: ToolCallStamp;
9
9
  clipRows?: boolean;
10
+ /** A line with the same key that is still the newest one is rewritten by this entry, not followed by it. */
11
+ replaceKey?: string;
10
12
  }
11
13
  export declare function transcriptColor(text: string): number | string;
12
14
  export declare function formatAnswer(summary: string): TranscriptEntry;
@@ -6,6 +6,8 @@ import { HEADING_PREFIX, renderMarkdown } from './markdown.js';
6
6
  import { formatDuration } from './duration.js';
7
7
  import { toolCallStamp } from './tool-call-clock.js';
8
8
  import { canonicalCodingToolName } from './tool-names.js';
9
+ import { jevRequestPhrase } from './decision/requestPhrases.js';
10
+ import { compactionText } from './compaction-phrases.js';
9
11
  const clean = (value) => stripVTControlCharacters(String(value ?? '')).replace(/\r\n?/g, '\n').replace(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u202a-\u202e\u2066-\u2069]/g, '');
10
12
  const line = (value) => clipText(clean(value).replace(/\s+/g, ' ').trim(), 240);
11
13
  export function formatDurationSuffix(data) {
@@ -47,6 +49,7 @@ export function describeTool(name, value) {
47
49
  case 'message_subagent': return `Message a subagent: ${line(args.message)}`;
48
50
  case 'cancel_subagent': return 'Stop a subagent';
49
51
  case 'ask_user': return 'Ask a question';
52
+ case 'submit_bug_report': return `Send a bug report: ${line(args.title)}`;
50
53
  case 'git_read':
51
54
  case 'git_write': return `Git ${line(args.operation)}`;
52
55
  case 'memory_search': return `Search memory for "${line(args.query)}"`;
@@ -93,7 +96,7 @@ export function formatEvent(event) {
93
96
  const data = event.data;
94
97
  if (data.provider === 'andorra' || data.provider === 'jev') {
95
98
  if (event.type === 'decision.requested')
96
- return { text: '• [Jev] Evaluating context needs' };
99
+ return { text: `• [Jev] ${jevRequestPhrase(data.text)}` };
97
100
  if (event.type === 'decision.skills_truncated')
98
101
  return typeof data.text === 'string' && data.text ? { text: ` ⚠ ${data.text}` } : undefined;
99
102
  if (event.type === 'decision.completed')
@@ -114,13 +117,17 @@ export function formatEvent(event) {
114
117
  const identity = [data.nodeName, typeof data.copy === 'number' && Number(data.copies ?? 2) > 1 ? `copy ${data.copy}${data.copies ? `/${data.copies}` : ''}` : '', data.subagentId].filter(Boolean).map(line).join(' - ');
115
118
  const actor = identity ? `[${identity}] ` : '';
116
119
  if (event.type === 'agent.context.compaction.started')
117
- return { text: 'Summarizing earlier work to free context.' };
120
+ return { text: compactionText(data.text) };
121
+ if (event.type === 'agent.context.compacted' && data.reason === 'requested')
122
+ return { text: data.removedExchanges === 0 ? 'Nothing to compact yet: the run has no earlier exchanges to summarize. Continuing.' : `Compacted ${line(data.removedExchanges)} earlier exchange${data.removedExchanges === 1 ? '' : 's'} into a summary. Continuing.` };
123
+ if (event.type === 'agent.context.compaction.deferred' && data.requested === true)
124
+ return { text: `The context summary could not be written (${line(data.reason)}), so the run continues with its full history.` };
118
125
  if (event.type === 'agent.context.compaction.retry')
119
126
  return { text: `Context summary incomplete (${line(data.reason)}); retrying ${line(data.nextAttempt)}/3.` };
120
127
  if (event.type === 'agent.model.retry' && data.quiet === true)
121
128
  return undefined;
122
129
  if (event.type === 'agent.model.retry')
123
- return { text: `\u2022 ${actor}Provider request retry ${line(data.retry)}/${line(data.maxRetries)} in ${formatRetryDelay(data.delayMs)}: ${line(data.reason)}` };
130
+ return { text: `\u2022 ${actor}Provider request retry ${line(data.retry)}/${line(data.maxRetries)} in ${formatRetryDelay(data.delayMs)}: ${line(data.reason)}${typeof data.cause === 'string' && /^[A-Z][A-Z0-9_]{0,63}$/.test(data.cause) ? ` (${data.cause})` : ''}`, replaceKey: `model-retry:${JSON.stringify([data.runId, data.nodeId, data.copy, data.subagentId, data.nodeName].map(part => part ?? null))}` };
124
131
  if (event.type === 'graph.node.started')
125
132
  return { text: `Step: ${line(data.nodeName ?? data.nodeId)}${Number(data.visit) > 1 ? ` (visit ${line(data.visit)})` : ''}` };
126
133
  if (event.type === 'agent.modifier.iteration.started' && Number(data.maxIterations) > 1)
@@ -65,6 +65,10 @@ export interface ModelRetry {
65
65
  reason: string;
66
66
  quiet?: boolean;
67
67
  unparsedReply?: string;
68
+ /** The system error code behind a connection that could not be made (`ECONNREFUSED`, `EAI_AGAIN`), for the record only: `reason` stays the plain sentence. */
69
+ cause?: string;
70
+ /** The telemetry error code of the failure being retried (`http_429`, `provider_timeout`, `ECONNRESET`); record-only, never shown. */
71
+ code?: string;
68
72
  }
69
73
  export interface GenerateRequest {
70
74
  model: string;
@@ -77,6 +81,11 @@ export interface GenerateRequest {
77
81
  context?: ModelRequestContext;
78
82
  estimateInputTokens?: () => number;
79
83
  onRetry?: (retry: ModelRetry) => void | Promise<void>;
84
+ /**
85
+ * A failed request the provider recovered from without a visible retry (a 400 answered by sending again
86
+ * without a forced tool choice or without streaming). Record-only: its telemetry code, never shown.
87
+ */
88
+ onRecoveredError?: (code: string) => void;
80
89
  onRequest?: () => void;
81
90
  onReasoning?: (delta: string) => void;
82
91
  onText?: (delta: string) => void;
@@ -6,21 +6,29 @@ import { providerLabel } from './providers.js';
6
6
  const nonnegative = (value) => typeof value === 'number' && Number.isSafeInteger(value) && value >= 0 ? value : undefined;
7
7
  const finiteNonnegative = (value) => typeof value === 'number' && Number.isFinite(value) && value >= 0 ? value : undefined;
8
8
  const asObject = (value) => value !== null && typeof value === 'object' && !Array.isArray(value) ? value : undefined;
9
- const dateOf = (time) => {
9
+ const dateOf = (time, width = 10) => {
10
10
  if (typeof time !== 'string')
11
11
  return undefined;
12
12
  const instant = new Date(time);
13
- return Number.isFinite(instant.getTime()) ? instant.toISOString().slice(0, 10) : undefined;
13
+ return Number.isFinite(instant.getTime()) ? instant.toISOString().slice(0, width) : undefined;
14
14
  };
15
15
  const keyOf = (providerId, model) => JSON.stringify([providerId, model]);
16
16
  const emptyModel = (providerId, provider, model) => ({ providerId, provider, model, inputTokens: 0, outputTokens: 0, cacheRead: 0, savedInputEstimate: 0, savedOutputEstimate: 0, bypassedTurns: 0 });
17
17
  const emptyDay = (date) => ({ date, inputTokens: 0, outputTokens: 0, cacheRead: 0, savedInputEstimate: 0, savedOutputEstimate: 0, bypassedTurns: 0, models: [] });
18
18
  export function createUsageCollector(windowDays, now = new Date(), resolveProvider = provider => provider) {
19
- if (![7, 30, 365].includes(windowDays))
20
- throw new Error('windowDays must be 7, 30, or 365');
21
- const midnight = Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate());
22
- const cutoff = new Date(midnight - (windowDays - 1) * 86400000).toISOString().slice(0, 10);
23
- const today = new Date(midnight).toISOString().slice(0, 10);
19
+ if (![1, 7, 30, 365].includes(windowDays))
20
+ throw new Error('windowDays must be 1, 7, 30, or 365');
21
+ // A one-day window is the rolling last 24 hours, bucketed by UTC hour ("2026-10-29T12"); longer windows bucket by UTC date.
22
+ const hourly = windowDays === 1;
23
+ const step = hourly ? 3600000 : 86400000;
24
+ const buckets = hourly ? 24 : windowDays;
25
+ const width = hourly ? 13 : 10;
26
+ const start = hourly
27
+ ? Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), now.getUTCHours())
28
+ : Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate());
29
+ const bucketOf = (time) => dateOf(time, width);
30
+ const cutoff = new Date(start - (buckets - 1) * step).toISOString().slice(0, width);
31
+ const today = new Date(start).toISOString().slice(0, width);
24
32
  const days = new Map();
25
33
  const models = new Map();
26
34
  const baselines = new Map();
@@ -51,7 +59,7 @@ export function createUsageCollector(windowDays, now = new Date(), resolveProvid
51
59
  const item = asObject(record);
52
60
  if (!item)
53
61
  return;
54
- const date = dateOf(item.time);
62
+ const date = bucketOf(item.time);
55
63
  if (!date || date > today)
56
64
  return;
57
65
  if (item.type === 'model.response') {
@@ -130,8 +138,8 @@ export function createUsageCollector(windowDays, now = new Date(), resolveProvid
130
138
  };
131
139
  const finish = (filesScanned = 0, incomplete = false) => {
132
140
  const orderedDays = [];
133
- for (let i = 0; i < windowDays; i++) {
134
- const date = new Date(midnight - (windowDays - i - 1) * 86400000).toISOString().slice(0, 10);
141
+ for (let i = 0; i < buckets; i++) {
142
+ const date = new Date(start - (buckets - i - 1) * step).toISOString().slice(0, width);
135
143
  const day = days.get(date);
136
144
  orderedDays.push({ ...(day?.row ?? emptyDay(date)), models: [...(day?.models.values() ?? [])].sort((a, b) => b.inputTokens + b.outputTokens - a.inputTokens - a.outputTokens) });
137
145
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andorra-labs/code",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "description": "Terminal-first coding agent with a ReAct graph runtime",
5
5
  "homepage": "https://andorracode.com",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -56,6 +56,7 @@
56
56
  "typescript": "~5.9.3"
57
57
  },
58
58
  "dependencies": {
59
+ "@agentclientprotocol/sdk": "2.9.1",
59
60
  "@anthropic-ai/sdk": "0.124.0",
60
61
  "@colbymchenry/codegraph": "^1.6.0",
61
62
  "@google/genai": "2.21.0",