githolon 0.105.13 → 0.105.14

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/full-cli.mjs CHANGED
@@ -1055,9 +1055,9 @@ function activityKey(kind, slot) {
1055
1055
  return `activity.${kind}.${slot}`;
1056
1056
  }
1057
1057
  function templateVars(template) {
1058
- const out13 = [];
1059
- for (const m of template.matchAll(/\{([a-zA-Z0-9_]+)\}/g)) out13.push(m[1]);
1060
- return out13;
1058
+ const out14 = [];
1059
+ for (const m of template.matchAll(/\{([a-zA-Z0-9_]+)\}/g)) out14.push(m[1]);
1060
+ return out14;
1061
1061
  }
1062
1062
  function payloadFieldNames(schema) {
1063
1063
  const def = schema?._def ?? schema?.def;
@@ -2987,15 +2987,15 @@ var init_git_fs = __esm({
2987
2987
  });
2988
2988
 
2989
2989
  // ../cloud/web-client/src/_adapter/tree.ts
2990
- function flatten(dir, prefix, out13) {
2990
+ function flatten(dir, prefix, out14) {
2991
2991
  const children = [...(dir.contents ?? /* @__PURE__ */ new Map()).entries()].sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0);
2992
2992
  for (const [name, inode] of children) {
2993
2993
  const path2 = prefix ? prefix + "/" + name : name;
2994
2994
  if (inode.contents instanceof Map) {
2995
- out13.push({ path: path2, dir: true });
2996
- flatten(inode, path2, out13);
2995
+ out14.push({ path: path2, dir: true });
2996
+ flatten(inode, path2, out14);
2997
2997
  } else {
2998
- out13.push({ path: path2, dir: false, bytes: inode.data ?? new Uint8Array(0) });
2998
+ out14.push({ path: path2, dir: false, bytes: inode.data ?? new Uint8Array(0) });
2999
2999
  }
3000
3000
  }
3001
3001
  }
@@ -3018,13 +3018,13 @@ function serializeTree(workTree) {
3018
3018
  }
3019
3019
  let total = 0;
3020
3020
  for (const c of chunks) total += c.length;
3021
- const out13 = new Uint8Array(total);
3021
+ const out14 = new Uint8Array(total);
3022
3022
  let off = 0;
3023
3023
  for (const c of chunks) {
3024
- out13.set(c, off);
3024
+ out14.set(c, off);
3025
3025
  off += c.length;
3026
3026
  }
3027
- return out13;
3027
+ return out14;
3028
3028
  }
3029
3029
  function deserializeTree(bytes, { File: File4, Directory: Directory4 }) {
3030
3030
  const u8 = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes);
