@elementumai/edk 0.8.0-preview.11 → 0.8.2-alpha.5
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.
- package/README.md +510 -324
- package/dist-sdk/src/catalog/ai-provider-models.d.ts +30 -0
- package/dist-sdk/src/catalog/ai-provider-models.js +63 -0
- package/dist-sdk/src/catalog/factories.d.ts +56 -3
- package/dist-sdk/src/catalog/factories.js +83 -4
- package/dist-sdk/src/catalog/from-authoring.js +19 -2
- package/dist-sdk/src/catalog/index.d.ts +3 -2
- package/dist-sdk/src/catalog/index.js +3 -2
- package/dist-sdk/src/catalog/org.d.ts +1 -1
- package/dist-sdk/src/catalog/org.js +134 -50
- package/dist-sdk/src/catalog/render.d.ts +13 -1
- package/dist-sdk/src/catalog/render.js +21 -4
- package/dist-sdk/src/catalog/token.js +18 -0
- package/dist-sdk/src/catalog/types.d.ts +75 -3
- package/dist-sdk/src/catalog/types.js +3 -0
- package/dist-sdk/src/core/system-fields.d.ts +2 -0
- package/dist-sdk/src/core/system-fields.js +2 -0
- package/dist-sdk/src/core/types/ai-provider.d.ts +10 -23
- package/dist-sdk/src/core/types/ai-provider.js +1 -25
- package/dist-sdk/src/core/types/app.d.ts +26 -1
- package/dist-sdk/src/engine/build/context.d.ts +58 -0
- package/dist-sdk/src/engine/build/context.js +11 -1
- package/dist-sdk/src/engine/build/source-context.d.ts +45 -0
- package/dist-sdk/src/engine/build/source-context.js +23 -0
- package/dist-sdk/src/engine/pull/context.d.ts +15 -0
- package/dist-sdk/src/engine/pull/org.d.ts +10 -0
- package/dist-sdk/src/engine/pull/org.js +34 -4
- package/dist-sdk/src/engine/tf/index.d.ts +2 -2
- package/dist-sdk/src/engine/tf/index.js +2 -2
- package/dist-sdk/src/engine/tf/labels.d.ts +54 -0
- package/dist-sdk/src/engine/tf/labels.js +75 -0
- package/dist-sdk/src/engine/tf/parse.d.ts +15 -0
- package/dist-sdk/src/engine/tf/parse.js +162 -0
- package/dist-sdk/src/entities/access-policy/build.d.ts +26 -0
- package/dist-sdk/src/entities/access-policy/build.js +7 -0
- package/dist-sdk/src/entities/access-policy/filter.d.ts +61 -0
- package/dist-sdk/src/entities/access-policy/filter.js +83 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +66 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +187 -0
- package/dist-sdk/src/entities/access-policy/module.d.ts +3 -0
- package/dist-sdk/src/entities/access-policy/module.js +17 -0
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +43 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +164 -0
- package/dist-sdk/src/entities/access-policy/types.d.ts +4 -0
- package/dist-sdk/src/entities/access-policy/types.js +10 -0
- package/dist-sdk/src/entities/agent/build.d.ts +2 -0
- package/dist-sdk/src/entities/agent/build.js +1 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +38 -3
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +257 -32
- package/dist-sdk/src/entities/agent/from-tf.d.ts +29 -9
- package/dist-sdk/src/entities/agent/from-tf.js +146 -19
- package/dist-sdk/src/entities/agent/index.d.ts +1 -1
- package/dist-sdk/src/entities/agent/module.js +14 -4
- package/dist-sdk/src/entities/agent/to-tf.d.ts +46 -1
- package/dist-sdk/src/entities/agent/to-tf.js +160 -14
- package/dist-sdk/src/entities/agent/tools.d.ts +88 -9
- package/dist-sdk/src/entities/agent/tools.js +46 -7
- package/dist-sdk/src/entities/agent-a2a-skill/from-tf.d.ts +17 -0
- package/dist-sdk/src/entities/agent-a2a-skill/from-tf.js +64 -0
- package/dist-sdk/src/entities/agent-a2a-skill/module.d.ts +4 -0
- package/dist-sdk/src/entities/agent-a2a-skill/module.js +14 -0
- package/dist-sdk/src/entities/agent-a2a-skill/to-tf.d.ts +40 -0
- package/dist-sdk/src/entities/agent-a2a-skill/to-tf.js +47 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +51 -4
- package/dist-sdk/src/entities/agent-tool/from-tf.js +131 -35
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +11 -4
- package/dist-sdk/src/entities/agent-tool/to-tf.js +176 -30
- package/dist-sdk/src/entities/agent-tool/types.d.ts +5 -4
- package/dist-sdk/src/entities/agent-tool/types.js +38 -6
- package/dist-sdk/src/entities/app/build.d.ts +91 -13
- package/dist-sdk/src/entities/app/build.js +63 -5
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +3 -0
- package/dist-sdk/src/entities/app/from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/app/from-tf.js +32 -22
- package/dist-sdk/src/entities/app/index.d.ts +4 -1
- package/dist-sdk/src/entities/app/index.js +2 -1
- package/dist-sdk/src/entities/app/module.js +10 -2
- package/dist-sdk/src/entities/app/to-tf.d.ts +5 -0
- package/dist-sdk/src/entities/app/to-tf.js +45 -4
- package/dist-sdk/src/entities/automation/build.d.ts +57 -13
- package/dist-sdk/src/entities/automation/build.js +62 -42
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +25 -8
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +16 -1
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +206 -47
- package/dist-sdk/src/entities/automation/filter.d.ts +37 -3
- package/dist-sdk/src/entities/automation/filter.js +54 -3
- package/dist-sdk/src/entities/automation/from-tf.d.ts +26 -27
- package/dist-sdk/src/entities/automation/from-tf.js +1344 -222
- package/dist-sdk/src/entities/automation/index.d.ts +4 -0
- package/dist-sdk/src/entities/automation/index.js +4 -0
- package/dist-sdk/src/entities/automation/module.js +29 -32
- package/dist-sdk/src/entities/automation/operators.d.ts +29 -2
- package/dist-sdk/src/entities/automation/operators.js +27 -1
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +19 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +24 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +10 -21
- package/dist-sdk/src/entities/automation/script-code.js +272 -5
- package/dist-sdk/src/entities/automation/tasks.d.ts +125 -19
- package/dist-sdk/src/entities/automation/tasks.js +83 -15
- package/dist-sdk/src/entities/automation/to-tf.d.ts +10 -29
- package/dist-sdk/src/entities/automation/to-tf.js +1291 -230
- package/dist-sdk/src/entities/automation/triggers.d.ts +9 -1
- package/dist-sdk/src/entities/automation/types.d.ts +29 -4
- package/dist-sdk/src/entities/automation/types.js +76 -46
- package/dist-sdk/src/entities/element/build.d.ts +44 -13
- package/dist-sdk/src/entities/element/build.js +45 -3
- package/dist-sdk/src/entities/element/from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/element/from-tf.js +28 -14
- package/dist-sdk/src/entities/element/index.d.ts +4 -1
- package/dist-sdk/src/entities/element/index.js +2 -1
- package/dist-sdk/src/entities/element/module.js +4 -1
- package/dist-sdk/src/entities/element/to-tf.js +26 -3
- package/dist-sdk/src/entities/field/build.d.ts +61 -14
- package/dist-sdk/src/entities/field/build.js +10 -0
- package/dist-sdk/src/entities/field/calc/runtime.js +4 -0
- package/dist-sdk/src/entities/field/from-tf.d.ts +5 -3
- package/dist-sdk/src/entities/field/from-tf.js +118 -7
- package/dist-sdk/src/entities/field/module.js +3 -2
- package/dist-sdk/src/entities/field/to-tf.d.ts +46 -11
- package/dist-sdk/src/entities/field/to-tf.js +166 -17
- package/dist-sdk/src/entities/field/types.d.ts +26 -0
- package/dist-sdk/src/entities/field/types.js +34 -12
- package/dist-sdk/src/entities/file-reader/build.d.ts +108 -50
- package/dist-sdk/src/entities/file-reader/build.js +23 -23
- package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.d.ts +6 -0
- package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.js +109 -0
- package/dist-sdk/src/entities/file-reader/from-tf.d.ts +13 -0
- package/dist-sdk/src/entities/file-reader/from-tf.js +172 -0
- package/dist-sdk/src/entities/file-reader/index.d.ts +8 -3
- package/dist-sdk/src/entities/file-reader/index.js +7 -2
- package/dist-sdk/src/entities/file-reader/module.d.ts +3 -0
- package/dist-sdk/src/entities/file-reader/module.js +115 -0
- package/dist-sdk/src/entities/file-reader/to-tf.d.ts +14 -0
- package/dist-sdk/src/entities/file-reader/to-tf.js +84 -0
- package/dist-sdk/src/entities/file-reader/types.d.ts +32 -0
- package/dist-sdk/src/entities/file-reader/types.js +30 -0
- package/dist-sdk/src/entities/org/ai-provider.d.ts +13 -0
- package/dist-sdk/src/entities/org/ai-provider.js +46 -0
- package/dist-sdk/src/entities/org/connector.d.ts +8 -1
- package/dist-sdk/src/entities/org/connector.js +12 -14
- package/dist-sdk/src/entities/org/group.js +10 -1
- package/dist-sdk/src/entities/org/index.d.ts +1 -0
- package/dist-sdk/src/entities/org/index.js +1 -0
- package/dist-sdk/src/entities/org/user.js +10 -1
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +59 -9
- package/dist-sdk/src/entities/shared/filters/types.d.ts +1 -1
- package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +17 -0
- package/dist-sdk/src/entities/shared/tool-field-ref.js +46 -0
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +10 -1
- package/dist-sdk/src/entities/shared/types/field-types.js +9 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +19 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +128 -11
- package/dist-sdk/src/entities/skill/from-tf.js +4 -3
- package/dist-sdk/src/entities/skill/index.d.ts +1 -1
- package/dist-sdk/src/entities/skill/module.js +7 -1
- package/dist-sdk/src/entities/skill/to-tf.d.ts +26 -0
- package/dist-sdk/src/entities/skill/to-tf.js +65 -4
- package/dist-sdk/src/entities/skill/tools.d.ts +37 -8
- package/dist-sdk/src/entities/skill/tools.js +43 -1
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +34 -4
- package/dist-sdk/src/entities/skill-tool/from-tf.js +128 -18
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +13 -1
- package/dist-sdk/src/entities/skill-tool/to-tf.js +164 -25
- package/dist-sdk/src/entities/skill-tool/types.d.ts +5 -7
- package/dist-sdk/src/entities/skill-tool/types.js +47 -11
- package/dist-sdk/src/entities/view/from-tf.d.ts +6 -2
- package/dist-sdk/src/entities/view/from-tf.js +11 -9
- package/dist-sdk/src/entities/view/to-tf.d.ts +9 -7
- package/dist-sdk/src/entities/view/to-tf.js +39 -18
- package/dist-sdk/src/entities/view/types.d.ts +1 -1
- package/dist-sdk/src/entities/view/types.js +1 -1
- package/dist-sdk/src/graph/deferred-catalog-render.d.ts +0 -5
- package/dist-sdk/src/graph/deferred-catalog-render.js +1 -20
- package/dist-sdk/src/graph/index.d.ts +8 -0
- package/dist-sdk/src/graph/index.js +13 -9
- package/dist-sdk/src/graph/modules.js +8 -1
- package/dist-sdk/src/graph/types.d.ts +98 -4
- package/package.json +49 -16
- package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +0 -76
- package/dist-sdk/src/entities/automation/value-ref-tf.js +0 -190
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { EntityTfError } from "../../engine/entity.js";
|
|
8
8
|
import { optionalString, resourceRefLabel } from "../../engine/pull/context.js";
|
|
9
|
-
import { isTfExpr,
|
|
10
|
-
import {
|
|
9
|
+
import { isTfExpr, scopedLabelToBagKey } from "../../engine/tf/index.js";
|
|
10
|
+
import { resolveToolFieldKey } from "../shared/tool-field-ref.js";
|
|
11
11
|
import { KNOWN_TOOL_ATTRS, TOOL_SUB_TYPE_BY_RESOURCE } from "./types.js";
|
|
12
12
|
/**
|
|
13
13
|
* One tool block → its normalized shape; undefined = skipped with a
|
|
@@ -41,58 +41,146 @@ export function toolFromTf(block, owner, ctx) {
|
|
|
41
41
|
return undefined;
|
|
42
42
|
}
|
|
43
43
|
if (subType.typeKey === "executeWorkflow") {
|
|
44
|
-
return executeWorkflowFromTf(block, name, where, ctx);
|
|
44
|
+
return executeWorkflowFromTf(block, name, where, owner, ctx);
|
|
45
45
|
}
|
|
46
46
|
// Target: the owning app's resource ref = self; a data.elementum_app ref =
|
|
47
47
|
// a foreign app, resolved to its display name via the stream's data block.
|
|
48
|
+
// searchTable is the one sub-type where target_id can be absent entirely
|
|
49
|
+
// (confirmed live: a search table tool searches the table itself, with no
|
|
50
|
+
// "live record" target required) — every other implemented sub-type
|
|
51
|
+
// requires it.
|
|
48
52
|
const targetAttr = attrs["target_id"];
|
|
49
53
|
let target;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
// The tool's fields are scoped under the RESOLVED target aspect, not
|
|
55
|
+
// always the owning app (board issue #169) — a field on a foreign
|
|
56
|
+
// app/element carries that aspect's own label, mirroring the
|
|
57
|
+
// foreignApp/foreignElement resolution below.
|
|
58
|
+
let fieldScopeLabel = owner.ownerTfLabel;
|
|
59
|
+
let fieldScope = "app";
|
|
60
|
+
if (targetAttr === undefined) {
|
|
61
|
+
if (subType.typeKey !== "searchTable") {
|
|
62
|
+
ctx.diagnostics.push(`${where}: target_id is missing; skipped`);
|
|
58
63
|
return undefined;
|
|
59
64
|
}
|
|
60
|
-
target = { kind: "foreignApp", name: appName };
|
|
61
65
|
}
|
|
62
66
|
else {
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
const selfLabel = resourceRefLabel(targetAttr, owner.appType);
|
|
68
|
+
if (selfLabel === owner.appLabel) {
|
|
69
|
+
target = { kind: "self" };
|
|
70
|
+
}
|
|
71
|
+
else if (isTfExpr(targetAttr) && targetAttr.$expr === "data-attr" && targetAttr.type === "elementum_app") {
|
|
72
|
+
const appName = ctx.dataName("elementum_app", targetAttr.label);
|
|
73
|
+
if (appName === undefined) {
|
|
74
|
+
ctx.diagnostics.push(`${where}: target_id references data.elementum_app.${targetAttr.label} but the stream has no such data block; skipped`);
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
target = { kind: "foreignApp", name: appName };
|
|
78
|
+
fieldScopeLabel = targetAttr.label;
|
|
79
|
+
}
|
|
80
|
+
else if (isTfExpr(targetAttr) && targetAttr.$expr === "data-attr" && targetAttr.type === "elementum_element") {
|
|
81
|
+
// Board issue #42: an aspect target can be an element, not just an app —
|
|
82
|
+
// same shape as the foreignApp branch, just the other data type.
|
|
83
|
+
const elementName = ctx.dataName("elementum_element", targetAttr.label);
|
|
84
|
+
if (elementName === undefined) {
|
|
85
|
+
ctx.diagnostics.push(`${where}: target_id references data.elementum_element.${targetAttr.label} but the stream has no such data block; skipped`);
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
target = { kind: "foreignElement", name: elementName };
|
|
89
|
+
fieldScopeLabel = targetAttr.label;
|
|
90
|
+
fieldScope = "element";
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
ctx.diagnostics.push(`${where}: target_id has an unrecognized shape (${JSON.stringify(targetAttr)}); skipped`);
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
65
96
|
}
|
|
66
97
|
let fields;
|
|
98
|
+
let searchTableFields;
|
|
67
99
|
const rawFields = attrs["fields"];
|
|
68
100
|
if (Array.isArray(rawFields)) {
|
|
69
|
-
|
|
70
|
-
|
|
101
|
+
if (subType.typeKey === "searchTable") {
|
|
102
|
+
searchTableFields = [];
|
|
103
|
+
for (const item of rawFields) {
|
|
104
|
+
if (typeof item !== "object" || item === null || Array.isArray(item) || isTfExpr(item)) {
|
|
105
|
+
ctx.diagnostics.push(`${where}: fields item has an unrecognized shape; dropped`);
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
const rec = item;
|
|
109
|
+
if (typeof rec["field_id"] !== "string" || rec["field_id"] === "") {
|
|
110
|
+
ctx.diagnostics.push(`${where}: fields item has no field_id; dropped`);
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
searchTableFields.push({
|
|
114
|
+
fieldId: rec["field_id"],
|
|
115
|
+
...(typeof rec["name"] === "string" && { name: rec["name"] }),
|
|
116
|
+
...(typeof rec["description"] === "string" && { description: rec["description"] }),
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
if (searchTableFields.length === 0)
|
|
120
|
+
searchTableFields = undefined;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
fields = [];
|
|
124
|
+
for (const item of rawFields) {
|
|
125
|
+
if (typeof item !== "object" || item === null || Array.isArray(item) || isTfExpr(item)) {
|
|
126
|
+
ctx.diagnostics.push(`${where}: fields item has an unrecognized shape; dropped`);
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
const rec = item;
|
|
130
|
+
const fieldKey = resolveToolFieldKey(rec["field_id"], fieldScopeLabel, fieldScope);
|
|
131
|
+
// A field on a foreign/out-of-scope aspect has no field resource ei
|
|
132
|
+
// can reference — it falls back to a bare platform id, confirmed
|
|
133
|
+
// live (board issue #169). Preserve it (raw-id TODO placeholder)
|
|
134
|
+
// rather than silently dropping the field.
|
|
135
|
+
const rawFieldId = fieldKey === undefined && typeof rec["field_id"] === "string" && rec["field_id"] !== "" ? rec["field_id"] : undefined;
|
|
136
|
+
if (fieldKey === undefined && rawFieldId === undefined) {
|
|
137
|
+
ctx.diagnostics.push(`${where}: fields item's field_id is not a field resource reference; dropped`);
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
fields.push({
|
|
141
|
+
...(fieldKey !== undefined ? { key: fieldKey } : { rawFieldId: rawFieldId }),
|
|
142
|
+
...(typeof rec["name"] === "string" && { name: rec["name"] }),
|
|
143
|
+
...(typeof rec["description"] === "string" && { description: rec["description"] }),
|
|
144
|
+
...(typeof rec["required"] === "boolean" && { required: rec["required"] }),
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
if (fields.length === 0)
|
|
148
|
+
fields = undefined;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
else if (rawFields !== undefined) {
|
|
152
|
+
ctx.diagnostics.push(`${where}: fields is not a list; dropped`);
|
|
153
|
+
}
|
|
154
|
+
// searchTable's field_id is ALWAYS a raw platform id, never a resource
|
|
155
|
+
// reference (confirmed live, 161/161 real captures) — these describe
|
|
156
|
+
// columns of the search table's own schema, not app/element fields, so
|
|
157
|
+
// there's no elementum_*_field resource (and no catalog bag key) to
|
|
158
|
+
// resolve them to.
|
|
159
|
+
let returnFields;
|
|
160
|
+
const rawReturnFields = attrs["return_fields"];
|
|
161
|
+
if (Array.isArray(rawReturnFields)) {
|
|
162
|
+
returnFields = [];
|
|
163
|
+
for (const item of rawReturnFields) {
|
|
71
164
|
if (typeof item !== "object" || item === null || Array.isArray(item) || isTfExpr(item)) {
|
|
72
|
-
ctx.diagnostics.push(`${where}:
|
|
165
|
+
ctx.diagnostics.push(`${where}: return_fields item has an unrecognized shape; dropped`);
|
|
73
166
|
continue;
|
|
74
167
|
}
|
|
75
168
|
const rec = item;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
? fieldRef.label
|
|
79
|
-
: undefined;
|
|
80
|
-
if (fieldLabel === undefined) {
|
|
81
|
-
ctx.diagnostics.push(`${where}: fields item's field_id is not a field resource reference; dropped`);
|
|
169
|
+
if (typeof rec["field_id"] !== "string" || rec["field_id"] === "") {
|
|
170
|
+
ctx.diagnostics.push(`${where}: return_fields item has no field_id; dropped`);
|
|
82
171
|
continue;
|
|
83
172
|
}
|
|
84
|
-
|
|
85
|
-
|
|
173
|
+
returnFields.push({
|
|
174
|
+
fieldId: rec["field_id"],
|
|
86
175
|
...(typeof rec["name"] === "string" && { name: rec["name"] }),
|
|
87
|
-
...(typeof rec["
|
|
88
|
-
...(typeof rec["required"] === "boolean" && { required: rec["required"] }),
|
|
176
|
+
...(typeof rec["display_name"] === "string" && { displayName: rec["display_name"] }),
|
|
89
177
|
});
|
|
90
178
|
}
|
|
91
|
-
if (
|
|
92
|
-
|
|
179
|
+
if (returnFields.length === 0)
|
|
180
|
+
returnFields = undefined;
|
|
93
181
|
}
|
|
94
|
-
else if (
|
|
95
|
-
ctx.diagnostics.push(`${where}:
|
|
182
|
+
else if (rawReturnFields !== undefined) {
|
|
183
|
+
ctx.diagnostics.push(`${where}: return_fields is not a list; dropped`);
|
|
96
184
|
}
|
|
97
185
|
if (subType.typeKey === "searchAspect" && attrs["filter_variables"] !== undefined) {
|
|
98
186
|
ctx.diagnostics.push(`${where}: filter_variables are not supported on the terraform path yet; a rebuilt stream will omit them`);
|
|
@@ -103,12 +191,20 @@ export function toolFromTf(block, owner, ctx) {
|
|
|
103
191
|
name,
|
|
104
192
|
description: optionalString(attrs, "description", where, ctx) ?? "",
|
|
105
193
|
...(startMessage !== undefined && { startMessage }),
|
|
106
|
-
target,
|
|
194
|
+
...(target !== undefined && { target }),
|
|
107
195
|
...(fields !== undefined && { fields }),
|
|
108
|
-
...(
|
|
196
|
+
...(searchTableFields !== undefined && { searchTableFields }),
|
|
197
|
+
...(returnFields !== undefined && { returnFields }),
|
|
198
|
+
...((subType.typeKey === "searchAspect" || subType.typeKey === "searchTable") && {
|
|
109
199
|
queryDescription: optionalString(attrs, "query_description", where, ctx) ?? "",
|
|
110
200
|
}),
|
|
111
201
|
...(typeof attrs["result_limit"] === "number" && { limit: attrs["result_limit"] }),
|
|
202
|
+
...(subType.typeKey === "updateRecord" && {
|
|
203
|
+
handleDescription: optionalString(attrs, "handle_description", where, ctx) ?? "",
|
|
204
|
+
}),
|
|
205
|
+
...(subType.typeKey === "searchTable" && typeof attrs["search_table_id"] === "string" && {
|
|
206
|
+
searchTableId: attrs["search_table_id"],
|
|
207
|
+
}),
|
|
112
208
|
};
|
|
113
209
|
}
|
|
114
210
|
/**
|
|
@@ -117,7 +213,7 @@ export function toolFromTf(block, owner, ctx) {
|
|
|
117
213
|
* generated after the automation's, and both carry the same platform id) or
|
|
118
214
|
* the automation resource itself; both labels are the automation's.
|
|
119
215
|
*/
|
|
120
|
-
function executeWorkflowFromTf(block, name, where, ctx) {
|
|
216
|
+
function executeWorkflowFromTf(block, name, where, owner, ctx) {
|
|
121
217
|
const attrs = block.attrs;
|
|
122
218
|
const autoRef = attrs["automation_id"];
|
|
123
219
|
const autoLabel = isTfExpr(autoRef) &&
|
|
@@ -162,7 +258,7 @@ function executeWorkflowFromTf(block, name, where, ctx) {
|
|
|
162
258
|
name,
|
|
163
259
|
description: optionalString(attrs, "description", where, ctx) ?? "",
|
|
164
260
|
...(startMessage !== undefined && { startMessage }),
|
|
165
|
-
automationKey:
|
|
261
|
+
automationKey: scopedLabelToBagKey(owner.ownerTfLabel, autoLabel),
|
|
166
262
|
...(inputs.length > 0 && { inputs }),
|
|
167
263
|
...(outputs.length > 0 && { outputs }),
|
|
168
264
|
};
|
|
@@ -10,17 +10,24 @@
|
|
|
10
10
|
* - cross-app target → a name-keyed `data.elementum_app` lookup whose
|
|
11
11
|
* label derives from the app NAME (ei's sanitize rule);
|
|
12
12
|
* - tool fields → the field resource's ref (`elementum_*_field.<label>.id`),
|
|
13
|
-
* derivable purely from the FieldRef token (fieldType + refName)
|
|
13
|
+
* derivable purely from the FieldRef token (fieldType + refName); a field
|
|
14
|
+
* owned by a DIFFERENT app/element resolves via a `data.elementum_field`
|
|
15
|
+
* lookup instead (`parentKind`/`parentName` on the token — see
|
|
16
|
+
* `FieldRef`'s doc comment in `src/catalog/types.ts`).
|
|
14
17
|
*/
|
|
15
|
-
import { type TfBlock } from "../../engine/tf/index.js";
|
|
18
|
+
import { type TfBlock, type TfValue } from "../../engine/tf/index.js";
|
|
16
19
|
export interface ToolToTfContext {
|
|
17
20
|
/** The owning app's refName + tfLabel (namespace) — self-target detection + app_id. */
|
|
18
21
|
readonly appRefName: string;
|
|
19
22
|
readonly appTfLabel: string;
|
|
20
|
-
/** The owning agent's tfLabel. */
|
|
21
|
-
readonly
|
|
23
|
+
/** The owning agent's bare tfLabel (before apps_ prefix). */
|
|
24
|
+
readonly agentBareTfLabel: string;
|
|
22
25
|
/** Records a foreign-app data lookup for data.tf; returns its tfLabel. */
|
|
23
26
|
foreignAppRef(tfLabel: string, name: string): void;
|
|
27
|
+
/** Records a foreign-ELEMENT data lookup for data.tf (board issue #42). */
|
|
28
|
+
foreignElementRef(tfLabel: string, name: string): void;
|
|
29
|
+
/** Records a `data.elementum_field` lookup for a field owned by a foreign app/element. */
|
|
30
|
+
foreignFieldRef(type: string, tfLabel: string, objectId: TfValue, name: string): void;
|
|
24
31
|
/** Degradations land here — reported by the caller, never silent. */
|
|
25
32
|
readonly diagnostics: string[];
|
|
26
33
|
}
|
|
@@ -10,36 +10,109 @@
|
|
|
10
10
|
* - cross-app target → a name-keyed `data.elementum_app` lookup whose
|
|
11
11
|
* label derives from the app NAME (ei's sanitize rule);
|
|
12
12
|
* - tool fields → the field resource's ref (`elementum_*_field.<label>.id`),
|
|
13
|
-
* derivable purely from the FieldRef token (fieldType + refName)
|
|
13
|
+
* derivable purely from the FieldRef token (fieldType + refName); a field
|
|
14
|
+
* owned by a DIFFERENT app/element resolves via a `data.elementum_field`
|
|
15
|
+
* lookup instead (`parentKind`/`parentName` on the token — see
|
|
16
|
+
* `FieldRef`'s doc comment in `src/catalog/types.ts`).
|
|
14
17
|
*/
|
|
15
|
-
import { expr, sanitizeName, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
16
|
-
import {
|
|
18
|
+
import { appScopedResourceLabel, expr, sanitizeName, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
19
|
+
import { EntityTfError } from "../../engine/entity.js";
|
|
20
|
+
import { fieldRefToTfValue } from "../field/to-tf.js";
|
|
17
21
|
import { TOOL_SUB_TYPE_BY_TYPE_KEY } from "./types.js";
|
|
18
|
-
/** authoring
|
|
19
|
-
function
|
|
22
|
+
/** authoring AspectRef token → its resolved target (self resource ref or foreign data ref). */
|
|
23
|
+
function resolveTarget(token, ctx) {
|
|
20
24
|
const refName = token.refName ?? "";
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
const kind = token.__kind === "element" ? "element" : "app";
|
|
26
|
+
if (kind === "app" && refName === ctx.appRefName) {
|
|
27
|
+
return { value: expr.resourceAttr("elementum_app", ctx.appTfLabel, ["id"]), refName, kind, isSelf: true };
|
|
28
|
+
}
|
|
29
|
+
// ei derives foreign-app/foreign-element data labels from the display NAME.
|
|
30
|
+
const name = token.name ?? refName;
|
|
31
|
+
const tfLabel = sanitizeName(name);
|
|
32
|
+
// Board issue #42: an aspect token can be an element, not just an app —
|
|
33
|
+
// must emit `data.elementum_element`, never `data.elementum_app`, or the
|
|
34
|
+
// provider looks up the wrong resource type entirely.
|
|
35
|
+
if (kind === "element") {
|
|
36
|
+
ctx.foreignElementRef(tfLabel, name);
|
|
37
|
+
return { value: expr.dataAttr("elementum_element", tfLabel, ["id"]), refName, kind, isSelf: false, foreignTfLabel: tfLabel };
|
|
38
|
+
}
|
|
39
|
+
ctx.foreignAppRef(tfLabel, name);
|
|
40
|
+
return { value: expr.dataAttr("elementum_app", tfLabel, ["id"]), refName, kind, isSelf: false, foreignTfLabel: tfLabel };
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A field belonging to the tool's target aspect, when that target is
|
|
44
|
+
* foreign to the tool's owning app — resolved via a `data.elementum_field`
|
|
45
|
+
* lookup keyed by the TARGET's already-resolved id (never re-derived from
|
|
46
|
+
* the field token's own `parentKind`/`parentName`, which would let a field
|
|
47
|
+
* from some unrelated third aspect silently pair with this target's id;
|
|
48
|
+
* see `resolveFieldForTarget`) + the field's display name. Same pattern as
|
|
49
|
+
* `automation/to-tf.ts`'s `crossAppFieldToTf` and `field/to-tf.ts`'s
|
|
50
|
+
* `resolveRelatedLabelField`.
|
|
51
|
+
*/
|
|
52
|
+
function foreignTargetFieldRefValue(token, refName, target, ctx) {
|
|
53
|
+
const fieldName = token.name ?? refName;
|
|
54
|
+
const fieldLabel = `${target.kind}_${target.foreignTfLabel}_${tsLabelToTfLabel(refName)}`;
|
|
55
|
+
ctx.foreignFieldRef("elementum_field", fieldLabel, target.value, fieldName);
|
|
56
|
+
return expr.dataAttr("elementum_field", fieldLabel, ["id"]);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* authoring FieldRef token → the field resource address, resolved against
|
|
60
|
+
* the tool's ACTUAL target aspect (`resolveTarget`'s result) — not just the
|
|
61
|
+
* tool's owning app. A tool's fields are attributes of the record it
|
|
62
|
+
* creates/searches/updates, so a field whose `parent` doesn't match the
|
|
63
|
+
* target (by refName AND kind — an app and a foreign element can share a
|
|
64
|
+
* refName) is an authoring error the platform would otherwise reject
|
|
65
|
+
* opaquely at apply ("field is not valid on target aspect"); `target`
|
|
66
|
+
* absent (defensive: only possible for `searchTable`'s optional-aspect
|
|
67
|
+
* shape, which doesn't use this field path) falls back to the tool's own
|
|
68
|
+
* app as before.
|
|
69
|
+
*/
|
|
70
|
+
function fieldRefValue(token, where, ctx, target) {
|
|
71
|
+
const refName = token.refName ?? "";
|
|
72
|
+
if (refName === "") {
|
|
73
|
+
ctx.diagnostics.push(`${where}: field token has no refName; dropped`);
|
|
25
74
|
return undefined;
|
|
26
75
|
}
|
|
27
|
-
if (
|
|
28
|
-
|
|
76
|
+
if (target !== undefined) {
|
|
77
|
+
// `parentKind` is stamped ALONGSIDE a FOREIGN `parent` by `appCatalog`/
|
|
78
|
+
// `elementCatalog` (see `FieldRef`'s doc comment) — but a field's own
|
|
79
|
+
// `.ref()` on ITS OWN app/element stamps `parent` (as a self-reference)
|
|
80
|
+
// without `parentKind` at all (a real, common shape — see e.g.
|
|
81
|
+
// `__tests__/extract/update-record-tool.test.ts`'s fixture literals), so
|
|
82
|
+
// only a parent naming something OTHER than the tool's owning app is
|
|
83
|
+
// genuinely ambiguous. Defaulting `parentKind` to "app" THERE instead of
|
|
84
|
+
// failing loudly is the same silent-miss failure mode
|
|
85
|
+
// `automation/to-tf.ts`'s `crossAppFieldToTf` guards against: an element
|
|
86
|
+
// field with a missing kind stamp would validate (and later resolve) as
|
|
87
|
+
// if it belonged to an app of the same refName.
|
|
88
|
+
if (token.parent !== undefined && token.parent !== ctx.appRefName && token.parentKind === undefined) {
|
|
89
|
+
ctx.diagnostics.push(`${where}: field "${refName}" has a parent ("${token.parent}") but no parentKind — incomplete foreign-field provenance; dropped`);
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
const parent = token.parent ?? ctx.appRefName;
|
|
93
|
+
const parentKind = token.parentKind ?? "app";
|
|
94
|
+
if (parent !== target.refName || parentKind !== target.kind) {
|
|
95
|
+
ctx.diagnostics.push(`${where}: field "${refName}" belongs to ${parentKind} "${parent}", not the tool's target ${target.kind} "${target.refName}" — a tool's fields must belong to its own target aspect; dropped`);
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
if (!target.isSelf)
|
|
99
|
+
return foreignTargetFieldRefValue(token, refName, target, ctx);
|
|
100
|
+
// Falls through to the same-app resource-address resolution below —
|
|
101
|
+
// `target.isSelf` already proved this target IS ctx.appTfLabel.
|
|
102
|
+
}
|
|
103
|
+
else if (token.parent !== undefined && (token.parent !== ctx.appRefName || token.parentKind === "element")) {
|
|
104
|
+
ctx.diagnostics.push(`${where}: field "${refName}" belongs to "${token.parent}", not this tool's app; dropped`);
|
|
29
105
|
return undefined;
|
|
30
106
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
107
|
+
// Delegates to field/to-tf.ts's shared resolver (system-field local alias
|
|
108
|
+
// vs. real field resource, by authoring type) rather than reimplementing
|
|
109
|
+
// it here — see fieldRefToTfValue's doc comment for the system-field
|
|
110
|
+
// ordering rationale.
|
|
111
|
+
const value = fieldRefToTfValue(token.fieldType ?? "", refName, ctx.appTfLabel);
|
|
112
|
+
if (value === undefined) {
|
|
113
|
+
ctx.diagnostics.push(`${where}: field token "${refName}" has no terraform field resource mapping (fieldType ${JSON.stringify(token.fieldType ?? "")}); dropped`);
|
|
37
114
|
}
|
|
38
|
-
|
|
39
|
-
const name = token.name ?? token.refName ?? "";
|
|
40
|
-
const tfLabel = sanitizeName(name);
|
|
41
|
-
ctx.foreignAppRef(tfLabel, name);
|
|
42
|
-
return expr.dataAttr("elementum_app", tfLabel, ["id"]);
|
|
115
|
+
return value;
|
|
43
116
|
}
|
|
44
117
|
/**
|
|
45
118
|
* One authored tool entry (`{ createRecord: {...} }`) → its resource block;
|
|
@@ -73,9 +146,10 @@ export function toolToTf(entry, ctx) {
|
|
|
73
146
|
ctx.diagnostics.push(`agent tool "${name}": runAs is not supported on the terraform path yet; dropped`);
|
|
74
147
|
}
|
|
75
148
|
const where = `agent tool "${name}"`;
|
|
76
|
-
const
|
|
149
|
+
const agentTfLabel = appScopedResourceLabel(ctx.appTfLabel, ctx.agentBareTfLabel);
|
|
150
|
+
const tfLabel = appScopedResourceLabel(ctx.appTfLabel, sanitizeName(`${ctx.agentBareTfLabel}_${name}`));
|
|
77
151
|
const attrs = {
|
|
78
|
-
agent_id: expr.resourceAttr("elementum_agent",
|
|
152
|
+
agent_id: expr.resourceAttr("elementum_agent", agentTfLabel, ["id"]),
|
|
79
153
|
app_id: expr.resourceAttr("elementum_app", ctx.appTfLabel, ["id"]),
|
|
80
154
|
name,
|
|
81
155
|
description: inner.description ?? "",
|
|
@@ -105,7 +179,7 @@ export function toolToTf(entry, ctx) {
|
|
|
105
179
|
// until the provider has published the workflow whose bindings it reads.
|
|
106
180
|
// ei export normalizes this back to elementum_automation.<label>.id; the
|
|
107
181
|
// live round-trip comparator treats only those two references as equal.
|
|
108
|
-
attrs["automation_id"] = expr.resourceAttr("elementum_workflow_publish", autoTfLabel, ["id"]);
|
|
182
|
+
attrs["automation_id"] = expr.resourceAttr("elementum_workflow_publish", appScopedResourceLabel(ctx.appTfLabel, autoTfLabel), ["id"]);
|
|
109
183
|
if (inner.inputs !== undefined && inner.inputs.length > 0) {
|
|
110
184
|
attrs["inputs"] = inner.inputs.map((i) => ({
|
|
111
185
|
parameter_name: i.triggerParameterId?.name ?? "",
|
|
@@ -126,12 +200,26 @@ export function toolToTf(entry, ctx) {
|
|
|
126
200
|
const block = { kind: "resource", type: subType.resourceType, label: tfLabel, attrs };
|
|
127
201
|
return { block, address: `${subType.resourceType}.${tfLabel}` };
|
|
128
202
|
}
|
|
129
|
-
|
|
203
|
+
// searchTable is the one sub-type where a target aspect is optional
|
|
204
|
+
// (confirmed live — see toolFromTf's matching comment).
|
|
205
|
+
if (inner.aspectId === undefined && typeKey !== "searchTable") {
|
|
130
206
|
ctx.diagnostics.push(`${where}: no target aspect token; dropped`);
|
|
131
207
|
return undefined;
|
|
132
208
|
}
|
|
133
|
-
|
|
134
|
-
if (
|
|
209
|
+
const target = inner.aspectId !== undefined ? resolveTarget(inner.aspectId, ctx) : undefined;
|
|
210
|
+
if (target !== undefined)
|
|
211
|
+
attrs["target_id"] = target.value;
|
|
212
|
+
if (typeKey === "updateRecord") {
|
|
213
|
+
if (inner.handleDescription === undefined || inner.handleDescription === "") {
|
|
214
|
+
// The provider requires a non-empty handle_description and rejects an
|
|
215
|
+
// empty one at apply with an opaque "Unable to validate" error — fail
|
|
216
|
+
// loud at build time instead (same discipline as the tool-name check).
|
|
217
|
+
throw new EntityTfError(`${where}: agentUpdateRecord requires a non-empty \`handleDescription\` — the platform ` +
|
|
218
|
+
`uses it to identify which record to update and rejects an empty value at apply.`);
|
|
219
|
+
}
|
|
220
|
+
attrs["handle_description"] = inner.handleDescription;
|
|
221
|
+
}
|
|
222
|
+
if (typeKey === "searchAspect" || typeKey === "searchTable") {
|
|
135
223
|
attrs["query_description"] = inner.queryDescription ?? "";
|
|
136
224
|
if (inner.limit !== undefined)
|
|
137
225
|
attrs["result_limit"] = inner.limit;
|
|
@@ -139,10 +227,27 @@ export function toolToTf(entry, ctx) {
|
|
|
139
227
|
ctx.diagnostics.push(`${where}: filter/sort are not supported on the terraform path yet; dropped`);
|
|
140
228
|
}
|
|
141
229
|
}
|
|
230
|
+
if (typeKey === "searchTable") {
|
|
231
|
+
if (inner.searchTableId === undefined || inner.searchTableId === "") {
|
|
232
|
+
ctx.diagnostics.push(`${where}: no searchTableId; dropped`);
|
|
233
|
+
return undefined;
|
|
234
|
+
}
|
|
235
|
+
// Always a raw platform id — see ReturnFieldWire's sibling comment on
|
|
236
|
+
// searchTableId. There is no data-source/reference form to resolve
|
|
237
|
+
// against; ei itself never exports one for this attribute.
|
|
238
|
+
attrs["search_table_id"] = inner.searchTableId;
|
|
239
|
+
}
|
|
142
240
|
if (inner.fields !== undefined && inner.fields.length > 0) {
|
|
143
241
|
const fieldValues = [];
|
|
144
242
|
for (const f of inner.fields) {
|
|
145
|
-
|
|
243
|
+
// A raw-id fallback field (board issue #169) is echoed straight
|
|
244
|
+
// through — ei never resolves it to a reference either, so there's
|
|
245
|
+
// nothing to re-derive.
|
|
246
|
+
const ref = typeof f.fieldId === "string"
|
|
247
|
+
? f.fieldId
|
|
248
|
+
: f.fieldId === undefined
|
|
249
|
+
? undefined
|
|
250
|
+
: fieldRefValue(f.fieldId, where, ctx, target);
|
|
146
251
|
if (ref === undefined)
|
|
147
252
|
continue;
|
|
148
253
|
fieldValues.push({
|
|
@@ -150,7 +255,13 @@ export function toolToTf(entry, ctx) {
|
|
|
150
255
|
// The wire duplicates the display name; the dialect carries one.
|
|
151
256
|
...(f.name !== undefined && { name: f.name }),
|
|
152
257
|
...(f.description !== undefined && { description: f.description }),
|
|
153
|
-
|
|
258
|
+
// Always emit `required` (defaulting false) rather than omitting it:
|
|
259
|
+
// the provider's own Create/Read round trip normalizes a missing
|
|
260
|
+
// value to `false` and returns it, so a config that omits the key
|
|
261
|
+
// plans an eternal `required: false -> null` diff on every apply
|
|
262
|
+
// after the first (confirmed live 2026-08-05). Pin it, like
|
|
263
|
+
// executeWorkflow's `timeout`, so config and state agree.
|
|
264
|
+
required: f.required ?? false,
|
|
154
265
|
});
|
|
155
266
|
if (f.defaultValue !== undefined) {
|
|
156
267
|
ctx.diagnostics.push(`${where}: field default values are not supported on the terraform path yet; dropped`);
|
|
@@ -159,6 +270,41 @@ export function toolToTf(entry, ctx) {
|
|
|
159
270
|
if (fieldValues.length > 0)
|
|
160
271
|
attrs["fields"] = fieldValues;
|
|
161
272
|
}
|
|
273
|
+
// searchTable's own field shapes: field_id is always a raw platform id
|
|
274
|
+
// (see SearchTableFieldWire/ReturnFieldWire's comments) - no
|
|
275
|
+
// fieldRefValue resolution, unlike the shared `fields` block above.
|
|
276
|
+
if (inner.searchTableFields !== undefined && inner.searchTableFields.length > 0) {
|
|
277
|
+
const values = [];
|
|
278
|
+
for (const f of inner.searchTableFields) {
|
|
279
|
+
if (f.fieldId === undefined || f.fieldId === "") {
|
|
280
|
+
ctx.diagnostics.push(`${where}: fields item has no fieldId; dropped`);
|
|
281
|
+
continue;
|
|
282
|
+
}
|
|
283
|
+
values.push({
|
|
284
|
+
field_id: f.fieldId,
|
|
285
|
+
...(f.name !== undefined && { name: f.name }),
|
|
286
|
+
...(f.description !== undefined && { description: f.description }),
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
if (values.length > 0)
|
|
290
|
+
attrs["fields"] = values;
|
|
291
|
+
}
|
|
292
|
+
if (inner.returnFields !== undefined && inner.returnFields.length > 0) {
|
|
293
|
+
const returnFieldValues = [];
|
|
294
|
+
for (const f of inner.returnFields) {
|
|
295
|
+
if (f.fieldId === undefined || f.fieldId === "") {
|
|
296
|
+
ctx.diagnostics.push(`${where}: return_fields item has no fieldId; dropped`);
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
returnFieldValues.push({
|
|
300
|
+
field_id: f.fieldId,
|
|
301
|
+
...(f.name !== undefined && { name: f.name }),
|
|
302
|
+
...(f.displayName !== undefined && { display_name: f.displayName }),
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
if (returnFieldValues.length > 0)
|
|
306
|
+
attrs["return_fields"] = returnFieldValues;
|
|
307
|
+
}
|
|
162
308
|
const block = { kind: "resource", type: subType.resourceType, label: tfLabel, attrs };
|
|
163
309
|
return { block, address: `${subType.resourceType}.${tfLabel}` };
|
|
164
310
|
}
|
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
* (agent_id + app_id + name/description) — so per-sub-type knowledge is one
|
|
5
5
|
* ROW here, exactly like `entities/field/types.ts`.
|
|
6
6
|
*
|
|
7
|
-
* M3 implements createRecord
|
|
8
|
-
* declared so streams REPORT them by name
|
|
9
|
-
* resource", and adoption scopes ONLY the
|
|
10
|
-
* type the printer can't reconstruct would
|
|
7
|
+
* M3 implements createRecord, searchAspect, executeWorkflow, and updateRecord
|
|
8
|
+
* end to end; the other rows are declared so streams REPORT them by name
|
|
9
|
+
* (plan §6) instead of "unknown resource", and adoption scopes ONLY the
|
|
10
|
+
* implemented ones — an adopted type the printer can't reconstruct would
|
|
11
|
+
* plan as a destroy on rebuild.
|
|
11
12
|
*/
|
|
12
13
|
/** One agent-tool sub-type: authoring variant key ↔ resource type. */
|
|
13
14
|
export interface AgentToolSubType {
|
|
@@ -4,17 +4,18 @@
|
|
|
4
4
|
* (agent_id + app_id + name/description) — so per-sub-type knowledge is one
|
|
5
5
|
* ROW here, exactly like `entities/field/types.ts`.
|
|
6
6
|
*
|
|
7
|
-
* M3 implements createRecord
|
|
8
|
-
* declared so streams REPORT them by name
|
|
9
|
-
* resource", and adoption scopes ONLY the
|
|
10
|
-
* type the printer can't reconstruct would
|
|
7
|
+
* M3 implements createRecord, searchAspect, executeWorkflow, and updateRecord
|
|
8
|
+
* end to end; the other rows are declared so streams REPORT them by name
|
|
9
|
+
* (plan §6) instead of "unknown resource", and adoption scopes ONLY the
|
|
10
|
+
* implemented ones — an adopted type the printer can't reconstruct would
|
|
11
|
+
* plan as a destroy on rebuild.
|
|
11
12
|
*/
|
|
12
13
|
export const RUN_AUTOMATION_TOOL_RESOURCE_TYPE = "elementum_agent_run_automation_tool";
|
|
13
14
|
export const AGENT_TOOL_SUB_TYPES = [
|
|
14
15
|
{ typeKey: "createRecord", resourceType: "elementum_agent_create_record_tool", implemented: true },
|
|
15
16
|
{ typeKey: "searchAspect", resourceType: "elementum_agent_search_records_tool", implemented: true },
|
|
16
|
-
{ typeKey: "updateRecord", resourceType: "elementum_agent_update_record_tool" },
|
|
17
|
-
{ typeKey: "searchTable", resourceType: "elementum_agent_ai_search_tool" },
|
|
17
|
+
{ typeKey: "updateRecord", resourceType: "elementum_agent_update_record_tool", implemented: true },
|
|
18
|
+
{ typeKey: "searchTable", resourceType: "elementum_agent_ai_search_tool", implemented: true },
|
|
18
19
|
{ typeKey: "relateRecord", resourceType: "elementum_agent_relate_record_tool" },
|
|
19
20
|
{ typeKey: "executeWorkflow", resourceType: RUN_AUTOMATION_TOOL_RESOURCE_TYPE, implemented: true },
|
|
20
21
|
{ typeKey: "runAgent", resourceType: "elementum_agent_run_agent_tool" },
|
|
@@ -67,4 +68,35 @@ export const KNOWN_TOOL_ATTRS = {
|
|
|
67
68
|
"fields",
|
|
68
69
|
"filter_variables",
|
|
69
70
|
]),
|
|
71
|
+
updateRecord: new Set([
|
|
72
|
+
"agent_id",
|
|
73
|
+
"app_id",
|
|
74
|
+
"name",
|
|
75
|
+
"description",
|
|
76
|
+
"start_message",
|
|
77
|
+
"target_id",
|
|
78
|
+
"handle_description",
|
|
79
|
+
"fields",
|
|
80
|
+
]),
|
|
81
|
+
// target_id is OPTIONAL here (unlike the other three) - confirmed live,
|
|
82
|
+
// 5 of 18 real elementum_agent_ai_search_tool blocks have no target_id at
|
|
83
|
+
// all. return_fields (field_id/name/display_name) is the dialect ei's own
|
|
84
|
+
// export still emits on most tools; a minority have already migrated to
|
|
85
|
+
// the newer `fields` (field_id/name/description) shape the provider
|
|
86
|
+
// schema is deprecating return_fields in favor of - both must round-trip,
|
|
87
|
+
// since re-emitting the wrong one on an already-migrated tool would plan
|
|
88
|
+
// a spurious diff on every apply.
|
|
89
|
+
searchTable: new Set([
|
|
90
|
+
"agent_id",
|
|
91
|
+
"app_id",
|
|
92
|
+
"name",
|
|
93
|
+
"description",
|
|
94
|
+
"start_message",
|
|
95
|
+
"target_id",
|
|
96
|
+
"search_table_id",
|
|
97
|
+
"query_description",
|
|
98
|
+
"result_limit",
|
|
99
|
+
"fields",
|
|
100
|
+
"return_fields",
|
|
101
|
+
]),
|
|
70
102
|
};
|