agent-orcha 0.0.1
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/LICENSE +21 -0
- package/README.md +917 -0
- package/bin/cli.js +2 -0
- package/dist/lib/agents/agent-executor.d.ts +13 -0
- package/dist/lib/agents/agent-executor.d.ts.map +1 -0
- package/dist/lib/agents/agent-executor.js +158 -0
- package/dist/lib/agents/agent-executor.js.map +1 -0
- package/dist/lib/agents/agent-loader.d.ts +13 -0
- package/dist/lib/agents/agent-loader.d.ts.map +1 -0
- package/dist/lib/agents/agent-loader.js +39 -0
- package/dist/lib/agents/agent-loader.js.map +1 -0
- package/dist/lib/agents/index.d.ts +5 -0
- package/dist/lib/agents/index.d.ts.map +1 -0
- package/dist/lib/agents/index.js +4 -0
- package/dist/lib/agents/index.js.map +1 -0
- package/dist/lib/agents/types.d.ts +140 -0
- package/dist/lib/agents/types.d.ts.map +1 -0
- package/dist/lib/agents/types.js +28 -0
- package/dist/lib/agents/types.js.map +1 -0
- package/dist/lib/functions/function-loader.d.ts +30 -0
- package/dist/lib/functions/function-loader.d.ts.map +1 -0
- package/dist/lib/functions/function-loader.js +107 -0
- package/dist/lib/functions/function-loader.js.map +1 -0
- package/dist/lib/functions/index.d.ts +3 -0
- package/dist/lib/functions/index.d.ts.map +1 -0
- package/dist/lib/functions/index.js +2 -0
- package/dist/lib/functions/index.js.map +1 -0
- package/dist/lib/functions/simple-function-wrapper.d.ts +33 -0
- package/dist/lib/functions/simple-function-wrapper.d.ts.map +1 -0
- package/dist/lib/functions/simple-function-wrapper.js +66 -0
- package/dist/lib/functions/simple-function-wrapper.js.map +1 -0
- package/dist/lib/index.d.ts +16 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +17 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/llm/index.d.ts +6 -0
- package/dist/lib/llm/index.d.ts.map +1 -0
- package/dist/lib/llm/index.js +4 -0
- package/dist/lib/llm/index.js.map +1 -0
- package/dist/lib/llm/llm-config.d.ts +138 -0
- package/dist/lib/llm/llm-config.d.ts.map +1 -0
- package/dist/lib/llm/llm-config.js +75 -0
- package/dist/lib/llm/llm-config.js.map +1 -0
- package/dist/lib/llm/llm-factory.d.ts +30 -0
- package/dist/lib/llm/llm-factory.d.ts.map +1 -0
- package/dist/lib/llm/llm-factory.js +103 -0
- package/dist/lib/llm/llm-factory.js.map +1 -0
- package/dist/lib/llm/provider-detector.d.ts +12 -0
- package/dist/lib/llm/provider-detector.d.ts.map +1 -0
- package/dist/lib/llm/provider-detector.js +46 -0
- package/dist/lib/llm/provider-detector.js.map +1 -0
- package/dist/lib/llm/types.d.ts +19 -0
- package/dist/lib/llm/types.d.ts.map +1 -0
- package/dist/lib/llm/types.js +18 -0
- package/dist/lib/llm/types.js.map +1 -0
- package/dist/lib/logger.d.ts +43 -0
- package/dist/lib/logger.d.ts.map +1 -0
- package/dist/lib/logger.js +113 -0
- package/dist/lib/logger.js.map +1 -0
- package/dist/lib/mcp/index.d.ts +4 -0
- package/dist/lib/mcp/index.d.ts.map +1 -0
- package/dist/lib/mcp/index.js +3 -0
- package/dist/lib/mcp/index.js.map +1 -0
- package/dist/lib/mcp/mcp-client.d.ts +17 -0
- package/dist/lib/mcp/mcp-client.d.ts.map +1 -0
- package/dist/lib/mcp/mcp-client.js +166 -0
- package/dist/lib/mcp/mcp-client.js.map +1 -0
- package/dist/lib/mcp/types.d.ts +146 -0
- package/dist/lib/mcp/types.d.ts.map +1 -0
- package/dist/lib/mcp/types.js +24 -0
- package/dist/lib/mcp/types.js.map +1 -0
- package/dist/lib/orchestrator.d.ts +64 -0
- package/dist/lib/orchestrator.d.ts.map +1 -0
- package/dist/lib/orchestrator.js +201 -0
- package/dist/lib/orchestrator.js.map +1 -0
- package/dist/lib/tools/built-in/index.d.ts +2 -0
- package/dist/lib/tools/built-in/index.d.ts.map +1 -0
- package/dist/lib/tools/built-in/index.js +2 -0
- package/dist/lib/tools/built-in/index.js.map +1 -0
- package/dist/lib/tools/built-in/vector-search.tool.d.ts +4 -0
- package/dist/lib/tools/built-in/vector-search.tool.d.ts.map +1 -0
- package/dist/lib/tools/built-in/vector-search.tool.js +26 -0
- package/dist/lib/tools/built-in/vector-search.tool.js.map +1 -0
- package/dist/lib/tools/index.d.ts +3 -0
- package/dist/lib/tools/index.d.ts.map +1 -0
- package/dist/lib/tools/index.js +3 -0
- package/dist/lib/tools/index.js.map +1 -0
- package/dist/lib/tools/tool-registry.d.ts +20 -0
- package/dist/lib/tools/tool-registry.d.ts.map +1 -0
- package/dist/lib/tools/tool-registry.js +76 -0
- package/dist/lib/tools/tool-registry.js.map +1 -0
- package/dist/lib/vectors/index.d.ts +5 -0
- package/dist/lib/vectors/index.d.ts.map +1 -0
- package/dist/lib/vectors/index.js +4 -0
- package/dist/lib/vectors/index.js.map +1 -0
- package/dist/lib/vectors/types.d.ts +212 -0
- package/dist/lib/vectors/types.d.ts.map +1 -0
- package/dist/lib/vectors/types.js +39 -0
- package/dist/lib/vectors/types.js.map +1 -0
- package/dist/lib/vectors/vector-store-factory.d.ts +14 -0
- package/dist/lib/vectors/vector-store-factory.d.ts.map +1 -0
- package/dist/lib/vectors/vector-store-factory.js +350 -0
- package/dist/lib/vectors/vector-store-factory.js.map +1 -0
- package/dist/lib/vectors/vector-store-manager.d.ts +18 -0
- package/dist/lib/vectors/vector-store-manager.d.ts.map +1 -0
- package/dist/lib/vectors/vector-store-manager.js +79 -0
- package/dist/lib/vectors/vector-store-manager.js.map +1 -0
- package/dist/lib/workflows/index.d.ts +5 -0
- package/dist/lib/workflows/index.d.ts.map +1 -0
- package/dist/lib/workflows/index.js +4 -0
- package/dist/lib/workflows/index.js.map +1 -0
- package/dist/lib/workflows/types.d.ts +630 -0
- package/dist/lib/workflows/types.d.ts.map +1 -0
- package/dist/lib/workflows/types.js +51 -0
- package/dist/lib/workflows/types.js.map +1 -0
- package/dist/lib/workflows/workflow-executor.d.ts +22 -0
- package/dist/lib/workflows/workflow-executor.d.ts.map +1 -0
- package/dist/lib/workflows/workflow-executor.js +276 -0
- package/dist/lib/workflows/workflow-executor.js.map +1 -0
- package/dist/lib/workflows/workflow-loader.d.ts +13 -0
- package/dist/lib/workflows/workflow-loader.d.ts.map +1 -0
- package/dist/lib/workflows/workflow-loader.js +39 -0
- package/dist/lib/workflows/workflow-loader.js.map +1 -0
- package/dist/public/index.html +762 -0
- package/dist/src/cli/commands/init.d.ts +2 -0
- package/dist/src/cli/commands/init.d.ts.map +1 -0
- package/dist/src/cli/commands/init.js +108 -0
- package/dist/src/cli/commands/init.js.map +1 -0
- package/dist/src/cli/commands/start.d.ts +3 -0
- package/dist/src/cli/commands/start.d.ts.map +1 -0
- package/dist/src/cli/commands/start.js +114 -0
- package/dist/src/cli/commands/start.js.map +1 -0
- package/dist/src/cli/index.d.ts +3 -0
- package/dist/src/cli/index.d.ts.map +1 -0
- package/dist/src/cli/index.js +59 -0
- package/dist/src/cli/index.js.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +62 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/routes/agents.route.d.ts +3 -0
- package/dist/src/routes/agents.route.d.ts.map +1 -0
- package/dist/src/routes/agents.route.js +58 -0
- package/dist/src/routes/agents.route.js.map +1 -0
- package/dist/src/routes/llm.route.d.ts +3 -0
- package/dist/src/routes/llm.route.d.ts.map +1 -0
- package/dist/src/routes/llm.route.js +97 -0
- package/dist/src/routes/llm.route.js.map +1 -0
- package/dist/src/routes/vectors.route.d.ts +3 -0
- package/dist/src/routes/vectors.route.d.ts.map +1 -0
- package/dist/src/routes/vectors.route.js +74 -0
- package/dist/src/routes/vectors.route.js.map +1 -0
- package/dist/src/routes/workflows.route.d.ts +3 -0
- package/dist/src/routes/workflows.route.d.ts.map +1 -0
- package/dist/src/routes/workflows.route.js +58 -0
- package/dist/src/routes/workflows.route.js.map +1 -0
- package/dist/src/server.d.ts +9 -0
- package/dist/src/server.d.ts.map +1 -0
- package/dist/src/server.js +34 -0
- package/dist/src/server.js.map +1 -0
- package/dist/templates/.env.example +6 -0
- package/dist/templates/README.md +234 -0
- package/dist/templates/agents/example.agent.yaml +32 -0
- package/dist/templates/agents/knowledge.agent.yaml +36 -0
- package/dist/templates/agents/math.agent.yaml +38 -0
- package/dist/templates/agents/time.agent.yaml +42 -0
- package/dist/templates/functions/README.md +195 -0
- package/dist/templates/functions/fibonacci.function.js +55 -0
- package/dist/templates/llm.json +44 -0
- package/dist/templates/mcp.json +18 -0
- package/dist/templates/vectors/example-chroma.vector.yaml +43 -0
- package/dist/templates/vectors/example.vector.yaml +28 -0
- package/dist/templates/vectors/sample-data/example-document.txt +15 -0
- package/dist/templates/workflows/example.workflow.yaml +79 -0
- package/package.json +77 -0
package/bin/cli.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AgentDefinition, AgentInstance } from './types.js';
|
|
2
|
+
import type { ToolRegistry } from '../tools/tool-registry.js';
|
|
3
|
+
export declare class AgentExecutor {
|
|
4
|
+
private toolRegistry;
|
|
5
|
+
constructor(toolRegistry: ToolRegistry);
|
|
6
|
+
createInstance(definition: AgentDefinition): Promise<AgentInstance>;
|
|
7
|
+
private invoke;
|
|
8
|
+
private invokeWithTools;
|
|
9
|
+
private invokeWithoutTools;
|
|
10
|
+
private formatUserMessage;
|
|
11
|
+
private stream;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=agent-executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-executor.d.ts","sourceRoot":"","sources":["../../../lib/agents/agent-executor.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAe,MAAM,YAAY,CAAC;AAE9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAG9D,qBAAa,aAAa;IACxB,OAAO,CAAC,YAAY,CAAe;gBAEvB,YAAY,EAAE,YAAY;IAIhC,cAAc,CAAC,UAAU,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC;YAW3D,MAAM;YAeN,eAAe;YA+Ef,kBAAkB;IAuBhC,OAAO,CAAC,iBAAiB;YAmBV,MAAM;CA+CtB"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { ChatPromptTemplate, HumanMessagePromptTemplate, SystemMessagePromptTemplate } from '@langchain/core/prompts';
|
|
2
|
+
import { createReactAgent } from '@langchain/langgraph/prebuilt';
|
|
3
|
+
import { LLMFactory } from '../llm/llm-factory.js';
|
|
4
|
+
import { logger } from '../logger.js';
|
|
5
|
+
export class AgentExecutor {
|
|
6
|
+
toolRegistry;
|
|
7
|
+
constructor(toolRegistry) {
|
|
8
|
+
this.toolRegistry = toolRegistry;
|
|
9
|
+
}
|
|
10
|
+
async createInstance(definition) {
|
|
11
|
+
const llm = LLMFactory.create(definition.llm);
|
|
12
|
+
const tools = await this.toolRegistry.resolveTools(definition.tools);
|
|
13
|
+
return {
|
|
14
|
+
definition,
|
|
15
|
+
invoke: async (input) => this.invoke(definition, llm, tools, input),
|
|
16
|
+
stream: (input) => this.stream(definition, llm, tools, input),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
async invoke(definition, llm, tools, input) {
|
|
20
|
+
const startTime = Date.now();
|
|
21
|
+
if (tools.length > 0) {
|
|
22
|
+
return this.invokeWithTools(definition, llm, tools, input, startTime);
|
|
23
|
+
}
|
|
24
|
+
return this.invokeWithoutTools(definition, llm, input, startTime);
|
|
25
|
+
}
|
|
26
|
+
async invokeWithTools(definition, llm, tools, input, startTime) {
|
|
27
|
+
try {
|
|
28
|
+
const agent = createReactAgent({
|
|
29
|
+
llm,
|
|
30
|
+
tools,
|
|
31
|
+
stateModifier: definition.prompt.system,
|
|
32
|
+
});
|
|
33
|
+
const userMessage = this.formatUserMessage(definition, input);
|
|
34
|
+
logger.info(`[Agent: ${definition.name}] Invoking with ${tools.length} tools...`);
|
|
35
|
+
logger.info(`[Agent: ${definition.name}] User message: ${userMessage.substring(0, 100)}...`);
|
|
36
|
+
// Increase recursion limit to prevent premature termination
|
|
37
|
+
// Default is 25, increase to 50 for complex workflows
|
|
38
|
+
const result = await agent.invoke({
|
|
39
|
+
messages: [{ role: 'user', content: userMessage }],
|
|
40
|
+
}, {
|
|
41
|
+
recursionLimit: 50,
|
|
42
|
+
});
|
|
43
|
+
logger.info(`[Agent: ${definition.name}] Got ${result.messages?.length ?? 0} messages`);
|
|
44
|
+
if (!result.messages || result.messages.length === 0) {
|
|
45
|
+
logger.warn(`[Agent: ${definition.name}] No messages returned`);
|
|
46
|
+
return {
|
|
47
|
+
output: 'Agent returned no response',
|
|
48
|
+
metadata: { duration: Date.now() - startTime, toolCalls: [] },
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
const lastMessage = result.messages[result.messages.length - 1];
|
|
52
|
+
let output;
|
|
53
|
+
if (typeof lastMessage === 'object' && lastMessage !== null) {
|
|
54
|
+
if ('content' in lastMessage) {
|
|
55
|
+
output = String(lastMessage.content);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
output = JSON.stringify(lastMessage);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
output = String(lastMessage);
|
|
63
|
+
}
|
|
64
|
+
if (!output || output === 'null' || output === 'undefined') {
|
|
65
|
+
logger.warn(`[Agent: ${definition.name}] Empty output, last message:`, lastMessage);
|
|
66
|
+
output = 'Agent returned empty response';
|
|
67
|
+
}
|
|
68
|
+
logger.info(`[Agent: ${definition.name}] Output length: ${output.length}`);
|
|
69
|
+
return {
|
|
70
|
+
output,
|
|
71
|
+
metadata: {
|
|
72
|
+
duration: Date.now() - startTime,
|
|
73
|
+
toolCalls: [],
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
logger.error(`[Agent: ${definition.name}] Error:`, error);
|
|
79
|
+
return {
|
|
80
|
+
output: `Agent error: ${error instanceof Error ? error.message : String(error)}`,
|
|
81
|
+
metadata: {
|
|
82
|
+
duration: Date.now() - startTime,
|
|
83
|
+
toolCalls: [],
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
async invokeWithoutTools(definition, llm, input, startTime) {
|
|
89
|
+
const prompt = ChatPromptTemplate.fromMessages([
|
|
90
|
+
SystemMessagePromptTemplate.fromTemplate(definition.prompt.system),
|
|
91
|
+
HumanMessagePromptTemplate.fromTemplate('{userInput}'),
|
|
92
|
+
]);
|
|
93
|
+
const userMessage = this.formatUserMessage(definition, input);
|
|
94
|
+
const messages = await prompt.formatMessages({ userInput: userMessage });
|
|
95
|
+
const result = await llm.invoke(messages);
|
|
96
|
+
return {
|
|
97
|
+
output: String(result.content),
|
|
98
|
+
metadata: {
|
|
99
|
+
duration: Date.now() - startTime,
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
formatUserMessage(definition, input) {
|
|
104
|
+
if (definition.prompt.inputVariables.length === 0) {
|
|
105
|
+
return JSON.stringify(input);
|
|
106
|
+
}
|
|
107
|
+
if (definition.prompt.inputVariables.length === 1) {
|
|
108
|
+
const key = definition.prompt.inputVariables[0];
|
|
109
|
+
const value = key ? input[key] : undefined;
|
|
110
|
+
return value !== undefined ? String(value) : '';
|
|
111
|
+
}
|
|
112
|
+
return definition.prompt.inputVariables
|
|
113
|
+
.map((variable) => {
|
|
114
|
+
const value = input[variable];
|
|
115
|
+
return `${variable}: ${value !== undefined ? String(value) : ''}`;
|
|
116
|
+
})
|
|
117
|
+
.join('\n');
|
|
118
|
+
}
|
|
119
|
+
async *stream(definition, llm, tools, input) {
|
|
120
|
+
if (tools.length > 0) {
|
|
121
|
+
const agent = createReactAgent({
|
|
122
|
+
llm,
|
|
123
|
+
tools,
|
|
124
|
+
stateModifier: definition.prompt.system,
|
|
125
|
+
});
|
|
126
|
+
const userMessage = this.formatUserMessage(definition, input);
|
|
127
|
+
// Note: stream may not support recursionLimit config directly
|
|
128
|
+
// If recursion limit is needed for streaming, consider using withConfig
|
|
129
|
+
const stream = await agent.stream({
|
|
130
|
+
messages: [{ role: 'user', content: userMessage }],
|
|
131
|
+
});
|
|
132
|
+
for await (const chunk of stream) {
|
|
133
|
+
if (chunk.agent?.messages && Array.isArray(chunk.agent.messages)) {
|
|
134
|
+
for (const msg of chunk.agent.messages) {
|
|
135
|
+
if (typeof msg === 'object' && 'content' in msg && typeof msg.content === 'string') {
|
|
136
|
+
yield msg.content;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
const prompt = ChatPromptTemplate.fromMessages([
|
|
144
|
+
SystemMessagePromptTemplate.fromTemplate(definition.prompt.system),
|
|
145
|
+
HumanMessagePromptTemplate.fromTemplate('{userInput}'),
|
|
146
|
+
]);
|
|
147
|
+
const userMessage = this.formatUserMessage(definition, input);
|
|
148
|
+
const messages = await prompt.formatMessages({ userInput: userMessage });
|
|
149
|
+
const stream = await llm.stream(messages);
|
|
150
|
+
for await (const chunk of stream) {
|
|
151
|
+
if (typeof chunk.content === 'string') {
|
|
152
|
+
yield chunk.content;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=agent-executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-executor.js","sourceRoot":"","sources":["../../../lib/agents/agent-executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtH,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAIjE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,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M,GAAG,CAAC,OAAO,CAAC;wBACpB,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,MAAM,GAAG,kBAAkB,CAAC,YAAY,CAAC;gBAC7C,2BAA2B,CAAC,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC;gBAClE,0BAA0B,CAAC,YAAY,CAAC,aAAa,CAAC;aACvD,CAAC,CAAC;YAEH,MAAM,WAAW,GAAG,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;YAC9D,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,CAAC;YACzE,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAE1C,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;gBACjC,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;oBACtC,MAAM,KAAK,CAAC,OAAO,CAAC;gBACtB,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type AgentDefinition } from './types.js';
|
|
2
|
+
export declare class AgentLoader {
|
|
3
|
+
private agentsDir;
|
|
4
|
+
private agents;
|
|
5
|
+
constructor(agentsDir: string);
|
|
6
|
+
loadAll(): Promise<Map<string, AgentDefinition>>;
|
|
7
|
+
loadOne(filePath: string): Promise<AgentDefinition>;
|
|
8
|
+
get(name: string): AgentDefinition | undefined;
|
|
9
|
+
list(): AgentDefinition[];
|
|
10
|
+
has(name: string): boolean;
|
|
11
|
+
names(): string[];
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=agent-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-loader.d.ts","sourceRoot":"","sources":["../../../lib/agents/agent-loader.ts"],"names":[],"mappings":"AAIA,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAEzE,qBAAa,WAAW;IACtB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,MAAM,CAA2C;gBAE7C,SAAS,EAAE,MAAM;IAIvB,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAYhD,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAMzD,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAI9C,IAAI,IAAI,eAAe,EAAE;IAIzB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B,KAAK,IAAI,MAAM,EAAE;CAGlB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as fs from 'fs/promises';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import { glob } from 'glob';
|
|
4
|
+
import { parse as parseYaml } from 'yaml';
|
|
5
|
+
import { AgentDefinitionSchema } from './types.js';
|
|
6
|
+
export class AgentLoader {
|
|
7
|
+
agentsDir;
|
|
8
|
+
agents = new Map();
|
|
9
|
+
constructor(agentsDir) {
|
|
10
|
+
this.agentsDir = agentsDir;
|
|
11
|
+
}
|
|
12
|
+
async loadAll() {
|
|
13
|
+
const files = await glob('**/*.agent.yaml', { cwd: this.agentsDir });
|
|
14
|
+
for (const file of files) {
|
|
15
|
+
const filePath = path.join(this.agentsDir, file);
|
|
16
|
+
const agent = await this.loadOne(filePath);
|
|
17
|
+
this.agents.set(agent.name, agent);
|
|
18
|
+
}
|
|
19
|
+
return this.agents;
|
|
20
|
+
}
|
|
21
|
+
async loadOne(filePath) {
|
|
22
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
23
|
+
const parsed = parseYaml(content);
|
|
24
|
+
return AgentDefinitionSchema.parse(parsed);
|
|
25
|
+
}
|
|
26
|
+
get(name) {
|
|
27
|
+
return this.agents.get(name);
|
|
28
|
+
}
|
|
29
|
+
list() {
|
|
30
|
+
return Array.from(this.agents.values());
|
|
31
|
+
}
|
|
32
|
+
has(name) {
|
|
33
|
+
return this.agents.has(name);
|
|
34
|
+
}
|
|
35
|
+
names() {
|
|
36
|
+
return Array.from(this.agents.keys());
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=agent-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-loader.js","sourceRoot":"","sources":["../../../lib/agents/agent-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAwB,MAAM,YAAY,CAAC;AAEzE,MAAM,OAAO,WAAW;IACd,SAAS,CAAS;IAClB,MAAM,GAAiC,IAAI,GAAG,EAAE,CAAC;IAEzD,YAAY,SAAiB;QAC3B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,OAAO;QACX,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,iBAAiB,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;QAErE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;YACjD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAC3C,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACrC,CAAC;QAED,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,QAAgB;QAC5B,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACrD,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;QAClC,OAAO,qBAAqB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7C,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED,IAAI;QACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED,KAAK;QACH,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IACxC,CAAC;CACF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { AgentLoader } from './agent-loader.js';
|
|
2
|
+
export { AgentExecutor } from './agent-executor.js';
|
|
3
|
+
export { AgentDefinitionSchema, ToolReferenceSchema, OutputConfigSchema, } from './types.js';
|
|
4
|
+
export type { AgentDefinition, ToolReference, OutputConfig, AgentInstance, AgentResult, ToolCallRecord, } from './types.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/agents/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,eAAe,EACf,aAAa,EACb,YAAY,EACZ,aAAa,EACb,WAAW,EACX,cAAc,GACf,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/agents/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ToolReferenceSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
source: z.ZodEnum<["mcp", "vector", "builtin", "custom"]>;
|
|
5
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
name: string;
|
|
8
|
+
source: "custom" | "mcp" | "vector" | "builtin";
|
|
9
|
+
config?: Record<string, unknown> | undefined;
|
|
10
|
+
}, {
|
|
11
|
+
name: string;
|
|
12
|
+
source: "custom" | "mcp" | "vector" | "builtin";
|
|
13
|
+
config?: Record<string, unknown> | undefined;
|
|
14
|
+
}>]>;
|
|
15
|
+
export declare const OutputConfigSchema: z.ZodObject<{
|
|
16
|
+
format: z.ZodDefault<z.ZodEnum<["text", "json", "structured"]>>;
|
|
17
|
+
schema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
format: "text" | "json" | "structured";
|
|
20
|
+
schema?: Record<string, unknown> | undefined;
|
|
21
|
+
}, {
|
|
22
|
+
format?: "text" | "json" | "structured" | undefined;
|
|
23
|
+
schema?: Record<string, unknown> | undefined;
|
|
24
|
+
}>;
|
|
25
|
+
export declare const AgentDefinitionSchema: z.ZodObject<{
|
|
26
|
+
name: z.ZodString;
|
|
27
|
+
description: z.ZodString;
|
|
28
|
+
version: z.ZodDefault<z.ZodString>;
|
|
29
|
+
llm: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
30
|
+
name: z.ZodString;
|
|
31
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
name: string;
|
|
34
|
+
temperature?: number | undefined;
|
|
35
|
+
}, {
|
|
36
|
+
name: string;
|
|
37
|
+
temperature?: number | undefined;
|
|
38
|
+
}>]>>;
|
|
39
|
+
prompt: z.ZodObject<{
|
|
40
|
+
system: z.ZodString;
|
|
41
|
+
inputVariables: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
system: string;
|
|
44
|
+
inputVariables: string[];
|
|
45
|
+
}, {
|
|
46
|
+
system: string;
|
|
47
|
+
inputVariables?: string[] | undefined;
|
|
48
|
+
}>;
|
|
49
|
+
tools: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
50
|
+
name: z.ZodString;
|
|
51
|
+
source: z.ZodEnum<["mcp", "vector", "builtin", "custom"]>;
|
|
52
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
53
|
+
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
name: string;
|
|
55
|
+
source: "custom" | "mcp" | "vector" | "builtin";
|
|
56
|
+
config?: Record<string, unknown> | undefined;
|
|
57
|
+
}, {
|
|
58
|
+
name: string;
|
|
59
|
+
source: "custom" | "mcp" | "vector" | "builtin";
|
|
60
|
+
config?: Record<string, unknown> | undefined;
|
|
61
|
+
}>]>, "many">>;
|
|
62
|
+
output: z.ZodOptional<z.ZodObject<{
|
|
63
|
+
format: z.ZodDefault<z.ZodEnum<["text", "json", "structured"]>>;
|
|
64
|
+
schema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
65
|
+
}, "strip", z.ZodTypeAny, {
|
|
66
|
+
format: "text" | "json" | "structured";
|
|
67
|
+
schema?: Record<string, unknown> | undefined;
|
|
68
|
+
}, {
|
|
69
|
+
format?: "text" | "json" | "structured" | undefined;
|
|
70
|
+
schema?: Record<string, unknown> | undefined;
|
|
71
|
+
}>>;
|
|
72
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
73
|
+
}, "strip", z.ZodTypeAny, {
|
|
74
|
+
version: string;
|
|
75
|
+
name: string;
|
|
76
|
+
description: string;
|
|
77
|
+
llm: string | {
|
|
78
|
+
name: string;
|
|
79
|
+
temperature?: number | undefined;
|
|
80
|
+
};
|
|
81
|
+
prompt: {
|
|
82
|
+
system: string;
|
|
83
|
+
inputVariables: string[];
|
|
84
|
+
};
|
|
85
|
+
tools: (string | {
|
|
86
|
+
name: string;
|
|
87
|
+
source: "custom" | "mcp" | "vector" | "builtin";
|
|
88
|
+
config?: Record<string, unknown> | undefined;
|
|
89
|
+
})[];
|
|
90
|
+
output?: {
|
|
91
|
+
format: "text" | "json" | "structured";
|
|
92
|
+
schema?: Record<string, unknown> | undefined;
|
|
93
|
+
} | undefined;
|
|
94
|
+
metadata?: Record<string, unknown> | undefined;
|
|
95
|
+
}, {
|
|
96
|
+
name: string;
|
|
97
|
+
description: string;
|
|
98
|
+
prompt: {
|
|
99
|
+
system: string;
|
|
100
|
+
inputVariables?: string[] | undefined;
|
|
101
|
+
};
|
|
102
|
+
version?: string | undefined;
|
|
103
|
+
llm?: string | {
|
|
104
|
+
name: string;
|
|
105
|
+
temperature?: number | undefined;
|
|
106
|
+
} | undefined;
|
|
107
|
+
tools?: (string | {
|
|
108
|
+
name: string;
|
|
109
|
+
source: "custom" | "mcp" | "vector" | "builtin";
|
|
110
|
+
config?: Record<string, unknown> | undefined;
|
|
111
|
+
})[] | undefined;
|
|
112
|
+
output?: {
|
|
113
|
+
format?: "text" | "json" | "structured" | undefined;
|
|
114
|
+
schema?: Record<string, unknown> | undefined;
|
|
115
|
+
} | undefined;
|
|
116
|
+
metadata?: Record<string, unknown> | undefined;
|
|
117
|
+
}>;
|
|
118
|
+
export type ToolReference = z.infer<typeof ToolReferenceSchema>;
|
|
119
|
+
export type OutputConfig = z.infer<typeof OutputConfigSchema>;
|
|
120
|
+
export type AgentDefinition = z.infer<typeof AgentDefinitionSchema>;
|
|
121
|
+
export interface ToolCallRecord {
|
|
122
|
+
tool: string;
|
|
123
|
+
input: unknown;
|
|
124
|
+
output: unknown;
|
|
125
|
+
duration: number;
|
|
126
|
+
}
|
|
127
|
+
export interface AgentResult {
|
|
128
|
+
output: string | Record<string, unknown>;
|
|
129
|
+
metadata: {
|
|
130
|
+
tokensUsed?: number;
|
|
131
|
+
toolCalls?: ToolCallRecord[];
|
|
132
|
+
duration: number;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
export interface AgentInstance {
|
|
136
|
+
definition: AgentDefinition;
|
|
137
|
+
invoke: (input: Record<string, unknown>) => Promise<AgentResult>;
|
|
138
|
+
stream: (input: Record<string, unknown>) => AsyncGenerator<string, void, unknown>;
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../lib/agents/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;IAO9B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;EAG7B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYhC,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,QAAQ,EAAE;QACR,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,cAAc,EAAE,CAAC;QAC7B,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,eAAe,CAAC;IAC5B,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;IACjE,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;CACnF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AgentLLMRefSchema } from '../llm/types.js';
|
|
3
|
+
export const ToolReferenceSchema = z.union([
|
|
4
|
+
z.string(),
|
|
5
|
+
z.object({
|
|
6
|
+
name: z.string(),
|
|
7
|
+
source: z.enum(['mcp', 'vector', 'builtin', 'custom']),
|
|
8
|
+
config: z.record(z.unknown()).optional(),
|
|
9
|
+
}),
|
|
10
|
+
]);
|
|
11
|
+
export const OutputConfigSchema = z.object({
|
|
12
|
+
format: z.enum(['text', 'json', 'structured']).default('text'),
|
|
13
|
+
schema: z.record(z.unknown()).optional(),
|
|
14
|
+
});
|
|
15
|
+
export const AgentDefinitionSchema = z.object({
|
|
16
|
+
name: z.string().describe('Unique agent identifier'),
|
|
17
|
+
description: z.string().describe('Human-readable description'),
|
|
18
|
+
version: z.string().default('1.0.0'),
|
|
19
|
+
llm: AgentLLMRefSchema.default('default'),
|
|
20
|
+
prompt: z.object({
|
|
21
|
+
system: z.string().describe('System prompt for the agent'),
|
|
22
|
+
inputVariables: z.array(z.string()).default([]),
|
|
23
|
+
}),
|
|
24
|
+
tools: z.array(ToolReferenceSchema).default([]),
|
|
25
|
+
output: OutputConfigSchema.optional(),
|
|
26
|
+
metadata: z.record(z.unknown()).optional(),
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../lib/agents/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC;IACzC,CAAC,CAAC,MAAM,EAAE;IACV,CAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;QACtD,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;KACzC,CAAC;CACH,CA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
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
version?: string;
|
|
6
|
+
author?: string;
|
|
7
|
+
tags?: string[];
|
|
8
|
+
}
|
|
9
|
+
export interface LoadedFunction {
|
|
10
|
+
name: string;
|
|
11
|
+
tool: StructuredTool;
|
|
12
|
+
metadata: FunctionMetadata;
|
|
13
|
+
filePath: string;
|
|
14
|
+
}
|
|
15
|
+
export declare class FunctionLoader {
|
|
16
|
+
private functionsDir;
|
|
17
|
+
private functions;
|
|
18
|
+
constructor(functionsDir: string);
|
|
19
|
+
loadAll(): Promise<void>;
|
|
20
|
+
loadOne(filePath: string): Promise<LoadedFunction>;
|
|
21
|
+
private isSimpleFunctionDefinition;
|
|
22
|
+
private hasToolExport;
|
|
23
|
+
private findToolExport;
|
|
24
|
+
get(name: string): LoadedFunction | undefined;
|
|
25
|
+
getTool(name: string): StructuredTool | undefined;
|
|
26
|
+
list(): LoadedFunction[];
|
|
27
|
+
names(): string[];
|
|
28
|
+
reload(name: string): Promise<LoadedFunction>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=function-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function-loader.d.ts","sourceRoot":"","sources":["../../../lib/functions/function-loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAI5D,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,cAAc,CAAC;IACrB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,SAAS,CAA0C;gBAE/C,YAAY,EAAE,MAAM;IAI1B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAexB,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAiDxD,OAAO,CAAC,0BAA0B;IAUlC,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,cAAc;IAStB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAI7C,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAIjD,IAAI,IAAI,cAAc,EAAE;IAIxB,KAAK,IAAI,MAAM,EAAE;IAIX,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;CASpD"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import { glob } from 'glob';
|
|
3
|
+
import { pathToFileURL } from 'url';
|
|
4
|
+
import { logger } from '../logger.js';
|
|
5
|
+
import { wrapSimpleFunction } from './simple-function-wrapper.js';
|
|
6
|
+
export class FunctionLoader {
|
|
7
|
+
functionsDir;
|
|
8
|
+
functions = new Map();
|
|
9
|
+
constructor(functionsDir) {
|
|
10
|
+
this.functionsDir = functionsDir;
|
|
11
|
+
}
|
|
12
|
+
async loadAll() {
|
|
13
|
+
try {
|
|
14
|
+
const files = await glob('**/*.function.js', { cwd: this.functionsDir });
|
|
15
|
+
for (const file of files) {
|
|
16
|
+
const filePath = path.join(this.functionsDir, file);
|
|
17
|
+
await this.loadOne(filePath);
|
|
18
|
+
}
|
|
19
|
+
logger.info(`[FunctionLoader] Loaded ${this.functions.size} function(s)`);
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
logger.warn('[FunctionLoader] Functions directory not found or error loading functions:', error);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
async loadOne(filePath) {
|
|
26
|
+
try {
|
|
27
|
+
const fileUrl = pathToFileURL(filePath).href;
|
|
28
|
+
const module = await import(fileUrl);
|
|
29
|
+
let tool;
|
|
30
|
+
let metadata;
|
|
31
|
+
// Check if it's a simple function definition
|
|
32
|
+
if (this.isSimpleFunctionDefinition(module.default)) {
|
|
33
|
+
const simpleDef = module.default;
|
|
34
|
+
tool = wrapSimpleFunction(simpleDef);
|
|
35
|
+
metadata = module.metadata || {
|
|
36
|
+
name: simpleDef.name,
|
|
37
|
+
description: simpleDef.description,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
// Check for advanced LangChain tool format
|
|
41
|
+
else if (module.default || this.hasToolExport(module)) {
|
|
42
|
+
tool = module.default || this.findToolExport(module);
|
|
43
|
+
metadata = module.metadata || {
|
|
44
|
+
name: tool.name,
|
|
45
|
+
description: tool.description,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
throw new Error('Function file must export either:\n' +
|
|
50
|
+
'1. A simple function definition as default export, or\n' +
|
|
51
|
+
'2. A LangChain tool (named export ending in "Tool" or default export)');
|
|
52
|
+
}
|
|
53
|
+
const loadedFunction = {
|
|
54
|
+
name: metadata.name,
|
|
55
|
+
tool,
|
|
56
|
+
metadata,
|
|
57
|
+
filePath,
|
|
58
|
+
};
|
|
59
|
+
this.functions.set(metadata.name, loadedFunction);
|
|
60
|
+
logger.info(`[FunctionLoader] Loaded function: ${metadata.name}`);
|
|
61
|
+
return loadedFunction;
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
logger.error(`[FunctionLoader] Failed to load function from ${filePath}:`, error);
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
isSimpleFunctionDefinition(obj) {
|
|
69
|
+
return (obj &&
|
|
70
|
+
typeof obj === 'object' &&
|
|
71
|
+
typeof obj.name === 'string' &&
|
|
72
|
+
typeof obj.description === 'string' &&
|
|
73
|
+
typeof obj.execute === 'function');
|
|
74
|
+
}
|
|
75
|
+
hasToolExport(module) {
|
|
76
|
+
return Object.keys(module).some((key) => key.endsWith('Tool'));
|
|
77
|
+
}
|
|
78
|
+
findToolExport(module) {
|
|
79
|
+
// Find the first export that ends with "Tool"
|
|
80
|
+
const toolExport = Object.keys(module).find((key) => key.endsWith('Tool'));
|
|
81
|
+
if (toolExport) {
|
|
82
|
+
return module[toolExport];
|
|
83
|
+
}
|
|
84
|
+
throw new Error('No tool export found (should be named export ending in "Tool" or default export)');
|
|
85
|
+
}
|
|
86
|
+
get(name) {
|
|
87
|
+
return this.functions.get(name);
|
|
88
|
+
}
|
|
89
|
+
getTool(name) {
|
|
90
|
+
return this.functions.get(name)?.tool;
|
|
91
|
+
}
|
|
92
|
+
list() {
|
|
93
|
+
return Array.from(this.functions.values());
|
|
94
|
+
}
|
|
95
|
+
names() {
|
|
96
|
+
return Array.from(this.functions.keys());
|
|
97
|
+
}
|
|
98
|
+
async reload(name) {
|
|
99
|
+
const existing = this.functions.get(name);
|
|
100
|
+
if (!existing) {
|
|
101
|
+
throw new Error(`Function not found: ${name}`);
|
|
102
|
+
}
|
|
103
|
+
this.functions.delete(name);
|
|
104
|
+
return this.loadOne(existing.filePath);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=function-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function-loader.js","sourceRoot":"","sources":["../../../lib/functions/function-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAiC,MAAM,8BAA8B,CAAC;AAiBjG,MAAM,OAAO,cAAc;IACjB,YAAY,CAAS;IACrB,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C,CAAC;IACzC,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/functions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/functions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC"}
|