@elementumai/edk 0.9.20 → 0.10.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 (147) hide show
  1. package/README.md +19 -7
  2. package/dist-sdk/src/catalog/factories.d.ts +10 -2
  3. package/dist-sdk/src/catalog/factories.js +10 -1
  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/token.js +4 -0
  7. package/dist-sdk/src/catalog/types.d.ts +7 -1
  8. package/dist-sdk/src/catalog/types.js +1 -0
  9. package/dist-sdk/src/core/triggers/on-demand.d.ts +2 -2
  10. package/dist-sdk/src/core/triggers/on-demand.js +7 -0
  11. package/dist-sdk/src/core/types/app.d.ts +2 -2
  12. package/dist-sdk/src/engine/coverage-gaps.d.ts +86 -0
  13. package/dist-sdk/src/engine/coverage-gaps.js +156 -0
  14. package/dist-sdk/src/engine/ei/run.d.ts +21 -1
  15. package/dist-sdk/src/engine/ei/run.js +89 -2
  16. package/dist-sdk/src/engine/pull/catalog-ref.d.ts +16 -0
  17. package/dist-sdk/src/engine/pull/catalog-ref.js +24 -0
  18. package/dist-sdk/src/engine/pull/context.d.ts +68 -6
  19. package/dist-sdk/src/engine/pull/context.js +40 -1
  20. package/dist-sdk/src/engine/pull/procedure-refs.d.ts +8 -0
  21. package/dist-sdk/src/engine/pull/procedure-refs.js +28 -0
  22. package/dist-sdk/src/engine/pull/result-output.js +27 -1
  23. package/dist-sdk/src/engine/tf/index.d.ts +1 -1
  24. package/dist-sdk/src/engine/tf/index.js +1 -1
  25. package/dist-sdk/src/engine/tf/labels.d.ts +22 -5
  26. package/dist-sdk/src/engine/tf/labels.js +45 -3
  27. package/dist-sdk/src/engine/tf/parse.js +3 -2
  28. package/dist-sdk/src/engine/validation.d.ts +5 -0
  29. package/dist-sdk/src/engine/validation.js +12 -2
  30. package/dist-sdk/src/entities/access-policy/from-tf.js +38 -1
  31. package/dist-sdk/src/entities/access-policy/principal.d.ts +2 -0
  32. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +3 -0
  33. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +42 -19
  34. package/dist-sdk/src/entities/agent/from-tf.js +11 -3
  35. package/dist-sdk/src/entities/agent/module.js +2 -0
  36. package/dist-sdk/src/entities/agent/to-tf.js +14 -3
  37. package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +8 -1
  38. package/dist-sdk/src/entities/agent-tool/from-tf.js +11 -5
  39. package/dist-sdk/src/entities/agent-tool/module.js +3 -0
  40. package/dist-sdk/src/entities/app/auto-share.d.ts +38 -0
  41. package/dist-sdk/src/entities/app/auto-share.js +49 -0
  42. package/dist-sdk/src/entities/app/build.d.ts +17 -3
  43. package/dist-sdk/src/entities/app/build.js +56 -4
  44. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +6 -1
  45. package/dist-sdk/src/entities/app/from-tf.js +4 -0
  46. package/dist-sdk/src/entities/app/index.d.ts +2 -1
  47. package/dist-sdk/src/entities/app/index.js +1 -8
  48. package/dist-sdk/src/entities/app/to-tf.d.ts +6 -0
  49. package/dist-sdk/src/entities/app/to-tf.js +21 -2
  50. package/dist-sdk/src/entities/automation/build.d.ts +10 -2
  51. package/dist-sdk/src/entities/automation/build.js +104 -17
  52. package/dist-sdk/src/entities/automation/calculation-expression.d.ts +7 -7
  53. package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +17 -4
  54. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +156 -19
  55. package/dist-sdk/src/entities/automation/from-tf.d.ts +9 -2
  56. package/dist-sdk/src/entities/automation/from-tf.js +366 -86
  57. package/dist-sdk/src/entities/automation/index.d.ts +1 -1
  58. package/dist-sdk/src/entities/automation/index.js +1 -1
  59. package/dist-sdk/src/entities/automation/module.d.ts +3 -0
  60. package/dist-sdk/src/entities/automation/module.js +70 -7
  61. package/dist-sdk/src/entities/automation/script-code.d.ts +5 -2
  62. package/dist-sdk/src/entities/automation/script-code.js +23 -5
  63. package/dist-sdk/src/entities/automation/task-output-labels.d.ts +37 -0
  64. package/dist-sdk/src/entities/automation/task-output-labels.js +76 -0
  65. package/dist-sdk/src/entities/automation/tasks.d.ts +92 -20
  66. package/dist-sdk/src/entities/automation/tasks.js +48 -15
  67. package/dist-sdk/src/entities/automation/to-tf.d.ts +20 -3
  68. package/dist-sdk/src/entities/automation/to-tf.js +606 -62
  69. package/dist-sdk/src/entities/automation/triggers.d.ts +8 -4
  70. package/dist-sdk/src/entities/automation/types.d.ts +9 -0
  71. package/dist-sdk/src/entities/automation/types.js +19 -0
  72. package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +1 -1
  73. package/dist-sdk/src/entities/automation/value-ref-tf.js +1 -1
  74. package/dist-sdk/src/entities/chart/from-tf.js +9 -1
  75. package/dist-sdk/src/entities/data-lookup/module.js +2 -0
  76. package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +1 -0
  77. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +7 -5
  78. package/dist-sdk/src/entities/element/build.d.ts +3 -0
  79. package/dist-sdk/src/entities/element/build.js +1 -0
  80. package/dist-sdk/src/entities/element/from-tf.js +4 -0
  81. package/dist-sdk/src/entities/element/to-tf.d.ts +1 -1
  82. package/dist-sdk/src/entities/element/to-tf.js +8 -14
  83. package/dist-sdk/src/entities/field/build.d.ts +3 -2
  84. package/dist-sdk/src/entities/field/calc.d.ts +7 -7
  85. package/dist-sdk/src/entities/field/from-tf.d.ts +4 -4
  86. package/dist-sdk/src/entities/field/from-tf.js +205 -48
  87. package/dist-sdk/src/entities/field/module.js +1 -0
  88. package/dist-sdk/src/entities/field/options.js +6 -1
  89. package/dist-sdk/src/entities/field/to-tf.d.ts +4 -4
  90. package/dist-sdk/src/entities/field/to-tf.js +7 -1
  91. package/dist-sdk/src/entities/field/types.d.ts +2 -0
  92. package/dist-sdk/src/entities/field/types.js +27 -0
  93. package/dist-sdk/src/entities/role/from-tf.js +3 -3
  94. package/dist-sdk/src/entities/role/to-tf.d.ts +2 -0
  95. package/dist-sdk/src/entities/role/to-tf.js +12 -4
  96. package/dist-sdk/src/entities/service-account/from-tf.js +3 -3
  97. package/dist-sdk/src/entities/service-account/workspace-owner.d.ts +16 -0
  98. package/dist-sdk/src/entities/service-account/workspace-owner.js +22 -0
  99. package/dist-sdk/src/entities/shared/filters/ast.d.ts +15 -1
  100. package/dist-sdk/src/entities/shared/filters/ast.js +2 -0
  101. package/dist-sdk/src/entities/shared/filters/index.d.ts +5 -0
  102. package/dist-sdk/src/entities/shared/filters/index.js +5 -0
  103. package/dist-sdk/src/entities/shared/filters/print.js +7 -2
  104. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +5 -0
  105. package/dist-sdk/src/entities/shared/filters/tf-codec.js +42 -7
  106. package/dist-sdk/src/entities/shared/filters/types.d.ts +8 -3
  107. package/dist-sdk/src/entities/shared/ref.d.ts +5 -7
  108. package/dist-sdk/src/entities/shared/ref.js +5 -7
  109. package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +9 -0
  110. package/dist-sdk/src/entities/shared/tool-field-ref.js +35 -2
  111. package/dist-sdk/src/entities/shared/types/field-types.d.ts +10 -0
  112. package/dist-sdk/src/entities/shared/types/field-types.js +4 -0
  113. package/dist-sdk/src/entities/skill/access-policy.js +3 -3
  114. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +3 -0
  115. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +12 -5
  116. package/dist-sdk/src/entities/skill/from-tf.js +4 -2
  117. package/dist-sdk/src/entities/skill/module.js +2 -0
  118. package/dist-sdk/src/entities/skill-tool/from-tf.js +41 -8
  119. package/dist-sdk/src/entities/skill-tool/module.js +3 -0
  120. package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +0 -6
  121. package/dist-sdk/src/entities/skill-tool/to-tf.js +22 -9
  122. package/dist-sdk/src/entities/task/build.d.ts +8 -0
  123. package/dist-sdk/src/entities/task/build.js +10 -1
  124. package/dist-sdk/src/entities/task/from-tf.d.ts +4 -2
  125. package/dist-sdk/src/entities/task/from-tf.js +7 -2
  126. package/dist-sdk/src/entities/task/module.js +2 -2
  127. package/dist-sdk/src/entities/task/to-tf.d.ts +8 -4
  128. package/dist-sdk/src/entities/task/to-tf.js +28 -1
  129. package/dist-sdk/src/entities/view/from-tf.js +9 -1
  130. package/dist-sdk/src/entities/view/to-tf.d.ts +6 -7
  131. package/dist-sdk/src/entities/view/to-tf.js +19 -8
  132. package/dist-sdk/src/entities/visual-flow/build.d.ts +16 -1
  133. package/dist-sdk/src/entities/visual-flow/build.js +9 -0
  134. package/dist-sdk/src/entities/visual-flow/from-tf.d.ts +14 -0
  135. package/dist-sdk/src/entities/visual-flow/from-tf.js +51 -3
  136. package/dist-sdk/src/entities/visual-flow/index.d.ts +1 -1
  137. package/dist-sdk/src/entities/visual-flow/index.js +1 -1
  138. package/dist-sdk/src/entities/visual-flow/printer.js +19 -0
  139. package/dist-sdk/src/entities/visual-flow/to-tf.js +87 -3
  140. package/dist-sdk/src/entities/widget/from-tf.js +3 -3
  141. package/dist-sdk/src/entities/widget/to-tf.d.ts +2 -0
  142. package/dist-sdk/src/entities/widget/to-tf.js +7 -6
  143. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +133 -9
  144. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
  145. package/dist-sdk/src/graph/index.d.ts +1 -0
  146. package/dist-sdk/src/graph/types.d.ts +29 -3
  147. package/package.json +7 -3
