@helix3/helix-cli 0.1.15-helix3.230 → 0.1.15-helix3.232
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/dist/continuum/homeScenePackage.d.ts +159 -0
- package/dist/continuum/homeScenePackage.js +267 -0
- package/dist/continuum/homeScenePackage.js.map +1 -0
- package/dist/continuum/homeScenePackageCommand.d.ts +44 -0
- package/dist/continuum/homeScenePackageCommand.js +107 -0
- package/dist/continuum/homeScenePackageCommand.js.map +1 -0
- package/dist/continuum/index.d.ts +1 -0
- package/dist/continuum/index.js +1 -0
- package/dist/continuum/index.js.map +1 -1
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/plugins/beamng-vehicle/bin/__pycache__/beamng_abs.cpython-312.pyc +0 -0
- package/plugins/beamng-vehicle/bin/__pycache__/beamng_expression.cpython-312.pyc +0 -0
- package/plugins/beamng-vehicle/bin/__pycache__/beamng_jbeam.cpython-312.pyc +0 -0
- package/plugins/beamng-vehicle/bin/__pycache__/beamng_materials.cpython-312.pyc +0 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import type { ContinuumObjectReference, ContinuumPackageVersion } from '@hypersoniclabs/helix-manifest';
|
|
2
|
+
export type HomeShellSceneResource = {
|
|
3
|
+
id: string;
|
|
4
|
+
kind: string;
|
|
5
|
+
source: {
|
|
6
|
+
kind: string;
|
|
7
|
+
uri?: string;
|
|
8
|
+
};
|
|
9
|
+
integrity: {
|
|
10
|
+
sha256: string;
|
|
11
|
+
};
|
|
12
|
+
bytes?: number;
|
|
13
|
+
mimeType: string;
|
|
14
|
+
};
|
|
15
|
+
export type HomeShellSceneDocument = {
|
|
16
|
+
format: string;
|
|
17
|
+
version: number;
|
|
18
|
+
id: string;
|
|
19
|
+
revision: string;
|
|
20
|
+
integrity: {
|
|
21
|
+
sha256: string;
|
|
22
|
+
};
|
|
23
|
+
profiles?: Record<string, {
|
|
24
|
+
kind?: string;
|
|
25
|
+
}>;
|
|
26
|
+
resources?: HomeShellSceneResource[];
|
|
27
|
+
collision?: {
|
|
28
|
+
sets?: unknown[];
|
|
29
|
+
};
|
|
30
|
+
lights?: unknown[];
|
|
31
|
+
mounts?: unknown[];
|
|
32
|
+
materials?: unknown[];
|
|
33
|
+
};
|
|
34
|
+
export type HomeShellItem = {
|
|
35
|
+
id: string;
|
|
36
|
+
slug: string;
|
|
37
|
+
title: string;
|
|
38
|
+
kind: string;
|
|
39
|
+
tags?: string[];
|
|
40
|
+
/** The Package this Item already resolves to, if it has one. */
|
|
41
|
+
continuumPackagePin?: {
|
|
42
|
+
packageId: string;
|
|
43
|
+
version?: string;
|
|
44
|
+
manifestCid?: string;
|
|
45
|
+
} | null;
|
|
46
|
+
};
|
|
47
|
+
export type HomeScenePackageObject = {
|
|
48
|
+
reference: ContinuumObjectReference;
|
|
49
|
+
source: {
|
|
50
|
+
kind: 'file';
|
|
51
|
+
path: string;
|
|
52
|
+
audience: 'public';
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export type HomeScenePackageDescriptor = {
|
|
56
|
+
projectId: string;
|
|
57
|
+
package: {
|
|
58
|
+
schema: 'helix.continuum.package/1';
|
|
59
|
+
id: string;
|
|
60
|
+
type: 'scene';
|
|
61
|
+
name: string;
|
|
62
|
+
};
|
|
63
|
+
packagePublication: {
|
|
64
|
+
slug: string;
|
|
65
|
+
visibility: 'public' | 'private';
|
|
66
|
+
};
|
|
67
|
+
packageVersion: ContinuumPackageVersion;
|
|
68
|
+
universalItemPin: {
|
|
69
|
+
itemId: string;
|
|
70
|
+
promoteToPublished?: true;
|
|
71
|
+
};
|
|
72
|
+
objects: HomeScenePackageObject[];
|
|
73
|
+
listings: Array<{
|
|
74
|
+
listing: Record<string, unknown>;
|
|
75
|
+
}>;
|
|
76
|
+
};
|
|
77
|
+
export type DerivedHomeScenePackage = {
|
|
78
|
+
descriptor: HomeScenePackageDescriptor;
|
|
79
|
+
/** Bundle-relative paths the caller must write beside the descriptor. */
|
|
80
|
+
files: Array<{
|
|
81
|
+
path: string;
|
|
82
|
+
sha256: string;
|
|
83
|
+
}>;
|
|
84
|
+
/**
|
|
85
|
+
* Whether another creator could mount this Scene into their own map. A mount
|
|
86
|
+
* selects a profile and the resolver requires that profile to be `world`-kind,
|
|
87
|
+
* so a Home that declares only a `home` profile is discoverable and buyable
|
|
88
|
+
* but not embeddable.
|
|
89
|
+
*/
|
|
90
|
+
mountable: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Resources the Scene pins from somewhere other than its own bundle (a Vault
|
|
93
|
+
* sky, say). They are deliberately NOT in the Package closure: the Package
|
|
94
|
+
* owns the bytes it ships, and claiming bytes it does not ship would make the
|
|
95
|
+
* closure a lie.
|
|
96
|
+
*/
|
|
97
|
+
externalResources: Array<{
|
|
98
|
+
id: string;
|
|
99
|
+
kind: string;
|
|
100
|
+
source: string;
|
|
101
|
+
}>;
|
|
102
|
+
};
|
|
103
|
+
export type HomeShellResourceBytes = {
|
|
104
|
+
/** Bundle-relative URI, exactly as the Scene document pins it. */
|
|
105
|
+
uri: string;
|
|
106
|
+
bytes: Uint8Array;
|
|
107
|
+
};
|
|
108
|
+
/** Deterministic UUIDv5-shaped identity over a HELIX-owned namespace string. */
|
|
109
|
+
export declare function deterministicContinuumUuidFromNamespace(namespace: string): string;
|
|
110
|
+
/**
|
|
111
|
+
* The Package, Vault Listing and Marketplace Listing identities a given Home
|
|
112
|
+
* Shell owns. Deriving them from the Item id rather than minting them makes the
|
|
113
|
+
* whole promotion idempotent: re-running it reconciles the same rows instead of
|
|
114
|
+
* creating a second Package for the same house.
|
|
115
|
+
*/
|
|
116
|
+
export declare function homeScenePackageIdentity(itemId: string): {
|
|
117
|
+
packageId: string;
|
|
118
|
+
vaultListingId: string;
|
|
119
|
+
marketplaceListingId: string;
|
|
120
|
+
};
|
|
121
|
+
export type DeriveHomeScenePackageInput = {
|
|
122
|
+
item: HomeShellItem;
|
|
123
|
+
/** The published Scene document, byte for byte as the CDN serves it. */
|
|
124
|
+
sceneBytes: Uint8Array;
|
|
125
|
+
/** Every bundle resource the Scene document pins, already fetched. */
|
|
126
|
+
resources: HomeShellResourceBytes[];
|
|
127
|
+
version?: string;
|
|
128
|
+
packageSlug?: string;
|
|
129
|
+
tags?: string[];
|
|
130
|
+
/**
|
|
131
|
+
* Publish into an EXISTING Package rather than the one derived from the Item.
|
|
132
|
+
* Needed for a Home whose Scene Package was minted before this path existed —
|
|
133
|
+
* without it a second run would create a second Package for the same house.
|
|
134
|
+
*/
|
|
135
|
+
packageId?: string;
|
|
136
|
+
/** Publish the Item alongside the pin. Omitted leaves the Item's status alone. */
|
|
137
|
+
promoteToPublished?: boolean;
|
|
138
|
+
};
|
|
139
|
+
export declare function deriveHomeScenePackage(input: DeriveHomeScenePackageInput): DerivedHomeScenePackage;
|
|
140
|
+
/**
|
|
141
|
+
* Where a Home Shell's Scene v2 bundle lives.
|
|
142
|
+
*
|
|
143
|
+
* The `home-shell` asset's `cdnUrl` is whichever rendition the compiler wrote as
|
|
144
|
+
* the entry point: `scene.helix-scene.json` for a natively published Scene v2
|
|
145
|
+
* package, and the legacy `world.json` rollback rendition for a shell compiled
|
|
146
|
+
* from GLB. Only `metadata.bundle` names the canonical Scene v2 bundle in both
|
|
147
|
+
* cases, so resolve through it first — reading the cdnUrl alone reports a
|
|
148
|
+
* perfectly Scene-backed Home as legacy.
|
|
149
|
+
*/
|
|
150
|
+
export declare function homeShellSceneBundleRoot(asset: {
|
|
151
|
+
cdnUrl?: string | null;
|
|
152
|
+
metadata?: {
|
|
153
|
+
bundle?: {
|
|
154
|
+
format?: string;
|
|
155
|
+
version?: number;
|
|
156
|
+
baseUrl?: string;
|
|
157
|
+
} | null;
|
|
158
|
+
} | null;
|
|
159
|
+
}): string | null;
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deterministicContinuumUuidFromNamespace = deterministicContinuumUuidFromNamespace;
|
|
4
|
+
exports.homeScenePackageIdentity = homeScenePackageIdentity;
|
|
5
|
+
exports.deriveHomeScenePackage = deriveHomeScenePackage;
|
|
6
|
+
exports.homeShellSceneBundleRoot = homeShellSceneBundleRoot;
|
|
7
|
+
const node_crypto_1 = require("node:crypto");
|
|
8
|
+
/**
|
|
9
|
+
* Derive a Continuum Scene Package from a Home Shell that is already published.
|
|
10
|
+
*
|
|
11
|
+
* A Home is not a Continuum concept — helix-manifest says so in as many words:
|
|
12
|
+
* "A Home is a `home` profile plus residence-owned instance state; it is not a
|
|
13
|
+
* separate rendering format." What a published Home Shell actually is, on both
|
|
14
|
+
* publication lanes, is an immutable HELIX Scene v2 document plus the bytes it
|
|
15
|
+
* pins, sitting in a content-addressed CDN bundle beside a `universal_items`
|
|
16
|
+
* row. `application/vnd.helix.scene+json;version=2` is one of the two Scene
|
|
17
|
+
* document media types a Continuum Scene Package may root on, so those exact
|
|
18
|
+
* bytes ALREADY satisfy the Scene Package contract. Nothing has to be rebuilt,
|
|
19
|
+
* re-exported or re-encoded: this derives the Package identity around bytes the
|
|
20
|
+
* runtime already downloads.
|
|
21
|
+
*
|
|
22
|
+
* Why that matters, and why it is a derivation rather than a new publish:
|
|
23
|
+
* - A Vault Listing can only target a Package (`CHK_continuum_listings_target`
|
|
24
|
+
* is a database CHECK, not a convention), so a Home with no Package can
|
|
25
|
+
* never appear on Vault however it is published.
|
|
26
|
+
* - Marketplace commerce for a Home Shell runs through the Continuum pin
|
|
27
|
+
* eligibility predicate, which admits `kind = 'home_shell'` against a
|
|
28
|
+
* `type = 'scene'` Package.
|
|
29
|
+
* - Scenes nest. A Scene v2 document pins children through `mounts[]`, so the
|
|
30
|
+
* same Package another creator finds on Vault is the one they can mount
|
|
31
|
+
* into their own map — but only through a `world`-kind profile, which is
|
|
32
|
+
* why `mountable` is reported rather than assumed.
|
|
33
|
+
*
|
|
34
|
+
* Every CID here is the sha256 of bytes the caller fetched and verified against
|
|
35
|
+
* the Scene document's own pins. A descriptor this function produces is never
|
|
36
|
+
* a claim about content; it is a restatement of content that already exists.
|
|
37
|
+
*/
|
|
38
|
+
const SCENE_V2_MEDIA_TYPE = 'application/vnd.helix.scene+json;version=2';
|
|
39
|
+
/** Continuum object roles for the Scene v2 resource kinds a Home Shell uses. */
|
|
40
|
+
const ROLE_BY_RESOURCE_KIND = Object.freeze({
|
|
41
|
+
model: 'scene-mesh',
|
|
42
|
+
collider: 'collision-mesh',
|
|
43
|
+
texture: 'scene-texture',
|
|
44
|
+
environment: 'sky-definition',
|
|
45
|
+
'component-data': 'scene-component-data',
|
|
46
|
+
});
|
|
47
|
+
/**
|
|
48
|
+
* Which role survives when one file is pinned under several resource kinds. A
|
|
49
|
+
* Home compiled from GLB reuses each render mesh as its own collider, so its
|
|
50
|
+
* forty resources are twenty files; Continuum objects are content-addressed and
|
|
51
|
+
* carry each CID exactly once, and the render role is the truthful one.
|
|
52
|
+
*/
|
|
53
|
+
const ROLE_PRECEDENCE = Object.freeze({
|
|
54
|
+
'scene-mesh': 0,
|
|
55
|
+
'scene-texture': 1,
|
|
56
|
+
'scene-component-data': 2,
|
|
57
|
+
'sky-definition': 3,
|
|
58
|
+
'collision-mesh': 4,
|
|
59
|
+
});
|
|
60
|
+
/** Deterministic UUIDv5-shaped identity over a HELIX-owned namespace string. */
|
|
61
|
+
function deterministicContinuumUuidFromNamespace(namespace) {
|
|
62
|
+
const bytes = (0, node_crypto_1.createHash)('sha256').update(namespace).digest().subarray(0, 16);
|
|
63
|
+
bytes[6] = (bytes[6] & 0x0f) | 0x50;
|
|
64
|
+
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
|
65
|
+
const hex = bytes.toString('hex');
|
|
66
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The Package, Vault Listing and Marketplace Listing identities a given Home
|
|
70
|
+
* Shell owns. Deriving them from the Item id rather than minting them makes the
|
|
71
|
+
* whole promotion idempotent: re-running it reconciles the same rows instead of
|
|
72
|
+
* creating a second Package for the same house.
|
|
73
|
+
*/
|
|
74
|
+
function homeScenePackageIdentity(itemId) {
|
|
75
|
+
return {
|
|
76
|
+
packageId: deterministicContinuumUuidFromNamespace(`helix.continuum.home-shell-scene-package:${itemId}`),
|
|
77
|
+
vaultListingId: deterministicContinuumUuidFromNamespace(`helix.continuum.home-shell-vault-listing:${itemId}`),
|
|
78
|
+
marketplaceListingId: deterministicContinuumUuidFromNamespace(`helix.continuum.home-shell-marketplace-listing:${itemId}`),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function sha256Hex(bytes) {
|
|
82
|
+
return (0, node_crypto_1.createHash)('sha256').update(bytes).digest('hex');
|
|
83
|
+
}
|
|
84
|
+
function deriveHomeScenePackage(input) {
|
|
85
|
+
const { item, sceneBytes } = input;
|
|
86
|
+
if (item.kind !== 'home_shell') {
|
|
87
|
+
throw new TypeError(`Universal Item ${item.id} is kind "${item.kind}", not "home_shell"`);
|
|
88
|
+
}
|
|
89
|
+
const scene = JSON.parse(Buffer.from(sceneBytes).toString('utf8'));
|
|
90
|
+
if (scene.format !== 'helix.scene' || scene.version !== 2) {
|
|
91
|
+
throw new TypeError(`Home Shell ${item.id} does not publish a HELIX Scene v2 document; only a Scene-backed shell can become a Scene Package`);
|
|
92
|
+
}
|
|
93
|
+
// Material bindings would have to become declared Package dependencies, and
|
|
94
|
+
// the Scene document names materials by binding id, not by Package Version —
|
|
95
|
+
// there is no honest way to derive the reference. Refuse rather than seal a
|
|
96
|
+
// Package whose declared closure omits what it actually needs. Both shipped
|
|
97
|
+
// Homes bind materials into their meshes and declare none here.
|
|
98
|
+
if ((scene.materials ?? []).length > 0) {
|
|
99
|
+
throw new TypeError(`Home Shell ${item.id} declares ${(scene.materials ?? []).length} Scene material binding(s); deriving their Package dependencies is not supported yet`);
|
|
100
|
+
}
|
|
101
|
+
const byUri = new Map(input.resources.map((resource) => [resource.uri, resource.bytes]));
|
|
102
|
+
const sceneResources = scene.resources ?? [];
|
|
103
|
+
const bundled = sceneResources.filter((resource) => resource.source.kind === 'bundle');
|
|
104
|
+
const externalResources = sceneResources
|
|
105
|
+
.filter((resource) => resource.source.kind !== 'bundle')
|
|
106
|
+
.map((resource) => ({ id: resource.id, kind: resource.kind, source: resource.source.kind }));
|
|
107
|
+
const byCid = new Map();
|
|
108
|
+
for (const resource of bundled) {
|
|
109
|
+
const uri = resource.source.uri;
|
|
110
|
+
if (!uri)
|
|
111
|
+
throw new TypeError(`Scene resource ${resource.id} is bundled but pins no uri`);
|
|
112
|
+
const bytes = byUri.get(uri);
|
|
113
|
+
if (!bytes)
|
|
114
|
+
throw new TypeError(`Scene resource ${uri} was not fetched`);
|
|
115
|
+
const digest = sha256Hex(bytes);
|
|
116
|
+
// The Scene document's own pin is the authority. If the bytes on the CDN no
|
|
117
|
+
// longer match it, the Package must not be minted around them.
|
|
118
|
+
if (digest !== resource.integrity.sha256) {
|
|
119
|
+
throw new TypeError(`Scene resource ${uri} does not match the Scene document's pin`);
|
|
120
|
+
}
|
|
121
|
+
if (resource.bytes !== undefined && resource.bytes !== bytes.byteLength) {
|
|
122
|
+
throw new TypeError(`Scene resource ${uri} is ${bytes.byteLength} bytes, pinned as ${resource.bytes}`);
|
|
123
|
+
}
|
|
124
|
+
const cid = `cid:sha256:${digest}`;
|
|
125
|
+
const role = ROLE_BY_RESOURCE_KIND[resource.kind] ?? `scene-${resource.kind}`;
|
|
126
|
+
const existing = byCid.get(cid);
|
|
127
|
+
if (existing) {
|
|
128
|
+
const rank = ROLE_PRECEDENCE[role] ?? Number.MAX_SAFE_INTEGER;
|
|
129
|
+
const held = ROLE_PRECEDENCE[existing.reference.role] ?? Number.MAX_SAFE_INTEGER;
|
|
130
|
+
if (rank < held)
|
|
131
|
+
existing.reference.role = role;
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
byCid.set(cid, {
|
|
135
|
+
reference: {
|
|
136
|
+
cid: cid,
|
|
137
|
+
bytes: bytes.byteLength,
|
|
138
|
+
mediaType: resource.mimeType,
|
|
139
|
+
role,
|
|
140
|
+
},
|
|
141
|
+
source: { kind: 'file', path: uri, audience: 'public' },
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
// Scene-owned objects are canonically ordered by CID.
|
|
145
|
+
const objects = [...byCid.values()].sort((a, b) => a.reference.cid.localeCompare(b.reference.cid));
|
|
146
|
+
const root = {
|
|
147
|
+
cid: `cid:sha256:${sha256Hex(sceneBytes)}`,
|
|
148
|
+
bytes: sceneBytes.byteLength,
|
|
149
|
+
mediaType: SCENE_V2_MEDIA_TYPE,
|
|
150
|
+
role: 'scene-document',
|
|
151
|
+
};
|
|
152
|
+
const provides = ['helix.scene-mesh/1', 'helix.scene-spawn/1'];
|
|
153
|
+
if (scene.collision?.sets?.length)
|
|
154
|
+
provides.push('helix.scene-collision/1');
|
|
155
|
+
if (scene.lights?.length)
|
|
156
|
+
provides.push('lighting.punctual/1');
|
|
157
|
+
const derivedIdentity = homeScenePackageIdentity(item.id);
|
|
158
|
+
const existingPackageId = item.continuumPackagePin?.packageId ?? null;
|
|
159
|
+
const packageId = input.packageId ?? existingPackageId ?? derivedIdentity.packageId;
|
|
160
|
+
// A Home that already resolves to a Package must keep resolving to THAT
|
|
161
|
+
// Package. Minting a second Scene Package for the same house would split its
|
|
162
|
+
// version history, and buyers already hold instances against the first one.
|
|
163
|
+
if (input.packageId && existingPackageId && input.packageId !== existingPackageId) {
|
|
164
|
+
throw new TypeError(`Home Shell ${item.id} is already pinned to Package ${existingPackageId}; refusing to publish into ${input.packageId}`);
|
|
165
|
+
}
|
|
166
|
+
const identity = { ...derivedIdentity, packageId };
|
|
167
|
+
const packageSlug = input.packageSlug ?? `${item.slug}-scene`;
|
|
168
|
+
const tags = input.tags ?? item.tags ?? [];
|
|
169
|
+
const mountable = Object.values(scene.profiles ?? {}).some((profile) => profile?.kind === 'world');
|
|
170
|
+
const packageVersion = {
|
|
171
|
+
schema: 'helix.continuum.package-version/1',
|
|
172
|
+
package: { id: identity.packageId, type: 'scene' },
|
|
173
|
+
version: input.version ?? '1.0.0',
|
|
174
|
+
root,
|
|
175
|
+
dependencies: [],
|
|
176
|
+
variants: [],
|
|
177
|
+
compatibility: { contract: 'helix.scene/2', requires: [], provides },
|
|
178
|
+
provenance: {
|
|
179
|
+
kind: 'imported',
|
|
180
|
+
source: `HELIX Home Shell ${item.slug}`,
|
|
181
|
+
sourceId: scene.integrity.sha256,
|
|
182
|
+
},
|
|
183
|
+
expectedClosure: {
|
|
184
|
+
objectCount: objects.length + 1,
|
|
185
|
+
totalBytes: objects.reduce((sum, object) => sum + object.reference.bytes, 0) + root.bytes,
|
|
186
|
+
},
|
|
187
|
+
scene: {
|
|
188
|
+
document: root,
|
|
189
|
+
objects: objects.map((object) => object.reference),
|
|
190
|
+
children: [],
|
|
191
|
+
},
|
|
192
|
+
};
|
|
193
|
+
const listing = (id, surface) => ({
|
|
194
|
+
listing: {
|
|
195
|
+
schema: 'helix.continuum.listing/1',
|
|
196
|
+
id,
|
|
197
|
+
surface,
|
|
198
|
+
target: surface === 'vault'
|
|
199
|
+
? { type: 'package', packageId: identity.packageId }
|
|
200
|
+
: { type: 'universal-item', universalItemId: item.id },
|
|
201
|
+
visibility: 'public',
|
|
202
|
+
title: item.title,
|
|
203
|
+
tags,
|
|
204
|
+
},
|
|
205
|
+
});
|
|
206
|
+
return {
|
|
207
|
+
descriptor: {
|
|
208
|
+
projectId: `helix.home-shell.${item.slug}.scene`,
|
|
209
|
+
package: {
|
|
210
|
+
schema: 'helix.continuum.package/1',
|
|
211
|
+
id: identity.packageId,
|
|
212
|
+
type: 'scene',
|
|
213
|
+
name: item.title,
|
|
214
|
+
},
|
|
215
|
+
packagePublication: { slug: packageSlug, visibility: 'public' },
|
|
216
|
+
packageVersion,
|
|
217
|
+
universalItemPin: {
|
|
218
|
+
itemId: item.id,
|
|
219
|
+
...(input.promoteToPublished ? { promoteToPublished: true } : {}),
|
|
220
|
+
},
|
|
221
|
+
objects: [
|
|
222
|
+
{ reference: root, source: { kind: 'file', path: 'scene.helix-scene.json', audience: 'public' } },
|
|
223
|
+
...objects,
|
|
224
|
+
],
|
|
225
|
+
// Both surfaces, because a Home needs both and they are different rows:
|
|
226
|
+
// the Vault Listing makes the Package findable and mountable by other
|
|
227
|
+
// creators, the Marketplace Listing is the visibility gate the commerce
|
|
228
|
+
// eligibility predicate requires once the Item carries a Package pin.
|
|
229
|
+
// Creating only the first is what silently un-sells a Home.
|
|
230
|
+
listings: [
|
|
231
|
+
listing(identity.vaultListingId, 'vault'),
|
|
232
|
+
listing(identity.marketplaceListingId, 'marketplace'),
|
|
233
|
+
],
|
|
234
|
+
},
|
|
235
|
+
files: [
|
|
236
|
+
{ path: 'scene.helix-scene.json', sha256: sha256Hex(sceneBytes) },
|
|
237
|
+
...objects.map((object) => ({
|
|
238
|
+
path: object.source.path,
|
|
239
|
+
sha256: object.reference.cid.slice('cid:sha256:'.length),
|
|
240
|
+
})),
|
|
241
|
+
],
|
|
242
|
+
mountable,
|
|
243
|
+
externalResources,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Where a Home Shell's Scene v2 bundle lives.
|
|
248
|
+
*
|
|
249
|
+
* The `home-shell` asset's `cdnUrl` is whichever rendition the compiler wrote as
|
|
250
|
+
* the entry point: `scene.helix-scene.json` for a natively published Scene v2
|
|
251
|
+
* package, and the legacy `world.json` rollback rendition for a shell compiled
|
|
252
|
+
* from GLB. Only `metadata.bundle` names the canonical Scene v2 bundle in both
|
|
253
|
+
* cases, so resolve through it first — reading the cdnUrl alone reports a
|
|
254
|
+
* perfectly Scene-backed Home as legacy.
|
|
255
|
+
*/
|
|
256
|
+
function homeShellSceneBundleRoot(asset) {
|
|
257
|
+
const bundle = asset.metadata?.bundle;
|
|
258
|
+
if (bundle?.format === 'helix.scene' && bundle.version === 2 && bundle.baseUrl) {
|
|
259
|
+
return bundle.baseUrl.replace(/\/+$/, '');
|
|
260
|
+
}
|
|
261
|
+
const cdnUrl = asset.cdnUrl ?? '';
|
|
262
|
+
if (cdnUrl.endsWith('/scene.helix-scene.json')) {
|
|
263
|
+
return cdnUrl.slice(0, cdnUrl.lastIndexOf('/'));
|
|
264
|
+
}
|
|
265
|
+
return null;
|
|
266
|
+
}
|
|
267
|
+
//# sourceMappingURL=homeScenePackage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"homeScenePackage.js","sourceRoot":"","sources":["../../src/continuum/homeScenePackage.ts"],"names":[],"mappings":";;AAyIA,0FAMC;AAQD,4DAgBC;AAyBD,wDAmLC;AAYD,4DAaC;AA5YD,6CAAyC;AAMzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,MAAM,mBAAmB,GAAG,4CAA4C,CAAC;AAEzE,gFAAgF;AAChF,MAAM,qBAAqB,GAAqC,MAAM,CAAC,MAAM,CAAC;IAC5E,KAAK,EAAE,YAAY;IACnB,QAAQ,EAAE,gBAAgB;IAC1B,OAAO,EAAE,eAAe;IACxB,WAAW,EAAE,gBAAgB;IAC7B,gBAAgB,EAAE,sBAAsB;CACzC,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,eAAe,GAAqC,MAAM,CAAC,MAAM,CAAC;IACtE,YAAY,EAAE,CAAC;IACf,eAAe,EAAE,CAAC;IAClB,sBAAsB,EAAE,CAAC;IACzB,gBAAgB,EAAE,CAAC;IACnB,gBAAgB,EAAE,CAAC;CACpB,CAAC,CAAC;AA4EH,gFAAgF;AAChF,SAAgB,uCAAuC,CAAC,SAAiB;IACvE,MAAM,KAAK,GAAG,IAAA,wBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,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CAAC,KAGxC;IACC,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC;IACtC,IAAI,MAAM,EAAE,MAAM,KAAK,aAAa,IAAI,MAAM,CAAC,OAAO,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QAC/E,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC5C,CAAC;IACD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC;IAClC,IAAI,MAAM,CAAC,QAAQ,CAAC,yBAAyB,CAAC,EAAE,CAAC;QAC/C,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import type { CliCredentials } from '../config';
|
|
3
|
+
import { type HomeShellItem } from './homeScenePackage';
|
|
4
|
+
type HomeShellAsset = {
|
|
5
|
+
rendition?: string | null;
|
|
6
|
+
cdnUrl?: string | null;
|
|
7
|
+
metadata?: {
|
|
8
|
+
bundle?: {
|
|
9
|
+
format?: string;
|
|
10
|
+
version?: number;
|
|
11
|
+
baseUrl?: string;
|
|
12
|
+
} | null;
|
|
13
|
+
} | null;
|
|
14
|
+
};
|
|
15
|
+
export interface HomeScenePackageDependencies {
|
|
16
|
+
requireAuth(): CliCredentials;
|
|
17
|
+
/** `GET /api/v1/universal-items/:id`, unwrapped to the item record. */
|
|
18
|
+
readUniversalItem(credentials: CliCredentials, itemId: string): Promise<HomeShellItem & {
|
|
19
|
+
assets?: HomeShellAsset[];
|
|
20
|
+
}>;
|
|
21
|
+
/** Fetch published bytes by absolute URL. */
|
|
22
|
+
readPublishedBytes(url: string): Promise<Uint8Array>;
|
|
23
|
+
/** Write a descriptor-relative file, creating parent directories. */
|
|
24
|
+
writeFile(directory: string, relativePath: string, bytes: Uint8Array): Promise<void>;
|
|
25
|
+
printJson(value: unknown): void;
|
|
26
|
+
fail(message: string): never;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* `helix continuum home-scene-package <itemId> --out <dir>`
|
|
30
|
+
*
|
|
31
|
+
* Emit the Continuum publication descriptor for a Home Shell that is already
|
|
32
|
+
* published, together with the exact bytes it roots on, so that
|
|
33
|
+
* `helix continuum publish-package` can seal the Scene Package, create its
|
|
34
|
+
* public Vault and Marketplace Listings and pin it onto the Item — in one
|
|
35
|
+
* resumable, exact-ID publication.
|
|
36
|
+
*
|
|
37
|
+
* This is deliberately two commands rather than one. The descriptor is a plain
|
|
38
|
+
* file a creator can read, diff and keep as the record of what was published,
|
|
39
|
+
* and `publish-package` is the single audited door every other Package goes
|
|
40
|
+
* through. Nothing here is Home-specific except knowing where a Home Shell
|
|
41
|
+
* keeps its Scene document.
|
|
42
|
+
*/
|
|
43
|
+
export declare function registerContinuumHomeScenePackageCommand(continuum: Command, dependencies: HomeScenePackageDependencies): void;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerContinuumHomeScenePackageCommand = registerContinuumHomeScenePackageCommand;
|
|
4
|
+
const homeScenePackage_1 = require("./homeScenePackage");
|
|
5
|
+
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
6
|
+
const SEMVER = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
|
|
7
|
+
/**
|
|
8
|
+
* `helix continuum home-scene-package <itemId> --out <dir>`
|
|
9
|
+
*
|
|
10
|
+
* Emit the Continuum publication descriptor for a Home Shell that is already
|
|
11
|
+
* published, together with the exact bytes it roots on, so that
|
|
12
|
+
* `helix continuum publish-package` can seal the Scene Package, create its
|
|
13
|
+
* public Vault and Marketplace Listings and pin it onto the Item — in one
|
|
14
|
+
* resumable, exact-ID publication.
|
|
15
|
+
*
|
|
16
|
+
* This is deliberately two commands rather than one. The descriptor is a plain
|
|
17
|
+
* file a creator can read, diff and keep as the record of what was published,
|
|
18
|
+
* and `publish-package` is the single audited door every other Package goes
|
|
19
|
+
* through. Nothing here is Home-specific except knowing where a Home Shell
|
|
20
|
+
* keeps its Scene document.
|
|
21
|
+
*/
|
|
22
|
+
function registerContinuumHomeScenePackageCommand(continuum, dependencies) {
|
|
23
|
+
continuum
|
|
24
|
+
.command('home-scene-package')
|
|
25
|
+
.description('Derive the Scene Package publication descriptor for a published Home Shell (Vault + Marketplace + Item pin)')
|
|
26
|
+
.argument('<itemId>', 'the published Home Shell Universal Item')
|
|
27
|
+
.requiredOption('--out <dir>', 'directory to write the descriptor and its objects into')
|
|
28
|
+
.option('--package-version <semver>', 'Package Version to publish (default 1.0.0)')
|
|
29
|
+
.option('--slug <slug>', 'Package slug (default <item slug>-scene)')
|
|
30
|
+
.option('--package-id <uuid>', 'publish into an existing Package instead of the derived one')
|
|
31
|
+
.option('--tags <tags>', 'comma-separated Listing tags (default the Item tags)')
|
|
32
|
+
.option('--promote-to-published', 'publish the Universal Item alongside the pin')
|
|
33
|
+
.action(async (itemId, options) => {
|
|
34
|
+
try {
|
|
35
|
+
if (!UUID.test(itemId))
|
|
36
|
+
throw new TypeError('item id must be a UUID');
|
|
37
|
+
if (options.packageVersion && !SEMVER.test(options.packageVersion)) {
|
|
38
|
+
throw new TypeError('--package-version must be a semantic version');
|
|
39
|
+
}
|
|
40
|
+
if (options.packageId && !UUID.test(options.packageId)) {
|
|
41
|
+
throw new TypeError('--package-id must be a UUID');
|
|
42
|
+
}
|
|
43
|
+
const credentials = dependencies.requireAuth();
|
|
44
|
+
const item = await dependencies.readUniversalItem(credentials, itemId);
|
|
45
|
+
const asset = (item.assets ?? []).find((candidate) => (candidate.rendition ?? '').toLowerCase() === 'home-shell');
|
|
46
|
+
if (!asset) {
|
|
47
|
+
throw new TypeError(`Home Shell ${itemId} has no published home-shell asset`);
|
|
48
|
+
}
|
|
49
|
+
const bundleRoot = (0, homeScenePackage_1.homeShellSceneBundleRoot)(asset);
|
|
50
|
+
if (!bundleRoot) {
|
|
51
|
+
throw new TypeError(`Home Shell ${itemId} publishes no HELIX Scene v2 bundle; only a Scene-backed shell can become a Scene Package`);
|
|
52
|
+
}
|
|
53
|
+
const sceneBytes = await dependencies.readPublishedBytes(`${bundleRoot}/scene.helix-scene.json`);
|
|
54
|
+
const scene = JSON.parse(Buffer.from(sceneBytes).toString('utf8'));
|
|
55
|
+
const resources = [];
|
|
56
|
+
for (const resource of scene.resources ?? []) {
|
|
57
|
+
if (resource.source.kind !== 'bundle' || !resource.source.uri)
|
|
58
|
+
continue;
|
|
59
|
+
resources.push({
|
|
60
|
+
uri: resource.source.uri,
|
|
61
|
+
bytes: await dependencies.readPublishedBytes(`${bundleRoot}/${resource.source.uri}`),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
const derived = (0, homeScenePackage_1.deriveHomeScenePackage)({
|
|
65
|
+
item,
|
|
66
|
+
sceneBytes,
|
|
67
|
+
resources,
|
|
68
|
+
version: options.packageVersion,
|
|
69
|
+
packageSlug: options.slug,
|
|
70
|
+
packageId: options.packageId,
|
|
71
|
+
tags: options.tags
|
|
72
|
+
? options.tags.split(',').map((tag) => tag.trim()).filter(Boolean)
|
|
73
|
+
: undefined,
|
|
74
|
+
promoteToPublished: options.promoteToPublished === true,
|
|
75
|
+
});
|
|
76
|
+
await dependencies.writeFile(options.out, 'scene.helix-scene.json', sceneBytes);
|
|
77
|
+
for (const resource of resources) {
|
|
78
|
+
await dependencies.writeFile(options.out, resource.uri, resource.bytes);
|
|
79
|
+
}
|
|
80
|
+
await dependencies.writeFile(options.out, 'continuum-publication.json', Buffer.from(`${JSON.stringify(derived.descriptor, null, 2)}\n`, 'utf8'));
|
|
81
|
+
dependencies.printJson({
|
|
82
|
+
contract: 'helix.creator.home-scene-package/1',
|
|
83
|
+
itemId,
|
|
84
|
+
itemSlug: item.slug,
|
|
85
|
+
packageId: derived.descriptor.package.id,
|
|
86
|
+
packageSlug: derived.descriptor.packagePublication.slug,
|
|
87
|
+
packageVersion: derived.descriptor.packageVersion.version,
|
|
88
|
+
sceneId: scene.id,
|
|
89
|
+
sceneRevision: scene.revision,
|
|
90
|
+
objectCount: derived.descriptor.packageVersion.expectedClosure.objectCount,
|
|
91
|
+
totalBytes: derived.descriptor.packageVersion.expectedClosure.totalBytes,
|
|
92
|
+
// A Home that declares only a `home` profile is discoverable and
|
|
93
|
+
// buyable but cannot be mounted into someone else's map, because a
|
|
94
|
+
// mount resolves against a `world`-kind profile. Say so here rather
|
|
95
|
+
// than letting the creator find out at mount time.
|
|
96
|
+
mountable: derived.mountable,
|
|
97
|
+
externalResources: derived.externalResources,
|
|
98
|
+
descriptor: 'continuum-publication.json',
|
|
99
|
+
next: `helix continuum publish-package ${options.out}/continuum-publication.json --confirm-public-listing`,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
dependencies.fail(`✖ ${error instanceof Error ? error.message : String(error)}`);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=homeScenePackageCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"homeScenePackageCommand.js","sourceRoot":"","sources":["../../src/continuum/homeScenePackageCommand.ts"],"names":[],"mappings":";;AAiDA,4FAkHC;AAjKD,yDAM4B;AAE5B,MAAM,IAAI,GAAG,iEAAiE,CAAC;AAC/E,MAAM,MAAM,GAAG,mFAAmF,CAAC;AAuBnG;;;;;;;;;;;;;;GAcG;AACH,SAAgB,wCAAwC,CACtD,SAAkB,EAClB,YAA0C;IAE1C,SAAS;SAC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ACxE,iEAAiE;gBACjE,mEAAmE;gBACnE,oEAAoE;gBACpE,mDAAmD;gBACnD,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;gBAC5C,UAAU,EAAE,4BAA4B;gBACxC,IAAI,EAAE,mCAAmC,OAAO,CAAC,GAAG,sDAAsD;aAC3G,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,YAAY,CAAC,IAAI,CAAC,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACnF,CAAC;IACH,CAAC,CACF,CAAC;AACN,CAAC"}
|
package/dist/continuum/index.js
CHANGED
|
@@ -18,6 +18,7 @@ __exportStar(require("./authoring"), exports);
|
|
|
18
18
|
__exportStar(require("./characterMigrationGenerator"), exports);
|
|
19
19
|
__exportStar(require("./client"), exports);
|
|
20
20
|
__exportStar(require("./cli"), exports);
|
|
21
|
+
__exportStar(require("./homeScenePackage"), exports);
|
|
21
22
|
__exportStar(require("./identity"), exports);
|
|
22
23
|
__exportStar(require("./pull"), exports);
|
|
23
24
|
__exportStar(require("./sourceBundle"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/continuum/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,gEAA8C;AAC9C,2CAAyB;AACzB,wCAAsB;AACtB,6CAA2B;AAC3B,yCAAuB;AACvB,iDAA+B;AAC/B,0CAAwB;AACxB,0CAAwB;AACxB,6CAA2B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/continuum/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,gEAA8C;AAC9C,2CAAyB;AACzB,wCAAsB;AACtB,qDAAmC;AACnC,6CAA2B;AAC3B,yCAAuB;AACvB,iDAA+B;AAC/B,0CAAwB;AACxB,0CAAwB;AACxB,6CAA2B"}
|