@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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  One command line for Vecteur's public API. Sign in through your browser, then use the same
4
4
  Projects and run records as the web app. The client stores your credential locally; it never
5
- calls the OPE, engine or database directly.
5
+ calls the runner, engine or database directly.
6
6
 
7
7
  ```bash
8
8
  npm install -g @vecteur/cli
@@ -13,15 +13,12 @@ vecteur
13
13
  linked to this folder. A new folder creates its Project only when you send your first ask.
14
14
  No `init` command or file in the working directory is required.
15
15
 
16
- On Linux, a fresh interactive ask offers separate local command consent. `/exec on` enables
17
- it for the next admission; `/exec off` revokes it and stops the active process group.
18
- Commands show their exact bash text, folder and timeout, with once/session approval.
19
- `vecteur run submit --ask '…' --allow-exec` grants invocation-scoped session approval and
20
- stays in the foreground; `--no-wait`, persisted `--request-key` retries and MCP refuse this flag.
21
- The shell has your OS permissions, including network access and writes outside its cwd.
22
- Only scanned UTF-8 output tails (16,000/8,000 bytes) return to Vecteur; credential-shaped or
23
- unsupported output withholds both tails. A lost start acknowledgement never spawns; unknown
24
- outcomes are never retried. Restarted sessions observe existing Runs without execution authority.
16
+ One Run is one turn, executed in Vecteur cloud. A turn prints your ask, a working trace (one line
17
+ per tool call, with its result status), the answer, the files it produced and its terminal state:
18
+ `completed`, `failed`, `cancelled` or `budget`. A `budget` terminal adds the stop card: what the
19
+ server offers this reader (plan, usage). A question from Vecteur is its answer; your reply is your
20
+ next ask. A Project created before the current engine is read-only: an ask to it is refused
21
+ `project_read_only`, and its history stays readable.
25
22
 
26
23
  For scripts and explicit one-shot commands:
27
24
 
@@ -68,17 +65,17 @@ again, which would start another turn. Start a fresh study with `vecteur project
68
65
  embedded events match the stream. Redirects, secret-shaped responses, malformed responses and
69
66
  timeouts fail nonzero. `--json` sorts object keys for deterministic machine output.
70
67
 
71
- Human run output shows the sealed synthesis, input origins, artifact download commands, the typed
72
- terminal cause/recovery, and—after `run submit`—the selected Project's UTC-month customer cost using
73
- the server's display strings. Machine run output remains the unchanged canonical record. Artifact
68
+ Human run output shows the working trace, the answer, the files with their download commands, the
69
+ typed terminal state and cause, and—after `run submit`—the selected Project's UTC-month customer cost
70
+ using the server's display strings (at a `budget` terminal, the stop card instead). Machine run output remains the unchanged canonical record. Artifact
74
71
  downloads use the Project-scoped admitted CAS route, verify the declared length, media type and
75
72
  SHA-256, and refuse to overwrite a local path. Use `--project ID` when no Project is selected.
76
73
 
77
74
  `vecteur mcp` serves MCP over stdio using the same credentials and public client. It exposes
78
75
  `vecteur_project_get`, `vecteur_run_submit`, `vecteur_run_get`, `vecteur_run_events`, `vecteur_artifact_get` (digest-verified download into the working folder, never overwrites) and `vecteur_material_attach` (uploads one file from the working folder after you confirm the origin and the Project head; refuses read-only, foreign or moved-on Projects).
79
76
  Pass material_attach's returned `selections` verbatim to `vecteur_run_submit` or `vecteur_run_start` for that Project. For multiple files, concatenate their `selections` arrays. These select the same extracts as CLI `--attach`; upload alone does not admit material to a Run. Omitting that Project's pending material in the same MCP session refuses with `selection_required` before admission; pending material in another Project does not block it. To deliberately abandon pending material, pass the optional boolean `discard_pending_material: true` to submit or start: it clears only that Project's pending tracking before admission and uses the supplied selections, or none if omitted. The discard remains effective if admission refuses; it does not delete uploaded files. Omitting the flag or passing `false` retains the guard. A file with no selectable extracts refuses with `extraction_unavailable`.
