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,72 @@
1
+ /**
2
+ * Beddel Protocol - Primitive Handler Registry
3
+ *
4
+ * This registry maps step types to their handler implementations.
5
+ * Following Expansion Pack Pattern from BMAD-METHOD™ for extensibility.
6
+ * See: https://github.com/bmadcode/bmad-method
7
+ *
8
+ * Server-only: Handlers may use Node.js APIs and external services.
9
+ */
10
+ import { llmPrimitive } from './llm';
11
+ import { outputPrimitive } from './output';
12
+ // Re-export llm exports for consumer access
13
+ export { llmPrimitive, registerCallback, callbackRegistry } from './llm';
14
+ /**
15
+ * Placeholder handler for primitives not yet implemented.
16
+ * Returns config and context for debugging purposes.
17
+ */
18
+ const placeholderHandler = async (config, context) => {
19
+ console.warn('[Beddel] Placeholder handler invoked. Implement the actual primitive.');
20
+ return {
21
+ _placeholder: true,
22
+ config,
23
+ input: context.input,
24
+ variableCount: context.variables.size,
25
+ };
26
+ };
27
+ /**
28
+ * Registry of primitive handlers keyed by step type.
29
+ *
30
+ * MVP Primitives:
31
+ * - 'llm': Wrapper for streamText/generateText (Task 2.2)
32
+ * - 'output-generator': Deterministic variable mapping (Task 2.3)
33
+ * - 'call-agent': Sub-agent invocation (future)
34
+ */
35
+ export const handlerRegistry = {
36
+ /**
37
+ * LLM Primitive - Dual-mode AI text generation.
38
+ * Supports streaming (streamText) and blocking (generateText) modes.
39
+ */
40
+ 'llm': llmPrimitive,
41
+ /**
42
+ * Output Generator Primitive - Deterministic JSON transform.
43
+ * Resolves variable references in templates.
44
+ */
45
+ 'output-generator': outputPrimitive,
46
+ /**
47
+ * Call Agent Primitive - Placeholder
48
+ * Enables recursive workflow execution via sub-agents.
49
+ */
50
+ 'call-agent': placeholderHandler,
51
+ };
52
+ /**
53
+ * Register a custom primitive handler in the registry.
54
+ * Allows consumers to extend Beddel with domain-specific primitives.
55
+ *
56
+ * @param type - Step type identifier (e.g., 'my-custom-primitive')
57
+ * @param handler - PrimitiveHandler function
58
+ *
59
+ * @example
60
+ * import { registerPrimitive } from 'beddel';
61
+ *
62
+ * registerPrimitive('http-fetch', async (config, context) => {
63
+ * const response = await fetch(config.url);
64
+ * return { data: await response.json() };
65
+ * });
66
+ */
67
+ export function registerPrimitive(type, handler) {
68
+ if (handlerRegistry[type]) {
69
+ console.warn(`[Beddel] Primitive '${type}' already registered, overwriting.`);
70
+ }
71
+ handlerRegistry[type] = handler;
72
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Beddel Protocol - LLM Primitive
3
+ *
4
+ * Core primitive for AI text generation with dual-mode support:
5
+ * - Stream Mode: Uses streamText → returns Response via toUIMessageStreamResponse()
6
+ * - Block Mode: Uses generateText → returns JSON object { text, usage }
7
+ *
8
+ * Supports tools via mapTools() which bridges YAML definitions to Vercel AI SDK tools.
9
+ * Requires GEMINI_API_KEY environment variable.
10
+ *
11
+ * Server-only: Uses Vercel AI SDK Core which requires Node.js.
12
+ *
13
+ * AI SDK v6 Compatibility:
14
+ * - Frontend (useChat) sends UIMessage[] with { parts: [...] } format
15
+ * - Backend (streamText/generateText) expects ModelMessage[] with { content: ... }
16
+ * - convertToModelMessages() bridges this gap automatically
17
+ */
18
+ import type { PrimitiveHandler } from '../types';
19
+ /**
20
+ * Callback function type for lifecycle hooks (onFinish, onError).
21
+ */
22
+ export type CallbackFn = (payload: Record<string, unknown>) => void | Promise<void>;
23
+ /**
24
+ * Registry for consumer-registered callbacks.
25
+ * Populated by the application using Beddel.
26
+ */
27
+ export declare const callbackRegistry: Record<string, CallbackFn>;
28
+ /**
29
+ * Register a callback function for lifecycle hooks.
30
+ *
31
+ * @param name - Unique identifier for the callback
32
+ * @param callback - Function to execute when hook is triggered
33
+ *
34
+ * @example
35
+ * registerCallback('persistConversation', async ({ text, usage }) => {
36
+ * await db.saveMessage(text, usage);
37
+ * });
38
+ */
39
+ export declare function registerCallback(name: string, callback: CallbackFn): void;
40
+ /**
41
+ * LLM Primitive Handler
42
+ *
43
+ * Dual-mode support via config.stream:
44
+ * - stream: true → Uses streamText → returns result.toUIMessageStreamResponse()
45
+ * - stream: false → Uses generateText → returns { text, usage }
46
+ *
47
+ * When tools are present, stopWhen is set to stepCountIs(5) to enable tool loops.
48
+ *
49
+ * AI SDK v6: Converts UIMessage[] (from useChat) to ModelMessage[] automatically.
50
+ *
51
+ * @param config - Step configuration from YAML (model, stream, system, messages, tools)
52
+ * @param context - Execution context with input and variables
53
+ * @returns Response (streaming) or Record (blocking mode)
54
+ */
55
+ export declare const llmPrimitive: PrimitiveHandler;
56
+ //# sourceMappingURL=llm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"llm.d.ts","sourceRoot":"","sources":["../../src/primitives/llm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAaH,OAAO,KAAK,EAAgC,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAI/E;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEpF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAM,CAAC;AAE/D;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,GAAG,IAAI,CAKzE;AA0DD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,YAAY,EAAE,gBA4E1B,CAAC"}
@@ -0,0 +1,156 @@
1
+ /**
2
+ * Beddel Protocol - LLM Primitive
3
+ *
4
+ * Core primitive for AI text generation with dual-mode support:
5
+ * - Stream Mode: Uses streamText → returns Response via toUIMessageStreamResponse()
6
+ * - Block Mode: Uses generateText → returns JSON object { text, usage }
7
+ *
8
+ * Supports tools via mapTools() which bridges YAML definitions to Vercel AI SDK tools.
9
+ * Requires GEMINI_API_KEY environment variable.
10
+ *
11
+ * Server-only: Uses Vercel AI SDK Core which requires Node.js.
12
+ *
13
+ * AI SDK v6 Compatibility:
14
+ * - Frontend (useChat) sends UIMessage[] with { parts: [...] } format
15
+ * - Backend (streamText/generateText) expects ModelMessage[] with { content: ... }
16
+ * - convertToModelMessages() bridges this gap automatically
17
+ */
18
+ import { streamText, generateText, dynamicTool, stepCountIs, convertToModelMessages, } from 'ai';
19
+ import { createGoogleGenerativeAI } from '@ai-sdk/google';
20
+ import { toolRegistry } from '../tools';
21
+ import { resolveVariables } from '../core/variable-resolver';
22
+ /**
23
+ * Registry for consumer-registered callbacks.
24
+ * Populated by the application using Beddel.
25
+ */
26
+ export const callbackRegistry = {};
27
+ /**
28
+ * Register a callback function for lifecycle hooks.
29
+ *
30
+ * @param name - Unique identifier for the callback
31
+ * @param callback - Function to execute when hook is triggered
32
+ *
33
+ * @example
34
+ * registerCallback('persistConversation', async ({ text, usage }) => {
35
+ * await db.saveMessage(text, usage);
36
+ * });
37
+ */
38
+ export function registerCallback(name, callback) {
39
+ if (callbackRegistry[name]) {
40
+ console.warn(`[Beddel] Callback '${name}' already registered, overwriting.`);
41
+ }
42
+ callbackRegistry[name] = callback;
43
+ }
44
+ /**
45
+ * Maps YAML tool definitions to Vercel AI SDK tool objects.
46
+ *
47
+ * YAML defines intent (name, optional description override).
48
+ * Registry provides implementation (parameters, execute).
49
+ * Uses dynamicTool for flexible type support with unknown input/output types.
50
+ *
51
+ * @param toolDefinitions - Array of tool definitions from YAML config
52
+ * @returns Record of Vercel AI SDK tools (ToolSet)
53
+ */
54
+ function mapTools(toolDefinitions) {
55
+ const tools = {};
56
+ for (const def of toolDefinitions) {
57
+ const impl = toolRegistry[def.name];
58
+ if (!impl) {
59
+ console.warn(`[Beddel] Tool '${def.name}' not found in registry, skipping.`);
60
+ continue;
61
+ }
62
+ // Use dynamicTool for flexible type handling with registry-defined tools
63
+ tools[def.name] = dynamicTool({
64
+ description: def.description || impl.description, // YAML can override
65
+ inputSchema: impl.parameters,
66
+ execute: async (args) => {
67
+ return impl.execute(args);
68
+ },
69
+ });
70
+ }
71
+ return tools;
72
+ }
73
+ /**
74
+ * LLM Primitive Handler
75
+ *
76
+ * Dual-mode support via config.stream:
77
+ * - stream: true → Uses streamText → returns result.toUIMessageStreamResponse()
78
+ * - stream: false → Uses generateText → returns { text, usage }
79
+ *
80
+ * When tools are present, stopWhen is set to stepCountIs(5) to enable tool loops.
81
+ *
82
+ * AI SDK v6: Converts UIMessage[] (from useChat) to ModelMessage[] automatically.
83
+ *
84
+ * @param config - Step configuration from YAML (model, stream, system, messages, tools)
85
+ * @param context - Execution context with input and variables
86
+ * @returns Response (streaming) or Record (blocking mode)
87
+ */
88
+ export const llmPrimitive = async (config, context) => {
89
+ const llmConfig = config;
90
+ // Initialize Google Generative AI provider
91
+ const google = createGoogleGenerativeAI({
92
+ apiKey: process.env.GEMINI_API_KEY,
93
+ });
94
+ const model = google(llmConfig.model || 'gemini-1.5-flash');
95
+ // Resolve messages from context (e.g., $input.messages)
96
+ // AI SDK v6: Frontend sends UIMessage[], we convert to ModelMessage[]
97
+ const rawMessages = resolveVariables(llmConfig.messages, context);
98
+ const messages = await convertToModelMessages(rawMessages);
99
+ // Map YAML tools to Vercel AI SDK format
100
+ const hasTools = llmConfig.tools && llmConfig.tools.length > 0;
101
+ const tools = hasTools ? mapTools(llmConfig.tools) : undefined;
102
+ if (llmConfig.stream) {
103
+ // STREAMING MODE: Returns HTTP response directly
104
+ const result = streamText({
105
+ model,
106
+ messages,
107
+ system: llmConfig.system,
108
+ // Enable tool loop if tools exist (default is stepCountIs(1))
109
+ stopWhen: hasTools ? stepCountIs(5) : undefined,
110
+ tools,
111
+ // Lifecycle hooks (AI SDK v6 signature)
112
+ onFinish: async ({ text, finishReason, usage, totalUsage, steps, response }) => {
113
+ if (llmConfig.onFinish) {
114
+ const callback = callbackRegistry[llmConfig.onFinish];
115
+ if (callback) {
116
+ await callback({
117
+ text,
118
+ finishReason,
119
+ usage,
120
+ totalUsage,
121
+ steps,
122
+ response,
123
+ });
124
+ }
125
+ }
126
+ },
127
+ onError: ({ error }) => {
128
+ if (llmConfig.onError) {
129
+ const callback = callbackRegistry[llmConfig.onError];
130
+ if (callback) {
131
+ callback({ error });
132
+ }
133
+ }
134
+ console.error('[Beddel] Stream error:', error);
135
+ },
136
+ });
137
+ // Return streaming response - Executor will detect this and return to client immediately
138
+ // AI SDK v6: toUIMessageStreamResponse() for useChat compatibility
139
+ return result.toUIMessageStreamResponse();
140
+ }
141
+ else {
142
+ // BLOCKING MODE: Returns data for next workflow step
143
+ const result = await generateText({
144
+ model,
145
+ messages,
146
+ system: llmConfig.system,
147
+ // Enable tool loop if tools exist (default is stepCountIs(1))
148
+ stopWhen: hasTools ? stepCountIs(5) : undefined,
149
+ tools,
150
+ });
151
+ return {
152
+ text: result.text,
153
+ usage: result.usage,
154
+ };
155
+ }
156
+ };
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Beddel Protocol - Output Primitive
3
+ *
4
+ * Deterministic JSON transform primitive for the workflow engine.
5
+ * Resolves variable references in a template and returns the result.
6
+ *
7
+ * This is a pure transform - no LLM invocation.
8
+ *
9
+ * Server-only: Used within WorkflowExecutor during step execution.
10
+ */
11
+ import type { PrimitiveHandler } from '../types';
12
+ /**
13
+ * Output Primitive Handler
14
+ *
15
+ * Resolves all variable references in the template and returns
16
+ * the transformed object for consumption by subsequent steps.
17
+ *
18
+ * Supported patterns (via resolveVariables):
19
+ * - $input.* → context.input[path]
20
+ * - $stepResult.* → context.variables.get(stepName)[path]
21
+ * - $varName.* → context.variables.get(varName)[path] (legacy)
22
+ *
23
+ * @param config - Step configuration from YAML (must contain 'template')
24
+ * @param context - Execution context with input and variables
25
+ * @returns Resolved template as Record (never streams)
26
+ */
27
+ export declare const outputPrimitive: PrimitiveHandler;
28
+ //# sourceMappingURL=output.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/primitives/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAgC,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAmB/E;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,EAAE,gBAmB7B,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Beddel Protocol - Output Primitive
3
+ *
4
+ * Deterministic JSON transform primitive for the workflow engine.
5
+ * Resolves variable references in a template and returns the result.
6
+ *
7
+ * This is a pure transform - no LLM invocation.
8
+ *
9
+ * Server-only: Used within WorkflowExecutor during step execution.
10
+ */
11
+ import { resolveVariables } from '../core/variable-resolver';
12
+ /**
13
+ * Output Primitive Handler
14
+ *
15
+ * Resolves all variable references in the template and returns
16
+ * the transformed object for consumption by subsequent steps.
17
+ *
18
+ * Supported patterns (via resolveVariables):
19
+ * - $input.* → context.input[path]
20
+ * - $stepResult.* → context.variables.get(stepName)[path]
21
+ * - $varName.* → context.variables.get(varName)[path] (legacy)
22
+ *
23
+ * @param config - Step configuration from YAML (must contain 'template')
24
+ * @param context - Execution context with input and variables
25
+ * @returns Resolved template as Record (never streams)
26
+ */
27
+ export const outputPrimitive = async (config, context) => {
28
+ const outputConfig = config;
29
+ if (outputConfig.template === undefined) {
30
+ console.warn('[Beddel] output-generator: No template provided, returning empty object.');
31
+ return {};
32
+ }
33
+ const resolved = resolveVariables(outputConfig.template, context);
34
+ // Ensure we return a Record even if template resolves to primitive
35
+ if (typeof resolved !== 'object' || resolved === null) {
36
+ return { value: resolved };
37
+ }
38
+ return resolved;
39
+ };
@@ -0,0 +1,7 @@
1
+ import { NextRequest } from 'next/server';
2
+ export interface BeddelHandlerOptions {
3
+ agentsPath?: string;
4
+ }
5
+ export type BeddelHandler = (request: NextRequest) => Promise<Response>;
6
+ export declare function createBeddelHandler(options?: BeddelHandlerOptions): BeddelHandler;
7
+ //# sourceMappingURL=handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/server/handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK1C,MAAM,WAAW,oBAAoB;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAsBxE,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,oBAAyB,GAAG,aAAa,CAgDrF"}
@@ -0,0 +1,55 @@
1
+ import { loadYaml } from '../core/parser';
2
+ import { WorkflowExecutor } from '../core/workflow';
3
+ import { join, normalize } from 'path';
4
+ /**
5
+ * Validate agentId to prevent path traversal attacks.
6
+ * Only allows alphanumeric characters, hyphens, and underscores.
7
+ *
8
+ * @param agentId - The agent identifier from request
9
+ * @returns true if valid, false otherwise
10
+ */
11
+ function isValidAgentId(agentId) {
12
+ // Must be non-empty string
13
+ if (typeof agentId !== 'string' || agentId.length === 0) {
14
+ return false;
15
+ }
16
+ // Only allow safe characters: alphanumeric, hyphen, underscore
17
+ // No dots, slashes, or other path characters
18
+ const safePattern = /^[a-zA-Z0-9_-]+$/;
19
+ return safePattern.test(agentId);
20
+ }
21
+ export function createBeddelHandler(options = {}) {
22
+ const agentsPath = options.agentsPath || 'src/agents';
23
+ return async function POST(request) {
24
+ try {
25
+ const body = await request.json();
26
+ const { agentId, ...input } = body;
27
+ if (!agentId) {
28
+ return Response.json({ error: 'agentId is required' }, { status: 400 });
29
+ }
30
+ // Security: Validate agentId to prevent path traversal
31
+ if (!isValidAgentId(agentId)) {
32
+ return Response.json({ error: 'Invalid agentId: only alphanumeric characters, hyphens, and underscores allowed' }, { status: 400 });
33
+ }
34
+ // Resolve path relative to CWD (usually project root)
35
+ const basePath = join(process.cwd(), agentsPath);
36
+ const fullPath = normalize(join(basePath, `${agentId}.yaml`));
37
+ // Double-check: ensure resolved path is within agents directory
38
+ if (!fullPath.startsWith(basePath)) {
39
+ return Response.json({ error: 'Invalid agentId' }, { status: 400 });
40
+ }
41
+ const yaml = await loadYaml(fullPath);
42
+ const executor = new WorkflowExecutor(yaml);
43
+ // Pass the entire body (minus agentId) as input ($input)
44
+ const result = await executor.execute(input);
45
+ if (result instanceof Response) {
46
+ return result;
47
+ }
48
+ return Response.json(result);
49
+ }
50
+ catch (error) {
51
+ console.error('[Beddel] Handler Error:', error);
52
+ return Response.json({ error: error instanceof Error ? error.message : 'Internal Server Error' }, { status: 500 });
53
+ }
54
+ };
55
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Beddel Protocol - Server Entry Point
3
+ *
4
+ * Use: import { createBeddelHandler } from 'beddel/server'
5
+ *
6
+ * This module provides the server-side handler factory for Next.js API routes.
7
+ * Contains Node.js dependencies - DO NOT import in client code.
8
+ */
9
+ export { createBeddelHandler, type BeddelHandlerOptions } from './server/handler';
10
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,mBAAmB,EAAE,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC"}
package/dist/server.js ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Beddel Protocol - Server Entry Point
3
+ *
4
+ * Use: import { createBeddelHandler } from 'beddel/server'
5
+ *
6
+ * This module provides the server-side handler factory for Next.js API routes.
7
+ * Contains Node.js dependencies - DO NOT import in client code.
8
+ */
9
+ export { createBeddelHandler } from './server/handler';
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Beddel Protocol - Tool Registry
3
+ *
4
+ * This registry contains tool implementations that LLM primitives can access.
5
+ * Each tool has: description, Zod parameters schema, and execute function.
6
+ *
7
+ * Following Expansion Pack Pattern from BMAD-METHOD™ for extensibility.
8
+ * See: https://github.com/bmadcode/bmad-method
9
+ */
10
+ import { z } from 'zod';
11
+ /**
12
+ * Interface for tool implementations in the registry.
13
+ * Tools are invoked by the LLM via function calling.
14
+ */
15
+ export interface ToolImplementation {
16
+ /** Human-readable description of what the tool does */
17
+ description: string;
18
+ /** Zod schema defining the tool's input parameters */
19
+ parameters: z.ZodSchema;
20
+ /** Async function that executes the tool and returns results */
21
+ execute: (args: Record<string, unknown>) => Promise<Record<string, unknown>>;
22
+ }
23
+ /**
24
+ * Registry of available tools keyed by tool name.
25
+ *
26
+ * YAML workflows reference tools by name:
27
+ * ```yaml
28
+ * tools:
29
+ * - name: "calculator"
30
+ * description: "Optional override" # Can override default description
31
+ * ```
32
+ */
33
+ export declare const toolRegistry: Record<string, ToolImplementation>;
34
+ /**
35
+ * Register a custom tool in the registry.
36
+ * Allows consumers to extend Beddel with domain-specific tools.
37
+ *
38
+ * @param name - Unique identifier for the tool
39
+ * @param implementation - Tool implementation object
40
+ *
41
+ * @example
42
+ * registerTool('weatherLookup', {
43
+ * description: 'Get weather for a city',
44
+ * parameters: z.object({ city: z.string() }),
45
+ * execute: async ({ city }) => fetchWeather(city),
46
+ * });
47
+ */
48
+ export declare function registerTool(name: string, implementation: ToolImplementation): void;
49
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAC/B,uDAAuD;IACvD,WAAW,EAAE,MAAM,CAAC;IACpB,sDAAsD;IACtD,UAAU,EAAE,CAAC,CAAC,SAAS,CAAC;IACxB,gEAAgE;IAChE,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAChF;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CA6D3D,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,kBAAkB,GAAG,IAAI,CAKnF"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Beddel Protocol - Tool Registry
3
+ *
4
+ * This registry contains tool implementations that LLM primitives can access.
5
+ * Each tool has: description, Zod parameters schema, and execute function.
6
+ *
7
+ * Following Expansion Pack Pattern from BMAD-METHOD™ for extensibility.
8
+ * See: https://github.com/bmadcode/bmad-method
9
+ */
10
+ import { z } from 'zod';
11
+ /**
12
+ * Registry of available tools keyed by tool name.
13
+ *
14
+ * YAML workflows reference tools by name:
15
+ * ```yaml
16
+ * tools:
17
+ * - name: "calculator"
18
+ * description: "Optional override" # Can override default description
19
+ * ```
20
+ */
21
+ export const toolRegistry = {
22
+ /**
23
+ * Calculator tool - evaluates mathematical expressions safely.
24
+ *
25
+ * Security: Only allows numbers, operators (+, -, *, /, %, **),
26
+ * parentheses, and decimal points. No function calls or variables.
27
+ *
28
+ * @example
29
+ * Input: { expression: "2 + 2 * 3" }
30
+ * Output: { result: 8 }
31
+ */
32
+ calculator: {
33
+ description: 'Evaluate a mathematical expression (numbers and basic operators only)',
34
+ parameters: z.object({
35
+ expression: z.string().describe('The math expression to evaluate (e.g., "2 + 2 * 3")'),
36
+ }),
37
+ execute: async ({ expression }) => {
38
+ const expr = String(expression);
39
+ // Security: Whitelist only safe characters
40
+ // Allows: digits, operators, parentheses, spaces, decimal points
41
+ const safePattern = /^[\d\s+\-*/%().]+$/;
42
+ if (!safePattern.test(expr)) {
43
+ return { error: 'Invalid expression: only numbers and operators (+, -, *, /, %, **) allowed' };
44
+ }
45
+ // Additional check: no empty parentheses or dangerous patterns
46
+ if (/\(\s*\)/.test(expr) || /[a-zA-Z_$]/.test(expr)) {
47
+ return { error: 'Invalid expression: function calls not allowed' };
48
+ }
49
+ try {
50
+ // Safe to evaluate after whitelist validation
51
+ const result = Function(`"use strict"; return (${expr})`)();
52
+ if (typeof result !== 'number' || !Number.isFinite(result)) {
53
+ return { error: 'Expression did not evaluate to a valid number' };
54
+ }
55
+ return { result };
56
+ }
57
+ catch (e) {
58
+ return { error: `Evaluation failed: ${e instanceof Error ? e.message : 'unknown error'}` };
59
+ }
60
+ },
61
+ },
62
+ /**
63
+ * getCurrentTime tool - returns current date and time in ISO format.
64
+ *
65
+ * @example
66
+ * Input: {}
67
+ * Output: { time: "2024-12-23T15:30:00.000Z" }
68
+ */
69
+ getCurrentTime: {
70
+ description: 'Get the current date and time in ISO format',
71
+ parameters: z.object({}),
72
+ execute: async () => {
73
+ return { time: new Date().toISOString() };
74
+ },
75
+ },
76
+ };
77
+ /**
78
+ * Register a custom tool in the registry.
79
+ * Allows consumers to extend Beddel with domain-specific tools.
80
+ *
81
+ * @param name - Unique identifier for the tool
82
+ * @param implementation - Tool implementation object
83
+ *
84
+ * @example
85
+ * registerTool('weatherLookup', {
86
+ * description: 'Get weather for a city',
87
+ * parameters: z.object({ city: z.string() }),
88
+ * execute: async ({ city }) => fetchWeather(city),
89
+ * });
90
+ */
91
+ export function registerTool(name, implementation) {
92
+ if (toolRegistry[name]) {
93
+ console.warn(`[Beddel] Tool '${name}' already registered, overwriting.`);
94
+ }
95
+ toolRegistry[name] = implementation;
96
+ }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Beddel Protocol - Type Definitions
3
+ * Core interfaces for the workflow engine
4
+ */
5
+ /**
6
+ * Metadata from YAML header section
7
+ */
8
+ export interface YamlMetadata {
9
+ name: string;
10
+ version: string;
11
+ }
12
+ /**
13
+ * Configuration for a workflow step
14
+ * Contents vary by step type (llm, output-generator, call-agent)
15
+ */
16
+ export interface StepConfig {
17
+ [key: string]: unknown;
18
+ }
19
+ /**
20
+ * Individual workflow step definition
21
+ */
22
+ export interface WorkflowStep {
23
+ /** Unique identifier for this step */
24
+ id: string;
25
+ /** Step type: 'llm' | 'output-generator' | 'call-agent' */
26
+ type: string;
27
+ /** Step-specific configuration */
28
+ config: StepConfig;
29
+ /** Optional variable name to store step result */
30
+ result?: string;
31
+ }
32
+ /**
33
+ * Complete parsed YAML document structure
34
+ */
35
+ export interface ParsedYaml {
36
+ metadata: YamlMetadata;
37
+ workflow: WorkflowStep[];
38
+ }
39
+ /**
40
+ * Execution context passed to primitive handlers
41
+ * Holds input data and accumulated step results
42
+ */
43
+ export interface ExecutionContext {
44
+ /** Original input passed to WorkflowExecutor.execute() */
45
+ input: unknown;
46
+ /** Map of step results keyed by step.result name */
47
+ variables: Map<string, unknown>;
48
+ }
49
+ /**
50
+ * Contract for primitive handlers (llm, output-generator, call-agent)
51
+ * Handlers may return Response (streaming) or Record (data for next step)
52
+ */
53
+ export type PrimitiveHandler = (config: StepConfig, context: ExecutionContext) => Promise<Response | Record<string, unknown>>;
54
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,sCAAsC;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,MAAM,EAAE,UAAU,CAAC;IACnB,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACvB,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,EAAE,YAAY,EAAE,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC7B,0DAA0D;IAC1D,KAAK,EAAE,OAAO,CAAC;IACf,oDAAoD;IACpD,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAC3B,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,gBAAgB,KACxB,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Beddel Protocol - Type Definitions
3
+ * Core interfaces for the workflow engine
4
+ */
5
+ export {};