@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.
- package/README.md +31 -205
- package/THIRD_PARTY_NOTICES.md +30 -0
- package/dist/src/agent-execution.js +50 -2
- package/dist/src/agent-mcp.js +5 -0
- package/dist/src/app-server/protocol.d.ts +9 -1
- package/dist/src/app-server/protocol.js +1 -1
- package/dist/src/app-server.d.ts +49 -1
- package/dist/src/app-server.js +353 -64
- package/dist/src/automation-service.js +1 -1
- package/dist/src/browser-panel-tool.d.ts +24 -3
- package/dist/src/browser-panel-tool.js +80 -6
- package/dist/src/browser-runner.js +3 -1
- package/dist/src/browser-session.d.ts +8 -0
- package/dist/src/browser-session.js +27 -1
- package/dist/src/browser-ui/app.js +237 -15
- package/dist/src/browser-ui/index.html +5 -5
- package/dist/src/browser-ui/style.css +110 -65
- package/dist/src/browser-ui/tokens.css +27 -26
- package/dist/src/browser-view.d.ts +16 -0
- package/dist/src/browser-view.js +38 -2
- package/dist/src/claude-provider.js +15 -2
- package/dist/src/cli.d.ts +2 -1
- package/dist/src/cli.js +175 -43
- package/dist/src/code-intelligence/CodeIntelligenceManager.js +1 -1
- package/dist/src/codex-provider.js +6 -3
- package/dist/src/coding-tools.d.ts +26 -1
- package/dist/src/coding-tools.js +104 -33
- package/dist/src/command-screens.js +1 -1
- package/dist/src/commands.js +1 -1
- package/dist/src/completion-gates.d.ts +42 -7
- package/dist/src/completion-gates.js +55 -9
- package/dist/src/completion.d.ts +51 -1
- package/dist/src/completion.js +164 -5
- package/dist/src/config.d.ts +1 -0
- package/dist/src/config.js +2 -0
- package/dist/src/dashboard-view.js +2 -2
- package/dist/src/deadline.js +4 -0
- package/dist/src/decision/PreparedSteps.js +1 -1
- package/dist/src/delegation-changes.js +19 -2
- package/dist/src/diff-preview.d.ts +1 -0
- package/dist/src/diff-preview.js +12 -3
- package/dist/src/engine-streams.d.ts +22 -0
- package/dist/src/engine-streams.js +16 -0
- package/dist/src/extensions.js +17 -6
- package/dist/src/file-read-key.d.ts +8 -0
- package/dist/src/file-read-key.js +12 -0
- package/dist/src/graph-editor-session.js +2 -1
- package/dist/src/graph-health.d.ts +21 -0
- package/dist/src/graph-health.js +46 -0
- package/dist/src/graph-manager-chat.d.ts +52 -3
- package/dist/src/graph-manager-chat.js +62 -17
- package/dist/src/graph-runner.js +62 -5
- package/dist/src/graph-server.d.ts +1 -1
- package/dist/src/graph-server.js +48 -27
- package/dist/src/graph-sync.d.ts +8 -0
- package/dist/src/graph-sync.js +54 -3
- package/dist/src/graph-tool.js +1 -1
- package/dist/src/graph-ui/app.js +362 -123
- package/dist/src/graph-ui/controls.css +95 -22
- package/dist/src/graph-ui/controls.js +31 -1
- package/dist/src/graph-ui/embed.js +62 -13
- package/dist/src/graph-ui/icons.js +7 -0
- package/dist/src/graph-ui/index.html +4 -4
- package/dist/src/graph-ui/manager-state.js +143 -5
- package/dist/src/graph-ui/manager.css +21 -20
- package/dist/src/graph-ui/manager.js +337 -75
- package/dist/src/graph-ui/model-picker.js +279 -0
- package/dist/src/graph-ui/provider-glyphs/alibaba-cloud.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/anthropic.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/aws-bedrock.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/claude.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/deepseek.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/fireworks.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/kimi.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/minimax.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/openai.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/opencode.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/openrouter.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/xai.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/xiaomi-mimo.png +0 -0
- package/dist/src/graph-ui/provider-glyphs/zai.png +0 -0
- package/dist/src/graph-ui/skill-picker.js +1 -1
- package/dist/src/graph-ui/studio-canvas.js +8 -8
- package/dist/src/graph-ui/studio.css +18 -15
- package/dist/src/graph-ui/studio.js +92 -35
- package/dist/src/graph-ui/style.css +122 -79
- package/dist/src/graph-ui/theme.js +2 -2
- package/dist/src/graph-ui/tokens.css +33 -29
- package/dist/src/graphs.d.ts +5 -2
- package/dist/src/graphs.js +10 -9
- package/dist/src/mcp.d.ts +52 -14
- package/dist/src/mcp.js +285 -128
- package/dist/src/membership-errors.d.ts +7 -1
- package/dist/src/membership-errors.js +9 -3
- package/dist/src/memory/ProjectMemory.d.ts +77 -0
- package/dist/src/memory/ProjectMemory.js +310 -0
- package/dist/src/memory/index.d.ts +1 -0
- package/dist/src/memory/index.js +1 -0
- package/dist/src/opencode-provider.js +5 -6
- package/dist/src/package-name.d.ts +3 -0
- package/dist/src/package-name.js +3 -0
- package/dist/src/provider-engine.js +2 -2
- package/dist/src/pull-requests.d.ts +42 -6
- package/dist/src/pull-requests.js +11 -3
- package/dist/src/qa/runtime/PtyManager.js +2 -1
- package/dist/src/react-runtime.js +137 -22
- package/dist/src/read-document-doc.d.ts +20 -0
- package/dist/src/read-document-doc.js +524 -0
- package/dist/src/read-document-docx.d.ts +21 -0
- package/dist/src/read-document-docx.js +584 -0
- package/dist/src/read-document-text.d.ts +29 -0
- package/dist/src/read-document-text.js +67 -0
- package/dist/src/read-document-tool.d.ts +48 -0
- package/dist/src/read-document-tool.js +162 -0
- package/dist/src/read-document.d.ts +78 -0
- package/dist/src/read-document.js +353 -0
- package/dist/src/read-image.d.ts +29 -2
- package/dist/src/read-image.js +42 -17
- package/dist/src/remote/cert.d.ts +1 -1
- package/dist/src/remote/cert.js +2 -7
- package/dist/src/remote/client.js +1 -1
- package/dist/src/remote/pem.d.ts +6 -0
- package/dist/src/remote/pem.js +11 -0
- package/dist/src/run-records.js +49 -10
- package/dist/src/runtime.d.ts +21 -0
- package/dist/src/runtime.js +10 -1
- package/dist/src/session-changes.d.ts +6 -1
- package/dist/src/session-changes.js +13 -5
- package/dist/src/sessions.d.ts +3 -1
- package/dist/src/sessions.js +5 -3
- package/dist/src/side-panel.d.ts +6 -1
- package/dist/src/side-panel.js +12 -10
- package/dist/src/sign-in-detection.d.ts +82 -0
- package/dist/src/sign-in-detection.js +197 -0
- package/dist/src/sign-in-offer.d.ts +35 -0
- package/dist/src/sign-in-offer.js +116 -0
- package/dist/src/skills/bundled/create-skill/SKILL.md +1 -1
- package/dist/src/skills/bundled/diagram/SKILL.md +1 -1
- package/dist/src/skills/bundled/graph-manager/SKILL.md +59 -7
- package/dist/src/skills/bundled/graph-manager/patterns.md +27 -0
- package/dist/src/skills/bundled/provenance.json +4 -4
- package/dist/src/skills/runtime-skills.d.ts +6 -0
- package/dist/src/skills/runtime-skills.js +16 -3
- package/dist/src/stall-recovery.d.ts +6 -2
- package/dist/src/stall-recovery.js +7 -2
- package/dist/src/stray-files.d.ts +14 -0
- package/dist/src/stray-files.js +81 -0
- package/dist/src/subagent-run.js +6 -1
- package/dist/src/terminal-ui.d.ts +1 -1
- package/dist/src/terminal-ui.js +11 -5
- package/dist/src/time-limit.d.ts +53 -0
- package/dist/src/time-limit.js +79 -0
- package/dist/src/tool-activity.js +1 -1
- package/dist/src/tool-schema-compatibility.d.ts +7 -2
- package/dist/src/tool-schema-compatibility.js +8 -4
- package/dist/src/tools.js +92 -7
- package/dist/src/transcript.d.ts +5 -0
- package/dist/src/transcript.js +12 -4
- package/dist/src/types.d.ts +8 -0
- package/dist/src/untracked-file-removal.d.ts +3 -0
- package/dist/src/untracked-file-removal.js +125 -0
- package/dist/src/update-check.js +1 -1
- package/dist/src/update.d.ts +11 -1
- package/dist/src/update.js +27 -5
- package/dist/src/usage-analytics.d.ts +3 -1
- package/dist/src/usage-analytics.js +16 -2
- package/dist/src/workspace-git-metadata.d.ts +15 -0
- package/dist/src/workspace-git-metadata.js +50 -1
- package/dist/src/workspace-instructions.js +1 -1
- package/package.json +6 -26
- package/docs/README.md +0 -36
- package/docs/agents/README.md +0 -62
- package/docs/agents/install-for-agents.md +0 -56
- package/docs/agents/mcp-server.md +0 -212
- package/docs/agents/subagent-mode.md +0 -149
- package/docs/concepts/README.md +0 -47
- package/docs/concepts/jev-actionable-routing.md +0 -113
- package/docs/concepts/jev-decision-thresholds.md +0 -412
- package/docs/concepts/jev-efficiency.md +0 -217
- package/docs/concepts/jev-eval-2026-11-01.md +0 -78
- package/docs/concepts/limits.md +0 -52
- package/docs/concepts/memory.md +0 -10
- package/docs/concepts/security.md +0 -50
- package/docs/concepts/workspace-instructions.md +0 -29
- package/docs/getting-started/README.md +0 -82
- package/docs/getting-started/accounts.md +0 -78
- package/docs/getting-started/configure-providers.md +0 -132
- package/docs/guides/README.md +0 -13
- package/docs/guides/browser.md +0 -39
- package/docs/guides/desktop-app.md +0 -414
- package/docs/guides/extensions.md +0 -102
- package/docs/guides/graph-builder.md +0 -116
- package/docs/guides/headless.md +0 -46
- package/docs/guides/tui.md +0 -75
- package/docs/guides/update.md +0 -70
- package/docs/guides/web-search.md +0 -51
- package/docs/guides/windows-code-signing.md +0 -319
- package/docs/llms.txt +0 -45
- package/docs/reference/README.md +0 -7
- package/docs/reference/cli.md +0 -76
- package/docs/reference/config.md +0 -91
- package/docs/reference/slash-commands.md +0 -59
- package/docs/superpowers/plans/2026-11-01-claude-console-sign-in.md +0 -111
- package/docs/superpowers/plans/2026-11-01-jev-node-opt-in.md +0 -910
- package/docs/superpowers/plans/2026-11-02-workflow-pane.md +0 -398
- package/docs/superpowers/plans/2026-11-06-graph-soft-delete.md +0 -125
- package/docs/superpowers/plans/2026-11-09-orchestrator-delegation.md +0 -295
- package/docs/superpowers/plans/2026-11-13-graph-manager-chat.md +0 -203
- package/docs/superpowers/plans/2026-11-14-jev-fair-use-pricing.md +0 -79
- package/docs/superpowers/specs/2026-10-31-work-line-summary-design.md +0 -50
- package/docs/superpowers/specs/2026-11-01-claude-console-sign-in-design.md +0 -176
- package/docs/superpowers/specs/2026-11-01-jev-node-opt-in-design.md +0 -164
- package/docs/superpowers/specs/2026-11-01-pr-section-design.md +0 -111
- package/docs/superpowers/specs/2026-11-02-workflow-pane-design.md +0 -130
- package/docs/superpowers/specs/2026-11-06-bundled-skills-design.md +0 -206
- package/docs/superpowers/specs/2026-11-09-orchestrator-delegation-design.md +0 -291
- package/docs/superpowers/specs/2026-11-13-graph-manager-chat-design.md +0 -182
- package/docs/superpowers/specs/2026-11-14-jev-fair-use-pricing-design.md +0 -156
- package/scripts/jev-efficiency-eval.mjs +0 -187
- package/scripts/jev-efficiency-live.mjs +0 -193
- package/scripts/zcode-engine-replay.mjs +0 -223
- package/tests/agent-centric-mcp-test-plan.md +0 -208
- package/tests/analytics-settings-test-plan.md +0 -165
- package/tests/browser-cli-smoke.mjs +0 -276
- package/tests/browser-test-plan.md +0 -280
- package/tests/chat-side-panel-test-plan.md +0 -309
- package/tests/decision-engine-test-plan.md +0 -163
- package/tests/default-active-jev-test-plan.md +0 -85
- package/tests/harness-extensions-test-plan.md +0 -113
- package/tests/jev-all-decisions-test-plan.md +0 -156
- package/tests/jev-efficiency/criteria.json +0 -158
- package/tests/jev-efficiency/workloads.mjs +0 -242
- package/tests/jev-efficiency-test-plan.md +0 -198
- package/tests/permissions-sandbox-probe.mjs +0 -74
- package/tests/permissions-test-plan.md +0 -191
- package/tests/product-telemetry-test-plan.md +0 -536
- package/tests/thinking-stream-preview-test-plan.md +0 -136
- package/tests/zcode-react-engine-test-plan.md +0 -396
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { mkdir, readFile, rename, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { stripVTControlCharacters } from 'node:util';
|
|
4
|
+
import { changeConfigFile, configDirectory, loadConfig } from './config.js';
|
|
5
|
+
import { applySignInImports, detectSignIns } from './sign-in-detection.js';
|
|
6
|
+
const DETECT_TIMEOUT_MS = 8_000;
|
|
7
|
+
const MAX_ATTEMPTS = 3;
|
|
8
|
+
const NAME = { claude: 'Claude', codex: 'ChatGPT', grok: 'Grok', opencode: 'OpenCode' };
|
|
9
|
+
const statePath = (home) => join(home, 'sign-in-offer.json');
|
|
10
|
+
export async function readSignInOfferState(home = configDirectory()) {
|
|
11
|
+
try {
|
|
12
|
+
const value = JSON.parse(await readFile(statePath(home), 'utf8'));
|
|
13
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
14
|
+
return {};
|
|
15
|
+
const record = value;
|
|
16
|
+
return {
|
|
17
|
+
...(record.done === true ? { done: true } : {}),
|
|
18
|
+
...(Number.isSafeInteger(record.attempts) && record.attempts > 0 ? { attempts: record.attempts } : {}),
|
|
19
|
+
...(Array.isArray(record.answered) && record.answered.length > 0 && record.answered.length <= 8 && record.answered.every(item => typeof item === 'string') ? { answered: record.answered } : {}),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return {};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export async function writeSignInOfferState(state, home = configDirectory()) {
|
|
27
|
+
await mkdir(home, { recursive: true });
|
|
28
|
+
const target = statePath(home);
|
|
29
|
+
const temporary = `${target}.${process.pid}.tmp`;
|
|
30
|
+
await writeFile(temporary, JSON.stringify(state) + '\n', 'utf8');
|
|
31
|
+
await rename(temporary, target);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* What a typed answer chooses among `count` listed accounts: every index for an empty answer or
|
|
35
|
+
* yes, `'none'` for no, the named ones for numbers, and undefined for anything else.
|
|
36
|
+
*/
|
|
37
|
+
export function parseSignInAnswer(answer, count) {
|
|
38
|
+
const value = answer.trim().toLowerCase();
|
|
39
|
+
if (value === '' || value === 'y' || value === 'yes')
|
|
40
|
+
return Array.from({ length: count }, (_, index) => index);
|
|
41
|
+
if (value === 'n' || value === 'no')
|
|
42
|
+
return 'none';
|
|
43
|
+
const parts = value.split(/[\s,]+/).filter(Boolean);
|
|
44
|
+
if (!parts.length || parts.some(part => !/^\d{1,3}$/.test(part)))
|
|
45
|
+
return undefined;
|
|
46
|
+
const picked = [...new Set(parts.map(part => Number(part) - 1))].sort((a, b) => a - b);
|
|
47
|
+
return picked.some(index => index < 0 || index >= count) ? undefined : picked;
|
|
48
|
+
}
|
|
49
|
+
function plain(text) {
|
|
50
|
+
return stripVTControlCharacters(text).replace(/[\x00-\x08\x0b-\x1f\x7f-\x9f]/g, '');
|
|
51
|
+
}
|
|
52
|
+
function summary(signIn) {
|
|
53
|
+
return [signIn.email, signIn.planType].filter(Boolean).join(' · ') || signIn.detail || 'signed in';
|
|
54
|
+
}
|
|
55
|
+
function listed(names) {
|
|
56
|
+
return names.length <= 1 ? names.join('') : `${names.slice(0, -1).join(', ')} and ${names.at(-1)}`;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Offer once per configuration home. Returns the ids of the providers added; never throws.
|
|
60
|
+
*
|
|
61
|
+
* OpenCode is named but never added here: its models span upstream providers that may bill per use,
|
|
62
|
+
* and choosing one is what the `/providers` screen is for.
|
|
63
|
+
*/
|
|
64
|
+
export async function offerSignInImport(options) {
|
|
65
|
+
const home = options.home ?? configDirectory();
|
|
66
|
+
const write = (text) => options.write(plain(text));
|
|
67
|
+
try {
|
|
68
|
+
const state = await readSignInOfferState(home);
|
|
69
|
+
if (state.done)
|
|
70
|
+
return [];
|
|
71
|
+
const attempts = (state.attempts ?? 0) + 1;
|
|
72
|
+
write('Looking for accounts you\'re already signed in to...\n');
|
|
73
|
+
const detect = options.detect ?? (async (directory, signal, skip) => detectSignIns(await loadConfig(directory), signal, { timeoutMs: DETECT_TIMEOUT_MS, skip }));
|
|
74
|
+
// A tool the person already answered about is not looked for again while a slow one is retried.
|
|
75
|
+
const answered = state.answered ?? [];
|
|
76
|
+
const { signIns, timedOut } = await detect(home, AbortSignal.timeout(DETECT_TIMEOUT_MS + 1_000), answered);
|
|
77
|
+
// A tool that ran out of time gets another launch, but not forever.
|
|
78
|
+
const finished = timedOut.length === 0 || attempts >= MAX_ATTEMPTS;
|
|
79
|
+
const addable = signIns.filter(signIn => signIn.type !== 'opencode' && signIn.model !== undefined);
|
|
80
|
+
const settle = (asked = false) => {
|
|
81
|
+
const known = [...new Set([...answered, ...(asked ? addable.map(signIn => signIn.type) : [])])];
|
|
82
|
+
return writeSignInOfferState(finished ? { done: true } : { attempts, ...(known.length ? { answered: known } : {}) }, home);
|
|
83
|
+
};
|
|
84
|
+
if (signIns.some(signIn => signIn.type === 'opencode'))
|
|
85
|
+
write('OpenCode is signed in too. Run /providers to add it with a model.\n');
|
|
86
|
+
if (!addable.length) {
|
|
87
|
+
await settle();
|
|
88
|
+
return [];
|
|
89
|
+
}
|
|
90
|
+
write('Found accounts you\'re already signed in to:\n');
|
|
91
|
+
addable.forEach((signIn, index) => write(` ${index + 1}. ${NAME[signIn.type].padEnd(8)} ${summary(signIn)}\n`));
|
|
92
|
+
let choice;
|
|
93
|
+
while (choice === undefined)
|
|
94
|
+
choice = parseSignInAnswer(await options.ask(`Add ${addable.length === 1 ? 'it as a provider' : 'them as providers'}? [Y]es / [n]o / numbers to pick (e.g. 1): `), addable.length);
|
|
95
|
+
if (choice === 'none') {
|
|
96
|
+
await settle(true);
|
|
97
|
+
return [];
|
|
98
|
+
}
|
|
99
|
+
const chosen = choice.map(index => addable[index]);
|
|
100
|
+
const imports = chosen.map(signIn => ({ type: signIn.type, model: signIn.model }));
|
|
101
|
+
let added = [];
|
|
102
|
+
const saved = await changeConfigFile(home, current => {
|
|
103
|
+
const applied = applySignInImports(current, chosen, imports, options.env ?? process.env);
|
|
104
|
+
added = applied.added;
|
|
105
|
+
return applied.config;
|
|
106
|
+
});
|
|
107
|
+
const names = saved.providers.filter(provider => added.includes(provider.id)).map(provider => provider.name ?? provider.id);
|
|
108
|
+
write(names.length ? `Added ${listed(names)}. Change models or add more with /providers.\n` : 'Those accounts already have providers.\n');
|
|
109
|
+
await settle(true);
|
|
110
|
+
return added;
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
// Startup continues exactly as it would have: the offer is a convenience, not a step.
|
|
114
|
+
return [];
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
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
|
|
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 process, checklist or house style as a reusable /command, or asks how to make a skill."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Create a skill
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: diagram
|
|
3
|
-
description: "Draw a UML-style diagram in a reply instead of hand-typed arrows. Use when about to describe or explain a graph,
|
|
3
|
+
description: "Draw a UML-style diagram in a reply instead of hand-typed arrows. Use when about to describe or explain a graph, process, routing, state machine, call sequence, data model or code structure to the user, including when reviewing an Andorra graph."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Explain with a diagram
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: graph-manager
|
|
3
|
-
description: "Design, create, edit, delete or restore Andorra Code graphs (multi-agent
|
|
3
|
+
description: "Design, create, edit, delete or restore Andorra Code graphs (multi-agent pipelines) through Andorra's graph tools. Use when the user wants a new graph (one that reviews or fixes pull requests included), wants to change how a graph routes work, or wants a graph removed or restored."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Manage graphs
|
|
@@ -33,14 +33,30 @@ changes with the product; this skill does not repeat it.
|
|
|
33
33
|
|
|
34
34
|
## 3. Understand what the user wants
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
Do what the user asks. When their message says what to build or change, work the answers below out of the
|
|
37
|
+
request, the canvas and the graph guide, and start building: an edit to an existing graph rarely needs a
|
|
38
|
+
question. Ask only when something you cannot infer would change the graph's shape (a vague request for a new
|
|
39
|
+
workflow, say), and then ask once, about that alone. Never ask the user to look up a field value or option:
|
|
40
|
+
the graph guide and the validation messages name every accepted value. The one exception is the provider and
|
|
41
|
+
model of an agent, covered below: when the user did not name it, ask before publishing.
|
|
42
|
+
|
|
43
|
+
What you need to know:
|
|
37
44
|
|
|
38
45
|
- What the workflow is for, and what finished looks like.
|
|
39
46
|
- The stages, in order, and what each one hands to the next.
|
|
40
47
|
- Where work loops back (a failed review returns to the builder), and how many attempts are allowed.
|
|
41
48
|
- Which provider and model each agent uses: list them with `andorra_providers_list` and use those ids only.
|
|
49
|
+
The user chooses these, not you. When the request does not name a provider and model for an agent you add,
|
|
50
|
+
or for one whose model you change, you may draft the node with a likely choice so the build can go on, but
|
|
51
|
+
ask the user before you publish: name each such agent, the provider and model you drafted, and the
|
|
52
|
+
alternatives `andorra_providers_list` offers, and wait for their answer. One question covers every agent
|
|
53
|
+
left unspecified. Keep an existing node's provider and model unless the request changes them; that needs no
|
|
54
|
+
question.
|
|
42
55
|
- What each agent may touch (read only, write files, run shell, open pull requests).
|
|
43
56
|
- What input a run needs beyond the task text.
|
|
57
|
+
- When the workflow opens, reviews or fixes pull requests: which agent owns the PR and its review comments.
|
|
58
|
+
Build it with the "Pull request with review fixes" pattern in `patterns.md`: that agent switches Auto-fix on
|
|
59
|
+
itself and loops on the reviews, and the graph's entry stays where it is.
|
|
44
60
|
|
|
45
61
|
Then sketch the nodes and routes. When the `diagram` skill is in your catalog, load it and draw the sketch
|
|
46
62
|
as a state diagram instead; do the same whenever you describe or review an existing graph for the user.
|
|
@@ -52,8 +68,12 @@ review --pass--> done (end)
|
|
|
52
68
|
review --fail--> build (at most 3 rounds: limits.maxNodeVisits = 3, a per-node ceiling)
|
|
53
69
|
```
|
|
54
70
|
|
|
55
|
-
|
|
56
|
-
|
|
71
|
+
For a concrete request, build straight away; do not stop for approval of a sketch. In Graph Studio each draft
|
|
72
|
+
change appears on the user's canvas as you make it, and nothing is saved until the user approves the publish,
|
|
73
|
+
so that approval is their review, except for an unspecified provider and model, which you still ask about
|
|
74
|
+
before publishing (see above). Sketch first and wait only when designing a new graph from a vague request.
|
|
75
|
+
`patterns.md` in this skill has tested shapes for common workflows; read it with `read_skill_resource` (path
|
|
76
|
+
`patterns.md`) when one fits.
|
|
57
77
|
|
|
58
78
|
## 4. Build or change it
|
|
59
79
|
|
|
@@ -71,6 +91,26 @@ only what the request needs: `andorra_graph_node_patch` for a node's instruction
|
|
|
71
91
|
`andorra_graph_node_remove` / `andorra_graph_edge_remove` to take parts out (the entry node cannot be removed
|
|
72
92
|
until another node is the entry).
|
|
73
93
|
|
|
94
|
+
**Adding an outcome to a node that already routes.** A node's outcomes name the conditions it routes on, and
|
|
95
|
+
the names stop fitting once the node branches. Before adding the new outcome, read the node's existing
|
|
96
|
+
outcomes, their written criteria and the routes they drive, and decide what each one now means beside the new
|
|
97
|
+
one:
|
|
98
|
+
|
|
99
|
+
- A lone `completed` (or another catch-all such as `done` or `next`) no longer says anything once a second
|
|
100
|
+
outcome exists. Rename it for the kind of work it actually routes: an Orchestrator that sent everything to
|
|
101
|
+
the Software Engineer as `completed` and now also sends releases to a Release Manager has `implement` and
|
|
102
|
+
`release`, not `completed` and `release`.
|
|
103
|
+
- Rewrite each existing criterion so the outcomes are mutually exclusive and together cover every case the
|
|
104
|
+
node can meet; a criterion written when the node had one exit usually claims everything.
|
|
105
|
+
- Keep a name that still fits; rename only where the new branch made it vague or overlapping.
|
|
106
|
+
|
|
107
|
+
To apply a rename, switch the node to `completion: { mode: "outcomes", outcomes: [...], criteria: {...} }`
|
|
108
|
+
with `andorra_graph_node_patch`, then `andorra_graph_edge_upsert` every route that used the old name with the
|
|
109
|
+
new `outcome` and the edge's existing `id` (an upsert without the id adds a second edge and leaves the old
|
|
110
|
+
one on a port the node no longer has). Also update anything else that names the
|
|
111
|
+
old outcome: a loop modifier's `until.outcome` on that node, and the node's instruction if it tells the agent
|
|
112
|
+
which outcome to report. Name the renames when you show the user what changed.
|
|
113
|
+
|
|
74
114
|
The built-in `default` graph cannot be edited: create a new graph with the shape you want instead.
|
|
75
115
|
|
|
76
116
|
**Place every node.** A node's `position` (`{x, y}`) is the top-left corner of its card on the editor's
|
|
@@ -84,8 +124,18 @@ and the upsert reply's `placed` says where it went.
|
|
|
84
124
|
## 5. Validate, show, publish
|
|
85
125
|
|
|
86
126
|
1. `andorra_graph_validate` and fix every issue it reports; `errors.md` in this skill maps each code to its
|
|
87
|
-
fix. Do not publish around an issue.
|
|
88
|
-
|
|
127
|
+
fix. Do not publish around an issue. If any agent's provider and model came from you rather than the user,
|
|
128
|
+
ask now (section 3) and apply their answer before going on.
|
|
129
|
+
2. Describe the change to the user in chat, in plain words, before publishing. Outside Full Access, publishing
|
|
130
|
+
asks the user to approve or deny, and that prompt shows only the raw call; under Full Access it publishes
|
|
131
|
+
without a prompt, so do not promise one. Either way this description is what the user verifies against:
|
|
132
|
+
- the graph's name and id, and the revision it replaces;
|
|
133
|
+
- each node added, removed or changed, and for a changed node what it now does differently (instruction,
|
|
134
|
+
model, capabilities, completion outcomes), not just that it changed;
|
|
135
|
+
- each route added or removed, and any change to the entry or the limits;
|
|
136
|
+
- what a run of the graph will now do that it did not before, including anything the user did not ask for
|
|
137
|
+
that the change brings with it;
|
|
138
|
+
- the updated diagram, when the `diagram` skill is available.
|
|
89
139
|
3. `andorra_graph_publish`. A `REVISION_CONFLICT` means someone saved a newer revision: begin a new edit draft
|
|
90
140
|
from the latest, reapply your changes, validate and publish again.
|
|
91
141
|
4. If the user stops partway, `andorra_graph_discard` the draft.
|
|
@@ -96,7 +146,9 @@ Deleting is a soft delete: the graph leaves every list and new runs refuse it, b
|
|
|
96
146
|
it can be restored.
|
|
97
147
|
|
|
98
148
|
1. Read the graph's latest `revision` (`andorra_graph_get` or `andorra_graphs_list`).
|
|
99
|
-
2. Ask the user in chat to confirm deleting that graph, naming it
|
|
149
|
+
2. Ask the user in chat to confirm deleting that graph, naming it and saying what it does, which revision is
|
|
150
|
+
the latest, and that new runs will refuse it. Do not delete without a clear yes. Before a restore, say the
|
|
151
|
+
same about the graph that comes back.
|
|
100
152
|
3. `andorra_graph_delete` with `id`, `expectedRevision` and `confirm` set to the same `id`.
|
|
101
153
|
- `GRAPH_IN_USE`: an automation runs this graph; tell the user which ones and stop.
|
|
102
154
|
- A free account's deleted graph still counts as its one custom graph; it can be restored, not replaced.
|
|
@@ -67,6 +67,33 @@ check (loop modifier) --pass--> done
|
|
|
67
67
|
`pass` or runs out of attempts. It exposes only the `pass` port; use it when the same agent fixes and
|
|
68
68
|
rechecks its own work.
|
|
69
69
|
|
|
70
|
+
## Pull request with review fixes (Auto-fix)
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
orchestrator --completed--> pr-owner --completed--> done
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Use this whenever the workflow opens a pull request, reviews one, or answers its review comments.
|
|
77
|
+
|
|
78
|
+
- One agent owns the PR end to end: it opens or attaches the PR, switches Auto-fix on itself (the `pull_request`
|
|
79
|
+
tool, `action: "attach"` or `"update"` with `autoFix: true`), and fixes the review comments. Auto-fix prompts
|
|
80
|
+
go back to the node that switched Auto-fix on (or, when none did, to the node that attached the PR), not to
|
|
81
|
+
the graph's entry. So that call belongs in the PR owner's instruction, never in an Orchestrator or planner
|
|
82
|
+
that hands the work on.
|
|
83
|
+
- Do not move the entry, demote an Orchestrator, or add edges back into the owner to steer Auto-fix there. A
|
|
84
|
+
prompt is never routed through the graph's edges; it is addressed to the node.
|
|
85
|
+
- The owner's instruction is a loop it runs itself: push the fix, resolve the threads it fixed, reply to the
|
|
86
|
+
findings it disputes, then wait for the next review. If the `pull_request` tool offers an `await_review`
|
|
87
|
+
action, call it and repeat until it reports the PR merged or closed (or the round cap below): the agent keeps
|
|
88
|
+
its whole conversation, and waiting costs no tokens. Without that action, end the turn once the round is
|
|
89
|
+
pushed; Auto-fix wakes this same node with the next comments, continuing its attempt when it stopped short.
|
|
90
|
+
- Never wait with `sleep`, a shell polling loop, or `set_timer` (timers are for reminders the user asked for).
|
|
91
|
+
Waiting inside a tool call is the only wait that does not hold the model.
|
|
92
|
+
- Give the owner shell, file-write and network access (it runs `git` and `gh`), and a `limits.wallTimeMs` with
|
|
93
|
+
room for several fix rounds: a 15-minute ceiling stops it in the middle of a fix.
|
|
94
|
+
- Put the exit rule in its instruction: stop when the PR is merged or closed (Auto-fix then switches itself
|
|
95
|
+
off), when the reviewer signs off, or after a fixed number of rounds the user chose.
|
|
96
|
+
|
|
70
97
|
## Single agent with a human approval
|
|
71
98
|
|
|
72
99
|
```
|
|
@@ -689,7 +689,7 @@
|
|
|
689
689
|
{
|
|
690
690
|
"source": "src/skills/bundled/create-skill/SKILL.md",
|
|
691
691
|
"asset": "create-skill/SKILL.md",
|
|
692
|
-
"sha256": "
|
|
692
|
+
"sha256": "fd25af06f9545e27d2db3ba34c0d912574b27b1f04c61399c27f078d5e6cf5b0"
|
|
693
693
|
},
|
|
694
694
|
{
|
|
695
695
|
"source": "src/skills/bundled/manage-skills/SKILL.md",
|
|
@@ -714,7 +714,7 @@
|
|
|
714
714
|
{
|
|
715
715
|
"source": "src/skills/bundled/graph-manager/SKILL.md",
|
|
716
716
|
"asset": "graph-manager/SKILL.md",
|
|
717
|
-
"sha256": "
|
|
717
|
+
"sha256": "a980212344b3cb2a23dc0968729150799c9f43a9b4a55cf6bfee3d72b07430a5"
|
|
718
718
|
},
|
|
719
719
|
{
|
|
720
720
|
"source": "src/skills/bundled/graph-manager/errors.md",
|
|
@@ -724,12 +724,12 @@
|
|
|
724
724
|
{
|
|
725
725
|
"source": "src/skills/bundled/graph-manager/patterns.md",
|
|
726
726
|
"asset": "graph-manager/patterns.md",
|
|
727
|
-
"sha256": "
|
|
727
|
+
"sha256": "bf57e2421697360cc293109b5eaa84ecff0d93fc5dcd957a34d8173ca91b1e2c"
|
|
728
728
|
},
|
|
729
729
|
{
|
|
730
730
|
"source": "src/skills/bundled/diagram/SKILL.md",
|
|
731
731
|
"asset": "diagram/SKILL.md",
|
|
732
|
-
"sha256": "
|
|
732
|
+
"sha256": "2840d736a0001ca82dc002056648ac2b73bdc3f6ce3f710a3d1832a548bbd4dc"
|
|
733
733
|
}
|
|
734
734
|
],
|
|
735
735
|
"additionalCopyright": [
|
|
@@ -14,6 +14,12 @@ export interface RuntimeSkill extends ProjectSkill {
|
|
|
14
14
|
}
|
|
15
15
|
/** Andorra's own skills, as registered: what a person can type and the agent can load by id. */
|
|
16
16
|
export declare function bundledSkillCatalog(): readonly Pick<RuntimeSkill, 'id' | 'description' | 'path' | 'requiredTools'>[];
|
|
17
|
+
/**
|
|
18
|
+
* The disk directory a bundled skill's files live in, by the same names the catalog and the Skill tool
|
|
19
|
+
* resolve (`andorra:name` in full, or its unique short name); undefined when the id names no bundled
|
|
20
|
+
* skill. This is what lets a client read a built-in skill's SKILL.md without installing it.
|
|
21
|
+
*/
|
|
22
|
+
export declare function bundledSkillDirectory(id: string): string | undefined;
|
|
17
23
|
export declare function discoverRuntimeSkills(workspace: string, signal: AbortSignal, toolNames?: string[], includeProject?: boolean): Promise<RuntimeSkill[]>;
|
|
18
24
|
/** The catalog skill a name loads, as the Skill tool resolves it; undefined when none would load. */
|
|
19
25
|
export declare function matchRuntimeSkill(skills: RuntimeSkill[], name: string): RuntimeSkill | undefined;
|
|
@@ -22,19 +22,32 @@ const bundled = [
|
|
|
22
22
|
{ id: 'andorra:control-browser', path: 'control-browser/SKILL.md', description: 'Use the available persistent browser runtime to navigate, inspect and interact with web pages.', source: 'bundled', requiredTools: ['qa.browser_session'] },
|
|
23
23
|
// Andorra's own setup skills: written for the agent, typeable as /name, loaded on matching requests.
|
|
24
24
|
{ id: 'andorra:manage-mcp', path: 'manage-mcp/SKILL.md', description: "Add, change, test, turn off or remove an MCP server in Andorra Code. Use when the user wants to connect a tool server (GitHub, a database, a browser, an internal API), asks why an MCP server's tools are missing, or wants one disconnected.", source: 'bundled' },
|
|
25
|
-
{ id: 'andorra:create-skill', path: 'create-skill/SKILL.md', 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
|
|
25
|
+
{ id: 'andorra:create-skill', path: 'create-skill/SKILL.md', 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 process, checklist or house style as a reusable /command, or asks how to make a skill.", source: 'bundled', loadWhen: 'before writing a new skill or turning something into one' },
|
|
26
26
|
{ id: 'andorra:manage-skills', path: 'manage-skills/SKILL.md', description: "List, install, turn on or off, and remove Andorra Code skills and plugins. Use when the user asks what skills they have, wants to add a skill from GitHub or a folder, disable one, or clean up skills they no longer use.", source: 'bundled', loadWhen: 'before installing, copying, listing, turning on or off, or removing a skill or plugin' },
|
|
27
27
|
{ id: 'andorra:create-agent', path: 'create-agent/SKILL.md', 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.", source: 'bundled' },
|
|
28
28
|
{ id: 'andorra:doctor', path: 'doctor/SKILL.md', 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.", source: 'bundled' },
|
|
29
29
|
{ id: 'andorra:write-instructions', path: 'write-instructions/SKILL.md', description: "Create or improve a repository's agent instructions (ANDORRA.md or AGENTS.md): build and test commands, conventions, and rules agents must follow. Use when the user wants agents to work the way their team does, or asks to set up or tighten project instructions.", source: 'bundled' },
|
|
30
|
-
{ id: 'andorra:graph-manager', path: 'graph-manager/SKILL.md', description: "Design, create, edit, delete or restore Andorra Code graphs (multi-agent
|
|
30
|
+
{ id: 'andorra:graph-manager', path: 'graph-manager/SKILL.md', description: "Design, create, edit, delete or restore Andorra Code graphs (multi-agent pipelines) from the user's requirements, through Andorra's graph tools. Use when the user wants a new graph, wants to change how an existing graph routes work, or wants a graph removed or brought back.", source: 'bundled' },
|
|
31
31
|
// Loaded by the agent on its own when a reply has a shape to show; the desktop transcript draws the fence it writes.
|
|
32
|
-
{ id: 'andorra:diagram', path: 'diagram/SKILL.md', description: "Draw a UML-style diagram in a reply instead of hand-typed arrows. Use when about to describe or explain a graph,
|
|
32
|
+
{ id: 'andorra:diagram', path: 'diagram/SKILL.md', description: "Draw a UML-style diagram in a reply instead of hand-typed arrows. Use when about to describe or explain a graph, process, routing, state machine, call sequence, data model or code structure to the user, including when reviewing an Andorra graph.", source: 'bundled', loadWhen: 'before describing or explaining a graph, workflow, state machine, call sequence or code structure to the user' },
|
|
33
33
|
];
|
|
34
34
|
/** Andorra's own skills, as registered: what a person can type and the agent can load by id. */
|
|
35
35
|
export function bundledSkillCatalog() {
|
|
36
36
|
return bundled.map(({ id, description, path, requiredTools }) => ({ id, description, path, ...(requiredTools ? { requiredTools: [...requiredTools] } : {}) }));
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* The disk directory a bundled skill's files live in, by the same names the catalog and the Skill tool
|
|
40
|
+
* resolve (`andorra:name` in full, or its unique short name); undefined when the id names no bundled
|
|
41
|
+
* skill. This is what lets a client read a built-in skill's SKILL.md without installing it.
|
|
42
|
+
*/
|
|
43
|
+
export function bundledSkillDirectory(id) {
|
|
44
|
+
const canonical = canonicalSkillId(id);
|
|
45
|
+
const exact = bundled.find(item => item.id === canonical);
|
|
46
|
+
const matches = exact ? [exact] : bundled.filter(item => item.id.split(':').at(-1) === canonical);
|
|
47
|
+
if (!exact && matches.length !== 1)
|
|
48
|
+
return undefined;
|
|
49
|
+
return join(BUNDLED_ROOT, dirname((exact ?? matches[0]).path));
|
|
50
|
+
}
|
|
38
51
|
const inside = (root, target) => { const value = relative(root, target); return !isAbsolute(value) && value !== '..' && !value.startsWith(`..${sep}`); };
|
|
39
52
|
/** Linux's proc fd paths let Node perform a no-follow walk relative to pinned
|
|
40
53
|
* directory handles. Every lookup below '/' contains exactly one component;
|
|
@@ -21,10 +21,14 @@ export declare function unavailableToolsSentence(unavailable: readonly string[])
|
|
|
21
21
|
* call, which is exactly what a stall looks like, and "call complete_agent when the requirements
|
|
22
22
|
* are finished" reads as a ban on handing off before they are. A live run asked the user to sign in
|
|
23
23
|
* twice, was sent back both times, and started the interactive login itself instead; the user never
|
|
24
|
-
* saw either request.
|
|
25
|
-
* handoff: the summary is what the user reads, and their next message
|
|
24
|
+
* saw either request. A node without `ask_user` (a headless run, a delegated child, a later graph
|
|
25
|
+
* stage) asks through its handoff: the summary is what the user reads, and their next message
|
|
26
|
+
* continues the conversation. A node that has the tool is pointed at it first by
|
|
27
|
+
* {@link ASK_USER_GUIDANCE}, because a question it asks that way pauses the run for the answer.
|
|
26
28
|
*/
|
|
27
29
|
export declare const USER_BLOCKED_GUIDANCE = "The exception is work that cannot continue without the user: a question only they can answer, or a login, approval or other action only they can perform. Do not work around it or retry it. Call complete_agent alone now (with a blocked outcome if one is declared) and put the question or the exact action needed first in the summary, followed by what is done and what remains; the user reads the summary and answers in their next message.";
|
|
30
|
+
/** Added for a node that has `ask_user`: a question belongs in that tool, not in a reply or a handoff. */
|
|
31
|
+
export declare const ASK_USER_GUIDANCE = "If your reply asked the user a question, call ask_user with that question now instead: a question written in a reply does not pause the run, and the tool waits for their answer.";
|
|
28
32
|
/** The continuation sent after a graph-node turn that ended without a tool call or a handoff. */
|
|
29
33
|
export declare function stalledTurnGuidance(input: {
|
|
30
34
|
dropped: boolean;
|
|
@@ -64,10 +64,14 @@ export function unavailableToolsSentence(unavailable) {
|
|
|
64
64
|
* call, which is exactly what a stall looks like, and "call complete_agent when the requirements
|
|
65
65
|
* are finished" reads as a ban on handing off before they are. A live run asked the user to sign in
|
|
66
66
|
* twice, was sent back both times, and started the interactive login itself instead; the user never
|
|
67
|
-
* saw either request.
|
|
68
|
-
* handoff: the summary is what the user reads, and their next message
|
|
67
|
+
* saw either request. A node without `ask_user` (a headless run, a delegated child, a later graph
|
|
68
|
+
* stage) asks through its handoff: the summary is what the user reads, and their next message
|
|
69
|
+
* continues the conversation. A node that has the tool is pointed at it first by
|
|
70
|
+
* {@link ASK_USER_GUIDANCE}, because a question it asks that way pauses the run for the answer.
|
|
69
71
|
*/
|
|
70
72
|
export const USER_BLOCKED_GUIDANCE = 'The exception is work that cannot continue without the user: a question only they can answer, or a login, approval or other action only they can perform. Do not work around it or retry it. Call complete_agent alone now (with a blocked outcome if one is declared) and put the question or the exact action needed first in the summary, followed by what is done and what remains; the user reads the summary and answers in their next message.';
|
|
73
|
+
/** Added for a node that has `ask_user`: a question belongs in that tool, not in a reply or a handoff. */
|
|
74
|
+
export const ASK_USER_GUIDANCE = 'If your reply asked the user a question, call ask_user with that question now instead: a question written in a reply does not pause the run, and the tool waits for their answer.';
|
|
71
75
|
/** The continuation sent after a graph-node turn that ended without a tool call or a handoff. */
|
|
72
76
|
export function stalledTurnGuidance(input) {
|
|
73
77
|
const parts = [
|
|
@@ -77,6 +81,7 @@ export function stalledTurnGuidance(input) {
|
|
|
77
81
|
input.available.length ? `This node's tools are: ${list(input.available)}.` : '',
|
|
78
82
|
unavailableToolsSentence(input.unavailable),
|
|
79
83
|
'Your next response must call one of this node\'s tools. A progress update does not hand off this graph node. When its requirements and verification are finished, call complete_agent alone with the declared outcome and output.',
|
|
84
|
+
input.available.includes('ask_user') ? ASK_USER_GUIDANCE : '',
|
|
80
85
|
USER_BLOCKED_GUIDANCE,
|
|
81
86
|
];
|
|
82
87
|
return parts.filter(Boolean).join(' ');
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Whether Windows reads this file name as a device (`nul`, `con`, `com1`, also with an extension). */
|
|
2
|
+
export declare function isWindowsDeviceName(name: string): boolean;
|
|
3
|
+
/** Why a new file with this name is almost certainly a mistake, or undefined when the name is ordinary. */
|
|
4
|
+
export declare function strayNameReason(name: string, directory: string, platform?: NodeJS.Platform): string | undefined;
|
|
5
|
+
/** The entry names of a directory, or undefined when it cannot be listed or is too large to compare. */
|
|
6
|
+
export declare function directoryNames(directory: string): Promise<Set<string> | undefined>;
|
|
7
|
+
/** The note for the entries that appeared in `directory` since `before` and have a stray name; empty when none did. */
|
|
8
|
+
export declare function strayFileNotice(directory: string, before: Set<string> | undefined, platform?: NodeJS.Platform): Promise<string>;
|
|
9
|
+
/**
|
|
10
|
+
* Runs a shell tool's command and adds the stray-file note to whatever it reports. A command that
|
|
11
|
+
* fails reports through its error, so the note is added there too: the command that leaves such a
|
|
12
|
+
* file behind has usually failed on the next line.
|
|
13
|
+
*/
|
|
14
|
+
export declare function withStrayFileNotice(directory: string, run: () => Promise<string>): Promise<string>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// A shell command can leave a file behind whose name is plainly a mistake: a whole sentence (a
|
|
2
|
+
// path and its content passed in the wrong order) or a Windows device name (output sent to `nul`
|
|
3
|
+
// from a shell that is not cmd.exe). Nothing stops a process from creating one, so the shell tools
|
|
4
|
+
// look at their working directory before and after a command and tell the model what appeared.
|
|
5
|
+
import { readdir } from 'node:fs/promises';
|
|
6
|
+
import { join } from 'node:path';
|
|
7
|
+
/** A directory with more entries than this is not compared: the check must stay cheap. */
|
|
8
|
+
const SCAN_LIMIT = 5_000;
|
|
9
|
+
/** No deliberate file name is this long; a pasted sentence is. */
|
|
10
|
+
const NAME_LIMIT = 150;
|
|
11
|
+
/** Windows' MAX_PATH, which Git and most tools there still enforce. */
|
|
12
|
+
const WINDOWS_PATH_LIMIT = 260;
|
|
13
|
+
const SHOWN_NAME_CHARS = 80;
|
|
14
|
+
const SHOWN_FILES = 3;
|
|
15
|
+
/** Whether Windows reads this file name as a device (`nul`, `con`, `com1`, also with an extension). */
|
|
16
|
+
export function isWindowsDeviceName(name) {
|
|
17
|
+
return /^(con|prn|aux|nul|com[1-9]|lpt[1-9])\s*(\..*)?$/i.test(name);
|
|
18
|
+
}
|
|
19
|
+
/** Why a new file with this name is almost certainly a mistake, or undefined when the name is ordinary. */
|
|
20
|
+
export function strayNameReason(name, directory, platform = process.platform) {
|
|
21
|
+
if (platform === 'win32' && isWindowsDeviceName(name))
|
|
22
|
+
return 'a reserved Windows device name';
|
|
23
|
+
if (name.length >= NAME_LIMIT)
|
|
24
|
+
return `a ${name.length}-character name`;
|
|
25
|
+
if (platform === 'win32' && join(directory, name).length >= WINDOWS_PATH_LIMIT)
|
|
26
|
+
return 'a path over the Windows 260-character limit';
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
/** The entry names of a directory, or undefined when it cannot be listed or is too large to compare. */
|
|
30
|
+
export async function directoryNames(directory) {
|
|
31
|
+
try {
|
|
32
|
+
const names = await readdir(directory);
|
|
33
|
+
return names.length > SCAN_LIMIT ? undefined : new Set(names);
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/** The note for the entries that appeared in `directory` since `before` and have a stray name; empty when none did. */
|
|
40
|
+
export async function strayFileNotice(directory, before, platform = process.platform) {
|
|
41
|
+
if (!before)
|
|
42
|
+
return '';
|
|
43
|
+
const after = await directoryNames(directory);
|
|
44
|
+
if (!after)
|
|
45
|
+
return '';
|
|
46
|
+
const found = [];
|
|
47
|
+
for (const name of after) {
|
|
48
|
+
if (before.has(name))
|
|
49
|
+
continue;
|
|
50
|
+
const reason = strayNameReason(name, directory, platform);
|
|
51
|
+
if (!reason)
|
|
52
|
+
continue;
|
|
53
|
+
const shown = name.length > SHOWN_NAME_CHARS ? `${name.slice(0, SHOWN_NAME_CHARS)}…` : name;
|
|
54
|
+
found.push(`${JSON.stringify(shown)} (${reason})`);
|
|
55
|
+
}
|
|
56
|
+
if (!found.length)
|
|
57
|
+
return '';
|
|
58
|
+
const listed = found.slice(0, SHOWN_FILES).join(', ') + (found.length > SHOWN_FILES ? ` and ${found.length - SHOWN_FILES} more` : '');
|
|
59
|
+
return `\n[Warning: this command created ${found.length === 1 ? 'a file' : 'files'} in ${directory} whose name is almost certainly a mistake: ${listed}. `
|
|
60
|
+
+ 'Delete it now unless it was intended; such a file breaks Git and other tools on Windows. '
|
|
61
|
+
+ 'The usual causes are a path and its content passed in the wrong order (Windows PowerShell binds the content of Set-Content or Add-Content as the path when a switch such as -NoNewline comes before a positional path: name -Path and -Value, or use Write) '
|
|
62
|
+
+ 'and output redirected to nul outside cmd.exe (use $null in PowerShell, /dev/null in Bash).]';
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Runs a shell tool's command and adds the stray-file note to whatever it reports. A command that
|
|
66
|
+
* fails reports through its error, so the note is added there too: the command that leaves such a
|
|
67
|
+
* file behind has usually failed on the next line.
|
|
68
|
+
*/
|
|
69
|
+
export async function withStrayFileNotice(directory, run) {
|
|
70
|
+
const before = await directoryNames(directory);
|
|
71
|
+
try {
|
|
72
|
+
const output = await run();
|
|
73
|
+
return output + await strayFileNotice(directory, before);
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
const notice = await strayFileNotice(directory, before);
|
|
77
|
+
if (notice && error instanceof Error)
|
|
78
|
+
error.message += notice;
|
|
79
|
+
throw error;
|
|
80
|
+
}
|
|
81
|
+
}
|
package/dist/src/subagent-run.js
CHANGED
|
@@ -11,12 +11,12 @@ import { createRunTelemetry, recordModelUse } from './telemetry/capture.js';
|
|
|
11
11
|
import { checkGraphModelHealth } from './graph-health.js';
|
|
12
12
|
import { validateGraph } from './graphs.js';
|
|
13
13
|
import { runGraph } from './runtime.js';
|
|
14
|
-
import { createTools } from './tools.js';
|
|
15
14
|
import { loadWorkspaceInstructions } from './workspace-instructions.js';
|
|
16
15
|
import { extensionSnapshot } from './extensions.js';
|
|
17
16
|
import { resolveModelContext } from './model-metadata.js';
|
|
18
17
|
import { MemoryManager } from './memory/MemoryManager.js';
|
|
19
18
|
import { LocalToolMemory } from './memory/LocalToolMemory.js';
|
|
19
|
+
import { ProjectMemory } from './memory/ProjectMemory.js';
|
|
20
20
|
import { ArtifactStore } from './artifacts.js';
|
|
21
21
|
import { CodeIntelligenceManager } from './code-intelligence/CodeIntelligenceManager.js';
|
|
22
22
|
import { DecisionManager } from './decision/DecisionManager.js';
|
|
@@ -536,6 +536,7 @@ export class SubagentRunner {
|
|
|
536
536
|
let codeIntel;
|
|
537
537
|
/** The repository's learned command guidance, when the installation keeps it. */
|
|
538
538
|
let commandMemory;
|
|
539
|
+
let projectMemory;
|
|
539
540
|
/** The checkpoint writes, chained so the newest conversation is the file's content. */
|
|
540
541
|
let checkpointWrites = Promise.resolve();
|
|
541
542
|
try {
|
|
@@ -614,6 +615,8 @@ export class SubagentRunner {
|
|
|
614
615
|
// run honours it like any other run.
|
|
615
616
|
if (config.commandMemory !== false)
|
|
616
617
|
commandMemory = await LocalToolMemory.open({ workspace: run.workspace, directory: run.directory });
|
|
618
|
+
if (config.projectMemory !== false)
|
|
619
|
+
projectMemory = await ProjectMemory.open({ home: run.directory, workspace: run.workspace });
|
|
617
620
|
// The checkpoints land one at a time, newest last: the runner calls back synchronously from
|
|
618
621
|
// several nodes, and an unserialized write could leave an older conversation as the file's
|
|
619
622
|
// final content.
|
|
@@ -635,6 +638,7 @@ export class SubagentRunner {
|
|
|
635
638
|
// while its checkpoint was still queued could be killed with that conversation unwritten.
|
|
636
639
|
return checkpointWrites;
|
|
637
640
|
};
|
|
641
|
+
const { createTools } = await import('./tools.js');
|
|
638
642
|
const graphOptions = {
|
|
639
643
|
task: run.task, runId: run.runId, provider: run.providerId, model: run.model,
|
|
640
644
|
adapter: adapterFor(resolvedProvider),
|
|
@@ -673,6 +677,7 @@ export class SubagentRunner {
|
|
|
673
677
|
context,
|
|
674
678
|
artifactStore,
|
|
675
679
|
...(commandMemory ? { commandMemory } : {}),
|
|
680
|
+
...(projectMemory ? { projectMemory } : {}),
|
|
676
681
|
memory,
|
|
677
682
|
decisionManager: new DecisionManager({ config: await subagentDecisionConfig(config, () => (options.membership ?? getMembership)(signal)), onEvent: event => this.observe(run, event) }),
|
|
678
683
|
decisionNodeOptIn: true,
|
|
@@ -427,7 +427,7 @@ export declare class TerminalUI extends EventEmitter {
|
|
|
427
427
|
loadScreen<T>(title: string, load: (signal: AbortSignal) => Promise<T>, options?: ScreenOptions): Promise<T | undefined>;
|
|
428
428
|
private openModal;
|
|
429
429
|
private finishModal;
|
|
430
|
-
print(text: string, detail?: string, toolCall?: ToolCallStamp, conversation?: boolean, notice?: boolean, alignRight?: boolean): void;
|
|
430
|
+
print(text: string, detail?: string, toolCall?: ToolCallStamp, conversation?: boolean, notice?: boolean, alignRight?: boolean, clipRows?: boolean): void;
|
|
431
431
|
/**
|
|
432
432
|
* Echo submitted text as its own bordered box.
|
|
433
433
|
*
|
package/dist/src/terminal-ui.js
CHANGED
|
@@ -1131,7 +1131,7 @@ export class TerminalUI extends EventEmitter {
|
|
|
1131
1131
|
modal.resolve(value);
|
|
1132
1132
|
this.scheduleRender();
|
|
1133
1133
|
}
|
|
1134
|
-
print(text, detail, toolCall, conversation = false, notice = true, alignRight = false) {
|
|
1134
|
+
print(text, detail, toolCall, conversation = false, notice = true, alignRight = false, clipRows = false) {
|
|
1135
1135
|
if (notice) {
|
|
1136
1136
|
this.dashboardNotices.push(clean(String(text)).slice(0, 100_000));
|
|
1137
1137
|
this.dashboardNotices = this.dashboardNotices.slice(-12);
|
|
@@ -1140,7 +1140,7 @@ export class TerminalUI extends EventEmitter {
|
|
|
1140
1140
|
if (this.modal?.kind === 'loading')
|
|
1141
1141
|
this.modal.lines = [...this.modal.lines, ...lines].slice(-100);
|
|
1142
1142
|
const entry = { text: lines.join('\n'), ...(detail ? { detail: clean(detail) } : {}),
|
|
1143
|
-
...(toolCall ? { toolCall, timing: this.toolClock.get(toolCall.key) } : {}), ...(conversation ? { conversation: true } : {}), ...(alignRight ? { alignRight: true } : {}) };
|
|
1143
|
+
...(toolCall ? { toolCall, timing: this.toolClock.get(toolCall.key) } : {}), ...(conversation ? { conversation: true } : {}), ...(alignRight ? { alignRight: true } : {}), ...(clipRows && detail ? { clipRows: true } : {}) };
|
|
1144
1144
|
if (this.scroll)
|
|
1145
1145
|
this.scroll += this.transcriptRows(entry, this.chatColumns()).length;
|
|
1146
1146
|
this.transcript.append(entry);
|
|
@@ -2946,13 +2946,13 @@ export class TerminalUI extends EventEmitter {
|
|
|
2946
2946
|
return [
|
|
2947
2947
|
clip(brand.at(-1), available),
|
|
2948
2948
|
...(viewportHeight >= 2 ? [clip(`● ${activity}`, available)] : []),
|
|
2949
|
-
...(viewportHeight >= 3 ? [clip(`
|
|
2949
|
+
...(viewportHeight >= 3 ? [clip(`Graph · ${graphName}`, available)] : []),
|
|
2950
2950
|
...(status.graphNeedsOverride && viewportHeight >= 4 ? [paint(clip(OVERRIDE_HINT, available), ATTENTION)] : []),
|
|
2951
2951
|
];
|
|
2952
2952
|
return [
|
|
2953
2953
|
'', ...brand, '',
|
|
2954
2954
|
clip(`● ${activity}`, available),
|
|
2955
|
-
clip(`
|
|
2955
|
+
clip(`Graph · ${graphName}${nodeCount}`, available),
|
|
2956
2956
|
...(status.graphNeedsOverride ? [paint(clip(OVERRIDE_HINT, available), ATTENTION)] : []),
|
|
2957
2957
|
'',
|
|
2958
2958
|
...(viewportHeight >= 10 ? ['Describe a task to get started.'] : []),
|
|
@@ -3101,7 +3101,13 @@ export class TerminalUI extends EventEmitter {
|
|
|
3101
3101
|
? promptExpanded && entry.detail ? entry.detail : entry.text
|
|
3102
3102
|
: this.expandedTranscript && entry.detail ? entry.detail : entry.text + (entry.detail ? ' (Ctrl+O to expand)' : '');
|
|
3103
3103
|
if (!entry.toolCall) {
|
|
3104
|
-
|
|
3104
|
+
// A collapsed tool result holds each output row to one screen line; Ctrl+O shows the rows
|
|
3105
|
+
// whole. The last row is the `… N lines total (Ctrl+O to expand)` marker, which still wraps
|
|
3106
|
+
// so a narrow pane never hides the key that reveals the rest.
|
|
3107
|
+
const shown = entry.clipRows && text !== entry.detail
|
|
3108
|
+
? text.split('\n').map((row, index, rows) => index < rows.length - 1 ? clip(row, Math.max(1, width - 4)) : row).join('\n')
|
|
3109
|
+
: text;
|
|
3110
|
+
const rows = this.wrapTranscript(shown + '\n', width, entry.alignRight === true);
|
|
3105
3111
|
if (!disclosure)
|
|
3106
3112
|
return rows;
|
|
3107
3113
|
return rows.map(row => {
|