@corvio/cli 0.1.0-beta.19 → 0.1.0-beta.20

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.
Files changed (3) hide show
  1. package/README.md +6 -3
  2. package/dist/cli.js +120 -14
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -13,11 +13,14 @@ corvio ask --prompt 'Summarize recurring launch risks' --json
13
13
  corvio files upload --file ./research.pdf --json
14
14
  corvio files organize <asset_id> --instruction 'Create a reusable decision brief' --yes --json
15
15
  corvio files operation <operation_id> --json
16
+ corvio files resume <operation_id> --yes --json
17
+ corvio docs table-read <document_id> --limit 25 --json
18
+ corvio docs table-mutate <document_id> --input ./table-change.json --change-summary 'Updated owner and due date' --yes --json
16
19
  corvio sync init --dir ./knowledge --root-node-id <node_id> --json
17
20
  corvio update check --json
18
21
  ```
19
22
 
20
- When no environment key is configured, run `corvio auth login`. Login creates one user-level `cvu_` control-plane credential; it does not freeze the browser's current Workspace. Run `corvio agents connect --project .` from the project you want to expose. The command verifies the selected Codex, Claude Code, or Copilot host before server mutation, then idempotently creates or restores the Agent for that provider/device/project binding, grants current/future Workspace coverage under live membership/role and ACL limits, saves the one-time `cvg_` in a `0600` multi-binding registry, and starts that project's listener. `corvio collaboration status` then checks a separate foreground requirement: the current host must also discover the official Skill at the live server contract version. A listener receives inbound `@Agent` work; it does not make an unrelated foreground coding session collaborate automatically. Another project gets another Agent. Ordinary data commands prefer the binding whose root contains the current directory, then a locally confirmed selection, the account selection, the personal default, or one authorized candidate. They ask only on real ambiguity. Use `corvio workspaces use`, `--workspace`, and `--agent` as explicit routing/reproducibility controls. Legacy Workspace-bound `cvk_`, `cvg_`, and version-1 credential files remain compatible and are never widened. Local sync stores only credential-free handles and revision/hash baselines in `.corvio/state.json`; Markdown lives below `corvio_docs/`, and conflicts require explicit resolution. Update checks compare npm's published `beta` tag with the API compatibility policy but never self-install. See [the Corvio CLI guide](https://corvio.ai/developers/cli) for the full command and receipt contract.
23
+ When no environment key is configured, run `corvio auth login`. Login creates one user-level `cvu_` control-plane credential; it does not freeze the browser's current Workspace. Run `corvio agents connect --project .` from the project you want to expose. The command verifies the selected Codex, Claude Code, or Copilot host before server mutation, then idempotently creates or restores the Agent for that provider/device/project binding, grants current/future Workspace coverage under live membership/role and ACL limits, saves the one-time `cvg_` in a `0600` multi-binding registry, and starts that project's listener. `corvio collaboration status` then checks local foreground prerequisites: the official Skill is installed at the live server contract version. A listener receives inbound `@Agent` work; it does not make an unrelated foreground coding session collaborate automatically, and the CLI cannot prove that the current host task loaded the Skill or remote MCP. Another project gets another Agent. Ordinary data commands prefer the binding whose root contains the current directory, then a locally confirmed selection, the account selection, the personal default, or one authorized candidate. They ask only on real ambiguity. Use `corvio workspaces use`, `--workspace`, and `--agent` as explicit routing/reproducibility controls. Legacy Workspace-bound `cvk_`, `cvg_`, and version-1 credential files remain compatible and are never widened. Local sync stores only credential-free handles and revision/hash baselines in `.corvio/state.json`; Markdown lives below `corvio_docs/`, and conflicts require explicit resolution. Update checks compare npm's published `beta` tag with the API compatibility policy but never self-install. See [the Corvio CLI guide](https://corvio.ai/developers/cli) for the full command and receipt contract.
21
24
 
22
25
  CLI and Skill updates are independent. `corvio update check` checks the CLI package only. `corvio collaboration status` detects a missing
23
26
  official Skill or a shared-contract mismatch, but not every content-only package revision. The canonical website zip is a static local
@@ -25,9 +28,9 @@ copy and is not currently update-tracked by `npx skills update`; rerun its offic
25
28
  scope for exact freshness, start a new host session, then rerun `corvio collaboration status`. Remote MCP changes are server-delivered and
26
29
  normally need only a refreshed host session unless new OAuth scopes require reauthorization.
27
30
 
28
- The CLI rejects unknown/duplicate options and malformed integer bounds before network access. Normal API calls have a bounded timeout (`CORVIO_REQUEST_TIMEOUT_MS`, maximum ten minutes); only reads, explicit idempotency contracts, revision guards, and other owner-declared safe operations retry automatically. Document updates preflight the current revision when `--expected-revision` is omitted. When the executing principal is a connected Agent, `docs update` also requires `--change-summary`, creates a visible document-level comment after the guarded write, and returns its receipt; a comment failure is reported as a partial effect rather than silent success. When a Corvio document or comment supplied the task, use `corvio agent closeout` to return the verified outcome, optionally resolve the thread, and read both document and thread back. Downloads, uploads, and Markdown pulls verify SHA-256 receipts before replacing local files; local writes are atomic, remote default filenames cannot escape the current directory, and Sync refuses symbolic-link traversal while checkpointing each successful push.
31
+ The CLI rejects unknown/duplicate options and malformed integer bounds before network access. Normal API calls have a bounded timeout (`CORVIO_REQUEST_TIMEOUT_MS`, maximum ten minutes); only reads, explicit idempotency contracts, revision guards, and other owner-declared safe operations retry automatically. Document updates preflight the current revision when `--expected-revision` is omitted. `docs table-read` returns a bounded stable-ID projection; `docs table-mutate` accepts a JSON payload for at most 50 cell updates or row appends and requires the fetched revision, while formulas, styles, structure, sorting, and semantic transformations remain `corvio ask --allow-actions` work. When the executing principal is a connected Agent, document and table mutations also require `--change-summary`, create a visible document-level comment after the guarded update, and return its receipt; a comment failure is reported as a partial effect rather than silent success. When a Corvio document or comment supplied the task, use `corvio agent closeout` to return the verified outcome, optionally resolve the thread, and read both document and thread back. Downloads, uploads, and Markdown pulls verify SHA-256 receipts before replacing local files; local writes are atomic, remote default filenames cannot escape the current directory, and Sync refuses symbolic-link traversal while checkpointing each successful push.
29
32
 
30
- File organization is asynchronous. A queued organization receipt is progress, not completion: continue from its stable operation ID with `corvio files operation <operation_id>` and only report completion after the terminal receipt exposes the resulting artifacts, Skill evaluation, and durable links.
33
+ File organization is asynchronous. A queued organization receipt is progress, not completion: continue from its stable operation ID with `corvio files operation <operation_id>`. Blocked operations expose their typed error and can be continued with `corvio files resume <operation_id> --yes`; queued/running/blocked operations can be stopped with `corvio files cancel <operation_id> --yes`. Report completion only after the terminal receipt exposes the resulting artifacts, Skill evaluation, and durable links.
31
34
 
32
35
  ## Project Agent collaboration
33
36
 
package/dist/cli.js CHANGED
@@ -39,7 +39,7 @@ import {
39
39
  agentCredentialPath,
40
40
  } from "./core.js";
41
41
 
42
- const VERSION = "0.1.0-beta.19";
42
+ const VERSION = "0.1.0-beta.20";
43
43
  const DEFAULT_API_BASE = "https://api.corvio.ai/v1";
44
44
  const DEFAULT_APP_BASE = "https://corvio.ai";
45
45
  const USER_AGENT = `corvio-cli/${VERSION}`;
@@ -103,6 +103,8 @@ const COMMAND_OPTIONS = Object.freeze({
103
103
  "search:": ["query", "limit", "page-id", "node-id"],
104
104
  "docs:list": ["limit", "cursor", "lifecycle"],
105
105
  "docs:get": ["id", "output"],
106
+ "docs:table-read": ["id", "table-id", "after-row-id", "limit"],
107
+ "docs:table-mutate": ["id", "input", "operation-id", "change-summary", "yes"],
106
108
  "docs:create": ["title", "file", "markdown", "parent-node-id", "idempotency-key"],
107
109
  "docs:update": ["id", "title", "file", "markdown", "expected-revision", "change-summary"],
108
110
  "docs:move": ["id", "parent-node-id", "before-node-id", "after-node-id", "idempotency-key"],
@@ -124,6 +126,8 @@ const COMMAND_OPTIONS = Object.freeze({
124
126
  "processing-profile", "max-processing-profile", "scan-mode", "skills-extraction-mode", "caller-model",
125
127
  ],
126
128
  "files:operation": ["id"],
129
+ "files:resume": ["id"],
130
+ "files:cancel": ["id"],
127
131
  "files:open": ["id"],
128
132
  "sync:init": ["root-node-id", "dir", "name", "force"],
129
133
  "sync:status": ["dir"],
@@ -147,9 +151,9 @@ Usage:
147
151
  corvio questions list|get [id]
148
152
  corvio conversations list|get [id]
149
153
  corvio search <query>
150
- corvio docs list|get|create|update|move|archive|restore|share|open [id]
154
+ corvio docs list|get|table-read|table-mutate|create|update|move|archive|restore|share|open [id]
151
155
  corvio projects list|create
152
- corvio files list|get|download|upload|organize|operation|open [id]
156
+ corvio files list|get|download|upload|organize|operation|resume|cancel|open [id]
153
157
  corvio sync init|status|plan|pull|push|resolve
154
158
  corvio update check
155
159
 
@@ -169,16 +173,16 @@ const COMMAND_HELP = Object.freeze({
169
173
  auth: `Usage: corvio auth login|status|logout\n\nAuthenticate with a user-level device link, inspect the current principal, or revoke the stored credential.`,
170
174
  workspaces: `Usage:\n corvio workspaces list\n corvio workspaces use <workspace-id>\n corvio workspaces current\n corvio workspaces create --name <name> [--kind personal|team]\n\nWorkspace status and blocked capability reasons are returned with each item.`,
171
175
  capabilities: `Usage: corvio capabilities [--json]\n\nShow live API resources, principal scopes, selected Workspace status, and CLI compatibility.`,
172
- collaboration: `Usage:\n corvio collaboration status [--project <path>] [--provider codex|claude_code|copilot]\n\nVerify that the current project has a bound Corvio Agent, the official collaboration Skill is discoverable at the live contract version, and the inbound listener state is reported separately. This is the foreground work-loop readiness check; a listening process alone is not enough.`,
176
+ collaboration: `Usage:\n corvio collaboration status [--project <path>] [--provider codex|claude_code|copilot]\n\nCheck local Corvio prerequisites: project-Agent binding, installed collaboration Skill version, and inbound listener state. The CLI cannot prove that the current host task loaded the Skill, remote MCP, or host memory.`,
173
177
  ask: `Usage: corvio ask --prompt <text> [--file <path>] [--asset-ids <id,id>] [--conversation-id <id>] [--sources workspace,web,memory] [--allow-actions] [--processing-profile auto|economy|standard|deep] [--max-processing-profile economy|standard|deep] [--scan-mode auto|always|off] [--skills-extraction-mode auto|always|off] [--caller-model <host-model>] [--context-file <json>] [--idempotency-key <key>]\n\n--file retains the selected local file, verifies its hash, and attaches the finalized Asset to this exact question. --asset-ids attaches already-retained Corvio Assets. Skill extraction mode always requires --allow-actions; answer-only questions may use auto or off.`,
174
- agents: `Usage:\n corvio agents list\n corvio agents connect [--provider codex|claude_code|copilot] [--project <path>] [--permission-profile read_only|workspace_write|danger_full_access] [--trigger-policy owner_only|workspace_members] [--display-name <name>] [--recover-credential] [--no-listen]\n corvio agents create --handle <handle> --display-name <name> [--provider codex|claude_code|copilot|custom] [--permissions read,comment,edit]\n corvio agents update <id> [--display-name <name>] [--status active|paused|revoked] [--permissions <list>]\n corvio agents rotate <id>\n\n'connect' binds the current Git project (or --project path) to one stable personal Agent. Repeating it is idempotent; another project creates another Agent. It reports provider/CLI, listener, and foreground Skill readiness separately; run corvio collaboration status after installing or refreshing the Skill. The default workspace_write profile is limited by the provider's native sandbox. owner_only is the safe trigger default. Secrets and absolute project paths stay local.`,
178
+ agents: `Usage:\n corvio agents list\n corvio agents connect [--provider codex|claude_code|copilot] [--project <path>] [--permission-profile read_only|workspace_write|danger_full_access] [--trigger-policy owner_only|workspace_members] [--display-name <name>] [--recover-credential] [--no-listen]\n corvio agents create --handle <handle> --display-name <name> [--provider codex|claude_code|copilot|custom] [--permissions read,comment,edit]\n corvio agents update <id> [--display-name <name>] [--status active|paused|revoked] [--permissions <list>]\n corvio agents rotate <id>\n\n'connect' binds the current Git project (or --project path) to one stable personal Agent. Repeating it is idempotent; another project creates another Agent. It reports provider/CLI, listener, and local Skill prerequisites separately; run corvio collaboration status after installing or refreshing the Skill. The CLI cannot prove that the current host task loaded those surfaces. The default workspace_write profile is limited by the provider's native sandbox. owner_only is the safe trigger default. Secrets and absolute project paths stay local.`,
175
179
  agent: `Usage:\n corvio agent claim [--worker-id <id>] [--wait-seconds <0-30>]\n corvio agent renew <event-id> --lease-token <token> [--lease-seconds <30-900>]\n corvio agent complete <event-id> --lease-token <token> [--result-file <json>]\n corvio agent fail <event-id> --lease-token <token> --error <message>\n corvio agent mentions --document-id <id> [--query <name>]\n corvio agent comments --document-id <id>\n corvio agent comment --document-id <id> --body <text> [--selection-file <json>] [--start-new-chain] [--idempotency-key <key>]\n corvio agent reply <thread-id> --document-id <id> --body <text> [--source-event-id <id> --source-event-lease-token <token>|--start-new-chain] [--idempotency-key <key>]\n corvio agent status <thread-id> --document-id <id> --status open|resolved\n corvio agent closeout --document-id <id> [--thread-id <id>] --body <verified-result> [--status open|resolved] [--idempotency-key <key>]\n corvio agent run [--provider codex|claude_code|copilot|custom] [--handler <executable>] [--agent <id>] [--once] [--processing-profile auto|economy|standard|deep] [--max-processing-profile economy|standard|deep] [--scan-mode auto|always|off] [--skills-extraction-mode auto|always|off] [--caller-model <host-model>]\n\nUse mentions before commenting when the target is uncertain; aliases resolve to stable user or Agent IDs and ambiguity fails closed. Use closeout when a Corvio document or comment owned the task: it returns the verified result to that surface and reads document/comments back. Agent-to-Agent comments require either a claimed source event or explicit --start-new-chain. The runner iteratively exchanges origin-scoped evidence with Corvio Query/Writer, then invokes the bound provider inside its local project. Local code changes use the recorded provider permission profile; complex Corvio document changes belong to Query/Writer. Provider children never receive Corvio credentials.`,
