@andorra-labs/code 0.1.15 → 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 (100) hide show
  1. package/dist/src/agent-definitions.js +29 -6
  2. package/dist/src/agent-execution.js +4 -2
  3. package/dist/src/agent-mcp.d.ts +1 -1
  4. package/dist/src/agent-mcp.js +13 -9
  5. package/dist/src/app-server/protocol.d.ts +4 -1
  6. package/dist/src/app-server/protocol.js +1 -1
  7. package/dist/src/app-server.d.ts +107 -0
  8. package/dist/src/app-server.js +893 -22
  9. package/dist/src/auth/deployment.js +2 -2
  10. package/dist/src/browser-runner.js +1 -0
  11. package/dist/src/browser-ui/style.css +3 -3
  12. package/dist/src/browser-ui/tokens.css +27 -16
  13. package/dist/src/claude-provider.js +3 -1
  14. package/dist/src/cli.js +22 -8
  15. package/dist/src/codex-errors.js +4 -1
  16. package/dist/src/command-screens.js +5 -3
  17. package/dist/src/commands.d.ts +2 -1
  18. package/dist/src/compaction-phrases.d.ts +4 -0
  19. package/dist/src/compaction-phrases.js +20 -0
  20. package/dist/src/context-compaction.js +2 -1
  21. package/dist/src/decision/DecisionManager.js +3 -2
  22. package/dist/src/decision/requestPhrases.d.ts +4 -0
  23. package/dist/src/decision/requestPhrases.js +23 -0
  24. package/dist/src/github-inbox.d.ts +55 -0
  25. package/dist/src/github-inbox.js +153 -0
  26. package/dist/src/graph-health.js +7 -3
  27. package/dist/src/graph-provider-portability.js +32 -10
  28. package/dist/src/graph-quota.d.ts +29 -2
  29. package/dist/src/graph-quota.js +68 -10
  30. package/dist/src/graph-runner.js +24 -7
  31. package/dist/src/graph-server.d.ts +1 -1
  32. package/dist/src/graph-server.js +9 -7
  33. package/dist/src/graph-ui/app.js +110 -33
  34. package/dist/src/graph-ui/controls.css +1 -0
  35. package/dist/src/graph-ui/embed.js +2 -2
  36. package/dist/src/graph-ui/icons.js +1 -0
  37. package/dist/src/graph-ui/index.html +1 -1
  38. package/dist/src/graph-ui/manager.css +1 -1
  39. package/dist/src/graph-ui/manager.js +2 -2
  40. package/dist/src/graph-ui/sidebar.js +30 -0
  41. package/dist/src/graph-ui/studio-canvas.js +26 -13
  42. package/dist/src/graph-ui/studio.css +15 -7
  43. package/dist/src/graph-ui/studio.js +11 -4
  44. package/dist/src/graph-ui/style.css +77 -45
  45. package/dist/src/graph-ui/theme.js +3 -36
  46. package/dist/src/graph-ui/tokens.css +27 -19
  47. package/dist/src/graphs.js +4 -3
  48. package/dist/src/membership.d.ts +20 -1
  49. package/dist/src/membership.js +29 -4
  50. package/dist/src/model-metadata.d.ts +1 -1
  51. package/dist/src/model-metadata.js +4 -2
  52. package/dist/src/plan-pass.d.ts +59 -0
  53. package/dist/src/plan-pass.js +165 -0
  54. package/dist/src/provider-engine.js +3 -0
  55. package/dist/src/providers.d.ts +17 -0
  56. package/dist/src/providers.js +68 -19
  57. package/dist/src/pull-request-checks.d.ts +26 -0
  58. package/dist/src/pull-request-checks.js +56 -0
  59. package/dist/src/pull-request-conversation.d.ts +134 -0
  60. package/dist/src/pull-request-conversation.js +221 -0
  61. package/dist/src/pull-request-create.d.ts +175 -0
  62. package/dist/src/pull-request-create.js +392 -0
  63. package/dist/src/pull-request-details.d.ts +242 -0
  64. package/dist/src/pull-request-details.js +614 -0
  65. package/dist/src/pull-request-edit.d.ts +23 -0
  66. package/dist/src/pull-request-edit.js +91 -0
  67. package/dist/src/pull-request-logs.d.ts +76 -0
  68. package/dist/src/pull-request-logs.js +172 -0
  69. package/dist/src/pull-request-merge.d.ts +112 -0
  70. package/dist/src/pull-request-merge.js +258 -0
  71. package/dist/src/pull-request-review.d.ts +137 -0
  72. package/dist/src/pull-request-review.js +401 -0
  73. package/dist/src/pull-requests.d.ts +43 -2
  74. package/dist/src/pull-requests.js +112 -21
  75. package/dist/src/react-runtime.js +37 -4
  76. package/dist/src/remote/engine-pool.js +16 -4
  77. package/dist/src/run-control.d.ts +10 -0
  78. package/dist/src/run-control.js +24 -0
  79. package/dist/src/run-progress.d.ts +10 -0
  80. package/dist/src/run-progress.js +122 -0
  81. package/dist/src/run-records.d.ts +2 -2
  82. package/dist/src/runtime.d.ts +5 -1
  83. package/dist/src/runtime.js +14 -2
  84. package/dist/src/subagent-run.js +1 -0
  85. package/dist/src/telemetry/capture-core.d.ts +17 -0
  86. package/dist/src/telemetry/capture-core.js +59 -1
  87. package/dist/src/telemetry/classify.d.ts +3 -1
  88. package/dist/src/telemetry/classify.js +37 -0
  89. package/dist/src/telemetry/emitter.d.ts +2 -0
  90. package/dist/src/telemetry/emitter.js +42 -5
  91. package/dist/src/telemetry/schema.d.ts +22 -0
  92. package/dist/src/telemetry/schema.js +68 -1
  93. package/dist/src/telemetry/surface.d.ts +1 -0
  94. package/dist/src/telemetry/uploader.d.ts +6 -1
  95. package/dist/src/telemetry/uploader.js +22 -3
  96. package/dist/src/terminal-ui.js +1 -1
  97. package/dist/src/transcript.js +8 -2
  98. package/dist/src/types.d.ts +7 -0
  99. package/dist/src/usage-analytics.js +18 -10
  100. package/package.json +1 -1
