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.
Files changed (542) hide show
  1. package/README.md +138 -595
  2. package/dist/client.d.ts +10 -0
  3. package/dist/client.d.ts.map +1 -0
  4. package/dist/client.js +9 -0
  5. package/dist/core/parser.d.ts +25 -0
  6. package/dist/core/parser.d.ts.map +1 -0
  7. package/dist/core/parser.js +31 -0
  8. package/dist/core/variable-resolver.d.ts +23 -0
  9. package/dist/core/variable-resolver.d.ts.map +1 -0
  10. package/dist/core/variable-resolver.js +98 -0
  11. package/dist/core/workflow.d.ts +39 -0
  12. package/dist/core/workflow.d.ts.map +1 -0
  13. package/dist/core/workflow.js +64 -0
  14. package/dist/index.d.ts +14 -36
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +15 -130
  17. package/dist/primitives/index.d.ts +37 -0
  18. package/dist/primitives/index.d.ts.map +1 -0
  19. package/dist/primitives/index.js +72 -0
  20. package/dist/primitives/llm.d.ts +56 -0
  21. package/dist/primitives/llm.d.ts.map +1 -0
  22. package/dist/primitives/llm.js +156 -0
  23. package/dist/primitives/output.d.ts +28 -0
  24. package/dist/primitives/output.d.ts.map +1 -0
  25. package/dist/primitives/output.js +39 -0
  26. package/dist/server/handler.d.ts +7 -0
  27. package/dist/server/handler.d.ts.map +1 -0
  28. package/dist/server/handler.js +55 -0
  29. package/dist/server.d.ts +10 -0
  30. package/dist/server.d.ts.map +1 -0
  31. package/dist/server.js +9 -0
  32. package/dist/tools/index.d.ts +49 -0
  33. package/dist/tools/index.d.ts.map +1 -0
  34. package/dist/tools/index.js +96 -0
  35. package/dist/types/index.d.ts +54 -0
  36. package/dist/types/index.d.ts.map +1 -0
  37. package/dist/types/index.js +5 -0
  38. package/docs/architecture/api-reference.md +307 -0
  39. package/docs/architecture/components.md +246 -0
  40. package/docs/architecture/core-workflows.md +236 -0
  41. package/docs/architecture/high-level-architecture.md +76 -0
  42. package/docs/architecture/index.md +31 -0
  43. package/docs/architecture/source-tree.md +92 -0
  44. package/docs/architecture/tech-stack.md +25 -0
  45. package/docs/prd/epic-list.md +101 -0
  46. package/docs/prd/goals-context.md +23 -0
  47. package/docs/prd/index.md +21 -0
  48. package/docs/prd/requirements.md +25 -0
  49. package/docs/prd/technical-assumptions.md +35 -0
  50. package/package.json +31 -118
  51. package/src/client.ts +18 -0
  52. package/src/core/parser.ts +36 -0
  53. package/src/core/variable-resolver.ts +114 -0
  54. package/src/core/workflow.ts +77 -0
  55. package/src/index.ts +25 -159
  56. package/src/primitives/index.ts +83 -0
  57. package/src/primitives/llm.ts +210 -0
  58. package/src/primitives/output.ts +65 -0
  59. package/src/server/handler.ts +80 -0
  60. package/src/server.ts +10 -0
  61. package/src/tools/index.ts +118 -0
  62. package/src/types/index.ts +62 -0
  63. package/tsconfig.json +27 -0
  64. package/CHANGELOG.md +0 -78
  65. package/LICENSE +0 -21
  66. package/dist/agents/chat/chat.handler.d.ts +0 -12
  67. package/dist/agents/chat/chat.handler.d.ts.map +0 -1
  68. package/dist/agents/chat/chat.handler.js +0 -143
  69. package/dist/agents/chat/chat.handler.js.map +0 -1
  70. package/dist/agents/chat/chat.schema.d.ts +0 -38
  71. package/dist/agents/chat/chat.schema.d.ts.map +0 -1
  72. package/dist/agents/chat/chat.schema.js +0 -31
  73. package/dist/agents/chat/chat.schema.js.map +0 -1
  74. package/dist/agents/chat/chat.types.d.ts +0 -42
  75. package/dist/agents/chat/chat.types.d.ts.map +0 -1
  76. package/dist/agents/chat/chat.types.js +0 -6
  77. package/dist/agents/chat/chat.types.js.map +0 -1
  78. package/dist/agents/chat/chat.yaml +0 -150
  79. package/dist/agents/chat/index.d.ts +0 -16
  80. package/dist/agents/chat/index.d.ts.map +0 -1
  81. package/dist/agents/chat/index.js +0 -21
  82. package/dist/agents/chat/index.js.map +0 -1
  83. package/dist/agents/chromadb/chromadb.handler.d.ts +0 -12
  84. package/dist/agents/chromadb/chromadb.handler.d.ts.map +0 -1
  85. package/dist/agents/chromadb/chromadb.handler.js +0 -139
  86. package/dist/agents/chromadb/chromadb.handler.js.map +0 -1
  87. package/dist/agents/chromadb/chromadb.schema.d.ts +0 -36
  88. package/dist/agents/chromadb/chromadb.schema.d.ts.map +0 -1
  89. package/dist/agents/chromadb/chromadb.schema.js +0 -33
  90. package/dist/agents/chromadb/chromadb.schema.js.map +0 -1
  91. package/dist/agents/chromadb/chromadb.types.d.ts +0 -49
  92. package/dist/agents/chromadb/chromadb.types.d.ts.map +0 -1
  93. package/dist/agents/chromadb/chromadb.types.js +0 -6
  94. package/dist/agents/chromadb/chromadb.types.js.map +0 -1
  95. package/dist/agents/chromadb/chromadb.yaml +0 -128
  96. package/dist/agents/chromadb/index.d.ts +0 -15
  97. package/dist/agents/chromadb/index.d.ts.map +0 -1
  98. package/dist/agents/chromadb/index.js +0 -20
  99. package/dist/agents/chromadb/index.js.map +0 -1
  100. package/dist/agents/gemini-vectorize/gemini-vectorize.handler.d.ts +0 -8
  101. package/dist/agents/gemini-vectorize/gemini-vectorize.handler.d.ts.map +0 -1
  102. package/dist/agents/gemini-vectorize/gemini-vectorize.handler.js +0 -58
  103. package/dist/agents/gemini-vectorize/gemini-vectorize.handler.js.map +0 -1
  104. package/dist/agents/gemini-vectorize/gemini-vectorize.schema.d.ts +0 -22
  105. package/dist/agents/gemini-vectorize/gemini-vectorize.schema.d.ts.map +0 -1
  106. package/dist/agents/gemini-vectorize/gemini-vectorize.schema.js +0 -20
  107. package/dist/agents/gemini-vectorize/gemini-vectorize.schema.js.map +0 -1
  108. package/dist/agents/gemini-vectorize/gemini-vectorize.types.d.ts +0 -32
  109. package/dist/agents/gemini-vectorize/gemini-vectorize.types.d.ts.map +0 -1
  110. package/dist/agents/gemini-vectorize/gemini-vectorize.types.js +0 -6
  111. package/dist/agents/gemini-vectorize/gemini-vectorize.types.js.map +0 -1
  112. package/dist/agents/gemini-vectorize/gemini-vectorize.yaml +0 -84
  113. package/dist/agents/gemini-vectorize/index.d.ts +0 -15
  114. package/dist/agents/gemini-vectorize/index.d.ts.map +0 -1
  115. package/dist/agents/gemini-vectorize/index.js +0 -20
  116. package/dist/agents/gemini-vectorize/index.js.map +0 -1
  117. package/dist/agents/gitmcp/gitmcp.handler.d.ts +0 -12
  118. package/dist/agents/gitmcp/gitmcp.handler.d.ts.map +0 -1
  119. package/dist/agents/gitmcp/gitmcp.handler.js +0 -95
  120. package/dist/agents/gitmcp/gitmcp.handler.js.map +0 -1
  121. package/dist/agents/gitmcp/gitmcp.schema.d.ts +0 -17
  122. package/dist/agents/gitmcp/gitmcp.schema.d.ts.map +0 -1
  123. package/dist/agents/gitmcp/gitmcp.schema.js +0 -18
  124. package/dist/agents/gitmcp/gitmcp.schema.js.map +0 -1
  125. package/dist/agents/gitmcp/gitmcp.types.d.ts +0 -31
  126. package/dist/agents/gitmcp/gitmcp.types.d.ts.map +0 -1
  127. package/dist/agents/gitmcp/gitmcp.types.js +0 -6
  128. package/dist/agents/gitmcp/gitmcp.types.js.map +0 -1
  129. package/dist/agents/gitmcp/gitmcp.yaml +0 -71
  130. package/dist/agents/gitmcp/index.d.ts +0 -16
  131. package/dist/agents/gitmcp/index.d.ts.map +0 -1
  132. package/dist/agents/gitmcp/index.js +0 -21
  133. package/dist/agents/gitmcp/index.js.map +0 -1
  134. package/dist/agents/image/image.handler.d.ts +0 -8
  135. package/dist/agents/image/image.handler.d.ts.map +0 -1
  136. package/dist/agents/image/image.handler.js +0 -66
  137. package/dist/agents/image/image.handler.js.map +0 -1
  138. package/dist/agents/image/image.schema.d.ts +0 -29
  139. package/dist/agents/image/image.schema.d.ts.map +0 -1
  140. package/dist/agents/image/image.schema.js +0 -26
  141. package/dist/agents/image/image.schema.js.map +0 -1
  142. package/dist/agents/image/image.types.d.ts +0 -42
  143. package/dist/agents/image/image.types.d.ts.map +0 -1
  144. package/dist/agents/image/image.types.js +0 -6
  145. package/dist/agents/image/image.types.js.map +0 -1
  146. package/dist/agents/image/image.yaml +0 -86
  147. package/dist/agents/image/index.d.ts +0 -14
  148. package/dist/agents/image/index.d.ts.map +0 -1
  149. package/dist/agents/image/index.js +0 -19
  150. package/dist/agents/image/index.js.map +0 -1
  151. package/dist/agents/index.d.ts +0 -95
  152. package/dist/agents/index.d.ts.map +0 -1
  153. package/dist/agents/index.js +0 -76
  154. package/dist/agents/index.js.map +0 -1
  155. package/dist/agents/joker/index.d.ts +0 -14
  156. package/dist/agents/joker/index.d.ts.map +0 -1
  157. package/dist/agents/joker/index.js +0 -19
  158. package/dist/agents/joker/index.js.map +0 -1
  159. package/dist/agents/joker/joker.handler.d.ts +0 -8
  160. package/dist/agents/joker/joker.handler.d.ts.map +0 -1
  161. package/dist/agents/joker/joker.handler.js +0 -48
  162. package/dist/agents/joker/joker.handler.js.map +0 -1
  163. package/dist/agents/joker/joker.schema.d.ts +0 -12
  164. package/dist/agents/joker/joker.schema.d.ts.map +0 -1
  165. package/dist/agents/joker/joker.schema.js +0 -13
  166. package/dist/agents/joker/joker.schema.js.map +0 -1
  167. package/dist/agents/joker/joker.types.d.ts +0 -35
  168. package/dist/agents/joker/joker.types.d.ts.map +0 -1
  169. package/dist/agents/joker/joker.types.js +0 -6
  170. package/dist/agents/joker/joker.types.js.map +0 -1
  171. package/dist/agents/joker/joker.yaml +0 -47
  172. package/dist/agents/mcp-tool/index.d.ts +0 -14
  173. package/dist/agents/mcp-tool/index.d.ts.map +0 -1
  174. package/dist/agents/mcp-tool/index.js +0 -19
  175. package/dist/agents/mcp-tool/index.js.map +0 -1
  176. package/dist/agents/mcp-tool/mcp-tool.handler.d.ts +0 -12
  177. package/dist/agents/mcp-tool/mcp-tool.handler.d.ts.map +0 -1
  178. package/dist/agents/mcp-tool/mcp-tool.handler.js +0 -116
  179. package/dist/agents/mcp-tool/mcp-tool.handler.js.map +0 -1
  180. package/dist/agents/mcp-tool/mcp-tool.schema.d.ts +0 -19
  181. package/dist/agents/mcp-tool/mcp-tool.schema.d.ts.map +0 -1
  182. package/dist/agents/mcp-tool/mcp-tool.schema.js +0 -20
  183. package/dist/agents/mcp-tool/mcp-tool.schema.js.map +0 -1
  184. package/dist/agents/mcp-tool/mcp-tool.types.d.ts +0 -31
  185. package/dist/agents/mcp-tool/mcp-tool.types.d.ts.map +0 -1
  186. package/dist/agents/mcp-tool/mcp-tool.types.js +0 -6
  187. package/dist/agents/mcp-tool/mcp-tool.types.js.map +0 -1
  188. package/dist/agents/mcp-tool/mcp-tool.yaml +0 -71
  189. package/dist/agents/rag/index.d.ts +0 -15
  190. package/dist/agents/rag/index.d.ts.map +0 -1
  191. package/dist/agents/rag/index.js +0 -20
  192. package/dist/agents/rag/index.js.map +0 -1
  193. package/dist/agents/rag/rag.handler.d.ts +0 -8
  194. package/dist/agents/rag/rag.handler.d.ts.map +0 -1
  195. package/dist/agents/rag/rag.handler.js +0 -101
  196. package/dist/agents/rag/rag.handler.js.map +0 -1
  197. package/dist/agents/rag/rag.schema.d.ts +0 -27
  198. package/dist/agents/rag/rag.schema.d.ts.map +0 -1
  199. package/dist/agents/rag/rag.schema.js +0 -24
  200. package/dist/agents/rag/rag.schema.js.map +0 -1
  201. package/dist/agents/rag/rag.types.d.ts +0 -47
  202. package/dist/agents/rag/rag.types.d.ts.map +0 -1
  203. package/dist/agents/rag/rag.types.js +0 -6
  204. package/dist/agents/rag/rag.types.js.map +0 -1
  205. package/dist/agents/rag/rag.yaml +0 -89
  206. package/dist/agents/registry/agentRegistry.d.ts +0 -117
  207. package/dist/agents/registry/agentRegistry.d.ts.map +0 -1
  208. package/dist/agents/registry/agentRegistry.js +0 -551
  209. package/dist/agents/registry/agentRegistry.js.map +0 -1
  210. package/dist/agents/registry/index.d.ts +0 -6
  211. package/dist/agents/registry/index.d.ts.map +0 -1
  212. package/dist/agents/registry/index.js +0 -10
  213. package/dist/agents/registry/index.js.map +0 -1
  214. package/dist/agents/translator/index.d.ts +0 -14
  215. package/dist/agents/translator/index.d.ts.map +0 -1
  216. package/dist/agents/translator/index.js +0 -19
  217. package/dist/agents/translator/index.js.map +0 -1
  218. package/dist/agents/translator/translator.handler.d.ts +0 -8
  219. package/dist/agents/translator/translator.handler.d.ts.map +0 -1
  220. package/dist/agents/translator/translator.handler.js +0 -83
  221. package/dist/agents/translator/translator.handler.js.map +0 -1
  222. package/dist/agents/translator/translator.schema.d.ts +0 -27
  223. package/dist/agents/translator/translator.schema.d.ts.map +0 -1
  224. package/dist/agents/translator/translator.schema.js +0 -28
  225. package/dist/agents/translator/translator.schema.js.map +0 -1
  226. package/dist/agents/translator/translator.types.d.ts +0 -40
  227. package/dist/agents/translator/translator.types.d.ts.map +0 -1
  228. package/dist/agents/translator/translator.types.js +0 -6
  229. package/dist/agents/translator/translator.types.js.map +0 -1
  230. package/dist/agents/translator/translator.yaml +0 -80
  231. package/dist/audit/auditTrail.d.ts +0 -55
  232. package/dist/audit/auditTrail.d.ts.map +0 -1
  233. package/dist/audit/auditTrail.js +0 -93
  234. package/dist/audit/auditTrail.js.map +0 -1
  235. package/dist/client/index.d.ts +0 -89
  236. package/dist/client/index.d.ts.map +0 -1
  237. package/dist/client/index.js +0 -93
  238. package/dist/client/index.js.map +0 -1
  239. package/dist/client/types.d.ts +0 -17
  240. package/dist/client/types.d.ts.map +0 -1
  241. package/dist/client/types.js +0 -7
  242. package/dist/client/types.js.map +0 -1
  243. package/dist/compliance/gdprEngine.d.ts +0 -44
  244. package/dist/compliance/gdprEngine.d.ts.map +0 -1
  245. package/dist/compliance/gdprEngine.js +0 -178
  246. package/dist/compliance/gdprEngine.js.map +0 -1
  247. package/dist/compliance/lgpdEngine.d.ts +0 -51
  248. package/dist/compliance/lgpdEngine.d.ts.map +0 -1
  249. package/dist/compliance/lgpdEngine.js +0 -221
  250. package/dist/compliance/lgpdEngine.js.map +0 -1
  251. package/dist/config.d.ts +0 -78
  252. package/dist/config.d.ts.map +0 -1
  253. package/dist/config.js +0 -77
  254. package/dist/config.js.map +0 -1
  255. package/dist/errors.d.ts +0 -17
  256. package/dist/errors.d.ts.map +0 -1
  257. package/dist/errors.js +0 -40
  258. package/dist/errors.js.map +0 -1
  259. package/dist/firebase/tenantManager.d.ts +0 -116
  260. package/dist/firebase/tenantManager.d.ts.map +0 -1
  261. package/dist/firebase/tenantManager.js +0 -444
  262. package/dist/firebase/tenantManager.js.map +0 -1
  263. package/dist/index.js.map +0 -1
  264. package/dist/integration/secure-yaml-runtime.d.ts +0 -68
  265. package/dist/integration/secure-yaml-runtime.d.ts.map +0 -1
  266. package/dist/integration/secure-yaml-runtime.js +0 -245
  267. package/dist/integration/secure-yaml-runtime.js.map +0 -1
  268. package/dist/parser/secure-yaml-parser.d.ts +0 -62
  269. package/dist/parser/secure-yaml-parser.d.ts.map +0 -1
  270. package/dist/parser/secure-yaml-parser.js +0 -234
  271. package/dist/parser/secure-yaml-parser.js.map +0 -1
  272. package/dist/performance/autoscaling.d.ts +0 -100
  273. package/dist/performance/autoscaling.d.ts.map +0 -1
  274. package/dist/performance/autoscaling.js +0 -339
  275. package/dist/performance/autoscaling.js.map +0 -1
  276. package/dist/performance/benchmark.d.ts +0 -104
  277. package/dist/performance/benchmark.d.ts.map +0 -1
  278. package/dist/performance/benchmark.js +0 -514
  279. package/dist/performance/benchmark.js.map +0 -1
  280. package/dist/performance/index.d.ts +0 -14
  281. package/dist/performance/index.d.ts.map +0 -1
  282. package/dist/performance/index.js +0 -35
  283. package/dist/performance/index.js.map +0 -1
  284. package/dist/performance/monitor.d.ts +0 -126
  285. package/dist/performance/monitor.d.ts.map +0 -1
  286. package/dist/performance/monitor.js +0 -324
  287. package/dist/performance/monitor.js.map +0 -1
  288. package/dist/performance/streaming.d.ts +0 -82
  289. package/dist/performance/streaming.d.ts.map +0 -1
  290. package/dist/performance/streaming.js +0 -287
  291. package/dist/performance/streaming.js.map +0 -1
  292. package/dist/runtime/audit.d.ts +0 -240
  293. package/dist/runtime/audit.d.ts.map +0 -1
  294. package/dist/runtime/audit.js +0 -641
  295. package/dist/runtime/audit.js.map +0 -1
  296. package/dist/runtime/declarativeAgentRuntime.d.ts +0 -92
  297. package/dist/runtime/declarativeAgentRuntime.d.ts.map +0 -1
  298. package/dist/runtime/declarativeAgentRuntime.js +0 -512
  299. package/dist/runtime/declarativeAgentRuntime.js.map +0 -1
  300. package/dist/runtime/index.d.ts +0 -12
  301. package/dist/runtime/index.d.ts.map +0 -1
  302. package/dist/runtime/index.js +0 -33
  303. package/dist/runtime/index.js.map +0 -1
  304. package/dist/runtime/isolatedRuntime.d.ts +0 -119
  305. package/dist/runtime/isolatedRuntime.d.ts.map +0 -1
  306. package/dist/runtime/isolatedRuntime.js +0 -425
  307. package/dist/runtime/isolatedRuntime.js.map +0 -1
  308. package/dist/runtime/schemaCompiler.d.ts +0 -35
  309. package/dist/runtime/schemaCompiler.d.ts.map +0 -1
  310. package/dist/runtime/schemaCompiler.js +0 -152
  311. package/dist/runtime/schemaCompiler.js.map +0 -1
  312. package/dist/runtime/simpleRuntime.d.ts +0 -57
  313. package/dist/runtime/simpleRuntime.d.ts.map +0 -1
  314. package/dist/runtime/simpleRuntime.js +0 -187
  315. package/dist/runtime/simpleRuntime.js.map +0 -1
  316. package/dist/runtime/workflowExecutor.d.ts +0 -30
  317. package/dist/runtime/workflowExecutor.d.ts.map +0 -1
  318. package/dist/runtime/workflowExecutor.js +0 -70
  319. package/dist/runtime/workflowExecutor.js.map +0 -1
  320. package/dist/security/dashboard.d.ts +0 -89
  321. package/dist/security/dashboard.d.ts.map +0 -1
  322. package/dist/security/dashboard.js +0 -300
  323. package/dist/security/dashboard.js.map +0 -1
  324. package/dist/security/hardening.d.ts +0 -130
  325. package/dist/security/hardening.d.ts.map +0 -1
  326. package/dist/security/hardening.js +0 -414
  327. package/dist/security/hardening.js.map +0 -1
  328. package/dist/security/index.d.ts +0 -128
  329. package/dist/security/index.d.ts.map +0 -1
  330. package/dist/security/index.js +0 -353
  331. package/dist/security/index.js.map +0 -1
  332. package/dist/security/monitor.d.ts +0 -88
  333. package/dist/security/monitor.d.ts.map +0 -1
  334. package/dist/security/monitor.js +0 -356
  335. package/dist/security/monitor.js.map +0 -1
  336. package/dist/security/scanner.d.ts +0 -104
  337. package/dist/security/scanner.d.ts.map +0 -1
  338. package/dist/security/scanner.js +0 -298
  339. package/dist/security/scanner.js.map +0 -1
  340. package/dist/security/score.d.ts +0 -150
  341. package/dist/security/score.d.ts.map +0 -1
  342. package/dist/security/score.js +0 -983
  343. package/dist/security/score.js.map +0 -1
  344. package/dist/security/threatDetector.d.ts +0 -39
  345. package/dist/security/threatDetector.d.ts.map +0 -1
  346. package/dist/security/threatDetector.js +0 -354
  347. package/dist/security/threatDetector.js.map +0 -1
  348. package/dist/security/validation.d.ts +0 -69
  349. package/dist/security/validation.d.ts.map +0 -1
  350. package/dist/security/validation.js +0 -286
  351. package/dist/security/validation.js.map +0 -1
  352. package/dist/server/api/clientsRoute.d.ts +0 -9
  353. package/dist/server/api/clientsRoute.d.ts.map +0 -1
  354. package/dist/server/api/clientsRoute.js +0 -71
  355. package/dist/server/api/clientsRoute.js.map +0 -1
  356. package/dist/server/api/endpointsRoute.d.ts +0 -8
  357. package/dist/server/api/endpointsRoute.d.ts.map +0 -1
  358. package/dist/server/api/endpointsRoute.js +0 -76
  359. package/dist/server/api/endpointsRoute.js.map +0 -1
  360. package/dist/server/api/graphql.d.ts +0 -9
  361. package/dist/server/api/graphql.d.ts.map +0 -1
  362. package/dist/server/api/graphql.js +0 -222
  363. package/dist/server/api/graphql.js.map +0 -1
  364. package/dist/server/errors.d.ts +0 -19
  365. package/dist/server/errors.d.ts.map +0 -1
  366. package/dist/server/errors.js +0 -42
  367. package/dist/server/errors.js.map +0 -1
  368. package/dist/server/index.d.ts +0 -7
  369. package/dist/server/index.d.ts.map +0 -1
  370. package/dist/server/index.js +0 -24
  371. package/dist/server/index.js.map +0 -1
  372. package/dist/server/kvStore.d.ts +0 -27
  373. package/dist/server/kvStore.d.ts.map +0 -1
  374. package/dist/server/kvStore.js +0 -128
  375. package/dist/server/kvStore.js.map +0 -1
  376. package/dist/server/runtimeSecurity.d.ts +0 -28
  377. package/dist/server/runtimeSecurity.d.ts.map +0 -1
  378. package/dist/server/runtimeSecurity.js +0 -85
  379. package/dist/server/runtimeSecurity.js.map +0 -1
  380. package/dist/server/types.d.ts +0 -53
  381. package/dist/server/types.d.ts.map +0 -1
  382. package/dist/server/types.js +0 -8
  383. package/dist/server/types.js.map +0 -1
  384. package/dist/shared/index.d.ts +0 -7
  385. package/dist/shared/index.d.ts.map +0 -1
  386. package/dist/shared/index.js +0 -23
  387. package/dist/shared/index.js.map +0 -1
  388. package/dist/shared/types/agent.types.d.ts +0 -50
  389. package/dist/shared/types/agent.types.d.ts.map +0 -1
  390. package/dist/shared/types/agent.types.js +0 -7
  391. package/dist/shared/types/agent.types.js.map +0 -1
  392. package/dist/shared/types/execution.types.d.ts +0 -42
  393. package/dist/shared/types/execution.types.d.ts.map +0 -1
  394. package/dist/shared/types/execution.types.js +0 -7
  395. package/dist/shared/types/execution.types.js.map +0 -1
  396. package/dist/shared/types/index.d.ts +0 -7
  397. package/dist/shared/types/index.d.ts.map +0 -1
  398. package/dist/shared/types/index.js +0 -23
  399. package/dist/shared/types/index.js.map +0 -1
  400. package/dist/shared/types/schema.types.d.ts +0 -52
  401. package/dist/shared/types/schema.types.d.ts.map +0 -1
  402. package/dist/shared/types/schema.types.js +0 -7
  403. package/dist/shared/types/schema.types.js.map +0 -1
  404. package/dist/shared/utils/index.d.ts +0 -5
  405. package/dist/shared/utils/index.d.ts.map +0 -1
  406. package/dist/shared/utils/index.js +0 -21
  407. package/dist/shared/utils/index.js.map +0 -1
  408. package/dist/shared/utils/validation.d.ts +0 -42
  409. package/dist/shared/utils/validation.d.ts.map +0 -1
  410. package/dist/shared/utils/validation.js +0 -93
  411. package/dist/shared/utils/validation.js.map +0 -1
  412. package/dist/tenant/TenantManager.d.ts +0 -152
  413. package/dist/tenant/TenantManager.d.ts.map +0 -1
  414. package/dist/tenant/TenantManager.js +0 -392
  415. package/dist/tenant/TenantManager.js.map +0 -1
  416. package/dist/tenant/index.d.ts +0 -47
  417. package/dist/tenant/index.d.ts.map +0 -1
  418. package/dist/tenant/index.js +0 -74
  419. package/dist/tenant/index.js.map +0 -1
  420. package/dist/tenant/interfaces.d.ts +0 -170
  421. package/dist/tenant/interfaces.d.ts.map +0 -1
  422. package/dist/tenant/interfaces.js +0 -67
  423. package/dist/tenant/interfaces.js.map +0 -1
  424. package/dist/tenant/providerFactory.d.ts +0 -43
  425. package/dist/tenant/providerFactory.d.ts.map +0 -1
  426. package/dist/tenant/providerFactory.js +0 -70
  427. package/dist/tenant/providerFactory.js.map +0 -1
  428. package/dist/tenant/providerRegistry.d.ts +0 -47
  429. package/dist/tenant/providerRegistry.d.ts.map +0 -1
  430. package/dist/tenant/providerRegistry.js +0 -79
  431. package/dist/tenant/providerRegistry.js.map +0 -1
  432. package/dist/tenant/providers/FirebaseTenantProvider.d.ts +0 -41
  433. package/dist/tenant/providers/FirebaseTenantProvider.d.ts.map +0 -1
  434. package/dist/tenant/providers/FirebaseTenantProvider.js +0 -290
  435. package/dist/tenant/providers/FirebaseTenantProvider.js.map +0 -1
  436. package/dist/tenant/providers/InMemoryTenantProvider.d.ts +0 -18
  437. package/dist/tenant/providers/InMemoryTenantProvider.d.ts.map +0 -1
  438. package/dist/tenant/providers/InMemoryTenantProvider.js +0 -137
  439. package/dist/tenant/providers/InMemoryTenantProvider.js.map +0 -1
  440. package/dist/types/executionContext.d.ts +0 -16
  441. package/dist/types/executionContext.d.ts.map +0 -1
  442. package/dist/types/executionContext.js +0 -3
  443. package/dist/types/executionContext.js.map +0 -1
  444. package/src/agents/chat/chat.handler.ts +0 -209
  445. package/src/agents/chat/chat.schema.ts +0 -33
  446. package/src/agents/chat/chat.types.ts +0 -46
  447. package/src/agents/chat/chat.yaml +0 -150
  448. package/src/agents/chat/index.ts +0 -21
  449. package/src/agents/chromadb/chromadb.handler.ts +0 -130
  450. package/src/agents/chromadb/chromadb.schema.ts +0 -35
  451. package/src/agents/chromadb/chromadb.types.ts +0 -52
  452. package/src/agents/chromadb/chromadb.yaml +0 -128
  453. package/src/agents/chromadb/index.ts +0 -20
  454. package/src/agents/gemini-vectorize/gemini-vectorize.handler.ts +0 -72
  455. package/src/agents/gemini-vectorize/gemini-vectorize.schema.ts +0 -22
  456. package/src/agents/gemini-vectorize/gemini-vectorize.types.ts +0 -34
  457. package/src/agents/gemini-vectorize/gemini-vectorize.yaml +0 -84
  458. package/src/agents/gemini-vectorize/index.ts +0 -20
  459. package/src/agents/gitmcp/gitmcp.handler.ts +0 -122
  460. package/src/agents/gitmcp/gitmcp.schema.ts +0 -20
  461. package/src/agents/gitmcp/gitmcp.types.ts +0 -33
  462. package/src/agents/gitmcp/gitmcp.yaml +0 -71
  463. package/src/agents/gitmcp/index.ts +0 -21
  464. package/src/agents/image/image.handler.ts +0 -82
  465. package/src/agents/image/image.schema.ts +0 -28
  466. package/src/agents/image/image.types.ts +0 -45
  467. package/src/agents/image/image.yaml +0 -86
  468. package/src/agents/image/index.ts +0 -19
  469. package/src/agents/index.ts +0 -59
  470. package/src/agents/joker/index.ts +0 -19
  471. package/src/agents/joker/joker.handler.ts +0 -60
  472. package/src/agents/joker/joker.schema.ts +0 -15
  473. package/src/agents/joker/joker.types.ts +0 -37
  474. package/src/agents/joker/joker.yaml +0 -47
  475. package/src/agents/mcp-tool/index.ts +0 -19
  476. package/src/agents/mcp-tool/mcp-tool.handler.ts +0 -112
  477. package/src/agents/mcp-tool/mcp-tool.schema.ts +0 -22
  478. package/src/agents/mcp-tool/mcp-tool.types.ts +0 -33
  479. package/src/agents/mcp-tool/mcp-tool.yaml +0 -71
  480. package/src/agents/rag/index.ts +0 -20
  481. package/src/agents/rag/rag.handler.ts +0 -119
  482. package/src/agents/rag/rag.schema.ts +0 -26
  483. package/src/agents/rag/rag.types.ts +0 -51
  484. package/src/agents/rag/rag.yaml +0 -89
  485. package/src/agents/registry/agentRegistry.ts +0 -598
  486. package/src/agents/registry/index.ts +0 -6
  487. package/src/agents/translator/index.ts +0 -19
  488. package/src/agents/translator/translator.handler.ts +0 -99
  489. package/src/agents/translator/translator.schema.ts +0 -30
  490. package/src/agents/translator/translator.types.ts +0 -42
  491. package/src/agents/translator/translator.yaml +0 -80
  492. package/src/audit/auditTrail.ts +0 -134
  493. package/src/client/index.ts +0 -53
  494. package/src/client/types.ts +0 -38
  495. package/src/compliance/gdprEngine.ts +0 -209
  496. package/src/compliance/lgpdEngine.ts +0 -268
  497. package/src/config.ts +0 -179
  498. package/src/errors.ts +0 -35
  499. package/src/integration/secure-yaml-runtime.ts +0 -341
  500. package/src/parser/secure-yaml-parser.ts +0 -273
  501. package/src/performance/autoscaling.ts +0 -495
  502. package/src/performance/benchmark.ts +0 -644
  503. package/src/performance/index.ts +0 -34
  504. package/src/performance/monitor.ts +0 -469
  505. package/src/performance/streaming.ts +0 -317
  506. package/src/runtime/audit.ts +0 -907
  507. package/src/runtime/declarativeAgentRuntime.ts +0 -772
  508. package/src/runtime/index.ts +0 -31
  509. package/src/runtime/isolatedRuntime.ts +0 -572
  510. package/src/runtime/schemaCompiler.ts +0 -228
  511. package/src/runtime/simpleRuntime.ts +0 -201
  512. package/src/runtime/workflowExecutor.ts +0 -94
  513. package/src/security/dashboard.ts +0 -462
  514. package/src/security/hardening.ts +0 -560
  515. package/src/security/index.ts +0 -439
  516. package/src/security/monitor.ts +0 -490
  517. package/src/security/scanner.ts +0 -368
  518. package/src/security/score.ts +0 -1138
  519. package/src/security/threatDetector.ts +0 -481
  520. package/src/security/validation.ts +0 -365
  521. package/src/server/api/clientsRoute.ts +0 -92
  522. package/src/server/api/endpointsRoute.ts +0 -97
  523. package/src/server/api/graphql.ts +0 -284
  524. package/src/server/errors.ts +0 -38
  525. package/src/server/index.ts +0 -6
  526. package/src/server/kvStore.ts +0 -152
  527. package/src/server/runtimeSecurity.ts +0 -102
  528. package/src/server/types.ts +0 -60
  529. package/src/shared/index.ts +0 -7
  530. package/src/shared/types/agent.types.ts +0 -80
  531. package/src/shared/types/execution.types.ts +0 -45
  532. package/src/shared/types/index.ts +0 -7
  533. package/src/shared/types/schema.types.ts +0 -55
  534. package/src/shared/utils/index.ts +0 -5
  535. package/src/shared/utils/validation.ts +0 -100
  536. package/src/tenant/TenantManager.ts +0 -488
  537. package/src/tenant/index.ts +0 -101
  538. package/src/tenant/interfaces.ts +0 -231
  539. package/src/tenant/providerFactory.ts +0 -75
  540. package/src/tenant/providerRegistry.ts +0 -86
  541. package/src/tenant/providers/InMemoryTenantProvider.ts +0 -168
  542. package/src/types/executionContext.ts +0 -16
