@andorra-labs/code 0.1.10 → 0.1.11

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 (155) hide show
  1. package/README.md +28 -208
  2. package/THIRD_PARTY_NOTICES.md +15 -0
  3. package/dist/src/agent-execution.js +36 -0
  4. package/dist/src/app-server/protocol.d.ts +1 -0
  5. package/dist/src/app-server.d.ts +34 -1
  6. package/dist/src/app-server.js +264 -54
  7. package/dist/src/automation-service.js +1 -1
  8. package/dist/src/browser-session.d.ts +8 -0
  9. package/dist/src/browser-session.js +27 -1
  10. package/dist/src/browser-ui/app.js +237 -15
  11. package/dist/src/browser-ui/index.html +5 -5
  12. package/dist/src/browser-ui/style.css +110 -65
  13. package/dist/src/browser-ui/tokens.css +27 -26
  14. package/dist/src/coding-tools.d.ts +24 -0
  15. package/dist/src/coding-tools.js +71 -8
  16. package/dist/src/command-screens.js +1 -1
  17. package/dist/src/commands.js +1 -1
  18. package/dist/src/completion-gates.d.ts +42 -7
  19. package/dist/src/completion-gates.js +55 -9
  20. package/dist/src/completion.d.ts +8 -0
  21. package/dist/src/completion.js +19 -1
  22. package/dist/src/dashboard-view.js +2 -2
  23. package/dist/src/deadline.js +4 -0
  24. package/dist/src/graph-manager-chat.js +13 -13
  25. package/dist/src/graph-runner.js +39 -2
  26. package/dist/src/graph-server.js +9 -9
  27. package/dist/src/graph-sync.d.ts +8 -0
  28. package/dist/src/graph-sync.js +54 -3
  29. package/dist/src/graph-tool.js +1 -1
  30. package/dist/src/graph-ui/app.js +262 -93
  31. package/dist/src/graph-ui/controls.css +43 -22
  32. package/dist/src/graph-ui/controls.js +31 -1
  33. package/dist/src/graph-ui/embed.js +62 -13
  34. package/dist/src/graph-ui/icons.js +4 -0
  35. package/dist/src/graph-ui/index.html +3 -3
  36. package/dist/src/graph-ui/manager-state.js +2 -2
  37. package/dist/src/graph-ui/manager.css +19 -18
  38. package/dist/src/graph-ui/manager.js +11 -11
  39. package/dist/src/graph-ui/skill-picker.js +1 -1
  40. package/dist/src/graph-ui/studio-canvas.js +8 -8
  41. package/dist/src/graph-ui/studio.css +18 -15
  42. package/dist/src/graph-ui/studio.js +92 -35
  43. package/dist/src/graph-ui/style.css +122 -79
  44. package/dist/src/graph-ui/theme.js +2 -2
  45. package/dist/src/graph-ui/tokens.css +33 -29
  46. package/dist/src/graphs.d.ts +3 -2
  47. package/dist/src/graphs.js +3 -2
  48. package/dist/src/membership-errors.d.ts +7 -1
  49. package/dist/src/membership-errors.js +9 -3
  50. package/dist/src/pull-requests.d.ts +42 -6
  51. package/dist/src/pull-requests.js +11 -3
  52. package/dist/src/react-runtime.js +121 -14
  53. package/dist/src/read-document-doc.d.ts +20 -0
  54. package/dist/src/read-document-doc.js +524 -0
  55. package/dist/src/read-document-docx.d.ts +21 -0
  56. package/dist/src/read-document-docx.js +584 -0
  57. package/dist/src/read-document-text.d.ts +29 -0
  58. package/dist/src/read-document-text.js +67 -0
  59. package/dist/src/read-document-tool.d.ts +48 -0
  60. package/dist/src/read-document-tool.js +162 -0
  61. package/dist/src/read-document.d.ts +78 -0
  62. package/dist/src/read-document.js +353 -0
  63. package/dist/src/read-image.d.ts +29 -2
  64. package/dist/src/read-image.js +42 -17
  65. package/dist/src/runtime.d.ts +19 -0
  66. package/dist/src/runtime.js +10 -1
  67. package/dist/src/session-changes.d.ts +6 -1
  68. package/dist/src/session-changes.js +13 -5
  69. package/dist/src/side-panel.d.ts +6 -1
  70. package/dist/src/side-panel.js +12 -10
  71. package/dist/src/skills/bundled/create-skill/SKILL.md +1 -1
  72. package/dist/src/skills/bundled/diagram/SKILL.md +1 -1
  73. package/dist/src/skills/bundled/graph-manager/SKILL.md +37 -3
  74. package/dist/src/skills/bundled/graph-manager/patterns.md +27 -0
  75. package/dist/src/skills/bundled/provenance.json +4 -4
  76. package/dist/src/skills/runtime-skills.js +3 -3
  77. package/dist/src/stall-recovery.d.ts +6 -2
  78. package/dist/src/stall-recovery.js +7 -2
  79. package/dist/src/terminal-ui.js +2 -2
  80. package/dist/src/time-limit.d.ts +53 -0
  81. package/dist/src/time-limit.js +79 -0
  82. package/dist/src/tools.js +92 -7
  83. package/dist/src/transcript.js +1 -1
  84. package/dist/src/types.d.ts +6 -0
  85. package/dist/src/usage-analytics.d.ts +3 -1
  86. package/dist/src/usage-analytics.js +16 -2
  87. package/package.json +6 -26
  88. package/docs/README.md +0 -36
  89. package/docs/agents/README.md +0 -62
  90. package/docs/agents/install-for-agents.md +0 -56
  91. package/docs/agents/mcp-server.md +0 -212
  92. package/docs/agents/subagent-mode.md +0 -149
  93. package/docs/concepts/README.md +0 -47
  94. package/docs/concepts/jev-actionable-routing.md +0 -113
  95. package/docs/concepts/jev-decision-thresholds.md +0 -412
  96. package/docs/concepts/jev-efficiency.md +0 -217
  97. package/docs/concepts/jev-eval-2026-11-01.md +0 -78
  98. package/docs/concepts/limits.md +0 -52
  99. package/docs/concepts/memory.md +0 -10
  100. package/docs/concepts/security.md +0 -50
  101. package/docs/concepts/workspace-instructions.md +0 -29
  102. package/docs/getting-started/README.md +0 -82
  103. package/docs/getting-started/accounts.md +0 -78
  104. package/docs/getting-started/configure-providers.md +0 -132
  105. package/docs/guides/README.md +0 -13
  106. package/docs/guides/browser.md +0 -39
  107. package/docs/guides/desktop-app.md +0 -414
  108. package/docs/guides/extensions.md +0 -102
  109. package/docs/guides/graph-builder.md +0 -116
  110. package/docs/guides/headless.md +0 -46
  111. package/docs/guides/tui.md +0 -75
  112. package/docs/guides/update.md +0 -70
  113. package/docs/guides/web-search.md +0 -51
  114. package/docs/guides/windows-code-signing.md +0 -319
  115. package/docs/llms.txt +0 -45
  116. package/docs/reference/README.md +0 -7
  117. package/docs/reference/cli.md +0 -76
  118. package/docs/reference/config.md +0 -91
  119. package/docs/reference/slash-commands.md +0 -59
  120. package/docs/superpowers/plans/2026-11-01-claude-console-sign-in.md +0 -111
  121. package/docs/superpowers/plans/2026-11-01-jev-node-opt-in.md +0 -910
  122. package/docs/superpowers/plans/2026-11-02-workflow-pane.md +0 -398
  123. package/docs/superpowers/plans/2026-11-06-graph-soft-delete.md +0 -125
  124. package/docs/superpowers/plans/2026-11-09-orchestrator-delegation.md +0 -295
  125. package/docs/superpowers/plans/2026-11-13-graph-manager-chat.md +0 -203
  126. package/docs/superpowers/plans/2026-11-14-jev-fair-use-pricing.md +0 -79
  127. package/docs/superpowers/specs/2026-10-31-work-line-summary-design.md +0 -50
  128. package/docs/superpowers/specs/2026-11-01-claude-console-sign-in-design.md +0 -176
  129. package/docs/superpowers/specs/2026-11-01-jev-node-opt-in-design.md +0 -164
  130. package/docs/superpowers/specs/2026-11-01-pr-section-design.md +0 -111
  131. package/docs/superpowers/specs/2026-11-02-workflow-pane-design.md +0 -130
  132. package/docs/superpowers/specs/2026-11-06-bundled-skills-design.md +0 -206
  133. package/docs/superpowers/specs/2026-11-09-orchestrator-delegation-design.md +0 -291
  134. package/docs/superpowers/specs/2026-11-13-graph-manager-chat-design.md +0 -182
  135. package/docs/superpowers/specs/2026-11-14-jev-fair-use-pricing-design.md +0 -156
  136. package/scripts/jev-efficiency-eval.mjs +0 -187
  137. package/scripts/jev-efficiency-live.mjs +0 -193
  138. package/scripts/zcode-engine-replay.mjs +0 -223
  139. package/tests/agent-centric-mcp-test-plan.md +0 -208
  140. package/tests/analytics-settings-test-plan.md +0 -165
  141. package/tests/browser-cli-smoke.mjs +0 -276
  142. package/tests/browser-test-plan.md +0 -280
  143. package/tests/chat-side-panel-test-plan.md +0 -309
  144. package/tests/decision-engine-test-plan.md +0 -163
  145. package/tests/default-active-jev-test-plan.md +0 -85
  146. package/tests/harness-extensions-test-plan.md +0 -113
  147. package/tests/jev-all-decisions-test-plan.md +0 -156
  148. package/tests/jev-efficiency/criteria.json +0 -158
  149. package/tests/jev-efficiency/workloads.mjs +0 -242
  150. package/tests/jev-efficiency-test-plan.md +0 -198
  151. package/tests/permissions-sandbox-probe.mjs +0 -74
  152. package/tests/permissions-test-plan.md +0 -191
  153. package/tests/product-telemetry-test-plan.md +0 -536
  154. package/tests/thinking-stream-preview-test-plan.md +0 -136
  155. package/tests/zcode-react-engine-test-plan.md +0 -396
