@laplace.live/persona-sdk 0.6.0 → 0.8.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.
@@ -109,6 +109,13 @@ export interface SceneModelItem {
109
109
  instanceId: string;
110
110
  ref: ModelRef;
111
111
  visible: boolean;
112
+ /**
113
+ * Face source tracking this instance ({@link TrackingSourceConfig.id}); null = its face is untracked.
114
+ * A dangling or disabled id behaves as null. One source may track several instances (mirroring).
115
+ */
116
+ faceSourceId: string | null;
117
+ /** Body source (vmc) tracking this instance; null = its pose is untracked. New instances bind to each channel's default source. */
118
+ poseSourceId: string | null;
112
119
  live2d: ScreenPlacement;
113
120
  vrm: VrmPlacement;
114
121
  idleAnimation: boolean;
@@ -371,6 +378,24 @@ export interface SceneDroplets {
371
378
  /** Specular glint on drops where the frame is transparent, so rain reads over the desktop (0 to 1). */
372
379
  glints: number;
373
380
  }
381
+ /** Compute-driven snowfall in the 3D scene: flakes drift down, settle on models and props, then melt. */
382
+ export interface SceneSnow {
383
+ enabled: boolean;
384
+ /** How many flakes are alive at once. */
385
+ amount: number;
386
+ /** Fall and drift clock multiplier. */
387
+ speed: number;
388
+ /** Steady sideways drift, in metres per second along the stage's x axis. */
389
+ wind: number;
390
+ /** Horizontal wobble while falling. */
391
+ sway: number;
392
+ /** Flake size multiplier. */
393
+ size: number;
394
+ /** Seconds a settled flake rests before it finishes melting away. */
395
+ melt: number;
396
+ /** Flake opacity. */
397
+ opacity: number;
398
+ }
374
399
  /**
375
400
  * Post-processing over the rendered 3D frame. Everything off skips the effect
376
401
  * chain entirely. Deliberately flat: every toggle-plus-numbers effect sits at
@@ -391,6 +416,7 @@ export interface SceneEffects {
391
416
  pixelate: ScenePixelate;
392
417
  glitch: SceneGlitch;
393
418
  droplets: SceneDroplets;
419
+ snow: SceneSnow;
394
420
  }
395
421
  /**
396
422
  * Image-based lighting for the 3D stage: an environment map, whether to show it
@@ -438,8 +464,17 @@ export interface ScenePatch {
438
464
  lights?: SceneLight[];
439
465
  environment?: SceneEnvironment;
440
466
  }
467
+ /**
468
+ * App-level features a client gates on (never version-sniff): `hello` and
469
+ * `app.info` report them — the per-app mirror of {@link InstanceRuntime.capabilities}.
470
+ */
471
+ export declare const APP_CAPABILITIES: readonly ["storage", "speech"];
472
+ export type AppCapability = (typeof APP_CAPABILITIES)[number];
473
+ export declare function isAppCapability(v: unknown): v is AppCapability;
441
474
  /** What a loaded model instance can do; absent capabilities answer `unsupported-for-format`. */
442
- export type InstanceCapability = 'motions' | 'expressions' | 'placement-2d' | 'placement-3d' | 'mtoon' | 'idle-clips' | 'pose' | 'live2d-params';
475
+ export type InstanceCapability = 'motions' | 'expressions' | 'placement-2d' | 'placement-3d' | 'mtoon' | 'idle-clips' | 'pose' | 'live2d-params'
476
+ /** `speech.play` lip-sync; engine-dependent, so gate on the runtime, not the format. */
477
+ | 'speech';
443
478
  export interface InstanceRuntime {
444
479
  instanceId: string;
445
480
  kind: 'model' | 'object';
@@ -503,10 +538,40 @@ export interface ExpressionPersistence {
503
538
  enabled: boolean;
504
539
  saved: string[];
505
540
  }
506
- export type TrackingSourceId = 'vts-ios' | 'vts-ios-native' | 'ifacialmocap';
507
- export type PoseSourceId = 'vmc';
541
+ /** Any JSON-serializable value what `storage.set` accepts and `storage.get` returns. */
542
+ export type JsonValue = string | number | boolean | null | JsonValue[] | {
543
+ [key: string]: JsonValue;
544
+ };
545
+ export declare const TRACKING_SOURCE_IDS: readonly ["vts-ios", "vts-ios-native", "ifacialmocap"];
546
+ export type TrackingSourceId = (typeof TRACKING_SOURCE_IDS)[number];
547
+ /** Body-pose protocols. Every one so far is UDP with a configurable port. */
548
+ export declare const POSE_SOURCE_IDS: readonly ["vmc"];
549
+ export type PoseSourceId = (typeof POSE_SOURCE_IDS)[number];
508
550
  export type TrackingStatus = 'off' | 'waiting' | 'tracking' | 'no-face';
509
551
  export type PoseStatus = 'off' | 'waiting' | 'tracking';
552
+ /** Every protocol a tracking source instance can speak; face kinds plus the body (vmc) kind. */
553
+ export declare const TRACKING_SOURCE_KINDS: readonly ["vts-ios", "vts-ios-native", "ifacialmocap", "vmc"];
554
+ export type TrackingSourceKind = (typeof TRACKING_SOURCE_KINDS)[number];
555
+ /** Whether a source kind feeds the face channel (vmc is the body channel). */
556
+ export declare function isFaceSourceKind(kind: TrackingSourceKind): kind is TrackingSourceId;
557
+ /**
558
+ * One configured tracking source instance. Several can run at once — one per person —
559
+ * and scene model instances bind to them by id (`SceneModelItem.faceSourceId`/`poseSourceId`).
560
+ */
561
+ export interface TrackingSourceConfig {
562
+ id: string;
563
+ kind: TrackingSourceKind;
564
+ /** User label shown in lists; '' renders as the kind's own label. */
565
+ name: string;
566
+ enabled: boolean;
567
+ /**
568
+ * Face kinds: accept only this device/sender IP; null accepts any sender not claimed
569
+ * by a pinned instance of the same kind. Ignored by vmc (its senders pick the port).
570
+ */
571
+ phoneIp: string | null;
572
+ /** vmc only: the UDP port this instance listens on. Null on face kinds — they bind per protocol. */
573
+ port: number | null;
574
+ }
510
575
  export declare const EFFECTS_QUALITY_LEVELS: readonly ["low", "medium", "high"];
511
576
  export type EffectsQuality = (typeof EFFECTS_QUALITY_LEVELS)[number];
512
577
  /**
@@ -529,10 +594,13 @@ export interface Settings {
529
594
  selectionOutline: boolean;
530
595
  effectsQuality: EffectsQuality;
531
596
  };
597
+ /** `source` mirrors the first face source's kind — the pre-multi-source field, kept for old clients. */
532
598
  tracking: {
533
599
  enabled: boolean;
534
600
  source: TrackingSourceId;
601
+ sources: TrackingSourceConfig[];
535
602
  };
603
+ /** `source`/`port` mirror the first vmc source — the pre-multi-source fields, kept for old clients. */
536
604
  pose: {
537
605
  enabled: boolean;
538
606
  source: PoseSourceId;
@@ -7,6 +7,25 @@
7
7
  * directional light covers with one map, so it gets the smaller of the pair.
8
8
  */
9
9
  export const SHADOW_QUALITY_LEVELS = ['off', 'low', 'medium', 'high', 'extra'];
10
+ // ---- Runtime state -------------------------------------------------------------
11
+ /**
12
+ * App-level features a client gates on (never version-sniff): `hello` and
13
+ * `app.info` report them — the per-app mirror of {@link InstanceRuntime.capabilities}.
14
+ */
15
+ export const APP_CAPABILITIES = ['storage', 'speech'];
16
+ export function isAppCapability(v) {
17
+ return typeof v === 'string' && APP_CAPABILITIES.includes(v);
18
+ }
19
+ // ---- Settings ------------------------------------------------------------------
20
+ export const TRACKING_SOURCE_IDS = ['vts-ios', 'vts-ios-native', 'ifacialmocap'];
21
+ /** Body-pose protocols. Every one so far is UDP with a configurable port. */
22
+ export const POSE_SOURCE_IDS = ['vmc'];
23
+ /** Every protocol a tracking source instance can speak; face kinds plus the body (vmc) kind. */
24
+ export const TRACKING_SOURCE_KINDS = [...TRACKING_SOURCE_IDS, ...POSE_SOURCE_IDS];
25
+ /** Whether a source kind feeds the face channel (vmc is the body channel). */
26
+ export function isFaceSourceKind(kind) {
27
+ return TRACKING_SOURCE_IDS.includes(kind);
28
+ }
10
29
  export const EFFECTS_QUALITY_LEVELS = ['low', 'medium', 'high'];
11
30
  /**
12
31
  * Accepted values for `performance.fpsLimit`; 0 = unlimited. Anything else is snapped
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laplace.live/persona-sdk",
3
- "version": "0.6.0",
3
+ "version": "0.8.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": "^4.1.10"
31
+ "vitest": "^4.1.11"
32
32
  },
33
33
  "engines": {
34
34
  "node": ">=22"
File without changes
File without changes
File without changes