@andorra-labs/code 0.1.13 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/src/account-presentation.js +4 -1
  2. package/dist/src/agent-execution.js +300 -140
  3. package/dist/src/agent-mcp.js +2 -2
  4. package/dist/src/andorra/endpoint.d.ts +7 -0
  5. package/dist/src/andorra/endpoint.js +46 -0
  6. package/dist/src/andorra/entry.d.ts +21 -0
  7. package/dist/src/andorra/entry.js +100 -0
  8. package/dist/src/andorra/errors.d.ts +2 -0
  9. package/dist/src/andorra/errors.js +39 -0
  10. package/dist/src/andorra/hosted.d.ts +52 -0
  11. package/dist/src/andorra/hosted.js +126 -0
  12. package/dist/src/andorra/monitor.d.ts +151 -0
  13. package/dist/src/andorra/monitor.js +393 -0
  14. package/dist/src/andorra/notices.d.ts +7 -0
  15. package/dist/src/andorra/notices.js +15 -0
  16. package/dist/src/andorra/opt-in.d.ts +58 -0
  17. package/dist/src/andorra/opt-in.js +112 -0
  18. package/dist/src/andorra/request-watch.d.ts +6 -0
  19. package/dist/src/andorra/request-watch.js +10 -0
  20. package/dist/src/andorra/state.d.ts +86 -0
  21. package/dist/src/andorra/state.js +238 -0
  22. package/dist/src/andorra/terminal.d.ts +68 -0
  23. package/dist/src/andorra/terminal.js +125 -0
  24. package/dist/src/andorra/usage-format.d.ts +9 -0
  25. package/dist/src/andorra/usage-format.js +19 -0
  26. package/dist/src/anthropic-credentials.js +9 -1
  27. package/dist/src/app-server/protocol.d.ts +6 -2
  28. package/dist/src/app-server/protocol.js +1 -1
  29. package/dist/src/app-server.d.ts +27 -0
  30. package/dist/src/app-server.js +292 -85
  31. package/dist/src/auth/AuthManager.d.ts +9 -0
  32. package/dist/src/auth/AuthManager.js +161 -21
  33. package/dist/src/auth/deployment.d.ts +1 -0
  34. package/dist/src/auth/deployment.js +1 -0
  35. package/dist/src/auth/index.d.ts +1 -1
  36. package/dist/src/auth/index.js +1 -1
  37. package/dist/src/auth/store.d.ts +26 -0
  38. package/dist/src/auth/store.js +34 -1
  39. package/dist/src/browser-runner.js +1 -1
  40. package/dist/src/browser-stealth.d.ts +19 -1
  41. package/dist/src/browser-stealth.js +23 -3
  42. package/dist/src/browser-ui/tokens.css +4 -4
  43. package/dist/src/browser-view.d.ts +65 -0
  44. package/dist/src/browser-view.js +229 -16
  45. package/dist/src/cli.js +43 -26
  46. package/dist/src/command-screens.d.ts +17 -1
  47. package/dist/src/command-screens.js +192 -21
  48. package/dist/src/commands.d.ts +7 -1
  49. package/dist/src/commands.js +78 -27
  50. package/dist/src/config.d.ts +6 -1
  51. package/dist/src/config.js +86 -3
  52. package/dist/src/dashboard-view.d.ts +2 -0
  53. package/dist/src/dashboard-view.js +11 -2
  54. package/dist/src/decision/PreparedSteps.js +1 -1
  55. package/dist/src/decision/applyToolMenu.js +1 -1
  56. package/dist/src/decision/toolFamilies.js +1 -1
  57. package/dist/src/decision/types.d.ts +1 -0
  58. package/dist/src/graph-health.d.ts +11 -0
  59. package/dist/src/graph-health.js +36 -4
  60. package/dist/src/graph-manager-chat.d.ts +33 -0
  61. package/dist/src/graph-manager-chat.js +159 -5
  62. package/dist/src/graph-runner.js +27 -0
  63. package/dist/src/graph-selection.js +2 -1
  64. package/dist/src/graph-ui/app.js +25 -2
  65. package/dist/src/graph-ui/manager.js +40 -5
  66. package/dist/src/graph-ui/style.css +5 -2
  67. package/dist/src/graph-ui/tokens.css +4 -4
  68. package/dist/src/graphs.js +1 -3
  69. package/dist/src/hardened-runtime.js +1 -1
  70. package/dist/src/membership-errors.js +1 -1
  71. package/dist/src/membership.d.ts +10 -2
  72. package/dist/src/membership.js +20 -6
  73. package/dist/src/model-context-windows.d.ts +2 -0
  74. package/dist/src/model-context-windows.js +24 -0
  75. package/dist/src/model-health-cache.js +1 -1
  76. package/dist/src/model-metadata.d.ts +1 -0
  77. package/dist/src/model-metadata.js +40 -3
  78. package/dist/src/palette.d.ts +1 -0
  79. package/dist/src/palette.js +1 -1
  80. package/dist/src/permissions.js +17 -4
  81. package/dist/src/provider-connection.js +15 -0
  82. package/dist/src/provider-settings.d.ts +16 -1
  83. package/dist/src/provider-settings.js +36 -20
  84. package/dist/src/providers.d.ts +14 -2
  85. package/dist/src/providers.js +69 -11
  86. package/dist/src/react-runtime.js +12 -7
  87. package/dist/src/remote/engine-pool.js +5 -4
  88. package/dist/src/run-control.d.ts +2 -2
  89. package/dist/src/run-control.js +9 -6
  90. package/dist/src/runtime.d.ts +2 -0
  91. package/dist/src/runtime.js +2 -1
  92. package/dist/src/sessions.d.ts +1 -0
  93. package/dist/src/sessions.js +4 -2
  94. package/dist/src/skills/bundled/graph-manager/errors.md +1 -1
  95. package/dist/src/skills/bundled/provenance.json +738 -738
  96. package/dist/src/subagent-run.d.ts +2 -0
  97. package/dist/src/subagent-run.js +14 -3
  98. package/dist/src/telemetry/schema.d.ts +1 -1
  99. package/dist/src/telemetry/schema.js +2 -2
  100. package/dist/src/terminal-ui.d.ts +21 -0
  101. package/dist/src/terminal-ui.js +73 -10
  102. package/dist/src/transcript.js +3 -0
  103. package/dist/src/types.d.ts +3 -0
  104. package/dist/src/workspace-instructions.js +1 -1
  105. package/package.json +12 -1
