@xemahq/xema 0.41.0 → 0.41.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.
@@ -62924,6 +62924,14 @@ function resetEditionWorkspaceConfig() {
62924
62924
  cached = void 0;
62925
62925
  }
62926
62926
 
62927
+ // edition/string-order.mjs
62928
+ function compareStrings(a, b) {
62929
+ if (a === b) {
62930
+ return 0;
62931
+ }
62932
+ return a < b ? -1 : 1;
62933
+ }
62934
+
62927
62935
  // edition/evidence-grammars.mjs
62928
62936
  var COMMIT_PATTERN = /^[a-f0-9]{40}$/;
62929
62937
  var SHA256_HEX_PATTERN = /^[a-f0-9]{64}$/;
@@ -62939,16 +62947,6 @@ var requireFromHere2 = createRequire2(import.meta.url);
62939
62947
 
62940
62948
  // edition/operation-requirements.mjs
62941
62949
  import { createRequire as createRequire3 } from "node:module";
62942
-
62943
- // edition/string-order.mjs
62944
- function compareStrings(a, b) {
62945
- if (a === b) {
62946
- return 0;
62947
- }
62948
- return a < b ? -1 : 1;
62949
- }
62950
-
62951
- // edition/operation-requirements.mjs
62952
62950
  var requireFromHere3 = createRequire3(import.meta.url);
62953
62951
  var PRINCIPAL_PRIVILEGE_FIELDS = Object.freeze(["requiresOperations", "optionalOperations", "requiresOrganizationSweeps"]);
62954
62952
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "artifactSha256": "sha256:4acede935bc574c1d35a03eac3e9f47ad2338f0065bdf046b9b1ddc9cd10e4ea",
3
+ "artifactSha256": "sha256:5966f006186455653ee4f41c2d1b9995d5af4e1e2956d6f7395f7479a73f252f",
4
4
  "esbuild": {
5
5
  "version": "0.28.2"
6
6
  },
@@ -2383,247 +2383,253 @@
2383
2383
  },
2384
2384
  {
2385
2385
  "package": "@xemahq/xema",
2386
- "version": "0.41.0",
2386
+ "version": "0.41.1",
2387
2387
  "path": "edition/adapter-host-versions.mjs",
2388
2388
  "sha256": "sha256:1b7ebd3592f4da1225fba74aaba912e7d85fbceeb1626f7dcdac83491cbb4d69"
2389
2389
  },
2390
2390
  {
2391
2391
  "package": "@xemahq/xema",
2392
- "version": "0.41.0",
2392
+ "version": "0.41.1",
2393
2393
  "path": "edition/authorization-base.mjs",
2394
2394
  "sha256": "sha256:bbeac7ff01376cb89ed2140526d4795d8e559b3f01612b404a701f19aaa24c6a"
2395
2395
  },
2396
2396
  {
2397
2397
  "package": "@xemahq/xema",
2398
- "version": "0.41.0",
2398
+ "version": "0.41.1",
2399
2399
  "path": "edition/build-ledger.mjs",
2400
2400
  "sha256": "sha256:05202cbdd606aee086c8e9c62d28be68c429653a8b1d73a289ed0fe4ff14da85"
2401
2401
  },
2402
2402
  {
2403
2403
  "package": "@xemahq/xema",
2404
- "version": "0.41.0",
2404
+ "version": "0.41.1",
2405
2405
  "path": "edition/connector-source-authority.mjs",
2406
2406
  "sha256": "sha256:ea94475f4324737673accd7de1303c44db1cbc4dac61a865a06cd83abe310164"
2407
2407
  },
2408
2408
  {
2409
2409
  "package": "@xemahq/xema",
2410
- "version": "0.41.0",
2410
+ "version": "0.41.1",
2411
+ "path": "edition/dispatched-runtime-components.mjs",
2412
+ "sha256": "sha256:32a972640de9cc004d2c44e6667a2eaceea7c7ff2b2a5754854723ff5bdbe9c3"
2413
+ },
2414
+ {
2415
+ "package": "@xemahq/xema",
2416
+ "version": "0.41.1",
2411
2417
  "path": "edition/distribution-paths.mjs",
2412
2418
  "sha256": "sha256:d78a5c8405bc6c25d36fcec61b0030e1fdacac7d528e698adb96f906f4b70279"
2413
2419
  },