@@ -0,0 +1,22 @@
1
+ import { workspaceAspectKey } from "../../engine/build/context.js";
2
+ import { expr } from "../../engine/tf/index.js";
3
+ import { APP_RESOURCE_TYPE } from "../app/module.js";
4
+ /**
5
+ * Resolve the workspace app that owns a `serviceAccountRef` named from a
6
+ * different object (another app or an element), so its lookup is scoped to the
7
+ * OWNING app (#1592), not the object that grants it access. A managed account
8
+ * becomes a direct resource ref, so same-apply creation is sequenced.
9
+ */
10
+ export function workspaceServiceAccountAppResolver(workspaceAspects) {
11
+ return (appRefName) => {
12
+ const app = workspaceAspects?.get(workspaceAspectKey("app", appRefName));
13
+ if (app === undefined)
14
+ return undefined;
15
+ const serviceAccounts = app.streamRootEntity?.payload?.serviceAccounts;
16
+ return {
17
+ appTfLabel: app.tfLabel,
18
+ appId: expr.resourceAttr(APP_RESOURCE_TYPE, app.tfLabel, ["id"]),
19
+ ...(serviceAccounts !== undefined ? { serviceAccounts } : {}),
20
+ };
21
+ };
22
+ }
@@ -42,6 +42,8 @@ export interface AppRefAst {
42
42
  readonly entityType?: "app" | "element" | "task";
43
43
  /** Provider lookup name for that foreign app/element. */
44
44
  readonly name?: string;
45
+ /** Set when the export looked the foreign root up by namespace; build then does too. */
46
+ readonly namespace?: string;
45
47
  }
46
48
  /** Reference to an app field: `<appHandle>.fields.<fieldKey>`. */
