@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
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * printSkillV2 — pulled skill rendering for the terraform path. Consumes
3
3
  * the `NormalizedSkill` that `skillFromTf` produces and emits an
4
- * `apps/<app>/skills/<refName>.ts` authoring file: `defineSkill` with tools
4
+ * `apps/<app>/skills/<refName>.ts` authoring file: `skill` with tools
5
5
  * as `catalog` tokens (self-app) or a TODO literal (foreign apps — their
6
6
  * catalog may not exist in this workspace) and tool fields as
7
7
  * `catalog.<app>.fields.<key>`.
@@ -14,9 +14,11 @@
14
14
  */
15
15
  import { quote } from "../../../../pull/util.js";
16
16
  import { sdkPackageSpecifier } from "../../../internal/sdk-package.js";
17
+ import { safeIdentifier } from "../../../internal/safe-identifier.js";
17
18
  const TOOL_FACTORY_BY_TYPE_KEY = {
18
19
  createRecord: "skillCreateRecord",
19
- searchAspect: "skillSearchAspect",
20
+ searchAspect: "skillSearchRecords",
21
+ searchTable: "skillSearchTable",
20
22
  updateRecord: "skillUpdateRecord",
21
23
  runAgent: "skillRunAgent",
22
24
  automation: "skillAutomation",
@@ -27,24 +29,28 @@ function safeMember(name) {
27
29
  function safeKey(name) {
28
30
  return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name) ? name : quote(name);
29
31
  }
30
- function printRunAs(runAs) {
31
- if (runAs["currentUser"] === true)
32
+ function searchTableLookupKey(aspectName, tableName) {
33
+ return JSON.stringify([aspectName, tableName]);
34
+ }
35
+ function printRunAs(runAs, appRefName) {
36
+ if ("currentUser" in runAs)
32
37
  return "{ currentUser: true }";
33
- if (runAs["publisher"] === true)
38
+ if ("publisher" in runAs)
34
39
  return "{ publisher: true }";
35
- const serviceAccount = runAs["serviceAccount"];
36
- return `{ serviceAccount: { serviceAccount: ${quote(String(serviceAccount?.serviceAccount ?? ""))} } }`;
40
+ return `{ serviceAccount: serviceAccountRef({ app: catalog.${appRefName}, name: ${quote(runAs.serviceAccount.name)} }) }`;
37
41
  }
38
42
  export function printSkillV2(skill, opts) {
39
43
  const { appRefName } = opts;
40
44
  const crossOrg = opts.crossOrg === true;
41
- const factories = [...new Set(skill.tools.map((t) => TOOL_FACTORY_BY_TYPE_KEY[t.typeKey]).filter(Boolean))].sort();
42
- const usesCatalog = skill.tools.some((t) => t.typeKey === "automation" ||
43
- t.typeKey === "runAgent" ||
44
- t.target?.kind === "self" ||
45
- (t.fields !== undefined && t.fields.length > 0) ||
46
- (t.target?.kind === "foreignApp" && opts.foreignAppRefNames?.has(t.target.name)) ||
47
- (t.target?.kind === "foreignElement" && opts.foreignElementRefNames?.has(t.target.name)));
45
+ const factories = [
46
+ ...new Set([
47
+ ...skill.tools.map((t) => TOOL_FACTORY_BY_TYPE_KEY[t.typeKey]).filter(Boolean),
48
+ ...(skill.tools.some((t) => t.runAs !== undefined && "serviceAccount" in t.runAs)
49
+ ? ["serviceAccountRef"]
50
+ : []),
51
+ ]),
52
+ ].sort();
53
+ const usesUnsafePlatformId = skill.tools.some((tool) => tool.fields?.some((field) => field.rawFieldId !== undefined && !opts.foreignFieldRefsById?.has(field.rawFieldId)) === true);
48
54
  const lines = [];
49
55
  lines.push("/**");
50
56
  lines.push(` * ${skill.name}`);
@@ -53,13 +59,15 @@ export function printSkillV2(skill, opts) {
53
59
  lines.push(" * one-shot starting point, not a live-binding view.");
54
60
  lines.push(" */");
55
61
  lines.push("");
56
- lines.push(`import { ${[...factories, "defineSkill"].sort().join(", ")} } from ${JSON.stringify(sdkPackageSpecifier("agents/skills"))};`);
57
- if (usesCatalog)
58
- lines.push(`import catalog from "@catalog";`);
62
+ lines.push(`import { ${[...factories, "skill"].sort().join(", ")} } from ${JSON.stringify(sdkPackageSpecifier("agents/skills"))};`);
63
+ if (usesUnsafePlatformId)
64
+ lines.push(`import { unsafePlatformId } from ${JSON.stringify(sdkPackageSpecifier("core"))};`);
65
+ lines.push(`import catalog from "@catalog";`);
59
66
  lines.push("");
60
- lines.push(`const ${skill.refName} = defineSkill({`);
67
+ const identifier = safeIdentifier(skill.refName, "skill");
68
+ lines.push(`const ${identifier} = skill({`);
61
69
  lines.push(` name: ${quote(skill.name)},`);
62
- lines.push(` parent: ${quote(appRefName)},`);
70
+ lines.push(` app: catalog.${appRefName},`);
63
71
  lines.push(` description: ${quote(skill.description)},`);
64
72
  lines.push(` instructions: ${quote(skill.instructions)},`);
65
73
  if (skill.status !== undefined)
@@ -70,13 +78,13 @@ export function printSkillV2(skill, opts) {
70
78
  if (skill.tools.length > 0) {
71
79
  lines.push(" tools: [");
72
80
  for (const tool of skill.tools) {
73
- lines.push(...printTool(tool, appRefName, crossOrg, opts.foreignAppRefNames, opts.foreignElementRefNames).map((l) => ` ${l}`));
81
+ lines.push(...printTool(tool, appRefName, crossOrg, opts.foreignAppRefNames, opts.foreignElementRefNames, opts.foreignFieldRefsById, opts.foreignSearchTableRefsByName).map((l) => ` ${l}`));
74
82
  }
75
83
  lines.push(" ],");
76
84
  }
77
85
  lines.push("});");
78
86
  lines.push("");
79
- lines.push(`export default ${skill.refName};`);
87
+ lines.push(`export default ${identifier};`);
80
88
  lines.push("");
81
89
  return lines.join("\n");
82
90
  }
@@ -94,9 +102,16 @@ function fieldOwnerRef(tool, appRefName, foreignAppRefNames, foreignElementRefNa
94
102
  ? { kind: "catalog", expr: `catalog.${foreignRefName}` }
95
103
  : { kind: "raw", entityType: entityKind, name: tool.target.name };
96
104
  }
97
- function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElementRefNames) {
98
- const factory = TOOL_FACTORY_BY_TYPE_KEY[tool.typeKey] ?? "skillSearchAspect";
105
+ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElementRefNames, foreignFieldRefsById, foreignSearchTableRefsByName) {
106
+ const factory = TOOL_FACTORY_BY_TYPE_KEY[tool.typeKey] ?? "skillSearchRecords";
99
107
  const lines = [`${factory}({`];
108
+ const targetRefName = tool.target?.kind === "self"
109
+ ? appRefName
110
+ : tool.target?.kind === "foreignElement"
111
+ ? foreignElementRefNames?.get(tool.target.name)
112
+ : tool.target?.kind === "foreignApp"
113
+ ? foreignAppRefNames?.get(tool.target.name)
114
+ : undefined;
100
115
  lines.push(` name: ${quote(tool.name)},`);
101
116
  lines.push(` description: ${quote(tool.description)},`);
102
117
  if (tool.status !== undefined)
@@ -104,7 +119,7 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
104
119
  if (tool.startMessage !== undefined)
105
120
  lines.push(` startMessage: ${quote(tool.startMessage)},`);
106
121
  if (tool.runAs !== undefined)
107
- lines.push(` runAs: ${printRunAs(tool.runAs)},`);
122
+ lines.push(` runAs: ${printRunAs(tool.runAs, appRefName)},`);
108
123
  if (tool.typeKey === "runAgent") {
109
124
  lines.push(` agent: catalog.${appRefName}.agents${safeMember(tool.targetAgentKey ?? "")},`);
110
125
  lines.push(` workerTaskPrompt: ${quote(tool.workerTaskPrompt ?? "")},`);
@@ -113,9 +128,21 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
113
128
  }
114
129
  if (tool.typeKey === "automation") {
115
130
  lines.push(` automation: catalog.${appRefName}.automations${safeMember(tool.automationKey ?? "")},`);
116
- if (tool.inputs !== undefined && tool.inputs.length > 0) {
131
+ const inputs = tool.inputs ?? [];
132
+ const missingRequired = tool.missingRequiredInputs ?? [];
133
+ if (inputs.length > 0 || missingRequired.length > 0) {
134
+ // `missingRequiredInputs` names REQUIRED trigger parameters this tool
135
+ // has no real mapping for on the platform — `AutomationToolV2` demands
136
+ // every one be present, but there is no real data to print for them
137
+ // (see skill-tool/from-tf.ts's doc comment: inventing an entry here
138
+ // would get faithfully re-serialized to HCL by `elementum build` and
139
+ // propose writing fake data onto a live tool). Print only the REAL
140
+ // captured entries, verbatim, and — only when a required one is still
141
+ // missing — cast the whole (possibly empty) object so the file still
142
+ // compiles; the cast changes nothing about what gets built, since an
143
+ // empty/absent `inputs` already round-trips to the same wire shape.
117
144
  lines.push(" inputs: {");
118
- for (const input of tool.inputs) {
145
+ for (const input of inputs) {
119
146
  const parts = [];
120
147
  if (input.displayName !== undefined && input.displayName !== input.parameterName) {
121
148
  parts.push(`name: ${quote(input.displayName)}`);
@@ -125,7 +152,10 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
125
152
  parts.push(`required: ${input.required}`);
126
153
  lines.push(` ${safeKey(input.parameterName)}: { ${parts.join(", ")} },`);
127
154
  }
128
- lines.push(" },");
155
+ const cast = missingRequired.length > 0
156
+ ? ` as any /* TODO: automation requires input(s) for ${missingRequired.map((n) => quote(n)).join(", ")} — this tool has no mapping configured on the platform; add real inputs and remove this cast before deploying */`
157
+ : "";
158
+ lines.push(` }${cast},`);
129
159
  }
130
160
  if (tool.outputs !== undefined && tool.outputs.length > 0) {
131
161
  lines.push(" outputs: {");
@@ -141,7 +171,13 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
141
171
  return lines;
142
172
  }
143
173
  if (tool.target?.kind === "self") {
144
- lines.push(` aspect: catalog.${appRefName},`);
174
+ // A search-table tool targets the ELEMENT that owns the table, so a "self"
175
+ // target means the owning aspect IS that element — emit `element:`, not
176
+ // `app:`. (A foreignApp target on a searchTable tool is malformed input:
177
+ // apps never own search tables. It keeps printing `app:` below so tsc
178
+ // rejects the emitted source loudly instead of mislabelling an app as an
179
+ // element.)
180
+ lines.push(` ${tool.typeKey === "searchTable" ? "element" : "app"}: catalog.${appRefName},`);
145
181
  }
146
182
  else if (tool.target !== undefined) {
147
183
  // Board issue #42: the target can be a foreign APP or a foreign
@@ -153,7 +189,7 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
153
189
  if (foreignRefName !== undefined) {
154
190
  // The dependency is already pulled into this workspace (board issue
155
191
  // #40) — a typed token, not a stub.
156
- lines.push(` aspect: catalog.${foreignRefName},`);
192
+ lines.push(` ${entityKind}: catalog.${foreignRefName},`);
157
193
  }
158
194
  else {
159
195
  // The foreign app/element's catalog may not exist in this workspace —
@@ -163,7 +199,7 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
163
199
  const todo = crossOrg
164
200
  ? ` // TODO: cross-org clone — "${tool.target.name}" was resolved in the SOURCE org; verify it exists (with this name) in the destination org`
165
201
  : "";
166
- lines.push(` aspect: { __kind: ${quote(entityKind)}, refName: ${quote(tool.target.name)}, name: ${quote(tool.target.name)} },${todo}`);
202
+ lines.push(` ${entityKind}: { __kind: ${quote(entityKind)}, refName: ${quote(tool.target.name)}, name: ${quote(tool.target.name)} },${todo}`);
167
203
  }
168
204
  }
169
205
  if (tool.typeKey === "searchAspect") {
@@ -171,6 +207,26 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
171
207
  if (tool.limit !== undefined)
172
208
  lines.push(` limit: ${tool.limit},`);
173
209
  }
210
+ if (tool.typeKey === "searchTable") {
211
+ if (tool.searchTableKey !== undefined) {
212
+ lines.push(` table: catalog.${targetRefName ?? appRefName}.searchTables${safeMember(tool.searchTableKey)},`);
213
+ }
214
+ else {
215
+ const parent = tool.target?.kind === "self" ? appRefName : tool.target?.name ?? "";
216
+ const typedTable = tool.searchTableName === undefined
217
+ ? undefined
218
+ : foreignSearchTableRefsByName?.get(searchTableLookupKey(parent, tool.searchTableName));
219
+ if (typedTable !== undefined) {
220
+ lines.push(` table: catalog.${typedTable.ownerRefName}.searchTables${safeMember(typedTable.tableKey)},`);
221
+ }
222
+ else {
223
+ lines.push(` table: { __kind: "searchTable", refName: ${quote(tool.searchTableName ?? "")}, name: ${quote(tool.searchTableName ?? "")}, parent: ${quote(parent)} },`);
224
+ }
225
+ }
226
+ lines.push(` queryDescription: ${quote(tool.queryDescription ?? "")},`);
227
+ if (tool.limit !== undefined)
228
+ lines.push(` limit: ${tool.limit},`);
229
+ }
174
230
  if (tool.typeKey === "updateRecord") {
175
231
  lines.push(` handleDescription: ${quote(tool.handleDescription ?? "")},`);
176
232
  }
@@ -182,26 +238,31 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
182
238
  // reference — it falls back to a bare platform id (board issue #169);
183
239
  // print the raw-id shape (SkillSearchRawIdField/SkillRecordRawIdField)
184
240
  // instead of a catalog token.
185
- const isRaw = f.key === undefined;
241
+ const resolvedRaw = f.rawFieldId === undefined ? undefined : foreignFieldRefsById?.get(f.rawFieldId);
242
+ const isRaw = f.key === undefined && resolvedRaw === undefined;
186
243
  // A field always belongs to the tool's TARGET, not necessarily the
187
244
  // owning app — `owner` (self/foreign-resolved/foreign-unresolved)
188
245
  // mirrors the `aspect:` resolution above.
189
246
  const parts = isRaw
190
- ? [`fieldId: ${quote(f.rawFieldId ?? "")}`]
191
- : owner.kind === "catalog"
192
- ? [`field: ${owner.expr}.fields.${f.key}`]
193
- : [
194
- `field: { __kind: "field", refName: ${quote(f.key)}, name: ${quote(f.name ?? f.key)}, fieldType: "TEXT", ` +
195
- `parent: ${quote(owner.name)}, parentKind: ${quote(owner.entityType)}, parentName: ${quote(owner.name)} }`,
196
- ];
247
+ ? [`fieldId: unsafePlatformId(${quote(f.rawFieldId ?? "")})`]
248
+ : resolvedRaw !== undefined
249
+ ? [`field: catalog.${resolvedRaw.ownerRefName}.fields.${resolvedRaw.fieldKey}`]
250
+ : owner.kind === "catalog"
251
+ ? [`field: ${owner.expr}.fields.${f.key}`]
252
+ : [
253
+ `field: { __kind: "field", refName: ${quote(f.key)}, name: ${quote(f.name ?? f.key)}, fieldType: "TEXT", ` +
254
+ `parent: ${quote(owner.name)}, parentKind: ${quote(owner.entityType)}, parentName: ${quote(owner.name)} }`,
255
+ ];
197
256
  parts.push(`name: ${quote(f.name ?? "")}`);
198
257
  parts.push(`description: ${quote(f.description ?? "")}`);
199
258
  if ((tool.typeKey === "createRecord" || tool.typeKey === "updateRecord") && f.required !== undefined) {
200
259
  parts.push(`required: ${f.required}`);
201
260
  }
261
+ if (f.defaultValue !== undefined)
262
+ parts.push(`defaultValue: ${quote(f.defaultValue)}`);
202
263
  const todo = isRaw
203
264
  ? " // TODO: raw platform field id - the field belongs to a foreign/out-of-scope aspect ei can't resolve to a reference"
204
- : owner.kind === "raw"
265
+ : owner.kind === "raw" && resolvedRaw === undefined
205
266
  ? ` // TODO: foreign field — type unconfirmed (ei's elementum_field data source doesn't expose it) and refName is a best-effort guess; verify against "${owner.name}"`
206
267
  : "";
207
268
  lines.push(` { ${parts.join(", ")} },${todo}`);
@@ -3,5 +3,6 @@
3
3
  * which the deploy wire client injects) with `CatalogRef` tokens at every
4
4
  * reference position. Standalone from v1.
5
5
  */
6
- export { defineSkill, type SkillConfigured, type SkillV2Options } from "./build.js";
7
- export { skillAutomation, skillCreateRecord, skillRunAgent, skillSearchAspect, skillSearchTable, skillUpdateRecord, type SkillRecordField, type SkillRecordFieldInput, type SkillRecordRawIdField, type SkillSearchField, type SkillSearchFieldInput, type SkillSearchRawIdField, type SkillToolStatus, type SkillTool, } from "./tools.js";
6
+ export { skill, type SkillConfigured, type SkillV2Options } from "./build.js";
7
+ export { serviceAccountRef, type AgentToolRunAs, type ServiceAccountRef, } from "../agent/run-as.js";
8
+ export { skillAutomation, skillCreateRecord, skillRunAgent, skillSearchRecords, skillSearchTable, skillUpdateRecord, type SkillRecordField, type SkillRecordFieldInput, type SkillRecordRawIdField, type SkillSearchField, type SkillSearchFieldInput, type SkillSearchRawIdField, type SkillToolStatus, type SkillTool, } from "./tools.js";
@@ -3,5 +3,6 @@
3
3
  * which the deploy wire client injects) with `CatalogRef` tokens at every
4
4
  * reference position. Standalone from v1.
5
5
  */
6
- export { defineSkill } from "./build.js";
7
- export { skillAutomation, skillCreateRecord, skillRunAgent, skillSearchAspect, skillSearchTable, skillUpdateRecord, } from "./tools.js";
6
+ export { skill } from "./build.js";
7
+ export { serviceAccountRef, } from "../agent/run-as.js";
8
+ export { skillAutomation, skillCreateRecord, skillRunAgent, skillSearchRecords, skillSearchTable, skillUpdateRecord, } from "./tools.js";
@@ -1,5 +1,5 @@
1
1
  /** The skill entity's registry entry + resource-type constant (see src/graph/). */
2
- import { bareFactoryEntry } from "../../catalog/render-helpers.js";
2
+ import { rootParentFactoryEntry } from "../../catalog/render-helpers.js";
3
3
  import { isTfExpr } from "../../engine/tf/index.js";
4
4
  import { printSkillV2 } from "./deserializer/print-skill-v2.js";
5
5
  import { skillFromTf } from "./from-tf.js";
@@ -88,6 +88,10 @@ export const skillModule = {
88
88
  ...(opts.crossOrg !== undefined && { crossOrg: opts.crossOrg }),
89
89
  ...(opts.foreignAppRefNames !== undefined && { foreignAppRefNames: opts.foreignAppRefNames }),
90
90
  ...(opts.foreignElementRefNames !== undefined && { foreignElementRefNames: opts.foreignElementRefNames }),
91
+ ...(opts.foreignFieldRefsById !== undefined && { foreignFieldRefsById: opts.foreignFieldRefsById }),
92
+ ...(opts.foreignSearchTableRefsByName !== undefined && {
93
+ foreignSearchTableRefsByName: opts.foreignSearchTableRefsByName,
94
+ }),
91
95
  }),
92
96
  };
93
97
  },
@@ -95,6 +99,8 @@ export const skillModule = {
95
99
  appRefName: ctx.appRefName,
96
100
  appTfLabel: ctx.appTfLabel,
97
101
  orgRefs: ctx.orgRefs,
102
+ workspaceAspects: ctx.workspaceAspects,
103
+ serviceAccounts: ctx.streamRootEntity?.payload?.serviceAccounts,
98
104
  diagnostics: ctx.diagnostics,
99
105
  ...(ctx.siblingEntities !== undefined && { siblingEntities: ctx.siblingEntities }),
100
106
  }),
@@ -105,7 +111,7 @@ export const skillModule = {
105
111
  catalogBag: "skills",
106
112
  renderOrder: 30,
107
113
  catalogRoot: "app",
108
- renderEntry: ({ keyName, baseIndent }) => bareFactoryEntry("skillRef", keyName, baseIndent),
114
+ renderEntry: rootParentFactoryEntry("skillRef"),
109
115
  stubRef: skillStubRef,
110
116
  refFromAuthoring: skillRefFromAuthoring,
111
117
  },
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Skill emission: `skillToTf` consumes the discovered `DeployableEntity`
3
- * (the `defineSkill` def() payload) and emits `elementum_agentic_skill` +
3
+ * (the `skill` def() payload) and emits `elementum_agentic_skill` +
4
4
  * one tool resource per implemented tool (the tool pass delegates to
5
5
  * `entities/skill-tool/to-tf.ts`). Mirrors `entities/agent/to-tf.ts`.
6
6
  *
@@ -13,14 +13,18 @@
13
13
  * *_keywords, routing_priority) and access policy (user_ids/group_ids)
14
14
  * aren't authored yet, so there's nothing to emit for them.
15
15
  */
16
- import type { OrgRefLookup } from "../../engine/build/context.js";
16
+ import type { OrgRefLookup, WorkspaceAspect } from "../../engine/build/context.js";
17
17
  import { type DeployableEntity } from "../../engine/entity.js";
18
18
  import { type TfBlock } from "../../engine/tf/index.js";
19
+ import type { AppServiceAccount } from "../service-account/build.js";
19
20
  export interface SkillToTfContext {
20
21
  /** The owning app's refName (self-target detection) and tfLabel (namespace). */
21
22
  readonly appRefName: string;
22
23
  readonly appTfLabel: string;
23
24
  readonly orgRefs: OrgRefLookup;
25
+ readonly workspaceAspects?: ReadonlyMap<string, WorkspaceAspect>;
26
+ /** Inline service accounts authored on the owning app, keyed by their stable bag key. */
27
+ readonly serviceAccounts?: Readonly<Record<string, AppServiceAccount>>;
24
28
  /** Degradations land here — reported by the caller, never silent. */
25
29
  readonly diagnostics: string[];
26
30
  /**
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Skill emission: `skillToTf` consumes the discovered `DeployableEntity`
3
- * (the `defineSkill` def() payload) and emits `elementum_agentic_skill` +
3
+ * (the `skill` def() payload) and emits `elementum_agentic_skill` +
4
4
  * one tool resource per implemented tool (the tool pass delegates to
5
5
  * `entities/skill-tool/to-tf.ts`). Mirrors `entities/agent/to-tf.ts`.
6
6
  *
@@ -17,7 +17,23 @@ import { EntityTfError } from "../../engine/entity.js";
17
17
  import { appScopedResourceLabel, expr, sanitizeName, tsLabelToTfLabel } from "../../engine/tf/index.js";
18
18
  import { skillToolToTf } from "../skill-tool/to-tf.js";
19
19
  import { APP_RESOURCE_TYPE } from "../app/module.js";
20
+ import { SERVICE_ACCOUNT_RESOURCE_TYPE } from "../service-account/module.js";
20
21
  import { SKILL_RESOURCE_TYPE } from "./module.js";
22
+ function serviceAccountValue(name, ctx) {
23
+ const matches = Object.entries(ctx.serviceAccounts ?? {}).filter(([, account]) => `${account.firstName} ${account.lastName}`.trim() === name);
24
+ if (matches.length > 1) {
25
+ throw new EntityTfError(`service account name ${JSON.stringify(name)} is ambiguous in app ${JSON.stringify(ctx.appRefName)}`);
26
+ }
27
+ const local = matches[0];
28
+ if (local !== undefined) {
29
+ return expr.resourceAttr(SERVICE_ACCOUNT_RESOURCE_TYPE, appScopedResourceLabel(ctx.appTfLabel, tsLabelToTfLabel(local[0])), ["id"]);
30
+ }
31
+ const label = appScopedResourceLabel(ctx.appTfLabel, sanitizeName(name));
32
+ ctx.orgRefs.rawLookup(SERVICE_ACCOUNT_RESOURCE_TYPE, label, name, {
33
+ app_id: expr.resourceAttr(APP_RESOURCE_TYPE, ctx.appTfLabel, ["id"]),
34
+ });
35
+ return expr.dataAttr(SERVICE_ACCOUNT_RESOURCE_TYPE, label, ["id"]);
36
+ }
21
37
  function toSortableSkills(entities) {
22
38
  const out = [];
23
39
  for (const entity of entities) {
@@ -83,7 +99,7 @@ export function skillToTf(entity, ctx) {
83
99
  const payload = entity.payload;
84
100
  const elementum = payload?.skill;
85
101
  if (payload === null || typeof payload !== "object" || elementum === undefined) {
86
- throw new EntityTfError(`skill "${entity.refName}" has no skill payload — was it built with defineSkill?`);
102
+ throw new EntityTfError(`skill "${entity.refName}" has no skill payload — was it built with skill?`);
87
103
  }
88
104
  const tfLabel = appScopedResourceLabel(ctx.appTfLabel, tsLabelToTfLabel(entity.refName));
89
105
  const name = elementum.name ?? "";
@@ -110,6 +126,8 @@ export function skillToTf(entity, ctx) {
110
126
  foreignAppRef: (l, n) => ctx.orgRefs.foreignApp(l, n),
111
127
  foreignElementRef: (l, n) => ctx.orgRefs.foreignElement(l, n),
112
128
  foreignFieldRef: (t, l, o, n) => ctx.orgRefs.foreignField(t, l, o, n),
129
+ workspaceAspects: ctx.workspaceAspects,
130
+ serviceAccountRef: (_label, serviceAccountName) => serviceAccountValue(serviceAccountName, ctx),
113
131
  diagnostics: ctx.diagnostics,
114
132
  });
115
133
  if (tool !== undefined)
@@ -9,13 +9,27 @@
9
9
  * Search/record fields require `name` + `description` (matching the v1 skill
10
10
  * serializer, which always emits them).
11
11
  */
12
- import type { AgentRef, AspectRef, AutomationCatalogRef, FieldRef, SearchTableRef } from "../../catalog/index.js";
12
+ import type { AgentRef, AppCatalogRef, AutomationCatalogRef, ElementCatalogRef, FieldRef, SearchTableRef } from "../../catalog/index.js";
13
+ import type { UnsafePlatformId } from "../../core/platform-id.js";
13
14
  import type { AgentToolRunAs, RunAutomationToolV2 } from "../agent/tools.js";
14
- /** A handle-form skill tool: an `AgenticSkillToolCreateInput` with ref tokens. */
15
- export type SkillTool = Record<string, unknown>;
15
+ declare const skillToolBrand: unique symbol;
16
+ /** A closed factory result; arbitrary records cannot be added to a skill's tool list. */
17
+ export type SkillTool = Record<string, unknown> & {
18
+ readonly [skillToolBrand]: "SkillTool";
19
+ };
16
20
  export type SkillToolStatus = "ACTIVE" | "INACTIVE";
17
- export interface SkillSearchField {
18
- readonly field: FieldRef;
21
+ type ToolTarget = AppCatalogRef | ElementCatalogRef;
22
+ type TargetOption<Target extends ToolTarget> = Target extends {
23
+ readonly __kind: "app";
24
+ } ? {
25
+ readonly app: Target;
26
+ readonly element?: never;
27
+ } : {
28
+ readonly app?: never;
29
+ readonly element: Target;
30
+ };
31
+ export interface SkillSearchField<Target extends ToolTarget = ToolTarget> {
32
+ readonly field: FieldRef<Target["refName"]>;
19
33
  readonly name: string;
20
34
  readonly description: string;
21
35
  }
@@ -28,13 +42,13 @@ export interface SkillSearchField {
28
42
  * existing tool.
29
43
  */
30
44
  export interface SkillSearchRawIdField {
31
- readonly fieldId: string;
45
+ readonly fieldId: UnsafePlatformId;
32
46
  readonly name: string;
33
47
  readonly description: string;
34
48
  }
35
- export type SkillSearchFieldInput = SkillSearchField | SkillSearchRawIdField;
36
- export interface SkillRecordField {
37
- readonly field: FieldRef;
49
+ export type SkillSearchFieldInput<Target extends ToolTarget = ToolTarget> = SkillSearchField<Target> | SkillSearchRawIdField;
50
+ export interface SkillRecordField<Target extends ToolTarget = ToolTarget> {
51
+ readonly field: FieldRef<Target["refName"]>;
38
52
  readonly name: string;
39
53
  readonly description: string;
40
54
  readonly required: boolean;
@@ -42,12 +56,13 @@ export interface SkillRecordField {
42
56
  }
43
57
  /** A create/update-record field identified by a raw platform id — see {@link SkillSearchRawIdField}. */
44
58
  export interface SkillRecordRawIdField {
45
- readonly fieldId: string;
59
+ readonly fieldId: UnsafePlatformId;
46
60
  readonly name: string;
47
61
  readonly description: string;
48
62
  readonly required: boolean;
63
+ readonly defaultValue?: string;
49
64
  }
50
- export type SkillRecordFieldInput = SkillRecordField | SkillRecordRawIdField;
65
+ export type SkillRecordFieldInput<Target extends ToolTarget = ToolTarget> = SkillRecordField<Target> | SkillRecordRawIdField;
51
66
  interface CommonToolOptions {
52
67
  readonly name: string;
53
68
  readonly description: string;
@@ -64,34 +79,35 @@ export type AutomationToolV2<A extends AutomationCatalogRef = AutomationCatalogR
64
79
  * must be mapped and output keys autocomplete, matching agentRunAutomation.
65
80
  */
66
81
  export declare function skillAutomation<A extends AutomationCatalogRef>(opts: AutomationToolV2<A>): SkillTool;
67
- export interface SkillSearchAspectToolV2 extends CommonToolOptions {
68
- readonly aspect: AspectRef;
82
+ export type SkillSearchRecordsToolOptions<Target extends ToolTarget = ToolTarget> = CommonToolOptions & TargetOption<Target> & {
69
83
  readonly queryDescription: string;
70
- readonly fields: readonly SkillSearchFieldInput[];
84
+ readonly fields?: readonly SkillSearchFieldInput<Target>[];
71
85
  /** Maximum number of records the search returns. */
72
86
  readonly limit?: number;
73
- }
74
- export declare function skillSearchAspect(opts: SkillSearchAspectToolV2): SkillTool;
75
- export interface SkillSearchTableToolV2 extends CommonToolOptions {
76
- readonly aspect: AspectRef;
87
+ };
88
+ export declare function skillSearchRecords<Target extends ToolTarget>(opts: SkillSearchRecordsToolOptions<Target>): SkillTool;
89
+ /**
90
+ * A search-table tool targets the ELEMENT that owns the search table — never an
91
+ * app. See `search-table/build.ts`'s `SearchTableOwner`: an app's backing
92
+ * Snowflake table is hybrid, which Cortex cannot index.
93
+ */
94
+ export type SkillSearchTableToolV2<Target extends ElementCatalogRef = ElementCatalogRef> = CommonToolOptions & TargetOption<Target> & {
77
95
  readonly table: SearchTableRef;
78
96
  readonly queryDescription: string;
79
- readonly fields: readonly SkillSearchField[];
97
+ readonly fields: readonly SkillSearchFieldInput<Target>[];
80
98
  /** Maximum number of records the search returns. */
81
99
  readonly limit?: number;
82
- }
83
- export declare function skillSearchTable(opts: SkillSearchTableToolV2): SkillTool;
84
- export interface SkillCreateRecordToolV2 extends CommonToolOptions {
85
- readonly aspect: AspectRef;
86
- readonly fields: readonly SkillRecordFieldInput[];
87
- }
88
- export declare function skillCreateRecord(opts: SkillCreateRecordToolV2): SkillTool;
89
- export interface SkillUpdateRecordToolV2 extends CommonToolOptions {
90
- readonly aspect: AspectRef;
91
- readonly fields: readonly SkillRecordFieldInput[];
100
+ };
101
+ export declare function skillSearchTable<Target extends ElementCatalogRef>(opts: SkillSearchTableToolV2<Target>): SkillTool;
102
+ export type SkillCreateRecordToolV2<Target extends ToolTarget = ToolTarget> = CommonToolOptions & TargetOption<Target> & {
103
+ readonly fields?: readonly SkillRecordFieldInput<Target>[];
104
+ };
105
+ export declare function skillCreateRecord<Target extends ToolTarget>(opts: SkillCreateRecordToolV2<Target>): SkillTool;
106
+ export type SkillUpdateRecordToolV2<Target extends ToolTarget = ToolTarget> = CommonToolOptions & TargetOption<Target> & {
107
+ readonly fields?: readonly SkillRecordFieldInput<Target>[];
92
108
  readonly handleDescription: string;
93
- }
94
- export declare function skillUpdateRecord(opts: SkillUpdateRecordToolV2): SkillTool;
109
+ };
110
+ export declare function skillUpdateRecord<Target extends ToolTarget>(opts: SkillUpdateRecordToolV2<Target>): SkillTool;
95
111
  export interface SkillRunAgentToolV2 extends CommonToolOptions {
96
112
  readonly agent: AgentRef;
97
113
  readonly workerTaskPrompt: string;