80
- It also exposes `vecteur_run_start`, `vecteur_run_status` and `vecteur_clarification_answer` for
81
- long Runs. `vecteur_run_submit` blocks and is suitable only for short asks.
77
+ It also exposes `vecteur_run_start` and `vecteur_run_status` for long Runs. `vecteur_artifact_get`
78
+ takes a `cas_ref`, or a `run_id` with the file's `artifact_path`. `vecteur_run_submit` blocks and is suitable only for short asks.
82
79
  An MCP host supplies tool arguments; stdout carries only MCP protocol.
83
80
 
84
81
  `vecteur mcp setup claude` (or `codex`) runs that vendor's own `mcp add` once so your Claude Code
@@ -92,7 +89,7 @@ mode in which the vendor session appears inside Vecteur's TUI and web.
92
89
  new folder: `answer.md` (exact answer bytes), `run.json` (the canonical record) and every artifact,
93
90
  each verified against its SHA-256 CAS id. Nothing is overwritten.
94
91
 
95
- ## Claude Code and Codex: attach, poll, answer, export
92
+ ## Claude Code and Codex: attach, poll, export
96
93
 
97
94
  Both vendors use the same lifecycle recipe. Sign in to Vecteur and to your vendor separately;
98
95
  use `vecteur mcp setup claude` / `vecteur handoff claude`, or substitute `codex`. The installed
@@ -113,26 +110,15 @@ vecteur run submit --no-wait --parent "$H" --request-key orbit-20261107-01 \
113
110
  vecteur run get RUN_ID --json
114
111
  # Optional validated event replay (the stream has the configured request timeout):
115
112
  vecteur run events RUN_ID --json
116
- # When the latest clarification has state "requested":
117
- vecteur run answer RUN_ID --clarification CLARIFICATION_ID --answers answers.json --json
118
- vecteur run get RUN_ID --json
113
+ # A question from Vecteur is the Run's answer: reply with a new submit on the new head.
119
114
  vecteur run export RUN_ID -p PROJECT_ID --output orbit-result --json
120
115
  ```
121
116
 
122
- `answers.json` is the wire answer array; `--answers -` reads the same JSON from stdin:
123
-
124
- ```json
125
- [{"id":"orbit","selected":["leo","meo"],"custom":"Include a polar case"},
126
- {"id":"mass","selected":[],"custom":"550 kg"}]
127
- ```
128
-
129
- The server owns valid question/option ids, multi-select, expiry and stale/duplicate refusals.
130
117
  MCP hosts use `vecteur_run_start({project_id, ask, request_key, parent_state_hash})`, then poll
131
- `vecteur_run_status({run_id})` and answer with
132
- `vecteur_clarification_answer({run_id, clarification_id, answers})`. Start returns the RunAck
133
- plus the resolved `parent_state_hash`. Status returns `{run_id, terminal, last_seq, clarification}`:
134
- one bounded record read, last sequence `-1` when no events exist, and the latest clarification
135
- payload verbatim only while requested. Stopping polling detaches and never cancels the Run.
118
+ `vecteur_run_status({run_id})`. Start returns the RunAck plus the resolved `parent_state_hash`.
119
+ Status returns `{run_id, terminal, last_seq}`: one bounded record read, `terminal` empty while the
120
+ Run is open, last sequence `-1` when no events exist. Stopping polling detaches and never cancels
121
+ the Run.
136
122
 
137
123
  `--attach` is explicit consent to upload exactly those files to the command's explicit or
138
124
  selected Project at the authenticated origin, for Vecteur cloud and the Run's model provider.
@@ -156,7 +142,7 @@ without that file remains `admission_unresolved`; a conflicting same-key retry a
156
142
  `admission_unresolved`. Inspect Project history before choosing a new key. No newest Run is
157
143
  presented as recovered, and the client never generates a replacement key. Transport, timeout,
158
144
  pending, unknown and malformed-ack errors carry the request key and parent once resolved.
159
- Only `run submit --no-wait` and `run answer` emit one JSON error object on stderr
145
+ Only `run submit --no-wait` emits one JSON error object on stderr
160
146
  (`code`, `message`, optional `run_id`, `request_key`, `parent_state_hash`); stdout holds only the
161
147
  success record. Existing blocking CLI and MCP success outputs and CLI error bytes are preserved;
162
148
  MCP errors may additionally name an admitted `run_id`.
@@ -178,8 +164,8 @@ Bare invocation in a pipe or CI keeps the previous status output; `vecteur statu
178
164
  - `/project` chooses a Project for this session; `/link` saves the folder association.
179
165
  `/unlink` removes that association for this subtree and preserves the draft. `/name` renames
