@andorra-labs/code 0.1.10 → 0.1.12

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 (238) hide show
  1. package/README.md +31 -205
  2. package/THIRD_PARTY_NOTICES.md +30 -0
  3. package/dist/src/agent-execution.js +50 -2
  4. package/dist/src/agent-mcp.js +5 -0
  5. package/dist/src/app-server/protocol.d.ts +9 -1
  6. package/dist/src/app-server/protocol.js +1 -1
  7. package/dist/src/app-server.d.ts +49 -1
  8. package/dist/src/app-server.js +353 -64
  9. package/dist/src/automation-service.js +1 -1
  10. package/dist/src/browser-panel-tool.d.ts +24 -3
  11. package/dist/src/browser-panel-tool.js +80 -6
  12. package/dist/src/browser-runner.js +3 -1
  13. package/dist/src/browser-session.d.ts +8 -0
  14. package/dist/src/browser-session.js +27 -1
  15. package/dist/src/browser-ui/app.js +237 -15
  16. package/dist/src/browser-ui/index.html +5 -5
  17. package/dist/src/browser-ui/style.css +110 -65
  18. package/dist/src/browser-ui/tokens.css +27 -26
  19. package/dist/src/browser-view.d.ts +16 -0
  20. package/dist/src/browser-view.js +38 -2
  21. package/dist/src/claude-provider.js +15 -2
  22. package/dist/src/cli.d.ts +2 -1
  23. package/dist/src/cli.js +175 -43
  24. package/dist/src/code-intelligence/CodeIntelligenceManager.js +1 -1
  25. package/dist/src/codex-provider.js +6 -3
  26. package/dist/src/coding-tools.d.ts +26 -1
  27. package/dist/src/coding-tools.js +104 -33
  28. package/dist/src/command-screens.js +1 -1
  29. package/dist/src/commands.js +1 -1
  30. package/dist/src/completion-gates.d.ts +42 -7
  31. package/dist/src/completion-gates.js +55 -9
  32. package/dist/src/completion.d.ts +51 -1
  33. package/dist/src/completion.js +164 -5
  34. package/dist/src/config.d.ts +1 -0
  35. package/dist/src/config.js +2 -0
  36. package/dist/src/dashboard-view.js +2 -2
  37. package/dist/src/deadline.js +4 -0
  38. package/dist/src/decision/PreparedSteps.js +1 -1
  39. package/dist/src/delegation-changes.js +19 -2
  40. package/dist/src/diff-preview.d.ts +1 -0
  41. package/dist/src/diff-preview.js +12 -3
  42. package/dist/src/engine-streams.d.ts +22 -0
  43. package/dist/src/engine-streams.js +16 -0
  44. package/dist/src/extensions.js +17 -6
  45. package/dist/src/file-read-key.d.ts +8 -0
  46. package/dist/src/file-read-key.js +12 -0
  47. package/dist/src/graph-editor-session.js +2 -1
  48. package/dist/src/graph-health.d.ts +21 -0
  49. package/dist/src/graph-health.js +46 -0
  50. package/dist/src/graph-manager-chat.d.ts +52 -3
  51. package/dist/src/graph-manager-chat.js +62 -17
  52. package/dist/src/graph-runner.js +62 -5
  53. package/dist/src/graph-server.d.ts +1 -1
  54. package/dist/src/graph-server.js +48 -27
  55. package/dist/src/graph-sync.d.ts +8 -0
  56. package/dist/src/graph-sync.js +54 -3
  57. package/dist/src/graph-tool.js +1 -1
  58. package/dist/src/graph-ui/app.js +362 -123
  59. package/dist/src/graph-ui/controls.css +95 -22
  60. package/dist/src/graph-ui/controls.js +31 -1
  61. package/dist/src/graph-ui/embed.js +62 -13
  62. package/dist/src/graph-ui/icons.js +7 -0
  63. package/dist/src/graph-ui/index.html +4 -4
  64. package/dist/src/graph-ui/manager-state.js +143 -5
  65. package/dist/src/graph-ui/manager.css +21 -20
  66. package/dist/src/graph-ui/manager.js +337 -75
  67. package/dist/src/graph-ui/model-picker.js +279 -0
  68. package/dist/src/graph-ui/provider-glyphs/alibaba-cloud.png +0 -0
  69. package/dist/src/graph-ui/provider-glyphs/anthropic.png +0 -0
  70. package/dist/src/graph-ui/provider-glyphs/aws-bedrock.png +0 -0
  71. package/dist/src/graph-ui/provider-glyphs/claude.png +0 -0
  72. package/dist/src/graph-ui/provider-glyphs/deepseek.png +0 -0
  73. package/dist/src/graph-ui/provider-glyphs/fireworks.png +0 -0
  74. package/dist/src/graph-ui/provider-glyphs/kimi.png +0 -0
  75. package/dist/src/graph-ui/provider-glyphs/minimax.png +0 -0
  76. package/dist/src/graph-ui/provider-glyphs/openai.png +0 -0
  77. package/dist/src/graph-ui/provider-glyphs/opencode.png +0 -0
  78. package/dist/src/graph-ui/provider-glyphs/openrouter.png +0 -0
  79. package/dist/src/graph-ui/provider-glyphs/xai.png +0 -0
  80. package/dist/src/graph-ui/provider-glyphs/xiaomi-mimo.png +0 -0
  81. package/dist/src/graph-ui/provider-glyphs/zai.png +0 -0
  82. package/dist/src/graph-ui/skill-picker.js +1 -1
  83. package/dist/src/graph-ui/studio-canvas.js +8 -8
  84. package/dist/src/graph-ui/studio.css +18 -15
  85. package/dist/src/graph-ui/studio.js +92 -35
  86. package/dist/src/graph-ui/style.css +122 -79
  87. package/dist/src/graph-ui/theme.js +2 -2
  88. package/dist/src/graph-ui/tokens.css +33 -29
  89. package/dist/src/graphs.d.ts +5 -2
  90. package/dist/src/graphs.js +10 -9
  91. package/dist/src/mcp.d.ts +52 -14
  92. package/dist/src/mcp.js +285 -128
  93. package/dist/src/membership-errors.d.ts +7 -1
  94. package/dist/src/membership-errors.js +9 -3
  95. package/dist/src/memory/ProjectMemory.d.ts +77 -0
  96. package/dist/src/memory/ProjectMemory.js +310 -0
  97. package/dist/src/memory/index.d.ts +1 -0
  98. package/dist/src/memory/index.js +1 -0
  99. package/dist/src/opencode-provider.js +5 -6
  100. package/dist/src/package-name.d.ts +3 -0
  101. package/dist/src/package-name.js +3 -0
  102. package/dist/src/provider-engine.js +2 -2
  103. package/dist/src/pull-requests.d.ts +42 -6
  104. package/dist/src/pull-requests.js +11 -3
  105. package/dist/src/qa/runtime/PtyManager.js +2 -1
  106. package/dist/src/react-runtime.js +137 -22
  107. package/dist/src/read-document-doc.d.ts +20 -0
  108. package/dist/src/read-document-doc.js +524 -0
  109. package/dist/src/read-document-docx.d.ts +21 -0
  110. package/dist/src/read-document-docx.js +584 -0
  111. package/dist/src/read-document-text.d.ts +29 -0
  112. package/dist/src/read-document-text.js +67 -0
  113. package/dist/src/read-document-tool.d.ts +48 -0
  114. package/dist/src/read-document-tool.js +162 -0
  115. package/dist/src/read-document.d.ts +78 -0
  116. package/dist/src/read-document.js +353 -0
  117. package/dist/src/read-image.d.ts +29 -2
  118. package/dist/src/read-image.js +42 -17
  119. package/dist/src/remote/cert.d.ts +1 -1
  120. package/dist/src/remote/cert.js +2 -7
  121. package/dist/src/remote/client.js +1 -1
  122. package/dist/src/remote/pem.d.ts +6 -0
  123. package/dist/src/remote/pem.js +11 -0
  124. package/dist/src/run-records.js +49 -10
  125. package/dist/src/runtime.d.ts +21 -0
  126. package/dist/src/runtime.js +10 -1
  127. package/dist/src/session-changes.d.ts +6 -1
  128. package/dist/src/session-changes.js +13 -5
  129. package/dist/src/sessions.d.ts +3 -1
  130. package/dist/src/sessions.js +5 -3
  131. package/dist/src/side-panel.d.ts +6 -1
  132. package/dist/src/side-panel.js +12 -10
  133. package/dist/src/sign-in-detection.d.ts +82 -0
  134. package/dist/src/sign-in-detection.js +197 -0
  135. package/dist/src/sign-in-offer.d.ts +35 -0
  136. package/dist/src/sign-in-offer.js +116 -0
  137. package/dist/src/skills/bundled/create-skill/SKILL.md +1 -1
  138. package/dist/src/skills/bundled/diagram/SKILL.md +1 -1
  139. package/dist/src/skills/bundled/graph-manager/SKILL.md +59 -7
  140. package/dist/src/skills/bundled/graph-manager/patterns.md +27 -0
  141. package/dist/src/skills/bundled/provenance.json +4 -4
  142. package/dist/src/skills/runtime-skills.d.ts +6 -0
  143. package/dist/src/skills/runtime-skills.js +16 -3
  144. package/dist/src/stall-recovery.d.ts +6 -2
  145. package/dist/src/stall-recovery.js +7 -2
  146. package/dist/src/stray-files.d.ts +14 -0
  147. package/dist/src/stray-files.js +81 -0
  148. package/dist/src/subagent-run.js +6 -1
  149. package/dist/src/terminal-ui.d.ts +1 -1
  150. package/dist/src/terminal-ui.js +11 -5
  151. package/dist/src/time-limit.d.ts +53 -0
  152. package/dist/src/time-limit.js +79 -0
  153. package/dist/src/tool-activity.js +1 -1
  154. package/dist/src/tool-schema-compatibility.d.ts +7 -2
  155. package/dist/src/tool-schema-compatibility.js +8 -4
  156. package/dist/src/tools.js +92 -7
  157. package/dist/src/transcript.d.ts +5 -0
  158. package/dist/src/transcript.js +12 -4
  159. package/dist/src/types.d.ts +8 -0
  160. package/dist/src/untracked-file-removal.d.ts +3 -0
  161. package/dist/src/untracked-file-removal.js +125 -0
  162. package/dist/src/update-check.js +1 -1
  163. package/dist/src/update.d.ts +11 -1
  164. package/dist/src/update.js +27 -5
  165. package/dist/src/usage-analytics.d.ts +3 -1
  166. package/dist/src/usage-analytics.js +16 -2
  167. package/dist/src/workspace-git-metadata.d.ts +15 -0
  168. package/dist/src/workspace-git-metadata.js +50 -1
  169. package/dist/src/workspace-instructions.js +1 -1
  170. package/package.json +6 -26
  171. package/docs/README.md +0 -36
  172. package/docs/agents/README.md +0 -62
  173. package/docs/agents/install-for-agents.md +0 -56
  174. package/docs/agents/mcp-server.md +0 -212
  175. package/docs/agents/subagent-mode.md +0 -149
  176. package/docs/concepts/README.md +0 -47
  177. package/docs/concepts/jev-actionable-routing.md +0 -113
  178. package/docs/concepts/jev-decision-thresholds.md +0 -412
  179. package/docs/concepts/jev-efficiency.md +0 -217
  180. package/docs/concepts/jev-eval-2026-11-01.md +0 -78
  181. package/docs/concepts/limits.md +0 -52
  182. package/docs/concepts/memory.md +0 -10
  183. package/docs/concepts/security.md +0 -50
  184. package/docs/concepts/workspace-instructions.md +0 -29
  185. package/docs/getting-started/README.md +0 -82
  186. package/docs/getting-started/accounts.md +0 -78
  187. package/docs/getting-started/configure-providers.md +0 -132
  188. package/docs/guides/README.md +0 -13
  189. package/docs/guides/browser.md +0 -39
  190. package/docs/guides/desktop-app.md +0 -414
  191. package/docs/guides/extensions.md +0 -102
  192. package/docs/guides/graph-builder.md +0 -116
  193. package/docs/guides/headless.md +0 -46
  194. package/docs/guides/tui.md +0 -75
  195. package/docs/guides/update.md +0 -70
  196. package/docs/guides/web-search.md +0 -51
  197. package/docs/guides/windows-code-signing.md +0 -319
  198. package/docs/llms.txt +0 -45
  199. package/docs/reference/README.md +0 -7
  200. package/docs/reference/cli.md +0 -76
  201. package/docs/reference/config.md +0 -91
  202. package/docs/reference/slash-commands.md +0 -59
  203. package/docs/superpowers/plans/2026-11-01-claude-console-sign-in.md +0 -111
  204. package/docs/superpowers/plans/2026-11-01-jev-node-opt-in.md +0 -910
  205. package/docs/superpowers/plans/2026-11-02-workflow-pane.md +0 -398
  206. package/docs/superpowers/plans/2026-11-06-graph-soft-delete.md +0 -125
  207. package/docs/superpowers/plans/2026-11-09-orchestrator-delegation.md +0 -295
  208. package/docs/superpowers/plans/2026-11-13-graph-manager-chat.md +0 -203
  209. package/docs/superpowers/plans/2026-11-14-jev-fair-use-pricing.md +0 -79
  210. package/docs/superpowers/specs/2026-10-31-work-line-summary-design.md +0 -50
  211. package/docs/superpowers/specs/2026-11-01-claude-console-sign-in-design.md +0 -176
  212. package/docs/superpowers/specs/2026-11-01-jev-node-opt-in-design.md +0 -164
  213. package/docs/superpowers/specs/2026-11-01-pr-section-design.md +0 -111
  214. package/docs/superpowers/specs/2026-11-02-workflow-pane-design.md +0 -130
  215. package/docs/superpowers/specs/2026-11-06-bundled-skills-design.md +0 -206
  216. package/docs/superpowers/specs/2026-11-09-orchestrator-delegation-design.md +0 -291
  217. package/docs/superpowers/specs/2026-11-13-graph-manager-chat-design.md +0 -182
  218. package/docs/superpowers/specs/2026-11-14-jev-fair-use-pricing-design.md +0 -156
  219. package/scripts/jev-efficiency-eval.mjs +0 -187
  220. package/scripts/jev-efficiency-live.mjs +0 -193
  221. package/scripts/zcode-engine-replay.mjs +0 -223
  222. package/tests/agent-centric-mcp-test-plan.md +0 -208
  223. package/tests/analytics-settings-test-plan.md +0 -165
  224. package/tests/browser-cli-smoke.mjs +0 -276
  225. package/tests/browser-test-plan.md +0 -280
  226. package/tests/chat-side-panel-test-plan.md +0 -309
  227. package/tests/decision-engine-test-plan.md +0 -163
  228. package/tests/default-active-jev-test-plan.md +0 -85
  229. package/tests/harness-extensions-test-plan.md +0 -113
  230. package/tests/jev-all-decisions-test-plan.md +0 -156
  231. package/tests/jev-efficiency/criteria.json +0 -158
  232. package/tests/jev-efficiency/workloads.mjs +0 -242
  233. package/tests/jev-efficiency-test-plan.md +0 -198
  234. package/tests/permissions-sandbox-probe.mjs +0 -74
  235. package/tests/permissions-test-plan.md +0 -191
  236. package/tests/product-telemetry-test-plan.md +0 -536
  237. package/tests/thinking-stream-preview-test-plan.md +0 -136
  238. package/tests/zcode-react-engine-test-plan.md +0 -396
