@elementumai/edk 0.9.7 → 0.9.9
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 +3 -2
- package/dist-sdk/src/catalog/factories.d.ts +14 -3
- package/dist-sdk/src/catalog/factories.js +32 -0
- package/dist-sdk/src/catalog/from-authoring.js +27 -33
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +2 -2
- package/dist-sdk/src/catalog/org.js +67 -29
- package/dist-sdk/src/catalog/token.js +10 -0
- package/dist-sdk/src/catalog/types.d.ts +20 -2
- package/dist-sdk/src/catalog/types.js +5 -0
- package/dist-sdk/src/core/index.d.ts +1 -1
- package/dist-sdk/src/core/index.js +1 -1
- package/dist-sdk/src/core/platform-id.d.ts +2 -0
- package/dist-sdk/src/core/platform-id.js +4 -0
- package/dist-sdk/src/core/system-fields.d.ts +14 -0
- package/dist-sdk/src/core/system-fields.js +6 -0
- package/dist-sdk/src/core/triggers/on-demand.d.ts +27 -24
- package/dist-sdk/src/core/triggers/on-demand.js +33 -12
- package/dist-sdk/src/core/types/aspect-category.d.ts +1 -0
- package/dist-sdk/src/core/types/aspect-category.js +1 -0
- package/dist-sdk/src/engine/build/context.d.ts +20 -8
- package/dist-sdk/src/engine/build/source-context.d.ts +14 -17
- package/dist-sdk/src/engine/build/source-context.js +1 -1
- package/dist-sdk/src/engine/pull/context.d.ts +9 -0
- package/dist-sdk/src/engine/pull/org.d.ts +4 -0
- package/dist-sdk/src/engine/pull/org.js +17 -2
- package/dist-sdk/src/engine/pull/procedure-refs.d.ts +16 -0
- package/dist-sdk/src/engine/pull/procedure-refs.js +69 -0
- package/dist-sdk/src/engine/tf/expr.js +1 -1
- package/dist-sdk/src/engine/workspace/authoring-layout.d.ts +15 -0
- package/dist-sdk/src/engine/workspace/authoring-layout.js +33 -1
- package/dist-sdk/src/engine/workspace/loader.d.ts +40 -0
- package/dist-sdk/src/engine/workspace/loader.js +328 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +4 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +10 -2
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +7 -2
- package/dist-sdk/src/entities/agent/build.d.ts +54 -8
- package/dist-sdk/src/entities/agent/build.js +36 -1
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +126 -2
- package/dist-sdk/src/entities/agent/from-tf.d.ts +7 -6
- package/dist-sdk/src/entities/agent/from-tf.js +176 -5
- package/dist-sdk/src/entities/agent/index.d.ts +2 -2
- package/dist-sdk/src/entities/agent/index.js +1 -1
- package/dist-sdk/src/entities/agent/to-tf.d.ts +4 -4
- package/dist-sdk/src/entities/agent/to-tf.js +185 -11
- package/dist-sdk/src/entities/agent/tools.d.ts +16 -5
- package/dist-sdk/src/entities/agent/tools.js +13 -1
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +7 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.js +29 -4
- package/dist-sdk/src/entities/agent-tool/to-tf.js +10 -9
- package/dist-sdk/src/entities/agent-tool/types.js +1 -0
- package/dist-sdk/src/entities/app/build.d.ts +2 -2
- package/dist-sdk/src/entities/app/build.js +6 -3
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +5 -0
- package/dist-sdk/src/entities/app/display-blocks-to-layout.d.ts +45 -0
- package/dist-sdk/src/entities/app/display-blocks-to-layout.js +98 -0
- package/dist-sdk/src/entities/app/display-blocks-to-record-create-form.d.ts +55 -0
- package/dist-sdk/src/entities/app/display-blocks-to-record-create-form.js +99 -0
- package/dist-sdk/src/entities/app/from-tf.js +9 -7
- package/dist-sdk/src/entities/app/to-tf.js +15 -7
- package/dist-sdk/src/entities/automation/build.d.ts +8 -1
- package/dist-sdk/src/entities/automation/build.js +36 -5
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +3 -7
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +2 -0
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +77 -8
- package/dist-sdk/src/entities/automation/from-tf.d.ts +10 -1
- package/dist-sdk/src/entities/automation/from-tf.js +803 -62
- package/dist-sdk/src/entities/automation/index.d.ts +1 -1
- package/dist-sdk/src/entities/automation/module.js +13 -3
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +12 -4
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +17 -6
- package/dist-sdk/src/entities/automation/script-code.d.ts +1 -1
- package/dist-sdk/src/entities/automation/script-code.js +15 -11
- package/dist-sdk/src/entities/automation/task-label.d.ts +2 -0
- package/dist-sdk/src/entities/automation/task-label.js +18 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +60 -9
- package/dist-sdk/src/entities/automation/tasks.js +16 -4
- package/dist-sdk/src/entities/automation/to-tf.d.ts +4 -0
- package/dist-sdk/src/entities/automation/to-tf.js +385 -52
- package/dist-sdk/src/entities/automation/triggers.d.ts +14 -5
- package/dist-sdk/src/entities/automation/triggers.js +1 -1
- package/dist-sdk/src/entities/dashboard/from-tf.js +1 -1
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +1 -1
- package/dist-sdk/src/entities/element/build.d.ts +30 -7
- package/dist-sdk/src/entities/element/build.js +6 -3
- package/dist-sdk/src/entities/element/from-tf.js +7 -3
- package/dist-sdk/src/entities/element/index.d.ts +1 -1
- package/dist-sdk/src/entities/element/index.js +1 -1
- package/dist-sdk/src/entities/element/to-tf.js +49 -8
- package/dist-sdk/src/entities/field/from-tf.d.ts +6 -0
- package/dist-sdk/src/entities/field/from-tf.js +12 -0
- package/dist-sdk/src/entities/field/module.js +1 -0
- package/dist-sdk/src/entities/field/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/field/to-tf.js +19 -5
- package/dist-sdk/src/entities/org/category-ref.d.ts +5 -0
- package/dist-sdk/src/entities/org/category-ref.js +12 -0
- package/dist-sdk/src/entities/record-create-form/from-tf.js +3 -3
- package/dist-sdk/src/entities/record-create-form/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/record-create-form/to-tf.js +13 -5
- package/dist-sdk/src/entities/relationship/from-tf.js +15 -4
- package/dist-sdk/src/entities/role/from-tf.js +10 -4
- package/dist-sdk/src/entities/search-table/build.d.ts +1 -1
- package/dist-sdk/src/entities/search-table/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/search-table/from-tf.js +6 -0
- package/dist-sdk/src/entities/search-table/printer.js +3 -1
- package/dist-sdk/src/entities/search-table/to-tf.js +3 -3
- package/dist-sdk/src/entities/search-table/types.js +1 -0
- package/dist-sdk/src/entities/service-account/from-tf.js +10 -4
- package/dist-sdk/src/entities/service-account/to-tf.d.ts +2 -1
- package/dist-sdk/src/entities/service-account/to-tf.js +7 -0
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +7 -1
- package/dist-sdk/src/entities/shared/filters/ast.js +3 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +7 -1
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +8 -4
- package/dist-sdk/src/entities/shared/handle-description.d.ts +12 -0
- package/dist-sdk/src/entities/shared/handle-description.js +20 -0
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +6 -1
- package/dist-sdk/src/entities/shared/types/field-types.js +5 -8
- package/dist-sdk/src/entities/skill/build.d.ts +51 -2
- package/dist-sdk/src/entities/skill/build.js +65 -8
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +35 -3
- package/dist-sdk/src/entities/skill/from-tf.d.ts +11 -0
- package/dist-sdk/src/entities/skill/from-tf.js +39 -7
- package/dist-sdk/src/entities/skill/index.d.ts +1 -1
- package/dist-sdk/src/entities/skill/index.js +1 -1
- package/dist-sdk/src/entities/skill/input-coverage.d.ts +21 -0
- package/dist-sdk/src/entities/skill/input-coverage.js +148 -5
- package/dist-sdk/src/entities/skill/to-tf.d.ts +6 -25
- package/dist-sdk/src/entities/skill/to-tf.js +22 -38
- package/dist-sdk/src/entities/skill/tools.d.ts +2 -1
- package/dist-sdk/src/entities/skill/tools.js +3 -1
- package/dist-sdk/src/entities/skill-tool/from-tf.js +10 -3
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +5 -5
- package/dist-sdk/src/entities/skill-tool/to-tf.js +5 -7
- package/dist-sdk/src/entities/table/to-tf.js +3 -4
- package/dist-sdk/src/entities/task/to-tf.js +3 -2
- package/dist-sdk/src/entities/view/from-tf.js +36 -10
- package/dist-sdk/src/entities/view/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/view/to-tf.js +44 -30
- package/dist-sdk/src/entities/widget/from-tf.js +2 -2
- package/dist-sdk/src/entities/widget/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/widget/to-tf.js +52 -23
- package/dist-sdk/src/graph/index.d.ts +19 -1
- package/dist-sdk/src/graph/index.js +20 -0
- package/dist-sdk/src/graph/types.d.ts +19 -0
- package/package.json +10 -5
|
@@ -48,17 +48,65 @@ function printConnectorToken(connectorKey) {
|
|
|
48
48
|
export function printAgentV2(agent, opts) {
|
|
49
49
|
const { appRefName } = opts;
|
|
50
50
|
const crossOrg = opts.crossOrg === true;
|
|
51
|
+
if (agent.type === "bedrock") {
|
|
52
|
+
const lines = [];
|
|
53
|
+
lines.push("/**");
|
|
54
|
+
lines.push(` * ${agent.name}`);
|
|
55
|
+
lines.push(" *");
|
|
56
|
+
lines.push(" * Auto-generated by EDK (v2 pull). Hand-edit freely; the generator is a");
|
|
57
|
+
lines.push(" * one-shot starting point, not a live-binding view.");
|
|
58
|
+
lines.push(" */");
|
|
59
|
+
lines.push("");
|
|
60
|
+
lines.push(`import { bedrockAgent } from "${sdkPackageSpecifier("agents")}";`);
|
|
61
|
+
lines.push(`import catalog from "@catalog";`);
|
|
62
|
+
lines.push("");
|
|
63
|
+
const identifier = safeIdentifier(agent.refName, "agent");
|
|
64
|
+
lines.push(`const ${identifier} = bedrockAgent({`);
|
|
65
|
+
lines.push(` name: ${quote(agent.name)},`);
|
|
66
|
+
lines.push(` app: catalog.${appRefName},`);
|
|
67
|
+
if (agent.description !== undefined && agent.description !== "") {
|
|
68
|
+
lines.push(` description: ${quote(agent.description)},`);
|
|
69
|
+
}
|
|
70
|
+
const connectorMatchesDestination = agent.connectorKey !== undefined && (opts.destinationConnectorKeys?.has(agent.connectorKey) ?? false);
|
|
71
|
+
if (opts.connectorKeyOverride !== undefined) {
|
|
72
|
+
lines.push(` provider: ${printConnectorToken(opts.connectorKeyOverride)},`);
|
|
73
|
+
}
|
|
74
|
+
else if (agent.connectorKey !== undefined && crossOrg && !connectorMatchesDestination) {
|
|
75
|
+
lines.push(` provider: ${TODO_CONNECTOR_TOKEN}, // TODO: cross-org clone — provider "${agent.connectorKey}" was resolved in the SOURCE org; verify/replace with the destination org's catalog.aiProviders.<provider>.models.<model>`);
|
|
76
|
+
}
|
|
77
|
+
else if (agent.connectorKey !== undefined) {
|
|
78
|
+
lines.push(` provider: ${printConnectorToken(agent.connectorKey)},`);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
lines.push(` provider: ${TODO_CONNECTOR_TOKEN}, // TODO: no provider connector in the export — pick one`);
|
|
82
|
+
}
|
|
83
|
+
lines.push(` agentAliasArn: ${quote(agent.bedrockAgentArn ?? "")},`);
|
|
84
|
+
if (agent.instructions !== undefined && agent.instructions !== "") {
|
|
85
|
+
lines.push(` instructions: ${quote(agent.instructions)},`);
|
|
86
|
+
}
|
|
87
|
+
if (agent.firstMessage !== undefined && agent.firstMessage !== "") {
|
|
88
|
+
lines.push(` firstMessage: ${quote(agent.firstMessage)},`);
|
|
89
|
+
}
|
|
90
|
+
lines.push("});");
|
|
91
|
+
lines.push("");
|
|
92
|
+
lines.push(`export default ${identifier};`);
|
|
93
|
+
lines.push("");
|
|
94
|
+
return lines.join("\n");
|
|
95
|
+
}
|
|
51
96
|
const usesServiceAccountRef = (agent.runAs !== undefined && "serviceAccount" in agent.runAs) ||
|
|
52
97
|
agent.tools.some((tool) => tool.runAs !== undefined && "serviceAccount" in tool.runAs);
|
|
98
|
+
const usesStartingActionVariableType = agent.startingActions?.some((action) => (action.variables?.length ?? 0) > 0) === true;
|
|
53
99
|
const factories = [
|
|
54
100
|
...new Set([
|
|
55
101
|
...agent.tools.map((t) => TOOL_FACTORY_BY_TYPE_KEY[t.typeKey]).filter(Boolean),
|
|
56
102
|
...(usesServiceAccountRef ? ["serviceAccountRef"] : []),
|
|
103
|
+
...(usesStartingActionVariableType ? ["agentStartingActionVariableType"] : []),
|
|
57
104
|
]),
|
|
58
105
|
].sort();
|
|
59
106
|
const usesUnsafePlatformId = agent.tools.some((tool) => {
|
|
60
107
|
const targetOwner = searchTableTargetOwnerRefName(tool, appRefName, opts.foreignAppRefNames, opts.foreignElementRefNames);
|
|
61
|
-
return (tool.
|
|
108
|
+
return ((tool.filterVariables?.length ?? 0) > 0 ||
|
|
109
|
+
tool.fields?.some((field) => field.rawFieldId !== undefined) === true ||
|
|
62
110
|
tool.searchTableFields?.some((field) => !searchTableFieldMatchesTarget(field.fieldId, targetOwner, opts.foreignFieldRefsById)) === true ||
|
|
63
111
|
tool.returnFields?.some((field) => !searchTableFieldMatchesTarget(field.fieldId, targetOwner, opts.foreignFieldRefsById)) === true);
|
|
64
112
|
});
|
|
@@ -106,11 +154,18 @@ export function printAgentV2(agent, opts) {
|
|
|
106
154
|
lines.push(` connector: ${TODO_CONNECTOR_TOKEN}, // TODO: no connector in the export — pick one`);
|
|
107
155
|
}
|
|
108
156
|
lines.push(` description: ${quote(agent.description)},`);
|
|
109
|
-
lines.push(` instructions: ${quote(agent.instructions)},`);
|
|
157
|
+
lines.push(` instructions: ${quote(agent.instructions ?? "")},`);
|
|
110
158
|
if (agent.firstMessage !== undefined)
|
|
111
159
|
lines.push(` firstMessage: ${quote(agent.firstMessage)},`);
|
|
112
160
|
if (agent.maxLength !== undefined)
|
|
113
161
|
lines.push(` maxLength: ${String(agent.maxLength)},`);
|
|
162
|
+
if (agent.startingActions !== undefined && agent.startingActions.length > 0) {
|
|
163
|
+
lines.push(" startingActions: [");
|
|
164
|
+
for (const action of agent.startingActions) {
|
|
165
|
+
lines.push(...printStartingAction(action).map((l) => ` ${l}`));
|
|
166
|
+
}
|
|
167
|
+
lines.push(" ],");
|
|
168
|
+
}
|
|
114
169
|
if (agent.skillAccess !== undefined) {
|
|
115
170
|
lines.push(...printSkillAccess(agent.skillAccess, appRefName, crossOrg).map((l) => ` ${l}`));
|
|
116
171
|
}
|
|
@@ -178,6 +233,68 @@ function printSkillRefToken(ref, appRefName, crossOrg) {
|
|
|
178
233
|
: "";
|
|
179
234
|
return `{ __kind: "skill", refName: ${quote(ref.name)}, name: ${quote(ref.name)}, parent: ${quote(ref.appRefName ?? ref.appName)}, parentName: ${quote(ref.appName)} },${todo}`;
|
|
180
235
|
}
|
|
236
|
+
function printStartingActionVariableType(type) {
|
|
237
|
+
if (type === "NUMBER")
|
|
238
|
+
return "agentStartingActionVariableType.number";
|
|
239
|
+
if (type === "SELECT")
|
|
240
|
+
return "agentStartingActionVariableType.select";
|
|
241
|
+
return "agentStartingActionVariableType.text";
|
|
242
|
+
}
|
|
243
|
+
function printStartingActionVariable(variable) {
|
|
244
|
+
const lines = [
|
|
245
|
+
"{",
|
|
246
|
+
` key: ${quote(variable.key)},`,
|
|
247
|
+
` label: ${quote(variable.label)},`,
|
|
248
|
+
];
|
|
249
|
+
if (variable.placeholder !== undefined)
|
|
250
|
+
lines.push(` placeholder: ${quote(variable.placeholder)},`);
|
|
251
|
+
lines.push(` type: ${printStartingActionVariableType(variable.type)},`);
|
|
252
|
+
if (variable.required === true)
|
|
253
|
+
lines.push(" required: true,");
|
|
254
|
+
if (variable.type === "SELECT") {
|
|
255
|
+
lines.push(" options: [");
|
|
256
|
+
for (const option of variable.options) {
|
|
257
|
+
lines.push(` { value: ${quote(option.value)}, label: ${quote(option.label)} },`);
|
|
258
|
+
}
|
|
259
|
+
lines.push(" ],");
|
|
260
|
+
}
|
|
261
|
+
if (variable.validation !== undefined) {
|
|
262
|
+
const validation = variable.validation;
|
|
263
|
+
lines.push(" validation: {");
|
|
264
|
+
if (validation.pattern !== undefined)
|
|
265
|
+
lines.push(` pattern: ${quote(validation.pattern)},`);
|
|
266
|
+
if (validation.minLength !== undefined)
|
|
267
|
+
lines.push(` minLength: ${String(validation.minLength)},`);
|
|
268
|
+
if (validation.maxLength !== undefined)
|
|
269
|
+
lines.push(` maxLength: ${String(validation.maxLength)},`);
|
|
270
|
+
if (validation.errorMessage !== undefined)
|
|
271
|
+
lines.push(` errorMessage: ${quote(validation.errorMessage)},`);
|
|
272
|
+
lines.push(" },");
|
|
273
|
+
}
|
|
274
|
+
lines.push("},");
|
|
275
|
+
return lines;
|
|
276
|
+
}
|
|
277
|
+
function printStartingAction(action) {
|
|
278
|
+
const lines = [
|
|
279
|
+
"{",
|
|
280
|
+
` name: ${quote(action.name)},`,
|
|
281
|
+
` prompt: ${quote(action.prompt)},`,
|
|
282
|
+
` order: ${String(action.order)},`,
|
|
283
|
+
];
|
|
284
|
+
if (action.enabled === false)
|
|
285
|
+
lines.push(" enabled: false,");
|
|
286
|
+
if (action.icon !== undefined)
|
|
287
|
+
lines.push(` icon: ${quote(action.icon)},`);
|
|
288
|
+
if (action.variables !== undefined && action.variables.length > 0) {
|
|
289
|
+
lines.push(" variables: [");
|
|
290
|
+
for (const variable of action.variables) {
|
|
291
|
+
lines.push(...printStartingActionVariable(variable).map((l) => ` ${l}`));
|
|
292
|
+
}
|
|
293
|
+
lines.push(" ],");
|
|
294
|
+
}
|
|
295
|
+
lines.push("},");
|
|
296
|
+
return lines;
|
|
297
|
+
}
|
|
181
298
|
function printSkillAccess(access, appRefName, crossOrg) {
|
|
182
299
|
const hasPreloaded = access.preloadedSkills !== undefined && access.preloadedSkills.length > 0;
|
|
183
300
|
if (access.mode !== "CUSTOM" && !hasPreloaded) {
|
|
@@ -434,6 +551,13 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
|
|
|
434
551
|
if (tool.limit !== undefined)
|
|
435
552
|
lines.push(` limit: ${tool.limit},`);
|
|
436
553
|
}
|
|
554
|
+
if ((tool.typeKey === "searchAspect" || tool.typeKey === "searchTable") && tool.filterVariables !== undefined && tool.filterVariables.length > 0) {
|
|
555
|
+
lines.push(" filterVariables: [");
|
|
556
|
+
for (const variable of tool.filterVariables) {
|
|
557
|
+
lines.push(` { id: unsafePlatformId(${quote(variable.id)}), name: ${quote(variable.name)}, description: ${quote(variable.description)}, required: ${variable.required} },`);
|
|
558
|
+
}
|
|
559
|
+
lines.push(" ],");
|
|
560
|
+
}
|
|
437
561
|
if (tool.typeKey === "updateRecord" && tool.handleDescription !== undefined) {
|
|
438
562
|
lines.push(` handleDescription: ${quote(tool.handleDescription)},`);
|
|
439
563
|
}
|
|
@@ -10,14 +10,12 @@ import { type FromTfContext } from "../../engine/pull/context.js";
|
|
|
10
10
|
import { type TfBlock } from "../../engine/tf/index.js";
|
|
11
11
|
import { type NormalizedA2ASkill } from "../agent-a2a-skill/from-tf.js";
|
|
12
12
|
import { type NormalizedAgentTool } from "../agent-tool/from-tf.js";
|
|
13
|
-
import type { AgentAuthentication } from "./build.js";
|
|
13
|
+
import type { AgentAuthentication, AgentStartingAction } from "./build.js";
|
|
14
14
|
import type { AgentToolRunAs } from "./tools.js";
|
|
15
15
|
/**
|
|
16
16
|
* A resolved skill reference: this app's own skill (by catalog key), a
|
|
17
|
-
* foreign app's (by
|
|
18
|
-
*
|
|
19
|
-
* can be a bare UUID literal with neither a resource ref into this stream
|
|
20
|
-
* nor a `data.elementum_agentic_skill` block backing it anywhere in the export.
|
|
17
|
+
* foreign app's skill (by name + foreign app refName if the app is
|
|
18
|
+
* recognized), or an unresolvable platform UUID literal.
|
|
21
19
|
*/
|
|
22
20
|
export type NormalizedSkillRef = {
|
|
23
21
|
readonly kind: "self";
|
|
@@ -44,7 +42,9 @@ export interface NormalizedAgent {
|
|
|
44
42
|
readonly refName: string;
|
|
45
43
|
readonly name: string;
|
|
46
44
|
readonly description: string;
|
|
47
|
-
readonly
|
|
45
|
+
readonly type?: "elementum" | "bedrock";
|
|
46
|
+
readonly bedrockAgentArn?: string;
|
|
47
|
+
readonly instructions?: string;
|
|
48
48
|
readonly firstMessage?: string;
|
|
49
49
|
readonly maxLength?: number;
|
|
50
50
|
/** org.ts `aiProviders.<provider>.models.<model>` compound key ("<provider>.<model>"), when pinned. */
|
|
@@ -55,6 +55,7 @@ export interface NormalizedAgent {
|
|
|
55
55
|
readonly conversationIdleTimeout?: string;
|
|
56
56
|
readonly a2aStreaming?: boolean;
|
|
57
57
|
readonly a2aCreateRecordEnabled?: boolean;
|
|
58
|
+
readonly startingActions?: readonly AgentStartingAction[];
|
|
58
59
|
readonly tools: readonly NormalizedAgentTool[];
|
|
59
60
|
readonly a2aSkills?: readonly NormalizedA2ASkill[];
|
|
60
61
|
}
|
|
@@ -31,16 +31,18 @@ const KNOWN_AGENT_ATTRS = new Set([
|
|
|
31
31
|
"conversation_idle_timeout",
|
|
32
32
|
"a2a_streaming",
|
|
33
33
|
"a2a_create_record_enabled",
|
|
34
|
+
"type",
|
|
35
|
+
"bedrock_agent_arn",
|
|
36
|
+
"starting_actions",
|
|
34
37
|
]);
|
|
35
38
|
/** Dialect attrs with no authoring slot yet — reported by name, agent still pulled. */
|
|
36
|
-
const UNAUTHORABLE_AGENT_ATTRS = new Set(["
|
|
39
|
+
const UNAUTHORABLE_AGENT_ATTRS = new Set(["model"]);
|
|
40
|
+
const STARTING_ACTION_VARIABLE_TYPES = new Set(["TEXT", "NUMBER", "SELECT"]);
|
|
37
41
|
/** Non-elementum agent variants (type + their config attrs) — the whole agent is skipped. */
|
|
38
42
|
const VARIANT_ATTRS = new Set([
|
|
39
|
-
"type",
|
|
40
43
|
"snowflake_database",
|
|
41
44
|
"snowflake_schema",
|
|
42
45
|
"snowflake_name",
|
|
43
|
-
"bedrock_agent_arn",
|
|
44
46
|
"browser_agent_instructions",
|
|
45
47
|
]);
|
|
46
48
|
/**
|
|
@@ -153,6 +155,151 @@ function parseJwtAuthentication(value, where, ctx) {
|
|
|
153
155
|
},
|
|
154
156
|
};
|
|
155
157
|
}
|
|
158
|
+
function parseStartingActionValidation(value, where, ctx) {
|
|
159
|
+
const rec = plainObject(value);
|
|
160
|
+
if (rec === undefined) {
|
|
161
|
+
ctx.diagnostics.push(`${where}: validation has an unrecognized shape; dropped`);
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
164
|
+
const pattern = optionalString(rec, "pattern", where, ctx);
|
|
165
|
+
const errorMessage = optionalString(rec, "error_message", where, ctx);
|
|
166
|
+
const minLength = rec["min_length"];
|
|
167
|
+
const maxLength = rec["max_length"];
|
|
168
|
+
const validation = {
|
|
169
|
+
...(pattern !== undefined && pattern !== "" && { pattern }),
|
|
170
|
+
...(typeof minLength === "number" && Number.isSafeInteger(minLength) ? { minLength } : {}),
|
|
171
|
+
...(typeof maxLength === "number" && Number.isSafeInteger(maxLength) ? { maxLength } : {}),
|
|
172
|
+
...(errorMessage !== undefined && errorMessage !== "" && { errorMessage }),
|
|
173
|
+
};
|
|
174
|
+
if (minLength !== undefined && validation.minLength === undefined) {
|
|
175
|
+
ctx.diagnostics.push(`${where}: expected integer min_length, got ${JSON.stringify(minLength)}; dropped`);
|
|
176
|
+
}
|
|
177
|
+
if (maxLength !== undefined && validation.maxLength === undefined) {
|
|
178
|
+
ctx.diagnostics.push(`${where}: expected integer max_length, got ${JSON.stringify(maxLength)}; dropped`);
|
|
179
|
+
}
|
|
180
|
+
return Object.keys(validation).length > 0 ? validation : undefined;
|
|
181
|
+
}
|
|
182
|
+
function parseStartingActionVariable(value, where, ctx) {
|
|
183
|
+
const rec = plainObject(value);
|
|
184
|
+
if (rec === undefined) {
|
|
185
|
+
ctx.diagnostics.push(`${where}: starting action variable has an unrecognized shape; dropped`);
|
|
186
|
+
return undefined;
|
|
187
|
+
}
|
|
188
|
+
const key = optionalString(rec, "key", where, ctx);
|
|
189
|
+
const label = optionalString(rec, "label", where, ctx);
|
|
190
|
+
const type = optionalString(rec, "type", where, ctx);
|
|
191
|
+
if (key === undefined || key === "" || label === undefined || label === "") {
|
|
192
|
+
ctx.diagnostics.push(`${where}: starting action variable is missing key/label; dropped`);
|
|
193
|
+
return undefined;
|
|
194
|
+
}
|
|
195
|
+
if (type === undefined || !STARTING_ACTION_VARIABLE_TYPES.has(type)) {
|
|
196
|
+
ctx.diagnostics.push(`${where}: starting action variable "${key}" has unrecognized type ${JSON.stringify(type)}; dropped`);
|
|
197
|
+
return undefined;
|
|
198
|
+
}
|
|
199
|
+
let options;
|
|
200
|
+
const rawOptions = rec["options"];
|
|
201
|
+
if (Array.isArray(rawOptions) && rawOptions.length > 0) {
|
|
202
|
+
if (type !== "SELECT") {
|
|
203
|
+
ctx.diagnostics.push(`${where}: starting action variable "${key}" is type ${type} but has options (only SELECT carries options); dropped`);
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
const parsed = [];
|
|
207
|
+
for (const item of rawOptions) {
|
|
208
|
+
const option = plainObject(item);
|
|
209
|
+
const optionLabel = option === undefined ? undefined : optionalString(option, "label", where, ctx);
|
|
210
|
+
const optionValue = option === undefined ? undefined : optionalString(option, "value", where, ctx);
|
|
211
|
+
if (optionLabel === undefined || optionValue === undefined) {
|
|
212
|
+
ctx.diagnostics.push(`${where}: starting action variable "${key}" has an unrecognized option; dropped`);
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
parsed.push({ value: optionValue, label: optionLabel });
|
|
216
|
+
}
|
|
217
|
+
if (parsed.length > 0)
|
|
218
|
+
options = parsed;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
else if (rawOptions !== undefined && !Array.isArray(rawOptions)) {
|
|
222
|
+
ctx.diagnostics.push(`${where}: starting action variable "${key}" options is not a list; dropped`);
|
|
223
|
+
}
|
|
224
|
+
if (type === "SELECT" && options === undefined) {
|
|
225
|
+
ctx.diagnostics.push(`${where}: starting action variable "${key}" is type SELECT but has no valid options; dropped`);
|
|
226
|
+
return undefined;
|
|
227
|
+
}
|
|
228
|
+
const required = optionalBoolean(rec, "required", where, ctx);
|
|
229
|
+
const placeholder = optionalString(rec, "placeholder", where, ctx);
|
|
230
|
+
const validation = rec["validation"] === undefined ? undefined : parseStartingActionValidation(rec["validation"], `${where}: ${key}`, ctx);
|
|
231
|
+
const base = {
|
|
232
|
+
key,
|
|
233
|
+
label,
|
|
234
|
+
...(placeholder !== undefined && placeholder !== "" && { placeholder }),
|
|
235
|
+
...(required === true && { required: true }),
|
|
236
|
+
...(validation !== undefined && { validation }),
|
|
237
|
+
};
|
|
238
|
+
if (type === "SELECT") {
|
|
239
|
+
return {
|
|
240
|
+
...base,
|
|
241
|
+
type: "SELECT",
|
|
242
|
+
options: options,
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
return { ...base, type: type };
|
|
246
|
+
}
|
|
247
|
+
function parseStartingAction(value, where, ctx) {
|
|
248
|
+
const rec = plainObject(value);
|
|
249
|
+
if (rec === undefined) {
|
|
250
|
+
ctx.diagnostics.push(`${where}: starting action has an unrecognized shape; dropped`);
|
|
251
|
+
return undefined;
|
|
252
|
+
}
|
|
253
|
+
const name = optionalString(rec, "name", where, ctx);
|
|
254
|
+
const prompt = optionalString(rec, "prompt", where, ctx);
|
|
255
|
+
const order = rec["order"];
|
|
256
|
+
if (name === undefined || name === "" || typeof prompt !== "string") {
|
|
257
|
+
ctx.diagnostics.push(`${where}: starting action is missing name/prompt; dropped`);
|
|
258
|
+
return undefined;
|
|
259
|
+
}
|
|
260
|
+
if (typeof order !== "number" || !Number.isSafeInteger(order)) {
|
|
261
|
+
ctx.diagnostics.push(`${where}: starting action "${name}" is missing integer order; dropped`);
|
|
262
|
+
return undefined;
|
|
263
|
+
}
|
|
264
|
+
const enabled = optionalBoolean(rec, "enabled", where, ctx);
|
|
265
|
+
const icon = optionalString(rec, "icon", where, ctx);
|
|
266
|
+
let variables;
|
|
267
|
+
const rawVariables = rec["variables"];
|
|
268
|
+
if (Array.isArray(rawVariables) && rawVariables.length > 0) {
|
|
269
|
+
const parsed = [];
|
|
270
|
+
for (const item of rawVariables) {
|
|
271
|
+
const variable = parseStartingActionVariable(item, `${where}: ${name}`, ctx);
|
|
272
|
+
if (variable !== undefined)
|
|
273
|
+
parsed.push(variable);
|
|
274
|
+
}
|
|
275
|
+
if (parsed.length > 0)
|
|
276
|
+
variables = parsed;
|
|
277
|
+
}
|
|
278
|
+
else if (rawVariables !== undefined && !Array.isArray(rawVariables)) {
|
|
279
|
+
ctx.diagnostics.push(`${where}: starting action "${name}" variables is not a list; dropped`);
|
|
280
|
+
}
|
|
281
|
+
return {
|
|
282
|
+
name,
|
|
283
|
+
prompt,
|
|
284
|
+
order,
|
|
285
|
+
...(enabled === false && { enabled: false }),
|
|
286
|
+
...(icon !== undefined && icon !== "" && { icon }),
|
|
287
|
+
...(variables !== undefined && { variables }),
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
function parseStartingActions(value, where, ctx) {
|
|
291
|
+
if (!Array.isArray(value)) {
|
|
292
|
+
ctx.diagnostics.push(`${where}: starting_actions is not a list; dropped`);
|
|
293
|
+
return undefined;
|
|
294
|
+
}
|
|
295
|
+
const actions = [];
|
|
296
|
+
for (const item of value) {
|
|
297
|
+
const action = parseStartingAction(item, where, ctx);
|
|
298
|
+
if (action !== undefined)
|
|
299
|
+
actions.push(action);
|
|
300
|
+
}
|
|
301
|
+
return actions.length > 0 ? actions : undefined;
|
|
302
|
+
}
|
|
156
303
|
function parseSkillAccessConfig(value, where, ownerTfLabel, ctx) {
|
|
157
304
|
if (typeof value !== "object" || value === null || Array.isArray(value) || isTfExpr(value)) {
|
|
158
305
|
ctx.diagnostics.push(`${where}: skill_access_config has an unrecognized shape; dropped`);
|
|
@@ -201,9 +348,10 @@ export function agentFromTf(agentBlock, toolBlocks, appLabel, _appRefName, ctx,
|
|
|
201
348
|
const attrs = agentBlock.attrs;
|
|
202
349
|
const name = optionalString(attrs, "name", `agent "${label}"`, ctx) ?? "";
|
|
203
350
|
const where = `agent "${name}" (${AGENT_RESOURCE_TYPE}.${label})`;
|
|
204
|
-
|
|
351
|
+
const rawType = optionalString(attrs, "type", where, ctx);
|
|
352
|
+
if (rawType !== undefined && rawType !== "elementum" && rawType !== "bedrock") {
|
|
205
353
|
return {
|
|
206
|
-
skippedReason: `${where}: agent type ${JSON.stringify(
|
|
354
|
+
skippedReason: `${where}: agent type ${JSON.stringify(rawType)} has no terraform-path authoring yet; skipped`,
|
|
207
355
|
};
|
|
208
356
|
}
|
|
209
357
|
for (const key of Object.keys(attrs)) {
|
|
@@ -240,6 +388,27 @@ export function agentFromTf(agentBlock, toolBlocks, appLabel, _appRefName, ctx,
|
|
|
240
388
|
ctx.diagnostics.push(`${where}: ai_provider_connector_id is not a connector data reference; dropped`);
|
|
241
389
|
}
|
|
242
390
|
}
|
|
391
|
+
if (rawType === "bedrock") {
|
|
392
|
+
const bedrockAgentArn = optionalString(attrs, "bedrock_agent_arn", where, ctx) ?? "";
|
|
393
|
+
const instructions = optionalString(attrs, "instructions", where, ctx);
|
|
394
|
+
const firstMessage = optionalString(attrs, "first_message", where, ctx);
|
|
395
|
+
if (attrs["starting_actions"] !== undefined) {
|
|
396
|
+
ctx.diagnostics.push(`${where}: starting_actions has no authoring slot on bedrock agents yet; a rebuilt stream will omit it`);
|
|
397
|
+
}
|
|
398
|
+
return {
|
|
399
|
+
agent: {
|
|
400
|
+
refName: scopedLabelToBagKey(appLabel, label),
|
|
401
|
+
name,
|
|
402
|
+
description: optionalString(attrs, "description", where, ctx) ?? "",
|
|
403
|
+
...(instructions !== undefined && instructions !== "" && { instructions }),
|
|
404
|
+
...(firstMessage !== undefined && { firstMessage }),
|
|
405
|
+
type: "bedrock",
|
|
406
|
+
bedrockAgentArn,
|
|
407
|
+
...(connectorKey !== undefined && { connectorKey }),
|
|
408
|
+
tools: [],
|
|
409
|
+
},
|
|
410
|
+
};
|
|
411
|
+
}
|
|
243
412
|
const owner = { appType: APP_RESOURCE_TYPE, appLabel, ownerTfLabel: appLabel, agentType: AGENT_RESOURCE_TYPE, agentLabel: label };
|
|
244
413
|
const tools = [];
|
|
245
414
|
for (const block of toolBlocks) {
|
|
@@ -271,6 +440,7 @@ export function agentFromTf(agentBlock, toolBlocks, appLabel, _appRefName, ctx,
|
|
|
271
440
|
const conversationIdleTimeout = optionalString(attrs, "conversation_idle_timeout", where, ctx);
|
|
272
441
|
const a2aStreaming = optionalBoolean(attrs, "a2a_streaming", where, ctx);
|
|
273
442
|
const a2aCreateRecordEnabled = optionalBoolean(attrs, "a2a_create_record_enabled", where, ctx);
|
|
443
|
+
const startingActions = attrs["starting_actions"] === undefined ? undefined : parseStartingActions(attrs["starting_actions"], where, ctx);
|
|
274
444
|
const firstMessage = optionalString(attrs, "first_message", where, ctx);
|
|
275
445
|
const maxTokens = attrs["max_tokens"];
|
|
276
446
|
const maxLength = typeof maxTokens === "number" && Number.isSafeInteger(maxTokens) && maxTokens > 0
|
|
@@ -294,6 +464,7 @@ export function agentFromTf(agentBlock, toolBlocks, appLabel, _appRefName, ctx,
|
|
|
294
464
|
...(conversationIdleTimeout !== undefined && { conversationIdleTimeout }),
|
|
295
465
|
...(a2aStreaming !== undefined && { a2aStreaming }),
|
|
296
466
|
...(a2aCreateRecordEnabled !== undefined && { a2aCreateRecordEnabled }),
|
|
467
|
+
...(startingActions !== undefined && { startingActions }),
|
|
297
468
|
tools,
|
|
298
469
|
...(a2aSkills.length > 0 && { a2aSkills }),
|
|
299
470
|
},
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* the deploy wire client injects) with `CatalogRef` tokens at every reference
|
|
4
4
|
* position. Standalone from v1.
|
|
5
5
|
*/
|
|
6
|
-
export { agent, type A2ASkill, type AgentAuthentication, type AgentV2Options, agentStartingActionVariableType, type AgentStartingAction, type AgentStartingActionVariable, type AgentStartingActionVariableType, type SkillAccess, } from "./build.js";
|
|
7
|
-
export { agentCreateRecord, agentExecuteWorkflow, agentMcp, agentRelateRecord, agentRunAgent, agentRunAutomation, agentSearchRecords, agentSearchTable, agentUpdateRecord, type AgentExecuteWorkflowInput, type AgentExecuteWorkflowOutput, type RunAutomationInputs, type RunAutomationOptionalInput, type RunAutomationOutput, type RunAutomationOutputs, type RunAutomationRequiredInput, type RunAutomationToolV2, type AgentMcpHeader, type AgentRecordField, type AgentRecordFieldInput, type AgentRecordRawIdField, type AgentSearchField, type AgentSearchFieldInput, type AgentSearchRawIdField, type AgentSearchReturnField, type AgentSearchReturnFieldInput, type AgentSearchRawIdReturnField, type AgentSearchTableField, type AgentSearchTableFieldInput, type AgentSearchTableRawIdField, type SearchTableToolV2, type AgentToolRunAs, type AgentTool, } from "./tools.js";
|
|
6
|
+
export { agent, bedrockAgent, type A2ASkill, type AgentAuthentication, type AgentConfigured, type AgentV2Options, type BedrockAgentOptions, agentStartingActionVariableType, type AgentStartingAction, type AgentStartingActionVariable, type AgentStartingActionVariableType, type SkillAccess, } from "./build.js";
|
|
7
|
+
export { agentCreateRecord, agentExecuteWorkflow, agentMcp, agentRelateRecord, agentRunAgent, agentRunAutomation, agentSearchRecords, agentSearchTable, agentUpdateRecord, type AgentExecuteWorkflowInput, type AgentExecuteWorkflowOutput, type RunAutomationInputs, type RunAutomationOptionalInput, type RunAutomationOutput, type RunAutomationOutputs, type RunAutomationRequiredInput, type RunAutomationToolV2, type AgentMcpHeader, type AgentRecordField, type AgentRecordFieldInput, type AgentRecordRawIdField, type AgentSearchField, type AgentSearchFieldInput, type AgentFilterVariable, type AgentSearchRawIdField, type AgentSearchReturnField, type AgentSearchReturnFieldInput, type AgentSearchRawIdReturnField, type AgentSearchTableField, type AgentSearchTableFieldInput, type AgentSearchTableRawIdField, type SearchTableToolV2, type AgentToolRunAs, type AgentTool, } from "./tools.js";
|
|
8
8
|
export { serviceAccountRef, type ServiceAccountRef } from "./run-as.js";
|
|
9
9
|
export * as filter from "../shared/filters/index.js";
|
|
10
10
|
export { type Filter } from "../shared/filters/types.js";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* the deploy wire client injects) with `CatalogRef` tokens at every reference
|
|
4
4
|
* position. Standalone from v1.
|
|
5
5
|
*/
|
|
6
|
-
export { agent, agentStartingActionVariableType, } from "./build.js";
|
|
6
|
+
export { agent, bedrockAgent, agentStartingActionVariableType, } from "./build.js";
|
|
7
7
|
export { agentCreateRecord, agentExecuteWorkflow, agentMcp, agentRelateRecord, agentRunAgent, agentRunAutomation, agentSearchRecords, agentSearchTable, agentUpdateRecord, } from "./tools.js";
|
|
8
8
|
export { serviceAccountRef } from "./run-as.js";
|
|
9
9
|
export * as filter from "../shared/filters/index.js";
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
* app_id as the owning app's resource ref, the connector as a
|
|
11
11
|
* `data.elementum_ai_provider_connector` ref, agent-prefixed tool labels.
|
|
12
12
|
* `skillAccess` emits `skill_access_config` (confirmed live against the
|
|
13
|
-
* provider's `elementum_agent` schema).
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* silent (plan §4.3).
|
|
13
|
+
* provider's `elementum_agent` schema). `startingActions` emit
|
|
14
|
+
* `starting_actions` (issue #760). Authoring knobs the terraform dialect
|
|
15
|
+
* still doesn't carry (temperature, reasoningEffort, …) degrade through
|
|
16
|
+
* `diagnostics` — reported, never silent (plan §4.3).
|
|
17
17
|
*/
|
|
18
18
|
import { type OrgRefLookup, type WorkspaceAspect } from "../../engine/build/context.js";
|
|
19
19
|
import { type DeployableEntity } from "../../engine/entity.js";
|