@andorra-labs/code 0.1.16 → 0.1.17

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 (188) hide show
  1. package/dist/src/acp-agent.d.ts +6 -0
  2. package/dist/src/acp-agent.js +15 -4
  3. package/dist/src/agent-execution.js +11 -8
  4. package/dist/src/agent-mcp-catalog.js +1 -0
  5. package/dist/src/agent-mcp.d.ts +3 -0
  6. package/dist/src/agent-mcp.js +33 -1
  7. package/dist/src/andorra/entry.d.ts +10 -0
  8. package/dist/src/andorra/entry.js +18 -4
  9. package/dist/src/andorra/hosted.d.ts +2 -1
  10. package/dist/src/andorra/hosted.js +2 -1
  11. package/dist/src/andorra/notices.d.ts +5 -0
  12. package/dist/src/andorra/notices.js +7 -0
  13. package/dist/src/andorra/state.d.ts +3 -2
  14. package/dist/src/andorra/state.js +4 -4
  15. package/dist/src/andorra/terminal.js +7 -2
  16. package/dist/src/anthropic-credentials.js +2 -0
  17. package/dist/src/app-server/error.d.ts +5 -0
  18. package/dist/src/app-server/error.js +7 -0
  19. package/dist/src/app-server/protocol.d.ts +19 -44
  20. package/dist/src/app-server/protocol.js +5 -1
  21. package/dist/src/app-server/workspace.d.ts +89 -0
  22. package/dist/src/app-server/workspace.js +457 -11
  23. package/dist/src/app-server.d.ts +358 -32
  24. package/dist/src/app-server.js +2429 -509
  25. package/dist/src/bridge/cloud.d.ts +27 -0
  26. package/dist/src/bridge/cloud.js +187 -0
  27. package/dist/src/bridge/command.d.ts +30 -0
  28. package/dist/src/bridge/command.js +347 -0
  29. package/dist/src/bridge/control.d.ts +68 -0
  30. package/dist/src/bridge/control.js +233 -0
  31. package/dist/src/bridge/engines.d.ts +90 -0
  32. package/dist/src/bridge/engines.js +601 -0
  33. package/dist/src/bridge/host-ops.d.ts +9 -0
  34. package/dist/src/bridge/host-ops.js +129 -0
  35. package/dist/src/bridge/host.d.ts +47 -0
  36. package/dist/src/bridge/host.js +540 -0
  37. package/dist/src/bridge/link.d.ts +38 -0
  38. package/dist/src/bridge/link.js +508 -0
  39. package/dist/src/bridge/login-link.d.ts +29 -0
  40. package/dist/src/bridge/login-link.js +54 -0
  41. package/dist/src/bridge/protocol.d.ts +136 -0
  42. package/dist/src/bridge/protocol.js +11 -0
  43. package/dist/src/bridge/store.d.ts +12 -0
  44. package/dist/src/bridge/store.js +61 -0
  45. package/dist/src/bridge/wording.d.ts +6 -0
  46. package/dist/src/bridge/wording.js +10 -0
  47. package/dist/src/browser-server.js +7 -1
  48. package/dist/src/browser-ui/tokens.css +1 -1
  49. package/dist/src/change-authors.d.ts +41 -0
  50. package/dist/src/change-authors.js +146 -0
  51. package/dist/src/cli.js +182 -32
  52. package/dist/src/coding-tools.js +15 -15
  53. package/dist/src/command-screens.d.ts +6 -0
  54. package/dist/src/command-screens.js +14 -11
  55. package/dist/src/commands.d.ts +14 -2
  56. package/dist/src/compaction-phrases.js +1 -1
  57. package/dist/src/completion.js +82 -5
  58. package/dist/src/config.d.ts +71 -3
  59. package/dist/src/config.js +202 -77
  60. package/dist/src/deadline.js +13 -1
  61. package/dist/src/decision/checks.js +1 -1
  62. package/dist/src/decision/requestPhrases.js +0 -1
  63. package/dist/src/default-graph.js +1 -1
  64. package/dist/src/file-diff.d.ts +4 -0
  65. package/dist/src/file-diff.js +2 -1
  66. package/dist/src/github-app/agent-writes.d.ts +102 -0
  67. package/dist/src/github-app/agent-writes.js +320 -0
  68. package/dist/src/github-app/client.d.ts +349 -0
  69. package/dist/src/github-app/client.js +810 -0
  70. package/dist/src/github-app/event-source.d.ts +208 -0
  71. package/dist/src/github-app/event-source.js +684 -0
  72. package/dist/src/github-app/metrics.d.ts +32 -0
  73. package/dist/src/github-app/metrics.js +49 -0
  74. package/dist/src/github-app/review-loop.d.ts +274 -0
  75. package/dist/src/github-app/review-loop.js +1177 -0
  76. package/dist/src/github-app/review-node.d.ts +81 -0
  77. package/dist/src/github-app/review-node.js +205 -0
  78. package/dist/src/github-app/review-post.d.ts +73 -0
  79. package/dist/src/github-app/review-post.js +139 -0
  80. package/dist/src/github-app/review-text.d.ts +107 -0
  81. package/dist/src/github-app/review-text.js +1133 -0
  82. package/dist/src/github-app/review-threads.d.ts +47 -0
  83. package/dist/src/github-app/review-threads.js +107 -0
  84. package/dist/src/github-app/reviewer.d.ts +121 -0
  85. package/dist/src/github-app/reviewer.js +598 -0
  86. package/dist/src/github-app/store.d.ts +59 -0
  87. package/dist/src/github-app/store.js +148 -0
  88. package/dist/src/github-app/triggers.d.ts +141 -0
  89. package/dist/src/github-app/triggers.js +441 -0
  90. package/dist/src/github-names.d.ts +8 -0
  91. package/dist/src/github-names.js +8 -0
  92. package/dist/src/glob-search.d.ts +61 -0
  93. package/dist/src/glob-search.js +180 -0
  94. package/dist/src/graph-health.js +6 -1
  95. package/dist/src/graph-manager-chat.js +1 -1
  96. package/dist/src/graph-preview.d.ts +46 -0
  97. package/dist/src/graph-preview.js +55 -0
  98. package/dist/src/graph-provider-portability.js +2 -1
  99. package/dist/src/graph-runner.js +64 -3
  100. package/dist/src/graph-server.js +3 -3
  101. package/dist/src/graph-sync.js +3 -3
  102. package/dist/src/graph-ui/app.js +91 -7
  103. package/dist/src/graph-ui/icons.js +2 -1
  104. package/dist/src/graph-ui/studio.js +15 -1
  105. package/dist/src/graph-ui/tokens.css +1 -1
  106. package/dist/src/graphs.d.ts +34 -1
  107. package/dist/src/graphs.js +158 -14
  108. package/dist/src/image-input.d.ts +16 -0
  109. package/dist/src/image-input.js +41 -0
  110. package/dist/src/membership.d.ts +10 -0
  111. package/dist/src/membership.js +19 -4
  112. package/dist/src/model-health-cache.js +1 -1
  113. package/dist/src/model-metadata.d.ts +6 -0
  114. package/dist/src/model-metadata.js +35 -15
  115. package/dist/src/model-relay/local.d.ts +116 -0
  116. package/dist/src/model-relay/local.js +468 -0
  117. package/dist/src/model-relay/remote.d.ts +129 -0
  118. package/dist/src/model-relay/remote.js +252 -0
  119. package/dist/src/model-relay/runs.d.ts +34 -0
  120. package/dist/src/model-relay/runs.js +146 -0
  121. package/dist/src/model-relay/wire.d.ts +5 -0
  122. package/dist/src/model-relay/wire.js +5 -0
  123. package/dist/src/project-registry.d.ts +21 -0
  124. package/dist/src/project-registry.js +74 -0
  125. package/dist/src/provider-import.d.ts +0 -12
  126. package/dist/src/provider-import.js +7 -195
  127. package/dist/src/providers.d.ts +23 -2
  128. package/dist/src/providers.js +25 -4
  129. package/dist/src/pull-request-logs.d.ts +12 -1
  130. package/dist/src/pull-request-logs.js +14 -3
  131. package/dist/src/pull-requests.d.ts +327 -7
  132. package/dist/src/pull-requests.js +429 -51
  133. package/dist/src/react-runtime.js +1 -1
  134. package/dist/src/remote/engine-pool.d.ts +88 -4
  135. package/dist/src/remote/engine-pool.js +366 -89
  136. package/dist/src/remote/roots.d.ts +19 -0
  137. package/dist/src/remote/roots.js +45 -7
  138. package/dist/src/remote/types.d.ts +0 -44
  139. package/dist/src/run-control.d.ts +7 -0
  140. package/dist/src/run-control.js +23 -0
  141. package/dist/src/run-records.d.ts +7 -2
  142. package/dist/src/run-records.js +71 -6
  143. package/dist/src/runtime.d.ts +5 -1
  144. package/dist/src/runtime.js +10 -2
  145. package/dist/src/session-changes.d.ts +35 -0
  146. package/dist/src/session-changes.js +194 -6
  147. package/dist/src/session-monitor.js +2 -1
  148. package/dist/src/session-reaper.d.ts +1 -1
  149. package/dist/src/session-reaper.js +6 -1
  150. package/dist/src/session-summary.d.ts +2 -1
  151. package/dist/src/session-summary.js +2 -1
  152. package/dist/src/sessions.d.ts +11 -1
  153. package/dist/src/sessions.js +17 -4
  154. package/dist/src/skills/bundled/diagram/SKILL.md +5 -3
  155. package/dist/src/skills/bundled/graph-manager/SKILL.md +7 -4
  156. package/dist/src/skills/bundled/provenance.json +2 -2
  157. package/dist/src/skills/runtime-skills.js +1 -1
  158. package/dist/src/telemetry/emitter.d.ts +15 -0
  159. package/dist/src/telemetry/emitter.js +35 -1
  160. package/dist/src/telemetry/schema.d.ts +25 -2
  161. package/dist/src/telemetry/schema.js +52 -4
  162. package/dist/src/telemetry/surface.d.ts +2 -1
  163. package/dist/src/telemetry/surface.js +4 -1
  164. package/dist/src/terminal-ui.d.ts +1 -0
  165. package/dist/src/terminal-ui.js +10 -3
  166. package/dist/src/test-edit-guard.d.ts +7 -0
  167. package/dist/src/test-edit-guard.js +49 -1
  168. package/dist/src/timers.d.ts +2 -0
  169. package/dist/src/tools.js +59 -9
  170. package/package.json +6 -1
  171. package/dist/src/remote/cert.d.ts +0 -11
  172. package/dist/src/remote/cert.js +0 -87
  173. package/dist/src/remote/client.d.ts +0 -119
  174. package/dist/src/remote/client.js +0 -544
  175. package/dist/src/remote/command.d.ts +0 -4
  176. package/dist/src/remote/command.js +0 -194
  177. package/dist/src/remote/errors.d.ts +0 -11
  178. package/dist/src/remote/errors.js +0 -14
  179. package/dist/src/remote/network.d.ts +0 -22
  180. package/dist/src/remote/network.js +0 -102
  181. package/dist/src/remote/pairing.d.ts +0 -63
  182. package/dist/src/remote/pairing.js +0 -299
  183. package/dist/src/remote/pem.d.ts +0 -2
  184. package/dist/src/remote/pem.js +0 -7
  185. package/dist/src/remote/serve.d.ts +0 -68
  186. package/dist/src/remote/serve.js +0 -244
  187. package/dist/src/remote/server.d.ts +0 -21
  188. package/dist/src/remote/server.js +0 -406
