@elementumai/edk 0.12.0 → 0.13.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 (224) hide show
  1. package/README.md +8 -2
  2. package/dist-sdk/src/catalog/factories.d.ts +7 -1
  3. package/dist-sdk/src/catalog/factories.js +10 -2
  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 +12 -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/types/app.d.ts +6 -0
  13. package/dist-sdk/src/engine/build/context.d.ts +3 -0
  14. package/dist-sdk/src/engine/coverage-gaps.d.ts +2 -0
  15. package/dist-sdk/src/engine/coverage-gaps.js +4 -0
  16. package/dist-sdk/src/engine/ei/run.d.ts +8 -0
  17. package/dist-sdk/src/engine/ei/run.js +46 -7
  18. package/dist-sdk/src/engine/pull/authored-address.js +42 -6
  19. package/dist-sdk/src/engine/pull/authored-root.d.ts +88 -0
  20. package/dist-sdk/src/engine/pull/authored-root.js +306 -0
  21. package/dist-sdk/src/engine/pull/context.d.ts +34 -0
  22. package/dist-sdk/src/engine/pull/field-refs-registry.d.ts +114 -0
  23. package/dist-sdk/src/engine/pull/field-refs-registry.js +501 -0
  24. package/dist-sdk/src/engine/pull/org.d.ts +1 -0
  25. package/dist-sdk/src/engine/pull/org.js +2 -0
  26. package/dist-sdk/src/engine/pull/partition.d.ts +8 -0
  27. package/dist-sdk/src/engine/pull/partition.js +43 -0
  28. package/dist-sdk/src/engine/pull/pulled-roots.d.ts +89 -0
  29. package/dist-sdk/src/engine/pull/pulled-roots.js +203 -0
  30. package/dist-sdk/src/engine/pull/ref-only.d.ts +4 -0
  31. package/dist-sdk/src/engine/pull/ref-only.js +7 -1
  32. package/dist-sdk/src/engine/pull/source-resources.d.ts +39 -0
  33. package/dist-sdk/src/engine/pull/source-resources.js +110 -0
  34. package/dist-sdk/src/engine/pull/stream-root.d.ts +159 -0
  35. package/dist-sdk/src/engine/pull/stream-root.js +579 -0
  36. package/dist-sdk/src/engine/workspace/authoring-layout.js +16 -2
  37. package/dist-sdk/src/engine/workspace/reserved-catalog-keys.d.ts +47 -0
  38. package/dist-sdk/src/engine/workspace/reserved-catalog-keys.js +115 -0
  39. package/dist-sdk/src/entities/access-policy/build.d.ts +2 -1
  40. package/dist-sdk/src/entities/access-policy/from-tf.d.ts +7 -0
  41. package/dist-sdk/src/entities/access-policy/from-tf.js +17 -5
  42. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +19 -0
  43. package/dist-sdk/src/entities/access-policy/to-tf.js +65 -8
  44. package/dist-sdk/src/entities/agent/build.d.ts +52 -1
  45. package/dist-sdk/src/entities/agent/build.js +34 -0
  46. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +70 -1
  47. package/dist-sdk/src/entities/agent/from-tf.d.ts +36 -1
  48. package/dist-sdk/src/entities/agent/from-tf.js +289 -2
  49. package/dist-sdk/src/entities/agent/index.d.ts +1 -1
  50. package/dist-sdk/src/entities/agent/module.js +1 -0
  51. package/dist-sdk/src/entities/agent/to-tf.d.ts +11 -11
  52. package/dist-sdk/src/entities/agent/to-tf.js +179 -17
  53. package/dist-sdk/src/entities/agent-tool/from-tf.js +6 -0
  54. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -2
  55. package/dist-sdk/src/entities/agent-tool/to-tf.js +2 -2
  56. package/dist-sdk/src/entities/app/build.d.ts +33 -13
  57. package/dist-sdk/src/entities/app/build.js +14 -12
  58. package/dist-sdk/src/entities/app/from-tf.d.ts +1 -0
  59. package/dist-sdk/src/entities/app/from-tf.js +7 -9
  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 +3 -0
  63. package/dist-sdk/src/entities/app/stage-keys.d.ts +2 -2
  64. package/dist-sdk/src/entities/app/stage-keys.js +3 -3
  65. package/dist-sdk/src/entities/app/to-tf.js +1 -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 +10 -1
  82. package/dist-sdk/src/entities/automation/build.js +70 -27
  83. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +21 -5
  84. package/dist-sdk/src/entities/automation/from-tf.d.ts +26 -5
  85. package/dist-sdk/src/entities/automation/from-tf.js +665 -112
  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 +45 -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/slack-message-refs.d.ts +9 -0
  93. package/dist-sdk/src/entities/automation/slack-message-refs.js +75 -0
  94. package/dist-sdk/src/entities/automation/system-ref-name.d.ts +23 -3
  95. package/dist-sdk/src/entities/automation/system-ref-name.js +86 -4
  96. package/dist-sdk/src/entities/automation/task-output-labels.d.ts +11 -0
  97. package/dist-sdk/src/entities/automation/task-output-labels.js +23 -0
  98. package/dist-sdk/src/entities/automation/tasks.d.ts +29 -4
  99. package/dist-sdk/src/entities/automation/tasks.js +34 -11
  100. package/dist-sdk/src/entities/automation/to-tf.d.ts +8 -1
  101. package/dist-sdk/src/entities/automation/to-tf.js +563 -103
  102. package/dist-sdk/src/entities/automation/triggers.d.ts +0 -8
  103. package/dist-sdk/src/entities/automation/triggers.js +26 -11
  104. package/dist-sdk/src/entities/automation/unsafe-script-output.d.ts +50 -0
  105. package/dist-sdk/src/entities/automation/unsafe-script-output.js +92 -0
  106. package/dist-sdk/src/entities/chart/build.d.ts +9 -1
  107. package/dist-sdk/src/entities/chart/from-tf.js +3 -0
  108. package/dist-sdk/src/entities/chart/to-tf.js +19 -2
  109. package/dist-sdk/src/entities/dashboard/from-tf.d.ts +3 -1
  110. package/dist-sdk/src/entities/dashboard/from-tf.js +42 -2
  111. package/dist-sdk/src/entities/dashboard/to-tf.js +9 -1
  112. package/dist-sdk/src/entities/dashboard-widget-order/module.d.ts +10 -0
  113. package/dist-sdk/src/entities/dashboard-widget-order/module.js +25 -0
  114. package/dist-sdk/src/entities/dashboard-widget-order/order.d.ts +31 -0
  115. package/dist-sdk/src/entities/dashboard-widget-order/order.js +102 -0
  116. package/dist-sdk/src/entities/dynamic-layout/build.d.ts +2 -0
  117. package/dist-sdk/src/entities/dynamic-layout/from-tf.js +44 -5
  118. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +46 -12
  119. package/dist-sdk/src/entities/element/audit-field-guard.d.ts +9 -0
  120. package/dist-sdk/src/entities/element/audit-field-guard.js +88 -0
  121. package/dist-sdk/src/entities/element/build.js +2 -1
  122. package/dist-sdk/src/entities/element/from-tf.d.ts +1 -0
  123. package/dist-sdk/src/entities/element/from-tf.js +4 -7
  124. package/dist-sdk/src/entities/element/module.js +5 -0
  125. package/dist-sdk/src/entities/element/system-fields.d.ts +13 -0
  126. package/dist-sdk/src/entities/element/system-fields.js +23 -0
  127. package/dist-sdk/src/entities/element/to-tf.js +1 -0
  128. package/dist-sdk/src/entities/field/build.d.ts +9 -0
  129. package/dist-sdk/src/entities/field/from-tf.d.ts +52 -1
  130. package/dist-sdk/src/entities/field/from-tf.js +212 -14
  131. package/dist-sdk/src/entities/field/module.js +4 -0
  132. package/dist-sdk/src/entities/field/to-tf.d.ts +5 -1
  133. package/dist-sdk/src/entities/field/to-tf.js +33 -12
  134. package/dist-sdk/src/entities/org/category.js +1 -0
  135. package/dist-sdk/src/entities/org/index.d.ts +1 -0
  136. package/dist-sdk/src/entities/org/index.js +1 -0
  137. package/dist-sdk/src/entities/org/voice-auth.d.ts +5 -0
  138. package/dist-sdk/src/entities/org/voice-auth.js +33 -0
  139. package/dist-sdk/src/entities/organization/build.d.ts +3 -0
  140. package/dist-sdk/src/entities/organization/build.js +2 -0
  141. package/dist-sdk/src/entities/organization/index.d.ts +1 -0
  142. package/dist-sdk/src/entities/organization/index.js +1 -0
  143. package/dist-sdk/src/entities/organization/to-tf.d.ts +2 -0
  144. package/dist-sdk/src/entities/organization/to-tf.js +59 -1
  145. package/dist-sdk/src/entities/organization/voice-auth.d.ts +60 -0
  146. package/dist-sdk/src/entities/organization/voice-auth.js +60 -0
  147. package/dist-sdk/src/entities/phone-service/build.d.ts +9 -1
  148. package/dist-sdk/src/entities/phone-service/build.js +1 -0
  149. package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.js +3 -0
  150. package/dist-sdk/src/entities/phone-service/from-tf.d.ts +1 -0
  151. package/dist-sdk/src/entities/phone-service/from-tf.js +8 -1
  152. package/dist-sdk/src/entities/phone-service/to-tf.js +16 -0
  153. package/dist-sdk/src/entities/record-create-form/from-tf.js +2 -2
  154. package/dist-sdk/src/entities/relationship/from-tf.js +9 -4
  155. package/dist-sdk/src/entities/relationship/module.js +2 -2
  156. package/dist-sdk/src/entities/relationship/pair-check.d.ts +6 -2
  157. package/dist-sdk/src/entities/relationship/pair-check.js +105 -18
  158. package/dist-sdk/src/entities/relationship/to-tf.js +5 -2
  159. package/dist-sdk/src/entities/role/build.d.ts +3 -4
  160. package/dist-sdk/src/entities/role/permission-levels.d.ts +7 -0
  161. package/dist-sdk/src/entities/role/permission-levels.js +78 -0
  162. package/dist-sdk/src/entities/role/to-tf.js +32 -2
  163. package/dist-sdk/src/entities/search-table/build.d.ts +9 -3
  164. package/dist-sdk/src/entities/search-table/build.js +4 -4
  165. package/dist-sdk/src/entities/search-table/printer.js +3 -1
  166. package/dist-sdk/src/entities/search-table/to-tf.js +20 -2
  167. package/dist-sdk/src/entities/service-account/module.d.ts +2 -1
  168. package/dist-sdk/src/entities/service-account/module.js +4 -1
  169. package/dist-sdk/src/entities/service-account/resource-type.d.ts +2 -0
  170. package/dist-sdk/src/entities/service-account/resource-type.js +2 -0
  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/context.d.ts +14 -1
  176. package/dist-sdk/src/entities/shared/filters/ast.d.ts +2 -0
  177. package/dist-sdk/src/entities/shared/filters/index.d.ts +97 -15
  178. package/dist-sdk/src/entities/shared/filters/index.js +30 -7
  179. package/dist-sdk/src/entities/shared/filters/option-lookups.d.ts +57 -0
  180. package/dist-sdk/src/entities/shared/filters/option-lookups.js +108 -0
  181. package/dist-sdk/src/entities/shared/filters/print.d.ts +2 -0
  182. package/dist-sdk/src/entities/shared/filters/print.js +19 -6
  183. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +16 -7
  184. package/dist-sdk/src/entities/shared/filters/tf-codec.js +25 -5
  185. package/dist-sdk/src/entities/shared/filters/types.d.ts +4 -0
  186. package/dist-sdk/src/entities/shared/raw-option-id.d.ts +30 -0
  187. package/dist-sdk/src/entities/shared/raw-option-id.js +41 -0
  188. package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +1 -1
  189. package/dist-sdk/src/entities/shared/tool-field-ref.js +3 -2
  190. package/dist-sdk/src/entities/skill/input-coverage.js +5 -2
  191. package/dist-sdk/src/entities/sla/build.d.ts +96 -0
  192. package/dist-sdk/src/entities/sla/build.js +124 -0
  193. package/dist-sdk/src/entities/sla/from-tf.d.ts +40 -0
  194. package/dist-sdk/src/entities/sla/from-tf.js +164 -0
  195. package/dist-sdk/src/entities/sla/index.d.ts +1 -0
  196. package/dist-sdk/src/entities/sla/index.js +1 -0
  197. package/dist-sdk/src/entities/sla/module.d.ts +4 -0
  198. package/dist-sdk/src/entities/sla/module.js +73 -0
  199. package/dist-sdk/src/entities/sla/printer.d.ts +2 -0
  200. package/dist-sdk/src/entities/sla/printer.js +84 -0
  201. package/dist-sdk/src/entities/sla/to-tf.d.ts +12 -0
  202. package/dist-sdk/src/entities/sla/to-tf.js +81 -0
  203. package/dist-sdk/src/entities/table/build.d.ts +7 -2
  204. package/dist-sdk/src/entities/table/build.js +22 -1
  205. package/dist-sdk/src/entities/table/deserializer/normalize.d.ts +4 -1
  206. package/dist-sdk/src/entities/table/from-tf.js +89 -14
  207. package/dist-sdk/src/entities/table/index.d.ts +1 -1
  208. package/dist-sdk/src/entities/table/to-tf.js +41 -2
  209. package/dist-sdk/src/entities/task/from-tf.js +3 -2
  210. package/dist-sdk/src/entities/view/custom-view-validate.d.ts +6 -4
  211. package/dist-sdk/src/entities/view/custom-view-validate.js +36 -18
  212. package/dist-sdk/src/entities/view/from-tf.js +16 -4
  213. package/dist-sdk/src/entities/view/to-tf.js +66 -47
  214. package/dist-sdk/src/entities/visual-flow/module.js +52 -1
  215. package/dist-sdk/src/entities/widget/from-tf.js +19 -8
  216. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +49 -4
  217. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
  218. package/dist-sdk/src/graph/index.d.ts +9 -0
  219. package/dist-sdk/src/graph/index.js +8 -0
  220. package/dist-sdk/src/graph/modules.js +13 -1
  221. package/dist-sdk/src/graph/resource-types.d.ts +47 -0
  222. package/dist-sdk/src/graph/resource-types.js +62 -0
  223. package/dist-sdk/src/graph/types.d.ts +113 -6
  224. package/package.json +7 -4