180
166
  the current Project or names the one created on first send. `/history` loads older Runs on demand.
181
- - `/model` selects the next Run's model or route from the matched server catalogue. `/mode`
182
- explains leadership, execution location and payer. Stage 1 runs in Vecteur cloud.
167
+ - `/model` selects the next Run's model from the product's model choices (Auto is the default).
168
+ `/mode` explains model, execution location and payer. Runs execute in Vecteur cloud.
183
169
  - `@` completes local paths. A whole filename in your ask offers attachment after local
184
170
  checks (at most three offers; ambiguous basenames list choices).
185
171
  A refused name prints `name: not offered (reason)` and asks whether to send without it.
@@ -199,11 +185,9 @@ Bare invocation in a pipe or CI keeps the previous status output; `vecteur statu
199
185
  Up to eight files, **8 MiB each** (reduced from 16 MiB) and 32 MiB total; all available extracts
200
186
  are selected. `/clear-files` removes pending selections. A retry of an admitted upload uses
201
187
  its frozen source handle and never rereads the local file.
202
- - `/answer` handles clarification, including multiple choices and custom text. `/steer <text>`
203
- and `/answer-now` submit instructions; acceptance is distinct from execution.
188
+ - An ask sent while a Run is working is kept as your draft; send it when the Run ends.
204
189
  - `/cancel` or double Esc requests cloud Run cancellation. Ctrl+D on an empty composer or
205
190
  `/quit` detaches; the cloud Run continues. Ctrl+C clears a nonempty composer.
206
- - `/package <number>` saves a result into its own new folder and prints how to continue. Local execution needs its separate consent; attached test reports join the next turn as your evidence, not an accepted result.
207
191
  - After a terminal head Run, a save-new prompt offers absent artifact paths, including missing
208
192
  parent directories. Identical bytes preselect the shortest path; `d` shows every path and
209
193
  lets you choose any. `yes` installs verified bytes without overwriting, `n` declines.
@@ -253,7 +237,7 @@ request evidence stays until resolved. Account draft recovery requires the same
253
237
  previously bound by a successful account read. Never-signed-in drafts occupy a separate unsigned
254
238
  namespace with no Project authority; only explicit login transfers them into an account. Neither
255
239
  recovery path grants server access. Selections hold metadata until send and must be selected
256
- again after restart; generated `/run-package` reports remain an explicit-command exception. A newer store version is refused without
240
+ again after restart. A newer store version is refused without
257
241
  rewriting it. Previous CLI versions ignore the separate folder registry.
258
242
 
259
243
  ## Local file authority limits
@@ -329,7 +313,7 @@ limit; identity-checked cleanup has the same last-check race. Node provides no o
329
313
  boundary for eliminating it here. The TUI has no `--project` attachment door;
330
314
  `run submit --no-wait -p OTHER --attach ...` grants only that invocation's explicit destination.
331
315
 
332
- Explicit `/download`, `/copy`, `/export`, `artifact get`, `run export`, `/package`, `/run-package`
316
+ Explicit `/download`, `/copy`, `/export`, `artifact get`, `run export`
333
317
  and MCP `materialAttach` retain their own consent/ownership boundaries. They are not uses of the
334
318
  new persistent local grant; MCP attachment remains the integration-doors owner.
335
319
 
@@ -341,7 +325,7 @@ One package, one session owner, two views; stage 1 has no daemon or second appli
341
325
  |---|---|
342
326
  | `bin/vecteur.js` | TTY dispatch and preserved script/MCP commands; lazy terminal loading |
343
327
  | `session.js`, `commands.js` | Cloud actions, prompts, recovery and view facts |
344
- | `client.js` | Public API, auth transport, validated records, sources, controls and cursor replay |
328
+ | `client.js`, `wire.js` | Public API, auth transport, sources and cursor replay; wire v6 event and record validation |
345
329
  | `credentials.js`, `folders.js`, `store.js` | Existing login, account/folder metadata and atomic persistence |
346
330
  | `localfiles.js` | Grants, anchored reads/writes, exclusions/scan, local lock, admission/save journals and recovery |
347
331
  | `input.js`, `terminal.js` | Grapheme-aware composer, paste, signals and the single stdout writer |
@@ -355,10 +339,9 @@ Ink failed the frozen startup budget. Completed output is appended; resize aband
355
339
  geometry so it never guesses how many reflowed scrollback lines to erase. Neither view authorizes
356
340
  operations or issues requests itself.
357
341
 
358
- The v5 foreground `local_exec` replaces the proposed companion and local-file seed paths.
359
- Folder links and file grants do not authorize execution. Explicit attach and verified save-new
360
- remain the file transfer doors; command output is not a Lab certification. Native Claude/Codex
361
- handoffs retain their own identity and lifecycle.
342
+ Nothing runs on this computer: a Run executes in Vecteur cloud, and folder links and file grants
343
+ authorize no execution. Explicit attach and verified save-new are the file transfer doors. Native
344
+ Claude/Codex handoffs retain their own identity and lifecycle.
362
345
 
363
346
  The intended platform matrix includes Linux, macOS and Windows Terminal, plus screen-reader
364
347
  qualification. Current evidence and unresolved cases belong in the stage-1 WBS/backlog; Linux
package/bin/vecteur.js CHANGED
@@ -1,19 +1,16 @@
1
1
  #!/usr/bin/env node
2
- import { Executor } from "../src/executor.js";
3
- import { withLocalLock, executionGrant, rootIdentity, qualify } from "../src/localfiles.js";
4
2
  import { readFileSync } from "node:fs";
5
- import { createHash } from "node:crypto";
6
3
 
7
4
  import {
8
5
  CliError, VecteurClient, admittedFailure, configuration, isStateHash, isTokenShaped, redact,
9
- requestTimeout, resolveOrigin, shouldOpenBrowser, waitForDeviceAuthorization, isRequestKey, validateAnswers,
6
+ requestTimeout, resolveOrigin, shouldOpenBrowser, waitForDeviceAuthorization, isRequestKey,
10
7
  } from "../src/client.js";
11
8
  import {
12
9
  clearCredentials, credentialsPath, readCredentials, setCurrentOrigin, writeCredentials, selectProject,
13
10
  } from "../src/credentials.js";
14
- import { downloadArtifact, downloadProjection, exportRun } from "../src/download.js";
11
+ import { downloadArtifact, exportRun } from "../src/download.js";
15
12
  import { humanProjects, resolveNamed, resolveRunProject, resolveWorkspace } from "../src/projects.js";
16
- import { canonicalJson, currentTransferTables, human, stopViewOf, humanCost, progress } from "../src/format.js";
13
+ import { canonicalJson, human, humanCost, progress } from "../src/format.js";
17
14
  import { openBrowser } from "../src/browser.js";
18
15
 
19
16
  function manifest() {
@@ -46,15 +43,14 @@ function refuseOldNode() {
46
43
 
47
44
  function helpText(version) {
48
45
  return `vecteur ${version}
