@elementumai/edk 0.9.2 → 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 (296) hide show
  1. package/README.md +34 -26
  2. package/dist-sdk/elementum-entity-client/clients/automation/models/automation.d.ts +1 -1
  3. package/dist-sdk/elementum-entity-client/clients/skills/models/skill.d.ts +1 -1
  4. package/dist-sdk/elementum-entity-client/clients/skills/models/skill.js +1 -1
  5. package/dist-sdk/pull/util.d.ts +1 -1
  6. package/dist-sdk/pull/util.js +3 -3
  7. package/dist-sdk/src/catalog/factories.d.ts +49 -10
  8. package/dist-sdk/src/catalog/factories.js +94 -13
  9. package/dist-sdk/src/catalog/from-authoring.d.ts +5 -5
  10. package/dist-sdk/src/catalog/from-authoring.js +7 -7
  11. package/dist-sdk/src/catalog/index.d.ts +2 -2
  12. package/dist-sdk/src/catalog/index.js +1 -1
  13. package/dist-sdk/src/catalog/org.js +62 -4
  14. package/dist-sdk/src/catalog/render-helpers.d.ts +1 -1
  15. package/dist-sdk/src/catalog/render-helpers.js +1 -1
  16. package/dist-sdk/src/catalog/render.d.ts +1 -0
  17. package/dist-sdk/src/catalog/render.js +2 -2
  18. package/dist-sdk/src/catalog/token.js +11 -4
  19. package/dist-sdk/src/catalog/types.d.ts +33 -4
  20. package/dist-sdk/src/catalog/types.js +5 -0
  21. package/dist-sdk/src/core/index.d.ts +10 -10
  22. package/dist-sdk/src/core/index.js +9 -9
  23. package/dist-sdk/src/core/render-tree.d.ts +1 -1
  24. package/dist-sdk/src/core/render-tree.js +1 -2
  25. package/dist-sdk/src/core/types/ai-provider.d.ts +1 -1
  26. package/dist-sdk/src/core/types/ai-provider.js +1 -1
  27. package/dist-sdk/src/core/types/app.d.ts +66 -30
  28. package/dist-sdk/src/core/types/app.js +2 -2
  29. package/dist-sdk/src/core/types/aspect-category.d.ts +4 -4
  30. package/dist-sdk/src/core/types/aspect-category.js +4 -4
  31. package/dist-sdk/src/core/types/cloud-link.d.ts +3 -3
  32. package/dist-sdk/src/core/types/cloud-link.js +3 -3
  33. package/dist-sdk/src/core/types/display-block.d.ts +2 -2
  34. package/dist-sdk/src/core/types/display-block.js +2 -2
  35. package/dist-sdk/src/core/types/group.d.ts +1 -1
  36. package/dist-sdk/src/core/types/group.js +1 -1
  37. package/dist-sdk/src/core/types/user.d.ts +1 -1
  38. package/dist-sdk/src/core/types/user.js +1 -1
  39. package/dist-sdk/src/core/wire/ref-serializer.js +3 -3
  40. package/dist-sdk/src/engine/build/context.d.ts +20 -13
  41. package/dist-sdk/src/engine/entity.d.ts +1 -1
  42. package/dist-sdk/src/engine/pull/context.d.ts +34 -0
  43. package/dist-sdk/src/engine/pull/context.js +14 -0
  44. package/dist-sdk/src/engine/pull/org.d.ts +9 -0
  45. package/dist-sdk/src/engine/pull/org.js +33 -0
  46. package/dist-sdk/src/engine/pull/ref-only.d.ts +37 -0
  47. package/dist-sdk/src/engine/pull/ref-only.js +204 -0
  48. package/dist-sdk/src/engine/tf/expr.d.ts +6 -2
  49. package/dist-sdk/src/engine/tf/expr.js +18 -13
  50. package/dist-sdk/src/engine/tf/index.d.ts +1 -1
  51. package/dist-sdk/src/engine/tf/index.js +1 -1
  52. package/dist-sdk/src/engine/tf/model.d.ts +8 -1
  53. package/dist-sdk/src/engine/tf/model.js +4 -0
  54. package/dist-sdk/src/engine/tf/parse.js +13 -2
  55. package/dist-sdk/src/engine/tf/render.js +4 -0
  56. package/dist-sdk/src/entities/access-policy/build.d.ts +4 -5
  57. package/dist-sdk/src/entities/access-policy/build.js +1 -1
  58. package/dist-sdk/src/entities/access-policy/from-tf.d.ts +4 -4
  59. package/dist-sdk/src/entities/access-policy/from-tf.js +12 -13
  60. package/dist-sdk/src/entities/access-policy/principal.d.ts +14 -4
  61. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +14 -2
  62. package/dist-sdk/src/entities/access-policy/to-tf.js +36 -6
  63. package/dist-sdk/src/entities/agent/build.d.ts +3 -3
  64. package/dist-sdk/src/entities/agent/build.js +5 -5
  65. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +6 -1
  66. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +68 -18
  67. package/dist-sdk/src/entities/agent/from-tf.d.ts +3 -1
  68. package/dist-sdk/src/entities/agent/from-tf.js +12 -4
  69. package/dist-sdk/src/entities/agent/index.d.ts +2 -2
  70. package/dist-sdk/src/entities/agent/index.js +1 -1
  71. package/dist-sdk/src/entities/agent/module.js +2 -0
  72. package/dist-sdk/src/entities/agent/to-tf.d.ts +5 -2
  73. package/dist-sdk/src/entities/agent/to-tf.js +56 -8
  74. package/dist-sdk/src/entities/agent/tools.d.ts +38 -23
  75. package/dist-sdk/src/entities/agent/tools.js +21 -7
  76. package/dist-sdk/src/entities/agent-evaluation/build.d.ts +19 -0
  77. package/dist-sdk/src/entities/agent-evaluation/build.js +41 -0
  78. package/dist-sdk/src/entities/agent-evaluation/deserializer/print-agent-evaluation.d.ts +4 -0
  79. package/dist-sdk/src/entities/agent-evaluation/deserializer/print-agent-evaluation.js +30 -0
  80. package/dist-sdk/src/entities/agent-evaluation/from-tf.d.ts +12 -0
  81. package/dist-sdk/src/entities/agent-evaluation/from-tf.js +46 -0
  82. package/dist-sdk/src/entities/agent-evaluation/index.d.ts +1 -0
  83. package/dist-sdk/src/entities/agent-evaluation/index.js +1 -0
  84. package/dist-sdk/src/entities/agent-evaluation/module.d.ts +3 -0
  85. package/dist-sdk/src/entities/agent-evaluation/module.js +58 -0
  86. package/dist-sdk/src/entities/agent-evaluation/to-tf.d.ts +12 -0
  87. package/dist-sdk/src/entities/agent-evaluation/to-tf.js +35 -0
  88. package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +8 -7
  89. package/dist-sdk/src/entities/agent-tool/from-tf.js +48 -6
  90. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +10 -2
  91. package/dist-sdk/src/entities/agent-tool/to-tf.js +76 -28
  92. package/dist-sdk/src/entities/agent-tool/types.d.ts +0 -1
  93. package/dist-sdk/src/entities/agent-tool/types.js +10 -37
  94. package/dist-sdk/src/entities/app/build.d.ts +97 -42
  95. package/dist-sdk/src/entities/app/build.js +25 -14
  96. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +32 -24
  97. package/dist-sdk/src/entities/app/deserializer/pulled-expression.d.ts +1 -1
  98. package/dist-sdk/src/entities/app/deserializer/pulled-expression.js +2 -0
  99. package/dist-sdk/src/entities/app/index.d.ts +11 -8
  100. package/dist-sdk/src/entities/app/index.js +10 -7
  101. package/dist-sdk/src/entities/app/module.js +2 -2
  102. package/dist-sdk/src/entities/app/to-tf.d.ts +1 -1
  103. package/dist-sdk/src/entities/app/to-tf.js +22 -6
  104. package/dist-sdk/src/entities/approval-chain/build.d.ts +1 -1
  105. package/dist-sdk/src/entities/approval-chain/build.js +5 -5
  106. package/dist-sdk/src/entities/approval-chain/index.d.ts +1 -1
  107. package/dist-sdk/src/entities/approval-chain/index.js +1 -1
  108. package/dist-sdk/src/entities/approval-chain/printer.js +2 -2
  109. package/dist-sdk/src/entities/automation/build.d.ts +172 -94
  110. package/dist-sdk/src/entities/automation/build.js +159 -68
  111. package/dist-sdk/src/entities/automation/calculation-expression.d.ts +191 -0
  112. package/dist-sdk/src/entities/automation/calculation-expression.js +57 -0
  113. package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +11 -4
  114. package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +18 -14
  115. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +164 -198
  116. package/dist-sdk/src/entities/automation/from-tf.d.ts +26 -2
  117. package/dist-sdk/src/entities/automation/from-tf.js +510 -80
  118. package/dist-sdk/src/entities/automation/index.d.ts +9 -12
  119. package/dist-sdk/src/entities/automation/index.js +11 -13
  120. package/dist-sdk/src/entities/automation/module.js +74 -6
  121. package/dist-sdk/src/entities/automation/operators.d.ts +32 -48
  122. package/dist-sdk/src/entities/automation/operators.js +10 -37
  123. package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +1 -1
  124. package/dist-sdk/src/entities/automation/output-key-wire-name.js +1 -1
  125. package/dist-sdk/src/entities/automation/script-code.js +13 -22
  126. package/dist-sdk/src/entities/automation/serialize.js +1 -1
  127. package/dist-sdk/src/entities/automation/tasks.d.ts +153 -89
  128. package/dist-sdk/src/entities/automation/tasks.js +64 -11
  129. package/dist-sdk/src/entities/automation/to-tf.d.ts +10 -1
  130. package/dist-sdk/src/entities/automation/to-tf.js +342 -71
  131. package/dist-sdk/src/entities/automation/triggers.d.ts +17 -10
  132. package/dist-sdk/src/entities/automation/triggers.js +7 -1
  133. package/dist-sdk/src/entities/automation/types.d.ts +3 -2
  134. package/dist-sdk/src/entities/automation/types.js +3 -2
  135. package/dist-sdk/src/entities/chart/build.d.ts +95 -0
  136. package/dist-sdk/src/entities/chart/build.js +42 -0
  137. package/dist-sdk/src/entities/chart/from-tf.d.ts +55 -0
  138. package/dist-sdk/src/entities/chart/from-tf.js +269 -0
  139. package/dist-sdk/src/entities/chart/index.d.ts +4 -0
  140. package/dist-sdk/src/entities/chart/index.js +3 -0
  141. package/dist-sdk/src/entities/chart/module.d.ts +3 -0
  142. package/dist-sdk/src/entities/chart/module.js +61 -0
  143. package/dist-sdk/src/entities/chart/printer.d.ts +5 -0
  144. package/dist-sdk/src/entities/chart/printer.js +104 -0
  145. package/dist-sdk/src/entities/chart/to-tf.d.ts +15 -0
  146. package/dist-sdk/src/entities/chart/to-tf.js +150 -0
  147. package/dist-sdk/src/entities/chart/types.d.ts +53 -0
  148. package/dist-sdk/src/entities/chart/types.js +22 -0
  149. package/dist-sdk/src/entities/dashboard/build.d.ts +34 -7
  150. package/dist-sdk/src/entities/dashboard/build.js +16 -1
  151. package/dist-sdk/src/entities/dashboard/from-tf.js +22 -4
  152. package/dist-sdk/src/entities/dashboard/to-tf.d.ts +16 -3
  153. package/dist-sdk/src/entities/dashboard/to-tf.js +37 -10
  154. package/dist-sdk/src/entities/datamine/module.js +1 -1
  155. package/dist-sdk/src/entities/dynamic-layout/build.d.ts +4 -3
  156. package/dist-sdk/src/entities/dynamic-layout/build.js +1 -1
  157. package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +2 -0
  158. package/dist-sdk/src/entities/dynamic-layout/dialect.js +43 -5
  159. package/dist-sdk/src/entities/dynamic-layout/from-tf.js +12 -6
  160. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +10 -10
  161. package/dist-sdk/src/entities/element/build.d.ts +25 -32
  162. package/dist-sdk/src/entities/element/build.js +15 -32
  163. package/dist-sdk/src/entities/element/index.d.ts +7 -5
  164. package/dist-sdk/src/entities/element/index.js +7 -4
  165. package/dist-sdk/src/entities/element/module.js +7 -3
  166. package/dist-sdk/src/entities/element/to-tf.d.ts +2 -1
  167. package/dist-sdk/src/entities/element/to-tf.js +7 -3
  168. package/dist-sdk/src/entities/field/build.d.ts +51 -24
  169. package/dist-sdk/src/entities/field/build.js +31 -6
  170. package/dist-sdk/src/entities/field/calc/aggregate.d.ts +52 -21
  171. package/dist-sdk/src/entities/field/calc/aggregate.js +59 -29
  172. package/dist-sdk/src/entities/field/calc/date.d.ts +78 -29
  173. package/dist-sdk/src/entities/field/calc/date.js +120 -29
  174. package/dist-sdk/src/entities/field/calc/index.d.ts +80 -85
  175. package/dist-sdk/src/entities/field/calc/index.js +82 -139
  176. package/dist-sdk/src/entities/field/calc/numeric.d.ts +8 -12
  177. package/dist-sdk/src/entities/field/calc/numeric.js +10 -27
  178. package/dist-sdk/src/entities/field/calc/runtime.d.ts +19 -2
  179. package/dist-sdk/src/entities/field/calc/runtime.js +79 -8
  180. package/dist-sdk/src/entities/field/calc/text.d.ts +32 -23
  181. package/dist-sdk/src/entities/field/calc/text.js +43 -31
  182. package/dist-sdk/src/entities/field/calc/types.d.ts +36 -81
  183. package/dist-sdk/src/entities/field/calc/types.js +1 -22
  184. package/dist-sdk/src/entities/field/calc.d.ts +71 -48
  185. package/dist-sdk/src/entities/field/calc.js +5 -15
  186. package/dist-sdk/src/entities/field/calculation-types.js +10 -3
  187. package/dist-sdk/src/entities/field/from-tf.js +156 -10
  188. package/dist-sdk/src/entities/field/locals.d.ts +11 -3
  189. package/dist-sdk/src/entities/field/locals.js +15 -2
  190. package/dist-sdk/src/entities/field/module.js +23 -6
  191. package/dist-sdk/src/entities/field/record-shape.d.ts +24 -10
  192. package/dist-sdk/src/entities/field/to-tf.d.ts +40 -1
  193. package/dist-sdk/src/entities/field/to-tf.js +293 -35
  194. package/dist-sdk/src/entities/field/types.d.ts +1 -1
  195. package/dist-sdk/src/entities/field/types.js +7 -1
  196. package/dist-sdk/src/entities/file-reader/build.d.ts +5 -0
  197. package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.js +1 -1
  198. package/dist-sdk/src/entities/org/cloud-link.js +4 -5
  199. package/dist-sdk/src/entities/org/email-alias.d.ts +2 -0
  200. package/dist-sdk/src/entities/org/email-alias.js +12 -0
  201. package/dist-sdk/src/entities/org/index.d.ts +1 -0
  202. package/dist-sdk/src/entities/org/index.js +1 -0
  203. package/dist-sdk/src/entities/org/phone-provider.js +4 -7
  204. package/dist-sdk/src/entities/organization/build.d.ts +214 -2
  205. package/dist-sdk/src/entities/organization/build.js +145 -4
  206. package/dist-sdk/src/entities/organization/index.d.ts +1 -1
  207. package/dist-sdk/src/entities/organization/index.js +1 -1
  208. package/dist-sdk/src/entities/organization/module.js +4 -1
  209. package/dist-sdk/src/entities/organization/to-tf.d.ts +1 -0
  210. package/dist-sdk/src/entities/organization/to-tf.js +118 -1
  211. package/dist-sdk/src/entities/phone-service/build.d.ts +1 -1
  212. package/dist-sdk/src/entities/phone-service/build.js +2 -2
  213. package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.js +5 -3
  214. package/dist-sdk/src/entities/phone-service/index.d.ts +1 -1
  215. package/dist-sdk/src/entities/phone-service/index.js +1 -1
  216. package/dist-sdk/src/entities/phone-service/types.js +1 -1
  217. package/dist-sdk/src/entities/record-create-form/to-tf.js +9 -1
  218. package/dist-sdk/src/entities/relationship/to-tf.d.ts +1 -0
  219. package/dist-sdk/src/entities/relationship/to-tf.js +5 -13
  220. package/dist-sdk/src/entities/search-table/build.d.ts +4 -4
  221. package/dist-sdk/src/entities/search-table/build.js +13 -13
  222. package/dist-sdk/src/entities/search-table/index.d.ts +2 -2
  223. package/dist-sdk/src/entities/search-table/index.js +2 -2
  224. package/dist-sdk/src/entities/search-table/printer.js +5 -5
  225. package/dist-sdk/src/entities/service-account/to-tf.d.ts +21 -0
  226. package/dist-sdk/src/entities/service-account/to-tf.js +32 -1
  227. package/dist-sdk/src/entities/shared/context.d.ts +25 -24
  228. package/dist-sdk/src/entities/shared/context.js +36 -35
  229. package/dist-sdk/src/entities/shared/filters/ast.d.ts +10 -3
  230. package/dist-sdk/src/entities/shared/filters/ast.js +1 -0
  231. package/dist-sdk/src/entities/shared/filters/index.d.ts +2 -1
  232. package/dist-sdk/src/entities/shared/filters/index.js +11 -4
  233. package/dist-sdk/src/entities/shared/foreign-ref.d.ts +14 -0
  234. package/dist-sdk/src/entities/shared/foreign-ref.js +12 -0
  235. package/dist-sdk/src/entities/shared/ref.d.ts +26 -11
  236. package/dist-sdk/src/entities/shared/ref.js +8 -3
  237. package/dist-sdk/src/entities/shared/types/common.d.ts +2 -2
  238. package/dist-sdk/src/entities/shared/types/field-types.d.ts +1 -1
  239. package/dist-sdk/src/entities/shared/types/field-types.js +1 -1
  240. package/dist-sdk/src/entities/skill/build.d.ts +2 -2
  241. package/dist-sdk/src/entities/skill/build.js +3 -3
  242. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +1 -1
  243. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +26 -7
  244. package/dist-sdk/src/entities/skill/index.d.ts +1 -1
  245. package/dist-sdk/src/entities/skill/index.js +1 -1
  246. package/dist-sdk/src/entities/skill/module.js +2 -2
  247. package/dist-sdk/src/entities/skill/to-tf.d.ts +1 -1
  248. package/dist-sdk/src/entities/skill/to-tf.js +2 -2
  249. package/dist-sdk/src/entities/skill/tools.d.ts +4 -3
  250. package/dist-sdk/src/entities/skill/tools.js +4 -3
  251. package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +13 -0
  252. package/dist-sdk/src/entities/skill-tool/from-tf.js +42 -0
  253. package/dist-sdk/src/entities/skill-tool/to-tf.js +6 -6
  254. package/dist-sdk/src/entities/table/build.d.ts +1 -1
  255. package/dist-sdk/src/entities/table/build.js +9 -9
  256. package/dist-sdk/src/entities/table/catalog-render.js +9 -1
  257. package/dist-sdk/src/entities/table/deserializer/normalize.js +4 -4
  258. package/dist-sdk/src/entities/table/fields/types.d.ts +1 -1
  259. package/dist-sdk/src/entities/table/fields/types.js +1 -1
  260. package/dist-sdk/src/entities/table/index.d.ts +2 -2
  261. package/dist-sdk/src/entities/table/index.js +3 -3
  262. package/dist-sdk/src/entities/table/module.js +1 -1
  263. package/dist-sdk/src/entities/table/to-tf.js +22 -30
  264. package/dist-sdk/src/entities/task/build.d.ts +1 -1
  265. package/dist-sdk/src/entities/task/build.js +5 -5
  266. package/dist-sdk/src/entities/task/index.d.ts +1 -1
  267. package/dist-sdk/src/entities/task/index.js +1 -1
  268. package/dist-sdk/src/entities/view/build.d.ts +46 -0
  269. package/dist-sdk/src/entities/view/build.js +19 -0
  270. package/dist-sdk/src/entities/view/from-tf.js +68 -18
  271. package/dist-sdk/src/entities/view/module.d.ts +6 -13
  272. package/dist-sdk/src/entities/view/module.js +7 -14
  273. package/dist-sdk/src/entities/view/sharing.d.ts +10 -0
  274. package/dist-sdk/src/entities/view/sharing.js +6 -0
  275. package/dist-sdk/src/entities/view/to-tf.d.ts +21 -19
  276. package/dist-sdk/src/entities/view/to-tf.js +61 -26
  277. package/dist-sdk/src/entities/view/types.js +3 -0
  278. package/dist-sdk/src/entities/visual-flow/build.d.ts +1 -1
  279. package/dist-sdk/src/entities/visual-flow/build.js +8 -8
  280. package/dist-sdk/src/entities/visual-flow/index.d.ts +1 -1
  281. package/dist-sdk/src/entities/visual-flow/index.js +1 -1
  282. package/dist-sdk/src/entities/visual-flow/module.js +1 -1
  283. package/dist-sdk/src/entities/visual-flow/printer.js +3 -3
  284. package/dist-sdk/src/entities/visual-flow/to-tf.d.ts +1 -0
  285. package/dist-sdk/src/entities/visual-flow/to-tf.js +3 -7
  286. package/dist-sdk/src/entities/widget/to-tf.d.ts +1 -0
  287. package/dist-sdk/src/entities/widget/to-tf.js +9 -7
  288. package/dist-sdk/src/graph/index.d.ts +5 -1
  289. package/dist-sdk/src/graph/index.js +4 -1
  290. package/dist-sdk/src/graph/modules.js +6 -1
  291. package/dist-sdk/src/graph/types.d.ts +52 -1
  292. package/dist-sdk/src/internal/safe-identifier.d.ts +4 -0
  293. package/dist-sdk/src/internal/safe-identifier.js +13 -0
  294. package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
  295. package/dist-sdk/src/internal/sdk-package.js +1 -0
  296. package/package.json +12 -3
