@elementumai/edk 0.9.7 → 0.9.10
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 +22 -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.d.ts +1 -1
- package/dist-sdk/src/entities/app/to-tf.js +17 -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 +140 -12
- 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 +8 -1
- package/dist-sdk/src/entities/automation/script-code.js +32 -14
- 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 +394 -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/dashboard/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/dashboard/to-tf.js +4 -0
- package/dist-sdk/src/entities/datamine/from-tf.js +23 -3
- 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
|
@@ -10,7 +10,7 @@ import { optionalString, resourceRefLabel } from "../../engine/pull/context.js";
|
|
|
10
10
|
import { scopedLabelToBagKey } from "../../engine/tf/index.js";
|
|
11
11
|
import { skillToolFromTf } from "../skill-tool/from-tf.js";
|
|
12
12
|
import { APP_RESOURCE_TYPE } from "../app/module.js";
|
|
13
|
-
import { analyzeSkillInputCoverage, skillCoverageGapDiagnostics, skillCoverageReportLines, } from "./input-coverage.js";
|
|
13
|
+
import { analyzeSkillInputCoverage, decomposeSkillInstructions, skillCoverageGapDiagnostics, skillCoverageReportLines, } from "./input-coverage.js";
|
|
14
14
|
import { SKILL_RESOURCE_TYPE } from "./module.js";
|
|
15
15
|
/** Attributes `skillFromTf` understands — anything else is dialect growth, reported loudly. */
|
|
16
16
|
const KNOWN_SKILL_ATTRS = new Set([
|
|
@@ -22,18 +22,28 @@ const KNOWN_SKILL_ATTRS = new Set([
|
|
|
22
22
|
"status",
|
|
23
23
|
"type",
|
|
24
24
|
"properties",
|
|
25
|
-
"depends_on",
|
|
26
|
-
]);
|
|
27
|
-
/** Dialect attrs with no authoring slot yet — reported by name, skill still pulled. */
|
|
28
|
-
const UNAUTHORABLE_SKILL_ATTRS = new Set([
|
|
29
25
|
"routing_priority",
|
|
30
26
|
"aliases",
|
|
31
27
|
"example_utterances",
|
|
32
28
|
"positive_keywords",
|
|
33
29
|
"negative_keywords",
|
|
30
|
+
"depends_on",
|
|
31
|
+
]);
|
|
32
|
+
/** Dialect attrs with no authoring slot yet — reported by name, skill still pulled. */
|
|
33
|
+
const UNAUTHORABLE_SKILL_ATTRS = new Set([
|
|
34
34
|
"user_ids",
|
|
35
35
|
"group_ids",
|
|
36
36
|
]);
|
|
37
|
+
function optionalStringList(attrs, key, where, ctx) {
|
|
38
|
+
const value = attrs[key];
|
|
39
|
+
if (value === undefined || value === null)
|
|
40
|
+
return undefined;
|
|
41
|
+
if (!Array.isArray(value) || value.some((item) => typeof item !== "string")) {
|
|
42
|
+
ctx.diagnostics.push(`${where}: ${key} must be a list of strings; dropped`);
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
37
47
|
/**
|
|
38
48
|
* The `elementum_agentic_skill` block + its tool blocks → the normalized
|
|
39
49
|
* skill. Tool blocks belonging to OTHER skills are skipped with a
|
|
@@ -76,6 +86,21 @@ export function skillFromTf(skillBlock, toolBlocks, appLabel, ctx) {
|
|
|
76
86
|
}
|
|
77
87
|
}
|
|
78
88
|
const status = optionalString(attrs, "status", where, ctx);
|
|
89
|
+
const routingPriority = attrs["routing_priority"];
|
|
90
|
+
if (routingPriority !== undefined && typeof routingPriority !== "number") {
|
|
91
|
+
ctx.diagnostics.push(`${where}: routing_priority must be a number; dropped`);
|
|
92
|
+
}
|
|
93
|
+
const aliases = optionalStringList(attrs, "aliases", where, ctx);
|
|
94
|
+
const exampleUtterances = optionalStringList(attrs, "example_utterances", where, ctx);
|
|
95
|
+
const positiveKeywords = optionalStringList(attrs, "positive_keywords", where, ctx);
|
|
96
|
+
const negativeKeywords = optionalStringList(attrs, "negative_keywords", where, ctx);
|
|
97
|
+
const discovery = {
|
|
98
|
+
...(typeof routingPriority === "number" && { routingPriority }),
|
|
99
|
+
...(aliases !== undefined && { aliases }),
|
|
100
|
+
...(exampleUtterances !== undefined && { exampleUtterances }),
|
|
101
|
+
...(positiveKeywords !== undefined && { positiveKeywords }),
|
|
102
|
+
...(negativeKeywords !== undefined && { negativeKeywords }),
|
|
103
|
+
};
|
|
79
104
|
const owner = { appType: APP_RESOURCE_TYPE, appLabel, ownerTfLabel: appLabel, skillType: SKILL_RESOURCE_TYPE, skillLabel: label };
|
|
80
105
|
const tools = [];
|
|
81
106
|
for (const block of toolBlocks) {
|
|
@@ -83,23 +108,30 @@ export function skillFromTf(skillBlock, toolBlocks, appLabel, ctx) {
|
|
|
83
108
|
if (tool !== undefined)
|
|
84
109
|
tools.push(tool);
|
|
85
110
|
}
|
|
86
|
-
const
|
|
111
|
+
const rawInstructions = optionalString(attrs, "instructions", where, ctx) ?? "";
|
|
87
112
|
const coverageTools = tools.map((tool) => ({
|
|
88
113
|
name: tool.name,
|
|
89
114
|
fields: (tool.fields ?? []).flatMap((field) => field.name ?? field.key ?? []),
|
|
90
115
|
inputs: (tool.inputs ?? []).map((input) => input.parameterName),
|
|
91
116
|
}));
|
|
92
|
-
const coverage = analyzeSkillInputCoverage(name,
|
|
117
|
+
const coverage = analyzeSkillInputCoverage(name, rawInstructions, coverageTools);
|
|
93
118
|
ctx.reports?.push(...skillCoverageReportLines(coverage));
|
|
94
119
|
ctx.diagnostics.push(...skillCoverageGapDiagnostics(coverage));
|
|
120
|
+
const decomposed = decomposeSkillInstructions(rawInstructions);
|
|
121
|
+
const instructions = decomposed.inputs.length > 0 || decomposed.lookups.length > 0
|
|
122
|
+
? decomposed.prose
|
|
123
|
+
: rawInstructions;
|
|
95
124
|
return {
|
|
96
125
|
skill: {
|
|
97
126
|
refName: scopedLabelToBagKey(appLabel, label),
|
|
98
127
|
name,
|
|
99
128
|
description: optionalString(attrs, "description", where, ctx) ?? "",
|
|
100
129
|
instructions,
|
|
130
|
+
...(decomposed.inputs.length > 0 && { inputs: decomposed.inputs }),
|
|
131
|
+
...(decomposed.lookups.length > 0 && { lookups: decomposed.lookups }),
|
|
101
132
|
...((status === "ACTIVE" || status === "INACTIVE") && { status }),
|
|
102
133
|
...(properties !== undefined && { properties }),
|
|
134
|
+
...(Object.keys(discovery).length > 0 && { discovery }),
|
|
103
135
|
tools,
|
|
104
136
|
},
|
|
105
137
|
};
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
* which the deploy wire client injects) with `CatalogRef` tokens at every
|
|
4
4
|
* reference position. Standalone from v1.
|
|
5
5
|
*/
|
|
6
|
-
export { skill, type SkillConfigured, type SkillV2Options } from "./build.js";
|
|
6
|
+
export { skill, type SkillConfigured, type SkillDiscoveryOptions, type SkillInputSpec, type SkillInputsOption, type SkillLookupSpec, type SkillLookupsOption, type SkillV2Options, } from "./build.js";
|
|
7
7
|
export { serviceAccountRef, type AgentToolRunAs, type ServiceAccountRef, } from "../agent/run-as.js";
|
|
8
8
|
export { skillAutomation, skillCreateRecord, skillRunAgent, skillSearchRecords, skillSearchTable, skillUpdateRecord, type SkillRecordField, type SkillRecordFieldInput, type SkillRecordRawIdField, type SkillSearchField, type SkillSearchFieldInput, type SkillSearchRawIdField, type SkillToolStatus, type SkillTool, } from "./tools.js";
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
* which the deploy wire client injects) with `CatalogRef` tokens at every
|
|
4
4
|
* reference position. Standalone from v1.
|
|
5
5
|
*/
|
|
6
|
-
export { skill } from "./build.js";
|
|
6
|
+
export { skill, } from "./build.js";
|
|
7
7
|
export { serviceAccountRef, } from "../agent/run-as.js";
|
|
8
8
|
export { skillAutomation, skillCreateRecord, skillRunAgent, skillSearchRecords, skillSearchTable, skillUpdateRecord, } from "./tools.js";
|
|
@@ -13,6 +13,21 @@
|
|
|
13
13
|
* ## Lookup Notes
|
|
14
14
|
* - field_name: resolve_field_name (source_table)
|
|
15
15
|
*/
|
|
16
|
+
export interface SkillInputDefinition {
|
|
17
|
+
readonly name: string;
|
|
18
|
+
readonly description?: string;
|
|
19
|
+
readonly required?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface SkillLookupDefinition {
|
|
22
|
+
readonly input: string;
|
|
23
|
+
readonly tool: string;
|
|
24
|
+
readonly source?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface DecomposedSkillInstructions {
|
|
27
|
+
readonly prose: string;
|
|
28
|
+
readonly inputs: readonly SkillInputDefinition[];
|
|
29
|
+
readonly lookups: readonly SkillLookupDefinition[];
|
|
30
|
+
}
|
|
16
31
|
export interface SkillCoverageTool {
|
|
17
32
|
readonly name: string;
|
|
18
33
|
readonly fields: readonly string[];
|
|
@@ -58,6 +73,12 @@ export interface SkillInputCoverageReport {
|
|
|
58
73
|
readonly bindings: readonly SkillCoverageBinding[];
|
|
59
74
|
readonly gaps: readonly SkillCoverageGap[];
|
|
60
75
|
}
|
|
76
|
+
export declare function parseSkillInputDefinition(line: string): SkillInputDefinition | undefined;
|
|
77
|
+
export declare function parseSkillLookupDefinition(line: string): SkillLookupDefinition | undefined;
|
|
78
|
+
export declare function formatSkillInputSchema(inputs: readonly SkillInputDefinition[]): string;
|
|
79
|
+
export declare function formatSkillLookupNotes(lookups: readonly SkillLookupDefinition[]): string;
|
|
80
|
+
export declare function deriveSkillInstructions(baseProse: string | undefined, inputs?: readonly SkillInputDefinition[], lookups?: readonly SkillLookupDefinition[]): string;
|
|
81
|
+
export declare function decomposeSkillInstructions(markdown: string): DecomposedSkillInstructions;
|
|
61
82
|
/** Compare instruction-declared form variables with the deployed tool surface. */
|
|
62
83
|
export declare function analyzeSkillInputCoverage(skill: string, instructions: string, coverageTools: readonly SkillCoverageTool[]): SkillInputCoverageReport;
|
|
63
84
|
/** Informational coverage lines emitted on stderr and in JSON `reports`. */
|
|
@@ -37,9 +37,35 @@ function unique(values) {
|
|
|
37
37
|
function canonicalName(value) {
|
|
38
38
|
return value.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
39
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
|
+
}
|
|
40
67
|
function bulletKey(line) {
|
|
41
|
-
|
|
42
|
-
return match?.[1];
|
|
68
|
+
return parseSkillInputDefinition(line)?.name;
|
|
43
69
|
}
|
|
44
70
|
function inputNames(section) {
|
|
45
71
|
return unique(section.lines.map(bulletKey).filter((value) => value !== undefined));
|
|
@@ -47,13 +73,130 @@ function inputNames(section) {
|
|
|
47
73
|
function lookupBindings(section) {
|
|
48
74
|
const out = [];
|
|
49
75
|
for (const line of section.lines) {
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
52
|
-
out.push({ input:
|
|
76
|
+
const parsed = parseSkillLookupDefinition(line);
|
|
77
|
+
if (parsed !== undefined) {
|
|
78
|
+
out.push({ input: parsed.input, tool: parsed.tool });
|
|
53
79
|
}
|
|
54
80
|
}
|
|
55
81
|
return out;
|
|
56
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
|
+
}
|
|
57
200
|
function mentionsIdentifier(markdown, name) {
|
|
58
201
|
if (name === "")
|
|
59
202
|
return false;
|
|
@@ -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";
|
|
@@ -30,11 +29,9 @@ export interface SkillToTfContext {
|
|
|
30
29
|
/** Informational reports are surfaced separately from actionable diagnostics. */
|
|
31
30
|
readonly reports?: string[];
|
|
32
31
|
/**
|
|
33
|
-
* Every skill entity discovered for this app (self included)
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* contexts that don't supply it (e.g. most unit tests): every tool then
|
|
37
|
-
* 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.
|
|
38
35
|
*/
|
|
39
36
|
readonly siblingEntities?: readonly DeployableEntity[];
|
|
40
37
|
readonly activeAutomationRefNames?: ReadonlySet<string>;
|
|
@@ -44,23 +41,7 @@ export interface SkillToTfResult {
|
|
|
44
41
|
/** The skill's terraform address. */
|
|
45
42
|
readonly address: string;
|
|
46
43
|
}
|
|
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
|
-
*/
|
|
44
|
+
/** Return deterministic suffixes for duplicate tool names within one skill. */
|
|
64
45
|
export declare function computeToolLabelSuffixes(siblingSkills: readonly DeployableEntity[]): ReadonlyMap<string, string>;
|
|
65
46
|
/** `elementum_agentic_skill` + one tool resource per implemented tool, in the platform's dialect. */
|
|
66
47
|
export declare function skillToTf(entity: DeployableEntity, ctx: SkillToTfContext): SkillToTfResult;
|
|
@@ -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 { EntityTfError } from "../../engine/entity.js";
|
|
17
16
|
import { appScopedResourceLabel, expr, sanitizeName, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
@@ -41,52 +40,24 @@ function toSortableSkills(entities) {
|
|
|
41
40
|
if (entity.kind !== "skill")
|
|
42
41
|
continue;
|
|
43
42
|
const payload = entity.payload;
|
|
44
|
-
out.push({ refName: entity.refName,
|
|
43
|
+
out.push({ refName: entity.refName, tools: payload?.tools ?? [] });
|
|
45
44
|
}
|
|
46
45
|
return out;
|
|
47
46
|
}
|
|
48
|
-
/**
|
|
49
|
-
* Mirrors ei's cross-skill tool-name disambiguation (`cmd/elementum/export/
|
|
50
|
-
* imports.go`'s `skillNames`/`toolNames` counting maps) — a same-app,
|
|
51
|
-
* same-named tool on two different skills is not a collision on the
|
|
52
|
-
* platform: ei's exporter walks `app.Skills` (each skill's tools in turn)
|
|
53
|
-
* and gives the first occurrence of a sanitized tool name the bare label,
|
|
54
|
-
* each later occurrence `_1`, `_2`, … Board issue #310's live capture
|
|
55
|
-
* (2026-08-18, against a deliberately-collided app) confirmed the walk
|
|
56
|
-
* order is ascending by the skill's display NAME — not creation order, not
|
|
57
|
-
* authoring-file order. Ordering of tools WITHIN one skill wasn't
|
|
58
|
-
* observable live (each capture skill carried only one tool); authored
|
|
59
|
-
* array order is assumed there pending a capture that can confirm it.
|
|
60
|
-
*
|
|
61
|
-
* Returns suffixes ("" for the first occurrence, "_1", "_2", … after)
|
|
62
|
-
* keyed by `${skillRefName}#${toolIndex}` — the tool's position in its own
|
|
63
|
-
* skill's authored `tools` array, NOT a global index.
|
|
64
|
-
*/
|
|
47
|
+
/** Return deterministic suffixes for duplicate tool names within one skill. */
|
|
65
48
|
export function computeToolLabelSuffixes(siblingSkills) {
|
|
66
|
-
// refName tie-breaker (stable, unique per app): two skills can't share a
|
|
67
|
-
// display name in practice — ei's exporter has never demonstrated a tie —
|
|
68
|
-
// but sort() is not guaranteed stable across engines, so a same-name pair
|
|
69
|
-
// could otherwise silently swap which one gets the bare label between
|
|
70
|
-
// runs. refName (the authoring filename) is always unique within an app,
|
|
71
|
-
// making the overall ordering deterministic even in that case.
|
|
72
|
-
const sorted = toSortableSkills(siblingSkills).sort((a, b) => {
|
|
73
|
-
if (a.name < b.name)
|
|
74
|
-
return -1;
|
|
75
|
-
if (a.name > b.name)
|
|
76
|
-
return 1;
|
|
77
|
-
return a.refName < b.refName ? -1 : a.refName > b.refName ? 1 : 0;
|
|
78
|
-
});
|
|
79
49
|
const counts = new Map();
|
|
80
50
|
const suffixes = new Map();
|
|
81
|
-
for (const skill of
|
|
51
|
+
for (const skill of toSortableSkills(siblingSkills)) {
|
|
82
52
|
skill.tools.forEach((entry, index) => {
|
|
83
53
|
const typeKey = Object.keys(entry)[0];
|
|
84
54
|
if (typeKey === undefined)
|
|
85
55
|
return;
|
|
86
56
|
const inner = entry[typeKey];
|
|
87
57
|
const base = sanitizeName(inner?.name ?? "");
|
|
88
|
-
const
|
|
89
|
-
counts.
|
|
58
|
+
const key = `${skill.refName}\0${base}`;
|
|
59
|
+
const count = counts.get(key) ?? 0;
|
|
60
|
+
counts.set(key, count + 1);
|
|
90
61
|
suffixes.set(`${skill.refName}#${index}`, count > 0 ? `_${count}` : "");
|
|
91
62
|
});
|
|
92
63
|
}
|
|
@@ -102,7 +73,8 @@ export function skillToTf(entity, ctx) {
|
|
|
102
73
|
if (payload === null || typeof payload !== "object" || elementum === undefined) {
|
|
103
74
|
throw new EntityTfError(`skill "${entity.refName}" has no skill payload — was it built with skill?`);
|
|
104
75
|
}
|
|
105
|
-
const
|
|
76
|
+
const skillBareTfLabel = tsLabelToTfLabel(entity.refName);
|
|
77
|
+
const tfLabel = appScopedResourceLabel(ctx.appTfLabel, skillBareTfLabel);
|
|
106
78
|
const name = elementum.name ?? "";
|
|
107
79
|
const coverage = analyzeSkillInputCoverage(name, elementum.instructions ?? "", coverageToolsFromWire(payload.tools ?? []));
|
|
108
80
|
ctx.reports?.push(...skillCoverageReportLines(coverage));
|
|
@@ -119,6 +91,17 @@ export function skillToTf(entity, ctx) {
|
|
|
119
91
|
if (elementum.properties !== undefined) {
|
|
120
92
|
attrs["properties"] = JSON.stringify(elementum.properties);
|
|
121
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];
|
|
122
105
|
const toolLabelSuffixes = computeToolLabelSuffixes(ctx.siblingEntities ?? [entity]);
|
|
123
106
|
const blocks = [{ kind: "resource", type: SKILL_RESOURCE_TYPE, label: tfLabel, attrs }];
|
|
124
107
|
(payload.tools ?? []).forEach((entry, index) => {
|
|
@@ -126,6 +109,7 @@ export function skillToTf(entity, ctx) {
|
|
|
126
109
|
appRefName: ctx.appRefName,
|
|
127
110
|
appTfLabel: ctx.appTfLabel,
|
|
128
111
|
skillTfLabel: tfLabel,
|
|
112
|
+
skillBareTfLabel,
|
|
129
113
|
labelSuffix: toolLabelSuffixes.get(`${entity.refName}#${index}`) ?? "",
|
|
130
114
|
...(ctx.activeAutomationRefNames !== undefined && { activeAutomationRefNames: ctx.activeAutomationRefNames }),
|
|
131
115
|
foreignAppRef: (l, n, ns) => ctx.orgRefs.foreignApp(l, n, ns),
|
|
@@ -114,7 +114,8 @@ export type SkillCreateRecordToolV2<Target extends ToolTarget = ToolTarget> = Co
|
|
|
114
114
|
export declare function skillCreateRecord<Target extends ToolTarget>(opts: SkillCreateRecordToolV2<Target>): SkillTool;
|
|
115
115
|
export type SkillUpdateRecordToolV2<Target extends ToolTarget = ToolTarget> = CommonToolOptions & TargetOption<Target> & {
|
|
116
116
|
readonly fields?: readonly SkillRecordFieldInput<Target>[];
|
|
117
|
-
|
|
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;
|
|
118
119
|
};
|
|
119
120
|
export declare function skillUpdateRecord<Target extends ToolTarget>(opts: SkillUpdateRecordToolV2<Target>): SkillTool;
|
|
120
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
|
}
|
|
@@ -119,12 +120,13 @@ export function skillCreateRecord(opts) {
|
|
|
119
120
|
});
|
|
120
121
|
}
|
|
121
122
|
export function skillUpdateRecord(opts) {
|
|
123
|
+
assertHandleDescriptionNotEmpty(opts.handleDescription, "skillUpdateRecord");
|
|
122
124
|
return tool({
|
|
123
125
|
updateRecord: {
|
|
124
126
|
...common(opts),
|
|
125
127
|
aspectId: targetOf(opts),
|
|
126
128
|
fields: (opts.fields ?? []).map(recordFieldToken),
|
|
127
|
-
handleDescription: opts.handleDescription,
|
|
129
|
+
...(opts.handleDescription !== undefined ? { handleDescription: opts.handleDescription } : {}),
|
|
128
130
|
},
|
|
129
131
|
});
|
|
130
132
|
}
|
|
@@ -352,6 +352,15 @@ export function skillToolFromTf(block, owner, ctx) {
|
|
|
352
352
|
if ((subType.typeKey === "searchAspect" || subType.typeKey === "searchTable") && attrs["filter_variables"] !== undefined) {
|
|
353
353
|
ctx.diagnostics.push(`${where}: filter_variables are not supported on the terraform path yet; a rebuilt stream will omit them`);
|
|
354
354
|
}
|
|
355
|
+
let handleDescription;
|
|
356
|
+
if (subType.typeKey === "updateRecord") {
|
|
357
|
+
// A live "" is not a reconstructable value any more than a missing
|
|
358
|
+
// attribute is - skillUpdateRecord's own assertHandleDescriptionNotEmpty
|
|
359
|
+
// throws on an explicit "", so printing one straight into a
|
|
360
|
+
// skillUpdateRecord({...}) call would crash the next time this source
|
|
361
|
+
// loads. Collapse it to undefined here so the printer never sees it.
|
|
362
|
+
handleDescription = optionalString(attrs, "handle_description", where, ctx) || undefined;
|
|
363
|
+
}
|
|
355
364
|
return {
|
|
356
365
|
typeKey: subType.typeKey,
|
|
357
366
|
...common,
|
|
@@ -363,8 +372,6 @@ export function skillToolFromTf(block, owner, ctx) {
|
|
|
363
372
|
...(searchTableKey !== undefined && { searchTableKey }),
|
|
364
373
|
...(searchTableName !== undefined && { searchTableName }),
|
|
365
374
|
...(typeof attrs["result_limit"] === "number" && { limit: attrs["result_limit"] }),
|
|
366
|
-
...(
|
|
367
|
-
handleDescription: optionalString(attrs, "handle_description", where, ctx) ?? "",
|
|
368
|
-
}),
|
|
375
|
+
...(handleDescription !== undefined && { handleDescription }),
|
|
369
376
|
};
|
|
370
377
|
}
|
|
@@ -14,12 +14,12 @@ export interface SkillToolToTfContext {
|
|
|
14
14
|
readonly appTfLabel: string;
|
|
15
15
|
/** The owning skill's tfLabel. */
|
|
16
16
|
readonly skillTfLabel: string;
|
|
17
|
+
/** The owning skill's bare label, included in every child tool address. */
|
|
18
|
+
readonly skillBareTfLabel?: string;
|
|
17
19
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* `computeToolLabelSuffixes`; empty when absent (single-skill contexts,
|
|
22
|
-
* most unit tests).
|
|
20
|
+
* Same-skill duplicate suffix ("", "_1", "_2", …). The unique parent
|
|
21
|
+
* skill label handles cross-skill identity; this only protects against
|
|
22
|
+
* repeated tool names within one skill.
|
|
23
23
|
*/
|
|
24
24
|
readonly labelSuffix?: string;
|
|
25
25
|
/** Records a foreign-app data lookup for data.tf; returns its tfLabel. */
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { workspaceAspectKey } from "../../engine/build/context.js";
|
|
10
10
|
import { automationRunTargetResourceAttr } from "../automation/to-tf.js";
|
|
11
|
-
import { appScopedResourceLabel, expr, sanitizeName, scopedResourceLabel, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
11
|
+
import { appScopedResourceLabel, childPartFromScopedLabel, expr, sanitizeName, scopedResourceLabel, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
12
12
|
import { fieldRefToTfValue } from "../field/to-tf.js";
|
|
13
|
+
import { encodeOptionalHandleDescription } from "../shared/handle-description.js";
|
|
13
14
|
import { SKILL_TOOL_SUB_TYPE_BY_TYPE_KEY } from "./types.js";
|
|
14
15
|
function serviceAccountIdValue(token, where, ctx) {
|
|
15
16
|
if (token.__kind !== "serviceAccount" || token.name === undefined || token.name === "") {
|
|
@@ -140,7 +141,8 @@ export function skillToolToTf(entry, ctx) {
|
|
|
140
141
|
return undefined;
|
|
141
142
|
}
|
|
142
143
|
const where = `skill tool "${name}"`;
|
|
143
|
-
const
|
|
144
|
+
const skillBareTfLabel = ctx.skillBareTfLabel ?? childPartFromScopedLabel(ctx.appTfLabel, ctx.skillTfLabel, "app");
|
|
145
|
+
const tfLabel = appScopedResourceLabel(ctx.appTfLabel, `${skillBareTfLabel}_${sanitizeName(name)}${ctx.labelSuffix ?? ""}`);
|
|
144
146
|
const attrs = {
|
|
145
147
|
skill_id: expr.resourceAttr("elementum_agentic_skill", ctx.skillTfLabel, ["id"]),
|
|
146
148
|
app_id: expr.resourceAttr("elementum_app", ctx.appTfLabel, ["id"]),
|
|
@@ -255,11 +257,7 @@ export function skillToolToTf(entry, ctx) {
|
|
|
255
257
|
}
|
|
256
258
|
}
|
|
257
259
|
if (typeKey === "updateRecord") {
|
|
258
|
-
|
|
259
|
-
ctx.diagnostics.push(`${where}: no handleDescription; dropped`);
|
|
260
|
-
return undefined;
|
|
261
|
-
}
|
|
262
|
-
attrs["handle_description"] = inner.handleDescription;
|
|
260
|
+
encodeOptionalHandleDescription(attrs, inner.handleDescription);
|
|
263
261
|
}
|
|
264
262
|
if (typeKey === "searchAspect" || typeKey === "searchTable") {
|
|
265
263
|
attrs["query_description"] = inner.queryDescription ?? "";
|
|
@@ -2,6 +2,7 @@ import { workspaceAspectKey, } from "../../engine/build/context.js";
|
|
|
2
2
|
import { EntityTfError } from "../../engine/entity.js";
|
|
3
3
|
import { expr, sanitizeName, tsLabelToTfLabel, } from "../../engine/tf/index.js";
|
|
4
4
|
import { CATEGORY_ORG_BAG } from "../org/category.js";
|
|
5
|
+
import { categoryIdExpr, missingCategoryDiagnostic } from "../org/category-ref.js";
|
|
5
6
|
import { CLOUD_LINK_ORG_BAG } from "../org/cloud-link.js";
|
|
6
7
|
import { tableDataminesToTf, } from "../datamine/to-tf.js";
|
|
7
8
|
import { fieldRefToTfValue } from "../field/to-tf.js";
|
|
@@ -126,10 +127,8 @@ export function tableToTf(entity, ctx) {
|
|
|
126
127
|
? ctx.orgRefs.byTsLabel(CATEGORY_ORG_BAG, categoryRefName)
|
|
127
128
|
: undefined;
|
|
128
129
|
if (category === undefined)
|
|
129
|
-
throw new EntityTfError(`table ${JSON.stringify(p.name)}:
|
|
130
|
-
attrs["category_id"] =
|
|
131
|
-
"id",
|
|
132
|
-
]);
|
|
130
|
+
throw new EntityTfError(`table ${JSON.stringify(p.name)}: ${missingCategoryDiagnostic(categoryRefName ?? "")}`);
|
|
131
|
+
attrs["category_id"] = categoryIdExpr(category);
|
|
133
132
|
if (p.source !== undefined)
|
|
134
133
|
attrs["source_id"] = aspectId(p.source, ctx.orgRefs, ctx.workspaceAspects, ctx.diagnostics, "table source");
|
|
135
134
|
for (const key of ["description", "icon", "color"])
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EntityTfError } from "../../engine/entity.js";
|
|
2
2
|
import { expr } from "../../engine/tf/index.js";
|
|
3
3
|
import { CATEGORY_ORG_BAG } from "../org/category.js";
|
|
4
|
+
import { categoryIdExpr, missingCategoryDiagnostic } from "../org/category-ref.js";
|
|
4
5
|
import { CLOUD_LINK_ORG_BAG } from "../org/cloud-link.js";
|
|
5
6
|
import { TASK_RESOURCE_TYPE } from "./module.js";
|
|
6
7
|
export function taskToTf(entity, ctx) {
|
|
@@ -13,9 +14,9 @@ export function taskToTf(entity, ctx) {
|
|
|
13
14
|
const categoryRefName = p.category?.refName;
|
|
14
15
|
const category = categoryRefName ? ctx.orgRefs.byTsLabel(CATEGORY_ORG_BAG, categoryRefName) : undefined;
|
|
15
16
|
if (category === undefined)
|
|
16
|
-
ctx.diagnostics.push(`task ${JSON.stringify(p.name)}:
|
|
17
|
+
ctx.diagnostics.push(`task ${JSON.stringify(p.name)}: ${missingCategoryDiagnostic(categoryRefName ?? "")}`);
|
|
17
18
|
else
|
|
18
|
-
attrs["category_id"] =
|
|
19
|
+
attrs["category_id"] = categoryIdExpr(category);
|
|
19
20
|
if (p.cloudLink?.refName) {
|
|
20
21
|
const link = ctx.orgRefs.byTsLabel(CLOUD_LINK_ORG_BAG, p.cloudLink.refName);
|
|
21
22
|
if (link === undefined)
|