@@ -8,7 +8,8 @@ import semver from 'semver';
8
8
  import { configDirectory } from './config.js';
9
9
  const executeFile = promisify(execFile);
10
10
  /** The package `andorra update` installs. */
11
- export const PACKAGE_NAME = '@andorra-labs/code';
11
+ import { PACKAGE_NAME } from './package-name.js';
12
+ export { PACKAGE_NAME };
12
13
  /** The npm dist-tag the update follows. */
13
14
  const RELEASE_TAG = 'latest';
14
15
  /** Bounded install attempts; only a failure that still looks transient is retried. */
@@ -74,6 +75,25 @@ async function npmCli() {
74
75
  }
75
76
  throw new Error('Cannot find npm beside the Node.js installation running Andorra. Install Node.js with npm, then run andorra update again.');
76
77
  }
78
+ /** The install prefix of the Node.js running Andorra: the directory above `bin/node`, or the directory of `node.exe`. */
79
+ async function runningNodePrefix() {
80
+ const nodeDirectory = dirname(await realpath(process.execPath));
81
+ return process.platform === 'win32' ? nodeDirectory : resolve(nodeDirectory, '..');
82
+ }
83
+ /**
84
+ * The prefix to name to npm when the package is the global install of the Node.js running it, as
85
+ * the native installer lays it out (~/.andorracode/runtime/node). npm would otherwise take its
86
+ * global prefix from the user's .npmrc or NPM_CONFIG_PREFIX, which names a different directory
87
+ * and turns the update into a refusal. For every other layout npm's own answer stands.
88
+ */
89
+ export async function ownedNodePrefix(packageRoot, nodePrefix) {
90
+ const prefix = await realpath(nodePrefix).catch(() => undefined);
91
+ if (!prefix)
92
+ return undefined;
93
+ const scoped = PACKAGE_NAME.split('/');
94
+ const candidates = [join(prefix, 'lib', 'node_modules', ...scoped), join(prefix, 'node_modules', ...scoped)];
95
+ return candidates.some(candidate => samePath(candidate, packageRoot)) ? prefix : undefined;
96
+ }
77
97
  /** Keep the opaque, escaped shapes Windows error text can carry when matching it. */