176
180
  questions: `Usage:\n corvio questions list [--limit <n>] [--cursor <cursor>] [--conversation-id <id>]\n corvio questions get <question-id>`,
177
181
  conversations: `Usage:\n corvio conversations list [--limit <n>] [--cursor <cursor>]\n corvio conversations get <conversation-id>`,
178
182
  search: `Usage: corvio search <query> [--limit <n>] [--page-id <id>] [--node-id <id>]`,
179
- docs: `Usage:\n corvio docs list [--limit <n>] [--cursor <cursor>] [--lifecycle active|archived]\n corvio docs get <id> [--output <path>]\n corvio docs create --title <title> [--file <path>|--markdown <text>] [--parent-node-id <id>] [--idempotency-key <key>]\n corvio docs update <id> [--title <title>] [--file <path>|--markdown <text>] [--expected-revision <n>] [--change-summary <text>]\n corvio docs move <id> --parent-node-id <id>\n corvio docs archive <id> --yes\n corvio docs restore <id> --yes\n corvio docs share <id> --yes [--display-name <name>]\n corvio docs open <id>\n\nDirect document commands operate on canonical Page/Markdown. Use \`corvio ask --allow-actions\` for Spreadsheet, Presentation, Code, HTML Artifact, or semantic organization. Agent-authenticated document updates require --change-summary and create a visible document-level comment after the guarded update. When a document/comment is the task owner, use \`corvio agent closeout\` to return verified work to that same collaboration surface and read it back.`,
183
+ docs: `Usage:\n corvio docs list [--limit <n>] [--cursor <cursor>] [--lifecycle active|archived]\n corvio docs get <id> [--output <path>]\n corvio docs table-read <id> [--table-id <id>] [--after-row-id <id>] [--limit <1-100>]\n corvio docs table-mutate <id> --input <json> --yes [--operation-id <id>] [--change-summary <text>]\n corvio docs create --title <title> [--file <path>|--markdown <text>] [--parent-node-id <id>] [--idempotency-key <key>]\n corvio docs update <id> [--title <title>] [--file <path>|--markdown <text>] [--expected-revision <n>] [--change-summary <text>]\n corvio docs move <id> --parent-node-id <id>\n corvio docs archive <id> --yes\n corvio docs restore <id> --yes\n corvio docs share <id> --yes [--display-name <name>]\n corvio docs open <id>\n\nUse table-read plus table-mutate for bounded stable-ID cell updates or row appends without round-tripping a whole document. Use \`corvio ask --allow-actions\` for formulas, styles, table structure, Spreadsheet, Presentation, Code, HTML Artifact, or semantic organization. Agent-authenticated document changes require --change-summary and create a visible document-level comment after the guarded update. When a document/comment is the task owner, use \`corvio agent closeout\` to return verified work to that same collaboration surface and read it back.`,
180
184
  projects: `Usage:\n corvio projects list [--limit <n>]\n corvio projects create --title <title> [--idempotency-key <key>]\n\nProjects are durable grouping owners in the Corvio Docs tree. Reuse a matching Project instead of creating one ceremonial Project per file. 'corvio folders' is an alias.`,
