@laplace.live/persona-sdk 1.17.0 → 1.18.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.
@@ -162,6 +162,10 @@ export declare const SPAWN_ALIVE_MAX = 500;
162
162
  export declare const SPAWN_SPREAD_MAX = 20;
163
163
  export declare const SPAWN_SPEED_MAX = 50;
164
164
  export declare const SPAWN_TTL_MAX_MS = 600000;
165
+ /** `stage.capture` longest-edge bounds and default, px. */
166
+ export declare const STAGE_CAPTURE_EDGE_MIN = 64;
167
+ export declare const STAGE_CAPTURE_EDGE_MAX = 2048;
168
+ export declare const STAGE_CAPTURE_EDGE_DEFAULT = 1024;
165
169
  /** Web object viewport bounds, CSS px per side. */
166
170
  export declare const WEB_SIZE_MIN = 16;
167
171
  export declare const WEB_SIZE_MAX = 7680;
@@ -282,6 +282,10 @@ export const SPAWN_ALIVE_MAX = 500;
282
282
  export const SPAWN_SPREAD_MAX = 20;
283
283
  export const SPAWN_SPEED_MAX = 50;
284
284
  export const SPAWN_TTL_MAX_MS = 600_000;
285
+ /** `stage.capture` longest-edge bounds and default, px. */
286
+ export const STAGE_CAPTURE_EDGE_MIN = 64;
287
+ export const STAGE_CAPTURE_EDGE_MAX = 2048;
288
+ export const STAGE_CAPTURE_EDGE_DEFAULT = 1024;
285
289
  /** Web object viewport bounds, CSS px per side. */
286
290
  export const WEB_SIZE_MIN = 16;
287
291
  export const WEB_SIZE_MAX = 7680;
@@ -23,6 +23,7 @@ export interface SceneActivateRequest {
23
23
  }
24
24
  export type SceneActivateResponse = SceneState;
25
25
  export type SceneCreateRequest = EmptyRequest;
26
+ /** The create activates the scene it adds: `activeSceneId` is the new scene's id. */
26
27
  export type SceneCreateResponse = SceneState;
