@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
  * printAgentV2 — pulled agent rendering for the terraform path (M3).
3
3
  * Consumes the `NormalizedAgent` that `agentFromTf` produces and emits an
4
- * `apps/<app>/agents/<refName>.ts` authoring file: `defineAgent` with the
4
+ * `apps/<app>/agents/<refName>.ts` authoring file: `agent` with the
5
5
  * connector as a `catalog.aiProviders.<provider>.models.<model>` token (the
6
6
  * generated org-root barrel re-exports `org.aiProviders`, so this file needs
7
7
  * no separate relative `org.js` import), tool targets as `catalog` tokens
@@ -12,12 +12,16 @@
12
12
  */
13
13
  import { quote } from "../../../../pull/util.js";
14
14
  import { sdkPackageSpecifier } from "../../../internal/sdk-package.js";
15
+ import { safeIdentifier } from "../../../internal/safe-identifier.js";
15
16
  const TOOL_FACTORY_BY_TYPE_KEY = {
16
17
  createRecord: "agentCreateRecord",
17
- searchAspect: "agentSearchAspect",
18
+ searchAspect: "agentSearchRecords",
18
19
  updateRecord: "agentUpdateRecord",
19
20
  executeWorkflow: "agentRunAutomation",
20
21
  searchTable: "agentSearchTable",
22
+ relateRecord: "agentRelateRecord",
23
+ runAgent: "agentRunAgent",
24
+ mcp: "agentMcp",
21
25
  };
22
26
  /**
23
27
  * A safe placeholder `ConnectorRef` literal (board issue — a property-access
@@ -44,7 +48,20 @@ function printConnectorToken(connectorKey) {
44
48
  export function printAgentV2(agent, opts) {
45
49
  const { appRefName } = opts;
46
50
  const crossOrg = opts.crossOrg === true;
47
- const factories = [...new Set(agent.tools.map((t) => TOOL_FACTORY_BY_TYPE_KEY[t.typeKey]).filter(Boolean))].sort();
51
+ const usesServiceAccountRef = (agent.runAs !== undefined && "serviceAccount" in agent.runAs) ||
52
+ agent.tools.some((tool) => tool.runAs !== undefined && "serviceAccount" in tool.runAs);
53
+ const factories = [
54
+ ...new Set([
55
+ ...agent.tools.map((t) => TOOL_FACTORY_BY_TYPE_KEY[t.typeKey]).filter(Boolean),
56
+ ...(usesServiceAccountRef ? ["serviceAccountRef"] : []),
57
+ ]),
58
+ ].sort();
59
+ const usesUnsafePlatformId = agent.tools.some((tool) => {
60
+ const targetOwner = searchTableTargetOwnerRefName(tool, appRefName, opts.foreignAppRefNames, opts.foreignElementRefNames);
61
+ return (tool.fields?.some((field) => field.rawFieldId !== undefined) === true ||
62
+ tool.searchTableFields?.some((field) => !searchTableFieldMatchesTarget(field.fieldId, targetOwner, opts.foreignFieldRefsById)) === true ||
63
+ tool.returnFields?.some((field) => !searchTableFieldMatchesTarget(field.fieldId, targetOwner, opts.foreignFieldRefsById)) === true);
64
+ });
48
65
  const lines = [];
49
66
  lines.push("/**");
50
67
  lines.push(` * ${agent.name}`);
@@ -53,15 +70,19 @@ export function printAgentV2(agent, opts) {
53
70
  lines.push(" * one-shot starting point, not a live-binding view.");
54
71
  lines.push(" */");
55
72
  lines.push("");
56
- lines.push(`import { ${[...factories, "defineAgent"].sort().join(", ")} } from "${sdkPackageSpecifier("agents")}";`);
73
+ const agentImports = [...factories, "agent"];
74
+ lines.push(`import { ${[...new Set(agentImports)].sort().join(", ")} } from "${sdkPackageSpecifier("agents")}";`);
75
+ if (usesUnsafePlatformId)
76
+ lines.push(`import { unsafePlatformId } from "${sdkPackageSpecifier("core")}";`);
57
77
  // Always needed: `connector:` is required and always a catalog.aiProviders
58
78
  // token (or the TODO placeholder), and the barrel already re-exports
59
79
  // org.aiProviders — no separate relative org.js import is needed here.
60
80
  lines.push(`import catalog from "@catalog";`);
61
81
  lines.push("");
62
- lines.push(`const ${agent.refName} = defineAgent({`);
82
+ const identifier = safeIdentifier(agent.refName, "agent");
83
+ lines.push(`const ${identifier} = agent({`);
63
84
  lines.push(` name: ${quote(agent.name)},`);
64
- lines.push(` parent: ${quote(appRefName)},`);
85
+ lines.push(` app: catalog.${appRefName},`);
65
86
  const connectorMatchesDestination = agent.connectorKey !== undefined && (opts.destinationConnectorKeys?.has(agent.connectorKey) ?? false);
