agent-orcha 0.0.2 → 0.0.4
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/README.md +777 -100
- package/dist/lib/agents/agent-executor.d.ts +6 -1
- package/dist/lib/agents/agent-executor.d.ts.map +1 -1
- package/dist/lib/agents/agent-executor.js +241 -45
- package/dist/lib/agents/agent-executor.js.map +1 -1
- package/dist/lib/agents/agent-loader.d.ts.map +1 -1
- package/dist/lib/agents/agent-loader.js +3 -1
- package/dist/lib/agents/agent-loader.js.map +1 -1
- package/dist/lib/agents/index.d.ts +2 -1
- package/dist/lib/agents/index.d.ts.map +1 -1
- package/dist/lib/agents/index.js +1 -0
- package/dist/lib/agents/index.js.map +1 -1
- package/dist/lib/agents/structured-output-wrapper.d.ts +19 -0
- package/dist/lib/agents/structured-output-wrapper.d.ts.map +1 -0
- package/dist/lib/agents/structured-output-wrapper.js +104 -0
- package/dist/lib/agents/structured-output-wrapper.js.map +1 -0
- package/dist/lib/agents/types.d.ts +17 -10
- package/dist/lib/agents/types.d.ts.map +1 -1
- package/dist/lib/agents/types.js +1 -1
- package/dist/lib/agents/types.js.map +1 -1
- package/dist/lib/index.d.ts +9 -7
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +7 -5
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/knowledge/graph-rag/community-detector.d.ts +16 -0
- package/dist/lib/knowledge/graph-rag/community-detector.d.ts.map +1 -0
- package/dist/lib/knowledge/graph-rag/community-detector.js +81 -0
- package/dist/lib/knowledge/graph-rag/community-detector.js.map +1 -0
- package/dist/lib/knowledge/graph-rag/community-summarizer.d.ts +17 -0
- package/dist/lib/knowledge/graph-rag/community-summarizer.d.ts.map +1 -0
- package/dist/lib/knowledge/graph-rag/community-summarizer.js +87 -0
- package/dist/lib/knowledge/graph-rag/community-summarizer.js.map +1 -0
- package/dist/lib/knowledge/graph-rag/entity-extractor.d.ts +36 -0
- package/dist/lib/knowledge/graph-rag/entity-extractor.d.ts.map +1 -0
- package/dist/lib/knowledge/graph-rag/entity-extractor.js +192 -0
- package/dist/lib/knowledge/graph-rag/entity-extractor.js.map +1 -0
- package/dist/lib/knowledge/graph-rag/extraction-cache.d.ts +30 -0
- package/dist/lib/knowledge/graph-rag/extraction-cache.d.ts.map +1 -0
- package/dist/lib/knowledge/graph-rag/extraction-cache.js +88 -0
- package/dist/lib/knowledge/graph-rag/extraction-cache.js.map +1 -0
- package/dist/lib/knowledge/graph-rag/global-search.d.ts +19 -0
- package/dist/lib/knowledge/graph-rag/global-search.d.ts.map +1 -0
- package/dist/lib/knowledge/graph-rag/global-search.js +96 -0
- package/dist/lib/knowledge/graph-rag/global-search.js.map +1 -0
- package/dist/lib/knowledge/graph-rag/graph-rag-factory.d.ts +24 -0
- package/dist/lib/knowledge/graph-rag/graph-rag-factory.d.ts.map +1 -0
- package/dist/lib/knowledge/graph-rag/graph-rag-factory.js +239 -0
- package/dist/lib/knowledge/graph-rag/graph-rag-factory.js.map +1 -0
- package/dist/lib/knowledge/graph-rag/index.d.ts +14 -0
- package/dist/lib/knowledge/graph-rag/index.d.ts.map +1 -0
- package/dist/lib/knowledge/graph-rag/index.js +12 -0
- package/dist/lib/knowledge/graph-rag/index.js.map +1 -0
- package/dist/lib/knowledge/graph-rag/local-search.d.ts +20 -0
- package/dist/lib/knowledge/graph-rag/local-search.d.ts.map +1 -0
- package/dist/lib/knowledge/graph-rag/local-search.js +110 -0
- package/dist/lib/knowledge/graph-rag/local-search.js.map +1 -0
- package/dist/lib/knowledge/graph-rag/memory-graph-store.d.ts +31 -0
- package/dist/lib/knowledge/graph-rag/memory-graph-store.d.ts.map +1 -0
- package/dist/lib/knowledge/graph-rag/memory-graph-store.js +165 -0
- package/dist/lib/knowledge/graph-rag/memory-graph-store.js.map +1 -0
- package/dist/lib/knowledge/graph-rag/neo4j-graph-store.d.ts +38 -0
- package/dist/lib/knowledge/graph-rag/neo4j-graph-store.d.ts.map +1 -0
- package/dist/lib/knowledge/graph-rag/neo4j-graph-store.js +190 -0
- package/dist/lib/knowledge/graph-rag/neo4j-graph-store.js.map +1 -0
- package/dist/lib/knowledge/graph-rag/search-mode-detector.d.ts +11 -0
- package/dist/lib/knowledge/graph-rag/search-mode-detector.d.ts.map +1 -0
- package/dist/lib/knowledge/graph-rag/search-mode-detector.js +50 -0
- package/dist/lib/knowledge/graph-rag/search-mode-detector.js.map +1 -0
- package/dist/lib/knowledge/graph-rag/types.d.ts +368 -0
- package/dist/lib/knowledge/graph-rag/types.d.ts.map +1 -0
- package/dist/lib/knowledge/graph-rag/types.js +48 -0
- package/dist/lib/knowledge/graph-rag/types.js.map +1 -0
- package/dist/lib/knowledge/index.d.ts +9 -0
- package/dist/lib/knowledge/index.d.ts.map +1 -0
- package/dist/lib/knowledge/index.js +8 -0
- package/dist/lib/knowledge/index.js.map +1 -0
- package/dist/lib/knowledge/knowledge-store-factory.d.ts +16 -0
- package/dist/lib/knowledge/knowledge-store-factory.d.ts.map +1 -0
- package/dist/lib/{vectors/vector-store-factory.js → knowledge/knowledge-store-factory.js} +36 -10
- package/dist/lib/knowledge/knowledge-store-factory.js.map +1 -0
- package/dist/lib/knowledge/knowledge-store-manager.d.ts +18 -0
- package/dist/lib/knowledge/knowledge-store-manager.d.ts.map +1 -0
- package/dist/lib/knowledge/knowledge-store-manager.js +98 -0
- package/dist/lib/knowledge/knowledge-store-manager.js.map +1 -0
- package/dist/lib/knowledge/loaders/database-loader.d.ts +18 -0
- package/dist/lib/knowledge/loaders/database-loader.d.ts.map +1 -0
- package/dist/lib/knowledge/loaders/database-loader.js +115 -0
- package/dist/lib/knowledge/loaders/database-loader.js.map +1 -0
- package/dist/lib/knowledge/loaders/index.d.ts +4 -0
- package/dist/lib/knowledge/loaders/index.d.ts.map +1 -0
- package/dist/lib/knowledge/loaders/index.js +4 -0
- package/dist/lib/knowledge/loaders/index.js.map +1 -0
- package/dist/lib/knowledge/loaders/s3-loader.d.ts +17 -0
- package/dist/lib/knowledge/loaders/s3-loader.d.ts.map +1 -0
- package/dist/lib/knowledge/loaders/s3-loader.js +185 -0
- package/dist/lib/knowledge/loaders/s3-loader.js.map +1 -0
- package/dist/lib/knowledge/loaders/web-loader.d.ts +12 -0
- package/dist/lib/knowledge/loaders/web-loader.d.ts.map +1 -0
- package/dist/lib/knowledge/loaders/web-loader.js +56 -0
- package/dist/lib/knowledge/loaders/web-loader.js.map +1 -0
- package/dist/lib/knowledge/types.d.ts +1839 -0
- package/dist/lib/knowledge/types.d.ts.map +1 -0
- package/dist/lib/knowledge/types.js +111 -0
- package/dist/lib/knowledge/types.js.map +1 -0
- package/dist/lib/knowledge/utils/connection-pool.d.ts +18 -0
- package/dist/lib/knowledge/utils/connection-pool.d.ts.map +1 -0
- package/dist/lib/knowledge/utils/connection-pool.js +77 -0
- package/dist/lib/knowledge/utils/connection-pool.js.map +1 -0
- package/dist/lib/knowledge/utils/file-type-detector.d.ts +10 -0
- package/dist/lib/knowledge/utils/file-type-detector.d.ts.map +1 -0
- package/dist/lib/knowledge/utils/file-type-detector.js +32 -0
- package/dist/lib/knowledge/utils/file-type-detector.js.map +1 -0
- package/dist/lib/knowledge/utils/index.d.ts +3 -0
- package/dist/lib/knowledge/utils/index.d.ts.map +1 -0
- package/dist/lib/knowledge/utils/index.js +3 -0
- package/dist/lib/knowledge/utils/index.js.map +1 -0
- package/dist/lib/mcp/mcp-client.d.ts +9 -1
- package/dist/lib/mcp/mcp-client.d.ts.map +1 -1
- package/dist/lib/mcp/mcp-client.js +33 -0
- package/dist/lib/mcp/mcp-client.js.map +1 -1
- package/dist/lib/memory/conversation-store.d.ts +43 -0
- package/dist/lib/memory/conversation-store.d.ts.map +1 -0
- package/dist/lib/memory/conversation-store.js +109 -0
- package/dist/lib/memory/conversation-store.js.map +1 -0
- package/dist/lib/memory/index.d.ts +3 -0
- package/dist/lib/memory/index.d.ts.map +1 -0
- package/dist/lib/memory/index.js +3 -0
- package/dist/lib/memory/index.js.map +1 -0
- package/dist/lib/memory/types.d.ts +19 -0
- package/dist/lib/memory/types.d.ts.map +1 -0
- package/dist/lib/memory/types.js +6 -0
- package/dist/lib/memory/types.js.map +1 -0
- package/dist/lib/orchestrator.d.ts +56 -14
- package/dist/lib/orchestrator.d.ts.map +1 -1
- package/dist/lib/orchestrator.js +182 -25
- package/dist/lib/orchestrator.js.map +1 -1
- package/dist/lib/tools/agent-tool-wrapper.d.ts +22 -0
- package/dist/lib/tools/agent-tool-wrapper.d.ts.map +1 -0
- package/dist/lib/tools/agent-tool-wrapper.js +56 -0
- package/dist/lib/tools/agent-tool-wrapper.js.map +1 -0
- package/dist/lib/tools/built-in/ask-user.tool.d.ts +7 -0
- package/dist/lib/tools/built-in/ask-user.tool.d.ts.map +1 -0
- package/dist/lib/tools/built-in/ask-user.tool.js +23 -0
- package/dist/lib/tools/built-in/ask-user.tool.js.map +1 -0
- package/dist/lib/tools/built-in/index.d.ts +2 -1
- package/dist/lib/tools/built-in/index.d.ts.map +1 -1
- package/dist/lib/tools/built-in/index.js +2 -1
- package/dist/lib/tools/built-in/index.js.map +1 -1
- package/dist/lib/tools/built-in/knowledge-search.tool.d.ts +4 -0
- package/dist/lib/tools/built-in/knowledge-search.tool.d.ts.map +1 -0
- package/dist/lib/tools/built-in/{vector-search.tool.js → knowledge-search.tool.js} +4 -4
- package/dist/lib/tools/built-in/knowledge-search.tool.js.map +1 -0
- package/dist/lib/tools/index.d.ts +3 -1
- package/dist/lib/tools/index.d.ts.map +1 -1
- package/dist/lib/tools/index.js +3 -1
- package/dist/lib/tools/index.js.map +1 -1
- package/dist/lib/tools/tool-discovery.d.ts +50 -0
- package/dist/lib/tools/tool-discovery.d.ts.map +1 -0
- package/dist/lib/tools/tool-discovery.js +178 -0
- package/dist/lib/tools/tool-discovery.js.map +1 -0
- package/dist/lib/tools/tool-registry.d.ts +19 -3
- package/dist/lib/tools/tool-registry.d.ts.map +1 -1
- package/dist/lib/tools/tool-registry.js +63 -10
- package/dist/lib/tools/tool-registry.js.map +1 -1
- package/dist/lib/workflows/index.d.ts +4 -2
- package/dist/lib/workflows/index.d.ts.map +1 -1
- package/dist/lib/workflows/index.js +3 -1
- package/dist/lib/workflows/index.js.map +1 -1
- package/dist/lib/workflows/interrupt-manager.d.ts +42 -0
- package/dist/lib/workflows/interrupt-manager.d.ts.map +1 -0
- package/dist/lib/workflows/interrupt-manager.js +102 -0
- package/dist/lib/workflows/interrupt-manager.js.map +1 -0
- package/dist/lib/workflows/langgraph-executor.d.ts +51 -0
- package/dist/lib/workflows/langgraph-executor.d.ts.map +1 -0
- package/dist/lib/workflows/langgraph-executor.js +297 -0
- package/dist/lib/workflows/langgraph-executor.js.map +1 -0
- package/dist/lib/workflows/types.d.ts +911 -34
- package/dist/lib/workflows/types.d.ts.map +1 -1
- package/dist/lib/workflows/types.js +51 -2
- package/dist/lib/workflows/types.js.map +1 -1
- package/dist/lib/workflows/workflow-executor.d.ts.map +1 -1
- package/dist/lib/workflows/workflow-executor.js +4 -0
- package/dist/lib/workflows/workflow-executor.js.map +1 -1
- package/dist/lib/workflows/workflow-loader.d.ts.map +1 -1
- package/dist/lib/workflows/workflow-loader.js +3 -1
- package/dist/lib/workflows/workflow-loader.js.map +1 -1
- package/dist/public/index.html +133 -700
- package/dist/public/src/components/AgentsView.js +763 -0
- package/dist/public/src/components/AppRoot.js +76 -0
- package/dist/public/src/components/IdeView.js +330 -0
- package/dist/public/src/components/KnowledgeView.js +133 -0
- package/dist/public/src/components/LlmView.js +127 -0
- package/dist/public/src/components/McpView.js +387 -0
- package/dist/public/src/components/NavBar.js +71 -0
- package/dist/public/src/components/WorkflowsView.js +243 -0
- package/dist/public/src/main.js +9 -0
- package/dist/public/src/services/ApiService.js +142 -0
- package/dist/public/src/store.js +41 -0
- package/dist/public/src/utils/Component.js +23 -0
- package/dist/public/src/utils/markdown.js +82 -0
- package/dist/src/cli/commands/init.js +3 -3
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/cli/commands/start.d.ts.map +1 -1
- package/dist/src/cli/commands/start.js +3 -2
- package/dist/src/cli/commands/start.js.map +1 -1
- package/dist/src/index.js +46 -12
- package/dist/src/index.js.map +1 -1
- package/dist/src/routes/agents.route.d.ts.map +1 -1
- package/dist/src/routes/agents.route.js +38 -5
- package/dist/src/routes/agents.route.js.map +1 -1
- package/dist/src/routes/files.route.d.ts +3 -0
- package/dist/src/routes/files.route.d.ts.map +1 -0
- package/dist/src/routes/files.route.js +160 -0
- package/dist/src/routes/files.route.js.map +1 -0
- package/dist/src/routes/functions.route.d.ts +3 -0
- package/dist/src/routes/functions.route.d.ts.map +1 -0
- package/dist/src/routes/functions.route.js +83 -0
- package/dist/src/routes/functions.route.js.map +1 -0
- package/dist/src/routes/knowledge.route.d.ts +3 -0
- package/dist/src/routes/knowledge.route.d.ts.map +1 -0
- package/dist/src/routes/knowledge.route.js +153 -0
- package/dist/src/routes/knowledge.route.js.map +1 -0
- package/dist/src/routes/mcp.route.d.ts +3 -0
- package/dist/src/routes/mcp.route.d.ts.map +1 -0
- package/dist/src/routes/mcp.route.js +79 -0
- package/dist/src/routes/mcp.route.js.map +1 -0
- package/dist/src/routes/workflows.route.d.ts.map +1 -1
- package/dist/src/routes/workflows.route.js +2 -1
- package/dist/src/routes/workflows.route.js.map +1 -1
- package/dist/src/server.d.ts.map +1 -1
- package/dist/src/server.js +8 -2
- package/dist/src/server.js.map +1 -1
- package/dist/templates/.env.example +21 -0
- package/dist/templates/README.md +43 -152
- package/dist/templates/agents/call-center-analyst-simple.agent.yaml +36 -0
- package/dist/templates/agents/math.agent.yaml +4 -14
- package/dist/templates/agents/sentiment-structured.agent.yaml +42 -0
- package/dist/templates/functions/calculator.function.js +69 -0
- package/dist/templates/functions/text-formatter.function.js +66 -0
- package/dist/templates/{vectors/example.vector.yaml → knowledge/example.knowledge.yaml} +1 -1
- package/dist/templates/knowledge/transcripts/call-001.txt +40 -0
- package/dist/templates/knowledge/transcripts/call-002.txt +36 -0
- package/dist/templates/knowledge/transcripts/call-003.txt +42 -0
- package/dist/templates/llm.md +1195 -0
- package/dist/templates/workflows/example.workflow.yaml +8 -19
- package/dist/templates/workflows/langgraph-example.workflow.yaml +84 -0
- package/package.json +21 -12
- package/dist/lib/tools/built-in/vector-search.tool.d.ts +0 -4
- package/dist/lib/tools/built-in/vector-search.tool.d.ts.map +0 -1
- package/dist/lib/tools/built-in/vector-search.tool.js.map +0 -1
- package/dist/lib/vectors/index.d.ts +0 -5
- package/dist/lib/vectors/index.d.ts.map +0 -1
- package/dist/lib/vectors/index.js +0 -4
- package/dist/lib/vectors/index.js.map +0 -1
- package/dist/lib/vectors/types.d.ts +0 -212
- package/dist/lib/vectors/types.d.ts.map +0 -1
- package/dist/lib/vectors/types.js +0 -39
- package/dist/lib/vectors/types.js.map +0 -1
- package/dist/lib/vectors/vector-store-factory.d.ts +0 -14
- package/dist/lib/vectors/vector-store-factory.d.ts.map +0 -1
- package/dist/lib/vectors/vector-store-factory.js.map +0 -1
- package/dist/lib/vectors/vector-store-manager.d.ts +0 -18
- package/dist/lib/vectors/vector-store-manager.d.ts.map +0 -1
- package/dist/lib/vectors/vector-store-manager.js +0 -79
- package/dist/lib/vectors/vector-store-manager.js.map +0 -1
- package/dist/src/routes/vectors.route.d.ts +0 -3
- package/dist/src/routes/vectors.route.d.ts.map +0 -1
- package/dist/src/routes/vectors.route.js +0 -74
- package/dist/src/routes/vectors.route.js.map +0 -1
- package/dist/templates/agents/example.agent.yaml +0 -32
- package/dist/templates/agents/knowledge.agent.yaml +0 -36
- package/dist/templates/agents/time.agent.yaml +0 -42
- package/dist/templates/functions/README.md +0 -195
- package/dist/templates/functions/fibonacci.function.js +0 -55
- package/dist/templates/vectors/sample-data/example-document.txt +0 -15
|
@@ -1,79 +0,0 @@
|
|
|
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 { VectorConfigSchema } from './types.js';
|
|
6
|
-
import { VectorStoreFactory } from './vector-store-factory.js';
|
|
7
|
-
import { createLogger } from '../logger.js';
|
|
8
|
-
const logger = createLogger('VectorStore');
|
|
9
|
-
export class VectorStoreManager {
|
|
10
|
-
vectorsDir;
|
|
11
|
-
projectRoot;
|
|
12
|
-
stores = new Map();
|
|
13
|
-
configs = new Map();
|
|
14
|
-
constructor(vectorsDir, projectRoot) {
|
|
15
|
-
this.vectorsDir = vectorsDir;
|
|
16
|
-
this.projectRoot = projectRoot;
|
|
17
|
-
}
|
|
18
|
-
async loadAll() {
|
|
19
|
-
const files = await glob('**/*.vector.yaml', { cwd: this.vectorsDir });
|
|
20
|
-
for (const file of files) {
|
|
21
|
-
const filePath = path.join(this.vectorsDir, file);
|
|
22
|
-
await this.loadOne(filePath);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
async loadOne(filePath) {
|
|
26
|
-
const content = await fs.readFile(filePath, 'utf-8');
|
|
27
|
-
const parsed = parseYaml(content);
|
|
28
|
-
const config = VectorConfigSchema.parse(parsed);
|
|
29
|
-
this.configs.set(config.name, config);
|
|
30
|
-
return config;
|
|
31
|
-
}
|
|
32
|
-
async initialize(name) {
|
|
33
|
-
const existing = this.stores.get(name);
|
|
34
|
-
if (existing) {
|
|
35
|
-
logger.info(`"${name}" already initialized`);
|
|
36
|
-
return existing;
|
|
37
|
-
}
|
|
38
|
-
const config = this.configs.get(name);
|
|
39
|
-
if (!config) {
|
|
40
|
-
throw new Error(`Vector config not found: ${name}`);
|
|
41
|
-
}
|
|
42
|
-
logger.info(`Initializing "${name}"...`);
|
|
43
|
-
logger.info(`Source: ${config.source.path}, Pattern: ${config.source.pattern || '*'}`);
|
|
44
|
-
try {
|
|
45
|
-
const store = await VectorStoreFactory.create(config, this.projectRoot);
|
|
46
|
-
this.stores.set(name, store);
|
|
47
|
-
logger.info(`"${name}" initialized successfully`);
|
|
48
|
-
return store;
|
|
49
|
-
}
|
|
50
|
-
catch (error) {
|
|
51
|
-
logger.error(`Failed to initialize "${name}":`, error);
|
|
52
|
-
throw error;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
async initializeAll() {
|
|
56
|
-
for (const name of this.configs.keys()) {
|
|
57
|
-
await this.initialize(name);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
get(name) {
|
|
61
|
-
return this.stores.get(name);
|
|
62
|
-
}
|
|
63
|
-
getConfig(name) {
|
|
64
|
-
return this.configs.get(name);
|
|
65
|
-
}
|
|
66
|
-
list() {
|
|
67
|
-
return Array.from(this.stores.values());
|
|
68
|
-
}
|
|
69
|
-
listConfigs() {
|
|
70
|
-
return Array.from(this.configs.values());
|
|
71
|
-
}
|
|
72
|
-
async refresh(name) {
|
|
73
|
-
const store = this.stores.get(name);
|
|
74
|
-
if (store) {
|
|
75
|
-
await store.refresh();
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
//# sourceMappingURL=vector-store-manager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vector-store-manager.js","sourceRoot":"","sources":["../../../lib/vectors/vector-store-manager.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,kBAAkB,EAA+C,MAAM,YAAY,CAAC;AAC7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,MAAM,GAAG,YAAY,CAAC,aAAa,CAAC,CAAC;AAE3C,MAAM,OAAO,kBAAkB;IACrB,UAAU,CAAS;IACnB,WAAW,CAAS;IACpB,MAAM,GAAqC,IAAI,GAAG,EA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AW;QACT,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,IAAY;QACxB,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;QACxB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vectors.route.d.ts","sourceRoot":"","sources":["../../../src/routes/vectors.route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAkBlD,eAAO,MAAM,aAAa,EAAE,kBA4F3B,CAAC"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
export const vectorsRoutes = async (fastify) => {
|
|
2
|
-
fastify.get('/', async () => {
|
|
3
|
-
const configs = fastify.orchestrator.vectors.listConfigs();
|
|
4
|
-
return configs.map((config) => ({
|
|
5
|
-
name: config.name,
|
|
6
|
-
description: config.description,
|
|
7
|
-
source: config.source,
|
|
8
|
-
store: config.store.type,
|
|
9
|
-
}));
|
|
10
|
-
});
|
|
11
|
-
fastify.get('/:name', async (request, reply) => {
|
|
12
|
-
const config = fastify.orchestrator.vectors.getConfig(request.params.name);
|
|
13
|
-
if (!config) {
|
|
14
|
-
return reply.status(404).send({
|
|
15
|
-
error: 'Vector store not found',
|
|
16
|
-
name: request.params.name,
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
return config;
|
|
20
|
-
});
|
|
21
|
-
fastify.post('/:name/search', async (request, reply) => {
|
|
22
|
-
const { name } = request.params;
|
|
23
|
-
const { query, k } = request.body;
|
|
24
|
-
try {
|
|
25
|
-
const results = await fastify.orchestrator.searchVectors(name, query, k);
|
|
26
|
-
return { results };
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
30
|
-
if (message.includes('not found')) {
|
|
31
|
-
return reply.status(404).send({ error: message });
|
|
32
|
-
}
|
|
33
|
-
return reply.status(500).send({ error: message });
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
fastify.post('/:name/refresh', async (request, reply) => {
|
|
37
|
-
const { name } = request.params;
|
|
38
|
-
try {
|
|
39
|
-
await fastify.orchestrator.vectors.refresh(name);
|
|
40
|
-
return { success: true };
|
|
41
|
-
}
|
|
42
|
-
catch (error) {
|
|
43
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
44
|
-
return reply.status(500).send({ error: message });
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
fastify.post('/:name/add', async (request, reply) => {
|
|
48
|
-
const { name } = request.params;
|
|
49
|
-
const { documents } = request.body;
|
|
50
|
-
try {
|
|
51
|
-
const store = fastify.orchestrator.vectors.get(name);
|
|
52
|
-
if (!store) {
|
|
53
|
-
await fastify.orchestrator.vectors.initialize(name);
|
|
54
|
-
const initializedStore = fastify.orchestrator.vectors.get(name);
|
|
55
|
-
if (!initializedStore) {
|
|
56
|
-
return reply.status(404).send({
|
|
57
|
-
error: 'Vector store not found',
|
|
58
|
-
name,
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
await initializedStore.addDocuments(documents);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
await store.addDocuments(documents);
|
|
65
|
-
}
|
|
66
|
-
return { success: true, added: documents.length };
|
|
67
|
-
}
|
|
68
|
-
catch (error) {
|
|
69
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
70
|
-
return reply.status(500).send({ error: message });
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
//# sourceMappingURL=vectors.route.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vectors.route.js","sourceRoot":"","sources":["../../../src/routes/vectors.route.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
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
name: example
|
|
2
|
-
description: An example agent that demonstrates the basic structure
|
|
3
|
-
version: "1.0.0"
|
|
4
|
-
|
|
5
|
-
llm:
|
|
6
|
-
name: default
|
|
7
|
-
temperature: 0.7
|
|
8
|
-
|
|
9
|
-
prompt:
|
|
10
|
-
system: |
|
|
11
|
-
You are a helpful AI assistant.
|
|
12
|
-
|
|
13
|
-
When responding to user queries:
|
|
14
|
-
1. Be clear and concise
|
|
15
|
-
2. Use tools when available to enhance your responses
|
|
16
|
-
3. Provide accurate information
|
|
17
|
-
inputVariables:
|
|
18
|
-
- query
|
|
19
|
-
|
|
20
|
-
tools: []
|
|
21
|
-
# Add tools here, for example:
|
|
22
|
-
# - mcp:fetch # MCP server tools
|
|
23
|
-
# - vector:knowledge # Vector store search
|
|
24
|
-
# - function:calculator # Custom function
|
|
25
|
-
|
|
26
|
-
output:
|
|
27
|
-
format: text
|
|
28
|
-
|
|
29
|
-
metadata:
|
|
30
|
-
category: general
|
|
31
|
-
tags:
|
|
32
|
-
- example
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
name: knowledge
|
|
2
|
-
description: An agent that searches a knowledge base using vector store for semantic search
|
|
3
|
-
version: "1.0.0"
|
|
4
|
-
|
|
5
|
-
llm:
|
|
6
|
-
name: default
|
|
7
|
-
temperature: 0.5
|
|
8
|
-
|
|
9
|
-
prompt:
|
|
10
|
-
system: |
|
|
11
|
-
You are a knowledgeable assistant with access to a vector database.
|
|
12
|
-
|
|
13
|
-
When users ask questions:
|
|
14
|
-
1. Search your knowledge base using the vector store
|
|
15
|
-
2. Find relevant information based on semantic similarity
|
|
16
|
-
3. Provide accurate answers based on the retrieved information
|
|
17
|
-
4. Cite or reference the information you found
|
|
18
|
-
|
|
19
|
-
If you cannot find relevant information in your knowledge base,
|
|
20
|
-
clearly state that and provide general knowledge if appropriate.
|
|
21
|
-
inputVariables:
|
|
22
|
-
- query
|
|
23
|
-
|
|
24
|
-
tools:
|
|
25
|
-
- vector:example # Reference to the example vector store
|
|
26
|
-
|
|
27
|
-
output:
|
|
28
|
-
format: text
|
|
29
|
-
|
|
30
|
-
metadata:
|
|
31
|
-
category: knowledge
|
|
32
|
-
tags:
|
|
33
|
-
- rag
|
|
34
|
-
- vector-search
|
|
35
|
-
- knowledge-base
|
|
36
|
-
- example
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
name: time
|
|
2
|
-
description: An agent that fetches current time information for specific timezones using web APIs
|
|
3
|
-
version: "1.0.0"
|
|
4
|
-
|
|
5
|
-
llm:
|
|
6
|
-
name: default
|
|
7
|
-
temperature: 0.3
|
|
8
|
-
|
|
9
|
-
prompt:
|
|
10
|
-
system: |
|
|
11
|
-
You are a time information assistant with access to web fetch capabilities.
|
|
12
|
-
|
|
13
|
-
When users ask for time information:
|
|
14
|
-
1. Use the fetch tool to get current time from worldtimeapi.org
|
|
15
|
-
2. For East Coast USA, use the timezone: America/New_York
|
|
16
|
-
3. Parse the JSON response and extract the datetime information
|
|
17
|
-
4. Format the time in a user-friendly way
|
|
18
|
-
|
|
19
|
-
API endpoint format: http://worldtimeapi.org/api/timezone/America/New_York
|
|
20
|
-
|
|
21
|
-
The response will include:
|
|
22
|
-
- datetime: The current date and time
|
|
23
|
-
- timezone: The timezone name
|
|
24
|
-
- utc_offset: The UTC offset
|
|
25
|
-
|
|
26
|
-
Present the time clearly with the timezone information.
|
|
27
|
-
inputVariables:
|
|
28
|
-
- timezone
|
|
29
|
-
|
|
30
|
-
tools:
|
|
31
|
-
- mcp:fetch # Reference to the MCP fetch server
|
|
32
|
-
|
|
33
|
-
output:
|
|
34
|
-
format: text
|
|
35
|
-
|
|
36
|
-
metadata:
|
|
37
|
-
category: utilities
|
|
38
|
-
tags:
|
|
39
|
-
- time
|
|
40
|
-
- fetch
|
|
41
|
-
- api
|
|
42
|
-
- example
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
# Custom Functions
|
|
2
|
-
|
|
3
|
-
This directory contains custom function tools that can be used by agents in the orchestrator.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
Functions are JavaScript files that export tools with metadata. They provide a way to extend agent capabilities with custom logic and operations.
|
|
8
|
-
|
|
9
|
-
**No dependencies required!** Functions use a simple format that requires no npm packages or imports.
|
|
10
|
-
|
|
11
|
-
## Creating a Function
|
|
12
|
-
|
|
13
|
-
Functions must follow this structure:
|
|
14
|
-
|
|
15
|
-
1. File name must end with `.function.js`
|
|
16
|
-
2. Must export a default object with `name`, `description`, `parameters`, and `execute`
|
|
17
|
-
3. Optionally export metadata for better documentation
|
|
18
|
-
|
|
19
|
-
### Simple Format (Recommended)
|
|
20
|
-
|
|
21
|
-
**No imports needed!** Just export a plain JavaScript object:
|
|
22
|
-
|
|
23
|
-
```javascript
|
|
24
|
-
/**
|
|
25
|
-
* Your function description
|
|
26
|
-
*/
|
|
27
|
-
export default {
|
|
28
|
-
name: 'your-function-name',
|
|
29
|
-
description: 'A clear description of what this function does',
|
|
30
|
-
|
|
31
|
-
parameters: {
|
|
32
|
-
param1: {
|
|
33
|
-
type: 'number',
|
|
34
|
-
description: 'Description of parameter 1',
|
|
35
|
-
},
|
|
36
|
-
param2: {
|
|
37
|
-
type: 'string',
|
|
38
|
-
description: 'Description of parameter 2',
|
|
39
|
-
},
|
|
40
|
-
optionalParam: {
|
|
41
|
-
type: 'boolean',
|
|
42
|
-
description: 'An optional parameter',
|
|
43
|
-
required: false,
|
|
44
|
-
default: true,
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
execute: async ({ param1, param2, optionalParam }) => {
|
|
49
|
-
// Your implementation here
|
|
50
|
-
return `Result: ${param1 + param2}`;
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
// Optional: Export metadata for discovery
|
|
55
|
-
export const metadata = {
|
|
56
|
-
name: 'your-function-name',
|
|
57
|
-
description: 'Function description',
|
|
58
|
-
version: '1.0.0',
|
|
59
|
-
author: 'Your Name',
|
|
60
|
-
tags: ['category1', 'category2'],
|
|
61
|
-
};
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### Parameter Types
|
|
65
|
-
|
|
66
|
-
Supported parameter types:
|
|
67
|
-
|
|
68
|
-
- `'string'` - String value
|
|
69
|
-
- `'number'` - Numeric value
|
|
70
|
-
- `'boolean'` - Boolean true/false
|
|
71
|
-
- `'array'` - Array of values
|
|
72
|
-
- `'object'` - Object/JSON structure
|
|
73
|
-
- `'enum'` - One of a fixed set of values (requires `values` array)
|
|
74
|
-
|
|
75
|
-
### Enum Parameters
|
|
76
|
-
|
|
77
|
-
For parameters with a fixed set of allowed values:
|
|
78
|
-
|
|
79
|
-
```javascript
|
|
80
|
-
parameters: {
|
|
81
|
-
operation: {
|
|
82
|
-
type: 'enum',
|
|
83
|
-
values: ['add', 'subtract', 'multiply', 'divide'],
|
|
84
|
-
description: 'The operation to perform',
|
|
85
|
-
},
|
|
86
|
-
}
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
## Using Functions in Agents
|
|
90
|
-
|
|
91
|
-
To use a function in an agent, add it to the agent's `tools` array using the `function:` prefix:
|
|
92
|
-
|
|
93
|
-
```yaml
|
|
94
|
-
name: my-agent
|
|
95
|
-
description: An agent that uses custom functions
|
|
96
|
-
|
|
97
|
-
tools:
|
|
98
|
-
- function:fibonacci # References fibonacci.function.js
|
|
99
|
-
- function:your-function-name
|
|
100
|
-
|
|
101
|
-
# ... rest of agent configuration
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
## Available Functions
|
|
105
|
-
|
|
106
|
-
### fibonacci
|
|
107
|
-
|
|
108
|
-
**File:** `fibonacci.function.js`
|
|
109
|
-
|
|
110
|
-
**Description:** Returns the nth Fibonacci number
|
|
111
|
-
|
|
112
|
-
**Parameters:**
|
|
113
|
-
- `n` (number) - The index (0-based, max 100)
|
|
114
|
-
|
|
115
|
-
**Examples:**
|
|
116
|
-
- Fibonacci(0) returns: 0
|
|
117
|
-
- Fibonacci(5) returns: 5
|
|
118
|
-
- Fibonacci(10) returns: 55
|
|
119
|
-
|
|
120
|
-
**Usage in agent:**
|
|
121
|
-
```yaml
|
|
122
|
-
tools:
|
|
123
|
-
- function:fibonacci
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
## Best Practices
|
|
127
|
-
|
|
128
|
-
1. **Error Handling**: Always validate inputs and handle errors gracefully
|
|
129
|
-
2. **Descriptive Names**: Use clear, descriptive names for functions and parameters
|
|
130
|
-
3. **Documentation**: Include JSDoc comments explaining what the function does
|
|
131
|
-
4. **Parameter Descriptions**: Provide clear descriptions for each parameter
|
|
132
|
-
5. **Metadata**: Export metadata to make functions discoverable and well-documented
|
|
133
|
-
6. **Async Operations**: Use async/await for operations that involve I/O or external calls
|
|
134
|
-
7. **Return Values**: Return strings or serializable objects that agents can interpret
|
|
135
|
-
|
|
136
|
-
## Development Tips
|
|
137
|
-
|
|
138
|
-
- Functions are loaded automatically on orchestrator initialization
|
|
139
|
-
- Function names must be unique across all loaded functions
|
|
140
|
-
- The simple format requires no npm packages or dependencies
|
|
141
|
-
- Test functions independently before integrating with agents
|
|
142
|
-
- Use the simple format unless you need advanced LangChain features
|
|
143
|
-
|
|
144
|
-
## Example Agent Using Fibonacci
|
|
145
|
-
|
|
146
|
-
```yaml
|
|
147
|
-
name: math-assistant
|
|
148
|
-
description: A Fibonacci number assistant
|
|
149
|
-
|
|
150
|
-
llm:
|
|
151
|
-
name: default
|
|
152
|
-
temperature: 0.3
|
|
153
|
-
|
|
154
|
-
prompt:
|
|
155
|
-
system: |
|
|
156
|
-
You are a math assistant specialized in Fibonacci numbers.
|
|
157
|
-
Use the fibonacci tool to calculate Fibonacci numbers or sequences.
|
|
158
|
-
inputVariables:
|
|
159
|
-
- query
|
|
160
|
-
|
|
161
|
-
tools:
|
|
162
|
-
- function:fibonacci
|
|
163
|
-
|
|
164
|
-
output:
|
|
165
|
-
format: text
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
## Extending the System
|
|
169
|
-
|
|
170
|
-
To add new function capabilities:
|
|
171
|
-
|
|
172
|
-
1. Create a new `.function.js` file in this directory
|
|
173
|
-
2. Export a default object with the simple format shown above
|
|
174
|
-
3. Add it to your agent's tools array as `function:your-name`
|
|
175
|
-
4. Restart the orchestrator to load the new function
|
|
176
|
-
|
|
177
|
-
**Example new function:**
|
|
178
|
-
|
|
179
|
-
```javascript
|
|
180
|
-
// my-function.function.js
|
|
181
|
-
export default {
|
|
182
|
-
name: 'my-function',
|
|
183
|
-
description: 'Does something useful',
|
|
184
|
-
parameters: {
|
|
185
|
-
input: {
|
|
186
|
-
type: 'string',
|
|
187
|
-
description: 'The input to process',
|
|
188
|
-
},
|
|
189
|
-
},
|
|
190
|
-
execute: async ({ input }) => {
|
|
191
|
-
// Your logic here
|
|
192
|
-
return `Processed: ${input}`;
|
|
193
|
-
},
|
|
194
|
-
};
|
|
195
|
-
```
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fibonacci calculator function - Simple format example
|
|
3
|
-
*
|
|
4
|
-
* This demonstrates the simple function format that requires no imports.
|
|
5
|
-
* Just export a default object with name, description, parameters, and execute.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
name: 'fibonacci',
|
|
10
|
-
description: 'Returns the nth Fibonacci number (0-based indexing).',
|
|
11
|
-
|
|
12
|
-
parameters: {
|
|
13
|
-
n: {
|
|
14
|
-
type: 'number',
|
|
15
|
-
description: 'The index of the Fibonacci number (0-based). For example, n=0 returns 0, n=5 returns 5.',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
execute: async ({ n }) => {
|
|
20
|
-
// Validate input
|
|
21
|
-
if (n < 0) {
|
|
22
|
-
throw new Error('Index must be non-negative');
|
|
23
|
-
}
|
|
24
|
-
if (!Number.isInteger(n)) {
|
|
25
|
-
throw new Error('Index must be an integer');
|
|
26
|
-
}
|
|
27
|
-
if (n > 100) {
|
|
28
|
-
throw new Error('Index too large (max 100 to prevent overflow)');
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Calculate Fibonacci number
|
|
32
|
-
if (n === 0) return `Fibonacci(${n}) = 0`;
|
|
33
|
-
if (n === 1) return `Fibonacci(${n}) = 1`;
|
|
34
|
-
|
|
35
|
-
let prev = 0;
|
|
36
|
-
let curr = 1;
|
|
37
|
-
|
|
38
|
-
for (let i = 2; i <= n; i++) {
|
|
39
|
-
const next = prev + curr;
|
|
40
|
-
prev = curr;
|
|
41
|
-
curr = next;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return `Fibonacci(${n}) = ${curr}`;
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
// Optional: Export metadata for discovery
|
|
49
|
-
export const metadata = {
|
|
50
|
-
name: 'fibonacci',
|
|
51
|
-
description: 'Returns the nth Fibonacci number',
|
|
52
|
-
version: '1.0.0',
|
|
53
|
-
author: 'Agent Orchestrator',
|
|
54
|
-
tags: ['math', 'fibonacci'],
|
|
55
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
Welcome to Agent Orchestrator
|
|
2
|
-
|
|
3
|
-
This is an example document for the vector store.
|
|
4
|
-
|
|
5
|
-
Agent Orchestrator is a TypeScript framework for building and orchestrating multi-agent AI systems with LangChain, Model Context Protocol (MCP), and vector store integration.
|
|
6
|
-
|
|
7
|
-
Key Features:
|
|
8
|
-
- Define agents using YAML configuration files
|
|
9
|
-
- Create workflows that coordinate multiple agents
|
|
10
|
-
- Integrate vector stores for RAG capabilities
|
|
11
|
-
- Connect MCP servers for extended functionality
|
|
12
|
-
- REST API for programmatic access
|
|
13
|
-
|
|
14
|
-
You can add more documents to this directory to build your knowledge base.
|
|
15
|
-
Each document will be chunked and embedded for semantic search.
|