47
49
  export interface FieldRefAst {
@@ -102,6 +104,18 @@ export interface UserRefAst {
102
104
  readonly kind: "user";
103
105
  readonly email: string;
104
106
  }
107
+ /** Reference to an existing vault entry by key: `secret("<key>")`. */
108
+ export interface SecretRefAst {
109
+ readonly kind: "secret";
110
+ readonly key: string;
111
+ }
112
+ /** Organization group from the org catalog's `groups` bag (`org.groups.<key>`). */
113
+ export interface GroupRefAst {
114
+ readonly kind: "orgGroup";
115
+ readonly groupKey: string;
116
+ /** The group's display name — the lookup value. */
117
+ readonly name: string;
118
+ }
105
119
  /** Reference to a sub-automation via the app's `automations` bag. */
106
120
  export interface AutomationRefAst {
107
121
  readonly kind: "automation";
@@ -259,7 +273,7 @@ export type RefExpr =
259
273
  | {
260
274
  kind: "template";
261
275
  parts: readonly (string | RefExpr)[];
262
- } | FieldRefAst | UserFieldRefAst | UserGroupFieldRefAst | AppRefAst | AgentRefAst | AutomationRefAst | DocumentModelRefAst | DocumentModelFieldRefAst | ApprovalChainRefAst | DatamineRefAst | TableRefAst | TableColumnRefAst | SearchTableRefAst | ConnectorRefAst | CloudLinkRefAst | ProcedureRefAst | PhoneServiceRefAst | UserRefAst | UnresolvedRefAst
276
+ } | FieldRefAst | UserFieldRefAst | UserGroupFieldRefAst | AppRefAst | AgentRefAst | AutomationRefAst | DocumentModelRefAst | DocumentModelFieldRefAst | ApprovalChainRefAst | DatamineRefAst | TableRefAst | TableColumnRefAst | SearchTableRefAst | ConnectorRefAst | CloudLinkRefAst | ProcedureRefAst | PhoneServiceRefAst | UserRefAst | SecretRefAst | GroupRefAst | UnresolvedRefAst
263
277
  /** Preserved terraform local expression for round-trip (e.g. status option ids by label). */
264
278
  | {
265
279
  kind: "localRef";
@@ -69,5 +69,7 @@ export function isRefExpr(value) {
69
69
  kind === "procedure" ||
70
70
  kind === "phoneService" ||
71
71
  kind === "user" ||
72
+ kind === "secret" ||
73
+ kind === "orgGroup" ||
72
74
  kind === "unresolved");
73
75
  }
@@ -80,9 +80,14 @@ export declare function fieldValue(value: FilterField, options?: {
80
80
  * Compare against a field on the record being edited — a dynamic Dropdown
81
81
  * filter such as "source Process Area equals this record's Process Area".
82
82
  * `field` must belong to the Dropdown's own app or element.
83
+ *
84
+ * `includeOwner` stores the Dropdown's own app or element alongside the field,
85
+ * the form some existing filters were saved in. Pull keeps whichever form the
86
+ * platform holds, so adopting the filter changes nothing.
83
87
  */
84
88
  export declare function recordField(field: FilterField, options?: {
85
89
  readonly required?: boolean;
90
+ readonly includeOwner?: boolean;
86
91
  }): Extract<FilterValue<FilterField, FilterReferenceValue>, {
87
92
  type: "RECORD_FIELD";
88
93
  }>;
@@ -105,11 +105,16 @@ export function fieldValue(value, options) {
105
105
  * Compare against a field on the record being edited — a dynamic Dropdown
106
106
  * filter such as "source Process Area equals this record's Process Area".
107
107
  * `field` must belong to the Dropdown's own app or element.
108
+ *
109
+ * `includeOwner` stores the Dropdown's own app or element alongside the field,
110
+ * the form some existing filters were saved in. Pull keeps whichever form the
111
+ * platform holds, so adopting the filter changes nothing.
108
112
  */
109
113
  export function recordField(field, options) {
110
114
  return {
111
115
  type: "RECORD_FIELD",
112
116
  field: fieldWireValue(field),
117
+ ...(options?.includeOwner === true && { includeOwner: true }),
113
118
  ...(options?.required !== undefined && { required: options.required }),
114
119
  };
115
120
  }
@@ -161,8 +161,13 @@ function printFilterValue(value, codec, call, quote) {
161
161
  if (typeof value.field === "string")
162
162
  return `${JSON.stringify(value)} as const`;
163
163
  const { type: _type, field, required, ...rest } = value;
164
- if (Object.keys(rest).length === 0) {
165
- return call("recordField", `${codec.field(field)}${required !== undefined ? `, { required: ${required} }` : ""}`);
164
+ const { includeOwner, ...unhelped } = rest;
165
+ if (Object.keys(unhelped).length === 0) {
166
+ const options = [
167
+ ...(required !== undefined ? [`required: ${required}`] : []),
168
+ ...(includeOwner === true ? ["includeOwner: true"] : []),
169
+ ];
170
+ return call("recordField", `${codec.field(field)}${options.length > 0 ? `, { ${options.join(", ")} }` : ""}`);
166
171
  }
167
172
  const extras = Object.entries({ ...rest, ...(required !== undefined && { required }) })
168
173
  .map(([key, item]) => `${key}: ${JSON.stringify(item)}`);
@@ -98,6 +98,8 @@ export interface FilterToTfCodec {
98
98
  readonly literal?: (value: TfValue, field: unknown | undefined, valueType: string, isOptionLabel: boolean) => TfValue;
99
99
  /** A RECORD_FIELD value's source-record field; without it only raw platform ids encode. */
100
100
  readonly recordField?: (value: unknown) => TfValue;
101
+ /** The owning app or element an `includeOwner` RECORD_FIELD value stores; without it such a value cannot encode. */
102
+ readonly recordFieldOwner?: () => TfValue;
101
103
  readonly fieldFromLeftValue?: (value: unknown) => unknown | undefined;
102
104
  /**
103
105
  * Override the REFERENCE `real_type` that would otherwise default to TEXT.
@@ -124,6 +126,8 @@ export interface FilterFromTfCodec<Field = string, ReferenceValue = never> {
124
126
  readonly literal?: (value: TfValue, valueType: string) => TfValue;
125
127
  /** Decode a RECORD_FIELD value's source-record field reference; without it only raw platform ids decode. */
126
128
  readonly recordField?: (value: TfValue) => Field;
129
+ /** Whether a RECORD_FIELD `object` reference names the owning app or element; without it only raw platform ids decode. */
130
+ readonly recordFieldOwner?: (value: TfValue) => boolean;
127
131
  /**
128
132
  * A TEXT-wrapped literal `literal` resolved from an option-id lookup is an
129
133
  * option LABEL, not a stored word. Set this when the owner cannot rebuild a
@@ -147,6 +151,7 @@ export type WireFilterValue = Readonly<{
147
151
  dynamicFieldAspect?: TfValue;
148
152
  sourceFieldType?: string;
149
153
  required?: boolean;
154
+ includeOwner?: boolean;
150
155
  }>;
151
156
  type WireFilterBase = Readonly<{
152
157
  field?: TfValue;
@@ -207,15 +207,21 @@ function wireFilterValueToTf(value, field, codec, role = "value", operator) {
207
207
  const authoredType = typeof authored === "string" ? authored : undefined;
208
208
  // `filter.text()` and the other typed wrappers set `explicit`. That type
209
209
  // is the comparison the author wrote. Metadata inference replaces only an
210
- // unmarked operator fallback (dropdown `.id` TEXT → UUID).
210
+ // unmarked operator fallback (dropdown `.id` TEXT → UUID). An operator
211
+ // fallback of TEXT, and a trigger-field inference that agrees with the
212
+ // authored type, stay off the reference callback so a runAutomation left
213
+ // ref is not enveloped.
211
214
  const explicit = raw.explicit === true;
212
215
  const inferred = explicit ? authoredType : codec.referenceRealType?.(reference, role, authoredType);
213
216
  const realType = String(inferred ?? authoredType ?? "TEXT");
217
+ const inferenceDisagrees = inferred !== undefined
218
+ && inferred.toUpperCase() !== (authoredType ?? "").toUpperCase();
219
+ const referenceRealType = explicit ? realType : inferenceDisagrees ? inferred : undefined;
214
220
  // ei export always writes an explicit `multiple = false` on scalar text
215
221
  // references. Omitting it plans null-vs-false drift after pull.
216
222
  return {
217
223
  type,
218
- value_reference: codec.reference(reference, role, realType, operator),
224
+ value_reference: codec.reference(reference, role, referenceRealType, operator),
219
225
  real_type: realType.toLowerCase(),
220
226
  multiple: typeof raw.multiple === "boolean" ? raw.multiple : false,
221
227
  };
@@ -237,7 +243,14 @@ function wireFilterValueToTf(value, field, codec, role = "value", operator) {
237
243
  if (type === "record_field") {
238
244
  if (raw.field === undefined)
239
245
  throw new EntityTfError("record_field filter value requires field");
240
- const aspect = raw.aspect ?? raw.object;
246
+ let object = (raw.aspect ?? raw.object);
247
+ if (raw.includeOwner === true) {
248
+ if (object !== undefined)
249
+ throw new EntityTfError("record_field filter value cannot set includeOwner and also name a raw app id");
250
+ if (codec.recordFieldOwner === undefined)
251
+ throw new EntityTfError("a record_field filter value with includeOwner needs an owning app or element in this filter context");
252
+ object = codec.recordFieldOwner();
253
+ }
241
254
  const sourceFieldType = raw.sourceFieldType ?? raw.source_field_type;
242
255
  let field;
243
256
  if (codec.recordField !== undefined)
@@ -249,7 +262,7 @@ function wireFilterValueToTf(value, field, codec, role = "value", operator) {
249
262
  return {
250
263
  type,
251
264
  field,
252
- ...(aspect !== undefined && { object: aspect }),
265
+ ...(object !== undefined && { object }),
253
266
  ...(sourceFieldType !== undefined && { source_field_type: String(sourceFieldType).toLowerCase() }),
254
267
  ...((raw.dynamicField ?? raw.dynamic_field) !== undefined && { dynamic_field: (raw.dynamicField ?? raw.dynamic_field) }),
255
268
  ...((raw.dynamicFieldAspect ?? raw.dynamic_field_object) !== undefined && { dynamic_field_object: (raw.dynamicFieldAspect ?? raw.dynamic_field_object) }),
@@ -578,8 +591,30 @@ function filterValueFromTf(value, codec, fieldScope) {
578
591
  case "record_field": {
579
592
  if (value.field === undefined)
580
593
  throw new EntityTfError("record_field filter value requires field");
581
- if ((value.object !== undefined && typeof value.object !== "string") || (value.source_field_type !== undefined && typeof value.source_field_type !== "string")) {
582
- throw new EntityTfError("record_field filter value object and source_field_type must be literal strings");
594
+ if (value.source_field_type !== undefined && typeof value.source_field_type !== "string") {
595
+ throw new EntityTfError("record_field filter value source_field_type must be a literal string");
596
+ }
597
+ // The exporter resolves the platform's dynamicField / dynamicFieldAspect
598
+ // to references (e.g. `data.elementum_app.parent.id`). No typed public
599
+ // value rebuilds them yet, so refuse rather than keep the rest of the
600
+ // value and let a rebuild silently omit them. RECORD_FIELD values only
601
+ // occur in dynamic Dropdown filters.
602
+ for (const key of ["dynamic_field", "dynamic_field_object"]) {
603
+ if (value[key] !== undefined && typeof value[key] !== "string") {
604
+ throw new EntityTfError(`record_field filter value ${key} reference cannot be reconstructed: the EDK cannot yet represent a dynamic-field comparison in a Dropdown filter`);
605
+ }
606
+ }
607
+ // A literal id stays as stored; a reference must name the owning app or
608
+ // element, which the owner context rebuilds, so only the fact survives.
609
+ let owner;
610
+ if (typeof value.object === "string")
611
+ owner = { aspect: value.object };
612
+ else if (value.object !== undefined) {
613
+ if (codec.recordFieldOwner === undefined)
614
+ throw new EntityTfError("record_field filter value object reference cannot be reconstructed in this filter context");
615
+ if (!codec.recordFieldOwner(value.object))
616
+ throw new EntityTfError("record_field filter value object must name the owning app or element");
617
+ owner = { includeOwner: true };
583
618
  }
584
619
  let field;
585
620
  if (typeof value.field === "string")
@@ -591,7 +626,7 @@ function filterValueFromTf(value, codec, fieldScope) {
591
626
  return {
592
627
  type: "RECORD_FIELD",
593
628
  field,
594
- ...(value.object !== undefined && { aspect: value.object }),
629
+ ...owner,
595
630
  ...(value.source_field_type !== undefined && { sourceFieldType: value.source_field_type.toUpperCase() }),
596
631
  ...(typeof value.dynamic_field === "string" && { dynamicField: value.dynamic_field }),
597
632
  ...(typeof value.dynamic_field_object === "string" && { dynamicFieldAspect: value.dynamic_field_object }),
@@ -69,15 +69,20 @@ export type FilterValue<FieldValue = string, ReferenceValue = FilterReference> =
69
69
  } | {
70
70
  type: "CURRENT_USER";
71
71
  valueType?: "ID" | "EMAIL" | "DOMAIN";
72
- } | {
72
+ } | ({
73
73
  type: "RECORD_FIELD";
74
74
  field: FieldValue | string;
75
- aspect?: string;
76
75
  sourceFieldType?: string;
77
76
  dynamicField?: string;
78
77
  dynamicFieldAspect?: string;
79
78
  required?: boolean;
80
- }
79
+ } & ({
80
+ aspect?: string;
81
+ includeOwner?: never;
82
+ } | {
83
+ includeOwner: true;
84
+ aspect?: never;
85
+ }))
81
86
  /**
82
87
  * `explicit` is set by `filter.text()` / `filter.uuid()` / the other typed
83
88
  * wrappers, and by an explicit comparison type. Build keeps that type.
@@ -118,16 +118,14 @@ export type ValidateTemplateArgs<Args extends readonly unknown[]> = Args extends
118
118
  */
119
119
  export declare function template<const Args extends readonly (string | Ref<unknown>)[]>(...parts: Args & ValidateTemplateArgs<Args>): Ref<string>;
120
120
  /**
121
- * Reference a named secret by id. The resolver at execution time fetches
122
- * the plaintext from the Elementum secret vault. EDK never sees the
123
- * plaintext.
121
+ * Reference an existing Elementum vault entry by key. The platform resolves
122
+ * its value only when the automation runs; EDK never reads or stores it.
124
123
  *
125
124
  * @example
126
125
  * ```ts
127
- * apiRequest({
128
- * url: "https://api.example.com",
129
- * method: "GET",
130
- * authorization: { type: "bearer", token: secret("payments-provider-token") },
126
+ * .executeScript("Call API", {
127
+ * inputs: { baseUrl: secret("ELEMENTUM_BASE_URL") },
128
+ * code: (input) => ({ url: input.parameters.baseUrl }),
131
129
  * })
132
130
  * ```
133
131
  */
@@ -50,16 +50,14 @@ export function template(...parts) {
50
50
  return createRef({ kind: "template", parts: data });
51
51
  }
52
52
  /**
53
- * Reference a named secret by id. The resolver at execution time fetches
54
- * the plaintext from the Elementum secret vault. EDK never sees the
55
- * plaintext.
53
+ * Reference an existing Elementum vault entry by key. The platform resolves
54
+ * its value only when the automation runs; EDK never reads or stores it.
56
55
  *
57
56
  * @example
58
57
  * ```ts
59
- * apiRequest({
60
- * url: "https://api.example.com",
61
- * method: "GET",
62
- * authorization: { type: "bearer", token: secret("payments-provider-token") },
58
+ * .executeScript("Call API", {
59
+ * inputs: { baseUrl: secret("ELEMENTUM_BASE_URL") },
60
+ * code: (input) => ({ url: input.parameters.baseUrl }),
63
61
  * })
64
62
  * ```
65
63
  */
@@ -17,3 +17,12 @@
17
17
  import type { FromTfContext } from "../../engine/pull/context.js";
18
18
  import { type ChildResourceScope, type TfValue } from "../../engine/tf/index.js";
19
19
  export declare function resolveToolFieldKey(fieldRef: TfValue | undefined, scopeTfLabel: string, scope?: ChildResourceScope | "task", ctx?: Pick<FromTfContext, "dataAttrs" | "foreignFieldRefsByDataAddress">): string | undefined;
20
+ /**
21
+ * When `fieldRef` is a field resource whose scoped label names a different
22
+ * owner than the tool's resolved target, return that owner as
23
+ * `<scope> "<label>"` for diagnostics. Unscoped labels can't be attributed
24
+ * and return undefined.
25
+ */
26
+ export declare function toolFieldRefOtherOwner(fieldRef: TfValue | undefined, scopeTfLabel: string, scope?: ChildResourceScope | "task"): string | undefined;
27
+ /** Diagnostic for a tool fields item whose field_id could not be kept. */
28
+ export declare function droppedToolFieldDiagnostic(where: string, fieldRef: TfValue | undefined, scopeTfLabel: string, scope?: ChildResourceScope | "task"): string;
@@ -1,10 +1,14 @@
1
- import { isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
1
+ import { isTfExpr, ownerFromScopedChildLabel, scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
2
2
  import { SUB_TYPE_BY_RESOURCE as FIELD_SUB_TYPE_BY_RESOURCE } from "../field/types.js";
3
3
  export function resolveToolFieldKey(fieldRef, scopeTfLabel, scope = "app", ctx) {
4
4
  if (fieldRef === undefined)
5
5
  return undefined;
6
6
  if (isTfExpr(fieldRef) && fieldRef.$expr === "resource-attr" && FIELD_SUB_TYPE_BY_RESOURCE.has(fieldRef.type)) {
7
- return scopedLabelToBagKey(scopeTfLabel, fieldRef.label, scope === "task" ? "app" : scope);
7
+ // A field resource owned by a different app/element must not be renamed
8
+ // into a key on this tool's target (edk#1403 review S1).
9
+ if (toolFieldRefOtherOwner(fieldRef, scopeTfLabel, scope) !== undefined)
10
+ return undefined;
11
+ return scopedLabelToBagKey(scopeTfLabel, fieldRef.label, scope);
8
12
  }
9
13
  if (isTfExpr(fieldRef) && fieldRef.$expr === "data-attr" && fieldRef.type === "elementum_field") {
10
14
  const fieldAttrs = ctx?.dataAttrs?.("elementum_field", fieldRef.label);
@@ -40,3 +44,32 @@ export function resolveToolFieldKey(fieldRef, scopeTfLabel, scope = "app", ctx)
40
44
  }
41
45
  return undefined;
42
46
  }
47
+ /**
48
+ * When `fieldRef` is a field resource whose scoped label names a different
49
+ * owner than the tool's resolved target, return that owner as
50
+ * `<scope> "<label>"` for diagnostics. Unscoped labels can't be attributed
51
+ * and return undefined.
52
+ */
53
+ export function toolFieldRefOtherOwner(fieldRef, scopeTfLabel, scope = "app") {
54
+ if (fieldRef === undefined || !isTfExpr(fieldRef) || fieldRef.$expr !== "resource-attr")
55
+ return undefined;
56
+ if (!FIELD_SUB_TYPE_BY_RESOURCE.has(fieldRef.type))
57
+ return undefined;
58
+ const owner = ownerFromScopedChildLabel(fieldRef.label);
59
+ if (owner === undefined)
60
+ return undefined;
61
+ if (owner.scope === scope && owner.ownerTfLabel === scopeTfLabel)
62
+ return undefined;
63
+ return `${owner.scope} "${owner.ownerTfLabel}"`;
64
+ }
65
+ /** Diagnostic for a tool fields item whose field_id could not be kept. */
66
+ export function droppedToolFieldDiagnostic(where, fieldRef, scopeTfLabel, scope = "app") {
67
+ if (fieldRef === undefined || fieldRef === "")
68
+ return `${where}: fields item has no field_id; dropped`;
69
+ const other = toolFieldRefOtherOwner(fieldRef, scopeTfLabel, scope);
70
+ if (other !== undefined && isTfExpr(fieldRef) && fieldRef.$expr === "resource-attr") {
71
+ return `${where}: fields item's field_id references ${fieldRef.type}.${fieldRef.label}, a field of ${other}, ` +
72
+ `not of this tool's target "${scopeTfLabel}"; dropped - set this field on the tool by hand`;
73
+ }
74
+ return `${where}: fields item's field_id is not a field resource reference; dropped`;
75
+ }
@@ -56,6 +56,16 @@ export declare function isOnDemandRecordType(type: string | undefined): boolean;
56
56
  * clicking user with `runAutomationParameterValue.triggeredByUser`.
57
57
  */
58
58
  export type TriggerFieldTypeAlias = Exclude<FieldTypeAlias, "user">;
59
+ /**
60
+ * Subset of {@link TriggerFieldTypeAlias} that an `onDemand` input may
61
+ * declare. Mirrors the provider's `elementum_on_demand_trigger`
62
+ * `parameters[].type` enum (text, number, decimal, boolean, date, datetime,
63
+ * user, group, attachment, record): `json` and `object` have no provider
64
+ * spelling, so OpenTofu rejects the generated config at plan time (#1415).
65
+ */
66
+ export type OnDemandParamTypeAlias = Exclude<TriggerFieldTypeAlias, "json" | "object">;
67
+ /** Runtime list of {@link OnDemandParamTypeAlias} values. */
68
+ export declare const ON_DEMAND_PARAM_TYPES: readonly ["text", "number", "decimal", "boolean", "date", "datetime", "userId", "attachmentId", "record"];
59
69
  /**
60
70
  * Maps a user-friendly FieldTypeAlias to the TypeScript type it represents.
61
71
  * Used to derive the phantom T in Ref<T> for trigger inputs.
@@ -32,6 +32,10 @@ export const FIELD_TYPE_MAP = {
32
32
  export function isOnDemandRecordType(type) {
33
33
  return type === "record" || type === "ASPECT_RECORD";
34
34
  }
35
+ /** Runtime list of {@link OnDemandParamTypeAlias} values. */
36
+ export const ON_DEMAND_PARAM_TYPES = [
37
+ "text", "number", "decimal", "boolean", "date", "datetime", "userId", "attachmentId", "record",
38
+ ];
35
39
  /**
36
40
  * Maps a user-friendly FieldTypeAlias to the TypeScript type it represents.
37
41
  * Used to derive the phantom T in Ref<T> for trigger inputs.
@@ -1,6 +1,6 @@
1
1
  import { EntityTfError } from "../../engine/entity.js";
2
- import { dataRefLabel } from "../../engine/pull/context.js";
3
- import { expr, sanitizeName, tfLabelToTsLabel } from "../../engine/tf/index.js";
2
+ import { dataRefLabel, groupCatalogKey } from "../../engine/pull/context.js";
3
+ import { expr, sanitizeName } from "../../engine/tf/index.js";
4
4
  function object(value) {
5
5
  return value !== null && typeof value === "object" && !Array.isArray(value);
6
6
  }
@@ -90,7 +90,7 @@ export function skillAccessPolicyFromTf(attrs, ctx) {
90
90
  if (output === "users")
91
91
  users.push({ __kind: "user", email: identity });
92
92
  else
93
- groups.push({ __kind: "group", refName: tfLabelToTsLabel(label), name: identity });
93
+ groups.push({ __kind: "group", refName: groupCatalogKey(ctx, label, identity), name: identity });
94
94
  }
95
95
  if (output === "users")
96
96
  policy.users = users;
@@ -44,6 +44,9 @@ export interface PrintSkillV2Options {
44
44
  * `catalog.<refName>` instead of the literal stub.
45
45
  */
46
46
  readonly foreignTaskRefNames?: ReadonlyMap<string, string>;
47
+ /** Terraform label → authored catalog ref. Field identities stay on the label. */
48
+ readonly foreignAppRefNamespaces?: ReadonlyMap<string, string>;
49
+ readonly foreignElementRefNamespaces?: ReadonlyMap<string, string>;
47
50
  /** Raw foreign field id → typed catalog field identity, supplied by recursive pull. */
48
51
  readonly foreignFieldRefsById?: ReadonlyMap<string, {
49
52
  readonly ownerRefName: string;
@@ -13,6 +13,7 @@
13
13
  * Unresolved field and automation platform ids print as `unsafePlatformId(...)`.
14
14
  */
15
15
  import { quote } from "../../../../pull/util.js";
16
+ import { catalogRefForFieldOwner } from "../../../engine/pull/catalog-ref.js";
16
17
  import { sanitizeName, tfLabelToTsLabel } from "../../../engine/tf/index.js";
17
18
  import { sdkPackageSpecifier } from "../../../internal/sdk-package.js";
18
19
  import { safeIdentifier } from "../../../internal/safe-identifier.js";
@@ -139,7 +140,7 @@ export function printSkillV2(skill, opts) {
139
140
  if (skill.tools.length > 0) {
140
141
  lines.push(" tools: [");
141
142
  for (const tool of skill.tools) {
142
- lines.push(...printTool(tool, appRefName, crossOrg, opts.foreignAppRefNames, opts.foreignElementRefNames, opts.foreignTaskRefNames, opts.foreignFieldRefsById, opts.foreignSearchTableRefsByName).map((l) => ` ${l}`));
143
+ lines.push(...printTool(tool, appRefName, crossOrg, opts.foreignAppRefNames, opts.foreignElementRefNames, opts.foreignTaskRefNames, opts.foreignFieldRefsById, opts.foreignSearchTableRefsByName, opts.foreignAppRefNamespaces, opts.foreignElementRefNamespaces).map((l) => ` ${l}`));
143
144
  }
144
145
  lines.push(" ],");
145
146
  }
@@ -191,7 +192,7 @@ function fieldOwnerRef(tool, appRefName, foreignAppRefNames, foreignElementRefNa
191
192
  }
192
193
  : { kind: "raw", entityType: entityKind, name: tool.target.name, refName: tool.target.name };
193
194
  }
194
- function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElementRefNames, foreignTaskRefNames, foreignFieldRefsById, foreignSearchTableRefsByName) {
195
+ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElementRefNames, foreignTaskRefNames, foreignFieldRefsById, foreignSearchTableRefsByName, foreignAppRefNamespaces, foreignElementRefNamespaces) {
195
196
  const factory = TOOL_FACTORY_BY_TYPE_KEY[tool.typeKey] ?? "skillSearchRecords";
196
197
  const lines = [`${factory}({`];
197
198
  const targetRefName = tool.target?.kind === "self"
@@ -286,7 +287,12 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
286
287
  : tool.target.kind === "foreignTask"
287
288
  ? foreignTaskRefNames
288
289
  : foreignAppRefNames;
289
- const catalogRefName = refNames?.get(tool.target.name);
290
+ // Display-name map first: the terraform label and the authored catalog key
291
+ // differ (#1427). Extract-time refName is the state/namespace join for
292
+ // apps and elements. Task refNames are terraform labels, so they stay on
293
+ // the inline stub unless the map names a workspace catalog key (#1452).
294
+ const mapped = refNames?.get(tool.target.name);
295
+ const catalogRefName = mapped ?? (tool.target.kind === "foreignTask" ? undefined : tool.target.refName);
290
296
  if (catalogRefName !== undefined) {
291
297
  lines.push(` ${entityKind}: catalog.${catalogRefName},`);
292
298
  }
@@ -345,7 +351,8 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
345
351
  lines.push(` table: tableSearchTableRef({ name: ${quote(tool.searchTableName ?? "")}, parent: ${quote(owner)}${ownerName !== undefined ? `, parentName: ${quote(ownerName)}` : ""}${pinnedId} }),`);
346
352
  }
347
353
  else if (typedTable !== undefined) {
348
- lines.push(` table: catalog.${typedTable.ownerRefName}.searchTables${safeMember(typedTable.tableKey)},`);
354
+ const tableOwner = catalogRefForFieldOwner(typedTable.ownerRefName, foreignAppRefNamespaces, foreignElementRefNamespaces);
355
+ lines.push(` table: catalog.${tableOwner}.searchTables${safeMember(typedTable.tableKey)},`);
349
356
  }
350
357
  else {
351
358
  lines.push(` table: { __kind: "searchTable", refName: ${quote(tool.searchTableName ?? "")}, name: ${quote(tool.searchTableName ?? "")}, parent: ${quote(parent)} },`);
@@ -381,7 +388,7 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
381
388
  const parts = isRaw
382
389
  ? [`fieldId: unsafePlatformId(${quote(f.rawFieldId ?? "")})`]
383
390
  : resolvedRaw !== undefined
384
- ? [`field: catalog.${resolvedRaw.ownerRefName}.fields.${resolvedRaw.fieldKey}`]
391
+ ? [`field: catalog.${catalogRefForFieldOwner(resolvedRaw.ownerRefName, foreignAppRefNamespaces, foreignElementRefNamespaces)}.fields.${resolvedRaw.fieldKey}`]
385
392
  : owner.kind === "catalog"
386
393
  ? [`field: ${owner.expr}.fields.${f.key}`]
387
394
  : owner.kind === "table"
@@ -6,7 +6,7 @@
6
6
  * source. Mirrors `entities/agent/from-tf.ts`.
7
7
  */
8
8
  import { EntityTfError } from "../../engine/entity.js";
9
- import { optionalString, resourceRefLabel } from "../../engine/pull/context.js";
9
+ import { optionalString, ownerMismatchBlocker, reportAuthoringBlocker, resourceRefLabel } from "../../engine/pull/context.js";
10
10
  import { isTfExpr, scopedLabelToBagKey } from "../../engine/tf/index.js";
11
11
  import { skillToolFromTf } from "../skill-tool/from-tf.js";
12
12
  import { APP_RESOURCE_TYPE } from "../app/module.js";
@@ -128,7 +128,9 @@ export function skillFromTf(skillBlock, toolBlocks, appLabel, ctx) {
128
128
  return { skippedReason: `${where}: owner_type ${JSON.stringify(ownerType)} has no terraform-path authoring yet; skipped` };
129
129
  }
130
130
  if (resourceRefLabel(attrs["owner_id"], APP_RESOURCE_TYPE) !== appLabel) {
131
- return { skippedReason: `${where}: owner_id does not reference ${APP_RESOURCE_TYPE}.${appLabel}; skipped` };
131
+ const reason = `${where}: owner_id does not reference ${APP_RESOURCE_TYPE}.${appLabel}`;
132
+ reportAuthoringBlocker(ctx, ownerMismatchBlocker(`${SKILL_RESOURCE_TYPE}.${label}`, reason, "skill"));
133
+ return { skippedReason: `${reason}; skipped` };
132
134
  }
133
135
  const properties = propertiesFromTf(attrs["properties"], where, ctx);
134
136
  const status = optionalString(attrs, "status", where, ctx);
@@ -90,6 +90,8 @@ export const skillModule = {
90
90
  ...(opts.foreignAppRefNames !== undefined && { foreignAppRefNames: opts.foreignAppRefNames }),
91
91
  ...(opts.foreignElementRefNames !== undefined && { foreignElementRefNames: opts.foreignElementRefNames }),
92
92
  ...(opts.foreignTaskRefNames !== undefined && { foreignTaskRefNames: opts.foreignTaskRefNames }),
93
+ ...(opts.foreignAppRefNamespaces !== undefined && { foreignAppRefNamespaces: opts.foreignAppRefNamespaces }),
94
+ ...(opts.foreignElementRefNamespaces !== undefined && { foreignElementRefNamespaces: opts.foreignElementRefNamespaces }),
93
95
  ...(opts.foreignFieldRefsById !== undefined && { foreignFieldRefsById: opts.foreignFieldRefsById }),
94
96
  ...(opts.foreignTableRefsById !== undefined && { foreignTableRefsById: opts.foreignTableRefsById }),
95
97
  ...(opts.foreignSearchTableRefsByName !== undefined && {
@@ -6,10 +6,22 @@
6
6
  */
7
7
  import { EntityTfError } from "../../engine/entity.js";
8
8
  import { dataRefLabel, optionalString, resourceRefLabel } from "../../engine/pull/context.js";
9
- import { isTfExpr, sanitizeName, scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
9
+ import { isTfExpr, isUuid, sanitizeName, scopedLabelToBagKey, tfLabelToTsLabel, tsLabelToTfLabel } from "../../engine/tf/index.js";
10
10
  import { dataAspectDisplayName, dataAspectRefName, resolveDataAspectTarget } from "../shared/aspect-target-from-tf.js";
11
- import { resolveToolFieldKey } from "../shared/tool-field-ref.js";
11
+ import { droppedToolFieldDiagnostic, resolveToolFieldKey } from "../shared/tool-field-ref.js";
12
12
  import { KNOWN_SKILL_TOOL_ATTRS, SKILL_TOOL_SUB_TYPE_BY_RESOURCE, UNAUTHORABLE_SKILL_TOOL_ATTRS, } from "./types.js";
13
+ /** Namespace-map key for a catalog ref, skipping UUID index entries. */
14
+ function stateScopeLabel(catalogRef, namespaces) {
15
+ if (namespaces !== undefined) {
16
+ for (const [key, value] of namespaces) {
17
+ if (value !== catalogRef || isUuid(key))
18
+ continue;
19
+ return key;
20
+ }
21
+ }
22
+ // UUID-only index: the stored ref is tfLabelToTsLabel(resource.name).
23
+ return tsLabelToTfLabel(catalogRef);
24
+ }
13
25
  /**
14
26
  * One tool block → its normalized shape; undefined = skipped with a
15
27
  * diagnostic (unimplemented sub-type, wrong owner, unresolvable target).
@@ -355,11 +367,32 @@ export function skillToolFromTf(block, owner, ctx) {
355
367
  fieldScope = "task";
356
368
  }
357
369
  else if (typeof targetAttr === "string") {
358
- // No portable reference was available at export time (ei fell back to
359
- // the raw platform UUID) — keep the tool with an unresolved target
360
- // instead of dropping it entirely (board issue #648).
361
- ctx.diagnostics.push(`${where}: target_id could not be resolved to a portable reference ("${targetAttr}"); kept as unresolved`);
362
- target = { kind: "unresolved", uuid: targetAttr };
370
+ // Same state join as automations (#1427 / #1452): when the element/app is
371
+ // already in OpenTofu state, the UUID is indexed on the namespace map.
372
+ const elementRefName = ctx.foreignElementRefNamespaces?.get(targetAttr);
373
+ if (elementRefName !== undefined) {
374
+ const displayName = [...(ctx.foreignElementRefNames?.entries() ?? [])]
375
+ .find(([, refName]) => refName === elementRefName)?.[0] ?? elementRefName;
376
+ target = { kind: "foreignElement", name: displayName, refName: elementRefName };
377
+ fieldScopeLabel = stateScopeLabel(elementRefName, ctx.foreignElementRefNamespaces);
378
+ fieldScope = "element";
379
+ }
380
+ else {
381
+ const appRefName = ctx.foreignAppRefNamespaces?.get(targetAttr);
382
+ if (appRefName !== undefined) {
383
+ const displayName = [...(ctx.foreignAppRefNames?.entries() ?? [])]
384
+ .find(([, refName]) => refName === appRefName)?.[0] ?? appRefName;
385
+ target = { kind: "foreignApp", name: displayName, refName: appRefName };
386
+ fieldScopeLabel = stateScopeLabel(appRefName, ctx.foreignAppRefNamespaces);
387
+ }
388
+ else {
389
+ // No portable reference was available at export time (ei fell back to
390
+ // the raw platform UUID) — keep the tool with an unresolved target
391
+ // instead of dropping it entirely (board issue #648).
392
+ ctx.diagnostics.push(`${where}: target_id could not be resolved to a portable reference ("${targetAttr}"); kept as unresolved`);
393
+ target = { kind: "unresolved", uuid: targetAttr };
394
+ }
395
+ }
363
396
  }
364
397
  else {
365
398
  ctx.diagnostics.push(`${where}: target_id has an unrecognized shape (${JSON.stringify(targetAttr)}); skipped`);
@@ -382,7 +415,7 @@ export function skillToolFromTf(block, owner, ctx) {
382
415
  // than silently dropping the field.
383
416
  const rawFieldId = fieldKey === undefined && typeof rec["field_id"] === "string" && rec["field_id"] !== "" ? rec["field_id"] : undefined;
384
417
  if (fieldKey === undefined && rawFieldId === undefined) {
385
- ctx.diagnostics.push(`${where}: fields item's field_id is not a field resource reference; dropped`);
418
+ ctx.diagnostics.push(droppedToolFieldDiagnostic(where, rec["field_id"], fieldScopeLabel, fieldScope));
386
419
  continue;
387
420
  }
388
421
  fields.push({
@@ -26,5 +26,8 @@ export const skillToolModule = {
26
26
  nestedAttribute: "field_id",
27
27
  dataType: FIELD_DATA_RESOURCE_TYPE,
28
28
  }],
29
+ // The provider reads an omitted `required` as false (edk#1429): the
30
+ // export leaves it out, the build may spell it out.
31
+ nestedOmittedDefaults: [{ attribute: "fields", defaults: { required: false } }],
29
32
  },
30
33
  };
@@ -54,10 +54,4 @@ export interface SkillToolToTfResult {
54
54
  /** `<resourceType>.<tfLabel>` — bookkeeping for the skill catalog. */
55
55
  readonly address: string;
56
56
  }
57
- /**
58
- * One authored tool entry (`{ createRecord: {...} }`) → its resource block;
59
- * undefined = degraded with a diagnostic (unimplemented sub-type, missing
60
- * target). Tool-name validity is enforced in the authoring builders
61
- * (entities/skill/tools.ts), not here.
62
- */
63
57
  export declare function skillToolToTf(entry: Record<string, unknown>, ctx: SkillToolToTfContext): SkillToolToTfResult | undefined;