@corvio/cli 0.1.0-beta.37 → 0.1.0-beta.39

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
@@ -10,6 +10,9 @@ corvio auth status
10
10
  corvio agents connect --provider codex --project . --json
11
11
  corvio collaboration status --json --no-input
12
12
  corvio ask --prompt 'Summarize recurring launch risks' --json
13
+ corvio ask --background --prompt 'Reconcile the current launch evidence' --json
14
+ corvio questions operation <operation_id> --after-cursor <progress_cursor> --wait-until-terminal --json
15
+ corvio questions cancel <operation_id> --yes --json
13
16
  corvio files upload --file ./research.pdf --json
14
17
  corvio files get <asset_id> --content --json
15
18
  corvio files organize <asset_id> --instruction 'Create a reusable decision brief' --yes --wait-until-terminal --timeout-seconds 1200 --json
@@ -54,6 +57,13 @@ Read the terminal Question receipt and use `artifact.url` or
54
57
  `links.primary_artifact` verbatim; `reader_output` artifacts are deliverables, `structure_container` artifacts are hierarchy, and
55
58
  `node_id` is never a document URL.
56
59
 
60
+ For a Question that may outlive one host turn, add `--background`. The command returns one durable `operation_id` immediately. Continue
61
+ that same operation with `corvio questions operation`; `--wait-until-terminal` keeps the status loop inside the CLI, while
62
+ `--after-cursor` returns only later user-visible milestones. A local deadline is not remote cancellation. Use
63
+ `corvio questions cancel <operation_id> --yes` to request a stop, and do not report success until the returned state is actually
64
+ `cancelled`. Progress is a bounded phase summary, never hidden reasoning or a provisional final answer. To correct the objective, finish
65
+ or cancel the current operation and start a successor `corvio ask --conversation-id <conversation_id>` rather than silently replacing it.
66
+
57
67
  Treat files as a value ladder, not one upload event. Upload/finalize preserves the exact original, provenance, hash, policy, and stable Asset ID. A selected Markdown file can become an editable Page through `corvio docs create --file`; for other formats or a coherent source set, use `corvio files organize` or `corvio ask --allow-actions` to produce the reader-facing Page, Spreadsheet, Presentation, Code, HTML Artifact, or reading layer that fits the task. Stable facts/preferences may enter Memory; only an evidence-backed reusable method, configuration, constraint, or quality bar should become a Project Skill.
58
68
 
