@bivy/bivy 0.10.1-staging.285 → 0.10.1-staging.286

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/bivy.mjs CHANGED
@@ -1735,7 +1735,7 @@ async function cmdExec(args = []) {
1735
1735
  function cmdCompletions(args = []) {
1736
1736
  const shell = (args[0] || "").toLowerCase();
1737
1737
  const commands = [
1738
- "run", "sessions", "ls", "resume", "promote", "rename", "nodes", "agent", "agents", "agents:install", "shim", "takeover", "token", "exec",
1738
+ "run", "runs", "sessions", "ls", "resume", "promote", "rename", "nodes", "agent", "agents", "agents:install", "shim", "takeover", "token", "exec",
1739
1739
  "send", "attach", "kill", "setup", "start", "stop", "restart", "status", "doctor", "diagnostics", "logs", "login",
1740
1740
  "update", "update:log", "audit", "automation", "config", "plugin", "open", "service", "secrets", "voice", "link", "relay:setup",
1741
1741
  "github:connect", "github:app-create", "github:app-connect", "github:app-sync", "prune", "uninstall", "help", "version",
@@ -4578,7 +4578,8 @@ ${c.bold("bivy")} — Bivy node CLI
4578
4578
  ${c.cyan("bivy send <id>")} "..." Send a prompt to an existing session and stream the reply
4579
4579
  ${c.cyan("bivy kill <id>")} Stop a session/terminal (--delete also removes a saved session)
4580
4580
  ${c.cyan("bivy prune")} Delete old sessions/workspaces/worktrees (--keep N, --older-than 7d, --dry-run)
4581
- ${c.cyan("bivy exec")} "<prompt>" One-shot headless run: prints the answer to stdout (pipe-friendly)
4581
+ ${c.cyan("bivy exec")} "<prompt>" One-shot headless session: prints the answer to stdout (pipe-friendly)
4582
+ ${c.cyan("bivy runs start")} "<instructions>" Queue a one-off unattended Run with checks and a Receipt
4582
4583
  ${c.cyan("bivy automation")} list | trigger | init | validate | plan | test | apply
4583
4584
  ${c.cyan("bivy config")} init | validate | show | get | set | explain (typed node config)
4584
4585
  ${c.cyan("bivy plugin")} init | validate | doctor | test | install | list | remove
@@ -4698,6 +4699,17 @@ An agent's own --help passes through, e.g. 'bivy run claude --help'.`);
4698
4699
  case "completion":
4699
4700
  cmdCompletions(args);
4700
4701
  break;
4702
+ case "runs": {
4703
+ if (!(await ensureDeps())) process.exit(1);
4704
+ const [action, ...runArgs] = args;
4705
+ if (!action || ["-h", "--help", "help"].includes(action)) {
4706
+ console.log('Usage: bivy runs start "<instructions>" [--name <title>] [--repo <owner/name>] [--agent <id>] [--model <id>] [--approval <mode>] [--sandbox <tier>] [--max-attempts <n>] [--json]\n\nStart a one-off unattended Run. Unlike `bivy run`, this queues governed background work with checks, evidence, and a Receipt.');
4707
+ break;
4708
+ }
4709
+ if (action !== "start" && action !== "create") { console.error(c.red(`Unknown runs action: ${action}`)); process.exit(1); break; }
4710
+ process.exit(await run(nodeBin, [...nodeScriptArgs(automationEntry), "start-run", ...runArgs], { cwd: process.cwd(), env: process.env }));
4711
+ break;
4712
+ }
4701
4713
  case "automation":
4702
4714
  case "automations": {
4703
4715
  if (!(await ensureDeps())) process.exit(1);
@@ -30,6 +30,11 @@ Commands:
30
30
  test [path] --event <file> Simulate an event and explain the first match
31
31
  apply [path] [--prune] Encrypt instructions and reconcile the control plane
32
32
 
33
+ One-off Run flags (used by 'bivy runs start'):
34
+ --name <title> --repo <owner/name> --agent <id> --model <id>
35
+ --approval <mode> --sandbox <tier> --max-attempts <1-10> --json
36
+ Pass '-' as the instructions to read them from stdin.
37
+
33
38
  Default path: ${DEFAULT_AUTOMATION_CONFIG_PATH}
34
39
  List, trigger, and apply require an enrolled node ('bivy setup'). Instructions
35
40
  are encrypted on this machine before upload; the control plane receives
@@ -175,6 +180,57 @@ async function main() {
175
180
  }
176
181
  return;
177
182
  }
183
+ if (command === "start-run") {
184
+ if (args.includes("-h") || args.includes("--help"))
185
+ usage();
186
+ const valuedFlags = new Set(["--name", "--repo", "--agent", "--model", "--approval", "--sandbox", "--max-attempts"]);
187
+ const positional = [];
188
+ for (let i = 0; i < args.length; i += 1) {
189
+ const arg = args[i];
190
+ if (valuedFlags.has(arg)) {
191
+ i += 1;
192
+ continue;
193
+ }
194
+ if (arg.startsWith("--") && arg.includes("="))
195
+ continue;
196
+ if (arg === "--json")
197
+ continue;
198
+ positional.push(arg);
199
+ }
200
+ let instructions = positional.join(" ").trim();
201
+ if (instructions === "-")
202
+ instructions = fs.readFileSync(0, "utf8").trim();
203
+ if (!instructions)
204
+ throw new Error("instructions are required (or pass '-' to read stdin)");
205
+ const appDir = appDataDir();
206
+ const relay = relayConfig(appDir);
207
+ const identity = NodeIdentity.load(appDir);
208
+ const pairing = PairingStore.load(appDir, relay.e2eKey);
209
+ const approvalMode = value(args, "--approval") ?? "risky";
210
+ const sandbox = value(args, "--sandbox") ?? "workspace-write";
211
+ const maxAttempts = Number(value(args, "--max-attempts") ?? 2);
212
+ const title = (value(args, "--name") ?? instructions.split(/\r?\n/, 1)[0] ?? "One-off Run").slice(0, 120);
213
+ const created = await request(relay, "/node/automation-runs", {
214
+ method: "POST",
215
+ body: JSON.stringify({
216
+ title,
217
+ body: `bivy-room-v1:${identity.nodeId}:${seal(pairing.roomKey(), instructions)}`,
218
+ repo: value(args, "--repo"),
219
+ runtimeId: value(args, "--agent"),
220
+ model: value(args, "--model"),
221
+ approvalMode,
222
+ sandbox,
223
+ maxAttempts,
224
+ }),
225
+ });
226
+ if (args.includes("--json"))
227
+ console.log(JSON.stringify(created, null, 2));
228
+ else {
229
+ console.log(`Queued Run ${created.id} on ${identity.name}.`);
230
+ console.log(`Status: ${created.status}`);
231
+ }
232
+ return;
233
+ }
178
234
  if (command === "init") {
179
235
  const file = configPath(args);
180
236
  if (fs.existsSync(file) && !args.includes("--force"))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bivy/bivy",
3
- "version": "0.10.1-staging.285",
3
+ "version": "0.10.1-staging.286",
4
4
  "type": "module",
5
5
  "license": "AGPL-3.0-only",
6
6
  "description": "Run coding agents on machines you own. Open-source, self-hostable agent workspace.",