superbee 0.3.0-pre.2 → 0.3.0-pre.3

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/dist/superbee.mjs CHANGED
@@ -44,7 +44,7 @@ var __toESM = (mod, isNodeMode, target2) => (target2 = mod != null ? __create(__
44
44
  var define_SUPERBEE_BUILD_IDENTITY_default;
45
45
  var init_define_SUPERBEE_BUILD_IDENTITY = __esm({
46
46
  "<define:__SUPERBEE_BUILD_IDENTITY__>"() {
47
- define_SUPERBEE_BUILD_IDENTITY_default = { schema: "superbee.build-identity.v1", package: { name: "superbee", version: "0.3.0-pre.2" }, source: { commit: "2a374e115dd765ad94d1199be34da9b16ba9334c", dirty: false }, artifact: { channel: "npm-package" }, compatibility_contracts: { skill: 1, hook: 1, mcp: 1 } };
47
+ define_SUPERBEE_BUILD_IDENTITY_default = { schema: "superbee.build-identity.v1", package: { name: "superbee", version: "0.3.0-pre.3" }, source: { commit: "7c930597dd46f7b3283158882e19db48420fe1c5", dirty: false }, artifact: { channel: "npm-package" }, compatibility_contracts: { skill: 1, hook: 1, mcp: 1 } };
48
48
  }
49
49
  });
50
50
 
@@ -84,9 +84,9 @@ var require_common = __commonJS({
84
84
  }
85
85
  return target2;
86
86
  }
87
- function repeat2(string8, count2) {
87
+ function repeat2(string8, count3) {
88
88
  var result3 = "", cycle;
89
- for (cycle = 0; cycle < count2; cycle += 1) {
89
+ for (cycle = 0; cycle < count3; cycle += 1) {
90
90
  result3 += string8;
91
91
  }
92
92
  return result3;
@@ -1533,11 +1533,11 @@ var require_loader = __commonJS({
1533
1533
  }
1534
1534
  return false;
1535
1535
  }
1536
- function writeFoldedLines(state, count2) {
1537
- if (count2 === 1) {
1536
+ function writeFoldedLines(state, count3) {
1537
+ if (count3 === 1) {
1538
1538
  state.result += " ";
1539
- } else if (count2 > 1) {
1540
- state.result += common.repeat("\n", count2 - 1);
1539
+ } else if (count3 > 1) {
1540
+ state.result += common.repeat("\n", count3 - 1);
1541
1541
  }
1542
1542
  }
1543
1543
  function readPlainScalar(state, nodeIndent, withinFlowCollection) {
@@ -3482,11 +3482,11 @@ function scan(frontmatter, existing) {
3482
3482
  window2(frontmatter.usage_window, "usage_window", existing?.usage_window);
3483
3483
  for (const key of ["verified", "sources"]) {
3484
3484
  authoredOkfRows(frontmatter[key], existing?.[key], key === "verified").forEach(({ entry, index: index2 }) => {
3485
- const path43 = key === "verified" && !Array.isArray(frontmatter.verified) ? key : `${key}[${index2}]`;
3486
- if (key === "verified") slot(entry, "at", `${path43}.at`);
3485
+ const path44 = key === "verified" && !Array.isArray(frontmatter.verified) ? key : `${key}[${index2}]`;
3486
+ if (key === "verified") slot(entry, "at", `${path44}.at`);
3487
3487
  else {
3488
- slot(entry, "last_modified", `${path43}.last_modified`);
3489
- if (isOkfRecord(entry)) window2(entry.usage_window, `${path43}.usage_window`);
3488
+ slot(entry, "last_modified", `${path44}.last_modified`);
3489
+ if (isOkfRecord(entry)) window2(entry.usage_window, `${path44}.usage_window`);
3490
3490
  }
3491
3491
  });
3492
3492
  }
@@ -3513,29 +3513,29 @@ var init_okf_timestamps = __esm({
3513
3513
  });
3514
3514
 
3515
3515
  // ../core/src/okf-standard-fields.ts
3516
- function fail(path43, expected) {
3517
- throw new InvalidInputError(`OKF v0.2 ${path43} must be ${expected}`);
3516
+ function fail(path44, expected) {
3517
+ throw new InvalidInputError(`OKF v0.2 ${path44} must be ${expected}`);
3518
3518
  }
3519
3519
  function assertAuthoredOkfStandardFields(frontmatter, existing, options = {}) {
3520
- const field = (owner, key, path43, valid, expected, previous3, required2 = false) => {
3520
+ const field = (owner, key, path44, valid, expected, previous3, required2 = false) => {
3521
3521
  if (!Object.hasOwn(owner, key)) {
3522
- if (required2 && !(previous3 && !Object.hasOwn(previous3, key))) fail(path43, expected);
3522
+ if (required2 && !(previous3 && !Object.hasOwn(previous3, key))) fail(path44, expected);
3523
3523
  return;
3524
3524
  }
3525
3525
  if (previous3 && Object.hasOwn(previous3, key) && okfValuesEqual(owner[key], previous3[key])) return;
3526
- if (!valid(owner[key])) fail(path43, expected);
3526
+ if (!valid(owner[key])) fail(path44, expected);
3527
3527
  };
3528
- const strings = (value, path43) => {
3529
- if (!Array.isArray(value)) fail(path43, "a list of strings");
3528
+ const strings = (value, path44) => {
3529
+ if (!Array.isArray(value)) fail(path44, "a list of strings");
3530
3530
  Array.from(value).forEach((entry, index2) => {
3531
- if (!string(entry)) fail(`${path43}[${index2}]`, "a string");
3531
+ if (!string(entry)) fail(`${path44}[${index2}]`, "a string");
3532
3532
  });
3533
3533
  };
3534
- const mapping = (owner, key, path43, previous3) => {
3534
+ const mapping = (owner, key, path44, previous3) => {
3535
3535
  if (!Object.hasOwn(owner, key)) return void 0;
3536
3536
  if (!isOkfRecord(owner[key])) {
3537
3537
  if (previous3 && Object.hasOwn(previous3, key) && okfValuesEqual(owner[key], previous3[key])) return void 0;
3538
- fail(path43, "a mapping when present");
3538
+ fail(path44, "a mapping when present");
3539
3539
  }
3540
3540
  return owner[key];
3541
3541
  };
@@ -3547,9 +3547,9 @@ function assertAuthoredOkfStandardFields(frontmatter, existing, options = {}) {
3547
3547
  fail(key, allowBare ? "a list of events or one event mapping" : "a list");
3548
3548
  }
3549
3549
  for (const { entry, index: index2 } of authoredOkfRows(value, previous3?.[key], allowBare)) {
3550
- const path43 = allowBare && !Array.isArray(value) ? key : `${key}[${index2}]`;
3551
- if (!isOkfRecord(entry)) fail(path43, "a mapping");
3552
- validate(entry, path43);
3550
+ const path44 = allowBare && !Array.isArray(value) ? key : `${key}[${index2}]`;
3551
+ if (!isOkfRecord(entry)) fail(path44, "a mapping");
3552
+ validate(entry, path44);
3553
3553
  }
3554
3554
  };
3555
3555
  field(frontmatter, "type", "type", nonempty, "a nonempty string", void 0, true);
@@ -3564,24 +3564,24 @@ function assertAuthoredOkfStandardFields(frontmatter, existing, options = {}) {
3564
3564
  field(generated, "by", "generated.by", isOkfActor, "human:<id>, process:<id>, or <producer>/<version>", previous3, false);
3565
3565
  if (required2 && !Object.hasOwn(generated, "by")) fail("generated.by", "present when generated is authored");
3566
3566
  }
3567
- list4("verified", existing, (entry, path43) => {
3568
- field(entry, "by", `${path43}.by`, isOkfActor, "human:<id>, process:<id>, or <producer>/<version>", void 0, true);
3569
- field(entry, "at", `${path43}.at`, string, "an ISO-8601 datetime with an explicit UTC offset", void 0, true);
3567
+ list4("verified", existing, (entry, path44) => {
3568
+ field(entry, "by", `${path44}.by`, isOkfActor, "human:<id>, process:<id>, or <producer>/<version>", void 0, true);
3569
+ field(entry, "at", `${path44}.at`, string, "an ISO-8601 datetime with an explicit UTC offset", void 0, true);
3570
3570
  }, true);
3571
- list4("sources", existing, (entry, path43) => {
3572
- field(entry, "resource", `${path43}.resource`, nonempty, "a nonempty string", void 0, true);
3573
- for (const key of ["id", "title"]) field(entry, key, `${path43}.${key}`, string, "a string");
3574
- field(entry, "author", `${path43}.author`, nonempty, "a nonempty string");
3575
- field(entry, "usage_count", `${path43}.usage_count`, count, "a finite nonnegative integer");
3576
- mapping(entry, "usage_window", `${path43}.usage_window`);
3571
+ list4("sources", existing, (entry, path44) => {
3572
+ field(entry, "resource", `${path44}.resource`, nonempty, "a nonempty string", void 0, true);
3573
+ for (const key of ["id", "title"]) field(entry, key, `${path44}.${key}`, string, "a string");
3574
+ field(entry, "author", `${path44}.author`, nonempty, "a nonempty string");
3575
+ field(entry, "usage_count", `${path44}.usage_count`, count, "a finite nonnegative integer");
3576
+ mapping(entry, "usage_window", `${path44}.usage_window`);
3577
3577
  });
3578
3578
  if (frontmatter.type === "Attested Computation") {
3579
3579
  const previous3 = existing?.type === frontmatter.type ? existing : void 0;
3580
3580
  field(frontmatter, "runtime", "runtime", nonempty, "a nonempty string", previous3, true);
3581
3581
  field(frontmatter, "computation", "computation", string, "a string", previous3);
3582
- list4("parameters", previous3, (entry, path43) => {
3583
- for (const key of ["name", "type"]) field(entry, key, `${path43}.${key}`, string, "a string", void 0, true);
3584
- field(entry, "required", `${path43}.required`, (value) => typeof value === "boolean", "a boolean");
3582
+ list4("parameters", previous3, (entry, path44) => {
3583
+ for (const key of ["name", "type"]) field(entry, key, `${path44}.${key}`, string, "a string", void 0, true);
3584
+ field(entry, "required", `${path44}.required`, (value) => typeof value === "boolean", "a boolean");
3585
3585
  });
3586
3586
  for (const key of ["executor", "attester"]) {
3587
3587
  const entry = mapping(frontmatter, key, key, previous3);
@@ -4522,14 +4522,14 @@ async function ensurePrivateLockRoot(root, policy) {
4522
4522
  } catch (err) {
4523
4523
  if (err.code !== "EEXIST") throw err;
4524
4524
  }
4525
- const stat8 = await fs.lstat(root);
4525
+ const stat9 = await fs.lstat(root);
4526
4526
  const uid = process.getuid?.();
4527
4527
  if (!isPrivateFilesystemMutationLockRoot({
4528
- directory: stat8.isDirectory(),
4529
- symbolicLink: stat8.isSymbolicLink(),
4530
- ownerUid: stat8.uid,
4528
+ directory: stat9.isDirectory(),
4529
+ symbolicLink: stat9.isSymbolicLink(),
4530
+ ownerUid: stat9.uid,
4531
4531
  expectedUid: uid,
4532
- mode: stat8.mode,
4532
+ mode: stat9.mode,
4533
4533
  enforcePrivateMode: policy.enforcePrivateMode
4534
4534
  })) {
4535
4535
  throw new FilesystemMutationLockError(
@@ -7044,26 +7044,26 @@ function applyReplacer(root, replacer) {
7044
7044
  if (replacedRoot === void 0) return transformChildren(root, replacer, []);
7045
7045
  return transformChildren(normalizeValue(replacedRoot), replacer, []);
7046
7046
  }
7047
- function transformChildren(value, replacer, path43) {
7048
- if (isJsonObject(value)) return transformObject(value, replacer, path43);
7049
- if (isJsonArray(value)) return transformArray(value, replacer, path43);
7047
+ function transformChildren(value, replacer, path44) {
7048
+ if (isJsonObject(value)) return transformObject(value, replacer, path44);
7049
+ if (isJsonArray(value)) return transformArray(value, replacer, path44);
7050
7050
  return value;
7051
7051
  }
7052
- function transformObject(obj, replacer, path43) {
7052
+ function transformObject(obj, replacer, path44) {
7053
7053
  const result3 = {};
7054
7054
  for (const [key, value] of Object.entries(obj)) {
7055
- const childPath = [...path43, key];
7055
+ const childPath = [...path44, key];
7056
7056
  const replacedValue = replacer(key, value, childPath);
7057
7057
  if (replacedValue === void 0) continue;
7058
7058
  setOwnProperty(result3, key, transformChildren(normalizeValue(replacedValue), replacer, childPath));
7059
7059
  }
7060
7060
  return result3;
7061
7061
  }
7062
- function transformArray(arr, replacer, path43) {
7062
+ function transformArray(arr, replacer, path44) {
7063
7063
  const result3 = [];
7064
7064
  for (let i = 0; i < arr.length; i++) {
7065
7065
  const value = arr[i];
7066
- const childPath = [...path43, i];
7066
+ const childPath = [...path44, i];
7067
7067
  const replacedValue = replacer(String(i), value, childPath);
7068
7068
  if (replacedValue === void 0) continue;
7069
7069
  const normalizedValue = normalizeValue(replacedValue);
@@ -7108,11 +7108,11 @@ var init_dist = __esm({
7108
7108
 
7109
7109
  // ../../node_modules/axi-sdk-js/dist/output.js
7110
7110
  import { homedir as homedir4 } from "node:os";
7111
- function collapseHomeDirectory2(path43, homeDir = homedir4()) {
7112
- if (!path43.startsWith(homeDir)) {
7113
- return path43;
7111
+ function collapseHomeDirectory2(path44, homeDir = homedir4()) {
7112
+ if (!path44.startsWith(homeDir)) {
7113
+ return path44;
7114
7114
  }
7115
- return `~${path43.slice(homeDir.length)}`;
7115
+ return `~${path44.slice(homeDir.length)}`;
7116
7116
  }
7117
7117
  function homeHeaderOutput(options) {
7118
7118
  return {
@@ -7243,36 +7243,36 @@ function readNearestPackageJson(startPath, fs14 = nodeFs) {
7243
7243
  }
7244
7244
  function detectInstallMethod(options) {
7245
7245
  const env = options.env ?? process.env;
7246
- const path43 = options.entry.replaceAll("\\", "/");
7247
- if (path43.includes("/_npx/") || /\/dlx-[^/]+\//.test(path43) || path43.includes("/pnpm/dlx/") || path43.includes("/bun/install/cache/")) {
7246
+ const path44 = options.entry.replaceAll("\\", "/");
7247
+ if (path44.includes("/_npx/") || /\/dlx-[^/]+\//.test(path44) || path44.includes("/pnpm/dlx/") || path44.includes("/bun/install/cache/")) {
7248
7248
  return { kind: "npx" };
7249
7249
  }
7250
- const homebrewFormula = homebrewFormulaFromPath(path43, env);
7250
+ const homebrewFormula = homebrewFormulaFromPath(path44, env);
7251
7251
  if (homebrewFormula) {
7252
7252
  return { kind: "homebrew", formula: homebrewFormula };
7253
7253
  }
7254
7254
  const pnpmHome = normalizePathRoot(env.PNPM_HOME);
7255
- if (isPathInsideRoot(path43, pnpmHome) || isKnownPnpmGlobalStore(path43, env)) {
7255
+ if (isPathInsideRoot(path44, pnpmHome) || isKnownPnpmGlobalStore(path44, env)) {
7256
7256
  return { kind: "pnpm-global" };
7257
7257
  }
7258
- if (isKnownNpmGlobalInstall(path43, env)) {
7258
+ if (isKnownNpmGlobalInstall(path44, env)) {
7259
7259
  return { kind: "npm-global" };
7260
7260
  }
7261
7261
  return { kind: "unknown" };
7262
7262
  }
7263
- function normalizePathRoot(path43) {
7264
- const normalized = path43?.replaceAll("\\", "/").replace(/\/+$/, "");
7263
+ function normalizePathRoot(path44) {
7264
+ const normalized = path44?.replaceAll("\\", "/").replace(/\/+$/, "");
7265
7265
  return normalized && normalized.length > 0 ? normalized : void 0;
7266
7266
  }
7267
- function isPathInsideRoot(path43, root) {
7268
- return root !== void 0 && (path43 === root || path43.startsWith(`${root}/`));
7267
+ function isPathInsideRoot(path44, root) {
7268
+ return root !== void 0 && (path44 === root || path44.startsWith(`${root}/`));
7269
7269
  }
7270
- function homebrewFormulaFromPath(path43, env) {
7270
+ function homebrewFormulaFromPath(path44, env) {
7271
7271
  for (const root of homebrewCellarRoots(env)) {
7272
- if (!isPathInsideRoot(path43, root)) {
7272
+ if (!isPathInsideRoot(path44, root)) {
7273
7273
  continue;
7274
7274
  }
7275
- const relative2 = path43.slice(root.length).replace(/^\/+/, "");
7275
+ const relative2 = path44.slice(root.length).replace(/^\/+/, "");
7276
7276
  const formula = relative2.split("/")[0];
7277
7277
  if (formula) {
7278
7278
  return formula;
@@ -7300,12 +7300,12 @@ function homebrewCellarRoots(env) {
7300
7300
  }
7301
7301
  return [...new Set(roots)];
7302
7302
  }
7303
- function isKnownPnpmGlobalStore(path43, env) {
7303
+ function isKnownPnpmGlobalStore(path44, env) {
7304
7304
  return pnpmGlobalStoreRoots(env).some((root) => {
7305
- if (!isPathInsideRoot(path43, root)) {
7305
+ if (!isPathInsideRoot(path44, root)) {
7306
7306
  return false;
7307
7307
  }
7308
- const relative2 = path43.slice(root.length).replace(/^\/+/, "");
7308
+ const relative2 = path44.slice(root.length).replace(/^\/+/, "");
7309
7309
  return /^\d+\/\.pnpm\//.test(relative2);
7310
7310
  });
7311
7311
  }
@@ -7323,8 +7323,8 @@ function pnpmGlobalStoreRoots(env) {
7323
7323
  }
7324
7324
  return [...new Set(roots)];
7325
7325
  }
7326
- function isKnownNpmGlobalInstall(path43, env) {
7327
- return npmGlobalNodeModulesRoots(env).some((root) => isPathInsideRoot(path43, root)) || isKnownVersionManagerNpmGlobal(path43, env);
7326
+ function isKnownNpmGlobalInstall(path44, env) {
7327
+ return npmGlobalNodeModulesRoots(env).some((root) => isPathInsideRoot(path44, root)) || isKnownVersionManagerNpmGlobal(path44, env);
7328
7328
  }
7329
7329
  function npmGlobalNodeModulesRoots(env) {
7330
7330
  const roots = [
@@ -7350,8 +7350,8 @@ function npmGlobalNodeModulesRoots(env) {
7350
7350
  }
7351
7351
  return [...new Set(roots)];
7352
7352
  }
7353
- function isKnownVersionManagerNpmGlobal(path43, env) {
7354
- return versionManagerNodeRoots(env).some((root) => isPathInsideRoot(path43, root) && path43.includes("/lib/node_modules/"));
7353
+ function isKnownVersionManagerNpmGlobal(path44, env) {
7354
+ return versionManagerNodeRoots(env).some((root) => isPathInsideRoot(path44, root) && path44.includes("/lib/node_modules/"));
7355
7355
  }
7356
7356
  function versionManagerNodeRoots(env) {
7357
7357
  const roots = [];
@@ -7535,18 +7535,18 @@ async function defaultRunInstall(plan, stdout, context) {
7535
7535
  function binNameFromArgv(invokedAs) {
7536
7536
  return basename(invokedAs ?? "tool") || "tool";
7537
7537
  }
7538
- function resolveEntry(invokedAs, realpath7) {
7538
+ function resolveEntry(invokedAs, realpath10) {
7539
7539
  if (!invokedAs) {
7540
7540
  return void 0;
7541
7541
  }
7542
7542
  try {
7543
- return realpath7(invokedAs);
7543
+ return realpath10(invokedAs);
7544
7544
  } catch {
7545
7545
  return invokedAs;
7546
7546
  }
7547
7547
  }
7548
- function resolveInstalledVersion(invokedAs, realpath7, fs14) {
7549
- const installedEntry = resolveEntry(invokedAs, realpath7);
7548
+ function resolveInstalledVersion(invokedAs, realpath10, fs14) {
7549
+ const installedEntry = resolveEntry(invokedAs, realpath10);
7550
7550
  return installedEntry ? readNearestPackageJson(installedEntry, fs14).version : void 0;
7551
7551
  }
7552
7552
  function homebrewUpgradeOutput(options) {
@@ -7585,8 +7585,8 @@ async function runUpdate(options) {
7585
7585
  const binName = binNameFromArgv(invokedAs);
7586
7586
  const mode = parseUpdateArgs(options.args, binName);
7587
7587
  const platform = options.platform ?? process.platform;
7588
- const realpath7 = options.realpath ?? ((path43) => realpathSync5(path43));
7589
- const entry = resolveEntry(invokedAs, realpath7);
7588
+ const realpath10 = options.realpath ?? ((path44) => realpathSync5(path44));
7589
+ const entry = resolveEntry(invokedAs, realpath10);
7590
7590
  const fs14 = options.fs ?? nodeFs;
7591
7591
  const fromPackageJson = entry ? readNearestPackageJson(entry, fs14) : {};
7592
7592
  const packageName = options.packageName ?? fromPackageJson.packageName;
@@ -7650,7 +7650,7 @@ async function runUpdate(options) {
7650
7650
  packageName,
7651
7651
  current,
7652
7652
  latest,
7653
- installedVersion: resolveInstalledVersion(invokedAs, realpath7, fs14),
7653
+ installedVersion: resolveInstalledVersion(invokedAs, realpath10, fs14),
7654
7654
  command: plan.command
7655
7655
  });
7656
7656
  }
@@ -7670,7 +7670,7 @@ var init_update = __esm({
7670
7670
  REGISTRY_FETCH_TIMEOUT_MS = 2e4;
7671
7671
  nodeFs = {
7672
7672
  existsSync,
7673
- readFileSync: (path43, encoding) => readFileSync3(path43, encoding)
7673
+ readFileSync: (path44, encoding) => readFileSync3(path44, encoding)
7674
7674
  };
7675
7675
  RegistryNotFoundError = class extends Error {
7676
7676
  };
@@ -8336,42 +8336,42 @@ var init_journaled_backend = __esm({
8336
8336
  // ../core/src/remote-document-codec.ts
8337
8337
  function captureRemoteFrontmatter(frontmatter) {
8338
8338
  const ancestors = /* @__PURE__ */ new Set();
8339
- const refuse = (path43, reason) => {
8340
- throw new RemoteDocumentValueError(path43, reason);
8339
+ const refuse = (path44, reason) => {
8340
+ throw new RemoteDocumentValueError(path44, reason);
8341
8341
  };
8342
- const visit2 = (value, path43, depth2) => {
8343
- if (depth2 > 512) return refuse(path43, "metadata nesting exceeds the supported depth");
8342
+ const visit2 = (value, path44, depth2) => {
8343
+ if (depth2 > 512) return refuse(path44, "metadata nesting exceeds the supported depth");
8344
8344
  if (value === null || typeof value === "string" || typeof value === "boolean") return value;
8345
8345
  if (typeof value === "number") {
8346
- if (!Number.isFinite(value) || Object.is(value, -0)) return refuse(path43, "number would change during JSON encoding");
8346
+ if (!Number.isFinite(value) || Object.is(value, -0)) return refuse(path44, "number would change during JSON encoding");
8347
8347
  return value;
8348
8348
  }
8349
- if (typeof value !== "object") return refuse(path43, `${typeof value} is not a JSON value`);
8350
- if (ancestors.has(value)) return refuse(path43, "cyclic metadata cannot be represented in JSON");
8349
+ if (typeof value !== "object") return refuse(path44, `${typeof value} is not a JSON value`);
8350
+ if (ancestors.has(value)) return refuse(path44, "cyclic metadata cannot be represented in JSON");
8351
8351
  const prototype = Object.getPrototypeOf(value);
8352
8352
  const descriptors = Object.getOwnPropertyDescriptors(value);
8353
8353
  const hook2 = descriptors.toJSON;
8354
8354
  if (hook2 && (!("value" in hook2) || typeof hook2.value === "function")) {
8355
- return refuse(`${path43}["toJSON"]`, "custom serialization hooks are not supported");
8355
+ return refuse(`${path44}["toJSON"]`, "custom serialization hooks are not supported");
8356
8356
  }
8357
8357
  for (const key of Reflect.ownKeys(descriptors)) {
8358
8358
  const descriptor = Object.getOwnPropertyDescriptor(value, key);
8359
- if (typeof key === "symbol" && descriptor.enumerable) return refuse(path43, "enumerable symbol keys would be omitted");
8359
+ if (typeof key === "symbol" && descriptor.enumerable) return refuse(path44, "enumerable symbol keys would be omitted");
8360
8360
  }
8361
8361
  if (prototype === Date.prototype) {
8362
- if (Object.values(descriptors).some((descriptor) => descriptor.enumerable)) return refuse(path43, "Date properties would be omitted");
8362
+ if (Object.values(descriptors).some((descriptor) => descriptor.enumerable)) return refuse(path44, "Date properties would be omitted");
8363
8363
  let instant;
8364
8364
  try {
8365
8365
  instant = Date.prototype.getTime.call(value);
8366
8366
  } catch {
8367
- return refuse(path43, "object has no Date value");
8367
+ return refuse(path44, "object has no Date value");
8368
8368
  }
8369
- if (!Number.isFinite(instant)) return refuse(path43, "invalid Date would become null");
8369
+ if (!Number.isFinite(instant)) return refuse(path44, "invalid Date would become null");
8370
8370
  return Date.prototype.toISOString.call(value);
8371
8371
  }
8372
8372
  const array2 = Array.isArray(value);
8373
8373
  if (array2 ? prototype !== Array.prototype && prototype !== null : prototype !== Object.prototype && prototype !== null) {
8374
- return refuse(path43, "only plain records, arrays, and valid Dates are supported");
8374
+ return refuse(path44, "only plain records, arrays, and valid Dates are supported");
8375
8375
  }
8376
8376
  ancestors.add(value);
8377
8377
  try {
@@ -8381,14 +8381,14 @@ function captureRemoteFrontmatter(frontmatter) {
8381
8381
  Object.setPrototypeOf(result4, null);
8382
8382
  for (const key of Object.keys(descriptors)) {
8383
8383
  if (descriptors[key].enumerable && !(String(Number(key)) === key && Number.isInteger(Number(key)) && Number(key) >= 0 && Number(key) < length)) {
8384
- return refuse(`${path43}[${JSON.stringify(key)}]`, "extra array properties would be omitted");
8384
+ return refuse(`${path44}[${JSON.stringify(key)}]`, "extra array properties would be omitted");
8385
8385
  }
8386
8386
  }
8387
8387
  for (let index2 = 0; index2 < length; index2++) {
8388
8388
  const descriptor = descriptors[String(index2)];
8389
- if (!descriptor) return refuse(`${path43}[${index2}]`, "array holes would become null");
8390
- if (!("value" in descriptor)) return refuse(`${path43}[${index2}]`, "accessors are not supported");
8391
- result4[index2] = visit2(descriptor.value, `${path43}[${index2}]`, depth2 + 1);
8389
+ if (!descriptor) return refuse(`${path44}[${index2}]`, "array holes would become null");
8390
+ if (!("value" in descriptor)) return refuse(`${path44}[${index2}]`, "accessors are not supported");
8391
+ result4[index2] = visit2(descriptor.value, `${path44}[${index2}]`, depth2 + 1);
8392
8392
  }
8393
8393
  return result4;
8394
8394
  }
@@ -8396,7 +8396,7 @@ function captureRemoteFrontmatter(frontmatter) {
8396
8396
  for (const key of Object.keys(descriptors)) {
8397
8397
  const descriptor = descriptors[key];
8398
8398
  if (!descriptor.enumerable) continue;
8399
- const field = `${path43}[${JSON.stringify(key)}]`;
8399
+ const field = `${path44}[${JSON.stringify(key)}]`;
8400
8400
  if (!("value" in descriptor)) return refuse(field, "accessors are not supported");
8401
8401
  result3[key] = visit2(descriptor.value, field, depth2 + 1);
8402
8402
  }
@@ -8420,10 +8420,10 @@ var init_remote_document_codec = __esm({
8420
8420
  init_errors();
8421
8421
  RemoteDocumentValueError = class extends InvalidInputError {
8422
8422
  path;
8423
- constructor(path43, reason) {
8424
- super(`Remote document ${path43}: ${reason}. Supply JSON-compatible metadata explicitly.`);
8423
+ constructor(path44, reason) {
8424
+ super(`Remote document ${path44}: ${reason}. Supply JSON-compatible metadata explicitly.`);
8425
8425
  this.name = "RemoteDocumentValueError";
8426
- this.path = path43;
8426
+ this.path = path44;
8427
8427
  }
8428
8428
  };
8429
8429
  }
@@ -8852,13 +8852,13 @@ var init_remote_backend = __esm({
8852
8852
  url(bundleRelativePath) {
8853
8853
  return `${this.baseUrl}/v0/bundles/${encodeURIComponent(this.bundle)}${bundleRelativePath}`;
8854
8854
  }
8855
- async send(path43, init2 = {}, scope = "bundle") {
8855
+ async send(path44, init2 = {}, scope = "bundle") {
8856
8856
  if (this.authToken) {
8857
8857
  const headers = new Headers(init2.headers);
8858
8858
  headers.set("Authorization", `Bearer ${this.authToken}`);
8859
8859
  init2 = { ...init2, headers };
8860
8860
  }
8861
- const url2 = scope === "bundle" ? this.url(path43) : `${this.baseUrl}${path43}`;
8861
+ const url2 = scope === "bundle" ? this.url(path44) : `${this.baseUrl}${path44}`;
8862
8862
  for (let attempt = 0; ; attempt++) {
8863
8863
  try {
8864
8864
  const res = await this.fetchImpl(new Request(url2, init2));
@@ -9443,13 +9443,13 @@ function describeShape(value) {
9443
9443
  if (typeof value === "object") return "an object";
9444
9444
  return typeof value;
9445
9445
  }
9446
- function toStringArrayLenient(value, path43, docId, warnings) {
9446
+ function toStringArrayLenient(value, path44, docId, warnings) {
9447
9447
  if (!Array.isArray(value)) {
9448
9448
  if (value !== void 0) {
9449
9449
  warnings.push({
9450
9450
  code: "KIND_CONVENTION_BAD_SHAPE",
9451
- message: `kind convention '${docId}' has a non-list '${path43}' (${describeShape(value)}; expected a list of strings); ignoring it.`,
9452
- field: path43,
9451
+ message: `kind convention '${docId}' has a non-list '${path44}' (${describeShape(value)}; expected a list of strings); ignoring it.`,
9452
+ field: path44,
9453
9453
  severity: "warning"
9454
9454
  });
9455
9455
  }
@@ -9462,8 +9462,8 @@ function toStringArrayLenient(value, path43, docId, warnings) {
9462
9462
  } else {
9463
9463
  warnings.push({
9464
9464
  code: "KIND_CONVENTION_BAD_MEMBER",
9465
- message: `kind convention '${docId}' has a non-scalar member (${describeShape(v2)}) in '${path43}'; skipping it.`,
9466
- field: path43,
9465
+ message: `kind convention '${docId}' has a non-scalar member (${describeShape(v2)}) in '${path44}'; skipping it.`,
9466
+ field: path44,
9467
9467
  severity: "warning"
9468
9468
  });
9469
9469
  }
@@ -9842,7 +9842,7 @@ function parseConventionDoc(doc2, options = {}) {
9842
9842
  });
9843
9843
  }
9844
9844
  }
9845
- const path43 = typeof fm.path === "string" && fm.path.trim() !== "" ? fm.path.trim() : void 0;
9845
+ const path44 = typeof fm.path === "string" && fm.path.trim() !== "" ? fm.path.trim() : void 0;
9846
9846
  const freshnessHorizon = typeof fm.freshness_horizon === "string" && fm.freshness_horizon.trim() !== "" ? fm.freshness_horizon.trim() : void 0;
9847
9847
  const browseCollapsed = fm.browse_collapsed === true ? true : void 0;
9848
9848
  let order;
@@ -9865,7 +9865,7 @@ function parseConventionDoc(doc2, options = {}) {
9865
9865
  fields: { required: required2, optional: optional2, values, valueDescriptions, terminal, descriptions: descriptions2 }
9866
9866
  };
9867
9867
  if (description !== void 0) kind2.description = description;
9868
- if (path43 !== void 0) kind2.path = path43;
9868
+ if (path44 !== void 0) kind2.path = path44;
9869
9869
  if (links !== void 0) kind2.links = links;
9870
9870
  if (linkDescriptions !== void 0) kind2.linkDescriptions = linkDescriptions;
9871
9871
  if (expectsInbound !== void 0) kind2.expectsInbound = expectsInbound;
@@ -10500,8 +10500,8 @@ function withCanonicalComparableTimestamp(frontmatter, okfVersion) {
10500
10500
  if (typeof timestamp2 !== "string") return frontmatter;
10501
10501
  const instant = parseTimestamp(timestamp2, okfVersion);
10502
10502
  if (instant === null) return frontmatter;
10503
- const canonical = new Date(instant).toISOString();
10504
- return canonical === timestamp2 ? frontmatter : { ...frontmatter, timestamp: canonical };
10503
+ const canonical2 = new Date(instant).toISOString();
10504
+ return canonical2 === timestamp2 ? frontmatter : { ...frontmatter, timestamp: canonical2 };
10505
10505
  }
10506
10506
  function isNoopMutation(existing, candidate, compareTimestamp, okfVersion, ignoreAutomaticActor = false, kindRequiresActor = false) {
10507
10507
  if (normalizeDocumentBodyForStorage(candidate.body) !== normalizeDocumentBodyForStorage(existing.body)) {
@@ -10882,11 +10882,11 @@ function applyQuerySelectionFilters(rows, params, kinds2 = []) {
10882
10882
  return !kind2 || !isTerminal(kind2, row2.frontmatter);
10883
10883
  });
10884
10884
  }
10885
- const count2 = out.length;
10885
+ const count3 = out.length;
10886
10886
  if (typeof params.limit === "number" && params.limit > 0) {
10887
10887
  out = out.slice(0, params.limit);
10888
10888
  }
10889
- return { rows: out, count: count2 };
10889
+ return { rows: out, count: count3 };
10890
10890
  }
10891
10891
  var init_query_selection = __esm({
10892
10892
  "../core/src/query-selection.ts"() {
@@ -11711,9 +11711,9 @@ function bundleDirNameForProject(top) {
11711
11711
  const byName = /* @__PURE__ */ new Map();
11712
11712
  for (const match of matches) byName.set(match.name, [...byName.get(match.name) ?? [], match]);
11713
11713
  if (byName.size > 1) {
11714
- const canonical = byName.get(BUNDLE_DIR) ?? [];
11714
+ const canonical2 = byName.get(BUNDLE_DIR) ?? [];
11715
11715
  const legacy = byName.get(LEGACY_BUNDLE_DIR) ?? [];
11716
- const sharedPhysical = canonical.find(
11716
+ const sharedPhysical = canonical2.find(
11717
11717
  (candidate) => legacy.some((other) => other.realPath === candidate.realPath)
11718
11718
  )?.realPath;
11719
11719
  if (sharedPhysical) {
@@ -12537,9 +12537,9 @@ function assertBundleBytesMatchCommit(top, bundlePath, commit) {
12537
12537
  });
12538
12538
  }
12539
12539
  try {
12540
- const stat8 = lstatSync(absolute);
12540
+ const stat9 = lstatSync(absolute);
12541
12541
  const actual = mode === "120000" ? readlinkSync(absolute, { encoding: "buffer" }) : readFileSync4(absolute);
12542
- if (mode === "120000" && !stat8.isSymbolicLink() || mode !== "120000" && !stat8.isFile()) {
12542
+ if (mode === "120000" && !stat9.isSymbolicLink() || mode !== "120000" && !stat9.isFile()) {
12543
12543
  mismatches.push(relPath);
12544
12544
  } else if (!Buffer.from(actual).equals(stored.stdout)) {
12545
12545
  mismatches.push(relPath);
@@ -14069,8 +14069,8 @@ function normalizeServer(raw) {
14069
14069
  if (url2.protocol !== "http:" && url2.protocol !== "https:") {
14070
14070
  throw new Error(`server URL must use http or https: ${raw}`);
14071
14071
  }
14072
- const path43 = url2.pathname.replace(/\/+$/, "");
14073
- return { base: url2.origin + path43, resource: url2.origin };
14072
+ const path44 = url2.pathname.replace(/\/+$/, "");
14073
+ return { base: url2.origin + path44, resource: url2.origin };
14074
14074
  }
14075
14075
  var init_config = __esm({
14076
14076
  "../cli/src/config.ts"() {
@@ -15260,10 +15260,37 @@ async function resolveProjectBinding(startDir = process.cwd()) {
15260
15260
  dir = parent;
15261
15261
  }
15262
15262
  }
15263
- function wrapTransportErrors(remote) {
15263
+ async function isHostedSuperbee(origin) {
15264
+ try {
15265
+ const response = await globalThis.fetch(`${origin}${HOSTED_PROBE_PATH}`, {
15266
+ headers: { accept: "application/json" },
15267
+ redirect: "manual",
15268
+ signal: AbortSignal.timeout(HOSTED_PROBE_TIMEOUT_MS)
15269
+ });
15270
+ if (!response.ok) return false;
15271
+ const body = await response.json();
15272
+ return typeof body.resource === "string";
15273
+ } catch {
15274
+ return false;
15275
+ }
15276
+ }
15277
+ function hostedRemoteRefusal(remote, origin) {
15278
+ return new CliError(
15279
+ "USAGE",
15280
+ `${remote} is a hosted Superbee URL, not a wire-protocol server: --remote reaches only 'superbee serve'; use 'superbee checkout' for a hosted bundle`,
15281
+ {
15282
+ details: { reason: "hosted_url", remote, host: origin },
15283
+ help: `${cliInvocation()} checkout <bundle-id> --host ${commandToken(origin)}`
15284
+ }
15285
+ );
15286
+ }
15287
+ function wrapTransportErrors(remote, origin) {
15288
+ let hosted;
15264
15289
  return captureRuntimeCallback(async (request2) => {
15290
+ if (hosted) throw hostedRemoteRefusal(remote, origin);
15291
+ let response;
15265
15292
  try {
15266
- return await globalThis.fetch(request2);
15293
+ response = await globalThis.fetch(request2);
15267
15294
  } catch (err) {
15268
15295
  throw new CliError(
15269
15296
  "RUNTIME",
@@ -15271,6 +15298,11 @@ function wrapTransportErrors(remote) {
15271
15298
  { help: `${cliInvocation()} serve --dir <path>` }
15272
15299
  );
15273
15300
  }
15301
+ if (hosted === void 0) {
15302
+ hosted = HOSTED_PROBE_STATUSES.has(response.status) ? await isHostedSuperbee(origin) : false;
15303
+ if (hosted) throw hostedRemoteRefusal(remote, origin);
15304
+ }
15305
+ return response;
15274
15306
  });
15275
15307
  }
15276
15308
  function resolveApiKeyEnv(env = process.env) {
@@ -15298,7 +15330,7 @@ async function openRemoteBundle(remoteFlag) {
15298
15330
  const backend = new RemoteBackend({
15299
15331
  baseUrl: base,
15300
15332
  bundle: "default",
15301
- fetchImpl: wrapTransportErrors(base),
15333
+ fetchImpl: wrapTransportErrors(base, origin),
15302
15334
  authToken
15303
15335
  });
15304
15336
  return { root: base, backend };
@@ -16172,14 +16204,14 @@ async function captureDirectoryIdentity(target2) {
16172
16204
  if (!samePhysicalPath3(canonicalRoot, target2.canonicalRoot)) {
16173
16205
  throw bindingPathConflict(target2, "the selected target changed while its lexical path was validated");
16174
16206
  }
16175
- let stat8;
16207
+ let stat9;
16176
16208
  try {
16177
- stat8 = await fs3.stat(canonicalRoot);
16209
+ stat9 = await fs3.stat(canonicalRoot);
16178
16210
  } catch {
16179
16211
  throw bindingPathConflict(target2, "the selected target is unavailable");
16180
16212
  }
16181
- if (!stat8.isDirectory()) throw bindingPathConflict(target2, "the selected target is not a directory");
16182
- return { canonicalRoot, dev: stat8.dev, ino: stat8.ino };
16213
+ if (!stat9.isDirectory()) throw bindingPathConflict(target2, "the selected target is not a directory");
16214
+ return { canonicalRoot, dev: stat9.dev, ino: stat9.ino };
16183
16215
  }
16184
16216
  async function hasOwnGitWorktreeSignature(root) {
16185
16217
  try {
@@ -16208,13 +16240,13 @@ async function assertResolvedLocalRouteIdentity(route) {
16208
16240
  if (!samePhysicalPath3(canonicalRoot, route.identity.canonicalRoot)) {
16209
16241
  throw bindingPathConflict(route.target, "the selected target changed after classification");
16210
16242
  }
16211
- let stat8;
16243
+ let stat9;
16212
16244
  try {
16213
- stat8 = await fs3.stat(canonicalRoot);
16245
+ stat9 = await fs3.stat(canonicalRoot);
16214
16246
  } catch {
16215
16247
  throw bindingPathConflict(route.target, "the selected target is unavailable");
16216
16248
  }
16217
- if (stat8.dev !== route.identity.dev || stat8.ino !== route.identity.ino) {
16249
+ if (stat9.dev !== route.identity.dev || stat9.ino !== route.identity.ino) {
16218
16250
  throw bindingPathConflict(route.target, "the selected target identity changed after classification");
16219
16251
  }
16220
16252
  }
@@ -16268,7 +16300,7 @@ async function openBundle(dirFlag, remoteFlag) {
16268
16300
  await assertResolvedLocalRouteIdentity(route);
16269
16301
  return route.bundle;
16270
16302
  }
16271
- var CONVENTIONAL_BUNDLE_DIR_NAME, LEGACY_CONVENTIONAL_BUNDLE_DIR_NAME, SUPERBEE_PROJECT_BINDING_FILE_NAME, PROJECT_BINDING_FILE_NAME, PROJECT_BINDING_FILE_NAMES, API_KEY_ENV_VAR, SUPERBEE_API_KEY_ENV_VAR, REMOTE_ENV_VAR, createOnlyFs;
16303
+ var CONVENTIONAL_BUNDLE_DIR_NAME, LEGACY_CONVENTIONAL_BUNDLE_DIR_NAME, SUPERBEE_PROJECT_BINDING_FILE_NAME, PROJECT_BINDING_FILE_NAME, PROJECT_BINDING_FILE_NAMES, HOSTED_PROBE_STATUSES, HOSTED_PROBE_PATH, HOSTED_PROBE_TIMEOUT_MS, API_KEY_ENV_VAR, SUPERBEE_API_KEY_ENV_VAR, REMOTE_ENV_VAR, createOnlyFs;
16272
16304
  var init_bundle2 = __esm({
16273
16305
  "../cli/src/bundle.ts"() {
16274
16306
  "use strict";
@@ -16296,6 +16328,9 @@ var init_bundle2 = __esm({
16296
16328
  SUPERBEE_PROJECT_BINDING_FILE_NAME,
16297
16329
  PROJECT_BINDING_FILE_NAME
16298
16330
  ];
16331
+ HOSTED_PROBE_STATUSES = /* @__PURE__ */ new Set([401, 403, 404, 405]);
16332
+ HOSTED_PROBE_PATH = "/.well-known/oauth-protected-resource/mcp";
16333
+ HOSTED_PROBE_TIMEOUT_MS = 3e3;
16299
16334
  API_KEY_ENV_VAR = LEGACY_API_KEY_ENV;
16300
16335
  SUPERBEE_API_KEY_ENV_VAR = SUPERBEE_API_KEY_ENV;
16301
16336
  REMOTE_ENV_VAR = "AGENTSTATE_LITE_REMOTE";
@@ -16311,17 +16346,17 @@ var init_bundle2 = __esm({
16311
16346
  });
16312
16347
 
16313
16348
  // ../cli/src/command-spec.ts
16314
- function exactPositionalArity(count2) {
16315
- if (!Number.isSafeInteger(count2) || count2 < 0) {
16316
- throw new TypeError(`exact positional count must be a non-negative safe integer; received ${count2}`);
16349
+ function exactPositionalArity(count3) {
16350
+ if (!Number.isSafeInteger(count3) || count3 < 0) {
16351
+ throw new TypeError(`exact positional count must be a non-negative safe integer; received ${count3}`);
16317
16352
  }
16318
- return Object.freeze({ kind: "exact", count: count2 });
16353
+ return Object.freeze({ kind: "exact", count: count3 });
16319
16354
  }
16320
16355
  function pathFlags(...flags) {
16321
16356
  return Object.freeze(flags.map((entry) => Object.freeze({ ...entry })));
16322
16357
  }
16323
- function firstWord(path43) {
16324
- return path43.split(" ", 1)[0];
16358
+ function firstWord(path44) {
16359
+ return path44.split(" ", 1)[0];
16325
16360
  }
16326
16361
  function surfaceOf(surface, arity) {
16327
16362
  const positionals = surface?.positionals ?? NO_PATH_POSITIONALS;
@@ -16332,14 +16367,14 @@ function surfaceOf(surface, arity) {
16332
16367
  }
16333
16368
  return { pathFlags: surface?.flags ?? NO_PATHS, pathPositionals: positionals };
16334
16369
  }
16335
- function publicLeaf(id, path43, arity, commandOrder, surface) {
16370
+ function publicLeaf(id, path44, arity, commandOrder, surface) {
16336
16371
  if (commandOrder !== void 0 && (!Number.isSafeInteger(commandOrder) || commandOrder < 0)) {
16337
16372
  throw new TypeError(`command order must be a non-negative safe integer; received ${commandOrder}`);
16338
16373
  }
16339
16374
  const mutable = {
16340
16375
  id,
16341
- path: path43,
16342
- command: firstWord(path43),
16376
+ path: path44,
16377
+ command: firstWord(path44),
16343
16378
  arity,
16344
16379
  canonical: void 0,
16345
16380
  exposure: "public",
@@ -16352,31 +16387,31 @@ function publicLeaf(id, path43, arity, commandOrder, surface) {
16352
16387
  OWNED_CLI_LEAVES.add(mutable);
16353
16388
  return Object.freeze(mutable);
16354
16389
  }
16355
- function publicAlias(id, path43, canonical, commandOrder) {
16356
- if (canonical.exposure !== "public") throw new TypeError("a public alias must target a public leaf");
16390
+ function publicAlias(id, path44, canonical2, commandOrder) {
16391
+ if (canonical2.exposure !== "public") throw new TypeError("a public alias must target a public leaf");
16357
16392
  const mutable = {
16358
16393
  id,
16359
- path: path43,
16360
- command: firstWord(path43),
16361
- arity: canonical.arity,
16362
- canonical: canonical.canonical,
16394
+ path: path44,
16395
+ command: firstWord(path44),
16396
+ arity: canonical2.arity,
16397
+ canonical: canonical2.canonical,
16363
16398
  exposure: "public",
16364
16399
  ...commandOrder === void 0 ? {} : { commandOrder },
16365
16400
  // An alias is the same executable surface under a second spelling: its path metadata is the
16366
16401
  // canonical leaf's, never a second declaration that could drift.
16367
- pathFlags: canonical.pathFlags,
16368
- pathPositionals: canonical.pathPositionals,
16369
- ...canonical.dynamicFieldFlags ? { dynamicFieldFlags: true } : {},
16402
+ pathFlags: canonical2.pathFlags,
16403
+ pathPositionals: canonical2.pathPositionals,
16404
+ ...canonical2.dynamicFieldFlags ? { dynamicFieldFlags: true } : {},
16370
16405
  [CLI_LEAF_BRAND]: true
16371
16406
  };
16372
16407
  OWNED_CLI_LEAVES.add(mutable);
16373
16408
  return Object.freeze(mutable);
16374
16409
  }
16375
- function hiddenLeaf(id, path43, arity, surface) {
16410
+ function hiddenLeaf(id, path44, arity, surface) {
16376
16411
  const mutable = {
16377
16412
  id,
16378
- path: path43,
16379
- command: firstWord(path43),
16413
+ path: path44,
16414
+ command: firstWord(path44),
16380
16415
  arity,
16381
16416
  canonical: void 0,
16382
16417
  exposure: "hidden",
@@ -16739,7 +16774,7 @@ var init_command_spec = __esm({
16739
16774
  id: "sync",
16740
16775
  leaves: [publicLeaf("sync", "sync", zero, 22, DIR_SYNC_SURFACE)],
16741
16776
  usage: "sync [--establish [--yes] | --pull-only | --show-incoming <id> [--out <file> | --body-out <file>] | --inspect --doc <id> [--out <file>] | --resolve keep|take|revise --doc <id> | --restore-deletes | --accept-deletes <token> | --take-host-deletions <token>] [--dir <path>] [--limit <n>]",
16742
- summary: "In a hosted checkout (made by `checkout`): send each edited file as one whole document under your own access and refresh documents changed on the host, with one row per document (committed, conflict, held, refused, unknown, paused; non-zero exit until all are committed). A change to one document and a host change to another both land; a document changed on both sides is never merged but comes back as a conflict, resolved with --inspect --doc <id> then --resolve keep|take|revise --doc <id> (a resolution is recorded, then sent by the next plain sync). A held mass delete is accepted only by the person, typing the count in their own terminal (--accept-deletes); --restore-deletes puts the files back; --take-host-deletions takes a mass deletion the pull refused. Otherwise: share the board branch with a remote \u2014 commits, pulls, and pushes (git tier; --pull-only skips commit+push). The remote repository must already exist: Superbee does not create it. After confirming the repository exists and origin/board does not, --establish is the separate explicit act that creates/pushes the board branch; it needs repository-specific push capability and branch-create policy clearance. If origin/board exists, plain `sync` joins it. Works both from a project's conventional bundle worktree and from a standalone clone whose tracked OKF root is attached to the shared board branch. A bundle folder already committed on the code branch is the same flag's hard case: preview first, --yes executes, and the folder's removal from the code branch rides a prepared side-branch commit you push and open as a PR. A bundle committed with code and NO board branch anywhere is the IN-TREE mode (read-side): full sync refuses (sharing rides your normal commit/push), --pull-only fetches the branch's tracking upstream and reports incoming board docs ('git pull' delivers them), and --establish converts to a dedicated board branch. A doc changed on both sides converges: teammate's version kept, yours exported; --show-incoming <id> (exclusive with --pull-only) prints the incoming version as of the last fetch. Board-reading commands (list/doc read/status/home/link show) auto-run the ff-only pull when board state is >~5m stale \u2014 silent, bounded (~2s), never a push; SUPERBEE_NO_AUTOPULL=<any value, even 0> disables it"
16777
+ summary: "Share the board branch with a remote \u2014 commits, pulls, and pushes (git tier; --pull-only skips commit+push). The remote repository must already exist: Superbee does not create it. After confirming the repository exists and origin/board does not, --establish is the separate explicit act that creates/pushes the board branch; it needs repository-specific push capability and branch-create policy clearance. If origin/board exists, plain `sync` joins it. Works both from a project's conventional bundle worktree and from a standalone clone whose tracked OKF root is attached to the shared board branch. A bundle folder already committed on the code branch is the same flag's hard case: preview first, --yes executes, and the folder's removal from the code branch rides a prepared side-branch commit you push and open as a PR. A bundle committed with code and NO board branch anywhere is the IN-TREE mode (read-side): full sync refuses (sharing rides your normal commit/push), --pull-only fetches the branch's tracking upstream and reports incoming board docs ('git pull' delivers them), and --establish converts to a dedicated board branch. A doc changed on both sides converges: teammate's version kept, yours exported; --show-incoming <id> (exclusive with --pull-only) prints the incoming version as of the last fetch. Board-reading commands (list/doc read/status/home/link show) auto-run the ff-only pull when board state is >~5m stale \u2014 silent, bounded (~2s), never a push; SUPERBEE_NO_AUTOPULL=<any value, even 0> disables it. Hosted checkout (a folder made by `checkout`): sync instead sends each edited file as one whole document under your own access and refreshes documents changed on the host, with one row per document (committed, conflict, held, refused, unknown, paused; non-zero exit until all are committed). A change to one document and a host change to another both land; a document changed on both sides is never merged but comes back as a conflict, resolved with --inspect --doc <id> then --resolve keep|take|revise --doc <id> (a resolution is recorded, then sent by the next plain sync). A held mass delete is accepted only by the person, typing the count in their own terminal (--accept-deletes); --restore-deletes puts the files back; --take-host-deletions takes a mass deletion the pull refused."
16743
16778
  }
16744
16779
  ]
16745
16780
  },
@@ -16823,7 +16858,7 @@ var init_command_spec = __esm({
16823
16858
  id: "checkout",
16824
16859
  leaves: [publicLeaf("checkout", "checkout", one, 32, DIR_SURFACE)],
16825
16860
  usage: "checkout (<bundle-id> [--host <url>] [--dir <folder>] [--workspace <id>] | --release <folder>) [--json]",
16826
- summary: "Mirror a hosted bundle into a new local folder (a read copy for now): signs in if needed (AUTH_REQUIRED carries the link), the host defaults to your last sign-in, the binding stays in private state, and every command then runs on the folder; commands sync cannot send are refused there with 'do this in the app'; --release forgets a checkout and keeps its files"
16861
+ summary: "Mirror a hosted bundle into a new local folder you edit and then sync (sync sends your edits and brings in the host's): signs in if needed (AUTH_REQUIRED carries the link), the host defaults to your last sign-in, the binding stays in private state, and every command then runs on the folder; commands sync cannot send are refused there with 'do this in the app'; --release forgets a checkout and keeps its files"
16827
16862
  }
16828
16863
  ]
16829
16864
  }
@@ -16842,23 +16877,23 @@ function boundedToken(token) {
16842
16877
  }
16843
16878
  function assertLeafArity(leaf, positionals) {
16844
16879
  assertCliLeaf(leaf);
16845
- const path43 = leaf.canonical.path;
16846
- const count2 = leaf.arity.count;
16847
- const max = leaf.arity.max ?? count2;
16848
- const expected = max !== count2 ? `${count2} to ${max} positionals` : count2 === 0 ? "no positional arguments" : `exactly ${count2} positional${count2 === 1 ? "" : "s"}`;
16880
+ const path44 = leaf.canonical.path;
16881
+ const count3 = leaf.arity.count;
16882
+ const max = leaf.arity.max ?? count3;
16883
+ const expected = max !== count3 ? `${count3} to ${max} positionals` : count3 === 0 ? "no positional arguments" : `exactly ${count3} positional${count3 === 1 ? "" : "s"}`;
16849
16884
  const actual = positionals.length;
16850
- if (actual >= count2 && actual <= max) return;
16885
+ if (actual >= count3 && actual <= max) return;
16851
16886
  const firstUnexpected = boundedToken(positionals[max]);
16852
16887
  const surplus = Math.max(0, actual - max);
16853
- throw new CliError("USAGE", `${path43} expected ${expected}; received ${actual}`, {
16888
+ throw new CliError("USAGE", `${path44} expected ${expected}; received ${actual}`, {
16854
16889
  details: {
16855
- command: path43,
16890
+ command: path44,
16856
16891
  expected,
16857
16892
  actual,
16858
16893
  ...surplus === 0 ? {} : { surplus },
16859
16894
  ...firstUnexpected === void 0 ? {} : { first_unexpected: firstUnexpected }
16860
16895
  },
16861
- help: `${cliInvocation()} ${commandWords(path43)} --help`
16896
+ help: `${cliInvocation()} ${commandWords(path44)} --help`
16862
16897
  });
16863
16898
  }
16864
16899
  var init_positional_arity = __esm({
@@ -18305,8 +18340,8 @@ function filesRecipeSource() {
18305
18340
  if (!real) {
18306
18341
  return { ok: false, error: { code: "RECIPE_NOT_FOUND", message: `no recipe folder at '${ref}'` } };
18307
18342
  }
18308
- const stat8 = await fs4.stat(real).catch(() => null);
18309
- if (!stat8 || !stat8.isDirectory()) {
18343
+ const stat9 = await fs4.stat(real).catch(() => null);
18344
+ if (!stat9 || !stat9.isDirectory()) {
18310
18345
  return { ok: false, error: { code: "RECIPE_UNSAFE_PATH", message: `'${ref}' is not a directory` } };
18311
18346
  }
18312
18347
  let files;
@@ -20415,8 +20450,8 @@ function resolveHostedTarget(host) {
20415
20450
  if (url2.username || url2.password || url2.search || url2.hash) {
20416
20451
  throw new CliError("USAGE", "--host must be a plain URL without credentials, query or fragment");
20417
20452
  }
20418
- const path43 = trimTrailingSlashes2(url2.pathname);
20419
- const resourcePath = path43 === "" ? DEFAULT_RESOURCE_PATH : path43;
20453
+ const path44 = trimTrailingSlashes2(url2.pathname);
20454
+ const resourcePath = path44 === "" ? DEFAULT_RESOURCE_PATH : path44;
20420
20455
  return {
20421
20456
  origin: url2.origin,
20422
20457
  audience: `${url2.origin}${resourcePath}`,
@@ -20460,10 +20495,10 @@ function endpoint(meta3, key) {
20460
20495
  function issuerMetadataUrls(issuer) {
20461
20496
  const url2 = new URL(issuer);
20462
20497
  const trimmed = trimTrailingSlashes2(issuer);
20463
- const path43 = trimTrailingSlashes2(url2.pathname);
20498
+ const path44 = trimTrailingSlashes2(url2.pathname);
20464
20499
  return [
20465
20500
  `${trimmed}/.well-known/openid-configuration`,
20466
- `${url2.origin}/.well-known/oauth-authorization-server${path43}`
20501
+ `${url2.origin}/.well-known/oauth-authorization-server${path44}`
20467
20502
  ];
20468
20503
  }
20469
20504
  function sameIssuer(a, b) {
@@ -22260,9 +22295,9 @@ var init_indexeddb_backend = __esm({
22260
22295
  async writeReserved(dir, name, content3, options = {}) {
22261
22296
  assertSafeReservedDir(dir);
22262
22297
  assertSafeReservedFilename(name);
22263
- const path43 = reservedKey2(dir, name);
22264
- return this.#compareAndSwap(RESERVED, path43, path43, options.expectedVersion, () => ({
22265
- record: { path: path43, content: content3, version: versionOfBytes(content3) }
22298
+ const path44 = reservedKey2(dir, name);
22299
+ return this.#compareAndSwap(RESERVED, path44, path44, options.expectedVersion, () => ({
22300
+ record: { path: path44, content: content3, version: versionOfBytes(content3) }
22266
22301
  }));
22267
22302
  }
22268
22303
  // ── intent journal and meta ────────────────────────────────────────────────────────────
@@ -22947,8 +22982,8 @@ function createFetchCarrier(options) {
22947
22982
  const deadlineMs = options.deadlineMs ?? 15e3;
22948
22983
  const bindingHeader = options.bindingHeader ?? "X-Superbee-Checkout";
22949
22984
  const base = new URL(options.baseUrl);
22950
- async function send(path43, input, signal, extra, deadline) {
22951
- if (!path43.startsWith("/")) throw new TypeError(`hosted route '${path43}' must be absolute`);
22985
+ async function send(path44, input, signal, extra, deadline) {
22986
+ if (!path44.startsWith("/")) throw new TypeError(`hosted route '${path44}' must be absolute`);
22952
22987
  let credentials;
22953
22988
  try {
22954
22989
  credentials = await options.credentials(signal);
@@ -22957,7 +22992,7 @@ function createFetchCarrier(options) {
22957
22992
  }
22958
22993
  if (signal.aborted) throw new HostedCarrierError("denied");
22959
22994
  try {
22960
- return await fetcher(new URL(path43, base), {
22995
+ return await fetcher(new URL(path44, base), {
22961
22996
  method: "POST",
22962
22997
  redirect: "error",
22963
22998
  headers: { ...credentials, ...extra, "Content-Type": "application/json", Accept: "application/json" },
@@ -22969,7 +23004,7 @@ function createFetchCarrier(options) {
22969
23004
  }
22970
23005
  }
22971
23006
  return {
22972
- async json(path43, input, signal, request2) {
23007
+ async json(path44, input, signal, request2) {
22973
23008
  if (request2.writeRequest !== void 0 && !WRITE_REQUEST.test(request2.writeRequest)) throw new HostedCarrierError("denied");
22974
23009
  if (request2.binding !== void 0 && !BINDING.test(request2.binding)) throw new HostedCarrierError("denied");
22975
23010
  if (request2.recreate !== void 0 && !BINDING.test(request2.recreate)) throw new HostedCarrierError("denied");
@@ -22978,7 +23013,7 @@ function createFetchCarrier(options) {
22978
23013
  if (request2.binding !== void 0) extra[bindingHeader] = request2.binding;
22979
23014
  if (request2.recreate !== void 0) extra[RECREATE_HEADER] = request2.recreate;
22980
23015
  const deadline = AbortSignal.timeout(deadlineMs);
22981
- const response = await send(path43, input, signal, extra, deadline);
23016
+ const response = await send(path44, input, signal, extra, deadline);
22982
23017
  let body;
22983
23018
  try {
22984
23019
  body = await readBounded(response, request2.maximum);
@@ -22988,12 +23023,12 @@ function createFetchCarrier(options) {
22988
23023
  }
22989
23024
  return { status: response.status, headers: response.headers, body };
22990
23025
  },
22991
- async stream(path43, input, signal) {
23026
+ async stream(path44, input, signal) {
22992
23027
  const idle = new AbortController();
22993
23028
  const firstByte = setTimeout(() => idle.abort(), deadlineMs);
22994
23029
  let response;
22995
23030
  try {
22996
- response = await send(path43, input, signal, {}, idle.signal);
23031
+ response = await send(path44, input, signal, {}, idle.signal);
22997
23032
  } finally {
22998
23033
  clearTimeout(firstByte);
22999
23034
  }
@@ -24787,8 +24822,8 @@ async function pushBodyIntent(backend, mode, requestId2, options) {
24787
24822
  patch = { ...patch, state: "acknowledged", acknowledgedVersion: proposal.receipt.version };
24788
24823
  meta3.push({ key, value: { ...evidence, receipt: proposal.receipt } });
24789
24824
  if (proposal.shared.action === "replace-shared-under-CAS") {
24790
- const canonical = bodyDocument(proposal.shared.content, intent.target, mode);
24791
- meta3.push(baseRow(intent.target, { version: proposal.shared.version, content: stringifyDoc(canonical.frontmatter, canonical.body ?? "") }));
24825
+ const canonical2 = bodyDocument(proposal.shared.content, intent.target, mode);
24826
+ meta3.push(baseRow(intent.target, { version: proposal.shared.version, content: stringifyDoc(canonical2.frontmatter, canonical2.body ?? "") }));
24792
24827
  }
24793
24828
  if (proposal.action === "replace-local-under-CAS") document4 = bodyDocument(proposal.receipt.content, intent.target, mode);
24794
24829
  break;
@@ -25508,8 +25543,8 @@ var init_file_journaled_backend = __esm({
25508
25543
  if (!(compactAfter >= 0)) throw new TypeError("compactAfterBytes must be a non-negative number");
25509
25544
  let created = false;
25510
25545
  try {
25511
- const stat8 = await fs6.stat(directory);
25512
- if (!stat8.isDirectory()) throw new Error(`'${directory}' is not a directory`);
25546
+ const stat9 = await fs6.stat(directory);
25547
+ if (!stat9.isDirectory()) throw new Error(`'${directory}' is not a directory`);
25513
25548
  } catch (error51) {
25514
25549
  if (error51.code !== "ENOENT" || options.readOnly) throw error51;
25515
25550
  await fs6.mkdir(directory, { recursive: true, mode: 448 });
@@ -26122,14 +26157,14 @@ var init_filesystem_push_role = __esm({
26122
26157
  });
26123
26158
 
26124
26159
  // ../cli/src/board-runtime.ts
26125
- function worktreeRootResolvesForOwner2(path43, owner) {
26126
- return worktreeRootResolvesForOwner(path43, owner, currentBoardHost());
26160
+ function worktreeRootResolvesForOwner2(path44, owner) {
26161
+ return worktreeRootResolvesForOwner(path44, owner, currentBoardHost());
26127
26162
  }
26128
- function isProvisioned2(path43) {
26129
- return isProvisioned(path43, currentBoardHost());
26163
+ function isProvisioned2(path44) {
26164
+ return isProvisioned(path44, currentBoardHost());
26130
26165
  }
26131
- function resolveProvisionedBoardPath2(path43) {
26132
- return resolveProvisionedBoardPath(path43, currentBoardHost());
26166
+ function resolveProvisionedBoardPath2(path44) {
26167
+ return resolveProvisionedBoardPath(path44, currentBoardHost());
26133
26168
  }
26134
26169
  function existingDirRefusal2(...args) {
26135
26170
  return existingDirRefusal(
@@ -26222,26 +26257,26 @@ function renamePrivateConfigSync(source, destination, platform) {
26222
26257
  }
26223
26258
  }
26224
26259
  }
26225
- function resolveWriteDestination(path43, followFinalSymlink) {
26260
+ function resolveWriteDestination(path44, followFinalSymlink) {
26226
26261
  let isLink = false;
26227
26262
  try {
26228
- isLink = lstatSync4(path43).isSymbolicLink();
26263
+ isLink = lstatSync4(path44).isSymbolicLink();
26229
26264
  } catch (error51) {
26230
- if (missing(error51)) return path43;
26265
+ if (missing(error51)) return path44;
26231
26266
  throw error51;
26232
26267
  }
26233
- if (!isLink) return path43;
26268
+ if (!isLink) return path44;
26234
26269
  if (!followFinalSymlink) {
26235
- throw new Error(`symlink at ${path43} \u2014 refusing to replace a generated plugin through a link`);
26270
+ throw new Error(`symlink at ${path44} \u2014 refusing to replace a generated plugin through a link`);
26236
26271
  }
26237
26272
  try {
26238
- return realpathSync11(path43);
26273
+ return realpathSync11(path44);
26239
26274
  } catch {
26240
- throw new Error(`dangling symlink at ${path43} \u2014 refusing to write through it; fix or remove the link`);
26275
+ throw new Error(`dangling symlink at ${path44} \u2014 refusing to write through it; fix or remove the link`);
26241
26276
  }
26242
26277
  }
26243
- function capturePrivateConfigParent(path43) {
26244
- let current = dirname4(path43);
26278
+ function capturePrivateConfigParent(path44) {
26279
+ let current = dirname4(path44);
26245
26280
  while (true) {
26246
26281
  try {
26247
26282
  return { path: current, destination: realpathSync11(current) };
@@ -26253,19 +26288,19 @@ function capturePrivateConfigParent(path43) {
26253
26288
  }
26254
26289
  }
26255
26290
  }
26256
- function atomicWriteFileSync(path43, content3, options = {}) {
26291
+ function atomicWriteFileSync(path44, content3, options = {}) {
26257
26292
  const platform = options.platform ?? process.platform;
26258
- const destination = resolveWriteDestination(path43, options.followFinalSymlink ?? true);
26293
+ const destination = resolveWriteDestination(path44, options.followFinalSymlink ?? true);
26259
26294
  if (options.expected) {
26260
26295
  if (options.expected.parent) {
26261
- const currentParent = capturePrivateConfigParent(path43);
26296
+ const currentParent = capturePrivateConfigParent(path44);
26262
26297
  if (currentParent.path !== options.expected.parent.path || currentParent.destination !== options.expected.parent.destination) {
26263
26298
  throw new Error("private configuration parent changed after inspection");
26264
26299
  }
26265
26300
  }
26266
26301
  let currentDestination;
26267
26302
  try {
26268
- currentDestination = realpathSync11(path43);
26303
+ currentDestination = realpathSync11(path44);
26269
26304
  } catch (error51) {
26270
26305
  if (!missing(error51)) throw error51;
26271
26306
  currentDestination = null;
@@ -26473,8 +26508,8 @@ function defaultRealpath(candidate) {
26473
26508
  return void 0;
26474
26509
  }
26475
26510
  }
26476
- function npmPrefixInvocation(_platform = process.platform, _env = process.env, realpath7 = defaultRealpath, runtimePath = process.execPath) {
26477
- return currentHost().npmPrefixInvocation(runtimePath, realpath7);
26511
+ function npmPrefixInvocation(_platform = process.platform, _env = process.env, realpath10 = defaultRealpath, runtimePath = process.execPath) {
26512
+ return currentHost().npmPrefixInvocation(runtimePath, realpath10);
26478
26513
  }
26479
26514
  function defaultNpmPrefixGlobal() {
26480
26515
  try {
@@ -27096,10 +27131,10 @@ function targetSets(bases, deps) {
27096
27131
  const env = deps.env ?? process.env;
27097
27132
  return [targetsForBase(cwd, platform), globalHookTargets(home2, env, platform)];
27098
27133
  }
27099
- function readSettings(path43) {
27100
- if (!existsSync6(path43)) return {};
27134
+ function readSettings(path44) {
27135
+ if (!existsSync6(path44)) return {};
27101
27136
  try {
27102
- return JSON.parse(readFileSync10(path43, "utf8"));
27137
+ return JSON.parse(readFileSync10(path44, "utf8"));
27103
27138
  } catch {
27104
27139
  return {};
27105
27140
  }
@@ -27107,11 +27142,11 @@ function readSettings(path43) {
27107
27142
  function isPlainObject3(value) {
27108
27143
  return typeof value === "object" && value !== null && !Array.isArray(value);
27109
27144
  }
27110
- function readSettingsForInstall(path43) {
27111
- if (!existsSync6(path43)) return { ok: true, settings: {} };
27145
+ function readSettingsForInstall(path44) {
27146
+ if (!existsSync6(path44)) return { ok: true, settings: {} };
27112
27147
  let raw;
27113
27148
  try {
27114
- raw = readFileSync10(path43, "utf8");
27149
+ raw = readFileSync10(path44, "utf8");
27115
27150
  } catch (err) {
27116
27151
  return { ok: false, reason: `unreadable (${err instanceof Error ? err.message : String(err)})` };
27117
27152
  }
@@ -27162,8 +27197,8 @@ function readSettingsForInstall(path43) {
27162
27197
  }
27163
27198
  return { ok: true, settings: parsed };
27164
27199
  }
27165
- function writeSettings(path43, settings) {
27166
- atomicWriteFileSync(path43, `${JSON.stringify(settings, null, 2)}
27200
+ function writeSettings(path44, settings) {
27201
+ atomicWriteFileSync(path44, `${JSON.stringify(settings, null, 2)}
27167
27202
  `);
27168
27203
  }
27169
27204
  function buildOpenCodePluginTemplate(options) {
@@ -27317,10 +27352,10 @@ function generatedConstant(source, name) {
27317
27352
  function normalizedGeneratedSource(source) {
27318
27353
  return source.replaceAll("\r\n", "\n");
27319
27354
  }
27320
- function readOpenCodeHookStatus(path43, expectedSource) {
27355
+ function readOpenCodeHookStatus(path44, expectedSource) {
27321
27356
  let entry;
27322
27357
  try {
27323
- entry = lstatSync6(path43);
27358
+ entry = lstatSync6(path44);
27324
27359
  } catch {
27325
27360
  return { installed: false, compatibility: { state: "absent", reason: "plugin file is absent" } };
27326
27361
  }
@@ -27336,7 +27371,7 @@ function readOpenCodeHookStatus(path43, expectedSource) {
27336
27371
  if (!entry.isFile()) {
27337
27372
  return { installed: false, compatibility: { state: "unmanaged", reason: "plugin path is not a regular file" } };
27338
27373
  }
27339
- const read = readRegularFileTextNoFollowSync(path43);
27374
+ const read = readRegularFileTextNoFollowSync(path44);
27340
27375
  if (read.state === "missing") {
27341
27376
  return { installed: false, compatibility: { state: "absent", reason: "plugin file is absent" } };
27342
27377
  }
@@ -27407,9 +27442,9 @@ function readOpenCodeHookStatus(path43, expectedSource) {
27407
27442
  };
27408
27443
  }
27409
27444
  function readOpenCodeTargetsStatus(targets, expectedSource) {
27410
- const canonical = readOpenCodeHookStatus(targets.opencodePlugin, expectedSource);
27445
+ const canonical2 = readOpenCodeHookStatus(targets.opencodePlugin, expectedSource);
27411
27446
  const legacy = readOpenCodeHookStatus(targets.legacyOpencodePlugin);
27412
- const owned = [canonical, legacy].filter((status2) => status2.installed);
27447
+ const owned = [canonical2, legacy].filter((status2) => status2.installed);
27413
27448
  if (owned.length > 1) {
27414
27449
  return {
27415
27450
  installed: true,
@@ -27421,7 +27456,7 @@ function readOpenCodeTargetsStatus(targets, expectedSource) {
27421
27456
  };
27422
27457
  }
27423
27458
  if (owned.length === 1) return owned[0];
27424
- if (canonical.compatibility.state === "unmanaged" || legacy.compatibility.state === "unmanaged") {
27459
+ if (canonical2.compatibility.state === "unmanaged" || legacy.compatibility.state === "unmanaged") {
27425
27460
  return {
27426
27461
  installed: false,
27427
27462
  compatibility: {
@@ -27430,62 +27465,62 @@ function readOpenCodeTargetsStatus(targets, expectedSource) {
27430
27465
  }
27431
27466
  };
27432
27467
  }
27433
- return canonical;
27468
+ return canonical2;
27434
27469
  }
27435
- function openCodeClaimPath(path43) {
27436
- return `${path43}.claim-${process.pid}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
27470
+ function openCodeClaimPath(path44) {
27471
+ return `${path44}.claim-${process.pid}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
27437
27472
  }
27438
- function restoreOpenCodeClaim(claim, path43) {
27473
+ function restoreOpenCodeClaim(claim, path44) {
27439
27474
  try {
27440
27475
  const entry = lstatSync6(claim);
27441
- if (entry.isSymbolicLink()) symlinkSync(readlinkSync3(claim), path43);
27442
- else if (entry.isFile()) linkSync2(claim, path43);
27476
+ if (entry.isSymbolicLink()) symlinkSync(readlinkSync3(claim), path44);
27477
+ else if (entry.isFile()) linkSync2(claim, path44);
27443
27478
  else throw new Error("claimed entry is not a regular file or symlink");
27444
27479
  } catch (error51) {
27445
27480
  throw new Error(`OpenCode plugin changed during migration; recovery copy retained at ${collapseHomeDirectory(claim)}`, { cause: error51 });
27446
27481
  }
27447
27482
  rmSync3(claim, { force: true });
27448
27483
  }
27449
- function claimOwnedOpenCodePlugin(path43) {
27450
- const inspected = readOpenCodeHookStatus(path43);
27484
+ function claimOwnedOpenCodePlugin(path44) {
27485
+ const inspected = readOpenCodeHookStatus(path44);
27451
27486
  if (!inspected.installed) return void 0;
27452
- const claim = openCodeClaimPath(path43);
27487
+ const claim = openCodeClaimPath(path44);
27453
27488
  try {
27454
- renameSync4(path43, claim);
27489
+ renameSync4(path44, claim);
27455
27490
  } catch (error51) {
27456
27491
  throw new Error("OpenCode plugin changed after inspection; nothing was removed", { cause: error51 });
27457
27492
  }
27458
27493
  const claimed = readOpenCodeHookStatus(claim);
27459
27494
  if (!claimed.installed) {
27460
- restoreOpenCodeClaim(claim, path43);
27495
+ restoreOpenCodeClaim(claim, path44);
27461
27496
  throw new Error("OpenCode plugin changed after inspection; the changed bytes were preserved");
27462
27497
  }
27463
27498
  return claim;
27464
27499
  }
27465
- function removeOwnedOpenCodePlugin(path43) {
27466
- const claim = claimOwnedOpenCodePlugin(path43);
27500
+ function removeOwnedOpenCodePlugin(path44) {
27501
+ const claim = claimOwnedOpenCodePlugin(path44);
27467
27502
  if (claim === void 0) return false;
27468
27503
  rmSync3(claim, { force: true });
27469
27504
  return true;
27470
27505
  }
27471
- function installOpenCodePlugin(path43, next) {
27472
- const inspected = readOpenCodeHookStatus(path43, next);
27506
+ function installOpenCodePlugin(path44, next) {
27507
+ const inspected = readOpenCodeHookStatus(path44, next);
27473
27508
  if (inspected.compatibility.state === "unmanaged") {
27474
27509
  throw new Error("refusing to overwrite unmanaged OpenCode plugin");
27475
27510
  }
27476
27511
  if (inspected.compatibility.state === "current") return false;
27477
- const claim = inspected.installed ? claimOwnedOpenCodePlugin(path43) : void 0;
27512
+ const claim = inspected.installed ? claimOwnedOpenCodePlugin(path44) : void 0;
27478
27513
  try {
27479
- atomicWriteFileSync(path43, next, {
27514
+ atomicWriteFileSync(path44, next, {
27480
27515
  followFinalSymlink: false,
27481
27516
  expected: {
27482
27517
  destination: null,
27483
27518
  content: null,
27484
- parent: capturePrivateConfigParent(path43)
27519
+ parent: capturePrivateConfigParent(path44)
27485
27520
  }
27486
27521
  });
27487
27522
  } catch (error51) {
27488
- if (claim !== void 0) restoreOpenCodeClaim(claim, path43);
27523
+ if (claim !== void 0) restoreOpenCodeClaim(claim, path44);
27489
27524
  throw error51;
27490
27525
  }
27491
27526
  if (claim !== void 0) rmSync3(claim, { force: true });
@@ -27525,10 +27560,10 @@ function inspectHookStatus(scope, deps = {}) {
27525
27560
  } catch {
27526
27561
  expectedLaunch = void 0;
27527
27562
  }
27528
- const inspectSettingsTarget = (path43) => {
27529
- const status2 = readHookCompatibilityStatus(readSettings(path43));
27563
+ const inspectSettingsTarget = (path44) => {
27564
+ const status2 = readHookCompatibilityStatus(readSettings(path44));
27530
27565
  const launchAvailability = inspectHookLaunchAvailability(status2.command);
27531
- const preflight = readSettingsForInstall(path43);
27566
+ const preflight = readSettingsForInstall(path44);
27532
27567
  if (!preflight.ok) {
27533
27568
  return { ...status2, installSafe: false, launchAvailability };
27534
27569
  }
@@ -27778,12 +27813,12 @@ async function hook(argv2, deps = {}) {
27778
27813
  }
27779
27814
  let changed = false;
27780
27815
  const notes = [];
27781
- for (const path43 of [targets.claudeSettings, targets.codexHooks]) {
27782
- const settings = readSettings(path43);
27816
+ for (const path44 of [targets.claudeSettings, targets.codexHooks]) {
27817
+ const settings = readSettings(path44);
27783
27818
  const [withoutSessionStart, sessionStartChanged] = turnEndSync ? [settings, false] : computeHookUninstall(settings);
27784
27819
  const [updated, stopChanged] = computeTurnEndHookUninstall(withoutSessionStart);
27785
27820
  if (sessionStartChanged || stopChanged) {
27786
- writeSettings(path43, updated);
27821
+ writeSettings(path44, updated);
27787
27822
  changed = true;
27788
27823
  }
27789
27824
  }
@@ -27804,12 +27839,12 @@ async function hook(argv2, deps = {}) {
27804
27839
  );
27805
27840
  return;
27806
27841
  }
27807
- for (const path43 of [targets.opencodePlugin, targets.legacyOpencodePlugin]) {
27808
- const openCodeStatus = readOpenCodeHookStatus(path43);
27842
+ for (const path44 of [targets.opencodePlugin, targets.legacyOpencodePlugin]) {
27843
+ const openCodeStatus = readOpenCodeHookStatus(path44);
27809
27844
  if (openCodeStatus.installed) {
27810
- changed = removeOwnedOpenCodePlugin(path43) || changed;
27845
+ changed = removeOwnedOpenCodePlugin(path44) || changed;
27811
27846
  } else if (openCodeStatus.compatibility.state === "unmanaged") {
27812
- notes.push(`preserved unmanaged OpenCode plugin: ${collapseHomeDirectory(path43)}`);
27847
+ notes.push(`preserved unmanaged OpenCode plugin: ${collapseHomeDirectory(path44)}`);
27813
27848
  }
27814
27849
  }
27815
27850
  stdout(
@@ -36267,9 +36302,9 @@ var init_splice_buffer = __esm({
36267
36302
  * Any removed items.
36268
36303
  */
36269
36304
  splice(start, deleteCount, items) {
36270
- const count2 = deleteCount || 0;
36305
+ const count3 = deleteCount || 0;
36271
36306
  this.setCursor(Math.trunc(start));
36272
- const removed = this.right.splice(this.right.length - count2, Number.POSITIVE_INFINITY);
36307
+ const removed = this.right.splice(this.right.length - count3, Number.POSITIVE_INFINITY);
36273
36308
  if (items) chunkedPush(this.left, items);
36274
36309
  return removed.reverse();
36275
36310
  }
@@ -41500,13 +41535,13 @@ function ccount(value, character) {
41500
41535
  if (typeof character !== "string") {
41501
41536
  throw new TypeError("Expected character");
41502
41537
  }
41503
- let count2 = 0;
41538
+ let count3 = 0;
41504
41539
  let index2 = source.indexOf(character);
41505
41540
  while (index2 !== -1) {
41506
- count2++;
41541
+ count3++;
41507
41542
  index2 = source.indexOf(character, index2 + character.length);
41508
41543
  }
41509
- return count2;
41544
+ return count3;
41510
41545
  }
41511
41546
  var init_ccount = __esm({
41512
41547
  "../../node_modules/ccount/index.js"() {
@@ -41930,7 +41965,7 @@ function transformGfmAutolinkLiterals(tree) {
41930
41965
  { ignore: ["link", "linkReference"] }
41931
41966
  );
41932
41967
  }
41933
- function findUrl(_2, protocol, domain3, path43, match) {
41968
+ function findUrl(_2, protocol, domain3, path44, match) {
41934
41969
  let prefix = "";
41935
41970
  if (!previous2(match)) {
41936
41971
  return false;
@@ -41943,7 +41978,7 @@ function findUrl(_2, protocol, domain3, path43, match) {
41943
41978
  if (!isCorrectDomain(domain3)) {
41944
41979
  return false;
41945
41980
  }
41946
- const parts = splitUrl(domain3 + path43);
41981
+ const parts = splitUrl(domain3 + path44);
41947
41982
  if (!parts[0]) return false;
41948
41983
  const result3 = {
41949
41984
  type: "link",
@@ -42558,9 +42593,9 @@ var require_react_production = __commonJS({
42558
42593
  }
42559
42594
  function mapChildren(children, func, context) {
42560
42595
  if (null == children) return children;
42561
- var result3 = [], count2 = 0;
42596
+ var result3 = [], count3 = 0;
42562
42597
  mapIntoArray(children, result3, "", "", function(child) {
42563
- return func.call(context, child, count2++);
42598
+ return func.call(context, child, count3++);
42564
42599
  });
42565
42600
  return result3;
42566
42601
  }
@@ -43141,9 +43176,9 @@ var require_react_development = __commonJS({
43141
43176
  }
43142
43177
  function mapChildren(children, func, context) {
43143
43178
  if (null == children) return children;
43144
- var result3 = [], count2 = 0;
43179
+ var result3 = [], count3 = 0;
43145
43180
  mapIntoArray(children, result3, "", "", function(child) {
43146
- return func.call(context, child, count2++);
43181
+ return func.call(context, child, count3++);
43147
43182
  });
43148
43183
  return result3;
43149
43184
  }
@@ -71376,8 +71411,8 @@ function versionHeaders(version3) {
71376
71411
  function isCanonicalBundleId(value) {
71377
71412
  return BUNDLE_ID_RE.test(value);
71378
71413
  }
71379
- function literalSpecificity(path43) {
71380
- return path43.split("/").filter((segment) => segment !== "" && !segment.startsWith("{")).length;
71414
+ function literalSpecificity(path44) {
71415
+ return path44.split("/").filter((segment) => segment !== "" && !segment.startsWith("{")).length;
71381
71416
  }
71382
71417
  function matchTemplate(template, pathname) {
71383
71418
  const templateSegments = template.split("/");
@@ -71741,7 +71776,7 @@ function buildRouter(options) {
71741
71776
  const limit = Number.isFinite(parsedLimit) && parsedLimit > 0 ? parsedLimit : DEFAULT_LIST_LIMIT;
71742
71777
  const cursor = searchParams.get("cursor") ?? void 0;
71743
71778
  const heads = await queryHeads(backend, { prefix, type, tags });
71744
- const count2 = heads.length;
71779
+ const count3 = heads.length;
71745
71780
  let page = heads;
71746
71781
  if (cursor) {
71747
71782
  const idx = page.findIndex((r2) => r2.id === cursor);
@@ -71758,7 +71793,7 @@ function buildRouter(options) {
71758
71793
  }
71759
71794
  return { id, version: version3, ...captureRemoteFrontmatter(projected) };
71760
71795
  });
71761
- return jsonResponse(200, { count: count2, docs, next_cursor: nextCursor });
71796
+ return jsonResponse(200, { count: count3, docs, next_cursor: nextCursor });
71762
71797
  }
71763
71798
  async function listHeads(backend) {
71764
71799
  const ids = await backend.list();
@@ -71916,7 +71951,7 @@ function buildRouter(options) {
71916
71951
  const limit = Number.isFinite(parsedLimit) && parsedLimit > 0 ? parsedLimit : DEFAULT_LIST_LIMIT;
71917
71952
  const cursor = searchParams.get("cursor") ?? void 0;
71918
71953
  const keys = await backend.listBlobs(prefix);
71919
- const count2 = keys.length;
71954
+ const count3 = keys.length;
71920
71955
  let page = keys;
71921
71956
  if (cursor) {
71922
71957
  const idx = page.findIndex((k2) => k2 === cursor);
@@ -71924,7 +71959,7 @@ function buildRouter(options) {
71924
71959
  }
71925
71960
  const limited = page.slice(0, limit);
71926
71961
  const nextCursor = page.length > limit ? limited[limited.length - 1] ?? null : null;
71927
- return jsonResponse(200, { count: count2, keys: limited, next_cursor: nextCursor });
71962
+ return jsonResponse(200, { count: count3, keys: limited, next_cursor: nextCursor });
71928
71963
  }
71929
71964
  function handleCapabilities() {
71930
71965
  const caps = options.capabilities;
@@ -75452,19 +75487,142 @@ var init_assets2 = __esm({
75452
75487
  }
75453
75488
  });
75454
75489
 
75455
- // ../cli/src/catalog.ts
75456
- import { randomUUID as randomUUID4 } from "node:crypto";
75457
- import { open as open2, readFile as readFile3, stat as stat3, unlink as unlink5 } from "node:fs/promises";
75490
+ // ../cli/src/bundle-home.ts
75491
+ import { realpath as realpath3, stat as stat3 } from "node:fs/promises";
75458
75492
  import { homedir as homedir13 } from "node:os";
75459
75493
  import path34 from "node:path";
75494
+ function gitText(dir, args) {
75495
+ try {
75496
+ const result3 = runGit(dir, args);
75497
+ const text4 = result3.stdout.trim();
75498
+ return result3.status === 0 && text4.length > 0 ? text4 : null;
75499
+ } catch {
75500
+ return null;
75501
+ }
75502
+ }
75503
+ async function canonical(dir) {
75504
+ try {
75505
+ return await realpath3(dir);
75506
+ } catch {
75507
+ return null;
75508
+ }
75509
+ }
75510
+ async function gitBoardAt(canonicalRoot) {
75511
+ const topText = gitText(canonicalRoot, ["rev-parse", "--show-toplevel"]);
75512
+ if (topText === null) return null;
75513
+ const top = await canonical(topText);
75514
+ if (top === null) return null;
75515
+ if (top === canonicalRoot) {
75516
+ const branch2 = gitText(top, ["symbolic-ref", "-q", "--short", "HEAD"]);
75517
+ if (branch2 !== BOARD_BRANCH) return null;
75518
+ const upstream2 = gitText(top, ["for-each-ref", "--format=%(upstream:short)", `refs/heads/${branch2}`]) ?? (gitText(top, ["rev-parse", "--verify", "--quiet", `refs/remotes/${BOARD_REF}`]) === null ? null : BOARD_REF);
75519
+ return { channel: "branch", branch: branch2, upstream: upstream2, shared: upstream2 !== null, top, prefix: "" };
75520
+ }
75521
+ let committed;
75522
+ try {
75523
+ committed = committedBundleAtHead(top);
75524
+ } catch {
75525
+ return null;
75526
+ }
75527
+ if (!committed || path34.join(top, committed.bundleDir) !== canonicalRoot) return null;
75528
+ if (hasWorktreeSignature(canonicalRoot)) return null;
75529
+ const resolved = resolveInTreeUpstream(top);
75530
+ const upstream = resolved.state === "ok" ? resolved.config.ref : null;
75531
+ const branch = resolved.state === "ok" ? resolved.config.branch : gitText(top, ["symbolic-ref", "-q", "--short", "HEAD"]);
75532
+ return { channel: "in-tree", branch, upstream, shared: upstream !== null, top, prefix: committed.bundleDir };
75533
+ }
75534
+ async function bundleHomeAt(canonicalRoot, options = {}) {
75535
+ const binding = await bindingForPath(options.home ?? homedir13(), canonicalRoot).catch(() => null);
75536
+ if (binding) return { home: "hosted", binding };
75537
+ const board = await gitBoardAt(canonicalRoot).catch(() => null);
75538
+ if (board) return { home: "git", board };
75539
+ return { home: "local" };
75540
+ }
75541
+ function homeDetail(facts) {
75542
+ if (facts.home === "hosted") {
75543
+ const { binding } = facts;
75544
+ return { hosted: { host: binding.origin, bundle_id: binding.bundle_id, workspace: binding.workspace, principal: binding.principal_id } };
75545
+ }
75546
+ if (facts.home === "git") {
75547
+ const { board } = facts;
75548
+ return { board: { channel: board.channel, branch: board.branch, upstream: board.upstream, shared: board.shared } };
75549
+ }
75550
+ return {};
75551
+ }
75552
+ function count2(dir, args) {
75553
+ const text4 = gitText(dir, args);
75554
+ if (text4 === null) return null;
75555
+ const n = Number.parseInt(text4, 10);
75556
+ return Number.isFinite(n) ? n : null;
75557
+ }
75558
+ async function lastFetch(top) {
75559
+ const own5 = gitText(top, ["rev-parse", "--path-format=absolute", "--git-path", "FETCH_HEAD"]);
75560
+ const common = gitText(top, ["rev-parse", "--path-format=absolute", "--git-common-dir"]);
75561
+ let newest = null;
75562
+ for (const file2 of [own5, common === null ? null : path34.join(common, "FETCH_HEAD")]) {
75563
+ if (file2 === null) continue;
75564
+ try {
75565
+ const { mtime } = await stat3(file2);
75566
+ if (newest === null || mtime > newest) newest = mtime;
75567
+ } catch {
75568
+ }
75569
+ }
75570
+ return newest === null ? null : newest.toISOString();
75571
+ }
75572
+ async function gitBoardSyncBlock(board) {
75573
+ const block = {
75574
+ channel: board.channel,
75575
+ branch: board.branch,
75576
+ upstream: board.upstream
75577
+ };
75578
+ let ahead = null;
75579
+ let behind = null;
75580
+ const prefix = board.prefix;
75581
+ if (board.upstream !== null) {
75582
+ if (board.channel === "branch") {
75583
+ ahead = count2(board.top, ["rev-list", "--count", `${board.upstream}..HEAD`]);
75584
+ behind = count2(board.top, ["rev-list", "--count", `HEAD..${board.upstream}`]);
75585
+ } else if (prefix !== "" && inTreeUpstreamSha(board.top, board.upstream) !== null) {
75586
+ ahead = inTreeUnpushedCount(board.top, board.upstream, prefix);
75587
+ behind = inTreeBehindCount(board.top, board.upstream, prefix);
75588
+ }
75589
+ }
75590
+ let uncommitted;
75591
+ try {
75592
+ uncommitted = prefix === "" ? countUncommitted(board.top) : countUncommitted(board.top, prefix);
75593
+ } catch {
75594
+ uncommitted = null;
75595
+ }
75596
+ block.state = board.upstream === null ? "not_shared" : (ahead ?? 0) > 0 && (behind ?? 0) > 0 ? "diverged" : (ahead ?? 0) > 0 || (uncommitted ?? 0) > 0 ? "unsent_changes" : (behind ?? 0) > 0 ? "behind" : "clean";
75597
+ block.ahead = ahead;
75598
+ block.behind = behind;
75599
+ block.uncommitted = uncommitted;
75600
+ block.last_fetch = await lastFetch(board.top);
75601
+ return block;
75602
+ }
75603
+ var init_bundle_home = __esm({
75604
+ "../cli/src/bundle-home.ts"() {
75605
+ "use strict";
75606
+ init_define_SUPERBEE_BUILD_IDENTITY();
75607
+ init_define_SUPERBEE_UPDATE_POLICY();
75608
+ init_src2();
75609
+ init_binding();
75610
+ }
75611
+ });
75612
+
75613
+ // ../cli/src/catalog.ts
75614
+ import { randomUUID as randomUUID4 } from "node:crypto";
75615
+ import { open as open2, readFile as readFile3, stat as stat4, unlink as unlink5 } from "node:fs/promises";
75616
+ import { homedir as homedir14 } from "node:os";
75617
+ import path35 from "node:path";
75460
75618
  function catalogDir(home2) {
75461
75619
  return credentialsDir(home2);
75462
75620
  }
75463
- function catalogPath(home2 = homedir13()) {
75464
- return path34.join(catalogDir(home2), CATALOG_FILE_NAME);
75621
+ function catalogPath(home2 = homedir14()) {
75622
+ return path35.join(catalogDir(home2), CATALOG_FILE_NAME);
75465
75623
  }
75466
- function catalogLockPath(home2 = homedir13()) {
75467
- return path34.join(catalogDir(home2), CATALOG_LOCK_FILE_NAME);
75624
+ function catalogLockPath(home2 = homedir14()) {
75625
+ return path35.join(catalogDir(home2), CATALOG_LOCK_FILE_NAME);
75468
75626
  }
75469
75627
  function isObject2(value) {
75470
75628
  return value !== null && typeof value === "object" && !Array.isArray(value);
@@ -75504,7 +75662,7 @@ function validateEntry(value, file2, index2) {
75504
75662
  if (value.locator.kind !== "local-path") {
75505
75663
  throw invalidCatalog(file2, `entries[${index2}].locator.kind must be "local-path"`);
75506
75664
  }
75507
- if (typeof value.locator.path !== "string" || !path34.isAbsolute(value.locator.path) || path34.normalize(value.locator.path) !== value.locator.path) {
75665
+ if (typeof value.locator.path !== "string" || !path35.isAbsolute(value.locator.path) || path35.normalize(value.locator.path) !== value.locator.path) {
75508
75666
  throw invalidCatalog(file2, `entries[${index2}].locator.path must be a normalized absolute path`);
75509
75667
  }
75510
75668
  return {
@@ -75548,11 +75706,11 @@ function parseCatalog(raw, file2) {
75548
75706
  }
75549
75707
  return { schema_version: CATALOG_SCHEMA_VERSION, entries };
75550
75708
  }
75551
- async function loadCatalog(home2 = homedir13(), signal) {
75709
+ async function loadCatalog(home2 = homedir14(), signal) {
75552
75710
  const file2 = catalogPath(home2);
75553
75711
  let raw;
75554
75712
  try {
75555
- if (!(await stat3(file2)).isFile()) {
75713
+ if (!(await stat4(file2)).isFile()) {
75556
75714
  throw new CliError("RUNTIME", `workspace catalog ${file2} is not a regular file`);
75557
75715
  }
75558
75716
  raw = await readUserStateFile(home2, file2, 4 * 1024 * 1024, signal);
@@ -75585,7 +75743,7 @@ function readLockMetadata(raw) {
75585
75743
  }
75586
75744
  }
75587
75745
  async function acquireCatalogLock(options) {
75588
- const home2 = options.home ?? homedir13();
75746
+ const home2 = options.home ?? homedir14();
75589
75747
  const dir = catalogDir(home2);
75590
75748
  const lockPath = catalogLockPath(home2);
75591
75749
  const now = options.now ?? Date.now;
@@ -75627,7 +75785,7 @@ async function acquireCatalogLock(options) {
75627
75785
  let malformedAgeMs = null;
75628
75786
  try {
75629
75787
  owner = readLockMetadata(await readFile3(lockPath, "utf8"));
75630
- if (!owner) malformedAgeMs = now() - (await stat3(lockPath)).mtimeMs;
75788
+ if (!owner) malformedAgeMs = now() - (await stat4(lockPath)).mtimeMs;
75631
75789
  } catch (err) {
75632
75790
  if (err.code === "ENOENT") continue;
75633
75791
  }
@@ -75653,7 +75811,7 @@ async function acquireCatalogLock(options) {
75653
75811
  }
75654
75812
  }
75655
75813
  async function mutateCatalog(decide, options) {
75656
- const home2 = options.home ?? homedir13();
75814
+ const home2 = options.home ?? homedir14();
75657
75815
  const release2 = await acquireCatalogLock({ ...options, home: home2 });
75658
75816
  try {
75659
75817
  const current = await loadCatalog(home2);
@@ -75681,7 +75839,7 @@ function generatedId(options, existing) {
75681
75839
  }
75682
75840
  async function addCatalogEntry(label, canonicalPath, options = {}) {
75683
75841
  assertCatalogLabel(label);
75684
- if (!path34.isAbsolute(canonicalPath)) throw new CliError("USAGE", "workspace catalog paths must be absolute");
75842
+ if (!path35.isAbsolute(canonicalPath)) throw new CliError("USAGE", "workspace catalog paths must be absolute");
75685
75843
  const result3 = await mutateCatalog(async (current) => {
75686
75844
  const target2 = await resolveLocalBundleTarget(canonicalPath);
75687
75845
  if (!samePhysicalPath3(target2.canonicalRoot, canonicalPath)) {
@@ -75727,10 +75885,17 @@ async function entryAvailable(entry) {
75727
75885
  return false;
75728
75886
  }
75729
75887
  }
75730
- async function listCatalogEntries(home2 = homedir13()) {
75888
+ async function entryView(entry, available, home2) {
75889
+ if (!available) return { ...entry, available, home: "local" };
75890
+ const facts = await bundleHomeAt(entry.locator.path, { home: home2 });
75891
+ if (facts.home !== "hosted") return { ...entry, available, home: facts.home };
75892
+ const { binding } = facts;
75893
+ return { ...entry, available, home: "hosted", hosted: { host: binding.origin, bundle_id: binding.bundle_id, checked_out_at: binding.created_at } };
75894
+ }
75895
+ async function listCatalogEntries(home2 = homedir14()) {
75731
75896
  const catalog2 = await loadCatalog(home2);
75732
75897
  return Promise.all(
75733
- [...catalog2.entries].sort((a, b) => a.label.localeCompare(b.label)).map(async (entry) => ({ ...entry, available: await entryAvailable(entry) }))
75898
+ [...catalog2.entries].sort((a, b) => a.label.localeCompare(b.label)).map(async (entry) => entryView(entry, await entryAvailable(entry), home2))
75734
75899
  );
75735
75900
  }
75736
75901
  function classifySelector(selector2) {
@@ -75743,7 +75908,7 @@ function classifySelector(selector2) {
75743
75908
  assertCatalogLabel(selector2);
75744
75909
  return "label";
75745
75910
  }
75746
- async function resolveCatalogEntry(selector2, home2 = homedir13()) {
75911
+ async function resolveCatalogEntry(selector2, home2 = homedir14()) {
75747
75912
  const catalog2 = await loadCatalog(home2);
75748
75913
  const kind2 = classifySelector(selector2);
75749
75914
  const entry = catalog2.entries.find((item) => item[kind2] === selector2);
@@ -75758,7 +75923,7 @@ async function resolveCatalogEntry(selector2, home2 = homedir13()) {
75758
75923
  help: `restore the bundle at ${entry.locator.path}, then retry`
75759
75924
  });
75760
75925
  }
75761
- return { ...entry, available: true };
75926
+ return entryView(entry, true, home2);
75762
75927
  }
75763
75928
  var CATALOG_FILE_NAME, CATALOG_LOCK_FILE_NAME, CATALOG_SCHEMA_VERSION, LOCK_MODE, DEFAULT_LOCK_WAIT_MS, DEFAULT_LOCK_POLL_MS, STALE_LOCK_MIN_AGE_MS, LABEL_PATTERN, ID_PATTERN;
75764
75929
  var init_catalog2 = __esm({
@@ -75768,6 +75933,7 @@ var init_catalog2 = __esm({
75768
75933
  init_define_SUPERBEE_UPDATE_POLICY();
75769
75934
  init_runtime_context();
75770
75935
  init_bundle2();
75936
+ init_bundle_home();
75771
75937
  init_credentials();
75772
75938
  init_errors4();
75773
75939
  init_invocation();
@@ -75786,7 +75952,7 @@ var init_catalog2 = __esm({
75786
75952
  });
75787
75953
 
75788
75954
  // ../cli/src/ui/sharing.ts
75789
- import path35 from "node:path";
75955
+ import path36 from "node:path";
75790
75956
  import { realpathSync as realpathSync13, statSync as statSync8 } from "node:fs";
75791
75957
  function realOr(p2) {
75792
75958
  try {
@@ -75802,8 +75968,8 @@ function samePhysicalPath4(left, right) {
75802
75968
  if (a2.dev === b2.dev && a2.ino === b2.ino) return true;
75803
75969
  } catch {
75804
75970
  }
75805
- const a = path35.resolve(realOr(left));
75806
- const b = path35.resolve(realOr(right));
75971
+ const a = path36.resolve(realOr(left));
75972
+ const b = path36.resolve(realOr(right));
75807
75973
  return currentHost().sameResolvedPath(a, b);
75808
75974
  }
75809
75975
  function humanizeRemote(url2) {
@@ -75836,13 +76002,13 @@ function classifySharing(bundleRoot, now = () => /* @__PURE__ */ new Date()) {
75836
76002
  const asOf = now().toISOString();
75837
76003
  try {
75838
76004
  const root = realOr(bundleRoot);
75839
- const repo = probeRepoTopLevel(path35.dirname(root));
76005
+ const repo = probeRepoTopLevel(path36.dirname(root));
75840
76006
  if (repo.kind === "not_repo") return { kind: "private", as_of: asOf };
75841
76007
  if (repo.kind === "unavailable") return { kind: "unavailable", reason: repo.reason, as_of: asOf };
75842
76008
  const top = repo.top;
75843
76009
  const committed = committedBundleAtHead(top);
75844
76010
  const bundleDir = committed?.bundleDir ?? bundleDirNameForProject(top);
75845
- if (!samePhysicalPath4(path35.join(top, bundleDir), root)) return { kind: "unscoped", as_of: asOf };
76011
+ if (!samePhysicalPath4(path36.join(top, bundleDir), root)) return { kind: "unscoped", as_of: asOf };
75846
76012
  const evidence = localEvidence(top, committed !== null);
75847
76013
  const branchMode = hasWorktreeSignature(root) && worktreeRootResolvesForOwner2(root, top) || !evidence.tracked && localBranchExists(top, BOARD_BRANCH);
75848
76014
  if (branchMode) {
@@ -75928,7 +76094,7 @@ var init_sharing = __esm({
75928
76094
 
75929
76095
  // ../cli/src/ui/view-authorizations.ts
75930
76096
  import { createHash as createHash11 } from "node:crypto";
75931
- import { homedir as homedir14 } from "node:os";
76097
+ import { homedir as homedir15 } from "node:os";
75932
76098
  import { join as join12 } from "node:path";
75933
76099
  function stableRecord(bundle, subject) {
75934
76100
  return {
@@ -75975,9 +76141,9 @@ function assertMigratableViewAuthorization(name, raw) {
75975
76141
  if (!hasExactKeys3(subject, ["registryId", "contentVersion", "contentType", "capability", "execution", "policyVersion"]) || typeof subject.registryId !== "string" || subject.registryId.length === 0 || typeof subject.contentVersion !== "string" || subject.contentVersion.length === 0 || subject.contentType !== "text/html; charset=utf-8" || !["none", "bundle-read", "bundle-propose"].includes(String(subject.capability)) || subject.execution !== "active" || subject.policyVersion !== "active-view-v1") {
75976
76142
  throw new Error("legacy View authorization has an unsupported subject");
75977
76143
  }
75978
- const canonical = JSON.stringify(value);
75979
- if (raw !== `${canonical}
75980
- ` || name !== `${createHash11("sha256").update(canonical).digest("hex")}.json`) {
76144
+ const canonical2 = JSON.stringify(value);
76145
+ if (raw !== `${canonical2}
76146
+ ` || name !== `${createHash11("sha256").update(canonical2).digest("hex")}.json`) {
75981
76147
  throw new Error("legacy View authorization does not match its immutable identity");
75982
76148
  }
75983
76149
  }
@@ -76007,7 +76173,7 @@ var init_view_authorizations = __esm({
76007
76173
  if (subject.sourceKind !== "registered") return false;
76008
76174
  const expected = serialized(this.bundleIdentity, subject);
76009
76175
  try {
76010
- const selectedHome = this.home ?? homedir14();
76176
+ const selectedHome = this.home ?? homedir15();
76011
76177
  const raw = await readUserStateFile(
76012
76178
  selectedHome,
76013
76179
  join12(credentialsDir(selectedHome), STORE_DIR, fileName(this.bundleIdentity, subject)),
@@ -76024,7 +76190,7 @@ var init_view_authorizations = __esm({
76024
76190
  throw new Error("transient View approvals are process-local and cannot be persisted");
76025
76191
  }
76026
76192
  await writeUserStateFileAtomic0600(
76027
- this.home ?? homedir14(),
76193
+ this.home ?? homedir15(),
76028
76194
  join12(credentialsDir(this.home), STORE_DIR),
76029
76195
  fileName(this.bundleIdentity, subject),
76030
76196
  `${serialized(this.bundleIdentity, subject)}
@@ -76072,18 +76238,18 @@ var init_server2 = __esm({
76072
76238
 
76073
76239
  // ../cli/src/ui/url-file.ts
76074
76240
  import { unlink as unlink6 } from "node:fs/promises";
76075
- import { homedir as homedir15 } from "node:os";
76241
+ import { homedir as homedir16 } from "node:os";
76076
76242
  import { join as join13 } from "node:path";
76077
- function uiUrlFilePath(home2 = homedir15()) {
76243
+ function uiUrlFilePath(home2 = homedir16()) {
76078
76244
  return join13(credentialsDir(home2), UI_URL_FILE_NAME);
76079
76245
  }
76080
- async function writeUiUrlFile(url2, home2 = homedir15()) {
76246
+ async function writeUiUrlFile(url2, home2 = homedir16()) {
76081
76247
  try {
76082
76248
  await writeUserStateFileAtomic0600(home2, credentialsDir(home2), UI_URL_FILE_NAME, url2 + "\n");
76083
76249
  } catch {
76084
76250
  }
76085
76251
  }
76086
- async function clearUiUrlFile(url2, home2 = homedir15()) {
76252
+ async function clearUiUrlFile(url2, home2 = homedir16()) {
76087
76253
  try {
76088
76254
  const current = (await readUserStateFile(home2, uiUrlFilePath(home2), 16 * 1024)).trim();
76089
76255
  if (current === url2.trim()) await unlink6(uiUrlFilePath(home2));
@@ -76104,15 +76270,15 @@ var init_url_file = __esm({
76104
76270
 
76105
76271
  // ../cli/src/ui/managed-authority.ts
76106
76272
  import { createHash as createHash12, randomBytes as randomBytes5, randomUUID as randomUUID5 } from "node:crypto";
76107
- import { readdir as readdir2, realpath as realpath3, stat as stat4, unlink as unlink7 } from "node:fs/promises";
76108
- import { homedir as homedir16 } from "node:os";
76109
- import path36 from "node:path";
76273
+ import { readdir as readdir2, realpath as realpath4, stat as stat5, unlink as unlink7 } from "node:fs/promises";
76274
+ import { homedir as homedir17 } from "node:os";
76275
+ import path37 from "node:path";
76110
76276
  async function captureManagedUiLaunchIdentity(authority) {
76111
- const canonicalRoot = await realpath3(authority.launch_root);
76277
+ const canonicalRoot = await realpath4(authority.launch_root);
76112
76278
  if (canonicalRoot !== authority.bundle_root) {
76113
76279
  throw new CliError("CONFLICT", "managed UI launch route changed after controller selection");
76114
76280
  }
76115
- const metadata = await stat4(canonicalRoot, { bigint: true });
76281
+ const metadata = await stat5(canonicalRoot, { bigint: true });
76116
76282
  if (!metadata.isDirectory()) throw new CliError("CONFLICT", "managed UI launch route is no longer a directory");
76117
76283
  return { canonical_root: canonicalRoot, dev: metadata.dev.toString(), ino: metadata.ino.toString() };
76118
76284
  }
@@ -76134,8 +76300,8 @@ function managedUiAuthority(bundleRoot, actor, launchRoot = bundleRoot) {
76134
76300
  function validateAuthority(value) {
76135
76301
  if (!object(value) || !exactKeys3(value, ["key", "mode", "bundle_root", "launch_root", "actor", "protocol"])) return null;
76136
76302
  if (!boundedString2(value.key, 64) || !/^[0-9a-f]{64}$/u.test(value.key)) return null;
76137
- if (value.mode !== "dir" || !boundedString2(value.bundle_root) || !path36.isAbsolute(value.bundle_root)) return null;
76138
- if (!boundedString2(value.launch_root) || !path36.isAbsolute(value.launch_root)) return null;
76303
+ if (value.mode !== "dir" || !boundedString2(value.bundle_root) || !path37.isAbsolute(value.bundle_root)) return null;
76304
+ if (!boundedString2(value.launch_root) || !path37.isAbsolute(value.launch_root)) return null;
76139
76305
  if (!(value.actor === null || boundedString2(value.actor, 1024))) return null;
76140
76306
  if (typeof value.protocol !== "number" || !Number.isSafeInteger(value.protocol) || value.protocol < 1) return null;
76141
76307
  const expected = managedUiAuthority(value.bundle_root, value.actor ?? void 0, value.launch_root);
@@ -76171,8 +76337,8 @@ function parseManagedUiRecord(raw) {
76171
76337
  }
76172
76338
  return value;
76173
76339
  }
76174
- function managedUiRecordPath(authority, home2 = homedir16()) {
76175
- return path36.join(userStateDir(home2), `${RECORD_PREFIX}${authority.key}${RECORD_SUFFIX}`);
76340
+ function managedUiRecordPath(authority, home2 = homedir17()) {
76341
+ return path37.join(userStateDir(home2), `${RECORD_PREFIX}${authority.key}${RECORD_SUFFIX}`);
76176
76342
  }
76177
76343
  function recordName(authority) {
76178
76344
  return `${RECORD_PREFIX}${authority.key}${RECORD_SUFFIX}`;
@@ -76459,7 +76625,7 @@ async function recoverOrReuse(current, desiredAuthority, requestedPort, now, fet
76459
76625
  return record5;
76460
76626
  }
76461
76627
  async function startOrReuseManagedUi(authority, documentId2, requestedPort, options = {}) {
76462
- const home2 = options.home ?? homedir16();
76628
+ const home2 = options.home ?? homedir17();
76463
76629
  const now = options.now ?? Date.now;
76464
76630
  const fetchImpl = options.fetch ?? fetch;
76465
76631
  const spawnWorker = options.spawnWorker ?? defaultSpawnWorker;
@@ -76506,13 +76672,13 @@ async function startOrReuseManagedUi(authority, documentId2, requestedPort, opti
76506
76672
  });
76507
76673
  }
76508
76674
  async function listManagedUiStatus(bundleRoot, options = {}) {
76509
- const home2 = options.home ?? homedir16();
76675
+ const home2 = options.home ?? homedir17();
76510
76676
  const fetchImpl = options.fetch ?? fetch;
76511
76677
  const root = await ensureUserStateRoot(home2);
76512
76678
  const names = await readdir2(root);
76513
76679
  const statuses = [];
76514
76680
  for (const name of names.filter((entry) => entry.startsWith(RECORD_PREFIX) && entry.endsWith(RECORD_SUFFIX)).sort()) {
76515
- const raw = await readUserStateFile(home2, path36.join(root, name), RECORD_MAX_BYTES);
76681
+ const raw = await readUserStateFile(home2, path37.join(root, name), RECORD_MAX_BYTES);
76516
76682
  const record5 = parseManagedUiRecord(raw);
76517
76683
  if (record5.authority.bundle_root !== bundleRoot) continue;
76518
76684
  const result3 = await probeRecord(record5, fetchImpl);
@@ -76525,7 +76691,7 @@ async function listManagedUiStatus(bundleRoot, options = {}) {
76525
76691
  return statuses;
76526
76692
  }
76527
76693
  async function stopManagedUi(authority, options = {}) {
76528
- const home2 = options.home ?? homedir16();
76694
+ const home2 = options.home ?? homedir17();
76529
76695
  const fetchImpl = options.fetch ?? fetch;
76530
76696
  const sleep = options.sleep ?? ((ms) => new Promise((resolve2) => setTimeout(resolve2, ms)));
76531
76697
  const withLock = options.withLock ?? ((target2, fn) => withCliFilesystemMutationLock(target2, fn, { waitMs: LIFECYCLE_LOCK_WAIT_MS }));
@@ -77331,7 +77497,7 @@ Options:
77331
77497
  // ../cli/src/commands/pull.ts
77332
77498
  import { parseArgs as parseArgs13 } from "node:util";
77333
77499
  import { promises as fs13 } from "node:fs";
77334
- import path37 from "node:path";
77500
+ import path38 from "node:path";
77335
77501
  function isDocRouteKey2(key) {
77336
77502
  return key.toLowerCase().endsWith(".md");
77337
77503
  }
@@ -77422,7 +77588,7 @@ async function pull2(argv2, deps = {}) {
77422
77588
  help: `${cliInvocation()} pull --doc-key ${commandToken(key)} --out <path>`
77423
77589
  });
77424
77590
  }
77425
- if (out !== "-") assertPathOutsidePrivateState(path37.resolve(out));
77591
+ if (out !== "-") assertPathOutsidePrivateState(path38.resolve(out));
77426
77592
  const bundle = await openBundle(values.dir, await resolveRemoteFlag(values.remote, values.dir));
77427
77593
  const mode = resolveMode(values);
77428
77594
  const streamMode = out === "-";
@@ -78703,15 +78869,15 @@ function distinctValues(instances, key) {
78703
78869
  return [...seen];
78704
78870
  }
78705
78871
  function inferKindCandidate(type, instances, stats = collectInstanceStats(instances)) {
78706
- const count2 = stats.count;
78872
+ const count3 = stats.count;
78707
78873
  const required2 = [];
78708
78874
  const optional2 = [];
78709
78875
  const values = {};
78710
78876
  for (const [key, present] of Object.entries(stats.keyPresence)) {
78711
78877
  if (EXCLUDED_FIELDS.has(key)) continue;
78712
- if (present === count2 && count2 > 0) {
78878
+ if (present === count3 && count3 > 0) {
78713
78879
  required2.push(key);
78714
- if (count2 >= ENUM_MIN_INSTANCES && everyValueScalarString(instances, key)) {
78880
+ if (count3 >= ENUM_MIN_INSTANCES && everyValueScalarString(instances, key)) {
78715
78881
  const distinct = distinctValues(instances, key);
78716
78882
  if (distinct.length >= ENUM_MIN_DISTINCT && distinct.length <= ENUM_MAX_DISTINCT) {
78717
78883
  values[key] = distinct.sort((a, b) => a.localeCompare(b));
@@ -78721,7 +78887,7 @@ function inferKindCandidate(type, instances, stats = collectInstanceStats(instan
78721
78887
  optional2.push(key);
78722
78888
  }
78723
78889
  }
78724
- const sections = Object.entries(stats.headingPresence).filter(([, present]) => present === count2 && count2 > 0).map(([heading]) => heading);
78890
+ const sections = Object.entries(stats.headingPresence).filter(([, present]) => present === count3 && count3 > 0).map(([heading]) => heading);
78725
78891
  const prefixes = /* @__PURE__ */ new Set();
78726
78892
  let allPrefixed = instances.length > 0;
78727
78893
  for (const doc2 of instances) {
@@ -78732,13 +78898,13 @@ function inferKindCandidate(type, instances, stats = collectInstanceStats(instan
78732
78898
  }
78733
78899
  prefixes.add(doc2.id.slice(0, slash));
78734
78900
  }
78735
- const path43 = allPrefixed && prefixes.size === 1 ? `${[...prefixes][0]}/` : void 0;
78901
+ const path44 = allPrefixed && prefixes.size === 1 ? `${[...prefixes][0]}/` : void 0;
78736
78902
  return {
78737
78903
  id: `conventions/${conventionSlugForType(type)}`,
78738
78904
  title: type,
78739
78905
  governs: type,
78740
- description: `Drafted by 'kind draft' from ${count2} existing instance${count2 === 1 ? "" : "s"}.`,
78741
- ...path43 === void 0 ? {} : { path: path43 },
78906
+ description: `Drafted by 'kind draft' from ${count3} existing instance${count3 === 1 ? "" : "s"}.`,
78907
+ ...path44 === void 0 ? {} : { path: path44 },
78742
78908
  fields: { required: required2, optional: optional2, values, terminal: {}, descriptions: {} },
78743
78909
  ...sections.length > 0 ? { sections } : {}
78744
78910
  };
@@ -79524,8 +79690,8 @@ function candidateDocFor(kind2, body) {
79524
79690
  if (kind2.sections !== void 0 && kind2.sections.length > 0) frontmatter.sections = kind2.sections;
79525
79691
  return { id: kind2.id, frontmatter, body };
79526
79692
  }
79527
- function inferredBody(type, count2) {
79528
- return `Drafted from ${count2} existing '${type}' instance${count2 === 1 ? "" : "s"} by \`superbee kind draft\`. It ratifies the shape those instances already share; evolve it with \`superbee kind field ${commandQuoted(type)} add <name>\`.
79693
+ function inferredBody(type, count3) {
79694
+ return `Drafted from ${count3} existing '${type}' instance${count3 === 1 ? "" : "s"} by \`superbee kind draft\`. It ratifies the shape those instances already share; evolve it with \`superbee kind field ${commandQuoted(type)} add <name>\`.
79529
79695
  `;
79530
79696
  }
79531
79697
  async function prepareDraftPlan(bundle, type) {
@@ -81170,7 +81336,8 @@ var init_status = __esm({
81170
81336
 
81171
81337
  // ../cli/src/commands/status.ts
81172
81338
  import { parseArgs as parseArgs23 } from "node:util";
81173
- import { homedir as homedir17 } from "node:os";
81339
+ import { homedir as homedir18 } from "node:os";
81340
+ import { realpath as realpath5 } from "node:fs/promises";
81174
81341
  function cap2(rows, limit) {
81175
81342
  const bounded2 = limit > 0 ? rows.slice(0, limit) : rows;
81176
81343
  return { shown: bounded2.length, total: rows.length, rows: bounded2 };
@@ -81252,7 +81419,7 @@ async function status(argv2, deps = {}) {
81252
81419
  limit = Number(raw);
81253
81420
  }
81254
81421
  const remote = await resolveRemoteFlag(values.remote, values.dir);
81255
- const home2 = deps.home ?? homedir17();
81422
+ const home2 = deps.home ?? homedir18();
81256
81423
  const hosted = remote ? null : await hostedCheckoutAt(values.dir, home2).catch(() => null);
81257
81424
  if (!remote && !hosted) await (deps.autoPull ?? maybeAutoPull2)(values.dir);
81258
81425
  const hostedReport = hosted ? await (await Promise.resolve().then(() => (init_status(), status_exports))).hostedStatus(hosted, home2, (deps.now ?? (() => /* @__PURE__ */ new Date()))()) : null;
@@ -81559,12 +81726,28 @@ async function status(argv2, deps = {}) {
81559
81726
  out.legacy_naming = legacy;
81560
81727
  }
81561
81728
  if (hostedReport) {
81562
- const record5 = { sync: hostedReport.sync, ...out };
81729
+ const record5 = { home: "hosted", sync: hostedReport.sync, ...out };
81563
81730
  if (hostedReport.help.length > 0) record5.help = hostedReport.help;
81564
81731
  stdout(render(record5, resolveMode(values)));
81565
81732
  return;
81566
81733
  }
81567
- stdout(render(out, resolveMode(values)));
81734
+ if (remote) {
81735
+ stdout(render(out, resolveMode(values)));
81736
+ return;
81737
+ }
81738
+ const facts = await bundleHomeAt(await realpath5(bundle.root), { home: home2 });
81739
+ if (facts.home === "git") {
81740
+ const block = await gitBoardSyncBlock(facts.board);
81741
+ const record5 = { home: "git", sync: block, ...out };
81742
+ if (block.state !== "clean") {
81743
+ record5.help = [
81744
+ values.dir === void 0 ? `${cliInvocation()} sync` : commandFragment`${cliInvocation()} sync --dir ${commandToken(values.dir)}`
81745
+ ];
81746
+ }
81747
+ stdout(render(record5, resolveMode(values)));
81748
+ return;
81749
+ }
81750
+ stdout(render({ home: "local", sync: "none (local only)", ...out }, resolveMode(values)));
81568
81751
  }
81569
81752
  var STATUS_USAGE, DEFAULT_LIMIT3, FRONTMATTER_VIOLATION_CODES;
81570
81753
  var init_status2 = __esm({
@@ -81586,6 +81769,8 @@ var init_status2 = __esm({
81586
81769
  init_legacy_page();
81587
81770
  init_invocation();
81588
81771
  init_bundle_name();
81772
+ init_bundle_home();
81773
+ init_command_text();
81589
81774
  STATUS_USAGE = `superbee status \u2014 read-only whole-bundle health report (bundle lint)
81590
81775
 
81591
81776
  Usage:
@@ -81703,8 +81888,20 @@ Category semantics (one line each):
81703
81888
  prefixes \u2014 those LOCATIONS remain recognized; relocation is a separate
81704
81889
  open decision. Omitted when the bundle carries none of the above.
81705
81890
 
81706
- In a hosted checkout (a folder made by 'checkout'), a 'sync' block leads the report, read from
81707
- local state only (no request to the host, and no automatic pull):
81891
+ The report leads with the bundle's 'home' (local, git or hosted) and a 'sync' block for it, read
81892
+ from local state only: no request, no fetch, and no automatic pull for a hosted checkout. A local
81893
+ bundle reports 'sync: none (local only)'.
81894
+
81895
+ For a Git board, the 'sync' block reads local Git (what the last fetch saw, never a new fetch):
81896
+ channel branch (the provisioned 'board' worktree) | in-tree (committed with the code)
81897
+ branch, upstream The checked-out branch and its tracking ref (null when there is none)
81898
+ state clean | unsent_changes | behind | diverged | not_shared (no upstream yet)
81899
+ ahead Board commits not yet pushed (null without an upstream)
81900
+ behind Upstream board commits not yet pulled, as of the last fetch
81901
+ uncommitted Changed files not yet committed to the board
81902
+ last_fetch When this clone last fetched (null when it never has)
81903
+
81904
+ In a hosted checkout (a folder made by 'checkout'), the 'sync' block reads:
81708
81905
  state clean | unsent_changes | needs_decision (a conflict or a held item) | busy
81709
81906
  (another command, such as a running sync, holds the checkout)
81710
81907
  unsent Documents with a change the next sync would send (edited, new or deleted
@@ -82264,8 +82461,8 @@ var init_parseUtil = __esm({
82264
82461
  init_errors5();
82265
82462
  init_en();
82266
82463
  makeIssue = (params) => {
82267
- const { data, path: path43, errorMaps, issueData } = params;
82268
- const fullPath = [...path43, ...issueData.path || []];
82464
+ const { data, path: path44, errorMaps, issueData } = params;
82465
+ const fullPath = [...path44, ...issueData.path || []];
82269
82466
  const fullIssue = {
82270
82467
  ...issueData,
82271
82468
  path: fullPath
@@ -82551,11 +82748,11 @@ var init_types = __esm({
82551
82748
  init_parseUtil();
82552
82749
  init_util();
82553
82750
  ParseInputLazyPath = class {
82554
- constructor(parent, value, path43, key) {
82751
+ constructor(parent, value, path44, key) {
82555
82752
  this._cachedPath = [];
82556
82753
  this.parent = parent;
82557
82754
  this.data = value;
82558
- this._path = path43;
82755
+ this._path = path44;
82559
82756
  this._key = key;
82560
82757
  }
82561
82758
  get path() {
@@ -86061,10 +86258,10 @@ function mergeDefs(...defs) {
86061
86258
  function cloneDef(schema) {
86062
86259
  return mergeDefs(schema._zod.def);
86063
86260
  }
86064
- function getElementAtPath(obj, path43) {
86065
- if (!path43)
86261
+ function getElementAtPath(obj, path44) {
86262
+ if (!path44)
86066
86263
  return obj;
86067
- return path43.reduce((acc, key) => acc?.[key], obj);
86264
+ return path44.reduce((acc, key) => acc?.[key], obj);
86068
86265
  }
86069
86266
  function promiseAllObject(promisesObj) {
86070
86267
  const keys = Object.keys(promisesObj);
@@ -86392,11 +86589,11 @@ function explicitlyAborted(x, startIndex = 0) {
86392
86589
  }
86393
86590
  return false;
86394
86591
  }
86395
- function prefixIssues(path43, issues) {
86592
+ function prefixIssues(path44, issues) {
86396
86593
  return issues.map((iss) => {
86397
86594
  var _a3;
86398
86595
  (_a3 = iss).path ?? (_a3.path = []);
86399
- iss.path.unshift(path43);
86596
+ iss.path.unshift(path44);
86400
86597
  return iss;
86401
86598
  });
86402
86599
  }
@@ -86615,16 +86812,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
86615
86812
  }
86616
86813
  function formatError(error51, mapper = (issue2) => issue2.message) {
86617
86814
  const fieldErrors = { _errors: [] };
86618
- const processError = (error52, path43 = []) => {
86815
+ const processError = (error52, path44 = []) => {
86619
86816
  for (const issue2 of error52.issues) {
86620
86817
  if (issue2.code === "invalid_union" && issue2.errors.length) {
86621
- issue2.errors.map((issues) => processError({ issues }, [...path43, ...issue2.path]));
86818
+ issue2.errors.map((issues) => processError({ issues }, [...path44, ...issue2.path]));
86622
86819
  } else if (issue2.code === "invalid_key") {
86623
- processError({ issues: issue2.issues }, [...path43, ...issue2.path]);
86820
+ processError({ issues: issue2.issues }, [...path44, ...issue2.path]);
86624
86821
  } else if (issue2.code === "invalid_element") {
86625
- processError({ issues: issue2.issues }, [...path43, ...issue2.path]);
86822
+ processError({ issues: issue2.issues }, [...path44, ...issue2.path]);
86626
86823
  } else {
86627
- const fullpath = [...path43, ...issue2.path];
86824
+ const fullpath = [...path44, ...issue2.path];
86628
86825
  if (fullpath.length === 0) {
86629
86826
  fieldErrors._errors.push(mapper(issue2));
86630
86827
  } else {
@@ -86651,17 +86848,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
86651
86848
  }
86652
86849
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
86653
86850
  const result3 = { errors: [] };
86654
- const processError = (error52, path43 = []) => {
86851
+ const processError = (error52, path44 = []) => {
86655
86852
  var _a3, _b;
86656
86853
  for (const issue2 of error52.issues) {
86657
86854
  if (issue2.code === "invalid_union" && issue2.errors.length) {
86658
- issue2.errors.map((issues) => processError({ issues }, [...path43, ...issue2.path]));
86855
+ issue2.errors.map((issues) => processError({ issues }, [...path44, ...issue2.path]));
86659
86856
  } else if (issue2.code === "invalid_key") {
86660
- processError({ issues: issue2.issues }, [...path43, ...issue2.path]);
86857
+ processError({ issues: issue2.issues }, [...path44, ...issue2.path]);
86661
86858
  } else if (issue2.code === "invalid_element") {
86662
- processError({ issues: issue2.issues }, [...path43, ...issue2.path]);
86859
+ processError({ issues: issue2.issues }, [...path44, ...issue2.path]);
86663
86860
  } else {
86664
- const fullpath = [...path43, ...issue2.path];
86861
+ const fullpath = [...path44, ...issue2.path];
86665
86862
  if (fullpath.length === 0) {
86666
86863
  result3.errors.push(mapper(issue2));
86667
86864
  continue;
@@ -86693,8 +86890,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
86693
86890
  }
86694
86891
  function toDotPath(_path) {
86695
86892
  const segs = [];
86696
- const path43 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
86697
- for (const seg of path43) {
86893
+ const path44 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
86894
+ for (const seg of path44) {
86698
86895
  if (typeof seg === "number")
86699
86896
  segs.push(`[${seg}]`);
86700
86897
  else if (typeof seg === "symbol")
@@ -89965,8 +90162,8 @@ var init_az = __esm({
89965
90162
  });
89966
90163
 
89967
90164
  // ../../node_modules/zod/v4/locales/be.js
89968
- function getBelarusianPlural(count2, one3, few, many) {
89969
- const absCount = Math.abs(count2);
90165
+ function getBelarusianPlural(count3, one3, few, many) {
90166
+ const absCount = Math.abs(count3);
89970
90167
  const lastDigit = absCount % 10;
89971
90168
  const lastTwoDigits = absCount % 100;
89972
90169
  if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
@@ -92180,8 +92377,8 @@ var init_hu = __esm({
92180
92377
  });
92181
92378
 
92182
92379
  // ../../node_modules/zod/v4/locales/hy.js
92183
- function getArmenianPlural(count2, one3, many) {
92184
- return Math.abs(count2) === 1 ? one3 : many;
92380
+ function getArmenianPlural(count3, one3, many) {
92381
+ return Math.abs(count3) === 1 ? one3 : many;
92185
92382
  }
92186
92383
  function withDefiniteArticle(word) {
92187
92384
  if (!word)
@@ -94460,8 +94657,8 @@ var init_ro = __esm({
94460
94657
  });
94461
94658
 
94462
94659
  // ../../node_modules/zod/v4/locales/ru.js
94463
- function getRussianPlural(count2, one3, few, many) {
94464
- const absCount = Math.abs(count2);
94660
+ function getRussianPlural(count3, one3, few, many) {
94661
+ const absCount = Math.abs(count3);
94465
94662
  const lastDigit = absCount % 10;
94466
94663
  const lastTwoDigits = absCount % 100;
94467
94664
  if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
@@ -100536,13 +100733,13 @@ function resolveRef(ref, ctx) {
100536
100733
  if (!ref.startsWith("#")) {
100537
100734
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
100538
100735
  }
100539
- const path43 = ref.slice(1).split("/").filter(Boolean);
100540
- if (path43.length === 0) {
100736
+ const path44 = ref.slice(1).split("/").filter(Boolean);
100737
+ if (path44.length === 0) {
100541
100738
  return ctx.rootSchema;
100542
100739
  }
100543
100740
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
100544
- if (path43[0] === defsKey) {
100545
- const key = path43[1];
100741
+ if (path44[0] === defsKey) {
100742
+ const key = path44[1];
100546
100743
  if (!key || !ctx.defs[key]) {
100547
100744
  throw new Error(`Reference not found: ${ref}`);
100548
100745
  }
@@ -108094,20 +108291,20 @@ var require_resolve = __commonJS({
108094
108291
  return false;
108095
108292
  }
108096
108293
  function countKeys(schema) {
108097
- let count2 = 0;
108294
+ let count3 = 0;
108098
108295
  for (const key in schema) {
108099
108296
  if (key === "$ref")
108100
108297
  return Infinity;
108101
- count2++;
108298
+ count3++;
108102
108299
  if (SIMPLE_INLINED.has(key))
108103
108300
  continue;
108104
108301
  if (typeof schema[key] == "object") {
108105
- (0, util_1.eachItem)(schema[key], (sch) => count2 += countKeys(sch));
108302
+ (0, util_1.eachItem)(schema[key], (sch) => count3 += countKeys(sch));
108106
108303
  }
108107
- if (count2 === Infinity)
108304
+ if (count3 === Infinity)
108108
108305
  return Infinity;
108109
108306
  }
108110
- return count2;
108307
+ return count3;
108111
108308
  }
108112
108309
  function getFullPath(resolver2, id = "", normalize2) {
108113
108310
  if (normalize2 !== false)
@@ -109146,8 +109343,8 @@ var require_utils = __commonJS({
109146
109343
  }
109147
109344
  return ind;
109148
109345
  }
109149
- function removeDotSegments(path43) {
109150
- let input = path43;
109346
+ function removeDotSegments(path44) {
109347
+ let input = path44;
109151
109348
  const output = [];
109152
109349
  let nextSlash = -1;
109153
109350
  let len = 0;
@@ -109558,8 +109755,8 @@ var require_schemes = __commonJS({
109558
109755
  }
109559
109756
  if (wsComponent.resourceName) {
109560
109757
  const queryIndex = wsComponent.resourceName.indexOf("?");
109561
- const path43 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
109562
- wsComponent.path = path43 && path43 !== "/" ? path43 : void 0;
109758
+ const path44 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
109759
+ wsComponent.path = path44 && path44 !== "/" ? path44 : void 0;
109563
109760
  wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
109564
109761
  wsComponent.resourceName = void 0;
109565
109762
  }
@@ -111649,8 +111846,8 @@ var require_contains = __commonJS({
111649
111846
  cxt.result(valid, () => cxt.reset());
111650
111847
  function validateItemsWithCount() {
111651
111848
  const schValid = gen.name("_valid");
111652
- const count2 = gen.let("count", 0);
111653
- validateItems(schValid, () => gen.if(schValid, () => checkLimits(count2)));
111849
+ const count3 = gen.let("count", 0);
111850
+ validateItems(schValid, () => gen.if(schValid, () => checkLimits(count3)));
111654
111851
  }
111655
111852
  function validateItems(_valid, block) {
111656
111853
  gen.forRange("i", 0, len, (i) => {
@@ -111663,16 +111860,16 @@ var require_contains = __commonJS({
111663
111860
  block();
111664
111861
  });
111665
111862
  }
111666
- function checkLimits(count2) {
111667
- gen.code((0, codegen_1._)`${count2}++`);
111863
+ function checkLimits(count3) {
111864
+ gen.code((0, codegen_1._)`${count3}++`);
111668
111865
  if (max === void 0) {
111669
- gen.if((0, codegen_1._)`${count2} >= ${min}`, () => gen.assign(valid, true).break());
111866
+ gen.if((0, codegen_1._)`${count3} >= ${min}`, () => gen.assign(valid, true).break());
111670
111867
  } else {
111671
- gen.if((0, codegen_1._)`${count2} > ${max}`, () => gen.assign(valid, false).break());
111868
+ gen.if((0, codegen_1._)`${count3} > ${max}`, () => gen.assign(valid, false).break());
111672
111869
  if (min === 1)
111673
111870
  gen.assign(valid, true);
111674
111871
  else
111675
- gen.if((0, codegen_1._)`${count2} >= ${min}`, () => gen.assign(valid, true));
111872
+ gen.if((0, codegen_1._)`${count3} >= ${min}`, () => gen.assign(valid, true));
111676
111873
  }
111677
111874
  }
111678
111875
  }
@@ -116257,7 +116454,167 @@ Use \`superbee mcp status --host <id>\` to verify it and restart the host after
116257
116454
  }
116258
116455
  });
116259
116456
 
116457
+ // ../cli/src/hosted/refusals.ts
116458
+ import { homedir as homedir19 } from "node:os";
116459
+ import { realpath as realpath6 } from "node:fs/promises";
116460
+ import path39 from "node:path";
116461
+ function docKey(args) {
116462
+ let value;
116463
+ for (let index2 = 0; index2 < args.length; index2 += 1) {
116464
+ const token = args[index2];
116465
+ if (token === "--") break;
116466
+ if (token === "--doc-key") value = args[index2 + 1];
116467
+ else if (token.startsWith("--doc-key=")) value = token.slice("--doc-key=".length);
116468
+ }
116469
+ return value;
116470
+ }
116471
+ function matchRow(command, args) {
116472
+ const sub = args.find((token) => !token.startsWith("-"));
116473
+ return HOSTED_CHECKOUT_REFUSALS.find((row2) => {
116474
+ if (row2.words[0] !== command) return false;
116475
+ if (row2.when && !row2.when(args)) return false;
116476
+ if (row2.words.length === 1) return true;
116477
+ return row2.words[1] === "*" ? sub !== void 0 : row2.words[1] === sub;
116478
+ });
116479
+ }
116480
+ function scan2(args) {
116481
+ let dir;
116482
+ for (let index2 = 0; index2 < args.length; index2 += 1) {
116483
+ const token = args[index2];
116484
+ if (token === "--") break;
116485
+ if (token === "--help" || token === "-h" || token === "--remote" || token.startsWith("--remote=")) return { dir, skip: true };
116486
+ if (token === "--dir") dir = args[index2 + 1];
116487
+ else if (token.startsWith("--dir=")) dir = token.slice("--dir=".length);
116488
+ }
116489
+ return { dir, skip: false };
116490
+ }
116491
+ async function checkoutFor(command, dir, home2, cwd) {
116492
+ let root;
116493
+ try {
116494
+ if (command === "init") root = await realpath6(path39.resolve(cwd, dir ?? "."));
116495
+ else root = (await resolveLocalBundleTarget(dir, cwd)).canonicalRoot;
116496
+ } catch {
116497
+ return null;
116498
+ }
116499
+ return bindingForPath(home2, root);
116500
+ }
116501
+ function hostedCheckoutRefusal(row2, words, binding) {
116502
+ const details = { reason: row2.reason, command: words, bundle_id: binding.bundle_id, host: binding.origin, checkout: binding.path };
116503
+ if (row2.reason === "checkout_target") {
116504
+ return new CliError("FORBIDDEN", `'${words}' refused: ${row2.why} (bundle ${binding.bundle_id} on ${binding.origin})`, {
116505
+ details,
116506
+ help: "choose another folder for a local bundle"
116507
+ });
116508
+ }
116509
+ return new CliError("FORBIDDEN", `'${words}' cannot sync from a hosted checkout (${row2.why}): do this in the Superbee app`, {
116510
+ details: { ...details, do_this_in: "app" },
116511
+ help: `do this in the Superbee app for bundle ${binding.bundle_id} on ${binding.origin}`
116512
+ });
116513
+ }
116514
+ async function assertAllowedInHostedCheckout(command, args, context = {}) {
116515
+ const row2 = matchRow(command, args);
116516
+ if (!row2) return;
116517
+ const { dir, skip } = scan2(args);
116518
+ if (skip) return;
116519
+ const binding = await checkoutFor(command, dir, context.home ?? homedir19(), context.cwd ?? process.cwd());
116520
+ if (!binding) return;
116521
+ const sub = row2.words.length > 1 ? args.find((token) => !token.startsWith("-")) : void 0;
116522
+ throw hostedCheckoutRefusal(row2, sub ? `${command} ${sub}` : command, binding);
116523
+ }
116524
+ function hostedMcpWriteRefusal(binding, operation) {
116525
+ return hostedCheckoutRefusal(
116526
+ { words: ["mcp"], reason: "not_syncable", why: "the local MCP app writes Views, blobs and documents the app owns for a checkout" },
116527
+ `mcp ${operation}`,
116528
+ binding
116529
+ );
116530
+ }
116531
+ var MCP_REGISTRATION, HOSTED_CHECKOUT_REFUSALS;
116532
+ var init_refusals = __esm({
116533
+ "../cli/src/hosted/refusals.ts"() {
116534
+ "use strict";
116535
+ init_define_SUPERBEE_BUILD_IDENTITY();
116536
+ init_define_SUPERBEE_UPDATE_POLICY();
116537
+ init_bundle2();
116538
+ init_errors4();
116539
+ init_binding();
116540
+ MCP_REGISTRATION = /* @__PURE__ */ new Set(["install", "status", "uninstall"]);
116541
+ HOSTED_CHECKOUT_REFUSALS = Object.freeze([
116542
+ { words: ["doc", "verify"], reason: "not_syncable", why: "verification is a managed field the host records" },
116543
+ { words: ["kind", "*"], reason: "not_syncable", why: "Kind conventions are edited in the app" },
116544
+ { words: ["recipe", "add"], reason: "not_syncable", why: "recipes change Kind and View conventions, which are edited in the app" },
116545
+ { words: ["recipe", "evolve"], reason: "not_syncable", why: "recipes change Kind and View conventions, which are edited in the app" },
116546
+ { words: ["artifact", "*"], reason: "not_syncable", why: "artifacts carry blobs, which do not sync" },
116547
+ {
116548
+ words: ["promote"],
116549
+ reason: "not_syncable",
116550
+ why: "a key that is not a .md document is stored as a blob, and blobs do not sync",
116551
+ when: (args) => !(docKey(args) ?? "").toLowerCase().endsWith(".md")
116552
+ },
116553
+ {
116554
+ words: ["delete"],
116555
+ reason: "not_syncable",
116556
+ why: "a key that is not a .md document is a blob, and blobs do not sync (delete a document with doc delete)",
116557
+ when: (args) => {
116558
+ const key = docKey(args);
116559
+ return key !== void 0 && !key.toLowerCase().endsWith(".md");
116560
+ }
116561
+ },
116562
+ {
116563
+ words: ["index", "generate"],
116564
+ reason: "not_syncable",
116565
+ why: "index.md files are reserved navigation the host keeps; generated ones would be held by sync",
116566
+ // --check only reports whether the indexes are current; it writes nothing.
116567
+ when: (args) => !args.some((token) => token === "--check" || token.startsWith("--check="))
116568
+ },
116569
+ { words: ["serve"], reason: "not_syncable", why: "the served bundle accepts writes and deletes that do not sync" },
116570
+ { words: ["ui"], reason: "not_syncable", why: "the local app writes Views and conventions, which do not sync" },
116571
+ {
116572
+ words: ["mcp"],
116573
+ reason: "not_syncable",
116574
+ why: "the local MCP app writes Views and conventions, which do not sync",
116575
+ when: (args) => !MCP_REGISTRATION.has(args.find((token) => !token.startsWith("-")) ?? "")
116576
+ },
116577
+ { words: ["init"], reason: "checkout_target", why: "the folder is a hosted checkout, not a local bundle" }
116578
+ ].map((row2) => Object.freeze({ ...row2, words: Object.freeze([...row2.words]) })));
116579
+ }
116580
+ });
116581
+
116582
+ // ../cli/src/hosted/read-only-bundle.ts
116583
+ function readOnlyHostedBundle(bundle, binding) {
116584
+ const backend = bundle.backend ?? configuredBundle(bundle.root).backend;
116585
+ const guarded2 = new Proxy(backend, {
116586
+ get(target2, property, receiver) {
116587
+ if (typeof property === "string" && Object.hasOwn(WRITES, property)) {
116588
+ return async () => {
116589
+ throw hostedMcpWriteRefusal(binding, WRITES[property]);
116590
+ };
116591
+ }
116592
+ const value = Reflect.get(target2, property, receiver);
116593
+ return typeof value === "function" ? value.bind(target2) : value;
116594
+ }
116595
+ });
116596
+ return Object.freeze({ ...bundle, backend: guarded2 });
116597
+ }
116598
+ var WRITES;
116599
+ var init_read_only_bundle = __esm({
116600
+ "../cli/src/hosted/read-only-bundle.ts"() {
116601
+ "use strict";
116602
+ init_define_SUPERBEE_BUILD_IDENTITY();
116603
+ init_define_SUPERBEE_UPDATE_POLICY();
116604
+ init_filesystem_runtime();
116605
+ init_refusals();
116606
+ WRITES = Object.freeze({
116607
+ write: "document write",
116608
+ delete: "document delete",
116609
+ writeReserved: "index write",
116610
+ writeBlob: "blob write",
116611
+ deleteBlob: "blob delete"
116612
+ });
116613
+ }
116614
+ });
116615
+
116260
116616
  // ../cli/src/mcp-workspace-resolver.ts
116617
+ import { homedir as homedir20 } from "node:os";
116261
116618
  function createCatalogMcpWorkspaceResolver(options = {}) {
116262
116619
  const listEntries = options.listEntries ?? listCatalogEntries;
116263
116620
  const resolveEntry2 = options.resolveEntry ?? resolveCatalogEntry;
@@ -116307,9 +116664,11 @@ function createCatalogMcpWorkspaceResolver(options = {}) {
116307
116664
  if (!samePhysicalPath3(bundle.root, entry.locator.path) || !samePhysicalPath3(target2.canonicalRoot, entry.locator.path)) {
116308
116665
  throw new Error("workspace catalog target changed during selection");
116309
116666
  }
116310
- const bundleName = (await deriveName(bundle)).name;
116667
+ const binding = await bindingForPath(options.home ?? homedir20(), target2.canonicalRoot);
116668
+ const served = binding ? readOnlyHostedBundle(bundle, binding) : bundle;
116669
+ const bundleName = (await deriveName(served)).name;
116311
116670
  return createMcpBundleContext({
116312
- bundle,
116671
+ bundle: served,
116313
116672
  bundleName,
116314
116673
  ...options.actor !== void 0 ? { actor: options.actor } : {},
116315
116674
  viewAuthorization: new LocalViewAuthorizationStore(bundle.root, options.home)
@@ -116328,6 +116687,8 @@ var init_mcp_workspace_resolver = __esm({
116328
116687
  init_bundle_name();
116329
116688
  init_catalog2();
116330
116689
  init_view_authorizations();
116690
+ init_binding();
116691
+ init_read_only_bundle();
116331
116692
  }
116332
116693
  });
116333
116694
 
@@ -116335,10 +116696,10 @@ var init_mcp_workspace_resolver = __esm({
116335
116696
  function createScanner(text4, ignoreTrivia = false) {
116336
116697
  const len = text4.length;
116337
116698
  let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
116338
- function scanHexDigits(count2, exact) {
116699
+ function scanHexDigits(count3, exact) {
116339
116700
  let digits = 0;
116340
116701
  let value2 = 0;
116341
- while (digits < count2 || !exact) {
116702
+ while (digits < count3 || !exact) {
116342
116703
  let ch = text4.charCodeAt(pos);
116343
116704
  if (ch >= 48 && ch <= 57) {
116344
116705
  value2 = value2 * 16 + ch - 48;
@@ -116352,7 +116713,7 @@ function createScanner(text4, ignoreTrivia = false) {
116352
116713
  pos++;
116353
116714
  digits++;
116354
116715
  }
116355
- if (digits < count2) {
116716
+ if (digits < count3) {
116356
116717
  value2 = -1;
116357
116718
  }
116358
116719
  return value2;
@@ -116991,9 +117352,9 @@ function format(documentText, range, options) {
116991
117352
  }
116992
117353
  return editOperations;
116993
117354
  }
116994
- function repeat(s, count2) {
117355
+ function repeat(s, count3) {
116995
117356
  let result3 = "";
116996
- for (let i = 0; i < count2; i++) {
117357
+ for (let i = 0; i < count3; i++) {
116997
117358
  result3 += s;
116998
117359
  }
116999
117360
  return result3;
@@ -117101,12 +117462,12 @@ function parseTree(text4, errors = [], options = ParseOptions.DEFAULT) {
117101
117462
  }
117102
117463
  return result3;
117103
117464
  }
117104
- function findNodeAtLocation(root, path43) {
117465
+ function findNodeAtLocation(root, path44) {
117105
117466
  if (!root) {
117106
117467
  return void 0;
117107
117468
  }
117108
117469
  let node2 = root;
117109
- for (let segment of path43) {
117470
+ for (let segment of path44) {
117110
117471
  if (typeof segment === "string") {
117111
117472
  if (node2.type !== "object" || !Array.isArray(node2.children)) {
117112
117473
  return void 0;
@@ -117496,14 +117857,14 @@ var init_parser = __esm({
117496
117857
 
117497
117858
  // ../../node_modules/jsonc-parser/lib/esm/impl/edit.js
117498
117859
  function setProperty(text4, originalPath, value, options) {
117499
- const path43 = originalPath.slice();
117860
+ const path44 = originalPath.slice();
117500
117861
  const errors = [];
117501
117862
  const root = parseTree(text4, errors);
117502
117863
  let parent = void 0;
117503
117864
  let lastSegment = void 0;
117504
- while (path43.length > 0) {
117505
- lastSegment = path43.pop();
117506
- parent = findNodeAtLocation(root, path43);
117865
+ while (path44.length > 0) {
117866
+ lastSegment = path44.pop();
117867
+ parent = findNodeAtLocation(root, path44);
117507
117868
  if (parent === void 0 && value !== void 0) {
117508
117869
  if (typeof lastSegment === "string") {
117509
117870
  value = { [lastSegment]: value };
@@ -117648,8 +118009,8 @@ var init_edit = __esm({
117648
118009
  });
117649
118010
 
117650
118011
  // ../../node_modules/jsonc-parser/lib/esm/main.js
117651
- function modify(text4, path43, value, options) {
117652
- return setProperty(text4, path43, value, options);
118012
+ function modify(text4, path44, value, options) {
118013
+ return setProperty(text4, path44, value, options);
117653
118014
  }
117654
118015
  function applyEdits(text4, edits) {
117655
118016
  let sortedEdits = edits.slice(0).sort((a, b) => {
@@ -117751,7 +118112,7 @@ var init_host_command = __esm({
117751
118112
 
117752
118113
  // ../cli/src/mcp-install-targets.ts
117753
118114
  import { readFileSync as readFileSync12 } from "node:fs";
117754
- import { homedir as homedir18 } from "node:os";
118115
+ import { homedir as homedir21 } from "node:os";
117755
118116
  function resolveMcpInstallTarget(value) {
117756
118117
  return TARGET_BY_NAME.get(value.trim().toLowerCase());
117757
118118
  }
@@ -117967,12 +118328,12 @@ function selectMcpRegistration(entries) {
117967
118328
  return entries.find((entry) => entry.name === CURRENT_MCP_REGISTRATION) ?? LEGACY_MCP_REGISTRATIONS.map((name) => entries.find((entry) => entry.name === name)).find(Boolean);
117968
118329
  }
117969
118330
  function environment(deps) {
117970
- return deps.environment ?? { home: homedir18(), env: process.env, platform: process.platform };
118331
+ return deps.environment ?? { home: homedir21(), env: process.env, platform: process.platform };
117971
118332
  }
117972
118333
  function inspectMcpHost(target2, deps = {}) {
117973
118334
  const input = environment(deps);
117974
- const path43 = resolveMcpTargetConfigPath(target2.id, input);
117975
- if (!path43) {
118335
+ const path44 = resolveMcpTargetConfigPath(target2.id, input);
118336
+ if (!path44) {
117976
118337
  return {
117977
118338
  host: target2.id,
117978
118339
  label: target2.label,
@@ -117983,7 +118344,7 @@ function inspectMcpHost(target2, deps = {}) {
117983
118344
  };
117984
118345
  }
117985
118346
  const authority = deps.authority?.() ?? resolvePersistentInstallAuthority({ env: input.env, platform: input.platform });
117986
- let reportedPath = path43;
118347
+ let reportedPath = path44;
117987
118348
  try {
117988
118349
  let entries;
117989
118350
  if (target2.id === "codex") {
@@ -117991,7 +118352,7 @@ function inspectMcpHost(target2, deps = {}) {
117991
118352
  entries = inspectCodexMcp(command, input, deps);
117992
118353
  } else {
117993
118354
  const read = deps.readFile ?? ((candidate) => readFileSync12(candidate, "utf8"));
117994
- const candidates = target2.id === "opencode" ? openCodeConfigCandidates(input) : [path43];
118355
+ const candidates = target2.id === "opencode" ? openCodeConfigCandidates(input) : [path44];
117995
118356
  const sources = [];
117996
118357
  for (const candidate of candidates) {
117997
118358
  try {
@@ -118123,7 +118484,7 @@ var init_mcp_install_targets = __esm({
118123
118484
  // ../cli/src/mcp-registration.ts
118124
118485
  import { execFileSync as execFileSync3 } from "node:child_process";
118125
118486
  import { readFileSync as readFileSync13, realpathSync as realpathSync14 } from "node:fs";
118126
- import { homedir as homedir19 } from "node:os";
118487
+ import { homedir as homedir22 } from "node:os";
118127
118488
  function isRecord9(value) {
118128
118489
  return typeof value === "object" && value !== null && !Array.isArray(value);
118129
118490
  }
@@ -118131,12 +118492,12 @@ function own4(value, key) {
118131
118492
  return Object.prototype.hasOwnProperty.call(value, key) ? value[key] : void 0;
118132
118493
  }
118133
118494
  function defaultEnvironment() {
118134
- return { home: homedir19(), env: process.env, platform: process.platform };
118495
+ return { home: homedir22(), env: process.env, platform: process.platform };
118135
118496
  }
118136
118497
  function isMissing(error51) {
118137
118498
  return isRecord9(error51) && own4(error51, "code") === "ENOENT";
118138
118499
  }
118139
- function resolvedPath(path43, deps) {
118500
+ function resolvedPath(path44, deps) {
118140
118501
  const resolve2 = deps.realpath ?? ((candidate) => {
118141
118502
  try {
118142
118503
  return realpathSync14(candidate);
@@ -118145,11 +118506,11 @@ function resolvedPath(path43, deps) {
118145
118506
  throw error51;
118146
118507
  }
118147
118508
  });
118148
- return resolve2(path43);
118509
+ return resolve2(path44);
118149
118510
  }
118150
- function readOptional(path43, read) {
118511
+ function readOptional(path44, read) {
118151
118512
  try {
118152
- return read(path43);
118513
+ return read(path44);
118153
118514
  } catch (error51) {
118154
118515
  if (isMissing(error51)) return void 0;
118155
118516
  throw error51;
@@ -118199,8 +118560,8 @@ function selectedSources(sources) {
118199
118560
  }
118200
118561
  function inspectTarget(target2, deps, codexCommand) {
118201
118562
  const input = deps.environment ?? defaultEnvironment();
118202
- const path43 = resolveMcpTargetConfigPath(target2.id, input);
118203
- if (!path43) {
118563
+ const path44 = resolveMcpTargetConfigPath(target2.id, input);
118564
+ if (!path44) {
118204
118565
  throw new McpRegistrationError(`no supported ${target2.label} local-config path on ${input.platform}`, {
118205
118566
  host: target2.id
118206
118567
  }, [target2.docs_url], "usage");
@@ -118212,7 +118573,7 @@ function inspectTarget(target2, deps, codexCommand) {
118212
118573
  }
118213
118574
  try {
118214
118575
  const entries = inspectCodexMcp(codexCommand, input, deps);
118215
- return { entries, selected: selectMcpRegistration(entries), config: collapseHomeDirectory(path43) };
118576
+ return { entries, selected: selectMcpRegistration(entries), config: collapseHomeDirectory(path44) };
118216
118577
  } catch (error51) {
118217
118578
  const state = error51 instanceof HostCommandError && error51.state === "absent" ? "cli_absent" : "unreadable";
118218
118579
  throw new McpRegistrationError(
@@ -118224,17 +118585,17 @@ function inspectTarget(target2, deps, codexCommand) {
118224
118585
  }
118225
118586
  }
118226
118587
  if (target2.id !== "opencode") {
118227
- const text4 = readOptional(path43, read);
118588
+ const text4 = readOptional(path44, read);
118228
118589
  const entries = text4 === void 0 ? [] : parseClaudeMcpEntries(text4, target2.id);
118229
118590
  return {
118230
118591
  entries,
118231
118592
  selected: selectMcpRegistration(entries),
118232
- config: collapseHomeDirectory(path43),
118233
- sourcePath: path43,
118593
+ config: collapseHomeDirectory(path44),
118594
+ sourcePath: path44,
118234
118595
  sourceText: text4 ?? "{}\n",
118235
118596
  sourceExists: text4 !== void 0,
118236
- sourceDestination: text4 === void 0 ? null : resolvedPath(path43, deps) ?? null,
118237
- sourceParent: capturePrivateConfigParent(path43)
118597
+ sourceDestination: text4 === void 0 ? null : resolvedPath(path44, deps) ?? null,
118598
+ sourceParent: capturePrivateConfigParent(path44)
118238
118599
  };
118239
118600
  }
118240
118601
  if (input.env.OPENCODE_CONFIG_CONTENT?.trim()) {
@@ -118277,7 +118638,7 @@ function inspectTarget(target2, deps, codexCommand) {
118277
118638
  configs: standard2.map((candidate) => collapseHomeDirectory(candidate.path))
118278
118639
  });
118279
118640
  }
118280
- source = standard2[0] ?? { path: path43, text: "{}\n", entries: [], destination: null, exists: false };
118641
+ source = standard2[0] ?? { path: path44, text: "{}\n", entries: [], destination: null, exists: false };
118281
118642
  }
118282
118643
  }
118283
118644
  const root = parseMcpConfigRoot(source.text);
@@ -118334,8 +118695,8 @@ function inspectForMutation(target2, deps, codexCommand) {
118334
118695
  }, [target2.docs_url], "runtime");
118335
118696
  }
118336
118697
  }
118337
- function editJsonc(text4, path43, value) {
118338
- const edits = modify(text4, [...path43], value, {
118698
+ function editJsonc(text4, path44, value) {
118699
+ const edits = modify(text4, [...path44], value, {
118339
118700
  formattingOptions: { insertSpaces: true, tabSize: 2, eol: "\n" }
118340
118701
  });
118341
118702
  const next = applyEdits(text4, edits);
@@ -118421,7 +118782,7 @@ function applyTarget(target2, operation, desired, before, deps, codexCommand) {
118421
118782
  if (!before.sourcePath || before.sourceText === void 0) {
118422
118783
  throw new McpRegistrationError(`no writable ${target2.label} configuration source was resolved`);
118423
118784
  }
118424
- let path43;
118785
+ let path44;
118425
118786
  let value;
118426
118787
  if (target2.id === "claude-desktop") {
118427
118788
  const root = parseMcpConfigRoot(before.sourceText);
@@ -118429,14 +118790,14 @@ function applyTarget(target2, operation, desired, before, deps, codexCommand) {
118429
118790
  if (servers !== void 0 && !isRecord9(servers)) {
118430
118791
  throw new McpRegistrationError("Claude Desktop mcpServers is not an object");
118431
118792
  }
118432
- path43 = ["mcpServers", CURRENT_MCP_REGISTRATION];
118793
+ path44 = ["mcpServers", CURRENT_MCP_REGISTRATION];
118433
118794
  value = operation === "install" ? { command: desired.command, args: desired.args } : void 0;
118434
118795
  } else {
118435
- path43 = before.openCodePath ?? ["mcp", CURRENT_MCP_REGISTRATION];
118436
- const v2 = path43[1] === "servers";
118796
+ path44 = before.openCodePath ?? ["mcp", CURRENT_MCP_REGISTRATION];
118797
+ const v2 = path44[1] === "servers";
118437
118798
  value = operation === "install" ? v2 ? { type: "local", command: [desired.command, ...desired.args], disabled: false } : { type: "local", command: [desired.command, ...desired.args], enabled: true } : void 0;
118438
118799
  }
118439
- const next = editJsonc(before.sourceText, path43, value);
118800
+ const next = editJsonc(before.sourceText, path44, value);
118440
118801
  const write = deps.writeFile ?? ((candidate, content3) => atomicWriteFileSync(candidate, content3, {
118441
118802
  expected: {
118442
118803
  destination: before.sourceDestination ?? null,
@@ -118905,7 +119266,7 @@ __export(sync_exports2, {
118905
119266
  withUpstreamHelp: () => withUpstreamHelp,
118906
119267
  writeAwarenessCache: () => writeAwarenessCache
118907
119268
  });
118908
- import { homedir as homedir20 } from "node:os";
119269
+ import { homedir as homedir23 } from "node:os";
118909
119270
  function requestsHelp(argv2) {
118910
119271
  for (const token of argv2) {
118911
119272
  if (token === "--") return false;
@@ -118916,10 +119277,12 @@ function requestsHelp(argv2) {
118916
119277
  async function sync2(argv2, deps = {}) {
118917
119278
  if (requestsHelp(argv2)) {
118918
119279
  (deps.stdout ?? ((text4) => void process.stdout.write(text4)))(renderUsage(`${SYNC_USAGE}
119280
+ Hosted checkouts (the target decides; there is no flag):
119281
+
118919
119282
  ${HOSTED_SYNC_USAGE}`));
118920
119283
  return;
118921
119284
  }
118922
- const home2 = deps.auth?.home ?? homedir20();
119285
+ const home2 = deps.auth?.home ?? homedir23();
118923
119286
  const binding = await hostedCheckoutFor(argv2, home2, deps.cwd ?? process.cwd());
118924
119287
  if (binding) {
118925
119288
  await hostedSync(argv2, binding, deps);
@@ -119230,7 +119593,7 @@ var init_skill_compatibility = __esm({
119230
119593
  // ../cli/src/commands/skill.ts
119231
119594
  import { createHash as createHash15 } from "node:crypto";
119232
119595
  import { existsSync as existsSync9, lstatSync as lstatSync8, readFileSync as readFileSync14, readdirSync as readdirSync3, realpathSync as realpathSync15, renameSync as renameSync6, rmSync as rmSync5, rmdirSync as rmdirSync3 } from "node:fs";
119233
- import { homedir as homedir21 } from "node:os";
119596
+ import { homedir as homedir24 } from "node:os";
119234
119597
  import { dirname as dirname5, join as join14 } from "node:path";
119235
119598
  import { parseArgs as parseArgs26 } from "node:util";
119236
119599
  function listFilesRelative(dir, prefix = "") {
@@ -119296,7 +119659,7 @@ function skillTargetsForName(dirName, scope, deps = {}) {
119296
119659
  opencode: paths.join(cwd, ".claude", "skills", dirName)
119297
119660
  };
119298
119661
  }
119299
- const home2 = deps.home ?? homedir21();
119662
+ const home2 = deps.home ?? homedir24();
119300
119663
  const env = deps.env ?? process.env;
119301
119664
  return {
119302
119665
  claude: paths.join(resolveHostConfigRoot(HOST_CONFIG_ROOTS.claude, home2, env, platform), "skills", dirName),
@@ -119644,12 +120007,12 @@ function inspectInstallPath(dir, assets, installCommand) {
119644
120007
  }
119645
120008
  }
119646
120009
  function inspectHostInstall(canonicalDir, legacyDir, assets, installCommand) {
119647
- const canonical = inspectInstallPath(canonicalDir, assets, installCommand);
120010
+ const canonical2 = inspectInstallPath(canonicalDir, assets, installCommand);
119648
120011
  const legacy = inspectInstallPath(legacyDir, assets, installCommand);
119649
- if (!canonical.ok) return canonical;
120012
+ if (!canonical2.ok) return canonical2;
119650
120013
  if (!legacy.ok) return legacy;
119651
- if (!canonical.preflight.ok) return canonical.preflight;
119652
- const canonicalOwned = canonical.status.state === "installed" || canonical.status.state === "stale";
120014
+ if (!canonical2.preflight.ok) return canonical2.preflight;
120015
+ const canonicalOwned = canonical2.status.state === "installed" || canonical2.status.state === "stale";
119653
120016
  const legacyOwned = legacy.status.state === "installed" || legacy.status.state === "stale";
119654
120017
  if (legacyOwned && !legacy.preflight.ok) return legacy.preflight;
119655
120018
  if (canonicalOwned && legacyOwned) {
@@ -119660,7 +120023,7 @@ function inspectHostInstall(canonicalDir, legacyDir, assets, installCommand) {
119660
120023
  }
119661
120024
  return {
119662
120025
  ok: true,
119663
- canonical: { ...canonical, preflight: canonical.preflight },
120026
+ canonical: { ...canonical2, preflight: canonical2.preflight },
119664
120027
  legacy,
119665
120028
  canonicalOwned,
119666
120029
  legacyOwned
@@ -119669,15 +120032,15 @@ function inspectHostInstall(canonicalDir, legacyDir, assets, installCommand) {
119669
120032
  function installForHost(canonicalDir, legacyDir, assets, installCommand) {
119670
120033
  const inspected = inspectHostInstall(canonicalDir, legacyDir, assets, installCommand);
119671
120034
  if (!inspected.ok) return inspected;
119672
- const { canonical, legacy, canonicalOwned, legacyOwned } = inspected;
120035
+ const { canonical: canonical2, legacy, canonicalOwned, legacyOwned } = inspected;
119673
120036
  if (!canonicalOwned && legacyOwned) {
119674
- sweepManagedDebris(canonicalDir, canonical.preflight.ownedForSweep);
120037
+ sweepManagedDebris(canonicalDir, canonical2.preflight.ownedForSweep);
119675
120038
  removeEmptyDirectories(canonicalDir, true);
119676
120039
  renameSync6(legacyDir, canonicalDir);
119677
120040
  const result4 = installIntoDir(canonicalDir, assets);
119678
120041
  return result4.ok ? { ok: true, changed: true, migrated: true, legacyState: legacy.status.state } : result4;
119679
120042
  }
119680
- const result3 = installIntoDir(canonicalDir, assets, canonical.preflight);
120043
+ const result3 = installIntoDir(canonicalDir, assets, canonical2.preflight);
119681
120044
  return result3.ok ? { ok: true, changed: result3.changed, migrated: false, legacyState: legacy.status.state } : result3;
119682
120045
  }
119683
120046
  function statusOutput(dir, status2) {
@@ -120463,7 +120826,7 @@ import {
120463
120826
  unlinkSync as unlinkSync3,
120464
120827
  writeFileSync as writeFileSync5
120465
120828
  } from "node:fs";
120466
- import { homedir as homedir22 } from "node:os";
120829
+ import { homedir as homedir25 } from "node:os";
120467
120830
  import { isAbsolute as isAbsolute3, join as join15 } from "node:path";
120468
120831
  function asRecord(value) {
120469
120832
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
@@ -120665,9 +121028,9 @@ function readPrivateFile(home2, filePath, maxBytes) {
120665
121028
  const bytes = Buffer.allocUnsafe(maxBytes + 1);
120666
121029
  let offset = 0;
120667
121030
  while (offset < bytes.byteLength) {
120668
- const count2 = readSync(descriptor, bytes, offset, bytes.byteLength - offset, null);
120669
- if (count2 === 0) break;
120670
- offset += count2;
121031
+ const count3 = readSync(descriptor, bytes, offset, bytes.byteLength - offset, null);
121032
+ if (count3 === 0) break;
121033
+ offset += count3;
120671
121034
  }
120672
121035
  if (offset > maxBytes) return { state: "unsafe" };
120673
121036
  const after = lstatSync9(filePath);
@@ -120994,7 +121357,7 @@ function transitionMatchingActiveToCooldown(home2, token, now) {
120994
121357
  }
120995
121358
  function runPassiveUpdateOrientation(deps = {}) {
120996
121359
  if (currentDistribution()?.updatesEnabled === false) return void 0;
120997
- const home2 = deps.home ?? homedir22();
121360
+ const home2 = deps.home ?? homedir25();
120998
121361
  const runningVersion = deps.runningVersion ?? staticBuildIdentity().package.version;
120999
121362
  const now = deps.now ?? (() => /* @__PURE__ */ new Date());
121000
121363
  const initial = inspectUpdateCache({ home: home2, runningVersion, now: now() });
@@ -121049,7 +121412,7 @@ function runPassiveUpdateOrientation(deps = {}) {
121049
121412
  async function runUpdateRefreshWorker(token, deps = {}) {
121050
121413
  if (currentDistribution()?.updatesEnabled === false) return;
121051
121414
  if (!isUpdateLeaseToken(token)) return;
121052
- const home2 = deps.home ?? homedir22();
121415
+ const home2 = deps.home ?? homedir25();
121053
121416
  const runningVersion = deps.runningVersion ?? staticBuildIdentity().package.version;
121054
121417
  const now = deps.now ?? (() => /* @__PURE__ */ new Date());
121055
121418
  if (!parseStrictSemver(runningVersion) || !activeLeaseAuthority(home2, token, now())) return;
@@ -121126,7 +121489,8 @@ var init_update_orientation = __esm({
121126
121489
 
121127
121490
  // ../cli/src/commands/home.ts
121128
121491
  import { parseArgs as parseArgs27 } from "node:util";
121129
- import path38 from "node:path";
121492
+ import path40 from "node:path";
121493
+ import { realpath as realpath7 } from "node:fs/promises";
121130
121494
  function parseHomeArgs(argv2) {
121131
121495
  return parseArgs27({ args: argv2, options: HOME_OPTIONS, allowPositionals: true });
121132
121496
  }
@@ -121180,7 +121544,7 @@ async function defaultSummarizeBundle(dir, route) {
121180
121544
  if (route) await assertResolvedLocalRouteIdentity(route);
121181
121545
  } catch (err) {
121182
121546
  if (err instanceof CliError && err.code === "NOT_FOUND") return null;
121183
- const root = collapseHomeDirectory(path38.resolve(dir ?? process.cwd()));
121547
+ const root = collapseHomeDirectory(path40.resolve(dir ?? process.cwd()));
121184
121548
  if (err instanceof CliError && err.code === "CONFLICT") {
121185
121549
  return { root, conflict: true, message: err.message };
121186
121550
  }
@@ -121190,18 +121554,19 @@ async function defaultSummarizeBundle(dir, route) {
121190
121554
  const docs = await queryHeads2(bundle);
121191
121555
  const { name, source } = await deriveBundleDisplayName(bundle);
121192
121556
  const okfVersion = await readBundleOkfVersion2(bundle);
121193
- return { name, nameSource: source, ...summarizeDocs(docs, collapseHomeDirectory(bundle.root), { okfVersion }) };
121557
+ const bundleHome = (await bundleHomeAt(await realpath7(bundle.root).catch(() => bundle.root))).home;
121558
+ return { name, nameSource: source, ...summarizeDocs(docs, collapseHomeDirectory(bundle.root), { okfVersion }), home: bundleHome };
121194
121559
  } catch {
121195
121560
  return { root: collapseHomeDirectory(bundle.root), unreadable: true };
121196
121561
  }
121197
121562
  }
121198
121563
  async function discoverSummarizeBundle(startDir) {
121199
121564
  try {
121200
- const root = await findBundleRoot(path38.resolve(startDir));
121565
+ const root = await findBundleRoot(path40.resolve(startDir));
121201
121566
  return root ? defaultSummarizeBundle(root) : null;
121202
121567
  } catch (err) {
121203
121568
  if (err instanceof CliError && err.code === "NOT_FOUND") return null;
121204
- const root = collapseHomeDirectory(path38.resolve(startDir));
121569
+ const root = collapseHomeDirectory(path40.resolve(startDir));
121205
121570
  if (err instanceof CliError && err.code === "CONFLICT") {
121206
121571
  return { root, conflict: true, message: err.message };
121207
121572
  }
@@ -121306,7 +121671,7 @@ async function defaultLoadBoardStatus(dir, route) {
121306
121671
  if (!top) return null;
121307
121672
  const committed = committedBundleAtHead(top);
121308
121673
  const bundleDir = committed?.bundleDir ?? bundleDirNameForProject(top);
121309
- const conventionalBoardPath = path38.join(top, bundleDir);
121674
+ const conventionalBoardPath = path40.join(top, bundleDir);
121310
121675
  const provisionedBoardPath = resolveProvisionedBoardPath2(top);
121311
121676
  if (!provisionedBoardPath) {
121312
121677
  const remoteRefExists = runGit(top, ["rev-parse", "--verify", "--quiet", `refs/remotes/${BOARD_REF}`]).status === 0;
@@ -121416,6 +121781,7 @@ function buildHomeView(deps, summary, remote, binding, bindingError, board, hook
121416
121781
  view2.bundle = bundleBlock;
121417
121782
  } else if (summary) {
121418
121783
  const bundleBlock = {};
121784
+ if (summary.home) bundleBlock.home = summary.home;
121419
121785
  if (summary.name) {
121420
121786
  bundleBlock.name = summary.name;
121421
121787
  if (summary.nameSource === "conventional-parent") {
@@ -121455,7 +121821,7 @@ function buildHomeView(deps, summary, remote, binding, bindingError, board, hook
121455
121821
  const recovery = binding.recovery ?? bindingInitRecovery(binding.target, deps.invocation());
121456
121822
  view2.getting_started = `project binding ${binding.file} -> ${binding.target} did not resolve to a bundle \u2014 recipes stay withheld until the binding resolves; recover with: ${recovery}`;
121457
121823
  } else {
121458
- const createTarget = path38.join(deps.targetDir ?? ".", CONVENTIONAL_BUNDLE_DIR_NAME);
121824
+ const createTarget = path40.join(deps.targetDir ?? ".", CONVENTIONAL_BUNDLE_DIR_NAME);
121459
121825
  const target2 = commandFragment` --dir ${commandQuoted(createTarget)}`;
121460
121826
  view2.getting_started = `no OKF bundle found in this directory \u2014 run \`${deps.invocation()} init --create-only --recipe none${target2}\` to create a blank bundle, or \`${deps.invocation()} recipes\` to compare available workspace setups; create your chosen setup here with \`${deps.invocation()} init --create-only --recipe <name>${target2}\``;
121461
121827
  }
@@ -121675,6 +122041,7 @@ var init_home = __esm({
121675
122041
  init_actor();
121676
122042
  init_actor_guidance();
121677
122043
  init_offers();
122044
+ init_bundle_home();
121678
122045
  init_src2();
121679
122046
  init_autopull2();
121680
122047
  init_errors4();
@@ -121700,6 +122067,9 @@ detached refresh at most once per 24-hour attempt window. Rendering never waits
121700
122067
  public npm request names only superbee; it sends no installed version, cwd, bundle, actor, or
121701
122068
  usage data beyond ordinary network metadata.
121702
122069
 
122070
+ The bundle block leads with 'home': local, git (a Git board) or hosted (a hosted checkout), read
122071
+ from local Git and private state only. 'bundle locate' and 'status' give the details.
122072
+
121703
122073
  Home also checks managed Agent Skill bytes locally. A stale install that passes the installer's
121704
122074
  complete read-only preflight is reported with its exact scope-specific refresh command and restart
121705
122075
  requirement; current, absent, unmanaged, conflicting, or unreadable installs stay quiet.
@@ -121730,11 +122100,11 @@ ASLITE_NO_UPDATE_CHECK, NO_UPDATE_NOTIFIER, or CI.
121730
122100
  });
121731
122101
 
121732
122102
  // ../cli/src/commands/session-start.ts
121733
- import { homedir as homedir23 } from "node:os";
122103
+ import { homedir as homedir26 } from "node:os";
121734
122104
  import { parseArgs as parseArgs28 } from "node:util";
121735
- import path39 from "node:path";
122105
+ import path41 from "node:path";
121736
122106
  async function hostedSessionStartPull(binding, budgetMs, deps = {}) {
121737
- const home2 = deps.sync?.auth?.home ?? homedir23();
122107
+ const home2 = deps.sync?.auth?.home ?? homedir26();
121738
122108
  const state = await sessionPullState(binding, budgetMs, home2, deps);
121739
122109
  const counts = typeof state === "object" ? state : {};
121740
122110
  const pulledAt = (await readFreshness(home2, binding.checkout_id).catch(() => null))?.pulled_at ?? null;
@@ -121766,7 +122136,7 @@ async function sessionStartPull(dir, budgetMs = SESSION_START_PULL_BUDGET_MS, no
121766
122136
  const deadline = now() + budgetMs;
121767
122137
  const remaining = () => Math.max(0, deadline - now());
121768
122138
  try {
121769
- assertSearchDirOutsidePrivateState(path39.resolve(dir ?? process.cwd()));
122139
+ assertSearchDirOutsidePrivateState(path41.resolve(dir ?? process.cwd()));
121770
122140
  const route = dir === void 0 && await resolveProjectBinding(process.cwd()) ? await resolveLocalBundleRoute(void 0) : void 0;
121771
122141
  if (route?.kind === "bound-board" && route.readiness !== "ready") return void 0;
121772
122142
  const owner = route?.kind === "bound-board" ? route.owner : void 0;
@@ -121807,7 +122177,7 @@ async function sessionStartPull(dir, budgetMs = SESSION_START_PULL_BUDGET_MS, no
121807
122177
  const top = repoTopLevel(startDir);
121808
122178
  if (!top) return void 0;
121809
122179
  const bundleDir = committedBundleAtHead(top)?.bundleDir ?? bundleDirNameForProject(top);
121810
- const boardPath2 = path39.join(top, bundleDir);
122180
+ const boardPath2 = path41.join(top, bundleDir);
121811
122181
  const key2 = resolveBundleKey(boardPath2);
121812
122182
  await defaultSyncStore.refreshMarker(key2);
121813
122183
  if (remaining() < MIN_USEFUL_BUDGET_MS) return { offline: true, boardPath: boardPath2 };
@@ -122023,7 +122393,7 @@ Options:
122023
122393
 
122024
122394
  // ../cli/src/commands/turn-end.ts
122025
122395
  import { createHash as createHash16 } from "node:crypto";
122026
- import { homedir as homedir24 } from "node:os";
122396
+ import { homedir as homedir27 } from "node:os";
122027
122397
  import { parseArgs as parseArgs29 } from "node:util";
122028
122398
  async function readHookStdin() {
122029
122399
  if (process.stdin.isTTY) return null;
@@ -122093,7 +122463,7 @@ async function turnEnd(argv2, partial2 = {}) {
122093
122463
  if (!binding) return;
122094
122464
  const stdin = await (partial2.readStdin ?? readHookStdin)().catch(() => null);
122095
122465
  if (continuingForHook(stdin)) return;
122096
- const home2 = partial2.syncDeps?.auth?.home ?? homedir24();
122466
+ const home2 = partial2.syncDeps?.auth?.home ?? homedir27();
122097
122467
  const deadline = Date.now() + (partial2.budgetMs ?? TURN_END_BUDGET_MS);
122098
122468
  const local = await (partial2.localState ?? ((b) => Promise.resolve().then(() => (init_sync(), sync_exports)).then((m2) => m2.hostedLocalState(b, home2))))(binding).catch(() => "changed");
122099
122469
  if (local === "busy") return;
@@ -122214,12 +122584,15 @@ async function bundleCommand(argv2, deps = {}) {
122214
122584
  });
122215
122585
  }
122216
122586
  const target2 = await resolveLocalBundleTarget(parsed.values.dir, cwd());
122587
+ const home2 = await bundleHomeAt(target2.canonicalRoot, deps.home === void 0 ? {} : { home: deps.home });
122217
122588
  stdout(
122218
122589
  render(
122219
122590
  {
122220
122591
  schema_version: 1,
122221
122592
  locator: { kind: "local-path", path: target2.canonicalRoot },
122222
- selected_by: target2.selectedBy,
122593
+ home: home2.home,
122594
+ ...homeDetail(home2),
122595
+ selected_by: home2.home === "hosted" && target2.selectedBy === "discovery" ? "hosted-checkout" : target2.selectedBy,
122223
122596
  ...target2.bindingFile ? { binding_file: target2.bindingFile } : {},
122224
122597
  available: true
122225
122598
  },
@@ -122237,6 +122610,7 @@ var init_bundle3 = __esm({
122237
122610
  init_args();
122238
122611
  init_command_spec();
122239
122612
  init_bundle2();
122613
+ init_bundle_home();
122240
122614
  init_errors4();
122241
122615
  init_invocation();
122242
122616
  init_output2();
@@ -122256,20 +122630,29 @@ Options:
122256
122630
  Resolution preserves normal CLI precedence: explicit --dir, then the nearest project binding,
122257
122631
  then local discovery. A successful receipt contains a canonical absolute local path suitable for
122258
122632
  passing back to ordinary commands with --dir. This command never reads or selects an HTTP remote.
122633
+
122634
+ The receipt names the bundle's home, which decides how its changes travel:
122635
+ local Changes stay on this machine
122636
+ git A Git board; 'board' names its channel, branch, upstream, and whether it is shared
122637
+ hosted A hosted checkout; 'hosted' names the host, bundle id, workspace and principal.
122638
+ selected_by is 'hosted-checkout' when discovery found the checkout
122639
+ The home is read from local Git and private state only: no request, no fetch.
122259
122640
  `;
122260
122641
  }
122261
122642
  });
122262
122643
 
122263
122644
  // ../cli/src/commands/catalog.ts
122264
122645
  import { parseArgs as parseArgs31 } from "node:util";
122265
- import { homedir as homedir25 } from "node:os";
122646
+ import { homedir as homedir28 } from "node:os";
122266
122647
  function entryReceipt(entry) {
122267
122648
  return {
122268
122649
  schema_version: 1,
122269
122650
  id: entry.id,
122270
122651
  label: entry.label,
122271
122652
  locator: entry.locator,
122272
- available: entry.available
122653
+ available: entry.available,
122654
+ home: entry.home,
122655
+ ...entry.hosted ? { hosted: entry.hosted } : {}
122273
122656
  };
122274
122657
  }
122275
122658
  function usage(message) {
@@ -122295,7 +122678,7 @@ function requestsPathField(argv2) {
122295
122678
  async function catalogInner(argv2, deps) {
122296
122679
  const stdout = deps.stdout ?? ((s) => void process.stdout.write(s));
122297
122680
  const cwd = deps.cwd ?? (() => process.cwd());
122298
- const home2 = deps.home ?? homedir25;
122681
+ const home2 = deps.home ?? homedir28;
122299
122682
  const parsed = parseSelectorOrUsage(
122300
122683
  () => parseArgs31({
122301
122684
  args: argv2,
@@ -122340,7 +122723,7 @@ async function catalogInner(argv2, deps) {
122340
122723
  {
122341
122724
  catalog: result3.changed ? "added" : "unchanged",
122342
122725
  changed: result3.changed,
122343
- ...entryReceipt({ ...result3.entry, available: true }),
122726
+ ...entryReceipt(await resolveCatalogEntry(result3.entry.id, home2())),
122344
122727
  help: [`${cliInvocation()} catalog resolve ${commandToken(result3.entry.label)} --field path`]
122345
122728
  },
122346
122729
  resolveMode(parsed.values)
@@ -122418,7 +122801,7 @@ is explicit: the catalog never crawls for or silently enrolls workspaces.
122418
122801
 
122419
122802
  Commands:
122420
122803
  add Register the resolved local bundle under a unique label (idempotent for the same pair)
122421
- list List registered workspaces and their currently derived availability
122804
+ list List registered workspaces with their currently derived availability and home
122422
122805
  resolve Revalidate and return exactly one registered workspace
122423
122806
 
122424
122807
  Options:
@@ -122427,6 +122810,11 @@ Options:
122427
122810
  --json Emit compact JSON instead of TOON
122428
122811
  -h, --help Show this help
122429
122812
 
122813
+ Each entry reports its home, derived from the folder now and never stored: local, git (a Git
122814
+ board) or hosted (a hosted checkout, with its host, bundle id and checked_out_at). The local MCP
122815
+ app serves a hosted entry read-only: its writes cannot sync, so they are refused with 'do this in
122816
+ the Superbee app'.
122817
+
122430
122818
  The catalog only selects a target. Pass a resolved path explicitly to ordinary commands with
122431
122819
  --dir; there is no process-global active workspace and no implicit cross-bundle operation.
122432
122820
  `;
@@ -122452,7 +122840,7 @@ function cappedPaths(dirs) {
122452
122840
  return {
122453
122841
  shown: Math.min(paths.length, PATH_LIMIT),
122454
122842
  total: paths.length,
122455
- rows: paths.slice(0, PATH_LIMIT).map((path43) => ({ path: path43 }))
122843
+ rows: paths.slice(0, PATH_LIMIT).map((path44) => ({ path: path44 }))
122456
122844
  };
122457
122845
  }
122458
122846
  function dirsWith(targets, disposition) {
@@ -123576,11 +123964,11 @@ var init_defaults = __esm({
123576
123964
  });
123577
123965
 
123578
123966
  // ../cli/src/commands/setup-hosted.ts
123579
- import { homedir as homedir26 } from "node:os";
123967
+ import { homedir as homedir29 } from "node:os";
123580
123968
  import { parseArgs as parseArgs36 } from "node:util";
123581
123969
  async function setupHosted(argv2, partial2 = {}) {
123582
123970
  const stdout = partial2.stdout ?? ((text4) => void process.stdout.write(text4));
123583
- const auth = partial2.auth ?? defaultHostedAuthDeps(homedir26());
123971
+ const auth = partial2.auth ?? defaultHostedAuthDeps(homedir29());
123584
123972
  const { values } = parseLeafOrUsage(
123585
123973
  () => parseArgs36({
123586
123974
  args: argv2,
@@ -123724,10 +124112,10 @@ import {
123724
124112
  mkdir as mkdir3,
123725
124113
  open as open3,
123726
124114
  readdir as readdir3,
123727
- stat as stat5,
124115
+ stat as stat6,
123728
124116
  unlink as unlink8
123729
124117
  } from "node:fs/promises";
123730
- import { homedir as homedir27 } from "node:os";
124118
+ import { homedir as homedir30 } from "node:os";
123731
124119
  import { dirname as dirname6, join as join17 } from "node:path";
123732
124120
  function errno3(error51) {
123733
124121
  return error51?.code;
@@ -123847,7 +124235,7 @@ async function preflightLegacy(input) {
123847
124235
  function blockedSource(error51) {
123848
124236
  return error51 instanceof UnsafeMigrationSource ? { reason: `legacy operational state at ${error51.display} ${error51.detail}`, command: error51.command } : { reason: "legacy operational state is not safe to migrate automatically", command: "superbee setup" };
123849
124237
  }
123850
- async function inspectUserStateMigration(input = homedir27()) {
124238
+ async function inspectUserStateMigration(input = homedir30()) {
123851
124239
  if (staticBuildIdentity().package.name === LEGACY_BRIDGE_PACKAGE_NAME) {
123852
124240
  return { state: "ready", reason: "the separately published Aslite bridge retains its legacy state root", records: 0 };
123853
124241
  }
@@ -123860,16 +124248,16 @@ async function inspectUserStateMigration(input = homedir27()) {
123860
124248
  command: "superbee setup"
123861
124249
  };
123862
124250
  }
123863
- const canonical = await inspectCanonicalUserStateRootDetail(input);
123864
- if (canonical.state === "ready") {
123865
- return canonical.hardening === "loose" ? {
124251
+ const canonical2 = await inspectCanonicalUserStateRootDetail(input);
124252
+ if (canonical2.state === "ready") {
124253
+ return canonical2.hardening === "loose" ? {
123866
124254
  state: "repairable",
123867
124255
  reason: "the canonical Superbee user-state root is recognized but its permissions are group- or world-accessible",
123868
124256
  records: 0,
123869
124257
  command: `${distributionBinName()} setup harden-state`
123870
124258
  } : { state: "ready", reason: "the canonical Superbee user-state root is ready", records: 0 };
123871
124259
  }
123872
- if (canonical.state === "conflict") {
124260
+ if (canonical2.state === "conflict") {
123873
124261
  return {
123874
124262
  state: "blocked",
123875
124263
  reason: "the canonical Superbee user-state root is unrecognized",
@@ -123891,7 +124279,7 @@ async function ensureMigrationParent(input) {
123891
124279
  } catch (error51) {
123892
124280
  if (errno3(error51) !== "EEXIST") throw error51;
123893
124281
  }
123894
- if (!(await stat5(parent)).isDirectory()) throw new Error("canonical state parent is unsafe");
124282
+ if (!(await stat6(parent)).isDirectory()) throw new Error("canonical state parent is unsafe");
123895
124283
  }
123896
124284
  function migrationTemporaryPath(root, relative2) {
123897
124285
  const digest2 = createHash17("sha256").update(relative2).digest("hex").slice(0, 24);
@@ -123947,10 +124335,10 @@ function journalBytes(records) {
123947
124335
  `;
123948
124336
  }
123949
124337
  async function removeStaleJournal(root, input) {
123950
- const path43 = join17(root, MIGRATION_JOURNAL_FILE_NAME);
123951
- const raw = await readPrivateStateFile(path43, MAX_CATALOG_BYTES, void 0, input).catch(() => null);
124338
+ const path44 = join17(root, MIGRATION_JOURNAL_FILE_NAME);
124339
+ const raw = await readPrivateStateFile(path44, MAX_CATALOG_BYTES, void 0, input).catch(() => null);
123952
124340
  if (raw === null || parseJournal(raw) === null) return;
123953
- await unlink8(path43).catch(() => {
124341
+ await unlink8(path44).catch(() => {
123954
124342
  });
123955
124343
  }
123956
124344
  function parseJournal(raw) {
@@ -124026,7 +124414,7 @@ function receipt(status2, changed, records) {
124026
124414
  next: { command: "superbee setup" }
124027
124415
  };
124028
124416
  }
124029
- async function migrateUserState(input = homedir27(), hooks = {}) {
124417
+ async function migrateUserState(input = homedir30(), hooks = {}) {
124030
124418
  if (staticBuildIdentity().package.name === LEGACY_BRIDGE_PACKAGE_NAME) {
124031
124419
  throw new CliError("NOT_IMPLEMENTED", "state migration is available only from the Superbee package", { help: "npm install -g superbee" });
124032
124420
  }
@@ -124034,9 +124422,9 @@ async function migrateUserState(input = homedir27(), hooks = {}) {
124034
124422
  if (policy.state === "blocked") {
124035
124423
  throw new CliError("CONFLICT", policy.reason ?? "the selected host private-state location is unavailable", { help: `${distributionBinName()} setup` });
124036
124424
  }
124037
- const canonical = await inspectCanonicalUserStateRoot(input);
124425
+ const canonical2 = await inspectCanonicalUserStateRoot(input);
124038
124426
  const root = canonicalUserStateDir(input);
124039
- if (canonical === "ready") {
124427
+ if (canonical2 === "ready") {
124040
124428
  const current = await preflightDurableRecords(root, input).catch(() => {
124041
124429
  throw new CliError("CONFLICT", "canonical Superbee user state contains an invalid durable record", { help: `${distributionBinName()} setup` });
124042
124430
  });
@@ -124048,8 +124436,8 @@ async function migrateUserState(input = homedir27(), hooks = {}) {
124048
124436
  const blocked = blockedSource(error51);
124049
124437
  throw new CliError("CONFLICT", blocked.reason, { help: blocked.command });
124050
124438
  });
124051
- if (records.length === 0 && canonical === "absent") return receipt("nothing_to_migrate", false, []);
124052
- if (canonical === "conflict") {
124439
+ if (records.length === 0 && canonical2 === "absent") return receipt("nothing_to_migrate", false, []);
124440
+ if (canonical2 === "conflict") {
124053
124441
  let raw;
124054
124442
  try {
124055
124443
  await assertPrivateDirectory(root, input);
@@ -124139,7 +124527,7 @@ var init_user_state_migration = __esm({
124139
124527
  });
124140
124528
 
124141
124529
  // ../cli/src/commands/setup.ts
124142
- import { homedir as homedir28 } from "node:os";
124530
+ import { homedir as homedir31 } from "node:os";
124143
124531
  import { parseArgs as parseArgs37 } from "node:util";
124144
124532
  function setupHost(value) {
124145
124533
  return MCP_INSTALL_TARGETS.find((target2) => target2.id === value)?.id;
@@ -124341,7 +124729,7 @@ async function setup(argv2, injected = {}) {
124341
124729
  const deps = {
124342
124730
  stdout,
124343
124731
  cwd: injected.cwd ?? (() => process.cwd()),
124344
- home: injected.home ?? homedir28,
124732
+ home: injected.home ?? homedir31,
124345
124733
  inspectDistribution: injected.inspectDistribution ?? (() => resolvePersistentInstallAuthority()),
124346
124734
  inspectSkill: injected.inspectSkill ?? ((selectedScope) => inspectSkillStatus(selectedScope)),
124347
124735
  inspectHook: injected.inspectHook ?? ((selectedScope) => inspectHookStatus(selectedScope)),
@@ -124606,13 +124994,13 @@ var init_loopback = __esm({
124606
124994
  });
124607
124995
 
124608
124996
  // ../cli/src/commands/hosted-auth.ts
124609
- import { homedir as homedir29 } from "node:os";
124997
+ import { homedir as homedir32 } from "node:os";
124610
124998
  import { parseArgs as parseArgs38 } from "node:util";
124611
124999
  function commandDeps(deps) {
124612
125000
  return {
124613
125001
  stdout: deps.stdout ?? ((text4) => void process.stdout.write(text4)),
124614
125002
  stderr: deps.stderr ?? ((text4) => void process.stderr.write(text4)),
124615
- auth: deps.auth ?? defaultHostedAuthDeps(homedir29())
125003
+ auth: deps.auth ?? defaultHostedAuthDeps(homedir32())
124616
125004
  };
124617
125005
  }
124618
125006
  function iso(ms) {
@@ -124943,117 +125331,15 @@ Options:
124943
125331
  }
124944
125332
  });
124945
125333
 
124946
- // ../cli/src/hosted/refusals.ts
124947
- import { homedir as homedir30 } from "node:os";
124948
- import { realpath as realpath4 } from "node:fs/promises";
124949
- import path40 from "node:path";
124950
- function docKey(args) {
124951
- let value;
124952
- for (let index2 = 0; index2 < args.length; index2 += 1) {
124953
- const token = args[index2];
124954
- if (token === "--") break;
124955
- if (token === "--doc-key") value = args[index2 + 1];
124956
- else if (token.startsWith("--doc-key=")) value = token.slice("--doc-key=".length);
124957
- }
124958
- return value;
124959
- }
124960
- function matchRow(command, args) {
124961
- const sub = args.find((token) => !token.startsWith("-"));
124962
- return HOSTED_CHECKOUT_REFUSALS.find((row2) => {
124963
- if (row2.words[0] !== command) return false;
124964
- if (row2.when && !row2.when(args)) return false;
124965
- if (row2.words.length === 1) return true;
124966
- return row2.words[1] === "*" ? sub !== void 0 : row2.words[1] === sub;
124967
- });
124968
- }
124969
- function scan2(args) {
124970
- let dir;
124971
- for (let index2 = 0; index2 < args.length; index2 += 1) {
124972
- const token = args[index2];
124973
- if (token === "--") break;
124974
- if (token === "--help" || token === "-h" || token === "--remote" || token.startsWith("--remote=")) return { dir, skip: true };
124975
- if (token === "--dir") dir = args[index2 + 1];
124976
- else if (token.startsWith("--dir=")) dir = token.slice("--dir=".length);
124977
- }
124978
- return { dir, skip: false };
124979
- }
124980
- async function checkoutFor(command, dir, home2, cwd) {
124981
- let root;
124982
- try {
124983
- if (command === "init") root = await realpath4(path40.resolve(cwd, dir ?? "."));
124984
- else root = (await resolveLocalBundleTarget(dir, cwd)).canonicalRoot;
124985
- } catch {
124986
- return null;
124987
- }
124988
- return bindingForPath(home2, root);
124989
- }
124990
- function hostedCheckoutRefusal(row2, words, binding) {
124991
- const details = { reason: row2.reason, command: words, bundle_id: binding.bundle_id, host: binding.origin, checkout: binding.path };
124992
- if (row2.reason === "checkout_target") {
124993
- return new CliError("FORBIDDEN", `'${words}' refused: ${row2.why} (bundle ${binding.bundle_id} on ${binding.origin})`, {
124994
- details,
124995
- help: "choose another folder for a local bundle"
124996
- });
124997
- }
124998
- return new CliError("FORBIDDEN", `'${words}' cannot sync from a hosted checkout (${row2.why}): do this in the Superbee app`, {
124999
- details: { ...details, do_this_in: "app" },
125000
- help: `do this in the Superbee app for bundle ${binding.bundle_id} on ${binding.origin}`
125001
- });
125002
- }
125003
- async function assertAllowedInHostedCheckout(command, args, context = {}) {
125004
- const row2 = matchRow(command, args);
125005
- if (!row2) return;
125006
- const { dir, skip } = scan2(args);
125007
- if (skip) return;
125008
- const binding = await checkoutFor(command, dir, context.home ?? homedir30(), context.cwd ?? process.cwd());
125009
- if (!binding) return;
125010
- const sub = row2.words.length > 1 ? args.find((token) => !token.startsWith("-")) : void 0;
125011
- throw hostedCheckoutRefusal(row2, sub ? `${command} ${sub}` : command, binding);
125012
- }
125013
- var MCP_REGISTRATION, HOSTED_CHECKOUT_REFUSALS;
125014
- var init_refusals = __esm({
125015
- "../cli/src/hosted/refusals.ts"() {
125016
- "use strict";
125017
- init_define_SUPERBEE_BUILD_IDENTITY();
125018
- init_define_SUPERBEE_UPDATE_POLICY();
125019
- init_bundle2();
125020
- init_errors4();
125021
- init_binding();
125022
- MCP_REGISTRATION = /* @__PURE__ */ new Set(["install", "status", "uninstall"]);
125023
- HOSTED_CHECKOUT_REFUSALS = Object.freeze([
125024
- { words: ["doc", "verify"], reason: "not_syncable", why: "verification is a managed field the host records" },
125025
- { words: ["kind", "*"], reason: "not_syncable", why: "Kind conventions are edited in the app" },
125026
- { words: ["recipe", "add"], reason: "not_syncable", why: "recipes change Kind and View conventions, which are edited in the app" },
125027
- { words: ["recipe", "evolve"], reason: "not_syncable", why: "recipes change Kind and View conventions, which are edited in the app" },
125028
- { words: ["artifact", "*"], reason: "not_syncable", why: "artifacts carry blobs, which do not sync" },
125029
- {
125030
- words: ["promote"],
125031
- reason: "not_syncable",
125032
- why: "a key that is not a .md document is stored as a blob, and blobs do not sync",
125033
- when: (args) => !(docKey(args) ?? "").toLowerCase().endsWith(".md")
125034
- },
125035
- { words: ["serve"], reason: "not_syncable", why: "the served bundle accepts writes and deletes that do not sync" },
125036
- { words: ["ui"], reason: "not_syncable", why: "the local app writes Views and conventions, which do not sync" },
125037
- {
125038
- words: ["mcp"],
125039
- reason: "not_syncable",
125040
- why: "the local MCP app writes Views and conventions, which do not sync",
125041
- when: (args) => !MCP_REGISTRATION.has(args.find((token) => !token.startsWith("-")) ?? "")
125042
- },
125043
- { words: ["init"], reason: "checkout_target", why: "the folder is a hosted checkout, not a local bundle" }
125044
- ].map((row2) => Object.freeze({ ...row2, words: Object.freeze([...row2.words]) })));
125045
- }
125046
- });
125047
-
125048
125334
  // ../cli/src/commands/checkout.ts
125049
- import { homedir as homedir31 } from "node:os";
125050
- import { lstat as lstat6, mkdir as mkdir4, readFile as readFile5, readdir as readdir4, realpath as realpath5, rmdir as rmdir2, stat as stat6, unlink as unlink9 } from "node:fs/promises";
125051
- import path41 from "node:path";
125335
+ import { homedir as homedir33 } from "node:os";
125336
+ import { lstat as lstat6, mkdir as mkdir4, readFile as readFile5, readdir as readdir4, realpath as realpath8, rmdir as rmdir2, stat as stat7, unlink as unlink9 } from "node:fs/promises";
125337
+ import path42 from "node:path";
125052
125338
  import { parseArgs as parseArgs39 } from "node:util";
125053
125339
  function checkoutDeps(partial2) {
125054
125340
  return {
125055
125341
  stdout: partial2.stdout ?? ((text4) => void process.stdout.write(text4)),
125056
- auth: partial2.auth ?? defaultHostedAuthDeps(homedir31()),
125342
+ auth: partial2.auth ?? defaultHostedAuthDeps(homedir33()),
125057
125343
  cwd: partial2.cwd ?? process.cwd(),
125058
125344
  ...partial2.fetch ? { fetch: partial2.fetch } : {}
125059
125345
  };
@@ -125061,7 +125347,7 @@ function checkoutDeps(partial2) {
125061
125347
  async function entryKind(target2) {
125062
125348
  let info;
125063
125349
  try {
125064
- info = await stat6(target2);
125350
+ info = await stat7(target2);
125065
125351
  } catch (error51) {
125066
125352
  if (error51.code === "ENOENT") return "absent";
125067
125353
  throw error51;
@@ -125086,7 +125372,7 @@ function nextSteps(folder) {
125086
125372
  return [`${cliInvocation()} list --dir ${commandToken(folder)}`, `${cliInvocation()} status --dir ${commandToken(folder)}`];
125087
125373
  }
125088
125374
  async function assertStandaloneFolder(folder) {
125089
- const parent = path41.dirname(folder);
125375
+ const parent = path42.dirname(folder);
125090
125376
  const enclosing = await findBundleRoot(parent).catch(() => null);
125091
125377
  if (enclosing) {
125092
125378
  throw new CliError("FORBIDDEN", `refusing to check out inside the local bundle at ${enclosing}`, {
@@ -125118,9 +125404,9 @@ function capabilityRefusal(error51, bundleId, target2, listed, resume2) {
125118
125404
  if (error51 instanceof RemoteError && error51.code === "result_too_large") return tooLarge(bundleId, target2, null);
125119
125405
  return hostedFailure(error51, target2, resume2);
125120
125406
  }
125121
- function tooLarge(bundleId, target2, count2) {
125407
+ function tooLarge(bundleId, target2, count3) {
125122
125408
  return new CliError("FORBIDDEN", `hosted bundle '${bundleId}' is too large to check out (over ${CHECKOUT_DOCUMENT_LIMIT} documents)`, {
125123
- details: { reason: "bundle_too_large", bundle_id: bundleId, host: target2.origin, limit: CHECKOUT_DOCUMENT_LIMIT, ...count2 === null ? {} : { documents: count2 } },
125409
+ details: { reason: "bundle_too_large", bundle_id: bundleId, host: target2.origin, limit: CHECKOUT_DOCUMENT_LIMIT, ...count3 === null ? {} : { documents: count3 } },
125124
125410
  help: "use the Superbee app for this bundle; paged checkout is not available yet"
125125
125411
  });
125126
125412
  }
@@ -125140,7 +125426,7 @@ function lockFailure2(error51, folder) {
125140
125426
  return error51;
125141
125427
  }
125142
125428
  async function canonicalFolder(folder) {
125143
- const parent = path41.dirname(folder);
125429
+ const parent = path42.dirname(folder);
125144
125430
  await mkdir4(parent, { recursive: true });
125145
125431
  let link3 = false;
125146
125432
  try {
@@ -125148,19 +125434,19 @@ async function canonicalFolder(folder) {
125148
125434
  } catch (error51) {
125149
125435
  if (error51.code !== "ENOENT") throw error51;
125150
125436
  }
125151
- if (!link3) return path41.join(await realpath5(parent), path41.basename(folder));
125437
+ if (!link3) return path42.join(await realpath8(parent), path42.basename(folder));
125152
125438
  try {
125153
- return await realpath5(folder);
125439
+ return await realpath8(folder);
125154
125440
  } catch {
125155
125441
  throw new CliError("USAGE", `the --dir folder ${folder} is a symbolic link to a folder that does not exist`, { help: "pass --dir <the real folder>" });
125156
125442
  }
125157
125443
  }
125158
- async function assertReclaimable(home2, binding, canonical) {
125159
- const identity = await folderIdentity(canonical);
125444
+ async function assertReclaimable(home2, binding, canonical2) {
125445
+ const identity = await folderIdentity(canonical2);
125160
125446
  if (identity && sameFolder(identity, binding.folder_identity)) {
125161
- throw new CliError("ALREADY_EXISTS", `${canonical} is the checkout of '${binding.bundle_id}' with every file removed; that is a pending change, not a stale checkout`, {
125447
+ throw new CliError("ALREADY_EXISTS", `${canonical2} is the checkout of '${binding.bundle_id}' with every file removed; that is a pending change, not a stale checkout`, {
125162
125448
  details: { reason: "emptied_checkout", ...bindingView(binding) },
125163
- help: `restore the files, or forget the checkout first: ${cliInvocation()} checkout --release ${commandToken(canonical)}`
125449
+ help: `restore the files, or forget the checkout first: ${cliInvocation()} checkout --release ${commandToken(canonical2)}`
125164
125450
  });
125165
125451
  }
125166
125452
  const store = await FileJournaledBackend.open({ directory: checkoutStoreDir(home2, binding.checkout_id) });
@@ -125171,9 +125457,9 @@ async function assertReclaimable(home2, binding, canonical) {
125171
125457
  await store.close();
125172
125458
  }
125173
125459
  if (unsent > 0) {
125174
- throw new CliError("CONFLICT", `the checkout of '${binding.bundle_id}' at ${canonical} holds ${unsent} change(s) sync has not sent`, {
125460
+ throw new CliError("CONFLICT", `the checkout of '${binding.bundle_id}' at ${canonical2} holds ${unsent} change(s) sync has not sent`, {
125175
125461
  details: { reason: "unsent_changes", unsent, ...bindingView(binding) },
125176
- help: `to discard them and check out again: ${cliInvocation()} checkout --release ${commandToken(canonical)}`
125462
+ help: `to discard them and check out again: ${cliInvocation()} checkout --release ${commandToken(canonical2)}`
125177
125463
  });
125178
125464
  }
125179
125465
  }
@@ -125184,7 +125470,7 @@ async function removePlaced(folder, placed, createdFolder) {
125184
125470
  if (digestOf(await readFile5(file2)) === digest2) await unlink9(file2);
125185
125471
  } catch {
125186
125472
  }
125187
- for (let dir = path41.dirname(file2); dir !== folder && dir.startsWith(`${folder}${path41.sep}`); dir = path41.dirname(dir)) dirs.add(dir);
125473
+ for (let dir = path42.dirname(file2); dir !== folder && dir.startsWith(`${folder}${path42.sep}`); dir = path42.dirname(dir)) dirs.add(dir);
125188
125474
  }
125189
125475
  for (const dir of [...dirs].sort((a, b) => b.length - a.length)) await rmdir2(dir).catch(() => {
125190
125476
  });
@@ -125193,32 +125479,32 @@ async function removePlaced(folder, placed, createdFolder) {
125193
125479
  return await entryKind(folder) !== "dir";
125194
125480
  }
125195
125481
  async function release(folderArg, deps, mode) {
125196
- const folder = path41.resolve(deps.cwd, folderArg);
125197
- let canonical;
125482
+ const folder = path42.resolve(deps.cwd, folderArg);
125483
+ let canonical2;
125198
125484
  try {
125199
- canonical = (await lstat6(folder)).isSymbolicLink() ? await realpath5(folder) : path41.join(await realpath5(path41.dirname(folder)), path41.basename(folder));
125485
+ canonical2 = (await lstat6(folder)).isSymbolicLink() ? await realpath8(folder) : path42.join(await realpath8(path42.dirname(folder)), path42.basename(folder));
125200
125486
  } catch {
125201
125487
  try {
125202
- canonical = path41.join(await realpath5(path41.dirname(folder)), path41.basename(folder));
125488
+ canonical2 = path42.join(await realpath8(path42.dirname(folder)), path42.basename(folder));
125203
125489
  } catch {
125204
- canonical = folder;
125490
+ canonical2 = folder;
125205
125491
  }
125206
125492
  }
125207
- const binding = await indexedBindingForPath(deps.auth.home, canonical);
125493
+ const binding = await indexedBindingForPath(deps.auth.home, canonical2);
125208
125494
  if (!binding) {
125209
- deps.stdout(render({ released: false, folder: canonical, reason: "not a hosted checkout" }, mode));
125495
+ deps.stdout(render({ released: false, folder: canonical2, reason: "not a hosted checkout" }, mode));
125210
125496
  return;
125211
125497
  }
125212
- await filesystemPushRoleLocks().request(checkoutLockName(canonical), { ifAvailable: true }, async (lock) => {
125498
+ await filesystemPushRoleLocks().request(checkoutLockName(canonical2), { ifAvailable: true }, async (lock) => {
125213
125499
  if (!lock) {
125214
- throw new CliError("CONFLICT", `another command holds the checkout lock for ${canonical}`, {
125215
- details: { reason: "checkout_busy", folder: canonical },
125500
+ throw new CliError("CONFLICT", `another command holds the checkout lock for ${canonical2}`, {
125501
+ details: { reason: "checkout_busy", folder: canonical2 },
125216
125502
  help: "wait for it to finish, then retry the same command"
125217
125503
  });
125218
125504
  }
125219
125505
  await releaseCheckout(deps.auth.home, binding);
125220
125506
  }).catch((error51) => {
125221
- throw lockFailure2(error51, canonical);
125507
+ throw lockFailure2(error51, canonical2);
125222
125508
  });
125223
125509
  deps.stdout(
125224
125510
  render(
@@ -125273,7 +125559,7 @@ async function checkout(argv2, partial2 = {}) {
125273
125559
  }
125274
125560
  const target2 = resolveHostedTarget(hostChoice);
125275
125561
  const prefix = syncRoutePrefix(target2);
125276
- const folder = path41.resolve(deps.cwd, values.dir ?? bundleId);
125562
+ const folder = path42.resolve(deps.cwd, values.dir ?? bundleId);
125277
125563
  assertBundleOutsidePrivateState(folder, deps.auth.home);
125278
125564
  const resume2 = commandFragment`${cliInvocation()} checkout ${commandToken(bundleId)} --host ${commandToken(hostArgument(target2))} --dir ${commandToken(folder)}${values.workspace !== void 0 ? commandFragment` --workspace ${commandToken(values.workspace)}` : commandFragment``}${values.json ? commandFragment` --json` : commandFragment``}`;
125279
125565
  const found = await entryKind(folder);
@@ -125281,7 +125567,7 @@ async function checkout(argv2, partial2 = {}) {
125281
125567
  throw new CliError("ALREADY_EXISTS", `${folder} exists and is not a folder`, { help: "pass --dir <new folder>" });
125282
125568
  }
125283
125569
  if (found === "dir") {
125284
- const existing = await bindingForPath(deps.auth.home, await realpath5(folder));
125570
+ const existing = await bindingForPath(deps.auth.home, await realpath8(folder));
125285
125571
  if (existing && sameBundle(existing, target2, bundleId)) {
125286
125572
  deps.stdout(render({ checkout: "unchanged", ...bindingView(existing), help: nextSteps(existing.path) }, mode));
125287
125573
  return;
@@ -125343,36 +125629,36 @@ async function checkout(argv2, partial2 = {}) {
125343
125629
  assertProjectable(ids, bundleId, target2);
125344
125630
  const remembered = identity.tenantIds.length > 1 ? await readDefaultWorkspace(deps.auth.home, target2.origin) : null;
125345
125631
  const workspace = values.workspace ?? (identity.tenantIds.length === 1 ? identity.tenantIds[0] : remembered !== null && identity.tenantIds.includes(remembered) ? remembered : null);
125346
- const canonical = await canonicalFolder(folder);
125632
+ const canonical2 = await canonicalFolder(folder);
125347
125633
  let createdFolder = false;
125348
125634
  const placed = /* @__PURE__ */ new Map();
125349
125635
  let replaced = null;
125350
- const result3 = await filesystemPushRoleLocks().request(checkoutLockName(canonical), { ifAvailable: true }, async (lock) => {
125636
+ const result3 = await filesystemPushRoleLocks().request(checkoutLockName(canonical2), { ifAvailable: true }, async (lock) => {
125351
125637
  if (!lock) {
125352
- throw new CliError("CONFLICT", `another command holds the checkout lock for ${canonical}`, {
125353
- details: { reason: "checkout_busy", folder: canonical },
125638
+ throw new CliError("CONFLICT", `another command holds the checkout lock for ${canonical2}`, {
125639
+ details: { reason: "checkout_busy", folder: canonical2 },
125354
125640
  help: "wait for it to finish, then retry the same command"
125355
125641
  });
125356
125642
  }
125357
- const kind2 = await entryKind(canonical);
125643
+ const kind2 = await entryKind(canonical2);
125358
125644
  if (kind2 === "dir" || kind2 === "other") {
125359
- throw new CliError("ALREADY_EXISTS", `${canonical} is no longer empty`, { details: { reason: "not_empty", folder: canonical }, help: "pass --dir <new or empty folder>" });
125645
+ throw new CliError("ALREADY_EXISTS", `${canonical2} is no longer empty`, { details: { reason: "not_empty", folder: canonical2 }, help: "pass --dir <new or empty folder>" });
125360
125646
  }
125361
- replaced = await indexedBindingForPath(deps.auth.home, canonical);
125647
+ replaced = await indexedBindingForPath(deps.auth.home, canonical2);
125362
125648
  if (replaced) {
125363
- await assertReclaimable(deps.auth.home, replaced, canonical);
125649
+ await assertReclaimable(deps.auth.home, replaced, canonical2);
125364
125650
  await releaseCheckout(deps.auth.home, replaced);
125365
125651
  }
125366
125652
  if (kind2 === "absent") {
125367
- await mkdir4(canonical);
125653
+ await mkdir4(canonical2);
125368
125654
  createdFolder = true;
125369
125655
  }
125370
- const identityNow = await folderIdentity(canonical);
125371
- if (!identityNow) throw new CliError("RUNTIME", `${canonical} disappeared during checkout`, { help: "retry the same command" });
125656
+ const identityNow = await folderIdentity(canonical2);
125657
+ if (!identityNow) throw new CliError("RUNTIME", `${canonical2} disappeared during checkout`, { help: "retry the same command" });
125372
125658
  const binding = {
125373
125659
  schema: 1,
125374
125660
  checkout_id: newCheckoutId(),
125375
- path: canonical,
125661
+ path: canonical2,
125376
125662
  origin: target2.origin,
125377
125663
  audience: target2.audience,
125378
125664
  routes: prefix,
@@ -125397,9 +125683,9 @@ async function checkout(argv2, partial2 = {}) {
125397
125683
  }
125398
125684
  const stored = await store.readHeads({ project: (head) => head.id });
125399
125685
  assertProjectable(stored, bundleId, target2);
125400
- const exported = await exportFresh(store, canonical, (file2, digest2) => placed.set(file2, digest2));
125686
+ const exported = await exportFresh(store, canonical2, (file2, digest2) => placed.set(file2, digest2));
125401
125687
  if (exported.kept.length > 0) {
125402
- throw new CliError("CONFLICT", `files appeared in ${canonical} during checkout`, {
125688
+ throw new CliError("CONFLICT", `files appeared in ${canonical2} during checkout`, {
125403
125689
  details: { reason: "folder_changed", kept: exported.kept.slice(0, 20), kept_total: exported.kept.length },
125404
125690
  help: "retry the same command once nothing else writes to the folder"
125405
125691
  });
@@ -125427,22 +125713,24 @@ async function checkout(argv2, partial2 = {}) {
125427
125713
  await store?.close();
125428
125714
  }
125429
125715
  }).catch(async (error51) => {
125430
- const clean = await removePlaced(canonical, placed, createdFolder);
125431
- const failure3 = lockFailure2(error51, canonical);
125716
+ const clean = await removePlaced(canonical2, placed, createdFolder);
125717
+ const failure3 = lockFailure2(error51, canonical2);
125432
125718
  if (!clean && failure3 instanceof CliError) {
125433
125719
  throw new CliError(failure3.code, failure3.message, {
125434
- details: { ...failure3.details ?? {}, partial_folder: canonical },
125720
+ details: { ...failure3.details ?? {}, partial_folder: canonical2 },
125435
125721
  ...failure3.help ? { help: failure3.help } : {}
125436
125722
  });
125437
125723
  }
125438
125724
  throw failure3;
125439
125725
  });
125440
125726
  const replacedBinding = replaced;
125727
+ const cataloged = await registerInCatalog(deps.auth.home, result3.binding);
125441
125728
  deps.stdout(
125442
125729
  render(
125443
125730
  {
125444
125731
  checkout: "created",
125445
125732
  ...bindingView(result3.binding),
125733
+ catalog: cataloged,
125446
125734
  documents: result3.documents,
125447
125735
  root_index: result3.root,
125448
125736
  heads_digest: result3.digest,
@@ -125455,6 +125743,29 @@ async function checkout(argv2, partial2 = {}) {
125455
125743
  )
125456
125744
  );
125457
125745
  }
125746
+ function catalogLabels(bundleId) {
125747
+ const base = bundleId.slice(0, 60).replace(/[._-]+$/, "");
125748
+ return [base, ...Array.from({ length: 8 }, (_2, index2) => `${base}-${index2 + 2}`)].filter((label) => {
125749
+ try {
125750
+ assertCatalogLabel(label);
125751
+ return true;
125752
+ } catch {
125753
+ return false;
125754
+ }
125755
+ });
125756
+ }
125757
+ async function registerInCatalog(home2, binding) {
125758
+ const byHand = `${cliInvocation()} catalog add <label> --dir ${commandToken(binding.path)}`;
125759
+ try {
125760
+ const taken = new Set((await loadCatalog(home2)).entries.map((entry2) => entry2.label));
125761
+ const label = catalogLabels(binding.bundle_id).find((candidate) => !taken.has(candidate));
125762
+ if (label === void 0) return { registered: false, note: "every catalog label for this bundle id is taken", help: byHand };
125763
+ const { entry } = await addCatalogEntry(label, binding.path, { home: home2 });
125764
+ return { registered: true, label: entry.label, id: entry.id, home: "hosted" };
125765
+ } catch (error51) {
125766
+ return { registered: false, note: error51 instanceof Error ? error51.message : String(error51), help: byHand };
125767
+ }
125768
+ }
125458
125769
  function assertProjectable(ids, bundleId, target2) {
125459
125770
  let collision;
125460
125771
  try {
@@ -125499,6 +125810,7 @@ var init_checkout = __esm({
125499
125810
  init_refusals();
125500
125811
  init_projection();
125501
125812
  init_sync_scan();
125813
+ init_catalog2();
125502
125814
  CHECKOUT_DOCUMENT_LIMIT = 1e3;
125503
125815
  BUNDLE_ID = /^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/;
125504
125816
  BUNDLE_LIST_CAP = 100;
@@ -125517,12 +125829,17 @@ never in the folder. Re-running for the same folder and bundle is a no-op. A che
125517
125829
  was deleted, or replaced by a new empty folder, is replaced, unless it holds changes sync has not
125518
125830
  sent yet; a checkout emptied in place is refused, because removing every file is a pending edit.
125519
125831
 
125832
+ A new checkout is added to your workspace catalog under its bundle id (or the id with -2 to -9
125833
+ when that label is taken), so other sessions and the local MCP app can find it; 'catalog list'
125834
+ shows it with home: hosted. The local MCP app serves it read-only.
125835
+
125520
125836
  --release <folder> forgets the checkout at that folder: its private binding and store are removed
125521
125837
  and the folder's files are left as they are. Releasing a folder that is not a checkout is a no-op.
125522
125838
 
125523
125839
  'superbee sync --dir <folder>' sends your edits and brings in the host's. Commands whose effect
125524
- sync cannot send (doc delete, delete, doc verify, kind, recipe add/evolve, artifact, promote to a
125525
- non-.md key, serve, ui, mcp) are refused in it with "do this in the app". Bundles over ${CHECKOUT_DOCUMENT_LIMIT} documents, bundles the host does not
125840
+ sync cannot send (doc verify, kind, recipe add/evolve, artifact, promote or delete of a non-.md
125841
+ key, index generate, serve, ui, mcp) are refused in it with "do this in the app". Deleting a
125842
+ document file, by hand or with doc delete or delete --doc-key <id>.md, syncs as a delete. Bundles over ${CHECKOUT_DOCUMENT_LIMIT} documents, bundles the host does not
125526
125843
  serve to a checkout (such as one with a Git source), and ids in two of your workspaces are refused.
125527
125844
 
125528
125845
  Options:
@@ -125542,7 +125859,7 @@ Examples:
125542
125859
  REFUSED_SUMMARY = Object.freeze(
125543
125860
  HOSTED_CHECKOUT_REFUSALS.filter((row2) => row2.reason !== "checkout_target").map((row2) => {
125544
125861
  const words = row2.words.join(" ");
125545
- return row2.words[0] === "promote" ? "promote (non-.md key)" : words;
125862
+ return row2.words[0] === "promote" || row2.words[0] === "delete" ? `${words} (non-.md key)` : words;
125546
125863
  })
125547
125864
  );
125548
125865
  }
@@ -125784,9 +126101,9 @@ __export(managed_worker_exports, {
125784
126101
  runManagedUiWorker: () => runManagedUiWorker,
125785
126102
  runManagedUiWorkerInput: () => runManagedUiWorkerInput
125786
126103
  });
125787
- import { stat as stat7, realpath as realpath6 } from "node:fs/promises";
126104
+ import { stat as stat8, realpath as realpath9 } from "node:fs/promises";
125788
126105
  import { randomUUID as randomUUID6 } from "node:crypto";
125789
- import path42 from "node:path";
126106
+ import path43 from "node:path";
125790
126107
  function object4(value) {
125791
126108
  return value !== null && typeof value === "object" && !Array.isArray(value);
125792
126109
  }
@@ -125814,7 +126131,7 @@ function parseManagedUiWorkerInput(raw) {
125814
126131
  if (!object4(launchIdentity) || Object.keys(launchIdentity).sort().join(",") !== "canonical_root,dev,ino") {
125815
126132
  throw new Error("managed UI startup launch identity has an unsupported shape");
125816
126133
  }
125817
- if (typeof launchIdentity.canonical_root !== "string" || !path42.isAbsolute(launchIdentity.canonical_root)) {
126134
+ if (typeof launchIdentity.canonical_root !== "string" || !path43.isAbsolute(launchIdentity.canonical_root)) {
125818
126135
  throw new Error("managed UI startup canonical root is invalid");
125819
126136
  }
125820
126137
  if (typeof launchIdentity.dev !== "string" || !DECIMAL_IDENTITY.test(launchIdentity.dev)) {
@@ -125829,10 +126146,10 @@ function parseManagedUiWorkerInput(raw) {
125829
126146
  if (authority.mode !== "dir" || authority.protocol !== MANAGED_UI_PROTOCOL) {
125830
126147
  throw new Error("managed UI startup authority protocol is invalid");
125831
126148
  }
125832
- if (typeof authority.bundle_root !== "string" || !path42.isAbsolute(authority.bundle_root)) {
126149
+ if (typeof authority.bundle_root !== "string" || !path43.isAbsolute(authority.bundle_root)) {
125833
126150
  throw new Error("managed UI startup bundle root is invalid");
125834
126151
  }
125835
- if (typeof authority.launch_root !== "string" || !path42.isAbsolute(authority.launch_root)) {
126152
+ if (typeof authority.launch_root !== "string" || !path43.isAbsolute(authority.launch_root)) {
125836
126153
  throw new Error("managed UI startup launch root is invalid");
125837
126154
  }
125838
126155
  if (!(authority.actor === null || typeof authority.actor === "string" && authority.actor.length > 0 && authority.actor.length <= 1024)) {
@@ -125868,8 +126185,8 @@ async function adoptionLifecycle(handle, deadlineTimer) {
125868
126185
  }
125869
126186
  }
125870
126187
  async function assertFrozenLaunchIdentity(input) {
125871
- const canonicalRoot = await realpath6(input.authority.launch_root);
125872
- const metadata = await stat7(canonicalRoot, { bigint: true });
126188
+ const canonicalRoot = await realpath9(input.authority.launch_root);
126189
+ const metadata = await stat8(canonicalRoot, { bigint: true });
125873
126190
  if (canonicalRoot !== input.authority.bundle_root || canonicalRoot !== input.launch_identity.canonical_root || !metadata.isDirectory() || metadata.dev.toString() !== input.launch_identity.dev || metadata.ino.toString() !== input.launch_identity.ino) throw new Error("managed UI launch route changed after controller selection");
125874
126191
  }
125875
126192
  async function runManagedUiWorkerInput(input, runtime = {}) {