@elementumai/edk 0.8.2-alpha.6 → 0.9.2

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 (372) hide show
  1. package/README.md +18 -14
  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 +2 -10
  6. package/dist-sdk/elementum-entity-client/clients/skills/models/skill-tool.d.ts +1 -1
  7. package/dist-sdk/fs/entity.d.ts +2 -2
  8. package/dist-sdk/fs/entity.js +1 -1
  9. package/dist-sdk/pull/missing-report.d.ts +81 -0
  10. package/dist-sdk/pull/missing-report.js +52 -0
  11. package/dist-sdk/src/catalog/factories.d.ts +53 -19
  12. package/dist-sdk/src/catalog/factories.js +51 -12
  13. package/dist-sdk/src/catalog/from-authoring.js +13 -3
  14. package/dist-sdk/src/catalog/index.d.ts +2 -2
  15. package/dist-sdk/src/catalog/index.js +1 -1
  16. package/dist-sdk/src/catalog/org.js +1 -0
  17. package/dist-sdk/src/catalog/render.js +6 -0
  18. package/dist-sdk/src/catalog/token.js +7 -0
  19. package/dist-sdk/src/catalog/types.d.ts +34 -23
  20. package/dist-sdk/src/catalog/types.js +7 -4
  21. package/dist-sdk/src/core/app-to-ui.d.ts +6 -6
  22. package/dist-sdk/src/core/app-to-ui.js +7 -9
  23. package/dist-sdk/src/core/index.d.ts +1 -0
  24. package/dist-sdk/src/core/index.js +1 -0
  25. package/dist-sdk/src/core/platform-id.d.ts +11 -0
  26. package/dist-sdk/src/core/platform-id.js +8 -0
  27. package/dist-sdk/src/{entities/flow/activities/render-catalog.d.ts → core/render-tree.d.ts} +2 -2
  28. package/dist-sdk/src/{entities/flow/activities/render-catalog.js → core/render-tree.js} +6 -8
  29. package/dist-sdk/src/core/types/app.d.ts +13 -23
  30. package/dist-sdk/src/core/types/app.js +0 -1
  31. package/dist-sdk/src/engine/build/context.d.ts +3 -3
  32. package/dist-sdk/src/engine/pull/attrs.d.ts +4 -0
  33. package/dist-sdk/src/engine/pull/attrs.js +17 -0
  34. package/dist-sdk/src/engine/pull/context.d.ts +39 -0
  35. package/dist-sdk/src/engine/pull/org.d.ts +1 -0
  36. package/dist-sdk/src/engine/pull/org.js +2 -0
  37. package/dist-sdk/src/engine/tf/expr.d.ts +1 -1
  38. package/dist-sdk/src/engine/tf/expr.js +10 -3
  39. package/dist-sdk/src/engine/workspace/authoring-layout.js +4 -2
  40. package/dist-sdk/src/entities/access-policy/build.d.ts +4 -13
  41. package/dist-sdk/src/entities/access-policy/build.js +1 -1
  42. package/dist-sdk/src/entities/access-policy/from-tf.d.ts +12 -38
  43. package/dist-sdk/src/entities/access-policy/from-tf.js +16 -74
  44. package/dist-sdk/src/entities/access-policy/principal.d.ts +29 -0
  45. package/dist-sdk/src/entities/access-policy/principal.js +13 -0
  46. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +20 -5
  47. package/dist-sdk/src/entities/access-policy/to-tf.js +26 -54
  48. package/dist-sdk/src/entities/agent/build.d.ts +39 -8
  49. package/dist-sdk/src/entities/agent/build.js +36 -15
  50. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +5 -0
  51. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +121 -36
  52. package/dist-sdk/src/entities/agent/from-tf.js +5 -8
  53. package/dist-sdk/src/entities/agent/index.d.ts +5 -2
  54. package/dist-sdk/src/entities/agent/index.js +4 -2
  55. package/dist-sdk/src/entities/agent/module.js +5 -2
  56. package/dist-sdk/src/entities/agent/run-as.d.ts +16 -0
  57. package/dist-sdk/src/entities/agent/run-as.js +1 -0
  58. package/dist-sdk/src/entities/agent/to-tf.d.ts +2 -1
  59. package/dist-sdk/src/entities/agent/to-tf.js +2 -1
  60. package/dist-sdk/src/entities/agent/tools.d.ts +60 -48
  61. package/dist-sdk/src/entities/agent/tools.js +44 -38
  62. package/dist-sdk/src/entities/agent-a2a-skill/from-tf.js +1 -1
  63. package/dist-sdk/src/entities/agent-a2a-skill/to-tf.js +4 -4
  64. package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +17 -8
  65. package/dist-sdk/src/entities/agent-tool/from-tf.js +127 -37
  66. package/dist-sdk/src/entities/agent-tool/module.js +6 -0
  67. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +5 -5
  68. package/dist-sdk/src/entities/agent-tool/to-tf.js +93 -20
  69. package/dist-sdk/src/entities/agent-tool/types.d.ts +4 -5
  70. package/dist-sdk/src/entities/agent-tool/types.js +36 -8
  71. package/dist-sdk/src/entities/app/build.d.ts +137 -25
  72. package/dist-sdk/src/entities/app/build.js +104 -53
  73. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +173 -1
  74. package/dist-sdk/src/entities/app/deserializer/pulled-expression.d.ts +59 -0
  75. package/dist-sdk/src/entities/app/deserializer/pulled-expression.js +68 -0
  76. package/dist-sdk/src/entities/app/display-blocks.d.ts +2 -1
  77. package/dist-sdk/src/entities/app/display-blocks.js +1 -1
  78. package/dist-sdk/src/entities/app/from-tf.d.ts +11 -1
  79. package/dist-sdk/src/entities/app/from-tf.js +30 -2
  80. package/dist-sdk/src/entities/app/index.d.ts +13 -4
  81. package/dist-sdk/src/entities/app/index.js +8 -1
  82. package/dist-sdk/src/entities/app/module.js +27 -2
  83. package/dist-sdk/src/entities/app/to-tf.js +75 -1
  84. package/dist-sdk/src/entities/approval-chain/build.d.ts +31 -16
  85. package/dist-sdk/src/entities/approval-chain/build.js +49 -49
  86. package/dist-sdk/src/entities/approval-chain/from-tf.d.ts +17 -0
  87. package/dist-sdk/src/entities/approval-chain/from-tf.js +57 -0
  88. package/dist-sdk/src/entities/approval-chain/index.d.ts +2 -3
  89. package/dist-sdk/src/entities/approval-chain/index.js +2 -3
  90. package/dist-sdk/src/entities/approval-chain/module.d.ts +3 -0
  91. package/dist-sdk/src/entities/approval-chain/module.js +51 -0
  92. package/dist-sdk/src/entities/approval-chain/printer.d.ts +2 -0
  93. package/dist-sdk/src/entities/approval-chain/printer.js +21 -0
  94. package/dist-sdk/src/entities/approval-chain/to-tf.d.ts +9 -0
  95. package/dist-sdk/src/entities/approval-chain/to-tf.js +43 -0
  96. package/dist-sdk/src/entities/automation/build.d.ts +10 -6
  97. package/dist-sdk/src/entities/automation/build.js +5 -4
  98. package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +10 -8
  99. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +51 -114
  100. package/dist-sdk/src/entities/automation/filter.d.ts +1 -115
  101. package/dist-sdk/src/entities/automation/filter.js +1 -197
  102. package/dist-sdk/src/entities/automation/from-tf.d.ts +4 -0
  103. package/dist-sdk/src/entities/automation/from-tf.js +202 -119
  104. package/dist-sdk/src/entities/automation/index.d.ts +4 -2
  105. package/dist-sdk/src/entities/automation/index.js +3 -1
  106. package/dist-sdk/src/entities/automation/module.js +10 -4
  107. package/dist-sdk/src/entities/automation/script-code.js +94 -6
  108. package/dist-sdk/src/entities/automation/tasks.d.ts +20 -19
  109. package/dist-sdk/src/entities/automation/tasks.js +2 -2
  110. package/dist-sdk/src/entities/automation/to-tf.d.ts +34 -2
  111. package/dist-sdk/src/entities/automation/to-tf.js +273 -98
  112. package/dist-sdk/src/entities/automation/triggers.d.ts +18 -17
  113. package/dist-sdk/src/entities/automation/triggers.js +1 -1
  114. package/dist-sdk/src/entities/dashboard/build.d.ts +17 -0
  115. package/dist-sdk/src/entities/dashboard/from-tf.d.ts +12 -0
  116. package/dist-sdk/src/entities/dashboard/from-tf.js +95 -0
  117. package/dist-sdk/src/entities/dashboard/module.d.ts +3 -0
  118. package/dist-sdk/src/entities/dashboard/module.js +16 -0
  119. package/dist-sdk/src/entities/dashboard/to-tf.d.ts +30 -0
  120. package/dist-sdk/src/entities/dashboard/to-tf.js +94 -0
  121. package/dist-sdk/src/entities/dashboard-widget/module.d.ts +3 -0
  122. package/dist-sdk/src/entities/dashboard-widget/module.js +10 -0
  123. package/dist-sdk/src/entities/data-lookup/module.d.ts +3 -0
  124. package/dist-sdk/src/entities/data-lookup/module.js +22 -0
  125. package/dist-sdk/src/entities/datamine/build.d.ts +22 -0
  126. package/dist-sdk/src/entities/datamine/build.js +1 -0
  127. package/dist-sdk/src/entities/datamine/from-tf.d.ts +17 -0
  128. package/dist-sdk/src/entities/datamine/from-tf.js +98 -0
  129. package/dist-sdk/src/entities/datamine/module.d.ts +3 -0
  130. package/dist-sdk/src/entities/datamine/module.js +23 -0
  131. package/dist-sdk/src/entities/datamine/to-tf.d.ts +11 -0
  132. package/dist-sdk/src/entities/datamine/to-tf.js +53 -0
  133. package/dist-sdk/src/entities/dynamic-layout/build.d.ts +303 -0
  134. package/dist-sdk/src/entities/dynamic-layout/build.js +4 -0
  135. package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +2 -0
  136. package/dist-sdk/src/entities/dynamic-layout/dialect.js +9 -0
  137. package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +10 -0
  138. package/dist-sdk/src/entities/dynamic-layout/from-tf.js +233 -0
  139. package/dist-sdk/src/entities/dynamic-layout/module.d.ts +3 -0
  140. package/dist-sdk/src/entities/dynamic-layout/module.js +13 -0
  141. package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +26 -0
  142. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +267 -0
  143. package/dist-sdk/src/entities/element/build.d.ts +31 -14
  144. package/dist-sdk/src/entities/element/build.js +12 -4
  145. package/dist-sdk/src/entities/element/from-tf.d.ts +9 -1
  146. package/dist-sdk/src/entities/element/from-tf.js +31 -2
  147. package/dist-sdk/src/entities/element/index.d.ts +8 -3
  148. package/dist-sdk/src/entities/element/index.js +4 -1
  149. package/dist-sdk/src/entities/element/module.js +19 -2
  150. package/dist-sdk/src/entities/element/to-tf.js +57 -1
  151. package/dist-sdk/src/entities/field/build.d.ts +4 -3
  152. package/dist-sdk/src/entities/field/calculation-types.d.ts +6 -0
  153. package/dist-sdk/src/entities/field/calculation-types.js +42 -0
  154. package/dist-sdk/src/entities/field/from-tf.js +90 -11
  155. package/dist-sdk/src/entities/field/module.d.ts +1 -0
  156. package/dist-sdk/src/entities/field/module.js +5 -2
  157. package/dist-sdk/src/entities/field/record-shape.d.ts +1 -1
  158. package/dist-sdk/src/entities/field/to-tf.d.ts +1 -1
  159. package/dist-sdk/src/entities/field/to-tf.js +22 -6
  160. package/dist-sdk/src/entities/field/types.js +3 -0
  161. package/dist-sdk/src/entities/file-reader/build.d.ts +66 -19
  162. package/dist-sdk/src/entities/file-reader/build.js +49 -4
  163. package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.d.ts +1 -0
  164. package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.js +11 -9
  165. package/dist-sdk/src/entities/file-reader/from-tf.d.ts +1 -1
  166. package/dist-sdk/src/entities/file-reader/from-tf.js +31 -2
  167. package/dist-sdk/src/entities/file-reader/index.d.ts +3 -3
  168. package/dist-sdk/src/entities/file-reader/index.js +3 -3
  169. package/dist-sdk/src/entities/file-reader/module.js +6 -5
  170. package/dist-sdk/src/entities/file-reader/to-tf.d.ts +1 -1
  171. package/dist-sdk/src/entities/file-reader/to-tf.js +5 -2
  172. package/dist-sdk/src/entities/file-reader/types.d.ts +3 -4
  173. package/dist-sdk/src/entities/file-reader/types.js +4 -5
  174. package/dist-sdk/src/entities/org/category.js +4 -5
  175. package/dist-sdk/src/entities/org/group.js +4 -5
  176. package/dist-sdk/src/entities/org/index.d.ts +1 -0
  177. package/dist-sdk/src/entities/org/index.js +1 -0
  178. package/dist-sdk/src/entities/org/phone-provider.d.ts +4 -0
  179. package/dist-sdk/src/entities/org/phone-provider.js +33 -0
  180. package/dist-sdk/src/entities/org/role.d.ts +3 -3
  181. package/dist-sdk/src/entities/org/role.js +9 -6
  182. package/dist-sdk/src/entities/organization/build.d.ts +29 -0
  183. package/dist-sdk/src/entities/organization/build.js +24 -0
  184. package/dist-sdk/src/entities/organization/index.d.ts +2 -0
  185. package/dist-sdk/src/entities/organization/index.js +2 -0
  186. package/dist-sdk/src/entities/organization/module.d.ts +2 -0
  187. package/dist-sdk/src/entities/organization/module.js +18 -0
  188. package/dist-sdk/src/entities/organization/to-tf.d.ts +6 -0
  189. package/dist-sdk/src/entities/organization/to-tf.js +37 -0
  190. package/dist-sdk/src/entities/phone-service/build.d.ts +17 -0
  191. package/dist-sdk/src/entities/phone-service/build.js +31 -0
  192. package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.d.ts +4 -0
  193. package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.js +54 -0
  194. package/dist-sdk/src/entities/phone-service/from-tf.d.ts +25 -0
  195. package/dist-sdk/src/entities/phone-service/from-tf.js +75 -0
  196. package/dist-sdk/src/entities/phone-service/index.d.ts +2 -0
  197. package/dist-sdk/src/entities/phone-service/index.js +2 -0
  198. package/dist-sdk/src/entities/phone-service/module.d.ts +3 -0
  199. package/dist-sdk/src/entities/phone-service/module.js +55 -0
  200. package/dist-sdk/src/entities/phone-service/to-tf.d.ts +12 -0
  201. package/dist-sdk/src/entities/phone-service/to-tf.js +54 -0
  202. package/dist-sdk/src/entities/phone-service/types.d.ts +35 -0
  203. package/dist-sdk/src/entities/phone-service/types.js +22 -0
  204. package/dist-sdk/src/entities/record-create-form/from-tf.d.ts +11 -0
  205. package/dist-sdk/src/entities/record-create-form/from-tf.js +74 -0
  206. package/dist-sdk/src/entities/record-create-form/module.d.ts +11 -0
  207. package/dist-sdk/src/entities/record-create-form/module.js +24 -0
  208. package/dist-sdk/src/entities/record-create-form/to-tf.d.ts +33 -0
  209. package/dist-sdk/src/entities/record-create-form/to-tf.js +80 -0
  210. package/dist-sdk/src/entities/relationship/build.d.ts +16 -0
  211. package/dist-sdk/src/entities/relationship/build.js +1 -0
  212. package/dist-sdk/src/entities/relationship/from-tf.d.ts +12 -0
  213. package/dist-sdk/src/entities/relationship/from-tf.js +109 -0
  214. package/dist-sdk/src/entities/relationship/module.d.ts +3 -0
  215. package/dist-sdk/src/entities/relationship/module.js +16 -0
  216. package/dist-sdk/src/entities/relationship/to-tf.d.ts +31 -0
  217. package/dist-sdk/src/entities/relationship/to-tf.js +153 -0
  218. package/dist-sdk/src/entities/role/build.d.ts +65 -0
  219. package/dist-sdk/src/entities/role/build.js +33 -0
  220. package/dist-sdk/src/entities/role/from-tf.d.ts +13 -0
  221. package/dist-sdk/src/entities/role/from-tf.js +138 -0
  222. package/dist-sdk/src/entities/role/to-tf.d.ts +13 -0
  223. package/dist-sdk/src/entities/role/to-tf.js +69 -0
  224. package/dist-sdk/src/entities/search-table/build.d.ts +67 -28
  225. package/dist-sdk/src/entities/search-table/build.js +110 -56
  226. package/dist-sdk/src/entities/search-table/from-tf.d.ts +37 -0
  227. package/dist-sdk/src/entities/search-table/from-tf.js +113 -0
  228. package/dist-sdk/src/entities/search-table/index.d.ts +2 -2
  229. package/dist-sdk/src/entities/search-table/index.js +2 -2
  230. package/dist-sdk/src/entities/search-table/module.js +88 -10
  231. package/dist-sdk/src/entities/search-table/printer.d.ts +2 -0
  232. package/dist-sdk/src/entities/search-table/printer.js +52 -0
  233. package/dist-sdk/src/entities/search-table/to-tf.d.ts +14 -0
  234. package/dist-sdk/src/entities/search-table/to-tf.js +104 -0
  235. package/dist-sdk/src/entities/search-table/types.d.ts +8 -0
  236. package/dist-sdk/src/entities/search-table/types.js +21 -0
  237. package/dist-sdk/src/entities/service-account/build.d.ts +32 -0
  238. package/dist-sdk/src/entities/service-account/build.js +9 -0
  239. package/dist-sdk/src/entities/service-account/from-tf.d.ts +10 -0
  240. package/dist-sdk/src/entities/service-account/from-tf.js +109 -0
  241. package/dist-sdk/src/entities/service-account/module.d.ts +4 -0
  242. package/dist-sdk/src/entities/service-account/module.js +21 -0
  243. package/dist-sdk/src/entities/service-account/ref.d.ts +11 -0
  244. package/dist-sdk/src/entities/service-account/ref.js +5 -0
  245. package/dist-sdk/src/entities/service-account/to-tf.d.ts +11 -0
  246. package/dist-sdk/src/entities/service-account/to-tf.js +72 -0
  247. package/dist-sdk/src/entities/shared/connector-from-tf.d.ts +14 -0
  248. package/dist-sdk/src/entities/shared/connector-from-tf.js +14 -0
  249. package/dist-sdk/src/entities/shared/filters/ast.d.ts +21 -79
  250. package/dist-sdk/src/entities/shared/filters/ast.js +5 -2
  251. package/dist-sdk/src/entities/shared/filters/index.d.ts +94 -206
  252. package/dist-sdk/src/entities/shared/filters/index.js +189 -341
  253. package/dist-sdk/src/entities/shared/filters/print.d.ts +11 -0
  254. package/dist-sdk/src/entities/shared/filters/print.js +122 -0
  255. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +170 -0
  256. package/dist-sdk/src/entities/shared/filters/tf-codec.js +527 -0
  257. package/dist-sdk/src/entities/shared/filters/types.d.ts +66 -69
  258. package/dist-sdk/src/entities/shared/filters/types.js +2 -3
  259. package/dist-sdk/src/entities/skill/build.d.ts +2 -2
  260. package/dist-sdk/src/entities/skill/build.js +4 -3
  261. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +10 -0
  262. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +74 -32
  263. package/dist-sdk/src/entities/skill/index.d.ts +2 -1
  264. package/dist-sdk/src/entities/skill/index.js +2 -1
  265. package/dist-sdk/src/entities/skill/module.js +6 -0
  266. package/dist-sdk/src/entities/skill/to-tf.d.ts +5 -1
  267. package/dist-sdk/src/entities/skill/to-tf.js +18 -0
  268. package/dist-sdk/src/entities/skill/tools.d.ts +46 -31
  269. package/dist-sdk/src/entities/skill/tools.js +33 -20
  270. package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +4 -1
  271. package/dist-sdk/src/entities/skill-tool/from-tf.js +76 -8
  272. package/dist-sdk/src/entities/skill-tool/module.js +9 -0
  273. package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +6 -1
  274. package/dist-sdk/src/entities/skill-tool/to-tf.js +94 -42
  275. package/dist-sdk/src/entities/skill-tool/types.js +18 -1
  276. package/dist-sdk/src/entities/table/build.d.ts +64 -23
  277. package/dist-sdk/src/entities/table/build.js +33 -18
  278. package/dist-sdk/src/entities/table/catalog-render.js +6 -0
  279. package/dist-sdk/src/entities/table/deserializer/normalize.d.ts +99 -0
  280. package/dist-sdk/src/entities/table/deserializer/normalize.js +192 -0
  281. package/dist-sdk/src/entities/table/fields/types.d.ts +86 -0
  282. package/dist-sdk/src/entities/table/fields/types.js +12 -0
  283. package/dist-sdk/src/entities/table/fields.d.ts +107 -47
  284. package/dist-sdk/src/entities/table/fields.js +76 -55
  285. package/dist-sdk/src/entities/table/from-tf.d.ts +4 -0
  286. package/dist-sdk/src/entities/table/from-tf.js +261 -0
  287. package/dist-sdk/src/entities/table/index.d.ts +7 -5
  288. package/dist-sdk/src/entities/table/index.js +7 -7
  289. package/dist-sdk/src/entities/table/joins.d.ts +22 -9
  290. package/dist-sdk/src/entities/table/joins.js +8 -16
  291. package/dist-sdk/src/entities/table/module.d.ts +2 -1
  292. package/dist-sdk/src/entities/table/module.js +13 -6
  293. package/dist-sdk/src/entities/table/to-tf.d.ts +10 -0
  294. package/dist-sdk/src/entities/table/to-tf.js +230 -0
  295. package/dist-sdk/src/entities/task/build.d.ts +43 -0
  296. package/dist-sdk/src/entities/task/build.js +17 -0
  297. package/dist-sdk/src/entities/task/from-tf.d.ts +28 -0
  298. package/dist-sdk/src/entities/task/from-tf.js +38 -0
  299. package/dist-sdk/src/entities/task/index.d.ts +1 -0
  300. package/dist-sdk/src/entities/task/index.js +1 -0
  301. package/dist-sdk/src/entities/task/module.d.ts +3 -0
  302. package/dist-sdk/src/entities/task/module.js +12 -0
  303. package/dist-sdk/src/entities/task/to-tf.d.ts +9 -0
  304. package/dist-sdk/src/entities/task/to-tf.js +49 -0
  305. package/dist-sdk/src/entities/view/from-tf.d.ts +7 -2
  306. package/dist-sdk/src/entities/view/from-tf.js +209 -25
  307. package/dist-sdk/src/entities/view/module.js +5 -1
  308. package/dist-sdk/src/entities/view/to-tf.d.ts +49 -7
  309. package/dist-sdk/src/entities/view/to-tf.js +155 -18
  310. package/dist-sdk/src/entities/view/types.d.ts +8 -0
  311. package/dist-sdk/src/entities/view/types.js +43 -0
  312. package/dist-sdk/src/entities/visual-flow/build.d.ts +87 -0
  313. package/dist-sdk/src/entities/visual-flow/build.js +72 -0
  314. package/dist-sdk/src/entities/visual-flow/from-tf.d.ts +49 -0
  315. package/dist-sdk/src/entities/visual-flow/from-tf.js +124 -0
  316. package/dist-sdk/src/entities/visual-flow/index.d.ts +1 -0
  317. package/dist-sdk/src/entities/visual-flow/index.js +1 -0
  318. package/dist-sdk/src/entities/visual-flow/module.d.ts +3 -0
  319. package/dist-sdk/src/entities/visual-flow/module.js +41 -0
  320. package/dist-sdk/src/entities/visual-flow/printer.d.ts +8 -0
  321. package/dist-sdk/src/entities/visual-flow/printer.js +92 -0
  322. package/dist-sdk/src/entities/visual-flow/to-tf.d.ts +14 -0
  323. package/dist-sdk/src/entities/visual-flow/to-tf.js +101 -0
  324. package/dist-sdk/src/entities/widget/build.d.ts +55 -0
  325. package/dist-sdk/src/entities/widget/build.js +1 -0
  326. package/dist-sdk/src/entities/widget/from-tf.d.ts +11 -0
  327. package/dist-sdk/src/entities/widget/from-tf.js +209 -0
  328. package/dist-sdk/src/entities/widget/module.d.ts +3 -0
  329. package/dist-sdk/src/entities/widget/module.js +16 -0
  330. package/dist-sdk/src/entities/widget/to-tf.d.ts +44 -0
  331. package/dist-sdk/src/entities/widget/to-tf.js +204 -0
  332. package/dist-sdk/src/graph/deferred-catalog-render.d.ts +1 -1
  333. package/dist-sdk/src/graph/deferred-catalog-render.js +1 -1
  334. package/dist-sdk/src/graph/index.d.ts +7 -0
  335. package/dist-sdk/src/graph/index.js +4 -18
  336. package/dist-sdk/src/graph/modules.js +30 -1
  337. package/dist-sdk/src/graph/types.d.ts +55 -7
  338. package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
  339. package/dist-sdk/src/internal/sdk-package.js +4 -2
  340. package/package.json +30 -15
  341. package/dist-sdk/src/entities/access-policy/filter.d.ts +0 -61
  342. package/dist-sdk/src/entities/access-policy/filter.js +0 -83
  343. package/dist-sdk/src/entities/approval-chain/steps.d.ts +0 -24
  344. package/dist-sdk/src/entities/approval-chain/steps.js +0 -20
  345. package/dist-sdk/src/entities/flow/activities/agent.d.ts +0 -15
  346. package/dist-sdk/src/entities/flow/activities/agent.js +0 -29
  347. package/dist-sdk/src/entities/flow/activities/approval.d.ts +0 -9
  348. package/dist-sdk/src/entities/flow/activities/approval.js +0 -18
  349. package/dist-sdk/src/entities/flow/activities/automation.d.ts +0 -12
  350. package/dist-sdk/src/entities/flow/activities/automation.js +0 -22
  351. package/dist-sdk/src/entities/flow/activities/ctx.d.ts +0 -34
  352. package/dist-sdk/src/entities/flow/activities/ctx.js +0 -38
  353. package/dist-sdk/src/entities/flow/activities/form.d.ts +0 -22
  354. package/dist-sdk/src/entities/flow/activities/form.js +0 -36
  355. package/dist-sdk/src/entities/flow/activities/index.d.ts +0 -14
  356. package/dist-sdk/src/entities/flow/activities/index.js +0 -13
  357. package/dist-sdk/src/entities/flow/activities/input-refs.d.ts +0 -39
  358. package/dist-sdk/src/entities/flow/activities/input-refs.js +0 -19
  359. package/dist-sdk/src/entities/flow/activities/prompt-template.d.ts +0 -13
  360. package/dist-sdk/src/entities/flow/activities/prompt-template.js +0 -34
  361. package/dist-sdk/src/entities/flow/activities/types.d.ts +0 -33
  362. package/dist-sdk/src/entities/flow/build.d.ts +0 -38
  363. package/dist-sdk/src/entities/flow/build.js +0 -115
  364. package/dist-sdk/src/entities/flow/index.d.ts +0 -8
  365. package/dist-sdk/src/entities/flow/index.js +0 -7
  366. package/dist-sdk/src/entities/flow/serialize.d.ts +0 -51
  367. package/dist-sdk/src/entities/flow/serialize.js +0 -94
  368. package/dist-sdk/src/entities/flow/util.d.ts +0 -27
  369. package/dist-sdk/src/entities/flow/util.js +0 -38
  370. package/dist-sdk/src/entities/table/filter.d.ts +0 -41
  371. package/dist-sdk/src/entities/table/filter.js +0 -89
  372. /package/dist-sdk/src/entities/{flow/activities/types.js → dashboard/build.js} +0 -0
