@elementumai/edk 0.8.0-preview.11 → 0.8.2-alpha.5
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 +510 -324
- package/dist-sdk/src/catalog/ai-provider-models.d.ts +30 -0
- package/dist-sdk/src/catalog/ai-provider-models.js +63 -0
- package/dist-sdk/src/catalog/factories.d.ts +56 -3
- package/dist-sdk/src/catalog/factories.js +83 -4
- package/dist-sdk/src/catalog/from-authoring.js +19 -2
- package/dist-sdk/src/catalog/index.d.ts +3 -2
- package/dist-sdk/src/catalog/index.js +3 -2
- package/dist-sdk/src/catalog/org.d.ts +1 -1
- package/dist-sdk/src/catalog/org.js +134 -50
- package/dist-sdk/src/catalog/render.d.ts +13 -1
- package/dist-sdk/src/catalog/render.js +21 -4
- package/dist-sdk/src/catalog/token.js +18 -0
- package/dist-sdk/src/catalog/types.d.ts +75 -3
- package/dist-sdk/src/catalog/types.js +3 -0
- package/dist-sdk/src/core/system-fields.d.ts +2 -0
- package/dist-sdk/src/core/system-fields.js +2 -0
- package/dist-sdk/src/core/types/ai-provider.d.ts +10 -23
- package/dist-sdk/src/core/types/ai-provider.js +1 -25
- package/dist-sdk/src/core/types/app.d.ts +26 -1
- package/dist-sdk/src/engine/build/context.d.ts +58 -0
- package/dist-sdk/src/engine/build/context.js +11 -1
- package/dist-sdk/src/engine/build/source-context.d.ts +45 -0
- package/dist-sdk/src/engine/build/source-context.js +23 -0
- package/dist-sdk/src/engine/pull/context.d.ts +15 -0
- package/dist-sdk/src/engine/pull/org.d.ts +10 -0
- package/dist-sdk/src/engine/pull/org.js +34 -4
- 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 +54 -0
- package/dist-sdk/src/engine/tf/labels.js +75 -0
- package/dist-sdk/src/engine/tf/parse.d.ts +15 -0
- package/dist-sdk/src/engine/tf/parse.js +162 -0
- package/dist-sdk/src/entities/access-policy/build.d.ts +26 -0
- package/dist-sdk/src/entities/access-policy/build.js +7 -0
- package/dist-sdk/src/entities/access-policy/filter.d.ts +61 -0
- package/dist-sdk/src/entities/access-policy/filter.js +83 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +66 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +187 -0
- package/dist-sdk/src/entities/access-policy/module.d.ts +3 -0
- package/dist-sdk/src/entities/access-policy/module.js +17 -0
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +43 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +164 -0
- package/dist-sdk/src/entities/access-policy/types.d.ts +4 -0
- package/dist-sdk/src/entities/access-policy/types.js +10 -0
- package/dist-sdk/src/entities/agent/build.d.ts +2 -0
- package/dist-sdk/src/entities/agent/build.js +1 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +38 -3
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +257 -32
- package/dist-sdk/src/entities/agent/from-tf.d.ts +29 -9
- package/dist-sdk/src/entities/agent/from-tf.js +146 -19
- package/dist-sdk/src/entities/agent/index.d.ts +1 -1
- package/dist-sdk/src/entities/agent/module.js +14 -4
- package/dist-sdk/src/entities/agent/to-tf.d.ts +46 -1
- package/dist-sdk/src/entities/agent/to-tf.js +160 -14
- package/dist-sdk/src/entities/agent/tools.d.ts +88 -9
- package/dist-sdk/src/entities/agent/tools.js +46 -7
- package/dist-sdk/src/entities/agent-a2a-skill/from-tf.d.ts +17 -0
- package/dist-sdk/src/entities/agent-a2a-skill/from-tf.js +64 -0
- package/dist-sdk/src/entities/agent-a2a-skill/module.d.ts +4 -0
- package/dist-sdk/src/entities/agent-a2a-skill/module.js +14 -0
- package/dist-sdk/src/entities/agent-a2a-skill/to-tf.d.ts +40 -0
- package/dist-sdk/src/entities/agent-a2a-skill/to-tf.js +47 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +51 -4
- package/dist-sdk/src/entities/agent-tool/from-tf.js +131 -35
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +11 -4
- package/dist-sdk/src/entities/agent-tool/to-tf.js +176 -30
- package/dist-sdk/src/entities/agent-tool/types.d.ts +5 -4
- package/dist-sdk/src/entities/agent-tool/types.js +38 -6
- package/dist-sdk/src/entities/app/build.d.ts +91 -13
- package/dist-sdk/src/entities/app/build.js +63 -5
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +3 -0
- package/dist-sdk/src/entities/app/from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/app/from-tf.js +32 -22
- package/dist-sdk/src/entities/app/index.d.ts +4 -1
- package/dist-sdk/src/entities/app/index.js +2 -1
- package/dist-sdk/src/entities/app/module.js +10 -2
- package/dist-sdk/src/entities/app/to-tf.d.ts +5 -0
- package/dist-sdk/src/entities/app/to-tf.js +45 -4
- package/dist-sdk/src/entities/automation/build.d.ts +57 -13
- package/dist-sdk/src/entities/automation/build.js +62 -42
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +25 -8
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +16 -1
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +206 -47
- package/dist-sdk/src/entities/automation/filter.d.ts +37 -3
- package/dist-sdk/src/entities/automation/filter.js +54 -3
- package/dist-sdk/src/entities/automation/from-tf.d.ts +26 -27
- package/dist-sdk/src/entities/automation/from-tf.js +1344 -222
- package/dist-sdk/src/entities/automation/index.d.ts +4 -0
- package/dist-sdk/src/entities/automation/index.js +4 -0
- package/dist-sdk/src/entities/automation/module.js +29 -32
- package/dist-sdk/src/entities/automation/operators.d.ts +29 -2
- package/dist-sdk/src/entities/automation/operators.js +27 -1
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +19 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +24 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +10 -21
- package/dist-sdk/src/entities/automation/script-code.js +272 -5
- package/dist-sdk/src/entities/automation/tasks.d.ts +125 -19
- package/dist-sdk/src/entities/automation/tasks.js +83 -15
- package/dist-sdk/src/entities/automation/to-tf.d.ts +10 -29
- package/dist-sdk/src/entities/automation/to-tf.js +1291 -230
- package/dist-sdk/src/entities/automation/triggers.d.ts +9 -1
- package/dist-sdk/src/entities/automation/types.d.ts +29 -4
- package/dist-sdk/src/entities/automation/types.js +76 -46
- package/dist-sdk/src/entities/element/build.d.ts +44 -13
- package/dist-sdk/src/entities/element/build.js +45 -3
- package/dist-sdk/src/entities/element/from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/element/from-tf.js +28 -14
- package/dist-sdk/src/entities/element/index.d.ts +4 -1
- package/dist-sdk/src/entities/element/index.js +2 -1
- package/dist-sdk/src/entities/element/module.js +4 -1
- package/dist-sdk/src/entities/element/to-tf.js +26 -3
- package/dist-sdk/src/entities/field/build.d.ts +61 -14
- package/dist-sdk/src/entities/field/build.js +10 -0
- package/dist-sdk/src/entities/field/calc/runtime.js +4 -0
- package/dist-sdk/src/entities/field/from-tf.d.ts +5 -3
- package/dist-sdk/src/entities/field/from-tf.js +118 -7
- package/dist-sdk/src/entities/field/module.js +3 -2
- package/dist-sdk/src/entities/field/to-tf.d.ts +46 -11
- package/dist-sdk/src/entities/field/to-tf.js +166 -17
- package/dist-sdk/src/entities/field/types.d.ts +26 -0
- package/dist-sdk/src/entities/field/types.js +34 -12
- package/dist-sdk/src/entities/file-reader/build.d.ts +108 -50
- package/dist-sdk/src/entities/file-reader/build.js +23 -23
- package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.d.ts +6 -0
- package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.js +109 -0
- package/dist-sdk/src/entities/file-reader/from-tf.d.ts +13 -0
- package/dist-sdk/src/entities/file-reader/from-tf.js +172 -0
- package/dist-sdk/src/entities/file-reader/index.d.ts +8 -3
- package/dist-sdk/src/entities/file-reader/index.js +7 -2
- package/dist-sdk/src/entities/file-reader/module.d.ts +3 -0
- package/dist-sdk/src/entities/file-reader/module.js +115 -0
- package/dist-sdk/src/entities/file-reader/to-tf.d.ts +14 -0
- package/dist-sdk/src/entities/file-reader/to-tf.js +84 -0
- package/dist-sdk/src/entities/file-reader/types.d.ts +32 -0
- package/dist-sdk/src/entities/file-reader/types.js +30 -0
- package/dist-sdk/src/entities/org/ai-provider.d.ts +13 -0
- package/dist-sdk/src/entities/org/ai-provider.js +46 -0
- package/dist-sdk/src/entities/org/connector.d.ts +8 -1
- package/dist-sdk/src/entities/org/connector.js +12 -14
- package/dist-sdk/src/entities/org/group.js +10 -1
- package/dist-sdk/src/entities/org/index.d.ts +1 -0
- package/dist-sdk/src/entities/org/index.js +1 -0
- package/dist-sdk/src/entities/org/user.js +10 -1
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +59 -9
- package/dist-sdk/src/entities/shared/filters/types.d.ts +1 -1
- package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +17 -0
- package/dist-sdk/src/entities/shared/tool-field-ref.js +46 -0
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +10 -1
- package/dist-sdk/src/entities/shared/types/field-types.js +9 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +19 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +128 -11
- package/dist-sdk/src/entities/skill/from-tf.js +4 -3
- package/dist-sdk/src/entities/skill/index.d.ts +1 -1
- package/dist-sdk/src/entities/skill/module.js +7 -1
- package/dist-sdk/src/entities/skill/to-tf.d.ts +26 -0
- package/dist-sdk/src/entities/skill/to-tf.js +65 -4
- package/dist-sdk/src/entities/skill/tools.d.ts +37 -8
- package/dist-sdk/src/entities/skill/tools.js +43 -1
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +34 -4
- package/dist-sdk/src/entities/skill-tool/from-tf.js +128 -18
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +13 -1
- package/dist-sdk/src/entities/skill-tool/to-tf.js +164 -25
- package/dist-sdk/src/entities/skill-tool/types.d.ts +5 -7
- package/dist-sdk/src/entities/skill-tool/types.js +47 -11
- package/dist-sdk/src/entities/view/from-tf.d.ts +6 -2
- package/dist-sdk/src/entities/view/from-tf.js +11 -9
- package/dist-sdk/src/entities/view/to-tf.d.ts +9 -7
- package/dist-sdk/src/entities/view/to-tf.js +39 -18
- package/dist-sdk/src/entities/view/types.d.ts +1 -1
- package/dist-sdk/src/entities/view/types.js +1 -1
- package/dist-sdk/src/graph/deferred-catalog-render.d.ts +0 -5
- package/dist-sdk/src/graph/deferred-catalog-render.js +1 -20
- package/dist-sdk/src/graph/index.d.ts +8 -0
- package/dist-sdk/src/graph/index.js +13 -9
- package/dist-sdk/src/graph/modules.js +8 -1
- package/dist-sdk/src/graph/types.d.ts +98 -4
- package/package.json +49 -16
- package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +0 -76
- package/dist-sdk/src/entities/automation/value-ref-tf.js +0 -190
|
@@ -10,7 +10,16 @@ export const userModule = {
|
|
|
10
10
|
data: {
|
|
11
11
|
participates: true,
|
|
12
12
|
lookupAttr: "email",
|
|
13
|
-
|
|
13
|
+
// A USER field's `default_value` (entities/field/types.ts's
|
|
14
|
+
// OrgFieldRefValue) and an access policy's `user_ids` (board issue #69)
|
|
15
|
+
// both round-trip as `data.elementum_user` lookups via the generic
|
|
16
|
+
// `rawLookup` mechanism — real, tested coverage, so this participates in
|
|
17
|
+
// the byte-fidelity roundtrip scope. A captured `elementum_user` data
|
|
18
|
+
// block for any OTHER reason still fails loud (missing from build
|
|
19
|
+
// output) rather than silently passing — surfacing gaps instead of
|
|
20
|
+
// hiding them was the tradeoff of leaving this false; if that surfaces a
|
|
21
|
+
// real one, extend the reproducing path rather than reverting this flag.
|
|
22
|
+
referencedByBuild: true,
|
|
14
23
|
},
|
|
15
24
|
authoring: { unit: "none" },
|
|
16
25
|
parents: [{ parent: "org", child: "user" }],
|
|
@@ -33,16 +33,42 @@
|
|
|
33
33
|
* filters, for instance, only produce `literal`, `field`, `app`, and
|
|
34
34
|
* `unresolved`).
|
|
35
35
|
*/
|
|
36
|
+
import type { LikeMode } from "./types.js";
|
|
37
|
+
import type { UserFieldKey } from "../../../catalog/types.js";
|
|
36
38
|
/** Reference to an app: `<appHandle>`. */
|
|
37
39
|
export interface AppRefAst {
|
|
38
40
|
readonly kind: "app";
|
|
39
41
|
readonly appHandle: string;
|
|
42
|
+
/** Present for a foreign data lookup that is not in the local catalog. */
|
|
43
|
+
readonly entityType?: "app" | "element";
|
|
44
|
+
/** Provider lookup name for that foreign app/element. */
|
|
45
|
+
readonly name?: string;
|
|
40
46
|
}
|
|
41
47
|
/** Reference to an app field: `<appHandle>.fields.<fieldKey>`. */
|
|
42
48
|
export interface FieldRefAst {
|
|
43
49
|
readonly kind: "field";
|
|
44
50
|
readonly appHandle: string;
|
|
45
51
|
readonly fieldKey: string;
|
|
52
|
+
/**
|
|
53
|
+
* Present when the field belongs to a DIFFERENT app/element than
|
|
54
|
+
* `appHandle` resolves locally — a foreign `data.elementum_field` lookup,
|
|
55
|
+
* not a same-workspace catalog access. `appHandle` in this case is a
|
|
56
|
+
* best-effort refName recovered from the owner's own data-block label
|
|
57
|
+
* (not guaranteed to match a real local ref — same caveat as
|
|
58
|
+
* `AppRefAst.name`, which this mirrors).
|
|
59
|
+
*/
|
|
60
|
+
readonly foreign?: {
|
|
61
|
+
readonly entityType: "app" | "element";
|
|
62
|
+
/** The owner's display name — resolves a same-name local catalog entry, same convention as `AppRefAst.name`. */
|
|
63
|
+
readonly name: string;
|
|
64
|
+
/** The field's OWN display name (the `data.elementum_field` block's `name` attr), when the stream carried it — used for the raw stub's `name:` when the owner isn't locally resolvable. */
|
|
65
|
+
readonly fieldName?: string;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/** Reference to a fixed platform user-directory attribute. */
|
|
69
|
+
export interface UserFieldRefAst {
|
|
70
|
+
readonly kind: "userField";
|
|
71
|
+
readonly fieldKey: UserFieldKey;
|
|
46
72
|
}
|
|
47
73
|
/** Reference to an app's search table: `<appHandle>.searchTables.<tableKey>`. */
|
|
48
74
|
export interface SearchTableRefAst {
|
|
@@ -82,21 +108,38 @@ export interface ApprovalChainRefAst {
|
|
|
82
108
|
readonly kind: "approvalChain";
|
|
83
109
|
readonly appHandle: string;
|
|
84
110
|
readonly approvalChainKey: string;
|
|
111
|
+
/** Imported provider id used when EDK does not emit the approval process. */
|
|
112
|
+
readonly unresolvedId?: string;
|
|
85
113
|
}
|
|
86
114
|
/**
|
|
87
|
-
* Reference to an org-level AI provider connector
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
* key (e.g. `bedrockSonnet`)
|
|
93
|
-
*
|
|
115
|
+
* Reference to an org-level AI provider connector, nested under its owning
|
|
116
|
+
* provider (`catalog.aiProviders.<provider>.models.<model>`) — connectors
|
|
117
|
+
* aren't app-owned, so there's no `appHandle`. `id` is the wire connector id,
|
|
118
|
+
* carried even when resolved so the printer can fall back to an id-only TODO
|
|
119
|
+
* literal on a catalog miss; `name` is set only when the connector catalog
|
|
120
|
+
* resolved a display name. `handle` is the model key (e.g. `bedrockSonnet`)
|
|
121
|
+
* resolved via the connector catalog — when present, the printer emits it
|
|
122
|
+
* directly rather than re-deriving a handle from `name`. `providerKey` is the
|
|
123
|
+
* owning AI provider's key, resolved from the connector's `provider_id`
|
|
124
|
+
* reference; when unset (the provider couldn't be resolved), the printer
|
|
125
|
+
* falls back to a TODO placeholder rather than a flat `catalog.connectors`
|
|
126
|
+
* lookup, which no longer exists on the catalog barrel.
|
|
94
127
|
*/
|
|
95
128
|
export interface ConnectorRefAst {
|
|
96
129
|
readonly kind: "connector";
|
|
97
130
|
readonly id: string;
|
|
98
131
|
readonly name?: string;
|
|
99
132
|
readonly handle?: string;
|
|
133
|
+
readonly providerKey?: string;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Reference to an org-level cloud link (`catalog.cloudLinks.<handle>`) —
|
|
137
|
+
* flat, no provider nesting like a connector, and org-owned (no appHandle).
|
|
138
|
+
*/
|
|
139
|
+
export interface CloudLinkRefAst {
|
|
140
|
+
readonly kind: "cloudLink";
|
|
141
|
+
readonly handle: string;
|
|
142
|
+
readonly name?: string;
|
|
100
143
|
}
|
|
101
144
|
/**
|
|
102
145
|
* Placeholder for an identifier (uuid or clientHandle) the catalog couldn't
|
|
@@ -155,7 +198,13 @@ export type RefExpr =
|
|
|
155
198
|
| {
|
|
156
199
|
kind: "template";
|
|
157
200
|
parts: readonly (string | RefExpr)[];
|
|
158
|
-
} | FieldRefAst | AppRefAst | AgentRefAst | AutomationRefAst | DocumentModelRefAst | DocumentModelFieldRefAst | ApprovalChainRefAst | ConnectorRefAst | UnresolvedRefAst
|
|
201
|
+
} | FieldRefAst | UserFieldRefAst | AppRefAst | AgentRefAst | AutomationRefAst | DocumentModelRefAst | DocumentModelFieldRefAst | ApprovalChainRefAst | ConnectorRefAst | CloudLinkRefAst | UnresolvedRefAst
|
|
202
|
+
/** Preserved terraform local expression for round-trip (e.g. status option ids by label). */
|
|
203
|
+
| {
|
|
204
|
+
kind: "localRef";
|
|
205
|
+
readonly localName: string;
|
|
206
|
+
readonly path: readonly import("../../../engine/tf/model.js").PathSeg[];
|
|
207
|
+
};
|
|
159
208
|
export type FilterValueAst = {
|
|
160
209
|
kind: "text";
|
|
161
210
|
value: string;
|
|
@@ -178,6 +227,7 @@ export type FilterValueAst = {
|
|
|
178
227
|
kind: "null";
|
|
179
228
|
} | {
|
|
180
229
|
kind: "currentUser";
|
|
230
|
+
currentUserType: "id" | "email" | "domain";
|
|
181
231
|
}
|
|
182
232
|
/** A reference value — wraps a RefExpr for the printer to render. */
|
|
183
233
|
| {
|
|
@@ -196,7 +246,7 @@ export type FilterAst = {
|
|
|
196
246
|
right: FilterValueAst | RefExpr;
|
|
197
247
|
not?: boolean;
|
|
198
248
|
caseInsensitive?: boolean;
|
|
199
|
-
mode?:
|
|
249
|
+
mode?: LikeMode;
|
|
200
250
|
} | {
|
|
201
251
|
kind: "in";
|
|
202
252
|
left: RefExpr;
|
|
@@ -63,7 +63,7 @@ export type FilterValue = {
|
|
|
63
63
|
realType: ValueType;
|
|
64
64
|
value: FilterReference;
|
|
65
65
|
};
|
|
66
|
-
export type LikeMode = "
|
|
66
|
+
export type LikeMode = "starts_with" | "ends_with" | "contains" | "legacy";
|
|
67
67
|
export interface EqualsFilter {
|
|
68
68
|
type: "EQUALS";
|
|
69
69
|
field?: string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A tool's `field_id` value → the TARGET aspect's field bag key. Shared by
|
|
3
|
+
* `agent-tool`/`skill-tool` from-tf (neither owns the other, so this lives in
|
|
4
|
+
* the cross-entity commons rather than either module). Two shapes: a
|
|
5
|
+
* `resource-attr` to the field's own resource (custom fields, which have a
|
|
6
|
+
* dedicated `elementum_<type>_field` block), or a `local.<aspect>_<key>_
|
|
7
|
+
* field_id` reference (system fields - title/status/closedBy/…, which have
|
|
8
|
+
* no resource of their own). Same recognition `automation/from-tf.ts`'s
|
|
9
|
+
* `decodeValue` already does for record-path field refs.
|
|
10
|
+
*
|
|
11
|
+
* `scopeTfLabel`/`scope` identify the tool's RESOLVED target aspect (self,
|
|
12
|
+
* or a foreign app/element per `target_id` — board issue #169), not always
|
|
13
|
+
* the owning app: a field on a foreign aspect is scoped under that aspect's
|
|
14
|
+
* own label, not the caller's.
|
|
15
|
+
*/
|
|
16
|
+
import { type ChildResourceScope, type TfValue } from "../../engine/tf/index.js";
|
|
17
|
+
export declare function resolveToolFieldKey(fieldRef: TfValue | undefined, scopeTfLabel: string, scope?: ChildResourceScope): string | undefined;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A tool's `field_id` value → the TARGET aspect's field bag key. Shared by
|
|
3
|
+
* `agent-tool`/`skill-tool` from-tf (neither owns the other, so this lives in
|
|
4
|
+
* the cross-entity commons rather than either module). Two shapes: a
|
|
5
|
+
* `resource-attr` to the field's own resource (custom fields, which have a
|
|
6
|
+
* dedicated `elementum_<type>_field` block), or a `local.<aspect>_<key>_
|
|
7
|
+
* field_id` reference (system fields - title/status/closedBy/…, which have
|
|
8
|
+
* no resource of their own). Same recognition `automation/from-tf.ts`'s
|
|
9
|
+
* `decodeValue` already does for record-path field refs.
|
|
10
|
+
*
|
|
11
|
+
* `scopeTfLabel`/`scope` identify the tool's RESOLVED target aspect (self,
|
|
12
|
+
* or a foreign app/element per `target_id` — board issue #169), not always
|
|
13
|
+
* the owning app: a field on a foreign aspect is scoped under that aspect's
|
|
14
|
+
* own label, not the caller's.
|
|
15
|
+
*/
|
|
16
|
+
import { isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
17
|
+
import { SUB_TYPE_BY_RESOURCE as FIELD_SUB_TYPE_BY_RESOURCE } from "../field/types.js";
|
|
18
|
+
export function resolveToolFieldKey(fieldRef, scopeTfLabel, scope = "app") {
|
|
19
|
+
if (fieldRef === undefined)
|
|
20
|
+
return undefined;
|
|
21
|
+
if (isTfExpr(fieldRef) && fieldRef.$expr === "resource-attr" && FIELD_SUB_TYPE_BY_RESOURCE.has(fieldRef.type)) {
|
|
22
|
+
return scopedLabelToBagKey(scopeTfLabel, fieldRef.label, scope);
|
|
23
|
+
}
|
|
24
|
+
if (isTfExpr(fieldRef) && fieldRef.$expr === "data-attr" && fieldRef.type === "elementum_field") {
|
|
25
|
+
// The reverse of `agent-tool`/`skill-tool` to-tf's
|
|
26
|
+
// `foreignTargetFieldRefValue`: a CUSTOM field on the tool's target
|
|
27
|
+
// aspect, resolved via a `data.elementum_field` lookup rather than a
|
|
28
|
+
// resource block (the target isn't recursively exported, so it has no
|
|
29
|
+
// field resource of its own in this stream). `scopeTfLabel`/`scope`
|
|
30
|
+
// already identify the RESOLVED target (see this module's header
|
|
31
|
+
// comment), so the label prefix to strip is known without any extra
|
|
32
|
+
// lookup — mirrors `crossAppFieldToTf`'s label construction in
|
|
33
|
+
// `automation/to-tf.ts`.
|
|
34
|
+
const prefix = `${scope}_${scopeTfLabel}_`;
|
|
35
|
+
if (fieldRef.label.startsWith(prefix)) {
|
|
36
|
+
return tfLabelToTsLabel(fieldRef.label.slice(prefix.length));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (isTfExpr(fieldRef) && fieldRef.$expr === "local") {
|
|
40
|
+
const prefix = `${scopeTfLabel}_`;
|
|
41
|
+
if (fieldRef.name.startsWith(prefix) && fieldRef.name.endsWith("_field_id")) {
|
|
42
|
+
return tfLabelToTsLabel(fieldRef.name.slice(prefix.length, -"_field_id".length));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
@@ -6,10 +6,19 @@
|
|
|
6
6
|
* configurations is surfaced here. The full enum is listed for
|
|
7
7
|
* forward-compatibility; uncommon types are commented.
|
|
8
8
|
*/
|
|
9
|
-
export type WorkflowFieldType = "TEXT" | "HANDLE" | "NUMBER" | "DECIMAL" | "BOOLEAN" | "DATE" | "DATETIME" | "HTML" | "USER" | "USER_ID" | "GROUP" | "GROUP_ID" | "FILE" | "ATTACHMENT" | "ATTACHMENT_ID" | "ASPECT_ID" | "ASPECT_RECORD" | "ASPECT_RECORD_ID" | "ASPECT_FIELD_ID" | "FILTER" | "OBJECT" | "JSON" | "PICKLIST" | "PICKLIST_ID" | "MULTI_PICKLIST" | "MULTI_PICKLIST_ID" | "SEARCH_TABLE_ID" | "TABLE_ID" | "TABLE_RECORD" | "VARIABLE" | "RICH_TEXT" | "AI_SEARCH_TABLE_RECORD";
|
|
9
|
+
export type WorkflowFieldType = "TEXT" | "HANDLE" | "NUMBER" | "DECIMAL" | "BOOLEAN" | "DATE" | "DATETIME" | "HTML" | "USER" | "USER_ID" | "GROUP" | "GROUP_ID" | "FILE" | "ATTACHMENT" | "ATTACHMENT_ID" | "ASPECT_ID" | "ASPECT_RECORD" | "ASPECT_RECORD_ID" | "ASPECT_FIELD_ID" | "FILTER" | "OBJECT" | "JSON" | "PICKLIST" | "PICKLIST_ID" | "MULTI_PICKLIST" | "MULTI_PICKLIST_ID" | "RELATION" | "SEARCH_TABLE_ID" | "TABLE_ID" | "TABLE_RECORD" | "VARIABLE" | "RICH_TEXT" | "AI_SEARCH_TABLE_RECORD";
|
|
10
10
|
/**
|
|
11
11
|
* Map from user-friendly type names (used in the SDK's onDemand input
|
|
12
12
|
* schema) to the platform's WorkflowFieldType value.
|
|
13
|
+
*
|
|
14
|
+
* `attachmentId` is the odd one out: `elementum_on_demand_trigger`'s own
|
|
15
|
+
* `parameters[].type` terraform attribute (on_demand_trigger_resource.go)
|
|
16
|
+
* only validates a bare "attachment" - there is no "attachment_id" spelling
|
|
17
|
+
* at that layer, unlike every other row here where the wire string is just
|
|
18
|
+
* the WorkflowFieldType name lowercased. automation/to-tf.ts special-cases
|
|
19
|
+
* ATTACHMENT_ID -> "attachment" (and from-tf.ts the inverse) rather than
|
|
20
|
+
* renaming this alias, to avoid a breaking change to authored `onDemand({})`
|
|
21
|
+
* calls that already use `type: "attachmentId"`.
|
|
13
22
|
*/
|
|
14
23
|
export declare const FIELD_TYPE_MAP: {
|
|
15
24
|
readonly text: "TEXT";
|
|
@@ -9,6 +9,15 @@
|
|
|
9
9
|
/**
|
|
10
10
|
* Map from user-friendly type names (used in the SDK's onDemand input
|
|
11
11
|
* schema) to the platform's WorkflowFieldType value.
|
|
12
|
+
*
|
|
13
|
+
* `attachmentId` is the odd one out: `elementum_on_demand_trigger`'s own
|
|
14
|
+
* `parameters[].type` terraform attribute (on_demand_trigger_resource.go)
|
|
15
|
+
* only validates a bare "attachment" - there is no "attachment_id" spelling
|
|
16
|
+
* at that layer, unlike every other row here where the wire string is just
|
|
17
|
+
* the WorkflowFieldType name lowercased. automation/to-tf.ts special-cases
|
|
18
|
+
* ATTACHMENT_ID -> "attachment" (and from-tf.ts the inverse) rather than
|
|
19
|
+
* renaming this alias, to avoid a breaking change to authored `onDemand({})`
|
|
20
|
+
* calls that already use `type: "attachmentId"`.
|
|
12
21
|
*/
|
|
13
22
|
export const FIELD_TYPE_MAP = {
|
|
14
23
|
text: "TEXT",
|
|
@@ -16,5 +16,24 @@ import type { NormalizedSkill } from "../from-tf.js";
|
|
|
16
16
|
export interface PrintSkillV2Options {
|
|
17
17
|
/** The owning app's refName — `parent:` and the catalog token root. */
|
|
18
18
|
readonly appRefName: string;
|
|
19
|
+
/**
|
|
20
|
+
* Set for a cross-org clone: a foreign-app tool target was resolved
|
|
21
|
+
* against the SOURCE org, so it's flagged as a TODO for manual review
|
|
22
|
+
* instead of silently carried over — same treatment as agent tools
|
|
23
|
+
* (`src/entities/agent/deserializer/print-agent-v2.ts`).
|
|
24
|
+
*/
|
|
25
|
+
readonly crossOrg?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Name → refName for every app already on disk in this workspace (board
|
|
28
|
+
* issue #40). A foreign-app tool target whose name is a key here prints
|
|
29
|
+
* `catalog.<refName>` instead of the always-safe literal stub.
|
|
30
|
+
*/
|
|
31
|
+
readonly foreignAppRefNames?: ReadonlyMap<string, string>;
|
|
32
|
+
/**
|
|
33
|
+
* Same as {@link foreignAppRefNames}, keyed for elements (board issue
|
|
34
|
+
* #42) — a `foreignElement` tool target whose name is a key here prints
|
|
35
|
+
* `catalog.<refName>` instead of the literal stub.
|
|
36
|
+
*/
|
|
37
|
+
readonly foreignElementRefNames?: ReadonlyMap<string, string>;
|
|
19
38
|
}
|
|
20
39
|
export declare function printSkillV2(skill: NormalizedSkill, opts: PrintSkillV2Options): string;
|
|
@@ -17,11 +17,34 @@ import { sdkPackageSpecifier } from "../../../internal/sdk-package.js";
|
|
|
17
17
|
const TOOL_FACTORY_BY_TYPE_KEY = {
|
|
18
18
|
createRecord: "skillCreateRecord",
|
|
19
19
|
searchAspect: "skillSearchAspect",
|
|
20
|
+
updateRecord: "skillUpdateRecord",
|
|
21
|
+
runAgent: "skillRunAgent",
|
|
22
|
+
automation: "skillAutomation",
|
|
20
23
|
};
|
|
24
|
+
function safeMember(name) {
|
|
25
|
+
return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name) ? `.${name}` : `[${quote(name)}]`;
|
|
26
|
+
}
|
|
27
|
+
function safeKey(name) {
|
|
28
|
+
return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name) ? name : quote(name);
|
|
29
|
+
}
|
|
30
|
+
function printRunAs(runAs) {
|
|
31
|
+
if (runAs["currentUser"] === true)
|
|
32
|
+
return "{ currentUser: true }";
|
|
33
|
+
if (runAs["publisher"] === true)
|
|
34
|
+
return "{ publisher: true }";
|
|
35
|
+
const serviceAccount = runAs["serviceAccount"];
|
|
36
|
+
return `{ serviceAccount: { serviceAccount: ${quote(String(serviceAccount?.serviceAccount ?? ""))} } }`;
|
|
37
|
+
}
|
|
21
38
|
export function printSkillV2(skill, opts) {
|
|
22
39
|
const { appRefName } = opts;
|
|
40
|
+
const crossOrg = opts.crossOrg === true;
|
|
23
41
|
const factories = [...new Set(skill.tools.map((t) => TOOL_FACTORY_BY_TYPE_KEY[t.typeKey]).filter(Boolean))].sort();
|
|
24
|
-
const usesCatalog = skill.tools.some((t) => t.
|
|
42
|
+
const usesCatalog = skill.tools.some((t) => t.typeKey === "automation" ||
|
|
43
|
+
t.typeKey === "runAgent" ||
|
|
44
|
+
t.target?.kind === "self" ||
|
|
45
|
+
(t.fields !== undefined && t.fields.length > 0) ||
|
|
46
|
+
(t.target?.kind === "foreignApp" && opts.foreignAppRefNames?.has(t.target.name)) ||
|
|
47
|
+
(t.target?.kind === "foreignElement" && opts.foreignElementRefNames?.has(t.target.name)));
|
|
25
48
|
const lines = [];
|
|
26
49
|
lines.push("/**");
|
|
27
50
|
lines.push(` * ${skill.name}`);
|
|
@@ -47,7 +70,7 @@ export function printSkillV2(skill, opts) {
|
|
|
47
70
|
if (skill.tools.length > 0) {
|
|
48
71
|
lines.push(" tools: [");
|
|
49
72
|
for (const tool of skill.tools) {
|
|
50
|
-
lines.push(...printTool(tool, appRefName).map((l) => ` ${l}`));
|
|
73
|
+
lines.push(...printTool(tool, appRefName, crossOrg, opts.foreignAppRefNames, opts.foreignElementRefNames).map((l) => ` ${l}`));
|
|
51
74
|
}
|
|
52
75
|
lines.push(" ],");
|
|
53
76
|
}
|
|
@@ -57,7 +80,21 @@ export function printSkillV2(skill, opts) {
|
|
|
57
80
|
lines.push("");
|
|
58
81
|
return lines.join("\n");
|
|
59
82
|
}
|
|
60
|
-
function
|
|
83
|
+
function fieldOwnerRef(tool, appRefName, foreignAppRefNames, foreignElementRefNames) {
|
|
84
|
+
// `fields` (and therefore this) is only ever reached for createRecord/
|
|
85
|
+
// searchAspect/updateRecord, which always carry a target — automation/
|
|
86
|
+
// runAgent tools return before this point. The undefined branch only
|
|
87
|
+
// exists to satisfy NormalizedSkillTool.target's now-optional type.
|
|
88
|
+
if (tool.target === undefined || tool.target.kind === "self")
|
|
89
|
+
return { kind: "catalog", expr: `catalog.${appRefName}` };
|
|
90
|
+
const entityKind = tool.target.kind === "foreignElement" ? "element" : "app";
|
|
91
|
+
const refNames = tool.target.kind === "foreignElement" ? foreignElementRefNames : foreignAppRefNames;
|
|
92
|
+
const foreignRefName = refNames?.get(tool.target.name);
|
|
93
|
+
return foreignRefName !== undefined
|
|
94
|
+
? { kind: "catalog", expr: `catalog.${foreignRefName}` }
|
|
95
|
+
: { kind: "raw", entityType: entityKind, name: tool.target.name };
|
|
96
|
+
}
|
|
97
|
+
function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElementRefNames) {
|
|
61
98
|
const factory = TOOL_FACTORY_BY_TYPE_KEY[tool.typeKey] ?? "skillSearchAspect";
|
|
62
99
|
const lines = [`${factory}({`];
|
|
63
100
|
lines.push(` name: ${quote(tool.name)},`);
|
|
@@ -66,28 +103,108 @@ function printTool(tool, appRefName) {
|
|
|
66
103
|
lines.push(` status: ${quote(tool.status)},`);
|
|
67
104
|
if (tool.startMessage !== undefined)
|
|
68
105
|
lines.push(` startMessage: ${quote(tool.startMessage)},`);
|
|
69
|
-
if (tool.
|
|
106
|
+
if (tool.runAs !== undefined)
|
|
107
|
+
lines.push(` runAs: ${printRunAs(tool.runAs)},`);
|
|
108
|
+
if (tool.typeKey === "runAgent") {
|
|
109
|
+
lines.push(` agent: catalog.${appRefName}.agents${safeMember(tool.targetAgentKey ?? "")},`);
|
|
110
|
+
lines.push(` workerTaskPrompt: ${quote(tool.workerTaskPrompt ?? "")},`);
|
|
111
|
+
lines.push("}),");
|
|
112
|
+
return lines;
|
|
113
|
+
}
|
|
114
|
+
if (tool.typeKey === "automation") {
|
|
115
|
+
lines.push(` automation: catalog.${appRefName}.automations${safeMember(tool.automationKey ?? "")},`);
|
|
116
|
+
if (tool.inputs !== undefined && tool.inputs.length > 0) {
|
|
117
|
+
lines.push(" inputs: {");
|
|
118
|
+
for (const input of tool.inputs) {
|
|
119
|
+
const parts = [];
|
|
120
|
+
if (input.displayName !== undefined && input.displayName !== input.parameterName) {
|
|
121
|
+
parts.push(`name: ${quote(input.displayName)}`);
|
|
122
|
+
}
|
|
123
|
+
parts.push(`description: ${quote(input.description ?? "")}`);
|
|
124
|
+
if (input.required !== undefined)
|
|
125
|
+
parts.push(`required: ${input.required}`);
|
|
126
|
+
lines.push(` ${safeKey(input.parameterName)}: { ${parts.join(", ")} },`);
|
|
127
|
+
}
|
|
128
|
+
lines.push(" },");
|
|
129
|
+
}
|
|
130
|
+
if (tool.outputs !== undefined && tool.outputs.length > 0) {
|
|
131
|
+
lines.push(" outputs: {");
|
|
132
|
+
for (const output of tool.outputs) {
|
|
133
|
+
const spec = output.displayName !== undefined && output.displayName !== output.workflowPropertyName
|
|
134
|
+
? `{ name: ${quote(output.displayName)} }`
|
|
135
|
+
: "{}";
|
|
136
|
+
lines.push(` ${safeKey(output.workflowPropertyName)}: ${spec},`);
|
|
137
|
+
}
|
|
138
|
+
lines.push(" },");
|
|
139
|
+
}
|
|
140
|
+
lines.push("}),");
|
|
141
|
+
return lines;
|
|
142
|
+
}
|
|
143
|
+
if (tool.target?.kind === "self") {
|
|
70
144
|
lines.push(` aspect: catalog.${appRefName},`);
|
|
71
145
|
}
|
|
72
|
-
else {
|
|
73
|
-
//
|
|
74
|
-
//
|
|
75
|
-
|
|
146
|
+
else if (tool.target !== undefined) {
|
|
147
|
+
// Board issue #42: the target can be a foreign APP or a foreign
|
|
148
|
+
// ELEMENT — each stub carries the right `__kind` and is looked up
|
|
149
|
+
// against its own map, never conflated.
|
|
150
|
+
const entityKind = tool.target.kind === "foreignElement" ? "element" : "app";
|
|
151
|
+
const refNames = tool.target.kind === "foreignElement" ? foreignElementRefNames : foreignAppRefNames;
|
|
152
|
+
const foreignRefName = refNames?.get(tool.target.name);
|
|
153
|
+
if (foreignRefName !== undefined) {
|
|
154
|
+
// The dependency is already pulled into this workspace (board issue
|
|
155
|
+
// #40) — a typed token, not a stub.
|
|
156
|
+
lines.push(` aspect: catalog.${foreignRefName},`);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
// The foreign app/element's catalog may not exist in this workspace —
|
|
160
|
+
// a literal token compiles and deploys; swap for a catalog token when
|
|
161
|
+
// available (`edk pull app`/`edk pull element` reports missing
|
|
162
|
+
// dependencies like this one).
|
|
163
|
+
const todo = crossOrg
|
|
164
|
+
? ` // TODO: cross-org clone — "${tool.target.name}" was resolved in the SOURCE org; verify it exists (with this name) in the destination org`
|
|
165
|
+
: "";
|
|
166
|
+
lines.push(` aspect: { __kind: ${quote(entityKind)}, refName: ${quote(tool.target.name)}, name: ${quote(tool.target.name)} },${todo}`);
|
|
167
|
+
}
|
|
76
168
|
}
|
|
77
169
|
if (tool.typeKey === "searchAspect") {
|
|
78
170
|
lines.push(` queryDescription: ${quote(tool.queryDescription ?? "")},`);
|
|
79
171
|
if (tool.limit !== undefined)
|
|
80
172
|
lines.push(` limit: ${tool.limit},`);
|
|
81
173
|
}
|
|
174
|
+
if (tool.typeKey === "updateRecord") {
|
|
175
|
+
lines.push(` handleDescription: ${quote(tool.handleDescription ?? "")},`);
|
|
176
|
+
}
|
|
82
177
|
if (tool.fields !== undefined && tool.fields.length > 0) {
|
|
178
|
+
const owner = fieldOwnerRef(tool, appRefName, foreignAppRefNames, foreignElementRefNames);
|
|
83
179
|
lines.push(" fields: [");
|
|
84
180
|
for (const f of tool.fields) {
|
|
85
|
-
|
|
181
|
+
// A foreign/out-of-scope aspect's field has no field resource ei can
|
|
182
|
+
// reference — it falls back to a bare platform id (board issue #169);
|
|
183
|
+
// print the raw-id shape (SkillSearchRawIdField/SkillRecordRawIdField)
|
|
184
|
+
// instead of a catalog token.
|
|
185
|
+
const isRaw = f.key === undefined;
|
|
186
|
+
// A field always belongs to the tool's TARGET, not necessarily the
|
|
187
|
+
// owning app — `owner` (self/foreign-resolved/foreign-unresolved)
|
|
188
|
+
// mirrors the `aspect:` resolution above.
|
|
189
|
+
const parts = isRaw
|
|
190
|
+
? [`fieldId: ${quote(f.rawFieldId ?? "")}`]
|
|
191
|
+
: owner.kind === "catalog"
|
|
192
|
+
? [`field: ${owner.expr}.fields.${f.key}`]
|
|
193
|
+
: [
|
|
194
|
+
`field: { __kind: "field", refName: ${quote(f.key)}, name: ${quote(f.name ?? f.key)}, fieldType: "TEXT", ` +
|
|
195
|
+
`parent: ${quote(owner.name)}, parentKind: ${quote(owner.entityType)}, parentName: ${quote(owner.name)} }`,
|
|
196
|
+
];
|
|
86
197
|
parts.push(`name: ${quote(f.name ?? "")}`);
|
|
87
198
|
parts.push(`description: ${quote(f.description ?? "")}`);
|
|
88
|
-
if (tool.typeKey === "createRecord" && f.required !== undefined)
|
|
199
|
+
if ((tool.typeKey === "createRecord" || tool.typeKey === "updateRecord") && f.required !== undefined) {
|
|
89
200
|
parts.push(`required: ${f.required}`);
|
|
90
|
-
|
|
201
|
+
}
|
|
202
|
+
const todo = isRaw
|
|
203
|
+
? " // TODO: raw platform field id - the field belongs to a foreign/out-of-scope aspect ei can't resolve to a reference"
|
|
204
|
+
: owner.kind === "raw"
|
|
205
|
+
? ` // TODO: foreign field — type unconfirmed (ei's elementum_field data source doesn't expose it) and refName is a best-effort guess; verify against "${owner.name}"`
|
|
206
|
+
: "";
|
|
207
|
+
lines.push(` { ${parts.join(", ")} },${todo}`);
|
|
91
208
|
}
|
|
92
209
|
lines.push(" ],");
|
|
93
210
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { EntityTfError } from "../../engine/entity.js";
|
|
9
9
|
import { optionalString, resourceRefLabel } from "../../engine/pull/context.js";
|
|
10
|
-
import {
|
|
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
13
|
import { SKILL_RESOURCE_TYPE } from "./module.js";
|
|
@@ -21,6 +21,7 @@ const KNOWN_SKILL_ATTRS = new Set([
|
|
|
21
21
|
"status",
|
|
22
22
|
"type",
|
|
23
23
|
"properties",
|
|
24
|
+
"depends_on",
|
|
24
25
|
]);
|
|
25
26
|
/** Dialect attrs with no authoring slot yet — reported by name, skill still pulled. */
|
|
26
27
|
const UNAUTHORABLE_SKILL_ATTRS = new Set([
|
|
@@ -74,7 +75,7 @@ export function skillFromTf(skillBlock, toolBlocks, appLabel, ctx) {
|
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
const status = optionalString(attrs, "status", where, ctx);
|
|
77
|
-
const owner = { appType: APP_RESOURCE_TYPE, appLabel, skillType: SKILL_RESOURCE_TYPE, skillLabel: label };
|
|
78
|
+
const owner = { appType: APP_RESOURCE_TYPE, appLabel, ownerTfLabel: appLabel, skillType: SKILL_RESOURCE_TYPE, skillLabel: label };
|
|
78
79
|
const tools = [];
|
|
79
80
|
for (const block of toolBlocks) {
|
|
80
81
|
const tool = skillToolFromTf(block, owner, ctx);
|
|
@@ -83,7 +84,7 @@ export function skillFromTf(skillBlock, toolBlocks, appLabel, ctx) {
|
|
|
83
84
|
}
|
|
84
85
|
return {
|
|
85
86
|
skill: {
|
|
86
|
-
refName:
|
|
87
|
+
refName: scopedLabelToBagKey(appLabel, label),
|
|
87
88
|
name,
|
|
88
89
|
description: optionalString(attrs, "description", where, ctx) ?? "",
|
|
89
90
|
instructions: optionalString(attrs, "instructions", where, ctx) ?? "",
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* reference position. Standalone from v1.
|
|
5
5
|
*/
|
|
6
6
|
export { defineSkill, type SkillConfigured, type SkillV2Options } from "./build.js";
|
|
7
|
-
export { skillAutomation, skillCreateRecord, skillRunAgent, skillSearchAspect, skillSearchTable, skillUpdateRecord, type SkillRecordField, type SkillSearchField, type SkillToolStatus, type SkillTool, } from "./tools.js";
|
|
7
|
+
export { skillAutomation, skillCreateRecord, skillRunAgent, skillSearchAspect, skillSearchTable, skillUpdateRecord, type SkillRecordField, type SkillRecordFieldInput, type SkillRecordRawIdField, type SkillSearchField, type SkillSearchFieldInput, type SkillSearchRawIdField, type SkillToolStatus, type SkillTool, } from "./tools.js";
|
|
@@ -83,7 +83,12 @@ export const skillModule = {
|
|
|
83
83
|
const skill = item;
|
|
84
84
|
return {
|
|
85
85
|
refName: skill.refName,
|
|
86
|
-
source: printSkillV2(skill, {
|
|
86
|
+
source: printSkillV2(skill, {
|
|
87
|
+
appRefName: opts.appRefName,
|
|
88
|
+
...(opts.crossOrg !== undefined && { crossOrg: opts.crossOrg }),
|
|
89
|
+
...(opts.foreignAppRefNames !== undefined && { foreignAppRefNames: opts.foreignAppRefNames }),
|
|
90
|
+
...(opts.foreignElementRefNames !== undefined && { foreignElementRefNames: opts.foreignElementRefNames }),
|
|
91
|
+
}),
|
|
87
92
|
};
|
|
88
93
|
},
|
|
89
94
|
toTf: (entity, ctx) => skillToTf(entity, {
|
|
@@ -91,6 +96,7 @@ export const skillModule = {
|
|
|
91
96
|
appTfLabel: ctx.appTfLabel,
|
|
92
97
|
orgRefs: ctx.orgRefs,
|
|
93
98
|
diagnostics: ctx.diagnostics,
|
|
99
|
+
...(ctx.siblingEntities !== undefined && { siblingEntities: ctx.siblingEntities }),
|
|
94
100
|
}),
|
|
95
101
|
},
|
|
96
102
|
catalog: {
|
|
@@ -23,11 +23,37 @@ export interface SkillToTfContext {
|
|
|
23
23
|
readonly orgRefs: OrgRefLookup;
|
|
24
24
|
/** Degradations land here — reported by the caller, never silent. */
|
|
25
25
|
readonly diagnostics: string[];
|
|
26
|
+
/**
|
|
27
|
+
* Every skill entity discovered for this app (self included) — forwarded
|
|
28
|
+
* by build.ts, unordered. Used to replicate ei's cross-skill tool-label
|
|
29
|
+
* disambiguation (see {@link computeToolLabelSuffixes}). Absent in
|
|
30
|
+
* contexts that don't supply it (e.g. most unit tests): every tool then
|
|
31
|
+
* gets the bare label, matching the pre-#310 behavior for a single skill.
|
|
32
|
+
*/
|
|
33
|
+
readonly siblingEntities?: readonly DeployableEntity[];
|
|
26
34
|
}
|
|
27
35
|
export interface SkillToTfResult {
|
|
28
36
|
readonly blocks: readonly TfBlock[];
|
|
29
37
|
/** The skill's terraform address. */
|
|
30
38
|
readonly address: string;
|
|
31
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Mirrors ei's cross-skill tool-name disambiguation (`cmd/elementum/export/
|
|
42
|
+
* imports.go`'s `skillNames`/`toolNames` counting maps) — a same-app,
|
|
43
|
+
* same-named tool on two different skills is not a collision on the
|
|
44
|
+
* platform: ei's exporter walks `app.Skills` (each skill's tools in turn)
|
|
45
|
+
* and gives the first occurrence of a sanitized tool name the bare label,
|
|
46
|
+
* each later occurrence `_1`, `_2`, … Board issue #310's live capture
|
|
47
|
+
* (2026-08-18, against a deliberately-collided app) confirmed the walk
|
|
48
|
+
* order is ascending by the skill's display NAME — not creation order, not
|
|
49
|
+
* authoring-file order. Ordering of tools WITHIN one skill wasn't
|
|
50
|
+
* observable live (each capture skill carried only one tool); authored
|
|
51
|
+
* array order is assumed there pending a capture that can confirm it.
|
|
52
|
+
*
|
|
53
|
+
* Returns suffixes ("" for the first occurrence, "_1", "_2", … after)
|
|
54
|
+
* keyed by `${skillRefName}#${toolIndex}` — the tool's position in its own
|
|
55
|
+
* skill's authored `tools` array, NOT a global index.
|
|
56
|
+
*/
|
|
57
|
+
export declare function computeToolLabelSuffixes(siblingSkills: readonly DeployableEntity[]): ReadonlyMap<string, string>;
|
|
32
58
|
/** `elementum_agentic_skill` + one tool resource per implemented tool, in the platform's dialect. */
|
|
33
59
|
export declare function skillToTf(entity: DeployableEntity, ctx: SkillToTfContext): SkillToTfResult;
|