@vecteur/cli 0.15.2 → 0.15.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/bin/vecteur.js CHANGED
@@ -387,9 +387,11 @@ async function main() {
387
387
  let value;
388
388
  let renderOptions = {};
389
389
  if (command.kind === "project_list") {
390
- const [account, projects] = await Promise.all([client.accountMe(), client.projectList()]);
390
+ const [account, projects, storage] = await Promise.all([
391
+ client.accountMe(), client.projectList(), client.storageUsage(),
392
+ ]);
391
393
  value = { projects, active_projects: account.entitlements.active_projects,
392
- selected_project_id: config.projectId ?? null };
394
+ selected_project_id: config.projectId ?? null, storage };
393
395
  process.stdout.write(command.json ? canonicalJson(value) : humanProjects(value));
394
396
  return;
395
397
  } else if (command.kind === "project_create") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vecteur/cli",
3
- "version": "0.15.2",
3
+ "version": "0.15.4",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "vecteur": "bin/vecteur.js"
package/src/client.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  ARTIFACT_MEDIA_TYPES, OWNER_CONTRACT_IDENTITY, RECOVERY_ACTIONS, STORED_WIRE_VERSIONS, STORED_WIRE_VERSION_HEADER,
8
8
  WIRE_READER_HEADER, WIRE_READER_VERSION, validateAccount, validateCliRelease, validateCustomerCostProjection,
9
9
  validateDeviceAuthorization, validateLimitDenial, validatePatCreated, validateProject, validateQuotaDenial,
10
- validateRunAck, validateRunStopOffer, validateSource, validateSourceOffer,
10
+ validateRunAck, validateRunStopOffer, validateSource, validateSourceOffer, validateStorageDenial, validateStorageUsage,
11
11
  } from "./contract.js";
12
12
  import { FIRST_EVENT_SEQ, isStateHash, validateEvent, validateRun } from "./wire.js";
13
13
  import { credentialsPath, readCredentials } from "./credentials.js";
@@ -408,6 +408,13 @@ export class VecteurClient {
408
408
  ownerMessage = `${error.message}; ${quota.current} of ${quota.maximum} active projects used on the ${quota.tier} plan`
409
409
  + (actions.length ? `; next: ${actions.join("; ")}` : "");
410
410
  }
