@andorra-labs/code 0.1.5 → 0.1.7

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 (224) hide show
  1. package/dist/src/account-presentation.js +3 -3
  2. package/dist/src/agent-execution.d.ts +2 -0
  3. package/dist/src/agent-execution.js +526 -41
  4. package/dist/src/agent-mcp-catalog.d.ts +21 -0
  5. package/dist/src/agent-mcp-catalog.js +40 -0
  6. package/dist/src/agent-mcp.d.ts +36 -3
  7. package/dist/src/agent-mcp.js +114 -45
  8. package/dist/src/app-server/protocol.d.ts +57 -5
  9. package/dist/src/app-server/protocol.js +18 -1
  10. package/dist/src/app-server/workspace.d.ts +9 -1
  11. package/dist/src/app-server/workspace.js +50 -3
  12. package/dist/src/app-server.d.ts +115 -41
  13. package/dist/src/app-server.js +1316 -221
  14. package/dist/src/auth/AuthManager.d.ts +33 -1
  15. package/dist/src/auth/AuthManager.js +138 -10
  16. package/dist/src/auth/callback-page.d.ts +4 -0
  17. package/dist/src/auth/callback-page.js +70 -0
  18. package/dist/src/auth/callback.d.ts +39 -0
  19. package/dist/src/auth/callback.js +146 -22
  20. package/dist/src/auth/index.d.ts +10 -6
  21. package/dist/src/auth/index.js +2 -2
  22. package/dist/src/auth/store.d.ts +142 -3
  23. package/dist/src/auth/store.js +334 -13
  24. package/dist/src/auth/types.d.ts +17 -1
  25. package/dist/src/auth-commands.d.ts +11 -2
  26. package/dist/src/auth-commands.js +14 -7
  27. package/dist/src/automation-runner.d.ts +9 -0
  28. package/dist/src/automation-runner.js +22 -1
  29. package/dist/src/automation-tool.js +18 -3
  30. package/dist/src/automations.d.ts +5 -0
  31. package/dist/src/automations.js +11 -1
  32. package/dist/src/browser-captcha-tool.d.ts +54 -0
  33. package/dist/src/browser-captcha-tool.js +374 -0
  34. package/dist/src/browser-panel-tool.d.ts +7 -0
  35. package/dist/src/browser-panel-tool.js +74 -3
  36. package/dist/src/browser-runner.js +19 -4
  37. package/dist/src/browser-server.js +21 -1
  38. package/dist/src/browser-session.d.ts +16 -0
  39. package/dist/src/browser-session.js +35 -0
  40. package/dist/src/browser-ui/app.js +193 -3
  41. package/dist/src/browser-ui/style.css +15 -1
  42. package/dist/src/browser-view.d.ts +72 -4
  43. package/dist/src/browser-view.js +229 -17
  44. package/dist/src/capabilities.d.ts +9 -3
  45. package/dist/src/capabilities.js +20 -5
  46. package/dist/src/capsolver.d.ts +60 -0
  47. package/dist/src/capsolver.js +101 -0
  48. package/dist/src/claude-provider.d.ts +6 -0
  49. package/dist/src/claude-provider.js +34 -3
  50. package/dist/src/cli-executable.d.ts +33 -0
  51. package/dist/src/cli-executable.js +64 -0
  52. package/dist/src/cli-process.d.ts +47 -0
  53. package/dist/src/cli-process.js +113 -0
  54. package/dist/src/cli-sign-in.d.ts +68 -0
  55. package/dist/src/cli-sign-in.js +224 -0
  56. package/dist/src/cli.js +84 -26
  57. package/dist/src/code-intelligence/CodeIntelligenceManager.d.ts +1 -1
  58. package/dist/src/code-intelligence/CodeIntelligenceManager.js +5 -5
  59. package/dist/src/codex-provider.js +12 -0
  60. package/dist/src/coding-tools.d.ts +5 -0
  61. package/dist/src/coding-tools.js +98 -53
  62. package/dist/src/command-output-tap.d.ts +16 -0
  63. package/dist/src/command-output-tap.js +45 -0
  64. package/dist/src/command-screens.js +3 -3
  65. package/dist/src/commands.d.ts +15 -2
  66. package/dist/src/commands.js +14 -13
  67. package/dist/src/completion.d.ts +23 -5
  68. package/dist/src/completion.js +380 -17
  69. package/dist/src/config.d.ts +61 -0
  70. package/dist/src/config.js +276 -12
  71. package/dist/src/context-budget.d.ts +7 -0
  72. package/dist/src/context-budget.js +18 -1
  73. package/dist/src/deadline.js +6 -0
  74. package/dist/src/decision/FactContinuations.d.ts +41 -6
  75. package/dist/src/decision/FactContinuations.js +211 -64
  76. package/dist/src/decision/PreparedSteps.js +3 -1
  77. package/dist/src/decision/checks.d.ts +25 -0
  78. package/dist/src/decision/checks.js +77 -6
  79. package/dist/src/delegation-changes.d.ts +109 -0
  80. package/dist/src/delegation-changes.js +431 -0
  81. package/dist/src/extensions.d.ts +1 -0
  82. package/dist/src/extensions.js +16 -3
  83. package/dist/src/graph-provider-portability.js +2 -2
  84. package/dist/src/graph-quota.d.ts +1 -1
  85. package/dist/src/graph-quota.js +1 -1
  86. package/dist/src/graph-runner.js +35 -21
  87. package/dist/src/graph-selection.d.ts +6 -0
  88. package/dist/src/graph-selection.js +10 -0
  89. package/dist/src/graph-server.d.ts +8 -0
  90. package/dist/src/graph-server.js +76 -6
  91. package/dist/src/graph-sync.d.ts +65 -0
  92. package/dist/src/graph-sync.js +433 -13
  93. package/dist/src/graph-tool.d.ts +52 -0
  94. package/dist/src/graph-tool.js +136 -0
  95. package/dist/src/graph-ui/app.js +272 -50
  96. package/dist/src/graph-ui/controls.js +6 -0
  97. package/dist/src/graph-ui/drafts.js +39 -0
  98. package/dist/src/graph-ui/embed.js +1 -1
  99. package/dist/src/graph-ui/icons.js +1 -0
  100. package/dist/src/graph-ui/index.html +2 -2
  101. package/dist/src/graph-ui/skill-picker.js +242 -0
  102. package/dist/src/graph-ui/studio.css +7 -5
  103. package/dist/src/graph-ui/style.css +65 -12
  104. package/dist/src/graphs.d.ts +60 -5
  105. package/dist/src/graphs.js +191 -37
  106. package/dist/src/grok-provider.d.ts +50 -0
  107. package/dist/src/grok-provider.js +186 -0
  108. package/dist/src/handoffs.d.ts +13 -0
  109. package/dist/src/handoffs.js +31 -1
  110. package/dist/src/hardened-runtime.d.ts +4 -4
  111. package/dist/src/hardened-runtime.js +109 -9
  112. package/dist/src/managed-sign-in.d.ts +38 -0
  113. package/dist/src/managed-sign-in.js +169 -0
  114. package/dist/src/markdown.d.ts +5 -0
  115. package/dist/src/markdown.js +5 -2
  116. package/dist/src/mcp.js +11 -0
  117. package/dist/src/membership.d.ts +8 -1
  118. package/dist/src/membership.js +15 -5
  119. package/dist/src/model-metadata.js +14 -2
  120. package/dist/src/model-override.d.ts +10 -0
  121. package/dist/src/model-override.js +20 -0
  122. package/dist/src/opencode-cli-provider.d.ts +122 -0
  123. package/dist/src/opencode-cli-provider.js +415 -0
  124. package/dist/src/opencode-provider.js +23 -8
  125. package/dist/src/palette.d.ts +2 -0
  126. package/dist/src/palette.js +2 -0
  127. package/dist/src/permissions.d.ts +19 -1
  128. package/dist/src/permissions.js +30 -1
  129. package/dist/src/powershell-pool.d.ts +11 -2
  130. package/dist/src/powershell-pool.js +34 -5
  131. package/dist/src/provider-connection.js +36 -0
  132. package/dist/src/provider-engine.d.ts +2 -1
  133. package/dist/src/provider-engine.js +64 -13
  134. package/dist/src/provider-import.js +6 -1
  135. package/dist/src/provider-keys.d.ts +48 -0
  136. package/dist/src/provider-keys.js +121 -0
  137. package/dist/src/provider-settings.js +22 -3
  138. package/dist/src/providers.d.ts +12 -1
  139. package/dist/src/providers.js +27 -8
  140. package/dist/src/pull-requests.d.ts +123 -20
  141. package/dist/src/pull-requests.js +334 -84
  142. package/dist/src/qa/qa-authorize.js +9 -1
  143. package/dist/src/qa/runtime/ProcessManager.d.ts +6 -0
  144. package/dist/src/qa/runtime/ProcessManager.js +16 -0
  145. package/dist/src/react-runtime.js +106 -7
  146. package/dist/src/read-image.d.ts +30 -0
  147. package/dist/src/read-image.js +97 -0
  148. package/dist/src/remote/engine-pool.js +1 -1
  149. package/dist/src/run-progress.js +6 -1
  150. package/dist/src/run-records.d.ts +133 -27
  151. package/dist/src/run-records.js +320 -40
  152. package/dist/src/runtime.d.ts +38 -1
  153. package/dist/src/runtime.js +27 -4
  154. package/dist/src/save-lock.d.ts +11 -0
  155. package/dist/src/save-lock.js +29 -2
  156. package/dist/src/secret-redaction.d.ts +13 -0
  157. package/dist/src/secret-redaction.js +71 -0
  158. package/dist/src/session-summary.d.ts +10 -4
  159. package/dist/src/session-summary.js +14 -7
  160. package/dist/src/sessions.js +8 -2
  161. package/dist/src/shell.js +4 -1
  162. package/dist/src/side-panel.d.ts +1 -1
  163. package/dist/src/side-panel.js +1 -1
  164. package/dist/src/skill-commands.d.ts +2 -0
  165. package/dist/src/skill-commands.js +2 -0
  166. package/dist/src/skills/bundled/create-agent/SKILL.md +81 -0
  167. package/dist/src/skills/bundled/create-skill/SKILL.md +81 -0
  168. package/dist/src/skills/bundled/doctor/SKILL.md +43 -0
  169. package/dist/src/skills/bundled/graph-manager/SKILL.md +100 -0
  170. package/dist/src/skills/bundled/graph-manager/errors.md +38 -0
  171. package/dist/src/skills/bundled/graph-manager/patterns.md +78 -0
  172. package/dist/src/skills/bundled/manage-mcp/SKILL.md +75 -0
  173. package/dist/src/skills/bundled/manage-mcp/probe.md +165 -0
  174. package/dist/src/skills/bundled/manage-skills/SKILL.md +67 -0
  175. package/dist/src/skills/bundled/provenance.json +50 -0
  176. package/dist/src/skills/bundled/write-instructions/SKILL.md +42 -0
  177. package/dist/src/skills/invocable-skills.d.ts +41 -0
  178. package/dist/src/skills/invocable-skills.js +49 -0
  179. package/dist/src/skills/prompt-skills.d.ts +1 -0
  180. package/dist/src/skills/prompt-skills.js +33 -0
  181. package/dist/src/skills/runtime-skills.d.ts +4 -0
  182. package/dist/src/skills/runtime-skills.js +21 -0
  183. package/dist/src/structured-step.d.ts +55 -0
  184. package/dist/src/structured-step.js +85 -0
  185. package/dist/src/subagent-run.d.ts +1 -1
  186. package/dist/src/subagent-run.js +29 -33
  187. package/dist/src/telemetry/schema.d.ts +2 -2
  188. package/dist/src/telemetry/schema.js +3 -2
  189. package/dist/src/terminal-ui.d.ts +38 -0
  190. package/dist/src/terminal-ui.js +126 -28
  191. package/dist/src/timers.d.ts +21 -2
  192. package/dist/src/timers.js +12 -4
  193. package/dist/src/tool-dependencies.js +4 -0
  194. package/dist/src/tool-names.d.ts +18 -0
  195. package/dist/src/tool-names.js +26 -0
  196. package/dist/src/tools.d.ts +9 -0
  197. package/dist/src/tools.js +159 -20
  198. package/dist/src/trajectory.js +32 -12
  199. package/dist/src/transcript.js +5 -0
  200. package/dist/src/types.d.ts +36 -0
  201. package/dist/src/web-search.d.ts +59 -0
  202. package/dist/src/web-search.js +216 -0
  203. package/docs/agents/README.md +2 -2
  204. package/docs/agents/mcp-server.md +28 -3
  205. package/docs/agents/subagent-mode.md +7 -4
  206. package/docs/concepts/README.md +1 -1
  207. package/docs/concepts/security.md +4 -2
  208. package/docs/getting-started/accounts.md +15 -4
  209. package/docs/getting-started/configure-providers.md +30 -3
  210. package/docs/guides/README.md +1 -0
  211. package/docs/guides/browser.md +12 -0
  212. package/docs/guides/desktop-app.md +11 -4
  213. package/docs/guides/graph-builder.md +9 -1
  214. package/docs/guides/web-search.md +47 -0
  215. package/docs/reference/cli.md +4 -3
  216. package/docs/reference/config.md +4 -4
  217. package/docs/reference/slash-commands.md +2 -1
  218. package/docs/superpowers/plans/2026-11-06-graph-soft-delete.md +125 -0
  219. package/docs/superpowers/plans/2026-11-09-orchestrator-delegation.md +295 -0
  220. package/docs/superpowers/specs/2026-11-01-pr-section-design.md +7 -0
  221. package/docs/superpowers/specs/2026-11-06-bundled-skills-design.md +206 -0
  222. package/docs/superpowers/specs/2026-11-09-orchestrator-delegation-design.md +291 -0
  223. package/package.json +1 -1
  224. package/tests/permissions-test-plan.md +2 -1
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Credential material a user pastes beside a task is work order, not a label: it must never reach
3
+ * a naming model or a rail row. Redaction replaces a value a secret label introduces (`password is
4
+ * "x"`, `token: x`), a recognizable token shape, and a long unbroken run of key material with a
5
+ * placeholder — the label itself stays, so the text still reads as a summary of the ask. Model
6
+ * names, paths, and ordinary prose survive: they carry separators a key run does not.
7
+ *
8
+ * A labeled value is consumed in full regardless of its length: a three-character password is
9
+ * still a credential, and a tail left behind a length cap is still a leak. The cost of that is a
10
+ * garbled word in rare prose that uses the connector ("password is the problem"), which is
11
+ * preferable to the leak.
12
+ */
13
+ /** Words whose next value is treated as the secret itself. */
14
+ const SECRET_LABELS = String.raw `password|passwd|pwd|passcode|pass\s?phrase|secret|api[\s_-]?key|apikey|access[\s_-]?token|auth[\s_-]?token|client[\s_-]?secret|private[\s_-]?key|refresh[\s_-]?token|token`;
15
+ /** A value wrapped in any quote style the codebase sees pasted, with no length cap. A backslash
16
+ * inside the value escapes the next character, so an escaped quote (JSON's `\"`) is part of the
17
+ * value and does not end it: the whole credential is consumed, never a head alone. */
18
+ // A value may span lines (YAML and dotenv allow multiline quoted values), so it runs to its closing
19
+ // delimiter, and an escape may precede a line break. A doubled apostrophe inside a single-quoted
20
+ // value is YAML's escaped apostrophe, not the closing delimiter.
21
+ const SECRET_QUOTED = '"(?:[^"\\\\]|\\\\[^])*"|\'(?:[^\'\\\\]|\\\\[^]|\'\')*\'|`(?:[^`\\\\]|\\\\[^])*`|\u201c(?:[^\u201d\\\\]|\\\\[^])*\u201d|\u2018(?:[^\u2019\\\\]|\\\\[^])*\u2019';
22
+ // A credential whose key itself is quoted (`"password": "x"`, `'api_key': 'y'`, TOML `"token" = "x"`):
23
+ // the key and its separator stay so pasted JSON keeps its shape, and only the value is replaced. The
24
+ // unquoted alternative also covers a bare value after a quoted key (`"password": hunter2`).
25
+ const QUOTED_KEY = new RegExp('(["\'\u201c\u2018])([A-Za-z0-9_-]*?(?:' + SECRET_LABELS + '))(["\'\u201d\u2019])(\\s*[:=]\\s*)(' + SECRET_QUOTED + '|[^\\s,;}\\]]+)', 'gi');
26
+ // A label directly inside quotes is a quoted key the rule above owns — never a prose label — so the
27
+ // label rules below refuse labels that a quote character precedes; without that, the quoted-value
28
+ // pattern would mistake a JSON key's closing quote for the start of a quoted secret and leave the
29
+ // value behind (`{"password": "hunter2"}` redacted to `{"password[redacted]hunter2"}`). A backtick
30
+ // is not a key quote: Markdown inline code (`` `password=hunter2` ``) wraps an assignment, so it stays a label.
31
+ // A label backticked on its own (`` `password` and `foo` ``) is still a mentioned word, though: the
32
+ // second lookbehind refuses it so the span between two inline-code wrappers is never taken as a value.
33
+ const IN_QUOTE = '(?<!["\'\u201c\u2018])(?<!`(?=(?:' + SECRET_LABELS + ')`))';
34
+ // A connector is optional only in front of a quoted value: `password is "x"`, `token: x`, and
35
+ // `pass "x"` all redact, while `the access token used by the client` stays whole — a label with
36
+ // no value after it is prose about credentials, not credentials. Whitespace after the label is consumed
37
+ // once, then the connector and its own trailing whitespace: two adjacent `\s*` around an optional
38
+ // connector would repartition a long whitespace run quadratically.
39
+ // A label may end an environment-style name (`DB_PASSWORD=x`, `STRIPE_API_KEY: x`): an underscore or
40
+ // hyphen before it is a name prefix, not part of a longer word, so only a letter or digit refuses it.
41
+ const LABEL_START = '(?<![A-Za-z0-9])';
42
+ // A label a quote closes is a quoted key (`"db_password": "x"`) that QUOTED_KEY owns.
43
+ const KEY_CLOSE = '(?!["\'”’])';
44
+ const QUOTED_AFTER_LABEL = new RegExp(IN_QUOTE + LABEL_START + '(' + SECRET_LABELS + ')\\b' + KEY_CLOSE + '(\\s*(?:(?:is|are|=|:|\u2014|\u2013)\\s*)?)(' + SECRET_QUOTED + ')', 'gi');
45
+ // A YAML literal or folded block scalar (`password: |` / `token: >-`) carries the credential on the
46
+ // indented lines below the indicator; the whole indented block is the value, not the indicator alone.
47
+ // A header comment may follow the indicator (`password: | # deploy secret`).
48
+ const BLOCK_SCALAR_AFTER_LABEL = new RegExp(IN_QUOTE + LABEL_START + '(' + SECRET_LABELS + ')\\b' + KEY_CLOSE + '[ \\t]*:[ \\t]*[|>][+-]?[0-9]?[+-]?[ \\t]*(?:#[^\\r\\n]*)?(?:\\r?\\n[ \\t]+[^\\r\\n]*)+', 'gi');
49
+ const VALUE_AFTER_LABEL = new RegExp(IN_QUOTE + LABEL_START + '(' + SECRET_LABELS + ')\\b' + KEY_CLOSE + '\\s*(?:is|are|=|:)\\s*([^\\s"\'`\u201c\u201d\u2018\u2019]+)', 'gi');
50
+ /** Token shapes that are credentials even with no label around them. */
51
+ const TOKEN_SHAPES = /\b(?:sk-[A-Za-z0-9_-]{8,}|gh[pousr]_[A-Za-z0-9]{16,}|github_pat_[A-Za-z0-9_]{16,}|AKIA[0-9A-Z]{12,}|ASIA[0-9A-Z]{12,}|xox[baprs]-[A-Za-z0-9-]{10,}|eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{5,}\.[A-Za-z0-9_-]{5,})\b/g;
52
+ const BEARER = /\bBearer\s+[A-Za-z0-9._~+/=-]{8,}/gi;
53
+ // A long unbroken run of key material (hex or base64, no separators) is a secret even unlabeled;
54
+ // model names and paths carry separators, so they survive this cut.
55
+ const KEY_RUN = /[A-Za-z0-9+/=]{32,}/g;
56
+ export const redactSecrets = (text) => text
57
+ .replace(QUOTED_KEY, (_all, open, label, close, sep, value) => {
58
+ // In a code paste the value's quotes are syntax, not wrapping prose: keep them so the JSON
59
+ // (or TOML/YAML) still parses as a quoted string, with only the credential inside replaced.
60
+ const first = value.slice(0, 1), last = value.slice(-1);
61
+ const wrapped = value.length >= 2
62
+ && ((first === '"' && last === '"') || (first === "'" && last === "'") || (first === '`' && last === '`')
63
+ || (first === '\u201c' && last === '\u201d') || (first === '\u2018' && last === '\u2019'));
64
+ return `${open}${label}${close}${sep}${wrapped ? `${first}[redacted]${last}` : '[redacted]'}`;
65
+ })
66
+ .replace(QUOTED_AFTER_LABEL, (_all, label, gap) => `${label}${gap}[redacted]`)
67
+ .replace(BLOCK_SCALAR_AFTER_LABEL, (_all, label) => `${label}: [redacted]`)
68
+ .replace(VALUE_AFTER_LABEL, (_all, label) => `${label}: [redacted]`)
69
+ .replace(TOKEN_SHAPES, '[redacted]')
70
+ .replace(BEARER, 'Bearer [redacted]')
71
+ .replace(KEY_RUN, '[redacted]');
@@ -3,11 +3,12 @@ import type { ModelAdapter } from './types.js';
3
3
  /**
4
4
  * Whether a title request can be bounded for this provider.
5
5
  *
6
- * The Codex adapter never reads `maxTokens`: a title request there is a full reasoning turn that
7
- * runs beside the real one until its signal deadline, so an unbounded auxiliary request would cost
8
- * more than the local name it replaces. Those sessions keep the local name.
6
+ * Every supported adapter bounds an auxiliary turn itself: the adapters that read `maxTokens`
7
+ * natively, and the Codex adapter by running the naming turn with minimal reasoning effort on a
8
+ * dedicated ephemeral thread (the installed Codex CLI exposes no token-level output bound), with
9
+ * this deadline as the outer bound. No provider has to keep the local word-slice name.
9
10
  */
