@elementumai/edk 0.0.0-oidc-bootstrap → 0.8.1

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 (390) hide show
  1. package/README.md +462 -3
  2. package/dist-sdk/elementum-entity-client/clients/agents/models/agent-tool.d.ts +188 -0
  3. package/dist-sdk/elementum-entity-client/clients/agents/models/agent-tool.js +20 -0
  4. package/dist-sdk/elementum-entity-client/clients/agents/models/agent.d.ts +245 -0
  5. package/dist-sdk/elementum-entity-client/clients/agents/models/agent.js +30 -0
  6. package/dist-sdk/elementum-entity-client/clients/ai-provider-connectors/models/ai-provider-connector.d.ts +18 -0
  7. package/dist-sdk/elementum-entity-client/clients/ai-provider-connectors/models/ai-provider-connector.js +8 -0
  8. package/dist-sdk/elementum-entity-client/clients/aspects/models/aspect.d.ts +718 -0
  9. package/dist-sdk/elementum-entity-client/clients/aspects/models/aspect.js +52 -0
  10. package/dist-sdk/elementum-entity-client/clients/aspects/models/field-base.d.ts +23 -0
  11. package/dist-sdk/elementum-entity-client/clients/aspects/models/field-base.js +1 -0
  12. package/dist-sdk/elementum-entity-client/clients/aspects/models/field-types.d.ts +148 -0
  13. package/dist-sdk/elementum-entity-client/clients/aspects/models/field-types.js +12 -0
  14. package/dist-sdk/elementum-entity-client/clients/aspects/models/format.d.ts +63 -0
  15. package/dist-sdk/elementum-entity-client/clients/aspects/models/format.js +17 -0
  16. package/dist-sdk/elementum-entity-client/clients/aspects/models/index.d.ts +39 -0
  17. package/dist-sdk/elementum-entity-client/clients/aspects/models/index.js +35 -0
  18. package/dist-sdk/elementum-entity-client/clients/aspects/models/picklist-config.d.ts +116 -0
  19. package/dist-sdk/elementum-entity-client/clients/aspects/models/picklist-config.js +11 -0
  20. package/dist-sdk/elementum-entity-client/clients/automation/models/automation.d.ts +178 -0
  21. package/dist-sdk/elementum-entity-client/clients/automation/models/automation.js +18 -0
  22. package/dist-sdk/elementum-entity-client/clients/document-models/models/document-model.d.ts +200 -0
  23. package/dist-sdk/elementum-entity-client/clients/document-models/models/document-model.js +1 -0
  24. package/dist-sdk/elementum-entity-client/clients/search-tables/models/index.d.ts +1 -0
  25. package/dist-sdk/elementum-entity-client/clients/search-tables/models/index.js +1 -0
  26. package/dist-sdk/elementum-entity-client/clients/search-tables/models/search-table-wire.d.ts +141 -0
  27. package/dist-sdk/elementum-entity-client/clients/search-tables/models/search-table-wire.js +22 -0
  28. package/dist-sdk/elementum-entity-client/clients/skills/models/skill-tool.d.ts +123 -0
  29. package/dist-sdk/elementum-entity-client/clients/skills/models/skill-tool.js +14 -0
  30. package/dist-sdk/elementum-entity-client/clients/skills/models/skill.d.ts +78 -0
  31. package/dist-sdk/elementum-entity-client/clients/skills/models/skill.js +23 -0
  32. package/dist-sdk/elementum-entity-client/clients/tables/models/index.d.ts +1 -0
  33. package/dist-sdk/elementum-entity-client/clients/tables/models/index.js +1 -0
  34. package/dist-sdk/elementum-entity-client/clients/tables/models/table-wire.d.ts +265 -0
  35. package/dist-sdk/elementum-entity-client/clients/tables/models/table-wire.js +15 -0
  36. package/dist-sdk/elementum-entity-client/errors.d.ts +90 -0
  37. package/dist-sdk/elementum-entity-client/errors.js +111 -0
  38. package/dist-sdk/elementum-entity-client/models/connection.d.ts +30 -0
  39. package/dist-sdk/elementum-entity-client/models/connection.js +16 -0
  40. package/dist-sdk/elementum-entity-client/types.d.ts +71 -0
  41. package/dist-sdk/elementum-entity-client/types.js +1 -0
  42. package/dist-sdk/fs/entity.d.ts +104 -0
  43. package/dist-sdk/fs/entity.js +52 -0
  44. package/dist-sdk/pull/util.d.ts +130 -0
  45. package/dist-sdk/pull/util.js +204 -0
  46. package/dist-sdk/src/catalog/ai-provider-models.d.ts +30 -0
  47. package/dist-sdk/src/catalog/ai-provider-models.js +63 -0
  48. package/dist-sdk/src/catalog/factories.d.ts +242 -0
  49. package/dist-sdk/src/catalog/factories.js +265 -0
  50. package/dist-sdk/src/catalog/from-authoring.d.ts +103 -0
  51. package/dist-sdk/src/catalog/from-authoring.js +467 -0
  52. package/dist-sdk/src/catalog/index.d.ts +12 -0
  53. package/dist-sdk/src/catalog/index.js +12 -0
  54. package/dist-sdk/src/catalog/org.d.ts +11 -0
  55. package/dist-sdk/src/catalog/org.js +288 -0
  56. package/dist-sdk/src/catalog/render-helpers.d.ts +35 -0
  57. package/dist-sdk/src/catalog/render-helpers.js +82 -0
  58. package/dist-sdk/src/catalog/render.d.ts +48 -0
  59. package/dist-sdk/src/catalog/render.js +193 -0
  60. package/dist-sdk/src/catalog/token.d.ts +10 -0
  61. package/dist-sdk/src/catalog/token.js +76 -0
  62. package/dist-sdk/src/catalog/types.d.ts +215 -0
  63. package/dist-sdk/src/catalog/types.js +86 -0
  64. package/dist-sdk/src/catalog/write.d.ts +43 -0
  65. package/dist-sdk/src/catalog/write.js +109 -0
  66. package/dist-sdk/src/core/app-to-ui.d.ts +22 -0
  67. package/dist-sdk/src/core/app-to-ui.js +75 -0
  68. package/dist-sdk/src/core/index.d.ts +10 -0
  69. package/dist-sdk/src/core/index.js +9 -0
  70. package/dist-sdk/src/core/system-fields.d.ts +95 -0
  71. package/dist-sdk/src/core/system-fields.js +153 -0
  72. package/dist-sdk/src/core/triggers/on-demand.d.ts +144 -0
  73. package/dist-sdk/src/core/triggers/on-demand.js +112 -0
  74. package/dist-sdk/src/core/types/ai-provider.d.ts +23 -0
  75. package/dist-sdk/src/core/types/ai-provider.js +8 -0
  76. package/dist-sdk/src/core/types/app.d.ts +857 -0
  77. package/dist-sdk/src/core/types/app.js +210 -0
  78. package/dist-sdk/src/core/types/aspect-category.d.ts +35 -0
  79. package/dist-sdk/src/core/types/aspect-category.js +33 -0
  80. package/dist-sdk/src/core/types/cloud-link.d.ts +34 -0
  81. package/dist-sdk/src/core/types/cloud-link.js +32 -0
  82. package/dist-sdk/src/core/types/display-block.d.ts +149 -0
  83. package/dist-sdk/src/core/types/display-block.js +61 -0
  84. package/dist-sdk/src/core/types/group.d.ts +13 -0
  85. package/dist-sdk/src/core/types/group.js +6 -0
  86. package/dist-sdk/src/core/types/platform.d.ts +2 -0
  87. package/dist-sdk/src/core/types/platform.js +1 -0
  88. package/dist-sdk/src/core/types/user.d.ts +20 -0
  89. package/dist-sdk/src/core/types/user.js +8 -0
  90. package/dist-sdk/src/core/wire/ref-serializer.d.ts +45 -0
  91. package/dist-sdk/src/core/wire/ref-serializer.js +89 -0
  92. package/dist-sdk/src/engine/build/context.d.ts +67 -0
  93. package/dist-sdk/src/engine/build/context.js +6 -0
  94. package/dist-sdk/src/engine/build/source-context.d.ts +45 -0
  95. package/dist-sdk/src/engine/build/source-context.js +23 -0
  96. package/dist-sdk/src/engine/entity.d.ts +44 -0
  97. package/dist-sdk/src/engine/entity.js +15 -0
  98. package/dist-sdk/src/engine/pull/context.d.ts +38 -0
  99. package/dist-sdk/src/engine/pull/context.js +44 -0
  100. package/dist-sdk/src/engine/pull/org.d.ts +54 -0
  101. package/dist-sdk/src/engine/pull/org.js +134 -0
  102. package/dist-sdk/src/engine/tf/escape.d.ts +22 -0
  103. package/dist-sdk/src/engine/tf/escape.js +28 -0
  104. package/dist-sdk/src/engine/tf/expr.d.ts +25 -0
  105. package/dist-sdk/src/engine/tf/expr.js +405 -0
  106. package/dist-sdk/src/engine/tf/index.d.ts +12 -0
  107. package/dist-sdk/src/engine/tf/index.js +11 -0
  108. package/dist-sdk/src/engine/tf/labels.d.ts +76 -0
  109. package/dist-sdk/src/engine/tf/labels.js +196 -0
  110. package/dist-sdk/src/engine/tf/model.d.ts +84 -0
  111. package/dist-sdk/src/engine/tf/model.js +49 -0
  112. package/dist-sdk/src/engine/tf/parse.d.ts +41 -0
  113. package/dist-sdk/src/engine/tf/parse.js +189 -0
  114. package/dist-sdk/src/engine/tf/render.d.ts +13 -0
  115. package/dist-sdk/src/engine/tf/render.js +102 -0
  116. package/dist-sdk/src/engine/workspace/authoring-layout.d.ts +43 -0
  117. package/dist-sdk/src/engine/workspace/authoring-layout.js +201 -0
  118. package/dist-sdk/src/entities/access-policy/build.d.ts +26 -0
  119. package/dist-sdk/src/entities/access-policy/build.js +7 -0
  120. package/dist-sdk/src/entities/access-policy/filter.d.ts +61 -0
  121. package/dist-sdk/src/entities/access-policy/filter.js +83 -0
  122. package/dist-sdk/src/entities/access-policy/from-tf.d.ts +48 -0
  123. package/dist-sdk/src/entities/access-policy/from-tf.js +189 -0
  124. package/dist-sdk/src/entities/access-policy/module.d.ts +3 -0
  125. package/dist-sdk/src/entities/access-policy/module.js +17 -0
  126. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +36 -0
  127. package/dist-sdk/src/entities/access-policy/to-tf.js +149 -0
  128. package/dist-sdk/src/entities/access-policy/types.d.ts +4 -0
  129. package/dist-sdk/src/entities/access-policy/types.js +10 -0
  130. package/dist-sdk/src/entities/agent/build.d.ts +108 -0
  131. package/dist-sdk/src/entities/agent/build.js +148 -0
  132. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +53 -0
  133. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +344 -0
  134. package/dist-sdk/src/entities/agent/from-tf.d.ts +65 -0
  135. package/dist-sdk/src/entities/agent/from-tf.js +289 -0
  136. package/dist-sdk/src/entities/agent/index.d.ts +7 -0
  137. package/dist-sdk/src/entities/agent/index.js +7 -0
  138. package/dist-sdk/src/entities/agent/module.d.ts +4 -0
  139. package/dist-sdk/src/entities/agent/module.js +122 -0
  140. package/dist-sdk/src/entities/agent/to-tf.d.ts +33 -0
  141. package/dist-sdk/src/entities/agent/to-tf.js +188 -0
  142. package/dist-sdk/src/entities/agent/tools.d.ts +284 -0
  143. package/dist-sdk/src/entities/agent/tools.js +238 -0
  144. package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +110 -0
  145. package/dist-sdk/src/entities/agent-tool/from-tf.js +265 -0
  146. package/dist-sdk/src/entities/agent-tool/module.d.ts +3 -0
  147. package/dist-sdk/src/entities/agent-tool/module.js +32 -0
  148. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +40 -0
  149. package/dist-sdk/src/entities/agent-tool/to-tf.js +250 -0
  150. package/dist-sdk/src/entities/agent-tool/types.d.ts +43 -0
  151. package/dist-sdk/src/entities/agent-tool/types.js +102 -0
  152. package/dist-sdk/src/entities/app/build.d.ts +368 -0
  153. package/dist-sdk/src/entities/app/build.js +372 -0
  154. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +168 -0
  155. package/dist-sdk/src/entities/app/deserializer/normalize.js +12 -0
  156. package/dist-sdk/src/entities/app/display-blocks.d.ts +26 -0
  157. package/dist-sdk/src/entities/app/display-blocks.js +34 -0
  158. package/dist-sdk/src/entities/app/from-tf.d.ts +23 -0
  159. package/dist-sdk/src/entities/app/from-tf.js +197 -0
  160. package/dist-sdk/src/entities/app/index.d.ts +14 -0
  161. package/dist-sdk/src/entities/app/index.js +11 -0
  162. package/dist-sdk/src/entities/app/locals.d.ts +11 -0
  163. package/dist-sdk/src/entities/app/locals.js +31 -0
  164. package/dist-sdk/src/entities/app/module.d.ts +4 -0
  165. package/dist-sdk/src/entities/app/module.js +66 -0
  166. package/dist-sdk/src/entities/app/to-tf.d.ts +33 -0
  167. package/dist-sdk/src/entities/app/to-tf.js +212 -0
  168. package/dist-sdk/src/entities/approval-chain/build.d.ts +24 -0
  169. package/dist-sdk/src/entities/approval-chain/build.js +56 -0
  170. package/dist-sdk/src/entities/approval-chain/index.d.ts +6 -0
  171. package/dist-sdk/src/entities/approval-chain/index.js +6 -0
  172. package/dist-sdk/src/entities/approval-chain/steps.d.ts +24 -0
  173. package/dist-sdk/src/entities/approval-chain/steps.js +20 -0
  174. package/dist-sdk/src/entities/automation/build.d.ts +259 -0
  175. package/dist-sdk/src/entities/automation/build.js +436 -0
  176. package/dist-sdk/src/entities/automation/catalog-render.d.ts +5 -0
  177. package/dist-sdk/src/entities/automation/catalog-render.js +35 -0
  178. package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +152 -0
  179. package/dist-sdk/src/entities/automation/deserializer/ast.js +13 -0
  180. package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +55 -0
  181. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +1176 -0
  182. package/dist-sdk/src/entities/automation/filter.d.ts +93 -0
  183. package/dist-sdk/src/entities/automation/filter.js +156 -0
  184. package/dist-sdk/src/entities/automation/from-tf.d.ts +35 -0
  185. package/dist-sdk/src/entities/automation/from-tf.js +1258 -0
  186. package/dist-sdk/src/entities/automation/index.d.ts +22 -0
  187. package/dist-sdk/src/entities/automation/index.js +25 -0
  188. package/dist-sdk/src/entities/automation/module.d.ts +3 -0
  189. package/dist-sdk/src/entities/automation/module.js +150 -0
  190. package/dist-sdk/src/entities/automation/operators.d.ts +93 -0
  191. package/dist-sdk/src/entities/automation/operators.js +69 -0
  192. package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +19 -0
  193. package/dist-sdk/src/entities/automation/output-key-wire-name.js +24 -0
  194. package/dist-sdk/src/entities/automation/script-code.d.ts +51 -0
  195. package/dist-sdk/src/entities/automation/script-code.js +633 -0
  196. package/dist-sdk/src/entities/automation/serialize.d.ts +6 -0
  197. package/dist-sdk/src/entities/automation/serialize.js +41 -0
  198. package/dist-sdk/src/entities/automation/tasks.d.ts +641 -0
  199. package/dist-sdk/src/entities/automation/tasks.js +765 -0
  200. package/dist-sdk/src/entities/automation/to-tf.d.ts +19 -0
  201. package/dist-sdk/src/entities/automation/to-tf.js +1169 -0
  202. package/dist-sdk/src/entities/automation/triggers.d.ts +205 -0
  203. package/dist-sdk/src/entities/automation/triggers.js +202 -0
  204. package/dist-sdk/src/entities/automation/types.d.ts +78 -0
  205. package/dist-sdk/src/entities/automation/types.js +131 -0
  206. package/dist-sdk/src/entities/element/build.d.ts +121 -0
  207. package/dist-sdk/src/entities/element/build.js +110 -0
  208. package/dist-sdk/src/entities/element/from-tf.d.ts +19 -0
  209. package/dist-sdk/src/entities/element/from-tf.js +170 -0
  210. package/dist-sdk/src/entities/element/index.d.ts +12 -0
  211. package/dist-sdk/src/entities/element/index.js +10 -0
  212. package/dist-sdk/src/entities/element/locals.d.ts +7 -0
  213. package/dist-sdk/src/entities/element/locals.js +12 -0
  214. package/dist-sdk/src/entities/element/module.d.ts +8 -0
  215. package/dist-sdk/src/entities/element/module.js +65 -0
  216. package/dist-sdk/src/entities/element/to-tf.d.ts +14 -0
  217. package/dist-sdk/src/entities/element/to-tf.js +169 -0
  218. package/dist-sdk/src/entities/field/build.d.ts +112 -0
  219. package/dist-sdk/src/entities/field/build.js +84 -0
  220. package/dist-sdk/src/entities/field/calc/aggregate.d.ts +60 -0
  221. package/dist-sdk/src/entities/field/calc/aggregate.js +71 -0
  222. package/dist-sdk/src/entities/field/calc/date.d.ts +73 -0
  223. package/dist-sdk/src/entities/field/calc/date.js +109 -0
  224. package/dist-sdk/src/entities/field/calc/index.d.ts +229 -0
  225. package/dist-sdk/src/entities/field/calc/index.js +433 -0
  226. package/dist-sdk/src/entities/field/calc/numeric.d.ts +22 -0
  227. package/dist-sdk/src/entities/field/calc/numeric.js +67 -0
  228. package/dist-sdk/src/entities/field/calc/runtime.d.ts +61 -0
  229. package/dist-sdk/src/entities/field/calc/runtime.js +174 -0
  230. package/dist-sdk/src/entities/field/calc/text.d.ts +100 -0
  231. package/dist-sdk/src/entities/field/calc/text.js +208 -0
  232. package/dist-sdk/src/entities/field/calc/types.d.ts +86 -0
  233. package/dist-sdk/src/entities/field/calc/types.js +23 -0
  234. package/dist-sdk/src/entities/field/calc.d.ts +108 -0
  235. package/dist-sdk/src/entities/field/calc.js +54 -0
  236. package/dist-sdk/src/entities/field/from-tf.d.ts +31 -0
  237. package/dist-sdk/src/entities/field/from-tf.js +184 -0
  238. package/dist-sdk/src/entities/field/locals.d.ts +8 -0
  239. package/dist-sdk/src/entities/field/locals.js +24 -0
  240. package/dist-sdk/src/entities/field/module.d.ts +3 -0
  241. package/dist-sdk/src/entities/field/module.js +50 -0
  242. package/dist-sdk/src/entities/field/options.d.ts +27 -0
  243. package/dist-sdk/src/entities/field/options.js +76 -0
  244. package/dist-sdk/src/entities/field/record-shape.d.ts +57 -0
  245. package/dist-sdk/src/entities/field/record-shape.js +1 -0
  246. package/dist-sdk/src/entities/field/to-tf.d.ts +73 -0
  247. package/dist-sdk/src/entities/field/to-tf.js +142 -0
  248. package/dist-sdk/src/entities/field/types.d.ts +53 -0
  249. package/dist-sdk/src/entities/field/types.js +68 -0
  250. package/dist-sdk/src/entities/file-reader/build.d.ts +182 -0
  251. package/dist-sdk/src/entities/file-reader/build.js +105 -0
  252. package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.d.ts +6 -0
  253. package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.js +109 -0
  254. package/dist-sdk/src/entities/file-reader/from-tf.d.ts +13 -0
  255. package/dist-sdk/src/entities/file-reader/from-tf.js +172 -0
  256. package/dist-sdk/src/entities/file-reader/index.d.ts +10 -0
  257. package/dist-sdk/src/entities/file-reader/index.js +10 -0
  258. package/dist-sdk/src/entities/file-reader/module.d.ts +3 -0
  259. package/dist-sdk/src/entities/file-reader/module.js +115 -0
  260. package/dist-sdk/src/entities/file-reader/to-tf.d.ts +14 -0
  261. package/dist-sdk/src/entities/file-reader/to-tf.js +84 -0
  262. package/dist-sdk/src/entities/file-reader/types.d.ts +32 -0
  263. package/dist-sdk/src/entities/file-reader/types.js +30 -0
  264. package/dist-sdk/src/entities/flow/activities/agent.d.ts +15 -0
  265. package/dist-sdk/src/entities/flow/activities/agent.js +29 -0
  266. package/dist-sdk/src/entities/flow/activities/approval.d.ts +9 -0
  267. package/dist-sdk/src/entities/flow/activities/approval.js +18 -0
  268. package/dist-sdk/src/entities/flow/activities/automation.d.ts +12 -0
  269. package/dist-sdk/src/entities/flow/activities/automation.js +22 -0
  270. package/dist-sdk/src/entities/flow/activities/ctx.d.ts +34 -0
  271. package/dist-sdk/src/entities/flow/activities/ctx.js +38 -0
  272. package/dist-sdk/src/entities/flow/activities/form.d.ts +22 -0
  273. package/dist-sdk/src/entities/flow/activities/form.js +36 -0
  274. package/dist-sdk/src/entities/flow/activities/index.d.ts +14 -0
  275. package/dist-sdk/src/entities/flow/activities/index.js +13 -0
  276. package/dist-sdk/src/entities/flow/activities/input-refs.d.ts +39 -0
  277. package/dist-sdk/src/entities/flow/activities/input-refs.js +19 -0
  278. package/dist-sdk/src/entities/flow/activities/prompt-template.d.ts +13 -0
  279. package/dist-sdk/src/entities/flow/activities/prompt-template.js +34 -0
  280. package/dist-sdk/src/entities/flow/activities/render-catalog.d.ts +140 -0
  281. package/dist-sdk/src/entities/flow/activities/render-catalog.js +174 -0
  282. package/dist-sdk/src/entities/flow/activities/types.d.ts +33 -0
  283. package/dist-sdk/src/entities/flow/activities/types.js +1 -0
  284. package/dist-sdk/src/entities/flow/build.d.ts +38 -0
  285. package/dist-sdk/src/entities/flow/build.js +115 -0
  286. package/dist-sdk/src/entities/flow/index.d.ts +8 -0
  287. package/dist-sdk/src/entities/flow/index.js +7 -0
  288. package/dist-sdk/src/entities/flow/serialize.d.ts +51 -0
  289. package/dist-sdk/src/entities/flow/serialize.js +94 -0
  290. package/dist-sdk/src/entities/flow/util.d.ts +27 -0
  291. package/dist-sdk/src/entities/flow/util.js +38 -0
  292. package/dist-sdk/src/entities/org/ai-provider.d.ts +13 -0
  293. package/dist-sdk/src/entities/org/ai-provider.js +46 -0
  294. package/dist-sdk/src/entities/org/category.d.ts +5 -0
  295. package/dist-sdk/src/entities/org/category.js +33 -0
  296. package/dist-sdk/src/entities/org/cloud-link.d.ts +5 -0
  297. package/dist-sdk/src/entities/org/cloud-link.js +33 -0
  298. package/dist-sdk/src/entities/org/connector.d.ts +12 -0
  299. package/dist-sdk/src/entities/org/connector.js +35 -0
  300. package/dist-sdk/src/entities/org/group.d.ts +5 -0
  301. package/dist-sdk/src/entities/org/group.js +40 -0
  302. package/dist-sdk/src/entities/org/index.d.ts +11 -0
  303. package/dist-sdk/src/entities/org/index.js +11 -0
  304. package/dist-sdk/src/entities/org/role.d.ts +7 -0
  305. package/dist-sdk/src/entities/org/role.js +21 -0
  306. package/dist-sdk/src/entities/org/user.d.ts +7 -0
  307. package/dist-sdk/src/entities/org/user.js +30 -0
  308. package/dist-sdk/src/entities/search-table/build.d.ts +41 -0
  309. package/dist-sdk/src/entities/search-table/build.js +79 -0
  310. package/dist-sdk/src/entities/search-table/index.d.ts +5 -0
  311. package/dist-sdk/src/entities/search-table/index.js +5 -0
  312. package/dist-sdk/src/entities/search-table/module.d.ts +6 -0
  313. package/dist-sdk/src/entities/search-table/module.js +64 -0
  314. package/dist-sdk/src/entities/shared/context.d.ts +93 -0
  315. package/dist-sdk/src/entities/shared/context.js +156 -0
  316. package/dist-sdk/src/entities/shared/filters/ast.d.ts +277 -0
  317. package/dist-sdk/src/entities/shared/filters/ast.js +65 -0
  318. package/dist-sdk/src/entities/shared/filters/index.d.ts +211 -0
  319. package/dist-sdk/src/entities/shared/filters/index.js +372 -0
  320. package/dist-sdk/src/entities/shared/filters/types.d.ts +170 -0
  321. package/dist-sdk/src/entities/shared/filters/types.js +7 -0
  322. package/dist-sdk/src/entities/shared/ref.d.ts +160 -0
  323. package/dist-sdk/src/entities/shared/ref.js +119 -0
  324. package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +17 -0
  325. package/dist-sdk/src/entities/shared/tool-field-ref.js +31 -0
  326. package/dist-sdk/src/entities/shared/types/common.d.ts +106 -0
  327. package/dist-sdk/src/entities/shared/types/common.js +64 -0
  328. package/dist-sdk/src/entities/shared/types/field-types.d.ts +58 -0
  329. package/dist-sdk/src/entities/shared/types/field-types.js +57 -0
  330. package/dist-sdk/src/entities/shared/types/platform.d.ts +46 -0
  331. package/dist-sdk/src/entities/shared/types/platform.js +10 -0
  332. package/dist-sdk/src/entities/skill/build.d.ts +25 -0
  333. package/dist-sdk/src/entities/skill/build.js +50 -0
  334. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +39 -0
  335. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +124 -0
  336. package/dist-sdk/src/entities/skill/from-tf.d.ts +33 -0
  337. package/dist-sdk/src/entities/skill/from-tf.js +96 -0
  338. package/dist-sdk/src/entities/skill/index.d.ts +7 -0
  339. package/dist-sdk/src/entities/skill/index.js +7 -0
  340. package/dist-sdk/src/entities/skill/module.d.ts +4 -0
  341. package/dist-sdk/src/entities/skill/module.js +111 -0
  342. package/dist-sdk/src/entities/skill/to-tf.d.ts +33 -0
  343. package/dist-sdk/src/entities/skill/to-tf.js +59 -0
  344. package/dist-sdk/src/entities/skill/tools.d.ts +93 -0
  345. package/dist-sdk/src/entities/skill/tools.js +105 -0
  346. package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +60 -0
  347. package/dist-sdk/src/entities/skill-tool/from-tf.js +142 -0
  348. package/dist-sdk/src/entities/skill-tool/module.d.ts +3 -0
  349. package/dist-sdk/src/entities/skill-tool/module.js +21 -0
  350. package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +34 -0
  351. package/dist-sdk/src/entities/skill-tool/to-tf.js +130 -0
  352. package/dist-sdk/src/entities/skill-tool/types.d.ts +40 -0
  353. package/dist-sdk/src/entities/skill-tool/types.js +67 -0
  354. package/dist-sdk/src/entities/table/build.d.ts +74 -0
  355. package/dist-sdk/src/entities/table/build.js +339 -0
  356. package/dist-sdk/src/entities/table/catalog-render.d.ts +5 -0
  357. package/dist-sdk/src/entities/table/catalog-render.js +39 -0
  358. package/dist-sdk/src/entities/table/fields.d.ts +81 -0
  359. package/dist-sdk/src/entities/table/fields.js +70 -0
  360. package/dist-sdk/src/entities/table/filter.d.ts +41 -0
  361. package/dist-sdk/src/entities/table/filter.js +89 -0
  362. package/dist-sdk/src/entities/table/index.d.ts +8 -0
  363. package/dist-sdk/src/entities/table/index.js +12 -0
  364. package/dist-sdk/src/entities/table/joins.d.ts +26 -0
  365. package/dist-sdk/src/entities/table/joins.js +31 -0
  366. package/dist-sdk/src/entities/table/keys.d.ts +11 -0
  367. package/dist-sdk/src/entities/table/keys.js +25 -0
  368. package/dist-sdk/src/entities/table/module.d.ts +5 -0
  369. package/dist-sdk/src/entities/table/module.js +25 -0
  370. package/dist-sdk/src/entities/table/state.d.ts +39 -0
  371. package/dist-sdk/src/entities/table/state.js +43 -0
  372. package/dist-sdk/src/entities/view/from-tf.d.ts +29 -0
  373. package/dist-sdk/src/entities/view/from-tf.js +235 -0
  374. package/dist-sdk/src/entities/view/module.d.ts +24 -0
  375. package/dist-sdk/src/entities/view/module.js +61 -0
  376. package/dist-sdk/src/entities/view/to-tf.d.ts +65 -0
  377. package/dist-sdk/src/entities/view/to-tf.js +171 -0
  378. package/dist-sdk/src/entities/view/types.d.ts +58 -0
  379. package/dist-sdk/src/entities/view/types.js +89 -0
  380. package/dist-sdk/src/graph/deferred-catalog-render.d.ts +9 -0
  381. package/dist-sdk/src/graph/deferred-catalog-render.js +18 -0
  382. package/dist-sdk/src/graph/index.d.ts +91 -0
  383. package/dist-sdk/src/graph/index.js +211 -0
  384. package/dist-sdk/src/graph/modules.d.ts +7 -0
  385. package/dist-sdk/src/graph/modules.js +42 -0
  386. package/dist-sdk/src/graph/types.d.ts +375 -0
  387. package/dist-sdk/src/graph/types.js +102 -0
  388. package/dist-sdk/src/internal/sdk-package.d.ts +7 -0
  389. package/dist-sdk/src/internal/sdk-package.js +23 -0
  390. package/package.json +201 -8