411
+ if (candidate === "storage_exhausted") {
412
+ if (!validateStorageDenial(error.storage) || typeof error.message !== "string"
413
+ || !error.message.length || /[\u0000-\u001f\u007f-\u009f]/.test(error.message)) {
414
+ throw new CliError("storage_invalid", "Server returned malformed storage refusal");
415
+ }
416
+ ownerMessage = [error.message, ...error.storage.usage.actions.map(action => action.label)].join(". ");
417
+ }
411
418
  if (candidate === "customer_cost_exhausted") {
412
419
  if (!validateLimitDenial(error.limit)) {
413
420
  throw new CliError("customer_cost_invalid", "Server returned malformed customer-cost refusal");
@@ -450,7 +457,7 @@ export class VecteurClient {
450
457
  } catch (error) {
451
458
  if (error?.name === "AbortError") throw error;
452
459
  if (error instanceof CliError && [
453
- "secret_response_refused", "quota_invalid", "recovery_action_invalid", "customer_cost_invalid",
460
+ "secret_response_refused", "quota_invalid", "recovery_action_invalid", "customer_cost_invalid", "storage_invalid",
454
461
  ].includes(error.code)) refused = error;
455
462
  }
456
463
  if (refused) throw refused;
@@ -477,6 +484,14 @@ export class VecteurClient {
477
484
  }
478
485
  }
479
486
 
487
+ async storageUsage() {
488
+ const value = await this.#json("GET", "/api/storage/usage");
489
+ if (!validateStorageUsage(value)) {
490
+ throw new CliError("storage_invalid", "Server returned malformed storage usage");
491
+ }
492
+ return value;
493
+ }
494
+
480
495
  async projectList(signal = undefined) {
481
496
  const value = await this.#json("GET", "/api/projects", { signal });
482
497
  if (!Array.isArray(value) || !value.every(validateProject)) {
package/src/contract.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // GENERATED by scripts/gen-contract.mjs from the owner projections.
2
- export const OWNER_CONTRACT_IDENTITY = "api-sha256:564c71ca9ba66818306f5b97e82ae834a7d50e5dcf91a9a9de52c5fdb680b8c9;run-wire-sha256:66a605fada495e69ada6498523e5725082ce6d803f2336f7fb69c9b719acfcad";
3
- export const MODEL_CHOICES = Object.freeze([{"route_id":"auto","label":"Auto","level":"balanced"},{"route_id":"claude_opus","label":"Claude Opus 5.5","level":"quality"},{"route_id":"claude_sonnet","label":"Claude Sonnet 5.5","level":"balanced"},{"route_id":"claude_haiku","label":"Claude Haiku 5.5","level":"economy"},{"route_id":"gpt_sol","label":"GPT-6.1 Sol","level":"quality"},{"route_id":"gpt_terra","label":"GPT-6.1 Terra","level":"balanced"},{"route_id":"gpt_luna","label":"GPT-6 Luna","level":"economy"},{"route_id":"mistral_large","label":"Mistral Large 4","level":"quality"},{"route_id":"deepseek_flash_eu","label":"DeepSeek V4.1 Flash","level":"balanced"}]);
2
+ export const OWNER_CONTRACT_IDENTITY = "api-sha256:c23dad4f150e6ad870161c328ab599766d8d234b6d18ff7fa3a480c197af9ac4;run-wire-sha256:5f02687e884369a37c8a133cdadaba44ec5854b2365ffb0cc56655bf4299e84f";
3
+ export const MODEL_CHOICES = Object.freeze([{"route_id":"auto","label":"Auto","level":"balanced"},{"route_id":"claude_opus","label":"Claude Opus 5.5","level":"quality"},{"route_id":"claude_sonnet","label":"Claude Sonnet 5.5","level":"balanced"},{"route_id":"claude_haiku","label":"Claude Haiku 5.5","level":"economy"},{"route_id":"gpt_sol_62","label":"GPT-6.2 Sol","level":"quality"},{"route_id":"gpt_sol","label":"GPT-6.1 Sol","level":"quality","hidden":true},{"route_id":"gpt_terra","label":"GPT-6.1 Terra","level":"balanced"},{"route_id":"gpt_luna","label":"GPT-6 Luna","level":"economy"},{"route_id":"mistral_large","label":"Mistral Large 4","level":"quality"},{"route_id":"deepseek_flash_eu","label":"DeepSeek V4.1 Flash","level":"balanced"},{"route_id":"claude_fable","label":"Claude Fable 5.2","level":"quality"}]);
4
4
  export const EVENT_KINDS = Object.freeze(["assistant_delta","tool_call","tool_result","synthesis","artifact","study","review","terminal"]);
5
5
  export const TOOL_KINDS = Object.freeze(["bash","python","read","write","edit","search","web","skill","other"]);
6
6
  export const TERMINAL_STATES = Object.freeze(["completed","failed","cancelled","budget"]);
@@ -8,7 +8,8 @@ export const TERMINAL_DEFECTS = Object.freeze(["budget_exhausted","cancelled","r
8
8
  export const ARTIFACT_MEDIA_TYPES = Object.freeze({"binary":"application/octet-stream","code":"text/plain","csv":"text/csv","docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document","html":"text/html","jpeg":"image/jpeg","json":"application/json","md":"text/markdown","pdf":"application/pdf","png":"image/png","svg":"image/svg+xml","xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});
9
9
  export const RECOVERY_ACTIONS = Object.freeze({"delete_project":{"label":"Delete a project","href":"/projects"},"upgrade_plan":{"label":"Upgrade your plan","href":"/dashboard/billing"},"wait_for_reset":{"label":"Wait until the UTC reset","href":null}});
10
10
  export const STOP_ACTION_HREFS = Object.freeze({"upgrade_plan":"/dashboard/billing?checkout=pro","contact_sales":"/enterprise#enterprise-contact","see_usage":"/dashboard/billing"});
11
- export const PLAN_WORDS = Object.freeze({"enterprise_action":"Talk to us about Enterprise","free_price":"€0","pro_action":"Move to Pro","pro_price":"€50 a month","pro_start":"Create an account to move to Pro","see_plan":"See your plan"});
11
+ export const STORAGE_GB = 1000000000;
12
+ export const PLAN_WORDS = Object.freeze({"enterprise_action":"Talk to us about Enterprise","free_price":"€0","pro_action":"Move to Pro","pro_price":"€50 per month per seat","pro_start":"Create an account to move to Pro","see_plan":"See your plan"});
12
13
  export const WIRE_READER_HEADER = "Vecteur-Wire";
13
14
  export const STORED_WIRE_VERSION_HEADER = "X-Vecteur-Stored-Wire-Version";
14
15
  export const STORED_WIRE_VERSIONS = Object.freeze([6]);
@@ -42,11 +43,19 @@ const ownerSourceOffer=v=>shape(v,["id","sha256","project_id","source_handle","e
42
43
  const ownerSourceHandle=v=>shape(v,["cas_ref","acquisition_ref"],[])&&typeof v.cas_ref==="string"&&typeof v.acquisition_ref==="string";
43
44
  const ownerOfferExtract=v=>shape(v,["id","locator","extractor_id","extractor_version","text_sha256"],[])&&(typeof v.id==="string")&&(v.locator!==null&&typeof v.locator==="object"&&!Array.isArray(v.locator)&&Object.values(v.locator).every(x=>true))&&(typeof v.extractor_id==="string")&&(typeof v.extractor_version==="string")&&(typeof v.text_sha256==="string");
44
45
  const ownerSourceObject=v=>shape(v,["cas_ref","sha256","size","content_type","acquisition_ref","acquisition"],[])&&(typeof v.cas_ref==="string")&&(typeof v.sha256==="string")&&(Number.isFinite(v.size))&&(typeof v.content_type==="string")&&(typeof v.acquisition_ref==="string")&&(ownerSourceAcquisition(v.acquisition));
46
+ const ownerStorageDenial=v=>shape(v,["operation","usage"],["shortfall_bytes"])&&((v.operation==="upload"||v.operation==="turn"))&&(ownerStorageUsage(v.usage))&&(v.shortfall_bytes===undefined||Number.isFinite(v.shortfall_bytes));
47
+ const ownerStorageUsage=v=>shape(v,["state","projects","actions"],["totals"])&&((v.state==="available"||v.state==="full"||v.state==="unavailable"))&&(Array.isArray(v.projects)&&v.projects.every(x=>ownerStorageProject(x)))&&(Array.isArray(v.actions)&&v.actions.every(x=>ownerStorageAction(x)))&&(v.totals===undefined||ownerStorageTotals(v.totals));
48
+ const ownerStorageProject=v=>shape(v,["id","name","working_bytes","object_bytes"],[])&&(typeof v.id==="string")&&(typeof v.name==="string")&&(Number.isFinite(v.working_bytes))&&(Number.isFinite(v.object_bytes));
49
+ const ownerStorageAction=v=>shape(v,["kind","label"],["href","project_id","room_bytes"])&&((v.kind==="request_storage"||v.kind==="delete_project"||v.kind==="upgrade_plan"))&&(typeof v.label==="string")&&(v.href===undefined||typeof v.href==="string")&&(v.project_id===undefined||typeof v.project_id==="string")&&(v.room_bytes===undefined||Number.isFinite(v.room_bytes));
50
+ const ownerStorageTotals=v=>shape(v,["used_bytes","ceiling_bytes","remaining_bytes"],[])&&(Number.isFinite(v.used_bytes))&&(Number.isFinite(v.ceiling_bytes))&&(Number.isFinite(v.remaining_bytes));
45
51
  export const validateCliRelease=ownerCliRelease;
46
52
  export const validateAccount=v=>ownerAccount(v)&&[v.id,v.email,v.display_name,v.org_id].every(text)&&v.workspaces.every(w=>[w.id,w.org_id,w.name].every(text))&&integer(v.entitlements.active_projects.current)&&v.entitlements.active_projects.current>=0&&(v.entitlements.active_projects.maximum===null||(integer(v.entitlements.active_projects.maximum)&&v.entitlements.active_projects.maximum>=0));
47
53
  export const validateQuotaDenial=v=>ownerQuotaDenial(v)&&v.resource==="active_projects"&&integer(v.current)&&v.current>=0&&integer(v.maximum)&&v.maximum>=0&&text(v.tier);
48
54
  const plainText=v=>text(v)&&!/[\u0000-\u001f\u007f-\u009f]/.test(v); const costText=v=>v===null||plainText(v); const money=v=>v===null||(integer(v)&&v>=0);
49
55
  const costProjection=v=>[v.scope?.id,v.binding_scope?.scope?.id].every(plainText)&&[v.period_start,v.period_end,v.reset_at].every(x=>integer(x)&&x>=0&&x<=8640000000000)&&v.period_start<v.period_end&&v.reset_at===v.period_end&&[v.used,v.scope_used,v.limit,v.remaining].every(money)&&[v.display?.used,v.display?.scope_used,v.display?.limit,v.display?.remaining].every(costText)&&((v.scope_used===null)===(v.display.scope_used===null))&&(v.coverage==="complete"?(v.used!==null&&v.display.used!==null&&((v.limit===null&&v.remaining===null&&v.display.limit===null&&v.display.remaining===null)||(v.limit!==null&&v.remaining!==null&&v.display.limit!==null&&v.display.remaining!==null))):(v.used===null&&v.limit===null&&v.remaining===null&&v.display.used===null&&v.display.limit===null&&v.display.remaining===null));
56
+ const bytes=v=>integer(v)&&v>=0;
57
+ export const validateStorageUsage=v=>ownerStorageUsage(v)&&v.projects.every(p=>plainText(p.id)&&text(p.name)&&bytes(p.working_bytes)&&bytes(p.object_bytes))&&v.actions.every(a=>plainText(a.label)&&(a.room_bytes===undefined||bytes(a.room_bytes)))&&(v.totals===undefined||Object.values(v.totals).every(bytes));
58
+ export const validateStorageDenial=v=>ownerStorageDenial(v)&&validateStorageUsage(v.usage)&&(v.shortfall_bytes===undefined||bytes(v.shortfall_bytes));
50
59
  export const validateRunStopOffer=v=>ownerRunStopOffer(v)&&plainText(v.run_id)&&integer(v.as_of)&&v.as_of>0;
51
60
  export const validateCustomerCostProjection=v=>ownerCustomerCostProjection(v)&&costProjection(v);
52
61
  export const validateLimitDenial=v=>ownerLimitDenial(v)&&costProjection(v)&&v.coverage==="incomplete"&&v.scope_used===null&&v.recovery.length>0;
package/src/mcp.js CHANGED
@@ -6,7 +6,7 @@ import { serveStdio } from "@modelcontextprotocol/server/stdio";
6
6
  import * as z from "zod/v4";
7
7
 
8
8
  import { CliError, OWNER_WORDED, VecteurClient, redact } from "./client.js";
9
- import { EVENT_KINDS, STORED_WIRE_VERSIONS, TERMINAL_STATES } from "./contract.js";
9
+ import { EVENT_KINDS, MODEL_CHOICES, STORED_WIRE_VERSIONS, TERMINAL_STATES } from "./contract.js";
10
10
  import { canonicalJson, fillPrompt } from "./format.js";
11
11
  import { artifactToFolder, materialAttach } from "./exchange.js";
12
12
  import { credentialsPath } from "./credentials.js";
@@ -239,6 +239,11 @@ export async function createVecteurMcpServer(client = new VecteurClient(), shutd
239
239
  return result;
240
240
  });
241
241
 
242
+ tool(server, "vecteur_model_list", "List model choices in the Vecteur catalogue. MCP Runs use the service and organization default.",
243
+ z.object({}).strict(), z.object({ models: z.array(z.object({
244
+ route_id: z.string(), label: z.string(), level: z.string(),
245
+ }).strict()) }).strict(), () => ({ models: MODEL_CHOICES.filter(row => !row.hidden) }));
246
+
242
247
  tool(server, "vecteur_workflow_list", "List the guided workflows (also served as this server's prompts): what to bring, what you get, and the ask with its {{blanks}}. Fill every blank, then send it with vecteur_run_submit.",
243
248
  z.object({}).strict(), workflowListOutput, (_input, context) => client.workflows(signal(context)));
244
249
 
package/src/projects.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { STORAGE_GB } from "./contract.js";
1
2
  import { CliError } from "./errors.js";
2
3
 
3
4
  /** Resolve only server-authorized objects. Ids take precedence over names. */
@@ -38,5 +39,11 @@ export function humanProjects(value) {
38
39
  const rows = value.projects.map(project =>
39
40
  `${project.id === value.selected_project_id ? "*" : " "} ${project.name} (${project.id}) ${project.role}`);
40
41
  const allowance = value.active_projects;
41
- return [...rows, `Active projects: ${allowance.current} / ${allowance.maximum ?? "Contract limit"}`].join("\n") + "\n";
42
+ const summary = value.storage.state === "unavailable" ? "Storage figure unavailable"
43
+ : `Storage: ${storageBytes(value.storage.projects.reduce((sum, project) => sum + project.working_bytes + project.object_bytes, 0))} in visible projects · ${value.storage.state}`;
44
+ return [...rows, `Active projects: ${allowance.current} / ${allowance.maximum ?? "Contract limit"}`, summary].join("\n") + "\n";
45
+ }
46
+
47
+ function storageBytes(bytes) {
48
+ return bytes < STORAGE_GB ? `${bytes} B` : `${Number((bytes / STORAGE_GB).toFixed(2))} GB`;
42
49
  }
package/src/session.js CHANGED
@@ -903,7 +903,7 @@ export class Session extends EventEmitter {
903
903
  modelChoice() { return this.transition(() => this.selectModel()); }
904
904
 
905
905
  async selectModel() {
906
- this.model = await this.choose("Model for the next Run (Vecteur billing)", MODEL_CHOICES.map(row => ({
906
+ this.model = await this.choose("Model for the next Run (Vecteur billing)", MODEL_CHOICES.filter(row => !row.hidden).map(row => ({
907
907
  label: row.route_id === "auto" ? "Auto — Vecteur selects the model" : `${row.label} · ${row.level}`,
908
908
  value: row.route_id === "auto" ? null : row.route_id })));
909
909
  this.change();