10
- export declare const titleRequestSupported: (provider: Pick<ProviderConfig, "type">) => boolean;
11
+ export declare const titleRequestSupported: (_provider: Pick<ProviderConfig, "type">) => boolean;
11
12
  /**
12
13
  * How long a naming request may take. The session already carries its local name, so this is only
13
14
  * the wait before a slow provider's better name replaces it: a bound past the provider's own
@@ -21,6 +22,11 @@ export declare const MAX_SESSION_TITLE_CHARS = 80;
21
22
  * what the user asked for rather than the first words cut off. Resolves `''` whenever no usable
22
23
  * title came back — provider missing, offline, timeout, empty answer — and the caller keeps the
23
24
  * local name. The signal only cancels the request; a settled title is always safe to use.
25
+ *
26
+ * Credential material is redacted on both sides: the prompt is redacted before it leaves the
27
+ * process, so the naming request never carries a secret, and the answer is redacted before it
28
+ * becomes a title, so a model that echoed one back never puts it on the rail. A prompt or answer
29
+ * that redacts to nothing keeps the local name.
24
30
  */
25
31
  export declare function summarizeSessionPrompt(prompt: string, adapter: ModelAdapter, model: string, signal?: AbortSignal): Promise<string>;
26
32
  /** Normalize a model answer into one displayable line; `''` when nothing usable came back. */
