@elementumai/edk 0.0.0-oidc-bootstrap → 0.8.0-preview.11

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 (360) hide show
  1. package/README.md +408 -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/factories.d.ts +189 -0
  47. package/dist-sdk/src/catalog/factories.js +202 -0
  48. package/dist-sdk/src/catalog/from-authoring.d.ts +103 -0
  49. package/dist-sdk/src/catalog/from-authoring.js +462 -0
  50. package/dist-sdk/src/catalog/index.d.ts +11 -0
  51. package/dist-sdk/src/catalog/index.js +11 -0
  52. package/dist-sdk/src/catalog/org.d.ts +11 -0
  53. package/dist-sdk/src/catalog/org.js +211 -0
  54. package/dist-sdk/src/catalog/render-helpers.d.ts +35 -0
  55. package/dist-sdk/src/catalog/render-helpers.js +82 -0
  56. package/dist-sdk/src/catalog/render.d.ts +36 -0
  57. package/dist-sdk/src/catalog/render.js +176 -0
  58. package/dist-sdk/src/catalog/token.d.ts +10 -0
  59. package/dist-sdk/src/catalog/token.js +62 -0
  60. package/dist-sdk/src/catalog/types.d.ts +158 -0
  61. package/dist-sdk/src/catalog/types.js +83 -0
  62. package/dist-sdk/src/catalog/write.d.ts +43 -0
  63. package/dist-sdk/src/catalog/write.js +109 -0
  64. package/dist-sdk/src/core/app-to-ui.d.ts +22 -0
  65. package/dist-sdk/src/core/app-to-ui.js +75 -0
  66. package/dist-sdk/src/core/index.d.ts +10 -0
  67. package/dist-sdk/src/core/index.js +9 -0
  68. package/dist-sdk/src/core/system-fields.d.ts +93 -0
  69. package/dist-sdk/src/core/system-fields.js +151 -0
  70. package/dist-sdk/src/core/triggers/on-demand.d.ts +144 -0
  71. package/dist-sdk/src/core/triggers/on-demand.js +112 -0
  72. package/dist-sdk/src/core/types/ai-provider.d.ts +36 -0
  73. package/dist-sdk/src/core/types/ai-provider.js +32 -0
  74. package/dist-sdk/src/core/types/app.d.ts +838 -0
  75. package/dist-sdk/src/core/types/app.js +210 -0
  76. package/dist-sdk/src/core/types/aspect-category.d.ts +35 -0
  77. package/dist-sdk/src/core/types/aspect-category.js +33 -0
  78. package/dist-sdk/src/core/types/cloud-link.d.ts +34 -0
  79. package/dist-sdk/src/core/types/cloud-link.js +32 -0
  80. package/dist-sdk/src/core/types/display-block.d.ts +149 -0
  81. package/dist-sdk/src/core/types/display-block.js +61 -0
  82. package/dist-sdk/src/core/types/group.d.ts +13 -0
  83. package/dist-sdk/src/core/types/group.js +6 -0
  84. package/dist-sdk/src/core/types/platform.d.ts +2 -0
  85. package/dist-sdk/src/core/types/platform.js +1 -0
  86. package/dist-sdk/src/core/types/user.d.ts +20 -0
  87. package/dist-sdk/src/core/types/user.js +8 -0
  88. package/dist-sdk/src/core/wire/ref-serializer.d.ts +45 -0
  89. package/dist-sdk/src/core/wire/ref-serializer.js +89 -0
  90. package/dist-sdk/src/engine/build/context.d.ts +49 -0
  91. package/dist-sdk/src/engine/build/context.js +6 -0
  92. package/dist-sdk/src/engine/entity.d.ts +44 -0
  93. package/dist-sdk/src/engine/entity.js +15 -0
  94. package/dist-sdk/src/engine/pull/context.d.ts +23 -0
  95. package/dist-sdk/src/engine/pull/context.js +44 -0
  96. package/dist-sdk/src/engine/pull/org.d.ts +44 -0
  97. package/dist-sdk/src/engine/pull/org.js +104 -0
  98. package/dist-sdk/src/engine/tf/escape.d.ts +22 -0
  99. package/dist-sdk/src/engine/tf/escape.js +28 -0
  100. package/dist-sdk/src/engine/tf/expr.d.ts +25 -0
  101. package/dist-sdk/src/engine/tf/expr.js +405 -0
  102. package/dist-sdk/src/engine/tf/index.d.ts +12 -0
  103. package/dist-sdk/src/engine/tf/index.js +11 -0
  104. package/dist-sdk/src/engine/tf/labels.d.ts +31 -0
  105. package/dist-sdk/src/engine/tf/labels.js +125 -0
  106. package/dist-sdk/src/engine/tf/model.d.ts +84 -0
  107. package/dist-sdk/src/engine/tf/model.js +49 -0
  108. package/dist-sdk/src/engine/tf/parse.d.ts +41 -0
  109. package/dist-sdk/src/engine/tf/parse.js +189 -0
  110. package/dist-sdk/src/engine/tf/render.d.ts +13 -0
  111. package/dist-sdk/src/engine/tf/render.js +102 -0
  112. package/dist-sdk/src/engine/workspace/authoring-layout.d.ts +43 -0
  113. package/dist-sdk/src/engine/workspace/authoring-layout.js +201 -0
  114. package/dist-sdk/src/entities/agent/build.d.ts +108 -0
  115. package/dist-sdk/src/entities/agent/build.js +148 -0
  116. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +18 -0
  117. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +177 -0
  118. package/dist-sdk/src/entities/agent/from-tf.d.ts +50 -0
  119. package/dist-sdk/src/entities/agent/from-tf.js +169 -0
  120. package/dist-sdk/src/entities/agent/index.d.ts +7 -0
  121. package/dist-sdk/src/entities/agent/index.js +7 -0
  122. package/dist-sdk/src/entities/agent/module.d.ts +4 -0
  123. package/dist-sdk/src/entities/agent/module.js +116 -0
  124. package/dist-sdk/src/entities/agent/to-tf.d.ts +33 -0
  125. package/dist-sdk/src/entities/agent/to-tf.js +136 -0
  126. package/dist-sdk/src/entities/agent/tools.d.ts +205 -0
  127. package/dist-sdk/src/entities/agent/tools.js +199 -0
  128. package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +63 -0
  129. package/dist-sdk/src/entities/agent-tool/from-tf.js +169 -0
  130. package/dist-sdk/src/entities/agent-tool/module.d.ts +3 -0
  131. package/dist-sdk/src/entities/agent-tool/module.js +32 -0
  132. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +38 -0
  133. package/dist-sdk/src/entities/agent-tool/to-tf.js +164 -0
  134. package/dist-sdk/src/entities/agent-tool/types.d.ts +42 -0
  135. package/dist-sdk/src/entities/agent-tool/types.js +70 -0
  136. package/dist-sdk/src/entities/app/build.d.ts +318 -0
  137. package/dist-sdk/src/entities/app/build.js +325 -0
  138. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +165 -0
  139. package/dist-sdk/src/entities/app/deserializer/normalize.js +12 -0
  140. package/dist-sdk/src/entities/app/display-blocks.d.ts +26 -0
  141. package/dist-sdk/src/entities/app/display-blocks.js +34 -0
  142. package/dist-sdk/src/entities/app/from-tf.d.ts +23 -0
  143. package/dist-sdk/src/entities/app/from-tf.js +180 -0
  144. package/dist-sdk/src/entities/app/index.d.ts +11 -0
  145. package/dist-sdk/src/entities/app/index.js +10 -0
  146. package/dist-sdk/src/entities/app/locals.d.ts +11 -0
  147. package/dist-sdk/src/entities/app/locals.js +31 -0
  148. package/dist-sdk/src/entities/app/module.d.ts +4 -0
  149. package/dist-sdk/src/entities/app/module.js +59 -0
  150. package/dist-sdk/src/entities/app/to-tf.d.ts +28 -0
  151. package/dist-sdk/src/entities/app/to-tf.js +183 -0
  152. package/dist-sdk/src/entities/approval-chain/build.d.ts +24 -0
  153. package/dist-sdk/src/entities/approval-chain/build.js +56 -0
  154. package/dist-sdk/src/entities/approval-chain/index.d.ts +6 -0
  155. package/dist-sdk/src/entities/approval-chain/index.js +6 -0
  156. package/dist-sdk/src/entities/approval-chain/steps.d.ts +24 -0
  157. package/dist-sdk/src/entities/approval-chain/steps.js +20 -0
  158. package/dist-sdk/src/entities/automation/build.d.ts +215 -0
  159. package/dist-sdk/src/entities/automation/build.js +424 -0
  160. package/dist-sdk/src/entities/automation/catalog-render.d.ts +5 -0
  161. package/dist-sdk/src/entities/automation/catalog-render.js +35 -0
  162. package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +135 -0
  163. package/dist-sdk/src/entities/automation/deserializer/ast.js +13 -0
  164. package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +40 -0
  165. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +1040 -0
  166. package/dist-sdk/src/entities/automation/filter.d.ts +81 -0
  167. package/dist-sdk/src/entities/automation/filter.js +146 -0
  168. package/dist-sdk/src/entities/automation/from-tf.d.ts +36 -0
  169. package/dist-sdk/src/entities/automation/from-tf.js +252 -0
  170. package/dist-sdk/src/entities/automation/index.d.ts +18 -0
  171. package/dist-sdk/src/entities/automation/index.js +21 -0
  172. package/dist-sdk/src/entities/automation/module.d.ts +3 -0
  173. package/dist-sdk/src/entities/automation/module.js +153 -0
  174. package/dist-sdk/src/entities/automation/operators.d.ts +66 -0
  175. package/dist-sdk/src/entities/automation/operators.js +43 -0
  176. package/dist-sdk/src/entities/automation/script-code.d.ts +62 -0
  177. package/dist-sdk/src/entities/automation/script-code.js +366 -0
  178. package/dist-sdk/src/entities/automation/serialize.d.ts +6 -0
  179. package/dist-sdk/src/entities/automation/serialize.js +41 -0
  180. package/dist-sdk/src/entities/automation/tasks.d.ts +535 -0
  181. package/dist-sdk/src/entities/automation/tasks.js +697 -0
  182. package/dist-sdk/src/entities/automation/to-tf.d.ts +38 -0
  183. package/dist-sdk/src/entities/automation/to-tf.js +266 -0
  184. package/dist-sdk/src/entities/automation/triggers.d.ts +197 -0
  185. package/dist-sdk/src/entities/automation/triggers.js +202 -0
  186. package/dist-sdk/src/entities/automation/types.d.ts +53 -0
  187. package/dist-sdk/src/entities/automation/types.js +101 -0
  188. package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +76 -0
  189. package/dist-sdk/src/entities/automation/value-ref-tf.js +190 -0
  190. package/dist-sdk/src/entities/element/build.d.ts +108 -0
  191. package/dist-sdk/src/entities/element/build.js +109 -0
  192. package/dist-sdk/src/entities/element/from-tf.d.ts +19 -0
  193. package/dist-sdk/src/entities/element/from-tf.js +155 -0
  194. package/dist-sdk/src/entities/element/index.d.ts +9 -0
  195. package/dist-sdk/src/entities/element/index.js +9 -0
  196. package/dist-sdk/src/entities/element/locals.d.ts +7 -0
  197. package/dist-sdk/src/entities/element/locals.js +12 -0
  198. package/dist-sdk/src/entities/element/module.d.ts +8 -0
  199. package/dist-sdk/src/entities/element/module.js +63 -0
  200. package/dist-sdk/src/entities/element/to-tf.d.ts +14 -0
  201. package/dist-sdk/src/entities/element/to-tf.js +151 -0
  202. package/dist-sdk/src/entities/field/build.d.ts +69 -0
  203. package/dist-sdk/src/entities/field/build.js +74 -0
  204. package/dist-sdk/src/entities/field/calc/aggregate.d.ts +60 -0
  205. package/dist-sdk/src/entities/field/calc/aggregate.js +71 -0
  206. package/dist-sdk/src/entities/field/calc/date.d.ts +73 -0
  207. package/dist-sdk/src/entities/field/calc/date.js +109 -0
  208. package/dist-sdk/src/entities/field/calc/index.d.ts +229 -0
  209. package/dist-sdk/src/entities/field/calc/index.js +433 -0
  210. package/dist-sdk/src/entities/field/calc/numeric.d.ts +22 -0
  211. package/dist-sdk/src/entities/field/calc/numeric.js +67 -0
  212. package/dist-sdk/src/entities/field/calc/runtime.d.ts +61 -0
  213. package/dist-sdk/src/entities/field/calc/runtime.js +170 -0
  214. package/dist-sdk/src/entities/field/calc/text.d.ts +100 -0
  215. package/dist-sdk/src/entities/field/calc/text.js +208 -0
  216. package/dist-sdk/src/entities/field/calc/types.d.ts +86 -0
  217. package/dist-sdk/src/entities/field/calc/types.js +23 -0
  218. package/dist-sdk/src/entities/field/calc.d.ts +108 -0
  219. package/dist-sdk/src/entities/field/calc.js +54 -0
  220. package/dist-sdk/src/entities/field/from-tf.d.ts +29 -0
  221. package/dist-sdk/src/entities/field/from-tf.js +73 -0
  222. package/dist-sdk/src/entities/field/locals.d.ts +8 -0
  223. package/dist-sdk/src/entities/field/locals.js +24 -0
  224. package/dist-sdk/src/entities/field/module.d.ts +3 -0
  225. package/dist-sdk/src/entities/field/module.js +49 -0
  226. package/dist-sdk/src/entities/field/options.d.ts +27 -0
  227. package/dist-sdk/src/entities/field/options.js +76 -0
  228. package/dist-sdk/src/entities/field/record-shape.d.ts +57 -0
  229. package/dist-sdk/src/entities/field/record-shape.js +1 -0
  230. package/dist-sdk/src/entities/field/to-tf.d.ts +55 -0
  231. package/dist-sdk/src/entities/field/to-tf.js +97 -0
  232. package/dist-sdk/src/entities/field/types.d.ts +27 -0
  233. package/dist-sdk/src/entities/field/types.js +46 -0
  234. package/dist-sdk/src/entities/file-reader/build.d.ts +124 -0
  235. package/dist-sdk/src/entities/file-reader/build.js +105 -0
  236. package/dist-sdk/src/entities/file-reader/index.d.ts +5 -0
  237. package/dist-sdk/src/entities/file-reader/index.js +5 -0
  238. package/dist-sdk/src/entities/flow/activities/agent.d.ts +15 -0
  239. package/dist-sdk/src/entities/flow/activities/agent.js +29 -0
  240. package/dist-sdk/src/entities/flow/activities/approval.d.ts +9 -0
  241. package/dist-sdk/src/entities/flow/activities/approval.js +18 -0
  242. package/dist-sdk/src/entities/flow/activities/automation.d.ts +12 -0
  243. package/dist-sdk/src/entities/flow/activities/automation.js +22 -0
  244. package/dist-sdk/src/entities/flow/activities/ctx.d.ts +34 -0
  245. package/dist-sdk/src/entities/flow/activities/ctx.js +38 -0
  246. package/dist-sdk/src/entities/flow/activities/form.d.ts +22 -0
  247. package/dist-sdk/src/entities/flow/activities/form.js +36 -0
  248. package/dist-sdk/src/entities/flow/activities/index.d.ts +14 -0
  249. package/dist-sdk/src/entities/flow/activities/index.js +13 -0
  250. package/dist-sdk/src/entities/flow/activities/input-refs.d.ts +39 -0
  251. package/dist-sdk/src/entities/flow/activities/input-refs.js +19 -0
  252. package/dist-sdk/src/entities/flow/activities/prompt-template.d.ts +13 -0
  253. package/dist-sdk/src/entities/flow/activities/prompt-template.js +34 -0
  254. package/dist-sdk/src/entities/flow/activities/render-catalog.d.ts +140 -0
  255. package/dist-sdk/src/entities/flow/activities/render-catalog.js +174 -0
  256. package/dist-sdk/src/entities/flow/activities/types.d.ts +33 -0
  257. package/dist-sdk/src/entities/flow/activities/types.js +1 -0
  258. package/dist-sdk/src/entities/flow/build.d.ts +38 -0
  259. package/dist-sdk/src/entities/flow/build.js +115 -0
  260. package/dist-sdk/src/entities/flow/index.d.ts +8 -0
  261. package/dist-sdk/src/entities/flow/index.js +7 -0
  262. package/dist-sdk/src/entities/flow/serialize.d.ts +51 -0
  263. package/dist-sdk/src/entities/flow/serialize.js +94 -0
  264. package/dist-sdk/src/entities/flow/util.d.ts +27 -0
  265. package/dist-sdk/src/entities/flow/util.js +38 -0
  266. package/dist-sdk/src/entities/org/category.d.ts +5 -0
  267. package/dist-sdk/src/entities/org/category.js +33 -0
  268. package/dist-sdk/src/entities/org/cloud-link.d.ts +5 -0
  269. package/dist-sdk/src/entities/org/cloud-link.js +33 -0
  270. package/dist-sdk/src/entities/org/connector.d.ts +5 -0
  271. package/dist-sdk/src/entities/org/connector.js +37 -0
  272. package/dist-sdk/src/entities/org/group.d.ts +5 -0
  273. package/dist-sdk/src/entities/org/group.js +31 -0
  274. package/dist-sdk/src/entities/org/index.d.ts +10 -0
  275. package/dist-sdk/src/entities/org/index.js +10 -0
  276. package/dist-sdk/src/entities/org/role.d.ts +7 -0
  277. package/dist-sdk/src/entities/org/role.js +21 -0
  278. package/dist-sdk/src/entities/org/user.d.ts +7 -0
  279. package/dist-sdk/src/entities/org/user.js +21 -0
  280. package/dist-sdk/src/entities/search-table/build.d.ts +41 -0
  281. package/dist-sdk/src/entities/search-table/build.js +79 -0
  282. package/dist-sdk/src/entities/search-table/index.d.ts +5 -0
  283. package/dist-sdk/src/entities/search-table/index.js +5 -0
  284. package/dist-sdk/src/entities/search-table/module.d.ts +6 -0
  285. package/dist-sdk/src/entities/search-table/module.js +64 -0
  286. package/dist-sdk/src/entities/shared/context.d.ts +93 -0
  287. package/dist-sdk/src/entities/shared/context.js +156 -0
  288. package/dist-sdk/src/entities/shared/filters/ast.d.ts +242 -0
  289. package/dist-sdk/src/entities/shared/filters/ast.js +65 -0
  290. package/dist-sdk/src/entities/shared/filters/index.d.ts +211 -0
  291. package/dist-sdk/src/entities/shared/filters/index.js +372 -0
  292. package/dist-sdk/src/entities/shared/filters/types.d.ts +170 -0
  293. package/dist-sdk/src/entities/shared/filters/types.js +7 -0
  294. package/dist-sdk/src/entities/shared/ref.d.ts +160 -0
  295. package/dist-sdk/src/entities/shared/ref.js +119 -0
  296. package/dist-sdk/src/entities/shared/types/common.d.ts +106 -0
  297. package/dist-sdk/src/entities/shared/types/common.js +64 -0
  298. package/dist-sdk/src/entities/shared/types/field-types.d.ts +49 -0
  299. package/dist-sdk/src/entities/shared/types/field-types.js +48 -0
  300. package/dist-sdk/src/entities/shared/types/platform.d.ts +46 -0
  301. package/dist-sdk/src/entities/shared/types/platform.js +10 -0
  302. package/dist-sdk/src/entities/skill/build.d.ts +25 -0
  303. package/dist-sdk/src/entities/skill/build.js +50 -0
  304. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +20 -0
  305. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +96 -0
  306. package/dist-sdk/src/entities/skill/from-tf.d.ts +33 -0
  307. package/dist-sdk/src/entities/skill/from-tf.js +95 -0
  308. package/dist-sdk/src/entities/skill/index.d.ts +7 -0
  309. package/dist-sdk/src/entities/skill/index.js +7 -0
  310. package/dist-sdk/src/entities/skill/module.d.ts +4 -0
  311. package/dist-sdk/src/entities/skill/module.js +106 -0
  312. package/dist-sdk/src/entities/skill/to-tf.d.ts +33 -0
  313. package/dist-sdk/src/entities/skill/to-tf.js +58 -0
  314. package/dist-sdk/src/entities/skill/tools.d.ts +71 -0
  315. package/dist-sdk/src/entities/skill/tools.js +88 -0
  316. package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +47 -0
  317. package/dist-sdk/src/entities/skill-tool/from-tf.js +121 -0
  318. package/dist-sdk/src/entities/skill-tool/module.d.ts +3 -0
  319. package/dist-sdk/src/entities/skill-tool/module.js +21 -0
  320. package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +32 -0
  321. package/dist-sdk/src/entities/skill-tool/to-tf.js +107 -0
  322. package/dist-sdk/src/entities/skill-tool/types.d.ts +40 -0
  323. package/dist-sdk/src/entities/skill-tool/types.js +67 -0
  324. package/dist-sdk/src/entities/table/build.d.ts +74 -0
  325. package/dist-sdk/src/entities/table/build.js +339 -0
  326. package/dist-sdk/src/entities/table/catalog-render.d.ts +5 -0
  327. package/dist-sdk/src/entities/table/catalog-render.js +39 -0
  328. package/dist-sdk/src/entities/table/fields.d.ts +81 -0
  329. package/dist-sdk/src/entities/table/fields.js +70 -0
  330. package/dist-sdk/src/entities/table/filter.d.ts +41 -0
  331. package/dist-sdk/src/entities/table/filter.js +89 -0
  332. package/dist-sdk/src/entities/table/index.d.ts +8 -0
  333. package/dist-sdk/src/entities/table/index.js +12 -0
  334. package/dist-sdk/src/entities/table/joins.d.ts +26 -0
  335. package/dist-sdk/src/entities/table/joins.js +31 -0
  336. package/dist-sdk/src/entities/table/keys.d.ts +11 -0
  337. package/dist-sdk/src/entities/table/keys.js +25 -0
  338. package/dist-sdk/src/entities/table/module.d.ts +5 -0
  339. package/dist-sdk/src/entities/table/module.js +25 -0
  340. package/dist-sdk/src/entities/table/state.d.ts +39 -0
  341. package/dist-sdk/src/entities/table/state.js +43 -0
  342. package/dist-sdk/src/entities/view/from-tf.d.ts +25 -0
  343. package/dist-sdk/src/entities/view/from-tf.js +233 -0
  344. package/dist-sdk/src/entities/view/module.d.ts +24 -0
  345. package/dist-sdk/src/entities/view/module.js +61 -0
  346. package/dist-sdk/src/entities/view/to-tf.d.ts +63 -0
  347. package/dist-sdk/src/entities/view/to-tf.js +156 -0
  348. package/dist-sdk/src/entities/view/types.d.ts +58 -0
  349. package/dist-sdk/src/entities/view/types.js +89 -0
  350. package/dist-sdk/src/graph/deferred-catalog-render.d.ts +14 -0
  351. package/dist-sdk/src/graph/deferred-catalog-render.js +37 -0
  352. package/dist-sdk/src/graph/index.d.ts +83 -0
  353. package/dist-sdk/src/graph/index.js +207 -0
  354. package/dist-sdk/src/graph/modules.d.ts +7 -0
  355. package/dist-sdk/src/graph/modules.js +37 -0
  356. package/dist-sdk/src/graph/types.d.ts +301 -0
  357. package/dist-sdk/src/graph/types.js +102 -0
  358. package/dist-sdk/src/internal/sdk-package.d.ts +7 -0
  359. package/dist-sdk/src/internal/sdk-package.js +23 -0
  360. package/package.json +173 -8
