@elementumai/edk 0.8.0-preview.11 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/README.md +378 -324
  2. package/dist-sdk/src/catalog/ai-provider-models.d.ts +30 -0
  3. package/dist-sdk/src/catalog/ai-provider-models.js +63 -0
  4. package/dist-sdk/src/catalog/factories.d.ts +56 -3
  5. package/dist-sdk/src/catalog/factories.js +65 -2
  6. package/dist-sdk/src/catalog/from-authoring.js +6 -1
  7. package/dist-sdk/src/catalog/index.d.ts +3 -2
  8. package/dist-sdk/src/catalog/index.js +3 -2
  9. package/dist-sdk/src/catalog/org.d.ts +1 -1
  10. package/dist-sdk/src/catalog/org.js +83 -6
  11. package/dist-sdk/src/catalog/render.d.ts +13 -1
  12. package/dist-sdk/src/catalog/render.js +21 -4
  13. package/dist-sdk/src/catalog/token.js +14 -0
  14. package/dist-sdk/src/catalog/types.d.ts +60 -3
  15. package/dist-sdk/src/catalog/types.js +3 -0
  16. package/dist-sdk/src/core/system-fields.d.ts +2 -0
  17. package/dist-sdk/src/core/system-fields.js +2 -0
  18. package/dist-sdk/src/core/types/ai-provider.d.ts +10 -23
  19. package/dist-sdk/src/core/types/ai-provider.js +1 -25
  20. package/dist-sdk/src/core/types/app.d.ts +20 -1
  21. package/dist-sdk/src/engine/build/context.d.ts +18 -0
  22. package/dist-sdk/src/engine/build/source-context.d.ts +45 -0
  23. package/dist-sdk/src/engine/build/source-context.js +23 -0
  24. package/dist-sdk/src/engine/pull/context.d.ts +15 -0
  25. package/dist-sdk/src/engine/pull/org.d.ts +10 -0
  26. package/dist-sdk/src/engine/pull/org.js +34 -4
  27. package/dist-sdk/src/engine/tf/index.d.ts +1 -1
  28. package/dist-sdk/src/engine/tf/index.js +1 -1
  29. package/dist-sdk/src/engine/tf/labels.d.ts +45 -0
  30. package/dist-sdk/src/engine/tf/labels.js +71 -0
  31. package/dist-sdk/src/entities/access-policy/build.d.ts +26 -0
  32. package/dist-sdk/src/entities/access-policy/build.js +7 -0
  33. package/dist-sdk/src/entities/access-policy/filter.d.ts +61 -0
  34. package/dist-sdk/src/entities/access-policy/filter.js +83 -0
  35. package/dist-sdk/src/entities/access-policy/from-tf.d.ts +48 -0
  36. package/dist-sdk/src/entities/access-policy/from-tf.js +189 -0
  37. package/dist-sdk/src/entities/access-policy/module.d.ts +3 -0
  38. package/dist-sdk/src/entities/access-policy/module.js +17 -0
  39. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +36 -0
  40. package/dist-sdk/src/entities/access-policy/to-tf.js +149 -0
  41. package/dist-sdk/src/entities/access-policy/types.d.ts +4 -0
  42. package/dist-sdk/src/entities/access-policy/types.js +10 -0
  43. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +38 -3
  44. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +199 -32
  45. package/dist-sdk/src/entities/agent/from-tf.d.ts +18 -3
  46. package/dist-sdk/src/entities/agent/from-tf.js +135 -15
  47. package/dist-sdk/src/entities/agent/index.d.ts +1 -1
  48. package/dist-sdk/src/entities/agent/module.js +8 -2
  49. package/dist-sdk/src/entities/agent/to-tf.js +62 -10
  50. package/dist-sdk/src/entities/agent/tools.d.ts +88 -9
  51. package/dist-sdk/src/entities/agent/tools.js +46 -7
  52. package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +51 -4
  53. package/dist-sdk/src/entities/agent-tool/from-tf.js +131 -35
  54. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +4 -2
  55. package/dist-sdk/src/entities/agent-tool/to-tf.js +103 -17
  56. package/dist-sdk/src/entities/agent-tool/types.d.ts +5 -4
  57. package/dist-sdk/src/entities/agent-tool/types.js +38 -6
  58. package/dist-sdk/src/entities/app/build.d.ts +63 -13
  59. package/dist-sdk/src/entities/app/build.js +48 -1
  60. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +3 -0
  61. package/dist-sdk/src/entities/app/from-tf.d.ts +1 -1
  62. package/dist-sdk/src/entities/app/from-tf.js +32 -15
  63. package/dist-sdk/src/entities/app/index.d.ts +4 -1
  64. package/dist-sdk/src/entities/app/index.js +2 -1
  65. package/dist-sdk/src/entities/app/module.js +9 -2
  66. package/dist-sdk/src/entities/app/to-tf.d.ts +5 -0
  67. package/dist-sdk/src/entities/app/to-tf.js +33 -4
  68. package/dist-sdk/src/entities/automation/build.d.ts +57 -13
  69. package/dist-sdk/src/entities/automation/build.js +48 -36
  70. package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +25 -8
  71. package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +16 -1
  72. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +179 -43
  73. package/dist-sdk/src/entities/automation/filter.d.ts +15 -3
  74. package/dist-sdk/src/entities/automation/filter.js +12 -2
  75. package/dist-sdk/src/entities/automation/from-tf.d.ts +26 -27
  76. package/dist-sdk/src/entities/automation/from-tf.js +1229 -223
  77. package/dist-sdk/src/entities/automation/index.d.ts +4 -0
  78. package/dist-sdk/src/entities/automation/index.js +4 -0
  79. package/dist-sdk/src/entities/automation/module.js +29 -32
  80. package/dist-sdk/src/entities/automation/operators.d.ts +29 -2
  81. package/dist-sdk/src/entities/automation/operators.js +27 -1
  82. package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +19 -0
  83. package/dist-sdk/src/entities/automation/output-key-wire-name.js +24 -0
  84. package/dist-sdk/src/entities/automation/script-code.d.ts +10 -21
  85. package/dist-sdk/src/entities/automation/script-code.js +272 -5
  86. package/dist-sdk/src/entities/automation/tasks.d.ts +125 -19
  87. package/dist-sdk/src/entities/automation/tasks.js +83 -15
  88. package/dist-sdk/src/entities/automation/to-tf.d.ts +10 -29
  89. package/dist-sdk/src/entities/automation/to-tf.js +1134 -231
  90. package/dist-sdk/src/entities/automation/triggers.d.ts +9 -1
  91. package/dist-sdk/src/entities/automation/types.d.ts +29 -4
  92. package/dist-sdk/src/entities/automation/types.js +76 -46
  93. package/dist-sdk/src/entities/element/build.d.ts +23 -10
  94. package/dist-sdk/src/entities/element/build.js +1 -0
  95. package/dist-sdk/src/entities/element/from-tf.d.ts +1 -1
  96. package/dist-sdk/src/entities/element/from-tf.js +18 -3
  97. package/dist-sdk/src/entities/element/index.d.ts +4 -1
  98. package/dist-sdk/src/entities/element/index.js +2 -1
  99. package/dist-sdk/src/entities/element/module.js +3 -1
  100. package/dist-sdk/src/entities/element/to-tf.js +21 -3
  101. package/dist-sdk/src/entities/field/build.d.ts +56 -13
  102. package/dist-sdk/src/entities/field/build.js +10 -0
  103. package/dist-sdk/src/entities/field/calc/runtime.js +4 -0
  104. package/dist-sdk/src/entities/field/from-tf.d.ts +5 -3
  105. package/dist-sdk/src/entities/field/from-tf.js +118 -7
  106. package/dist-sdk/src/entities/field/module.js +3 -2
  107. package/dist-sdk/src/entities/field/to-tf.d.ts +27 -9
  108. package/dist-sdk/src/entities/field/to-tf.js +62 -17
  109. package/dist-sdk/src/entities/field/types.d.ts +26 -0
  110. package/dist-sdk/src/entities/field/types.js +34 -12
  111. package/dist-sdk/src/entities/file-reader/build.d.ts +108 -50
  112. package/dist-sdk/src/entities/file-reader/build.js +23 -23
  113. package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.d.ts +6 -0
  114. package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.js +109 -0
  115. package/dist-sdk/src/entities/file-reader/from-tf.d.ts +13 -0
  116. package/dist-sdk/src/entities/file-reader/from-tf.js +172 -0
  117. package/dist-sdk/src/entities/file-reader/index.d.ts +8 -3
  118. package/dist-sdk/src/entities/file-reader/index.js +7 -2
  119. package/dist-sdk/src/entities/file-reader/module.d.ts +3 -0
  120. package/dist-sdk/src/entities/file-reader/module.js +115 -0
  121. package/dist-sdk/src/entities/file-reader/to-tf.d.ts +14 -0
  122. package/dist-sdk/src/entities/file-reader/to-tf.js +84 -0
  123. package/dist-sdk/src/entities/file-reader/types.d.ts +32 -0
  124. package/dist-sdk/src/entities/file-reader/types.js +30 -0
  125. package/dist-sdk/src/entities/org/ai-provider.d.ts +13 -0
  126. package/dist-sdk/src/entities/org/ai-provider.js +46 -0
  127. package/dist-sdk/src/entities/org/connector.d.ts +8 -1
  128. package/dist-sdk/src/entities/org/connector.js +12 -14
  129. package/dist-sdk/src/entities/org/group.js +10 -1
  130. package/dist-sdk/src/entities/org/index.d.ts +1 -0
  131. package/dist-sdk/src/entities/org/index.js +1 -0
  132. package/dist-sdk/src/entities/org/user.js +10 -1
  133. package/dist-sdk/src/entities/shared/filters/ast.d.ts +44 -9
  134. package/dist-sdk/src/entities/shared/filters/types.d.ts +1 -1
  135. package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +17 -0
  136. package/dist-sdk/src/entities/shared/tool-field-ref.js +31 -0
  137. package/dist-sdk/src/entities/shared/types/field-types.d.ts +10 -1
  138. package/dist-sdk/src/entities/shared/types/field-types.js +9 -0
  139. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +19 -0
  140. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +36 -8
  141. package/dist-sdk/src/entities/skill/from-tf.js +4 -3
  142. package/dist-sdk/src/entities/skill/index.d.ts +1 -1
  143. package/dist-sdk/src/entities/skill/module.js +6 -1
  144. package/dist-sdk/src/entities/skill/to-tf.js +3 -2
  145. package/dist-sdk/src/entities/skill/tools.d.ts +25 -3
  146. package/dist-sdk/src/entities/skill/tools.js +17 -0
  147. package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +15 -2
  148. package/dist-sdk/src/entities/skill-tool/from-tf.js +32 -11
  149. package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +2 -0
  150. package/dist-sdk/src/entities/skill-tool/to-tf.js +32 -9
  151. package/dist-sdk/src/entities/view/from-tf.d.ts +6 -2
  152. package/dist-sdk/src/entities/view/from-tf.js +11 -9
  153. package/dist-sdk/src/entities/view/to-tf.d.ts +9 -7
  154. package/dist-sdk/src/entities/view/to-tf.js +33 -18
  155. package/dist-sdk/src/entities/view/types.d.ts +1 -1
  156. package/dist-sdk/src/entities/view/types.js +1 -1
  157. package/dist-sdk/src/graph/deferred-catalog-render.d.ts +0 -5
  158. package/dist-sdk/src/graph/deferred-catalog-render.js +1 -20
  159. package/dist-sdk/src/graph/index.d.ts +8 -0
  160. package/dist-sdk/src/graph/index.js +13 -9
  161. package/dist-sdk/src/graph/modules.js +6 -1
  162. package/dist-sdk/src/graph/types.d.ts +77 -3
  163. package/package.json +42 -14
  164. package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +0 -76
  165. package/dist-sdk/src/entities/automation/value-ref-tf.js +0 -190
