githolon 0.108.4 → 0.108.7

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.
@@ -394,6 +394,16 @@ function prepareManagedPromotion(report, candidateHash, domain, opts = {}) {
394
394
  error: `the package-wide report does not cover the generated business area '${domain}'`
395
395
  };
396
396
  }
397
+ const dispositions = report.dispositions;
398
+ const changesStableIdentity = dispositions !== void 0 && (dispositions.retired.length > 0 || Object.keys(dispositions.retyped).length > 0 || Object.keys(dispositions.rebinds).length > 0);
399
+ if (changesStableIdentity && !acceptanceReason) {
400
+ return {
401
+ ok: false,
402
+ stage: "acceptance",
403
+ report,
404
+ error: "the current-frontier transition changes stable business identities and needs an attributed acceptance reason"
405
+ };
406
+ }
397
407
  const preflight = {
398
408
  candidateHash,
399
409
  // A package may be reached through any one of its generated domain clients. The
@@ -1719,6 +1729,17 @@ var init_offer_result = __esm({
1719
1729
  }
1720
1730
  });
1721
1731
 
1732
+ // vendor/engine/proto/nomos/custody/v1/snapshot_pb.js
1733
+ import { fileDesc as fileDesc2, messageDesc as messageDesc2 } from "@bufbuild/protobuf/codegenv2";
1734
+ var file_nomos_custody_v1_snapshot, LocalCustodySnapshotSchema;
1735
+ var init_snapshot_pb = __esm({
1736
+ "vendor/engine/proto/nomos/custody/v1/snapshot_pb.js"() {
1737
+ "use strict";
1738
+ file_nomos_custody_v1_snapshot = /* @__PURE__ */ fileDesc2("Ch9ub21vcy9jdXN0b2R5L3YxL3NuYXBzaG90LnByb3RvEhBub21vcy5jdXN0b2R5LnYxIqACChRMb2NhbEN1c3RvZHlTbmFwc2hvdBIWCg5mb3JtYXRfdmVyc2lvbhgBIAEoDRIWCgl3b3Jrc3BhY2UYAiABKAlIAIgBARIMCgR0cmVlGAMgASgMEhcKCmNoZWNrcG9pbnQYBCABKAxIAYgBARIVCghmcm9udGllchgFIAEoDEgCiAEBEhMKBmN1cnNvchgGIAEoCUgDiAEBEhcKCnN0YXRlX3Jvb3QYByABKAlIBIgBARIYCgtzeW5jZWRfYmFzZRgIIAEoCUgFiAEBQgwKCl93b3Jrc3BhY2VCDQoLX2NoZWNrcG9pbnRCCwoJX2Zyb250aWVyQgkKB19jdXJzb3JCDQoLX3N0YXRlX3Jvb3RCDgoMX3N5bmNlZF9iYXNlYgZwcm90bzM");
1739
+ LocalCustodySnapshotSchema = /* @__PURE__ */ messageDesc2(file_nomos_custody_v1_snapshot, 0);
1740
+ }
1741
+ });
1742
+
1722
1743
  // vendor/engine/engine.ts
1723
1744
  var engine_exports = {};