2414
2420
  {
2415
2421
  "package": "@xemahq/xema",
2416
- "version": "0.41.0",
2422
+ "version": "0.41.1",
2417
2423
  "path": "edition/edition-artifact.mjs",
2418
2424
  "sha256": "sha256:282b6d5e70736f7e41cff41167d2cd99b7d0127dcc2b712132888dcfc82e36cd"
2419
2425
  },
2420
2426
  {
2421
2427
  "package": "@xemahq/xema",
2422
- "version": "0.41.0",
2428
+ "version": "0.41.1",
2423
2429
  "path": "edition/edition-channel.mjs",
2424
2430
  "sha256": "sha256:3c0c1564dc50be133cad500452d953353aa5beb703142c05a17bbce8175ba9f3"
2425
2431
  },
2426
2432
  {
2427
2433
  "package": "@xemahq/xema",
2428
- "version": "0.41.0",
2434
+ "version": "0.41.1",
2429
2435
  "path": "edition/edition-chart-set.mjs",
2430
2436
  "sha256": "sha256:f9f16b58279c8c2619a39c5cc92bdbc334543d1a324304cd5d3b120d66dc8f3a"
2431
2437
  },
2432
2438
  {
2433
2439
  "package": "@xemahq/xema",
2434
- "version": "0.41.0",
2440
+ "version": "0.41.1",
2435
2441
  "path": "edition/edition-config.mjs",
2436
2442
  "sha256": "sha256:e3997bd9a0082e02d01760868b2a4f41ed3081e904126b30fdf86e7938dc6137"
2437
2443
  },
2438
2444
  {
2439
2445
  "package": "@xemahq/xema",
2440
- "version": "0.41.0",
2446
+ "version": "0.41.1",
2441
2447
  "path": "edition/edition-constants.mjs",
2442
2448
  "sha256": "sha256:d3747ca300f38832796521b47d12076bdba7f214199a1dec52c9384ab3dde394"
2443
2449
  },
2444
2450
  {
2445
2451
  "package": "@xemahq/xema",
2446
- "version": "0.41.0",
2452
+ "version": "0.41.1",
2447
2453
  "path": "edition/edition-contract-parse.mjs",
2448
2454
  "sha256": "sha256:c575e96b70bda82899931eb0b18567988e2e13e664fa498bcbef96b571dcabb4"
2449
2455
  },
2450
2456
  {
2451
2457
  "package": "@xemahq/xema",
2452
- "version": "0.41.0",
2458
+ "version": "0.41.1",
2453
2459
  "path": "edition/edition-contract.json",
2454
2460
  "sha256": "sha256:af7c88854007e63e4e77863cf72610f59ff838959dbd381087ec50ba782ae0e1"
2455
2461
  },
2456
2462
  {
2457
2463
  "package": "@xemahq/xema",
2458
- "version": "0.41.0",
2464
+ "version": "0.41.1",
2459
2465
  "path": "edition/edition-protocol.mjs",
2460
2466
  "sha256": "sha256:c488ac72ff3f23c0f28f8db159bf84d2c86ec5cda3633db1fe91ca3f21b12214"
2461
2467
  },
2462
2468
  {
2463
2469
  "package": "@xemahq/xema",
2464
- "version": "0.41.0",
2470
+ "version": "0.41.1",
2465
2471
  "path": "edition/edition-source-pins.mjs",
2466
2472
  "sha256": "sha256:b141474fff33b06734fb62cd2552752b991c8267bb1c9bccb22a81dd80e91c6c"
2467
2473
  },
2468
2474
  {
2469
2475
  "package": "@xemahq/xema",
2470
- "version": "0.41.0",
2476
+ "version": "0.41.1",
2471
2477
  "path": "edition/edition-workspace.mjs",
2472
2478
  "sha256": "sha256:2bca85f534474d12f161a76d29e2efbe18e25a326066360122ae392bf9b27dab"
2473
2479
  },
2474
2480
  {
2475
2481
  "package": "@xemahq/xema",
2476
- "version": "0.41.0",
2482
+ "version": "0.41.1",
2477
2483
  "path": "edition/evidence-checkout.mjs",
2478
2484
  "sha256": "sha256:31fb669769b31de4c6f2b2501bb96959548172ef166e7568edbbfed7f5079a11"
2479
2485
  },