@@ -0,0 +1,284 @@
1
+ /**
2
+ * v2 agent tool factories — emit Hydra's `AgentToolCreateInput` wire shape with
3
+ * `CatalogRef` tokens at every id position (aspect, field, search table, target
4
+ * agent, automation, connector). The tokens are resolved to ids at deploy by
5
+ * `resolvePayload`; nothing here reads an `.id`.
6
+ *
7
+ * Parallel to v1 `src/agents/tools/*` + `serializer`, fully standalone so v1 can
8
+ * be deleted. Each factory takes the tool's `name`/`description` inline (v1 kept
9
+ * the name on the `.tool(name, def)` call) and returns the discriminated wire
10
+ * object. Optional `startMessage` / `runAs` are emitted only when supplied,
11
+ * matching the v1 serializer's field-by-field discipline.
12
+ */
13
+ import type { AutomationCatalogRef, AgentRef, AspectRef, AutomationRef, FieldRef, OutputPropertyRef, TriggerParameterRef } from "../../catalog/index.js";
14
+ /** A handle-form agent tool: a Hydra `AgentToolCreateInput` with ref tokens. */
15
+ export type AgentTool = Record<string, unknown>;
16
+ /** Opaque run-as config (Hydra's `AgentConversationRunAsInput`). */
17
+ export type AgentToolRunAs = Record<string, unknown>;
18
+ /** A field exposed to a search tool. */
19
+ export interface AgentSearchField {
20
+ readonly field: FieldRef;
21
+ readonly name?: string;
22
+ /** Required by the provider on every tool field. */
23
+ readonly description: string;
24
+ }
25
+ /**
26
+ * A search-tool field identified by a raw platform id rather than a
27
+ * FieldRef token — the field belongs to a foreign/out-of-scope aspect ei
28
+ * can't resolve to a resource reference (board issue #169; confirmed live,
29
+ * same fallback convention as `AgentSearchTableField`). The platform id, not
30
+ * a live reference — it never updates if the field is later renamed
31
+ * upstream, and there's no way to author one directly; it only arises from
32
+ * `edk pull app` round-tripping an existing tool.
33
+ */
34
+ export interface AgentSearchRawIdField {
35
+ readonly fieldId: string;
36
+ readonly name?: string;
37
+ readonly description: string;
38
+ }
39
+ export type AgentSearchFieldInput = AgentSearchField | AgentSearchRawIdField;
40
+ /**
41
+ * A field exposed to a searchTable tool's newer `fields` wire shape
42
+ * (field_id/name/description). Unlike every other tool's `fields`,
43
+ * field_id here is a raw platform id, not a catalog token — confirmed
44
+ * live, searchTable's fields describe columns of the search table's own
45
+ * schema, not app/element fields, so there's no `elementum_*_field`
46
+ * resource to reference (same raw-id convention as
47
+ * `TableRecordsSearchOptions.table`).
48
+ */
49
+ export interface AgentSearchTableField {
50
+ readonly fieldId: string;
51
+ readonly name?: string;
52
+ readonly description?: string;
53
+ }
54
+ /**
55
+ * A field exposed to a searchTable tool's legacy `return_fields` wire shape
56
+ * (field_id/name/display_name, no description) — the dialect most existing
57
+ * elementum_agent_ai_search_tool resources still use; the provider is
58
+ * deprecating it in favor of the same shape as {@link AgentSearchTableField},
59
+ * but both are live on the platform today (see `agentSearchTable`'s doc
60
+ * comment). Same raw field_id convention as `AgentSearchTableField`.
61
+ */
62
+ export interface AgentSearchReturnField {
63
+ readonly fieldId: string;
64
+ readonly name?: string;
65
+ readonly displayName?: string;
66
+ }
67
+ /** A field the agent can populate/modify via a create/update record tool. */
68
+ export interface AgentRecordField {
69
+ readonly field: FieldRef;
70
+ readonly name?: string;
71
+ /** Required by the provider on every tool field. */
72
+ readonly description: string;
73
+ readonly required?: boolean;
74
+ readonly defaultValue?: string;
75
+ }
76
+ /**
77
+ * A create/update-record field identified by a raw platform id rather than
78
+ * a FieldRef token — same raw-id fallback as {@link AgentSearchRawIdField}
79
+ * (board issue #169), for createRecord/updateRecord tools instead of search.
80
+ */
81
+ export interface AgentRecordRawIdField {
82
+ readonly fieldId: string;
83
+ readonly name?: string;
84
+ /** Required by the provider on every tool field. */
85
+ readonly description: string;
86
+ readonly required?: boolean;
87
+ }
88
+ export type AgentRecordFieldInput = AgentRecordField | AgentRecordRawIdField;
89
+ /** Input-parameter mapping for an execute-workflow tool. */
90
+ export interface AgentExecuteWorkflowInput {
91
+ readonly name: string;
92
+ readonly description: string;
93
+ /** The target automation's trigger parameter, e.g. `app.automations.foo.trigger.bar`. */
94
+ readonly triggerParameter: TriggerParameterRef;
95
+ readonly required?: boolean;
96
+ }
97
+ /** Output-parameter mapping for an execute-workflow tool. */
98
+ export interface AgentExecuteWorkflowOutput {
99
+ readonly name: string;
100
+ /** The target automation's output property, e.g. `app.automations.foo.outputs.bar`. */
101
+ readonly workflowOutputProperty: OutputPropertyRef;
102
+ }
103
+ export interface AgentMcpHeader {
104
+ readonly key: string;
105
+ readonly value: string;
106
+ }
107
+ /** Common options shared by every tool. */
108
+ interface CommonToolOptions {
109
+ readonly name: string;
110
+ readonly description: string;
111
+ readonly startMessage?: string;
112
+ readonly runAs?: AgentToolRunAs;
113
+ }
114
+ export interface SearchAspectToolV2 extends CommonToolOptions {
115
+ readonly aspect: AspectRef;
116
+ readonly queryDescription: string;
117
+ readonly fields?: readonly AgentSearchFieldInput[];
118
+ /** Pre-built wire `Filter` (may embed `FieldRef` tokens — resolved at deploy). */
119
+ readonly filter?: Record<string, unknown>;
120
+ /** Pre-built wire `Sort` (`{ orders: [{ field, direction }] }`). */
121
+ readonly sort?: Record<string, unknown>;
122
+ readonly limit?: number;
123
+ }
124
+ export declare function agentSearchAspect(opts: SearchAspectToolV2): AgentTool;
125
+ /**
126
+ * Unlike the other search tools, a search table has no import/reference
127
+ * mechanism yet (mirrors `TableRecordsSearchOptions.table`'s same raw-id
128
+ * convention): `table` is the platform's raw search table id, not a catalog
129
+ * token — confirmed live, ei's own export never resolves `search_table_id`
130
+ * to a reference for any of these tools. `aspect` is also optional here
131
+ * (unlike searchAspect) — a search table tool doesn't always need a live
132
+ * record target. `fields`/`returnFields` are mutually exclusive: most
133
+ * existing tools use the legacy `return_fields` wire shape (`returnFields`,
134
+ * field_id/name/displayName), which the provider is deprecating in favor of
135
+ * the same shape searchAspect already uses (`fields`, field_id/name/
136
+ * description) — both are live on the platform today, so both round-trip.
137
+ */
138
+ export interface SearchTableToolV2 extends CommonToolOptions {
139
+ readonly aspect?: AspectRef;
140
+ readonly table: string;
141
+ readonly queryDescription: string;
142
+ /** searchTable's newer field shape — mutually exclusive with `returnFields`. */
143
+ readonly fields?: readonly AgentSearchTableField[];
144
+ /** searchTable's legacy field shape — mutually exclusive with `fields`. */
145
+ readonly returnFields?: readonly AgentSearchReturnField[];
146
+ readonly filter?: Record<string, unknown>;
147
+ readonly limit?: number;
148
+ }
149
+ export declare function agentSearchTable(opts: SearchTableToolV2): AgentTool;
150
+ export interface CreateRecordToolV2 extends CommonToolOptions {
151
+ readonly aspect: AspectRef;
152
+ readonly fields?: readonly AgentRecordFieldInput[];
153
+ }
154
+ export declare function agentCreateRecord(opts: CreateRecordToolV2): AgentTool;
155
+ export interface UpdateRecordToolV2 extends CommonToolOptions {
156
+ readonly aspect: AspectRef;
157
+ readonly fields?: readonly AgentRecordFieldInput[];
158
+ /**
159
+ * How the agent should identify which record to update — the provider
160
+ * requires this (there's no way to infer it) and rejects an empty value
161
+ * at apply with an opaque "Unable to validate" error, so it's required
162
+ * here instead. Example: "Identify the ticket by its ID or subject line."
163
+ */
164
+ readonly handleDescription: string;
165
+ }
166
+ export declare function agentUpdateRecord(opts: UpdateRecordToolV2): AgentTool;
167
+ export interface RelateRecordToolV2 extends CommonToolOptions {
168
+ readonly aspect: AspectRef;
169
+ readonly relatedAspect: AspectRef;
170
+ }
171
+ export declare function agentRelateRecord(opts: RelateRecordToolV2): AgentTool;
172
+ export interface ExecuteWorkflowToolV2 extends CommonToolOptions {
173
+ readonly automation: AutomationRef;
174
+ readonly inputs?: readonly AgentExecuteWorkflowInput[];
175
+ readonly outputs?: readonly AgentExecuteWorkflowOutput[];
176
+ }
177
+ export declare function agentExecuteWorkflow(opts: ExecuteWorkflowToolV2): AgentTool;
178
+ type EmptyBag = {
179
+ readonly [K in never]: never;
180
+ };
181
+ /**
182
+ * Strip index signatures, keeping only literal keys. Indexing an
183
+ * `AutomationCatalogRef & { trigger: <literal bag> }` intersection yields
184
+ * `Readonly<Record<string, TriggerParameterRef>> & <literal bag>` — the
185
+ * Record component's index signature would poison `keyof` into `string`
186
+ * and silently disable every constraint below.
187
+ */
188
+ type KnownKeys<T> = {
189
+ [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K];
190
+ };
191
+ /**
192
+ * The automation's trigger bag, resolved for constraint purposes:
193
+ * - `trigger: undefined` (paramless automation) → EmptyBag (any key errors);
194
+ * - literal bag from a generated/typed catalog → its literal keys;
195
+ * - wide token (plain AutomationCatalogRef — foreign app or hand-written)
196
+ * → permissive Record (graceful degradation; def() still validates).
197
+ */
198
+ type TriggerBagOf<A extends AutomationCatalogRef> = [NonNullable<A["trigger"]>] extends [never] ? EmptyBag : KnownKeys<NonNullable<A["trigger"]>> extends infer KK ? [keyof KK] extends [never] ? Readonly<Record<string, TriggerParameterRef>> : KK : never;
199
+ type OutputBagOf<A extends AutomationCatalogRef> = [NonNullable<A["outputs"]>] extends [never] ? EmptyBag : KnownKeys<NonNullable<A["outputs"]>> extends infer KK ? [keyof KK] extends [never] ? Readonly<Record<string, OutputPropertyRef>> : KK : never;
200
+ /** Keys whose catalog entry carries `required: true` (rendered by the generated catalog). */
201
+ type RequiredParamKeys<T> = {
202
+ [K in keyof T]: T[K] extends {
203
+ readonly required: true;
204
+ } ? K : never;
205
+ }[keyof T];
206
+ /** Input spec for a trigger parameter the automation declares REQUIRED — the tool input must be required too. */
207
+ export interface RunAutomationRequiredInput {
208
+ /** Agent-facing input name; defaults to the trigger parameter name (the record key). */
209
+ readonly name?: string;
210
+ readonly description: string;
211
+ readonly required: true;
212
+ }
213
+ /** Input spec for an optional trigger parameter — the tool input may still be required. */
214
+ export interface RunAutomationOptionalInput {
215
+ /** Agent-facing input name; defaults to the trigger parameter name (the record key). */
216
+ readonly name?: string;
217
+ readonly description: string;
218
+ readonly required?: boolean;
219
+ }
220
+ /**
221
+ * The inputs record, keyed by the automation's DECLARED trigger parameter
222
+ * names: required params are non-optional keys whose spec demands
223
+ * `required: true`; optional params are optional keys.
224
+ */
225
+ export type RunAutomationInputs<T> = [keyof T] extends [never] ? {
226
+ readonly [key: string]: never;
227
+ } : {
228
+ readonly [K in RequiredParamKeys<T>]: RunAutomationRequiredInput;
229
+ } & {
230
+ readonly [K in Exclude<keyof T, RequiredParamKeys<T>>]?: RunAutomationOptionalInput;
231
+ };
232
+ export interface RunAutomationOutput {
233
+ /** Agent-facing output name; defaults to the workflow output property name (the record key). */
234
+ readonly name?: string;
235
+ }
236
+ /** The outputs record, keyed by the automation's workflow output property names. */
237
+ export type RunAutomationOutputs<O> = [keyof O] extends [never] ? {
238
+ readonly [key: string]: never;
239
+ } : {
240
+ readonly [K in keyof O]?: RunAutomationOutput;
241
+ };
242
+ export type RunAutomationToolV2<A extends AutomationCatalogRef> = CommonToolOptions & {
243
+ readonly automation: A;
244
+ readonly outputs?: RunAutomationOutputs<OutputBagOf<A>>;
245
+ } & ([RequiredParamKeys<TriggerBagOf<A>>] extends [never] ? {
246
+ readonly inputs?: RunAutomationInputs<TriggerBagOf<A>>;
247
+ } : {
248
+ readonly inputs: RunAutomationInputs<TriggerBagOf<A>>;
249
+ });
250
+ /**
251
+ * Run Automation tool (the product-language name; the wire kind is
252
+ * `executeWorkflow`). Inputs/outputs are TYPE-CONSTRAINED by the selected
253
+ * automation's catalog ref: record keys must be its declared trigger
254
+ * parameter / output property names, every REQUIRED parameter must be
255
+ * mapped (a non-optional key), and a required parameter's input must set
256
+ * `required: true`. The agent-facing name defaults to the record key;
257
+ * override with `name:`. `defineAgent().def()` re-validates at runtime.
258
+ *
259
+ * Reference tokens are synthesized from the record keys alone — the factory
260
+ * never dereferences `automation.trigger`/`outputs`, so agent files load
261
+ * safely against the catalog regen's STUB pass (empty bags). A foreign or
262
+ * hand-written automation token without bags degrades to permissive typing;
263
+ * def() validation skips bag-dependent checks for those.
264
+ *
265
+ * The legacy array surface lives on as {@link agentExecuteWorkflow}.
266
+ */
267
+ export declare function agentRunAutomation<A extends AutomationCatalogRef>(opts: RunAutomationToolV2<A>): AgentTool;
268
+ export interface RunAgentToolV2 extends CommonToolOptions {
269
+ readonly agent: AgentRef;
270
+ readonly workerTaskPrompt: string;
271
+ }
272
+ export declare function agentRunAgent(opts: RunAgentToolV2): AgentTool;
273
+ export interface McpToolV2 extends CommonToolOptions {
274
+ readonly serverUrl: string;
275
+ readonly mcpToolName: string;
276
+ readonly headers?: readonly AgentMcpHeader[];
277
+ }
278
+ export declare function agentMcp(opts: McpToolV2): AgentTool;
279
+ export interface SelectBotRouteToolV2 extends CommonToolOptions {
280
+ /** Bot route target id. Bots aren't modeled in the catalog yet — raw id. */
281
+ readonly botId: string;
282
+ }
283
+ export declare function agentSelectBotRoute(opts: SelectBotRouteToolV2): AgentTool;
284
+ export {};
@@ -0,0 +1,238 @@
1
+ import { isValidToolName } from "../agent-tool/types.js";
2
+ /**
3
+ * Hydra hard-codes the execute-workflow timeout to PT10M and ignores any other
4
+ * value; mirror v1 so pull→edit→redeploy round-trips stay stable.
5
+ */
6
+ const EXECUTE_WORKFLOW_TIMEOUT = "PT10M";
7
+ function common(opts) {
8
+ // Authoring-layer name check (mirrors defineApp's handle/namespace guards).
9
+ // Every tool factory routes through here, so this is the single enforcement
10
+ // point — the tf passes never re-check.
11
+ if (!isValidToolName(opts.name)) {
12
+ throw new Error(`agent tool name "${opts.name}" must be 1–64 characters of letters, digits, and ` +
13
+ `underscores (A–Z, a–z, 0–9, _) with no consecutive underscores — no hyphens or spaces.`);
14
+ }
15
+ return {
16
+ name: opts.name,
17
+ description: opts.description,
18
+ ...(opts.startMessage !== undefined ? { startMessage: opts.startMessage } : {}),
19
+ ...(opts.runAs !== undefined ? { runAs: opts.runAs } : {}),
20
+ };
21
+ }
22
+ function searchFieldToken(f) {
23
+ if ("fieldId" in f) {
24
+ // Raw platform id fallback — see AgentSearchRawIdField's comment.
25
+ return {
26
+ fieldId: f.fieldId,
27
+ ...(f.name !== undefined ? { name: f.name } : {}),
28
+ description: f.description,
29
+ };
30
+ }
31
+ // Provider requires `name` on every tool field — default to the field's
32
+ // display name when the author omits an override. `description` is required
33
+ // on the authoring type and always emitted.
34
+ return {
35
+ fieldId: f.field, // token → resolved to the field id at deploy
36
+ clientHandle: f.field, // token → resolved to the field clientHandle at deploy
37
+ name: f.name ?? f.field.name,
38
+ description: f.description,
39
+ };
40
+ }
41
+ function searchTableFieldToken(f) {
42
+ return {
43
+ fieldId: f.fieldId, // raw platform id - not a catalog token, see AgentSearchTableField's comment
44
+ ...(f.name !== undefined ? { name: f.name } : {}),
45
+ ...(f.description !== undefined ? { description: f.description } : {}),
46
+ };
47
+ }
48
+ function returnFieldToken(f) {
49
+ return {
50
+ fieldId: f.fieldId, // raw platform id - not a catalog token, see AgentSearchReturnField's comment
51
+ ...(f.name !== undefined ? { name: f.name } : {}),
52
+ ...(f.displayName !== undefined ? { displayName: f.displayName } : {}),
53
+ };
54
+ }
55
+ function recordFieldToken(f) {
56
+ if ("fieldId" in f) {
57
+ // Raw platform id fallback — see AgentRecordRawIdField's comment.
58
+ return {
59
+ fieldId: f.fieldId,
60
+ ...(f.name !== undefined ? { name: f.name } : {}),
61
+ description: f.description,
62
+ ...(f.required !== undefined ? { required: f.required } : {}),
63
+ };
64
+ }
65
+ // Provider requires `name` on every tool field — default to the field's
66
+ // display name when the author omits an override. `description` is required
67
+ // on the authoring type and always emitted.
68
+ return {
69
+ fieldId: f.field,
70
+ clientHandle: f.field,
71
+ name: f.name ?? f.field.name,
72
+ description: f.description,
73
+ ...(f.required !== undefined ? { required: f.required } : {}),
74
+ ...(f.defaultValue !== undefined ? { defaultValue: f.defaultValue } : {}),
75
+ };
76
+ }
77
+ export function agentSearchAspect(opts) {
78
+ return {
79
+ searchAspect: {
80
+ ...common(opts),
81
+ aspectId: opts.aspect,
82
+ queryDescription: opts.queryDescription,
83
+ ...(opts.fields !== undefined ? { fields: opts.fields.map(searchFieldToken) } : {}),
84
+ ...(opts.filter !== undefined ? { filter: opts.filter } : {}),
85
+ ...(opts.sort !== undefined ? { sort: opts.sort } : {}),
86
+ ...(opts.limit !== undefined ? { limit: opts.limit } : {}),
87
+ },
88
+ };
89
+ }
90
+ export function agentSearchTable(opts) {
91
+ return {
92
+ searchTable: {
93
+ ...common(opts),
94
+ ...(opts.aspect !== undefined ? { aspectId: opts.aspect } : {}),
95
+ searchTableId: opts.table,
96
+ queryDescription: opts.queryDescription,
97
+ // Distinct wire key from every other tool's `fields` (which carries
98
+ // FieldRef tokens) - searchTable's own field/returnField shapes carry
99
+ // raw platform ids instead, see AgentSearchTableField's comment.
100
+ ...(opts.fields !== undefined ? { searchTableFields: opts.fields.map(searchTableFieldToken) } : {}),
101
+ ...(opts.returnFields !== undefined ? { returnFields: opts.returnFields.map(returnFieldToken) } : {}),
102
+ ...(opts.filter !== undefined ? { filter: opts.filter } : {}),
103
+ ...(opts.limit !== undefined ? { limit: opts.limit } : {}),
104
+ },
105
+ };
106
+ }
107
+ export function agentCreateRecord(opts) {
108
+ return {
109
+ createRecord: {
110
+ ...common(opts),
111
+ aspectId: opts.aspect,
112
+ ...(opts.fields !== undefined ? { fields: opts.fields.map(recordFieldToken) } : {}),
113
+ },
114
+ };
115
+ }
116
+ export function agentUpdateRecord(opts) {
117
+ return {
118
+ updateRecord: {
119
+ ...common(opts),
120
+ aspectId: opts.aspect,
121
+ ...(opts.fields !== undefined ? { fields: opts.fields.map(recordFieldToken) } : {}),
122
+ handleDescription: opts.handleDescription,
123
+ },
124
+ };
125
+ }
126
+ export function agentRelateRecord(opts) {
127
+ return {
128
+ relateRecord: {
129
+ ...common(opts),
130
+ aspectId: opts.aspect,
131
+ relatedAspectId: opts.relatedAspect,
132
+ },
133
+ };
134
+ }
135
+ export function agentExecuteWorkflow(opts) {
136
+ return {
137
+ executeWorkflow: {
138
+ ...common(opts),
139
+ automationId: opts.automation,
140
+ timeout: EXECUTE_WORKFLOW_TIMEOUT,
141
+ ...(opts.inputs !== undefined
142
+ ? {
143
+ // The ref stays in the id slot for `resolvePayload` to swap for the
144
+ // current-version param id at deploy.
145
+ inputs: opts.inputs.map((i) => ({
146
+ name: i.name,
147
+ description: i.description,
148
+ triggerParameterId: i.triggerParameter,
149
+ ...(i.required !== undefined ? { required: i.required } : {}),
150
+ })),
151
+ }
152
+ : {}),
153
+ ...(opts.outputs !== undefined
154
+ ? {
155
+ // One ref fans out: the property name is read off the ref now; the id
156
+ // slot keeps the ref for `resolvePayload` to resolve at deploy.
157
+ outputs: opts.outputs.map((o) => ({
158
+ name: o.name,
159
+ workflowPropertyName: o.workflowOutputProperty.name,
160
+ workflowOutputPropertyId: o.workflowOutputProperty,
161
+ })),
162
+ }
163
+ : {}),
164
+ },
165
+ };
166
+ }
167
+ /**
168
+ * Run Automation tool (the product-language name; the wire kind is
169
+ * `executeWorkflow`). Inputs/outputs are TYPE-CONSTRAINED by the selected
170
+ * automation's catalog ref: record keys must be its declared trigger
171
+ * parameter / output property names, every REQUIRED parameter must be
172
+ * mapped (a non-optional key), and a required parameter's input must set
173
+ * `required: true`. The agent-facing name defaults to the record key;
174
+ * override with `name:`. `defineAgent().def()` re-validates at runtime.
175
+ *
176
+ * Reference tokens are synthesized from the record keys alone — the factory
177
+ * never dereferences `automation.trigger`/`outputs`, so agent files load
178
+ * safely against the catalog regen's STUB pass (empty bags). A foreign or
179
+ * hand-written automation token without bags degrades to permissive typing;
180
+ * def() validation skips bag-dependent checks for those.
181
+ *
182
+ * The legacy array surface lives on as {@link agentExecuteWorkflow}.
183
+ */
184
+ export function agentRunAutomation(opts) {
185
+ const inputEntries = Object.entries((opts.inputs ?? {}));
186
+ const inputs = inputEntries.map(([param, spec]) => ({
187
+ name: spec.name ?? param,
188
+ description: spec.description,
189
+ // Synthesized from the record key — identical slim form to a catalog
190
+ // trigger-bag token (refName = name = param, parent = automation ref).
191
+ triggerParameterId: { __kind: "triggerParameter", refName: param, name: param, parent: opts.automation.refName },
192
+ ...(spec.required !== undefined ? { required: spec.required } : {}),
193
+ }));
194
+ const outputEntries = Object.entries((opts.outputs ?? {}));
195
+ const outputs = outputEntries.map(([prop, spec]) => ({
196
+ name: spec?.name ?? prop,
197
+ workflowPropertyName: prop,
198
+ workflowOutputPropertyId: { __kind: "outputProperty", refName: prop, name: prop, parent: opts.automation.refName },
199
+ }));
200
+ return {
201
+ executeWorkflow: {
202
+ ...common(opts),
203
+ automationId: opts.automation,
204
+ timeout: EXECUTE_WORKFLOW_TIMEOUT,
205
+ ...(inputs.length > 0 ? { inputs } : {}),
206
+ ...(outputs.length > 0 ? { outputs } : {}),
207
+ },
208
+ };
209
+ }
210
+ export function agentRunAgent(opts) {
211
+ return {
212
+ runAgent: {
213
+ ...common(opts),
214
+ targetAgentId: opts.agent,
215
+ workerTaskPrompt: opts.workerTaskPrompt,
216
+ },
217
+ };
218
+ }
219
+ export function agentMcp(opts) {
220
+ return {
221
+ mcp: {
222
+ ...common(opts),
223
+ serverUrl: opts.serverUrl,
224
+ mcpToolName: opts.mcpToolName,
225
+ ...(opts.headers !== undefined
226
+ ? { headers: opts.headers.map((h) => ({ key: h.key, value: h.value })) }
227
+ : {}),
228
+ },
229
+ };
230
+ }
231
+ export function agentSelectBotRoute(opts) {
232
+ return {
233
+ selectBotRoute: {
234
+ ...common(opts),
235
+ botId: opts.botId,
236
+ },
237
+ };
238
+ }
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Agent-tool extraction (M3): one `elementum_agent_*_tool` block → the
3
+ * normalized shape the agent printer consumes. The owning agent's from-tf
4
+ * drives the pass and says who the owners are — this module never names the
5
+ * agent or app resource types.
6
+ */
7
+ import { type FromTfContext } from "../../engine/pull/context.js";
8
+ import { type TfBlock } from "../../engine/tf/index.js";
9
+ export interface NormalizedToolField {
10
+ /** The field's bag key in the TARGET aspect's `fields: {}` (bijective image of its label). Mutually exclusive with `rawFieldId`. */
11
+ readonly key?: string;
12
+ /**
13
+ * Raw platform field id — board issue #169. When the tool's target is a
14
+ * foreign/out-of-scope aspect (not recursively exported), ei has no field
15
+ * resource to reference and falls back to a bare id, same convention as
16
+ * `NormalizedAgentTool.searchTableId`. Mutually exclusive with `key`;
17
+ * exactly one is always set.
18
+ */
19
+ readonly rawFieldId?: string;
20
+ readonly name?: string;
21
+ readonly description?: string;
22
+ readonly required?: boolean;
23
+ }
24
+ /**
25
+ * searchTable's own field shapes. Unlike createRecord/searchAspect/
26
+ * updateRecord, field_id here is NEVER a resource reference — confirmed
27
+ * live, 161/161 field_id values across every real elementum_agent_ai_search_tool
28
+ * capture are raw strings. These describe columns of the search table's own
29
+ * schema, not app/element fields, so there's no `elementum_*_field` resource
30
+ * (and therefore no catalog bag key) to resolve them to.
31
+ */
32
+ export interface NormalizedSearchTableField {
33
+ readonly fieldId: string;
34
+ readonly name?: string;
35
+ readonly description?: string;
36
+ }
37
+ /** searchTable's legacy return_fields shape (field_id/name/display_name) — no description, no required. */
38
+ export interface NormalizedSearchTableReturnField {
39
+ readonly fieldId: string;
40
+ readonly name?: string;
41
+ readonly displayName?: string;
42
+ }
43
+ export type NormalizedToolTarget = {
44
+ readonly kind: "self";
45
+ } | {
46
+ /** A foreign app via `data.elementum_app.<label>` — `name` from the stream's data block. */
47
+ readonly kind: "foreignApp";
48
+ readonly name: string;
49
+ } | {
50
+ /** A foreign ELEMENT via `data.elementum_element.<label>` — `name` from the stream's data block (board issue #42). */
51
+ readonly kind: "foreignElement";
52
+ readonly name: string;
53
+ };
54
+ export interface NormalizedExecuteWorkflowInput {
55
+ /** The published workflow's declared trigger parameter name. */
56
+ readonly parameterName: string;
57
+ readonly name?: string;
58
+ readonly description?: string;
59
+ readonly required?: boolean;
60
+ }
61
+ export interface NormalizedExecuteWorkflowOutput {
62
+ /** The published workflow's output property name. */
63
+ readonly workflowPropertyName: string;
64
+ readonly name?: string;
65
+ readonly description?: string;
66
+ }
67
+ export interface NormalizedAgentTool {
68
+ readonly typeKey: "createRecord" | "searchAspect" | "updateRecord" | "executeWorkflow" | "searchTable";
69
+ readonly name: string;
70
+ readonly description: string;
71
+ readonly startMessage?: string;
72
+ /** absent for executeWorkflow — its target is an automation, not an aspect. searchTable's target is also optional. */
73
+ readonly target?: NormalizedToolTarget;
74
+ /** createRecord/searchAspect/updateRecord only — searchTable's own field shapes never resolve to a catalog key, see below. */
75
+ readonly fields?: readonly NormalizedToolField[];
76
+ /** searchTable's newer field shape (field_id/name/description) — mutually exclusive with `returnFields`. */
77
+ readonly searchTableFields?: readonly NormalizedSearchTableField[];
78
+ /** searchTable's legacy field shape (field_id/name/display_name) — mutually exclusive with `searchTableFields`. */
79
+ readonly returnFields?: readonly NormalizedSearchTableReturnField[];
80
+ readonly queryDescription?: string;
81
+ readonly limit?: number;
82
+ /** updateRecord: how the agent should identify the record to update. */
83
+ readonly handleDescription?: string;
84
+ /** executeWorkflow: the target automation's bag key (bijective image of its tf label). */
85
+ readonly automationKey?: string;
86
+ readonly inputs?: readonly NormalizedExecuteWorkflowInput[];
87
+ readonly outputs?: readonly NormalizedExecuteWorkflowOutput[];
88
+ /**
89
+ * searchTable's search_table_id. Always a raw platform id on the wire —
90
+ * confirmed live, ei's own export never resolves it to a reference (it
91
+ * writes a bare id with a "# TODO: Replace with data source or variable"
92
+ * comment), so there is no data-source lookup to reconstruct here.
93
+ */
94
+ readonly searchTableId?: string;
95
+ }
96
+ export interface ToolOwner {
97
+ /** The owning app's resource type + tfLabel. */
98
+ readonly appType: string;
99
+ readonly appLabel: string;
100
+ /** Namespace tf label for stripping `apps_<ns>_` child labels. */
101
+ readonly ownerTfLabel: string;
102
+ /** The owning agent's resource type + tfLabel. */
103
+ readonly agentType: string;
104
+ readonly agentLabel: string;
105
+ }
106
+ /**
107
+ * One tool block → its normalized shape; undefined = skipped with a
108
+ * diagnostic (unimplemented sub-type, wrong owner, unresolvable target).
109
+ */
110
+ export declare function toolFromTf(block: TfBlock, owner: ToolOwner, ctx: FromTfContext): NormalizedAgentTool | undefined;