@@ -4280,13 +4280,13 @@ var init_kernel_provider_wasm = __esm({
4280
4280
  function concatBytes(chunks) {
4281
4281
  let n = 0;
4282
4282
  for (const c of chunks) n += c.length;
4283
- const out13 = new Uint8Array(n);
4283
+ const out14 = new Uint8Array(n);
4284
4284
  let o = 0;
4285
4285
  for (const c of chunks) {
4286
- out13.set(c, o);
4286
+ out14.set(c, o);
4287
4287
  o += c.length;
4288
4288
  }
4289
- return out13;
4289
+ return out14;
4290
4290
  }
4291
4291
  function pkt(payload) {
4292
4292
  const body = typeof payload === "string" ? enc3.encode(payload) : payload;
@@ -4490,7 +4490,7 @@ function prepareManagedPromotion(report, candidateHash, domain, opts = {}) {
4490
4490
  domainHash: candidateHash,
4491
4491
  ...opts.replaces ? { replaces: opts.replaces } : {},
4492
4492
  retireReplaced: opts.retireReplaced ?? false,
4493
- ...opts.dispositions ? { dispositions: opts.dispositions } : {},
4493
+ ...report.dispositions ? { dispositions: report.dispositions } : {},
4494
4494
  preflight
4495
4495
  }
4496
4496
  };
@@ -4506,7 +4506,6 @@ function prepareManagedRestoration(report, currentHash, priorHash, domain, opts
4506
4506
  }
4507
4507
  const acceptanceReason = opts.acceptanceReason?.trim();
4508
4508
  const prepared = prepareManagedPromotion(report, priorHash, domain, {
4509
- dispositions: report.dispositions,
4510
4509
  ...acceptanceReason ? { acceptanceReason } : {}
4511
4510
  });
4512
4511
  if (!prepared.ok) {
@@ -4593,7 +4592,7 @@ function compatible(client, workspace) {
4593
4592
  return { ok: missing.length === 0 && incompatible.length === 0, missing, incompatible };
4594
4593
  }
4595
4594
  function memberVerdicts(client, workspace) {
4596
- const out13 = {};
4595
+ const out14 = {};
4597
4596
  const cDirs = client && client.directives || {};
4598
4597
  const wDirs = workspace && workspace.directives || {};
4599
4598
  const cAggs = client && client.aggregates || {};
@@ -4601,7 +4600,7 @@ function memberVerdicts(client, workspace) {
4601
4600
  for (const [did, cShape] of Object.entries(cDirs)) {
4602
4601
  const wShape = wDirs[did];
4603
4602
  if (!wShape) {
4604
- out13[did] = { ok: false, reason: `directive '${did}' is not installed on the workspace` };
4603
+ out14[did] = { ok: false, reason: `directive '${did}' is not installed on the workspace` };
4605
4604
  continue;
4606
4605
  }
4607
4606
  const cf = cShape.fields || {};
@@ -4616,13 +4615,13 @@ function memberVerdicts(client, workspace) {
4616
4615
  const w = wf[f];
4617
4616
  if (w && w.kind !== c.kind) reasons.push(`field '${f}' kind ${c.kind} \u2260 workspace ${w.kind}`);
4618
4617
  }
4619
- out13[did] = reasons.length ? { ok: false, reason: reasons.join("; ") } : { ok: true };
4618
+ out14[did] = reasons.length ? { ok: false, reason: reasons.join("; ") } : { ok: true };
4620
4619
  }
4621
4620
  for (const [sid, cAgg] of Object.entries(cAggs)) {
4622
4621
  const label = cAgg.label || sid;
4623
4622
  const wAgg = wAggs[sid];
4624
4623
  if (!wAgg) {
4625
- out13[label] = { ok: false, reason: `aggregate '${label}' is not served by the workspace` };
4624
+ out14[label] = { ok: false, reason: `aggregate '${label}' is not served by the workspace` };
4626
4625
  continue;
4627
4626
  }
4628
4627
  const cFields = cAgg.fields || {};
@@ -4633,9 +4632,9 @@ function memberVerdicts(client, workspace) {
4633
4632
  if (!w) reasons.push(`field '${label}.${c.label || fsid}' is not served`);
4634
4633
  else if (w.kind !== c.kind) reasons.push(`field '${label}.${c.label || fsid}' read kind ${c.kind} \u2260 workspace ${w.kind}`);
4635
4634
  }
4636
- out13[label] = reasons.length ? { ok: false, reason: reasons.join("; ") } : { ok: true };
4635
+ out14[label] = reasons.length ? { ok: false, reason: reasons.join("; ") } : { ok: true };
4637
4636
  }
4638
- return out13;
4637
+ return out14;
4639
4638
  }
4640
4639
  function interfaceDomains(byDomain) {
4641
4640
  const map = byDomain && typeof byDomain === "object" ? byDomain : {};
@@ -4645,17 +4644,17 @@ function interfaceDomains(byDomain) {
4645
4644
  );
4646
4645
  }
4647
4646
  function mergeDomainInterfaces(byDomain, onlyDomains) {
4648
- const out13 = { directives: {}, aggregates: {} };
4647
+ const out14 = { directives: {}, aggregates: {} };
4649
4648
  const map = byDomain && typeof byDomain === "object" ? byDomain : {};
4650
4649
  const entries = map.directives ? [[String(map.domain ?? "?"), map]] : Object.entries(map);
4651
4650
  for (const [domain, value] of entries) {
4652
4651
  if (onlyDomains !== void 0 && !onlyDomains.has(domain)) continue;
4653
4652
  if (!value || typeof value !== "object") continue;
4654
4653
  const di = value;
4655
- Object.assign(out13.directives, di.directives || {});
4656
- Object.assign(out13.aggregates, di.aggregates || {});
4654
+ Object.assign(out14.directives, di.directives || {});
4655
+ Object.assign(out14.aggregates, di.aggregates || {});
4657
4656
  }
4658
- return out13;
4657
+ return out14;
4659
4658
  }
4660
4659
  var init_shape_compat = __esm({
4661
4660
  "../cloud/web-client/src/shape_compat.ts"() {
@@ -5036,7 +5035,14 @@ function createGovernanceOffers(ctx) {
5036
5035
  rows = JSON.parse(call("query", { queryBytes: qBytes2({ kind: "query", queryId: "relationTuplesByObject", paramsJson: JSON.stringify({ object }) }) })) || [];
5037
5036
  } else {
5038
5037
  const headers = authToken ? { Authorization: `Bearer ${authToken}`, "x-nomos-auth": authToken } : authHeaders;
5039
- const r = await _fetch(`${base}/v2/workspaces/${parent}/relationTuplesByObject?object=${encodeURIComponent(object)}`, { headers });
5038
+ const route = await resolveFrameworkRoute({
5039
+ parent,
5040
+ operationId: "relationTuplesByObject",
5041
+ method: "get",
5042
+ token: authToken,
5043
+ principal: p
5044
+ });
5045
+ const r = await _fetch(`${base}/v2/workspaces/${parent}${route.path}?object=${encodeURIComponent(object)}`, { headers });
5040
5046
  const text = await r.text();
5041
5047
  let body;
5042
5048
  try {
@@ -5090,7 +5096,14 @@ function createGovernanceOffers(ctx) {
5090
5096
  rows = JSON.parse(call("query", { queryBytes: qBytes2({ kind: "query", queryId: "relationTuplesByObject", paramsJson: JSON.stringify({ object }) }) })) || [];
5091
5097
  } else {
5092
5098
  const headers = authToken ? { Authorization: `Bearer ${authToken}`, "x-nomos-auth": authToken } : authHeaders;
5093
- const r = await _fetch(`${base}/v2/workspaces/${ws}/relationTuplesByObject?object=${encodeURIComponent(object)}`, { headers });
5099
+ const route = await resolveFrameworkRoute({
5100
+ parent: ws,
5101
+ operationId: "relationTuplesByObject",
5102
+ method: "get",
5103
+ token: authToken,
5104
+ principal: subj
5105
+ });
5106
+ const r = await _fetch(`${base}/v2/workspaces/${ws}${route.path}?object=${encodeURIComponent(object)}`, { headers });
5094
5107
  const text = await r.text();
5095
5108
  let body;
5096
5109
  try {
@@ -5687,13 +5700,13 @@ async function actorForShareQuote(quote) {
5687
5700
  function osEntropyBuffer(n) {
5688
5701
  const bytes = new Uint8Array(n * 8);
5689
5702
  crypto.getRandomValues(bytes);
5690
- const out13 = new Array(n), T = 2 ** 53;
5703
+ const out14 = new Array(n), T = 2 ** 53;
5691
5704
  for (let i = 0; i < n; i++) {
5692
5705
  let z6 = 0n;
5693
5706
  for (let b = 7; b >= 0; b--) z6 = z6 << 8n | BigInt(bytes[i * 8 + b]);
5694
- out13[i] = Number(z6 >> 11n) / T;
5707
+ out14[i] = Number(z6 >> 11n) / T;
5695
5708
  }
5696
- return out13;
5709
+ return out14;
5697
5710
  }
5698
5711
  function stringifyBig(o) {
5699
5712
  return JSON.stringify(o, (_k, v) => typeof v === "bigint" ? `@@B:${v}@@` : v).replace(/"@@B:(\d+)@@"/g, "$1");
@@ -5708,14 +5721,14 @@ async function routeTagHexOfHomeKey(homeKey) {
5708
5721
  return (await sha256hex(`nomos-route:${homeKey}`)).slice(0, 12);
5709
5722
  }
5710
5723
  function installedLawOfRows(rows) {
5711
- const out13 = [];
5724
+ const out14 = [];
5712
5725
  for (const r of rows || []) {
5713
5726
  const d = r && r.data;
5714
5727
  if (!d || d["status.phase"] !== "Active") continue;
5715
5728
  const h = d["spec.domainHash"];
5716
- if (typeof h === "string" && h && !out13.includes(h)) out13.push(h);
5729
+ if (typeof h === "string" && h && !out14.includes(h)) out14.push(h);
5717
5730
  }
5718
- return out13;
5731
+ return out14;
5719
5732
  }
5720
5733
  function lawStatusOf(installed, clientHash) {
5721
5734
  const known = Array.isArray(installed);
@@ -5740,14 +5753,14 @@ function birthOutcomeFailure(birthOutcomes) {
5740
5753
  const first = bad[0];
5741
5754
  const list = bad.map((o) => `${o.workspace || "?"} [${o.status}${o.code ? `: ${o.code}` : ""}]${o.reason ? ` \u2014 ${o.reason}` : ""}`).join("; ");
5742
5755
  const lawUnavailable = bad.some((o) => o.code === "BirthLawPackageUnavailable");
5743
- const err13 = new Error(
5756
+ const err14 = new Error(
5744
5757
  `birth incomplete: ${bad.length} child workspace(s) did NOT come up \u2014 ${list}. The parent offer admitted, but the child was not fully born, so opening it would poll head:null until timeout. ` + (lawUnavailable ? `The child's law package is not resolvable from the parent's custody \u2014 deploy it to the parent (POST /v2/workspaces/<parent>/domains) BEFORE birthing.` : `See the outcome's reason/code for the cause.`) + ` [birth-failed]`
5745
5758
  );
5746
- err13.code = first.code || "BirthFailed";
5747
- err13.status = first.status;
5748
- err13.failedBirths = bad;
5749
- err13.birthOutcomes = birthOutcomes;
5750
- return err13;
5759
+ err14.code = first.code || "BirthFailed";
5760
+ err14.status = first.status;
5761
+ err14.failedBirths = bad;
5762
+ err14.birthOutcomes = birthOutcomes;
5763
+ return err14;
5751
5764
  }
5752
5765
  async function checkCompat(holon, nomosCompat) {
5753
5766
  if (!holon || !nomosCompat || typeof nomosCompat.lawHash !== "string") return null;
@@ -6334,15 +6347,15 @@ ${String(commit).toLowerCase()}`;
6334
6347
  typeof principal === "string" && principal ? principal : typeof tokenSubject === "string" ? tokenSubject : ""
6335
6348
  );
6336
6349
  const readAuthFields = (keys, p) => {
6337
- const out13 = { nowUnix: Math.floor(Date.now() / 1e3) };
6350
+ const out14 = { nowUnix: Math.floor(Date.now() / 1e3) };
6338
6351
  const pr = typeof p === "string" && p ? p : connectionPrincipal;
6339
- if (pr) out13.principal = pr;
6352
+ if (pr) out14.principal = pr;
6340
6353
  if (activeAuthToken) {
6341
- out13.authToken = activeAuthToken;
6354
+ out14.authToken = activeAuthToken;
6342
6355
  }
6343
- if (deviceSecret) out13.authorSecret = deviceSecret;
6344
- if (Array.isArray(keys) && keys.length) out13.keys = keys;
6345
- return out13;
6356
+ if (deviceSecret) out14.authorSecret = deviceSecret;
6357
+ if (Array.isArray(keys) && keys.length) out14.keys = keys;
6358
+ return out14;
6346
6359
  };
6347
6360
  let clientLawHash;
6348
6361
  let warnedDrift = false;
@@ -6719,9 +6732,9 @@ ${String(commit).toLowerCase()}`;
6719
6732
  } catch {
6720
6733
  }
6721
6734
  const missingObject = (text.match(/\b[0-9a-f]{40}\b/) || [null])[0];
6722
- const err13 = new Error(text);
6723
- err13.code = code;
6724
- err13.errorInfo = {
6735
+ const err14 = new Error(text);
6736
+ err14.code = code;
6737
+ err14.errorInfo = {
6725
6738
  code,
6726
6739
  message: text,
6727
6740
  component: "nomos.custody",
@@ -6739,7 +6752,7 @@ ${String(commit).toLowerCase()}`;
6739
6752
  "nomos.custody.recommended_action": source === "localSnapshot" ? "quarantineLocalSnapshotAndReclone" : "refetchFullHistoryAndRetry"
6740
6753
  }
6741
6754
  };
6742
- return err13;
6755
+ return err14;
6743
6756
  };
6744
6757
  if (ckptBlobStr || ckptFrontierStr || ckptStagedFrontierFile || ckptCursor) {
6745
6758
  const _ckptSpan = span("receive", restoreFrom ? "boot: restore folded state (snapshot)" : "boot: restore checkpoint", "boot");
@@ -7311,7 +7324,7 @@ ${String(commit).toLowerCase()}`;
7311
7324
  domain,
7312
7325
  candidateHash,
7313
7326
  atHash,
7314
- ...opts.dispositions ? { dispositions: opts.dispositions } : {}
7327
+ ackBy: connectionPrincipal
7315
7328
  })
7316
7329
  }));
7317
7330
  });
@@ -7324,8 +7337,7 @@ ${String(commit).toLowerCase()}`;
7324
7337
  }
7325
7338
  const prepared = prepareManagedPromotion(report, candidateHash, domain, {
7326
7339
  ...currentHash && currentHash !== candidateHash ? { replaces: currentHash } : {},
7327
- ...opts.because !== void 0 ? { acceptanceReason: opts.because } : {},
7328
- ...opts.dispositions ? { dispositions: opts.dispositions } : {}
7340
+ ...opts.because !== void 0 ? { acceptanceReason: opts.because } : {}
7329
7341
  });
7330
7342
  if (!prepared.ok) return prepared;
7331
7343
  try {
@@ -8140,7 +8152,7 @@ ${String(commit).toLowerCase()}`;
8140
8152
  if (!deviceSecret || !connectionPrincipal) {
8141
8153
  throw new Error("owned device recovery needs a signed-in session with its persisted device credential");
8142
8154
  }
8143
- const out13 = JSON.parse(call("query", {
8155
+ const out14 = JSON.parse(call("query", {
8144
8156
  queryBytes: qBytes({
8145
8157
  op: "cryptoOwnedDeviceRequest",
8146
8158
  authorSecret: deviceSecret,
@@ -8149,7 +8161,7 @@ ${String(commit).toLowerCase()}`;
8149
8161
  scope
8150
8162
  })
8151
8163
  }));
8152
- return String(out13.request || "");
8164
+ return String(out14.request || "");
8153
8165
  };
8154
8166
  const ownedRecoveryPolicyRaw = (owner) => ownedTupleData(ownedRecoveryPolicyId(owner));
8155
8167
  const ownedRecoveryOrdersRaw = async (recoveryPrincipal) => (await ownedQueryRows("nomosOwnedRecoveryOrdersByRecoveryPrincipal", { recoveryPrincipal })).map((row) => ({ id: String(row.id || ""), ...ownedRowData(row) }));
@@ -9491,11 +9503,11 @@ ${String(commit).toLowerCase()}`;
9491
9503
  await sleep(pollMs);
9492
9504
  }
9493
9505
  if (!sawDelegation) {
9494
- const err13 = new Error(
9506
+ const err14 = new Error(
9495
9507
  `receiving-group setup: parent '${parent}' still holds NO SignerDelegation for '${owner}' after ${pollTimeoutMs}ms. enrollFirstDevice seated the device SIGNER, but the home cert chain's links[1] (the platform-signed delegation) never surfaced \u2014 the birth would come up UNWARRANTED/headless (birth-cert-not-seeded). The enroll must record the keyless delegation (enrollFirstDevice.delegationCert) BEFORE birth. [ParentSignerDelegationMissing]`
9496
9508
  );
9497
- err13.code = "ParentSignerDelegationMissing";
9498
- throw err13;
9509
+ err14.code = "ParentSignerDelegationMissing";
9510
+ throw err14;
9499
9511
  }
9500
9512
  } finally {
9501
9513
  delegationSpan.end();
@@ -9728,10 +9740,10 @@ ${String(commit).toLowerCase()}`;
9728
9740
  const off = installedInterfaceInner();
9729
9741
  if (off === null && _lastInterfaceReadError) {
9730
9742
  const e = _lastInterfaceReadError;
9731
- const err13 = new Error(`projection read failed on workspace '${workspace}': ${e.message}`);
9732
- err13.code = "nomos.projection.read_failed";
9733
- err13.errorInfo = { code: "nomos.projection.read_failed", message: e.message, component: "nomos.projection", workspace, attributes: { "nomos.projection.workspace": workspace } };
9734
- throw err13;
9743
+ const err14 = new Error(`projection read failed on workspace '${workspace}': ${e.message}`);
9744
+ err14.code = "nomos.projection.read_failed";
9745
+ err14.errorInfo = { code: "nomos.projection.read_failed", message: e.message, component: "nomos.projection", workspace, attributes: { "nomos.projection.workspace": workspace } };
9746
+ throw err14;
9735
9747
  }
9736
9748
  return off;
9737
9749
  }),
@@ -11004,12 +11016,12 @@ function routedHolon(coordinator, { cloud, workspace, clientId, authToken, fetch
11004
11016
  }
11005
11017
  async function frontierMap() {
11006
11018
  const rows = await coordinator.query("aggregatesByType", { __type: "NomosSummaryFrontier" });
11007
- const out13 = {};
11019
+ const out14 = {};
11008
11020
  for (const r of rows || []) {
11009
11021
  const d = r.data || {};
11010
- if (typeof d.shard === "string" && typeof d.frontier === "string") out13[d.shard] = d.frontier;
11022
+ if (typeof d.shard === "string" && typeof d.frontier === "string") out14[d.shard] = d.frontier;
11011
11023
  }
11012
- return out13;
11024
+ return out14;
11013
11025
  }
11014
11026
  async function scopedValue(kind, readId, groupKey, opts = {}) {
11015
11027
  if (kind === "min" || kind === "max") {
@@ -11709,15 +11721,15 @@ var init_git_fs2 = __esm({
11709
11721
  });
11710
11722
 
11711
11723
  // vendor/engine/tree.ts
11712
- function flatten2(dir, prefix, out13) {
11724
+ function flatten2(dir, prefix, out14) {
11713
11725
  const children = [...(dir.contents ?? /* @__PURE__ */ new Map()).entries()].sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0);
11714
11726
  for (const [name, inode] of children) {
11715
11727
  const path2 = prefix ? prefix + "/" + name : name;
11716
11728
  if (inode.contents instanceof Map) {
11717
- out13.push({ path: path2, dir: true });
11718
- flatten2(inode, path2, out13);
11729
+ out14.push({ path: path2, dir: true });
11730
+ flatten2(inode, path2, out14);
11719
11731
  } else {
11720
- out13.push({ path: path2, dir: false, bytes: inode.data ?? new Uint8Array(0) });
11732
+ out14.push({ path: path2, dir: false, bytes: inode.data ?? new Uint8Array(0) });
11721
11733
  }
11722
11734
  }
11723
11735
  }
@@ -11740,13 +11752,13 @@ function serializeTree2(workTree) {
11740
11752
  }
11741
11753
  let total = 0;
11742
11754
  for (const c of chunks) total += c.length;
11743
- const out13 = new Uint8Array(total);
11755
+ const out14 = new Uint8Array(total);
11744
11756
  let off = 0;
11745
11757
  for (const c of chunks) {
11746
- out13.set(c, off);
11758
+ out14.set(c, off);
11747
11759
  off += c.length;
11748
11760
  }
11749
- return out13;
11761
+ return out14;
11750
11762
  }
11751
11763
  var enc5, dec5;
11752
11764
  var init_tree2 = __esm({
@@ -11761,13 +11773,13 @@ var init_tree2 = __esm({
11761
11773
  function concatBytes2(chunks) {
11762
11774
  let n = 0;
11763
11775
  for (const c of chunks) n += c.length;
11764
- const out13 = new Uint8Array(n);
11776
+ const out14 = new Uint8Array(n);
11765
11777
  let o = 0;
11766
11778
  for (const c of chunks) {
11767
- out13.set(c, o);
11779
+ out14.set(c, o);
11768
11780
  o += c.length;
11769
11781
  }
11770
- return out13;
11782
+ return out14;
11771
11783
  }
11772
11784
  function pkt2(payload) {
11773
11785
  const body = typeof payload === "string" ? enc6.encode(payload) : payload;
@@ -12011,7 +12023,7 @@ function prepareManagedPromotion2(report, candidateHash, domain, opts = {}) {
12011
12023
  domainHash: candidateHash,
12012
12024
  ...opts.replaces ? { replaces: opts.replaces } : {},
12013
12025
  retireReplaced: opts.retireReplaced ?? false,
12014
- ...opts.dispositions ? { dispositions: opts.dispositions } : {},
12026
+ ...report.dispositions ? { dispositions: report.dispositions } : {},
12015
12027
  preflight
12016
12028
  }
12017
12029
  };
@@ -12027,7 +12039,6 @@ function prepareManagedRestoration2(report, currentHash, priorHash, domain, opts
12027
12039
  }
12028
12040
  const acceptanceReason = opts.acceptanceReason?.trim();
12029
12041
  const prepared = prepareManagedPromotion2(report, priorHash, domain, {
12030
- dispositions: report.dispositions,
12031
12042
  ...acceptanceReason ? { acceptanceReason } : {}
12032
12043
  });
12033
12044
  if (!prepared.ok) {
@@ -12285,13 +12296,13 @@ async function sha256hex2(t2) {
12285
12296
  function osEntropyBuffer2(n) {
12286
12297
  const bytes = new Uint8Array(n * 8);
12287
12298
  for (let o = 0; o < bytes.length; o += 65536) crypto.getRandomValues(bytes.subarray(o, Math.min(o + 65536, bytes.length)));
12288
- const out13 = new Array(n), T = 2 ** 53;
12299
+ const out14 = new Array(n), T = 2 ** 53;
12289
12300
  for (let i = 0; i < n; i++) {
12290
12301
  let z6 = 0n;
12291
12302
  for (let b = 7; b >= 0; b--) z6 = z6 << 8n | BigInt(bytes[i * 8 + b]);
12292
- out13[i] = Number(z6 >> 11n) / T;
12303
+ out14[i] = Number(z6 >> 11n) / T;
12293
12304
  }
12294
- return out13;
12305
+ return out14;
12295
12306
  }
12296
12307
  function callProto(ex, operation, STDERR) {
12297
12308
  const requestId = `adapter-${++protoRequestSequence2}`;
@@ -12985,15 +12996,15 @@ function contribution(read, cur) {
12985
12996
  return { group, value: typeof raw === "number" ? raw : 0 };
12986
12997
  }
12987
12998
  function contributionDiff(read, before, after) {
12988
- const out13 = [];
12999
+ const out14 = [];
12989
13000
  if (before && after && before.group === after.group) {
12990
13001
  const d = after.value - before.value;
12991
- if (d !== 0) out13.push({ readId: read.id, group: after.group, delta: d });
12992
- return out13;
13002
+ if (d !== 0) out14.push({ readId: read.id, group: after.group, delta: d });
13003
+ return out14;
12993
13004
  }
12994
- if (before) out13.push({ readId: read.id, group: before.group, delta: -before.value });
12995
- if (after) out13.push({ readId: read.id, group: after.group, delta: after.value });
12996
- return out13.filter((d) => d.delta !== 0);
13005
+ if (before) out14.push({ readId: read.id, group: before.group, delta: -before.value });
13006
+ if (after) out14.push({ readId: read.id, group: after.group, delta: after.value });
13007
+ return out14.filter((d) => d.delta !== 0);
12997
13008
  }
12998
13009
  function countTenantRows(eng, ws) {
12999
13010
  let total = 0;
@@ -13006,16 +13017,16 @@ async function countTenantRowsByHome(eng, ws, homeKeys) {
13006
13017
  const keySet = new Set(homeKeys);
13007
13018
  const tagOf = /* @__PURE__ */ new Map();
13008
13019
  for (const hk of homeKeys) tagOf.set(await routeTagHexOfHomeKey2(hk), hk);
13009
- const out13 = /* @__PURE__ */ new Map();
13010
- for (const hk of homeKeys) out13.set(hk, 0);
13020
+ const out14 = /* @__PURE__ */ new Map();
13021
+ for (const hk of homeKeys) out14.set(hk, 0);
13011
13022
  for (const type of tenantTypes(eng)) {
13012
13023
  for (const r of query2(eng, ws, "aggregatesByType", JSON.stringify({ __type: type }))) {
13013
13024
  const id = String(r.id || "");
13014
13025
  const hk = keySet.has(id) ? id : tagOf.get(routeTagHexOfMintedId(id) ?? "");
13015
- if (hk !== void 0) out13.set(hk, (out13.get(hk) ?? 0) + 1);
13026
+ if (hk !== void 0) out14.set(hk, (out14.get(hk) ?? 0) + 1);
13016
13027
  }
13017
13028
  }
13018
- return out13;
13029
+ return out14;
13019
13030
  }
13020
13031
  async function collectHomedIntents(eng, ws, homeKeys) {
13021
13032
  const routes = directiveRoutes(eng);
@@ -13040,7 +13051,7 @@ async function collectHomedIntents(eng, ws, homeKeys) {
13040
13051
  strikeParity.set(target, (strikeParity.get(target) ?? 0) + 1);
13041
13052
  }
13042
13053
  }
13043
- const out13 = [];
13054
+ const out14 = [];
13044
13055
  for (const { oid, blob, doc } of docs) {
13045
13056
  const id = doc && typeof doc.id === "string" ? doc.id : null;
13046
13057
  if (!id || (strikeParity.get(id) ?? 0) % 2 === 1) continue;
@@ -13056,9 +13067,9 @@ async function collectHomedIntents(eng, ws, homeKeys) {
13056
13067
  const tag = routeTagHexOfMintedId(value);
13057
13068
  homeKey = tag !== void 0 ? tagOf.get(tag) ?? null : null;
13058
13069
  }
13059
- if (homeKey !== null) out13.push({ oid, id, homeKey, blob });
13070
+ if (homeKey !== null) out14.push({ oid, id, homeKey, blob });
13060
13071
  }
13061
- return out13;
13072
+ return out14;
13062
13073
  }
13063
13074
  async function migrateHomes(eng, ws, ledger, sourceWs, homeKeys, { onlyIds = null } = {}) {
13064
13075
  const wanted = onlyIds ? new Set(onlyIds) : null;
@@ -13167,7 +13178,7 @@ async function collectGlobalIntents(eng, ws) {
13167
13178
  strikeParity.set(target, (strikeParity.get(target) ?? 0) + 1);
13168
13179
  }
13169
13180
  }
13170
- const out13 = [];
13181
+ const out14 = [];
13171
13182
  for (const { oid, blob, doc } of docs) {
13172
13183
  const id = doc && typeof doc.id === "string" ? doc.id : null;
13173
13184
  let touches = false;
@@ -13178,9 +13189,9 @@ async function collectGlobalIntents(eng, ws) {
13178
13189
  if (t2 !== void 0 && globals.has(t2)) touches = true;
13179
13190
  }
13180
13191
  if (!touches || !id || (strikeParity.get(id) ?? 0) % 2 === 1) continue;
13181
- out13.push({ oid, id, blob });
13192
+ out14.push({ oid, id, blob });
13182
13193
  }
13183
- return out13;
13194
+ return out14;
13184
13195
  }
13185
13196
  async function replicateIntents(eng, ws, ledger, intents, { push = true } = {}) {
13186
13197
  const main2 = await mainIntentIds(eng, ws);
@@ -13537,7 +13548,7 @@ async function mountWorkspace(eng, ws, ledger) {
13537
13548
  throw new Error(`kernel refused restored main ${remoteMain}: ${JSON.stringify(mounted)}`);
13538
13549
  }
13539
13550
  restored = true;
13540
- if (!seeded?.seeded) {
13551
+ if (!seeded?.seeded && ledger.readOnly !== true) {
13541
13552
  void pushCheckpoint(eng, ws, ledger).catch(() => {
13542
13553
  });
13543
13554
  }
@@ -13609,8 +13620,8 @@ function stageLawClosure(eng, lawUsdz, label = "candidate-law") {
13609
13620
  }, "lawClosureInfo");
13610
13621
  }
13611
13622
  function currentLaw(eng, ws) {
13612
- const out13 = namedQueryProto(eng, ws, QueryOperation2.CURRENT_LAW);
13613
- return out13.keyMap || {};
13623
+ const out14 = namedQueryProto(eng, ws, QueryOperation2.CURRENT_LAW);
13624
+ return out14.keyMap || {};
13614
13625
  }
13615
13626
  function installedLaw(eng, ws) {
13616
13627
  return namedQueryProto(eng, ws, QueryOperation2.INSTALLED_LAW);
@@ -13622,8 +13633,8 @@ function kernelStamp(eng, ws) {
13622
13633
  return namedQueryProto(eng, ws, QueryOperation2.KERNEL_STAMP);
13623
13634
  }
13624
13635
  function declaredCapabilities(eng, ws) {
13625
- const out13 = namedQueryProto(eng, ws, QueryOperation2.DECLARED_CAPABILITIES);
13626
- return out13.capabilities || [];
13636
+ const out14 = namedQueryProto(eng, ws, QueryOperation2.DECLARED_CAPABILITIES);
13637
+ return out14.capabilities || [];
13627
13638
  }
13628
13639
  function outboundOffers(eng, ws, nowMillis = Date.now()) {
13629
13640
  const response = callProto(eng.ex, {
@@ -13664,8 +13675,8 @@ function evolveDryRun(eng, ws, lawUsdz, domainHash, dispositions2 = null) {
13664
13675
  return r.ok ? { admits: true } : { admits: false, detail: r.error };
13665
13676
  }
13666
13677
  function mintId(eng, typeTag) {
13667
- const out13 = namedQueryProto(eng, "root", QueryOperation2.MINT, { typeTag, nowMillis: Date.now() });
13668
- return out13.id;
13678
+ const out14 = namedQueryProto(eng, "root", QueryOperation2.MINT, { typeTag, nowMillis: Date.now() });
13679
+ return out14.id;
13669
13680
  }
13670
13681
  function author(eng, ws, domain, directiveId, payload, controllerHash, opts = {}) {
13671
13682
  const seq = eng.seq++;
@@ -13853,13 +13864,13 @@ async function streamAll(stream) {
13853
13864
  }
13854
13865
  let len = 0;
13855
13866
  for (const c of chunks) len += c.length;
13856
- const out13 = new Uint8Array(len);
13867
+ const out14 = new Uint8Array(len);
13857
13868
  let at = 0;
13858
13869
  for (const c of chunks) {
13859
- out13.set(c, at);
13870
+ out14.set(c, at);
13860
13871
  at += c.length;
13861
13872
  }
13862
- return out13;
13873
+ return out14;
13863
13874
  }
13864
13875
  async function gzip(bytes) {
13865
13876
  const cs = new CompressionStream("gzip");
@@ -14698,12 +14709,12 @@ async function verifyChain(eng, ws, ledger) {
14698
14709
  function verifyChainLocal(eng, ws) {
14699
14710
  return namedQueryProto(eng, ws, QueryOperation2.VERIFY_CHAIN);
14700
14711
  }
14701
- function historyPreflight(eng, ws, domain, candidateHash, atHash, dispositions2) {
14712
+ function historyPreflight(eng, ws, domain, candidateHash, atHash, actor = "") {
14702
14713
  return namedQueryProto(eng, ws, QueryOperation2.HISTORY_PREFLIGHT, {
14703
14714
  domain,
14704
14715
  candidateHash,
14705
14716
  atHash,
14706
- ...dispositions2 ? { dispositions: dispositions2 } : {}
14717
+ ...actor.trim() ? { ackBy: actor.trim() } : {}
14707
14718
  });
14708
14719
  }
14709
14720
  function historyRestorePreflight(eng, ws, domain, currentHash, priorHash, atHash, actor) {
@@ -14730,7 +14741,7 @@ function promotePreflighted(eng, ws, domain, candidateHash, opts = {}) {
14730
14741
  }
14731
14742
  let report;
14732
14743
  try {
14733
- report = historyPreflight(eng, ws, domain, candidateHash, atHash, opts.dispositions);
14744
+ report = historyPreflight(eng, ws, domain, candidateHash, atHash, actingPrincipal);
14734
14745
  } catch (error) {
14735
14746
  return { ok: false, stage: "preflight", error: String(error?.message || error) };
14736
14747
  }
@@ -14739,7 +14750,6 @@ function promotePreflighted(eng, ws, domain, candidateHash, opts = {}) {
14739
14750
  const {
14740
14751
  replaces: _replaces,
14741
14752
  retireReplaced: _retireReplaced,
14742
- dispositions: _dispositions,
14743
14753
  acceptanceReason: _acceptance,
14744
14754
  ...authorOpts
14745
14755
  } = opts;
@@ -15044,17 +15054,17 @@ async function writeRefusedRef(eng, ws, dl) {
15044
15054
  async function listRefusedRefs(eng, ws) {
15045
15055
  const gitdir = gitdirOf(ws);
15046
15056
  const refs = kgit.listRefs(eng, gitdir, "refs/heads/refused/");
15047
- const out13 = [];
15057
+ const out14 = [];
15048
15058
  for (const { ref, oid } of refs) {
15049
15059
  try {
15050
15060
  const vb = kgit.readBlob(eng, gitdir, oid, "verdict.usda") ?? new Uint8Array();
15051
15061
  const ib = kgit.readBlob(eng, gitdir, oid, "change.usda") ?? new Uint8Array();
15052
15062
  const v = kgit.inspectRefusalVerdict(eng, vb);
15053
- out13.push({ ref, ...v, verdict: { reason: v.reason }, changeB64: b64Bytes(ib) });
15063
+ out14.push({ ref, ...v, verdict: { reason: v.reason }, changeB64: b64Bytes(ib) });
15054
15064
  } catch {
15055
15065
  }
15056
15066
  }
15057
- return out13;
15067
+ return out14;
15058
15068
  }
15059
15069
  async function refusedSummary(eng, ws) {
15060
15070
  const gitdir = gitdirOf(ws);
@@ -15193,9 +15203,9 @@ async function ledgerStats(eng, ws, ledger = null) {
15193
15203
  const mounted = eng.mounted.get(ws);
15194
15204
  if (mounted && mounted.ledgerStats?.head === head) return mounted.ledgerStats;
15195
15205
  const commits = kgit.intentsAbove(eng, gitdir, head).length;
15196
- const out13 = { head, commits };
15197
- if (mounted) mounted.ledgerStats = out13;
15198
- return out13;
15206
+ const out14 = { head, commits };
15207
+ if (mounted) mounted.ledgerStats = out14;
15208
+ return out14;
15199
15209
  }
15200
15210
  async function countRemoteCommits(eng, ledger) {
15201
15211
  const head = (await custodyLsRefs(ledger, "refs/heads/main"))["refs/heads/main"] || null;
@@ -19563,7 +19573,7 @@ __export(mcp_exports, {
19563
19573
  toolEvolvePreview: () => toolEvolvePreview
19564
19574
  });
19565
19575
  import { spawnSync as spawnSync5 } from "node:child_process";
19566
- import { existsSync as existsSync11 } from "node:fs";
19576
+ import { existsSync as existsSync12 } from "node:fs";
19567
19577
  import { dirname as dirname7, isAbsolute as isAbsolute2, resolve as resolve4 } from "node:path";
19568
19578
  function resolveConfig(config) {
19569
19579
  const arg = config ?? "nomos.project.ts";
@@ -19642,7 +19652,7 @@ function extractDispositions(humanReport) {
19642
19652
  }
19643
19653
  function toolCheck(args) {
19644
19654
  const { configPath } = resolveConfig(args.config);
19645
- if (!existsSync11(configPath)) {
19655
+ if (!existsSync12(configPath)) {
19646
19656
  return { text: `nomos_check: config not found: ${configPath}`, isError: true };
19647
19657
  }
19648
19658
  const extra = args.against !== void 0 ? ["--against", args.against] : [];
@@ -19659,11 +19669,11 @@ ${JSON.stringify(payload, null, 2)}`, isError: false };
19659
19669
  }
19660
19670
  function toolEvolvePreview(args) {
19661
19671
  const { configPath } = resolveConfig(args.config);
19662
- if (!existsSync11(configPath)) {
19672
+ if (!existsSync12(configPath)) {
19663
19673
  return { text: `nomos_evolve_preview: config not found: ${configPath}`, isError: true };
19664
19674
  }
19665
19675
  const againstPath = isAbsolute2(args.against) ? args.against : resolve4(dirname7(configPath), args.against);
19666
- const priorArg = existsSync11(againstPath) ? againstPath : args.against;
19676
+ const priorArg = existsSync12(againstPath) ? againstPath : args.against;
19667
19677
  const jsonRun = runCheckJson(configPath, ["--against", priorArg]);
19668
19678
  if (jsonRun.error !== void 0) {
19669
19679
  return {
@@ -19826,7 +19836,7 @@ __export(test_exports, {
19826
19836
  runDartTests: () => runDartTests
19827
19837
  });
19828
19838
  import { spawnSync as spawnSync6 } from "node:child_process";
19829
- import { existsSync as existsSync12 } from "node:fs";
19839
+ import { existsSync as existsSync13 } from "node:fs";
19830
19840
  import { dirname as dirname8, resolve as resolve5 } from "node:path";
19831
19841
  import { fileURLToPath as fileURLToPath2 } from "node:url";
19832
19842
  function resolveTestCloudEntry(options = {}) {
@@ -19835,7 +19845,7 @@ function resolveTestCloudEntry(options = {}) {
19835
19845
  const explicit = environment.NOMOS_TEST_CLOUD_ENTRY;
19836
19846
  if (explicit !== void 0) {
19837
19847
  const candidate = resolve5(cwd, explicit);
19838
- if (!existsSync12(candidate)) {
19848
+ if (!existsSync13(candidate)) {
19839
19849
  throw new Error(`NOMOS_TEST_CLOUD_ENTRY does not exist: ${candidate}`);
19840
19850
  }
19841
19851
  return candidate;
@@ -19847,7 +19857,7 @@ function resolveTestCloudEntry(options = {}) {
19847
19857
  resolve5(here, "../../cloud/dev-server/server.ts"),
19848
19858
  resolve5(cwd, "cloud/dev-server/server.ts")
19849
19859
  ];
19850
- const server = candidates.find((candidate) => existsSync12(candidate));
19860
+ const server = candidates.find((candidate) => existsSync13(candidate));
19851
19861
  if (server === void 0) {
19852
19862
  throw new Error("the bundled local Nomos cloud is missing \u2014 rebuild or reinstall githolon");
19853
19863
  }
@@ -19894,8 +19904,8 @@ __export(harness_exports, {
19894
19904
  harnessInstall: () => harnessInstall,
19895
19905
  looksLikeStaleRuntime: () => looksLikeStaleRuntime
19896
19906
  });
19897
- import { existsSync as existsSync13, readFileSync as readFileSync11, writeFileSync as writeFileSync8 } from "node:fs";
19898
- import { join as join14 } from "node:path";
19907
+ import { existsSync as existsSync14, readFileSync as readFileSync11, writeFileSync as writeFileSync8 } from "node:fs";
19908
+ import { join as join15 } from "node:path";
19899
19909
  import { randomBytes as randomBytes3 } from "node:crypto";
19900
19910
  function looksLikeStaleRuntime(msg) {
19901
19911
  return /\bbbox param\b|missing.*param|non-numeric|unknown (op|query op)|unsupported op|unexpected (field|key)|no such op/i.test(
@@ -19905,14 +19915,14 @@ function looksLikeStaleRuntime(msg) {
19905
19915
  async function harnessInstall(opts) {
19906
19916
  const { law: lawPaths, workspace, out: outPath } = opts;
19907
19917
  if (lawPaths.length === 0) die("no --law .law.usdz path(s) given");
19908
- const runtimeDir = opts.runtime || process.env["NOMOS_CANDIDATE_RUNTIME"] || process.env["NOMOS_OFFLINE_RUNTIME"] || join14(configDir(), "runtime");
19918
+ const runtimeDir = opts.runtime || process.env["NOMOS_CANDIDATE_RUNTIME"] || process.env["NOMOS_OFFLINE_RUNTIME"] || join15(configDir(), "runtime");
19909
19919
  const refreshed = await refreshRuntimeDir(cloudBase(), runtimeDir);
19910
19920
  if (refreshed) process.stderr.write(`harness-install: refreshed runtime cache from the cloud \u2192 ${runtimeDir}
19911
19921
  `);
19912
- const wasmFile = join14(runtimeDir, "holon-testmint.wasm");
19913
- const bootstrapFile = join14(runtimeDir, "bootstrap.law.usdz");
19914
- const nomosFile = join14(runtimeDir, "nomos.law.usdz");
19915
- if (!existsSync13(wasmFile) || !existsSync13(bootstrapFile) || !existsSync13(nomosFile)) {
19922
+ const wasmFile = join15(runtimeDir, "holon-testmint.wasm");
19923
+ const bootstrapFile = join15(runtimeDir, "bootstrap.law.usdz");
19924
+ const nomosFile = join15(runtimeDir, "nomos.law.usdz");
19925
+ if (!existsSync14(wasmFile) || !existsSync14(bootstrapFile) || !existsSync14(nomosFile)) {
19916
19926
  die(
19917
19927
  `test runtime cache missing at ${runtimeDir} (holon-testmint.wasm + bootstrap.law.usdz + nomos.law.usdz). Warm it once with a \`githolon\` run (it fetches + caches the runtime), then re-run offline.`
19918
19928
  );
@@ -20051,23 +20061,23 @@ async function doctor(opts = {}) {
20051
20061
  const cloud = cloudBase(opts.cloud);
20052
20062
  const localLaw = await readLocalLaw(process.cwd(), cloud, opts.file);
20053
20063
  const report = await probeKernelCapabilities(cloud);
20054
- const out13 = [];
20055
- out13.push(`githolon doctor \u2014 release coherence`);
20056
- out13.push(` cloud : ${cloud}`);
20057
- out13.push(` local law : ${localLaw ? `${localLaw.identity.slice(0, 16)}\u2026 (${localLaw.domains.join(", ") || "no domains"})` : "(not admitted \u2014 run `githolon compile` or inspect the error with `githolon deploy`)"}`);
20058
- out13.push(` runner : cloud expects bundle version ${report?.expectedBundleVersion ?? "(not advertised)"}`);
20059
- out13.push(stampLine("prod kernel", report?.prod));
20060
- out13.push(stampLine("test kernel", report?.testmint));
20064
+ const out14 = [];
20065
+ out14.push(`githolon doctor \u2014 release coherence`);
20066
+ out14.push(` cloud : ${cloud}`);
20067
+ out14.push(` local law : ${localLaw ? `${localLaw.identity.slice(0, 16)}\u2026 (${localLaw.domains.join(", ") || "no domains"})` : "(not admitted \u2014 run `githolon compile` or inspect the error with `githolon deploy`)"}`);
20068
+ out14.push(` runner : cloud expects bundle version ${report?.expectedBundleVersion ?? "(not advertised)"}`);
20069
+ out14.push(stampLine("prod kernel", report?.prod));
20070
+ out14.push(stampLine("test kernel", report?.testmint));
20061
20071
  if (!localLaw) {
20062
- out13.push(``);
20063
- out13.push(` \u26A0 no local build found \u2014 cannot check the law\u2194kernel fit. Run \`githolon compile\` first.`);
20064
- process.stdout.write(out13.join("\n") + "\n");
20072
+ out14.push(``);
20073
+ out14.push(` \u26A0 no local build found \u2014 cannot check the law\u2194kernel fit. Run \`githolon compile\` first.`);
20074
+ process.stdout.write(out14.join("\n") + "\n");
20065
20075
  return report ? 0 : 1;
20066
20076
  }
20067
- out13.push(``);
20068
- out13.push(` \u2713 ARCHIVE COHERENT \u2014 the selected kernel admitted and composed ${localLaw.identity.slice(0, 16)}\u2026 directly from typed USDA.`);
20069
- out13.push(` Full schema/projection compatibility is enforced again by the ordinary install offer.`);
20070
- process.stdout.write(out13.join("\n") + "\n");
20077
+ out14.push(``);
20078
+ out14.push(` \u2713 ARCHIVE COHERENT \u2014 the selected kernel admitted and composed ${localLaw.identity.slice(0, 16)}\u2026 directly from typed USDA.`);
20079
+ out14.push(` Full schema/projection compatibility is enforced again by the ordinary install offer.`);
20080
+ process.stdout.write(out14.join("\n") + "\n");
20071
20081
  return 0;
20072
20082
  }
20073
20083
  var init_doctor = __esm({
@@ -20496,11 +20506,11 @@ function bareTypeLabel(t2) {
20496
20506
  return i > 0 && i < t2.length - 1 ? t2.slice(i + 1) : t2;
20497
20507
  }
20498
20508
  function geoFieldsOfInstalls(installs) {
20499
- const out13 = /* @__PURE__ */ new Map();
20509
+ const out14 = /* @__PURE__ */ new Map();
20500
20510
  const add2 = (type, field) => {
20501
- const set2 = out13.get(type) ?? /* @__PURE__ */ new Set();
20511
+ const set2 = out14.get(type) ?? /* @__PURE__ */ new Set();
20502
20512
  set2.add(field);
20503
- out13.set(type, set2);
20513
+ out14.set(type, set2);
20504
20514
  };
20505
20515
  for (const inst of installs) {
20506
20516
  for (const layer of inst.layers) {
@@ -20516,7 +20526,7 @@ function geoFieldsOfInstalls(installs) {
20516
20526
  }
20517
20527
  }
20518
20528
  }
20519
- return out13;
20529
+ return out14;
20520
20530
  }
20521
20531
  function pointOfOpValue(setOp) {
20522
20532
  let v = setOp["Json"];
@@ -21141,8 +21151,8 @@ var scene_exports = {};
21141
21151
  __export(scene_exports, {
21142
21152
  scene: () => scene
21143
21153
  });
21144
- import { existsSync as existsSync14, mkdirSync as mkdirSync6, writeFileSync as writeFileSync9 } from "node:fs";
21145
- import { join as join15, resolve as resolve6 } from "node:path";
21154
+ import { existsSync as existsSync15, mkdirSync as mkdirSync6, writeFileSync as writeFileSync9 } from "node:fs";
21155
+ import { join as join16, resolve as resolve6 } from "node:path";
21146
21156
  import { createHash as createHash5 } from "node:crypto";
21147
21157
  async function walkChain2(eng, ws) {
21148
21158
  const gitdir = gitdirOf(ws);
@@ -21157,8 +21167,8 @@ async function projectOnce(cloud, target, isDir, name) {
21157
21167
  const { eng } = await holonEngine(cloud, "githolon-scene");
21158
21168
  const SOURCE3 = "source";
21159
21169
  if (isDir) {
21160
- const gitDir = existsSync14(join15(target, ".git")) ? join15(target, ".git") : target;
21161
- if (!existsSync14(join15(gitDir, "HEAD"))) throw new Error(`${target} is not a git repo (no HEAD)`);
21170
+ const gitDir = existsSync15(join16(target, ".git")) ? join16(target, ".git") : target;
21171
+ if (!existsSync15(join16(gitDir, "HEAD"))) throw new Error(`${target} is not a git repo (no HEAD)`);
21162
21172
  await mountFresh(eng, SOURCE3);
21163
21173
  eng.preopen.dir.contents.get("ws").contents.get(SOURCE3).contents.set("nomos.git", readTreeFromDisk(gitDir));
21164
21174
  } else {
@@ -21217,44 +21227,44 @@ async function projectOnce(cloud, target, isDir, name) {
21217
21227
  }
21218
21228
  async function scene(target, opts) {
21219
21229
  const cloud = cloudBase(opts.cloud);
21220
- const isDir = existsSync14(target) || target.includes("/") || target.startsWith(".");
21230
+ const isDir = existsSync15(target) || target.includes("/") || target.startsWith(".");
21221
21231
  const name = isDir ? (resolve6(target).split("/").filter(Boolean).pop() ?? "scene").replace(/\.git$/, "") : target;
21222
- out11(`scene \u2014 ${name} (${isDir ? resolve6(target) : `${cloud} :: ${target}`})`);
21232
+ out12(`scene \u2014 ${name} (${isDir ? resolve6(target) : `${cloud} :: ${target}`})`);
21223
21233
  let first, second;
21224
21234
  try {
21225
21235
  first = await projectOnce(cloud, target, isDir, name);
21226
21236
  second = await projectOnce(cloud, target, isDir, name);
21227
21237
  } catch (e) {
21228
- err11(String(e.message ?? e));
21238
+ err12(String(e.message ?? e));
21229
21239
  return 1;
21230
21240
  }
21231
21241
  if (first.usda !== second.usda) {
21232
- err11(`two replays of the SAME chain emitted DIFFERENT bytes \u2014 the projector is nondeterministic (refusing to write)`);
21242
+ err12(`two replays of the SAME chain emitted DIFFERENT bytes \u2014 the projector is nondeterministic (refusing to write)`);
21233
21243
  return 1;
21234
21244
  }
21235
21245
  const violations = lintPortableProfile(first.usda);
21236
21246
  if (violations.length > 0) {
21237
- err11(`the emitted stage violates the portable profile: ${violations.join("; ")}`);
21247
+ err12(`the emitted stage violates the portable profile: ${violations.join("; ")}`);
21238
21248
  return 1;
21239
21249
  }
21240
- const outDir = resolve6(opts.out ?? join15("scene", name));
21250
+ const outDir = resolve6(opts.out ?? join16("scene", name));
21241
21251
  mkdirSync6(outDir, { recursive: true });
21242
- const usdaPath = join15(outDir, `${name}.usda`);
21243
- const usdzPath = join15(outDir, `${name}.usdz`);
21252
+ const usdaPath = join16(outDir, `${name}.usda`);
21253
+ const usdzPath = join16(outDir, `${name}.usdz`);
21244
21254
  const usdaBytes = new TextEncoder().encode(first.usda);
21245
21255
  writeFileSync9(usdaPath, usdaBytes);
21246
21256
  writeFileSync9(usdzPath, usdzPack([[`${name}.usda`, usdaBytes]]));
21247
21257
  const s = first.stats;
21248
- out11(` verify_chain ${s.verdictLine}`);
21249
- out11(` law canopy ${s.nodes} node(s), ${s.edges} edge(s) \u2014 from the chain's own installed packages`);
21250
- out11(` chain tier ${s.frames} frame(s), timeCodes 0..${s.endT} (timeCode = chain index)`);
21251
- out11(` determinism two fresh replays \u2192 BYTE-IDENTICAL sha256 ${sha256(first.usda).slice(0, 16)}\u2026`);
21252
- out11(` profile portable (Mesh-only, UsdPreviewSurface, translate/scale/visibility timeSamples)`);
21253
- out11(` \u2192 ${usdaPath} (${usdaBytes.length} bytes)`);
21254
- out11(` \u2192 ${usdzPath}`);
21258
+ out12(` verify_chain ${s.verdictLine}`);
21259
+ out12(` law canopy ${s.nodes} node(s), ${s.edges} edge(s) \u2014 from the chain's own installed packages`);
21260
+ out12(` chain tier ${s.frames} frame(s), timeCodes 0..${s.endT} (timeCode = chain index)`);
21261
+ out12(` determinism two fresh replays \u2192 BYTE-IDENTICAL sha256 ${sha256(first.usda).slice(0, 16)}\u2026`);
21262
+ out12(` profile portable (Mesh-only, UsdPreviewSurface, translate/scale/visibility timeSamples)`);
21263
+ out12(` \u2192 ${usdaPath} (${usdaBytes.length} bytes)`);
21264
+ out12(` \u2192 ${usdzPath}`);
21255
21265
  return s.verdictLine.startsWith("GREEN") ? 0 : 2;
21256
21266
  }
21257
- var out11, err11, sha256;
21267
+ var out12, err12, sha256;
21258
21268
  var init_scene = __esm({
21259
21269
  "src/scene.ts"() {
21260
21270
  "use strict";
@@ -21262,8 +21272,8 @@ var init_scene = __esm({
21262
21272
  init_cloud();
21263
21273
  init_local_holon();
21264
21274
  init_scene_projector();
21265
- out11 = (s) => void process.stdout.write(s + "\n");
21266
- err11 = (s) => void process.stderr.write("error: " + s + "\n");
21275
+ out12 = (s) => void process.stdout.write(s + "\n");
21276
+ err12 = (s) => void process.stderr.write("error: " + s + "\n");
21267
21277
  sha256 = (s) => createHash5("sha256").update(s).digest("hex");
21268
21278
  }
21269
21279
  });
@@ -21297,42 +21307,42 @@ async function dlqSweep(ws, opts = {}) {
21297
21307
  const res = await fetch(url);
21298
21308
  body = await res.json();
21299
21309
  if (body.ok !== true || body.root === void 0) {
21300
- err12(`dlq sweep refused: ${String(body.error ?? "no sweep in the response").slice(0, 300)}`);
21310
+ err13(`dlq sweep refused: ${String(body.error ?? "no sweep in the response").slice(0, 300)}`);
21301
21311
  return 1;
21302
21312
  }
21303
21313
  } catch (e) {
21304
- err12(`dlq sweep failed against ${cloud}: ${e.message}`);
21314
+ err13(`dlq sweep failed against ${cloud}: ${e.message}`);
21305
21315
  return 1;
21306
21316
  }
21307
21317
  if (opts.json === true) {
21308
- out12(JSON.stringify(body, null, 2));
21318
+ out13(JSON.stringify(body, null, 2));
21309
21319
  return body.jammed ? 2 : 0;
21310
21320
  }
21311
- out12(`DLQ sweep of '${ws}' \u2014 ${body.nodes} node(s), ${body.jammed} jammed`);
21312
- for (const line of renderSweepNode(body.root)) out12(line);
21321
+ out13(`DLQ sweep of '${ws}' \u2014 ${body.nodes} node(s), ${body.jammed} jammed`);
21322
+ for (const line of renderSweepNode(body.root)) out13(line);
21313
21323
  if (body.jammed) {
21314
- out12("");
21315
- out12("unjam: fix/deploy the law on the jammed workspace, then POST /v2/workspaces/<node>/dead-letters/retry");
21316
- out12(" (or from the app: holon.retryDeadLetter(id); discard is the app's explicit choice)");
21324
+ out13("");
21325
+ out13("unjam: fix/deploy the law on the jammed workspace, then POST /v2/workspaces/<node>/dead-letters/retry");
21326
+ out13(" (or from the app: holon.retryDeadLetter(id); discard is the app's explicit choice)");
21317
21327
  }
21318
21328
  return body.jammed ? 2 : 0;
21319
21329
  }
21320
- var out12, err12;
21330
+ var out13, err13;
21321
21331
  var init_dlq = __esm({
21322
21332
  "src/dlq.ts"() {
21323
21333
  "use strict";
21324
21334
  init_cloud();
21325
- out12 = (s) => void process.stdout.write(s + "\n");
21326
- err12 = (s) => void process.stderr.write("error: " + s + "\n");
21335
+ out13 = (s) => void process.stdout.write(s + "\n");
21336
+ err13 = (s) => void process.stderr.write("error: " + s + "\n");
21327
21337
  }
21328
21338
  });
21329
21339
 
21330
21340
  // src/cli.ts
21331
- import { existsSync as existsSync15, readdirSync as readdirSync6, readFileSync as readFileSync12 } from "node:fs";
21341
+ import { existsSync as existsSync16, readdirSync as readdirSync6, readFileSync as readFileSync12 } from "node:fs";
21332
21342
  import { spawn as spawn2, spawnSync as spawnSync7 } from "node:child_process";
21333
21343
  import { createHash as createHash6 } from "node:crypto";
21334
21344
  import { createRequire as createRequire3 } from "node:module";
21335
- import { dirname as dirname9, join as join16, resolve as resolve7 } from "node:path";
21345
+ import { dirname as dirname9, join as join17, resolve as resolve7 } from "node:path";
21336
21346
  import { pathToFileURL as pathToFileURL5, fileURLToPath as fileURLToPath3 } from "node:url";
21337
21347
 
21338
21348
  // src/generate.ts
@@ -23093,8 +23103,8 @@ function runRelationBootstrapLeg(eng, ws, lawHash, rb, reuseJourneyState = false
23093
23103
  const t0 = performance.now();
23094
23104
  const lines = [];
23095
23105
  const done = (ok, error) => ({ ok, ms: performance.now() - t0, legs: lines, ...error !== void 0 ? { error } : {} });
23096
- const ACTOR = journey.actor ?? "user:proof-conformance";
23097
- const BARE_ACTOR = ACTOR.replace(/^user:/, "");
23106
+ const ACTOR2 = journey.actor ?? "user:proof-conformance";
23107
+ const BARE_ACTOR = ACTOR2.replace(/^user:/, "");
23098
23108
  const stamp = (/* @__PURE__ */ new Date()).toISOString();
23099
23109
  const grantedRelation = rb.grantedRelation ?? rb.relation;
23100
23110
  const computed = grantedRelation !== rb.relation;
@@ -23105,12 +23115,12 @@ function runRelationBootstrapLeg(eng, ws, lawHash, rb, reuseJourneyState = false
23105
23115
  authorities.add(grantedRelation);
23106
23116
  };
23107
23117
  if (rb.bornContext !== void 0) {
23108
- return runBornContextLeg(eng, ws, lawHash, rb, ACTOR, stamp, reuseJourneyState, journey);
23118
+ return runBornContextLeg(eng, ws, lawHash, rb, ACTOR2, stamp, reuseJourneyState, journey);
23109
23119
  }
23110
23120
  if (reuseJourneyState && journey.domain === rb.domain && journey.workspace !== void 0) {
23111
23121
  ws = journey.workspace;
23112
23122
  }
23113
- const actorOpts = journey.authorSecret === void 0 ? { actor: ACTOR } : { actor: ACTOR, authorSecret: journey.authorSecret };
23123
+ const actorOpts = journey.authorSecret === void 0 ? { actor: ACTOR2 } : { actor: ACTOR2, authorSecret: journey.authorSecret };
23114
23124
  if (rb.via === "unrestricted") reuseJourneyState = true;
23115
23125
  if (reuseJourneyState) {
23116
23126
  let retainedPreconditionsReady = true;
@@ -23187,7 +23197,7 @@ function runRelationBootstrapLeg(eng, ws, lawHash, rb, reuseJourneyState = false
23187
23197
  ws,
23188
23198
  lawHash,
23189
23199
  rb.granterAuthority,
23190
- ACTOR,
23200
+ ACTOR2,
23191
23201
  stamp,
23192
23202
  lines,
23193
23203
  journey.authorSecret
@@ -23205,7 +23215,7 @@ function runRelationBootstrapLeg(eng, ws, lawHash, rb, reuseJourneyState = false
23205
23215
  const wrappedSet = new Set(wrapped);
23206
23216
  for (const k of Object.keys(payload)) {
23207
23217
  if (wrappedSet.has(k)) payload[k] = BARE_ACTOR;
23208
- else if (set2.has(k) || /^(subject|principal|grantedBy|grantee|member|user|owner|founder)$/i.test(k)) payload[k] = ACTOR;
23218
+ else if (set2.has(k) || /^(subject|principal|grantedBy|grantee|member|user|owner|founder)$/i.test(k)) payload[k] = ACTOR2;
23209
23219
  }
23210
23220
  };
23211
23221
  for (const seed of rb.prerequisiteSeeds ?? []) {
@@ -23222,7 +23232,7 @@ function runRelationBootstrapLeg(eng, ws, lawHash, rb, reuseJourneyState = false
23222
23232
  lines.push(`\u2013 relation-bootstrap leg SKIPPED (prerequisite-seed chain) \u2014 the prerequisite seed ${rb.domain}/${seed.directiveId} REFUSED with a synthesized payload (${seedRes.error ?? "refused"}); the granter ${rb.grantDirectiveId}'s prerequisite can't be established standalone \u2014 prove ${rb.gatedDirectiveId} via a birth genesis / by hand`);
23223
23233
  return done(true);
23224
23234
  }
23225
- lines.push(`\u2713 relation bootstrap (prerequisite) \u2014 ${rb.domain}/${seed.directiveId} established (as founder ${ACTOR}) before the grant`);
23235
+ lines.push(`\u2713 relation bootstrap (prerequisite) \u2014 ${rb.domain}/${seed.directiveId} established (as founder ${ACTOR2}) before the grant`);
23226
23236
  }
23227
23237
  const grantPayload = { ...rb.grantPayload };
23228
23238
  bindJourneyPrincipals(grantPayload, journey);
@@ -23240,7 +23250,7 @@ function runRelationBootstrapLeg(eng, ws, lawHash, rb, reuseJourneyState = false
23240
23250
  }
23241
23251
  return done(false, `relation bootstrap grant ${rb.domain}/${rb.grantDirectiveId} refused: ${grantRes.error ?? "unknown"} \u2014 the grant that should seat "${grantedRelation}" on the proof actor was rejected (is ${rb.grantDirectiveId} itself gated? add .grants("${grantedRelation}") + an ungated bootstrap, or prove by hand)`);
23242
23252
  }
23243
- const seatDesc = speculative ? `replayed the declared seed ${rb.domain}/${rb.grantDirectiveId} (seats [${(rb.seedWritesRelations ?? [grantedRelation]).join(", ")}]) on ${ACTOR} \u2014 deferring to the real gate to authorize "${rb.relation}"` : `${rb.domain}/${rb.grantDirectiveId} granted "${grantedRelation}" to ${ACTOR} (${rb.via})${computed ? ` \u21D2 satisfies "${rb.relation}" via the rewrite` : ``}`;
23253
+ const seatDesc = speculative ? `replayed the declared seed ${rb.domain}/${rb.grantDirectiveId} (seats [${(rb.seedWritesRelations ?? [grantedRelation]).join(", ")}]) on ${ACTOR2} \u2014 deferring to the real gate to authorize "${rb.relation}"` : `${rb.domain}/${rb.grantDirectiveId} granted "${grantedRelation}" to ${ACTOR2} (${rb.via})${computed ? ` \u21D2 satisfies "${rb.relation}" via the rewrite` : ``}`;
23244
23254
  lines.push(`\u2713 relation bootstrap (${speculative ? "seed" : "grant"}) \u2014 ${seatDesc}`);
23245
23255
  for (const setup of rb.preconditionSetups ?? []) {
23246
23256
  if (reusablePreconditionExists(eng, ws, rb.domain, setup)) {
@@ -23293,17 +23303,17 @@ function runRelationBootstrapLeg(eng, ws, lawHash, rb, reuseJourneyState = false
23293
23303
  const id = gatedPayload[field];
23294
23304
  if (typeof id !== "string") return [];
23295
23305
  const object = `${rb.domain}__${aggregate2}:${id}`;
23296
- const verdict = check(eng, ws, object, rb.relation, ACTOR);
23306
+ const verdict = check(eng, ws, object, rb.relation, ACTOR2);
23297
23307
  return [`${object}#${rb.relation}=${verdict.allowed === true ? "allowed" : `denied(${verdict.error ?? "no reason"})`}`];
23298
23308
  });
23299
- return done(false, `relation bootstrap prove ${rb.domain}/${rb.gatedDirectiveId} refused: ${gatedRes.error ?? "unknown"} \u2014 the gated write did NOT succeed even after granting "${grantedRelation}" to the actor${computed ? ` (which should satisfy "${rb.relation}" via the rewrite)` : ``} (the gate is not honoring the seeded relation, OR the grant did not seat it on ${ACTOR})${authorityChecks.length > 0 ? `; checks: ${authorityChecks.join(", ")}` : ""}${tracedProofPayload(eng, ws, rb.domain, gatedPayload, rb.gatedReferenceFields)}`);
23309
+ return done(false, `relation bootstrap prove ${rb.domain}/${rb.gatedDirectiveId} refused: ${gatedRes.error ?? "unknown"} \u2014 the gated write did NOT succeed even after granting "${grantedRelation}" to the actor${computed ? ` (which should satisfy "${rb.relation}" via the rewrite)` : ``} (the gate is not honoring the seeded relation, OR the grant did not seat it on ${ACTOR2})${authorityChecks.length > 0 ? `; checks: ${authorityChecks.join(", ")}` : ""}${tracedProofPayload(eng, ws, rb.domain, gatedPayload, rb.gatedReferenceFields)}`);
23300
23310
  }
23301
23311
  lines.push(speculative ? `\u2713 relation bootstrap (prove) \u2014 ${rb.domain}/${rb.gatedDirectiveId} authored under the replayed seed (gated write SUCCEEDS \u2014 the REAL kernel gate confirmed the replayed seed establishes authority for "${rb.relation}")` : `\u2713 relation bootstrap (prove) \u2014 ${rb.domain}/${rb.gatedDirectiveId} authored under the seeded holder of "${rb.relation}" (gated write SUCCEEDS once granted)`);
23302
23312
  retainAuthoredReferences(eng, ws, gatedRes, journey);
23303
23313
  retainAuthority();
23304
23314
  return done(true);
23305
23315
  }
23306
- function runBornContextLeg(eng, ws, lawHash, rb, ACTOR, stamp, reuseJourneyState, journey) {
23316
+ function runBornContextLeg(eng, ws, lawHash, rb, ACTOR2, stamp, reuseJourneyState, journey) {
23307
23317
  const t0 = performance.now();
23308
23318
  const lines = [];
23309
23319
  const done = (ok, error) => ({ ok, ms: performance.now() - t0, legs: lines, ...error !== void 0 ? { error } : {} });
@@ -23323,12 +23333,12 @@ function runBornContextLeg(eng, ws, lawHash, rb, ACTOR, stamp, reuseJourneyState
23323
23333
  const retainedWs = reuseJourneyState && journey.domain === rb.domain ? journey.workspace : void 0;
23324
23334
  const retainedSecret = reuseJourneyState && journey.domain === rb.domain ? journey.authorSecret : void 0;
23325
23335
  if (retainedWs !== void 0 && retainedSecret !== void 0) {
23326
- const actorOpts2 = { actor: ACTOR, authorSecret: retainedSecret };
23336
+ const actorOpts2 = { actor: ACTOR2, authorSecret: retainedSecret };
23327
23337
  for (const setup of rb.preconditionSetups ?? []) {
23328
23338
  if (reusablePreconditionExists(eng, retainedWs, rb.domain, setup)) continue;
23329
23339
  const setupPayload = { ...setup.payload };
23330
23340
  for (const key2 of Object.keys(setupPayload)) {
23331
- if (seatsProofActor(key2, setupPayload[key2])) setupPayload[key2] = ACTOR;
23341
+ if (seatsProofActor(key2, setupPayload[key2])) setupPayload[key2] = ACTOR2;
23332
23342
  }
23333
23343
  bindJourneyPrincipals(setupPayload, journey);
23334
23344
  for (const field of setup.autoStamped) setupPayload[field] = stamp;
@@ -23355,7 +23365,7 @@ function runBornContextLeg(eng, ws, lawHash, rb, ACTOR, stamp, reuseJourneyState
23355
23365
  }
23356
23366
  const payload = { ...rb.gatedPayload };
23357
23367
  for (const key2 of Object.keys(payload)) {
23358
- if (seatsProofActor(key2, payload[key2])) payload[key2] = ACTOR;
23368
+ if (seatsProofActor(key2, payload[key2])) payload[key2] = ACTOR2;
23359
23369
  }
23360
23370
  bindJourneyPrincipals(payload, journey);
23361
23371
  for (const field of rb.gatedAutoStamped) payload[field] = stamp;
@@ -23388,7 +23398,7 @@ function runBornContextLeg(eng, ws, lawHash, rb, ACTOR, stamp, reuseJourneyState
23388
23398
  lines.push(unrestricted ? `\u2713 generated business action \u2014 ${rb.domain}/${rb.gatedDirectiveId} reused ${retainedWs}, its typed records and enrolled device` : `\u2713 relation bootstrap (retained born-context) \u2014 ${rb.domain}/${rb.gatedDirectiveId} reused ${retainedWs}, its business records, authority and enrolled device`);
23389
23399
  return done(true);
23390
23400
  }
23391
- const founder = ACTOR && !SENTINEL_PRINCIPAL.test(ACTOR) ? ACTOR : "user:00000000-0000-4000-8000-000000000001";
23401
+ const founder = ACTOR2 && !SENTINEL_PRINCIPAL.test(ACTOR2) ? ACTOR2 : "user:00000000-0000-4000-8000-000000000001";
23392
23402
  const dev2 = journey.authorPublic !== void 0 && journey.authorSecret !== void 0 ? { public: journey.authorPublic, secret: journey.authorSecret } : authorKeygen(eng);
23393
23403
  const devKeyHash = keyHashOf(dev2.public);
23394
23404
  const identityProvider = journey.identityProvider ??= createOfflineProofIdentityProvider();
@@ -23441,7 +23451,7 @@ function runBornContextLeg(eng, ws, lawHash, rb, ACTOR, stamp, reuseJourneyState
23441
23451
  journey.actor = founder;
23442
23452
  journey.authorSecret = dev2.secret;
23443
23453
  journey.authorPublic = dev2.public;
23444
- lines.push(unrestricted ? `\u2713 generated business context \u2014 birthed ${bornWs} via ${rb.domain}/${bc.birthDirectiveId} and enrolled the signed-in owner's device` : `\u2713 relation bootstrap (born-context) \u2014 birthed ${bornWs} via ${rb.domain}/${bc.birthDirectiveId}; its genesis (${bc.seatsViaDirectiveId}) seated "${rb.relation}" for the owner ${ACTOR}`);
23454
+ lines.push(unrestricted ? `\u2713 generated business context \u2014 birthed ${bornWs} via ${rb.domain}/${bc.birthDirectiveId} and enrolled the signed-in owner's device` : `\u2713 relation bootstrap (born-context) \u2014 birthed ${bornWs} via ${rb.domain}/${bc.birthDirectiveId}; its genesis (${bc.seatsViaDirectiveId}) seated "${rb.relation}" for the owner ${ACTOR2}`);
23445
23455
  for (const setup of rb.preconditionSetups ?? []) {
23446
23456
  if (reusablePreconditionExists(eng, bornWs, rb.domain, setup)) continue;
23447
23457
  const setupPayload = { ...setup.payload };
@@ -23495,7 +23505,7 @@ function runBornContextLeg(eng, ws, lawHash, rb, ACTOR, stamp, reuseJourneyState
23495
23505
  if (source.line !== void 0) lines.push(source.line);
23496
23506
  const gatedRes = author(eng, bornWs, rb.domain, rb.gatedDirectiveId, gatedPayload, lawHash, source.opts);
23497
23507
  if (gatedRes.ok === false) {
23498
- lines.push(unrestricted ? `\u2013 generated business journey SKIPPED \u2014 ${rb.domain}/${rb.gatedDirectiveId} was refused inside the born ${bornWs} (${gatedRes.error ?? "refused"})` : `\u2013 relation-bootstrap leg SKIPPED (layer-4 born-context) \u2014 dispatching ${rb.domain}/${rb.gatedDirectiveId} .requires("${rb.relation}") inside the born ${bornWs} as ${ACTOR} was REFUSED on the real gate (${gatedRes.error ?? "refused"}); the born genesis did not establish the authority the gate needs`);
23508
+ lines.push(unrestricted ? `\u2013 generated business journey SKIPPED \u2014 ${rb.domain}/${rb.gatedDirectiveId} was refused inside the born ${bornWs} (${gatedRes.error ?? "refused"})` : `\u2013 relation-bootstrap leg SKIPPED (layer-4 born-context) \u2014 dispatching ${rb.domain}/${rb.gatedDirectiveId} .requires("${rb.relation}") inside the born ${bornWs} as ${ACTOR2} was REFUSED on the real gate (${gatedRes.error ?? "refused"}); the born genesis did not establish the authority the gate needs`);
23499
23509
  return done(true);
23500
23510
  }
23501
23511
  retainAuthoredReferences(eng, bornWs, gatedRes, journey);
@@ -23893,9 +23903,23 @@ var HELP = {
23893
23903
  examples: ["githolon compile", "githolon compile nomos.application.ts --require-usdcat"]
23894
23904
  },
23895
23905
  proof: {
23896
- usage: "githolon proof [build/<name>.proof.mts] [--live]",
23897
- what: "Run the application-wide proof GENERATED from your business law. By default it opens a blank\nlocal application through the same generated API tenant code uses, executes its business journey,\nsynchronizes, reopens, and reads the saved records back. --live runs that same business proof against\nNomos Cloud; identity, provisioning, persistence, and cleanup remain inside Nomos. ALL GREEN or it names the jam.",
23898
- examples: ["githolon proof", "githolon proof build/co2.proof.mts", "githolon proof --live"]
23906
+ usage: "githolon proof [build/<name>.proof.mts] [--live] | githolon proof --upgrade [<ws|dir>] [--file <law.usdz>]",
23907
+ what: "Run the application-wide proof GENERATED from your business law. By default it opens a blank\nlocal application through the same generated API tenant code uses, executes its business journey,\nsynchronizes, reopens, and reads the saved records back. --upgrade copies existing custody, replays the\ncandidate over its exact history, promotes only in memory, and cold-restarts it; the source stays read-only.\n--live runs the fresh proof against Nomos Cloud. ALL GREEN or it names the jam.",
23908
+ flags: [
23909
+ ["--upgrade [<ws|dir>]", "copy existing custody, replay the candidate over its exact history, promote only in memory, then cold-restart it"],
23910
+ ["--target <name>", "use a named workspace target from nomos.project.ts when --upgrade has no explicit source"],
23911
+ ["--file <law.usdz>", "candidate archive for --upgrade (default: the single build/*.law.usdz)"],
23912
+ ["--acceptance-reason <why>", "account for an intentional historical outcome change; never inferred or supplied by Nomos"],
23913
+ ["--live", "run the generated fresh-application proof against an isolated Nomos Cloud workspace"],
23914
+ ["--performance", "repeat the local fresh-application proof and enforce its runtime budgets"]
23915
+ ],
23916
+ examples: [
23917
+ "githolon proof",
23918
+ "githolon proof --upgrade",
23919
+ "githolon proof --upgrade ./custody",
23920
+ "githolon proof --upgrade --target prod",
23921
+ "githolon proof --live"
23922
+ ]
23899
23923
  },
23900
23924
  test: {
23901
23925
  usage: "githolon test [test-file-or-flutter-test-flags] [--diagnostics]",
@@ -24265,9 +24289,9 @@ function capJsonStrings(v, max = 2048) {
24265
24289
  if (typeof v === "string") return v.length > max ? `${v.slice(0, max)}\u2026(${v.length} chars)` : v;
24266
24290
  if (Array.isArray(v)) return v.map((x) => capJsonStrings(x, max));
24267
24291
  if (typeof v === "object" && v !== null) {
24268
- const out13 = {};
24269
- for (const [k, x] of Object.entries(v)) out13[k] = capJsonStrings(x, max);
24270
- return out13;
24292
+ const out14 = {};
24293
+ for (const [k, x] of Object.entries(v)) out14[k] = capJsonStrings(x, max);
24294
+ return out14;
24271
24295
  }
24272
24296
  return v;
24273
24297
  }
@@ -24630,6 +24654,267 @@ async function status(wsArg, opts) {
24630
24654
  return verdict.inSync ? 0 : 2;
24631
24655
  }
24632
24656
 
24657
+ // src/proof_upgrade.ts
24658
+ init_engine();
24659
+ init_cloud();
24660
+ init_local_holon();
24661
+ import { existsSync as existsSync11 } from "node:fs";
24662
+ import { join as join13 } from "node:path";
24663
+ var WORKSPACE = "upgrade-proof";
24664
+ var ACTOR = "githolon-upgrade-proof";
24665
+ var out11 = (message) => void process.stdout.write(message + "\n");
24666
+ var err11 = (message) => void process.stderr.write("error: " + message + "\n");
24667
+ function flagValue(args, name) {
24668
+ const exact = args.indexOf(name);
24669
+ if (exact >= 0) {
24670
+ const value = args[exact + 1];
24671
+ if (value === void 0 || value.startsWith("--")) {
24672
+ throw new Error(`${name} needs a value`);
24673
+ }
24674
+ return { value, indexes: [exact, exact + 1] };
24675
+ }
24676
+ const prefix = `${name}=`;
24677
+ const inline = args.findIndex((argument) => argument.startsWith(prefix));
24678
+ if (inline >= 0) {
24679
+ const value = args[inline].slice(prefix.length).trim();
24680
+ if (value.length === 0) throw new Error(`${name} needs a value`);
24681
+ return { value, indexes: [inline] };
24682
+ }
24683
+ return { indexes: [] };
24684
+ }
24685
+ function parseUpgradeProofArguments(args) {
24686
+ const upgradeIndex = args.findIndex((argument) => argument === "--upgrade" || argument.startsWith("--upgrade="));
24687
+ if (upgradeIndex < 0) {
24688
+ return { requested: false, consumed: /* @__PURE__ */ new Set() };
24689
+ }
24690
+ const consumed = /* @__PURE__ */ new Set([upgradeIndex]);
24691
+ let source;
24692
+ const upgrade = args[upgradeIndex];
24693
+ if (upgrade.startsWith("--upgrade=")) {
24694
+ source = upgrade.slice("--upgrade=".length).trim() || void 0;
24695
+ } else {
24696
+ const following = args[upgradeIndex + 1];
24697
+ if (following !== void 0 && !following.startsWith("--") && !following.endsWith(".proof.mts")) {
24698
+ source = following;
24699
+ consumed.add(upgradeIndex + 1);
24700
+ }
24701
+ }
24702
+ const target = flagValue(args, "--target");
24703
+ const acceptance = flagValue(args, "--acceptance-reason");
24704
+ const candidateFile = flagValue(args, "--file");
24705
+ for (const index of [...target.indexes, ...acceptance.indexes, ...candidateFile.indexes]) consumed.add(index);
24706
+ return {
24707
+ requested: true,
24708
+ ...source === void 0 ? {} : { source },
24709
+ ...target.value === void 0 ? {} : { target: target.value },
24710
+ ...acceptance.value === void 0 ? {} : { acceptanceReason: acceptance.value },
24711
+ ...candidateFile.value === void 0 ? {} : { candidateFile: candidateFile.value },
24712
+ consumed
24713
+ };
24714
+ }
24715
+ function isLocalLedger(target) {
24716
+ return existsSync11(target) || target.includes("/") || target.startsWith(".");
24717
+ }
24718
+ async function mountReadOnlyCopy(eng, source, cloud) {
24719
+ if (!isLocalLedger(source)) {
24720
+ const resident = /* @__PURE__ */ new Set();
24721
+ const mountWithDependencies = async (workspace, mountName, ancestry) => {
24722
+ if (resident.has(workspace)) return;
24723
+ const ledger = {
24724
+ remote: `${cloud}/v2/workspaces/${workspace}/git`,
24725
+ headers: {},
24726
+ readOnly: true
24727
+ };
24728
+ let mounted = await mountWorkspace(eng, mountName, ledger);
24729
+ if (mounted.restored !== true && (mounted.requiredResidencies?.length ?? 0) > 0) {
24730
+ for (const dependency of mounted.requiredResidencies ?? []) {
24731
+ if (ancestry.includes(dependency.workspace)) {
24732
+ throw new Error(`cyclic custody readiness while opening ${[...ancestry, dependency.workspace].join(" -> ")}`);
24733
+ }
24734
+ await mountWithDependencies(
24735
+ dependency.workspace,
24736
+ dependency.workspace,
24737
+ [...ancestry, dependency.workspace]
24738
+ );
24739
+ }
24740
+ mounted = await mountWorkspace(eng, mountName, ledger);
24741
+ }
24742
+ if (mounted.restored !== true) {
24743
+ throw new Error(
24744
+ `workspace '${workspace}' has no readable refs/heads/main on ${cloud}` + (mounted.restoreError ? ` (${String(mounted.restoreError).split(" | ")[0]})` : "")
24745
+ );
24746
+ }
24747
+ resident.add(workspace);
24748
+ };
24749
+ await mountWithDependencies(source, WORKSPACE, [source]);
24750
+ const dependencyCount = Math.max(0, resident.size - 1);
24751
+ return {
24752
+ location: `cloud custody${dependencyCount > 0 ? ` + ${dependencyCount} referenced workspace(s)` : ""}`,
24753
+ rawLocalCopy: false
24754
+ };
24755
+ }
24756
+ const gitDir = existsSync11(join13(source, ".git")) ? join13(source, ".git") : source;
24757
+ if (!existsSync11(join13(gitDir, "HEAD"))) {
24758
+ throw new Error(`${source} is not a GitHolon ledger (no HEAD)`);
24759
+ }
24760
+ await mountFresh(eng, WORKSPACE);
24761
+ const workspaceDir = eng.preopen.dir.contents.get("ws").contents.get(WORKSPACE);
24762
+ workspaceDir.contents.set("nomos.git", readTreeFromDisk(gitDir));
24763
+ const head = kgit.resolveRef(eng, gitdirOf(WORKSPACE), "refs/heads/main");
24764
+ if (!head) throw new Error(`${source} has no refs/heads/main`);
24765
+ return { location: "local custody copy", rawLocalCopy: true };
24766
+ }
24767
+ function tenantPredecessors(candidateDomains, current, frameworkHashes) {
24768
+ return [...new Set(candidateDomains.map((domain) => current[domain]).filter((hash) => typeof hash === "string" && !frameworkHashes.has(hash)))];
24769
+ }
24770
+ function printDifferences(report) {
24771
+ out11(` replayed ${report.replayedIntents} historical intent(s); ${report.candidateIntents} candidate action(s)`);
24772
+ for (const difference of report.divergences.slice(0, 12)) {
24773
+ const location = [difference.domain, difference.directiveId].filter(Boolean).join(".");
24774
+ out11(` changed ${difference.kind}${location ? ` at ${location}` : ""}: ${difference.detail}`);
24775
+ }
24776
+ if (report.divergences.length > 12) out11(` changed + ${report.divergences.length - 12} more difference(s)`);
24777
+ }
24778
+ function localAuthorIdentity() {
24779
+ const credentials = loadCreds();
24780
+ const actor = activePrincipal() ?? ACTOR;
24781
+ const device = getDeviceKey(actor);
24782
+ const session = credentials.session?.uid === actor ? credentials.session : void 0;
24783
+ return {
24784
+ actor,
24785
+ ...device?.secret ? { authorSecret: device.secret } : {},
24786
+ ...session?.accessToken ? { authToken: session.accessToken } : {}
24787
+ };
24788
+ }
24789
+ async function runUpgradeProof(sourceArg, lawUsdzPath, opts = {}) {
24790
+ const cloud = cloudBase(opts.cloud);
24791
+ let source;
24792
+ try {
24793
+ source = await resolveWorkspace(
24794
+ sourceArg,
24795
+ process.cwd(),
24796
+ opts.target,
24797
+ "githolon proof --upgrade <ws|dir>"
24798
+ );
24799
+ } catch (error) {
24800
+ err11(error.message);
24801
+ return 1;
24802
+ }
24803
+ try {
24804
+ const identity = localAuthorIdentity();
24805
+ const { eng: sourceEngine, runtime } = await holonEngine(cloud, identity.actor);
24806
+ const mounted = await mountReadOnlyCopy(sourceEngine, source, cloud);
24807
+ const sourceVerdict = verifyChainLocal(sourceEngine, WORKSPACE);
24808
+ if (sourceVerdict.valid !== true) {
24809
+ throw new Error(`source chain is invalid at ${String(sourceVerdict.check ?? "verify_chain")}: ${String(sourceVerdict.error ?? "unknown refusal")}`);
24810
+ }
24811
+ let eng = sourceEngine;
24812
+ if (mounted.rawLocalCopy) {
24813
+ const sourceHead = kgit.resolveRef(sourceEngine, gitdirOf(WORKSPACE), "refs/heads/main");
24814
+ if (!sourceHead) throw new Error("verified source custody has no main head");
24815
+ const sourcePack = packDelta(sourceEngine, WORKSPACE, "", sourceHead);
24816
+ if (!(sourcePack instanceof Uint8Array) || sourcePack.byteLength === 0) {
24817
+ throw new Error("kernel produced no pack from the verified source custody copy");
24818
+ }
24819
+ ({ eng } = await holonEngine(cloud, identity.actor, "production", runtime));
24820
+ await ingestPackAsCustody(eng, WORKSPACE, sourcePack, sourceHead);
24821
+ }
24822
+ const candidate = inspectLawArchive(eng, lawUsdzPath);
24823
+ if (candidate.domainKeys.length === 0) throw new Error("candidate law archive carries no business domains");
24824
+ const before = currentLaw(eng, WORKSPACE);
24825
+ const predecessors = tenantPredecessors(
24826
+ candidate.domainKeys,
24827
+ before,
24828
+ /* @__PURE__ */ new Set([eng.hashes.bootstrap, eng.hashes.nomos])
24829
+ );
24830
+ const alreadyCurrent = candidate.domainKeys.every((domain) => before[domain] === candidate.identity);
24831
+ if (alreadyCurrent) {
24832
+ out11(`githolon proof --upgrade \u2014 ${source} (${mounted.location})`);
24833
+ out11(`\u2713 candidate ${candidate.identity.slice(0, 16)}\u2026 is already current for ${candidate.domainKeys.join(", ")}`);
24834
+ } else {
24835
+ if (predecessors.length === 0) {
24836
+ throw new Error(
24837
+ `the source does not currently serve any of the candidate domains (${candidate.domainKeys.join(", ")}); this is a first installation, so use \`githolon proof\` rather than an upgrade proof`
24838
+ );
24839
+ }
24840
+ if (predecessors.length !== 1) {
24841
+ throw new Error(
24842
+ `candidate domains currently come from ${predecessors.length} different packages; Nomos will not guess which independent models this one package replaces`
24843
+ );
24844
+ }
24845
+ const predecessor = predecessors[0];
24846
+ const staged = author(
24847
+ eng,
24848
+ WORKSPACE,
24849
+ "nomos",
24850
+ "stageDomain",
24851
+ closureInstallPayload(candidate.identity, identity.actor, { supersedes: predecessor }),
24852
+ eng.hashes.nomos,
24853
+ { ...identity, lawUsdz: candidate.lawUsdz }
24854
+ );
24855
+ if (staged.ok === false) throw new Error(`candidate staging refused: ${staged.error ?? "unknown refusal"}`);
24856
+ const stagedHead = kgit.resolveRef(eng, gitdirOf(WORKSPACE), "refs/heads/main");
24857
+ if (!stagedHead) throw new Error("candidate staging produced no current head");
24858
+ const report = historyPreflight(
24859
+ eng,
24860
+ WORKSPACE,
24861
+ candidate.domainKeys[0],
24862
+ candidate.identity,
24863
+ stagedHead,
24864
+ identity.actor
24865
+ );
24866
+ out11(`githolon proof --upgrade \u2014 ${source} (${mounted.location}, never modified)`);
24867
+ out11(` current ${predecessor.slice(0, 16)}\u2026`);
24868
+ out11(` candidate ${candidate.identity.slice(0, 16)}\u2026 (${candidate.domainKeys.join(", ")})`);
24869
+ printDifferences(report);
24870
+ if (!report.sourceVerified || !report.complete || !report.evolve.ok) {
24871
+ throw new Error(
24872
+ !report.sourceVerified ? "the source history did not verify" : !report.complete ? "the candidate could not re-derive every historical premise" : `typed evolution refused: ${report.evolve.violations.map((violation) => violation.detail).join("; ")}`
24873
+ );
24874
+ }
24875
+ if (!report.promotable && !opts.acceptanceReason?.trim()) {
24876
+ throw new Error(
24877
+ 'the candidate deliberately changes historical business outcomes; review the differences above, then rerun with --acceptance-reason "why this change is correct"'
24878
+ );
24879
+ }
24880
+ const promoted = promotePreflighted(eng, WORKSPACE, candidate.domainKeys[0], candidate.identity, {
24881
+ ...identity,
24882
+ replaces: predecessor,
24883
+ retireReplaced: true,
24884
+ ...opts.acceptanceReason?.trim() ? { acceptanceReason: opts.acceptanceReason.trim() } : {}
24885
+ });
24886
+ if (!promoted.ok) throw new Error(`disposable promotion refused at ${promoted.stage}: ${promoted.error}`);
24887
+ const active = currentLaw(eng, WORKSPACE);
24888
+ for (const domain of candidate.domainKeys) {
24889
+ if (active[domain] !== candidate.identity) {
24890
+ throw new Error(`promotion completed but ${domain} does not resolve to the candidate model`);
24891
+ }
24892
+ }
24893
+ out11(`\u2713 exact-history promotion admitted in the disposable copy`);
24894
+ }
24895
+ const warmVerdict = verifyChainLocal(eng, WORKSPACE);
24896
+ if (warmVerdict.valid !== true) throw new Error(`promoted chain failed verification: ${String(warmVerdict.error ?? "unknown refusal")}`);
24897
+ const head = kgit.resolveRef(eng, gitdirOf(WORKSPACE), "refs/heads/main");
24898
+ if (!head) throw new Error("verified upgraded custody has no main head");
24899
+ const pack = packDelta(eng, WORKSPACE, "", head);
24900
+ if (!(pack instanceof Uint8Array) || pack.byteLength === 0) throw new Error("kernel produced no upgraded custody pack");
24901
+ const { eng: cold } = await holonEngine(cloud, identity.actor, "production", runtime);
24902
+ await ingestPackAsCustody(cold, WORKSPACE, pack, head);
24903
+ const coldVerdict = verifyChainLocal(cold, WORKSPACE);
24904
+ if (coldVerdict.valid !== true) throw new Error(`cold restart refused upgraded custody: ${String(coldVerdict.error ?? "unknown refusal")}`);
24905
+ const coldLaw = currentLaw(cold, WORKSPACE);
24906
+ for (const domain of candidate.domainKeys) {
24907
+ if (coldLaw[domain] !== candidate.identity) throw new Error(`cold restart did not serve ${domain} from the candidate model`);
24908
+ }
24909
+ out11(`\u2713 cold restart serves the candidate at ${head.slice(0, 12)}\u2026`);
24910
+ out11(`\u2713 UPGRADE PROOF GREEN \u2014 source custody was read-only; deployment may proceed through the ordinary offer lane`);
24911
+ return 0;
24912
+ } catch (error) {
24913
+ err11(`upgrade proof failed: ${error.message ?? error}`);
24914
+ return 1;
24915
+ }
24916
+ }
24917
+
24633
24918
  // src/cli.ts
24634
24919
  var KINDS = ["domain", "aggregate", "intent"];
24635
24920
  var DEFAULT_OUT = "domains";
@@ -24776,14 +25061,14 @@ function isKind(s) {
24776
25061
  function resolvedTsxCli() {
24777
25062
  const resolvePkgDir = (name, fromDir) => {
24778
25063
  try {
24779
- return dirname9(createRequire3(pathToFileURL5(join16(fromDir, "noop.js"))).resolve(`${name}/package.json`));
25064
+ return dirname9(createRequire3(pathToFileURL5(join17(fromDir, "noop.js"))).resolve(`${name}/package.json`));
24780
25065
  } catch {
24781
25066
  return void 0;
24782
25067
  }
24783
25068
  };
24784
25069
  const dslDir = (() => {
24785
25070
  try {
24786
- return dirname9(createRequire3(pathToFileURL5(join16(process.cwd(), "noop.js"))).resolve("@githolon/dsl/package.json"));
25071
+ return dirname9(createRequire3(pathToFileURL5(join17(process.cwd(), "noop.js"))).resolve("@githolon/dsl/package.json"));
24787
25072
  } catch {
24788
25073
  try {
24789
25074
  return dirname9(createRequire3(import.meta.url).resolve("@githolon/dsl/package.json"));
@@ -24794,13 +25079,13 @@ function resolvedTsxCli() {
24794
25079
  })();
24795
25080
  const tsxDir = resolvePkgDir("tsx", process.cwd()) ?? (dslDir !== void 0 ? resolvePkgDir("tsx", dslDir) : void 0);
24796
25081
  if (tsxDir === void 0) throw new Error("tsx not found \u2014 add @githolon/dsl to the project and npm install");
24797
- const tsxPkg = JSON.parse(readFileSync12(join16(tsxDir, "package.json"), "utf8"));
25082
+ const tsxPkg = JSON.parse(readFileSync12(join17(tsxDir, "package.json"), "utf8"));
24798
25083
  const tsxBinRel = typeof tsxPkg.bin === "string" ? tsxPkg.bin : tsxPkg.bin?.tsx;
24799
- return join16(tsxDir, tsxBinRel ?? "dist/cli.mjs");
25084
+ return join17(tsxDir, tsxBinRel ?? "dist/cli.mjs");
24800
25085
  }
24801
25086
  async function runGeneratedApplicationProofLocally(proofPath, onPerformance) {
24802
25087
  const lawUsdzPath = proofPath.replace(/\.proof\.mts$/, ".law.usdz");
24803
- if (lawUsdzPath === proofPath || !existsSync15(lawUsdzPath)) {
25088
+ if (lawUsdzPath === proofPath || !existsSync16(lawUsdzPath)) {
24804
25089
  throw new Error(`generated application proof needs its canonical sibling law archive: ${lawUsdzPath}`);
24805
25090
  }
24806
25091
  const here = dirname9(fileURLToPath3(import.meta.url));
@@ -24812,14 +25097,14 @@ async function runGeneratedApplicationProofLocally(proofPath, onPerformance) {
24812
25097
  resolve7(here, "dev-server.mjs"),
24813
25098
  resolve7(here, "../dist/dev-server.mjs")
24814
25099
  ];
24815
- const serverPath = serverCandidates.find((candidate) => existsSync15(candidate));
25100
+ const serverPath = serverCandidates.find((candidate) => existsSync16(candidate));
24816
25101
  if (serverPath === void 0) {
24817
25102
  throw new Error("the bundled local Nomos cloud is missing \u2014 rebuild or reinstall githolon");
24818
25103
  }
24819
25104
  const candidateRuntime = process.env.NOMOS_CANDIDATE_RUNTIME ?? process.env.NOMOS_OFFLINE_RUNTIME;
24820
- const candidateTestMint = candidateRuntime === void 0 ? void 0 : join16(candidateRuntime, "holon-testmint.wasm");
25105
+ const candidateTestMint = candidateRuntime === void 0 ? void 0 : join17(candidateRuntime, "holon-testmint.wasm");
24821
25106
  const priorLocalWasm = process.env.NOMOS_LOCAL_WASM;
24822
- if (candidateTestMint !== void 0 && existsSync15(candidateTestMint)) process.env.NOMOS_LOCAL_WASM = candidateTestMint;
25107
+ if (candidateTestMint !== void 0 && existsSync16(candidateTestMint)) process.env.NOMOS_LOCAL_WASM = candidateTestMint;
24823
25108
  const module = await import(pathToFileURL5(serverPath).href);
24824
25109
  if (typeof module.startGeneratedApplicationProofCloud !== "function") {
24825
25110
  throw new Error("the bundled local Nomos cloud predates generated application execution \u2014 rebuild githolon");
@@ -24899,6 +25184,12 @@ async function runProof(args) {
24899
25184
  };
24900
25185
  const live = args.includes("--live");
24901
25186
  const performance2 = args.includes("--performance");
25187
+ let upgrade;
25188
+ try {
25189
+ upgrade = parseUpgradeProofArguments(args);
25190
+ } catch (error) {
25191
+ return refuse(error.message);
25192
+ }
24902
25193
  const samplesFlag = args.findIndex((argument) => argument === "--samples");
24903
25194
  const samplesValueIdx = samplesFlag < 0 ? -1 : samplesFlag + 1;
24904
25195
  const performanceSamples = samplesFlag < 0 ? 5 : Number(args[samplesFlag + 1]);
@@ -24906,6 +25197,8 @@ async function runProof(args) {
24906
25197
  return refuse("--samples needs an integer from 1 to 20");
24907
25198
  }
24908
25199
  if (live && performance2) return refuse("--performance is a local release gate; use the production-configured app gate for live deployment evidence");
25200
+ if (upgrade.requested && live) return refuse("--upgrade proves copied existing custody locally; it cannot be combined with --live");
25201
+ if (upgrade.requested && performance2) return refuse("--performance measures the generated fresh journey; --upgrade instead proves the exact existing history");
24909
25202
  if (args.includes("--keep")) return refuse("--keep no longer applies: proof --live owns its isolated acceptance workspace and preserves its verified history");
24910
25203
  let domainValueIdx = -1;
24911
25204
  const di = args.findIndex((a) => a === "--domain" || a.startsWith("--domain="));
@@ -24914,14 +25207,36 @@ async function runProof(args) {
24914
25207
  if (!a.includes("=")) domainValueIdx = di + 1;
24915
25208
  return refuse("--domain has been removed: the generated proof exercises the whole application through its one business API");
24916
25209
  }
24917
- const explicit = args.find((a, i) => !a.startsWith("--") && i !== domainValueIdx && i !== samplesValueIdx);
25210
+ const explicit = args.find(
25211
+ (a, i) => !a.startsWith("--") && i !== domainValueIdx && i !== samplesValueIdx && !upgrade.consumed.has(i)
25212
+ );
25213
+ if (upgrade.requested) {
25214
+ let lawUsdzPath;
25215
+ try {
25216
+ if (explicit?.endsWith(".proof.mts")) {
25217
+ const explicitProof = resolve7(process.cwd(), explicit);
25218
+ lawUsdzPath = explicitProof.replace(/\.proof\.mts$/, ".law.usdz");
25219
+ if (!existsSync16(lawUsdzPath)) throw new Error(`generated proof has no canonical sibling law archive: ${lawUsdzPath}`);
25220
+ } else if (explicit !== void 0) {
25221
+ return refuse(`unexpected positional '${explicit}' \u2014 pass custody to --upgrade and candidate law with --file <law.usdz>`);
25222
+ } else {
25223
+ lawUsdzPath = discoverLawUsdz(process.cwd(), upgrade.candidateFile);
25224
+ }
25225
+ } catch (error) {
25226
+ return refuse(error.message);
25227
+ }
25228
+ return runUpgradeProof(upgrade.source, lawUsdzPath, {
25229
+ ...upgrade.target === void 0 ? {} : { target: upgrade.target },
25230
+ ...upgrade.acceptanceReason === void 0 ? {} : { acceptanceReason: upgrade.acceptanceReason }
25231
+ });
25232
+ }
24918
25233
  let proofPath;
24919
25234
  if (explicit !== void 0) {
24920
25235
  proofPath = resolve7(process.cwd(), explicit);
24921
- if (!existsSync15(proofPath)) return refuse(`proof not found: ${proofPath} \u2014 run \`githolon compile\` to (re)generate it`);
25236
+ if (!existsSync16(proofPath)) return refuse(`proof not found: ${proofPath} \u2014 run \`githolon compile\` to (re)generate it`);
24922
25237
  } else {
24923
- const buildDir = join16(process.cwd(), "build");
24924
- if (!existsSync15(buildDir)) {
25238
+ const buildDir = join17(process.cwd(), "build");
25239
+ if (!existsSync16(buildDir)) {
24925
25240
  return refuse("no build/ directory here \u2014 run `githolon compile` first (every compile generates build/<name>.proof.mts from your law)");
24926
25241
  }
24927
25242
  const proofs = readdirSync6(buildDir).filter((f) => f.endsWith(".proof.mts"));
@@ -24931,7 +25246,7 @@ async function runProof(args) {
24931
25246
  if (proofs.length > 1) {
24932
25247
  return refuse(`found ${proofs.length} proofs (${proofs.join(", ")}) \u2014 name one: githolon proof build/<name>.proof.mts`);
24933
25248
  }
24934
- proofPath = join16(buildDir, proofs[0]);
25249
+ proofPath = join17(buildDir, proofs[0]);
24935
25250
  }
24936
25251
  if (!live) {
24937
25252
  try {
@@ -25113,10 +25428,10 @@ async function main(argv) {
25113
25428
  };
25114
25429
  const lawArg = pull("--law");
25115
25430
  const workspace = pull("--workspace") ?? "test-ws";
25116
- const out13 = pull("--out");
25431
+ const out14 = pull("--out");
25117
25432
  const runtime = pull("--runtime");
25118
25433
  const law = (lawArg ?? "").split(",").map((s) => s.trim()).filter(Boolean);
25119
- if (law.length === 0 || out13 === void 0) {
25434
+ if (law.length === 0 || out14 === void 0) {
25120
25435
  process.stderr.write(
25121
25436
  `error: usage: githolon harness-install --law <law.usdz[,law.usdz...]> --workspace <ws> --out <snapshotPath> [--runtime <dir>]
25122
25437
  `
@@ -25124,7 +25439,7 @@ async function main(argv) {
25124
25439
  return 1;
25125
25440
  }
25126
25441
  const { harnessInstall: harnessInstall2 } = await Promise.resolve().then(() => (init_harness(), harness_exports));
25127
- return harnessInstall2({ law, workspace, out: out13, ...runtime !== void 0 ? { runtime } : {} });
25442
+ return harnessInstall2({ law, workspace, out: out14, ...runtime !== void 0 ? { runtime } : {} });
25128
25443
  }
25129
25444
  if (argv[0] === "dev") {
25130
25445
  const rest = argv.slice(1);
@@ -25190,7 +25505,7 @@ usage: githolon cloud dev [--port <n>] [--data <dir>] [--ephemeral]
25190
25505
  resolve7(here, "../../../cloud/dev-server/server.mjs"),
25191
25506
  resolve7(process.cwd(), "cloud/dev-server/server.mjs")
25192
25507
  ];
25193
- const serverPath = candidates.find((p) => existsSync15(p));
25508
+ const serverPath = candidates.find((p) => existsSync16(p));
25194
25509
  if (!serverPath) {
25195
25510
  process.stderr.write("error: dev-server not found \u2014 reinstall `githolon` or run `npm run build` in the cli package\n");
25196
25511
  return 1;
@@ -25647,8 +25962,8 @@ ${USAGE}`);
25647
25962
  let parsed;
25648
25963
  try {
25649
25964
  parsed = parseArgs(argv);
25650
- } catch (err13) {
25651
- process.stderr.write(`error: ${err13.message}
25965
+ } catch (err14) {
25966
+ process.stderr.write(`error: ${err14.message}
25652
25967
 
25653
25968
  ${USAGE}`);
25654
25969
  return 1;
@@ -25667,8 +25982,8 @@ ${USAGE}`);
25667
25982
  process.stdout.write(`created ${path2}
25668
25983
  `);
25669
25984
  return 0;
25670
- } catch (err13) {
25671
- process.stderr.write(`error: ${err13.message}
25985
+ } catch (err14) {
25986
+ process.stderr.write(`error: ${err14.message}
25672
25987
  `);
25673
25988
  return 1;
25674
25989
  }