78
98
  function normalizePathText(text) {
79
99
  return text.replace(/\\{2,}/g, '\\').replace(/\\/g, '/').toLowerCase();
@@ -283,10 +303,10 @@ function installFailureMessage(entry, version, outcome, cause) {
283
303
  * looks like a transient Windows sharing violation is retried a bounded number of times, after
284
304
  * checking that the package can be moved again; anything else is reported at once.
285
305
  */
286
- async function installRelease(run, sleep, probe, npm, cwd, packageRoot, entry, version, previous) {
306
+ async function installRelease(run, sleep, probe, npm, cwd, packageRoot, entry, version, previous, prefixArgs) {
287
307
  for (let attempt = 1; attempt <= INSTALL_ATTEMPTS; attempt += 1) {
288
308
  try {
289
- await run(process.execPath, [npm, 'install', '--global', `${PACKAGE_NAME}@${version}`, '--prefer-online', '--no-audit', '--no-fund'], cwd, { stream: true });
309
+ await run(process.execPath, [npm, 'install', '--global', ...prefixArgs, `${PACKAGE_NAME}@${version}`, '--prefer-online', '--no-audit', '--no-fund'], cwd, { stream: true });
290
310
  return { ok: true };
291
311
  }
292
312
  catch (error) {
@@ -512,9 +532,11 @@ export async function updateInstallation(options = {}) {
512
532
  // npm runs outside the package it replaces: a working directory inside it would keep Windows from
513
533
  // moving it, and a project's .npmrc in the caller's directory has no say over a global install.
514
534
  const cwd = home;
535
+ const owned = await ownedNodePrefix(packageRoot, options.nodePrefix ?? await runningNodePrefix());
536
+ const prefixArgs = owned ? ['--prefix', owned] : [];
515
537
  let globalRoot;
516
538
  try {
517
- globalRoot = lastLine(await run(process.execPath, [npm, 'root', '--global'], cwd));
539
+ globalRoot = lastLine(await run(process.execPath, [npm, 'root', '--global', ...prefixArgs], cwd));
518
540
  }
519
541
  catch (error) {
520
542
  throw new Error(`Could not ask npm where global packages are installed, so nothing was changed.\n${error.message}`);
@@ -556,7 +578,7 @@ export async function updateInstallation(options = {}) {
556
578
  const replaceable = await probe(packageRoot);
557
579
  if (replaceable.state !== 'clear')
558
580
  throw probeRefusal(packageRoot, replaceable);
559
- const outcome = await installRelease(run, sleep, probe, npm, cwd, packageRoot, entry, latest, current);
581
+ const outcome = await installRelease(run, sleep, probe, npm, cwd, packageRoot, entry, latest, current, prefixArgs);
560
582
  if (!outcome.ok)
561
583
  throw new Error(installFailureMessage(entry, latest, { locked: outcome.locked, installed: outcome.installed }, outcome.cause));
562
584
  const installed = await installedVersion(entry);
@@ -29,7 +29,8 @@ export interface UsageAnalytics {
29
29
  * `jevInputTokens`/`jevOutputTokens` are the measured tokens of the run/nodes Jev was enabled on
30
30
  * — the only usage a bypass could have replaced, and so the base of the avoidance rate.
31
31
  * `contextEstimatedTurns` counts the bypasses whose input came from the journaled context size
32
- * rather than the last-measured-input fallback.
32
+ * rather than the last-measured-input fallback. `jevCalls` counts the requests Jev answered
33
+ * (`decision.completed`) — most shape a request rather than replace one, so it is not `bypassedTurns`.
33
34
  */
34
35
  totals: {
35
36
  inputTokens: number;
@@ -38,6 +39,7 @@ export interface UsageAnalytics {
38
39
  savedInputEstimate: number;
39
40
  savedOutputEstimate: number;
40
41
  bypassedTurns: number;
42
+ jevCalls: number;
41
43
  unestimatedTurns: number;
42
44
  contextEstimatedTurns: number;
43
45
  jevInputTokens: number;
@@ -57,6 +57,7 @@ export function createUsageCollector(windowDays, now = new Date(), resolveProvid
57
57
  const jevNodes = new Set();
58
58
  let unestimatedTurns = 0;
59
59
  let contextEstimatedTurns = 0;
60
+ let jevCalls = 0;
60
61
  const dayFor = (date) => {
61
62
  let day = days.get(date);
62
63
  if (!day) {
@@ -128,6 +129,13 @@ export function createUsageCollector(windowDays, now = new Date(), resolveProvid
128
129
  // Jev was enabled there. Run-level notices carry no node and mark nothing.
129
130
  if (typeof data?.runId === 'string' && typeof data.nodeId === 'string')
130
131
  jevNodes.add(JSON.stringify([data.runId, data.nodeId]));
132
+ // An answered Jev request. Counted apart from the bypasses: a preflight answer picks tools and
133
+ // skills for a call that is still made, so most Jev calls skip nothing.
134
+ if (event.type === 'decision.completed') {
135
+ if (date >= cutoff)
136
+ jevCalls++;
137
+ return;
138
+ }
131
139
  if (event.type !== 'decision.turn_bypassed')
132
140
  return;
133
141
  const identity = typeof data?.runId === 'string' && typeof data.nodeId === 'string' ? JSON.stringify([data.runId, data.nodeId]) : undefined;
@@ -174,6 +182,7 @@ export function createUsageCollector(windowDays, now = new Date(), resolveProvid
174
182
  savedInputEstimate: orderedModels.reduce((sum, row) => sum + row.savedInputEstimate, 0),
175
183
  savedOutputEstimate: orderedModels.reduce((sum, row) => sum + row.savedOutputEstimate, 0),
176
184
  bypassedTurns: orderedDays.reduce((sum, day) => sum + day.bypassedTurns, 0),
185
+ jevCalls,
177
186
  unestimatedTurns,
178
187
  contextEstimatedTurns,
179
188
  jevInputTokens: 0,
@@ -200,8 +209,9 @@ const MAX_CACHE_RECORDS_TOTAL = 250_000;
200
209
  /**
201
210
  * 2: files are re-read once to capture the `j` markers version 1 never stored.
202
211
  * 3: and again for the bypass accounting fields (`i`, `p`, `m` on `b`) version 2 never stored.
212
+ * 4: and again for the answered Jev calls (`d`), which earlier versions folded into one `j` marker.
203
213
  */
204
- const CACHE_VERSION = 3;
214
+ const CACHE_VERSION = 4;
205
215
  const NAME_PATTERN = /^[a-zA-Z0-9_-]{1,64}\.jsonl$/;
206
216
  /** The largest window the collector accepts; files older than its bound are never replayed. */
207
217
  const MAX_WINDOW_DAYS = 365;
@@ -242,6 +252,8 @@ const slimOf = (record) => {
242
252
  if (typeof event?.type !== 'string' || !event.type.startsWith('decision.'))
243
253
  return undefined;
244
254
  const data = asObject(event.data);
255
+ if (event.type === 'decision.completed')
256
+ return { k: 'd', t: item.time, ...(typeof data?.runId === 'string' ? { r: data.runId } : {}), ...(typeof data?.nodeId === 'string' ? { n: data.nodeId } : {}) };
245
257
  if (event.type !== 'decision.turn_bypassed')
246
258
  return typeof data?.runId === 'string' && typeof data.nodeId === 'string'
247
259
  ? { k: 'j', t: item.time, r: data.runId, n: data.nodeId } : undefined;
@@ -265,7 +277,7 @@ const replayOf = (slim) => slim.k === 'r'
265
277
  : {
266
278
  type: 'runtime.event', time: slim.t,
267
279
  // The collector reads a marker's run and node only, so one type stands in for all of them.
268
- event: { type: slim.k === 'b' ? 'decision.turn_bypassed' : 'decision.ready', data: {
280
+ event: { type: slim.k === 'b' ? 'decision.turn_bypassed' : slim.k === 'd' ? 'decision.completed' : 'decision.ready', data: {
269
281
  ...(slim.r === undefined ? {} : { runId: slim.r }), ...(slim.n === undefined ? {} : { nodeId: slim.n }),
270
282
  ...(slim.k === 'b' && slim.i !== undefined ? { estimatedInputTokens: slim.i } : {}),
271
283
  ...(slim.k === 'b' && slim.p !== undefined ? { providerId: slim.p } : {}),
@@ -290,6 +302,8 @@ const validSlim = (value) => {
290
302
  && (item.p === undefined || typeof item.p === 'string') && (item.m === undefined || typeof item.m === 'string');
291
303
  if (item.k === 'j')
292
304
  return typeof item.r === 'string' && typeof item.n === 'string';
305
+ if (item.k === 'd')
306
+ return true;
293
307
  if (item.k !== 'r')
294
308
  return false;
295
309
  if (typeof item.p !== 'string' || typeof item.m !== 'string')
@@ -4,3 +4,18 @@
4
4
  * parent repositories and external worktree/common directories are unavailable.
5
5
  */
6
6
  export declare function workspaceGitMetadata(args: string[], workspace: string): Promise<string>;
7
+ /**
8
+ * Identity of a linked worktree's main repository: its origin url and the main checkout's root.
9
+ *
10
+ * `workspaceGitMetadata` never leaves the workspace, so a worktree whose shared Git directory lives
11
+ * in the main checkout has no remote there. Project memory needs every worktree of a repository to
12
+ * resolve to one identity, so this follows the worktree's own `.git` pointer and `commondir` out
13
+ * of the workspace. It only reads three small files with bounded reads and runs nothing; a
14
+ * workspace could name any remote in its own config anyway, so following the pointer grants no
15
+ * identity it could not already claim. Returns undefined when the workspace is not a linked
16
+ * worktree or any step is malformed.
17
+ */
18
+ export declare function linkedWorktreeIdentity(workspace: string): Promise<{
19
+ remote: string;
20
+ root: string;
21
+ } | undefined>;
@@ -68,7 +68,10 @@ export async function workspaceGitMetadata(args, workspace) {
68
68
  }
69
69
  if (common)
70
70
  directory = await checked(resolve(directory, common));
71
- const config = await text(join(directory, 'config'), 65536);
71
+ return originUrl(await text(join(directory, 'config'), 65536));
72
+ }
73
+ /** The `remote "origin"` url of a Git config file's text, or '' when it names none. */
74
+ function originUrl(config) {
72
75
  let origin = false;
73
76
  let remote = '';
74
77
  for (const line of config.split(/\r?\n/)) {
@@ -86,6 +89,52 @@ export async function workspaceGitMetadata(args, workspace) {
86
89
  }
87
90
  return remote;
88
91
  }
92
+ /**
93
+ * Identity of a linked worktree's main repository: its origin url and the main checkout's root.
94
+ *
95
+ * `workspaceGitMetadata` never leaves the workspace, so a worktree whose shared Git directory lives
96
+ * in the main checkout has no remote there. Project memory needs every worktree of a repository to
97
+ * resolve to one identity, so this follows the worktree's own `.git` pointer and `commondir` out
98
+ * of the workspace. It only reads three small files with bounded reads and runs nothing; a
99
+ * workspace could name any remote in its own config anyway, so following the pointer grants no
100
+ * identity it could not already claim. Returns undefined when the workspace is not a linked
101
+ * worktree or any step is malformed.
102
+ */
103
+ export async function linkedWorktreeIdentity(workspace) {
104
+ const read = async (path, limit) => {
105
+ const handle = await open(path, 'r');
106
+ try {
107
+ const info = await handle.stat();
108
+ if (!info.isFile() || info.size > limit)
109
+ throw new Error('Invalid Git metadata');
110
+ const buffer = Buffer.alloc(limit + 1);
111
+ const { bytesRead } = await handle.read(buffer, 0, buffer.length, 0);
112
+ if (bytesRead > limit)
113
+ throw new Error('Invalid Git metadata');
114
+ return buffer.subarray(0, bytesRead).toString('utf8').trim();
115
+ }
116
+ finally {
117
+ await handle.close();
118
+ }
119
+ };
120
+ try {
121
+ const root = await realpath(workspace);
122
+ const pointer = /^gitdir: (.+)$/.exec(await read(join(root, '.git'), 4096));
123
+ if (!pointer)
124
+ return undefined;
125
+ const gitDirectory = resolve(root, pointer[1]);
126
+ const common = await realpath(resolve(gitDirectory, await read(join(gitDirectory, 'commondir'), 4096)));
127
+ if (!(await stat(common)).isDirectory())
128
+ return undefined;
129
+ const remote = originUrl(await read(join(common, 'config'), 65536));
130
+ // A standard layout keeps the shared directory at <main checkout>/.git.
131
+ const mainRoot = common.replace(/[\\/]+$/, '').replace(/[\\/]\.git$/i, '');
132
+ return { remote, root: mainRoot === common ? common : mainRoot };
133
+ }
134
+ catch {
135
+ return undefined;
136
+ }
137
+ }
89
138
  /** Decode a single Git config value, rejecting unsupported/malformed escapes. */
90
139
  function configValue(value) {
91
140
  let result = '';
@@ -1,5 +1,4 @@
1
1
  import { readdir } from 'node:fs/promises';
2
- import { createTools } from './tools.js';
3
2
  import { clipText } from './text.js';
4
3
  /** Guide names in order of preference, each with the spelling that wins a same-name tie. */
5
4
  const GUIDE_NAMES = ['ANDORRA.md', 'AGENTS.md'];
@@ -39,6 +38,7 @@ export async function loadWorkspaceInstructions(workspace, signal, override) {
39
38
  return '';
40
39
  // read_file is the raw-content reader; the canonical Read prefixes 'N\t' line numbers,
41
40
  // which would corrupt the guidance text injected into the model prompt.
41
+ const { createTools } = await import('./tools.js');
42
42
  const guide = await createTools().find(tool => tool.name === 'read_file').execute({ path }, {
43
43
  workspace, signal, yolo: false, approve: async () => false,
44
44
  });
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@andorra-labs/code",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "Terminal-first coding agent with a ReAct graph runtime",
5
+ "homepage": "https://andorracode.com",
5
6
  "license": "SEE LICENSE IN LICENSE.md",
6
7
  "type": "module",
7
8
  "bin": {
@@ -10,34 +11,12 @@
10
11
  },
11
12
  "files": [
12
13
  "dist/src",
13
- "README.md",
14
+ "dist/vendor/engine",
15
+ "dist/vendor/zcode",
14
16
  "LICENSE.md",
15
17
  "THIRD_PARTY_NOTICES.md",
16
18
  "licenses/ZCODE-APACHE-2.0.txt",
17
- "licenses/GEIST-OFL-1.1.txt",
18
- "docs",
19
- "tests/decision-engine-test-plan.md",
20
- "tests/jev-efficiency-test-plan.md",
21
- "tests/jev-efficiency/workloads.mjs",
22
- "tests/jev-efficiency/criteria.json",
23
- "scripts/jev-efficiency-eval.mjs",
24
- "scripts/jev-efficiency-live.mjs",
25
- "tests/default-active-jev-test-plan.md",
26
- "tests/jev-all-decisions-test-plan.md",
27
- "tests/permissions-test-plan.md",
28
- "tests/permissions-sandbox-probe.mjs",
29
- "tests/thinking-stream-preview-test-plan.md",
30
- "dist/vendor/engine",
31
- "dist/vendor/zcode",
32
- "tests/browser-test-plan.md",
33
- "tests/browser-cli-smoke.mjs",
34
- "scripts/zcode-engine-replay.mjs",
35
- "tests/zcode-react-engine-test-plan.md",
36
- "tests/harness-extensions-test-plan.md",
37
- "tests/chat-side-panel-test-plan.md",
38
- "tests/agent-centric-mcp-test-plan.md",
39
- "tests/analytics-settings-test-plan.md",
40
- "tests/product-telemetry-test-plan.md"
19
+ "licenses/GEIST-OFL-1.1.txt"
41
20
  ],
42
21
  "engines": {
43
22
  "node": ">=22.19.0"
@@ -77,6 +56,7 @@
77
56
  "@anthropic-ai/sdk": "0.124.0",
78
57
  "@colbymchenry/codegraph": "^1.6.0",
79
58
  "@google/genai": "2.21.0",
59
+ "@hyzyla/pdfium": "3.0.0",
80
60
  "@modelcontextprotocol/sdk": "^1.31.0",
81
61
  "@napi-rs/keyring": "^2.1.0",
82
62
  "@peculiar/x509": "2.1.0",
package/docs/README.md DELETED
@@ -1,36 +0,0 @@
1
- # Andorra Code
2
-
3
- Andorra Code is a terminal-first coding agent. Run `andorra` in a project folder and it researches the repository, asks what you need, and implements the work with your own model providers. Instead of one opaque agent loop, work runs on a **graph**: visible stages, decisions, and handoffs that you can inspect, edit, and rerun.
4
-
5
- ```sh
6
- # after installing (see Getting started)
7
- cd /path/to/your/project
8
- andorra
9
- ```
10
-
11
- ## Where to start
12
-
13
- | Page | What it covers |
14
- | --- | --- |
15
- | [Getting started](getting-started/README.md) | Install Andorra Code, configure a provider, run your first task |
16
- | [Give these instructions to an AI agent](agents/install-for-agents.md) | A copy-paste block that lets another coding agent install and set up Andorra Code for you |
17
- | [Accounts, membership, and hosted Jev](getting-started/accounts.md) | Signing in, free and paid access, the `/jev` routing service |
18
- | [Concepts](concepts/README.md) | Graphs, agent nodes, providers, memory, limits, and security boundaries |
19
- | [Guides](guides/README.md) | The TUI, the visual Graph Builder, headless runs, extensions, the browser and desktop clients |
20
- | [Reference](reference/README.md) | CLI commands and flags, slash commands, configuration files |
21
- | [For AI agents](agents/README.md) | How an agent should read this documentation |
22
-
23
- ## The short version
24
-
25
- - **CLI-first.** `andorra` opens the TUI. `andorra graph` opens the local browser Graph Builder. There is no required cloud service for the coding loop: it runs on your machine with your providers.
26
- - **Bring your own models.** OpenAI-compatible endpoints, Anthropic, Codex (ChatGPT subscription sign-in), and local servers such as LM Studio. See [Configure providers](getting-started/configure-providers.md).
27
- - **The graph is the harness.** Out of the box, `andorra` runs a single Andorra Agent on the bundled default graph. Free accounts can build one small custom graph; paid members can select the Orchestrator workflow (`/graph` or `--graph :andorra`) and build any number of custom graphs with per-agent models, tools, instructions, typed handoffs, loops, and joins. See [Concepts](concepts/README.md).
28
- - **Agent-readable.** Every page here is written in Markdown, and [`llms.txt`](/llms.txt) indexes them for AI agents. See [For AI agents](agents/README.md).
29
-
30
- ## Documentation map
31
-
32
- - **Getting started** — install, first run, providers, accounts.
33
- - **Concepts** — what the runtime actually does: the graph model, context handling, limits, security.
34
- - **Guides** — task-oriented how-tos for every client and mode.
35
- - **Reference** — exact CLI and configuration surface.
36
- - **For AI agents** — machine-facing entry points, including graph authoring over the local MCP server (the supported surface for agents; the Graph Builder is the editor for people).
@@ -1,62 +0,0 @@
1
- # For AI agents
2
-
3
- This page is written for AI agents (and the people who configure them). Andorra Code is an agent-centric tool, so its documentation is designed to be read by machines as well as humans.
4
-
5
- ## Reading these docs
6
-
7
- Every page you are reading is published on the documentation site. The rendered page is at `/docs/<page>`; the same page as plain markdown, exactly as it is written here, is at `/docs-md/<path>`:
8
-
9
- ```text
10
- /docs-md/getting-started/README.md
11
- ```
12
-
13
- `llms.txt` at the site root is a curated index of every page with a one-line description, following the emerging `llms.txt` convention. Start there, then fetch only the pages you need:
14
-
15
- ```text
16
- /llms.txt
17
- ```
18
-
19
- ## Authoring a graph: use the MCP server
20
-
21
- When an agent creates or edits a graph, the MCP server is the surface to use — not the Graph Builder. The Graph Builder is a browser application for people; the MCP server is the documented authoring API for agents, and it needs no browser, no mouse, and no UI state to coordinate.
22
-
23
- ```text
24
- andorra mcp-server --stdio
25
- ```
26
-
27
- - **It does not run the graph you authored and opens no network listener.** Authoring and running are separate steps: publish a revision over MCP, then run it with `andorra --graph <id>`.
28
- - **Graph access requires a signed-in account.** A free account is held to its allowance of one custom graph of up to three nodes; legacy and paid accounts are not. If the account signs out or switches during a call, the server fails closed with `AUTH_CHANGED` instead of disclosing another account's graphs.
29
- - **Every Agent node you create must name a provider ID from `andorra_providers_list`.** Never assume the session provider is inherited; `NODE_PROVIDER_MISSING` and `NODE_PROVIDER_INVALID` mean the node, not the call, is wrong.
30
- - **Read the architecture resource before designing.** `andorra_graph_guide` returns the node types, ports, edge rules, and error contract — including that `agent`, `condition`, `loop`, `approval`, `join`, `parallel`, `action`, and `end` are the node types, and that every declared outcome needs an outgoing edge unless the node sets `completion.requireRoutes: false`. Do not guess at node fields from an example alone, and do not add edges or End nodes just to satisfy a route an agent deliberately left terminal.
31
- - **Follow the documented sequence and never skip validation.** `andorra_graph_begin` → `andorra_graph_node_upsert` / `andorra_graph_edge_upsert` / `andorra_graph_patch` → `andorra_graph_validate` → `andorra_graph_publish`. Fix every reported issue; do not suppress them by widening schemas or dropping outcomes.
32
- - **Cycles need a ceiling.** A failure route back to an earlier node is a cycle, so set `limits.maxNodeVisits` (or a wall clock) and make the ceiling large enough for the intended reentries.
33
- - **Drafts are process-local and expire after an hour of disuse.** Exiting the MCP process discards unpublished work, so finish the sequence in one session.
34
- - **Publishing is local-first.** A successful `andorra_graph_publish` is durable locally but is **not** cloud confirmation; report the sync state rather than claiming the graph was backed up.
35
- - **Do not drive the Graph Builder UI to author a graph.** Open it only for human editing or to show a person the result visually. If you do use it, expect an online account check before it starts.
36
-
37
- ## What an agent should know
38
-
39
- - **Install and setup** — [Give these instructions to an AI agent](install-for-agents.md) is a deterministic, copy-pasteable procedure for installing Andorra Code and configuring a provider. Follow it verbatim; it lists every decision point.
40
- - **CLI surface** — [Reference: CLI](../reference/cli.md) lists every subcommand and flag; [Reference: slash commands](../reference/slash-commands.md) covers the in-TUI commands.
41
- - **Headless automation** — `andorra --prompt "..." --json --no-tui` runs one task and prints a machine-readable result object with status, run ID, usage, and tool count. Exit codes: `0` success, `1` failure/exhaustion, `130` cancellation, `143` termination (SIGTERM). See [Headless mode](../guides/headless.md).
42
- - **Workspace instructions** — Andorra reads project-root `ANDORRA.md`, falling back to `AGENTS.md` only when the preferred file is absent; names match in any case. If you are preparing a repository for Andorra, put workspace instructions in `ANDORRA.md`. See [Workspace instructions](../concepts/workspace-instructions.md).
43
- - **Driving Andorra over MCP** — The same local stdio MCP server (`andorra mcp-server --stdio`) is how an agent outside Andorra authors and inspects graphs and reports on sessions. An agent inside one of Andorra's own nodes uses the built-in `graphs` tool, which offers the same graph operations without a server. See [Agent MCP server](mcp-server.md).
44
-
45
- ### Choosing a surface
46
-
47
- | The task | Use |
48
- | --- | --- |
49
- | Create or edit a graph | MCP server (`andorra_graph_*` tools); inside Andorra, the built-in `graphs` tool |
50
- | Run one task and read a machine-readable result | `andorra --prompt "..." --json` |
51
- | Watch sessions, find a run that needs input | MCP session tools |
52
- | Edit a graph by hand, or show one to a person | Graph Builder (`andorra graph`) |
53
- | Answer an Orchestrator's intake questions | an interactive session; headless returns `needs_clarification` |
54
-
55
- ## Grounding rules for agents
56
-
57
- 1. Prefer this documentation over assumptions about CLI behavior; flags and commands change between revisions and the docs track the current `main`.
58
- 2. Do not run interactive TUI commands when automating; use the headless flags or the MCP server.
59
- 3. Author graphs over the MCP server, and read `andorra_graph_guide` before designing one. The Graph Builder is for people, not for agents.
60
- 4. Treat exit code `1` with status `needs_clarification` as a request for human input, not a retryable failure — answer it in an interactive session.
61
- 5. Never put credentials in handoff data, graph JSON, or workspace instruction files; provider keys live in the operating system credential store (`~/.andorracode/config.json` only where there is none) or in environment variables.
62
- 6. Report what you actually ran and saw. A build that compiles is not evidence that the change works, and a published revision is not evidence that the cloud copy exists.
@@ -1,56 +0,0 @@
1
- # Give these instructions to an AI agent
2
-
3
- If you use another AI coding agent (Hermes, Codex, Claude Code, etc.), paste the block below into it. The agent can then install Andorra Code on your machine, configure a provider, and verify the install without further decisions from you.
4
-
5
- Before pasting, fill in the bracketed value: which provider to configure. Everything else is deterministic.
6
-
7
- ````markdown
8
- Install Andorra Code (a terminal-first coding agent) on this machine and verify it works.
9
-
10
- Prerequisites you must check first:
11
- - Node.js 22.19 or newer (`node --version`). If missing or older, install the current LTS
12
- from nodejs.org (or via the system's package manager) before continuing. npm ships with it.
13
- - Network access to registry.npmjs.org and to the model provider endpoint below.
14
- - If the provider preset below is "ChatGPT / Codex": the official OpenAI Codex CLI must already be
15
- installed and signed in with ChatGPT (install @openai/codex and run `codex login`), or
16
- ANDORRA_CODEX_PATH must point at its executable. Without it, configuring the Codex
17
- provider fails — check this before step 3 when that preset is chosen.
18
-
19
- Steps (run verbatim, stopping to report if any step fails):
20
- 1. npm install -g @andorra-labs/code
21
- 2. Verify: `andorra --version` must print a version number. If `andorra` is not found, the
22
- npm global bin directory is not on PATH — report that; do not edit shell profiles silently.
23
-
24
- Provider configuration (interactive, needs the human once):
25
- 3. Tell the user to run `andorra` in any folder, type `/providers`, press Enter, choose
26
- "Add provider", select the "<provider preset, exactly as the picker labels it: DeepSeek | Kimi / Moonshot | Kimi For Coding (Global) | Kimi For Coding (China) | GLM Coding Plan (Z.ai) | OpenAI | Anthropic | Local server | ChatGPT / Codex | Claude subscription | Grok subscription (Grok CLI) | OpenCode (CLI sign-in) | OpenCode Go | Custom provider>"
27
- preset, and provide credentials one of these two ways:
28
- - Paste their API key into the masked **API key** field (saved locally), or
29
- - Enter a variable name (e.g. OPENAI_API_KEY) in the **Environment fallback** field AND
30
- export that variable in the shell before starting. Exporting alone does nothing: the
31
- fallback field is what tells Andorra to read the environment.
32
- Settings save only after choosing "Save changes".
33
-
34
- Verification (optional, non-interactive):
35
- 4. `andorra --version`
36
- 5. `andorra auth status` — reports the Andorra account session (signed out is fine;
37
- accounts are optional and only needed for hosted Jev and custom graphs).
38
-
39
- Notes:
40
- - To update later: run `andorra update` from any directory. It installs the latest npm
41
- release of @andorra-labs/code and never downgrades.
42
- - Configuration lives in ~/.andorracode (override with ANDORRACODE_HOME). Saved API keys
43
- go to the operating system credential store. On Linux without one they stay in
44
- ~/.andorracode/config.json, so never commit or share that file.
45
- ````
46
-
47
- ## What the human still has to do
48
-
49
- Two things cannot be automated away:
50
-
51
- 1. **The API key.** Provider keys are secrets; paste them yourself in the masked field, or export the environment variable yourself.
52
- 2. **The optional account.** Run `andorra login` yourself if you want hosted Jev routing or custom graphs — the browser sign-in is interactive. See [Accounts](../getting-started/accounts.md).
53
-
54
- ## Installing from source instead
55
-
56
- To run unreleased changes, clone and link the repository as [Getting started](../getting-started/README.md#install-from-source) describes. `andorra update` does not update a source checkout: pull and rebuild it yourself, or switch to the npm release with `npm install -g @andorra-labs/code@latest`.