@@ -1,12 +1,14 @@
1
1
  import { stripVTControlCharacters } from 'node:util';
2
+ import { redactSecrets } from './secret-redaction.js';
2
3
  /**
3
4
  * Whether a title request can be bounded for this provider.
4
5
  *
5
- * The Codex adapter never reads `maxTokens`: a title request there is a full reasoning turn that
6
- * runs beside the real one until its signal deadline, so an unbounded auxiliary request would cost
7
- * more than the local name it replaces. Those sessions keep the local name.
6
+ * Every supported adapter bounds an auxiliary turn itself: the adapters that read `maxTokens`
7
+ * natively, and the Codex adapter by running the naming turn with minimal reasoning effort on a
8
+ * dedicated ephemeral thread (the installed Codex CLI exposes no token-level output bound), with
9
+ * this deadline as the outer bound. No provider has to keep the local word-slice name.
8
10
  */
9
- export const titleRequestSupported = (provider) => provider.type !== 'codex';
11
+ export const titleRequestSupported = (_provider) => true;
10
12
  /**
11
13
  * How long a naming request may take. The session already carries its local name, so this is only
12
14
  * the wait before a slow provider's better name replaces it: a bound past the provider's own
@@ -21,6 +23,11 @@ const MAX_PROMPT_CHARS = 4_000;
21
23
  * what the user asked for rather than the first words cut off. Resolves `''` whenever no usable
22
24
  * title came back — provider missing, offline, timeout, empty answer — and the caller keeps the
23
25
  * local name. The signal only cancels the request; a settled title is always safe to use.
26
+ *
27
+ * Credential material is redacted on both sides: the prompt is redacted before it leaves the
28
+ * process, so the naming request never carries a secret, and the answer is redacted before it
29
+ * becomes a title, so a model that echoed one back never puts it on the rail. A prompt or answer
30
+ * that redacts to nothing keeps the local name.
24
31
  */
