@andorra-labs/code 0.1.8 → 0.1.9
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/THIRD_PARTY_NOTICES.md +2 -1
- package/dist/src/account-presentation.d.ts +11 -0
- package/dist/src/account-presentation.js +29 -2
- package/dist/src/agent-execution.js +37 -4
- package/dist/src/agent-mcp.d.ts +12 -0
- package/dist/src/agent-mcp.js +81 -2
- package/dist/src/app-server/protocol.d.ts +12 -0
- package/dist/src/app-server/reasoning.d.ts +0 -8
- package/dist/src/app-server/reasoning.js +15 -28
- package/dist/src/app-server.d.ts +7 -0
- package/dist/src/app-server.js +59 -11
- package/dist/src/auth/AuthManager.d.ts +15 -0
- package/dist/src/auth/AuthManager.js +66 -7
- package/dist/src/browser-runner.js +1 -2
- package/dist/src/browser-server.js +10 -2
- package/dist/src/browser-session.js +6 -2
- package/dist/src/browser-stealth.d.ts +29 -0
- package/dist/src/browser-stealth.js +166 -0
- package/dist/src/browser-ui/app.js +108 -13
- package/dist/src/browser-ui/icons/chevron-right.svg +8 -0
- package/dist/src/browser-ui/index.html +8 -8
- package/dist/src/browser-ui/style.css +199 -171
- package/dist/src/browser-ui/tokens.css +198 -0
- package/dist/src/browser-view.d.ts +57 -9
- package/dist/src/browser-view.js +187 -36
- package/dist/src/cli.js +21 -4
- package/dist/src/coding-tools.js +9 -5
- package/dist/src/command-screens.js +4 -4
- package/dist/src/commands.d.ts +1 -1
- package/dist/src/commands.js +2 -1
- package/dist/src/completion-gates.d.ts +35 -0
- package/dist/src/completion-gates.js +25 -0
- package/dist/src/completion.d.ts +6 -0
- package/dist/src/completion.js +36 -3
- package/dist/src/config.d.ts +1 -1
- package/dist/src/config.js +2 -2
- package/dist/src/context-budget.d.ts +11 -0
- package/dist/src/context-budget.js +13 -0
- package/dist/src/decision/DecisionEngine.d.ts +5 -1
- package/dist/src/decision/DecisionManager.d.ts +1 -0
- package/dist/src/decision/DecisionManager.js +14 -3
- package/dist/src/decision/FactContinuations.d.ts +6 -0
- package/dist/src/decision/FactContinuations.js +9 -1
- package/dist/src/decision/FactServiceGate.js +1 -1
- package/dist/src/decision/hostedSkills.d.ts +37 -0
- package/dist/src/decision/hostedSkills.js +64 -0
- package/dist/src/decision/providers/AndorraDecisionProvider.d.ts +10 -2
- package/dist/src/decision/providers/AndorraDecisionProvider.js +121 -10
- package/dist/src/default-graph.d.ts +11 -0
- package/dist/src/default-graph.js +20 -0
- package/dist/src/duration.d.ts +13 -2
- package/dist/src/duration.js +27 -3
- package/dist/src/graph-manager-chat.d.ts +302 -0
- package/dist/src/graph-manager-chat.js +940 -0
- package/dist/src/graph-runner.js +6 -0
- package/dist/src/graph-server.d.ts +9 -0
- package/dist/src/graph-server.js +167 -16
- package/dist/src/graph-studio-features.js +2 -2
- package/dist/src/graph-sync.js +5 -2
- package/dist/src/graph-ui/app.js +252 -71
- package/dist/src/graph-ui/controls.css +55 -32
- package/dist/src/graph-ui/controls.js +85 -9
- package/dist/src/graph-ui/edge-router.js +114 -13
- package/dist/src/graph-ui/embed.js +23 -8
- package/dist/src/graph-ui/index.html +3 -3
- package/dist/src/graph-ui/library.css +4 -10
- package/dist/src/graph-ui/manager-markdown.js +155 -0
- package/dist/src/graph-ui/manager-state.js +191 -0
- package/dist/src/graph-ui/manager.css +161 -0
- package/dist/src/graph-ui/manager.js +700 -0
- package/dist/src/graph-ui/studio-canvas.js +2 -0
- package/dist/src/graph-ui/studio.css +24 -23
- package/dist/src/graph-ui/studio.js +29 -8
- package/dist/src/graph-ui/style.css +125 -92
- package/dist/src/graph-ui/tokens.css +217 -151
- package/dist/src/graphs.d.ts +69 -1
- package/dist/src/graphs.js +160 -7
- package/dist/src/hardened-runtime.js +8 -2
- package/dist/src/membership-errors.d.ts +14 -0
- package/dist/src/membership-errors.js +24 -1
- package/dist/src/membership.d.ts +20 -0
- package/dist/src/membership.js +45 -16
- package/dist/src/palette.d.ts +25 -8
- package/dist/src/palette.js +26 -8
- package/dist/src/provider-engine.d.ts +4 -4
- package/dist/src/provider-engine.js +39 -22
- package/dist/src/providers.d.ts +24 -0
- package/dist/src/providers.js +47 -2
- package/dist/src/qa/guidance.d.ts +26 -0
- package/dist/src/qa/guidance.js +59 -0
- package/dist/src/qa/index.d.ts +1 -6
- package/dist/src/qa/index.js +1 -14
- package/dist/src/qa/runtime/ProcessManager.d.ts +20 -2
- package/dist/src/qa/runtime/ProcessManager.js +69 -13
- package/dist/src/react-runtime.d.ts +11 -0
- package/dist/src/react-runtime.js +190 -51
- package/dist/src/remote/engine-pool.js +4 -1
- package/dist/src/run-progress.d.ts +6 -0
- package/dist/src/run-progress.js +7 -0
- package/dist/src/runtime.d.ts +8 -0
- package/dist/src/session-skills.d.ts +75 -0
- package/dist/src/session-skills.js +151 -0
- package/dist/src/side-panel.d.ts +1 -1
- package/dist/src/side-panel.js +6 -12
- package/dist/src/skill-commands.js +1 -1
- package/dist/src/skills/bundled/control-browser/SKILL.md +9 -1
- package/dist/src/skills/bundled/graph-manager/SKILL.md +8 -0
- package/dist/src/skills/bundled/provenance.json +3 -3
- package/dist/src/skills/bundled/web-gui-tester/SKILL.md +1 -1
- package/dist/src/stall-recovery.d.ts +22 -0
- package/dist/src/stall-recovery.js +71 -0
- package/dist/src/subagent-run.js +1 -2
- package/dist/src/terminal-ui.d.ts +2 -2
- package/dist/src/terminal-ui.js +18 -13
- package/dist/src/transcript.js +9 -1
- package/dist/src/types.d.ts +18 -4
- package/dist/src/usage-analytics.d.ts +7 -0
- package/dist/src/usage-analytics.js +55 -15
- package/docs/concepts/README.md +1 -1
- package/docs/concepts/limits.md +9 -0
- package/docs/guides/desktop-app.md +1 -1
- package/docs/guides/graph-builder.md +16 -1
- package/docs/reference/slash-commands.md +2 -1
- package/docs/superpowers/plans/2026-11-13-graph-manager-chat.md +203 -0
- package/docs/superpowers/plans/2026-11-14-jev-fair-use-pricing.md +79 -0
- package/docs/superpowers/specs/2026-11-13-graph-manager-chat-design.md +182 -0
- package/docs/superpowers/specs/2026-11-14-jev-fair-use-pricing-design.md +156 -0
- package/package.json +1 -1
- package/tests/chat-side-panel-test-plan.md +1 -1
package/dist/src/graphs.js
CHANGED
|
@@ -5,6 +5,7 @@ import { configDirectory } from './config.js';
|
|
|
5
5
|
import { acquireSaveLock, archiveUnpublishedSnapshot, removeLockedFolder, SaveLockBusyError } from './save-lock.js';
|
|
6
6
|
import { validateMappingConstants, validateMappings, validateSchema, validateValue, schemaAt, nodeOutputSchema } from './handoffs.js';
|
|
7
7
|
import { CANONICAL_CODING_TOOLS, canonicalToolName, canonicalizeToolList, toolNameMatches } from './tool-names.js';
|
|
8
|
+
import { DEFAULT_AGENT_GRAPH } from './default-graph.js';
|
|
8
9
|
export const GRAPH_TOOLS = [...CANONICAL_CODING_TOOLS, 'NativeExec', 'AsyncProcess', 'PowerShellFast', 'ShellMetrics', 'read_file', 'list_files', 'search_files', 'write_file', 'edit_file', 'read', 'write', 'edit', 'find', 'grep', 'ls', 'powershell', 'bash', 'shell', 'git_read', 'read_artifact', 'write_artifact', 'repo_explore', 'memory_search', 'set_timer', 'pull_request', 'graphs', 'qa.inspect_project', 'qa.status', 'qa.fast', 'qa.deep', 'qa.test', 'qa.terminal', 'qa.security', 'qa.browser', 'qa.browser_session', 'browser.solve_captcha', 'web_search', 'read_skill_resource', 'browser.panel', 'browser.incognito'];
|
|
9
10
|
/** QA tool names are an explicit allowlist; gating keys off membership, never a name prefix. */
|
|
10
11
|
export const QA_TOOL_NAMES = ['qa.inspect_project', 'qa.status', 'qa.fast', 'qa.deep', 'qa.test', 'qa.terminal', 'qa.security', 'qa.browser'];
|
|
@@ -87,10 +88,60 @@ export const DEFAULT_HARNESS_REVISION_5 = {
|
|
|
87
88
|
* tasks alongside coding. The agent still receives the confirmed task instruction through the same
|
|
88
89
|
* intake handoff, and topology, capabilities and tooling are exactly revision 5's, so the change is
|
|
89
90
|
* presentation and instruction only.
|
|
91
|
+
*
|
|
92
|
+
* Revision 6 is frozen and is no longer the latest `default`: it is the body of the paid Andorra
|
|
93
|
+
* preset (`getAndorraHarness`), the Orchestrator -> Andorra Agent -> Done workflow. The graph a
|
|
94
|
+
* Default run executes is {@link DEFAULT_GRAPH}.
|
|
90
95
|
*/
|
|
91
96
|
export const DEFAULT_HARNESS = { ...structuredClone(DEFAULT_HARNESS_REVISION_5), name: 'Andorra Agent', revision: 6 };
|
|
92
97
|
DEFAULT_HARNESS.nodes.engineer.name = 'Andorra Agent';
|
|
93
98
|
DEFAULT_HARNESS.nodes.engineer.instruction = 'Carry out the confirmed task instruction completely, whether it is a coding task or a general one: implement code and verify changes with appropriate tools, and answer general research, writing and analysis directly. Use the supplied requirements, acceptance criteria, design considerations and repository findings to guide the work. Verify the result and report remaining issues.';
|
|
99
|
+
/**
|
|
100
|
+
* Revision 7, the latest `default`: one Andorra Agent and no Orchestrator intake.
|
|
101
|
+
*
|
|
102
|
+
* Selecting Default runs a single agent that cannot delegate (`SOFTWARE_ENGINEER_HARNESS`, built from
|
|
103
|
+
* the same {@link DEFAULT_AGENT_GRAPH} as this revision), while revision 6 put an Orchestrator in front of it. Graph
|
|
104
|
+
* Studio and the graph tools read `default` from here, so they showed a workflow that Default never
|
|
105
|
+
* ran. This revision describes what Default runs; revision 6 remains loadable as history and as the
|
|
106
|
+
* Andorra preset. It is schema version 3 so the editor's migration leaves it as one agent rather than
|
|
107
|
+
* adding an Orchestrator in front of it.
|
|
108
|
+
*/
|
|
109
|
+
export const DEFAULT_GRAPH = {
|
|
110
|
+
schemaVersion: 3, id: 'default', name: DEFAULT_AGENT_GRAPH.name, revision: 7, entry: DEFAULT_AGENT_GRAPH.entry,
|
|
111
|
+
nodes: structuredClone(DEFAULT_AGENT_GRAPH.nodes), edges: structuredClone(DEFAULT_AGENT_GRAPH.edges),
|
|
112
|
+
};
|
|
113
|
+
/** The id of the bundled Graph Manager graph. Reserved: no saved, synced or deleted graph may use it. */
|
|
114
|
+
export const GRAPH_MANAGER_GRAPH_ID = 'andorra-graph-manager';
|
|
115
|
+
/**
|
|
116
|
+
* The graph Graph Studio's Graph Manager chat runs: one top-level agent and no Orchestrator intake.
|
|
117
|
+
*
|
|
118
|
+
* It is built in rather than saved so every installation has it and no account can edit it, and it
|
|
119
|
+
* is hidden from graph lists because it is not a workflow a user selects for a task. The agent
|
|
120
|
+
* sets neither `capabilities` nor `tools`, exactly as the default graph's execution agent: the
|
|
121
|
+
* defaults allow the shell, which is what grants the `graphs` tool, and filesystem reads, which
|
|
122
|
+
* grant `read_skill_resource`. A delegated subagent never receives `graphs`, so the work stays on
|
|
123
|
+
* this node. Only an Orchestrator is given `ask_user`, so the agent asks in its reply and the user's
|
|
124
|
+
* next message is the answer; the node keeps session history so that message sees the question.
|
|
125
|
+
*/
|
|
126
|
+
export const GRAPH_MANAGER_HARNESS = {
|
|
127
|
+
schemaVersion: 3, id: GRAPH_MANAGER_GRAPH_ID, name: 'Graph Manager', revision: 1, entry: 'manager',
|
|
128
|
+
nodes: {
|
|
129
|
+
manager: { id: 'manager', name: 'Graph Manager', type: 'agent', executor: 'react-basic', instruction: 'You are Graph Manager inside Graph Studio. Before acting, load the bundled skill andorra:graph-manager with read_skill_resource and follow it. Work only through the graphs tool; never write graph files. Reply to the user in the conversation; when a choice is theirs, ask in your reply and wait for their next message.', contextPolicy: { history: true }, position: { x: 120, y: 120 } },
|
|
130
|
+
done: { id: 'done', name: 'Done', type: 'end', position: { x: 440, y: 120 } },
|
|
131
|
+
}, edges: [{ id: 'manager-done', source: 'manager', target: 'done', outcome: 'completed' }],
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* The configured MCP servers a run of this graph connects at its start.
|
|
135
|
+
*
|
|
136
|
+
* Graph Manager works only through the `graphs` tool and its bundled skill, and its chat runs
|
|
137
|
+
* under Ask for approval, where every server raises a connection prompt before the first reply:
|
|
138
|
+
* its run connects none. Every other graph connects what the user configured.
|
|
139
|
+
*/
|
|
140
|
+
export function graphMcpServers(graphId, servers) {
|
|
141
|
+
return graphId === GRAPH_MANAGER_GRAPH_ID ? {} : servers;
|
|
142
|
+
}
|
|
143
|
+
/** The refusal every path that would write, delete or tombstone the reserved id answers with. */
|
|
144
|
+
export const reservedGraphId = (id) => new Error(`Graph id ${id} is reserved for a built-in graph`);
|
|
94
145
|
/** Upgrade only in-memory copies. Stored snapshots remain unchanged. */
|
|
95
146
|
/**
|
|
96
147
|
* `addOrchestrator: false` upgrades a legacy graph without an Orchestrator to the current schema as it
|
|
@@ -209,7 +260,14 @@ export function delegatesWriting(node) {
|
|
|
209
260
|
return node.type === 'agent' && node.agentRole === 'orchestrator' && node.subagents?.enabled === true && node.maxSubagents !== 0
|
|
210
261
|
&& (node.subagents.roles ?? []).some(isWritingRole);
|
|
211
262
|
}
|
|
212
|
-
|
|
263
|
+
/**
|
|
264
|
+
* The shell setting alone decides whether a node runs commands. Filesystem and Git settings govern
|
|
265
|
+
* their own structured tools (Write/Edit, git writes) and do not take the shell away: a reviewer set
|
|
266
|
+
* to read files but allowed a shell needs `gh pr diff`, and withholding the shell silently left it
|
|
267
|
+
* with instructions it could not follow (run 8a245b0f). Commands still go through the run's approval
|
|
268
|
+
* rules. Ordinary delegated children never run commands; only a delegated-worktree child does.
|
|
269
|
+
*/
|
|
270
|
+
const canRunCommands = (policy, child) => child !== true && policy.shell === 'allowed';
|
|
213
271
|
export function permitsBuiltInTool(node, name, child = false) {
|
|
214
272
|
if (node.tools !== undefined && !node.tools.some(configured => toolNameMatches(configured, name)))
|
|
215
273
|
return false;
|
|
@@ -431,6 +489,88 @@ function toolsValid(value, label) {
|
|
|
431
489
|
fail(`${label}: tools must be unique supported tool names`);
|
|
432
490
|
}
|
|
433
491
|
export function validateGraph(value, options = {}) { return validateGraphInternal(value, options); }
|
|
492
|
+
/**
|
|
493
|
+
* The agent nodes a run can reach after this node, nearest first, without the node itself.
|
|
494
|
+
*
|
|
495
|
+
* Every outgoing edge counts whatever its outcome, so the list is what may run after the node,
|
|
496
|
+
* not what will: a node told what later nodes exist leaves their work to them rather than doing
|
|
497
|
+
* it early. A node a loop leads back to is still excluded, because it is this node.
|
|
498
|
+
*/
|
|
499
|
+
export function laterAgentNodes(graph, nodeId) {
|
|
500
|
+
const seen = new Set([nodeId]);
|
|
501
|
+
const later = [];
|
|
502
|
+
const queue = [nodeId];
|
|
503
|
+
for (let index = 0; index < queue.length; index += 1) {
|
|
504
|
+
for (const edge of graph.edges ?? []) {
|
|
505
|
+
if (edge.source !== queue[index] || seen.has(edge.target))
|
|
506
|
+
continue;
|
|
507
|
+
seen.add(edge.target);
|
|
508
|
+
queue.push(edge.target);
|
|
509
|
+
const node = graph.nodes[edge.target];
|
|
510
|
+
if (node?.type === 'agent')
|
|
511
|
+
later.push(node);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
return later;
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Whether a node's name says it tests the change: "QA Tester", "Test runner", "Verifier".
|
|
518
|
+
*
|
|
519
|
+
* Graphs declare no testing role, so the name is the evidence a graph author gives; a name that
|
|
520
|
+
* does not say so is treated as not testing, which leaves the node's predecessors told to verify
|
|
521
|
+
* their own work as before.
|
|
522
|
+
*/
|
|
523
|
+
export function isTestingNode(node) {
|
|
524
|
+
return /\b(?:qa|tests?|tester|testing|verif(?:y|ier|ication))\b/i.test(node.name ?? '');
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* The testing node this node's work is sure to pass through: every outcome the node can complete
|
|
528
|
+
* with routes, along every path, through a testing node before the run can end. Absent when any
|
|
529
|
+
* route can finish untested — a delegating Orchestrator's `delivered` edge straight to Done, an
|
|
530
|
+
* outcome no edge handles (this node's or any node's on the way), or a branch that reaches an end
|
|
531
|
+
* first — because a node told to leave
|
|
532
|
+
* the running app to a tester must not be one whose work can ship without that tester.
|
|
533
|
+
*
|
|
534
|
+
* A path that leads back to the node itself is not an escape: the node runs again and its own
|
|
535
|
+
* routes are the ones being checked.
|
|
536
|
+
*/
|
|
537
|
+
export function testerOnEveryRoute(graph, nodeId) {
|
|
538
|
+
const node = graph.nodes[nodeId];
|
|
539
|
+
if (node === undefined)
|
|
540
|
+
return undefined;
|
|
541
|
+
// The targets of each outcome a node declares, the way the runner routes them: an edge with no
|
|
542
|
+
// outcome is the `completed` route. A declared outcome with no edge is an empty route, which ends
|
|
543
|
+
// the run there (a graph saved with `requireRoutes: false` may leave one unconnected).
|
|
544
|
+
const routes = (id, of) => nodeOutcomes(of).map(outcome => (graph.edges ?? []).filter(edge => edge.source === id && (edge.outcome ?? 'completed') === outcome).map(edge => edge.target));
|
|
545
|
+
const seen = new Set([nodeId]);
|
|
546
|
+
const stack = [];
|
|
547
|
+
for (const targets of routes(nodeId, node)) {
|
|
548
|
+
if (targets.length === 0)
|
|
549
|
+
return undefined;
|
|
550
|
+
stack.push(...targets);
|
|
551
|
+
}
|
|
552
|
+
let tester;
|
|
553
|
+
while (stack.length > 0) {
|
|
554
|
+
const id = stack.pop();
|
|
555
|
+
if (seen.has(id))
|
|
556
|
+
continue;
|
|
557
|
+
seen.add(id);
|
|
558
|
+
const next = graph.nodes[id];
|
|
559
|
+
if (next === undefined || next.type === 'end')
|
|
560
|
+
return undefined;
|
|
561
|
+
if (next.type === 'agent' && isTestingNode(next)) {
|
|
562
|
+
tester ??= next.name;
|
|
563
|
+
continue;
|
|
564
|
+
}
|
|
565
|
+
// Every outcome of a node on the way counts, not only the ones the graph happened to connect.
|
|
566
|
+
const nextRoutes = routes(id, next);
|
|
567
|
+
if (nextRoutes.length === 0 || nextRoutes.some(targets => targets.length === 0))
|
|
568
|
+
return undefined;
|
|
569
|
+
for (const targets of nextRoutes)
|
|
570
|
+
stack.push(...targets);
|
|
571
|
+
}
|
|
572
|
+
return tester;
|
|
573
|
+
}
|
|
434
574
|
/**
|
|
435
575
|
* Whether a run of this graph can execute the session's own provider/model pair.
|
|
436
576
|
*
|
|
@@ -1032,6 +1172,8 @@ export async function restoreGraphRevision(input, directory, skip, floorOf) {
|
|
|
1032
1172
|
const graph = validateGraphInternal(input);
|
|
1033
1173
|
if (graph.id === 'default' || graph.revision < 1)
|
|
1034
1174
|
throw new Error('Invalid cloud revision');
|
|
1175
|
+
if (graph.id === GRAPH_MANAGER_GRAPH_ID)
|
|
1176
|
+
throw reservedGraphId(graph.id);
|
|
1035
1177
|
const folder = join(directory, 'graphs', graph.id);
|
|
1036
1178
|
await mkdir(folder, { recursive: true });
|
|
1037
1179
|
const release = await acquireSaveLock(folder);
|
|
@@ -1133,9 +1275,15 @@ export async function loadGraph(id, revision, directory = configDirectory()) {
|
|
|
1133
1275
|
if (revision !== undefined && (!Number.isSafeInteger(revision) || revision < 1))
|
|
1134
1276
|
throw new Error('Invalid graph revision');
|
|
1135
1277
|
if (id === 'default') {
|
|
1136
|
-
if (revision !== undefined && ![1, 2, 3, 4, 5, 6].includes(revision))
|
|
1278
|
+
if (revision !== undefined && ![1, 2, 3, 4, 5, 6, 7].includes(revision))
|
|
1137
1279
|
throw new Error('Default graph revision does not exist');
|
|
1138
|
-
return structuredClone(revision === 1 ? LEGACY_DEFAULT_HARNESS : revision === 2 ? DEFAULT_HARNESS_REVISION_2 : revision === 3 ? DEFAULT_HARNESS_REVISION_3 : revision === 4 ? DEFAULT_HARNESS_REVISION_4 : revision === 5 ? DEFAULT_HARNESS_REVISION_5 : DEFAULT_HARNESS);
|
|
1280
|
+
return structuredClone(revision === 1 ? LEGACY_DEFAULT_HARNESS : revision === 2 ? DEFAULT_HARNESS_REVISION_2 : revision === 3 ? DEFAULT_HARNESS_REVISION_3 : revision === 4 ? DEFAULT_HARNESS_REVISION_4 : revision === 5 ? DEFAULT_HARNESS_REVISION_5 : revision === 6 ? DEFAULT_HARNESS : DEFAULT_GRAPH);
|
|
1281
|
+
}
|
|
1282
|
+
// Built in like `default`: answered before storage is read, so a folder of the same name is never loaded.
|
|
1283
|
+
if (id === GRAPH_MANAGER_GRAPH_ID) {
|
|
1284
|
+
if (revision !== undefined && revision !== GRAPH_MANAGER_HARNESS.revision)
|
|
1285
|
+
throw new Error('Graph Manager graph revision does not exist');
|
|
1286
|
+
return structuredClone(GRAPH_MANAGER_HARNESS);
|
|
1139
1287
|
}
|
|
1140
1288
|
const folder = join(directory, 'graphs', id);
|
|
1141
1289
|
const selected = revision ?? JSON.parse(await readFile(join(folder, 'latest.json'), 'utf8'));
|
|
@@ -1153,11 +1301,11 @@ export async function listGraphs(directory = configDirectory(), onLoadError) {
|
|
|
1153
1301
|
}
|
|
1154
1302
|
catch (error) {
|
|
1155
1303
|
if (error.code === 'ENOENT')
|
|
1156
|
-
return [structuredClone(
|
|
1304
|
+
return [structuredClone(DEFAULT_GRAPH)];
|
|
1157
1305
|
throw error;
|
|
1158
1306
|
}
|
|
1159
|
-
const graphs = [structuredClone(
|
|
1160
|
-
for (const entry of entries.filter(item => item.isDirectory() && validId(item.name) && item.name !== 'default').sort((a, b) => a.name.localeCompare(b.name))) {
|
|
1307
|
+
const graphs = [structuredClone(DEFAULT_GRAPH)];
|
|
1308
|
+
for (const entry of entries.filter(item => item.isDirectory() && validId(item.name) && item.name !== 'default' && item.name !== GRAPH_MANAGER_GRAPH_ID).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
1161
1309
|
try {
|
|
1162
1310
|
graphs.push(await loadGraph(entry.name, undefined, directory));
|
|
1163
1311
|
}
|
|
@@ -1171,6 +1319,8 @@ export async function saveGraph(input, expectedRevision, directory = configDirec
|
|
|
1171
1319
|
const graph = validateGraph(input);
|
|
1172
1320
|
if (graph.id === 'default')
|
|
1173
1321
|
throw new Error('Duplicate the bundled default graph before customizing it');
|
|
1322
|
+
if (graph.id === GRAPH_MANAGER_GRAPH_ID)
|
|
1323
|
+
throw reservedGraphId(graph.id);
|
|
1174
1324
|
if (expectedRevision !== null && (!Number.isSafeInteger(expectedRevision) || expectedRevision < 1))
|
|
1175
1325
|
throw new Error('Invalid expected revision');
|
|
1176
1326
|
if (graph.revision !== (expectedRevision ?? 0))
|
|
@@ -1232,11 +1382,14 @@ export async function saveGraph(input, expectedRevision, directory = configDirec
|
|
|
1232
1382
|
* race one into leaving a half-written folder behind. The folder leaves the live path in one
|
|
1233
1383
|
* rename while the lock is held, so a save that lands during the removal writes into a fresh
|
|
1234
1384
|
* folder and survives it. Deleting the bundled `default` is refused: it has no storage to remove,
|
|
1235
|
-
* and a hidden preset would only return on the next launch.
|
|
1385
|
+
* and a hidden preset would only return on the next launch. The built-in Graph Manager graph is
|
|
1386
|
+
* refused for the same reason, by name.
|
|
1236
1387
|
*/
|
|
1237
1388
|
export async function deleteGraph(id, directory = configDirectory(), options = {}) {
|
|
1238
1389
|
if (!validId(id) || id === 'default')
|
|
1239
1390
|
throw new Error('Invalid graph id');
|
|
1391
|
+
if (id === GRAPH_MANAGER_GRAPH_ID)
|
|
1392
|
+
throw reservedGraphId(id);
|
|
1240
1393
|
const folder = join(directory, 'graphs', id);
|
|
1241
1394
|
let releaseLock;
|
|
1242
1395
|
try {
|
|
@@ -13,6 +13,7 @@ import { factTaskText } from './decision/facts.js';
|
|
|
13
13
|
import { isVerificationCheck } from './decision/checks.js';
|
|
14
14
|
import { FactContinuations, FACT_CONTINUATION_GUIDANCE, FINISH_SUMMARY_DESCRIPTION, PREPARE_FINISH, taskConstraints, localCheckResult, prepareFinishArguments, prepareFinishDescription } from './decision/FactContinuations.js';
|
|
15
15
|
import { bypassGeneration } from './decision/ContinuationAdapter.js';
|
|
16
|
+
import { bypassAccounting } from './context-budget.js';
|
|
16
17
|
/**
|
|
17
18
|
* Facts select concrete continuations at the coding-adapter boundary; the one React engine still
|
|
18
19
|
* validates and executes every call, hook, approval, budget and completion contract. A synthetic
|
|
@@ -98,6 +99,8 @@ export class AndorraAgentEngine {
|
|
|
98
99
|
let calls = [];
|
|
99
100
|
let automatic;
|
|
100
101
|
let acceptedAutomatic;
|
|
102
|
+
/** What each bypassed request would have sent, read from the request it answered. */
|
|
103
|
+
const bypassInput = new WeakMap();
|
|
101
104
|
let liveProvider = options.provider, liveModel = options.model;
|
|
102
105
|
let task = options.decisionTask ?? options.task;
|
|
103
106
|
let steered = false;
|
|
@@ -219,6 +222,9 @@ export class AndorraAgentEngine {
|
|
|
219
222
|
if (!automatic)
|
|
220
223
|
return undefined;
|
|
221
224
|
const next = automatic;
|
|
225
|
+
const wouldSend = request.estimateInputTokens?.();
|
|
226
|
+
if (wouldSend !== undefined)
|
|
227
|
+
bypassInput.set(next, wouldSend);
|
|
222
228
|
await emit('efficiency.facts.action', { action: next.kind });
|
|
223
229
|
await emit('efficiency.prepared.selected', { reason: 'fact_selected', kind: next.kind, evidenceSource: next.evidenceSource });
|
|
224
230
|
request.signal.throwIfAborted();
|
|
@@ -287,7 +293,7 @@ export class AndorraAgentEngine {
|
|
|
287
293
|
const outcome = batch.find(o => o.call.id === automatic.id);
|
|
288
294
|
if (outcome?.executionSucceeded && !outcome.isError) {
|
|
289
295
|
await emit('efficiency.prepared.executed', { kind: automatic.kind, succeeded: true });
|
|
290
|
-
await emit('decision.turn_bypassed', { kind: automatic.kind, selection: 'fact_selected', evidenceSource: automatic.evidenceSource, accounting: 'observed_bypass_not_net_savings' });
|
|
296
|
+
await emit('decision.turn_bypassed', { kind: automatic.kind, selection: 'fact_selected', evidenceSource: automatic.evidenceSource, accounting: 'observed_bypass_not_net_savings', ...bypassAccounting(bypassInput.get(automatic), liveProvider, liveModel) });
|
|
291
297
|
}
|
|
292
298
|
else
|
|
293
299
|
await emit('efficiency.prepared.rejected', { kind: automatic.kind, reason: 'execution_not_confirmed' });
|
|
@@ -367,7 +373,7 @@ export class AndorraAgentEngine {
|
|
|
367
373
|
});
|
|
368
374
|
// Count completion only when the normal engine actually accepted and returned success.
|
|
369
375
|
if (result.status === 'succeeded' && acceptedAutomatic) {
|
|
370
|
-
await emit('decision.turn_bypassed', { kind: 'complete', selection: 'fact_selected', evidenceSource: acceptedAutomatic.evidenceSource, accounting: 'observed_bypass_not_net_savings' });
|
|
376
|
+
await emit('decision.turn_bypassed', { kind: 'complete', selection: 'fact_selected', evidenceSource: acceptedAutomatic.evidenceSource, accounting: 'observed_bypass_not_net_savings', ...bypassAccounting(bypassInput.get(acceptedAutomatic), liveProvider, liveModel) });
|
|
371
377
|
}
|
|
372
378
|
return result;
|
|
373
379
|
}
|
|
@@ -1,4 +1,18 @@
|
|
|
1
|
+
/** What a membership check found, as far as naming the refusal needs. */
|
|
2
|
+
export interface MembershipVerdict {
|
|
3
|
+
paid: boolean;
|
|
4
|
+
unavailable?: boolean;
|
|
5
|
+
failureReason?: 'tls' | 'dns' | 'network';
|
|
6
|
+
subject?: string;
|
|
7
|
+
}
|
|
1
8
|
/** A graph feature the account's membership does not reach. */
|
|
2
9
|
export declare class PaidMembershipRequiredError extends Error {
|
|
3
10
|
constructor(message?: string);
|
|
11
|
+
/**
|
|
12
|
+
* The refusal for one membership answer, naming which of its causes applies.
|
|
13
|
+
*
|
|
14
|
+
* One message used to cover all three, so a dropped connection and a lost sign-in both read as
|
|
15
|
+
* "paid membership is required" and sent people to check a membership they had.
|
|
16
|
+
*/
|
|
17
|
+
static for(access: MembershipVerdict): PaidMembershipRequiredError;
|
|
4
18
|
}
|
|
@@ -1,4 +1,27 @@
|
|
|
1
|
+
const FEATURES = 'the Andorra graph, custom graphs and the graph builder';
|
|
2
|
+
const REASONS = {
|
|
3
|
+
tls: 'a secure connection to the account service could not be verified',
|
|
4
|
+
dns: 'the account service address could not be resolved',
|
|
5
|
+
network: 'the account service could not be reached',
|
|
6
|
+
};
|
|
1
7
|
/** A graph feature the account's membership does not reach. */
|
|
2
8
|
export class PaidMembershipRequiredError extends Error {
|
|
3
|
-
constructor(message =
|
|
9
|
+
constructor(message = `Paid membership is required for ${FEATURES}. Use /login to sign in. If already signed in, check your membership or connection.`) { super(message); }
|
|
10
|
+
/**
|
|
11
|
+
* The refusal for one membership answer, naming which of its causes applies.
|
|
12
|
+
*
|
|
13
|
+
* One message used to cover all three, so a dropped connection and a lost sign-in both read as
|
|
14
|
+
* "paid membership is required" and sent people to check a membership they had.
|
|
15
|
+
*/
|
|
16
|
+
static for(access) {
|
|
17
|
+
if (access.unavailable) {
|
|
18
|
+
const reason = access.failureReason ? `: ${REASONS[access.failureReason]}` : ' right now';
|
|
19
|
+
return new PaidMembershipRequiredError(`Your Andorra membership could not be checked${reason}. This does not mean you were signed out; check your connection and retry.`);
|
|
20
|
+
}
|
|
21
|
+
if (!access.subject)
|
|
22
|
+
return new PaidMembershipRequiredError(`You are signed out of your Andorra account. Use /login to sign in again; ${FEATURES} need a signed-in account.`);
|
|
23
|
+
if (!access.paid)
|
|
24
|
+
return new PaidMembershipRequiredError('This needs a paid membership, and your Andorra account does not have one.');
|
|
25
|
+
return new PaidMembershipRequiredError();
|
|
26
|
+
}
|
|
4
27
|
}
|
package/dist/src/membership.d.ts
CHANGED
|
@@ -6,6 +6,10 @@ import type { TelemetryPlan } from './telemetry/schema.js';
|
|
|
6
6
|
* The selection id and the export name keep their `software-engineer` spellings for saved-run and
|
|
7
7
|
* saved-selection compatibility; the agent the user sees is the Andorra Agent, which handles general
|
|
8
8
|
* tasks and coding alike.
|
|
9
|
+
*
|
|
10
|
+
* Its body is {@link DEFAULT_AGENT_GRAPH}, which the latest bundled `default` revision shown in Graph
|
|
11
|
+
* Studio is built from too, so the editor shows exactly what a Default run executes. The run identity
|
|
12
|
+
* stays as it was: schema version 2, `software-engineer` and revision 1, which saved runs recorded.
|
|
9
13
|
*/
|
|
10
14
|
export declare const SOFTWARE_ENGINEER_HARNESS: Graph;
|
|
11
15
|
/** Reserved selection cannot collide with a saved graph's filesystem-safe id. */
|
|
@@ -21,6 +25,13 @@ export type MembershipFailureReason = 'tls' | 'dns' | 'network';
|
|
|
21
25
|
*/
|
|
22
26
|
export type MembershipTier = 'free' | 'legacy' | 'paid';
|
|
23
27
|
export declare const MEMBERSHIP_TIERS: readonly MembershipTier[];
|
|
28
|
+
/**
|
|
29
|
+
* The rolling-window fields of a membership answer, each kept only when it is well formed.
|
|
30
|
+
*
|
|
31
|
+
* They are display metadata from a newer service: an older one sends none, and a malformed one is
|
|
32
|
+
* dropped on its own rather than failing the whole membership.
|
|
33
|
+
*/
|
|
34
|
+
export declare function windowFields(result: Record<string, unknown>): Pick<Membership, 'fairUse' | 'windowDays' | 'windowDecisionLimit' | 'windowDecisionUsed' | 'windowDecisionResetsAt'>;
|
|
24
35
|
export interface Membership {
|
|
25
36
|
paid: boolean;
|
|
26
37
|
unavailable?: boolean;
|
|
@@ -32,6 +43,15 @@ export interface Membership {
|
|
|
32
43
|
dailyDecisionUsed?: number;
|
|
33
44
|
dailyDecisionResetsAt?: string;
|
|
34
45
|
decisionsSinceRollout?: number; /**
|
|
46
|
+
* The rolling allowance: Free accounts get `windowDecisionLimit` decisions per `windowDays` UTC days;
|
|
47
|
+
* Paid and Legacy accounts are unlimited under fair use (`fairUse`), with a daily and a window cap.
|
|
48
|
+
* `windowDecisionResetsAt` is when the oldest counted decision leaves the window.
|
|
49
|
+
*/
|
|
50
|
+
fairUse?: boolean;
|
|
51
|
+
windowDays?: number;
|
|
52
|
+
windowDecisionLimit?: number;
|
|
53
|
+
windowDecisionUsed?: number;
|
|
54
|
+
windowDecisionResetsAt?: string; /**
|
|
35
55
|
* Where the account's billing lives, when the service has a billing page for it. Subscription
|
|
36
56
|
* billing is not set up yet, so the account service does not send this.
|
|
37
57
|
*/
|
package/dist/src/membership.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DEFAULT_AGENT_GRAPH } from './default-graph.js';
|
|
2
|
+
import { DEFAULT_HARNESS, GRAPH_MANAGER_GRAPH_ID, GRAPH_MANAGER_HARNESS, GraphDeletedError, isDeletedGraph, loadGraph } from './graphs.js';
|
|
2
3
|
import { AUTH_REFRESH_BUDGET_MS, AuthError, getAccessToken, getAuthConfiguration } from './auth/index.js';
|
|
3
4
|
import { graphStorageDirectory } from './graph-account.js';
|
|
4
5
|
import { configDirectory, loadConfig } from './config.js';
|
|
@@ -13,18 +14,15 @@ import { loadFreeTierGraph } from './graph-quota.js';
|
|
|
13
14
|
* The selection id and the export name keep their `software-engineer` spellings for saved-run and
|
|
14
15
|
* saved-selection compatibility; the agent the user sees is the Andorra Agent, which handles general
|
|
15
16
|
* tasks and coding alike.
|
|
17
|
+
*
|
|
18
|
+
* Its body is {@link DEFAULT_AGENT_GRAPH}, which the latest bundled `default` revision shown in Graph
|
|
19
|
+
* Studio is built from too, so the editor shows exactly what a Default run executes. The run identity
|
|
20
|
+
* stays as it was: schema version 2, `software-engineer` and revision 1, which saved runs recorded.
|
|
16
21
|
*/
|
|
22
|
+
// Keys keep their original order, so the serialized run graph is byte-identical to earlier releases.
|
|
17
23
|
export const SOFTWARE_ENGINEER_HARNESS = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
nodes: {
|
|
21
|
-
engineer: { id: 'engineer', name: 'Andorra Agent', type: 'agent', executor: 'react-basic',
|
|
22
|
-
instruction: 'Handle the user\'s task end to end, whether it is a coding task or a general one: implement code and verify changes with appropriate tools, and answer general research, writing and analysis directly from the available sources. Ask for clarification when needed. Report the result and any remaining issues. For follow-up questions, use the retained conversation and prior results first. Answer directly when they contain the answer; do not restart completed work or scan unrelated files. If no pull request was created or its number is unknown, say so rather than guessing. Start new implementation work only when the user requests it.',
|
|
23
|
-
contextPolicy: { history: true }, jevEnabled: true,
|
|
24
|
-
subagents: { enabled: false }, position: { x: 120, y: 120 } },
|
|
25
|
-
done: { id: 'done', name: 'Done', type: 'end', position: { x: 440, y: 120 } },
|
|
26
|
-
},
|
|
27
|
-
edges: [{ id: 'engineer-done', source: 'engineer', target: 'done', outcome: 'completed' }],
|
|
24
|
+
schemaVersion: 2, id: 'software-engineer', name: DEFAULT_AGENT_GRAPH.name, revision: 1, entry: DEFAULT_AGENT_GRAPH.entry,
|
|
25
|
+
nodes: structuredClone(DEFAULT_AGENT_GRAPH.nodes), edges: structuredClone(DEFAULT_AGENT_GRAPH.edges),
|
|
28
26
|
};
|
|
29
27
|
/** Reserved selection cannot collide with a saved graph's filesystem-safe id. */
|
|
30
28
|
export const ANDORRA_GRAPH_SELECTION = ':andorra';
|
|
@@ -37,6 +35,28 @@ export function getAndorraHarness() {
|
|
|
37
35
|
return graph;
|
|
38
36
|
}
|
|
39
37
|
export const MEMBERSHIP_TIERS = ['free', 'legacy', 'paid'];
|
|
38
|
+
/**
|
|
39
|
+
* The rolling-window fields of a membership answer, each kept only when it is well formed.
|
|
40
|
+
*
|
|
41
|
+
* They are display metadata from a newer service: an older one sends none, and a malformed one is
|
|
42
|
+
* dropped on its own rather than failing the whole membership.
|
|
43
|
+
*/
|
|
44
|
+
export function windowFields(result) {
|
|
45
|
+
const positive = (value) => Number.isSafeInteger(value) && value > 0;
|
|
46
|
+
const fields = {};
|
|
47
|
+
if (typeof result.fairUse === 'boolean')
|
|
48
|
+
fields.fairUse = result.fairUse;
|
|
49
|
+
if (positive(result.windowDays) && result.windowDays <= 366)
|
|
50
|
+
fields.windowDays = result.windowDays;
|
|
51
|
+
if (positive(result.windowDecisionLimit))
|
|
52
|
+
fields.windowDecisionLimit = result.windowDecisionLimit;
|
|
53
|
+
if (Number.isSafeInteger(result.windowDecisionUsed) && result.windowDecisionUsed >= 0)
|
|
54
|
+
fields.windowDecisionUsed = result.windowDecisionUsed;
|
|
55
|
+
const reset = result.windowDecisionResetsAt;
|
|
56
|
+
if (typeof reset === 'string' && reset.length <= 40 && /^\d{4}-\d{2}-\d{2}T/.test(reset) && Number.isFinite(Date.parse(reset)))
|
|
57
|
+
fields.windowDecisionResetsAt = reset;
|
|
58
|
+
return fields;
|
|
59
|
+
}
|
|
40
60
|
/**
|
|
41
61
|
* How a membership is named to the user.
|
|
42
62
|
*
|
|
@@ -174,6 +194,7 @@ export function createMembershipClient(deps) {
|
|
|
174
194
|
// answer records as Legacy.
|
|
175
195
|
const observedAt = new Date().toISOString();
|
|
176
196
|
await (deps.recordPlan ?? recordPlanConfirmation)({ subject: result.subject, tier: analyticsPlanFromMembership(tier, result.paid), observedAt }, home).catch(() => { });
|
|
197
|
+
const windowed = windowFields(result);
|
|
177
198
|
const lifetime = Number.isSafeInteger(result.decisionsSinceRollout) && result.decisionsSinceRollout >= 0
|
|
178
199
|
? result.decisionsSinceRollout : undefined;
|
|
179
200
|
// A billing link opens a page in the user's browser, so it is checked before it is used.
|
|
@@ -182,6 +203,7 @@ export function createMembershipClient(deps) {
|
|
|
182
203
|
return { paid: result.paid, subject: result.subject, ...(email ? { email } : {}), ...(tier ? { tier } : {}), ...(result.dailyDecisionLimit === undefined ? {} : { dailyDecisionLimit: result.dailyDecisionLimit }),
|
|
183
204
|
...(validUsage ? { dailyDecisionUsed: result.dailyDecisionUsed, dailyDecisionResetsAt: reset } : {}),
|
|
184
205
|
...(lifetime === undefined ? {} : { decisionsSinceRollout: lifetime }),
|
|
206
|
+
...windowed,
|
|
185
207
|
...(billing === undefined ? {} : { billingUrl: billing }) };
|
|
186
208
|
}
|
|
187
209
|
catch (error) {
|
|
@@ -206,8 +228,9 @@ export const getMembership = createMembershipClient({
|
|
|
206
228
|
fetch: (...args) => globalThis.fetch(...args),
|
|
207
229
|
});
|
|
208
230
|
export async function requirePaidMembership(signal) {
|
|
209
|
-
|
|
210
|
-
|
|
231
|
+
const access = await getMembership(signal);
|
|
232
|
+
if (!access.paid)
|
|
233
|
+
throw PaidMembershipRequiredError.for(access);
|
|
211
234
|
}
|
|
212
235
|
/**
|
|
213
236
|
* Refuse graph building to an account the membership service has not confirmed.
|
|
@@ -222,7 +245,7 @@ export async function requireGraphMembership(signal) {
|
|
|
222
245
|
export async function readGraphMembership(signal) {
|
|
223
246
|
const access = await getMembership(signal);
|
|
224
247
|
if (!access.paid && !access.subject)
|
|
225
|
-
throw
|
|
248
|
+
throw PaidMembershipRequiredError.for(access);
|
|
226
249
|
return access;
|
|
227
250
|
}
|
|
228
251
|
/** Called for every CLI run so a saved selection cannot bypass a membership downgrade. */
|
|
@@ -230,15 +253,21 @@ export async function loadAccessibleGraph(id = 'default', signal, membership = g
|
|
|
230
253
|
signal?.throwIfAborted();
|
|
231
254
|
if (id === 'default')
|
|
232
255
|
return structuredClone(SOFTWARE_ENGINEER_HARNESS);
|
|
256
|
+
// Graph Studio's own chat graph is built in like the default: it is no account's saved graph, so
|
|
257
|
+
// no membership or free allowance decides it, and every account that opens Graph Studio runs it.
|
|
258
|
+
if (id === GRAPH_MANAGER_GRAPH_ID)
|
|
259
|
+
return structuredClone(GRAPH_MANAGER_HARNESS);
|
|
233
260
|
const access = await membership(signal);
|
|
234
261
|
signal?.throwIfAborted();
|
|
235
262
|
// A free account runs its one custom graph; the Andorra preset stays Premium. Membership that could
|
|
236
263
|
// not be read names no subject, so it is refused here as before.
|
|
237
264
|
if (!access.paid && (id === ANDORRA_GRAPH_SELECTION || access.unavailable))
|
|
238
|
-
throw
|
|
265
|
+
throw PaidMembershipRequiredError.for(access);
|
|
239
266
|
if (id === ANDORRA_GRAPH_SELECTION)
|
|
240
267
|
return getAndorraHarness();
|
|
241
|
-
if (!access.subject
|
|
268
|
+
if (!access.subject)
|
|
269
|
+
throw PaidMembershipRequiredError.for(access);
|
|
270
|
+
if (!/^[A-Za-z0-9-]{1,128}$/.test(access.subject))
|
|
242
271
|
throw new PaidMembershipRequiredError();
|
|
243
272
|
const directory = await graphStorageDirectory(undefined, access.subject);
|
|
244
273
|
const graph = access.paid ? await loadGraph(id, undefined, directory) : await loadFreeTierGraph(id, directory);
|
package/dist/src/palette.d.ts
CHANGED
|
@@ -15,26 +15,43 @@ export declare const SUBTLE = 250;
|
|
|
15
15
|
export declare const WHITE = 231;
|
|
16
16
|
/** The accent: the brightest neutral, so emphasis reads as strength rather than color. */
|
|
17
17
|
export declare const ACCENT_INDEX = 231;
|
|
18
|
-
/** A picked skill in the composer: bold indigo, so a recognised command reads apart from typed text and
|
|
18
|
+
/** A picked skill in the composer: bold indigo, so a recognised command reads apart from typed text and bold attachments. */
|
|
19
19
|
export declare const SKILL_CHIP = 147;
|
|
20
20
|
/**
|
|
21
21
|
* Semantic status colors, the only hues in the palette.
|
|
22
22
|
*
|
|
23
|
-
* These carry meaning (
|
|
24
|
-
* neutral accent cannot. `error` is the one red, kept for failures and removed lines.
|
|
23
|
+
* These carry meaning (a passed check or an added line, a failure or a removed line) that
|
|
24
|
+
* the neutral accent cannot. `error` is the one red, kept for failures and removed lines.
|
|
25
|
+
* There is no amber: something that needs attention is set in {@link ATTENTION}, by weight.
|
|
25
26
|
*/
|
|
26
27
|
export declare const STATUS: {
|
|
27
28
|
readonly ok: 114;
|
|
28
|
-
readonly warn: 214;
|
|
29
29
|
readonly error: 203;
|
|
30
30
|
readonly added: 114;
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
33
|
+
* Attention without a hue, as an SGR parameter: bold in the terminal's own foreground.
|
|
34
|
+
*
|
|
35
|
+
* The elevated Full Access permission state, the model-override hint and a node a run stopped
|
|
36
|
+
* on need to stand out from the gray chrome around them, but the palette keeps hue for status.
|
|
37
|
+
* Weight carries it instead, and the terminal's default foreground keeps it legible on dark
|
|
38
|
+
* and light themes alike, where a fixed bright neutral would vanish on a light background.
|
|
39
|
+
*
|
|
40
|
+
* `39` restores that default foreground explicitly: bold alone keeps whatever foreground an
|
|
41
|
+
* enclosing paint set, and the welcome wraps the override hint in the draft gray (252), which
|
|
42
|
+
* would leave it near-white on a light theme.
|
|
43
|
+
*/
|
|
44
|
+
export declare const ATTENTION = "1;39";
|
|
45
|
+
/**
|
|
46
|
+
* Attachment tokens in the composer, as an SGR parameter: plain bold in the terminal's own
|
|
47
|
+
* foreground.
|
|
48
|
+
*
|
|
49
|
+
* An inline paste, image, or file reference must read as an object rather than as typed
|
|
50
|
+
* text. Weight and its bracketed label carry that, so a token never borrows a status hue and
|
|
51
|
+
* never matches the indigo skill chip, and it stays legible on a light terminal theme. As with
|
|
52
|
+
* {@link ATTENTION}, `39` resets any inherited foreground so the token never takes the draft gray.
|
|
36
53
|
*/
|
|
37
|
-
export declare const ATTACHMENT_TOKEN =
|
|
54
|
+
export declare const ATTACHMENT_TOKEN = "1;39";
|
|
38
55
|
/**
|
|
39
56
|
* Whether the terminal can render 24-bit color.
|
|
40
57
|
*
|
package/dist/src/palette.js
CHANGED
|
@@ -15,21 +15,39 @@ export const SUBTLE = 250;
|
|
|
15
15
|
export const WHITE = 231;
|
|
16
16
|
/** The accent: the brightest neutral, so emphasis reads as strength rather than color. */
|
|
17
17
|
export const ACCENT_INDEX = WHITE;
|
|
18
|
-
/** A picked skill in the composer: bold indigo, so a recognised command reads apart from typed text and
|
|
18
|
+
/** A picked skill in the composer: bold indigo, so a recognised command reads apart from typed text and bold attachments. */
|
|
19
19
|
export const SKILL_CHIP = 147;
|
|
20
20
|
/**
|
|
21
21
|
* Semantic status colors, the only hues in the palette.
|
|
22
22
|
*
|
|
23
|
-
* These carry meaning (
|
|
24
|
-
* neutral accent cannot. `error` is the one red, kept for failures and removed lines.
|
|
23
|
+
* These carry meaning (a passed check or an added line, a failure or a removed line) that
|
|
24
|
+
* the neutral accent cannot. `error` is the one red, kept for failures and removed lines.
|
|
25
|
+
* There is no amber: something that needs attention is set in {@link ATTENTION}, by weight.
|
|
25
26
|
*/
|
|
26
|
-
export const STATUS = { ok: 114,
|
|
27
|
+
export const STATUS = { ok: 114, error: 203, added: 114 };
|
|
27
28
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
29
|
+
* Attention without a hue, as an SGR parameter: bold in the terminal's own foreground.
|
|
30
|
+
*
|
|
31
|
+
* The elevated Full Access permission state, the model-override hint and a node a run stopped
|
|
32
|
+
* on need to stand out from the gray chrome around them, but the palette keeps hue for status.
|
|
33
|
+
* Weight carries it instead, and the terminal's default foreground keeps it legible on dark
|
|
34
|
+
* and light themes alike, where a fixed bright neutral would vanish on a light background.
|
|
35
|
+
*
|
|
36
|
+
* `39` restores that default foreground explicitly: bold alone keeps whatever foreground an
|
|
37
|
+
* enclosing paint set, and the welcome wraps the override hint in the draft gray (252), which
|
|
38
|
+
* would leave it near-white on a light theme.
|
|
39
|
+
*/
|
|
40
|
+
export const ATTENTION = '1;39';
|
|
41
|
+
/**
|
|
42
|
+
* Attachment tokens in the composer, as an SGR parameter: plain bold in the terminal's own
|
|
43
|
+
* foreground.
|
|
44
|
+
*
|
|
45
|
+
* An inline paste, image, or file reference must read as an object rather than as typed
|
|
46
|
+
* text. Weight and its bracketed label carry that, so a token never borrows a status hue and
|
|
47
|
+
* never matches the indigo skill chip, and it stays legible on a light terminal theme. As with
|
|
48
|
+
* {@link ATTENTION}, `39` resets any inherited foreground so the token never takes the draft gray.
|
|
31
49
|
*/
|
|
32
|
-
export const ATTACHMENT_TOKEN =
|
|
50
|
+
export const ATTACHMENT_TOKEN = '1;39';
|
|
33
51
|
/**
|
|
34
52
|
* Whether the terminal can render 24-bit color.
|
|
35
53
|
*
|
|
@@ -23,12 +23,12 @@ export interface EngineTransport {
|
|
|
23
23
|
}
|
|
24
24
|
export declare function isEngineContextOverflow(errorMessage: string): boolean;
|
|
25
25
|
/**
|
|
26
|
-
* Move the serializer's conversation breakpoint off the trailing
|
|
26
|
+
* Move the serializer's conversation breakpoint off the trailing messages a later request rewrites.
|
|
27
27
|
*
|
|
28
28
|
* Anthropic writes a cache entry only at a marked block, and the vendored serializer marks the
|
|
29
|
-
* final message.
|
|
30
|
-
* request
|
|
31
|
-
*
|
|
29
|
+
* final message. When that message is transient guidance, the entry would end at a message the
|
|
30
|
+
* next request replaces, so no prefix of the next request ever matches it and the whole history
|
|
31
|
+
* is re-written every turn. Marking the last committed message instead lets
|
|
32
32
|
* the next request find that entry by looking back from its own breakpoint.
|
|
33
33
|
*/
|
|
34
34
|
export declare function relocateConversationBreakpoint(body: Record<string, unknown>, mutableTail: number): void;
|