@@ -2,8 +2,8 @@ export const AUTH_DEPLOYMENT = {
2
2
  issuer: 'https://cognito-idp.us-east-2.amazonaws.com/us-east-2_RBw7LImHf',
3
3
  clientId: '5gsaecbpdqnt6a0mh6u6h46gag',
4
4
  domain: 'https://auth.andorracode.com',
5
- apiBaseUrl: 'https://g2jkeh2w1k.execute-api.us-east-2.amazonaws.com/v1',
6
- telemetryBaseUrl: 'https://98m5jdbcf0.execute-api.us-east-2.amazonaws.com/v1',
5
+ apiBaseUrl: 'https://api.andorracode.com/v1',
6
+ telemetryBaseUrl: 'https://api.andorracode.com/telemetry/v1',
7
7
  inferenceBaseUrl: 'https://inference.andorracode.com',
8
8
  redirectUri: 'http://localhost:43187/callback',
9
9
  };
@@ -253,6 +253,7 @@ export async function runBrowserTask(session, task, control, options = {}) {
253
253
  status: result.status, ...(result.reason === undefined ? {} : { reason: result.reason }),
254
254
  ...(result.providerRequestFailed ? { providerRequestFailed: true } : {}),
255
255
  ...(result.providerOverflow ? { providerOverflow: true } : {}),
256
+ ...(result.failureCode === undefined ? {} : { errorCode: result.failureCode }),
256
257
  ...(result.telemetry !== undefined || probeModels.size > 0 ? { telemetry: finishedTelemetry } : {}),
257
258
  toolCalls: result.toolCalls,
258
259
  });
@@ -72,9 +72,9 @@ textarea{resize:none;line-height:var(--leading-sm)}
72
72
  .mark{width:16px;height:16px;flex:none;display:inline-grid;place-items:center}
73
73
  .mark::before{content:'';display:block;box-sizing:border-box;border-radius:var(--radius-full)}
74
74
  .mark.running::before{width:12px;height:12px;border:1.5px solid var(--border-strong);border-top-color:var(--text-2);animation:spin var(--loop-spin) linear infinite}
75
- .mark.waiting::before{width:8px;height:8px;background:var(--text)}
76
- .mark.failed::before{width:8px;height:8px;background:var(--err)}
77
- .mark.stopped::before{width:8px;height:8px;border:1.5px solid var(--text-3)}
75
+ .mark.waiting::before{width:6px;height:6px;background:var(--status-waiting)}
76
+ .mark.failed::before{width:6px;height:6px;background:var(--err)}
77
+ .mark.stopped::before{content:none}
78
78
  .mark.unread::before{width:6px;height:6px;background:var(--text-3)}
79
79
  @keyframes spin{to{transform:rotate(360deg)}}
80
80
  .empty-projects{padding:var(--space-2) var(--space-3);color:var(--text-3);font-size:var(--type-xs);line-height:var(--leading-xs)}
@@ -1,10 +1,12 @@
1
1
  :root {
2
- --rail-width: 232px;
3
- --rail-task-indent: 28px;
4
- --chrome-height: 36px;
2
+ --rail-width: 252px;
3
+ --rail-task-indent: 12px;
4
+ --chrome-height: 44px;
5
5
  --reading-measure: 792px;
6
6
  --settings-measure: 880px;
7
- --row-height: 28px;
7
+ --group-radius: 10px;
8
+ --settings-page-measure: 680px;
9
+ --row-height: 30px;
8
10
  --row-radius: 6px;
9
11
  --control-height: 28px;
10
12
  --btn-height: 32px;
@@ -21,17 +23,17 @@
21
23
  --type-section: 15px;
22
24
  --type-hint: 12px;
23
25
  --type-h1: 17px;
24
- --weight-regular: 400; --weight-strong: 500;
26
+ --weight-regular: 400; --weight-strong: 500; --weight-title: 600;
25
27
  --leading-xs: 16px; --leading-sm: 18px; --leading-md: 20px; --leading-prose: 22px; --leading-lg: 24px;
26
28
  --leading-code: 18px;
27
29
  --tracking-sm: -0.08px; --tracking-title: -0.01em; --tracking-code: .06em;
28
30
  --type-prose: 14px; --weight-prose: 400; --weight-prose-strong: 600; --weight-prose-bold: 500;
29
- --text-prose: color-mix(in srgb, var(--text) 80%, var(--bg-surface));
31
+ --text-prose: var(--text);
30
32
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;
31
33
  --input-height: 32px;
32
34
  --input-radius: 8px;
33
35
 
34
- --bg-rail: #101010; --bg-app: #141414; --bg-surface: #191919; --bg-input: #1f1f1f;
36
+ --bg-rail: #181818; --bg-app: #141414; --bg-surface: #141414; --bg-input: #212121;
35
37
  --text: #f5f5f5; --text-2: rgba(245,245,245,.74); --text-3: rgba(245,245,245,.60); --shimmer-dim: 40%;
36
38
  --text-disabled: rgba(245,245,245,.36);
37
39
  --border: rgba(245,245,245,.08); --border-strong: rgba(245,245,245,.12);
@@ -39,16 +41,20 @@
39
41
  --bg-control: rgba(245,245,245,.08); --bg-control-hover: rgba(245,245,245,.14);
40
42
  --bg-raised: rgba(245,245,245,.16);
41
43
  --bg-card-solid: color-mix(in srgb, var(--text) 6%, var(--bg-surface));
42
- --switch-off: var(--text-disabled);
43
- --hover: color-mix(in srgb, var(--text) 7%, transparent);
44
- --selected: color-mix(in srgb, var(--text) 12%, transparent);
44
+ --bg-group: color-mix(in srgb, var(--text) 4%, var(--bg-surface));
45
+ --bg-bubble: var(--bg-input);
46
+ --switch-off: color-mix(in srgb, var(--text) 18%, transparent); --switch-on: #3fa266; --switch-knob: #ffffff;
47
+ --hover: color-mix(in srgb, var(--text) 5%, transparent);
48
+ --selected: color-mix(in srgb, var(--text) 8%, transparent);
49
+ --pressed: color-mix(in srgb, var(--text) 10%, transparent);
45
50
  --bg-hover: var(--hover);
46
51
  --accent: #ececec; --accent-soft: rgba(245,245,245,.16); --on-accent: #141414;
47
52
  --accent-hover: #ffffff; --accent-ring: rgba(245,245,245,.36);
48
- --accent-fill: #1372da; --accent-fill-hover: #2a7fdd; --on-accent-fill: #f5f5f5;
53
+ --accent-fill: #1372da; --accent-fill-hover: #2a7fdd; --accent-fill-pressed: #0f63c2; --on-accent-fill: #f5f5f5;
49
54
  --accent-text: #71aeff; --focus: #1f87fc;
55
+ --status-waiting: #518cce;
50
56
  --ok: #2f9e6a; --err: #e5484d; --warn: #c9c9c9; --caution: #d9a520; --caution-text: #f2c94c;
51
- --ok-text: #7cc79a; --err-text: #f47174; --warn-text: #ececec; --merged-text: #bba4f2; --draft-text: #f0a35e;
57
+ --ok-text: #7cc79a; --err-text: #f47174; --warn-text: #ececec; --merged-text: #bba4f2;
52
58
  --skill: #aab8ff; --skill-wash: rgba(120,140,255,.18);
53
59
  --ok-wash: rgba(47,158,106,.14); --err-wash: rgba(229,72,77,.14); --merged-wash: rgba(142,110,224,.14);
54
60
  --add-wash: rgba(47,158,106,.16); --del-wash: rgba(229,72,77,.16);
@@ -78,6 +84,7 @@
78
84
  --pop-distance: 4px; --pop-scale: .98;
79
85
  --loop-spin: 1s; --loop-shimmer: 1.8s; --loop-breathe: 2.4s;
80
86
  --delay-hover-intent: 150ms;
87
+ --delay-startup-status: 800ms;
81
88
 
82
89
  color-scheme: dark;
83
90
  }
