@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,857 @@
1
+ /**
2
+ * App object pattern — a single typed object per Elementum app that
3
+ * carries all related IDs (fields, agents, search tables, automations).
4
+ *
5
+ * Each app is code-generated from its platform definition and imported into
6
+ * automation files. Downstream task configs (e.g. `recordSearch`,
7
+ * `updateField`, `aiSearchTable`) accept the imported app value directly;
8
+ * the generics infer field / record shapes from it.
9
+ */
10
+ import { type Ref, type ValueOrRef } from "../../entities/shared/ref.js";
11
+ import type { WorkflowFieldType } from "../../entities/shared/types/field-types.js";
12
+ import type { CloudLink } from "./cloud-link.js";
13
+ import type { DisplayBlockBag } from "./display-block.js";
14
+ import type { SerializedRenderTree } from "../../entities/flow/activities/render-catalog.js";
15
+ import type { AspectFieldQrFormat, AspectNumericFieldFormat, AspectReferenceFieldFormat, PicklistConfigInput, PicklistValueExInput } from "../../../elementum-entity-client/clients/aspects/models/index.js";
16
+ /**
17
+ * One static picklist value; in `createRecord` / `updateField` pick via
18
+ * `(options) => options.Name` — only `id` is sent to the API.
19
+ *
20
+ * `parentValues` is the per-option half of dependent dropdowns: each
21
+ * entry is an option on the field's `parentField` that gates this
22
+ * option's availability. Authors pass typed refs (`country.options.usa`)
23
+ * rather than raw ids — the serializer flattens to id strings on the
24
+ * wire. Server-side validation rejects a record save whose child
25
+ * selection isn't valid for the current parent value. Leave the slot
26
+ * unset on plain (non-dependent) options.
27
+ */
28
+ /**
29
+ * Tag values the platform recognises on a picklist option. `CLOSED`
30
+ * on a STATUS field's option tells the platform to auto-stamp the
31
+ * close timestamp / closed-by system fields when a record moves into
32
+ * that value. The priority tags drive cosmetic-priority surfaces.
33
+ *
34
+ * Authors picking a closed-state for a status field set
35
+ * `tags: ["CLOSED"]` on the relevant option.
36
+ */
37
+ export type PicklistOptionTag = "CLOSED" | "CRITICAL" | "HIGH" | "MEDIUM" | "LOW";
38
+ export interface PicklistOption {
39
+ readonly id: string;
40
+ readonly label: string;
41
+ readonly parentValues?: readonly PicklistOption[];
42
+ /**
43
+ * Optional tags on this option. See {@link PicklistOptionTag}
44
+ * for the supported values and what they drive on the platform.
45
+ */
46
+ readonly tags?: readonly PicklistOptionTag[];
47
+ /**
48
+ * Optional display color (hex, e.g. `"#3B82F6"`). Surfaced on status
49
+ * options; cosmetic only.
50
+ */
51
+ readonly color?: string;
52
+ }
53
+ export declare function picklistOption(id: string, label: string, parentValues?: readonly PicklistOption[]): PicklistOption;
54
+ /** If `value` is a static picklist option for this field, return its API id; otherwise return `value`. */
55
+ export declare function picklistStaticValueToApiId(field: AppField<FieldScope>, value: unknown): unknown;
56
+ /**
57
+ * Phantom marker — distinguishes a field descriptor reachable at module scope
58
+ * (`app.fields.X`) from one handed in by a row-scoped filter callback
59
+ * (`(row) => ...`). The marker has no runtime presence; it exists purely so
60
+ * the type system can gate filter helpers that only make sense when a row is
61
+ * in scope.
62
+ *
63
+ * - `"unscoped"` — the default for `app.fields.X`; these descriptors can be
64
+ * consumed by row-less APIs (e.g. `recordFieldLocking`) but cannot be the
65
+ * left-hand side of a row-based filter comparison.
66
+ * - `"row"` — produced only by a row-scoped callback's row proxy. These are
67
+ * the descriptors filter helpers like `eq` / `gt` / `like` accept.
68
+ *
69
+ * This replaces earlier prompt-only guidance that forbade `APP.fields.x` in
70
+ * switch conditions: the ban is now a compile error instead of a rule the
71
+ * agent has to remember.
72
+ */
73
+ export type FieldScope = "row" | "unscoped";
74
+ /**
75
+ * Names that Ultron auto-provisions on every `APP` aspect. A user field
76
+ * whose `name` collides with one of these causes compose to fail with a
77
+ * raw Postgres unique-constraint 500 instead of a typed validation error,
78
+ * so we reject the collision at `defineApp()` time.
79
+ *
80
+ * This list is hand-maintained — if Ultron adds a new system field, add
81
+ * the literal here and regenerate. A long-term improvement is to source
82
+ * this list from an Ultron endpoint at codegen time (see
83
+ * plans/edk-shortcomings.md #14).
84
+ */
85
+ /**
86
+ * Field names ultron auto-creates on every aspect at create time and
87
+ * reserves for system bookkeeping. Source of truth: ultron's
88
+ * `FieldTag.REQUIRED_TAGS` map (`shared/.../field/model/FieldTag.java:114`)
89
+ * and the i18n display bundle (`shared/.../bundle/aspect.json` →
90
+ * `aspect.requiredTags`).
91
+ *
92
+ * The list is the union across all `AspectType` variants — APP has the
93
+ * full 10, TASK omits Stage, ELEMENT/TRANSACTION only have ID + Title.
94
+ * Reserving the union is slightly stricter than ultron per-variant but
95
+ * avoids any author-time/runtime-collision class.
96
+ */
97
+ export type ReservedSystemFieldName = "ID" | "Title" | "Status" | "Stage" | "Created on" | "Created by" | "Updated on" | "Updated by" | "Closed on" | "Closed by";
98
+ /**
99
+ * Branded `never` alias that surfaces a readable error message when a
100
+ * field `name` collides with a reserved system field. The `tsc` hover
101
+ * shows the offending name, so authors see:
102
+ *
103
+ * Type 'Status' is not assignable to type
104
+ * '__edk_error_field_name_is_reserved_for_system_use<"Status">__'
105
+ */
106
+ export type _ReservedSystemFieldName<N extends string> = `__edk_error_field_name_is_reserved_for_system_use<${N}>__` & never;
107
+ export type SystemFieldSemanticTag = "HANDLE" | "TITLE" | "STATUS" | "STAGE" | "CREATED_AT" | "CREATED_BY" | "UPDATED_AT" | "UPDATED_BY" | "CLOSED_AT" | "CLOSED_BY";
108
+ export type WritableSystemFieldSemanticTag = "TITLE" | "STATUS";
109
+ type TagsOf<F> = F extends {
110
+ readonly tags: readonly (infer T)[];
111
+ } ? T : never;
112
+ type HasLiteralTags<F> = string extends TagsOf<F> ? false : true;
113
+ type HasKnownSystemSemanticTag<F> = HasLiteralTags<F> extends true ? [Extract<TagsOf<F>, SystemFieldSemanticTag>] extends [never] ? false : true : false;
114
+ type WritableFieldValues<TFields extends Record<string, AppField>> = {
115
+ [K in keyof TFields]?: AppFieldInputForTask<TFields[K] & AppField>;
116
+ };
117
+ /**
118
+ * Shared base for every per-variant `AppField`. Carries identity
119
+ * (`id`, `name`) plus the cross-variant authoring options that ultron
120
+ * accepts on every `AbstractAspectFieldInput` (required, description,
121
+ * tags, etc.). Per-variant interfaces below extend this with their
122
+ * variant-specific extras.
123
+ */
124
+ export interface AspectFieldBase<Scope extends FieldScope = "unscoped"> {
125
+ /** Phantom — never read or written at runtime; see `FieldScope`. */
126
+ readonly __scope?: Scope;
127
+ readonly id: string;
128
+ readonly name: string;
129
+ readonly columnName?: string;
130
+ readonly required?: boolean;
131
+ readonly requiredOnClose?: boolean;
132
+ readonly showOnCreate?: boolean;
133
+ readonly description?: string;
134
+ /**
135
+ * Platform semantic-role tags (HANDLE, TITLE, STATUS, ...).
136
+ */
137
+ readonly tags?: readonly string[];
138
+ readonly lockOnCreate?: boolean;
139
+ readonly defaultValue?: unknown;
140
+ /**
141
+ * Runtime metadata stamped on pulled fields by `print-aspect.ts`.
142
+ * Records the variant the field was when pulled — `serializeAspectForUpdate`
143
+ * compares it against the current `type` and throws if they differ.
144
+ * Belt to the `satisfies <VariantInterface>` brace's compile-time
145
+ * check: catches the pathological case where an agent edits the
146
+ * `type:` literal AND removes the `satisfies` clause (or otherwise
147
+ * bypasses the type system) but leaves the rest of the source.
148
+ *
149
+ * Hand-authored sources don't set this; the guard is a no-op there.
150
+ * Never serialized to ultron — `serializeBaseField` projects only
151
+ * the wire-relevant properties.
152
+ */
153
+ readonly __pulledType?: "TEXT" | "RICH_TEXT" | "HANDLE" | "HTML" | "NUMBER" | "DECIMAL" | "BOOLEAN" | "DATE" | "DATETIME" | "JSON" | "PICKLIST" | "MULTI_PICKLIST" | "USER" | "USER_ID" | "GROUP" | "GROUP_ID" | "ATTACHMENT" | "ATTACHMENT_ID" | "CALCULATED";
154
+ }
155
+ /** TEXT and RICH_TEXT fields. `qrFormat` opts in to QR rendering. */
156
+ export interface TextAppField<Scope extends FieldScope = "unscoped"> extends AspectFieldBase<Scope> {
157
+ readonly type: "TEXT" | "RICH_TEXT";
158
+ readonly qrFormat?: AspectFieldQrFormat;
159
+ }
160
+ /** HANDLE fields. Aspect compose accepts user-authored handles in addition to ultron's auto-generated `ID` field. */
161
+ export interface HandleAppField<Scope extends FieldScope = "unscoped"> extends AspectFieldBase<Scope> {
162
+ readonly type: "HANDLE";
163
+ readonly qrFormat?: AspectFieldQrFormat;
164
+ }
165
+ /** Integer NUMBER fields. `numericFormat` controls currency/percent/etc. rendering. */
166
+ export interface NumberAppField<Scope extends FieldScope = "unscoped"> extends AspectFieldBase<Scope> {
167
+ readonly type: "NUMBER";
168
+ readonly numericFormat?: AspectNumericFieldFormat;
169
+ }
170
+ /** DECIMAL fields. Same `numericFormat` slot as `NumberAppField`. */
171
+ export interface DecimalAppField<Scope extends FieldScope = "unscoped"> extends AspectFieldBase<Scope> {
172
+ readonly type: "DECIMAL";
173
+ readonly numericFormat?: AspectNumericFieldFormat;
174
+ /** Display/storage precision (`elementum_decimal_field.decimal_places`). */
175
+ readonly decimalPlaces?: number;
176
+ }
177
+ /** BOOLEAN fields. */
178
+ export interface BooleanAppField<Scope extends FieldScope = "unscoped"> extends AspectFieldBase<Scope> {
179
+ readonly type: "BOOLEAN";
180
+ }
181
+ /** DATE fields (date-only, no time). */
182
+ export interface DateAppField<Scope extends FieldScope = "unscoped"> extends AspectFieldBase<Scope> {
183
+ readonly type: "DATE";
184
+ }
185
+ /** DATETIME fields. */
186
+ export interface DateTimeAppField<Scope extends FieldScope = "unscoped"> extends AspectFieldBase<Scope> {
187
+ readonly type: "DATETIME";
188
+ }
189
+ /** HTML fields (rich-text body). */
190
+ export interface HtmlAppField<Scope extends FieldScope = "unscoped"> extends AspectFieldBase<Scope> {
191
+ readonly type: "HTML";
192
+ }
193
+ /** JSON-blob fields. */
194
+ export interface JsonAppField<Scope extends FieldScope = "unscoped"> extends AspectFieldBase<Scope> {
195
+ readonly type: "JSON";
196
+ }
197
+ /**
198
+ * Shared base for `PicklistAppField` / `MultiPicklistAppField`. The
199
+ * three value-source mechanisms are mutually exclusive at the wire
200
+ * layer:
201
+ * - `options` — static value list emitted by `fetch-app-definition`
202
+ * and consumed by the serializer's `optionsToPicklistValues`
203
+ * translation (the agent-friendly authoring shape)
204
+ * - `picklistValues` — explicit `PicklistValueExInput[]` for richer
205
+ * authoring (color, icon)
206
+ * - `config: PicklistConfigInput` — typed wrapper for static /
207
+ * dynamic picklist config (related-aspect refs, filters, etc.)
208
+ *
209
+ * The legacy `values: string[]` slot is preserved for update flows
210
+ * that re-send id-only ordering data.
211
+ *
212
+ * `parentField` is the field-level half of dependent dropdowns: a
213
+ * typed reference to another picklist (single or multi) whose
214
+ * selected value(s) gate which of THIS field's options are available.
215
+ * Authors pass the parent field directly:
216
+ *
217
+ * ```ts
218
+ * const country = { ..., type: "PICKLIST" as const, options: { usa, canada } } satisfies PicklistAppField;
219
+ * const state = {
220
+ * ..., type: "PICKLIST" as const,
221
+ * parentField: country,
222
+ * options: {
223
+ * ca: { id, label, parentValues: [country.options.usa] },
224
+ * on: { id, label, parentValues: [country.options.canada] },
225
+ * },
226
+ * } satisfies PicklistAppField;
227
+ * ```
228
+ *
229
+ * The serializer flattens this into the wire form: `parentField.id`
230
+ * lands on `config.static.parentFieldId` (or `config.dynamic.parentFieldId`
231
+ * when the picklist is dynamic), and each option's `parentValues` ids
232
+ * land on its `relatedParentValues`. For the related-aspect-backed
233
+ * (dynamic) case, the cross-aspect field mappings live on
234
+ * `config.dynamic.parentMappings` and are still authored through the
235
+ * `config` slot directly.
236
+ */
237
+ export interface PicklistAppFieldBase<Scope extends FieldScope = "unscoped"> extends AspectFieldBase<Scope> {
238
+ readonly options?: Readonly<Record<string, PicklistOption>>;
239
+ readonly picklistValues?: readonly PicklistValueExInput[];
240
+ readonly config?: PicklistConfigInput;
241
+ readonly values?: readonly string[];
242
+ readonly referenceFormat?: AspectReferenceFieldFormat;
243
+ readonly parentField?: PicklistAppField<Scope> | MultiPicklistAppField<Scope>;
244
+ /**
245
+ * Runtime metadata stamped on pulled picklist fields by
246
+ * `print-aspect.ts`. Records the picklist value ids that existed
247
+ * at pull time. `serializeAspectForUpdate` checks every id in this
248
+ * set is still present in the current `picklistValues`; missing
249
+ * ids → throw, since the EDK doesn't support deleting picklist
250
+ * values (matching the create/update-only pattern across
251
+ * `defineAutomation`, `defineAgent`, etc.).
252
+ *
253
+ * Hand-authored fields don't set this; the guard is a no-op.
254
+ * Never serialized to ultron — `resolvePicklistValues` projects
255
+ * only the wire-relevant fields.
256
+ */
257
+ readonly __pulledValueIds?: readonly string[];
258
+ }
259
+ /** Single-value PICKLIST fields. */
260
+ export interface PicklistAppField<Scope extends FieldScope = "unscoped"> extends PicklistAppFieldBase<Scope> {
261
+ readonly type: "PICKLIST";
262
+ }
263
+ /** Multi-value MULTI_PICKLIST fields. */
264
+ export interface MultiPicklistAppField<Scope extends FieldScope = "unscoped"> extends PicklistAppFieldBase<Scope> {
265
+ readonly type: "MULTI_PICKLIST";
266
+ }
267
+ /** USER fields (user references). `USER` and `USER_ID` are accepted aliases. */
268
+ export interface UserAppField<Scope extends FieldScope = "unscoped"> extends AspectFieldBase<Scope> {
269
+ readonly type: "USER" | "USER_ID";
270
+ }
271
+ /** GROUP fields (group references). `GROUP` and `GROUP_ID` are accepted aliases. */
272
+ export interface GroupAppField<Scope extends FieldScope = "unscoped"> extends AspectFieldBase<Scope> {
273
+ readonly type: "GROUP" | "GROUP_ID";
274
+ }
275
+ /** ATTACHMENT fields. `mediaTypes` restricts uploads to the listed MIME types. */
276
+ export interface AttachmentAppField<Scope extends FieldScope = "unscoped"> extends AspectFieldBase<Scope> {
277
+ readonly type: "ATTACHMENT" | "ATTACHMENT_ID";
278
+ readonly mediaTypes?: readonly string[];
279
+ }
280
+ /**
281
+ * RELATION fields (`elementum_relation_field`) - a dynamic dropdown whose
282
+ * options are records from another App/Element/Task, distinct from a
283
+ * static PICKLIST (no fixed `options` list at all). `relatedAspectId`/
284
+ * `relatedLabelFieldId` are raw platform ids, not catalog tokens: a
285
+ * non-recursive `ei apps export` never discovers the related aspect's own
286
+ * identity (confirmed live), so there's no catalog entry to resolve them
287
+ * against - same "round-trip the raw id verbatim" escape already used for
288
+ * other genuinely cross-scope references this SDK can't otherwise name.
289
+ */
290
+ export interface RelationAppField<Scope extends FieldScope = "unscoped"> extends AspectFieldBase<Scope> {
291
+ readonly type: "RELATION";
292
+ readonly relatedAspectId: string;
293
+ readonly relatedLabelFieldId: string;
294
+ /** Defaults to `true` on the platform. */
295
+ readonly autoRelate?: boolean;
296
+ }
297
+ /**
298
+ * Branded result of the `calc.*` builder. The brand is opaque on the
299
+ * author surface — agents never construct this directly; they call
300
+ * `calc.if(...)` / `calc.plus(...)` / etc. and the builder returns one
301
+ * of these. The compose serializer reads `toCalcString()` to emit the
302
+ * wire text.
303
+ *
304
+ * Pulled sources carry a different shape (an opaque marker that holds
305
+ * the server's stored expression string verbatim) — the marker is
306
+ * assignable to this slot but its `toCalcString` round-trips the
307
+ * server text byte-for-byte instead of walking a typed AST. See
308
+ * `src/aspects/calc/` for the DSL and (in a follow-up PR) the
309
+ * deserializer's `__pulledExpression` marker.
310
+ */
311
+ export interface CalculationExpression {
312
+ readonly __calc: true;
313
+ readonly toCalcString: () => string;
314
+ }
315
+ /**
316
+ * Calculated fields. The output field type (NUMBER/DECIMAL/TEXT/...)
317
+ * is server-inferred from the expression text; the EDK doesn't declare
318
+ * it explicitly. `numericFormat` is the only format slot supported
319
+ * today (wraps as `AspectReferenceFieldFormat.numeric` on the wire).
320
+ *
321
+ * Authors build `expression` with the `calc.*` builder exported from
322
+ * `src/aspects/index.js`; the compose serializer walks the resulting
323
+ * AST and emits the wire string.
324
+ */
325
+ export interface CalculatedAppField<Scope extends FieldScope = "unscoped"> extends AspectFieldBase<Scope> {
326
+ readonly type: "CALCULATED";
327
+ readonly expression: CalculationExpression;
328
+ readonly numericFormat?: AspectNumericFieldFormat;
329
+ }
330
+ /**
331
+ * Discriminated union of every authorable aspect field. Routed by the
332
+ * `type` literal — TypeScript narrows the variant when authors set
333
+ * `type: "PICKLIST"` etc., so per-variant fields (`numericFormat` on
334
+ * NumberAppField, `picklistValues` on PicklistAppField, etc.) are
335
+ * statically gated to the right variant.
336
+ */
337
+ export type AppField<Scope extends FieldScope = "unscoped"> = TextAppField<Scope> | HandleAppField<Scope> | NumberAppField<Scope> | DecimalAppField<Scope> | BooleanAppField<Scope> | DateAppField<Scope> | DateTimeAppField<Scope> | HtmlAppField<Scope> | JsonAppField<Scope> | PicklistAppField<Scope> | MultiPicklistAppField<Scope> | UserAppField<Scope> | GroupAppField<Scope> | AttachmentAppField<Scope> | RelationAppField<Scope> | CalculatedAppField<Scope>;
338
+ export interface AppAgent {
339
+ readonly id: string;
340
+ readonly name?: string;
341
+ readonly model?: string;
342
+ }
343
+ /**
344
+ * A reusable agentic skill owned by the app — an AI capability bundle
345
+ * (prompt + tools) that one of the app's agents can be granted via
346
+ * `defineAgent({ skills: [...] })`. The agent doesn't author the skill
347
+ * here; it only references it by id/name. Authoring lives on the
348
+ * separate `defineSkill` factory and lands in this bag once deployed.
349
+ */
350
+ export interface AppAgenticSkill {
351
+ readonly id: string;
352
+ readonly name?: string;
353
+ }
354
+ export interface AppSearchTable<TFields extends Record<string, AppField> = {}> {
355
+ readonly id: string;
356
+ readonly name?: string;
357
+ readonly fields: TFields;
358
+ }
359
+ /**
360
+ * Descriptor for one on-demand trigger parameter of a target automation.
361
+ * Produced by `fetch-app-definition.ts` and consumed by `runAutomation`'s
362
+ * static-mode `inputs:` shape, which resolves names to `parameterId` at
363
+ * serialize time so the author never sees a UUID.
364
+ *
365
+ * `type` is required — the renderer reads it from antman's wire
366
+ * (`TriggerParameter.fieldType`, surfaced from mobius's
367
+ * `ServiceTaskParam.fieldType`). Hand-authored `defineApp({ ... })`
368
+ * entries must set it explicitly so `runAutomation`'s input typing can
369
+ * derive value types.
370
+ */
371
+ export interface AppAutomationParam {
372
+ readonly id: string;
373
+ readonly name: string;
374
+ readonly type: WorkflowFieldType;
375
+ readonly multiple?: boolean;
376
+ readonly required?: boolean;
377
+ }
378
+ /**
379
+ * Workflow metadata attached to an automation in an AppAutomation
380
+ * entry — the part the agent needs to pull the automation back as
381
+ * editable source via `defineAutomation.fromJSON`.
382
+ *
383
+ * Substantive type, not a wrapper over the entity-client's `Workflow`:
384
+ * - `id` is required, so the agent can't author an entry with
385
+ * workflow metadata but no actual id (typecheck catches it at
386
+ * `defineApp({...})` construction time).
387
+ * - Surface is narrow to authoring concerns. Heavier wire fields
388
+ * (triggers, tasks, outputs, owner, etc.) live on the
389
+ * entity-client's `Workflow` and are read at pull time, not
390
+ * authored into the AppAutomation entry.
391
+ *
392
+ * Each AppAutomation can carry both `workflowCurrent` (live
393
+ * published version) and `workflowDraft` (in-progress edits) since
394
+ * antman's app definition response surfaces both. The agent picks
395
+ * which to pull at the call site:
396
+ *
397
+ * ```ts
398
+ * defineAutomation.fromJSON(myApp.automations.foo.workflowDraft!)
399
+ * ```
400
+ *
401
+ * (The ref is passed directly, not its `.id` — `fromJSON` takes the
402
+ * typed `AppAutomationWorkflow` shape, mirroring F22's update path.)
403
+ */
404
+ export interface AppAutomationWorkflow<TParams extends Record<string, AppAutomationParam> = {}> {
405
+ /**
406
+ * Runtime-injected discriminator stamped by `defineApp` so the SDK
407
+ * can distinguish a workflow ref from its parent automation ref at
408
+ * tool-config time. Both shapes have the same required surface
409
+ * (`id: string`), so structural typing alone can't tell them apart
410
+ * — `kind` is the runtime safety net. Optional on the type so
411
+ * hand-built test fixtures don't have to set it.
412
+ */
413
+ readonly kind?: "workflow";
414
+ readonly id: string;
415
+ /**
416
+ * On-demand trigger parameters of THIS workflow version, keyed by
417
+ * camelCase parameter name. Emitted by the renderer when the
418
+ * workflow has on-demand parameters; absent when there's no
419
+ * on-demand trigger or no parameters at all. Read at deploy time
420
+ * by `runAutomation`'s static-mode serializer to translate
421
+ * source-side input keys to mobius parameter UUIDs.
422
+ *
423
+ * Lives on the workflow (not on the parent `AppAutomation`)
424
+ * because parameters are versioned with the workflow — an
425
+ * automation's draft can have different params than its current.
426
+ * `runAutomation` references the parent automation; the SDK reads
427
+ * `workflowCurrent.parameters` because mobius dispatches
428
+ * runAutomation to the active version.
429
+ */
430
+ readonly parameters?: TParams;
431
+ }
432
+ export interface AppAutomation<TParams extends Record<string, AppAutomationParam> = {}, TStatus extends "DRAFT" | "ACTIVE" = "ACTIVE"> {
433
+ /**
434
+ * Runtime-injected discriminator stamped by `defineApp`. Pairs with
435
+ * `AppAutomationWorkflow.kind` to let the SDK reject a workflow ref
436
+ * passed where an automation ref was expected (e.g.
437
+ * `agentExecuteWorkflowTool({ automation: ... })`). See the comment
438
+ * on `AppAutomationWorkflow.kind` for the full rationale.
439
+ */
440
+ readonly kind?: "automation";
441
+ readonly id: string;
442
+ readonly name?: string;
443
+ /**
444
+ * Workflow status at the time the app definition was pulled. Codegen
445
+ * emits `"ACTIVE"` when the current workflow is published; otherwise
446
+ * omits or emits `"DRAFT"`. Used by `runAutomation` to reject
447
+ * references to non-active targets at compile time.
448
+ */
449
+ readonly status?: TStatus;
450
+ /**
451
+ * Live published version of this automation. Populated by the agent
452
+ * from the `workflowCurrent` field of the antman app definition
453
+ * response when authoring `defineApp({...})`. Read at pull time
454
+ * via `defineAutomation.fromJSON(myApp.automations.foo.workflowCurrent!)`.
455
+ * Carries the active version's parameters for `runAutomation`
456
+ * static-mode resolution.
457
+ */
458
+ readonly workflowCurrent?: AppAutomationWorkflow<TParams>;
459
+ /**
460
+ * In-progress draft version of this automation. Same shape as
461
+ * `workflowCurrent`. Prefer this when the user asks to "edit" the
462
+ * automation — the draft is the editable surface.
463
+ */
464
+ readonly workflowDraft?: AppAutomationWorkflow<TParams>;
465
+ }
466
+ export interface AppPhoneService {
467
+ readonly id: string;
468
+ readonly description?: string;
469
+ }
470
+ /**
471
+ * Authoring shape of one stage. Read-only — not serialized on
472
+ * aspect compose/update; mutations go through dedicated endpoints.
473
+ *
474
+ * Bag key order encodes workflow order; the wire's `displayOrder`
475
+ * is consumed during pull and not re-exposed here.
476
+ */
477
+ export interface AppStage {
478
+ readonly id: string;
479
+ readonly name: string;
480
+ readonly color?: string;
481
+ readonly icon?: string;
482
+ }
483
+ /**
484
+ * Build a map from field property key → field UUID for the given app.
485
+ * Used by the serializer to rewrite `record.<fieldKey>` → `record.<fieldUUID>`
486
+ * in both trigger and task references. Includes the system `id` field.
487
+ */
488
+ export declare function buildFieldMap(app: App): ReadonlyMap<string, string>;
489
+ /**
490
+ * Build a map from field UUID → field type literal for the given app.
491
+ * Used by the serializer to decide whether a `record.<fieldUuid>` trigger
492
+ * ref placed in a USER_ID / GROUP_ID slot (sendEmail.users / groups) needs
493
+ * an `.id` drill-in: USER and GROUP record fields surface as objects on
494
+ * the wire, and the surrounding slot wants the id specifically.
495
+ */
496
+ export declare function buildFieldTypeByIdMap(app: App): ReadonlyMap<string, string>;
497
+ export type AspectType = "APP" | "ELEMENT" | "TABLE" | "TASK" | "TRANSACTION";
498
+ export interface AppCategory {
499
+ readonly name: string;
500
+ readonly icon?: string;
501
+ readonly color?: string;
502
+ /**
503
+ * Optional category description. The compose endpoint upserts
504
+ * categories by name, so this is only applied when the platform
505
+ * creates a new category — existing-by-name categories keep their own.
506
+ */
507
+ readonly description?: string;
508
+ }
509
+ /**
510
+ * Imported-table cloud mapping surfaced on a pulled aspect backed by
511
+ * an external table (Snowflake today). Carried for round-trip parity;
512
+ * native apps leave it unset.
513
+ */
514
+ export interface AppCloudConnection {
515
+ readonly database?: string;
516
+ readonly schema?: string;
517
+ readonly table?: string;
518
+ readonly readOnly?: boolean;
519
+ }
520
+ /**
521
+ * Minimal structural stand-in for the deleted v1 deploy graph's node shape —
522
+ * kept only so the `App<...>` bag generics below still discriminate builder
523
+ * outputs by their `kind` literal.
524
+ */
525
+ interface Deployable {
526
+ readonly kind: string;
527
+ }
528
+ /**
529
+ * Narrow `Deployable` shapes, discriminated on the `kind` literal every
530
+ * builder output sets (`defineAgent` → `"agent"`, `defineAutomation` →
531
+ * `"automation"`, `defineFlow` → `"flow"`). Used to constrain each App
532
+ * bag so `automations: { myFlow }` or `flows: { myAgent }` are compile
533
+ * errors instead of runtime surprises at deploy time.
534
+ *
535
+ * These are structural (not imported from the builder modules) to avoid
536
+ * a circular import between `core/types/app.ts` and `agents/builder.ts`
537
+ * / `automations/builder.ts` / `flows/builder.ts`. Every builder output
538
+ * satisfies the corresponding shape because its own `kind` field is a
539
+ * literal, not the wider `DeployableKind` union.
540
+ */
541
+ export interface DeployableAgent extends Deployable {
542
+ readonly kind: "agent";
543
+ }
544
+ export interface DeployableAutomation extends Deployable {
545
+ readonly kind: "automation";
546
+ }
547
+ export interface DeployableFlow extends Deployable {
548
+ readonly kind: "flow";
549
+ }
550
+ export interface AppFlow {
551
+ readonly id: string;
552
+ readonly name?: string;
553
+ }
554
+ export interface DeployableApprovalChain extends Deployable {
555
+ readonly kind: "approvalChain";
556
+ }
557
+ export interface DeployableSkill extends Deployable {
558
+ readonly kind: "skill";
559
+ }
560
+ export interface DeployableSearchTable extends Deployable {
561
+ readonly kind: "searchTable";
562
+ }
563
+ export interface AppApprovalChain {
564
+ readonly id: string;
565
+ readonly name?: string;
566
+ }
567
+ /**
568
+ * Each bag accepts both the preloaded "App*" reference shape (from a
569
+ * generated app file — carries a real `.id`) and a freshly-built
570
+ * `Deployable` of the matching kind. A `Deployable`'s id is assigned at
571
+ * deploy time via the late-binding registry.
572
+ */
573
+ export interface App<TFields extends Record<string, AppField> = {}, TAgents extends Record<string, AppAgent | DeployableAgent> = {}, TSearchTables extends Record<string, AppSearchTable | DeployableSearchTable> = {}, TAutomations extends Record<string, AppAutomation | DeployableAutomation> = {}, TPhoneServices extends Record<string, AppPhoneService> = {}, TFlows extends Record<string, AppFlow | DeployableFlow> = {}, TApprovalChains extends Record<string, AppApprovalChain | DeployableApprovalChain> = {}, TAgenticSkills extends Record<string, AppAgenticSkill | DeployableSkill> = {}, TStages extends Record<string, AppStage> = {}, TSystemFields extends Record<string, AppField> = {}> {
574
+ readonly id: string;
575
+ readonly name: string;
576
+ readonly fields: TFields;
577
+ /**
578
+ * Platform-provisioned writable system fields (Title / Status /
579
+ * Stage), keyed by author handle. Populated only by the pull /
580
+ * fetch path — never hand-authored, since the ids are server-
581
+ * assigned. Exposed so record-write surfaces (`createRecord`,
582
+ * `updateField`, agent/skill record tools) can set them by typed
583
+ * ref, e.g. `values: { title: ..., status: (o) => o.inProgress }`.
584
+ *
585
+ * Deliberately a SEPARATE bag from `fields`: the aspect serializer
586
+ * iterates `fields` only, so these never enter the app
587
+ * compose/update payload (re-sending them would collide with the
588
+ * platform's auto-provisioned copies). Read-only system fields (ID,
589
+ * created/updated/closed metadata) are excluded from this bag
590
+ * entirely, which makes them structurally non-writable.
591
+ *
592
+ * Non-optional (like `fields`) so `app.systemFields.<key>` is a
593
+ * direct access without an undefined guard; the factory defaults it
594
+ * to `{}` when no system fields are supplied.
595
+ */
596
+ readonly systemFields: TSystemFields;
597
+ readonly agents: TAgents;
598
+ readonly searchTables: TSearchTables;
599
+ readonly automations: TAutomations;
600
+ readonly phoneServices: TPhoneServices;
601
+ readonly flows: TFlows;
602
+ readonly approvalChains: TApprovalChains;
603
+ readonly agenticSkills: TAgenticSkills;
604
+ readonly stages: TStages;
605
+ readonly handle?: string;
606
+ readonly namespace?: string;
607
+ readonly description?: string;
608
+ readonly type?: AspectType;
609
+ readonly category?: AppCategory;
610
+ readonly icon?: string;
611
+ readonly color?: string;
612
+ /** Cloud link this aspect's records are stored on. */
613
+ readonly cloudLink?: CloudLink;
614
+ /** Imported-table mapping (Snowflake-backed elements). */
615
+ readonly cloudConnection?: AppCloudConnection;
616
+ /**
617
+ * Whether the comments display block is present and unhidden.
618
+ * Sugar over the `displayBlocks` comments entry — the serializer
619
+ * reconciles the two on deploy.
620
+ */
621
+ readonly commentsEnabled?: boolean;
622
+ /** Record-view layout blocks, keyed by author handle. */
623
+ readonly displayBlocks?: DisplayBlockBag;
624
+ /** New-record-form layout blocks, keyed by author handle. */
625
+ readonly recordCreateDisplayBlocks?: DisplayBlockBag;
626
+ /**
627
+ * Produce a json-render `SerializedRenderTree` describing the app
628
+ * as a card with sections for flows, automations, and agents. Built
629
+ * children embed their own `FlowGraph` / `ActivityNode`; pre-loaded
630
+ * `App*` refs render as single neutral leaf nodes (since their
631
+ * internal structure isn't available without a deploy round-trip).
632
+ */
633
+ toUI(): SerializedRenderTree;
634
+ }
635
+ /**
636
+ * Narrow a field map so any entry whose `name` collides with
637
+ * {@link ReservedSystemFieldName} becomes a branded `never`.
638
+ *
639
+ * Since `never` is unassignable from `{ id, name, type }`, the offending
640
+ * entry becomes a `tsc` error at the object-literal position, pointing
641
+ * at the reserved name.
642
+ */
643
+ export type ValidateAppFields<TFields extends Record<string, AppField>> = {
644
+ [K in keyof TFields]: TFields[K]["name"] extends ReservedSystemFieldName ? HasKnownSystemSemanticTag<TFields[K]> extends true ? TFields[K] : _ReservedSystemFieldName<TFields[K]["name"] & string> : TFields[K];
645
+ };
646
+ /**
647
+ * Shared options shape consumed by both the data-only `defineApp`
648
+ * (this file) and the deploy-attached wrapper in
649
+ * `src/aspects/index.ts`. Hoisting the options type to one
650
+ * declaration site means a future addition (e.g. a new optional
651
+ * authoring property) lands in both factories automatically — no
652
+ * silent drift between them.
653
+ *
654
+ * `snapshot` is a type-level discriminator (no runtime use):
655
+ * - Default (`snapshot` omitted or `false`) — agent-authored entry
656
+ * point. `fields` is intersected with {@link ValidateAppFields} so a
657
+ * user field whose `name` collides with {@link ReservedSystemFieldName}
658
+ * is rejected at compile time.
659
+ * - `snapshot: true` — fetched-snapshot entry point emitted by
660
+ * `fetch-app-definition.ts` when rendering an app from antman.
661
+ * Skips the reserved-name check because the data already exists on
662
+ * the server (the brand was designed to catch authoring mistakes,
663
+ * not legitimate fetched state). The agent should only see this
664
+ * flag in `generated/apps/*.ts` files; never write it by hand.
665
+ */
666
+ export interface DefineAppOpts<TFields extends Record<string, AppField> = {}, TAgents extends Record<string, AppAgent | DeployableAgent> = {}, TSearchTables extends Record<string, AppSearchTable | DeployableSearchTable> = {}, TAutomations extends Record<string, AppAutomation | DeployableAutomation> = {}, TPhoneServices extends Record<string, AppPhoneService> = {}, TFlows extends Record<string, AppFlow | DeployableFlow> = {}, TApprovalChains extends Record<string, AppApprovalChain | DeployableApprovalChain> = {}, TAgenticSkills extends Record<string, AppAgenticSkill | DeployableSkill> = {}, TStages extends Record<string, AppStage> = {}, TSnapshot extends boolean = false, TSystemFields extends Record<string, AppField> = {}> {
667
+ readonly id: string;
668
+ readonly name: string;
669
+ readonly snapshot?: TSnapshot;
670
+ readonly fields?: TSnapshot extends true ? TFields : TFields & ValidateAppFields<TFields>;
671
+ /**
672
+ * Writable system fields (Title / Status / Stage). Emitted only by
673
+ * the fetch / pull printer into `generated/apps/*.ts`; never hand-
674
+ * authored (ids are server-assigned). Not run through
675
+ * {@link ValidateAppFields} — this is the one legal home for the
676
+ * reserved system-field names. See {@link App.systemFields}.
677
+ */
678
+ readonly systemFields?: TSystemFields;
679
+ readonly agents?: TAgents;
680
+ readonly searchTables?: TSearchTables;
681
+ readonly automations?: TAutomations;
682
+ readonly phoneServices?: TPhoneServices;
683
+ readonly flows?: TFlows;
684
+ readonly approvalChains?: TApprovalChains;
685
+ readonly agenticSkills?: TAgenticSkills;
686
+ readonly stages?: TStages;
687
+ readonly handle?: string;
688
+ readonly namespace?: string;
689
+ readonly description?: string;
690
+ readonly type?: AspectType;
691
+ readonly category?: AppCategory;
692
+ readonly icon?: string;
693
+ readonly color?: string;
694
+ /** Cloud link this aspect's records are stored on. */
695
+ readonly cloudLink?: CloudLink;
696
+ /** Imported-table mapping (Snowflake-backed elements). */
697
+ readonly cloudConnection?: AppCloudConnection;
698
+ /**
699
+ * Toggle the comments display block. Only available on snapshot
700
+ * sources (pulled via `defineApp.fromJSON(...)`) because the EDK
701
+ * needs the full `displayBlocks` list to reconcile the comments
702
+ * block on update — a fresh create has no list and the platform
703
+ * auto-provisions display blocks without a comments block. To
704
+ * enable comments on a freshly-created app: deploy first, then
705
+ * pull and re-deploy with `commentsEnabled: true`.
706
+ */
707
+ readonly commentsEnabled?: TSnapshot extends true ? boolean : never;
708
+ /** Record-view layout blocks, keyed by author handle. */
709
+ readonly displayBlocks?: DisplayBlockBag;
710
+ /** New-record-form layout blocks, keyed by author handle. */
711
+ readonly recordCreateDisplayBlocks?: DisplayBlockBag;
712
+ }
713
+ export declare function defineApp<const TFields extends Record<string, AppField> = {}, const TAgents extends Record<string, AppAgent | DeployableAgent> = {}, const TSearchTables extends Record<string, AppSearchTable | DeployableSearchTable> = {}, const TAutomations extends Record<string, AppAutomation | DeployableAutomation> = {}, const TPhoneServices extends Record<string, AppPhoneService> = {}, const TFlows extends Record<string, AppFlow | DeployableFlow> = {}, const TApprovalChains extends Record<string, AppApprovalChain | DeployableApprovalChain> = {}, const TAgenticSkills extends Record<string, AppAgenticSkill | DeployableSkill> = {}, const TStages extends Record<string, AppStage> = {}, const TSnapshot extends boolean = false, const TSystemFields extends Record<string, AppField> = {}>(opts: DefineAppOpts<TFields, TAgents, TSearchTables, TAutomations, TPhoneServices, TFlows, TApprovalChains, TAgenticSkills, TStages, TSnapshot, TSystemFields>): App<TFields, TAgents, TSearchTables, TAutomations, TPhoneServices, TFlows, TApprovalChains, TAgenticSkills, TStages, TSystemFields>;
714
+ export type FieldValueType<T extends string> = T extends "TEXT" | "HANDLE" | "HTML" | "RICH_TEXT" | "PICKLIST" ? string : T extends "NUMBER" | "DECIMAL" ? number : T extends "BOOLEAN" ? boolean : T extends "DATE" | "DATETIME" ? string : T extends "USER" | "USER_ID" | "GROUP" | "GROUP_ID" ? string : T extends "UUID" | "ASPECT_ID" | "ASPECT_RECORD_ID" | "ASPECT_FIELD_ID" ? string : T extends "JSON" | "OBJECT" ? unknown : string;
715
+ /**
716
+ * Value type for a single app field: static picklists use `PicklistOption` (one of `options` values);
717
+ * dynamic picklists stay `string`; multi-picklists use arrays of options or strings.
718
+ *
719
+ * Constraint is `AppField<FieldScope>` (any scope) — TS invariance otherwise
720
+ * rejects `AppField<"row">` fed into an `AppField<"unscoped">`-defaulted slot.
721
+ */
722
+ export type FieldValueForAppField<F extends AppField<FieldScope>> = F extends {
723
+ type: "PICKLIST";
724
+ readonly options: infer O extends Readonly<Record<string, PicklistOption>>;
725
+ } ? O[keyof O] : F extends {
726
+ type: "PICKLIST";
727
+ } ? string : F extends {
728
+ type: "MULTI_PICKLIST";
729
+ readonly options: infer O extends Readonly<Record<string, PicklistOption>>;
730
+ } ? ReadonlyArray<O[keyof O] | string> : F extends {
731
+ type: "MULTI_PICKLIST";
732
+ } ? ReadonlyArray<string> : FieldValueType<F["type"]>;
733
+ /**
734
+ * Full row shape for app `A` — field names map to each field’s value type.
735
+ * Use with `Ref<AspectRecord<A>>` anywhere a platform record reference is required.
736
+ *
737
+ * `id` is merged directly into the mapped type rather than via intersection
738
+ * (`{ id: string } & { ... }`) so that `DeepRef<AspectRecord<A>>` can resolve
739
+ * `id` as a valid key. TypeScript does not fully flatten intersections inside
740
+ * conditional mapped types, so `ctx.trigger.record.id` would fail to type-check
741
+ * with the intersection form.
742
+ */
743
+ export type AspectRecord<A extends App> = A extends App<infer TFields, any, any, any, any, any, any, any, any, infer TSystemFields> ? {
744
+ [K in keyof TFields | keyof TSystemFields | "id"]: K extends "id" ? string : K extends keyof TFields ? FieldValueForAppField<TFields[K]> : K extends keyof TSystemFields ? FieldValueForAppField<TSystemFields[K] & AppField> : never;
745
+ } : unknown;
746
+ /**
747
+ * A record ref from *any* app. Used by cross-app tasks (`updateField`,
748
+ * `postComment`) where the task owner's app types the writable fields
749
+ * (via `AppFieldValues<A>`), but the record being acted on may have been
750
+ * produced by a `recordSearch` / trigger / `forEach` over a different
751
+ * app. Every record has at least `id`; other keys vary per app.
752
+ */
753
+ export type AnyAspectRecord = {
754
+ id: string;
755
+ } & Record<string, unknown>;
756
+ export type SearchTableRecord<ST> = ST extends AppSearchTable<infer TFields> ? {
757
+ [K in keyof TFields]: FieldValueForAppField<TFields[K]>;
758
+ } : unknown;
759
+ /**
760
+ * A field descriptor that belongs to app `A` (union of `app.fields.*`).
761
+ * Use for APIs that take field references scoped to one app, e.g. `recordFieldLocking`.
762
+ * Intersection with `AppField` keeps this assignable where `AppField` is required (indexed access widens otherwise).
763
+ */
764
+ export type AppFieldOf<A extends App> = (NonNullable<A["fields"][keyof A["fields"]]> | NonNullable<A["systemFields"][keyof A["systemFields"]]>) & AppField;
765
+ /**
766
+ * Re-tags a `fields` bag so each descriptor carries the `"row"` scope marker.
767
+ * Runtime shape is identical to the source bag — only the type changes, so
768
+ * the `& AppField<"row">` intersection is a zero-cost annotation.
769
+ */
770
+ export type RowScopedFields<TFields extends Record<string, AppField>> = {
771
+ readonly [K in keyof TFields]: TFields[K] & AppField<"row">;
772
+ };
773
+ /**
774
+ * Typed view over any object with a `fields` bag where every descriptor is
775
+ * marked row-scoped. Works for both `App` and `AppSearchTable` — the
776
+ * constraint is structural (`{ fields: Record<string, AppField> }`), not
777
+ * nominal. Handed to callers by a row-filter callback; never constructed at
778
+ * module scope, so `row.fields.X` is the only path that yields an
779
+ * `AppField<"row">` — exactly the shape filter helpers require.
780
+ */
781
+ export type RowProxy<T extends {
782
+ fields: Record<string, AppField>;
783
+ }> = {
784
+ readonly fields: RowScopedFields<T["fields"]>;
785
+ /**
786
+ * Row-scoped view of the app's writable system fields (Title /
787
+ * Status / Stage), so a filter can reference one:
788
+ * `eq(row.systemFields.status, …)`. Empty when the source has none.
789
+ */
790
+ readonly systemFields: T extends {
791
+ systemFields: infer S extends Record<string, AppField>;
792
+ } ? RowScopedFields<S> : Record<string, never>;
793
+ };
794
+ /**
795
+ * Build a row proxy. Runtime-only identity cast — the returned object IS
796
+ * the source; only its static type changes to expose row-scoped fields.
797
+ * Tasks that filter rows call this before invoking the user's callback so
798
+ * the callback argument is typed as `RowProxy<T>`.
799
+ */
800
+ export declare function asRowProxy<T extends {
801
+ fields: Record<string, AppField>;
802
+ }>(source: T): RowProxy<T>;
803
+ /**
804
+ * Static picklist value in tasks: `values: { stage: (options) => options.Assigned }`.
805
+ * `options` is that field's `options` map (same object as `app.fields.<field>.options`).
806
+ */
807
+ export type PicklistOptionsResolver<F extends AppField> = F extends {
808
+ type: "PICKLIST";
809
+ readonly options: infer O extends Readonly<Record<string, PicklistOption>>;
810
+ } ? (options: O) => O[keyof O] : F extends {
811
+ type: "MULTI_PICKLIST";
812
+ readonly options: infer O extends Readonly<Record<string, PicklistOption>>;
813
+ } ? (options: O) => FieldValueForAppField<F> : never;
814
+ /**
815
+ * Allowed `values` entry per field. Static picklists: **only** `(options) => options.X` or `Ref` (e.g. dynamic UUID).
816
+ * Other fields: `ValueOrRef` as usual.
817
+ */
818
+ export type AppFieldInputForTask<F extends AppField> = F extends {
819
+ type: "PICKLIST";
820
+ readonly options: Readonly<Record<string, PicklistOption>>;
821
+ } ? PicklistOptionsResolver<F> | Ref<FieldValueForAppField<F>> : F extends {
822
+ type: "MULTI_PICKLIST";
823
+ readonly options: Readonly<Record<string, PicklistOption>>;
824
+ } ? PicklistOptionsResolver<F> | Ref<FieldValueForAppField<F>> : import("../../entities/shared/ref.js").ValueOrRef<FieldValueForAppField<F>>;
825
+ /** The writable system-field bag of an app, with the optional slot narrowed away. */
826
+ export type SystemFieldsOf<A extends App> = NonNullable<A["systemFields"]>;
827
+ /**
828
+ * Typed `values` shape for `createRecord` / `updateField`. Keys are the
829
+ * app's own field handles AND its system-field handles, so an author can
830
+ * set system-tagged fields in the same object as custom fields:
831
+ *
832
+ * values: { title: "...", status: (o) => o.inProgress, customField: 1 }
833
+ *
834
+ * Whether a field is backend-owned/read-only is decided from deploy state
835
+ * (`system: true`) at plan/apply time; tags alone are not enough.
836
+ */
837
+ export type AppFieldValues<A extends App> = WritableFieldValues<A["fields"]> & WritableFieldValues<SystemFieldsOf<A>>;
838
+ export declare function resolveFieldValues(app: App, values: Record<string, unknown>): Array<{
839
+ fieldId: string;
840
+ value: unknown;
841
+ }>;
842
+ /**
843
+ * Typed `inputs:` shape for `runAutomation` in static mode. Keys are the
844
+ * target automation's on-demand trigger parameter names; values are
845
+ * type-checked against each parameter's declared `WorkflowFieldType`.
846
+ *
847
+ * Unknown keys are a compile error. All entries are optional so callers
848
+ * can omit non-required parameters; runtime validation of `required`
849
+ * parameters is deferred to Mobius.
850
+ *
851
+ * Constraint is over `AppAutomation<any>` so the mapped type can infer
852
+ * `TParams` from a concrete automation passed in.
853
+ */
854
+ export type AutomationInputValues<AA extends AppAutomation<any>> = AA extends AppAutomation<infer TParams> ? [keyof TParams] extends [never] ? Record<string, never> : {
855
+ [K in keyof TParams]?: ValueOrRef<FieldValueType<TParams[K]["type"] extends string ? TParams[K]["type"] : never>>;
856
+ } : never;
857
+ export {};