@elementumai/edk 0.9.6 → 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 +34 -3
- package/dist-sdk/src/catalog/factories.d.ts +26 -6
- package/dist-sdk/src/catalog/factories.js +41 -6
- 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 +93 -42
- package/dist-sdk/src/catalog/token.js +10 -0
- package/dist-sdk/src/catalog/types.d.ts +42 -3
- package/dist-sdk/src/catalog/types.js +5 -0
- package/dist-sdk/src/core/index.d.ts +2 -2
- 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 +18 -0
- package/dist-sdk/src/core/system-fields.js +21 -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/app.d.ts +14 -9
- 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/core/types/platform.d.ts +1 -1
- package/dist-sdk/src/engine/build/context.d.ts +24 -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 +18 -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/pull/ref-only.d.ts +14 -0
- package/dist-sdk/src/engine/pull/ref-only.js +35 -2
- 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 +24 -4
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +7 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +11 -3
- 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 +144 -3
- 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/module.js +1 -0
- package/dist-sdk/src/entities/agent/to-tf.d.ts +5 -4
- package/dist-sdk/src/entities/agent/to-tf.js +186 -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 +16 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.js +39 -6
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.js +12 -12
- package/dist-sdk/src/entities/agent-tool/types.js +1 -0
- package/dist-sdk/src/entities/app/build.d.ts +44 -24
- package/dist-sdk/src/entities/app/build.js +18 -8
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +15 -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 +79 -14
- 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 +30 -6
- package/dist-sdk/src/entities/automation/build.d.ts +37 -18
- package/dist-sdk/src/entities/automation/build.js +121 -12
- package/dist-sdk/src/entities/automation/catalog-render.js +5 -2
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +8 -10
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +2 -0
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +103 -20
- package/dist-sdk/src/entities/automation/from-tf.d.ts +10 -1
- package/dist-sdk/src/entities/automation/from-tf.js +1165 -91
- package/dist-sdk/src/entities/automation/index.d.ts +1 -1
- package/dist-sdk/src/entities/automation/module.js +15 -5
- 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 +20 -4
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +33 -6
- package/dist-sdk/src/entities/automation/script-code.d.ts +1 -1
- package/dist-sdk/src/entities/automation/script-code.js +168 -36
- 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 +159 -45
- package/dist-sdk/src/entities/automation/tasks.js +60 -47
- package/dist-sdk/src/entities/automation/to-tf.d.ts +7 -1
- package/dist-sdk/src/entities/automation/to-tf.js +816 -87
- 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/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/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 +7 -3
- package/dist-sdk/src/entities/element/from-tf.js +7 -3
- package/dist-sdk/src/entities/element/index.d.ts +3 -2
- package/dist-sdk/src/entities/element/index.js +3 -2
- package/dist-sdk/src/entities/element/to-tf.js +49 -8
- 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.d.ts +6 -0
- package/dist-sdk/src/entities/field/from-tf.js +104 -1
- package/dist-sdk/src/entities/field/locals.js +6 -7
- package/dist-sdk/src/entities/field/module.js +1 -0
- 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 +13 -3
- package/dist-sdk/src/entities/field/to-tf.js +191 -56
- package/dist-sdk/src/entities/field/types.js +2 -0
- 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 +18 -13
- package/dist-sdk/src/entities/relationship/from-tf.js +100 -7
- 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/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 +24 -1
- package/dist-sdk/src/entities/shared/filters/ast.js +4 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +13 -2
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +14 -8
- 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/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/field-types.d.ts +6 -1
- package/dist-sdk/src/entities/shared/types/field-types.js +5 -8
- package/dist-sdk/src/entities/shared/types/platform.d.ts +15 -2
- 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.d.ts +1 -1
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +79 -18
- package/dist-sdk/src/entities/skill/from-tf.d.ts +11 -0
- package/dist-sdk/src/entities/skill/from-tf.js +47 -5
- 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 +89 -0
- package/dist-sdk/src/entities/skill/input-coverage.js +327 -0
- package/dist-sdk/src/entities/skill/module.js +2 -0
- package/dist-sdk/src/entities/skill/to-tf.d.ts +9 -25
- package/dist-sdk/src/entities/skill/to-tf.js +29 -40
- package/dist-sdk/src/entities/skill/tools.d.ts +12 -2
- package/dist-sdk/src/entities/skill/tools.js +3 -6
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +19 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +50 -14
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +9 -7
- package/dist-sdk/src/entities/skill-tool/to-tf.js +29 -23
- package/dist-sdk/src/entities/table/to-tf.js +21 -5
- 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 +49 -30
- package/dist-sdk/src/entities/visual-flow/from-tf.js +6 -2
- 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 +22 -0
- package/package.json +11 -5
|
@@ -0,0 +1,327 @@
|
|
|
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
|
+
export function parseSkillInputDefinition(line) {
|
|
41
|
+
const match = /^\s*[-*]\s+`?([A-Za-z_][A-Za-z0-9_.-]*)`?\s*(?:\(([^)]*)\))?\s*:\s*(.*)$/.exec(line);
|
|
42
|
+
if (match === null || match[1] === undefined)
|
|
43
|
+
return undefined;
|
|
44
|
+
const name = match[1];
|
|
45
|
+
const flag = match[2]?.trim().toLowerCase();
|
|
46
|
+
const required = flag === "required" ? true : undefined;
|
|
47
|
+
const desc = match[3]?.trim();
|
|
48
|
+
return {
|
|
49
|
+
name,
|
|
50
|
+
...(required !== undefined && { required }),
|
|
51
|
+
...(desc !== undefined && desc !== "" && { description: desc }),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export function parseSkillLookupDefinition(line) {
|
|
55
|
+
const match = /^\s*[-*]\s+`?([A-Za-z_][A-Za-z0-9_.-]*)`?\s*:\s*`?([A-Za-z_][A-Za-z0-9_-]*)`?(?:\s*\(([^)]*)\))?\s*$/.exec(line);
|
|
56
|
+
if (match === null || match[1] === undefined || match[2] === undefined)
|
|
57
|
+
return undefined;
|
|
58
|
+
const input = match[1];
|
|
59
|
+
const tool = match[2];
|
|
60
|
+
const source = match[3]?.trim();
|
|
61
|
+
return {
|
|
62
|
+
input,
|
|
63
|
+
tool,
|
|
64
|
+
...(source !== undefined && source !== "" && { source }),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function bulletKey(line) {
|
|
68
|
+
return parseSkillInputDefinition(line)?.name;
|
|
69
|
+
}
|
|
70
|
+
function inputNames(section) {
|
|
71
|
+
return unique(section.lines.map(bulletKey).filter((value) => value !== undefined));
|
|
72
|
+
}
|
|
73
|
+
function lookupBindings(section) {
|
|
74
|
+
const out = [];
|
|
75
|
+
for (const line of section.lines) {
|
|
76
|
+
const parsed = parseSkillLookupDefinition(line);
|
|
77
|
+
if (parsed !== undefined) {
|
|
78
|
+
out.push({ input: parsed.input, tool: parsed.tool });
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return out;
|
|
82
|
+
}
|
|
83
|
+
export function formatSkillInputSchema(inputs) {
|
|
84
|
+
if (inputs.length === 0) {
|
|
85
|
+
return "## Input Schema\n\n- No input fields yet.";
|
|
86
|
+
}
|
|
87
|
+
const lines = ["## Input Schema", ""];
|
|
88
|
+
for (const input of inputs) {
|
|
89
|
+
const requiredStr = input.required === true ? " (required)" : "";
|
|
90
|
+
const desc = input.description !== undefined && input.description !== "" ? `: ${input.description}` : ":";
|
|
91
|
+
lines.push(`- ${input.name}${requiredStr}${desc}`);
|
|
92
|
+
}
|
|
93
|
+
return lines.join("\n");
|
|
94
|
+
}
|
|
95
|
+
export function formatSkillLookupNotes(lookups) {
|
|
96
|
+
if (lookups.length === 0) {
|
|
97
|
+
return "## Lookup Notes\n\n- No lookup tools yet.";
|
|
98
|
+
}
|
|
99
|
+
const lines = ["## Lookup Notes", ""];
|
|
100
|
+
for (const lookup of lookups) {
|
|
101
|
+
const sourceStr = lookup.source ? ` (${lookup.source})` : "";
|
|
102
|
+
lines.push(`- ${lookup.input}: ${lookup.tool}${sourceStr}`);
|
|
103
|
+
}
|
|
104
|
+
return lines.join("\n");
|
|
105
|
+
}
|
|
106
|
+
export function deriveSkillInstructions(baseProse, inputs, lookups) {
|
|
107
|
+
const raw = baseProse?.trim() ?? "";
|
|
108
|
+
if (inputs === undefined && lookups === undefined) {
|
|
109
|
+
return raw;
|
|
110
|
+
}
|
|
111
|
+
const decomposed = decomposeSkillInstructions(raw);
|
|
112
|
+
const effectiveInputs = inputs !== undefined
|
|
113
|
+
? inputs
|
|
114
|
+
: decomposed.inputs.length > 0
|
|
115
|
+
? decomposed.inputs
|
|
116
|
+
: undefined;
|
|
117
|
+
const effectiveLookups = lookups !== undefined
|
|
118
|
+
? lookups
|
|
119
|
+
: decomposed.lookups.length > 0
|
|
120
|
+
? decomposed.lookups
|
|
121
|
+
: undefined;
|
|
122
|
+
const prose = decomposed.prose;
|
|
123
|
+
const sections = [];
|
|
124
|
+
if (prose !== "") {
|
|
125
|
+
sections.push(prose);
|
|
126
|
+
}
|
|
127
|
+
if (effectiveInputs !== undefined && effectiveInputs.length > 0) {
|
|
128
|
+
sections.push(formatSkillInputSchema(effectiveInputs));
|
|
129
|
+
}
|
|
130
|
+
else if (inputs !== undefined && inputs.length === 0) {
|
|
131
|
+
sections.push(formatSkillInputSchema([]));
|
|
132
|
+
}
|
|
133
|
+
if (effectiveLookups !== undefined && effectiveLookups.length > 0) {
|
|
134
|
+
sections.push(formatSkillLookupNotes(effectiveLookups));
|
|
135
|
+
}
|
|
136
|
+
else if (lookups !== undefined && lookups.length === 0) {
|
|
137
|
+
sections.push(formatSkillLookupNotes([]));
|
|
138
|
+
}
|
|
139
|
+
return sections.join("\n\n");
|
|
140
|
+
}
|
|
141
|
+
export function decomposeSkillInstructions(markdown) {
|
|
142
|
+
const lines = markdown.split(/\r?\n/);
|
|
143
|
+
const inputs = [];
|
|
144
|
+
const lookups = [];
|
|
145
|
+
const proseLines = [];
|
|
146
|
+
let currentSection = undefined;
|
|
147
|
+
for (const line of lines) {
|
|
148
|
+
const headerMatch = /^\s*#{1,6}\s+(.+?)\s*$/.exec(line);
|
|
149
|
+
if (headerMatch !== null) {
|
|
150
|
+
const title = headerMatch[1]?.trim().toLowerCase();
|
|
151
|
+
if (title === "input schema") {
|
|
152
|
+
currentSection = "input-schema";
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
else if (title === "lookup notes") {
|
|
156
|
+
currentSection = "lookup-notes";
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
currentSection = undefined;
|
|
161
|
+
proseLines.push(line);
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (currentSection === "input-schema") {
|
|
166
|
+
const trimmed = line.trim();
|
|
167
|
+
if (trimmed === "" || trimmed.toLowerCase() === "- no input fields yet.") {
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
const parsed = parseSkillInputDefinition(line);
|
|
171
|
+
if (parsed !== undefined) {
|
|
172
|
+
inputs.push(parsed);
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
currentSection = undefined;
|
|
176
|
+
proseLines.push(line);
|
|
177
|
+
}
|
|
178
|
+
else if (currentSection === "lookup-notes") {
|
|
179
|
+
const trimmed = line.trim().toLowerCase();
|
|
180
|
+
if (trimmed === "" ||
|
|
181
|
+
trimmed === "- no lookup tools yet." ||
|
|
182
|
+
trimmed === "- no lookup tools are required.") {
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
const parsed = parseSkillLookupDefinition(line);
|
|
186
|
+
if (parsed !== undefined) {
|
|
187
|
+
lookups.push(parsed);
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
currentSection = undefined;
|
|
191
|
+
proseLines.push(line);
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
proseLines.push(line);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
const prose = proseLines.join("\n").trim();
|
|
198
|
+
return { prose, inputs, lookups };
|
|
199
|
+
}
|
|
200
|
+
function mentionsIdentifier(markdown, name) {
|
|
201
|
+
if (name === "")
|
|
202
|
+
return false;
|
|
203
|
+
const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
204
|
+
return new RegExp(`(^|[^A-Za-z0-9_])${escaped}([^A-Za-z0-9_]|$)`).test(markdown);
|
|
205
|
+
}
|
|
206
|
+
function sameName(left, right) {
|
|
207
|
+
return canonicalName(left) === canonicalName(right);
|
|
208
|
+
}
|
|
209
|
+
/** Compare instruction-declared form variables with the deployed tool surface. */
|
|
210
|
+
export function analyzeSkillInputCoverage(skill, instructions, coverageTools) {
|
|
211
|
+
const schema = markdownSection(instructions, "Input Schema");
|
|
212
|
+
const inputs = inputNames(schema);
|
|
213
|
+
const tools = coverageTools.map((entry) => entry.name);
|
|
214
|
+
if (!schema.found) {
|
|
215
|
+
return {
|
|
216
|
+
skill,
|
|
217
|
+
inputs: [],
|
|
218
|
+
tools,
|
|
219
|
+
bindings: [],
|
|
220
|
+
gaps: [{ kind: "input-schema-missing" }],
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
const lookups = lookupBindings(markdownSection(instructions, "Lookup Notes"));
|
|
224
|
+
const gaps = [];
|
|
225
|
+
const bindings = [];
|
|
226
|
+
const coveredTools = new Set();
|
|
227
|
+
for (const input of inputs) {
|
|
228
|
+
const targets = [];
|
|
229
|
+
for (const lookup of lookups.filter((entry) => sameName(entry.input, input))) {
|
|
230
|
+
if (tools.includes(lookup.tool)) {
|
|
231
|
+
targets.push({ kind: "lookup", tool: lookup.tool });
|
|
232
|
+
coveredTools.add(lookup.tool);
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
gaps.push({ kind: "missing-lookup-tool", input, tool: lookup.tool });
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
for (const coverageTool of coverageTools) {
|
|
239
|
+
for (const field of coverageTool.fields.filter((entry) => sameName(entry, input))) {
|
|
240
|
+
targets.push({ kind: "field", tool: coverageTool.name, name: field });
|
|
241
|
+
coveredTools.add(coverageTool.name);
|
|
242
|
+
}
|
|
243
|
+
for (const parameter of coverageTool.inputs.filter((entry) => sameName(entry, input))) {
|
|
244
|
+
targets.push({ kind: "input", tool: coverageTool.name, name: parameter });
|
|
245
|
+
coveredTools.add(coverageTool.name);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
if (targets.length === 0)
|
|
249
|
+
gaps.push({ kind: "missing-field", input });
|
|
250
|
+
bindings.push({ input, targets });
|
|
251
|
+
}
|
|
252
|
+
for (const lookup of lookups) {
|
|
253
|
+
if (!inputs.some((input) => sameName(input, lookup.input))) {
|
|
254
|
+
gaps.push({ kind: "unbound-lookup", input: lookup.input, tool: lookup.tool });
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
for (const coverageTool of coverageTools) {
|
|
258
|
+
if (coveredTools.has(coverageTool.name) || mentionsIdentifier(instructions, coverageTool.name))
|
|
259
|
+
continue;
|
|
260
|
+
gaps.push({ kind: "leftover-tool", tool: coverageTool.name });
|
|
261
|
+
}
|
|
262
|
+
return { skill, inputs, tools, bindings, gaps };
|
|
263
|
+
}
|
|
264
|
+
function describeTarget(target) {
|
|
265
|
+
if (target.kind === "lookup")
|
|
266
|
+
return `lookup tool ${JSON.stringify(target.tool)}`;
|
|
267
|
+
return `tool ${JSON.stringify(target.tool)} ${target.kind} ${JSON.stringify(target.name)}`;
|
|
268
|
+
}
|
|
269
|
+
/** Informational coverage lines emitted on stderr and in JSON `reports`. */
|
|
270
|
+
export function skillCoverageReportLines(report) {
|
|
271
|
+
const lines = [
|
|
272
|
+
`skill ${JSON.stringify(report.skill)} input coverage report: ${report.inputs.length} form variables, ${report.tools.length} tools, ${report.gaps.length} gaps`,
|
|
273
|
+
];
|
|
274
|
+
for (const binding of report.bindings) {
|
|
275
|
+
lines.push(`skill ${JSON.stringify(report.skill)} input coverage: ${JSON.stringify(binding.input)} -> ${binding.targets.length > 0 ? binding.targets.map(describeTarget).join(", ") : "UNBOUND"}`);
|
|
276
|
+
}
|
|
277
|
+
return lines;
|
|
278
|
+
}
|
|
279
|
+
/** Only actionable gaps; these remain warnings and JSON `diagnostics`. */
|
|
280
|
+
export function skillCoverageGapDiagnostics(report) {
|
|
281
|
+
const lines = [];
|
|
282
|
+
for (const gap of report.gaps) {
|
|
283
|
+
if (gap.kind === "input-schema-missing") {
|
|
284
|
+
lines.push(`skill ${JSON.stringify(report.skill)} input coverage gap [input-schema-missing]: instructions have no "## Input Schema" section; tool coverage cannot be verified`);
|
|
285
|
+
}
|
|
286
|
+
else if (gap.kind === "missing-field") {
|
|
287
|
+
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`);
|
|
288
|
+
}
|
|
289
|
+
else if (gap.kind === "missing-lookup-tool") {
|
|
290
|
+
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`);
|
|
291
|
+
}
|
|
292
|
+
else if (gap.kind === "unbound-lookup") {
|
|
293
|
+
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`);
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
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`);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return lines;
|
|
300
|
+
}
|
|
301
|
+
function stringsAt(value, key) {
|
|
302
|
+
if (typeof value !== "object" || value === null)
|
|
303
|
+
return [];
|
|
304
|
+
const entries = value[key];
|
|
305
|
+
if (!Array.isArray(entries))
|
|
306
|
+
return [];
|
|
307
|
+
const nameKey = key === "fields" ? "name" : "parameterName";
|
|
308
|
+
return entries.flatMap((entry) => {
|
|
309
|
+
if (typeof entry !== "object" || entry === null || Array.isArray(entry))
|
|
310
|
+
return [];
|
|
311
|
+
const name = entry[nameKey];
|
|
312
|
+
return typeof name === "string" && name !== "" ? [name] : [];
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
/** Convert a skill def() payload's closed tool envelopes to analyzer input. */
|
|
316
|
+
export function coverageToolsFromWire(entries) {
|
|
317
|
+
return entries.flatMap((entry) => {
|
|
318
|
+
const typeKey = Object.keys(entry)[0];
|
|
319
|
+
const inner = typeKey === undefined ? undefined : entry[typeKey];
|
|
320
|
+
if (typeof inner !== "object" || inner === null || Array.isArray(inner))
|
|
321
|
+
return [];
|
|
322
|
+
const name = inner["name"];
|
|
323
|
+
if (typeof name !== "string" || name === "")
|
|
324
|
+
return [];
|
|
325
|
+
return [{ name, fields: stringsAt(inner, "fields"), inputs: stringsAt(inner, "inputs") }];
|
|
326
|
+
});
|
|
327
|
+
}
|
|
@@ -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: {
|
|
@@ -9,9 +9,8 @@
|
|
|
9
9
|
* repo — not `pristine-refactor`'s older, generic single-tool-resource
|
|
10
10
|
* shape): `owner_id`/`owner_type` as the owning app's resource ref +
|
|
11
11
|
* `"APP_ASPECT"`, `name`/`description`/`instructions`/`status`/`type`/
|
|
12
|
-
* `properties
|
|
13
|
-
*
|
|
14
|
-
* aren't authored yet, so there's nothing to emit for them.
|
|
12
|
+
* `properties`, plus typed discovery/routing fields. Access policy
|
|
13
|
+
* (user_ids/group_ids) is not authored yet.
|
|
15
14
|
*/
|
|
16
15
|
import type { OrgRefLookup, WorkspaceAspect } from "../../engine/build/context.js";
|
|
17
16
|
import { type DeployableEntity } from "../../engine/entity.js";
|
|
@@ -27,37 +26,22 @@ export interface SkillToTfContext {
|
|
|
27
26
|
readonly serviceAccounts?: Readonly<Record<string, AppServiceAccount>>;
|
|
28
27
|
/** Degradations land here — reported by the caller, never silent. */
|
|
29
28
|
readonly diagnostics: string[];
|
|
29
|
+
/** Informational reports are surfaced separately from actionable diagnostics. */
|
|
30
|
+
readonly reports?: string[];
|
|
30
31
|
/**
|
|
31
|
-
* Every skill entity discovered for this app (self included)
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* contexts that don't supply it (e.g. most unit tests): every tool then
|
|
35
|
-
* gets the bare label, matching the pre-#310 behavior for a single skill.
|
|
32
|
+
* Every skill entity discovered for this app (self included). Tool labels
|
|
33
|
+
* are parent-scoped; this remains available to deterministically suffix
|
|
34
|
+
* duplicate tool names within one skill.
|
|
36
35
|
*/
|
|
37
36
|
readonly siblingEntities?: readonly DeployableEntity[];
|
|
37
|
+
readonly activeAutomationRefNames?: ReadonlySet<string>;
|
|
38
38
|
}
|
|
39
39
|
export interface SkillToTfResult {
|
|
40
40
|
readonly blocks: readonly TfBlock[];
|
|
41
41
|
/** The skill's terraform address. */
|
|
42
42
|
readonly address: string;
|
|
43
43
|
}
|
|
44
|
-
/**
|
|
45
|
-
* Mirrors ei's cross-skill tool-name disambiguation (`cmd/elementum/export/
|
|
46
|
-
* imports.go`'s `skillNames`/`toolNames` counting maps) — a same-app,
|
|
47
|
-
* same-named tool on two different skills is not a collision on the
|
|
48
|
-
* platform: ei's exporter walks `app.Skills` (each skill's tools in turn)
|
|
49
|
-
* and gives the first occurrence of a sanitized tool name the bare label,
|
|
50
|
-
* each later occurrence `_1`, `_2`, … Board issue #310's live capture
|
|
51
|
-
* (2026-08-18, against a deliberately-collided app) confirmed the walk
|
|
52
|
-
* order is ascending by the skill's display NAME — not creation order, not
|
|
53
|
-
* authoring-file order. Ordering of tools WITHIN one skill wasn't
|
|
54
|
-
* observable live (each capture skill carried only one tool); authored
|
|
55
|
-
* array order is assumed there pending a capture that can confirm it.
|
|
56
|
-
*
|
|
57
|
-
* Returns suffixes ("" for the first occurrence, "_1", "_2", … after)
|
|
58
|
-
* keyed by `${skillRefName}#${toolIndex}` — the tool's position in its own
|
|
59
|
-
* skill's authored `tools` array, NOT a global index.
|
|
60
|
-
*/
|
|
44
|
+
/** Return deterministic suffixes for duplicate tool names within one skill. */
|
|
61
45
|
export declare function computeToolLabelSuffixes(siblingSkills: readonly DeployableEntity[]): ReadonlyMap<string, string>;
|
|
62
46
|
/** `elementum_agentic_skill` + one tool resource per implemented tool, in the platform's dialect. */
|
|
63
47
|
export declare function skillToTf(entity: DeployableEntity, ctx: SkillToTfContext): SkillToTfResult;
|
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
* repo — not `pristine-refactor`'s older, generic single-tool-resource
|
|
10
10
|
* shape): `owner_id`/`owner_type` as the owning app's resource ref +
|
|
11
11
|
* `"APP_ASPECT"`, `name`/`description`/`instructions`/`status`/`type`/
|
|
12
|
-
* `properties
|
|
13
|
-
*
|
|
14
|
-
* aren't authored yet, so there's nothing to emit for them.
|
|
12
|
+
* `properties`, plus typed discovery/routing fields. Access policy
|
|
13
|
+
* (user_ids/group_ids) is not authored yet.
|
|
15
14
|
*/
|
|
16
15
|
import { EntityTfError } from "../../engine/entity.js";
|
|
17
16
|
import { appScopedResourceLabel, expr, sanitizeName, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
18
17
|
import { skillToolToTf } from "../skill-tool/to-tf.js";
|
|
19
18
|
import { APP_RESOURCE_TYPE } from "../app/module.js";
|
|
20
19
|
import { SERVICE_ACCOUNT_RESOURCE_TYPE } from "../service-account/module.js";
|
|
20
|
+
import { analyzeSkillInputCoverage, coverageToolsFromWire, skillCoverageGapDiagnostics, skillCoverageReportLines, } from "./input-coverage.js";
|
|
21
21
|
import { SKILL_RESOURCE_TYPE } from "./module.js";
|
|
22
22
|
function serviceAccountValue(name, ctx) {
|
|
23
23
|
const matches = Object.entries(ctx.serviceAccounts ?? {}).filter(([, account]) => `${account.firstName} ${account.lastName}`.trim() === name);
|
|
@@ -40,52 +40,24 @@ function toSortableSkills(entities) {
|
|
|
40
40
|
if (entity.kind !== "skill")
|
|
41
41
|
continue;
|
|
42
42
|
const payload = entity.payload;
|
|
43
|
-
out.push({ refName: entity.refName,
|
|
43
|
+
out.push({ refName: entity.refName, tools: payload?.tools ?? [] });
|
|
44
44
|
}
|
|
45
45
|
return out;
|
|
46
46
|
}
|
|
47
|
-
/**
|
|
48
|
-
* Mirrors ei's cross-skill tool-name disambiguation (`cmd/elementum/export/
|
|
49
|
-
* imports.go`'s `skillNames`/`toolNames` counting maps) — a same-app,
|
|
50
|
-
* same-named tool on two different skills is not a collision on the
|
|
51
|
-
* platform: ei's exporter walks `app.Skills` (each skill's tools in turn)
|
|
52
|
-
* and gives the first occurrence of a sanitized tool name the bare label,
|
|
53
|
-
* each later occurrence `_1`, `_2`, … Board issue #310's live capture
|
|
54
|
-
* (2026-08-18, against a deliberately-collided app) confirmed the walk
|
|
55
|
-
* order is ascending by the skill's display NAME — not creation order, not
|
|
56
|
-
* authoring-file order. Ordering of tools WITHIN one skill wasn't
|
|
57
|
-
* observable live (each capture skill carried only one tool); authored
|
|
58
|
-
* array order is assumed there pending a capture that can confirm it.
|
|
59
|
-
*
|
|
60
|
-
* Returns suffixes ("" for the first occurrence, "_1", "_2", … after)
|
|
61
|
-
* keyed by `${skillRefName}#${toolIndex}` — the tool's position in its own
|
|
62
|
-
* skill's authored `tools` array, NOT a global index.
|
|
63
|
-
*/
|
|
47
|
+
/** Return deterministic suffixes for duplicate tool names within one skill. */
|
|
64
48
|
export function computeToolLabelSuffixes(siblingSkills) {
|
|
65
|
-
// refName tie-breaker (stable, unique per app): two skills can't share a
|
|
66
|
-
// display name in practice — ei's exporter has never demonstrated a tie —
|
|
67
|
-
// but sort() is not guaranteed stable across engines, so a same-name pair
|
|
68
|
-
// could otherwise silently swap which one gets the bare label between
|
|
69
|
-
// runs. refName (the authoring filename) is always unique within an app,
|
|
70
|
-
// making the overall ordering deterministic even in that case.
|
|
71
|
-
const sorted = toSortableSkills(siblingSkills).sort((a, b) => {
|
|
72
|
-
if (a.name < b.name)
|
|
73
|
-
return -1;
|
|
74
|
-
if (a.name > b.name)
|
|
75
|
-
return 1;
|
|
76
|
-
return a.refName < b.refName ? -1 : a.refName > b.refName ? 1 : 0;
|
|
77
|
-
});
|
|
78
49
|
const counts = new Map();
|
|
79
50
|
const suffixes = new Map();
|
|
80
|
-
for (const skill of
|
|
51
|
+
for (const skill of toSortableSkills(siblingSkills)) {
|
|
81
52
|
skill.tools.forEach((entry, index) => {
|
|
82
53
|
const typeKey = Object.keys(entry)[0];
|
|
83
54
|
if (typeKey === undefined)
|
|
84
55
|
return;
|
|
85
56
|
const inner = entry[typeKey];
|
|
86
57
|
const base = sanitizeName(inner?.name ?? "");
|
|
87
|
-
const
|
|
88
|
-
counts.
|
|
58
|
+
const key = `${skill.refName}\0${base}`;
|
|
59
|
+
const count = counts.get(key) ?? 0;
|
|
60
|
+
counts.set(key, count + 1);
|
|
89
61
|
suffixes.set(`${skill.refName}#${index}`, count > 0 ? `_${count}` : "");
|
|
90
62
|
});
|
|
91
63
|
}
|
|
@@ -101,8 +73,12 @@ export function skillToTf(entity, ctx) {
|
|
|
101
73
|
if (payload === null || typeof payload !== "object" || elementum === undefined) {
|
|
102
74
|
throw new EntityTfError(`skill "${entity.refName}" has no skill payload — was it built with skill?`);
|
|
103
75
|
}
|
|
104
|
-
const
|
|
76
|
+
const skillBareTfLabel = tsLabelToTfLabel(entity.refName);
|
|
77
|
+
const tfLabel = appScopedResourceLabel(ctx.appTfLabel, skillBareTfLabel);
|
|
105
78
|
const name = elementum.name ?? "";
|
|
79
|
+
const coverage = analyzeSkillInputCoverage(name, elementum.instructions ?? "", coverageToolsFromWire(payload.tools ?? []));
|
|
80
|
+
ctx.reports?.push(...skillCoverageReportLines(coverage));
|
|
81
|
+
ctx.diagnostics.push(...skillCoverageGapDiagnostics(coverage));
|
|
106
82
|
const attrs = {
|
|
107
83
|
owner_id: expr.resourceAttr(APP_RESOURCE_TYPE, ctx.appTfLabel, ["id"]),
|
|
108
84
|
owner_type: "APP_ASPECT",
|
|
@@ -115,6 +91,17 @@ export function skillToTf(entity, ctx) {
|
|
|
115
91
|
if (elementum.properties !== undefined) {
|
|
116
92
|
attrs["properties"] = JSON.stringify(elementum.properties);
|
|
117
93
|
}
|
|
94
|
+
const discovery = elementum.discovery;
|
|
95
|
+
if (discovery?.routingPriority !== undefined)
|
|
96
|
+
attrs["routing_priority"] = discovery.routingPriority;
|
|
97
|
+
if (discovery?.aliases !== undefined)
|
|
98
|
+
attrs["aliases"] = [...discovery.aliases];
|
|
99
|
+
if (discovery?.exampleUtterances !== undefined)
|
|
100
|
+
attrs["example_utterances"] = [...discovery.exampleUtterances];
|
|
101
|
+
if (discovery?.positiveKeywords !== undefined)
|
|
102
|
+
attrs["positive_keywords"] = [...discovery.positiveKeywords];
|
|
103
|
+
if (discovery?.negativeKeywords !== undefined)
|
|
104
|
+
attrs["negative_keywords"] = [...discovery.negativeKeywords];
|
|
118
105
|
const toolLabelSuffixes = computeToolLabelSuffixes(ctx.siblingEntities ?? [entity]);
|
|
119
106
|
const blocks = [{ kind: "resource", type: SKILL_RESOURCE_TYPE, label: tfLabel, attrs }];
|
|
120
107
|
(payload.tools ?? []).forEach((entry, index) => {
|
|
@@ -122,9 +109,11 @@ export function skillToTf(entity, ctx) {
|
|
|
122
109
|
appRefName: ctx.appRefName,
|
|
123
110
|
appTfLabel: ctx.appTfLabel,
|
|
124
111
|
skillTfLabel: tfLabel,
|
|
112
|
+
skillBareTfLabel,
|
|
125
113
|
labelSuffix: toolLabelSuffixes.get(`${entity.refName}#${index}`) ?? "",
|
|
126
|
-
|
|
127
|
-
|
|
114
|
+
...(ctx.activeAutomationRefNames !== undefined && { activeAutomationRefNames: ctx.activeAutomationRefNames }),
|
|
115
|
+
foreignAppRef: (l, n, ns) => ctx.orgRefs.foreignApp(l, n, ns),
|
|
116
|
+
foreignElementRef: (l, n, ns) => ctx.orgRefs.foreignElement(l, n, ns),
|
|
128
117
|
foreignFieldRef: (t, l, o, n) => ctx.orgRefs.foreignField(t, l, o, n),
|
|
129
118
|
workspaceAspects: ctx.workspaceAspects,
|
|
130
119
|
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;
|
|
@@ -105,7 +114,8 @@ export type SkillCreateRecordToolV2<Target extends ToolTarget = ToolTarget> = Co
|
|
|
105
114
|
export declare function skillCreateRecord<Target extends ToolTarget>(opts: SkillCreateRecordToolV2<Target>): SkillTool;
|
|
106
115
|
export type SkillUpdateRecordToolV2<Target extends ToolTarget = ToolTarget> = CommonToolOptions & TargetOption<Target> & {
|
|
107
116
|
readonly fields?: readonly SkillRecordFieldInput<Target>[];
|
|
108
|
-
|
|
117
|
+
/** Omit entirely when there's no description; the platform accepts that. An explicit empty string is always a mistake, never a valid value. */
|
|
118
|
+
readonly handleDescription?: string;
|
|
109
119
|
};
|
|
110
120
|
export declare function skillUpdateRecord<Target extends ToolTarget>(opts: SkillUpdateRecordToolV2<Target>): SkillTool;
|
|
111
121
|
export interface SkillRunAgentToolV2 extends CommonToolOptions {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isValidToolName } from "../agent-tool/types.js";
|
|
2
|
+
import { assertHandleDescriptionNotEmpty } from "../shared/handle-description.js";
|
|
2
3
|
function targetOf(opts) {
|
|
3
4
|
return ("app" in opts && opts.app !== undefined ? opts.app : opts.element);
|
|
4
5
|
}
|
|
@@ -64,11 +65,6 @@ function recordFieldToken(f) {
|
|
|
64
65
|
...(f.defaultValue !== undefined ? { defaultValue: f.defaultValue } : {}),
|
|
65
66
|
};
|
|
66
67
|
}
|
|
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
68
|
export function skillAutomation(opts) {
|
|
73
69
|
const inputEntries = Object.entries((opts.inputs ?? {}));
|
|
74
70
|
const inputs = inputEntries.map(([parameterName, spec]) => ({
|
|
@@ -124,12 +120,13 @@ export function skillCreateRecord(opts) {
|
|
|
124
120
|
});
|
|
125
121
|
}
|
|
126
122
|
export function skillUpdateRecord(opts) {
|
|
123
|
+
assertHandleDescriptionNotEmpty(opts.handleDescription, "skillUpdateRecord");
|
|
127
124
|
return tool({
|
|
128
125
|
updateRecord: {
|
|
129
126
|
...common(opts),
|
|
130
127
|
aspectId: targetOf(opts),
|
|
131
128
|
fields: (opts.fields ?? []).map(recordFieldToken),
|
|
132
|
-
handleDescription: opts.handleDescription,
|
|
129
|
+
...(opts.handleDescription !== undefined ? { handleDescription: opts.handleDescription } : {}),
|
|
133
130
|
},
|
|
134
131
|
});
|
|
135
132
|
}
|
|
@@ -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;
|