1724
1745
  __export(engine_exports, {
@@ -1808,6 +1829,7 @@ __export(engine_exports, {
1808
1829
  lawParity: () => lawParity,
1809
1830
  ledgerStats: () => ledgerStats,
1810
1831
  listRefusedRefs: () => listRefusedRefs,
1832
+ localCustodySnapshot: () => localCustodySnapshot,
1811
1833
  materializeRefused: () => materializeRefused,
1812
1834
  memoryDropProbe: () => memoryDropProbe,
1813
1835
  migrateHomes: () => migrateHomes,
@@ -3382,8 +3404,11 @@ async function reconcileRequiredCustodyHead(eng, ws, ledger, requiredCustodyHead
3382
3404
  if (!/^[0-9a-f]{40}$/.test(requiredCustodyHead)) {
3383
3405
  throw new Error("required custody head must be a lowercase 40-hex git object id");
3384
3406
  }
3385
- const current = eng.mounted.has(ws) ? kgit.resolveRef(eng, gitdirOf(ws), BRANCH) : "";
3386
- if (current === requiredCustodyHead) return eng.mounted.get(ws);
3407
+ const resident = eng.mounted.get(ws);
3408
+ const current = resident ? kgit.resolveRef(eng, gitdirOf(ws), BRANCH) : "";
3409
+ if (current === requiredCustodyHead && resident?.remoteMain === requiredCustodyHead && !resident.restoreError) {
3410
+ return resident;
3411
+ }
3387
3412
  if (current && isDirty(eng, ws)) {
3388
3413
  throw new Error(
3389
3414
  `workspace '${ws}' has verified but unsealed resident work; refusing to discard it while reconciling custody`
@@ -3396,6 +3421,12 @@ async function reconcileRequiredCustodyHead(eng, ws, ledger, requiredCustodyHead
3396
3421
  `workspace '${ws}' could not reconcile required custody ${requiredCustodyHead}: ${mounted.restoreError || "custody has no verified main"}`
3397
3422
  );
3398
3423
  }
3424
+ const reconciled = kgit.resolveRef(eng, gitdirOf(ws), BRANCH);
3425
+ if (reconciled !== requiredCustodyHead || mounted.remoteMain !== requiredCustodyHead) {
3426
+ throw new Error(
3427
+ `workspace '${ws}' restored custody ${mounted.remoteMain || reconciled || "none"}, not required custody ${requiredCustodyHead}`
3428
+ );
3429
+ }
3399
3430
  return mounted;
3400
3431
  }
3401
3432
  function assertAuthored(res, what) {
@@ -3533,7 +3564,10 @@ async function applyWorkspaceEffect(eng, ws, ledger, requestBytes, admissionChec
3533
3564
  const result = response.outcome.value.result;
3534
3565
  if (!result || result.outcome.case !== "admitted") {
3535
3566
  const outcome = result?.outcome.case || "empty";
3536
- throw new Error(`target kernel ${outcome} the workspace effect`);
3567
+ const detail = result?.outcome.case === "refused" ? result.outcome.value.refusal?.message : void 0;
3568
+ throw new Error(
3569
+ `target kernel ${outcome} the workspace effect${detail ? `: ${detail}` : ""}`
3570
+ );
3537
3571
  }
3538
3572
  await custodyPush(eng, ws, ledger, { remoteRef: "refs/heads/main", ffOnly: true });
3539
3573
  return toBinary(ApplyWorkspaceEffectResponseSchema, response.outcome.value);
@@ -3644,8 +3678,8 @@ function prepareRemoteOffer(eng, ws, requestBytes) {
3644
3678
  if (authoring.authorSecret.byteLength !== 0) {
3645
3679
  throw new Error("remote offer preparation refuses client signing secrets");
3646
3680
  }
3647
- if (request.intent.case !== "call") {
3648
- throw new Error("remote offer preparation requires a typed directive call");
3681
+ if (request.intent.case !== "call" && request.intent.case !== "modelLifecycle") {
3682
+ throw new Error("remote offer preparation requires a typed directive or model-lifecycle call");
3649
3683
  }
3650
3684
  const response = callProto(eng.ex, {
3651
3685
  case: "prepareRemoteOffer",
@@ -4111,7 +4145,13 @@ function packDelta(eng, ws, base, head) {
4111
4145
  case: "packDelta",
4112
4146
  value: create(PackDeltaRequestSchema, { repo: repoArgOf(ws), base: base || void 0, head })
4113
4147
  }, "packDelta").pack;
4114
- } catch {
4148
+ } catch (error) {
4149
+ console.error("[nomos-custody-pack] packDelta refused", {
4150
+ workspace: ws,
4151
+ base: base || "<full>",
4152
+ head,
4153
+ error: String(error)
4154
+ });
4115
4155
  return null;
4116
4156
  }
4117
4157
  }
@@ -5288,7 +5328,10 @@ async function emitOutbox(eng, ws, ledger, workspaceEffectBase = "", admissionCh
5288
5328
  const targetResult = response.result;
5289
5329
  if (!targetResult || targetResult.outcome.case !== "admitted") {
5290
5330
  const outcome = targetResult?.outcome.case || "empty";
5291
- throw new Error(`target kernel ${outcome} the workspace effect`);
5331
+ const detail = targetResult?.outcome.case === "refused" ? targetResult.outcome.value.refusal?.message : void 0;
5332
+ throw new Error(
5333
+ `target kernel ${outcome} the workspace effect${detail ? `: ${detail}` : ""}`
5334
+ );
5292
5335
  }
5293
5336
  break;
5294
5337
  }
@@ -5320,7 +5363,7 @@ async function emitOutbox(eng, ws, ledger, workspaceEffectBase = "", admissionCh
5320
5363
  } catch (e) {
5321
5364
  errors++;
5322
5365
  const destination = offer.route.case === "httpsRoute" ? offer.route.value.url : offer.route.case === "workspaceRoute" ? offer.route.value.workspace : offer.destination;
5323
- log("outbox-deliver-failed", { ws, offerId: offer.id, destination, error: String(e).slice(0, 200) });
5366
+ log("outbox-deliver-failed", { ws, offerId: offer.id, destination, error: String(e).slice(0, 2e3) });
5324
5367
  }
5325
5368
  }
5326
5369
  if (delivered.length || errors) log("outbox", { ws, delivered: delivered.length, errors });
@@ -5351,6 +5394,26 @@ function snapshot(eng, ws) {
5351
5394
  const wsDir = dirOf(eng.preopen.dir.contents.get("ws")).contents.get(ws);
5352
5395
  return serializeTree(wsDir);
5353
5396
  }
5397
+ function localCustodySnapshot(eng, ws) {
5398
+ const checkpoint = exportCheckpoint(eng, ws);
5399
+ const tree = snapshot(eng, ws);
5400
+ const head = headOf(eng, ws);
5401
+ const body = toBinary(LocalCustodySnapshotSchema, create(LocalCustodySnapshotSchema, {
5402
+ formatVersion: 3,
5403
+ workspace: ws,
5404
+ tree,
5405
+ checkpoint: checkpoint.blob ? bytesFromB64(checkpoint.blob) : void 0,
5406
+ frontier: checkpoint.frontier ? bytesFromB64(checkpoint.frontier) : void 0,
5407
+ cursor: checkpoint.cursor === void 0 ? void 0 : String(checkpoint.cursor),
5408
+ stateRoot: checkpoint.stateRoot,
5409
+ syncedBase: head || void 0
5410
+ }));
5411
+ const prefix = enc3.encode("NOMOS-CUSTODY-PB3\n");
5412
+ const framed = new Uint8Array(prefix.byteLength + body.byteLength);
5413
+ framed.set(prefix);
5414
+ framed.set(body, prefix.byteLength);
5415
+ return framed;
5416
+ }
5354
5417
  function stats(eng) {
5355
5418
  return {
5356
5419
  mounted: eng.mounted.size,
@@ -5427,6 +5490,7 @@ var init_engine = __esm({
5427
5490
  init_lifecycle_calls();
5428
5491
  init_offer_result();
5429
5492
  init_kernel_pb();
5493
+ init_snapshot_pb();
5430
5494
  enc3 = new TextEncoder();
5431
5495
  dec3 = new TextDecoder();
5432
5496
  BRANCH = "main";