lumiverse-spindle-types 0.2.3 → 0.2.5
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/dom.ts +40 -0
- package/src/spindle-api.ts +34 -0
package/package.json
CHANGED
package/src/dom.ts
CHANGED
|
@@ -165,6 +165,26 @@ export interface PermissionRequestOptions {
|
|
|
165
165
|
reason?: string;
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
+
// ── Text Editor ──
|
|
169
|
+
|
|
170
|
+
export interface SpindleTextEditorOptions {
|
|
171
|
+
/** Modal title. Default: "Edit Text" */
|
|
172
|
+
title?: string;
|
|
173
|
+
/** Initial text content. Default: "" */
|
|
174
|
+
value?: string;
|
|
175
|
+
/** Placeholder text. Default: "" */
|
|
176
|
+
placeholder?: string;
|
|
177
|
+
/** Enable macro syntax highlighting and insertion panel. Default: true */
|
|
178
|
+
macros?: boolean;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export interface SpindleTextEditorResult {
|
|
182
|
+
/** The edited text (or original value if cancelled) */
|
|
183
|
+
text: string;
|
|
184
|
+
/** True if the user dismissed the editor without confirming */
|
|
185
|
+
cancelled: boolean;
|
|
186
|
+
}
|
|
187
|
+
|
|
168
188
|
/** Context object provided to frontend extension modules */
|
|
169
189
|
export interface SpindleFrontendContext {
|
|
170
190
|
dom: SpindleDOMHelper;
|
|
@@ -179,6 +199,26 @@ export interface SpindleFrontendContext {
|
|
|
179
199
|
requestDockPanel(options: SpindleDockPanelOptions): SpindleDockPanelHandle;
|
|
180
200
|
mountApp(options?: SpindleAppMountOptions): SpindleAppMountHandle;
|
|
181
201
|
registerInputBarAction(options: SpindleInputBarActionOptions): SpindleInputBarActionHandle;
|
|
202
|
+
/**
|
|
203
|
+
* Open the native Lumiverse expanded text editor modal.
|
|
204
|
+
* Provides macro syntax highlighting, macro insertion panel with search,
|
|
205
|
+
* and a full-screen editing experience.
|
|
206
|
+
*
|
|
207
|
+
* Returns a Promise that resolves when the user closes the editor.
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* ```ts
|
|
211
|
+
* const result = await ctx.ui.openTextEditor({
|
|
212
|
+
* title: 'Edit System Prompt',
|
|
213
|
+
* value: currentText,
|
|
214
|
+
* macros: true,
|
|
215
|
+
* })
|
|
216
|
+
* if (!result.cancelled) {
|
|
217
|
+
* currentText = result.text
|
|
218
|
+
* }
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
openTextEditor(options?: SpindleTextEditorOptions): Promise<SpindleTextEditorResult>;
|
|
182
222
|
};
|
|
183
223
|
uploads: {
|
|
184
224
|
pickFile(options?: {
|
package/src/spindle-api.ts
CHANGED
|
@@ -402,6 +402,40 @@ export interface SpindleAPI {
|
|
|
402
402
|
}>;
|
|
403
403
|
};
|
|
404
404
|
|
|
405
|
+
/**
|
|
406
|
+
* Macro resolution (free tier — no permission needed).
|
|
407
|
+
* Resolve `{{macro}}` placeholders in arbitrary text using
|
|
408
|
+
* the full Lumiverse macro engine (character fields, chat context,
|
|
409
|
+
* variables, time/date, random, etc.).
|
|
410
|
+
*/
|
|
411
|
+
macros: {
|
|
412
|
+
/**
|
|
413
|
+
* Resolve all macros in the given template string.
|
|
414
|
+
* Provide `chatId` and/or `characterId` for full context resolution.
|
|
415
|
+
* Without them, only context-free macros (time, random, etc.) resolve.
|
|
416
|
+
*
|
|
417
|
+
* @example
|
|
418
|
+
* ```ts
|
|
419
|
+
* const { text } = await spindle.macros.resolve(
|
|
420
|
+
* 'Hello {{user}}, I am {{char}}!',
|
|
421
|
+
* { chatId: 'abc', characterId: 'xyz' },
|
|
422
|
+
* )
|
|
423
|
+
* ```
|
|
424
|
+
*/
|
|
425
|
+
resolve(
|
|
426
|
+
template: string,
|
|
427
|
+
options?: {
|
|
428
|
+
chatId?: string;
|
|
429
|
+
characterId?: string;
|
|
430
|
+
/** For operator-scoped extensions only. */
|
|
431
|
+
userId?: string;
|
|
432
|
+
},
|
|
433
|
+
): Promise<{
|
|
434
|
+
text: string;
|
|
435
|
+
diagnostics: Array<{ message: string; offset: number; length: number }>;
|
|
436
|
+
}>;
|
|
437
|
+
};
|
|
438
|
+
|
|
405
439
|
/**
|
|
406
440
|
* User presence queries (free tier — no permission needed).
|
|
407
441
|
* Check whether a user currently has the Lumiverse app visible/focused
|