@githolon/dsl 0.112.0 → 0.112.1

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/dart/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.66.10
2
+
3
+ - Share the existing typed platform-effect handler with browser background work, so console enrolment, device identity and law acquisition can complete without a foreground invocation.
4
+ - Restage the peer runtime with residency-aware live correspondence and full Git-ref retention checks.
5
+
1
6
  ## 0.66.9
2
7
 
3
8
  - Prepare delayed workspace enrollment inside Peer Office and retry a proven non-admitted write once. Generated applications can observe preparation while retaining their draft.
@@ -7290,7 +7290,7 @@ function runtimeKernelPort(engine) {
7290
7290
  case: "resolveRef",
7291
7291
  value: create(ResolveRefRequestSchema, {
7292
7292
  repo: workspaceRepositoryPath(workspace),
7293
- reference: `refs/heads/${branch}`
7293
+ reference: branch.startsWith("refs/") ? branch : `refs/heads/${branch}`
7294
7294
  })
7295
7295
  }
7296
7296
  })
@@ -8272,7 +8272,6 @@ function gitCustodyDesk(kernel, fetchImpl = fetch, observe, phaseStarted) {
8272
8272
  return acquired;
8273
8273
  },
8274
8274
  deepenMain(workspace, ledger) {
8275
- if (ledger.operatorCustody !== true) return Promise.resolve({ changed: false, complete: true });
8276
8275
  return acquiring(workspace, ledger, "deepen-main", async () => {
8277
8276
  if (resolveRef(workspace, branchRef("main")) === void 0) {
8278
8277
  const acquired = await acquireMain(workspace, ledger);
@@ -13601,6 +13600,7 @@ var PeerPlatformShell = class {
13601
13600
  // one constitutional genesis offer. WorkspaceAccessDesk decides whether
13602
13601
  // that exact request may proceed against the unborn kernel mount.
13603
13602
  async openCustody(workspace) {
13603
+ if (physical.openLocalCustody) return physical.openLocalCustody(workspace);
13604
13604
  await custody.acquireMain(workspace, await ledgerFor(workspace));
13605
13605
  return {};
13606
13606
  },
@@ -13616,7 +13616,12 @@ var PeerPlatformShell = class {
13616
13616
  },
13617
13617
  persistBornCustody: (effect) => physical.persistBornCustody(effect),
13618
13618
  retainFrontier: (effect) => physical.retainFrontier(effect),
13619
- ...physical.completeHistoryInLocalCustody ? {
13619
+ ...physical.advanceHistory ? {
13620
+ advanceHistory: (workspace, capability) => {
13621
+ const credential = capability ? this.#credentials.authToken(capability) : authToken;
13622
+ return physical.advanceHistory(workspace, credential && new TextDecoder().decode(credential));
13623
+ }
13624
+ } : physical.completeHistoryInLocalCustody ? {
13620
13625
  // The kernel mounts a shallow working copy; the peer's own Git custody is deep.
13621
13626
  // One bounded slice per call; the Peer Office decides whether and when to take the next.
13622
13627
  async advanceHistory(workspace) {
@@ -22969,10 +22974,11 @@ var LiveCorrespondenceDesk = class {
22969
22974
  failures: 0,
22970
22975
  origin: origin2,
22971
22976
  publisher: !binding.cloudBound,
22972
- published: !binding.cloudBound ? head : void 0
22977
+ published: !binding.cloudBound ? head : void 0,
22978
+ wasResident: this.kernel.isResident(binding.workspace) !== false
22973
22979
  };
22974
22980
  this.#links.set(binding.workspace, link);
22975
- this.#open(link);
22981
+ if (link.wasResident) this.#open(link);
22976
22982
  }
22977
22983
  changed(workspace) {
22978
22984
  const link = this.#links.get(workspace);
@@ -23129,9 +23135,11 @@ var LiveCorrespondenceDesk = class {
23129
23135
  let wake;
23130
23136
  for (const link of this.#links.values()) {
23131
23137
  if (this.kernel.isResident(link.binding.workspace) === false) {
23132
- this.disconnect(link.binding.workspace);
23138
+ if (link.wasResident) this.disconnect(link.binding.workspace);
23139
+ else wake = wake === void 0 || wake > 250n ? 250n : wake;
23133
23140
  continue;
23134
23141
  }
23142
+ link.wasResident = true;
23135
23143
  if (link.state === "opening" && now >= link.due) {
23136
23144
  this.#effect(link, { case: "close", value: true });
23137
23145
  link.state = "closed";
@@ -30812,7 +30820,7 @@ var executeGitPushEffect = async (effect, fetchImpl) => {
30812
30820
  });
30813
30821
  }
30814
30822
  };
30815
- async function drivePeerFrame(runner, initialFrame, fetchImpl = globalThis.fetch, custody, bornCustody, credentialRefresh, yieldWakeToCaller = false, deviceIdentity, lawPackage, yieldLocalReadToCaller = false, yieldHistoryToCaller = false) {
30823
+ async function drivePeerFrame(runner, initialFrame, fetchImpl = globalThis.fetch, custody, bornCustody, credentialRefresh, yieldWakeToCaller = false, deviceIdentity, lawPackage, yieldLocalReadToCaller = false, yieldHistoryToCaller = false, performExternalEffect) {
30816
30824
  const persistBornCustody = bornCustody ?? (custody?.persistBornCustody ? (effect) => custody.persistBornCustody(effect) : void 0);
30817
30825
  let responseFrame = runner.handleFrame(initialFrame);
30818
30826
  const satisfied = /* @__PURE__ */ new Set();
@@ -30948,12 +30956,10 @@ async function drivePeerFrame(runner, initialFrame, fetchImpl = globalThis.fetch
30948
30956
  if (pending.effect.case === "historyAcquisition" && (yieldHistoryToCaller || !custody?.advanceHistory)) {
30949
30957
  return responseFrame;
30950
30958
  }
30951
- if (pending.effect.case === "refreshCredential" && credentialRefresh === externalPeerEffect) return responseFrame;
30952
- if (pending.effect.case === "deviceIdentity" && deviceIdentity === externalPeerEffect) return responseFrame;
30953
- if (pending.effect.case === "lawPackage" && lawPackage === externalPeerEffect) return responseFrame;
30954
30959
  if (pending.effect.case === "wake" && yieldWakeToCaller) return responseFrame;
30955
- if (pending.effect.case === "consoleEnrolment") return responseFrame;
30956
- const receipt = pending.effect.case === "http" ? await executeHttpEffect(pending.effect.value, fetchImpl) : pending.effect.case === "gitFetch" ? await executeGitFetchWithAlongside(pending.effect.value, fetchImpl) : pending.effect.case === "gitPush" ? await executeGitPushEffect(pending.effect.value, fetchImpl) : pending.effect.case === "persistBornCustody" ? create(PeerEffectReceiptSchema, {
30960
+ const external = pending.effect.case === "refreshCredential" && credentialRefresh === externalPeerEffect || pending.effect.case === "deviceIdentity" && deviceIdentity === externalPeerEffect || pending.effect.case === "lawPackage" && lawPackage === externalPeerEffect || pending.effect.case === "consoleEnrolment";
30961
+ if (external && !performExternalEffect) return responseFrame;
30962
+ const receipt = external ? await performExternalEffect(pending) : pending.effect.case === "http" ? await executeHttpEffect(pending.effect.value, fetchImpl) : pending.effect.case === "gitFetch" ? await executeGitFetchWithAlongside(pending.effect.value, fetchImpl) : pending.effect.case === "gitPush" ? await executeGitPushEffect(pending.effect.value, fetchImpl) : pending.effect.case === "persistBornCustody" ? create(PeerEffectReceiptSchema, {
30957
30963
  effectId: pending.effect.value.effectId,
30958
30964
  outcome: {
30959
30965
  case: "bornCustodyPersisted",
@@ -30981,7 +30987,7 @@ async function drivePeerFrame(runner, initialFrame, fetchImpl = globalThis.fetch
30981
30987
  async function executeHistoryAcquisitionEffect(effect, custody) {
30982
30988
  try {
30983
30989
  if (!custody.advanceHistory) throw new Error("platform shell has no history acquisition capability");
30984
- const progress = await custody.advanceHistory(effect.workspace);
30990
+ const progress = await custody.advanceHistory(effect.workspace, effect.credentialCapability);
30985
30991
  return create(PeerEffectReceiptSchema, {
30986
30992
  effectId: effect.effectId,
30987
30993
  outcome: {
@@ -31212,7 +31218,7 @@ var targetOf = (frame) => {
31212
31218
  };
31213
31219
  };
31214
31220
  function openPeerOfficeHost(kernel, shell, fetchImpl = globalThis.fetch, maintenanceSettled, postEvent2 = () => {
31215
- }, credentialRefresh, yieldWakeToCaller = false, deviceIdentity, lawPackage) {
31221
+ }, credentialRefresh, yieldWakeToCaller = false, deviceIdentity, lawPackage, performExternalEffect) {
31216
31222
  let runner;
31217
31223
  const configuredOrigins = new Set((shell.providerOrigins?.() ?? []).map((provider) => originOf(provider)).filter((origin2) => origin2 !== void 0));
31218
31224
  const permittedSocket = (url) => {
@@ -31221,10 +31227,10 @@ function openPeerOfficeHost(kernel, shell, fetchImpl = globalThis.fetch, mainten
31221
31227
  return origin2 !== void 0 && configuredOrigins.has(origin2);
31222
31228
  };
31223
31229
  const sockets = socketEffects(
31224
- (frame) => drivePeerFrame(runner, frame, fetchImpl, shell.custodyPort(), void 0, void 0, false, deviceIdentity, lawPackage),
31230
+ (frame) => drivePeerFrame(runner, frame, fetchImpl, shell.custodyPort(), void 0, void 0, false, deviceIdentity, lawPackage, false, false, performExternalEffect),
31225
31231
  permittedSocket
31226
31232
  );
31227
- const credentials = credentialEffects((frame) => drivePeerFrame(runner, frame, fetchImpl, shell.custodyPort(), void 0, credentialRefresh, false, deviceIdentity, lawPackage), credentialRefresh);
31233
+ const credentials = credentialEffects((frame) => drivePeerFrame(runner, frame, fetchImpl, shell.custodyPort(), void 0, credentialRefresh, false, deviceIdentity, lawPackage, false, false, performExternalEffect), credentialRefresh);
31228
31234
  runner = createPeerOfficeFrameRunner(
31229
31235
  kernel,
31230
31236
  shell.credentials(),
@@ -31249,7 +31255,10 @@ function openPeerOfficeHost(kernel, shell, fetchImpl = globalThis.fetch, mainten
31249
31255
  credentialRefresh,
31250
31256
  false,
31251
31257
  deviceIdentity,
31252
- lawPackage
31258
+ lawPackage,
31259
+ false,
31260
+ false,
31261
+ performExternalEffect
31253
31262
  );
31254
31263
  },
31255
31264
  shell.peerDeskStore()
@@ -31301,7 +31310,10 @@ function openPeerOfficeHost(kernel, shell, fetchImpl = globalThis.fetch, mainten
31301
31310
  credentialRefresh,
31302
31311
  yieldWakeToCaller,
31303
31312
  deviceIdentity,
31304
- lawPackage
31313
+ lawPackage,
31314
+ false,
31315
+ false,
31316
+ performExternalEffect
31305
31317
  );
31306
31318
  },
31307
31319
  settleRetention: (withinMillis) => runner.settleRetention(withinMillis),
@@ -477,6 +477,36 @@ mixin NmsPlatformCredentialProviderHost
477
477
  }
478
478
  }
479
479
 
480
+ /// Execute one typed effect carried by either a foreground or background paper.
481
+ Future<nomos_protocol.PeerEffectReceipt> performExternalEffect(
482
+ nomos_protocol.CorrespondencePending pending,
483
+ ) async {
484
+ final nomos_protocol.PeerEffectReceipt receipt;
485
+ if (pending.hasDeviceIdentity()) {
486
+ receipt = await performDeviceIdentityEffect(pending.deviceIdentity);
487
+ } else if (pending.hasLawPackage()) {
488
+ receipt = await performLawPackageEffect(pending.lawPackage);
489
+ } else if (pending.hasConsoleEnrolment()) {
490
+ receipt = await performConsoleEnrolment(pending.consoleEnrolment);
491
+ } else if (pending.hasWake()) {
492
+ // The shared runtime chooses the delay and checks its own clock.
493
+ // Waiting outside the serial Node frame lane keeps it available for
494
+ // credential-provider calls while authentication is pending.
495
+ await Future<void>.delayed(
496
+ Duration(milliseconds: pending.wake.delayMillis),
497
+ );
498
+ receipt = nomos_protocol.PeerEffectReceipt(
499
+ effectId: pending.wake.effectId,
500
+ woken: nomos_protocol.PeerWoken(),
501
+ );
502
+ } else if (pending.hasRefreshCredential()) {
503
+ receipt = await performCredentialRefresh(pending.refreshCredential);
504
+ } else {
505
+ throw StateError('Unsupported enclosing-shell effect');
506
+ }
507
+ return receipt;
508
+ }
509
+
480
510
  Future<nomos_protocol.RuntimeResponse> driveCredentialEffects(
481
511
  nomos_protocol.RuntimeRequest request,
482
512
  Future<nomos_protocol.RuntimeResponse> Function(
@@ -498,26 +528,7 @@ mixin NmsPlatformCredentialProviderHost
498
528
  !response.correspondencePending.hasConsoleEnrolment() &&
499
529
  !response.correspondencePending.hasWake())) return response;
500
530
  final pending = response.correspondencePending;
501
- final nomos_protocol.PeerEffectReceipt receipt;
502
- if (pending.hasDeviceIdentity()) {
503
- receipt = await performDeviceIdentityEffect(pending.deviceIdentity);
504
- } else if (pending.hasLawPackage()) {
505
- receipt = await performLawPackageEffect(pending.lawPackage);
506
- } else if (pending.hasConsoleEnrolment()) {
507
- receipt = await performConsoleEnrolment(pending.consoleEnrolment);
508
- } else if (pending.hasWake()) {
509
- // The shared runtime chooses the delay and checks its own clock.
510
- // Waiting outside the serial Node frame lane keeps it available for
511
- // credential-provider calls while authentication is pending.
512
- await Future<void>.delayed(
513
- Duration(milliseconds: pending.wake.delayMillis));
514
- receipt = nomos_protocol.PeerEffectReceipt(
515
- effectId: pending.wake.effectId,
516
- woken: nomos_protocol.PeerWoken(),
517
- );
518
- } else {
519
- receipt = await performCredentialRefresh(pending.refreshCredential);
520
- }
531
+ final receipt = await performExternalEffect(pending);
521
532
  next = nomos_protocol.RuntimeRequest(
522
533
  protocolVersion: 2,
523
534
  requestId: request.requestId,
package/dart/pubspec.yaml CHANGED
@@ -7,7 +7,7 @@ repository: https://github.com/Captain-App/nomos2
7
7
  description: >-
8
8
  Nomos 2 Dart client — generated domain values, intent payloads and application
9
9
  lifecycle types over the typed Nomos kernel protocol and USDA custody model.
10
- version: 0.66.9
10
+ version: 0.66.10
11
11
 
12
12
  environment:
13
13
  sdk: ^3.5.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@githolon/dsl",
3
- "version": "0.112.0",
3
+ "version": "0.112.1",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "Nomos 2 domain-authoring DSL: aggregates + directives in TS, executed and encoded to the Rust kernel's wire shapes.",
@@ -73,7 +73,7 @@
73
73
  "test": "vitest run"
74
74
  },
75
75
  "dependencies": {
76
- "@githolon/runtime": "^0.112.0",
76
+ "@githolon/runtime": "^0.112.1",
77
77
  "@bufbuild/protobuf": "^2.13.0",
78
78
  "@bufbuild/protoc-gen-es": "^2.13.0",
79
79
  "esbuild": "0.24.2",
@@ -2545,8 +2545,8 @@ const NOMOS_TYPES_DEP = "^0.11.3";
2545
2545
  // 0.48.x: session-bound clients (XClient.bind/NomosClientInterface/DomainClientSessionMismatch/
2546
2546
  // DomainNotInstalledForSession, engine.follow, pendingConflicts lanes) — the generated client
2547
2547
  // REQUIRES this surface. 0.48.1 fixes NomosSession.watchPendingConflicts delegation.
2548
- const NOMOS_CLIENT_DEP = "^0.66.9";
2549
- const NOMOS_FLUTTER_DEP = "^0.65.14";
2548
+ const NOMOS_CLIENT_DEP = "^0.66.10";
2549
+ const NOMOS_FLUTTER_DEP = "^0.65.15";
2550
2550
  // DRIFT TRIPWIRE: pubspec_pins.test.ts asserts these equal the CURRENT versions in the Dart and Flutter
2551
2551
  // package pubspecs — a release without this bump fails the suite, so tenants never
2552
2552
  // land back in dependency_overrides (the exact co2 report this closes, third occurrence).