@womp/spark-agent 5.5.0 → 5.6.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/dist/agent-tools.js +12 -5
- package/package.json +1 -1
package/dist/agent-tools.js
CHANGED
|
@@ -80,10 +80,17 @@ export function createSparkTools(options) {
|
|
|
80
80
|
read_skill: tool({
|
|
81
81
|
...inputLabels("name"),
|
|
82
82
|
description: "Read required skills together with names, or one skill with name. Returns instructions, TypeScript API declarations, and JavaScript examples from the available directory.",
|
|
83
|
-
inputSchema: z.
|
|
84
|
-
|
|
85
|
-
z.
|
|
86
|
-
|
|
83
|
+
inputSchema: z.object({
|
|
84
|
+
name: z.string().min(1).max(160).optional(),
|
|
85
|
+
names: z.array(z.string().min(1).max(160)).min(1).optional(),
|
|
86
|
+
}).strict().transform((input, context) => {
|
|
87
|
+
if (input.name !== undefined && input.names === undefined)
|
|
88
|
+
return { name: input.name };
|
|
89
|
+
if (input.names !== undefined && input.name === undefined)
|
|
90
|
+
return { names: input.names };
|
|
91
|
+
context.addIssue({ code: "custom", message: "Provide exactly one of name or names." });
|
|
92
|
+
return z.NEVER;
|
|
93
|
+
}),
|
|
87
94
|
execute: (input, { toolCallId }) => execute({ id: toolCallId, name: "read_skill", input }, async () => {
|
|
88
95
|
const read = (requested) => {
|
|
89
96
|
const skill = options.capabilities.skills.find(({ name }) => name === requested);
|
|
@@ -96,7 +103,7 @@ export function createSparkTools(options) {
|
|
|
96
103
|
}
|
|
97
104
|
return { ok: true, ...skill };
|
|
98
105
|
};
|
|
99
|
-
if (
|
|
106
|
+
if (input.name !== undefined)
|
|
100
107
|
return read(input.name);
|
|
101
108
|
const skills = [...new Set(input.names)].map(read);
|
|
102
109
|
return { ok: skills.every(skill => skill.ok), skills };
|