49
- login | logout | whoami | project list | project create <name> [--workspace <name-or-id>] | project use <name-or-id> | project get <id> | run submit [-p <id>] -a <ask> [--parent <state-hash>] | run get <id> | run events <id> | run export <id> [--output <dir>] [-p <id>] | artifact get <id> [--output <path>] [-p <id>] | projection get <run-id> <projection-id> [--output <path>] [-p <id>] | mcp
46
+ login | logout | whoami | project list | project create <name> [--workspace <name-or-id>] | project use <name-or-id> | project get <id> | run submit [-p <id>] -a <ask> [--parent <state-hash>] | run get <id> | run events <id> | run export <id> [--output <dir>] [-p <id>] | artifact get <id> [--output <path>] [-p <id>] | mcp
50
47
  mcp setup claude|codex adds Vecteur to your Claude Code/Codex · handoff claude|codex opens it in this terminal with Vecteur attached
51
48
  status | doctor | (bare vecteur opens an interactive session)
52
49
  --help --version --json --origin <url> --no-browser --offline --plain --no-color --local -p/--project -a/--ask --output <path>
53
50
  update [--check] [--yes] [--origin <url>] updates the executing installation
54
51
  run submit continues the Project's current head; --parent <state-hash> admits it only if that is still the head
55
52
  run submit --no-wait --request-key K [--parent H|none] [--attach PATH…] -p ID -a ASK --json
