@elementumai/edk 0.8.2-alpha.6 → 0.9.5

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 (481) hide show
  1. package/README.md +49 -37
  2. package/dist-sdk/elementum-entity-client/clients/agents/models/agent-tool.d.ts +3 -3
  3. package/dist-sdk/elementum-entity-client/clients/aspects/models/index.d.ts +1 -1
  4. package/dist-sdk/elementum-entity-client/clients/aspects/models/picklist-config.d.ts +3 -11
  5. package/dist-sdk/elementum-entity-client/clients/automation/models/automation.d.ts +3 -11
  6. package/dist-sdk/elementum-entity-client/clients/skills/models/skill-tool.d.ts +1 -1
  7. package/dist-sdk/elementum-entity-client/clients/skills/models/skill.d.ts +1 -1
  8. package/dist-sdk/elementum-entity-client/clients/skills/models/skill.js +1 -1
  9. package/dist-sdk/fs/entity.d.ts +2 -2
  10. package/dist-sdk/fs/entity.js +1 -1
  11. package/dist-sdk/pull/missing-report.d.ts +81 -0
  12. package/dist-sdk/pull/missing-report.js +52 -0
  13. package/dist-sdk/pull/util.d.ts +1 -1
  14. package/dist-sdk/pull/util.js +3 -3
  15. package/dist-sdk/src/catalog/factories.d.ts +96 -23
  16. package/dist-sdk/src/catalog/factories.js +141 -21
  17. package/dist-sdk/src/catalog/from-authoring.d.ts +5 -5
  18. package/dist-sdk/src/catalog/from-authoring.js +20 -10
  19. package/dist-sdk/src/catalog/index.d.ts +2 -2
  20. package/dist-sdk/src/catalog/index.js +1 -1
  21. package/dist-sdk/src/catalog/org.js +63 -4
  22. package/dist-sdk/src/catalog/render-helpers.d.ts +1 -1
  23. package/dist-sdk/src/catalog/render-helpers.js +1 -1
  24. package/dist-sdk/src/catalog/render.d.ts +1 -0
  25. package/dist-sdk/src/catalog/render.js +8 -2
  26. package/dist-sdk/src/catalog/token.js +18 -4
  27. package/dist-sdk/src/catalog/types.d.ts +64 -24
  28. package/dist-sdk/src/catalog/types.js +12 -4
  29. package/dist-sdk/src/core/app-to-ui.d.ts +6 -6
  30. package/dist-sdk/src/core/app-to-ui.js +7 -9
  31. package/dist-sdk/src/core/index.d.ts +11 -10
  32. package/dist-sdk/src/core/index.js +10 -9
  33. package/dist-sdk/src/core/platform-id.d.ts +11 -0
  34. package/dist-sdk/src/core/platform-id.js +8 -0
  35. package/dist-sdk/src/{entities/flow/activities/render-catalog.d.ts → core/render-tree.d.ts} +3 -3
  36. package/dist-sdk/src/{entities/flow/activities/render-catalog.js → core/render-tree.js} +7 -10
  37. package/dist-sdk/src/core/types/ai-provider.d.ts +1 -1
  38. package/dist-sdk/src/core/types/ai-provider.js +1 -1
  39. package/dist-sdk/src/core/types/app.d.ts +78 -52
  40. package/dist-sdk/src/core/types/app.js +2 -3
  41. package/dist-sdk/src/core/types/aspect-category.d.ts +4 -4
  42. package/dist-sdk/src/core/types/aspect-category.js +4 -4
  43. package/dist-sdk/src/core/types/cloud-link.d.ts +3 -3
  44. package/dist-sdk/src/core/types/cloud-link.js +3 -3
  45. package/dist-sdk/src/core/types/display-block.d.ts +2 -2
  46. package/dist-sdk/src/core/types/display-block.js +2 -2
  47. package/dist-sdk/src/core/types/group.d.ts +1 -1
  48. package/dist-sdk/src/core/types/group.js +1 -1
  49. package/dist-sdk/src/core/types/user.d.ts +1 -1
  50. package/dist-sdk/src/core/types/user.js +1 -1
  51. package/dist-sdk/src/core/wire/ref-serializer.js +3 -3
  52. package/dist-sdk/src/engine/build/context.d.ts +23 -16
  53. package/dist-sdk/src/engine/entity.d.ts +1 -1
  54. package/dist-sdk/src/engine/pull/attrs.d.ts +4 -0
  55. package/dist-sdk/src/engine/pull/attrs.js +17 -0
  56. package/dist-sdk/src/engine/pull/context.d.ts +73 -0
  57. package/dist-sdk/src/engine/pull/context.js +14 -0
  58. package/dist-sdk/src/engine/pull/org.d.ts +10 -0
  59. package/dist-sdk/src/engine/pull/org.js +35 -0
  60. package/dist-sdk/src/engine/pull/ref-only.d.ts +37 -0
  61. package/dist-sdk/src/engine/pull/ref-only.js +204 -0
  62. package/dist-sdk/src/engine/tf/expr.d.ts +7 -3
  63. package/dist-sdk/src/engine/tf/expr.js +27 -15
  64. package/dist-sdk/src/engine/tf/index.d.ts +1 -1
  65. package/dist-sdk/src/engine/tf/index.js +1 -1
  66. package/dist-sdk/src/engine/tf/model.d.ts +8 -1
  67. package/dist-sdk/src/engine/tf/model.js +4 -0
  68. package/dist-sdk/src/engine/tf/parse.js +13 -2
  69. package/dist-sdk/src/engine/tf/render.js +4 -0
  70. package/dist-sdk/src/engine/workspace/authoring-layout.js +4 -2
  71. package/dist-sdk/src/entities/access-policy/build.d.ts +6 -16
  72. package/dist-sdk/src/entities/access-policy/build.js +2 -2
  73. package/dist-sdk/src/entities/access-policy/from-tf.d.ts +14 -40
  74. package/dist-sdk/src/entities/access-policy/from-tf.js +26 -85
  75. package/dist-sdk/src/entities/access-policy/principal.d.ts +39 -0
  76. package/dist-sdk/src/entities/access-policy/principal.js +13 -0
  77. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +33 -6
  78. package/dist-sdk/src/entities/access-policy/to-tf.js +62 -60
  79. package/dist-sdk/src/entities/agent/build.d.ts +42 -11
  80. package/dist-sdk/src/entities/agent/build.js +40 -19
  81. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +11 -1
  82. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +180 -45
  83. package/dist-sdk/src/entities/agent/from-tf.d.ts +3 -1
  84. package/dist-sdk/src/entities/agent/from-tf.js +17 -12
  85. package/dist-sdk/src/entities/agent/index.d.ts +5 -2
  86. package/dist-sdk/src/entities/agent/index.js +4 -2
  87. package/dist-sdk/src/entities/agent/module.js +7 -2
  88. package/dist-sdk/src/entities/agent/run-as.d.ts +16 -0
  89. package/dist-sdk/src/entities/agent/run-as.js +1 -0
  90. package/dist-sdk/src/entities/agent/to-tf.d.ts +6 -2
  91. package/dist-sdk/src/entities/agent/to-tf.js +58 -9
  92. package/dist-sdk/src/entities/agent/tools.d.ts +97 -70
  93. package/dist-sdk/src/entities/agent/tools.js +63 -43
  94. package/dist-sdk/src/entities/agent-a2a-skill/from-tf.js +1 -1
  95. package/dist-sdk/src/entities/agent-a2a-skill/to-tf.js +4 -4
  96. package/dist-sdk/src/entities/agent-evaluation/build.d.ts +19 -0
  97. package/dist-sdk/src/entities/agent-evaluation/build.js +41 -0
  98. package/dist-sdk/src/entities/agent-evaluation/deserializer/print-agent-evaluation.d.ts +4 -0
  99. package/dist-sdk/src/entities/agent-evaluation/deserializer/print-agent-evaluation.js +30 -0
  100. package/dist-sdk/src/entities/agent-evaluation/from-tf.d.ts +12 -0
  101. package/dist-sdk/src/entities/agent-evaluation/from-tf.js +46 -0
  102. package/dist-sdk/src/entities/agent-evaluation/index.d.ts +1 -0
  103. package/dist-sdk/src/entities/agent-evaluation/index.js +1 -0
  104. package/dist-sdk/src/entities/agent-evaluation/module.d.ts +3 -0
  105. package/dist-sdk/src/entities/agent-evaluation/module.js +58 -0
  106. package/dist-sdk/src/entities/agent-evaluation/to-tf.d.ts +12 -0
  107. package/dist-sdk/src/entities/agent-evaluation/to-tf.js +35 -0
  108. package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +25 -15
  109. package/dist-sdk/src/entities/agent-tool/from-tf.js +175 -43
  110. package/dist-sdk/src/entities/agent-tool/module.js +6 -0
  111. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +15 -7
  112. package/dist-sdk/src/entities/agent-tool/to-tf.js +169 -48
  113. package/dist-sdk/src/entities/agent-tool/types.d.ts +4 -6
  114. package/dist-sdk/src/entities/agent-tool/types.js +30 -29
  115. package/dist-sdk/src/entities/app/build.d.ts +214 -47
  116. package/dist-sdk/src/entities/app/build.js +128 -66
  117. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +188 -8
  118. package/dist-sdk/src/entities/app/deserializer/pulled-expression.d.ts +59 -0
  119. package/dist-sdk/src/entities/app/deserializer/pulled-expression.js +70 -0
  120. package/dist-sdk/src/entities/app/display-blocks.d.ts +2 -1
  121. package/dist-sdk/src/entities/app/display-blocks.js +1 -1
  122. package/dist-sdk/src/entities/app/from-tf.d.ts +11 -1
  123. package/dist-sdk/src/entities/app/from-tf.js +30 -2
  124. package/dist-sdk/src/entities/app/index.d.ts +20 -8
  125. package/dist-sdk/src/entities/app/index.js +16 -6
  126. package/dist-sdk/src/entities/app/module.js +29 -4
  127. package/dist-sdk/src/entities/app/to-tf.d.ts +1 -1
  128. package/dist-sdk/src/entities/app/to-tf.js +97 -7
  129. package/dist-sdk/src/entities/approval-chain/build.d.ts +31 -16
  130. package/dist-sdk/src/entities/approval-chain/build.js +49 -49
  131. package/dist-sdk/src/entities/approval-chain/from-tf.d.ts +17 -0
  132. package/dist-sdk/src/entities/approval-chain/from-tf.js +57 -0
  133. package/dist-sdk/src/entities/approval-chain/index.d.ts +2 -3
  134. package/dist-sdk/src/entities/approval-chain/index.js +2 -3
  135. package/dist-sdk/src/entities/approval-chain/module.d.ts +3 -0
  136. package/dist-sdk/src/entities/approval-chain/module.js +51 -0
  137. package/dist-sdk/src/entities/approval-chain/printer.d.ts +2 -0
  138. package/dist-sdk/src/entities/approval-chain/printer.js +21 -0
  139. package/dist-sdk/src/entities/approval-chain/to-tf.d.ts +9 -0
  140. package/dist-sdk/src/entities/approval-chain/to-tf.js +43 -0
  141. package/dist-sdk/src/entities/automation/build.d.ts +177 -95
  142. package/dist-sdk/src/entities/automation/build.js +164 -72
  143. package/dist-sdk/src/entities/automation/calculation-expression.d.ts +191 -0
  144. package/dist-sdk/src/entities/automation/calculation-expression.js +57 -0
  145. package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +18 -9
  146. package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +18 -14
  147. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +214 -311
  148. package/dist-sdk/src/entities/automation/filter.d.ts +1 -115
  149. package/dist-sdk/src/entities/automation/filter.js +1 -197
  150. package/dist-sdk/src/entities/automation/from-tf.d.ts +28 -0
  151. package/dist-sdk/src/entities/automation/from-tf.js +695 -182
  152. package/dist-sdk/src/entities/automation/index.d.ts +9 -10
  153. package/dist-sdk/src/entities/automation/index.js +11 -11
  154. package/dist-sdk/src/entities/automation/module.js +82 -8
  155. package/dist-sdk/src/entities/automation/operators.d.ts +32 -48
  156. package/dist-sdk/src/entities/automation/operators.js +10 -37
  157. package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +1 -1
  158. package/dist-sdk/src/entities/automation/output-key-wire-name.js +1 -1
  159. package/dist-sdk/src/entities/automation/script-code.js +107 -28
  160. package/dist-sdk/src/entities/automation/serialize.js +1 -1
  161. package/dist-sdk/src/entities/automation/tasks.d.ts +167 -102
  162. package/dist-sdk/src/entities/automation/tasks.js +66 -13
  163. package/dist-sdk/src/entities/automation/to-tf.d.ts +44 -3
  164. package/dist-sdk/src/entities/automation/to-tf.js +607 -161
  165. package/dist-sdk/src/entities/automation/triggers.d.ts +33 -25
  166. package/dist-sdk/src/entities/automation/triggers.js +8 -2
  167. package/dist-sdk/src/entities/automation/types.d.ts +3 -2
  168. package/dist-sdk/src/entities/automation/types.js +3 -2
  169. package/dist-sdk/src/entities/chart/build.d.ts +95 -0
  170. package/dist-sdk/src/entities/chart/build.js +42 -0
  171. package/dist-sdk/src/entities/chart/from-tf.d.ts +55 -0
  172. package/dist-sdk/src/entities/chart/from-tf.js +269 -0
  173. package/dist-sdk/src/entities/chart/index.d.ts +4 -0
  174. package/dist-sdk/src/entities/chart/index.js +3 -0
  175. package/dist-sdk/src/entities/chart/module.d.ts +3 -0
  176. package/dist-sdk/src/entities/chart/module.js +61 -0
  177. package/dist-sdk/src/entities/chart/printer.d.ts +5 -0
  178. package/dist-sdk/src/entities/chart/printer.js +104 -0
  179. package/dist-sdk/src/entities/chart/to-tf.d.ts +15 -0
  180. package/dist-sdk/src/entities/chart/to-tf.js +150 -0
  181. package/dist-sdk/src/entities/chart/types.d.ts +53 -0
  182. package/dist-sdk/src/entities/chart/types.js +22 -0
  183. package/dist-sdk/src/entities/dashboard/build.d.ts +44 -0
  184. package/dist-sdk/src/entities/dashboard/build.js +16 -0
  185. package/dist-sdk/src/entities/dashboard/from-tf.d.ts +12 -0
  186. package/dist-sdk/src/entities/dashboard/from-tf.js +113 -0
  187. package/dist-sdk/src/entities/dashboard/module.d.ts +3 -0
  188. package/dist-sdk/src/entities/dashboard/module.js +16 -0
  189. package/dist-sdk/src/entities/dashboard/to-tf.d.ts +43 -0
  190. package/dist-sdk/src/entities/dashboard/to-tf.js +121 -0
  191. package/dist-sdk/src/entities/dashboard-widget/module.d.ts +3 -0
  192. package/dist-sdk/src/entities/dashboard-widget/module.js +10 -0
  193. package/dist-sdk/src/entities/data-lookup/module.d.ts +3 -0
  194. package/dist-sdk/src/entities/data-lookup/module.js +22 -0
  195. package/dist-sdk/src/entities/datamine/build.d.ts +22 -0
  196. package/dist-sdk/src/entities/datamine/from-tf.d.ts +17 -0
  197. package/dist-sdk/src/entities/datamine/from-tf.js +98 -0
  198. package/dist-sdk/src/entities/datamine/module.d.ts +3 -0
  199. package/dist-sdk/src/entities/datamine/module.js +23 -0
  200. package/dist-sdk/src/entities/datamine/to-tf.d.ts +11 -0
  201. package/dist-sdk/src/entities/datamine/to-tf.js +53 -0
  202. package/dist-sdk/src/entities/dynamic-layout/build.d.ts +304 -0
  203. package/dist-sdk/src/entities/dynamic-layout/build.js +4 -0
  204. package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +4 -0
  205. package/dist-sdk/src/entities/dynamic-layout/dialect.js +47 -0
  206. package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +10 -0
  207. package/dist-sdk/src/entities/dynamic-layout/from-tf.js +239 -0
  208. package/dist-sdk/src/entities/dynamic-layout/module.d.ts +3 -0
  209. package/dist-sdk/src/entities/dynamic-layout/module.js +13 -0
  210. package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +26 -0
  211. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +267 -0
  212. package/dist-sdk/src/entities/element/build.d.ts +48 -38
  213. package/dist-sdk/src/entities/element/build.js +24 -33
  214. package/dist-sdk/src/entities/element/from-tf.d.ts +9 -1
  215. package/dist-sdk/src/entities/element/from-tf.js +31 -2
  216. package/dist-sdk/src/entities/element/index.d.ts +14 -7
  217. package/dist-sdk/src/entities/element/index.js +11 -5
  218. package/dist-sdk/src/entities/element/module.js +26 -5
  219. package/dist-sdk/src/entities/element/to-tf.d.ts +2 -1
  220. package/dist-sdk/src/entities/element/to-tf.js +64 -4
  221. package/dist-sdk/src/entities/field/build.d.ts +55 -27
  222. package/dist-sdk/src/entities/field/build.js +31 -6
  223. package/dist-sdk/src/entities/field/calc/aggregate.d.ts +52 -21
  224. package/dist-sdk/src/entities/field/calc/aggregate.js +59 -29
  225. package/dist-sdk/src/entities/field/calc/date.d.ts +78 -29
  226. package/dist-sdk/src/entities/field/calc/date.js +120 -29
  227. package/dist-sdk/src/entities/field/calc/index.d.ts +80 -85
  228. package/dist-sdk/src/entities/field/calc/index.js +82 -139
  229. package/dist-sdk/src/entities/field/calc/numeric.d.ts +8 -12
  230. package/dist-sdk/src/entities/field/calc/numeric.js +10 -27
  231. package/dist-sdk/src/entities/field/calc/runtime.d.ts +19 -2
  232. package/dist-sdk/src/entities/field/calc/runtime.js +79 -8
  233. package/dist-sdk/src/entities/field/calc/text.d.ts +32 -23
  234. package/dist-sdk/src/entities/field/calc/text.js +43 -31
  235. package/dist-sdk/src/entities/field/calc/types.d.ts +36 -81
  236. package/dist-sdk/src/entities/field/calc/types.js +1 -22
  237. package/dist-sdk/src/entities/field/calc.d.ts +71 -48
  238. package/dist-sdk/src/entities/field/calc.js +5 -15
  239. package/dist-sdk/src/entities/field/calculation-types.d.ts +6 -0
  240. package/dist-sdk/src/entities/field/calculation-types.js +49 -0
  241. package/dist-sdk/src/entities/field/from-tf.js +238 -13
  242. package/dist-sdk/src/entities/field/locals.d.ts +11 -3
  243. package/dist-sdk/src/entities/field/locals.js +15 -2
  244. package/dist-sdk/src/entities/field/module.d.ts +1 -0
  245. package/dist-sdk/src/entities/field/module.js +27 -7
  246. package/dist-sdk/src/entities/field/record-shape.d.ts +25 -11
  247. package/dist-sdk/src/entities/field/to-tf.d.ts +41 -2
  248. package/dist-sdk/src/entities/field/to-tf.js +314 -40
  249. package/dist-sdk/src/entities/field/types.d.ts +1 -1
  250. package/dist-sdk/src/entities/field/types.js +10 -1
  251. package/dist-sdk/src/entities/file-reader/build.d.ts +71 -19
  252. package/dist-sdk/src/entities/file-reader/build.js +49 -4
  253. package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.d.ts +1 -0
  254. package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.js +12 -10
  255. package/dist-sdk/src/entities/file-reader/from-tf.d.ts +1 -1
  256. package/dist-sdk/src/entities/file-reader/from-tf.js +31 -2
  257. package/dist-sdk/src/entities/file-reader/index.d.ts +3 -3
  258. package/dist-sdk/src/entities/file-reader/index.js +3 -3
  259. package/dist-sdk/src/entities/file-reader/module.js +6 -5
  260. package/dist-sdk/src/entities/file-reader/to-tf.d.ts +1 -1
  261. package/dist-sdk/src/entities/file-reader/to-tf.js +5 -2
  262. package/dist-sdk/src/entities/file-reader/types.d.ts +3 -4
  263. package/dist-sdk/src/entities/file-reader/types.js +4 -5
  264. package/dist-sdk/src/entities/org/category.js +4 -5
  265. package/dist-sdk/src/entities/org/cloud-link.js +4 -5
  266. package/dist-sdk/src/entities/org/email-alias.d.ts +2 -0
  267. package/dist-sdk/src/entities/org/email-alias.js +12 -0
  268. package/dist-sdk/src/entities/org/group.js +4 -5
  269. package/dist-sdk/src/entities/org/index.d.ts +2 -0
  270. package/dist-sdk/src/entities/org/index.js +2 -0
  271. package/dist-sdk/src/entities/org/phone-provider.d.ts +4 -0
  272. package/dist-sdk/src/entities/org/phone-provider.js +30 -0
  273. package/dist-sdk/src/entities/org/role.d.ts +3 -3
  274. package/dist-sdk/src/entities/org/role.js +9 -6
  275. package/dist-sdk/src/entities/organization/build.d.ts +241 -0
  276. package/dist-sdk/src/entities/organization/build.js +165 -0
  277. package/dist-sdk/src/entities/organization/index.d.ts +2 -0
  278. package/dist-sdk/src/entities/organization/index.js +2 -0
  279. package/dist-sdk/src/entities/organization/module.d.ts +2 -0
  280. package/dist-sdk/src/entities/organization/module.js +21 -0
  281. package/dist-sdk/src/entities/organization/to-tf.d.ts +7 -0
  282. package/dist-sdk/src/entities/organization/to-tf.js +154 -0
  283. package/dist-sdk/src/entities/phone-service/build.d.ts +17 -0
  284. package/dist-sdk/src/entities/phone-service/build.js +31 -0
  285. package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.d.ts +4 -0
  286. package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.js +56 -0
  287. package/dist-sdk/src/entities/phone-service/from-tf.d.ts +25 -0
  288. package/dist-sdk/src/entities/phone-service/from-tf.js +75 -0
  289. package/dist-sdk/src/entities/phone-service/index.d.ts +2 -0
  290. package/dist-sdk/src/entities/phone-service/index.js +2 -0
  291. package/dist-sdk/src/entities/phone-service/module.d.ts +3 -0
  292. package/dist-sdk/src/entities/phone-service/module.js +55 -0
  293. package/dist-sdk/src/entities/phone-service/to-tf.d.ts +12 -0
  294. package/dist-sdk/src/entities/phone-service/to-tf.js +54 -0
  295. package/dist-sdk/src/entities/phone-service/types.d.ts +35 -0
  296. package/dist-sdk/src/entities/phone-service/types.js +22 -0
  297. package/dist-sdk/src/entities/record-create-form/from-tf.d.ts +11 -0
  298. package/dist-sdk/src/entities/record-create-form/from-tf.js +74 -0
  299. package/dist-sdk/src/entities/record-create-form/module.d.ts +11 -0
  300. package/dist-sdk/src/entities/record-create-form/module.js +24 -0
  301. package/dist-sdk/src/entities/record-create-form/to-tf.d.ts +33 -0
  302. package/dist-sdk/src/entities/record-create-form/to-tf.js +88 -0
  303. package/dist-sdk/src/entities/relationship/build.d.ts +16 -0
  304. package/dist-sdk/src/entities/relationship/build.js +1 -0
  305. package/dist-sdk/src/entities/relationship/from-tf.d.ts +12 -0
  306. package/dist-sdk/src/entities/relationship/from-tf.js +109 -0
  307. package/dist-sdk/src/entities/relationship/module.d.ts +3 -0
  308. package/dist-sdk/src/entities/relationship/module.js +16 -0
  309. package/dist-sdk/src/entities/relationship/to-tf.d.ts +32 -0
  310. package/dist-sdk/src/entities/relationship/to-tf.js +145 -0
  311. package/dist-sdk/src/entities/role/build.d.ts +65 -0
  312. package/dist-sdk/src/entities/role/build.js +33 -0
  313. package/dist-sdk/src/entities/role/from-tf.d.ts +13 -0
  314. package/dist-sdk/src/entities/role/from-tf.js +138 -0
  315. package/dist-sdk/src/entities/role/to-tf.d.ts +13 -0
  316. package/dist-sdk/src/entities/role/to-tf.js +69 -0
  317. package/dist-sdk/src/entities/search-table/build.d.ts +67 -28
  318. package/dist-sdk/src/entities/search-table/build.js +110 -56
  319. package/dist-sdk/src/entities/search-table/from-tf.d.ts +37 -0
  320. package/dist-sdk/src/entities/search-table/from-tf.js +113 -0
  321. package/dist-sdk/src/entities/search-table/index.d.ts +2 -2
  322. package/dist-sdk/src/entities/search-table/index.js +2 -2
  323. package/dist-sdk/src/entities/search-table/module.js +88 -10
  324. package/dist-sdk/src/entities/search-table/printer.d.ts +2 -0
  325. package/dist-sdk/src/entities/search-table/printer.js +52 -0
  326. package/dist-sdk/src/entities/search-table/to-tf.d.ts +14 -0
  327. package/dist-sdk/src/entities/search-table/to-tf.js +104 -0
  328. package/dist-sdk/src/entities/search-table/types.d.ts +8 -0
  329. package/dist-sdk/src/entities/search-table/types.js +21 -0
  330. package/dist-sdk/src/entities/service-account/build.d.ts +32 -0
  331. package/dist-sdk/src/entities/service-account/build.js +9 -0
  332. package/dist-sdk/src/entities/service-account/from-tf.d.ts +10 -0
  333. package/dist-sdk/src/entities/service-account/from-tf.js +109 -0
  334. package/dist-sdk/src/entities/service-account/module.d.ts +4 -0
  335. package/dist-sdk/src/entities/service-account/module.js +21 -0
  336. package/dist-sdk/src/entities/service-account/ref.d.ts +11 -0
  337. package/dist-sdk/src/entities/service-account/ref.js +5 -0
  338. package/dist-sdk/src/entities/service-account/to-tf.d.ts +32 -0
  339. package/dist-sdk/src/entities/service-account/to-tf.js +103 -0
  340. package/dist-sdk/src/entities/shared/connector-from-tf.d.ts +14 -0
  341. package/dist-sdk/src/entities/shared/connector-from-tf.js +14 -0
  342. package/dist-sdk/src/entities/shared/context.d.ts +25 -24
  343. package/dist-sdk/src/entities/shared/context.js +36 -35
  344. package/dist-sdk/src/entities/shared/filters/ast.d.ts +30 -81
  345. package/dist-sdk/src/entities/shared/filters/ast.js +6 -2
  346. package/dist-sdk/src/entities/shared/filters/index.d.ts +95 -206
  347. package/dist-sdk/src/entities/shared/filters/index.js +196 -341
  348. package/dist-sdk/src/entities/shared/filters/print.d.ts +11 -0
  349. package/dist-sdk/src/entities/shared/filters/print.js +122 -0
  350. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +170 -0
  351. package/dist-sdk/src/entities/shared/filters/tf-codec.js +527 -0
  352. package/dist-sdk/src/entities/shared/filters/types.d.ts +66 -69
  353. package/dist-sdk/src/entities/shared/filters/types.js +2 -3
  354. package/dist-sdk/src/entities/shared/foreign-ref.d.ts +14 -0
  355. package/dist-sdk/src/entities/shared/foreign-ref.js +12 -0
  356. package/dist-sdk/src/entities/shared/ref.d.ts +26 -11
  357. package/dist-sdk/src/entities/shared/ref.js +8 -3
  358. package/dist-sdk/src/entities/shared/types/common.d.ts +2 -2
  359. package/dist-sdk/src/entities/shared/types/field-types.d.ts +1 -1
  360. package/dist-sdk/src/entities/shared/types/field-types.js +1 -1
  361. package/dist-sdk/src/entities/skill/build.d.ts +4 -4
  362. package/dist-sdk/src/entities/skill/build.js +6 -5
  363. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +11 -1
  364. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +100 -39
  365. package/dist-sdk/src/entities/skill/index.d.ts +3 -2
  366. package/dist-sdk/src/entities/skill/index.js +3 -2
  367. package/dist-sdk/src/entities/skill/module.js +8 -2
  368. package/dist-sdk/src/entities/skill/to-tf.d.ts +6 -2
  369. package/dist-sdk/src/entities/skill/to-tf.js +20 -2
  370. package/dist-sdk/src/entities/skill/tools.d.ts +47 -31
  371. package/dist-sdk/src/entities/skill/tools.js +37 -23
  372. package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +17 -1
  373. package/dist-sdk/src/entities/skill-tool/from-tf.js +118 -8
  374. package/dist-sdk/src/entities/skill-tool/module.js +9 -0
  375. package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +6 -1
  376. package/dist-sdk/src/entities/skill-tool/to-tf.js +100 -48
  377. package/dist-sdk/src/entities/skill-tool/types.js +18 -1
  378. package/dist-sdk/src/entities/table/build.d.ts +64 -23
  379. package/dist-sdk/src/entities/table/build.js +41 -26
  380. package/dist-sdk/src/entities/table/catalog-render.js +15 -1
  381. package/dist-sdk/src/entities/table/deserializer/normalize.d.ts +99 -0
  382. package/dist-sdk/src/entities/table/deserializer/normalize.js +192 -0
  383. package/dist-sdk/src/entities/table/fields/types.d.ts +86 -0
  384. package/dist-sdk/src/entities/table/fields/types.js +12 -0
  385. package/dist-sdk/src/entities/table/fields.d.ts +107 -47
  386. package/dist-sdk/src/entities/table/fields.js +76 -55
  387. package/dist-sdk/src/entities/table/from-tf.d.ts +4 -0
  388. package/dist-sdk/src/entities/table/from-tf.js +261 -0
  389. package/dist-sdk/src/entities/table/index.d.ts +7 -5
  390. package/dist-sdk/src/entities/table/index.js +7 -7
  391. package/dist-sdk/src/entities/table/joins.d.ts +22 -9
  392. package/dist-sdk/src/entities/table/joins.js +8 -16
  393. package/dist-sdk/src/entities/table/module.d.ts +2 -1
  394. package/dist-sdk/src/entities/table/module.js +13 -6
  395. package/dist-sdk/src/entities/table/to-tf.d.ts +10 -0
  396. package/dist-sdk/src/entities/table/to-tf.js +222 -0
  397. package/dist-sdk/src/entities/task/build.d.ts +43 -0
  398. package/dist-sdk/src/entities/task/build.js +17 -0
  399. package/dist-sdk/src/entities/task/from-tf.d.ts +28 -0
  400. package/dist-sdk/src/entities/task/from-tf.js +38 -0
  401. package/dist-sdk/src/entities/task/index.d.ts +1 -0
  402. package/dist-sdk/src/entities/task/index.js +1 -0
  403. package/dist-sdk/src/entities/task/module.d.ts +3 -0
  404. package/dist-sdk/src/entities/task/module.js +12 -0
  405. package/dist-sdk/src/entities/task/to-tf.d.ts +9 -0
  406. package/dist-sdk/src/entities/task/to-tf.js +49 -0
  407. package/dist-sdk/src/entities/view/build.d.ts +46 -0
  408. package/dist-sdk/src/entities/view/build.js +19 -0
  409. package/dist-sdk/src/entities/view/from-tf.d.ts +7 -2
  410. package/dist-sdk/src/entities/view/from-tf.js +264 -30
  411. package/dist-sdk/src/entities/view/module.d.ts +6 -13
  412. package/dist-sdk/src/entities/view/module.js +12 -15
  413. package/dist-sdk/src/entities/view/sharing.d.ts +10 -0
  414. package/dist-sdk/src/entities/view/sharing.js +6 -0
  415. package/dist-sdk/src/entities/view/to-tf.d.ts +56 -12
  416. package/dist-sdk/src/entities/view/to-tf.js +192 -20
  417. package/dist-sdk/src/entities/view/types.d.ts +8 -0
  418. package/dist-sdk/src/entities/view/types.js +46 -0
  419. package/dist-sdk/src/entities/visual-flow/build.d.ts +87 -0
  420. package/dist-sdk/src/entities/visual-flow/build.js +72 -0
  421. package/dist-sdk/src/entities/visual-flow/from-tf.d.ts +49 -0
  422. package/dist-sdk/src/entities/visual-flow/from-tf.js +124 -0
  423. package/dist-sdk/src/entities/visual-flow/index.d.ts +1 -0
  424. package/dist-sdk/src/entities/visual-flow/index.js +1 -0
  425. package/dist-sdk/src/entities/visual-flow/module.d.ts +3 -0
  426. package/dist-sdk/src/entities/visual-flow/module.js +41 -0
  427. package/dist-sdk/src/entities/visual-flow/printer.d.ts +8 -0
  428. package/dist-sdk/src/entities/visual-flow/printer.js +92 -0
  429. package/dist-sdk/src/entities/visual-flow/to-tf.d.ts +15 -0
  430. package/dist-sdk/src/entities/visual-flow/to-tf.js +97 -0
  431. package/dist-sdk/src/entities/widget/build.d.ts +55 -0
  432. package/dist-sdk/src/entities/widget/build.js +1 -0
  433. package/dist-sdk/src/entities/widget/from-tf.d.ts +11 -0
  434. package/dist-sdk/src/entities/widget/from-tf.js +209 -0
  435. package/dist-sdk/src/entities/widget/module.d.ts +3 -0
  436. package/dist-sdk/src/entities/widget/module.js +16 -0
  437. package/dist-sdk/src/entities/widget/to-tf.d.ts +45 -0
  438. package/dist-sdk/src/entities/widget/to-tf.js +206 -0
  439. package/dist-sdk/src/graph/deferred-catalog-render.d.ts +1 -1
  440. package/dist-sdk/src/graph/deferred-catalog-render.js +1 -1
  441. package/dist-sdk/src/graph/index.d.ts +12 -1
  442. package/dist-sdk/src/graph/index.js +8 -19
  443. package/dist-sdk/src/graph/modules.js +35 -1
  444. package/dist-sdk/src/graph/types.d.ts +106 -7
  445. package/dist-sdk/src/internal/safe-identifier.d.ts +4 -0
  446. package/dist-sdk/src/internal/safe-identifier.js +13 -0
  447. package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
  448. package/dist-sdk/src/internal/sdk-package.js +5 -2
  449. package/package.json +39 -15
  450. package/dist-sdk/src/entities/access-policy/filter.d.ts +0 -61
  451. package/dist-sdk/src/entities/access-policy/filter.js +0 -83
  452. package/dist-sdk/src/entities/approval-chain/steps.d.ts +0 -24
  453. package/dist-sdk/src/entities/approval-chain/steps.js +0 -20
  454. package/dist-sdk/src/entities/flow/activities/agent.d.ts +0 -15
  455. package/dist-sdk/src/entities/flow/activities/agent.js +0 -29
  456. package/dist-sdk/src/entities/flow/activities/approval.d.ts +0 -9
  457. package/dist-sdk/src/entities/flow/activities/approval.js +0 -18
  458. package/dist-sdk/src/entities/flow/activities/automation.d.ts +0 -12
  459. package/dist-sdk/src/entities/flow/activities/automation.js +0 -22
  460. package/dist-sdk/src/entities/flow/activities/ctx.d.ts +0 -34
  461. package/dist-sdk/src/entities/flow/activities/ctx.js +0 -38
  462. package/dist-sdk/src/entities/flow/activities/form.d.ts +0 -22
  463. package/dist-sdk/src/entities/flow/activities/form.js +0 -36
  464. package/dist-sdk/src/entities/flow/activities/index.d.ts +0 -14
  465. package/dist-sdk/src/entities/flow/activities/index.js +0 -13
  466. package/dist-sdk/src/entities/flow/activities/input-refs.d.ts +0 -39
  467. package/dist-sdk/src/entities/flow/activities/input-refs.js +0 -19
  468. package/dist-sdk/src/entities/flow/activities/prompt-template.d.ts +0 -13
  469. package/dist-sdk/src/entities/flow/activities/prompt-template.js +0 -34
  470. package/dist-sdk/src/entities/flow/activities/types.d.ts +0 -33
  471. package/dist-sdk/src/entities/flow/build.d.ts +0 -38
  472. package/dist-sdk/src/entities/flow/build.js +0 -115
  473. package/dist-sdk/src/entities/flow/index.d.ts +0 -8
  474. package/dist-sdk/src/entities/flow/index.js +0 -7
  475. package/dist-sdk/src/entities/flow/serialize.d.ts +0 -51
  476. package/dist-sdk/src/entities/flow/serialize.js +0 -94
  477. package/dist-sdk/src/entities/flow/util.d.ts +0 -27
  478. package/dist-sdk/src/entities/flow/util.js +0 -38
  479. package/dist-sdk/src/entities/table/filter.d.ts +0 -41
  480. package/dist-sdk/src/entities/table/filter.js +0 -89
  481. /package/dist-sdk/src/entities/{flow/activities/types.js → datamine/build.js} +0 -0