@@ -12,6 +12,8 @@ export declare const MAX_SUBAGENT_MODEL_CHARS = 500;
12
12
  export declare class SubagentInvalidArgumentError extends Error {
13
13
  constructor(message: string);
14
14
  }
15
+ /** The adapters a subagent run talks to: each request names the run's session, so Andorra can keep it on one machine. */
16
+ export declare function subagentAdapterFactory(sessionId: string): (provider: ProviderConfig) => ModelAdapter;
15
17
  export declare function resolveSubagentPermissions(requested: unknown): SubagentPermissions;
16
18
  export declare function canonicalWorkspace(requested: string): Promise<string>;
17
19
  export interface SubagentProviderListing {
@@ -8,7 +8,8 @@ import { configuredContextWindow, createAdapter, providerModels } from './provid
8
8
  import { getMembership, loadAccessibleGraph } from './membership.js';
9
9
  import { currentGraphSubject } from './graph-selection.js';
10
10
  import { createRunTelemetry, recordModelUse } from './telemetry/capture.js';
11
- import { checkGraphModelHealth } from './graph-health.js';
11
+ import { hostedGate } from './andorra/hosted.js';
12
+ import { checkGraphModelHealth, plainHealthFailure } from './graph-health.js';
12
13
  import { validateGraph } from './graphs.js';
13
14
  import { runGraph } from './runtime.js';
14
15
  import { loadWorkspaceInstructions, systemPromptOverrideFor } from './workspace-instructions.js';
@@ -30,6 +31,10 @@ export const MAX_SUBAGENT_MODEL_CHARS = 500;
30
31
  export class SubagentInvalidArgumentError extends Error {
31
32
  constructor(message) { super(message); this.name = 'SubagentInvalidArgumentError'; }
32
33
  }
34
+ /** The adapters a subagent run talks to: each request names the run's session, so Andorra can keep it on one machine. */
35
+ export function subagentAdapterFactory(sessionId) {
36
+ return provider => createAdapter(provider, { sessionId });
37
+ }
33
38
  export function resolveSubagentPermissions(requested) {
34
39
  if (requested === undefined)
35
40
  return 'full-access';
@@ -110,6 +115,9 @@ export function resolveSubagentProvider(config, call = {}) {
110
115
  }
111
116
  const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms));
112
117
  function subagentHealthFailure(health) {
118
+ const plain = plainHealthFailure(health.failures);
119
+ if (plain !== undefined)
120
+ return plain;
113
121
  return ['The provider/model this subagent run would use is not usable:',
114
122
  ...health.failures.map(failure => `- ${failure.provider}/${failure.model}: ${failure.reason}`),
115
123
  'A subagent run always uses the built-in Andorra Agent graph, whose model is the one you picked, so there is no graph to edit: retry with another provider and model, or repair that provider credentials.',
@@ -327,6 +335,9 @@ export class SubagentRunner {
327
335
  }),
328
336
  };