66
87
  if (opts.connectorKeyOverride !== undefined) {
67
88
  // Interactively confirmed by the caller — print directly, uncommented,
@@ -94,7 +115,7 @@ export function printAgentV2(agent, opts) {
94
115
  lines.push(...printSkillAccess(agent.skillAccess, appRefName, crossOrg).map((l) => ` ${l}`));
95
116
  }
96
117
  if (agent.runAs !== undefined)
97
- lines.push(` runAs: ${printRunAs(agent.runAs)},`);
118
+ lines.push(` runAs: ${printRunAs(agent.runAs, appRefName)},`);
98
119
  if (agent.agentAuthentication !== undefined) {
99
120
  lines.push(...printAgentAuthentication(agent.agentAuthentication).map((l) => ` ${l}`));
100
121
  }
@@ -115,13 +136,13 @@ export function printAgentV2(agent, opts) {
115
136
  if (agent.tools.length > 0) {
116
137
  lines.push(" tools: [");
117
138
  for (const tool of agent.tools) {
118
- lines.push(...printTool(tool, appRefName, crossOrg, opts.foreignAppRefNames, opts.foreignElementRefNames).map((l) => ` ${l}`));
139
+ lines.push(...printTool(tool, appRefName, crossOrg, opts.foreignAppRefNames, opts.foreignElementRefNames, opts.foreignSearchTableRefsByName, opts.foreignFieldRefsById).map((l) => ` ${l}`));
119
140
  }
120
141
  lines.push(" ],");
121
142
  }
122
143
  lines.push("});");
123
144
  lines.push("");
124
- lines.push(`export default ${agent.refName};`);
145
+ lines.push(`export default ${identifier};`);
125
146
  lines.push("");
126
147
  return lines.join("\n");
127
148
  }
@@ -155,7 +176,7 @@ function printSkillRefToken(ref, appRefName, crossOrg) {
155
176
  const todo = crossOrg
156
177
  ? ` // TODO: cross-org clone — "${ref.name}" was resolved in the SOURCE org; verify it exists (with this name) in the destination org`
157
178
  : "";
158
- return `{ __kind: "skill", refName: ${quote(ref.name)}, name: ${quote(ref.name)} },${todo}`;
179
+ return `{ __kind: "skill", refName: ${quote(ref.name)}, name: ${quote(ref.name)}, parent: ${quote(ref.appRefName ?? ref.appName)}, parentName: ${quote(ref.appName)} },${todo}`;
159
180
  }
160
181
  function printSkillAccess(access, appRefName, crossOrg) {
161
182
  const hasPreloaded = access.preloadedSkills !== undefined && access.preloadedSkills.length > 0;
@@ -178,17 +199,12 @@ function printSkillAccess(access, appRefName, crossOrg) {
178
199
  lines.push(`},`);
179
200
  return lines;
180
201
  }
181
- /** `AgentToolRunAs` is opaque — `agentFromTf` only ever produces `{ currentUser: true }` today. */
182
- function printRunAs(runAs) {
183
- if (runAs["currentUser"] !== undefined)
184
- return `{ currentUser: ${String(runAs["currentUser"])} }`;
185
- if (runAs["publisher"] !== undefined)
186
- return `{ publisher: ${String(runAs["publisher"])} }`;
187
- const serviceAccount = runAs["serviceAccount"];
188
- if (serviceAccount?.serviceAccount !== undefined) {
189
- return `{ serviceAccount: { serviceAccount: ${quote(String(serviceAccount.serviceAccount))} } }`;
190
- }
191
- return JSON.stringify(runAs);
202
+ function printRunAs(runAs, appRefName) {
203
+ if ("currentUser" in runAs)
204
+ return `{ currentUser: true }`;
205
+ if ("publisher" in runAs)
206
+ return `{ publisher: true }`;
207
+ return `{ serviceAccount: serviceAccountRef({ app: catalog.${appRefName}, name: ${quote(runAs.serviceAccount.name)} }) }`;
192
208
  }
193
209
  function printAgentAuthentication(auth) {
194
210
  const { jwt } = auth;
@@ -223,14 +239,18 @@ function printA2ASkill(skill) {
223
239
  const lines = ["{"];
224
240
  lines.push(` name: ${quote(skill.name)},`);
225
241
  lines.push(` description: ${quote(skill.description)},`);
226
- if (skill.tags !== undefined && skill.tags.length > 0)
227
- lines.push(` tags: [${skill.tags.map(quote).join(", ")}],`);
242
+ // The provider schema models tags as a set. GraphQL/export connection order
243
+ // is therefore not authored state, so print one stable, review-friendly
244
+ // representation instead of letting every pull reshuffle this line.
245
+ if (skill.tags !== undefined && skill.tags.length > 0) {
246
+ lines.push(` tags: [${[...skill.tags].sort().map(quote).join(", ")}],`);
247
+ }
228
248
  if (skill.examples !== undefined && skill.examples.length > 0)
229
- lines.push(` examples: [${skill.examples.map(quote).join(", ")}],`);
249
+ lines.push(` examples: [${[...skill.examples].sort().map(quote).join(", ")}],`);
230
250
  if (skill.inputModes !== undefined && skill.inputModes.length > 0)
231
- lines.push(` inputModes: [${skill.inputModes.map(quote).join(", ")}],`);
251
+ lines.push(` inputModes: [${[...skill.inputModes].sort().map(quote).join(", ")}],`);
232
252
  if (skill.outputModes !== undefined && skill.outputModes.length > 0)
233
- lines.push(` outputModes: [${skill.outputModes.map(quote).join(", ")}],`);
253
+ lines.push(` outputModes: [${[...skill.outputModes].sort().map(quote).join(", ")}],`);
234
254
  lines.push("},");
235
255
  return lines;
236
256
  }
@@ -248,13 +268,34 @@ function fieldOwnerRef(tool, appRefName, foreignAppRefNames, foreignElementRefNa
248
268
  ? { kind: "catalog", expr: `catalog.${foreignRefName}` }
249
269
  : { kind: "raw", entityType: "element", name: tool.target.name };
250
270
  }
251
- function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElementRefNames) {
252
- const factory = TOOL_FACTORY_BY_TYPE_KEY[tool.typeKey] ?? "agentSearchAspect";
271
+ /** Catalog key for the search-table tool's target element/app, when pull resolved it. */
272
+ function searchTableTargetOwnerRefName(tool, appRefName, foreignAppRefNames, foreignElementRefNames) {
273
+ if (tool.target === undefined || tool.target.kind === "self")
274
+ return appRefName;
275
+ if (tool.target.kind === "foreignApp")
276
+ return foreignAppRefNames?.get(tool.target.name);
277
+ if (tool.target.kind === "foreignElement")
278
+ return foreignElementRefNames?.get(tool.target.name);
279
+ return undefined;
280
+ }
281
+ /**
282
+ * Upgrade a search-table field id only when the recursive-pull registry maps it
283
+ * to the tool's own target. A global hit for a different dependency would print
284
+ * `catalog.other.fields.x`, which fails the owner-bound authoring type.
285
+ */
286
+ function searchTableFieldMatchesTarget(fieldId, targetOwnerRefName, foreignFieldRefsById) {
287
+ const resolved = foreignFieldRefsById?.get(fieldId);
288
+ return resolved !== undefined && targetOwnerRefName !== undefined && resolved.ownerRefName === targetOwnerRefName;
289
+ }
290
+ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElementRefNames, foreignSearchTableRefsByName, foreignFieldRefsById) {
291
+ const factory = TOOL_FACTORY_BY_TYPE_KEY[tool.typeKey] ?? "agentSearchRecords";
253
292
  const lines = [`${factory}({`];
254
293
  lines.push(` name: ${quote(tool.name)},`);
255
294
  lines.push(` description: ${quote(tool.description)},`);
256
295
  if (tool.startMessage !== undefined)
257
296
  lines.push(` startMessage: ${quote(tool.startMessage)},`);
297
+ if (tool.runAs !== undefined)
298
+ lines.push(` runAs: ${printRunAs(tool.runAs, appRefName)},`);
258
299
  if (tool.typeKey === "executeWorkflow") {
259
300
  // Record form (agentRunAutomation v3): keys are the automation's declared
260
301
  // parameter/property names; the agent-facing `name:` prints only when it
@@ -286,8 +327,33 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
286
327
  lines.push("}),");
287
328
  return lines;
288
329
  }
330
+ if (tool.typeKey === "runAgent") {
331
+ lines.push(` agent: catalog.${appRefName}.agents${safeMember(tool.targetAgentKey ?? "")},`);
332
+ lines.push(` workerTaskPrompt: ${quote(tool.workerTaskPrompt ?? "")},`);
333
+ lines.push("}),");
334
+ return lines;
335
+ }
336
+ if (tool.typeKey === "mcp") {
337
+ lines.push(` serverUrl: ${quote(tool.serverUrl ?? "")},`);
338
+ lines.push(` mcpToolName: ${quote(tool.mcpToolName ?? "")},`);
339
+ if (tool.headers !== undefined && tool.headers.length > 0) {
340
+ lines.push(" headers: [");
341
+ for (const header of tool.headers) {
342
+ lines.push(` { key: ${quote(header.key)}, value: ${quote(header.value)} },`);
343
+ }
344
+ lines.push(" ],");
345
+ }
346
+ lines.push("}),");
347
+ return lines;
348
+ }
289
349
  if (tool.target?.kind === "self") {
290
- lines.push(` aspect: catalog.${appRefName},`);
350
+ // A search-table tool targets the ELEMENT that owns the table, so a "self"
351
+ // target means the owning aspect IS that element — emit `element:`, not
352
+ // `app:`. (A foreignApp target on a searchTable tool is malformed input:
353
+ // apps never own search tables. It keeps printing `app:` below so tsc
354
+ // rejects the emitted source loudly instead of mislabelling an app as an
355
+ // element.)
356
+ lines.push(` ${tool.typeKey === "searchTable" ? "element" : "app"}: catalog.${appRefName},`);
291
357
  }
292
358
  else if (tool.target !== undefined && tool.target.kind === "foreignApp") {
293
359
  const foreignRefName = foreignAppRefNames?.get(tool.target.name);
@@ -295,7 +361,7 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
295
361
  // The dependency is already pulled into this workspace (board issue
296
362
  // #40) — a typed token, not a stub, so tsc catches drift if the
297
363
  // foreign app's fields change out from under this tool.
298
- lines.push(` aspect: catalog.${foreignRefName},`);
364
+ lines.push(` app: catalog.${foreignRefName},`);
299
365
  }
300
366
  else {
301
367
  // The foreign app's catalog may not exist in this workspace — a literal
@@ -304,7 +370,7 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
304
370
  const todo = crossOrg
305
371
  ? ` // TODO: cross-org clone — "${tool.target.name}" was resolved in the SOURCE org; verify it exists (with this name) in the destination org`
306
372
  : "";
307
- lines.push(` aspect: { __kind: "app", refName: ${quote(tool.target.name)}, name: ${quote(tool.target.name)} },${todo}`);
373
+ lines.push(` app: { __kind: "app", refName: ${quote(tool.target.name)}, name: ${quote(tool.target.name)} },${todo}`);
308
374
  }
309
375
  }
310
376
  else if (tool.target !== undefined && tool.target.kind === "foreignElement") {
@@ -312,13 +378,40 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
312
378
  // same treatment as foreignApp, distinct stub `__kind`.
313
379
  const foreignRefName = foreignElementRefNames?.get(tool.target.name);
314
380
  if (foreignRefName !== undefined) {
315
- lines.push(` aspect: catalog.${foreignRefName},`);
381
+ lines.push(` element: catalog.${foreignRefName},`);
316
382
  }
317
383
  else {
318
384
  const todo = crossOrg
319
385
  ? ` // TODO: cross-org clone — "${tool.target.name}" was resolved in the SOURCE org; verify it exists (with this name) in the destination org`
320
386
  : "";
321
- lines.push(` aspect: { __kind: "element", refName: ${quote(tool.target.name)}, name: ${quote(tool.target.name)} },${todo}`);
387
+ lines.push(` element: { __kind: "element", refName: ${quote(tool.target.name)}, name: ${quote(tool.target.name)} },${todo}`);
388
+ }
389
+ }
390
+ if (tool.typeKey === "relateRecord" && tool.relatedTarget?.kind === "self") {
391
+ lines.push(` relatedApp: catalog.${appRefName},`);
392
+ }
393
+ else if (tool.typeKey === "relateRecord" && tool.relatedTarget?.kind === "foreignApp") {
394
+ const foreignRefName = foreignAppRefNames?.get(tool.relatedTarget.name);
395
+ if (foreignRefName !== undefined) {
396
+ lines.push(` relatedApp: catalog.${foreignRefName},`);
397
+ }
398
+ else {
399
+ const todo = crossOrg
400
+ ? ` // TODO: cross-org clone — "${tool.relatedTarget.name}" was resolved in the SOURCE org; verify it exists (with this name) in the destination org`
401
+ : "";
402
+ lines.push(` relatedApp: { __kind: "app", refName: ${quote(tool.relatedTarget.name)}, name: ${quote(tool.relatedTarget.name)} },${todo}`);
403
+ }
404
+ }
405
+ else if (tool.typeKey === "relateRecord" && tool.relatedTarget?.kind === "foreignElement") {
406
+ const foreignRefName = foreignElementRefNames?.get(tool.relatedTarget.name);
407
+ if (foreignRefName !== undefined) {
408
+ lines.push(` relatedElement: catalog.${foreignRefName},`);
409
+ }
410
+ else {
411
+ const todo = crossOrg
412
+ ? ` // TODO: cross-org clone — "${tool.relatedTarget.name}" was resolved in the SOURCE org; verify it exists (with this name) in the destination org`
413
+ : "";
414
+ lines.push(` relatedElement: { __kind: "element", refName: ${quote(tool.relatedTarget.name)}, name: ${quote(tool.relatedTarget.name)} },${todo}`);
322
415
  }
323
416
  }
324
417
  if (tool.typeKey === "searchAspect" || tool.typeKey === "searchTable") {
@@ -329,10 +422,29 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
329
422
  if (tool.typeKey === "updateRecord" && tool.handleDescription !== undefined) {
330
423
  lines.push(` handleDescription: ${quote(tool.handleDescription)},`);
331
424
  }
332
- if (tool.typeKey === "searchTable" && tool.searchTableId !== undefined) {
333
- // Always a raw platform id — see NormalizedAgentTool.searchTableId's
334
- // comment; ei never exports a resolvable reference for this attribute.
335
- lines.push(` table: ${quote(tool.searchTableId)}, // TODO: raw search table id - ei's export never resolves this to a reference`);
425
+ if (tool.typeKey === "searchTable") {
426
+ const targetRefName = tool.target?.kind === "self"
427
+ ? appRefName
428
+ : tool.target?.kind === "foreignApp"
429
+ ? foreignAppRefNames?.get(tool.target.name)
430
+ : tool.target?.kind === "foreignElement"
431
+ ? foreignElementRefNames?.get(tool.target.name)
432
+ : undefined;
433
+ if (tool.searchTableKey !== undefined) {
434
+ lines.push(` table: catalog.${targetRefName ?? appRefName}.searchTables${safeMember(tool.searchTableKey)},`);
435
+ }
436
+ else {
437
+ const parent = tool.target?.kind === "self" ? appRefName : tool.target?.name ?? "";
438
+ const typedTable = tool.searchTableName === undefined
439
+ ? undefined
440
+ : foreignSearchTableRefsByName?.get(JSON.stringify([parent, tool.searchTableName]));
441
+ if (typedTable !== undefined) {
442
+ lines.push(` table: catalog.${typedTable.ownerRefName}.searchTables${safeMember(typedTable.tableKey)},`);
443
+ }
444
+ else {
445
+ lines.push(` table: { __kind: "searchTable", refName: ${quote(tool.searchTableName ?? "")}, name: ${quote(tool.searchTableName ?? "")}, parent: ${quote(parent)} },`);
446
+ }
447
+ }
336
448
  }
337
449
  if (tool.fields !== undefined && tool.fields.length > 0) {
338
450
  const owner = fieldOwnerRef(tool, appRefName, foreignAppRefNames, foreignElementRefNames);
@@ -347,7 +459,7 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
347
459
  // owning app — `owner` (self/foreign-resolved/foreign-unresolved)
348
460
  // mirrors the `aspect:` resolution just above.
349
461
  const parts = isRaw
350
- ? [`fieldId: ${quote(f.rawFieldId ?? "")}`]
462
+ ? [`fieldId: unsafePlatformId(${quote(f.rawFieldId ?? "")})`]
351
463
  : owner.kind === "catalog"
352
464
  ? [`field: ${owner.expr}.fields.${f.key}`]
353
465
  : [
@@ -361,6 +473,8 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
361
473
  parts.push(`description: ${quote(f.description ?? "")}`);
362
474
  if (f.required !== undefined)
363
475
  parts.push(`required: ${f.required}`);
476
+ if (f.defaultValue !== undefined)
477
+ parts.push(`defaultValue: ${quote(f.defaultValue)}`);
364
478
  const todo = isRaw
365
479
  ? " // TODO: raw platform field id - the field belongs to a foreign/out-of-scope aspect ei can't resolve to a reference"
366
480
  : owner.kind === "raw"
@@ -370,30 +484,51 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
370
484
  }
371
485
  lines.push(" ],");
372
486
  }
373
- // searchTable's own field shapes: field_id is always a raw platform id
374
- // (see NormalizedSearchTableField's comment), so these print as `fieldId:`
375
- // literals rather than `field: catalog....` tokens.
487
+ // The provider reads search-table field ids as raw strings. Recursive pull's
488
+ // dependency registry upgrades known ids to typed target-field tokens — but
489
+ // only when the resolved owner matches this tool's target (authoring requires
490
+ // FieldRef<Target["refName"]>; a wrong-owner upgrade fails tsc).
376
491
  if (tool.searchTableFields !== undefined && tool.searchTableFields.length > 0) {
492
+ const targetOwner = searchTableTargetOwnerRefName(tool, appRefName, foreignAppRefNames, foreignElementRefNames);
377
493
  lines.push(" fields: [");
378
494
  for (const f of tool.searchTableFields) {
379
- const parts = [`fieldId: ${quote(f.fieldId)}`];
495
+ const resolved = foreignFieldRefsById?.get(f.fieldId);
496
+ const typed = searchTableFieldMatchesTarget(f.fieldId, targetOwner, foreignFieldRefsById)
497
+ ? resolved
498
+ : undefined;
499
+ const parts = typed === undefined
500
+ ? [`fieldId: unsafePlatformId(${quote(f.fieldId)})`]
501
+ : [`field: catalog.${typed.ownerRefName}.fields.${typed.fieldKey}`];
380
502
  if (f.name !== undefined)
381
503
  parts.push(`name: ${quote(f.name)}`);
382
504
  if (f.description !== undefined)
383
505
  parts.push(`description: ${quote(f.description)}`);
384
- lines.push(` { ${parts.join(", ")} }, // TODO: raw search table field id - ei's export never resolves this to a reference`);
506
+ const todo = typed === undefined
507
+ ? " // TODO: unresolved search-table field id - pull the target element recursively to recover its catalog field"
508
+ : "";
509
+ lines.push(` { ${parts.join(", ")} },${todo}`);
385
510
  }
386
511
  lines.push(" ],");
387
512
  }
388
513
  if (tool.returnFields !== undefined && tool.returnFields.length > 0) {
514
+ const targetOwner = searchTableTargetOwnerRefName(tool, appRefName, foreignAppRefNames, foreignElementRefNames);
389
515
  lines.push(" returnFields: [");
390
516
  for (const f of tool.returnFields) {
391
- const parts = [`fieldId: ${quote(f.fieldId)}`];
517
+ const resolved = foreignFieldRefsById?.get(f.fieldId);
518
+ const typed = searchTableFieldMatchesTarget(f.fieldId, targetOwner, foreignFieldRefsById)
519
+ ? resolved
520
+ : undefined;
521
+ const parts = typed === undefined
522
+ ? [`fieldId: unsafePlatformId(${quote(f.fieldId)})`]
523
+ : [`field: catalog.${typed.ownerRefName}.fields.${typed.fieldKey}`];
392
524
  if (f.name !== undefined)
393
525
  parts.push(`name: ${quote(f.name)}`);
394
526
  if (f.displayName !== undefined)
395
527
  parts.push(`displayName: ${quote(f.displayName)}`);
396
- lines.push(` { ${parts.join(", ")} }, // TODO: raw search table field id - ei's export never resolves this to a reference`);
528
+ const todo = typed === undefined
529
+ ? " // TODO: unresolved search-table field id - pull the target element recursively to recover its catalog field"
530
+ : "";
531
+ lines.push(` { ${parts.join(", ")} },${todo}`);
397
532
  }
398
533
  lines.push(" ],");
399
534
  }
@@ -14,7 +14,7 @@ import type { AgentAuthentication } from "./build.js";
14
14
  import type { AgentToolRunAs } from "./tools.js";
15
15
  /**
16
16
  * A resolved skill reference: this app's own skill (by catalog key), a
17
- * foreign app's (by name only), or a raw platform id the export carries with
17
+ * foreign app's (by skill name plus its owning app identity), or a raw platform id the export carries with
18
18
  * no way to resolve it further at all — confirmed live: a `skill_ids` entry
19
19
  * can be a bare UUID literal with neither a resource ref into this stream
20
20
  * nor a `data.elementum_agentic_skill` block backing it anywhere in the export.
@@ -25,6 +25,8 @@ export type NormalizedSkillRef = {
25
25
  } | {
26
26
  readonly kind: "foreign";
27
27
  readonly name: string;
28
+ readonly appName: string;
29
+ readonly appRefName?: string;
28
30
  } | {
29
31
  readonly kind: "unresolved";
30
32
  readonly id: string;
@@ -7,10 +7,11 @@
7
7
  * import blocks and stay data-side — they never reach printed source.
8
8
  */
9
9
  import { EntityTfError } from "../../engine/entity.js";
10
- import { optionalBoolean, optionalString, plainObject, resourceRefLabel } from "../../engine/pull/context.js";
11
- import { isTfExpr, isUuid, sanitizeName, scopedLabelToBagKey, tfLabelToTsLabel, } from "../../engine/tf/index.js";
10
+ import { dataRefLabel, optionalBoolean, optionalString, plainObject, resourceRefLabel } from "../../engine/pull/context.js";
11
+ import { isTfExpr, isUuid, scopedLabelToBagKey, } from "../../engine/tf/index.js";
12
12
  import { a2aSkillFromTf } from "../agent-a2a-skill/from-tf.js";
13
13
  import { toolFromTf } from "../agent-tool/from-tf.js";
14
+ import { connectorIdentityFromTf } from "../shared/connector-from-tf.js";
14
15
  import { APP_RESOURCE_TYPE } from "../app/module.js";
15
16
  import { SKILL_RESOURCE_TYPE } from "../skill/module.js";
16
17
  import { AGENT_RESOURCE_TYPE } from "./module.js";
@@ -59,7 +60,14 @@ function parseSkillRef(item, where, ownerTfLabel, ctx) {
59
60
  ctx.diagnostics.push(`${where}: references data.${SKILL_RESOURCE_TYPE}.${item.label} but the stream has no such data block; dropped`);
60
61
  return undefined;
61
62
  }
62
- return { kind: "foreign", name };
63
+ const appDataLabel = dataRefLabel(ctx.dataAttrs?.(SKILL_RESOURCE_TYPE, item.label)?.["app_id"], APP_RESOURCE_TYPE);
64
+ const appName = appDataLabel === undefined ? undefined : ctx.dataName(APP_RESOURCE_TYPE, appDataLabel);
65
+ if (appName === undefined) {
66
+ ctx.diagnostics.push(`${where}: data.${SKILL_RESOURCE_TYPE}.${item.label} has no resolvable app_id owner; dropped`);
67
+ return undefined;
68
+ }
69
+ const appRefName = ctx.foreignAppRefNames?.get(appName);
70
+ return { kind: "foreign", name, appName, ...(appRefName !== undefined && { appRefName }) };
63
71
  }
64
72
  // A bare UUID literal with no data block backing it at all - the platform
65
73
  // lets skill_ids reference a skill this export can't otherwise name (e.g.
@@ -75,9 +83,10 @@ function parseSkillRef(item, where, ownerTfLabel, ctx) {
75
83
  /**
76
84
  * `run_as` is a bare string on the wire (`elementum_agent`'s schema: only
77
85
  * `"current_user"` is documented; unset means "run as admin/publisher").
78
- * `defineAgent`'s `runAs` option takes the opaque object shape shared with
86
+ * `agent`'s `runAs` option takes the opaque object shape shared with
79
87
  * agent-tool's `runAs` (`{ currentUser: true }` / `{ publisher: true }` /
80
- * `{ serviceAccount: { serviceAccount } }`) — board item B28(d) — so the
88
+ * `{ serviceAccount: { serviceAccount } }`) — the remaining agent-level
89
+ * portion of board item B28(d) — so the
81
90
  * string is translated into that shape for authoring; unrecognized values
82
91
  * (not `"current_user"`) are reported and dropped rather than guessed at.
83
92
  */
@@ -219,16 +228,12 @@ export function agentFromTf(agentBlock, toolBlocks, appLabel, _appRefName, ctx,
219
228
  // Deriving providerKey/modelKey this way (not by splitting the
220
229
  // connector's combined tfLabel) is the same derivation
221
230
  // renderAiProvidersBag uses, so the printed token matches the catalog.
222
- const modelName = ctx.dataName(connectorAttr.type, connectorAttr.label);
223
- const providerRef = ctx.dataRef(connectorAttr.type, connectorAttr.label);
224
- const providerName = providerRef !== undefined ? ctx.dataName(providerRef.resourceType, providerRef.tfLabel) : undefined;
225
- if (modelName === undefined || providerName === undefined) {
231
+ const identity = connectorIdentityFromTf(connectorAttr.type, connectorAttr.label, ctx);
232
+ if (identity.catalogKey === undefined) {
226
233
  ctx.diagnostics.push(`${where}: references data.${connectorAttr.type}.${connectorAttr.label} but the stream has no model_name/provider for it; dropped`);
227
234
  }
228
235
  else {
229
- const providerKey = tfLabelToTsLabel(sanitizeName(providerName));
230
- const modelKey = tfLabelToTsLabel(sanitizeName(modelName));
231
- connectorKey = `${providerKey}.${modelKey}`;
236
+ connectorKey = identity.catalogKey;
232
237
  }
233
238
  }
234
239
  else {
@@ -3,5 +3,8 @@
3
3
  * the deploy wire client injects) with `CatalogRef` tokens at every reference
4
4
  * position. Standalone from v1.
5
5
  */
6
- export { defineAgent, type A2ASkill, type AgentAuthentication, type AgentV2Options, type SkillAccess, } from "./build.js";
7
- export { agentCreateRecord, agentExecuteWorkflow, agentMcp, agentRelateRecord, agentRunAgent, agentRunAutomation, agentSearchAspect, agentSearchTable, agentSelectBotRoute, agentUpdateRecord, type AgentExecuteWorkflowInput, type AgentExecuteWorkflowOutput, type RunAutomationInputs, type RunAutomationOptionalInput, type RunAutomationOutput, type RunAutomationOutputs, type RunAutomationRequiredInput, type RunAutomationToolV2, type AgentMcpHeader, type AgentRecordField, type AgentRecordFieldInput, type AgentRecordRawIdField, type AgentSearchField, type AgentSearchFieldInput, type AgentSearchRawIdField, type AgentToolRunAs, type AgentTool, } from "./tools.js";
6
+ export { agent, type A2ASkill, type AgentAuthentication, type AgentV2Options, agentStartingActionVariableType, type AgentStartingAction, type AgentStartingActionVariable, type AgentStartingActionVariableType, type SkillAccess, } from "./build.js";
7
+ export { agentCreateRecord, agentExecuteWorkflow, agentMcp, agentRelateRecord, agentRunAgent, agentRunAutomation, agentSearchRecords, agentSearchTable, agentUpdateRecord, type AgentExecuteWorkflowInput, type AgentExecuteWorkflowOutput, type RunAutomationInputs, type RunAutomationOptionalInput, type RunAutomationOutput, type RunAutomationOutputs, type RunAutomationRequiredInput, type RunAutomationToolV2, type AgentMcpHeader, type AgentRecordField, type AgentRecordFieldInput, type AgentRecordRawIdField, type AgentSearchField, type AgentSearchFieldInput, type AgentSearchRawIdField, type AgentSearchReturnField, type AgentSearchReturnFieldInput, type AgentSearchRawIdReturnField, type AgentSearchTableField, type AgentSearchTableFieldInput, type AgentSearchTableRawIdField, type SearchTableToolV2, type AgentToolRunAs, type AgentTool, } from "./tools.js";
8
+ export { serviceAccountRef, type ServiceAccountRef } from "./run-as.js";
9
+ export * as filter from "../shared/filters/index.js";
10
+ export { type Filter } from "../shared/filters/types.js";
@@ -3,5 +3,7 @@
3
3
  * the deploy wire client injects) with `CatalogRef` tokens at every reference
4
4
  * position. Standalone from v1.
5
5
  */
6
- export { defineAgent, } from "./build.js";
7
- export { agentCreateRecord, agentExecuteWorkflow, agentMcp, agentRelateRecord, agentRunAgent, agentRunAutomation, agentSearchAspect, agentSearchTable, agentSelectBotRoute, agentUpdateRecord, } from "./tools.js";
6
+ export { agent, agentStartingActionVariableType, } from "./build.js";
7
+ export { agentCreateRecord, agentExecuteWorkflow, agentMcp, agentRelateRecord, agentRunAgent, agentRunAutomation, agentSearchRecords, agentSearchTable, agentUpdateRecord, } from "./tools.js";
8
+ export { serviceAccountRef } from "./run-as.js";
9
+ export * as filter from "../shared/filters/index.js";
@@ -1,7 +1,6 @@
1
1
  /** The agent entity's registry entry + resource-type constant (see src/graph/). */
2
2
  import { bareFactoryEntry } from "../../catalog/render-helpers.js";
3
3
  import { isTfExpr } from "../../engine/tf/index.js";
4
- import { NO_DATA, } from "../../graph/types.js";
5
4
  import { printAgentV2 } from "./deserializer/print-agent-v2.js";
6
5
  import { agentFromTf } from "./from-tf.js";
7
6
  import { agentToTf } from "./to-tf.js";
@@ -70,7 +69,7 @@ export const agentModule = {
70
69
  authoring: { unit: "ownFile", bag: "agents" },
71
70
  parents: [{ parent: "app", child: "agent" }],
72
71
  resource: { shape: "single", resourceType: AGENT_RESOURCE_TYPE, adoptable: true },
73
- data: NO_DATA,
72
+ data: { participates: true, resourceType: AGENT_RESOURCE_TYPE, lookupAttr: "name", referencedByBuild: false },
74
73
  canvas: {
75
74
  participates: true,
76
75
  label: "Agents",
@@ -102,6 +101,10 @@ export const agentModule = {
102
101
  ...(opts.connectorKeyOverride !== undefined && { connectorKeyOverride: opts.connectorKeyOverride }),
103
102
  ...(opts.foreignAppRefNames !== undefined && { foreignAppRefNames: opts.foreignAppRefNames }),
104
103
  ...(opts.foreignElementRefNames !== undefined && { foreignElementRefNames: opts.foreignElementRefNames }),
104
+ ...(opts.foreignFieldRefsById !== undefined && { foreignFieldRefsById: opts.foreignFieldRefsById }),
105
+ ...(opts.foreignSearchTableRefsByName !== undefined && {
106
+ foreignSearchTableRefsByName: opts.foreignSearchTableRefsByName,
107
+ }),
105
108
  }),
106
109
  };
107
110
  },
@@ -109,6 +112,8 @@ export const agentModule = {
109
112
  appRefName: ctx.appRefName,
110
113
  appTfLabel: ctx.appTfLabel,
111
114
  orgRefs: ctx.orgRefs,
115
+ workspaceAspects: ctx.workspaceAspects,
116
+ serviceAccounts: ctx.streamRootEntity?.payload?.serviceAccounts,
112
117
  diagnostics: ctx.diagnostics,
113
118
  ...(ctx.siblingEntities !== undefined && { siblingEntities: ctx.siblingEntities }),
114
119
  }),
@@ -0,0 +1,16 @@
1
+ import type { ServiceAccountRef } from "../service-account/ref.js";
2
+ export { serviceAccountRef, type ServiceAccountRef } from "../service-account/ref.js";
3
+ /** Execution identity accepted by agents and their tools. */
4
+ export type AgentToolRunAs = {
5
+ readonly currentUser: true;
6
+ readonly publisher?: never;
7
+ readonly serviceAccount?: never;
8
+ } | {
9
+ readonly publisher: true;
10
+ readonly currentUser?: never;
11
+ readonly serviceAccount?: never;
12
+ } | {
13
+ readonly serviceAccount: ServiceAccountRef;
14
+ readonly currentUser?: never;
15
+ readonly publisher?: never;
16
+ };
@@ -0,0 +1 @@
1
+ export { serviceAccountRef } from "../service-account/ref.js";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Agent emission (M3, plan §4.3): `agentToTf` consumes the discovered
3
- * `DeployableEntity` (the `defineAgent` def() payload) and emits
3
+ * `DeployableEntity` (the `agent` def() payload) and emits
4
4
  * `elementum_agent` + one tool resource per implemented tool (the tool pass
5
5
  * delegates to `entities/agent-tool/to-tf.ts`) + one `elementum_agent_a2a_skill`
6
6
  * per a2aSkills entry (delegates to `entities/agent-a2a-skill/to-tf.ts`,
@@ -15,14 +15,18 @@
15
15
  * startingActions, …) degrade through `diagnostics` — reported, never
16
16
  * silent (plan §4.3).
17
17
  */
18
- import type { OrgRefLookup } from "../../engine/build/context.js";
18
+ import { type OrgRefLookup, type WorkspaceAspect } from "../../engine/build/context.js";
19
19
  import { type DeployableEntity } from "../../engine/entity.js";
20
20
  import { type TfBlock } from "../../engine/tf/index.js";
21
+ import type { AppServiceAccount } from "../service-account/build.js";
21
22
  export interface AgentToTfContext {
22
23
  /** The owning app's refName (self-target detection) and tfLabel (namespace). */
23
24
  readonly appRefName: string;
24
25
  readonly appTfLabel: string;
25
26
  readonly orgRefs: OrgRefLookup;
27
+ readonly workspaceAspects?: ReadonlyMap<string, WorkspaceAspect>;
28
+ /** Inline service accounts authored on the owning app, keyed by stable bag key. */
29
+ readonly serviceAccounts?: Readonly<Record<string, AppServiceAccount>>;
26
30
  /** Degradations land here — reported by the caller, never silent. */
27
31
  readonly diagnostics: string[];
28
32
  /**