@elementumai/edk 0.11.0 → 0.13.0

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 (222) hide show
  1. package/README.md +40 -6
  2. package/dist-sdk/src/catalog/factories.d.ts +7 -1
  3. package/dist-sdk/src/catalog/factories.js +2 -0
  4. package/dist-sdk/src/catalog/index.d.ts +2 -2
  5. package/dist-sdk/src/catalog/index.js +1 -1
  6. package/dist-sdk/src/catalog/org.js +79 -34
  7. package/dist-sdk/src/catalog/token.js +5 -0
  8. package/dist-sdk/src/catalog/types.d.ts +7 -1
  9. package/dist-sdk/src/catalog/types.js +3 -0
  10. package/dist-sdk/src/core/system-fields.d.ts +1 -1
  11. package/dist-sdk/src/core/system-fields.js +1 -1
  12. package/dist-sdk/src/core/triggers/on-demand.d.ts +2 -0
  13. package/dist-sdk/src/core/triggers/on-demand.js +3 -0
  14. package/dist-sdk/src/core/types/app.d.ts +6 -0
  15. package/dist-sdk/src/engine/build/context.d.ts +3 -0
  16. package/dist-sdk/src/engine/coverage-gaps.d.ts +5 -0
  17. package/dist-sdk/src/engine/coverage-gaps.js +9 -0
  18. package/dist-sdk/src/engine/ei/run.d.ts +20 -1
  19. package/dist-sdk/src/engine/ei/run.js +102 -14
  20. package/dist-sdk/src/engine/pull/authored-address.js +42 -6
  21. package/dist-sdk/src/engine/pull/authored-root.d.ts +88 -0
  22. package/dist-sdk/src/engine/pull/authored-root.js +306 -0
  23. package/dist-sdk/src/engine/pull/context.d.ts +10 -0
  24. package/dist-sdk/src/engine/pull/field-refs-registry.d.ts +114 -0
  25. package/dist-sdk/src/engine/pull/field-refs-registry.js +501 -0
  26. package/dist-sdk/src/engine/pull/org.d.ts +1 -0
  27. package/dist-sdk/src/engine/pull/org.js +2 -0
  28. package/dist-sdk/src/engine/pull/partition.d.ts +8 -0
  29. package/dist-sdk/src/engine/pull/partition.js +43 -0
  30. package/dist-sdk/src/engine/pull/pulled-roots.d.ts +89 -0
  31. package/dist-sdk/src/engine/pull/pulled-roots.js +203 -0
  32. package/dist-sdk/src/engine/pull/ref-only.d.ts +22 -0
  33. package/dist-sdk/src/engine/pull/ref-only.js +59 -1
  34. package/dist-sdk/src/engine/pull/source-resources.d.ts +39 -0
  35. package/dist-sdk/src/engine/pull/source-resources.js +110 -0
  36. package/dist-sdk/src/engine/pull/stream-root.d.ts +148 -0
  37. package/dist-sdk/src/engine/pull/stream-root.js +563 -0
  38. package/dist-sdk/src/engine/workspace/reserved-catalog-keys.d.ts +47 -0
  39. package/dist-sdk/src/engine/workspace/reserved-catalog-keys.js +115 -0
  40. package/dist-sdk/src/entities/access-policy/build.d.ts +2 -1
  41. package/dist-sdk/src/entities/access-policy/from-tf.d.ts +9 -1
  42. package/dist-sdk/src/entities/access-policy/from-tf.js +25 -4
  43. package/dist-sdk/src/entities/access-policy/module.js +5 -0
  44. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +19 -0
  45. package/dist-sdk/src/entities/access-policy/to-tf.js +65 -8
  46. package/dist-sdk/src/entities/agent/build.d.ts +52 -1
  47. package/dist-sdk/src/entities/agent/build.js +34 -0
  48. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +68 -0
  49. package/dist-sdk/src/entities/agent/from-tf.d.ts +34 -1
  50. package/dist-sdk/src/entities/agent/from-tf.js +262 -2
  51. package/dist-sdk/src/entities/agent/index.d.ts +1 -1
  52. package/dist-sdk/src/entities/agent/to-tf.d.ts +8 -10
  53. package/dist-sdk/src/entities/agent/to-tf.js +158 -14
  54. package/dist-sdk/src/entities/agent-tool/from-tf.js +6 -0
  55. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -2
  56. package/dist-sdk/src/entities/agent-tool/to-tf.js +2 -2
  57. package/dist-sdk/src/entities/app/build.d.ts +34 -14
  58. package/dist-sdk/src/entities/app/build.js +93 -16
  59. package/dist-sdk/src/entities/app/from-tf.js +25 -11
  60. package/dist-sdk/src/entities/app/index.d.ts +1 -0
  61. package/dist-sdk/src/entities/app/index.js +1 -0
  62. package/dist-sdk/src/entities/app/module.js +1 -0
  63. package/dist-sdk/src/entities/app/stage-keys.d.ts +20 -5
  64. package/dist-sdk/src/entities/app/stage-keys.js +43 -9
  65. package/dist-sdk/src/entities/app/to-tf.js +2 -0
  66. package/dist-sdk/src/entities/approval-chain/build.d.ts +46 -11
  67. package/dist-sdk/src/entities/approval-chain/build.js +120 -8
  68. package/dist-sdk/src/entities/approval-chain/from-tf.d.ts +24 -2
  69. package/dist-sdk/src/entities/approval-chain/from-tf.js +148 -6
  70. package/dist-sdk/src/entities/approval-chain/index.d.ts +4 -1
  71. package/dist-sdk/src/entities/approval-chain/index.js +4 -1
  72. package/dist-sdk/src/entities/approval-chain/module.js +23 -5
  73. package/dist-sdk/src/entities/approval-chain/printer.d.ts +1 -1
  74. package/dist-sdk/src/entities/approval-chain/printer.js +91 -5
  75. package/dist-sdk/src/entities/approval-chain/steps-tf.d.ts +77 -0
  76. package/dist-sdk/src/entities/approval-chain/steps-tf.js +255 -0
  77. package/dist-sdk/src/entities/approval-chain/steps.d.ts +71 -0
  78. package/dist-sdk/src/entities/approval-chain/steps.js +83 -0
  79. package/dist-sdk/src/entities/approval-chain/to-tf.d.ts +16 -6
  80. package/dist-sdk/src/entities/approval-chain/to-tf.js +37 -4
  81. package/dist-sdk/src/entities/automation/build.d.ts +50 -24
  82. package/dist-sdk/src/entities/automation/build.js +86 -33
  83. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +52 -8
  84. package/dist-sdk/src/entities/automation/from-tf.d.ts +38 -6
  85. package/dist-sdk/src/entities/automation/from-tf.js +855 -157
  86. package/dist-sdk/src/entities/automation/index.d.ts +2 -1
  87. package/dist-sdk/src/entities/automation/index.js +1 -0
  88. package/dist-sdk/src/entities/automation/module.d.ts +4 -3
  89. package/dist-sdk/src/entities/automation/module.js +33 -12
  90. package/dist-sdk/src/entities/automation/refs-read.d.ts +19 -0
  91. package/dist-sdk/src/entities/automation/refs-read.js +48 -0
  92. package/dist-sdk/src/entities/automation/run-target.d.ts +2 -0
  93. package/dist-sdk/src/entities/automation/run-target.js +5 -0
  94. package/dist-sdk/src/entities/automation/script-code.d.ts +2 -1
  95. package/dist-sdk/src/entities/automation/script-code.js +82 -1
  96. package/dist-sdk/src/entities/automation/script-lint.d.ts +13 -0
  97. package/dist-sdk/src/entities/automation/script-lint.js +418 -0
  98. package/dist-sdk/src/entities/automation/slack-message-refs.d.ts +9 -0
  99. package/dist-sdk/src/entities/automation/slack-message-refs.js +75 -0
  100. package/dist-sdk/src/entities/automation/task-output-labels.d.ts +12 -1
  101. package/dist-sdk/src/entities/automation/task-output-labels.js +32 -1
  102. package/dist-sdk/src/entities/automation/tasks.d.ts +76 -18
  103. package/dist-sdk/src/entities/automation/tasks.js +52 -15
  104. package/dist-sdk/src/entities/automation/to-tf.d.ts +3 -0
  105. package/dist-sdk/src/entities/automation/to-tf.js +585 -97
  106. package/dist-sdk/src/entities/automation/triggers.d.ts +48 -23
  107. package/dist-sdk/src/entities/automation/triggers.js +27 -12
  108. package/dist-sdk/src/entities/automation/unsafe-script-output.d.ts +50 -0
  109. package/dist-sdk/src/entities/automation/unsafe-script-output.js +92 -0
  110. package/dist-sdk/src/entities/chart/build.d.ts +18 -2
  111. package/dist-sdk/src/entities/chart/from-tf.d.ts +2 -2
  112. package/dist-sdk/src/entities/chart/from-tf.js +28 -1
  113. package/dist-sdk/src/entities/chart/index.d.ts +1 -1
  114. package/dist-sdk/src/entities/chart/printer.js +5 -2
  115. package/dist-sdk/src/entities/chart/to-tf.js +38 -3
  116. package/dist-sdk/src/entities/dynamic-layout/build.d.ts +3 -0
  117. package/dist-sdk/src/entities/dynamic-layout/condition-keys.d.ts +48 -0
  118. package/dist-sdk/src/entities/dynamic-layout/condition-keys.js +261 -0
  119. package/dist-sdk/src/entities/dynamic-layout/from-tf.js +45 -6
  120. package/dist-sdk/src/entities/dynamic-layout/module.js +2 -1
  121. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +46 -12
  122. package/dist-sdk/src/entities/element/audit-field-guard.d.ts +9 -0
  123. package/dist-sdk/src/entities/element/audit-field-guard.js +88 -0
  124. package/dist-sdk/src/entities/element/build.js +2 -1
  125. package/dist-sdk/src/entities/element/from-tf.js +15 -2
  126. package/dist-sdk/src/entities/element/module.js +3 -0
  127. package/dist-sdk/src/entities/element/system-fields.d.ts +13 -0
  128. package/dist-sdk/src/entities/element/system-fields.js +23 -0
  129. package/dist-sdk/src/entities/element/to-tf.js +2 -0
  130. package/dist-sdk/src/entities/field/build.d.ts +9 -0
  131. package/dist-sdk/src/entities/field/from-tf.d.ts +29 -1
  132. package/dist-sdk/src/entities/field/from-tf.js +99 -6
  133. package/dist-sdk/src/entities/field/module.js +12 -2
  134. package/dist-sdk/src/entities/field/to-tf.d.ts +13 -3
  135. package/dist-sdk/src/entities/field/to-tf.js +90 -46
  136. package/dist-sdk/src/entities/org/category.js +1 -0
  137. package/dist-sdk/src/entities/org/index.d.ts +1 -0
  138. package/dist-sdk/src/entities/org/index.js +1 -0
  139. package/dist-sdk/src/entities/org/role.js +5 -0
  140. package/dist-sdk/src/entities/org/voice-auth.d.ts +5 -0
  141. package/dist-sdk/src/entities/org/voice-auth.js +33 -0
  142. package/dist-sdk/src/entities/organization/build.d.ts +3 -0
  143. package/dist-sdk/src/entities/organization/build.js +2 -0
  144. package/dist-sdk/src/entities/organization/index.d.ts +1 -0
  145. package/dist-sdk/src/entities/organization/index.js +1 -0
  146. package/dist-sdk/src/entities/organization/to-tf.d.ts +2 -0
  147. package/dist-sdk/src/entities/organization/to-tf.js +59 -1
  148. package/dist-sdk/src/entities/organization/voice-auth.d.ts +60 -0
  149. package/dist-sdk/src/entities/organization/voice-auth.js +60 -0
  150. package/dist-sdk/src/entities/phone-service/build.d.ts +9 -1
  151. package/dist-sdk/src/entities/phone-service/build.js +1 -0
  152. package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.js +3 -0
  153. package/dist-sdk/src/entities/phone-service/from-tf.d.ts +1 -0
  154. package/dist-sdk/src/entities/phone-service/from-tf.js +8 -1
  155. package/dist-sdk/src/entities/phone-service/to-tf.js +16 -0
  156. package/dist-sdk/src/entities/record-create-form/from-tf.js +2 -2
  157. package/dist-sdk/src/entities/relationship/from-tf.js +7 -2
  158. package/dist-sdk/src/entities/relationship/module.js +2 -2
  159. package/dist-sdk/src/entities/relationship/pair-check.d.ts +6 -2
  160. package/dist-sdk/src/entities/relationship/pair-check.js +105 -18
  161. package/dist-sdk/src/entities/relationship/to-tf.js +5 -2
  162. package/dist-sdk/src/entities/role/permission-levels.d.ts +7 -0
  163. package/dist-sdk/src/entities/role/permission-levels.js +78 -0
  164. package/dist-sdk/src/entities/role/to-tf.js +32 -2
  165. package/dist-sdk/src/entities/service-account/module.d.ts +2 -1
  166. package/dist-sdk/src/entities/service-account/module.js +9 -1
  167. package/dist-sdk/src/entities/service-account/resource-type.d.ts +2 -0
  168. package/dist-sdk/src/entities/service-account/resource-type.js +2 -0
  169. package/dist-sdk/src/entities/service-account/role-fidelity.d.ts +5 -5
  170. package/dist-sdk/src/entities/service-account/role-fidelity.js +21 -13
  171. package/dist-sdk/src/entities/service-account/role-membership-check.d.ts +20 -0
  172. package/dist-sdk/src/entities/service-account/role-membership-check.js +80 -0
  173. package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +15 -0
  174. package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +36 -0
  175. package/dist-sdk/src/entities/shared/filters/ast.d.ts +4 -0
  176. package/dist-sdk/src/entities/shared/filters/index.d.ts +85 -14
  177. package/dist-sdk/src/entities/shared/filters/index.js +18 -6
  178. package/dist-sdk/src/entities/shared/filters/option-lookups.d.ts +57 -0
  179. package/dist-sdk/src/entities/shared/filters/option-lookups.js +108 -0
  180. package/dist-sdk/src/entities/shared/filters/print.js +9 -5
  181. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +12 -7
  182. package/dist-sdk/src/entities/shared/filters/tf-codec.js +9 -5
  183. package/dist-sdk/src/entities/shared/raw-option-id.d.ts +30 -0
  184. package/dist-sdk/src/entities/shared/raw-option-id.js +41 -0
  185. package/dist-sdk/src/entities/shared/tool-field-ref.js +6 -2
  186. package/dist-sdk/src/entities/shared/types/field-types.d.ts +6 -3
  187. package/dist-sdk/src/entities/shared/types/field-types.js +3 -1
  188. package/dist-sdk/src/entities/skill/input-coverage.js +5 -2
  189. package/dist-sdk/src/entities/skill/module.js +2 -0
  190. package/dist-sdk/src/entities/sla/build.d.ts +96 -0
  191. package/dist-sdk/src/entities/sla/build.js +124 -0
  192. package/dist-sdk/src/entities/sla/from-tf.d.ts +40 -0
  193. package/dist-sdk/src/entities/sla/from-tf.js +164 -0
  194. package/dist-sdk/src/entities/sla/index.d.ts +1 -0
  195. package/dist-sdk/src/entities/sla/index.js +1 -0
  196. package/dist-sdk/src/entities/sla/module.d.ts +4 -0
  197. package/dist-sdk/src/entities/sla/module.js +73 -0
  198. package/dist-sdk/src/entities/sla/printer.d.ts +2 -0
  199. package/dist-sdk/src/entities/sla/printer.js +84 -0
  200. package/dist-sdk/src/entities/sla/to-tf.d.ts +12 -0
  201. package/dist-sdk/src/entities/sla/to-tf.js +81 -0
  202. package/dist-sdk/src/entities/table/build.d.ts +7 -2
  203. package/dist-sdk/src/entities/table/build.js +22 -1
  204. package/dist-sdk/src/entities/table/deserializer/normalize.d.ts +4 -1
  205. package/dist-sdk/src/entities/table/from-tf.js +89 -14
  206. package/dist-sdk/src/entities/table/index.d.ts +1 -1
  207. package/dist-sdk/src/entities/table/to-tf.js +41 -2
  208. package/dist-sdk/src/entities/task/from-tf.js +2 -1
  209. package/dist-sdk/src/entities/task/to-tf.js +1 -0
  210. package/dist-sdk/src/entities/view/from-tf.d.ts +8 -4
  211. package/dist-sdk/src/entities/view/from-tf.js +10 -9
  212. package/dist-sdk/src/entities/view/module.js +5 -0
  213. package/dist-sdk/src/entities/widget/from-tf.js +15 -4
  214. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +51 -4
  215. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
  216. package/dist-sdk/src/graph/index.d.ts +20 -2
  217. package/dist-sdk/src/graph/index.js +19 -0
  218. package/dist-sdk/src/graph/modules.js +11 -1
  219. package/dist-sdk/src/graph/resource-types.d.ts +47 -0
  220. package/dist-sdk/src/graph/resource-types.js +62 -0
  221. package/dist-sdk/src/graph/types.d.ts +116 -6
  222. package/package.json +6 -3