59
69
  Use `corvio files get <asset_id> --content` when the task needs only bounded facts from one retained source. The response preserves the immutable original as authority, reports its source hash and whether the projection is complete or truncated, and does not create a Question or materialize another document. Never infer unseen workbook rows/sheets or document sections.
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.37";
42
+ const VERSION = "0.1.0-beta.39";
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}`;
@@ -49,6 +49,7 @@ const MAX_MARKDOWN_CHARACTERS = 120_000;
49
49
  const DEFAULT_FILE_OPERATION_WAIT_TIMEOUT_SECONDS = 1_200;
50
50
  const MAX_FILE_OPERATION_WAIT_TIMEOUT_SECONDS = 7_200;
51
51
  const FILE_OPERATION_PENDING_STATUSES = new Set(["accepted", "pending", "prepared", "queued", "running"]);
52
+ const QUESTION_OPERATION_PENDING_STATUSES = new Set(["queued", "running"]);
52
53
  const READ_ONLY_LOCAL_STATE_ERROR_CODES = new Set(["EACCES", "EPERM", "EROFS"]);
53
54
  const CORVIO_SKILL_ARCHIVE = "https://corvio.ai/developers/skills/corvio-operate-workspace/corvio-operate-workspace.zip";
54
55
  const AGENT_SKILLS_INSTALLER_VERSION = "1.5.23";
@@ -88,7 +89,7 @@ const COMMAND_OPTIONS = Object.freeze({
88
89
  "ask:": [
89
90
  "prompt", "conversation-id", "sources", "allow-actions", "context-file", "idempotency-key",
90
91
  "processing-profile", "max-processing-profile", "scan-mode", "skills-extraction-mode", "caller-model",
91
- "file", "asset-ids", "mime-type",
92
+ "file", "asset-ids", "mime-type", "background",
92
93
  ],
93
94
  "agents:list": ["include-revoked"],
94
95
  "agents:connect": [
@@ -114,6 +115,8 @@ const COMMAND_OPTIONS = Object.freeze({
114
115
  ],
115
116
  "questions:list": ["limit", "cursor", "conversation-id"],
116
117
  "questions:get": ["id"],
118
+ "questions:operation": ["id", "after-cursor", "wait-until-terminal", "timeout-seconds"],
119
+ "questions:cancel": ["id"],
117
120
  "conversations:list": ["limit", "cursor"],
118
121
  "conversations:get": ["id"],
119
122
  "search:": ["query", "limit", "page-id", "node-id"],
@@ -167,11 +170,11 @@ Usage:
167
170
  corvio auth login|status|logout
168
171
  corvio workspaces list|use|current|create [id]
169
172
  corvio capabilities
170
- corvio collaboration status [--project <path>] [--provider codex|claude_code|copilot]
173
+ corvio collaboration status [--project <path>] [--provider codex|claude_code|copilot|grok_build|muse_code]
171
174
  corvio ask --prompt <text> [--file <path>] [--asset-ids <id,id>] [--conversation-id <id>] [--allow-actions] [--processing-profile auto|economy|standard|deep]
172
175
  corvio agents list|connect|create|update|rotate [id]
173
176
  corvio agent claim|renew|complete|fail|comments|comment|reply|status|closeout|run [id]
174
- corvio questions list|get [id]
177
+ corvio questions list|get|operation|cancel [id]
175
178
  corvio conversations list|get [id]
176
179
  corvio search <query>
177
180
  corvio docs list|get|read|patch|table-read|table-mutate|create|update|move|archive|restore|share|open [id]
@@ -196,11 +199,11 @@ const COMMAND_HELP = Object.freeze({
196
199
  auth: `Usage: corvio auth login|status|logout\n\nAuthenticate with a user-level device link, inspect the current principal, or revoke the stored credential.`,
197
200
  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.`,
198
201
  capabilities: `Usage: corvio capabilities [--json]\n\nShow live API resources, principal scopes, selected Workspace status, and CLI compatibility.`,
