@vecteur/cli 0.9.1 → 0.11.1
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 +224 -15
- package/bin/vecteur.js +107 -10
- package/package.json +5 -1
- package/src/blocks.js +201 -6
- package/src/client.js +280 -29
- package/src/commands.js +56 -15
- package/src/contract.js +35 -7
- package/src/credentials.js +8 -0
- package/src/errors.js +4 -1
- package/src/exchange.js +85 -0
- package/src/executor.js +171 -0
- package/src/folders.js +28 -2
- package/src/format.js +332 -28
- package/src/input.js +22 -3
- package/src/localfiles.js +788 -0
- package/src/mcp.js +143 -9
- package/src/produce.js +49 -0
- package/src/session.js +697 -104
- package/src/terminal.js +189 -54
- package/src/tui/view.js +342 -124
package/README.md
CHANGED
|
@@ -13,6 +13,16 @@ 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.
|
|
25
|
+
|
|
16
26
|
For scripts and explicit one-shot commands:
|
|
17
27
|
|
|
18
28
|
```bash
|
|
@@ -48,7 +58,7 @@ login. `project list --json` preserves `{projects, active_projects, selected_pro
|
|
|
48
58
|
Run's `state_hash`) and submits the next turn on it, so two submits in a row are two turns of one
|
|
49
59
|
study, exactly as in the web app. A new Project's first turn has no head. `--parent STATE_HASH`
|
|
50
60
|
skips the read and admits the turn only if that hash is still the head. The CLI never forks a
|
|
51
|
-
Project and never retries: a moved head exits `state_fork` naming the current head, and a Project
|
|
61
|
+
Project and never automatically retries: a moved head exits `state_fork` naming the current head, and a Project
|
|
52
62
|
whose Run is still open exits `state_busy` naming that Run (and, when it waits on a question, the
|
|
53
63
|
web address where it can be answered). Nothing is admitted in either case. Once a turn is admitted,
|
|
54
64
|
any later failure names the Run: check it with `vecteur run get RUN_ID` instead of submitting
|
|
@@ -65,7 +75,10 @@ downloads use the Project-scoped admitted CAS route, verify the declared length,
|
|
|
65
75
|
SHA-256, and refuse to overwrite a local path. Use `--project ID` when no Project is selected.
|
|
66
76
|
|
|
67
77
|
`vecteur mcp` serves MCP over stdio using the same credentials and public client. It exposes
|
|
68
|
-
`vecteur_project_get`, `vecteur_run_submit`, `vecteur_run_get` and `
|
|
78
|
+
`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
|
+
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.
|
|
69
82
|
An MCP host supplies tool arguments; stdout carries only MCP protocol.
|
|
70
83
|
|
|
71
84
|
`vecteur mcp setup claude` (or `codex`) runs that vendor's own `mcp add` once so your Claude Code
|
|
@@ -79,9 +92,85 @@ mode in which the vendor session appears inside Vecteur's TUI and web.
|
|
|
79
92
|
new folder: `answer.md` (exact answer bytes), `run.json` (the canonical record) and every artifact,
|
|
80
93
|
each verified against its SHA-256 CAS id. Nothing is overwritten.
|
|
81
94
|
|
|
95
|
+
## Claude Code and Codex: attach, poll, answer, export
|
|
96
|
+
|
|
97
|
+
Both vendors use the same lifecycle recipe. Sign in to Vecteur and to your vendor separately;
|
|
98
|
+
use `vecteur mcp setup claude` / `vecteur handoff claude`, or substitute `codex`. The installed
|
|
99
|
+
vendor command and its own permissions apply. These recipes have packed CLI/MCP fake-server
|
|
100
|
+
coverage; interactive Claude Code/Codex handoff acceptance is not yet recorded. Vecteur Runs
|
|
101
|
+
use your Vecteur plan; the generalist uses its own provider and billing. Data returned to the
|
|
102
|
+
generalist goes to that assistant's provider.
|
|
103
|
+
|
|
104
|
+
From the folder containing your inputs, choose the Project and pin its last Run's `state_hash`
|
|
105
|
+
as `H` (a 64-character lowercase hex hash). For a Project with no Run, use `--parent none`.
|
|
106
|
+
Choose a fresh request key of 8–64 letters, digits, `_` or `-`, then keep the command unchanged
|
|
107
|
+
for retries:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
vecteur run submit --no-wait --parent "$H" --request-key orbit-20261107-01 \
|
|
111
|
+
--attach orbit.csv requirements.txt -p PROJECT_ID --ask 'Plot this orbit' --json
|
|
112
|
+
# Read run_id from the acknowledgment, then poll until terminal is nonempty:
|
|
113
|
+
vecteur run get RUN_ID --json
|
|
114
|
+
# Optional validated event replay (the stream has the configured request timeout):
|
|
115
|
+
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
|
|
119
|
+
vecteur run export RUN_ID -p PROJECT_ID --output orbit-result --json
|
|
120
|
+
```
|
|
121
|
+
|
|
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
|
+
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.
|
|
136
|
+
|
|
137
|
+
`--attach` is explicit consent to upload exactly those files to the command's explicit or
|
|
138
|
+
selected Project at the authenticated origin, for Vecteur cloud and the Run's model provider.
|
|
139
|
+
It replaces inherited sources. The invocation grant is never persisted and does not change a
|
|
140
|
+
folder binding or saved Project selection. Paths must be inside the working folder; the same
|
|
141
|
+
Linux/Node qualification, exclusions, no-symlink reader, secret scan, eight-file, 8 MiB/file and
|
|
142
|
+
32 MiB total limits as interactive selection apply. All extracts are selected. An unsafe member
|
|
143
|
+
of the initial set refuses before any file uploads. Neither filenames nor local paths enter
|
|
144
|
+
the admission/upload bodies. `--attach` applies only to `run submit --no-wait`.
|
|
145
|
+
|
|
146
|
+
With explicit `--parent H|none`, the CLI writes the exact admission body (ask, parent, source
|
|
147
|
+
handles and selections) before dispatch, in a no-overwrite 0600 `request-<key-digest>.json` file
|
|
148
|
+
beside `credentials.json`. Retain that file for recovery. A retry with the same command reuses
|
|
149
|
+
its handles without rereading local files or the head, even if both changed. Changing the ask,
|
|
150
|
+
parent, Project or attachment set with the same key refuses `request_key_reused`. The shared
|
|
151
|
+
admission-intent journal remains in force through a dropped response or killed process.
|
|
152
|
+
|
|
153
|
+
Without `--parent`, the client resolves the head once and reports that parent in its response
|
|
154
|
+
or admission error. This convenience mode has no frozen request file. An interrupted request
|
|
155
|
+
without that file remains `admission_unresolved`; a conflicting same-key retry also reports
|
|
156
|
+
`admission_unresolved`. Inspect Project history before choosing a new key. No newest Run is
|
|
157
|
+
presented as recovered, and the client never generates a replacement key. Transport, timeout,
|
|
158
|
+
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
|
|
160
|
+
(`code`, `message`, optional `run_id`, `request_key`, `parent_state_hash`); stdout holds only the
|
|
161
|
+
success record. Existing blocking CLI and MCP success outputs and CLI error bytes are preserved;
|
|
162
|
+
MCP errors may additionally name an admitted `run_id`.
|
|
163
|
+
|
|
164
|
+
`run export` and `artifact get` keep their verified no-overwrite behavior. New MCP local-file
|
|
165
|
+
tools (`vecteur_input_add`, `vecteur_artifact_save`) remain gated on integration-doors §6.1.
|
|
166
|
+
|
|
82
167
|
## Interactive session
|
|
83
168
|
|
|
84
|
-
Enter sends; Ctrl+J or Alt+Enter inserts a line.
|
|
169
|
+
Enter sends; Ctrl+J or Alt+Enter inserts a line. In rich mode, bracketed paste is one edit and never sends.
|
|
170
|
+
Plain mode and `TERM=dumb` emit no escape bytes: only an input read consisting exactly of CR or
|
|
171
|
+
CRLF submits. A read containing text before its final CR/CRLF stays a draft; all CR/CRLF delimiters
|
|
172
|
+
in that read become newlines. An unmarked paste split into a lone CR/CRLF read can therefore
|
|
173
|
+
submit early; coalesced text and Enter stay in the draft.
|
|
85
174
|
The rich view uses normal terminal scrollback. `vecteur --plain` gives a linear view;
|
|
86
175
|
`NO_COLOR=1 vecteur` or `--no-color` removes styling. `TERM=dumb` selects the linear view.
|
|
87
176
|
Bare invocation in a pipe or CI keeps the previous status output; `vecteur status` always prints it.
|
|
@@ -91,19 +180,62 @@ Bare invocation in a pipe or CI keeps the previous status output; `vecteur statu
|
|
|
91
180
|
the current Project or names the one created on first send. `/history` loads older Runs on demand.
|
|
92
181
|
- `/model` selects the next Run's model or route from the matched server catalogue. `/mode`
|
|
93
182
|
explains leadership, execution location and payer. Stage 1 runs in Vecteur cloud.
|
|
94
|
-
-
|
|
95
|
-
|
|
96
|
-
|
|
183
|
+
- `@` completes local paths. A whole filename in your ask offers attachment after local
|
|
184
|
+
checks (at most three offers; ambiguous basenames list choices).
|
|
185
|
+
A refused name prints `name: not offered (reason)` and asks whether to send without it.
|
|
186
|
+
Without a grant, ordinary named files are offered by name and size without reading
|
|
187
|
+
their content. Accepting an offer leads to the common first-use permission card; only after
|
|
188
|
+
confirmation is content read and scanned. Credential-shaped content refuses `secret_suspected`
|
|
189
|
+
before upload. With a grant, content is also checked before offering.
|
|
190
|
+
Directory listings and ignore-policy reads stay local.
|
|
191
|
+
`/attach <path>` selects metadata inside the session folder, including before its first send.
|
|
192
|
+
Absolute paths must lie inside that folder; outside paths now refuse `outside_folder`.
|
|
193
|
+
First send asks for `select` and `save-new` permission, naming the folder, Project and origin.
|
|
194
|
+
Send-first and save cards print their full disclosure and every file's selection state to
|
|
195
|
+
scrollback once on opening; a short question and its choices stay live.
|
|
196
|
+
Nothing leaves this computer unless you confirm it. Selected content uploads to Vecteur cloud
|
|
197
|
+
and the Run's model provider route; local residency is not guaranteed. The composer states
|
|
198
|
+
the upload destination. Declining keeps the draft and selections and reads no selected content.
|
|
199
|
+
Up to eight files, **8 MiB each** (reduced from 16 MiB) and 32 MiB total; all available extracts
|
|
200
|
+
are selected. `/clear-files` removes pending selections. A retry of an admitted upload uses
|
|
201
|
+
its frozen source handle and never rereads the local file.
|
|
97
202
|
- `/answer` handles clarification, including multiple choices and custom text. `/steer <text>`
|
|
98
203
|
and `/answer-now` submit instructions; acceptance is distinct from execution.
|
|
99
204
|
- `/cancel` or double Esc requests cloud Run cancellation. Ctrl+D on an empty composer or
|
|
100
205
|
`/quit` detaches; the cloud Run continues. Ctrl+C clears a nonempty composer.
|
|
101
|
-
- `/
|
|
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
|
+
- After a terminal head Run, a save-new prompt offers absent artifact paths, including missing
|
|
208
|
+
parent directories. Identical bytes preselect the shortest path; `d` shows every path and
|
|
209
|
+
lets you choose any. `yes` installs verified bytes without overwriting, `n` declines.
|
|
210
|
+
This writes once; it makes no synchronization or latest-version promise.
|
|
211
|
+
`/files revoke` ends local permission and withdraws pending proposals. Unlink, any bind/relink
|
|
212
|
+
(even to the same Project and with an explicit session selection), another `/project`, logout
|
|
213
|
+
and root replacement also end permission. `/project` without linking works with fresh consent.
|
|
214
|
+
When a returned path already exists, Vecteur offers a separate proposal:
|
|
215
|
+
`<path>.vecteur-<run8>-<rev>` (collision suffixes `-1` through `-99`). The original is kept.
|
|
216
|
+
Before local read consent, inspection uses metadata only. First-use approval permits the
|
|
217
|
+
comparison, then an informed proposal confirmation; `d` also requires explicit read consent.
|
|
218
|
+
Revoked permission requires fresh consent for `/files diff N`.
|
|
219
|
+
`d` displays `local now → proposed` and, when retained, `base → local now`; diffs are bounded
|
|
220
|
+
and sanitized. The prompt labels **clean**, **local changed**, or **first sync**; identical
|
|
221
|
+
bytes need no write. A target edit or deletion before the approval commits withdraws it,
|
|
222
|
+
refreshes the comparison and requires fresh confirmation. This check does not lock your editor.
|
|
223
|
+
Review and adopt using your own editor or the printed `mv -i -- …` command. Vecteur never
|
|
224
|
+
replaces, renames, moves or deletes the original or a published proposal. `/files` lists
|
|
225
|
+
proposals and `/files diff N` compares their recorded CAS bytes with the current original.
|
|
226
|
+
Adoption is observed when the original matches a recorded proposal, including after restart
|
|
227
|
+
or adoption by move. The next unchanged turn then compares with that adopted baseline.
|
|
228
|
+
Uploaded, saved, adopted and previously observed existing paths are never automatically offered again after deletion, even with changed bytes;
|
|
229
|
+
`/files save N` explicitly offers one again. History is scoped to origin/account/root/Project.
|
|
230
|
+
Cloud and pending `/files` rows remain available when local authority is unavailable (including
|
|
231
|
+
Viewer access and unqualified platforms); optional local observation reports a notice.
|
|
232
|
+
`/files` lists inputs/outputs; `/download <number> [path]` verifies bytes and refuses overwrite.
|
|
102
233
|
`/copy [path]` preserves the exact answer: terminal clipboard when supported, otherwise a file.
|
|
103
234
|
- `/resume` reconciles an interrupted submission using its original identity, or follows the
|
|
104
235
|
same Run from its validated event cursor. A moved head requires an explicit new send.
|
|
105
236
|
Unknown admission remains pending if authority or transport prevents reconciliation.
|
|
106
|
-
- `/details [number]
|
|
237
|
+
- `Ctrl+O` and `/details [number]` print the full human tool block (changed files, excerpts and code summary).
|
|
238
|
+
- `/web`, `/doctor` and `/help` expose details, browser access, diagnostics
|
|
107
239
|
and commands. Updates are manual; an incompatible origin supplies its required install command.
|
|
108
240
|
|
|
109
241
|
Folder links are scoped by origin, authenticated account and canonical directory identity.
|
|
@@ -120,10 +252,87 @@ overwrite another editor, and admission consumes only its exact draft revision.
|
|
|
120
252
|
request evidence stays until resolved. Account draft recovery requires the same credential fingerprint
|
|
121
253
|
previously bound by a successful account read. Never-signed-in drafts occupy a separate unsigned
|
|
122
254
|
namespace with no Project authority; only explicit login transfers them into an account. Neither
|
|
123
|
-
recovery path grants server access.
|
|
124
|
-
|
|
255
|
+
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
|
|
125
257
|
rewriting it. Previous CLI versions ignore the separate folder registry.
|
|
126
258
|
|
|
259
|
+
## Local file authority limits
|
|
260
|
+
|
|
261
|
+
Selection and automatic save-new require **Linux and Node >=20.8**. Other platforms and older
|
|
262
|
+
Node versions refuse these capabilities with `platform_unqualified`; cloud commands still work.
|
|
263
|
+
A folder link supplies no permission. Viewer Projects cannot acquire file authority, upload
|
|
264
|
+
inputs, admit Runs or retry them; the server checks EDITOR for both cookies and PATs, and checks
|
|
265
|
+
EDITOR before fetching a Drive import.
|
|
266
|
+
|
|
267
|
+
The fixed exclusions cover credential/vendor directories, `.git`, `.env*`, private-key names,
|
|
268
|
+
`node_modules` and the CLI store; nested `.gitignore`, `.vecteurignore` and root `.git/info/exclude`
|
|
269
|
+
apply with git precedence. A `.git` gitfile is denied and never followed; it supplies no
|
|
270
|
+
`.git/info/exclude`. Unknown/unreadable policy excludes its subtree. If optional filename
|
|
271
|
+
discovery is unavailable, the CLI says so and a plain ask still submits without offers.
|
|
272
|
+
Global `core.excludesFile` is not read. Symlinks, hardlinks, devices, FIFOs, path escapes and detected folder moves refuse.
|
|
273
|
+
Local file authority uploads only strict UTF-8 (with or without BOM) or UTF-16LE/BE text
|
|
274
|
+
with a BOM, with these extensions:
|
|
275
|
+
`.txt`, `.md`, `.csv`, `.json`, `.py`, `.m`, `.jl`, `.r`, `.c`, `.h`, `.cpp`, `.f90`,
|
|
276
|
+
`.toml`, `.yaml`, `.yml`, `.ini`, `.cfg`, `.tex`, `.rst` (case-insensitive).
|
|
277
|
+
A BOM selects exactly its declared encoding; invalid text refuses `scan_unsupported`.
|
|
278
|
+
Without a BOM, only strict UTF-8 is decoded: no encoding heuristics or fallback are used.
|
|
279
|
+
BOM-less UTF-16 is unsupported; export it as UTF-8 or include a UTF-16 BOM.
|
|
280
|
+
Credential shapes are scanned in raw bytes and in a copy of the decoded text with control
|
|
281
|
+
(except tab, CR and LF) and zero-width/format characters removed. Uploaded bytes remain unchanged.
|
|
282
|
+
|
|
283
|
+
**PDF is refused in this slice** (`scan_unsupported`), by `.pdf` extension or `%PDF-` content
|
|
284
|
+
signature anywhere in the file, including after a preamble and under another filename.
|
|
285
|
+
**DOCX and ZIP/OOXML containers are refused** (`scan_unsupported`), by extension or ZIP content
|
|
286
|
+
signature (`PK\x03\x04` anywhere in the file), including under a `.txt` filename. Their reading
|
|
287
|
+
order cannot yet be checked reliably for credentials before upload. Upload Word/PDF files in
|
|
288
|
+
the web app, or attach a text/CSV/Markdown export. No ZIP/XML document scanner is used.
|
|
289
|
+
Other extensions, invalid text encodings and uninspectable binary representations also refuse.
|
|
290
|
+
False positives refuse. This is a bounded representation/pattern check, not a guarantee that every
|
|
291
|
+
secret can be recognized. No local filename or absolute path is added to an upload body.
|
|
292
|
+
|
|
293
|
+
`local-grants.json` records permission generations and pending consent metadata; `local-writes.json`
|
|
294
|
+
records upload evidence, save intents, proposal-to-original/CAS mappings, per-path baseline hashes
|
|
295
|
+
and provenance, observed-existence tombstones and unresolved non-session admissions.
|
|
296
|
+
Grant revocation is fsynced before link/logout metadata and automatic Project binding; a
|
|
297
|
+
journalled revocation intent also blocks old grants and consent if the grant-store write fails or is interrupted.
|
|
298
|
+
Both are private local stores beside `folders.json`. Local admissions and file operations share
|
|
299
|
+
an async, non-reentrant lock in the order local lock → short store lock. **Design deviation:**
|
|
300
|
+
a realpath-canonical Linux abstract Unix socket replaces the spec's literal lock file so SIGKILL
|
|
301
|
+
releases exclusion in the kernel. Another same-user process contends across XDG aliases; another
|
|
302
|
+
OS user in the same network namespace could squat the name (denial of service).
|
|
303
|
+
|
|
304
|
+
Exact baseline bytes are retained privately in `local-bases/<sha256>` beside these stores, mode
|
|
305
|
+
0600, up to 8 MiB per file and 256 MiB total; oldest snapshots are evicted first. Reads verify the
|
|
306
|
+
digest. If a snapshot is evicted, missing or corrupt, hash-based conflict status remains and the
|
|
307
|
+
display says the base diff is unavailable. Edited proposal files are never used to reconstruct a
|
|
308
|
+
baseline. The code/text extensions `.py .m .jl .r .c .h .cpp .f90 .toml .yaml .yml .ini .cfg .tex .rst`
|
|
309
|
+
upload as `text/plain`, with the same strict content scan. Extract-based upload does not establish
|
|
310
|
+
whole-file model fidelity: fixture J3 runs prove delivery and user adoption mechanically; model-quality
|
|
311
|
+
J3 remains UNKNOWN until the installed literal model run.
|
|
312
|
+
|
|
313
|
+
Downloads finish and verify length, digest and kind-specific media in memory before any local
|
|
314
|
+
mutation. Fsynced intents precede directory/staging creation, writes, publication and cleanup.
|
|
315
|
+
Restart checks root and inode ownership; the post-link two-name state removes its recorded staging
|
|
316
|
+
link before completing. Replacements and unexplained hardlinks are retained and reported.
|
|
317
|
+
A mkdir interrupted before its inode was recorded is retained with
|
|
318
|
+
`may have been created by an interrupted save`; unconditional empty-folder crash cleanup is not promised.
|
|
319
|
+
An unsafe/partial installation reports `install_unverified`, with cleaned and remaining paths.
|
|
320
|
+
The older short store-lock recovery message still applies to `store.js` writes themselves.
|
|
321
|
+
|
|
322
|
+
A save refuses `admission_unresolved, resolve it with /resume` before reading the head while any
|
|
323
|
+
folder's pending admission or the command/MCP admission journal is unresolved for that origin/Project.
|
|
324
|
+
`/resume` retries the exact persisted request/key through the active credential; failed authorization
|
|
325
|
+
keeps the intent unresolved. A local lock cannot fence web/other-machine admissions after the head
|
|
326
|
+
read: that residual window is the local installation sequence, with no network wait. Hostile
|
|
327
|
+
same-OS-user directory/name swaps between the last identity check and a syscall remain a TOCTOU
|
|
328
|
+
limit; identity-checked cleanup has the same last-check race. Node provides no openat2/linkat/flock
|
|
329
|
+
boundary for eliminating it here. The TUI has no `--project` attachment door;
|
|
330
|
+
`run submit --no-wait -p OTHER --attach ...` grants only that invocation's explicit destination.
|
|
331
|
+
|
|
332
|
+
Explicit `/download`, `/copy`, `/export`, `artifact get`, `run export`, `/package`, `/run-package`
|
|
333
|
+
and MCP `materialAttach` retain their own consent/ownership boundaries. They are not uses of the
|
|
334
|
+
new persistent local grant; MCP attachment remains the integration-doors owner.
|
|
335
|
+
|
|
127
336
|
## Maintainer boundaries and later stages
|
|
128
337
|
|
|
129
338
|
One package, one session owner, two views; stage 1 has no daemon or second application.
|
|
@@ -134,6 +343,7 @@ One package, one session owner, two views; stage 1 has no daemon or second appli
|
|
|
134
343
|
| `session.js`, `commands.js` | Cloud actions, prompts, recovery and view facts |
|
|
135
344
|
| `client.js` | Public API, auth transport, validated records, sources, controls and cursor replay |
|
|
136
345
|
| `credentials.js`, `folders.js`, `store.js` | Existing login, account/folder metadata and atomic persistence |
|
|
346
|
+
| `localfiles.js` | Grants, anchored reads/writes, exclusions/scan, local lock, admission/save journals and recovery |
|
|
137
347
|
| `input.js`, `terminal.js` | Grapheme-aware composer, paste, signals and the single stdout writer |
|
|
138
348
|
| `tui/view.js`, `blocks.js` | Rich layout and Run presentation; plain view uses the same session facts |
|
|
139
349
|
| `markdown.js`, `contract.js` | Generated parser/contracts; no runtime web or SDK import |
|
|
@@ -145,11 +355,10 @@ Ink failed the frozen startup budget. Completed output is appended; resize aband
|
|
|
145
355
|
geometry so it never guesses how many reflowed scrollback lines to erase. Neither view authorizes
|
|
146
356
|
operations or issues requests itself.
|
|
147
357
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
discovery or local execution capability ships in this package.
|
|
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.
|
|
153
362
|
|
|
154
363
|
The intended platform matrix includes Linux, macOS and Windows Terminal, plus screen-reader
|
|
155
364
|
qualification. Current evidence and unresolved cases belong in the stage-1 WBS/backlog; Linux
|
package/bin/vecteur.js
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { Executor } from "../src/executor.js";
|
|
3
|
+
import { withLocalLock, executionGrant, rootIdentity, qualify } from "../src/localfiles.js";
|
|
2
4
|
import { readFileSync } from "node:fs";
|
|
5
|
+
import { createHash } from "node:crypto";
|
|
3
6
|
|
|
4
7
|
import {
|
|
5
8
|
CliError, VecteurClient, admittedFailure, configuration, isStateHash, isTokenShaped, redact,
|
|
6
|
-
requestTimeout, resolveOrigin, shouldOpenBrowser, waitForDeviceAuthorization,
|
|
9
|
+
requestTimeout, resolveOrigin, shouldOpenBrowser, waitForDeviceAuthorization, isRequestKey, validateAnswers,
|
|
7
10
|
} from "../src/client.js";
|
|
8
11
|
import {
|
|
9
12
|
clearCredentials, credentialsPath, readCredentials, setCurrentOrigin, writeCredentials, selectProject,
|
|
10
13
|
} from "../src/credentials.js";
|
|
11
14
|
import { downloadArtifact, downloadProjection, exportRun } from "../src/download.js";
|
|
12
15
|
import { humanProjects, resolveNamed, resolveRunProject, resolveWorkspace } from "../src/projects.js";
|
|
13
|
-
import { canonicalJson, currentTransferTables, human, humanCost, progress } from "../src/format.js";
|
|
16
|
+
import { canonicalJson, currentTransferTables, human, stopViewOf, humanCost, progress } from "../src/format.js";
|
|
14
17
|
import { openBrowser } from "../src/browser.js";
|
|
15
18
|
|
|
16
19
|
function manifest() {
|
|
@@ -49,6 +52,9 @@ function helpText(version) {
|
|
|
49
52
|
--help --version --json --origin <url> --no-browser --offline --plain --no-color --local -p/--project -a/--ask --output <path>
|
|
50
53
|
update [--check] [--yes] [--origin <url>] updates the executing installation
|
|
51
54
|
run submit continues the Project's current head; --parent <state-hash> admits it only if that is still the head
|
|
55
|
+
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
|
|
52
58
|
`;
|
|
53
59
|
}
|
|
54
60
|
|
|
@@ -77,11 +83,19 @@ function parseCommand(argv) {
|
|
|
77
83
|
if (indexes.length > 1) throw new CliError("usage_invalid", "Invalid command grammar");
|
|
78
84
|
if (indexes.length === 0) return undefined;
|
|
79
85
|
const index = indexes[0];
|
|
80
|
-
if (!value(args[index + 1])) throw new CliError("usage_invalid", "Invalid command grammar");
|
|
86
|
+
if (!value(args[index + 1]) && !(names.includes("--answers") && args[index + 1] === "-")) throw new CliError("usage_invalid", "Invalid command grammar");
|
|
81
87
|
const option = args[index + 1];
|
|
82
88
|
args = args.filter((_, i) => i !== index && i !== index + 1);
|
|
83
89
|
return option;
|
|
84
90
|
};
|
|
91
|
+
const paths = [];
|
|
92
|
+
while (args.includes("--attach")) {
|
|
93
|
+
const index = args.indexOf("--attach");
|
|
94
|
+
let end = index + 1;
|
|
95
|
+
while (value(args[end])) paths.push(args[end++]);
|
|
96
|
+
if (end === index + 1) throw new CliError("usage_invalid", "--attach requires explicit paths");
|
|
97
|
+
args.splice(index, end - index);
|
|
98
|
+
}
|
|
85
99
|
const version = takeFlag("--version");
|
|
86
100
|
const help = takeFlag("--help");
|
|
87
101
|
const json = takeFlag("--json");
|
|
@@ -97,7 +111,13 @@ function parseCommand(argv) {
|
|
|
97
111
|
const workspace = takeOption("--workspace");
|
|
98
112
|
const output = takeOption("--output");
|
|
99
113
|
const parent = takeOption("--parent");
|
|
100
|
-
|
|
114
|
+
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
|
+
if (parent !== undefined && (!(isStateHash(parent) || noWait && parent === "none") || args[0] !== "run" || args[1] !== "submit")) {
|
|
101
121
|
throw new CliError("usage_invalid", "Invalid command grammar");
|
|
102
122
|
}
|
|
103
123
|
if (args.some((arg) => typeof arg === "string" && arg.startsWith("-"))) {
|
|
@@ -105,6 +125,21 @@ function parseCommand(argv) {
|
|
|
105
125
|
}
|
|
106
126
|
if (version) return { kind: "version" };
|
|
107
127
|
if (help) return { kind: "help" };
|
|
128
|
+
if (noWait || requestKey !== undefined || paths.length || clarification !== undefined || answers !== undefined) {
|
|
129
|
+
const common = !noBrowser && !offline && !checkUpdate && !yesUpdate && !plain && !noColor && !local
|
|
130
|
+
&& workspace === undefined && output === undefined;
|
|
131
|
+
if (common && args.length === 2 && args[0] === "run" && args[1] === "submit" && noWait
|
|
132
|
+
&& value(ask) && clarification === undefined && answers === undefined) {
|
|
133
|
+
if (!isRequestKey(requestKey)) throw new CliError("request_key_invalid", "--request-key requires 8–64 letters, digits, _ or -");
|
|
134
|
+
return { kind: "run_start", projectId, ask, requestKey, parent: parent === "none" ? null : parent, paths, origin, json };
|
|
135
|
+
}
|
|
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
|
+
throw new CliError("usage_invalid", "Invalid command grammar");
|
|
142
|
+
}
|
|
108
143
|
if (args.length === 1 && args[0] === "update" && !json && !local && !offline && !plain && !noColor
|
|
109
144
|
&& !noBrowser && projectId === undefined && ask === undefined && workspace === undefined && output === undefined && parent === undefined) {
|
|
110
145
|
return { kind: "update", origin, check: checkUpdate, yes: yesUpdate };
|
|
@@ -155,7 +190,7 @@ function parseCommand(argv) {
|
|
|
155
190
|
}
|
|
156
191
|
if (args.length === 2 && args[0] === "run" && args[1] === "submit"
|
|
157
192
|
&& (projectId === undefined || value(projectId)) && value(ask) && output === undefined) {
|
|
158
|
-
return { kind: "run_submit", projectId, ask, parent, origin, json };
|
|
193
|
+
return { kind: "run_submit", projectId, ask, parent, origin, json, allowExec };
|
|
159
194
|
}
|
|
160
195
|
if (args.length === 3 && args[0] === "run" && args[1] === "get" && value(args[2])
|
|
161
196
|
&& projectId === undefined && ask === undefined && output === undefined) {
|
|
@@ -276,6 +311,7 @@ async function whoami(command, env = process.env) {
|
|
|
276
311
|
async function main() {
|
|
277
312
|
refuseOldNode();
|
|
278
313
|
const command = parseCommand(process.argv.slice(2));
|
|
314
|
+
if (command.allowExec) qualify();
|
|
279
315
|
if (command.kind === "version") {
|
|
280
316
|
process.stdout.write(`vecteur ${manifest().version}\n`);
|
|
281
317
|
return;
|
|
@@ -391,15 +427,45 @@ async function main() {
|
|
|
391
427
|
: `Downloaded ${value.bytes} bytes to ${value.path} (${value.content_type}; ${value.disposition})\n`);
|
|
392
428
|
return;
|
|
393
429
|
}
|
|
430
|
+
else if (command.kind === "run_start") {
|
|
431
|
+
const projectId = await resolveRunProject(client, command.projectId);
|
|
432
|
+
value = await client.runStartLocal(projectId, command.ask, { requestKey: command.requestKey,
|
|
433
|
+
parentStateHash: command.parent, paths: command.paths });
|
|
434
|
+
process.stdout.write(canonicalJson(value));
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
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
|
+
}
|
|
394
445
|
else if (command.kind === "run_submit") {
|
|
395
446
|
const projectId = await resolveRunProject(client, command.projectId);
|
|
396
|
-
|
|
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);
|
|
397
457
|
if (!command.json) {
|
|
398
458
|
try {
|
|
399
459
|
const currentTransferIds = await verifiedTransferIds(client, value);
|
|
400
|
-
|
|
401
|
-
const
|
|
402
|
-
|
|
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
|
+
}
|
|
403
469
|
} catch (error) {
|
|
404
470
|
throw admittedFailure(error, value.run_id);
|
|
405
471
|
}
|
|
@@ -412,6 +478,12 @@ async function main() {
|
|
|
412
478
|
}
|
|
413
479
|
if (!command.json && Array.isArray(value?.events)) {
|
|
414
480
|
renderOptions.currentTransferIds = await verifiedTransferIds(client, value);
|
|
481
|
+
const stopped = stopViewOf(value.events);
|
|
482
|
+
if (stopped) {
|
|
483
|
+
renderOptions.stopOffer = await client.stopOffer(value.run_id);
|
|
484
|
+
if (stopped.cause === "plan_limit") await client.stopEvent(value.run_id, { event: "shown", surface: "cli" });
|
|
485
|
+
}
|
|
486
|
+
renderOptions.origin = config.origin;
|
|
415
487
|
}
|
|
416
488
|
process.stdout.write(command.json ? canonicalJson(value) : human(value, renderOptions));
|
|
417
489
|
}
|
|
@@ -427,8 +499,33 @@ async function verifiedTransferIds(client, run) {
|
|
|
427
499
|
return ids;
|
|
428
500
|
}
|
|
429
501
|
|
|
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.
|
|
504
|
+
function lifecycleInvocation(argv) {
|
|
505
|
+
const tokens = [];
|
|
506
|
+
let noWait = false;
|
|
507
|
+
const options = new Set(["--origin", "--project", "-p", "--ask", "-a", "--workspace", "--output", "--parent",
|
|
508
|
+
"--request-key", "--clarification", "--answers"]);
|
|
509
|
+
for (let i = 0; i < argv.length; i++) {
|
|
510
|
+
if (options.has(argv[i])) { i++; continue; }
|
|
511
|
+
if (argv[i] === "--no-wait") { noWait = true; continue; }
|
|
512
|
+
if (argv[i] === "--attach") {
|
|
513
|
+
while (i + 1 < argv.length && !argv[i + 1].startsWith("-")) i++;
|
|
514
|
+
continue;
|
|
515
|
+
}
|
|
516
|
+
if (!argv[i].startsWith("-")) tokens.push(argv[i]);
|
|
517
|
+
}
|
|
518
|
+
return tokens[0] === "run" && (tokens[1] === "answer" || tokens[1] === "submit" && noWait);
|
|
519
|
+
}
|
|
520
|
+
|
|
430
521
|
main().catch((error) => {
|
|
431
522
|
const code = error instanceof CliError ? error.code : "internal_error";
|
|
432
|
-
process.
|
|
523
|
+
const argv = process.argv.slice(2);
|
|
524
|
+
const structured = lifecycleInvocation(argv);
|
|
525
|
+
const message = redact(error?.message ?? "CLI failed");
|
|
526
|
+
const details = Object.fromEntries(["run_id", "request_key", "parent_state_hash"]
|
|
527
|
+
.filter(field => error instanceof CliError && Object.hasOwn(error, field))
|
|
528
|
+
.map(field => [field, typeof error[field] === "string" ? redact(error[field]) : error[field]]));
|
|
529
|
+
process.stderr.write(structured ? canonicalJson({ code, message, ...details }) : `${code}: ${message}\n`);
|
|
433
530
|
process.exitCode = code === "usage_invalid" ? 2 : 1;
|
|
434
531
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vecteur/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"vecteur": "bin/vecteur.js"
|
|
@@ -12,12 +12,16 @@
|
|
|
12
12
|
"src/contract.js",
|
|
13
13
|
"src/credentials.js",
|
|
14
14
|
"src/download.js",
|
|
15
|
+
"src/produce.js",
|
|
16
|
+
"src/exchange.js",
|
|
15
17
|
"src/errors.js",
|
|
16
18
|
"src/format.js",
|
|
17
19
|
"src/mcp.js",
|
|
18
20
|
"src/projects.js",
|
|
19
21
|
"src/store.js",
|
|
20
22
|
"src/folders.js",
|
|
23
|
+
"src/localfiles.js",
|
|
24
|
+
"src/executor.js",
|
|
21
25
|
"src/browser.js",
|
|
22
26
|
"src/blocks.js",
|
|
23
27
|
"src/session.js",
|