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
@@ -0,0 +1,236 @@
1
+ # Core Workflows
2
+
3
+ ## Consumer Setup Flow
4
+
5
+ Setting up Beddel in a Next.js application:
6
+
7
+ ### 1. Install Package
8
+
9
+ ```bash
10
+ npm install beddel
11
+ # or
12
+ pnpm add beddel
13
+ ```
14
+
15
+ ### 2. Create API Route
16
+
17
+ ```typescript
18
+ // app/api/beddel/chat/route.ts
19
+ import { createBeddelHandler } from 'beddel/server';
20
+
21
+ export const POST = createBeddelHandler({
22
+ agentsPath: 'src/agents' // Optional, default: 'src/agents'
23
+ });
24
+ ```
25
+
26
+ ### 3. Create YAML Agent
27
+
28
+ ```yaml
29
+ # src/agents/assistant.yaml
30
+ metadata:
31
+ name: "Streaming Assistant"
32
+ version: "1.0.0"
33
+
34
+ workflow:
35
+ - id: "chat-interaction"
36
+ type: "llm"
37
+ config:
38
+ model: "gemini-2.0-flash-exp"
39
+ stream: true
40
+ system: "You are a helpful and concise assistant."
41
+ messages: "$input.messages"
42
+ ```
43
+
44
+ ### 4. (Optional) Register Custom Extensions
45
+
46
+ ```typescript
47
+ // app/api/beddel/chat/route.ts
48
+ import { createBeddelHandler } from 'beddel/server';
49
+ import { registerTool, registerCallback } from 'beddel';
50
+ import { z } from 'zod';
51
+
52
+ // Register custom tool
53
+ registerTool('myTool', {
54
+ description: 'My custom tool',
55
+ parameters: z.object({ input: z.string() }),
56
+ execute: async ({ input }) => ({ result: input.toUpperCase() }),
57
+ });
58
+
59
+ // Register lifecycle callback
60
+ registerCallback('saveConversation', async ({ text, usage }) => {
61
+ await db.saveMessage(text, usage);
62
+ });
63
+
64
+ export const POST = createBeddelHandler();
65
+ ```
66
+
67
+ ---
68
+
69
+ ## YAML Structure
70
+
71
+ YAML files define a **Pipeline** of sequential steps:
72
+
73
+ ```yaml
74
+ metadata:
75
+ name: "Agent Name"
76
+ version: "1.0.0"
77
+
78
+ workflow:
79
+ - id: "step-1"
80
+ type: "llm" # Primitive type
81
+ config:
82
+ model: "gemini-2.0-flash-exp"
83
+ stream: true # true = streaming, false = blocking
84
+ system: "System prompt"
85
+ messages: "$input.messages"
86
+ tools: # Optional: tools for function calling
87
+ - name: "calculator"
88
+ onFinish: "callbackName" # Optional: lifecycle hook
89
+ result: "stepOutput" # Optional: variable name for result
90
+
91
+ - id: "step-2"
92
+ type: "output-generator"
93
+ config:
94
+ template:
95
+ status: "completed"
96
+ tokens: "$stepOutput.usage"
97
+ ```
98
+
99
+ ### Variable Resolution Patterns
100
+
101
+ | Pattern | Description | Example |
102
+ |---------|-------------|---------|
103
+ | `$input.*` | Access request input data | `$input.messages` |
104
+ | `$stepResult.varName.*` | Access step result by result name | `$stepResult.llmOutput.text` |
105
+ | `$varName.*` | Legacy: direct variable access | `$llmOutput.usage` |
106
+
107
+ ---
108
+
109
+ ## Streaming Chat Flow
110
+
111
+ ```mermaid
112
+ sequenceDiagram
113
+ participant Client as Client (useChat)
114
+ participant API as POST /api/beddel/chat
115
+ participant Loader as YAML Loader
116
+ participant Executor as WorkflowExecutor
117
+ participant LLM as llmPrimitive
118
+ participant SDK as Vercel AI SDK
119
+
120
+ Client->>API: { agentId, messages: UIMessage[] }
121
+ API->>Loader: loadYaml(src/agents/{agentId}.yaml)
122
+ Loader-->>API: ParsedYaml
123
+ API->>Executor: new WorkflowExecutor(yaml)
124
+ API->>Executor: execute({ messages })
125
+
126
+ loop For each step in workflow
127
+ Executor->>Executor: Get handler from registry
128
+ Executor->>LLM: handler(config, context)
129
+
130
+ alt stream: true
131
+ LLM->>LLM: convertToModelMessages(UIMessage[])
132
+ LLM->>SDK: streamText({ messages: ModelMessage[] })
133
+ SDK-->>LLM: StreamResult
134
+ LLM->>LLM: result.toUIMessageStreamResponse()
135
+ LLM-->>Executor: Response (stream)
136
+ Note over Executor: Break loop immediately
137
+ Executor-->>API: Response
138
+ API-->>Client: UI Message Stream
139
+ else stream: false
140
+ LLM->>LLM: convertToModelMessages(UIMessage[])
141
+ LLM->>SDK: generateText({ messages: ModelMessage[] })
142
+ SDK-->>LLM: TextResult
143
+ LLM-->>Executor: { text, usage }
144
+ Executor->>Executor: Store in context.variables
145
+ end
146
+ end
147
+ ```
148
+
149
+ ### AI SDK v6 Message Format
150
+
151
+ The LLM primitive handles message format conversion automatically:
152
+
153
+ | Source | Format | Example |
154
+ |--------|--------|---------|
155
+ | Frontend (`useChat`) | `UIMessage[]` | `{ role: "user", parts: [{ type: "text", text: "Hello" }] }` |
156
+ | Backend (`streamText`) | `ModelMessage[]` | `{ role: "user", content: "Hello" }` |
157
+
158
+ - `convertToModelMessages()` converts `UIMessage[]` → `ModelMessage[]`
159
+ - `toUIMessageStreamResponse()` returns the correct stream format for `useChat`
160
+
161
+ ## Tool Loop Flow
162
+
163
+ When tools are defined, the LLM may invoke them in a multi-step loop:
164
+
165
+ ```mermaid
166
+ sequenceDiagram
167
+ participant LLM as llmPrimitive
168
+ participant SDK as streamText
169
+ participant Tools as Tool Registry
170
+ participant Calc as calculator
171
+
172
+ LLM->>SDK: streamText({ stopWhen: stepCountIs(5), tools })
173
+
174
+ loop Until stopWhen condition met
175
+ SDK->>SDK: LLM generates response
176
+
177
+ alt Tool call requested
178
+ SDK->>Tools: Lookup tool by name
179
+ Tools->>Calc: execute({ expression })
180
+ Calc-->>SDK: { result }
181
+ SDK->>SDK: Continue with tool result
182
+ else No tool call
183
+ Note over SDK: Break loop
184
+ end
185
+ end
186
+
187
+ SDK-->>LLM: Final StreamResult
188
+ ```
189
+
190
+ ## Variable Resolution Flow
191
+
192
+ How variables like `$input.messages` are resolved:
193
+
194
+ ```mermaid
195
+ sequenceDiagram
196
+ participant Config as Step Config
197
+ participant Resolver as Variable Resolver
198
+ participant Context as ExecutionContext
199
+
200
+ Config->>Resolver: "$input.messages"
201
+ Resolver->>Context: context.input.messages
202
+ Context-->>Resolver: Message[]
203
+ Resolver-->>Config: Resolved value
204
+
205
+ Config->>Resolver: "$llmOutput.text"
206
+ Resolver->>Context: context.variables.get("llmOutput").text
207
+ Context-->>Resolver: "Hello!"
208
+ Resolver-->>Config: Resolved value
209
+ ```
210
+
211
+ ## onFinish Lifecycle Hook Flow
212
+
213
+ How `onFinish` executes after streaming completes (Option B: direct callbacks):
214
+
215
+ ```mermaid
216
+ sequenceDiagram
217
+ participant LLM as llmPrimitive
218
+ participant SDK as streamText
219
+ participant Registry as callbackRegistry
220
+ participant Callback as persistConversation
221
+
222
+ LLM->>SDK: streamText({ onFinish, onError })
223
+ SDK->>SDK: Stream tokens to client
224
+
225
+ Note over SDK: Stream completes
226
+
227
+ SDK->>LLM: onFinish({ text, usage, totalUsage, steps })
228
+ LLM->>LLM: config.onFinish = "persistConversation"
229
+ LLM->>Registry: callbackRegistry["persistConversation"]
230
+ Registry-->>LLM: callback function
231
+ LLM->>Callback: callback({ text, usage, totalUsage, steps })
232
+ Callback->>Callback: Save to database
233
+ Callback-->>LLM: Done
234
+
235
+ Note over LLM: Response already sent to client
236
+ ```
@@ -0,0 +1,76 @@
1
+ # High Level Architecture
2
+
3
+ ## Technical Summary
4
+
5
+ Beddel Protocol is a **Sequential Pipeline Executor** that parses YAML workflow definitions and executes steps sequentially. The architecture prioritizes streaming-first LLM responses, secure configuration parsing, and an extensible primitive system. Core patterns include the Expansion Pack Pattern for primitive registration and the early-return pattern for streaming responses.
6
+
7
+ ### Pipeline Pattern Definition
8
+
9
+ Unlike traditional "agent wrappers", Beddel is a **declarative pipeline executor**:
10
+
11
+ | Concept | Definition |
12
+ |---------|------------|
13
+ | **Workflow** | A linear list of steps defined in YAML |
14
+ | **Agent** | Just one step type (`llm`) within the workflow |
15
+ | **Streaming** | Native `streamText` support, returns `Response` immediately |
16
+ | **Primitive** | A handler function for a step type (llm, output-generator, call-agent) |
17
+
18
+ ---
19
+
20
+ ## High Level Overview
21
+
22
+ 1. **Architectural Style:** Sequential Pipeline (not microservices)
23
+ 2. **Repository Structure:** Monorepo package (`packages/beddel/`)
24
+ 3. **Service Architecture:** Stateless executor with no external database dependencies
25
+ 4. **Primary Data Flow:**
26
+ - Client sends `{ agentId, messages }` to REST endpoint
27
+ - `createBeddelHandler` loads YAML via `loadYaml`
28
+ - `WorkflowExecutor` iterates over workflow steps
29
+ - First step returning a `Response` breaks the loop and returns to client
30
+ 5. **Key Decision:** REST-only API (no GraphQL) for streaming compatibility
31
+
32
+ ---
33
+
34
+ ## High Level Project Diagram
35
+
36
+ ```mermaid
37
+ graph TD
38
+ Client["Client (useChat/fetch)"] --> API["POST /api/beddel/chat"]
39
+ API --> Handler["createBeddelHandler"]
40
+ Handler --> Loader["YAML Loader (FAILSAFE)"]
41
+ Loader --> Executor["WorkflowExecutor"]
42
+ Executor --> LLM["llm Primitive"]
43
+ Executor --> Output["output-generator Primitive"]
44
+ Executor --> CallAgent["call-agent (placeholder)"]
45
+ LLM --> SDK["Vercel AI SDK (streamText/generateText)"]
46
+ SDK --> Provider["@ai-sdk/google (Gemini)"]
47
+ LLM --> Tools["Tool Registry"]
48
+
49
+ subgraph "Expansion Pack Pattern"
50
+ PrimitiveRegistry["handlerRegistry"]
51
+ ToolRegistry["toolRegistry"]
52
+ CallbackRegistry["callbackRegistry"]
53
+ end
54
+
55
+ Executor --> PrimitiveRegistry
56
+ LLM --> ToolRegistry
57
+ LLM --> CallbackRegistry
58
+ ```
59
+
60
+ ---
61
+
62
+ ## Architectural and Design Patterns
63
+
64
+ - **Sequential Pipeline Pattern:** Workflow steps execute in order; first `Response` return breaks the loop — *Rationale:* Enables streaming without blocking subsequent steps
65
+
66
+ - **Expansion Pack Pattern:** Primitives, tools, and callbacks are registered in extensible maps — *Rationale:* Inspired by BMAD-METHOD™, allows community extensions without core changes
67
+ - `registerPrimitive(type, handler)` — Add custom step types
68
+ - `registerTool(name, impl)` — Add custom LLM tools
69
+ - `registerCallback(name, fn)` — Add lifecycle hooks
70
+
71
+ - **Early Return Pattern:** When `llmPrimitive` returns `Response`, executor immediately returns to client — *Rationale:* Prevents buffering of streaming responses
72
+
73
+ - **Registry Pattern:** Primitives, tools, and callbacks use lookup maps — *Rationale:* Decouples YAML definitions from implementation details
74
+
75
+ - **Bundle Separation Pattern:** Three entry points (`beddel`, `beddel/server`, `beddel/client`) — *Rationale:* Prevents Node.js dependencies from leaking into client bundles
76
+
@@ -0,0 +1,31 @@
1
+ # Beddel Protocol - Architecture Document
2
+
3
+ > **Version:** 1.0.0
4
+ > **Scope:** Streaming Pipeline Edition — Core architecture for declarative workflow execution
5
+
6
+ ---
7
+
8
+ ## Sections
9
+
10
+ - [High Level Architecture](./high-level-architecture.md)
11
+ - [Tech Stack](./tech-stack.md)
12
+ - [Components](./components.md)
13
+ - [Source Tree](./source-tree.md)
14
+ - [Core Workflows](./core-workflows.md)
15
+ - [API Reference](./api-reference.md)
16
+
17
+ ---
18
+
19
+ ## Introduction
20
+
21
+ This document outlines the architecture for **Beddel Protocol**, a declarative agent execution engine built on Vercel AI SDK Core. Its primary goal is to serve as the guiding architectural blueprint for AI-driven development.
22
+
23
+ **Starter Template:** N/A — This is a new package, not based on an existing template.
24
+
25
+ ---
26
+
27
+ ## Change Log
28
+
29
+ | Date | Version | Description | Author |
30
+ |------------|---------|-------------------------------------|--------|
31
+ | 2024-12-23 | 1.0.0 | Initial Architecture for Beddel Protocol | BMad Master |
@@ -0,0 +1,92 @@
1
+ # Source Tree
2
+
3
+ ```
4
+ packages/beddel/
5
+ ├── src/
6
+ │ ├── index.ts # Main server exports (Node.js deps)
7
+ │ ├── server.ts # Server handler barrel export
8
+ │ ├── client.ts # Client exports (types only, browser-safe)
9
+ │ ├── core/
10
+ │ │ ├── parser.ts # YAML parsing (FAILSAFE_SCHEMA)
11
+ │ │ ├── workflow.ts # WorkflowExecutor class
12
+ │ │ └── variable-resolver.ts # $variable.path resolution
13
+ │ ├── primitives/
14
+ │ │ ├── index.ts # Handler registry (handlerRegistry)
15
+ │ │ ├── llm.ts # streamText/generateText wrapper
16
+ │ │ └── output.ts # JSON transform primitive
17
+ │ ├── server/
18
+ │ │ └── handler.ts # createBeddelHandler factory
19
+ │ ├── tools/
20
+ │ │ └── index.ts # Tool registry (calculator, getCurrentTime)
21
+ │ └── types/
22
+ │ └── index.ts # Type definitions (PrimitiveHandler, ExecutionContext, etc.)
23
+ ├── examples/
24
+ │ └── agents/
25
+ │ └── assistant.yaml # Sample streaming assistant agent
26
+ ├── docs/
27
+ │ ├── prd/ # Sharded PRD documents
28
+ │ │ ├── index.md
29
+ │ │ ├── goals-context.md
30
+ │ │ ├── requirements.md
31
+ │ │ ├── technical-assumptions.md
32
+ │ │ └── epic-list.md
33
+ │ └── architecture/ # Sharded Architecture documents
34
+ │ ├── index.md
35
+ │ ├── high-level-architecture.md
36
+ │ ├── tech-stack.md
37
+ │ ├── components.md
38
+ │ ├── source-tree.md
39
+ │ ├── core-workflows.md
40
+ │ └── api-reference.md
41
+ ├── package.json
42
+ └── tsconfig.json
43
+ ```
44
+
45
+ ---
46
+
47
+ ## Bundle Separation
48
+
49
+ Beddel exports three distinct bundles to support different runtime environments:
50
+
51
+ | Import Path | Entry File | Contents | Use Case |
52
+ |-------------|------------|----------|----------|
53
+ | `beddel` | `index.ts` | Full API: `loadYaml`, `WorkflowExecutor`, `handlerRegistry`, `toolRegistry`, `registerPrimitive`, `registerTool` | Internal Beddel usage, custom handlers |
54
+ | `beddel/server` | `server.ts` | `createBeddelHandler`, `BeddelHandlerOptions` | Next.js API Routes (Consumer) |
55
+ | `beddel/client` | `client.ts` | Types only: `ParsedYaml`, `ExecutionContext`, `PrimitiveHandler`, etc. | Client Components, type-checking |
56
+
57
+ > [!IMPORTANT]
58
+ > The `beddel` and `beddel/server` entry points use Node.js APIs (`fs/promises`).
59
+ > **Never import these in client/browser code.** Use `beddel/client` for type imports.
60
+
61
+ ---
62
+
63
+ ## package.json exports
64
+
65
+ ```json
66
+ {
67
+ "exports": {
68
+ ".": {
69
+ "import": "./dist/index.js",
70
+ "types": "./dist/index.d.ts"
71
+ },
72
+ "./server": {
73
+ "import": "./dist/server.js",
74
+ "types": "./dist/server.d.ts"
75
+ },
76
+ "./client": {
77
+ "import": "./dist/client.js",
78
+ "types": "./dist/client.d.ts"
79
+ }
80
+ }
81
+ }
82
+ ```
83
+
84
+ ---
85
+
86
+ ## Notes
87
+
88
+ - **Consumer application** places YAML agents in `src/agents/` (configurable via `agentsPath`)
89
+ - **API route** lives in `app/api/beddel/chat/route.ts` using `createBeddelHandler`
90
+ - **`call-agent` primitive** is registered as a placeholder — implementation coming soon
91
+ - **No test folder shown** — tests should be co-located or in `__tests__/` per project preference
92
+
@@ -0,0 +1,25 @@
1
+ # Tech Stack
2
+
3
+ ## Technology Stack Table
4
+
5
+ | Category | Technology | Version | Purpose | Rationale |
6
+ |----------------|----------------------|---------|--------------------------------------|----------------------------------------------|
7
+ | **Language** | TypeScript | 5.x | Primary development language | Strict typing, excellent tooling |
8
+ | **Runtime** | Node.js / Edge | 20+ | JavaScript runtime | Next.js App Router Edge compatibility |
9
+ | **AI Core** | `ai` | 6.x | Vercel AI SDK Core | Native `streamText`/`generateText` support |
10
+ | **AI Provider**| `@ai-sdk/google` | 3.x | Google Gemini integration | Default LLM provider (requires v3+ for AI SDK 6.x) |
11
+ | **Validation** | `zod` | 3.x | Schema validation for tools | Type-safe runtime validation |
12
+ | **YAML Parser**| `js-yaml` | 4.x | Secure YAML parsing | FAILSAFE_SCHEMA prevents code execution |
13
+ | **Framework** | Next.js App Router | 14+ | API route hosting | Required by consumers, not bundled |
14
+
15
+ ## Cloud Infrastructure
16
+
17
+ - **Provider:** N/A — Beddel is a library, not a deployed service
18
+ - **Key Services:** Consumer's responsibility
19
+ - **Deployment Regions:** Consumer's responsibility
20
+
21
+ ## Notes
22
+
23
+ - Beddel Protocol is a **package**, not a standalone application
24
+ - Next.js dependency is for consumers, not bundled in the package
25
+ - The package exposes TypeScript modules for consumption in Edge or Node.js environments
@@ -0,0 +1,101 @@
1
+ # Epic List
2
+
3
+ ## Epic 1: Foundation & Core
4
+
5
+ Establish project structure, secure YAML parsing, and the core `WorkflowExecutor` that drives all pipeline execution.
6
+
7
+ ### Story 1.1: Clean Setup
8
+
9
+ As a developer, I want a properly configured TypeScript package, so that I can build with strict type safety.
10
+
11
+ **Acceptance Criteria:**
12
+ 1. Package includes: `ai`, `@ai-sdk/google`, `zod`, `js-yaml`
13
+ 2. `tsconfig.json` configured with strict mode
14
+ 3. No GraphQL dependencies in the package
15
+
16
+ ### Story 1.2: Secure Parser
17
+
18
+ As a security-conscious developer, I want YAML parsing that prevents code execution, so that user-defined configurations are safe.
19
+
20
+ **Acceptance Criteria:**
21
+ 1. `loadYaml` function uses `FAILSAFE_SCHEMA` from js-yaml
22
+ 2. Functions and class instances are rejected by the parser
23
+ 3. Parser returns typed `ParsedYaml` object
24
+
25
+ ### Story 1.3: Workflow Executor
26
+
27
+ As a workflow author, I want steps to execute sequentially, so that I can compose complex pipelines.
28
+
29
+ **Acceptance Criteria:**
30
+ 1. `WorkflowExecutor` iterates over `yaml.workflow` steps
31
+ 2. If a handler returns a `Response` instance, execution stops and returns immediately
32
+ 3. Step results are stored in `context.variables` for use by subsequent steps
33
+
34
+ ---
35
+
36
+ ## Epic 2: Primitive Handlers
37
+
38
+ Implement the three core primitives that power the pipeline: `llm`, `output-generator`, and `call-agent`.
39
+
40
+ ### Story 2.1: Handler & Tool Registries
41
+
42
+ As a package author, I want extensible registries for primitives and tools, so that the system supports the Expansion Pack Pattern.
43
+
44
+ **Acceptance Criteria:**
45
+ 1. `primitiveRegistry: Record<string, PrimitiveHandler>` exists in `src/primitives/index.ts`
46
+ 2. `toolRegistry: Record<string, ToolImplementation>` exists in `src/tools/index.ts`
47
+ 3. MVP includes `calculator` and `getCurrentTime` sample tools
48
+
49
+ ### Story 2.2: LLM Primitive
50
+
51
+ As a workflow author, I want to call LLMs from YAML steps, so that I can define AI behavior declaratively.
52
+
53
+ **Acceptance Criteria:**
54
+ 1. `stream: true` uses `streamText` and returns `result.toUIMessageStreamResponse()`
55
+ 2. `stream: false` uses `generateText` and returns JSON object
56
+ 3. `config.tools` maps to Vercel AI SDK `tools` via `mapTools()` function
57
+ 4. `stopWhen: stepCountIs(5)` is set when tools are present (enabling tool loops)
58
+ 5. Uses `convertToModelMessages()` for `UIMessage[]` → `ModelMessage[]` conversion (AI SDK v6)
59
+
60
+ ### Story 2.3: Output Primitive
61
+
62
+ As a workflow author, I want to transform variables into structured output, so that I can format responses without LLM calls.
63
+
64
+ **Acceptance Criteria:**
65
+ 1. Variable resolution supports `$input.*` and `$stepResult.*` syntax
66
+ 2. Template is a pure JSON transform (no LLM invocation)
67
+ 3. Returns the transformed object for next step consumption
68
+
69
+ ### Story 2.4: Lifecycle Hooks
70
+
71
+ As a workflow author, I want callbacks to execute after streaming completes, so that I can persist conversations and log usage.
72
+
73
+ **Acceptance Criteria:**
74
+ 1. `onFinish` callback executes after stream completes with `{ text, usage, totalUsage, steps }` payload
75
+ 2. `onError` callback executes when stream errors with `{ error }` payload
76
+ 3. Callbacks are registered via `callbackRegistry: Record<string, CallbackFn>`
77
+ 4. YAML references callback by name string (e.g., `onFinish: "persistConversation"`)
78
+
79
+ ---
80
+
81
+ ## Epic 3: API & Integration
82
+
83
+ Expose the workflow engine via a REST endpoint and provide a sample agent for testing.
84
+
85
+ ### Story 3.1: API Route
86
+
87
+ As a frontend developer, I want a REST endpoint for chat, so that I can use `useChat` or standard fetch calls.
88
+
89
+ **Acceptance Criteria:**
90
+ 1. `POST /api/beddel/chat` accepts `{ agentId, messages }`
91
+ 2. Loads YAML from `src/agents/{agentId}.yaml`
92
+ 3. Returns streaming `Response` or JSON based on workflow output
93
+
94
+ ### Story 3.2: Sample Assistant
95
+
96
+ As a developer onboarding to Beddel, I want a working example agent, so that I can understand the YAML structure.
97
+
98
+ **Acceptance Criteria:**
99
+ 1. `src/agents/assistant.yaml` is provided with streaming enabled
100
+ 2. Includes at least one tool definition (`calculator`)
101
+ 3. curl command successfully receives streamed response
@@ -0,0 +1,23 @@
1
+ # Goals and Background Context
2
+
3
+ ## Goals
4
+
5
+ - Provide a **declarative agent execution engine** built on Vercel AI SDK Core
6
+ - Enable **native streaming** for real-time chat responses at the Edge
7
+ - Allow developers to define agent workflows via **YAML configurations** instead of hardcoded logic
8
+ - Establish an **extensible primitive system** following the Expansion Pack Pattern
9
+ - Deliver a **lean, secure parser** that prevents arbitrary code execution
10
+
11
+ ## Background Context
12
+
13
+ Beddel Protocol represents a fundamental shift in architecture: from an "agent wrapper" approach to a **Sequential Pipeline Executor**. This redesign addresses the need for streaming-first chat interactions while maintaining the declarative configuration philosophy that makes Beddel accessible to developers.
14
+
15
+ The core problem being solved is the latency in LLM-powered applications where responses are delivered only after full processing. By leveraging Vercel AI SDK's `streamText` capability, Beddel Protocol enables instant, token-by-token response delivery.
16
+
17
+ ### Key Concepts
18
+
19
+ | Concept | Definition |
20
+ |--------------|-----------------------------------------------|
21
+ | **Workflow** | A linear list of steps executed sequentially |
22
+ | **Agent** | Just one step type (`llm`) within the workflow |
23
+ | **Streaming**| Native `streamText` support at the Edge |
@@ -0,0 +1,21 @@
1
+ # Beddel Protocol - Product Requirements Document (PRD)
2
+
3
+ > **Version:** 1.0.0
4
+ > **Scope:** Streaming Pipeline Edition — First release of the package
5
+
6
+ ---
7
+
8
+ ## Sections
9
+
10
+ - [Goals and Background Context](./goals-context.md)
11
+ - [Requirements](./requirements.md)
12
+ - [Technical Assumptions](./technical-assumptions.md)
13
+ - [Epic List](./epic-list.md)
14
+
15
+ ---
16
+
17
+ ## Change Log
18
+
19
+ | Date | Version | Description | Author |
20
+ |------------|---------|--------------------------|--------|
21
+ | 2024-12-23 | 1.0.0 | Initial PRD for Beddel Protocol | BMad Master |
@@ -0,0 +1,25 @@
1
+ # Requirements
2
+
3
+ ## Functional Requirements
4
+
5
+ - **FR1:** The system MUST parse YAML workflow definitions using a secure schema (FAILSAFE_SCHEMA)
6
+ - **FR2:** The system MUST execute workflow steps sequentially via `WorkflowExecutor`
7
+ - **FR3:** The `llm` primitive MUST support dual-mode operation:
8
+ - `stream: true` → returns `Response` from `streamText`
9
+ - `stream: false` → returns JSON object from `generateText`
10
+ - **FR4:** The executor MUST immediately return a `Response` when a primitive returns a stream
11
+ - **FR5:** The system MUST resolve variables using `$input.*` and `$stepResult.*` syntax
12
+ - **FR6:** The `output-generator` primitive MUST perform deterministic JSON transformation without LLM calls
13
+ - **FR7:** The `call-agent` primitive MUST allow recursive invocation of other YAML workflow files
14
+ - **FR8:** The system MUST expose a REST endpoint (`POST /api/beddel/chat`) for chat interactions
15
+ - **FR9:** The system MUST support tool definitions in YAML with automatic mapping to Vercel AI SDK `tools` object
16
+ - **FR10:** The tool registry MUST contain sample implementations: `calculator`, `getCurrentTime`
17
+ - **FR11:** The `llmPrimitive` MUST support `onFinish` and `onError` callbacks for post-stream logic
18
+
19
+ ## Non-Functional Requirements
20
+
21
+ - **NFR1:** YAML parser MUST use `FAILSAFE_SCHEMA` to prevent function instantiation
22
+ - **NFR2:** Tool parameters MUST be validated using Zod schemas
23
+ - **NFR3:** The package MUST be compatible with Edge runtime (Next.js App Router)
24
+ - **NFR4:** Streaming responses MUST follow Vercel AI SDK Data Stream protocol
25
+ - **NFR5:** Configuration MUST be strict TypeScript (`tsconfig.json` strict mode)
@@ -0,0 +1,35 @@
1
+ # Technical Assumptions
2
+
3
+ ## Repository Structure
4
+
5
+ - **Structure:** Monorepo package (`packages/beddel/`)
6
+ - **Package Manager:** npm or pnpm (workspace-compatible)
7
+
8
+ ## Service Architecture
9
+
10
+ - **Pattern:** Sequential Pipeline Executor (not microservices)
11
+ - **Runtime:** Node.js / Edge (Next.js App Router)
12
+ - **No GraphQL for chat:** REST-only for streaming compatibility
13
+
14
+ ## Technology Stack
15
+
16
+ | Category | Technology | Purpose |
17
+ |--------------|---------------------|--------------------------------------|
18
+ | AI Core | `ai` (6.x) | Vercel AI SDK Core for LLM calls |
19
+ | AI Provider | `@ai-sdk/google` | Google Gemini integration |
20
+ | Validation | `zod` | Schema validation for tools |
21
+ | YAML Parser | `js-yaml` | Secure YAML parsing (FAILSAFE) |
22
+ | Runtime | Next.js App Router | Edge-compatible API routes |
23
+
24
+ ## Testing Requirements
25
+
26
+ - **Unit Tests:** Required for core modules (parser, workflow, primitives)
27
+ - **Integration Tests:** Required for API route with mock LLM responses
28
+ - **Manual Verification:** curl command to test streaming responses
29
+
30
+ ## Additional Technical Assumptions
31
+
32
+ - Environment variable `GEMINI_API_KEY` is required for LLM calls
33
+ - TypeScript strict mode is mandatory
34
+ - No database dependencies (stateless execution)
35
+ - Tool implementations are synchronous or return Promises