@voltagent/core 0.1.21 → 0.1.23
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/index.js +143 -124
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -776,77 +776,76 @@ var updateSinglePackage = /* @__PURE__ */ __name((packageName, packagePath) => _
|
|
|
776
776
|
}), "updateSinglePackage");
|
|
777
777
|
|
|
778
778
|
// src/server/api.routes.ts
|
|
779
|
-
var import_zod = require("zod");
|
|
780
779
|
var import_zod_openapi = require("@hono/zod-openapi");
|
|
781
|
-
var ParamsSchema =
|
|
782
|
-
id:
|
|
780
|
+
var ParamsSchema = import_zod_openapi.z.object({
|
|
781
|
+
id: import_zod_openapi.z.string().openapi({
|
|
783
782
|
param: { name: "id", in: "path" },
|
|
784
783
|
description: "The ID of the agent",
|
|
785
784
|
example: "my-agent-123"
|
|
786
785
|
})
|
|
787
786
|
});
|
|
788
|
-
var ErrorSchema =
|
|
789
|
-
success:
|
|
790
|
-
error:
|
|
787
|
+
var ErrorSchema = import_zod_openapi.z.object({
|
|
788
|
+
success: import_zod_openapi.z.literal(false),
|
|
789
|
+
error: import_zod_openapi.z.string().openapi({ description: "Error message" })
|
|
791
790
|
});
|
|
792
|
-
var SubAgentResponseSchema =
|
|
793
|
-
id:
|
|
794
|
-
name:
|
|
795
|
-
description:
|
|
796
|
-
status:
|
|
791
|
+
var SubAgentResponseSchema = import_zod_openapi.z.object({
|
|
792
|
+
id: import_zod_openapi.z.string(),
|
|
793
|
+
name: import_zod_openapi.z.string(),
|
|
794
|
+
description: import_zod_openapi.z.string(),
|
|
795
|
+
status: import_zod_openapi.z.string().openapi({ description: "Current status of the sub-agent" }),
|
|
797
796
|
// Keeping string for now
|
|
798
|
-
model:
|
|
799
|
-
tools:
|
|
800
|
-
memory:
|
|
797
|
+
model: import_zod_openapi.z.string(),
|
|
798
|
+
tools: import_zod_openapi.z.array(import_zod_openapi.z.any()).optional(),
|
|
799
|
+
memory: import_zod_openapi.z.any().optional()
|
|
801
800
|
}).passthrough();
|
|
802
|
-
var AgentResponseSchema =
|
|
803
|
-
id:
|
|
804
|
-
name:
|
|
805
|
-
description:
|
|
806
|
-
status:
|
|
801
|
+
var AgentResponseSchema = import_zod_openapi.z.object({
|
|
802
|
+
id: import_zod_openapi.z.string(),
|
|
803
|
+
name: import_zod_openapi.z.string(),
|
|
804
|
+
description: import_zod_openapi.z.string(),
|
|
805
|
+
status: import_zod_openapi.z.string().openapi({ description: "Current status of the agent" }),
|
|
807
806
|
// Reverted to z.string()
|
|
808
|
-
model:
|
|
809
|
-
tools:
|
|
807
|
+
model: import_zod_openapi.z.string(),
|
|
808
|
+
tools: import_zod_openapi.z.array(import_zod_openapi.z.any()),
|
|
810
809
|
// Simplified tool representation
|
|
811
|
-
subAgents:
|
|
810
|
+
subAgents: import_zod_openapi.z.array(SubAgentResponseSchema).optional().openapi({ description: "List of sub-agents" }),
|
|
812
811
|
// Use SubAgent schema
|
|
813
|
-
memory:
|
|
812
|
+
memory: import_zod_openapi.z.any().optional(),
|
|
814
813
|
// Simplified memory representation
|
|
815
|
-
isTelemetryEnabled:
|
|
814
|
+
isTelemetryEnabled: import_zod_openapi.z.boolean().openapi({ description: "Indicates if telemetry is configured for the agent" })
|
|
816
815
|
// Add other fields from getFullState if necessary and want them documented
|
|
817
816
|
}).passthrough();
|
|
818
|
-
var GenerateOptionsSchema =
|
|
819
|
-
userId:
|
|
820
|
-
conversationId:
|
|
817
|
+
var GenerateOptionsSchema = import_zod_openapi.z.object({
|
|
818
|
+
userId: import_zod_openapi.z.string().optional().openapi({ description: "Optional user ID for context tracking" }),
|
|
819
|
+
conversationId: import_zod_openapi.z.string().optional().openapi({
|
|
821
820
|
description: "Optional conversation ID for context tracking"
|
|
822
821
|
}),
|
|
823
|
-
contextLimit:
|
|
822
|
+
contextLimit: import_zod_openapi.z.number().int().positive().optional().default(10).openapi({
|
|
824
823
|
description: "Optional limit for conversation history context"
|
|
825
824
|
}),
|
|
826
|
-
temperature:
|
|
827
|
-
maxTokens:
|
|
828
|
-
topP:
|
|
825
|
+
temperature: import_zod_openapi.z.number().min(0).max(1).optional().default(0.7).openapi({ description: "Controls randomness (0-1)" }),
|
|
826
|
+
maxTokens: import_zod_openapi.z.number().int().positive().optional().default(4e3).openapi({ description: "Maximum tokens to generate" }),
|
|
827
|
+
topP: import_zod_openapi.z.number().min(0).max(1).optional().default(1).openapi({
|
|
829
828
|
description: "Controls diversity via nucleus sampling (0-1)"
|
|
830
829
|
}),
|
|
831
|
-
frequencyPenalty:
|
|
832
|
-
presencePenalty:
|
|
833
|
-
seed:
|
|
834
|
-
stopSequences:
|
|
835
|
-
extraOptions:
|
|
830
|
+
frequencyPenalty: import_zod_openapi.z.number().min(0).max(2).optional().default(0).openapi({ description: "Penalizes repeated tokens (0-2)" }),
|
|
831
|
+
presencePenalty: import_zod_openapi.z.number().min(0).max(2).optional().default(0).openapi({ description: "Penalizes tokens based on presence (0-2)" }),
|
|
832
|
+
seed: import_zod_openapi.z.number().int().optional().openapi({ description: "Optional seed for reproducible results" }),
|
|
833
|
+
stopSequences: import_zod_openapi.z.array(import_zod_openapi.z.string()).optional().openapi({ description: "Stop sequences to end generation" }),
|
|
834
|
+
extraOptions: import_zod_openapi.z.record(import_zod_openapi.z.string(), import_zod_openapi.z.unknown()).optional().openapi({ description: "Provider-specific options" })
|
|
836
835
|
// Add other relevant options from PublicGenerateOptions if known/needed for API exposure
|
|
837
836
|
}).passthrough();
|
|
838
|
-
var ContentPartSchema =
|
|
839
|
-
|
|
837
|
+
var ContentPartSchema = import_zod_openapi.z.union([
|
|
838
|
+
import_zod_openapi.z.object({
|
|
840
839
|
// Text part
|
|
841
|
-
type:
|
|
842
|
-
text:
|
|
840
|
+
type: import_zod_openapi.z.literal("text"),
|
|
841
|
+
text: import_zod_openapi.z.string()
|
|
843
842
|
}).openapi({ example: { type: "text", text: "Hello there!" } }),
|
|
844
|
-
|
|
843
|
+
import_zod_openapi.z.object({
|
|
845
844
|
// Image part
|
|
846
|
-
type:
|
|
847
|
-
image:
|
|
848
|
-
mimeType:
|
|
849
|
-
alt:
|
|
845
|
+
type: import_zod_openapi.z.literal("image"),
|
|
846
|
+
image: import_zod_openapi.z.string().openapi({ description: "Base64 encoded image data or a URL" }),
|
|
847
|
+
mimeType: import_zod_openapi.z.string().optional().openapi({ example: "image/jpeg" }),
|
|
848
|
+
alt: import_zod_openapi.z.string().optional().openapi({ description: "Alternative text for the image" })
|
|
850
849
|
}).openapi({
|
|
851
850
|
example: {
|
|
852
851
|
type: "image",
|
|
@@ -854,13 +853,13 @@ var ContentPartSchema = import_zod.z.union([
|
|
|
854
853
|
mimeType: "image/png"
|
|
855
854
|
}
|
|
856
855
|
}),
|
|
857
|
-
|
|
856
|
+
import_zod_openapi.z.object({
|
|
858
857
|
// File part
|
|
859
|
-
type:
|
|
860
|
-
data:
|
|
861
|
-
filename:
|
|
862
|
-
mimeType:
|
|
863
|
-
size:
|
|
858
|
+
type: import_zod_openapi.z.literal("file"),
|
|
859
|
+
data: import_zod_openapi.z.string().openapi({ description: "Base64 encoded file data" }),
|
|
860
|
+
filename: import_zod_openapi.z.string().openapi({ example: "document.pdf" }),
|
|
861
|
+
mimeType: import_zod_openapi.z.string().openapi({ example: "application/pdf" }),
|
|
862
|
+
size: import_zod_openapi.z.number().optional().openapi({ description: "File size in bytes" })
|
|
864
863
|
}).openapi({
|
|
865
864
|
example: {
|
|
866
865
|
type: "file",
|
|
@@ -870,24 +869,24 @@ var ContentPartSchema = import_zod.z.union([
|
|
|
870
869
|
}
|
|
871
870
|
})
|
|
872
871
|
]);
|
|
873
|
-
var MessageContentSchema =
|
|
874
|
-
|
|
875
|
-
|
|
872
|
+
var MessageContentSchema = import_zod_openapi.z.union([
|
|
873
|
+
import_zod_openapi.z.string().openapi({ description: "Plain text content" }),
|
|
874
|
+
import_zod_openapi.z.array(ContentPartSchema).openapi({ description: "An array of content parts (text, image, file)." })
|
|
876
875
|
]);
|
|
877
|
-
var MessageObjectSchema =
|
|
878
|
-
role:
|
|
876
|
+
var MessageObjectSchema = import_zod_openapi.z.object({
|
|
877
|
+
role: import_zod_openapi.z.enum(["system", "user", "assistant", "tool"]).openapi({
|
|
879
878
|
description: "Role of the sender (e.g., 'user', 'assistant')"
|
|
880
879
|
}),
|
|
881
880
|
content: MessageContentSchema
|
|
882
881
|
// Use the reusable content schema
|
|
883
882
|
}).openapi({ description: "A message object with role and content" });
|
|
884
|
-
var TextRequestSchema =
|
|
885
|
-
input:
|
|
886
|
-
|
|
883
|
+
var TextRequestSchema = import_zod_openapi.z.object({
|
|
884
|
+
input: import_zod_openapi.z.union([
|
|
885
|
+
import_zod_openapi.z.string().openapi({
|
|
887
886
|
description: "Input text for the agent",
|
|
888
887
|
example: "Tell me a joke!"
|
|
889
888
|
}),
|
|
890
|
-
|
|
889
|
+
import_zod_openapi.z.array(MessageObjectSchema).openapi({
|
|
891
890
|
description: "An array of message objects, representing the conversation history",
|
|
892
891
|
example: [
|
|
893
892
|
{ role: "user", content: "What is the weather?" },
|
|
@@ -907,37 +906,56 @@ var TextRequestSchema = import_zod.z.object({
|
|
|
907
906
|
}
|
|
908
907
|
})
|
|
909
908
|
}).openapi("TextGenerationRequest");
|
|
910
|
-
var TextResponseSchema =
|
|
911
|
-
success:
|
|
912
|
-
data:
|
|
909
|
+
var TextResponseSchema = import_zod_openapi.z.object({
|
|
910
|
+
success: import_zod_openapi.z.literal(true),
|
|
911
|
+
data: import_zod_openapi.z.string().openapi({ description: "Generated text response" })
|
|
913
912
|
// Assuming simple text response for now
|
|
914
913
|
});
|
|
915
|
-
var StreamTextEventSchema =
|
|
916
|
-
text:
|
|
917
|
-
timestamp:
|
|
918
|
-
type:
|
|
919
|
-
done:
|
|
920
|
-
error:
|
|
914
|
+
var StreamTextEventSchema = import_zod_openapi.z.object({
|
|
915
|
+
text: import_zod_openapi.z.string().optional(),
|
|
916
|
+
timestamp: import_zod_openapi.z.string().datetime().optional(),
|
|
917
|
+
type: import_zod_openapi.z.enum(["text", "completion", "error"]).optional(),
|
|
918
|
+
done: import_zod_openapi.z.boolean().optional(),
|
|
919
|
+
error: import_zod_openapi.z.string().optional()
|
|
921
920
|
});
|
|
922
|
-
var
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
921
|
+
var BasicJsonSchema = import_zod_openapi.z.object({
|
|
922
|
+
type: import_zod_openapi.z.literal("object"),
|
|
923
|
+
properties: import_zod_openapi.z.record(
|
|
924
|
+
import_zod_openapi.z.object({
|
|
925
|
+
type: import_zod_openapi.z.enum(["string", "number", "boolean", "object", "array", "null", "any"])
|
|
926
|
+
})
|
|
927
|
+
).optional().openapi({
|
|
928
|
+
description: "A dictionary defining each property of the object and its type",
|
|
929
|
+
example: {
|
|
930
|
+
id: { type: "string" },
|
|
931
|
+
age: { type: "number" },
|
|
932
|
+
isActive: { type: "boolean" }
|
|
933
|
+
}
|
|
929
934
|
}),
|
|
935
|
+
required: import_zod_openapi.z.array(import_zod_openapi.z.string()).optional().openapi({
|
|
936
|
+
description: "List of required property names in the object",
|
|
937
|
+
example: ["id", "age"]
|
|
938
|
+
})
|
|
939
|
+
}).passthrough().openapi({
|
|
940
|
+
description: "The Zod schema for the desired object output (passed as JSON)"
|
|
941
|
+
});
|
|
942
|
+
var ObjectRequestSchema = import_zod_openapi.z.object({
|
|
943
|
+
input: import_zod_openapi.z.union([
|
|
944
|
+
import_zod_openapi.z.string().openapi({ description: "Input text prompt" }),
|
|
945
|
+
import_zod_openapi.z.array(MessageObjectSchema).openapi({ description: "Conversation history" })
|
|
946
|
+
]),
|
|
947
|
+
schema: BasicJsonSchema,
|
|
930
948
|
options: GenerateOptionsSchema.optional().openapi({
|
|
931
949
|
description: "Optional object generation parameters",
|
|
932
950
|
example: { temperature: 0.2 }
|
|
933
951
|
})
|
|
934
952
|
}).openapi("ObjectGenerationRequest");
|
|
935
|
-
var ObjectResponseSchema =
|
|
936
|
-
success:
|
|
937
|
-
data:
|
|
953
|
+
var ObjectResponseSchema = import_zod_openapi.z.object({
|
|
954
|
+
success: import_zod_openapi.z.literal(true),
|
|
955
|
+
data: import_zod_openapi.z.object({}).passthrough().openapi({ description: "Generated object response" })
|
|
938
956
|
// Using passthrough object
|
|
939
957
|
});
|
|
940
|
-
var StreamObjectEventSchema =
|
|
958
|
+
var StreamObjectEventSchema = import_zod_openapi.z.any().openapi({
|
|
941
959
|
description: "Streamed object parts or the final object, format depends on agent implementation."
|
|
942
960
|
});
|
|
943
961
|
var getAgentsRoute = (0, import_zod_openapi.createRoute)({
|
|
@@ -947,9 +965,9 @@ var getAgentsRoute = (0, import_zod_openapi.createRoute)({
|
|
|
947
965
|
200: {
|
|
948
966
|
content: {
|
|
949
967
|
"application/json": {
|
|
950
|
-
schema:
|
|
951
|
-
success:
|
|
952
|
-
data:
|
|
968
|
+
schema: import_zod_openapi.z.object({
|
|
969
|
+
success: import_zod_openapi.z.literal(true),
|
|
970
|
+
data: import_zod_openapi.z.array(AgentResponseSchema).openapi({ description: "List of registered agents" })
|
|
953
971
|
})
|
|
954
972
|
}
|
|
955
973
|
},
|
|
@@ -1159,6 +1177,7 @@ Example event: 'data: {"partialUpdate": {...}}
|
|
|
1159
1177
|
});
|
|
1160
1178
|
|
|
1161
1179
|
// src/server/api.ts
|
|
1180
|
+
var import_json_schema_to_zod = require("@n8n/json-schema-to-zod");
|
|
1162
1181
|
var app = new import_zod_openapi2.OpenAPIHono();
|
|
1163
1182
|
app.get("/", (c) => {
|
|
1164
1183
|
const html = `
|
|
@@ -1501,7 +1520,8 @@ app.openapi(objectRoute, (c) => __async(void 0, null, function* () {
|
|
|
1501
1520
|
schema,
|
|
1502
1521
|
options = {}
|
|
1503
1522
|
} = c.req.valid("json");
|
|
1504
|
-
const
|
|
1523
|
+
const schemaInZodObject = (0, import_json_schema_to_zod.jsonSchemaToZod)(schema);
|
|
1524
|
+
const response = yield agent.generateObject(input, schemaInZodObject, options);
|
|
1505
1525
|
return c.json(
|
|
1506
1526
|
{ success: true, data: response },
|
|
1507
1527
|
200
|
|
@@ -1533,12 +1553,12 @@ app.openapi(streamObjectRoute, (c) => __async(void 0, null, function* () {
|
|
|
1533
1553
|
schema,
|
|
1534
1554
|
options = {}
|
|
1535
1555
|
} = c.req.valid("json");
|
|
1536
|
-
const
|
|
1556
|
+
const schemaInZodObject = (0, import_json_schema_to_zod.jsonSchemaToZod)(schema);
|
|
1557
|
+
const agentStream = yield agent.streamObject(input, schemaInZodObject, options);
|
|
1537
1558
|
const sseStream = new ReadableStream({
|
|
1538
1559
|
start(controller) {
|
|
1539
1560
|
return __async(this, null, function* () {
|
|
1540
|
-
const reader = agentStream.getReader();
|
|
1541
|
-
const decoder = new TextDecoder();
|
|
1561
|
+
const reader = agentStream.objectStream.getReader();
|
|
1542
1562
|
try {
|
|
1543
1563
|
while (true) {
|
|
1544
1564
|
const { done, value } = yield reader.read();
|
|
@@ -1553,8 +1573,7 @@ app.openapi(streamObjectRoute, (c) => __async(void 0, null, function* () {
|
|
|
1553
1573
|
`);
|
|
1554
1574
|
break;
|
|
1555
1575
|
}
|
|
1556
|
-
|
|
1557
|
-
controller.enqueue(`data: ${chunkString}
|
|
1576
|
+
controller.enqueue(`data: ${JSON.stringify(value)}
|
|
1558
1577
|
|
|
1559
1578
|
`);
|
|
1560
1579
|
}
|
|
@@ -4881,7 +4900,7 @@ function createHooks(hooks = {}) {
|
|
|
4881
4900
|
__name(createHooks, "createHooks");
|
|
4882
4901
|
|
|
4883
4902
|
// src/agent/subagent/index.ts
|
|
4884
|
-
var
|
|
4903
|
+
var import_zod = require("zod");
|
|
4885
4904
|
var SubAgentManager = class {
|
|
4886
4905
|
/**
|
|
4887
4906
|
* Creates a new SubAgentManager instance
|
|
@@ -5108,10 +5127,10 @@ Context: ${JSON.stringify(context)}`
|
|
|
5108
5127
|
id: "delegate_task",
|
|
5109
5128
|
name: "delegate_task",
|
|
5110
5129
|
description: "Delegate a task to one or more specialized agents",
|
|
5111
|
-
parameters:
|
|
5112
|
-
task:
|
|
5113
|
-
targetAgents:
|
|
5114
|
-
context:
|
|
5130
|
+
parameters: import_zod.z.object({
|
|
5131
|
+
task: import_zod.z.string().describe("The task to delegate"),
|
|
5132
|
+
targetAgents: import_zod.z.array(import_zod.z.string()).describe("List of agent names to delegate the task to"),
|
|
5133
|
+
context: import_zod.z.record(import_zod.z.unknown()).optional().describe("Additional context for the task")
|
|
5115
5134
|
}),
|
|
5116
5135
|
execute: (_0) => __async(this, [_0], function* ({ task, targetAgents, context = {} }) {
|
|
5117
5136
|
try {
|
|
@@ -7121,48 +7140,48 @@ ${context}`;
|
|
|
7121
7140
|
__name(Agent, "Agent");
|
|
7122
7141
|
|
|
7123
7142
|
// src/tool/reasoning/tools.ts
|
|
7124
|
-
var
|
|
7143
|
+
var import_zod3 = require("zod");
|
|
7125
7144
|
var import_uuid4 = require("uuid");
|
|
7126
7145
|
|
|
7127
7146
|
// src/tool/reasoning/types.ts
|
|
7128
|
-
var
|
|
7147
|
+
var import_zod2 = require("zod");
|
|
7129
7148
|
var NextAction = /* @__PURE__ */ ((NextAction2) => {
|
|
7130
7149
|
NextAction2["CONTINUE"] = "continue";
|
|
7131
7150
|
NextAction2["VALIDATE"] = "validate";
|
|
7132
7151
|
NextAction2["FINAL_ANSWER"] = "final_answer";
|
|
7133
7152
|
return NextAction2;
|
|
7134
7153
|
})(NextAction || {});
|
|
7135
|
-
var ReasoningStepSchema =
|
|
7136
|
-
id:
|
|
7154
|
+
var ReasoningStepSchema = import_zod2.z.object({
|
|
7155
|
+
id: import_zod2.z.string().uuid(),
|
|
7137
7156
|
// Unique ID for the step
|
|
7138
|
-
type:
|
|
7157
|
+
type: import_zod2.z.enum(["thought", "analysis"]),
|
|
7139
7158
|
// Type of step
|
|
7140
|
-
title:
|
|
7159
|
+
title: import_zod2.z.string(),
|
|
7141
7160
|
// Concise title for the step
|
|
7142
|
-
reasoning:
|
|
7161
|
+
reasoning: import_zod2.z.string(),
|
|
7143
7162
|
// The detailed thought or analysis
|
|
7144
|
-
action:
|
|
7163
|
+
action: import_zod2.z.string().optional(),
|
|
7145
7164
|
// The action planned based on the thought (for 'thought' type)
|
|
7146
|
-
result:
|
|
7165
|
+
result: import_zod2.z.string().optional(),
|
|
7147
7166
|
// The result being analyzed (for 'analysis' type)
|
|
7148
|
-
next_action:
|
|
7167
|
+
next_action: import_zod2.z.nativeEnum(NextAction).optional(),
|
|
7149
7168
|
// What to do next (for 'analysis' type)
|
|
7150
|
-
confidence:
|
|
7169
|
+
confidence: import_zod2.z.number().min(0).max(1).optional().default(0.8),
|
|
7151
7170
|
// Confidence level
|
|
7152
|
-
timestamp:
|
|
7171
|
+
timestamp: import_zod2.z.string().datetime(),
|
|
7153
7172
|
// Timestamp of the step creation
|
|
7154
|
-
historyEntryId:
|
|
7173
|
+
historyEntryId: import_zod2.z.string(),
|
|
7155
7174
|
// Link to the main history entry
|
|
7156
|
-
agentId:
|
|
7175
|
+
agentId: import_zod2.z.string()
|
|
7157
7176
|
// ID of the agent performing the step
|
|
7158
7177
|
});
|
|
7159
7178
|
|
|
7160
7179
|
// src/tool/reasoning/tools.ts
|
|
7161
|
-
var thinkParametersSchema =
|
|
7162
|
-
title:
|
|
7163
|
-
thought:
|
|
7164
|
-
action:
|
|
7165
|
-
confidence:
|
|
7180
|
+
var thinkParametersSchema = import_zod3.z.object({
|
|
7181
|
+
title: import_zod3.z.string().describe("A concise title for this thinking step"),
|
|
7182
|
+
thought: import_zod3.z.string().describe("Your detailed thought or reasoning for this step"),
|
|
7183
|
+
action: import_zod3.z.string().optional().describe("Optional: What you plan to do next based on this thought"),
|
|
7184
|
+
confidence: import_zod3.z.number().min(0).max(1).optional().default(0.8).describe("Optional: How confident you are about this thought (0.0 to 1.0)")
|
|
7166
7185
|
});
|
|
7167
7186
|
var thinkTool = createTool({
|
|
7168
7187
|
name: "think",
|
|
@@ -7198,14 +7217,14 @@ var thinkTool = createTool({
|
|
|
7198
7217
|
}
|
|
7199
7218
|
})
|
|
7200
7219
|
});
|
|
7201
|
-
var analyzeParametersSchema =
|
|
7202
|
-
title:
|
|
7203
|
-
result:
|
|
7204
|
-
analysis:
|
|
7205
|
-
next_action:
|
|
7220
|
+
var analyzeParametersSchema = import_zod3.z.object({
|
|
7221
|
+
title: import_zod3.z.string().describe("A concise title for this analysis step"),
|
|
7222
|
+
result: import_zod3.z.string().describe("The outcome or result of the previous action/thought being analyzed"),
|
|
7223
|
+
analysis: import_zod3.z.string().describe("Your analysis of the result"),
|
|
7224
|
+
next_action: import_zod3.z.nativeEnum(NextAction).describe(
|
|
7206
7225
|
`What to do next based on the analysis: "${"continue" /* CONTINUE */}", "${"validate" /* VALIDATE */}", or "${"final_answer" /* FINAL_ANSWER */}"`
|
|
7207
7226
|
),
|
|
7208
|
-
confidence:
|
|
7227
|
+
confidence: import_zod3.z.number().min(0).max(1).optional().default(0.8).describe("Optional: How confident you are in this analysis (0.0 to 1.0)")
|
|
7209
7228
|
});
|
|
7210
7229
|
var analyzeTool = createTool({
|
|
7211
7230
|
name: "analyze",
|
|
@@ -7467,15 +7486,15 @@ function serializeValueForDebug(value) {
|
|
|
7467
7486
|
__name(serializeValueForDebug, "serializeValueForDebug");
|
|
7468
7487
|
|
|
7469
7488
|
// src/retriever/tools/index.ts
|
|
7470
|
-
var
|
|
7489
|
+
var import_zod4 = require("zod");
|
|
7471
7490
|
var createRetrieverTool = /* @__PURE__ */ __name((retriever, options = {}) => {
|
|
7472
7491
|
const toolName = options.name || "search_knowledge";
|
|
7473
7492
|
const toolDescription = options.description || "Searches for relevant information in the knowledge base based on the query.";
|
|
7474
7493
|
return createTool({
|
|
7475
7494
|
name: toolName,
|
|
7476
7495
|
description: toolDescription,
|
|
7477
|
-
parameters:
|
|
7478
|
-
query:
|
|
7496
|
+
parameters: import_zod4.z.object({
|
|
7497
|
+
query: import_zod4.z.string().describe("The search query to find relevant information")
|
|
7479
7498
|
}),
|
|
7480
7499
|
execute: (_0) => __async(void 0, [_0], function* ({ query }) {
|
|
7481
7500
|
const result = yield retriever.retrieve(query);
|
|
@@ -7537,7 +7556,7 @@ var import_sse = require("@modelcontextprotocol/sdk/client/sse.js");
|
|
|
7537
7556
|
var import_stdio = require("@modelcontextprotocol/sdk/client/stdio.js");
|
|
7538
7557
|
var import_protocol = require("@modelcontextprotocol/sdk/shared/protocol.js");
|
|
7539
7558
|
var import_types2 = require("@modelcontextprotocol/sdk/types.js");
|
|
7540
|
-
var
|
|
7559
|
+
var import_json_schema_to_zod2 = require("@n8n/json-schema-to-zod");
|
|
7541
7560
|
var MCPClient = class extends import_node_events2.EventEmitter {
|
|
7542
7561
|
// Renamed back from identity
|
|
7543
7562
|
/**
|
|
@@ -7681,7 +7700,7 @@ var MCPClient = class extends import_node_events2.EventEmitter {
|
|
|
7681
7700
|
const executableTools = {};
|
|
7682
7701
|
for (const toolDef of Object.values(definitions)) {
|
|
7683
7702
|
try {
|
|
7684
|
-
const zodSchema = (0,
|
|
7703
|
+
const zodSchema = (0, import_json_schema_to_zod2.jsonSchemaToZod)(toolDef.inputSchema);
|
|
7685
7704
|
const namespacedToolName = `${this.clientInfo.name}_${toolDef.name}`;
|
|
7686
7705
|
const agentTool = createTool({
|
|
7687
7706
|
name: namespacedToolName,
|