package/README.md CHANGED
@@ -28,10 +28,13 @@ folders:
28
28
 
29
29
  ```sh
30
30
  npm install @elementumai/edk
31
+ npm install --save-dev typescript
31
32
  ```
32
33
 
33
- Use Node 24 or newer. The npm package is the authoring SDK; the only public
34
- executable is `elementum`.
34
+ Use Node 24 or newer. TypeScript is what checks your files (`npx tsc --noEmit`);
35
+ the SDK brings the Node type definitions the workspace's `tsconfig.json` names.
36
+ The npm package is the authoring SDK; the only public executable is
37
+ `elementum`.
35
38
 
36
39
  ### Platform support
37
40
 
@@ -103,6 +106,7 @@ mkdir elementum-workspace
103
106
  cd elementum-workspace
104
107
  npm init -y
105
108
  npm install @elementumai/edk
109
+ npm install --save-dev typescript
106
110
  elementum auth login --profile <profile>
107
111
  elementum --profile=<profile> pull org --data-only
108
112
  cd <instance>/<organization>
@@ -214,6 +218,8 @@ elementum pull app <namespace> [--root <orgRoot>] [--no-adopt] [--skip-unsupport
214
218
  elementum pull element <namespace> [--root <orgRoot>] [--no-adopt] [--skip-unsupported-layouts] [--portable [--map <file>]]
215
219
  elementum pull task <namespace> [--root <orgRoot>] [--no-adopt] [--portable [--map <file>]]
216
220
  elementum pull --restore-previous [--root <orgRoot>] # after a failed pull: .tf/in.previous -> .tf/in (failed copy kept as .tf/in.failed); never automatic
221
+ # A failed `pull app`/`pull element` adoption settles the .ts itself: unchanged state puts apps|elements/<ref>/ back as it was before
222
+ # the pull (pulled copy kept under .edk-state/failed-pulls/); changed state keeps the pulled source (previous copy kept there instead).
217
223
  elementum clone app <namespace> --as <newName> [--namespace <newns>] [--root <orgRoot>] [--target-root <destOrgRoot>] [--map <file>]
218
224
  elementum build [orgRoot]
219
225
  elementum plan [orgRoot-or-nested-target] [--json] [bridge args...]
@@ -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",
@@ -368,13 +369,19 @@ function stampOwnedRefs(bag, identity, parentKind) {
368
369
  ...(identity.namespace !== undefined ? { parentNamespace: identity.namespace } : {}),
369
370
  }]));
