@vecteur/cli 0.11.1 → 0.12.4

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/src/localfiles.js CHANGED
@@ -45,8 +45,6 @@ export function qualify({ platform = process.platform, version = process.version
45
45
  const [major, minor] = version.split('.').map(Number);
46
46
  if (platform !== 'linux' || major < 20 || (major === 20 && minor < 8)) fail('platform_unqualified', 'Local file authority requires Linux and Node >=20.8');
47
47
  }
48
- export const localProcessEnv = (env, root) => ({ PATH: env.PATH ?? '/usr/bin:/bin', HOME: env.HOME ?? root,
49
- TMPDIR: env.TMPDIR, XDG_CONFIG_HOME: env.XDG_CONFIG_HOME, LANG: 'C.UTF-8', PYTHONDONTWRITEBYTECODE: '1' });
50
48
  function directory(env) { return dirname(credentialsPath(env)); }
51
49
  function store(env, name) { return join(directory(env), name + '.json'); }
52
50
  function readGrants(env) {
@@ -137,8 +135,7 @@ export function endGrants({ origin, accountId, root } = {}, env = process.env) {
137
135
  const value = readGrants(env);
138
136
  const intent = journal(env); intent.grantEnds ??= {};
139
137
  const affected = [];
140
- // An invocation may hold only an in-memory execution marker. An explicit folder
141
- // revoke must still advance its generation, even before any file grant exists.
138
+ // An explicit folder revoke advances its generation even before any file grant exists.
142
139
  const explicit = origin && accountId && root ? {
143
140
  [grantKey({ origin, accountId, root: { path: root } })]: { origin, accountId, root: { path: root }, generation: 0 },
144
141
  } : {};
@@ -185,26 +182,9 @@ export function rootIdentity(path) {
185
182
  if (!info.isDirectory()) fail('folder_invalid');
186
183
  return { path: real, ...inode(info) };
187
184
  }
188
- export function executionGrant(pin, env = process.env) {
185
+ export function pinCheck(grant, pin, env = process.env) {
189
186
  requireLock(env);
190
- const grant = currentGrant(pin, env) ?? { ...pin, generation: readGrants(env).generations[grantKey(pin)] ?? 0 };
191
- return { ...grant, execCredential: pin.credential.token, execPid: process.pid };
192
- }
193
- export function checkGrantLive(grant, pin, env = process.env) {
194
- requireLock(env);
195
- if (grant.accountId !== pin.accountId || grant.origin !== pin.origin || grant.root.path !== pin.root.path || grant.execCredential !== pin.credential.token
196
- || (readGrants(env).generations[grantKey(grant)] ?? 0) !== grant.generation) fail('grant_changed', 'Local permission changed; draft kept. Confirm again.');
197
- }
198
- export function consumeExec(runId, requestId, env = process.env) {
199
- requireLock(env);
200
- const value = journal(env); value.executions ??= [];
201
- if (value.executions.some(row => row.runId === runId && row.requestId === requestId)) fail('executor_consumed');
202
- value.executions.push({runId,requestId}); saveJournal(env,value);
203
- }
204
- export function pinCheck(grant, pin, env = process.env, { execution = false } = {}) {
205
- requireLock(env);
206
- if (execution && (grant.execCredential !== pin.credential.token || grant.execPid !== process.pid)) fail('grant_changed');
207
- const live = currentGrant(grant, env) ?? (execution && (readGrants(env).generations[grantKey(grant)] ?? 0) === grant.generation ? grant : null);
187
+ const live = currentGrant(grant, env);
208
188
  if (!live || live.generation !== grant.generation || live.projectId !== pin.projectId
209
189
  || pin.accountId !== grant.accountId || pin.origin !== grant.origin) fail('grant_changed', 'Local permission changed; draft kept. Confirm again.');
210
190
  if (pin.role === 'VIEWER') fail('role_forbidden');
@@ -578,7 +558,6 @@ export async function writeProposalConfined(grant, rel, fetchBytes, expected, op
578
558
  }
579
559
  export function admissionIntent(origin, projectId, key, body, env = process.env) {
580
560
  requireLock(env); const j = journal(env);
581
- if (body.local_exec !== undefined) fail('admission_unresolved', 'Execution consent cannot be frozen; observe the Project history');
582
561
  j.admissions ??= {};
583
562
  const id = hash(JSON.stringify([origin, projectId, key]));
584
563
  const prior = j.admissions[id];
@@ -595,9 +574,8 @@ export async function reconcileAdmissions(client, origin, env = process.env) {
595
574
  requireLock(env);
596
575
  for (const [id, row] of Object.entries(journal(env).admissions ?? {})) {
597
576
  if (row.origin !== origin) continue;
598
- if (row.body?.local_exec !== undefined) fail('admission_unresolved', 'Saved execution consent expired; observe the Project history');
599
577
  try { await client.runAdmit(row.projectId, row.body, row.key); admissionResolved(id, env); }
600
- catch (e) { if (e.admission === 'refused' || ['state_fork', 'state_busy'].includes(e.code)) admissionResolved(id, env); else throw e; }
578
+ catch (e) { if (e.admission === 'refused' || ['state_fork', 'state_busy', 'not_supported', 'project_read_only'].includes(e.code)) admissionResolved(id, env); else throw e; }
601
579
  }
602
580
  }
603
581
 
package/src/markdown.js CHANGED
@@ -1,12 +1,42 @@
1
1
  // GENERATED from frontend/src/run/markdown.ts; no runtime frontend dependency.
2
+ export const studyPath = (value) => value.replace(/(?<![\w.-])(?:\/work)?\/study\//g, '');
3
+ export const readerPaths = (source) => studyPath(source.replace(/`(?:\/work)?\/study\/?`|(?<![\w/.-])(?:\/work)?\/study\/?(?=[\s:;,.!?)]|$)/g, 'the study folder'));
4
+ const LISTED_FILE = /^\s*[-*]\s+`?[\w./-]+\.\w{1,5}`?\s*$/;
5
+ const LIST_LEAD = /^(?:\*\*)?(?:all\s+|the\s+)?(?:files?|deliverables?|outputs?|everything)\b[^\n]*:\s*(?:\*\*)?$/i;
6
+ export function withoutClosingFileList(source) {
7
+ const lines = source.split('\n');
8
+ const out = [];
9
+ for (let at = 0; at < lines.length; at += 1) {
10
+ if (LIST_LEAD.test(readerPaths(lines[at]).trim())) {
11
+ let end = at + 1;
12
+ while (end < lines.length && lines[end].trim() === '')
13
+ end += 1;
14
+ let last = end;
15
+ while (last < lines.length && LISTED_FILE.test(lines[last]))
16
+ last += 1;
17
+ if (last > end && (last === lines.length || !/^\s*[-*]\s/.test(lines[last]))) {
18
+ at = last - 1;
19
+ while (out.length && out.at(-1).trim() === '')
20
+ out.pop();
21
+ continue;
22
+ }
23
+ }
24
+ out.push(lines[at]);
25
+ }
26
+ return out.join('\n').trimEnd();
27
+ }
28
+ export function closeOpenMarks(source) {
29
+ if (source.split('\n').filter((line) => /^\s*```/.test(line)).length % 2)
30
+ return `${source}\n${'```'}`;
31
+ const text = /^\s*```/.test(source.split('\n').at(-1) ?? '') ? source : source.replace(/(?:\*\*|`)+$/, '');
32
+ const plain = text.replace(/```[\s\S]*?```/g, '');
33
+ const code = (plain.match(/`/g) ?? []).length % 2 === 1;
34
+ const bold = (plain.replace(/`[^`]*`?/g, '').match(/\*\*/g) ?? []).length % 2 === 1;
35
+ return `${text}${code ? '`' : ''}${bold && !code ? '**' : ''}`;
36
+ }
2
37
  export function inlinePlain(inline) {
3
38
  return inline.map((token) => token.text).join('');
4
39
  }
5
- export function tableGrid(block) {
6
- const header = block.header.map(inlinePlain);
7
- const rows = block.rows.map((row) => row.map(inlinePlain));
8
- return header.length ? [header, ...rows] : rows;
9
- }
10
40
  const INLINE_PATTERN = /(!\[[^\]]*\]\([^)\s]+\)|`[^`]+`|\[[^\]\n]+\]\([^)\s]+\)|\*\*[^*]+\*\*|\*[^*]+\*|\$[A-Za-z_][A-Za-z0-9_.]*\$)/g;
11
41
  const LINK_TOKEN = /^\[([^\]\n]+)\]\(([^)\s]+)\)$/;
12
42
  const IMAGE_TOKEN = /^!\[([^\]]*)\]\(([^)\s]+)\)$/;
@@ -79,66 +109,6 @@ export function parseInline(text) {
79
109
  }
80
110
  return out;
81
111
  }
82
- export function withholdOpenTokens(text) {
83
- const scrubbed = text.replace(/\\[*`$]/g, ' ');
84
- const cuts = [];
85
- const backticks = [...scrubbed.matchAll(/`/g)];
86
- if (backticks.length % 2 === 1)
87
- cuts.push(backticks[backticks.length - 1].index ?? 0);
88
- const bolds = [...scrubbed.matchAll(/\*\*/g)];
89
- if (bolds.length % 2 === 1)
90
- cuts.push(bolds[bolds.length - 1].index ?? 0);
91
- const openReference = /\$[A-Za-z_][A-Za-z0-9_.]*$/.exec(scrubbed);
92
- if (openReference)
93
- cuts.push(openReference.index);
94
- const openLink = /\[[^\]\n]*\]\([^)\s]*$/.exec(scrubbed);
95
- if (openLink)
96
- cuts.push(openLink.index);
97
- const tablePrefix = trailingTableDelimiterPrefix(text);
98
- if (tablePrefix !== null)
99
- cuts.push(tablePrefix);
100
- if (!cuts.length)
101
- return text;
102
- return text.slice(0, Math.min(...cuts));
103
- }
104
- function trailingTableDelimiterPrefix(text) {
105
- const lines = text.split('\n');
106
- if (lines.length < 2)
107
- return null;
108
- const candidate = lines[lines.length - 1];
109
- const header = lines[lines.length - 2];
110
- if (!TABLE_ROW.test(candidate) || !TABLE_ROW.test(header))
111
- return null;
112
- if (lines.slice(0, -1).filter((line) => line.startsWith('```')).length % 2 === 1)
113
- return null;
114
- if (lines.length > 2 && TABLE_ROW.test(lines[lines.length - 3]))
115
- return null;
116
- const cells = (line) => line.trim().replace(/^\||\|$/g, '').split('|').map((cell) => cell.trim());
117
- const delimiter = cells(candidate);
118
- const headerCells = cells(header);
119
- if (delimiter.length >= headerCells.length)
120
- return null;
121
- if (!delimiter.every((cell) => /^:?-+:?$/.test(cell)))
122
- return null;
123
- return text.lastIndexOf('\n') + 1;
124
- }
125
- export function splitStream(source) {
126
- const lines = source.split('\n');
127
- let fenceOpen = -1;
128
- let offset = 0;
129
- for (const line of lines) {
130
- if (line.startsWith('```'))
131
- fenceOpen = fenceOpen === -1 ? offset : -1;
132
- offset += line.length + 1;
133
- }
134
- if (fenceOpen !== -1) {
135
- return { frozen: source.slice(0, fenceOpen), tail: source.slice(fenceOpen) };
136
- }
137
- const boundary = source.lastIndexOf('\n\n');
138
- if (boundary === -1)
139
- return { frozen: '', tail: source };
140
- return { frozen: source.slice(0, boundary + 2), tail: source.slice(boundary + 2) };
141
- }
142
112
  export function parseMarkdown(source) {
143
113
  const blocks = [];
144
114
  const lines = source.split('\n');
@@ -202,12 +172,15 @@ export function parseMarkdown(source) {
202
172
  if (BULLET_ROW.test(line) || NUMBERED_ROW.test(line)) {
203
173
  const ordered = NUMBERED_ROW.test(line);
204
174
  const pattern = ordered ? NUMBERED_ROW : BULLET_ROW;
175
+ const base = /^\s*/.exec(line)[0].length;
205
176
  const items = [];
206
177
  while (index < lines.length) {
207
- const item = pattern.exec(lines[index]);
208
- if (!item)
178
+ const indent = /^\s*/.exec(lines[index])[0].length;
179
+ const nested = indent >= base + 2 && items.length > 0;
180
+ const item = (nested ? BULLET_ROW.exec(lines[index]) ?? NUMBERED_ROW.exec(lines[index]) : pattern.exec(lines[index]));
181
+ if (!item || (!nested && indent > base + 1))
209
182
  break;
210
- items.push(parseInline(item[1]));
183
+ items.push({ inline: parseInline(item[1]), depth: nested ? 1 : 0, ordered: nested ? NUMBERED_ROW.test(lines[index]) : ordered });
211
184
  index += 1;
212
185
  }
213
186
  blocks.push({ kind: 'list', ordered, items });
package/src/mcp.js CHANGED
@@ -5,8 +5,8 @@ import { McpServer } from "@modelcontextprotocol/server";
5
5
  import { serveStdio } from "@modelcontextprotocol/server/stdio";
6
6
  import * as z from "zod/v4";
7
7
 
8
- import { CliError, VecteurClient, redact } from "./client.js";
9
- import { EVENT_KINDS, RETIRED_EVENT_KINDS, STORED_WIRE_VERSIONS, TERMINAL_STATES } from "./contract.js";
8
+ import { CliError, OWNER_WORDED, VecteurClient, redact } from "./client.js";
9
+ import { EVENT_KINDS, STORED_WIRE_VERSIONS, TERMINAL_STATES } from "./contract.js";
10
10
  import { canonicalJson } from "./format.js";
11
11
  import { artifactToFolder, materialAttach } from "./exchange.js";
12
12
  import { credentialsPath } from "./credentials.js";
@@ -21,21 +21,11 @@ const selectionInput = z.object({
21
21
  selected_extract_ids: z.array(z.string().min(1)).min(1),
22
22
  method: z.literal("exact-extract"),
23
23
  }).strict();
24
- // v5 §2.5 explicit Produce: one named specialist child, started by the host before Engineering's turn. A38: Code Produce
25
- // is off at the run door, so this tool does not offer it; the door's `produce_unavailable` words still name any entry kept off.
26
- const produceInput = z.object({
27
- specialist: z.enum(["business", "knowledge"]).describe("Business, or Knowledge documents (profile nasa or esa; a document needs a completed analysis in this Project first)"),
28
- mode: z.string().min(1).max(64),
29
- target: z.string().min(1).max(256).optional(),
30
- profile: z.string().min(1).max(256).optional(),
31
- standard: z.string().min(1).max(256).optional(),
32
- }).strict();
33
24
  const submitInput = z.object({
34
25
  project_id: z.string().min(1),
35
26
  ask: z.string().min(1),
36
27
  selections: z.array(selectionInput).min(1).optional(),
37
28
  discard_pending_material: z.boolean().optional(),
38
- produce: produceInput.optional(),
39
29
  }).strict();
40
30
  const runInput = z.object({ run_id: z.string().min(1) }).strict();
41
31
  const startInput = z.object({
@@ -49,21 +39,15 @@ const ackFields = {
49
39
  run_id: z.string().min(1), state_hash: z.string().min(1),
50
40
  accepted_at: z.number().int().safe(), requested_route_id: z.string().min(1),
51
41
  };
52
- const ackOutput = z.object(ackFields).strict();
53
42
  const startOutput = z.object({ ...ackFields, parent_state_hash: z.string().nullable() }).strict();
54
- const answerInput = z.object({
55
- run_id: z.string().min(1), clarification_id: z.string().min(1),
56
- answers: z.array(z.object({ id: z.string().min(1), selected: z.array(z.string()),
57
- custom: z.string().nullable().optional() }).strict()).min(1),
58
- }).strict();
43
+ // The four wire v6 states, or "" while the Run is open.
44
+ const terminalOutput = z.union([z.enum([...TERMINAL_STATES]), z.literal("")]);
59
45
  const statusOutput = z.object({
60
- run_id: z.string().min(1), terminal: z.union([z.enum([...TERMINAL_STATES]), z.literal("")]),
61
- last_seq: z.number().int().safe().min(-1), clarification: z.record(z.string(), z.json()).nullable(),
46
+ run_id: z.string().min(1), terminal: terminalOutput, last_seq: z.number().int().safe().min(-1),
62
47
  }).strict();
63
- const eventKind = z.enum([...EVENT_KINDS, ...RETIRED_EVENT_KINDS]);
64
48
  const eventOutput = z.object({
65
49
  run_id: z.string().min(1), seq: z.number().int().safe().nonnegative(),
66
- kind: eventKind,
50
+ kind: z.enum([...EVENT_KINDS]),
67
51
  payload: z.record(z.string(), z.json()),
68
52
  }).strict();
69
53
  const memberOutput = z.object({
@@ -75,53 +59,28 @@ const projectOutput = z.object({
75
59
  workspace_id: z.string().min(1), role: z.enum(["OWNER", "EDITOR", "VIEWER"]),
76
60
  members: z.array(memberOutput),
77
61
  created_at: z.number().int().safe(), updated_at: z.number().int().safe(),
78
- }).strict();
79
- const billableDimensionsOutput = z.object({
80
- uncached_input: z.number().int().safe().nonnegative(),
81
- cache_read: z.number().int().safe().nonnegative(),
82
- cache_write: z.number().int().safe().nonnegative(),
83
- output: z.number().int().safe().nonnegative(),
84
- cache_write_class: z.string().min(1).nullable().optional(),
85
- cache_write_duration_s: z.number().int().safe().nonnegative().nullable().optional(),
86
- provider_tier: z.string().min(1).nullable().optional(),
87
- long_context_band: z.string().min(1).nullable().optional(),
88
- }).strict();
89
- const runControlEgressOutput = z.object({
90
- candidate: z.number().int().safe().nonnegative(),
91
- call: z.number().int().safe().nonnegative(),
92
- }).strict();
93
- const runControlOutput = z.object({
94
- id: z.string().min(1),
95
- kind: z.enum(["steer", "answer_now"]),
96
- sequence: z.number().int().safe().positive(),
97
- state: z.enum(["queued", "claimed", "dispatched", "not_dispatched"]),
98
- attempt: z.number().int().safe().nonnegative().nullable(),
99
- step: z.number().int().safe().nonnegative().nullable(),
100
- egress: runControlEgressOutput.nullable(),
101
- text: z.string().nullable().optional(),
102
- }).strict();
103
- const admittedOutput = z.object({
104
- run_id: z.string().min(1), state_hash: z.string().min(1), result_hash: z.string(),
105
- requested_route_id: z.string().min(1), profile: z.string().min(1),
106
- stored_wire_version: z.union(STORED_WIRE_VERSIONS.map(version => z.literal(version))),
107
- terminal: z.union([z.enum([...TERMINAL_STATES]), z.literal("")]),
62
+ engine: z.enum(["v5", "v6"]).optional(),
63
+ }).strict();
64
+ // The owner's RunRecord, field for field; identity, state and events are checked, usage is the owner's object as served.
65
+ const runOutput = z.object({
66
+ run_id: z.string().min(1), project_id: z.string().min(1).optional(),
67
+ state_hash: z.string().regex(/^[0-9a-f]{64}$/), result_hash: z.string(),
68
+ requested_route_id: z.string().min(1).optional(), profile: z.string().optional(),
69
+ stored_wire_version: z.union(STORED_WIRE_VERSIONS.map(version => z.literal(version))).optional(),
70
+ terminal: terminalOutput,
71
+ usage: z.record(z.string(), z.json()).nullable().optional(),
72
+ accepted_at: z.number().int().safe().optional(),
108
73
  duration_seconds: z.number().int().safe().nonnegative().nullable().optional(),
109
- usage: z.object({
110
- coverage: z.enum(["complete", "incomplete"]), provider_id: z.string().min(1),
111
- model_id: z.string().min(1), observed_at: z.number().int().safe().nonnegative(),
112
- billable_dimensions: z.array(billableDimensionsOutput).min(1),
113
- }).strict(),
114
74
  events: z.array(eventOutput),
115
- controls: z.array(runControlOutput),
116
75
  }).strict().refine(value => value.terminal === ""
117
76
  ? value.result_hash === "" && value.events.at(-1)?.kind !== "terminal"
118
- : value.result_hash.length > 0, "Run terminal and result hash are not paired");
77
+ : value.result_hash.length > 0 && value.events.at(-1)?.kind === "terminal", "Run terminal and result hash are not paired");
119
78
 
120
79
  const artifactInput = z.object({
121
80
  project_id: z.string().min(1),
122
81
  cas_ref: z.string().regex(/^sha256:[0-9a-f]{64}$/).optional(),
123
82
  run_id: z.string().min(1).optional(),
124
- artifact_id: z.string().min(1).optional(),
83
+ artifact_path: z.string().min(1).optional(),
125
84
  output: z.string().min(1).optional(),
126
85
  }).strict();
127
86
  const artifactOutput = z.object({
@@ -151,8 +110,8 @@ function success(value) {
151
110
  function failure(error, lifecycle = false) {
152
111
  const code = error instanceof CliError && /^[a-z][a-z0-9_]{0,63}$/.test(error.code)
153
112
  ? error.code : "internal_error";
154
- // A38: the run door's product words naming the Produce entry it keeps off (validated by the client) ride along.
155
- const message = code === "produce_unavailable" ? { message: error.message } : {};
113
+ // A read-only (v5) Project and a retired door carry the owner's own sentence (validated by the client).
114
+ const message = OWNER_WORDED.includes(code) ? { message: error.message } : {};
156
115
  const details = Object.fromEntries((lifecycle ? ["run_id", "request_key", "parent_state_hash", "pending"] : ["run_id", "pending"])
157
116
  .filter(field => error instanceof CliError && Object.hasOwn(error, field))
158
117
  .map(field => [field, typeof error[field] === "string" ? redact(error[field]) : error[field]]));
@@ -212,42 +171,38 @@ export function createVecteurMcpServer(client = new VecteurClient(), shutdownSig
212
171
 
213
172
  tool(server, "vecteur_run_submit",
214
173
  "Submit an ask and return its terminal record. Pass vecteur_material_attach's returned selections verbatim; omitting this Project's pending material refuses, also after a server restart (attach again for its selections). Set discard_pending_material=true to forget this Project's pending material and use only the supplied selections (or none). For long Runs use vecteur_run_start and poll vecteur_run_status.",
215
- submitInput, admittedOutput, async ({ project_id: projectId, ask, selections, discard_pending_material, produce }, context) => {
174
+ submitInput, runOutput, async ({ project_id: projectId, ask, selections, discard_pending_material }, context) => {
216
175
  const progressToken = context.mcpReq._meta?.progressToken;
217
176
  const onEvent = progressToken === undefined ? null : (event) => context.mcpReq.notify({
218
177
  method: "notifications/progress",
219
178
  params: {
220
179
  progressToken,
221
- progress: event.seq + 1,
180
+ progress: event.seq, // events are numbered from 1 (wire.js FIRST_EVENT_SEQ): the count delivered
222
181
  message: event.kind,
223
182
  },
224
183
  });
225
- return withMaterial(projectId, selections, discard_pending_material, () => client.runSubmit(projectId, ask, onEvent, signal(context), undefined, selections,
226
- produce === undefined ? undefined : { kind: "produce", ...produce }));
184
+ return withMaterial(projectId, selections, discard_pending_material, () => client.runSubmit(projectId, ask, onEvent, signal(context), undefined, selections));
227
185
  });
228
186
 
229
- tool(server, "vecteur_run_get", "Get one Vecteur run record, including an open run.", runInput, admittedOutput,
187
+ tool(server, "vecteur_run_get", "Get one Vecteur run record, including an open run.", runInput, runOutput,
230
188
  ({ run_id: runId }, context) => client.runGet(runId, signal(context)));
231
189
 
232
190
  tool(server, "vecteur_run_events", "Validate run events against its direct record.", runInput,
233
- admittedOutput, ({ run_id: runId }, context) => client.runEvents(runId, null, signal(context)));
191
+ runOutput, ({ run_id: runId }, context) => client.runEvents(runId, null, signal(context)));
234
192
 
235
193
  tool(server, "vecteur_run_start", "Admit without waiting. Pass attached material's returned selections verbatim; omitting this Project's pending material refuses, also after a server restart (attach again for its selections). Set discard_pending_material=true to forget this Project's pending material and use only the supplied selections (or none). Freeze request_key, ask and parent_state_hash (null for no head) for retries. Detaching never cancels.",
236
194
  startInput, startOutput, ({ project_id, ask, request_key, parent_state_hash, selections, discard_pending_material }, context) =>
237
195
  withMaterial(project_id, selections, discard_pending_material, () => client.runStart(project_id, ask, {
238
196
  requestKey: request_key, parentStateHash: parent_state_hash, selections, signal: signal(context),
239
197
  })), true);
240
- tool(server, "vecteur_run_status", "Poll one bounded Run record; preserve its terminal and latest requested clarification verbatim.",
198
+ tool(server, "vecteur_run_status", "Poll one bounded Run record: its terminal state (completed, failed, cancelled, budget; empty while open) and last event sequence. A question from the agent is its answer; reply with a new ask.",
241
199
  runInput, statusOutput, ({ run_id }, context) => client.runStatus(run_id, signal(context)), true);
242
- tool(server, "vecteur_clarification_answer", "Answer the requested clarification with wire answers, including multi-select and custom text. Stale or duplicate answers refuse.",
243
- answerInput, ackOutput, ({ run_id, clarification_id, answers }, context) =>
244
- client.clarificationAnswer(run_id, clarification_id, answers, signal(context)), true);
245
200
 
246
201
  const cwd = process.cwd();
247
202
  tool(server, "vecteur_artifact_get",
248
- "Download one run artifact into the server's working folder (never outside it), verified against its sha256 CAS id. Give cas_ref, or run_id with artifact_id. Never overwrites.",
249
- artifactInput, artifactOutput, ({ project_id: projectId, cas_ref: casRef, run_id: runId, artifact_id: artifactId, output }, context) =>
250
- artifactToFolder(client, { projectId, casRef, runId, artifactId, output, cwd, signal: signal(context) }));
203
+ "Download one run artifact into the server's working folder (never outside it), verified against its sha256 CAS id. Give cas_ref, or run_id with artifact_path. Never overwrites.",
204
+ artifactInput, artifactOutput, ({ project_id: projectId, cas_ref: casRef, run_id: runId, artifact_path: artifactPath, output }, context) =>
205
+ artifactToFolder(client, { projectId, casRef, runId, artifactPath, output, cwd, signal: signal(context) }));
251
206
 
252
207
  tool(server, "vecteur_material_attach",
253
208
  `Upload one local file to ${client.config.origin}. Pass the returned selections verbatim to vecteur_run_submit or vecteur_run_start for this Project; upload alone is not Run admission. Requires confirm_origin equal to that origin and expected_state_hash equal to the current head (null if none).`,