199
- collaboration: `Usage:\n corvio collaboration status [--project <path>] [--provider codex|claude_code|copilot|workbuddy]\n\nCheck local Corvio prerequisites and every discoverable Corvio Skill copy. Current copies stay quiet; non-current receipts include one compact Agent notice and a source-aware next action. Standalone refresh commands pin the verified installer, select exactly one provider, and preserve project/global scope. WorkBuddy inspection is read-only and never changes ~/.workbuddy. The CLI cannot prove that the current host task loaded a particular copy, or whether remote MCP or host memory is active.`,
200
- 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\nAnswer-only is the default: omit --allow-actions; there is no --mode option. Keep the user's natural question unchanged, then append the smallest complete decision-relevant context or stable handles as a separate clause. A carried Project handle normally bounds a cross-branch question without enumerating all descendants. Handles are evidence addresses: do not invent a comparison rubric, prescribe reasoning steps, substitute another user objective, or turn current Tree labels into a detailed task plan. Unless the user chose them, do not invent taxonomy, titles, artifact count, or Corvio's internal plan; Corvio chooses the cognitive structure and carriers. In a bounded read-only continuation, start this foreground command exactly once when a trusted current-task or prior receipt already proves this authenticated CLI and exact Workspace; do not launch an identical Question concurrently or retry before terminal exit. If the host shell yields a running-session handle, wait on that exact handle until the CLI exits instead of answering from prior context. It returns the terminal Question without model-visible polling. Transport continuity does not prove a cheaper processing profile; leave processing on auto unless the remaining transformation independently justifies another profile. Do not install, probe, or switch to the CLI only for that optimization, and do not extend it to an unbound Workspace. --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. Use --allow-actions when Corvio should create the Page, Spreadsheet, Presentation, Code, HTML Artifact, Memory, or qualifying Project Skill that best serves the result. A continuation handle is subject evidence, not necessarily the durable write destination: for a reusable pattern or method, resolve the fitting same-scope Memory or Skill owner before admitting or merging it. Read the terminal Question receipt and use artifact.url or links.primary_artifact verbatim; reader_output artifacts are deliverables, structure_container artifacts are hierarchy, and node_id is never a document URL. Upload alone is not evidence of interpretation. Skill extraction mode always requires --allow-actions and an evidence-backed decision, not forced Skill creation; answer-only questions may use auto or off.`,
201
- 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.`,
202
- 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.`,
203
- questions: `Usage:\n corvio questions list [--limit <n>] [--cursor <cursor>] [--conversation-id <id>]\n corvio questions get <question-id>`,
202
+ collaboration: `Usage:\n corvio collaboration status [--project <path>] [--provider codex|claude_code|copilot|grok_build|muse_code|workbuddy]\n\nCheck local Corvio prerequisites and every discoverable Corvio Skill copy. Current copies stay quiet; non-current receipts include one compact Agent notice and a source-aware next action. Standalone refresh commands pin the verified installer when available and preserve project/global scope. Muse Code and Grok Build inspect their native and shared Agent Skill roots; WorkBuddy inspection is read-only. The CLI cannot prove that the current host task loaded a particular copy, or whether remote MCP or host memory is active.`,
203
+ ask: `Usage: corvio ask --prompt <text> [--file <path>] [--asset-ids <id,id>] [--conversation-id <id>] [--sources workspace,web,memory] [--allow-actions] [--background] [--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\nAnswer-only is the default: omit --allow-actions; there is no --mode option. Keep the user's natural question unchanged, then append the smallest complete decision-relevant context or stable handles as a separate clause. A carried Project handle normally bounds a cross-branch question without enumerating all descendants. Handles are evidence addresses: do not invent a comparison rubric, prescribe reasoning steps, substitute another user objective, or turn current Tree labels into a detailed task plan. Unless the user chose them, do not invent taxonomy, titles, artifact count, or Corvio's internal plan; Corvio chooses the cognitive structure and carriers. In a bounded read-only continuation, start this foreground command exactly once when a trusted current-task or prior receipt already proves this authenticated CLI and exact Workspace; do not launch an identical Question concurrently or retry before terminal exit. If the shell tool yields a running-session handle, wait on that exact handle until the CLI exits instead of answering from prior context. It returns the terminal Question without model-visible polling. Use --background for work that should outlive the current shell; it returns one durable operation immediately. Inspect it with questions operation, stop it with questions cancel, and use the terminal conversation_id for a corrected follow-up instead of silently changing an in-flight objective. Transport continuity does not prove a cheaper processing profile; leave processing on auto unless the remaining transformation independently justifies another profile. Do not install, probe, or switch to the CLI only to avoid MCP polling, and do not extend it to an unbound Workspace. --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. Use --allow-actions when Corvio should create the Page, Spreadsheet, Presentation, Code, HTML Artifact, Memory, or qualifying Project Skill that best serves the result. A continuation handle is subject evidence, not necessarily the durable write destination: for a reusable pattern or method, resolve the fitting same-scope Memory or Skill owner before admitting or merging it. Read the terminal Question receipt and use artifact.url or links.primary_artifact verbatim; reader_output artifacts are deliverables, structure_container artifacts are hierarchy, and node_id is never a document URL. Upload alone is not evidence of interpretation. Skill extraction mode always requires --allow-actions and an evidence-backed decision, not forced Skill creation; answer-only questions may use auto or off.`,
204
+ agents: `Usage:\n corvio agents list\n corvio agents connect [--provider codex|claude_code|copilot|grok_build] [--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|grok_build|grok_bot|muse|muse_code|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.`,
205
+ 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|grok_build|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.`,
206
+ questions: `Usage:\n corvio questions list [--limit <n>] [--cursor <cursor>] [--conversation-id <id>]\n corvio questions get <question-id>\n corvio questions operation <operation-id> [--after-cursor <n>] [--wait-until-terminal] [--timeout-seconds <1-7200>]\n corvio questions cancel <operation-id> --yes\n\nA Question operation is the durable owner for background work. operation returns only new user-visible milestones after --after-cursor and never exposes hidden reasoning or provisional answer text. --wait-until-terminal keeps deterministic polling in this process and returns a typed deadline receipt if the local deadline expires. cancel is idempotent; treat cancellation_requested as non-terminal and verify cancelled before telling the user the task stopped. Cancellation does not roll back effects that already settled. To correct the objective, stop or finish the current operation, then use corvio ask --conversation-id <conversation_id> so the new Question is an explicit successor.`,
204
207
  conversations: `Usage:\n corvio conversations list [--limit <n>] [--cursor <cursor>]\n corvio conversations get <conversation-id>`,
205
208
  search: `Usage: corvio search <query> [--limit <n>] [--page-id <id>] [--node-id <id>]`,
206
209
  docs: `Usage:\n corvio docs list [--limit <n>] [--cursor <cursor>] [--lifecycle active|archived]\n corvio docs get <id> [--output <path>]\n corvio docs read <id> [--mode auto|overview|line-range|section|search|full] [--start-line <n> --end-line <n>|--section-ref <S#>|--query <text>] [--max-chars <n>]\n corvio docs patch <id> --input <json> --yes [--operation-id <id>] [--change-summary <text>]\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 \`docs read --mode auto\` first for a small full body or a large-document overview, then read an exact section or line range. Use \`docs patch\` when the host already knows 1-20 exact L# replacements; it preserves untouched lines and returns a compact verified delta. A selected Markdown file can become an editable Page without resending the body through the model. Use \`docs update\` only when whole-body replacement is the smallest faithful change. Delegate document-wide judgment, cross-source synthesis, structure/formatting interpretation, and typed Spreadsheet, Presentation, Code, or HTML work to \`corvio ask --allow-actions\`. A Project is a structure container; body writes fail with project_structure_container_body_write_disabled, while a title-only Project rename remains valid. Projects stay at the Workspace root and cannot be nested; use \`files organize\` or \`ask --allow-actions\` for Work Model maintenance. Use table-read plus table-mutate for bounded stable-ID cell updates or row appends. 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.`,
@@ -258,6 +261,8 @@ function validateInvocation(options, positionals) {
258
261
  const actionsWithId = new Set([
259
262
  "workspaces:use",
260
263
  "questions:get",
264
+ "questions:operation",
265
+ "questions:cancel",
261
266
  "conversations:get",
262
267
  "docs:get",
263
268
  "docs:read",
@@ -965,6 +970,20 @@ async function inspectCollaborationGuidance(provider, projectRoot, liveContract,
965
970
  },
966
971
  );
967
972
  }
973
+ if (provider === "grok_build") {
974
+ candidates.push(
975
+ { scope: "project_grok", source: "project_skill", priority: 300, path: join(projectRoot, ".grok", "skills", "corvio-operate-workspace", "SKILL.md") },
976
+ { scope: "user_grok", source: "user_skill", priority: 200, path: join(homedir(), ".grok", "skills", "corvio-operate-workspace", "SKILL.md") },
977
+ );
978
+ }
979
+ if (provider === "muse_code") {
980
+ candidates.push({
981
+ scope: "user_muse",
982
+ source: "user_skill",
983
+ priority: 200,
984
+ path: join(String(process.env.XDG_CONFIG_HOME || join(homedir(), ".config")), "muse", "skills", "corvio-operate-workspace", "SKILL.md"),
985
+ });
986
+ }
968
987
  const found = [];
969
988
  for (const candidate of candidates) {
970
989
  try {
@@ -1046,6 +1065,10 @@ async function inspectCollaborationGuidance(provider, projectRoot, liveContract,
1046
1065
  let updateAction = null;
1047
1066
  if (provider === "workbuddy" && refreshAvailable) {
1048
1067
  updateAction = workbuddyAction || "Download the official Skill ZIP, replace it in WorkBuddy, then start a fresh conversation.";
1068
+ } else if (provider === "grok_build" && refreshAvailable) {
1069
+ updateAction = "Install the official Corvio Agent Plugin from its verified source, or place the verified Skill under .agents/skills, then start a fresh Grok Build session.";
1070
+ } else if (provider === "muse_code" && refreshAvailable) {
1071
+ updateAction = "Extract the official Corvio Skill archive, validate it, then run muse skills install <skill-directory> --scope user and start a fresh Muse Code session.";
1049
1072
  } else if (packageStatus === "multiple_copies_conflict") {
1050
1073
  updateAction = "Resolve the reported effective scopes explicitly; do not overwrite either copy by assumption.";
1051
1074
  } else if (pluginManaged && refreshAvailable) {
@@ -1089,8 +1112,8 @@ async function collaborationStatus(options) {
1089
1112
  fallbackToActive: false,
1090
1113
  });
1091
1114
  const provider = String(options.provider || credential?.metadata?.provider || "codex");
1092
- if (!["codex", "claude_code", "copilot", "workbuddy"].includes(provider)) {
1093
- throw new CliError("--provider must be codex, claude_code, copilot, or workbuddy.", {
1115
+ if (!["codex", "claude_code", "copilot", "grok_build", "muse_code", "workbuddy"].includes(provider)) {
1116
+ throw new CliError("--provider must be codex, claude_code, copilot, grok_build, muse_code, or workbuddy.", {
1094
1117
  code: "invalid_provider",
1095
1118
  });
1096
1119
  }
@@ -1104,7 +1127,7 @@ async function collaborationStatus(options) {
1104
1127
  const runnerState = await readAgentRunnerState();
1105
1128
  const listener = bindingId ? dictLike(runnerState?.listeners?.[bindingId]) : {};
1106
1129
  const listenerStatus = processIsRunning(Number(listener.pid)) ? "listening" : "offline";
1107
- const requiresProjectAgent = provider !== "workbuddy";
1130
+ const requiresProjectAgent = !["workbuddy", "muse_code"].includes(provider);
1108
1131
  let status = "ready";
1109
1132
  if (!credential && requiresProjectAgent) status = "needs_connection";
1110
1133
  else if (!serverVersion) status = "contract_unavailable";
@@ -1274,7 +1297,7 @@ async function ask(options, positionals) {
1274
1297
  const uniqueAssetIds = [...new Set(assetIds.map((value) => String(value).trim()).filter(Boolean))];
1275
1298
  let result;
1276
1299
  try {
1277
- result = await api.request("/questions", {
1300
+ result = await api.request(options.background ? "/question-operations" : "/questions", {
1278
1301
  method: "POST",
1279
1302
  headers: {
1280
1303
  "idempotency-key": idempotencyKey(options),
@@ -1292,7 +1315,7 @@ async function ask(options, positionals) {
1292
1315
  skills_extraction_mode: skillsExtractionMode,
1293
1316
  context,
1294
1317
  },
1295
- timeoutMs: 330_000,
1318
+ timeoutMs: options.background ? 30_000 : 330_000,
1296
1319
  });
1297
1320
  } catch (error) {
1298
1321
  if (attachedAssets.length > 0) {
@@ -1517,7 +1540,7 @@ async function resolveProjectRuntimeBinding(options, provider) {
1517
1540
  permission_profile: permissionProfile,
1518
1541
  trigger_policy: triggerPolicy,
1519
1542
  // These are observed provider capabilities, not security controls. Codex,
1520
- // Claude Code, and Copilot do not expose one common switch that can safely
1543
+ // Claude Code, Copilot, and Grok Build do not expose one common switch that can safely
1521
1544
  // separate project and personal instructions, memories, and connectors.
1522
1545
  // Host file authority is enforced separately by permission_profile.
1523
1546
  skills_scope: "project_and_personal",
@@ -1531,6 +1554,7 @@ async function probeAgentProvider(provider, projectRoot) {
1531
1554
  codex: { executable: "codex", versionArgs: ["--version"], authArgs: ["login", "status"] },
1532
1555
  claude_code: { executable: "claude", versionArgs: ["--version"], authArgs: ["auth", "status"] },
1533
1556
  copilot: { executable: "copilot", versionArgs: ["--version"], authArgs: null },
1557
+ grok_build: { executable: "grok", versionArgs: ["--version"], authArgs: null },
1534
1558
  };
1535
1559
  const spec = specs[provider];
1536
1560
  if (!spec) {
@@ -1562,6 +1586,32 @@ async function probeAgentProvider(provider, projectRoot) {
1562
1586
  return { provider, ready: false, version: version.stdout.trim(), reason: "Copilot did not complete its authenticated headless readiness check." };
1563
1587
  }
1564
1588
  }
1589
+ if (provider === "grok_build") {
1590
+ const authProbe = await runProviderCommand("grok", [
1591
+ "--no-auto-update",
1592
+ "--sandbox",
1593
+ "read-only",
1594
+ "--permission-mode",
1595
+ "dontAsk",
1596
+ "--allow",
1597
+ "Read",
1598
+ "--allow",
1599
+ "Grep",
1600
+ "--deny",
1601
+ "Edit",
1602
+ "--deny",
1603
+ "Bash(*)",
1604
+ "--cwd",
1605
+ projectRoot,
1606
+ "-p",
1607
+ "Return exactly READY and do not use tools.",
1608
+ "--output-format",
1609
+ "plain",
1610
+ ], { cwd: projectRoot, maximumBytes: 64 * 1024 });
1611
+ if (!/\bREADY\b/.test(authProbe.stdout)) {
1612
+ return { provider, ready: false, version: version.stdout.trim(), reason: "Grok Build did not complete its authenticated headless readiness check." };
1613
+ }
1614
+ }
1565
1615
  return { provider, ready: true, version: version.stdout.trim() };
1566
1616
  }
1567
1617
 
@@ -1726,6 +1776,8 @@ async function agents(options, action, id) {
1726
1776
  ? "my-claude"
1727
1777
  : provider === "copilot"
1728
1778
  ? "my-copilot"
1779
+ : provider === "grok_build"
1780
+ ? "my-grok"
1729
1781
  : "my-agent";
1730
1782
  const connect = (recoverCredential) => api.request("/agents:connect", {
1731
1783
  method: "POST",
@@ -2098,6 +2150,29 @@ async function runStructuredProvider({ provider, prompt, schema, binding, reques
2098
2150
  ...(binding.connector_scope === "off" ? ["--disable-builtin-mcps"] : []),
2099
2151
  ...permissionArgs,
2100
2152
  ], { maximumBytes: 2 * 1024 * 1024, cwd: projectRoot });
2153
+ } else if (provider === "grok_build") {
2154
+ const sandbox = profile === "danger_full_access"
2155
+ ? "off"
2156
+ : profile === "workspace_write"
2157
+ ? "workspace"
2158
+ : "read-only";
2159
+ const permissionArgs = profile === "danger_full_access"
2160
+ ? ["--always-approve"]
2161
+ : profile === "workspace_write"
2162
+ ? ["--permission-mode", "dontAsk", "--allow", "Read", "--allow", "Grep", "--allow", "Edit", "--allow", "Bash(*)"]
2163
+ : ["--permission-mode", "dontAsk", "--allow", "Read", "--allow", "Grep", "--deny", "Edit", "--deny", "Bash(*)"];
2164
+ result = await runProviderCommand("grok", [
2165
+ "--no-auto-update",
2166
+ "--sandbox",
2167
+ sandbox,
2168
+ ...permissionArgs,
2169
+ "--cwd",
2170
+ projectRoot,
2171
+ "-p",
2172
+ prompt,
2173
+ "--output-format",
2174
+ "json",
2175
+ ], { maximumBytes: 2 * 1024 * 1024, cwd: projectRoot });
2101
2176
  } else {
2102
2177
  throw new CliError("A custom provider requires --handler <executable>.", {
2103
2178
  code: "agent_handler_required",
@@ -2952,12 +3027,114 @@ function pageQuery(options) {
2952
3027
 
2953
3028
  async function questions(options, action, id) {
2954
3029
  const { api } = await executionClient(options, { continuityId: options["conversation-id"] || null });
2955
- const result = action === "list"
2956
- ? await api.request("/questions", { query: pageQuery(options) })
2957
- : await api.request(`/questions/${resourcePath(id || option(options, "id", { required: true }))}`);
3030
+ let result;
3031
+ if (action === "list") {
3032
+ result = await api.request("/questions", { query: pageQuery(options) });
3033
+ } else if (action === "get") {
3034
+ result = await api.request(`/questions/${resourcePath(id || option(options, "id", { required: true }))}`);
3035
+ } else if (action === "operation") {
3036
+ const operationId = id || option(options, "id", { required: true });
3037
+ const afterCursor = numberOption(options, "after-cursor", 0, { minimum: 0 });
3038
+ const timeoutSeconds = questionOperationWaitTimeoutSeconds(options);
3039
+ result = timeoutSeconds === null
3040
+ ? await api.request(`/question-operations/${resourcePath(operationId)}`, {
3041
+ query: { after_cursor: afterCursor },
3042
+ })
3043
+ : await waitForQuestionOperation(api, operationId, {
3044
+ afterCursor,
3045
+ timeoutSeconds,
3046
+ });
3047
+ } else if (action === "cancel") {
3048
+ const operationId = id || option(options, "id", { required: true });
3049
+ requireConfirmation(options, `Cancelling Question operation ${operationId}`);
3050
+ result = await api.request(`/question-operations/${resourcePath(operationId)}/cancel`, {
3051
+ method: "POST",
3052
+ retrySafe: true,
3053
+ });
3054
+ } else {
3055
+ throw new CliError("questions action must be list, get, operation, or cancel.");
3056
+ }
2958
3057
  writeResult(result, { json: options.json });
2959
3058
  }
2960
3059
 
3060
+ function questionOperationWaitTimeoutSeconds(options) {
3061
+ if (!options["wait-until-terminal"]) {
3062
+ if (options["timeout-seconds"] !== undefined) {
3063
+ throw new CliError("--timeout-seconds requires --wait-until-terminal.", {
3064
+ code: "question_operation_wait_required",
3065
+ });
3066
+ }
3067
+ return null;
3068
+ }
3069
+ return numberOption(
3070
+ options,
3071
+ "timeout-seconds",
3072
+ DEFAULT_FILE_OPERATION_WAIT_TIMEOUT_SECONDS,
3073
+ { minimum: 1, maximum: MAX_FILE_OPERATION_WAIT_TIMEOUT_SECONDS },
3074
+ );
3075
+ }
3076
+
3077
+ function questionOperationIsPending(result) {
3078
+ return QUESTION_OPERATION_PENDING_STATUSES.has(String(result?.status || "").trim().toLowerCase());
3079
+ }
3080
+
3081
+ function questionOperationDeadlineReceipt(result, { timeoutSeconds, startedAtMs, operationReadCount }) {
3082
+ return {
3083
+ ...result,
3084
+ transport_wait: {
3085
+ status: "deadline_reached",
3086
+ terminal: false,
3087
+ timeout_seconds: timeoutSeconds,
3088
+ elapsed_seconds: Math.max(0, Math.round((Date.now() - startedAtMs) / 1000)),
3089
+ operation_read_count: operationReadCount,
3090
+ continuation: "Run the same questions operation command with --wait-until-terminal; do not start a replacement Question.",
3091
+ },
3092
+ };
3093
+ }
3094
+
3095
+ async function waitForQuestionOperation(api, operationId, { afterCursor, timeoutSeconds }) {
3096
+ const startedAtMs = Date.now();
3097
+ const deadlineAtMs = startedAtMs + timeoutSeconds * 1000;
3098
+ let cursor = Math.max(0, Number(afterCursor) || 0);
3099
+ let result = null;
3100
+ let operationReadCount = 0;
3101
+ while (true) {
3102
+ const remainingMs = deadlineAtMs - Date.now();
3103
+ if (remainingMs <= 0 && result) {
3104
+ return questionOperationDeadlineReceipt(result, {
3105
+ timeoutSeconds,
3106
+ startedAtMs,
3107
+ operationReadCount,
3108
+ });
3109
+ }
3110
+ result = await api.request(`/question-operations/${resourcePath(operationId)}`, {
3111
+ query: {
3112
+ after_cursor: cursor,
3113
+ wait_seconds: Math.max(0, Math.min(30, Math.ceil(remainingMs / 1000))),
3114
+ },
3115
+ timeoutMs: Math.max(35_000, Math.min(remainingMs + 5_000, 40_000)),
3116
+ });
3117
+ operationReadCount += 1;
3118
+ if (Number.isFinite(Number(result.progress_cursor))) {
3119
+ cursor = Math.max(cursor, Number(result.progress_cursor));
3120
+ }
3121
+ if (!questionOperationIsPending(result)) return result;
3122
+ const nextRemainingMs = deadlineAtMs - Date.now();
3123
+ if (nextRemainingMs <= 0) {
3124
+ return questionOperationDeadlineReceipt(result, {
3125
+ timeoutSeconds,
3126
+ startedAtMs,
3127
+ operationReadCount,
3128
+ });
3129
+ }
3130
+ const retryAfterSeconds = Number(result.retry_after_seconds);
3131
+ const requestedDelayMs = Number.isFinite(retryAfterSeconds) && retryAfterSeconds >= 0
3132
+ ? retryAfterSeconds * 1000
3133
+ : 5_000;
3134
+ await sleep(Math.min(nextRemainingMs, Math.max(50, Math.min(30_000, requestedDelayMs))));
3135
+ }
3136
+ }
3137
+
2961
3138
  async function conversations(options, action, id) {
2962
3139
  const conversationId = action === "get" ? id || options.id || null : null;
2963
3140
  const { api } = await executionClient(options, { continuityId: conversationId });
package/dist/core.js CHANGED
@@ -93,6 +93,7 @@ export function parseArgv(argv) {
93
93
  "no-input",
94
94
  "yes",
95
95
  "allow-actions",
96
+ "background",
96
97
  "content",
97
98
  "organize",
98
99
  "private-link",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corvio/cli",
3
- "version": "0.1.0-beta.37",
3
+ "version": "0.1.0-beta.39",
4
4
  "description": "Official Corvio Workspace CLI for questions, knowledge search, documents, and Agent workflows.",
5
5
  "type": "module",
6
6
  "bin": {