@laplace.live/persona-sdk 1.24.0 → 1.25.1

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.
Files changed (44) hide show
  1. package/README.md +10 -10
  2. package/dist/client/client.js +5 -6
  3. package/dist/client/legacy-names.d.ts +2 -0
  4. package/dist/client/{legacy-kinds.js → legacy-names.js} +12 -3
  5. package/dist/client/node.d.ts +13 -0
  6. package/dist/client/node.js +29 -0
  7. package/dist/client/scene-hotkeys.d.ts +16 -0
  8. package/dist/client/scene-hotkeys.js +17 -0
  9. package/dist/index.d.ts +3 -0
  10. package/dist/index.js +3 -0
  11. package/dist/values/bindings.d.ts +40 -15
  12. package/dist/values/controller.d.ts +9 -6
  13. package/dist/values/edit-history.d.ts +4 -0
  14. package/dist/values/edit-history.js +14 -7
  15. package/dist/values/effect-schema.d.ts +26 -0
  16. package/dist/values/effect-schema.js +76 -91
  17. package/dist/values/hotkey-targets.d.ts +10 -3
  18. package/dist/values/hotkey-targets.js +20 -0
  19. package/dist/values/hotkeys.d.ts +9 -1
  20. package/dist/values/hotkeys.js +11 -0
  21. package/dist/values/labels.js +1 -0
  22. package/dist/values/limits.d.ts +96 -8
  23. package/dist/values/limits.js +109 -1
  24. package/dist/values/lipsync.d.ts +7 -8
  25. package/dist/values/locale.d.ts +4 -1
  26. package/dist/values/locale.js +4 -0
  27. package/dist/values/model-movement.d.ts +19 -4
  28. package/dist/values/model-movement.js +17 -4
  29. package/dist/values/volumetric-lighting.d.ts +1 -1
  30. package/dist/values/volumetric-lighting.js +1 -1
  31. package/dist/wire/envelope.js +6 -3
  32. package/dist/wire/methods.d.ts +16 -17
  33. package/dist/wire/protocol.d.ts +2 -0
  34. package/dist/wire/protocol.js +4 -0
  35. package/dist/wire/schemas/fields.d.ts +8 -0
  36. package/dist/wire/schemas/fields.js +1 -0
  37. package/dist/wire/schemas/requests.d.ts +2 -2
  38. package/dist/wire/schemas/requests.js +70 -20
  39. package/dist/wire/schemas/settings.d.ts +3 -3
  40. package/dist/wire/schemas/settings.js +3 -3
  41. package/dist/wire/types.d.ts +68 -115
  42. package/dist/wire/types.js +68 -9
  43. package/package.json +2 -2
  44. package/dist/client/legacy-kinds.d.ts +0 -2
@@ -8,6 +8,8 @@ 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
9
  import { MOUSE_INPUT_NAMES, MOUSE_INPUT_RANGES } from "../values/mouse.js";
10
10
  import { TIME_INPUT_NAMES, TIME_INPUT_RANGES } from "../values/time.js";
11
+ export const MODEL_FORMATS = ['live2d', 'vrm'];
12
+ export const CONTENT_ORIGINS = ['bundled', 'user'];
11
13
  /**
12
14
  * How a registered file is labelled. Wider than an object's content kinds: `.hdr` is only
13
15
  * ever an environment map, and a `.vmd` splits by content — `cameraMotion` for one that
@@ -30,18 +32,22 @@ export function isAssetKind(v) {
30
32
  }
31
33
  // ---- Objects -------------------------------------------------------------------
32
34
  export const OBJECT_SPACES = ['2d', '3d'];
35
+ export const CAPTURE_KINDS = ['display', 'window'];
33
36
  export const TEXT_ALIGNS = ['left', 'center', 'right', 'justify'];
34
37
  /** `baseline` is the first line's baseline — Blender's Top Base-Line. */
35
38
  export const TEXT_VERTICAL_ALIGNS = ['top', 'middle', 'baseline', 'bottom'];
36
39
  /** Blender's text-box overflow: spill past the box, shrink to fit it, or drop the lines that don't fit. */
