@githolon/dsl 0.108.3 → 0.108.4

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.65.2
2
+
3
+ - Preserve complete typed birth lineage and recover existing workspaces through the authenticated
4
+ installed-controller lifecycle without falling back to dynamic host-authored payloads.
5
+
1
6
  ## 0.65.1
2
7
 
3
8
  - Publish the generated nominal application call and query surfaces required by current DSL output, so
@@ -14666,8 +14666,24 @@ function firstDeviceDelegationPayload(route, certificate, typedPayload) {
14666
14666
  if (declared.has("delegationCertificate")) {
14667
14667
  return { delegationCertificate: typedPayload };
14668
14668
  }
14669
- throw new Error(
14670
- `Nomos application route '${route.domain}${route.path}' does not declare the typed 'delegationCertificate' contract [nomos.application.contract_missing]`
14669
+ throw new NomosClientError(
14670
+ `Nomos application route '${route.domain}${route.path}' does not declare the typed 'delegationCertificate' contract`,
14671
+ {
14672
+ code: "nomos.application.contract_missing",
14673
+ operation: "enrollFirstDevice",
14674
+ recommendedAction: NomosRecommendedAction.redeployLaw,
14675
+ info: {
14676
+ code: "nomos.application.contract_missing",
14677
+ message: `Nomos application route '${route.domain}${route.path}' does not declare the typed 'delegationCertificate' contract`,
14678
+ component: "nomos.application",
14679
+ domain: route.domain,
14680
+ operation: "enrollFirstDevice",
14681
+ attributes: {
14682
+ "nomos.application.missing_contract": "delegationCertificate",
14683
+ "nomos.recovery.action": "repeat-parent-authorized-birth"
14684
+ }
14685
+ }
14686
+ }
14671
14687
  );
14672
14688
  }
14673
14689
  var GIT_OBJECT_ID = /^[0-9a-f]{40}$/;
@@ -4390,6 +4390,8 @@ __export(engine_exports, {
4390
4390
  author: () => author,
4391
4391
  authorEphemeral: () => authorEphemeral,
4392
4392
  authorKeygen: () => authorKeygen,
4393
+ authorModelLifecyclePromotion: () => authorModelLifecyclePromotion,
4394
+ authorModelLifecycleStage: () => authorModelLifecycleStage,
4393
4395
  authorOn: () => authorOn,
4394
4396
  authorOperatorCall: () => authorOperatorCall,
4395
4397
  backupHead: () => backupHead,
@@ -10898,6 +10900,7 @@ var AuthoringOptionsSchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_ke
10898
10900
  var CapturedClockSchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 49);
10899
10901
  var BirthCertificateSchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 50);
10900
10902
  var SignBirthCertificateRequestSchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 51);
10903
+ var ModelLifecycleIntentSchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 53);
10901
10904
  var OfferRequestSchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 54);
10902
10905
  var QueryRequestSchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 57);
10903
10906
  var QueryAuthoritySchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 64);
@@ -10912,6 +10915,10 @@ var PendingConflictsQuerySchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_
10912
10915
  var PendingConflictSummaryQuerySchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 77);
10913
10916
  var NamedQuerySchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 78);
10914
10917
  var FrontierTransitionRequestSchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 79);
10918
+ var FrontierTransitionDispositionMapEntrySchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 80);
10919
+ var FrontierTransitionDispositionsSchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 81);
10920
+ var FrontierTransitionViolationSchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 82);
10921
+ var FrontierTransitionResponseSchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 83);
10915
10922
  var AuthorizationObjectSchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 84);
10916
10923
  var AuthorizationSubjectSchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 85);
10917
10924
  var AuthorizationConsistencySchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 87);
@@ -10950,6 +10957,8 @@ var NomosValueSchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel,
10950
10957
  var NomosStructSchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 166);
10951
10958
  var BirthOutcomeStatusSchema = /* @__PURE__ */ enumDesc(file_nomos_kernel_v1_kernel, 0);
10952
10959
  var BirthOutcomeStatus = /* @__PURE__ */ tsEnum(BirthOutcomeStatusSchema);
10960
+ var ModelLifecycleOperationSchema = /* @__PURE__ */ enumDesc(file_nomos_kernel_v1_kernel, 3);
10961
+ var ModelLifecycleOperation = /* @__PURE__ */ tsEnum(ModelLifecycleOperationSchema);
10953
10962
  var QueryResultFormatSchema = /* @__PURE__ */ enumDesc(file_nomos_kernel_v1_kernel, 5);
10954
10963
  var QueryResultFormat = /* @__PURE__ */ tsEnum(QueryResultFormatSchema);
10955
10964
  var QueryOperationSchema = /* @__PURE__ */ enumDesc(file_nomos_kernel_v1_kernel, 6);