@@ -10,7 +10,7 @@
10
10
  * (views have no nested sub-entities of their own), so this module never
11
11
  * throws `EntityTfError`.
12
12
  */
13
- import { type TfBlock, type TfValue } from "../../engine/tf/index.js";
13
+ import { type ChildResourceScope, type TfBlock, type TfValue } from "../../engine/tf/index.js";
14
14
  /** The authored field-ref shape post-`slimTokens`: a system key string, or a slimmed `FieldRef` token. */
15
15
  export type ViewFieldRefWire = string | {
16
16
  readonly __kind?: string;
@@ -42,16 +42,18 @@ export interface AppListViewWire {
42
42
  readonly sort?: unknown;
43
43
  }
44
44
  export interface ViewToTfOptions {
45
- /** The owning app's tfLabel (its namespace). */
46
- readonly appTfLabel: string;
45
+ /** The owning stream root's terraform label (namespace). */
46
+ readonly ownerTfLabel: string;
47
+ /** App children use `apps_<ns>_`; element children use `<ns>_`. */
48
+ readonly scope?: ChildResourceScope;
47
49
  /**
48
- * The owning app's display name — `elementum_managed_view_order`'s label
50
+ * The owning aspect's display name — `elementum_managed_view_order`'s label
49
51
  * has no authored bag key (it's a derived aspect-wide singleton), so ei
50
- * derives it from the app's NAME (its `SanitizeName`, not the namespace);
52
+ * derives it from the NAME (its `SanitizeName`, not the namespace);
51
53
  * matching that here keeps the build-vs-export address-stable across a real pull.
52
54
  */
53
- readonly appName: string;
54
- /** The owning app's id reference, e.g. `elementum_app.<ns>.id` — computed by the caller. */
55
+ readonly aspectName: string;
56
+ /** The owning aspect's id reference — computed by the caller. */
55
57
  readonly objectId: TfValue;
56
58
  /** Degradations land here — reported by the caller, never silent. */
57
59
  readonly diagnostics: string[];
@@ -10,16 +10,20 @@
10
10
  * (views have no nested sub-entities of their own), so this module never
11
11
  * throws `EntityTfError`.
12
12
  */
13
- import { expr, isCanonicalTsLabel, sanitizeName, tsLabelToTfLabel, } from "../../engine/tf/index.js";
13
+ import { expr, isCanonicalTsLabel, sanitizeName, scopedResourceLabel, tsLabelToTfLabel, } from "../../engine/tf/index.js";
14
14
  import { fieldRefToTfValue as customFieldRefToTfValue } from "../field/to-tf.js";
15
15
  import { SUB_TYPE_BY_AUTHORING_TYPE } from "../field/types.js";
16
16
  import { GROUP_SECTION_WIRE_TYPE, LAYOUT_RESOURCE_TYPE, LAYOUT_RESTRICTED_SYSTEM_FIELD_KEYS, LIST_VIEW_RESOURCE_TYPE, MANAGED_VIEW_ORDER_RESOURCE_TYPE, SECTION_TYPE_TO_WIRE, SYSTEM_FIELD_ID_ATTR_BY_KEY, UPDATE_SECTION_WIRE_TYPE, } from "./types.js";
17
17
  /** `layouts`/`listViews`/`viewOrder` → their resource blocks, in ei's dialect. */
18
18
  export function viewToTf(layouts, listViews, viewOrder, opts) {
19
- const { appTfLabel, appName, objectId, diagnostics } = opts;
19
+ const { ownerTfLabel, scope = "app", aspectName, objectId, diagnostics } = opts;
20
20
  const blocks = [];
21
21
  for (const [stageKey, layout] of Object.entries(layouts ?? {})) {
22
- blocks.push(layoutToTf(stageKey, layout, appTfLabel, objectId, diagnostics));
22
+ if (!isCanonicalTsLabel(stageKey)) {
23
+ diagnostics.push(`layouts key "${stageKey}" is not a canonical tsLabel (see src/engine/tf/labels.ts) — rename the key`);
24
+ continue;
25
+ }
26
+ blocks.push(layoutToTf(stageKey, layout, ownerTfLabel, scope, objectId, diagnostics));
23
27
  }
24
28
  const viewAddressByKey = new Map();
25
29
  for (const [viewKey, view] of Object.entries(listViews ?? {})) {
@@ -27,12 +31,12 @@ export function viewToTf(layouts, listViews, viewOrder, opts) {
27
31
  diagnostics.push(`listViews key "${viewKey}" is not a canonical tsLabel (see src/engine/tf/labels.ts) — rename the key`);
28
32
  continue;
29
33
  }
30
- const tfLabel = tsLabelToTfLabel(viewKey);
34
+ const tfLabel = scopedResourceLabel(ownerTfLabel, tsLabelToTfLabel(viewKey), scope);
31
35
  const attrs = {
32
36
  aspect_id: objectId,
33
37
  name: view.name ?? "",
34
38
  allow_record_creation: view.allowRecordCreation ?? true,
35
- columns: resolveFieldRefs(view.columns ?? [], appTfLabel, `listViews.${viewKey}.columns`, diagnostics),
39
+ columns: resolveFieldRefs(view.columns ?? [], ownerTfLabel, scope, `listViews.${viewKey}.columns`, diagnostics),
36
40
  density: view.density ?? "STANDARD",
37
41
  rows: view.rows ?? 25,
38
42
  };
@@ -69,14 +73,14 @@ export function viewToTf(layouts, listViews, viewOrder, opts) {
69
73
  blocks.push({
70
74
  kind: "resource",
71
75
  type: MANAGED_VIEW_ORDER_RESOURCE_TYPE,
72
- label: `${sanitizeName(appName)}_view_order`,
76
+ label: `${sanitizeName(aspectName)}_view_order`,
73
77
  attrs: { object_id: objectId, view_ids: viewIds },
74
78
  });
75
79
  }
76
80
  }
77
81
  return { blocks };
78
82
  }
79
- function layoutToTf(stageKey, layout, appTfLabel, objectId, diagnostics) {
83
+ function layoutToTf(stageKey, layout, ownerTfLabel, scope, objectId, diagnostics) {
80
84
  const sections = [];
81
85
  for (const section of layout.sections) {
82
86
  const authoringType = section.type ?? "group";
@@ -89,8 +93,14 @@ function layoutToTf(stageKey, layout, appTfLabel, objectId, diagnostics) {
89
93
  type: wireType,
90
94
  display_location: section.displayLocation ?? "CENTER",
91
95
  display_order: section.displayOrder ?? 0,
92
- side_nav_item: section.sideNavItem ?? false,
93
96
  };
97
+ // Mirrors ei's exporter (hcl_app.go): true is the platform default and is
98
+ // NEVER emitted; only an explicit false is written. Always emitting a
99
+ // value here (like the other three) would force `false` on every section
100
+ // whose sideNavItem was never captured (i.e. is really `true`), planning
101
+ // a spurious change on every build.
102
+ if (section.sideNavItem === false)
103
+ sec.side_nav_item = false;
94
104
  if (wireType === GROUP_SECTION_WIRE_TYPE) {
95
105
  sec.name = section.name ?? "";
96
106
  if (section.icon !== undefined)
@@ -105,41 +115,48 @@ function layoutToTf(stageKey, layout, appTfLabel, objectId, diagnostics) {
105
115
  }
106
116
  return true;
107
117
  });
108
- sec.field_ids = resolveFieldRefs(fields, appTfLabel, where, diagnostics);
118
+ sec.field_ids = resolveFieldRefs(fields, ownerTfLabel, scope, where, diagnostics);
109
119
  }
110
120
  else if (wireType === UPDATE_SECTION_WIRE_TYPE && section.name !== undefined) {
111
121
  sec.name = section.name;
112
122
  }
113
123
  sections.push(sec);
114
124
  }
125
+ // `stage_ids_by_key` (a real provider-computed attribute) is keyed by
126
+ // tfLabel ("in_progress"), not the authored tsLabel ("inProgress") — same
127
+ // bijection listViews already applies to its own label just above. Reusing
128
+ // the raw tsLabel here would both mislabel the resource (a fresh terraform
129
+ // address ei never produced) and index the map with a key that doesn't
130
+ // exist, breaking every plan.
131
+ const tfLabel = tsLabelToTfLabel(stageKey);
115
132
  return {
116
133
  kind: "resource",
117
134
  type: LAYOUT_RESOURCE_TYPE,
118
- label: stageKey,
135
+ label: scopedResourceLabel(ownerTfLabel, tfLabel, scope),
119
136
  attrs: {
120
137
  object_id: objectId,
121
- stage_id: expr.local(`${appTfLabel}_stage_ids_by_key`, [{ index: stageKey }]),
138
+ stage_id: expr.local(`${ownerTfLabel}_stage_ids_by_key`, [{ index: tfLabel }]),
122
139
  sections,
123
140
  },
124
141
  };
125
142
  }
126
- function resolveFieldRefs(refs, appTfLabel, where, diagnostics) {
143
+ function resolveFieldRefs(refs, ownerTfLabel, scope, where, diagnostics) {
127
144
  const out = [];
128
145
  for (const ref of refs) {
129
- const resolved = fieldRefToTfValue(ref, appTfLabel, where, diagnostics);
146
+ const resolved = fieldRefToTfValue(ref, ownerTfLabel, scope, where, diagnostics);
130
147
  if (resolved !== undefined)
131
148
  out.push(resolved);
132
149
  }
133
150
  return out;
134
151
  }
135
- function fieldRefToTfValue(ref, appTfLabel, where, diagnostics) {
152
+ function fieldRefToTfValue(ref, ownerTfLabel, scope, where, diagnostics) {
136
153
  if (typeof ref === "string") {
137
154
  const attr = SYSTEM_FIELD_ID_ATTR_BY_KEY.get(ref);
138
155
  if (attr === undefined) {
139
156
  diagnostics.push(`${where}: "${ref}" is not a known system field key; dropped`);
140
157
  return undefined;
141
158
  }
142
- return expr.local(`${appTfLabel}_${attr}`);
159
+ return expr.local(`${ownerTfLabel}_${attr}`);
143
160
  }
144
161
  const refName = ref.refName ?? "";
145
162
  if (!SUB_TYPE_BY_AUTHORING_TYPE.has(ref.fieldType ?? "")) {
@@ -150,7 +167,5 @@ function fieldRefToTfValue(ref, appTfLabel, where, diagnostics) {
150
167
  diagnostics.push(`${where}: field bag key "${refName}" is not a canonical tsLabel; dropped`);
151
168
  return undefined;
152
169
  }
153
- // Actual resourceAttr construction is shared with agent-tool's field refs
154
- // (src/entities/agent-tool/to-tf.ts) via entities/field/to-tf.ts.
155
- return customFieldRefToTfValue(ref.fieldType, refName);
170
+ return customFieldRefToTfValue(ref.fieldType, refName, ownerTfLabel, scope);
156
171
  }
@@ -15,7 +15,7 @@ export declare const LIST_VIEW_RESOURCE_TYPE = "elementum_list_view";
15
15
  export declare const MANAGED_VIEW_ORDER_RESOURCE_TYPE = "elementum_managed_view_order";
16
16
  /**
17
17
  * Layout section `type` discriminator: authoring camelCase ↔ the provider's
18
- * wire value, verified against `fde-tf-cli-old`'s `layout_resource.go`
18
+ * wire value, verified against `provider/internal/provider/layout_resource.go`
19
19
  * (the schema's own embedded doc table). Only `group` carries
20
20
  * `name`/`icon`/`color`/`field_ids`; `update` additionally takes an optional
21
21
  * `name`; the rest are bare component sections.
@@ -17,7 +17,7 @@ export const LIST_VIEW_RESOURCE_TYPE = "elementum_list_view";
17
17
  export const MANAGED_VIEW_ORDER_RESOURCE_TYPE = "elementum_managed_view_order";
18
18
  /**
19
19
  * Layout section `type` discriminator: authoring camelCase ↔ the provider's
20
- * wire value, verified against `fde-tf-cli-old`'s `layout_resource.go`
20
+ * wire value, verified against `provider/internal/provider/layout_resource.go`
21
21
  * (the schema's own embedded doc table). Only `group` carries
22
22
  * `name`/`icon`/`color`/`field_ids`; `update` additionally takes an optional
23
23
  * `name`; the rest are bare component sections.
@@ -7,8 +7,3 @@ import type { CatalogRenderArgs, CatalogRenderResult } from "./types.js";
7
7
  export declare function renderDeferredNamedEntry(factoryName: string, opts?: {
8
8
  readonly omitParent?: boolean;
9
9
  }): (args: CatalogRenderArgs) => CatalogRenderResult;
10
- /**
11
- * Document model with optional inline `fields` bag — mirrors the former
12
- * catalog/render.ts dialect.
13
- */
14
- export declare function renderDocumentModelEntry(args: CatalogRenderArgs): CatalogRenderResult;
@@ -2,7 +2,7 @@
2
2
  * Catalog renderEntry for kinds not yet registered as EntityKindModules.
3
3
  * Moves onto each kind's CatalogFacet when its module lands.
4
4
  */
5
- import { asNamedRef, namedFactoryEntry, safeCatalogKey, } from "../catalog/render-helpers.js";
5
+ import { asNamedRef, namedFactoryEntry, } from "../catalog/render-helpers.js";
6
6
  /** Simple `{ name }` / optional parent — flow, approvalChain, nested stubs. */
7
7
  export function renderDeferredNamedEntry(factoryName, opts) {
8
8
  return (args) => {
@@ -16,22 +16,3 @@ export function renderDeferredNamedEntry(factoryName, opts) {
16
16
  });
17
17
  };
18
18
  }
19
- /**
20
- * Document model with optional inline `fields` bag — mirrors the former
21
- * catalog/render.ts dialect.
22
- */
23
- export function renderDocumentModelEntry(args) {
24
- const ref = args.ref;
25
- const fieldKeys = Object.keys(ref.fields ?? {}).sort();
26
- const head = `${args.baseIndent}${safeCatalogKey(args.keyName)}: documentModelRef({ name: ${JSON.stringify(ref.name)}`;
27
- if (fieldKeys.length === 0) {
28
- return { lines: [`${head} }),`] };
29
- }
30
- const lines = [`${head},`, `${args.baseIndent} fields: {`];
31
- for (const key of fieldKeys) {
32
- const field = ref.fields[key];
33
- lines.push(`${args.baseIndent} ${safeCatalogKey(key)}: documentModelFieldRef({ name: ${JSON.stringify(field.name)}, parent: ${JSON.stringify(field.parent ?? "")} }),`);
34
- }
35
- lines.push(`${args.baseIndent} },`, `${args.baseIndent}}),`);
36
- return { lines, extraFactories: ["documentModelFieldRef"] };
37
- }
@@ -19,6 +19,14 @@ export declare const DATA_FACET_MODULES: readonly EntityKindModule[];
19
19
  export declare const DATA_FACET_BY_TYPE: ReadonlyMap<string, EntityKindModule>;
20
20
  /** Org identity bags written by `edk pull org` (data.orgBag set). */
21
21
  export declare const ORG_IDENTITY_BAGS: readonly EntityKindModule[];
22
+ /**
23
+ * `defineAiProvider({ type })` identifiers → their terraform resource type —
24
+ * one entry per `ai-provider-*` kind, derived from the kind id so authored
25
+ * source never has to name a resource type directly.
26
+ */
27
+ export declare const AI_PROVIDER_RESOURCE_TYPE_BY_TYPE: ReadonlyMap<string, string>;
28
+ /** Reverse of {@link AI_PROVIDER_RESOURCE_TYPE_BY_TYPE} — resourceType → public `type`. */
29
+ export declare const AI_PROVIDER_TYPE_BY_RESOURCE_TYPE: ReadonlyMap<string, string>;
22
30
  /** Backward-compatible metadata view derived from the graph. */
23
31
  export declare const RESOURCE_KIND_MODULES: readonly ResourceKindModule[];
24
32
  /** Resource types the §6 adoption gates import. */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Public graph barrel: KIND_MODULES + derived views for pull/build/canvas.
3
3
  */
4
- import { renderDeferredNamedEntry, renderDocumentModelEntry, } from "./deferred-catalog-render.js";
4
+ import { renderDeferredNamedEntry } from "./deferred-catalog-render.js";
5
5
  import { KIND_MODULES } from "./modules.js";
6
6
  import { implementedResourceTypes, isResourceAdoptable, isTfLive, knownResourceTypes, matchType, singleResourceType, } from "./types.js";
7
7
  export { NO_CANVAS, NO_CATALOG, NO_DATA, NO_LIFECYCLE, defaultMatchResourceType, implementedResourceTypes, isResourceAdoptable, isTfLive, knownResourceTypes, matchType, singleResourceType, } from "./types.js";
@@ -22,6 +22,18 @@ export const DATA_FACET_BY_TYPE = (() => {
22
22
  })();
23
23
  /** Org identity bags written by `edk pull org` (data.orgBag set). */
24
24
  export const ORG_IDENTITY_BAGS = DATA_FACET_MODULES.filter((m) => m.data.participates && m.data.orgBag !== undefined);
25
+ const AI_PROVIDER_KIND_PREFIX = "ai-provider-";
26
+ /**
27
+ * `defineAiProvider({ type })` identifiers → their terraform resource type —
28
+ * one entry per `ai-provider-*` kind, derived from the kind id so authored
29
+ * source never has to name a resource type directly.
30
+ */
31
+ export const AI_PROVIDER_RESOURCE_TYPE_BY_TYPE = new Map(ORG_IDENTITY_BAGS.filter((m) => m.kind.startsWith(AI_PROVIDER_KIND_PREFIX)).flatMap((m) => {
32
+ const resourceType = singleResourceType(m);
33
+ return resourceType === undefined ? [] : [[m.kind.slice(AI_PROVIDER_KIND_PREFIX.length), resourceType]];
34
+ }));
35
+ /** Reverse of {@link AI_PROVIDER_RESOURCE_TYPE_BY_TYPE} — resourceType → public `type`. */
36
+ export const AI_PROVIDER_TYPE_BY_RESOURCE_TYPE = new Map([...AI_PROVIDER_RESOURCE_TYPE_BY_TYPE].map(([type, resourceType]) => [resourceType, type]));
25
37
  /** Backward-compatible metadata view derived from the graph. */
26
38
  export const RESOURCE_KIND_MODULES = KIND_MODULES.filter(isTfLive).map((m) => ({
27
39
  kind: m.kind,
@@ -141,14 +153,6 @@ const DEFERRED_CATALOG_META = [
141
153
  factoryName: "approvalChainRef",
142
154
  renderEntry: renderDeferredNamedEntry("approvalChainRef"),
143
155
  },
144
- {
145
- refKind: "documentModel",
146
- catalogBag: "fileReaders",
147
- renderOrder: 55,
148
- catalogRoot: "app",
149
- factoryName: "documentModelRef",
150
- renderEntry: renderDocumentModelEntry,
151
- },
152
156
  {
153
157
  refKind: "tableColumn",
154
158
  catalogBag: "columns",
@@ -2,13 +2,15 @@
2
2
  * KIND_MODULES assembly — the only place that imports concrete entity
3
3
  * modules. Engine code imports derived views from {@link ./index.js}.
4
4
  */
5
+ import { accessPolicyModule } from "../entities/access-policy/module.js";
5
6
  import { agentModule } from "../entities/agent/module.js";
6
7
  import { agentToolModule } from "../entities/agent-tool/module.js";
7
8
  import { appModule } from "../entities/app/module.js";
8
9
  import { automationModule } from "../entities/automation/module.js";
9
10
  import { elementModule } from "../entities/element/module.js";
10
11
  import { fieldModule } from "../entities/field/module.js";
11
- import { categoryModule, cloudLinkModule, connectorModule, groupModule, roleModule, userModule, } from "../entities/org/index.js";
12
+ import { fileReaderModule } from "../entities/file-reader/module.js";
13
+ import { aiProviderModules, categoryModule, cloudLinkModule, connectorModule, groupModule, roleModule, userModule, } from "../entities/org/index.js";
12
14
  import { searchTableModule } from "../entities/search-table/module.js";
13
15
  import { skillModule } from "../entities/skill/module.js";
14
16
  import { skillToolModule } from "../entities/skill-tool/module.js";
@@ -19,9 +21,11 @@ export const KIND_MODULES = [
19
21
  appModule,
20
22
  elementModule,
21
23
  fieldModule,
24
+ accessPolicyModule,
22
25
  agentModule,
23
26
  agentToolModule,
24
27
  automationModule,
28
+ fileReaderModule,
25
29
  viewModule,
26
30
  managedViewOrderModule,
27
31
  skillModule,
@@ -31,6 +35,7 @@ export const KIND_MODULES = [
31
35
  cloudLinkModule,
32
36
  categoryModule,
33
37
  connectorModule,
38
+ ...aiProviderModules,
34
39
  groupModule,
35
40
  roleModule,
36
41
  userModule,
@@ -9,7 +9,7 @@
9
9
  import type { DeployableEntity } from "../engine/entity.js";
10
10
  import type { FromTfContext } from "../engine/pull/context.js";
11
11
  import type { TfBlock } from "../engine/tf/index.js";
12
- export type KindId = "org" | "app" | "element" | "field" | "agent" | "agent-tool" | "automation" | "skill" | "skill-tool" | "view" | "managed-view-order" | "search-table" | "table" | "cloud-link" | "category" | "connector" | "group" | "role" | "user";
12
+ export type KindId = "org" | "app" | "element" | "field" | "access-policy" | "agent" | "agent-tool" | "automation" | "file-reader" | "skill" | "skill-tool" | "view" | "managed-view-order" | "search-table" | "table" | "cloud-link" | "category" | "connector" | "ai-provider-anthropic" | "ai-provider-bedrock" | "ai-provider-custom" | "ai-provider-deepgram" | "ai-provider-elevenlab" | "ai-provider-gemini" | "ai-provider-openai" | "ai-provider-snowflake" | "ai-provider-xai" | "ai-provider-managed" | "group" | "role" | "user";
13
13
  /** @deprecated Use {@link KindId}. */
14
14
  export type EntityKindId = KindId;
15
15
  export type StreamFacet = {
@@ -76,8 +76,8 @@ export type ResourceFacet = {
76
76
  /** How a resource type belonging to this kind participates in stream partition. */
77
77
  export type StreamMatch = "extract" | "family" | "reported";
78
78
  /** Catalog kinds used by org identity data facets. */
79
- export type DataFacetCatalogKind = "cloudLink" | "category" | "connector" | "group";
80
- export type OrgIdentityBag = "cloudLinks" | "categories" | "connectors" | "groups";
79
+ export type DataFacetCatalogKind = "cloudLink" | "category" | "connector" | "group" | "aiProvider";
80
+ export type OrgIdentityBag = "cloudLinks" | "categories" | "connectors" | "groups" | "aiProviders";
81
81
  /**
82
82
  * Kind can be materialized as a data lookup / interface (not adopted), or
83
83
  * {@link NO_DATA} when it does not participate.
@@ -91,6 +91,15 @@ export type DataFacet = {
91
91
  readonly catalogKind?: DataFacetCatalogKind;
92
92
  /** If set, pull org writes identities into org.ts under this property. */
93
93
  readonly orgBag?: OrgIdentityBag;
94
+ /**
95
+ * Attribute that's a `data-attr` reference to this identity's owner
96
+ * (connector's `provider_id` → the owning `elementum_<type>_ai_provider`
97
+ * block) rather than a plain string — read as a TfExpr, not via
98
+ * `requireStringAttr`. A bag can span multiple resource types (10
99
+ * distinct `elementum_<type>_ai_provider` types share `orgBag:
100
+ * "aiProviders"`), so the referenced type isn't known until read.
101
+ */
102
+ readonly providerRefAttr?: string;
94
103
  };
95
104
  /** Null-object data facet — kind is not a data lookup. */
96
105
  export declare const NO_DATA: DataFacet;
@@ -199,12 +208,63 @@ export interface PrintedOwnFile {
199
208
  export interface PrintOwnFileOptions {
200
209
  readonly appRefName: string;
201
210
  readonly orgImportPath: string;
211
+ /**
212
+ * Set by `edk clone app --target-root` when the destination org differs
213
+ * from the source: org-identity references (connectors, cloud links, …)
214
+ * resolved against the SOURCE org's catalog are meaningless in the
215
+ * destination, so printers degrade them to a flagged TODO token instead of
216
+ * the resolved reference, for manual review — same pattern already used
217
+ * for a structurally-unresolved reference, just triggered unconditionally.
218
+ */
219
+ readonly crossOrg?: boolean;
220
+ /**
221
+ * The destination org's connector compound keys (cross-org only), each
222
+ * `"<provider>.<model>"` — since both halves are deterministically derived
223
+ * from display names (`src/engine/tf/labels.ts`), a key present in both
224
+ * orgs means both orgs have that same provider/model pair. When set and
225
+ * the source's `connectorKey` is a member, printers use it directly
226
+ * instead of degrading to a TODO.
227
+ */
228
+ readonly destinationConnectorKeys?: ReadonlySet<string>;
229
+ /**
230
+ * A destination-org connector compound key (`"<provider>.<model>"`) the
231
+ * caller already confirmed — `edk clone app --target-root` prompts the
232
+ * user interactively when a connector (or the total absence of one) has
233
+ * no automatic match, instead of always degrading to a `TODO_CONNECTOR`
234
+ * placeholder. Consumed today only by the agent printer; harmless
235
+ * (ignored) for other own-file kinds.
236
+ */
237
+ readonly connectorKeyOverride?: string;
238
+ /**
239
+ * Name → refName for every app already on disk in this workspace
240
+ * (board issue #40). A tool/skillAccess `aspect`/foreign-app reference
241
+ * whose name is a key here has that dependency actually pulled locally —
242
+ * printers use `catalog.<refName>` instead of the always-safe
243
+ * `{ __kind: "app", refName: name, name }` literal stub. Absent (or a
244
+ * miss) falls back to the stub exactly as before.
245
+ */
246
+ readonly foreignAppRefNames?: ReadonlyMap<string, string>;
247
+ /**
248
+ * Same as {@link foreignAppRefNames}, keyed for elements (board issue
249
+ * #42) — a `foreignElement` aspect target whose name is a key here
250
+ * prints `catalog.<refName>` instead of the literal stub.
251
+ */
252
+ readonly foreignElementRefNames?: ReadonlyMap<string, string>;
253
+ }
254
+ export interface BuildFieldMetadata {
255
+ readonly name: string;
256
+ readonly fieldType: string;
257
+ readonly options?: readonly string[];
258
+ readonly tags?: readonly string[];
202
259
  }
203
260
  export interface BuildChildContext {
204
261
  readonly appRefName: string;
205
262
  readonly appTfLabel: string;
206
263
  readonly orgRefs: unknown;
207
264
  readonly diagnostics: string[];
265
+ readonly fieldAddresses?: ReadonlyMap<string, string>;
266
+ readonly fieldNames?: ReadonlyMap<string, string>;
267
+ readonly fieldMetadata?: ReadonlyMap<string, BuildFieldMetadata>;
208
268
  }
209
269
  /** Result of extracting a stream-root kind (app, element) from a partitioned export. */
210
270
  export interface StreamRootExtractResult {
@@ -218,6 +278,19 @@ export interface ToTfResult {
218
278
  readonly blocks: readonly TfBlock[];
219
279
  /** Present for app roots — field addresses for locals / catalog bookkeeping. */
220
280
  readonly fieldAddresses?: ReadonlyMap<string, string>;
281
+ readonly fieldNames?: ReadonlyMap<string, string>;
282
+ readonly fieldMetadata?: ReadonlyMap<string, BuildFieldMetadata>;
283
+ /**
284
+ * Own-file children only — the terraform address ("type.label") of this
285
+ * child's own entry-point resource (e.g. `elementum_automation.x`,
286
+ * `elementum_agent.x`): the one thing every other block this child emits
287
+ * already chains back to via a real reference (a trigger's `automation =
288
+ * ...`, a tool's owning agent, …). When present, build.ts attaches a
289
+ * `depends_on` on just this one resource covering every field on the app,
290
+ * so the whole child transitively waits for all fields without needing to
291
+ * track which of its resources actually reference which field.
292
+ */
293
+ readonly address?: string;
221
294
  }
222
295
  export type LifecycleFacet = {
223
296
  readonly participates: false;
@@ -257,6 +330,7 @@ export interface StreamPartition {
257
330
  readonly reported: readonly string[];
258
331
  readonly unknown: readonly string[];
259
332
  readonly allResources: readonly TfBlock[];
333
+ readonly allBlocks: readonly TfBlock[];
260
334
  }
261
335
  export interface EntityKindModule {
262
336
  readonly kind: KindId;
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@elementumai/edk",
3
- "version": "0.8.0-preview.11",
4
- "description": "Elementum Development Kit — strongly-typed SDK for building Elementum automations, agents, and flows",
3
+ "version": "0.8.1",
4
+ "description": "Elementum Development Kit — statically typed SDK for building Elementum automations, agents, and flows",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "git+https://github.com/elementum-fde/elementum-development-kit.git"
9
+ "url": "git+https://github.com/elementum-fde/edk.git"
10
10
  },
11
11
  "engines": {
12
- "node": "24.x"
12
+ "node": ">=24"
13
13
  },
14
14
  "publishConfig": {
15
15
  "registry": "https://registry.npmjs.org",
@@ -128,53 +128,81 @@
128
128
  "sync:version": "tsx src/scripts/sync-cli-version.ts",
129
129
  "sync:skills": "tsx src/scripts/sync-skill-assets.ts",
130
130
  "sync:compatibility": "tsx src/scripts/sync-compatibility.ts",
131
+ "fetch:schema": "make -C provider fetch-schema",
132
+ "generate:schema": "make -C provider generate-schema",
131
133
  "build": "npm run build:sdk",
132
134
  "build:sdk": "rm -rf dist-sdk && tsc -p tsconfig.sdk.json",
133
135
  "build:cli": "npm run sync:version && npm run sync:skills && npm run sync:compatibility && rm -rf dist-cli && tsc -p tsconfig.cli.json",
134
- "version": "npm run sync:version && npm run sync:skills && git add src/cli/version.ts src/cli/skills-assets.ts skills/elementum-edk-authoring/SKILL.md",
136
+ "prebuild:provider": "npm run generate:schema",
137
+ "build:provider": "go -C provider build -v .",
138
+ "prebuild:bridge": "npm run generate:schema",
139
+ "build:bridge": "mkdir -p integration/.toolchain && go -C cmd/elementum build -v -o ../../integration/.toolchain/ei .",
140
+ "build:go": "npm run build:provider && npm run build:bridge",
141
+ "build:distribution": "npm --prefix distribution run build",
142
+ "version": "npm run sync:version && npm run sync:skills && git add src/cli/version.ts src/cli/skills-assets.ts skills/user/*/SKILL.md",
135
143
  "build:binary:bun": "npm run build:cli && node dist-cli/src/scripts/build-bun-binary.js",
136
144
  "build:binary:bun:all": "npm run build:cli && node dist-cli/src/scripts/build-bun-binary.js --all",
145
+ "local:setup": "bash integration/local-toolchain.sh",
146
+ "elementum": "bash integration/tools/elementum-local.sh",
147
+ "local:clone": "bash integration/tools/clone-golden.sh",
137
148
  "smoke:binary:bun": "node dist-cli/src/scripts/smoke-bun-binary.js",
138
149
  "prepare": "husky || true",
139
150
  "prepack": "npm run build:sdk",
140
151
  "pack:dry-run": "npm pack --dry-run",
141
152
  "pack:consumer": "npm run build:sdk && tsx src/scripts/test-package-consumer.ts",
142
153
  "test": "tsc --noEmit -p tsconfig.typecheck-tests.json && vitest run",
154
+ "pretest:provider": "npm run generate:schema",
155
+ "test:provider": "go -C provider test -v -cover -timeout=120s -parallel=10 ./internal/...",
156
+ "pretest:bridge": "npm run generate:schema",
157
+ "test:bridge": "go -C cmd/elementum test -v -timeout=30s ./...",
158
+ "test:go": "npm run test:provider && npm run test:bridge",
159
+ "test:distribution": "npm --prefix distribution test",
143
160
  "test:watch": "vitest",
144
- "integration": "npm run build:cli && node integration/run.mjs",
145
- "integration:nobuild": "node integration/run.mjs",
146
- "plan": "tsx src/scripts/plan.ts",
147
- "apply": "tsx src/scripts/apply.ts",
161
+ "test:cli": "vitest run __tests__/cli",
162
+ "test:binary": "npm run build:binary:bun && npm run smoke:binary:bun",
163
+ "test:integration": "node integration/run.mjs",
148
164
  "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.examples-check.json && tsc --noEmit -p tsconfig.package-consumer-check.json",
149
165
  "typecheck:src": "tsc --noEmit",
150
166
  "typecheck:examples": "tsc --noEmit -p tsconfig.examples-check.json",
151
167
  "typecheck:consumer": "tsc --noEmit -p tsconfig.package-consumer-check.json",
152
168
  "typecheck:tests": "tsc --noEmit -p tsconfig.typecheck-tests.json",
153
- "lint": "eslint src/cli src/internal/sdk-package.ts src/scripts/test-package-consumer.ts examples/package-consumer",
169
+ "lint": "eslint src/cli src/internal/sdk-package.ts src/scripts/prepare-release-promotion.ts src/scripts/test-package-consumer.ts examples/package-consumer",
154
170
  "lint:all": "eslint .",
155
171
  "lint:generated": "eslint generated/",
156
172
  "check": "npm run typecheck && npm run lint",
173
+ "check:distribution": "npm --prefix distribution run check",
174
+ "verify:distribution": "npm run check:distribution && npm run test:distribution && npm run build:distribution && git diff --exit-code -- distribution/generated distribution/public/schemas",
157
175
  "edk:canvas": "tsx --tsconfig tsconfig.examples-check.json src/scripts/edk-canvas.ts"
158
176
  },
159
177
  "dependencies": {
160
- "jiti": "^2.7.0"
178
+ "jiti": "^2.7.0",
179
+ "semver": "^7.8.5"
161
180
  },
162
181
  "devDependencies": {
163
182
  "@cdktf/hcl2json": "^0.21.0",
164
183
  "@eslint/js": "^9.39.4",
165
184
  "@types/node": "^25.5.2",
166
- "@vercel/blob": "^2.6.1",
167
185
  "@types/semver": "^7.8.0",
186
+ "@vercel/blob": "^2.6.1",
187
+ "ajv": "^8.20.0",
188
+ "ajv-formats": "^3.0.1",
168
189
  "bun": "^1.3.14",
169
190
  "commander": "^14.0.3",
170
191
  "eslint": "^9.39.4",
192
+ "graphql": "^17.0.2",
171
193
  "husky": "^9.1.7",
172
194
  "openpgp": "^6.3.1",
173
- "semver": "^7.8.5",
174
195
  "tar": "^7.5.22",
175
196
  "tsx": "^4.21.0",
176
197
  "typescript": "^6.0.2",
177
198
  "typescript-eslint": "^8.59.1",
178
- "vitest": "^4.1.1"
199
+ "vitest": "^4.1.1",
200
+ "yaml": "^2.9.0"
201
+ },
202
+ "allowScripts": {
203
+ "bun@1.3.14": true,
204
+ "esbuild@0.27.4": true,
205
+ "esbuild@0.25.12": true,
206
+ "fsevents@2.3.3": true
179
207
  }
180
208
  }
@@ -1,76 +0,0 @@
1
- /**
2
- * Value-reference codec for the automation tf dialect.
3
- *
4
- * The compose wire carries refs as JSON envelopes ({triggerReference},
5
- * {taskReference}, {variableReference}, {templateReference}, {value}); ei's
6
- * HCL dialect carries them as `refs["…"]` RESOURCE EXPRESSIONS resolved at
7
- * apply — `elementum_on_demand_trigger.x.refs["STUDENT_NAME"]` — with plain
8
- * literals for static values and `${…}` interpolated strings for multi-part
9
- * templates (cmd/elementum/export/hcl_task.go convertToRefsSyntax). ei's
10
- * exporter falls back to embedding the raw JSON (with platform ids) when it
11
- * can't resolve a ref; that fallback is NOT reproduced here — build emits only
12
- * the id-free refs syntax, and pull reports the JSON fallback loudly instead
13
- * of guessing.
14
- *
15
- * refs-map KEY naming (provider sources):
16
- * - on_demand trigger: the DECLARED parameter name (the authored schema key;
17
- * the wire's triggerReference name is the Mobius-canonicalized form —
18
- * reverse-mapped here via the declared names).
19
- * - variable task: the variable_name (buildVariableTaskRefs).
20
- * - execute_script: "Result" for the whole result, "result.<prop>" per
21
- * output-schema property.
22
- */
23
- import { type TfValue } from "../../engine/tf/index.js";
24
- import type { RefExpr } from "./deserializer/ast.js";
25
- export interface WireRefContext {
26
- /** The automation's tf label (trigger blocks share it). */
27
- readonly autoLabel: string;
28
- /** The trigger block's resource type. */
29
- readonly triggerType: string;
30
- /** Declared onDemand parameter names (authored schema keys), for reverse canonicalization. */
31
- readonly paramNames: readonly string[];
32
- /** Task refKey → its tf resource type (implemented tasks only). */
33
- readonly taskType: (refKey: string) => string | undefined;
34
- /** Task refKey → the result property names its output schema declares. */
35
- readonly taskResultProps: (refKey: string) => readonly string[];
36
- /** Stamped variable id → its owning task refKey + variable name. */
37
- readonly variableById: ReadonlyMap<string, {
38
- taskRefKey: string;
39
- varName: string;
40
- }>;
41
- }
42
- export type WireRefResult = {
43
- value: TfValue;
44
- } | {
45
- unsupported: string;
46
- };
47
- /** Wire ref envelope → tf attribute value (literal, refs expression, or template). */
48
- export declare function wireRefToTf(ref: unknown, ctx: WireRefContext): WireRefResult;
49
- /** Index the stamped variable ids in a finalized payload: id → {taskRefKey, varName}. */
50
- export declare function indexVariableIds(tasks: ReadonlyArray<{
51
- refKey?: string;
52
- task?: Record<string, unknown>;
53
- }>): Map<string, {
54
- taskRefKey: string;
55
- varName: string;
56
- }>;
57
- export interface TfRefContext {
58
- /** The automation's tf label — the label-strip FALLBACK for refKey recovery. */
59
- readonly autoLabel: string;
60
- /** Trigger resource types (any `*_trigger`). */
61
- readonly isTriggerType: (type: string) => boolean;
62
- /**
63
- * Task tf label → the authored refKey (recovered from the block's `name`
64
- * attribute when the label derives from it — see from-tf). Labels are
65
- * snake_case by ei's labeling rule, so this is what preserves caps/spaces
66
- * in task names across a pull.
67
- */
68
- readonly refKeyByLabel: ReadonlyMap<string, string>;
69
- }
70
- export type TfRefResult = {
71
- ast: RefExpr | string | number | boolean;
72
- } | {
73
- unsupported: string;
74
- };
75
- /** tf attribute value → printer AST node (inverse of wireRefToTf). */
76
- export declare function tfRefToAst(value: TfValue, ctx: TfRefContext): TfRefResult;