37
40
  export const TEXT_OVERFLOWS = ['overflow', 'scale', 'truncate'];
38
41
  export const TEXT_STROKE_JOINS = ['round', 'miter', 'bevel'];
42
+ // ---- Scene sections ------------------------------------------------------------
43
+ export const BACKGROUND_MODES = ['transparent', 'color', 'image'];
39
44
  /**
40
45
  * How a following camera turns with its anchor — Warudo's Transposer binding modes. `world` follows
41
46
  * position only; `yaw`, `yaw-pitch` and `full` also turn with it (Lock To Target With World Up, No Roll,
42
47
  * and Lock To Target); `lazy` trails it, turning only as it passes (Simple Follow With World Up).
43
48
  */
44
49
  export const CAMERA_FOLLOW_BINDINGS = ['world', 'yaw', 'yaw-pitch', 'full', 'lazy'];
50
+ export const CAMERA_PROJECTIONS = ['perspective', 'orthographic'];
45
51
  export const SCENE_LIGHT_TYPES = ['directional', 'point', 'ambient', 'area', 'spot'];
46
52
  /**
47
53
  * Per-light shadow tier. `off` is the old `castShadow: false`; the rest raise
@@ -50,10 +56,13 @@ export const SCENE_LIGHT_TYPES = ['directional', 'point', 'ambient', 'area', 'sp
50
56
  */
51
57
  export const SHADOW_QUALITY_LEVELS = ['off', 'low', 'medium', 'high', 'ultra'];
52
58
  export const SHADOW_FILTERS = ['pcf', 'pcss'];
59
+ /** Display transform applied after the scene renders. `none` keeps colors exactly as authored. */
60
+ export const SCENE_TONE_MAPPINGS = ['none', 'neutral', 'aces', 'agx'];
53
61
  // ---- Runtime state -------------------------------------------------------------
54
62
  /**
55
63
  * App-level features a client gates on (never version-sniff): `hello` and
56
64
  * `app.info` report them — the per-app mirror of {@link InstanceRuntime.capabilities}.
65
+ * Each name leads with what it extends (`light-spot`, `object-text`), as action kinds do.
57
66
  */