2480
2486
  {
2481
2487
  "package": "@xemahq/xema",
2482
- "version": "0.41.0",
2488
+ "version": "0.41.1",
2483
2489
  "path": "edition/evidence-grammars.mjs",
2484
2490
  "sha256": "sha256:4dae22b61ade99219a482b971c9780d68a3d37d021e39cdfe860b245364b8b9f"
2485
2491
  },
2486
2492
  {
2487
2493
  "package": "@xemahq/xema",
2488
- "version": "0.41.0",
2494
+ "version": "0.41.1",
2489
2495
  "path": "edition/evidence-trust-pin.mjs",
2490
2496
  "sha256": "sha256:65077589d1d9bd129c175c03a6dca6bb4eaf277fa29d6391e1065654fe8cc246"
2491
2497
  },
2492
2498
  {
2493
2499
  "package": "@xemahq/xema",
2494
- "version": "0.41.0",
2500
+ "version": "0.41.1",
2495
2501
  "path": "edition/git-json.mjs",
2496
2502
  "sha256": "sha256:d0d25cda0c19007becabc9a2827c3dcf759b295cd0b41596eb4480c9549a1f21"
2497
2503
  },
2498
2504
  {
2499
2505
  "package": "@xemahq/xema",
2500
- "version": "0.41.0",
2506
+ "version": "0.41.1",
2501
2507
  "path": "edition/image-delivery-entitlement-descriptor.mjs",
2502
2508
  "sha256": "sha256:4726b66116f01bf2523fafe2b7a356591eca8fb5ca6bd8b154dd4821873e921b"
2503
2509
  },
2504
2510
  {
2505
2511
  "package": "@xemahq/xema",
2506
- "version": "0.41.0",
2512
+ "version": "0.41.1",
2507
2513
  "path": "edition/image-evidence-replay-state.mjs",
2508
2514
  "sha256": "sha256:eba0cf1d38af0ab2f00c5099fa8bc2edc543136ce92f895544d4d284b3d6af0f"
2509
2515
  },
2510
2516
  {
2511
2517
  "package": "@xemahq/xema",
2512
- "version": "0.41.0",
2518
+ "version": "0.41.1",
2513
2519
  "path": "edition/image-evidence.mjs",
2514
2520
  "sha256": "sha256:8ccbd4e7ce482cbb25521e893ac047d31ca1da782e87ee2179629e8911aa6aa3"
2515
2521
  },
2516
2522
  {
2517
2523
  "package": "@xemahq/xema",
2518
- "version": "0.41.0",
2524
+ "version": "0.41.1",
2519
2525
  "path": "edition/kernel-capability-domain.mjs",
2520
2526
  "sha256": "sha256:3ecf887dd8d399e91a8285f6f115f6e418fb59bbf3f004539fe65ec667219356"
2521
2527
  },
2522
2528
  {
2523
2529
  "package": "@xemahq/xema",
2524
- "version": "0.41.0",
2530
+ "version": "0.41.1",
2525
2531
  "path": "edition/kernel-contract-authority.mjs",
2526
2532
  "sha256": "sha256:20abdde62a7b037c01ea9bbe1ff1e6094e6b0efd0add2f656f1938a04409bf82"
2527
2533
  },
2528
2534
  {
2529
2535
  "package": "@xemahq/xema",
2530
- "version": "0.41.0",
2536
+ "version": "0.41.1",
2531
2537
  "path": "edition/lib.mjs",
2532
- "sha256": "sha256:c1a354fd8e88429adfe65641267744be555d5957c814fe56b05189010dae8c0d"
2538
+ "sha256": "sha256:840ab735e6cc0ca415efb7646eb591847646f83b1b16327d7aa04350fa74d48e"
2533
2539
  },
2534
2540
  {
2535
2541
  "package": "@xemahq/xema",
2536
- "version": "0.41.0",
2542
+ "version": "0.41.1",
2537
2543
  "path": "edition/no-follow-file.mjs",
2538
2544
  "sha256": "sha256:c17bdf5e441f3c079aa06d4b48bbed05cad087855b9ad2a5e6dc43d5ee2b17c3"
2539
2545
  },
