@wairon/cli 5.1.1-dev.66 → 5.1.1-dev.67

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/cli/index.js CHANGED
@@ -65,7 +65,7 @@ var init_defaults = __esm({
65
65
  copilot: ".github/prompts",
66
66
  codex: ".codex/agents"
67
67
  };
68
- WAIRON_VERSION = "5.1.1-dev.66";
68
+ WAIRON_VERSION = "5.1.1-dev.67";
69
69
  GITHUB_REPO = "SYW-Apps/Waffle-AIron";
70
70
  SUPPORTED_ALIASES = ["wai"];
71
71
  SCAN_EXCLUDE_DIRS = /* @__PURE__ */ new Set([
@@ -37582,13 +37582,29 @@ function storeInstallGlobalPackArchive(archive, name) {
37582
37582
  descriptor.tier = "instance";
37583
37583
  return descriptor;
37584
37584
  }
37585
+ function declaredName2(loadRef, baseRoot, scope) {
37586
+ const d = probe(loadRef, baseRoot, scope, loadRef);
37587
+ return d.error ? void 0 : d.name;
37588
+ }
37589
+ function pickByName(candidates, name, fileOf, manifestOf) {
37590
+ const byFile = candidates.find((c) => stem(fileOf(c)) === name || path53.basename(fileOf(c)) === name);
37591
+ if (byFile !== void 0) return byFile;
37592
+ const byManifest = candidates.filter((c) => manifestOf(c) === name);
37593
+ if (byManifest.length > 1) {
37594
+ throw new Error(
37595
+ `Pack name "${name}" is ambiguous: ${byManifest.map((c) => `"${fileOf(c)}"`).join(", ")} all declare it. Remove one by its file name instead.`
37596
+ );
37597
+ }
37598
+ return byManifest[0];
37599
+ }
37585
37600
  function storeRemoveGlobalPack(name) {
37586
37601
  assertName(name);
37587
37602
  const dir = hostCore.globalPacksDir();
37588
- const match = hostCore.discoverPacks(dir).find((ref) => stem(ref) === name || path53.basename(ref) === name);
37603
+ const manifestOf = (ref) => declaredName2(ref, path53.dirname(ref), "global");
37604
+ const match = pickByName(hostCore.discoverPacks(dir), name, path53.basename, manifestOf);
37589
37605
  if (!match) {
37590
37606
  const inImage = hostCore.discoverPacks(imagePacksDir()).some(
37591
- (ref) => stem(ref) === name || path53.basename(ref) === name
37607
+ (ref) => stem(ref) === name || path53.basename(ref) === name || manifestOf(ref) === name
37592
37608
  );
37593
37609
  throw new Error(
37594
37610
  inImage ? `Pack "${name}" is an immutable image-layer pack (WAIRON_IMAGE_PACKS_DIR) and cannot be removed at runtime; rebuild the extension image without it.` : `No server-global instance pack named "${name}".`
@@ -37650,7 +37666,12 @@ function boundProject2(cfg, project2) {
37650
37666
  }
37651
37667
  function findPackRegistration(config, name) {
37652
37668
  const relRef = `.wai/packs/${name}.yaml`;
37653
- return (config?.extensions?.packs ?? []).find((entry) => typeof entry === "string" ? entry === relRef || stem(entry) === name || path53.basename(entry) === name : entry.name === name);
37669
+ const entries = config?.extensions?.packs ?? [];
37670
+ const direct = entries.find((entry) => typeof entry === "string" ? entry === relRef || stem(entry) === name || path53.basename(entry) === name : entry.name === name);
37671
+ if (direct !== void 0) return direct;
37672
+ const root = getProjectRoot();
37673
+ const refs = entries.filter((entry) => typeof entry === "string");
37674
+ return pickByName(refs, name, (ref) => ref, (ref) => declaredName2(ref, root, "project"));
37654
37675
  }
37655
37676
  function listGlobalPacks(cfg, credential) {
37656
37677
  requireCap(cfg, credential, "project:admin", "instance", "", "Forbidden \u2014 managing server-global packs requires instance-level project:admin");
@@ -42453,6 +42474,10 @@ function removeUnit(cfg, sessionId, unitId, disposition) {
42453
42474
  }
42454
42475
  const units = listOrganizationUnits(cfg.dataDir);
42455
42476
  const subtree = subtreeUnitIds2(units, unitId);
42477
+ const kind = disposition?.kind;
42478
+ if (kind !== "migrate" && kind !== "alternative" && kind !== "absorb" && kind !== "cascade") {
42479
+ throw new Error("A disposition kind is required: migrate, alternative, absorb or cascade");
42480
+ }
42456
42481
  if (disposition.kind === "cascade") {
42457
42482
  for (const placement of listProjectPlacements(cfg.dataDir)) {
42458
42483
  if (subtree.has(placement.unitId)) {
@@ -45703,7 +45728,8 @@ async function handleWebRequest(cfg, req, res, body, url, ctx) {
45703
45728
  return sendJson(res, 200, { ok: true });
45704
45729
  }
45705
45730
  if (req.method === "POST" && parts.length === 4 && parts[2] === "producers" && parts[3] === "run") {
45706
- return opsRunProducer(cfg, sessionId, String(body?.projectId ?? ""), String(body?.target ?? "")).then(() => sendJson(res, 200, { ok: true }));
45731
+ await opsRunProducer(cfg, sessionId, String(body?.projectId ?? ""), String(body?.target ?? ""));
45732
+ return sendJson(res, 200, { ok: true });
45707
45733
  }
45708
45734
  if (req.method === "GET" && parts.length === 3 && parts[2] === "git") {
45709
45735
  return sendJson(res, 200, opsGitStatus(cfg, sessionId, q(url, "projectId") ?? ""));