329
337
  const health = await checkGraphModelHealth(graph, healthConfig, signal, {
338
+ // A subagent run has no monitor of its own: it asks the router once, so an Andorra that is off or signed out
339
+ // refuses the run with its sentence and no model request.
340
+ andorra: hostedGate(),
330
341
  ...(options.adapterFactory ? { createAdapter: options.adapterFactory } : options.healthDependencies),
331
342
  onUsage: (delta, reference) => {
332
343
  foldUsage(run.probeUsage, delta);
@@ -347,7 +358,7 @@ export class SubagentRunner {
347
358
  }
348
359
  const runProvider = config.providers.find(item => item.id === run.providerId);
349
360
  const resolvedProvider = options.adapterFactory ? { ...runProvider, model: run.model } : await resolveModelContext(runProvider, run.model, signal);
350
- const adapterFor = options.adapterFactory ?? createAdapter;
361
+ const adapterFor = options.adapterFactory ?? subagentAdapterFactory(run.sessionId);
351
362
  const snapshot = await extensionSnapshot(effectiveExtensionConfig(config, run.workspace), signal, run.directory);
352
363
  const instructions = `${await loadWorkspaceInstructions(run.workspace, signal, systemPromptOverrideFor(graph, config.systemPromptOverride))}${snapshot.instructions}`;
353
364
  const context = {
@@ -396,7 +407,7 @@ export class SubagentRunner {
396
407
  return Promise.resolve({ model: wanted, adapter: options.adapterFactory(providerForModel(provider, wanted)), providerType: provider.type, baseUrl: provider.baseUrl });
397
408
  }
398
409
  return resolveModelContext(provider, wanted, modelSignal)
399
- .then(resolved => ({ model: resolved.model, adapter: createAdapter(resolved), contextWindow: resolved.contextWindow, providerType: provider.type, baseUrl: provider.baseUrl }));
410
+ .then(resolved => ({ model: resolved.model, adapter: subagentAdapterFactory(run.sessionId)(resolved), contextWindow: resolved.contextWindow, providerType: provider.type, baseUrl: provider.baseUrl }));
400
411
  },
401
412
  resolveProvider: id => {
402
413
  const provider = config.providers.find(item => item.id === id);
@@ -31,7 +31,7 @@ export declare const TELEMETRY_LANGUAGES: readonly ["typescript", "javascript",
31
31
  export type TelemetryLanguage = typeof TELEMETRY_LANGUAGES[number];
32
32
  export declare const TELEMETRY_FRAMEWORKS: readonly ["react", "vue", "angular", "svelte", "nextjs", "nestjs", "express", "fastapi", "django", "flask", "spring", "rails", "laravel", "dotnet", "actix", "axum", "gin", "flutter", "electron", "tauri", "other"];
33
33
  export type TelemetryFramework = typeof TELEMETRY_FRAMEWORKS[number];
34
- export declare const TELEMETRY_TOOL_NAMES: readonly ["Read", "Write", "Edit", "Glob", "Grep", "Bash", "PowerShell", "git_read", "read_artifact", "write_artifact", "repo_explore", "memory_search", "set_timer", "pull_request", "read_skill_resource", "ask_user", "spawn_subagent", "qa.browser", "qa.browser_session", "qa.terminal", "browser.panel", "browser.incognito", "browser.extensions", "browser.solve_captcha", "web_search", "mcp", "plugin", "other"];
34
+ export declare const TELEMETRY_TOOL_NAMES: readonly ["Read", "Write", "Edit", "Glob", "Grep", "Bash", "PowerShell", "git_read", "read_artifact", "write_artifact", "repo_explore", "memory_search", "set_timer", "pull_request", "read_skill_resource", "ask_user", "spawn_subagent", "wait_subagent", "message_subagent", "cancel_subagent", "qa.browser", "qa.browser_session", "qa.terminal", "browser.panel", "browser.incognito", "browser.extensions", "browser.solve_captcha", "web_search", "mcp", "plugin", "other"];
35
35
  export type TelemetryToolName = typeof TELEMETRY_TOOL_NAMES[number];
36
36
  export declare const TELEMETRY_MODELS: readonly ["gpt-4.1", "gpt-4.1-mini", "gpt-4.1-nano", "gpt-4o", "gpt-4o-mini", "gpt-4-turbo", "gpt-4", "o1", "o1-mini", "o3", "o3-mini", "o4-mini", "claude-opus-5-5", "claude-sonnet-5-5", "claude-haiku-5-5", "claude-opus-4", "claude-sonnet-4", "claude-sonnet-4-6", "claude-3-7-sonnet", "claude-3-5-sonnet", "claude-3-5-haiku", "gemini-2.5-pro", "gemini-2.5-flash", "llama-3.3-70b", "deepseek-chat", "qwen-2.5-coder", "other"];
37
37
  export declare const APP_VERSION_PATTERN: RegExp;
@@ -23,7 +23,7 @@ export const TELEMETRY_FRAMEWORKS = ['react', 'vue', 'angular', 'svelte', 'nextj
23
23
  export const TELEMETRY_TOOL_NAMES = [
24
24
  ...CANONICAL_CODING_TOOLS,
25
25
  'git_read', 'read_artifact', 'write_artifact', 'repo_explore', 'memory_search', 'set_timer', 'pull_request',
26
- 'read_skill_resource', 'ask_user', 'spawn_subagent',
26
+ 'read_skill_resource', 'ask_user', 'spawn_subagent', 'wait_subagent', 'message_subagent', 'cancel_subagent',
27
27
  'qa.browser', 'qa.browser_session', 'qa.terminal',
28
28
  'browser.panel', 'browser.incognito', 'browser.extensions',
29
29
  'browser.solve_captcha', 'web_search',
@@ -132,7 +132,7 @@ export function bucketToolName(name) {
132
132
  return 'mcp';
133
133
  return 'other';
134
134
  }
135
- const GRAPH_RUNTIME_TOOLS = new Set(['git_read', 'read_artifact', 'write_artifact', 'repo_explore', 'memory_search', 'set_timer', 'pull_request', 'read_skill_resource', 'ask_user', 'spawn_subagent']);
135
+ const GRAPH_RUNTIME_TOOLS = new Set(['git_read', 'read_artifact', 'write_artifact', 'repo_explore', 'memory_search', 'set_timer', 'pull_request', 'read_skill_resource', 'ask_user', 'spawn_subagent', 'wait_subagent', 'message_subagent', 'cancel_subagent']);
136
136
  export function isMetadataTool(name) { return METADATA_TOOLS.has(name); }
137
137
  export function isGraphRuntimeTool(name) { return GRAPH_RUNTIME_TOOLS.has(name); }
138
138
  export function bucketWorkspaceFiles(count) {
@@ -7,6 +7,7 @@ import type { TodoItem } from './todos.js';
7
7
  import { type SessionGoal } from './session-goal.js';
8
8
  import type { AccountPresentation } from './account-presentation.js';
9
9
  import { type ToolCallStamp } from './tool-call-clock.js';
10
+ import type { HostedUsage } from './andorra/monitor.js';
10
11
  import { type PanelChanges, type PanelTerminal } from './side-panel.js';
11
12
  import { type PendingAttachment } from './attachments.js';
12
13
  export interface TerminalStatus {
@@ -26,6 +27,12 @@ export interface TerminalStatus {
26
27
  reasoningEffort?: string;
27
28
  graph?: Graph;
28
29
  providerModels?: Record<string, string>;
30
+ /** Provider id → model id → display name (Andorra models); only what a person reads changes. */
31
+ modelNames?: Record<string, Record<string, string>>;
32
+ /** Ids of the configured providers that serve Andorra's hosted models. */
33
+ andorraProviders?: readonly string[];
34
+ /** What to show for Andorra's hosted models (HostedMonitor.usage); the footer shows it while an Andorra model is in play. */
35
+ andorraUsage?: HostedUsage;
29
36
  graphSelection?: string;
30
37
  graphNeedsOverride?: boolean;
31
38
  codeIntel?: string;
@@ -64,6 +71,11 @@ export interface ScreenOptions {
64
71
  collapsePrefix?: string;
65
72
  /** The choice marked with a check, when it differs from the one the cursor starts on. */
66
73
  checkedId?: string;
74
+ /**
75
+ * For a select whose rows can change while it is open: called once when it opens with `redraw`, which replaces
76
+ * the rows in place (the highlight stays on the row with the same id); returns what to call when the select closes.
77
+ */
78
+ refresh?: (redraw: (items: readonly TerminalChoice[]) => void) => () => void;
67
79
  }
68
80
  export declare class TerminalUI extends EventEmitter {
69
81
  private readonly input;
@@ -110,6 +122,15 @@ export declare class TerminalUI extends EventEmitter {
110
122
  private panelColumns;
111
123
  private panelRows;
112
124
  private composePanel;
125
+ /** What a person reads for a model: its display name when the provider has one (Andorra), else the id. */
126
+ private providerText;
127
+ private modelText;
128
+ /**
129
+ * The footer's Andorra usage segment, while an Andorra model is in play: the selected model, the model of the node
130
+ * answering, or an agent node of the shown graph resolves to an Andorra provider (a node without one runs the selected model).
131
+ * `forms` lists the texts to try, longest first; the footer shows the first that fits.
132
+ */
133
+ private andorraSegment;
113
134
  private activeModel;
114
135
  private started;
115
136
  private releaseWarnings;
@@ -12,7 +12,8 @@ import { ToolCallClock, toolHeaderRows } from './tool-call-clock.js';
12
12
  import { formatDuration, formatHms } from './duration.js';
13
13
  import { PagedTranscript } from './paged-transcript.js';
14
14
  import { emptySelection, highlightRow, selectedSpan, selectedText, wordAt } from './screen-selection.js';
15
- import { accentSgr, ATTACHMENT_TOKEN, ATTENTION, DIM, FAINT, GRAY, SKILL_CHIP, SUBTLE, WHITE } from './palette.js';
15
+ import { accentSgr, ATTACHMENT_TOKEN, ATTENTION, DIM, FAINT, GRAY, SKILL_CHIP, STATUS, SUBTLE, WHITE } from './palette.js';
16
+ import { usageTone } from './andorra/usage-format.js';
16
17
  import { isCustomGraph, panelRowText, panelWidth, PANEL_MIN_COLUMNS, PANEL_MIN_ROWS, sidePanelRows, subagentTreeRows } from './side-panel.js';
17
18
  import { TokenRateMeter } from './token-rate.js';
18
19
  import { SubagentTracker } from './subagent-tree.js';
@@ -28,7 +29,7 @@ const clean = (text) => stripVTControlCharacters(text).replace(/\r\n?/g, '\n').r
28
29
  const oneLine = (text) => clean(text).replace(/\n/g, ' ');
29
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'];
30
31
  const argumentCompletions = {
31
- '/jev': ['/jev status', '/jev on', '/jev off'],
32
+ '/jev': ['/jev status', '/jev on', '/jev off', '/jev global on', '/jev global off'],
32
33
  '/feedback': ['/feedback status', '/feedback on', '/feedback off'],
33
34
  '/yolo': ['/yolo off', '/yolo on'],
34
35
  '/reasoning': ['default', 'none', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max'].map(level => `/reasoning ${level}`),
@@ -66,7 +67,8 @@ const commandDescriptions = {
66
67
  '/skill': 'Show the active skill', '/skill off': 'Pause the active skill', '/skill on': 'Resume the active skill', '/skill remove': 'End the active skill',
67
68
  '/skills': 'Manage and install skills', '/plugins': 'Manage and install plugins',
68
69
  '/mcp': 'Manage MCP servers',
69
- '/jev': 'Turn Jev on or off for nodes that enable it', '/jev on': 'Enable Jev', '/jev off': 'Disable Jev', '/jev status': 'Show saved Jev setting',
70
+ '/jev': 'Turn Jev on or off for this session', '/jev on': 'Turn Jev on for this session', '/jev off': 'Turn Jev off for this session', '/jev status': 'Show the session and global Jev settings',
71
+ '/jev global on': 'Turn the Global Jev switch on', '/jev global off': 'Turn Jev off for every session and agent',
70
72
  '/feedback': 'Show the anonymous-feedback setting; Paid accounts can turn it off', '/feedback on': 'Allow anonymous product feedback', '/feedback off': 'Stop anonymous product feedback (Paid plan)', '/feedback status': 'Show saved feedback setting',
71
73
  '/graph': 'Choose a graph', '/codegraph': 'Code intelligence status and actions', '/usage': 'Usage and token totals', '/yolo': 'Turn automatic approvals on or off', '/yolo on': 'Approve everything for this session', '/yolo off': 'Restore Ask for approval',
72
74
  '/permissions': 'Choose workspace permissions',
@@ -314,7 +316,7 @@ export class TerminalUI extends EventEmitter {
314
316
  const modelLabel = typeof model === 'string' ? oneLine(model) : undefined;
315
317
  const effort = typeof session.reasoningEffort === 'string' ? oneLine(session.reasoningEffort) : undefined;
316
318
  if (providerLabel !== undefined && modelLabel !== undefined)
317
- this.nodeModels.set(nodeId, oneLine(`${providerLabel}/${modelLabel}`));
319
+ this.nodeModels.set(nodeId, oneLine(`${providerLabel}/${this.modelText(provider, model)}`));
318
320
  this.stampSpeedMeter(this.speedKey(nodeId, typeof session.copy === 'number' ? session.copy : undefined), providerLabel, modelLabel, effort);
319
321
  }
320
322
  if (event.type.startsWith('dashboard.'))
@@ -463,7 +465,7 @@ export class TerminalUI extends EventEmitter {
463
465
  const perCopy = id === focus && this.activeSpeedCopy !== undefined ? node.copiesResolved?.get(this.activeSpeedCopy) : undefined;
464
466
  const provider = perCopy?.provider ?? node.provider;
465
467
  const model = perCopy?.model ?? node.model;
466
- const label = provider !== undefined || model !== undefined ? `${provider ?? this.status.provider} / ${model ?? this.status.model}` : '';
468
+ const label = provider !== undefined || model !== undefined ? `${this.providerText(provider ?? this.status.provider)} / ${this.modelText(provider ?? this.status.provider, model ?? this.status.model)}` : '';
467
469
  return { id, name: node.name, ...(detail ? { detail } : {}), ...(label ? { model: label } : {}) };
468
470
  });
469
471
  return sidePanelRows({
@@ -493,17 +495,50 @@ export class TerminalUI extends EventEmitter {
493
495
  return padded + (text ? ` ${divider} ${text}` : ` ${divider}`);
494
496
  });
495
497
  }
498
+ /** What a person reads for a model: its display name when the provider has one (Andorra), else the id. */
499
+ // Model names are published only for the hosted Andorra provider, whose saved id is lower case;
500
+ // every other provider is shown by the id the user gave it.
501
+ providerText(provider) {
502
+ const names = this.status.modelNames;
503
+ return names && Object.hasOwn(names, provider) ? 'Andorra' : provider;
504
+ }
505
+ modelText(provider, model) {
506
+ const names = this.status.modelNames;
507
+ const own = names && Object.hasOwn(names, provider) ? names[provider] : undefined;
508
+ const name = own && Object.hasOwn(own, model) ? own[model] : undefined;
509
+ return typeof name === 'string' && name ? name : model;
510
+ }
511
+ /**
512
+ * The footer's Andorra usage segment, while an Andorra model is in play: the selected model, the model of the node
513
+ * answering, or an agent node of the shown graph resolves to an Andorra provider (a node without one runs the selected model).
514
+ * `forms` lists the texts to try, longest first; the footer shows the first that fits.
515
+ */
516
+ andorraSegment() {
517
+ const usage = this.status.andorraUsage;
518
+ const andorra = new Set(this.status.andorraProviders ?? []);
519
+ if (!usage || andorra.size === 0)
520
+ return undefined;
521
+ const active = this.displayNode();
522
+ const inPlay = andorra.has(this.status.provider) || (active?.provider !== undefined && andorra.has(active.provider))
523
+ || Object.values(this.status.graph?.nodes ?? {}).some(node => node.type === 'agent' && node.provider !== undefined && andorra.has(node.provider));
524
+ if (!inPlay)
525
+ return undefined;
526
+ if (usage.kind === 'not-available')
527
+ return { forms: ['Andorra: Not available', 'Andorra n/a'], color: FAINT };
528
+ const tone = usageTone(usage.usedPercent);
529
+ return { forms: [`Andorra ${usage.usedPercent}%`], color: tone === 'full' ? STATUS.error : tone === 'warn' ? STATUS.warn : GRAY };
530
+ }
496
531
  activeModel() {
497
532
  const node = this.displayNode();
498
533
  if (!node)
499
- return { label: oneLine(`${this.status.provider} / ${this.status.model}`), reasoningEffort: this.status.reasoningEffort, contextWindow: this.status.contextWindow };
534
+ return { label: oneLine(`${this.providerText(this.status.provider)} / ${this.modelText(this.status.provider, this.status.model)}`), reasoningEffort: this.status.reasoningEffort, contextWindow: this.status.contextWindow };
500
535
  const more = this.activeNodes.size > 1 ? ` +${this.activeNodes.size - 1} more` : '';
501
536
  const perCopy = this.activeSpeedCopy !== undefined ? node.copiesResolved?.get(this.activeSpeedCopy) : undefined;
502
537
  const provider = perCopy?.provider ?? node.provider ?? this.status.provider;
503
538
  const model = perCopy?.model ?? node.model ?? this.status.model;
504
539
  const resolved = perCopy?.resolved ?? node.resolved;
505
540
  return {
506
- label: oneLine(`${node.name}${more} · ${provider} / ${model}`),
541
+ label: oneLine(`${node.name}${more} · ${this.providerText(provider)} / ${this.modelText(provider, model)}`),
507
542
  reasoningEffort: resolved ? resolved.reasoningEffort : this.status.reasoningEffort,
508
543
  contextWindow: resolved ? resolved.contextWindow : this.status.contextWindow,
509
544
  };
@@ -716,7 +751,29 @@ export class TerminalUI extends EventEmitter {
716
751
  let selected = Math.max(0, items.findIndex(item => item.id === options.selectedId));
717
752
  while (items[selected]?.separator)
718
753
  selected++;
719
- return this.openModal({ kind: 'select', title, items: [...items], lines: [], selected, selectedId: options.selectedId, ...options });
754
+ const { refresh, ...rest } = options;
755
+ const opened = this.openModal({ kind: 'select', title, items: [...items], lines: [], selected, selectedId: options.selectedId, ...rest });
756
+ if (!refresh)
757
+ return opened;
758
+ const modal = this.modal;
759
+ const stop = refresh(next => {
760
+ // Only while this very select is the screen on top: a sub-screen opened from it is never redrawn under.
761
+ if (!modal || this.modal !== modal)
762
+ return;
763
+ const highlighted = modal.items[modal.selected]?.id;
764
+ modal.items = [...next];
765
+ const kept = modal.items.findIndex(item => item.id === highlighted && !item.separator);
766
+ modal.selected = kept >= 0 ? kept : Math.max(0, Math.min(modal.selected, modal.items.length - 1));
767
+ if (kept < 0)
768
+ this.moveSelection(modal, 0);
769
+ this.scheduleRender();
770
+ });
771
+ const done = () => { try {
772
+ stop();
773
+ }
774
+ catch { /* the caller's cleanup never breaks the screen */ } };
775
+ opened.then(done, done);
776
+ return opened;
720
777
  }
721
778
  moveSelection(modal, movement, homeEnd) {
722
779
  const selectable = (index) => index >= 0 && index < modal.items.length && !modal.items[index].separator;
@@ -2444,7 +2501,7 @@ export class TerminalUI extends EventEmitter {
2444
2501
  revision: entry => entry.timing ? formatDuration(this.toolClock.elapsed(entry.timing)) ?? ''
2445
2502
  : entry.promptDisclosure ? (this.promptExpanded(entry.promptDisclosure.id) ? 'expanded' : 'collapsed') : '' });
2446
2503
  this.scroll = page.scroll;
2447
- const visible = this.dashboard ? dashboardRows({ metrics: this.dashboardMetrics.snapshot(), selectedModel: this.dashboardModel, provider: this.status.provider, model: this.status.model, graph: this.status.graph, providerModels: this.status.providerModels, activeNodes: [...this.activeNodes.keys()], nodeModels: this.nodeModels, todos: this.todos, todoOffset: this.todoOffset, onTodoOffset: offset => { this.todoOffset = offset; }, graphOffset: this.dashboardGraphOffset, notices: this.dashboardNotices, question: this.pending && !this.pending.conversationPrompt ? this.pending.dashboardQuestion ?? this.pending.choiceTitle ?? this.pending.title ?? this.pending.label : undefined }, Math.max(2, width - 4), transcriptHeight).map(line => ({ text: panelRowText(line), color: DIM, segments: line.segments })) : page.rows;
2504
+ const visible = this.dashboard ? dashboardRows({ metrics: this.dashboardMetrics.snapshot(), selectedModel: this.dashboardModel, provider: this.status.provider, model: this.status.model, graph: this.status.graph, providerModels: this.status.providerModels, modelNames: this.status.modelNames, activeNodes: [...this.activeNodes.keys()], nodeModels: this.nodeModels, todos: this.todos, todoOffset: this.todoOffset, onTodoOffset: offset => { this.todoOffset = offset; }, graphOffset: this.dashboardGraphOffset, notices: this.dashboardNotices, question: this.pending && !this.pending.conversationPrompt ? this.pending.dashboardQuestion ?? this.pending.choiceTitle ?? this.pending.title ?? this.pending.label : undefined }, Math.max(2, width - 4), transcriptHeight).map(line => ({ text: panelRowText(line), color: DIM, segments: line.segments })) : page.rows;
2448
2505
  while (visible.length < transcriptHeight)
2449
2506
  visible.push({ text: '', color: DIM });
2450
2507
  if (!this.dashboard && this.scroll && visible.length)
@@ -2500,7 +2557,13 @@ export class TerminalUI extends EventEmitter {
2500
2557
  const branchWidth = Math.min(Math.floor(width / 3), stringWidth(branch) + 3);
2501
2558
  const jev = oneLine(status.account?.jevQuota ?? 'Jev unavailable').replace(/^Jev(?= )/, status.jevEnabled === false ? 'Jev [Disabled] ·' : status.jevEnabled === true ? 'Jev [Enabled] ·' : 'Jev');
2502
2559
  const jevWidth = Math.min(stringWidth(jev), width - 1);
2503
- lines.push(paint(pad(model, Math.max(0, width - jevWidth - 2)) + (width - jevWidth > 1 ? ' ' : '') + clip(jev, jevWidth), GRAY));
2560
+ const andorraUsage = this.andorraSegment();
2561
+ const andorraText = andorraUsage?.forms.find(text => stringWidth(model) + 1 + stringWidth(text) + 3 + jevWidth <= width - 1);
2562
+ const andorraWidth = andorraText !== undefined ? stringWidth(andorraText) + 3 : 0;
2563
+ if (andorraUsage && andorraText !== undefined)
2564
+ lines.push(paint(pad(model, width - jevWidth - andorraWidth - 2) + ' ', GRAY) + paint(andorraText, andorraUsage.color) + paint(` · ${jev}`, GRAY));
2565
+ else
2566
+ lines.push(paint(pad(model, Math.max(0, width - jevWidth - 2)) + (width - jevWidth > 1 ? ' ' : '') + clip(jev, jevWidth), GRAY));
2504
2567
  const graph = oneLine(`Graph: ${(status.graphSelection ?? (status.graph?.id === 'software-engineer' ? 'default' : status.graph?.id)) === 'default' ? 'Default' : status.graph?.name ?? 'Not selected'}${status.codeIntel ? ` · CodeGraph: ${status.codeIntel}` : ''}`);
2505
2568
  if (!compactFooter)
2506
2569
  lines.push(paint(pad(graph, width - branchWidth) + clip(`⎇ ${branch}`, branchWidth), GRAY));
@@ -43,6 +43,9 @@ export function describeTool(name, value) {
43
43
  }
44
44
  switch (name) {
45
45
  case 'spawn_subagent': return `Delegate to ${line(args.role)}: ${line(args.task)}`;
46
+ case 'wait_subagent': return 'Wait for a subagent';
47
+ case 'message_subagent': return `Message a subagent: ${line(args.message)}`;
48
+ case 'cancel_subagent': return 'Stop a subagent';
46
49
  case 'ask_user': return 'Ask a question';
47
50
  case 'git_read':
48
51
  case 'git_write': return `Git ${line(args.operation)}`;
@@ -109,7 +109,10 @@ export interface ToolContext {
109
109
  runControl?: import('./run-control.js').RunControl;
110
110
  workspace: string;
111
111
  signal: AbortSignal;
112
+ toolCallId?: string;
113
+ toolInvocationId?: string;
112
114
  userSignal?: AbortSignal;
115
+ steerSignal?: AbortSignal;
113
116
  yolo: boolean;
114
117
  permissions?: import('./permissions.js').PermissionMode;
115
118
  pinFilePaths?: boolean;
@@ -13,7 +13,7 @@ export function selectGuideName(entries) {
13
13
  return undefined;
14
14
  }
15
15
  // The system prompt override from Settings belongs to the Default graph (Andorra Agent) alone.
16
- // Every other graph, the paid Andorra graph included, reads the project's guide file. The Default
16
+ // Every other graph reads the project's guide file. The Default
17
17
  // selection runs as 'software-engineer' (SOFTWARE_ENGINEER_HARNESS in membership.ts).
18
18
  export function systemPromptOverrideFor(graph, override) {
19
19
  return graph.id === 'software-engineer' || graph.id === 'default' ? override : undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andorra-labs/code",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
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",
@@ -30,6 +30,7 @@
30
30
  },
31
31
  "scripts": {
32
32
  "build": "node build.mjs",
33
+ "setup": "allow-scripts run",
33
34
  "check": "node scripts/build-engine.mjs && tsc --noEmit && npm run check --prefix desktop",
34
35
  "test": "npm run build && node scripts/run-tests.mjs",
35
36
  "ci:local": "node scripts/ci-local.mjs",
@@ -46,6 +47,8 @@
46
47
  "eval:jev:live": "node scripts/jev-efficiency-live.mjs"
47
48
  },
48
49
  "devDependencies": {
50
+ "@lavamoat/allow-scripts": "5.1.0",
51
+ "@lavamoat/preinstall-always-fail": "3.0.1",
49
52
  "@types/cross-spawn": "6.0.6",
50
53
  "@types/node": "^22.0.0",
51
54
  "@types/proper-lockfile": "4.1.4",
@@ -75,5 +78,13 @@
75
78
  "string-width": "^8.2.2",
76
79
  "typebox": "1.3.27",
77
80
  "yaml": "2.9.0"
81
+ },
82
+ "lavamoat": {
83
+ "allowScripts": {
84
+ "@google/genai#2.21.0": false,
85
+ "@google/genai>protobufjs#7.6.6": false,
86
+ "node-pty#1.1.0": true,
87
+ "@lavamoat/preinstall-always-fail#3.0.1": false
88
+ }
78
89
  }
79
90
  }