181
- files: `Usage:\n corvio files list [--limit <n>]\n corvio files get <id>\n corvio files download <id> [--output <path>]\n corvio files upload --file <path> [--mime-type <type>] [--organize --instruction <text> --additional-asset-ids <id,id> --yes]\n corvio files organize <id> --instruction <text> --yes [--additional-asset-ids <id,id>] [--processing-profile auto|economy|standard|deep] [--scan-mode auto|always|off] [--skills-extraction-mode auto|always|off]\n corvio files operation <operation-id>\n corvio files open <id>\n\nUpload alone preserves the original file. Organization is asynchronous: use 'files operation' to read its terminal result, derived artifacts, Skill evaluation, and links before claiming completion.`,
185
+ files: `Usage:\n corvio files list [--limit <n>]\n corvio files get <id>\n corvio files download <id> [--output <path>]\n corvio files upload --file <path> [--mime-type <type>] [--organize --instruction <text> --additional-asset-ids <id,id> --yes]\n corvio files organize <id> --instruction <text> --yes [--additional-asset-ids <id,id>] [--processing-profile auto|economy|standard|deep] [--scan-mode auto|always|off] [--skills-extraction-mode auto|always|off]\n corvio files operation <operation-id>\n corvio files resume <operation-id> --yes\n corvio files cancel <operation-id> --yes\n corvio files open <id>\n\nUpload alone preserves the original file. Organization is asynchronous: use 'files operation' to read its terminal result, typed blocker and recovery links before claiming completion. Resume reuses the same durable operation after resolving its blocker; cancel is idempotent.`,
182
186
  sync: `Usage:\n corvio sync init --root-node-id <id> [--dir <path>] [--name <name>]\n corvio sync status|plan|pull [--dir <path>]\n corvio sync push --yes [--dir <path>]\n corvio sync resolve --conflict-id <id> --strategy use-remote|keep-local --yes [--dir <path>]`,
