@laplace.live/persona-sdk 1.4.0 → 1.5.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/client/client.d.ts +1 -0
- package/dist/client/client.js +3 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/values/controller.d.ts +11 -11
- package/dist/values/controller.js +24 -44
- package/dist/values/curve.d.ts +4 -4
- package/dist/values/effect-schema.js +4 -4
- package/dist/values/guards.d.ts +12 -0
- package/dist/values/guards.js +16 -0
- package/dist/values/hands.d.ts +22 -22
- package/dist/values/hands.js +30 -58
- package/dist/values/hotkeys.d.ts +14 -0
- package/dist/values/hotkeys.js +13 -1
- package/dist/values/labels.d.ts +10 -5
- package/dist/values/labels.js +20 -9
- package/dist/values/lipsync.d.ts +2 -2
- package/dist/values/lipsync.js +2 -15
- package/dist/values/locale.d.ts +9 -4
- package/dist/values/locale.js +4 -3
- package/dist/values/scene-transition.d.ts +14 -0
- package/dist/values/scene-transition.js +36 -0
- package/dist/wire/errors.js +3 -2
- package/dist/wire/events.d.ts +4 -4
- package/dist/wire/events.js +3 -2
- package/dist/wire/methods.d.ts +13 -13
- package/dist/wire/protocol.d.ts +3 -1
- package/dist/wire/protocol.js +3 -1
- package/dist/wire/schemas.d.ts +18 -2
- package/dist/wire/schemas.js +17 -7
- package/dist/wire/types.d.ts +78 -21
- package/dist/wire/types.js +60 -66
- package/package.json +1 -1
package/dist/wire/types.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// filesystem-shaped — model refs are sanitized to ids, never directories.
|
|
4
4
|
import { ARKIT_INPUT_NAMES } from "../values/arkit.js";
|
|
5
5
|
import { BASE_CONTROLLER_INPUT_NAMES, BASE_CONTROLLER_INPUT_RANGES, controllerInputRange, isControllerInputName, } from "../values/controller.js";
|
|
6
|
+
import { isOneOf, keysOf } from "../values/guards.js";
|
|
6
7
|
import { HAND_INPUT_NAMES, HAND_INPUT_RANGES } from "../values/hands.js";
|
|
7
8
|
import { VOICE_INPUT_NAMES, VOICE_INPUT_RANGES, } from "../values/lipsync.js";
|
|
8
9
|
/**
|
|
@@ -13,8 +14,10 @@ import { VOICE_INPUT_NAMES, VOICE_INPUT_RANGES, } from "../values/lipsync.js";
|
|
|
13
14
|
export const ASSET_KINDS = ['image', 'video', 'prop', 'ibl', 'lut', 'animation', 'cameraMotion'];
|
|
14
15
|
/** Narrow a kind string to the set the asset registry owns — models and effects have their own. */
|
|
15
16
|
export function isAssetKind(v) {
|
|
16
|
-
return
|
|
17
|
+
return isOneOf(v, ASSET_KINDS);
|
|
17
18
|
}
|
|
19
|
+
// ---- Objects -------------------------------------------------------------------
|
|
20
|
+
export const OBJECT_SPACES = ['2d', '3d'];
|
|
18
21
|
/**
|
|
19
22
|
* Per-light shadow tier. `off` is the old `castShadow: false`; the rest raise
|
|
20
23
|
* shadow-map resolution. A point light pays 6 cube faces for the same tier a
|
|
@@ -29,42 +32,46 @@ export const SHADOW_QUALITY_LEVELS = ['off', 'low', 'medium', 'high', 'ultra'];
|
|
|
29
32
|
export const APP_CAPABILITIES = [
|
|
30
33
|
'storage',
|
|
31
34
|
'speech',
|
|
32
|
-
'
|
|
35
|
+
'automations',
|
|
33
36
|
'controllers',
|
|
34
37
|
'model-editing',
|
|
35
38
|
'asset-inspection',
|
|
36
39
|
'layer-effects',
|
|
40
|
+
'scene-transitions',
|
|
37
41
|
];
|
|
38
42
|
export function isAppCapability(v) {
|
|
39
|
-
return
|
|
43
|
+
return isOneOf(v, APP_CAPABILITIES);
|
|
40
44
|
}
|
|
41
|
-
// ---- App
|
|
42
|
-
/** Action kinds an app
|
|
43
|
-
export const
|
|
45
|
+
// ---- App automations --------------------------------------------------------------
|
|
46
|
+
/** Action kinds an app automation can carry today; servers may send kinds newer than this list. */
|
|
47
|
+
export const AUTOMATION_ACTION_KINDS = [
|
|
44
48
|
'effect-toggle',
|
|
45
49
|
'effect-params',
|
|
46
50
|
'camera-pose',
|
|
47
51
|
'reset-camera',
|
|
48
52
|
'layer-visibility',
|
|
49
53
|
'stream-mode',
|
|
54
|
+
'delay',
|
|
50
55
|
];
|
|
51
56
|
// ---- Settings ------------------------------------------------------------------
|
|
57
|
+
export const LIVE2D_ENGINES = ['pixi', 'three'];
|
|
52
58
|
export const TRACKING_SOURCE_IDS = ['persona-ios', 'ifacialmocap', 'vts-ios'];
|
|
53
59
|
/** Body-pose protocols. Every one so far is UDP with a configurable port. */
|
|
54
60
|
export const POSE_SOURCE_IDS = ['vmc', 'mocopi'];
|
|
55
61
|
/** Every protocol a tracking source instance can speak; face and body kinds. */
|
|
56
62
|
export const TRACKING_SOURCE_KINDS = [...TRACKING_SOURCE_IDS, ...POSE_SOURCE_IDS, 'mediapipe'];
|
|
57
|
-
export const TRACKING_CHANNELS = ['face', 'pose', 'hands'];
|
|
58
63
|
/** The scene-item binding each channel reads and writes. */
|
|
59
64
|
export const TRACKING_CHANNEL_FIELDS = {
|
|
60
65
|
face: 'faceSourceId',
|
|
61
66
|
pose: 'poseSourceId',
|
|
62
67
|
hands: 'handSourceId',
|
|
63
68
|
};
|
|
69
|
+
export const TRACKING_CHANNELS = keysOf(TRACKING_CHANNEL_FIELDS);
|
|
64
70
|
export const HAND_TRACKING_MODES = ['arms', 'fingers'];
|
|
65
71
|
export function isHandTrackingMode(v) {
|
|
66
|
-
return
|
|
72
|
+
return isOneOf(v, HAND_TRACKING_MODES);
|
|
67
73
|
}
|
|
74
|
+
export const MEDIAPIPE_DELEGATES = ['CPU', 'GPU'];
|
|
68
75
|
export const DEFAULT_MEDIAPIPE_CONFIG = {
|
|
69
76
|
deviceId: '',
|
|
70
77
|
mirror: true,
|
|
@@ -75,11 +82,11 @@ export const DEFAULT_MEDIAPIPE_CONFIG = {
|
|
|
75
82
|
};
|
|
76
83
|
/** Whether a source kind uses a network face receiver. */
|
|
77
84
|
export function isFaceSourceKind(kind) {
|
|
78
|
-
return
|
|
85
|
+
return isOneOf(kind, TRACKING_SOURCE_IDS);
|
|
79
86
|
}
|
|
80
87
|
/** Whether a source uses a network body receiver. */
|
|
81
88
|
export function isPoseSource(source) {
|
|
82
|
-
return
|
|
89
|
+
return isOneOf(source.kind, POSE_SOURCE_IDS);
|
|
83
90
|
}
|
|
84
91
|
const FACE_ONLY = ['face'];
|
|
85
92
|
const POSE_ONLY = ['pose'];
|
|
@@ -119,30 +126,41 @@ export const EFFECTS_QUALITY_LEVELS = ['low', 'medium', 'high'];
|
|
|
119
126
|
*/
|
|
120
127
|
export const FPS_LIMIT_PRESETS = [0, 15, 30, 60, 90];
|
|
121
128
|
// ---- Injection -----------------------------------------------------------------
|
|
129
|
+
/**
|
|
130
|
+
* From VTS's own registry (`FaceTrackingParamInfo.paramNameDictionary`), which is both the
|
|
131
|
+
* range its editor seeds a new parameter with and what every `.vtube.json` was authored
|
|
132
|
+
* against. Two families differ deliberately:
|
|
133
|
+
*
|
|
134
|
+
* - **the brow inputs** are signed here. VTS lists them `0..1`; we derive them as
|
|
135
|
+
* `brow-up − brow-down`, so a frown needs the lower half.
|
|
136
|
+
* - **`JawOpen`** is absent from VTS's registry — it exists there only as a plugin-created
|
|
137
|
+
* parameter, which VTS then special-cases — so its span is the ARKit channel's.
|
|
138
|
+
*/
|
|
139
|
+
const VTS_INPUT_RANGES = {
|
|
140
|
+
FaceAngleX: [-30, 30],
|
|
141
|
+
FaceAngleY: [-30, 30],
|
|
142
|
+
FaceAngleZ: [-90, 90],
|
|
143
|
+
FacePositionX: [-15, 15],
|
|
144
|
+
FacePositionY: [-15, 15],
|
|
145
|
+
FacePositionZ: [-10, 10],
|
|
146
|
+
EyeOpenLeft: [0, 1],
|
|
147
|
+
EyeOpenRight: [0, 1],
|
|
148
|
+
EyeLeftX: [-1, 1],
|
|
149
|
+
EyeLeftY: [-1, 1],
|
|
150
|
+
EyeRightX: [-1, 1],
|
|
151
|
+
EyeRightY: [-1, 1],
|
|
152
|
+
Brows: [-1, 1],
|
|
153
|
+
BrowLeftY: [-1, 1],
|
|
154
|
+
BrowRightY: [-1, 1],
|
|
155
|
+
MouthSmile: [0, 1],
|
|
156
|
+
MouthOpen: [0, 1],
|
|
157
|
+
MouthX: [-1, 1],
|
|
158
|
+
CheekPuff: [0, 1],
|
|
159
|
+
JawOpen: [0, 1],
|
|
160
|
+
TongueOut: [0, 1],
|
|
161
|
+
};
|
|
122
162
|
/** VTS's input vocabulary, plus `JawOpen` — the derived half of {@link INPUT_NAMES}. */
|
|
123
|
-
const VTS_INPUT_NAMES =
|
|
124
|
-
'FaceAngleX',
|
|
125
|
-
'FaceAngleY',
|
|
126
|
-
'FaceAngleZ',
|
|
127
|
-
'FacePositionX',
|
|
128
|
-
'FacePositionY',
|
|
129
|
-
'FacePositionZ',
|
|
130
|
-
'EyeOpenLeft',
|
|
131
|
-
'EyeOpenRight',
|
|
132
|
-
'EyeLeftX',
|
|
133
|
-
'EyeLeftY',
|
|
134
|
-
'EyeRightX',
|
|
135
|
-
'EyeRightY',
|
|
136
|
-
'Brows',
|
|
137
|
-
'BrowLeftY',
|
|
138
|
-
'BrowRightY',
|
|
139
|
-
'MouthSmile',
|
|
140
|
-
'MouthOpen',
|
|
141
|
-
'MouthX',
|
|
142
|
-
'CheekPuff',
|
|
143
|
-
'JawOpen',
|
|
144
|
-
'TongueOut',
|
|
145
|
-
];
|
|
163
|
+
const VTS_INPUT_NAMES = keysOf(VTS_INPUT_RANGES);
|
|
146
164
|
/**
|
|
147
165
|
* Default input vocabulary: face and hand inputs, raw ARKit channels and controller profile 1.
|
|
148
166
|
* Additional controller profile ids are accepted by isInputName without appearing in this list.
|
|
@@ -180,39 +198,6 @@ export const BINDING_INPUT_NAMES = INPUT_NAMES.filter(n => !isArkitTwinAlias(n))
|
|
|
180
198
|
export function arkitTwinOf(input) {
|
|
181
199
|
return isArkitTwinAlias(input) ? ARKIT_TWINS[input] : input;
|
|
182
200
|
}
|
|
183
|
-
/**
|
|
184
|
-
* From VTS's own registry (`FaceTrackingParamInfo.paramNameDictionary`), which is both the
|
|
185
|
-
* range its editor seeds a new parameter with and what every `.vtube.json` was authored
|
|
186
|
-
* against. Two families differ deliberately:
|
|
187
|
-
*
|
|
188
|
-
* - **the brow inputs** are signed here. VTS lists them `0..1`; we derive them as
|
|
189
|
-
* `brow-up − brow-down`, so a frown needs the lower half.
|
|
190
|
-
* - **`JawOpen`** is absent from VTS's registry — it exists there only as a plugin-created
|
|
191
|
-
* parameter, which VTS then special-cases — so its span is the ARKit channel's.
|
|
192
|
-
*/
|
|
193
|
-
const VTS_INPUT_RANGES = {
|
|
194
|
-
FaceAngleX: [-30, 30],
|
|
195
|
-
FaceAngleY: [-30, 30],
|
|
196
|
-
FaceAngleZ: [-90, 90],
|
|
197
|
-
FacePositionX: [-15, 15],
|
|
198
|
-
FacePositionY: [-15, 15],
|
|
199
|
-
FacePositionZ: [-10, 10],
|
|
200
|
-
EyeOpenLeft: [0, 1],
|
|
201
|
-
EyeOpenRight: [0, 1],
|
|
202
|
-
EyeLeftX: [-1, 1],
|
|
203
|
-
EyeLeftY: [-1, 1],
|
|
204
|
-
EyeRightX: [-1, 1],
|
|
205
|
-
EyeRightY: [-1, 1],
|
|
206
|
-
Brows: [-1, 1],
|
|
207
|
-
BrowLeftY: [-1, 1],
|
|
208
|
-
BrowRightY: [-1, 1],
|
|
209
|
-
MouthSmile: [0, 1],
|
|
210
|
-
MouthOpen: [0, 1],
|
|
211
|
-
MouthX: [-1, 1],
|
|
212
|
-
CheekPuff: [0, 1],
|
|
213
|
-
JawOpen: [0, 1],
|
|
214
|
-
TongueOut: [0, 1],
|
|
215
|
-
};
|
|
216
201
|
/** ARKit blendshapes are unit-scale by definition, so every raw channel shares one span. */
|
|
217
202
|
const ARKIT_RANGE = [0, 1];
|
|
218
203
|
/**
|
|
@@ -232,3 +217,12 @@ export const INPUT_RANGES = {
|
|
|
232
217
|
export function getInputRange(name) {
|
|
233
218
|
return isControllerInputName(name) ? controllerInputRange(name) : INPUT_RANGES[name];
|
|
234
219
|
}
|
|
220
|
+
/**
|
|
221
|
+
* What an injected value drives:
|
|
222
|
+
* - `input` — a VTS-vocabulary tracking input (`MouthOpen`, `FaceAngleX`, …), mapped
|
|
223
|
+
* through the model's own tracking rules. Live2D only.
|
|
224
|
+
* - `live2d-param` — a Cubism parameter id, written directly.
|
|
225
|
+
* - `vrm-expression` — reserved, not implemented yet; the server answers
|
|
226
|
+
* `unsupported-for-format`.
|
|
227
|
+
*/
|
|
228
|
+
export const INJECT_TARGET_TYPES = ['input', 'live2d-param', 'vrm-expression'];
|