@bivy/bivy 0.10.1-staging.263 → 0.10.1-staging.264
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 +43 -14
- package/package.json +1 -1
package/bin/bivy.mjs
CHANGED
|
@@ -432,9 +432,9 @@ function hasModelConfig(config) {
|
|
|
432
432
|
}
|
|
433
433
|
|
|
434
434
|
const SETUP_AGENT_CHOICES = [
|
|
435
|
-
{ key: "p", label: "Pi (default; uses your existing login and configuration)", runtimeId: "pi", command: "pi", needsBivyModel: false, loginHint: "Sign in through Pi (/login)" },
|
|
436
435
|
{ key: "c", label: "Claude Code", runtimeId: "claude-code-sdk", command: "claude", authProbe: ["auth", "status"], needsBivyModel: false, loginHint: "Sign in through Claude Code" },
|
|
437
|
-
{ key: "x", label: "Codex", runtimeId: "codex", command: "codex", authProbe: ["login", "status"], needsBivyModel: false, loginHint: "Sign in through Codex" },
|
|
436
|
+
{ key: "x", label: "Codex", runtimeId: "codex-approvals", command: "codex", authProbe: ["login", "status"], needsBivyModel: false, loginHint: "Sign in through Codex" },
|
|
437
|
+
{ key: "p", label: "Pi", runtimeId: "pi", command: "pi", needsBivyModel: false, loginHint: "Sign in through Pi (/login)" },
|
|
438
438
|
{ key: "o", label: "OpenCode", runtimeId: "opencode", command: "opencode", needsBivyModel: false },
|
|
439
439
|
{ key: "g", label: "Gemini CLI", runtimeId: "gemini", command: "gemini", needsBivyModel: false, loginHint: "Sign in through Gemini" },
|
|
440
440
|
{ key: "q", label: "Qwen Code", runtimeId: "qwen", command: "qwen", needsBivyModel: false, loginHint: "Sign in through Qwen" },
|
|
@@ -442,16 +442,23 @@ const SETUP_AGENT_CHOICES = [
|
|
|
442
442
|
{ key: "l", label: "Cline", runtimeId: "cline", needsBivyModel: false },
|
|
443
443
|
{ key: "r", label: "Crush", runtimeId: "crush", needsBivyModel: false },
|
|
444
444
|
];
|
|
445
|
+
const RECOMMENDED_SETUP_AGENT_IDS = new Set(["claude-code-sdk", "codex-approvals"]);
|
|
446
|
+
const recommendedSetupAgents = () => SETUP_AGENT_CHOICES.filter((choice) => RECOMMENDED_SETUP_AGENT_IDS.has(choice.runtimeId));
|
|
447
|
+
const additionalSetupAgents = () => SETUP_AGENT_CHOICES.filter((choice) => !RECOMMENDED_SETUP_AGENT_IDS.has(choice.runtimeId));
|
|
445
448
|
|
|
446
449
|
function setupAgentByRuntime(runtimeId) {
|
|
450
|
+
// Migrate the former ungoverned Codex exec default into the single recommended
|
|
451
|
+
// Codex surface when setup is re-run; existing Sessions retain their own id.
|
|
452
|
+
if (runtimeId === "codex") runtimeId = "codex-approvals";
|
|
447
453
|
return SETUP_AGENT_CHOICES.find((choice) => choice.runtimeId === runtimeId);
|
|
448
454
|
}
|
|
449
455
|
|
|
450
456
|
function setupAgentDefaultKey(config) {
|
|
451
457
|
const saved = setupAgentByRuntime(String(config?.env?.BIVY_RUNTIME || ""));
|
|
452
|
-
if (saved) return saved.key;
|
|
453
|
-
|
|
454
|
-
|
|
458
|
+
if (saved && RECOMMENDED_SETUP_AGENT_IDS.has(saved.runtimeId)) return saved.key;
|
|
459
|
+
if (saved) return "m";
|
|
460
|
+
const installed = recommendedSetupAgents().find((choice) => choice.command && commandExists(choice.command));
|
|
461
|
+
return installed?.key || "c";
|
|
455
462
|
}
|
|
456
463
|
|
|
457
464
|
function nativeAgentAuthDetected(choice) {
|
|
@@ -653,7 +660,7 @@ async function ensureSetupAgent(choice) {
|
|
|
653
660
|
const cli = await ensureNpmCommand("claude", "@anthropic-ai/claude-code", "Claude Code");
|
|
654
661
|
return sdk && cli;
|
|
655
662
|
}
|
|
656
|
-
if (choice.runtimeId === "codex") return ensureNpmCommand("codex", "@openai/codex", "Codex");
|
|
663
|
+
if (choice.runtimeId === "codex-approvals") return ensureNpmCommand("codex", "@openai/codex", "Codex");
|
|
657
664
|
if (choice.runtimeId === "opencode") return ensureNpmCommand("opencode", "opencode-ai/opencode", "OpenCode");
|
|
658
665
|
if (choice.runtimeId === "gemini") return ensureNpmCommand("gemini", "@google/gemini-cli", "Gemini CLI");
|
|
659
666
|
if (choice.runtimeId === "qwen") return ensureNpmCommand("qwen", "@qwen-code/qwen-code", "Qwen Code");
|
|
@@ -982,6 +989,19 @@ function defaultRunWorkspace(config) {
|
|
|
982
989
|
return res.code === 0 && res.stdout.trim() === "true" ? cwd : fallback;
|
|
983
990
|
}
|
|
984
991
|
|
|
992
|
+
/** First setup should use the repository the developer deliberately ran it
|
|
993
|
+
* from, when there is one. Never mistake Bivy's own source/install checkout for
|
|
994
|
+
* the customer's first repository; that path keeps the safe dedicated folder. */
|
|
995
|
+
function firstSetupWorkspace(config) {
|
|
996
|
+
if (config.workspace && config.workspace !== repoRoot) return config.workspace;
|
|
997
|
+
const cwd = path.resolve(process.cwd());
|
|
998
|
+
if (cwd !== repoRoot) {
|
|
999
|
+
const top = runQuiet("git", ["-C", cwd, "rev-parse", "--show-toplevel"]);
|
|
1000
|
+
if (top.code === 0 && top.stdout.trim()) return path.resolve(top.stdout.trim());
|
|
1001
|
+
}
|
|
1002
|
+
return path.join(os.homedir(), "bivy-workspace");
|
|
1003
|
+
}
|
|
1004
|
+
|
|
985
1005
|
// --- nodes registry ---------------------------------------------------------
|
|
986
1006
|
// Other Bivy nodes this machine can reach directly (LAN, Tailscale, SSH tunnel,
|
|
987
1007
|
// VPN). name → { url, token }. `bivy run --node <name>` starts the session on
|
|
@@ -3337,9 +3357,9 @@ async function cmdSetup(args = []) {
|
|
|
3337
3357
|
const rl = createPrompter();
|
|
3338
3358
|
const { ask, askChoice, askYesNo } = rl;
|
|
3339
3359
|
|
|
3340
|
-
// 1.
|
|
3341
|
-
//
|
|
3342
|
-
//
|
|
3360
|
+
// 1. Repository workspace + local port — chosen for the user, no prompts. If
|
|
3361
|
+
// setup is run from a repository, that repository is the first-task workspace;
|
|
3362
|
+
// otherwise use a dedicated ~/bivy-workspace folder. The local port is for this machine only (remote access
|
|
3343
3363
|
// goes through the relay). Both are changeable later in Settings.
|
|
3344
3364
|
//
|
|
3345
3365
|
// Port selection auto-avoids collisions so multiple nodes on one machine (e.g.
|
|
@@ -3348,7 +3368,7 @@ async function cmdSetup(args = []) {
|
|
|
3348
3368
|
// otherwise we take the first free port at or above 4317. Without this the
|
|
3349
3369
|
// second node would default to 4317 too and silently fail to bind.
|
|
3350
3370
|
if (!existingConfig || config.workspace === repoRoot) {
|
|
3351
|
-
const workspace = config
|
|
3371
|
+
const workspace = firstSetupWorkspace(config);
|
|
3352
3372
|
if (!fs.existsSync(workspace)) fs.mkdirSync(workspace, { recursive: true });
|
|
3353
3373
|
config.workspace = workspace;
|
|
3354
3374
|
const explicitPort = Number(process.env.PORT);
|
|
@@ -3370,15 +3390,24 @@ async function cmdSetup(args = []) {
|
|
|
3370
3390
|
// credentials. Prefer an already-installed native agent on a fresh machine,
|
|
3371
3391
|
// while retaining the saved choice when setup is re-run.
|
|
3372
3392
|
console.log(c.bold("\n Agent\n"));
|
|
3373
|
-
const
|
|
3393
|
+
const recommended = recommendedSetupAgents();
|
|
3394
|
+
const initialChoice = await askChoice(
|
|
3374
3395
|
"Which agent do you want to try first?",
|
|
3375
|
-
|
|
3396
|
+
[...recommended.map((choice) => ({
|
|
3376
3397
|
key: choice.key,
|
|
3377
3398
|
label: `${choice.label}${choice.command && commandExists(choice.command) ? " (installed)" : ""}`,
|
|
3378
|
-
})),
|
|
3399
|
+
})), { key: "m", label: "More agents…" }],
|
|
3379
3400
|
setupAgentDefaultKey(config),
|
|
3380
3401
|
);
|
|
3381
|
-
const
|
|
3402
|
+
const savedAgent = setupAgentByRuntime(String(config?.env?.BIVY_RUNTIME || ""));
|
|
3403
|
+
const agentChoice = initialChoice === "m"
|
|
3404
|
+
? await askChoice(
|
|
3405
|
+
"Choose another agent",
|
|
3406
|
+
additionalSetupAgents().map((choice) => ({ key: choice.key, label: `${choice.label}${choice.command && commandExists(choice.command) ? " (installed)" : ""}` })),
|
|
3407
|
+
savedAgent && !RECOMMENDED_SETUP_AGENT_IDS.has(savedAgent.runtimeId) ? savedAgent.key : "p",
|
|
3408
|
+
)
|
|
3409
|
+
: initialChoice;
|
|
3410
|
+
const setupAgent = SETUP_AGENT_CHOICES.find((choice) => choice.key === agentChoice) || setupAgentByRuntime("claude-code-sdk");
|
|
3382
3411
|
if (setupAgent) {
|
|
3383
3412
|
config.env = { ...config.env, BIVY_RUNTIME: setupAgent.runtimeId };
|
|
3384
3413
|
saveConfig(config);
|
package/package.json
CHANGED