agent-orcha 0.0.4 → 0.0.7
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 +216 -1323
- package/dist/lib/agents/agent-executor.d.ts +15 -4
- package/dist/lib/agents/agent-executor.d.ts.map +1 -1
- package/dist/lib/agents/agent-executor.js +337 -87
- package/dist/lib/agents/agent-executor.js.map +1 -1
- package/dist/lib/agents/agent-loader.d.ts +4 -1
- package/dist/lib/agents/agent-loader.d.ts.map +1 -1
- package/dist/lib/agents/agent-loader.js +20 -4
- package/dist/lib/agents/agent-loader.js.map +1 -1
- package/dist/lib/agents/index.d.ts +5 -5
- package/dist/lib/agents/index.js +4 -4
- package/dist/lib/agents/react-loop.d.ts +30 -0
- package/dist/lib/agents/react-loop.d.ts.map +1 -0
- package/dist/lib/agents/react-loop.js +193 -0
- package/dist/lib/agents/react-loop.js.map +1 -0
- package/dist/lib/agents/structured-output-wrapper.d.ts +3 -3
- package/dist/lib/agents/structured-output-wrapper.d.ts.map +1 -1
- package/dist/lib/agents/structured-output-wrapper.js +2 -2
- package/dist/lib/agents/structured-output-wrapper.js.map +1 -1
- package/dist/lib/agents/types.d.ts +306 -19
- package/dist/lib/agents/types.d.ts.map +1 -1
- package/dist/lib/agents/types.js +34 -4
- package/dist/lib/agents/types.js.map +1 -1
- package/dist/lib/functions/function-loader.d.ts +3 -1
- package/dist/lib/functions/function-loader.d.ts.map +1 -1
- package/dist/lib/functions/function-loader.js +23 -5
- package/dist/lib/functions/function-loader.js.map +1 -1
- package/dist/lib/functions/index.d.ts +2 -2
- package/dist/lib/functions/index.js +1 -1
- package/dist/lib/functions/simple-function-wrapper.d.ts +2 -11
- package/dist/lib/functions/simple-function-wrapper.d.ts.map +1 -1
- package/dist/lib/functions/simple-function-wrapper.js +3 -3
- package/dist/lib/functions/simple-function-wrapper.js.map +1 -1
- package/dist/lib/index.d.ts +29 -17
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +21 -9
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/integrations/collabnook.d.ts +56 -0
- package/dist/lib/integrations/collabnook.d.ts.map +1 -0
- package/dist/lib/integrations/collabnook.js +307 -0
- package/dist/lib/integrations/collabnook.js.map +1 -0
- package/dist/lib/integrations/email.d.ts +38 -0
- package/dist/lib/integrations/email.d.ts.map +1 -0
- package/dist/lib/integrations/email.js +249 -0
- package/dist/lib/integrations/email.js.map +1 -0
- package/dist/lib/integrations/integration-manager.d.ts +19 -0
- package/dist/lib/integrations/integration-manager.d.ts.map +1 -0
- package/dist/lib/integrations/integration-manager.js +159 -0
- package/dist/lib/integrations/integration-manager.js.map +1 -0
- package/dist/lib/integrations/types.d.ts +232 -0
- package/dist/lib/integrations/types.d.ts.map +1 -0
- package/dist/lib/integrations/types.js +37 -0
- package/dist/lib/integrations/types.js.map +1 -0
- package/dist/lib/knowledge/direct-mapper.d.ts +21 -0
- package/dist/lib/knowledge/direct-mapper.d.ts.map +1 -0
- package/dist/lib/knowledge/direct-mapper.js +134 -0
- package/dist/lib/knowledge/direct-mapper.js.map +1 -0
- package/dist/lib/knowledge/index.d.ts +9 -8
- package/dist/lib/knowledge/index.d.ts.map +1 -1
- package/dist/lib/knowledge/index.js +9 -7
- package/dist/lib/knowledge/index.js.map +1 -1
- package/dist/lib/knowledge/knowledge-store-metadata.d.ts +40 -0
- package/dist/lib/knowledge/knowledge-store-metadata.d.ts.map +1 -0
- package/dist/lib/knowledge/knowledge-store-metadata.js +93 -0
- package/dist/lib/knowledge/knowledge-store-metadata.js.map +1 -0
- package/dist/lib/knowledge/knowledge-store.d.ts +49 -0
- package/dist/lib/knowledge/knowledge-store.d.ts.map +1 -0
- package/dist/lib/knowledge/knowledge-store.js +670 -0
- package/dist/lib/knowledge/knowledge-store.js.map +1 -0
- package/dist/lib/knowledge/loaders/database-loader.d.ts +5 -5
- package/dist/lib/knowledge/loaders/database-loader.d.ts.map +1 -1
- package/dist/lib/knowledge/loaders/database-loader.js +21 -10
- package/dist/lib/knowledge/loaders/database-loader.js.map +1 -1
- package/dist/lib/knowledge/loaders/file-loaders.d.ts +45 -0
- package/dist/lib/knowledge/loaders/file-loaders.d.ts.map +1 -0
- package/dist/lib/knowledge/loaders/file-loaders.js +160 -0
- package/dist/lib/knowledge/loaders/file-loaders.js.map +1 -0
- package/dist/lib/knowledge/loaders/index.d.ts +3 -3
- package/dist/lib/knowledge/loaders/index.d.ts.map +1 -1
- package/dist/lib/knowledge/loaders/index.js +3 -3
- package/dist/lib/knowledge/loaders/index.js.map +1 -1
- package/dist/lib/knowledge/loaders/web-loader.d.ts +14 -5
- package/dist/lib/knowledge/loaders/web-loader.d.ts.map +1 -1
- package/dist/lib/knowledge/loaders/web-loader.js +64 -29
- package/dist/lib/knowledge/loaders/web-loader.js.map +1 -1
- package/dist/lib/knowledge/sqlite-store.d.ts +107 -0
- package/dist/lib/knowledge/sqlite-store.d.ts.map +1 -0
- package/dist/lib/knowledge/sqlite-store.js +327 -0
- package/dist/lib/knowledge/sqlite-store.js.map +1 -0
- package/dist/lib/knowledge/types.d.ts +124 -1448
- package/dist/lib/knowledge/types.d.ts.map +1 -1
- package/dist/lib/knowledge/types.js +54 -60
- package/dist/lib/knowledge/types.js.map +1 -1
- package/dist/lib/knowledge/utils/connection-pool.d.ts +3 -2
- package/dist/lib/knowledge/utils/connection-pool.d.ts.map +1 -1
- package/dist/lib/knowledge/utils/connection-pool.js +20 -10
- package/dist/lib/knowledge/utils/connection-pool.js.map +1 -1
- package/dist/lib/knowledge/utils/index.d.ts +2 -2
- package/dist/lib/knowledge/utils/index.js +2 -2
- package/dist/lib/llm/index.d.ts +5 -5
- package/dist/lib/llm/index.d.ts.map +1 -1
- package/dist/lib/llm/index.js +3 -3
- package/dist/lib/llm/index.js.map +1 -1
- package/dist/lib/llm/llm-call-logger.d.ts +39 -0
- package/dist/lib/llm/llm-call-logger.d.ts.map +1 -0
- package/dist/lib/llm/llm-call-logger.js +110 -0
- package/dist/lib/llm/llm-call-logger.js.map +1 -0
- package/dist/lib/llm/llm-config.d.ts +30 -16
- package/dist/lib/llm/llm-config.d.ts.map +1 -1
- package/dist/lib/llm/llm-config.js +22 -4
- package/dist/lib/llm/llm-config.js.map +1 -1
- package/dist/lib/llm/llm-factory.d.ts +3 -16
- package/dist/lib/llm/llm-factory.d.ts.map +1 -1
- package/dist/lib/llm/llm-factory.js +33 -48
- package/dist/lib/llm/llm-factory.js.map +1 -1
- package/dist/lib/llm/provider-detector.d.ts +1 -1
- package/dist/lib/llm/providers/anthropic-chat-model.d.ts +31 -0
- package/dist/lib/llm/providers/anthropic-chat-model.d.ts.map +1 -0
- package/dist/lib/llm/providers/anthropic-chat-model.js +262 -0
- package/dist/lib/llm/providers/anthropic-chat-model.js.map +1 -0
- package/dist/lib/llm/providers/gemini-chat-model.d.ts +30 -0
- package/dist/lib/llm/providers/gemini-chat-model.d.ts.map +1 -0
- package/dist/lib/llm/providers/gemini-chat-model.js +300 -0
- package/dist/lib/llm/providers/gemini-chat-model.js.map +1 -0
- package/dist/lib/llm/providers/gemini-embeddings.d.ts +14 -0
- package/dist/lib/llm/providers/gemini-embeddings.d.ts.map +1 -0
- package/dist/lib/llm/providers/gemini-embeddings.js +20 -0
- package/dist/lib/llm/providers/gemini-embeddings.js.map +1 -0
- package/dist/lib/llm/providers/openai-chat-model.d.ts +39 -0
- package/dist/lib/llm/providers/openai-chat-model.d.ts.map +1 -0
- package/dist/lib/llm/providers/openai-chat-model.js +397 -0
- package/dist/lib/llm/providers/openai-chat-model.js.map +1 -0
- package/dist/lib/llm/providers/openai-embeddings.d.ts +17 -0
- package/dist/lib/llm/providers/openai-embeddings.d.ts.map +1 -0
- package/dist/lib/llm/providers/openai-embeddings.js +35 -0
- package/dist/lib/llm/providers/openai-embeddings.js.map +1 -0
- package/dist/lib/llm/types.d.ts +2 -2
- package/dist/lib/llm/types.js +1 -1
- package/dist/lib/logger.d.ts +7 -0
- package/dist/lib/logger.d.ts.map +1 -1
- package/dist/lib/logger.js +42 -4
- package/dist/lib/logger.js.map +1 -1
- package/dist/lib/mcp/index.d.ts +3 -3
- package/dist/lib/mcp/index.js +2 -2
- package/dist/lib/mcp/mcp-client.d.ts +3 -2
- package/dist/lib/mcp/mcp-client.d.ts.map +1 -1
- package/dist/lib/mcp/mcp-client.js +10 -5
- package/dist/lib/mcp/mcp-client.js.map +1 -1
- package/dist/lib/mcp/types.d.ts +26 -25
- package/dist/lib/mcp/types.d.ts.map +1 -1
- package/dist/lib/mcp/types.js +12 -4
- package/dist/lib/mcp/types.js.map +1 -1
- package/dist/lib/memory/conversation-store.d.ts +2 -2
- package/dist/lib/memory/conversation-store.d.ts.map +1 -1
- package/dist/lib/memory/conversation-store.js +1 -1
- package/dist/lib/memory/index.d.ts +3 -2
- package/dist/lib/memory/index.d.ts.map +1 -1
- package/dist/lib/memory/index.js +3 -2
- package/dist/lib/memory/index.js.map +1 -1
- package/dist/lib/memory/memory-manager.d.ts +10 -0
- package/dist/lib/memory/memory-manager.d.ts.map +1 -0
- package/dist/lib/memory/memory-manager.js +43 -0
- package/dist/lib/memory/memory-manager.js.map +1 -0
- package/dist/lib/memory/types.d.ts +1 -1
- package/dist/lib/memory/types.d.ts.map +1 -1
- package/dist/lib/orchestrator.d.ts +72 -18
- package/dist/lib/orchestrator.d.ts.map +1 -1
- package/dist/lib/orchestrator.js +341 -56
- package/dist/lib/orchestrator.js.map +1 -1
- package/dist/lib/sandbox/cdp-client.d.ts +14 -0
- package/dist/lib/sandbox/cdp-client.d.ts.map +1 -0
- package/dist/lib/sandbox/cdp-client.js +113 -0
- package/dist/lib/sandbox/cdp-client.js.map +1 -0
- package/dist/lib/sandbox/html-to-markdown.d.ts +10 -0
- package/dist/lib/sandbox/html-to-markdown.d.ts.map +1 -0
- package/dist/lib/sandbox/html-to-markdown.js +121 -0
- package/dist/lib/sandbox/html-to-markdown.js.map +1 -0
- package/dist/lib/sandbox/index.d.ts +12 -0
- package/dist/lib/sandbox/index.d.ts.map +1 -0
- package/dist/lib/sandbox/index.js +10 -0
- package/dist/lib/sandbox/index.js.map +1 -0
- package/dist/lib/sandbox/page-readiness.d.ts +37 -0
- package/dist/lib/sandbox/page-readiness.d.ts.map +1 -0
- package/dist/lib/sandbox/page-readiness.js +235 -0
- package/dist/lib/sandbox/page-readiness.js.map +1 -0
- package/dist/lib/sandbox/sandbox-browser.d.ts +4 -0
- package/dist/lib/sandbox/sandbox-browser.d.ts.map +1 -0
- package/dist/lib/sandbox/sandbox-browser.js +303 -0
- package/dist/lib/sandbox/sandbox-browser.js.map +1 -0
- package/dist/lib/sandbox/sandbox-exec.d.ts +5 -0
- package/dist/lib/sandbox/sandbox-exec.d.ts.map +1 -0
- package/dist/lib/sandbox/sandbox-exec.js +35 -0
- package/dist/lib/sandbox/sandbox-exec.js.map +1 -0
- package/dist/lib/sandbox/sandbox-file.d.ts +4 -0
- package/dist/lib/sandbox/sandbox-file.d.ts.map +1 -0
- package/dist/lib/sandbox/sandbox-file.js +168 -0
- package/dist/lib/sandbox/sandbox-file.js.map +1 -0
- package/dist/lib/sandbox/sandbox-shell.d.ts +4 -0
- package/dist/lib/sandbox/sandbox-shell.d.ts.map +1 -0
- package/dist/lib/sandbox/sandbox-shell.js +93 -0
- package/dist/lib/sandbox/sandbox-shell.js.map +1 -0
- package/dist/lib/sandbox/sandbox-web.d.ts +5 -0
- package/dist/lib/sandbox/sandbox-web.d.ts.map +1 -0
- package/dist/lib/sandbox/sandbox-web.js +226 -0
- package/dist/lib/sandbox/sandbox-web.js.map +1 -0
- package/dist/lib/sandbox/types.d.ts +30 -0
- package/dist/lib/sandbox/types.d.ts.map +1 -0
- package/dist/lib/sandbox/types.js +8 -0
- package/dist/lib/sandbox/types.js.map +1 -0
- package/dist/lib/sandbox/vision-browser.d.ts +4 -0
- package/dist/lib/sandbox/vision-browser.d.ts.map +1 -0
- package/dist/lib/sandbox/vision-browser.js +289 -0
- package/dist/lib/sandbox/vision-browser.js.map +1 -0
- package/dist/lib/sandbox/vm-executor.d.ts +12 -0
- package/dist/lib/sandbox/vm-executor.d.ts.map +1 -0
- package/dist/lib/sandbox/vm-executor.js +101 -0
- package/dist/lib/sandbox/vm-executor.js.map +1 -0
- package/dist/lib/skills/index.d.ts +4 -0
- package/dist/lib/skills/index.d.ts.map +1 -0
- package/dist/lib/skills/index.js +3 -0
- package/dist/lib/skills/index.js.map +1 -0
- package/dist/lib/skills/skill-loader.d.ts +21 -0
- package/dist/lib/skills/skill-loader.d.ts.map +1 -0
- package/dist/lib/skills/skill-loader.js +116 -0
- package/dist/lib/skills/skill-loader.js.map +1 -0
- package/dist/lib/skills/types.d.ts +17 -0
- package/dist/lib/skills/types.d.ts.map +1 -0
- package/dist/lib/skills/types.js +6 -0
- package/dist/lib/skills/types.js.map +1 -0
- package/dist/lib/tasks/index.d.ts +4 -0
- package/dist/lib/tasks/index.d.ts.map +1 -0
- package/dist/lib/tasks/index.js +4 -0
- package/dist/lib/tasks/index.js.map +1 -0
- package/dist/lib/tasks/task-manager.d.ts +27 -0
- package/dist/lib/tasks/task-manager.d.ts.map +1 -0
- package/dist/lib/tasks/task-manager.js +200 -0
- package/dist/lib/tasks/task-manager.js.map +1 -0
- package/dist/lib/tasks/task-store.d.ts +20 -0
- package/dist/lib/tasks/task-store.d.ts.map +1 -0
- package/dist/lib/tasks/task-store.js +102 -0
- package/dist/lib/tasks/task-store.js.map +1 -0
- package/dist/lib/tasks/types.d.ts +56 -0
- package/dist/lib/tasks/types.d.ts.map +1 -0
- package/dist/lib/tasks/types.js +2 -0
- package/dist/lib/tasks/types.js.map +1 -0
- package/dist/lib/templates/resource-templates.d.ts +6 -0
- package/dist/lib/templates/resource-templates.d.ts.map +1 -0
- package/dist/lib/templates/resource-templates.js +146 -0
- package/dist/lib/templates/resource-templates.js.map +1 -0
- package/dist/lib/tools/agent-tool-wrapper.d.ts +5 -5
- package/dist/lib/tools/agent-tool-wrapper.js +3 -3
- package/dist/lib/tools/agent-tool-wrapper.js.map +1 -1
- package/dist/lib/tools/built-in/ask-user.tool.d.ts +1 -1
- package/dist/lib/tools/built-in/ask-user.tool.d.ts.map +1 -1
- package/dist/lib/tools/built-in/ask-user.tool.js +2 -2
- package/dist/lib/tools/built-in/ask-user.tool.js.map +1 -1
- package/dist/lib/tools/built-in/index.d.ts +9 -2
- package/dist/lib/tools/built-in/index.d.ts.map +1 -1
- package/dist/lib/tools/built-in/index.js +9 -2
- package/dist/lib/tools/built-in/index.js.map +1 -1
- package/dist/lib/tools/built-in/integration-tools.d.ts +4 -0
- package/dist/lib/tools/built-in/integration-tools.d.ts.map +1 -0
- package/dist/lib/tools/built-in/integration-tools.js +47 -0
- package/dist/lib/tools/built-in/integration-tools.js.map +1 -0
- package/dist/lib/tools/built-in/knowledge-entity-lookup.tool.d.ts +9 -0
- package/dist/lib/tools/built-in/knowledge-entity-lookup.tool.d.ts.map +1 -0
- package/dist/lib/tools/built-in/knowledge-entity-lookup.tool.js +108 -0
- package/dist/lib/tools/built-in/knowledge-entity-lookup.tool.js.map +1 -0
- package/dist/lib/tools/built-in/knowledge-graph-schema.tool.d.ts +9 -0
- package/dist/lib/tools/built-in/knowledge-graph-schema.tool.d.ts.map +1 -0
- package/dist/lib/tools/built-in/knowledge-graph-schema.tool.js +96 -0
- package/dist/lib/tools/built-in/knowledge-graph-schema.tool.js.map +1 -0
- package/dist/lib/tools/built-in/knowledge-search.tool.d.ts +2 -2
- package/dist/lib/tools/built-in/knowledge-search.tool.d.ts.map +1 -1
- package/dist/lib/tools/built-in/knowledge-search.tool.js +1 -1
- package/dist/lib/tools/built-in/knowledge-search.tool.js.map +1 -1
- package/dist/lib/tools/built-in/knowledge-sql.tool.d.ts +7 -0
- package/dist/lib/tools/built-in/knowledge-sql.tool.d.ts.map +1 -0
- package/dist/lib/tools/built-in/knowledge-sql.tool.js +128 -0
- package/dist/lib/tools/built-in/knowledge-sql.tool.js.map +1 -0
- package/dist/lib/tools/built-in/knowledge-tools-factory.d.ts +17 -0
- package/dist/lib/tools/built-in/knowledge-tools-factory.d.ts.map +1 -0
- package/dist/lib/tools/built-in/knowledge-tools-factory.js +54 -0
- package/dist/lib/tools/built-in/knowledge-tools-factory.js.map +1 -0
- package/dist/lib/tools/built-in/knowledge-traverse.tool.d.ts +9 -0
- package/dist/lib/tools/built-in/knowledge-traverse.tool.d.ts.map +1 -0
- package/dist/lib/tools/built-in/knowledge-traverse.tool.js +91 -0
- package/dist/lib/tools/built-in/knowledge-traverse.tool.js.map +1 -0
- package/dist/lib/tools/built-in/memory-save.tool.d.ts +4 -0
- package/dist/lib/tools/built-in/memory-save.tool.d.ts.map +1 -0
- package/dist/lib/tools/built-in/memory-save.tool.js +21 -0
- package/dist/lib/tools/built-in/memory-save.tool.js.map +1 -0
- package/dist/lib/tools/built-in/query-validators.d.ts +18 -0
- package/dist/lib/tools/built-in/query-validators.d.ts.map +1 -0
- package/dist/lib/tools/built-in/query-validators.js +91 -0
- package/dist/lib/tools/built-in/query-validators.js.map +1 -0
- package/dist/lib/tools/index.d.ts +4 -4
- package/dist/lib/tools/index.js +4 -4
- package/dist/lib/tools/tool-discovery.d.ts +11 -33
- package/dist/lib/tools/tool-discovery.d.ts.map +1 -1
- package/dist/lib/tools/tool-discovery.js +16 -43
- package/dist/lib/tools/tool-discovery.js.map +1 -1
- package/dist/lib/tools/tool-registry.d.ts +10 -18
- package/dist/lib/tools/tool-registry.d.ts.map +1 -1
- package/dist/lib/tools/tool-registry.js +37 -23
- package/dist/lib/tools/tool-registry.js.map +1 -1
- package/dist/lib/tools/workspace/workspace-tools.d.ts +61 -0
- package/dist/lib/tools/workspace/workspace-tools.d.ts.map +1 -0
- package/dist/lib/tools/workspace/workspace-tools.js +179 -0
- package/dist/lib/tools/workspace/workspace-tools.js.map +1 -0
- package/dist/lib/triggers/cron-trigger.d.ts +12 -0
- package/dist/lib/triggers/cron-trigger.d.ts.map +1 -0
- package/dist/lib/triggers/cron-trigger.js +45 -0
- package/dist/lib/triggers/cron-trigger.js.map +1 -0
- package/dist/lib/triggers/index.d.ts +6 -0
- package/dist/lib/triggers/index.d.ts.map +1 -0
- package/dist/lib/triggers/index.js +5 -0
- package/dist/lib/triggers/index.js.map +1 -0
- package/dist/lib/triggers/trigger-manager.d.ts +12 -0
- package/dist/lib/triggers/trigger-manager.d.ts.map +1 -0
- package/dist/lib/triggers/trigger-manager.js +77 -0
- package/dist/lib/triggers/trigger-manager.js.map +1 -0
- package/dist/lib/triggers/types.d.ts +57 -0
- package/dist/lib/triggers/types.d.ts.map +1 -0
- package/dist/lib/triggers/types.js +16 -0
- package/dist/lib/triggers/types.js.map +1 -0
- package/dist/lib/triggers/webhook-trigger.d.ts +12 -0
- package/dist/lib/triggers/webhook-trigger.d.ts.map +1 -0
- package/dist/lib/triggers/webhook-trigger.js +34 -0
- package/dist/lib/triggers/webhook-trigger.js.map +1 -0
- package/dist/lib/types/llm-types.d.ts +72 -0
- package/dist/lib/types/llm-types.d.ts.map +1 -0
- package/dist/lib/types/llm-types.js +72 -0
- package/dist/lib/types/llm-types.js.map +1 -0
- package/dist/lib/types/text-splitters.d.ts +27 -0
- package/dist/lib/types/text-splitters.d.ts.map +1 -0
- package/dist/lib/types/text-splitters.js +114 -0
- package/dist/lib/types/text-splitters.js.map +1 -0
- package/dist/lib/types/tool-factory.d.ts +9 -0
- package/dist/lib/types/tool-factory.d.ts.map +1 -0
- package/dist/lib/types/tool-factory.js +12 -0
- package/dist/lib/types/tool-factory.js.map +1 -0
- package/dist/lib/utils/env-substitution.d.ts +6 -0
- package/dist/lib/utils/env-substitution.d.ts.map +1 -0
- package/dist/lib/utils/env-substitution.js +15 -0
- package/dist/lib/utils/env-substitution.js.map +1 -0
- package/dist/lib/utils/file-utils.d.ts +11 -0
- package/dist/lib/utils/file-utils.d.ts.map +1 -0
- package/dist/lib/utils/file-utils.js +86 -0
- package/dist/lib/utils/file-utils.js.map +1 -0
- package/dist/lib/workflows/index.d.ts +6 -6
- package/dist/lib/workflows/index.d.ts.map +1 -1
- package/dist/lib/workflows/index.js +5 -5
- package/dist/lib/workflows/index.js.map +1 -1
- package/dist/lib/workflows/interrupt-manager.d.ts +1 -1
- package/dist/lib/workflows/interrupt-manager.js +1 -1
- package/dist/lib/workflows/react-workflow-executor.d.ts +26 -0
- package/dist/lib/workflows/react-workflow-executor.d.ts.map +1 -0
- package/dist/lib/workflows/react-workflow-executor.js +333 -0
- package/dist/lib/workflows/react-workflow-executor.js.map +1 -0
- package/dist/lib/workflows/types.d.ts +106 -107
- package/dist/lib/workflows/types.d.ts.map +1 -1
- package/dist/lib/workflows/types.js +5 -5
- package/dist/lib/workflows/types.js.map +1 -1
- package/dist/lib/workflows/workflow-executor.d.ts +3 -3
- package/dist/lib/workflows/workflow-executor.js +2 -2
- package/dist/lib/workflows/workflow-executor.js.map +1 -1
- package/dist/lib/workflows/workflow-loader.d.ts +4 -1
- package/dist/lib/workflows/workflow-loader.d.ts.map +1 -1
- package/dist/lib/workflows/workflow-loader.js +20 -4
- package/dist/lib/workflows/workflow-loader.js.map +1 -1
- package/dist/public/chat.html +114 -0
- package/dist/public/index.html +189 -0
- package/dist/public/src/components/AgentComposer.js +807 -0
- package/dist/public/src/components/AgentsView.js +1021 -344
- package/dist/public/src/components/AppRoot.js +150 -5
- package/dist/public/src/components/GraphView.js +420 -0
- package/dist/public/src/components/IdeView.js +625 -14
- package/dist/public/src/components/KnowledgeView.js +443 -66
- package/dist/public/src/components/MonitorView.js +526 -0
- package/dist/public/src/components/NavBar.js +3 -0
- package/dist/public/src/components/SkillsView.js +137 -0
- package/dist/public/src/components/StandaloneChat.js +889 -0
- package/dist/public/src/components/WorkflowsView.js +454 -129
- package/dist/public/src/services/ApiService.js +170 -25
- package/dist/public/src/services/SessionStore.js +83 -0
- package/dist/public/src/store.js +3 -4
- package/dist/public/src/utils/markdown.js +14 -0
- package/dist/src/cli/commands/init.js +2 -2
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/cli/commands/start.d.ts +0 -1
- package/dist/src/cli/commands/start.d.ts.map +1 -1
- package/dist/src/cli/commands/start.js +23 -14
- package/dist/src/cli/commands/start.js.map +1 -1
- package/dist/src/cli/index.js +8 -5
- package/dist/src/cli/index.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +23 -9
- package/dist/src/index.js.map +1 -1
- package/dist/src/middleware/auth.d.ts +3 -0
- package/dist/src/middleware/auth.d.ts.map +1 -0
- package/dist/src/middleware/auth.js +129 -0
- package/dist/src/middleware/auth.js.map +1 -0
- package/dist/src/middleware/rate-limit.d.ts +8 -0
- package/dist/src/middleware/rate-limit.d.ts.map +1 -0
- package/dist/src/middleware/rate-limit.js +21 -0
- package/dist/src/middleware/rate-limit.js.map +1 -0
- package/dist/src/routes/agents.route.d.ts.map +1 -1
- package/dist/src/routes/agents.route.js +167 -12
- package/dist/src/routes/agents.route.js.map +1 -1
- package/dist/src/routes/chat.route.d.ts +3 -0
- package/dist/src/routes/chat.route.d.ts.map +1 -0
- package/dist/src/routes/chat.route.js +155 -0
- package/dist/src/routes/chat.route.js.map +1 -0
- package/dist/src/routes/files.route.d.ts.map +1 -1
- package/dist/src/routes/files.route.js +163 -87
- package/dist/src/routes/files.route.js.map +1 -1
- package/dist/src/routes/functions.route.js +1 -1
- package/dist/src/routes/graph.route.d.ts +3 -0
- package/dist/src/routes/graph.route.d.ts.map +1 -0
- package/dist/src/routes/graph.route.js +173 -0
- package/dist/src/routes/graph.route.js.map +1 -0
- package/dist/src/routes/knowledge.route.d.ts.map +1 -1
- package/dist/src/routes/knowledge.route.js +172 -69
- package/dist/src/routes/knowledge.route.js.map +1 -1
- package/dist/src/routes/llm.route.d.ts.map +1 -1
- package/dist/src/routes/llm.route.js +85 -9
- package/dist/src/routes/llm.route.js.map +1 -1
- package/dist/src/routes/mcp.route.js +1 -1
- package/dist/src/routes/skills.route.d.ts +3 -0
- package/dist/src/routes/skills.route.d.ts.map +1 -0
- package/dist/src/routes/skills.route.js +23 -0
- package/dist/src/routes/skills.route.js.map +1 -0
- package/dist/src/routes/tasks.route.d.ts +3 -0
- package/dist/src/routes/tasks.route.d.ts.map +1 -0
- package/dist/src/routes/tasks.route.js +149 -0
- package/dist/src/routes/tasks.route.js.map +1 -0
- package/dist/src/routes/vnc.route.d.ts +3 -0
- package/dist/src/routes/vnc.route.d.ts.map +1 -0
- package/dist/src/routes/vnc.route.js +49 -0
- package/dist/src/routes/vnc.route.js.map +1 -0
- package/dist/src/routes/workflows.route.d.ts.map +1 -1
- package/dist/src/routes/workflows.route.js +9 -1
- package/dist/src/routes/workflows.route.js.map +1 -1
- package/dist/src/server.d.ts +1 -1
- package/dist/src/server.d.ts.map +1 -1
- package/dist/src/server.js +26 -9
- package/dist/src/server.js.map +1 -1
- package/dist/templates/.env.example +4 -19
- package/dist/templates/Demo.md +152 -0
- package/dist/templates/README.md +28 -11
- package/dist/templates/agents/architect.agent.yaml +57 -0
- package/dist/templates/agents/chatbot.agent.yaml +55 -0
- package/dist/templates/agents/corporate.agent.yaml +65 -0
- package/dist/templates/agents/investment-analyst.agent.yaml +80 -0
- package/dist/templates/agents/music-librarian.agent.yaml +70 -0
- package/dist/templates/agents/network-security.agent.yaml +82 -0
- package/dist/templates/agents/transport-security.agent.yaml +70 -0
- package/dist/templates/agents/web-engineer.agent.yaml +99 -0
- package/dist/templates/agents/web-pilot.agent.yaml +58 -0
- package/dist/templates/knowledge/music-store/LICENSE.md +11 -0
- package/dist/templates/knowledge/music-store/musicstore.sqlite +0 -0
- package/dist/templates/knowledge/music-store/tables.png +0 -0
- package/dist/templates/knowledge/music-store.knowledge.yaml +138 -0
- package/dist/templates/knowledge/org-chart/personnel.csv +21 -0
- package/dist/templates/knowledge/org-chart.knowledge.yaml +53 -0
- package/dist/templates/knowledge/pet-store/pet-store.db +0 -0
- package/dist/templates/knowledge/pet-store.knowledge.yaml +81 -0
- package/dist/templates/knowledge/security-incidents/incidents.json +55935 -0
- package/dist/templates/knowledge/security-incidents.knowledge.yaml +46 -0
- package/dist/templates/knowledge/transcripts.knowledge.yaml +29 -0
- package/dist/templates/knowledge/transport-ot/systems.csv +117 -0
- package/dist/templates/knowledge/transport-ot.knowledge.yaml +55 -0
- package/dist/templates/knowledge/web-docs.knowledge.yaml +20 -0
- package/dist/templates/llm.json +7 -30
- package/dist/templates/mcp.json +10 -4
- package/dist/templates/skills/orcha-builder/SKILL.md +219 -0
- package/dist/templates/skills/pii-guard/SKILL.md +22 -0
- package/dist/templates/skills/sandbox/SKILL.md +40 -0
- package/dist/templates/skills/web-pilot/SKILL.md +51 -0
- package/dist/templates/workflows/example.workflow.yaml +25 -30
- package/dist/templates/workflows/react-example.workflow.yaml +53 -0
- package/package.json +22 -20
- package/dist/lib/knowledge/graph-rag/community-detector.d.ts +0 -16
- package/dist/lib/knowledge/graph-rag/community-detector.d.ts.map +0 -1
- package/dist/lib/knowledge/graph-rag/community-detector.js +0 -81
- package/dist/lib/knowledge/graph-rag/community-detector.js.map +0 -1
- package/dist/lib/knowledge/graph-rag/community-summarizer.d.ts +0 -17
- package/dist/lib/knowledge/graph-rag/community-summarizer.d.ts.map +0 -1
- package/dist/lib/knowledge/graph-rag/community-summarizer.js +0 -87
- package/dist/lib/knowledge/graph-rag/community-summarizer.js.map +0 -1
- package/dist/lib/knowledge/graph-rag/entity-extractor.d.ts +0 -36
- package/dist/lib/knowledge/graph-rag/entity-extractor.d.ts.map +0 -1
- package/dist/lib/knowledge/graph-rag/entity-extractor.js +0 -192
- package/dist/lib/knowledge/graph-rag/entity-extractor.js.map +0 -1
- package/dist/lib/knowledge/graph-rag/extraction-cache.d.ts +0 -30
- package/dist/lib/knowledge/graph-rag/extraction-cache.d.ts.map +0 -1
- package/dist/lib/knowledge/graph-rag/extraction-cache.js +0 -88
- package/dist/lib/knowledge/graph-rag/extraction-cache.js.map +0 -1
- package/dist/lib/knowledge/graph-rag/global-search.d.ts +0 -19
- package/dist/lib/knowledge/graph-rag/global-search.d.ts.map +0 -1
- package/dist/lib/knowledge/graph-rag/global-search.js +0 -96
- package/dist/lib/knowledge/graph-rag/global-search.js.map +0 -1
- package/dist/lib/knowledge/graph-rag/graph-rag-factory.d.ts +0 -24
- package/dist/lib/knowledge/graph-rag/graph-rag-factory.d.ts.map +0 -1
- package/dist/lib/knowledge/graph-rag/graph-rag-factory.js +0 -239
- package/dist/lib/knowledge/graph-rag/graph-rag-factory.js.map +0 -1
- package/dist/lib/knowledge/graph-rag/index.d.ts +0 -14
- package/dist/lib/knowledge/graph-rag/index.d.ts.map +0 -1
- package/dist/lib/knowledge/graph-rag/index.js +0 -12
- package/dist/lib/knowledge/graph-rag/index.js.map +0 -1
- package/dist/lib/knowledge/graph-rag/local-search.d.ts +0 -20
- package/dist/lib/knowledge/graph-rag/local-search.d.ts.map +0 -1
- package/dist/lib/knowledge/graph-rag/local-search.js +0 -110
- package/dist/lib/knowledge/graph-rag/local-search.js.map +0 -1
- package/dist/lib/knowledge/graph-rag/memory-graph-store.d.ts +0 -31
- package/dist/lib/knowledge/graph-rag/memory-graph-store.d.ts.map +0 -1
- package/dist/lib/knowledge/graph-rag/memory-graph-store.js +0 -165
- package/dist/lib/knowledge/graph-rag/memory-graph-store.js.map +0 -1
- package/dist/lib/knowledge/graph-rag/neo4j-graph-store.d.ts +0 -38
- package/dist/lib/knowledge/graph-rag/neo4j-graph-store.d.ts.map +0 -1
- package/dist/lib/knowledge/graph-rag/neo4j-graph-store.js +0 -190
- package/dist/lib/knowledge/graph-rag/neo4j-graph-store.js.map +0 -1
- package/dist/lib/knowledge/graph-rag/search-mode-detector.d.ts +0 -11
- package/dist/lib/knowledge/graph-rag/search-mode-detector.d.ts.map +0 -1
- package/dist/lib/knowledge/graph-rag/search-mode-detector.js +0 -50
- package/dist/lib/knowledge/graph-rag/search-mode-detector.js.map +0 -1
- package/dist/lib/knowledge/graph-rag/types.d.ts +0 -368
- package/dist/lib/knowledge/graph-rag/types.d.ts.map +0 -1
- package/dist/lib/knowledge/graph-rag/types.js +0 -48
- package/dist/lib/knowledge/graph-rag/types.js.map +0 -1
- package/dist/lib/knowledge/knowledge-store-factory.d.ts +0 -16
- package/dist/lib/knowledge/knowledge-store-factory.d.ts.map +0 -1
- package/dist/lib/knowledge/knowledge-store-factory.js +0 -376
- package/dist/lib/knowledge/knowledge-store-factory.js.map +0 -1
- package/dist/lib/knowledge/knowledge-store-manager.d.ts +0 -18
- package/dist/lib/knowledge/knowledge-store-manager.d.ts.map +0 -1
- package/dist/lib/knowledge/knowledge-store-manager.js +0 -98
- package/dist/lib/knowledge/knowledge-store-manager.js.map +0 -1
- package/dist/lib/knowledge/loaders/s3-loader.d.ts +0 -17
- package/dist/lib/knowledge/loaders/s3-loader.d.ts.map +0 -1
- package/dist/lib/knowledge/loaders/s3-loader.js +0 -185
- package/dist/lib/knowledge/loaders/s3-loader.js.map +0 -1
- package/dist/lib/workflows/langgraph-executor.d.ts +0 -51
- package/dist/lib/workflows/langgraph-executor.d.ts.map +0 -1
- package/dist/lib/workflows/langgraph-executor.js +0 -297
- package/dist/lib/workflows/langgraph-executor.js.map +0 -1
- package/dist/templates/agents/call-center-analyst-simple.agent.yaml +0 -36
- package/dist/templates/agents/math.agent.yaml +0 -28
- package/dist/templates/agents/sentiment-structured.agent.yaml +0 -42
- package/dist/templates/knowledge/example.knowledge.yaml +0 -28
- package/dist/templates/llm.md +0 -1195
- package/dist/templates/workflows/langgraph-example.workflow.yaml +0 -84
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sandbox
|
|
3
|
+
description: Execute JavaScript, shell commands, fetch web content, and control a browser
|
|
4
|
+
sandbox: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Sandbox Tools
|
|
8
|
+
|
|
9
|
+
## sandbox_exec
|
|
10
|
+
Run JavaScript in isolated VM. Use `console.log()` for output, `return` for result. No `fetch`/`require` — use `sandbox_web_fetch` for HTTP.
|
|
11
|
+
|
|
12
|
+
## sandbox_shell
|
|
13
|
+
Run shell commands in `/tmp` with limited permissions (Docker only).
|
|
14
|
+
|
|
15
|
+
## sandbox_web_fetch
|
|
16
|
+
Fetch web pages (auto-converted to markdown) or APIs (`raw: true`).
|
|
17
|
+
|
|
18
|
+
## sandbox_web_search
|
|
19
|
+
Search DuckDuckGo. Params: `query`, `num_results`.
|
|
20
|
+
|
|
21
|
+
## Browser Tools
|
|
22
|
+
|
|
23
|
+
Observe → Act → Observe loop. Elements have short refs (e1, e2...) — use them in click/type.
|
|
24
|
+
|
|
25
|
+
| Tool | Use |
|
|
26
|
+
|------|-----|
|
|
27
|
+
| `sandbox_browser_observe` | Text snapshot with element refs. Primary verification tool. |
|
|
28
|
+
| `sandbox_browser_navigate` | Go to URL, wait for ready, return snapshot |
|
|
29
|
+
| `sandbox_browser_click` | Click by ref (`"e3"`) or text (`"Submit"`) |
|
|
30
|
+
| `sandbox_browser_type` | Type by ref (`"e5"`), dispatches input/change events |
|
|
31
|
+
| `sandbox_browser_content` | Page as markdown (optional selector) |
|
|
32
|
+
| `sandbox_browser_evaluate` | Run JS, reports side effects |
|
|
33
|
+
| `sandbox_browser_screenshot` | PNG screenshot (expensive, last resort) |
|
|
34
|
+
|
|
35
|
+
## Best Practices
|
|
36
|
+
|
|
37
|
+
1. Use `sandbox_web_fetch` for HTTP — not `fetch` in sandbox_exec
|
|
38
|
+
2. Use observe to verify page state — not screenshots
|
|
39
|
+
3. Use refs from observe output in click/type — don't guess selectors
|
|
40
|
+
4. Check `sideEffects` in evaluate results
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: web-pilot
|
|
3
|
+
description: Browser automation — observe-act loop with refs
|
|
4
|
+
sandbox: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Web Pilot
|
|
8
|
+
|
|
9
|
+
## Tools
|
|
10
|
+
|
|
11
|
+
| Tool | Purpose |
|
|
12
|
+
|------|---------|
|
|
13
|
+
| `sandbox_browser_observe` | Text snapshot: URL, title, headings, textExcerpt, elements with refs |
|
|
14
|
+
| `sandbox_browser_navigate` | Go to URL, wait for ready, return snapshot with textExcerpt |
|
|
15
|
+
| `sandbox_browser_click` | Click by ref (e.g. "e3") or visible text |
|
|
16
|
+
| `sandbox_browser_type` | Type into input by ref (e.g. "e5") |
|
|
17
|
+
| `sandbox_browser_content` | Page as markdown (optional CSS selector) |
|
|
18
|
+
| `sandbox_browser_evaluate` | Run JS, reports side effects |
|
|
19
|
+
| `sandbox_browser_screenshot` | PNG screenshot (expensive, last resort) |
|
|
20
|
+
| `sandbox_web_search` | Search DuckDuckGo for URLs |
|
|
21
|
+
|
|
22
|
+
## Workflow: Observe → Act → Observe
|
|
23
|
+
|
|
24
|
+
1. **Navigate** → returns snapshot with element refs
|
|
25
|
+
2. **Act** using refs from snapshot: `click({ ref: "e3" })` or `type({ ref: "e5", text: "hello" })`
|
|
26
|
+
3. **Observe** → verify action worked
|
|
27
|
+
4. Repeat. Screenshot only if text can't answer your question.
|
|
28
|
+
|
|
29
|
+
## Refs
|
|
30
|
+
|
|
31
|
+
Observe output lists elements like:
|
|
32
|
+
```
|
|
33
|
+
- button "Submit" [ref=e1]
|
|
34
|
+
- textbox [ref=e2] name=email placeholder="Enter email"
|
|
35
|
+
- link "Home" [ref=e3]
|
|
36
|
+
```
|
|
37
|
+
Use refs in click/type: `{ "ref": "e1" }`. Refs update on each observe — always use latest.
|
|
38
|
+
|
|
39
|
+
## Data Extraction Strategy
|
|
40
|
+
|
|
41
|
+
1. **Check textExcerpt first** — observe/navigate returns the first 2000 chars of visible text. For many tasks this is enough.
|
|
42
|
+
2. **Use content(selector)** over content() — target a specific section (e.g. `{ selector: "main" }` or `{ selector: ".repo-list" }`) to avoid huge dumps.
|
|
43
|
+
3. **Use evaluate() for structured extraction** — `evaluate({ expression: "..." })` with JS that returns exactly the data you need (e.g. `[...document.querySelectorAll('.repo')].map(...)`)
|
|
44
|
+
4. **Prefer web_fetch for read-only pages** — if you just need page content without interaction, `sandbox_web_fetch` is cheaper than navigating.
|
|
45
|
+
5. **Never repeat a failed approach** — if a tool call returns nothing useful, switch to a different strategy immediately.
|
|
46
|
+
|
|
47
|
+
## Patterns
|
|
48
|
+
|
|
49
|
+
- **Click by text:** `{ "text": "Accept cookies" }` (when ref unavailable)
|
|
50
|
+
- **Scroll:** evaluate `window.scrollBy(0, 500)` then observe
|
|
51
|
+
- **Dropdown:** evaluate with value set + change event dispatch
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
name:
|
|
2
|
-
description:
|
|
1
|
+
name: research-pipeline
|
|
2
|
+
description: Multi-step research pipeline that searches knowledge bases and produces a friendly summary
|
|
3
3
|
version: "1.0.0"
|
|
4
4
|
type: steps
|
|
5
5
|
|
|
@@ -8,51 +8,50 @@ input:
|
|
|
8
8
|
topic:
|
|
9
9
|
type: string
|
|
10
10
|
required: true
|
|
11
|
-
description: The topic or question
|
|
11
|
+
description: The research topic or question
|
|
12
12
|
|
|
13
13
|
steps:
|
|
14
14
|
|
|
15
|
-
# Step 1: Search
|
|
16
|
-
- id:
|
|
17
|
-
agent:
|
|
15
|
+
# Step 1: Search web knowledge for background information
|
|
16
|
+
- id: web-research
|
|
17
|
+
agent: knowledge-broker
|
|
18
18
|
input:
|
|
19
|
-
query: "{{input.topic}}"
|
|
19
|
+
query: "Find information about {{input.topic}}"
|
|
20
20
|
output:
|
|
21
|
-
key:
|
|
21
|
+
key: web_findings
|
|
22
22
|
|
|
23
|
-
# Step 2:
|
|
24
|
-
- id:
|
|
25
|
-
agent:
|
|
23
|
+
# Step 2: Search org chart to find relevant people in the company
|
|
24
|
+
- id: find-experts
|
|
25
|
+
agent: knowledge-broker
|
|
26
26
|
input:
|
|
27
|
-
query: "
|
|
27
|
+
query: "Who in the company has expertise related to {{input.topic}}?"
|
|
28
28
|
output:
|
|
29
|
-
key:
|
|
29
|
+
key: expert_findings
|
|
30
30
|
|
|
31
|
-
# Step 3: Summarize
|
|
31
|
+
# Step 3: Summarize everything into a friendly report
|
|
32
32
|
- id: summarize
|
|
33
|
-
agent:
|
|
33
|
+
agent: chatbot
|
|
34
34
|
input:
|
|
35
35
|
query: |
|
|
36
|
-
|
|
36
|
+
Write a brief research summary on: {{input.topic}}
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
Background Research:
|
|
39
|
+
{{steps.web-research.output}}
|
|
39
40
|
|
|
40
|
-
|
|
41
|
-
{{steps.
|
|
41
|
+
Internal Experts:
|
|
42
|
+
{{steps.find-experts.output}}
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
{{steps.perform-calculation.output}}
|
|
44
|
+
Combine these into a clear, concise report with sections for background context and recommended contacts.
|
|
45
45
|
output:
|
|
46
|
-
key:
|
|
46
|
+
key: final_report
|
|
47
47
|
|
|
48
48
|
config:
|
|
49
49
|
timeout: 300000
|
|
50
50
|
onError: stop
|
|
51
51
|
|
|
52
52
|
output:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
calculation: "{{steps.perform-calculation.output}}"
|
|
53
|
+
research: "{{steps.web-research.output}}"
|
|
54
|
+
experts: "{{steps.find-experts.output}}"
|
|
56
55
|
summary: "{{steps.summarize.output}}"
|
|
57
56
|
|
|
58
57
|
metadata:
|
|
@@ -61,8 +60,4 @@ metadata:
|
|
|
61
60
|
- demo
|
|
62
61
|
- workflow
|
|
63
62
|
- multi-agent
|
|
64
|
-
-
|
|
65
|
-
- vector-search
|
|
66
|
-
- mcp-tools
|
|
67
|
-
- time-api
|
|
68
|
-
- fibonacci
|
|
63
|
+
- knowledge-search
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
name: react-research
|
|
2
|
+
description: Autonomous research workflow that discovers and uses all available tools and knowledge bases
|
|
3
|
+
version: "1.0.0"
|
|
4
|
+
type: react
|
|
5
|
+
|
|
6
|
+
input:
|
|
7
|
+
schema:
|
|
8
|
+
topic:
|
|
9
|
+
type: string
|
|
10
|
+
required: true
|
|
11
|
+
description: The research topic or question
|
|
12
|
+
|
|
13
|
+
prompt:
|
|
14
|
+
system: |
|
|
15
|
+
You are a research assistant with access to knowledge bases, tools, and other agents.
|
|
16
|
+
|
|
17
|
+
Available knowledge bases include company org charts, product inventories, web content, and more.
|
|
18
|
+
You also have access to calculator functions and other utility tools.
|
|
19
|
+
|
|
20
|
+
Research process:
|
|
21
|
+
1. Identify which knowledge bases and tools are relevant to the topic
|
|
22
|
+
2. Search multiple sources in parallel when possible
|
|
23
|
+
3. Synthesize the results into a comprehensive, well-structured answer
|
|
24
|
+
|
|
25
|
+
If you need clarification from the user, use the ask_user tool.
|
|
26
|
+
goal: "Research and answer: {{input.topic}}"
|
|
27
|
+
|
|
28
|
+
graph:
|
|
29
|
+
model: default
|
|
30
|
+
executionMode: react
|
|
31
|
+
tools:
|
|
32
|
+
mode: all
|
|
33
|
+
sources: [knowledge, function, builtin]
|
|
34
|
+
agents:
|
|
35
|
+
mode: all
|
|
36
|
+
exclude:
|
|
37
|
+
- architect
|
|
38
|
+
maxIterations: 10
|
|
39
|
+
timeout: 300000
|
|
40
|
+
|
|
41
|
+
output:
|
|
42
|
+
analysis: "{{state.messages[-1].content}}"
|
|
43
|
+
|
|
44
|
+
config:
|
|
45
|
+
onError: stop
|
|
46
|
+
|
|
47
|
+
metadata:
|
|
48
|
+
category: example
|
|
49
|
+
tags:
|
|
50
|
+
- demo
|
|
51
|
+
- react
|
|
52
|
+
- autonomous
|
|
53
|
+
- tool-discovery
|
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-orcha",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "TypeScript Agentic Orchestration http server and framework for building multi-agent workflows with MCP tools and vector stores",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
7
7
|
"agents",
|
|
8
8
|
"llm",
|
|
9
|
-
"langchain",
|
|
10
9
|
"mcp",
|
|
11
10
|
"vector-store",
|
|
12
11
|
"rag",
|
|
@@ -35,52 +34,55 @@
|
|
|
35
34
|
"LICENSE"
|
|
36
35
|
],
|
|
37
36
|
"scripts": {
|
|
38
|
-
"dev": "
|
|
37
|
+
"dev": "WORKSPACE=${WORKSPACE:-./templates} node --watch src/index.ts",
|
|
39
38
|
"build": "tsc && npm run copy-assets",
|
|
40
39
|
"copy-assets": "mkdir -p dist && cp -r public dist/ && cp -r templates dist/",
|
|
41
40
|
"start": "node dist/src/index.js",
|
|
42
41
|
"prepublishOnly": "npm run build",
|
|
43
42
|
"lint": "eslint src lib --ext .ts",
|
|
44
43
|
"typecheck": "tsc --noEmit",
|
|
45
|
-
"test": "node --
|
|
44
|
+
"test": "node --test --test-force-exit 'test/**/*.test.ts'",
|
|
45
|
+
"test:coverage": "node --test --test-force-exit --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=lcov.info --test-reporter=spec --test-reporter-destination=stdout 'test/**/*.test.ts'",
|
|
46
|
+
"docker": "docker compose up --build --watch",
|
|
47
|
+
"docker:auth": "AUTH_PASSWORD=${AUTH_PASSWORD:-password} docker compose up --build --watch"
|
|
46
48
|
},
|
|
47
49
|
"dependencies": {
|
|
48
|
-
"@
|
|
50
|
+
"@anthropic-ai/sdk": "^0.76.0",
|
|
49
51
|
"@fastify/cors": "^10.0.1",
|
|
50
52
|
"@fastify/static": "^8.0.4",
|
|
51
|
-
"@
|
|
52
|
-
"@langchain/community": "^1.1.6",
|
|
53
|
-
"@langchain/core": "^1.1.16",
|
|
54
|
-
"@langchain/google-genai": "^2.1.12",
|
|
55
|
-
"@langchain/langgraph": "^1.1.2",
|
|
56
|
-
"@langchain/openai": "^1.2.3",
|
|
57
|
-
"@langchain/textsplitters": "^1.0.1",
|
|
53
|
+
"@google/generative-ai": "^0.24.1",
|
|
58
54
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
59
|
-
"
|
|
55
|
+
"cheerio": "^1.0.0",
|
|
60
56
|
"dotenv": "^16.4.7",
|
|
61
57
|
"fastify": "^5.2.0",
|
|
58
|
+
"fastify-plugin": "^5.1.0",
|
|
62
59
|
"glob": "^11.0.0",
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"langchain": "^1.2.12",
|
|
66
|
-
"minimatch": "^10.0.1",
|
|
60
|
+
"imapflow": "^1.2.10",
|
|
61
|
+
"jsdom": "^28.1.0",
|
|
67
62
|
"mysql2": "^3.12.0",
|
|
68
|
-
"
|
|
63
|
+
"node-cron": "^4.2.1",
|
|
64
|
+
"nodemailer": "^8.0.1",
|
|
65
|
+
"openai": "^6.22.0",
|
|
69
66
|
"pg": "^8.13.2",
|
|
70
67
|
"pino": "^10.2.1",
|
|
71
68
|
"pino-pretty": "^13.1.3",
|
|
69
|
+
"sqlite-vec": "^0.1.7-alpha.2",
|
|
70
|
+
"ws": "^8.18.0",
|
|
72
71
|
"yaml": "^2.6.1",
|
|
73
72
|
"zod": "^3.24.1",
|
|
74
73
|
"zod-to-json-schema": "^3.25.1"
|
|
75
74
|
},
|
|
76
75
|
"devDependencies": {
|
|
76
|
+
"@types/jsdom": "^27.0.0",
|
|
77
77
|
"@types/node": "^22.10.5",
|
|
78
|
+
"@types/node-cron": "^3.0.11",
|
|
79
|
+
"@types/nodemailer": "^7.0.11",
|
|
78
80
|
"@types/pg": "^8.11.10",
|
|
81
|
+
"@types/ws": "^8.18.1",
|
|
79
82
|
"eslint": "^9.17.0",
|
|
80
|
-
"tsx": "^4.19.2",
|
|
81
83
|
"typescript": "^5.7.2"
|
|
82
84
|
},
|
|
83
85
|
"engines": {
|
|
84
|
-
"node": ">=
|
|
86
|
+
"node": ">=24.0.0"
|
|
85
87
|
}
|
|
86
88
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { MemoryGraphStore } from './memory-graph-store.js';
|
|
2
|
-
import type { Community, GraphCommunitiesConfig } from './types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Louvain community detection on the in-memory graph.
|
|
5
|
-
* Groups nodes into communities based on graph structure (edge density).
|
|
6
|
-
*/
|
|
7
|
-
export declare class CommunityDetector {
|
|
8
|
-
private config;
|
|
9
|
-
constructor(config: GraphCommunitiesConfig);
|
|
10
|
-
/**
|
|
11
|
-
* Detect communities in the graph store.
|
|
12
|
-
* Only works with MemoryGraphStore (requires graphology instance).
|
|
13
|
-
*/
|
|
14
|
-
detect(store: MemoryGraphStore): Promise<Community[]>;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=community-detector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"community-detector.d.ts","sourceRoot":"","sources":["../../../../lib/knowledge/graph-rag/community-detector.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAKpE;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAyB;gBAE3B,MAAM,EAAE,sBAAsB;IAI1C;;;OAGG;IACG,MAAM,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;CA4E5D"}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { createLogger } from '../../logger.js';
|
|
2
|
-
const logger = createLogger('CommunityDetector');
|
|
3
|
-
/**
|
|
4
|
-
* Louvain community detection on the in-memory graph.
|
|
5
|
-
* Groups nodes into communities based on graph structure (edge density).
|
|
6
|
-
*/
|
|
7
|
-
export class CommunityDetector {
|
|
8
|
-
config;
|
|
9
|
-
constructor(config) {
|
|
10
|
-
this.config = config;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Detect communities in the graph store.
|
|
14
|
-
* Only works with MemoryGraphStore (requires graphology instance).
|
|
15
|
-
*/
|
|
16
|
-
async detect(store) {
|
|
17
|
-
const graph = await store.getGraphologyInstance();
|
|
18
|
-
if (graph.order === 0) {
|
|
19
|
-
logger.warn('Graph is empty, no communities to detect');
|
|
20
|
-
return [];
|
|
21
|
-
}
|
|
22
|
-
// Dynamic imports to handle ESM/CJS interop
|
|
23
|
-
const graphology = await import('graphology');
|
|
24
|
-
const GraphClass = graphology.default ?? graphology;
|
|
25
|
-
const louvainModule = await import('graphology-communities-louvain');
|
|
26
|
-
const louvain = louvainModule.default ?? louvainModule;
|
|
27
|
-
// graphology-communities-louvain requires an undirected graph for community detection.
|
|
28
|
-
// Create a temporary undirected copy.
|
|
29
|
-
const undirected = new GraphClass({ type: 'undirected' });
|
|
30
|
-
graph.forEachNode((nodeId, attrs) => {
|
|
31
|
-
undirected.addNode(nodeId, attrs);
|
|
32
|
-
});
|
|
33
|
-
graph.forEachEdge((_edgeKey, attrs, source, target) => {
|
|
34
|
-
if (source === target)
|
|
35
|
-
return; // skip self-loops
|
|
36
|
-
if (!undirected.hasEdge(source, target)) {
|
|
37
|
-
undirected.addEdge(source, target, { weight: attrs.weight ?? 1 });
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
// Merge edge weights
|
|
41
|
-
const existing = undirected.getEdgeAttributes(source, target);
|
|
42
|
-
undirected.setEdgeAttribute(source, target, 'weight', existing.weight + (attrs.weight ?? 1));
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
if (undirected.size === 0) {
|
|
46
|
-
logger.warn('No edges in graph, each node becomes its own community');
|
|
47
|
-
const communities = [];
|
|
48
|
-
let i = 0;
|
|
49
|
-
graph.forEachNode((nodeId) => {
|
|
50
|
-
communities.push({ id: `community-${i}`, nodeIds: [nodeId] });
|
|
51
|
-
i++;
|
|
52
|
-
});
|
|
53
|
-
return communities.filter((c) => c.nodeIds.length >= this.config.minSize);
|
|
54
|
-
}
|
|
55
|
-
logger.info(`Running Louvain on ${undirected.order} nodes, ${undirected.size} edges (resolution: ${this.config.resolution})`);
|
|
56
|
-
// Run Louvain algorithm
|
|
57
|
-
const assignments = louvain(undirected, {
|
|
58
|
-
resolution: this.config.resolution,
|
|
59
|
-
});
|
|
60
|
-
// Group nodes by community
|
|
61
|
-
const communityMap = new Map();
|
|
62
|
-
for (const [nodeId, communityId] of Object.entries(assignments)) {
|
|
63
|
-
const existing = communityMap.get(communityId) ?? [];
|
|
64
|
-
existing.push(nodeId);
|
|
65
|
-
communityMap.set(communityId, existing);
|
|
66
|
-
}
|
|
67
|
-
// Filter by minimum size and create Community objects
|
|
68
|
-
const communities = [];
|
|
69
|
-
for (const [id, nodeIds] of communityMap.entries()) {
|
|
70
|
-
if (nodeIds.length >= this.config.minSize) {
|
|
71
|
-
communities.push({
|
|
72
|
-
id: `community-${id}`,
|
|
73
|
-
nodeIds,
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
logger.info(`Detected ${communities.length} communities (min size: ${this.config.minSize})`);
|
|
78
|
-
return communities;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
//# sourceMappingURL=community-detector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"community-detector.js","sourceRoot":"","sources":["../../../../lib/knowledge/graph-rag/community-detector.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,MAAM,GAAG,YAAY,CAAC,mBAAmB,CAAC,CAAC;AAEjD;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IACpB,MAAM,CAAyB;IAEvC,YAAY,MAA8B;QACxC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,MAAM,CAAC,KAAuB;QAClC,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,qBAAqB,EAAE,CAAC;QAElD,IAAI,KAAK,CAAC,KAAK,KAAK,CAAC,EAAE,CAAC;YACtB,MAAM,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAC;YACxD,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,4CAA4C;QAC5C,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC;QAC9C,MAA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CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBAC1C,WAAW,CAAC,IAAI,CAAC;oBACf,EAAE,EAAE,aAAa,EAAE,EAAE;oBACrB,OAAO;iBACR,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,YAAY,WAAW,CAAC,MAAM,2BAA2B,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC;QAC7F,OAAO,WAAW,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
-
import type { Community, GraphStore } from './types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Generates natural language summaries for graph communities using an LLM.
|
|
5
|
-
* Each community summary describes the key entities and relationships within it.
|
|
6
|
-
*/
|
|
7
|
-
export declare class CommunitySummarizer {
|
|
8
|
-
private llm;
|
|
9
|
-
constructor(llm: BaseChatModel);
|
|
10
|
-
/**
|
|
11
|
-
* Generate summaries for all communities.
|
|
12
|
-
*/
|
|
13
|
-
summarize(communities: Community[], store: GraphStore): Promise<Community[]>;
|
|
14
|
-
private summarizeSingle;
|
|
15
|
-
private buildCommunityContext;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=community-summarizer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"community-summarizer.d.ts","sourceRoot":"","sources":["../../../../lib/knowledge/graph-rag/community-summarizer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAEjF,OAAO,KAAK,EAAE,SAAS,EAAwB,UAAU,EAAE,MAAM,YAAY,CAAC;AAK9E;;;GAGG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,GAAG,CAAgB;gBAEf,GAAG,EAAE,aAAa;IAI9B;;OAEG;IACG,SAAS,CAAC,WAAW,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;YAuBpE,eAAe;IAqD7B,OAAO,CAAC,qBAAqB;CAQ9B"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { HumanMessage, SystemMessage } from '@langchain/core/messages';
|
|
2
|
-
import { createLogger } from '../../logger.js';
|
|
3
|
-
const logger = createLogger('CommunitySummarizer');
|
|
4
|
-
/**
|
|
5
|
-
* Generates natural language summaries for graph communities using an LLM.
|
|
6
|
-
* Each community summary describes the key entities and relationships within it.
|
|
7
|
-
*/
|
|
8
|
-
export class CommunitySummarizer {
|
|
9
|
-
llm;
|
|
10
|
-
constructor(llm) {
|
|
11
|
-
this.llm = llm;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Generate summaries for all communities.
|
|
15
|
-
*/
|
|
16
|
-
async summarize(communities, store) {
|
|
17
|
-
const summarized = [];
|
|
18
|
-
for (let i = 0; i < communities.length; i++) {
|
|
19
|
-
const community = communities[i];
|
|
20
|
-
logger.info(`Summarizing community ${i + 1}/${communities.length} (${community.nodeIds.length} nodes)`);
|
|
21
|
-
try {
|
|
22
|
-
const { title, summary } = await this.summarizeSingle(community, store);
|
|
23
|
-
summarized.push({ ...community, title, summary });
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
logger.error(`Failed to summarize community ${community.id}: ${error instanceof Error ? error.message : String(error)}`);
|
|
27
|
-
summarized.push({
|
|
28
|
-
...community,
|
|
29
|
-
title: `Community ${community.id}`,
|
|
30
|
-
summary: `Community with ${community.nodeIds.length} entities.`,
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return summarized;
|
|
35
|
-
}
|
|
36
|
-
async summarizeSingle(community, store) {
|
|
37
|
-
// Gather all nodes and their relationships within the community
|
|
38
|
-
const nodes = [];
|
|
39
|
-
for (const nodeId of community.nodeIds) {
|
|
40
|
-
const node = await store.getNode(nodeId);
|
|
41
|
-
if (node)
|
|
42
|
-
nodes.push(node);
|
|
43
|
-
}
|
|
44
|
-
const allEdges = await store.getAllEdges();
|
|
45
|
-
const communityNodeIds = new Set(community.nodeIds);
|
|
46
|
-
const internalEdges = allEdges.filter((e) => communityNodeIds.has(e.sourceId) && communityNodeIds.has(e.targetId));
|
|
47
|
-
const context = this.buildCommunityContext(nodes, internalEdges);
|
|
48
|
-
const response = await this.llm.invoke([
|
|
49
|
-
new SystemMessage(`You are a knowledge graph analyst. Given a set of entities and relationships from a community in a knowledge graph, provide:
|
|
50
|
-
1. A short title (5-10 words) that captures the main theme
|
|
51
|
-
2. A comprehensive summary (2-4 sentences) that describes the key entities, their relationships, and the overall theme
|
|
52
|
-
|
|
53
|
-
Respond ONLY with valid JSON:
|
|
54
|
-
{
|
|
55
|
-
"title": "Short descriptive title",
|
|
56
|
-
"summary": "Comprehensive summary of the community..."
|
|
57
|
-
}`),
|
|
58
|
-
new HumanMessage(`Analyze this community:\n\n${context}`),
|
|
59
|
-
]);
|
|
60
|
-
const responseText = typeof response.content === 'string'
|
|
61
|
-
? response.content
|
|
62
|
-
: Array.isArray(response.content)
|
|
63
|
-
? response.content.map((c) => (typeof c === 'string' ? c : 'text' in c ? c.text : '')).join('')
|
|
64
|
-
: '';
|
|
65
|
-
try {
|
|
66
|
-
const jsonMatch = responseText.match(/```(?:json)?\s*([\s\S]*?)```/) ?? [null, responseText];
|
|
67
|
-
const parsed = JSON.parse((jsonMatch[1] ?? responseText).trim());
|
|
68
|
-
return {
|
|
69
|
-
title: String(parsed.title ?? `Community ${community.id}`),
|
|
70
|
-
summary: String(parsed.summary ?? ''),
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
catch {
|
|
74
|
-
logger.warn(`Failed to parse community summary, using raw response`);
|
|
75
|
-
return {
|
|
76
|
-
title: `Community ${community.id}`,
|
|
77
|
-
summary: responseText.substring(0, 500),
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
buildCommunityContext(nodes, edges) {
|
|
82
|
-
const entityLines = nodes.map((n) => `- ${n.name} (${n.type}): ${n.description}`).join('\n');
|
|
83
|
-
const relLines = edges.map((e) => `- ${e.sourceId} -[${e.type}]-> ${e.targetId}: ${e.description}`).join('\n');
|
|
84
|
-
return `Entities:\n${entityLines}\n\nRelationships:\n${relLines}`;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
//# sourceMappingURL=community-summarizer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"community-summarizer.js","sourceRoot":"","sources":["../../../../lib/knowledge/graph-rag/community-summarizer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEvE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,MAAM,GAAG,YAAY,CAAC,qBAAqB,CAAC,CAAC;AAEnD;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IACtB,GAAG,CAAgB;IAE3B,YAAY,GAAkB;QAC5B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS,CAAC,WAAwB,EAAE,KAAiB;QACzD,MAAM,UAAU,GAAgB,EAAE,CAAC;QAEnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC5C,MAAM,SAAS,GAAG,WAAW,CAAC,CAAC,CAAE,CAAC;YAClC,MAAM,CAAC,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,IAAI,WAAW,CAAC,MAAM,KAAK,SAAS,CAAC,OAAO,CAAC,MAAM,SAAS,CAAC,CAAC;YAExG,IAAI,CAAC;gBACH,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,KAAK,CA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YACrE,OAAO;gBACL,KAAK,EAAE,aAAa,SAAS,CAAC,EAAE,EAAE;gBAClC,OAAO,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC;aACxC,CAAC;QACJ,CAAC;IACH,CAAC;IAEO,qBAAqB,CAAC,KAAkB,EAAE,KAAkB;QAClE,MAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7F,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CACxB,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,QAAQ,MAAM,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,WAAW,EAAE,CACxE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEb,OAAO,cAAc,WAAW,uBAAuB,QAAQ,EAAE,CAAC;IACpE,CAAC;CACF"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
-
import type { EntityTypeConfig, RelationshipTypeConfig, ExtractionResult } from './types.js';
|
|
3
|
-
interface EntityExtractorOptions {
|
|
4
|
-
llm: BaseChatModel;
|
|
5
|
-
entityTypes?: EntityTypeConfig[];
|
|
6
|
-
relationshipTypes?: RelationshipTypeConfig[];
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* LLM-based entity and relationship extraction from text chunks.
|
|
10
|
-
*/
|
|
11
|
-
export declare class EntityExtractor {
|
|
12
|
-
private llm;
|
|
13
|
-
private entityTypes?;
|
|
14
|
-
private relationshipTypes?;
|
|
15
|
-
constructor(options: EntityExtractorOptions);
|
|
16
|
-
/**
|
|
17
|
-
* Extract entities and relationships from a set of text chunks.
|
|
18
|
-
* Processes chunks sequentially to avoid rate limiting.
|
|
19
|
-
*/
|
|
20
|
-
extractFromChunks(chunks: Array<{
|
|
21
|
-
id: string;
|
|
22
|
-
content: string;
|
|
23
|
-
}>): Promise<ExtractionResult>;
|
|
24
|
-
private extractFromSingleChunk;
|
|
25
|
-
private buildSystemPrompt;
|
|
26
|
-
private buildUserPrompt;
|
|
27
|
-
private parseExtractionResponse;
|
|
28
|
-
/**
|
|
29
|
-
* Deduplicate entities by normalized key (lowercase name + type).
|
|
30
|
-
* Merges descriptions and source chunk IDs.
|
|
31
|
-
* Updates relationship references to use canonical entity names.
|
|
32
|
-
*/
|
|
33
|
-
private deduplicateEntities;
|
|
34
|
-
}
|
|
35
|
-
export {};
|
|
36
|
-
//# sourceMappingURL=entity-extractor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entity-extractor.d.ts","sourceRoot":"","sources":["../../../../lib/knowledge/graph-rag/entity-extractor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAEjF,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAA0C,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAKrI,UAAU,sBAAsB;IAC9B,GAAG,EAAE,aAAa,CAAC;IACnB,WAAW,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACjC,iBAAiB,CAAC,EAAE,sBAAsB,EAAE,CAAC;CAC9C;AAED;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,GAAG,CAAgB;IAC3B,OAAO,CAAC,WAAW,CAAC,CAAqB;IACzC,OAAO,CAAC,iBAAiB,CAAC,CAA2B;gBAEzC,OAAO,EAAE,sBAAsB;IAM3C;;;OAGG;IACG,iBAAiB,CAAC,MAAM,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC;YA0BpF,sBAAsB;IAkBpC,OAAO,CAAC,iBAAiB;IA2CzB,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,uBAAuB;IAgC/B;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;CAmE5B"}
|