@@ -0,0 +1,19 @@
1
+ import { type AgentEvaluationRef, type AiServiceRef, type AppCatalogRef } from "../../catalog/index.js";
2
+ import type { DeployableEntity, EntityDeployOptions } from "../../engine/entity.js";
3
+ export interface AgentEvaluationOptions<AppRefName extends string = string> extends EntityDeployOptions {
4
+ /** The app whose scenarios may use this evaluation rubric. */
5
+ readonly app: AppCatalogRef<AppRefName>;
6
+ readonly name: string;
7
+ /** Instructions given to the evaluator model when scoring a scenario result. */
8
+ readonly prompt: string;
9
+ /** A pulled organization AI-service token. */
10
+ readonly connector: AiServiceRef;
11
+ /** Minimum score required to pass. The product supports values from 0 through 4. */
12
+ readonly passingThreshold: number;
13
+ }
14
+ export interface AgentEvaluationConfigured {
15
+ ref(refName: string): AgentEvaluationRef;
16
+ def(refName: string): DeployableEntity;
17
+ }
18
+ /** Define an app-owned rubric used to evaluate agent scenario responses. */
19
+ export declare function agentEvaluation<const AppRefName extends string>(opts: AgentEvaluationOptions<AppRefName>): AgentEvaluationConfigured;
@@ -0,0 +1,41 @@
1
+ import { slimTokens, } from "../../catalog/index.js";
2
+ function validateAgentEvaluation(refName, opts) {
3
+ const fail = (message) => {
4
+ throw new Error(`agentEvaluation "${refName}": ${message}`);
5
+ };
6
+ if (opts.app.__kind !== "app")
7
+ fail("app must be an app catalog ref");
8
+ if (opts.name.trim() === "")
9
+ fail("name must not be empty");
10
+ if (opts.prompt.trim() === "")
11
+ fail("prompt must not be empty");
12
+ if (opts.connector.__kind !== "connector")
13
+ fail("connector must be a pulled AI-service token");
14
+ if (!Number.isFinite(opts.passingThreshold) || opts.passingThreshold < 0 || opts.passingThreshold > 4) {
15
+ fail("passingThreshold must be a finite number from 0 through 4");
16
+ }
17
+ }
18
+ /** Define an app-owned rubric used to evaluate agent scenario responses. */
19
+ export function agentEvaluation(opts) {
20
+ return {
21
+ ref(refName) {
22
+ return { __kind: "agent-evaluation", refName, name: opts.name, parent: opts.app.refName };
23
+ },
24
+ def(refName) {
25
+ validateAgentEvaluation(refName, opts);
26
+ return {
27
+ kind: "agent-evaluation",
28
+ parent: opts.app.refName,
29
+ refName,
30
+ payload: slimTokens({
31
+ app: opts.app,
32
+ name: opts.name,
33
+ prompt: opts.prompt,
34
+ connector: opts.connector,
35
+ passingThreshold: opts.passingThreshold,
36
+ }),
37
+ ...(opts.enabled !== undefined ? { enabled: opts.enabled } : {}),
38
+ };
39
+ },
40
+ };
41
+ }
@@ -0,0 +1,4 @@
1
+ import type { NormalizedAgentEvaluation } from "../from-tf.js";
2
+ export declare function printAgentEvaluation(evaluation: NormalizedAgentEvaluation, opts: {
3
+ readonly appRefName: string;
4
+ }): string;
@@ -0,0 +1,30 @@
1
+ import { quote } from "../../../../pull/util.js";
2
+ import { sdkPackageSpecifier } from "../../../internal/sdk-package.js";
3
+ import { safeIdentifier } from "../../../internal/safe-identifier.js";
4
+ export function printAgentEvaluation(evaluation, opts) {
5
+ const [providerKey, modelKey] = evaluation.connectorKey.split(".");
6
+ const connector = providerKey !== undefined && modelKey !== undefined
7
+ ? `catalog.aiProviders.${providerKey}.models.${modelKey}`
8
+ : `{ __kind: "connector", refName: "TODO_CONNECTOR", name: "TODO_CONNECTOR", parent: "TODO_PROVIDER" } /* TODO: unresolved connector ${quote(evaluation.connectorKey)} */`;
9
+ const identifier = safeIdentifier(evaluation.refName, "agentEvaluation");
10
+ return [
11
+ "/**",
12
+ " * Auto-generated by EDK (v2 pull). Hand-edit freely; the generator is a",
13
+ " * one-shot starting point, not a live-binding view.",
14
+ " */",
15
+ "",
16
+ `import { agentEvaluation } from ${quote(sdkPackageSpecifier("app"))};`,
17
+ 'import catalog from "@catalog";',
18
+ "",
19
+ `const ${identifier} = agentEvaluation({`,
20
+ ` app: catalog.${opts.appRefName},`,
21
+ ` name: ${quote(evaluation.name)},`,
22
+ ` prompt: ${quote(evaluation.prompt)},`,
23
+ ` connector: ${connector},`,
24
+ ` passingThreshold: ${evaluation.passingThreshold},`,
25
+ "});",
26
+ "",
27
+ `export default ${identifier};`,
28
+ "",
29
+ ].join("\n");
30
+ }
@@ -0,0 +1,12 @@
1
+ import { type FromTfContext } from "../../engine/pull/context.js";
2
+ import { type TfBlock } from "../../engine/tf/index.js";
3
+ export interface NormalizedAgentEvaluation {
4
+ readonly refName: string;
5
+ readonly name: string;
6
+ readonly prompt: string;
7
+ readonly connectorKey: string;
8
+ readonly passingThreshold: number;
9
+ }
10
+ export declare function agentEvaluationFromTf(block: TfBlock, opts: {
11
+ readonly appLabel: string;
12
+ }, ctx: FromTfContext): NormalizedAgentEvaluation | undefined;
@@ -0,0 +1,46 @@
1
+ import { dataRefLabel, resourceRefLabel, } from "../../engine/pull/context.js";
2
+ import { scopedLabelToBagKey } from "../../engine/tf/index.js";
3
+ import { APP_RESOURCE_TYPE } from "../app/module.js";
4
+ import { connectorIdentityFromTf } from "../shared/connector-from-tf.js";
5
+ const KNOWN_ATTRS = new Set([
6
+ "app_id",
7
+ "name",
8
+ "prompt",
9
+ "ai_provider_connector_id",
10
+ "passing_threshold",
11
+ ]);
12
+ export function agentEvaluationFromTf(block, opts, ctx) {
13
+ const label = block.label ?? "";
14
+ const where = `agent evaluation "${label}"`;
15
+ for (const key of Object.keys(block.attrs)) {
16
+ if (!KNOWN_ATTRS.has(key)) {
17
+ ctx.diagnostics.push(`${where}: unhandled attribute "${key}" — extend agentEvaluationFromTf deliberately`);
18
+ }
19
+ }
20
+ if (resourceRefLabel(block.attrs["app_id"], APP_RESOURCE_TYPE) !== opts.appLabel) {
21
+ ctx.diagnostics.push(`${where}: app_id does not reference ${APP_RESOURCE_TYPE}.${opts.appLabel}; skipped`);
22
+ return undefined;
23
+ }
24
+ const connectorLabel = dataRefLabel(block.attrs["ai_provider_connector_id"], "elementum_ai_provider_connector");
25
+ const connectorKey = connectorLabel === undefined
26
+ ? undefined
27
+ : connectorIdentityFromTf("elementum_ai_provider_connector", connectorLabel, ctx).catalogKey;
28
+ if (connectorLabel === undefined || connectorKey === undefined) {
29
+ ctx.diagnostics.push(`${where}: ai_provider_connector_id is not a resolvable AI-service data reference; skipped`);
30
+ return undefined;
31
+ }
32
+ const name = block.attrs["name"];
33
+ const prompt = block.attrs["prompt"];
34
+ const passingThreshold = block.attrs["passing_threshold"];
35
+ if (typeof name !== "string" || typeof prompt !== "string" || typeof passingThreshold !== "number") {
36
+ ctx.diagnostics.push(`${where}: name, prompt, and passing_threshold must be literal values; skipped`);
37
+ return undefined;
38
+ }
39
+ return {
40
+ refName: scopedLabelToBagKey(opts.appLabel, label, "app"),
41
+ name,
42
+ prompt,
43
+ connectorKey,
44
+ passingThreshold,
45
+ };
46
+ }
@@ -0,0 +1 @@
1
+ export { agentEvaluation, type AgentEvaluationConfigured, type AgentEvaluationOptions, } from "./build.js";
@@ -0,0 +1 @@
1
+ export { agentEvaluation, } from "./build.js";
@@ -0,0 +1,3 @@
1
+ import { type EntityKindModule } from "../../graph/types.js";
2
+ export declare const AGENT_EVALUATION_RESOURCE_TYPE = "elementum_agent_evaluation";
3
+ export declare const agentEvaluationModule: EntityKindModule;
@@ -0,0 +1,58 @@
1
+ import { bareFactoryEntry } from "../../catalog/render-helpers.js";
2
+ import { NO_CANVAS } from "../../graph/types.js";
3
+ import { printAgentEvaluation } from "./deserializer/print-agent-evaluation.js";
4
+ import { agentEvaluationFromTf } from "./from-tf.js";
5
+ import { agentEvaluationToTf } from "./to-tf.js";
6
+ export const AGENT_EVALUATION_RESOURCE_TYPE = "elementum_agent_evaluation";
7
+ function stubRef(refName, parent) {
8
+ return { __kind: "agent-evaluation", refName, name: refName, parent };
9
+ }
10
+ function refFromAuthoring(args) {
11
+ const configured = args.defaultExport;
12
+ return typeof configured?.ref === "function" ? configured.ref(args.refName) : undefined;
13
+ }
14
+ export const agentEvaluationModule = {
15
+ kind: "agent-evaluation",
16
+ stream: { role: "streamMember" },
17
+ authoring: { unit: "ownFile", bag: "evaluations" },
18
+ parents: [{ parent: "app", child: "agent-evaluation" }],
19
+ resource: { shape: "single", resourceType: AGENT_EVALUATION_RESOURCE_TYPE, adoptable: true },
20
+ data: { participates: false },
21
+ lifecycle: {
22
+ participates: true,
23
+ extractOwnFile: (ownBlocks, _stream, ctx) => {
24
+ const items = [];
25
+ for (const block of ownBlocks) {
26
+ const evaluation = agentEvaluationFromTf(block, { appLabel: ctx.appTfLabel }, ctx);
27
+ if (evaluation !== undefined)
28
+ items.push(evaluation);
29
+ }
30
+ return { items, skipped: [], diagnostics: [] };
31
+ },
32
+ printOwnFile: (item, opts) => {
33
+ const evaluation = item;
34
+ return {
35
+ refName: evaluation.refName,
36
+ source: printAgentEvaluation(evaluation, { appRefName: opts.appRefName }),
37
+ };
38
+ },
39
+ toTf: (entity, ctx) => agentEvaluationToTf(entity, {
40
+ appRefName: ctx.appRefName,
41
+ appTfLabel: ctx.appTfLabel,
42
+ orgRefs: ctx.orgRefs,
43
+ diagnostics: ctx.diagnostics,
44
+ }),
45
+ },
46
+ canvas: NO_CANVAS,
47
+ catalog: {
48
+ participates: true,
49
+ refKind: "agent-evaluation",
50
+ catalogBag: "evaluations",
51
+ renderOrder: 64,
52
+ catalogRoot: "app",
53
+ factoryName: "agentEvaluationRef",
54
+ renderEntry: ({ keyName, baseIndent }) => bareFactoryEntry("agentEvaluationRef", keyName, baseIndent),
55
+ stubRef,
56
+ refFromAuthoring,
57
+ },
58
+ };
@@ -0,0 +1,12 @@
1
+ import type { OrgRefLookup } from "../../engine/build/context.js";
2
+ import { type DeployableEntity } from "../../engine/entity.js";
3
+ import { type TfBlock } from "../../engine/tf/index.js";
4
+ export declare function agentEvaluationToTf(entity: DeployableEntity, opts: {
5
+ readonly appRefName: string;
6
+ readonly appTfLabel: string;
7
+ readonly orgRefs: OrgRefLookup;
8
+ readonly diagnostics: string[];
9
+ }): {
10
+ readonly blocks: readonly TfBlock[];
11
+ readonly address: string;
12
+ };
@@ -0,0 +1,35 @@
1
+ import { EntityTfError } from "../../engine/entity.js";
2
+ import { expr, scopedResourceLabel, tsLabelToTfLabel } from "../../engine/tf/index.js";
3
+ import { APP_RESOURCE_TYPE } from "../app/module.js";
4
+ import { CONNECTOR_ORG_BAG } from "../org/connector.js";
5
+ import { AGENT_EVALUATION_RESOURCE_TYPE } from "./module.js";
6
+ export function agentEvaluationToTf(entity, opts) {
7
+ if (entity.kind !== "agent-evaluation") {
8
+ throw new EntityTfError(`agentEvaluationToTf expects kind "agent-evaluation"; got "${entity.kind}"`);
9
+ }
10
+ const evaluation = entity.payload;
11
+ if (evaluation === null || evaluation.app?.refName !== opts.appRefName) {
12
+ throw new EntityTfError(`agent evaluation "${entity.refName}" does not reference owning app "${opts.appRefName}"`);
13
+ }
14
+ const connectorKey = evaluation.connector?.parent !== undefined
15
+ ? `${evaluation.connector.parent}.${evaluation.connector.refName ?? ""}`
16
+ : evaluation.connector?.refName ?? "";
17
+ const connector = opts.orgRefs.byTsLabel(CONNECTOR_ORG_BAG, connectorKey);
18
+ if (connector === undefined) {
19
+ throw new EntityTfError(`agent evaluation "${entity.refName}": connector token "${connectorKey}" is not in the org catalog — re-run \`elementum pull org --data-only\``);
20
+ }
21
+ const label = scopedResourceLabel(opts.appTfLabel, tsLabelToTfLabel(entity.refName), "app");
22
+ const block = {
23
+ kind: "resource",
24
+ type: AGENT_EVALUATION_RESOURCE_TYPE,
25
+ label,
26
+ attrs: {
27
+ app_id: expr.resourceAttr(APP_RESOURCE_TYPE, opts.appTfLabel, ["id"]),
28
+ name: evaluation.name ?? "",
29
+ prompt: evaluation.prompt ?? "",
30
+ ai_provider_connector_id: expr.dataAttr("elementum_ai_provider_connector", connector.tfLabel, ["id"]),
31
+ passing_threshold: evaluation.passingThreshold ?? 0,
32
+ },
33
+ };
34
+ return { blocks: [block], address: `${AGENT_EVALUATION_RESOURCE_TYPE}.${label}` };
35
+ }
@@ -6,6 +6,7 @@
6
6
  */
