@laplace.live/persona-sdk 1.11.1 → 1.13.0
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/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/values/bindings.d.ts +8 -0
- package/dist/values/item-transition.d.ts +23 -0
- package/dist/values/item-transition.js +9 -0
- package/dist/values/limits.d.ts +8 -0
- package/dist/values/limits.js +8 -0
- package/dist/values/mouse.d.ts +12 -0
- package/dist/values/mouse.js +14 -0
- package/dist/wire/methods.d.ts +64 -4
- package/dist/wire/schemas/requests.d.ts +38 -1
- package/dist/wire/schemas/requests.js +29 -5
- package/dist/wire/types.d.ts +11 -6
- package/dist/wire/types.js +7 -2
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -11,11 +11,13 @@ export * from './values/gltf-extensions.ts';
|
|
|
11
11
|
export * from './values/guards.ts';
|
|
12
12
|
export * from './values/hands.ts';
|
|
13
13
|
export * from './values/hotkeys.ts';
|
|
14
|
+
export * from './values/item-transition.ts';
|
|
14
15
|
export * from './values/labels.ts';
|
|
15
16
|
export * from './values/limits.ts';
|
|
16
17
|
export * from './values/lipsync.ts';
|
|
17
18
|
export * from './values/locale.ts';
|
|
18
19
|
export * from './values/model-info.ts';
|
|
20
|
+
export * from './values/mouse.ts';
|
|
19
21
|
export * from './values/scene-transition.ts';
|
|
20
22
|
export * from './values/stage-info.ts';
|
|
21
23
|
export * from './values/terms.ts';
|
package/dist/index.js
CHANGED
|
@@ -13,11 +13,13 @@ export * from "./values/gltf-extensions.js";
|
|
|
13
13
|
export * from "./values/guards.js";
|
|
14
14
|
export * from "./values/hands.js";
|
|
15
15
|
export * from "./values/hotkeys.js";
|
|
16
|
+
export * from "./values/item-transition.js";
|
|
16
17
|
export * from "./values/labels.js";
|
|
17
18
|
export * from "./values/limits.js";
|
|
18
19
|
export * from "./values/lipsync.js";
|
|
19
20
|
export * from "./values/locale.js";
|
|
20
21
|
export * from "./values/model-info.js";
|
|
22
|
+
export * from "./values/mouse.js";
|
|
21
23
|
export * from "./values/scene-transition.js";
|
|
22
24
|
export * from "./values/stage-info.js";
|
|
23
25
|
export * from "./values/terms.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BindingInput } from '../wire/types.ts';
|
|
1
2
|
import type { Curve } from './curve.ts';
|
|
2
3
|
import type { BindingTerm } from './terms.ts';
|
|
3
4
|
/** A saved input-to-parameter rule shared by the rig editor and plugin API. */
|
|
@@ -21,6 +22,13 @@ export interface BindableParameter {
|
|
|
21
22
|
max: number;
|
|
22
23
|
default: number;
|
|
23
24
|
}
|
|
25
|
+
/** The editor's live readout, polled as one sample. */
|
|
26
|
+
export interface BindingLiveValues {
|
|
27
|
+
/** What each tracking input reads right now; empty while nothing is measured. */
|
|
28
|
+
inputs: Partial<Record<BindingInput, number>>;
|
|
29
|
+
/** What each bound parameter reads on the model right now, by output id; empty for a host that cannot read it back. */
|
|
30
|
+
outputs: Record<string, number>;
|
|
31
|
+
}
|
|
24
32
|
/** Metadata read from a rig's display and physics sidecars. */
|
|
25
33
|
export interface BindingEditorData {
|
|
26
34
|
connections: Binding[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const ITEM_TRANSITION_STYLES: readonly ["glitch", "dither", "pop", "cut"];
|
|
2
|
+
export type ItemTransitionStyle = (typeof ITEM_TRANSITION_STYLES)[number];
|
|
3
|
+
/** One ramp length for a model switch, an object fade, or a body's entrance and exit. */
|
|
4
|
+
export declare const ITEM_TRANSITION_DEFAULT_MS = 300;
|
|
5
|
+
export declare const ITEM_TRANSITION_MAX_MS = 5000;
|
|
6
|
+
export interface ItemTransition {
|
|
7
|
+
/**
|
|
8
|
+
* `glitch` tears and burns through a dithered dissolve, `dither` is the plain screen-door,
|
|
9
|
+
* `pop` scales in and out, `cut` switches.
|
|
10
|
+
*/
|
|
11
|
+
style: ItemTransitionStyle;
|
|
12
|
+
/** Length of the ramp either way, 0–`ITEM_TRANSITION_MAX_MS`; 0 behaves as `cut`. */
|
|
13
|
+
durationMs: number;
|
|
14
|
+
}
|
|
15
|
+
export declare function defaultItemTransition(): ItemTransition;
|
|
16
|
+
/** A per-call departure from the scene's item transition, for `stage.spawn`. */
|
|
17
|
+
export interface SpawnTransition {
|
|
18
|
+
style?: ItemTransitionStyle;
|
|
19
|
+
/** Entrance ramp, 0–`ITEM_TRANSITION_MAX_MS`; defaults to the scene's duration. */
|
|
20
|
+
inMs?: number;
|
|
21
|
+
/** Exit ramp — expiry, eviction and clears — 0–`ITEM_TRANSITION_MAX_MS`; defaults to the scene's duration. */
|
|
22
|
+
outMs?: number;
|
|
23
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// How stage items appear and disappear — models, objects and spawned bodies alike. Per scene,
|
|
2
|
+
// on `SceneEnvironment.itemTransition`; `stage.spawn` may override it per call.
|
|
3
|
+
export const ITEM_TRANSITION_STYLES = ['glitch', 'dither', 'pop', 'cut'];
|
|
4
|
+
/** One ramp length for a model switch, an object fade, or a body's entrance and exit. */
|
|
5
|
+
export const ITEM_TRANSITION_DEFAULT_MS = 300;
|
|
6
|
+
export const ITEM_TRANSITION_MAX_MS = 5000;
|
|
7
|
+
export function defaultItemTransition() {
|
|
8
|
+
return { style: 'glitch', durationMs: ITEM_TRANSITION_DEFAULT_MS };
|
|
9
|
+
}
|
package/dist/values/limits.d.ts
CHANGED
|
@@ -152,6 +152,14 @@ export declare const PLACE_2D_SCALE_MIN = 0.01;
|
|
|
152
152
|
export declare const PLACE_2D_SCALE_MAX = 50;
|
|
153
153
|
export declare const PLACE_3D_SCALE_MIN = 0.01;
|
|
154
154
|
export declare const PLACE_3D_SCALE_MAX = 100;
|
|
155
|
+
/** Objects one `object.addMany` call may append. */
|
|
156
|
+
export declare const OBJECT_ADD_MANY_MAX = 100;
|
|
157
|
+
/** `stage.spawn` bounds: bodies per call, bodies alive at once (the oldest make room), scatter and throw ranges, lifetime. */
|
|
158
|
+
export declare const SPAWN_COUNT_MAX = 200;
|
|
159
|
+
export declare const SPAWN_ALIVE_MAX = 500;
|
|
160
|
+
export declare const SPAWN_SPREAD_MAX = 20;
|
|
161
|
+
export declare const SPAWN_SPEED_MAX = 50;
|
|
162
|
+
export declare const SPAWN_TTL_MAX_MS = 600000;
|
|
155
163
|
/** Web object viewport bounds, CSS px per side. */
|
|
156
164
|
export declare const WEB_SIZE_MIN = 16;
|
|
157
165
|
export declare const WEB_SIZE_MAX = 7680;
|
package/dist/values/limits.js
CHANGED
|
@@ -272,6 +272,14 @@ export const PLACE_2D_SCALE_MIN = 0.01;
|
|
|
272
272
|
export const PLACE_2D_SCALE_MAX = 50;
|
|
273
273
|
export const PLACE_3D_SCALE_MIN = 0.01;
|
|
274
274
|
export const PLACE_3D_SCALE_MAX = 100;
|
|
275
|
+
/** Objects one `object.addMany` call may append. */
|
|
276
|
+
export const OBJECT_ADD_MANY_MAX = 100;
|
|
277
|
+
/** `stage.spawn` bounds: bodies per call, bodies alive at once (the oldest make room), scatter and throw ranges, lifetime. */
|
|
278
|
+
export const SPAWN_COUNT_MAX = 200;
|
|
279
|
+
export const SPAWN_ALIVE_MAX = 500;
|
|
280
|
+
export const SPAWN_SPREAD_MAX = 20;
|
|
281
|
+
export const SPAWN_SPEED_MAX = 50;
|
|
282
|
+
export const SPAWN_TTL_MAX_MS = 600_000;
|
|
275
283
|
/** Web object viewport bounds, CSS px per side. */
|
|
276
284
|
export const WEB_SIZE_MIN = 16;
|
|
277
285
|
export const WEB_SIZE_MAX = 7680;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The OS cursor as a tracking input, in VTS's own names and span: −1..1 across the display the
|
|
3
|
+
* cursor is on, x growing rightward and y growing upward like `FacePositionY`.
|
|
4
|
+
*/
|
|
5
|
+
export declare const MOUSE_INPUT_RANGES: {
|
|
6
|
+
readonly MousePositionX: readonly [-1, 1];
|
|
7
|
+
readonly MousePositionY: readonly [-1, 1];
|
|
8
|
+
};
|
|
9
|
+
export declare const MOUSE_INPUT_NAMES: readonly MouseInputName[];
|
|
10
|
+
export type MouseInputName = keyof typeof MOUSE_INPUT_RANGES;
|
|
11
|
+
export type MouseInputs = Partial<Record<MouseInputName, number>>;
|
|
12
|
+
export declare function isMouseInputName(v: string): v is MouseInputName;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { keysOf } from "./guards.js";
|
|
2
|
+
/**
|
|
3
|
+
* The OS cursor as a tracking input, in VTS's own names and span: −1..1 across the display the
|
|
4
|
+
* cursor is on, x growing rightward and y growing upward like `FacePositionY`.
|
|
5
|
+
*/
|
|
6
|
+
export const MOUSE_INPUT_RANGES = {
|
|
7
|
+
MousePositionX: [-1, 1],
|
|
8
|
+
MousePositionY: [-1, 1],
|
|
9
|
+
};
|
|
10
|
+
export const MOUSE_INPUT_NAMES = keysOf(MOUSE_INPUT_RANGES);
|
|
11
|
+
const MOUSE_INPUT_SET = new Set(MOUSE_INPUT_NAMES);
|
|
12
|
+
export function isMouseInputName(v) {
|
|
13
|
+
return MOUSE_INPUT_SET.has(v);
|
|
14
|
+
}
|
package/dist/wire/methods.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { Binding, BindingEditorData } from '../values/bindings.ts';
|
|
1
|
+
import type { Binding, BindingEditorData, BindingLiveValues } from '../values/bindings.ts';
|
|
2
2
|
import type { ControllerMovementConfig, ControllerState } from '../values/controller.ts';
|
|
3
|
+
import type { SpawnTransition } from '../values/item-transition.ts';
|
|
3
4
|
import type { LipSyncCalibrationCommand, LipSyncConfig, LipSyncMode, LipSyncState } from '../values/lipsync.ts';
|
|
4
5
|
import type { SceneInspection } from '../values/stage-info.ts';
|
|
5
6
|
import type { EventName } from './events.ts';
|
|
@@ -168,10 +169,21 @@ export interface InstanceInfoResponse {
|
|
|
168
169
|
export interface ObjectAddRequest {
|
|
169
170
|
content: ObjectContent;
|
|
170
171
|
name?: string;
|
|
172
|
+
/** Initial placement, so the object never draws a frame at the default one. Omitted axes keep it. */
|
|
173
|
+
place2d?: Partial<Place2D>;
|
|
174
|
+
place3d?: Partial<Place3D>;
|
|
171
175
|
}
|
|
172
176
|
export interface ObjectAddResponse {
|
|
173
177
|
instanceId: string;
|
|
174
178
|
}
|
|
179
|
+
/** Up to `OBJECT_ADD_MANY_MAX` objects as one scene edit: one stage apply, one persist, one undo step. */
|
|
180
|
+
export interface ObjectAddManyRequest {
|
|
181
|
+
objects: ObjectAddRequest[];
|
|
182
|
+
}
|
|
183
|
+
export interface ObjectAddManyResponse {
|
|
184
|
+
/** In request order. */
|
|
185
|
+
instanceIds: string[];
|
|
186
|
+
}
|
|
175
187
|
export interface ObjectRenameRequest {
|
|
176
188
|
instanceId: string;
|
|
177
189
|
name: string;
|
|
@@ -414,6 +426,44 @@ export interface StageResetTransformRequest {
|
|
|
414
426
|
export type StageResetTransformResponse = EmptyResponse;
|
|
415
427
|
export type StageResetCameraRequest = EmptyRequest;
|
|
416
428
|
export type StageResetCameraResponse = EmptyResponse;
|
|
429
|
+
/** A world-space vector: metres, or metres per second for a velocity. */
|
|
430
|
+
export interface StageVector {
|
|
431
|
+
x: number;
|
|
432
|
+
y: number;
|
|
433
|
+
z: number;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Drop physics-driven copies of a prop asset onto the stage. They live in the renderer only —
|
|
437
|
+
* no scene item, no undo, no persistence — and clear with the scene, with Physics, or on
|
|
438
|
+
* `stage.clearSpawned`. Needs the scene's Physics switch on (`invalid-state` otherwise).
|
|
439
|
+
*/
|
|
440
|
+
export interface StageSpawnRequest {
|
|
441
|
+
/** A registered `prop` asset. */
|
|
442
|
+
assetId: string;
|
|
443
|
+
/** 1–`SPAWN_COUNT_MAX`; default 1. Past `SPAWN_ALIVE_MAX` alive bodies, the oldest make room. */
|
|
444
|
+
count?: number;
|
|
445
|
+
/** Centre of the scatter box, metres; default `{ x: 0, y: 3, z: 0 }`, above where an avatar stands. */
|
|
446
|
+
origin?: StageVector;
|
|
447
|
+
/** Edge of the scatter box around `origin`, 0–`SPAWN_SPREAD_MAX` metres; default 1. */
|
|
448
|
+
spread?: number;
|
|
449
|
+
/** Initial velocity every body shares, each axis within ±`SPAWN_SPEED_MAX`; default at rest. */
|
|
450
|
+
velocity?: StageVector;
|
|
451
|
+
/** Placement scale, `PLACE_3D_SCALE_MIN`–`PLACE_3D_SCALE_MAX`; default 1. */
|
|
452
|
+
scale?: number;
|
|
453
|
+
/** Lifetime before a body vanishes, 0–`SPAWN_TTL_MAX_MS`; 0 keeps it until cleared. Default 30000. */
|
|
454
|
+
ttlMs?: number;
|
|
455
|
+
/** How these bodies appear and disappear; omitted fields take the scene's `itemTransition`. */
|
|
456
|
+
transition?: SpawnTransition;
|
|
457
|
+
}
|
|
458
|
+
export interface StageSpawnResponse {
|
|
459
|
+
spawned: number;
|
|
460
|
+
/** Bodies alive after this call, across every asset. */
|
|
461
|
+
alive: number;
|
|
462
|
+
}
|
|
463
|
+
export type StageClearSpawnedRequest = EmptyRequest;
|
|
464
|
+
export interface StageClearSpawnedResponse {
|
|
465
|
+
cleared: number;
|
|
466
|
+
}
|
|
417
467
|
export type AppInfoRequest = EmptyRequest;
|
|
418
468
|
export interface AppInfoResponse {
|
|
419
469
|
name: string;
|
|
@@ -531,9 +581,7 @@ export interface BindingSetResponse {
|
|
|
531
581
|
saved: boolean;
|
|
532
582
|
}
|
|
533
583
|
export type BindingInputsRequest = BindingTarget;
|
|
534
|
-
export
|
|
535
|
-
inputs: Partial<Record<BindingInput, number>>;
|
|
536
|
-
}
|
|
584
|
+
export type BindingInputsResponse = BindingLiveValues;
|
|
537
585
|
export interface BindingOverrideRequest extends BindingTarget {
|
|
538
586
|
input: BindingInput;
|
|
539
587
|
value: number | null;
|
|
@@ -759,6 +807,10 @@ export interface MethodMap {
|
|
|
759
807
|
request: ObjectAddRequest;
|
|
760
808
|
response: ObjectAddResponse;
|
|
761
809
|
};
|
|
810
|
+
'object.addMany': {
|
|
811
|
+
request: ObjectAddManyRequest;
|
|
812
|
+
response: ObjectAddManyResponse;
|
|
813
|
+
};
|
|
762
814
|
'object.rename': {
|
|
763
815
|
request: ObjectRenameRequest;
|
|
764
816
|
response: ObjectRenameResponse;
|
|
@@ -926,6 +978,14 @@ export interface MethodMap {
|
|
|
926
978
|
request: StageResetCameraRequest;
|
|
927
979
|
response: StageResetCameraResponse;
|
|
928
980
|
};
|
|
981
|
+
'stage.spawn': {
|
|
982
|
+
request: StageSpawnRequest;
|
|
983
|
+
response: StageSpawnResponse;
|
|
984
|
+
};
|
|
985
|
+
'stage.clearSpawned': {
|
|
986
|
+
request: StageClearSpawnedRequest;
|
|
987
|
+
response: StageClearSpawnedResponse;
|
|
988
|
+
};
|
|
929
989
|
'app.info': {
|
|
930
990
|
request: AppInfoRequest;
|
|
931
991
|
response: AppInfoResponse;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
2
|
import type { MethodName } from '../methods.ts';
|
|
3
|
-
import type { HotkeyConfig, ObjectContent } from '../types.ts';
|
|
3
|
+
import type { HotkeyConfig, ObjectContent, Place2D, Place3D } from '../types.ts';
|
|
4
4
|
/** A complete transition replacement; scene.patch remains stage-owned for its other slices. */
|
|
5
5
|
export declare const SceneTransitionSchema: z.ZodObject<{
|
|
6
6
|
type: z.ZodEnum<{
|
|
@@ -132,6 +132,16 @@ export declare const requestSchemas: {
|
|
|
132
132
|
'object.add': z.ZodObject<{
|
|
133
133
|
content: z.ZodCustom<ObjectContent, ObjectContent>;
|
|
134
134
|
name: z.ZodOptional<z.ZodString>;
|
|
135
|
+
place2d: z.ZodOptional<z.ZodCustom<Partial<Place2D>, Partial<Place2D>>>;
|
|
136
|
+
place3d: z.ZodOptional<z.ZodCustom<Partial<Place3D>, Partial<Place3D>>>;
|
|
137
|
+
}, z.core.$strip>;
|
|
138
|
+
'object.addMany': z.ZodObject<{
|
|
139
|
+
objects: z.ZodArray<z.ZodObject<{
|
|
140
|
+
content: z.ZodCustom<ObjectContent, ObjectContent>;
|
|
141
|
+
name: z.ZodOptional<z.ZodString>;
|
|
142
|
+
place2d: z.ZodOptional<z.ZodCustom<Partial<Place2D>, Partial<Place2D>>>;
|
|
143
|
+
place3d: z.ZodOptional<z.ZodCustom<Partial<Place3D>, Partial<Place3D>>>;
|
|
144
|
+
}, z.core.$strip>>;
|
|
135
145
|
}, z.core.$strip>;
|
|
136
146
|
'object.setContent': z.ZodObject<{
|
|
137
147
|
instanceId: z.ZodString;
|
|
@@ -297,6 +307,33 @@ export declare const requestSchemas: {
|
|
|
297
307
|
'speech.stop': z.ZodObject<{
|
|
298
308
|
instanceId: z.ZodOptional<z.ZodString>;
|
|
299
309
|
}, z.core.$strip>;
|
|
310
|
+
'stage.spawn': z.ZodObject<{
|
|
311
|
+
assetId: z.ZodString;
|
|
312
|
+
count: z.ZodOptional<z.ZodNumber>;
|
|
313
|
+
origin: z.ZodOptional<z.ZodObject<{
|
|
314
|
+
x: z.ZodNumber;
|
|
315
|
+
y: z.ZodNumber;
|
|
316
|
+
z: z.ZodNumber;
|
|
317
|
+
}, z.core.$strip>>;
|
|
318
|
+
spread: z.ZodOptional<z.ZodNumber>;
|
|
319
|
+
velocity: z.ZodOptional<z.ZodObject<{
|
|
320
|
+
x: z.ZodNumber;
|
|
321
|
+
y: z.ZodNumber;
|
|
322
|
+
z: z.ZodNumber;
|
|
323
|
+
}, z.core.$strip>>;
|
|
324
|
+
scale: z.ZodOptional<z.ZodNumber>;
|
|
325
|
+
ttlMs: z.ZodOptional<z.ZodNumber>;
|
|
326
|
+
transition: z.ZodOptional<z.ZodObject<{
|
|
327
|
+
style: z.ZodOptional<z.ZodEnum<{
|
|
328
|
+
glitch: "glitch";
|
|
329
|
+
dither: "dither";
|
|
330
|
+
pop: "pop";
|
|
331
|
+
cut: "cut";
|
|
332
|
+
}>>;
|
|
333
|
+
inMs: z.ZodOptional<z.ZodNumber>;
|
|
334
|
+
outMs: z.ZodOptional<z.ZodNumber>;
|
|
335
|
+
}, z.core.$strip>>;
|
|
336
|
+
}, z.core.$strip>;
|
|
300
337
|
'events.subscribe': z.ZodObject<{
|
|
301
338
|
events: z.ZodArray<z.ZodCustom<keyof import("../events.ts").EventMap, keyof import("../events.ts").EventMap>>;
|
|
302
339
|
}, z.core.$strip>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
2
|
import { CONTROLLER_DEAD_ZONE_MAX } from "../../values/controller.js";
|
|
3
3
|
import { isRecord } from "../../values/guards.js";
|
|
4
|
-
import {
|
|
4
|
+
import { ITEM_TRANSITION_STYLES } from "../../values/item-transition.js";
|
|
5
|
+
import { OBJECT_ADD_MANY_MAX, SCENE_COLOR_RE, SPEECH_URL_MAX_LENGTH, STORAGE_KEY_MAX_LENGTH, STORAGE_VALUE_MAX_LENGTH, } from "../../values/limits.js";
|
|
5
6
|
import { LIP_SYNC_CALIBRATION_ACTIONS, LIP_SYNC_MODES, LIP_SYNC_PHONEMES, } from "../../values/lipsync.js";
|
|
6
7
|
import { SCENE_TRANSITION_DURATION_MAX_MS, SCENE_TRANSITION_DURATION_MIN_MS, SCENE_TRANSITION_FADE_DEFAULT_MS, SCENE_TRANSITION_SWITCH_POINT_MAX, SCENE_TRANSITION_SWITCH_POINT_MIN, SCENE_TRANSITION_TYPES, } from "../../values/scene-transition.js";
|
|
7
8
|
import { ASSET_KINDS, INJECT_TARGET_TYPES, POSE_SOURCE_IDS, TRACKING_SOURCE_IDS, TRACKING_SOURCE_KINDS, } from "../types.js";
|
|
@@ -59,6 +60,14 @@ const speechUrl = z
|
|
|
59
60
|
return false;
|
|
60
61
|
}
|
|
61
62
|
}, 'url must be http(s) or data:audio/*');
|
|
63
|
+
// Placements are healed stage-side like `object.setPlacement`'s; only the container is gated here.
|
|
64
|
+
const objectAdd = z.object({
|
|
65
|
+
content: z.custom(isRecord, 'content must be an object'),
|
|
66
|
+
name: nonEmpty.optional(),
|
|
67
|
+
place2d: z.custom(isRecord, 'place2d must be an object').optional(),
|
|
68
|
+
place3d: z.custom(isRecord, 'place3d must be an object').optional(),
|
|
69
|
+
});
|
|
70
|
+
const stageVector = z.object({ x: z.number(), y: z.number(), z: z.number() });
|
|
62
71
|
export const requestSchemas = {
|
|
63
72
|
'lipSync.state': z.object({}),
|
|
64
73
|
'lipSync.configure': lipSyncPatch,
|
|
@@ -85,10 +94,8 @@ export const requestSchemas = {
|
|
|
85
94
|
}),
|
|
86
95
|
'instance.add': z.object({ modelId: nonEmpty }),
|
|
87
96
|
'instance.setModel': z.object({ instanceId: nonEmpty, modelId: nonEmpty }),
|
|
88
|
-
'object.add':
|
|
89
|
-
|
|
90
|
-
name: nonEmpty.optional(),
|
|
91
|
-
}),
|
|
97
|
+
'object.add': objectAdd,
|
|
98
|
+
'object.addMany': z.object({ objects: z.array(objectAdd).min(1).max(OBJECT_ADD_MANY_MAX) }),
|
|
92
99
|
'object.setContent': z.object({
|
|
93
100
|
instanceId: nonEmpty,
|
|
94
101
|
content: z.custom(isRecord, 'content must be an object'),
|
|
@@ -144,6 +151,23 @@ export const requestSchemas = {
|
|
|
144
151
|
volume: z.number().min(0).max(1).optional(),
|
|
145
152
|
}),
|
|
146
153
|
'speech.stop': z.object({ instanceId: nonEmpty.optional() }),
|
|
154
|
+
// Main needs the asset id to resolve; the stage clamps the rest, so the numbers are gated shallowly.
|
|
155
|
+
'stage.spawn': z.object({
|
|
156
|
+
assetId: nonEmpty,
|
|
157
|
+
count: z.number().optional(),
|
|
158
|
+
origin: stageVector.optional(),
|
|
159
|
+
spread: z.number().optional(),
|
|
160
|
+
velocity: stageVector.optional(),
|
|
161
|
+
scale: z.number().optional(),
|
|
162
|
+
ttlMs: z.number().optional(),
|
|
163
|
+
transition: z
|
|
164
|
+
.object({
|
|
165
|
+
style: z.enum(ITEM_TRANSITION_STYLES).optional(),
|
|
166
|
+
inMs: z.number().optional(),
|
|
167
|
+
outMs: z.number().optional(),
|
|
168
|
+
})
|
|
169
|
+
.optional(),
|
|
170
|
+
}),
|
|
147
171
|
'events.subscribe': z.object({ events: z.array(lenientEventNameSchema).min(1) }),
|
|
148
172
|
'events.unsubscribe': z.object({ events: z.array(lenientEventNameSchema).optional() }),
|
|
149
173
|
'param.inject': z.object({ entries: z.array(InjectEntrySchema).min(1) }),
|
package/dist/wire/types.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type * as z from 'zod';
|
|
2
2
|
import type { EFFECT_BLEND_MODES, EFFECT_SCOPES } from '../values/effect-schema.ts';
|
|
3
|
+
import type { ItemTransition } from '../values/item-transition.ts';
|
|
3
4
|
import type { SCENE_TRANSITION_TYPES } from '../values/scene-transition.ts';
|
|
4
5
|
import type { SettingsPatchSchema, SettingsSchema } from './schemas/settings.ts';
|
|
5
6
|
import { type ArkitInputName } from '../values/arkit.ts';
|
|
6
7
|
import { type BaseControllerInputName, type ControllerInputName, type ControllerMovementConfig } from '../values/controller.ts';
|
|
7
8
|
import { type HandInputName } from '../values/hands.ts';
|
|
8
9
|
import { type LipSyncMode, type VoiceInputName } from '../values/lipsync.ts';
|
|
10
|
+
import { type MouseInputName } from '../values/mouse.ts';
|
|
9
11
|
export type ModelFormat = 'live2d' | 'vrm';
|
|
10
12
|
/** Where an item came from: shipped with the app, or added by the user. */
|
|
11
13
|
export type ContentOrigin = 'bundled' | 'user';
|
|
@@ -922,6 +924,8 @@ export interface SceneEnvironment {
|
|
|
922
924
|
* The simulated pose is never saved — switching it off restores each object's placement.
|
|
923
925
|
*/
|
|
924
926
|
physics?: boolean;
|
|
927
|
+
/** How models, objects and spawned bodies appear and disappear; omitted by older hosts. */
|
|
928
|
+
itemTransition?: ItemTransition;
|
|
925
929
|
effects: SceneEffects;
|
|
926
930
|
/**
|
|
927
931
|
* Built-in effects added as layers, in registry order — one keeps its row and tuning while
|
|
@@ -981,7 +985,7 @@ export interface ScenePatch {
|
|
|
981
985
|
* App-level features a client gates on (never version-sniff): `hello` and
|
|
982
986
|
* `app.info` report them — the per-app mirror of {@link InstanceRuntime.capabilities}.
|
|
983
987
|
*/
|
|
984
|
-
export declare const APP_CAPABILITIES: readonly ["storage", "speech", "automations", "controllers", "model-editing", "asset-inspection", "layer-effects", "scene-transitions", "area-lights", "spot-lights", "camera-follow-lights", "shadow-filters", "environment-map-model"];
|
|
988
|
+
export declare const APP_CAPABILITIES: readonly ["storage", "speech", "automations", "controllers", "model-editing", "asset-inspection", "layer-effects", "scene-transitions", "area-lights", "spot-lights", "camera-follow-lights", "shadow-filters", "environment-map-model", "spawn"];
|
|
985
989
|
export type AppCapability = (typeof APP_CAPABILITIES)[number];
|
|
986
990
|
export declare function isAppCapability(v: unknown): v is AppCapability;
|
|
987
991
|
/** What a loaded model instance can do; absent capabilities answer `unsupported-for-format`. */
|
|
@@ -1223,11 +1227,12 @@ declare const VTS_INPUT_RANGES: {
|
|
|
1223
1227
|
};
|
|
1224
1228
|
type VtsInputName = keyof typeof VTS_INPUT_RANGES;
|
|
1225
1229
|
/**
|
|
1226
|
-
* Default input vocabulary: face and
|
|
1227
|
-
* Additional controller profile ids are accepted by isInputName without appearing
|
|
1230
|
+
* Default input vocabulary: face, hand and cursor inputs, raw ARKit channels and controller
|
|
1231
|
+
* profile 1. Additional controller profile ids are accepted by isInputName without appearing
|
|
1232
|
+
* in this list.
|
|
1228
1233
|
*/
|
|
1229
|
-
export declare const INPUT_NAMES: readonly (VtsInputName | HandInputName | VoiceInputName | ArkitInputName | BaseControllerInputName)[];
|
|
1230
|
-
export type InputName = VtsInputName | HandInputName | VoiceInputName | ArkitInputName | ControllerInputName;
|
|
1234
|
+
export declare const INPUT_NAMES: readonly (VtsInputName | HandInputName | VoiceInputName | MouseInputName | ArkitInputName | BaseControllerInputName)[];
|
|
1235
|
+
export type InputName = VtsInputName | HandInputName | VoiceInputName | MouseInputName | ArkitInputName | ControllerInputName;
|
|
1231
1236
|
/** Whether an untrusted string names a tracking input — the guard every wire boundary needs. */
|
|
1232
1237
|
export declare function isInputName(v: string): v is InputName;
|
|
1233
1238
|
/**
|
|
@@ -1255,7 +1260,7 @@ export declare function arkitTwinOf(input: InputName): BindingInput;
|
|
|
1255
1260
|
* Default inputs' natural spans. Use getInputRange for a dynamically numbered controller input.
|
|
1256
1261
|
* Head angles are degrees; the rest are unitless.
|
|
1257
1262
|
*/
|
|
1258
|
-
export declare const INPUT_RANGES: Record<VtsInputName | HandInputName | VoiceInputName | ArkitInputName | BaseControllerInputName, readonly [number, number]>;
|
|
1263
|
+
export declare const INPUT_RANGES: Record<VtsInputName | HandInputName | VoiceInputName | MouseInputName | ArkitInputName | BaseControllerInputName, readonly [number, number]>;
|
|
1259
1264
|
/** Natural span of any valid input, including dynamically numbered controller profiles. */
|
|
1260
1265
|
export declare function getInputRange(name: InputName): readonly [number, number];
|
|
1261
1266
|
/**
|
package/dist/wire/types.js
CHANGED
|
@@ -6,6 +6,7 @@ import { BASE_CONTROLLER_INPUT_NAMES, BASE_CONTROLLER_INPUT_RANGES, controllerIn
|
|
|
6
6
|
import { isOneOf, keysOf } from "../values/guards.js";
|
|
7
7
|
import { HAND_INPUT_NAMES, HAND_INPUT_RANGES } from "../values/hands.js";
|
|
8
8
|
import { VOICE_INPUT_NAMES, VOICE_INPUT_RANGES } from "../values/lipsync.js";
|
|
9
|
+
import { MOUSE_INPUT_NAMES, MOUSE_INPUT_RANGES } from "../values/mouse.js";
|
|
9
10
|
/**
|
|
10
11
|
* How a registered file is labelled. Wider than an object's content kinds: `.hdr` is only
|
|
11
12
|
* ever an environment map, and a `.vmd` splits by content — `cameraMotion` for one that
|
|
@@ -45,6 +46,7 @@ export const APP_CAPABILITIES = [
|
|
|
45
46
|
'camera-follow-lights',
|
|
46
47
|
'shadow-filters',
|
|
47
48
|
'environment-map-model',
|
|
49
|
+
'spawn',
|
|
48
50
|
];
|
|
49
51
|
export function isAppCapability(v) {
|
|
50
52
|
return isOneOf(v, APP_CAPABILITIES);
|
|
@@ -184,13 +186,15 @@ const VTS_INPUT_RANGES = {
|
|
|
184
186
|
/** VTS's input vocabulary, plus `JawOpen` — the derived half of {@link INPUT_NAMES}. */
|
|
185
187
|
const VTS_INPUT_NAMES = keysOf(VTS_INPUT_RANGES);
|
|
186
188
|
/**
|
|
187
|
-
* Default input vocabulary: face and
|
|
188
|
-
* Additional controller profile ids are accepted by isInputName without appearing
|
|
189
|
+
* Default input vocabulary: face, hand and cursor inputs, raw ARKit channels and controller
|
|
190
|
+
* profile 1. Additional controller profile ids are accepted by isInputName without appearing
|
|
191
|
+
* in this list.
|
|
189
192
|
*/
|
|
190
193
|
export const INPUT_NAMES = [
|
|
191
194
|
...VTS_INPUT_NAMES,
|
|
192
195
|
...VOICE_INPUT_NAMES,
|
|
193
196
|
...HAND_INPUT_NAMES,
|
|
197
|
+
...MOUSE_INPUT_NAMES,
|
|
194
198
|
...ARKIT_INPUT_NAMES,
|
|
195
199
|
...BASE_CONTROLLER_INPUT_NAMES,
|
|
196
200
|
];
|
|
@@ -230,6 +234,7 @@ export const INPUT_RANGES = {
|
|
|
230
234
|
...VTS_INPUT_RANGES,
|
|
231
235
|
...VOICE_INPUT_RANGES,
|
|
232
236
|
...HAND_INPUT_RANGES,
|
|
237
|
+
...MOUSE_INPUT_RANGES,
|
|
233
238
|
...BASE_CONTROLLER_INPUT_RANGES,
|
|
234
239
|
// `fromEntries` widens the key type back to `string`; the annotation above is what keeps
|
|
235
240
|
// this exhaustive, and it fails to typecheck if a name ever lacks a range.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@laplace.live/persona-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"description": "TypeScript SDK and wire schema for the LAPLACE Persona plugin API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"rimraf": "^6.1.3",
|
|
30
30
|
"typescript": "~6.0.3",
|
|
31
|
-
"vitest": "^5.0.
|
|
31
|
+
"vitest": "^5.0.1"
|
|
32
32
|
},
|
|
33
33
|
"engines": {
|
|
34
34
|
"node": ">=24"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"zod": "^4.6.
|
|
37
|
+
"zod": "^4.6.5"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "rimraf dist && tsc -p tsconfig.build.json",
|