27
28
  export interface SceneDuplicateRequest {
28
29
  sceneId: string;
@@ -493,6 +494,20 @@ export type StageClearSpawnedRequest = EmptyRequest;
493
494
  export interface StageClearSpawnedResponse {
494
495
  cleared: number;
495
496
  }
497
+ /**
498
+ * A PNG of the stage window as it is displayed — what a client that cannot see the screen
499
+ * checks its edits against. Each capture costs the stage a frame, so read on demand, never poll.
500
+ */
501
+ export interface StageCaptureRequest {
502
+ /** Longest edge in px, `STAGE_CAPTURE_EDGE_MIN`–`STAGE_CAPTURE_EDGE_MAX`; default `STAGE_CAPTURE_EDGE_DEFAULT`. */
503
+ maxEdge?: number;
504
+ }
505
+ export interface StageCaptureResponse {
506
+ /** `data:image/png;base64,…`, alpha preserved. */
507
+ dataUrl: string;
508
+ width: number;
509
+ height: number;
510
+ }
496
511
  export type AppInfoRequest = EmptyRequest;
497
512
  export interface AppInfoResponse {
498
513
  name: string;
@@ -1024,6 +1039,11 @@ export interface MethodMap {
1024
1039
  request: StageClearSpawnedRequest;
1025
1040
  response: StageClearSpawnedResponse;
1026
1041
  };
1042
+ /** Needs the `stage-capture` app capability. */
1043
+ 'stage.capture': {
1044
+ request: StageCaptureRequest;
1045
+ response: StageCaptureResponse;
1046
+ };
1027
1047
  'app.info': {
1028
1048
  request: AppInfoRequest;
1029
1049
  response: AppInfoResponse;
@@ -1089,3 +1109,4 @@ export interface MethodMap {
1089
1109
  export type MethodName = keyof MethodMap;
1090
1110
  export type MethodRequest<M extends MethodName> = MethodMap[M]['request'];
1091
1111
  export type MethodResponse<M extends MethodName> = MethodMap[M]['response'];
1112
+ export declare const METHOD_NAMES: readonly MethodName[];
@@ -1 +1,109 @@
1
- export {};
1
+ // Built from a `Record<MethodName, …>` so a new MethodMap key that is missing
2
+ // here fails the build instead of silently dropping out of the runtime list.
3
+ export const METHOD_NAMES = Object.keys({
4
+ 'scene.list': true,
5
+ 'scene.get': true,
6
+ 'scene.activate': true,
7
+ 'scene.create': true,
8
+ 'scene.duplicate': true,
9
+ 'scene.rename': true,
10
+ 'scene.delete': true,
11
+ 'scene.patch': true,
12
+ 'scene.setLightFollowCamera': true,
13
+ 'scene.inspect': true,
14
+ 'instance.list': true,
15
+ 'instance.get': true,
16
+ 'instance.add': true,
17
+ 'instance.setModel': true,
18
+ 'instance.remove': true,
19
+ 'instance.setVisible': true,
20
+ 'instance.setEffects': true,
21
+ 'instance.setTrackingSources': true,
22
+ 'instance.setControllerMovement': true,
23
+ 'instance.reorder': true,
24
+ 'instance.setPrimary': true,
25
+ 'instance.setPlacement': true,
26
+ 'instance.attach': true,
27
+ 'instance.setMToon': true,
28
+ 'instance.setIdle': true,
29
+ 'instance.setBreath': true,
30
+ 'instance.setLipSync': true,
31
+ 'instance.info': true,
32
+ 'selection.set': true,
33
+ 'selection.get': true,
34
+ 'object.add': true,
35
+ 'object.addMany': true,
36
+ 'object.rename': true,
37
+ 'object.setContent': true,
38
+ 'object.setSpace': true,
39
+ 'object.setPlacement': true,
40
+ 'object.attach': true,
41
+ 'object.setLightOverrides': true,
42
+ 'object.anchors': true,
43
+ 'expression.list': true,
44
+ 'expression.active': true,
45
+ 'expression.toggle': true,
46
+ 'expression.setWeight': true,
47
+ 'expression.getPersistence': true,
48
+ 'expression.setPersistence': true,
49
+ 'motion.list': true,
50
+ 'motion.play': true,
51
+ 'motion.playAsset': true,
52
+ 'motion.playing': true,
53
+ 'motion.stop': true,
54
+ 'speech.play': true,
55
+ 'speech.stop': true,
56
+ 'hotkey.list': true,
57
+ 'hotkey.set': true,
58
+ 'hotkey.trigger': true,
59
+ 'automation.list': true,
60
+ 'automation.run': true,
61
+ 'model.list': true,
62
+ 'model.register': true,
63
+ 'asset.list': true,
64
+ 'asset.register': true,
65
+ 'registry.thumbnail': true,
66
+ 'settings.get': true,
67
+ 'settings.patch': true,
68
+ 'tracking.status': true,
69
+ 'tracking.setEnabled': true,
70
+ 'tracking.setSource': true,
71
+ 'tracking.addSource': true,
72
+ 'tracking.updateSource': true,
73
+ 'tracking.removeSource': true,
74
+ 'pose.setEnabled': true,
75
+ 'pose.setSource': true,
76
+ 'pose.setPort': true,
77
+ 'lipSync.state': true,
78
+ 'lipSync.configure': true,
79
+ 'lipSync.restart': true,
80
+ 'lipSync.calibrate': true,
81
+ 'binding.get': true,
82
+ 'binding.preview': true,
83
+ 'binding.set': true,
84
+ 'binding.release': true,
85
+ 'binding.inputs': true,
86
+ 'binding.override': true,
87
+ 'controller.state': true,
88
+ 'controller.rename': true,
89
+ 'controller.setDeadZone': true,
90
+ 'controller.remove': true,
91
+ 'controller.assign': true,
92
+ 'stage.resetTransform': true,
93
+ 'stage.resetCamera': true,
94
+ 'stage.spawn': true,
95
+ 'stage.clearSpawned': true,
96
+ 'stage.capture': true,
97
+ 'app.info': true,
98
+ 'app.localAddresses': true,
99
+ 'app.stats': true,
100
+ 'session.identify': true,
101
+ 'storage.get': true,
102
+ 'storage.set': true,
103
+ 'storage.delete': true,
104
+ 'storage.list': true,
105
+ 'events.subscribe': true,
106
+ 'events.unsubscribe': true,
107
+ 'param.inject': true,
108
+ 'param.release': true,
109
+ });
@@ -330,6 +330,9 @@ export declare const requestSchemas: {
330
330
  outMs: z.ZodOptional<z.ZodNumber>;
331
331
  }, z.core.$strip>>;
332
332
  }, z.core.$strip>;
333
+ 'stage.capture': z.ZodObject<{
334
+ maxEdge: z.ZodOptional<z.ZodNumber>;
335
+ }, z.core.$strip>;
333
336
  'events.subscribe': z.ZodObject<{
334
337
  events: z.ZodArray<z.ZodCustom<keyof import("../events.ts").EventMap, keyof import("../events.ts").EventMap>>;
335
338
  }, z.core.$strip>;
@@ -2,7 +2,7 @@ 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
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
+ import { OBJECT_ADD_MANY_MAX, SCENE_COLOR_RE, SPEECH_URL_MAX_LENGTH, STAGE_CAPTURE_EDGE_MAX, STAGE_CAPTURE_EDGE_MIN, STORAGE_KEY_MAX_LENGTH, STORAGE_VALUE_MAX_LENGTH, } from "../../values/limits.js";
6
6
  import { LIP_SYNC_CALIBRATION_ACTIONS, LIP_SYNC_MODES, LIP_SYNC_PHONEMES, } from "../../values/lipsync.js";
7
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";
8
8
  import { ASSET_KINDS, INJECT_TARGET_TYPES, POSE_SOURCE_IDS, TRACKING_SOURCE_IDS, TRACKING_SOURCE_KINDS, } from "../types.js";
@@ -168,6 +168,9 @@ export const requestSchemas = {
168
168
  })
169
169
  .optional(),
170
170
  }),