370
371
  }
371
- /** Stamp the owning app's stable key and display name onto each skill token. */
372
+ /** Stamp the owning app's stable key, display name and namespace onto each skill token. */
372
373
  function stampSkillRefs(bag, identity) {
373
374
  if (bag === undefined)
374
375
  return undefined;
375
376
  const out = {};
376
377
  for (const [refName, ref] of Object.entries(bag)) {
377
- out[refName] = { ...ref, refName, parent: identity.refName, parentName: identity.name };
378
+ out[refName] = {
379
+ ...ref,
380
+ refName,
381
+ parent: identity.refName,
382
+ parentName: identity.name,
383
+ ...(identity.namespace !== undefined ? { parentNamespace: identity.namespace } : {}),
384
+ };
378
385
  }
379
386
  return out;
380
387
  }
@@ -496,6 +503,7 @@ export function orgCatalog(bags) {
496
503
  categories: withOwnKeyAsHandle(bags.categories) ?? {},
497
504
  groups: withOwnKeyAsHandle(bags.groups) ?? {},
498
505
  phoneProviders: withOwnKeyAsHandle(bags.phoneProviders) ?? {},
506
+ voiceAuths: withOwnKeyAsHandle(bags.voiceAuths) ?? {},
499
507
  tables: stampTableRefs(bags.tables) ?? {},
500
508
  };
