@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.
- package/dist/src/account-presentation.js +3 -3
- package/dist/src/agent-execution.d.ts +2 -0
- package/dist/src/agent-execution.js +526 -41
- package/dist/src/agent-mcp-catalog.d.ts +21 -0
- package/dist/src/agent-mcp-catalog.js +40 -0
- package/dist/src/agent-mcp.d.ts +36 -3
- package/dist/src/agent-mcp.js +114 -45
- package/dist/src/app-server/protocol.d.ts +57 -5
- package/dist/src/app-server/protocol.js +18 -1
- package/dist/src/app-server/workspace.d.ts +9 -1
- package/dist/src/app-server/workspace.js +50 -3
- package/dist/src/app-server.d.ts +115 -41
- package/dist/src/app-server.js +1316 -221
- package/dist/src/auth/AuthManager.d.ts +33 -1
- package/dist/src/auth/AuthManager.js +138 -10
- package/dist/src/auth/callback-page.d.ts +4 -0
- package/dist/src/auth/callback-page.js +70 -0
- package/dist/src/auth/callback.d.ts +39 -0
- package/dist/src/auth/callback.js +146 -22
- package/dist/src/auth/index.d.ts +10 -6
- package/dist/src/auth/index.js +2 -2
- package/dist/src/auth/store.d.ts +142 -3
- package/dist/src/auth/store.js +334 -13
- package/dist/src/auth/types.d.ts +17 -1
- package/dist/src/auth-commands.d.ts +11 -2
- package/dist/src/auth-commands.js +14 -7
- package/dist/src/automation-runner.d.ts +9 -0
- package/dist/src/automation-runner.js +22 -1
- package/dist/src/automation-tool.js +18 -3
- package/dist/src/automations.d.ts +5 -0
- package/dist/src/automations.js +11 -1
- package/dist/src/browser-captcha-tool.d.ts +54 -0
- package/dist/src/browser-captcha-tool.js +374 -0
- package/dist/src/browser-panel-tool.d.ts +7 -0
- package/dist/src/browser-panel-tool.js +74 -3
- package/dist/src/browser-runner.js +19 -4
- package/dist/src/browser-server.js +21 -1
- package/dist/src/browser-session.d.ts +16 -0
- package/dist/src/browser-session.js +35 -0
- package/dist/src/browser-ui/app.js +193 -3
- package/dist/src/browser-ui/style.css +15 -1
- package/dist/src/browser-view.d.ts +72 -4
- package/dist/src/browser-view.js +229 -17
- package/dist/src/capabilities.d.ts +9 -3
- package/dist/src/capabilities.js +20 -5
- package/dist/src/capsolver.d.ts +60 -0
- package/dist/src/capsolver.js +101 -0
- package/dist/src/claude-provider.d.ts +6 -0
- package/dist/src/claude-provider.js +34 -3
- package/dist/src/cli-executable.d.ts +33 -0
- package/dist/src/cli-executable.js +64 -0
- package/dist/src/cli-process.d.ts +47 -0
- package/dist/src/cli-process.js +113 -0
- package/dist/src/cli-sign-in.d.ts +68 -0
- package/dist/src/cli-sign-in.js +224 -0
- package/dist/src/cli.js +84 -26
- package/dist/src/code-intelligence/CodeIntelligenceManager.d.ts +1 -1
- package/dist/src/code-intelligence/CodeIntelligenceManager.js +5 -5
- package/dist/src/codex-provider.js +12 -0
- package/dist/src/coding-tools.d.ts +5 -0
- package/dist/src/coding-tools.js +98 -53
- package/dist/src/command-output-tap.d.ts +16 -0
- package/dist/src/command-output-tap.js +45 -0
- package/dist/src/command-screens.js +3 -3
- package/dist/src/commands.d.ts +15 -2
- package/dist/src/commands.js +14 -13
- package/dist/src/completion.d.ts +23 -5
- package/dist/src/completion.js +380 -17
- package/dist/src/config.d.ts +61 -0
- package/dist/src/config.js +276 -12
- package/dist/src/context-budget.d.ts +7 -0
- package/dist/src/context-budget.js +18 -1
- package/dist/src/deadline.js +6 -0
- package/dist/src/decision/FactContinuations.d.ts +41 -6
- package/dist/src/decision/FactContinuations.js +211 -64
- package/dist/src/decision/PreparedSteps.js +3 -1
- package/dist/src/decision/checks.d.ts +25 -0
- package/dist/src/decision/checks.js +77 -6
- package/dist/src/delegation-changes.d.ts +109 -0
- package/dist/src/delegation-changes.js +431 -0
- package/dist/src/extensions.d.ts +1 -0
- package/dist/src/extensions.js +16 -3
- package/dist/src/graph-provider-portability.js +2 -2
- package/dist/src/graph-quota.d.ts +1 -1
- package/dist/src/graph-quota.js +1 -1
- package/dist/src/graph-runner.js +35 -21
- package/dist/src/graph-selection.d.ts +6 -0
- package/dist/src/graph-selection.js +10 -0
- package/dist/src/graph-server.d.ts +8 -0
- package/dist/src/graph-server.js +76 -6
- package/dist/src/graph-sync.d.ts +65 -0
- package/dist/src/graph-sync.js +433 -13
- package/dist/src/graph-tool.d.ts +52 -0
- package/dist/src/graph-tool.js +136 -0
- package/dist/src/graph-ui/app.js +272 -50
- package/dist/src/graph-ui/controls.js +6 -0
- package/dist/src/graph-ui/drafts.js +39 -0
- package/dist/src/graph-ui/embed.js +1 -1
- package/dist/src/graph-ui/icons.js +1 -0
- package/dist/src/graph-ui/index.html +2 -2
- package/dist/src/graph-ui/skill-picker.js +242 -0
- package/dist/src/graph-ui/studio.css +7 -5
- package/dist/src/graph-ui/style.css +65 -12
- package/dist/src/graphs.d.ts +60 -5
- package/dist/src/graphs.js +191 -37
- package/dist/src/grok-provider.d.ts +50 -0
- package/dist/src/grok-provider.js +186 -0
- package/dist/src/handoffs.d.ts +13 -0
- package/dist/src/handoffs.js +31 -1
- package/dist/src/hardened-runtime.d.ts +4 -4
- package/dist/src/hardened-runtime.js +109 -9
- package/dist/src/managed-sign-in.d.ts +38 -0
- package/dist/src/managed-sign-in.js +169 -0
- package/dist/src/markdown.d.ts +5 -0
- package/dist/src/markdown.js +5 -2
- package/dist/src/mcp.js +11 -0
- package/dist/src/membership.d.ts +8 -1
- package/dist/src/membership.js +15 -5
- package/dist/src/model-metadata.js +14 -2
- package/dist/src/model-override.d.ts +10 -0
- package/dist/src/model-override.js +20 -0
- package/dist/src/opencode-cli-provider.d.ts +122 -0
- package/dist/src/opencode-cli-provider.js +415 -0
- package/dist/src/opencode-provider.js +23 -8
- package/dist/src/palette.d.ts +2 -0
- package/dist/src/palette.js +2 -0
- package/dist/src/permissions.d.ts +19 -1
- package/dist/src/permissions.js +30 -1
- package/dist/src/powershell-pool.d.ts +11 -2
- package/dist/src/powershell-pool.js +34 -5
- package/dist/src/provider-connection.js +36 -0
- package/dist/src/provider-engine.d.ts +2 -1
- package/dist/src/provider-engine.js +64 -13
- package/dist/src/provider-import.js +6 -1
- package/dist/src/provider-keys.d.ts +48 -0
- package/dist/src/provider-keys.js +121 -0
- package/dist/src/provider-settings.js +22 -3
- package/dist/src/providers.d.ts +12 -1
- package/dist/src/providers.js +27 -8
- package/dist/src/pull-requests.d.ts +123 -20
- package/dist/src/pull-requests.js +334 -84
- package/dist/src/qa/qa-authorize.js +9 -1
- package/dist/src/qa/runtime/ProcessManager.d.ts +6 -0
- package/dist/src/qa/runtime/ProcessManager.js +16 -0
- package/dist/src/react-runtime.js +106 -7
- package/dist/src/read-image.d.ts +30 -0
- package/dist/src/read-image.js +97 -0
- package/dist/src/remote/engine-pool.js +1 -1
- package/dist/src/run-progress.js +6 -1
- package/dist/src/run-records.d.ts +133 -27
- package/dist/src/run-records.js +320 -40
- package/dist/src/runtime.d.ts +38 -1
- package/dist/src/runtime.js +27 -4
- package/dist/src/save-lock.d.ts +11 -0
- package/dist/src/save-lock.js +29 -2
- package/dist/src/secret-redaction.d.ts +13 -0
- package/dist/src/secret-redaction.js +71 -0
- package/dist/src/session-summary.d.ts +10 -4
- package/dist/src/session-summary.js +14 -7
- package/dist/src/sessions.js +8 -2
- package/dist/src/shell.js +4 -1
- package/dist/src/side-panel.d.ts +1 -1
- package/dist/src/side-panel.js +1 -1
- package/dist/src/skill-commands.d.ts +2 -0
- package/dist/src/skill-commands.js +2 -0
- package/dist/src/skills/bundled/create-agent/SKILL.md +81 -0
- package/dist/src/skills/bundled/create-skill/SKILL.md +81 -0
- package/dist/src/skills/bundled/doctor/SKILL.md +43 -0
- package/dist/src/skills/bundled/graph-manager/SKILL.md +100 -0
- package/dist/src/skills/bundled/graph-manager/errors.md +38 -0
- package/dist/src/skills/bundled/graph-manager/patterns.md +78 -0
- package/dist/src/skills/bundled/manage-mcp/SKILL.md +75 -0
- package/dist/src/skills/bundled/manage-mcp/probe.md +165 -0
- package/dist/src/skills/bundled/manage-skills/SKILL.md +67 -0
- package/dist/src/skills/bundled/provenance.json +50 -0
- package/dist/src/skills/bundled/write-instructions/SKILL.md +42 -0
- package/dist/src/skills/invocable-skills.d.ts +41 -0
- package/dist/src/skills/invocable-skills.js +49 -0
- package/dist/src/skills/prompt-skills.d.ts +1 -0
- package/dist/src/skills/prompt-skills.js +33 -0
- package/dist/src/skills/runtime-skills.d.ts +4 -0
- package/dist/src/skills/runtime-skills.js +21 -0
- package/dist/src/structured-step.d.ts +55 -0
- package/dist/src/structured-step.js +85 -0
- package/dist/src/subagent-run.d.ts +1 -1
- package/dist/src/subagent-run.js +29 -33
- package/dist/src/telemetry/schema.d.ts +2 -2
- package/dist/src/telemetry/schema.js +3 -2
- package/dist/src/terminal-ui.d.ts +38 -0
- package/dist/src/terminal-ui.js +126 -28
- package/dist/src/timers.d.ts +21 -2
- package/dist/src/timers.js +12 -4
- package/dist/src/tool-dependencies.js +4 -0
- package/dist/src/tool-names.d.ts +18 -0
- package/dist/src/tool-names.js +26 -0
- package/dist/src/tools.d.ts +9 -0
- package/dist/src/tools.js +159 -20
- package/dist/src/trajectory.js +32 -12
- package/dist/src/transcript.js +5 -0
- package/dist/src/types.d.ts +36 -0
- package/dist/src/web-search.d.ts +59 -0
- package/dist/src/web-search.js +216 -0
- package/docs/agents/README.md +2 -2
- package/docs/agents/mcp-server.md +28 -3
- package/docs/agents/subagent-mode.md +7 -4
- package/docs/concepts/README.md +1 -1
- package/docs/concepts/security.md +4 -2
- package/docs/getting-started/accounts.md +15 -4
- package/docs/getting-started/configure-providers.md +30 -3
- package/docs/guides/README.md +1 -0
- package/docs/guides/browser.md +12 -0
- package/docs/guides/desktop-app.md +11 -4
- package/docs/guides/graph-builder.md +9 -1
- package/docs/guides/web-search.md +47 -0
- package/docs/reference/cli.md +4 -3
- package/docs/reference/config.md +4 -4
- package/docs/reference/slash-commands.md +2 -1
- package/docs/superpowers/plans/2026-11-06-graph-soft-delete.md +125 -0
- package/docs/superpowers/plans/2026-11-09-orchestrator-delegation.md +295 -0
- package/docs/superpowers/specs/2026-11-01-pr-section-design.md +7 -0
- package/docs/superpowers/specs/2026-11-06-bundled-skills-design.md +206 -0
- package/docs/superpowers/specs/2026-11-09-orchestrator-delegation-design.md +291 -0
- package/package.json +1 -1
- package/tests/permissions-test-plan.md +2 -1
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { AGENT_MCP_GRAPH_TOOLS } from './agent-mcp-catalog.js';
|
|
2
|
+
import { approveOperation } from './capabilities.js';
|
|
3
|
+
import { configDirectory } from './config.js';
|
|
4
|
+
import { assertPlanMutationAllowed } from './permissions.js';
|
|
5
|
+
/** Actions that save a revision to the account's graph store; drafts and reads stay in memory. */
|
|
6
|
+
const DURABLE_ACTIONS = new Set(['andorra_graph_publish', 'andorra_graph_delete', 'andorra_graph_restore']);
|
|
7
|
+
const ACTIONS = AGENT_MCP_GRAPH_TOOLS.map(tool => tool.name);
|
|
8
|
+
/** A published graph is commonly tens of kilobytes; a reply is bounded, never silently cut mid-graph. */
|
|
9
|
+
const MAX_REPLY_CHARS = 100_000;
|
|
10
|
+
/** Drafts expire after an hour in the backend, so an idle backend is closed no sooner. */
|
|
11
|
+
const DEFAULT_IDLE_CLOSE_MS = 60 * 60_000;
|
|
12
|
+
/**
|
|
13
|
+
* One graph backend per installation directory, created on the first graph action and closed after
|
|
14
|
+
* an idle hour.
|
|
15
|
+
*
|
|
16
|
+
* Shared across the tasks of one process so a draft begun in one task survives into the next, and so
|
|
17
|
+
* at most one cloud-sync loop runs per home however many tasks touch graphs. Nothing is loaded until
|
|
18
|
+
* a graph action runs: the backend module pulls in graph sync, membership and the subagent runner.
|
|
19
|
+
*/
|
|
20
|
+
export class GraphBackendPool {
|
|
21
|
+
options;
|
|
22
|
+
entries = new Map();
|
|
23
|
+
constructor(options = {}) {
|
|
24
|
+
this.options = options;
|
|
25
|
+
}
|
|
26
|
+
async call(directory, action, args, options = {}) {
|
|
27
|
+
let entry = this.entries.get(directory);
|
|
28
|
+
if (!entry) {
|
|
29
|
+
const backend = (this.options.create ?? defaultBackend)(directory);
|
|
30
|
+
entry = { backend, active: 0 };
|
|
31
|
+
this.entries.set(directory, entry);
|
|
32
|
+
// A failed construction must not poison the directory: the next action tries again.
|
|
33
|
+
backend.catch(() => { if (this.entries.get(directory)?.backend === backend)
|
|
34
|
+
this.entries.delete(directory); });
|
|
35
|
+
}
|
|
36
|
+
clearTimeout(entry.timer);
|
|
37
|
+
entry.active++;
|
|
38
|
+
try {
|
|
39
|
+
return await (await entry.backend).call(action, args, options);
|
|
40
|
+
}
|
|
41
|
+
finally {
|
|
42
|
+
entry.active--;
|
|
43
|
+
if (entry.active === 0 && this.entries.get(directory) === entry) {
|
|
44
|
+
entry.timer = setTimeout(() => { void this.closeEntry(directory, entry); }, this.options.idleCloseMs ?? DEFAULT_IDLE_CLOSE_MS);
|
|
45
|
+
entry.timer.unref?.();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/** Close every backend (tests, shutdown). A later action opens a fresh one. */
|
|
50
|
+
async close() {
|
|
51
|
+
await Promise.all([...this.entries].map(([directory, entry]) => this.closeEntry(directory, entry)));
|
|
52
|
+
}
|
|
53
|
+
/** Open backends, by directory; for tests that prove laziness and idle closing. */
|
|
54
|
+
get size() { return this.entries.size; }
|
|
55
|
+
async closeEntry(directory, entry) {
|
|
56
|
+
clearTimeout(entry.timer);
|
|
57
|
+
if (entry.active > 0 || this.entries.get(directory) !== entry)
|
|
58
|
+
return;
|
|
59
|
+
this.entries.delete(directory);
|
|
60
|
+
await (await entry.backend.catch(() => undefined))?.close().catch(() => { });
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async function defaultBackend(directory) {
|
|
64
|
+
const { AgentMcpBackend } = await import('./agent-mcp.js');
|
|
65
|
+
return new AgentMcpBackend({ directory, recoverRuns: false });
|
|
66
|
+
}
|
|
67
|
+
const sharedPool = new GraphBackendPool();
|
|
68
|
+
/** `name {arg*, arg}`: the arguments each action takes, `*` marking the required ones. */
|
|
69
|
+
function actionSummary() {
|
|
70
|
+
return AGENT_MCP_GRAPH_TOOLS.map(tool => {
|
|
71
|
+
const { properties, required } = tool.inputSchema;
|
|
72
|
+
const names = Object.keys(properties).map(key => required.includes(key) ? `${key}*` : key);
|
|
73
|
+
return names.length ? `${tool.name} {${names.join(', ')}}` : tool.name;
|
|
74
|
+
}).join('; ');
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The engine's built-in graph authoring tool: the graph MCP server's graph actions, in process.
|
|
78
|
+
*
|
|
79
|
+
* Agents inside Andorra get graph authoring without a configured MCP server, a child process or an
|
|
80
|
+
* `andorra` command on PATH. One tool with an `action` keeps every request's schema small; the action
|
|
81
|
+
* names are the MCP tool names, so the guide, the graph-manager skill and the error codes apply as-is.
|
|
82
|
+
*/
|
|
83
|
+
export function createGraphTool(pool = sharedPool) {
|
|
84
|
+
return {
|
|
85
|
+
name: 'graphs', capability: 'external', executionMode: 'sequential',
|
|
86
|
+
description: 'Create, edit, validate, publish, delete or restore Andorra graphs (multi-agent workflows) in the signed-in account\'s graph store, the same store the Graph Builder and graph picker use. Never write graph files on disk. '
|
|
87
|
+
+ 'Call action andorra_graph_guide first for node types, ports, limits and error codes; load the skill andorra:graph-manager to design a graph with the user. '
|
|
88
|
+
+ 'Put the action\'s arguments in args. Drafts are kept in this Andorra process for up to an hour; publish saves a revision and syncs it to the account. Publish, delete and restore ask for permission. '
|
|
89
|
+
+ `Actions and their args (* required): ${actionSummary()}.`,
|
|
90
|
+
parameters: { type: 'object', additionalProperties: false, properties: {
|
|
91
|
+
action: { type: 'string', enum: ACTIONS },
|
|
92
|
+
args: { type: 'object', description: 'Arguments of the action; omit for actions that take none.' },
|
|
93
|
+
}, required: ['action'] },
|
|
94
|
+
execute: async (args, context) => {
|
|
95
|
+
context.signal.throwIfAborted();
|
|
96
|
+
if (Object.keys(args).some(key => key !== 'action' && key !== 'args'))
|
|
97
|
+
throw new Error('graphs takes only action and args.');
|
|
98
|
+
const action = args.action;
|
|
99
|
+
if (typeof action !== 'string' || !ACTIONS.includes(action))
|
|
100
|
+
throw new Error(`action must be one of: ${ACTIONS.join(', ')}.`);
|
|
101
|
+
const input = args.args ?? {};
|
|
102
|
+
if (!input || typeof input !== 'object' || Array.isArray(input))
|
|
103
|
+
throw new Error('args must be an object.');
|
|
104
|
+
// Saving changes the account's graphs and syncs them to every machine: the same gate
|
|
105
|
+
// automations use for durable work, which also refuses it in plan mode.
|
|
106
|
+
if (DURABLE_ACTIONS.has(action))
|
|
107
|
+
await approveOperation(context, 'graphs', { action, args: input });
|
|
108
|
+
context.signal.throwIfAborted();
|
|
109
|
+
// The approval above is not the last word: the backend still awaits sign-in checks and cloud
|
|
110
|
+
// sync before it writes. Re-check right before the write, so a task cancelled or switched to
|
|
111
|
+
// Plan in the meantime saves nothing, and report that refusal rather than a backend error.
|
|
112
|
+
let refused;
|
|
113
|
+
const beforeSave = () => {
|
|
114
|
+
try {
|
|
115
|
+
context.signal.throwIfAborted();
|
|
116
|
+
assertPlanMutationAllowed(context);
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
refused = error;
|
|
120
|
+
throw error;
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
const reply = await pool.call(context.automationDirectory ?? configDirectory(), action, input, { beforeSave });
|
|
124
|
+
if (refused !== undefined)
|
|
125
|
+
throw refused;
|
|
126
|
+
let text = JSON.stringify(reply);
|
|
127
|
+
if (text.length > MAX_REPLY_CHARS)
|
|
128
|
+
text = JSON.stringify({ ok: reply.ok, truncated: true,
|
|
129
|
+
note: `The reply exceeded ${MAX_REPLY_CHARS} characters and is shown only in part.`,
|
|
130
|
+
preview: text.slice(0, 2_000) });
|
|
131
|
+
if (!reply.ok)
|
|
132
|
+
throw new Error(text);
|
|
133
|
+
return text;
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
}
|