package/README.md CHANGED
@@ -51,6 +51,25 @@ elementum auth login --profile <profile>
51
51
  elementum --profile=<profile> auth status
52
52
  ```
53
53
 
54
+ `auth login` asks how to sign in. **Browser** (recommended) needs only your
55
+ Elementum URL: the browser opens, you click **Approve**, and the organization,
56
+ environment and profile name are filled in from the URL. Pass the URL to skip
57
+ the form, with or without a terminal:
58
+
59
+ ```sh
60
+ elementum auth login --url https://acme.elementum.io
61
+ ```
62
+
63
+ A browser login stores no client secret. Its tokens are kept in the OS keychain
64
+ and renew automatically for 30 days from the last use, up to 90 days from the
65
+ sign-in; approving requires the CREATE_OAUTH_TOKENS permission in the org.
66
+ It works for every command, `plan` and `apply` included. `auth env` prints its
67
+ current access token (good for up to 24 hours, it does not renew), and `auth
68
+ export` carries the profile's settings without its tokens, so you sign in once
69
+ on the other machine. **Client ID and secret** (from an OAuth token created on
70
+ the OAuth settings page) remains available, for CI and other places where no
71
+ one can click Approve.
72
+
54
73
  A profile selects the organization, instance, optional organization
55
74
  environment, credentials, and custom endpoints. Pass it explicitly before any
56
75
  command when reproducibility matters:
@@ -195,6 +214,8 @@ elementum pull app <namespace> [--root <orgRoot>] [--no-adopt] [--skip-unsupport
195
214
  elementum pull element <namespace> [--root <orgRoot>] [--no-adopt] [--skip-unsupported-layouts] [--portable [--map <file>]]
196
215
  elementum pull task <namespace> [--root <orgRoot>] [--no-adopt] [--portable [--map <file>]]
197
216
  elementum pull --restore-previous [--root <orgRoot>] # after a failed pull: .tf/in.previous -> .tf/in (failed copy kept as .tf/in.failed); never automatic
217
+ # A failed `pull app`/`pull element` adoption settles the .ts itself: unchanged state puts apps|elements/<ref>/ back as it was before
218
+ # the pull (pulled copy kept under .edk-state/failed-pulls/); changed state keeps the pulled source (previous copy kept there instead).
198
219
  elementum clone app <namespace> --as <newName> [--namespace <newns>] [--root <orgRoot>] [--target-root <destOrgRoot>] [--map <file>]
199
220
  elementum build [orgRoot]
200
221
  elementum plan [orgRoot-or-nested-target] [--json] [bridge args...]
@@ -203,7 +224,9 @@ elementum plan --smart [--base <branch>] [orgRoot-or-nested-target] [bridge args
203
224
  elementum apply --smart [--base <branch>] [orgRoot-or-nested-target] [-auto-approve] [bridge args...]
204
225
 
205
226
  elementum list apps|elements|users|groups|categories|cloud-links
206
- elementum list ai-provider-connectors|automations|tables
227
+ elementum list ai-provider-connectors|automations|tables|portals
228
+ elementum list relationships <namespace-or-id> [--json] # read-only: the related end and column mappings of each relationship
229
+ elementum apps export <namespace> [--recursive=false] [--directory <dir>] # raw Terraform export (runs the bridge's `ei apps export`)
207
230
  elementum new category --name "Operations"
208
231
  elementum new app --name "Support Tickets" --namespace support --category "Operations" --handle SUPPORT
209
232
  elementum new element --name "Locations" --namespace locations --category "Operations" --handle LOCATION
@@ -219,6 +242,15 @@ elementum playbooks list|install|status|path|print
219
242
  `auth` and other bridge-owned commands route through the managed bridge. Run
220
243
  `elementum --help` for the combined local and bridge command surface.
221
244
 
245
+ `elementum apps export` is the supported way to get a raw Terraform export of a
246
+ live app. It is a pass-through to the bridge's `ei apps export`, which does the
247
+ work: the same flags, the same output, and the same exit code. When an export
248
+ stops on an incomplete read, the error names the read. If the platform sent
249
+ errors, it also gives their message and ends with a `[not retried: …]` or
250
+ `[retries exhausted …]` detail. A stop with no platform errors (for example a
251
+ null workflow and no GraphQL errors) has no bracket. Report the error as
252
+ printed. Use `elementum apps export` rather than calling `ei` directly.
253
+
222
254
  `build` loads app, element, and supported child authoring files and replaces its
223
255
  marker-owned files under `.tf/out/`; it never calls the platform. `plan` and
224
256
  `apply` run from `.tf/out/`, initialize OpenTofu there when necessary, and
@@ -287,10 +319,12 @@ The server exposes `run` (any CLI command as argument tokens after
287
319
  login, auth-check, pull/build/plan/apply, and pass profiles. Nested
288
320
  `mcp`/`canvas`/`chat` are refused, as are `auth env` / `auth export` /
289
321
  `auth import` (credential dump or passphrase TTY). `auth login` over MCP is
290
- non-interactive: it reads `ELEMENTUM_ORGANIZATION`, `ELEMENTUM_INSTANCE`,
291
- `ELEMENTUM_CLIENT_ID`, `ELEMENTUM_CLIENT_SECRET`, and optional
292
- `ELEMENTUM_PROFILE` (or the matching flags) and persists a profile. A human
293
- TTY login still uses the form. `apply` still goes through the real CLI; after
322
+ non-interactive. With `["auth", "login", "--url", "<the user's Elementum
323
+ URL>"]` it opens the user's browser and waits up to five minutes for them to
324
+ click **Approve**, then persists a profile. Without `--url` it reads
325
+ `ELEMENTUM_ORGANIZATION`, `ELEMENTUM_INSTANCE`, `ELEMENTUM_CLIENT_ID`,
326
+ `ELEMENTUM_CLIENT_SECRET`, and optional `ELEMENTUM_PROFILE` (or the matching
327
+ flags). A human TTY login still uses the form. `apply` still goes through the real CLI; after
294
328
  the user reviews the plan, use `["apply", "-auto-approve"]` (stdin is not a
295
329
  TTY, so a bare apply cannot prompt).
296
330
 
@@ -643,7 +677,7 @@ GitHub Actions job (the public signed toolchain is macOS-only today) looks like:
643
677
  ```yaml
644
678
  jobs:
645
679
  apply:
646
- runs-on: macos-14
680
+ runs-on: macos-26
647
681
  concurrency:
648
682
  group: elementum-prod
649
683
  cancel-in-progress: false
@@ -21,7 +21,7 @@
21
21
  * nothing reads those interim values.
22
22
  */
23
23
  import type { AiProviderLlmModel, AiProviderType } from "./ai-provider-models.js";
24
- import type { AgentEvaluationRef, AgentRef, AppCatalogRef, AppOrElementRef, AiProviderRef, ApprovalChainRef, AutomationCatalogRef, CatalogRef, CategoryRef, ChartRef, DashboardRef, WidgetRef, CloudLinkRef, ConnectorRef, DatamineRef, RelationshipRef, GroupRef, PhoneProviderRef, PhoneServiceRef, ProcedureParameterType, ProcedureRef, FileReaderCatalogRef, DocumentModelFieldRef, ElementCatalogRef, FieldRef, ViewRef, ViewType, OutputPropertyRef, RecordIdentityRef, SearchTableRef, StoredFunctionRef, StoredFunctionScalarType, SkillRef, TableColumnRef, TableOwnedSearchTableRef, TableRef, TaskCatalogRef, TriggerParameterRef } from "./types.js";
24
+ import type { AgentEvaluationRef, AgentRef, AppCatalogRef, AppOrElementRef, AiProviderRef, ApprovalChainRef, AutomationCatalogRef, CatalogRef, CategoryRef, ChartRef, DashboardRef, WidgetRef, CloudLinkRef, ConnectorRef, DatamineRef, RelationshipRef, GroupRef, PhoneProviderRef, PhoneServiceRef, VoiceAuthRef, ProcedureParameterType, ProcedureRef, FileReaderCatalogRef, DocumentModelFieldRef, ElementCatalogRef, FieldRef, ViewRef, ViewType, OutputPropertyRef, RecordIdentityRef, SearchTableRef, StoredFunctionRef, StoredFunctionScalarType, SkillRef, TableColumnRef, TableOwnedSearchTableRef, TableRef, TaskCatalogRef, TriggerParameterRef } from "./types.js";
25
25
  export declare function recordIdentity<const Target extends AppOrElementRef | TaskCatalogRef | TableRef>(target: Target): RecordIdentityRef<Target>;
26
26
  /** Fixed platform user-directory schema used by userSearch filters. */
27
27
  export declare const usersCatalog: {
@@ -308,6 +308,10 @@ export declare const phoneProviderRef: (opts: Omit<PhoneProviderRef, "refName" |
308
308
  readonly __kind: "phoneProvider";
309
309
  readonly refName: string;
310
310
  };
311
+ export declare const voiceAuthRef: (opts: Omit<VoiceAuthRef, "refName" | "__kind">) => Omit<VoiceAuthRef, "refName" | "__kind"> & {
312
+ readonly __kind: "voiceAuth";
313
+ readonly refName: string;
314
+ };
311
315
  export declare function tableColumnRef(opts: Omit<TableColumnRef, "__kind" | "refName" | "parent"> & {
312
316
  readonly parent?: string;
313
317
  }): TableColumnRef;
@@ -392,6 +396,7 @@ export declare function elementCatalog<const RefName extends string, B extends E
392
396
  */
393
397
  type PhoneProviderOrgCatalogBag = {
394
398
  readonly phoneProviders: Readonly<Record<string, PhoneProviderRef>>;
399
+ readonly voiceAuths: Readonly<Record<string, VoiceAuthRef>>;
395
400
  };
396
401
  export declare function orgCatalog<B extends {
397
402
  aiProviders?: Record<string, AiProviderRef>;
@@ -399,6 +404,7 @@ export declare function orgCatalog<B extends {
399
404
  categories?: Record<string, CategoryRef>;
400
405
  groups?: Record<string, GroupRef>;
401
406
  phoneProviders?: Record<string, PhoneProviderRef>;
407
+ voiceAuths?: Record<string, VoiceAuthRef>;
402
408
  tables?: Record<string, TableRef>;
403
409
  }>(bags: B): {
404
410
  readonly handle: "org";
@@ -243,6 +243,7 @@ export function procedureRef(opts) {
243
243
  export const categoryRef = refFactory("category");
244
244
  export const groupRef = refFactory("group");
245
245
  export const phoneProviderRef = refFactory("phoneProvider");
246
+ export const voiceAuthRef = refFactory("voiceAuth");
246
247
  export function tableColumnRef(opts) {
247
248
  return {
248
249
  __kind: "tableColumn",
@@ -496,6 +497,7 @@ export function orgCatalog(bags) {
496
497
  categories: withOwnKeyAsHandle(bags.categories) ?? {},
497
498
  groups: withOwnKeyAsHandle(bags.groups) ?? {},
498
499
  phoneProviders: withOwnKeyAsHandle(bags.phoneProviders) ?? {},
500
+ voiceAuths: withOwnKeyAsHandle(bags.voiceAuths) ?? {},
499
501
  tables: stampTableRefs(bags.tables) ?? {},
500
502
  };
501
503
  }
@@ -4,9 +4,9 @@
4
4
  * ids appear here (identity lives in `src/deploy/state`).
5
5
  */
6
6
  export { AI_PROVIDER_LLM_MODELS, type AiProviderLlmModel, type AiProviderType } from "./ai-provider-models.js";
7
- export { REF_SCOPE, REF_UPDATABLE, type AgentRef, type AgentEvaluationRef, type AiProviderRef, type ApprovalChainRef, type ApprovalProcessRef, type AppCatalogRef, type AppOrElementRef, type AutomationCatalogRef, type AutomationRef, type CatalogRef, type CatalogRefKind, type CategoryRef, type ChartRef, type DashboardRef, type WidgetRef, type CloudLinkRef, type AiServiceRef, type ConnectorRef, type GroupRef, type PhoneProviderRef, type PhoneServiceRef, PROCEDURE_PARAMETER_TYPES, type ProcedureParameterType, type ProcedureRef, type FileReaderCatalogRef, type DocumentModelFieldRef, type ElementCatalogRef, type TaskCatalogRef, type AppOrElementOrTaskRef, type FieldRef, type OutputPropertyRef, type RecordIdentityRef, type SearchTableRef, type TableOwnedSearchTableRef, type StoredFunctionRef, type StoredFunctionScalarType, type DatamineRef, type RelationshipRef, type SkillRef, type TableColumnRef, type TableRef, type TriggerParameterRef, USER_FIELD_KEYS, type UserFieldKey, type UserFieldRef, USER_GROUP_FIELD_KEYS, type UserGroupFieldKey, type UserGroupFieldRef, viewType, type ViewRef, type ViewType, } from "./types.js";
7
+ export { REF_SCOPE, REF_UPDATABLE, type AgentRef, type AgentEvaluationRef, type AiProviderRef, type ApprovalChainRef, type ApprovalProcessRef, type AppCatalogRef, type AppOrElementRef, type AutomationCatalogRef, type AutomationRef, type CatalogRef, type CatalogRefKind, type CategoryRef, type ChartRef, type DashboardRef, type WidgetRef, type CloudLinkRef, type AiServiceRef, type ConnectorRef, type GroupRef, type PhoneProviderRef, type VoiceAuthRef, type PhoneServiceRef, PROCEDURE_PARAMETER_TYPES, type ProcedureParameterType, type ProcedureRef, type FileReaderCatalogRef, type DocumentModelFieldRef, type ElementCatalogRef, type TaskCatalogRef, type AppOrElementOrTaskRef, type FieldRef, type OutputPropertyRef, type RecordIdentityRef, type SearchTableRef, type TableOwnedSearchTableRef, type StoredFunctionRef, type StoredFunctionScalarType, type DatamineRef, type RelationshipRef, type SkillRef, type TableColumnRef, type TableRef, type TriggerParameterRef, USER_FIELD_KEYS, type UserFieldKey, type UserFieldRef, USER_GROUP_FIELD_KEYS, type UserGroupFieldKey, type UserGroupFieldRef, viewType, type ViewRef, type ViewType, } from "./types.js";
8
8
  export { renderBarrel, renderCatalog, renderFragment, type BarrelEntry, type BarrelRoot, } from "./render.js";
9
9
  export { appCatalogTarget, barrelPathFor, orgCatalogTarget, regenerateBarrel, writeCatalog, writeFlatCatalog, writeFragment, type CatalogTarget, } from "./write.js";
10
10
  export { isCatalogToken, slimToken, slimTokens } from "./token.js";
11
11
  export { buildAppCatalogFromAuthoring, listEntityFilesFromPaths, refNameOf, regenerateAppCatalogsUnder, writeAppCatalog, writeAppCatalogFromAuthoring, type AppAuthoringCatalog, type AppCatalogRegenResult, type ConfiguredEntity, } from "./from-authoring.js";
12
- export { agentRef, agentEvaluationRef, appRef, appCatalog, approvalChainRef, automationRef, categoryRef, chartRef, dashboardRef, widgetRef, cloudLinkRef, connectorRef, aiProvider, groupRef, linkedSearchTableRef, phoneProviderRef, phoneServiceRef, procedureRef, documentModelFieldRef, documentModelRef, elementCatalog, elementRef, fieldRef, orgCatalog, outputPropertyRef, recordIdentity, searchTableRef, datamineRef, relationshipRef, skillRef, storedFunctionRef, tableColumnRef, tableRef, tableSearchTableRef, taskRef, triggerParameterRef, userGroupsCatalog, usersCatalog, viewRef, type CatalogViewRefOptions, type OutsideViewRefOptions, } from "./factories.js";
12
+ export { agentRef, agentEvaluationRef, appRef, appCatalog, approvalChainRef, automationRef, categoryRef, chartRef, dashboardRef, widgetRef, cloudLinkRef, connectorRef, aiProvider, groupRef, linkedSearchTableRef, phoneProviderRef, phoneServiceRef, voiceAuthRef, procedureRef, documentModelFieldRef, documentModelRef, elementCatalog, elementRef, fieldRef, orgCatalog, outputPropertyRef, recordIdentity, searchTableRef, datamineRef, relationshipRef, skillRef, storedFunctionRef, tableColumnRef, tableRef, tableSearchTableRef, taskRef, triggerParameterRef, userGroupsCatalog, usersCatalog, viewRef, type CatalogViewRefOptions, type OutsideViewRefOptions, } from "./factories.js";
@@ -9,4 +9,4 @@ export { renderBarrel, renderCatalog, renderFragment, } from "./render.js";
9
9
  export { appCatalogTarget, barrelPathFor, orgCatalogTarget, regenerateBarrel, writeCatalog, writeFlatCatalog, writeFragment, } from "./write.js";
10
10
  export { isCatalogToken, slimToken, slimTokens } from "./token.js";
11
11
  export { buildAppCatalogFromAuthoring, listEntityFilesFromPaths, refNameOf, regenerateAppCatalogsUnder, writeAppCatalog, writeAppCatalogFromAuthoring, } from "./from-authoring.js";
12
- export { agentRef, agentEvaluationRef, appRef, appCatalog, approvalChainRef, automationRef, categoryRef, chartRef, dashboardRef, widgetRef, cloudLinkRef, connectorRef, aiProvider, groupRef, linkedSearchTableRef, phoneProviderRef, phoneServiceRef, procedureRef, documentModelFieldRef, documentModelRef, elementCatalog, elementRef, fieldRef, orgCatalog, outputPropertyRef, recordIdentity, searchTableRef, datamineRef, relationshipRef, skillRef, storedFunctionRef, tableColumnRef, tableRef, tableSearchTableRef, taskRef, triggerParameterRef, userGroupsCatalog, usersCatalog, viewRef, } from "./factories.js";
12
+ export { agentRef, agentEvaluationRef, appRef, appCatalog, approvalChainRef, automationRef, categoryRef, chartRef, dashboardRef, widgetRef, cloudLinkRef, connectorRef, aiProvider, groupRef, linkedSearchTableRef, phoneProviderRef, phoneServiceRef, voiceAuthRef, procedureRef, documentModelFieldRef, documentModelRef, elementCatalog, elementRef, fieldRef, orgCatalog, outputPropertyRef, recordIdentity, searchTableRef, datamineRef, relationshipRef, skillRef, storedFunctionRef, tableColumnRef, tableRef, tableSearchTableRef, taskRef, triggerParameterRef, userGroupsCatalog, usersCatalog, viewRef, } from "./factories.js";
@@ -26,6 +26,8 @@ import { sanitizeName, tfLabelToTsLabel, tsLabelToTfLabel } from "../engine/tf/i
26
26
  import { sdkPackageSpecifier } from "../internal/sdk-package.js";
27
27
  import { OrgExtractError } from "../engine/pull/org.js";
28
28
  import { writeTechnicalLog } from "../engine/progress.js";
29
+ import { computeElementKeys, isGeneratedOnlyFolder, isShadowedCatalogKey, ORG_CATALOG_KEYS, shadowedFolderWarning, } from "../engine/workspace/reserved-catalog-keys.js";
30
+ import { reservedRootFolder } from "../engine/pull/authored-root.js";
29
31
  // ---------------------------------------------------------------------------
30
32
  // Public entry points
31
33
  // ---------------------------------------------------------------------------
@@ -97,20 +99,25 @@ async function readBarrelState(root) {
97
99
  const worktree = await readOptional(join(root, BARREL_RELATIVE_PATH));
98
100
  const git = barrelGitStatus(root);
99
101
  const barrel = worktree ?? (git.kind === "tracked" ? indexedBarrel(root) : undefined);
102
+ const listed = new Set(barrel === undefined ? [] : [...barrel.matchAll(BARREL_ENTRY_PATH)].map((m) => `${m[1]}/${m[2]}`));
103
+ // A listed table entry may be kept (keptReason), and then `tables` is emitted.
104
+ const keptTables = git.kind !== "untracked" && [...listed].some((e) => e.startsWith("tables/"));
100
105
  const handles = await discoverOrgRootHandles(root);
106
+ const droppedSet = shadowedBarrelRoots(root, handles, keptTables);
101
107
  const expected = new Set([
102
108
  ...handles.appHandles.map((h) => `apps/${h}`),
103
109
  ...handles.elementHandles.map((h) => `elements/${h}`),
104
110
  ...handles.tableHandles.map((h) => `tables/${h}`),
105
- ]);
106
- const listed = new Set(barrel === undefined ? [] : [...barrel.matchAll(BARREL_ENTRY_PATH)].map((m) => `${m[1]}/${m[2]}`));
111
+ ].filter((e) => !droppedSet.has(e)));
107
112
  const expectedFolded = new Set([...expected].map((e) => e.toLowerCase()));
108
- const notExpected = [...listed].filter((e) => !expected.has(e));
113
+ const notExpected = [...listed].filter((e) => !expected.has(e) && !droppedSet.has(e));
109
114
  return {
110
115
  present: worktree !== undefined,
111
116
  shadowed: notExpected.filter((e) => expectedFolded.has(e.toLowerCase())).sort(),
112
117
  git,
113
118
  handles,
119
+ reservedListed: [...listed].filter((e) => droppedSet.has(e)).sort(),
120
+ shadowedRoots: [...droppedSet].sort(),
114
121
  missing: [...expected].filter((e) => !listed.has(e)).sort(),
115
122
  stale: notExpected.filter((e) => !expectedFolded.has(e.toLowerCase())).sort(),
116
123
  };
@@ -166,10 +173,11 @@ export async function refreshCatalogBarrel(root) {
166
173
  const { missing, stale } = state;
167
174
  const reason = keptReason(state);
168
175
  const kept = { keptStale: reason !== undefined, ...(reason !== undefined && { keptReason: reason }) };
169
- if (state.present && missing.length === 0 && state.shadowed.length === 0 && (stale.length === 0 || reason !== undefined)) {
176
+ if (state.present && missing.length === 0 && state.shadowed.length === 0 && state.reservedListed.length === 0 &&
177
+ (stale.length === 0 || reason !== undefined)) {
170
178
  await ensureBarrelIgnored(root);
171
179
  const entries = state.handles.appHandles.length + state.handles.elementHandles.length +
172
- state.handles.tableHandles.length + (reason === undefined ? 0 : stale.length);
180
+ state.handles.tableHandles.length - state.shadowedRoots.length + (reason === undefined ? 0 : stale.length);
173
181
  return { missing, stale, created: false, written: false, entries, ...kept };
174
182
  }
175
183
  const entries = await writeBarrel(root, state);
@@ -640,6 +648,21 @@ function renderAiProvidersBag(extract) {
640
648
  lines.push(" },");
641
649
  return lines;
642
650
  }
651
+ /**
652
+ * The org entries renderBarrel writes after the app and element getters, in
653
+ * ORG_CATALOG_KEYS order. Keyed by that list, so the reserved names pull and
654
+ * `elementum new` avoid (edk#2839) can't drift from what the barrel emits.
655
+ */
656
+ const ORG_CATALOG_ENTRY_VALUES = {
657
+ users: "usersCatalog",
658
+ userGroups: "userGroupsCatalog",
659
+ aiProviders: "orgIdentities.aiProviders",
660
+ cloudLinks: "orgIdentities.cloudLinks",
661
+ categories: "orgIdentities.categories",
662
+ groups: "orgIdentities.groups",
663
+ phoneProviders: "orgIdentities.phoneProviders",
664
+ voiceAuths: "orgIdentities.voiceAuths",
665
+ };
643
666
  /**
644
667
  * Render generated/catalog.ts as a pure barrel over org.ts + disk-scanned
645
668
  * catalogs — every app/element/table entry is a lazy `get` accessor (a
@@ -665,11 +688,20 @@ function renderAiProvidersBag(extract) {
665
688
  * invoked, so its self-referential chain never runs).
666
689
  */
667
690
  function renderBarrel(appHandles, elementHandles, tableHandles) {
691
+ // Element keys come from every app and element folder, as on main. Then
692
+ // an app whose folder name, or an element whose key, is an org entry below
693
+ // is left out: that entry wins, so the getter would never be reached
694
+ // (edk#2839).
695
+ const tablesEmitted = tableHandles.length > 0;
668
696
  const elementKeys = computeElementKeys(appHandles, elementHandles);
697
+ appHandles = appHandles.filter((handle) => !isShadowedCatalogKey(handle, tablesEmitted));
698
+ elementHandles = elementHandles.filter((handle) => !isShadowedCatalogKey(elementKeys.get(handle), tablesEmitted));
669
699
  for (const [handle, key] of elementKeys) {
670
700
  if (key === handle)
671
701
  continue;
672
- writeTechnicalLog("WARN", "edk", `"${handle}" names both an app and an element — the element is exposed as catalog.${key} (the app keeps catalog.${handle}) to avoid a collision.`);
702
+ writeTechnicalLog("WARN", "edk", isShadowedCatalogKey(handle, tablesEmitted)
703
+ ? `"${handle}" names both an app and an element — the element is exposed as catalog.${key}; catalog.${handle} is the org's own entry.`
704
+ : `"${handle}" names both an app and an element — the element is exposed as catalog.${key} (the app keeps catalog.${handle}) to avoid a collision.`);
673
705
  }
