@bivy/bivy 0.16.9 → 0.16.10-staging.2
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 +18 -1
- package/dist/runtime/host.js +19 -4
- package/package.json +1 -1
package/bin/bivy.mjs
CHANGED
|
@@ -1791,13 +1791,30 @@ async function cmdExec(args = []) {
|
|
|
1791
1791
|
let token;
|
|
1792
1792
|
try { token = await localDeviceToken(config); }
|
|
1793
1793
|
catch (error) { console.error(c.red(error?.message || String(error))); process.exit(1); return; }
|
|
1794
|
-
|
|
1794
|
+
// Translate the friendly bridge names to their governed runtime ids (the same
|
|
1795
|
+
// mapping `bivy run <agent> --chat` uses), so `bivy exec --agent codex` opens
|
|
1796
|
+
// the governed Codex app-server session instead of the plain exec fallback.
|
|
1797
|
+
// Other aliases (claude, gemini-cli, …) resolve server-side via the registry.
|
|
1798
|
+
const execArgs = translateExecAgent(args);
|
|
1799
|
+
const code = await run(nodeBin, [...nodeScriptArgs(execEntry), "--url", url(config), "--token", token, ...execArgs], {
|
|
1795
1800
|
cwd: repoRoot,
|
|
1796
1801
|
env: startEnv(config),
|
|
1797
1802
|
});
|
|
1798
1803
|
process.exit(code);
|
|
1799
1804
|
}
|
|
1800
1805
|
|
|
1806
|
+
// Rewrite a `bivy exec` arg list's --agent/-a value through governedChatAgentId,
|
|
1807
|
+
// leaving everything else (the free-text prompt, --session, flags) untouched.
|
|
1808
|
+
function translateExecAgent(args = []) {
|
|
1809
|
+
const out = [...args];
|
|
1810
|
+
for (let i = 0; i < out.length; i++) {
|
|
1811
|
+
const a = out[i];
|
|
1812
|
+
if ((a === "--agent" || a === "-a") && out[i + 1]) { out[i + 1] = governedChatAgentId(out[i + 1]); i++; }
|
|
1813
|
+
else if (typeof a === "string" && a.startsWith("--agent=")) out[i] = `--agent=${governedChatAgentId(a.slice("--agent=".length))}`;
|
|
1814
|
+
}
|
|
1815
|
+
return out;
|
|
1816
|
+
}
|
|
1817
|
+
|
|
1801
1818
|
// `bivy completions <bash|zsh|fish>` — print a shell completion script to eval or
|
|
1802
1819
|
// install. Covers the top-level commands and known integration ids.
|
|
1803
1820
|
function cmdCompletions(args = []) {
|
package/dist/runtime/host.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
2
|
// Copyright (c) 2026 Petter André Sjulstad
|
|
3
|
-
import { listRuntimes, makeRuntime } from "./index.js";
|
|
3
|
+
import { canonicalAgentId, listRuntimes, makeRuntime } from "./index.js";
|
|
4
4
|
import { RemoteRuntime, connectSocketTransport } from "./remote.js";
|
|
5
5
|
import { withExactCapabilitySurface } from "./types.js";
|
|
6
6
|
function remoteRuntimeSelection() {
|
|
@@ -50,12 +50,24 @@ export class RuntimeHost {
|
|
|
50
50
|
}
|
|
51
51
|
resolveRuntimeId(requested, fallback) {
|
|
52
52
|
const wantId = (requested || fallback).toLowerCase();
|
|
53
|
-
|
|
53
|
+
// Resolve declared aliases and historical ids through the one authoritative
|
|
54
|
+
// registry (e.g. `claude` → claude-code-sdk, `gemini-cli` → gemini,
|
|
55
|
+
// `open-code` → opencode) so the session/exec API accepts the same friendly
|
|
56
|
+
// names the picker and `bivy run` use — not only exact canonical ids. This
|
|
57
|
+
// honors the aliases integrations already declare as data, instead of making
|
|
58
|
+
// every caller know each canonical id (previously only the CLI's `--chat`
|
|
59
|
+
// path translated a couple by hand, so `bivy exec --agent claude` failed).
|
|
60
|
+
// Unknown names fall through to wantId and still raise "Unknown agent" below.
|
|
61
|
+
const canonical = canonicalAgentId(wantId) ?? wantId;
|
|
62
|
+
// Pass the resolved id as the "current" runtime so a hidden-but-runnable
|
|
63
|
+
// contribution is still resolvable to back a session (the profiles' "hidden
|
|
64
|
+
// from the picker, still runnable" contract; parity with makeRuntime).
|
|
65
|
+
const info = this.list(canonical).find((candidate) => candidate.id === canonical);
|
|
54
66
|
if (!info)
|
|
55
67
|
throw new Error(`Unknown agent: ${wantId}`);
|
|
56
68
|
if (info.status !== "available")
|
|
57
69
|
throw new Error(`${info.displayName} is not available on this node yet.`);
|
|
58
|
-
return
|
|
70
|
+
return canonical;
|
|
59
71
|
}
|
|
60
72
|
get(requested, fallback, sandbox) {
|
|
61
73
|
// Remote path (opt-in, reversible): return a RemoteRuntime that drives the
|
|
@@ -63,7 +75,10 @@ export class RuntimeHost {
|
|
|
63
75
|
// runtime the daemon can't run locally (e.g. the Claude SDK isn't installed
|
|
64
76
|
// here) is still offloadable — remote availability is the service's business.
|
|
65
77
|
const remote = remoteRuntimeSelection();
|
|
66
|
-
const
|
|
78
|
+
const requestedId = (requested || fallback).toLowerCase();
|
|
79
|
+
// Canonicalize before the remote check too, so an alias (e.g. `claude`) is
|
|
80
|
+
// matched against BIVY_REMOTE_RUNTIME and drives the correct remote facade.
|
|
81
|
+
const wantId = canonicalAgentId(requestedId) ?? requestedId;
|
|
67
82
|
if (remote && remote.enabled(wantId))
|
|
68
83
|
return this.getRemote(wantId, remote.addr, sandbox);
|
|
69
84
|
const id = this.resolveRuntimeId(requested, fallback);
|