@@ -8,7 +8,7 @@ export const COMPACTION_PHRASES = [
8
8
  'Stuffing memories into a carry-on',
9
9
  'Shrink-wrapping the context',
10
10
  'Condensing the chat like canned soup',
11
- 'Turning the scroll into a sticky note',
11
+ 'Turning the context into a sticky note',
12
12
  ];
13
13
  export function pickCompactionPhrase(random = Math.random) {
14
14
  const index = Math.floor(random() * COMPACTION_PHRASES.length);
@@ -395,6 +395,74 @@ function splitFusedArguments(envelope, notes) {
395
395
  }
396
396
  }
397
397
  const EMBEDDED_ENVELOPE_FIELD = /"\s*,\s*"(tests|outcome|output|artifacts)"\s*:/;
398
+ const EMBEDDED_FIELDS = ['tests', 'outcome', 'output', 'artifacts', 'remaining'];
399
+ const RAW_CONTROL = { '\n': '\\n', '\r': '\\r', '\t': '\\t' };
400
+ function emptyField(value) {
401
+ if (value === undefined || value === null)
402
+ return true;
403
+ if (Array.isArray(value))
404
+ return value.length === 0;
405
+ return typeof value === 'object' && Object.keys(value).length === 0;
406
+ }
407
+ const JSON_ESCAPE = /\\(["\\/bfnrt]|u[0-9a-fA-F]{4})/g;
408
+ const JSON_ESCAPED = { '"': '"', '\\': '\\', '/': '/', b: '\b', f: '\f', n: '\n', r: '\r', t: '\t' };
409
+ const MARK = '\u0000';
410
+ /** Reads one level of JSON string escaping in a single pass, so an escaped backslash is never read twice. */
411
+ function decodeOneLevel(text) {
412
+ return text.replace(JSON_ESCAPE, (_, escape) => escape.length === 1 ? JSON_ESCAPED[escape] : String.fromCharCode(parseInt(escape.slice(1), 16)));
413
+ }
414
+ /**
415
+ * Recovers a completion whose summary string swallowed the rest of the envelope: the model escaped
416
+ * the quote that should have closed summary, so tests, outcome and output arrived as text inside it.
417
+ * The summary is cut where the first swallowed field starts and only what follows is parsed, so the
418
+ * answer's own text (a Windows path, a regular expression) is never read as JSON escapes. The parsed
419
+ * fields fill the ones the envelope lacks; a field the envelope already carries is never replaced.
420
+ */
421
+ function unpackEmbeddedEnvelope(envelope, notes) {
422
+ if (typeof envelope.summary !== 'string' || envelope.summary.includes(MARK))
423
+ return;
424
+ let candidate = envelope.summary;
425
+ // The swallowed fields sit at the summary's own escaping level, or one or two levels deeper when the
426
+ // model escaped the whole tail again.
427
+ for (let level = 0; level < 3; level += 1, candidate = decodeOneLevel(candidate)) {
428
+ let marked = false;
429
+ const masked = mapOutsideCode(candidate, prose => marked ? prose : prose.replace(EMBEDDED_ENVELOPE_FIELD, found => { marked = true; return MARK + found.slice(1); }));
430
+ const cut = masked.indexOf(MARK);
431
+ if (!marked || masked.length !== candidate.length || candidate[cut] !== '"')
432
+ continue;
433
+ let inner;
434
+ try {
435
+ inner = JSON.parse(`{"summary":""${candidate.slice(cut + 1).replace(/[\n\r\t]/g, char => RAW_CONTROL[char])}`);
436
+ }
437
+ catch {
438
+ continue;
439
+ }
440
+ if (!inner || typeof inner !== 'object' || Array.isArray(inner))
441
+ continue;
442
+ const fields = inner;
443
+ // At the summary's own level only its quotes can still be escaped: the model escaped them for the
444
+ // string it believed it was still inside.
445
+ const summary = level === 0 ? candidate.slice(0, cut).replace(/\\"/g, '"') : candidate.slice(0, cut);
446
+ if (!summary.trim())
447
+ continue;
448
+ if (Object.keys(fields).some(key => key !== 'summary' && !EMBEDDED_FIELDS.includes(key)))
449
+ continue;
450
+ if (fields.tests !== undefined && !ENVELOPE_FIELDS.tests(fields.tests))
451
+ continue;
452
+ if (fields.outcome !== undefined && typeof fields.outcome !== 'string')
453
+ continue;
454
+ const moved = [];
455
+ for (const key of EMBEDDED_FIELDS) {
456
+ if (fields[key] === undefined || !emptyField(envelope[key]))
457
+ continue;
458
+ envelope[key] = fields[key];
459
+ moved.push(key);
460
+ }
461
+ envelope.summary = summary;
462
+ notes?.push(`completion summary carried the rest of the envelope as text${moved.length ? ` (${moved.join(', ')})` : ''}; the host separated the fields`);
463
+ return;
464
+ }
465
+ }
398
466
  function rejectEmbeddedEnvelope(summary) {
399
467
  let field;
400
468
  mapOutsideCode(summary, prose => {
@@ -482,17 +550,23 @@ export function stripEchoedEnvelope(summary, outcome, notes) {
482
550
  notes?.push(`completion summary ended with its own ${[...fields].join(', ')} fields written out as text, removed by the host`);
483
551
  return answer;
484
552
  }
553
+ const CONTRACT_MISMATCH = 'Completion outcome or output does not match the declared contract';
485
554
  export function parseCompletion(text, options, reject, notes, stopReason) {
486
555
  const body = text.replace(/^```(?:json)?\s*\n?/, '').replace(/\n?```\s*$/, '');
487
556
  try {
488
557
  const value = parseCompletionJson(body, stopReason, notes);
489
- if (value && typeof value === 'object' && !Array.isArray(value))
558
+ if (value && typeof value === 'object' && !Array.isArray(value)) {
490
559
  splitFusedArguments(value, notes);
560
+ unpackEmbeddedEnvelope(value, notes);
561
+ }
491
562
  if (options.completionPolicy && value && typeof value === 'object' && !Array.isArray(value)) {
492
563
  const policy = options.completionPolicy;
493
564
  const outcome = value.outcome ?? (policy.mode === 'single' ? policy.outcome : undefined);
494
- if (typeof outcome !== 'string' || !(policy.mode === 'single' ? [policy.outcome] : policy.outcomes).includes(outcome))
495
- throw new Error("Completion outcome or output does not match the declared contract");
565
+ const declared = policy.mode === 'single' ? [policy.outcome] : policy.outcomes;
566
+ if (typeof outcome !== 'string' || !declared.includes(outcome)) {
567
+ const got = outcome === undefined ? 'outcome is missing' : `outcome ${(JSON.stringify(outcome) ?? String(outcome)).slice(0, 80)} is not declared`;
568
+ throw new Error(`${CONTRACT_MISMATCH}: ${got}; send outcome as ${declared.length === 1 ? '' : 'one of '}${declared.map(item => JSON.stringify(item)).join(', ')}`);
569
+ }
496
570
  let output = value.output ?? (typeof value.summary === 'string' ? { summary: value.summary, tests: value.tests ?? [] } : undefined);
497
571
  if (typeof output === 'string') {
498
572
  try {
@@ -504,8 +578,11 @@ export function parseCompletion(text, options, reject, notes, stopReason) {
504
578
  }
505
579
  catch { }
506
580
  }
507
- if (!output || typeof output !== 'object' || Array.isArray(output))
508
- throw new Error("Completion outcome or output does not match the declared contract");
581
+ if (!output || typeof output !== 'object' || Array.isArray(output)) {
582
+ throw new Error(output === undefined || output === null
583
+ ? `${CONTRACT_MISMATCH}: it has neither a summary nor an output; send summary (the final answer, in markdown), tests, outcome and output as complete_agent arguments`
584
+ : `${CONTRACT_MISMATCH}: output is ${Array.isArray(output) ? 'an array' : `a ${typeof output}`} and must be a JSON object`);
585
+ }
509
586
  if (value.output !== undefined)
510
587
  output = liftEnvelopeFields(value, output, options.outputSchema, notes);
511
588
  if (options.canonicalTask !== undefined)
@@ -7,7 +7,7 @@ import { type AnalyticsConfig } from './analytics.js';
7
7
  import { type PermissionMode } from './permissions.js';
8
8
  import { type ToolProfile } from './tool-profile.js';
9
9
  import { type Limits } from './limits.js';
10
- import type { ProjectEntry, RemoteConfig } from './remote/types.js';
10
+ import type { ProjectEntry, RemoteShare } from './remote/types.js';
11
11
  export interface LimitsConfig {
12
12
  maxIterations?: number;
13
13
  wallTimeMs?: number;
@@ -35,6 +35,27 @@ export type McpServerConfig = {
35
35
  headers?: Record<string, string>;
36
36
  enabled?: boolean;
37
37
  };
38
+ export interface BridgeConfig {
39
+ folders?: RemoteShare[];
40
+ }
41
+ /**
42
+ * `modelRelay`: by Andorra account subject, the linked machines (environment ids) allowed to use this computer's
43
+ * providers through the model relay, oldest first. A list (the shape before accounts were told apart) is ignored on read
44
+ * and replaced on the next write.
45
+ */
46
+ export interface EnvironmentsConfig {
47
+ modelRelay?: Record<string, string[]> | string[];
48
+ }
49
+ /** At most this many machines are allowed per account; allowing another drops the oldest. */
50
+ export declare const MODEL_RELAY_ALLOWED_LIMIT = 64;
51
+ /** The machines `subject` allowed to use this computer's models, from a saved `environments.modelRelay`. */
52
+ export declare function modelRelayAllowedFor(environments: EnvironmentsConfig | undefined, subject: string | undefined): string[];
53
+ /**
54
+ * `map` with `subject`'s list set to `list` and moved to the end: the object's key order is the order in which the
55
+ * accounts' lists were last written. Past 64 accounts, the least recently written are dropped, so the file always
56
+ * validates. (Account subjects are Cognito ids, never integer-like keys, so the order holds.)
57
+ */
58
+ export declare function withModelRelayEntry(map: Record<string, string[]>, subject: string, list: string[]): Record<string, string[]>;
38
59
  export interface Config {
39
60
  version: 1;
40
61
  provider: string;
@@ -59,18 +80,64 @@ export interface Config {
59
80
  mcpServers?: Record<string, McpServerConfig>;
60
81
  workspacePermissions?: Record<string, PermissionMode>;
61
82
  projectExtensions?: Record<string, ProjectExtensionOverride>;
62
- remote?: RemoteConfig;
83
+ remote?: Record<string, unknown>;
84
+ bridge?: BridgeConfig;
63
85
  projects?: ProjectEntry[];
64
86
  externalSubagent?: {
65
87
  provider: string;
66
88
  model: string;
67
89
  };
90
+ environments?: EnvironmentsConfig;
68
91
  systemPromptOverride?: string;
69
92
  toolProfile?: ToolProfile;
70
93
  autoArchiveDays?: number;
71
94
  browser?: BrowserConfig;
72
95
  webSearch?: WebSearchConfig;
96
+ github?: GitHubConfig;
73
97
  }
98
+ /**
99
+ * The Andorra GitHub App, per user. `app.enabled: false` turns its events off on this installation (every PR
100
+ * is polled through gh, as without the App). `app.agentWrites` says who the agent's replies, resolves and PR
101
+ * comments post as on a PR the App covers: `bot` (the default) for the App's bot, `me` for the person's own gh
102
+ * account. `app.triggers: false` stops a mention of the App's bot on a task's PR from waking the task on this
103
+ * installation (the per-machine opt-out; on by default). `app.reviews: false` refuses switching the Andorra review loop
104
+ * on here (on by default); `app.reviewNewPullRequests: true` switches it on for each PR a task opens (off by default).
105
+ * Other keys under `github.app` belong to later versions and are kept as written.
106
+ */
107
+ export declare const GITHUB_AGENT_WRITES: readonly ["bot", "me"];
108
+ export type GitHubAgentWrites = typeof GITHUB_AGENT_WRITES[number];
109
+ export interface GitHubConfig {
110
+ app?: {
111
+ enabled?: boolean;
112
+ agentWrites?: GitHubAgentWrites;
113
+ triggers?: boolean;
114
+ reviews?: boolean;
115
+ reviewNewPullRequests?: boolean;
116
+ } & Record<string, unknown>;
117
+ }
118
+ export declare function validateGitHubConfig(value: unknown): GitHubConfig;
119
+ export declare function githubAgentWrites(config: Pick<Config, 'github'>): GitHubAgentWrites;
120
+ /** The same, read from `config.json` for each write and each Auto-fix prompt, without validation or keyring; unreadable reads as `bot`. */
121
+ export declare function readGitHubAgentWrites(directory: string): Promise<GitHubAgentWrites>;
122
+ /** Whether the GitHub App's events may run here: not switched off in config, nor by `ANDORRA_GITHUB_APP=off`. */
123
+ export declare function githubAppEventsEnabled(config: Pick<Config, 'github'>, env?: NodeJS.ProcessEnv): boolean;
124
+ /**
125
+ * The same, read cheaply for a check that runs every minute: only `github.app.enabled` is taken from
126
+ * `config.json`, with no validation, no provider keys and no keyring. A missing or unreadable file reads as on,
127
+ * as `loadConfig`'s default config would.
128
+ */
129
+ export declare function readGitHubAppEventsEnabled(directory: string, env?: NodeJS.ProcessEnv): Promise<boolean>;
130
+ export declare function githubAppTriggersEnabled(config: Pick<Config, 'github'>): boolean;
131
+ /** The same, read from `config.json` for each mention, without validation or keyring; a missing or unreadable file reads as on. */
132
+ export declare function readGitHubAppTriggersEnabled(directory: string): Promise<boolean>;
133
+ /** The Andorra review loop may be switched on here: only `github.app.reviews: false` says no. */
134
+ export declare function githubAppReviewsEnabled(config: Pick<Config, 'github'>): boolean;
135
+ /** The same, read from `config.json` without validation or keyring; a missing or unreadable file reads as on. */
136
+ export declare function readGitHubAppReviewsEnabled(directory: string): Promise<boolean>;
137
+ /** A PR a task opens starts with the review loop on: only `github.app.reviewNewPullRequests: true` says so. */
138
+ export declare function githubAppReviewNewPullRequests(config: Pick<Config, 'github'>): boolean;
139
+ /** The same, read from `config.json`; a missing or unreadable file reads as off. */
140
+ export declare function readGitHubAppReviewNewPullRequests(directory: string): Promise<boolean>;
74
141
  export interface BrowserConfig {
75
142
  capsolverApiKey?: string;
76
143
  }
@@ -134,6 +201,7 @@ export declare class ConfigConflictError extends Error {
134
201
  export declare function changeConfigFile<T = undefined>(directory: string, change: (current: Config, prepared: T) => Config, attempts?: number, prepare?: () => Promise<T>): Promise<Config>;
135
202
  export declare function validateCodeIntelConfig(codeIntel: unknown): void;
136
203
  export declare function resolveCodeIntelConfig(config: Config): Required<Pick<CodeIntelConfig, 'enabled'>> & CodeIntelConfig;
137
- export declare function validateRemoteConfig(remote: unknown): void;
204
+ export declare function validateBridgeConfig(bridge: unknown): void;
205
+ export declare function validateEnvironmentsConfig(environments: unknown): void;
138
206
  export declare function validateProjectsConfig(projects: unknown): void;
139
207
  export declare function validateDecisionConfig(value: unknown): void;
@@ -43,6 +43,164 @@ export function isProjectExtensionOverride(entry) {
43
43
  return false;
44
44
  return true;
45
45
  }
46
+ /** At most this many machines are allowed per account; allowing another drops the oldest. */
47
+ export const MODEL_RELAY_ALLOWED_LIMIT = 64;
48
+ const MODEL_RELAY_ACCOUNT_LIMIT = 64;
49
+ const ENVIRONMENT_ID = /^env_[A-Za-z0-9_-]{22}$/;
50
+ const ACCOUNT_SUBJECT = /^[A-Za-z0-9-]{1,128}$/;
51
+ /** The machines `subject` allowed to use this computer's models, from a saved `environments.modelRelay`. */
52
+ export function modelRelayAllowedFor(environments, subject) {
53
+ const saved = environments?.modelRelay;
54
+ if (subject === undefined || !saved || Array.isArray(saved) || !Object.hasOwn(saved, subject))
55
+ return [];
56
+ return [...saved[subject]];
57
+ }
58
+ /**
59
+ * `map` with `subject`'s list set to `list` and moved to the end: the object's key order is the order in which the
60
+ * accounts' lists were last written. Past 64 accounts, the least recently written are dropped, so the file always
61
+ * validates. (Account subjects are Cognito ids, never integer-like keys, so the order holds.)
62
+ */
63
+ export function withModelRelayEntry(map, subject, list) {
64
+ const others = Object.entries(map).filter(([key]) => key !== subject);
65
+ return Object.fromEntries([...others.slice(Math.max(0, others.length - (MODEL_RELAY_ACCOUNT_LIMIT - 1))), [subject, list.slice(-MODEL_RELAY_ALLOWED_LIMIT)]]);
66
+ }
67
+ /**
68
+ * The Andorra GitHub App, per user. `app.enabled: false` turns its events off on this installation (every PR
69
+ * is polled through gh, as without the App). `app.agentWrites` says who the agent's replies, resolves and PR
70
+ * comments post as on a PR the App covers: `bot` (the default) for the App's bot, `me` for the person's own gh
71
+ * account. `app.triggers: false` stops a mention of the App's bot on a task's PR from waking the task on this
72
+ * installation (the per-machine opt-out; on by default). `app.reviews: false` refuses switching the Andorra review loop
73
+ * on here (on by default); `app.reviewNewPullRequests: true` switches it on for each PR a task opens (off by default).
74
+ * Other keys under `github.app` belong to later versions and are kept as written.
75
+ */
76
+ export const GITHUB_AGENT_WRITES = ['bot', 'me'];
77
+ export function validateGitHubConfig(value) {
78
+ const c = value;
79
+ if (!c || typeof c !== 'object' || Array.isArray(c))
80
+ throw new Error('Invalid github configuration');
81
+ if (c.app !== undefined && (!c.app || typeof c.app !== 'object' || Array.isArray(c.app)))
82
+ throw new Error('Invalid github.app configuration');
83
+ if (c.app?.enabled !== undefined && typeof c.app.enabled !== 'boolean')
84
+ throw new Error('github.app.enabled must be a boolean');
85
+ if (c.app?.agentWrites !== undefined && !GITHUB_AGENT_WRITES.includes(c.app.agentWrites))
86
+ throw new Error('github.app.agentWrites must be bot or me');
87
+ if (c.app?.triggers !== undefined && typeof c.app.triggers !== 'boolean')
88
+ throw new Error('github.app.triggers must be a boolean');
89
+ if (c.app?.reviews !== undefined && typeof c.app.reviews !== 'boolean')
90
+ throw new Error('github.app.reviews must be a boolean');
91
+ if (c.app?.reviewNewPullRequests !== undefined && typeof c.app.reviewNewPullRequests !== 'boolean')
92
+ throw new Error('github.app.reviewNewPullRequests must be a boolean');
93
+ return c;
94
+ }
95
+ /** Who the agent's PR writes post as: `me` only when the config says so; anything else, or no config, is `bot`. */
96
+ function agentWritesOf(config) {
97
+ const github = typeof config === 'object' && config !== null ? config.github : undefined;
98
+ const app = typeof github === 'object' && github !== null ? github.app : undefined;
99
+ return typeof app === 'object' && app !== null && app.agentWrites === 'me' ? 'me' : 'bot';
100
+ }
101
+ export function githubAgentWrites(config) {
102
+ return agentWritesOf(config);
103
+ }
104
+ /** The same, read from `config.json` for each write and each Auto-fix prompt, without validation or keyring; unreadable reads as `bot`. */
105
+ export async function readGitHubAgentWrites(directory) {
106
+ let value;
107
+ try {
108
+ value = JSON.parse(await readFile(join(directory, 'config.json'), 'utf8'));
109
+ }
110
+ catch {
111
+ return 'bot';
112
+ }
113
+ return agentWritesOf(value);
114
+ }
115
+ /**
116
+ * The one rule for whether the GitHub App's events may run here: not switched off by `ANDORRA_GITHUB_APP=off`,
117
+ * nor by `github.app.enabled: false` in the config (parsed, or read raw from `config.json`).
118
+ */
119
+ function githubAppEventsAllowed(config, env) {
120
+ if (env.ANDORRA_GITHUB_APP?.trim().toLowerCase() === 'off')
121
+ return false;
122
+ const github = typeof config === 'object' && config !== null ? config.github : undefined;
123
+ const app = typeof github === 'object' && github !== null ? github.app : undefined;
124
+ return !(typeof app === 'object' && app !== null && app.enabled === false);
125
+ }
126
+ /** Whether the GitHub App's events may run here: not switched off in config, nor by `ANDORRA_GITHUB_APP=off`. */
127
+ export function githubAppEventsEnabled(config, env = process.env) {
128
+ return githubAppEventsAllowed(config, env);
129
+ }
130
+ /**
131
+ * The same, read cheaply for a check that runs every minute: only `github.app.enabled` is taken from
132
+ * `config.json`, with no validation, no provider keys and no keyring. A missing or unreadable file reads as on,
133
+ * as `loadConfig`'s default config would.
134
+ */
135
+ export async function readGitHubAppEventsEnabled(directory, env = process.env) {
136
+ if (!githubAppEventsAllowed(undefined, env))
137
+ return false;
138
+ let value;
139
+ try {
140
+ value = JSON.parse(await readFile(join(directory, 'config.json'), 'utf8'));
141
+ }
142
+ catch {
143
+ return true;
144
+ }
145
+ return githubAppEventsAllowed(value, env);
146
+ }
147
+ /** A mention of the bot may wake a task here: only `github.app.triggers: false` says no. */
148
+ function triggersOf(config) {
149
+ const github = typeof config === 'object' && config !== null ? config.github : undefined;
150
+ const app = typeof github === 'object' && github !== null ? github.app : undefined;
151
+ return !(typeof app === 'object' && app !== null && app.triggers === false);
152
+ }
153
+ export function githubAppTriggersEnabled(config) {
154
+ return triggersOf(config);
155
+ }
156
+ /** The same, read from `config.json` for each mention, without validation or keyring; a missing or unreadable file reads as on. */
157
+ export async function readGitHubAppTriggersEnabled(directory) {
158
+ let value;
159
+ try {
160
+ value = JSON.parse(await readFile(join(directory, 'config.json'), 'utf8'));
161
+ }
162
+ catch {
163
+ return true;
164
+ }
165
+ return triggersOf(value);
166
+ }
167
+ /** One boolean key under `github.app`, or undefined when the config does not set it. */
168
+ function githubAppFlag(config, key) {
169
+ const github = typeof config === 'object' && config !== null ? config.github : undefined;
170
+ const app = typeof github === 'object' && github !== null ? github.app : undefined;
171
+ const value = typeof app === 'object' && app !== null ? app[key] : undefined;
172
+ return typeof value === 'boolean' ? value : undefined;
173
+ }
174
+ /** The Andorra review loop may be switched on here: only `github.app.reviews: false` says no. */
175
+ export function githubAppReviewsEnabled(config) {
176
+ return githubAppFlag(config, 'reviews') !== false;
177
+ }
178
+ /** The same, read from `config.json` without validation or keyring; a missing or unreadable file reads as on. */
179
+ export async function readGitHubAppReviewsEnabled(directory) {
180
+ let value;
181
+ try {
182
+ value = JSON.parse(await readFile(join(directory, 'config.json'), 'utf8'));
183
+ }
184
+ catch {
185
+ return true;
186
+ }
187
+ return githubAppFlag(value, 'reviews') !== false;
188
+ }
189
+ /** A PR a task opens starts with the review loop on: only `github.app.reviewNewPullRequests: true` says so. */
190
+ export function githubAppReviewNewPullRequests(config) {
191
+ return githubAppFlag(config, 'reviewNewPullRequests') === true;
192
+ }
193
+ /** The same, read from `config.json`; a missing or unreadable file reads as off. */
194
+ export async function readGitHubAppReviewNewPullRequests(directory) {
195
+ let value;
196
+ try {
197
+ value = JSON.parse(await readFile(join(directory, 'config.json'), 'utf8'));
198
+ }
199
+ catch {
200
+ return false;
201
+ }
202
+ return githubAppFlag(value, 'reviewNewPullRequests') === true;
203
+ }
46
204
  export const MAX_CAPSOLVER_API_KEY_LENGTH = 256;
47
205
  export function validateBrowserConfig(value) {
48
206
  const c = value;
@@ -235,6 +393,8 @@ export function validateConfig(value) {
235
393
  validateBrowserConfig(c.browser);
236
394
  if (c.webSearch !== undefined)
237
395
  validateWebSearchConfig(c.webSearch);
396
+ if (c.github !== undefined)
397
+ validateGitHubConfig(c.github);
238
398
  if (c.extensions !== undefined) {
239
399
  if (!c.extensions || typeof c.extensions !== 'object' || Array.isArray(c.extensions))
240
400
  throw new Error('Invalid extensions configuration');
@@ -256,8 +416,10 @@ export function validateConfig(value) {
256
416
  || Object.entries(c.projectExtensions).some(([key, entry]) => !/^[a-f0-9]{64}$/.test(key) || !isProjectExtensionOverride(entry)))) {
257
417
  throw new Error('Invalid projectExtensions configuration');
258
418
  }
259
- if (c.remote !== undefined)
260
- validateRemoteConfig(c.remote);
419
+ if (c.bridge !== undefined)
420
+ validateBridgeConfig(c.bridge);
421
+ if (c.environments !== undefined)
422
+ validateEnvironmentsConfig(c.environments);
261
423
  if (c.projects !== undefined)
262
424
  validateProjectsConfig(c.projects);
263
425
  if (c.externalSubagent !== undefined && !c.providers.some(p => p?.id === c.externalSubagent.provider)) {
@@ -271,6 +433,9 @@ export function validateConfig(value) {
271
433
  const ids = new Set();
272
434
  let andorraSeen = false;
273
435
  for (const p of c.providers) {
436
+ // A relayed provider lives only in the run that a desktop started with it: never in a config file.
437
+ if (p && typeof p === 'object' && p.type === 'relayed')
438
+ throw new Error('Relayed providers cannot be saved.');
274
439
  if (p && typeof p === 'object' && p.type === 'andorra')
275
440
  normaliseAndorraEntry(p);
276
441
  if (!p || typeof p.id !== 'string' || !/^[\w-]+$/.test(p.id) || ids.has(p.id)
@@ -294,6 +459,9 @@ export function validateConfig(value) {
294
459
  throw new Error(`The active model must be one of provider ${p.id}'s configured models`);
295
460
  }
296
461
  }
462
+ if (p.textOnlyModels !== undefined && (!Array.isArray(p.textOnlyModels) || p.textOnlyModels.some((model) => typeof model !== 'string' || !model.trim() || model.length > 500))) {
463
+ throw new Error('Provider textOnlyModels must be a list of nonempty model ids');
464
+ }
297
465
  if (p.modelContextWindows !== undefined) {
298
466
  if (!p.modelContextWindows || typeof p.modelContextWindows !== 'object' || Array.isArray(p.modelContextWindows)) {
299
467
  throw new Error('Provider modelContextWindows must map model ids to positive integer context windows');
@@ -785,9 +953,6 @@ export function resolveCodeIntelConfig(config) {
785
953
  validateCodeIntelConfig(codeIntel);
786
954
  return codeIntel;
787
955
  }
788
- const BASE64URL_32 = /^[A-Za-z0-9_-]{43}$/;
789
- const HEX_16 = /^[a-f0-9]{16}$/;
790
- const HEX_32 = /^[a-f0-9]{32}$/;
791
956
  const HEX_12 = /^[a-f0-9]{12}$/;
792
957
  const ISO_DATE = /^\d{4}-\d{2}-\d{2}T/;
793
958
  function isDisplayLabel(value) {
@@ -796,80 +961,40 @@ function isDisplayLabel(value) {
796
961
  function isIsoDate(value) {
797
962
  return typeof value === 'string' && ISO_DATE.test(value) && !Number.isNaN(Date.parse(value));
798
963
  }
799
- function isPort(value) {
800
- return Number.isSafeInteger(value) && value >= 1 && value <= 65535;
801
- }
802
- export function validateRemoteConfig(remote) {
803
- const r = remote;
804
- if (!r || typeof r !== 'object' || Array.isArray(r))
805
- throw new Error('Invalid remote configuration');
806
- if (r.hosting !== undefined) {
807
- const h = r.hosting;
808
- if (!h || typeof h !== 'object' || Array.isArray(h))
809
- throw new Error('Invalid remote hosting configuration');
810
- if (h.installId !== undefined && !HEX_32.test(h.installId))
811
- throw new Error('remote.hosting.installId must be 32 hex characters');
812
- if (h.port !== undefined && !isPort(h.port))
813
- throw new Error('remote.hosting.port must be a port number');
814
- if (h.transport !== undefined && h.transport !== 'https' && h.transport !== 'http')
815
- throw new Error('remote.hosting.transport must be https or http');
816
- if (h.invitation !== undefined && h.invitation !== null) {
817
- const i = h.invitation;
818
- if (!i || typeof i !== 'object' || Array.isArray(i) || !BASE64URL_32.test(i.token) || !isIsoDate(i.createdAt) || !isIsoDate(i.expiresAt)
819
- || (i.redeemedAt !== undefined && !isIsoDate(i.redeemedAt))
820
- || (i.grant !== undefined && i.grant !== 'browse' && i.grant !== 'full'))
821
- throw new Error('Invalid remote invitation');
822
- }
823
- if (h.devices !== undefined) {
824
- if (!Array.isArray(h.devices) || h.devices.length > 32)
825
- throw new Error('remote.hosting.devices must be an array of at most 32 devices');
826
- const ids = new Set();
827
- for (const device of h.devices) {
828
- if (!device || typeof device !== 'object' || Array.isArray(device) || !HEX_16.test(device.id) || ids.has(device.id)
829
- || !BASE64URL_32.test(device.token) || !isIsoDate(device.addedAt)
830
- || (device.label !== undefined && !isDisplayLabel(device.label))
831
- || (device.lastSeenAt !== undefined && !isIsoDate(device.lastSeenAt))
832
- || (device.grant !== undefined && device.grant !== 'browse' && device.grant !== 'full'))
833
- throw new Error('Invalid paired remote device');
834
- ids.add(device.id);
835
- }
836
- }
837
- if (h.shares !== undefined) {
838
- if (!Array.isArray(h.shares) || h.shares.length > 64)
839
- throw new Error('remote.hosting.shares must be an array of at most 64 shares');
840
- const ids = new Set();
841
- for (const share of h.shares) {
842
- if (!share || typeof share !== 'object' || Array.isArray(share) || !HEX_12.test(share.id) || ids.has(share.id)
843
- || typeof share.path !== 'string' || !share.path.trim() || share.path.includes('\0')
844
- || (share.label !== undefined && !isDisplayLabel(share.label)))
845
- throw new Error('Invalid remote share');
846
- ids.add(share.id);
847
- }
848
- }
964
+ export function validateBridgeConfig(bridge) {
965
+ const b = bridge;
966
+ if (!b || typeof b !== 'object' || Array.isArray(b))
967
+ throw new Error('Invalid bridge configuration');
968
+ if (b.folders === undefined)
969
+ return;
970
+ if (!Array.isArray(b.folders) || b.folders.length > 64)
971
+ throw new Error('bridge.folders must be an array of at most 64 folders');
972
+ const ids = new Set();
973
+ for (const folder of b.folders) {
974
+ if (!folder || typeof folder !== 'object' || Array.isArray(folder) || typeof folder.id !== 'string' || !HEX_12.test(folder.id) || ids.has(folder.id)
975
+ || typeof folder.path !== 'string' || !folder.path.trim() || folder.path.includes('\0')
976
+ || (folder.label !== undefined && !isDisplayLabel(folder.label)))
977
+ throw new Error('Invalid bridge folder');
978
+ ids.add(folder.id);
849
979
  }
850
- if (r.workspaces !== undefined) {
851
- if (!Array.isArray(r.workspaces) || r.workspaces.length > 32)
852
- throw new Error('remote.workspaces must be an array of at most 32 workspaces');
853
- const ids = new Set();
854
- for (const workspace of r.workspaces) {
855
- if (!workspace || typeof workspace !== 'object' || Array.isArray(workspace)
856
- || !/^ws-[a-f0-9]{12}$/.test(workspace.id) || ids.has(workspace.id)
857
- || !isDisplayLabel(workspace.nickname) || !Array.isArray(workspace.hosts) || workspace.hosts.length < 1 || workspace.hosts.length > 8
858
- || workspace.hosts.some((host) => typeof host !== 'string' || !host.trim() || host.length > 253 || /[\0\r\n /]/.test(host))
859
- || (workspace.host !== undefined && (typeof workspace.host !== 'string' || !workspace.host.trim() || workspace.host.length > 253 || /[\0\r\n /]/.test(workspace.host)))
860
- || !isPort(workspace.port) || (workspace.transport !== 'https' && workspace.transport !== 'http')
861
- || !BASE64URL_32.test(workspace.fingerprint)
862
- || (workspace.transport === 'https'
863
- ? (typeof workspace.certPem !== 'string' || !workspace.certPem.includes('BEGIN CERTIFICATE'))
864
- : (workspace.certPem !== undefined && typeof workspace.certPem !== 'string'))
865
- || !BASE64URL_32.test(workspace.token) || !isIsoDate(workspace.addedAt)
866
- || (workspace.hostname !== undefined && (typeof workspace.hostname !== 'string' || !workspace.hostname.trim() || workspace.hostname.length > 128 || /[\0\r\n]/.test(workspace.hostname)))
867
- || (workspace.platform !== undefined && (typeof workspace.platform !== 'string' || !workspace.platform.trim() || workspace.platform.length > 64 || /[\0\r\n]/.test(workspace.platform)))
868
- || (workspace.version !== undefined && (typeof workspace.version !== 'string' || !workspace.version.trim() || workspace.version.length > 64 || /[\0\r\n]/.test(workspace.version))))
869
- throw new Error('Invalid paired remote workspace');
870
- ids.add(workspace.id);
871
- }
980
+ }
981
+ export function validateEnvironmentsConfig(environments) {
982
+ const e = environments;
983
+ if (!e || typeof e !== 'object' || Array.isArray(e) || Object.keys(e).some(key => key !== 'modelRelay'))
984
+ throw new Error('Invalid environments configuration');
985
+ if (e.modelRelay === undefined)
986
+ return;
987
+ // The earlier list shape is read as nothing allowed; it is still a valid file.
988
+ if (Array.isArray(e.modelRelay)) {
989
+ if (e.modelRelay.length > MODEL_RELAY_ALLOWED_LIMIT || e.modelRelay.some(id => typeof id !== 'string'))
990
+ throw new Error('environments.modelRelay must map accounts to at most 64 environment ids');
991
+ return;
872
992
  }
993
+ const byAccount = e.modelRelay;
994
+ if (!byAccount || typeof byAccount !== 'object' || Object.keys(byAccount).length > MODEL_RELAY_ACCOUNT_LIMIT
995
+ || Object.entries(byAccount).some(([subject, ids]) => !ACCOUNT_SUBJECT.test(subject) || !Array.isArray(ids) || ids.length > MODEL_RELAY_ALLOWED_LIMIT
996
+ || ids.some(id => typeof id !== 'string' || !ENVIRONMENT_ID.test(id))))
997
+ throw new Error('environments.modelRelay must map accounts to at most 64 environment ids');
873
998
  }
874
999
  export function validateProjectsConfig(projects) {
875
1000
  if (!Array.isArray(projects) || projects.length > 256)
@@ -84,8 +84,20 @@ export function createRuntimeBudget(callerSignal, wallTimeMs, control) {
84
84
  resume = undefined;
85
85
  }
86
86
  };
87
- unsubscribe = control.onChange(changed);
87
+ const unsubscribePause = control.onChange(changed);
88
88
  changed(control.isPaused);
89
+ let resumeHold;
90
+ const held = (holding) => {
91
+ if (holding)
92
+ resumeHold ??= budget.suspend();
93
+ else {
94
+ resumeHold?.();
95
+ resumeHold = undefined;
96
+ }
97
+ };
98
+ const unsubscribeHold = control.onBudgetHold(held);
99
+ held(control.budgetsHeld);
100
+ unsubscribe = () => { unsubscribePause(); unsubscribeHold(); };
89
101
  }
90
102
  return budget;
91
103
  }
@@ -197,7 +197,7 @@ export function replayableTestRun(line) {
197
197
  const source = line.trim().replace(/^cd\s+"?\$\(pwd\)"?\s*&&\s*/, '');
198
198
  if (!source || MUTATING_FLAG.test(source) || source.includes('<<'))
199
199
  return undefined;
200
- const masked = source.replace(/'[^']*'/g, quoted => `'${'_'.repeat(quoted.length - 2)}'`).replace(/"(?:[^"\$`]|\.)*"/g, quoted => `"${'_'.repeat(quoted.length - 2)}"`);
200
+ const masked = source.replace(/'[^']*'/g, quoted => `'${'_'.repeat(quoted.length - 2)}'`).replace(/"[^"$`]*"/g, quoted => `"${'_'.repeat(quoted.length - 2)}"`);
201
201
  let cut = -1;
202
202
  for (let index = 0; index < masked.length; index++) {
203
203
  if (masked[index] !== '|')
@@ -8,7 +8,6 @@ export const JEV_REQUEST_PHRASES = [
8
8
  'Haggling with the token meter',
9
9
  'Teaching the prompt to travel light',
10
10
  'Bargain-hunting for bytes',
11
- 'Squeezing the context like a toothpaste tube',
12
11
  "Shrinking the bill before it's printed",
13
12
  'Leaving the extra tokens at home',
14
13
  'Sending unnecessary tokens home',
@@ -2,7 +2,7 @@ export const DEFAULT_AGENT_GRAPH = {
2
2
  name: 'Andorra Agent', entry: 'engineer',
3
3
  nodes: {
4
4
  engineer: { id: 'engineer', name: 'Andorra Agent', type: 'agent', executor: 'react-basic',
5
- instruction: 'Handle the user\'s task end to end, whether it is a coding task or a general one: implement code and verify changes with appropriate tools, and answer general research, writing and analysis directly from the available sources. Ask for clarification when needed. Report the result and any remaining issues. For follow-up questions, use the retained conversation and prior results first. Answer directly when they contain the answer; do not restart completed work or scan unrelated files. If no pull request was created or its number is unknown, say so rather than guessing. Start new implementation work only when the user requests it.',
5
+ instruction: 'Handle the user\'s task end to end, whether it is a coding task or a general one: implement code and verify changes with appropriate tools, and answer general research, writing and analysis directly from the available sources. Ask for clarification when needed. Report the result and any remaining issues. For follow-up questions, use the retained conversation and prior results first. Answer directly when they contain the answer; do not restart completed work or scan unrelated files. Never guess a pull request number. Mention pull requests in the report only when the task asked for one or one was opened; a pull request nobody asked for is not unfinished work. Start new implementation work only when the user requests it.',
6
6
  contextPolicy: { history: true }, jevEnabled: true,
7
7
  subagents: { enabled: false }, position: { x: 120, y: 120 } },
8
8
  done: { id: 'done', name: 'Done', type: 'end', position: { x: 440, y: 120 } },
@@ -5,6 +5,8 @@ export interface FileDiffLine {
5
5
  newLine?: number;
6
6
  noNewline?: true;
7
7
  clipped?: true;
8
+ /** Set on a file the person also edited (`change-authors.ts`): who added or removed the line. */
9
+ author?: 'agent' | 'user';
8
10
  }
9
11
  export interface FileDiffHunk {
10
12
  oldStart: number;
@@ -19,6 +21,8 @@ export interface FileDiff {
19
21
  linesRemoved: number;
20
22
  hiddenLines: number;
21
23
  coarse?: true;
24
+ /** The line matcher gave up (too many edits, or too slow), so the middle is shown as all removed, then all added. */
25
+ approximate?: true;
22
26
  }
23
27
  export type DiffSide = Buffer | string | null;
24
28
  export type FileDiffResult = {