501
509
  }
@@ -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.
@@ -78,6 +78,11 @@ export interface SkillRef extends CatalogRef<"skill"> {
78
78
  * owner identity needed to resolve `app_id` without exposing a platform id.
79
79
  */
80
80
  readonly parentName?: string;
81
+ /**
82
+ * Namespace of the owning app, when its catalog records one. A build looks
83
+ * an owner outside the workspace up by it, as ei's export does (edk#2919).
84
+ */
85
+ readonly parentNamespace?: string;
81
86
  /**
82
87
  * A raw platform id, when the export carries a `skill_ids`/
83
88
  * `preloaded_skill_ids` entry that resolves to neither a self-app resource
@@ -204,6 +209,7 @@ export interface CloudLinkRef<Functions extends Readonly<Record<string, StoredFu
204
209
  export type CategoryRef = CatalogRef<"category">;
205
210
  export type GroupRef = CatalogRef<"group">;
206
211
  export type PhoneProviderRef = CatalogRef<"phoneProvider">;
212
+ export type VoiceAuthRef = CatalogRef<"voiceAuth">;
207
213
  export type PhoneServiceRef<Parent extends string = string, RefName extends string = string> = CatalogRef<"phone-service", RefName, Parent>;
208
214
  /** Typed references to app and element catalog roots. */
209
215
  export type AppCatalogRef<RefName extends string = string> = CatalogRef<"app", RefName> & {
@@ -262,6 +268,11 @@ export interface FieldRef<Parent extends string = string, RefName extends string
262
268
  readonly fieldType: FieldType;
263
269
  readonly tags?: readonly string[];
264
270
  readonly options?: readonly string[];
271
+ /**
272
+ * Natural bag key when pull re-keyed this field off a reserved system key
273
+ * (#1871). Option locals and address fallbacks use this child part.
274
+ */
275
+ readonly resourceKey?: string;
265
276
  /** Authoring metadata: this Dropdown/Multi-Select sources values from records. */
266
277
  readonly dynamicSource?: true;
267
278
  /**
@@ -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",
@@ -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
@@ -17,6 +17,8 @@
17
17
  * the task is emitted, and the caller never resumes at run time)
18
18
  * - the custom-view non-PanesBlock root hint (check.mjs `warn`; the layout is
19
19
  * emitted exactly as authored, edk#1771)
20
+ * - a custom-view binding to a path missing from spec.state (the page reads it
21
+ * as undefined; the layout is emitted exactly as authored, edk#2923)
20
22
  * - the executeScript lint for an undeclared input, an output no return sets
21
23
  * (edk#2286), or a script with no top-level return (edk#2364); the script is
22
24
  * emitted as authored
@@ -17,6 +17,8 @@
17
17
  * the task is emitted, and the caller never resumes at run time)
18
18
  * - the custom-view non-PanesBlock root hint (check.mjs `warn`; the layout is
19
19
  * emitted exactly as authored, edk#1771)
20
+ * - a custom-view binding to a path missing from spec.state (the page reads it
21
+ * as undefined; the layout is emitted exactly as authored, edk#2923)
20
22
  * - the executeScript lint for an undeclared input, an output no return sets
21
23
  * (edk#2286), or a script with no top-level return (edk#2364); the script is
22
24
  * emitted as authored
@@ -34,9 +36,11 @@ const ADVISORY_DIAGNOSTICS = [
34
36
  // edk#1870. The task and loop names are quoted as authored and may contain `"`, so match them with
35
37
  // [\s\S]* and anchor on the fixed rest of the message, end included (the label is a sanitized TF label).
36
38
  /^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\)$/,
39
+ /^automation \S+: field ".*" is set from .+, a (?:whole|Multi-Select)/,
37
40
  /^automation \S+: executeScript ".*" (?:reads input|declares output|has no top-level return) /,
38
41
  /^applied-automation-revisions\.json .*; until then no automation is checked for an edit without a revision bump$/,
39
42
  /\.root: "[^"]*" is (?:untyped|a [A-Za-z0-9_]+); the root is usually a PanesBlock \(needed for record lists to open the details pane\)$/,
43
+ /: binds to "[^"]*", which is not in spec\.state, so it starts undefined\. Add an initial value there to set its default\.$/,
40
44
  ];
41
45
  export function isAdvisoryDiagnostic(message) {
42
46
  return ADVISORY_DIAGNOSTICS.some((pattern) => pattern.test(message));
@@ -31,6 +31,14 @@ export declare class EiRunError extends Error {
31
31
  readonly stdout?: string;
32
32
  constructor(message: string, exitCode: number | null, stderr?: string, stdout?: string);
33
33
  }
34
+ /** Whether OpenTofu output reports a stale provider selection (edk#2946). */
35
+ export declare function mentionsStaleProviderSelection(text: string): boolean;
36
+ /**
37
+ * Whether a `runEiPassthrough` since the last take printed a stale provider
38
+ * selection diagnostic (edk#2946); clears it. Output handed to a terminal
39
+ * (`passthroughNeedsTerminal`) is not seen here.
40
+ */
41
+ export declare function takeStaleProviderSelection(): boolean;
34
42
  export declare function configureBridgeProfile(profile: string | undefined): void;
35
43
  export declare function configuredBridgeProfile(): string | undefined;
36
44
  export declare function managedElementumRoot(): string;
@@ -63,8 +63,41 @@ const LOCAL_HELP_TIMEOUT_MS = 1_500;
63
63
  let bridgeProfile;
64
64
  /** Convert the provider's default tflog text sink into EDK technical logs. */
65
65
  const TFLOG_LINE = /^time=(\S+)\s+level=(TRACE|DEBUG|INFO|WARN|ERROR)\s+msg="((?:\\.|[^"])*)"/;