@@ -85,17 +92,21 @@
85
92
  :root[data-theme="light"] {
86
93
  --bg-rail: #f5f5f5; --bg-app: #ffffff; --bg-surface: #ffffff; --bg-input: #ffffff;
87
94
  --text: #1c1c1c; --text-2: rgba(28,28,28,.74); --text-3: rgba(28,28,28,.66); --shimmer-dim: 34%; --text-disabled: rgba(28,28,28,.36);
88
- --border: rgba(28,28,28,.08); --border-strong: rgba(28,28,28,.12);
95
+ --border: rgba(28,28,28,.10); --border-strong: rgba(28,28,28,.14);
89
96
  --bg-card: rgba(28,28,28,.06);
90
97
  --bg-control: rgba(28,28,28,.08); --bg-control-hover: rgba(28,28,28,.14);
91
98
  --bg-raised: #ffffff;
92
- --switch-off: color-mix(in srgb, var(--text) 50%, transparent);
99
+ --switch-off: color-mix(in srgb, var(--text) 50%, transparent); --switch-on: #2f9e6a;
100
+ --bg-group: rgba(28,28,28,.035); --bg-bubble: #f5f5f5;
101
+ --hover: color-mix(in srgb, var(--text) 6%, transparent); --selected: color-mix(in srgb, var(--text) 10%, transparent);
102
+ --pressed: color-mix(in srgb, var(--text) 13%, transparent);
93
103
  --accent: #1c1c1c; --accent-soft: rgba(28,28,28,.16); --on-accent: #ffffff;
94
104
  --accent-hover: #333333; --accent-ring: rgba(28,28,28,.48);
95
- --accent-fill: #1680f3; --accent-fill-hover: #1776dd; --on-accent-fill: #ffffff;
105
+ --accent-fill: #1680f3; --accent-fill-hover: #1776dd; --accent-fill-pressed: #1468c8; --on-accent-fill: #ffffff;
96
106
  --accent-text: #0b6dd3; --focus: #1680f3;
107
+ --status-waiting: #2f6fbd;
97
108
  --ok: #3d7a5c; --err: #d13438; --warn: #45464b; --caution: #b8860b; --caution-text: #8a6100;
98
- --ok-text: #36704f; --err-text: #c4262e; --warn-text: #1c1c1c; --merged-text: #6a4fc4; --draft-text: #b35a0e;
109
+ --ok-text: #36704f; --err-text: #c4262e; --warn-text: #1c1c1c; --merged-text: #6a4fc4;
99
110
  --skill: #3b4fc4; --skill-wash: rgba(59,79,196,.10);
100
111
  --ok-wash: rgba(61,122,92,.08); --err-wash: rgba(209,52,56,.08); --merged-wash: rgba(106,79,196,.08);
101
112
  --add-wash: rgba(61,122,92,.14); --del-wash: rgba(209,52,56,.13);
@@ -183,6 +183,8 @@ export async function readClaudeCatalog(signal, dependencies = {}) {
183
183
  }
184
184
  class MalformedClaudeStep extends Error {
185
185
  unparsedReply;
186
+ /** Record-only telemetry code; the error keeps its class so whole-agent retries behave as before. */
187
+ telemetryCode = 'malformed_response';
186
188
  constructor(message, unparsedReply) {
187
189
  super(message);
188
190
  this.unparsedReply = unparsedReply;
@@ -628,7 +630,7 @@ export function createClaudeAdapter(_config, dependencies = {}) {
628
630
  catch (error) {
629
631
  if (!(error instanceof MalformedClaudeStep) || attempt >= STEP_ATTEMPTS)
630
632
  throw error;
631
- await request.onRetry?.({ retry: attempt, maxRetries: STEP_ATTEMPTS - 1, delayMs: 0, reason: `${error.message}. Asking again.`, quiet: true,
633
+ await request.onRetry?.({ retry: attempt, maxRetries: STEP_ATTEMPTS - 1, delayMs: 0, reason: `${error.message}. Asking again.`, quiet: true, code: 'malformed_response',
632
634
  ...(error.unparsedReply === undefined ? {} : { unparsedReply: error.unparsedReply }) });
633
635
  input = compose(retryNote(error.message));
634
636
  }
package/dist/src/cli.js CHANGED
@@ -14,7 +14,7 @@ import { homedir } from 'node:os';
14
14
  import { workspacePermissionKey, permissionLabel } from './permissions.js';
15
15
  import { configDirectory, loadConfig, resolveCodeIntelConfig, resolveConfiguredLimits, saveConfig } from './config.js';
16
16
  import { andorraRefusal, compactHistory, compactedContextEstimate, executeCommand, HELP } from './commands.js';
17
- import { applyModelContextWindow, createAdapter, modelDisplayName, modelIdForDisplayName, providerModelNames, providerSecrets, recordProviderModel } from './providers.js';
17
+ import { applyModelContextWindow, createAdapter, findProviderById, providerModelId, modelDisplayName, modelIdForDisplayName, providerModelNames, providerSecrets, recordProviderModel } from './providers.js';
18
18
  import { disposeAllQaProcesses, disposeAllQaPtys, getQaPtyManager } from './qa/index.js';
19
19
  import { disposePooledPowerShell } from './powershell-pool.js';
20
20
  import { loadWorkspaceInstructions, systemPromptOverrideFor } from './workspace-instructions.js';
@@ -476,20 +476,23 @@ export async function main(argv = process.argv.slice(2), dependencies = {}) {
476
476
  await startupReject('No providers configured. Run andorra, then /providers to add a provider before starting a task.');
477
477
  await startupGuard(async () => {
478
478
  if (values.provider) {
479
- if (!config.providers.some(p => p.id === values.provider))
479
+ const named = findProviderById(config.providers, values.provider);
480
+ if (!named)
480
481
  throw new Error(`Unknown provider: ${values.provider}`);
481
- config.provider = values.provider;
482
+ config.provider = named.id;
482
483
  }
483
484
  if (values.model) {
484
485
  const selected = config.providers.find(p => p.id === config.provider);
485
486
  if (!selected)
486
487
  throw new Error('Add a provider in /providers before choosing a model.');
487
- if (selected.model !== values.model) {
488
- applyModelContextWindow(selected, values.model);
488
+ // A model the provider already lists is used in its configured spelling, whatever case was typed.
489
+ const model = providerModelId(selected, values.model) ?? values.model;
490
+ if (selected.model !== model) {
491
+ applyModelContextWindow(selected, model);
489
492
  delete selected.reasoningEffort;
490
493
  }
491
- recordProviderModel(selected, values.model);
492
- selected.model = values.model;
494
+ recordProviderModel(selected, model);
495
+ selected.model = model;
493
496
  }
494
497
  });
495
498
  bootMark('cli.config');
@@ -1031,6 +1034,7 @@ export async function main(argv = process.argv.slice(2), dependencies = {}) {
1031
1034
  status, reason,
1032
1035
  ...(result?.providerRequestFailed || healthProviderFailed ? { providerRequestFailed: true } : {}),
1033
1036
  ...(result?.providerOverflow ? { providerOverflow: true } : {}),
1037
+ ...(result?.failureCode === undefined ? {} : { errorCode: result.failureCode }),
1034
1038
  ...(result?.telemetry !== undefined || probeModels.size > 0 ? { telemetry: capture } : {}),
1035
1039
  ...(result ? { toolCalls: result.toolCalls } : {}),
1036
1040
  })).catch(() => { });
@@ -1192,9 +1196,19 @@ export async function main(argv = process.argv.slice(2), dependencies = {}) {
1192
1196
  print(`Attached ${target}. It rides your next steer.`);
1193
1197
  return true;
1194
1198
  }
1199
+ if (command === '/compact' && text.trim() === '/compact') {
1200
+ void debugRecord('command.steer', { input: text });
1201
+ if (!runControl) {
1202
+ print('/compact is unavailable during this run.');
1203
+ return true;
1204
+ }
1205
+ runControl.requestCompaction();
1206
+ print('Compacting the run’s context, then continuing it.');
1207
+ return true;
1208
+ }
1195
1209
  if (!['/model', '/browser', '/yolo', '/permissions', '/jev', '/help', '/status', '/usage', '/tools'].includes(command)) {
1196
1210
  void debugRecord('command.steer', { input: text });
1197
- print(`${command} is unavailable during a run. Use /model, /permissions <mode>, /yolo on|off, /jev on|off, /status, /usage, /help, or /exit.`);
1211
+ print(`${command} is unavailable during a run. Use /model, /permissions <mode>, /yolo on|off, /jev on|off, /compact, /status, /usage, /help, or /exit.`);
1198
1212
  return true;
1199
1213
  }
1200
1214
  const commandStartedAt = Date.now();
@@ -37,9 +37,12 @@ export function codexTurnFailure(error) {
37
37
  }
38
38
  }
39
39
  const http = typeof status === 'number' && Number.isInteger(status) && status >= 100 && status <= 599 ? `; HTTP ${status}` : '';
40
- return new ProviderRequestError(category
40
+ const failure = new ProviderRequestError(category
41
41
  ? `Codex inference failed (${category}${http}): ${descriptions[category]}.`
42
42
  : 'Codex inference failed', category === 'contextWindowExceeded');
43
+ if (http)
44
+ failure.telemetryCode = `http_${status}`;
45
+ return failure;
43
46
  }
44
47
  export function codexRequestFailure(error) {
45
48
  const code = record(error) ? error.code : undefined;
@@ -9,7 +9,7 @@ import { DEFAULT_GRAPH, listGraphs, withoutDeletedGraphs } from './graphs.js';
9
9
  import { graphStorageDirectory } from './graph-account.js';
10
10
  import { configuredGraphSelection, currentGraphSubject, saveGraphSelection } from './graph-selection.js';
11
11
  import { getMembership, loadAccessibleGraph, requireGraphMembership } from './membership.js';
12
- import { FREE_CUSTOM_GRAPH_LIMIT, FREE_GRAPH_LIMIT_MESSAGE, readGraphQuota } from './graph-quota.js';
12
+ import { FREE_GRAPH_LIMIT_MESSAGE, freeTierGraphViolation, readGraphQuota } from './graph-quota.js';
13
13
  import { GraphProviderUnavailableError } from './graph-provider-portability.js';
14
14
  import { confirmAndApplyModelOverride } from './model-override.js';
15
15
  import { andorraRefusal } from './commands.js';
@@ -317,12 +317,14 @@ export async function runCommandScreen(line, state, ui, persist, signal, adapter
317
317
  return unchanged;
318
318
  const access = await graphAccess.membership?.(signal);
319
319
  const free = access !== undefined && !access.paid && !access.unavailable && access.subject !== undefined;
320
- const atLimit = free && (await readGraphQuota(directory, saved)).customGraphs >= FREE_CUSTOM_GRAPH_LIMIT;
320
+ const kept = free ? (await readGraphQuota(directory, saved, { adopt: true })).freeGraphId : undefined;
321
+ const atLimit = free && kept !== undefined;
322
+ const viewOnly = (graph) => free && (graph.id !== kept || freeTierGraphViolation(graph) !== undefined);
321
323
  const items = [{
322
324
  id: DEFAULT_GRAPH.id,
323
325
  label: 'Default',
324
326
  description: 'Andorra Agent only. Reads project instructions and completes the task without an Orchestrator.',
325
- }, ...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' }];
327
+ }, ...withoutDeletedGraphs(saved).filter(graph => graph.id !== 'default').map(graph => ({ id: graph.id, label: `${graph.name} (${graph.id}@${graph.revision})`, description: viewOnly(graph) ? 'View only on the free tier. Duplicate it in the Graph Editor to change it.' : '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' }];
326
328
  while (!signal.aborted) {
327
329
  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 });
328
330
  if (selected === undefined || signal.aborted)
@@ -60,7 +60,8 @@ export interface ConversationTurn {
60
60
  subagentId?: string;
61
61
  }[];
62
62
  }
63
- export type TurnWake = 'timer' | 'auto-fix';
63
+ /** Why a turn started without the person typing it: a timer the agent set, Auto-fix, or the PR tab's Fix with Agent. */
64
+ export type TurnWake = 'timer' | 'auto-fix' | 'fix-checks';
64
65
  export declare function compactHistory(turns: ConversationTurn[]): ConversationTurn[];
65
66
  export declare function compactedContextEstimate(turns: ConversationTurn[]): number;
66
67
  export declare function subagentClearRequested(line: string, providers: {
@@ -0,0 +1,4 @@
1
+ export declare const COMPACTION_DEFAULT_TEXT = "Summarizing earlier work to free context.";
2
+ export declare const COMPACTION_PHRASES: readonly string[];
3
+ export declare function pickCompactionPhrase(random?: () => number): string;
4
+ export declare function compactionText(text: unknown): string;
@@ -0,0 +1,20 @@
1
+ // What the transcript says while earlier work is summarized to free context. The engine picks one per
2
+ // compaction batch and carries it on `agent.context.compaction.started` as `text`, so the CLI and the
3
+ // desktop show the same line; the plain description stays available as the default.
4
+ export const COMPACTION_DEFAULT_TEXT = 'Summarizing earlier work to free context.';
5
+ export const COMPACTION_PHRASES = [
6
+ 'Vacuum-sealing the conversation',
7
+ 'Writing the CliffsNotes of this chat',
8
+ 'Stuffing memories into a carry-on',
9
+ 'Shrink-wrapping the context',
10
+ 'Condensing the chat like canned soup',
11
+ 'Turning the scroll into a sticky note',
12
+ ];
13
+ export function pickCompactionPhrase(random = Math.random) {
14
+ const index = Math.floor(random() * COMPACTION_PHRASES.length);
15
+ return COMPACTION_PHRASES[Math.min(Math.max(index, 0), COMPACTION_PHRASES.length - 1)] ?? COMPACTION_DEFAULT_TEXT;
16
+ }
17
+ // Only a phrase from the list is shown, with an ellipsis; anything else falls back to the default line.
18
+ export function compactionText(text) {
19
+ return typeof text === 'string' && COMPACTION_PHRASES.includes(text) ? `${text}…` : COMPACTION_DEFAULT_TEXT;
20
+ }
@@ -2,6 +2,7 @@ import { engineModel } from './engine/protocol.js';
2
2
  import { generateWithUsage } from './runtime.js';
3
3
  import { selectCompactGroups } from '../vendor/zcode/source/compact/selection.js';
4
4
  import { serializeContext } from './context-budget.js';
5
+ import { pickCompactionPhrase } from './compaction-phrases.js';
5
6
  export const EFFICIENT_CONTEXT_POLICY = { triggerChars: 128_000, targetChars: 64_000, keepRecentToolTurns: 8, protectDiscovery: true };
6
7
  function completeExchanges(messages) {
7
8
  const exchanges = [];
@@ -248,7 +249,7 @@ export class HistoryCompactor {
248
249
  let batchTarget = targetChars;
249
250
  let batchMaxTokens = maxTokens;
250
251
  await options.onEvent?.({ type: 'agent.context.compaction.started', time: new Date().toISOString(), data: {
251
- runId: result.id, nodeId: options.nodeId ?? 'engineer', ...(options.subagentId ? { subagentId: options.subagentId } : {}), maxTokens: batchMaxTokens, batch: batchNumber,
252
+ runId: result.id, nodeId: options.nodeId ?? 'engineer', ...(options.subagentId ? { subagentId: options.subagentId } : {}), maxTokens: batchMaxTokens, batch: batchNumber, text: pickCompactionPhrase(),
252
253
  } });
253
254
  for (let attempt = 1; attempt <= maxAttempts; attempt++) {
254
255
  signal.throwIfAborted();
@@ -10,6 +10,7 @@ import { HOSTED_SKILL_LIMIT, hostedSkillLimitNotice, rankHostedSkills } from './
10
10
  import { markFactGuidance } from './guidancePolicy.js';
11
11
  import { actionablePreflightQuestion, answerOnlyTask } from './optimizationPolicy.js';
12
12
  import { parseToolRouteEvidence } from './routeTools.js';
13
+ import { pickJevRequestPhrase } from './requestPhrases.js';
13
14
  const FACT_TIMEOUT_MS = 2000;
14
15
  const families = new Set(['filesystem-read', 'filesystem-write', 'code-search', 'codegraph', 'git', 'shell', 'memory', 'web', 'browser', 'subagents', 'artifact']);
15
16
  export const toolFamilyQuestion = (family) => `tool_family_${family.replace(/-/g, '_')}`;
@@ -173,7 +174,7 @@ export class DecisionManager {
173
174
  };
174
175
  const evaluateFact = this.provider.evaluateFact?.bind(this.provider);
175
176
  if (!evaluateFact) {
176
- emit('decision.requested', { questions: [request.id] });
177
+ emit('decision.requested', { questions: [request.id], text: pickJevRequestPhrase() });
177
178
  emit('decision.fallback', { reason: 'provider_unavailable' });
178
179
  return undefined;
179
180
  }
@@ -229,7 +230,7 @@ export class DecisionManager {
229
230
  return this.settle(questions.map(q => q.id), (controllerSignal, deadlineAt) => this.provider.evaluate(structuredClone(snapshot), structuredClone(questions), controllerSignal, this.observer(emit), { deadlineAt }), value => validateBatch(value, questions), batch => Object.fromEntries(Object.entries(batch).map(([id, r]) => [id, r.type === 'noul' ? { probability: r.probability } : r.type === 'score' ? { score: r.score, confidence: r.confidence } : { ...(id === 'verification_tier' ? { choice: r.choice } : {}), confidence: r.confidence, selected: r.probabilities[r.choice] ?? 0 }])), signal, emit, this.config.requestTimeoutMs ?? DECISION_DEFAULTS.requestTimeoutMs);
230
231
  }
231
232
  async settle(questionIds, evaluate, validate, describe, signal, emit, timeoutMs) {
232
- emit('decision.requested', { questions: questionIds });
233
+ emit('decision.requested', { questions: questionIds, text: pickJevRequestPhrase() });
233
234
  if (this.config.mode === 'active' && !this.active) {
234
235
  emit('decision.fallback', { reason: 'active_unsupported' });
235
236
  return undefined;
@@ -0,0 +1,4 @@
1
+ export declare const JEV_DEFAULT_REQUEST_PHRASE = "Evaluating context needs";
2
+ export declare const JEV_REQUEST_PHRASES: readonly string[];
3
+ export declare function pickJevRequestPhrase(random?: () => number): string;
4
+ export declare function jevRequestPhrase(text: unknown): string;
@@ -0,0 +1,23 @@
1
+ // What the transcript says while a Jev request is in flight. The engine picks one per request and
2
+ // carries it on `decision.requested` as `text`, so the CLI and the desktop show the same line.
3
+ export const JEV_DEFAULT_REQUEST_PHRASE = 'Evaluating context needs';
4
+ export const JEV_REQUEST_PHRASES = [
5
+ 'Asking the tokens to carpool',
6
+ 'Clipping coupons for your context',
7
+ 'Checking which tokens spark joy',
8
+ 'Haggling with the token meter',
9
+ 'Teaching the prompt to travel light',
10
+ 'Bargain-hunting for bytes',
11
+ 'Squeezing the context like a toothpaste tube',
12
+ "Shrinking the bill before it's printed",
13
+ 'Leaving the extra tokens at home',
14
+ 'Sending unnecessary tokens home',
15
+ ];
16
+ export function pickJevRequestPhrase(random = Math.random) {
17
+ const index = Math.floor(random() * JEV_REQUEST_PHRASES.length);
18
+ return JEV_REQUEST_PHRASES[Math.min(Math.max(index, 0), JEV_REQUEST_PHRASES.length - 1)] ?? JEV_DEFAULT_REQUEST_PHRASE;
19
+ }
20
+ // Only a phrase from the list is shown; anything else on the event falls back to the default line.
21
+ export function jevRequestPhrase(text) {
22
+ return typeof text === 'string' && JEV_REQUEST_PHRASES.includes(text) ? text : JEV_DEFAULT_REQUEST_PHRASE;
23
+ }
@@ -0,0 +1,55 @@
1
+ import { type GhRunner } from './pull-requests.js';
2
+ export interface ReviewRequest {
3
+ url: string;
4
+ owner: string;
5
+ repo: string;
6
+ number: number;
7
+ title: string;
8
+ author: string;
9
+ draft: boolean;
10
+ createdAt?: string;
11
+ updatedAt?: string;
12
+ headRefName?: string;
13
+ /** The signed-in accounts asked to review it (directly or through a team). */
14
+ accounts: string[];
15
+ }
16
+ export interface RepositoryIssue {
17
+ url: string;
18
+ number: number;
19
+ title: string;
20
+ author: string;
21
+ updatedAt?: string;
22
+ labels: {
23
+ name: string;
24
+ color?: string;
25
+ }[];
26
+ assignees: string[];
27
+ comments: number;
28
+ /** Assigned to the account that read it. */
29
+ mine: boolean;
30
+ }
31
+ /** How many review requests one account's search reads; GitHub's search answers at most 100 a page. */
32
+ export declare const REVIEW_REQUESTS_READ = 50;
33
+ export declare function parseReviewRequests(raw: unknown, account: string): ReviewRequest[];
34
+ /**
35
+ * Every open pull request that asks one of gh's signed-in accounts to review it, newest activity first;
36
+ * one asked of two accounts is listed once, naming both. An account that cannot search is skipped, so one
37
+ * signed-out account does not hide the others' requests; when every account fails, the first error is thrown.
38
+ */
39
+ export declare function readReviewRequests(gh: GhRunner): Promise<{
40
+ requests: ReviewRequest[];
41
+ accounts: string[];
42
+ }>;
43
+ export declare function parseIssues(raw: unknown): {
44
+ viewer?: string;
45
+ enabled: boolean;
46
+ issues: RepositoryIssue[];
47
+ };
48
+ /** A repository's open issues, read as the first signed-in account that can read it. */
49
+ export declare function readRepositoryIssues(gh: GhRunner, owner: string, repo: string): Promise<{
50
+ viewer?: string;
51
+ enabled: boolean;
52
+ issues: RepositoryIssue[];
53
+ }>;
54
+ /** The issue of `owner/repo` that a task's first prompt names by its link, if one. */
55
+ export declare function issueNamedIn(prompt: string | undefined, owner: string, repo: string): number | undefined;
@@ -0,0 +1,153 @@
1
+ import { ghAccounts, isGhAccessError, isGhListingUnsupported } from './pull-requests.js';
2
+ const text = (value) => typeof value === 'string' && value !== '' ? value : undefined;
3
+ const record = (value) => typeof value === 'object' && value !== null && !Array.isArray(value) ? value : {};
4
+ const list = (value) => Array.isArray(value) ? value : [];
5
+ const loginOf = (value) => text(record(value).login)?.replace(/^app\//, '');
6
+ function graphqlErrors(value) {
7
+ const errors = list(value.errors).map(entry => text(record(entry).message)).filter((message) => message !== undefined);
8
+ if (errors.length > 0)
9
+ throw new Error(`GraphQL: ${errors.join('; ')}`);
10
+ }
11
+ const SEARCH_QUERY = 'query($q: String!) { viewer { login } search(query: $q, type: ISSUE, first: 50) { issueCount nodes { ... on PullRequest { number title url isDraft createdAt updatedAt headRefName author { login } repository { name owner { login } } } } } }';
12
+ /** How many review requests one account's search reads; GitHub's search answers at most 100 a page. */
13
+ export const REVIEW_REQUESTS_READ = 50;
14
+ export function parseReviewRequests(raw, account) {
15
+ return list(record(record(record(raw).data).search).nodes).map(record).flatMap((node) => {
16
+ const url = text(node.url);
17
+ const number = typeof node.number === 'number' && Number.isSafeInteger(node.number) ? node.number : undefined;
18
+ const repository = record(node.repository);
19
+ const owner = loginOf(repository.owner);
20
+ const repo = text(repository.name);
21
+ if (url === undefined || number === undefined || owner === undefined || repo === undefined || !/^https:\/\/github\.com\//.test(url))
22
+ return [];
23
+ return [{
24
+ url, owner, repo, number, title: text(node.title) ?? `#${number}`, author: loginOf(node.author) ?? 'ghost', draft: node.isDraft === true,
25
+ ...defined({ createdAt: text(node.createdAt), updatedAt: text(node.updatedAt), headRefName: text(node.headRefName) }),
26
+ accounts: [account],
27
+ }];
28
+ });
29
+ }
30
+ /**
31
+ * Every open pull request that asks one of gh's signed-in accounts to review it, newest activity first;
32
+ * one asked of two accounts is listed once, naming both. An account that cannot search is skipped, so one
33
+ * signed-out account does not hide the others' requests; when every account fails, the first error is thrown.
34
+ */
35
+ export async function readReviewRequests(gh) {
36
+ let accounts;
37
+ try {
38
+ accounts = await ghAccounts(gh);
39
+ }
40
+ catch (error) {
41
+ if (!isGhListingUnsupported(error))
42
+ throw error;
43
+ accounts = [];
44
+ }
45
+ const asked = accounts.length > 0 ? accounts.map(user => ({ user, login: user })) : [{}];
46
+ const byUrl = new Map();
47
+ const read = [];
48
+ let firstError;
49
+ for (const entry of asked) {
50
+ try {
51
+ const run = entry.user === undefined ? gh : (args, options) => gh(args, { ...options, user: entry.user });
52
+ const raw = JSON.parse(await run(['api', 'graphql', '--hostname', 'github.com', '-f', `query=${SEARCH_QUERY}`, '-f', `q=is:pr is:open archived:false review-requested:${entry.login ?? '@me'} sort:updated-desc`]));
53
+ graphqlErrors(raw);
54
+ const login = entry.login ?? loginOf(record(record(raw.data).viewer)) ?? 'you';
55
+ read.push(login);
56
+ for (const request of parseReviewRequests(raw, login)) {
57
+ const held = byUrl.get(request.url);
58
+ if (held) {
59
+ if (!held.accounts.includes(login))
60
+ held.accounts.push(login);
61
+ }
62
+ else
63
+ byUrl.set(request.url, request);
64
+ }
65
+ }
66
+ catch (error) {
67
+ firstError ??= error;
68
+ }
69
+ }
70
+ if (read.length === 0 && firstError !== undefined)
71
+ throw firstError;
72
+ const stamp = (request) => Date.parse(request.updatedAt ?? request.createdAt ?? '') || 0;
73
+ return { requests: [...byUrl.values()].sort((a, b) => stamp(b) - stamp(a)), accounts: read };
74
+ }
75
+ const ISSUES_QUERY = 'query($owner: String!, $name: String!) { viewer { login } repository(owner: $owner, name: $name) { hasIssuesEnabled issues(states: OPEN, first: 50, orderBy: { field: UPDATED_AT, direction: DESC }) { nodes { number title url updatedAt author { login } labels(first: 5) { nodes { name color } } assignees(first: 5) { nodes { login } } comments { totalCount } } } } }';
76
+ export function parseIssues(raw) {
77
+ const data = record(record(raw).data);
78
+ const viewer = loginOf(data.viewer);
79
+ const repository = record(data.repository);
80
+ const issues = list(record(repository.issues).nodes).map(record).flatMap((node) => {
81
+ const url = text(node.url);
82
+ const number = typeof node.number === 'number' && Number.isSafeInteger(node.number) ? node.number : undefined;
83
+ if (url === undefined || number === undefined)
84
+ return [];
85
+ const assignees = list(record(node.assignees).nodes).map(loginOf).filter((login) => login !== undefined);
86
+ const count = record(node.comments).totalCount;
87
+ return [{
88
+ url, number, title: text(node.title) ?? `#${number}`, author: loginOf(node.author) ?? 'ghost',
89
+ ...defined({ updatedAt: text(node.updatedAt) }),
90
+ labels: list(record(node.labels).nodes).map(record).flatMap(label => {
91
+ const name = text(label.name);
92
+ const color = text(label.color);
93
+ return name === undefined ? [] : [{ name, ...(color !== undefined && /^[0-9a-f]{6}$/i.test(color) ? { color: color.toLowerCase() } : {}) }];
94
+ }),
95
+ assignees,
96
+ comments: typeof count === 'number' && Number.isSafeInteger(count) && count > 0 ? count : 0,
97
+ mine: viewer !== undefined && assignees.some(login => login.toLowerCase() === viewer.toLowerCase()),
98
+ }];
99
+ });
100
+ // Issues assigned to the reader first, then the rest, each by latest activity as GitHub sent them.
101
+ return { ...defined({ viewer }), enabled: repository.hasIssuesEnabled !== false, issues: [...issues.filter(issue => issue.mine), ...issues.filter(issue => !issue.mine)] };
102
+ }
103
+ /** A repository's open issues, read as the first signed-in account that can read it. */
104
+ export async function readRepositoryIssues(gh, owner, repo) {
105
+ let accounts;
106
+ try {
107
+ accounts = await ghAccounts(gh);
108
+ }
109
+ catch (error) {
110
+ if (!isGhListingUnsupported(error))
111
+ throw error;
112
+ accounts = [];
113
+ }
114
+ const read = async (user) => {
115
+ const run = user === undefined ? gh : (args, options) => gh(args, { ...options, user });
116
+ const raw = JSON.parse(await run(['api', 'graphql', '--hostname', 'github.com', '-f', `query=${ISSUES_QUERY}`, '-f', `owner=${owner}`, '-f', `name=${repo}`]));
117
+ graphqlErrors(raw);
118
+ const found = record(raw.data).repository;
119
+ if (found === null || found === undefined)
120
+ throw new Error(`GraphQL: Could not resolve to a Repository with the name '${owner}/${repo}'.`);
121
+ return parseIssues(raw);
122
+ };
123
+ if (accounts.length === 0)
124
+ return read(undefined);
125
+ let firstError;
126
+ for (const user of accounts) {
127
+ try {
128
+ return await read(user);
129
+ }
130
+ catch (error) {
131
+ if (!isGhAccessError(error))
132
+ throw error;
133
+ firstError ??= error;
134
+ }
135
+ }
136
+ throw firstError;
137
+ }
138
+ /** The issue of `owner/repo` that a task's first prompt names by its link, if one. */
139
+ export function issueNamedIn(prompt, owner, repo) {
140
+ if (prompt === undefined)
141
+ return undefined;
142
+ const pattern = new RegExp(`https://github\\.com/${owner.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}/${repo.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}/issues/(\\d+)\\b`, 'i');
143
+ const match = pattern.exec(prompt);
144
+ const number = match ? Number(match[1]) : undefined;
145
+ return number !== undefined && Number.isSafeInteger(number) && number > 0 ? number : undefined;
146
+ }
147
+ function defined(values) {
148
+ const kept = {};
149
+ for (const [key, value] of Object.entries(values))
150
+ if (value !== undefined)
151
+ kept[key] = value;
152
+ return kept;
153
+ }
@@ -1,4 +1,4 @@
1
- import { configuredContextWindow, createAdapter } from './providers.js';
1
+ import { configuredContextWindow, createAdapter, findProviderById, providerModelId } from './providers.js';
2
2
  import { ANDORRA_UNAVAILABLE_MESSAGE } from './andorra/endpoint.js';
3
3
  export function resumeModelNodes(graph, resume) {
4
4
  if (resume === undefined)
@@ -30,7 +30,11 @@ export function resumeModelNodes(graph, resume) {
30
30
  function graphModels(graph, config, session = {}, only) {
31
31
  const references = new Map();
32
32
  const sessionProvider = session.provider ?? config.provider;
33
- const resolve = (provider, model) => ({ provider, model: model ?? config.providers.find(p => p.id === provider)?.model ?? '(default model)' });
33
+ // Each probe names the model as the provider it is sent to spells it.
34
+ const resolve = (provider, model) => {
35
+ const local = findProviderById(config.providers, provider);
36
+ return { provider, model: model === undefined ? local?.model ?? '(default model)' : local ? providerModelId(local, model) ?? model : model };
37
+ };
34
38
  const inherited = (node) => node.provider === undefined
35
39
  ? resolve(sessionProvider, node.model ?? session.model)
36
40
  : resolve(node.provider, node.model);
@@ -106,7 +110,7 @@ export async function checkGraphModelHealth(graph, config, signal, dependencies
106
110
  if (overall?.signal.aborted)
107
111
  return;
108
112
  const index = next++, reference = references[index];
109
- const provider = config.providers.find(p => p.id === reference.provider);
113
+ const provider = findProviderById(config.providers, reference.provider);
110
114
  if (!provider) {
111
115
  failures[index] = { ...reference, reason: 'Provider is not configured.' };
112
116
  continue;