25
32
  export async function summarizeSessionPrompt(prompt, adapter, model, signal) {
26
33
  const clean = stripVTControlCharacters(prompt).trim();
@@ -30,11 +37,11 @@ export async function summarizeSessionPrompt(prompt, adapter, model, signal) {
30
37
  const response = await adapter.generate({
31
38
  model, signal: bounded, tools: [], maxTokens: 512,
32
39
  messages: [
33
- { role: 'system', content: 'You name coding sessions. Answer with the session title only: 3 to 8 words summarizing what the user asked for, in the same language as the prompt. No quotes, no preamble, no ending punctuation.' },
34
- { role: 'user', content: `A coding session starts with this prompt. Give it its title.\n\n${clean.slice(0, MAX_PROMPT_CHARS)}` },
40
+ { role: 'system', content: 'You name coding sessions. Answer with the session title only: 3 to 8 words summarizing what the user asked for, in the same language as the prompt. No quotes, no preamble, no ending punctuation. Never include a password, API key, token, or other credential in the title.' },
41
+ { role: 'user', content: `A coding session starts with this prompt. Give it its title.\n\n${redactSecrets(clean).slice(0, MAX_PROMPT_CHARS)}` },
35
42
  ],
36
43
  });
37
- return titleFromSummary(response.text);
44
+ return titleFromSummary(redactSecrets(response.text));
38
45
  }
39
46
  /** Normalize a model answer into one displayable line; `''` when nothing usable came back. */
40
47
  export function titleFromSummary(text) {
@@ -5,9 +5,12 @@ import { join, resolve } from 'node:path';
5
5
  import { stripVTControlCharacters } from 'node:util';
6
6
  import { setTimeout as delay } from 'node:timers/promises';
7
7
  import { decodeDoubleEscapedSummary } from './completion.js';
8
+ import { redactSecrets } from './secret-redaction.js';
8
9
  /** Extract a short local task label without a model request. */
9
10
  export const sessionName = (prompt) => {
10
- const clean = stripVTControlCharacters(prompt)
11
+ // The label is what the rail shows until a model title replaces it (and forever when naming
12
+ // fails), so credential material pasted beside the task must never survive into it.
13
+ const clean = redactSecrets(stripVTControlCharacters(prompt))
11
14
  .replace(/https?:\/\/\S+/gi, ' ')
12
15
  .replace(/[a-z]:[\\/][^\s"<>|]*/gi, ' ')
13
16
  .replace(/(?:^|\s)[/~][\w./-]+/g, ' ')
@@ -174,7 +177,10 @@ export function validSavedSession(value) {
174
177
  const counter = value[key];
175
178
  return typeof counter === 'number' && Number.isFinite(counter) && counter >= 0;
176
179
  })
177
- && validCounter(value.cacheRead) && validCounter(value.cacheWrite);
180
+ && validCounter(value.cacheRead) && validCounter(value.cacheWrite)
181
+ && validCounter(value.localCacheInputTokens)
182
+ && validCounter(value.localCacheReadTokens)
183
+ && (value.localCacheReadTokens ?? 0) <= (value.localCacheInputTokens ?? 0);
178
184
  // A lineage's points are cumulative snapshots of the work: each one is at least the one before
179
185
  // it, none of them is more than the record's own totals, and none of them counts more turns
180
186
  // than the record has. A record that breaks these would make the totals drop a turn or a
package/dist/src/shell.js CHANGED
@@ -121,7 +121,10 @@ async function stopPosix(child, marker) {
121
121
  /** Cleanup runs in the host: never discover its executable through cwd or PATH. */
122
122
  export async function resolveTrustedTaskkill(workspace, env = process.env) {
123
123
  const failure = () => new Error('Shell cleanup requires a validated absolute SystemRoot\\System32\\taskkill.exe outside the workspace. No PATH fallback is allowed.');
124
- const systemRoot = env.SystemRoot;
124
+ // Windows variable names ignore case, but a plain-object copy of the environment keeps the spelling
125
+ // it was given: Git Bash exports SYSTEMROOT. Spellings that disagree are ambiguous and refused.
126
+ const spellings = new Set(Object.entries(env).filter(([key]) => key.toLowerCase() === 'systemroot').map(([, value]) => value));
127
+ const systemRoot = spellings.size === 1 ? [...spellings][0] : undefined;
125
128
  // Reject relative, network and device namespaces before probing the filesystem.
126
129
  if (!systemRoot || !/^[a-z]:[\\/]/i.test(systemRoot) || systemRoot.slice(2).includes(':'))
127
130
  throw failure();
@@ -122,7 +122,7 @@ export declare const panelWidth: (columns: number) => number;
122
122
  /**
123
123
  * Whether the selected graph is a custom one.
124
124
  *
125
- * The built-in Software Engineer harness is stored under `'default'` (and answers to its own
125
+ * The built-in Andorra Agent harness is stored under `'default'` (and answers to its own
126
126
  * id when a graph file was never written), so both spell the default; anything else is a
127
127
  * user-authored graph, which is what the zoom section exists for.
128
128
  */
@@ -30,7 +30,7 @@ export const panelWidth = (columns) => Math.min(44, Math.max(28, Math.floor(colu
30
30
  /**
31
31
  * Whether the selected graph is a custom one.
32
32
  *
33
- * The built-in Software Engineer harness is stored under `'default'` (and answers to its own
33
+ * The built-in Andorra Agent harness is stored under `'default'` (and answers to its own
34
34
  * id when a graph file was never written), so both spell the default; anything else is a
35
35
  * user-authored graph, which is what the zoom section exists for.
36
36
  */
@@ -1 +1,3 @@
1
+ /** The built-in command names, without their slash. */
2
+ export declare function builtinSlashCommandNames(): string[];
1
3
  export declare function isBuiltinSlashCommand(input: string): boolean;
@@ -6,6 +6,8 @@ const BUILTIN_COMMANDS = new Set([
6
6
  'feedback', 'yolo', 'tools', 'skills', 'plugins', 'mcp', 'logout', 'status',
7
7
  'clear', 'compact', 'help', 'exit', 'quit',
8
8
  ]);
9
+ /** The built-in command names, without their slash. */
10
+ export function builtinSlashCommandNames() { return [...BUILTIN_COMMANDS]; }
9
11
  export function isBuiltinSlashCommand(input) {
10
12
  return BUILTIN_COMMANDS.has(input.trim().split(/\s+/, 1)[0].slice(1));
11
13
  }
@@ -0,0 +1,81 @@
1
+ ---
2
+ name: create-agent
3
+ description: "Design a reusable Andorra Code Agent (a role with its own instructions, model, capabilities and input/output contract) and produce a file the user imports into their Agent library. Use when the user wants a custom reviewer, tester, researcher or other role to reuse across graphs."
4
+ ---
5
+
6
+ # Create an Agent
7
+
8
+ An Agent is one role in Andorra's graphs: instructions, a provider and model, what it may touch, and the
9
+ structured input it takes and output it returns. The library ships three presets (Orchestrator, Software
10
+ Engineer, QA Tester); this skill designs a new one and writes it as a shareable Agent file that the user
11
+ imports, the same format the library's Share action produces.
12
+
13
+ To put an Agent straight into a graph instead, use the `graph-manager` skill: a graph's agent nodes take the
14
+ same fields.
15
+
16
+ ## Steps
17
+
18
+ 1. **Pin down the role.** What it is for, what it receives, what it must hand back, and what it must never
19
+ do. Ask for an example task.
20
+ 2. **Choose the provider and model.** Use a provider id the user has configured (`/providers` in the
21
+ terminal; `config.json` → `providers[].id`). Leave the model out to use that provider's default.
22
+ 3. **Choose capabilities, least first.** Grant only what the role needs (table below). A reviewer usually
23
+ needs `filesystem: "read"`, `shell: "read-only"`, `git: "read"`.
24
+ 4. **Write the contract.** `inputSchema` and `outputSchema` are JSON Schemas (objects with `properties`,
25
+ `required`, `additionalProperties: false`). Keep outputs to what the next step consumes: findings,
26
+ evidence, a verdict.
27
+ 5. **Write the instruction** as a brief to a colleague: the goal, the steps, the rules, what to report.
28
+ 6. **Show the design** (name, model, capabilities, contract, instruction) and adjust it with the user.
29
+ 7. **Write the file** `<name>.andorra-agent.json` in a folder the user chooses (default: the workspace
30
+ root, which they can delete after importing). Do not write into `<home>/agent-definitions` directly:
31
+ the library keeps revisions and locks there.
32
+ 8. **Tell the user how to import it:** open the Graph Builder (`andorra graph`, or `/graph` → Edit Graphs, or
33
+ the desktop's graph editor), choose **Import agent** in the node library, then pick the file.
34
+
35
+ ## The file
36
+
37
+ ```json
38
+ {
39
+ "format": "andorra-code-agent",
40
+ "formatVersion": 1,
41
+ "exportedAt": "2026-01-01T00:00:00.000Z",
42
+ "agent": {
43
+ "name": "Security Reviewer",
44
+ "description": "Review a change for security issues and report findings with evidence.",
45
+ "node": {
46
+ "id": "agent",
47
+ "type": "agent",
48
+ "name": "Security Reviewer",
49
+ "provider": "<configured provider id>",
50
+ "instruction": "Review the change described in the input for injection, path traversal, secret leaks and unsafe permissions. Read the changed files and their callers. Report each finding with the file, the line and why it is exploitable. Do not modify files.",
51
+ "capabilities": { "filesystem": "read", "shell": "read-only", "git": "read", "github": "none", "browser": "disabled", "deployment": "none" },
52
+ "completion": { "mode": "outcomes", "outcomes": ["pass", "fail"], "criteria": { "pass": "No exploitable issue found", "fail": "At least one exploitable issue" } },
53
+ "inputSchema": { "type": "object", "properties": { "changeSummary": { "type": "string" }, "changedFiles": { "type": "array", "items": { "type": "string" } } }, "required": ["changeSummary"], "additionalProperties": false },
54
+ "outputSchema": { "type": "object", "properties": { "findings": { "type": "array", "items": { "type": "string" } }, "evidence": { "type": "array", "items": { "type": "string" } } }, "required": ["findings"], "additionalProperties": false }
55
+ }
56
+ }
57
+ }
58
+ ```
59
+
60
+ Fields of `node` you may use:
61
+
62
+ | Field | Meaning |
63
+ | --- | --- |
64
+ | `instruction` | The role's brief (main text). `systemPrompt` and `prompt` also exist; prefer `instruction`. |
65
+ | `provider`, `model` | A configured provider id; the model is optional. |
66
+ | `capabilities` | `filesystem`: none / read / read-write. `shell`: disabled / read-only / allowed. `git`: none / read / write. `github`: none / read / pull-request / review. `browser`: disabled / playwright. `deployment`: none / allowed. |
67
+ | `completion` | `{ "mode": "single", "outcome": "completed" }`, or `{ "mode": "outcomes", "outcomes": [...], "criteria": { outcome: text } }` for routing. |
68
+ | `inputSchema`, `outputSchema` | JSON Schemas for the handoff in and out. |
69
+ | `limits` | `maxIterations`, `maxToolCalls`, `wallTimeMs`, `maxContextChars`. |
70
+ | `tools` | Restrict to named tools; omit to allow what the capabilities permit. |
71
+ | `subagents` | `{ "enabled": true, "maxConcurrent": 3, "roles": [...] }` for an Agent that delegates. |
72
+
73
+ ## Rules
74
+
75
+ - Never put credentials in an instruction or schema.
76
+ - Grant write, shell or GitHub capabilities only when the role needs them, and say why in the design.
77
+ - A child role's capabilities can never exceed its parent's.
78
+
79
+ ## Report
80
+
81
+ The file path, the import steps, and a one-line summary of the role, its model and its capabilities.
@@ -0,0 +1,81 @@
1
+ ---
2
+ name: create-skill
3
+ description: "Write a new Andorra Code skill: a SKILL.md that tells an agent how to do a recurring task. Use when the user wants to capture a workflow, checklist or house style as a reusable /command, or asks how to make a skill."
4
+ ---
5
+
6
+ # Create a skill
7
+
8
+ A skill is a Markdown file written **for an agent**: the person starts it with `/name` (or the agent loads it
9
+ when a request matches its description), and the agent follows it. Write it the way you would brief a capable
10
+ colleague who has never seen this codebase or this team's habits.
11
+
12
+ ## Choose where it lives
13
+
14
+ | Kind | Path | Who gets it |
15
+ | --- | --- | --- |
16
+ | Project skill | `<workspace>/.andorra/skills/<name>/SKILL.md` (or `.agents/skills/`) | Everyone who opens this repository; commit it |
17
+ | Installed skill | `<home>/skills/<name>/SKILL.md` | Only this installation, in every project; typeable as `/name` and listed in Settings → Skills |
18
+
19
+ `<home>` is `$ANDORRACODE_HOME` when set, otherwise `~/.andorracode`. Ask the user which they want when it is
20
+ not obvious: a team process belongs in the repository; a personal habit belongs in the installation.
21
+
22
+ Project-skill limits (discovery skips files that break them):
23
+
24
+ - `<name>`: starts with a letter or digit; letters, digits, `_` and `-`; at most 48 characters.
25
+ - The file is at most 16 KB (16,384 bytes), UTF-8, no NUL bytes; only the first 12,000 characters are read.
26
+ - At most 16 project skills per repository are discovered.
27
+ - Project skills are read as reference material: they cannot grant permissions or override the user, so
28
+ write them as guidance, not as authority.
29
+
30
+ ## Write the description first
31
+
32
+ The `description` is what an agent sees before deciding to load the skill, so it carries the trigger:
33
+
34
+ - Say **what** the skill does and **when** to use it, in one line, at most 300 characters.
35
+ - Name the words a user would actually say ("release notes", "changelog", "what shipped").
36
+ - Do not describe how; that belongs in the body.
37
+
38
+ ## Template
39
+
40
+ ```markdown
41
+ ---
42
+ name: <name>
43
+ description: "<What it does>. Use when <the situations and phrases that should trigger it>."
44
+ ---
45
+
46
+ # <Title>
47
+
48
+ <One paragraph: the goal and what done looks like.>
49
+
50
+ ## Steps
51
+
52
+ 1. <Concrete step: the command, file or tool, and what to look for.>
53
+ 2. ...
54
+
55
+ ## Rules
56
+
57
+ - <Constraints the agent must keep: what never to do, what needs the user's confirmation.>
58
+
59
+ ## Report
60
+
61
+ <What the agent tells the user at the end, including what it could not verify.>
62
+ ```
63
+
64
+ Writing guidance:
65
+
66
+ - Give exact commands, paths and file names. An agent cannot guess a team's conventions.
67
+ - Say what to check after each risky step, and what to do when it fails.
68
+ - Keep secrets out: refer to environment variables by name.
69
+ - Long reference material (API tables, examples) goes in extra files beside `SKILL.md`; say in the body when
70
+ to read them (`read_skill_resource` with the relative path).
71
+
72
+ ## Steps
73
+
74
+ 1. Ask what recurring task the skill covers, an example request, and what a good result looks like.
75
+ 2. Pick the location and the name; check the name is free (`ls` the skills folder).
76
+ 3. Draft the description and the body from the template; show the draft and adjust it with the user.
77
+ 4. Write the file. Check it: the frontmatter starts the file with `---`, `name` and `description` are set,
78
+ the description is one line of at most 300 characters, and the file is under 16 KB
79
+ (`wc -c` / `(Get-Item <path>).Length`).
80
+ 5. Report the path, the command (`/<name>` for an installed skill), and that it is available from the next
81
+ task. For a project skill, remind the user to commit it.
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: doctor
3
+ description: "Check that Andorra Code is set up and healthy: Node, sign-in, configuration, providers, MCP servers, disk space. Use when something does not work (no models, tools missing, sign-in errors, tasks failing at start) or the user asks to check their setup."
4
+ ---
5
+
6
+ # Andorra doctor
7
+
8
+ Check each layer in order, because later layers depend on earlier ones. Read and test; change nothing
9
+ unless the user agrees to a specific fix. Never print a credential: an API key, token or `Authorization`
10
+ header is reported only as "set" or "missing".
11
+
12
+ The Andorra home is `$ANDORRACODE_HOME` when that variable is set, otherwise `~/.andorracode`
13
+ (`%USERPROFILE%\.andorracode` on Windows).
14
+
15
+ ## Checks
16
+
17
+ 1. **Node.js.** `node --version`. Andorra needs 22.19.0 or newer. Older: tell the user to
18
+ upgrade Node.
19
+ 2. **The CLI.** `andorra --version` prints the version and `andorra --help` the usage. Not found: the install did not put `andorra` on `PATH`.
20
+ 3. **Account.** `andorra auth status`. Signed out matters only for account features (graphs beyond the
21
+ Default, sync, paid presets); local tasks with a configured provider still work.
22
+ 4. **Configuration.** `<home>/config.json` parses as JSON, has `"version": 1`, a non-empty `providers`
23
+ array, and `provider` naming one of them. A parse error: report the line and column; do not rewrite the
24
+ file.
25
+ 5. **Providers.** For each provider entry, report its `id`, `type` and `model`. Test reachability without
26
+ sending a key in the output:
27
+ - `openai-compatible` with a `baseUrl`: request `<baseUrl>/models` (send the key header if the entry has
28
+ one, from the environment or file, but print only the HTTP status).
29
+ - Hosted providers (Codex, Claude): they sign in through `/providers`; report whether the entry exists and
30
+ suggest re-running its sign-in there when tasks fail with authentication errors.
31
+ 6. **MCP servers.** For each enabled entry in `mcpServers`, check every `${NAME}` reference is set in this
32
+ environment, and probe it with the `manage-mcp` skill's `probe.md` check. Report the tool count or the
33
+ error.
34
+ 7. **Disk space.** Free space on the drive that holds the home (`df -h <home>`, or
35
+ `Get-PSDrive <letter>` on Windows). Under 2 GB: warn; sessions and builds fail when the disk fills.
36
+ 8. **Workspace.** If the problem is in one project: is it a git repository (`git status`), and does its
37
+ `ANDORRA.md` or `AGENTS.md` exist and stay under 16,000 characters (longer guides are cut off)?
38
+
39
+ ## Report
40
+
41
+ A short table, one row per check: OK, Warning or Problem, and what was seen. Then the fixes, in the order to
42
+ apply them (a broken config before a provider, a provider before an MCP server), each as one command or one
43
+ setting. Say plainly which checks could not run and why.
@@ -0,0 +1,100 @@
1
+ ---
2
+ name: graph-manager
3
+ description: "Design, create, edit, delete or restore Andorra Code graphs (multi-agent workflows) from the user's requirements, through Andorra's graph tools. Use when the user wants a new workflow, wants to change how an existing graph routes work, or wants a graph removed or brought back."
4
+ ---
5
+
6
+ # Manage graphs
7
+
8
+ A graph is a workflow of agent nodes connected by outcome routes: a plan step hands to a build step, a review
9
+ routes `pass` to done and `fail` back to the build, and so on. Graphs are created and changed only through
10
+ Andorra's graph operations (`andorra_graph_*`), which validate every change and save immutable revisions that
11
+ sync to the user's account. Never edit graph files on disk.
12
+
13
+ ## 1. Find the graph tools
14
+
15
+ Inside Andorra, every graph operation is an action of the built-in `graphs` tool: call it with `action` set
16
+ to the operation named in this skill and its arguments in `args`, for example
17
+ `{"action": "andorra_graph_begin", "args": {"mode": "create", "id": "qa-flow", "name": "QA Flow"}}`.
18
+ It needs no MCP server. If `graphs` is not in your tools, this node is not allowed to use it (it needs shell
19
+ permission, and delegated subagents never get it): tell the user to run the request from a top-level agent
20
+ with shell access, and stop. Do not write graph files instead.
21
+
22
+ Outside Andorra (Claude Code, Codex, another agent host), the same operations are separate MCP tools, possibly
23
+ with a server prefix such as `mcp__andorra__andorra_graphs_list`. If they are missing, the graph MCP server is
24
+ not connected: it is a stdio server with `"command": "andorra"` and `"args": ["mcp-server", "--stdio"]`,
25
+ which the host connects in its own MCP settings.
26
+ Graph editing also needs the user to be signed in (`andorra auth status`); a free account may keep one custom
27
+ graph of up to 3 nodes, without an Orchestrator.
28
+
29
+ ## 2. Read the guide first
30
+
31
+ Call `andorra_graph_guide`. It is the authority on node types, ports, loops, limits and error codes, and it
32
+ changes with the product; this skill does not repeat it.
33
+
34
+ ## 3. Understand what the user wants
35
+
36
+ Ask until you can answer each of these:
37
+
38
+ - What the workflow is for, and what finished looks like.
39
+ - The stages, in order, and what each one hands to the next.
40
+ - Where work loops back (a failed review returns to the builder), and how many attempts are allowed.
41
+ - Which provider and model each agent uses: list them with `andorra_providers_list` and use those ids only.
42
+ - What each agent may touch (read only, write files, run shell, open pull requests).
43
+ - What input a run needs beyond the task text.
44
+
45
+ Then draw a text sketch of the nodes and routes, for example:
46
+
47
+ ```
48
+ plan (agent) --completed--> build (agent) --completed--> review (agent)
49
+ review --pass--> done (end)
50
+ review --fail--> build (at most 3 rounds: limits.maxNodeVisits = 3, a per-node ceiling)
51
+ ```
52
+
53
+ Get the user's approval of the sketch before building anything. `patterns.md` in this skill has tested
54
+ shapes for common workflows; read it with `read_skill_resource` (path `patterns.md`) when one fits.
55
+
56
+ ## 4. Build or change it
57
+
58
+ Before starting, `andorra_graphs_list` shows what exists. A free account that already has its one custom graph
59
+ cannot create another.
60
+
61
+ **Create:** `andorra_graph_begin` with `mode: "create"`, a new `id` (letters, digits, `_`, `-`) and a `name`.
62
+ Then `andorra_graph_node_upsert` for each node (every agent node names a `provider`), `andorra_graph_edge_upsert`
63
+ for each route (the `outcome` must be a port of the source node), and `andorra_graph_patch` for the `entry`
64
+ node and `limits`. Any cycle needs a ceiling: `limits.maxNodeVisits` large enough for the loops, or
65
+ `limits.wallTimeMs`.
66
+
67
+ **Edit:** `andorra_graph_get` to read the latest revision, `andorra_graph_begin` with `mode: "edit"`, then change
68
+ only what the request needs: `andorra_graph_node_patch` for a node's instruction, model or completion;
69
+ `andorra_graph_node_remove` / `andorra_graph_edge_remove` to take parts out (the entry node cannot be removed
70
+ until another node is the entry).
71
+
72
+ The built-in `default` graph cannot be edited: create a new graph with the shape you want instead.
73
+
74
+ ## 5. Validate, show, publish
75
+
76
+ 1. `andorra_graph_validate` and fix every issue it reports; `errors.md` in this skill maps each code to its
77
+ fix. Do not publish around an issue.
78
+ 2. Show the user what changed: nodes added, removed or changed, and routes.
79
+ 3. `andorra_graph_publish`. A `REVISION_CONFLICT` means someone saved a newer revision: begin a new edit draft
80
+ from the latest, reapply your changes, validate and publish again.
81
+ 4. If the user stops partway, `andorra_graph_discard` the draft.
82
+
83
+ ## 6. Delete or restore
84
+
85
+ Deleting is a soft delete: the graph leaves every list and new runs refuse it, but every revision is kept and
86
+ it can be restored.
87
+
88
+ 1. Read the graph's latest `revision` (`andorra_graph_get` or `andorra_graphs_list`).
89
+ 2. Ask the user in chat to confirm deleting that graph, naming it. Do not delete without a clear yes.
90
+ 3. `andorra_graph_delete` with `id`, `expectedRevision` and `confirm` set to the same `id`.
91
+ - `GRAPH_IN_USE`: an automation runs this graph; tell the user which ones and stop.
92
+ - A free account's deleted graph still counts as its one custom graph; it can be restored, not replaced.
93
+ 4. To bring one back: `andorra_graphs_list` with `includeDeleted: true` to find it, then
94
+ `andorra_graph_restore` with its `id` and latest `revision`.
95
+
96
+ ## 7. Report
97
+
98
+ The graph id and revision, what changed, how to run it (`/graph` in the terminal to select it, the desktop's
99
+ graph picker, or `andorra --graph <id>`), and that cloud sync may still be pending. Name anything you could not
100
+ validate.
@@ -0,0 +1,38 @@
1
+ # Graph tool errors and their fixes
2
+
3
+ Every `andorra_graph_*` reply is `ok: true` with `data`, or `ok: false` with `error.code`, `error.message` and,
4
+ where it applies, `nodeId`, `port`, `edgeId` and the full `issues` list. Fix the cause; never work around a
5
+ validation error.
6
+
7
+ | Code | Meaning | Fix |
8
+ | --- | --- | --- |
9
+ | `NODE_PROVIDER_MISSING` | An agent node has no `provider`. | Set `provider` to an id from `andorra_providers_list`. |
10
+ | `NODE_PROVIDER_INVALID` | The provider id is not configured. | Pick a configured id, or ask the user to add the provider in `/providers`. |
11
+ | `NODE_ROUTE_MISSING` | An outcome port (`port`) of `nodeId` has no route. | Add an edge from that node with that `outcome`, or set `completion.requireRoutes: false` if the outcome may end the run. |
12
+ | `EDGE_SOURCE_MISSING` / `EDGE_TARGET_MISSING` | The edge names a node that does not exist. | Create the node first, or fix the id. |
13
+ | `EDGE_OUTCOME_INVALID` | The `outcome` is not a port of the source node. | Use a declared outcome (`pass`/`fail`, `true`/`false`, `body`/`done`, ...). |
14
+ | `EDGE_DUPLICATE` | The same route already exists. | Remove the duplicate. |
15
+ | `NODE_NOT_FOUND` / `EDGE_NOT_FOUND` | The id is not in the draft. | Read the draft (`andorra_graph_validate` lists nodes) and use an existing id. |
16
+ | `ENTRY_NODE` | Removing the entry node. | `andorra_graph_patch` another `entry` first. |
17
+ | `ENTRY_NOT_FOUND` | `entry` is not a node. | Set `entry` to an existing node id. |
18
+ | `GRAPH_INVALID` | The structural validator refused the graph (unreachable nodes, an unbounded cycle, a bad join). | Read the message: reach every node from `entry`, set `limits.maxNodeVisits` or `limits.wallTimeMs` for cycles, don't join exclusive branches. |
19
+ | `GRAPH_TOO_LARGE` | Over 512 KiB. | Shorten instructions and schemas. |
20
+ | `GRAPH_EXISTS` | `mode: create` with an id in use. | Use `mode: edit`, or another id. |
21
+ | `GRAPH_NOT_FOUND` | No graph or revision with that id. | `andorra_graphs_list` for valid ids (`includeDeleted: true` shows deleted ones). |
22
+ | `BUNDLED_GRAPH` | The built-in `default` graph cannot be changed. | Create a new graph instead. |
23
+ | `REVISION_CONFLICT` | Someone saved a newer revision. | Begin a new edit draft from the latest, reapply, validate, publish. For delete or restore, re-read the revision and retry. |
24
+ | `DRAFT_NOT_FOUND` / `DRAFT_BUSY` | The draft expired (one hour), was discarded, or is publishing. | Begin a new draft; wait for a publish to finish. |
25
+ | `DRAFT_LIMIT` | 24 drafts are open. | Discard unused drafts. |
26
+ | `FREE_TIER_LIMIT` | A free account's limit: one custom graph, at most 3 nodes, no Orchestrator. | Stay within it, or tell the user a paid plan lifts it. |
27
+ | `AUTH_REQUIRED` / `MEMBERSHIP_REQUIRED` / `AUTH_CHANGED` | Not signed in, no membership, or the account changed mid-edit. | Ask the user to sign in (`andorra login`); retry with the current account. |
28
+ | `DEFAULT_GRAPH` | Deleting or restoring the Default graph or the Andorra preset. | Not allowed. |
29
+ | `CONFIRMATION_MISMATCH` | `confirm` is not the graph id. | Ask the user to confirm, then pass the id in `confirm`. |
30
+ | `GRAPH_IN_USE` | An automation runs the graph (`automations` lists them). | Tell the user; they change or remove the automation first. |
31
+ | `GRAPH_DELETED` | The graph is deleted (editing it, or deleting it again). | `andorra_graph_restore` first if the user wants it back. |
32
+ | `GRAPH_NOT_DELETED` | Restoring a live graph. | Nothing to restore. |
33
+ | `RESERVED_METADATA` | `metadata.deletedAt` was set through a patch. | Delete only with `andorra_graph_delete`. |
34
+ | `INVALID_GRAPH_ID` | The id is not a safe identifier. | Letters, digits, `_` and `-`, at most 80 characters. |
35
+ | `NODE_INVALID` / `EDGE_INVALID` | The node or edge object is malformed (unknown type, unsafe id). | Follow the shapes in `andorra_graph_guide`. |
36
+ | `NODE_LIMIT` | Over the node limit (100, or the free allowance). | Merge steps. |
37
+ | `VALIDATION_FAILED` | The graph grew past 512 KiB once provider identities were recorded. | Shorten instructions and schemas. |
38
+ | `STORAGE_ERROR` / `BACKEND_ERROR` | Reading Andorra's data failed; not a graph problem. | Report it to the user; do not change the graph. |