@@ -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,12 @@ 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;
49
63
  }
50
- export type SkillRecordFieldInput = SkillRecordField | SkillRecordRawIdField;
64
+ export type SkillRecordFieldInput<Target extends ToolTarget = ToolTarget> = SkillRecordField<Target> | SkillRecordRawIdField;
51
65
  interface CommonToolOptions {
52
66
  readonly name: string;
53
67
  readonly description: string;
@@ -64,34 +78,35 @@ export type AutomationToolV2<A extends AutomationCatalogRef = AutomationCatalogR
64
78
  * must be mapped and output keys autocomplete, matching agentRunAutomation.
65
79
  */
66
80
  export declare function skillAutomation<A extends AutomationCatalogRef>(opts: AutomationToolV2<A>): SkillTool;
67
- export interface SkillSearchAspectToolV2 extends CommonToolOptions {
68
- readonly aspect: AspectRef;
81
+ export type SkillSearchRecordsToolOptions<Target extends ToolTarget = ToolTarget> = CommonToolOptions & TargetOption<Target> & {
69
82
  readonly queryDescription: string;
70
- readonly fields: readonly SkillSearchFieldInput[];
83
+ readonly fields: readonly SkillSearchFieldInput<Target>[];
71
84
  /** Maximum number of records the search returns. */
72
85
  readonly limit?: number;
73
- }
74
- export declare function skillSearchAspect(opts: SkillSearchAspectToolV2): SkillTool;
75
- export interface SkillSearchTableToolV2 extends CommonToolOptions {
76
- readonly aspect: AspectRef;
86
+ };
87
+ export declare function skillSearchRecords<Target extends ToolTarget>(opts: SkillSearchRecordsToolOptions<Target>): SkillTool;
88
+ /**
89
+ * A search-table tool targets the ELEMENT that owns the search table — never an
90
+ * app. See `search-table/build.ts`'s `SearchTableOwner`: an app's backing
91
+ * Snowflake table is hybrid, which Cortex cannot index.
92
+ */
93
+ export type SkillSearchTableToolV2<Target extends ElementCatalogRef = ElementCatalogRef> = CommonToolOptions & TargetOption<Target> & {
77
94
  readonly table: SearchTableRef;
78
95
  readonly queryDescription: string;
79
- readonly fields: readonly SkillSearchField[];
96
+ readonly fields: readonly SkillSearchFieldInput<Target>[];
80
97
  /** Maximum number of records the search returns. */
81
98
  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[];
99
+ };
100
+ export declare function skillSearchTable<Target extends ElementCatalogRef>(opts: SkillSearchTableToolV2<Target>): SkillTool;
101
+ export type SkillCreateRecordToolV2<Target extends ToolTarget = ToolTarget> = CommonToolOptions & TargetOption<Target> & {
102
+ readonly fields: readonly SkillRecordFieldInput<Target>[];
103
+ };
104
+ export declare function skillCreateRecord<Target extends ToolTarget>(opts: SkillCreateRecordToolV2<Target>): SkillTool;
105
+ export type SkillUpdateRecordToolV2<Target extends ToolTarget = ToolTarget> = CommonToolOptions & TargetOption<Target> & {
106
+ readonly fields: readonly SkillRecordFieldInput<Target>[];
92
107
  readonly handleDescription: string;
93
- }
94
- export declare function skillUpdateRecord(opts: SkillUpdateRecordToolV2): SkillTool;
108
+ };
109
+ export declare function skillUpdateRecord<Target extends ToolTarget>(opts: SkillUpdateRecordToolV2<Target>): SkillTool;
95
110
  export interface SkillRunAgentToolV2 extends CommonToolOptions {
96
111
  readonly agent: AgentRef;
97
112
  readonly workerTaskPrompt: string;
@@ -1,4 +1,14 @@
1
1
  import { isValidToolName } from "../agent-tool/types.js";
2
+ function targetOf(opts) {
3
+ return ("app" in opts && opts.app !== undefined ? opts.app : opts.element);
4
+ }
5
+ function serializeRunAs(runAs) {
6
+ if ("currentUser" in runAs)
7
+ return { currentUser: true };
8
+ if ("publisher" in runAs)
9
+ return { publisher: true };
10
+ return { serviceAccount: runAs.serviceAccount };
11
+ }
2
12
  function common(opts) {
3
13
  // Authoring-layer name check (mirrors entities/agent/tools.ts's common()) —
4
14
  // every tool factory routes through here, so this is the single
@@ -12,14 +22,17 @@ function common(opts) {
12
22
  description: opts.description,
13
23
  status: opts.status ?? "ACTIVE",
14
24
  ...(opts.startMessage !== undefined ? { startMessage: opts.startMessage } : {}),
15
- ...(opts.runAs !== undefined ? { runAs: opts.runAs } : {}),
25
+ ...(opts.runAs !== undefined ? { runAs: serializeRunAs(opts.runAs) } : {}),
16
26
  };
17
27
  }
28
+ function tool(value) {
29
+ return value;
30
+ }
18
31
  function searchFieldToken(f) {
19
32
  if ("fieldId" in f) {
20
33
  // Raw platform id fallback — see SkillSearchRawIdField's comment.
21
34
  return {
22
- fieldId: f.fieldId,
35
+ fieldId: f.fieldId.value,
23
36
  name: f.name,
24
37
  description: f.description,
25
38
  };
@@ -35,7 +48,7 @@ function recordFieldToken(f) {
35
48
  if ("fieldId" in f) {
36
49
  // Raw platform id fallback — see SkillRecordRawIdField's comment.
37
50
  return {
38
- fieldId: f.fieldId,
51
+ fieldId: f.fieldId.value,
39
52
  name: f.name,
40
53
  description: f.description,
41
54
  required: f.required,
@@ -68,63 +81,63 @@ export function skillAutomation(opts) {
68
81
  workflowPropertyName,
69
82
  displayName: spec?.name ?? workflowPropertyName,
70
83
  }));
71
- return {
84
+ return tool({
72
85
  automation: {
73
86
  ...common(opts),
74
87
  automationId: opts.automation,
75
88
  ...(inputs.length > 0 ? { inputs } : {}),
76
89
  ...(outputs.length > 0 ? { outputs } : {}),
77
90
  },
78
- };
91
+ });
79
92
  }
80
- export function skillSearchAspect(opts) {
81
- return {
93
+ export function skillSearchRecords(opts) {
94
+ return tool({
82
95
  searchAspect: {
83
96
  ...common(opts),
84
- aspectId: opts.aspect,
97
+ aspectId: targetOf(opts),
85
98
  queryDescription: opts.queryDescription,
86
99
  fields: opts.fields.map(searchFieldToken),
87
100
  ...(opts.limit !== undefined ? { limit: opts.limit } : {}),
88
101
  },
89
- };
102
+ });
90
103
  }
91
104
  export function skillSearchTable(opts) {
92
- return {
105
+ return tool({
93
106
  searchTable: {
94
107
  ...common(opts),
95
- aspectId: opts.aspect,
108
+ aspectId: targetOf(opts),
96
109
  searchTableId: opts.table,
97
110
  queryDescription: opts.queryDescription,
98
111
  fields: opts.fields.map(searchFieldToken),
99
112
  ...(opts.limit !== undefined ? { limit: opts.limit } : {}),
100
113
  },
101
- };
114
+ });
102
115
  }
103
116
  export function skillCreateRecord(opts) {
104
- return {
117
+ return tool({
105
118
  createRecord: {
106
119
  ...common(opts),
107
- aspectId: opts.aspect,
120
+ aspectId: targetOf(opts),
108
121
  fields: opts.fields.map(recordFieldToken),
109
122
  },
110
- };
123
+ });
111
124
  }
112
125
  export function skillUpdateRecord(opts) {
113
- return {
126
+ return tool({
114
127
  updateRecord: {
115
128
  ...common(opts),
116
- aspectId: opts.aspect,
129
+ aspectId: targetOf(opts),
117
130
  fields: opts.fields.map(recordFieldToken),
118
131
  handleDescription: opts.handleDescription,
119
132
  },
120
- };
133
+ });
121
134
  }
122
135
  export function skillRunAgent(opts) {
123
- return {
136
+ return tool({
124
137
  runAgent: {
125
138
  ...common(opts),
126
139
  targetAgentId: opts.agent,
127
140
  workerTaskPrompt: opts.workerTaskPrompt,
128
141
  },
129
- };
142
+ });
130
143
  }
@@ -33,7 +33,7 @@ export type NormalizedSkillToolTarget = {
33
33
  readonly name: string;
34
34
  };
35
35
  export interface NormalizedSkillTool {
36
- readonly typeKey: "createRecord" | "searchAspect" | "updateRecord" | "runAgent" | "automation";
36
+ readonly typeKey: "createRecord" | "searchAspect" | "searchTable" | "updateRecord" | "runAgent" | "automation";
37
37
  readonly name: string;
38
38
  readonly description: string;
39
39
  /** Present only when it differs from the default ("ACTIVE"). */
@@ -47,6 +47,9 @@ export interface NormalizedSkillTool {
47
47
  readonly targetAgentKey?: string;
48
48
  readonly workerTaskPrompt?: string;
49
49
  readonly automationKey?: string;
50
+ readonly searchTableKey?: string;
51
+ /** Foreign table lookup name when search_table_id is data.elementum_search_table. */
52
+ readonly searchTableName?: string;
50
53
  readonly inputs?: readonly {
51
54
  readonly parameterName: string;
52
55
  readonly displayName?: string;
@@ -5,7 +5,7 @@
5
5
  * skill or app resource types. Mirrors `entities/agent-tool/from-tf.ts`.
6
6
  */
7
7
  import { EntityTfError } from "../../engine/entity.js";
8
- import { optionalString, resourceRefLabel } from "../../engine/pull/context.js";
8
+ import { dataRefLabel, optionalString, resourceRefLabel } from "../../engine/pull/context.js";
9
9
  import { isTfExpr, scopedLabelToBagKey } from "../../engine/tf/index.js";
10
10
  import { resolveToolFieldKey } from "../shared/tool-field-ref.js";
11
11
  import { KNOWN_SKILL_TOOL_ATTRS, SKILL_TOOL_SUB_TYPE_BY_RESOURCE, UNAUTHORABLE_SKILL_TOOL_ATTRS, } from "./types.js";
@@ -52,12 +52,48 @@ export function skillToolFromTf(block, owner, ctx) {
52
52
  else if (runAsValue === "publisher")
53
53
  runAs = { publisher: true };
54
54
  else if (runAsValue === "service_account") {
55
- const serviceAccountId = optionalString(attrs, "service_account_id", where, ctx);
56
- if (serviceAccountId !== undefined && serviceAccountId !== "") {
57
- runAs = { serviceAccount: { serviceAccount: serviceAccountId } };
55
+ const serviceAccountLabel = dataRefLabel(attrs["service_account_id"], "elementum_service_account");
56
+ if (serviceAccountLabel !== undefined) {
57
+ const serviceAccountName = ctx.dataName("elementum_service_account", serviceAccountLabel);
58
+ if (serviceAccountName !== undefined && serviceAccountName !== "") {
59
+ runAs = {
60
+ serviceAccount: {
61
+ __kind: "serviceAccount",
62
+ appRefName: owner.appLabel,
63
+ name: serviceAccountName,
64
+ },
65
+ };
66
+ }
67
+ else {
68
+ ctx.diagnostics.push(`${where}: service_account_id references data.elementum_service_account.${serviceAccountLabel}, but the stream has no matching named data block; dropped`);
69
+ }
58
70
  }
59
71
  else {
60
- ctx.diagnostics.push(`${where}: run_as is service_account but service_account_id is missing; dropped`);
72
+ const resourceLabel = resourceRefLabel(attrs["service_account_id"], "elementum_service_account");
73
+ const imported = typeof attrs["service_account_id"] === "string"
74
+ ? ctx.importedResource?.(attrs["service_account_id"])
75
+ : undefined;
76
+ const account = resourceLabel !== undefined
77
+ ? ctx.resourceByAddress?.(`elementum_service_account.${resourceLabel}`)
78
+ : imported?.type === "elementum_service_account" ? imported : undefined;
79
+ const explicitName = account?.attrs["name"];
80
+ const firstName = account?.attrs["first_name"];
81
+ const lastName = account?.attrs["last_name"];
82
+ const serviceAccountName = typeof explicitName === "string" && explicitName !== ""
83
+ ? explicitName
84
+ : typeof firstName === "string" && typeof lastName === "string" ? `${firstName} ${lastName}` : undefined;
85
+ if (serviceAccountName !== undefined) {
86
+ runAs = {
87
+ serviceAccount: {
88
+ __kind: "serviceAccount",
89
+ appRefName: owner.appLabel,
90
+ name: serviceAccountName,
91
+ },
92
+ };
93
+ }
94
+ else {
95
+ ctx.diagnostics.push(`${where}: service_account_id is not a named data.elementum_service_account reference; use a serviceAccountRef({ app, name }); dropped`);
96
+ }
61
97
  }
62
98
  }
63
99
  else if (runAsValue !== undefined) {
@@ -133,6 +169,36 @@ export function skillToolFromTf(block, owner, ctx) {
133
169
  ...(outputs.length > 0 && { outputs }),
134
170
  };
135
171
  }
172
+ let searchTableKey;
173
+ let searchTableName;
174
+ if (subType.typeKey === "searchTable") {
175
+ const value = attrs["search_table_id"];
176
+ const resourceTypes = ["elementum_ai_search_table", "elementum_linked_ai_search_table", "elementum_table_search_table"];
177
+ const matched = resourceTypes
178
+ .map((type) => ({ type, label: resourceRefLabel(value, type) }))
179
+ .find((candidate) => candidate.label !== undefined);
180
+ if (matched?.label !== undefined) {
181
+ // A managed or linked search table is owned by an ELEMENT, so its label
182
+ // carries the `elements_<ns>_` prefix — decoding it with app scope leaves
183
+ // the prefix in place and camel-cases the whole label into a bag key that
184
+ // matches nothing. The table variant keeps its existing app-scope
185
+ // handling: a table-owned search table reached through a tool is not
186
+ // modelled end to end yet.
187
+ const scope = matched.type === "elementum_table_search_table" ? "app" : "element";
188
+ searchTableKey = scopedLabelToBagKey(owner.ownerTfLabel, matched.label, scope);
189
+ }
190
+ else if (isTfExpr(value) && value.$expr === "data-attr" && value.type === "elementum_search_table") {
191
+ searchTableName = ctx.dataName(value.type, value.label);
192
+ if (searchTableName === undefined) {
193
+ ctx.diagnostics.push(`${where}: search_table_id references data.${value.type}.${value.label} without a matching name lookup; skipped`);
194
+ return undefined;
195
+ }
196
+ }
197
+ else {
198
+ ctx.diagnostics.push(`${where}: search_table_id is not a supported search-table resource reference; skipped`);
199
+ return undefined;
200
+ }
201
+ }
136
202
  // Target: the owning app's resource ref = self; a data.elementum_app ref =
137
203
  // a foreign app, resolved to its display name via the stream's data block.
138
204
  const targetAttr = attrs["target_id"];
@@ -209,10 +275,10 @@ export function skillToolFromTf(block, owner, ctx) {
209
275
  else if (rawFields !== undefined) {
210
276
  ctx.diagnostics.push(`${where}: fields is not a list; dropped`);
211
277
  }
212
- if (subType.typeKey === "searchAspect" && attrs["filter"] !== undefined) {
278
+ if ((subType.typeKey === "searchAspect" || subType.typeKey === "searchTable") && attrs["filter"] !== undefined) {
213
279
  ctx.diagnostics.push(`${where}: filter is not supported on the terraform path yet; a rebuilt stream will omit it`);
214
280
  }
215
- if (subType.typeKey === "searchAspect" && attrs["filter_variables"] !== undefined) {
281
+ if ((subType.typeKey === "searchAspect" || subType.typeKey === "searchTable") && attrs["filter_variables"] !== undefined) {
216
282
  ctx.diagnostics.push(`${where}: filter_variables are not supported on the terraform path yet; a rebuilt stream will omit them`);
217
283
  }
218
284
  return {
@@ -220,9 +286,11 @@ export function skillToolFromTf(block, owner, ctx) {
220
286
  ...common,
221
287
  target,
222
288
  ...(fields !== undefined && { fields }),
223
- ...(subType.typeKey === "searchAspect" && {
289
+ ...((subType.typeKey === "searchAspect" || subType.typeKey === "searchTable") && {
224
290
  queryDescription: optionalString(attrs, "query_description", where, ctx) ?? "",
225
291
  }),
292
+ ...(searchTableKey !== undefined && { searchTableKey }),
293
+ ...(searchTableName !== undefined && { searchTableName }),
226
294
  ...(typeof attrs["result_limit"] === "number" && { limit: attrs["result_limit"] }),
227
295
  ...(subType.typeKey === "updateRecord" && {
228
296
  handleDescription: optionalString(attrs, "handle_description", where, ctx) ?? "",
@@ -1,5 +1,6 @@
1
1
  /** The skill-tool entity's registry entry (see src/graph/). */
2
2
  import { NO_CANVAS, NO_CATALOG, NO_DATA, NO_LIFECYCLE } from "../../graph/types.js";
3
+ import { FIELD_DATA_RESOURCE_TYPE } from "../field/module.js";
3
4
  import { SKILL_TOOL_SUB_TYPES } from "./types.js";
4
5
  export const skillToolModule = {
5
6
  kind: "skill-tool",
@@ -18,4 +19,12 @@ export const skillToolModule = {
18
19
  lifecycle: NO_LIFECYCLE,
19
20
  canvas: NO_CANVAS,
20
21
  catalog: NO_CATALOG,
22
+ roundtrip: {
23
+ referenceAliases: [],
24
+ resolvedDataReferences: [{
25
+ attribute: "fields",
26
+ nestedAttribute: "field_id",
27
+ dataType: FIELD_DATA_RESOURCE_TYPE,
28
+ }],
29
+ },
21
30
  };
@@ -6,6 +6,7 @@
6
6
  * (`skill_id`) — this module never names the skill or app resource types.
7
7
  * Mirrors `entities/agent-tool/to-tf.ts`.
8
8
  */
9
+ import { type WorkspaceAspect } from "../../engine/build/context.js";
9
10
  import { type TfBlock, type TfValue } from "../../engine/tf/index.js";
10
11
  export interface SkillToolToTfContext {
11
12
  /** The owning app's refName + tfLabel (namespace) — self-target detection + app_id. */
@@ -25,8 +26,12 @@ export interface SkillToolToTfContext {
25
26
  foreignAppRef(tfLabel: string, name: string): void;
26
27
  /** Records a foreign-ELEMENT data lookup for data.tf (board issue #42). */
27
28
  foreignElementRef(tfLabel: string, name: string): void;
28
- /** Records a `data.elementum_field` lookup for a field owned by a foreign app/element. */
29
+ /** Records an object-scoped data lookup owned by a foreign app/element. */
29
30
  foreignFieldRef(type: string, tfLabel: string, objectId: TfValue, name: string): void;
31
+ /** App/element roots authored in this same workspace. */
32
+ readonly workspaceAspects?: ReadonlyMap<string, WorkspaceAspect>;
33
+ /** Records an app-scoped service-account lookup by name. */
34
+ serviceAccountRef?(tfLabel: string, name: string): TfValue | void;
30
35
  /** Degradations land here — reported by the caller, never silent. */
31
36
  readonly diagnostics: string[];
32
37
  }
@@ -6,15 +6,48 @@
6
6
  * (`skill_id`) — this module never names the skill or app resource types.
7
7
  * Mirrors `entities/agent-tool/to-tf.ts`.
8
8
  */
9
- import { appScopedResourceLabel, expr, sanitizeName, tsLabelToTfLabel } from "../../engine/tf/index.js";
9
+ import { workspaceAspectKey } from "../../engine/build/context.js";
10
+ import { appScopedResourceLabel, expr, sanitizeName, scopedResourceLabel, tsLabelToTfLabel } from "../../engine/tf/index.js";
10
11
  import { fieldRefToTfValue } from "../field/to-tf.js";
11
12
  import { SKILL_TOOL_SUB_TYPE_BY_TYPE_KEY } from "./types.js";
12
- /** authoring AspectRef token → its resolved target (self resource ref or foreign data ref). */
13
- function resolveTarget(token, ctx) {
13
+ function serviceAccountIdValue(token, where, ctx) {
14
+ if (token.__kind !== "serviceAccount" || token.name === undefined || token.name === "") {
15
+ ctx.diagnostics.push(`${where}: serviceAccount must be a serviceAccountRef({ app, name }); dropped`);
16
+ return undefined;
17
+ }
18
+ if (token.appRefName !== ctx.appRefName) {
19
+ ctx.diagnostics.push(`${where}: service account "${token.name}" belongs to app "${token.appRefName ?? ""}", not owning app "${ctx.appRefName}"; dropped`);
20
+ return undefined;
21
+ }
22
+ const tfLabel = appScopedResourceLabel(ctx.appTfLabel, sanitizeName(token.name));
23
+ if (ctx.serviceAccountRef === undefined) {
24
+ ctx.diagnostics.push(`${where}: build context cannot materialize a service-account lookup; dropped`);
25
+ return undefined;
26
+ }
27
+ return ctx.serviceAccountRef(tfLabel, token.name) ??
28
+ expr.dataAttr("elementum_service_account", tfLabel, ["id"]);
29
+ }
30
+ /** authoring AppOrElementRef token → target_id value (workspace resource or foreign data ref). */
31
+ function targetIdValue(token, ctx) {
14
32
  const refName = token.refName ?? "";
15
33
  const kind = token.__kind === "element" ? "element" : "app";
16
34
  if (kind === "app" && refName === ctx.appRefName) {
17
- return { value: expr.resourceAttr("elementum_app", ctx.appTfLabel, ["id"]), refName, kind, isSelf: true };
35
+ return {
36
+ value: expr.resourceAttr("elementum_app", ctx.appTfLabel, ["id"]),
37
+ refName,
38
+ kind,
39
+ localTfLabel: ctx.appTfLabel,
40
+ };
41
+ }
42
+ const sibling = ctx.workspaceAspects?.get(workspaceAspectKey(kind, refName));
43
+ if (sibling !== undefined) {
44
+ const resourceType = kind === "element" ? "elementum_element" : "elementum_app";
45
+ return {
46
+ value: expr.resourceAttr(resourceType, sibling.tfLabel, ["id"]),
47
+ refName,
48
+ kind,
49
+ localTfLabel: sibling.tfLabel,
50
+ };
18
51
  }
19
52
  // ei derives foreign-app/foreign-element data labels from the display NAME.
20
53
  const name = token.name ?? refName;
@@ -22,10 +55,20 @@ function resolveTarget(token, ctx) {
22
55
  // Board issue #42: an aspect token can be an element, not just an app.
23
56
  if (kind === "element") {
24
57
  ctx.foreignElementRef(tfLabel, name);
25
- return { value: expr.dataAttr("elementum_element", tfLabel, ["id"]), refName, kind, isSelf: false, foreignTfLabel: tfLabel };
58
+ return {
59
+ value: expr.dataAttr("elementum_element", tfLabel, ["id"]),
60
+ refName,
61
+ kind,
62
+ foreignTfLabel: tfLabel,
63
+ };
26
64
  }
27
65
  ctx.foreignAppRef(tfLabel, name);
28
- return { value: expr.dataAttr("elementum_app", tfLabel, ["id"]), refName, kind, isSelf: false, foreignTfLabel: tfLabel };
66
+ return {
67
+ value: expr.dataAttr("elementum_app", tfLabel, ["id"]),
68
+ refName,
69
+ kind,
70
+ foreignTfLabel: tfLabel,
71
+ };
29
72
  }
30
73
  /**
31
74
  * A field belonging to the tool's target aspect, when that target is
@@ -36,7 +79,8 @@ function resolveTarget(token, ctx) {
36
79
  */
37
80
  function foreignTargetFieldRefValue(token, refName, target, ctx) {
38
81
  const fieldName = token.name ?? refName;
39
- const fieldLabel = `${target.kind}_${target.foreignTfLabel}_${tsLabelToTfLabel(refName)}`;
82
+ const ownerLabel = target.foreignTfLabel ?? sanitizeName(target.refName);
83
+ const fieldLabel = `${target.kind}_${ownerLabel}_${tsLabelToTfLabel(refName)}`;
40
84
  ctx.foreignFieldRef("elementum_field", fieldLabel, target.value, fieldName);
41
85
  return expr.dataAttr("elementum_field", fieldLabel, ["id"]);
42
86
  }
@@ -47,37 +91,23 @@ function foreignTargetFieldRefValue(token, refName, target, ctx) {
47
91
  */
48
92
  function fieldRefValue(token, where, ctx, target) {
49
93
  const refName = token.refName ?? "";
50
- if (target !== undefined) {
51
- // `parentKind` is stamped ALONGSIDE a FOREIGN `parent` by `appCatalog`/
52
- // `elementCatalog` (see `FieldRef`'s doc comment) — but a field's own
53
- // `.ref()` on ITS OWN app/element stamps `parent` (as a self-reference)
54
- // without `parentKind` at all (a real, common shape — see
55
- // `agent-tool/to-tf.ts`'s identical check for the full rationale), so
56
- // only a parent naming something OTHER than the tool's owning app is
57
- // genuinely ambiguous.
58
- if (token.parent !== undefined && token.parent !== ctx.appRefName && token.parentKind === undefined) {
59
- ctx.diagnostics.push(`${where}: field "${refName}" has a parent ("${token.parent}") but no parentKind — incomplete foreign-field provenance; dropped`);
60
- return undefined;
61
- }
62
- const parent = token.parent ?? ctx.appRefName;
63
- const parentKind = token.parentKind ?? "app";
64
- if (parent !== target.refName || parentKind !== target.kind) {
65
- ctx.diagnostics.push(`${where}: field "${refName}" belongs to ${parentKind} "${parent}", not the tool's target ${target.kind} "${target.refName}" — a tool's fields must belong to its own target aspect; dropped`);
66
- return undefined;
67
- }
68
- if (!target.isSelf)
69
- return foreignTargetFieldRefValue(token, refName, target, ctx);
94
+ if (token.parent !== undefined && token.parent !== ctx.appRefName && token.parentKind === undefined) {
95
+ ctx.diagnostics.push(`${where}: field "${refName}" has a parent ("${token.parent}") but no parentKind — incomplete foreign-field provenance; dropped`);
96
+ return undefined;
70
97
  }
71
- else if (token.parent !== undefined && (token.parent !== ctx.appRefName || token.parentKind === "element")) {
72
- ctx.diagnostics.push(`${where}: field "${refName}" belongs to "${token.parent}", not this tool's app; dropped`);
98
+ const parent = token.parent ?? ctx.appRefName;
99
+ const parentKind = token.parentKind ?? "app";
100
+ if (parent !== target.refName || parentKind !== target.kind) {
101
+ ctx.diagnostics.push(`${where}: field "${refName}" belongs to ${parentKind} "${parent}", not the tool's target ${target.kind} "${target.refName}" — a tool's fields must belong to its own target aspect; dropped`);
73
102
  return undefined;
74
103
  }
104
+ if (target.localTfLabel === undefined) {
105
+ return foreignTargetFieldRefValue(token, refName, target, ctx);
106
+ }
75
107
  const authoringType = token.fieldType ?? "";
76
- // appTfLabel, not appRefName: fieldRefToTfValue builds a terraform address
77
- // (resource label prefix / local name), and the two differ whenever an
78
- // app's authoring ref doesn't match its platform namespace (e.g. a clone).
79
- // agent-tool/to-tf.ts's equivalent already passes appTfLabel.
80
- const ref = refName === "" ? undefined : fieldRefToTfValue(authoringType, refName, ctx.appTfLabel);
108
+ const ref = refName === ""
109
+ ? undefined
110
+ : fieldRefToTfValue(authoringType, refName, target.localTfLabel, target.kind);
81
111
  if (ref === undefined) {
82
112
  ctx.diagnostics.push(`${where}: field token "${refName}" has no terraform field resource mapping (fieldType ${JSON.stringify(authoringType)}); dropped`);
83
113
  return undefined;
@@ -127,13 +157,10 @@ export function skillToolToTf(entry, ctx) {
127
157
  attrs["run_as"] = "publisher";
128
158
  }
129
159
  else if (inner.runAs?.["serviceAccount"] !== undefined) {
130
- const serviceAccount = inner.runAs["serviceAccount"];
131
- if (typeof serviceAccount.serviceAccount === "string" && serviceAccount.serviceAccount !== "") {
160
+ const serviceAccountId = serviceAccountIdValue(inner.runAs["serviceAccount"], where, ctx);
161
+ if (serviceAccountId !== undefined) {
132
162
  attrs["run_as"] = "service_account";
133
- attrs["service_account_id"] = serviceAccount.serviceAccount;
134
- }
135
- else {
136
- ctx.diagnostics.push(`${where}: service-account runAs has no service account id; dropped`);
163
+ attrs["service_account_id"] = serviceAccountId;
137
164
  }
138
165
  }
139
166
  else if (inner.runAs !== undefined) {
@@ -192,8 +219,33 @@ export function skillToolToTf(entry, ctx) {
192
219
  ctx.diagnostics.push(`${where}: no target aspect token; dropped`);
193
220
  return undefined;
194
221
  }
195
- const target = resolveTarget(inner.aspectId, ctx);
222
+ const target = targetIdValue(inner.aspectId, ctx);
196
223
  attrs["target_id"] = target.value;
224
+ if (typeKey === "searchTable") {
225
+ const table = inner.searchTableId;
226
+ if (table?.refName === undefined || table.refName === "") {
227
+ ctx.diagnostics.push(`${where}: no search table token; dropped`);
228
+ return undefined;
229
+ }
230
+ if (table.parent !== undefined && table.parent !== "" && table.parent !== target.refName) {
231
+ ctx.diagnostics.push(`${where}: search table belongs to "${table.parent}", not target "${target.refName}"; dropped`);
232
+ return undefined;
233
+ }
234
+ if (target.localTfLabel === undefined) {
235
+ const targetName = inner.aspectId.name ?? inner.aspectId.refName ?? table.parent;
236
+ const lookupLabel = sanitizeName(`${targetName}_${table.name ?? table.refName}`);
237
+ ctx.foreignFieldRef("elementum_search_table", lookupLabel, target.value, table.name ?? table.refName);
238
+ attrs["search_table_id"] = expr.dataAttr("elementum_search_table", lookupLabel, ["id"]);
239
+ }
240
+ else {
241
+ const resourceType = table.__variant === "linked"
242
+ ? "elementum_linked_ai_search_table"
243
+ : table.__variant === "table"
244
+ ? "elementum_table_search_table"
245
+ : "elementum_ai_search_table";
246
+ attrs["search_table_id"] = expr.resourceAttr(resourceType, scopedResourceLabel(target.localTfLabel, tsLabelToTfLabel(table.refName), target.kind), ["id"]);
247
+ }
248
+ }
197
249
  if (typeKey === "updateRecord") {
198
250
  if (inner.handleDescription === undefined || inner.handleDescription === "") {
199
251
  ctx.diagnostics.push(`${where}: no handleDescription; dropped`);
@@ -201,7 +253,7 @@ export function skillToolToTf(entry, ctx) {
201
253
  }
202
254
  attrs["handle_description"] = inner.handleDescription;
203
255
  }
204
- if (typeKey === "searchAspect") {
256
+ if (typeKey === "searchAspect" || typeKey === "searchTable") {
205
257
  attrs["query_description"] = inner.queryDescription ?? "";
206
258
  if (inner.limit !== undefined)
207
259
  attrs["result_limit"] = inner.limit;