2540
2546
  {
2541
2547
  "package": "@xemahq/xema",
2542
- "version": "0.41.0",
2548
+ "version": "0.41.1",
2543
2549
  "path": "edition/operation-requirements.mjs",
2544
2550
  "sha256": "sha256:e7fed25747ee92be84cdc864ca35a723356df5b3d08923cf71f4bc66a791eb5d"
2545
2551
  },
2546
2552
  {
2547
2553
  "package": "@xemahq/xema",
2548
- "version": "0.41.0",
2554
+ "version": "0.41.1",
2549
2555
  "path": "edition/pin-source.mjs",
2550
2556
  "sha256": "sha256:a23fef4698ef66ba9de4a1aabe3eebe6487d1f105f3fc161bafc5a33b99a2440"
2551
2557
  },
2552
2558
  {
2553
2559
  "package": "@xemahq/xema",
2554
- "version": "0.41.0",
2560
+ "version": "0.41.1",
2555
2561
  "path": "edition/sigstore-bundle-media-type.mjs",
2556
2562
  "sha256": "sha256:e0aa5a3992f0385ddbbe69eb0307d642ac428ef516c8394816ac4fd52e0ac39c"
2557
2563
  },
2558
2564
  {
2559
2565
  "package": "@xemahq/xema",
2560
- "version": "0.41.0",
2566
+ "version": "0.41.1",
2561
2567
  "path": "edition/source-authority.mjs",
2562
2568
  "sha256": "sha256:9c351f60e8ea838f445f89c3709c60b7f13b021b78d6e40eaef91350a793f0ff"
2563
2569
  },
2564
2570
  {
2565
2571
  "package": "@xemahq/xema",
2566
- "version": "0.41.0",
2572
+ "version": "0.41.1",
2567
2573
  "path": "edition/strict-json.mjs",
2568
2574
  "sha256": "sha256:f95778396df7f38b086f55d2ec4f3b6644a8aeff2b32282a62829145fb544562"
2569
2575
  },
2570
2576
  {
2571
2577
  "package": "@xemahq/xema",
2572
- "version": "0.41.0",
2578
+ "version": "0.41.1",
2573
2579
  "path": "edition/string-order.mjs",
2574
2580
  "sha256": "sha256:b3210cd273e4b2e01fb8b1a91e28734cd211d4010c080d0ce95f5e5ff631cffb"
2575
2581
  },
2576
2582
  {
2577
2583
  "package": "@xemahq/xema",
2578
- "version": "0.41.0",
2584
+ "version": "0.41.1",
2579
2585
  "path": "edition/trust-policy-arming.mjs",
2580
2586
  "sha256": "sha256:6f6f192118407e71a744087caea988bcf3d33aca9803217bceb8134d7e2b9120"
2581
2587
  },
2582
2588
  {
2583
2589
  "package": "@xemahq/xema",
2584
- "version": "0.41.0",
2590
+ "version": "0.41.1",
2585
2591
  "path": "edition/trusted-executable.mjs",
2586
2592
  "sha256": "sha256:37d46cdbc999ddd55d4ea8aeed4850ddd1efde89ed7b532f5a2ddec87105d796"
2587
2593
  },
2588
2594
  {
2589
2595
  "package": "@xemahq/xema",
2590
- "version": "0.41.0",
2596
+ "version": "0.41.1",
2591
2597
  "path": "edition/verifier-binding.mjs",
2592
2598
  "sha256": "sha256:80732658617f5255258c538eeb2383331ec8553b44b58d552b567845a7b916aa"
2593
2599
  },
2594
2600
  {
2595
2601
  "package": "@xemahq/xema",
2596
- "version": "0.41.0",
2602
+ "version": "0.41.1",
2597
2603
  "path": "edition/verifier-files.mjs",
2598
2604
  "sha256": "sha256:cdd14a20a63f0f194a8abb55680a5a7e3ced1f09f8b210a90d349e655f6de0c0"
2599
2605
  },
2600
2606
  {
2601
2607
  "package": "@xemahq/xema",
2602
- "version": "0.41.0",
2608
+ "version": "0.41.1",
2603
2609
  "path": "edition/verifier-provenance.mjs",
2604
2610
  "sha256": "sha256:3e2fb8e07cf1f66b8ad6c7ac2555fe3af64ec7abeb07cecbaf1939a18c2b3663"
2605
2611
  },
