githolon 0.101.0 → 0.101.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -1274,7 +1274,7 @@ async function replicateIntents(eng, ws, ledger, intents, { push = true } = {})
1274
1274
  log("replicate-globals", { ws, replicated: replicated.length, skipped: skipped.length, refused: refused.length });
1275
1275
  return { replicated, skipped, refused };
1276
1276
  }
1277
- async function admitIntentOffers(eng, ws, ledger, offers, { receiptFence = null, shardRouting = null, clientBase = null, defer = false } = {}) {
1277
+ async function admitIntentOffers(eng, ws, ledger, offers, { receiptFence = null, shardRouting = null, clientBase = null } = {}) {
1278
1278
  const main2 = await mainIntentIds(eng, ws);
1279
1279
  const sessions = /* @__PURE__ */ new Map();
1280
1280
  const deadLetters = [];
@@ -1341,8 +1341,8 @@ async function admitIntentOffers(eng, ws, ledger, offers, { receiptFence = null,
1341
1341
  }
1342
1342
  const cap2 = summaryCtx ? beginSummaryCapture(eng, ws, summaryCtx, blob) : null;
1343
1343
  const _tOffer = Date.now();
1344
- const res = offerAdmit(eng, ws, blob, { defer: !summaryCtx });
1345
- log("offer-admit-ms", { ws, ms: Date.now() - _tOffer, deferred: !summaryCtx, ok: res.ok });
1344
+ const res = offerAdmit(eng, ws, blob, { defer: false });
1345
+ log("offer-admit-ms", { ws, ms: Date.now() - _tOffer, deferred: false, ok: res.ok });
1346
1346
  if (res.ok) {
1347
1347
  if (intentId) main2.ids.add(intentId);
1348
1348
  main2.oids.add(res.head);
@@ -1365,7 +1365,6 @@ async function admitIntentOffers(eng, ws, ledger, offers, { receiptFence = null,
1365
1365
  }
1366
1366
  timings.sessions = sessions.size;
1367
1367
  timings.intents = admittedTotal;
1368
- if (admittedTotal && !summaryCtx) (eng.pendingProjection ??= /* @__PURE__ */ new Set()).add(ws);
1369
1368
  if (deadLetters.length) {
1370
1369
  try {
1371
1370
  await materializeRefused(eng, ws, ledger, deadLetters);
@@ -1373,8 +1372,7 @@ async function admitIntentOffers(eng, ws, ledger, offers, { receiptFence = null,
1373
1372
  log("refused-materialize-failed", { ws, error: String(e).slice(0, 200) });
1374
1373
  }
1375
1374
  }
1376
- const deferDurability = defer && !summaryCtx;
1377
- if (admittedTotal && !deferDurability) {
1375
+ if (admittedTotal) {
1378
1376
  const sealDone = span("seal offered intents", "cseal", 1, { admitted: admittedTotal });
1379
1377
  await commitAndPush(eng, ws, ledger);
1380
1378
  sealDone();
@@ -1392,7 +1390,7 @@ async function admitIntentOffers(eng, ws, ledger, offers, { receiptFence = null,
1392
1390
  }
1393
1391
  log("admit-intent-offers", { ws, sessions: sessions.size, admitted: admittedTotal, rejected: [...sessions.values()].reduce((n, s) => n + s.rejected.length, 0), resultPack: resultPackB64 ? "inline" : "none" });
1394
1392
  const bornPacked = born.length ? packBornChildren(eng, born) : born;
1395
- return { sessions: [...sessions.values()].map((s) => ({ ...s, ...s.skipped.length ? {} : { skipped: void 0 } })), main: head, deadLetters, timings, summary: summary ?? null, born: bornPacked, birthOutcomes, ...resultPackB64 ? { resultPackB64, resultBase: clientBase } : {}, ...deferDurability && admittedTotal && head ? { deferred: true, head } : {} };
1393
+ return { sessions: [...sessions.values()].map((s) => ({ ...s, ...s.skipped.length ? {} : { skipped: void 0 } })), main: head, deadLetters, timings, summary: summary ?? null, born: bornPacked, birthOutcomes, ...resultPackB64 ? { resultPackB64, resultBase: clientBase } : {} };
1396
1394
  }
1397
1395
  async function checkpointStateHash(eng, ws) {
1398
1396
  const rows = query(eng, ws, "aggregatesByType", JSON.stringify({ __type: "NomosSummarySubtotal" }));
@@ -605,7 +605,7 @@ function summaryOfCapture(ctx, fromOid, toOid) {
605
605
  rowsByHome: Object.fromEntries([...ctx.rowsByHome.entries()].sort((a, b) => a[0] < b[0] ? -1 : 1))
606
606
  };
607
607
  }
608
- async function admitIntentOffers(eng, ws, ledger, offers, { receiptFence = null, shardRouting = null, clientBase = null, defer = false } = {}) {
608
+ async function admitIntentOffers(eng, ws, ledger, offers, { receiptFence = null, shardRouting = null, clientBase = null } = {}) {
609
609
  const main = await mainIntentIds(eng, ws);
610
610
  const sessions = /* @__PURE__ */ new Map();
611
611
  const deadLetters = [];
@@ -672,8 +672,8 @@ async function admitIntentOffers(eng, ws, ledger, offers, { receiptFence = null,
672
672
  }
673
673
  const cap = summaryCtx ? beginSummaryCapture(eng, ws, summaryCtx, blob) : null;
674
674
  const _tOffer = Date.now();
675
- const res = offerAdmit(eng, ws, blob, { defer: !summaryCtx });
676
- log("offer-admit-ms", { ws, ms: Date.now() - _tOffer, deferred: !summaryCtx, ok: res.ok });
675
+ const res = offerAdmit(eng, ws, blob, { defer: false });
676
+ log("offer-admit-ms", { ws, ms: Date.now() - _tOffer, deferred: false, ok: res.ok });
677
677
  if (res.ok) {
678
678
  if (intentId) main.ids.add(intentId);
679
679
  main.oids.add(res.head);
@@ -696,7 +696,6 @@ async function admitIntentOffers(eng, ws, ledger, offers, { receiptFence = null,
696
696
  }
697
697
  timings.sessions = sessions.size;
698
698
  timings.intents = admittedTotal;
699
- if (admittedTotal && !summaryCtx) (eng.pendingProjection ??= /* @__PURE__ */ new Set()).add(ws);
700
699
  if (deadLetters.length) {
701
700
  try {
702
701
  await materializeRefused(eng, ws, ledger, deadLetters);
@@ -704,8 +703,7 @@ async function admitIntentOffers(eng, ws, ledger, offers, { receiptFence = null,
704
703
  log("refused-materialize-failed", { ws, error: String(e).slice(0, 200) });
705
704
  }
706
705
  }
707
- const deferDurability = defer && !summaryCtx;
708
- if (admittedTotal && !deferDurability) {
706
+ if (admittedTotal) {
709
707
  const sealDone = span("seal offered intents", "cseal", 1, { admitted: admittedTotal });
710
708
  await commitAndPush(eng, ws, ledger);
711
709
  sealDone();
@@ -723,7 +721,7 @@ async function admitIntentOffers(eng, ws, ledger, offers, { receiptFence = null,
723
721
  }
724
722
  log("admit-intent-offers", { ws, sessions: sessions.size, admitted: admittedTotal, rejected: [...sessions.values()].reduce((n, s) => n + s.rejected.length, 0), resultPack: resultPackB64 ? "inline" : "none" });
725
723
  const bornPacked = born.length ? packBornChildren(eng, born) : born;
726
- return { sessions: [...sessions.values()].map((s) => ({ ...s, ...s.skipped.length ? {} : { skipped: void 0 } })), main: head, deadLetters, timings, summary: summary ?? null, born: bornPacked, birthOutcomes, ...resultPackB64 ? { resultPackB64, resultBase: clientBase } : {}, ...deferDurability && admittedTotal && head ? { deferred: true, head } : {} };
724
+ return { sessions: [...sessions.values()].map((s) => ({ ...s, ...s.skipped.length ? {} : { skipped: void 0 } })), main: head, deadLetters, timings, summary: summary ?? null, born: bornPacked, birthOutcomes, ...resultPackB64 ? { resultPackB64, resultBase: clientBase } : {} };
727
725
  }
728
726
  async function authorOn(eng, ws, ledger, domain, directiveId, payload, lawHash, opts = {}) {
729
727
  await mountWorkspace(eng, ws, ledger);
@@ -2514,6 +2512,20 @@ async function startDevCloud(opts = {}) {
2514
2512
  res.writeHead(200, { ...CORS, "content-type": "application/wasm", "cache-control": "no-store", "x-nomos-kernel": kernelKind, "x-nomos-kernel-sha": kernelSha });
2515
2513
  return res.end(Buffer.from(wasmBytes));
2516
2514
  }
2515
+ const pinnedKernel = url.pathname.match(/^\/v1\/runtime\/kernels\/([0-9a-f]{64})\/holon\.wasm$/);
2516
+ if (pinnedKernel) {
2517
+ if (pinnedKernel[1] !== kernelSha) {
2518
+ return sendJson(res, { ok: false, error: "kernel artifact not found", requested: pinnedKernel[1] }, 404);
2519
+ }
2520
+ res.writeHead(200, {
2521
+ ...CORS,
2522
+ "content-type": "application/wasm",
2523
+ "cache-control": "public, max-age=31536000, immutable",
2524
+ "x-nomos-kernel": kernelKind,
2525
+ "x-nomos-kernel-sha": kernelSha
2526
+ });
2527
+ return res.end(Buffer.from(wasmBytes));
2528
+ }
2517
2529
  if (url.pathname === "/v1/runtime/capabilities") {
2518
2530
  const stamp = capabilitiesForKernelHash(kernelSha);
2519
2531
  return sendJson(res, {
@@ -2671,6 +2683,15 @@ async function startDevCloud(opts = {}) {
2671
2683
  }
2672
2684
  if (sub[0] === "intent-offers" && req.method === "POST") {
2673
2685
  return await serialize(async () => {
2686
+ if (!custody.get(`holon-${ws}`)) {
2687
+ sendJson(res, {
2688
+ ok: false,
2689
+ retryable: true,
2690
+ ws,
2691
+ error: `custody-provisioning: workspace '${ws}' is awaiting its parent birth; Nomos will retry automatically`
2692
+ }, 409);
2693
+ return;
2694
+ }
2674
2695
  const ledger = ledgerFor(ws);
2675
2696
  await mountWorkspace(eng, ws, ledger);
2676
2697
  const body = JSON.parse((await readBody(req)).toString("utf8") || "{}");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "githolon",
3
- "version": "0.101.0",
3
+ "version": "0.101.2",
4
4
  "type": "module",
5
5
  "description": "githolon — the Nomos developer CLI: Rails-style generators for @githolon/dsl domains + the package compiler. Kernel-independent.",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -29,8 +29,8 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@bjorn3/browser_wasi_shim": "0.4.2",
32
- "@githolon/client": "^0.101.0",
33
- "@githolon/dsl": "^0.101.0",
32
+ "@githolon/client": "^0.101.2",
33
+ "@githolon/dsl": "^0.101.2",
34
34
  "isomorphic-git": "^1.38.4"
35
35
  },
36
36
  "devDependencies": {