@noetic-tools/core 2.3.0 → 2.4.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FunctionCallItem, FunctionCallOutputItem, Item, ItemSchemaExtensions, Tool, ToolExecutionContext, ToolMemoryDeclaration, ToolResultExtensionItem } from '@noetic-tools/types';
|
|
1
|
+
import type { FunctionCallItem, FunctionCallOutputItem, Item, ItemSchemaExtensions, Tool, ToolExecutionContext, ToolMemoryDeclaration, ToolResultExtensionItem, ToolUiDeclaration } from '@noetic-tools/types';
|
|
2
2
|
import type { ZodTypeAny, z } from 'zod';
|
|
3
3
|
interface ToolConfig<I extends ZodTypeAny, O extends ZodTypeAny> {
|
|
4
4
|
name: string;
|
|
@@ -18,6 +18,8 @@ interface ToolConfig<I extends ZodTypeAny, O extends ZodTypeAny> {
|
|
|
18
18
|
needsApproval?: boolean;
|
|
19
19
|
/** Optional memory declaration — the runtime generates a MemoryLayer from this via toolMemoryLayer(). */
|
|
20
20
|
memory?: ToolMemoryDeclaration;
|
|
21
|
+
/** Optional UI declaration — the runtime emits the rendered fragments at call/progress/result points. */
|
|
22
|
+
ui?: ToolUiDeclaration<I, O>;
|
|
21
23
|
}
|
|
22
24
|
interface GeneratorToolConfig<I extends ZodTypeAny, E extends ZodTypeAny, O extends ZodTypeAny> {
|
|
23
25
|
name: string;
|
|
@@ -38,6 +40,8 @@ interface GeneratorToolConfig<I extends ZodTypeAny, E extends ZodTypeAny, O exte
|
|
|
38
40
|
needsApproval?: boolean;
|
|
39
41
|
/** Optional memory declaration — the runtime generates a MemoryLayer from this via toolMemoryLayer(). */
|
|
40
42
|
memory?: ToolMemoryDeclaration;
|
|
43
|
+
/** Optional UI declaration — the runtime emits the rendered fragments at call/progress/result points. */
|
|
44
|
+
ui?: ToolUiDeclaration<I, O, z.infer<E>>;
|
|
41
45
|
}
|
|
42
46
|
/**
|
|
43
47
|
* Creates a typed Tool with Zod schema inference for input and output.
|
|
@@ -36,6 +36,7 @@ export function tool(config) {
|
|
|
36
36
|
execute: config.execute,
|
|
37
37
|
needsApproval: config.needsApproval,
|
|
38
38
|
memory: config.memory,
|
|
39
|
+
ui: config.ui,
|
|
39
40
|
};
|
|
40
41
|
}
|
|
41
42
|
/**
|
|
@@ -56,6 +57,7 @@ export function toolWithGenerator(config) {
|
|
|
56
57
|
execute: config.execute,
|
|
57
58
|
needsApproval: config.needsApproval,
|
|
58
59
|
memory: config.memory,
|
|
60
|
+
ui: config.ui,
|
|
59
61
|
};
|
|
60
62
|
}
|
|
61
63
|
//#endregion
|