56
- run answer RUN --clarification ID --answers FILE|- --json
57
- Claude Code/Codex recipe: submit --no-wait --parent H --request-key K --attach PATH…; run get / run events; run answer; run export
53
+ Claude Code/Codex recipe: submit --no-wait --parent H --request-key K --attach PATH…; run get / run events; run export
58
54
  `;
59
55
  }
60
56
 
@@ -83,7 +79,7 @@ function parseCommand(argv) {
83
79
  if (indexes.length > 1) throw new CliError("usage_invalid", "Invalid command grammar");
84
80
  if (indexes.length === 0) return undefined;
85
81
  const index = indexes[0];
86
- if (!value(args[index + 1]) && !(names.includes("--answers") && args[index + 1] === "-")) throw new CliError("usage_invalid", "Invalid command grammar");
82
+ if (!value(args[index + 1])) throw new CliError("usage_invalid", "Invalid command grammar");
87
83
  const option = args[index + 1];
88
84
  args = args.filter((_, i) => i !== index && i !== index + 1);
89
85
  return option;
@@ -112,11 +108,6 @@ function parseCommand(argv) {
112
108
  const output = takeOption("--output");
113
109
  const parent = takeOption("--parent");
114
110
  const noWait = takeFlag("--no-wait"), requestKey = takeOption("--request-key");
115
- const allowExec = takeFlag("--allow-exec");
116
- if (allowExec && (noWait || requestKey !== undefined || args[0] !== "run" || args[1] !== "submit")) {
117
- throw new CliError("usage_invalid", "--allow-exec requires foreground run submit, without --no-wait or --request-key; MCP has no local executor");
118
- }
119
- const clarification = takeOption("--clarification"), answers = takeOption("--answers");
120
111
  if (parent !== undefined && (!(isStateHash(parent) || noWait && parent === "none") || args[0] !== "run" || args[1] !== "submit")) {
121
112
  throw new CliError("usage_invalid", "Invalid command grammar");
122
113
  }
@@ -125,19 +116,14 @@ function parseCommand(argv) {
125
116
  }
126
117
  if (version) return { kind: "version" };
127
118
  if (help) return { kind: "help" };
128
- if (noWait || requestKey !== undefined || paths.length || clarification !== undefined || answers !== undefined) {
119
+ if (noWait || requestKey !== undefined || paths.length) {
129
120
  const common = !noBrowser && !offline && !checkUpdate && !yesUpdate && !plain && !noColor && !local
130
121
  && workspace === undefined && output === undefined;
131
122
  if (common && args.length === 2 && args[0] === "run" && args[1] === "submit" && noWait
132
- && value(ask) && clarification === undefined && answers === undefined) {
123
+ && value(ask)) {
133
124
  if (!isRequestKey(requestKey)) throw new CliError("request_key_invalid", "--request-key requires 8–64 letters, digits, _ or -");
134
125
  return { kind: "run_start", projectId, ask, requestKey, parent: parent === "none" ? null : parent, paths, origin, json };
135
126
  }
136
- if (common && args.length === 3 && args[0] === "run" && args[1] === "answer" && value(args[2])
137
- && value(clarification) && answers !== undefined && !noWait && requestKey === undefined && !paths.length
138
- && projectId === undefined && ask === undefined && parent === undefined) {
139
- return { kind: "run_answer", id: args[2], clarification, answers, origin, json };
140
- }
141
127
  throw new CliError("usage_invalid", "Invalid command grammar");
142
128
  }
143
129
  if (args.length === 1 && args[0] === "update" && !json && !local && !offline && !plain && !noColor
@@ -190,7 +176,7 @@ function parseCommand(argv) {
190
176
  }
191
177
  if (args.length === 2 && args[0] === "run" && args[1] === "submit"
192
178
  && (projectId === undefined || value(projectId)) && value(ask) && output === undefined) {
193
- return { kind: "run_submit", projectId, ask, parent, origin, json, allowExec };
179
+ return { kind: "run_submit", projectId, ask, parent, origin, json };
194
180
  }
195
181
  if (args.length === 3 && args[0] === "run" && args[1] === "get" && value(args[2])
196
182
  && projectId === undefined && ask === undefined && output === undefined) {
@@ -207,10 +193,6 @@ function parseCommand(argv) {
207
193
  && ask === undefined) {
208
194
  return { kind: "artifact_get", id: args[2], projectId, output, origin, json };
209
195
  }
210
- if (args.length === 4 && args[0] === "projection" && args[1] === "get"
211
- && value(args[2]) && value(args[3]) && ask === undefined) {
212
- return { kind: "projection_get", runId: args[2], id: args[3], projectId, output, origin, json };
213
- }
214
196
  throw new CliError("usage_invalid", "Invalid command grammar");
215
197
  }
216
198
 
@@ -311,7 +293,6 @@ async function whoami(command, env = process.env) {
311
293
  async function main() {
312
294
  refuseOldNode();
313
295
  const command = parseCommand(process.argv.slice(2));
314
- if (command.allowExec) qualify();
315
296
  if (command.kind === "version") {
316
297
  process.stdout.write(`vecteur ${manifest().version}\n`);
317
298
  return;
@@ -416,17 +397,6 @@ async function main() {
416
397
  + value.files.map(file => ` ${file.path} · ${file.bytes} bytes${file.cas_ref ? " · verified" : ""}\n`).join(""));
417
398
  return;
418
399
  }
419
- else if (command.kind === "projection_get") {
420
- const projectId = await resolveRunProject(client, command.projectId);
421
- const run = await client.runGet(command.runId);
422
- const matches = run.events.filter(event => event.kind === "engineering_projection"
423
- && event.payload?.projection_id === command.id && event.payload?.kind === "transfer_table");
424
- if (matches.length !== 1) throw new CliError("projection_invalid", "Run has no unique transfer table projection");
425
- value = await downloadProjection(client, projectId, command.runId, matches[0].payload, command.output);
426
- process.stdout.write(command.json ? canonicalJson(value)
427
- : `Downloaded ${value.bytes} bytes to ${value.path} (${value.content_type}; ${value.disposition})\n`);
428
- return;
429
- }
430
400
  else if (command.kind === "run_start") {
431
401
  const projectId = await resolveRunProject(client, command.projectId);
432
402
  value = await client.runStartLocal(projectId, command.ask, { requestKey: command.requestKey,
@@ -434,78 +404,37 @@ async function main() {
434
404
  process.stdout.write(canonicalJson(value));
435
405
  return;
436
406
  }
437
- else if (command.kind === "run_answer") {
438
- let answers;
439
- try { answers = JSON.parse(readFileSync(command.answers === "-" ? 0 : command.answers, "utf8")); }
440
- catch { throw new CliError("answers_invalid", "--answers must name a readable JSON answer array, or - for stdin"); }
441
- value = await client.clarificationAnswer(command.id, command.clarification, validateAnswers(answers));
442
- process.stdout.write(canonicalJson(value));
443
- return;
444
- }
445
407
  else if (command.kind === "run_submit") {
446
- const projectId = await resolveRunProject(client, command.projectId);
447
- let executor;
448
- if (command.allowExec) {
449
- const project = await client.projectGet(projectId);
450
- const pin = { origin: client.config.origin, accountId: "credential:" + createHash("sha256").update(client.config.token).digest("hex"), projectId, role: project.role,
451
- root: rootIdentity(process.cwd()), provenance: "invocation", credential: { token: client.config.token,
452
- kind: process.env.VECTEUR_TOKEN ? "environment" : "stored" } };
453
- const grant = await withLocalLock(() => executionGrant(pin));
454
- executor = new Executor({ client, grant, pin: () => pin, session: true });
455
- }
456
- value = await client.runSubmit(projectId, command.ask, onEvent, undefined, command.parent, undefined, undefined, executor);
457
- if (!command.json) {
458
- try {
459
- const currentTransferIds = await verifiedTransferIds(client, value);
460
- const stopped = stopViewOf(value.events);
461
- const stopOffer = stopped ? await client.stopOffer(value.run_id) : undefined;
462
- if (stopped?.cause === "plan_limit") await client.stopEvent(value.run_id, { event: "shown", surface: "cli" });
463
- process.stdout.write(human(value, { projectId, currentTransferIds, stopOffer, origin: config.origin }));
464
- // A stop states the limit that fired; "22 % used" below it reads as a contradiction (record §3). `vecteur` usage stays one command away.
465
- if (!stopped) {
466
- const cost = await client.customerCost(projectId);
467
- process.stdout.write(`\n${humanCost(cost)}`);
468
- }
469
- } catch (error) {
470
- throw admittedFailure(error, value.run_id);
471
- }
472
- return;
473
- }
408
+ renderOptions = { projectId: await resolveRunProject(client, command.projectId) };
409
+ value = await client.runSubmit(renderOptions.projectId, command.ask, onEvent, undefined, command.parent);
474
410
  } else if (command.kind === "run_get") value = await client.runGet(command.id);
475
411
  else value = await client.runEvents(command.id, onEvent);
476
- if (!command.json && !renderOptions.projectId && config.projectId) {
477
- renderOptions = { projectId: config.projectId };
478
- }
479
- if (!command.json && Array.isArray(value?.events)) {
480
- renderOptions.currentTransferIds = await verifiedTransferIds(client, value);
481
- const stopped = stopViewOf(value.events);
482
- if (stopped) {
412
+ if (command.json) { process.stdout.write(canonicalJson(value)); return; }
413
+ if (!Array.isArray(value?.events)) { process.stdout.write(human(value)); return; }
414
+ try {
415
+ renderOptions.projectId ??= config.projectId;
416
+ renderOptions.origin = config.origin;
417
+ // At a limit the server says what this reader may do; the stop card states the limit, so the usage block gives way to it.
418
+ if (value.terminal === "budget") {
483
419
  renderOptions.stopOffer = await client.stopOffer(value.run_id);
484
- if (stopped.cause === "plan_limit") await client.stopEvent(value.run_id, { event: "shown", surface: "cli" });
420
+ if (renderOptions.stopOffer) await client.stopEvent(value.run_id, { event: "shown", surface: "cli" });
485
421
  }
486
- renderOptions.origin = config.origin;
422
+ // The settled Run is printed first: a later cost read may fail loudly, never erase the answer.
423
+ process.stdout.write(human(value, renderOptions));
424
+ if (command.kind === "run_submit" && value.terminal !== "budget") {
425
+ process.stdout.write(`\n${humanCost(await client.customerCost(renderOptions.projectId))}`);
426
+ }
427
+ } catch (error) {
428
+ throw command.kind === "run_submit" ? admittedFailure(error, value.run_id) : error;
487
429
  }
488
- process.stdout.write(command.json ? canonicalJson(value) : human(value, renderOptions));
489
- }
490
-
491
- async function verifiedTransferIds(client, run) {
492
- const ids = new Set();
493
- for (const projection of currentTransferTables(run.events ?? [])) {
494
- const read = await client.projectionGet(
495
- projection.project_id, run.run_id, projection, async () => {},
496
- );
497
- if (read.disposition === "current") ids.add(projection.projection_id);
498
- }
499
- return ids;
500
430
  }
501
431
 
502
- // Skip option values when identifying the new doors: a legacy ask containing "answer"
503
- // must still print the legacy error bytes, including on a parser/configuration failure.
432
+ // The detached door (`run submit --no-wait`) reports failures as JSON; option values are skipped when identifying it.
504
433
  function lifecycleInvocation(argv) {
505
434
  const tokens = [];
506
435
  let noWait = false;
507
436
  const options = new Set(["--origin", "--project", "-p", "--ask", "-a", "--workspace", "--output", "--parent",
508
- "--request-key", "--clarification", "--answers"]);
437
+ "--request-key"]);
509
438
  for (let i = 0; i < argv.length; i++) {
510
439
  if (options.has(argv[i])) { i++; continue; }
511
440
  if (argv[i] === "--no-wait") { noWait = true; continue; }
@@ -515,7 +444,7 @@ function lifecycleInvocation(argv) {
515
444
  }
516
445
  if (!argv[i].startsWith("-")) tokens.push(argv[i]);
517
446
  }
518
- return tokens[0] === "run" && (tokens[1] === "answer" || tokens[1] === "submit" && noWait);
447
+ return tokens[0] === "run" && tokens[1] === "submit" && noWait;
519
448
  }
520
449
 
521
450
  main().catch((error) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vecteur/cli",
3
- "version": "0.11.1",
3
+ "version": "0.12.4",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "vecteur": "bin/vecteur.js"
@@ -10,18 +10,18 @@
10
10
  "bin/vecteur.js",
11
11
  "src/client.js",
12
12
  "src/contract.js",
13
+ "src/wire.js",
13
14
  "src/credentials.js",
14
15
  "src/download.js",
15
- "src/produce.js",
16
16
  "src/exchange.js",
17
17
  "src/errors.js",
18
18
  "src/format.js",
19
+ "src/stop-words.js",
19
20
  "src/mcp.js",
20
21
  "src/projects.js",
21
22
  "src/store.js",
22
23
  "src/folders.js",
23
24
  "src/localfiles.js",
24
- "src/executor.js",
25
25
  "src/browser.js",
26
26
  "src/blocks.js",
27
27
  "src/session.js",