@chrona-city/ugc-kit 1.5.10 → 1.5.11

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.
Files changed (21) hide show
  1. package/README.md +16 -0
  2. package/contracts/ugc/public-runtime/v1/README.md +40 -0
  3. package/contracts/ugc/public-runtime/v1/archive.mjs +4 -3
  4. package/contracts/ugc/public-runtime/v1/manifest.mjs +21 -10
  5. package/contracts/ugc/public-runtime/v1/runtime-manifest.schema.json +60 -16
  6. package/contracts/ugc/public-runtime/v1/static-room-runtime.test.mjs +225 -0
  7. package/docs/runtime-download.md +44 -0
  8. package/lib/creator-toolchain-compat.mjs +6 -0
  9. package/lib/host-ipc/{distribution-node-support-contract → distribution-static-room-semantic-contract}/contracts/ugc/public-runtime/v1/manifest.mjs +21 -10
  10. package/lib/host-ipc/{distribution-node-support-contract → distribution-static-room-semantic-contract}/contracts/ugc/public-runtime/v1/runtime-manifest.schema.json +60 -16
  11. package/lib/host-ipc/host-ipc.schema.json +18 -2
  12. package/lib/host-ipc/runtime-contract.mjs +5 -5
  13. package/lib/host-ipc/source-lock.json +9 -9
  14. package/lib/runtime-host-client.mjs +10 -4
  15. package/lib/runtime-host.mjs +3 -1
  16. package/lib/runtime-install.mjs +11 -3
  17. package/package.json +1 -1
  18. package/public-runtime.snapshot.lock.json +9 -5
  19. package/runtime-catalog.json +24 -8
  20. /package/lib/host-ipc/{distribution-node-support-contract → distribution-static-room-semantic-contract}/contracts/ugc/creator-source/v1/tool-package.schema.json +0 -0
  21. /package/lib/host-ipc/{distribution-node-support-contract → distribution-static-room-semantic-contract}/contracts/ugc/registry/v1/conformance/js/capability-resolver.mjs +0 -0
package/README.md CHANGED
@@ -102,6 +102,22 @@ and `M.m.p-alpha.N.P`, with positive, non-zero-prefixed alpha numbers. The full
102
102
  suffix remains part of every tool identity. Source `publishConfig.tag` validation
103
103
  does not publish a package or select the npm dist-tag for an authorized operation.
104
104
 
105
+ The original catalog-set input accepts a nonempty subset of the known `city`
106
+ and `world` profile keys. Each selected pairing retains its own exact Producer,
107
+ package, content and execution evidence; an unselected profile keeps its actual
108
+ current value. Updating city does not require upgrading or publishing world.
109
+ When selected Producers differ, there is no shared source/version summary.
110
+ After an unknown write, use the original read-only inspect entry; it never
111
+ authorizes retry. A corrupt partial single-profile set cannot establish the
112
+ retained profile and is rejected rather than reconstructed from an older copy.
113
+
114
+ Normal Runtime reports may serve a successor release-tool source only after the
115
+ original pairing Reader verifies their exact target, content, package and
116
+ cleanup bindings. Exact source equality remains the fast path; otherwise the
117
+ existing versioned execution-closure selector and dependency lock must match.
118
+ This does not fabricate a Document shared proof or a new Runtime execution.
119
+ The final source inventory, clean HEAD, catalog CAS, Tag and archive remain exact.
120
+
105
121
  For a version-only follow-up with unchanged implementation evidence, `--test-profile release-identity` runs installation, upgrade, metadata and Harness checks and labels the report with that limited coverage; it is not a full regression. Retain the baseline evidence separately. `--parent-version <fixed-parent>` rejects non-increasing versions; before any authorized channel update, supply the actual current npm target with `--channel-version <current-version>` to reject a numeric downgrade. Do not infer live channel state from a local report.
106
122
 
107
123
  Use a clean fixed checkout and the original `npm run verify:npm-package -- --output-directory <new-directory> --producer-content-file <absolute-snapshot-root>/local-content.snapshot.json --environment testing --release-tag v1.5.3 --test-profile release-identity --parent-version 1.5.2` entry for the internal runtime producer. The snapshot must come from the original `chrona build --project ... --output-directory <absolute-snapshot-root>` command; the producer validates it and generates the pinned `runtime-content.json` without hand-copying identity fields or digests. It checks package/lock/CLI versions, immutable tag conflicts, archive installation and schema3 download metadata, and emits `runtime-producer.json` beside the exact internal archive. Only the actual installation platform is declared. An absent tag leaves `tagVerified: false`; this is a candidate, not a release or user download.
@@ -50,6 +50,46 @@ original source-lock closures; bundling transforms are recorded by that builder,
50
50
  not guessed from output filenames. Private Room/replication/platform code must
51
51
  not be smuggled into a public closure under an allowed name.
52
52
 
53
+ ### Static Content Room source variant
54
+
55
+ Static `schemaVersion: "1.0.0"` has two separate exact source alternatives:
56
+ `{clientsCommitSha,publicNode,publicFlight}` (historical Flight), or
57
+ `{clientsCommitSha,publicNode,contentRoom}` (Content Room). Each source keeps the
58
+ existing exact `{commitSha,sourceHash,lockPath}` reference to a distinct included
59
+ data file. Mixed alternatives, extra `documentAuthority`, missing locks and
60
+ aliases refuse. Content Room is not a renamed Flight export: its real source
61
+ inventory, package/lock and locked dependencies must be packaged and checked by
62
+ the original source Reader and complete-host builder. The manifest does not
63
+ authenticate arbitrary source-lock bytes by itself or grant execution.
64
+
65
+ The static Room variant alone admits the trusted implementation files matching
66
+ `node/content-room-authority/services/game-worker/src/runtime/content/*.js`;
67
+ the final filename uses the existing ASCII filename grammar, without subfolders.
68
+ This does not admit creator `content/`, assets, private paths, Pipeline helpers
69
+ or the separate Document Room namespace. `validRuntimePath`,
70
+ `validateRuntimeFiles` and `encodeRuntimeArchive` accept `{staticRoom:true}`
71
+ for this Writer path; callers select it from their actual source variant.
72
+ `validateRuntimeManifest` derives it from the exact static source shape, and
73
+ `decodeRuntimeArchive` re-encodes with that verified choice. Archive format,
74
+ hashes, targets, protocol 1/2, static policy/entrypoints and exact 1.0 content
75
+ tuple remain unchanged. Document 1.1 still requires its independent
76
+ `publicNode/contentRoom/documentAuthority` sources and original namespace.
77
+ Neither option changes the creator snapshot or implies a playable Runtime.
78
+
79
+ For this exact, validated static Room family only, `assertRuntimeCompatibility`
80
+ matches the declared builderVersion, complete contracts, tool.packageName and
81
+ tool.kitSnapshotHash. Both tool version fields remain required and valid under
82
+ the original tool-version grammar, but packageVersion and kitVersion are source
83
+ provenance rather than execution-interface equality tests. No version range,
84
+ major inference, release-label lookup or per-World exception is introduced.
85
+ The original snapshot/expected identity, content hashes, manifest bytes, release
86
+ package and execution reports retain their full version fields and integrity
87
+ checks; callers must not rewrite them to the selected Runtime's versions.
88
+ Different SDK snapshot, contracts, package name, Builder or target still refuse.
89
+ The historical Flight family and Document 1.1 continue to compare the complete
90
+ tool tuple, including both versions. This rule alone proves neither acceptance
91
+ of an unobserved future Kit nor actual Host execution of any content.
92
+
53
93
  `targets` has at most four declarations in canonical-JSON order. Historical
54
94
  `{os,arch,nodeVersion:"22.16.0"}` rows retain exact matching, including the Node
55
95
  patch and architecture; their bytes and identities are unchanged. They are not
@@ -11,11 +11,11 @@ const crc32 = bytes => {
11
11
  return (crc ^ 0xffffffff) >>> 0;
12
12
  };
13
13
 
