beddel 0.2.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +138 -595
- package/dist/client.d.ts +10 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +9 -0
- package/dist/core/parser.d.ts +25 -0
- package/dist/core/parser.d.ts.map +1 -0
- package/dist/core/parser.js +31 -0
- package/dist/core/variable-resolver.d.ts +23 -0
- package/dist/core/variable-resolver.d.ts.map +1 -0
- package/dist/core/variable-resolver.js +98 -0
- package/dist/core/workflow.d.ts +39 -0
- package/dist/core/workflow.d.ts.map +1 -0
- package/dist/core/workflow.js +64 -0
- package/dist/index.d.ts +14 -36
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -130
- package/dist/primitives/index.d.ts +37 -0
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/primitives/index.js +72 -0
- package/dist/primitives/llm.d.ts +56 -0
- package/dist/primitives/llm.d.ts.map +1 -0
- package/dist/primitives/llm.js +156 -0
- package/dist/primitives/output.d.ts +28 -0
- package/dist/primitives/output.d.ts.map +1 -0
- package/dist/primitives/output.js +39 -0
- package/dist/server/handler.d.ts +7 -0
- package/dist/server/handler.d.ts.map +1 -0
- package/dist/server/handler.js +55 -0
- package/dist/server.d.ts +10 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +9 -0
- package/dist/tools/index.d.ts +49 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +96 -0
- package/dist/types/index.d.ts +54 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/docs/architecture/api-reference.md +307 -0
- package/docs/architecture/components.md +246 -0
- package/docs/architecture/core-workflows.md +236 -0
- package/docs/architecture/high-level-architecture.md +76 -0
- package/docs/architecture/index.md +31 -0
- package/docs/architecture/source-tree.md +92 -0
- package/docs/architecture/tech-stack.md +25 -0
- package/docs/prd/epic-list.md +101 -0
- package/docs/prd/goals-context.md +23 -0
- package/docs/prd/index.md +21 -0
- package/docs/prd/requirements.md +25 -0
- package/docs/prd/technical-assumptions.md +35 -0
- package/package.json +31 -118
- package/src/client.ts +18 -0
- package/src/core/parser.ts +36 -0
- package/src/core/variable-resolver.ts +114 -0
- package/src/core/workflow.ts +77 -0
- package/src/index.ts +25 -159
- package/src/primitives/index.ts +83 -0
- package/src/primitives/llm.ts +210 -0
- package/src/primitives/output.ts +65 -0
- package/src/server/handler.ts +80 -0
- package/src/server.ts +10 -0
- package/src/tools/index.ts +118 -0
- package/src/types/index.ts +62 -0
- package/tsconfig.json +27 -0
- package/CHANGELOG.md +0 -78
- package/LICENSE +0 -21
- package/dist/agents/chat/chat.handler.d.ts +0 -12
- package/dist/agents/chat/chat.handler.d.ts.map +0 -1
- package/dist/agents/chat/chat.handler.js +0 -143
- package/dist/agents/chat/chat.handler.js.map +0 -1
- package/dist/agents/chat/chat.schema.d.ts +0 -38
- package/dist/agents/chat/chat.schema.d.ts.map +0 -1
- package/dist/agents/chat/chat.schema.js +0 -31
- package/dist/agents/chat/chat.schema.js.map +0 -1
- package/dist/agents/chat/chat.types.d.ts +0 -42
- package/dist/agents/chat/chat.types.d.ts.map +0 -1
- package/dist/agents/chat/chat.types.js +0 -6
- package/dist/agents/chat/chat.types.js.map +0 -1
- package/dist/agents/chat/chat.yaml +0 -150
- package/dist/agents/chat/index.d.ts +0 -16
- package/dist/agents/chat/index.d.ts.map +0 -1
- package/dist/agents/chat/index.js +0 -21
- package/dist/agents/chat/index.js.map +0 -1
- package/dist/agents/chromadb/chromadb.handler.d.ts +0 -12
- package/dist/agents/chromadb/chromadb.handler.d.ts.map +0 -1
- package/dist/agents/chromadb/chromadb.handler.js +0 -139
- package/dist/agents/chromadb/chromadb.handler.js.map +0 -1
- package/dist/agents/chromadb/chromadb.schema.d.ts +0 -36
- package/dist/agents/chromadb/chromadb.schema.d.ts.map +0 -1
- package/dist/agents/chromadb/chromadb.schema.js +0 -33
- package/dist/agents/chromadb/chromadb.schema.js.map +0 -1
- package/dist/agents/chromadb/chromadb.types.d.ts +0 -49
- package/dist/agents/chromadb/chromadb.types.d.ts.map +0 -1
- package/dist/agents/chromadb/chromadb.types.js +0 -6
- package/dist/agents/chromadb/chromadb.types.js.map +0 -1
- package/dist/agents/chromadb/chromadb.yaml +0 -128
- package/dist/agents/chromadb/index.d.ts +0 -15
- package/dist/agents/chromadb/index.d.ts.map +0 -1
- package/dist/agents/chromadb/index.js +0 -20
- package/dist/agents/chromadb/index.js.map +0 -1
- package/dist/agents/gemini-vectorize/gemini-vectorize.handler.d.ts +0 -8
- package/dist/agents/gemini-vectorize/gemini-vectorize.handler.d.ts.map +0 -1
- package/dist/agents/gemini-vectorize/gemini-vectorize.handler.js +0 -58
- package/dist/agents/gemini-vectorize/gemini-vectorize.handler.js.map +0 -1
- package/dist/agents/gemini-vectorize/gemini-vectorize.schema.d.ts +0 -22
- package/dist/agents/gemini-vectorize/gemini-vectorize.schema.d.ts.map +0 -1
- package/dist/agents/gemini-vectorize/gemini-vectorize.schema.js +0 -20
- package/dist/agents/gemini-vectorize/gemini-vectorize.schema.js.map +0 -1
- package/dist/agents/gemini-vectorize/gemini-vectorize.types.d.ts +0 -32
- package/dist/agents/gemini-vectorize/gemini-vectorize.types.d.ts.map +0 -1
- package/dist/agents/gemini-vectorize/gemini-vectorize.types.js +0 -6
- package/dist/agents/gemini-vectorize/gemini-vectorize.types.js.map +0 -1
- package/dist/agents/gemini-vectorize/gemini-vectorize.yaml +0 -84
- package/dist/agents/gemini-vectorize/index.d.ts +0 -15
- package/dist/agents/gemini-vectorize/index.d.ts.map +0 -1
- package/dist/agents/gemini-vectorize/index.js +0 -20
- package/dist/agents/gemini-vectorize/index.js.map +0 -1
- package/dist/agents/gitmcp/gitmcp.handler.d.ts +0 -12
- package/dist/agents/gitmcp/gitmcp.handler.d.ts.map +0 -1
- package/dist/agents/gitmcp/gitmcp.handler.js +0 -95
- package/dist/agents/gitmcp/gitmcp.handler.js.map +0 -1
- package/dist/agents/gitmcp/gitmcp.schema.d.ts +0 -17
- package/dist/agents/gitmcp/gitmcp.schema.d.ts.map +0 -1
- package/dist/agents/gitmcp/gitmcp.schema.js +0 -18
- package/dist/agents/gitmcp/gitmcp.schema.js.map +0 -1
- package/dist/agents/gitmcp/gitmcp.types.d.ts +0 -31
- package/dist/agents/gitmcp/gitmcp.types.d.ts.map +0 -1
- package/dist/agents/gitmcp/gitmcp.types.js +0 -6
- package/dist/agents/gitmcp/gitmcp.types.js.map +0 -1
- package/dist/agents/gitmcp/gitmcp.yaml +0 -71
- package/dist/agents/gitmcp/index.d.ts +0 -16
- package/dist/agents/gitmcp/index.d.ts.map +0 -1
- package/dist/agents/gitmcp/index.js +0 -21
- package/dist/agents/gitmcp/index.js.map +0 -1
- package/dist/agents/image/image.handler.d.ts +0 -8
- package/dist/agents/image/image.handler.d.ts.map +0 -1
- package/dist/agents/image/image.handler.js +0 -66
- package/dist/agents/image/image.handler.js.map +0 -1
- package/dist/agents/image/image.schema.d.ts +0 -29
- package/dist/agents/image/image.schema.d.ts.map +0 -1
- package/dist/agents/image/image.schema.js +0 -26
- package/dist/agents/image/image.schema.js.map +0 -1
- package/dist/agents/image/image.types.d.ts +0 -42
- package/dist/agents/image/image.types.d.ts.map +0 -1
- package/dist/agents/image/image.types.js +0 -6
- package/dist/agents/image/image.types.js.map +0 -1
- package/dist/agents/image/image.yaml +0 -86
- package/dist/agents/image/index.d.ts +0 -14
- package/dist/agents/image/index.d.ts.map +0 -1
- package/dist/agents/image/index.js +0 -19
- package/dist/agents/image/index.js.map +0 -1
- package/dist/agents/index.d.ts +0 -95
- package/dist/agents/index.d.ts.map +0 -1
- package/dist/agents/index.js +0 -76
- package/dist/agents/index.js.map +0 -1
- package/dist/agents/joker/index.d.ts +0 -14
- package/dist/agents/joker/index.d.ts.map +0 -1
- package/dist/agents/joker/index.js +0 -19
- package/dist/agents/joker/index.js.map +0 -1
- package/dist/agents/joker/joker.handler.d.ts +0 -8
- package/dist/agents/joker/joker.handler.d.ts.map +0 -1
- package/dist/agents/joker/joker.handler.js +0 -48
- package/dist/agents/joker/joker.handler.js.map +0 -1
- package/dist/agents/joker/joker.schema.d.ts +0 -12
- package/dist/agents/joker/joker.schema.d.ts.map +0 -1
- package/dist/agents/joker/joker.schema.js +0 -13
- package/dist/agents/joker/joker.schema.js.map +0 -1
- package/dist/agents/joker/joker.types.d.ts +0 -35
- package/dist/agents/joker/joker.types.d.ts.map +0 -1
- package/dist/agents/joker/joker.types.js +0 -6
- package/dist/agents/joker/joker.types.js.map +0 -1
- package/dist/agents/joker/joker.yaml +0 -47
- package/dist/agents/mcp-tool/index.d.ts +0 -14
- package/dist/agents/mcp-tool/index.d.ts.map +0 -1
- package/dist/agents/mcp-tool/index.js +0 -19
- package/dist/agents/mcp-tool/index.js.map +0 -1
- package/dist/agents/mcp-tool/mcp-tool.handler.d.ts +0 -12
- package/dist/agents/mcp-tool/mcp-tool.handler.d.ts.map +0 -1
- package/dist/agents/mcp-tool/mcp-tool.handler.js +0 -116
- package/dist/agents/mcp-tool/mcp-tool.handler.js.map +0 -1
- package/dist/agents/mcp-tool/mcp-tool.schema.d.ts +0 -19
- package/dist/agents/mcp-tool/mcp-tool.schema.d.ts.map +0 -1
- package/dist/agents/mcp-tool/mcp-tool.schema.js +0 -20
- package/dist/agents/mcp-tool/mcp-tool.schema.js.map +0 -1
- package/dist/agents/mcp-tool/mcp-tool.types.d.ts +0 -31
- package/dist/agents/mcp-tool/mcp-tool.types.d.ts.map +0 -1
- package/dist/agents/mcp-tool/mcp-tool.types.js +0 -6
- package/dist/agents/mcp-tool/mcp-tool.types.js.map +0 -1
- package/dist/agents/mcp-tool/mcp-tool.yaml +0 -71
- package/dist/agents/rag/index.d.ts +0 -15
- package/dist/agents/rag/index.d.ts.map +0 -1
- package/dist/agents/rag/index.js +0 -20
- package/dist/agents/rag/index.js.map +0 -1
- package/dist/agents/rag/rag.handler.d.ts +0 -8
- package/dist/agents/rag/rag.handler.d.ts.map +0 -1
- package/dist/agents/rag/rag.handler.js +0 -101
- package/dist/agents/rag/rag.handler.js.map +0 -1
- package/dist/agents/rag/rag.schema.d.ts +0 -27
- package/dist/agents/rag/rag.schema.d.ts.map +0 -1
- package/dist/agents/rag/rag.schema.js +0 -24
- package/dist/agents/rag/rag.schema.js.map +0 -1
- package/dist/agents/rag/rag.types.d.ts +0 -47
- package/dist/agents/rag/rag.types.d.ts.map +0 -1
- package/dist/agents/rag/rag.types.js +0 -6
- package/dist/agents/rag/rag.types.js.map +0 -1
- package/dist/agents/rag/rag.yaml +0 -89
- package/dist/agents/registry/agentRegistry.d.ts +0 -117
- package/dist/agents/registry/agentRegistry.d.ts.map +0 -1
- package/dist/agents/registry/agentRegistry.js +0 -551
- package/dist/agents/registry/agentRegistry.js.map +0 -1
- package/dist/agents/registry/index.d.ts +0 -6
- package/dist/agents/registry/index.d.ts.map +0 -1
- package/dist/agents/registry/index.js +0 -10
- package/dist/agents/registry/index.js.map +0 -1
- package/dist/agents/translator/index.d.ts +0 -14
- package/dist/agents/translator/index.d.ts.map +0 -1
- package/dist/agents/translator/index.js +0 -19
- package/dist/agents/translator/index.js.map +0 -1
- package/dist/agents/translator/translator.handler.d.ts +0 -8
- package/dist/agents/translator/translator.handler.d.ts.map +0 -1
- package/dist/agents/translator/translator.handler.js +0 -83
- package/dist/agents/translator/translator.handler.js.map +0 -1
- package/dist/agents/translator/translator.schema.d.ts +0 -27
- package/dist/agents/translator/translator.schema.d.ts.map +0 -1
- package/dist/agents/translator/translator.schema.js +0 -28
- package/dist/agents/translator/translator.schema.js.map +0 -1
- package/dist/agents/translator/translator.types.d.ts +0 -40
- package/dist/agents/translator/translator.types.d.ts.map +0 -1
- package/dist/agents/translator/translator.types.js +0 -6
- package/dist/agents/translator/translator.types.js.map +0 -1
- package/dist/agents/translator/translator.yaml +0 -80
- package/dist/audit/auditTrail.d.ts +0 -55
- package/dist/audit/auditTrail.d.ts.map +0 -1
- package/dist/audit/auditTrail.js +0 -93
- package/dist/audit/auditTrail.js.map +0 -1
- package/dist/client/index.d.ts +0 -89
- package/dist/client/index.d.ts.map +0 -1
- package/dist/client/index.js +0 -93
- package/dist/client/index.js.map +0 -1
- package/dist/client/types.d.ts +0 -17
- package/dist/client/types.d.ts.map +0 -1
- package/dist/client/types.js +0 -7
- package/dist/client/types.js.map +0 -1
- package/dist/compliance/gdprEngine.d.ts +0 -44
- package/dist/compliance/gdprEngine.d.ts.map +0 -1
- package/dist/compliance/gdprEngine.js +0 -178
- package/dist/compliance/gdprEngine.js.map +0 -1
- package/dist/compliance/lgpdEngine.d.ts +0 -51
- package/dist/compliance/lgpdEngine.d.ts.map +0 -1
- package/dist/compliance/lgpdEngine.js +0 -221
- package/dist/compliance/lgpdEngine.js.map +0 -1
- package/dist/config.d.ts +0 -78
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -77
- package/dist/config.js.map +0 -1
- package/dist/errors.d.ts +0 -17
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -40
- package/dist/errors.js.map +0 -1
- package/dist/firebase/tenantManager.d.ts +0 -116
- package/dist/firebase/tenantManager.d.ts.map +0 -1
- package/dist/firebase/tenantManager.js +0 -444
- package/dist/firebase/tenantManager.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/integration/secure-yaml-runtime.d.ts +0 -68
- package/dist/integration/secure-yaml-runtime.d.ts.map +0 -1
- package/dist/integration/secure-yaml-runtime.js +0 -245
- package/dist/integration/secure-yaml-runtime.js.map +0 -1
- package/dist/parser/secure-yaml-parser.d.ts +0 -62
- package/dist/parser/secure-yaml-parser.d.ts.map +0 -1
- package/dist/parser/secure-yaml-parser.js +0 -234
- package/dist/parser/secure-yaml-parser.js.map +0 -1
- package/dist/performance/autoscaling.d.ts +0 -100
- package/dist/performance/autoscaling.d.ts.map +0 -1
- package/dist/performance/autoscaling.js +0 -339
- package/dist/performance/autoscaling.js.map +0 -1
- package/dist/performance/benchmark.d.ts +0 -104
- package/dist/performance/benchmark.d.ts.map +0 -1
- package/dist/performance/benchmark.js +0 -514
- package/dist/performance/benchmark.js.map +0 -1
- package/dist/performance/index.d.ts +0 -14
- package/dist/performance/index.d.ts.map +0 -1
- package/dist/performance/index.js +0 -35
- package/dist/performance/index.js.map +0 -1
- package/dist/performance/monitor.d.ts +0 -126
- package/dist/performance/monitor.d.ts.map +0 -1
- package/dist/performance/monitor.js +0 -324
- package/dist/performance/monitor.js.map +0 -1
- package/dist/performance/streaming.d.ts +0 -82
- package/dist/performance/streaming.d.ts.map +0 -1
- package/dist/performance/streaming.js +0 -287
- package/dist/performance/streaming.js.map +0 -1
- package/dist/runtime/audit.d.ts +0 -240
- package/dist/runtime/audit.d.ts.map +0 -1
- package/dist/runtime/audit.js +0 -641
- package/dist/runtime/audit.js.map +0 -1
- package/dist/runtime/declarativeAgentRuntime.d.ts +0 -92
- package/dist/runtime/declarativeAgentRuntime.d.ts.map +0 -1
- package/dist/runtime/declarativeAgentRuntime.js +0 -512
- package/dist/runtime/declarativeAgentRuntime.js.map +0 -1
- package/dist/runtime/index.d.ts +0 -12
- package/dist/runtime/index.d.ts.map +0 -1
- package/dist/runtime/index.js +0 -33
- package/dist/runtime/index.js.map +0 -1
- package/dist/runtime/isolatedRuntime.d.ts +0 -119
- package/dist/runtime/isolatedRuntime.d.ts.map +0 -1
- package/dist/runtime/isolatedRuntime.js +0 -425
- package/dist/runtime/isolatedRuntime.js.map +0 -1
- package/dist/runtime/schemaCompiler.d.ts +0 -35
- package/dist/runtime/schemaCompiler.d.ts.map +0 -1
- package/dist/runtime/schemaCompiler.js +0 -152
- package/dist/runtime/schemaCompiler.js.map +0 -1
- package/dist/runtime/simpleRuntime.d.ts +0 -57
- package/dist/runtime/simpleRuntime.d.ts.map +0 -1
- package/dist/runtime/simpleRuntime.js +0 -187
- package/dist/runtime/simpleRuntime.js.map +0 -1
- package/dist/runtime/workflowExecutor.d.ts +0 -30
- package/dist/runtime/workflowExecutor.d.ts.map +0 -1
- package/dist/runtime/workflowExecutor.js +0 -70
- package/dist/runtime/workflowExecutor.js.map +0 -1
- package/dist/security/dashboard.d.ts +0 -89
- package/dist/security/dashboard.d.ts.map +0 -1
- package/dist/security/dashboard.js +0 -300
- package/dist/security/dashboard.js.map +0 -1
- package/dist/security/hardening.d.ts +0 -130
- package/dist/security/hardening.d.ts.map +0 -1
- package/dist/security/hardening.js +0 -414
- package/dist/security/hardening.js.map +0 -1
- package/dist/security/index.d.ts +0 -128
- package/dist/security/index.d.ts.map +0 -1
- package/dist/security/index.js +0 -353
- package/dist/security/index.js.map +0 -1
- package/dist/security/monitor.d.ts +0 -88
- package/dist/security/monitor.d.ts.map +0 -1
- package/dist/security/monitor.js +0 -356
- package/dist/security/monitor.js.map +0 -1
- package/dist/security/scanner.d.ts +0 -104
- package/dist/security/scanner.d.ts.map +0 -1
- package/dist/security/scanner.js +0 -298
- package/dist/security/scanner.js.map +0 -1
- package/dist/security/score.d.ts +0 -150
- package/dist/security/score.d.ts.map +0 -1
- package/dist/security/score.js +0 -983
- package/dist/security/score.js.map +0 -1
- package/dist/security/threatDetector.d.ts +0 -39
- package/dist/security/threatDetector.d.ts.map +0 -1
- package/dist/security/threatDetector.js +0 -354
- package/dist/security/threatDetector.js.map +0 -1
- package/dist/security/validation.d.ts +0 -69
- package/dist/security/validation.d.ts.map +0 -1
- package/dist/security/validation.js +0 -286
- package/dist/security/validation.js.map +0 -1
- package/dist/server/api/clientsRoute.d.ts +0 -9
- package/dist/server/api/clientsRoute.d.ts.map +0 -1
- package/dist/server/api/clientsRoute.js +0 -71
- package/dist/server/api/clientsRoute.js.map +0 -1
- package/dist/server/api/endpointsRoute.d.ts +0 -8
- package/dist/server/api/endpointsRoute.d.ts.map +0 -1
- package/dist/server/api/endpointsRoute.js +0 -76
- package/dist/server/api/endpointsRoute.js.map +0 -1
- package/dist/server/api/graphql.d.ts +0 -9
- package/dist/server/api/graphql.d.ts.map +0 -1
- package/dist/server/api/graphql.js +0 -222
- package/dist/server/api/graphql.js.map +0 -1
- package/dist/server/errors.d.ts +0 -19
- package/dist/server/errors.d.ts.map +0 -1
- package/dist/server/errors.js +0 -42
- package/dist/server/errors.js.map +0 -1
- package/dist/server/index.d.ts +0 -7
- package/dist/server/index.d.ts.map +0 -1
- package/dist/server/index.js +0 -24
- package/dist/server/index.js.map +0 -1
- package/dist/server/kvStore.d.ts +0 -27
- package/dist/server/kvStore.d.ts.map +0 -1
- package/dist/server/kvStore.js +0 -128
- package/dist/server/kvStore.js.map +0 -1
- package/dist/server/runtimeSecurity.d.ts +0 -28
- package/dist/server/runtimeSecurity.d.ts.map +0 -1
- package/dist/server/runtimeSecurity.js +0 -85
- package/dist/server/runtimeSecurity.js.map +0 -1
- package/dist/server/types.d.ts +0 -53
- package/dist/server/types.d.ts.map +0 -1
- package/dist/server/types.js +0 -8
- package/dist/server/types.js.map +0 -1
- package/dist/shared/index.d.ts +0 -7
- package/dist/shared/index.d.ts.map +0 -1
- package/dist/shared/index.js +0 -23
- package/dist/shared/index.js.map +0 -1
- package/dist/shared/types/agent.types.d.ts +0 -50
- package/dist/shared/types/agent.types.d.ts.map +0 -1
- package/dist/shared/types/agent.types.js +0 -7
- package/dist/shared/types/agent.types.js.map +0 -1
- package/dist/shared/types/execution.types.d.ts +0 -42
- package/dist/shared/types/execution.types.d.ts.map +0 -1
- package/dist/shared/types/execution.types.js +0 -7
- package/dist/shared/types/execution.types.js.map +0 -1
- package/dist/shared/types/index.d.ts +0 -7
- package/dist/shared/types/index.d.ts.map +0 -1
- package/dist/shared/types/index.js +0 -23
- package/dist/shared/types/index.js.map +0 -1
- package/dist/shared/types/schema.types.d.ts +0 -52
- package/dist/shared/types/schema.types.d.ts.map +0 -1
- package/dist/shared/types/schema.types.js +0 -7
- package/dist/shared/types/schema.types.js.map +0 -1
- package/dist/shared/utils/index.d.ts +0 -5
- package/dist/shared/utils/index.d.ts.map +0 -1
- package/dist/shared/utils/index.js +0 -21
- package/dist/shared/utils/index.js.map +0 -1
- package/dist/shared/utils/validation.d.ts +0 -42
- package/dist/shared/utils/validation.d.ts.map +0 -1
- package/dist/shared/utils/validation.js +0 -93
- package/dist/shared/utils/validation.js.map +0 -1
- package/dist/tenant/TenantManager.d.ts +0 -152
- package/dist/tenant/TenantManager.d.ts.map +0 -1
- package/dist/tenant/TenantManager.js +0 -392
- package/dist/tenant/TenantManager.js.map +0 -1
- package/dist/tenant/index.d.ts +0 -47
- package/dist/tenant/index.d.ts.map +0 -1
- package/dist/tenant/index.js +0 -74
- package/dist/tenant/index.js.map +0 -1
- package/dist/tenant/interfaces.d.ts +0 -170
- package/dist/tenant/interfaces.d.ts.map +0 -1
- package/dist/tenant/interfaces.js +0 -67
- package/dist/tenant/interfaces.js.map +0 -1
- package/dist/tenant/providerFactory.d.ts +0 -43
- package/dist/tenant/providerFactory.d.ts.map +0 -1
- package/dist/tenant/providerFactory.js +0 -70
- package/dist/tenant/providerFactory.js.map +0 -1
- package/dist/tenant/providerRegistry.d.ts +0 -47
- package/dist/tenant/providerRegistry.d.ts.map +0 -1
- package/dist/tenant/providerRegistry.js +0 -79
- package/dist/tenant/providerRegistry.js.map +0 -1
- package/dist/tenant/providers/FirebaseTenantProvider.d.ts +0 -41
- package/dist/tenant/providers/FirebaseTenantProvider.d.ts.map +0 -1
- package/dist/tenant/providers/FirebaseTenantProvider.js +0 -290
- package/dist/tenant/providers/FirebaseTenantProvider.js.map +0 -1
- package/dist/tenant/providers/InMemoryTenantProvider.d.ts +0 -18
- package/dist/tenant/providers/InMemoryTenantProvider.d.ts.map +0 -1
- package/dist/tenant/providers/InMemoryTenantProvider.js +0 -137
- package/dist/tenant/providers/InMemoryTenantProvider.js.map +0 -1
- package/dist/types/executionContext.d.ts +0 -16
- package/dist/types/executionContext.d.ts.map +0 -1
- package/dist/types/executionContext.js +0 -3
- package/dist/types/executionContext.js.map +0 -1
- package/src/agents/chat/chat.handler.ts +0 -209
- package/src/agents/chat/chat.schema.ts +0 -33
- package/src/agents/chat/chat.types.ts +0 -46
- package/src/agents/chat/chat.yaml +0 -150
- package/src/agents/chat/index.ts +0 -21
- package/src/agents/chromadb/chromadb.handler.ts +0 -130
- package/src/agents/chromadb/chromadb.schema.ts +0 -35
- package/src/agents/chromadb/chromadb.types.ts +0 -52
- package/src/agents/chromadb/chromadb.yaml +0 -128
- package/src/agents/chromadb/index.ts +0 -20
- package/src/agents/gemini-vectorize/gemini-vectorize.handler.ts +0 -72
- package/src/agents/gemini-vectorize/gemini-vectorize.schema.ts +0 -22
- package/src/agents/gemini-vectorize/gemini-vectorize.types.ts +0 -34
- package/src/agents/gemini-vectorize/gemini-vectorize.yaml +0 -84
- package/src/agents/gemini-vectorize/index.ts +0 -20
- package/src/agents/gitmcp/gitmcp.handler.ts +0 -122
- package/src/agents/gitmcp/gitmcp.schema.ts +0 -20
- package/src/agents/gitmcp/gitmcp.types.ts +0 -33
- package/src/agents/gitmcp/gitmcp.yaml +0 -71
- package/src/agents/gitmcp/index.ts +0 -21
- package/src/agents/image/image.handler.ts +0 -82
- package/src/agents/image/image.schema.ts +0 -28
- package/src/agents/image/image.types.ts +0 -45
- package/src/agents/image/image.yaml +0 -86
- package/src/agents/image/index.ts +0 -19
- package/src/agents/index.ts +0 -59
- package/src/agents/joker/index.ts +0 -19
- package/src/agents/joker/joker.handler.ts +0 -60
- package/src/agents/joker/joker.schema.ts +0 -15
- package/src/agents/joker/joker.types.ts +0 -37
- package/src/agents/joker/joker.yaml +0 -47
- package/src/agents/mcp-tool/index.ts +0 -19
- package/src/agents/mcp-tool/mcp-tool.handler.ts +0 -112
- package/src/agents/mcp-tool/mcp-tool.schema.ts +0 -22
- package/src/agents/mcp-tool/mcp-tool.types.ts +0 -33
- package/src/agents/mcp-tool/mcp-tool.yaml +0 -71
- package/src/agents/rag/index.ts +0 -20
- package/src/agents/rag/rag.handler.ts +0 -119
- package/src/agents/rag/rag.schema.ts +0 -26
- package/src/agents/rag/rag.types.ts +0 -51
- package/src/agents/rag/rag.yaml +0 -89
- package/src/agents/registry/agentRegistry.ts +0 -598
- package/src/agents/registry/index.ts +0 -6
- package/src/agents/translator/index.ts +0 -19
- package/src/agents/translator/translator.handler.ts +0 -99
- package/src/agents/translator/translator.schema.ts +0 -30
- package/src/agents/translator/translator.types.ts +0 -42
- package/src/agents/translator/translator.yaml +0 -80
- package/src/audit/auditTrail.ts +0 -134
- package/src/client/index.ts +0 -53
- package/src/client/types.ts +0 -38
- package/src/compliance/gdprEngine.ts +0 -209
- package/src/compliance/lgpdEngine.ts +0 -268
- package/src/config.ts +0 -179
- package/src/errors.ts +0 -35
- package/src/integration/secure-yaml-runtime.ts +0 -341
- package/src/parser/secure-yaml-parser.ts +0 -273
- package/src/performance/autoscaling.ts +0 -495
- package/src/performance/benchmark.ts +0 -644
- package/src/performance/index.ts +0 -34
- package/src/performance/monitor.ts +0 -469
- package/src/performance/streaming.ts +0 -317
- package/src/runtime/audit.ts +0 -907
- package/src/runtime/declarativeAgentRuntime.ts +0 -772
- package/src/runtime/index.ts +0 -31
- package/src/runtime/isolatedRuntime.ts +0 -572
- package/src/runtime/schemaCompiler.ts +0 -228
- package/src/runtime/simpleRuntime.ts +0 -201
- package/src/runtime/workflowExecutor.ts +0 -94
- package/src/security/dashboard.ts +0 -462
- package/src/security/hardening.ts +0 -560
- package/src/security/index.ts +0 -439
- package/src/security/monitor.ts +0 -490
- package/src/security/scanner.ts +0 -368
- package/src/security/score.ts +0 -1138
- package/src/security/threatDetector.ts +0 -481
- package/src/security/validation.ts +0 -365
- package/src/server/api/clientsRoute.ts +0 -92
- package/src/server/api/endpointsRoute.ts +0 -97
- package/src/server/api/graphql.ts +0 -284
- package/src/server/errors.ts +0 -38
- package/src/server/index.ts +0 -6
- package/src/server/kvStore.ts +0 -152
- package/src/server/runtimeSecurity.ts +0 -102
- package/src/server/types.ts +0 -60
- package/src/shared/index.ts +0 -7
- package/src/shared/types/agent.types.ts +0 -80
- package/src/shared/types/execution.types.ts +0 -45
- package/src/shared/types/index.ts +0 -7
- package/src/shared/types/schema.types.ts +0 -55
- package/src/shared/utils/index.ts +0 -5
- package/src/shared/utils/validation.ts +0 -100
- package/src/tenant/TenantManager.ts +0 -488
- package/src/tenant/index.ts +0 -101
- package/src/tenant/interfaces.ts +0 -231
- package/src/tenant/providerFactory.ts +0 -75
- package/src/tenant/providerRegistry.ts +0 -86
- package/src/tenant/providers/InMemoryTenantProvider.ts +0 -168
- package/src/types/executionContext.ts +0 -16
|
@@ -1,772 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Declarative Agent Runtime - YAML Interpreter for Beddel Declarative Protocol
|
|
3
|
-
* Safely interprets declarative YAML agent definitions without dynamic code execution
|
|
4
|
-
*
|
|
5
|
-
* Phase 3 Refactored: Delegates to individual agent handlers via workflowExecutor
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import 'server-only';
|
|
9
|
-
|
|
10
|
-
import * as yaml from 'js-yaml';
|
|
11
|
-
import { type ZodTypeAny } from 'zod';
|
|
12
|
-
import { ExecutionContext } from '../types/executionContext';
|
|
13
|
-
import { agentRegistry } from '../agents/registry';
|
|
14
|
-
import {
|
|
15
|
-
DeclarativeSchemaCompiler,
|
|
16
|
-
DeclarativeSchemaValidationError,
|
|
17
|
-
type DeclarativeSchemaPhase,
|
|
18
|
-
} from './schemaCompiler';
|
|
19
|
-
|
|
20
|
-
// Import handlers from workflowExecutor
|
|
21
|
-
import {
|
|
22
|
-
executeJokeHandler,
|
|
23
|
-
executeTranslationHandler,
|
|
24
|
-
executeImageHandler,
|
|
25
|
-
executeMcpToolHandler,
|
|
26
|
-
executeVectorizeHandler,
|
|
27
|
-
executeChromaDBHandler,
|
|
28
|
-
executeGitMcpHandler,
|
|
29
|
-
executeRagHandler,
|
|
30
|
-
executeChatHandler,
|
|
31
|
-
} from './workflowExecutor';
|
|
32
|
-
|
|
33
|
-
export interface YamlAgentDefinition {
|
|
34
|
-
agent: {
|
|
35
|
-
id: string;
|
|
36
|
-
version: string;
|
|
37
|
-
protocol: string;
|
|
38
|
-
};
|
|
39
|
-
metadata: {
|
|
40
|
-
name: string;
|
|
41
|
-
description: string;
|
|
42
|
-
category: string;
|
|
43
|
-
route?: string;
|
|
44
|
-
};
|
|
45
|
-
schema: {
|
|
46
|
-
input: any;
|
|
47
|
-
output: any;
|
|
48
|
-
};
|
|
49
|
-
logic: {
|
|
50
|
-
variables?: Array<{
|
|
51
|
-
name: string;
|
|
52
|
-
type: string;
|
|
53
|
-
init: string;
|
|
54
|
-
}>;
|
|
55
|
-
workflow: Array<{
|
|
56
|
-
name: string;
|
|
57
|
-
type: string;
|
|
58
|
-
action: {
|
|
59
|
-
type: string;
|
|
60
|
-
output?: Record<string, any>;
|
|
61
|
-
[key: string]: any;
|
|
62
|
-
};
|
|
63
|
-
}>;
|
|
64
|
-
};
|
|
65
|
-
output?: {
|
|
66
|
-
schema?: any;
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export interface YamlAgentInterpreterOptions {
|
|
71
|
-
yamlContent: string;
|
|
72
|
-
input: Record<string, any>;
|
|
73
|
-
props: Record<string, string>;
|
|
74
|
-
context: ExecutionContext;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export type YamlExecutionResult = Record<string, any>;
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Safe declarative YAML interpreter - no dynamic code execution
|
|
81
|
-
* Delegates execution to individual agent handlers
|
|
82
|
-
*/
|
|
83
|
-
export class DeclarativeAgentInterpreter {
|
|
84
|
-
private readonly MAX_VARIABLE_SIZE = 1024;
|
|
85
|
-
private readonly MAX_WORKFLOW_STEPS = 100;
|
|
86
|
-
private readonly MAX_OUTPUT_SIZE = 5 * 1024 * 1024;
|
|
87
|
-
private readonly schemaCompiler = new DeclarativeSchemaCompiler();
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Interpret declarative YAML agent definition
|
|
91
|
-
*/
|
|
92
|
-
public async interpret(
|
|
93
|
-
options: YamlAgentInterpreterOptions
|
|
94
|
-
): Promise<YamlExecutionResult> {
|
|
95
|
-
const startTime = Date.now();
|
|
96
|
-
|
|
97
|
-
try {
|
|
98
|
-
const agent = this.parseYaml(options.yamlContent);
|
|
99
|
-
this.validateAgentDefinition(agent);
|
|
100
|
-
|
|
101
|
-
const schemas = this.buildSchemaSet(agent);
|
|
102
|
-
const validatedInput = this.validateAgainstSchema(
|
|
103
|
-
options.input,
|
|
104
|
-
schemas.input,
|
|
105
|
-
'input',
|
|
106
|
-
options.context
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
const executionOptions: YamlAgentInterpreterOptions = {
|
|
110
|
-
...options,
|
|
111
|
-
input: validatedInput,
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
const result = await this.executeWorkflow(agent, executionOptions);
|
|
115
|
-
|
|
116
|
-
const validatedOutput = this.validateAgainstSchema(
|
|
117
|
-
result,
|
|
118
|
-
schemas.output,
|
|
119
|
-
'output',
|
|
120
|
-
options.context
|
|
121
|
-
);
|
|
122
|
-
this.enforceOutputSize(validatedOutput);
|
|
123
|
-
|
|
124
|
-
const executionTime = Date.now() - startTime;
|
|
125
|
-
options.context.log(`Declarative agent executed in ${executionTime}ms`);
|
|
126
|
-
|
|
127
|
-
return validatedOutput;
|
|
128
|
-
} catch (error) {
|
|
129
|
-
options.context.log(`Declarative agent execution failed: ${error}`);
|
|
130
|
-
options.context.setError(
|
|
131
|
-
error instanceof Error ? error.message : 'Unknown declarative agent error'
|
|
132
|
-
);
|
|
133
|
-
throw error;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
private parseYaml(yamlContent: string): YamlAgentDefinition {
|
|
138
|
-
try {
|
|
139
|
-
const parsed = yaml.load(yamlContent) as YamlAgentDefinition;
|
|
140
|
-
|
|
141
|
-
if (!parsed || typeof parsed !== 'object') {
|
|
142
|
-
throw new Error('Invalid YAML: expected object');
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (!parsed.agent || !parsed.logic || !parsed.schema) {
|
|
146
|
-
throw new Error('Invalid agent definition: missing required sections');
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
return parsed;
|
|
150
|
-
} catch (error) {
|
|
151
|
-
throw new Error(`YAML parsing failed: ${error}`);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
private validateAgentDefinition(agent: YamlAgentDefinition): void {
|
|
156
|
-
if (agent.agent.protocol !== 'beddel-declarative-protocol/v2.0') {
|
|
157
|
-
throw new Error(`Unsupported protocol: ${agent.agent.protocol}`);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
if (!agent.schema.input || !agent.schema.output) {
|
|
161
|
-
throw new Error('Invalid schema: missing input or output definition');
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
if (!Array.isArray(agent.logic.workflow) || agent.logic.workflow.length === 0) {
|
|
165
|
-
throw new Error('Invalid workflow: must be non-empty array');
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
if (agent.logic.workflow.length > this.MAX_WORKFLOW_STEPS) {
|
|
169
|
-
throw new Error(`Workflow too complex: max ${this.MAX_WORKFLOW_STEPS} steps allowed`);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
private buildSchemaSet(agent: YamlAgentDefinition): {
|
|
174
|
-
input: ZodTypeAny;
|
|
175
|
-
output: ZodTypeAny;
|
|
176
|
-
} {
|
|
177
|
-
return {
|
|
178
|
-
input: this.schemaCompiler.compile(agent.schema.input, 'schema.input'),
|
|
179
|
-
output: this.schemaCompiler.compile(agent.schema.output, 'schema.output'),
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
private validateAgainstSchema(
|
|
184
|
-
data: unknown,
|
|
185
|
-
schema: ZodTypeAny,
|
|
186
|
-
phase: DeclarativeSchemaPhase,
|
|
187
|
-
context: ExecutionContext
|
|
188
|
-
): any {
|
|
189
|
-
const validationResult = schema.safeParse(data);
|
|
190
|
-
if (!validationResult.success) {
|
|
191
|
-
const issues = validationResult.error.issues;
|
|
192
|
-
const issueSummary = issues
|
|
193
|
-
.map((issue) => `${issue.path.join('.') || 'root'}: ${issue.message}`)
|
|
194
|
-
.join('; ');
|
|
195
|
-
const label = phase === 'input' ? 'Input' : 'Output';
|
|
196
|
-
const message = `${label} validation failed: ${issueSummary}`;
|
|
197
|
-
context.setError(message);
|
|
198
|
-
throw new DeclarativeSchemaValidationError(message, phase, issues);
|
|
199
|
-
}
|
|
200
|
-
return validationResult.data;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
private enforceOutputSize(output: any): void {
|
|
204
|
-
const outputSize = JSON.stringify(output).length;
|
|
205
|
-
if (outputSize > this.MAX_OUTPUT_SIZE) {
|
|
206
|
-
throw new Error(`Output size exceeds maximum allowed: ${outputSize} > ${this.MAX_OUTPUT_SIZE}`);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
private async executeWorkflow(
|
|
211
|
-
agent: YamlAgentDefinition,
|
|
212
|
-
options: YamlAgentInterpreterOptions
|
|
213
|
-
): Promise<YamlExecutionResult> {
|
|
214
|
-
const variables = new Map<string, any>();
|
|
215
|
-
let output: any = undefined;
|
|
216
|
-
|
|
217
|
-
if (agent.logic.variables) {
|
|
218
|
-
for (const variable of agent.logic.variables) {
|
|
219
|
-
this.validateVariable(variable);
|
|
220
|
-
const value = this.evaluateValue(variable.init, variables);
|
|
221
|
-
variables.set(variable.name, value);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
for (const step of agent.logic.workflow) {
|
|
226
|
-
output = await this.executeWorkflowStep(step, variables, options);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
return output;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
private async executeWorkflowStep(
|
|
233
|
-
step: any,
|
|
234
|
-
variables: Map<string, any>,
|
|
235
|
-
options: YamlAgentInterpreterOptions
|
|
236
|
-
): Promise<any> {
|
|
237
|
-
options.context.log(`Executing workflow step: ${step.name} (${step.type})`);
|
|
238
|
-
|
|
239
|
-
switch (step.type) {
|
|
240
|
-
case 'output-generator':
|
|
241
|
-
return this.executeOutputGenerator(step, variables, options);
|
|
242
|
-
case 'genkit-joke':
|
|
243
|
-
return this.executeGenkitJoke(step, variables, options);
|
|
244
|
-
case 'genkit-translation':
|
|
245
|
-
return this.executeGenkitTranslation(step, variables, options);
|
|
246
|
-
case 'genkit-image':
|
|
247
|
-
return this.executeGenkitImage(step, variables, options);
|
|
248
|
-
case 'custom-action':
|
|
249
|
-
return this.executeCustomAction(step, variables, options);
|
|
250
|
-
case 'mcp-tool':
|
|
251
|
-
return this.executeMcpTool(step, variables, options);
|
|
252
|
-
case 'gemini-vectorize':
|
|
253
|
-
return this.executeGeminiVectorize(step, variables, options);
|
|
254
|
-
case 'chromadb':
|
|
255
|
-
return this.executeChromaDB(step, variables, options);
|
|
256
|
-
case 'gitmcp':
|
|
257
|
-
return this.executeGitMcp(step, variables, options);
|
|
258
|
-
case 'rag':
|
|
259
|
-
return this.executeRag(step, variables, options);
|
|
260
|
-
case 'chat':
|
|
261
|
-
return this.executeChat(step, variables, options);
|
|
262
|
-
case 'builtin-agent':
|
|
263
|
-
return this.executeBuiltinAgent(step, variables, options);
|
|
264
|
-
default:
|
|
265
|
-
throw new Error(`Unsupported workflow step type: ${step.type}`);
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
// ============================================================================
|
|
270
|
-
// Output Generator (kept inline - orchestration logic)
|
|
271
|
-
// ============================================================================
|
|
272
|
-
|
|
273
|
-
private executeOutputGenerator(
|
|
274
|
-
step: any,
|
|
275
|
-
variables: Map<string, any>,
|
|
276
|
-
options: YamlAgentInterpreterOptions
|
|
277
|
-
): any {
|
|
278
|
-
if (step.action?.type !== 'generate' || !step.action.output) {
|
|
279
|
-
throw new Error('Invalid output generator configuration');
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
const output: any = {};
|
|
283
|
-
|
|
284
|
-
options.context.log(
|
|
285
|
-
`Output generator: Available variables: ${Array.from(variables.keys()).join(', ')}`
|
|
286
|
-
);
|
|
287
|
-
|
|
288
|
-
for (const [key, valueExpr] of Object.entries(step.action.output)) {
|
|
289
|
-
if (typeof valueExpr === 'string' && valueExpr.startsWith('$')) {
|
|
290
|
-
try {
|
|
291
|
-
const reference = valueExpr.substring(1);
|
|
292
|
-
const resolved = this.resolveReference(reference, variables);
|
|
293
|
-
output[key] = resolved;
|
|
294
|
-
} catch (error) {
|
|
295
|
-
options.context.log(
|
|
296
|
-
`Output generator: Failed to resolve ${valueExpr}: ${error instanceof Error ? error.message : String(error)}`
|
|
297
|
-
);
|
|
298
|
-
throw error;
|
|
299
|
-
}
|
|
300
|
-
} else {
|
|
301
|
-
output[key] = valueExpr;
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
return output;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
// ============================================================================
|
|
309
|
-
// Delegated Handlers - Using extracted agent handlers
|
|
310
|
-
// ============================================================================
|
|
311
|
-
|
|
312
|
-
private async executeGenkitJoke(
|
|
313
|
-
step: any,
|
|
314
|
-
variables: Map<string, any>,
|
|
315
|
-
options: YamlAgentInterpreterOptions
|
|
316
|
-
): Promise<any> {
|
|
317
|
-
const prompt =
|
|
318
|
-
typeof step.action?.prompt === 'string' && step.action.prompt.trim().length
|
|
319
|
-
? step.action.prompt.trim()
|
|
320
|
-
: 'Tell a short and original joke that works for any audience.';
|
|
321
|
-
const temperature =
|
|
322
|
-
typeof step.action?.temperature === 'number' ? step.action.temperature : 0.8;
|
|
323
|
-
const maxTokens =
|
|
324
|
-
typeof step.action?.maxTokens === 'number' ? step.action.maxTokens : undefined;
|
|
325
|
-
const resultVar =
|
|
326
|
-
typeof step.action?.result === 'string' && step.action.result.length > 0
|
|
327
|
-
? step.action.result
|
|
328
|
-
: 'jokerResult';
|
|
329
|
-
|
|
330
|
-
const result = await executeJokeHandler(
|
|
331
|
-
{ prompt, temperature, maxTokens },
|
|
332
|
-
options.props,
|
|
333
|
-
options.context
|
|
334
|
-
);
|
|
335
|
-
|
|
336
|
-
variables.set(resultVar, result);
|
|
337
|
-
return result;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
private async executeGenkitTranslation(
|
|
341
|
-
step: any,
|
|
342
|
-
variables: Map<string, any>,
|
|
343
|
-
options: YamlAgentInterpreterOptions
|
|
344
|
-
): Promise<any> {
|
|
345
|
-
const text = options.input?.texto || options.input?.text;
|
|
346
|
-
const sourceLanguage = options.input?.idioma_origem || options.input?.source_language;
|
|
347
|
-
const targetLanguage = options.input?.idioma_destino || options.input?.target_language;
|
|
348
|
-
|
|
349
|
-
const resultVar =
|
|
350
|
-
typeof step.action?.result === 'string' && step.action.result.length > 0
|
|
351
|
-
? step.action.result
|
|
352
|
-
: 'translationResult';
|
|
353
|
-
|
|
354
|
-
const result = await executeTranslationHandler(
|
|
355
|
-
{
|
|
356
|
-
text,
|
|
357
|
-
source_language: sourceLanguage,
|
|
358
|
-
target_language: targetLanguage,
|
|
359
|
-
promptTemplate:
|
|
360
|
-
typeof step.action?.promptTemplate === 'string'
|
|
361
|
-
? step.action.promptTemplate
|
|
362
|
-
: undefined,
|
|
363
|
-
},
|
|
364
|
-
options.props,
|
|
365
|
-
options.context
|
|
366
|
-
);
|
|
367
|
-
|
|
368
|
-
variables.set(resultVar, result);
|
|
369
|
-
return result;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
private async executeGenkitImage(
|
|
373
|
-
step: any,
|
|
374
|
-
variables: Map<string, any>,
|
|
375
|
-
options: YamlAgentInterpreterOptions
|
|
376
|
-
): Promise<any> {
|
|
377
|
-
const description =
|
|
378
|
-
typeof options.input?.descricao === 'string'
|
|
379
|
-
? options.input.descricao.trim()
|
|
380
|
-
: typeof options.input?.description === 'string'
|
|
381
|
-
? options.input.description.trim()
|
|
382
|
-
: '';
|
|
383
|
-
const style =
|
|
384
|
-
typeof options.input?.estilo === 'string'
|
|
385
|
-
? options.input.estilo.trim()
|
|
386
|
-
: typeof options.input?.style === 'string'
|
|
387
|
-
? options.input.style.trim()
|
|
388
|
-
: '';
|
|
389
|
-
const resolution =
|
|
390
|
-
typeof options.input?.resolucao === 'string'
|
|
391
|
-
? options.input.resolucao.trim()
|
|
392
|
-
: typeof options.input?.resolution === 'string'
|
|
393
|
-
? options.input.resolution.trim()
|
|
394
|
-
: '';
|
|
395
|
-
|
|
396
|
-
if (!description) {
|
|
397
|
-
throw new Error('Missing required image input: description');
|
|
398
|
-
}
|
|
399
|
-
if (!style) {
|
|
400
|
-
throw new Error('Missing required image input: style');
|
|
401
|
-
}
|
|
402
|
-
if (!resolution) {
|
|
403
|
-
throw new Error('Missing required image input: resolution');
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
const promptTemplate =
|
|
407
|
-
typeof step.action?.promptTemplate === 'string' &&
|
|
408
|
-
step.action.promptTemplate.trim().length > 0
|
|
409
|
-
? step.action.promptTemplate
|
|
410
|
-
: 'Create a detailed image in {{style}} style focusing on: {{description}}';
|
|
411
|
-
|
|
412
|
-
const resultVar =
|
|
413
|
-
typeof step.action?.result === 'string' && step.action.result.length > 0
|
|
414
|
-
? step.action.result
|
|
415
|
-
: 'imageResult';
|
|
416
|
-
|
|
417
|
-
const result = await executeImageHandler(
|
|
418
|
-
{
|
|
419
|
-
description,
|
|
420
|
-
style,
|
|
421
|
-
resolution,
|
|
422
|
-
promptTemplate,
|
|
423
|
-
},
|
|
424
|
-
options.props,
|
|
425
|
-
options.context
|
|
426
|
-
);
|
|
427
|
-
|
|
428
|
-
variables.set(resultVar, result);
|
|
429
|
-
return result;
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
private async executeMcpTool(
|
|
433
|
-
step: any,
|
|
434
|
-
variables: Map<string, any>,
|
|
435
|
-
options: YamlAgentInterpreterOptions
|
|
436
|
-
): Promise<any> {
|
|
437
|
-
const serverUrl = this.resolveInputValue(step.action?.server_url, options.input, variables);
|
|
438
|
-
const toolName = this.resolveInputValue(step.action?.tool_name, options.input, variables);
|
|
439
|
-
const toolArguments =
|
|
440
|
-
this.resolveInputValue(step.action?.tool_arguments, options.input, variables) || {};
|
|
441
|
-
const resultVar = step.action?.result || 'mcpResult';
|
|
442
|
-
|
|
443
|
-
const result = await executeMcpToolHandler(
|
|
444
|
-
{
|
|
445
|
-
server_url: serverUrl,
|
|
446
|
-
tool_name: toolName,
|
|
447
|
-
tool_arguments: toolArguments,
|
|
448
|
-
},
|
|
449
|
-
options.props,
|
|
450
|
-
options.context
|
|
451
|
-
);
|
|
452
|
-
|
|
453
|
-
variables.set(resultVar, result);
|
|
454
|
-
return result;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
private async executeGeminiVectorize(
|
|
458
|
-
step: any,
|
|
459
|
-
variables: Map<string, any>,
|
|
460
|
-
options: YamlAgentInterpreterOptions
|
|
461
|
-
): Promise<any> {
|
|
462
|
-
const action = step.action?.action || 'embedSingle';
|
|
463
|
-
const resultVar = step.action?.result || 'vectorizeResult';
|
|
464
|
-
|
|
465
|
-
let result;
|
|
466
|
-
if (action === 'embedSingle') {
|
|
467
|
-
const text = this.resolveInputValue(step.action?.text, options.input, variables);
|
|
468
|
-
result = await executeVectorizeHandler(
|
|
469
|
-
{ action: 'embedSingle', text },
|
|
470
|
-
options.props,
|
|
471
|
-
options.context
|
|
472
|
-
);
|
|
473
|
-
} else if (action === 'embedBatch') {
|
|
474
|
-
const texts = this.resolveInputValue(step.action?.texts, options.input, variables);
|
|
475
|
-
result = await executeVectorizeHandler(
|
|
476
|
-
{ action: 'embedBatch', texts },
|
|
477
|
-
options.props,
|
|
478
|
-
options.context
|
|
479
|
-
);
|
|
480
|
-
} else {
|
|
481
|
-
throw new Error(`Unknown vectorize action: ${action}`);
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
variables.set(resultVar, result);
|
|
485
|
-
return result;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
private async executeChromaDB(
|
|
489
|
-
step: any,
|
|
490
|
-
variables: Map<string, any>,
|
|
491
|
-
options: YamlAgentInterpreterOptions
|
|
492
|
-
): Promise<any> {
|
|
493
|
-
const action = this.resolveInputValue(step.action?.action, options.input, variables);
|
|
494
|
-
const collectionName = this.resolveInputValue(
|
|
495
|
-
step.action?.collection_name,
|
|
496
|
-
options.input,
|
|
497
|
-
variables
|
|
498
|
-
);
|
|
499
|
-
const resultVar = step.action?.result || 'chromaResult';
|
|
500
|
-
|
|
501
|
-
let params: any = { action, collection_name: collectionName };
|
|
502
|
-
|
|
503
|
-
if (action === 'hasData') {
|
|
504
|
-
params.min_count =
|
|
505
|
-
this.resolveInputValue(step.action?.min_count, options.input, variables) || 1;
|
|
506
|
-
} else if (action === 'store') {
|
|
507
|
-
params.ids = this.resolveInputValue(step.action?.ids, options.input, variables);
|
|
508
|
-
params.vectors = this.resolveInputValue(step.action?.vectors, options.input, variables);
|
|
509
|
-
params.documents = this.resolveInputValue(step.action?.documents, options.input, variables);
|
|
510
|
-
params.metadatas = this.resolveInputValue(step.action?.metadatas, options.input, variables);
|
|
511
|
-
} else if (action === 'search') {
|
|
512
|
-
params.query_vector = this.resolveInputValue(
|
|
513
|
-
step.action?.query_vector,
|
|
514
|
-
options.input,
|
|
515
|
-
variables
|
|
516
|
-
);
|
|
517
|
-
params.limit =
|
|
518
|
-
this.resolveInputValue(step.action?.limit, options.input, variables) || 5;
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
const result = await executeChromaDBHandler(params, options.props, options.context);
|
|
522
|
-
|
|
523
|
-
variables.set(resultVar, result);
|
|
524
|
-
return result;
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
private async executeGitMcp(
|
|
528
|
-
step: any,
|
|
529
|
-
variables: Map<string, any>,
|
|
530
|
-
options: YamlAgentInterpreterOptions
|
|
531
|
-
): Promise<any> {
|
|
532
|
-
const gitmcpUrl = this.resolveInputValue(step.action?.gitmcp_url, options.input, variables);
|
|
533
|
-
const resultVar = step.action?.result || 'gitmcpResult';
|
|
534
|
-
|
|
535
|
-
const result = await executeGitMcpHandler(
|
|
536
|
-
{ gitmcp_url: gitmcpUrl },
|
|
537
|
-
options.props,
|
|
538
|
-
options.context
|
|
539
|
-
);
|
|
540
|
-
|
|
541
|
-
variables.set(resultVar, result);
|
|
542
|
-
return result;
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
private async executeRag(
|
|
546
|
-
step: any,
|
|
547
|
-
variables: Map<string, any>,
|
|
548
|
-
options: YamlAgentInterpreterOptions
|
|
549
|
-
): Promise<any> {
|
|
550
|
-
const query = this.resolveInputValue(step.action?.query, options.input, variables);
|
|
551
|
-
const context =
|
|
552
|
-
this.resolveInputValue(step.action?.context, options.input, variables) ||
|
|
553
|
-
this.resolveInputValue(step.action?.documents, options.input, variables);
|
|
554
|
-
const history = this.resolveInputValue(step.action?.history, options.input, variables);
|
|
555
|
-
const resultVar = step.action?.result || 'ragResult';
|
|
556
|
-
|
|
557
|
-
const result = await executeRagHandler(
|
|
558
|
-
{ query, context, documents: context, history },
|
|
559
|
-
options.props,
|
|
560
|
-
options.context
|
|
561
|
-
);
|
|
562
|
-
|
|
563
|
-
variables.set(resultVar, result);
|
|
564
|
-
return result;
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
private async executeChat(
|
|
568
|
-
step: any,
|
|
569
|
-
variables: Map<string, any>,
|
|
570
|
-
options: YamlAgentInterpreterOptions
|
|
571
|
-
): Promise<any> {
|
|
572
|
-
const messages = this.resolveInputValue(step.action?.messages, options.input, variables);
|
|
573
|
-
const query = this.resolveInputValue(step.action?.query, options.input, variables);
|
|
574
|
-
const resultVar = step.action?.result || 'chatResult';
|
|
575
|
-
|
|
576
|
-
const result = await executeChatHandler(
|
|
577
|
-
{ messages, query },
|
|
578
|
-
options.props,
|
|
579
|
-
options.context
|
|
580
|
-
);
|
|
581
|
-
|
|
582
|
-
variables.set(resultVar, result);
|
|
583
|
-
return result;
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
// ============================================================================
|
|
587
|
-
// Custom Action & Builtin Agent (orchestration logic)
|
|
588
|
-
// ============================================================================
|
|
589
|
-
|
|
590
|
-
private async executeCustomAction(
|
|
591
|
-
step: any,
|
|
592
|
-
variables: Map<string, any>,
|
|
593
|
-
options: YamlAgentInterpreterOptions
|
|
594
|
-
): Promise<any> {
|
|
595
|
-
const functionName = step.action?.function;
|
|
596
|
-
if (!functionName) {
|
|
597
|
-
throw new Error("Missing 'function' in custom-action");
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
options.context.log(`Custom action: Looking up function '${functionName}'`);
|
|
601
|
-
|
|
602
|
-
const customFunc = agentRegistry.getCustomFunction(functionName);
|
|
603
|
-
if (!customFunc) {
|
|
604
|
-
throw new Error(
|
|
605
|
-
`Custom function '${functionName}' not found in registry. ` +
|
|
606
|
-
`Make sure the corresponding .ts file is in the /agents directory.`
|
|
607
|
-
);
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
const args = {
|
|
611
|
-
input: options.input,
|
|
612
|
-
variables: Object.fromEntries(variables),
|
|
613
|
-
action: step.action,
|
|
614
|
-
context: options.context,
|
|
615
|
-
};
|
|
616
|
-
|
|
617
|
-
options.context.log(`Custom action: Executing function '${functionName}'`);
|
|
618
|
-
|
|
619
|
-
try {
|
|
620
|
-
const result = await customFunc(args);
|
|
621
|
-
|
|
622
|
-
if (step.action.result) {
|
|
623
|
-
variables.set(step.action.result, result);
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
return result;
|
|
627
|
-
} catch (e) {
|
|
628
|
-
const errorMessage = e instanceof Error ? e.message : String(e);
|
|
629
|
-
options.context.log(`Custom action execution failed: ${errorMessage}`);
|
|
630
|
-
options.context.setError(errorMessage);
|
|
631
|
-
throw new Error(`Custom action execution failed: ${errorMessage}`);
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
private async executeBuiltinAgent(
|
|
636
|
-
step: any,
|
|
637
|
-
variables: Map<string, any>,
|
|
638
|
-
options: YamlAgentInterpreterOptions
|
|
639
|
-
): Promise<any> {
|
|
640
|
-
const agentName = step.action?.agent;
|
|
641
|
-
const agentInput =
|
|
642
|
-
this.resolveInputValue(step.action?.input, options.input, variables) || options.input;
|
|
643
|
-
const agentProps = step.action?.props || options.props;
|
|
644
|
-
const resultVar = step.action?.result || 'builtinResult';
|
|
645
|
-
|
|
646
|
-
if (!agentName) {
|
|
647
|
-
throw new Error('Missing required builtin-agent input: agent');
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
options.context.log(`[Builtin Agent] Invoking agent: ${agentName}`);
|
|
651
|
-
|
|
652
|
-
try {
|
|
653
|
-
const result = await agentRegistry.executeAgent(
|
|
654
|
-
agentName,
|
|
655
|
-
agentInput,
|
|
656
|
-
agentProps,
|
|
657
|
-
options.context
|
|
658
|
-
);
|
|
659
|
-
|
|
660
|
-
variables.set(resultVar, result);
|
|
661
|
-
return result;
|
|
662
|
-
} catch (error: unknown) {
|
|
663
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
664
|
-
options.context.log(`[Builtin Agent] Error: ${message}`);
|
|
665
|
-
throw new Error(`Builtin agent '${agentName}' execution failed: ${message}`);
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
// ============================================================================
|
|
670
|
-
// Helper Methods
|
|
671
|
-
// ============================================================================
|
|
672
|
-
|
|
673
|
-
private resolveInputValue(
|
|
674
|
-
value: any,
|
|
675
|
-
input: Record<string, any>,
|
|
676
|
-
variables: Map<string, any>
|
|
677
|
-
): any {
|
|
678
|
-
if (value === undefined || value === null) return undefined;
|
|
679
|
-
|
|
680
|
-
if (typeof value === 'string' && value.startsWith('$')) {
|
|
681
|
-
const ref = value.substring(1);
|
|
682
|
-
if (ref.startsWith('input.')) {
|
|
683
|
-
const inputKey = ref.substring(6);
|
|
684
|
-
return this.getNestedValue(input, inputKey);
|
|
685
|
-
}
|
|
686
|
-
return this.resolveReference(ref, variables);
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
if (typeof value === 'string' && input[value] !== undefined) {
|
|
690
|
-
return input[value];
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
return value;
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
private getNestedValue(obj: any, path: string): any {
|
|
697
|
-
const parts = path.split('.');
|
|
698
|
-
let current = obj;
|
|
699
|
-
for (const part of parts) {
|
|
700
|
-
if (current == null) return undefined;
|
|
701
|
-
current = current[part];
|
|
702
|
-
}
|
|
703
|
-
return current;
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
private evaluateValue(expr: string, variables: Map<string, any>): any {
|
|
707
|
-
if (expr.startsWith('"') && expr.endsWith('"')) {
|
|
708
|
-
if (expr.length - 2 > this.MAX_VARIABLE_SIZE) {
|
|
709
|
-
throw new Error('Variable initialization exceeds maximum size');
|
|
710
|
-
}
|
|
711
|
-
return expr.slice(1, -1);
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
if (expr.startsWith("'") && expr.endsWith("'")) {
|
|
715
|
-
if (expr.length - 2 > this.MAX_VARIABLE_SIZE) {
|
|
716
|
-
throw new Error('Variable initialization exceeds maximum size');
|
|
717
|
-
}
|
|
718
|
-
return expr.slice(1, -1);
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
if (expr.length > this.MAX_VARIABLE_SIZE) {
|
|
722
|
-
throw new Error('Variable initialization exceeds maximum size');
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
if (expr === 'true') return true;
|
|
726
|
-
if (expr === 'false') return false;
|
|
727
|
-
if (expr === 'null') return null;
|
|
728
|
-
|
|
729
|
-
if (expr.startsWith('$')) {
|
|
730
|
-
return this.resolveReference(expr.substring(1), variables);
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
if (/^-?\d+$/.test(expr)) return parseInt(expr, 10);
|
|
734
|
-
if (/^-?\d+\.\d+$/.test(expr)) return parseFloat(expr);
|
|
735
|
-
|
|
736
|
-
throw new Error(`Unsupported value expression: ${expr}`);
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
private validateVariable(variable: any): void {
|
|
740
|
-
if (!variable.name || !variable.type) {
|
|
741
|
-
throw new Error('Invalid variable declaration: missing name or type');
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
if (!['string', 'number', 'boolean', 'object'].includes(variable.type)) {
|
|
745
|
-
throw new Error(`Unsupported variable type: ${variable.type}`);
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
private resolveReference(reference: string, variables: Map<string, any>): any {
|
|
750
|
-
const [varName, ...pathSegments] = reference.split('.');
|
|
751
|
-
let value = variables.get(varName);
|
|
752
|
-
if (value === undefined) {
|
|
753
|
-
throw new Error(`Undefined variable referenced: ${varName}`);
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
for (const segment of pathSegments) {
|
|
757
|
-
if (value == null || typeof value !== 'object') {
|
|
758
|
-
throw new Error(
|
|
759
|
-
`Cannot resolve path '${reference}': segment '${segment}' is invalid`
|
|
760
|
-
);
|
|
761
|
-
}
|
|
762
|
-
value = value[segment];
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
return value;
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
// Singleton instance
|
|
770
|
-
export const declarativeInterpreter = new DeclarativeAgentInterpreter();
|
|
771
|
-
|
|
772
|
-
export default DeclarativeAgentInterpreter;
|