@botbuddy/cli 1.90.0 → 1.91.0
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 +4 -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/commands.mjs +2 -2
- package/src/mcp-key.mjs +4 -1
- package/src/stack-bundle.mjs +44 -5
- package/src/stack.mjs +47 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.91.0
|
|
4
|
+
|
|
5
|
+
- BOT-3371: a stack a Go daemon host starts for a lease skips Supabase Studio, vector, Logflare (analytics) and postgres-meta, which tests never call, saving about 1 GB per stack. `bb stack run --supabase-service <name>` (repeatable) keeps one of them (`studio` also keeps `postgres-meta`, `logflare` also keeps `vector`); any other name is refused before a lease exists (exit 4 `STACK_SERVICE_NOT_ALLOWED`). The receipt's `supabase_services` lists what the stack runs. The daemon checks the running containers after start and fails the provision (`supabase_service_plan_unmet`) rather than activate a stack that started a skipped service or lacks an opted-in one.
|
|
6
|
+
|
|
3
7
|
## 1.85.3
|
|
4
8
|
|
|
5
9
|
- BOT-3276: `bb stack run --test-child` measures the child's whole process tree, including browsers and servers that move to their own process group or session. `child_resources.method` is now `ps_tree_sample`; the receipt's fields are unchanged.
|
|
Binary file
|
|
Binary file
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"release_version": "1.
|
|
3
|
-
"source_commit": "
|
|
4
|
-
"source_sha256": "
|
|
2
|
+
"release_version": "1.91.0",
|
|
3
|
+
"source_commit": "4408300cd49ba1d4fbda5fd79c2aa3f79b5ee24c",
|
|
4
|
+
"source_sha256": "03c050b688b1cbc1973be82b4307c0037984a785c3361e44a7598d465b8b4738",
|
|
5
5
|
"target": "darwin-arm64",
|
|
6
|
-
"sha256": "
|
|
6
|
+
"sha256": "3782bb2b0f6d6a7c7b9f61210beb40327aa32afff7874e5d83e101734d3d2d0c"
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"release_version": "1.
|
|
3
|
-
"source_commit": "
|
|
4
|
-
"source_sha256": "
|
|
2
|
+
"release_version": "1.91.0",
|
|
3
|
+
"source_commit": "4408300cd49ba1d4fbda5fd79c2aa3f79b5ee24c",
|
|
4
|
+
"source_sha256": "03c050b688b1cbc1973be82b4307c0037984a785c3361e44a7598d465b8b4738",
|
|
5
5
|
"target": "linux-x64",
|
|
6
|
-
"sha256": "
|
|
6
|
+
"sha256": "2b5195d61e7053fedf175e3306f8b1ab82668c3376d841465236decfaf4f35b6"
|
|
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.91.0",
|
|
4
|
+
"source_commit": "4408300cd49ba1d4fbda5fd79c2aa3f79b5ee24c",
|
|
5
|
+
"source_sha256": "03c050b688b1cbc1973be82b4307c0037984a785c3361e44a7598d465b8b4738",
|
|
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": "3782bb2b0f6d6a7c7b9f61210beb40327aa32afff7874e5d83e101734d3d2d0c",
|
|
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": "2b5195d61e7053fedf175e3306f8b1ab82668c3376d841465236decfaf4f35b6",
|
|
19
19
|
"mode": "0755"
|
|
20
20
|
}
|
|
21
21
|
}
|
package/package.json
CHANGED
package/src/commands.mjs
CHANGED
|
@@ -1566,8 +1566,8 @@ export function mcpHelp(log = console.log) {
|
|
|
1566
1566
|
A bb_mcp_ key is tenant-sealed: on a machine serving more than
|
|
1567
1567
|
one tenant, mint each tenant under a distinct --env <NAME> var
|
|
1568
1568
|
and commit that repo's matching .botbuddy-agent.json mcp_env.
|
|
1569
|
-
Refuses an occupied Keychain slot unless --force
|
|
1570
|
-
|
|
1569
|
+
Refuses an occupied Keychain slot unless --force, which
|
|
1570
|
+
replaces the key in that slot and revokes the key it replaces.
|
|
1571
1571
|
revoke <agent_id> [--tenant <slug>] [--env <NAME>]
|
|
1572
1572
|
Revoke ONLY that MCP key (returned by setup). Your login and
|
|
1573
1573
|
live agent sessions keep working. Multi-tenant owners must
|
package/src/mcp-key.mjs
CHANGED
|
@@ -465,9 +465,12 @@ export async function revokeMcpKey({
|
|
|
465
465
|
// and macOS offers no per-service cross-process lock. So we always hand back the
|
|
466
466
|
// exact, side-effect-free deletion command instead of deleting anything.
|
|
467
467
|
const slot = envVar || "<NAME>";
|
|
468
|
+
// BOT-3337 AC-2: a key revoked earlier (e.g. by `mcp setup --force`) is still
|
|
469
|
+
// dead; say so instead of reporting a second revoke.
|
|
470
|
+
const already = response.data?.already_revoked === true;
|
|
468
471
|
return {
|
|
469
472
|
schema_version: 1,
|
|
470
|
-
outcome: "revoked",
|
|
473
|
+
outcome: already ? "already_revoked" : "revoked",
|
|
471
474
|
agent_id: id,
|
|
472
475
|
...(envVar ? { env_var: envVar } : {}),
|
|
473
476
|
next_step:
|
package/src/stack-bundle.mjs
CHANGED
|
@@ -50,6 +50,33 @@ export function isExcludedBundlePath(relPath) {
|
|
|
50
50
|
return SECRET_DOTENV.test(name);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
// ── BOT-3371: --supabase-service (the lease's opt-in back to unused services) ──
|
|
54
|
+
|
|
55
|
+
/** Services a daemon-started leased stack skips unless the lease opts back in. Names are the
|
|
56
|
+
* `supabase start -x` tokens (the Go daemon's allowlist, daemon/stack_services.go). */
|
|
57
|
+
export const OPTIONAL_SUPABASE_SERVICES = Object.freeze(["studio", "vector", "logflare", "postgres-meta"]);
|
|
58
|
+
/** Where the opt-in ships in the bundle; the daemon reads it from the materialized claim. */
|
|
59
|
+
export const STACK_SERVICES_OPT_IN_PATH = ".botbuddy/stack-services.json";
|
|
60
|
+
|
|
61
|
+
/** Validate one `--supabase-service` name; throws STACK_SERVICE_NOT_ALLOWED. */
|
|
62
|
+
export function validateSupabaseServiceName(name) {
|
|
63
|
+
const value = typeof name === "string" ? name : "";
|
|
64
|
+
if (!OPTIONAL_SUPABASE_SERVICES.includes(value)) {
|
|
65
|
+
throw bundleError("STACK_SERVICE_NOT_ALLOWED",
|
|
66
|
+
`--supabase-service ${JSON.stringify(value)}: not an optional service; choose from ${OPTIONAL_SUPABASE_SERVICES.join(", ")} ` +
|
|
67
|
+
"(every other Supabase service always runs)");
|
|
68
|
+
}
|
|
69
|
+
return value;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** The exact opt-in file body for `include` (allowlist order), or null when nothing is opted in.
|
|
73
|
+
* Null keeps the bundle byte-identical to a pre-BOT-3371 one, so a default lease's digest is unchanged. */
|
|
74
|
+
export function stackServicesOptInBody(include = []) {
|
|
75
|
+
const wanted = new Set(include.map(validateSupabaseServiceName));
|
|
76
|
+
if (wanted.size === 0) return null;
|
|
77
|
+
return Buffer.from(JSON.stringify({ schema: 1, include: OPTIONAL_SUPABASE_SERVICES.filter((s) => wanted.has(s)) }) + "\n", "utf8");
|
|
78
|
+
}
|
|
79
|
+
|
|
53
80
|
// ── BOT-2269: --bundle-include (exact paths) + the content guard ─────────────
|
|
54
81
|
|
|
55
82
|
const NO_OPT_IN = new Set();
|
|
@@ -356,20 +383,32 @@ export function buildStackBundle(stackDir, { maxBytes = DEFAULT_BUNDLE_MAX_BYTES
|
|
|
356
383
|
}
|
|
357
384
|
const present = new Set(entries.map((e) => e.rel));
|
|
358
385
|
const extras = [];
|
|
359
|
-
for (const { rel, abs } of extraFiles) {
|
|
386
|
+
for (const { rel, abs, content } of extraFiles) {
|
|
360
387
|
const parts = String(rel).split("/");
|
|
361
388
|
if (!rel || rel.startsWith("/") || parts.some((p) => p === "" || p === "." || p === "..") || isExcludedBundlePath(rel)) {
|
|
362
389
|
throw bundleError("BUNDLE_UNSAFE_LINK", `refusing to add ${rel} to the bundle: it is not a safe relative path`);
|
|
363
390
|
}
|
|
391
|
+
// BOT-3371: generated content (the services opt-in) must be the bytes that ship, never a
|
|
392
|
+
// same-named file the stack dir happens to carry.
|
|
393
|
+
if (present.has(rel) && content !== undefined) {
|
|
394
|
+
throw bundleError("BUNDLE_UNSAFE_LINK", `refusing to add ${rel} to the bundle: the stack directory already carries a file at that path`);
|
|
395
|
+
}
|
|
364
396
|
if (present.has(rel)) continue;
|
|
365
|
-
|
|
366
|
-
if (
|
|
397
|
+
let size;
|
|
398
|
+
if (content !== undefined) {
|
|
399
|
+
if (!Buffer.isBuffer(content)) throw bundleError("BUNDLE_UNSAFE_LINK", `refusing to add ${rel} to the bundle: its generated content is not bytes`);
|
|
400
|
+
size = content.length;
|
|
401
|
+
} else {
|
|
402
|
+
const info = lstatSync(abs);
|
|
403
|
+
if (!info.isFile()) throw bundleError("BUNDLE_UNSAFE_LINK", `refusing to add ${rel} to the bundle: ${abs} is not a regular file`);
|
|
404
|
+
size = info.size;
|
|
405
|
+
}
|
|
367
406
|
for (let i = 1; i < parts.length; i++) {
|
|
368
407
|
const dir = `${parts.slice(0, i).join("/")}/`;
|
|
369
408
|
if (!present.has(dir)) { present.add(dir); extras.push({ rel: dir, type: "dir" }); }
|
|
370
409
|
}
|
|
371
410
|
present.add(rel);
|
|
372
|
-
extras.push({ rel, type: "file", abs,
|
|
411
|
+
extras.push({ rel, type: "file", abs, content, size, executable: false });
|
|
373
412
|
}
|
|
374
413
|
entries.unshift(...extras);
|
|
375
414
|
// Raw bytes are bounded too, so a pathological tree fails fast instead of
|
|
@@ -389,7 +428,7 @@ export function buildStackBundle(stackDir, { maxBytes = DEFAULT_BUNDLE_MAX_BYTES
|
|
|
389
428
|
// Codex #1077 P2: refuse from the stat size BEFORE allocating the file, so one
|
|
390
429
|
// huge file is a BUNDLE_TOO_LARGE error, never an out-of-memory kill.
|
|
391
430
|
if (raw + entry.size > rawLimit) throw tooLarge(`more than ${rawLimit} bytes before compression (at ${entry.rel}, ${entry.size} bytes)`);
|
|
392
|
-
const body = readFile(entry.abs);
|
|
431
|
+
const body = entry.content ?? readFile(entry.abs);
|
|
393
432
|
if (optIn.has(entry.rel)) {
|
|
394
433
|
// The bytes that ship must be the bytes the guard scanned.
|
|
395
434
|
const scanned = included.find((e) => e.path === entry.rel);
|
package/src/stack.mjs
CHANGED
|
@@ -52,7 +52,7 @@ import { patchRequesterAuthOrigin } from "./stack-requester-origin-config.mjs";
|
|
|
52
52
|
import { measureStackUsage } from "./stack-usage.mjs";
|
|
53
53
|
import { checkReadoptedStackMounts } from "./stack-mount-health.mjs";
|
|
54
54
|
import { machineUuid } from "./machine-id.mjs";
|
|
55
|
-
import { DEFAULT_BUNDLE_MAX_BYTES, buildStackBundle, uploadStackBundle, validateBundleIncludePath } from "./stack-bundle.mjs";
|
|
55
|
+
import { DEFAULT_BUNDLE_MAX_BYTES, OPTIONAL_SUPABASE_SERVICES, STACK_SERVICES_OPT_IN_PATH, buildStackBundle, stackServicesOptInBody, uploadStackBundle, validateBundleIncludePath, validateSupabaseServiceName } from "./stack-bundle.mjs";
|
|
56
56
|
import { assertSshTarget, establishSshTunnel } from "./stack-tunnel.mjs";
|
|
57
57
|
import { CALLBACK_STALE_PROOF_MAX_MS, NATIVE_CALLBACK_TRANSPORT, boundedAuthorizationReason, openNativeCallbackTransport } from "./stack-native-callback.mjs";
|
|
58
58
|
import { FORWARD_ATTESTATION_ENV, startForwardAttestation, readForwardAttestation } from "./stack-forward-attestation.mjs";
|
|
@@ -349,6 +349,15 @@ ${bold("run OPTIONS")}
|
|
|
349
349
|
hosted project ref, a non-demo service-role JWT) refuses the run before any
|
|
350
350
|
lease exists (exit 4 BUNDLE_SECRET_ENV, naming the KEY, never the value).
|
|
351
351
|
The receipt and the lease carry bundle_included [{path, sha256, keys}].
|
|
352
|
+
--supabase-service <name> Run this optional Supabase service on a stack a Go daemon host starts
|
|
353
|
+
(repeatable): studio, vector, logflare or postgres-meta. Those four are
|
|
354
|
+
skipped by default, saving about 1 GB per stack; tests never call them.
|
|
355
|
+
studio also keeps postgres-meta, and logflare also keeps vector (each
|
|
356
|
+
needs the other to work).
|
|
357
|
+
Any other name refuses the run before a lease exists (exit 4
|
|
358
|
+
STACK_SERVICE_NOT_ALLOWED). The opt-in ships in the stack bundle, so an idle
|
|
359
|
+
stack is re-used only by a run asking for the same services. The receipt's
|
|
360
|
+
supabase_services lists what the stack runs.
|
|
352
361
|
|
|
353
362
|
${bold("GLOBAL")}
|
|
354
363
|
--json Pretty-print the receipt (default is one compact JSON line).
|
|
@@ -440,6 +449,7 @@ ${bold("REMOTE LEASES")} (BOT-2142, stack run)
|
|
|
440
449
|
4 BUNDLE_TOO_LARGE --remote and the bundle is over --bundle-max-mb
|
|
441
450
|
4 BUNDLE_SECRET_ENV a --bundle-include file holds a live-credential-shaped value (names the key)
|
|
442
451
|
4 BUNDLE_INCLUDE_* a --bundle-include path is missing, not a file, too large, or excluded
|
|
452
|
+
4 STACK_SERVICE_NOT_ALLOWED a --supabase-service name is not studio, vector, logflare or postgres-meta
|
|
443
453
|
(BUNDLE_UNSAFE_LINK: it resolves outside the stack); no lease is created
|
|
444
454
|
6 TUNNEL_LOST the forward exited mid-child: the child is stopped, the lease released,
|
|
445
455
|
park_reason tunnel_lost (its failures were transport, not product)
|
|
@@ -529,6 +539,8 @@ export function deriveSlot({ slot, repo, ticket } = {}, env = process.env) {
|
|
|
529
539
|
*/
|
|
530
540
|
export function parseStackArgs(argv) {
|
|
531
541
|
const errors = [];
|
|
542
|
+
/** BOT-3371: error message → typed code, for refusals that carry one. */
|
|
543
|
+
const errorCodes = new Map();
|
|
532
544
|
const [rawCommand, ...rawRest] = argv;
|
|
533
545
|
// BOT-2400: `stack cancel <lease_id>` is the explicit give-up for a queued lease (its place
|
|
534
546
|
// is otherwise kept): exactly `stack done <lease_id> --reap`.
|
|
@@ -548,6 +560,8 @@ export function parseStackArgs(argv) {
|
|
|
548
560
|
// BOT-2269: exact stack-relative files shipped in the remote-lease bundle despite the
|
|
549
561
|
// default exclusions (`--bundle-include`, repeatable).
|
|
550
562
|
bundleInclude: [],
|
|
563
|
+
// BOT-3371: optional Supabase services this run's daemon-started stack keeps (`--supabase-service`).
|
|
564
|
+
supabaseServices: [],
|
|
551
565
|
disposition: "destroy", json: false, receiptMaxBytes: DEFAULT_RECEIPT_MAX_BYTES,
|
|
552
566
|
// BOT-1803: eager release (reap) instead of the default idle release (done/run).
|
|
553
567
|
reap: cancel,
|
|
@@ -693,6 +707,13 @@ export function parseStackArgs(argv) {
|
|
|
693
707
|
}
|
|
694
708
|
break;
|
|
695
709
|
}
|
|
710
|
+
case "--supabase-service": {
|
|
711
|
+
if (need(a, rest[i + 1])) {
|
|
712
|
+
const name = rest[++i];
|
|
713
|
+
try { opts.supabaseServices.push(validateSupabaseServiceName(name)); } catch (error) { errors.push(error.message); errorCodes.set(error.message, error.code); }
|
|
714
|
+
}
|
|
715
|
+
break;
|
|
716
|
+
}
|
|
696
717
|
case "--bundle-max-mb": {
|
|
697
718
|
if (need(a, rest[i + 1])) {
|
|
698
719
|
const n = Number(rest[++i]);
|
|
@@ -769,6 +790,12 @@ export function parseStackArgs(argv) {
|
|
|
769
790
|
}
|
|
770
791
|
}
|
|
771
792
|
opts.bundleInclude = [...new Set(opts.bundleInclude)];
|
|
793
|
+
if (opts.supabaseServices.length && command !== "run") {
|
|
794
|
+
errors.push("--supabase-service is valid only with `stack run` (only run builds the stack bundle that carries it)");
|
|
795
|
+
} else if (opts.supabaseServices.length && opts.localOnly) {
|
|
796
|
+
errors.push("--supabase-service applies to a stack a Go daemon host starts, and --local-only never uses one; drop one of them");
|
|
797
|
+
}
|
|
798
|
+
opts.supabaseServices = OPTIONAL_SUPABASE_SERVICES.filter((name) => opts.supabaseServices.includes(name));
|
|
772
799
|
opts.execution = opts.remote ? "remote" : opts.localOnly ? "local" : null;
|
|
773
800
|
if (typeof opts.stackPath !== "string" || !opts.stackPath.trim() || opts.stackPath.startsWith("/") ||
|
|
774
801
|
opts.stackPath.split("/").some((part) => part === "..")) {
|
|
@@ -838,7 +865,7 @@ export function parseStackArgs(argv) {
|
|
|
838
865
|
} else if (divider !== -1) {
|
|
839
866
|
errors.push("-- <executable> is only valid with stack run");
|
|
840
867
|
}
|
|
841
|
-
return { command, leaseId, opts, errors, childArgv };
|
|
868
|
+
return { command, leaseId, opts, errors, errorCodes, childArgv };
|
|
842
869
|
}
|
|
843
870
|
|
|
844
871
|
/**
|
|
@@ -4282,7 +4309,9 @@ async function runStackLifecycleOnce(opts, childArgv, adapters, incidentBox) {
|
|
|
4282
4309
|
let tunnelLost = null;
|
|
4283
4310
|
// BOT-2780: the requester origin closed under a live run (SSH loss or forward failure).
|
|
4284
4311
|
let originLost = null;
|
|
4285
|
-
const placement = { mode: null, hostKey: null, requesterHost: null, transport: "none", forwards: null, bundle: null, placementReason: null, considered: null
|
|
4312
|
+
const placement = { mode: null, hostKey: null, requesterHost: null, transport: "none", forwards: null, bundle: null, placementReason: null, considered: null,
|
|
4313
|
+
// BOT-3371: the optional services this run asked for, and what the stack reports it runs.
|
|
4314
|
+
supabaseServicesRequested: opts.supabaseServices ?? [], supabaseServices: null };
|
|
4286
4315
|
incidentBox.execution = placement;
|
|
4287
4316
|
// BOT-1803: idle-lease bookkeeping for the receipt.
|
|
4288
4317
|
const idleLease = { reused: null, reprovisioned: null, previousLeaseId: null, stackDigest: null, readoptHealth: null };
|
|
@@ -4565,6 +4594,7 @@ async function runStackLifecycleOnce(opts, childArgv, adapters, incidentBox) {
|
|
|
4565
4594
|
// nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal -- this invocation's own materialized stack directory, never a request-supplied path.
|
|
4566
4595
|
try { originConfigPath = realpathSync(join(stackDirFor(execution), "supabase", "config.toml")); } catch { originConfigPath = null; }
|
|
4567
4596
|
}
|
|
4597
|
+
const servicesOptIn = stackServicesOptInBody(opts.supabaseServices ?? []);
|
|
4568
4598
|
const buildRunBundle = ({ digestOnly = false, remoteVariant = false } = {}) => {
|
|
4569
4599
|
// BOT-2162: ship the worktree's BOT-2107 readiness declaration with the stack, so the
|
|
4570
4600
|
// serving Helper runs the canonical bind-RPC probe for a remote lease too.
|
|
@@ -4579,7 +4609,11 @@ async function runStackLifecycleOnce(opts, childArgv, adapters, incidentBox) {
|
|
|
4579
4609
|
// A digest that ships nothing has no upload cap (the archive is only hashed).
|
|
4580
4610
|
maxBytes: digestOnly ? Number.MAX_SAFE_INTEGER : (opts.bundleMaxBytes ?? DEFAULT_BUNDLE_MAX_BYTES),
|
|
4581
4611
|
...(digestOnly ? { rawLimitBytes: Number.MAX_SAFE_INTEGER } : {}),
|
|
4582
|
-
|
|
4612
|
+
extraFiles: [
|
|
4613
|
+
...(hasDeclaration ? [{ rel: ".botbuddy/config.json", abs: declaration }] : []),
|
|
4614
|
+
// BOT-3371: the services opt-in, only when there is one (a default bundle is unchanged).
|
|
4615
|
+
...(servicesOptIn ? [{ rel: STACK_SERVICES_OPT_IN_PATH, content: servicesOptIn }] : []),
|
|
4616
|
+
],
|
|
4583
4617
|
...(bundleInclude.length ? { include: bundleInclude } : {}),
|
|
4584
4618
|
});
|
|
4585
4619
|
};
|
|
@@ -4608,7 +4642,7 @@ async function runStackLifecycleOnce(opts, childArgv, adapters, incidentBox) {
|
|
|
4608
4642
|
// BOT-2269: the caller asked for these files to ship. A refused path or a live key is
|
|
4609
4643
|
// a hard refusal in every mode — quietly falling back to a co-located lease would
|
|
4610
4644
|
// hide it — and it happens before any lease exists.
|
|
4611
|
-
if (executionRequest === "remote" || bundleInclude.length) {
|
|
4645
|
+
if (executionRequest === "remote" || bundleInclude.length || servicesOptIn) {
|
|
4612
4646
|
const fixable = typeof error?.code === "string" && error.code.startsWith("BUNDLE_");
|
|
4613
4647
|
return { exitCode: fixable ? EXIT.INVALID : EXIT.INTERNAL, outcome: "error", code: error?.code ?? "BUNDLE_FAILED", error: message,
|
|
4614
4648
|
...(error?.code === "REQUESTER_ORIGIN_DIGEST_UNAVAILABLE" && error?.failureMechanism === "origin_config_missing" ? { failureMechanism: error.failureMechanism } : {}) };
|
|
@@ -5317,6 +5351,8 @@ async function runStackLifecycleOnce(opts, childArgv, adapters, incidentBox) {
|
|
|
5317
5351
|
stderrLine(`stack: lease ${leaseId} moved to ${placement.hostKey ?? "another host"} while queued (${placement.placementReason ?? "moved"}) — forwarding to it`);
|
|
5318
5352
|
}
|
|
5319
5353
|
let childConnection = current.data.connection;
|
|
5354
|
+
// BOT-3371: what the stack runs, as its host reported it (a daemon-started stack only).
|
|
5355
|
+
if (Array.isArray(current.data.connection.supabase_services)) placement.supabaseServices = current.data.connection.supabase_services;
|
|
5320
5356
|
// BOT-2775: a callback_policy auto lease serves its callback natively whenever it is remote,
|
|
5321
5357
|
// including one that moved to a remote host while queued. Its current lease must name the
|
|
5322
5358
|
// native transport; anything else is refused before any forward opens.
|
|
@@ -5865,6 +5901,9 @@ export function runReceiptFields(result) {
|
|
|
5865
5901
|
...(result.execution?.bundle ? { bundle: result.execution.bundle } : {}),
|
|
5866
5902
|
// BOT-2269: the opted-in files that shipped in that bundle — paths, sha256, key names.
|
|
5867
5903
|
...(result.execution?.bundle && result.execution?.bundleIncluded ? { bundle_included: result.execution.bundleIncluded } : {}),
|
|
5904
|
+
// BOT-3371: the Supabase services the stack runs and the optional ones this run opted into.
|
|
5905
|
+
...(result.execution?.supabaseServices ? { supabase_services: result.execution.supabaseServices } : {}),
|
|
5906
|
+
...(result.execution?.supabaseServicesRequested?.length ? { supabase_services_requested: result.execution.supabaseServicesRequested } : {}),
|
|
5868
5907
|
// BOT-2207: why it ran where it did (e.g. moved_remote_on_requeue) and every host weighed.
|
|
5869
5908
|
...(result.execution?.placementReason ? { placement_reason: result.execution.placementReason } : {}),
|
|
5870
5909
|
...(result.execution?.considered ? { considered: result.execution.considered } : {}),
|
|
@@ -6010,10 +6049,11 @@ export async function cmdStack(argv, { report = reportStackRunOutcome, outcomeCh
|
|
|
6010
6049
|
process.stdout.write(stackCommandHelp(argv[0]) + "\n");
|
|
6011
6050
|
return EXIT.OK;
|
|
6012
6051
|
}
|
|
6013
|
-
const { command, leaseId, opts, errors, childArgv } = parseStackArgs(argv);
|
|
6052
|
+
const { command, leaseId, opts, errors, errorCodes, childArgv } = parseStackArgs(argv);
|
|
6014
6053
|
if (errors.length) {
|
|
6015
6054
|
for (const e of errors) process.stderr.write(`${yellow("⚠")} stack: ${e}\n`);
|
|
6016
|
-
|
|
6055
|
+
// BOT-3371: a typed refusal (e.g. STACK_SERVICE_NOT_ALLOWED) names its code on the receipt.
|
|
6056
|
+
const fields = { command: command || "?", outcome: "error", error: errors[0], ...(errorCodes?.get(errors[0]) ? { code: errorCodes.get(errors[0]) } : {}) };
|
|
6017
6057
|
const code = emit(buildReceipt(fields), opts, EXIT.INVALID);
|
|
6018
6058
|
// BOT-2467: a refused `stack run` is recorded as an `invocation` outcome (no lease).
|
|
6019
6059
|
if (command === "run") {
|