@laplace.live/persona-sdk 0.2.0 → 0.3.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 +13 -0
- package/dist/methods.d.ts +10 -0
- package/dist/schemas.d.ts +4 -0
- package/dist/schemas.js +1 -0
- package/dist/types.d.ts +37 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -67,3 +67,16 @@ in Persona). The client reports them via `onWarning` and goes `closed`.
|
|
|
67
67
|
Treat the token like a password: it grants control of the app, including loading registered
|
|
68
68
|
models and web overlays. The server listens on loopback unless LAN access is enabled in
|
|
69
69
|
Persona's settings.
|
|
70
|
+
|
|
71
|
+
## Registry and catalog metadata
|
|
72
|
+
|
|
73
|
+
`model.list` / `asset.list` return refs with provenance and attribution: assets carry
|
|
74
|
+
`origin` (`'bundled'` shipped with the app, `'user'` registered by the user; models carry
|
|
75
|
+
the same as `kind`), and both may carry optional `author` / `url` credits sourced from the
|
|
76
|
+
app's content manifest.
|
|
77
|
+
|
|
78
|
+
`CatalogItem` is the transport-agnostic content-metadata shape behind pickers: a stable
|
|
79
|
+
`id` (scene refs key off it), an `InventoryKind`, display `name`, and optional
|
|
80
|
+
`thumbnailUrl`, `version`, `author`, `url`, and `download` (payload location + integrity
|
|
81
|
+
for items not yet on disk — Persona will use this to ship bundled content as
|
|
82
|
+
metadata-only rows downloaded from its CDN on demand).
|
package/dist/methods.d.ts
CHANGED
|
@@ -59,6 +59,11 @@ export interface InstanceAddRequest {
|
|
|
59
59
|
export interface InstanceAddResponse {
|
|
60
60
|
instanceId: string;
|
|
61
61
|
}
|
|
62
|
+
export interface InstanceSetModelRequest {
|
|
63
|
+
instanceId: string;
|
|
64
|
+
modelId: string;
|
|
65
|
+
}
|
|
66
|
+
export type InstanceSetModelResponse = EmptyResponse;
|
|
62
67
|
export interface InstanceRemoveRequest {
|
|
63
68
|
instanceId: string;
|
|
64
69
|
}
|
|
@@ -394,6 +399,11 @@ export interface MethodMap {
|
|
|
394
399
|
request: InstanceAddRequest;
|
|
395
400
|
response: InstanceAddResponse;
|
|
396
401
|
};
|
|
402
|
+
/** Swap a model layer's model in place; placement, primary status, and identity carry over. */
|
|
403
|
+
'instance.setModel': {
|
|
404
|
+
request: InstanceSetModelRequest;
|
|
405
|
+
response: InstanceSetModelResponse;
|
|
406
|
+
};
|
|
397
407
|
/** Removes any scene item — model or object. */
|
|
398
408
|
'instance.remove': {
|
|
399
409
|
request: InstanceRemoveRequest;
|
package/dist/schemas.d.ts
CHANGED
|
@@ -64,6 +64,10 @@ export declare const requestSchemas: {
|
|
|
64
64
|
'instance.add': z.ZodObject<{
|
|
65
65
|
modelId: z.ZodString;
|
|
66
66
|
}, z.core.$strip>;
|
|
67
|
+
'instance.setModel': z.ZodObject<{
|
|
68
|
+
instanceId: z.ZodString;
|
|
69
|
+
modelId: z.ZodString;
|
|
70
|
+
}, z.core.$strip>;
|
|
67
71
|
'object.add': z.ZodObject<{
|
|
68
72
|
content: z.ZodCustom<ObjectContent, ObjectContent>;
|
|
69
73
|
name: z.ZodOptional<z.ZodString>;
|
package/dist/schemas.js
CHANGED
|
@@ -40,6 +40,7 @@ export const requestSchemas = {
|
|
|
40
40
|
'scene.delete': z.object({ sceneId: nonEmpty }),
|
|
41
41
|
'scene.setShortcut': z.object({ sceneId: nonEmpty, accelerator: nonEmpty.nullable() }),
|
|
42
42
|
'instance.add': z.object({ modelId: nonEmpty }),
|
|
43
|
+
'instance.setModel': z.object({ instanceId: nonEmpty, modelId: nonEmpty }),
|
|
43
44
|
'object.add': z.object({
|
|
44
45
|
content: z.custom(isRecord, 'content must be an object'),
|
|
45
46
|
name: nonEmpty.optional(),
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export type ModelFormat = 'live2d' | 'vrm';
|
|
2
2
|
export type ModelKind = 'bundled' | 'user';
|
|
3
|
+
/** Where an item came from: shipped with the app, or added by the user. */
|
|
4
|
+
export type ContentOrigin = 'bundled' | 'user';
|
|
3
5
|
/** A model as the registry lists it. Paths deliberately never cross the wire. */
|
|
4
6
|
export interface ModelRef {
|
|
5
7
|
/** Stable slug, unique per installed model. */
|
|
@@ -7,6 +9,10 @@ export interface ModelRef {
|
|
|
7
9
|
name: string;
|
|
8
10
|
kind: ModelKind;
|
|
9
11
|
format: ModelFormat;
|
|
12
|
+
/** Creator credit, for attribution in pickers. */
|
|
13
|
+
author?: string;
|
|
14
|
+
/** Creator or content homepage (https). */
|
|
15
|
+
url?: string;
|
|
10
16
|
}
|
|
11
17
|
/** How a registered file is labelled. Wider than an object's content kinds: `.hdr` is only ever an environment map. */
|
|
12
18
|
export type AssetKind = 'image' | 'video' | 'prop' | 'ibl' | 'lut';
|
|
@@ -16,7 +22,38 @@ export interface AssetRef {
|
|
|
16
22
|
name: string;
|
|
17
23
|
/** What the extension makes it — an object created from it starts on this kind. */
|
|
18
24
|
kind: AssetKind;
|
|
25
|
+
origin: ContentOrigin;
|
|
19
26
|
exists: boolean;
|
|
27
|
+
/** Creator credit, for attribution in pickers. */
|
|
28
|
+
author?: string;
|
|
29
|
+
/** Creator or content homepage (https). */
|
|
30
|
+
url?: string;
|
|
31
|
+
}
|
|
32
|
+
/** Every content kind the Inventory can list. `pngtuber` is schema-ready before any producer exists. */
|
|
33
|
+
export type InventoryKind = 'live2d' | 'vrm' | 'pngtuber' | 'image' | 'video' | 'prop';
|
|
34
|
+
/**
|
|
35
|
+
* Content metadata decoupled from any on-disk file — local registry entries and
|
|
36
|
+
* remote catalog rows both map into it. `id` is stable forever: scene refs key
|
|
37
|
+
* off it, and it must survive a ship-in-app → download-from-CDN migration.
|
|
38
|
+
*/
|
|
39
|
+
export interface CatalogItem {
|
|
40
|
+
id: string;
|
|
41
|
+
kind: InventoryKind;
|
|
42
|
+
name: string;
|
|
43
|
+
/** `persona://` for local items; CDN https for metadata-only rows. */
|
|
44
|
+
thumbnailUrl?: string;
|
|
45
|
+
/** Payload location + integrity when not on disk; absent = already local. */
|
|
46
|
+
download?: {
|
|
47
|
+
url: string;
|
|
48
|
+
size: number;
|
|
49
|
+
sha256: string;
|
|
50
|
+
};
|
|
51
|
+
/** Content revision, for CDN-side updates of an installed item. */
|
|
52
|
+
version?: string;
|
|
53
|
+
/** Creator credit, for attribution in the Inventory row/detail. */
|
|
54
|
+
author?: string;
|
|
55
|
+
/** Creator or content homepage (https). */
|
|
56
|
+
url?: string;
|
|
20
57
|
}
|
|
21
58
|
/** Screen-space placement: pixels from the stage centre, rotation in radians. */
|
|
22
59
|
export interface ScreenPlacement {
|