@@ -65,11 +65,22 @@ function renderOrgTs(extract) {
65
65
  // they never appear in `bags` above. Models nest on their provider instead
66
66
  // (`aiProviders.<provider>.models.<model>`), rendered specially here.
67
67
  const aiProvidersLines = renderAiProvidersBag(extract);
68
+ const supportedFunctionsByCloudLink = new Map();
69
+ for (const fn of extract.storedFunctions ?? []) {
70
+ const mapped = supportedStoredFunction(fn);
71
+ if (mapped === undefined)
72
+ continue;
73
+ const functions = supportedFunctionsByCloudLink.get(fn.cloudLinkName) ?? [];
74
+ functions.push({ fn, mapped });
75
+ supportedFunctionsByCloudLink.set(fn.cloudLinkName, functions);
76
+ }
68
77
  const factories = new Set(["orgCatalog", ...bags.map((b) => b.factory)]);
69
78
  if (aiProvidersLines.length > 0) {
70
- factories.add("defineAiProvider");
79
+ factories.add("aiProvider");
71
80
  factories.add("connectorRef");
72
81
  }
82
+ if (supportedFunctionsByCloudLink.size > 0)
83
+ factories.add("storedFunctionRef");
73
84
  const lines = [
74
85
  "// Org reference identities from `elementum pull org --data-only` — refresh by re-running it.",
75
86
  "// Each key IS the identity's terraform label in camelCase: tfLabel = tsLabelToTfLabel(key)",
@@ -82,13 +93,60 @@ function renderOrgTs(extract) {
82
93
  for (const { bag, factory, entries } of bags) {
83
94
  lines.push(` ${bag}: {`);
84
95
  for (const e of entries) {
85
- lines.push(` ${e.tsLabel}: ${factory}({ name: ${q(e.name)} }),`);
96
+ if (bag !== "cloudLinks") {
97
+ lines.push(` ${e.tsLabel}: ${factory}({ name: ${q(e.name)} }),`);
98
+ continue;
99
+ }
100
+ const functions = supportedFunctionsByCloudLink.get(e.name) ?? [];
101
+ if (functions.length === 0) {
102
+ lines.push(` ${e.tsLabel}: ${factory}({ name: ${q(e.name)} }),`);
103
+ continue;
104
+ }
105
+ lines.push(` ${e.tsLabel}: ${factory}({ name: ${q(e.name)}, storedFunctions: {`);
106
+ const used = new Set();
107
+ for (const { fn, mapped } of functions) {
108
+ const key = tfLabelToTsLabel(sanitizeName(fn.name));
109
+ if (used.has(key))
110
+ throw new OrgExtractError(`cloud link ${q(e.name)} has duplicate stored-function key ${q(key)}`);
111
+ used.add(key);
112
+ lines.push(` ${key}: storedFunctionRef({ name: ${q(fn.name)}, parameters: ${JSON.stringify(mapped.parameters)}, result: ${q(mapped.result)} }),`);
113
+ }
114
+ lines.push(" } }),");
86
115
  }
87
116
  lines.push(" },");
88
117
  }
89
118
  lines.push("});", "");
90
119
  return lines.join("\n");
91
120
  }
121
+ const STORED_FUNCTION_TYPE = {
122
+ AUTO_INCREMENT: "number",
123
+ LONG: "number",
124
+ BOOLEAN: "bool",
125
+ DATE: "date",
126
+ DATETIME: "datetime",
127
+ DECIMAL: "decimal",
128
+ HANDLE: "handle",
129
+ JSON: "json",
130
+ TEXT: "text",
131
+ UUID: "text",
132
+ BINARY: undefined,
133
+ };
134
+ function supportedStoredFunction(fn) {
135
+ const problem = fn.functionType !== "USER_DEFINED_FUNCTION" ? `type ${fn.functionType}`
136
+ : !fn.configured ? "not configured"
137
+ : fn.returnType === "TABLE" ? "table result"
138
+ : STORED_FUNCTION_TYPE[fn.returnType] === undefined ? `unsupported result ${fn.returnType}`
139
+ : fn.parameterTypes.some((type) => STORED_FUNCTION_TYPE[type] === undefined) ? `unsupported argument in ${fn.parameterTypes.join(", ")}`
140
+ : undefined;
141
+ if (problem !== undefined) {
142
+ console.error(`[elementum] skipping stored function ${fn.name}: ${problem}`);
143
+ return undefined;
144
+ }
145
+ return {
146
+ parameters: fn.parameterTypes.map((type) => STORED_FUNCTION_TYPE[type]),
147
+ result: STORED_FUNCTION_TYPE[fn.returnType],
148
+ };
149
+ }
92
150
  /**
93
151
  * Connectors nest one level under their provider — model names alone collide
94
152
  * across providers, so `aiProviders.<provider>.models.<model>` disambiguates
@@ -141,10 +199,10 @@ function renderAiProvidersBag(extract) {
141
199
  }
142
200
  const models = (modelsByProviderKey.get(providerKey) ?? []).sort((a, b) => a.modelKey.localeCompare(b.modelKey));
143
201
  if (models.length === 0) {
144
- lines.push(` ${providerKey}: defineAiProvider({ name: ${q(provider.name)}, type: ${q(type)} }),`);
202
+ lines.push(` ${providerKey}: aiProvider({ name: ${q(provider.name)}, type: ${q(type)} }),`);
145
203
  continue;
146
204
  }
147
- lines.push(` ${providerKey}: defineAiProvider({ name: ${q(provider.name)}, type: ${q(type)}, models: {`);
205
+ lines.push(` ${providerKey}: aiProvider({ name: ${q(provider.name)}, type: ${q(type)}, models: {`);
148
206
  for (const { modelKey, connector } of models) {
149
207
  lines.push(` ${modelKey}: connectorRef({ name: ${q(connector.name)} }),`);
150
208
  }
@@ -30,6 +30,6 @@ export declare function asNamedRef(ref: unknown): {
30
30
  export declare function namedOnlyFactoryEntry(factoryName: string): (args: import("../graph/types.js").CatalogRenderArgs) => CatalogRenderResult;
31
31
  /**
32
32
  * `{ name }` with parent omitted — appCatalog injects parent from the root
33
- * (fields, search tables).
33
+ * (search tables).
34
34
  */
35
35
  export declare function rootParentFactoryEntry(factoryName: string, extraParts?: (ref: unknown) => readonly string[]): (args: import("../graph/types.js").CatalogRenderArgs) => CatalogRenderResult;
@@ -66,7 +66,7 @@ export function namedOnlyFactoryEntry(factoryName) {
66
66
  }
67
67
  /**
68
68
  * `{ name }` with parent omitted — appCatalog injects parent from the root
69
- * (fields, search tables).
69
+ * (search tables).
70
70
  */
71
71
  export function rootParentFactoryEntry(factoryName, extraParts) {
72
72
  return (args) => {
@@ -12,6 +12,7 @@ export interface BarrelRoot {
12
12
  readonly kind: "app" | "element" | "org";
13
13
  readonly refName: string;
14
14
  readonly name: string;
15
+ readonly namespace?: string;
15
16
  }
16
17
  /**
17
18
  * The app/element's own authoring file, imported live so identity + fields
@@ -77,8 +77,8 @@ export function renderCatalog(root, refs, _automationTriggerKinds, ownFile) {
77
77
  }
78
78
  lines.push(`export const ${root.refName} = ${catalogFn}(`);
79
79
  lines.push(ownFile !== undefined
80
- ? ` { refName: __own.refName, name: __own.name },`
81
- : ` { refName: ${JSON.stringify(root.refName)}, name: ${JSON.stringify(root.name)} },`);
80
+ ? ` { refName: __own.refName, name: __own.name, ...(__own.namespace !== undefined ? { namespace: __own.namespace } : {}) },`
81
+ : ` { refName: ${JSON.stringify(root.refName)}, name: ${JSON.stringify(root.name)}${root.namespace !== undefined ? `, namespace: ${JSON.stringify(root.namespace)}` : ""} },`);
82
82
  lines.push(` {`);
83
83
  for (const m of usedMeta) {
84
84
  const bag = bagName(m.refKind);
@@ -30,17 +30,24 @@ export function slimToken(token) {
30
30
  out.name = token.name;
31
31
  if (token.parent !== undefined)
32
32
  out.parent = token.parent;
33
+ if ((token.__kind === "app" || token.__kind === "element") && typeof token.namespace === "string") {
34
+ out.namespace = token.namespace;
35
+ }
36
+ if ((token.parentKind === "app" || token.parentKind === "element"))
37
+ out.parentKind = token.parentKind;
38
+ if (typeof token.parentName === "string")
39
+ out.parentName = token.parentName;
40
+ if (typeof token.parentNamespace === "string")
41
+ out.parentNamespace = token.parentNamespace;
33
42
  if ((token.__kind === "approvalChain" || token.__kind === "skill") && typeof token.unresolvedId === "string") {
34
43
  out.unresolvedId = token.unresolvedId;
35
44
  }
45
+ if (token.__kind === "skill" && typeof token.parentName === "string")
46
+ out.parentName = token.parentName;
36
47
  // The terraform path derives a field's resource type from its authoring
37
48
  // type — canonical field metadata, not a barrel bag.
38
49
  if (token.__kind === "field" && typeof token.fieldType === "string")
39
50
  out.fieldType = token.fieldType;
40
- if (token.__kind === "field" && (token.parentKind === "app" || token.parentKind === "element"))
41
- out.parentKind = token.parentKind;
42
- if (token.__kind === "field" && typeof token.parentName === "string")
43
- out.parentName = token.parentName;
44
51
  // Same reasoning for a file reader: build needs to know which of the
45
52
  // excel/json/text/xml/ai resource types backs it to emit the right
46
53
  // `elementum_<type>_file_reader.<label>.id` reference - without this,
@@ -36,7 +36,7 @@ import type { AiProviderLlmModel, AiProviderType } from "./ai-provider-models.js
36
36
  * resolved to the current-version param/output id via the parent
37
37
  * automation's state binding.
38
38
  */
39
- export type CatalogRefKind = "automation" | "agent" | "skill" | "visual-flow" | "approvalChain" | "table" | "tableColumn" | "cloudLink" | "field" | "searchTable" | "documentModel" | "documentModelField" | "connector" | "aiProvider" | "category" | "group" | "phoneProvider" | "phone-service" | "datamine" | "app" | "element" | "task" | "triggerParameter" | "outputProperty";
39
+ export type CatalogRefKind = "automation" | "agent" | "agent-evaluation" | "chart" | "dashboard" | "skill" | "visual-flow" | "approvalChain" | "table" | "tableColumn" | "cloudLink" | "storedFunction" | "field" | "searchTable" | "documentModel" | "documentModelField" | "connector" | "aiProvider" | "category" | "group" | "phoneProvider" | "phone-service" | "datamine" | "app" | "element" | "task" | "triggerParameter" | "outputProperty";
40
40
  /**
41
41
  * The reference surface for a catalog entity. `handle` is the stable join key
42
42
  * (no id); `name` is for readability/diagnostics, never a match key.
@@ -67,7 +67,16 @@ export interface AutomationRef<TTrigger = unknown, TOutput = unknown> extends Ca
67
67
  readonly output?: TOutput;
68
68
  }
69
69
  export type AgentRef<Parent extends string = string, RefName extends string = string> = CatalogRef<"agent", RefName, Parent>;
70
+ export type AgentEvaluationRef<Parent extends string = string, RefName extends string = string> = CatalogRef<"agent-evaluation", RefName, Parent>;
71
+ export type ChartRef<Parent extends string = string, RefName extends string = string> = CatalogRef<"chart", RefName, Parent>;
72
+ export type DashboardRef<Parent extends string = string, RefName extends string = string> = CatalogRef<"dashboard", RefName, Parent>;
70
73
  export interface SkillRef extends CatalogRef<"skill"> {
74
+ /**
75
+ * Display name of the app that owns this skill. Generated app catalogs
76
+ * stamp it alongside `parent`, giving cross-app skill lookups the stable
77
+ * owner identity needed to resolve `app_id` without exposing a platform id.
78
+ */
79
+ readonly parentName?: string;
71
80
  /**
72
81
  * A raw platform id, when the export carries a `skill_ids`/
73
82
  * `preloaded_skill_ids` entry that resolves to neither a self-app resource
@@ -123,15 +132,30 @@ export interface AiProviderRef<T extends AiProviderType = AiProviderType> extend
123
132
  */
124
133
  readonly models?: Readonly<Record<string, ConnectorRef | AiProviderLlmModel<T>>>;
125
134
  }
126
- export type CloudLinkRef = CatalogRef<"cloudLink">;
135
+ /** Scalar calculation families supported by configured stored functions. */
136
+ export type StoredFunctionScalarType = "number" | "decimal" | "bool" | "date" | "datetime" | "handle" | "json" | "text";
137
+ export interface StoredFunctionRef<Parameters extends readonly StoredFunctionScalarType[] = readonly StoredFunctionScalarType[], Result extends StoredFunctionScalarType = StoredFunctionScalarType> extends CatalogRef<"storedFunction"> {
138
+ readonly parent: string;
139
+ readonly parameterTypes: Parameters;
140
+ readonly resultType: Result;
141
+ }
142
+ export interface CloudLinkRef<Functions extends Readonly<Record<string, StoredFunctionRef>> = Readonly<Record<string, StoredFunctionRef>>> extends CatalogRef<"cloudLink"> {
143
+ readonly storedFunctions?: Functions;
144
+ }
127
145
  /** Org-owned reference identities from `elementum pull org --data-only` (pristine-refactor). */
128
146
  export type CategoryRef = CatalogRef<"category">;
129
147
  export type GroupRef = CatalogRef<"group">;
130
148
  export type PhoneProviderRef = CatalogRef<"phoneProvider">;
131
149
  export type PhoneServiceRef<Parent extends string = string, RefName extends string = string> = CatalogRef<"phone-service", RefName, Parent>;
132
150
  /** Typed references to app and element catalog roots. */
133
- export type AppCatalogRef<RefName extends string = string> = CatalogRef<"app", RefName>;
134
- export type ElementCatalogRef<RefName extends string = string> = CatalogRef<"element", RefName>;
151
+ export type AppCatalogRef<RefName extends string = string> = CatalogRef<"app", RefName> & {
152
+ /** Stable cross-organization lookup identity. Pulled/generated refs always carry it. */
153
+ readonly namespace?: string;
154
+ };
155
+ export type ElementCatalogRef<RefName extends string = string> = CatalogRef<"element", RefName> & {
156
+ /** Stable cross-organization lookup identity. Pulled/generated refs always carry it. */
157
+ readonly namespace?: string;
158
+ };
135
159
  export type AppOrElementRef<RefName extends string = string> = AppCatalogRef<RefName> | ElementCatalogRef<RefName>;
136
160
  /**
137
161
  * A field reference. Beyond the shared surface it carries `fieldType` (the
@@ -159,6 +183,8 @@ export interface FieldRef<Parent extends string = string, RefName extends string
159
183
  * refName) doesn't carry.
160
184
  */
161
185
  readonly parentName?: string;
186
+ /** Namespace of the owning app/element, used for portable foreign-owner lookup. */
187
+ readonly parentNamespace?: string;
162
188
  }
163
189
  /** Platform-owned user attributes accepted by user-search task filters. */
164
190
  export declare const USER_FIELD_KEYS: readonly ["firstName", "email", "jobTitle", "lastName"];
@@ -209,6 +235,9 @@ export interface FileReaderCatalogRef extends CatalogRef<"documentModel"> {
209
235
  * in the barrel. `parent` on each nested ref is this automation's handle.
210
236
  */
211
237
  export interface AutomationCatalogRef extends CatalogRef<"automation"> {
238
+ readonly parentKind?: "app" | "element";
239
+ readonly parentName?: string;
240
+ readonly parentNamespace?: string;
212
241
  readonly trigger?: Readonly<Record<string, TriggerParameterRef>>;
213
242
  readonly outputs?: Readonly<Record<string, OutputPropertyRef>>;
214
243
  }
@@ -35,12 +35,16 @@ export const USER_FIELD_KEYS = ["firstName", "email", "jobTitle", "lastName"];
35
35
  export const REF_SCOPE = {
36
36
  automation: "app",
37
37
  agent: "app",
38
+ "agent-evaluation": "app",
39
+ chart: "app",
40
+ dashboard: "app",
38
41
  skill: "app",
39
42
  "visual-flow": "app",
40
43
  approvalChain: "app",
41
44
  table: "org",
42
45
  tableColumn: "org",
43
46
  cloudLink: "org",
47
+ storedFunction: "org",
44
48
  field: "app",
45
49
  searchTable: "app",
46
50
  datamine: "app",
@@ -79,6 +83,7 @@ export const REF_SCOPE = {
79
83
  export const REF_UPDATABLE = new Set([
80
84
  "automation",
81
85
  "agent",
86
+ "agent-evaluation",
82
87
  "skill",
83
88
  "approvalChain",
84
89
  "table",
@@ -1,11 +1,11 @@
1
- export { type Ref, type ToRefs, type Simplify, type ValueOrRef, type RefData, type TriggerRefData, type TaskRefData, type ForEachRefData, type StaticRefData, type TemplateRefData, type SecretRefData, createRef, isRef, val, template, secret, unresolvedField, toRefData, UNRESOLVED_FIELD_MARKER, } from "../entities/shared/ref.js";
2
- export { type Context, type ForEachItem, buildContext, createTriggerProxy, createTaskOutputProxy, createTasksProxy, createForEachItemProxy, } from "../entities/shared/context.js";
3
- export { type App, type AppField, type FieldScope, type AppAgent, type AppSearchTable, type AppAutomation, type AppPhoneService, type AspectType, type AppCategory, type FieldValueType, type FieldValueForAppField, type PicklistOption, type AspectRecord, type SearchTableRecord, type AppFieldValues, type AppFieldOf, type AppFieldInputForTask, type PicklistOptionsResolver, type RowScopedFields, type RowProxy, defineApp, picklistOption, picklistStaticValueToApiId, resolveFieldValues, asRowProxy, } from "./types/app.js";
4
- export { type SortDirection, type SortOrder, asc, desc, sortBy, } from "../entities/shared/types/common.js";
5
- export { type User, type Group, type Attachment, type Employee, type Manager, type RichText, type PicklistValue, } from "../entities/shared/types/platform.js";
6
- export { type AiProviderConnector, defineAiProviderConnector, } from "./types/ai-provider.js";
7
- export { type UserRef, defineUser, } from "./types/user.js";
8
- export { type GroupRef, defineGroup, } from "./types/group.js";
9
- export { type CloudLink, defineCloudLink, } from "./types/cloud-link.js";
10
- export { type AspectCategoryRef, defineCategory, } from "./types/aspect-category.js";
1
+ export { UNRESOLVED_FIELD_MARKER, createRef, isRef, secret, template, toRefData, unresolvedField, val, type ActionRefData, type ForEachRefData, type Ref, type RefData, type SecretRefData, type Simplify, type StaticRefData, type TemplateRefData, type ToRefs, type TriggerRefData, type ValueOrRef } from "../entities/shared/ref.js";
2
+ export { buildContext, createActionOutputProxy, createActionsProxy, createForEachItemProxy, createTriggerProxy, type Context, type ForEachItem } from "../entities/shared/context.js";
3
+ export { asRowProxy, app, picklistOption, picklistStaticValueToApiId, resolveFieldValues, type App, type AppAgent, type AppAutomation, type AppCategory, type AppField, type AppFieldInputForAction, type AppFieldOf, type AppFieldValues, type AppPhoneService, type AppSearchTable, type AspectRecord, type AspectType, type FieldScope, type FieldValueForAppField, type FieldValueType, type PicklistOption, type PicklistOptionsResolver, type RowProxy, type RowScopedFields, type SearchTableRecord } from "./types/app.js";
4
+ export { asc, desc, sortBy, type SortDirection, type SortOrder } from "../entities/shared/types/common.js";
5
+ export { type Attachment, type Employee, type Group, type Manager, type PicklistValue, type RichText, type User } from "../entities/shared/types/platform.js";
6
+ export { aiProviderConnector, type AiProviderConnector } from "./types/ai-provider.js";
7
+ export { user, type UserRef } from "./types/user.js";
8
+ export { group, type GroupRef } from "./types/group.js";
9
+ export { cloudLink, type CloudLink } from "./types/cloud-link.js";
10
+ export { category, type AspectCategoryRef } from "./types/aspect-category.js";
11
11
  export { unsafePlatformId, type UnsafePlatformId } from "./platform-id.js";
@@ -1,10 +1,10 @@
1
- export { createRef, isRef, val, template, secret, unresolvedField, toRefData, UNRESOLVED_FIELD_MARKER, } from "../entities/shared/ref.js";
2
- export { buildContext, createTriggerProxy, createTaskOutputProxy, createTasksProxy, createForEachItemProxy, } from "../entities/shared/context.js";
3
- export { defineApp, picklistOption, picklistStaticValueToApiId, resolveFieldValues, asRowProxy, } from "./types/app.js";
4
- export { asc, desc, sortBy, } from "../entities/shared/types/common.js";
5
- export { defineAiProviderConnector, } from "./types/ai-provider.js";
6
- export { defineUser, } from "./types/user.js";
7
- export { defineGroup, } from "./types/group.js";
8
- export { defineCloudLink, } from "./types/cloud-link.js";
9
- export { defineCategory, } from "./types/aspect-category.js";
1
+ export { UNRESOLVED_FIELD_MARKER, createRef, isRef, secret, template, toRefData, unresolvedField, val } from "../entities/shared/ref.js";
2
+ export { buildContext, createActionOutputProxy, createActionsProxy, createForEachItemProxy, createTriggerProxy } from "../entities/shared/context.js";
3
+ export { asRowProxy, app, picklistOption, picklistStaticValueToApiId, resolveFieldValues } from "./types/app.js";
4
+ export { asc, desc, sortBy } from "../entities/shared/types/common.js";
5
+ export { aiProviderConnector } from "./types/ai-provider.js";
6
+ export { user } from "./types/user.js";
7
+ export { group } from "./types/group.js";
8
+ export { cloudLink } from "./types/cloud-link.js";
9
+ export { category } from "./types/aspect-category.js";
10
10
  export { unsafePlatformId } from "./platform-id.js";
@@ -112,7 +112,7 @@ export interface SelectFieldOptions extends FieldBindingOptions {
112
112
  }
113
113
  /** Bind a scalar field (TEXT/NUMBER/DECIMAL/DATE/DATETIME/USER_ID/GROUP_ID) to an `Input`. */
114
114
  export declare function inputFor(field: FieldRef, opts?: InputFieldOptions): RenderNode<"Input">;
115
- /** Bind a TEXT/HTML/RICH_TEXT field to a `Textarea`. */
115
+ /** Bind a TEXT/RICH_TEXT field to a `Textarea`. */
116
116
  export declare function textareaFor(field: FieldRef, opts?: TextareaFieldOptions): RenderNode<"Textarea">;
117
117
  /** Bind a PICKLIST/MULTI_PICKLIST field to a `Select` (options fetched at render time unless given). */
118
118
  export declare function selectFor(field: FieldRef, opts?: SelectFieldOptions): RenderNode<"Select">;
@@ -86,7 +86,7 @@ export function inputFor(field, opts = {}) {
86
86
  props.placeholder = opts.placeholder;
87
87
  return buildBindingNode("Input", field, props);
88
88
  }
89
- /** Bind a TEXT/HTML/RICH_TEXT field to a `Textarea`. */
89
+ /** Bind a TEXT/RICH_TEXT field to a `Textarea`. */
90
90
  export function textareaFor(field, opts = {}) {
91
91
  const props = commonProps(field, opts);
92
92
  if (opts.placeholder != null)
@@ -118,7 +118,6 @@ export function fieldFor(field, opts = {}) {
118
118
  case "PICKLIST":
119
119
  case "MULTI_PICKLIST":
120
120
  return selectFor(field, opts);
121
- case "HTML":
122
121
  case "RICH_TEXT":
123
122
  return textareaFor(field, opts);
124
123
  case "BOOLEAN":
@@ -16,7 +16,7 @@ export interface AiProviderConnector {
16
16
  readonly model?: string;
17
17
  }
18
18
  /** @deprecated Use the pulled `catalog.aiProviders.<provider>.models.<model>` token instead — see {@link AiProviderConnector}. */
19
- export declare function defineAiProviderConnector(opts: {
19
+ export declare function aiProviderConnector(opts: {
20
20
  id: string;
21
21
  name?: string;
22
22
  model?: string;
@@ -1,5 +1,5 @@
1
1
  /** @deprecated Use the pulled `catalog.aiProviders.<provider>.models.<model>` token instead — see {@link AiProviderConnector}. */
2
- export function defineAiProviderConnector(opts) {
2
+ export function aiProviderConnector(opts) {
3
3
  return {
4
4
  id: opts.id,
5
5
  ...(opts.name != null && { name: opts.name }),
@@ -10,10 +10,12 @@
10
10
  import { type Ref, type ValueOrRef } from "../../entities/shared/ref.js";
11
11
  import type { WorkflowFieldType } from "../../entities/shared/types/field-types.js";
12
12
  import type { AppOrElementRef, FieldRef } from "../../catalog/types.js";
13
+ import type { RefExpr } from "../../entities/shared/filters/ast.js";
14
+ import type { Filter } from "../../entities/shared/filters/types.js";
13
15
  import type { CloudLink } from "./cloud-link.js";
14
16
  import type { DisplayBlockBag } from "./display-block.js";
15
17
  import type { SerializedRenderTree } from "../render-tree.js";
16
- import type { AspectFieldQrFormat, AspectNumericFieldFormat, AspectReferenceFieldFormat, PicklistConfigInput, PicklistValueExInput } from "../../../elementum-entity-client/clients/aspects/models/index.js";
18
+ import type { AspectFieldQrFormat, AspectNumericFieldFormat, AspectReferenceFieldFormat, PicklistValueExInput } from "../../../elementum-entity-client/clients/aspects/models/index.js";
17
19
  /**
18
20
  * One static picklist value; in `createRecord` / `updateField` pick via
19
21
  * `(options) => options.Name` — only `id` is sent to the API.
@@ -76,7 +78,7 @@ export type FieldScope = "row" | "unscoped";
76
78
  * Names that Ultron auto-provisions on every `APP` aspect. A user field
77
79
  * whose `name` collides with one of these causes compose to fail with a
78
80
  * raw Postgres unique-constraint 500 instead of a typed validation error,
79
- * so we reject the collision at `defineApp()` time.
81
+ * so we reject the collision at `app()` time.
80
82
  *
81
83
  * This list is hand-maintained — if Ultron adds a new system field, add
82
84
  * the literal here and regenerate. A long-term improvement is to source
@@ -113,7 +115,7 @@ type TagsOf<F> = F extends {
113
115
  type HasLiteralTags<F> = string extends TagsOf<F> ? false : true;
114
116
  type HasKnownSystemSemanticTag<F> = HasLiteralTags<F> extends true ? [Extract<TagsOf<F>, SystemFieldSemanticTag>] extends [never] ? false : true : false;
115
117
  type WritableFieldValues<TFields extends Record<string, AppField>> = {
116
- [K in keyof TFields]?: AppFieldInputForTask<TFields[K] & AppField>;
118
+ [K in keyof TFields]?: AppFieldInputForAction<TFields[K] & AppField>;
117
119
  };
118
120
  /**
119
121
  * Shared base for every per-variant `AppField`. Carries identity
@@ -195,6 +197,43 @@ export interface HtmlAppField<Scope extends FieldScope = "unscoped"> extends Asp
195
197
  export interface JsonAppField<Scope extends FieldScope = "unscoped"> extends AspectFieldBase<Scope> {
196
198
  readonly type: "JSON";
197
199
  }
200
+ /**
201
+ * Normalized (pulled) dynamic-picklist config — a picklist whose values
202
+ * come from records of another aspect (`elementum_dropdown_field`/
203
+ * `elementum_multiselect_field`'s `dynamic_config`), rather than a fixed
204
+ * `options` list. `relatedAspectId`/`relatedLabelFieldId`/`parentFieldId`
205
+ * mirror `RelationAppField`'s duality: a raw platform id (the common case —
206
+ * `field/from-tf.ts` prints it via `unsafePlatformId(...)`), or a resolved
207
+ * catalog ref when the related aspect/field is already pulled into this
208
+ * workspace. `filter`/`sort` round-trip through the same `Filter<RefExpr,
209
+ * RefExpr>` shape `NormalizedAccessPolicy` already uses.
210
+ */
211
+ export interface NormalizedPicklistDynamicConfig {
212
+ readonly relatedAspectId: AppOrElementRef | string;
213
+ readonly relatedLabelFieldId: string | {
214
+ readonly ownerRefName: string;
215
+ readonly fieldKey: string;
216
+ };
217
+ /**
218
+ * A field on the SAME owning aspect (not `relatedAspectId`'s target) — the
219
+ * cascading-parent trigger. Carried as that field's own bag key, printed
220
+ * as a hoisted `FieldRef` const (`field/from-tf.ts` resolves it via
221
+ * `fieldKeyFromTfRef`, same as `AppField.parentField`'s sibling mechanism).
222
+ */
223
+ readonly parentFieldId?: string;
224
+ readonly autoRelate?: boolean;
225
+ readonly valuesRenderType?: string;
226
+ readonly filter?: Filter<RefExpr, RefExpr>;
227
+ readonly sort?: Readonly<Record<string, unknown>>;
228
+ }
229
+ /**
230
+ * Only `dynamic` round-trips through the terraform path today — a `static`
231
+ * variant exists on the platform (filter/sort/parentFieldId over a fixed
232
+ * option list) but has no terraform attribute yet (see `field/to-tf.ts`).
233
+ */
234
+ export interface NormalizedPicklistConfig {
235
+ readonly dynamic?: NormalizedPicklistDynamicConfig;
236
+ }
198
237
  /**
199
238
  * Shared base for `PicklistAppField` / `MultiPicklistAppField`. The
200
239
  * three value-source mechanisms are mutually exclusive at the wire
@@ -204,8 +243,8 @@ export interface JsonAppField<Scope extends FieldScope = "unscoped"> extends Asp
204
243
  * translation (the agent-friendly authoring shape)
205
244
  * - `picklistValues` — explicit `PicklistValueExInput[]` for richer
206
245
  * authoring (color, icon)
207
- * - `config: PicklistConfigInput` — typed wrapper for static /
208
- * dynamic picklist config (related-aspect refs, filters, etc.)
246
+ * - `config: NormalizedPicklistConfig` — dynamic picklist config
247
+ * (related-aspect refs, filter, sort)
209
248
  *
210
249
  * The legacy `values: string[]` slot is preserved for update flows
211
250
  * that re-send id-only ordering data.
@@ -227,18 +266,15 @@ export interface JsonAppField<Scope extends FieldScope = "unscoped"> extends Asp
227
266
  * } satisfies PicklistAppField;
228
267
  * ```
229
268
  *
230
- * The serializer flattens this into the wire form: `parentField.id`
231
- * lands on `config.static.parentFieldId` (or `config.dynamic.parentFieldId`
232
- * when the picklist is dynamic), and each option's `parentValues` ids
233
- * land on its `relatedParentValues`. For the related-aspect-backed
234
- * (dynamic) case, the cross-aspect field mappings live on
235
- * `config.dynamic.parentMappings` and are still authored through the
236
- * `config` slot directly.
269
+ * This dependent-option-link mechanism (`parentField`/`parentValues`) is a
270
+ * DIFFERENT, still-unimplemented feature from `config.dynamic`'s own
271
+ * `parentFieldId` (a dynamic picklist's cascading-parent trigger) — see
272
+ * `field/to-tf.ts`'s handling of `relatedParentValues`.
237
273
  */
238
274
  export interface PicklistAppFieldBase<Scope extends FieldScope = "unscoped"> extends AspectFieldBase<Scope> {
239
275
  readonly options?: Readonly<Record<string, PicklistOption>>;
240
276
  readonly picklistValues?: readonly PicklistValueExInput[];
241
- readonly config?: PicklistConfigInput;
277
+ readonly config?: NormalizedPicklistConfig;
242
278
  readonly values?: readonly string[];
243
279
  readonly referenceFormat?: AspectReferenceFieldFormat;
244
280
  readonly parentField?: PicklistAppField<Scope> | MultiPicklistAppField<Scope>;
@@ -249,7 +285,7 @@ export interface PicklistAppFieldBase<Scope extends FieldScope = "unscoped"> ext
249
285
  * set is still present in the current `picklistValues`; missing
250
286
  * ids → throw, since the EDK doesn't support deleting picklist
251
287
  * values (matching the create/update-only pattern across
252
- * `defineAutomation`, `defineAgent`, etc.).
288
+ * `automation`, `agent`, etc.).
253
289
  *
254
290
  * Hand-authored fields don't set this; the guard is a no-op.
255
291
  * Never serialized to ultron — `resolvePicklistValues` projects
@@ -349,9 +385,9 @@ export interface AppAgent {
349
385
  /**
350
386
  * A reusable agentic skill owned by the app — an AI capability bundle
351
387
  * (prompt + tools) that one of the app's agents can be granted via
352
- * `defineAgent({ skills: [...] })`. The agent doesn't author the skill
388
+ * `agent({ skills: [...] })`. The agent doesn't author the skill
353
389
  * here; it only references it by id/name. Authoring lives on the
354
- * separate `defineSkill` factory and lands in this bag once deployed.
390
+ * separate `skill` factory and lands in this bag once deployed.
355
391
  */
356
392
  export interface AppAgenticSkill {
357
393
  readonly id: string;
@@ -370,7 +406,7 @@ export interface AppSearchTable<TFields extends Record<string, AppField> = {}> {
370
406
  *
371
407
  * `type` is required — the renderer reads it from antman's wire
372
408
  * (`TriggerParameter.fieldType`, surfaced from mobius's
373
- * `ServiceTaskParam.fieldType`). Hand-authored `defineApp({ ... })`
409
+ * `ServiceTaskParam.fieldType`). Hand-authored `app({ ... })`
374
410
  * entries must set it explicitly so `runAutomation`'s input typing can
375
411
  * derive value types.
376
412
  */
@@ -384,12 +420,12 @@ export interface AppAutomationParam {
384
420
  /**
385
421
  * Workflow metadata attached to an automation in an AppAutomation
386
422
  * entry — the part the agent needs to pull the automation back as
387
- * editable source via `defineAutomation.fromJSON`.
423
+ * editable source via `automation.fromJSON`.
388
424
  *
389
425
  * Substantive type, not a wrapper over the entity-client's `Workflow`:
390
426
  * - `id` is required, so the agent can't author an entry with
391
427
  * workflow metadata but no actual id (typecheck catches it at
392
- * `defineApp({...})` construction time).
428
+ * `app({...})` construction time).
393
429
  * - Surface is narrow to authoring concerns. Heavier wire fields
394
430
  * (triggers, tasks, outputs, owner, etc.) live on the
395
431
  * entity-client's `Workflow` and are read at pull time, not
@@ -401,7 +437,7 @@ export interface AppAutomationParam {
401
437
  * which to pull at the call site:
402
438
  *
403
439
  * ```ts
404
- * defineAutomation.fromJSON(myApp.automations.foo.workflowDraft!)
440
+ * automation.fromJSON(myApp.automations.foo.workflowDraft!)
405
441
  * ```
406
442
  *
407
443
  * (The ref is passed directly, not its `.id` — `fromJSON` takes the
@@ -409,7 +445,7 @@ export interface AppAutomationParam {
409
445
  */
410
446
  export interface AppAutomationWorkflow<TParams extends Record<string, AppAutomationParam> = {}> {
411
447
  /**
412
- * Runtime-injected discriminator stamped by `defineApp` so the SDK
448
+ * Runtime-injected discriminator stamped by `app` so the SDK
413
449
  * can distinguish a workflow ref from its parent automation ref at
414
450
  * tool-config time. Both shapes have the same required surface
415
451
  * (`id: string`), so structural typing alone can't tell them apart
@@ -437,7 +473,7 @@ export interface AppAutomationWorkflow<TParams extends Record<string, AppAutomat
437
473
  }
438
474
  export interface AppAutomation<TParams extends Record<string, AppAutomationParam> = {}, TStatus extends "DRAFT" | "ACTIVE" = "ACTIVE"> {
439
475
  /**
440
- * Runtime-injected discriminator stamped by `defineApp`. Pairs with
476
+ * Runtime-injected discriminator stamped by `app`. Pairs with
441
477
  * `AppAutomationWorkflow.kind` to let the SDK reject a workflow ref
442
478
  * passed where an automation ref was expected (e.g.
443
479
  * `agentExecuteWorkflowTool({ automation: ... })`). See the comment
@@ -456,8 +492,8 @@ export interface AppAutomation<TParams extends Record<string, AppAutomationParam
456
492
  /**
457
493
  * Live published version of this automation. Populated by the agent
458
494
  * from the `workflowCurrent` field of the antman app definition
459
- * response when authoring `defineApp({...})`. Read at pull time
460
- * via `defineAutomation.fromJSON(myApp.automations.foo.workflowCurrent!)`.
495
+ * response when authoring `app({...})`. Read at pull time
496
+ * via `automation.fromJSON(myApp.automations.foo.workflowCurrent!)`.
461
497
  * Carries the active version's parameters for `runAutomation`
462
498
  * static-mode resolution.
463
499
  */
@@ -533,7 +569,7 @@ interface Deployable {
533
569
  }
534
570
  /**
535
571
  * Narrow `Deployable` shapes, discriminated on the `kind` literal every
536
- * builder output sets (`defineAgent` → `"agent"`, `defineAutomation` →
572
+ * builder output sets (`agent` → `"agent"`, `automation` →
537
573
  * `"automation"`). Used to constrain each App bag so a deployable of the
538
574
  * wrong kind is a compile error instead of a runtime surprise at deploy time.
539
575
  *
@@ -641,7 +677,7 @@ export type ValidateAppFields<TFields extends Record<string, AppField>> = {
641
677
  [K in keyof TFields]: TFields[K]["name"] extends ReservedSystemFieldName ? HasKnownSystemSemanticTag<TFields[K]> extends true ? TFields[K] : _ReservedSystemFieldName<TFields[K]["name"] & string> : TFields[K];
642
678
  };
643
679
  /**
644
- * Shared options shape consumed by both the data-only `defineApp`
680
+ * Shared options shape consumed by both the data-only `app`
645
681
  * (this file) and the deploy-attached wrapper in
646
682
  * `src/aspects/index.ts`. Hoisting the options type to one
647
683
  * declaration site means a future addition (e.g. a new optional
@@ -693,7 +729,7 @@ export interface DefineAppOpts<TFields extends Record<string, AppField> = {}, TA
693
729
  readonly cloudConnection?: AppCloudConnection;
694
730
  /**
695
731
  * Toggle the comments display block. Only available on snapshot
696
- * sources (pulled via `defineApp.fromJSON(...)`) because the EDK
732
+ * sources (pulled via `app.fromJSON(...)`) because the EDK
697
733
  * needs the full `displayBlocks` list to reconcile the comments
698
734
  * block on update — a fresh create has no list and the platform
699
735
  * auto-provisions display blocks without a comments block. To
@@ -706,7 +742,7 @@ export interface DefineAppOpts<TFields extends Record<string, AppField> = {}, TA
706
742
  /** New-record-form layout blocks, keyed by author handle. */
707
743
  readonly recordCreateDisplayBlocks?: DisplayBlockBag;
708
744
  }
709
- export declare function defineApp<const TFields extends Record<string, AppField> = {}, const TAgents extends Record<string, AppAgent | DeployableAgent> = {}, const TSearchTables extends Record<string, AppSearchTable | DeployableSearchTable> = {}, const TAutomations extends Record<string, AppAutomation | DeployableAutomation> = {}, const TPhoneServices extends Record<string, AppPhoneService> = {}, const TApprovalChains extends Record<string, AppApprovalChain | DeployableApprovalChain> = {}, const TAgenticSkills extends Record<string, AppAgenticSkill | DeployableSkill> = {}, const TStages extends Record<string, AppStage> = {}, const TSnapshot extends boolean = false, const TSystemFields extends Record<string, AppField> = {}>(opts: DefineAppOpts<TFields, TAgents, TSearchTables, TAutomations, TPhoneServices, TApprovalChains, TAgenticSkills, TStages, TSnapshot, TSystemFields>): App<TFields, TAgents, TSearchTables, TAutomations, TPhoneServices, TApprovalChains, TAgenticSkills, TStages, TSystemFields>;
745
+ export declare function app<const TFields extends Record<string, AppField> = {}, const TAgents extends Record<string, AppAgent | DeployableAgent> = {}, const TSearchTables extends Record<string, AppSearchTable | DeployableSearchTable> = {}, const TAutomations extends Record<string, AppAutomation | DeployableAutomation> = {}, const TPhoneServices extends Record<string, AppPhoneService> = {}, const TApprovalChains extends Record<string, AppApprovalChain | DeployableApprovalChain> = {}, const TAgenticSkills extends Record<string, AppAgenticSkill | DeployableSkill> = {}, const TStages extends Record<string, AppStage> = {}, const TSnapshot extends boolean = false, const TSystemFields extends Record<string, AppField> = {}>(opts: DefineAppOpts<TFields, TAgents, TSearchTables, TAutomations, TPhoneServices, TApprovalChains, TAgenticSkills, TStages, TSnapshot, TSystemFields>): App<TFields, TAgents, TSearchTables, TAutomations, TPhoneServices, TApprovalChains, TAgenticSkills, TStages, TSystemFields>;
710
746
  export type FieldValueType<T extends string> = T extends "TEXT" | "HANDLE" | "HTML" | "RICH_TEXT" | "PICKLIST" ? string : T extends "NUMBER" | "DECIMAL" ? number : T extends "BOOLEAN" ? boolean : T extends "DATE" | "DATETIME" ? string : T extends "USER" | "USER_ID" | "GROUP" | "GROUP_ID" ? string : T extends "UUID" | "ASPECT_ID" | "ASPECT_RECORD_ID" | "ASPECT_FIELD_ID" ? string : T extends "JSON" | "OBJECT" ? unknown : string;
711
747
  /**
712
748
  * Value type for a single app field: static picklists use `PicklistOption` (one of `options` values);
@@ -797,7 +833,7 @@ export declare function asRowProxy<T extends {
797
833
  fields: Record<string, AppField>;
798
834
  }>(source: T): RowProxy<T>;
799
835
  /**
800
- * Static picklist value in tasks: `values: { stage: (options) => options.Assigned }`.
836
+ * Static picklist value in actions: `values: { stage: (options) => options.Assigned }`.
801
837
  * `options` is that field's `options` map (same object as `app.fields.<field>.options`).
802
838
  */
803
839
  export type PicklistOptionsResolver<F extends AppField> = F extends {
@@ -811,7 +847,7 @@ export type PicklistOptionsResolver<F extends AppField> = F extends {
811
847
  * Allowed `values` entry per field. Static picklists: **only** `(options) => options.X` or `Ref` (e.g. dynamic UUID).
812
848
  * Other fields: `ValueOrRef` as usual.
813
849
  */
814
- export type AppFieldInputForTask<F extends AppField> = F extends {
850
+ export type AppFieldInputForAction<F extends AppField> = F extends {
815
851
  type: "PICKLIST";
816
852
  readonly options: Readonly<Record<string, PicklistOption>>;
817
853
  } ? PicklistOptionsResolver<F> | Ref<FieldValueForAppField<F>> : F extends {