package/README.md CHANGED
@@ -1,662 +1,205 @@
1
- # Beddel
1
+ # Beddel Protocol
2
2
 
3
- **Secure, Declarative, and Extensible Agent Runtime**
3
+ [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
4
+ [![npm version](https://img.shields.io/badge/npm-1.0.0-brightgreen.svg)](https://www.npmjs.com/package/beddel)
5
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.x-blue.svg)](https://www.typescriptlang.org/)
6
+ [![AI SDK](https://img.shields.io/badge/AI%20SDK-v6-purple.svg)](https://sdk.vercel.ai/)
4
7
 
5
- [![NPM Version](https://img.shields.io/npm/v/beddel.svg)](https://www.npmjs.com/package/beddel)
6
- [![License](https://img.shields.io/npm/l/beddel.svg)](https://github.com/botanarede/beddel-alpha/blob/main/LICENSE)
8
+ **Beddel Protocol** is a declarative **Sequential Pipeline Executor** that parses YAML workflow definitions and executes steps sequentially. Built on the Vercel AI SDK v6, it provides native streaming support and extensible primitives.
7
9
 
8
- Beddel is a security-first toolkit for building and running declarative YAML agents with enterprise-grade isolation, automatic schema validation, and extensible architecture.
10
+ ## Features
9
11
 
10
- ## Quick Start
11
-
12
- ```yaml
13
- # agents/my-agent.yaml
14
- agent:
15
- id: my-agent
16
- version: 1.0.0
17
- protocol: beddel-declarative-protocol/v2.0
18
-
19
- metadata:
20
- name: "My Custom Agent"
21
- description: "A simple custom agent"
22
- route: "/agents/my-agent"
23
-
24
- schema:
25
- input:
26
- type: "object"
27
- properties:
28
- message:
29
- type: "string"
30
- required: ["message"]
31
- output:
32
- type: "object"
33
- properties:
34
- response:
35
- type: "string"
36
- required: ["response"]
37
-
38
- logic:
39
- workflow:
40
- - name: "process"
41
- type: "genkit-joke"
42
- action:
43
- type: "joke"
44
- prompt: "{{message}}"
45
- result: "result"
46
-
47
- output:
48
- schema:
49
- response: "$result.texto"
50
- ```
51
-
52
- ```typescript
53
- import { agentRegistry } from "beddel";
54
-
55
- // Execute the agent
56
- const result = await agentRegistry.executeAgent(
57
- "my-agent.execute",
58
- { message: "Hello world" },
59
- { gemini_api_key: process.env.GEMINI_API_KEY },
60
- context
61
- );
62
- ```
12
+ - 🔄 **Sequential Pipeline Execution** — Define workflows as YAML, execute steps in order
13
+ - 🌊 **Native Streaming** — First-class `streamText` support with `useChat` compatibility
14
+ - 🔌 **Extensible Primitives** — Register custom step types, tools, and callbacks
15
+ - 🔒 **Security First** — YAML parsing with `FAILSAFE_SCHEMA` prevents code execution
16
+ - 📦 **Bundle Separation** — Three entry points for server, client, and full API access
63
17
 
64
18
  ## Installation
65
19
 
66
20
  ```bash
67
21
  npm install beddel
22
+ # or
23
+ pnpm add beddel
24
+ # or
25
+ yarn add beddel
68
26
  ```
69
27
 
70
- Requires Node.js 18+.
71
-
72
- ---
73
-
74
- ## Architecture Overview
75
-
76
- ```
77
- ┌─────────────────────────────────────────────────────────────────────┐
78
- │ Beddel Runtime │
79
- │ │
80
- │ ┌──────────────────────────────────────────────────────────────┐ │
81
- │ │ Agent Registry │ │
82
- │ │ │ │
83
- │ │ ┌─────────────────┐ ┌────────────────────────────────┐ │ │
84
- │ │ │ Built-in │ │ Custom Agents │ │ │
85
- │ │ │ Agents │ │ /agents/*.yaml │ │ │
86
- │ │ │ │ │ │ │ │
87
- │ │ │ • joker │ │ Automatically discovered │ │ │
88
- │ │ │ • translator │ │ and registered at startup │ │ │
89
- │ │ │ • image │ │ │ │ │
90
- │ │ └─────────────────┘ └────────────────────────────────┘ │ │
91
- │ │ │ │
92
- │ │ Priority: Custom Agents > Built-in Agents │ │
93
- │ └──────────────────────────────────────────────────────────────┘ │
94
- │ │ │
95
- │ ▼ │
96
- │ ┌──────────────────────────────────────────────────────────────┐ │
97
- │ │ Declarative Agent Interpreter │ │
98
- │ │ │ │
99
- │ │ • YAML Parsing (FAILSAFE schema) │ │
100
- │ │ • Schema Validation (Zod) │ │
101
- │ │ • Workflow Execution │ │
102
- │ │ • Genkit Integration (Gemini Flash) │ │
103
- │ └──────────────────────────────────────────────────────────────┘ │
104
- │ │ │
105
- │ ▼ │
106
- │ ┌──────────────────────────────────────────────────────────────┐ │
107
- │ │ Secure Runtime (isolated-vm) │ │
108
- │ │ │ │
109
- │ │ • Memory limits • V8 isolate │ │
110
- │ │ • Execution timeouts • No Node.js access │ │
111
- │ │ • Audit logging • Multi-tenant isolation │ │
112
- │ └──────────────────────────────────────────────────────────────┘ │
113
- └─────────────────────────────────────────────────────────────────────┘
114
- ```
115
-
116
- ---
117
-
118
- ## Custom Agents
119
-
120
- Beddel supports custom agents that you define in your application's `/agents` directory. Custom agents are automatically discovered and registered at startup.
121
-
122
- ### Directory Structure
123
-
124
- ```
125
- your-app/
126
- ├── agents/ # Custom agents directory
127
- │ ├── my-agent.yaml # Simple YAML-only agent
128
- │ ├── my-chat.yaml # Agent with TypeScript code-behind
129
- │ ├── my-chat.ts # TypeScript implementation
130
- │ ├── calculator/
131
- │ │ └── calculator.yaml # Agent in subdirectory
132
- │ └── translator-custom/
133
- │ └── translator-custom.yaml # Override built-in
134
-
135
- └── packages/beddel/src/agents/ # Built-in agents (sharded structure)
136
- ├── joker/
137
- │ ├── joker.yaml # Agent definition
138
- │ ├── joker.handler.ts # Server-only handler
139
- │ ├── joker.schema.ts # Zod validation
140
- │ ├── joker.types.ts # TypeScript types
141
- │ └── index.ts # Public exports
142
- ├── translator/
143
- │ └── ...
144
- ├── image/
145
- │ └── ...
146
- ├── mcp-tool/
147
- │ └── ...
148
- ├── gemini-vectorize/
149
- │ └── ...
150
- ├── chromadb/
151
- │ └── ...
152
- ├── gitmcp/
153
- │ └── ...
154
- ├── rag/
155
- │ └── ...
156
- └── chat/
157
- └── ...
158
- ```
159
-
160
- ### Agent Loading Flow
161
-
162
- ```
163
- ┌─────────────────────────────────────────────────────────────┐
164
- │ Agent Loading Sequence │
165
- │ │
166
- │ 1. AgentRegistry constructor() │
167
- │ │ │
168
- │ ├──▶ 2. registerBuiltinAgents() │
169
- │ │ ├── joker.execute │
170
- │ │ ├── translator.execute │
171
- │ │ └── image.generate │
172
- │ │ │
173
- │ └──▶ 3. loadCustomAgents() │
174
- │ │ │
175
- │ ├── Recursively scans /agents/**/*.yaml │
176
- │ │ └── Registers each agent │
177
- │ │ └── Custom agents override built-ins │
178
- │ │ │
179
- │ └── Scans /agents/**/*.ts │
180
- │ └── Dynamically imports TypeScript modules │
181
- │ └── Registers exported functions │
182
- │ │
183
- │ Priority: Custom Agents > Built-in Agents │
184
- └─────────────────────────────────────────────────────────────┘
185
- ```
186
-
187
- ### Creating a Custom Agent
188
-
189
- 1. **Create the YAML file** in `/agents`:
190
-
191
- ```yaml
192
- # agents/greeting.yaml
193
- agent:
194
- id: greeting
195
- version: 1.0.0
196
- protocol: beddel-declarative-protocol/v2.0
197
-
198
- metadata:
199
- name: "Greeting Agent"
200
- description: "Generates personalized greetings"
201
- category: "utility"
202
- route: "/agents/greeting"
203
-
204
- schema:
205
- input:
206
- type: "object"
207
- properties:
208
- name:
209
- type: "string"
210
- minLength: 1
211
- maxLength: 100
212
- required: ["name"]
213
-
214
- output:
215
- type: "object"
216
- properties:
217
- greeting:
218
- type: "string"
219
- required: ["greeting"]
220
-
221
- logic:
222
- workflow:
223
- - name: "generate-greeting"
224
- type: "genkit-joke"
225
- action:
226
- type: "joke"
227
- prompt: "Create a warm, friendly greeting for {{name}}"
228
- result: "greetingResult"
229
-
230
- output:
231
- schema:
232
- greeting: "$greetingResult.texto"
233
- ```
234
-
235
- 2. **The agent is automatically registered** when your application starts.
236
-
237
- 3. **Execute via GraphQL or directly** (GraphQL Yoga, introspection always enabled). GraphiQL is available at `GET /api/graphql`:
238
-
239
- ```graphql
240
- mutation Execute($methodName: String!, $params: JSON!, $props: JSON!) {
241
- executeMethod(methodName: $methodName, params: $params, props: $props) {
242
- success
243
- data
244
- error
245
- executionTime
246
- }
247
- }
248
- ```
249
-
250
- Example variables:
251
-
252
- ```json
253
- {
254
- "methodName": "greeting.execute",
255
- "params": { "name": "Alice" },
256
- "props": { "gemini_api_key": "your-api-key" }
257
- }
258
- ```
259
-
260
- ### Custom Agents with TypeScript Code-Behind
261
-
262
- For more complex logic, create custom agents with TypeScript implementations:
28
+ ## Quick Start
263
29
 
264
- #### 1. Create the TypeScript implementation:
30
+ ### 1. Create API Route
265
31
 
266
32
  ```typescript
267
- // agents/my-chat.ts
268
- export const chatHandler = async ({ input, variables, context }) => {
269
- // Full TypeScript power available here
270
- context.log("Processing chat message with custom TypeScript logic");
271
-
272
- const message = input.message || "";
273
- const history = input.messages || [];
274
-
275
- // Add user message to history
276
- history.push({ role: "user", content: message });
277
-
278
- // Your custom logic here - call external APIs, use Beddel helpers, etc.
279
- const response = `Processed: "${message}"`;
280
-
281
- history.push({ role: "assistant", content: response });
282
-
283
- return {
284
- response,
285
- history,
286
- timestamp: new Date().toISOString()
287
- };
288
- };
289
- ```
290
-
291
- #### 2. Create the YAML configuration:
33
+ // app/api/beddel/chat/route.ts
34
+ import { createBeddelHandler } from 'beddel/server';
292
35
 
293
- ```yaml
294
- # agents/my-chat.yaml
295
- agent:
296
- id: my-chat
297
- version: 1.0.0
298
- protocol: beddel-declarative-protocol/v2.0
299
-
300
- metadata:
301
- name: "Custom Chat Agent"
302
- description: "Chat agent with TypeScript code-behind"
303
- route: "/agents/my-chat"
304
-
305
- schema:
306
- input:
307
- type: "object"
308
- properties:
309
- message:
310
- type: "string"
311
- minLength: 1
312
- required: ["message"]
313
-
314
- output:
315
- type: "object"
316
- properties:
317
- response:
318
- type: "string"
319
- required: ["response"]
320
-
321
- logic:
322
- workflow:
323
- - name: process
324
- type: custom-action
325
- action:
326
- function: "my-chat/chatHandler" # Format: filename/exportedFunctionName
327
- result: response
328
-
329
- output:
330
- schema:
331
- response: "$response.response"
332
- ```
333
-
334
- #### 3. Function Arguments
335
-
336
- Custom functions receive a standardized arguments object:
337
-
338
- ```typescript
339
- {
340
- input: Record<string, any>, // Validated input from the request
341
- variables: Record<string, any>, // Current workflow variables
342
- action: Record<string, any>, // Action configuration from YAML
343
- context: ExecutionContext // Logging and error handling
344
- }
36
+ export const POST = createBeddelHandler({
37
+ agentsPath: 'src/agents' // Optional, default: 'src/agents'
38
+ });
345
39
  ```
346
40
 
347
- ### Overriding Built-in Agents
348
-
349
- Create a custom agent with the same route to override a built-in:
41
+ ### 2. Create YAML Agent
350
42
 
351
43
  ```yaml
352
- # agents/joker-custom.yaml
353
- agent:
354
- id: joker
355
- protocol: beddel-declarative-protocol/v2.0
356
-
44
+ # src/agents/assistant.yaml
357
45
  metadata:
358
- route: "/agents/joker" # Same route overrides built-in
359
- # ... your custom implementation
360
- ```
361
-
362
- ---
363
-
364
- ## Built-in Agents
365
-
366
- | Agent | Method | Description | Required Props |
367
- |-------|--------|-------------|----------------|
368
- | **Joker** | `joker.execute` | Generates short, original jokes | `gemini_api_key` |
369
- | **Translator** | `translator.execute` | Translates text between languages | `gemini_api_key` |
370
- | **Image Generator** | `image.generate` | Creates images (watercolor, neon, sketch) | `gemini_api_key` |
46
+ name: "Streaming Assistant"
47
+ version: "1.0.0"
371
48
 
372
- ### Joker Agent
373
-
374
- ```typescript
375
- const result = await agentRegistry.executeAgent(
376
- "joker.execute",
377
- {},
378
- { gemini_api_key: "..." },
379
- context
380
- );
381
- // Returns: { response: "Why did the..." }
49
+ workflow:
50
+ - id: "chat-interaction"
51
+ type: "llm"
52
+ config:
53
+ model: "gemini-2.0-flash-exp"
54
+ stream: true
55
+ system: "You are a helpful assistant."
56
+ messages: "$input.messages"
382
57
  ```
383
58
 
384
- ### Translator Agent
59
+ ### 3. Set Environment Variable
385
60
 
386
- ```typescript
387
- const result = await agentRegistry.executeAgent(
388
- "translator.execute",
389
- {
390
- texto: "Hello, world!",
391
- idioma_origem: "en",
392
- idioma_destino: "pt"
393
- },
394
- { gemini_api_key: "..." },
395
- context
396
- );
397
- // Returns: { texto_traduzido: "Olá, mundo!", metadados: {...} }
61
+ ```bash
62
+ GEMINI_API_KEY=your_api_key_here
63
+ ```
64
+
65
+ ### 4. Use with React (useChat)
66
+
67
+ ```tsx
68
+ 'use client';
69
+ import { useChat } from '@ai-sdk/react';
70
+
71
+ export default function Chat() {
72
+ const { messages, input, handleInputChange, handleSubmit } = useChat({
73
+ api: '/api/beddel/chat',
74
+ body: { agentId: 'assistant' },
75
+ });
76
+
77
+ return (
78
+ <div>
79
+ {messages.map((m) => (
80
+ <div key={m.id}>{m.role}: {m.content}</div>
81
+ ))}
82
+ <form onSubmit={handleSubmit}>
83
+ <input value={input} onChange={handleInputChange} />
84
+ <button type="submit">Send</button>
85
+ </form>
86
+ </div>
87
+ );
88
+ }
398
89
  ```
399
90
 
400
- ### Image Generator Agent
401
-
402
- ```typescript
403
- const result = await agentRegistry.executeAgent(
404
- "image.generate",
405
- {
406
- descricao: "A sunset over mountains",
407
- estilo: "watercolor",
408
- resolucao: "1024x1024"
409
- },
410
- { gemini_api_key: "..." },
411
- context
412
- );
413
- // Returns: { image_url, image_base64, media_type, ... }
414
- ```
91
+ ## Entry Points
415
92
 
416
- ---
93
+ | Import Path | Purpose | Environment |
94
+ |-------------|---------|-------------|
95
+ | `beddel` | Full API: `loadYaml`, `WorkflowExecutor`, registries | Server only |
96
+ | `beddel/server` | `createBeddelHandler` for Next.js API routes | Server only |
97
+ | `beddel/client` | Type-only exports (browser-safe) | Client/Server |
417
98
 
418
- ## Core Components
99
+ > ⚠️ **Important:** Never import `beddel` or `beddel/server` in client components. Use `beddel/client` for type imports.
419
100
 
420
- ### Package Map
101
+ ## Extensibility
421
102
 
422
- | Capability | Module | Description |
423
- |------------|--------|-------------|
424
- | **YAML Parsing** | `SecureYamlParser` | FAILSAFE schema, depth/size limits, UTF-8 validation |
425
- | **Sandboxed Execution** | `IsolatedRuntimeManager` | `isolated-vm` with security profiles |
426
- | **Agent Interpretation** | `DeclarativeAgentInterpreter` | Executes YAML agents with Genkit |
427
- | **Agent Registry** | `AgentRegistry` | Manages built-in and custom agents |
428
- | **Security** | `SecurityScanner`, `ThreatDetectionEngine` | Static scanning, scoring |
429
- | **Compliance** | `GDPRCompliance`, `LGPDCompliance` | Audit, anonymization |
430
- | **Performance** | `PerformanceMonitor`, `AutoScaler` | Metrics, scaling |
431
- | **Multi-tenancy** | `TenantManager`, `ITenantProvider` | Provider-agnostic tenant isolation |
103
+ Beddel follows the **Expansion Pack Pattern** for extensibility:
432
104
 
433
- ### Secure YAML Parsing
105
+ ### Register Custom Primitives
434
106
 
435
107
  ```typescript
436
- import { SecureYamlParser } from "beddel";
108
+ import { registerPrimitive } from 'beddel';
437
109
 
438
- const parser = new SecureYamlParser({
439
- maxDepth: 200,
440
- filename: "agent-manifest",
110
+ registerPrimitive('http-fetch', async (config, context) => {
111
+ const response = await fetch(config.url);
112
+ return { data: await response.json() };
441
113
  });
442
-
443
- const manifest = parser.parseSecure(yamlContent);
444
114
  ```
445
115
 
446
- ### Sandboxed Execution
116
+ ### Register Custom Tools
447
117
 
448
118
  ```typescript
449
- import { IsolatedRuntimeManager } from "beddel";
119
+ import { registerTool } from 'beddel';
120
+ import { z } from 'zod';
450
121
 
451
- const runtime = new IsolatedRuntimeManager();
452
-
453
- const result = await runtime.execute({
454
- code: `({ value: 42 })`,
455
- securityProfile: "ultra-secure",
456
- timeout: 2000,
122
+ registerTool('weatherLookup', {
123
+ description: 'Get weather for a city',
124
+ parameters: z.object({ city: z.string() }),
125
+ execute: async ({ city }) => fetchWeather(city),
457
126
  });
458
127
  ```
459
128
 
460
- ### Agent Registry API
129
+ ### Register Lifecycle Callbacks
461
130
 
462
131
  ```typescript
463
- import { agentRegistry } from "beddel";
464
-
465
- // Get all registered agents
466
- const agents = agentRegistry.getAllAgents();
132
+ import { registerCallback } from 'beddel';
467
133
 
468
- // Get a specific agent
469
- const agent = agentRegistry.getAgent("joker.execute");
470
-
471
- // Execute an agent
472
- const result = await agentRegistry.executeAgent(
473
- "joker.execute",
474
- input,
475
- props,
476
- context
477
- );
478
-
479
- // Load custom agents from a specific path
480
- agentRegistry.loadCustomAgents("/path/to/custom/agents");
134
+ registerCallback('persistConversation', async ({ text, usage }) => {
135
+ await db.saveMessage(text, usage);
136
+ });
481
137
  ```
482
138
 
483
- ---
484
-
485
- ## Schema Validation
486
-
487
- All agents must declare `schema.input` and `schema.output` blocks. The runtime compiles these into Zod schemas and validates:
488
-
489
- - **Before execution**: Input must match `schema.input`
490
- - **After execution**: Output must match `schema.output`
139
+ ## YAML Workflow Structure
491
140
 
492
141
  ```yaml
493
- schema:
494
- input:
495
- type: "object"
496
- properties:
497
- name:
498
- type: "string"
499
- minLength: 1
500
- maxLength: 100
501
- age:
502
- type: "number"
503
- required: ["name"]
504
-
505
- output:
506
- type: "object"
507
- properties:
508
- greeting:
509
- type: "string"
510
- required: ["greeting"]
511
- ```
512
-
513
- Supported types: `string`, `number`, `boolean`, `object`, `array`
514
-
515
- ---
516
-
517
- ## Multi-Tenant Architecture
518
-
519
- Beddel provides a provider-agnostic multi-tenant system with a dynamic registry for external providers.
520
-
521
- ### Built-in Providers
522
-
523
- | Provider | Type | Use Case |
524
- |----------|------|----------|
525
- | `InMemoryTenantProvider` | `memory` | Testing, development |
526
-
527
- ### External Providers
528
-
529
- Provider implementations that handle credentials (Firebase, Supabase, etc.) should be implemented in the consuming application. Use `ProviderRegistry` to register custom providers:
530
-
531
- ```typescript
532
- import { ProviderRegistry } from "beddel";
533
- import { FirebaseTenantProvider } from "./providers/FirebaseTenantProvider";
142
+ metadata:
143
+ name: "Agent Name"
144
+ version: "1.0.0"
534
145
 
535
- // Register during application bootstrap
536
- ProviderRegistry.register('firebase', () => new FirebaseTenantProvider());
146
+ workflow:
147
+ - id: "step-1"
148
+ type: "llm"
149
+ config:
150
+ model: "gemini-2.0-flash-exp"
151
+ stream: true
152
+ system: "System prompt"
153
+ messages: "$input.messages"
154
+ tools:
155
+ - name: "calculator"
156
+ onFinish: "callbackName"
157
+ result: "stepOutput"
537
158
  ```
538
159
 
539
- ### Quick Start
160
+ ### Variable Resolution
540
161
 
541
- ```typescript
542
- import { TenantManager } from "beddel";
543
-
544
- const manager = TenantManager.getInstance();
545
-
546
- // Initialize tenant
547
- const result = await manager.initializeTenant({
548
- tenantId: "tenant-123",
549
- securityProfile: "tenant-isolated",
550
- dataRetentionDays: 365,
551
- lgpdEnabled: true,
552
- gdprEnabled: true,
553
- provider: "memory", // or registered external provider like "firebase"
554
- providerConfig: {}
555
- });
162
+ | Pattern | Description | Example |
163
+ |---------|-------------|---------|
164
+ | `$input.*` | Access request input | `$input.messages` |
165
+ | `$stepResult.varName.*` | Access step result | `$stepResult.llmOutput.text` |
556
166
 
557
- // Execute in tenant context
558
- await manager.executeInTenant("tenant-123", "operation", data, async () => {
559
- const app = manager.getTenantApp("tenant-123");
560
- const db = app.getDatabase();
561
- await db.collection("users").add({ name: "Alice" });
562
- });
563
- ```
167
+ ## Built-in Tools
564
168
 
565
- ### Core Interfaces
169
+ | Tool | Description |
170
+ |------|-------------|
171
+ | `calculator` | Evaluate mathematical expressions |
172
+ | `getCurrentTime` | Get current ISO timestamp |
566
173
 
567
- - `ITenantProvider` Abstract provider for tenant management
568
- - `ITenantApp` — Isolated tenant instance
569
- - `ITenantDatabase` — Database operations
570
- - `ITenantCollection` — Collection operations
571
- - `ITenantDocument` — Document CRUD
572
- - `ProviderRegistry` — Dynamic provider registration
174
+ ## AI SDK v6 Compatibility
573
175
 
574
- ---
176
+ Beddel is fully compatible with Vercel AI SDK v6:
575
177
 
576
- ## Security
178
+ - **Frontend:** `useChat` sends `UIMessage[]` with `{ parts: [...] }` format
179
+ - **Backend:** `streamText`/`generateText` expects `ModelMessage[]` with `{ content: ... }`
180
+ - **Automatic Conversion:** `convertToModelMessages()` bridges the gap
181
+ - **Streaming:** `toUIMessageStreamResponse()` returns the correct format for `useChat`
577
182
 
578
- ### Multi-Layer Security Model
183
+ ## Technology Stack
579
184
 
580
- 1. **Parser Layer**: FAILSAFE schema, size limits, sanitization
581
- 2. **Runtime Layer**: V8 isolate, memory limits, timeouts
582
- 3. **Application Layer**: Authentication, rate limiting, tenant isolation
185
+ | Category | Technology | Version |
186
+ |----------|------------|---------|
187
+ | Language | TypeScript | 5.x |
188
+ | Runtime | Node.js / Edge | 20+ |
189
+ | AI Core | `ai` | 6.x |
190
+ | AI Provider | `@ai-sdk/google` | 3.x |
191
+ | Validation | `zod` | 3.x |
192
+ | YAML Parser | `js-yaml` | 4.x |
583
193
 
584
- ### Security Profiles
194
+ ## Documentation
585
195
 
586
- ```typescript
587
- const result = await runtime.execute({
588
- code: userCode,
589
- securityProfile: "tenant-isolated", // ultra-secure | tenant-isolated
590
- timeout: 5000,
591
- memoryLimit: 128,
592
- });
593
- ```
594
-
595
- ---
596
-
597
- ## Project Structure
598
-
599
- ```
600
- src/
601
- ├── agents/ # Agent registry and sharded agent modules
602
- │ ├── registry/ # Agent registry
603
- │ │ ├── agentRegistry.ts
604
- │ │ └── index.ts
605
- │ ├── joker/ # Joker agent
606
- │ │ ├── joker.yaml
607
- │ │ ├── joker.handler.ts
608
- │ │ ├── joker.schema.ts
609
- │ │ ├── joker.types.ts
610
- │ │ └── index.ts
611
- │ ├── translator/ # Translator agent
612
- │ ├── image/ # Image generator agent
613
- │ ├── mcp-tool/ # MCP tool agent
614
- │ ├── gemini-vectorize/ # Embeddings agent
615
- │ ├── chromadb/ # Vector storage agent
616
- │ ├── gitmcp/ # GitHub docs agent
617
- │ ├── rag/ # RAG agent
618
- │ ├── chat/ # Chat orchestrator agent
619
- │ └── index.ts # Public exports
620
- ├── runtime/ # Execution environments
621
- │ ├── declarativeAgentRuntime.ts
622
- │ ├── workflowExecutor.ts # Workflow step execution
623
- │ ├── schemaCompiler.ts
624
- │ └── index.ts
625
- ├── shared/ # Client-safe types and utilities
626
- │ ├── types/
627
- │ └── utils/
628
- ├── client/ # Client-safe exports
629
- ├── parser/ # Secure YAML parsing
630
- ├── security/ # Scanning and threat detection
631
- ├── compliance/ # GDPR/LGPD utilities
632
- ├── performance/ # Monitoring and autoscaling
633
- ├── tenant/ # Provider-agnostic multi-tenant management
634
- │ ├── TenantManager.ts # Singleton tenant orchestrator
635
- │ ├── interfaces.ts # ITenantProvider, ITenantApp, etc.
636
- │ ├── providerFactory.ts # Provider instantiation
637
- │ ├── providerRegistry.ts # Dynamic provider registration
638
- │ └── providers/ # Built-in provider implementations
639
- │ └── InMemoryTenantProvider.ts
640
- └── index.ts # Public exports
641
- ```
642
-
643
- ---
644
-
645
- ## Development
646
-
647
- ```bash
648
- # Build
649
- pnpm --filter beddel build
650
-
651
- # Test
652
- pnpm --filter beddel test
653
-
654
- # Lint
655
- pnpm --filter beddel lint
656
- ```
196
+ Detailed documentation is available in [`docs/`](./docs/):
657
197
 
658
- ---
198
+ - [API Reference](./docs/architecture/api-reference.md)
199
+ - [Components](./docs/architecture/components.md)
200
+ - [Core Workflows](./docs/architecture/core-workflows.md)
201
+ - [High-Level Architecture](./docs/architecture/high-level-architecture.md)
659
202
 
660
203
  ## License
661
204
 
662
- MIT License. See [LICENSE](LICENSE) for details.
205
+ [MIT](LICENSE)