2606
2612
  {
2607
2613
  "package": "@xemahq/xema",
2608
- "version": "0.41.0",
2614
+ "version": "0.41.1",
2609
2615
  "path": "edition/verify-catalogue-evidence.mjs",
2610
2616
  "sha256": "sha256:d7e42efc9edced97e4330cddc46183445a870ba22f57896a7ea6bc600d369137"
2611
2617
  },
2612
2618
  {
2613
2619
  "package": "@xemahq/xema",
2614
- "version": "0.41.0",
2620
+ "version": "0.41.1",
2615
2621
  "path": "edition/verify-image-evidence.mjs",
2616
2622
  "sha256": "sha256:396936f3d9e0ed68902b8b03c6fa02479e439357e6194ac8ce0e0991be834706"
2617
2623
  },
2618
2624
  {
2619
2625
  "package": "@xemahq/xema",
2620
- "version": "0.41.0",
2626
+ "version": "0.41.1",
2621
2627
  "path": "edition/workspace-sections.mjs",
2622
2628
  "sha256": "sha256:383f37ce066ea5573c30cedf124022095bf94d050f0a266a5881f587cff0ced0"
2623
2629
  },
2624
2630
  {
2625
2631
  "package": "@xemahq/xema",
2626
- "version": "0.41.0",
2632
+ "version": "0.41.1",
2627
2633
  "path": "scripts/build-evidence-verifier.mjs",
2628
2634
  "sha256": "sha256:5a688d20c47dc88aff37aa0c6cc02daf2c370a5bc610fef8446ce7be222d4c0b"
2629
2635
  },
@@ -1,5 +1,70 @@
1
1
  import { compareStrings } from './string-order.mjs';
2
2
 
