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
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Beddel Protocol - LLM Primitive
|
|
3
|
+
*
|
|
4
|
+
* Core primitive for AI text generation with dual-mode support:
|
|
5
|
+
* - Stream Mode: Uses streamText → returns Response via toUIMessageStreamResponse()
|
|
6
|
+
* - Block Mode: Uses generateText → returns JSON object { text, usage }
|
|
7
|
+
*
|
|
8
|
+
* Supports tools via mapTools() which bridges YAML definitions to Vercel AI SDK tools.
|
|
9
|
+
* Requires GEMINI_API_KEY environment variable.
|
|
10
|
+
*
|
|
11
|
+
* Server-only: Uses Vercel AI SDK Core which requires Node.js.
|
|
12
|
+
*
|
|
13
|
+
* AI SDK v6 Compatibility:
|
|
14
|
+
* - Frontend (useChat) sends UIMessage[] with { parts: [...] } format
|
|
15
|
+
* - Backend (streamText/generateText) expects ModelMessage[] with { content: ... }
|
|
16
|
+
* - convertToModelMessages() bridges this gap automatically
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import {
|
|
20
|
+
streamText,
|
|
21
|
+
generateText,
|
|
22
|
+
dynamicTool,
|
|
23
|
+
stepCountIs,
|
|
24
|
+
convertToModelMessages,
|
|
25
|
+
type ModelMessage,
|
|
26
|
+
type UIMessage,
|
|
27
|
+
type ToolSet,
|
|
28
|
+
} from 'ai';
|
|
29
|
+
import { createGoogleGenerativeAI } from '@ai-sdk/google';
|
|
30
|
+
import type { StepConfig, ExecutionContext, PrimitiveHandler } from '../types';
|
|
31
|
+
import { toolRegistry, type ToolImplementation } from '../tools';
|
|
32
|
+
import { resolveVariables } from '../core/variable-resolver';
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Callback function type for lifecycle hooks (onFinish, onError).
|
|
36
|
+
*/
|
|
37
|
+
export type CallbackFn = (payload: Record<string, unknown>) => void | Promise<void>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Registry for consumer-registered callbacks.
|
|
41
|
+
* Populated by the application using Beddel.
|
|
42
|
+
*/
|
|
43
|
+
export const callbackRegistry: Record<string, CallbackFn> = {};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Register a callback function for lifecycle hooks.
|
|
47
|
+
*
|
|
48
|
+
* @param name - Unique identifier for the callback
|
|
49
|
+
* @param callback - Function to execute when hook is triggered
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* registerCallback('persistConversation', async ({ text, usage }) => {
|
|
53
|
+
* await db.saveMessage(text, usage);
|
|
54
|
+
* });
|
|
55
|
+
*/
|
|
56
|
+
export function registerCallback(name: string, callback: CallbackFn): void {
|
|
57
|
+
if (callbackRegistry[name]) {
|
|
58
|
+
console.warn(`[Beddel] Callback '${name}' already registered, overwriting.`);
|
|
59
|
+
}
|
|
60
|
+
callbackRegistry[name] = callback;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Tool definition from YAML config.
|
|
67
|
+
*/
|
|
68
|
+
interface YamlToolDefinition {
|
|
69
|
+
name: string;
|
|
70
|
+
description?: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* LLM step configuration from YAML.
|
|
75
|
+
*/
|
|
76
|
+
interface LlmConfig extends StepConfig {
|
|
77
|
+
model?: string;
|
|
78
|
+
stream?: boolean;
|
|
79
|
+
system?: string;
|
|
80
|
+
messages?: string | ModelMessage[];
|
|
81
|
+
tools?: YamlToolDefinition[];
|
|
82
|
+
onFinish?: string;
|
|
83
|
+
onError?: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Maps YAML tool definitions to Vercel AI SDK tool objects.
|
|
88
|
+
*
|
|
89
|
+
* YAML defines intent (name, optional description override).
|
|
90
|
+
* Registry provides implementation (parameters, execute).
|
|
91
|
+
* Uses dynamicTool for flexible type support with unknown input/output types.
|
|
92
|
+
*
|
|
93
|
+
* @param toolDefinitions - Array of tool definitions from YAML config
|
|
94
|
+
* @returns Record of Vercel AI SDK tools (ToolSet)
|
|
95
|
+
*/
|
|
96
|
+
function mapTools(toolDefinitions: YamlToolDefinition[]): ToolSet {
|
|
97
|
+
const tools: ToolSet = {};
|
|
98
|
+
|
|
99
|
+
for (const def of toolDefinitions) {
|
|
100
|
+
const impl: ToolImplementation | undefined = toolRegistry[def.name];
|
|
101
|
+
if (!impl) {
|
|
102
|
+
console.warn(`[Beddel] Tool '${def.name}' not found in registry, skipping.`);
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Use dynamicTool for flexible type handling with registry-defined tools
|
|
107
|
+
tools[def.name] = dynamicTool({
|
|
108
|
+
description: def.description || impl.description, // YAML can override
|
|
109
|
+
inputSchema: impl.parameters,
|
|
110
|
+
execute: async (args: unknown) => {
|
|
111
|
+
return impl.execute(args as Record<string, unknown>);
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return tools;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* LLM Primitive Handler
|
|
121
|
+
*
|
|
122
|
+
* Dual-mode support via config.stream:
|
|
123
|
+
* - stream: true → Uses streamText → returns result.toUIMessageStreamResponse()
|
|
124
|
+
* - stream: false → Uses generateText → returns { text, usage }
|
|
125
|
+
*
|
|
126
|
+
* When tools are present, stopWhen is set to stepCountIs(5) to enable tool loops.
|
|
127
|
+
*
|
|
128
|
+
* AI SDK v6: Converts UIMessage[] (from useChat) to ModelMessage[] automatically.
|
|
129
|
+
*
|
|
130
|
+
* @param config - Step configuration from YAML (model, stream, system, messages, tools)
|
|
131
|
+
* @param context - Execution context with input and variables
|
|
132
|
+
* @returns Response (streaming) or Record (blocking mode)
|
|
133
|
+
*/
|
|
134
|
+
export const llmPrimitive: PrimitiveHandler = async (
|
|
135
|
+
config: StepConfig,
|
|
136
|
+
context: ExecutionContext
|
|
137
|
+
): Promise<Response | Record<string, unknown>> => {
|
|
138
|
+
const llmConfig = config as LlmConfig;
|
|
139
|
+
|
|
140
|
+
// Initialize Google Generative AI provider
|
|
141
|
+
const google = createGoogleGenerativeAI({
|
|
142
|
+
apiKey: process.env.GEMINI_API_KEY,
|
|
143
|
+
});
|
|
144
|
+
const model = google(llmConfig.model || 'gemini-1.5-flash');
|
|
145
|
+
|
|
146
|
+
// Resolve messages from context (e.g., $input.messages)
|
|
147
|
+
// AI SDK v6: Frontend sends UIMessage[], we convert to ModelMessage[]
|
|
148
|
+
const rawMessages = resolveVariables(llmConfig.messages, context) as UIMessage[];
|
|
149
|
+
const messages = await convertToModelMessages(rawMessages);
|
|
150
|
+
|
|
151
|
+
// Map YAML tools to Vercel AI SDK format
|
|
152
|
+
const hasTools = llmConfig.tools && llmConfig.tools.length > 0;
|
|
153
|
+
const tools = hasTools ? mapTools(llmConfig.tools!) : undefined;
|
|
154
|
+
|
|
155
|
+
if (llmConfig.stream) {
|
|
156
|
+
// STREAMING MODE: Returns HTTP response directly
|
|
157
|
+
const result = streamText({
|
|
158
|
+
model,
|
|
159
|
+
messages,
|
|
160
|
+
system: llmConfig.system,
|
|
161
|
+
// Enable tool loop if tools exist (default is stepCountIs(1))
|
|
162
|
+
stopWhen: hasTools ? stepCountIs(5) : undefined,
|
|
163
|
+
tools,
|
|
164
|
+
// Lifecycle hooks (AI SDK v6 signature)
|
|
165
|
+
onFinish: async ({ text, finishReason, usage, totalUsage, steps, response }) => {
|
|
166
|
+
if (llmConfig.onFinish) {
|
|
167
|
+
const callback = callbackRegistry[llmConfig.onFinish];
|
|
168
|
+
if (callback) {
|
|
169
|
+
await callback({
|
|
170
|
+
text,
|
|
171
|
+
finishReason,
|
|
172
|
+
usage,
|
|
173
|
+
totalUsage,
|
|
174
|
+
steps,
|
|
175
|
+
response,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
onError: ({ error }) => {
|
|
181
|
+
if (llmConfig.onError) {
|
|
182
|
+
const callback = callbackRegistry[llmConfig.onError];
|
|
183
|
+
if (callback) {
|
|
184
|
+
callback({ error });
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
console.error('[Beddel] Stream error:', error);
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
// Return streaming response - Executor will detect this and return to client immediately
|
|
192
|
+
// AI SDK v6: toUIMessageStreamResponse() for useChat compatibility
|
|
193
|
+
return result.toUIMessageStreamResponse();
|
|
194
|
+
} else {
|
|
195
|
+
// BLOCKING MODE: Returns data for next workflow step
|
|
196
|
+
const result = await generateText({
|
|
197
|
+
model,
|
|
198
|
+
messages,
|
|
199
|
+
system: llmConfig.system,
|
|
200
|
+
// Enable tool loop if tools exist (default is stepCountIs(1))
|
|
201
|
+
stopWhen: hasTools ? stepCountIs(5) : undefined,
|
|
202
|
+
tools,
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
return {
|
|
206
|
+
text: result.text,
|
|
207
|
+
usage: result.usage,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Beddel Protocol - Output Primitive
|
|
3
|
+
*
|
|
4
|
+
* Deterministic JSON transform primitive for the workflow engine.
|
|
5
|
+
* Resolves variable references in a template and returns the result.
|
|
6
|
+
*
|
|
7
|
+
* This is a pure transform - no LLM invocation.
|
|
8
|
+
*
|
|
9
|
+
* Server-only: Used within WorkflowExecutor during step execution.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type { StepConfig, ExecutionContext, PrimitiveHandler } from '../types';
|
|
13
|
+
import { resolveVariables } from '../core/variable-resolver';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Output step configuration from YAML.
|
|
17
|
+
*/
|
|
18
|
+
interface OutputConfig extends StepConfig {
|
|
19
|
+
/**
|
|
20
|
+
* JSON template with variable references to resolve.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* template:
|
|
24
|
+
* status: "completed"
|
|
25
|
+
* tokens: "$llmOutput.usage"
|
|
26
|
+
* user: "$input.user.name"
|
|
27
|
+
*/
|
|
28
|
+
template: unknown;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Output Primitive Handler
|
|
33
|
+
*
|
|
34
|
+
* Resolves all variable references in the template and returns
|
|
35
|
+
* the transformed object for consumption by subsequent steps.
|
|
36
|
+
*
|
|
37
|
+
* Supported patterns (via resolveVariables):
|
|
38
|
+
* - $input.* → context.input[path]
|
|
39
|
+
* - $stepResult.* → context.variables.get(stepName)[path]
|
|
40
|
+
* - $varName.* → context.variables.get(varName)[path] (legacy)
|
|
41
|
+
*
|
|
42
|
+
* @param config - Step configuration from YAML (must contain 'template')
|
|
43
|
+
* @param context - Execution context with input and variables
|
|
44
|
+
* @returns Resolved template as Record (never streams)
|
|
45
|
+
*/
|
|
46
|
+
export const outputPrimitive: PrimitiveHandler = async (
|
|
47
|
+
config: StepConfig,
|
|
48
|
+
context: ExecutionContext
|
|
49
|
+
): Promise<Record<string, unknown>> => {
|
|
50
|
+
const outputConfig = config as OutputConfig;
|
|
51
|
+
|
|
52
|
+
if (outputConfig.template === undefined) {
|
|
53
|
+
console.warn('[Beddel] output-generator: No template provided, returning empty object.');
|
|
54
|
+
return {};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const resolved = resolveVariables(outputConfig.template, context);
|
|
58
|
+
|
|
59
|
+
// Ensure we return a Record even if template resolves to primitive
|
|
60
|
+
if (typeof resolved !== 'object' || resolved === null) {
|
|
61
|
+
return { value: resolved };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return resolved as Record<string, unknown>;
|
|
65
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { NextRequest } from 'next/server';
|
|
2
|
+
import { loadYaml } from '../core/parser';
|
|
3
|
+
import { WorkflowExecutor } from '../core/workflow';
|
|
4
|
+
import { join, normalize } from 'path';
|
|
5
|
+
|
|
6
|
+
export interface BeddelHandlerOptions {
|
|
7
|
+
agentsPath?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type BeddelHandler = (request: NextRequest) => Promise<Response>;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Validate agentId to prevent path traversal attacks.
|
|
14
|
+
* Only allows alphanumeric characters, hyphens, and underscores.
|
|
15
|
+
*
|
|
16
|
+
* @param agentId - The agent identifier from request
|
|
17
|
+
* @returns true if valid, false otherwise
|
|
18
|
+
*/
|
|
19
|
+
function isValidAgentId(agentId: string): boolean {
|
|
20
|
+
// Must be non-empty string
|
|
21
|
+
if (typeof agentId !== 'string' || agentId.length === 0) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Only allow safe characters: alphanumeric, hyphen, underscore
|
|
26
|
+
// No dots, slashes, or other path characters
|
|
27
|
+
const safePattern = /^[a-zA-Z0-9_-]+$/;
|
|
28
|
+
|
|
29
|
+
return safePattern.test(agentId);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function createBeddelHandler(options: BeddelHandlerOptions = {}): BeddelHandler {
|
|
33
|
+
const agentsPath = options.agentsPath || 'src/agents';
|
|
34
|
+
|
|
35
|
+
return async function POST(request: NextRequest): Promise<Response> {
|
|
36
|
+
try {
|
|
37
|
+
const body = await request.json() as any;
|
|
38
|
+
const { agentId, ...input } = body;
|
|
39
|
+
|
|
40
|
+
if (!agentId) {
|
|
41
|
+
return Response.json({ error: 'agentId is required' }, { status: 400 });
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Security: Validate agentId to prevent path traversal
|
|
45
|
+
if (!isValidAgentId(agentId)) {
|
|
46
|
+
return Response.json(
|
|
47
|
+
{ error: 'Invalid agentId: only alphanumeric characters, hyphens, and underscores allowed' },
|
|
48
|
+
{ status: 400 }
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Resolve path relative to CWD (usually project root)
|
|
53
|
+
const basePath = join(process.cwd(), agentsPath);
|
|
54
|
+
const fullPath = normalize(join(basePath, `${agentId}.yaml`));
|
|
55
|
+
|
|
56
|
+
// Double-check: ensure resolved path is within agents directory
|
|
57
|
+
if (!fullPath.startsWith(basePath)) {
|
|
58
|
+
return Response.json({ error: 'Invalid agentId' }, { status: 400 });
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const yaml = await loadYaml(fullPath);
|
|
62
|
+
|
|
63
|
+
const executor = new WorkflowExecutor(yaml);
|
|
64
|
+
// Pass the entire body (minus agentId) as input ($input)
|
|
65
|
+
const result = await executor.execute(input);
|
|
66
|
+
|
|
67
|
+
if (result instanceof Response) {
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return Response.json(result);
|
|
72
|
+
} catch (error) {
|
|
73
|
+
console.error('[Beddel] Handler Error:', error);
|
|
74
|
+
return Response.json(
|
|
75
|
+
{ error: error instanceof Error ? error.message : 'Internal Server Error' },
|
|
76
|
+
{ status: 500 }
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
package/src/server.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Beddel Protocol - Server Entry Point
|
|
3
|
+
*
|
|
4
|
+
* Use: import { createBeddelHandler } from 'beddel/server'
|
|
5
|
+
*
|
|
6
|
+
* This module provides the server-side handler factory for Next.js API routes.
|
|
7
|
+
* Contains Node.js dependencies - DO NOT import in client code.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export { createBeddelHandler, type BeddelHandlerOptions } from './server/handler';
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Beddel Protocol - Tool Registry
|
|
3
|
+
*
|
|
4
|
+
* This registry contains tool implementations that LLM primitives can access.
|
|
5
|
+
* Each tool has: description, Zod parameters schema, and execute function.
|
|
6
|
+
*
|
|
7
|
+
* Following Expansion Pack Pattern from BMAD-METHOD™ for extensibility.
|
|
8
|
+
* See: https://github.com/bmadcode/bmad-method
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Interface for tool implementations in the registry.
|
|
15
|
+
* Tools are invoked by the LLM via function calling.
|
|
16
|
+
*/
|
|
17
|
+
export interface ToolImplementation {
|
|
18
|
+
/** Human-readable description of what the tool does */
|
|
19
|
+
description: string;
|
|
20
|
+
/** Zod schema defining the tool's input parameters */
|
|
21
|
+
parameters: z.ZodSchema;
|
|
22
|
+
/** Async function that executes the tool and returns results */
|
|
23
|
+
execute: (args: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Registry of available tools keyed by tool name.
|
|
28
|
+
*
|
|
29
|
+
* YAML workflows reference tools by name:
|
|
30
|
+
* ```yaml
|
|
31
|
+
* tools:
|
|
32
|
+
* - name: "calculator"
|
|
33
|
+
* description: "Optional override" # Can override default description
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export const toolRegistry: Record<string, ToolImplementation> = {
|
|
37
|
+
/**
|
|
38
|
+
* Calculator tool - evaluates mathematical expressions safely.
|
|
39
|
+
*
|
|
40
|
+
* Security: Only allows numbers, operators (+, -, *, /, %, **),
|
|
41
|
+
* parentheses, and decimal points. No function calls or variables.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* Input: { expression: "2 + 2 * 3" }
|
|
45
|
+
* Output: { result: 8 }
|
|
46
|
+
*/
|
|
47
|
+
calculator: {
|
|
48
|
+
description: 'Evaluate a mathematical expression (numbers and basic operators only)',
|
|
49
|
+
parameters: z.object({
|
|
50
|
+
expression: z.string().describe('The math expression to evaluate (e.g., "2 + 2 * 3")'),
|
|
51
|
+
}),
|
|
52
|
+
execute: async ({ expression }) => {
|
|
53
|
+
const expr = String(expression);
|
|
54
|
+
|
|
55
|
+
// Security: Whitelist only safe characters
|
|
56
|
+
// Allows: digits, operators, parentheses, spaces, decimal points
|
|
57
|
+
const safePattern = /^[\d\s+\-*/%().]+$/;
|
|
58
|
+
|
|
59
|
+
if (!safePattern.test(expr)) {
|
|
60
|
+
return { error: 'Invalid expression: only numbers and operators (+, -, *, /, %, **) allowed' };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Additional check: no empty parentheses or dangerous patterns
|
|
64
|
+
if (/\(\s*\)/.test(expr) || /[a-zA-Z_$]/.test(expr)) {
|
|
65
|
+
return { error: 'Invalid expression: function calls not allowed' };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
// Safe to evaluate after whitelist validation
|
|
70
|
+
const result = Function(`"use strict"; return (${expr})`)();
|
|
71
|
+
|
|
72
|
+
if (typeof result !== 'number' || !Number.isFinite(result)) {
|
|
73
|
+
return { error: 'Expression did not evaluate to a valid number' };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return { result };
|
|
77
|
+
} catch (e) {
|
|
78
|
+
return { error: `Evaluation failed: ${e instanceof Error ? e.message : 'unknown error'}` };
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* getCurrentTime tool - returns current date and time in ISO format.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* Input: {}
|
|
88
|
+
* Output: { time: "2024-12-23T15:30:00.000Z" }
|
|
89
|
+
*/
|
|
90
|
+
getCurrentTime: {
|
|
91
|
+
description: 'Get the current date and time in ISO format',
|
|
92
|
+
parameters: z.object({}),
|
|
93
|
+
execute: async () => {
|
|
94
|
+
return { time: new Date().toISOString() };
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Register a custom tool in the registry.
|
|
101
|
+
* Allows consumers to extend Beddel with domain-specific tools.
|
|
102
|
+
*
|
|
103
|
+
* @param name - Unique identifier for the tool
|
|
104
|
+
* @param implementation - Tool implementation object
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* registerTool('weatherLookup', {
|
|
108
|
+
* description: 'Get weather for a city',
|
|
109
|
+
* parameters: z.object({ city: z.string() }),
|
|
110
|
+
* execute: async ({ city }) => fetchWeather(city),
|
|
111
|
+
* });
|
|
112
|
+
*/
|
|
113
|
+
export function registerTool(name: string, implementation: ToolImplementation): void {
|
|
114
|
+
if (toolRegistry[name]) {
|
|
115
|
+
console.warn(`[Beddel] Tool '${name}' already registered, overwriting.`);
|
|
116
|
+
}
|
|
117
|
+
toolRegistry[name] = implementation;
|
|
118
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Beddel Protocol - Type Definitions
|
|
3
|
+
* Core interfaces for the workflow engine
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Metadata from YAML header section
|
|
8
|
+
*/
|
|
9
|
+
export interface YamlMetadata {
|
|
10
|
+
name: string;
|
|
11
|
+
version: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Configuration for a workflow step
|
|
16
|
+
* Contents vary by step type (llm, output-generator, call-agent)
|
|
17
|
+
*/
|
|
18
|
+
export interface StepConfig {
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Individual workflow step definition
|
|
24
|
+
*/
|
|
25
|
+
export interface WorkflowStep {
|
|
26
|
+
/** Unique identifier for this step */
|
|
27
|
+
id: string;
|
|
28
|
+
/** Step type: 'llm' | 'output-generator' | 'call-agent' */
|
|
29
|
+
type: string;
|
|
30
|
+
/** Step-specific configuration */
|
|
31
|
+
config: StepConfig;
|
|
32
|
+
/** Optional variable name to store step result */
|
|
33
|
+
result?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Complete parsed YAML document structure
|
|
38
|
+
*/
|
|
39
|
+
export interface ParsedYaml {
|
|
40
|
+
metadata: YamlMetadata;
|
|
41
|
+
workflow: WorkflowStep[];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Execution context passed to primitive handlers
|
|
46
|
+
* Holds input data and accumulated step results
|
|
47
|
+
*/
|
|
48
|
+
export interface ExecutionContext {
|
|
49
|
+
/** Original input passed to WorkflowExecutor.execute() */
|
|
50
|
+
input: unknown;
|
|
51
|
+
/** Map of step results keyed by step.result name */
|
|
52
|
+
variables: Map<string, unknown>;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Contract for primitive handlers (llm, output-generator, call-agent)
|
|
57
|
+
* Handlers may return Response (streaming) or Record (data for next step)
|
|
58
|
+
*/
|
|
59
|
+
export type PrimitiveHandler = (
|
|
60
|
+
config: StepConfig,
|
|
61
|
+
context: ExecutionContext
|
|
62
|
+
) => Promise<Response | Record<string, unknown>>;
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"lib": [
|
|
7
|
+
"ES2022"
|
|
8
|
+
],
|
|
9
|
+
"strict": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"forceConsistentCasingInFileNames": true,
|
|
13
|
+
"declaration": true,
|
|
14
|
+
"declarationMap": true,
|
|
15
|
+
"outDir": "./dist",
|
|
16
|
+
"rootDir": "./src",
|
|
17
|
+
"resolveJsonModule": true,
|
|
18
|
+
"isolatedModules": true
|
|
19
|
+
},
|
|
20
|
+
"include": [
|
|
21
|
+
"src/**/*"
|
|
22
|
+
],
|
|
23
|
+
"exclude": [
|
|
24
|
+
"node_modules",
|
|
25
|
+
"dist"
|
|
26
|
+
]
|
|
27
|
+
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## [0.2.3] - 2025-12-20
|
|
4
|
-
|
|
5
|
-
### Added
|
|
6
|
-
- **Client-Safe Type Exports**: Exposed shared types for frontend consumption
|
|
7
|
-
- `AgentMetadata`, `AgentResponse`, `ExecutionStep` from shared agent types
|
|
8
|
-
- `WorkflowStepType`, `AgentCategory` for workflow typing
|
|
9
|
-
- `ChatHandlerParams`, `ChatHandlerResult`, `ChatMetadata` for chat agent
|
|
10
|
-
- `ConversationMessage` from RAG types
|
|
11
|
-
- `chatMetadata` constant for chat agent metadata
|
|
12
|
-
|
|
13
|
-
### Purpose
|
|
14
|
-
- Enable frontend applications to import types directly from `beddel` package
|
|
15
|
-
- Support type-safe chat UI development without duplicating type definitions
|
|
16
|
-
- All exported types are client-safe (no server-only dependencies)
|
|
17
|
-
|
|
18
|
-
## [0.2.2] - 2025-12-19
|
|
19
|
-
|
|
20
|
-
### Changed
|
|
21
|
-
- Maintenance release (no functional changes)
|
|
22
|
-
|
|
23
|
-
## [0.2.0] - 2025-12-18
|
|
24
|
-
|
|
25
|
-
### Added
|
|
26
|
-
- **TypeScript Code-Behind for Custom Agents**: Custom agents can now include TypeScript implementations alongside YAML definitions
|
|
27
|
-
- Place `.ts` files in `/agents` directory
|
|
28
|
-
- Export functions are automatically registered with namespaced keys
|
|
29
|
-
- New `custom-action` workflow type for executing TypeScript functions
|
|
30
|
-
- Full access to input, variables, execution context, and Beddel helpers
|
|
31
|
-
- **Enhanced Agent Registry**:
|
|
32
|
-
- `loadCustomFunctions()` method for dynamic TypeScript module loading
|
|
33
|
-
- `getCustomFunction()` method for runtime function retrieval
|
|
34
|
-
- Async agent loading with proper error handling
|
|
35
|
-
- **Complete Documentation**: Added comprehensive guide for TypeScript code-behind in README.md
|
|
36
|
-
|
|
37
|
-
### Changed
|
|
38
|
-
- `AgentRegistry.loadCustomAgents()` is now async to support dynamic imports
|
|
39
|
-
- Updated agent loading flow to include TypeScript module discovery
|
|
40
|
-
|
|
41
|
-
### Backward Compatibility
|
|
42
|
-
- All existing agents (joker, translator, image-generator) continue to work without changes
|
|
43
|
-
- YAML-only agents are fully supported
|
|
44
|
-
- No breaking changes to existing APIs
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
All notable changes to this project will be documented in this file.
|
|
50
|
-
|
|
51
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
52
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
53
|
-
|
|
54
|
-
## [0.1.0] - 2025-12-18
|
|
55
|
-
|
|
56
|
-
### Added
|
|
57
|
-
- Initial release of Beddel package
|
|
58
|
-
- Secure YAML parser with FAILSAFE schema
|
|
59
|
-
- Declarative agent runtime (protocol v2.0)
|
|
60
|
-
- Agent registry with custom agent support
|
|
61
|
-
- Built-in agents: joker, translator, image generator
|
|
62
|
-
- Schema validation with Zod
|
|
63
|
-
- Isolated runtime with security profiles
|
|
64
|
-
- Multi-tenant Firebase support
|
|
65
|
-
- GDPR/LGPD compliance utilities
|
|
66
|
-
- Performance monitoring and autoscaling
|
|
67
|
-
- Security scanning and threat detection
|
|
68
|
-
- Server utilities (KV store, runtime security)
|
|
69
|
-
- GraphQL API integration
|
|
70
|
-
- Comprehensive documentation and guides
|
|
71
|
-
|
|
72
|
-
### Features
|
|
73
|
-
- Custom agents auto-discovery from `/agents` directory
|
|
74
|
-
- Agent override mechanism (custom > built-in)
|
|
75
|
-
- Variable interpolation in YAML workflows
|
|
76
|
-
- Nested property access in output schemas
|
|
77
|
-
- Gemini Flash integration for AI capabilities
|
|
78
|
-
- TypeScript support with full type definitions
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Beddel Contributors
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import 'server-only';
|
|
2
|
-
/**
|
|
3
|
-
* Chat Agent Handler - Server-only execution logic
|
|
4
|
-
* Orchestrates RAG pipeline or simple chat based on mode
|
|
5
|
-
*/
|
|
6
|
-
import type { ExecutionContext } from '../../types/executionContext';
|
|
7
|
-
import type { ChatHandlerParams, ChatHandlerResult } from './chat.types';
|
|
8
|
-
/**
|
|
9
|
-
* Execute chat orchestration
|
|
10
|
-
*/
|
|
11
|
-
export declare function executeChatHandler(params: ChatHandlerParams, props: Record<string, string>, context: ExecutionContext): Promise<ChatHandlerResult>;
|
|
12
|
-
//# sourceMappingURL=chat.handler.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chat.handler.d.ts","sourceRoot":"","sources":["../../../src/agents/chat/chat.handler.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAErB;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAErE,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAY,MAAM,cAAc,CAAC;AAqKnF;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,iBAAiB,EACzB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC7B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CA2B5B"}
|