@hypersoniclabs/helix-cli 0.1.27-helix3.694 → 0.1.27-helix3.696
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/device.d.ts +1 -1
- package/dist/device.js +86 -0
- package/dist/device.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/device.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ export declare const DEVICE_COMPONENT_TYPES: readonly ["slider", "clockHands", "
|
|
|
42
42
|
* `repeat`, `stopAudio`) — their absence from the examples is why the gap went
|
|
43
43
|
* unnoticed for so long.
|
|
44
44
|
*/
|
|
45
|
-
export declare const DEVICE_GRAPH_STEP_KINDS: readonly ["setState", "toggleState", "moveNode", "rotateNode", "playAudio", "stopAudio", "setVfx", "attachCharacter", "playCharacterAnimation", "releaseCharacter", "enterCharacterSpot", "reachCharacterHand", "releaseCharacterHand", "attachItem", "releaseItem", "emitSignal", "branch", "sequence", "delay", "repeat"];
|
|
45
|
+
export declare const DEVICE_GRAPH_STEP_KINDS: readonly ["setState", "toggleState", "moveNode", "rotateNode", "playAudio", "stopAudio", "setVfx", "attachCharacter", "playCharacterAnimation", "releaseCharacter", "enterCharacterSpot", "relocateCharacter", "requestTravel", "reachCharacterHand", "releaseCharacterHand", "attachItem", "releaseItem", "emitSignal", "branch", "sequence", "delay", "repeat"];
|
|
46
46
|
/**
|
|
47
47
|
* The closed CHARACTER socket set an `attachItem` step may target.
|
|
48
48
|
*
|
package/dist/device.js
CHANGED
|
@@ -121,6 +121,8 @@ exports.DEVICE_GRAPH_STEP_KINDS = [
|
|
|
121
121
|
'playCharacterAnimation',
|
|
122
122
|
'releaseCharacter',
|
|
123
123
|
'enterCharacterSpot',
|
|
124
|
+
'relocateCharacter',
|
|
125
|
+
'requestTravel',
|
|
124
126
|
'reachCharacterHand',
|
|
125
127
|
'releaseCharacterHand',
|
|
126
128
|
'attachItem',
|
|
@@ -279,12 +281,69 @@ function isNumberTriple(value) {
|
|
|
279
281
|
value.length === 3 &&
|
|
280
282
|
value.every((part) => typeof part === 'number' && !Number.isNaN(part)));
|
|
281
283
|
}
|
|
284
|
+
/**
|
|
285
|
+
* R138-TOWER: the two travel target shapes the platform lists: a Parallel City title (1..15000) or a named portal (`pc-portal:<slug>`).
|
|
286
|
+
* Mirrors the engine's `DeviceTravel.ts`; the id is only a key, the shell's allowlist decides what it is.
|
|
287
|
+
*/
|
|
288
|
+
const DEVICE_TRAVEL_TITLE_PATTERN = /^parallel-city:([1-9][0-9]{0,4})$/;
|
|
289
|
+
const DEVICE_TRAVEL_PORTAL_PATTERN = /^pc-portal:[a-z][a-z0-9-]{0,31}$/;
|
|
290
|
+
const DEVICE_TRAVEL_MAX_TITLE = 15_000;
|
|
291
|
+
const DEVICE_TRAVEL_TARGET_RULE = `parallel-city:<1..${DEVICE_TRAVEL_MAX_TITLE}> or pc-portal:<slug>`;
|
|
282
292
|
function isFiniteNumber(value) {
|
|
283
293
|
return typeof value === 'number' && Number.isFinite(value);
|
|
284
294
|
}
|
|
285
295
|
function isNonEmptyName(value) {
|
|
286
296
|
return typeof value === 'string' && value.trim().length > 0;
|
|
287
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* R137 `carries` on a slider: the load volume of a deck that carries a parked car.
|
|
300
|
+
* `boxM` is in the Device root frame at offset 0; finite, min < max on every axis, at most 12 x 6 x 12 m.
|
|
301
|
+
* y sliders only; `blockedKey` must be a declared boolean state key. Mirrors the backend/room validators
|
|
302
|
+
* (the room honours the same descriptor only after the backend places it as `placements[].carry`).
|
|
303
|
+
*/
|
|
304
|
+
const DEVICE_CARRY_MAX_BOX_M = [12, 6, 12];
|
|
305
|
+
function validateSliderCarries(component, label, state, errors) {
|
|
306
|
+
const path = `${label} carries`;
|
|
307
|
+
if (component.axis !== 'y') {
|
|
308
|
+
errors.push(`${path} is only valid on a y-axis slider`);
|
|
309
|
+
}
|
|
310
|
+
const raw = component.carries;
|
|
311
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
|
|
312
|
+
errors.push(`${path} must be an object { boxM, blockedKey? }`);
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
const carries = object(raw);
|
|
316
|
+
for (const key of Object.keys(carries)) {
|
|
317
|
+
if (key !== 'boxM' && key !== 'blockedKey')
|
|
318
|
+
errors.push(`${path}: unknown field "${key}"`);
|
|
319
|
+
}
|
|
320
|
+
const box = object(carries.boxM);
|
|
321
|
+
const vec = (v) => Array.isArray(v) && v.length === 3 && v.every(isFiniteNumber)
|
|
322
|
+
? v
|
|
323
|
+
: null;
|
|
324
|
+
const min = vec(box.min);
|
|
325
|
+
const max = vec(box.max);
|
|
326
|
+
if (!min || !max) {
|
|
327
|
+
errors.push(`${path}.boxM must be { min: [x,y,z], max: [x,y,z] } with finite numbers`);
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
const axes = ['x', 'y', 'z'];
|
|
331
|
+
for (let i = 0; i < 3; i += 1) {
|
|
332
|
+
if (!(min[i] < max[i]))
|
|
333
|
+
errors.push(`${path}.boxM.min.${axes[i]} must be below max.${axes[i]}`);
|
|
334
|
+
else if (max[i] - min[i] > DEVICE_CARRY_MAX_BOX_M[i])
|
|
335
|
+
errors.push(`${path}.boxM is ${(max[i] - min[i]).toFixed(2)} m on ${axes[i]}; the cap is ${DEVICE_CARRY_MAX_BOX_M.join(' x ')} m`);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
if (carries.blockedKey !== undefined) {
|
|
339
|
+
if (!isNonEmptyName(carries.blockedKey)) {
|
|
340
|
+
errors.push(`${path}.blockedKey must be a non-empty state key`);
|
|
341
|
+
}
|
|
342
|
+
else if (object(state[carries.blockedKey]).type !== 'boolean') {
|
|
343
|
+
errors.push(`${path}.blockedKey "${carries.blockedKey}" must be a declared boolean state key`);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
288
347
|
/** A node reference resolved through `model.nodeBindings`, as the host does. */
|
|
289
348
|
function graphNode(context, raw, path) {
|
|
290
349
|
const semantic = String(raw ?? '');
|
|
@@ -606,6 +665,30 @@ function validateGraphSteps(steps, context, path, depth) {
|
|
|
606
665
|
context.usage.animation = true;
|
|
607
666
|
return;
|
|
608
667
|
}
|
|
668
|
+
case 'relocateCharacter': {
|
|
669
|
+
// R138-TOWER: a socket of THIS Device (its own sealed pose), from a press only. Mirrors the engine `DeviceValidate`/`DeviceTravel`.
|
|
670
|
+
context.usage.animation = true;
|
|
671
|
+
requireName('to');
|
|
672
|
+
if (isNonEmptyName(step.to) && !context.sockets.has(String(step.to)))
|
|
673
|
+
context.errors.push(`graph: unknown relocateCharacter socket "${String(step.to)}"`);
|
|
674
|
+
if (context.trigger !== 'interact')
|
|
675
|
+
context.errors.push(`${stepPath}: relocateCharacter is valid only under an interact trigger`);
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
678
|
+
case 'requestTravel': {
|
|
679
|
+
// The id, never a URL: the shell owns the one allowlist that turns it into a route.
|
|
680
|
+
context.usage.animation = true;
|
|
681
|
+
const target = step.target;
|
|
682
|
+
const title = typeof target === 'string' ? DEVICE_TRAVEL_TITLE_PATTERN.exec(target) : null;
|
|
683
|
+
const listed = typeof target === 'string' &&
|
|
684
|
+
(DEVICE_TRAVEL_PORTAL_PATTERN.test(target) ||
|
|
685
|
+
(title !== null && Number(title[1]) <= DEVICE_TRAVEL_MAX_TITLE));
|
|
686
|
+
if (!listed)
|
|
687
|
+
context.errors.push(`${stepPath}: requestTravel target must be ${DEVICE_TRAVEL_TARGET_RULE}`);
|
|
688
|
+
if (context.trigger !== 'interact')
|
|
689
|
+
context.errors.push(`${stepPath}: requestTravel is valid only under an interact trigger`);
|
|
690
|
+
return;
|
|
691
|
+
}
|
|
609
692
|
case 'enterCharacterSpot': {
|
|
610
693
|
context.usage.posture = true;
|
|
611
694
|
const component = String(step.component ?? '');
|
|
@@ -2126,6 +2209,8 @@ function validateDeviceProject(input, options = {}) {
|
|
|
2126
2209
|
errors.push(`${label} durationMs must be between 16 and 60000`);
|
|
2127
2210
|
}
|
|
2128
2211
|
checkEasing(component.easing, label, errors);
|
|
2212
|
+
if (component.carries !== undefined)
|
|
2213
|
+
validateSliderCarries(component, label, state, errors);
|
|
2129
2214
|
}
|
|
2130
2215
|
if (component.type === 'clockHands') {
|
|
2131
2216
|
const label = `clock hands ${componentId}`;
|
|
@@ -2450,6 +2535,7 @@ function validateDeviceProject(input, options = {}) {
|
|
|
2450
2535
|
if (trigger.do === undefined)
|
|
2451
2536
|
errors.push(`${triggerPath}: every trigger requires a do array`);
|
|
2452
2537
|
else {
|
|
2538
|
+
graphContext.trigger = on;
|
|
2453
2539
|
validateGraphSteps(trigger.do, graphContext, `${triggerPath}.do`, 0);
|
|
2454
2540
|
let handBudgetInvalid = false;
|
|
2455
2541
|
if (graphHasHandStep(trigger.do)) {
|