3
+ /** A `runtime-image` edge target that is neither `{biomeId, componentKey}` nor `{supplementalRuntimeComponentId}`, or is both. */
4
+ export class DispatchedEdgeError extends Error {
5
+ constructor(message) {
6
+ super(message);
7
+ this.name = 'DispatchedEdgeError';
8
+ }
9
+ }
10
+
11
+ /** A dispatched `supplemental:<id>` the runtime-image source index does not declare as a supplemental subject. */
12
+ export class UndeclaredSupplementalRuntimeComponentError extends Error {
13
+ constructor(supplementalRuntimeComponentId, dispatchingBiomes, context) {
14
+ super(
15
+ `${context}: supplemental runtime component "${supplementalRuntimeComponentId}", dispatched by biome ` +
16
+ `${dispatchingBiomes.map((id) => `"${id}"`).join(', ')}, is not declared as a runtime-component subject ` +
17
+ 'by the runtime image source index — refusing rather than shipping the dispatcher without the image it launches.',
18
+ );
19
+ this.name = 'UndeclaredSupplementalRuntimeComponentError';
20
+ this.supplementalRuntimeComponentId = supplementalRuntimeComponentId;
21
+ this.dispatchingBiomes = dispatchingBiomes;
22
+ }
23
+ }
24
+
25
+ // The `supplementalRuntimeComponentId` field is read as plain data: this CLI is on
26
+ // @xemahq/contracts 0.83, which does not type it. XEMA-171 (CLI edition protocol
27
+ // v9) adopts the typed field from @xemahq/contracts >= 0.91.
28
+ const isNonEmptyString = (value) => typeof value === 'string' && value.length > 0;
29
+
30
+ /** True for the supplemental form of a projected edge. */
31
+ export const isSupplementalEdge = (edge) => edge.supplementalRuntimeComponentId !== undefined;
32
+
33
+ /** The identity of a projected edge: `supplemental:<id>` or `<biomeId>\0<componentKey>`. */
34
+ export const dispatchedEdgeIdentity = (edge) =>
35
+ isSupplementalEdge(edge)
36
+ ? `supplemental:${edge.supplementalRuntimeComponentId}`
37
+ : `${edge.biomeId}\0${edge.componentKey}`;
38
+
39
+ /**
40
+ * Project one generated-index `runtime-image` edge target into the typed union
41
+ * the index entry carries. A target that is neither form, or both, is refused
42
+ * naming the dispatching biome; no `undefined` identity can form.
43
+ */
44
+ export function projectDispatchedTarget(dispatchingBiomeId, target) {
45
+ const supplemental = target?.supplementalRuntimeComponentId;
46
+ const biomeForm = target?.biomeId !== undefined || target?.componentKey !== undefined;
47
+ if (supplemental !== undefined) {
48
+ if (biomeForm || !isNonEmptyString(supplemental)) {
49
+ throw new DispatchedEdgeError(
50
+ `biome "${dispatchingBiomeId}" has a runtime-image edge target that mixes supplementalRuntimeComponentId with ` +
51
+ 'biomeId/componentKey, or names an empty id — a target is exactly one form',
52
+ );
53
+ }
54
+ return { supplementalRuntimeComponentId: supplemental };
55
+ }
56
+ if (!isNonEmptyString(target?.biomeId) || !isNonEmptyString(target?.componentKey)) {
57
+ throw new DispatchedEdgeError(
58
+ `biome "${dispatchingBiomeId}" has a runtime-image edge target that is neither { biomeId, componentKey } nor ` +
59
+ '{ supplementalRuntimeComponentId }',
60
+ );
61
+ }
62
+ return { biomeId: target.biomeId, componentKey: target.componentKey };
63
+ }
64
+
65
+ const edgeLabel = (edge) =>
66
+ isSupplementalEdge(edge) ? `supplemental:${edge.supplementalRuntimeComponentId}` : `${edge.biomeId}/${edge.componentKey}`;
67
+
3
68
  /**
4
69
  * The runtime components an edition must carry because a biome it rosters
5
70
  * DISPATCHES them: the kernel's `runtime-image` edges, projected per biome into
@@ -21,6 +86,10 @@ import { compareStrings } from './string-order.mjs';
21
86
  * no biome drawn from a declared source. A biome drawn from a declared source
22
87
  * that dispatches is refused for the same reason.
23
88
  *
89
+ * A supplemental edge (`{supplementalRuntimeComponentId}`) names no biome: it
90
+ * is carried as a row `{ supplementalRuntimeComponentId, consumers }` without
91
+ * a biome lookup.
92
+ *
24
93
  * Returns one row per distinct (target biome, component key), sorted, with the
25
94
  * rostered biomes that dispatch it. Every unresolvable edge is refused, naming
26
95
  * the consumer and the target.
@@ -37,12 +106,24 @@ export function resolveDispatchedRuntimeComponents(context, consumers, index) {
37
106
  if (consumer.source !== undefined) {
38
107
  throw new Error(
39
108
  `${context}: biome "${consumer.id}", drawn from declared source "${consumer.source}", dispatches ` +
40
- `runtime components (${edges.map((edge) => `${edge.biomeId}/${edge.componentKey}`).join(', ')}). ` +
109
+ `runtime components (${edges.map(edgeLabel).join(', ')}). ` +
41
110
  'A dispatched image is resolved from the first-party biome index, which carries no biome from a ' +
42
111
  'declared source — refusing rather than shipping the dispatcher without the images it launches.',
43
112
  );
44
113
  }
45
114
  for (const edge of edges) {
115
+ if (isSupplementalEdge(edge)) {
116
+ // Carried as a requirement owned by the dispatching biome. Whether the
117
+ // runtime image source index declares it is the image plane's refusal.
118
+ const supplementalKey = dispatchedEdgeIdentity(edge);
119
+ const row = rows.get(supplementalKey) ?? {
120
+ supplementalRuntimeComponentId: edge.supplementalRuntimeComponentId,
121
+ consumers: [],
122
+ };
123
+ if (!row.consumers.includes(consumer.id)) {row.consumers.push(consumer.id);}
124
+ rows.set(supplementalKey, row);
125
+ continue;
126
+ }
46
127
  const edgeText = `biome "${consumer.id}" dispatches runtime component "${edge.componentKey}" of biome "${edge.biomeId}"`;
47
128
  const candidates = index.filter(
48
129
  (entry) => entry.id === edge.biomeId && entry.target === 'server' && entry.source === undefined,
@@ -80,3 +161,11 @@ export function resolveDispatchedRuntimeComponents(context, consumers, index) {
80
161
  .sort(([a], [b]) => compareStrings(a, b))
81
162
  .map(([, row]) => row);
82
163
  }
164
+
165
+ /** Sort order of projected edges: biome edges by (biomeId, componentKey), then supplemental edges by id. */
166
+ export function compareDispatchedEdges(a, b) {
167
+ if (isSupplementalEdge(a) !== isSupplementalEdge(b)) {return isSupplementalEdge(a) ? 1 : -1;}
168
+ return isSupplementalEdge(a)
169
+ ? compareStrings(a.supplementalRuntimeComponentId, b.supplementalRuntimeComponentId)
170
+ : compareStrings(a.biomeId, b.biomeId) || compareStrings(a.componentKey, b.componentKey);
171
+ }
package/edition/lib.mjs CHANGED
@@ -20,6 +20,12 @@ import { readBiomeAuthorizationModuleAt } from './authorization-base.mjs';
20
20
  import {
21
21
  isAuthoritativeProductionBiomeSource,
22
22
  } from './connector-source-authority.mjs';
