@andorra-labs/code 0.1.14 → 0.1.16
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 +54 -0
- package/dist/src/acp-agent.js +991 -0
- package/dist/src/agent-definitions.js +29 -6
- package/dist/src/agent-execution.js +8 -2
- package/dist/src/agent-mcp-catalog.js +2 -0
- package/dist/src/agent-mcp.d.ts +3 -1
- package/dist/src/agent-mcp.js +97 -11
- package/dist/src/andorra/entry.js +21 -3
- package/dist/src/andorra/hosted.d.ts +3 -0
- package/dist/src/andorra/hosted.js +5 -1
- package/dist/src/andorra/notices.d.ts +10 -1
- package/dist/src/andorra/notices.js +25 -2
- package/dist/src/andorra/terminal.d.ts +2 -0
- package/dist/src/andorra/terminal.js +2 -2
- package/dist/src/app-server/protocol.d.ts +9 -2
- package/dist/src/app-server/protocol.js +1 -1
- package/dist/src/app-server/workspace.d.ts +1 -0
- package/dist/src/app-server/workspace.js +141 -10
- package/dist/src/app-server.d.ts +115 -0
- package/dist/src/app-server.js +980 -63
- package/dist/src/auth/AuthManager.js +4 -4
- package/dist/src/auth/deployment.js +2 -2
- package/dist/src/browser-bridge.d.ts +1 -0
- package/dist/src/browser-bridge.js +5 -2
- package/dist/src/browser-external-app.d.ts +27 -0
- package/dist/src/browser-external-app.js +60 -0
- package/dist/src/browser-panel-tool.d.ts +6 -0
- package/dist/src/browser-panel-tool.js +36 -0
- package/dist/src/browser-runner.js +1 -0
- package/dist/src/browser-server.d.ts +5 -0
- package/dist/src/browser-server.js +27 -3
- package/dist/src/browser-ui/style.css +3 -3
- package/dist/src/browser-ui/tokens.css +27 -16
- package/dist/src/browser-view.d.ts +16 -0
- package/dist/src/browser-view.js +60 -2
- package/dist/src/bug-report.d.ts +81 -0
- package/dist/src/bug-report.js +235 -0
- package/dist/src/claude-provider.d.ts +2 -1
- package/dist/src/claude-provider.js +13 -9
- package/dist/src/cli-sign-in.d.ts +3 -1
- package/dist/src/cli-sign-in.js +4 -1
- package/dist/src/cli.js +184 -40
- package/dist/src/codex-errors.js +4 -1
- package/dist/src/coding-tools.js +7 -7
- package/dist/src/command-screens.d.ts +9 -2
- package/dist/src/command-screens.js +166 -97
- package/dist/src/commands.d.ts +3 -2
- package/dist/src/commands.js +1 -0
- package/dist/src/compaction-phrases.d.ts +4 -0
- package/dist/src/compaction-phrases.js +20 -0
- package/dist/src/completion-gates.d.ts +22 -0
- package/dist/src/completion-gates.js +11 -0
- package/dist/src/config.d.ts +5 -0
- package/dist/src/config.js +48 -0
- package/dist/src/context-compaction.js +2 -1
- package/dist/src/decision/DecisionManager.js +3 -2
- package/dist/src/decision/requestPhrases.d.ts +4 -0
- package/dist/src/decision/requestPhrases.js +23 -0
- package/dist/src/github-inbox.d.ts +55 -0
- package/dist/src/github-inbox.js +153 -0
- package/dist/src/google-provider.d.ts +31 -0
- package/dist/src/google-provider.js +153 -0
- package/dist/src/graph-health.js +8 -4
- package/dist/src/graph-manager-chat.js +6 -1
- package/dist/src/graph-provider-portability.js +32 -10
- package/dist/src/graph-quota.d.ts +29 -2
- package/dist/src/graph-quota.js +68 -10
- package/dist/src/graph-runner.js +24 -7
- package/dist/src/graph-server.d.ts +1 -1
- package/dist/src/graph-server.js +9 -7
- package/dist/src/graph-sync.d.ts +1 -0
- package/dist/src/graph-sync.js +93 -34
- package/dist/src/graph-tool.d.ts +2 -0
- package/dist/src/graph-tool.js +2 -2
- package/dist/src/graph-ui/app.js +177 -41
- package/dist/src/graph-ui/controls.css +1 -0
- package/dist/src/graph-ui/edge-router.js +121 -53
- package/dist/src/graph-ui/embed.js +2 -2
- package/dist/src/graph-ui/icons.js +1 -0
- package/dist/src/graph-ui/index.html +1 -1
- package/dist/src/graph-ui/manager.css +1 -1
- package/dist/src/graph-ui/manager.js +2 -2
- package/dist/src/graph-ui/sidebar.js +30 -0
- package/dist/src/graph-ui/studio-canvas.js +26 -13
- package/dist/src/graph-ui/studio.css +15 -7
- package/dist/src/graph-ui/studio.js +11 -4
- package/dist/src/graph-ui/style.css +77 -45
- package/dist/src/graph-ui/theme.js +3 -36
- package/dist/src/graph-ui/tokens.css +27 -19
- package/dist/src/graph-visibility.d.ts +31 -0
- package/dist/src/graph-visibility.js +102 -0
- package/dist/src/graphs.js +4 -3
- package/dist/src/live-model.d.ts +24 -0
- package/dist/src/live-model.js +37 -0
- package/dist/src/managed-sign-in.d.ts +1 -0
- package/dist/src/managed-sign-in.js +13 -0
- package/dist/src/membership-errors.d.ts +2 -0
- package/dist/src/membership-errors.js +5 -1
- package/dist/src/membership.d.ts +23 -1
- package/dist/src/membership.js +48 -6
- package/dist/src/model-health-cache.js +1 -1
- package/dist/src/model-metadata.d.ts +1 -1
- package/dist/src/model-metadata.js +12 -3
- package/dist/src/paged-transcript.d.ts +2 -0
- package/dist/src/paged-transcript.js +16 -0
- package/dist/src/plan-pass.d.ts +59 -0
- package/dist/src/plan-pass.js +165 -0
- package/dist/src/provider-connection.js +17 -0
- package/dist/src/provider-engine.d.ts +5 -0
- package/dist/src/provider-engine.js +6 -3
- package/dist/src/provider-import.js +3 -1
- package/dist/src/provider-settings.js +14 -2
- package/dist/src/providers.d.ts +33 -2
- package/dist/src/providers.js +101 -28
- package/dist/src/pull-request-checks.d.ts +26 -0
- package/dist/src/pull-request-checks.js +56 -0
- package/dist/src/pull-request-conversation.d.ts +134 -0
- package/dist/src/pull-request-conversation.js +221 -0
- package/dist/src/pull-request-create.d.ts +175 -0
- package/dist/src/pull-request-create.js +392 -0
- package/dist/src/pull-request-details.d.ts +242 -0
- package/dist/src/pull-request-details.js +614 -0
- package/dist/src/pull-request-edit.d.ts +23 -0
- package/dist/src/pull-request-edit.js +91 -0
- package/dist/src/pull-request-logs.d.ts +76 -0
- package/dist/src/pull-request-logs.js +172 -0
- package/dist/src/pull-request-merge.d.ts +112 -0
- package/dist/src/pull-request-merge.js +258 -0
- package/dist/src/pull-request-review.d.ts +137 -0
- package/dist/src/pull-request-review.js +401 -0
- package/dist/src/pull-requests.d.ts +43 -2
- package/dist/src/pull-requests.js +112 -21
- package/dist/src/react-runtime.js +58 -9
- package/dist/src/read-document-tool.d.ts +2 -0
- package/dist/src/read-document-tool.js +6 -6
- package/dist/src/remote/engine-pool.js +42 -6
- package/dist/src/run-control.d.ts +10 -0
- package/dist/src/run-control.js +24 -0
- package/dist/src/run-progress.d.ts +10 -0
- package/dist/src/run-progress.js +122 -0
- package/dist/src/run-records.d.ts +2 -2
- package/dist/src/runtime-environment.d.ts +1 -0
- package/dist/src/runtime-environment.js +13 -0
- package/dist/src/runtime.d.ts +5 -1
- package/dist/src/runtime.js +14 -2
- package/dist/src/save-lock.js +14 -7
- package/dist/src/session-title.d.ts +3 -0
- package/dist/src/session-title.js +5 -2
- package/dist/src/sign-in-detection.d.ts +1 -1
- package/dist/src/sign-in-detection.js +10 -3
- package/dist/src/sign-in-offer.js +1 -1
- package/dist/src/skill-commands.js +1 -1
- package/dist/src/skills/bundled/bug-report/SKILL.md +80 -0
- package/dist/src/skills/bundled/graph-manager/SKILL.md +9 -1
- package/dist/src/skills/bundled/graph-manager/errors.md +1 -0
- package/dist/src/skills/bundled/provenance.json +7 -2
- package/dist/src/skills/runtime-skills.js +1 -0
- package/dist/src/subagent-run.js +1 -0
- package/dist/src/telemetry/capture-core.d.ts +17 -0
- package/dist/src/telemetry/capture-core.js +59 -1
- package/dist/src/telemetry/classify.d.ts +3 -1
- package/dist/src/telemetry/classify.js +37 -0
- package/dist/src/telemetry/emitter.d.ts +2 -0
- package/dist/src/telemetry/emitter.js +42 -5
- package/dist/src/telemetry/schema.d.ts +22 -0
- package/dist/src/telemetry/schema.js +68 -1
- package/dist/src/telemetry/surface.d.ts +1 -0
- package/dist/src/telemetry/uploader.d.ts +12 -1
- package/dist/src/telemetry/uploader.js +30 -2
- package/dist/src/terminal-links.d.ts +16 -0
- package/dist/src/terminal-links.js +113 -0
- package/dist/src/terminal-ui.d.ts +8 -1
- package/dist/src/terminal-ui.js +40 -14
- package/dist/src/tool-catalog.js +1 -1
- package/dist/src/trajectory.js +6 -1
- package/dist/src/transcript.d.ts +2 -0
- package/dist/src/transcript.js +10 -3
- package/dist/src/types.d.ts +9 -0
- package/dist/src/usage-analytics.js +18 -10
- package/package.json +2 -1
|
@@ -3,6 +3,7 @@ import { mkdir, readdir, readFile, writeFile, rename, rm, unlink } from 'node:fs
|
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { validateSchema } from './handoffs.js';
|
|
5
5
|
import { configDirectory } from './config.js';
|
|
6
|
+
import { findProviderById, providerModelId } from './providers.js';
|
|
6
7
|
import { acquireSaveLock, archiveUnpublishedSnapshot, SaveLockBusyError } from './save-lock.js';
|
|
7
8
|
import { GraphConflictError, validateGraph, createOrchestratorNode, nodeOutcomes } from './graphs.js';
|
|
8
9
|
const base = { filesystem: 'read-write', shell: 'allowed', git: 'write', github: 'pull-request', browser: 'playwright', deployment: 'none' };
|
|
@@ -210,20 +211,42 @@ export function parseAgentExport(input) {
|
|
|
210
211
|
return { name: agent.name.trim(), description: agent.description ?? '', node: structuredClone(agent.node) };
|
|
211
212
|
}
|
|
212
213
|
function adoptModelProfiles(node, providers, defaultProvider) {
|
|
213
|
-
|
|
214
|
-
const
|
|
214
|
+
// Ids and models are matched without regard to case and kept in this machine's spelling.
|
|
215
|
+
const known = (id) => findProviderById(providers, id) !== undefined;
|
|
216
|
+
const forget = (ref) => { if (ref.provider === undefined)
|
|
217
|
+
return; const local = findProviderById(providers, ref.provider); if (local)
|
|
218
|
+
ref.provider = local.id;
|
|
219
|
+
else {
|
|
215
220
|
delete ref.provider;
|
|
216
221
|
delete ref.model;
|
|
217
222
|
} };
|
|
218
223
|
const offers = (ref, inherited) => {
|
|
219
|
-
const profile = providers
|
|
220
|
-
if (ref.model
|
|
224
|
+
const profile = findProviderById(providers, ref.provider ?? inherited);
|
|
225
|
+
if (ref.model === undefined)
|
|
226
|
+
return;
|
|
227
|
+
const local = profile ? providerModelId({ model: profile.model ?? '', models: profile.models }, ref.model) : undefined;
|
|
228
|
+
if (local === undefined)
|
|
221
229
|
delete ref.model;
|
|
230
|
+
else
|
|
231
|
+
ref.model = local;
|
|
232
|
+
};
|
|
233
|
+
const respell = (ref, inherited) => {
|
|
234
|
+
const profile = findProviderById(providers, ref.provider ?? inherited);
|
|
235
|
+
const local = profile && ref.model !== undefined ? providerModelId({ model: profile.model ?? '', models: profile.models }, ref.model) : undefined;
|
|
236
|
+
if (local !== undefined)
|
|
237
|
+
ref.model = local;
|
|
222
238
|
};
|
|
223
239
|
forget(node);
|
|
240
|
+
respell(node, defaultProvider);
|
|
224
241
|
const retry = node.retry;
|
|
225
|
-
if (record(retry) && record(retry.fallback)
|
|
226
|
-
|
|
242
|
+
if (record(retry) && record(retry.fallback)) {
|
|
243
|
+
if (!known(retry.fallback.provider))
|
|
244
|
+
delete retry.fallback;
|
|
245
|
+
else {
|
|
246
|
+
forget(retry.fallback);
|
|
247
|
+
respell(retry.fallback, undefined);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
227
250
|
const inherited = node.provider ?? defaultProvider;
|
|
228
251
|
const subagents = node.subagents;
|
|
229
252
|
if (!record(subagents))
|
|
@@ -11,6 +11,7 @@ import { structuredText } from './code-intelligence/CodeIntelligenceManager.js';
|
|
|
11
11
|
import { buildMemoryBlock } from './memory/MemoryRetriever.js';
|
|
12
12
|
import { discoverRuntimeSkills, matchRuntimeSkill, runtimeSkillTools } from './skills/runtime-skills.js';
|
|
13
13
|
import { promptSkillReferences } from './skills/prompt-skills.js';
|
|
14
|
+
import { BUG_REPORT_SKILL, bugReportTool } from './bug-report.js';
|
|
14
15
|
import { toolFamilies, routeToolFamilies, decisionExecutionGuidance } from './decision/toolFamilies.js';
|
|
15
16
|
import { allowsGraphRouting, route as codeGraphRoute } from './code-intelligence/ContextRouter.js';
|
|
16
17
|
import { randomUUID } from 'node:crypto';
|
|
@@ -367,7 +368,9 @@ export async function executeAgentNode(node, options) {
|
|
|
367
368
|
let provider = configuredProvider, resolved = await resolve(provider, configuredModel);
|
|
368
369
|
if (!resolved)
|
|
369
370
|
throw new Error(`Unknown provider ${provider}. Run andorra and open /providers first.`);
|
|
370
|
-
|
|
371
|
+
// The resolved model is the provider's own spelling of the configured one when they differ only in case.
|
|
372
|
+
const spelled = (wanted, got) => wanted !== undefined && wanted.toLowerCase() === got.toLowerCase() ? got : wanted ?? got;
|
|
373
|
+
let model = spelled(configured.model, resolved.model);
|
|
371
374
|
let fallbackAttempt = parentFallback;
|
|
372
375
|
const orchestratorCompletionGuard = () => {
|
|
373
376
|
if (!clarified)
|
|
@@ -997,6 +1000,9 @@ export async function executeAgentNode(node, options) {
|
|
|
997
1000
|
}).map(requirePublishedPlan) : [];
|
|
998
1001
|
if (skillTools.length)
|
|
999
1002
|
tools = tools.filter(tool => tool.name !== 'read_skill_resource');
|
|
1003
|
+
// The report tool exists only in a run that carries the bug-report skill, so no other run pays for its schema.
|
|
1004
|
+
if (depth === 0 && [...inheritedSkills, ...promptSkills].includes(BUG_REPORT_SKILL))
|
|
1005
|
+
tools.push(bugReportTool({ emit }));
|
|
1000
1006
|
const effectiveTask = typeof inputs.taskInstruction === 'string' && inputs.taskInstruction.trim() ? inputs.taskInstruction.trim() : task;
|
|
1001
1007
|
const graphFirstSearch = depth === 0 && !!codeIntel?.active && codeGraphRoute(effectiveTask) === 'graph';
|
|
1002
1008
|
const decisionTask = depth > 0 ? task : options.decisionPreflight?.task ?? effectiveTask;
|
|
@@ -1551,7 +1557,7 @@ export async function executeAgentNode(node, options) {
|
|
|
1551
1557
|
resolved = await resolve(provider, configured.retry.fallback.model);
|
|
1552
1558
|
if (!resolved)
|
|
1553
1559
|
throw new Error(`Unknown fallback provider: ${provider}`);
|
|
1554
|
-
model = configured.retry.fallback.model
|
|
1560
|
+
model = spelled(configured.retry.fallback.model, resolved.model);
|
|
1555
1561
|
}
|
|
1556
1562
|
}
|
|
1557
1563
|
researchResults.set(result, observedResearch);
|
|
@@ -23,6 +23,8 @@ export const AGENT_MCP_CATALOG = [
|
|
|
23
23
|
{ 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']) },
|
|
24
24
|
{ name: 'andorra_graph_restore', description: 'Restore a soft-deleted graph by publishing the next revision without the deleted marker.', inputSchema: obj({ id: str, expectedRevision: { type: 'integer', minimum: 1 } }, ['id', 'expectedRevision']) },
|
|
25
25
|
{ name: 'andorra_graph_discard', description: 'Discard an unpublished local graph draft.', inputSchema: obj(graphDraftSchema, ['draftId']) },
|
|
26
|
+
{ name: 'andorra_graph_visibility_get', description: 'Read which projects list a published graph in their graph picker (everywhere, or only the named project paths), and the registered project paths it can be limited to.', inputSchema: obj({ id: str }, ['id']) },
|
|
27
|
+
{ name: 'andorra_graph_visibility_set', description: 'Choose which projects list a published graph. projects is "this" (the project this task runs in), "all" (every project), or a list of registered project paths (andorra_graph_visibility_get lists them).', inputSchema: obj({ id: str, projects: { oneOf: [{ type: 'string', enum: ['this', 'all'] }, { type: 'array', items: str, minItems: 1 }] } }, ['id', 'projects']) },
|
|
26
28
|
{ name: 'andorra_projects_list', description: 'List registered projects and discovered session workspaces.', inputSchema: obj({}) },
|
|
27
29
|
{ name: 'andorra_sessions_list', description: 'Search sessions by project, status and last X minutes (lookbackMinutes). Supports paginated results.', inputSchema: obj({ ...searchFilters, status: { type: 'string', enum: ['completed', 'pending', 'running', 'required_input', 'incomplete'] },
|
|
28
30
|
offset: num, limit: { type: 'integer', minimum: 1, maximum: 100 } }) },
|
package/dist/src/agent-mcp.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { loadConfig } from './config.js';
|
|
2
2
|
import { GraphSync } from './graph-sync.js';
|
|
3
3
|
import { getAuthStatus } from './auth/index.js';
|
|
4
|
-
import { getMembership } from './membership.js';
|
|
4
|
+
import { type getMembership } from './membership.js';
|
|
5
5
|
import { type GraphNode } from './graphs.js';
|
|
6
6
|
import { SessionStore } from './sessions.js';
|
|
7
7
|
import { type SubagentProviderListing } from './subagent-run.js';
|
|
@@ -87,7 +87,9 @@ export declare class AgentMcpBackend {
|
|
|
87
87
|
private upsertEdge;
|
|
88
88
|
call(name: string, rawArgs?: unknown, options?: {
|
|
89
89
|
beforeSave?: () => void;
|
|
90
|
+
workspace?: string;
|
|
90
91
|
}): Promise<AgentMcpReply>;
|
|
92
|
+
private graphVisibility;
|
|
91
93
|
private dispatch;
|
|
92
94
|
}
|
|
93
95
|
export { AGENT_MCP_TOOL_NAMES };
|
package/dist/src/agent-mcp.js
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { realpath } from 'node:fs/promises';
|
|
3
|
+
import { isAbsolute, relative } from 'node:path';
|
|
2
4
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
3
5
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
6
|
import { CallToolRequestSchema, ListToolsRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
5
7
|
import { configDirectory, loadConfig } from './config.js';
|
|
8
|
+
import { graphVisibilityFor, setGraphVisibility } from './graph-visibility.js';
|
|
6
9
|
import { graphStorageDirectory } from './graph-account.js';
|
|
7
10
|
import { GraphSync } from './graph-sync.js';
|
|
8
11
|
import { stampGraphProviderProfiles } from './graph-provider-portability.js';
|
|
9
12
|
import { getAuthStatus } from './auth/index.js';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { GraphConflictError, isDeletedGraph, listGraphs, loadGraph, migrateGraphForEditor, nodeOutcomes, optionalOutcomes,
|
|
13
|
+
import { getGraphMembership, PaidMembershipRequiredError } from './membership.js';
|
|
14
|
+
import { FREE_GRAPH_LIMIT_MESSAGE, FREE_LOCKED_GRAPH_MESSAGE, FreeTierLimitError, notePremiumGraphAccount, readGraphQuota, saveFreeTierGraph, savePremiumGraph } from './graph-quota.js';
|
|
15
|
+
import { GraphConflictError, isDeletedGraph, listGraphs, loadGraph, migrateGraphForEditor, nodeOutcomes, optionalOutcomes, validateGraph, withoutDeletedGraphs } from './graphs.js';
|
|
13
16
|
import { getAgentSession, listAgentProjects, queryAgentSessions, scanAgentSessions, SessionQueryError } from './session-monitor.js';
|
|
14
17
|
import { AutomationStore } from './automations.js';
|
|
15
18
|
import { canonicalWorkspace, MAX_SUBAGENT_TASK_CHARS, SubagentInvalidArgumentError, SubagentProviderNotSetError, SubagentRunInProgressError, SubagentRunner, SubagentSelectionError } from './subagent-run.js';
|
|
@@ -64,8 +67,17 @@ export const GRAPH_AGENT_GUIDE = [
|
|
|
64
67
|
'Ask the user in chat first; confirm must repeat the id. Every revision stays stored; the graph leaves listings and new runs refuse it.',
|
|
65
68
|
'Sessions that already ran it keep resuming. andorra_graphs_list {includeDeleted:true} lists deleted graphs with deleted=true.',
|
|
66
69
|
'andorra_graph_restore {id, expectedRevision} publishes the next revision without the marker.',
|
|
67
|
-
'A
|
|
70
|
+
'A free account\'s own graph still counts as its one custom graph while deleted, so a free account restores it rather than replacing it. The other graphs a free account holds are view only: they can be read, but not edited, deleted or restored.',
|
|
68
71
|
'DEFAULT_GRAPH: the bundled Default graph cannot be deleted.',
|
|
72
|
+
'',
|
|
73
|
+
'## Project visibility',
|
|
74
|
+
'A published graph is listed in every project\'s graph picker until it is limited to some projects.',
|
|
75
|
+
'andorra_graph_visibility_get {id} reports {visibleIn: "all"} or {visibleIn: "projects", projects: [paths]}.',
|
|
76
|
+
'andorra_graph_visibility_set {id, projects} changes it: "this" limits the graph to the project the task runs in,',
|
|
77
|
+
'"all" lists it everywhere again, and a list of paths names registered projects; the get reply lists them in registeredProjects.',
|
|
78
|
+
'When the user asks for a graph to be visible only in a project, call andorra_graph_visibility_set after publishing;',
|
|
79
|
+
'never record visibility in graph metadata, which nothing reads. The bundled Default graph is always listed everywhere.',
|
|
80
|
+
'PROJECT_NOT_REGISTERED: the path is not a project in the sidebar; the error lists the registered ones.',
|
|
69
81
|
'CONFIRMATION_MISMATCH: confirm must equal id. GRAPH_IN_USE: an automation runs the graph; the error lists them; change them first.',
|
|
70
82
|
'GRAPH_DELETED: the graph is deleted; restore it before editing or deleting it again. GRAPH_NOT_DELETED: restore needs a deleted graph.',
|
|
71
83
|
'RESERVED_METADATA: metadata.deletedAt is set only by the delete and restore tools; andorra_graph_patch and publishing refuse it.',
|
|
@@ -324,7 +336,7 @@ export class AgentMcpBackend {
|
|
|
324
336
|
throw new AgentMcpError('AUTH_REQUIRED', 'Sign in to your Andorra Code account to edit graphs.');
|
|
325
337
|
if (!/^[A-Za-z0-9-]{1,128}$/.test(before.subject))
|
|
326
338
|
throw new AgentMcpError('AUTH_REQUIRED', 'The signed-in account has an invalid graph storage identity. Sign in again.');
|
|
327
|
-
const membership = await (this.options.membershipStatus ??
|
|
339
|
+
const membership = await (this.options.membershipStatus ?? getGraphMembership)();
|
|
328
340
|
if (!membership.paid && !membership.subject)
|
|
329
341
|
throw PaidMembershipRequiredError.for(membership);
|
|
330
342
|
if (!membership.subject || membership.subject !== before.subject)
|
|
@@ -336,6 +348,8 @@ export class AgentMcpBackend {
|
|
|
336
348
|
const confirmed = await authStatus();
|
|
337
349
|
if (!confirmed.signedIn || confirmed.subject !== membership.subject)
|
|
338
350
|
throw new AgentMcpError('AUTH_CHANGED', 'Account changed while opening graph storage. Retry graph access with the current account.');
|
|
351
|
+
if (membership.paid)
|
|
352
|
+
await notePremiumGraphAccount(directory);
|
|
339
353
|
access = { directory, subject: membership.subject, free: !membership.paid };
|
|
340
354
|
}
|
|
341
355
|
const key = access.directory + '\0' + (access.subject ?? '');
|
|
@@ -450,7 +464,7 @@ export class AgentMcpBackend {
|
|
|
450
464
|
const next = { ...latest, metadata };
|
|
451
465
|
beforeSave?.();
|
|
452
466
|
const saved = freshAccess.free ? await saveFreeTierGraph(next, latest.revision, access.directory)
|
|
453
|
-
: await
|
|
467
|
+
: await savePremiumGraph(next, latest.revision, access.directory);
|
|
454
468
|
if (deleting)
|
|
455
469
|
for (const [key, draft] of this.drafts)
|
|
456
470
|
if (draft.graph.id === id && draft.directory === access.directory)
|
|
@@ -458,7 +472,7 @@ export class AgentMcpBackend {
|
|
|
458
472
|
void this.sync?.sync();
|
|
459
473
|
const note = 'Revision saved locally. Cloud synchronization may still be pending.';
|
|
460
474
|
return deleting
|
|
461
|
-
? { id, revision: saved.revision, deletedAt, note: freshAccess.free ? note + '
|
|
475
|
+
? { id, revision: saved.revision, deletedAt, note: freshAccess.free ? note + ' This graph still counts as this free account\'s one custom graph while deleted; restore it to use it again.' : note }
|
|
462
476
|
: { id, revision: saved.revision, note };
|
|
463
477
|
}
|
|
464
478
|
async readGraph(id, directory, revision) {
|
|
@@ -533,7 +547,7 @@ export class AgentMcpBackend {
|
|
|
533
547
|
}
|
|
534
548
|
async call(name, rawArgs = {}, options = {}) {
|
|
535
549
|
try {
|
|
536
|
-
return { ok: true, data: await this.dispatch(name, argsRecord(rawArgs), options.beforeSave) };
|
|
550
|
+
return { ok: true, data: await this.dispatch(name, argsRecord(rawArgs), options.beforeSave, options.workspace) };
|
|
537
551
|
}
|
|
538
552
|
catch (error) {
|
|
539
553
|
if (error instanceof GraphConflictError)
|
|
@@ -543,6 +557,9 @@ export class AgentMcpBackend {
|
|
|
543
557
|
return { ok: false, error: { code: error.code, message: error.message } };
|
|
544
558
|
if (error instanceof FreeTierLimitError)
|
|
545
559
|
return { ok: false, error: { code: error.code, message: error.message } };
|
|
560
|
+
if (error instanceof PaidMembershipRequiredError && error.unavailable)
|
|
561
|
+
return { ok: false, error: { code: 'MEMBERSHIP_UNAVAILABLE',
|
|
562
|
+
message: error.message + ' An open draft is kept: repeat the same call after a short wait.' } };
|
|
546
563
|
if (error instanceof PaidMembershipRequiredError) {
|
|
547
564
|
const status = await getAuthStatus().catch(() => undefined);
|
|
548
565
|
return { ok: false, error: status?.signedIn
|
|
@@ -556,7 +573,71 @@ export class AgentMcpBackend {
|
|
|
556
573
|
return { ok: false, error: backendIssue(error) };
|
|
557
574
|
}
|
|
558
575
|
}
|
|
559
|
-
async
|
|
576
|
+
async graphVisibility(setting, args, access, beforeSave, workspace) {
|
|
577
|
+
const id = field(args, 'id');
|
|
578
|
+
if (id === 'default')
|
|
579
|
+
throw new AgentMcpError('DEFAULT_GRAPH', 'The bundled Default graph is always listed in every project.');
|
|
580
|
+
if (!access.subject)
|
|
581
|
+
throw new AgentMcpError('AUTH_REQUIRED', 'Sign in to your Andorra Code account to choose where a graph is listed.');
|
|
582
|
+
const graph = await this.readGraph(id, access.directory);
|
|
583
|
+
if (isDeletedGraph(graph))
|
|
584
|
+
throw new AgentMcpError('GRAPH_DELETED', 'Graph ' + id + ' is deleted. Restore it with andorra_graph_restore before changing where it is listed.');
|
|
585
|
+
const describe = (visibility) => {
|
|
586
|
+
const projects = visibility[id];
|
|
587
|
+
return projects === undefined ? { id, visibleIn: 'all' } : { id, visibleIn: 'projects', projects };
|
|
588
|
+
};
|
|
589
|
+
if (!setting) {
|
|
590
|
+
const config = await loadConfig(this.directory);
|
|
591
|
+
await this.assertGraphIdentity(access);
|
|
592
|
+
// The registered projects are what a list of paths may name; the graphs tool has no project listing of its own.
|
|
593
|
+
return { ...describe(graphVisibilityFor(config, access.subject)), registeredProjects: (config.projects ?? []).map(project => project.path) };
|
|
594
|
+
}
|
|
595
|
+
const requested = args.projects;
|
|
596
|
+
const registered = ((await loadConfig(this.directory)).projects ?? []).map(project => project.path);
|
|
597
|
+
const same = (a, b) => process.platform === 'win32' ? a.toLowerCase() === b.toLowerCase() : a === b;
|
|
598
|
+
const notRegistered = (path) => new AgentMcpError('PROJECT_NOT_REGISTERED', path + ' is not a project in the Andorra sidebar. Registered projects: ' + (registered.length ? registered.join(', ') : 'none') + '.');
|
|
599
|
+
const resolveProject = async (path, containing) => {
|
|
600
|
+
let real;
|
|
601
|
+
try {
|
|
602
|
+
real = await realpath(path);
|
|
603
|
+
}
|
|
604
|
+
catch {
|
|
605
|
+
real = path;
|
|
606
|
+
}
|
|
607
|
+
const exact = registered.find(project => same(project, real) || same(project, path));
|
|
608
|
+
if (exact)
|
|
609
|
+
return exact;
|
|
610
|
+
if (containing) {
|
|
611
|
+
// A task can run in a folder inside a project; it belongs to the closest registered project that holds it.
|
|
612
|
+
const holders = registered.filter(project => { const rel = relative(project, real); return rel !== '' && !rel.startsWith('..') && !isAbsolute(rel); });
|
|
613
|
+
const closest = holders.sort((a, b) => b.length - a.length)[0];
|
|
614
|
+
if (closest)
|
|
615
|
+
return closest;
|
|
616
|
+
}
|
|
617
|
+
throw notRegistered(path);
|
|
618
|
+
};
|
|
619
|
+
let projects;
|
|
620
|
+
if (requested === 'all')
|
|
621
|
+
projects = undefined;
|
|
622
|
+
else if (requested === 'this') {
|
|
623
|
+
const here = workspace ?? this.options.subagentWorkspace ?? process.cwd();
|
|
624
|
+
projects = [await resolveProject(here, true)];
|
|
625
|
+
}
|
|
626
|
+
else if (Array.isArray(requested) && requested.length > 0 && requested.every(path => typeof path === 'string' && path.trim() && !path.includes('\0'))) {
|
|
627
|
+
projects = [];
|
|
628
|
+
for (const path of requested)
|
|
629
|
+
projects.push(await resolveProject(path.trim(), false));
|
|
630
|
+
}
|
|
631
|
+
else
|
|
632
|
+
throw new AgentMcpError('INVALID_ARGUMENTS', 'projects must be "this", "all", or a non-empty list of registered project paths.');
|
|
633
|
+
beforeSave?.();
|
|
634
|
+
await this.assertGraphIdentity(access);
|
|
635
|
+
const visibility = await setGraphVisibility(this.directory, access.subject, id, projects);
|
|
636
|
+
return { ...describe(visibility), note: projects === undefined
|
|
637
|
+
? 'The graph is listed in every project.'
|
|
638
|
+
: 'The graph is listed only in ' + projects.join(', ') + '. Other projects no longer offer it in the graph picker.' };
|
|
639
|
+
}
|
|
640
|
+
async dispatch(name, args, beforeSave, workspace) {
|
|
560
641
|
if (name === 'andorra_graph_guide')
|
|
561
642
|
return { architecture: GRAPH_AGENT_GUIDE, resourceUri: 'andorra://graph/architecture' };
|
|
562
643
|
if (name === 'andorra_projects_list')
|
|
@@ -655,6 +736,9 @@ export class AgentMcpBackend {
|
|
|
655
736
|
return cancelled ? { cancelled: true } : { cancelled: false, note: 'No subagent run is active in this process.' };
|
|
656
737
|
}
|
|
657
738
|
const access = await this.graphAccess();
|
|
739
|
+
if (name === 'andorra_graph_visibility_get' || name === 'andorra_graph_visibility_set') {
|
|
740
|
+
return this.graphVisibility(name === 'andorra_graph_visibility_set', args, access, beforeSave, workspace);
|
|
741
|
+
}
|
|
658
742
|
if (name === 'andorra_graphs_list') {
|
|
659
743
|
if (args.includeDeleted !== undefined && typeof args.includeDeleted !== 'boolean')
|
|
660
744
|
throw new AgentMcpError('INVALID_ARGUMENTS', 'includeDeleted must be a boolean when supplied.');
|
|
@@ -695,6 +779,8 @@ export class AgentMcpBackend {
|
|
|
695
779
|
const latest = await this.readGraph(id, access.directory);
|
|
696
780
|
if (isDeletedGraph(latest))
|
|
697
781
|
throw new AgentMcpError('GRAPH_DELETED', 'Graph ' + id + ' is deleted. Restore it with andorra_graph_restore before editing it.');
|
|
782
|
+
if (access.free && (await readGraphQuota(access.directory, undefined, { adopt: true })).freeGraphId !== id)
|
|
783
|
+
throw new FreeTierLimitError(FREE_LOCKED_GRAPH_MESSAGE);
|
|
698
784
|
graph = migrateGraphForEditor(latest, { addOrchestrator: !access.free });
|
|
699
785
|
expectedRevision = graph.revision;
|
|
700
786
|
}
|
|
@@ -710,7 +796,7 @@ export class AgentMcpBackend {
|
|
|
710
796
|
if (error.code !== 'ENOENT')
|
|
711
797
|
throw error;
|
|
712
798
|
}
|
|
713
|
-
if (access.free && (await readGraphQuota(access.directory)).
|
|
799
|
+
if (access.free && (await readGraphQuota(access.directory, undefined, { adopt: true })).freeGraphId !== undefined)
|
|
714
800
|
throw new FreeTierLimitError(FREE_GRAPH_LIMIT_MESSAGE);
|
|
715
801
|
graph = { schemaVersion: 3, id, name: nameValue, revision: 0, entry: '', nodes: {}, edges: [] };
|
|
716
802
|
expectedRevision = null;
|
|
@@ -824,7 +910,7 @@ export class AgentMcpBackend {
|
|
|
824
910
|
throw new AgentMcpError('VALIDATION_FAILED', 'Graph exceeds 512 KiB after portable provider identities are recorded.');
|
|
825
911
|
beforeSave?.();
|
|
826
912
|
const saved = finalAccess.free ? await saveFreeTierGraph(stamped, draft.expectedRevision, access.directory)
|
|
827
|
-
: await
|
|
913
|
+
: await savePremiumGraph(stamped, draft.expectedRevision, access.directory);
|
|
828
914
|
await this.sync?.reviveGraph(saved.id);
|
|
829
915
|
draft.graph = saved;
|
|
830
916
|
draft.expectedRevision = saved.revision;
|
|
@@ -29,6 +29,20 @@ function sameNames(a, b) {
|
|
|
29
29
|
const keys = Object.keys(b);
|
|
30
30
|
return Object.keys(left).length === keys.length && keys.every(key => Object.hasOwn(left, key) && left[key] === b[key]);
|
|
31
31
|
}
|
|
32
|
+
function sameNumbers(a, b) {
|
|
33
|
+
const left = a ?? {};
|
|
34
|
+
const keys = Object.keys(b);
|
|
35
|
+
return Object.keys(left).length === keys.length && keys.every(key => Object.hasOwn(left, key) && left[key] === b[key]);
|
|
36
|
+
}
|
|
37
|
+
const UNSAFE_KEYS = ['__proto__', 'constructor', 'prototype'];
|
|
38
|
+
/** The sizes the answer states, by model id. */
|
|
39
|
+
function hostedParameters(answer) {
|
|
40
|
+
const sizes = {};
|
|
41
|
+
for (const model of answer.models)
|
|
42
|
+
if (model.parametersBillions !== undefined && !UNSAFE_KEYS.includes(model.id))
|
|
43
|
+
sizes[model.id] = model.parametersBillions;
|
|
44
|
+
return sizes;
|
|
45
|
+
}
|
|
32
46
|
// Line breaks and tabs become spaces; every other control, format or bidi character is dropped.
|
|
33
47
|
const SPACING = /[\t\n\v\f\r\u0085\u2028\u2029]/g;
|
|
34
48
|
const INVISIBLE = /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u180e\u200b-\u200f\u202a-\u202e\u2060-\u2064\u2066-\u206f\ufeff]/g;
|
|
@@ -61,7 +75,10 @@ export function applyAndorraEntry(config, answer, mode) {
|
|
|
61
75
|
for (const model of answer.models)
|
|
62
76
|
modelContextWindows[model.id] = model.contextWindow;
|
|
63
77
|
const modelNames = hostedNames(answer);
|
|
64
|
-
const
|
|
78
|
+
const modelParameters = hostedParameters(answer);
|
|
79
|
+
const freeModels = answer.models.filter(model => model.free === true).map(model => model.id);
|
|
80
|
+
const named = { ...(Object.keys(modelNames).length ? { modelNames } : {}),
|
|
81
|
+
...(Object.keys(modelParameters).length ? { modelParameters } : {}), ...(freeModels.length ? { freeModels } : {}) };
|
|
65
82
|
const index = config.providers.findIndex(provider => provider.type === 'andorra');
|
|
66
83
|
if (index < 0) {
|
|
67
84
|
if (mode !== 'create')
|
|
@@ -73,9 +90,10 @@ export function applyAndorraEntry(config, answer, mode) {
|
|
|
73
90
|
const existing = config.providers[index];
|
|
74
91
|
const model = models.includes(existing.model) ? existing.model : models[0];
|
|
75
92
|
if (model === existing.model && sameList(existing.models, models) && sameWindows(existing.modelContextWindows, modelContextWindows)
|
|
76
|
-
&& sameNames(existing.modelNames, modelNames))
|
|
93
|
+
&& sameNames(existing.modelNames, modelNames) && sameNumbers(existing.modelParameters, modelParameters)
|
|
94
|
+
&& sameList(existing.freeModels ?? [], freeModels))
|
|
77
95
|
return undefined;
|
|
78
|
-
const { modelNames: _previous, ...rest } = existing;
|
|
96
|
+
const { modelNames: _previous, modelParameters: _sizes, freeModels: _free, ...rest } = existing;
|
|
79
97
|
const refreshed = { ...rest, model, models, modelContextWindows, ...named };
|
|
80
98
|
if (refreshed.contextWindow !== undefined)
|
|
81
99
|
applyModelContextWindow(refreshed, model);
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
/** `parametersBillions`: the model's size, where the router states one. `free`: served past the weekly allowance. */
|
|
1
2
|
export interface HostedModel {
|
|
2
3
|
id: string;
|
|
3
4
|
name: string;
|
|
4
5
|
contextWindow: number;
|
|
6
|
+
parametersBillions?: number;
|
|
7
|
+
free?: boolean;
|
|
5
8
|
}
|
|
6
9
|
/** How much of the account's weekly allowance is used (0-100) and when it renews (ISO timestamp). */
|
|
7
10
|
export interface HostedAllowance {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isModelParameters } from '../providers.js';
|
|
1
2
|
import { ANDORRA_PROVIDER_BASE_URL, ANDORRA_SIGN_IN_MESSAGE, ANDORRA_UNAVAILABLE_MESSAGE, andorraAccessToken, andorraBaseUrl } from './endpoint.js';
|
|
2
3
|
export const HOSTED_CHECK_TIMEOUT_MS = 5_000;
|
|
3
4
|
const HOSTED_BODY_LIMIT = 64 * 1024;
|
|
@@ -20,7 +21,10 @@ export function parseHostedAnswer(value) {
|
|
|
20
21
|
if (typeof item.contextWindow !== 'number' || !Number.isSafeInteger(item.contextWindow) || item.contextWindow <= 0)
|
|
21
22
|
return undefined;
|
|
22
23
|
const name = typeof item.name === 'string' && item.name ? item.name : item.id;
|
|
23
|
-
|
|
24
|
+
// Both are optional and descriptive: a malformed one is dropped on its own and never fails the answer.
|
|
25
|
+
models.push({ id: item.id, name, contextWindow: item.contextWindow,
|
|
26
|
+
...(isModelParameters(item.parametersBillions) ? { parametersBillions: item.parametersBillions } : {}),
|
|
27
|
+
...(item.free === true ? { free: true } : {}) });
|
|
24
28
|
}
|
|
25
29
|
const answer = { enabled: true, promotionId: body.promotionId, models };
|
|
26
30
|
const allowance = parseAllowance(body.allowance);
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The ways the announcement is worded; one is picked at random each time it is shown. Each is one short
|
|
3
|
+
* sentence or two that fits the terminal's bubble on a narrow window, and none names a model.
|
|
4
|
+
*/
|
|
5
|
+
export declare const ANDORRA_ANNOUNCEMENTS: readonly ["New Andorra model is available.", "A new Andorra model just landed.", "Fresh Andorra model, still warm.", "Psst. Andorra has a new model.", "A new Andorra model has entered the chat.", "New Andorra model. No assembly required.", "New Andorra model. Your backlog looks nervous.", "A new Andorra model is eager to meet your bugs.", "New Andorra model. It already read the docs.", "New Andorra model. No opinion on tabs or spaces."];
|
|
6
|
+
/** One of the announcement's wordings, picked with `random` (a number in [0, 1), as Math.random gives). */
|
|
7
|
+
export declare function andorraAnnouncement(random?: () => number): string;
|
|
2
8
|
/** The second line of the announcement while Andorra is listed but not used yet: where to choose it. */
|
|
3
9
|
export declare const ANDORRA_ADD_HINT = "Choose Andorra in /model to use it.";
|
|
4
10
|
/** Said when the model the user picked is not served by the entry that was just saved (the offer changed meanwhile). */
|
|
5
11
|
export declare const ANDORRA_MODEL_GONE = "That model is no longer available.";
|
|
12
|
+
/** The last line of the bubble, in two parts so the terminal can draw the tail as part of the box. */
|
|
13
|
+
export declare const ANDORRA_BUBBLE_TAIL = " \u2570 ";
|
|
14
|
+
export declare const ANDORRA_BUBBLE_SPEAKER = "Andorra";
|
|
6
15
|
/** Short lines of text in a rounded box with a tail naming Andorra as the speaker. */
|
|
7
16
|
export declare function speechBubble(...lines: string[]): string;
|
|
@@ -1,8 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The ways the announcement is worded; one is picked at random each time it is shown. Each is one short
|
|
3
|
+
* sentence or two that fits the terminal's bubble on a narrow window, and none names a model.
|
|
4
|
+
*/
|
|
5
|
+
export const ANDORRA_ANNOUNCEMENTS = [
|
|
6
|
+
'New Andorra model is available.',
|
|
7
|
+
'A new Andorra model just landed.',
|
|
8
|
+
'Fresh Andorra model, still warm.',
|
|
9
|
+
'Psst. Andorra has a new model.',
|
|
10
|
+
'A new Andorra model has entered the chat.',
|
|
11
|
+
'New Andorra model. No assembly required.',
|
|
12
|
+
'New Andorra model. Your backlog looks nervous.',
|
|
13
|
+
'A new Andorra model is eager to meet your bugs.',
|
|
14
|
+
'New Andorra model. It already read the docs.',
|
|
15
|
+
'New Andorra model. No opinion on tabs or spaces.',
|
|
16
|
+
];
|
|
17
|
+
/** One of the announcement's wordings, picked with `random` (a number in [0, 1), as Math.random gives). */
|
|
18
|
+
export function andorraAnnouncement(random = Math.random) {
|
|
19
|
+
const index = Math.floor(random() * ANDORRA_ANNOUNCEMENTS.length);
|
|
20
|
+
return ANDORRA_ANNOUNCEMENTS[Math.min(ANDORRA_ANNOUNCEMENTS.length - 1, Math.max(0, index))];
|
|
21
|
+
}
|
|
2
22
|
/** The second line of the announcement while Andorra is listed but not used yet: where to choose it. */
|
|
3
23
|
export const ANDORRA_ADD_HINT = 'Choose Andorra in /model to use it.';
|
|
4
24
|
/** Said when the model the user picked is not served by the entry that was just saved (the offer changed meanwhile). */
|
|
5
25
|
export const ANDORRA_MODEL_GONE = 'That model is no longer available.';
|
|
26
|
+
/** The last line of the bubble, in two parts so the terminal can draw the tail as part of the box. */
|
|
27
|
+
export const ANDORRA_BUBBLE_TAIL = ' ╰ ';
|
|
28
|
+
export const ANDORRA_BUBBLE_SPEAKER = 'Andorra';
|
|
6
29
|
/** Short lines of text in a rounded box with a tail naming Andorra as the speaker. */
|
|
7
30
|
export function speechBubble(...lines) {
|
|
8
31
|
const width = Math.max(...lines.map(line => [...line].length));
|
|
@@ -10,6 +33,6 @@ export function speechBubble(...lines) {
|
|
|
10
33
|
`╭${'─'.repeat(width + 2)}╮`,
|
|
11
34
|
...lines.map(line => `│ ${line}${' '.repeat(width - [...line].length)} │`),
|
|
12
35
|
`╰─╮${'─'.repeat(width)}╯`,
|
|
13
|
-
|
|
36
|
+
ANDORRA_BUBBLE_TAIL + ANDORRA_BUBBLE_SPEAKER,
|
|
14
37
|
].join('\n');
|
|
15
38
|
}
|
|
@@ -60,6 +60,8 @@ export interface TerminalAndorraOptions {
|
|
|
60
60
|
check?: HostedMonitorOptions['check'];
|
|
61
61
|
now?: HostedMonitorOptions['now'];
|
|
62
62
|
timers?: HostedMonitorOptions['timers'];
|
|
63
|
+
/** Picks the announcement's wording; Math.random when omitted. */
|
|
64
|
+
random?: () => number;
|
|
63
65
|
}
|
|
64
66
|
/** The terminal app's Andorra monitor and the hooks its screens use. */
|
|
65
67
|
export declare function createTerminalAndorra(options: TerminalAndorraOptions): {
|
|
@@ -2,7 +2,7 @@ import { changeConfigFile, loadConfig, reconcileSubagentPair } from '../config.j
|
|
|
2
2
|
import { ANDORRA_CHANGED_MESSAGE } from './endpoint.js';
|
|
3
3
|
import { fallbackProviderId, hasAndorraEntry, virtualAndorraEntry } from './entry.js';
|
|
4
4
|
import { HostedMonitor } from './monitor.js';
|
|
5
|
-
import { ANDORRA_ADD_HINT,
|
|
5
|
+
import { ANDORRA_ADD_HINT, andorraAnnouncement, 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. */
|
|
@@ -87,7 +87,7 @@ export function createTerminalAndorra(options) {
|
|
|
87
87
|
},
|
|
88
88
|
hasEntry: () => hasAndorraEntry(config),
|
|
89
89
|
// The hint says where to choose it, while it is listed and not yet used.
|
|
90
|
-
onAnnounce: () => options.print(monitor.listed() ? speechBubble(
|
|
90
|
+
onAnnounce: () => { const line = andorraAnnouncement(options.random); options.print(monitor.listed() ? speechBubble(line, ANDORRA_ADD_HINT) : speechBubble(line)); },
|
|
91
91
|
onNotice: () => options.print(ANDORRA_CHANGED_MESSAGE),
|
|
92
92
|
onChange: () => options.refreshStatus(),
|
|
93
93
|
onSettled: () => { for (const listener of [...listeners]) {
|
|
@@ -1,5 +1,5 @@
|
|
|
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.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.steer", "run.overrideAllNodes", "run.setModel", "run.setModel.node", "run.setPermissions", "run.start.continueSession", "run.start.entryHistory", "remote.owner.projects", "remote.workspaces.probe", "remote.engine.relay", "remote.hosting.device.grant", "extensions.manage", "extensions.resources", "skills.invoke", "mcp.manage", "mcp.edit", "mcp.status", "runs.files", "sessions.files", "account.profile", "sessions.stats", "sessions.usage", "config.analytics", "config.analytics.planGate", "sessions.trajectory", "config.externalSubagent", "config.codeIntel", "config.decisions", "browser.view", "attachments.read", "config.general", "sessions.pullRequest", "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"];
|
|
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.workspaces.probe", "remote.engine.relay", "remote.hosting.device.grant", "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"];
|
|
3
3
|
export interface AppServerRequest {
|
|
4
4
|
id: number | string;
|
|
5
5
|
method: string;
|
|
@@ -67,7 +67,7 @@ export interface AppServerProviderAuth {
|
|
|
67
67
|
}
|
|
68
68
|
export interface AppServerProvider {
|
|
69
69
|
id: string;
|
|
70
|
-
type: 'openai-compatible' | 'anthropic' | 'codex' | 'claude' | 'opencode-go' | 'grok' | 'opencode' | 'andorra';
|
|
70
|
+
type: 'openai-compatible' | 'anthropic' | 'codex' | 'claude' | 'opencode-go' | 'grok' | 'opencode' | 'google' | 'andorra';
|
|
71
71
|
baseUrl: string;
|
|
72
72
|
model: string;
|
|
73
73
|
apiKeyEnv?: string;
|
|
@@ -75,6 +75,10 @@ export interface AppServerProvider {
|
|
|
75
75
|
modelContextWindows?: Record<string, number>;
|
|
76
76
|
/** Andorra only: model id -> the router's display name. Labels only; ids stay the identity. */
|
|
77
77
|
modelNames?: Record<string, string>;
|
|
78
|
+
/** Andorra only: model id -> its size in billions of parameters, where the router states one. */
|
|
79
|
+
modelParameters?: Record<string, number>;
|
|
80
|
+
/** Andorra only: the model ids served free of the weekly allowance. */
|
|
81
|
+
freeModels?: string[];
|
|
78
82
|
hasApiKey: boolean;
|
|
79
83
|
apiKeyRevision?: string;
|
|
80
84
|
contextWindow?: number;
|
|
@@ -234,6 +238,7 @@ export interface AppServerUsageAnalytics {
|
|
|
234
238
|
unreadable: number;
|
|
235
239
|
};
|
|
236
240
|
filesScanned: number;
|
|
241
|
+
/** 1 is the rolling last 24 hours, whose `days` rows are UTC hours keyed "YYYY-MM-DDTHH"; otherwise UTC dates. */
|
|
237
242
|
windowDays: number;
|
|
238
243
|
}
|
|
239
244
|
export interface AppServerFileDiffLine {
|
|
@@ -346,11 +351,13 @@ export interface AppServerRunSummary {
|
|
|
346
351
|
task?: string;
|
|
347
352
|
sessionId?: string;
|
|
348
353
|
}
|
|
354
|
+
/** `locked` marks a graph a free account can view, export and duplicate but not change or run. */
|
|
349
355
|
export interface AppServerGraphSummary {
|
|
350
356
|
id: string;
|
|
351
357
|
name: string;
|
|
352
358
|
revision: number;
|
|
353
359
|
preset: boolean;
|
|
360
|
+
locked?: boolean;
|
|
354
361
|
updatedAt?: string;
|
|
355
362
|
}
|
|
356
363
|
export interface AppServerTreeEntry {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const APP_SERVER_PROTOCOL_VERSION = 2;
|
|
2
|
-
export const APP_SERVER_CAPABILITIES = ['run.start.runPermissions', 'automations', 'providers.models', 'providers.test', 'providers.test.model', 'providers.streamIdleTimeout', 'providers.modelContextWindows', 'providers.name', 'providers.claude', 'providers.claudeAuth', 'providers.grok', '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.steer', 'run.overrideAllNodes', 'run.setModel', 'run.setModel.node', 'run.setPermissions', 'run.start.continueSession', 'run.start.entryHistory', 'remote.owner.projects', 'remote.workspaces.probe', 'remote.engine.relay', 'remote.hosting.device.grant', 'extensions.manage', 'extensions.resources', 'skills.invoke', 'mcp.manage', 'mcp.edit', 'mcp.status', 'runs.files', 'sessions.files', 'account.profile', 'sessions.stats', 'sessions.usage', 'config.analytics', 'config.analytics.planGate', 'sessions.trajectory', 'config.externalSubagent', 'config.codeIntel', 'config.decisions', 'browser.view', 'attachments.read', 'config.general', 'sessions.pullRequest', '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'];
|
|
2
|
+
export const APP_SERVER_CAPABILITIES = ['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.workspaces.probe', 'remote.engine.relay', 'remote.hosting.device.grant', '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'];
|
|
@@ -47,6 +47,7 @@ export declare function readRun(directory: string, id: unknown): Promise<{
|
|
|
47
47
|
result: unknown;
|
|
48
48
|
events: unknown[];
|
|
49
49
|
truncated: boolean;
|
|
50
|
+
outline?: unknown[];
|
|
50
51
|
}>;
|
|
51
52
|
export declare function runRecordFile(directory: string, id: unknown): Promise<{
|
|
52
53
|
path: string;
|