githolon 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.
@@ -1548,7 +1548,7 @@ var init_lifecycle_calls = __esm({
1548
1548
 
1549
1549
  // vendor/engine/proto/nomos/kernel/v1/kernel_pb.js
1550
1550
  import { enumDesc, fileDesc, messageDesc, serviceDesc, tsEnum } from "@bufbuild/protobuf/codegenv2";
1551
- var file_nomos_kernel_v1_kernel, CallRequestSchema, CallResponseSchema, PrepareRemoteOfferRequestSchema, PrepareRemoteOfferResponseSchema, ApplyWorkspaceEffectRequestSchema, ApplyWorkspaceEffectResponseSchema, WorkspaceTargetSchema, InitializeWorkspaceRequestSchema, DirectiveCallSchema, AuthoringOptionsSchema, CapturedClockSchema, BirthCertificateSchema, SignBirthCertificateRequestSchema, OfferRequestSchema, QueryRequestSchema, QueryAuthoritySchema, InjectedKeySchema, RowsQuerySchema, PageQuerySchema, ByIdQuerySchema, ByTypeQuerySchema, TallyQuerySchema, SpatialQuerySchema, PendingConflictsQuerySchema, PendingConflictSummaryQuerySchema, NamedQuerySchema, FrontierTransitionRequestSchema, AuthorizationObjectSchema, AuthorizationSubjectSchema, AuthorizationConsistencySchema, AuthorizationCheckRequestSchema, AuthorizationExpandRequestSchema, OutboxRequestSchema, SyncRequestSchema, TestRequestSchema, SetTestRootRequestSchema, CustodyRequestSchema, ResidentFootprintRequestSchema, PackDeltaRequestSchema, ApplyPackRequestSchema, RepoStatsRequestSchema, IntentsAboveRequestSchema, InspectChangeRequestSchema, RefusalVerdictSchema, EncodeRefusalVerdictRequestSchema, InspectRefusalVerdictRequestSchema, ProveCompactionEquivalenceRequestSchema, ReadBlobRequestSchema, ResolveRefRequestSchema, ListRefsRequestSchema, WriteRefRequestSchema, DeleteRefRequestSchema, WriteMetaCommitRequestSchema, LawClosureInfoRequestSchema, CheckpointExportRequestSchema, VerifiedFrontierReceiptSchema, StoredCheckpointManifestSchema, CheckpointImportRequestSchema, CapacityReserveRequestSchema, RestoreMainRequestSchema, ResolveStatePositionRequestSchema, NomosValueSchema, NomosStructSchema, BirthOutcomeStatusSchema, BirthOutcomeStatus, QueryResultFormatSchema, QueryResultFormat, QueryOperationSchema, QueryOperation, KernelLawCapabilitySchema, KernelLawCapability, CheckpointCompressionSchema, CheckpointCompression, CheckpointVerificationPolicySchema, CheckpointVerificationPolicy, CheckpointAssuranceSchema, CheckpointAssurance, IntentTransportRequirementSchema, IntentTransportRequirement, LifecycleInstallPhaseSchema, LifecycleInstallPhase;
1551
+ var file_nomos_kernel_v1_kernel, CallRequestSchema, CallResponseSchema, PrepareRemoteOfferRequestSchema, PrepareRemoteOfferResponseSchema, ApplyWorkspaceEffectRequestSchema, ApplyWorkspaceEffectResponseSchema, WorkspaceTargetSchema, InitializeWorkspaceRequestSchema, DirectiveCallSchema, AuthoringOptionsSchema, CapturedClockSchema, BirthCertificateSchema, SignBirthCertificateRequestSchema, ModelLifecycleIntentSchema, OfferRequestSchema, QueryRequestSchema, QueryAuthoritySchema, InjectedKeySchema, RowsQuerySchema, PageQuerySchema, ByIdQuerySchema, ByTypeQuerySchema, TallyQuerySchema, SpatialQuerySchema, PendingConflictsQuerySchema, PendingConflictSummaryQuerySchema, NamedQuerySchema, FrontierTransitionRequestSchema, FrontierTransitionDispositionMapEntrySchema, FrontierTransitionDispositionsSchema, FrontierTransitionViolationSchema, FrontierTransitionResponseSchema, AuthorizationObjectSchema, AuthorizationSubjectSchema, AuthorizationConsistencySchema, AuthorizationCheckRequestSchema, AuthorizationExpandRequestSchema, OutboxRequestSchema, SyncRequestSchema, TestRequestSchema, SetTestRootRequestSchema, CustodyRequestSchema, ResidentFootprintRequestSchema, PackDeltaRequestSchema, ApplyPackRequestSchema, RepoStatsRequestSchema, IntentsAboveRequestSchema, InspectChangeRequestSchema, RefusalVerdictSchema, EncodeRefusalVerdictRequestSchema, InspectRefusalVerdictRequestSchema, ProveCompactionEquivalenceRequestSchema, ReadBlobRequestSchema, ResolveRefRequestSchema, ListRefsRequestSchema, WriteRefRequestSchema, DeleteRefRequestSchema, WriteMetaCommitRequestSchema, LawClosureInfoRequestSchema, CheckpointExportRequestSchema, VerifiedFrontierReceiptSchema, StoredCheckpointManifestSchema, CheckpointImportRequestSchema, CapacityReserveRequestSchema, RestoreMainRequestSchema, ResolveStatePositionRequestSchema, NomosValueSchema, NomosStructSchema, BirthOutcomeStatusSchema, BirthOutcomeStatus, ModelLifecycleOperationSchema, ModelLifecycleOperation, QueryResultFormatSchema, QueryResultFormat, QueryOperationSchema, QueryOperation, KernelLawCapabilitySchema, KernelLawCapability, CheckpointCompressionSchema, CheckpointCompression, CheckpointVerificationPolicySchema, CheckpointVerificationPolicy, CheckpointAssuranceSchema, CheckpointAssurance, IntentTransportRequirementSchema, IntentTransportRequirement, LifecycleInstallPhaseSchema, LifecycleInstallPhase;
1552
1552
  var init_kernel_pb = __esm({
1553
1553
  "vendor/engine/proto/nomos/kernel/v1/kernel_pb.js"() {
1554
1554
  "use strict";
@@ -1566,6 +1566,7 @@ var init_kernel_pb = __esm({
1566
1566
  CapturedClockSchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 49);
1567
1567
  BirthCertificateSchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 50);
1568
1568
  SignBirthCertificateRequestSchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 51);
1569
+ ModelLifecycleIntentSchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 53);
1569
1570
  OfferRequestSchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 54);
1570
1571
  QueryRequestSchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 57);
1571
1572
  QueryAuthoritySchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 64);