23
+ import {
24
+ compareDispatchedEdges,
25
+ dispatchedEdgeIdentity,
26
+ isSupplementalEdge,
27
+ projectDispatchedTarget,
28
+ } from './dispatched-runtime-components.mjs';
23
29
  import { assertKernelEditionProtocol } from './edition-protocol.mjs';
24
30
  import {
25
31
  kernelDistPath,
@@ -2037,16 +2043,10 @@ export async function manifestToIndexEntry({ raw, generatedIndex, rel, repo, pat
2037
2043
  ...new Map(
2038
2044
  parsedIndex.biome.edges
2039
2045
  .filter((edge) => edge.kind === kernelBiome.BiomeGeneratedEdgeKind.RuntimeImage)
2040
- .map((edge) => [
2041
- `${edge.target.biomeId}\0${edge.target.componentKey}`,
2042
- { biomeId: edge.target.biomeId, componentKey: edge.target.componentKey },
2043
- ]),
2046
+ .map((edge) => projectDispatchedTarget(id, edge.target))
2047
+ .map((target) => [dispatchedEdgeIdentity(target), target]),
2044
2048
  ).values(),
2045
- ].sort(
2046
- (a, b) =>
2047
- compareStrings(a.biomeId, b.biomeId) ||
2048
- compareStrings(a.componentKey, b.componentKey),
2049
- );
2049
+ ].sort(compareDispatchedEdges);
2050
2050
 
2051
2051
  // Optional server biomes a web biome can integrate with but does not require
2052
2052
  // (never cause an ORPHANED resolution). Carried separately from `requires`.
@@ -2795,10 +2795,12 @@ export function validateImmutableBiomeIndex(index) {
2795
2795
  }
2796
2796
  const dispatched = new Set();
2797
2797
  for (const edge of biome.dispatchesRuntimeComponents ?? []) {
2798
- const edgeKey = `${edge.biomeId}\0${edge.componentKey}`;
2798
+ const edgeKey = dispatchedEdgeIdentity(projectDispatchedTarget(biome.id, edge));
2799
2799
  if (dispatched.has(edgeKey)) {
2800
2800
  throw new Error(
2801
- `biome "${biome.id}" dispatches runtime component "${edge.componentKey}" of biome "${edge.biomeId}" more than once`,
2801
+ isSupplementalEdge(edge)
2802
+ ? `biome "${biome.id}" dispatches ${edgeKey} more than once`
2803
+ : `biome "${biome.id}" dispatches runtime component "${edge.componentKey}" of biome "${edge.biomeId}" more than once`,
2802
2804
  );
2803
2805
  }
2804
2806
  dispatched.add(edgeKey);
@@ -40,7 +40,10 @@ import { setImmediate as yieldToEventLoop } from 'node:timers/promises';
40
40
  import { assertBuildLedgerComplete } from './build-ledger-completeness.mjs';
41
41
  import { BUILD_LEDGER_FILE, readBuildLedger } from './build-ledger.mjs';
42
42
  import { CROSS_REPO_BUILD_INPUTS_PATH, crossRepoInputKey, resolveCrossRepoVendoredInputs } from './cross-repo-build-inputs.mjs';
43
- import { resolveDispatchedRuntimeComponents } from './dispatched-runtime-components.mjs';
43
+ import {
44
+ resolveDispatchedRuntimeComponents,
45
+ UndeclaredSupplementalRuntimeComponentError,
46
+ } from './dispatched-runtime-components.mjs';
44
47
  import {
45
48
  assertCanonicalDistributionId,
46
49
  distributionOutputPath,
@@ -681,6 +684,28 @@ export function resolveImageStructure(
681
684
  dispatchers,
682
685
  biomeIndex,
683
686
  )) {
687
+ if (dispatched.supplementalRuntimeComponentId !== undefined) {
688
+ // THE REFUSAL: a dispatched supplemental runtime component must be one the
689
+ // runtime image source index declares as a runtime-component subject.
690
+ // Every image lock is produced here, so this is the one place it is checked.
691
+ const declared = runtimeSourceIndex.supplementalSubjects.find(
692
+ (subject) =>
693
+ subject.kind === enums.RuntimeImageSubjectKind.RuntimeComponent &&
694
+ subject.id === dispatched.supplementalRuntimeComponentId,
695
+ );
696
+ if (declared === undefined) {
697
+ throw new UndeclaredSupplementalRuntimeComponentError(
698
+ dispatched.supplementalRuntimeComponentId,
699
+ dispatched.consumers,
700
+ `distribution "${lock.distributionId}"`,
701
+ );
702
+ }
703
+ addSupplementalSubject(
704
+ declared,
705
+ dispatched.consumers.map((biomeId) => ({ kind: enums.RuntimeImageOwnerKind.Biome, biomeId })),
706
+ );
707
+ continue;
708
+ }
684
709
  const { target } = dispatched;
685
710
  addSubject(subjects, {
686
711
  kind: enums.RuntimeImageSubjectKind.RuntimeComponent,
@@ -717,6 +742,16 @@ export function resolveImageStructure(
717
742
  const boundSubjects = new Set(
718
743
  runtimeSourceIndex.platformServiceBindings.map((binding) => bindingKey(binding)),
719
744
  );
745
+ // A biome's `supplemental:<id>` dispatch edge also carries the subject: the
746
+ // catalogue check reads the whole first-party index, not this roster, so a
747
+ // subject reached only by a dispatch is not "unreachable" in any edition.
748
+ const dispatchedSubjects = new Set(
749
+ biomeIndex
750
+ .filter((entry) => entry.source === undefined)
751
+ .flatMap((entry) => entry.dispatchesRuntimeComponents ?? [])
752
+ .filter((edge) => edge.supplementalRuntimeComponentId !== undefined)
753
+ .map((edge) => `${enums.RuntimeImageSubjectKind.RuntimeComponent}\0${edge.supplementalRuntimeComponentId}`),
754
+ );
720
755
  const launchers = new Map(
721
756
  supplementalSources
722
757
  .filter((source) => source.launchedBy !== undefined)
@@ -733,11 +768,11 @@ export function resolveImageStructure(
733
768
  for (const [key, supplemental] of supplementalSubjects) {
734
769
  const launcher = launchers.get(key);
735
770
  if (launcher === undefined) {
736
- if (!boundSubjects.has(key)) {
771
+ if (!boundSubjects.has(key) && !dispatchedSubjects.has(key)) {
737
772
  throw new Error(
738
- `supplemental subject "${supplemental.kind}:${supplemental.id}" has neither a launchedBy nor a ` +
739
- 'platform-service binding, so no edition could ever carry it — declare what launches it ' +
740
- '(runtimeImageSources.supplementalSources[].launchedBy) or bind it to a platform service',
773
+ `supplemental subject "${supplemental.kind}:${supplemental.id}" has neither a launchedBy, a ` +
774
+ 'platform-service binding nor a biome dispatching it, so no edition could ever carry it — declare what launches it ' +
775
+ '(runtimeImageSources.supplementalSources[].launchedBy), bind it to a platform service or dispatch it from a biome',
741
776
  );
742
777
  }
743
778
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xemahq/xema",
3
- "version": "0.41.0",
3
+ "version": "0.41.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/xema-dev/xema-cli.git",
@@ -92,6 +92,6 @@
92
92
  "typecheck": "tsc --noEmit"
93
93
  },
94
94
  "xemaRelease": {
95
- "sourceDigest": "sha256:322929ee2999d155d5d612f17bb786adef52f44c46cee82b9bc9b11ecc792758"
95
+ "sourceDigest": "sha256:7e8af916b8cd5c8de331d7e274a7022071e6b6ac0d9d54042c2e55461ad46bab"
96
96
  }
97
97
  }