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

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.68";
69
69
  GITHUB_REPO = "SYW-Apps/Waffle-AIron";
70
70
  SUPPORTED_ALIASES = ["wai"];
71
71
  SCAN_EXCLUDE_DIRS = /* @__PURE__ */ new Set([
@@ -14394,19 +14394,34 @@ var init_export_conformance = __esm({
14394
14394
  }
14395
14395
  }
14396
14396
  const takenFrom = /* @__PURE__ */ new Map();
14397
+ const take = (consumer, writtenIn, specifier, names) => {
14398
+ const target = resolveImport(writtenIn, specifier, code.paths);
14399
+ if (!target) return;
14400
+ let byName = takenFrom.get(target);
14401
+ if (!byName) takenFrom.set(target, byName = /* @__PURE__ */ new Map());
14402
+ for (const name of names) {
14403
+ if (!name) continue;
14404
+ let takers = byName.get(name);
14405
+ if (!takers) byName.set(name, takers = /* @__PURE__ */ new Set());
14406
+ takers.add(consumer);
14407
+ }
14408
+ };
14397
14409
  for (const consumer of realization.paths) {
14398
14410
  if (!code.exactPaths.has(consumer)) continue;
14399
- for (const [local, binding] of Object.entries(code.factsAt(consumer)?.importBindings ?? {})) {
14411
+ const facts = code.factsAt(consumer);
14412
+ if (!facts) continue;
14413
+ for (const [local, binding] of Object.entries(facts.importBindings ?? {})) {
14400
14414
  if (binding.namespace) continue;
14401
- const target = resolveImport(consumer, binding.from, code.paths);
14402
- if (!target) continue;
14403
- let names = takenFrom.get(target);
14404
- if (!names) takenFrom.set(target, names = /* @__PURE__ */ new Map());
14405
- for (const name of [local, binding.imported]) {
14406
- if (!name) continue;
14407
- let takers = names.get(name);
14408
- if (!takers) names.set(name, takers = /* @__PURE__ */ new Set());
14409
- takers.add(consumer);
14415
+ take(consumer, consumer, binding.from, [local, binding.imported]);
14416
+ }
14417
+ for (const sites of Object.values(facts.functionCallSites ?? {})) {
14418
+ for (const site of sites) {
14419
+ if (!site.member || !site.via) continue;
14420
+ const writtenIn = site.from ? pathKey(site.from) : consumer;
14421
+ const scope = site.from ? code.factsAt(writtenIn) : facts;
14422
+ if (!scope) continue;
14423
+ const binding = importBindingOf(scope, site.via);
14424
+ if (binding?.namespace) take(consumer, writtenIn, binding.from, [site.name]);
14410
14425
  }
14411
14426
  }
14412
14427
  }
@@ -37582,13 +37597,29 @@ function storeInstallGlobalPackArchive(archive, name) {
37582
37597
  descriptor.tier = "instance";
37583
37598
  return descriptor;
37584
37599
  }
37600
+ function declaredName2(loadRef, baseRoot, scope) {
37601
+ const d = probe(loadRef, baseRoot, scope, loadRef);
37602
+ return d.error ? void 0 : d.name;
37603
+ }
37604
+ function pickByName(candidates, name, fileOf, manifestOf) {
37605
+ const byFile = candidates.find((c) => stem(fileOf(c)) === name || path53.basename(fileOf(c)) === name);
37606
+ if (byFile !== void 0) return byFile;
37607
+ const byManifest = candidates.filter((c) => manifestOf(c) === name);
37608
+ if (byManifest.length > 1) {
37609
+ throw new Error(
37610
+ `Pack name "${name}" is ambiguous: ${byManifest.map((c) => `"${fileOf(c)}"`).join(", ")} all declare it. Remove one by its file name instead.`
37611
+ );
37612
+ }
37613
+ return byManifest[0];
37614
+ }
37585
37615
  function storeRemoveGlobalPack(name) {
37586
37616
  assertName(name);
37587
37617
  const dir = hostCore.globalPacksDir();
37588
- const match = hostCore.discoverPacks(dir).find((ref) => stem(ref) === name || path53.basename(ref) === name);
37618
+ const manifestOf = (ref) => declaredName2(ref, path53.dirname(ref), "global");
37619
+ const match = pickByName(hostCore.discoverPacks(dir), name, path53.basename, manifestOf);
37589
37620
  if (!match) {
37590
37621
  const inImage = hostCore.discoverPacks(imagePacksDir()).some(
37591
- (ref) => stem(ref) === name || path53.basename(ref) === name
37622
+ (ref) => stem(ref) === name || path53.basename(ref) === name || manifestOf(ref) === name
37592
37623
  );
37593
37624
  throw new Error(
37594
37625
  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 +37681,12 @@ function boundProject2(cfg, project2) {
37650
37681
  }
37651
37682
  function findPackRegistration(config, name) {
37652
37683
  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);
37684
+ const entries = config?.extensions?.packs ?? [];
37685
+ const direct = entries.find((entry) => typeof entry === "string" ? entry === relRef || stem(entry) === name || path53.basename(entry) === name : entry.name === name);
37686
+ if (direct !== void 0) return direct;
37687
+ const root = getProjectRoot();
37688
+ const refs = entries.filter((entry) => typeof entry === "string");
37689
+ return pickByName(refs, name, (ref) => ref, (ref) => declaredName2(ref, root, "project"));
37654
37690
  }
37655
37691
  function listGlobalPacks(cfg, credential) {
37656
37692
  requireCap(cfg, credential, "project:admin", "instance", "", "Forbidden \u2014 managing server-global packs requires instance-level project:admin");
@@ -42453,6 +42489,10 @@ function removeUnit(cfg, sessionId, unitId, disposition) {
42453
42489
  }
42454
42490
  const units = listOrganizationUnits(cfg.dataDir);
42455
42491
  const subtree = subtreeUnitIds2(units, unitId);
42492
+ const kind = disposition?.kind;
42493
+ if (kind !== "migrate" && kind !== "alternative" && kind !== "absorb" && kind !== "cascade") {
42494
+ throw new Error("A disposition kind is required: migrate, alternative, absorb or cascade");
42495
+ }
42456
42496
  if (disposition.kind === "cascade") {
42457
42497
  for (const placement of listProjectPlacements(cfg.dataDir)) {
42458
42498
  if (subtree.has(placement.unitId)) {
@@ -45703,7 +45743,8 @@ async function handleWebRequest(cfg, req, res, body, url, ctx) {
45703
45743
  return sendJson(res, 200, { ok: true });
45704
45744
  }
45705
45745
  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 }));
45746
+ await opsRunProducer(cfg, sessionId, String(body?.projectId ?? ""), String(body?.target ?? ""));
45747
+ return sendJson(res, 200, { ok: true });
45707
45748
  }
45708
45749
  if (req.method === "GET" && parts.length === 3 && parts[2] === "git") {
45709
45750
  return sendJson(res, 200, opsGitStatus(cfg, sessionId, q(url, "projectId") ?? ""));