@andorra-labs/code 0.1.5 → 0.1.6
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 +126 -20
- package/dist/src/agent-mcp.d.ts +18 -1
- package/dist/src/agent-mcp.js +103 -8
- package/dist/src/app-server/protocol.d.ts +33 -3
- package/dist/src/app-server/protocol.js +14 -1
- package/dist/src/app-server/workspace.d.ts +1 -0
- package/dist/src/app-server/workspace.js +7 -1
- package/dist/src/app-server.d.ts +115 -41
- package/dist/src/app-server.js +1229 -219
- package/dist/src/automation-runner.d.ts +9 -0
- package/dist/src/automation-runner.js +22 -1
- package/dist/src/automation-tool.js +8 -1
- package/dist/src/automations.js +1 -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.js +13 -2
- 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 +53 -22
- package/dist/src/code-intelligence/CodeIntelligenceManager.d.ts +1 -1
- package/dist/src/code-intelligence/CodeIntelligenceManager.js +5 -5
- package/dist/src/coding-tools.js +44 -5
- 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 +10 -1
- package/dist/src/commands.js +7 -7
- package/dist/src/completion.d.ts +23 -5
- package/dist/src/completion.js +334 -17
- package/dist/src/config.d.ts +13 -0
- package/dist/src/config.js +28 -2
- package/dist/src/deadline.js +6 -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 +7 -0
- package/dist/src/graph-server.js +61 -3
- package/dist/src/graph-sync.d.ts +50 -0
- package/dist/src/graph-sync.js +383 -12
- package/dist/src/graph-ui/app.js +61 -8
- package/dist/src/graph-ui/icons.js +1 -0
- package/dist/src/graph-ui/index.html +1 -1
- package/dist/src/graph-ui/skill-picker.js +242 -0
- package/dist/src/graph-ui/style.css +19 -0
- package/dist/src/graphs.d.ts +46 -4
- package/dist/src/graphs.js +152 -27
- 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/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 +2 -2
- package/dist/src/powershell-pool.js +18 -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-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 +111 -17
- package/dist/src/pull-requests.js +308 -76
- package/dist/src/qa/qa-authorize.js +9 -1
- package/dist/src/react-runtime.js +76 -5
- 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/sessions.js +4 -1
- 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 +97 -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 +29 -0
- package/dist/src/terminal-ui.js +112 -28
- package/dist/src/timers.d.ts +21 -2
- package/dist/src/timers.js +12 -4
- package/dist/src/tool-names.d.ts +18 -0
- package/dist/src/tool-names.js +26 -0
- package/dist/src/tools.js +45 -11
- package/dist/src/trajectory.js +32 -12
- package/dist/src/types.d.ts +23 -0
- package/docs/agents/mcp-server.md +13 -1
- package/docs/agents/subagent-mode.md +7 -4
- package/docs/concepts/security.md +2 -0
- package/docs/getting-started/configure-providers.md +29 -2
- package/docs/guides/browser.md +12 -0
- package/docs/guides/desktop-app.md +10 -3
- package/docs/guides/graph-builder.md +8 -0
- package/docs/reference/config.md +2 -2
- package/docs/superpowers/plans/2026-11-06-graph-soft-delete.md +125 -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/package.json +1 -1
- package/tests/permissions-test-plan.md +2 -1
package/dist/src/timers.d.ts
CHANGED
|
@@ -59,6 +59,11 @@ export interface WakeCarry {
|
|
|
59
59
|
input?: Record<string, unknown>;
|
|
60
60
|
state?: Record<string, unknown>;
|
|
61
61
|
}
|
|
62
|
+
/** Which attempt, and which node of its graph, armed a wake. */
|
|
63
|
+
export interface WakeOrigin {
|
|
64
|
+
runId: string;
|
|
65
|
+
nodeId: string;
|
|
66
|
+
}
|
|
62
67
|
export interface ArmedTimer {
|
|
63
68
|
id: string;
|
|
64
69
|
/** The prompt delivered when the timer fires, exactly as the agent submitted it. */
|
|
@@ -76,6 +81,16 @@ export interface ArmedTimer {
|
|
|
76
81
|
owner?: string;
|
|
77
82
|
/** What the run that armed this wake was started with, so its delivery can start the same kind of run. */
|
|
78
83
|
carry?: WakeCarry;
|
|
84
|
+
/**
|
|
85
|
+
* The attempt and graph node that armed this wake, when a graph node armed it.
|
|
86
|
+
*
|
|
87
|
+
* A wake is the arming node's own reminder about the work it was doing, so it is delivered back to that
|
|
88
|
+
* work: into the node while its run is still going, or as a continuation of the attempt from that node's
|
|
89
|
+
* checkpoint once the attempt stopped. It is never a new task that enters the graph at its entry node.
|
|
90
|
+
* A wake without it - armed by a surface that runs no graph node, or held from before the field existed -
|
|
91
|
+
* is delivered the way such wakes always were.
|
|
92
|
+
*/
|
|
93
|
+
origin?: WakeOrigin;
|
|
79
94
|
/**
|
|
80
95
|
* Earliest epoch milliseconds at which a drain may take this wake, set when a delivery hands it back.
|
|
81
96
|
*
|
|
@@ -118,11 +133,15 @@ export declare class TimerRegistry {
|
|
|
118
133
|
* wait it is still waiting on — and, for an engine, that it still owns the wake the run has not yet carried.
|
|
119
134
|
*/
|
|
120
135
|
list(owner?: string): ArmedTimer[];
|
|
136
|
+
/** One armed wake by id, whether or not a delivery holds it. */
|
|
137
|
+
get(id: string): ArmedTimer | undefined;
|
|
121
138
|
/** A wake in hand: taken for delivery, and still owed until {@link settle} or {@link restore} says otherwise. */
|
|
122
139
|
private held;
|
|
140
|
+
/** Whether a delivery has taken this wake and not yet said what became of it. */
|
|
141
|
+
isHeld(id: string): boolean;
|
|
123
142
|
/** The earliest epoch milliseconds at which a drain may take this wake again. */
|
|
124
143
|
private nextTakeAt;
|
|
125
|
-
arm(seconds: number, prompt: string, owner?: string, carry?: WakeCarry): ArmedTimer;
|
|
144
|
+
arm(seconds: number, prompt: string, owner?: string, carry?: WakeCarry, origin?: WakeOrigin): ArmedTimer;
|
|
126
145
|
/**
|
|
127
146
|
* Arm (or re-arm) the one wake-up for a timer.
|
|
128
147
|
*
|
|
@@ -147,7 +166,7 @@ export declare class TimerRegistry {
|
|
|
147
166
|
* answers for a session the moment its deadline passes and the run only later, this is the difference between
|
|
148
167
|
* a reload finding the wake it must keep routing to that engine, and a reload concluding nothing is owed.
|
|
149
168
|
*/
|
|
150
|
-
takeDueOne(now?: number, owner?: string): ArmedTimer | undefined;
|
|
169
|
+
takeDueOne(now?: number, owner?: string, accept?: (timer: ArmedTimer) => boolean): ArmedTimer | undefined;
|
|
151
170
|
/**
|
|
152
171
|
* Say a taken wake has been delivered or spent: it is no longer owed, and no longer waits.
|
|
153
172
|
*
|
package/dist/src/timers.js
CHANGED
|
@@ -73,15 +73,23 @@ export class TimerRegistry {
|
|
|
73
73
|
return (owner === undefined ? waiting : waiting.filter(timer => timer.owner === owner))
|
|
74
74
|
.sort((left, right) => left.fireAt - right.fireAt);
|
|
75
75
|
}
|
|
76
|
+
/** One armed wake by id, whether or not a delivery holds it. */
|
|
77
|
+
get(id) {
|
|
78
|
+
return this.armed.get(id)?.timer;
|
|
79
|
+
}
|
|
76
80
|
/** A wake in hand: taken for delivery, and still owed until {@link settle} or {@link restore} says otherwise. */
|
|
77
81
|
held(timer) {
|
|
78
82
|
return this.armed.get(timer.id)?.held === true;
|
|
79
83
|
}
|
|
84
|
+
/** Whether a delivery has taken this wake and not yet said what became of it. */
|
|
85
|
+
isHeld(id) {
|
|
86
|
+
return this.armed.get(id)?.held === true;
|
|
87
|
+
}
|
|
80
88
|
/** The earliest epoch milliseconds at which a drain may take this wake again. */
|
|
81
89
|
nextTakeAt(timer) {
|
|
82
90
|
return Math.max(timer.fireAt, timer.notBefore ?? 0);
|
|
83
91
|
}
|
|
84
|
-
arm(seconds, prompt, owner, carry) {
|
|
92
|
+
arm(seconds, prompt, owner, carry, origin) {
|
|
85
93
|
if (typeof seconds !== 'number' || !Number.isSafeInteger(seconds) || seconds < MIN_TIMER_SECONDS || seconds > MAX_TIMER_SECONDS) {
|
|
86
94
|
throw new Error(`seconds must be an integer from ${MIN_TIMER_SECONDS} to ${MAX_TIMER_SECONDS}`);
|
|
87
95
|
}
|
|
@@ -94,7 +102,7 @@ export class TimerRegistry {
|
|
|
94
102
|
// Cloned, because the run keeps working with the objects it handed here: a wake must not see a scope that
|
|
95
103
|
// its arming run mutated after the prompt was armed.
|
|
96
104
|
const stored = carry === undefined || Object.keys(carry).length === 0 ? undefined : structuredClone(carry);
|
|
97
|
-
const timer = { id: randomUUID(), prompt: prompt.trim(), seconds, fireAt: Date.now() + seconds * 1_000, ...(owner === undefined ? {} : { owner }), ...(stored === undefined ? {} : { carry: stored }) };
|
|
105
|
+
const timer = { id: randomUUID(), prompt: prompt.trim(), seconds, fireAt: Date.now() + seconds * 1_000, ...(owner === undefined ? {} : { owner }), ...(stored === undefined ? {} : { carry: stored }), ...(origin === undefined ? {} : { origin: { runId: origin.runId, nodeId: origin.nodeId } }) };
|
|
98
106
|
const entry = { timer };
|
|
99
107
|
this.schedule(timer, entry, seconds * 1_000);
|
|
100
108
|
this.armed.set(timer.id, entry);
|
|
@@ -135,8 +143,8 @@ export class TimerRegistry {
|
|
|
135
143
|
* answers for a session the moment its deadline passes and the run only later, this is the difference between
|
|
136
144
|
* a reload finding the wake it must keep routing to that engine, and a reload concluding nothing is owed.
|
|
137
145
|
*/
|
|
138
|
-
takeDueOne(now = Date.now(), owner) {
|
|
139
|
-
const next = this.list(owner).find(timer => this.nextTakeAt(timer) <= now && !this.held(timer));
|
|
146
|
+
takeDueOne(now = Date.now(), owner, accept) {
|
|
147
|
+
const next = this.list(owner).find(timer => this.nextTakeAt(timer) <= now && !this.held(timer) && (accept === undefined || accept(timer)));
|
|
140
148
|
if (next === undefined)
|
|
141
149
|
return undefined;
|
|
142
150
|
const entry = this.armed.get(next.id);
|
package/dist/src/tool-names.d.ts
CHANGED
|
@@ -11,6 +11,24 @@ export declare function canonicalCodingToolName(name: string): CanonicalCodingTo
|
|
|
11
11
|
export declare function canonicalToolName(name: string): string;
|
|
12
12
|
export declare function toolNameMatches(configured: string, actual: string): boolean;
|
|
13
13
|
export declare function canonicalizeToolList(names: readonly string[] | undefined): string[] | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Rewrites the tool names one provider request sees and restores Andorra's names on everything
|
|
16
|
+
* that comes back. Canonical Andorra tool names use dots (`qa.fast`, `browser.panel`), while
|
|
17
|
+
* strict providers validate `function.name` against `^[a-zA-Z0-9_-]+$` and reject the whole
|
|
18
|
+
* request with an HTTP 400. The provider-side names are a pure transport encoding: journals,
|
|
19
|
+
* the executor and the desktop keep the canonical spellings.
|
|
20
|
+
*/
|
|
21
|
+
export interface ProviderToolNameCodec {
|
|
22
|
+
encode(name: string): string;
|
|
23
|
+
decode(name: string): string;
|
|
24
|
+
}
|
|
25
|
+
/** Encode a request's tool list for the provider and pair it with the matching name codec. */
|
|
26
|
+
export declare function encodeProviderToolNames<T extends {
|
|
27
|
+
name: string;
|
|
28
|
+
}>(tools: readonly T[]): {
|
|
29
|
+
tools: T[];
|
|
30
|
+
codec: ProviderToolNameCodec;
|
|
31
|
+
};
|
|
14
32
|
export declare const LEGACY_CODING_TOOL_NAMES: readonly string[];
|
|
15
33
|
/** Translate historical Pi/Andorra tool arguments into the canonical coding-tool contract. */
|
|
16
34
|
export declare function adaptLegacyCodingToolArguments(name: string, args: Record<string, unknown>): Record<string, unknown>;
|
package/dist/src/tool-names.js
CHANGED
|
@@ -32,6 +32,32 @@ export function canonicalizeToolList(names) {
|
|
|
32
32
|
return undefined;
|
|
33
33
|
return [...new Set(names.map(canonicalToolName))];
|
|
34
34
|
}
|
|
35
|
+
/** Characters provider tool-name validators (OpenAI-compatible endpoints, Messages API) reject. */
|
|
36
|
+
const UNSAFE_TOOL_NAME_CHARS = /[^a-zA-Z0-9_-]/g;
|
|
37
|
+
/** Encode a request's tool list for the provider and pair it with the matching name codec. */
|
|
38
|
+
export function encodeProviderToolNames(tools) {
|
|
39
|
+
const byEncoded = new Map();
|
|
40
|
+
const byOriginal = new Map();
|
|
41
|
+
const sanitized = (name) => name.replace(UNSAFE_TOOL_NAME_CHARS, '_');
|
|
42
|
+
const list = tools.map(tool => {
|
|
43
|
+
const base = sanitized(tool.name);
|
|
44
|
+
let encoded = base;
|
|
45
|
+
for (let n = 2; byEncoded.has(encoded); n++)
|
|
46
|
+
encoded = `${base}_${n}`;
|
|
47
|
+
byEncoded.set(encoded, tool.name);
|
|
48
|
+
byOriginal.set(tool.name, encoded);
|
|
49
|
+
return { ...tool, name: encoded };
|
|
50
|
+
});
|
|
51
|
+
return {
|
|
52
|
+
tools: list,
|
|
53
|
+
codec: {
|
|
54
|
+
// History can hold calls for tools this request no longer advertises; those still must
|
|
55
|
+
// not carry rejected characters, even though their response aliases cannot be decoded.
|
|
56
|
+
encode: name => byOriginal.get(name) ?? sanitized(name),
|
|
57
|
+
decode: name => byEncoded.get(name) ?? name,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
35
61
|
export const LEGACY_CODING_TOOL_NAMES = Object.freeze(Object.keys(ALIASES).filter(name => !CANONICAL_CODING_TOOLS.includes(name)));
|
|
36
62
|
function escapeRegexLiteral(value) {
|
|
37
63
|
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
package/dist/src/tools.js
CHANGED
|
@@ -2,10 +2,11 @@ import { open, opendir, realpath, stat, lstat, mkdir, rename, unlink } from 'nod
|
|
|
2
2
|
import { constants } from 'node:fs';
|
|
3
3
|
import { randomUUID } from 'node:crypto';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import { permissionMode, protectedPermissionRoots, assertLocalFilePath, inspectLocalFileResolution as inspectFileResolution, canonicalProtectedRoots as fileProtectedRoots } from './permissions.js';
|
|
5
|
+
import { permissionMode, protectedPermissionRoots, assertLocalFilePath, inspectLocalFileResolution as inspectFileResolution, canonicalProtectedRoots as fileProtectedRoots, PLAN_MODE_MUTATION_ERROR } from './permissions.js';
|
|
6
6
|
import { createCodingTools } from './coding-tools.js';
|
|
7
7
|
import { createQaTools } from './qa/index.js';
|
|
8
8
|
import { createBrowserSessionTool } from './browser-session.js';
|
|
9
|
+
import { createSolveCaptchaTool } from './browser-captcha-tool.js';
|
|
9
10
|
import { createAutomationTool } from './automation-tool.js';
|
|
10
11
|
import { andorraCreateWriteTool } from '../vendor/engine/runtime/coding-agent/core/tools/write.js';
|
|
11
12
|
import { andorraWithFileMutationQueue } from '../vendor/engine/runtime/coding-agent/core/tools/file-mutation-queue.js';
|
|
@@ -145,12 +146,16 @@ async function read(context, name) {
|
|
|
145
146
|
}
|
|
146
147
|
}
|
|
147
148
|
function assertMutationPermission(context) {
|
|
148
|
-
if (!context.pinFilePaths && !context.fileMutationApproval?.explicit && permissionMode(context) === 'read-only')
|
|
149
|
+
if (!context.pinFilePaths && !context.fileMutationApproval?.explicit && (permissionMode(context) === 'read-only' || permissionMode(context) === 'plan'))
|
|
149
150
|
throw new Error('Permission denied: file mutation grant was revoked');
|
|
150
151
|
}
|
|
151
152
|
async function mutationPermission(context, name) {
|
|
152
153
|
if (context.pinFilePaths || context.fileMutationApproval?.explicit)
|
|
153
154
|
return;
|
|
155
|
+
// Plan mode refuses mutations outright: an approval prompt would ask the user to pre-approve an
|
|
156
|
+
// edit no plan has been shown for, which is exactly what the mode exists to prevent.
|
|
157
|
+
if (permissionMode(context) === 'plan')
|
|
158
|
+
throw new Error(PLAN_MODE_MUTATION_ERROR);
|
|
154
159
|
if (permissionMode(context) === 'read-only')
|
|
155
160
|
await authorize('Write', { path: name, warning: 'Read Only requires approval for this file mutation.' }, context);
|
|
156
161
|
}
|
|
@@ -215,20 +220,34 @@ async function atomicWrite(context, name, content, expectedContent) {
|
|
|
215
220
|
}
|
|
216
221
|
export async function authorize(name, args, context) {
|
|
217
222
|
context.signal.throwIfAborted();
|
|
223
|
+
const fileMutationName = ['write_file', 'edit_file', 'Write', 'Edit', 'write', 'edit'].includes(name);
|
|
224
|
+
// File writes, unsandboxed QA and MCP execution cannot use an ordinary tool approval
|
|
225
|
+
// in place of presenting a plan. Recheck after every await: a pending approval can
|
|
226
|
+
// be settled by a live permission switch into Plan mode.
|
|
227
|
+
// Solving a captcha spends CapSolver credit and writes into a page, so it waits for the plan too.
|
|
228
|
+
const planRestricted = fileMutationName || name.startsWith('qa.') || name === 'browser.solve_captcha' || (name.startsWith('mcp_') && name !== 'mcp_connect');
|
|
229
|
+
const assertPlanAllowed = () => {
|
|
230
|
+
if (planRestricted && permissionMode(context) === 'plan')
|
|
231
|
+
throw new Error(PLAN_MODE_MUTATION_ERROR);
|
|
232
|
+
};
|
|
233
|
+
assertPlanAllowed();
|
|
218
234
|
if (context.pinFilePaths)
|
|
219
235
|
return;
|
|
220
|
-
const mutation =
|
|
236
|
+
const mutation = fileMutationName && !args.resolvedPath;
|
|
221
237
|
const automatic = () => mutation && ['ask-for-approval', 'approve-for-me'].includes(permissionMode(context) ?? '');
|
|
222
238
|
const liveMode = () => automatic() ? 'workspace-policy' : permissionMode(context) === 'full-access' ? 'yolo' : context.approvalMode ?? 'interactive';
|
|
223
239
|
while (true) {
|
|
224
240
|
context.signal.throwIfAborted();
|
|
241
|
+
assertPlanAllowed();
|
|
225
242
|
await context.onApprovalEvent?.('node.tool.approval.requested', { name, arguments: args, mode: liveMode() });
|
|
226
243
|
// Both audit hooks may yield while the user changes live permissions.
|
|
244
|
+
assertPlanAllowed();
|
|
227
245
|
let mode = liveMode();
|
|
228
246
|
let answer = false;
|
|
229
247
|
while (mode === 'interactive') {
|
|
230
248
|
answer = await context.approve(name, args, context.userSignal ?? context.signal);
|
|
231
249
|
context.signal.throwIfAborted();
|
|
250
|
+
assertPlanAllowed();
|
|
232
251
|
if (answer !== 'policy-changed')
|
|
233
252
|
break;
|
|
234
253
|
mode = liveMode();
|
|
@@ -240,9 +259,11 @@ export async function authorize(name, args, context) {
|
|
|
240
259
|
if (!approved)
|
|
241
260
|
throw new Error('Permission denied');
|
|
242
261
|
context.signal.throwIfAborted();
|
|
262
|
+
assertPlanAllowed();
|
|
243
263
|
// Only explicit user approval survives a mode change. Reacquire automatic
|
|
244
264
|
// grants through the live policy before returning control to the operation.
|
|
245
265
|
if (!policyGrant || liveMode() === mode) {
|
|
266
|
+
assertPlanAllowed();
|
|
246
267
|
if (mutation && context.fileMutationApproval)
|
|
247
268
|
context.fileMutationApproval.explicit = !policyGrant;
|
|
248
269
|
return;
|
|
@@ -456,12 +477,22 @@ function qaPermissionTool(tool) {
|
|
|
456
477
|
return { ...tool, execute: async (args, context) => {
|
|
457
478
|
const selected = permissionMode(context);
|
|
458
479
|
const readOnlyTerminal = tool.name === 'qa.terminal' && ['read', 'status', 'wait', 'resize'].includes(String(args.action));
|
|
480
|
+
// Host execution under plan mode is a change no plan has been approved for: an approved QA
|
|
481
|
+
// grant spawns an unsandboxed process whose commands can write the workspace, so the call is
|
|
482
|
+
// refused with the plan guidance rather than prompted. Reading a terminal that already exists
|
|
483
|
+
// changes nothing and stays available.
|
|
484
|
+
const assertPlanAllowed = () => {
|
|
485
|
+
if (!readOnlyTerminal && permissionMode(context) === 'plan')
|
|
486
|
+
throw new Error(PLAN_MODE_MUTATION_ERROR);
|
|
487
|
+
};
|
|
488
|
+
assertPlanAllowed();
|
|
459
489
|
if (selected && !readOnlyTerminal) {
|
|
460
490
|
let explicitlyApproved = false;
|
|
461
491
|
do {
|
|
462
492
|
await authorize(tool.name, { ...args, warning: 'UNSANDBOXED QA: this tool call can access the entire host filesystem and network.' }, {
|
|
463
493
|
...context, approve: async (...approval) => {
|
|
464
494
|
const allowed = await context.approve(...approval);
|
|
495
|
+
assertPlanAllowed();
|
|
465
496
|
if (allowed === true)
|
|
466
497
|
explicitlyApproved = true;
|
|
467
498
|
return allowed;
|
|
@@ -469,10 +500,13 @@ function qaPermissionTool(tool) {
|
|
|
469
500
|
});
|
|
470
501
|
// Decision-event delivery can also yield to a live-mode downgrade.
|
|
471
502
|
// An automatic Full Access decision never becomes a scoped user grant.
|
|
503
|
+
assertPlanAllowed();
|
|
472
504
|
} while (!explicitlyApproved && permissionMode(context) !== 'full-access');
|
|
473
505
|
if (explicitlyApproved)
|
|
474
506
|
context = { ...context, qaHostApproved: true };
|
|
475
507
|
}
|
|
508
|
+
// Never dispatch an unsandboxed QA operation on a grant from before Plan was selected.
|
|
509
|
+
assertPlanAllowed();
|
|
476
510
|
return tool.execute(args, context);
|
|
477
511
|
} };
|
|
478
512
|
}
|
|
@@ -602,7 +636,7 @@ export function createTools() {
|
|
|
602
636
|
return `Updated ${name}`;
|
|
603
637
|
});
|
|
604
638
|
}),
|
|
605
|
-
tool('set_timer', 'Arm a self-wake timer. After the delay your prompt is delivered back to you as a
|
|
639
|
+
tool('set_timer', 'Arm a self-wake timer. Only call this when the user explicitly asked you to set a timer, a reminder, or to check back after a delay. Never arm one on your own initiative, for example to wait on a test run, a build, or other background work you started: wait on that work with the tool that runs it, or report its state and stop. After the delay your prompt is delivered back to you as a reminder (marked [Timer]) for the work you are doing now. While you are still working it arrives at your next turn boundary. If your run stops before you finish (out of budget, failed, or interrupted), the reminder continues that run from where you left off. It is dropped, never started as a new task, once you have finished your work, the run has finished, the user stopped it, or a newer turn replaced it. In the terminal CLI, a session that is idle takes it as its next prompt. Timers are held in the running session only: they fire at most once, they are lost when the process exits, and they are unavailable where no session can deliver a follow-up prompt.', {
|
|
606
640
|
prompt: property('The message delivered to you when the timer fires'),
|
|
607
641
|
seconds: { type: 'integer', minimum: 1, maximum: 86_400, description: 'Delay before delivery, in seconds (1 to 86400)' },
|
|
608
642
|
}, ['prompt', 'seconds'], async (args, context) => {
|
|
@@ -610,18 +644,17 @@ export function createTools() {
|
|
|
610
644
|
throw new Error('set_timer is unavailable in this session; no session surface can deliver a follow-up prompt here.');
|
|
611
645
|
if (typeof args.seconds !== 'number' || !Number.isSafeInteger(args.seconds))
|
|
612
646
|
throw new Error('seconds must be an integer');
|
|
613
|
-
const timer = context.timers.arm(args.seconds, string(args, 'prompt'), context.sessionScope, context.wakeCarry);
|
|
647
|
+
const timer = context.timers.arm(args.seconds, string(args, 'prompt'), context.sessionScope, context.wakeCarry, context.wakeOrigin);
|
|
614
648
|
// Recorded for the run that made it: a wake is this turn's promise, and a turn that fails to be saved has
|
|
615
649
|
// only its own to lose.
|
|
616
650
|
context.wakesArmed?.push(timer.id);
|
|
617
651
|
return `Timer ${timer.id.slice(0, 8)} armed: your prompt will be delivered in ${args.seconds} second${args.seconds === 1 ? '' : 's'}, at ${new Date(timer.fireAt).toISOString()}. It fires once.`;
|
|
618
652
|
}),
|
|
619
|
-
{ ...tool('pull_request', 'Show or change the pull request this session tracks in the desktop Plan card. A PR you open with `gh pr create` is attached automatically; use attach for one opened another way. update changes its settings when the user asks: mergeWhenReady enables GitHub auto-merge (gh pr merge --auto), draft converts to a draft or marks it ready, autoFix wakes you with a prompt when new review comments arrive
|
|
653
|
+
{ ...tool('pull_request', 'Show or change the pull request this session tracks in the desktop Plan card. A PR you open with `gh pr create` is attached automatically; use attach for one opened another way. update changes its settings when the user asks: mergeWhenReady enables GitHub auto-merge (gh pr merge --auto), draft converts to a draft or marks it ready, autoFix wakes you with a prompt when new review comments arrive and switches itself off once the PR is merged or closed. dismiss removes it from the card. Only change a setting the user asked you to change.', {
|
|
620
654
|
action: { type: 'string', enum: ['status', 'attach', 'update', 'dismiss'], description: 'status shows the tracked PR; attach starts tracking url; update changes settings; dismiss stops tracking' },
|
|
621
655
|
url: property('The GitHub pull request URL (attach only)'),
|
|
622
|
-
autoFix: { type: 'boolean', description: 'Wake this session when new review comments arrive' },
|
|
656
|
+
autoFix: { type: 'boolean', description: 'Wake this session when new review comments arrive, until the PR is merged or closed' },
|
|
623
657
|
mergeWhenReady: { type: 'boolean', description: 'GitHub auto-merge once checks and reviews pass' },
|
|
624
|
-
autoArchive: { type: 'boolean', description: 'Archive this session when the PR is merged or closed' },
|
|
625
658
|
draft: { type: 'boolean', description: 'true converts to a draft, false marks it ready for review' },
|
|
626
659
|
}, ['action'], async (args, context) => {
|
|
627
660
|
const control = context.pullRequests;
|
|
@@ -629,10 +662,10 @@ export function createTools() {
|
|
|
629
662
|
throw new Error('pull_request is unavailable here; no session tracks a pull request for this run.');
|
|
630
663
|
const settings = pullRequestSettings(args);
|
|
631
664
|
// A setting is a change on GitHub (auto-merge, draft) or to what the engine will do unattended (Auto-fix
|
|
632
|
-
// runs
|
|
665
|
+
// runs), so it goes through the run's approval like any other host operation; a full-access
|
|
633
666
|
// run approves it by policy. Reading the PR and dismissing it change neither.
|
|
634
667
|
const approve = () => approveOperation(context, 'pull_request', { ...args, warning: 'Changes the pull request on GitHub, or what Andorra does on its own when the PR changes.' });
|
|
635
|
-
const describe = (pr) => `${pr.url} (${pr.state})${pr.title ? ` "${pr.title}"` : ''}: autoFix ${pr.autoFix ? 'on' : 'off'}, mergeWhenReady ${pr.mergeWhenReady ? 'on' : 'off'}
|
|
668
|
+
const describe = (pr) => `${pr.url} (${pr.state})${pr.title ? ` "${pr.title}"` : ''}: autoFix ${pr.autoFix ? 'on' : 'off'}, mergeWhenReady ${pr.mergeWhenReady ? 'on' : 'off'}`;
|
|
636
669
|
switch (args.action) {
|
|
637
670
|
case 'status': {
|
|
638
671
|
const pr = await control.status();
|
|
@@ -646,7 +679,7 @@ export function createTools() {
|
|
|
646
679
|
}
|
|
647
680
|
case 'update': {
|
|
648
681
|
if (!Object.keys(settings).length)
|
|
649
|
-
throw new Error('update needs at least one of autoFix, mergeWhenReady,
|
|
682
|
+
throw new Error('update needs at least one of autoFix, mergeWhenReady, draft');
|
|
650
683
|
await approve();
|
|
651
684
|
return `Updated ${describe(await control.update(settings))}`;
|
|
652
685
|
}
|
|
@@ -659,5 +692,6 @@ export function createTools() {
|
|
|
659
692
|
...createCodingTools({ safePath, read, atomicWrite, authorize, files, fileLimit: FILE_LIMIT }),
|
|
660
693
|
...createQaTools().map(qaPermissionTool),
|
|
661
694
|
createBrowserSessionTool(authorize),
|
|
695
|
+
createSolveCaptchaTool(authorize),
|
|
662
696
|
].map(filePermissionTool);
|
|
663
697
|
}
|
package/dist/src/trajectory.js
CHANGED
|
@@ -6,6 +6,29 @@ import { isDeepStrictEqual } from 'node:util';
|
|
|
6
6
|
import { redactSecrets } from './memory/redaction.js';
|
|
7
7
|
import { browserEventArguments, isBrowserToolName } from './browser-session.js';
|
|
8
8
|
const credentialKey = /(?:api[_-]?key|token|secret|password|passwd|authorization|cookie|credential|private[_-]?key)/i;
|
|
9
|
+
/** `MAX_OUTPUT_TOKENS` and the like hold counts, as the `*Tokens` record keys below do. */
|
|
10
|
+
const tokenCountKey = /tokens$/i;
|
|
11
|
+
/**
|
|
12
|
+
* Values that switch a setting on or off, or mark a credential as absent, rather than hold
|
|
13
|
+
* one: Chromium reads `GOOGLE_API_KEY=no`, local model servers accept `OPENAI_API_KEY=EMPTY`.
|
|
14
|
+
* No source treats them as secrets; redacting them rewrote ordinary words in every record.
|
|
15
|
+
*/
|
|
16
|
+
const flagValues = new Set(['y', 'n', 'yes', 'no', 'true', 'false', 'on', 'off', '0', '1',
|
|
17
|
+
'none', 'null', 'nil', 'undefined', 'unset', 'empty', 'disabled', 'enabled', 'dummy', 'placeholder']);
|
|
18
|
+
/**
|
|
19
|
+
* The shortest environment or configured value treated as a secret. A credential-named value
|
|
20
|
+
* shorter than this is a flag or a placeholder; substituting it can neither hide it (the
|
|
21
|
+
* surrounding text gives a word-length value away) nor avoid matching unrelated text.
|
|
22
|
+
* Browser inputs have no floor: what a model types into a page can be a short PIN.
|
|
23
|
+
*/
|
|
24
|
+
const MIN_CONFIGURED_SECRET_LENGTH = 4;
|
|
25
|
+
/** A flag, a placeholder, or text with no letter or digit (a typed space, bare punctuation). */
|
|
26
|
+
function isFlagValue(value) {
|
|
27
|
+
return flagValues.has(value.trim().toLowerCase()) || !/[\p{L}\p{N}]/u.test(value);
|
|
28
|
+
}
|
|
29
|
+
function configuredSecrets(values) {
|
|
30
|
+
return values.filter(value => value.trim().length >= MIN_CONFIGURED_SECRET_LENGTH && !isFlagValue(value));
|
|
31
|
+
}
|
|
9
32
|
const privateReasoningKey = /^(?:reasoningContent|reasoning_content|reasoning|thinking|signature|thinkingSignature|providerContinuation)$/i;
|
|
10
33
|
const MAX_STRUCTURE_DEPTH = 64;
|
|
11
34
|
const STRUCTURE_LIMIT = '[REDACTED: structure exceeds sanitization limit]';
|
|
@@ -92,16 +115,18 @@ export async function createSessionTrajectory(options = {}) {
|
|
|
92
115
|
const modulePath = await realpath(fileURLToPath(import.meta.url));
|
|
93
116
|
const directory = options.directory ?? join(resolve(dirname(modulePath), '..', '..'), '.andorracode', 'trajectories');
|
|
94
117
|
const path = join(directory, `${sessionId}.jsonl`);
|
|
95
|
-
let secrets = [...new Set([
|
|
96
|
-
...Object.entries(process.env).filter(([key]) => credentialKey.test(key)).map(([, value]) => value ?? ''),
|
|
118
|
+
let secrets = [...new Set(configuredSecrets([
|
|
119
|
+
...Object.entries(process.env).filter(([key]) => credentialKey.test(key) && !tokenCountKey.test(key)).map(([, value]) => value ?? ''),
|
|
97
120
|
...(options.secrets ?? []),
|
|
98
|
-
]
|
|
121
|
+
]))].sort((a, b) => b.length - a.length);
|
|
99
122
|
// Browser inputs are private even when they are too short for the ambient
|
|
100
123
|
// credential heuristics. Keep them local to this conversation, never global.
|
|
124
|
+
// A flag-like answer ("no", "0") is still removed from the recorded call by
|
|
125
|
+
// the argument projection; only its echoes in other text are left alone.
|
|
101
126
|
const browserSecrets = new Set();
|
|
102
127
|
const browserInputSecrets = new Set();
|
|
103
128
|
function rememberBrowserSecret(value) {
|
|
104
|
-
if (!value || browserInputSecrets.has(value))
|
|
129
|
+
if (!value || isFlagValue(value) || browserInputSecrets.has(value))
|
|
105
130
|
return;
|
|
106
131
|
browserInputSecrets.add(value);
|
|
107
132
|
// A model can quote an input inside prose/code fences, where whole-string
|
|
@@ -278,13 +303,8 @@ export async function createSessionTrajectory(options = {}) {
|
|
|
278
303
|
return redactBrowserSecrets(serializeSanitizedJson(value, parsed, sanitize(parsed, jsonDepth + 1, structureDepth + 1)));
|
|
279
304
|
}
|
|
280
305
|
let text = redactBrowserSecrets(value);
|
|
281
|
-
for (const secret of secrets)
|
|
282
|
-
|
|
283
|
-
if (secret.length < 4)
|
|
284
|
-
text = text.replace(new RegExp(`(?<![A-Za-z0-9_])${secret.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}(?![A-Za-z0-9_])`, 'g'), '[REDACTED]');
|
|
285
|
-
else
|
|
286
|
-
text = text.split(secret).join('[REDACTED]');
|
|
287
|
-
}
|
|
306
|
+
for (const secret of secrets)
|
|
307
|
+
text = text.split(secret).join('[REDACTED]');
|
|
288
308
|
return redactSecrets(text).text;
|
|
289
309
|
}
|
|
290
310
|
if (value && typeof value === 'object') {
|
|
@@ -387,7 +407,7 @@ export async function createSessionTrajectory(options = {}) {
|
|
|
387
407
|
return {
|
|
388
408
|
sessionId, path,
|
|
389
409
|
sanitize,
|
|
390
|
-
addSecrets(values) { secrets = [...new Set([...secrets, ...values
|
|
410
|
+
addSecrets(values) { secrets = [...new Set([...secrets, ...configuredSecrets(values)])].sort((a, b) => b.length - a.length); },
|
|
391
411
|
recordEvent: event => record('runtime.event', { event }),
|
|
392
412
|
record: (type, data) => record(type, data),
|
|
393
413
|
flush: () => pending,
|
package/dist/src/types.d.ts
CHANGED
|
@@ -48,6 +48,10 @@ export interface Usage {
|
|
|
48
48
|
cacheRead?: number;
|
|
49
49
|
cacheWrite?: number;
|
|
50
50
|
decodeMs?: number;
|
|
51
|
+
/** Input tokens on local model requests that explicitly reported cache reads (including zero). */
|
|
52
|
+
localCacheInputTokens?: number;
|
|
53
|
+
/** Cache-read tokens for those same local requests, summed across local model switches. */
|
|
54
|
+
localCacheReadTokens?: number;
|
|
51
55
|
}
|
|
52
56
|
export interface ToolSchema {
|
|
53
57
|
name: string;
|
|
@@ -172,9 +176,21 @@ export interface ToolContext {
|
|
|
172
176
|
approve: (name: string, args: Record<string, unknown>, signal: AbortSignal) => Promise<boolean | 'policy-changed'>;
|
|
173
177
|
/** Runtime-owned clarification channel; undefined answers decline the current intake. */
|
|
174
178
|
askUser?: (question: string, signal: AbortSignal, choices?: readonly string[]) => Promise<string | undefined>;
|
|
179
|
+
/**
|
|
180
|
+
* Runtime-owned plan approval: flips the run out of plan mode once the user approves, without
|
|
181
|
+
* touching the saved workspace default, and answers the mode the run continues in. Absent on
|
|
182
|
+
* surfaces with no live permission control, where presenting a plan cannot proceed.
|
|
183
|
+
*/
|
|
184
|
+
approvePlan?: () => Promise<import('./permissions.js').PermissionMode>;
|
|
175
185
|
onApprovalEvent?: (type: string, data: Record<string, unknown>) => void | Promise<void>;
|
|
176
186
|
/** Browser lifecycle observations, scoped to the current coding session, never a tool-supplied identity. */
|
|
177
187
|
onBrowserEvent?: (type: string, data: Record<string, unknown>) => void | Promise<void>;
|
|
188
|
+
/**
|
|
189
|
+
* Live output from a command tool that is still running: the runtime forwards it to the
|
|
190
|
+
* transcript as throttled `node.tool.output` events, so a running call's row shows what the
|
|
191
|
+
* command has printed. Display-only; the call's own observation remains the authoritative record.
|
|
192
|
+
*/
|
|
193
|
+
onCommandOutput?: (chunk: string) => void;
|
|
178
194
|
/**
|
|
179
195
|
* Called by the file permission wrapper once a mutation's path has been authorized and
|
|
180
196
|
* canonicalized, immediately before the tool executes.
|
|
@@ -194,6 +210,13 @@ export interface ToolContext {
|
|
|
194
210
|
* effort or scope. Surfaces with no run of their own leave it unset.
|
|
195
211
|
*/
|
|
196
212
|
wakeCarry?: import('./timers.js').WakeCarry;
|
|
213
|
+
/**
|
|
214
|
+
* The attempt and graph node a wake armed from this context belongs to, set by the agent node executor.
|
|
215
|
+
*
|
|
216
|
+
* A wake is delivered back to the work of the node that armed it - never as a new task that starts the
|
|
217
|
+
* graph over - so the node is part of the wake. A subagent's context inherits its host node's.
|
|
218
|
+
*/
|
|
219
|
+
wakeOrigin?: import('./timers.js').WakeOrigin;
|
|
197
220
|
/**
|
|
198
221
|
* Filled in with the id of every wake this run arms, so a run can tell its own wakes from the session's.
|
|
199
222
|
*
|
|
@@ -63,7 +63,7 @@ its user and retry with the choice. The full contract is in [Subagent mode](suba
|
|
|
63
63
|
| --- | --- |
|
|
64
64
|
| andorra_graph_guide | Returns the architecture, examples, node ports and machine-readable error contract |
|
|
65
65
|
| andorra_providers_list | Provider IDs, models and types, **no credentials** |
|
|
66
|
-
| andorra_graphs_list | List published graph IDs, names and revisions |
|
|
66
|
+
| andorra_graphs_list | List published graph IDs, names and revisions; deleted graphs only with `includeDeleted: true` |
|
|
67
67
|
| andorra_graph_get | Read the exact saved latest or selected immutable revision, without editor-only migration |
|
|
68
68
|
| andorra_graph_begin | Begin new or existing graph draft (mode create/edit, id, name for create); returns draftId |
|
|
69
69
|
| andorra_graph_node_upsert | Create/replace a whole node with prompt, provider, completion, permissions and other settings |
|
|
@@ -75,6 +75,8 @@ its user and retry with the choice. The full contract is in [Subagent mode](suba
|
|
|
75
75
|
| andorra_graph_validate | Validate without saving; return all missing-provider and missing-outcome issues, plus structural error |
|
|
76
76
|
| andorra_graph_publish | Validate and save the next immutable revision, or report revision conflict |
|
|
77
77
|
| andorra_graph_discard | Drop an uncommitted draft |
|
|
78
|
+
| andorra_graph_delete | Soft-delete a graph (`id`, `expectedRevision`, `confirm` repeating the id) after the user confirms in chat |
|
|
79
|
+
| andorra_graph_restore | Restore a soft-deleted graph (`id`, `expectedRevision`) |
|
|
78
80
|
|
|
79
81
|
Graph architecture is also exposed as a resource with URI andorra://graph/architecture. A third-party agent should read this before trying to design workflows. Agent completion outcomes may be pass/fail or custom names, Condition uses true/false ports, Loop uses body/done ports and bounded iteration counts, Approval uses approved/rejected, and Join all cannot wait for mutually exclusive branches. All nodes must be reachable from entry and every declared required outcome must route. See the resource for the full node and edge rules.
|
|
80
82
|
|
|
@@ -117,6 +119,16 @@ Graph architecture is also exposed as a resource with URI andorra://graph/archit
|
|
|
117
119
|
|
|
118
120
|
To make a Loop, create a Loop node with loop.maxIterations and link its body and done ports. Node visits are unlimited by default: `graph.limits.maxNodeVisits` is absent, and `0` there means the same thing. A graph with a return connection still needs a ceiling, so set `graph.limits.maxNodeVisits` high enough for each cycle/reentry, or set `graph.limits.wallTimeMs` to bound the run by the clock instead. The existing graph validator remains the authority for reachable links, cycles, schemas and Join dependencies.
|
|
119
121
|
|
|
122
|
+
### Deleting and restoring a graph
|
|
123
|
+
|
|
124
|
+
Deleting is a soft delete. `andorra_graph_delete` publishes the next revision with `metadata.deletedAt` set; no file is removed, and every earlier revision stays stored locally and in the cloud. Cloud sync carries that revision to the account's other machines like any publish. Removing the files instead would not work: sync restores every graph the account holds.
|
|
125
|
+
|
|
126
|
+
A deleted graph leaves `andorra_graphs_list` (unless `includeDeleted` is true), `/graph`, the desktop graph picker and the Graph Builder, and new runs refuse it with "Graph <name> was deleted. Restore it before running it." A saved default selection that names it falls back to the Default graph until it is restored. Sessions that already ran it keep resuming. `andorra_graph_get` still reads it and reports `deletedAt`; `andorra_graph_begin` with `mode=edit` refuses it.
|
|
127
|
+
|
|
128
|
+
`andorra_graph_restore` publishes the next revision without the marker. A deleted graph still counts toward a free account's one custom graph, so a free account restores it rather than replacing it.
|
|
129
|
+
|
|
130
|
+
Refusals: `DEFAULT_GRAPH` (the Default graph or the Andorra preset), `CONFIRMATION_MISMATCH` (`confirm` is not the id), `GRAPH_IN_USE` (an automation runs the graph; `automations` lists them), `GRAPH_DELETED` (already deleted, or an edit of a deleted graph), `GRAPH_NOT_DELETED` (restore of a live graph), and `REVISION_CONFLICT` when `expectedRevision` is not the latest. `metadata.deletedAt` is reserved: `andorra_graph_patch`, publishing and Graph Builder saves refuse it (`RESERVED_METADATA`), so a graph is deleted only through the delete tool.
|
|
131
|
+
|
|
120
132
|
### Validation errors
|
|
121
133
|
|
|
122
134
|
Every MCP tool returns a JSON text payload with ok/data or ok/error. A failed call sets MCP isError=true. For example, omitting a fail branch yields:
|
|
@@ -124,10 +124,13 @@ classified by the same recovery as any other attempt. The run record carries `su
|
|
|
124
124
|
the permission the run was bound to.
|
|
125
125
|
|
|
126
126
|
A finished run leaves no conversation behind: the checkpoint a stopped attempt needs is deleted
|
|
127
|
-
once the attempt succeeds, because a successful run has nothing to resume.
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
once the attempt succeeds, because a successful run has nothing to resume. A journal append the
|
|
128
|
+
file refuses (a full disk, most often) is held and written once appends succeed again, and a
|
|
129
|
+
node's failed checkpoint write is healed by its next successful one. An attempt that stopped while
|
|
130
|
+
something was still missing is marked (`runs/<runId>.journal-error` or `.checkpoint-error`, and
|
|
131
|
+
`journalIntegrity` or `checkpointIntegrity` on the record). A resume of it still goes ahead, because
|
|
132
|
+
a session must always be resumable, and the resumed attempt opens with a warning that a step may
|
|
133
|
+
repeat.
|
|
131
134
|
|
|
132
135
|
The run's own record is durable as it goes: an event is on disk before the run moves on, and the
|
|
133
136
|
checkpoint is written before the run advances past the tool call it describes. A process killed
|
|
@@ -20,6 +20,8 @@ Headless runs without `--yolo` receive permission-denied observations for writes
|
|
|
20
20
|
|
|
21
21
|
`/permissions` chooses a permission mode and remembers it per workspace (`workspacePermissions` in `config.json`).
|
|
22
22
|
|
|
23
|
+
A mode changed while a task runs applies to that task from its next decision on. In the desktop app (`run.setPermissions`), approvals the task is already waiting on are also checked again under the new mode: one the new mode allows goes through, and one it still requires is asked again. The change is recorded in the run journal as `run.permissions.changed`, followed by the decisions it led to. An escalated shell command approved this way runs on the host only while Full Access is still in force when it starts. A sandboxed command never leaves the sandbox because of a later switch.
|
|
24
|
+
|
|
23
25
|
## Secrets
|
|
24
26
|
|
|
25
27
|
- Provider API keys are stored locally in `config.json` (plaintext — keep the file private) or referenced by environment-variable name. They are never added to command history or displayed in provider summaries.
|
|
@@ -24,9 +24,22 @@ An **Anthropic** provider can sign in with a Claude Console account instead of a
|
|
|
24
24
|
|
|
25
25
|
Andorra runs `ant auth login` with `ANTHROPIC_CONFIG_DIR` set to `~/.andorracode/anthropic-accounts/<provider id>`, so each provider keeps its own login and your own `ant` profiles are never read or changed. The Anthropic SDK refreshes the access token from that directory; Andorra never handles the OAuth exchange. **Sign out**, or removing the provider, deletes the directory. New Anthropic providers start on `claude-opus-5-5`; **Discover Models** lists the rest.
|
|
26
26
|
|
|
27
|
+
### Sign in or use an API key
|
|
28
|
+
|
|
29
|
+
In Desktop, **+ Add Provider** lists one card per vendor. A vendor with a subscription sign-in shows two choices side by side before anything is saved: **Sign in with …** (a subscription the vendor's own CLI holds) or **Use an API key**. Choosing one switches the draft's type and endpoint; **Save provider** adds it to the list.
|
|
30
|
+
|
|
31
|
+
| Card | Sign in with … | Use an API key |
|
|
32
|
+
| --- | --- | --- |
|
|
33
|
+
| ChatGPT / OpenAI | ChatGPT Plus or Pro through Codex (`codex`) | OpenAI API key (`openai-compatible`) |
|
|
34
|
+
| Claude | Claude Pro or Max through Claude Code (`claude`) | Anthropic API key or Claude Console sign-in (`anthropic`) |
|
|
35
|
+
| Grok / xAI | SuperGrok through the Grok CLI (`grok`) | xAI API key (`openai-compatible`) |
|
|
36
|
+
| OpenCode | The providers connected in the OpenCode CLI (`opencode`) | OpenCode Go key (`opencode-go`) |
|
|
37
|
+
|
|
38
|
+
The sign-in panel runs the vendor CLI's own login on the engine's machine. The login and its tokens stay with that CLI; Andorra never copies them. After a sign-in in the add form, **Discover Models** runs once so the first model can be picked. Sign-in runs only for a local engine; for a remote workspace, sign in with the CLI on that machine.
|
|
39
|
+
|
|
27
40
|
### Claude subscription
|
|
28
41
|
|
|
29
|
-
Choose **Claude
|
|
42
|
+
Choose **Claude**, then **Sign in with Claude**, in Desktop, or **Claude subscription** in `/providers`. Install the native Claude Code CLI. Desktop's **Sign in with Claude** runs `claude auth login --claudeai`, which opens your browser; if the page shows a code instead, paste it into the panel. In the terminal, run `claude auth login` yourself first. Andorra reuses that CLI's managed sign-in; it never copies OAuth access or refresh tokens into its configuration. `ANDORRA_CLAUDE_PATH` can select a native CLI executable when it is not on PATH.
|
|
30
43
|
|
|
31
44
|
**Discover Models** reads the models available to the installed Claude CLI. The CLI must support safe mode, structured JSON output, and the stream-json control protocol. Andorra sends one model step at a time with native tools, MCP servers, hooks, plugins, and workspace customizations disabled. Andorra retains tool execution and permissions. Images use native image blocks. Changing providers does not change JEV or graph selection.
|
|
32
45
|
|
|
@@ -34,6 +47,20 @@ In Desktop, Claude and Go drafts can discover models before saving: choose the p
|
|
|
34
47
|
|
|
35
48
|
Auxiliary requests such as titles, model-health checks, graph generation, and context summaries use a separate tool-free mode with an explicit output cap. This requires native output/budget controls and matching stream usage metadata; incompatible CLI behavior is rejected. An explicit output cap combined with tool execution is not supported.
|
|
36
49
|
|
|
50
|
+
### Grok subscription
|
|
51
|
+
|
|
52
|
+
Choose **Grok / xAI**, then **Sign in with Grok**, in Desktop, or **Grok subscription (Grok CLI)** in `/providers`. Install the Grok CLI. Desktop runs `grok login --device-auth`, opens the xAI page and shows the code to confirm there; in the terminal, run `grok login` yourself. The fixed marker base is `https://api.x.ai`; requests go through the signed-in CLI. `ANDORRA_GROK_PATH` selects the executable when it is neither on PATH nor in `~/.grok/bin`.
|
|
53
|
+
|
|
54
|
+
Andorra sends one model step at a time through `grok --prompt-file … --output-format streaming-messages-json --json-schema …` with built-in tools, subagents, memory, plan mode and web search off, and refuses any native tool call. `XAI_API_KEY` is removed from the CLI's environment, so a signed-out CLI fails instead of billing an API key. Images in the conversation are not forwarded yet; the model is told how many were left out. To use an xAI API key instead, choose **Use an API key** on the same card.
|
|
55
|
+
|
|
56
|
+
### OpenCode
|
|
57
|
+
|
|
58
|
+
Choose **OpenCode**, then **Sign in with OpenCode**, in Desktop, or **OpenCode (CLI sign-in)** in `/providers`. Install the OpenCode CLI (`npm install -g opencode-ai`). Andorra starts a private `opencode serve` on loopback behind a random password the first time it is needed, stops it after five idle minutes, and stops it when the engine exits. Models are every model of every provider OpenCode has connected, named `provider/model` (for example `opencode/big-pickle`).
|
|
59
|
+
|
|
60
|
+
The panel lists the providers OpenCode has connected and the browser sign-ins it offers (ChatGPT, GitHub Copilot, Poe, xAI SuperGrok and others); **Sign in to …** runs that provider's sign-in inside OpenCode and stores the credential where OpenCode keeps it. A sign-in that needs typed input, such as a GitHub Enterprise URL, is left to `opencode auth login` in a terminal. `ANDORRA_OPENCODE_PATH` selects the executable.
|
|
61
|
+
|
|
62
|
+
Each step is a throwaway OpenCode session on an Andorra agent with every built-in tool off and a JSON-schema answer; the session is deleted afterwards. When an upstream provider is rate limited, OpenCode retries on its own schedule, which can be hours away: Andorra fails the step with the provider's reason instead of waiting.
|
|
63
|
+
|
|
37
64
|
### OpenCode Go
|
|
38
65
|
|
|
39
66
|
Choose **OpenCode Go (all model APIs)** and save your Go API key. Its fixed base is `https://opencode.ai/inference/go`. Discovery includes the live Go catalog. The adapter selects Chat Completions, Responses, Anthropic Messages, or Gemini according to verified model metadata. Requests stay on Go endpoints; failures never fall back to pay-as-you-go service. New models with unknown protocol metadata fail explicitly until their metadata is available.
|
|
@@ -100,4 +127,4 @@ Saving setup creates `~/.andorracode/config.json` (override the directory with `
|
|
|
100
127
|
}
|
|
101
128
|
```
|
|
102
129
|
|
|
103
|
-
Supported adapter types are `openai-compatible`, `anthropic`, `codex`, `claude`, and `opencode-go`. Managed CLI providers reject API-key overrides and HTTP timeout fields. The full configuration surface, including limits, memory, and request timeouts, is in [Reference: configuration](../reference/config.md).
|
|
130
|
+
Supported adapter types are `openai-compatible`, `anthropic`, `codex`, `claude`, `grok`, `opencode`, and `opencode-go`. Managed CLI providers reject API-key overrides and HTTP timeout fields. The full configuration surface, including limits, memory, and request timeouts, is in [Reference: configuration](../reference/config.md).
|
package/docs/guides/browser.md
CHANGED
|
@@ -13,3 +13,15 @@ The application belongs to the CLI that launched it. Closing its browser tab lea
|
|
|
13
13
|
The printed URL includes a capability token in its fragment. Keep it private. The server binds only to 127.0.0.1, validates request host/origin and bearer authorization, and uses existing trajectory sanitization for stored tool activity. It does not provide remote access or a cloud relay.
|
|
14
14
|
|
|
15
15
|
|
|
16
|
+
|
|
17
|
+
## Captcha solving with CapSolver
|
|
18
|
+
|
|
19
|
+
Agents can solve captchas on pages open in their headless browser (`qa.browser_session`) with the `browser.solve_captcha` tool, using your own [CapSolver](https://www.capsolver.com/) account. The tool supports reCAPTCHA v2 and v3, Cloudflare Turnstile, and image-to-text captchas. With `type` left at `auto`, it reads the widget and its site key from the page, sends the task to CapSolver, writes the returned token into the page's response field and calls the widget's callback. The agent then submits the form. The desktop's Browser panel is not supported.
|
|
20
|
+
|
|
21
|
+
The key is optional. Without one, the tool reports that CapSolver is not configured. To add a key:
|
|
22
|
+
|
|
23
|
+
- In the desktop app, open **Settings → Browser**, paste the key and click **Save**. **Remove** deletes it.
|
|
24
|
+
- Or add `"browser": { "capsolverApiKey": "<key>" }` to `~/.andorracode/config.json`.
|
|
25
|
+
- Or set `CAPSOLVER_API_KEY` in the environment. It is used only when no key is saved.
|
|
26
|
+
|
|
27
|
+
The saved key lives in the configuration file alongside provider API keys. The engine reports only whether a key exists and which one is in use, never the key itself. Each solve spends CapSolver credit and goes through the run's normal approval for browser tools. Use it only on sites you are permitted to automate.
|