@elementumai/edk 0.10.3 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -7
- package/dist-sdk/src/catalog/token.js +2 -1
- package/dist-sdk/src/core/wire/ref-serializer.js +26 -1
- package/dist-sdk/src/engine/build/context.d.ts +4 -0
- package/dist-sdk/src/engine/coverage-gaps.d.ts +2 -0
- package/dist-sdk/src/engine/coverage-gaps.js +3 -0
- package/dist-sdk/src/engine/ei/json-stream-reader.d.ts +43 -0
- package/dist-sdk/src/engine/ei/json-stream-reader.js +234 -0
- package/dist-sdk/src/engine/ei/run.d.ts +22 -0
- package/dist-sdk/src/engine/ei/run.js +99 -18
- package/dist-sdk/src/engine/ei/saved-plan.d.ts +16 -0
- package/dist-sdk/src/engine/ei/saved-plan.js +19 -0
- package/dist-sdk/src/engine/ei/state.d.ts +1 -1
- package/dist-sdk/src/engine/ei/state.js +17 -4
- package/dist-sdk/src/engine/progress.d.ts +3 -1
- package/dist-sdk/src/engine/progress.js +7 -3
- package/dist-sdk/src/engine/pull/authored-address.d.ts +15 -1
- package/dist-sdk/src/engine/pull/authored-address.js +180 -29
- package/dist-sdk/src/engine/pull/context.d.ts +52 -7
- package/dist-sdk/src/engine/pull/context.js +7 -4
- package/dist-sdk/src/engine/tf/index.d.ts +3 -2
- package/dist-sdk/src/engine/tf/index.js +3 -2
- package/dist-sdk/src/engine/tf/labels.d.ts +22 -0
- package/dist-sdk/src/engine/tf/labels.js +50 -0
- package/dist-sdk/src/engine/tf/model.d.ts +2 -0
- package/dist-sdk/src/engine/tf/model.js +26 -0
- package/dist-sdk/src/engine/tf/scan.d.ts +22 -0
- package/dist-sdk/src/engine/tf/scan.js +123 -0
- package/dist-sdk/src/engine/validation.d.ts +2 -0
- package/dist-sdk/src/engine/workspace/loader.d.ts +8 -0
- package/dist-sdk/src/engine/workspace/loader.js +20 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +17 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +52 -24
- package/dist-sdk/src/entities/access-policy/member-list.d.ts +32 -0
- package/dist-sdk/src/entities/access-policy/member-list.js +57 -0
- package/dist-sdk/src/entities/access-policy/module.js +5 -0
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +4 -3
- package/dist-sdk/src/entities/access-policy/to-tf.js +21 -12
- package/dist-sdk/src/entities/agent/build.js +7 -5
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +2 -0
- package/dist-sdk/src/entities/agent/from-tf.js +13 -3
- package/dist-sdk/src/entities/agent/to-tf.d.ts +13 -11
- package/dist-sdk/src/entities/agent/to-tf.js +28 -17
- package/dist-sdk/src/entities/agent/tools.d.ts +8 -0
- package/dist-sdk/src/entities/agent/tools.js +6 -2
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.js +2 -2
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +29 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.js +65 -3
- package/dist-sdk/src/entities/agent-tool/types.d.ts +12 -8
- package/dist-sdk/src/entities/agent-tool/types.js +13 -9
- package/dist-sdk/src/entities/app/build.d.ts +11 -0
- package/dist-sdk/src/entities/app/build.js +1 -0
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +11 -7
- package/dist-sdk/src/entities/app/from-tf.js +19 -9
- package/dist-sdk/src/entities/app/to-tf.js +6 -4
- package/dist-sdk/src/entities/automation/build.d.ts +2 -7
- package/dist-sdk/src/entities/automation/build.js +55 -16
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +7 -4
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +7 -11
- package/dist-sdk/src/entities/automation/from-tf.d.ts +23 -1
- package/dist-sdk/src/entities/automation/from-tf.js +456 -34
- package/dist-sdk/src/entities/automation/index.d.ts +1 -1
- package/dist-sdk/src/entities/automation/module.d.ts +22 -2
- package/dist-sdk/src/entities/automation/module.js +273 -58
- package/dist-sdk/src/entities/automation/output-field-types.d.ts +8 -0
- package/dist-sdk/src/entities/automation/output-field-types.js +20 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +24 -2
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +72 -3
- package/dist-sdk/src/entities/automation/run-target.d.ts +59 -0
- package/dist-sdk/src/entities/automation/run-target.js +99 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +9 -0
- package/dist-sdk/src/entities/automation/script-code.js +24 -3
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +16 -0
- package/dist-sdk/src/entities/automation/task-output-labels.js +49 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +20 -8
- package/dist-sdk/src/entities/automation/to-tf.d.ts +8 -3
- package/dist-sdk/src/entities/automation/to-tf.js +171 -58
- package/dist-sdk/src/entities/automation/triggers.d.ts +22 -3
- package/dist-sdk/src/entities/automation/triggers.js +40 -0
- package/dist-sdk/src/entities/automation/types.d.ts +21 -0
- package/dist-sdk/src/entities/automation/types.js +26 -0
- package/dist-sdk/src/entities/dashboard/from-tf.d.ts +11 -1
- package/dist-sdk/src/entities/dashboard/from-tf.js +57 -7
- package/dist-sdk/src/entities/dashboard/to-tf.js +13 -0
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +7 -2
- package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +3 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +65 -19
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +4 -2
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +341 -32
- package/dist-sdk/src/entities/element/build.d.ts +10 -0
- package/dist-sdk/src/entities/element/build.js +1 -0
- package/dist-sdk/src/entities/element/from-tf.js +16 -9
- package/dist-sdk/src/entities/element/to-tf.js +6 -4
- package/dist-sdk/src/entities/field/from-tf.d.ts +24 -0
- package/dist-sdk/src/entities/field/from-tf.js +79 -1
- package/dist-sdk/src/entities/field/module.js +7 -0
- package/dist-sdk/src/entities/field/to-tf.d.ts +30 -1
- package/dist-sdk/src/entities/field/to-tf.js +51 -0
- package/dist-sdk/src/entities/file-reader/module.js +3 -3
- package/dist-sdk/src/entities/file-reader/to-tf.js +3 -3
- package/dist-sdk/src/entities/file-reader/types.d.ts +4 -16
- package/dist-sdk/src/entities/file-reader/types.js +7 -0
- package/dist-sdk/src/entities/org/group.d.ts +1 -0
- package/dist-sdk/src/entities/org/group.js +2 -1
- package/dist-sdk/src/entities/record-create-form/from-tf.d.ts +8 -0
- package/dist-sdk/src/entities/record-create-form/from-tf.js +10 -2
- package/dist-sdk/src/entities/record-create-form/to-tf.d.ts +2 -1
- package/dist-sdk/src/entities/record-create-form/to-tf.js +14 -2
- package/dist-sdk/src/entities/relationship/from-tf.d.ts +8 -0
- package/dist-sdk/src/entities/relationship/from-tf.js +88 -10
- package/dist-sdk/src/entities/relationship/to-tf.d.ts +3 -2
- package/dist-sdk/src/entities/relationship/to-tf.js +79 -8
- package/dist-sdk/src/entities/role/from-tf.js +24 -7
- package/dist-sdk/src/entities/role/to-tf.js +25 -7
- package/dist-sdk/src/entities/service-account/from-tf.js +2 -1
- package/dist-sdk/src/entities/service-account/module.js +15 -0
- package/dist-sdk/src/entities/service-account/to-tf.js +12 -4
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +1 -1
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +12 -7
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +5 -2
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +8 -1
- package/dist-sdk/src/entities/skill/from-tf.js +10 -3
- package/dist-sdk/src/entities/skill/module.js +44 -2
- package/dist-sdk/src/entities/skill/to-tf.d.ts +8 -1
- package/dist-sdk/src/entities/skill/to-tf.js +23 -14
- package/dist-sdk/src/entities/skill/tools.d.ts +8 -0
- package/dist-sdk/src/entities/skill/tools.js +6 -2
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +8 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.js +6 -2
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +10 -2
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +18 -4
- package/dist-sdk/src/entities/view/custom-view-validate.js +6 -5
- package/dist-sdk/src/entities/view/from-tf.d.ts +68 -0
- package/dist-sdk/src/entities/view/from-tf.js +503 -25
- package/dist-sdk/src/entities/view/module.js +15 -0
- package/dist-sdk/src/entities/view/portable.d.ts +11 -0
- package/dist-sdk/src/entities/view/portable.js +47 -0
- package/dist-sdk/src/entities/view/to-tf.d.ts +4 -1
- package/dist-sdk/src/entities/view/to-tf.js +25 -7
- package/dist-sdk/src/entities/view/types.js +1 -1
- package/dist-sdk/src/entities/widget/build.d.ts +4 -3
- package/dist-sdk/src/entities/widget/from-tf.d.ts +3 -0
- package/dist-sdk/src/entities/widget/from-tf.js +100 -3
- package/dist-sdk/src/entities/widget/to-tf.d.ts +16 -1
- package/dist-sdk/src/entities/widget/to-tf.js +77 -14
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +27 -8
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/field-resource-types.d.ts +2 -0
- package/dist-sdk/src/graph/field-resource-types.js +11 -0
- package/dist-sdk/src/graph/index.d.ts +28 -3
- package/dist-sdk/src/graph/index.js +12 -2
- package/dist-sdk/src/graph/types.d.ts +164 -5
- package/package.json +1 -1
|
@@ -24,6 +24,7 @@ import { fieldRefToTfValue } from "../field/to-tf.js";
|
|
|
24
24
|
import { filterToTf as serializeFilterToTf } from "../shared/filters/tf-codec.js";
|
|
25
25
|
import { serviceAccountRefToTf } from "../service-account/to-tf.js";
|
|
26
26
|
import { ACCESS_POLICY_RESOURCE_TYPE } from "./types.js";
|
|
27
|
+
import { describeDroppedEntry, finishMemberList } from "./member-list.js";
|
|
27
28
|
function isFieldToken(v) {
|
|
28
29
|
return typeof v === "object" && v !== null && v.__kind === "field";
|
|
29
30
|
}
|
|
@@ -134,21 +135,22 @@ function resolveForeignOwningApp(item, ctx) {
|
|
|
134
135
|
const resolved = ctx.resolveServiceAccountApp?.(appRefName);
|
|
135
136
|
return resolved === undefined ? undefined : { appRefName, ...resolved };
|
|
136
137
|
}
|
|
137
|
-
export function principalListToTf(items, dataType, where, ctx) {
|
|
138
|
+
export function principalListToTf(items, dataType, where, ctx, kind) {
|
|
138
139
|
if (items === undefined || items.length === 0)
|
|
139
140
|
return undefined;
|
|
140
141
|
const values = [];
|
|
142
|
+
const dropped = [];
|
|
141
143
|
for (const item of items) {
|
|
142
144
|
if (isOrgPrincipalRef(item)) {
|
|
143
145
|
if (ctx.orgRefs === undefined) {
|
|
144
|
-
|
|
146
|
+
dropped.push(`${where}: pulled principal reference requires org context; dropped`);
|
|
145
147
|
}
|
|
146
148
|
else if (item.dataType === "elementum_service_account") {
|
|
147
149
|
// A service account is app-owned, so its data source requires
|
|
148
150
|
// `app_id`. The pulled shape carries only a name, so the owner must be
|
|
149
151
|
// the owning app — an element cannot say which app it meant.
|
|
150
152
|
if (ctx.scope !== "app") {
|
|
151
|
-
|
|
153
|
+
dropped.push(`${where}: pulled service-account reference ${JSON.stringify(item.value)} needs an app owner to supply app_id; dropped`);
|
|
152
154
|
}
|
|
153
155
|
else {
|
|
154
156
|
ctx.orgRefs.rawLookup(item.dataType, item.label, item.value, { app_id: ctx.objectId });
|
|
@@ -162,7 +164,7 @@ export function principalListToTf(items, dataType, where, ctx) {
|
|
|
162
164
|
}
|
|
163
165
|
else if (dataType === "elementum_user" && isUserToken(item)) {
|
|
164
166
|
if (ctx.orgRefs === undefined) {
|
|
165
|
-
|
|
167
|
+
dropped.push(`${where}: userRef requires org context; dropped`);
|
|
166
168
|
}
|
|
167
169
|
else {
|
|
168
170
|
const label = sanitizeName(item.email.split("@", 1)[0] ?? item.email);
|
|
@@ -173,7 +175,7 @@ export function principalListToTf(items, dataType, where, ctx) {
|
|
|
173
175
|
else if (dataType === "elementum_group" && isGroupToken(item)) {
|
|
174
176
|
const resolved = ctx.orgRefs?.byTsLabel("groups", item.refName ?? "");
|
|
175
177
|
if (resolved === undefined) {
|
|
176
|
-
|
|
178
|
+
dropped.push(`${where}: group token "${item.refName}" is not in the org catalog — re-run \`elementum pull org --data-only\``);
|
|
177
179
|
}
|
|
178
180
|
else {
|
|
179
181
|
values.push(expr.dataAttr("elementum_group", resolved.tfLabel, ["id"]));
|
|
@@ -188,10 +190,10 @@ export function principalListToTf(items, dataType, where, ctx) {
|
|
|
188
190
|
? { appRefName: ctx.appRefName, appTfLabel: ctx.ownerTfLabel, appId: ctx.objectId, serviceAccounts: ctx.serviceAccounts }
|
|
189
191
|
: resolveForeignOwningApp(item, ctx);
|
|
190
192
|
if (owning === undefined || ctx.orgRefs === undefined) {
|
|
191
|
-
|
|
193
|
+
dropped.push(`${where}: serviceAccount ${JSON.stringify(item.name ?? "")} cannot resolve its owning app ${JSON.stringify(item.appRefName ?? "")}; dropped`);
|
|
192
194
|
}
|
|
193
195
|
else {
|
|
194
|
-
const value = serviceAccountRefToTf(item, { ...owning, orgRefs: ctx.orgRefs }, where,
|
|
196
|
+
const value = serviceAccountRefToTf(item, { ...owning, orgRefs: ctx.orgRefs }, where, dropped);
|
|
195
197
|
if (value !== undefined)
|
|
196
198
|
values.push(value);
|
|
197
199
|
}
|
|
@@ -200,10 +202,10 @@ export function principalListToTf(items, dataType, where, ctx) {
|
|
|
200
202
|
values.push(item);
|
|
201
203
|
}
|
|
202
204
|
else {
|
|
203
|
-
|
|
205
|
+
dropped.push(`${where}: ${dataType} list item has an unrecognized shape (${describeDroppedEntry(item)}); dropped`);
|
|
204
206
|
}
|
|
205
207
|
}
|
|
206
|
-
return values
|
|
208
|
+
return finishMemberList(where, values, dropped, ctx.diagnostics, kind);
|
|
207
209
|
}
|
|
208
210
|
function accessPolicyTfLabel(ownerTfLabel, index, scope) {
|
|
209
211
|
const childPart = index === 0 ? "access_policy" : `access_policy_${index}`;
|
|
@@ -221,13 +223,20 @@ export function accessPolicyToTf(entry, index, ctx) {
|
|
|
221
223
|
object_id: ctx.objectId,
|
|
222
224
|
filter: entry.filter !== undefined ? filterToTf(entry.filter, where, ctx) : { type: "true" },
|
|
223
225
|
};
|
|
224
|
-
|
|
226
|
+
// `userIds: []` (and the other lists) removes every member, so it must
|
|
227
|
+
// reach the provider as `[]`: an omitted list changes nothing (#2160). A
|
|
228
|
+
// list whose every entry is dropped (each one diagnosed) stays omitted, so
|
|
229
|
+
// apply changes nothing rather than removing every member; a list with only
|
|
230
|
+
// some entries dropped fails the build (edk#2198, finishMemberList).
|
|
231
|
+
const userIds = entry.userIds?.length === 0 ? [] : principalListToTf(entry.userIds, "elementum_user", `${where}.userIds`, ctx);
|
|
225
232
|
if (userIds !== undefined)
|
|
226
233
|
attrs["user_ids"] = userIds;
|
|
227
|
-
const groupIds = principalListToTf(entry.groupIds, "elementum_group", `${where}.groupIds`, ctx);
|
|
234
|
+
const groupIds = entry.groupIds?.length === 0 ? [] : principalListToTf(entry.groupIds, "elementum_group", `${where}.groupIds`, ctx);
|
|
228
235
|
if (groupIds !== undefined)
|
|
229
236
|
attrs["group_ids"] = groupIds;
|
|
230
|
-
const serviceAccountIds =
|
|
237
|
+
const serviceAccountIds = entry.serviceAccountIds?.length === 0
|
|
238
|
+
? []
|
|
239
|
+
: principalListToTf(entry.serviceAccountIds, "elementum_service_account", `${where}.serviceAccountIds`, ctx);
|
|
231
240
|
if (serviceAccountIds !== undefined)
|
|
232
241
|
attrs["service_account_ids"] = serviceAccountIds;
|
|
233
242
|
return {
|
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
* the typed `app` reference, exactly like `automation`.
|
|
14
14
|
*/
|
|
15
15
|
import { slimTokens } from "../../catalog/index.js";
|
|
16
|
-
import { appScopedResourceLabel,
|
|
16
|
+
import { appScopedResourceLabel, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
17
17
|
import { currentValidationMode, currentValidationScope, recordValidations, ValidationFailureError, } from "../../engine/validation.js";
|
|
18
|
+
import { agentToolBareLabel, agentToolLabelSuffixes } from "../agent-tool/to-tf.js";
|
|
18
19
|
import { RUN_AUTOMATION_TOOL_RESOURCE_TYPE } from "../agent-tool/types.js";
|
|
19
20
|
export const agentStartingActionVariableType = {
|
|
20
21
|
number: "NUMBER",
|
|
@@ -74,14 +75,15 @@ function serializeA2ASkill(s) {
|
|
|
74
75
|
* bag-less (paramless automation → undefined) or non-empty, so skipping
|
|
75
76
|
* empty costs no real coverage.
|
|
76
77
|
*/
|
|
77
|
-
function runAutomationToolAddress(appTfLabel, agentRefName, toolName) {
|
|
78
|
+
function runAutomationToolAddress(appTfLabel, agentRefName, toolName, labelSuffix) {
|
|
78
79
|
const agentBare = tsLabelToTfLabel(agentRefName);
|
|
79
|
-
const label = appScopedResourceLabel(appTfLabel,
|
|
80
|
+
const label = appScopedResourceLabel(appTfLabel, agentToolBareLabel(agentBare, toolName, labelSuffix));
|
|
80
81
|
return `${RUN_AUTOMATION_TOOL_RESOURCE_TYPE}.${label}`;
|
|
81
82
|
}
|
|
82
83
|
export function validateAgentTools(agentName, tools, identity) {
|
|
83
84
|
const failures = [];
|
|
84
|
-
|
|
85
|
+
const labelSuffixes = agentToolLabelSuffixes(tsLabelToTfLabel(identity?.agentRefName ?? ""), tools);
|
|
86
|
+
for (const [index, tool] of tools.entries()) {
|
|
85
87
|
const inner = tool["executeWorkflow"];
|
|
86
88
|
if (inner === undefined || typeof inner !== "object")
|
|
87
89
|
continue;
|
|
@@ -94,7 +96,7 @@ export function validateAgentTools(agentName, tools, identity) {
|
|
|
94
96
|
failures.push({
|
|
95
97
|
severity: "fatal",
|
|
96
98
|
address: appTfLabel !== "" && agentRefName !== ""
|
|
97
|
-
? runAutomationToolAddress(appTfLabel, agentRefName, toolName)
|
|
99
|
+
? runAutomationToolAddress(appTfLabel, agentRefName, toolName, labelSuffixes[index] ?? "")
|
|
98
100
|
: `agent.${agentName}`,
|
|
99
101
|
name: agentName,
|
|
100
102
|
ownerKind: "agent",
|
|
@@ -427,6 +427,8 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
|
|
|
427
427
|
const lines = [`${factory}({`];
|
|
428
428
|
lines.push(` name: ${quote(tool.name)},`);
|
|
429
429
|
lines.push(` description: ${quote(tool.description)},`);
|
|
430
|
+
if (tool.labelSuffix !== undefined)
|
|
431
|
+
lines.push(` labelSuffix: ${tool.labelSuffix},`);
|
|
430
432
|
if (tool.startMessage !== undefined)
|
|
431
433
|
lines.push(` startMessage: ${quote(tool.startMessage)},`);
|
|
432
434
|
if (tool.runAs !== undefined)
|
|
@@ -9,9 +9,10 @@
|
|
|
9
9
|
import { typedCoverageGap } from "../../engine/coverage-gaps.js";
|
|
10
10
|
import { EntityTfError } from "../../engine/entity.js";
|
|
11
11
|
import { dataRefLabel, optionalBoolean, optionalString, ownerMismatchBlocker, plainObject, reportAuthoringBlocker, resourceRefLabel } from "../../engine/pull/context.js";
|
|
12
|
-
import { isTfExpr, isUuid, scopedLabelToBagKey, } from "../../engine/tf/index.js";
|
|
12
|
+
import { appScopedResourceLabel, exportLabelSuffix, isTfExpr, isUuid, scopedLabelToBagKey, tsLabelToTfLabel, } from "../../engine/tf/index.js";
|
|
13
13
|
import { a2aSkillFromTf } from "../agent-a2a-skill/from-tf.js";
|
|
14
14
|
import { toolFromTf } from "../agent-tool/from-tf.js";
|
|
15
|
+
import { agentToolBareLabel } from "../agent-tool/to-tf.js";
|
|
15
16
|
import { connectorIdentityFromTf } from "../shared/connector-from-tf.js";
|
|
16
17
|
import { APP_RESOURCE_TYPE } from "../app/module.js";
|
|
17
18
|
import { SKILL_RESOURCE_TYPE } from "../skill/module.js";
|
|
@@ -433,11 +434,20 @@ export function agentFromTf(agentBlock, toolBlocks, appLabel, _appRefName, ctx,
|
|
|
433
434
|
};
|
|
434
435
|
}
|
|
435
436
|
const owner = { appType: APP_RESOURCE_TYPE, appLabel, ownerTfLabel: appLabel, agentType: AGENT_RESOURCE_TYPE, agentLabel: label };
|
|
437
|
+
// Pin the `_N` ei gave each suffixed tool (edk#1987). ei counts in the
|
|
438
|
+
// platform's order, including tools pull doesn't print (unimplemented
|
|
439
|
+
// kinds), and the export file is sorted by resource type, so counting the
|
|
440
|
+
// printed tools again would shift their labels.
|
|
441
|
+
const agentBare = tsLabelToTfLabel(scopedLabelToBagKey(appLabel, label));
|
|
436
442
|
const tools = [];
|
|
437
443
|
for (const block of toolBlocks) {
|
|
438
444
|
const tool = toolFromTf(block, owner, ctx);
|
|
439
|
-
if (tool
|
|
440
|
-
|
|
445
|
+
if (tool === undefined)
|
|
446
|
+
continue;
|
|
447
|
+
const labelSuffix = block.label === undefined
|
|
448
|
+
? undefined
|
|
449
|
+
: exportLabelSuffix(appScopedResourceLabel(appLabel, agentToolBareLabel(agentBare, tool.name, "")), block.label);
|
|
450
|
+
tools.push(labelSuffix === undefined ? tool : { ...tool, labelSuffix });
|
|
441
451
|
}
|
|
442
452
|
const a2aSkills = [];
|
|
443
453
|
for (const block of a2aSkillBlocks) {
|
|
@@ -53,17 +53,19 @@ export interface AgentToTfResult {
|
|
|
53
53
|
* first occurrence of a sanitized name the bare label, each later
|
|
54
54
|
* occurrence `_1`, `_2`, …
|
|
55
55
|
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
56
|
+
* The order is shared with ei: agent name by UTF-16 code unit, then (for
|
|
57
|
+
* identical names) refName here and the agent's own label in ei, whose `_N`
|
|
58
|
+
* tails sort alike. The Go comparator is in the a2a loop of
|
|
59
|
+
* `cmd/elementum/export/imports.go` (`compareUTF16`, `agentChildParts`),
|
|
60
|
+
* and the two must stay in sync; changing one without the other moves
|
|
61
|
+
* `agent_id` and replaces skills on the first plan after a pull (edk#1728).
|
|
62
|
+
* Before edk#1728 ei walked agents in id order.
|
|
63
|
+
*
|
|
64
|
+
* The 2026-08-18 two-agent live capture ("Default agent 2" at the bare
|
|
65
|
+
* label, "test agent" at `_1`) is not evidence for name order: id order
|
|
66
|
+
* and name order happened to agree there, which edk#1728 disproved. The
|
|
67
|
+
* contract above is what fixes the order.
|
|
68
|
+
*
|
|
67
69
|
* Ordering of a2a skills WITHIN one agent is still assumed to be authored
|
|
68
70
|
* array order, unconfirmed live either way.
|
|
69
71
|
*
|
|
@@ -20,7 +20,7 @@ import { workspaceAspectKey } from "../../engine/build/context.js";
|
|
|
20
20
|
import { EntityTfError } from "../../engine/entity.js";
|
|
21
21
|
import { appScopedResourceLabel, expr, sanitizeName, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
22
22
|
import { a2aSkillToTf } from "../agent-a2a-skill/to-tf.js";
|
|
23
|
-
import { toolToTf } from "../agent-tool/to-tf.js";
|
|
23
|
+
import { agentToolLabelSuffixes, assertUniqueToolAddresses, toolName, toolToTf } from "../agent-tool/to-tf.js";
|
|
24
24
|
import { APP_RESOURCE_TYPE } from "../app/module.js";
|
|
25
25
|
import { CONNECTOR_ORG_BAG } from "../org/connector.js";
|
|
26
26
|
import { resolveForeignRef } from "../shared/foreign-ref.js";
|
|
@@ -255,17 +255,19 @@ function toSortableAgents(entities) {
|
|
|
255
255
|
* first occurrence of a sanitized name the bare label, each later
|
|
256
256
|
* occurrence `_1`, `_2`, …
|
|
257
257
|
*
|
|
258
|
-
*
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
258
|
+
* The order is shared with ei: agent name by UTF-16 code unit, then (for
|
|
259
|
+
* identical names) refName here and the agent's own label in ei, whose `_N`
|
|
260
|
+
* tails sort alike. The Go comparator is in the a2a loop of
|
|
261
|
+
* `cmd/elementum/export/imports.go` (`compareUTF16`, `agentChildParts`),
|
|
262
|
+
* and the two must stay in sync; changing one without the other moves
|
|
263
|
+
* `agent_id` and replaces skills on the first plan after a pull (edk#1728).
|
|
264
|
+
* Before edk#1728 ei walked agents in id order.
|
|
265
|
+
*
|
|
266
|
+
* The 2026-08-18 two-agent live capture ("Default agent 2" at the bare
|
|
267
|
+
* label, "test agent" at `_1`) is not evidence for name order: id order
|
|
268
|
+
* and name order happened to agree there, which edk#1728 disproved. The
|
|
269
|
+
* contract above is what fixes the order.
|
|
270
|
+
*
|
|
269
271
|
* Ordering of a2a skills WITHIN one agent is still assumed to be authored
|
|
270
272
|
* array order, unconfirmed live either way.
|
|
271
273
|
*
|
|
@@ -281,7 +283,10 @@ function toSortableAgents(entities) {
|
|
|
281
283
|
* the #294 case this disambiguates.
|
|
282
284
|
*/
|
|
283
285
|
export function computeA2ASkillLabelSuffixes(siblingAgents) {
|
|
284
|
-
|
|
286
|
+
// Ties (identical agent names) break on refName, whose `_N` tail is the
|
|
287
|
+
// export label's; ei breaks them on that label (edk#1728).
|
|
288
|
+
const order = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
|
|
289
|
+
const sorted = toSortableAgents(siblingAgents).sort((a, b) => order(a.name, b.name) || order(a.refName, b.refName));
|
|
285
290
|
const counts = new Map();
|
|
286
291
|
const suffixes = new Map();
|
|
287
292
|
for (const agent of sorted) {
|
|
@@ -465,11 +470,14 @@ export function agentToTf(entity, ctx) {
|
|
|
465
470
|
attrs["skill_access_config"] = skillAccessValue;
|
|
466
471
|
}
|
|
467
472
|
const blocks = [{ kind: "resource", type: AGENT_RESOURCE_TYPE, label: tfLabel, attrs }];
|
|
468
|
-
|
|
473
|
+
const toolLabelSuffixes = agentToolLabelSuffixes(agentBareTfLabel, payload.tools ?? []);
|
|
474
|
+
const toolAddresses = [];
|
|
475
|
+
(payload.tools ?? []).forEach((entry, index) => {
|
|
469
476
|
const tool = toolToTf(entry, {
|
|
470
477
|
appRefName: ctx.appRefName,
|
|
471
478
|
appTfLabel: ctx.appTfLabel,
|
|
472
479
|
agentBareTfLabel,
|
|
480
|
+
labelSuffix: toolLabelSuffixes[index] ?? "",
|
|
473
481
|
activeAutomationRefNames: ctx.activeAutomationRefNames,
|
|
474
482
|
foreignAppRef: (l, n, ns) => ctx.orgRefs.foreignApp(l, n, ns),
|
|
475
483
|
foreignElementRef: (l, n, ns) => ctx.orgRefs.foreignElement(l, n, ns),
|
|
@@ -503,9 +511,12 @@ export function agentToTf(entity, ctx) {
|
|
|
503
511
|
},
|
|
504
512
|
diagnostics: ctx.diagnostics,
|
|
505
513
|
});
|
|
506
|
-
if (tool
|
|
507
|
-
|
|
508
|
-
|
|
514
|
+
if (tool === undefined)
|
|
515
|
+
return;
|
|
516
|
+
toolAddresses.push({ name: toolName(entry), address: tool.address });
|
|
517
|
+
blocks.push(tool.block);
|
|
518
|
+
});
|
|
519
|
+
assertUniqueToolAddresses(where, toolAddresses);
|
|
509
520
|
// Board issue #294: two agents in the same app can legitimately both
|
|
510
521
|
// author an a2a skill with the same display name — ei's own exporter
|
|
511
522
|
// disambiguates that case with a numeric suffix rather than rejecting it
|
|
@@ -153,6 +153,14 @@ interface CommonToolOptions {
|
|
|
153
153
|
readonly description: string;
|
|
154
154
|
readonly startMessage?: string;
|
|
155
155
|
readonly runAs?: AgentToolRunAs;
|
|
156
|
+
/**
|
|
157
|
+
* Pins the `_N` on this tool's terraform label, for a tool whose name shares
|
|
158
|
+
* a label with others (`a-b`, `a_b`, `aB`). Pull writes it when ei's export
|
|
159
|
+
* gave the tool a suffix; keep it, or the tool's address changes. Without
|
|
160
|
+
* it, a colliding tool takes the lowest free `_N` in tool order. Never sent
|
|
161
|
+
* to the platform. A whole number from 1 to `Number.MAX_SAFE_INTEGER`.
|
|
162
|
+
*/
|
|
163
|
+
readonly labelSuffix?: number;
|
|
156
164
|
}
|
|
157
165
|
export type SearchRecordsToolOptions<Target extends ToolTarget = ToolTarget> = CommonToolOptions & TargetOption<Target> & {
|
|
158
166
|
readonly queryDescription: string;
|
|
@@ -32,11 +32,15 @@ function common(opts) {
|
|
|
32
32
|
// Every tool factory routes through here, so this is the single enforcement
|
|
33
33
|
// point — the tf passes never re-check.
|
|
34
34
|
if (!isValidToolName(opts.name)) {
|
|
35
|
-
throw new Error(`agent tool name "${opts.name}" must be 1–64 characters of letters, digits,
|
|
36
|
-
`
|
|
35
|
+
throw new Error(`agent tool name "${opts.name}" must be 1–64 characters of letters, digits, underscores, ` +
|
|
36
|
+
`and hyphens (A–Z, a–z, 0–9, _, -) with no consecutive underscores — no spaces.`);
|
|
37
|
+
}
|
|
38
|
+
if (opts.labelSuffix !== undefined && (!Number.isSafeInteger(opts.labelSuffix) || opts.labelSuffix < 1)) {
|
|
39
|
+
throw new Error(`agent tool "${opts.name}" labelSuffix must be a whole number from 1 to Number.MAX_SAFE_INTEGER; got ${String(opts.labelSuffix)}.`);
|
|
37
40
|
}
|
|
38
41
|
return {
|
|
39
42
|
name: opts.name,
|
|
43
|
+
...(opts.labelSuffix !== undefined ? { labelSuffix: opts.labelSuffix } : {}),
|
|
40
44
|
description: opts.description,
|
|
41
45
|
...(opts.startMessage !== undefined ? { startMessage: opts.startMessage } : {}),
|
|
42
46
|
...(opts.runAs !== undefined ? { runAs: serializeRunAs(opts.runAs) } : {}),
|
|
@@ -99,6 +99,8 @@ export interface NormalizedAgentTool {
|
|
|
99
99
|
readonly name: string;
|
|
100
100
|
readonly description: string;
|
|
101
101
|
readonly startMessage?: string;
|
|
102
|
+
/** The `_N` ei gave this tool's label (edk#1987); see the builders' `labelSuffix`. */
|
|
103
|
+
readonly labelSuffix?: number;
|
|
102
104
|
readonly runAs?: AgentToolRunAs;
|
|
103
105
|
/** absent for executeWorkflow — its target is an automation, not an aspect. searchTable's target is also optional. */
|
|
104
106
|
readonly target?: NormalizedToolTarget;
|
|
@@ -452,7 +452,7 @@ function executeWorkflowFromTf(block, name, where, owner, ctx) {
|
|
|
452
452
|
}
|
|
453
453
|
inputs.push({
|
|
454
454
|
parameterName: rec["parameter_name"],
|
|
455
|
-
...(typeof rec["
|
|
455
|
+
...(typeof rec["display_name"] === "string" && { name: rec["display_name"] }),
|
|
456
456
|
...(typeof rec["description"] === "string" && { description: rec["description"] }),
|
|
457
457
|
...(typeof rec["required"] === "boolean" && { required: rec["required"] }),
|
|
458
458
|
});
|
|
@@ -466,7 +466,7 @@ function executeWorkflowFromTf(block, name, where, owner, ctx) {
|
|
|
466
466
|
}
|
|
467
467
|
outputs.push({
|
|
468
468
|
workflowPropertyName: rec["workflow_property_name"],
|
|
469
|
-
...(typeof rec["
|
|
469
|
+
...(typeof rec["display_name"] === "string" && { name: rec["display_name"] }),
|
|
470
470
|
...(typeof rec["description"] === "string" && { description: rec["description"] }),
|
|
471
471
|
});
|
|
472
472
|
}
|
|
@@ -20,6 +20,8 @@ export interface ToolToTfContext {
|
|
|
20
20
|
readonly appTfLabel: string;
|
|
21
21
|
/** The owning agent's bare tfLabel (before apps_ prefix). */
|
|
22
22
|
readonly agentBareTfLabel: string;
|
|
23
|
+
/** `_N` from {@link agentToolLabelSuffixes} when this tool's label collides with an earlier sibling's. */
|
|
24
|
+
readonly labelSuffix?: string;
|
|
23
25
|
/** Records a foreign-app data lookup for data.tf; returns its tfLabel. */
|
|
24
26
|
foreignAppRef(tfLabel: string, name: string, namespace?: string): void;
|
|
25
27
|
/** Records a foreign-ELEMENT data lookup for data.tf (board issue #42). */
|
|
@@ -55,6 +57,33 @@ export interface ToolToTfResult {
|
|
|
55
57
|
/** `<resourceType>.<tfLabel>` — bookkeeping for the agent catalog. */
|
|
56
58
|
readonly address: string;
|
|
57
59
|
}
|
|
60
|
+
/** An agent tool's bare label: `sanitizeName(<agent>_<tool name>)` plus its collision suffix. */
|
|
61
|
+
export declare function agentToolBareLabel(agentBareTfLabel: string, toolName: string, labelSuffix: string): string;
|
|
62
|
+
/**
|
|
63
|
+
* `_N` suffixes, by tool index, for one agent's tools whose labels collide
|
|
64
|
+
* (`a-b` and `a_b` both sanitize to `a_b`), with one counter across tool
|
|
65
|
+
* kinds as in ei's export (`GenerateImportBlocks`, `toolNames` in
|
|
66
|
+
* imports.go). A tool with `labelSuffix` keeps that `_N`; the others take the
|
|
67
|
+
* lowest free count in tool order (`collisionLabelSuffixes`), so an unpinned
|
|
68
|
+
* tool's order is part of its address. Pull pins every tool ei suffixed
|
|
69
|
+
* (agentFromTf), so a pulled agent rebuilds its exported labels even when ei
|
|
70
|
+
* counted a tool pull doesn't print. Every known tool kind counts, implemented
|
|
71
|
+
* or not, as in ei. Parity holds within one agent only: ei's counter spans
|
|
72
|
+
* the whole app and is keyed on the agent's display name (edk#2000).
|
|
73
|
+
*/
|
|
74
|
+
export declare function agentToolLabelSuffixes(agentBareTfLabel: string, tools: readonly Record<string, unknown>[]): readonly string[];
|
|
75
|
+
/** A tool entry's (`{ createRecord: { name, ... } }`) platform name, or "". */
|
|
76
|
+
export declare function toolName(entry: Record<string, unknown>): string;
|
|
77
|
+
/**
|
|
78
|
+
* Fail the build when two of one owner's tools land on one resource address
|
|
79
|
+
* (`a-b`, `a_b` and `a_b_1` of one kind: the second gets `_1`, the third is
|
|
80
|
+
* `a_b_1` already). OpenTofu would reject the duplicate only at plan, so name
|
|
81
|
+
* both tools here instead (edk#1987).
|
|
82
|
+
*/
|
|
83
|
+
export declare function assertUniqueToolAddresses(owner: string, tools: readonly {
|
|
84
|
+
readonly name: string;
|
|
85
|
+
readonly address: string;
|
|
86
|
+
}[]): void;
|
|
58
87
|
/**
|
|
59
88
|
* One authored tool entry (`{ createRecord: {...} }`) → its resource block;
|
|
60
89
|
* undefined = degraded with a diagnostic (unimplemented sub-type, missing
|
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
* `data.elementum_field` lookup when the typed target is foreign.
|
|
14
14
|
*/
|
|
15
15
|
import { workspaceAspectKey } from "../../engine/build/context.js";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
16
|
+
import { EntityTfError } from "../../engine/entity.js";
|
|
17
|
+
import { automationRunTargetResourceAttr } from "../automation/run-target.js";
|
|
18
|
+
import { appScopedResourceLabel, collisionLabelSuffixes, expr, sanitizeName, scopedResourceLabel, stableIdSuffix, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
18
19
|
import { authoredFieldKeysFromPayload, fieldRefToTfValue, } from "../field/to-tf.js";
|
|
19
20
|
import { foreignFieldDataLabel } from "../shared/foreign-ref.js";
|
|
20
21
|
import { encodeOptionalHandleDescription } from "../shared/handle-description.js";
|
|
@@ -164,6 +165,58 @@ function fieldRefValue(token, where, ctx, target) {
|
|
|
164
165
|
}
|
|
165
166
|
return value;
|
|
166
167
|
}
|
|
168
|
+
/** An agent tool's bare label: `sanitizeName(<agent>_<tool name>)` plus its collision suffix. */
|
|
169
|
+
export function agentToolBareLabel(agentBareTfLabel, toolName, labelSuffix) {
|
|
170
|
+
return `${sanitizeName(`${agentBareTfLabel}_${toolName}`)}${labelSuffix}`;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* `_N` suffixes, by tool index, for one agent's tools whose labels collide
|
|
174
|
+
* (`a-b` and `a_b` both sanitize to `a_b`), with one counter across tool
|
|
175
|
+
* kinds as in ei's export (`GenerateImportBlocks`, `toolNames` in
|
|
176
|
+
* imports.go). A tool with `labelSuffix` keeps that `_N`; the others take the
|
|
177
|
+
* lowest free count in tool order (`collisionLabelSuffixes`), so an unpinned
|
|
178
|
+
* tool's order is part of its address. Pull pins every tool ei suffixed
|
|
179
|
+
* (agentFromTf), so a pulled agent rebuilds its exported labels even when ei
|
|
180
|
+
* counted a tool pull doesn't print. Every known tool kind counts, implemented
|
|
181
|
+
* or not, as in ei. Parity holds within one agent only: ei's counter spans
|
|
182
|
+
* the whole app and is keyed on the agent's display name (edk#2000).
|
|
183
|
+
*/
|
|
184
|
+
export function agentToolLabelSuffixes(agentBareTfLabel, tools) {
|
|
185
|
+
return collisionLabelSuffixes(tools.map((entry) => {
|
|
186
|
+
const typeKey = Object.keys(entry)[0];
|
|
187
|
+
if (typeKey === undefined || !TOOL_SUB_TYPE_BY_TYPE_KEY.has(typeKey))
|
|
188
|
+
return undefined;
|
|
189
|
+
const inner = entry[typeKey];
|
|
190
|
+
return {
|
|
191
|
+
base: sanitizeName(`${agentBareTfLabel}_${inner?.name ?? ""}`),
|
|
192
|
+
...(inner?.labelSuffix !== undefined && { pinned: inner.labelSuffix }),
|
|
193
|
+
};
|
|
194
|
+
}));
|
|
195
|
+
}
|
|
196
|
+
/** A tool entry's (`{ createRecord: { name, ... } }`) platform name, or "". */
|
|
197
|
+
export function toolName(entry) {
|
|
198
|
+
const typeKey = Object.keys(entry)[0];
|
|
199
|
+
const inner = typeKey === undefined ? undefined : entry[typeKey];
|
|
200
|
+
return typeof inner?.name === "string" ? inner.name : "";
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Fail the build when two of one owner's tools land on one resource address
|
|
204
|
+
* (`a-b`, `a_b` and `a_b_1` of one kind: the second gets `_1`, the third is
|
|
205
|
+
* `a_b_1` already). OpenTofu would reject the duplicate only at plan, so name
|
|
206
|
+
* both tools here instead (edk#1987).
|
|
207
|
+
*/
|
|
208
|
+
export function assertUniqueToolAddresses(owner, tools) {
|
|
209
|
+
const seen = new Map();
|
|
210
|
+
for (const tool of tools) {
|
|
211
|
+
const other = seen.get(tool.address);
|
|
212
|
+
if (other !== undefined) {
|
|
213
|
+
throw new EntityTfError(`${owner}: tools ${JSON.stringify(other)} and ${JSON.stringify(tool.name)} both get the address ${tool.address} ` +
|
|
214
|
+
`(names that differ only in hyphens, underscores or case share a label; a colliding tool's _N comes from its labelSuffix or, without one, its tool order). ` +
|
|
215
|
+
`Rename one of them.`);
|
|
216
|
+
}
|
|
217
|
+
seen.set(tool.address, tool.name);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
167
220
|
/**
|
|
168
221
|
* One authored tool entry (`{ createRecord: {...} }`) → its resource block;
|
|
169
222
|
* undefined = degraded with a diagnostic (unimplemented sub-type, missing
|
|
@@ -191,7 +244,7 @@ export function toolToTf(entry, ctx) {
|
|
|
191
244
|
}
|
|
192
245
|
const where = `agent tool "${name}"`;
|
|
193
246
|
const agentTfLabel = appScopedResourceLabel(ctx.appTfLabel, ctx.agentBareTfLabel);
|
|
194
|
-
const tfLabel = appScopedResourceLabel(ctx.appTfLabel,
|
|
247
|
+
const tfLabel = appScopedResourceLabel(ctx.appTfLabel, agentToolBareLabel(ctx.agentBareTfLabel, name, ctx.labelSuffix ?? ""));
|
|
195
248
|
const attrs = {
|
|
196
249
|
agent_id: expr.resourceAttr("elementum_agent", agentTfLabel, ["id"]),
|
|
197
250
|
app_id: expr.resourceAttr("elementum_app", ctx.appTfLabel, ["id"]),
|
|
@@ -255,6 +308,12 @@ export function toolToTf(entry, ctx) {
|
|
|
255
308
|
if (inner.inputs !== undefined && inner.inputs.length > 0) {
|
|
256
309
|
attrs["inputs"] = inner.inputs.map((i) => ({
|
|
257
310
|
parameter_name: i.triggerParameterId?.name ?? "",
|
|
311
|
+
// The provider reads display_name back only when the agent-facing
|
|
312
|
+
// name differs from the parameter name (null otherwise), so emit it
|
|
313
|
+
// under the same rule or the plan drops the rename (#1734).
|
|
314
|
+
...(i.name !== undefined &&
|
|
315
|
+
i.name !== "" &&
|
|
316
|
+
i.name !== i.triggerParameterId?.name && { display_name: i.name }),
|
|
258
317
|
...(i.description !== undefined && i.description !== "" && { description: i.description }),
|
|
259
318
|
...(i.required !== undefined && { required: i.required }),
|
|
260
319
|
}));
|
|
@@ -262,6 +321,9 @@ export function toolToTf(entry, ctx) {
|
|
|
262
321
|
if (inner.outputs !== undefined && inner.outputs.length > 0) {
|
|
263
322
|
attrs["outputs"] = inner.outputs.map((o) => ({
|
|
264
323
|
workflow_property_name: o.workflowPropertyName ?? "",
|
|
324
|
+
...(o.name !== undefined &&
|
|
325
|
+
o.name !== "" &&
|
|
326
|
+
o.name !== o.workflowPropertyName && { display_name: o.name }),
|
|
265
327
|
...(o.description !== undefined && o.description !== "" && { description: o.description }),
|
|
266
328
|
}));
|
|
267
329
|
}
|
|
@@ -28,14 +28,18 @@ export declare const IMPLEMENTED_TOOL_RESOURCE_TYPES: readonly string[];
|
|
|
28
28
|
export declare const ALL_TOOL_RESOURCE_TYPES: readonly string[];
|
|
29
29
|
/**
|
|
30
30
|
* EDK's tool-name rule — enforced in the authoring builders (see
|
|
31
|
-
* `entities/agent/tools.ts`), never in the tf
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* the
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
31
|
+
* `entities/agent/tools.ts` and `entities/skill/tools.ts`), never in the tf
|
|
32
|
+
* passes. It is the platform's own rule: 1–64 chars of letters, digits,
|
|
33
|
+
* underscores, and hyphens (`[A-Za-z0-9_-]`); no spaces; no consecutive
|
|
34
|
+
* underscores (the platform rejects those, opaquely). Hyphens are allowed
|
|
35
|
+
* because the platform mints them itself — its skill generator names a lookup
|
|
36
|
+
* tool `resolve_<label>` cut to 55 chars plus `-<8 hex>` — and pull prints the
|
|
37
|
+
* live name verbatim, so a stricter rule makes a pulled file fail to load
|
|
38
|
+
* (edk#1987). The name is sent to the platform verbatim; the terraform label is
|
|
39
|
+
* `sanitizeName(name)` (hyphens become underscores, the same as ei's export
|
|
40
|
+
* `SanitizeName`), and names that sanitize to one label get `_N` suffixes from
|
|
41
|
+
* a pinned `labelSuffix` or tool order (`computeToolLabelSuffixes`,
|
|
42
|
+
* `agentToolLabelSuffixes`).
|
|
39
43
|
*/
|
|
40
44
|
export declare function isValidToolName(name: string): boolean;
|
|
41
45
|
export declare const KNOWN_TOOL_ATTRS: Readonly<Record<string, ReadonlySet<string>>>;
|
|
@@ -29,17 +29,21 @@ export const IMPLEMENTED_TOOL_RESOURCE_TYPES = AGENT_TOOL_SUB_TYPES.filter((t) =
|
|
|
29
29
|
export const ALL_TOOL_RESOURCE_TYPES = AGENT_TOOL_SUB_TYPES.map((t) => t.resourceType);
|
|
30
30
|
/**
|
|
31
31
|
* EDK's tool-name rule — enforced in the authoring builders (see
|
|
32
|
-
* `entities/agent/tools.ts`), never in the tf
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* the
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
32
|
+
* `entities/agent/tools.ts` and `entities/skill/tools.ts`), never in the tf
|
|
33
|
+
* passes. It is the platform's own rule: 1–64 chars of letters, digits,
|
|
34
|
+
* underscores, and hyphens (`[A-Za-z0-9_-]`); no spaces; no consecutive
|
|
35
|
+
* underscores (the platform rejects those, opaquely). Hyphens are allowed
|
|
36
|
+
* because the platform mints them itself — its skill generator names a lookup
|
|
37
|
+
* tool `resolve_<label>` cut to 55 chars plus `-<8 hex>` — and pull prints the
|
|
38
|
+
* live name verbatim, so a stricter rule makes a pulled file fail to load
|
|
39
|
+
* (edk#1987). The name is sent to the platform verbatim; the terraform label is
|
|
40
|
+
* `sanitizeName(name)` (hyphens become underscores, the same as ei's export
|
|
41
|
+
* `SanitizeName`), and names that sanitize to one label get `_N` suffixes from
|
|
42
|
+
* a pinned `labelSuffix` or tool order (`computeToolLabelSuffixes`,
|
|
43
|
+
* `agentToolLabelSuffixes`).
|
|
40
44
|
*/
|
|
41
45
|
export function isValidToolName(name) {
|
|
42
|
-
return /^[A-Za-z0-9_]{1,64}$/.test(name) && !name.includes("__");
|
|
46
|
+
return /^[A-Za-z0-9_-]{1,64}$/.test(name) && !name.includes("__");
|
|
43
47
|
}
|
|
44
48
|
/** Attributes `toolFromTf` understands per implemented sub-type — growth is reported loudly. */
|
|
45
49
|
const COMMON_TOOL_ATTRS = ["agent_id", "app_id", "name", "description", "start_message", "run_as", "service_account_id"];
|
|
@@ -550,6 +550,17 @@ interface AppV2OptionsBase<F extends Record<string, AppField> = Record<string, A
|
|
|
550
550
|
readonly relationships?: Readonly<Record<string, AppRelationship>>;
|
|
551
551
|
/** Display order of all authored views (by key). Defaults to declaration order by view bag. */
|
|
552
552
|
readonly viewOrder?: readonly string[];
|
|
553
|
+
/**
|
|
554
|
+
* Delete the platform's default "List" view (the LIST-type view named
|
|
555
|
+
* "List" the platform creates on every app and element), so the first entry
|
|
556
|
+
* of `viewOrder` is the main surface. The delete runs once: when the view
|
|
557
|
+
* order is created with it set, or when it changes from unset/`false` to
|
|
558
|
+
* `true`; later applies, including reorders, never delete a view. The plan
|
|
559
|
+
* warns with the view's id and name, and fails if several views qualify.
|
|
560
|
+
* Omitting it means `false` (nothing is deleted). `elementum new app` sets
|
|
561
|
+
* it. No declared view may be named "List".
|
|
562
|
+
*/
|
|
563
|
+
readonly deleteDefaultListView?: boolean;
|
|
553
564
|
/**
|
|
554
565
|
* App-level sharing & row-level-security policies (`elementum_access_policy`), in declaration order.
|
|
555
566
|
* Creating the app also has the platform mint a separate creator policy
|
|
@@ -588,6 +588,7 @@ export function app(opts) {
|
|
|
588
588
|
...(opts.dynamicLayouts !== undefined ? { dynamicLayouts: opts.dynamicLayouts } : {}),
|
|
589
589
|
...(opts.relationships !== undefined ? { relationships: opts.relationships } : {}),
|
|
590
590
|
...(opts.viewOrder !== undefined ? { viewOrder: opts.viewOrder } : {}),
|
|
591
|
+
...(opts.deleteDefaultListView !== undefined ? { deleteDefaultListView: opts.deleteDefaultListView } : {}),
|
|
591
592
|
...(opts.accessPolicies !== undefined ? { accessPolicies: opts.accessPolicies } : {}),
|
|
592
593
|
...(opts.roles !== undefined ? { roles: opts.roles } : {}),
|
|
593
594
|
...(opts.serviceAccounts !== undefined ? { serviceAccounts: opts.serviceAccounts } : {}),
|