@elementumai/edk 0.10.4 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -13
- package/dist-sdk/src/catalog/token.js +2 -1
- package/dist-sdk/src/core/triggers/on-demand.d.ts +2 -0
- package/dist-sdk/src/core/triggers/on-demand.js +3 -0
- package/dist-sdk/src/core/wire/ref-serializer.js +26 -1
- package/dist-sdk/src/engine/build/context.d.ts +4 -0
- package/dist-sdk/src/engine/coverage-gaps.d.ts +7 -0
- package/dist-sdk/src/engine/coverage-gaps.js +12 -0
- package/dist-sdk/src/engine/ei/json-stream-reader.d.ts +43 -0
- package/dist-sdk/src/engine/ei/json-stream-reader.js +234 -0
- package/dist-sdk/src/engine/ei/run.d.ts +42 -1
- package/dist-sdk/src/engine/ei/run.js +201 -32
- package/dist-sdk/src/engine/ei/saved-plan.d.ts +16 -0
- package/dist-sdk/src/engine/ei/saved-plan.js +19 -0
- package/dist-sdk/src/engine/ei/state.d.ts +1 -1
- package/dist-sdk/src/engine/ei/state.js +17 -4
- package/dist-sdk/src/engine/progress.d.ts +3 -1
- package/dist-sdk/src/engine/progress.js +7 -3
- package/dist-sdk/src/engine/pull/authored-address.d.ts +15 -1
- package/dist-sdk/src/engine/pull/authored-address.js +180 -29
- package/dist-sdk/src/engine/pull/context.d.ts +37 -2
- package/dist-sdk/src/engine/pull/context.js +7 -4
- package/dist-sdk/src/engine/pull/ref-only.d.ts +18 -0
- package/dist-sdk/src/engine/pull/ref-only.js +52 -0
- package/dist-sdk/src/engine/tf/index.d.ts +2 -2
- package/dist-sdk/src/engine/tf/index.js +2 -2
- package/dist-sdk/src/engine/tf/labels.d.ts +22 -0
- package/dist-sdk/src/engine/tf/labels.js +50 -0
- package/dist-sdk/src/engine/tf/model.d.ts +2 -0
- package/dist-sdk/src/engine/tf/model.js +26 -0
- package/dist-sdk/src/engine/validation.d.ts +2 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +18 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +58 -24
- package/dist-sdk/src/entities/access-policy/member-list.d.ts +32 -0
- package/dist-sdk/src/entities/access-policy/member-list.js +57 -0
- package/dist-sdk/src/entities/access-policy/module.js +10 -0
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +4 -3
- package/dist-sdk/src/entities/access-policy/to-tf.js +21 -12
- package/dist-sdk/src/entities/agent/build.js +7 -5
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +2 -0
- package/dist-sdk/src/entities/agent/from-tf.js +13 -3
- package/dist-sdk/src/entities/agent/to-tf.js +11 -5
- package/dist-sdk/src/entities/agent/tools.d.ts +8 -0
- package/dist-sdk/src/entities/agent/tools.js +6 -2
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +29 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.js +56 -3
- package/dist-sdk/src/entities/agent-tool/types.d.ts +12 -8
- package/dist-sdk/src/entities/agent-tool/types.js +13 -9
- package/dist-sdk/src/entities/app/build.d.ts +12 -1
- package/dist-sdk/src/entities/app/build.js +80 -4
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +5 -7
- package/dist-sdk/src/entities/app/from-tf.js +17 -12
- package/dist-sdk/src/entities/app/stage-keys.d.ts +18 -3
- package/dist-sdk/src/entities/app/stage-keys.js +40 -6
- package/dist-sdk/src/entities/app/to-tf.js +7 -4
- package/dist-sdk/src/entities/automation/build.d.ts +52 -31
- package/dist-sdk/src/entities/automation/build.js +59 -20
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +7 -4
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +39 -14
- package/dist-sdk/src/entities/automation/from-tf.d.ts +35 -2
- package/dist-sdk/src/entities/automation/from-tf.js +721 -93
- package/dist-sdk/src/entities/automation/index.d.ts +1 -1
- package/dist-sdk/src/entities/automation/module.d.ts +22 -2
- package/dist-sdk/src/entities/automation/module.js +244 -57
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +22 -2
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +54 -3
- package/dist-sdk/src/entities/automation/run-target.d.ts +61 -0
- package/dist-sdk/src/entities/automation/run-target.js +104 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +11 -1
- package/dist-sdk/src/entities/automation/script-code.js +106 -4
- package/dist-sdk/src/entities/automation/script-lint.d.ts +13 -0
- package/dist-sdk/src/entities/automation/script-lint.js +418 -0
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +17 -1
- package/dist-sdk/src/entities/automation/task-output-labels.js +58 -1
- package/dist-sdk/src/entities/automation/tasks.d.ts +67 -22
- package/dist-sdk/src/entities/automation/tasks.js +18 -4
- package/dist-sdk/src/entities/automation/to-tf.d.ts +1 -3
- package/dist-sdk/src/entities/automation/to-tf.js +354 -64
- package/dist-sdk/src/entities/automation/triggers.d.ts +63 -11
- package/dist-sdk/src/entities/automation/triggers.js +45 -5
- package/dist-sdk/src/entities/automation/types.d.ts +21 -0
- package/dist-sdk/src/entities/automation/types.js +26 -0
- package/dist-sdk/src/entities/chart/build.d.ts +9 -1
- package/dist-sdk/src/entities/chart/from-tf.d.ts +2 -2
- package/dist-sdk/src/entities/chart/from-tf.js +25 -1
- package/dist-sdk/src/entities/chart/index.d.ts +1 -1
- package/dist-sdk/src/entities/chart/printer.js +5 -2
- package/dist-sdk/src/entities/chart/to-tf.js +19 -1
- package/dist-sdk/src/entities/dashboard/from-tf.d.ts +11 -1
- package/dist-sdk/src/entities/dashboard/from-tf.js +57 -7
- package/dist-sdk/src/entities/dashboard/to-tf.js +13 -0
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +8 -2
- package/dist-sdk/src/entities/dynamic-layout/condition-keys.d.ts +48 -0
- package/dist-sdk/src/entities/dynamic-layout/condition-keys.js +261 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +3 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +66 -20
- package/dist-sdk/src/entities/dynamic-layout/module.js +2 -1
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +4 -2
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +341 -32
- package/dist-sdk/src/entities/element/build.d.ts +10 -0
- package/dist-sdk/src/entities/element/build.js +1 -0
- package/dist-sdk/src/entities/element/from-tf.js +14 -9
- package/dist-sdk/src/entities/element/to-tf.js +7 -4
- package/dist-sdk/src/entities/field/from-tf.d.ts +24 -0
- package/dist-sdk/src/entities/field/from-tf.js +79 -1
- package/dist-sdk/src/entities/field/module.js +14 -1
- package/dist-sdk/src/entities/field/to-tf.d.ts +38 -3
- package/dist-sdk/src/entities/field/to-tf.js +108 -34
- package/dist-sdk/src/entities/file-reader/module.js +3 -3
- package/dist-sdk/src/entities/file-reader/to-tf.js +3 -3
- package/dist-sdk/src/entities/file-reader/types.d.ts +4 -16
- package/dist-sdk/src/entities/file-reader/types.js +7 -0
- package/dist-sdk/src/entities/org/group.d.ts +1 -0
- package/dist-sdk/src/entities/org/group.js +2 -1
- package/dist-sdk/src/entities/org/role.js +5 -0
- package/dist-sdk/src/entities/record-create-form/from-tf.d.ts +8 -0
- package/dist-sdk/src/entities/record-create-form/from-tf.js +10 -2
- package/dist-sdk/src/entities/record-create-form/to-tf.d.ts +2 -1
- package/dist-sdk/src/entities/record-create-form/to-tf.js +14 -2
- package/dist-sdk/src/entities/relationship/from-tf.d.ts +8 -0
- package/dist-sdk/src/entities/relationship/from-tf.js +88 -10
- package/dist-sdk/src/entities/relationship/to-tf.d.ts +3 -2
- package/dist-sdk/src/entities/relationship/to-tf.js +79 -8
- package/dist-sdk/src/entities/role/from-tf.js +24 -7
- package/dist-sdk/src/entities/role/to-tf.js +25 -7
- package/dist-sdk/src/entities/service-account/from-tf.js +2 -1
- package/dist-sdk/src/entities/service-account/module.js +20 -0
- package/dist-sdk/src/entities/service-account/role-fidelity.d.ts +5 -5
- package/dist-sdk/src/entities/service-account/role-fidelity.js +21 -13
- package/dist-sdk/src/entities/service-account/to-tf.js +12 -4
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +2 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +1 -1
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +12 -7
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +6 -3
- package/dist-sdk/src/entities/shared/types/field-types.js +3 -1
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +5 -2
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +8 -1
- package/dist-sdk/src/entities/skill/from-tf.js +10 -3
- package/dist-sdk/src/entities/skill/module.js +18 -0
- package/dist-sdk/src/entities/skill/to-tf.d.ts +8 -1
- package/dist-sdk/src/entities/skill/to-tf.js +23 -14
- package/dist-sdk/src/entities/skill/tools.d.ts +8 -0
- package/dist-sdk/src/entities/skill/tools.js +6 -2
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +8 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.js +6 -2
- package/dist-sdk/src/entities/task/to-tf.js +1 -0
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +8 -2
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +20 -10
- package/dist-sdk/src/entities/view/from-tf.d.ts +68 -4
- package/dist-sdk/src/entities/view/from-tf.js +394 -22
- package/dist-sdk/src/entities/view/module.js +20 -0
- package/dist-sdk/src/entities/view/portable.d.ts +11 -0
- package/dist-sdk/src/entities/view/portable.js +47 -0
- package/dist-sdk/src/entities/view/to-tf.d.ts +4 -1
- package/dist-sdk/src/entities/view/to-tf.js +25 -7
- package/dist-sdk/src/entities/view/types.js +1 -1
- package/dist-sdk/src/entities/widget/build.d.ts +4 -3
- package/dist-sdk/src/entities/widget/from-tf.d.ts +3 -0
- package/dist-sdk/src/entities/widget/from-tf.js +100 -3
- package/dist-sdk/src/entities/widget/to-tf.d.ts +16 -1
- package/dist-sdk/src/entities/widget/to-tf.js +77 -14
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +30 -9
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/field-resource-types.d.ts +2 -0
- package/dist-sdk/src/graph/field-resource-types.js +11 -0
- package/dist-sdk/src/graph/index.d.ts +41 -3
- package/dist-sdk/src/graph/index.js +24 -2
- package/dist-sdk/src/graph/types.d.ts +195 -5
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isUnsafePlatformId } from "../../core/platform-id.js";
|
|
2
2
|
import { appScopedResourceLabel, expr, sanitizeName, scopedResourceLabel, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
3
3
|
import { SERVICE_ACCOUNT_ACCESS_POLICY_RESOURCE_TYPE, SERVICE_ACCOUNT_RESOURCE_TYPE } from "./module.js";
|
|
4
|
+
import { describeDroppedEntry, finishMemberList } from "../access-policy/member-list.js";
|
|
4
5
|
/**
|
|
5
6
|
* Resolve a `serviceAccountRef({ app, name })` token to its terraform value:
|
|
6
7
|
* `elementum_service_account.<label>.id` when the name matches an account
|
|
@@ -40,9 +41,14 @@ export function serviceAccountRefToTf(token, opts, where, diagnostics) {
|
|
|
40
41
|
return expr.dataAttr(SERVICE_ACCOUNT_RESOURCE_TYPE, label, ["id"]);
|
|
41
42
|
}
|
|
42
43
|
function principalValues(values, type, where, orgRefs, diagnostics) {
|
|
43
|
-
if (values === undefined
|
|
44
|
+
if (values === undefined)
|
|
44
45
|
return undefined;
|
|
46
|
+
// `users: []` / `groups: []` removes every member, so it must reach the
|
|
47
|
+
// provider as `[]`: an omitted list changes nothing (#2160).
|
|
48
|
+
if (values.length === 0)
|
|
49
|
+
return [];
|
|
45
50
|
const out = [];
|
|
51
|
+
const dropped = [];
|
|
46
52
|
for (const value of values) {
|
|
47
53
|
if (type === "elementum_user" && value.__kind === "user") {
|
|
48
54
|
const email = value.email;
|
|
@@ -55,14 +61,16 @@ function principalValues(values, type, where, orgRefs, diagnostics) {
|
|
|
55
61
|
const refName = value.refName ?? "";
|
|
56
62
|
const resolved = orgRefs.byTsLabel("groups", refName);
|
|
57
63
|
if (resolved === undefined)
|
|
58
|
-
|
|
64
|
+
dropped.push(`${where}: group ${JSON.stringify(refName)} is not in org.ts; dropped`);
|
|
59
65
|
else
|
|
60
66
|
out.push(expr.dataAttr(type, resolved.tfLabel, ["id"]));
|
|
61
67
|
continue;
|
|
62
68
|
}
|
|
63
|
-
|
|
69
|
+
dropped.push(`${where}: expected a typed ${type === "elementum_user" ? "userRef" : "group ref"} (${describeDroppedEntry(value)}); dropped`);
|
|
64
70
|
}
|
|
65
|
-
|
|
71
|
+
// Every entry dropped: leave the list out so apply changes nothing. Some
|
|
72
|
+
// dropped: fail the build rather than remove those members (edk#2198).
|
|
73
|
+
return finishMemberList(where, out, dropped, diagnostics);
|
|
66
74
|
}
|
|
67
75
|
function roleValue(value, roles, ownerTfLabel, appId, orgRefs) {
|
|
68
76
|
if (isUnsafePlatformId(value))
|
|
@@ -122,6 +122,8 @@ export interface GroupRefAst {
|
|
|
122
122
|
readonly groupKey: string;
|
|
123
123
|
/** The group's display name — the lookup value. */
|
|
124
124
|
readonly name: string;
|
|
125
|
+
/** False when org.ts doesn't carry the group: printed as `groupRef({ name })`, not `org.groups.<key>` (edk#2241). */
|
|
126
|
+
readonly inOrgCatalog?: false;
|
|
125
127
|
}
|
|
126
128
|
/** Reference to a sub-automation via the app's `automations` bag. */
|
|
127
129
|
export interface AutomationRefAst {
|
|
@@ -123,7 +123,7 @@ export interface FilterFromTfCodec<Field = string, ReferenceValue = never> {
|
|
|
123
123
|
* that understand that envelope may override the fallback here.
|
|
124
124
|
*/
|
|
125
125
|
readonly referenceType?: (value: TfValue, fallback: ValueType) => ValueType;
|
|
126
|
-
readonly literal?: (value: TfValue, valueType: string) => TfValue;
|
|
126
|
+
readonly literal?: (value: TfValue, valueType: string, field?: Field) => TfValue;
|
|
127
127
|
/** Decode a RECORD_FIELD value's source-record field reference; without it only raw platform ids decode. */
|
|
128
128
|
readonly recordField?: (value: TfValue) => Field;
|
|
129
129
|
/** Whether a RECORD_FIELD `object` reference names the owning app or element; without it only raw platform ids decode. */
|
|
@@ -516,6 +516,11 @@ export function filterFromTf(value, codec, fieldScope = "app") {
|
|
|
516
516
|
})();
|
|
517
517
|
if (left === undefined)
|
|
518
518
|
throw new EntityTfError(`${type} filter has no left side`);
|
|
519
|
+
const comparedField = "field" in left
|
|
520
|
+
? left.field
|
|
521
|
+
: left.leftValue.type === "FIELD"
|
|
522
|
+
? left.leftValue.value
|
|
523
|
+
: undefined;
|
|
519
524
|
if ("not" in filter && filter.not === true && !NEGATABLE_FILTER_TYPES.has(type)) {
|
|
520
525
|
throw new EntityTfError(`${type} filter does not support not`);
|
|
521
526
|
}
|
|
@@ -535,13 +540,13 @@ export function filterFromTf(value, codec, fieldScope = "app") {
|
|
|
535
540
|
return { type: "CONSECUTIVE_RANGE", ...left, ...options, unit: filter.unit.toUpperCase(), count: filter.count, offset: filter.offset, ...(filter.iso_week !== undefined && { isoWeek: filter.iso_week }) };
|
|
536
541
|
}
|
|
537
542
|
if (type === "in") {
|
|
538
|
-
return { type: "IN", ...left, ...options, values: filter.values.map((item) => filterValueFromTf(item, codec, fieldScope)), ...not };
|
|
543
|
+
return { type: "IN", ...left, ...options, values: filter.values.map((item) => filterValueFromTf(item, codec, fieldScope, comparedField)), ...not };
|
|
539
544
|
}
|
|
540
545
|
if (type === "contains" || type === "overlaps") {
|
|
541
|
-
return { type: type.toUpperCase(), ...left, ...options, values: filter.values.map((item) => filterValueFromTf(item, codec, fieldScope)), ...not };
|
|
546
|
+
return { type: type.toUpperCase(), ...left, ...options, values: filter.values.map((item) => filterValueFromTf(item, codec, fieldScope, comparedField)), ...not };
|
|
542
547
|
}
|
|
543
548
|
if (type === "between") {
|
|
544
|
-
return { type: "BETWEEN", ...left, ...options, min: filterValueFromTf(filter.min, codec, fieldScope), max: filterValueFromTf(filter.max, codec, fieldScope), ...not };
|
|
549
|
+
return { type: "BETWEEN", ...left, ...options, min: filterValueFromTf(filter.min, codec, fieldScope, comparedField), max: filterValueFromTf(filter.max, codec, fieldScope, comparedField), ...not };
|
|
545
550
|
}
|
|
546
551
|
const single = filter;
|
|
547
552
|
const filterType = {
|
|
@@ -554,12 +559,12 @@ export function filterFromTf(value, codec, fieldScope = "app") {
|
|
|
554
559
|
};
|
|
555
560
|
const canonical = filterType[type];
|
|
556
561
|
return canonical === "LIKE"
|
|
557
|
-
? { type: canonical, ...left, ...options, value: filterValueFromTf(single.value, codec, fieldScope), ...not, ...(single.case_insensitive !== undefined && { caseInsensitive: single.case_insensitive }), ...(single.mode !== undefined && { mode: single.mode.toUpperCase() }) }
|
|
558
|
-
: { type: canonical, ...left, ...options, value: filterValueFromTf(single.value, codec, fieldScope), ...not };
|
|
562
|
+
? { type: canonical, ...left, ...options, value: filterValueFromTf(single.value, codec, fieldScope, comparedField), ...not, ...(single.case_insensitive !== undefined && { caseInsensitive: single.case_insensitive }), ...(single.mode !== undefined && { mode: single.mode.toUpperCase() }) }
|
|
563
|
+
: { type: canonical, ...left, ...options, value: filterValueFromTf(single.value, codec, fieldScope, comparedField), ...not };
|
|
559
564
|
}
|
|
560
|
-
function filterValueFromTf(value, codec, fieldScope) {
|
|
565
|
+
function filterValueFromTf(value, codec, fieldScope, field) {
|
|
561
566
|
const type = value.type.toLowerCase();
|
|
562
|
-
const literal = codec.literal?.(value.value, type) ?? value.value;
|
|
567
|
+
const literal = codec.literal?.(value.value, type, field) ?? value.value;
|
|
563
568
|
if (["text", "uuid", "number", "boolean", "date", "datetime"].includes(type) && typeof literal === "object" && literal !== null) {
|
|
564
569
|
throw new EntityTfError(`${type} filter literal contains an unresolved expression or object`);
|
|
565
570
|
}
|
|
@@ -25,6 +25,7 @@ export type WorkflowFieldType = "TEXT" | "HANDLE" | "NUMBER" | "DECIMAL" | "BOOL
|
|
|
25
25
|
*
|
|
26
26
|
* `userId` follows the same rule: the provider's attribute spells USER_ID as
|
|
27
27
|
* a bare "user", so to-tf maps USER_ID -> "user" and from-tf maps it back.
|
|
28
|
+
* So does `groupId` (GROUP_ID, the provider's "group"; #2204).
|
|
28
29
|
*/
|
|
29
30
|
export declare const FIELD_TYPE_MAP: {
|
|
30
31
|
readonly text: "TEXT";
|
|
@@ -35,6 +36,7 @@ export declare const FIELD_TYPE_MAP: {
|
|
|
35
36
|
readonly datetime: "DATETIME";
|
|
36
37
|
readonly user: "USER";
|
|
37
38
|
readonly userId: "USER_ID";
|
|
39
|
+
readonly groupId: "GROUP_ID";
|
|
38
40
|
readonly json: "JSON";
|
|
39
41
|
readonly object: "OBJECT";
|
|
40
42
|
readonly attachmentId: "ATTACHMENT_ID";
|
|
@@ -60,12 +62,13 @@ export type TriggerFieldTypeAlias = Exclude<FieldTypeAlias, "user">;
|
|
|
60
62
|
* Subset of {@link TriggerFieldTypeAlias} that an `onDemand` input may
|
|
61
63
|
* declare. Mirrors the provider's `elementum_on_demand_trigger`
|
|
62
64
|
* `parameters[].type` enum (text, number, decimal, boolean, date, datetime,
|
|
63
|
-
* user, group, attachment, record)
|
|
65
|
+
* user, group, attachment, record), with USER_ID, GROUP_ID and ATTACHMENT_ID
|
|
66
|
+
* authored as `userId`, `groupId` and `attachmentId`: `json` and `object` have no provider
|
|
64
67
|
* spelling, so OpenTofu rejects the generated config at plan time (#1415).
|
|
65
68
|
*/
|
|
66
69
|
export type OnDemandParamTypeAlias = Exclude<TriggerFieldTypeAlias, "json" | "object">;
|
|
67
70
|
/** Runtime list of {@link OnDemandParamTypeAlias} values. */
|
|
68
|
-
export declare const ON_DEMAND_PARAM_TYPES: readonly ["text", "number", "decimal", "boolean", "date", "datetime", "userId", "attachmentId", "record"];
|
|
71
|
+
export declare const ON_DEMAND_PARAM_TYPES: readonly ["text", "number", "decimal", "boolean", "date", "datetime", "userId", "groupId", "attachmentId", "record"];
|
|
69
72
|
/**
|
|
70
73
|
* Maps a user-friendly FieldTypeAlias to the TypeScript type it represents.
|
|
71
74
|
* Used to derive the phantom T in Ref<T> for trigger inputs.
|
|
@@ -75,4 +78,4 @@ export declare const ON_DEMAND_PARAM_TYPES: readonly ["text", "number", "decimal
|
|
|
75
78
|
* Used when generating app definitions from Hydra's field metadata.
|
|
76
79
|
*/
|
|
77
80
|
export declare const ASPECT_FIELD_TYPE_NAME_TO_WORKFLOW_FIELD_TYPE: Record<string, WorkflowFieldType>;
|
|
78
|
-
export type FieldTypeToTS<A extends FieldTypeAlias> = A extends "text" ? string : A extends "number" | "decimal" ? number : A extends "boolean" ? boolean : A extends "date" | "datetime" ? string : A extends "user" ? string : A extends "userId" ? CalculationTypedValue<string, "user"> : A extends "attachmentId" ? string : A extends "json" | "object" ? unknown : A extends "record" ? RecordShape<AppOrElementRef> : unknown;
|
|
81
|
+
export type FieldTypeToTS<A extends FieldTypeAlias> = A extends "text" ? string : A extends "number" | "decimal" ? number : A extends "boolean" ? boolean : A extends "date" | "datetime" ? string : A extends "user" ? string : A extends "userId" ? CalculationTypedValue<string, "user"> : A extends "attachmentId" ? string : A extends "groupId" ? string : A extends "json" | "object" ? unknown : A extends "record" ? RecordShape<AppOrElementRef> : unknown;
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* `userId` follows the same rule: the provider's attribute spells USER_ID as
|
|
15
15
|
* a bare "user", so to-tf maps USER_ID -> "user" and from-tf maps it back.
|
|
16
|
+
* So does `groupId` (GROUP_ID, the provider's "group"; #2204).
|
|
16
17
|
*/
|
|
17
18
|
export const FIELD_TYPE_MAP = {
|
|
18
19
|
text: "TEXT",
|
|
@@ -23,6 +24,7 @@ export const FIELD_TYPE_MAP = {
|
|
|
23
24
|
datetime: "DATETIME",
|
|
24
25
|
user: "USER",
|
|
25
26
|
userId: "USER_ID",
|
|
27
|
+
groupId: "GROUP_ID",
|
|
26
28
|
json: "JSON",
|
|
27
29
|
object: "OBJECT",
|
|
28
30
|
attachmentId: "ATTACHMENT_ID",
|
|
@@ -34,7 +36,7 @@ export function isOnDemandRecordType(type) {
|
|
|
34
36
|
}
|
|
35
37
|
/** Runtime list of {@link OnDemandParamTypeAlias} values. */
|
|
36
38
|
export const ON_DEMAND_PARAM_TYPES = [
|
|
37
|
-
"text", "number", "decimal", "boolean", "date", "datetime", "userId", "attachmentId", "record",
|
|
39
|
+
"text", "number", "decimal", "boolean", "date", "datetime", "userId", "groupId", "attachmentId", "record",
|
|
38
40
|
];
|
|
39
41
|
/**
|
|
40
42
|
* Maps a user-friendly FieldTypeAlias to the TypeScript type it represents.
|
|
@@ -21,11 +21,14 @@ export interface PrintSkillV2Options {
|
|
|
21
21
|
/**
|
|
22
22
|
* Set for a cross-org clone: a foreign-app tool target was resolved
|
|
23
23
|
* against the SOURCE org, so it's flagged as a TODO for manual review
|
|
24
|
-
* instead of silently carried over.
|
|
25
|
-
*
|
|
24
|
+
* instead of silently carried over. An access-policy group prints a
|
|
25
|
+
* build-blocking placeholder unless {@link destinationGroups} names it
|
|
26
|
+
* (kept through `--map`, edk#1894) — same treatment as agent tools
|
|
26
27
|
* (`src/entities/agent/deserializer/print-agent-v2.ts`).
|
|
27
28
|
*/
|
|
28
29
|
readonly crossOrg?: boolean;
|
|
30
|
+
/** Cross-org only: the destination's group name → `org.groups` key; a policy group named there prints as that key (edk#1894). */
|
|
31
|
+
readonly destinationGroups?: ReadonlyMap<string, string>;
|
|
29
32
|
/**
|
|
30
33
|
* Name → refName for every app already on disk in this workspace (board
|
|
31
34
|
* issue #40). A foreign-app tool target whose name is a key here prints
|
|
@@ -127,7 +127,12 @@ export function printSkillV2(skill, opts) {
|
|
|
127
127
|
if (crossOrg && skill.accessPolicy.groups.length > 0) {
|
|
128
128
|
lines.push(" groups: [");
|
|
129
129
|
for (const group of skill.accessPolicy.groups) {
|
|
130
|
-
|
|
130
|
+
// A group the destination org has, by name, was kept through --map (edk#1894).
|
|
131
|
+
const destinationKey = opts.destinationGroups?.get(group.name);
|
|
132
|
+
if (destinationKey !== undefined)
|
|
133
|
+
lines.push(` org.groups${safeMember(destinationKey)},`);
|
|
134
|
+
else
|
|
135
|
+
lines.push(` TODO_DESTINATION_GROUP, // TODO: cross-org clone — verify the destination group's membership, then replace with org.groups.<key> for source group ${quote(group.name)}.`);
|
|
131
136
|
}
|
|
132
137
|
lines.push(" ],");
|
|
133
138
|
}
|
|
@@ -206,6 +211,8 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
|
|
|
206
211
|
: undefined;
|
|
207
212
|
lines.push(` name: ${quote(tool.name)},`);
|
|
208
213
|
lines.push(` description: ${quote(tool.description)},`);
|
|
214
|
+
if (tool.labelSuffix !== undefined)
|
|
215
|
+
lines.push(` labelSuffix: ${tool.labelSuffix},`);
|
|
209
216
|
if (tool.status !== undefined)
|
|
210
217
|
lines.push(` status: ${quote(tool.status)},`);
|
|
211
218
|
if (tool.startMessage !== undefined)
|
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { EntityTfError } from "../../engine/entity.js";
|
|
9
9
|
import { optionalString, ownerMismatchBlocker, reportAuthoringBlocker, resourceRefLabel } from "../../engine/pull/context.js";
|
|
10
|
-
import { isTfExpr, scopedLabelToBagKey } from "../../engine/tf/index.js";
|
|
10
|
+
import { appScopedResourceLabel, exportLabelSuffix, isTfExpr, scopedLabelToBagKey, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
11
11
|
import { skillToolFromTf } from "../skill-tool/from-tf.js";
|
|
12
|
+
import { skillToolBareLabel } from "../skill-tool/to-tf.js";
|
|
12
13
|
import { APP_RESOURCE_TYPE } from "../app/module.js";
|
|
13
14
|
import { analyzeSkillInputCoverage, decomposeSkillInstructionsLossless, skillCoverageGapDiagnostics, skillCoverageReportLines, } from "./input-coverage.js";
|
|
14
15
|
import { SKILL_RESOURCE_TYPE } from "./module.js";
|
|
@@ -151,11 +152,17 @@ export function skillFromTf(skillBlock, toolBlocks, appLabel, ctx) {
|
|
|
151
152
|
...(negativeKeywords !== undefined && { negativeKeywords }),
|
|
152
153
|
};
|
|
153
154
|
const owner = { appType: APP_RESOURCE_TYPE, appLabel, ownerTfLabel: appLabel, skillType: SKILL_RESOURCE_TYPE, skillLabel: label };
|
|
155
|
+
// Pin the `_N` ei gave each suffixed tool, as for agent tools (edk#1987).
|
|
156
|
+
const skillBare = tsLabelToTfLabel(scopedLabelToBagKey(appLabel, label));
|
|
154
157
|
const tools = [];
|
|
155
158
|
for (const block of toolBlocks) {
|
|
156
159
|
const tool = skillToolFromTf(block, owner, ctx);
|
|
157
|
-
if (tool
|
|
158
|
-
|
|
160
|
+
if (tool === undefined)
|
|
161
|
+
continue;
|
|
162
|
+
const labelSuffix = block.label === undefined
|
|
163
|
+
? undefined
|
|
164
|
+
: exportLabelSuffix(appScopedResourceLabel(appLabel, skillToolBareLabel(skillBare, tool.name, "")), block.label);
|
|
165
|
+
tools.push(labelSuffix === undefined ? tool : { ...tool, labelSuffix });
|
|
159
166
|
}
|
|
160
167
|
const rawInstructions = optionalString(attrs, "instructions", where, ctx) ?? "";
|
|
161
168
|
const coverageTools = tools.map((tool) => ({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** The skill entity's registry entry + resource-type constant (see src/graph/). */
|
|
2
2
|
import { rootParentFactoryEntry } from "../../catalog/render-helpers.js";
|
|
3
3
|
import { isTfExpr, scopedLabelToBagKey } from "../../engine/tf/index.js";
|
|
4
|
+
import { GROUP_RESOURCE_TYPE } from "../org/group.js";
|
|
4
5
|
import { printSkillV2 } from "./deserializer/print-skill-v2.js";
|
|
5
6
|
import { skillFromTf } from "./from-tf.js";
|
|
6
7
|
import { skillToTf } from "./to-tf.js";
|
|
@@ -113,6 +114,7 @@ export const skillModule = {
|
|
|
113
114
|
appRefName: opts.appRefName,
|
|
114
115
|
orgImportPath: opts.orgImportPath,
|
|
115
116
|
...(opts.crossOrg !== undefined && { crossOrg: opts.crossOrg }),
|
|
117
|
+
...(opts.destinationGroups !== undefined && { destinationGroups: opts.destinationGroups }),
|
|
116
118
|
...(opts.foreignAppRefNames !== undefined && { foreignAppRefNames: opts.foreignAppRefNames }),
|
|
117
119
|
...(opts.foreignElementRefNames !== undefined && { foreignElementRefNames: opts.foreignElementRefNames }),
|
|
118
120
|
...(opts.foreignTaskRefNames !== undefined && { foreignTaskRefNames: opts.foreignTaskRefNames }),
|
|
@@ -140,6 +142,8 @@ export const skillModule = {
|
|
|
140
142
|
},
|
|
141
143
|
roundtrip: {
|
|
142
144
|
referenceAliases: [],
|
|
145
|
+
// Provider set attributes (edk#2437): order carries no meaning.
|
|
146
|
+
unorderedListAttributes: ["user_ids", "group_ids"],
|
|
143
147
|
stringSuffixAliases: [
|
|
144
148
|
{
|
|
145
149
|
attribute: "instructions",
|
|
@@ -157,4 +161,18 @@ export const skillModule = {
|
|
|
157
161
|
stubRef: skillStubRef,
|
|
158
162
|
refFromAuthoring: skillRefFromAuthoring,
|
|
159
163
|
},
|
|
164
|
+
// A skill's access policy is its user_ids/group_ids; dropping it keeps the skill.
|
|
165
|
+
portable: {
|
|
166
|
+
principals: [
|
|
167
|
+
{
|
|
168
|
+
resourceType: SKILL_RESOURCE_TYPE,
|
|
169
|
+
groupAttribute: "group_ids",
|
|
170
|
+
groupDataType: GROUP_RESOURCE_TYPE,
|
|
171
|
+
userAttributes: ["user_ids"],
|
|
172
|
+
whenDropped: "attributes",
|
|
173
|
+
noun: "skill access policy",
|
|
174
|
+
whenDroppedNote: "the skill is now open to everyone who can see the app's agents",
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
},
|
|
160
178
|
};
|
|
@@ -41,7 +41,14 @@ export interface SkillToTfResult {
|
|
|
41
41
|
/** The skill's terraform address. */
|
|
42
42
|
readonly address: string;
|
|
43
43
|
}
|
|
44
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* `_N` suffixes for each skill's tools whose labels collide, keyed
|
|
46
|
+
* `<refName>#<index>`, one counter per skill across tool kinds, as ei's
|
|
47
|
+
* export (`generateAppSkillImportBlocks`) counts known tool kinds. A tool with
|
|
48
|
+
* `labelSuffix` keeps that `_N`; the others take the lowest free count in tool
|
|
49
|
+
* order (`collisionLabelSuffixes`). Pull pins every tool ei suffixed
|
|
50
|
+
* (skillFromTf), so a pulled skill rebuilds its exported labels.
|
|
51
|
+
*/
|
|
45
52
|
export declare function computeToolLabelSuffixes(siblingSkills: readonly DeployableEntity[]): ReadonlyMap<string, string>;
|
|
46
53
|
/** `elementum_agentic_skill` + one tool resource per implemented tool, in the platform's dialect. */
|
|
47
54
|
export declare function skillToTf(entity: DeployableEntity, ctx: SkillToTfContext): SkillToTfResult;
|
|
@@ -14,9 +14,11 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import { workspaceAspectKey } from "../../engine/build/context.js";
|
|
16
16
|
import { EntityTfError } from "../../engine/entity.js";
|
|
17
|
-
import { appScopedResourceLabel, expr, sanitizeName, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
17
|
+
import { appScopedResourceLabel, collisionLabelSuffixes, expr, sanitizeName, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
18
18
|
import { resolveForeignRef } from "../shared/foreign-ref.js";
|
|
19
|
+
import { assertUniqueToolAddresses, toolName } from "../agent-tool/to-tf.js";
|
|
19
20
|
import { skillToolToTf } from "../skill-tool/to-tf.js";
|
|
21
|
+
import { SKILL_TOOL_SUB_TYPE_BY_TYPE_KEY } from "../skill-tool/types.js";
|
|
20
22
|
import { APP_RESOURCE_TYPE } from "../app/module.js";
|
|
21
23
|
import { SERVICE_ACCOUNT_RESOURCE_TYPE } from "../service-account/module.js";
|
|
22
24
|
import { analyzeSkillInputCoverage, coverageToolsFromWire, skillCoverageGapDiagnostics, skillCoverageReportLines, } from "./input-coverage.js";
|
|
@@ -47,22 +49,25 @@ function toSortableSkills(entities) {
|
|
|
47
49
|
}
|
|
48
50
|
return out;
|
|
49
51
|
}
|
|
50
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* `_N` suffixes for each skill's tools whose labels collide, keyed
|
|
54
|
+
* `<refName>#<index>`, one counter per skill across tool kinds, as ei's
|
|
55
|
+
* export (`generateAppSkillImportBlocks`) counts known tool kinds. A tool with
|
|
56
|
+
* `labelSuffix` keeps that `_N`; the others take the lowest free count in tool
|
|
57
|
+
* order (`collisionLabelSuffixes`). Pull pins every tool ei suffixed
|
|
58
|
+
* (skillFromTf), so a pulled skill rebuilds its exported labels.
|
|
59
|
+
*/
|
|
51
60
|
export function computeToolLabelSuffixes(siblingSkills) {
|
|
52
|
-
const counts = new Map();
|
|
53
61
|
const suffixes = new Map();
|
|
54
62
|
for (const skill of toSortableSkills(siblingSkills)) {
|
|
55
|
-
skill.tools.
|
|
63
|
+
const perTool = collisionLabelSuffixes(skill.tools.map((entry) => {
|
|
56
64
|
const typeKey = Object.keys(entry)[0];
|
|
57
|
-
if (typeKey === undefined)
|
|
58
|
-
return;
|
|
65
|
+
if (typeKey === undefined || !SKILL_TOOL_SUB_TYPE_BY_TYPE_KEY.has(typeKey))
|
|
66
|
+
return undefined;
|
|
59
67
|
const inner = entry[typeKey];
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
counts.set(key, count + 1);
|
|
64
|
-
suffixes.set(`${skill.refName}#${index}`, count > 0 ? `_${count}` : "");
|
|
65
|
-
});
|
|
68
|
+
return { base: sanitizeName(inner?.name ?? ""), ...(inner?.labelSuffix !== undefined && { pinned: inner.labelSuffix }) };
|
|
69
|
+
}));
|
|
70
|
+
perTool.forEach((suffix, index) => suffixes.set(`${skill.refName}#${index}`, suffix));
|
|
66
71
|
}
|
|
67
72
|
return suffixes;
|
|
68
73
|
}
|
|
@@ -115,6 +120,7 @@ export function skillToTf(entity, ctx) {
|
|
|
115
120
|
if (discovery?.negativeKeywords !== undefined)
|
|
116
121
|
attrs["negative_keywords"] = [...discovery.negativeKeywords];
|
|
117
122
|
const toolLabelSuffixes = computeToolLabelSuffixes(ctx.siblingEntities ?? [entity]);
|
|
123
|
+
const toolAddresses = [];
|
|
118
124
|
const blocks = [{ kind: "resource", type: SKILL_RESOURCE_TYPE, label: tfLabel, attrs }];
|
|
119
125
|
(payload.tools ?? []).forEach((entry, index) => {
|
|
120
126
|
const tool = skillToolToTf(entry, {
|
|
@@ -173,8 +179,11 @@ export function skillToTf(entity, ctx) {
|
|
|
173
179
|
},
|
|
174
180
|
diagnostics: ctx.diagnostics,
|
|
175
181
|
});
|
|
176
|
-
if (tool
|
|
177
|
-
|
|
182
|
+
if (tool === undefined)
|
|
183
|
+
return;
|
|
184
|
+
toolAddresses.push({ name: toolName(entry), address: tool.address });
|
|
185
|
+
blocks.push(tool.block);
|
|
178
186
|
});
|
|
187
|
+
assertUniqueToolAddresses(`skill "${name}" (${SKILL_RESOURCE_TYPE}.${tfLabel})`, toolAddresses);
|
|
179
188
|
return { blocks, address: `${SKILL_RESOURCE_TYPE}.${tfLabel}` };
|
|
180
189
|
}
|
|
@@ -92,6 +92,14 @@ interface CommonToolOptions {
|
|
|
92
92
|
readonly status?: SkillToolStatus;
|
|
93
93
|
readonly startMessage?: string;
|
|
94
94
|
readonly runAs?: AgentToolRunAs;
|
|
95
|
+
/**
|
|
96
|
+
* Pins the `_N` on this tool's terraform label, for a tool whose name shares
|
|
97
|
+
* a label with others (`a-b`, `a_b`, `aB`). Pull writes it when ei's export
|
|
98
|
+
* gave the tool a suffix; keep it, or the tool's address changes. Without
|
|
99
|
+
* it, a colliding tool takes the lowest free `_N` in tool order. Never sent
|
|
100
|
+
* to the platform. A whole number from 1 to `Number.MAX_SAFE_INTEGER`.
|
|
101
|
+
*/
|
|
102
|
+
readonly labelSuffix?: number;
|
|
95
103
|
}
|
|
96
104
|
export type SkillAutomationInputs<T> = [keyof T] extends [never] ? {
|
|
97
105
|
readonly [key: string]: never;
|
|
@@ -27,11 +27,15 @@ function common(opts) {
|
|
|
27
27
|
// every tool factory routes through here, so this is the single
|
|
28
28
|
// enforcement point; the tf passes never re-check.
|
|
29
29
|
if (!isValidToolName(opts.name)) {
|
|
30
|
-
throw new Error(`skill tool name "${opts.name}" must be 1–64 characters of letters, digits,
|
|
31
|
-
`
|
|
30
|
+
throw new Error(`skill tool name "${opts.name}" must be 1–64 characters of letters, digits, underscores, ` +
|
|
31
|
+
`and hyphens (A–Z, a–z, 0–9, _, -) with no consecutive underscores — no spaces.`);
|
|
32
|
+
}
|
|
33
|
+
if (opts.labelSuffix !== undefined && (!Number.isSafeInteger(opts.labelSuffix) || opts.labelSuffix < 1)) {
|
|
34
|
+
throw new Error(`skill tool "${opts.name}" labelSuffix must be a whole number from 1 to Number.MAX_SAFE_INTEGER; got ${String(opts.labelSuffix)}.`);
|
|
32
35
|
}
|
|
33
36
|
return {
|
|
34
37
|
name: opts.name,
|
|
38
|
+
...(opts.labelSuffix !== undefined ? { labelSuffix: opts.labelSuffix } : {}),
|
|
35
39
|
description: opts.description,
|
|
36
40
|
status: opts.status ?? "ACTIVE",
|
|
37
41
|
...(opts.startMessage !== undefined ? { startMessage: opts.startMessage } : {}),
|
|
@@ -70,6 +70,8 @@ export interface NormalizedSkillTool {
|
|
|
70
70
|
/** Present only when it differs from the default ("ACTIVE"). */
|
|
71
71
|
readonly status?: "INACTIVE";
|
|
72
72
|
readonly startMessage?: string;
|
|
73
|
+
/** The `_N` ei gave this tool's label (edk#1987); see the builders' `labelSuffix`. */
|
|
74
|
+
readonly labelSuffix?: number;
|
|
73
75
|
readonly target?: NormalizedSkillToolTarget;
|
|
74
76
|
readonly fields?: readonly NormalizedSkillToolField[];
|
|
75
77
|
readonly filterVariables?: readonly NormalizedFilterVariable[];
|
|
@@ -59,4 +59,12 @@ export interface SkillToolToTfResult {
|
|
|
59
59
|
/** `<resourceType>.<tfLabel>` — bookkeeping for the skill catalog. */
|
|
60
60
|
readonly address: string;
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* One authored tool entry (`{ createRecord: {...} }`) → its resource block;
|
|
64
|
+
* undefined = degraded with a diagnostic (unimplemented sub-type, missing
|
|
65
|
+
* target). Tool-name validity is enforced in the authoring builders
|
|
66
|
+
* (entities/skill/tools.ts), not here.
|
|
67
|
+
*/
|
|
68
|
+
/** A skill tool's bare label: `<skill>_<sanitizeName(tool name)>` plus its collision suffix. */
|
|
69
|
+
export declare function skillToolBareLabel(skillBareTfLabel: string, toolName: string, labelSuffix: string): string;
|
|
62
70
|
export declare function skillToolToTf(entry: Record<string, unknown>, ctx: SkillToolToTfContext): SkillToolToTfResult | undefined;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { typedCoverageGap } from "../../engine/coverage-gaps.js";
|
|
10
10
|
import { workspaceAspectKey } from "../../engine/build/context.js";
|
|
11
|
-
import { automationRunTargetResourceAttr } from "../automation/
|
|
11
|
+
import { automationRunTargetResourceAttr } from "../automation/run-target.js";
|
|
12
12
|
import { appScopedResourceLabel, childPartFromScopedLabel, expr, sanitizeName, scopedResourceLabel, stableIdSuffix, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
13
13
|
import { authoredFieldKeysFromPayload, fieldRefToTfValue, } from "../field/to-tf.js";
|
|
14
14
|
import { foreignFieldDataLabel } from "../shared/foreign-ref.js";
|
|
@@ -146,6 +146,10 @@ function fieldRefValue(token, where, ctx, target) {
|
|
|
146
146
|
* target). Tool-name validity is enforced in the authoring builders
|
|
147
147
|
* (entities/skill/tools.ts), not here.
|
|
148
148
|
*/
|
|
149
|
+
/** A skill tool's bare label: `<skill>_<sanitizeName(tool name)>` plus its collision suffix. */
|
|
150
|
+
export function skillToolBareLabel(skillBareTfLabel, toolName, labelSuffix) {
|
|
151
|
+
return `${skillBareTfLabel}_${sanitizeName(toolName)}${labelSuffix}`;
|
|
152
|
+
}
|
|
149
153
|
/**
|
|
150
154
|
* A whole skill tool the build cannot emit (edk#1480): the site states the
|
|
151
155
|
* consequence itself instead of leaving it to the generic "dropped" wording.
|
|
@@ -179,7 +183,7 @@ export function skillToolToTf(entry, ctx) {
|
|
|
179
183
|
}
|
|
180
184
|
const where = `skill tool "${name}"`;
|
|
181
185
|
const skillBareTfLabel = ctx.skillBareTfLabel ?? childPartFromScopedLabel(ctx.appTfLabel, ctx.skillTfLabel, "app");
|
|
182
|
-
const tfLabel = appScopedResourceLabel(ctx.appTfLabel,
|
|
186
|
+
const tfLabel = appScopedResourceLabel(ctx.appTfLabel, skillToolBareLabel(skillBareTfLabel, name, ctx.labelSuffix ?? ""));
|
|
183
187
|
const attrs = {
|
|
184
188
|
skill_id: expr.resourceAttr("elementum_agentic_skill", ctx.skillTfLabel, ["id"]),
|
|
185
189
|
app_id: expr.resourceAttr("elementum_app", ctx.appTfLabel, ["id"]),
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* `elementum_agent_view.layout` → `agentViews.<key>.layout`;
|
|
4
4
|
* `elementum_custom_view.layout` → `customViews.<key>.layout` (see
|
|
5
5
|
* `viewBlocksFromTf`). References become typed markers at the per-block id
|
|
6
|
-
* positions, inside nested filters and inside actions; raw platform
|
|
7
|
-
*
|
|
6
|
+
* positions, inside nested filters and inside actions; a raw platform id there
|
|
7
|
+
* becomes the owner's field ref when it names one of its fields (#2155), else
|
|
8
|
+
* `unsafePlatformId(...)`. A layout this cannot represent makes the
|
|
8
9
|
* whole view unmanaged (skipped), never silently dropped: the code owns the
|
|
9
10
|
* layout, so a dropped detail would be cleared on the next apply.
|
|
10
11
|
*/
|
|
@@ -61,6 +62,11 @@ export interface AgentViewLayoutFromTfOptions {
|
|
|
61
62
|
readonly isOwnApp: (value: TfValue) => boolean;
|
|
62
63
|
/** Resolves a field reference to its bag key, a system field key, or a raw id. */
|
|
63
64
|
readonly fieldKey: (value: TfValue) => string | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* The key of the owner's own extracted field (or, with `systemKeys`, system
|
|
67
|
+
* field) a raw platform id names (#2155). Undefined for any other id.
|
|
68
|
+
*/
|
|
69
|
+
readonly ownFieldKey?: (id: string, systemKeys: boolean) => string | undefined;
|
|
64
70
|
/** Sees a raw platform id in a field position, which pulls as is (#1736 records the ones naming unextracted fields). */
|
|
65
71
|
readonly noteRawFieldId?: (id: string) => void;
|
|
66
72
|
/** Resolves another app's or element's data lookup. */
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* `elementum_agent_view.layout` → `agentViews.<key>.layout`;
|
|
4
4
|
* `elementum_custom_view.layout` → `customViews.<key>.layout` (see
|
|
5
5
|
* `viewBlocksFromTf`). References become typed markers at the per-block id
|
|
6
|
-
* positions, inside nested filters and inside actions; raw platform
|
|
7
|
-
*
|
|
6
|
+
* positions, inside nested filters and inside actions; a raw platform id there
|
|
7
|
+
* becomes the owner's field ref when it names one of its fields (#2155), else
|
|
8
|
+
* `unsafePlatformId(...)`. A layout this cannot represent makes the
|
|
8
9
|
* whole view unmanaged (skipped), never silently dropped: the code owns the
|
|
9
10
|
* layout, so a dropped detail would be cleared on the next apply.
|
|
10
11
|
*/
|
|
@@ -152,10 +153,9 @@ function deepRefs(value, where, opts) {
|
|
|
152
153
|
if (isTfExpr(value)) {
|
|
153
154
|
return sourceRef(value, opts) ?? fieldMarker(value, where, opts);
|
|
154
155
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
return
|
|
158
|
-
}
|
|
156
|
+
// A system key here would build as a plain string, not the field's id.
|
|
157
|
+
if (isPlatformId(value))
|
|
158
|
+
return rawFieldIdMarker(value, false, opts);
|
|
159
159
|
if (Array.isArray(value))
|
|
160
160
|
return value.map((item, i) => deepRefs(item, `${where}[${i}]`, opts));
|
|
161
161
|
const rec = plain(value);
|
|
@@ -203,10 +203,8 @@ function sourceRef(value, opts) {
|
|
|
203
203
|
return opts.foreignSource?.(value);
|
|
204
204
|
}
|
|
205
205
|
function fieldMarker(value, where, opts) {
|
|
206
|
-
if (typeof value === "string")
|
|
207
|
-
|
|
208
|
-
return unsafe(value);
|
|
209
|
-
}
|
|
206
|
+
if (typeof value === "string")
|
|
207
|
+
return rawFieldIdMarker(value, true, opts);
|
|
210
208
|
// Checked first: the owner's resolver reports a foreign lookup as unknown.
|
|
211
209
|
const foreign = opts.foreignField?.(value);
|
|
212
210
|
if (foreign !== undefined)
|
|
@@ -216,6 +214,18 @@ function fieldMarker(value, where, opts) {
|
|
|
216
214
|
throw new Unrepresentable(`${where} references a field the EDK cannot represent here`);
|
|
217
215
|
return PLATFORM_ID.test(key) ? unsafe(key) : { __specRef: "field", key };
|
|
218
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* A raw id at a field position: the owner's own field's ref when the id names
|
|
219
|
+
* one (#2155), else unsafePlatformId(...). The export keeps a system field's
|
|
220
|
+
* id raw, and an own field's whenever it can't name its resource.
|
|
221
|
+
*/
|
|
222
|
+
function rawFieldIdMarker(id, systemKeys, opts) {
|
|
223
|
+
const key = opts.ownFieldKey?.(id, systemKeys);
|
|
224
|
+
if (key !== undefined)
|
|
225
|
+
return { __specRef: "field", key };
|
|
226
|
+
opts.noteRawFieldId?.(id);
|
|
227
|
+
return unsafe(id);
|
|
228
|
+
}
|
|
219
229
|
/** Plain JSON outside the id positions: any reference here is unrepresentable. */
|
|
220
230
|
function literal(value, where) {
|
|
221
231
|
if (isTfExpr(value))
|