7
7
  import { type FromTfContext } from "../../engine/pull/context.js";
8
8
  import { type TfBlock } from "../../engine/tf/index.js";
9
+ import type { AgentToolRunAs } from "../agent/tools.js";
9
10
  export interface NormalizedToolField {
10
11
  /** The field's bag key in the TARGET aspect's `fields: {}` (bijective image of its label). Mutually exclusive with `rawFieldId`. */
11
12
  readonly key?: string;
@@ -20,14 +21,13 @@ export interface NormalizedToolField {
20
21
  readonly name?: string;
21
22
  readonly description?: string;
22
23
  readonly required?: boolean;
24
+ readonly defaultValue?: string;
23
25
  }
24
26
  /**
25
- * searchTable's own field shapes. Unlike createRecord/searchAspect/
26
- * updateRecord, field_id here is NEVER a resource reference — confirmed
27
- * live, 161/161 field_id values across every real elementum_agent_ai_search_tool
28
- * capture are raw strings. These describe columns of the search table's own
29
- * schema, not app/element fields, so there's no `elementum_*_field` resource
30
- * (and therefore no catalog bag key) to resolve them to.
27
+ * searchTable's own field shapes. The provider export carries field_id as a
28
+ * raw string (confirmed live across the captured resources), so this pass
29
+ * preserves it. Recursive app pull resolves known ids through its dependency
30
+ * field registry before printing authored source.
31
31
  */
32
32
  export interface NormalizedSearchTableField {
33
33
  readonly fieldId: string;
@@ -64,14 +64,19 @@ export interface NormalizedExecuteWorkflowOutput {
64
64
  readonly name?: string;
65
65
  readonly description?: string;
66
66
  }
67
+ export interface NormalizedMcpHeader {
68
+ readonly key: string;
69
+ readonly value: string;
70
+ }
67
71
  export interface NormalizedAgentTool {
68
- readonly typeKey: "createRecord" | "searchAspect" | "updateRecord" | "executeWorkflow" | "searchTable";
72
+ readonly typeKey: "createRecord" | "searchAspect" | "updateRecord" | "executeWorkflow" | "searchTable" | "relateRecord" | "runAgent" | "mcp";
69
73
  readonly name: string;
70
74
  readonly description: string;
71
75
  readonly startMessage?: string;
76
+ readonly runAs?: AgentToolRunAs;
72
77
  /** absent for executeWorkflow — its target is an automation, not an aspect. searchTable's target is also optional. */
73
78
  readonly target?: NormalizedToolTarget;
74
- /** createRecord/searchAspect/updateRecord only — searchTable's own field shapes never resolve to a catalog key, see below. */
79
+ /** createRecord/searchAspect/updateRecord only; searchTable ids are upgraded later by recursive pull. */
75
80
  readonly fields?: readonly NormalizedToolField[];
76
81
  /** searchTable's newer field shape (field_id/name/description) — mutually exclusive with `returnFields`. */
77
82
  readonly searchTableFields?: readonly NormalizedSearchTableField[];
@@ -85,13 +90,18 @@ export interface NormalizedAgentTool {
85
90
  readonly automationKey?: string;
86
91
  readonly inputs?: readonly NormalizedExecuteWorkflowInput[];
87
92
  readonly outputs?: readonly NormalizedExecuteWorkflowOutput[];
88
- /**
89
- * searchTable's search_table_id. Always a raw platform id on the wire —
90
- * confirmed live, ei's own export never resolves it to a reference (it
91
- * writes a bare id with a "# TODO: Replace with data source or variable"
92
- * comment), so there is no data-source lookup to reconstruct here.
93
- */
94
- readonly searchTableId?: string;
93
+ /** Search-table bag key when the table is a pulled resource. */
94
+ readonly searchTableKey?: string;
95
+ /** Stable lookup name when the table is resolved through a data source. */
96
+ readonly searchTableName?: string;
97
+ /** relateRecord: the aspect whose record is related to the primary target. */
98
+ readonly relatedTarget?: NormalizedToolTarget;
99
+ /** runAgent: target agent bag key within the owning app. */
100
+ readonly targetAgentKey?: string;
101
+ readonly workerTaskPrompt?: string;
102
+ readonly serverUrl?: string;
103
+ readonly mcpToolName?: string;
104
+ readonly headers?: readonly NormalizedMcpHeader[];
95
105
  }
96
106
  export interface ToolOwner {
97
107
  /** The owning app's resource type + tfLabel. */
@@ -5,10 +5,49 @@
5
5
  * agent or app resource types.
6
6
  */
7
7
  import { EntityTfError } from "../../engine/entity.js";
8
- import { optionalString, resourceRefLabel } from "../../engine/pull/context.js";
9
- import { isTfExpr, scopedLabelToBagKey } from "../../engine/tf/index.js";
8
+ import { dataRefLabel, optionalString, resourceRefLabel } from "../../engine/pull/context.js";
9
+ import { isTfExpr, scopedLabelToBagKey, scopedResourceLabel, tsLabelToTfLabel } from "../../engine/tf/index.js";
10
10
  import { resolveToolFieldKey } from "../shared/tool-field-ref.js";
11
11
  import { KNOWN_TOOL_ATTRS, TOOL_SUB_TYPE_BY_RESOURCE } from "./types.js";
12
+ function runAsFromTf(attrs, owner, where, ctx) {
13
+ const value = optionalString(attrs, "run_as", where, ctx);
14
+ if (value === "current_user")
15
+ return { currentUser: true };
16
+ if (value === "publisher")
17
+ return { publisher: true };
18
+ if (value === "service_account") {
19
+ const dataLabel = dataRefLabel(attrs["service_account_id"], "elementum_service_account");
20
+ if (dataLabel !== undefined) {
21
+ const name = ctx.dataName("elementum_service_account", dataLabel);
22
+ if (name !== undefined && name !== "") {
23
+ return { serviceAccount: { __kind: "serviceAccount", appRefName: owner.appLabel, name } };
24
+ }
25
+ ctx.diagnostics.push(`${where}: service_account_id references data.elementum_service_account.${dataLabel}, but the stream has no matching named data block; dropped`);
26
+ return undefined;
27
+ }
28
+ const resourceLabel = resourceRefLabel(attrs["service_account_id"], "elementum_service_account");
29
+ const imported = typeof attrs["service_account_id"] === "string"
30
+ ? ctx.importedResource?.(attrs["service_account_id"])
31
+ : undefined;
32
+ const account = resourceLabel !== undefined
33
+ ? ctx.resourceByAddress?.(`elementum_service_account.${resourceLabel}`)
34
+ : imported?.type === "elementum_service_account" ? imported : undefined;
35
+ const explicitName = account?.attrs["name"];
36
+ const firstName = account?.attrs["first_name"];
37
+ const lastName = account?.attrs["last_name"];
38
+ const name = typeof explicitName === "string" && explicitName !== ""
39
+ ? explicitName
40
+ : typeof firstName === "string" && typeof lastName === "string" ? `${firstName} ${lastName}` : undefined;
41
+ if (name !== undefined) {
42
+ return { serviceAccount: { __kind: "serviceAccount", appRefName: owner.appLabel, name } };
43
+ }
44
+ ctx.diagnostics.push(`${where}: service_account_id is not a named data.elementum_service_account reference; use a serviceAccountRef({ app, name }); dropped`);
45
+ return undefined;
46
+ }
47
+ if (value !== undefined)
48
+ ctx.diagnostics.push(`${where}: unsupported run_as ${JSON.stringify(value)}; dropped`);
49
+ return undefined;
50
+ }
12
51
  /**
13
52
  * One tool block → its normalized shape; undefined = skipped with a
14
53
  * diagnostic (unimplemented sub-type, wrong owner, unresolvable target).
@@ -27,7 +66,9 @@ export function toolFromTf(block, owner, ctx) {
27
66
  const name = optionalString(attrs, "name", `tool "${label}"`, ctx) ?? "";
28
67
  const where = `agent tool "${name}" (${block.type}.${label})`;
29
68
  if (subType.implemented !== true) {
30
- ctx.diagnostics.push(`${where}: tool kind is not supported on the terraform path yet; skipped`);
69
+ ctx.diagnostics.push(subType.typeKey === "selectBotRoute"
70
+ ? `${where}: select-bot-route is a platform-internal Nexus routing tool and is not part of the public EDK; skipped`
71
+ : `${where}: tool kind is not supported on the terraform path yet; skipped`);
31
72
  return undefined;
32
73
  }
33
74
  const known = KNOWN_TOOL_ATTRS[subType.typeKey];
@@ -43,6 +84,60 @@ export function toolFromTf(block, owner, ctx) {
43
84
  if (subType.typeKey === "executeWorkflow") {
44
85
  return executeWorkflowFromTf(block, name, where, owner, ctx);
45
86
  }
87
+ const startMessage = optionalString(attrs, "start_message", where, ctx);
88
+ const runAs = runAsFromTf(attrs, owner, where, ctx);
89
+ const common = {
90
+ name,
91
+ description: optionalString(attrs, "description", where, ctx) ?? "",
92
+ ...(startMessage !== undefined && { startMessage }),
93
+ ...(runAs !== undefined && { runAs }),
94
+ };
95
+ if (subType.typeKey === "runAgent") {
96
+ const targetLabel = resourceRefLabel(attrs["target_agent_id"], "elementum_agent");
97
+ if (targetLabel === undefined) {
98
+ ctx.diagnostics.push(`${where}: target_agent_id is not an elementum_agent resource reference; skipped`);
99
+ return undefined;
100
+ }
101
+ const targetAgentKey = scopedLabelToBagKey(owner.ownerTfLabel, targetLabel);
102
+ if (scopedResourceLabel(owner.ownerTfLabel, tsLabelToTfLabel(targetAgentKey), "app") !== targetLabel) {
103
+ ctx.diagnostics.push(`${where}: cross-app run-agent targets are not supported; skipped`);
104
+ return undefined;
105
+ }
106
+ return {
107
+ typeKey: "runAgent",
108
+ ...common,
109
+ targetAgentKey,
110
+ workerTaskPrompt: optionalString(attrs, "worker_task_prompt", where, ctx) ?? "",
111
+ };
112
+ }
113
+ if (subType.typeKey === "mcp") {
114
+ const serverUrl = optionalString(attrs, "server_url", where, ctx);
115
+ const mcpToolName = optionalString(attrs, "mcp_tool_name", where, ctx);
116
+ if (serverUrl === undefined || serverUrl === "" || mcpToolName === undefined || mcpToolName === "") {
117
+ ctx.diagnostics.push(`${where}: server_url or mcp_tool_name is missing; skipped`);
118
+ return undefined;
119
+ }
120
+ const headers = [];
121
+ const rawHeaders = attrs["headers"];
122
+ if (Array.isArray(rawHeaders)) {
123
+ for (const item of rawHeaders) {
124
+ if (typeof item !== "object" || item === null || Array.isArray(item) || isTfExpr(item)) {
125
+ ctx.diagnostics.push(`${where}: headers item has an unrecognized shape; dropped`);
126
+ continue;
127
+ }
128
+ const rec = item;
129
+ if (typeof rec["key"] !== "string" || typeof rec["value"] !== "string") {
130
+ ctx.diagnostics.push(`${where}: headers item is missing key or value; dropped`);
131
+ continue;
132
+ }
133
+ headers.push({ key: rec["key"], value: rec["value"] });
134
+ }
135
+ }
136
+ else if (rawHeaders !== undefined) {
137
+ ctx.diagnostics.push(`${where}: headers is not a list; dropped`);
138
+ }
139
+ return { typeKey: "mcp", ...common, serverUrl, mcpToolName, ...(headers.length > 0 && { headers }) };
140
+ }
46
141
  // Target: the owning app's resource ref = self; a data.elementum_app ref =
47
142
  // a foreign app, resolved to its display name via the stream's data block.
48
143
  // searchTable is the one sub-type where target_id can be absent entirely
@@ -64,35 +159,12 @@ export function toolFromTf(block, owner, ctx) {
64
159
  }
65
160
  }
66
161
  else {
67
- const selfLabel = resourceRefLabel(targetAttr, owner.appType);
68
- if (selfLabel === owner.appLabel) {
69
- target = { kind: "self" };
70
- }
71
- else if (isTfExpr(targetAttr) && targetAttr.$expr === "data-attr" && targetAttr.type === "elementum_app") {
72
- const appName = ctx.dataName("elementum_app", targetAttr.label);
73
- if (appName === undefined) {
74
- ctx.diagnostics.push(`${where}: target_id references data.elementum_app.${targetAttr.label} but the stream has no such data block; skipped`);
75
- return undefined;
76
- }
77
- target = { kind: "foreignApp", name: appName };
78
- fieldScopeLabel = targetAttr.label;
79
- }
80
- else if (isTfExpr(targetAttr) && targetAttr.$expr === "data-attr" && targetAttr.type === "elementum_element") {
81
- // Board issue #42: an aspect target can be an element, not just an app —
82
- // same shape as the foreignApp branch, just the other data type.
83
- const elementName = ctx.dataName("elementum_element", targetAttr.label);
84
- if (elementName === undefined) {
85
- ctx.diagnostics.push(`${where}: target_id references data.elementum_element.${targetAttr.label} but the stream has no such data block; skipped`);
86
- return undefined;
87
- }
88
- target = { kind: "foreignElement", name: elementName };
89
- fieldScopeLabel = targetAttr.label;
90
- fieldScope = "element";
91
- }
92
- else {
93
- ctx.diagnostics.push(`${where}: target_id has an unrecognized shape (${JSON.stringify(targetAttr)}); skipped`);
162
+ const resolved = aspectTargetFromTf(targetAttr, "target_id", owner, ctx, where);
163
+ if (resolved === undefined)
94
164
  return undefined;
95
- }
165
+ target = resolved.target;
166
+ fieldScopeLabel = resolved.fieldScopeLabel;
167
+ fieldScope = resolved.fieldScope;
96
168
  }
97
169
  let fields;
98
170
  let searchTableFields;
@@ -142,6 +214,7 @@ export function toolFromTf(block, owner, ctx) {
142
214
  ...(typeof rec["name"] === "string" && { name: rec["name"] }),
143
215
  ...(typeof rec["description"] === "string" && { description: rec["description"] }),
144
216
  ...(typeof rec["required"] === "boolean" && { required: rec["required"] }),
217
+ ...(typeof rec["default_value"] === "string" && { defaultValue: rec["default_value"] }),
145
218
  });
146
219
  }
147
220
  if (fields.length === 0)
@@ -151,11 +224,9 @@ export function toolFromTf(block, owner, ctx) {
151
224
  else if (rawFields !== undefined) {
152
225
  ctx.diagnostics.push(`${where}: fields is not a list; dropped`);
153
226
  }
154
- // searchTable's field_id is ALWAYS a raw platform id, never a resource
155
- // reference (confirmed live, 161/161 real captures) — these describe
156
- // columns of the search table's own schema, not app/element fields, so
157
- // there's no elementum_*_field resource (and no catalog bag key) to
158
- // resolve them to.
227
+ // The provider export normalizes searchTable field_id to a raw platform id.
228
+ // Preserve it here; the recursive pull printer can upgrade known ids using
229
+ // the target element's dependency field registry.
159
230
  let returnFields;
160
231
  const rawReturnFields = attrs["return_fields"];
161
232
  if (Array.isArray(rawReturnFields)) {
@@ -185,13 +256,49 @@ export function toolFromTf(block, owner, ctx) {
185
256
  if (subType.typeKey === "searchAspect" && attrs["filter_variables"] !== undefined) {
186
257
  ctx.diagnostics.push(`${where}: filter_variables are not supported on the terraform path yet; a rebuilt stream will omit them`);
187
258
  }
188
- const startMessage = optionalString(attrs, "start_message", where, ctx);
259
+ let searchTableKey;
260
+ let searchTableName;
261
+ if (subType.typeKey === "searchTable") {
262
+ const value = attrs["search_table_id"];
263
+ const resourceTypes = ["elementum_ai_search_table", "elementum_linked_ai_search_table", "elementum_table_search_table"];
264
+ const matched = resourceTypes
265
+ .map((type) => ({ type, label: resourceRefLabel(value, type) }))
266
+ .find((candidate) => candidate.label !== undefined);
267
+ if (matched?.label !== undefined) {
268
+ // A managed or linked search table is owned by an ELEMENT, so its label
269
+ // carries the `elements_<ns>_` prefix — decoding it with app scope leaves
270
+ // the prefix in place and camel-cases the whole label into a bag key that
271
+ // matches nothing. The table variant keeps its existing app-scope
272
+ // handling: a table-owned search table reached through a tool is not
273
+ // modelled end to end yet.
274
+ const scope = matched.type === "elementum_table_search_table" ? "app" : "element";
275
+ searchTableKey = scopedLabelToBagKey(owner.ownerTfLabel, matched.label, scope);
276
+ }
277
+ else if (isTfExpr(value) && value.$expr === "data-attr" && value.type === "elementum_search_table") {
278
+ searchTableName = ctx.dataName(value.type, value.label);
279
+ if (searchTableName === undefined) {
280
+ ctx.diagnostics.push(`${where}: search_table_id references data.${value.type}.${value.label} without a matching name lookup; skipped`);
281
+ return undefined;
282
+ }
283
+ }
284
+ else {
285
+ ctx.diagnostics.push(`${where}: search_table_id is not a supported search-table reference; skipped`);
286
+ return undefined;
287
+ }
288
+ }
289
+ let relatedTarget;
290
+ if (subType.typeKey === "relateRecord") {
291
+ const relatedAttr = attrs["related_target_id"];
292
+ const resolved = aspectTargetFromTf(relatedAttr, "related_target_id", owner, ctx, where);
293
+ if (resolved === undefined)
294
+ return undefined;
295
+ relatedTarget = resolved.target;
296
+ }
189
297
  return {
190
298
  typeKey: subType.typeKey,
191
- name,
192
- description: optionalString(attrs, "description", where, ctx) ?? "",
193
- ...(startMessage !== undefined && { startMessage }),
299
+ ...common,
194
300
  ...(target !== undefined && { target }),
301
+ ...(relatedTarget !== undefined && { relatedTarget }),
195
302
  ...(fields !== undefined && { fields }),
196
303
  ...(searchTableFields !== undefined && { searchTableFields }),
197
304
  ...(returnFields !== undefined && { returnFields }),
@@ -202,11 +309,34 @@ export function toolFromTf(block, owner, ctx) {
202
309
  ...(subType.typeKey === "updateRecord" && {
203
310
  handleDescription: optionalString(attrs, "handle_description", where, ctx) ?? "",
204
311
  }),
205
- ...(subType.typeKey === "searchTable" && typeof attrs["search_table_id"] === "string" && {
206
- searchTableId: attrs["search_table_id"],
207
- }),
312
+ ...(searchTableKey !== undefined && { searchTableKey }),
313
+ ...(searchTableName !== undefined && { searchTableName }),
208
314
  };
209
315
  }
316
+ function aspectTargetFromTf(value, attrName, owner, ctx, where) {
317
+ if (value === undefined) {
318
+ ctx.diagnostics.push(`${where}: ${attrName} is missing; skipped`);
319
+ return undefined;
320
+ }
321
+ if (value !== undefined && resourceRefLabel(value, owner.appType) === owner.appLabel) {
322
+ return { target: { kind: "self" }, fieldScopeLabel: owner.ownerTfLabel, fieldScope: "app" };
323
+ }
324
+ for (const [type, kind, scope] of [
325
+ ["elementum_app", "foreignApp", "app"],
326
+ ["elementum_element", "foreignElement", "element"],
327
+ ]) {
328
+ if (!isTfExpr(value) || value.$expr !== "data-attr" || value.type !== type)
329
+ continue;
330
+ const name = ctx.dataName(type, value.label);
331
+ if (name === undefined) {
332
+ ctx.diagnostics.push(`${where}: ${attrName} references data.${type}.${value.label} but the stream has no such data block; skipped`);
333
+ return undefined;
334
+ }
335
+ return { target: { kind, name }, fieldScopeLabel: value.label, fieldScope: scope };
336
+ }
337
+ ctx.diagnostics.push(`${where}: ${attrName} has an unrecognized shape (${JSON.stringify(value)}); skipped`);
338
+ return undefined;
339
+ }
210
340
  /**
211
341
  * Run-automation (executeWorkflow) tool extraction. `automation_id` may
212
342
  * reference the publish block (ei's uuid→ref winner — the publish import is
@@ -253,11 +383,13 @@ function executeWorkflowFromTf(block, name, where, owner, ctx) {
253
383
  });
254
384
  }
255
385
  const startMessage = optionalString(attrs, "start_message", where, ctx);
386
+ const runAs = runAsFromTf(attrs, owner, where, ctx);
256
387
  return {
257
388
  typeKey: "executeWorkflow",
258
389
  name,
259
390
  description: optionalString(attrs, "description", where, ctx) ?? "",
260
391
  ...(startMessage !== undefined && { startMessage }),
392
+ ...(runAs !== undefined && { runAs }),
261
393
  automationKey: scopedLabelToBagKey(owner.ownerTfLabel, autoLabel),
262
394
  ...(inputs.length > 0 && { inputs }),
263
395
  ...(outputs.length > 0 && { outputs }),