14
- export function encodeRuntimeArchive(entries, { document = false } = {}) {
14
+ export function encodeRuntimeArchive(entries, { document = false, staticRoom = false } = {}) {
15
15
  if (!Array.isArray(entries) || entries.length > RUNTIME_LIMITS.files) fail('INVALID_RUNTIME_FILES');
16
16
  const files = entries.map(e => ({ path: e.path, role: e.role, bytes: e.bytes?.byteLength,
17
17
  sha256: e.bytes instanceof Uint8Array ? runtimeHash(e.bytes) : '' }));
18
- validateRuntimeFiles(files, { document });
18
+ validateRuntimeFiles(files, { document, staticRoom });
19
19
  const local = [], central = []; let offset = 0, centralBytes = 0;
20
20
  for (const entry of entries) {
21
21
  const name = Buffer.from(entry.path), data = Buffer.from(entry.bytes), crc = crc32(data);
@@ -47,6 +47,7 @@ export function decodeRuntimeArchive(bytes, manifest) {
47
47
  if (runtimeHash(data) !== file.sha256) fail('RUNTIME_ARCHIVE_HASH_MISMATCH');
48
48
  entries.push({ path: file.path, role: file.role, bytes: data }); offset = end;
49
49
  }
50
- if (!encodeRuntimeArchive(entries, { document: manifest.schemaVersion === '1.1.0' }).equals(archive)) fail('INVALID_RUNTIME_ARCHIVE');
50
+ if (!encodeRuntimeArchive(entries, { document: manifest.schemaVersion === '1.1.0',
51
+ staticRoom: manifest.schemaVersion === '1.0.0' && Object.hasOwn(manifest.source, 'contentRoom') }).equals(archive)) fail('INVALID_RUNTIME_ARCHIVE');
51
52
  return entries;
52
53
  }
@@ -14,9 +14,10 @@ const toolVersion = v => typeof v === 'string' && /^(0|[1-9][0-9]*)\.(0|[1-9][0-
14
14
  const bounded = (v, min, max) => Number.isSafeInteger(v) && v >= min && v <= max;
15
15
  const roles = ['node', 'browser', 'sandbox', 'wasm', 'data', 'license'];
16
16
 
17
- export function validRuntimePath(v, { document = false } = {}) {
18
- const roomImplementation = document && typeof v === 'string'
19
- && /^node\/content-room-document-authority\/services\/game-worker\/src\/runtime\/content\/[A-Za-z0-9_-][A-Za-z0-9_.-]*\.js$/.test(v);
17
+ export function validRuntimePath(v, { document = false, staticRoom = false } = {}) {
18
+ const roomImplementation = typeof v === 'string' && (document
19
+ ? /^node\/content-room-document-authority\/services\/game-worker\/src\/runtime\/content\/[A-Za-z0-9_-][A-Za-z0-9_.-]*\.js$/.test(v)
20
+ : staticRoom && /^node\/content-room-authority\/services\/game-worker\/src\/runtime\/content\/[A-Za-z0-9_-][A-Za-z0-9_.-]*\.js$/.test(v));
20
21
  const localExecutionImplementation = document && typeof v === 'string'
21
22
  && /^node\/document-local-execution\/services\/ugc-pipeline\/src\/(?:document-local-execution|private-state-model|private-event-model|private-ecs-model|registry-release)\.mjs$/.test(v);
22
23
  return typeof v === 'string' && v.length <= 512 && /^[A-Za-z0-9_@-][A-Za-z0-9_@.-]*(?:\/[A-Za-z0-9_@-][A-Za-z0-9_@.-]*)*$/.test(v)
@@ -27,12 +28,12 @@ export function validRuntimePath(v, { document = false } = {}) {
27
28
  && !/\.(?:pem|key|p12|pfx|glb|gltf)$/i.test(v) && !['runtime.zip', 'runtime-manifest.json'].includes(v.toLowerCase());
28
29
  }
29
30
 
30
- export function validateRuntimeFiles(files, { document = false } = {}) {
31
+ export function validateRuntimeFiles(files, { document = false, staticRoom = false } = {}) {
31
32
  if (!Array.isArray(files) || !files.length || files.length > RUNTIME_LIMITS.files) fail('INVALID_RUNTIME_FILES');
32
33
  let previous = '', total = 0;
33
34
  const folded = new Set(), directories = new Set();
34
35
  for (const f of files) {
35
- if (!exact(f, ['path', 'bytes', 'sha256', 'role']) || !validRuntimePath(f.path, { document }) || f.path <= previous
36
+ if (!exact(f, ['path', 'bytes', 'sha256', 'role']) || !validRuntimePath(f.path, { document, staticRoom }) || f.path <= previous
36
37
  || !digest(f.sha256) || !bounded(f.bytes, 0, RUNTIME_LIMITS.fileBytes) || !roles.includes(f.role)) fail('INVALID_RUNTIME_FILES');
37
38
  const parts = f.path.toLowerCase().split('/');
38
39
  if (folded.has(parts.join('/')) || directories.has(parts.join('/')) || parts.some((_, i) => folded.has(parts.slice(0, i).join('/')))) fail('INVALID_RUNTIME_FILES');
@@ -101,12 +102,16 @@ export function validateRuntimeManifest(v) {
101
102
  if (!exact(v, ['schemaVersion', 'kind', 'apiVersion', 'runtimeId', 'runtimeHash', 'executionTier', 'source', 'targets', 'compatibility', 'entrypoints', 'files', 'archive'])
102
103
  || !['1.0.0', '1.1.0'].includes(v.schemaVersion) || v.kind !== 'public-local-runtime' || v.apiVersion !== '1.0.0'
103
104
  || v.executionTier !== 'public-untrusted' || !/^runtime_[a-f0-9]{64}$/.test(v.runtimeId ?? '') || !digest(v.runtimeHash)) fail('INVALID_RUNTIME_MANIFEST');
104
- validateRuntimeFiles(v.files, { document: v.schemaVersion === '1.1.0' });
105
105
  const document = v.schemaVersion === '1.1.0';
106
- const files = new Map(v.files.map(f => [f.path, f]));
107
- const reference = (p, role) => validRuntimePath(p, { document }) && files.get(p)?.role === role;
108
- const sourceKeys = document ? ['publicNode', 'contentRoom', 'documentAuthority'] : ['publicNode', 'publicFlight'];
106
+ // Static Room is a distinct source closure, not Document or historical Flight.
107
+ // The exact source shape selects only its fixed implementation namespace.
108
+ const staticRoom = !document && exact(v.source, ['clientsCommitSha', 'publicNode', 'contentRoom']);
109
+ const sourceKeys = document ? ['publicNode', 'contentRoom', 'documentAuthority']
110
+ : staticRoom ? ['publicNode', 'contentRoom'] : ['publicNode', 'publicFlight'];
109
111
  if (!exact(v.source, ['clientsCommitSha', ...sourceKeys]) || !commit(v.source.clientsCommitSha)) fail('INVALID_RUNTIME_SOURCE');
112
+ validateRuntimeFiles(v.files, { document, staticRoom });
113
+ const files = new Map(v.files.map(f => [f.path, f]));
114
+ const reference = (p, role) => validRuntimePath(p, { document, staticRoom }) && files.get(p)?.role === role;
110
115
  for (const key of sourceKeys) {
111
116
  const source = v.source[key];
112
117
  if (!exact(source, ['commitSha', 'sourceHash', 'lockPath']) || !commit(source.commitSha) || !digest(source.sourceHash)
@@ -184,7 +189,13 @@ export function assertRuntimeTargetCompatibility(manifest, { target = { os: proc
184
189
  export function assertRuntimeCompatibility(manifest, { target, expected } = {}) {
185
190
  assertRuntimeTargetCompatibility(manifest, { target });
186
191
  const row = { builderVersion: expected?.builderVersion, tool: expected?.tool, contracts: expected?.contracts };
187
- if (!validContentRow(row, manifest.schemaVersion === '1.1.0') || !manifest.compatibility.content.some(r => canonicalJson(r) === canonicalJson(row))) fail('RUNTIME_CONTENT_INCOMPATIBLE');
192
+ const staticRoom = manifest.schemaVersion === '1.0.0' && exact(manifest.source, ['clientsCommitSha', 'publicNode', 'contentRoom']);
193
+ // Tool versions retain snapshot/report provenance. Only this validated static
194
+ // Room family matches the actual Builder/contracts/SDK interface instead.
195
+ if (!validContentRow(row, manifest.schemaVersion === '1.1.0') || !manifest.compatibility.content.some(r => staticRoom
196
+ ? r.builderVersion === row.builderVersion && canonicalJson(r.contracts) === canonicalJson(row.contracts)
197
+ && r.tool.packageName === row.tool.packageName && r.tool.kitSnapshotHash === row.tool.kitSnapshotHash
198
+ : canonicalJson(r) === canonicalJson(row))) fail('RUNTIME_CONTENT_INCOMPATIBLE');
188
199
  return true;
189
200
  }
190
201
 
@@ -82,6 +82,26 @@
82
82
  "$ref": "#/$defs/source"
83
83
  }
84
84
  }
85
+ },
86
+ {
87
+ "type": "object",
88
+ "additionalProperties": false,
89
+ "required": [
90
+ "clientsCommitSha",
91
+ "publicNode",
92
+ "contentRoom"
93
+ ],
94
+ "properties": {
95
+ "clientsCommitSha": {
96
+ "$ref": "#/$defs/commit"
97
+ },
98
+ "publicNode": {
99
+ "$ref": "#/$defs/source"
100
+ },
101
+ "contentRoom": {
102
+ "$ref": "#/$defs/source"
103
+ }
104
+ }
85
105
  }
86
106
  ]
87
107
  },
@@ -649,24 +669,48 @@
649
669
  "then": {
650
670
  "properties": {
651
671
  "source": {
652
- "type": "object",
653
- "additionalProperties": false,
654
- "required": [
655
- "clientsCommitSha",
656
- "publicNode",
657
- "publicFlight"
658
- ],
659
- "properties": {
660
- "clientsCommitSha": {
661
- "$ref": "#/$defs/commit"
662
- },
663
- "publicNode": {
664
- "$ref": "#/$defs/source"
672
+ "oneOf": [
673
+ {
674
+ "type": "object",
675
+ "additionalProperties": false,
676
+ "required": [
677
+ "clientsCommitSha",
678
+ "publicNode",
679
+ "publicFlight"
680
+ ],
681
+ "properties": {
682
+ "clientsCommitSha": {
683
+ "$ref": "#/$defs/commit"
684
+ },
685
+ "publicNode": {
686
+ "$ref": "#/$defs/source"
687
+ },
688
+ "publicFlight": {
689
+ "$ref": "#/$defs/source"
690
+ }
691
+ }
665
692
  },
666
- "publicFlight": {
667
- "$ref": "#/$defs/source"
693
+ {
694
+ "type": "object",
695
+ "additionalProperties": false,
696
+ "required": [
697
+ "clientsCommitSha",
698
+ "publicNode",
699
+ "contentRoom"
700
+ ],
701
+ "properties": {
702
+ "clientsCommitSha": {
703
+ "$ref": "#/$defs/commit"
704
+ },
705
+ "publicNode": {
706
+ "$ref": "#/$defs/source"
707
+ },
708
+ "contentRoom": {
709
+ "$ref": "#/$defs/source"
710
+ }
711
+ }
668
712
  }
669
- }
713
+ ]
670
714
  },
671
715
  "compatibility": {
672
716
  "type": "object",
@@ -0,0 +1,225 @@
1
+ import test from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { readFile, mkdir, writeFile } from 'node:fs/promises';
4
+ import { resolve, join } from 'node:path';
5
+ import { pathToFileURL } from 'node:url';
6
+ import { createFormatFixture } from './format-fixture.mjs';
7
+ import { encodeRuntimeArchive, decodeRuntimeArchive } from './archive.mjs';
8
+ import { runtimeCanonical, runtimeHash, runtimeIdentity, computeRuntimeHash, validateRuntimeManifest,
9
+ verifyRuntimeManifest, verifyRuntimePair, assertRuntimeCompatibility, validRuntimePath } from './manifest.mjs';
10
+
11
+ const prefix = 'node/content-room-authority/';
12
+ const implementation = `${prefix}services/game-worker/src/runtime/content/content-room-source.js`;
13
+ const sort = entries => entries.sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
14
+ function assemble(entries, roomSource) {
15
+ const f = createFormatFixture(), manifest = structuredClone(f.manifest);
16
+ delete manifest.source.publicFlight;
17
+ manifest.source.contentRoom = roomSource;
18
+ entries = sort([...f.entries, ...entries]);
19
+ const archive = encodeRuntimeArchive(entries, { staticRoom: true });
20
+ manifest.files = entries.map(e => ({ path: e.path, role: e.role, bytes: e.bytes.length, sha256: runtimeHash(e.bytes) }));
21
+ manifest.archive = { ...manifest.archive, bytes: archive.length, sha256: runtimeHash(archive) };
22
+ manifest.runtimeHash = computeRuntimeHash(manifest); manifest.runtimeId = runtimeIdentity(manifest);
23
+ const bytes = Buffer.from(`${runtimeCanonical(manifest)}\n`), manifestHash = runtimeHash(bytes);
24
+ const lock = { ...f.lock, runtimeId: manifest.runtimeId, runtimeHash: manifest.runtimeHash,
25
+ manifest: { ...f.lock.manifest, bytes: bytes.length, sha256: manifestHash },
26
+ archive: { ...f.lock.archive, bytes: archive.length, sha256: runtimeHash(archive) } };
27
+ return { manifest, archive, entries, bytes, manifestHash, lock, target: f.target, expected: f.expected };
28
+ }
29
+ function fixture() {
30
+ return assemble([
31
+ { path: implementation, role: 'node', bytes: Buffer.from('STATIC ROOM FORMAT FIXTURE ONLY\n') },
32
+ { path: `${prefix}source-lock.json`, role: 'data', bytes: Buffer.from('SOURCE LOCK FORMAT FIXTURE ONLY\n') }
33
+ ], { commitSha: 'e'.repeat(40), sourceHash: runtimeHash('room-format-fixture'), lockPath: `${prefix}source-lock.json` });
34
+ }
35
+ const rehash = m => { m.runtimeHash = computeRuntimeHash(m); m.runtimeId = runtimeIdentity(m); };
36
+
37
+ test('static Room archive Writer and Reader bind independent Room without Document or Flight claims', () => {
38
+ const f = fixture(), m = verifyRuntimeManifest(f.bytes, f.manifestHash);
39
+ assert.equal(m.schemaVersion, '1.0.0');
40
+ assert.deepEqual(Object.keys(m.source).sort(), ['clientsCommitSha', 'contentRoom', 'publicNode']);
41
+ assert.equal(m.source.documentAuthority, undefined); assert.equal(m.source.publicFlight, undefined);
42
+ assert.deepEqual(decodeRuntimeArchive(f.archive, m), f.entries);
43
+ assert.equal(verifyRuntimePair(m, f.lock, f.expected, { target: f.target }).ready, false);
44
+ const wrong = structuredClone(f.expected); wrong.contracts.contractSetHashes.worldScene = runtimeHash('wrong-content');
45
+ assert.throws(() => assertRuntimeCompatibility(m, { target: f.target, expected: wrong }), { code: 'RUNTIME_CONTENT_INCOMPATIBLE' });
46
+ });
47
+
48
+ test('static Room admits its fixed implementation namespace without opening author or Document paths', () => {
49
+ assert.equal(validRuntimePath(implementation), false);
50
+ assert.equal(validRuntimePath(implementation, { staticRoom: true }), true);
51
+ assert.equal(validRuntimePath(implementation, { document: true }), false);
52
+ for (const path of ['content/shared/main.js', `${prefix}content/main.js`,
53
+ `${prefix}services/game-worker/src/runtime/content/author.glb`,
54
+ `${prefix}services/game-worker/src/runtime/content/private/main.js`,
55
+ `${prefix}services/ugc-pipeline/src/local-content.mjs`,
56
+ 'node/content-room-document-authority/services/game-worker/src/runtime/content/content-room-source.js',
57
+ 'node/other/services/game-worker/src/runtime/content/content-room-source.js'])
58
+ assert.equal(validRuntimePath(path, { staticRoom: true }), false, path);
59
+ assert.throws(() => encodeRuntimeArchive(fixture().entries), { code: 'INVALID_RUNTIME_FILES' });
60
+ });
61
+
62
+ test('static Room source variants, lock references, inventory and archive bytes remain exact', () => {
63
+ for (const [mutate, code] of [
64
+ [m => { m.source.publicFlight = m.source.contentRoom; }, 'INVALID_RUNTIME_SOURCE'],
65
+ [m => { m.source.documentAuthority = m.source.contentRoom; }, 'INVALID_RUNTIME_SOURCE'],
66
+ [m => { delete m.source.contentRoom; }, 'INVALID_RUNTIME_SOURCE'],
67
+ [m => { m.source.contentRoom.lockPath = m.source.publicNode.lockPath; }, 'INVALID_RUNTIME_SOURCE'],
68
+ [m => { m.source.contentRoom.lockPath = 'data/missing.json'; }, 'INVALID_RUNTIME_SOURCE'],
69
+ [m => { m.source.contentRoom.sourceHash = 'unknown'; }, 'INVALID_RUNTIME_SOURCE'],
70
+ [m => { m.schemaVersion = '1.1.0'; }, 'INVALID_RUNTIME_SOURCE'],
71
+ [m => { m.compatibility.protocol.schemaRevision = 3; }, 'INVALID_RUNTIME_COMPATIBILITY'],
72
+ [m => { m.compatibility.content[0].builderVersion = 'local-content@1.1.0'; }, 'INVALID_RUNTIME_COMPATIBILITY']
73
+ ]) {
74
+ const { manifest } = fixture(); mutate(manifest); rehash(manifest);
75
+ assert.throws(() => validateRuntimeManifest(manifest), { code });
76
+ }
77
+ const f = fixture(), wrong = Buffer.from(f.archive); wrong[50] ^= 1;
78
+ assert.throws(() => decodeRuntimeArchive(wrong, f.manifest), { code: 'RUNTIME_ARCHIVE_HASH_MISMATCH' });
79
+ const altered = structuredClone(f.manifest); altered.files.find(x => x.path === implementation).sha256 = runtimeHash('drift');
80
+ assert.throws(() => validateRuntimeManifest(altered), { code: 'RUNTIME_PACKAGE_IDENTITY_MISMATCH' });
81
+ rehash(altered);
82
+ assert.throws(() => decodeRuntimeArchive(f.archive, altered), { code: 'RUNTIME_ARCHIVE_HASH_MISMATCH' });
83
+ });
84
+
85
+ test('schema preserves two exact static source alternatives and the separate Document source', async () => {
86
+ const s = JSON.parse(await readFile(new URL('./runtime-manifest.schema.json', import.meta.url)));
87
+ const variants = s.allOf[0].then.properties.source.oneOf;
88
+ assert.equal(variants.length, 2);
89
+ assert.deepEqual(variants.map(x => x.required.slice().sort()), [
90
+ ['clientsCommitSha', 'publicFlight', 'publicNode'], ['clientsCommitSha', 'contentRoom', 'publicNode']
91
+ ]);
92
+ for (const v of variants) assert.equal(v.additionalProperties, false);
93
+ assert.deepEqual(s.properties.source.oneOf.map(x => x.required.slice().sort()), [
94
+ variants[0].required.slice().sort(), ['clientsCommitSha', 'contentRoom', 'documentAuthority', 'publicNode'],
95
+ variants[1].required.slice().sort()
96
+ ]);
97
+ });
98
+
99
+ test('only static Room compatibility treats valid tool versions as provenance, preserving interface identity', () => {
100
+ const f = fixture();
101
+ for (const field of ['packageVersion', 'kitVersion']) {
102
+ for (const version of ['1.5.9', '1.5.10', '1.5.11']) {
103
+ // Version shape vectors only; 1.5.11 here is not a real Kit reference.
104
+ const expected = structuredClone(f.expected); expected.tool[field] = version;
105
+ assert.equal(verifyRuntimePair(f.manifest, f.lock, expected, { target: f.target }).ready, false);
106
+ assert.equal(f.expected.tool[field], '0.2.5');
107
+ }
108
+ for (const version of [undefined, null, '', '01.5.9', '1.5', '1.5.9-beta.1']) {
109
+ const expected = structuredClone(f.expected); expected.tool[field] = version;
110
+ assert.throws(() => assertRuntimeCompatibility(f.manifest, { target: f.target, expected }), { code: 'RUNTIME_CONTENT_INCOMPATIBLE' });
111
+ }
112
+ }
113
+ for (const mutate of [
114
+ row => { row.builderVersion = 'local-content@1.1.0'; },
115
+ row => { row.tool.packageName = '@chrona-city/ugc-kit'; },
116
+ row => { row.tool.kitSnapshotHash = runtimeHash('another-sdk'); },
117
+ row => { row.tool.extra = true; },
118
+ row => { row.contracts.registryVersion = '1.1.11'; },
119
+ row => { row.contracts.registryHash = runtimeHash('another-registry'); },
120
+ row => { row.contracts.resolutionPolicyHash = runtimeHash('another-policy'); },
121
+ row => { row.contracts.contractSetHashes.localContent = runtimeHash('another-builder'); },
122
+ row => { row.contracts.contractSetHashes.worldScene = runtimeHash('another-world'); }
123
+ ]) {
124
+ const expected = structuredClone(f.expected); mutate(expected);
125
+ assert.throws(() => assertRuntimeCompatibility(f.manifest, { target: f.target, expected }), { code: 'RUNTIME_CONTENT_INCOMPATIBLE' });
126
+ }
127
+ assert.throws(() => assertRuntimeCompatibility(f.manifest, { target: { ...f.target, nodeVersion: '24.1.0' }, expected: f.expected }),
128
+ { code: 'RUNTIME_TARGET_UNSUPPORTED' });
129
+ const malformed = structuredClone(f.manifest); malformed.compatibility.content[0].tool.kitVersion = 'unknown'; rehash(malformed);
130
+ assert.throws(() => assertRuntimeCompatibility(malformed, f), { code: 'INVALID_RUNTIME_COMPATIBILITY' });
131
+ });
132
+
133
+ test('Flight and Document preserve complete version matching and cannot select the static Room rule', () => {
134
+ const legacy = createFormatFixture();
135
+ for (const key of ['packageVersion', 'kitVersion']) {
136
+ const expected = structuredClone(legacy.expected); expected.tool[key] = '1.5.11';
137
+ assert.throws(() => assertRuntimeCompatibility(legacy.manifest, { target: legacy.target, expected }), { code: 'RUNTIME_CONTENT_INCOMPATIBLE' });
138
+ }
139
+ const document = fixture(); delete document.manifest.source.contentRoom;
140
+ document.manifest.source.contentRoom = { commitSha: 'e'.repeat(40), sourceHash: runtimeHash('doc-room'), lockPath: 'data/flight.json' };
141
+ document.manifest.source.documentAuthority = { commitSha: 'f'.repeat(40), sourceHash: runtimeHash('doc-authority'), lockPath: 'data/style.json' };
142
+ document.manifest.schemaVersion = '1.1.0';
143
+ document.manifest.files = document.manifest.files.filter(row => row.path !== implementation);
144
+ document.manifest.files.push({ path: 'sandbox/document-view.html', role: 'sandbox', bytes: 0, sha256: runtimeHash('') });
145
+ document.manifest.files.sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
146
+ document.manifest.compatibility.content[0].builderVersion = 'local-content@1.1.0';
147
+ document.manifest.compatibility.content[0].contracts.contractSetHashes.documentPresentation = runtimeHash('doc');
148
+ document.manifest.compatibility.policyFiles = { documentPresentation: 'data/world.json' };
149
+ document.manifest.entrypoints.sandbox = 'sandbox/document-view.html';
150
+ document.manifest.archive.bytes = 22 + document.manifest.files.reduce((n, f) => n + f.bytes + 76 + 2 * Buffer.byteLength(f.path), 0);
151
+ rehash(document.manifest); validateRuntimeManifest(document.manifest);
152
+ for (const key of ['packageVersion', 'kitVersion']) {
153
+ const expected = structuredClone(document.manifest.compatibility.content[0]); expected.tool[key] = '1.5.11';
154
+ assert.throws(() => assertRuntimeCompatibility(document.manifest, { target: document.target, expected }), { code: 'RUNTIME_CONTENT_INCOMPATIBLE' });
155
+ }
156
+ });
157
+
158
+ test('unchanged real 159 and 1510 Builder outputs match one static Room row through the original full Reader', {
159
+ skip: !process.env.CHRONA_STATIC_SEMANTIC_INPUTS || !process.env.CHRONA_STATIC_SEMANTIC_READER
160
+ }, async () => {
161
+ const reader = await import(pathToFileURL(resolve(process.env.CHRONA_STATIC_SEMANTIC_READER)));
162
+ const rows = [], pins = [];
163
+ for (const file of JSON.parse(process.env.CHRONA_STATIC_SEMANTIC_INPUTS)) {
164
+ const original = await readFile(file), content = JSON.parse(original);
165
+ const input = await reader.openLocalContentInput(content, { runtimeReader: true });
166
+ try {
167
+ assert.equal(input.snapshot.schemaVersion, '1.0.0');
168
+ assert.deepEqual(input.validation.identity, content.expected);
169
+ let bytes = 0;
170
+ for (const item of input.snapshot.files) bytes += (await input.files.read(item.path)).length;
171
+ rows.push(structuredClone(input.validation.identity));
172
+ pins.push({ inputHash: runtimeHash(original), expected: input.validation.identity, files: input.snapshot.files.length, bytes });
173
+ } finally { await input.close(); }
174
+ assert.deepEqual(await readFile(file), original);
175
+ }
176
+ assert.equal(rows.length, 2);
177
+ assert.deepEqual(rows.map(row => row.tool.packageVersion), ['1.5.9', '1.5.10']);
178
+ assert.deepEqual(rows[0].contracts, rows[1].contracts);
179
+ assert.equal(rows[0].tool.kitSnapshotHash, rows[1].tool.kitSnapshotHash);
180
+ const f = fixture();
181
+ f.manifest.compatibility.content = [{ builderVersion: rows[1].builderVersion, tool: rows[1].tool, contracts: rows[1].contracts }];
182
+ rehash(f.manifest);
183
+ const manifestBytes = Buffer.from(`${runtimeCanonical(f.manifest)}\n`);
184
+ f.lock.runtimeId = f.manifest.runtimeId; f.lock.runtimeHash = f.manifest.runtimeHash;
185
+ f.lock.manifest = { ...f.lock.manifest, bytes: manifestBytes.length, sha256: runtimeHash(manifestBytes) };
186
+ const manifest = verifyRuntimeManifest(manifestBytes, runtimeHash(manifestBytes));
187
+ for (const expected of rows) assert.equal(verifyRuntimePair(manifest, f.lock, expected, { target: f.target }).ready, false);
188
+ if (process.env.CHRONA_STATIC_SEMANTIC_OUTPUT) await writeFile(process.env.CHRONA_STATIC_SEMANTIC_OUTPUT,
189
+ `${JSON.stringify({ fixtureOnly: true, executable: false, actual1511ReferenceVerified: false,
190
+ inputs: pins, manifestBytesBase64: manifestBytes.toString('base64'), manifestHash: runtimeHash(manifestBytes),
191
+ lock: f.lock, target: f.target, hostVerified: false }, null, 2)}\n`, { flag: 'wx', mode: 0o600 });
192
+ });
193
+
194
+ test('original 70-source Room Reader output survives real archive Writer and independent decode', {
195
+ skip: !process.env.CHRONA_STATIC_ROOM_DIRECTORY || !process.env.CHRONA_STATIC_ROOM_READER
196
+ }, async () => {
197
+ // Only the original fixed Reader can supply this source. The outer host/WASM
198
+ // fixture remains non-executable; no installed Runtime or Guest is claimed.
199
+ const directory = resolve(process.env.CHRONA_STATIC_ROOM_DIRECTORY);
200
+ const reader = await import(pathToFileURL(resolve(process.env.CHRONA_STATIC_ROOM_READER)));
201
+ const { lock, files } = await reader.readContentRoomAuthority(directory);
202
+ assert.equal(lock.manifest.files.length, 70);
203
+ const entries = [...files].map(([path, bytes]) => ({ path: `${prefix}${path}`, bytes,
204
+ role: /\.(?:js|mjs|cjs)$/.test(path) ? 'node' : 'data' }));
205
+ const lockBytes = await readFile(join(directory, 'source-lock.json'));
206
+ entries.push({ path: `${prefix}source-lock.json`, bytes: lockBytes, role: 'data' });
207
+ const f = assemble(entries, { commitSha: lock.sourceCommit, sourceHash: lock.manifest.sourceHash,
208
+ lockPath: `${prefix}source-lock.json` });
209
+ const m = verifyRuntimeManifest(f.bytes, f.manifestHash);
210
+ const decoded = new Map(decodeRuntimeArchive(f.archive, m).map(x => [x.path, x.bytes]));
211
+ for (const row of lock.manifest.files) assert.equal(runtimeHash(decoded.get(`${prefix}${row.path}`)), `sha256:${row.sha256}`);
212
+ assert.deepEqual(decoded.get(`${prefix}source-lock.json`), lockBytes);
213
+ assert.equal(verifyRuntimePair(m, f.lock, f.expected, { target: f.target }).ready, false);
214
+ if (process.env.CHRONA_STATIC_ROOM_OUTPUT) {
215
+ const output = resolve(process.env.CHRONA_STATIC_ROOM_OUTPUT);
216
+ await mkdir(output, { recursive: true, mode: 0o700 });
217
+ for (const [name, bytes] of [['runtime-manifest.json', f.bytes], ['runtime.zip', f.archive],
218
+ ['runtime-lock.json', Buffer.from(`${JSON.stringify(f.lock, null, 2)}\n`)],
219
+ ['result.json', Buffer.from(`${JSON.stringify({ fixtureOnly: true, executable: false,
220
+ originalRoomFiles: lock.manifest.files.length, roomCommit: lock.sourceCommit, roomSourceHash: lock.manifest.sourceHash,
221
+ roomLockHash: runtimeHash(lockBytes), manifestHash: f.manifestHash, archiveHash: runtimeHash(f.archive),
222
+ files: m.files.length, archiveBytes: f.archive.length, ready: false }, null, 2)}\n`)]])
223
+ await writeFile(join(output, name), bytes, { flag: 'wx', mode: 0o600 });
224
+ }
225
+ });
@@ -48,6 +48,50 @@ finalization or bypass the final version/source/archive checks. Release tooling,
48
48
  portable integrity, target installation and ordinary gameplay remain separate
49
49
  verification stages; an engineering source/package fixture is not an issued Kit.
50
50
 
51
+ ## Release-only WorldScene and Document catalog composition
52
+
53
+ The catalog prepare CLI accepts its original `producerFile`,
54
+ `clientsDeliveryFile`, `runtimeOrigin` and `outputDirectory` input. A Document
55
+ release may also supply `legacy: {producerFile, clientsDeliveryFile}` for the
56
+ existing WorldScene1.0 content family. Each pair goes through the original
57
+ Producer/delivery/manifest/target checks before the catalog is combined. Both
58
+ must bind the same release source, version, environment and complete toolchain;
59
+ the additional delivery is a normal Producer delivery, not a borrowed Document
60
+ companion or payload-reuse proof. No snapshot or content identity is converted.
61
+ The shared release binding describes the two internal Kit packages, not a
62
+ requirement for historical projects to adopt a new identity. Every historical
63
+ content tuple still needs genuine compatibility and execution evidence; a new
64
+ reference built by the current Kit cannot stand in for that historical input.
65
+
66
+ The release package and the content under test have separate identities. The
67
+ Producer's package, metadata, evidence, source and toolchain bind the new release
68
+ exactly. A retained content input keeps its original `expected` tuple and pinned
69
+ snapshot; when it differs from the carrier, the constructor reenters the existing
70
+ snapshot Reader rather than changing its tool fields. Each target report's `tool`
71
+ must equal that actual content's `expected.tool`, not the carrier version. The two
72
+ content families may therefore have different tool identities while sharing the
73
+ same release package/toolchain/source. This is not a version-range waiver: the
74
+ Runtime must declare and verify the exact content tuple, and the installed
75
+ package, execution target, original reports and cleanup remain independently
76
+ checked. A successful Producer or catalog check is not proof of historical Host
77
+ execution or of an unobserved project's compatibility.
78
+
79
+ The pairing keeps the Document `producer`, `clients` and `targets` unchanged,
80
+ and pins the WorldScene pair under `legacy: {producer, clients, targets}`.
81
+ Final verification reproduces both catalogs, checks the entire selected catalog,
82
+ and returns `legacyTargets` alongside the original `targets`. Catalog CAS and
83
+ source checks apply to both Producers. Removing either pair, changing its inputs
84
+ or manually adding a catalog entry cannot produce a matching final pairing.
85
+
86
+ Portable export/import transports the additional Producer, package, metadata,
87
+ evidence, content, complete snapshot, optional source lock and both target
88
+ manifests/archives/reports as closed `legacy-*` roles. Original logical JSON and
89
+ pins remain byte-identical, with no original-host fallback. The Document
90
+ companion proof and its existing roles are not extended to certify WorldScene.
91
+ This tooling support alone does not supply a playable static Room Runtime: its
92
+ trusted source contract, installed inspection, IPC, actual execution and public
93
+ immutable download must be verified separately before a release is recommended.
94
+
51
95
  ## Local selection failures
52
96
 
53
97
  `dev` and `test` read the trusted catalog bundled with the CLI actually invoked,
@@ -61,6 +61,12 @@ export const registeredUpgradeSources = [{ schemaVersion: '1.0.0', package: '@ch
61
61
  snapshotHash: 'sha256:2a150f290a642e1c72c9ac887cf787a916e4a1ee6f5e25b47f1d87467198285f',
62
62
  sdk: { shared: '#chrona/shared', client: '#chrona/client' } },
63
63
  { schemaVersion: '1.0.0', package: '@chrona-city/ugc-kit', version: '1.5.9',
64
+ snapshotHash: 'sha256:1bc56acdc3fdac6999115526f804068c101dcc73ef5054eb2c2c3dc29e381af8',
65
+ sdk: { shared: '#chrona/shared', client: '#chrona/client' } },
66
+ { schemaVersion: '1.0.0', package: '@chrona-city/ugc-kit', version: '1.5.10',
67
+ snapshotHash: 'sha256:1bc56acdc3fdac6999115526f804068c101dcc73ef5054eb2c2c3dc29e381af8',
68
+ sdk: { shared: '#chrona/shared', client: '#chrona/client' } },
69
+ { schemaVersion: '1.0.0', package: '@chrona-city/ugc-kit', version: '1.5.11',
64
70
  snapshotHash: 'sha256:1bc56acdc3fdac6999115526f804068c101dcc73ef5054eb2c2c3dc29e381af8',
65
71
  sdk: { shared: '#chrona/shared', client: '#chrona/client' } }];
66
72
 
@@ -14,9 +14,10 @@ const toolVersion = v => typeof v === 'string' && /^(0|[1-9][0-9]*)\.(0|[1-9][0-
14
14
  const bounded = (v, min, max) => Number.isSafeInteger(v) && v >= min && v <= max;
15
15
  const roles = ['node', 'browser', 'sandbox', 'wasm', 'data', 'license'];
16
16
 
17
- export function validRuntimePath(v, { document = false } = {}) {
18
- const roomImplementation = document && typeof v === 'string'
19
- && /^node\/content-room-document-authority\/services\/game-worker\/src\/runtime\/content\/[A-Za-z0-9_-][A-Za-z0-9_.-]*\.js$/.test(v);
17
+ export function validRuntimePath(v, { document = false, staticRoom = false } = {}) {
18
+ const roomImplementation = typeof v === 'string' && (document
19
+ ? /^node\/content-room-document-authority\/services\/game-worker\/src\/runtime\/content\/[A-Za-z0-9_-][A-Za-z0-9_.-]*\.js$/.test(v)
20
+ : staticRoom && /^node\/content-room-authority\/services\/game-worker\/src\/runtime\/content\/[A-Za-z0-9_-][A-Za-z0-9_.-]*\.js$/.test(v));
20
21
  const localExecutionImplementation = document && typeof v === 'string'
21
22
  && /^node\/document-local-execution\/services\/ugc-pipeline\/src\/(?:document-local-execution|private-state-model|private-event-model|private-ecs-model|registry-release)\.mjs$/.test(v);
22
23
  return typeof v === 'string' && v.length <= 512 && /^[A-Za-z0-9_@-][A-Za-z0-9_@.-]*(?:\/[A-Za-z0-9_@-][A-Za-z0-9_@.-]*)*$/.test(v)
@@ -27,12 +28,12 @@ export function validRuntimePath(v, { document = false } = {}) {
27
28
  && !/\.(?:pem|key|p12|pfx|glb|gltf)$/i.test(v) && !['runtime.zip', 'runtime-manifest.json'].includes(v.toLowerCase());
28
29
  }
29
30
 
30
- export function validateRuntimeFiles(files, { document = false } = {}) {
31
+ export function validateRuntimeFiles(files, { document = false, staticRoom = false } = {}) {
31
32
  if (!Array.isArray(files) || !files.length || files.length > RUNTIME_LIMITS.files) fail('INVALID_RUNTIME_FILES');
32
33
  let previous = '', total = 0;
33
34
  const folded = new Set(), directories = new Set();
34
35
  for (const f of files) {
35
- if (!exact(f, ['path', 'bytes', 'sha256', 'role']) || !validRuntimePath(f.path, { document }) || f.path <= previous
36
+ if (!exact(f, ['path', 'bytes', 'sha256', 'role']) || !validRuntimePath(f.path, { document, staticRoom }) || f.path <= previous
36
37
  || !digest(f.sha256) || !bounded(f.bytes, 0, RUNTIME_LIMITS.fileBytes) || !roles.includes(f.role)) fail('INVALID_RUNTIME_FILES');
37
38
  const parts = f.path.toLowerCase().split('/');
38
39
  if (folded.has(parts.join('/')) || directories.has(parts.join('/')) || parts.some((_, i) => folded.has(parts.slice(0, i).join('/')))) fail('INVALID_RUNTIME_FILES');
@@ -101,12 +102,16 @@ export function validateRuntimeManifest(v) {
101
102
  if (!exact(v, ['schemaVersion', 'kind', 'apiVersion', 'runtimeId', 'runtimeHash', 'executionTier', 'source', 'targets', 'compatibility', 'entrypoints', 'files', 'archive'])
102
103
  || !['1.0.0', '1.1.0'].includes(v.schemaVersion) || v.kind !== 'public-local-runtime' || v.apiVersion !== '1.0.0'
103
104
  || v.executionTier !== 'public-untrusted' || !/^runtime_[a-f0-9]{64}$/.test(v.runtimeId ?? '') || !digest(v.runtimeHash)) fail('INVALID_RUNTIME_MANIFEST');
104
- validateRuntimeFiles(v.files, { document: v.schemaVersion === '1.1.0' });
105
105
  const document = v.schemaVersion === '1.1.0';
106
- const files = new Map(v.files.map(f => [f.path, f]));
107
- const reference = (p, role) => validRuntimePath(p, { document }) && files.get(p)?.role === role;
108
- const sourceKeys = document ? ['publicNode', 'contentRoom', 'documentAuthority'] : ['publicNode', 'publicFlight'];
106
+ // Static Room is a distinct source closure, not Document or historical Flight.
107
+ // The exact source shape selects only its fixed implementation namespace.
108
+ const staticRoom = !document && exact(v.source, ['clientsCommitSha', 'publicNode', 'contentRoom']);
109
+ const sourceKeys = document ? ['publicNode', 'contentRoom', 'documentAuthority']
110
+ : staticRoom ? ['publicNode', 'contentRoom'] : ['publicNode', 'publicFlight'];
109
111
  if (!exact(v.source, ['clientsCommitSha', ...sourceKeys]) || !commit(v.source.clientsCommitSha)) fail('INVALID_RUNTIME_SOURCE');
112
+ validateRuntimeFiles(v.files, { document, staticRoom });
113
+ const files = new Map(v.files.map(f => [f.path, f]));
114
+ const reference = (p, role) => validRuntimePath(p, { document, staticRoom }) && files.get(p)?.role === role;
110
115
  for (const key of sourceKeys) {
111
116
  const source = v.source[key];
112
117
  if (!exact(source, ['commitSha', 'sourceHash', 'lockPath']) || !commit(source.commitSha) || !digest(source.sourceHash)
@@ -184,7 +189,13 @@ export function assertRuntimeTargetCompatibility(manifest, { target = { os: proc
184
189
  export function assertRuntimeCompatibility(manifest, { target, expected } = {}) {
185
190
  assertRuntimeTargetCompatibility(manifest, { target });
186
191
  const row = { builderVersion: expected?.builderVersion, tool: expected?.tool, contracts: expected?.contracts };
187
- if (!validContentRow(row, manifest.schemaVersion === '1.1.0') || !manifest.compatibility.content.some(r => canonicalJson(r) === canonicalJson(row))) fail('RUNTIME_CONTENT_INCOMPATIBLE');
192
+ const staticRoom = manifest.schemaVersion === '1.0.0' && exact(manifest.source, ['clientsCommitSha', 'publicNode', 'contentRoom']);
193
+ // Tool versions retain snapshot/report provenance. Only this validated static
194
+ // Room family matches the actual Builder/contracts/SDK interface instead.
195
+ if (!validContentRow(row, manifest.schemaVersion === '1.1.0') || !manifest.compatibility.content.some(r => staticRoom
196
+ ? r.builderVersion === row.builderVersion && canonicalJson(r.contracts) === canonicalJson(row.contracts)
197
+ && r.tool.packageName === row.tool.packageName && r.tool.kitSnapshotHash === row.tool.kitSnapshotHash
198
+ : canonicalJson(r) === canonicalJson(row))) fail('RUNTIME_CONTENT_INCOMPATIBLE');
188
199
  return true;
189
200
  }
190
201
 
@@ -82,6 +82,26 @@
82
82
  "$ref": "#/$defs/source"
83
83
  }
84
84
  }
85
+ },
86
+ {
87
+ "type": "object",
88
+ "additionalProperties": false,
89
+ "required": [
90
+ "clientsCommitSha",
91
+ "publicNode",
92
+ "contentRoom"
93
+ ],
94
+ "properties": {
95
+ "clientsCommitSha": {
96
+ "$ref": "#/$defs/commit"
97
+ },
98
+ "publicNode": {
99
+ "$ref": "#/$defs/source"
100
+ },
101
+ "contentRoom": {
102
+ "$ref": "#/$defs/source"
103
+ }
104
+ }
85
105
  }
86
106
  ]
87
107
  },
@@ -649,24 +669,48 @@
649
669
  "then": {
650
670
  "properties": {
651
671
  "source": {
652
- "type": "object",
653
- "additionalProperties": false,
654
- "required": [
655
- "clientsCommitSha",
656
- "publicNode",
657
- "publicFlight"
658
- ],
659
- "properties": {
660
- "clientsCommitSha": {
661
- "$ref": "#/$defs/commit"
662
- },
663
- "publicNode": {
664
- "$ref": "#/$defs/source"
672
+ "oneOf": [
673
+ {
674
+ "type": "object",
675
+ "additionalProperties": false,
676
+ "required": [
677
+ "clientsCommitSha",
678
+ "publicNode",
679
+ "publicFlight"
680
+ ],
681
+ "properties": {
682
+ "clientsCommitSha": {
683
+ "$ref": "#/$defs/commit"
684
+ },
685
+ "publicNode": {
686
+ "$ref": "#/$defs/source"
687
+ },
688
+ "publicFlight": {
689
+ "$ref": "#/$defs/source"
690
+ }
691
+ }
665
692
  },
666
- "publicFlight": {
667
- "$ref": "#/$defs/source"
693
+ {
694
+ "type": "object",
695
+ "additionalProperties": false,
696
+ "required": [
697
+ "clientsCommitSha",
698
+ "publicNode",
699
+ "contentRoom"
700
+ ],
701
+ "properties": {
702
+ "clientsCommitSha": {
703
+ "$ref": "#/$defs/commit"
704
+ },
705
+ "publicNode": {
706
+ "$ref": "#/$defs/source"
707
+ },
708
+ "contentRoom": {
709
+ "$ref": "#/$defs/source"
710
+ }
711
+ }
668
712
  }
669
- }
713
+ ]
670
714
  },
671
715
  "compatibility": {
672
716
  "type": "object",
@@ -57,14 +57,14 @@
57
57
  "pattern": "^[A-Z][A-Z0-9_]{2,79}$"
58
58
  },
59
59
  "target": {
60
- "$ref": "./distribution-node-support-contract/contracts/ugc/public-runtime/v1/runtime-manifest.schema.json#/$defs/observedTarget"
60
+ "$ref": "./distribution-static-room-semantic-contract/contracts/ugc/public-runtime/v1/runtime-manifest.schema.json#/$defs/observedTarget"
61
61
  },
62
62
  "tool": {
63
63
  "type": "object",
64
64
  "additionalProperties": false,
65
65
  "properties": {
66
66
  "packageName": {
67
- "$ref": "./distribution-node-support-contract/contracts/ugc/creator-source/v1/tool-package.schema.json"
67
+ "$ref": "./distribution-static-room-semantic-contract/contracts/ugc/creator-source/v1/tool-package.schema.json"
68
68
  },
69
69
  "packageVersion": {
70
70
  "$ref": "#/$defs/version"
@@ -344,6 +344,9 @@
344
344
  },
345
345
  {
346
346
  "$ref": "#/$defs/inspectResultDocument"
347
+ },
348
+ {
349
+ "$ref": "#/$defs/inspectResultStaticRoom"
347
350
  }
348
351
  ]
349
352
  },
@@ -1119,6 +1122,19 @@
1119
1122
  }
1120
1123
  }
1121
1124
  },
1125
+ "inspectResultStaticRoom": {
1126
+ "type": "object",
1127
+ "additionalProperties": false,
1128
+ "required": ["runtime", "publicNodeSourceHash", "contentRoomSourceHash", "clientsCommitSha", "target", "filesVerified"],
1129
+ "properties": {
1130
+ "runtime": { "$ref": "#/$defs/runtime" },
1131
+ "publicNodeSourceHash": { "$ref": "#/$defs/hash" },
1132
+ "contentRoomSourceHash": { "$ref": "#/$defs/hash" },
1133
+ "clientsCommitSha": { "$ref": "#/$defs/commit" },
1134
+ "target": { "$ref": "#/$defs/target" },
1135
+ "filesVerified": { "type": "integer", "minimum": 1, "maximum": 4096 }
1136
+ }
1137
+ },
1122
1138
  "inspectResultDocument": {
1123
1139
  "type": "object",
1124
1140
  "additionalProperties": false,
@@ -1,7 +1,7 @@
1
1
  import schema from './host-ipc.schema.json' with { type: 'json' }
2
- import toolPackageSchema from './distribution-node-support-contract/contracts/ugc/creator-source/v1/tool-package.schema.json' with { type: 'json' }
3
- import runtimeSchema from './distribution-node-support-contract/contracts/ugc/public-runtime/v1/runtime-manifest.schema.json' with { type: 'json' }
4
- import { validateRuntimeTarget } from './distribution-node-support-contract/contracts/ugc/public-runtime/v1/manifest.mjs'
2
+ import toolPackageSchema from './distribution-static-room-semantic-contract/contracts/ugc/creator-source/v1/tool-package.schema.json' with { type: 'json' }
3
+ import runtimeSchema from './distribution-static-room-semantic-contract/contracts/ugc/public-runtime/v1/runtime-manifest.schema.json' with { type: 'json' }
4
+ import { validateRuntimeTarget } from './distribution-static-room-semantic-contract/contracts/ugc/public-runtime/v1/manifest.mjs'
5
5
 
6
6
  export const hostIpcSchema = schema
7
7
  export const canonicalRuntimeJson = value => {
@@ -14,8 +14,8 @@ const plain = value => value && typeof value === 'object' && !Array.isArray(valu
14
14
  && [Object.prototype, null].includes(Object.getPrototypeOf(value))
15
15
  function check(value, rule, field) {
16
16
  const invalid = () => fail('RUNTIME_CONTRACT_INVALID', field)
17
- if (rule.$ref) return check(value, rule.$ref === './distribution-node-support-contract/contracts/ugc/creator-source/v1/tool-package.schema.json'
18
- ? toolPackageSchema : rule.$ref === './distribution-node-support-contract/contracts/ugc/public-runtime/v1/runtime-manifest.schema.json#/$defs/observedTarget'
17
+ if (rule.$ref) return check(value, rule.$ref === './distribution-static-room-semantic-contract/contracts/ugc/creator-source/v1/tool-package.schema.json'
18
+ ? toolPackageSchema : rule.$ref === './distribution-static-room-semantic-contract/contracts/ugc/public-runtime/v1/runtime-manifest.schema.json#/$defs/observedTarget'
19
19
  ? runtimeSchema.$defs.observedTarget : schema.$defs[rule.$ref.slice(8)], field)
20
20
  if (rule.oneOf) {
21
21
  let matches = 0
@@ -2,32 +2,32 @@
2
2
  "schemaVersion": "1.0.0",
3
3
  "source": {
4
4
  "repository": "Alterverse-tech/chrona-clients",
5
- "commitSha": "db6dacf7dc7cd607b555c0600547f21c3cb56fad",
5
+ "commitSha": "d1bee3ed94a0a7be02323354b07c41c1bb4e0314",
6
6
  "path": "tools/local-preview"
7
7
  },
8
8
  "artifacts": [
9
9
  {
10
10
  "path": "runtime-contract.mjs",
11
- "sha256": "486c38c95ec43ef49a0a612dd6c2a4d1abf142029ed43f94d79c395ddf0861b2"
11
+ "sha256": "208e67986175a88e5554cbf0f3abb70db696d790bf6ec0dca1ddc4c21c5cb42a"
12
12
  },
13
13
  {
14
14
  "path": "host-ipc.schema.json",
15
- "sha256": "2400e0d4a82d82efd5866f6a90867ddd1f77150935418e524cc840233e17baad"
15
+ "sha256": "2f2d1260601b3b62f3fbf1e333c7c006c0abd5c4d3ba6783814400232ac90970"
16
16
  },
17
17
  {
18
- "path": "distribution-node-support-contract/contracts/ugc/creator-source/v1/tool-package.schema.json",
18
+ "path": "distribution-static-room-semantic-contract/contracts/ugc/creator-source/v1/tool-package.schema.json",
19
19
  "sha256": "b6af316222076800db26526cc2e75318513697405ae38b07ef40c57d36691a05"
20
20
  },
21
21
  {
22
- "path": "distribution-node-support-contract/contracts/ugc/public-runtime/v1/manifest.mjs",
23
- "sha256": "c721a8d42fa84c6f1506c99f11e2d8e3565dad4d6bcbf82189fb29ca622481fa"
22
+ "path": "distribution-static-room-semantic-contract/contracts/ugc/public-runtime/v1/manifest.mjs",
23
+ "sha256": "825be4852b3d635154a60a5e461d99c0ee60195ea5a2ef6527f8606b99bea030"
24
24
  },
25
25
  {
26
- "path": "distribution-node-support-contract/contracts/ugc/public-runtime/v1/runtime-manifest.schema.json",
27
- "sha256": "2c442ed296781d1656556720ebc1b3d63eecdcb4173d5170765206d8c30b04da"
26
+ "path": "distribution-static-room-semantic-contract/contracts/ugc/public-runtime/v1/runtime-manifest.schema.json",
27
+ "sha256": "4edbaadcf489b68d4830aa68b2b12249ba8e06ff8f250f858767f66b41216c74"
28
28
  },
29
29
  {
30
- "path": "distribution-node-support-contract/contracts/ugc/registry/v1/conformance/js/capability-resolver.mjs",
30
+ "path": "distribution-static-room-semantic-contract/contracts/ugc/registry/v1/conformance/js/capability-resolver.mjs",
31
31
  "sha256": "66e3be28c8b9da7fb4e814e6a9263fe276cb2456a8ac9d295c2e9d9d785ddafd"
32
32
  }
33
33
  ]
@@ -72,12 +72,18 @@ export function createRuntimeHostClient({ channel, installed, content, onStatus,
72
72
  }
73
73
  const result = value.result;
74
74
  if (value.operation === 'inspect') {
75
- const sourcesMatch = installed.manifestSchemaVersion === '1.1.0'
76
- ? result.contentRoomSourceHash === installed.contentRoomSourceHash
75
+ let sourcesMatch;
76
+ if (installed.manifestSchemaVersion === '1.1.0') {
77
+ sourcesMatch = result.contentRoomSourceHash === installed.contentRoomSourceHash
77
78
  && result.documentAuthoritySourceHash === installed.documentAuthoritySourceHash
78
- && !Object.hasOwn(result, 'publicFlightSourceHash')
79
- : result.publicFlightSourceHash === installed.publicFlightSourceHash
79
+ && !Object.hasOwn(result, 'publicFlightSourceHash');
80
+ } else if (installed.manifestSchemaVersion === '1.0.0' && installed.contentRoomSourceHash !== undefined) {
81
+ sourcesMatch = result.contentRoomSourceHash === installed.contentRoomSourceHash
82
+ && !Object.hasOwn(result, 'publicFlightSourceHash') && !Object.hasOwn(result, 'documentAuthoritySourceHash');
83
+ } else {
84
+ sourcesMatch = result.publicFlightSourceHash === installed.publicFlightSourceHash
80
85
  && !Object.hasOwn(result, 'contentRoomSourceHash') && !Object.hasOwn(result, 'documentAuthoritySourceHash');
86
+ }
81
87
  if (!equal(result.runtime, runtime) || result.publicNodeSourceHash !== installed.publicNodeSourceHash
82
88
  || !sourcesMatch || result.clientsCommitSha !== installed.clientsCommitSha
83
89
  || !equal(result.target, installed.target) || result.filesVerified !== installed.filesVerified) throw error('RUNTIME_IPC_IDENTITY_MISMATCH');
@@ -21,7 +21,9 @@ export async function verifyHostIpcSnapshot() {
21
21
  'contracts/ugc/public-runtime/v1/runtime-manifest.schema.json',
22
22
  'contracts/ugc/registry/v1/conformance/js/capability-resolver.mjs'
23
23
  ].map(name => `distribution-node-support-contract/${name}`)];
24
- const names = [legacy, current, support].find(names => Array.isArray(lock.artifacts)
24
+ const staticRoom = support.map(name => name.replace(/^distribution-node-support-contract\//, 'distribution-static-room-contract/'));
25
+ const semanticRoom = support.map(name => name.replace(/^distribution-node-support-contract\//, 'distribution-static-room-semantic-contract/'));
26
+ const names = [legacy, current, support, staticRoom, semanticRoom].find(names => Array.isArray(lock.artifacts)
25
27
  && JSON.stringify(lock.artifacts.map(row => row.path)) === JSON.stringify(names));
26
28
  if (lock.schemaVersion !== '1.0.0' || lock.source?.repository !== 'Alterverse-tech/chrona-clients' || lock.source.path !== 'tools/local-preview'
27
29
  || !/^[a-f0-9]{40}$/.test(lock.source.commitSha ?? '') || !names) throw error('HOST_IPC_SNAPSHOT_MISMATCH');
@@ -45,6 +45,7 @@ export async function verifyPublicRuntimeSnapshot() {
45
45
  const names = ['README.md', 'archive.mjs', 'format-fixture.mjs', 'golden.json', 'manifest.mjs', 'runtime-lock.schema.json', 'runtime-manifest.schema.json', 'runtime.test.mjs', 'vectors.json'];
46
46
  if (lock.artifacts?.some(f => f.path === `${base}/document-runtime.test.mjs`)) names.push('document-runtime.test.mjs');
47
47
  if (lock.artifacts?.some(f => f.path === `${base}/target-compatibility.test.mjs`)) names.push('target-compatibility.test.mjs');
48
+ if (lock.artifacts?.some(f => f.path === `${base}/static-room-runtime.test.mjs`)) names.push('static-room-runtime.test.mjs');
48
49
  names.sort();
49
50
  const dependency = 'contracts/ugc/creator-source/v1/tool-package.schema.json';
50
51
  const manifestBytes = await readBounded(path.join(kit, base, 'manifest.mjs'), 1048576, { privateFile: false });
@@ -129,9 +130,16 @@ export async function inspectInstalledRuntime({ installationDirectory, lock, tru
129
130
  const manifest = verifyRuntimeManifest(bytes, lock.manifest.sha256);
130
131
  const identity = verifyRuntimePair(manifest, lock, expected, { allowLocalHttp });
131
132
  await verifyTree(installationDirectory, manifest, bytes, signal);
132
- const sources = manifest.schemaVersion === '1.1.0'
133
- ? await inspectDocumentPrograms(installationDirectory, manifest, signal)
134
- : { publicFlightSourceHash: manifest.source.publicFlight.sourceHash };
133
+ let sources;
134
+ if (manifest.schemaVersion === '1.1.0') {
135
+ sources = await inspectDocumentPrograms(installationDirectory, manifest, signal);
136
+ } else if (manifest.source.contentRoom !== undefined) {
137
+ // The authority Reader and full installed tree have already been checked.
138
+ sources = { manifestSchemaVersion: manifest.schemaVersion,
139
+ contentRoomSourceHash: manifest.source.contentRoom.sourceHash };
140
+ } else {
141
+ sources = { publicFlightSourceHash: manifest.source.publicFlight.sourceHash };
142
+ }
135
143
  return { ...identity, installationDirectory, installed: true, executable: false, filesVerified: manifest.files.length,
136
144
  publicNodeSourceHash: manifest.source.publicNode.sourceHash, ...sources,
137
145
  clientsCommitSha: manifest.source.clientsCommitSha,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chrona-city/ugc-kit",
3
- "version": "1.5.10",
3
+ "version": "1.5.11",
4
4
  "description": "Chrona creator CLI, SDK and MCP tools for validated multiplayer content",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -2,7 +2,7 @@
2
2
  "schemaVersion": "1.0.0",
3
3
  "source": {
4
4
  "repository": "ChronaWorld/chrona-services",
5
- "commitSha": "49a782d34f7d4d49a3f8dc4979b2c1aefd641752",
5
+ "commitSha": "34906beca4047c710991c3d4da5cd58718e72fc2",
6
6
  "path": "contracts/ugc/public-runtime/v1"
7
7
  },
8
8
  "artifacts": [
@@ -12,11 +12,11 @@
12
12
  },
13
13
  {
14
14
  "path": "contracts/ugc/public-runtime/v1/README.md",
15
- "sha256": "806ae8c5e1e131d3ff112d168e6c010b6e897a8ad5e1e9816bd1d7b915de306b"
15
+ "sha256": "e9e869811991c350cfc4eeeb2dcd636a89f6b4da9139b3db6e19e692ffe26702"
16
16
  },
17
17
  {
18
18
  "path": "contracts/ugc/public-runtime/v1/archive.mjs",
19
- "sha256": "b1a124c8ee7328d1066aed0c58cee1b2d11cfeabc677b125586e774716bd5600"
19
+ "sha256": "92e851d3b871781922461ec5b2cf2f03024b47cc5cdb78750d91cf8abc097405"
20
20
  },
21
21
  {
22
22
  "path": "contracts/ugc/public-runtime/v1/document-runtime.test.mjs",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  {
34
34
  "path": "contracts/ugc/public-runtime/v1/manifest.mjs",
35
- "sha256": "c721a8d42fa84c6f1506c99f11e2d8e3565dad4d6bcbf82189fb29ca622481fa"
35
+ "sha256": "825be4852b3d635154a60a5e461d99c0ee60195ea5a2ef6527f8606b99bea030"
36
36
  },
37
37
  {
38
38
  "path": "contracts/ugc/public-runtime/v1/runtime-lock.schema.json",
@@ -40,12 +40,16 @@
40
40
  },
41
41
  {
42
42
  "path": "contracts/ugc/public-runtime/v1/runtime-manifest.schema.json",
43
- "sha256": "2c442ed296781d1656556720ebc1b3d63eecdcb4173d5170765206d8c30b04da"
43
+ "sha256": "4edbaadcf489b68d4830aa68b2b12249ba8e06ff8f250f858767f66b41216c74"
44
44
  },
45
45
  {
46
46
  "path": "contracts/ugc/public-runtime/v1/runtime.test.mjs",
47
47
  "sha256": "e7b23ac3dde5588a0e175ec220a79426ea7dafd4953150f253dba50a75c8cb76"
48
48
  },
49
+ {
50
+ "path": "contracts/ugc/public-runtime/v1/static-room-runtime.test.mjs",
51
+ "sha256": "4c615ed0cc90fd0e21ea7882c9fecc921cd2ceca4beb6055d233cbad16d14367"
52
+ },
49
53
  {
50
54
  "path": "contracts/ugc/public-runtime/v1/target-compatibility.test.mjs",
51
55
  "sha256": "c85565b0c431d29d28561e4d3cc5a5de412cc0039a4aeb27a01374890216044d"
@@ -5,17 +5,33 @@
5
5
  {
6
6
  "schemaVersion": "1.0.0",
7
7
  "kind": "public-runtime-lock",
8
- "runtimeId": "runtime_4a09f5591bcfa0abd86333bbab99ebb3ac716c82a4373bd761109aa077b4652d",
9
- "runtimeHash": "sha256:4a09f5591bcfa0abd86333bbab99ebb3ac716c82a4373bd761109aa077b4652d",
8
+ "runtimeId": "runtime_4f2469adcb46d2ef001c0e1ae8015be6d4f7d8ac03f7d5d7ed39f9e7911b9be2",
9
+ "runtimeHash": "sha256:4f2469adcb46d2ef001c0e1ae8015be6d4f7d8ac03f7d5d7ed39f9e7911b9be2",
10
10
  "manifest": {
11
- "bytes": 154529,
12
- "sha256": "sha256:72fdb552bb37b7f55908256fcf75d08454bf8717548df4efd0473815e9e84c10",
13
- "url": "https://chrona.city/runtime-packages/runtime_4a09f5591bcfa0abd86333bbab99ebb3ac716c82a4373bd761109aa077b4652d/runtime-manifest.json"
11
+ "bytes": 61663,
12
+ "sha256": "sha256:37263ffe4831fafebe9b51b04d0b750e986b9802d1e63299e15a36fe0d9b5f4e",
13
+ "url": "https://chrona.city/runtime-packages/runtime_4f2469adcb46d2ef001c0e1ae8015be6d4f7d8ac03f7d5d7ed39f9e7911b9be2/runtime-manifest.json"
14
14
  },
15
15
  "archive": {
16
- "bytes": 12132520,
17
- "sha256": "sha256:ffc73a16275fe5e7c11fb373636c5f92f2c9439393b9d21a7f31f7130bb85423",
18
- "url": "https://chrona.city/runtime-packages/runtime_4a09f5591bcfa0abd86333bbab99ebb3ac716c82a4373bd761109aa077b4652d/runtime.zip"
16
+ "bytes": 7856027,
17
+ "sha256": "sha256:f7058294e15dc8d4d902f7ab40b87b5e6332cf6ad7e7b5a18b7d83f59f1e558f",
18
+ "url": "https://chrona.city/runtime-packages/runtime_4f2469adcb46d2ef001c0e1ae8015be6d4f7d8ac03f7d5d7ed39f9e7911b9be2/runtime.zip"
19
+ }
20
+ },
21
+ {
22
+ "schemaVersion": "1.0.0",
23
+ "kind": "public-runtime-lock",
24
+ "runtimeId": "runtime_cc65ab02c830bc1856c77001f0c081f97d75b981e8f5bfa1fe65e282b7e1302f",
25
+ "runtimeHash": "sha256:cc65ab02c830bc1856c77001f0c081f97d75b981e8f5bfa1fe65e282b7e1302f",
26
+ "manifest": {
27
+ "bytes": 159328,
28
+ "sha256": "sha256:7190830a14318c02ed4a7e9d70eb196b99f59ab3560efce126a6babdf6b008b5",
29
+ "url": "https://chrona.city/runtime-packages/runtime_cc65ab02c830bc1856c77001f0c081f97d75b981e8f5bfa1fe65e282b7e1302f/runtime-manifest.json"
30
+ },
31
+ "archive": {
32
+ "bytes": 12345177,
33
+ "sha256": "sha256:15ad0a19b414d04768bac7755f218dca72b17f9ecae1dcf60b8e4a0eaf7ffd71",
34
+ "url": "https://chrona.city/runtime-packages/runtime_cc65ab02c830bc1856c77001f0c081f97d75b981e8f5bfa1fe65e282b7e1302f/runtime.zip"
19
35
  }
20
36
  }
21
37
  ]