@andorra-labs/code 0.1.16 → 0.1.17
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/acp-agent.d.ts +6 -0
- package/dist/src/acp-agent.js +15 -4
- package/dist/src/agent-execution.js +11 -8
- package/dist/src/agent-mcp-catalog.js +1 -0
- package/dist/src/agent-mcp.d.ts +3 -0
- package/dist/src/agent-mcp.js +33 -1
- package/dist/src/andorra/entry.d.ts +10 -0
- package/dist/src/andorra/entry.js +18 -4
- package/dist/src/andorra/hosted.d.ts +2 -1
- package/dist/src/andorra/hosted.js +2 -1
- package/dist/src/andorra/notices.d.ts +5 -0
- package/dist/src/andorra/notices.js +7 -0
- package/dist/src/andorra/state.d.ts +3 -2
- package/dist/src/andorra/state.js +4 -4
- package/dist/src/andorra/terminal.js +7 -2
- package/dist/src/anthropic-credentials.js +2 -0
- package/dist/src/app-server/error.d.ts +5 -0
- package/dist/src/app-server/error.js +7 -0
- package/dist/src/app-server/protocol.d.ts +19 -44
- package/dist/src/app-server/protocol.js +5 -1
- package/dist/src/app-server/workspace.d.ts +89 -0
- package/dist/src/app-server/workspace.js +457 -11
- package/dist/src/app-server.d.ts +358 -32
- package/dist/src/app-server.js +2429 -509
- package/dist/src/bridge/cloud.d.ts +27 -0
- package/dist/src/bridge/cloud.js +187 -0
- package/dist/src/bridge/command.d.ts +30 -0
- package/dist/src/bridge/command.js +347 -0
- package/dist/src/bridge/control.d.ts +68 -0
- package/dist/src/bridge/control.js +233 -0
- package/dist/src/bridge/engines.d.ts +90 -0
- package/dist/src/bridge/engines.js +601 -0
- package/dist/src/bridge/host-ops.d.ts +9 -0
- package/dist/src/bridge/host-ops.js +129 -0
- package/dist/src/bridge/host.d.ts +47 -0
- package/dist/src/bridge/host.js +540 -0
- package/dist/src/bridge/link.d.ts +38 -0
- package/dist/src/bridge/link.js +508 -0
- package/dist/src/bridge/login-link.d.ts +29 -0
- package/dist/src/bridge/login-link.js +54 -0
- package/dist/src/bridge/protocol.d.ts +136 -0
- package/dist/src/bridge/protocol.js +11 -0
- package/dist/src/bridge/store.d.ts +12 -0
- package/dist/src/bridge/store.js +61 -0
- package/dist/src/bridge/wording.d.ts +6 -0
- package/dist/src/bridge/wording.js +10 -0
- package/dist/src/browser-server.js +7 -1
- package/dist/src/browser-ui/tokens.css +1 -1
- package/dist/src/change-authors.d.ts +41 -0
- package/dist/src/change-authors.js +146 -0
- package/dist/src/cli.js +182 -32
- package/dist/src/coding-tools.js +15 -15
- package/dist/src/command-screens.d.ts +6 -0
- package/dist/src/command-screens.js +14 -11
- package/dist/src/commands.d.ts +14 -2
- package/dist/src/compaction-phrases.js +1 -1
- package/dist/src/completion.js +82 -5
- package/dist/src/config.d.ts +71 -3
- package/dist/src/config.js +202 -77
- package/dist/src/deadline.js +13 -1
- package/dist/src/decision/checks.js +1 -1
- package/dist/src/decision/requestPhrases.js +0 -1
- package/dist/src/default-graph.js +1 -1
- package/dist/src/file-diff.d.ts +4 -0
- package/dist/src/file-diff.js +2 -1
- package/dist/src/github-app/agent-writes.d.ts +102 -0
- package/dist/src/github-app/agent-writes.js +320 -0
- package/dist/src/github-app/client.d.ts +349 -0
- package/dist/src/github-app/client.js +810 -0
- package/dist/src/github-app/event-source.d.ts +208 -0
- package/dist/src/github-app/event-source.js +684 -0
- package/dist/src/github-app/metrics.d.ts +32 -0
- package/dist/src/github-app/metrics.js +49 -0
- package/dist/src/github-app/review-loop.d.ts +274 -0
- package/dist/src/github-app/review-loop.js +1177 -0
- package/dist/src/github-app/review-node.d.ts +81 -0
- package/dist/src/github-app/review-node.js +205 -0
- package/dist/src/github-app/review-post.d.ts +73 -0
- package/dist/src/github-app/review-post.js +139 -0
- package/dist/src/github-app/review-text.d.ts +107 -0
- package/dist/src/github-app/review-text.js +1133 -0
- package/dist/src/github-app/review-threads.d.ts +47 -0
- package/dist/src/github-app/review-threads.js +107 -0
- package/dist/src/github-app/reviewer.d.ts +121 -0
- package/dist/src/github-app/reviewer.js +598 -0
- package/dist/src/github-app/store.d.ts +59 -0
- package/dist/src/github-app/store.js +148 -0
- package/dist/src/github-app/triggers.d.ts +141 -0
- package/dist/src/github-app/triggers.js +441 -0
- package/dist/src/github-names.d.ts +8 -0
- package/dist/src/github-names.js +8 -0
- package/dist/src/glob-search.d.ts +61 -0
- package/dist/src/glob-search.js +180 -0
- package/dist/src/graph-health.js +6 -1
- package/dist/src/graph-manager-chat.js +1 -1
- package/dist/src/graph-preview.d.ts +46 -0
- package/dist/src/graph-preview.js +55 -0
- package/dist/src/graph-provider-portability.js +2 -1
- package/dist/src/graph-runner.js +64 -3
- package/dist/src/graph-server.js +3 -3
- package/dist/src/graph-sync.js +3 -3
- package/dist/src/graph-ui/app.js +91 -7
- package/dist/src/graph-ui/icons.js +2 -1
- package/dist/src/graph-ui/studio.js +15 -1
- package/dist/src/graph-ui/tokens.css +1 -1
- package/dist/src/graphs.d.ts +34 -1
- package/dist/src/graphs.js +158 -14
- package/dist/src/image-input.d.ts +16 -0
- package/dist/src/image-input.js +41 -0
- package/dist/src/membership.d.ts +10 -0
- package/dist/src/membership.js +19 -4
- package/dist/src/model-health-cache.js +1 -1
- package/dist/src/model-metadata.d.ts +6 -0
- package/dist/src/model-metadata.js +35 -15
- package/dist/src/model-relay/local.d.ts +116 -0
- package/dist/src/model-relay/local.js +468 -0
- package/dist/src/model-relay/remote.d.ts +129 -0
- package/dist/src/model-relay/remote.js +252 -0
- package/dist/src/model-relay/runs.d.ts +34 -0
- package/dist/src/model-relay/runs.js +146 -0
- package/dist/src/model-relay/wire.d.ts +5 -0
- package/dist/src/model-relay/wire.js +5 -0
- package/dist/src/project-registry.d.ts +21 -0
- package/dist/src/project-registry.js +74 -0
- package/dist/src/provider-import.d.ts +0 -12
- package/dist/src/provider-import.js +7 -195
- package/dist/src/providers.d.ts +23 -2
- package/dist/src/providers.js +25 -4
- package/dist/src/pull-request-logs.d.ts +12 -1
- package/dist/src/pull-request-logs.js +14 -3
- package/dist/src/pull-requests.d.ts +327 -7
- package/dist/src/pull-requests.js +429 -51
- package/dist/src/react-runtime.js +1 -1
- package/dist/src/remote/engine-pool.d.ts +88 -4
- package/dist/src/remote/engine-pool.js +366 -89
- package/dist/src/remote/roots.d.ts +19 -0
- package/dist/src/remote/roots.js +45 -7
- package/dist/src/remote/types.d.ts +0 -44
- package/dist/src/run-control.d.ts +7 -0
- package/dist/src/run-control.js +23 -0
- package/dist/src/run-records.d.ts +7 -2
- package/dist/src/run-records.js +71 -6
- package/dist/src/runtime.d.ts +5 -1
- package/dist/src/runtime.js +10 -2
- package/dist/src/session-changes.d.ts +35 -0
- package/dist/src/session-changes.js +194 -6
- package/dist/src/session-monitor.js +2 -1
- package/dist/src/session-reaper.d.ts +1 -1
- package/dist/src/session-reaper.js +6 -1
- package/dist/src/session-summary.d.ts +2 -1
- package/dist/src/session-summary.js +2 -1
- package/dist/src/sessions.d.ts +11 -1
- package/dist/src/sessions.js +17 -4
- package/dist/src/skills/bundled/diagram/SKILL.md +5 -3
- package/dist/src/skills/bundled/graph-manager/SKILL.md +7 -4
- package/dist/src/skills/bundled/provenance.json +2 -2
- package/dist/src/skills/runtime-skills.js +1 -1
- package/dist/src/telemetry/emitter.d.ts +15 -0
- package/dist/src/telemetry/emitter.js +35 -1
- package/dist/src/telemetry/schema.d.ts +25 -2
- package/dist/src/telemetry/schema.js +52 -4
- package/dist/src/telemetry/surface.d.ts +2 -1
- package/dist/src/telemetry/surface.js +4 -1
- package/dist/src/terminal-ui.d.ts +1 -0
- package/dist/src/terminal-ui.js +10 -3
- package/dist/src/test-edit-guard.d.ts +7 -0
- package/dist/src/test-edit-guard.js +49 -1
- package/dist/src/timers.d.ts +2 -0
- package/dist/src/tools.js +59 -9
- package/package.json +6 -1
- package/dist/src/remote/cert.d.ts +0 -11
- package/dist/src/remote/cert.js +0 -87
- package/dist/src/remote/client.d.ts +0 -119
- package/dist/src/remote/client.js +0 -544
- package/dist/src/remote/command.d.ts +0 -4
- package/dist/src/remote/command.js +0 -194
- package/dist/src/remote/errors.d.ts +0 -11
- package/dist/src/remote/errors.js +0 -14
- package/dist/src/remote/network.d.ts +0 -22
- package/dist/src/remote/network.js +0 -102
- package/dist/src/remote/pairing.d.ts +0 -63
- package/dist/src/remote/pairing.js +0 -299
- package/dist/src/remote/pem.d.ts +0 -2
- package/dist/src/remote/pem.js +0 -7
- package/dist/src/remote/serve.d.ts +0 -68
- package/dist/src/remote/serve.js +0 -244
- package/dist/src/remote/server.d.ts +0 -21
- package/dist/src/remote/server.js +0 -406
package/dist/src/acp-agent.d.ts
CHANGED
|
@@ -18,6 +18,12 @@ export declare function promptText(blocks: readonly ContentBlock[]): string;
|
|
|
18
18
|
export declare function toolKind(name: string): ToolKind;
|
|
19
19
|
/** A short, readable title for a tool call: what it reads, changes, searches for or runs. */
|
|
20
20
|
export declare function toolTitle(name: string, input: unknown, cwd: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* What "Always allow" in a session covers: the tool, except that each of pull_request's writes of public text
|
|
23
|
+
* (reply, resolve, comment) is allowed on its own, so allowing a settings change never lets the agent post on
|
|
24
|
+
* GitHub unasked.
|
|
25
|
+
*/
|
|
26
|
+
export declare function alwaysAllowKey(name: string, input: unknown): string;
|
|
21
27
|
/** A file's text for a diff: null when it does not exist, undefined when it cannot be shown whole. */
|
|
22
28
|
export type FileSnapshot = string | null | undefined;
|
|
23
29
|
/**
|
package/dist/src/acp-agent.js
CHANGED
|
@@ -288,6 +288,16 @@ export function toolTitle(name, input, cwd) {
|
|
|
288
288
|
}
|
|
289
289
|
/** Files larger than this are shown as a positioned text diff instead of whole before and after texts. */
|
|
290
290
|
const MAX_DIFF_FILE_BYTES = 1_000_000;
|
|
291
|
+
/**
|
|
292
|
+
* What "Always allow" in a session covers: the tool, except that each of pull_request's writes of public text
|
|
293
|
+
* (reply, resolve, comment) is allowed on its own, so allowing a settings change never lets the agent post on
|
|
294
|
+
* GitHub unasked.
|
|
295
|
+
*/
|
|
296
|
+
export function alwaysAllowKey(name, input) {
|
|
297
|
+
const tool = canonicalCodingToolName(name) ?? name;
|
|
298
|
+
const action = typeof input === 'object' && input !== null ? input.action : undefined;
|
|
299
|
+
return tool === 'pull_request' && (action === 'reply' || action === 'resolve' || action === 'comment') ? `pull_request ${action}` : tool;
|
|
300
|
+
}
|
|
291
301
|
/** A text as lines that keep their own line endings. */
|
|
292
302
|
function snapshotLines(text) {
|
|
293
303
|
return text === null || text === '' ? [] : text.split(/(?<=\n)/);
|
|
@@ -551,11 +561,12 @@ export async function runAcpAgent(options = {}) {
|
|
|
551
561
|
await new Promise(next => setImmediate(next));
|
|
552
562
|
const name = typeof data.name === 'string' ? data.name : 'tool';
|
|
553
563
|
const key = canonicalCodingToolName(name) ?? name;
|
|
554
|
-
|
|
564
|
+
const rawInput = toolInput(data.arguments);
|
|
565
|
+
const allowKey = alwaysAllowKey(name, rawInput);
|
|
566
|
+
if (session.alwaysAllow.has(allowKey)) {
|
|
555
567
|
await answerApproval(id, true);
|
|
556
568
|
return;
|
|
557
569
|
}
|
|
558
|
-
const rawInput = toolInput(data.arguments);
|
|
559
570
|
// The engine asks after the call has started: point the request at that call, so the client shows one item.
|
|
560
571
|
let matched;
|
|
561
572
|
for (const [toolCallId, open] of [...openTools].reverse()) {
|
|
@@ -577,7 +588,7 @@ export async function runAcpAgent(options = {}) {
|
|
|
577
588
|
toolCall: { toolCallId: matched ?? `approval-${id}`, title, kind: toolKind(name), status: 'pending', rawInput },
|
|
578
589
|
options: [
|
|
579
590
|
{ optionId: 'allow', name: 'Allow', kind: 'allow_once' },
|
|
580
|
-
{ optionId: 'allow-always', name: `Always allow ${
|
|
591
|
+
{ optionId: 'allow-always', name: `Always allow ${allowKey} in this session`, kind: 'allow_always' },
|
|
581
592
|
{ optionId: 'reject', name: 'Reject', kind: 'reject_once' },
|
|
582
593
|
],
|
|
583
594
|
});
|
|
@@ -588,7 +599,7 @@ export async function runAcpAgent(options = {}) {
|
|
|
588
599
|
}
|
|
589
600
|
catch { }
|
|
590
601
|
if (always)
|
|
591
|
-
session.alwaysAllow.add(
|
|
602
|
+
session.alwaysAllow.add(allowKey);
|
|
592
603
|
if (matched && approved)
|
|
593
604
|
update({ sessionUpdate: 'tool_call_update', toolCallId: matched, status: 'in_progress' });
|
|
594
605
|
await answerApproval(id, approved);
|
|
@@ -27,7 +27,7 @@ import { bindUserWaits, createRuntimeBudget } from './deadline.js';
|
|
|
27
27
|
import { createAgentEngine } from './hardened-runtime.js';
|
|
28
28
|
import { completionTool } from './completion.js';
|
|
29
29
|
import { applyToolProfile } from './tool-profile.js';
|
|
30
|
-
import { DELIVERED_OUTCOME, GRAPH_MANAGER_GRAPH_ID, capabilitySubset, delegatesWriting, effectiveCapabilities, intakeCapabilities, isTestingNode, isWritingRole, laterAgentNodes, permitsBuiltInTool, testerOnEveryRoute } from './graphs.js';
|
|
30
|
+
import { DELIVERED_OUTCOME, GRAPH_MANAGER_GRAPH_ID, REVIEWER_GRAPH_ID, capabilitySubset, isolatedGraph, reviewerOutputProblem, delegatesWriting, effectiveCapabilities, intakeCapabilities, isTestingNode, isWritingRole, laterAgentNodes, permitsBuiltInTool, testerOnEveryRoute } from './graphs.js';
|
|
31
31
|
import { DELEGATION_DIFF_LIMIT, LandingRestoreError, addChangeWorktree, assertDelegationGit, applyLanding, collectChange, prepareLanding, removeChangeWorktree, repositoryRoot, snapshotWorkspace } from './delegation-changes.js';
|
|
32
32
|
import { stopQaProcessesUnder } from './qa/runtime/ProcessManager.js';
|
|
33
33
|
import { qaGuidance } from './qa/guidance.js';
|
|
@@ -147,6 +147,8 @@ export async function executeAgentNode(node, options) {
|
|
|
147
147
|
options = { ...options, runId: randomUUID() };
|
|
148
148
|
const store = options.artifactStore ?? new ArtifactStore(options.runId ?? randomUUID());
|
|
149
149
|
const orchestrator = node.agentRole === 'orchestrator';
|
|
150
|
+
// An isolated graph's agent (the review loop's reviewer) gets its configured tools and the completion tools, nothing more.
|
|
151
|
+
const isolated = isolatedGraph(options.graph?.id);
|
|
150
152
|
// With declared outcomes the Orchestrator picks its route itself; with a single outcome, delegation needs a routed delivered port.
|
|
151
153
|
const routedDelegation = orchestrator && delegatesWriting(node) && node.completion?.mode === 'outcomes';
|
|
152
154
|
const delegationActive = routedDelegation || (orchestrator && delegatesWriting(node) && !!options.graph?.edges.some(edge => edge.source === node.id && edge.outcome === DELIVERED_OUTCOME));
|
|
@@ -381,7 +383,7 @@ export async function executeAgentNode(node, options) {
|
|
|
381
383
|
return 'Inspect relevant repository files, search or list the workspace (or obtain a successful research child result) before completing.';
|
|
382
384
|
};
|
|
383
385
|
let observedResearch = false;
|
|
384
|
-
const codeManager = options.codeIntel;
|
|
386
|
+
const codeManager = isolated ? undefined : options.codeIntel;
|
|
385
387
|
const codeLedger = codeManager?.createLedger();
|
|
386
388
|
const codeIntel = codeManager?.active && permitsBuiltInTool(configured, 'repo_explore') ? codeManager : undefined;
|
|
387
389
|
const researchTool = (name) => ['Read', 'Glob', 'Grep', 'git_read', 'repo_explore'].includes(canonicalToolName(name));
|
|
@@ -458,7 +460,7 @@ export async function executeAgentNode(node, options) {
|
|
|
458
460
|
} });
|
|
459
461
|
if (orchestrator && depth === 0 && effectiveCapabilities(configured).filesystem !== 'none')
|
|
460
462
|
tools.push(removeUntrackedFileTool());
|
|
461
|
-
if (!orchestrator && depth === 0 && options.context.approvalMode !== 'headless' && options.context.askUser)
|
|
463
|
+
if (!orchestrator && !isolated && depth === 0 && options.context.approvalMode !== 'headless' && options.context.askUser)
|
|
462
464
|
tools.push({ name: 'ask_user', executionMode: 'sequential', description: 'Ask the user a question only they can answer and wait for the answer. Use it whenever a choice is theirs to make: a skill or instruction that says to ask, a preference, a missing requirement. A question written in your reply does not pause the run and may go unseen, so never ask that way. Ask one short question per call in plain language; when the options are known give 2-4 short choices, the recommended one first and labelled (Recommended). Do not ask what your tools can find out or what you can reasonably decide yourself. Before asking where something is or what a name refers to, finish a search for it by file name and by content; a search that was cut short or timed out does not count.',
|
|
463
465
|
parameters: { type: 'object', properties: { question: { type: 'string', minLength: 1, maxLength: 500, description: 'One plain-language question.' }, choices: { type: 'array', items: { type: 'string', minLength: 1, maxLength: 200 }, minItems: 2, maxItems: 8, description: 'Short answers the user can pick from; they can always type their own.' } }, required: ['question'], additionalProperties: false },
|
|
464
466
|
execute: async (args, ctx) => {
|
|
@@ -484,7 +486,7 @@ export async function executeAgentNode(node, options) {
|
|
|
484
486
|
throw new Error('The answer exceeds 16000 characters; ask for a shorter decision.');
|
|
485
487
|
return JSON.stringify({ answered: true, answer });
|
|
486
488
|
} });
|
|
487
|
-
if (depth === 0)
|
|
489
|
+
if (depth === 0 && !isolated)
|
|
488
490
|
tools.push({ name: 'present_plan', executionMode: 'sequential', description: 'Present the implementation plan for the user to approve, reject, or send feedback on. Only meaningful while the run is in plan mode: file mutations and escalations stay refused until a plan is approved. Present one complete plan in markdown after researching; a later call may present a revised plan after feedback.',
|
|
489
491
|
parameters: { type: 'object', properties: { plan: { type: 'string', minLength: 1, maxLength: 16000, description: 'The implementation plan in markdown: what will change, the files or areas touched, the approach, and how it will be verified.' } }, required: ['plan'], additionalProperties: false },
|
|
490
492
|
execute: async (args, ctx) => {
|
|
@@ -950,7 +952,7 @@ export async function executeAgentNode(node, options) {
|
|
|
950
952
|
|| options.efficiency?.projectSkillDiscovery === true
|
|
951
953
|
|| (options.efficiency?.projectSkillDiscovery !== false && options.decisionManager?.skillRoutingEnabled === true));
|
|
952
954
|
const resourceReader = tools.find(tool => tool.name === 'read_skill_resource');
|
|
953
|
-
const skills = discoverProjectSkills || requestedInheritedSkills.length > 0 || promptSkillNames.length > 0 || resourceReader || tools.some(tool => tool.name === 'qa.browser_session')
|
|
955
|
+
const skills = !isolated && (discoverProjectSkills || requestedInheritedSkills.length > 0 || promptSkillNames.length > 0 || resourceReader || tools.some(tool => tool.name === 'qa.browser_session'))
|
|
954
956
|
? await discoverRuntimeSkills(context.workspace, context.signal, tools.map(tool => tool.name), discoverProjectSkills) : [];
|
|
955
957
|
// A skill inherited from earlier nodes that this node cannot load (broken locally, or no skill
|
|
956
958
|
// reader among its tools) is left out for this node only; the run continues without it.
|
|
@@ -1477,7 +1479,7 @@ export async function executeAgentNode(node, options) {
|
|
|
1477
1479
|
return [...replay, ...fresh];
|
|
1478
1480
|
};
|
|
1479
1481
|
result = await createAgentEngine().execute({ ...options, instructions: nodeInstructions || undefined, todoStore, context, provider, model,
|
|
1480
|
-
todoList: options.todoList !== false && options.graph?.id !== GRAPH_MANAGER_GRAPH_ID,
|
|
1482
|
+
todoList: options.todoList !== false && options.graph?.id !== GRAPH_MANAGER_GRAPH_ID && !isolated,
|
|
1481
1483
|
efficiency: configured.tools && options.efficiency?.toolMenuRouting
|
|
1482
1484
|
? { ...options.efficiency, toolMenuRouting: { ...options.efficiency.toolMenuRouting, pinnedTools: [...new Set([...(options.efficiency.toolMenuRouting.pinnedTools ?? []), ...configured.tools.map(canonicalToolName)])] } }
|
|
1483
1485
|
: options.efficiency,
|
|
@@ -1523,8 +1525,9 @@ export async function executeAgentNode(node, options) {
|
|
|
1523
1525
|
if (!routedDelegation && !records.some(change => change.state === 'landed'))
|
|
1524
1526
|
return 'Land at least one accepted change before completing as delivered.';
|
|
1525
1527
|
}
|
|
1526
|
-
} : depth === 0 &&
|
|
1527
|
-
: inheritedSkills.length || promptSkills.length ?
|
|
1528
|
+
} : isolated && depth === 0 && options.graph?.id === REVIEWER_GRAPH_ID ? completion => reviewerOutputProblem(completion.output)
|
|
1529
|
+
: depth === 0 && policy.enabled ? () => backgroundGuard() ?? (inheritedSkills.length || promptSkills.length ? missingSkillError() : undefined)
|
|
1530
|
+
: inheritedSkills.length || promptSkills.length ? () => missingSkillError() : undefined, completionPolicy, outputSchema: configured.outputSchema,
|
|
1528
1531
|
history: configured.contextPolicy?.history ? options.history : [],
|
|
1529
1532
|
task: attemptRepoBlock ? `${taskBase}\n\n${attemptRepoBlock}` : taskBase,
|
|
1530
1533
|
onUsage: (usage, origin) => {
|
|
@@ -18,6 +18,7 @@ export const AGENT_MCP_CATALOG = [
|
|
|
18
18
|
{ name: 'andorra_graph_edge_upsert', description: 'Create or replace an edge. Outcome must match a source node port (pass/fail, true/false, body/done...).', inputSchema: obj({ draftId: str, edge: { type: 'object' } }, ['draftId', 'edge']) },
|
|
19
19
|
{ name: 'andorra_graph_edge_remove', description: 'Remove an edge by ID from a draft.', inputSchema: obj({ ...graphDraftSchema, edgeId: str }, ['draftId', 'edgeId']) },
|
|
20
20
|
{ name: 'andorra_graph_patch', description: 'Set graph entry, name, limits, schemas, widgets or metadata in a draft.', inputSchema: obj({ draftId: str, patch: { type: 'object' } }, ['draftId', 'patch']) },
|
|
21
|
+
{ name: 'andorra_graph_show', description: 'Show a graph to the user in the chat. The Andorra desktop app draws it the way the Graph Editor does (steps, models, outcome routes, the entry); other hosts get the reply\'s plain-text sketch. Pass draftId for a draft, or id (and optionally revision) for a published graph. Use it whenever you present, sketch or review a graph, instead of drawing a diagram.', inputSchema: obj({ draftId: str, id: str, revision: { type: 'integer', minimum: 1 } }) },
|
|
21
22
|
{ name: 'andorra_graph_validate', description: 'Validate a draft; report all missing provider and outcome paths, plus graph topology issues.', inputSchema: obj(graphDraftSchema, ['draftId']) },
|
|
22
23
|
{ name: 'andorra_graph_publish', description: 'Validate and atomically publish the next immutable graph revision; optimistic concurrency guards other editors.', inputSchema: obj(graphDraftSchema, ['draftId']) },
|
|
23
24
|
{ name: 'andorra_graph_delete', description: 'Soft-delete a graph after the user confirms in chat: publishes a revision marked deleted, hides it from listings and new runs, keeps every revision. confirm must repeat the id.', inputSchema: obj({ id: str, expectedRevision: { type: 'integer', minimum: 1 }, confirm: str }, ['id', 'expectedRevision', 'confirm']) },
|
package/dist/src/agent-mcp.d.ts
CHANGED
|
@@ -40,6 +40,8 @@ export interface AgentMcpBackendOptions {
|
|
|
40
40
|
subagentWorkspace?: string;
|
|
41
41
|
subagentAdapterFactory?: (provider: import('./providers.js').ProviderConfig) => ModelAdapter;
|
|
42
42
|
recoverRuns?: boolean;
|
|
43
|
+
/** Whether a desktop app draws andorra_graph_show replies; defaults to running under one (ANDORRA_DESKTOP_HOST_PID). */
|
|
44
|
+
desktopHost?: boolean;
|
|
43
45
|
}
|
|
44
46
|
export declare const GRAPH_AGENT_GUIDE: string;
|
|
45
47
|
export declare class AgentMcpError extends Error {
|
|
@@ -81,6 +83,7 @@ export declare class AgentMcpBackend {
|
|
|
81
83
|
private assertGraphIdentity;
|
|
82
84
|
private obtainDraft;
|
|
83
85
|
private providers;
|
|
86
|
+
private showGraph;
|
|
84
87
|
private setDeleted;
|
|
85
88
|
private readGraph;
|
|
86
89
|
private upsertNode;
|
package/dist/src/agent-mcp.js
CHANGED
|
@@ -18,6 +18,9 @@ import { AutomationStore } from './automations.js';
|
|
|
18
18
|
import { canonicalWorkspace, MAX_SUBAGENT_TASK_CHARS, SubagentInvalidArgumentError, SubagentProviderNotSetError, SubagentRunInProgressError, SubagentRunner, SubagentSelectionError } from './subagent-run.js';
|
|
19
19
|
import { reconcileInterruptedRuns } from './run-records.js';
|
|
20
20
|
import { AGENT_MCP_CATALOG, AGENT_MCP_TOOL_NAMES } from './agent-mcp-catalog.js';
|
|
21
|
+
import { graphPreview, graphSketch } from './graph-preview.js';
|
|
22
|
+
/** The longest andorra_graph_show reply that still carries its sketch, inside the 24,000-character tool event. */
|
|
23
|
+
const SHOW_REPLY_BUDGET = 20_000;
|
|
21
24
|
export const GRAPH_AGENT_GUIDE = [
|
|
22
25
|
'# Andorra Code Graph Agent Architecture (MCP)',
|
|
23
26
|
'',
|
|
@@ -32,6 +35,7 @@ export const GRAPH_AGENT_GUIDE = [
|
|
|
32
35
|
'4. andorra_graph_edge_upsert links the exact source outcome to a target node.',
|
|
33
36
|
'5. andorra_graph_patch sets entry, name, limits, widgets and schemas.',
|
|
34
37
|
'6. andorra_graph_validate returns all missing-provider and missing-path issues plus the structural validator error.',
|
|
38
|
+
' andorra_graph_show draws a draft (draftId) or a published graph (id) for the user in the chat; use it instead of a diagram.',
|
|
35
39
|
'7. andorra_graph_publish validates and saves an optimistic, immutable revision. Fix issues; do not suppress them.',
|
|
36
40
|
'8. andorra_graph_discard abandons a draft. Drafts are process-local, expire after an hour and are not published until saved.',
|
|
37
41
|
'',
|
|
@@ -52,6 +56,10 @@ export const GRAPH_AGENT_GUIDE = [
|
|
|
52
56
|
' A cycle still needs a ceiling: graph.limits.maxNodeVisits or graph.limits.wallTimeMs, one of the two.',
|
|
53
57
|
' A finite graph.limits.maxNodeVisits must be large enough for loop maxIterations plus reentry.',
|
|
54
58
|
'approval: ports approved and rejected. The live runtime asks the person before advancing.',
|
|
59
|
+
'review: Andorra review of the task\'s pull request; requires review {rounds 1-10, when "ready"|"always", instruction <= 2 KiB, provider and model together or neither}.',
|
|
60
|
+
' Ports findings, clean and stopped. Each visit posts one review as andorra-code[bot]; route findings back to the Agent that fixes them',
|
|
61
|
+
' with inputMapping {taskInstruction: "$source.output.prompt"}, and clean and stopped onward. On a cycle, a finite graph.limits.maxNodeVisits must be at least rounds.',
|
|
62
|
+
' Output: round, rounds, loop, head, reviewUrl, findings [{priority, where, threadId, url, path, line, title}], nits, reason, prompt.',
|
|
55
63
|
'join: join {mode:"all"|"any"}. Join all must not wait on mutually exclusive outcome branches.',
|
|
56
64
|
'parallel: fan-out; connect its completed port to downstream work.',
|
|
57
65
|
'action: action {kind:"command"|"tests"|"git",command:"..."}; graph capability constraints still apply.',
|
|
@@ -149,7 +157,7 @@ function draftId(args) {
|
|
|
149
157
|
throw new AgentMcpError('INVALID_DRAFT', 'draftId must be the UUID returned by andorra_graph_begin.');
|
|
150
158
|
return value;
|
|
151
159
|
}
|
|
152
|
-
const knownTypes = ['agent', 'end', 'join', 'parallel', 'condition', 'loop', 'action', 'approval'];
|
|
160
|
+
const knownTypes = ['agent', 'end', 'join', 'parallel', 'condition', 'loop', 'action', 'approval', 'review'];
|
|
153
161
|
const CARD_WIDTH = 210, CARD_HEIGHT = 94, PORT_HEIGHT = 25;
|
|
154
162
|
const UNPLACED_SPACING = 290;
|
|
155
163
|
const COORDINATE_LIMIT = 100_000;
|
|
@@ -423,6 +431,28 @@ export class AgentMcpBackend {
|
|
|
423
431
|
// not only its default; without it validation rejects a graph the app itself runs.
|
|
424
432
|
return { providers: config.providers.map(({ id, model, type, models }) => ({ id, model, type, ...(models?.length ? { models: [...models] } : {}) })), active: config.provider };
|
|
425
433
|
}
|
|
434
|
+
async showGraph(args, access) {
|
|
435
|
+
const byDraft = args.draftId !== undefined, byId = args.id !== undefined;
|
|
436
|
+
if (byDraft === byId)
|
|
437
|
+
throw new AgentMcpError('INVALID_ARGUMENTS', 'Pass draftId to show a draft, or id (and optionally revision) to show a published graph, not both.');
|
|
438
|
+
const revision = args.revision;
|
|
439
|
+
if (revision !== undefined && (byDraft || typeof revision !== 'number' || !Number.isSafeInteger(revision) || revision < 1))
|
|
440
|
+
throw new AgentMcpError('INVALID_ARGUMENTS', 'revision must be a positive safe integer, and only with id.');
|
|
441
|
+
const graph = byDraft ? this.obtainDraft(draftId(args), access).graph : await this.readGraph(field(args, 'id'), access.directory, revision);
|
|
442
|
+
await this.assertGraphIdentity(access);
|
|
443
|
+
const { providers, active } = await this.providers();
|
|
444
|
+
const deleted = !byDraft && isDeletedGraph(graph);
|
|
445
|
+
const preview = { ...graphPreview(graph, byDraft ? 'draft' : graph.revision, provider => providers.find(item => item.id === (provider ?? active))?.model),
|
|
446
|
+
...(deleted ? { deleted: true } : {}) };
|
|
447
|
+
const drawn = this.options.desktopHost ?? Boolean(process.env.ANDORRA_DESKTOP_HOST_PID);
|
|
448
|
+
// The chat reads the reply from an event cut at 24,000 characters; the sketch goes only while the whole reply stays well inside it.
|
|
449
|
+
const sketch = graphSketch(preview);
|
|
450
|
+
const fits = JSON.stringify({ preview, sketch }).length <= SHOW_REPLY_BUDGET;
|
|
451
|
+
const note = drawn
|
|
452
|
+
? 'The Andorra desktop app draws this graph in the chat; do not draw it again or retype it as arrows.'
|
|
453
|
+
: fits ? 'Nothing in this host draws the graph: put the sketch in your reply.' : 'Nothing in this host draws the graph, and it is too large for a sketch: describe its steps and routes in words.';
|
|
454
|
+
return { preview, ...(fits ? { sketch } : {}), ...(deleted ? { deletedAt: graph.metadata.deletedAt } : {}), note };
|
|
455
|
+
}
|
|
426
456
|
async setDeleted(deleting, args, access, beforeSave) {
|
|
427
457
|
const tool = deleting ? 'andorra_graph_delete' : 'andorra_graph_restore';
|
|
428
458
|
const id = field(args, 'id');
|
|
@@ -814,6 +844,8 @@ export class AgentMcpBackend {
|
|
|
814
844
|
publishing: false, touched: Date.now(), authoredAgents: new Set() });
|
|
815
845
|
return { draftId: key, graph, expectedRevision, note: 'This draft is local to this MCP process until published.' };
|
|
816
846
|
}
|
|
847
|
+
if (name === 'andorra_graph_show')
|
|
848
|
+
return this.showGraph(args, access);
|
|
817
849
|
if (name === 'andorra_graph_discard') {
|
|
818
850
|
const key = draftId(args);
|
|
819
851
|
this.obtainDraft(key, access);
|
|
@@ -17,5 +17,15 @@ export declare function applyAndorraEntry(config: Config, answer: HostedAnswer,
|
|
|
17
17
|
* Andorra is offered and not saved yet. It exists in memory only; nothing validates, saves or sends requests with it.
|
|
18
18
|
*/
|
|
19
19
|
export declare function virtualAndorraEntry(config: Pick<Config, 'providers'>, answer: HostedAnswer): ProviderConfig | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* The move an Andorra entry made when the model it was on left the offer: the display names of the model before
|
|
22
|
+
* and after (the id where the router gave no other name). Undefined when the entry is new, gone, on the same
|
|
23
|
+
* model, or changed model while the old one is still served (the user's own pick).
|
|
24
|
+
*/
|
|
25
|
+
export declare function andorraModelSwitch(before: Pick<Config, 'providers'>, after: Pick<Config, 'providers'>): {
|
|
26
|
+
id: string;
|
|
27
|
+
from: string;
|
|
28
|
+
to: string;
|
|
29
|
+
} | undefined;
|
|
20
30
|
/** The provider to select when the active one goes away: never Andorra by position. */
|
|
21
31
|
export declare function fallbackProviderId(providers: readonly Pick<ProviderConfig, 'id' | 'type'>[]): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { reconcileSubagentPair } from '../config.js';
|
|
2
|
-
import { applyModelContextWindow, MAX_MODEL_DISPLAY_NAME_LENGTH } from '../providers.js';
|
|
2
|
+
import { applyModelContextWindow, MAX_MODEL_DISPLAY_NAME_LENGTH, modelDisplayName } from '../providers.js';
|
|
3
3
|
import { ANDORRA_PROVIDER_BASE_URL } from './endpoint.js';
|
|
4
4
|
const ANDORRA_ID = 'andorra';
|
|
5
5
|
const ANDORRA_NAME = 'Andorra';
|
|
@@ -77,8 +77,10 @@ export function applyAndorraEntry(config, answer, mode) {
|
|
|
77
77
|
const modelNames = hostedNames(answer);
|
|
78
78
|
const modelParameters = hostedParameters(answer);
|
|
79
79
|
const freeModels = answer.models.filter(model => model.free === true).map(model => model.id);
|
|
80
|
+
const textOnlyModels = answer.models.filter(model => model.imageInput === false).map(model => model.id);
|
|
80
81
|
const named = { ...(Object.keys(modelNames).length ? { modelNames } : {}),
|
|
81
|
-
...(Object.keys(modelParameters).length ? { modelParameters } : {}), ...(freeModels.length ? { freeModels } : {})
|
|
82
|
+
...(Object.keys(modelParameters).length ? { modelParameters } : {}), ...(freeModels.length ? { freeModels } : {}),
|
|
83
|
+
...(textOnlyModels.length ? { textOnlyModels } : {}) };
|
|
82
84
|
const index = config.providers.findIndex(provider => provider.type === 'andorra');
|
|
83
85
|
if (index < 0) {
|
|
84
86
|
if (mode !== 'create')
|
|
@@ -91,9 +93,9 @@ export function applyAndorraEntry(config, answer, mode) {
|
|
|
91
93
|
const model = models.includes(existing.model) ? existing.model : models[0];
|
|
92
94
|
if (model === existing.model && sameList(existing.models, models) && sameWindows(existing.modelContextWindows, modelContextWindows)
|
|
93
95
|
&& sameNames(existing.modelNames, modelNames) && sameNumbers(existing.modelParameters, modelParameters)
|
|
94
|
-
&& sameList(existing.freeModels ?? [], freeModels))
|
|
96
|
+
&& sameList(existing.freeModels ?? [], freeModels) && sameList(existing.textOnlyModels ?? [], textOnlyModels))
|
|
95
97
|
return undefined;
|
|
96
|
-
const { modelNames: _previous, modelParameters: _sizes, freeModels: _free, ...rest } = existing;
|
|
98
|
+
const { modelNames: _previous, modelParameters: _sizes, freeModels: _free, textOnlyModels: _textOnly, ...rest } = existing;
|
|
97
99
|
const refreshed = { ...rest, model, models, modelContextWindows, ...named };
|
|
98
100
|
if (refreshed.contextWindow !== undefined)
|
|
99
101
|
applyModelContextWindow(refreshed, model);
|
|
@@ -112,6 +114,18 @@ export function virtualAndorraEntry(config, answer) {
|
|
|
112
114
|
return undefined;
|
|
113
115
|
return applyAndorraEntry({ version: 1, provider: '', providers: [...config.providers] }, answer, 'create')?.providers[0];
|
|
114
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* The move an Andorra entry made when the model it was on left the offer: the display names of the model before
|
|
119
|
+
* and after (the id where the router gave no other name). Undefined when the entry is new, gone, on the same
|
|
120
|
+
* model, or changed model while the old one is still served (the user's own pick).
|
|
121
|
+
*/
|
|
122
|
+
export function andorraModelSwitch(before, after) {
|
|
123
|
+
const next = after.providers.find(provider => provider.type === 'andorra');
|
|
124
|
+
const previous = next && before.providers.find(provider => provider.type === 'andorra' && provider.id === next.id);
|
|
125
|
+
if (!next || !previous || previous.model === next.model || !next.models || next.models.includes(previous.model))
|
|
126
|
+
return undefined;
|
|
127
|
+
return { id: next.id, from: modelDisplayName(previous, previous.model), to: modelDisplayName(next, next.model) };
|
|
128
|
+
}
|
|
115
129
|
/** The provider to select when the active one goes away: never Andorra by position. */
|
|
116
130
|
export function fallbackProviderId(providers) {
|
|
117
131
|
return providers.find(provider => provider.type !== 'andorra')?.id ?? providers[0]?.id ?? '';
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
/** `parametersBillions`: the model's size, where the router states one. `free`: served past the weekly allowance. */
|
|
1
|
+
/** `parametersBillions`: the model's size, where the router states one. `free`: served past the weekly allowance. `imageInput: false`: text-only, never sent images. */
|
|
2
2
|
export interface HostedModel {
|
|
3
3
|
id: string;
|
|
4
4
|
name: string;
|
|
5
5
|
contextWindow: number;
|
|
6
6
|
parametersBillions?: number;
|
|
7
7
|
free?: boolean;
|
|
8
|
+
imageInput?: false;
|
|
8
9
|
}
|
|
9
10
|
/** How much of the account's weekly allowance is used (0-100) and when it renews (ISO timestamp). */
|
|
10
11
|
export interface HostedAllowance {
|
|
@@ -24,7 +24,8 @@ export function parseHostedAnswer(value) {
|
|
|
24
24
|
// Both are optional and descriptive: a malformed one is dropped on its own and never fails the answer.
|
|
25
25
|
models.push({ id: item.id, name, contextWindow: item.contextWindow,
|
|
26
26
|
...(isModelParameters(item.parametersBillions) ? { parametersBillions: item.parametersBillions } : {}),
|
|
27
|
-
...(item.free === true ? { free: true } : {})
|
|
27
|
+
...(item.free === true ? { free: true } : {}),
|
|
28
|
+
...(item.imageInput === false ? { imageInput: false } : {}) });
|
|
28
29
|
}
|
|
29
30
|
const answer = { enabled: true, promotionId: body.promotionId, models };
|
|
30
31
|
const allowance = parseAllowance(body.allowance);
|
|
@@ -9,6 +9,11 @@ export declare function andorraAnnouncement(random?: () => number): string;
|
|
|
9
9
|
export declare const ANDORRA_ADD_HINT = "Choose Andorra in /model to use it.";
|
|
10
10
|
/** Said when the model the user picked is not served by the entry that was just saved (the offer changed meanwhile). */
|
|
11
11
|
export declare const ANDORRA_MODEL_GONE = "That model is no longer available.";
|
|
12
|
+
/**
|
|
13
|
+
* Said when the Andorra model the user was on left the offer and they were moved to another one. `from` and `to`
|
|
14
|
+
* are display names; without a name for the one that went, the sentence does not guess at one.
|
|
15
|
+
*/
|
|
16
|
+
export declare function andorraModelSwitched(from: string | undefined, to: string): string;
|
|
12
17
|
/** The last line of the bubble, in two parts so the terminal can draw the tail as part of the box. */
|
|
13
18
|
export declare const ANDORRA_BUBBLE_TAIL = " \u2570 ";
|
|
14
19
|
export declare const ANDORRA_BUBBLE_SPEAKER = "Andorra";
|
|
@@ -23,6 +23,13 @@ export function andorraAnnouncement(random = Math.random) {
|
|
|
23
23
|
export const ANDORRA_ADD_HINT = 'Choose Andorra in /model to use it.';
|
|
24
24
|
/** Said when the model the user picked is not served by the entry that was just saved (the offer changed meanwhile). */
|
|
25
25
|
export const ANDORRA_MODEL_GONE = 'That model is no longer available.';
|
|
26
|
+
/**
|
|
27
|
+
* Said when the Andorra model the user was on left the offer and they were moved to another one. `from` and `to`
|
|
28
|
+
* are display names; without a name for the one that went, the sentence does not guess at one.
|
|
29
|
+
*/
|
|
30
|
+
export function andorraModelSwitched(from, to) {
|
|
31
|
+
return `${from ?? 'Your Andorra model'} is not available at the moment. Switched to ${to}.`;
|
|
32
|
+
}
|
|
26
33
|
/** The last line of the bubble, in two parts so the terminal can draw the tail as part of the box. */
|
|
27
34
|
export const ANDORRA_BUBBLE_TAIL = ' ╰ ';
|
|
28
35
|
export const ANDORRA_BUBBLE_SPEAKER = 'Andorra';
|
|
@@ -69,8 +69,9 @@ export declare function removingAndorraEntry<T>(home: string, save: () => Promis
|
|
|
69
69
|
export declare function recordAndorraRemoved(home?: string): Promise<boolean>;
|
|
70
70
|
/**
|
|
71
71
|
* What one client surface should say about a new answer, and what it has now seen. `entry` is the user's decision:
|
|
72
|
-
* a removed provider is silent, and the turned-off notice is only for someone who added the provider.
|
|
73
|
-
* is
|
|
72
|
+
* a removed provider is silent, and the turned-off notice is only for someone who added the provider. A model
|
|
73
|
+
* leaving an offer that stays on is not said here: the client that was on it is moved and told which one it is on
|
|
74
|
+
* now (`andorraModelSwitch`). The surface is advanced in every case, so nothing replays later.
|
|
74
75
|
*/
|
|
75
76
|
export declare function advanceSurface(surface: SurfaceState | undefined, answer: HostedAnswer, entry?: AndorraEntryState): {
|
|
76
77
|
surface: SurfaceState;
|
|
@@ -213,14 +213,14 @@ export function recordAndorraRemoved(home = configDirectory()) {
|
|
|
213
213
|
}
|
|
214
214
|
/**
|
|
215
215
|
* What one client surface should say about a new answer, and what it has now seen. `entry` is the user's decision:
|
|
216
|
-
* a removed provider is silent, and the turned-off notice is only for someone who added the provider.
|
|
217
|
-
* is
|
|
216
|
+
* a removed provider is silent, and the turned-off notice is only for someone who added the provider. A model
|
|
217
|
+
* leaving an offer that stays on is not said here: the client that was on it is moved and told which one it is on
|
|
218
|
+
* now (`andorraModelSwitch`). The surface is advanced in every case, so nothing replays later.
|
|
218
219
|
*/
|
|
219
220
|
export function advanceSurface(surface, answer, entry) {
|
|
220
221
|
const ids = answer.enabled ? answer.models.map(m => m.id) : [];
|
|
221
222
|
const fresh = answer.enabled && !!answer.promotionId && answer.promotionId !== surface?.announced;
|
|
222
|
-
const
|
|
223
|
-
const changed = surface?.available === true && (!answer.enabled || lostModel);
|
|
223
|
+
const changed = surface?.available === true && !answer.enabled;
|
|
224
224
|
const next = {};
|
|
225
225
|
const announced = fresh ? answer.promotionId : surface?.announced;
|
|
226
226
|
if (announced !== undefined)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { changeConfigFile, loadConfig, reconcileSubagentPair } from '../config.js';
|
|
2
2
|
import { ANDORRA_CHANGED_MESSAGE } from './endpoint.js';
|
|
3
|
-
import { fallbackProviderId, hasAndorraEntry, virtualAndorraEntry } from './entry.js';
|
|
3
|
+
import { andorraModelSwitch, fallbackProviderId, hasAndorraEntry, virtualAndorraEntry } from './entry.js';
|
|
4
4
|
import { HostedMonitor } from './monitor.js';
|
|
5
|
-
import { ANDORRA_ADD_HINT, andorraAnnouncement, speechBubble } from './notices.js';
|
|
5
|
+
import { ANDORRA_ADD_HINT, andorraAnnouncement, andorraModelSwitched, speechBubble } from './notices.js';
|
|
6
6
|
import { addAndorraEntry, saveAndorraAnswer } from './opt-in.js';
|
|
7
7
|
import { readHostedState, recordAndorraRemoved } from './state.js';
|
|
8
8
|
/** The ids of the providers that serve Andorra's hosted models: the footer shows the usage while one of them is in play. */
|
|
@@ -81,7 +81,12 @@ export function createTerminalAndorra(options) {
|
|
|
81
81
|
// Written or not, take the entry as the file has it, so one another client added or removed shows here.
|
|
82
82
|
const saved = await saveAndorraAnswer(directory, answer) ?? await loadConfig(directory);
|
|
83
83
|
const before = JSON.stringify([config.providers.find(provider => provider.type === 'andorra'), config.provider]);
|
|
84
|
+
const held = { providers: structuredClone(config.providers.filter(provider => provider.type === 'andorra')) };
|
|
84
85
|
adoptAndorraEntry(config, saved);
|
|
86
|
+
// The model this terminal was on left the offer, whichever client saved the move: say which one it is on now.
|
|
87
|
+
const moved = andorraModelSwitch(held, config);
|
|
88
|
+
if (moved !== undefined && config.provider === moved.id)
|
|
89
|
+
options.print(andorraModelSwitched(moved.from, moved.to));
|
|
85
90
|
if (JSON.stringify([config.providers.find(provider => provider.type === 'andorra'), config.provider]) !== before)
|
|
86
91
|
options.refreshStatus();
|
|
87
92
|
},
|
|
@@ -40,6 +40,8 @@ export function signInRequired(providerId) {
|
|
|
40
40
|
}
|
|
41
41
|
const REFRESH_FAILED = 'Your Claude Console sign-in expired or could not be refreshed. Sign in again.';
|
|
42
42
|
export async function providerAuthHeaders(provider, options = {}) {
|
|
43
|
+
if (provider.type === 'relayed')
|
|
44
|
+
throw new Error('A relayed provider needs a run.');
|
|
43
45
|
if (provider.type === 'andorra') {
|
|
44
46
|
assertProviderCredentials(provider);
|
|
45
47
|
const token = await andorraAccessToken(options.signal);
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export declare const APP_SERVER_PROTOCOL_VERSION = 2;
|
|
2
|
-
export declare const APP_SERVER_CAPABILITIES: readonly ["run.start.runPermissions", "automations", "providers.models", "providers.test", "providers.test.model", "providers.streamIdleTimeout", "providers.modelContextWindows", "providers.name", "providers.claude", "providers.claudeAuth", "providers.grok", "providers.google", "providers.opencode", "providers.auth.submit", "providers.opencodeGo", "providers.discover.draft", "providers.detectSignIns", "providers.codexAuth", "providers.codexAuth.logout", "providers.codexAccounts", "providers.anthropicConsole", "run.resume.direction", "run.resume.model", "run.resume.compact", "run.steer", "run.overrideAllNodes", "run.setModel", "run.setModel.node", "run.setPermissions", "run.start.continueSession", "run.start.entryHistory", "remote.owner.projects", "remote.
|
|
2
|
+
export declare const APP_SERVER_CAPABILITIES: readonly ["run.start.runPermissions", "model.relay", "automations", "providers.models", "providers.test", "providers.test.model", "providers.streamIdleTimeout", "providers.modelContextWindows", "providers.textOnlyModels", "providers.name", "providers.claude", "providers.claudeAuth", "providers.grok", "providers.google", "providers.opencode", "providers.auth.submit", "providers.opencodeGo", "providers.discover.draft", "providers.detectSignIns", "providers.codexAuth", "providers.codexAuth.logout", "providers.codexAccounts", "providers.anthropicConsole", "run.resume.direction", "run.resume.model", "run.resume.compact", "run.steer", "run.overrideAllNodes", "run.setModel", "run.setModel.node", "run.setPermissions", "run.start.continueSession", "run.start.entryHistory", "remote.owner.projects", "remote.engine.relay", "environments.bridge", "environments.cloud", "extensions.manage", "extensions.resources", "skills.invoke", "mcp.manage", "mcp.edit", "mcp.status", "runs.files", "sessions.files", "account.profile", "sessions.stats", "sessions.usage", "sessions.usage.hourly", "config.analytics", "config.analytics.planGate", "sessions.trajectory", "config.externalSubagent", "config.codeIntel", "config.decisions", "browser.view", "attachments.read", "config.general", "sessions.pullRequest", "sessions.pullRequest.details", "sessions.pullRequest.review", "sessions.pullRequest.review.teams", "sessions.pullRequest.merge", "sessions.pullRequest.create", "sessions.pullRequest.conversation", "sessions.pullRequest.suggestions", "sessions.pullRequest.checkLogs", "sessions.pullRequest.edit", "sessions.pullRequest.mergeQueue", "sessions.pullRequest.merge.bypass", "sessions.pullRequest.create.fork", "sessions.pullRequest.attach", "pullRequests.reviewRequests", "issues.list", "browser.view.go", "config.browser", "config.webSearch", "background.tasks", "workspace.warm", "browser.cookies.firefox", "browser.extensions", "sessions.compact", "sessions.goal", "sessions.changes", "run.current", "sessions.jev", "providers.andorra", "graphs.visibility", "github.app", "github.app.agentWrites", "github.app.triggers", "github.app.reviews", "sessions.pin", "workspace.files", "workspace.search", "workspace.linkBase", "workspace.write", "sessions.changes.authors", "run.note"];
|
|
3
|
+
/** Remote engine events about the engine version a desktop runs, sent to every connection of that version. */
|
|
4
|
+
export declare const REMOTE_ENGINE_INSTALLING_EVENT = "remote.engine.installing";
|
|
5
|
+
export declare const REMOTE_ENGINE_READY_EVENT = "remote.engine.ready";
|
|
6
|
+
export declare const REMOTE_ENGINE_INSTALL_FAILED_EVENT = "remote.engine.install-failed";
|
|
3
7
|
export interface AppServerRequest {
|
|
4
8
|
id: number | string;
|
|
5
9
|
method: string;
|
|
@@ -33,7 +37,7 @@ export interface AppServerHostInfo {
|
|
|
33
37
|
running?: boolean;
|
|
34
38
|
capabilities: readonly string[];
|
|
35
39
|
}
|
|
36
|
-
export type AppServerErrorCode = 'invalid-request' | 'unknown-method' | 'invalid-params' | 'busy' | 'engine-busy' | 'not-found' | 'login-required' | 'auth' | 'storage' | 'network' | 'cancelled' | 'internal' | 'remote' | 'nothing-to-continue';
|
|
40
|
+
export type AppServerErrorCode = 'invalid-request' | 'unknown-method' | 'invalid-params' | 'busy' | 'engine-busy' | 'not-found' | 'login-required' | 'auth' | 'storage' | 'network' | 'cancelled' | 'internal' | 'remote' | 'nothing-to-continue' | 'forbidden';
|
|
37
41
|
export type AppServerPermissionMode = 'read-only' | 'plan' | 'ask-for-approval' | 'approve-for-me' | 'full-access';
|
|
38
42
|
export interface AppServerProviderAuth {
|
|
39
43
|
state: 'signedOut' | 'starting' | 'waiting' | 'signedIn' | 'cancelled' | 'error';
|
|
@@ -67,7 +71,7 @@ export interface AppServerProviderAuth {
|
|
|
67
71
|
}
|
|
68
72
|
export interface AppServerProvider {
|
|
69
73
|
id: string;
|
|
70
|
-
type: 'openai-compatible' | 'anthropic' | 'codex' | 'claude' | 'opencode-go' | 'grok' | 'opencode' | 'google' | 'andorra';
|
|
74
|
+
type: 'openai-compatible' | 'anthropic' | 'codex' | 'claude' | 'opencode-go' | 'grok' | 'opencode' | 'google' | 'andorra' | 'relayed';
|
|
71
75
|
baseUrl: string;
|
|
72
76
|
model: string;
|
|
73
77
|
apiKeyEnv?: string;
|
|
@@ -241,6 +245,7 @@ export interface AppServerUsageAnalytics {
|
|
|
241
245
|
/** 1 is the rolling last 24 hours, whose `days` rows are UTC hours keyed "YYYY-MM-DDTHH"; otherwise UTC dates. */
|
|
242
246
|
windowDays: number;
|
|
243
247
|
}
|
|
248
|
+
/** `author` marks an added or removed line of a file the person also edited: `user` for theirs, `agent` for the agent's. */
|
|
244
249
|
export interface AppServerFileDiffLine {
|
|
245
250
|
kind: 'context' | 'add' | 'del';
|
|
246
251
|
text: string;
|
|
@@ -248,6 +253,7 @@ export interface AppServerFileDiffLine {
|
|
|
248
253
|
newLine?: number;
|
|
249
254
|
noNewline?: true;
|
|
250
255
|
clipped?: true;
|
|
256
|
+
author?: 'agent' | 'user';
|
|
251
257
|
}
|
|
252
258
|
export interface AppServerFileDiffHunk {
|
|
253
259
|
oldStart: number;
|
|
@@ -276,6 +282,8 @@ export interface AppServerSessionFileChange {
|
|
|
276
282
|
to: 'lf' | 'crlf' | 'mixed';
|
|
277
283
|
};
|
|
278
284
|
changedOnDisk?: true;
|
|
285
|
+
/** Saved from the Files tab: `only` when the person alone changed the file, `also` when the agent changed it too. */
|
|
286
|
+
editedByUser?: 'only' | 'also';
|
|
279
287
|
undoable: boolean;
|
|
280
288
|
version: number;
|
|
281
289
|
firstChangedAt: string;
|
|
@@ -287,10 +295,12 @@ export interface AppServerSessionChanges {
|
|
|
287
295
|
revision: number;
|
|
288
296
|
changes: AppServerSessionFileChange[];
|
|
289
297
|
}
|
|
298
|
+
/** `userLines`, on a `user-edited` conflict, are the person's lines in the file now, as inclusive ranges. */
|
|
290
299
|
export interface AppServerSessionChangeConflict {
|
|
291
300
|
path: string;
|
|
292
|
-
reason: 'changed-on-disk' | 'no-baseline';
|
|
301
|
+
reason: 'changed-on-disk' | 'no-baseline' | 'user-edited';
|
|
293
302
|
message: string;
|
|
303
|
+
userLines?: [number, number][];
|
|
294
304
|
}
|
|
295
305
|
export interface AppServerSessionChangesKept extends AppServerSessionChanges {
|
|
296
306
|
kept: string[];
|
|
@@ -313,6 +323,7 @@ export interface AppServerSessionSummary {
|
|
|
313
323
|
turns: number;
|
|
314
324
|
lastTask?: string;
|
|
315
325
|
archived?: boolean;
|
|
326
|
+
pinned?: boolean;
|
|
316
327
|
jevEnabled?: boolean;
|
|
317
328
|
lastTurnStatus?: AppServerTurnStatus;
|
|
318
329
|
timers?: AppServerTimerState[];
|
|
@@ -360,22 +371,26 @@ export interface AppServerGraphSummary {
|
|
|
360
371
|
locked?: boolean;
|
|
361
372
|
updatedAt?: string;
|
|
362
373
|
}
|
|
374
|
+
/** `ignored`: Git ignores the entry, or it sits inside a folder Git ignores. Absent outside a repository or when Git could not say. */
|
|
363
375
|
export interface AppServerTreeEntry {
|
|
364
376
|
name: string;
|
|
365
377
|
path: string;
|
|
366
378
|
type: 'file' | 'directory';
|
|
367
379
|
size?: number;
|
|
380
|
+
ignored?: boolean;
|
|
368
381
|
}
|
|
369
382
|
export interface AppServerGitFile {
|
|
370
383
|
path: string;
|
|
371
384
|
index: string;
|
|
372
385
|
worktree: string;
|
|
373
386
|
}
|
|
387
|
+
/** `prefix`: where the project folder sits in its repository (`app/`), when it is not the repository's top; `files` are named from the top. */
|
|
374
388
|
export interface AppServerGitStatus {
|
|
375
389
|
repository: boolean;
|
|
376
390
|
branch?: string;
|
|
377
391
|
files: AppServerGitFile[];
|
|
378
392
|
truncated?: boolean;
|
|
393
|
+
prefix?: string;
|
|
379
394
|
}
|
|
380
395
|
export interface AppServerBranchList {
|
|
381
396
|
repository: boolean;
|
|
@@ -398,51 +413,11 @@ export interface AppServerBundle {
|
|
|
398
413
|
relativePath?: string;
|
|
399
414
|
command?: string;
|
|
400
415
|
}
|
|
401
|
-
export type AppServerRemoteTransport = 'https' | 'http';
|
|
402
416
|
export interface AppServerProject {
|
|
403
417
|
path: string;
|
|
404
418
|
name?: string;
|
|
405
419
|
addedAt: string;
|
|
406
420
|
}
|
|
407
|
-
export interface AppServerRemoteHostingStatus {
|
|
408
|
-
serving: boolean;
|
|
409
|
-
port: number;
|
|
410
|
-
transport: AppServerRemoteTransport;
|
|
411
|
-
hostname: string;
|
|
412
|
-
fingerprint: string;
|
|
413
|
-
code: string | null;
|
|
414
|
-
invitationExpiresAt: string | null;
|
|
415
|
-
invitationGrant?: 'browse' | 'full';
|
|
416
|
-
devices: {
|
|
417
|
-
id: string;
|
|
418
|
-
label?: string;
|
|
419
|
-
addedAt: string;
|
|
420
|
-
lastSeenAt?: string;
|
|
421
|
-
grant?: 'browse' | 'full';
|
|
422
|
-
}[];
|
|
423
|
-
shares: {
|
|
424
|
-
id: string;
|
|
425
|
-
path: string;
|
|
426
|
-
label?: string;
|
|
427
|
-
}[];
|
|
428
|
-
}
|
|
429
|
-
export interface AppServerRemoteWorkspace {
|
|
430
|
-
id: string;
|
|
431
|
-
nickname: string;
|
|
432
|
-
host: string;
|
|
433
|
-
hosts: string[];
|
|
434
|
-
port: number;
|
|
435
|
-
transport: AppServerRemoteTransport;
|
|
436
|
-
fingerprint: string;
|
|
437
|
-
hostname?: string;
|
|
438
|
-
platform?: string;
|
|
439
|
-
version?: string;
|
|
440
|
-
addedAt: string;
|
|
441
|
-
status: 'online' | 'offline' | 'identity-changed' | 'unauthorized' | 'unknown';
|
|
442
|
-
grant?: 'browse' | 'full';
|
|
443
|
-
relay?: boolean;
|
|
444
|
-
statusDetail?: string;
|
|
445
|
-
}
|
|
446
421
|
export interface AppServerRemoteProject {
|
|
447
422
|
rootId: string;
|
|
448
423
|
name: string;
|