@@ -0,0 +1,108 @@
1
+ import type { AgentRef, ConnectorRef, SkillRef } from "../../catalog/index.js";
2
+ import type { DeployableEntity, EntityDeployOptions } from "../../engine/entity.js";
3
+ import type { AgentTool, AgentToolRunAs } from "./tools.js";
4
+ /** JWT authentication config (Hydra's `AgentAuthenticationInput`). */
5
+ export interface AgentAuthentication {
6
+ readonly jwt: {
7
+ readonly enabled: boolean;
8
+ readonly headerName: string;
9
+ readonly emailAddressClaimName: string;
10
+ readonly keySource: {
11
+ readonly plainText: {
12
+ readonly plainTextKeyValuePem: string;
13
+ };
14
+ } | {
15
+ readonly jwks: {
16
+ readonly jwksUrl: string;
17
+ };
18
+ };
19
+ readonly requiredClaims?: readonly {
20
+ readonly claimName: string;
21
+ readonly acceptableValues: readonly string[];
22
+ }[];
23
+ };
24
+ }
25
+ /** An A2A skill advertised on the agent's card. */
26
+ export interface A2ASkill {
27
+ readonly name: string;
28
+ readonly description: string;
29
+ readonly tags?: readonly string[];
30
+ readonly examples?: readonly string[];
31
+ readonly inputModes?: readonly string[];
32
+ readonly outputModes?: readonly string[];
33
+ }
34
+ /**
35
+ * Which skills the agent can use. `CUSTOM` requires a non-empty `skills` list at
36
+ * compile time (Hydra enforces the same at runtime). Skills are `SkillRef`
37
+ * tokens, resolved to ids at deploy.
38
+ *
39
+ * `preloadedSkills` (which skills auto-load into context at conversation
40
+ * start) is independent of `mode` — confirmed against the provider's
41
+ * `extractSkillAccessConfig`, which reads `preloaded_skill_ids` unconditionally,
42
+ * with no gating on `mode`. So it's available on every mode, not just CUSTOM
43
+ * (only `skills`/`skill_ids` is CUSTOM-specific, since an explicit accessible-
44
+ * skills list only makes authoring sense when the mode doesn't already imply
45
+ * one).
46
+ */
47
+ export type SkillAccess = {
48
+ readonly mode: "NONE" | "ALL" | "ALL_APP";
49
+ readonly preloadedSkills?: readonly SkillRef[];
50
+ } | {
51
+ readonly mode: "CUSTOM";
52
+ readonly skills: readonly SkillRef[];
53
+ readonly preloadedSkills?: readonly SkillRef[];
54
+ };
55
+ export interface AgentV2Options extends EntityDeployOptions {
56
+ readonly name: string;
57
+ readonly parent: string;
58
+ /** AI provider connector backing the agent (`connectors.<key>`). */
59
+ readonly connector: ConnectorRef;
60
+ readonly description: string;
61
+ readonly instructions: string;
62
+ readonly firstMessage?: string;
63
+ /** Runtime knobs — carried by the REST wire shape; the terraform path drops them (reported). */
64
+ readonly temperature?: number;
65
+ readonly maxLength?: number;
66
+ readonly reasoningEffort?: "minimal" | "low" | "medium" | "high" | "MINIMAL" | "LOW" | "MEDIUM" | "HIGH";
67
+ readonly avatarAttachmentId?: string;
68
+ readonly managedById?: string;
69
+ readonly serviceAccountId?: string;
70
+ readonly runAs?: AgentToolRunAs;
71
+ readonly startingActions?: readonly Record<string, unknown>[];
72
+ readonly a2aStreaming?: boolean;
73
+ readonly conversationIdleTimeout?: string;
74
+ readonly skillAccess?: SkillAccess;
75
+ readonly agentAuthentication?: AgentAuthentication;
76
+ readonly a2aSkills?: readonly A2ASkill[];
77
+ /** Escape hatch for `AgentElementumCreateInput` fields not surfaced yet. */
78
+ readonly extra?: Record<string, unknown>;
79
+ readonly tools?: readonly AgentTool[];
80
+ }
81
+ /**
82
+ * def()-time validation of run-automation (executeWorkflow) tools against
83
+ * the embedded automation token's trigger/outputs bags — the runtime
84
+ * backstop behind `agentRunAutomation`'s typed inputs (the defineApp
85
+ * handle/namespace pattern: throw with the full story, at def() time).
86
+ *
87
+ * MUST run before `slimTokens` — slimming strips the automation token's
88
+ * `trigger`/`outputs` bags. Bags that are absent OR EMPTY are skipped:
89
+ * absent = a hand-written/foreign token (the printer's foreign-token
90
+ * policy — platform stays the backstop); empty `{}` = the catalog regen's
91
+ * STUB pass, which builds the defs bag (and therefore calls def()) against
92
+ * stub tokens whose bags are empty objects. A real catalog token is either
93
+ * bag-less (paramless automation → undefined) or non-empty, so skipping
94
+ * empty costs no real coverage.
95
+ */
96
+ export declare function validateAgentTools(agentName: string, tools: readonly AgentTool[]): void;
97
+ /**
98
+ * The configured result of `defineAgent` — its reference surface (`ref()`)
99
+ * and its deployable entity (`def()`). Both take `refName` as a **call-time
100
+ * argument**, not a constructor option — see `AppConfigured` in
101
+ * `src/aspects/build.ts` for why.
102
+ */
103
+ export interface AgentConfigured {
104
+ ref(refName: string): AgentRef;
105
+ def(refName: string): DeployableEntity;
106
+ }
107
+ /** Build a v2 agent entity: identity + app from the flat options, exposing `.ref(refName)` and `.def(refName)`. */
108
+ export declare function defineAgent(opts: AgentV2Options): AgentConfigured;
@@ -0,0 +1,148 @@
1
+ /**
2
+ * v2 agent authoring (parallel to v1 `src/agents`, fully standalone so v1 can be
3
+ * deleted wholesale once v2 is validated).
4
+ *
5
+ * `defineAgent` emits Hydra's `AgentElementumCreateInput` + tools wire shape
6
+ * **minus the owner** (`ownerId`/`ownerType` are injected by the wire client at
7
+ * deploy) and with `CatalogRef` tokens at every reference position — the AI
8
+ * provider connector, skill access, and each tool's aspect/field/table/agent/
9
+ * automation refs. The tokens resolve to ids at deploy via `resolvePayload`;
10
+ * nothing here reads an `.id`.
11
+ *
12
+ * Identity (handle) and the owning app (`parent`) come from flat `name`/`parent`
13
+ * options, exactly like `defineAutomation`.
14
+ */
15
+ import { slimTokens } from "../../catalog/index.js";
16
+ function serializeSkillAccess(access) {
17
+ const preloaded = access.preloadedSkills !== undefined ? { preloadedSkillIds: access.preloadedSkills } : {};
18
+ if (access.mode === "CUSTOM") {
19
+ return {
20
+ mode: "CUSTOM",
21
+ skillIds: access.skills, // tokens → ids at deploy
22
+ ...preloaded,
23
+ };
24
+ }
25
+ return { mode: access.mode, ...preloaded };
26
+ }
27
+ function serializeA2ASkill(s) {
28
+ return {
29
+ name: s.name,
30
+ description: s.description,
31
+ ...(s.tags?.length ? { tags: s.tags } : {}),
32
+ ...(s.examples?.length ? { examples: s.examples } : {}),
33
+ ...(s.inputModes?.length ? { inputModes: s.inputModes } : {}),
34
+ ...(s.outputModes?.length ? { outputModes: s.outputModes } : {}),
35
+ };
36
+ }
37
+ /**
38
+ * def()-time validation of run-automation (executeWorkflow) tools against
39
+ * the embedded automation token's trigger/outputs bags — the runtime
40
+ * backstop behind `agentRunAutomation`'s typed inputs (the defineApp
41
+ * handle/namespace pattern: throw with the full story, at def() time).
42
+ *
43
+ * MUST run before `slimTokens` — slimming strips the automation token's
44
+ * `trigger`/`outputs` bags. Bags that are absent OR EMPTY are skipped:
45
+ * absent = a hand-written/foreign token (the printer's foreign-token
46
+ * policy — platform stays the backstop); empty `{}` = the catalog regen's
47
+ * STUB pass, which builds the defs bag (and therefore calls def()) against
48
+ * stub tokens whose bags are empty objects. A real catalog token is either
49
+ * bag-less (paramless automation → undefined) or non-empty, so skipping
50
+ * empty costs no real coverage.
51
+ */
52
+ export function validateAgentTools(agentName, tools) {
53
+ for (const tool of tools) {
54
+ const inner = tool["executeWorkflow"];
55
+ if (inner === undefined || typeof inner !== "object")
56
+ continue;
57
+ const toolName = inner.name ?? "";
58
+ const auto = inner.automationId;
59
+ const autoName = auto?.refName ?? "";
60
+ const fail = (msg) => {
61
+ throw new Error(`defineAgent "${agentName}": tool "${toolName}" — ${msg}`);
62
+ };
63
+ const trigger = auto?.trigger;
64
+ if (trigger !== undefined && typeof trigger === "object" && Object.keys(trigger).length > 0) {
65
+ const declared = Object.keys(trigger);
66
+ const mapped = new Set();
67
+ for (const input of inner.inputs ?? []) {
68
+ const param = input.triggerParameterId?.refName ?? input.triggerParameterId?.name ?? "";
69
+ if (!(param in trigger)) {
70
+ fail(`input "${param}" does not match a trigger parameter of automation "${autoName}"` +
71
+ (declared.length > 0 ? ` (declared: ${declared.join(", ")})` : " (it declares none)"));
72
+ }
73
+ mapped.add(param);
74
+ if (trigger[param]?.required === true && input.required !== true) {
75
+ fail(`trigger parameter "${param}" is required by automation "${autoName}"; its tool input must set required: true`);
76
+ }
77
+ }
78
+ for (const [param, meta] of Object.entries(trigger)) {
79
+ if (meta?.required === true && !mapped.has(param)) {
80
+ fail(`required trigger parameter "${param}" of automation "${autoName}" is not mapped to a tool input`);
81
+ }
82
+ }
83
+ }
84
+ const outputsBag = auto?.outputs;
85
+ if (outputsBag !== undefined && typeof outputsBag === "object" && Object.keys(outputsBag).length > 0) {
86
+ for (const output of inner.outputs ?? []) {
87
+ const prop = output.workflowPropertyName ?? "";
88
+ if (!(prop in outputsBag)) {
89
+ const declared = Object.keys(outputsBag);
90
+ fail(`output "${prop}" does not match a workflow output property of automation "${autoName}"` +
91
+ (declared.length > 0 ? ` (declared: ${declared.join(", ")})` : " (it declares none)"));
92
+ }
93
+ }
94
+ }
95
+ }
96
+ }
97
+ /** Build a v2 agent entity: identity + app from the flat options, exposing `.ref(refName)` and `.def(refName)`. */
98
+ export function defineAgent(opts) {
99
+ const elementum = {
100
+ name: opts.name,
101
+ description: opts.description,
102
+ aiProviderConnectorId: opts.connector, // token → connector id at deploy
103
+ ...(opts.temperature !== undefined ? { temperature: opts.temperature } : {}),
104
+ ...(opts.maxLength !== undefined ? { maxLength: opts.maxLength } : {}),
105
+ instructions: opts.instructions,
106
+ ...(opts.firstMessage !== undefined ? { firstMessage: opts.firstMessage } : {}),
107
+ ...(opts.reasoningEffort !== undefined
108
+ ? { reasoningEffort: opts.reasoningEffort.toUpperCase() }
109
+ : {}),
110
+ ...(opts.avatarAttachmentId !== undefined ? { avatarAttachmentId: opts.avatarAttachmentId } : {}),
111
+ ...(opts.managedById !== undefined ? { managedById: opts.managedById } : {}),
112
+ ...(opts.serviceAccountId !== undefined ? { serviceAccountId: opts.serviceAccountId } : {}),
113
+ ...(opts.runAs !== undefined ? { runAs: opts.runAs } : {}),
114
+ ...(opts.startingActions !== undefined ? { startingActions: opts.startingActions } : {}),
115
+ ...(opts.a2aStreaming !== undefined ? { a2aStreaming: opts.a2aStreaming } : {}),
116
+ ...(opts.conversationIdleTimeout !== undefined
117
+ ? { conversationIdleTimeout: opts.conversationIdleTimeout }
118
+ : {}),
119
+ ...(opts.skillAccess !== undefined
120
+ ? { skillAccessConfig: serializeSkillAccess(opts.skillAccess) }
121
+ : {}),
122
+ ...(opts.agentAuthentication !== undefined
123
+ ? { agentAuthentication: opts.agentAuthentication }
124
+ : {}),
125
+ // Spread last so an `extra` key overrides a surfaced field, matching v1.
126
+ ...(opts.extra ?? undefined),
127
+ };
128
+ return {
129
+ ref(refName) {
130
+ return { __kind: "agent", refName: refName, name: opts.name, parent: opts.parent };
131
+ },
132
+ def(refName) {
133
+ validateAgentTools(opts.name, opts.tools ?? []);
134
+ return {
135
+ kind: "agent",
136
+ parent: opts.parent,
137
+ refName,
138
+ // Slim every embedded catalog token to its canonical form (drop barrel bags).
139
+ payload: slimTokens({
140
+ agent: { elementum },
141
+ tools: opts.tools ?? [],
142
+ ...(opts.a2aSkills !== undefined ? { a2aSkills: opts.a2aSkills.map(serializeA2ASkill) } : {}),
143
+ }),
144
+ ...(opts.enabled !== undefined ? { enabled: opts.enabled } : {}),
145
+ };
146
+ },
147
+ };
148
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * printAgentV2 — pulled agent rendering for the terraform path (M3).
3
+ * Consumes the `NormalizedAgent` that `agentFromTf` produces and emits an
4
+ * `apps/<app>/agents/<refName>.ts` authoring file: `defineAgent` with the
5
+ * connector as an `org.connectors` token, tool targets as `catalog` tokens
6
+ * (self-app) or a TODO literal (foreign apps — their catalog may not exist
7
+ * in this workspace), and tool fields as `catalog.<app>.fields.<key>`.
8
+ *
9
+ * Platform ids never reach printed source (plan §4.2).
10
+ */
11
+ import type { NormalizedAgent } from "../from-tf.js";
12
+ export interface PrintAgentV2Options {
13
+ /** The owning app's refName — `parent:` and the catalog token root. */
14
+ readonly appRefName: string;
15
+ /** Module specifier for the workspace org bags (e.g. "../../../org.js"). */
16
+ readonly orgImportPath: string;
17
+ }
18
+ export declare function printAgentV2(agent: NormalizedAgent, opts: PrintAgentV2Options): string;
@@ -0,0 +1,177 @@
1
+ /**
2
+ * printAgentV2 — pulled agent rendering for the terraform path (M3).
3
+ * Consumes the `NormalizedAgent` that `agentFromTf` produces and emits an
4
+ * `apps/<app>/agents/<refName>.ts` authoring file: `defineAgent` with the
5
+ * connector as an `org.connectors` token, tool targets as `catalog` tokens
6
+ * (self-app) or a TODO literal (foreign apps — their catalog may not exist
7
+ * in this workspace), and tool fields as `catalog.<app>.fields.<key>`.
8
+ *
9
+ * Platform ids never reach printed source (plan §4.2).
10
+ */
11
+ import { quote } from "../../../../pull/util.js";
12
+ import { sdkPackageSpecifier } from "../../../internal/sdk-package.js";
13
+ const TOOL_FACTORY_BY_TYPE_KEY = {
14
+ createRecord: "agentCreateRecord",
15
+ searchAspect: "agentSearchAspect",
16
+ executeWorkflow: "agentRunAutomation",
17
+ };
18
+ export function printAgentV2(agent, opts) {
19
+ const { appRefName, orgImportPath } = opts;
20
+ const factories = [...new Set(agent.tools.map((t) => TOOL_FACTORY_BY_TYPE_KEY[t.typeKey]).filter(Boolean))].sort();
21
+ const usesCatalog = agent.tools.some((t) => t.target?.kind === "self" || (t.fields !== undefined && t.fields.length > 0) || t.typeKey === "executeWorkflow") ||
22
+ (agent.skillAccess !== undefined &&
23
+ [
24
+ ...(agent.skillAccess.mode === "CUSTOM" ? agent.skillAccess.skills : []),
25
+ ...(agent.skillAccess.preloadedSkills ?? []),
26
+ ].some((s) => s.kind === "self"));
27
+ const lines = [];
28
+ lines.push("/**");
29
+ lines.push(` * ${agent.name}`);
30
+ lines.push(" *");
31
+ lines.push(" * Auto-generated by EDK (v2 pull). Hand-edit freely; the generator is a");
32
+ lines.push(" * one-shot starting point, not a live-binding view.");
33
+ lines.push(" */");
34
+ lines.push("");
35
+ lines.push(`import { ${[...factories, "defineAgent"].sort().join(", ")} } from "${sdkPackageSpecifier("agents")}";`);
36
+ if (usesCatalog)
37
+ lines.push(`import catalog from "@catalog";`);
38
+ if (agent.connectorKey !== undefined)
39
+ lines.push(`import { org } from ${quote(orgImportPath)};`);
40
+ lines.push("");
41
+ lines.push(`const ${agent.refName} = defineAgent({`);
42
+ lines.push(` name: ${quote(agent.name)},`);
43
+ lines.push(` parent: ${quote(appRefName)},`);
44
+ if (agent.connectorKey !== undefined) {
45
+ lines.push(` connector: org.connectors.${agent.connectorKey},`);
46
+ }
47
+ else {
48
+ // No connector in the stream — the platform defaulted the model. There
49
+ // is no token to print; the author picks one (connector is required).
50
+ lines.push(` connector: org.connectors.TODO_CONNECTOR, // TODO: no connector in the export — pick one`);
51
+ }
52
+ lines.push(` description: ${quote(agent.description)},`);
53
+ lines.push(` instructions: ${quote(agent.instructions)},`);
54
+ if (agent.firstMessage !== undefined)
55
+ lines.push(` firstMessage: ${quote(agent.firstMessage)},`);
56
+ if (agent.maxLength !== undefined)
57
+ lines.push(` maxLength: ${String(agent.maxLength)},`);
58
+ if (agent.skillAccess !== undefined) {
59
+ lines.push(...printSkillAccess(agent.skillAccess, appRefName).map((l) => ` ${l}`));
60
+ }
61
+ if (agent.tools.length > 0) {
62
+ lines.push(" tools: [");
63
+ for (const tool of agent.tools) {
64
+ lines.push(...printTool(tool, appRefName).map((l) => ` ${l}`));
65
+ }
66
+ lines.push(" ],");
67
+ }
68
+ lines.push("});");
69
+ lines.push("");
70
+ lines.push(`export default ${agent.refName};`);
71
+ lines.push("");
72
+ return lines.join("\n");
73
+ }
74
+ /** Dot access for identifier-safe names, bracket access otherwise. */
75
+ function safeMember(name) {
76
+ return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name) ? `.${name}` : `[${quote(name)}]`;
77
+ }
78
+ /** Bare object key for identifier-safe names, quoted otherwise. */
79
+ function safeKey(name) {
80
+ return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name) ? name : quote(name);
81
+ }
82
+ function printSkillRefToken(ref, appRefName) {
83
+ if (ref.kind === "self")
84
+ return `catalog.${appRefName}.skills.${ref.key}`;
85
+ // The foreign app's catalog may not exist in this workspace — a literal
86
+ // token compiles and deploys; swap for a catalog token when available.
87
+ return `{ __kind: "skill", refName: ${quote(ref.name)}, name: ${quote(ref.name)} }`;
88
+ }
89
+ function printSkillAccess(access, appRefName) {
90
+ const hasPreloaded = access.preloadedSkills !== undefined && access.preloadedSkills.length > 0;
91
+ if (access.mode !== "CUSTOM" && !hasPreloaded) {
92
+ return [`skillAccess: { mode: ${quote(access.mode)} },`];
93
+ }
94
+ const lines = [`skillAccess: {`, ` mode: ${quote(access.mode)},`];
95
+ if (access.mode === "CUSTOM") {
96
+ lines.push(` skills: [`);
97
+ for (const ref of access.skills)
98
+ lines.push(` ${printSkillRefToken(ref, appRefName)},`);
99
+ lines.push(` ],`);
100
+ }
101
+ if (hasPreloaded) {
102
+ lines.push(` preloadedSkills: [`);
103
+ for (const ref of access.preloadedSkills)
104
+ lines.push(` ${printSkillRefToken(ref, appRefName)},`);
105
+ lines.push(` ],`);
106
+ }
107
+ lines.push(`},`);
108
+ return lines;
109
+ }
110
+ function printTool(tool, appRefName) {
111
+ const factory = TOOL_FACTORY_BY_TYPE_KEY[tool.typeKey] ?? "agentSearchAspect";
112
+ const lines = [`${factory}({`];
113
+ lines.push(` name: ${quote(tool.name)},`);
114
+ lines.push(` description: ${quote(tool.description)},`);
115
+ if (tool.startMessage !== undefined)
116
+ lines.push(` startMessage: ${quote(tool.startMessage)},`);
117
+ if (tool.typeKey === "executeWorkflow") {
118
+ // Record form (agentRunAutomation v3): keys are the automation's declared
119
+ // parameter/property names; the agent-facing `name:` prints only when it
120
+ // differs from the key — the fixed point for tools authored without a
121
+ // rename. Spec key order: name?, description, required?.
122
+ const auto = `catalog.${appRefName}.automations${safeMember(tool.automationKey ?? "")}`;
123
+ lines.push(` automation: ${auto},`);
124
+ if (tool.inputs !== undefined && tool.inputs.length > 0) {
125
+ lines.push(" inputs: {");
126
+ for (const i of tool.inputs) {
127
+ const parts = [];
128
+ if (i.name !== undefined && i.name !== i.parameterName)
129
+ parts.push(`name: ${quote(i.name)}`);
130
+ parts.push(`description: ${quote(i.description ?? "")}`);
131
+ if (i.required !== undefined)
132
+ parts.push(`required: ${i.required}`);
133
+ lines.push(` ${safeKey(i.parameterName)}: { ${parts.join(", ")} },`);
134
+ }
135
+ lines.push(" },");
136
+ }
137
+ if (tool.outputs !== undefined && tool.outputs.length > 0) {
138
+ lines.push(" outputs: {");
139
+ for (const o of tool.outputs) {
140
+ const spec = o.name !== undefined && o.name !== o.workflowPropertyName ? `{ name: ${quote(o.name)} }` : "{}";
141
+ lines.push(` ${safeKey(o.workflowPropertyName)}: ${spec},`);
142
+ }
143
+ lines.push(" },");
144
+ }
145
+ lines.push("}),");
146
+ return lines;
147
+ }
148
+ if (tool.target?.kind === "self") {
149
+ lines.push(` aspect: catalog.${appRefName},`);
150
+ }
151
+ else if (tool.target !== undefined && tool.target.kind === "foreignApp") {
152
+ // The foreign app's catalog may not exist in this workspace — a literal
153
+ // token compiles and deploys; swap for a catalog token when available.
154
+ lines.push(` aspect: { __kind: "app", refName: ${quote(tool.target.name)}, name: ${quote(tool.target.name)} },`);
155
+ }
156
+ if (tool.typeKey === "searchAspect") {
157
+ lines.push(` queryDescription: ${quote(tool.queryDescription ?? "")},`);
158
+ if (tool.limit !== undefined)
159
+ lines.push(` limit: ${tool.limit},`);
160
+ }
161
+ if (tool.fields !== undefined && tool.fields.length > 0) {
162
+ lines.push(" fields: [");
163
+ for (const f of tool.fields) {
164
+ const parts = [`field: catalog.${appRefName}.fields.${f.key}`];
165
+ if (f.name !== undefined)
166
+ parts.push(`name: ${quote(f.name)}`);
167
+ if (f.description !== undefined)
168
+ parts.push(`description: ${quote(f.description)}`);
169
+ if (f.required !== undefined)
170
+ parts.push(`required: ${f.required}`);
171
+ lines.push(` { ${parts.join(", ")} },`);
172
+ }
173
+ lines.push(" ],");
174
+ }
175
+ lines.push("}),");
176
+ return lines;
177
+ }
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Agent extraction (M3, plan §4.3): `agentFromTf` turns an
3
+ * `elementum_agent` block + its tool blocks (delegated to
4
+ * `entities/agent-tool/from-tf.ts`) into the normalized shape
5
+ * `printAgentV2` consumes. Platform ids come only from the stream's import
6
+ * blocks and stay data-side — they never reach printed source.
7
+ */
8
+ import { type FromTfContext } from "../../engine/pull/context.js";
9
+ import { type TfBlock } from "../../engine/tf/index.js";
10
+ import { type NormalizedAgentTool } from "../agent-tool/from-tf.js";
11
+ /** A resolved skill reference: this app's own skill (by catalog key) or a foreign app's (by name only). */
12
+ export type NormalizedSkillRef = {
13
+ readonly kind: "self";
14
+ readonly key: string;
15
+ } | {
16
+ readonly kind: "foreign";
17
+ readonly name: string;
18
+ };
19
+ export type NormalizedSkillAccess = {
20
+ readonly mode: "NONE" | "ALL" | "ALL_APP";
21
+ readonly preloadedSkills?: readonly NormalizedSkillRef[];
22
+ } | {
23
+ readonly mode: "CUSTOM";
24
+ readonly skills: readonly NormalizedSkillRef[];
25
+ readonly preloadedSkills?: readonly NormalizedSkillRef[];
26
+ };
27
+ export interface NormalizedAgent {
28
+ /** Authoring key = the bijective image of the exported label. */
29
+ readonly refName: string;
30
+ readonly name: string;
31
+ readonly description: string;
32
+ readonly instructions: string;
33
+ readonly firstMessage?: string;
34
+ readonly maxLength?: number;
35
+ /** org.ts `connectors` bag key (the data label's tsLabel image), when pinned. */
36
+ readonly connectorKey?: string;
37
+ readonly skillAccess?: NormalizedSkillAccess;
38
+ readonly tools: readonly NormalizedAgentTool[];
39
+ }
40
+ export interface AgentFromTfResult {
41
+ readonly agent?: NormalizedAgent;
42
+ /** Set when the agent can't be authored on the terraform path (variant types) — reported, not fatal. */
43
+ readonly skippedReason?: string;
44
+ }
45
+ /**
46
+ * The `elementum_agent` block + its tool blocks → the normalized agent.
47
+ * Tool blocks belonging to OTHER agents are skipped with a diagnostic (the
48
+ * caller partitions per-agent by agent_id, but stays defensive).
49
+ */
50
+ export declare function agentFromTf(agentBlock: TfBlock, toolBlocks: readonly TfBlock[], appLabel: string, ctx: FromTfContext): AgentFromTfResult;
@@ -0,0 +1,169 @@
1
+ /**
2
+ * Agent extraction (M3, plan §4.3): `agentFromTf` turns an
3
+ * `elementum_agent` block + its tool blocks (delegated to
4
+ * `entities/agent-tool/from-tf.ts`) into the normalized shape
5
+ * `printAgentV2` consumes. Platform ids come only from the stream's import
6
+ * blocks and stay data-side — they never reach printed source.
7
+ */
8
+ import { EntityTfError } from "../../engine/entity.js";
9
+ import { optionalString, resourceRefLabel } from "../../engine/pull/context.js";
10
+ import { isTfExpr, tfLabelToTsLabel } from "../../engine/tf/index.js";
11
+ import { toolFromTf } from "../agent-tool/from-tf.js";
12
+ import { APP_RESOURCE_TYPE } from "../app/module.js";
13
+ import { SKILL_RESOURCE_TYPE } from "../skill/module.js";
14
+ import { AGENT_RESOURCE_TYPE } from "./module.js";
15
+ /** Attributes `agentFromTf` understands — anything else is dialect growth, reported loudly. */
16
+ const KNOWN_AGENT_ATTRS = new Set([
17
+ "app_id",
18
+ "name",
19
+ "description",
20
+ "instructions",
21
+ "first_message",
22
+ "ai_provider_connector_id",
23
+ "skill_access_config",
24
+ "max_tokens",
25
+ ]);
26
+ /** Dialect attrs with no authoring slot yet — reported by name, agent still pulled. */
27
+ const UNAUTHORABLE_AGENT_ATTRS = new Set(["starting_actions", "model"]);
28
+ /** Non-elementum agent variants (type + their config attrs) — the whole agent is skipped. */
29
+ const VARIANT_ATTRS = new Set([
30
+ "type",
31
+ "snowflake_database",
32
+ "snowflake_schema",
33
+ "snowflake_name",
34
+ "bedrock_agent_arn",
35
+ "browser_agent_instructions",
36
+ ]);
37
+ /**
38
+ * One `skill_ids`/`preloaded_skill_ids` entry → its resolved ref. A
39
+ * resource-attr to `elementum_agentic_skill` is always self (the export
40
+ * stream only carries resource blocks for skills THIS app owns); a
41
+ * data-attr is a foreign app's skill, resolved to its name via the
42
+ * stream's data block.
43
+ */
44
+ function parseSkillRef(item, where, ctx) {
45
+ if (isTfExpr(item) && item.$expr === "resource-attr" && item.type === SKILL_RESOURCE_TYPE) {
46
+ return { kind: "self", key: tfLabelToTsLabel(item.label) };
47
+ }
48
+ if (isTfExpr(item) && item.$expr === "data-attr" && item.type === SKILL_RESOURCE_TYPE) {
49
+ const name = ctx.dataName(SKILL_RESOURCE_TYPE, item.label);
50
+ if (name === undefined) {
51
+ ctx.diagnostics.push(`${where}: references data.${SKILL_RESOURCE_TYPE}.${item.label} but the stream has no such data block; dropped`);
52
+ return undefined;
53
+ }
54
+ return { kind: "foreign", name };
55
+ }
56
+ ctx.diagnostics.push(`${where}: skill_access_config entry has an unrecognized shape (${JSON.stringify(item)}); dropped`);
57
+ return undefined;
58
+ }
59
+ function parseSkillAccessConfig(value, where, ctx) {
60
+ if (typeof value !== "object" || value === null || Array.isArray(value) || isTfExpr(value)) {
61
+ ctx.diagnostics.push(`${where}: skill_access_config has an unrecognized shape; dropped`);
62
+ return undefined;
63
+ }
64
+ const rec = value;
65
+ const mode = rec["mode"];
66
+ if (mode !== "NONE" && mode !== "ALL" && mode !== "ALL_APP" && mode !== "CUSTOM") {
67
+ ctx.diagnostics.push(`${where}: skill_access_config.mode ${JSON.stringify(mode)} is not recognized; dropped`);
68
+ return undefined;
69
+ }
70
+ const parseList = (attr) => {
71
+ const raw = rec[attr];
72
+ if (!Array.isArray(raw))
73
+ return undefined;
74
+ const refs = [];
75
+ for (const item of raw) {
76
+ const ref = parseSkillRef(item, `${where}: ${attr}`, ctx);
77
+ if (ref !== undefined)
78
+ refs.push(ref);
79
+ }
80
+ return refs;
81
+ };
82
+ // `preloaded_skill_ids` is independent of mode (the provider reads it
83
+ // unconditionally — see entities/agent/build.ts's SkillAccess doc comment),
84
+ // so it must be captured for every mode, not just CUSTOM — dropping it
85
+ // silently here would lose live-set data on every pull.
86
+ const preloadedSkills = parseList("preloaded_skill_ids");
87
+ const preloadedProp = preloadedSkills !== undefined && preloadedSkills.length > 0 ? { preloadedSkills } : {};
88
+ if (mode !== "CUSTOM")
89
+ return { mode, ...preloadedProp };
90
+ const skills = parseList("skill_ids") ?? [];
91
+ return { mode: "CUSTOM", skills, ...preloadedProp };
92
+ }
93
+ /**
94
+ * The `elementum_agent` block + its tool blocks → the normalized agent.
95
+ * Tool blocks belonging to OTHER agents are skipped with a diagnostic (the
96
+ * caller partitions per-agent by agent_id, but stays defensive).
97
+ */
98
+ export function agentFromTf(agentBlock, toolBlocks, appLabel, ctx) {
99
+ const label = agentBlock.label;
100
+ if (label === undefined || label === "") {
101
+ throw new EntityTfError("elementum_agent block is missing its label");
102
+ }
103
+ const attrs = agentBlock.attrs;
104
+ const name = optionalString(attrs, "name", `agent "${label}"`, ctx) ?? "";
105
+ const where = `agent "${name}" (${AGENT_RESOURCE_TYPE}.${label})`;
106
+ if (attrs["type"] !== undefined) {
107
+ return {
108
+ skippedReason: `${where}: agent type ${JSON.stringify(attrs["type"])} has no terraform-path authoring yet; skipped`,
109
+ };
110
+ }
111
+ for (const key of Object.keys(attrs)) {
112
+ if (KNOWN_AGENT_ATTRS.has(key))
113
+ continue;
114
+ if (UNAUTHORABLE_AGENT_ATTRS.has(key) || VARIANT_ATTRS.has(key)) {
115
+ ctx.diagnostics.push(`${where}: ${key} has no authoring slot on the terraform path yet; a rebuilt stream will omit it`);
116
+ }
117
+ else {
118
+ ctx.diagnostics.push(`${where}: unhandled attribute "${key}" — the export dialect grew; extend agentFromTf deliberately`);
119
+ }
120
+ }
121
+ if (resourceRefLabel(attrs["app_id"], APP_RESOURCE_TYPE) !== appLabel) {
122
+ return { skippedReason: `${where}: app_id does not reference ${APP_RESOURCE_TYPE}.${appLabel}; skipped` };
123
+ }
124
+ let connectorKey;
125
+ const connectorAttr = attrs["ai_provider_connector_id"];
126
+ if (connectorAttr !== undefined) {
127
+ if (isTfExpr(connectorAttr) && connectorAttr.$expr === "data-attr" && connectorAttr.type === "elementum_ai_provider_connector") {
128
+ // The org.ts key is the data label's bijective image — same derivation
129
+ // the org extractor used, so the printed token matches the catalog.
130
+ connectorKey = tfLabelToTsLabel(connectorAttr.label);
131
+ }
132
+ else {
133
+ ctx.diagnostics.push(`${where}: ai_provider_connector_id is not a connector data reference; dropped`);
134
+ }
135
+ }
136
+ const owner = { appType: APP_RESOURCE_TYPE, appLabel, agentType: AGENT_RESOURCE_TYPE, agentLabel: label };
137
+ const tools = [];
138
+ for (const block of toolBlocks) {
139
+ const tool = toolFromTf(block, owner, ctx);
140
+ if (tool !== undefined)
141
+ tools.push(tool);
142
+ }
143
+ let skillAccess;
144
+ const skillAccessAttr = attrs["skill_access_config"];
145
+ if (skillAccessAttr !== undefined) {
146
+ skillAccess = parseSkillAccessConfig(skillAccessAttr, where, ctx);
147
+ }
148
+ const firstMessage = optionalString(attrs, "first_message", where, ctx);
149
+ const maxTokens = attrs["max_tokens"];
150
+ const maxLength = typeof maxTokens === "number" && Number.isSafeInteger(maxTokens) && maxTokens > 0
151
+ ? maxTokens
152
+ : undefined;
153
+ if (maxTokens !== undefined && maxLength === undefined) {
154
+ ctx.diagnostics.push(`${where}: expected positive integer "max_tokens", got ${JSON.stringify(maxTokens)}; dropped`);
155
+ }
156
+ return {
157
+ agent: {
158
+ refName: tfLabelToTsLabel(label),
159
+ name,
160
+ description: optionalString(attrs, "description", where, ctx) ?? "",
161
+ instructions: optionalString(attrs, "instructions", where, ctx) ?? "",
162
+ ...(firstMessage !== undefined && { firstMessage }),
163
+ ...(maxLength !== undefined && { maxLength }),
164
+ ...(connectorKey !== undefined && { connectorKey }),
165
+ ...(skillAccess !== undefined && { skillAccess }),
166
+ tools,
167
+ },
168
+ };
169
+ }