@laplace.live/persona-sdk 1.13.0 → 1.14.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.
@@ -7,6 +7,11 @@ export declare function fileBasename(path: string): string;
7
7
  * so the basename is the only identifier there is.
8
8
  */
9
9
  export declare function motionLabel(file: string): string;
10
+ /**
11
+ * Label for one motion of a group: the group alone when the file just repeats it (a VRM clip
12
+ * group named for its file, or a loose VTS file whose group is its basename), else both.
13
+ */
14
+ export declare function motionSlotLabel(group: string, file: string): string;
10
15
  /** Playable entries of a `MotionGroup` with their authored indices; an empty string is a missing file and keeps its slot. */
11
16
  export declare function motionSlots(files: readonly string[]): {
12
17
  file: string;
@@ -13,6 +13,14 @@ export function motionLabel(file) {
13
13
  const base = fileBasename(file);
14
14
  return base.replace(/\.motion3\.json$|\.exp3\.json$|\.vrma$|\.json$/i, '') || base;
15
15
  }
16
+ /**
17
+ * Label for one motion of a group: the group alone when the file just repeats it (a VRM clip
18
+ * group named for its file, or a loose VTS file whose group is its basename), else both.
19
+ */
20
+ export function motionSlotLabel(group, file) {
21
+ const name = motionLabel(file);
22
+ return group === file || name === group ? group : `${group} · ${name}`;
23
+ }
16
24
  /** Playable entries of a `MotionGroup` with their authored indices; an empty string is a missing file and keeps its slot. */
17
25
  export function motionSlots(files) {
18
26
  return files.flatMap((file, index) => (file === '' ? [] : [{ file, index }]));
@@ -81,6 +81,8 @@ export interface CameraDistanceLimits {
81
81
  export declare function cameraDistanceLimits(env: Pick<SceneEnvironment, 'modelAssetId' | 'modelPlace'>, setRadius: number | null): CameraDistanceLimits;
82
82
  /** ×2 doubles Cubism's own breath amplitude — past that the head sway reads as a nod, not a breath. */
83
83
  export declare const BREATH_DEPTH_MAX = 2;
84
+ /** Seconds; a minute without a face is well past any dropout worth waiting out. */
85
+ export declare const TRACKING_LOST_DELAY_MAX = 60;
84
86
  export declare const MTOON_NORMAL_SCALE_MAX = 2;
85
87
  export declare const MTOON_RIM_MAX = 2;
86
88
  /** ×0 flattens the Fresnel to a flood fill, ×4 tightens a default power-5 rim to a hairline. */
@@ -112,6 +112,8 @@ export function cameraDistanceLimits(env, setRadius) {
112
112
  }
113
113
  /** ×2 doubles Cubism's own breath amplitude — past that the head sway reads as a nod, not a breath. */
114
114
  export const BREATH_DEPTH_MAX = 2;
115
+ /** Seconds; a minute without a face is well past any dropout worth waiting out. */
116
+ export const TRACKING_LOST_DELAY_MAX = 60;
115
117
  export const MTOON_NORMAL_SCALE_MAX = 2;
116
118
  export const MTOON_RIM_MAX = 2;
117
119
  /** ×0 flattens the Fresnel to a flood fill, ×4 tightens a default power-5 rim to a hairline. */
@@ -4,7 +4,7 @@ import type { SpawnTransition } from '../values/item-transition.ts';
4
4
  import type { LipSyncCalibrationCommand, LipSyncConfig, LipSyncMode, LipSyncState } from '../values/lipsync.ts';
5
5
  import type { SceneInspection } from '../values/stage-info.ts';
6
6
  import type { EventName } from './events.ts';
7
- import type { AnchorOption, AppCapability, AssetKind, AssetRef, Attach, AttachHeadAngle, AutomationInfo, BindingInput, Expression, ExpressionPersistence, HandTrackingMode, HotkeyConfig, HotkeyState, InjectEntry, InjectTarget, InstanceRuntime, JsonValue, LayerEffectKey, LayerEffects, LayerEffectsPatch, MediaPipeConfig, ModelInfo, ModelRef, MotionGroup, MToonTuning, ObjectContent, ObjectLightOverride, ObjectSpace, Place2D, Place3D, PlayingMotion, PoseSourceId, PoseStatus, Scene, SceneItem, SceneLight, SceneLightCameraFollowOptions, ScenePatch, SceneState, ScreenPlacement, Settings, SettingsPatch, TrackingSourceConfig, TrackingSourceId, TrackingSourceKind, TrackingStatus, VrmPlacement } from './types.ts';
7
+ import type { AnchorOption, AppCapability, AssetKind, AssetRef, Attach, AttachHeadAngle, AutomationInfo, BindingInput, Expression, ExpressionPersistence, HandTrackingMode, HotkeyConfig, HotkeyState, InjectEntry, InjectTarget, InstanceRuntime, JsonValue, LayerEffectKey, LayerEffects, LayerEffectsPatch, MediaPipeConfig, ModelInfo, ModelRef, MotionGroup, MToonTuning, ObjectContent, ObjectLightOverride, ObjectSpace, Place2D, Place3D, PlayingMotion, PoseSourceId, PoseStatus, Scene, SceneItem, SceneLight, SceneLightCameraFollowOptions, ScenePatch, SceneState, ScreenPlacement, Settings, SettingsPatch, TrackingLostBehavior, TrackingSourceConfig, TrackingSourceId, TrackingSourceKind, TrackingStatus, VrmPlacement } from './types.ts';
8
8
  /** Marker for methods that take no parameters; the client lets you omit the argument. */
9
9
  export type EmptyRequest = Record<never, never>;
10
10
  /** Marker for methods whose success response carries no data. */
@@ -157,7 +157,16 @@ export type InstanceSetMToonResponse = EmptyResponse;
157
157
  export interface InstanceSetIdleRequest {
158
158
  instanceId?: string;
159
159
  idleAnimation?: boolean;
160
+ /** VRM only. */
160
161
  idleClip?: string;
162
+ /** Live2D only: a motion file from `motion.list`, or null for the model's `Idle` group. */
163
+ idleMotion?: string | null;
164
+ /** The `tracking-lost` app capability carries these three. */
165
+ trackingLostBehavior?: TrackingLostBehavior;
166
+ /** Live2D only: a motion file from `motion.list`, or null for none. */
167
+ trackingLostMotion?: string | null;
168
+ /** Seconds, 0 to `TRACKING_LOST_DELAY_MAX`. */
169
+ trackingLostDelay?: number;
161
170
  }
162
171
  export type InstanceSetIdleResponse = EmptyResponse;
163
172
  export interface InstanceInfoRequest {
@@ -167,8 +167,28 @@ export interface SceneModelItem {
167
167
  controllerMovement: ControllerMovementConfig;
168
168
  live2d: ScreenPlacement;
169
169
  vrm: VrmPlacement;
170
+ /** Whether the idle base animation plays: VRM loops `idleClip`, Live2D `idleMotion`. */
170
171
  idleAnimation: boolean;
172
+ /** VRM: a bundled `.vrma` filename or `asset:<id>`. Kept while the instance shows a Live2D model. */
171
173
  idleClip: string;
174
+ /**
175
+ * Live2D: a motion file the model lists (as `motion.list` names it), looped beneath every
176
+ * other motion, or null for the model's own `Idle` group at random. A file the model no
177
+ * longer lists degrades to that group. Kept while the instance shows a VRM.
178
+ */
179
+ idleMotion: string | null;
180
+ /**
181
+ * What the tracked parameters do while the face is lost: keep the last pose until it is
182
+ * found again (`hold`), or ease back to the idle over ~0.3 s and return the same way (`idle`).
183
+ */
184
+ trackingLostBehavior: TrackingLostBehavior;
185
+ /**
186
+ * Live2D: a listed motion that replaces the idle once the face has been lost for
187
+ * `trackingLostDelay` seconds, until it is found again; null keeps the idle playing.
188
+ */
189
+ trackingLostMotion: string | null;
190
+ /** Seconds without a face before `trackingLostMotion` takes over. */
191
+ trackingLostDelay: number;
172
192
  /**
173
193
  * Live2D only: the engine's built-in idle breath. Beyond `ParamBreath` it also sways
174
194
  * `ParamAngle*`/`ParamBodyAngleX`, so a rig whose head ranges are tuned tightly may want it off.
@@ -985,11 +1005,13 @@ export interface ScenePatch {
985
1005
  * App-level features a client gates on (never version-sniff): `hello` and
986
1006
  * `app.info` report them — the per-app mirror of {@link InstanceRuntime.capabilities}.
987
1007
  */
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"];
1008
+ 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", "tracking-lost"];
989
1009
  export type AppCapability = (typeof APP_CAPABILITIES)[number];
990
1010
  export declare function isAppCapability(v: unknown): v is AppCapability;
991
1011
  /** What a loaded model instance can do; absent capabilities answer `unsupported-for-format`. */
992
- export type InstanceCapability = 'motions' | 'expressions' | 'placement-2d' | 'placement-3d' | 'mtoon' | 'idle-clips' | 'pose' | 'live2d-params'
1012
+ export type InstanceCapability = 'motions' | 'expressions' | 'placement-2d' | 'placement-3d' | 'mtoon' | 'idle-clips'
1013
+ /** `instance.setIdle` with `idleMotion`: one of the model's motions loops as its idle. Live2D only. */
1014
+ | 'idle-motions' | 'pose' | 'live2d-params'
993
1015
  /** `instance.setBreath`; the idle breathing loop is Cubism's, so VRM lacks it. */
994
1016
  | 'breath'
995
1017
  /** `expression.setWeight`; Cubism expressions carry no user-settable weight, so Live2D lacks it. */
@@ -1115,6 +1137,9 @@ export declare const TRACKING_CHANNEL_FIELDS: {
1115
1137
  };
1116
1138
  export declare const TRACKING_CHANNELS: readonly TrackingChannel[];
1117
1139
  export declare const HAND_TRACKING_MODES: readonly ["arms", "fingers"];
1140
+ /** How the face drivers react to a dropout; see `SceneModelInstance.trackingLostBehavior`. */
1141
+ export declare const TRACKING_LOST_BEHAVIORS: readonly ["hold", "idle"];
1142
+ export type TrackingLostBehavior = (typeof TRACKING_LOST_BEHAVIORS)[number];
1118
1143
  export type HandTrackingMode = (typeof HAND_TRACKING_MODES)[number];
1119
1144
  export declare function isHandTrackingMode(v: unknown): v is HandTrackingMode;
1120
1145
  export declare const MEDIAPIPE_DELEGATES: readonly ["CPU", "GPU"];
@@ -47,6 +47,8 @@ export const APP_CAPABILITIES = [
47
47
  'shadow-filters',
48
48
  'environment-map-model',
49
49
  'spawn',
50
+ /** `instance.setIdle` takes `trackingLostBehavior`, `trackingLostMotion` and `trackingLostDelay`. */
51
+ 'tracking-lost',
50
52
  ];
51
53
  export function isAppCapability(v) {
52
54
  return isOneOf(v, APP_CAPABILITIES);
@@ -92,6 +94,8 @@ export const TRACKING_CHANNEL_FIELDS = {
92
94
  };
93
95
  export const TRACKING_CHANNELS = keysOf(TRACKING_CHANNEL_FIELDS);
94
96
  export const HAND_TRACKING_MODES = ['arms', 'fingers'];
97
+ /** How the face drivers react to a dropout; see `SceneModelInstance.trackingLostBehavior`. */
98
+ export const TRACKING_LOST_BEHAVIORS = ['hold', 'idle'];
95
99
  export function isHandTrackingMode(v) {
96
100
  return isOneOf(v, HAND_TRACKING_MODES);
97
101
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laplace.live/persona-sdk",
3
- "version": "1.13.0",
3
+ "version": "1.14.0",
4
4
  "description": "TypeScript SDK and wire schema for the LAPLACE Persona plugin API",
5
5
  "license": "MIT",
6
6
  "type": "module",