@@ -32,7 +32,7 @@ export function readManagerGraphRevision(id, graphDirectory) {
32
32
  }
33
33
  /** The largest request body the editor accepts for a graph, whether it is being saved or sent to Graph Manager. */
34
34
  const GRAPH_BODY_LIMIT = 512 * 1024;
35
- const MANAGER_TOO_LARGE = 'This workflow is too large to send to Workflow Manager.';
35
+ const MANAGER_TOO_LARGE = 'This graph is too large to send to Graph Manager.';
36
36
  const MANAGER_PING_MS = 15_000;
37
37
  /**
38
38
  * Reads a request body of at most `limit` bytes; undefined when it is larger. An oversized body is
@@ -363,11 +363,11 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
363
363
  }
364
364
  const graph = value.graph;
365
365
  if (!filled(value.provider) || !filled(value.model))
366
- throw new Error('Choose a model for Workflow Manager.');
366
+ throw new Error('Choose a model for Graph Manager.');
367
367
  if (!filled(value.text))
368
- throw new Error('Write a message for Workflow Manager.');
368
+ throw new Error('Write a message for Graph Manager.');
369
369
  if (graph === null || typeof graph !== 'object' || Array.isArray(graph) || typeof graph.id !== 'string' || typeof graph.name !== 'string')
370
- throw new Error('A message to Workflow Manager needs the open workflow.');
370
+ throw new Error('A message to Graph Manager needs the open graph.');
371
371
  accepted(managerChat().send({
372
372
  provider: value.provider, model: value.model, text: value.text,
373
373
  graph: graph, saved: value.saved === true,
@@ -465,7 +465,7 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
465
465
  const graphs = [];
466
466
  const graphMigrationErrors = [];
467
467
  const savedGraphs = await listGraphs(graphDirectory, (id, error) => {
468
- graphMigrationErrors.push({ id, name: id, error: error instanceof Error ? error.message : 'Workflow load failed' });
468
+ graphMigrationErrors.push({ id, name: id, error: error instanceof Error ? error.message : 'Graph load failed' });
469
469
  });
470
470
  const free = await freeTier();
471
471
  // Deleted graphs stay out of the editor; restoring one goes through the graph MCP server.
@@ -520,7 +520,7 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
520
520
  // The preset is bundled with the CLI: it has no storage to remove, and hiding it would
521
521
  // only last until the next launch.
522
522
  if (id === 'default') {
523
- reply(res, 400, { error: 'The bundled default workflow cannot be deleted.' });
523
+ reply(res, 400, { error: 'The bundled default graph cannot be deleted.' });
524
524
  return;
525
525
  }
526
526
  if (id === GRAPH_MANAGER_GRAPH_ID) {
@@ -550,7 +550,7 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
550
550
  }
551
551
  const body = await readBody(req, GRAPH_BODY_LIMIT);
552
552
  if (!body) {
553
- reply(res, 413, { error: 'Workflow exceeds 512 KiB' });
553
+ reply(res, 413, { error: 'Graph exceeds 512 KiB' });
554
554
  return;
555
555
  }
556
556
  const value = JSON.parse(body.toString('utf8'));
@@ -605,7 +605,7 @@ export async function startGraphServer(directory = configDirectory(), checkMembe
605
605
  // Stamping can add profile entries after the streamed body already passed the limit.
606
606
  const stamped = stampGraphProviderProfiles(graph, config);
607
607
  if (Buffer.byteLength(JSON.stringify(stamped)) > GRAPH_BODY_LIMIT) {
608
- reply(res, 413, { error: 'Workflow exceeds 512 KiB' });
608
+ reply(res, 413, { error: 'Graph exceeds 512 KiB' });
609
609
  return;
610
610
  }
611
611
  const expected = graph.revision === 0 ? null : graph.revision;
@@ -672,7 +672,7 @@ export async function deleteGraphWithTombstone(id, graphDirectory, directory, su
672
672
  // MCP server's delete tool applies the same check, so the editor cannot bypass it.
673
673
  const users = (await new AutomationStore(directory).list()).filter(job => job.execution?.graph === id);
674
674
  if (users.length)
675
- throw new Error('Workflow ' + id + ' is run by automation'
675
+ throw new Error('Graph ' + id + ' is run by automation'
676
676
  + (users.length === 1 ? ' ' : 's ') + users.map(job => '"' + job.name + '"').join(', ')
677
677
  + '. Change or remove ' + (users.length === 1 ? 'it' : 'them') + ' first.');
678
678
  if (sync) {
@@ -111,6 +111,14 @@ export declare class GraphSync {
111
111
  private request;
112
112
  private perform;
113
113
  private restoreDraft;
114
+ /**
115
+ * Whether this exact snapshot is already published here, read without the save lock. Revision
116
+ * files are immutable, so a published one cannot change under the read; anything less than a
117
+ * published copy with these exact contents — a missing or different file, an unpublished one past
118
+ * the latest pointer, a conflict — is left to the locked restore, which decides it. The conflict
119
+ * copy's id is derived from this snapshot's hash, so its receipt can only be this snapshot's.
120
+ */
121
+ private alreadyRestored;
114
122
  private restoreSnapshot;
