@githolon/dsl 0.108.6 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@githolon/dsl",
3
- "version": "0.108.6",
3
+ "version": "0.108.7",
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.",
@@ -5372,6 +5372,68 @@ async function main(): Promise<void> {
5372
5372
  typedLawPathsByName.set(domain, compiledLayer.paths);
5373
5373
  }
5374
5374
 
5375
+ // Some exact directives are deliberately private implementation details: they must not appear in
5376
+ // the tenant's generated client, but typed application-law edges can still require the kernel to
5377
+ // execute them. Preserve that distinction here. The exact Directive object and its one configured
5378
+ // export are the authority; neither a string operation registry nor a host-selected adapter is
5379
+ // allowed to make a private directive executable.
5380
+ const retainExactExecutableDirective = (
5381
+ edge: string,
5382
+ declaredDomain: string | undefined,
5383
+ directive: Parameters<typeof synthesizePreconditionInvariants>[0],
5384
+ ) => {
5385
+ const matches = directiveExportSources.filter(
5386
+ (candidate) => candidate.directive === directive,
5387
+ );
5388
+ if (matches.length !== 1) {
5389
+ fail(
5390
+ `${edge} targets '${declaredDomain === undefined ? directive.id : `${declaredDomain}/${directive.id}`}', ` +
5391
+ `but that exact Directive object is ` +
5392
+ `exported by ${matches.length} configured law modules; export it once`,
5393
+ );
5394
+ }
5395
+ const target = matches[0]!;
5396
+ if (declaredDomain !== undefined && target.domainKey !== declaredDomain) {
5397
+ fail(
5398
+ `${edge} declares '${declaredDomain}/${directive.id}', but the exact Directive export belongs ` +
5399
+ `to domain '${target.domainKey}'`,
5400
+ );
5401
+ }
5402
+ const targetIds = executableDirectiveIdsByDomain.get(target.domainKey) ?? [];
5403
+ if (!targetIds.includes(directive.id)) {
5404
+ executableDirectiveIdsByDomain.set(
5405
+ target.domainKey,
5406
+ [...targetIds, directive.id].sort(),
5407
+ );
5408
+ }
5409
+ const targetDirectives = new Map(
5410
+ executableDirectivesByDomain.get(target.domainKey) ?? [],
5411
+ );
5412
+ targetDirectives.set(directive.id, directive);
5413
+ executableDirectivesByDomain.set(target.domainKey, targetDirectives);
5414
+ const targetExports = new Map(
5415
+ offerSourceExportsByDomain.get(target.domainKey) ?? [],
5416
+ );
5417
+ targetExports.set(directive.id, {
5418
+ modulePath: target.modulePath,
5419
+ exportName: target.exportName,
5420
+ aggregateId: directive.aggregateId,
5421
+ });
5422
+ offerSourceExportsByDomain.set(target.domainKey, targetExports);
5423
+ return target;
5424
+ };
5425
+
5426
+ // Application-home genesis is ordinary typed law. Every declared founding step therefore needs
5427
+ // the same exact executable route as a cross-workspace consequence, even when the directive is a
5428
+ // private implementation detail with no public intent pointing at it.
5429
+ for (const step of cfg.application?.homeGenesis?.steps ?? []) {
5430
+ retainExactExecutableDirective(
5431
+ "application home genesis",
5432
+ step.domain,
5433
+ step.directive,
5434
+ );
5435
+ }
5436
+
5375
5437
  // Cross-workspace effects retain the exact target Directive object in the typed application
5376
5438
  // language. Resolve that object back to its configured export once, then generate its nominal
5377
5439
  // USDA encoder from the target's own canonical graph. Runtime law receives no schema descriptor,
@@ -5400,16 +5462,11 @@ async function main(): Promise<void> {
5400
5462
  );
5401
5463
  }
5402
5464
  const source = sourceMatches[0]!;
5403
- const matches = directiveExportSources.filter(
5404
- (candidate) => candidate.directive === effect.target
5465
+ const target = retainExactExecutableDirective(
5466
+ `workspace effect '${sourceDomain}/${directive.id}'`,
5467
+ undefined,
5468
+ effect.target,
5405
5469
  );
5406
- if (matches.length !== 1) {
5407
- fail(
5408
- `workspace effect '${sourceDomain}/${directive.id}' targets '${effect.target.id}', but that exact ` +
5409
- `Directive object is exported by ${matches.length} configured law modules; export it once`
5410
- );
5411
- }
5412
- const target = matches[0]!;
5413
5470
  const graph = typedLawGraphs.get(target.graphName);
5414
5471
  const paths = typedLawPathsByName.get(target.graphName);
5415
5472
  if (graph === undefined || paths === undefined) {
@@ -5417,33 +5474,6 @@ async function main(): Promise<void> {
5417
5474
  `workspace effect target '${target.graphName}/${effect.target.id}' has no canonical law graph`
5418
5475
  );
5419
5476
  }
5420
- // `repliesWorkspace(...)` deliberately targets a private accepted directive: callers must not
5421
- // receive a public API for the machine-only consequence, but the target still needs an exact
5422
- // authenticated execution route. Application-language closure removes private consequences
5423
- // from `module.directives`; restore only targets reached by a typed cross-workspace edge. The
5424
- // exact Directive object and configured export above are the authority—no operation string or
5425
- // host-selected adapter is introduced.
5426
- const targetIds = executableDirectiveIdsByDomain.get(target.domainKey) ?? [];
5427
- if (!targetIds.includes(effect.target.id)) {
5428
- executableDirectiveIdsByDomain.set(
5429
- target.domainKey,
5430
- [...targetIds, effect.target.id].sort(),
5431
- );
5432
- }
5433
- const targetDirectives = new Map(
5434
- executableDirectivesByDomain.get(target.domainKey) ?? [],
5435
- );
5436
- targetDirectives.set(effect.target.id, effect.target);
5437
- executableDirectivesByDomain.set(target.domainKey, targetDirectives);
5438
- const targetExports = new Map(
5439
- offerSourceExportsByDomain.get(target.domainKey) ?? [],
5440
- );
5441
- targetExports.set(effect.target.id, {
5442
- modulePath: target.modulePath,
5443
- exportName: target.exportName,
5444
- aggregateId: effect.target.aggregateId,
5445
- });
5446
- offerSourceExportsByDomain.set(target.domainKey, targetExports);
5447
5477
  const generated = emitTsCallUsdaEncoder(
5448
5478
  graph,
5449
5479
  paths,