674
706
  const hasLazyEntries = appHandles.length > 0 || elementHandles.length > 0 || tableHandles.length > 0;
675
707
  const lines = [
@@ -701,13 +733,8 @@ function renderBarrel(appHandles, elementHandles, tableHandles) {
701
733
  for (const h of elementHandles) {
702
734
  lines.push(...lazyAspectGetter(elementKeys.get(h), `../elements/${h}/generated/catalog.js`, h));
703
735
  }
704
- lines.push(" users: usersCatalog,");
705
- lines.push(" userGroups: userGroupsCatalog,");
706
- lines.push(" aiProviders: orgIdentities.aiProviders,");
707
- lines.push(" cloudLinks: orgIdentities.cloudLinks,");
708
- lines.push(" categories: orgIdentities.categories,");
709
- lines.push(" groups: orgIdentities.groups,");
710
- lines.push(" phoneProviders: orgIdentities.phoneProviders,");
736
+ for (const key of ORG_CATALOG_KEYS)
737
+ lines.push(` ${key}: ${ORG_CATALOG_ENTRY_VALUES[key]},`);
711
738
  if (tableHandles.length > 0)
712
739
  lines.push(" tables,");
713
740
  lines.push("};");
@@ -731,27 +758,6 @@ function lazyAspectGetter(key, importPath, exportName, indent = " ") {
731
758
  `${indent}get ${key}() { return (catalogRequire(${quoted}) as typeof import(${quoted})).${exportName}; },`,
732
759
  ];
733
760
  }
734
- /** Pure shared allocator: app/element collisions receive disambiguated keys. */
735
- function computeElementKeys(appHandles, elementHandles) {
736
- const used = new Set(appHandles);
737
- const elementKeys = new Map();
738
- for (const h of elementHandles) {
739
- if (!used.has(h)) {
740
- elementKeys.set(h, h);
741
- used.add(h);
742
- continue;
743
- }
744
- let i = 2;
745
- let candidate = `${h}${i}`;
746
- while (used.has(candidate)) {
747
- i++;
748
- candidate = `${h}${i}`;
749
- }
750
- elementKeys.set(h, candidate);
751
- used.add(candidate);
752
- }
753
- return elementKeys;
754
- }
755
761
  // ---------------------------------------------------------------------------
756
762
  // App / element / table handle discovery (dirs from orgRootOwnFileBags)
757
763
  // ---------------------------------------------------------------------------
@@ -771,6 +777,45 @@ async function discoverHandles(root, subdir) {
771
777
  catch { /* subdir doesn't exist yet — no handles */ }
772
778
  return handles.sort();
773
779
  }
780
+ /**
781
+ * The app and element folders the barrel's org entries shadow (`users`,
782
+ * `groups`, …, and `tables` while a table catalog is emitted; edk#2839): an
783
+ * app by its folder name, an element by the key computeElementKeys gives it,
784
+ * so `elements/groups/` beside `apps/groups/` (key `groups2`) stays. Their
785
+ * getter would never be reached, so the barrel leaves them out. Pull and
786
+ * `elementum new` no longer write one. An older pull's dependency stub there
787
+ * (only `generated/`) moves on the next pull; a folder with source gets one
788
+ * warning naming how to move it. `keptTables` counts table entries a tracked
789
+ * barrel keeps as well as those on disk.
790
+ */
791
+ function shadowedBarrelRoots(root, handles, keptTables) {
792
+ const tablesEmitted = handles.tableHandles.length > 0 || keptTables;
793
+ const elementKeys = computeElementKeys(handles.appHandles, handles.elementHandles);
794
+ const shadowed = new Set();
795
+ const check = (bag, handle, key) => {
796
+ if (!isShadowedCatalogKey(key, tablesEmitted))
797
+ return;
798
+ shadowed.add(`${bag}/${handle}`);
799
+ const warned = `${root}\0${bag}/${handle}`;
800
+ if (!isGeneratedOnlyFolder(join(root, bag, handle)) && !warnedShadowedFolders.has(warned)) {
801
+ warnedShadowedFolders.add(warned);
802
+ const sharedWithElement = bag === "apps" && handles.elementHandles.includes(handle);
803
+ writeTechnicalLog("WARN", "edk", shadowedFolderWarning(bag, handle, reservedRootFolder(root, bag, handle, undefined, bag === "elements" ? handle : undefined)) +
804
+ (sharedWithElement
805
+ ? ` Move elements/${handle}/ to elements/${reservedRootFolder(root, "elements", handle, undefined, handle)}/ first ` +
806
+ `(pull it again, or pull an app that references it when it is only a dependency stub; a folder with source can be renamed the same way): ` +
807
+ `once the app leaves, the element's key becomes catalog.${handle}, the org entry, and catalog.${elementKeys.get(handle)} stops resolving.`
808
+ : ""));
809
+ }
810
+ };
811
+ for (const handle of handles.appHandles)
812
+ check("apps", handle, handle);
813
+ for (const handle of handles.elementHandles)
814
+ check("elements", handle, elementKeys.get(handle));
815
+ return shadowed;
816
+ }
817
+ /** One warning per shadowed folder per process; the barrel is read many times per command. */
818
+ const warnedShadowedFolders = new Set();
774
819
  /**
775
820
  * Scan org-root own-file bags from the graph. Apps/elements stay flat on the
776
821
  * barrel; `tables` nests under `catalog.tables` (historical shape).
@@ -102,6 +102,11 @@ export function slimToken(token) {
102
102
  else if ((token.__kind === "field" || token.__kind === "tableColumn") && Array.isArray(token.semanticTags)) {
103
103
  out.tags = token.semanticTags.filter((tag) => typeof tag === "string");
104
104
  }
105
+ // #1871 re-key map: keep the natural TF child part on the slim field token
106
+ // so option locals and address fallbacks match the emitted resource.
107
+ if (token.__kind === "field" && typeof token.resourceKey === "string" && token.resourceKey !== "") {
108
+ out.resourceKey = token.resourceKey;
109
+ }
105
110
  return out;
106
111
  }
107
112
  /**
@@ -36,7 +36,7 @@ import type { AiProviderLlmModel, AiProviderType } from "./ai-provider-models.js
36
36
  * resolved to the current-version param/output id via the parent
37
37
  * automation's state binding.
38
38
  */
39
- export type CatalogRefKind = "automation" | "agent" | "agent-evaluation" | "chart" | "dashboard" | "widget" | "skill" | "visual-flow" | "approvalChain" | "table" | "tableColumn" | "cloudLink" | "storedFunction" | "procedure" | "field" | "view" | "searchTable" | "documentModel" | "documentModelField" | "connector" | "aiProvider" | "category" | "group" | "phoneProvider" | "phone-service" | "datamine" | "relationship" | "app" | "element" | "task" | "portal" | "triggerParameter" | "outputProperty";
39
+ export type CatalogRefKind = "automation" | "agent" | "agent-evaluation" | "sla" | "chart" | "dashboard" | "widget" | "skill" | "visual-flow" | "approvalChain" | "table" | "tableColumn" | "cloudLink" | "storedFunction" | "procedure" | "field" | "view" | "searchTable" | "documentModel" | "documentModelField" | "connector" | "aiProvider" | "category" | "group" | "phoneProvider" | "voiceAuth" | "phone-service" | "datamine" | "relationship" | "app" | "element" | "task" | "portal" | "triggerParameter" | "outputProperty";
40
40
  /**
41
41
  * The reference surface for a catalog entity. `handle` is the stable join key
42
42
  * (no id); `name` is for readability/diagnostics, never a match key.
@@ -204,6 +204,7 @@ export interface CloudLinkRef<Functions extends Readonly<Record<string, StoredFu
204
204
  export type CategoryRef = CatalogRef<"category">;
205
205
  export type GroupRef = CatalogRef<"group">;
206
206
  export type PhoneProviderRef = CatalogRef<"phoneProvider">;
207
+ export type VoiceAuthRef = CatalogRef<"voiceAuth">;
207
208
  export type PhoneServiceRef<Parent extends string = string, RefName extends string = string> = CatalogRef<"phone-service", RefName, Parent>;
208
209
  /** Typed references to app and element catalog roots. */
209
210
  export type AppCatalogRef<RefName extends string = string> = CatalogRef<"app", RefName> & {
@@ -262,6 +263,11 @@ export interface FieldRef<Parent extends string = string, RefName extends string
262
263
  readonly fieldType: FieldType;
263
264
  readonly tags?: readonly string[];
264
265
  readonly options?: readonly string[];
266
+ /**
267
+ * Natural bag key when pull re-keyed this field off a reserved system key
268
+ * (#1871). Option locals and address fallbacks use this child part.
269
+ */
270
+ readonly resourceKey?: string;
265
271
  /** Authoring metadata: this Dropdown/Multi-Select sources values from records. */
266
272
  readonly dynamicSource?: true;
267
273
  /**
@@ -51,6 +51,7 @@ export const REF_SCOPE = {
51
51
  automation: "app",
52
52
  agent: "app",
53
53
  "agent-evaluation": "app",
54
+ sla: "app",
54
55
  chart: "app",
55
56
  dashboard: "app",
56
57
  widget: "app",
@@ -74,6 +75,7 @@ export const REF_SCOPE = {
74
75
  category: "org",
75
76
  group: "org",
76
77
  phoneProvider: "org",
78
+ voiceAuth: "org",
77
79
  "phone-service": "app",
78
80
  app: "registry",
79
81
  element: "registry",
@@ -104,6 +106,7 @@ export const REF_UPDATABLE = new Set([
104
106
  "automation",
105
107
  "agent",
106
108
  "agent-evaluation",
109
+ "sla",
107
110
  "skill",
108
111
  "approvalChain",
109
112
  "table",
@@ -48,7 +48,7 @@ export declare function isReadOnlySystemField(f: SystemFieldProbe): boolean;
48
48
  * Canonical `systemFields` bag key → platform semantic tag. These keys are the
49
49
  * ONLY authoring/catalog identity for system fields: pulled source keys its
50
50
  * hoisted refs and overrides by them, `ref()` exposes `fields.<key>` tokens
51
- * under them, and the custom `fields: {}` bag rejects them as collisions.
51
+ * under them, and a custom `fields:` key matching one is rejected at build (#1871).
52
52
  */
53
53
  export declare const SYSTEM_FIELD_TAG_BY_KEY: {
54
54
  readonly id: "HANDLE";
@@ -85,7 +85,7 @@ export function isReadOnlySystemField(f) {
85
85
  * Canonical `systemFields` bag key → platform semantic tag. These keys are the
86
86
  * ONLY authoring/catalog identity for system fields: pulled source keys its
87
87
  * hoisted refs and overrides by them, `ref()` exposes `fields.<key>` tokens
88
- * under them, and the custom `fields: {}` bag rejects them as collisions.
88
+ * under them, and a custom `fields:` key matching one is rejected at build (#1871).
89
89
  */
90
90
  export const SYSTEM_FIELD_TAG_BY_KEY = {
91
91
  id: "HANDLE",
@@ -140,6 +140,8 @@ type WireDefaultValue = {
140
140
  datetime: string;
141
141
  } | {
142
142
  userId: OnDemandUserDefault;
143
+ } | {
144
+ groupId: string;
143
145
  } | {
144
146
  attachmentId: string;
145
147
  };
@@ -89,6 +89,9 @@ function wrapDefaultValueForWire(alias, value) {
89
89
  }
90
90
  return { userId: { __kind: "user", email: user.email } };
91
91
  }
92
+ case "groupId":
93
+ // A group's platform id, like attachmentId's (#2204).
94
+ return { groupId: value };
92
95
  case "attachmentId":
93
96
  return { attachmentId: value };
94
97
  case "record":
@@ -142,6 +142,12 @@ export interface AspectFieldBase<Scope extends FieldScope = "unscoped"> {
142
142
  readonly tags?: readonly string[];
143
143
  readonly lockOnCreate?: boolean;
144
144
  readonly defaultValue?: unknown;
145
+ /**
146
+ * Natural bag key when pull re-keyed this field off a reserved system key
147
+ * (#1871). Build uses it as the terraform child part. Hand-authored
148
+ * fields omit this.
149
+ */
150
+ readonly resourceKey?: string;
145
151
  /**
146
152
  * Runtime metadata stamped on pulled fields by `print-aspect.ts`.
147
153
  * Records the variant the field was when pulled — `serializeAspectForUpdate`
@@ -6,6 +6,7 @@
6
6
  import type { ChildResourceScope, TfValue } from "../tf/index.js";
7
7
  import type { KindId } from "../../graph/types.js";
8
8
  import type { DeployableEntity } from "../entity.js";
9
+ import type { OptionIdIndex } from "../pull/field-refs-registry.js";
9
10
  export interface ForeignRootIdentity {
10
11
  readonly name: string;
11
12
  readonly namespace?: string;
@@ -124,6 +125,8 @@ export interface ToTfContext {
124
125
  readonly diagnostics: string[];
125
126
  /** Informational build reports, kept separate from warnings. */
126
127
  readonly reports?: string[];
128
+ /** Option ids known offline, for the raw-option-id warnings (#1733). */
129
+ readonly optionIds?: OptionIdIndex;
127
130
  /**
128
131
  * Every app/element stream root discovered in THIS build, keyed by
129
132
  * {@link workspaceAspectKey} — lets a cross-aspect reference (e.g. a
@@ -13,8 +13,13 @@
13
13
  * - the unbumped-automation revision reminder
14
14
  * - a live runAutomation call into a record input the platform already runs
15
15
  * (edk#2250; the mapping is emitted, and the called workflow fails at run time)
16
+ * - a synchronous Dynamic Reference runAutomation inside a forEach (edk#1870;
17
+ * the task is emitted, and the caller never resumes at run time)
16
18
  * - the custom-view non-PanesBlock root hint (check.mjs `warn`; the layout is
17
19
  * emitted exactly as authored, edk#1771)
20
+ * - the executeScript lint for an undeclared input, an output no return sets
21
+ * (edk#2286), or a script with no top-level return (edk#2364); the script is
22
+ * emitted as authored
18
23
  *
19
24
  * The ~600 emit sites push free-form `"<where>: <what>; dropped"` strings.
20
25
  * Rather than rewrite every site, they are classified here, where they leave
@@ -13,8 +13,13 @@
13
13
  * - the unbumped-automation revision reminder
14
14
  * - a live runAutomation call into a record input the platform already runs
15
15
  * (edk#2250; the mapping is emitted, and the called workflow fails at run time)
16
+ * - a synchronous Dynamic Reference runAutomation inside a forEach (edk#1870;
17
+ * the task is emitted, and the caller never resumes at run time)
16
18
  * - the custom-view non-PanesBlock root hint (check.mjs `warn`; the layout is
17
19
  * emitted exactly as authored, edk#1771)
20
+ * - the executeScript lint for an undeclared input, an output no return sets
21
+ * (edk#2286), or a script with no top-level return (edk#2364); the script is
22
+ * emitted as authored
18
23
  *
19
24
  * The ~600 emit sites push free-form `"<where>: <what>; dropped"` strings.
20
25
  * Rather than rewrite every site, they are classified here, where they leave
@@ -26,6 +31,10 @@ const ADVISORY_DIAGNOSTICS = [
26
31
  INPUT_COVERAGE,
27
32
  /^automation \S+: compiled steps changed since the last apply but its revision is still /,
28
33
  /^automation \S+: maps automation /,
34
+ // edk#1870. The task and loop names are quoted as authored and may contain `"`, so match them with
35
+ // [\s\S]* and anchor on the fixed rest of the message, end included (the label is a sanitized TF label).
36
+ /^automation \S+: task "[\s\S]*" is a synchronous Dynamic Reference runAutomation inside forEach "[\s\S]*"; the platform never resumes the caller after the called automation finishes, so the steps after it never run and the run stays parked\. Move the call out of the forEach, or call a known automation by its catalog ref \(Select Automation\)$/,
37
+ /^automation \S+: executeScript ".*" (?:reads input|declares output|has no top-level return) /,
29
38
  /^applied-automation-revisions\.json .*; until then no automation is checked for an edit without a revision bump$/,
30
39
  /\.root: "[^"]*" is (?:untyped|a [A-Za-z0-9_]+); the root is usually a PanesBlock \(needed for record lists to open the details pane\)$/,
31
40
  ];
@@ -166,10 +166,27 @@ export type TofuJsonEvent = {
166
166
  } | {
167
167
  readonly type: "diagnostic";
168
168
  readonly level: "INFO" | "WARN" | "ERROR";
169
+ /** `summary: detail`, as logged. */
169
170
  readonly message: string;
171
+ readonly summary: string;
172
+ readonly detail?: string;
173
+ /** Where OpenTofu says the error is (`range` and `address`), when it says. */
174
+ readonly location?: TofuDiagnosticLocation;
170
175
  } | {
171
176
  readonly type: "other";
172
177
  };
178
+ /**
179
+ * Where an OpenTofu diagnostic points: the file and line from its location
180
+ * line or JSON `range`, and the resource address from its `with` line or JSON
181
+ * `address` (edk#2295). Names only; never a snippet or a value.
182
+ */
183
+ export interface TofuDiagnosticLocation {
184
+ readonly file?: string;
185
+ readonly line?: number;
186
+ readonly address?: string;
187
+ }
188
+ /** `automations.tf line 27, elementum_x.y`: the location as one parenthetical. */
189
+ export declare function formatTofuDiagnosticLocation(location: TofuDiagnosticLocation): string;
173
190
  /** Parse the stable subset of OpenTofu's line-delimited JSON UI used by adoption. */
174
191
  export declare function parseTofuJsonEvent(line: string): TofuJsonEvent;
175
192
  /** Capture both bridge output streams for small machine-inspection commands. */
@@ -186,6 +203,8 @@ export declare function capTofuDiagnostics(diagnostics: readonly string[], max?:
186
203
  * Error diagnostics from a failed OpenTofu run: `diagnostic` events with
187
204
  * severity error from `-json` stdout, plus human `Error:` blocks from stderr.
188
205
  * Deduplicated, in order. Used to explain why `ei plan` failed instead of
189
- * discarding its output (edk#1402).
206
+ * discarding its output (edk#1402). Each names the file, line and resource
207
+ * address OpenTofu reported, right after the summary (edk#2295):
208
+ * `Invalid index (automations.tf line 27, elementum_x.y): The given key …`.
190
209
  */
191
210
  export declare function tofuErrorDiagnostics(stdout: string | undefined, stderr: string | undefined): string[];