@botbuddy/cli 1.94.0 → 1.95.1
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/CHANGELOG.md +8 -0
- package/daemon/bin/darwin-arm64/botbuddy-daemon +0 -0
- package/daemon/bin/linux-x64/botbuddy-daemon +0 -0
- package/daemon-release/darwin-arm64.json +4 -4
- package/daemon-release/linux-x64.json +4 -4
- package/daemon-release/manifest.json +5 -5
- package/package.json +1 -1
- package/src/host-toolchain.mjs +110 -0
- package/src/stack.mjs +21 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.95.1
|
|
4
|
+
|
|
5
|
+
- BOT-3412: a host test child can execute native binaries that live in its own workspace (native npm packages after `pnpm install`, compiled test binaries, downloaded tools). systemd mounts a DynamicUser `StateDirectory` `noexec`; the daemon's unit now carries `ExecPaths=` for exactly that run's state directory. Every other sandbox property is unchanged.
|
|
6
|
+
|
|
7
|
+
## 1.95.0
|
|
8
|
+
|
|
9
|
+
- BOT-3407: a repo that commits `mise.toml` and `mise.lock` at its root gets exactly those tools in a host test child. The host daemon reads the two files from the head bundle, installs them with a pinned, sha256-verified mise in a sandboxed unit into `/var/lib/private/bb-toolchain/<tenant>/<digest>`, and binds that directory read-only at `/run/bb-child/toolchain`. A host `node_dir` stays on `PATH` behind it. A repeat run with the same tenant and digest starts no install unit. Hosts report one new capability, `toolchain` (and `toolchain_error` when the installer is unavailable). `bb stack run --test-child` requires `toolchain` when the head declares a toolchain, in place of the tools the manifest declares, and warns when `mise.toml` is committed without `mise.lock`. A versioned requirement such as `node>=24` counts as met only when the version the lock resolves meets it; otherwise the run is refused before any lease (`TOOLCHAIN_PREREQUISITE_CONFLICT`, exit 4). Only `core:` and `aqua:` backends with an https URL and a checksum for the host's platform are installed; anything else fails the run before the child starts (`TOOLCHAIN_BACKEND_REFUSED`, `TOOLCHAIN_CHECKSUM_MISSING`, `TOOLCHAIN_CHECKSUM_MISMATCH`, `TOOLCHAIN_MANIFEST_INVALID`, `TOOLCHAIN_INSTALL_FAILED`, `TOOLCHAIN_INSTALL_TIMEOUT`, `TOOLCHAIN_QUOTA_EXCEEDED`, `TOOLCHAIN_UNAVAILABLE`). Each tenant may hold 8 GiB of toolchains per host; one unused for 14 days is removed.
|
|
10
|
+
|
|
3
11
|
## 1.94.0
|
|
4
12
|
|
|
5
13
|
- BOT-3417: the bb-status band (plugin 1.8.0) shows each ticket's Linear customers as badges on its row, at most three and then `+N`. `bb status-band read` carries them from `get_session_status.tickets[].customers` (MCP 2.135.0), BB's own copy of Linear's customer requests; Linear is not called for them. A ticket BB holds no customers for shows no badge.
|
|
Binary file
|
|
Binary file
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"release_version": "1.
|
|
3
|
-
"source_commit": "
|
|
4
|
-
"source_sha256": "
|
|
2
|
+
"release_version": "1.95.1",
|
|
3
|
+
"source_commit": "c03b6c85d2170e402acd6e937270749ff8e32e96",
|
|
4
|
+
"source_sha256": "a3530f22ec199257f95f22058b784673c7b1f90daec707e64231e035620c0b78",
|
|
5
5
|
"target": "darwin-arm64",
|
|
6
|
-
"sha256": "
|
|
6
|
+
"sha256": "ff7230165e3d6aa6002bb98c3160068d325abccde8d2ccd3c4f6d5e0f7a50a70"
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"release_version": "1.
|
|
3
|
-
"source_commit": "
|
|
4
|
-
"source_sha256": "
|
|
2
|
+
"release_version": "1.95.1",
|
|
3
|
+
"source_commit": "c03b6c85d2170e402acd6e937270749ff8e32e96",
|
|
4
|
+
"source_sha256": "a3530f22ec199257f95f22058b784673c7b1f90daec707e64231e035620c0b78",
|
|
5
5
|
"target": "linux-x64",
|
|
6
|
-
"sha256": "
|
|
6
|
+
"sha256": "56fa09c1d4591661ccc0ea8f84569152284e78e952779a7aaf7a225264c75107"
|
|
7
7
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema_version": 1,
|
|
3
|
-
"release_version": "1.
|
|
4
|
-
"source_commit": "
|
|
5
|
-
"source_sha256": "
|
|
3
|
+
"release_version": "1.95.1",
|
|
4
|
+
"source_commit": "c03b6c85d2170e402acd6e937270749ff8e32e96",
|
|
5
|
+
"source_sha256": "a3530f22ec199257f95f22058b784673c7b1f90daec707e64231e035620c0b78",
|
|
6
6
|
"targets": {
|
|
7
7
|
"darwin-arm64": {
|
|
8
8
|
"goos": "darwin",
|
|
9
9
|
"goarch": "arm64",
|
|
10
10
|
"binary": "daemon/bin/darwin-arm64/botbuddy-daemon",
|
|
11
|
-
"sha256": "
|
|
11
|
+
"sha256": "ff7230165e3d6aa6002bb98c3160068d325abccde8d2ccd3c4f6d5e0f7a50a70",
|
|
12
12
|
"mode": "0755"
|
|
13
13
|
},
|
|
14
14
|
"linux-x64": {
|
|
15
15
|
"goos": "linux",
|
|
16
16
|
"goarch": "amd64",
|
|
17
17
|
"binary": "daemon/bin/linux-x64/botbuddy-daemon",
|
|
18
|
-
"sha256": "
|
|
18
|
+
"sha256": "56fa09c1d4591661ccc0ea8f84569152284e78e952779a7aaf7a225264c75107",
|
|
19
19
|
"mode": "0755"
|
|
20
20
|
}
|
|
21
21
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// BOT-3407 — the toolchain a repo declares for its host test children.
|
|
2
|
+
//
|
|
3
|
+
// A repo that commits `mise.toml` and `mise.lock` at its root gets exactly those tools in a
|
|
4
|
+
// host child: the serving host reads the two files from the head bundle, installs them in a
|
|
5
|
+
// sandbox into the tenant's own directory, and binds the result read-only into the child.
|
|
6
|
+
// Nothing is sent beside the bundle. The requester's only part is placement: such a run
|
|
7
|
+
// needs a host that reports the `toolchain` capability, and no longer needs the host to
|
|
8
|
+
// provide the tools the manifest itself declares.
|
|
9
|
+
|
|
10
|
+
import { spawnSync } from "node:child_process";
|
|
11
|
+
|
|
12
|
+
export const TOOLCHAIN_CAPABILITY = "toolchain";
|
|
13
|
+
const MANIFEST = "mise.toml";
|
|
14
|
+
const LOCK = "mise.lock";
|
|
15
|
+
const MAX_BYTES = 256 * 1024;
|
|
16
|
+
|
|
17
|
+
/** `core:node` and `aqua:pnpm/pnpm` name the tools `node` and `pnpm`. */
|
|
18
|
+
const toolName = (key) => key.slice(key.indexOf(":") + 1).split("/").pop();
|
|
19
|
+
|
|
20
|
+
/** The `[tools]` table of a mise.toml: each key (bare or quoted) and its plain version string. */
|
|
21
|
+
export function toolchainTools(tomlText) {
|
|
22
|
+
const tools = [];
|
|
23
|
+
let inTools = false;
|
|
24
|
+
for (const raw of String(tomlText).split(/\r?\n/)) {
|
|
25
|
+
const line = raw.trim();
|
|
26
|
+
// A table header may carry a trailing comment: `[tools] # pinned runtimes`.
|
|
27
|
+
if (line.startsWith("[")) { inTools = /^\[\s*tools\s*\]\s*(#.*)?$/.test(line); continue; }
|
|
28
|
+
if (!inTools) continue;
|
|
29
|
+
const m = /^(?:"([^"]+)"|'([^']+)'|([A-Za-z0-9_.-]+))\s*=\s*(?:"([^"]*)"|'([^']*)')?/.exec(line);
|
|
30
|
+
if (m) tools.push({ name: m[1] ?? m[2] ?? m[3], version: m[4] ?? m[5] ?? null });
|
|
31
|
+
}
|
|
32
|
+
return tools;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** The tool names in a mise.toml `[tools]` table (bare or quoted keys). */
|
|
36
|
+
export function toolchainToolNames(tomlText) {
|
|
37
|
+
return toolchainTools(tomlText).map((t) => t.name);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** The version mise.lock resolved for each tool (`[[tools.<name>]]` then `version = "…"`). */
|
|
41
|
+
export function lockedToolVersions(lockText) {
|
|
42
|
+
const versions = {};
|
|
43
|
+
let current = null;
|
|
44
|
+
for (const raw of String(lockText).split(/\r?\n/)) {
|
|
45
|
+
const line = raw.trim();
|
|
46
|
+
const header = /^\[\[\s*tools\.(?:"([^"]+)"|'([^']+)'|([A-Za-z0-9_-]+))\s*\]\]\s*(#.*)?$/.exec(line);
|
|
47
|
+
if (header) { current = header[1] ?? header[2] ?? header[3]; continue; }
|
|
48
|
+
if (line.startsWith("[")) { current = null; continue; }
|
|
49
|
+
const version = current && /^version\s*=\s*"([^"]*)"/.exec(line);
|
|
50
|
+
if (version && versions[toolName(current)] === undefined) versions[toolName(current)] = version[1];
|
|
51
|
+
}
|
|
52
|
+
return versions;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* What HEAD commits: `{ manifest: true, tools, versions }` when both files are there,
|
|
57
|
+
* `{ manifest: false, lockMissing: true }` when only mise.toml is (the host then builds
|
|
58
|
+
* nothing). `versions` is the lock's resolved version per tool, else mise.toml's own string.
|
|
59
|
+
* Only the committed head counts, because only the head is shipped.
|
|
60
|
+
*/
|
|
61
|
+
export function headToolchain(worktreeRoot, { run = spawnSync } = {}) {
|
|
62
|
+
const none = (lockMissing) => ({ manifest: false, lockMissing, tools: [], versions: {} });
|
|
63
|
+
// nosemgrep: javascript.lang.security.detect-child-process.detect-child-process -- fixed argv, no shell.
|
|
64
|
+
const toml = run("git", ["-C", worktreeRoot, "show", `HEAD:${MANIFEST}`], { encoding: "utf8", maxBuffer: MAX_BYTES + 1 });
|
|
65
|
+
if (toml.status !== 0) return none(false);
|
|
66
|
+
// nosemgrep: javascript.lang.security.detect-child-process.detect-child-process -- fixed argv, no shell.
|
|
67
|
+
const lock = run("git", ["-C", worktreeRoot, "show", `HEAD:${LOCK}`], { encoding: "utf8", maxBuffer: MAX_BYTES + 1 });
|
|
68
|
+
if (lock.status !== 0) return none(true);
|
|
69
|
+
const tools = toolchainTools(toml.stdout);
|
|
70
|
+
const locked = lockedToolVersions(lock.stdout);
|
|
71
|
+
const versions = {};
|
|
72
|
+
for (const t of tools) {
|
|
73
|
+
const version = locked[toolName(t.name)] ?? t.version;
|
|
74
|
+
if (version) versions[toolName(t.name)] = version;
|
|
75
|
+
}
|
|
76
|
+
return { manifest: true, lockMissing: false, tools: tools.map((t) => t.name), versions };
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Placement prerequisites for a run whose head declares a toolchain: `toolchain`, plus
|
|
81
|
+
* every requested prerequisite the manifest does not itself provide. `psql` or `git` stay
|
|
82
|
+
* the host's. `node>=24` is the manifest's only when the version it locks for `node` meets
|
|
83
|
+
* it: the manifest's tools come first on the child's PATH, so a lower or unreadable
|
|
84
|
+
* version is a conflict the run must not start with.
|
|
85
|
+
*/
|
|
86
|
+
export function toolchainPrerequisites(requires, head) {
|
|
87
|
+
const wanted = [...(requires ?? [])];
|
|
88
|
+
if (!head?.manifest) return { prerequisites: wanted, provided: [], conflicts: [] };
|
|
89
|
+
const declared = new Set(head.tools.map(toolName));
|
|
90
|
+
const provided = [];
|
|
91
|
+
const conflicts = [];
|
|
92
|
+
const rest = [];
|
|
93
|
+
for (const p of wanted) {
|
|
94
|
+
if (p === TOOLCHAIN_CAPABILITY) continue;
|
|
95
|
+
const [tool, minimum] = p.split(">=");
|
|
96
|
+
if (!declared.has(tool)) { rest.push(p); continue; }
|
|
97
|
+
if (minimum === undefined) { provided.push(p); continue; }
|
|
98
|
+
const version = head.versions?.[tool] ?? null;
|
|
99
|
+
const major = /^v?(\d+)/.exec(version ?? "");
|
|
100
|
+
if (major && Number(major[1]) >= Number(minimum)) provided.push(p);
|
|
101
|
+
else conflicts.push({ prerequisite: p, tool, declared: version });
|
|
102
|
+
}
|
|
103
|
+
return { prerequisites: [TOOLCHAIN_CAPABILITY, ...rest], provided, conflicts };
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** Why a run is refused: its own manifest cannot meet a prerequisite it asks for. */
|
|
107
|
+
export function toolchainConflictError(conflicts) {
|
|
108
|
+
const each = conflicts.map((c) => `--child-requires ${c.prerequisite}, but this head's mise.lock declares ${c.tool} ${c.declared ?? "with no readable version"}`);
|
|
109
|
+
return `${each.join("; ")}. The manifest's tools come first in a host child, so change mise.toml and mise.lock, or the requirement.`;
|
|
110
|
+
}
|
package/src/stack.mjs
CHANGED
|
@@ -63,6 +63,7 @@ import { STACK_RELEASE_INTENT_ENV, classifyStackRunOutcome, observeStackRunSigna
|
|
|
63
63
|
import { REQUESTER_NETWORK_CANDIDATE_CODES, REQUESTER_NETWORK_LOST_CODE, createRequesterNetworkWatch, requesterNetworkLostMessage } from "./requester-network.mjs";
|
|
64
64
|
import { provisionFailureFields, provisionFailureLine } from "./stack-provision-failure.mjs";
|
|
65
65
|
import { hostChildApi, hostChildReceiptFields, startHostChild, childEnvFrom, HOST_CHILD_DEFAULT_MAX_RUNTIME_S } from "./host-child.mjs";
|
|
66
|
+
import { headToolchain, toolchainConflictError, toolchainPrerequisites } from "./host-toolchain.mjs";
|
|
66
67
|
import { acquireTestChildSlot, defaultTestChildWait, readPs, requesterSample, startChildSampler, testChildApi, testChildReceiptFields } from "./test-child.mjs";
|
|
67
68
|
|
|
68
69
|
export const STACK_SCHEMA_VERSION = 1;
|
|
@@ -304,6 +305,11 @@ ${bold("run OPTIONS")}
|
|
|
304
305
|
curl,psql,playwright-chromium-libs). node, pnpm and deno count only when
|
|
305
306
|
they run inside a child's sandbox on that host (BOT-3402). A host lacking
|
|
306
307
|
one is not placed on; the child runs here and the run names what was missing.
|
|
308
|
+
BOT-3407: a head that commits mise.toml and mise.lock at its root gets
|
|
309
|
+
exactly those tools on the host, built in a sandbox per tenant and bound
|
|
310
|
+
read-only into the child. Placement then requires \`toolchain\` in
|
|
311
|
+
place of the tools the manifest declares. Only core and aqua backends
|
|
312
|
+
with a checksum for the host's platform are installed.
|
|
307
313
|
--child-env NAME BOT-3030: pass NAME (this shell's value) to a host child (repeatable).
|
|
308
314
|
Nothing else is passed; credential-shaped names are refused.
|
|
309
315
|
--child-max-runtime S BOT-3030: the host stops the child after S seconds (default 3600).
|
|
@@ -4057,6 +4063,14 @@ export async function runStackLifecycle(opts, childArgv, adapters = {}) {
|
|
|
4057
4063
|
// A receipt always says what happened to a port-block claim. Before allocation
|
|
4058
4064
|
// no claim exists, which is a safe, explicit disposition rather than omission.
|
|
4059
4065
|
// BOT-1803: whether this run re-adopted / re-provisioned an idle lease, and its stack digest.
|
|
4066
|
+
// BOT-3407: a head whose own toolchain cannot meet a prerequisite the run asks for is
|
|
4067
|
+
// refused before any lease, because the manifest's tools come first in a host child.
|
|
4068
|
+
if (opts.testChild && opts.childRequires?.length) {
|
|
4069
|
+
const declared = toolchainPrerequisites(opts.childRequires, (adapters.headToolchain ?? headToolchain)(adapters.cwd ?? process.cwd()));
|
|
4070
|
+
if (declared.conflicts.length) {
|
|
4071
|
+
return { exitCode: EXIT.INVALID, outcome: "refused", code: "TOOLCHAIN_PREREQUISITE_CONFLICT", error: toolchainConflictError(declared.conflicts) };
|
|
4072
|
+
}
|
|
4073
|
+
}
|
|
4060
4074
|
const freshBox = () => ({ incident: null, execution: null, idleLease: null, webUrl: null, portBlock: { released: false, reason: "no port-block claim was created before stack allocation" } });
|
|
4061
4075
|
const incidentBox = freshBox();
|
|
4062
4076
|
const startedAtMs = (adapters.now ?? Date.now)();
|
|
@@ -5495,11 +5509,17 @@ async function runStackLifecycleOnce(opts, childArgv, adapters, incidentBox) {
|
|
|
5495
5509
|
const waitTouch = clock.setInterval(() => { void touchWhileWaiting(); }, waitCadenceMs);
|
|
5496
5510
|
waitTouch?.unref?.();
|
|
5497
5511
|
let placed;
|
|
5512
|
+
// BOT-3407: a head that commits mise.toml and mise.lock brings its own tools, so
|
|
5513
|
+
// placement asks the host for `toolchain` instead of for those tools.
|
|
5514
|
+
const head = (adapters.headToolchain ?? headToolchain)(execution.worktreeRoot);
|
|
5515
|
+
const toolchain = toolchainPrerequisites(opts.childRequires, head);
|
|
5516
|
+
if (head.manifest) stderrLine(`stack: this head declares its toolchain (mise.toml, mise.lock): placement requires a host with \`toolchain\`${toolchain.provided.length ? `; ${toolchain.provided.join(", ")} come from the manifest` : ""}`);
|
|
5517
|
+
else if (head.lockMissing) stderrLine("stack: this head commits mise.toml without mise.lock, so a host builds no toolchain for it; run `mise lock` and commit mise.lock to give host children the repo's own tools");
|
|
5498
5518
|
testChildWaitAbort = new AbortController();
|
|
5499
5519
|
try {
|
|
5500
5520
|
placed = await acquireTestChildSlot({
|
|
5501
5521
|
signal: testChildWaitAbort.signal,
|
|
5502
|
-
api: testChildCalls, leaseId, wait: adapters.testChildWait ?? defaultTestChildWait, log: stderrLine, prerequisites:
|
|
5522
|
+
api: testChildCalls, leaseId, wait: adapters.testChildWait ?? defaultTestChildWait, log: stderrLine, prerequisites: toolchain.prerequisites,
|
|
5503
5523
|
isStopped: () => Boolean(receivedSignal || tunnelLost || callbackLost || originLost),
|
|
5504
5524
|
onPark: touchWhileWaiting,
|
|
5505
5525
|
});
|