66
- const TOFU_TRANSIENT_LINE = /^.+: (Reading|Still reading|Read complete after|Preparing import|Importing|Import complete|Import complete after|Refreshing state|Still refreshing|Refresh complete after|Creating|Still creating|Creation complete after|Modifying|Still modifying|Modification complete after|Destroying|Still destroying|Destruction complete after)(?:\.\.\.|\s)/;
66
+ /**
67
+ * A resource instance address as OpenTofu prints it before a progress verb:
68
+ * `elementum_app.x`, `data.elementum_field.y`, `module.m["k"].elementum_app.x[0]`,
69
+ * or a deposed instance (`elementum_app.x (deposed object 1a2b3c4d)`). A
70
+ * diagnostic header such as `Warning: Creating …` or `│ Error: Modifying …`
71
+ * is never an address, so it is not mistaken for progress (edk#2942). The Go
72
+ * bridge's `progressResourceLine` (cmd/elementum/terraform/executor.go) uses
73
+ * the same grammar.
74
+ */
75
+ const TOFU_ADDRESS_INDEX = String.raw `(?:\[(?:\d+|"(?:[^"\\]|\\.)*")\])?`;
76
+ const TOFU_RESOURCE_ADDRESS = String.raw `(?:module\.[A-Za-z_][\w-]*${TOFU_ADDRESS_INDEX}\.)*(?:data\.)?[A-Za-z_][\w-]*\.[A-Za-z_][\w-]*${TOFU_ADDRESS_INDEX}(?: \(deposed object [^)]+\))?`;
77
+ const TOFU_TRANSIENT_LINE = new RegExp(String.raw `^${TOFU_RESOURCE_ADDRESS}: (Reading|Still reading|Read complete after|Preparing import|Importing|Import complete|Import complete after|Refreshing state|Still refreshing|Refresh complete after|Creating|Still creating|Creation complete after|Modifying|Still modifying|Modification complete after|Destroying|Still destroying|Destruction complete after)(?:\.\.\.|\s)`);
67
78
  const ANSI_SEQUENCE = /\x1b\[[0-?]*[ -/]*[@-~]/g;
79
+ /**
80
+ * OpenTofu's diagnostics for a provider selection that no longer matches
81
+ * providers.tf: a lock pinning another version, or a locked package that is
82
+ * not installed. The same test as the bridge's `isStaleProviderSelection`
83
+ * (cmd/elementum/terraform/executor.go).
84
+ */
85
+ const STALE_PROVIDER_SELECTION = /Inconsistent dependency lock file|Required plugins are not installed/;
86
+ let staleProviderSelectionSeen = false;
87
+ /** Whether OpenTofu output reports a stale provider selection (edk#2946). */
88
+ export function mentionsStaleProviderSelection(text) {
89
+ return STALE_PROVIDER_SELECTION.test(withoutAnsi(text));
90
+ }
91
+ /**
92
+ * Whether a `runEiPassthrough` since the last take printed a stale provider
93
+ * selection diagnostic (edk#2946); clears it. Output handed to a terminal
94
+ * (`passthroughNeedsTerminal`) is not seen here.
95
+ */
96
+ export function takeStaleProviderSelection() {
97
+ const seen = staleProviderSelectionSeen;
98
+ staleProviderSelectionSeen = false;
99
+ return seen;
100
+ }
68
101
  function withoutAnsi(line) {
69
102
  return line.replace(ANSI_SEQUENCE, "");
70
103
  }
@@ -484,8 +517,14 @@ export function runEiPassthrough(args, opts) {
484
517
  loggedTofuLines.add(plain);
485
518
  writeTechnicalLog("DEBUG", "tofu", plain);
486
519
  };
520
+ // edk#2946: note a stale provider selection whatever else consumes the line.
521
+ const observed = (consume) => (line) => {
522
+ if (mentionsStaleProviderSelection(line))
523
+ staleProviderSelectionSeen = true;
524
+ return consume?.(line) ?? false;
525
+ };
487
526
  const output = Promise.all([
488
- routeEiOutput(child.stdout, opts?.stdout ?? process.stdout, opts?.bridge === true ? (line) => {
527
+ routeEiOutput(child.stdout, opts?.stdout ?? process.stdout, observed(opts?.bridge === true ? (line) => {
489
528
  const plain = withoutAnsi(line);
490
529
  const event = parseProgressEvent(line);
491
530
  if (event !== undefined) {
@@ -520,8 +559,8 @@ export function runEiPassthrough(args, opts) {
520
559
  // A bridge-versioned ei may still emit ordinary user-facing text
521
560
  // (for example "Using tofu") on stdout. Preserve it verbatim.
522
561
  return false;
523
- } : undefined, writeUserPayload),
524
- routeEiOutput(child.stderr, opts?.stderr ?? process.stderr, opts?.bridge === true ? (line) => {
562
+ } : undefined), writeUserPayload),
563
+ routeEiOutput(child.stderr, opts?.stderr ?? process.stderr, observed(opts?.bridge === true ? (line) => {
525
564
  const plain = withoutAnsi(line);
526
565
  const event = parseProgressEvent(line);
527
566
  if (event !== undefined) {
@@ -559,7 +598,7 @@ export function runEiPassthrough(args, opts) {
559
598
  // Preserve unrecognized stderr through the writer callback so the
560
599
  // caller-selected stderr destination is retained.
561
600
  return false;
562
- } : undefined, writeUserPayload),
601
+ } : undefined), writeUserPayload),
563
602
  ]);
564
603
  const forwardSignal = (signal) => child.kill(signal);
565
604
  process.once("SIGINT", forwardSignal);
@@ -1066,8 +1105,8 @@ export function parseTofuJsonEvent(line) {
1066
1105
  return { type: "other" };
1067
1106
  }
1068
1107
  }
1069
- const TOFU_PROGRESS_LINE = /^(.+?): (Reading|Still reading|Preparing import|Importing|Refreshing state|Still refreshing|Read complete after|Import complete after|Refresh complete after|Creating|Still creating|Creation complete after|Modifying|Still modifying|Modification complete after|Destroying|Still destroying|Destruction complete after)\b/;
1070
- const TOFU_PROGRESS_EVENT_LABEL = /^(Reading|Still reading|Preparing import|Importing|Refreshing state|Still refreshing|Read complete after|Import complete after|Refresh complete after|Creating|Still creating|Creation complete after|Modifying|Still modifying|Modification complete after|Destroying|Still destroying|Destruction complete after):\s+(.+)$/;
1108
+ const TOFU_PROGRESS_LINE = new RegExp(String.raw `^(${TOFU_RESOURCE_ADDRESS}): (Reading|Still reading|Preparing import|Importing|Refreshing state|Still refreshing|Read complete after|Import complete after|Refresh complete after|Creating|Still creating|Creation complete after|Modifying|Still modifying|Modification complete after|Destroying|Still destroying|Destruction complete after)\b`);
1109
+ const TOFU_PROGRESS_EVENT_LABEL = new RegExp(String.raw `^(Reading|Still reading|Preparing import|Importing|Refreshing state|Still refreshing|Read complete after|Import complete after|Refresh complete after|Creating|Still creating|Creation complete after|Modifying|Still modifying|Modification complete after|Destroying|Still destroying|Destruction complete after):\s+(${TOFU_RESOURCE_ADDRESS})$`);
1071
1110
  const TOFU_PROGRESS_STARTS = new Set([
1072
1111
  "Reading", "Preparing import", "Importing", "Refreshing state",
1073
1112
  "Creating", "Modifying", "Destroying",