@bivy/bivy 0.16.17-staging.1 → 0.16.17-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.
@@ -45,7 +45,8 @@
45
45
  ],
46
46
  "install": {
47
47
  "kind": "pip",
48
- "pkg": "aider-chat"
48
+ "pkg": "aider-chat",
49
+ "python": "3.12"
49
50
  }
50
51
  },
51
52
  {
package/bin/bivy.mjs CHANGED
@@ -668,12 +668,9 @@ async function ensureNpmCommand(command, packageName, label) {
668
668
 
669
669
  async function ensurePythonCommand(command, packageName, label) {
670
670
  if (commandExists(command)) return true;
671
- if (!commandExists("python3")) {
672
- console.log(c.yellow(`Skipping ${label}: python3 is not available.`));
673
- return false;
674
- }
675
- console.log(c.dim(`Installing ${label} (${packageName})…`));
676
- const code = await run("python3", ["-m", "pip", "install", "--user", packageName]);
671
+ const install = loadAgentManifest().find((agent) => agent.command === command)?.install;
672
+ console.log(c.dim(`Installing ${label} (${packageName}) in an isolated Python environment…`));
673
+ const code = await run(process.execPath, [path.join(__dirname, "install-python-agent.mjs"), packageName, install?.python ?? "", userLocalPrefix]);
677
674
  return code === 0 && commandExists(command);
678
675
  }
679
676
 
@@ -0,0 +1,24 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (c) 2026 Petter André Sjulstad
3
+ // Shared by terminal setup/update and the daemon's agent installer.
4
+ import { spawnSync } from "node:child_process";
5
+ import path from "node:path";
6
+ import os from "node:os";
7
+
8
+ const [pkg, python, prefix] = process.argv.slice(2);
9
+ if (!pkg || !prefix) {
10
+ console.error("Usage: install-python-agent.mjs <package> <python-or-empty> <prefix>");
11
+ process.exit(1);
12
+ }
13
+ const probe = spawnSync("uv", ["--version"], { stdio: "ignore" });
14
+ if (probe.error || probe.status !== 0) {
15
+ console.error("Python agent installation requires uv. Install it from https://docs.astral.sh/uv/getting-started/installation/ then re-run 'bivy agents:install'.");
16
+ process.exit(1);
17
+ }
18
+ const resolvedPrefix = prefix === "~" ? os.homedir() : prefix.startsWith("~/") ? path.join(os.homedir(), prefix.slice(2)) : prefix;
19
+ const result = spawnSync("uv", ["tool", "install", ...(python ? ["--python", python] : []), pkg], {
20
+ stdio: "inherit",
21
+ env: { ...process.env, UV_TOOL_BIN_DIR: path.join(resolvedPrefix, "bin") },
22
+ });
23
+ if (result.error) console.error(result.error.message);
24
+ process.exit(result.status ?? 1);
@@ -104,7 +104,8 @@ export const AGENT_PROFILES = {
104
104
  // generic id-based primitive, and unsafe to bolt on generically (a second,
105
105
  // unrelated session opened in the same workspace would inherit that file's
106
106
  // history). See docs/agents-not-fully-supported.md.
107
- install: { kind: "pip", pkg: "aider-chat" },
107
+ // Isolate dependencies from the host Python (which may be too new).
108
+ install: { kind: "pip", pkg: "aider-chat", python: "3.12" },
108
109
  },
109
110
  hermes: {
110
111
  displayName: "Hermes",
@@ -236,12 +236,10 @@ function installSpecForCliAgent(spec, prefix) {
236
236
  };
237
237
  }
238
238
  if (install.kind === "pip") {
239
- // Some node images ship a python3 without pip; bootstrap it via ensurepip
240
- // (best-effort) before installing, but show users the plain pip line.
241
239
  return {
242
- command: "sh",
243
- args: ["-c", `python3 -m ensurepip --user >/dev/null 2>&1 || true; python3 -m pip install --user ${install.pkg}`],
244
- display: `python3 -m pip install --user ${install.pkg}`,
240
+ command: process.execPath,
241
+ args: [path.join(path.dirname(fileURLToPath(import.meta.url)), "..", "..", "bin", "install-python-agent.mjs"), install.pkg, install.python ?? "", prefix],
242
+ display: `uv tool install${install.python ? ` --python ${install.python}` : ""} ${install.pkg}`,
245
243
  };
246
244
  }
247
245
  // curl / script: `{bin}` → the node's <prefix>/bin so binaries land on PATH.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bivy/bivy",
3
- "version": "0.16.17-staging.1",
3
+ "version": "0.16.17-staging.2",
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.",