58
67
  export const APP_CAPABILITIES = [
59
68
  'storage',
@@ -64,14 +73,14 @@ export const APP_CAPABILITIES = [
64
73
  'asset-inspection',
65
74
  'layer-effects',
66
75
  'scene-transitions',
67
- 'area-lights',
68
- 'spot-lights',
69
- 'camera-follow-lights',
70
- 'shadow-filters',
76
+ 'light-area',
77
+ 'light-spot',
78
+ 'light-camera-follow',
79
+ 'light-shadow-filter',
71
80
  'environment-map-model',
72
- 'spawn',
81
+ 'stage-spawn',
73
82
  /** `instance.setIdle` takes `trackingLostBehavior`, `trackingLostMotion` and `trackingLostDelay`. */
74
- 'tracking-lost',
83
+ 'idle-tracking-lost',
75
84
  /** `motion.stop`; `motion.playing` and `motion.started` carry `oneShot`. */
76
85
  'motion-stop',
77
86
  /** `stage.capture`. */
@@ -84,7 +93,7 @@ export const APP_CAPABILITIES = [
84
93
  */
85
94
  'object-pin-depth',
86
95
  /** `text` object content and `fonts.list`. */
87
- 'text-objects',
96
+ 'object-text',
88
97
  /** `SceneCamera.follow`. */
89
98
  'camera-follow',
90
99
  /** `SceneCamera.aim`. */
@@ -94,13 +103,63 @@ export const APP_CAPABILITIES = [
94
103
  /** `SceneCamera.handheld`. */
95
104
  'camera-handheld',
96
105
  /** `object.setContent` edits a video's `loop`, `muted` and `volume` in place; its sound follows the output device. */
97
- 'video-sound',
106
+ 'object-video-sound',
98
107
  /** Image, video and webpage content takes `chromaKey`, which `object.setContent` edits in place. */
99
108
  'object-chroma-key',
109
+ /** `ModelMovementConfig.pivot`, which `model.setMovement` edits. */
110
+ 'model-movement-pivot',
111
+ /** `instance.setEffects` takes objects in `2d` space too; older hosts answer `unsupported-for-format`. */
112
+ 'layer-effects-2d',
100
113
  ];
101
114
  export function isAppCapability(v) {
102
115
  return isOneOf(v, APP_CAPABILITIES);
103
116
  }
117
+ /**
118
+ * Old app capability names, each mapped to its category-first replacement. Hosts still list them for
119
+ * clients from before the rename; the SDK client folds them into the new names on receipt.
120
+ */
121
+ export const LEGACY_APP_CAPABILITIES = new Map([
122
+ ['area-lights', 'light-area'],
123
+ ['spot-lights', 'light-spot'],
124
+ ['camera-follow-lights', 'light-camera-follow'],
125
+ ['shadow-filters', 'light-shadow-filter'],
126
+ ['spawn', 'stage-spawn'],
127
+ ['tracking-lost', 'idle-tracking-lost'],
128
+ ['text-objects', 'object-text'],
129
+ ['video-sound', 'object-video-sound'],
130
+ ]);
131
+ /** The current name of an app capability; names that were never renamed, known or not, pass through. */
132
+ export function canonicalAppCapability(name) {
133
+ return LEGACY_APP_CAPABILITIES.get(name) ?? name;
134
+ }
135
+ /** What a loaded model instance can do; absent capabilities answer `unsupported-for-format`. */
136
+ export const INSTANCE_CAPABILITIES = [
137
+ 'motions',
138
+ 'expressions',
139
+ 'placement-2d',
140
+ 'placement-3d',
141
+ 'mtoon',
142
+ 'idle-clips',
143
+ /** `instance.setIdle` with `idleMotion`: one of the model's motions loops as its idle. Live2D only. */
144
+ 'idle-motions',
145
+ 'pose',
146
+ 'live2d-params',
147
+ /** `instance.setBreath`; the idle breathing loop is Cubism's, so VRM lacks it. */
148
+ 'breath',
149
+ /** `expression.setWeight`; Cubism expressions carry no user-settable weight, so Live2D lacks it. */
150
+ 'expression-weights',
151
+ /**
152
+ * `speech.play` lip-sync. Loaded Live2D models only; 0.53 and earlier hosts also omit it under
153
+ * the Pixi engine, so gate on the runtime, not the format.
154
+ */
155
+ 'speech',
156
+ /**
157
+ * Draws through the 3D post chain, so the scene's look rows (tone mapping, exposure, LUT)
158
+ * reach it. Every model; 0.53 and earlier hosts omit it on Pixi-engine Live2D, so read it off
159
+ * the runtime rather than the format.
160
+ */
161
+ 'post-fx',
162
+ ];
104
163
  // ---- App automations --------------------------------------------------------------
105
164
  /** Action kinds an app automation can carry today; servers may send kinds newer than this list. */
106
165
  export const AUTOMATION_ACTION_KINDS = [
@@ -220,7 +279,7 @@ export function sourceChannelEnabled(source, channel, masters) {
220
279
  export function trackingPortTaken(sources, kind, port, excludeId) {
221
280
  return sources.some(s => s.id !== excludeId && s.port === port && !(s.kind === 'ifacialmocap' && kind === 'ifacialmocap'));
222
281
  }
223
- export const EFFECTS_QUALITY_LEVELS = ['low', 'medium', 'high'];
282
+ export { EFFECTS_QUALITY_LEVELS } from "../values/effect-schema.js";
224
283
  /**
225
284
  * Accepted values for `performance.fpsLimit`; 0 = unlimited. Anything else is snapped
226
285
  * to the nearest preset by the app, so a picker offering other values would lie.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laplace.live/persona-sdk",
3
- "version": "1.24.0",
3
+ "version": "1.25.1",
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": "^5.0.2"
31
+ "vitest": "^5.0.3"
32
32
  },
33
33
  "engines": {
34
34
  "node": ">=24"
@@ -1,2 +0,0 @@
1
- /** A method result or event payload with the action kinds an older host still sends renamed to current ones. */
2
- export declare function renameLegacyKinds(name: string, data: unknown): unknown;