115
123
  }
116
124
  /** What a caller needs from a sync it owns; a test supplies its own in place of a real one. */
@@ -642,7 +642,13 @@ export class GraphSync {
642
642
  }
643
643
  async perform() {
644
644
  this.deadline = this.now() + 20_000;
645
- this.status = { state: 'syncing', detail: 'Saving graphs to your account…' };
645
+ // The timer re-checks an account that is already in sync every 30 seconds, and the local sweep
646
+ // takes several passes to visit every file. Saying "Saving…" and then "will resume" for each of
647
+ // them would take back a verdict nothing has changed: while a pass sends nothing, the account
648
+ // stays synced. A save or delete replaces this object, and so does the first upload of the pass
649
+ // (a revision save marks nothing pending), so a change during the pass is reported.
650
+ const recheck = this.status.state === 'synced' ? this.status : undefined;
651
+ this.status = recheck ?? { state: 'syncing', detail: 'Saving graphs to your account…' };
646
652
  // Repair interrupted local deletions before network authorization: even an offline machine
647
653
  // must not show a graph whose tombstone was committed before a crash. A save that landed
648
654
  // after that tombstone is revived rather than removed.
@@ -718,6 +724,8 @@ export class GraphSync {
718
724
  if (options.confirm || !await this.cached(hash)) {
719
725
  // A refused snapshot stays on this machine and is offered again on a later sweep, so an
720
726
  // upgraded account uploads it then.
727
+ if (this.status === recheck)
728
+ this.status = { state: 'syncing', detail: 'Saving graphs to your account…' };
721
729
  try {
722
730
  await this.request(`/${hash}${options.pin ? '?pin=1' : ''}`, token, raw);
723
731
  }
@@ -865,7 +873,16 @@ export class GraphSync {
865
873
  ? await readFile(join(this.folder, 'snapshots', `${hash}.json`), 'utf8')
866
874
  : await this.request(`/${hash}`, token);
867
875
  // A cloud receipt proves upload, not that its user-visible copy still exists.
868
- await this.restoreSnapshot(raw, hash, receipts, deleted);
876
+ // A graph another window's sweep or a save is writing right now is not a sync failure:
877
+ // the checkpoint keeps this snapshot first, and the next pass restores it.
878
+ try {
879
+ await this.restoreSnapshot(raw, hash, receipts, deleted);
880
+ }
881
+ catch (error) {
882
+ if (error instanceof SaveLockBusyError)
883
+ throw new SyncPaused();
884
+ throw error;
885
+ }
869
886
  progress.page.remaining.shift();
870
887
  await atomic(progressPath, JSON.stringify(progress));
871
888
  }
@@ -879,7 +896,7 @@ export class GraphSync {
879
896
  ? { state: 'offline', detail: `${refused.size} graph change(s) exceed the free tier and were saved on this computer only. Upgrade to Premium to sync them.` }
880
897
  : invalidLocalFiles
881
898
  ? { state: 'offline', detail: `${invalidLocalFiles} local graph file(s) could not be read. Other graphs synchronized; original files preserved.` }
882
- : !localComplete ? { state: 'pending', detail: 'Saved locally; local history sync will resume automatically.' }
899
+ : !localComplete && !(recheck !== undefined && this.status === recheck) ? { state: 'pending', detail: 'Saved locally; local history sync will resume automatically.' }
883
900
  : { state: 'synced', detail: 'Graphs saved locally and to your account' };
884
901
  }
885
902
  async restoreDraft(raw, hash) {
@@ -898,6 +915,32 @@ export class GraphSync {
898
915
  }
899
916
  await immutable(path, raw);
900
917
  }
918
+ /**
919
+ * Whether this exact snapshot is already published here, read without the save lock. Revision
920
+ * files are immutable, so a published one cannot change under the read; anything less than a
921
+ * published copy with these exact contents — a missing or different file, an unpublished one past
922
+ * the latest pointer, a conflict — is left to the locked restore, which decides it. The conflict
923
+ * copy's id is derived from this snapshot's hash, so its receipt can only be this snapshot's.
924
+ */
925
+ async alreadyRestored(graph, hash, receipts) {
926
+ const published = async (id, matches) => {
927
+ try {
928
+ const folder = join(this.directory, 'graphs', id);
929
+ const latest = JSON.parse(await readFile(join(folder, 'latest.json'), 'utf8'));
930
+ if (!Number.isSafeInteger(latest) || latest < graph.revision)
931
+ return false;
932
+ return matches(await readFile(join(folder, `${graph.revision}.json`), 'utf8'));
933
+ }
934
+ catch {
935
+ return false;
936
+ }
937
+ };
938
+ if (await published(graph.id, raw => digest(envelope('revision', JSON.parse(raw))) === hash))
939
+ return true;
940
+ const conflict = `cloud-${hash.slice(0, 40)}`;
941
+ const path = join(this.directory, 'graphs', conflict, `${graph.revision}.json`);
942
+ return receipts[path] !== undefined && await published(conflict, raw => digest(raw) === receipts[path]);
943
+ }
901
944
  async restoreSnapshot(raw, hash, receipts, deleted) {
902
945
  const value = parseSnapshot(raw, hash);
903
946
  // A graph deleted on this machine stays deleted: its snapshots stay cached but restore no
@@ -918,6 +961,14 @@ export class GraphSync {
918
961
  await immutable(join(this.folder, 'snapshots', `${hash}.json`), raw);
919
962
  return;
920
963
  }
964
+ // Every sweep visits every snapshot the account holds, and a restore takes the graph's save
965
+ // lock. A revision this machine already holds needs no restore, so it must not take the lock:
966
+ // each window's engine runs its own sweep, and hundreds of needless locks per pass made the
967
+ // sweeps collide with each other and with the user's saves until no pass could finish.
968
+ if (await this.alreadyRestored(graph, hash, receipts)) {
969
+ await immutable(join(this.folder, 'snapshots', `${hash}.json`), raw);
970
+ return;
971
+ }
921
972
  // The guard re-reads the tombstone file under the graph's save lock, so a delete that landed
922
973
  // while this pass was running is honored even though this pass read an older verdict.
923
974
  let restored = true;
@@ -85,7 +85,7 @@ export function createGraphTool(pool = sharedPool) {
85
85
  name: 'graphs', capability: 'external', executionMode: 'sequential',
86
86
  description: 'Create, edit, validate, publish, delete or restore Andorra graphs (multi-agent workflows) in the signed-in account\'s graph store, the same store the Graph Builder and graph picker use. Never write graph files on disk. '
87
87
  + 'Call action andorra_graph_guide first for node types, ports, limits and error codes; load the skill andorra:graph-manager to design a graph with the user. '
88
- + 'Put the action\'s arguments in args. Drafts are kept in this Andorra process for up to an hour; publish saves a revision and syncs it to the account. Publish, delete and restore ask for permission. '
88
+ + 'Put the action\'s arguments in args. Drafts are kept in this Andorra process for up to an hour; publish saves a revision and syncs it to the account. Publish, delete and restore ask the user for permission, except under Full Access, which approves them without a prompt; never tell the user a prompt is coming when the task runs in Full Access. '
89
89
  + `Actions and their args (* required): ${actionSummary()}.`,
90
90
  parameters: { type: 'object', additionalProperties: false, properties: {
91
91
  action: { type: 'string', enum: ACTIONS },