@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
|
@@ -68,7 +68,9 @@ export declare function gitStatus(root: string, options?: {
|
|
|
68
68
|
* working tree is on is asked separately because a detached HEAD has none, and "absent from the
|
|
69
69
|
* listing" would otherwise be indistinguishable from a branch that only does not exist yet.
|
|
70
70
|
* Remote-tracking refs are left out: landing on one needs a tracking decision — which local branch
|
|
71
|
-
* follows it — that this request cannot express.
|
|
71
|
+
* follows it — that this request cannot express. The repository has to be the workspace folder
|
|
72
|
+
* itself or its immediate parent (`gitInScope`); a repository Git would only reach further up the
|
|
73
|
+
* tree is not this folder's to offer.
|
|
72
74
|
*/
|
|
73
75
|
export declare function listBranches(root: string): Promise<AppServerBranchList>;
|
|
74
76
|
/**
|
|
@@ -80,6 +82,10 @@ export declare function listBranches(root: string): Promise<AppServerBranchList>
|
|
|
80
82
|
* branch than the one in the request. Nothing else about the name is guessed; Git's own refusal is
|
|
81
83
|
* what the caller reports, because it names the reason (no such branch, a working tree that would
|
|
82
84
|
* lose changes) better than a rule kept in sync here could.
|
|
85
|
+
*
|
|
86
|
+
* The repository has to be the workspace folder itself or its immediate parent (`gitInScope`): a
|
|
87
|
+
* switch Git would only reach by walking further up the tree would move some ancestor repository's
|
|
88
|
+
* working tree, not this folder's.
|
|
83
89
|
*/
|
|
84
90
|
export declare function checkoutBranch(root: string, options: {
|
|
85
91
|
branch?: unknown;
|
|
@@ -93,6 +99,7 @@ export declare function checkoutBranch(root: string, options: {
|
|
|
93
99
|
* `base` names what the diff is taken against: the working tree alone (unstaged changes, Git's
|
|
94
100
|
* default) or `head`, which is what a per-file view wants because it includes staged and unstaged
|
|
95
101
|
* changes together. Untracked files have no diff at all and are read as content by the client.
|
|
102
|
+
* A folder out of Git scope (`gitInScope`) has nothing to compare, answered without running Git.
|
|
96
103
|
*/
|
|
97
104
|
export declare function gitDiff(root: string, options?: {
|
|
98
105
|
path?: unknown;
|
|
@@ -236,6 +243,7 @@ export declare function summarizeMcpServer(server: McpServerConfig): string;
|
|
|
236
243
|
/** Installed skills, plugins, and configured MCP servers. Secrets in env/headers are never included. */
|
|
237
244
|
export declare function listExtensions(config: Config, signal?: AbortSignal, directory?: string): Promise<{
|
|
238
245
|
skills: AppServerBundle[];
|
|
246
|
+
builtinSkills: AppServerBundle[];
|
|
239
247
|
plugins: AppServerBundle[];
|
|
240
248
|
mcpServers: {
|
|
241
249
|
id: string;
|
|
@@ -2,10 +2,11 @@ import { spawn } from 'node:child_process';
|
|
|
2
2
|
import { createReadStream } from 'node:fs';
|
|
3
3
|
import { opendir, open, readFile, readdir, realpath, stat } from 'node:fs/promises';
|
|
4
4
|
import { StringDecoder } from 'node:string_decoder';
|
|
5
|
-
import { isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
5
|
+
import { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
6
6
|
import { runRecordPath, runRecordsDirectory, sessionHasOpenRun } from '../run-records.js';
|
|
7
7
|
import { validSavedSession } from '../sessions.js';
|
|
8
8
|
import { listBundles } from '../extensions.js';
|
|
9
|
+
import { builtinSkillEntries } from '../skills/invocable-skills.js';
|
|
9
10
|
/**
|
|
10
11
|
* Inspection of a workspace and of this installation's run records.
|
|
11
12
|
*
|
|
@@ -152,6 +153,32 @@ export async function readWorkspaceFile(root, name) {
|
|
|
152
153
|
await handle.close();
|
|
153
154
|
}
|
|
154
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* Whether Git may be consulted about a workspace folder, and which repository that is: a `.git`
|
|
158
|
+
* sits at the folder itself or at its immediate parent, and the repository Git actually resolves
|
|
159
|
+
* to is one of those two.
|
|
160
|
+
*
|
|
161
|
+
* Git's own discovery never stops at the folder it is given — it walks every ancestor to the drive
|
|
162
|
+
* root — so on a machine whose home directory is itself a repository, a blank folder registered as
|
|
163
|
+
* a project is answered with that ancestor's branches and status, and a checkout would act on the
|
|
164
|
+
* ancestor's working tree. The parent stays in scope because a folder added directly inside a
|
|
165
|
+
* repository's root is still part of that repository's tree to the person who added it; nothing
|
|
166
|
+
* further up is. Presence is checked on the filesystem first, so a folder out of scope costs no
|
|
167
|
+
* process: `status --untracked-files=all` against an accidental ancestor of a large home directory
|
|
168
|
+
* would spend the whole timeout walking it. A `.git` that exists but is not a repository is
|
|
169
|
+
* skipped by Git, which then keeps walking — so the repository the folder resolves to is verified
|
|
170
|
+
* against this scope directly rather than assumed from what the filesystem happens to hold.
|
|
171
|
+
*/
|
|
172
|
+
async function gitInScope(root) {
|
|
173
|
+
const parent = dirname(root);
|
|
174
|
+
const holds = async (folder) => stat(join(folder, '.git')).then(() => true, () => false);
|
|
175
|
+
if (!(await holds(root)) && !(await holds(parent)))
|
|
176
|
+
return false;
|
|
177
|
+
const top = await collectCapped('git', ['-C', root, 'rev-parse', '--show-toplevel'], 4 * 1024, GIT_TIMEOUT_MS).catch(() => undefined);
|
|
178
|
+
if (!top || top.code !== 0)
|
|
179
|
+
return false;
|
|
180
|
+
return inside(root, top.text.trim()) || inside(parent, top.text.trim());
|
|
181
|
+
}
|
|
155
182
|
/**
|
|
156
183
|
* Working-tree status through the `git` executable.
|
|
157
184
|
*
|
|
@@ -165,6 +192,8 @@ export async function readWorkspaceFile(root, name) {
|
|
|
165
192
|
* following field, so no path has to be decoded.
|
|
166
193
|
*/
|
|
167
194
|
export async function gitStatus(root, options = {}) {
|
|
195
|
+
if (!(await gitInScope(root)))
|
|
196
|
+
return { repository: false, files: [] };
|
|
168
197
|
let collected;
|
|
169
198
|
try {
|
|
170
199
|
// Streamed and capped, like the diff path: `execFile` fails the whole call once a repository's
|
|
@@ -229,9 +258,13 @@ const MAX_BRANCH_NAME_CHARS = 200;
|
|
|
229
258
|
* working tree is on is asked separately because a detached HEAD has none, and "absent from the
|
|
230
259
|
* listing" would otherwise be indistinguishable from a branch that only does not exist yet.
|
|
231
260
|
* Remote-tracking refs are left out: landing on one needs a tracking decision — which local branch
|
|
232
|
-
* follows it — that this request cannot express.
|
|
261
|
+
* follows it — that this request cannot express. The repository has to be the workspace folder
|
|
262
|
+
* itself or its immediate parent (`gitInScope`); a repository Git would only reach further up the
|
|
263
|
+
* tree is not this folder's to offer.
|
|
233
264
|
*/
|
|
234
265
|
export async function listBranches(root) {
|
|
266
|
+
if (!(await gitInScope(root)))
|
|
267
|
+
return { repository: false, branches: [] };
|
|
235
268
|
let collected;
|
|
236
269
|
try {
|
|
237
270
|
// `:lstrip=2` removes the fixed `refs/heads/` prefix instead of asking for an abbreviation:
|
|
@@ -285,8 +318,14 @@ export async function listBranches(root) {
|
|
|
285
318
|
* branch than the one in the request. Nothing else about the name is guessed; Git's own refusal is
|
|
286
319
|
* what the caller reports, because it names the reason (no such branch, a working tree that would
|
|
287
320
|
* lose changes) better than a rule kept in sync here could.
|
|
321
|
+
*
|
|
322
|
+
* The repository has to be the workspace folder itself or its immediate parent (`gitInScope`): a
|
|
323
|
+
* switch Git would only reach by walking further up the tree would move some ancestor repository's
|
|
324
|
+
* working tree, not this folder's.
|
|
288
325
|
*/
|
|
289
326
|
export async function checkoutBranch(root, options) {
|
|
327
|
+
if (!(await gitInScope(root)))
|
|
328
|
+
throw new Error('The project folder is not a Git repository');
|
|
290
329
|
if (typeof options.branch !== 'string')
|
|
291
330
|
throw new Error('A branch name must be a string');
|
|
292
331
|
const name = options.branch.trim();
|
|
@@ -312,8 +351,11 @@ export async function checkoutBranch(root, options) {
|
|
|
312
351
|
* `base` names what the diff is taken against: the working tree alone (unstaged changes, Git's
|
|
313
352
|
* default) or `head`, which is what a per-file view wants because it includes staged and unstaged
|
|
314
353
|
* changes together. Untracked files have no diff at all and are read as content by the client.
|
|
354
|
+
* A folder out of Git scope (`gitInScope`) has nothing to compare, answered without running Git.
|
|
315
355
|
*/
|
|
316
356
|
export async function gitDiff(root, options = {}) {
|
|
357
|
+
if (!(await gitInScope(root)))
|
|
358
|
+
return { diff: '', truncated: false };
|
|
317
359
|
// The pathspec keeps the name that was asked for. `resolveInside` follows the final component with
|
|
318
360
|
// `realpath`, which is what a *read* needs — a link that leaves the project must be refused — but a
|
|
319
361
|
// diff is addressed by Git: canonicalizing a tracked symlink would ask for its target's diff, which
|
|
@@ -1088,7 +1130,12 @@ export async function listExtensions(config, signal, directory) {
|
|
|
1088
1130
|
listBundles('plugins', config, { signal, notices, directory }),
|
|
1089
1131
|
]);
|
|
1090
1132
|
return {
|
|
1091
|
-
skills: skills.map(map),
|
|
1133
|
+
skills: skills.map(map),
|
|
1134
|
+
// Andorra's own skills, for the composer's slash menu only: Settings lists what is installed, and
|
|
1135
|
+
// these can be neither removed nor turned off.
|
|
1136
|
+
builtinSkills: builtinSkillEntries(skills).map(skill => ({ id: skill.id, name: skill.name, description: skill.description, enabled: true, command: skill.command,
|
|
1137
|
+
repository: { id: 'andorra', name: 'Built-in', source: 'andorra', path: '' } })),
|
|
1138
|
+
plugins: plugins.map(map),
|
|
1092
1139
|
mcpServers: Object.entries(config.mcpServers ?? {}).map(([id, server]) => ({
|
|
1093
1140
|
id, transport: server.transport, enabled: server.enabled !== false,
|
|
1094
1141
|
summary: summarizeMcpServer(server),
|
package/dist/src/app-server.d.ts
CHANGED
|
@@ -2,11 +2,14 @@ import { type ProviderConfig } from './providers.js';
|
|
|
2
2
|
import { removeCodexAccount } from './codex-auth.js';
|
|
3
3
|
import { CodexAccountAuth } from './codex-browser-auth.js';
|
|
4
4
|
import { AnthropicConsoleAuth } from './anthropic-console-auth.js';
|
|
5
|
+
import { OpenCodeSignIn } from './managed-sign-in.js';
|
|
6
|
+
import type { CliSignIn } from './cli-sign-in.js';
|
|
5
7
|
import { checkGraphModelHealth } from './graph-health.js';
|
|
6
8
|
import { loadAccessibleGraph } from './membership.js';
|
|
7
9
|
import { type SavedSession } from './sessions.js';
|
|
8
10
|
import { type GhRunner } from './pull-requests.js';
|
|
9
11
|
import { type Completion, type RunResult } from './runtime.js';
|
|
12
|
+
import { CodeIntelligenceManager } from './code-intelligence/CodeIntelligenceManager.js';
|
|
10
13
|
import { type AppServerErrorCode } from './app-server/protocol.js';
|
|
11
14
|
/**
|
|
12
15
|
* `andorra app-server --stdio`: the engine a non-TUI client drives.
|
|
@@ -29,6 +32,8 @@ declare class AppServerError extends Error {
|
|
|
29
32
|
readonly code: AppServerErrorCode;
|
|
30
33
|
constructor(code: AppServerErrorCode, message: string);
|
|
31
34
|
}
|
|
35
|
+
type ManagedSignInService = Pick<CliSignIn, 'start' | 'status' | 'cancel' | 'logout' | 'submitCode' | 'close'>;
|
|
36
|
+
type OpenCodeSignInService = Pick<OpenCodeSignIn, 'start' | 'status' | 'cancel' | 'logout' | 'submitCode' | 'close'>;
|
|
32
37
|
/**
|
|
33
38
|
* Merge a client's provider list with the stored secrets.
|
|
34
39
|
*
|
|
@@ -58,32 +63,6 @@ declare class AppServerError extends Error {
|
|
|
58
63
|
* it — and dropping it on save would silently point a second account at the default home's sign-in.
|
|
59
64
|
*/
|
|
60
65
|
export declare function mergeProviderSecrets(stored: ProviderConfig[], incoming: unknown[]): ProviderConfig[];
|
|
61
|
-
/**
|
|
62
|
-
* Whether a failed wake delivery is final for that wake.
|
|
63
|
-
*
|
|
64
|
-
* A delivery gets two kinds of answer. One describes the request: an unknown provider or graph, a task the
|
|
65
|
-
* protocol will not accept, a session record that is no longer there at all, a remote workspace nothing may be
|
|
66
|
-
* run in, a method the engine does not have. The same prompt would be refused the same way a minute from now, so
|
|
67
|
-
* the wake is spent and the row must stop saying the session is waiting on it.
|
|
68
|
-
*
|
|
69
|
-
* A project folder that is not there *this moment* is not that answer. Folders come back: a checkout that has not
|
|
70
|
-
* landed, a share that is unreachable, a directory moved and moved again. A delivery that spent the wake on the
|
|
71
|
-
* first `ENOENT` would throw away a continuation the agent asked for, over a condition that clears. The start
|
|
72
|
-
* refuses a missing folder as a plain filesystem failure rather than a named protocol refusal, and that is the
|
|
73
|
-
* classification: `test/app-server.test.ts` ("a wake survives a delivery the engine could not start") takes an
|
|
74
|
-
* owed workspace out of the world and pins the rest - the wake stays owed, the row keeps its clock, no empty
|
|
75
|
-
* `timers.updated` says the wait is over, and the prompt arrives once the folder does.
|
|
76
|
-
*
|
|
77
|
-
* The other kind describes the moment, and every one of them clears: `engine-busy` and `busy` while another
|
|
78
|
-
* task or a `workspace.checkout` holds the engine, `cancelled` from a shutdown in progress (the wake is on
|
|
79
|
-
* disk, so the next engine process picks it up again), `storage` and `network` from inside the preparation,
|
|
80
|
-
* and — the one that costs a prompt most easily — a raw filesystem error, because the start re-throws the save
|
|
81
|
-
* when the session snapshot cannot be written. A deadline says the earliest a prompt may be given, not that it
|
|
82
|
-
* may be given once, so anything that is not a refusal of the request is waited out. Unclassified failures
|
|
83
|
-
* belong here: an error the engine never got to name is a failure of the moment, and losing the prompt the
|
|
84
|
-
* agent asked to be woken for is the more expensive guess.
|
|
85
|
-
*/
|
|
86
|
-
/** Exported because the table is the part a delivery must not get wrong; the protocol test pins it. */
|
|
87
66
|
export declare function isFinalWakeRefusal(error: unknown): boolean;
|
|
88
67
|
/**
|
|
89
68
|
* The account a finished run leaves on the session turn.
|
|
@@ -114,6 +93,8 @@ export interface AppServerOptions {
|
|
|
114
93
|
error?: NodeJS.WritableStream;
|
|
115
94
|
/** Overridable so a test can answer the model preflight without reaching a provider. */
|
|
116
95
|
checkGraphHealth?: typeof checkGraphModelHealth;
|
|
96
|
+
/** Overridable so a test can watch the code-intelligence manager's mode without starting CodeGraph. */
|
|
97
|
+
createCodeIntelligence?: typeof CodeIntelligenceManager.create;
|
|
117
98
|
/** Overridable so a test can run a graph whose access rules it cannot meet. */
|
|
118
99
|
loadGraph?: typeof loadAccessibleGraph;
|
|
119
100
|
/** Provider authentication is owned here, independently of the Andorra account sign-in. */
|
|
@@ -122,6 +103,12 @@ export interface AppServerOptions {
|
|
|
122
103
|
removeCodexAccount?: typeof removeCodexAccount;
|
|
123
104
|
/** Claude Console sign-in for Anthropic providers; overridable so a test never spawns `ant`. */
|
|
124
105
|
anthropicAuth?: Pick<AnthropicConsoleAuth, 'start' | 'status' | 'cancel' | 'logout' | 'discard' | 'close'>;
|
|
106
|
+
/** Subscription sign-ins run through a vendor CLI; overridable so a test never spawns one. */
|
|
107
|
+
managedSignIn?: {
|
|
108
|
+
claude?: ManagedSignInService;
|
|
109
|
+
grok?: ManagedSignInService;
|
|
110
|
+
opencode?: OpenCodeSignInService;
|
|
111
|
+
};
|
|
125
112
|
/** Overridable so a test can answer `gh` without reaching GitHub. */
|
|
126
113
|
gh?: GhRunner;
|
|
127
114
|
/** How often the pull request watcher polls; a test shortens it. */
|
|
@@ -140,14 +127,18 @@ export declare class AppServer {
|
|
|
140
127
|
private readonly output;
|
|
141
128
|
private readonly error;
|
|
142
129
|
private readonly checkGraphHealth;
|
|
130
|
+
private readonly createCodeIntelligence;
|
|
143
131
|
private readonly loadGraph;
|
|
144
132
|
private readonly codexAuth;
|
|
145
133
|
private readonly anthropicAuth;
|
|
134
|
+
private readonly claudeSignIn;
|
|
135
|
+
private readonly grokSignIn;
|
|
136
|
+
private readonly openCodeSignIn;
|
|
146
137
|
/** Retires a removed provider's slot home; a seam so a test never has to spawn the Codex CLI. */
|
|
147
138
|
private readonly retireCodexAccount;
|
|
148
139
|
/** The `gh` the pull request settings and watcher run through. */
|
|
149
140
|
private readonly gh;
|
|
150
|
-
/** Polls the PRs whose sessions asked for Auto-fix
|
|
141
|
+
/** Polls the PRs whose sessions asked for Auto-fix; one engine per home actually polls. */
|
|
151
142
|
private readonly pullRequestWatcher;
|
|
152
143
|
/** The wakes this engine armed for Auto-fix, checked against the PR record again before delivery. */
|
|
153
144
|
private readonly autoFixWakes;
|
|
@@ -234,18 +225,11 @@ export declare class AppServer {
|
|
|
234
225
|
*/
|
|
235
226
|
private startingSession?;
|
|
236
227
|
/**
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
* and a marker file carry
|
|
228
|
+
* Each live run's journal writer. A writer holds the events its file refused and writes them once
|
|
229
|
+
* appends succeed again, so it is also what knows, at finalization, whether the journal is a
|
|
230
|
+
* complete account (the record and a marker file carry the answer past a crash).
|
|
240
231
|
*/
|
|
241
|
-
private readonly
|
|
242
|
-
/**
|
|
243
|
-
* Runs whose checkpoint sink failed mid-attempt. A checkpoint is the conversation a resume
|
|
244
|
-
* re-enters the node with, so a run whose checkpoint could not be written is one no resume may
|
|
245
|
-
* replay: the resume would re-enter the node from its opening task and repeat the tool calls it
|
|
246
|
-
* had already made. The record and a marker file carry the failure past a crash.
|
|
247
|
-
*/
|
|
248
|
-
private readonly checkpointFailures;
|
|
232
|
+
private readonly journals;
|
|
249
233
|
/**
|
|
250
234
|
* The session trajectory of the run in flight: one sanitized debug log per session
|
|
251
235
|
* (`trajectories/<sessionId>.jsonl` in this home), appended by every run and resume of that
|
|
@@ -434,6 +418,13 @@ export declare class AppServer {
|
|
|
434
418
|
private discoverModels;
|
|
435
419
|
/** Local-client only. The remote engine relay deliberately does not admit these methods. */
|
|
436
420
|
private providerAuth;
|
|
421
|
+
/**
|
|
422
|
+
* Subscription sign-in through a vendor CLI's own login: Claude Code, Grok, or one of OpenCode's
|
|
423
|
+
* upstream providers. Local-client only, like the others. Each of these logins belongs to the CLI
|
|
424
|
+
* on this machine rather than to one provider entry, so the draft a person is adding can sign in
|
|
425
|
+
* before it is saved; a providerId is accepted and ignored.
|
|
426
|
+
*/
|
|
427
|
+
private managedProviderAuth;
|
|
437
428
|
/**
|
|
438
429
|
* Claude Console sign-in for one configured Anthropic provider. Local-client only, like Codex
|
|
439
430
|
* sign-in: the remote engine relay does not admit these methods.
|
|
@@ -594,6 +585,18 @@ export declare class AppServer {
|
|
|
594
585
|
* disagreeing about the model a node runs, because all three read this same graph.
|
|
595
586
|
*/
|
|
596
587
|
private graphForRun;
|
|
588
|
+
/**
|
|
589
|
+
* The graph a resume replays against, with carried node switches applied before its remaining
|
|
590
|
+
* provider references are bound.
|
|
591
|
+
*
|
|
592
|
+
* A node moved to provider B survives provider A leaving the configuration: the carried provider
|
|
593
|
+
* replaces the switched node's reference before the binder validates what is left, so the
|
|
594
|
+
* obsolete pin cannot fail the load. The carried model travels after the bind — the binder offers
|
|
595
|
+
* only models a provider's configuration lists, and a live switch may have named a model the
|
|
596
|
+
* endpoint serves without the configuration listing it, which `resolveModel` accepted. A
|
|
597
|
+
* whole-run override sets every reference aside instead, so it binds nothing, as before.
|
|
598
|
+
*/
|
|
599
|
+
private loadResumeGraph;
|
|
597
600
|
private prepareRunValidated;
|
|
598
601
|
/**
|
|
599
602
|
* Name a brand-new session from its first prompt with one bounded model request.
|
|
@@ -645,6 +648,39 @@ export declare class AppServer {
|
|
|
645
648
|
private serializeRunRecordWrite;
|
|
646
649
|
/** Change the next model turn without aborting a stream or replaying tools. */
|
|
647
650
|
private setRunModel;
|
|
651
|
+
/**
|
|
652
|
+
* Change the permission mode a live attempt runs under, without interrupting it.
|
|
653
|
+
*
|
|
654
|
+
* The new mode reaches the attempt through its permission control (`ActiveRun.permissionControl`): a
|
|
655
|
+
* tool call that has not decided yet decides under it, and every approval the attempt is waiting on
|
|
656
|
+
* is handed back as `policy-changed`, so its tool decides again — a prompt the new mode answers goes
|
|
657
|
+
* away, and one the new mode still requires is asked again. The mode is saved where the attempt read
|
|
658
|
+
* it from, so the next task, a resume and a terminal on the same project agree with what is running.
|
|
659
|
+
*/
|
|
660
|
+
private setRunPermissions;
|
|
661
|
+
private applyRunPermissions;
|
|
662
|
+
/**
|
|
663
|
+
* Move a live run's control to `next` and journal the change, settling any prompt that waited
|
|
664
|
+
* across it. Shared by the saved switch (`run.setPermissions`) and the run-scoped plan-approval
|
|
665
|
+
* flip: neither re-asks a mode the run already has.
|
|
666
|
+
*/
|
|
667
|
+
private switchLiveRunPermissions;
|
|
668
|
+
/**
|
|
669
|
+
* The plan-approval flip. Unlike `run.setPermissions` it is run-scoped only: approving a plan
|
|
670
|
+
* never rewrites the saved workspace default, so the next task plans again. The run continues in
|
|
671
|
+
* the workspace's saved default when that is an editing mode, and in Ask for approval otherwise.
|
|
672
|
+
*/
|
|
673
|
+
private approvePlan;
|
|
674
|
+
/** Save a live mode where the attempt reads it from: its own record when bound, the workspace default otherwise. */
|
|
675
|
+
private saveRunPermissions;
|
|
676
|
+
/**
|
|
677
|
+
* Bring the workspace's code-intelligence manager, once it exists, to the mode the run holds for it.
|
|
678
|
+
*
|
|
679
|
+
* One change at a time, each reading the target when it runs, so the last one leaves the manager on
|
|
680
|
+
* the latest target. A manager already on the target is left alone; one whose change failed is in an
|
|
681
|
+
* unknown mode, so the next sync applies the target again rather than trusting it.
|
|
682
|
+
*/
|
|
683
|
+
private syncCodeIntelPermissions;
|
|
648
684
|
private resolveModel;
|
|
649
685
|
/**
|
|
650
686
|
* The client-visible configuration with the plan-aware analytics answer.
|
|
@@ -666,12 +702,15 @@ export declare class AppServer {
|
|
|
666
702
|
private codeIntelligence;
|
|
667
703
|
/** Code-intelligence events belong to the active run's stream when one is running. */
|
|
668
704
|
private runEvent;
|
|
705
|
+
/** The journal writer of one run, created on its first event. */
|
|
706
|
+
private journalFor;
|
|
669
707
|
/**
|
|
670
708
|
* Journal first, then the client: a client that missed an event can re-read the record.
|
|
671
709
|
*
|
|
672
|
-
* `runs/`
|
|
673
|
-
* and this mode returns before that code runs, so a fresh configuration home
|
|
674
|
-
* fail every append with ENOENT
|
|
710
|
+
* The writer creates `runs/` when the first append finds it missing: the terminal client creates
|
|
711
|
+
* it during startup, and this mode returns before that code runs, so a fresh configuration home
|
|
712
|
+
* would otherwise fail every append with ENOENT. Appends are ordered: the filesystem does not
|
|
713
|
+
* finish concurrent appends in the order they were started.
|
|
675
714
|
*/
|
|
676
715
|
private recordRunEvent;
|
|
677
716
|
private ensureRunRecords;
|
|
@@ -720,6 +759,8 @@ export declare class AppServer {
|
|
|
720
759
|
* them into B's account. `graphStorageAccess` claims an unclaimed directory for a confirmed account —
|
|
721
760
|
* the account the builder claims it for — and reports the ones that are still shared.
|
|
722
761
|
*/
|
|
762
|
+
/** Whether a stored graph selection names a graph whose latest revision is soft-deleted. */
|
|
763
|
+
private selectionIsDeleted;
|
|
723
764
|
private graphDirectory;
|
|
724
765
|
/**
|
|
725
766
|
* Whether the account service confirms this account, paid or free.
|
|
@@ -993,6 +1034,39 @@ export declare class AppServer {
|
|
|
993
1034
|
private nextWakeLook;
|
|
994
1035
|
/** Begin a delivery pass when none is going. Called by the registry's due callback and by the check. */
|
|
995
1036
|
private checkTimers;
|
|
1037
|
+
/**
|
|
1038
|
+
* Say a wake will never be delivered: drop it, publish the shorter wait list, and tell the user why.
|
|
1039
|
+
*
|
|
1040
|
+
* A wake is the agent's own reminder about work that is over or was replaced, and starting it as a new task
|
|
1041
|
+
* would restart that work behind the user's back. Dropping it silently would hide a promise the agent made,
|
|
1042
|
+
* so the reason goes out with `timers.spent` - which a window shows as a notice - and into the log.
|
|
1043
|
+
*/
|
|
1044
|
+
private spendWake;
|
|
1045
|
+
/**
|
|
1046
|
+
* Spend the session's node-armed wakes that belong to an attempt in `attempts` and satisfy `spent`.
|
|
1047
|
+
*
|
|
1048
|
+
* Wakes another surface is in the middle of delivering are left alone: that delivery decides what became of
|
|
1049
|
+
* them. Wakes no graph node armed are never touched here.
|
|
1050
|
+
*/
|
|
1051
|
+
private spendAttemptWakes;
|
|
1052
|
+
/**
|
|
1053
|
+
* Hand every due wake the live run itself armed (or an attempt that run continues) to that run, as a
|
|
1054
|
+
* steering message its working node reads at the next turn boundary.
|
|
1055
|
+
*
|
|
1056
|
+
* The wake is settled once the message is queued: from there the run owns it. One the run ends before
|
|
1057
|
+
* reading is put back on the registry by the finalizer, where the rules for a finished run decide it.
|
|
1058
|
+
*/
|
|
1059
|
+
private steerDueWakes;
|
|
1060
|
+
/**
|
|
1061
|
+
* Where a node-armed wake goes once no run has the engine: the attempt to continue, a reason it is spent, or
|
|
1062
|
+
* a reason to wait.
|
|
1063
|
+
*
|
|
1064
|
+
* It continues only the session's newest attempt, and only when that attempt is the one that armed it or a
|
|
1065
|
+
* continuation of it, the attempt stopped without finishing, the user did not stop it, and the arming node
|
|
1066
|
+
* has not finished since the wake was armed. Anything else means the work the reminder was about is over or
|
|
1067
|
+
* was replaced by a newer turn, and it is spent.
|
|
1068
|
+
*/
|
|
1069
|
+
private wakeContinuation;
|
|
996
1070
|
/**
|
|
997
1071
|
* Give every wake that has come due to the session that armed it, one run at a time.
|
|
998
1072
|
*
|