lumiverse-spindle-types 0.6.14 → 0.6.16
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/package.json +1 -1
- package/src/api.ts +2 -0
- package/src/dom.ts +71 -0
- package/src/index.ts +4 -0
- package/src/spindle-api.ts +15 -6
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -1536,6 +1536,8 @@ export type RegexMacroModeDTO = "none" | "find" | "raw" | "escaped" | "after";
|
|
|
1536
1536
|
|
|
1537
1537
|
export interface RegexScriptDTO {
|
|
1538
1538
|
id: string;
|
|
1539
|
+
/** True when the calling extension may update or delete this script. */
|
|
1540
|
+
readonly can_mutate: boolean;
|
|
1539
1541
|
name: string;
|
|
1540
1542
|
script_id: string;
|
|
1541
1543
|
find_regex: string;
|
package/src/dom.ts
CHANGED
|
@@ -890,6 +890,61 @@ export interface SpindleDisplayResolverRegistry {
|
|
|
890
890
|
}): void;
|
|
891
891
|
}
|
|
892
892
|
|
|
893
|
+
/** Query options shared by the Lumiverse recent-chats host reads. */
|
|
894
|
+
export interface SpindleRecentChatsQuery {
|
|
895
|
+
limit?: number;
|
|
896
|
+
offset?: number;
|
|
897
|
+
search?: string;
|
|
898
|
+
sort?: "name" | "recent" | "created";
|
|
899
|
+
direction?: "asc" | "desc";
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
/**
|
|
903
|
+
* A flat recent-chat row: one entry per chat, newest-first by default.
|
|
904
|
+
* `message_count` and `last_message_preview` ride along so list UIs never
|
|
905
|
+
* need a per-row message fetch.
|
|
906
|
+
*/
|
|
907
|
+
export interface SpindleRecentChat {
|
|
908
|
+
id: string;
|
|
909
|
+
character_id: string;
|
|
910
|
+
name: string;
|
|
911
|
+
created_at: number;
|
|
912
|
+
updated_at: number;
|
|
913
|
+
character_name: string;
|
|
914
|
+
character_image_id: string | null;
|
|
915
|
+
character_avatar_path?: string | null;
|
|
916
|
+
message_count: number;
|
|
917
|
+
last_message_preview: string;
|
|
918
|
+
[key: string]: unknown;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
/**
|
|
922
|
+
* A grouped recent-chat row: one entry per solo character / group member
|
|
923
|
+
* set, pointing at that lineage's most recent chat.
|
|
924
|
+
*/
|
|
925
|
+
export interface SpindleGroupedRecentChat {
|
|
926
|
+
character_id: string;
|
|
927
|
+
character_name: string;
|
|
928
|
+
character_image_id: string | null;
|
|
929
|
+
character_avatar_path?: string | null;
|
|
930
|
+
latest_chat_id: string;
|
|
931
|
+
latest_chat_name: string;
|
|
932
|
+
updated_at: number;
|
|
933
|
+
chat_count: number;
|
|
934
|
+
is_group: boolean;
|
|
935
|
+
group_character_ids?: string[];
|
|
936
|
+
group_name?: string;
|
|
937
|
+
multiplayer?: boolean;
|
|
938
|
+
[key: string]: unknown;
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
/** Paginated recent-chats response (`data` + `total`). */
|
|
942
|
+
export interface SpindleRecentChatsPage<TRow = SpindleRecentChat> {
|
|
943
|
+
data: TRow[];
|
|
944
|
+
total: number;
|
|
945
|
+
[key: string]: unknown;
|
|
946
|
+
}
|
|
947
|
+
|
|
893
948
|
/** Context object provided to frontend extension modules */
|
|
894
949
|
export interface SpindleFrontendContext {
|
|
895
950
|
/** Immutable host compatibility descriptor for this extension runtime. */
|
|
@@ -1078,6 +1133,22 @@ export interface SpindleFrontendContext {
|
|
|
1078
1133
|
chats: {
|
|
1079
1134
|
/** Update a message through the host app's authenticated API. */
|
|
1080
1135
|
updateMessage(chatId: string, messageId: string, input: { content?: string }): Promise<unknown>;
|
|
1136
|
+
/**
|
|
1137
|
+
* Lumiverse host extension: flat one-row-per-chat recent list with
|
|
1138
|
+
* server-side search/sort and per-row preview enrichment. Free
|
|
1139
|
+
* (session-authenticated REST read). Undefined on hosts without it.
|
|
1140
|
+
*/
|
|
1141
|
+
listRecent?(options?: SpindleRecentChatsQuery): Promise<SpindleRecentChatsPage<SpindleRecentChat>>;
|
|
1142
|
+
/**
|
|
1143
|
+
* Lumiverse host extension: recent chats grouped per character/group with
|
|
1144
|
+
* server-side search, sort, and pagination. Free (session-authenticated
|
|
1145
|
+
* REST read). Undefined on hosts without it.
|
|
1146
|
+
*/
|
|
1147
|
+
listRecentGrouped?(options?: SpindleRecentChatsQuery): Promise<SpindleRecentChatsPage<SpindleGroupedRecentChat>>;
|
|
1148
|
+
/** Lumiverse host extension: rename a chat / merge metadata (permission: "chats"). */
|
|
1149
|
+
update?(chatId: string, input: { name?: string; metadata?: Record<string, unknown> }): Promise<unknown>;
|
|
1150
|
+
/** Lumiverse host extension: permanently delete a chat (permission: "chats"). */
|
|
1151
|
+
delete?(chatId: string): Promise<void>;
|
|
1081
1152
|
};
|
|
1082
1153
|
/** Take over display-time content resolution in the browser. */
|
|
1083
1154
|
display?: SpindleDisplayResolverRegistry;
|
package/src/index.ts
CHANGED
|
@@ -267,6 +267,10 @@ export type {
|
|
|
267
267
|
SpindleMessageWidgetOptions,
|
|
268
268
|
PermissionRequestOptions,
|
|
269
269
|
SpindleFrontendContext,
|
|
270
|
+
SpindleRecentChatsQuery,
|
|
271
|
+
SpindleRecentChat,
|
|
272
|
+
SpindleGroupedRecentChat,
|
|
273
|
+
SpindleRecentChatsPage,
|
|
270
274
|
SpindleFrontendModule,
|
|
271
275
|
SpindleFrontendTeardown,
|
|
272
276
|
SpindleGuideDefinition,
|
package/src/spindle-api.ts
CHANGED
|
@@ -312,9 +312,14 @@ export interface SpindleAPI {
|
|
|
312
312
|
/** Subscribe to a Lumiverse event. Multi-user extensions should use the optional `userId` to keep per-user state and notifications isolated. */
|
|
313
313
|
on(event: string, handler: (payload: unknown, userId?: string) => void): () => void;
|
|
314
314
|
|
|
315
|
-
/**
|
|
315
|
+
/**
|
|
316
|
+
* Register a macro owned by this extension. Registrations cannot replace
|
|
317
|
+
* system macros or macros owned by another extension. Preset/request dynamic
|
|
318
|
+
* macros take precedence over extension macros with the same name.
|
|
319
|
+
* Handler contexts expose `commit === false` during dry resolves.
|
|
320
|
+
*/
|
|
316
321
|
registerMacro(def: MacroDefinitionDTO): void;
|
|
317
|
-
/** Unregister a macro */
|
|
322
|
+
/** Unregister a macro owned by this extension. */
|
|
318
323
|
unregisterMacro(name: string): void;
|
|
319
324
|
/**
|
|
320
325
|
* Push the latest value for a registered macro.
|
|
@@ -1012,10 +1017,14 @@ export interface SpindleAPI {
|
|
|
1012
1017
|
};
|
|
1013
1018
|
|
|
1014
1019
|
/**
|
|
1015
|
-
* Regex Scripts
|
|
1016
|
-
*
|
|
1017
|
-
*
|
|
1018
|
-
*
|
|
1020
|
+
* Regex Scripts API (permission: "regex_scripts").
|
|
1021
|
+
* Read access to regex scripts attached to the user's account and write
|
|
1022
|
+
* access to unbound scripts created by the calling extension. Legacy or
|
|
1023
|
+
* unattributed scripts, preset-bound scripts, and scripts owned by another
|
|
1024
|
+
* extension remain readable and executable but cannot be updated or deleted.
|
|
1025
|
+
* Check `RegexScriptDTO.can_mutate` before presenting mutation controls.
|
|
1026
|
+
* Uses the same shape Lumiverse applies internally during prompt assembly,
|
|
1027
|
+
* response baking, and display rendering.
|
|
1019
1028
|
* For user-scoped extensions, userId is inferred from the extension owner.
|
|
1020
1029
|
* For operator-scoped extensions, pass userId to scope to a specific user.
|
|
1021
1030
|
*/
|