lumiverse-spindle-types 0.4.31 → 0.4.33
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 +22 -1
- package/src/council.ts +20 -4
- package/src/index.ts +4 -0
- package/src/spindle-api.ts +7 -11
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -29,6 +29,27 @@ export interface MacroDefinitionDTO {
|
|
|
29
29
|
handler: string; // serialized function body (executed in worker context)
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
/** Minimal shape exposed to extension macro handlers. Additional fields may be present. */
|
|
33
|
+
export interface MacroInvocationContextDTO {
|
|
34
|
+
/** False when the host is performing a dry / non-committing resolve. */
|
|
35
|
+
commit: boolean;
|
|
36
|
+
[key: string]: unknown;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface MacroResolveOptionsDTO {
|
|
40
|
+
chatId?: string;
|
|
41
|
+
characterId?: string;
|
|
42
|
+
/** For operator-scoped extensions only. */
|
|
43
|
+
userId?: string;
|
|
44
|
+
/** Defaults to true. Set false to request a dry / non-committing resolve. */
|
|
45
|
+
commit?: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface MacroResolveResultDTO {
|
|
49
|
+
text: string;
|
|
50
|
+
diagnostics: Array<{ message: string; offset: number; length: number }>;
|
|
51
|
+
}
|
|
52
|
+
|
|
32
53
|
export interface ToolRegistrationDTO {
|
|
33
54
|
name: string;
|
|
34
55
|
display_name: string;
|
|
@@ -1349,7 +1370,7 @@ export type WorkerToHost =
|
|
|
1349
1370
|
| { type: "confirm_open"; requestId: string; title: string; message: string; variant?: "info" | "warning" | "danger" | "success"; confirmLabel?: string; cancelLabel?: string; userId?: string }
|
|
1350
1371
|
| { type: "input_prompt_open"; requestId: string; title: string; message?: string; placeholder?: string; defaultValue?: string; submitLabel?: string; cancelLabel?: string; multiline?: boolean; userId?: string }
|
|
1351
1372
|
// ─── Macro Resolution (free tier) ──────────────────────────────────
|
|
1352
|
-
| { type: "macros_resolve"; requestId: string; template: string; chatId?: string; characterId?: string; userId?: string }
|
|
1373
|
+
| { type: "macros_resolve"; requestId: string; template: string; chatId?: string; characterId?: string; userId?: string; commit?: boolean }
|
|
1353
1374
|
// ─── Image Generation (gated: "image_gen") ──────────────────────────
|
|
1354
1375
|
| { type: "image_gen_generate"; requestId: string; input: ImageGenRequestDTO }
|
|
1355
1376
|
| { type: "image_gen_providers"; requestId: string; userId?: string }
|
package/src/council.ts
CHANGED
|
@@ -161,16 +161,32 @@ export type CouncilToolCategory =
|
|
|
161
161
|
| "content"
|
|
162
162
|
| "extension";
|
|
163
163
|
|
|
164
|
+
export type CouncilToolExecution =
|
|
165
|
+
| "llm"
|
|
166
|
+
| "host"
|
|
167
|
+
| "extension"
|
|
168
|
+
| "mcp";
|
|
169
|
+
|
|
164
170
|
/** Canonical definition of a council tool (built-in or DLC). */
|
|
165
171
|
export interface CouncilToolDefinition {
|
|
166
172
|
name: string;
|
|
167
173
|
displayName: string;
|
|
168
174
|
description: string;
|
|
169
175
|
category: CouncilToolCategory;
|
|
170
|
-
/**
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
|
|
176
|
+
/** Optional explicit runtime. When omitted, the host may infer one from the tool source. */
|
|
177
|
+
execution?: CouncilToolExecution;
|
|
178
|
+
/** The prompt sent to the sidecar LLM when invoking prompt-style LLM tools. */
|
|
179
|
+
prompt?: string;
|
|
180
|
+
/**
|
|
181
|
+
* JSON Schema describing the prompt-style tool's expected output structure.
|
|
182
|
+
*
|
|
183
|
+
* Historically this field was also used as the callable argument schema for
|
|
184
|
+
* extension / MCP tools. New host-callable tools should prefer `argsSchema`
|
|
185
|
+
* instead so invocation arguments and returned content are not conflated.
|
|
186
|
+
*/
|
|
187
|
+
inputSchema?: Record<string, unknown>;
|
|
188
|
+
/** JSON Schema describing the callable arguments for host / extension / MCP tools. */
|
|
189
|
+
argsSchema?: Record<string, unknown>;
|
|
174
190
|
/** If set, the tool's result is stored under this variable name for macro access. */
|
|
175
191
|
resultVariable?: string;
|
|
176
192
|
/** Whether this tool's output appears in the deliberation block (default true). */
|
package/src/index.ts
CHANGED
|
@@ -16,6 +16,9 @@ export type {
|
|
|
16
16
|
LlmMessageDTO,
|
|
17
17
|
InterceptorResultDTO,
|
|
18
18
|
MacroDefinitionDTO,
|
|
19
|
+
MacroInvocationContextDTO,
|
|
20
|
+
MacroResolveOptionsDTO,
|
|
21
|
+
MacroResolveResultDTO,
|
|
19
22
|
ToolRegistrationDTO,
|
|
20
23
|
ToolSchemaDTO,
|
|
21
24
|
ToolCallDTO,
|
|
@@ -129,6 +132,7 @@ export type {
|
|
|
129
132
|
CouncilExecutionResult,
|
|
130
133
|
CachedCouncilResult,
|
|
131
134
|
CouncilToolCategory,
|
|
135
|
+
CouncilToolExecution,
|
|
132
136
|
CouncilToolDefinition,
|
|
133
137
|
} from "./council";
|
|
134
138
|
export {
|
package/src/spindle-api.ts
CHANGED
|
@@ -3,6 +3,8 @@ import type {
|
|
|
3
3
|
LlmMessageDTO,
|
|
4
4
|
InterceptorResultDTO,
|
|
5
5
|
MacroDefinitionDTO,
|
|
6
|
+
MacroResolveOptionsDTO,
|
|
7
|
+
MacroResolveResultDTO,
|
|
6
8
|
ToolRegistrationDTO,
|
|
7
9
|
GenerationRequestDTO,
|
|
8
10
|
RequestInitDTO,
|
|
@@ -96,7 +98,7 @@ export interface SpindleAPI {
|
|
|
96
98
|
/** Subscribe to a Lumiverse event. */
|
|
97
99
|
on(event: string, handler: (payload: unknown, userId?: string) => void): () => void;
|
|
98
100
|
|
|
99
|
-
/** Register a macro */
|
|
101
|
+
/** Register a macro. Handler contexts expose `commit === false` during dry resolves. */
|
|
100
102
|
registerMacro(def: MacroDefinitionDTO): void;
|
|
101
103
|
/** Unregister a macro */
|
|
102
104
|
unregisterMacro(name: string): void;
|
|
@@ -763,6 +765,8 @@ export interface SpindleAPI {
|
|
|
763
765
|
* Resolve all macros in the given template string.
|
|
764
766
|
* Provide `chatId` and/or `characterId` for full context resolution.
|
|
765
767
|
* Without them, only context-free macros (time, random, etc.) resolve.
|
|
768
|
+
* Set `commit: false` for a dry / non-committing resolve; extension macro
|
|
769
|
+
* handlers will receive `ctx.commit === false`.
|
|
766
770
|
*
|
|
767
771
|
* @example
|
|
768
772
|
* ```ts
|
|
@@ -774,16 +778,8 @@ export interface SpindleAPI {
|
|
|
774
778
|
*/
|
|
775
779
|
resolve(
|
|
776
780
|
template: string,
|
|
777
|
-
options?:
|
|
778
|
-
|
|
779
|
-
characterId?: string;
|
|
780
|
-
/** For operator-scoped extensions only. */
|
|
781
|
-
userId?: string;
|
|
782
|
-
},
|
|
783
|
-
): Promise<{
|
|
784
|
-
text: string;
|
|
785
|
-
diagnostics: Array<{ message: string; offset: number; length: number }>;
|
|
786
|
-
}>;
|
|
781
|
+
options?: MacroResolveOptionsDTO,
|
|
782
|
+
): Promise<MacroResolveResultDTO>;
|
|
787
783
|
};
|
|
788
784
|
|
|
789
785
|
/**
|