@chrona-city/ugc-kit 1.5.9 → 1.5.10
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 +79 -5
- package/contracts/ugc/public-runtime/v1/README.md +42 -5
- package/contracts/ugc/public-runtime/v1/manifest.mjs +35 -4
- package/contracts/ugc/public-runtime/v1/runtime-manifest.schema.json +126 -23
- 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 +43 -2
- package/lib/creator-cli.mjs +6 -4
- package/lib/creator-platform.mjs +2 -1
- package/lib/creator-toolchain-compat.mjs +3 -0
- package/lib/host-ipc/distribution-node-support-contract/contracts/ugc/public-runtime/v1/manifest.mjs +198 -0
- package/lib/host-ipc/distribution-node-support-contract/contracts/ugc/public-runtime/v1/runtime-manifest.schema.json +854 -0
- package/lib/host-ipc/distribution-node-support-contract/contracts/ugc/registry/v1/conformance/js/capability-resolver.mjs +191 -0
- package/lib/host-ipc/host-ipc.schema.json +2 -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 +1 -0
- package/lib/runtime-host.mjs +10 -3
- package/lib/runtime-install.mjs +1 -0
- 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 +8 -4
- package/runtime-catalog.json +8 -24
- /package/lib/host-ipc/{distribution-document-tool-package-contract → distribution-node-support-contract}/contracts/ugc/creator-source/v1/tool-package.schema.json +0 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
const SCHEMA_VERSION = '1.0.0';
|
|
2
|
+
const SUPPORTED_REGISTRY_MAJOR = 1;
|
|
3
|
+
const BUDGET_KEYS = [
|
|
4
|
+
'maxEntities',
|
|
5
|
+
'maxAssetBytes',
|
|
6
|
+
'maxServerTimeMsPerTick',
|
|
7
|
+
'maxStateBytesPerSecond',
|
|
8
|
+
'maxCapabilityCallsPerTick'
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
const issue = (code, path, message, repairHint, capability) => ({
|
|
12
|
+
code,
|
|
13
|
+
path,
|
|
14
|
+
message,
|
|
15
|
+
repairHint,
|
|
16
|
+
...(capability ? { capability } : {})
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const parseVersion = value => {
|
|
20
|
+
const match = /^(\^?)([0-9]+)\.([0-9]+)\.([0-9]+)$/.exec(value ?? '');
|
|
21
|
+
return match ? { caret: match[1] === '^', parts: match.slice(2).map(Number) } : null;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const compareVersions = (left, right) => {
|
|
25
|
+
const a = parseVersion(left).parts;
|
|
26
|
+
const b = parseVersion(right).parts;
|
|
27
|
+
for (let index = 0; index < 3; index += 1) if (a[index] !== b[index]) return a[index] - b[index];
|
|
28
|
+
return 0;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const satisfies = (version, range) => {
|
|
32
|
+
const exact = parseVersion(version);
|
|
33
|
+
const requested = parseVersion(range);
|
|
34
|
+
if (!exact || !requested || !requested.caret) return false;
|
|
35
|
+
return exact.parts[0] === requested.parts[0] && compareVersions(version, range.slice(1)) >= 0;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const sortedUnique = values => [...new Set(values)].sort();
|
|
39
|
+
const compareText = (left, right) => left < right ? -1 : left > right ? 1 : 0;
|
|
40
|
+
const isObject = value => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
41
|
+
|
|
42
|
+
const lockCapability = capability => ({
|
|
43
|
+
id: capability.id,
|
|
44
|
+
version: capability.version,
|
|
45
|
+
executionSides: sortedUnique(capability.executionSides),
|
|
46
|
+
authority: capability.authority,
|
|
47
|
+
allowedReads: sortedUnique(capability.allowedReads),
|
|
48
|
+
allowedWrites: sortedUnique(capability.allowedWrites),
|
|
49
|
+
determinism: capability.determinism,
|
|
50
|
+
predictionProfile: capability.predictionProfile,
|
|
51
|
+
replicationProfile: capability.replicationProfile,
|
|
52
|
+
persistenceScope: capability.persistenceScope,
|
|
53
|
+
securityTier: capability.securityTier,
|
|
54
|
+
limits: { ...capability.limits },
|
|
55
|
+
adapters: Object.fromEntries(Object.entries(capability.adapters).sort(([a], [b]) => compareText(a, b))),
|
|
56
|
+
conformanceSuite: sortedUnique(capability.conformanceSuite)
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const resolveProfile = (intent, policy) => policy.networkProfiles.find(candidate =>
|
|
60
|
+
Object.entries(candidate.match).every(([key, expected]) => intent[key] === expected)
|
|
61
|
+
)?.id ?? policy.defaultNetworkProfile;
|
|
62
|
+
|
|
63
|
+
const failed = (code, path, message, repairHint, capability) => ({
|
|
64
|
+
schemaVersion: SCHEMA_VERSION,
|
|
65
|
+
contractVersion: SCHEMA_VERSION,
|
|
66
|
+
status: 'failed',
|
|
67
|
+
valid: false,
|
|
68
|
+
errors: [issue(code, path, message, repairHint, capability)],
|
|
69
|
+
warnings: [],
|
|
70
|
+
sensitiveValuesRedacted: true
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
export function canonicalJson(value) {
|
|
74
|
+
if (Array.isArray(value)) return `[${value.map(canonicalJson).join(',')}]`;
|
|
75
|
+
if (value && typeof value === 'object') return `{${Object.keys(value).sort().map(key => `${JSON.stringify(key)}:${canonicalJson(value[key])}`).join(',')}}`;
|
|
76
|
+
return JSON.stringify(value);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const failedQuery = (registryVersion, code, path, message, repairHint) => ({
|
|
80
|
+
schemaVersion: SCHEMA_VERSION,
|
|
81
|
+
status: 'failed',
|
|
82
|
+
registryVersion: registryVersion ?? '1.0.0',
|
|
83
|
+
capabilities: [],
|
|
84
|
+
errors: [issue(code, path, message, repairHint)],
|
|
85
|
+
warnings: [],
|
|
86
|
+
sensitiveValuesRedacted: true
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
export function queryCapabilities({ registry, query }) {
|
|
90
|
+
if (!registry || !Array.isArray(registry.capabilities) || registry.schemaVersion !== SCHEMA_VERSION) {
|
|
91
|
+
return failedQuery(registry?.registryVersion, 'INVALID_CAPABILITY_REGISTRY', '$.registry', 'Capability Registry is invalid.', 'Use a published platform Registry.');
|
|
92
|
+
}
|
|
93
|
+
const allowedKeys = new Set(['schemaVersion', 'registryVersion', 'id', 'executionTier']);
|
|
94
|
+
const validId = query?.id === undefined || /^[a-z][a-z0-9.-]{2,127}$/.test(query.id);
|
|
95
|
+
const validTier = query?.executionTier === undefined || ['cosmetic', 'declarative', 'reviewed-gameplay', 'public-untrusted'].includes(query.executionTier);
|
|
96
|
+
if (!isObject(query) || query.schemaVersion !== SCHEMA_VERSION || Object.keys(query).some(key => !allowedKeys.has(key)) || !validId || !validTier) {
|
|
97
|
+
return failedQuery(registry.registryVersion, 'INVALID_CAPABILITY_QUERY', '$.query', 'Capability query is invalid.', 'Use the locked capability-query schema.');
|
|
98
|
+
}
|
|
99
|
+
if (query.registryVersion !== registry.registryVersion) {
|
|
100
|
+
return failedQuery(registry.registryVersion, 'REGISTRY_VERSION_INCOMPATIBLE', '$.query.registryVersion', 'Capability query and Registry versions differ.', 'Refresh the project contract lock and retry.');
|
|
101
|
+
}
|
|
102
|
+
const capabilities = [...registry.capabilities]
|
|
103
|
+
.filter(capability => capability.status === 'published' && capability.securityTier !== 'platform-internal')
|
|
104
|
+
.filter(capability => query.id === undefined || capability.id === query.id)
|
|
105
|
+
.filter(capability => query.executionTier === undefined || capability.allowedExecutionTiers.includes(query.executionTier))
|
|
106
|
+
.sort((left, right) => compareText(`${left.id}@${left.version}`, `${right.id}@${right.version}`))
|
|
107
|
+
.map(capability => structuredClone(capability));
|
|
108
|
+
return {
|
|
109
|
+
schemaVersion: SCHEMA_VERSION,
|
|
110
|
+
status: 'passed',
|
|
111
|
+
registryVersion: registry.registryVersion,
|
|
112
|
+
capabilities,
|
|
113
|
+
errors: [],
|
|
114
|
+
warnings: [],
|
|
115
|
+
sensitiveValuesRedacted: true
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export function resolveCapabilities({ manifest, registry, policy }) {
|
|
120
|
+
if (!registry || !Array.isArray(registry.capabilities) || registry.schemaVersion !== SCHEMA_VERSION) return failed('INVALID_CAPABILITY_REGISTRY', '$.registry', 'Capability Registry is invalid.', 'Use a published platform Registry.');
|
|
121
|
+
const registryVersion = parseVersion(registry.registryVersion);
|
|
122
|
+
if (!policy || registry.registryVersion !== policy.registryVersion || policy.schemaVersion !== SCHEMA_VERSION || !registryVersion || registryVersion.caret || registryVersion.parts[0] !== SUPPORTED_REGISTRY_MAJOR) return failed('REGISTRY_VERSION_INCOMPATIBLE', '$.registryVersion', 'Registry version is incompatible with this resolver or its resolution policy.', 'Upgrade through the platform-managed contract lock.');
|
|
123
|
+
|
|
124
|
+
const resolved = [];
|
|
125
|
+
const degraded = [];
|
|
126
|
+
for (const request of [...manifest.requestedCapabilities].sort((a, b) => compareText(a.id, b.id))) {
|
|
127
|
+
const candidates = registry.capabilities
|
|
128
|
+
.filter(capability => capability.id === request.id && capability.status === 'published' && satisfies(capability.version, request.version))
|
|
129
|
+
.sort((a, b) => compareVersions(b.version, a.version));
|
|
130
|
+
const capability = candidates.find(candidate => candidate.securityTier !== 'platform-internal' && candidate.allowedExecutionTiers.includes(manifest.executionTier));
|
|
131
|
+
if (!capability) {
|
|
132
|
+
if (request.required) {
|
|
133
|
+
if (candidates.length === 0) return {
|
|
134
|
+
schemaVersion: SCHEMA_VERSION,
|
|
135
|
+
status: 'needs_capability',
|
|
136
|
+
valid: false,
|
|
137
|
+
contractVersion: SCHEMA_VERSION,
|
|
138
|
+
requestedCapability: { ...request },
|
|
139
|
+
proposalPath: `content/proposals/${request.id}.json`,
|
|
140
|
+
errors: [issue('NEEDS_CAPABILITY', '$.requestedCapabilities', `Required capability ${request.id}@${request.version} is not published.`, 'Generate a Capability proposal and stop; do not emulate platform authority.', request.id)],
|
|
141
|
+
warnings: [],
|
|
142
|
+
sensitiveValuesRedacted: true
|
|
143
|
+
};
|
|
144
|
+
return failed('CAPABILITY_NOT_ALLOWED', '$.requestedCapabilities', `Capability ${request.id} is not allowed for ${manifest.executionTier}.`, 'Preserve required capabilities; request platform review for the intended execution tier. Do not remove requirements or edit locks to bypass this rejection.', request.id);
|
|
145
|
+
}
|
|
146
|
+
degraded.push({ id: request.id, requestedVersion: request.version, fallback: { ...request.fallback }, reason: candidates.length > 0 ? 'execution-tier-not-allowed' : 'not-published' });
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
resolved.push(lockCapability(capability));
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const cap = policy.budgetCaps[manifest.executionTier];
|
|
153
|
+
if (!cap) return failed('REGISTRY_VERSION_INCOMPATIBLE', '$.executionTier', 'No budget policy exists for the execution tier.', 'Use a tier published by the locked policy.');
|
|
154
|
+
const requested = Object.fromEntries(BUDGET_KEYS.map(key => [key, manifest.requestedBudgets[key]]));
|
|
155
|
+
const effective = Object.fromEntries(BUDGET_KEYS.map(key => [key, Math.min(requested[key], cap[key])]));
|
|
156
|
+
const decisions = BUDGET_KEYS.filter(key => effective[key] !== requested[key]).map(key => ({ key, requested: requested[key], effective: effective[key], reason: 'execution-tier-cap' }));
|
|
157
|
+
const components = [...manifest.networkIntents]
|
|
158
|
+
.sort((a, b) => compareText(a.component, b.component))
|
|
159
|
+
.map(intent => ({ component: intent.component, profile: resolveProfile(intent, policy), sourceIntent: { ...intent } }));
|
|
160
|
+
|
|
161
|
+
return {
|
|
162
|
+
schemaVersion: SCHEMA_VERSION,
|
|
163
|
+
contractVersion: SCHEMA_VERSION,
|
|
164
|
+
status: 'passed',
|
|
165
|
+
valid: true,
|
|
166
|
+
errors: [],
|
|
167
|
+
warnings: degraded.map(entry => issue('OPTIONAL_CAPABILITY_DEGRADED', '$.requestedCapabilities', `Optional capability ${entry.id} uses its declared fallback.`, 'Keep the fallback test passing or remove the optional request.', entry.id)),
|
|
168
|
+
sensitiveValuesRedacted: true,
|
|
169
|
+
capabilitiesLock: {
|
|
170
|
+
schemaVersion: SCHEMA_VERSION,
|
|
171
|
+
registryVersion: registry.registryVersion,
|
|
172
|
+
generatedBy: 'chrona-capability-resolver@1',
|
|
173
|
+
resolved,
|
|
174
|
+
degraded
|
|
175
|
+
},
|
|
176
|
+
effectiveBudgets: {
|
|
177
|
+
schemaVersion: SCHEMA_VERSION,
|
|
178
|
+
registryVersion: registry.registryVersion,
|
|
179
|
+
executionTier: manifest.executionTier,
|
|
180
|
+
requested,
|
|
181
|
+
effective,
|
|
182
|
+
decisions
|
|
183
|
+
},
|
|
184
|
+
networkProfileLock: {
|
|
185
|
+
schemaVersion: SCHEMA_VERSION,
|
|
186
|
+
registryVersion: registry.registryVersion,
|
|
187
|
+
generatedBy: 'chrona-network-intent-resolver@1',
|
|
188
|
+
components
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
}
|
|
@@ -57,39 +57,14 @@
|
|
|
57
57
|
"pattern": "^[A-Z][A-Z0-9_]{2,79}$"
|
|
58
58
|
},
|
|
59
59
|
"target": {
|
|
60
|
-
"
|
|
61
|
-
"additionalProperties": false,
|
|
62
|
-
"properties": {
|
|
63
|
-
"os": {
|
|
64
|
-
"type": "string",
|
|
65
|
-
"enum": [
|
|
66
|
-
"darwin",
|
|
67
|
-
"linux"
|
|
68
|
-
]
|
|
69
|
-
},
|
|
70
|
-
"arch": {
|
|
71
|
-
"type": "string",
|
|
72
|
-
"enum": [
|
|
73
|
-
"arm64",
|
|
74
|
-
"x64"
|
|
75
|
-
]
|
|
76
|
-
},
|
|
77
|
-
"nodeVersion": {
|
|
78
|
-
"const": "22.16.0"
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
"required": [
|
|
82
|
-
"os",
|
|
83
|
-
"arch",
|
|
84
|
-
"nodeVersion"
|
|
85
|
-
]
|
|
60
|
+
"$ref": "./distribution-node-support-contract/contracts/ugc/public-runtime/v1/runtime-manifest.schema.json#/$defs/observedTarget"
|
|
86
61
|
},
|
|
87
62
|
"tool": {
|
|
88
63
|
"type": "object",
|
|
89
64
|
"additionalProperties": false,
|
|
90
65
|
"properties": {
|
|
91
66
|
"packageName": {
|
|
92
|
-
"$ref": "./distribution-
|
|
67
|
+
"$ref": "./distribution-node-support-contract/contracts/ugc/creator-source/v1/tool-package.schema.json"
|
|
93
68
|
},
|
|
94
69
|
"packageVersion": {
|
|
95
70
|
"$ref": "#/$defs/version"
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import schema from './host-ipc.schema.json' with { type: 'json' }
|
|
2
|
-
import toolPackageSchema from './distribution-
|
|
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'
|
|
3
5
|
|
|
4
6
|
export const hostIpcSchema = schema
|
|
5
7
|
export const canonicalRuntimeJson = value => {
|
|
@@ -12,8 +14,9 @@ const plain = value => value && typeof value === 'object' && !Array.isArray(valu
|
|
|
12
14
|
&& [Object.prototype, null].includes(Object.getPrototypeOf(value))
|
|
13
15
|
function check(value, rule, field) {
|
|
14
16
|
const invalid = () => fail('RUNTIME_CONTRACT_INVALID', field)
|
|
15
|
-
if (rule.$ref) return check(value, rule.$ref === './distribution-
|
|
16
|
-
? toolPackageSchema :
|
|
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'
|
|
19
|
+
? runtimeSchema.$defs.observedTarget : schema.$defs[rule.$ref.slice(8)], field)
|
|
17
20
|
if (rule.oneOf) {
|
|
18
21
|
let matches = 0
|
|
19
22
|
for (const option of rule.oneOf) { try { check(value, option, field); matches++ } catch (error) { if (error.code !== 'RUNTIME_CONTRACT_INVALID') throw error } }
|
|
@@ -46,6 +49,7 @@ function check(value, rule, field) {
|
|
|
46
49
|
export function validateHostIpc(value, kind) {
|
|
47
50
|
if (!['request', 'response', 'event'].includes(kind)) fail('RUNTIME_IPC_KIND_INVALID')
|
|
48
51
|
check(value, schema.$defs[kind], '$')
|
|
52
|
+
if (kind === 'response' && value.ok && value.operation === 'inspect' && !validateRuntimeTarget(value.result.target)) fail('RUNTIME_CONTRACT_INVALID', '$.result.target')
|
|
49
53
|
if (Buffer.byteLength(canonicalRuntimeJson(value)) > 262144) fail('RUNTIME_IPC_TOO_LARGE')
|
|
50
54
|
const status = kind === 'event' ? value.status : value.ok && (value.operation === 'start' ? value.result.status
|
|
51
55
|
: ['status', 'stop'].includes(value.operation) ? value.result : undefined)
|
|
@@ -2,21 +2,33 @@
|
|
|
2
2
|
"schemaVersion": "1.0.0",
|
|
3
3
|
"source": {
|
|
4
4
|
"repository": "Alterverse-tech/chrona-clients",
|
|
5
|
-
"commitSha": "
|
|
5
|
+
"commitSha": "db6dacf7dc7cd607b555c0600547f21c3cb56fad",
|
|
6
6
|
"path": "tools/local-preview"
|
|
7
7
|
},
|
|
8
8
|
"artifacts": [
|
|
9
9
|
{
|
|
10
10
|
"path": "runtime-contract.mjs",
|
|
11
|
-
"sha256": "
|
|
11
|
+
"sha256": "486c38c95ec43ef49a0a612dd6c2a4d1abf142029ed43f94d79c395ddf0861b2"
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"path": "host-ipc.schema.json",
|
|
15
|
-
"sha256": "
|
|
15
|
+
"sha256": "2400e0d4a82d82efd5866f6a90867ddd1f77150935418e524cc840233e17baad"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
|
-
"path": "distribution-
|
|
18
|
+
"path": "distribution-node-support-contract/contracts/ugc/creator-source/v1/tool-package.schema.json",
|
|
19
19
|
"sha256": "b6af316222076800db26526cc2e75318513697405ae38b07ef40c57d36691a05"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"path": "distribution-node-support-contract/contracts/ugc/public-runtime/v1/manifest.mjs",
|
|
23
|
+
"sha256": "c721a8d42fa84c6f1506c99f11e2d8e3565dad4d6bcbf82189fb29ca622481fa"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"path": "distribution-node-support-contract/contracts/ugc/public-runtime/v1/runtime-manifest.schema.json",
|
|
27
|
+
"sha256": "2c442ed296781d1656556720ebc1b3d63eecdcb4173d5170765206d8c30b04da"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "distribution-node-support-contract/contracts/ugc/registry/v1/conformance/js/capability-resolver.mjs",
|
|
31
|
+
"sha256": "66e3be28c8b9da7fb4e814e6a9263fe276cb2456a8ac9d295c2e9d9d785ddafd"
|
|
20
32
|
}
|
|
21
33
|
]
|
|
22
34
|
}
|
|
@@ -54,17 +54,20 @@ export function selectPublicRuntime(catalog, runtimeId, options) {
|
|
|
54
54
|
export async function resolvePublicRuntime(catalog, { expected, cacheDirectory, signal, offline = false, allowLocalHttp = false, readManifest = readPinnedRuntimeManifest } = {}) {
|
|
55
55
|
catalog = validatePublicRuntimeCatalog(catalog, { allowLocalHttp });
|
|
56
56
|
const matches = [];
|
|
57
|
+
let contentMismatch = false;
|
|
57
58
|
for (const lock of catalog.entries) {
|
|
58
59
|
if (signal?.aborted) fail('LOCAL_DEVELOPMENT_CANCELLED');
|
|
59
60
|
const manifest = await readManifest({ lock, trustedLock: structuredClone(lock), cacheDirectory, signal, offline, allowLocalHttp });
|
|
60
61
|
try { verifyRuntimePair(manifest, lock, expected, { allowLocalHttp }); }
|
|
61
62
|
catch (error) {
|
|
62
|
-
if (
|
|
63
|
+
if (error.code === 'RUNTIME_TARGET_UNSUPPORTED') continue;
|
|
64
|
+
// The shared Reader checks target support before the content row.
|
|
65
|
+
if (error.code === 'RUNTIME_CONTENT_INCOMPATIBLE') { contentMismatch = true; continue; }
|
|
63
66
|
throw error;
|
|
64
67
|
}
|
|
65
68
|
matches.push(lock);
|
|
66
69
|
}
|
|
67
|
-
if (!matches.length) fail('RUNTIME_CONTENT_INCOMPATIBLE');
|
|
70
|
+
if (!matches.length) fail(contentMismatch ? 'RUNTIME_CONTENT_INCOMPATIBLE' : 'RUNTIME_TARGET_UNSUPPORTED');
|
|
68
71
|
if (matches.length !== 1) fail('RUNTIME_SELECTION_AMBIGUOUS');
|
|
69
72
|
return matches[0];
|
|
70
73
|
}
|
|
@@ -8,6 +8,7 @@ const deadlines = Object.freeze({ inspect: 5000, status: 5000, start: 30000, sto
|
|
|
8
8
|
// Only these existing contract/IPC reasons are public at this response boundary.
|
|
9
9
|
// The schema's uppercase-code pattern alone does not authorize arbitrary text.
|
|
10
10
|
export const runtimeHostRejectionCodes = Object.freeze(['RUNTIME_HOST_REJECTED', 'INVALID_RUNTIME_COMPATIBILITY',
|
|
11
|
+
'RUNTIME_TARGET_UNSUPPORTED', 'RUNTIME_CONTENT_INCOMPATIBLE',
|
|
11
12
|
'RUNTIME_CONTRACT_INVALID', 'RUNTIME_SCHEMA_INVALID', 'RUNTIME_IPC_IDENTITY_MISMATCH',
|
|
12
13
|
'RUNTIME_IPC_STATUS_INVALID', 'RUNTIME_IPC_KIND_INVALID', 'RUNTIME_IPC_TOO_LARGE']);
|
|
13
14
|
|
package/lib/runtime-host.mjs
CHANGED
|
@@ -15,9 +15,16 @@ export async function verifyHostIpcSnapshot() {
|
|
|
15
15
|
const lock = JSON.parse(await readFile(path.join(ipcRoot, 'source-lock.json')));
|
|
16
16
|
const legacy = ['runtime-contract.mjs', 'host-ipc.schema.json'];
|
|
17
17
|
const current = [...legacy, 'distribution-document-tool-package-contract/contracts/ugc/creator-source/v1/tool-package.schema.json'];
|
|
18
|
-
const
|
|
18
|
+
const support = [...legacy, ...[
|
|
19
|
+
'contracts/ugc/creator-source/v1/tool-package.schema.json',
|
|
20
|
+
'contracts/ugc/public-runtime/v1/manifest.mjs',
|
|
21
|
+
'contracts/ugc/public-runtime/v1/runtime-manifest.schema.json',
|
|
22
|
+
'contracts/ugc/registry/v1/conformance/js/capability-resolver.mjs'
|
|
23
|
+
].map(name => `distribution-node-support-contract/${name}`)];
|
|
24
|
+
const names = [legacy, current, support].find(names => Array.isArray(lock.artifacts)
|
|
25
|
+
&& JSON.stringify(lock.artifacts.map(row => row.path)) === JSON.stringify(names));
|
|
19
26
|
if (lock.schemaVersion !== '1.0.0' || lock.source?.repository !== 'Alterverse-tech/chrona-clients' || lock.source.path !== 'tools/local-preview'
|
|
20
|
-
|| !/^[a-f0-9]{40}$/.test(lock.source.commitSha ?? '') || !
|
|
27
|
+
|| !/^[a-f0-9]{40}$/.test(lock.source.commitSha ?? '') || !names) throw error('HOST_IPC_SNAPSHOT_MISMATCH');
|
|
21
28
|
const inventory = async (directory, prefix = '') => {
|
|
22
29
|
const rows = [];
|
|
23
30
|
for (const item of await readdir(directory, { withFileTypes: true })) {
|
|
@@ -28,7 +35,7 @@ export async function verifyHostIpcSnapshot() {
|
|
|
28
35
|
rows.push(...await inventory(path.join(directory, item.name), relative));
|
|
29
36
|
} else if (item.isFile()) rows.push(relative);
|
|
30
37
|
else throw error('HOST_IPC_SNAPSHOT_MISMATCH');
|
|
31
|
-
if (rows.length >
|
|
38
|
+
if (rows.length > names.length + 1) throw error('HOST_IPC_SNAPSHOT_MISMATCH');
|
|
32
39
|
}
|
|
33
40
|
return rows.sort();
|
|
34
41
|
};
|
package/lib/runtime-install.mjs
CHANGED
|
@@ -44,6 +44,7 @@ export async function verifyPublicRuntimeSnapshot() {
|
|
|
44
44
|
const base = 'contracts/ugc/public-runtime/v1';
|
|
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
|
+
if (lock.artifacts?.some(f => f.path === `${base}/target-compatibility.test.mjs`)) names.push('target-compatibility.test.mjs');
|
|
47
48
|
names.sort();
|
|
48
49
|
const dependency = 'contracts/ugc/creator-source/v1/tool-package.schema.json';
|
|
49
50
|
const manifestBytes = await readBounded(path.join(kit, base, 'manifest.mjs'), 1048576, { privateFile: false });
|
|
Binary file
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@esbuild/darwin-x64",
|
|
3
|
+
"version": "0.25.9",
|
|
4
|
+
"description": "The macOS 64-bit binary for esbuild, a JavaScript bundler.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/evanw/esbuild.git"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"preferUnplugged": true,
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=18"
|
|
13
|
+
},
|
|
14
|
+
"os": [
|
|
15
|
+
"darwin"
|
|
16
|
+
],
|
|
17
|
+
"cpu": [
|
|
18
|
+
"x64"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@esbuild/linux-x64",
|
|
3
|
+
"version": "0.25.9",
|
|
4
|
+
"description": "The Linux 64-bit binary for esbuild, a JavaScript bundler.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/evanw/esbuild.git"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"preferUnplugged": true,
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=18"
|
|
13
|
+
},
|
|
14
|
+
"os": [
|
|
15
|
+
"linux"
|
|
16
|
+
],
|
|
17
|
+
"cpu": [
|
|
18
|
+
"x64"
|
|
19
|
+
]
|
|
20
|
+
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"schemaVersion": "1.0.0",
|
|
3
3
|
"source": {
|
|
4
4
|
"repository": "ChronaWorld/chrona-services",
|
|
5
|
-
"commitSha": "
|
|
5
|
+
"commitSha": "49a782d34f7d4d49a3f8dc4979b2c1aefd641752",
|
|
6
6
|
"path": "contracts/ugc/public-runtime/v1"
|
|
7
7
|
},
|
|
8
8
|
"artifacts": [
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"path": "contracts/ugc/public-runtime/v1/README.md",
|
|
15
|
-
"sha256": "
|
|
15
|
+
"sha256": "806ae8c5e1e131d3ff112d168e6c010b6e897a8ad5e1e9816bd1d7b915de306b"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
"path": "contracts/ugc/public-runtime/v1/archive.mjs",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
"path": "contracts/ugc/public-runtime/v1/manifest.mjs",
|
|
35
|
-
"sha256": "
|
|
35
|
+
"sha256": "c721a8d42fa84c6f1506c99f11e2d8e3565dad4d6bcbf82189fb29ca622481fa"
|
|
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": "
|
|
43
|
+
"sha256": "2c442ed296781d1656556720ebc1b3d63eecdcb4173d5170765206d8c30b04da"
|
|
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/target-compatibility.test.mjs",
|
|
51
|
+
"sha256": "c85565b0c431d29d28561e4d3cc5a5de412cc0039a4aeb27a01374890216044d"
|
|
52
|
+
},
|
|
49
53
|
{
|
|
50
54
|
"path": "contracts/ugc/public-runtime/v1/vectors.json",
|
|
51
55
|
"sha256": "95541dcb497db59e3db1cc7f4798a670fd70039ca2a1161db52bcd4e3d3264f3"
|
package/runtime-catalog.json
CHANGED
|
@@ -5,33 +5,17 @@
|
|
|
5
5
|
{
|
|
6
6
|
"schemaVersion": "1.0.0",
|
|
7
7
|
"kind": "public-runtime-lock",
|
|
8
|
-
"runtimeId": "
|
|
9
|
-
"runtimeHash": "sha256:
|
|
8
|
+
"runtimeId": "runtime_4a09f5591bcfa0abd86333bbab99ebb3ac716c82a4373bd761109aa077b4652d",
|
|
9
|
+
"runtimeHash": "sha256:4a09f5591bcfa0abd86333bbab99ebb3ac716c82a4373bd761109aa077b4652d",
|
|
10
10
|
"manifest": {
|
|
11
|
-
"bytes":
|
|
12
|
-
"sha256": "sha256:
|
|
13
|
-
"url": "https://chrona.city/runtime-packages/
|
|
11
|
+
"bytes": 154529,
|
|
12
|
+
"sha256": "sha256:72fdb552bb37b7f55908256fcf75d08454bf8717548df4efd0473815e9e84c10",
|
|
13
|
+
"url": "https://chrona.city/runtime-packages/runtime_4a09f5591bcfa0abd86333bbab99ebb3ac716c82a4373bd761109aa077b4652d/runtime-manifest.json"
|
|
14
14
|
},
|
|
15
15
|
"archive": {
|
|
16
|
-
"bytes":
|
|
17
|
-
"sha256": "sha256:
|
|
18
|
-
"url": "https://chrona.city/runtime-packages/
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"schemaVersion": "1.0.0",
|
|
23
|
-
"kind": "public-runtime-lock",
|
|
24
|
-
"runtimeId": "runtime_c1f37145982f2691df6a390089690438ca500a462b2d11bb726ec37a8adf8b11",
|
|
25
|
-
"runtimeHash": "sha256:c1f37145982f2691df6a390089690438ca500a462b2d11bb726ec37a8adf8b11",
|
|
26
|
-
"manifest": {
|
|
27
|
-
"bytes": 151631,
|
|
28
|
-
"sha256": "sha256:765a0539bbe2ad20beabe45f5cfb412336a2d3937515a917f487a8be476230c4",
|
|
29
|
-
"url": "https://chrona.city/runtime-packages/runtime_c1f37145982f2691df6a390089690438ca500a462b2d11bb726ec37a8adf8b11/runtime-manifest.json"
|
|
30
|
-
},
|
|
31
|
-
"archive": {
|
|
32
|
-
"bytes": 12003119,
|
|
33
|
-
"sha256": "sha256:c7d7a6c4352c77425abaa8158ec2d3bfed25b6a9e8126c66c5ed4b224889199c",
|
|
34
|
-
"url": "https://chrona.city/runtime-packages/runtime_c1f37145982f2691df6a390089690438ca500a462b2d11bb726ec37a8adf8b11/runtime.zip"
|
|
16
|
+
"bytes": 12132520,
|
|
17
|
+
"sha256": "sha256:ffc73a16275fe5e7c11fb373636c5f92f2c9439393b9d21a7f31f7130bb85423",
|
|
18
|
+
"url": "https://chrona.city/runtime-packages/runtime_4a09f5591bcfa0abd86333bbab99ebb3ac716c82a4373bd761109aa077b4652d/runtime.zip"
|
|
35
19
|
}
|
|
36
20
|
}
|
|
37
21
|
]
|