171
+ 'stage.capture': z.object({
172
+ maxEdge: z.number().int().min(STAGE_CAPTURE_EDGE_MIN).max(STAGE_CAPTURE_EDGE_MAX).optional(),
173
+ }),
171
174
  'events.subscribe': z.object({ events: z.array(lenientEventNameSchema).min(1) }),
172
175
  'events.unsubscribe': z.object({ events: z.array(lenientEventNameSchema).optional() }),
173
176
  'param.inject': z.object({ entries: z.array(InjectEntrySchema).min(1) }),
@@ -1041,7 +1041,7 @@ export interface ScenePatch {
1041
1041
  * App-level features a client gates on (never version-sniff): `hello` and
1042
1042
  * `app.info` report them — the per-app mirror of {@link InstanceRuntime.capabilities}.
1043
1043
  */
1044
- 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", "motion-stop"];
1044
+ 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", "motion-stop", "stage-capture"];
1045
1045
  export type AppCapability = (typeof APP_CAPABILITIES)[number];
1046
1046
  export declare function isAppCapability(v: unknown): v is AppCapability;
1047
1047
  /** What a loaded model instance can do; absent capabilities answer `unsupported-for-format`. */
@@ -51,6 +51,8 @@ export const APP_CAPABILITIES = [
51
51
  'tracking-lost',
52
52
  /** `motion.stop`; `motion.playing` and `motion.started` carry `oneShot`. */
53
53
  'motion-stop',
54
+ /** `stage.capture`. */
55
+ 'stage-capture',
54
56
  ];
55
57
  export function isAppCapability(v) {
56
58
  return isOneOf(v, APP_CAPABILITIES);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laplace.live/persona-sdk",
3
- "version": "1.17.0",
3
+ "version": "1.18.0",
4
4
  "description": "TypeScript SDK and wire schema for the LAPLACE Persona plugin API",
5
5
  "license": "MIT",
6
6
  "type": "module",