@@ -1580,6 +1581,10 @@ var init_kernel_pb = __esm({
1580
1581
  PendingConflictSummaryQuerySchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 77);
1581
1582
  NamedQuerySchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 78);
1582
1583
  FrontierTransitionRequestSchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 79);
1584
+ FrontierTransitionDispositionMapEntrySchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 80);
1585
+ FrontierTransitionDispositionsSchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 81);
1586
+ FrontierTransitionViolationSchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 82);
1587
+ FrontierTransitionResponseSchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 83);
1583
1588
  AuthorizationObjectSchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 84);
1584
1589
  AuthorizationSubjectSchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 85);
1585
1590
  AuthorizationConsistencySchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 87);
@@ -1618,6 +1623,8 @@ var init_kernel_pb = __esm({
1618
1623
  NomosStructSchema = /* @__PURE__ */ messageDesc(file_nomos_kernel_v1_kernel, 166);
1619
1624
  BirthOutcomeStatusSchema = /* @__PURE__ */ enumDesc(file_nomos_kernel_v1_kernel, 0);
1620
1625
  BirthOutcomeStatus = /* @__PURE__ */ tsEnum(BirthOutcomeStatusSchema);
1626
+ ModelLifecycleOperationSchema = /* @__PURE__ */ enumDesc(file_nomos_kernel_v1_kernel, 3);
1627
+ ModelLifecycleOperation = /* @__PURE__ */ tsEnum(ModelLifecycleOperationSchema);
1621
1628
  QueryResultFormatSchema = /* @__PURE__ */ enumDesc(file_nomos_kernel_v1_kernel, 5);
1622
1629
  QueryResultFormat = /* @__PURE__ */ tsEnum(QueryResultFormatSchema);
1623
1630
  QueryOperationSchema = /* @__PURE__ */ enumDesc(file_nomos_kernel_v1_kernel, 6);
@@ -1727,6 +1734,8 @@ __export(engine_exports, {
1727
1734
  author: () => author,
1728
1735
  authorEphemeral: () => authorEphemeral,
1729
1736
  authorKeygen: () => authorKeygen,
1737
+ authorModelLifecyclePromotion: () => authorModelLifecyclePromotion,
1738
+ authorModelLifecycleStage: () => authorModelLifecycleStage,
1730
1739
  authorOn: () => authorOn,
1731
1740
  authorOperatorCall: () => authorOperatorCall,
1732
1741
  backupHead: () => backupHead,
@@ -2179,6 +2188,100 @@ function workspaceGenesis(eng, ws) {
2179
2188
  function authorOperatorCall(eng, ws, call, controllerHash, opts = {}) {
2180
2189
  return author(eng, ws, call.domain, call.directive, call.canonicalUsda, controllerHash, opts);
2181
2190
  }
2191
+ function authorModelLifecycleStage(eng, ws, lawUsdz, installedBy, supersedes, opts = {}) {
2192
+ const sequence = eng.seq++;
2193
+ const captured = {
2194
+ physical: Date.now(),
2195
+ logical: 0,
2196
+ replica: eng.replica
2197
+ };
2198
+ const response = offerRequestResponse(eng, create(OfferRequestSchema, {
2199
+ target: protoTarget(ws),
2200
+ intent: {
2201
+ case: "modelLifecycle",
2202
+ value: create(ModelLifecycleIntentSchema, {
2203
+ operation: ModelLifecycleOperation.STAGE,
2204
+ installedBy,
2205
+ supersedes
2206
+ })
2207
+ },
2208
+ authoring: create(AuthoringOptionsSchema, {
2209
+ actor: opts.actor ?? "",
2210
+ authToken: opts.authToken ? enc3.encode(opts.authToken) : new Uint8Array(),
2211
+ authorSecret: opts.authorSecret ? bytesFromB64(opts.authorSecret) : new Uint8Array(),
2212
+ validFromEpoch: opts.validFromEpoch === void 0 ? void 0 : BigInt(opts.validFromEpoch),
2213
+ rng: osEntropyBuffer(opts.rngDraws ?? 64),
2214
+ deferProjection: opts.deferProjection !== false,
2215
+ spans: opts.spans ?? false,
2216
+ sequence: BigInt(sequence),
2217
+ clock: create(CapturedClockSchema, {
2218
+ physicalMillis: BigInt(captured.physical),
2219
+ logical: captured.logical,
2220
+ replica: BigInt(captured.replica)
2221
+ })
2222
+ }),
2223
+ lawUsdz
2224
+ }));
2225
+ return offerResult(response);
2226
+ }
2227
+ function authorModelLifecyclePromotion(eng, ws, transition, replaces, acceptanceReason, opts = {}) {
2228
+ const sequence = eng.seq++;
2229
+ const captured = {
2230
+ physical: Date.now(),
2231
+ logical: 0,
2232
+ replica: eng.replica
2233
+ };
2234
+ const dispositions = transition.dispositions === void 0 ? void 0 : create(FrontierTransitionDispositionsSchema, {
2235
+ retired: [...transition.dispositions.retired],
2236
+ retyped: Object.entries(transition.dispositions.retyped).map(
2237
+ ([sourceStableId, acknowledgement]) => create(FrontierTransitionDispositionMapEntrySchema, { sourceStableId, acknowledgement })
2238
+ ),
2239
+ rebinds: Object.entries(transition.dispositions.rebinds).map(
2240
+ ([sourceStableId, acknowledgement]) => create(FrontierTransitionDispositionMapEntrySchema, { sourceStableId, acknowledgement })
2241
+ ),
2242
+ acknowledgedBy: transition.dispositions.ackBy
2243
+ });
2244
+ const response = offerRequestResponse(eng, create(OfferRequestSchema, {
2245
+ target: protoTarget(ws),
2246
+ intent: {
2247
+ case: "modelLifecycle",
2248
+ value: create(ModelLifecycleIntentSchema, {
2249
+ operation: ModelLifecycleOperation.PROMOTE,
2250
+ replaces,
2251
+ acceptanceReason,
2252
+ transition: create(FrontierTransitionResponseSchema, {
2253
+ atHash: transition.atHash,
2254
+ currentHash: transition.currentHash,
2255
+ atStateRoot: transition.atStateRoot ?? "",
2256
+ candidateHash: transition.candidateHash,
2257
+ domain: transition.domain,
2258
+ domains: [...transition.domains ?? []],
2259
+ ready: transition.ready,
2260
+ violations: transition.evolve.violations.map(
2261
+ ({ domain, detail }) => create(FrontierTransitionViolationSchema, { domain, detail })
2262
+ ),
2263
+ dispositions
2264
+ })
2265
+ })
2266
+ },
2267
+ authoring: create(AuthoringOptionsSchema, {
2268
+ actor: opts.actor ?? "",
2269
+ authToken: opts.authToken ? enc3.encode(opts.authToken) : new Uint8Array(),
2270
+ authorSecret: opts.authorSecret ? bytesFromB64(opts.authorSecret) : new Uint8Array(),
2271
+ validFromEpoch: opts.validFromEpoch === void 0 ? void 0 : BigInt(opts.validFromEpoch),
2272
+ rng: osEntropyBuffer(opts.rngDraws ?? 64),
2273
+ deferProjection: opts.deferProjection !== false,
2274
+ spans: opts.spans ?? false,
2275
+ sequence: BigInt(sequence),
2276
+ clock: create(CapturedClockSchema, {
2277
+ physicalMillis: BigInt(captured.physical),
2278
+ logical: captured.logical,
2279
+ replica: BigInt(captured.replica)
2280
+ })
2281
+ })
2282
+ }));
2283
+ return offerResult(response);
2284
+ }
2182
2285
  function initializeWorkspace(eng, ws, installedBy = eng.installedBy) {
2183
2286
  const sequence = eng.seq++;
2184
2287
  const captured = {
@@ -4690,11 +4793,12 @@ function promotePreflighted(eng, ws, domain, candidateHash, opts = {}) {
4690
4793
  acceptanceReason: _acceptance,
4691
4794
  ...authorOpts
4692
4795
  } = opts;
4693
- const result = authorOperatorCall(
4796
+ const result = authorModelLifecyclePromotion(
4694
4797
  eng,
4695
4798
  ws,
4696
- promoteDomainCall(ws, prepared.payload),
4697
- requireCurrentControllerLawHash(eng, ws),
4799
+ report,
4800
+ prepared.payload.replaces,
4801
+ prepared.payload.preflight.acceptanceReason,
4698
4802
  {
4699
4803
  ...authorOpts,
4700
4804
  ...actingPrincipal ? { actor: actingPrincipal } : {}
Binary file
Binary file
package/dist/full-cli.mjs CHANGED
@@ -7821,8 +7821,24 @@ function firstDeviceDelegationPayload(route, certificate, typedPayload) {
7821
7821
  if (declared.has("delegationCertificate")) {
7822
7822
  return { delegationCertificate: typedPayload };
7823
7823
  }
7824
- throw new Error(
7825
- `Nomos application route '${route.domain}${route.path}' does not declare the typed 'delegationCertificate' contract [nomos.application.contract_missing]`
7824
+ throw new NomosClientError(
7825
+ `Nomos application route '${route.domain}${route.path}' does not declare the typed 'delegationCertificate' contract`,
7826
+ {
7827
+ code: "nomos.application.contract_missing",
7828
+ operation: "enrollFirstDevice",
7829
+ recommendedAction: NomosRecommendedAction.redeployLaw,
7830
+ info: {
7831
+ code: "nomos.application.contract_missing",
7832
+ message: `Nomos application route '${route.domain}${route.path}' does not declare the typed 'delegationCertificate' contract`,
7833
+ component: "nomos.application",
7834
+ domain: route.domain,
7835
+ operation: "enrollFirstDevice",
7836
+ attributes: {
7837
+ "nomos.application.missing_contract": "delegationCertificate",
7838
+ "nomos.recovery.action": "repeat-parent-authorized-birth"
7839
+ }
7840
+ }
7841
+ }
7826
7842
  );
7827
7843
  }
7828
7844
  function jwtClaimOf(token, claim) {
@@ -18511,7 +18527,7 @@ var init_lifecycle_calls2 = __esm({
18511
18527
 
18512
18528
  // vendor/engine/proto/nomos/kernel/v1/kernel_pb.js
18513
18529
  import { enumDesc as enumDesc4, fileDesc as fileDesc5, messageDesc as messageDesc5, serviceDesc as serviceDesc3, tsEnum as tsEnum4 } from "@bufbuild/protobuf/codegenv2";
18514
- var file_nomos_kernel_v1_kernel2, CallRequestSchema2, CallResponseSchema2, PrepareRemoteOfferRequestSchema2, PrepareRemoteOfferResponseSchema2, ApplyWorkspaceEffectRequestSchema, ApplyWorkspaceEffectResponseSchema, WorkspaceTargetSchema2, InitializeWorkspaceRequestSchema, DirectiveCallSchema3, AuthoringOptionsSchema3, CapturedClockSchema3, BirthCertificateSchema3, SignBirthCertificateRequestSchema2, OfferRequestSchema3, QueryRequestSchema3, QueryAuthoritySchema3, InjectedKeySchema2, RowsQuerySchema3, PageQuerySchema3, ByIdQuerySchema3, ByTypeQuerySchema2, TallyQuerySchema3, SpatialQuerySchema3, PendingConflictsQuerySchema2, PendingConflictSummaryQuerySchema2, NamedQuerySchema3, FrontierTransitionRequestSchema2, AuthorizationObjectSchema3, AuthorizationSubjectSchema3, AuthorizationConsistencySchema3, AuthorizationCheckRequestSchema3, AuthorizationExpandRequestSchema, OutboxRequestSchema, SyncRequestSchema3, TestRequestSchema3, SetTestRootRequestSchema3, CustodyRequestSchema2, ResidentFootprintRequestSchema, PackDeltaRequestSchema2, ApplyPackRequestSchema2, RepoStatsRequestSchema2, IntentsAboveRequestSchema3, InspectChangeRequestSchema, RefusalVerdictSchema, EncodeRefusalVerdictRequestSchema, InspectRefusalVerdictRequestSchema, ProveCompactionEquivalenceRequestSchema, ReadBlobRequestSchema, ResolveRefRequestSchema2, ListRefsRequestSchema, WriteRefRequestSchema3, DeleteRefRequestSchema3, WriteMetaCommitRequestSchema, LawClosureInfoRequestSchema2, CheckpointExportRequestSchema2, VerifiedFrontierReceiptSchema, StoredCheckpointManifestSchema, CheckpointImportRequestSchema3, CapacityReserveRequestSchema2, RestoreMainRequestSchema2, ResolveStatePositionRequestSchema, NomosValueSchema2, NomosStructSchema2, BirthOutcomeStatusSchema2, BirthOutcomeStatus2, QueryResultFormatSchema2, QueryResultFormat2, QueryOperationSchema2, QueryOperation3, KernelLawCapabilitySchema2, KernelLawCapability2, CheckpointCompressionSchema, CheckpointCompression, CheckpointVerificationPolicySchema, CheckpointVerificationPolicy, CheckpointAssuranceSchema, CheckpointAssurance, IntentTransportRequirementSchema2, IntentTransportRequirement3, LifecycleInstallPhaseSchema, LifecycleInstallPhase;
18530
+ var file_nomos_kernel_v1_kernel2, CallRequestSchema2, CallResponseSchema2, PrepareRemoteOfferRequestSchema2, PrepareRemoteOfferResponseSchema2, ApplyWorkspaceEffectRequestSchema, ApplyWorkspaceEffectResponseSchema, WorkspaceTargetSchema2, InitializeWorkspaceRequestSchema, DirectiveCallSchema3, AuthoringOptionsSchema3, CapturedClockSchema3, BirthCertificateSchema3, SignBirthCertificateRequestSchema2, ModelLifecycleIntentSchema2, OfferRequestSchema3, QueryRequestSchema3, QueryAuthoritySchema3, InjectedKeySchema2, RowsQuerySchema3, PageQuerySchema3, ByIdQuerySchema3, ByTypeQuerySchema2, TallyQuerySchema3, SpatialQuerySchema3, PendingConflictsQuerySchema2, PendingConflictSummaryQuerySchema2, NamedQuerySchema3, FrontierTransitionRequestSchema2, FrontierTransitionDispositionMapEntrySchema, FrontierTransitionDispositionsSchema, FrontierTransitionViolationSchema, FrontierTransitionResponseSchema, AuthorizationObjectSchema3, AuthorizationSubjectSchema3, AuthorizationConsistencySchema3, AuthorizationCheckRequestSchema3, AuthorizationExpandRequestSchema, OutboxRequestSchema, SyncRequestSchema3, TestRequestSchema3, SetTestRootRequestSchema3, CustodyRequestSchema2, ResidentFootprintRequestSchema, PackDeltaRequestSchema2, ApplyPackRequestSchema2, RepoStatsRequestSchema2, IntentsAboveRequestSchema3, InspectChangeRequestSchema, RefusalVerdictSchema, EncodeRefusalVerdictRequestSchema, InspectRefusalVerdictRequestSchema, ProveCompactionEquivalenceRequestSchema, ReadBlobRequestSchema, ResolveRefRequestSchema2, ListRefsRequestSchema, WriteRefRequestSchema3, DeleteRefRequestSchema3, WriteMetaCommitRequestSchema, LawClosureInfoRequestSchema2, CheckpointExportRequestSchema2, VerifiedFrontierReceiptSchema, StoredCheckpointManifestSchema, CheckpointImportRequestSchema3, CapacityReserveRequestSchema2, RestoreMainRequestSchema2, ResolveStatePositionRequestSchema, NomosValueSchema2, NomosStructSchema2, BirthOutcomeStatusSchema2, BirthOutcomeStatus2, ModelLifecycleOperationSchema2, ModelLifecycleOperation3, QueryResultFormatSchema2, QueryResultFormat2, QueryOperationSchema2, QueryOperation3, KernelLawCapabilitySchema2, KernelLawCapability2, CheckpointCompressionSchema, CheckpointCompression, CheckpointVerificationPolicySchema, CheckpointVerificationPolicy, CheckpointAssuranceSchema, CheckpointAssurance, IntentTransportRequirementSchema2, IntentTransportRequirement3, LifecycleInstallPhaseSchema, LifecycleInstallPhase;
18515
18531
  var init_kernel_pb2 = __esm({
18516
18532
  "vendor/engine/proto/nomos/kernel/v1/kernel_pb.js"() {
18517
18533
  "use strict";
@@ -18529,6 +18545,7 @@ var init_kernel_pb2 = __esm({
18529
18545
  CapturedClockSchema3 = /* @__PURE__ */ messageDesc5(file_nomos_kernel_v1_kernel2, 49);
18530
18546
  BirthCertificateSchema3 = /* @__PURE__ */ messageDesc5(file_nomos_kernel_v1_kernel2, 50);
18531
18547
  SignBirthCertificateRequestSchema2 = /* @__PURE__ */ messageDesc5(file_nomos_kernel_v1_kernel2, 51);
18548
+ ModelLifecycleIntentSchema2 = /* @__PURE__ */ messageDesc5(file_nomos_kernel_v1_kernel2, 53);
18532
18549
  OfferRequestSchema3 = /* @__PURE__ */ messageDesc5(file_nomos_kernel_v1_kernel2, 54);
18533
18550
  QueryRequestSchema3 = /* @__PURE__ */ messageDesc5(file_nomos_kernel_v1_kernel2, 57);
18534
18551
  QueryAuthoritySchema3 = /* @__PURE__ */ messageDesc5(file_nomos_kernel_v1_kernel2, 64);
@@ -18543,6 +18560,10 @@ var init_kernel_pb2 = __esm({
18543
18560
  PendingConflictSummaryQuerySchema2 = /* @__PURE__ */ messageDesc5(file_nomos_kernel_v1_kernel2, 77);
18544
18561
  NamedQuerySchema3 = /* @__PURE__ */ messageDesc5(file_nomos_kernel_v1_kernel2, 78);
18545
18562
  FrontierTransitionRequestSchema2 = /* @__PURE__ */ messageDesc5(file_nomos_kernel_v1_kernel2, 79);
18563
+ FrontierTransitionDispositionMapEntrySchema = /* @__PURE__ */ messageDesc5(file_nomos_kernel_v1_kernel2, 80);
18564
+ FrontierTransitionDispositionsSchema = /* @__PURE__ */ messageDesc5(file_nomos_kernel_v1_kernel2, 81);
18565
+ FrontierTransitionViolationSchema = /* @__PURE__ */ messageDesc5(file_nomos_kernel_v1_kernel2, 82);
18566
+ FrontierTransitionResponseSchema = /* @__PURE__ */ messageDesc5(file_nomos_kernel_v1_kernel2, 83);
18546
18567
  AuthorizationObjectSchema3 = /* @__PURE__ */ messageDesc5(file_nomos_kernel_v1_kernel2, 84);
18547
18568
  AuthorizationSubjectSchema3 = /* @__PURE__ */ messageDesc5(file_nomos_kernel_v1_kernel2, 85);
18548
18569
  AuthorizationConsistencySchema3 = /* @__PURE__ */ messageDesc5(file_nomos_kernel_v1_kernel2, 87);
@@ -18581,6 +18602,8 @@ var init_kernel_pb2 = __esm({
18581
18602
  NomosStructSchema2 = /* @__PURE__ */ messageDesc5(file_nomos_kernel_v1_kernel2, 166);
18582
18603
  BirthOutcomeStatusSchema2 = /* @__PURE__ */ enumDesc4(file_nomos_kernel_v1_kernel2, 0);
18583
18604
  BirthOutcomeStatus2 = /* @__PURE__ */ tsEnum4(BirthOutcomeStatusSchema2);
18605
+ ModelLifecycleOperationSchema2 = /* @__PURE__ */ enumDesc4(file_nomos_kernel_v1_kernel2, 3);
18606
+ ModelLifecycleOperation3 = /* @__PURE__ */ tsEnum4(ModelLifecycleOperationSchema2);
18584
18607
  QueryResultFormatSchema2 = /* @__PURE__ */ enumDesc4(file_nomos_kernel_v1_kernel2, 5);
18585
18608
  QueryResultFormat2 = /* @__PURE__ */ tsEnum4(QueryResultFormatSchema2);
18586
18609
  QueryOperationSchema2 = /* @__PURE__ */ enumDesc4(file_nomos_kernel_v1_kernel2, 6);
@@ -18690,6 +18713,8 @@ __export(engine_exports, {
18690
18713
  author: () => author,
18691
18714
  authorEphemeral: () => authorEphemeral,
18692
18715
  authorKeygen: () => authorKeygen,
18716
+ authorModelLifecyclePromotion: () => authorModelLifecyclePromotion,
18717
+ authorModelLifecycleStage: () => authorModelLifecycleStage,
18693
18718
  authorOn: () => authorOn,
18694
18719
  authorOperatorCall: () => authorOperatorCall,
18695
18720
  backupHead: () => backupHead,
@@ -19142,6 +19167,100 @@ function workspaceGenesis(eng, ws) {
19142
19167
  function authorOperatorCall(eng, ws, call, controllerHash, opts = {}) {
19143
19168
  return author(eng, ws, call.domain, call.directive, call.canonicalUsda, controllerHash, opts);
19144
19169
  }
19170
+ function authorModelLifecycleStage(eng, ws, lawUsdz, installedBy, supersedes, opts = {}) {
19171
+ const sequence = eng.seq++;
19172
+ const captured = {
19173
+ physical: Date.now(),
19174
+ logical: 0,
19175
+ replica: eng.replica
19176
+ };
19177
+ const response = offerRequestResponse(eng, create7(OfferRequestSchema3, {
19178
+ target: protoTarget2(ws),
19179
+ intent: {
19180
+ case: "modelLifecycle",
19181
+ value: create7(ModelLifecycleIntentSchema2, {
19182
+ operation: ModelLifecycleOperation3.STAGE,
19183
+ installedBy,
19184
+ supersedes
19185
+ })
19186
+ },
19187
+ authoring: create7(AuthoringOptionsSchema3, {
19188
+ actor: opts.actor ?? "",
19189
+ authToken: opts.authToken ? enc7.encode(opts.authToken) : new Uint8Array(),
19190
+ authorSecret: opts.authorSecret ? bytesFromB64(opts.authorSecret) : new Uint8Array(),
19191
+ validFromEpoch: opts.validFromEpoch === void 0 ? void 0 : BigInt(opts.validFromEpoch),
19192
+ rng: osEntropyBuffer2(opts.rngDraws ?? 64),
19193
+ deferProjection: opts.deferProjection !== false,
19194
+ spans: opts.spans ?? false,
19195
+ sequence: BigInt(sequence),
19196
+ clock: create7(CapturedClockSchema3, {
19197
+ physicalMillis: BigInt(captured.physical),
19198
+ logical: captured.logical,
19199
+ replica: BigInt(captured.replica)
19200
+ })
19201
+ }),
19202
+ lawUsdz
19203
+ }));
19204
+ return offerResult(response);
19205
+ }
19206
+ function authorModelLifecyclePromotion(eng, ws, transition, replaces, acceptanceReason, opts = {}) {
19207
+ const sequence = eng.seq++;
19208
+ const captured = {
19209
+ physical: Date.now(),
19210
+ logical: 0,
19211
+ replica: eng.replica
19212
+ };
19213
+ const dispositions2 = transition.dispositions === void 0 ? void 0 : create7(FrontierTransitionDispositionsSchema, {
19214
+ retired: [...transition.dispositions.retired],
19215
+ retyped: Object.entries(transition.dispositions.retyped).map(
19216
+ ([sourceStableId, acknowledgement]) => create7(FrontierTransitionDispositionMapEntrySchema, { sourceStableId, acknowledgement })
19217
+ ),
19218
+ rebinds: Object.entries(transition.dispositions.rebinds).map(
19219
+ ([sourceStableId, acknowledgement]) => create7(FrontierTransitionDispositionMapEntrySchema, { sourceStableId, acknowledgement })
19220
+ ),
19221
+ acknowledgedBy: transition.dispositions.ackBy
19222
+ });
19223
+ const response = offerRequestResponse(eng, create7(OfferRequestSchema3, {
19224
+ target: protoTarget2(ws),
19225
+ intent: {
19226
+ case: "modelLifecycle",
19227
+ value: create7(ModelLifecycleIntentSchema2, {
19228
+ operation: ModelLifecycleOperation3.PROMOTE,
19229
+ replaces,
19230
+ acceptanceReason,
19231
+ transition: create7(FrontierTransitionResponseSchema, {
19232
+ atHash: transition.atHash,
19233
+ currentHash: transition.currentHash,
19234
+ atStateRoot: transition.atStateRoot ?? "",
19235
+ candidateHash: transition.candidateHash,
19236
+ domain: transition.domain,
19237
+ domains: [...transition.domains ?? []],
19238
+ ready: transition.ready,
19239
+ violations: transition.evolve.violations.map(
19240
+ ({ domain, detail }) => create7(FrontierTransitionViolationSchema, { domain, detail })
19241
+ ),
19242
+ dispositions: dispositions2
19243
+ })
19244
+ })
19245
+ },
19246
+ authoring: create7(AuthoringOptionsSchema3, {
19247
+ actor: opts.actor ?? "",
19248
+ authToken: opts.authToken ? enc7.encode(opts.authToken) : new Uint8Array(),
19249
+ authorSecret: opts.authorSecret ? bytesFromB64(opts.authorSecret) : new Uint8Array(),
19250
+ validFromEpoch: opts.validFromEpoch === void 0 ? void 0 : BigInt(opts.validFromEpoch),
19251
+ rng: osEntropyBuffer2(opts.rngDraws ?? 64),
19252
+ deferProjection: opts.deferProjection !== false,
19253
+ spans: opts.spans ?? false,
19254
+ sequence: BigInt(sequence),
19255
+ clock: create7(CapturedClockSchema3, {
19256
+ physicalMillis: BigInt(captured.physical),
19257
+ logical: captured.logical,
19258
+ replica: BigInt(captured.replica)
19259
+ })
19260
+ })
19261
+ }));
19262
+ return offerResult(response);
19263
+ }
19145
19264
  function initializeWorkspace(eng, ws, installedBy = eng.installedBy) {
19146
19265
  const sequence = eng.seq++;
19147
19266
  const captured = {
@@ -21653,11 +21772,12 @@ function promotePreflighted(eng, ws, domain, candidateHash, opts = {}) {
21653
21772
  acceptanceReason: _acceptance,
21654
21773
  ...authorOpts
21655
21774
  } = opts;
21656
- const result = authorOperatorCall(
21775
+ const result = authorModelLifecyclePromotion(
21657
21776
  eng,
21658
21777
  ws,
21659
- promoteDomainCall(ws, prepared.payload),
21660
- requireCurrentControllerLawHash(eng, ws),
21778
+ report,
21779
+ prepared.payload.replaces,
21780
+ prepared.payload.preflight.acceptanceReason,
21661
21781
  {
21662
21782
  ...authorOpts,
21663
21783
  ...actingPrincipal ? { actor: actingPrincipal } : {}
@@ -31905,7 +32025,6 @@ async function status(wsArg, opts) {
31905
32025
 
31906
32026
  // src/proof_upgrade.ts
31907
32027
  init_engine();
31908
- init_lifecycle_calls2();
31909
32028
  init_cloud();
31910
32029
  init_governance();
31911
32030
  init_local_holon();
@@ -32033,27 +32152,33 @@ async function mountReadOnlyCopy(eng, source, cloud) {
32033
32152
  function tenantPredecessors(candidateDomains, current, frameworkHashes) {
32034
32153
  return [...new Set(candidateDomains.map((domain) => current[domain]).filter((hash) => typeof hash === "string" && !frameworkHashes.has(hash)))];
32035
32154
  }
32036
- function printDifferences(report) {
32037
- out11(` replayed ${report.replayedIntents} historical intent(s); ${report.candidateIntents} candidate action(s)`);
32038
- for (const difference of report.divergences.slice(0, 12)) {
32039
- const location = [difference.domain, difference.directiveId].filter(Boolean).join(".");
32040
- out11(` changed ${difference.kind}${location ? ` at ${location}` : ""}: ${difference.detail}`);
32155
+ function upgradeControllerLawHash(installed, bundledControllerHash) {
32156
+ const active = installed["nomos"];
32157
+ if (typeof active === "string" && /^[0-9a-f]{64}$/.test(active)) return active;
32158
+ if (/^[0-9a-f]{64}$/.test(bundledControllerHash)) return bundledControllerHash;
32159
+ throw new Error("the copied workspace declares no active Nomos lifecycle controller");
32160
+ }
32161
+ function printFrontier(report) {
32162
+ out11(` frontier ${report.atHash.slice(0, 12)}\u2026 state ${report.atStateRoot?.slice(0, 12) ?? "unknown"}\u2026`);
32163
+ out11(` evolution ${report.ready ? "admissible" : "refused"}`);
32164
+ for (const violation of report.evolve.violations) {
32165
+ out11(` violation ${violation.domain}: ${violation.detail}`);
32041
32166
  }
32042
- if (report.divergences.length > 12) out11(` changed + ${report.divergences.length - 12} more difference(s)`);
32043
32167
  }
32044
32168
  function localAuthorIdentity(explicitPrincipal) {
32045
32169
  const selectedPrincipal = explicitPrincipal ?? activePrincipal() ?? ACTOR;
32046
32170
  const actor = canonicalPrincipal2(selectedPrincipal);
32047
32171
  const bareActor = actor.startsWith("user:") ? actor.slice("user:".length) : actor;
32048
32172
  const device = getDeviceKey(selectedPrincipal) ?? getDeviceKey(actor) ?? getDeviceKey(bareActor);
32049
- if (device?.secret === void 0) {
32173
+ const authorSecret = process.env["NOMOS_AUTHOR_SECRET"]?.trim() || device?.secret;
32174
+ if (authorSecret === void 0) {
32050
32175
  throw new Error(
32051
32176
  `upgrade proof needs an enrolled signing device for '${actor}' \u2014 select one with --as <uid> or import/enroll its key first`
32052
32177
  );
32053
32178
  }
32054
32179
  return {
32055
32180
  actor,
32056
- authorSecret: device.secret
32181
+ authorSecret
32057
32182
  };
32058
32183
  }
32059
32184
  async function runUpgradeProof(sourceArg, lawUsdzPath, opts = {}) {
@@ -32071,7 +32196,11 @@ async function runUpgradeProof(sourceArg, lawUsdzPath, opts = {}) {
32071
32196
  return 1;
32072
32197
  }
32073
32198
  try {
32074
- const identity = localAuthorIdentity(opts.principal);
32199
+ const localIdentity = localAuthorIdentity(opts.principal);
32200
+ const identity = {
32201
+ ...localIdentity,
32202
+ ...process.env["NOMOS_AUTH_TOKEN"] ? { authToken: process.env["NOMOS_AUTH_TOKEN"] } : {}
32203
+ };
32075
32204
  const { eng: sourceEngine, runtime } = await holonEngine(cloud, identity.actor);
32076
32205
  const mounted = await mountReadOnlyCopy(sourceEngine, source, cloud);
32077
32206
  const sourceVerdict = verifyChainLocal(sourceEngine, WORKSPACE);
@@ -32092,10 +32221,11 @@ async function runUpgradeProof(sourceArg, lawUsdzPath, opts = {}) {
32092
32221
  const candidate = inspectLawArchive(eng, lawUsdzPath);
32093
32222
  if (candidate.domainKeys.length === 0) throw new Error("candidate law archive carries no business domains");
32094
32223
  const before = currentLaw(eng, WORKSPACE);
32224
+ const controllerLawHash = upgradeControllerLawHash(before, eng.hashes.nomos);
32095
32225
  const predecessors = tenantPredecessors(
32096
32226
  candidate.domainKeys,
32097
32227
  before,
32098
- /* @__PURE__ */ new Set([eng.hashes.bootstrap, eng.hashes.nomos])
32228
+ /* @__PURE__ */ new Set([eng.hashes.bootstrap, eng.hashes.nomos, controllerLawHash])
32099
32229
  );
32100
32230
  const alreadyCurrent = candidate.domainKeys.every((domain) => before[domain] === candidate.identity);
32101
32231
  if (alreadyCurrent) {
@@ -32113,20 +32243,23 @@ async function runUpgradeProof(sourceArg, lawUsdzPath, opts = {}) {
32113
32243
  );
32114
32244
  }
32115
32245
  const predecessor = predecessors[0];
32116
- const staged = authorOperatorCall(
32246
+ const staged = authorModelLifecycleStage(
32117
32247
  eng,
32118
32248
  WORKSPACE,
32119
- stageDomainCall(
32120
- WORKSPACE,
32121
- closureInstallPayload(candidate.identity, identity.actor, { supersedes: predecessor })
32122
- ),
32123
- eng.hashes.nomos,
32124
- { ...identity, lawUsdz: candidate.lawUsdz }
32249
+ candidate.lawUsdz,
32250
+ identity.actor,
32251
+ predecessor,
32252
+ identity
32125
32253
  );
32126
- if (staged.ok === false) throw new Error(`candidate staging refused: ${staged.error ?? "unknown refusal"}`);
32254
+ if (staged.ok === false) {
32255
+ const authority = /authoriz|not permitted/i.test(staged.error ?? "") ? expand(eng, WORKSPACE, "workspace:self", "installDomain").subjects : [];
32256
+ throw new Error(
32257
+ `candidate staging refused: ${staged.error ?? "unknown refusal"}` + (authority.length > 0 ? `; lifecycle authority is held by ${authority.join(", ")}` : "")
32258
+ );
32259
+ }
32127
32260
  const stagedHead = kgit.resolveRef(eng, gitdirOf(WORKSPACE), "refs/heads/main");
32128
32261
  if (!stagedHead) throw new Error("candidate staging produced no current head");
32129
- const report = historyPreflight(
32262
+ const report = frontierTransition(
32130
32263
  eng,
32131
32264
  WORKSPACE,
32132
32265
  candidate.domainKeys[0],
@@ -32137,21 +32270,13 @@ async function runUpgradeProof(sourceArg, lawUsdzPath, opts = {}) {
32137
32270
  out11(`githolon proof --upgrade \u2014 ${source} (${mounted.location}, never modified)`);
32138
32271
  out11(` current ${predecessor.slice(0, 16)}\u2026`);
32139
32272
  out11(` candidate ${candidate.identity.slice(0, 16)}\u2026 (${candidate.domainKeys.join(", ")})`);
32140
- printDifferences(report);
32141
- if (!report.sourceVerified || !report.complete || !report.evolve.ok) {
32142
- throw new Error(
32143
- !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("; ")}`
32144
- );
32145
- }
32146
- if (!report.promotable && !opts.acceptanceReason?.trim()) {
32147
- throw new Error(
32148
- 'the candidate deliberately changes historical business outcomes; review the differences above, then rerun with --acceptance-reason "why this change is correct"'
32149
- );
32273
+ printFrontier(report);
32274
+ if (!report.ready || !report.evolve.ok) {
32275
+ throw new Error(`typed evolution refused: ${report.evolve.violations.map((violation) => violation.detail).join("; ")}`);
32150
32276
  }
32151
32277
  const promoted = promotePreflighted(eng, WORKSPACE, candidate.domainKeys[0], candidate.identity, {
32152
32278
  ...identity,
32153
32279
  replaces: predecessor,
32154
- retireReplaced: true,
32155
32280
  ...opts.acceptanceReason?.trim() ? { acceptanceReason: opts.acceptanceReason.trim() } : {}
32156
32281
  });
32157
32282
  if (!promoted.ok) throw new Error(`disposable promotion refused at ${promoted.stage}: ${promoted.error}`);
@@ -32161,7 +32286,7 @@ async function runUpgradeProof(sourceArg, lawUsdzPath, opts = {}) {
32161
32286
  throw new Error(`promotion completed but ${domain} does not resolve to the candidate model`);
32162
32287
  }
32163
32288
  }
32164
- out11(`\u2713 exact-history promotion admitted in the disposable copy`);
32289
+ out11(`\u2713 current-frontier promotion admitted in the disposable copy`);
32165
32290
  }
32166
32291
  const warmVerdict = verifyChainLocal(eng, WORKSPACE);
32167
32292
  if (warmVerdict.valid !== true) throw new Error(`promoted chain failed verification: ${String(warmVerdict.error ?? "unknown refusal")}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "githolon",
3
- "version": "0.108.3",
3
+ "version": "0.108.4",
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",
@@ -30,7 +30,7 @@
30
30
  "dependencies": {
31
31
  "@bjorn3/browser_wasi_shim": "0.4.2",
32
32
  "@bufbuild/protobuf": "^2.13.0",
33
- "@githolon/dsl": "^0.108.3",
33
+ "@githolon/dsl": "^0.108.4",
34
34
  "fast-xml-parser": "5.10.1",
35
35
  "isomorphic-git": "^1.38.4",
36
36
  "tsx": "^4.19.2"