@chrona-city/ugc-kit 1.5.9 → 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.
- package/README.md +95 -5
- package/contracts/ugc/public-runtime/v1/README.md +82 -5
- package/contracts/ugc/public-runtime/v1/archive.mjs +4 -3
- package/contracts/ugc/public-runtime/v1/manifest.mjs +56 -14
- package/contracts/ugc/public-runtime/v1/runtime-manifest.schema.json +186 -39
- package/contracts/ugc/public-runtime/v1/static-room-runtime.test.mjs +225 -0
- package/contracts/ugc/public-runtime/v1/target-compatibility.test.mjs +98 -0
- package/docs/harness-onboarding.md +55 -12
- package/docs/npm-creator.md +95 -12
- package/docs/runtime-download.md +87 -2
- package/lib/creator-cli.mjs +6 -4
- package/lib/creator-platform.mjs +2 -1
- package/lib/creator-toolchain-compat.mjs +9 -0
- package/lib/host-ipc/distribution-static-room-semantic-contract/contracts/ugc/public-runtime/v1/manifest.mjs +209 -0
- package/lib/host-ipc/distribution-static-room-semantic-contract/contracts/ugc/public-runtime/v1/runtime-manifest.schema.json +898 -0
- package/lib/host-ipc/distribution-static-room-semantic-contract/contracts/ugc/registry/v1/conformance/js/capability-resolver.mjs +191 -0
- package/lib/host-ipc/host-ipc.schema.json +18 -27
- package/lib/host-ipc/runtime-contract.mjs +7 -3
- package/lib/host-ipc/source-lock.json +16 -4
- package/lib/local-development.mjs +5 -2
- package/lib/runtime-host-client.mjs +11 -4
- package/lib/runtime-host.mjs +12 -3
- package/lib/runtime-install.mjs +12 -3
- package/node_modules/@esbuild/darwin-x64/README.md +3 -0
- package/node_modules/@esbuild/darwin-x64/bin/esbuild +0 -0
- package/node_modules/@esbuild/darwin-x64/package.json +20 -0
- package/node_modules/@esbuild/linux-x64/README.md +3 -0
- package/node_modules/@esbuild/linux-x64/bin/esbuild +0 -0
- package/node_modules/@esbuild/linux-x64/package.json +20 -0
- package/package.json +1 -1
- package/public-runtime.snapshot.lock.json +13 -5
- package/runtime-catalog.json +16 -16
- /package/lib/host-ipc/{distribution-document-tool-package-contract → distribution-static-room-semantic-contract}/contracts/ugc/creator-source/v1/tool-package.schema.json +0 -0
package/README.md
CHANGED
|
@@ -16,7 +16,63 @@ mirror through the original `init`/MCP and `dev/test` options. Only transport ch
|
|
|
16
16
|
package-pinned runtime bytes and compatibility checks remain enforced, with no
|
|
17
17
|
Testing fallback. See [runtime sources](docs/runtime-download.md#explicit-local-distribution-same-pinned-runtime-bytes).
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
## Creator entry
|
|
20
|
+
|
|
21
|
+
<!-- creator-entry:start -->
|
|
22
|
+
<!-- Generated by tools/creator-entry-docs.mjs from the existing release profiles. -->
|
|
23
|
+
Inside the intended work directory, use the Testing npm entry:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
npx @chrona-city/ugc-kit@testing init
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The selected package defaults to **https://chrona.city** and discovers
|
|
30
|
+
`/site-assets/chrona-kit-current.json`. Initialization still verifies the current and immutable
|
|
31
|
+
metadata, exact archive and caller. npm publication alone does not prove that
|
|
32
|
+
the platform's download aliases, current tool policy or ordinary user flow are ready.
|
|
33
|
+
|
|
34
|
+
| Release profile | Package identity | Default platform Origin |
|
|
35
|
+
| --- | --- | --- |
|
|
36
|
+
| city | `@chrona-city/ugc-kit` | https://chrona.city |
|
|
37
|
+
| world | `@chrona-world/ugc-kit` | https://chrona.world |
|
|
38
|
+
|
|
39
|
+
The world row describes a separate release profile, not a public rollout claim.
|
|
40
|
+
npm tags select package versions; they do not change an existing project's
|
|
41
|
+
platform, World, permissions or private authorization. Keep existing bindings.
|
|
42
|
+
Local initialization must explicitly select the registered loopback platform;
|
|
43
|
+
it never falls back to Testing. MCP uses the verified persistent executable,
|
|
44
|
+
not a mutable npm tag. Installing does not authorize, upload, preview or publish a work.
|
|
45
|
+
|
|
46
|
+
Both the website archive and npm entry must resolve to the same verified release
|
|
47
|
+
identity. A newer npm package does not silently replace an existing MCP executable,
|
|
48
|
+
project binding or authorization session. Check the actual registered executable
|
|
49
|
+
with `chrona version`, and inspect the saved session without changing it:
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
chrona auth-status --session-directory ABSOLUTE_PRIVATE_SESSION_DIRECTORY
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
For the city profile, the returned authorization Origin and the project's
|
|
56
|
+
authorization, submission, review and preview links must use https://chrona.city.
|
|
57
|
+
If an older registration or session still selects another Origin, preserve its
|
|
58
|
+
receipts and unknown operations. `--replace-from` only updates the same binding;
|
|
59
|
+
it does not migrate a session across Origins. Select the intended platform
|
|
60
|
+
explicitly, complete its official authorization yourself, then verify access to
|
|
61
|
+
the same project before writing. Do not edit session JSON, rewrite a project ID,
|
|
62
|
+
re-upload content or switch accounts to hide the mismatch. The installer never
|
|
63
|
+
performs these authorization or submission steps automatically.
|
|
64
|
+
|
|
65
|
+
Installation metadata lists verified installation targets, not every CPU binary
|
|
66
|
+
bundled in the archive. Its Node version records the build environment; Runtime
|
|
67
|
+
support must come from the trusted Runtime declaration and real execution.
|
|
68
|
+
<!-- creator-entry:end -->
|
|
69
|
+
|
|
70
|
+
See [Harness onboarding](docs/harness-onboarding.md) for Codex/Claude registration,
|
|
71
|
+
[the npm creator guide](docs/npm-creator.md) for the installed CLI and contribution
|
|
72
|
+
workflow, and [Meshy](docs/meshy.md) for optional local asset generation. Already
|
|
73
|
+
issued archives and Tags remain immutable. This source documentation correction
|
|
74
|
+
does not change the guides inside the published 1.5.9 archive. Historical package
|
|
75
|
+
identities remain valid historical identities, not instructions to rename projects.
|
|
20
76
|
|
|
21
77
|
Chrona UGC Kit provides versioned project conventions, validation tools, templates, and contract snapshots used by AI agents and creator harnesses to build content for Chrona.
|
|
22
78
|
|
|
@@ -25,9 +81,10 @@ The creator protocol is reviewed outside this repository first. Only an approved
|
|
|
25
81
|
Paired scene/compiler updates use the existing `tools/sync-local-content.mjs`
|
|
26
82
|
entry with a fixed Services commit and trusted compiler export. See
|
|
27
83
|
[snapshot sync](tools/snapshot-sync.md) for the exact command and failure boundaries.
|
|
28
|
-
The 1.5.3 internal candidate
|
|
29
|
-
9f984cbb scene-report identity.
|
|
30
|
-
|
|
84
|
+
The historical 1.5.3 internal candidate retained the a7cde603 tool snapshot and
|
|
85
|
+
9f984cbb scene-report identity. Current compatibility comes from the actual
|
|
86
|
+
installed tool/contracts and verified manifests, not those historical labels.
|
|
87
|
+
Select the explicitly registered local runtime
|
|
31
88
|
origin for local delivery; canonical HTTPS URLs do not prove Testing deployment.
|
|
32
89
|
Do not relabel any already distributed alpha archive. Installation, native
|
|
33
90
|
dependency execution, gameplay and platform publication remain separate checks.
|
|
@@ -36,7 +93,30 @@ This repository does not contain player projects or Chrona production credential
|
|
|
36
93
|
|
|
37
94
|
## Release verification
|
|
38
95
|
|
|
39
|
-
This
|
|
96
|
+
This section is for maintainers, not creator onboarding. The single-profile
|
|
97
|
+
examples below retain historical release arguments; they must not be replayed
|
|
98
|
+
to modify an issued version. City/world packaging selects the original
|
|
99
|
+
`--release-profile` and versioned `tools/release-profiles.json`; it does not create
|
|
100
|
+
environment-specific source Tags. Accepted versions are `M.m.p`, `M.m.p-alpha.N`
|
|
101
|
+
and `M.m.p-alpha.N.P`, with positive, non-zero-prefixed alpha numbers. The full
|
|
102
|
+
suffix remains part of every tool identity. Source `publishConfig.tag` validation
|
|
103
|
+
does not publish a package or select the npm dist-tag for an authorized operation.
|
|
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.
|
|
40
120
|
|
|
41
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.
|
|
42
122
|
|
|
@@ -65,6 +145,16 @@ Transfer the entire resulting directory and its reported `manifestSha256` throug
|
|
|
65
145
|
|
|
66
146
|
The export reports both `sourceSha` (the internal runtime producer) and, when present, `finalSourceSha` (the later committed catalog and final Kit package). They can differ without changing the paired runtime bytes; the final evidence must still pin the original pairing/catalog hashes and the final source's package lock. Downstream release-material Readers must validate that lineage rather than assume the two Git commits are identical. Do not edit either proof to satisfy a consumer's one-SHA check.
|
|
67
147
|
|
|
148
|
+
For city/world profiles, a fully verified shared Runtime proof can also serve a
|
|
149
|
+
successor creator-tool source when its original versioned execution closure,
|
|
150
|
+
dependency lock and tool/content identity remain unchanged. The original
|
|
151
|
+
Producer, archive, four execution reports and proof keep their identities; the
|
|
152
|
+
catalog Writer and final package each bind their own complete clean source.
|
|
153
|
+
Without that verified proof, the existing exact source checks still apply.
|
|
154
|
+
Dirty/late-changing source, altered execution files, dependency drift or a fake
|
|
155
|
+
proof are not an exemption. Two independently verified OS reports for the same
|
|
156
|
+
manifest and ZIP produce one catalog entry, not an ambiguous duplicate.
|
|
157
|
+
|
|
68
158
|
The current UGC v1 contract and Capability Registry snapshots are locked to an exact `chrona-services` commit. Verify both with:
|
|
69
159
|
|
|
70
160
|
```sh
|
|
@@ -50,11 +50,88 @@ 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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
+
|
|
93
|
+
`targets` has at most four declarations in canonical-JSON order. Historical
|
|
94
|
+
`{os,arch,nodeVersion:"22.16.0"}` rows retain exact matching, including the Node
|
|
95
|
+
patch and architecture; their bytes and identities are unchanged. They are not
|
|
96
|
+
reinterpreted as support for another Node or architecture.
|
|
97
|
+
|
|
98
|
+
A new declaration can explicitly separate supported Node lines from precise
|
|
99
|
+
execution observations:
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{"os":"linux","arch":"x64","nodeSupport":{"schemaVersion":"1.0.0","lines":[{"major":22,"minimum":"22.16.0"},{"major":24,"minimum":"24.1.0"}]}}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
This is a **shape example, not a verified support claim or catalog artifact**.
|
|
106
|
+
Only an actually validated publisher decision may add these rows to a real
|
|
107
|
+
manifest. `engines.node`, an execution machine's version, a schema acceptance
|
|
108
|
+
test, or portable-looking JS/WASM never creates support. The declaration is
|
|
109
|
+
included in the original Runtime hash, raw manifest pin and trusted lock; this
|
|
110
|
+
Reader does not add it to existing records or rewrite execution reports.
|
|
111
|
+
|
|
112
|
+
`nodeSupport` is exact `{schemaVersion,lines}` with version `1.0.0`. Each of
|
|
113
|
+
one to four lines is exact `{major,minimum}`; majors are positive safe integers
|
|
114
|
+
in strictly increasing order and minimum is a canonical stable `M.m.p` whose
|
|
115
|
+
major equals that line. It supports that major from the minimum onward, up to
|
|
116
|
+
but excluding the next major. No semver expressions, prereleases, automatic
|
|
117
|
+
future majors, OS/arch inference or Windows support. Unknown versions, mixed
|
|
118
|
+
exact/range keys, duplicates and malformed declarations refuse. The existing
|
|
119
|
+
manifest `schemaVersion` still selects static `1.0.0` or Document `1.1.0` content
|
|
120
|
+
layout; it does not select a Node policy.
|
|
121
|
+
|
|
122
|
+
`validateRuntimeTarget(target)` checks only actual observation format:
|
|
123
|
+
exact `{os,arch,nodeVersion}`, Darwin/Linux, arm64/x64 and a positive-major,
|
|
124
|
+
safe-integer stable Node version. `runtime-manifest.schema.json` exposes the
|
|
125
|
+
same shape as `$defs.observedTarget` for IPC transport; this is not a support
|
|
126
|
+
gate. `assertRuntimeTargetCompatibility(manifest,{target})` validates the full
|
|
127
|
+
manifest and applies its declaration. Omitted target uses actual process
|
|
128
|
+
values. It returns `true` or throws the existing `RUNTIME_TARGET_UNSUPPORTED`;
|
|
129
|
+
bad declarations use `INVALID_RUNTIME_COMPATIBILITY`, while manifest/identity
|
|
130
|
+
errors keep their original codes. Host inspect and installed verification must
|
|
131
|
+
use this one API instead of independently comparing `manifest.targets`.
|
|
132
|
+
`assertRuntimeCompatibility` delegates to it, then retains the complete original
|
|
133
|
+
content-row check (`RUNTIME_CONTENT_INCOMPATIBLE`). Precise target/report and
|
|
134
|
+
source/AA/cache proof identities remain precise observations, not range matches.
|
|
58
135
|
|
|
59
136
|
`compatibility` includes protocol 1/2, `content` rows and included
|
|
60
137
|
local-content validator/world/style policy files. Each of at most eight rows is
|
|
@@ -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'
|
|
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 =
|
|
19
|
-
|
|
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');
|
|
@@ -52,8 +53,34 @@ export const runtimeHashFromId = value => {
|
|
|
52
53
|
if (typeof value !== 'string' || !/^runtime_[a-f0-9]{64}$/.test(value)) fail('INVALID_RUNTIME_MANIFEST');
|
|
53
54
|
return `sha256:${value.slice(8)}`;
|
|
54
55
|
};
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
// Actual execution observations are exact versions. A support declaration is a
|
|
57
|
+
// separate, versioned manifest value; neither package engines nor a report
|
|
58
|
+
// silently widens it. Old string targets keep their original exact semantics.
|
|
59
|
+
const nodeVersion = v => {
|
|
60
|
+
if (typeof v !== 'string' || v.length > 48 || !/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$(?![\s\S])/.test(v)) return null;
|
|
61
|
+
const parts = v.split('.').map(Number);
|
|
62
|
+
return parts.every(Number.isSafeInteger) && parts[0] > 0 ? parts : null;
|
|
63
|
+
};
|
|
64
|
+
const targetPlatform = v => ['darwin', 'linux'].includes(v.os) && ['arm64', 'x64'].includes(v.arch);
|
|
65
|
+
export const validateRuntimeTarget = v => Boolean(exact(v, ['os', 'arch', 'nodeVersion']) && targetPlatform(v) && nodeVersion(v.nodeVersion));
|
|
66
|
+
const validTarget = v => {
|
|
67
|
+
if (exact(v, ['os', 'arch', 'nodeVersion'])) return validateRuntimeTarget(v) && v.nodeVersion === '22.16.0';
|
|
68
|
+
if (!exact(v, ['os', 'arch', 'nodeSupport']) || !targetPlatform(v)
|
|
69
|
+
|| !exact(v.nodeSupport, ['schemaVersion', 'lines']) || v.nodeSupport.schemaVersion !== '1.0.0'
|
|
70
|
+
|| !Array.isArray(v.nodeSupport.lines) || !v.nodeSupport.lines.length || v.nodeSupport.lines.length > 4) return false;
|
|
71
|
+
return v.nodeSupport.lines.every((line, i, lines) => exact(line, ['major', 'minimum'])
|
|
72
|
+
&& Number.isSafeInteger(line.major) && line.major > 0 && nodeVersion(line.minimum)?.[0] === line.major
|
|
73
|
+
&& (!i || line.major > lines[i - 1].major));
|
|
74
|
+
};
|
|
75
|
+
const targetMatches = (declared, actual) => {
|
|
76
|
+
if (Object.hasOwn(declared, 'nodeVersion')) return canonicalJson(declared) === canonicalJson(actual);
|
|
77
|
+
const observed = nodeVersion(actual.nodeVersion);
|
|
78
|
+
return declared.os === actual.os && declared.arch === actual.arch && declared.nodeSupport.lines.some(line => {
|
|
79
|
+
if (observed[0] !== line.major) return false;
|
|
80
|
+
const minimum = nodeVersion(line.minimum);
|
|
81
|
+
return observed[1] > minimum[1] || observed[1] === minimum[1] && observed[2] >= minimum[2];
|
|
82
|
+
});
|
|
83
|
+
};
|
|
57
84
|
// The Host IPC and Runtime compatibility use the same exact tuple definition.
|
|
58
85
|
// `document` is selected from the verified snapshot/runtime variant, not a
|
|
59
86
|
// claim made by the child. This validates format, not source approval or access.
|
|
@@ -75,12 +102,16 @@ export function validateRuntimeManifest(v) {
|
|
|
75
102
|
if (!exact(v, ['schemaVersion', 'kind', 'apiVersion', 'runtimeId', 'runtimeHash', 'executionTier', 'source', 'targets', 'compatibility', 'entrypoints', 'files', 'archive'])
|
|
76
103
|
|| !['1.0.0', '1.1.0'].includes(v.schemaVersion) || v.kind !== 'public-local-runtime' || v.apiVersion !== '1.0.0'
|
|
77
104
|
|| v.executionTier !== 'public-untrusted' || !/^runtime_[a-f0-9]{64}$/.test(v.runtimeId ?? '') || !digest(v.runtimeHash)) fail('INVALID_RUNTIME_MANIFEST');
|
|
78
|
-
validateRuntimeFiles(v.files, { document: v.schemaVersion === '1.1.0' });
|
|
79
105
|
const document = v.schemaVersion === '1.1.0';
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const
|
|
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'];
|
|
83
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;
|
|
84
115
|
for (const key of sourceKeys) {
|
|
85
116
|
const source = v.source[key];
|
|
86
117
|
if (!exact(source, ['commitSha', 'sourceHash', 'lockPath']) || !commit(source.commitSha) || !digest(source.sourceHash)
|
|
@@ -149,11 +180,22 @@ export function validateRuntimeLock(lock, trustedLock, { allowLocalHttp = false
|
|
|
149
180
|
return lock;
|
|
150
181
|
}
|
|
151
182
|
|
|
152
|
-
export function
|
|
183
|
+
export function assertRuntimeTargetCompatibility(manifest, { target = { os: process.platform, arch: process.arch, nodeVersion: process.versions.node } } = {}) {
|
|
153
184
|
validateRuntimeManifest(manifest);
|
|
154
|
-
if (!
|
|
185
|
+
if (!validateRuntimeTarget(target) || !manifest.targets.some(t => targetMatches(t, target))) fail('RUNTIME_TARGET_UNSUPPORTED');
|
|
186
|
+
return true;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export function assertRuntimeCompatibility(manifest, { target, expected } = {}) {
|
|
190
|
+
assertRuntimeTargetCompatibility(manifest, { target });
|
|
155
191
|
const row = { builderVersion: expected?.builderVersion, tool: expected?.tool, contracts: expected?.contracts };
|
|
156
|
-
|
|
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');
|
|
157
199
|
return true;
|
|
158
200
|
}
|
|
159
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
|
},
|
|
@@ -356,31 +376,13 @@
|
|
|
356
376
|
}
|
|
357
377
|
},
|
|
358
378
|
"target": {
|
|
359
|
-
"
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
"os": {
|
|
363
|
-
"type": "string",
|
|
364
|
-
"enum": [
|
|
365
|
-
"darwin",
|
|
366
|
-
"linux"
|
|
367
|
-
]
|
|
368
|
-
},
|
|
369
|
-
"arch": {
|
|
370
|
-
"type": "string",
|
|
371
|
-
"enum": [
|
|
372
|
-
"arm64",
|
|
373
|
-
"x64"
|
|
374
|
-
]
|
|
379
|
+
"oneOf": [
|
|
380
|
+
{
|
|
381
|
+
"$ref": "#/$defs/legacyTarget"
|
|
375
382
|
},
|
|
376
|
-
|
|
377
|
-
"
|
|
383
|
+
{
|
|
384
|
+
"$ref": "#/$defs/supportedTarget"
|
|
378
385
|
}
|
|
379
|
-
},
|
|
380
|
-
"required": [
|
|
381
|
-
"os",
|
|
382
|
-
"arch",
|
|
383
|
-
"nodeVersion"
|
|
384
386
|
]
|
|
385
387
|
},
|
|
386
388
|
"tool": {
|
|
@@ -532,6 +534,127 @@
|
|
|
532
534
|
"$ref": "#/$defs/documentContracts"
|
|
533
535
|
}
|
|
534
536
|
}
|
|
537
|
+
},
|
|
538
|
+
"legacyTarget": {
|
|
539
|
+
"type": "object",
|
|
540
|
+
"additionalProperties": false,
|
|
541
|
+
"properties": {
|
|
542
|
+
"os": {
|
|
543
|
+
"type": "string",
|
|
544
|
+
"enum": [
|
|
545
|
+
"darwin",
|
|
546
|
+
"linux"
|
|
547
|
+
]
|
|
548
|
+
},
|
|
549
|
+
"arch": {
|
|
550
|
+
"type": "string",
|
|
551
|
+
"enum": [
|
|
552
|
+
"arm64",
|
|
553
|
+
"x64"
|
|
554
|
+
]
|
|
555
|
+
},
|
|
556
|
+
"nodeVersion": {
|
|
557
|
+
"const": "22.16.0"
|
|
558
|
+
}
|
|
559
|
+
},
|
|
560
|
+
"required": [
|
|
561
|
+
"os",
|
|
562
|
+
"arch",
|
|
563
|
+
"nodeVersion"
|
|
564
|
+
]
|
|
565
|
+
},
|
|
566
|
+
"observedTarget": {
|
|
567
|
+
"type": "object",
|
|
568
|
+
"additionalProperties": false,
|
|
569
|
+
"properties": {
|
|
570
|
+
"os": {
|
|
571
|
+
"type": "string",
|
|
572
|
+
"enum": [
|
|
573
|
+
"darwin",
|
|
574
|
+
"linux"
|
|
575
|
+
]
|
|
576
|
+
},
|
|
577
|
+
"arch": {
|
|
578
|
+
"type": "string",
|
|
579
|
+
"enum": [
|
|
580
|
+
"arm64",
|
|
581
|
+
"x64"
|
|
582
|
+
]
|
|
583
|
+
},
|
|
584
|
+
"nodeVersion": {
|
|
585
|
+
"type": "string",
|
|
586
|
+
"maxLength": 48,
|
|
587
|
+
"pattern": "^[1-9][0-9]*\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$(?![\\s\\S])"
|
|
588
|
+
}
|
|
589
|
+
},
|
|
590
|
+
"required": [
|
|
591
|
+
"os",
|
|
592
|
+
"arch",
|
|
593
|
+
"nodeVersion"
|
|
594
|
+
]
|
|
595
|
+
},
|
|
596
|
+
"supportedTarget": {
|
|
597
|
+
"type": "object",
|
|
598
|
+
"additionalProperties": false,
|
|
599
|
+
"required": [
|
|
600
|
+
"os",
|
|
601
|
+
"arch",
|
|
602
|
+
"nodeSupport"
|
|
603
|
+
],
|
|
604
|
+
"properties": {
|
|
605
|
+
"os": {
|
|
606
|
+
"type": "string",
|
|
607
|
+
"enum": [
|
|
608
|
+
"darwin",
|
|
609
|
+
"linux"
|
|
610
|
+
]
|
|
611
|
+
},
|
|
612
|
+
"arch": {
|
|
613
|
+
"type": "string",
|
|
614
|
+
"enum": [
|
|
615
|
+
"arm64",
|
|
616
|
+
"x64"
|
|
617
|
+
]
|
|
618
|
+
},
|
|
619
|
+
"nodeSupport": {
|
|
620
|
+
"type": "object",
|
|
621
|
+
"additionalProperties": false,
|
|
622
|
+
"required": [
|
|
623
|
+
"schemaVersion",
|
|
624
|
+
"lines"
|
|
625
|
+
],
|
|
626
|
+
"properties": {
|
|
627
|
+
"schemaVersion": {
|
|
628
|
+
"const": "1.0.0"
|
|
629
|
+
},
|
|
630
|
+
"lines": {
|
|
631
|
+
"type": "array",
|
|
632
|
+
"minItems": 1,
|
|
633
|
+
"maxItems": 4,
|
|
634
|
+
"items": {
|
|
635
|
+
"type": "object",
|
|
636
|
+
"additionalProperties": false,
|
|
637
|
+
"required": [
|
|
638
|
+
"major",
|
|
639
|
+
"minimum"
|
|
640
|
+
],
|
|
641
|
+
"properties": {
|
|
642
|
+
"major": {
|
|
643
|
+
"type": "integer",
|
|
644
|
+
"minimum": 1,
|
|
645
|
+
"maximum": 9007199254740991
|
|
646
|
+
},
|
|
647
|
+
"minimum": {
|
|
648
|
+
"type": "string",
|
|
649
|
+
"maxLength": 48,
|
|
650
|
+
"pattern": "^[1-9][0-9]*\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$(?![\\s\\S])"
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
}
|
|
535
658
|
}
|
|
536
659
|
},
|
|
537
660
|
"allOf": [
|
|
@@ -546,24 +669,48 @@
|
|
|
546
669
|
"then": {
|
|
547
670
|
"properties": {
|
|
548
671
|
"source": {
|
|
549
|
-
"
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
"
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
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
|
+
}
|
|
562
692
|
},
|
|
563
|
-
|
|
564
|
-
"
|
|
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
|
+
}
|
|
565
712
|
}
|
|
566
|
-
|
|
713
|
+
]
|
|
567
714
|
},
|
|
568
715
|
"compatibility": {
|
|
569
716
|
"type": "object",
|