183
187
  update: `Usage: corvio update check [--json]\n\nCompare this executable with the reviewed API policy and the npm beta dist-tag.`,
184
188
  });
@@ -230,6 +234,8 @@ function validateInvocation(options, positionals) {
230
234
  "questions:get",
231
235
  "conversations:get",
232
236
  "docs:get",
237
+ "docs:table-read",
238
+ "docs:table-mutate",
233
239
  "docs:update",
234
240
  "docs:move",
235
241
  "docs:archive",
@@ -240,6 +246,8 @@ function validateInvocation(options, positionals) {
240
246
  "files:download",
241
247
  "files:organize",
242
248
  "files:operation",
249
+ "files:resume",
250
+ "files:cancel",
243
251
  "files:open",
244
252
  "agents:update",
245
253
  "agents:rotate",
@@ -804,9 +812,11 @@ async function collaborationStatus(options) {
804
812
  if (!credential) nextActions.push(`corvio agents connect --provider ${provider} --project .`);
805
813
  if (guidance.install_command) nextActions.push(guidance.install_command);
806
814
  if (!serverVersion) nextActions.push("corvio update check --json");
815
+ const localPrerequisitesReady = status === "ready";
816
+ const hostIntegration = dictLike(liveContract.host_integration);
807
817
  writeResult({
808
818
  status,
809
- foreground_collaboration_ready: status === "ready",
819
+ local_prerequisites_ready: localPrerequisitesReady,
810
820
  contract_version: serverVersion,
811
821
  server_contract_version: serverVersion,
812
822
  project_agent: credential
@@ -820,11 +830,27 @@ async function collaborationStatus(options) {
820
830
  host_guidance: guidance,
821
831
  listener_status: listenerStatus,
822
832
  listener_note: "The listener receives inbound @Agent work; it does not activate foreground Coding-Agent collaboration.",
833
+ readiness: {
834
+ surface: "workspace_cli",
835
+ status,
836
+ inspected: [
837
+ "server_contract_version",
838
+ "local_project_agent_binding",
839
+ "installed_skill_version",
840
+ "local_listener_process",
841
+ ],
842
+ host_session_loaded: "not_observable_from_cli",
843
+ remote_mcp_connection: "not_observable_from_cli",
844
+ shared_contract: dictLike(liveContract.readiness),
845
+ next_actions: nextActions,
846
+ },
823
847
  synchronization: {
824
- mode: "host_guided_foreground",
848
+ mode: "complement_host_native_loop",
825
849
  automatic_transcript_capture: false,
826
850
  reason: "The host selects decision-relevant context and valuable results; Corvio never records arbitrary chats or local files in the background.",
827
- work_loop: liveContract.work_loop || ["ground", "work", "checkpoint", "materialize", "verify", "return"],
851
+ decision_points: Array.isArray(hostIntegration.decision_points)
852
+ ? hostIntegration.decision_points
853
+ : [],
828
854
  },
829
855
  next_actions: nextActions,
830
856
  }, { json: options.json });
@@ -1519,7 +1545,7 @@ async function agents(options, action, id) {
1519
1545
  reused: listener.reused,
1520
1546
  log: listener.log,
1521
1547
  },
1522
- foreground_collaboration: {
1548
+ local_collaboration_prerequisites: {
1523
1549
  status: hostGuidance.status === "ready"
1524
1550
  ? "ready"
1525
1551
  : hostGuidance.status === "contract_unavailable"
@@ -1527,7 +1553,9 @@ async function agents(options, action, id) {
1527
1553
  : "needs_skill",
1528
1554
  ready: hostGuidance.status === "ready",
1529
1555
  host_guidance: hostGuidance,
1530
- note: "The inbound listener and foreground collaboration are separate readiness facts.",
1556
+ host_session_loaded: "not_observable_from_cli",
1557
+ remote_mcp_connection: "not_observable_from_cli",
1558
+ note: "The inbound listener, installed Skill, Remote MCP, and current host session are separate readiness facts.",
1531
1559
  },
1532
1560
  settings_url: result.settings_url,
1533
1561
  next_command: hostGuidance.status === "ready"
@@ -2657,6 +2685,74 @@ async function docs(options, action, id) {
2657
2685
  await writeTextFile(options.output, String(result.markdown || ""));
2658
2686
  result = { ...result, output: options.output };
2659
2687
  }
2688
+ } else if (action === "table-read") {
2689
+ const targetId = documentId || option(options, "id", { required: true });
2690
+ result = await api.request(`/documents/${resourcePath(targetId)}/table`, {
2691
+ query: {
2692
+ table_id: options["table-id"] || undefined,
2693
+ after_row_id: options["after-row-id"] || undefined,
2694
+ limit: numberOption(options, "limit", 50, { minimum: 1, maximum: 100 }),
2695
+ },
2696
+ });
2697
+ } else if (action === "table-mutate") {
2698
+ requireConfirmation(options, "Mutating a document table");
2699
+ const targetId = documentId || option(options, "id", { required: true });
2700
+ const payload = await readJsonObject(option(options, "input", { required: true }), "--input");
2701
+ const changeSummary = String(options["change-summary"] || "").trim();
2702
+ if (executionIdentity === "agent" && !changeSummary) {
2703
+ throw new CliError(
2704
+ "Agent table mutations require --change-summary so collaborators can see what changed and why.",
2705
+ { code: "agent_document_change_summary_required" },
2706
+ );
2707
+ }
2708
+ const operationId = String(options["operation-id"] || payload.operation_id || randomUUID());
2709
+ result = await api.request(`/documents/${resourcePath(targetId)}/table`, {
2710
+ method: "PATCH",
2711
+ retrySafe: true,
2712
+ body: { ...payload, operation_id: operationId },
2713
+ });
2714
+ if (executionIdentity === "agent" && result?.status !== "no_op") {
2715
+ const commentIdempotencyKey = `document-table-change:${createHash("sha256")
2716
+ .update(JSON.stringify({ document_id: targetId, operation_id: operationId, body: changeSummary }))
2717
+ .digest("hex")}`;
2718
+ try {
2719
+ const comment = await api.request(`/documents/${resourcePath(targetId)}/comments`, {
2720
+ method: "POST",
2721
+ headers: { "idempotency-key": commentIdempotencyKey },
2722
+ body: {
2723
+ body: changeSummary,
2724
+ mention_targets: [],
2725
+ selection: { target_scope: "document" },
2726
+ entry_point: "external_agent_cli_document_table_change",
2727
+ start_new_chain: true,
2728
+ },
2729
+ });
2730
+ const entry = Array.isArray(comment?.entries) ? comment.entries.at(-1) : null;
2731
+ result = {
2732
+ ...result,
2733
+ change_comment: {
2734
+ thread_id: comment?.id || null,
2735
+ entry_id: entry?.id || null,
2736
+ body: changeSummary,
2737
+ },
2738
+ };
2739
+ } catch (error) {
2740
+ throw new CliError(
2741
+ "The table mutation succeeded, but its required change comment could not be created. Add the comment before reporting completion.",
2742
+ {
2743
+ code: "document_table_updated_comment_failed",
2744
+ exitCode: error instanceof CliError ? error.exitCode : EXIT.REMOTE,
2745
+ status: error instanceof CliError ? error.status : null,
2746
+ details: {
2747
+ document_id: targetId,
2748
+ operation_id: operationId,
2749
+ mutation: result,
2750
+ recovery_command: `corvio agent comment --document-id ${targetId} --body <change-summary> --start-new-chain --idempotency-key ${commentIdempotencyKey}`,
2751
+ },
2752
+ },
2753
+ );
2754
+ }
2755
+ }
2660
2756
  } else if (action === "create") {
2661
2757
  rejectTogether(options, "file", "markdown");
2662
2758
  const markdown = options.file ? await readTextFile(options.file) : String(options.markdown || "");
@@ -2781,7 +2877,7 @@ async function docs(options, action, id) {
2781
2877
  const opened = options["no-input"] ? false : await openBrowser(target);
2782
2878
  result = { document_id: targetId, url: target, opened };
2783
2879
  } else {
2784
- throw new CliError("docs action must be list, get, create, update, move, archive, restore, share, or open.");
2880
+ throw new CliError("docs action must be list, get, table-read, table-mutate, create, update, move, archive, restore, share, or open.");
2785
2881
  }
2786
2882
  writeResult(result, { json: options.json });
2787
2883
  }
@@ -2988,12 +3084,22 @@ async function files(options, action, id) {
2988
3084
  });
2989
3085
  } else if (action === "operation") {
2990
3086
  result = await api.request(`/file-operations/${resourcePath(assetId || option(options, "id", { required: true }))}`);
3087
+ } else if (action === "resume" || action === "cancel") {
3088
+ const operationId = assetId || option(options, "id", { required: true });
3089
+ requireConfirmation(
3090
+ options,
3091
+ `${action === "resume" ? "Resuming" : "Cancelling"} this file organization operation`,
3092
+ );
3093
+ result = await api.request(`/file-operations/${resourcePath(operationId)}:${action}`, {
3094
+ method: "POST",
3095
+ retrySafe: true,
3096
+ });
2991
3097
  } else if (action === "open") {
2992
3098
  const targetId = assetId || option(options, "id", { required: true });
2993
3099
  const target = `${String(process.env.CORVIO_APP_BASE || DEFAULT_APP_BASE).replace(/\/+$/, "")}/app/a/${resourcePath(targetId)}`;
2994
3100
  result = { file_id: targetId, url: target, opened: options["no-input"] ? false : await openBrowser(target) };
2995
3101
  } else {
2996
- throw new CliError("files action must be list, get, download, upload, organize, operation, or open.");
3102
+ throw new CliError("files action must be list, get, download, upload, organize, operation, resume, cancel, or open.");
2997
3103
  }
2998
3104
  writeResult(result, { json: options.json });
2999
3105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corvio/cli",
3
- "version": "0.1.0-beta.19",
3
+ "version": "0.1.0-beta.20",
4
4
  "description": "Official Corvio Workspace CLI for questions, knowledge search, documents, and Agent workflows.",
5
5
  "type": "module",
6
6
  "bin": {