@@ -11586,6 +11595,100 @@ var closureInstallPayload = (hash, installedBy, options = {}) => ({
11586
11595
  function authorOperatorCall(eng2, ws, call, controllerHash, opts = {}) {
11587
11596
  return author(eng2, ws, call.domain, call.directive, call.canonicalUsda, controllerHash, opts);
11588
11597
  }
11598
+ function authorModelLifecycleStage(eng2, ws, lawUsdz, installedBy, supersedes, opts = {}) {
11599
+ const sequence = eng2.seq++;
11600
+ const captured = {
11601
+ physical: Date.now(),
11602
+ logical: 0,
11603
+ replica: eng2.replica
11604
+ };
11605
+ const response = offerRequestResponse(eng2, create(OfferRequestSchema, {
11606
+ target: protoTarget(ws),
11607
+ intent: {
11608
+ case: "modelLifecycle",
11609
+ value: create(ModelLifecycleIntentSchema, {
11610
+ operation: ModelLifecycleOperation.STAGE,
11611
+ installedBy,
11612
+ supersedes
11613
+ })
11614
+ },
11615
+ authoring: create(AuthoringOptionsSchema, {
11616
+ actor: opts.actor ?? "",
11617
+ authToken: opts.authToken ? enc3.encode(opts.authToken) : new Uint8Array(),
11618
+ authorSecret: opts.authorSecret ? bytesFromB64(opts.authorSecret) : new Uint8Array(),
11619
+ validFromEpoch: opts.validFromEpoch === void 0 ? void 0 : BigInt(opts.validFromEpoch),
11620
+ rng: osEntropyBuffer(opts.rngDraws ?? 64),
11621
+ deferProjection: opts.deferProjection !== false,
11622
+ spans: opts.spans ?? false,
11623
+ sequence: BigInt(sequence),
11624
+ clock: create(CapturedClockSchema, {
11625
+ physicalMillis: BigInt(captured.physical),
11626
+ logical: captured.logical,
11627
+ replica: BigInt(captured.replica)
11628
+ })
11629
+ }),
11630
+ lawUsdz
11631
+ }));
11632
+ return offerResult(response);
11633
+ }
11634
+ function authorModelLifecyclePromotion(eng2, ws, transition, replaces, acceptanceReason, opts = {}) {
11635
+ const sequence = eng2.seq++;
11636
+ const captured = {
11637
+ physical: Date.now(),
11638
+ logical: 0,
11639
+ replica: eng2.replica
11640
+ };
11641
+ const dispositions = transition.dispositions === void 0 ? void 0 : create(FrontierTransitionDispositionsSchema, {
11642
+ retired: [...transition.dispositions.retired],
11643
+ retyped: Object.entries(transition.dispositions.retyped).map(
11644
+ ([sourceStableId, acknowledgement]) => create(FrontierTransitionDispositionMapEntrySchema, { sourceStableId, acknowledgement })
11645
+ ),
11646
+ rebinds: Object.entries(transition.dispositions.rebinds).map(
11647
+ ([sourceStableId, acknowledgement]) => create(FrontierTransitionDispositionMapEntrySchema, { sourceStableId, acknowledgement })
11648
+ ),
11649
+ acknowledgedBy: transition.dispositions.ackBy
11650
+ });
11651
+ const response = offerRequestResponse(eng2, create(OfferRequestSchema, {
11652
+ target: protoTarget(ws),
11653
+ intent: {
11654
+ case: "modelLifecycle",
11655
+ value: create(ModelLifecycleIntentSchema, {
11656
+ operation: ModelLifecycleOperation.PROMOTE,
11657
+ replaces,
11658
+ acceptanceReason,
11659
+ transition: create(FrontierTransitionResponseSchema, {
11660
+ atHash: transition.atHash,
11661
+ currentHash: transition.currentHash,
11662
+ atStateRoot: transition.atStateRoot ?? "",
11663
+ candidateHash: transition.candidateHash,
11664
+ domain: transition.domain,
11665
+ domains: [...transition.domains ?? []],
11666
+ ready: transition.ready,
11667
+ violations: transition.evolve.violations.map(
11668
+ ({ domain, detail }) => create(FrontierTransitionViolationSchema, { domain, detail })
11669
+ ),
11670
+ dispositions
11671
+ })
11672
+ })
11673
+ },
11674
+ authoring: create(AuthoringOptionsSchema, {
11675
+ actor: opts.actor ?? "",
11676
+ authToken: opts.authToken ? enc3.encode(opts.authToken) : new Uint8Array(),
11677
+ authorSecret: opts.authorSecret ? bytesFromB64(opts.authorSecret) : new Uint8Array(),
11678
+ validFromEpoch: opts.validFromEpoch === void 0 ? void 0 : BigInt(opts.validFromEpoch),
11679
+ rng: osEntropyBuffer(opts.rngDraws ?? 64),
11680
+ deferProjection: opts.deferProjection !== false,
11681
+ spans: opts.spans ?? false,
11682
+ sequence: BigInt(sequence),
11683
+ clock: create(CapturedClockSchema, {
11684
+ physicalMillis: BigInt(captured.physical),
11685
+ logical: captured.logical,
11686
+ replica: BigInt(captured.replica)
11687
+ })
11688
+ })
11689
+ }));
11690
+ return offerResult(response);
11691
+ }
11589
11692
  function initializeWorkspace(eng2, ws, installedBy = eng2.installedBy) {
11590
11693
  const sequence = eng2.seq++;
11591
11694
  const captured = {
@@ -14457,11 +14560,12 @@ function promotePreflighted(eng2, ws, domain, candidateHash, opts = {}) {
14457
14560
  acceptanceReason: _acceptance,
14458
14561
  ...authorOpts
14459
14562
  } = opts;
14460
- const result = authorOperatorCall(
14563
+ const result = authorModelLifecyclePromotion(
14461
14564
  eng2,
14462
14565
  ws,
14463
- promoteDomainCall(ws, prepared.payload),
14464
- requireCurrentControllerLawHash(eng2, ws),
14566
+ report,
14567
+ prepared.payload.replaces,
14568
+ prepared.payload.preflight.acceptanceReason,
14465
14569
  {
14466
14570
  ...authorOpts,
14467
14571
  ...actingPrincipal ? { actor: actingPrincipal } : {}
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.65.1
10
+ version: 0.65.2
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.108.3",
3
+ "version": "0.108.4",
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.",
@@ -13088,8 +13088,24 @@ function firstDeviceDelegationPayload(route, certificate, typedPayload) {
13088
13088
  if (declared.has("delegationCertificate")) {
13089
13089
  return { delegationCertificate: typedPayload };
13090
13090
  }
13091
- throw new Error(
13092
- `Nomos application route '${route.domain}${route.path}' does not declare the typed 'delegationCertificate' contract [nomos.application.contract_missing]`
13091
+ throw new NomosClientError(
13092
+ `Nomos application route '${route.domain}${route.path}' does not declare the typed 'delegationCertificate' contract`,
13093
+ {
13094
+ code: "nomos.application.contract_missing",
13095
+ operation: "enrollFirstDevice",
13096
+ recommendedAction: NomosRecommendedAction.redeployLaw,
13097
+ info: {
13098
+ code: "nomos.application.contract_missing",
13099
+ message: `Nomos application route '${route.domain}${route.path}' does not declare the typed 'delegationCertificate' contract`,
13100
+ component: "nomos.application",
13101
+ domain: route.domain,
13102
+ operation: "enrollFirstDevice",
13103
+ attributes: {
13104
+ "nomos.application.missing_contract": "delegationCertificate",
13105
+ "nomos.recovery.action": "repeat-parent-authorized-birth"
13106
+ }
13107
+ }
13108
+ }
13093
13109
  );
13094
13110
  }
13095
13111
  var GIT_OBJECT_ID = /^[0-9a-f]{40}$/;
@@ -22497,7 +22513,9 @@ async function nomosInternalOpenGeneratedApplication(options, bind, internals =
22497
22513
  try {
22498
22514
  await measureOpen("confirm private-custody signer enrolment", enroll);
22499
22515
  } catch (error) {
22500
- if (!String(error).includes("receiving-group-additional-device-requires-current-device-or-guardian")) throw error;
22516
+ const errorCode = typeof error === "object" && error !== null && "code" in error ? String(error.code ?? "") : "";
22517
+ const parentAuthorizedMigrationRequired = errorCode === "nomos.application.contract_missing" || String(error).includes("receiving-group-additional-device-requires-current-device-or-guardian");
22518
+ if (!parentAuthorizedMigrationRequired) throw error;
22501
22519
  await birthOrRepeat();
22502
22520
  await measureOpen("verify recovered private-custody signer enrolment", enroll);
22503
22521
  }
@@ -199,8 +199,20 @@ function readCurrentAuthProviderRows() {
199
199
  try {
200
200
  return readFrameworkDeclaredRows(authProvider, AuthProvider, { scope: "platform" });
201
201
  } catch (error) {
202
- if (error instanceof z.ZodError && error.issues.some((issue) =>
203
- issue.code === "unrecognized_keys" && issue.keys.includes("keys")
202
+ // Law plans execute in the deterministic VM, not in the compiler's Node
203
+ // realm. Imported class identity therefore cannot be used as an
204
+ // `instanceof` discriminator here: the compiler may carry the property
205
+ // path without carrying a constructible host class. Zod's issue list is
206
+ // already the nominal failure disclosure we need; inspect that bounded
207
+ // shape without depending on host-realm prototype identity.
208
+ const issues = error !== null && typeof error === "object" &&
209
+ "issues" in error && Array.isArray(error.issues)
210
+ ? error.issues
211
+ : [];
212
+ if (issues.some((issue: unknown) =>
213
+ issue !== null && typeof issue === "object" &&
214
+ "code" in issue && issue.code === "unrecognized_keys" &&
215
+ "keys" in issue && Array.isArray(issue.keys) && issue.keys.includes("keys")
204
216
  )) {
205
217
  throw new Error(
206
218
  "the AuthProvider still uses the historical serialized key field; migrate it to a typed keySet first",