@laplace.live/persona-sdk 1.0.0 → 1.2.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/README.md +3 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/values/effect-schema.d.ts +71 -11
- package/dist/values/effect-schema.js +278 -65
- package/dist/values/hands.d.ts +53 -0
- package/dist/values/hands.js +89 -0
- package/dist/values/lipsync.d.ts +106 -0
- package/dist/values/lipsync.js +120 -0
- package/dist/wire/events.d.ts +1 -1
- package/dist/wire/methods.d.ts +60 -7
- package/dist/wire/protocol.d.ts +1 -1
- package/dist/wire/protocol.js +1 -1
- package/dist/wire/schemas.d.ts +76 -3
- package/dist/wire/schemas.js +28 -0
- package/dist/wire/types.d.ts +245 -83
- package/dist/wire/types.js +55 -5
- package/package.json +2 -2
package/dist/wire/types.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
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 { HAND_INPUT_NAMES, HAND_INPUT_RANGES } from "../values/hands.js";
|
|
7
|
+
import { VOICE_INPUT_NAMES, VOICE_INPUT_RANGES, } from "../values/lipsync.js";
|
|
6
8
|
/**
|
|
7
9
|
* How a registered file is labelled. Wider than an object's content kinds: `.hdr` is only
|
|
8
10
|
* ever an environment map, and a `.vmd` splits by content — `cameraMotion` for one that
|
|
@@ -31,6 +33,7 @@ export const APP_CAPABILITIES = [
|
|
|
31
33
|
'controllers',
|
|
32
34
|
'model-editing',
|
|
33
35
|
'asset-inspection',
|
|
36
|
+
'layer-effects',
|
|
34
37
|
];
|
|
35
38
|
export function isAppCapability(v) {
|
|
36
39
|
return typeof v === 'string' && APP_CAPABILITIES.includes(v);
|
|
@@ -50,14 +53,57 @@ export const TRACKING_SOURCE_IDS = ['persona-ios', 'ifacialmocap', 'vts-ios'];
|
|
|
50
53
|
/** Body-pose protocols. Every one so far is UDP with a configurable port. */
|
|
51
54
|
export const POSE_SOURCE_IDS = ['vmc', 'mocopi'];
|
|
52
55
|
/** Every protocol a tracking source instance can speak; face and body kinds. */
|
|
53
|
-
export const TRACKING_SOURCE_KINDS = [...TRACKING_SOURCE_IDS, ...POSE_SOURCE_IDS];
|
|
54
|
-
|
|
56
|
+
export const TRACKING_SOURCE_KINDS = [...TRACKING_SOURCE_IDS, ...POSE_SOURCE_IDS, 'mediapipe'];
|
|
57
|
+
export const TRACKING_CHANNELS = ['face', 'pose', 'hands'];
|
|
58
|
+
/** The scene-item binding each channel reads and writes. */
|
|
59
|
+
export const TRACKING_CHANNEL_FIELDS = {
|
|
60
|
+
face: 'faceSourceId',
|
|
61
|
+
pose: 'poseSourceId',
|
|
62
|
+
hands: 'handSourceId',
|
|
63
|
+
};
|
|
64
|
+
export const HAND_TRACKING_MODES = ['arms', 'fingers'];
|
|
65
|
+
export function isHandTrackingMode(v) {
|
|
66
|
+
return HAND_TRACKING_MODES.includes(v);
|
|
67
|
+
}
|
|
68
|
+
export const DEFAULT_MEDIAPIPE_CONFIG = {
|
|
69
|
+
deviceId: '',
|
|
70
|
+
mirror: true,
|
|
71
|
+
face: true,
|
|
72
|
+
hands: true,
|
|
73
|
+
body: false,
|
|
74
|
+
delegate: 'CPU',
|
|
75
|
+
};
|
|
76
|
+
/** Whether a source kind uses a network face receiver. */
|
|
55
77
|
export function isFaceSourceKind(kind) {
|
|
56
78
|
return TRACKING_SOURCE_IDS.includes(kind);
|
|
57
79
|
}
|
|
58
|
-
/** Whether a source
|
|
80
|
+
/** Whether a source uses a network body receiver. */
|
|
59
81
|
export function isPoseSource(source) {
|
|
60
|
-
return
|
|
82
|
+
return POSE_SOURCE_IDS.includes(source.kind);
|
|
83
|
+
}
|
|
84
|
+
const FACE_ONLY = ['face'];
|
|
85
|
+
const POSE_ONLY = ['pose'];
|
|
86
|
+
/** The channels a kind can supply; the webcam's are further gated by its task switches. */
|
|
87
|
+
export function sourceKindChannels(kind) {
|
|
88
|
+
return kind === 'mediapipe' ? TRACKING_CHANNELS : isFaceSourceKind(kind) ? FACE_ONLY : POSE_ONLY;
|
|
89
|
+
}
|
|
90
|
+
/** Whether this source can supply a channel; {@link sourceChannelEnabled} folds in the switches. */
|
|
91
|
+
export function sourceSupportsChannel(source, channel) {
|
|
92
|
+
if (!sourceKindChannels(source.kind).includes(channel))
|
|
93
|
+
return false;
|
|
94
|
+
if (source.kind !== 'mediapipe')
|
|
95
|
+
return true;
|
|
96
|
+
const config = source.mediapipe ?? DEFAULT_MEDIAPIPE_CONFIG;
|
|
97
|
+
return channel === 'pose' ? config.body : config[channel];
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Whether a source feeds a channel right now: its own switch, its task, and — for a network
|
|
101
|
+
* face or body source — the channel master. Webcam tasks and hands answer to the source switch alone.
|
|
102
|
+
*/
|
|
103
|
+
export function sourceChannelEnabled(source, channel, masters) {
|
|
104
|
+
if (!source.enabled || !sourceSupportsChannel(source, channel))
|
|
105
|
+
return false;
|
|
106
|
+
return channel === 'hands' || source.kind === 'mediapipe' || masters[channel];
|
|
61
107
|
}
|
|
62
108
|
/**
|
|
63
109
|
* Whether another source already holds `port` and would contend for it. iFacialMocap instances
|
|
@@ -98,11 +144,13 @@ const VTS_INPUT_NAMES = [
|
|
|
98
144
|
'TongueOut',
|
|
99
145
|
];
|
|
100
146
|
/**
|
|
101
|
-
* Default input vocabulary:
|
|
147
|
+
* Default input vocabulary: face and hand inputs, raw ARKit channels and controller profile 1.
|
|
102
148
|
* Additional controller profile ids are accepted by isInputName without appearing in this list.
|
|
103
149
|
*/
|
|
104
150
|
export const INPUT_NAMES = [
|
|
105
151
|
...VTS_INPUT_NAMES,
|
|
152
|
+
...VOICE_INPUT_NAMES,
|
|
153
|
+
...HAND_INPUT_NAMES,
|
|
106
154
|
...ARKIT_INPUT_NAMES,
|
|
107
155
|
...BASE_CONTROLLER_INPUT_NAMES,
|
|
108
156
|
];
|
|
@@ -173,6 +221,8 @@ const ARKIT_RANGE = [0, 1];
|
|
|
173
221
|
*/
|
|
174
222
|
export const INPUT_RANGES = {
|
|
175
223
|
...VTS_INPUT_RANGES,
|
|
224
|
+
...VOICE_INPUT_RANGES,
|
|
225
|
+
...HAND_INPUT_RANGES,
|
|
176
226
|
...BASE_CONTROLLER_INPUT_RANGES,
|
|
177
227
|
// `fromEntries` widens the key type back to `string`; the annotation above is what keeps
|
|
178
228
|
// 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.2.0",
|
|
4
4
|
"description": "TypeScript SDK and wire schema for the LAPLACE Persona plugin API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"rimraf": "^6.1.3",
|
|
30
30
|
"typescript": "~6.0.3",
|
|
31
|
-
"vitest": "^
|
|
31
|
+
"vitest": "^5.0.0"
|
|
32
32
|
},
|
|
33
33
|
"engines": {
|
|
34
34
|
"node": ">=24"
|