@elementumai/edk 0.9.6 → 0.9.7
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 +31 -1
- package/dist-sdk/src/catalog/factories.d.ts +12 -3
- package/dist-sdk/src/catalog/factories.js +9 -6
- package/dist-sdk/src/catalog/org.js +26 -13
- package/dist-sdk/src/catalog/types.d.ts +22 -1
- package/dist-sdk/src/core/index.d.ts +1 -1
- package/dist-sdk/src/core/system-fields.d.ts +4 -0
- package/dist-sdk/src/core/system-fields.js +15 -0
- package/dist-sdk/src/core/types/app.d.ts +14 -9
- package/dist-sdk/src/core/types/platform.d.ts +1 -1
- package/dist-sdk/src/engine/build/context.d.ts +4 -0
- package/dist-sdk/src/engine/pull/context.d.ts +9 -0
- package/dist-sdk/src/engine/pull/ref-only.d.ts +14 -0
- package/dist-sdk/src/engine/pull/ref-only.js +35 -2
- package/dist-sdk/src/entities/access-policy/from-tf.js +14 -2
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +6 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +4 -1
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +18 -1
- package/dist-sdk/src/entities/agent/module.js +1 -0
- package/dist-sdk/src/entities/agent/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/agent/to-tf.js +1 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +9 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.js +10 -2
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.js +2 -3
- package/dist-sdk/src/entities/app/build.d.ts +42 -22
- package/dist-sdk/src/entities/app/build.js +12 -5
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +10 -0
- package/dist-sdk/src/entities/app/from-tf.js +71 -8
- package/dist-sdk/src/entities/app/index.d.ts +3 -2
- package/dist-sdk/src/entities/app/index.js +2 -1
- package/dist-sdk/src/entities/app/to-tf.js +16 -0
- package/dist-sdk/src/entities/automation/build.d.ts +31 -19
- package/dist-sdk/src/entities/automation/build.js +85 -7
- package/dist-sdk/src/entities/automation/catalog-render.js +5 -2
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +5 -3
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +26 -12
- package/dist-sdk/src/entities/automation/from-tf.js +364 -31
- package/dist-sdk/src/entities/automation/index.d.ts +1 -1
- package/dist-sdk/src/entities/automation/module.js +2 -2
- package/dist-sdk/src/entities/automation/operators.d.ts +2 -2
- package/dist-sdk/src/entities/automation/operators.js +1 -0
- package/dist-sdk/src/entities/automation/output-field-types.d.ts +17 -0
- package/dist-sdk/src/entities/automation/output-field-types.js +45 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +8 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +16 -0
- package/dist-sdk/src/entities/automation/script-code.js +153 -25
- package/dist-sdk/src/entities/automation/tasks.d.ts +100 -37
- package/dist-sdk/src/entities/automation/tasks.js +44 -43
- package/dist-sdk/src/entities/automation/to-tf.d.ts +3 -1
- package/dist-sdk/src/entities/automation/to-tf.js +454 -58
- package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +78 -0
- package/dist-sdk/src/entities/automation/value-ref-tf.js +193 -0
- package/dist-sdk/src/entities/element/build.js +1 -0
- package/dist-sdk/src/entities/element/index.d.ts +2 -1
- package/dist-sdk/src/entities/element/index.js +2 -1
- package/dist-sdk/src/entities/field/build.d.ts +94 -3
- package/dist-sdk/src/entities/field/build.js +82 -3
- package/dist-sdk/src/entities/field/from-tf.js +92 -1
- package/dist-sdk/src/entities/field/locals.js +6 -7
- package/dist-sdk/src/entities/field/options.d.ts +2 -0
- package/dist-sdk/src/entities/field/options.js +12 -2
- package/dist-sdk/src/entities/field/record-shape.d.ts +12 -15
- package/dist-sdk/src/entities/field/to-tf.d.ts +12 -2
- package/dist-sdk/src/entities/field/to-tf.js +172 -51
- package/dist-sdk/src/entities/field/types.js +2 -0
- package/dist-sdk/src/entities/record-create-form/to-tf.js +5 -8
- package/dist-sdk/src/entities/relationship/from-tf.js +91 -9
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +9 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +39 -0
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +18 -1
- package/dist-sdk/src/entities/shared/filters/ast.js +1 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +6 -1
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +6 -4
- package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +5 -3
- package/dist-sdk/src/entities/shared/tool-field-ref.js +11 -16
- package/dist-sdk/src/entities/shared/types/common.d.ts +7 -5
- package/dist-sdk/src/entities/shared/types/platform.d.ts +15 -2
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +1 -1
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +44 -15
- package/dist-sdk/src/entities/skill/from-tf.js +11 -1
- package/dist-sdk/src/entities/skill/input-coverage.d.ts +68 -0
- package/dist-sdk/src/entities/skill/input-coverage.js +184 -0
- package/dist-sdk/src/entities/skill/module.js +2 -0
- package/dist-sdk/src/entities/skill/to-tf.d.ts +3 -0
- package/dist-sdk/src/entities/skill/to-tf.js +7 -2
- package/dist-sdk/src/entities/skill/tools.d.ts +10 -1
- package/dist-sdk/src/entities/skill/tools.js +0 -5
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +19 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +40 -11
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +4 -2
- package/dist-sdk/src/entities/skill-tool/to-tf.js +24 -16
- package/dist-sdk/src/entities/table/to-tf.js +18 -1
- package/dist-sdk/src/entities/view/to-tf.js +8 -3
- package/dist-sdk/src/entities/visual-flow/from-tf.js +6 -2
- package/dist-sdk/src/graph/types.d.ts +3 -0
- package/package.json +2 -1
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill input-coverage analysis.
|
|
3
|
+
*
|
|
4
|
+
* The platform's current skill contract keeps the form schema and lookup
|
|
5
|
+
* bindings in the instructions Markdown while tool fields/inputs are
|
|
6
|
+
* structured resources. This module compares those two real sources instead
|
|
7
|
+
* of inventing a second persisted schema. The headings and list shape match
|
|
8
|
+
* the skill generator contract:
|
|
9
|
+
*
|
|
10
|
+
* ## Input Schema
|
|
11
|
+
* - field_name (required): description
|
|
12
|
+
*
|
|
13
|
+
* ## Lookup Notes
|
|
14
|
+
* - field_name: resolve_field_name (source_table)
|
|
15
|
+
*/
|
|
16
|
+
function markdownSection(markdown, title) {
|
|
17
|
+
const lines = markdown.split(/\r?\n/);
|
|
18
|
+
const wanted = title.trim().toLowerCase();
|
|
19
|
+
const start = lines.findIndex((line) => {
|
|
20
|
+
const match = /^\s*#{1,6}\s+(.+?)\s*$/.exec(line);
|
|
21
|
+
return match?.[1]?.trim().toLowerCase() === wanted;
|
|
22
|
+
});
|
|
23
|
+
if (start < 0)
|
|
24
|
+
return { found: false, lines: [] };
|
|
25
|
+
const body = [];
|
|
26
|
+
for (let index = start + 1; index < lines.length; index += 1) {
|
|
27
|
+
const line = lines[index];
|
|
28
|
+
if (/^\s*#{1,6}\s+/.test(line))
|
|
29
|
+
break;
|
|
30
|
+
body.push(line);
|
|
31
|
+
}
|
|
32
|
+
return { found: true, lines: body };
|
|
33
|
+
}
|
|
34
|
+
function unique(values) {
|
|
35
|
+
return [...new Set(values)];
|
|
36
|
+
}
|
|
37
|
+
function canonicalName(value) {
|
|
38
|
+
return value.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
39
|
+
}
|
|
40
|
+
function bulletKey(line) {
|
|
41
|
+
const match = /^\s*[-*]\s+`?([A-Za-z_][A-Za-z0-9_.-]*)`?\s*(?:\([^)]*\))?\s*:/.exec(line);
|
|
42
|
+
return match?.[1];
|
|
43
|
+
}
|
|
44
|
+
function inputNames(section) {
|
|
45
|
+
return unique(section.lines.map(bulletKey).filter((value) => value !== undefined));
|
|
46
|
+
}
|
|
47
|
+
function lookupBindings(section) {
|
|
48
|
+
const out = [];
|
|
49
|
+
for (const line of section.lines) {
|
|
50
|
+
const match = /^\s*[-*]\s+`?([A-Za-z_][A-Za-z0-9_.-]*)`?\s*:\s*`?([A-Za-z_][A-Za-z0-9_-]*)`?(?:\s|\(|$)/.exec(line);
|
|
51
|
+
if (match?.[1] !== undefined && match[2] !== undefined) {
|
|
52
|
+
out.push({ input: match[1], tool: match[2] });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return out;
|
|
56
|
+
}
|
|
57
|
+
function mentionsIdentifier(markdown, name) {
|
|
58
|
+
if (name === "")
|
|
59
|
+
return false;
|
|
60
|
+
const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
61
|
+
return new RegExp(`(^|[^A-Za-z0-9_])${escaped}([^A-Za-z0-9_]|$)`).test(markdown);
|
|
62
|
+
}
|
|
63
|
+
function sameName(left, right) {
|
|
64
|
+
return canonicalName(left) === canonicalName(right);
|
|
65
|
+
}
|
|
66
|
+
/** Compare instruction-declared form variables with the deployed tool surface. */
|
|
67
|
+
export function analyzeSkillInputCoverage(skill, instructions, coverageTools) {
|
|
68
|
+
const schema = markdownSection(instructions, "Input Schema");
|
|
69
|
+
const inputs = inputNames(schema);
|
|
70
|
+
const tools = coverageTools.map((entry) => entry.name);
|
|
71
|
+
if (!schema.found) {
|
|
72
|
+
return {
|
|
73
|
+
skill,
|
|
74
|
+
inputs: [],
|
|
75
|
+
tools,
|
|
76
|
+
bindings: [],
|
|
77
|
+
gaps: [{ kind: "input-schema-missing" }],
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const lookups = lookupBindings(markdownSection(instructions, "Lookup Notes"));
|
|
81
|
+
const gaps = [];
|
|
82
|
+
const bindings = [];
|
|
83
|
+
const coveredTools = new Set();
|
|
84
|
+
for (const input of inputs) {
|
|
85
|
+
const targets = [];
|
|
86
|
+
for (const lookup of lookups.filter((entry) => sameName(entry.input, input))) {
|
|
87
|
+
if (tools.includes(lookup.tool)) {
|
|
88
|
+
targets.push({ kind: "lookup", tool: lookup.tool });
|
|
89
|
+
coveredTools.add(lookup.tool);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
gaps.push({ kind: "missing-lookup-tool", input, tool: lookup.tool });
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
for (const coverageTool of coverageTools) {
|
|
96
|
+
for (const field of coverageTool.fields.filter((entry) => sameName(entry, input))) {
|
|
97
|
+
targets.push({ kind: "field", tool: coverageTool.name, name: field });
|
|
98
|
+
coveredTools.add(coverageTool.name);
|
|
99
|
+
}
|
|
100
|
+
for (const parameter of coverageTool.inputs.filter((entry) => sameName(entry, input))) {
|
|
101
|
+
targets.push({ kind: "input", tool: coverageTool.name, name: parameter });
|
|
102
|
+
coveredTools.add(coverageTool.name);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (targets.length === 0)
|
|
106
|
+
gaps.push({ kind: "missing-field", input });
|
|
107
|
+
bindings.push({ input, targets });
|
|
108
|
+
}
|
|
109
|
+
for (const lookup of lookups) {
|
|
110
|
+
if (!inputs.some((input) => sameName(input, lookup.input))) {
|
|
111
|
+
gaps.push({ kind: "unbound-lookup", input: lookup.input, tool: lookup.tool });
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
for (const coverageTool of coverageTools) {
|
|
115
|
+
if (coveredTools.has(coverageTool.name) || mentionsIdentifier(instructions, coverageTool.name))
|
|
116
|
+
continue;
|
|
117
|
+
gaps.push({ kind: "leftover-tool", tool: coverageTool.name });
|
|
118
|
+
}
|
|
119
|
+
return { skill, inputs, tools, bindings, gaps };
|
|
120
|
+
}
|
|
121
|
+
function describeTarget(target) {
|
|
122
|
+
if (target.kind === "lookup")
|
|
123
|
+
return `lookup tool ${JSON.stringify(target.tool)}`;
|
|
124
|
+
return `tool ${JSON.stringify(target.tool)} ${target.kind} ${JSON.stringify(target.name)}`;
|
|
125
|
+
}
|
|
126
|
+
/** Informational coverage lines emitted on stderr and in JSON `reports`. */
|
|
127
|
+
export function skillCoverageReportLines(report) {
|
|
128
|
+
const lines = [
|
|
129
|
+
`skill ${JSON.stringify(report.skill)} input coverage report: ${report.inputs.length} form variables, ${report.tools.length} tools, ${report.gaps.length} gaps`,
|
|
130
|
+
];
|
|
131
|
+
for (const binding of report.bindings) {
|
|
132
|
+
lines.push(`skill ${JSON.stringify(report.skill)} input coverage: ${JSON.stringify(binding.input)} -> ${binding.targets.length > 0 ? binding.targets.map(describeTarget).join(", ") : "UNBOUND"}`);
|
|
133
|
+
}
|
|
134
|
+
return lines;
|
|
135
|
+
}
|
|
136
|
+
/** Only actionable gaps; these remain warnings and JSON `diagnostics`. */
|
|
137
|
+
export function skillCoverageGapDiagnostics(report) {
|
|
138
|
+
const lines = [];
|
|
139
|
+
for (const gap of report.gaps) {
|
|
140
|
+
if (gap.kind === "input-schema-missing") {
|
|
141
|
+
lines.push(`skill ${JSON.stringify(report.skill)} input coverage gap [input-schema-missing]: instructions have no "## Input Schema" section; tool coverage cannot be verified`);
|
|
142
|
+
}
|
|
143
|
+
else if (gap.kind === "missing-field") {
|
|
144
|
+
lines.push(`skill ${JSON.stringify(report.skill)} input coverage gap [missing-field]: form variable ${JSON.stringify(gap.input)} has no skill field or tool input binding`);
|
|
145
|
+
}
|
|
146
|
+
else if (gap.kind === "missing-lookup-tool") {
|
|
147
|
+
lines.push(`skill ${JSON.stringify(report.skill)} input coverage gap [missing-lookup-tool]: ${JSON.stringify(gap.input)} names lookup tool ${JSON.stringify(gap.tool)}, but that tool is absent`);
|
|
148
|
+
}
|
|
149
|
+
else if (gap.kind === "unbound-lookup") {
|
|
150
|
+
lines.push(`skill ${JSON.stringify(report.skill)} input coverage gap [unbound-lookup]: lookup ${JSON.stringify(gap.input)} -> ${JSON.stringify(gap.tool)} has no matching Input Schema field`);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
lines.push(`skill ${JSON.stringify(report.skill)} input coverage gap [leftover-tool]: tool ${JSON.stringify(gap.tool)} is neither bound to an Input Schema field nor referenced by the instructions`);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return lines;
|
|
157
|
+
}
|
|
158
|
+
function stringsAt(value, key) {
|
|
159
|
+
if (typeof value !== "object" || value === null)
|
|
160
|
+
return [];
|
|
161
|
+
const entries = value[key];
|
|
162
|
+
if (!Array.isArray(entries))
|
|
163
|
+
return [];
|
|
164
|
+
const nameKey = key === "fields" ? "name" : "parameterName";
|
|
165
|
+
return entries.flatMap((entry) => {
|
|
166
|
+
if (typeof entry !== "object" || entry === null || Array.isArray(entry))
|
|
167
|
+
return [];
|
|
168
|
+
const name = entry[nameKey];
|
|
169
|
+
return typeof name === "string" && name !== "" ? [name] : [];
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
/** Convert a skill def() payload's closed tool envelopes to analyzer input. */
|
|
173
|
+
export function coverageToolsFromWire(entries) {
|
|
174
|
+
return entries.flatMap((entry) => {
|
|
175
|
+
const typeKey = Object.keys(entry)[0];
|
|
176
|
+
const inner = typeKey === undefined ? undefined : entry[typeKey];
|
|
177
|
+
if (typeof inner !== "object" || inner === null || Array.isArray(inner))
|
|
178
|
+
return [];
|
|
179
|
+
const name = inner["name"];
|
|
180
|
+
if (typeof name !== "string" || name === "")
|
|
181
|
+
return [];
|
|
182
|
+
return [{ name, fields: stringsAt(inner, "fields"), inputs: stringsAt(inner, "inputs") }];
|
|
183
|
+
});
|
|
184
|
+
}
|
|
@@ -102,7 +102,9 @@ export const skillModule = {
|
|
|
102
102
|
workspaceAspects: ctx.workspaceAspects,
|
|
103
103
|
serviceAccounts: ctx.streamRootEntity?.payload?.serviceAccounts,
|
|
104
104
|
diagnostics: ctx.diagnostics,
|
|
105
|
+
reports: ctx.reports,
|
|
105
106
|
...(ctx.siblingEntities !== undefined && { siblingEntities: ctx.siblingEntities }),
|
|
107
|
+
...(ctx.activeAutomationRefNames !== undefined && { activeAutomationRefNames: ctx.activeAutomationRefNames }),
|
|
106
108
|
}),
|
|
107
109
|
},
|
|
108
110
|
catalog: {
|
|
@@ -27,6 +27,8 @@ export interface SkillToTfContext {
|
|
|
27
27
|
readonly serviceAccounts?: Readonly<Record<string, AppServiceAccount>>;
|
|
28
28
|
/** Degradations land here — reported by the caller, never silent. */
|
|
29
29
|
readonly diagnostics: string[];
|
|
30
|
+
/** Informational reports are surfaced separately from actionable diagnostics. */
|
|
31
|
+
readonly reports?: string[];
|
|
30
32
|
/**
|
|
31
33
|
* Every skill entity discovered for this app (self included) — forwarded
|
|
32
34
|
* by build.ts, unordered. Used to replicate ei's cross-skill tool-label
|
|
@@ -35,6 +37,7 @@ export interface SkillToTfContext {
|
|
|
35
37
|
* gets the bare label, matching the pre-#310 behavior for a single skill.
|
|
36
38
|
*/
|
|
37
39
|
readonly siblingEntities?: readonly DeployableEntity[];
|
|
40
|
+
readonly activeAutomationRefNames?: ReadonlySet<string>;
|
|
38
41
|
}
|
|
39
42
|
export interface SkillToTfResult {
|
|
40
43
|
readonly blocks: readonly TfBlock[];
|
|
@@ -18,6 +18,7 @@ import { appScopedResourceLabel, expr, sanitizeName, tsLabelToTfLabel } from "..
|
|
|
18
18
|
import { skillToolToTf } from "../skill-tool/to-tf.js";
|
|
19
19
|
import { APP_RESOURCE_TYPE } from "../app/module.js";
|
|
20
20
|
import { SERVICE_ACCOUNT_RESOURCE_TYPE } from "../service-account/module.js";
|
|
21
|
+
import { analyzeSkillInputCoverage, coverageToolsFromWire, skillCoverageGapDiagnostics, skillCoverageReportLines, } from "./input-coverage.js";
|
|
21
22
|
import { SKILL_RESOURCE_TYPE } from "./module.js";
|
|
22
23
|
function serviceAccountValue(name, ctx) {
|
|
23
24
|
const matches = Object.entries(ctx.serviceAccounts ?? {}).filter(([, account]) => `${account.firstName} ${account.lastName}`.trim() === name);
|
|
@@ -103,6 +104,9 @@ export function skillToTf(entity, ctx) {
|
|
|
103
104
|
}
|
|
104
105
|
const tfLabel = appScopedResourceLabel(ctx.appTfLabel, tsLabelToTfLabel(entity.refName));
|
|
105
106
|
const name = elementum.name ?? "";
|
|
107
|
+
const coverage = analyzeSkillInputCoverage(name, elementum.instructions ?? "", coverageToolsFromWire(payload.tools ?? []));
|
|
108
|
+
ctx.reports?.push(...skillCoverageReportLines(coverage));
|
|
109
|
+
ctx.diagnostics.push(...skillCoverageGapDiagnostics(coverage));
|
|
106
110
|
const attrs = {
|
|
107
111
|
owner_id: expr.resourceAttr(APP_RESOURCE_TYPE, ctx.appTfLabel, ["id"]),
|
|
108
112
|
owner_type: "APP_ASPECT",
|
|
@@ -123,8 +127,9 @@ export function skillToTf(entity, ctx) {
|
|
|
123
127
|
appTfLabel: ctx.appTfLabel,
|
|
124
128
|
skillTfLabel: tfLabel,
|
|
125
129
|
labelSuffix: toolLabelSuffixes.get(`${entity.refName}#${index}`) ?? "",
|
|
126
|
-
|
|
127
|
-
|
|
130
|
+
...(ctx.activeAutomationRefNames !== undefined && { activeAutomationRefNames: ctx.activeAutomationRefNames }),
|
|
131
|
+
foreignAppRef: (l, n, ns) => ctx.orgRefs.foreignApp(l, n, ns),
|
|
132
|
+
foreignElementRef: (l, n, ns) => ctx.orgRefs.foreignElement(l, n, ns),
|
|
128
133
|
foreignFieldRef: (t, l, o, n) => ctx.orgRefs.foreignField(t, l, o, n),
|
|
129
134
|
workspaceAspects: ctx.workspaceAspects,
|
|
130
135
|
serviceAccountRef: (_label, serviceAccountName) => serviceAccountValue(serviceAccountName, ctx),
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import type { AgentRef, AppCatalogRef, AutomationCatalogRef, ElementCatalogRef, FieldRef, SearchTableRef } from "../../catalog/index.js";
|
|
13
13
|
import type { UnsafePlatformId } from "../../core/platform-id.js";
|
|
14
|
-
import type { AgentToolRunAs, RunAutomationToolV2 } from "../agent/tools.js";
|
|
14
|
+
import type { AgentToolRunAs, RunAutomationOptionalInput, RunAutomationOutput, RunAutomationToolV2 } from "../agent/tools.js";
|
|
15
15
|
declare const skillToolBrand: unique symbol;
|
|
16
16
|
/** A closed factory result; arbitrary records cannot be added to a skill's tool list. */
|
|
17
17
|
export type SkillTool = Record<string, unknown> & {
|
|
@@ -77,7 +77,16 @@ export type AutomationToolV2<A extends AutomationCatalogRef = AutomationCatalogR
|
|
|
77
77
|
* Run an on-demand automation with input/output record keys constrained by
|
|
78
78
|
* the selected automation's generated catalog type. Required trigger params
|
|
79
79
|
* must be mapped and output keys autocomplete, matching agentRunAutomation.
|
|
80
|
+
*
|
|
81
|
+
* When ei exported a bare `automation_id` UUID (no in-stream automation
|
|
82
|
+
* resource), pass `unsafePlatformId(...)` so rebuild keeps that tool.
|
|
80
83
|
*/
|
|
84
|
+
export declare function skillAutomation(opts: CommonToolOptions & {
|
|
85
|
+
readonly automation: UnsafePlatformId;
|
|
86
|
+
readonly status?: SkillToolStatus;
|
|
87
|
+
readonly inputs?: Record<string, RunAutomationOptionalInput>;
|
|
88
|
+
readonly outputs?: Record<string, RunAutomationOutput | undefined>;
|
|
89
|
+
}): SkillTool;
|
|
81
90
|
export declare function skillAutomation<A extends AutomationCatalogRef>(opts: AutomationToolV2<A>): SkillTool;
|
|
82
91
|
export type SkillSearchRecordsToolOptions<Target extends ToolTarget = ToolTarget> = CommonToolOptions & TargetOption<Target> & {
|
|
83
92
|
readonly queryDescription: string;
|
|
@@ -64,11 +64,6 @@ function recordFieldToken(f) {
|
|
|
64
64
|
...(f.defaultValue !== undefined ? { defaultValue: f.defaultValue } : {}),
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
-
/**
|
|
68
|
-
* Run an on-demand automation with input/output record keys constrained by
|
|
69
|
-
* the selected automation's generated catalog type. Required trigger params
|
|
70
|
-
* must be mapped and output keys autocomplete, matching agentRunAutomation.
|
|
71
|
-
*/
|
|
72
67
|
export function skillAutomation(opts) {
|
|
73
68
|
const inputEntries = Object.entries((opts.inputs ?? {}));
|
|
74
69
|
const inputs = inputEntries.map(([parameterName, spec]) => ({
|
|
@@ -28,10 +28,24 @@ export type NormalizedSkillToolTarget = {
|
|
|
28
28
|
/** A foreign app via `data.elementum_app.<label>` — `name` from the stream's data block. */
|
|
29
29
|
readonly kind: "foreignApp";
|
|
30
30
|
readonly name: string;
|
|
31
|
+
readonly refName?: string;
|
|
32
|
+
readonly namespace?: string;
|
|
31
33
|
} | {
|
|
32
34
|
/** A foreign ELEMENT via `data.elementum_element.<label>` — `name` from the stream's data block (board issue #42). */
|
|
33
35
|
readonly kind: "foreignElement";
|
|
34
36
|
readonly name: string;
|
|
37
|
+
readonly refName?: string;
|
|
38
|
+
readonly namespace?: string;
|
|
39
|
+
} | {
|
|
40
|
+
/**
|
|
41
|
+
* `target_id` didn't resolve to any portable reference at export
|
|
42
|
+
* time (ei fell back to a bare platform UUID — board issue #648).
|
|
43
|
+
* Kept, not dropped, so the tool's other data (fields, description,
|
|
44
|
+
* …) survives the pull; the printer marks it with a TODO instead of
|
|
45
|
+
* silently losing the whole tool.
|
|
46
|
+
*/
|
|
47
|
+
readonly kind: "unresolved";
|
|
48
|
+
readonly uuid: string;
|
|
35
49
|
};
|
|
36
50
|
export interface NormalizedSkillTool {
|
|
37
51
|
readonly typeKey: "createRecord" | "searchAspect" | "searchTable" | "updateRecord" | "runAgent" | "automation";
|
|
@@ -48,6 +62,11 @@ export interface NormalizedSkillTool {
|
|
|
48
62
|
readonly targetAgentKey?: string;
|
|
49
63
|
readonly workerTaskPrompt?: string;
|
|
50
64
|
readonly automationKey?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Bare `automation_id` UUID when ei exported no resource/data reference
|
|
67
|
+
* (out-of-stream automation). Printed as `unsafePlatformId(...)`.
|
|
68
|
+
*/
|
|
69
|
+
readonly automationRawId?: string;
|
|
51
70
|
readonly searchTableKey?: string;
|
|
52
71
|
/** Foreign table lookup name when search_table_id is data.elementum_search_table. */
|
|
53
72
|
readonly searchTableName?: string;
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { EntityTfError } from "../../engine/entity.js";
|
|
8
8
|
import { dataRefLabel, optionalString, resourceRefLabel } from "../../engine/pull/context.js";
|
|
9
9
|
import { isTfExpr, scopedLabelToBagKey } from "../../engine/tf/index.js";
|
|
10
|
+
import { dataAspectDisplayName, dataAspectRefName } from "../shared/aspect-target-from-tf.js";
|
|
10
11
|
import { resolveToolFieldKey } from "../shared/tool-field-ref.js";
|
|
11
12
|
import { KNOWN_SKILL_TOOL_ATTRS, SKILL_TOOL_SUB_TYPE_BY_RESOURCE, UNAUTHORABLE_SKILL_TOOL_ATTRS, } from "./types.js";
|
|
12
13
|
/**
|
|
@@ -126,7 +127,8 @@ export function skillToolFromTf(block, owner, ctx) {
|
|
|
126
127
|
(automation.type === "elementum_workflow_publish" || automation.type === "elementum_automation")
|
|
127
128
|
? automation.label
|
|
128
129
|
: undefined;
|
|
129
|
-
|
|
130
|
+
const automationRawId = typeof automation === "string" && automation !== "" ? automation : undefined;
|
|
131
|
+
if (automationLabel === undefined && automationRawId === undefined) {
|
|
130
132
|
ctx.diagnostics.push(`${where}: automation_id is not an automation/workflow_publish resource reference; skipped`);
|
|
131
133
|
return undefined;
|
|
132
134
|
}
|
|
@@ -171,10 +173,12 @@ export function skillToolFromTf(block, owner, ctx) {
|
|
|
171
173
|
// holds by observed export convention, not by contract, and a silent
|
|
172
174
|
// miss here would reproduce the exact tsc-failing call this fix is for,
|
|
173
175
|
// with no diagnostic to explain why.
|
|
174
|
-
const trigger =
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
const trigger = automationLabel === undefined
|
|
177
|
+
? undefined
|
|
178
|
+
: ctx.resourcesOfType?.("elementum_on_demand_trigger").find((block) => {
|
|
179
|
+
const ref = block.attrs["automation"];
|
|
180
|
+
return isTfExpr(ref) && ref.$expr === "resource-attr" && ref.type === "elementum_automation" && ref.label === automationLabel;
|
|
181
|
+
});
|
|
178
182
|
const missingRequiredInputs = [];
|
|
179
183
|
for (const item of Array.isArray(trigger?.attrs["parameters"]) ? trigger.attrs["parameters"] : []) {
|
|
180
184
|
if (typeof item !== "object" || item === null || Array.isArray(item) || isTfExpr(item))
|
|
@@ -203,7 +207,9 @@ export function skillToolFromTf(block, owner, ctx) {
|
|
|
203
207
|
return {
|
|
204
208
|
typeKey: "automation",
|
|
205
209
|
...common,
|
|
206
|
-
|
|
210
|
+
...(automationRawId !== undefined
|
|
211
|
+
? { automationRawId }
|
|
212
|
+
: { automationKey: scopedLabelToBagKey(owner.ownerTfLabel, automationLabel) }),
|
|
207
213
|
...(inputs.length > 0 && { inputs }),
|
|
208
214
|
...(outputs.length > 0 && { outputs }),
|
|
209
215
|
...(missingRequiredInputs.length > 0 && { missingRequiredInputs }),
|
|
@@ -254,25 +260,48 @@ export function skillToolFromTf(block, owner, ctx) {
|
|
|
254
260
|
target = { kind: "self" };
|
|
255
261
|
}
|
|
256
262
|
else if (isTfExpr(targetAttr) && targetAttr.$expr === "data-attr" && targetAttr.type === "elementum_app") {
|
|
257
|
-
const appName = ctx
|
|
263
|
+
const appName = dataAspectDisplayName(ctx, "app", targetAttr.label);
|
|
258
264
|
if (appName === undefined) {
|
|
259
265
|
ctx.diagnostics.push(`${where}: target_id references data.elementum_app.${targetAttr.label} but the stream has no such data block; skipped`);
|
|
260
266
|
return undefined;
|
|
261
267
|
}
|
|
262
|
-
|
|
268
|
+
const attrs = ctx.dataAttrs?.("elementum_app", targetAttr.label);
|
|
269
|
+
const namespace = typeof attrs?.namespace === "string" ? attrs.namespace : undefined;
|
|
270
|
+
const refName = dataAspectRefName(ctx, "app", targetAttr.label, appName);
|
|
271
|
+
target = {
|
|
272
|
+
kind: "foreignApp",
|
|
273
|
+
name: appName,
|
|
274
|
+
...(refName !== undefined && { refName }),
|
|
275
|
+
...(namespace !== undefined && { namespace }),
|
|
276
|
+
};
|
|
263
277
|
fieldScopeLabel = targetAttr.label;
|
|
264
278
|
}
|
|
265
279
|
else if (isTfExpr(targetAttr) && targetAttr.$expr === "data-attr" && targetAttr.type === "elementum_element") {
|
|
266
280
|
// Board issue #42: an aspect target can be an element, not just an app.
|
|
267
|
-
const elementName = ctx
|
|
281
|
+
const elementName = dataAspectDisplayName(ctx, "element", targetAttr.label);
|
|
268
282
|
if (elementName === undefined) {
|
|
269
283
|
ctx.diagnostics.push(`${where}: target_id references data.elementum_element.${targetAttr.label} but the stream has no such data block; skipped`);
|
|
270
284
|
return undefined;
|
|
271
285
|
}
|
|
272
|
-
|
|
286
|
+
const attrs = ctx.dataAttrs?.("elementum_element", targetAttr.label);
|
|
287
|
+
const namespace = typeof attrs?.namespace === "string" ? attrs.namespace : undefined;
|
|
288
|
+
const refName = dataAspectRefName(ctx, "element", targetAttr.label, elementName);
|
|
289
|
+
target = {
|
|
290
|
+
kind: "foreignElement",
|
|
291
|
+
name: elementName,
|
|
292
|
+
...(refName !== undefined && { refName }),
|
|
293
|
+
...(namespace !== undefined && { namespace }),
|
|
294
|
+
};
|
|
273
295
|
fieldScopeLabel = targetAttr.label;
|
|
274
296
|
fieldScope = "element";
|
|
275
297
|
}
|
|
298
|
+
else if (typeof targetAttr === "string") {
|
|
299
|
+
// No portable reference was available at export time (ei fell back to
|
|
300
|
+
// the raw platform UUID) — keep the tool with an unresolved target
|
|
301
|
+
// instead of dropping it entirely (board issue #648).
|
|
302
|
+
ctx.diagnostics.push(`${where}: target_id could not be resolved to a portable reference ("${targetAttr}"); kept as unresolved`);
|
|
303
|
+
target = { kind: "unresolved", uuid: targetAttr };
|
|
304
|
+
}
|
|
276
305
|
else {
|
|
277
306
|
ctx.diagnostics.push(`${where}: target_id has an unrecognized shape (${JSON.stringify(targetAttr)}); skipped`);
|
|
278
307
|
return undefined;
|
|
@@ -287,7 +316,7 @@ export function skillToolFromTf(block, owner, ctx) {
|
|
|
287
316
|
continue;
|
|
288
317
|
}
|
|
289
318
|
const rec = item;
|
|
290
|
-
const fieldKey = resolveToolFieldKey(rec["field_id"], fieldScopeLabel, fieldScope);
|
|
319
|
+
const fieldKey = resolveToolFieldKey(rec["field_id"], fieldScopeLabel, fieldScope, ctx);
|
|
291
320
|
// A field on a foreign/out-of-scope aspect has no field resource ei
|
|
292
321
|
// can reference — it falls back to a bare platform id, confirmed live
|
|
293
322
|
// (board issue #169). Preserve it (raw-id TODO placeholder) rather
|
|
@@ -23,15 +23,17 @@ export interface SkillToolToTfContext {
|
|
|
23
23
|
*/
|
|
24
24
|
readonly labelSuffix?: string;
|
|
25
25
|
/** Records a foreign-app data lookup for data.tf; returns its tfLabel. */
|
|
26
|
-
foreignAppRef(tfLabel: string, name: string): void;
|
|
26
|
+
foreignAppRef(tfLabel: string, name: string, namespace?: string): void;
|
|
27
27
|
/** Records a foreign-ELEMENT data lookup for data.tf (board issue #42). */
|
|
28
|
-
foreignElementRef(tfLabel: string, name: string): void;
|
|
28
|
+
foreignElementRef(tfLabel: string, name: string, namespace?: string): void;
|
|
29
29
|
/** Records an object-scoped data lookup owned by a foreign app/element. */
|
|
30
30
|
foreignFieldRef(type: string, tfLabel: string, objectId: TfValue, name: string): void;
|
|
31
31
|
/** App/element roots authored in this same workspace. */
|
|
32
32
|
readonly workspaceAspects?: ReadonlyMap<string, WorkspaceAspect>;
|
|
33
33
|
/** Records an app-scoped service-account lookup by name. */
|
|
34
34
|
serviceAccountRef?(tfLabel: string, name: string): TfValue | void;
|
|
35
|
+
/** App-local automations whose publish resource will be emitted in this build. */
|
|
36
|
+
readonly activeAutomationRefNames?: ReadonlySet<string>;
|
|
35
37
|
/** Degradations land here — reported by the caller, never silent. */
|
|
36
38
|
readonly diagnostics: string[];
|
|
37
39
|
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* Mirrors `entities/agent-tool/to-tf.ts`.
|
|
8
8
|
*/
|
|
9
9
|
import { workspaceAspectKey } from "../../engine/build/context.js";
|
|
10
|
+
import { automationRunTargetResourceAttr } from "../automation/to-tf.js";
|
|
10
11
|
import { appScopedResourceLabel, expr, sanitizeName, scopedResourceLabel, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
11
12
|
import { fieldRefToTfValue } from "../field/to-tf.js";
|
|
12
13
|
import { SKILL_TOOL_SUB_TYPE_BY_TYPE_KEY } from "./types.js";
|
|
@@ -49,12 +50,11 @@ function targetIdValue(token, ctx) {
|
|
|
49
50
|
localTfLabel: sibling.tfLabel,
|
|
50
51
|
};
|
|
51
52
|
}
|
|
52
|
-
// ei derives foreign-app/foreign-element data labels from the display NAME.
|
|
53
53
|
const name = token.name ?? refName;
|
|
54
|
-
const tfLabel = sanitizeName(name);
|
|
54
|
+
const tfLabel = sanitizeName(token.namespace ?? name);
|
|
55
55
|
// Board issue #42: an aspect token can be an element, not just an app.
|
|
56
56
|
if (kind === "element") {
|
|
57
|
-
ctx.foreignElementRef(tfLabel, name);
|
|
57
|
+
ctx.foreignElementRef(tfLabel, name, token.namespace);
|
|
58
58
|
return {
|
|
59
59
|
value: expr.dataAttr("elementum_element", tfLabel, ["id"]),
|
|
60
60
|
refName,
|
|
@@ -62,7 +62,7 @@ function targetIdValue(token, ctx) {
|
|
|
62
62
|
foreignTfLabel: tfLabel,
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
ctx.foreignAppRef(tfLabel, name);
|
|
65
|
+
ctx.foreignAppRef(tfLabel, name, token.namespace);
|
|
66
66
|
return {
|
|
67
67
|
value: expr.dataAttr("elementum_app", tfLabel, ["id"]),
|
|
68
68
|
refName,
|
|
@@ -168,20 +168,28 @@ export function skillToolToTf(entry, ctx) {
|
|
|
168
168
|
}
|
|
169
169
|
if (typeKey === "automation") {
|
|
170
170
|
const automation = inner.automationId;
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
: typeof automation?.name === "string" && automation.name !== ""
|
|
174
|
-
? sanitizeName(automation.name)
|
|
175
|
-
: undefined;
|
|
176
|
-
if (automationTfLabel === undefined) {
|
|
177
|
-
ctx.diagnostics.push(`${where}: no target automation token; dropped`);
|
|
178
|
-
return undefined;
|
|
171
|
+
if (automation?.__unsafe === "platformId" && typeof automation.value === "string" && automation.value !== "") {
|
|
172
|
+
attrs["automation_id"] = automation.value;
|
|
179
173
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
174
|
+
else {
|
|
175
|
+
const automationTfLabel = typeof automation?.refName === "string" && automation.refName !== ""
|
|
176
|
+
? tsLabelToTfLabel(automation.refName)
|
|
177
|
+
: typeof automation?.name === "string" && automation.name !== ""
|
|
178
|
+
? sanitizeName(automation.name)
|
|
179
|
+
: undefined;
|
|
180
|
+
if (automationTfLabel === undefined) {
|
|
181
|
+
ctx.diagnostics.push(`${where}: no target automation token; dropped`);
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
184
|
+
if (automation?.parent !== undefined && automation.parent !== ctx.appRefName) {
|
|
185
|
+
ctx.diagnostics.push(`${where}: cross-app automation targets are not supported; dropped`);
|
|
186
|
+
return undefined;
|
|
187
|
+
}
|
|
188
|
+
const automationRefName = typeof automation?.refName === "string" && automation.refName !== ""
|
|
189
|
+
? automation.refName
|
|
190
|
+
: automationTfLabel;
|
|
191
|
+
attrs["automation_id"] = automationRunTargetResourceAttr(ctx.appTfLabel, automationRefName, ctx.activeAutomationRefNames);
|
|
183
192
|
}
|
|
184
|
-
attrs["automation_id"] = expr.resourceAttr("elementum_workflow_publish", appScopedResourceLabel(ctx.appTfLabel, automationTfLabel), ["id"]);
|
|
185
193
|
if (inner.inputs !== undefined && inner.inputs.length > 0) {
|
|
186
194
|
attrs["inputs"] = inner.inputs.map((input) => ({
|
|
187
195
|
parameter_name: input.parameterName ?? "",
|
|
@@ -24,6 +24,9 @@ function aspectId(ref, orgRefs, workspaceAspects, diagnostics, where = "table as
|
|
|
24
24
|
return ref;
|
|
25
25
|
const name = ref.name ?? ref.refName ?? "";
|
|
26
26
|
if (ref.__kind === "table") {
|
|
27
|
+
const local = workspaceAspects?.get(workspaceAspectKey("table", ref.refName ?? ""));
|
|
28
|
+
if (local !== undefined)
|
|
29
|
+
return expr.resourceAttr(TABLE_RESOURCE_TYPE, local.tfLabel, ["id"]);
|
|
27
30
|
return resolveForeignRef("table", { name }, orgRefs, diagnostics, where).value;
|
|
28
31
|
}
|
|
29
32
|
if (ref.__kind === "element") {
|
|
@@ -41,6 +44,9 @@ function aspectId(ref, orgRefs, workspaceAspects, diagnostics, where = "table as
|
|
|
41
44
|
throw new EntityTfError(`table source must be an app, element, table, or raw id`);
|
|
42
45
|
}
|
|
43
46
|
function fieldId(value, orgRefs, ownRef, ownLabel, ownColumnNames, workspaceAspects, diagnostics) {
|
|
47
|
+
if (value === undefined || value === null) {
|
|
48
|
+
throw new EntityTfError(`table column source is missing — usually org.tables.<source>.columns.<key> did not resolve (re-pull the source table, or check the catalog column key)`);
|
|
49
|
+
}
|
|
44
50
|
if (typeof value === "string")
|
|
45
51
|
return value;
|
|
46
52
|
if (value !== null &&
|
|
@@ -60,8 +66,19 @@ function fieldId(value, orgRefs, ownRef, ownLabel, ownColumnNames, workspaceAspe
|
|
|
60
66
|
{ index: name },
|
|
61
67
|
]);
|
|
62
68
|
}
|
|
69
|
+
// A column of a table this same build owns resolves straight to that
|
|
70
|
+
// table's `field_ids`. `ref.parent` is the source table's refName, not its
|
|
71
|
+
// display name, so the foreign path below would look it up under a name
|
|
72
|
+
// the platform has never heard of.
|
|
73
|
+
const sibling = workspaceAspects?.get(workspaceAspectKey("table", ref.parent ?? ""));
|
|
74
|
+
if (sibling !== undefined) {
|
|
75
|
+
return expr.resourceAttr(TABLE_RESOURCE_TYPE, sibling.tfLabel, [
|
|
76
|
+
"field_ids",
|
|
77
|
+
{ index: ref.name ?? ref.refName ?? "" },
|
|
78
|
+
]);
|
|
79
|
+
}
|
|
63
80
|
const tableLabel = sanitizeName(ref.parent ?? "table");
|
|
64
|
-
orgRefs.rawLookup("elementum_table", tableLabel, ref.parent ?? "");
|
|
81
|
+
orgRefs.rawLookup("elementum_table", tableLabel, ref.parentName ?? ref.parent ?? "");
|
|
65
82
|
const fieldLabel = sanitizeName(`${ref.parent ?? "table"}_${ref.refName ?? ref.name ?? "field"}`);
|
|
66
83
|
orgRefs.foreignField("elementum_field", fieldLabel, expr.dataAttr("elementum_table", tableLabel, ["id"]), ref.name ?? ref.refName ?? "");
|
|
67
84
|
return expr.dataAttr("elementum_field", fieldLabel, ["id"]);
|
|
@@ -53,6 +53,10 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
53
53
|
const attrs = {
|
|
54
54
|
aspect_id: objectId,
|
|
55
55
|
name: view.name ?? "",
|
|
56
|
+
// Prefer an explicit authoring value. When pull omitted the attr (ei used
|
|
57
|
+
// to skip `false`), leave the wire unset only if we never captured it —
|
|
58
|
+
// defaulting to `true` planned false→true against live views that
|
|
59
|
+
// disallow create. Platform default when unset on create is still true.
|
|
56
60
|
allow_record_creation: view.allowRecordCreation ?? true,
|
|
57
61
|
columns: resolveFieldRefs(view.columns ?? [], ownerTfLabel, scope, `${where}.columns`, diagnostics),
|
|
58
62
|
density: view.density ?? "STANDARD",
|
|
@@ -64,6 +68,7 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
64
68
|
scope,
|
|
65
69
|
objectId,
|
|
66
70
|
diagnostics,
|
|
71
|
+
resolvePicklistLiterals: false,
|
|
67
72
|
});
|
|
68
73
|
}
|
|
69
74
|
if (view.sort !== undefined)
|
|
@@ -105,7 +110,7 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
105
110
|
}
|
|
106
111
|
}
|
|
107
112
|
if (view.filter !== undefined)
|
|
108
|
-
attrs["filter"] = filterToTf(view.filter, `${where}.filter`, { ownerTfLabel, scope, objectId, diagnostics });
|
|
113
|
+
attrs["filter"] = filterToTf(view.filter, `${where}.filter`, { ownerTfLabel, scope, objectId, diagnostics, resolvePicklistLiterals: false });
|
|
109
114
|
if (view.sort !== undefined)
|
|
110
115
|
attrs["sort"] = managedViewSortToTf(view.sort, ownerTfLabel, scope, `${where}.sort`, diagnostics);
|
|
111
116
|
appendViewSharingAttrs(attrs, view, where, principalCtx);
|
|
@@ -147,7 +152,7 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
147
152
|
allow_record_creation: view.allowRecordCreation ?? true,
|
|
148
153
|
};
|
|
149
154
|
if (view.filter !== undefined)
|
|
150
|
-
attrs["filter"] = filterToTf(view.filter, `dashboardViews.${viewKey}.filter`, { ownerTfLabel, scope, objectId, diagnostics });
|
|
155
|
+
attrs["filter"] = filterToTf(view.filter, `dashboardViews.${viewKey}.filter`, { ownerTfLabel, scope, objectId, diagnostics, resolvePicklistLiterals: false });
|
|
151
156
|
if (view.sort !== undefined)
|
|
152
157
|
attrs["sort"] = managedViewSortToTf(view.sort, ownerTfLabel, scope, `dashboardViews.${viewKey}.sort`, diagnostics);
|
|
153
158
|
appendViewSharingAttrs(attrs, view, `dashboardViews.${viewKey}`, principalCtx);
|
|
@@ -180,7 +185,7 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
180
185
|
allow_record_creation: view.allowRecordCreation ?? true,
|
|
181
186
|
};
|
|
182
187
|
if (view.filter !== undefined)
|
|
183
|
-
attrs["filter"] = filterToTf(view.filter, `agentViews.${viewKey}.filter`, { ownerTfLabel, scope, objectId, diagnostics });
|
|
188
|
+
attrs["filter"] = filterToTf(view.filter, `agentViews.${viewKey}.filter`, { ownerTfLabel, scope, objectId, diagnostics, resolvePicklistLiterals: false });
|
|
184
189
|
if (view.sort !== undefined)
|
|
185
190
|
attrs["sort"] = managedViewSortToTf(view.sort, ownerTfLabel, scope, `agentViews.${viewKey}.sort`, diagnostics);
|
|
186
191
|
appendViewSharingAttrs(attrs, view, `agentViews.${viewKey}`, principalCtx);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EntityTfError } from "../../engine/entity.js";
|
|
2
2
|
import { plainObject, resourceRefLabel } from "../../engine/pull/context.js";
|
|
3
3
|
import { isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
4
|
+
import { dataAspectDisplayName, dataAspectRefName } from "../shared/aspect-target-from-tf.js";
|
|
4
5
|
import { VISUAL_FLOW_RESOURCE_TYPE } from "./module.js";
|
|
5
6
|
const KNOWN = new Set(["id", "object_id", "stages"]);
|
|
6
7
|
const symbols = new Set(["SQUARE", "DIAMOND", "CIRCLE"]);
|
|
@@ -28,8 +29,11 @@ function objectRef(value, ctx, where) {
|
|
|
28
29
|
throw new EntityTfError(`${where}: expected an elementum_app or elementum_element reference`);
|
|
29
30
|
}
|
|
30
31
|
const kind = value.type === "elementum_element" ? "element" : "app";
|
|
31
|
-
const
|
|
32
|
-
|
|
32
|
+
const displayName = value.$expr === "data-attr" ? dataAspectDisplayName(ctx, kind, value.label) : undefined;
|
|
33
|
+
const refName = value.$expr === "data-attr"
|
|
34
|
+
? dataAspectRefName(ctx, kind, value.label, displayName) ?? tfLabelToTsLabel(value.label)
|
|
35
|
+
: tfLabelToTsLabel(value.label);
|
|
36
|
+
return { kind, refName, name: displayName ?? refName };
|
|
33
37
|
}
|
|
34
38
|
function actionFromTf(value, ownerLabel, scope, ctx, where) {
|
|
35
39
|
const action = requiredObject(value, where);
|
|
@@ -336,6 +336,7 @@ export interface BuildChildContext {
|
|
|
336
336
|
readonly parentScope?: ChildResourceScope | "table";
|
|
337
337
|
readonly orgRefs: unknown;
|
|
338
338
|
readonly diagnostics: string[];
|
|
339
|
+
readonly reports?: string[];
|
|
339
340
|
readonly fieldAddresses?: ReadonlyMap<string, string>;
|
|
340
341
|
readonly fieldNames?: ReadonlyMap<string, string>;
|
|
341
342
|
readonly fieldMetadata?: ReadonlyMap<string, BuildFieldMetadata>;
|
|
@@ -368,6 +369,8 @@ export interface BuildChildContext {
|
|
|
368
369
|
* cross-sibling disambiguation instead of emitting a colliding address.
|
|
369
370
|
*/
|
|
370
371
|
readonly siblingEntities?: readonly DeployableEntity[];
|
|
372
|
+
/** App-local automations whose workflow_publish block is emitted in this build. */
|
|
373
|
+
readonly activeAutomationRefNames?: ReadonlySet<string>;
|
|
371
374
|
/**
|
|
372
375
|
* The build's shared `locals.tf` attrs map, mutated in place — lets an
|
|
373
376
|
* own-file child (e.g. an automation referencing a foreign field) push a
|