@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,7 @@
|
|
|
10
10
|
* object. Optional `startMessage` / `runAs` are emitted only when supplied,
|
|
11
11
|
* matching the v1 serializer's field-by-field discipline.
|
|
12
12
|
*/
|
|
13
|
-
import type { AutomationCatalogRef, AgentRef, AspectRef, AutomationRef, FieldRef, OutputPropertyRef,
|
|
13
|
+
import type { AutomationCatalogRef, AgentRef, AspectRef, AutomationRef, FieldRef, OutputPropertyRef, TriggerParameterRef } from "../../catalog/index.js";
|
|
14
14
|
/** A handle-form agent tool: a Hydra `AgentToolCreateInput` with ref tokens. */
|
|
15
15
|
export type AgentTool = Record<string, unknown>;
|
|
16
16
|
/** Opaque run-as config (Hydra's `AgentConversationRunAsInput`). */
|
|
@@ -19,16 +19,73 @@ export type AgentToolRunAs = Record<string, unknown>;
|
|
|
19
19
|
export interface AgentSearchField {
|
|
20
20
|
readonly field: FieldRef;
|
|
21
21
|
readonly name?: string;
|
|
22
|
+
/** Required by the provider on every tool field. */
|
|
23
|
+
readonly description: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A search-tool field identified by a raw platform id rather than a
|
|
27
|
+
* FieldRef token — the field belongs to a foreign/out-of-scope aspect ei
|
|
28
|
+
* can't resolve to a resource reference (board issue #169; confirmed live,
|
|
29
|
+
* same fallback convention as `AgentSearchTableField`). The platform id, not
|
|
30
|
+
* a live reference — it never updates if the field is later renamed
|
|
31
|
+
* upstream, and there's no way to author one directly; it only arises from
|
|
32
|
+
* `edk pull app` round-tripping an existing tool.
|
|
33
|
+
*/
|
|
34
|
+
export interface AgentSearchRawIdField {
|
|
35
|
+
readonly fieldId: string;
|
|
36
|
+
readonly name?: string;
|
|
37
|
+
readonly description: string;
|
|
38
|
+
}
|
|
39
|
+
export type AgentSearchFieldInput = AgentSearchField | AgentSearchRawIdField;
|
|
40
|
+
/**
|
|
41
|
+
* A field exposed to a searchTable tool's newer `fields` wire shape
|
|
42
|
+
* (field_id/name/description). Unlike every other tool's `fields`,
|
|
43
|
+
* field_id here is a raw platform id, not a catalog token — confirmed
|
|
44
|
+
* live, searchTable's fields describe columns of the search table's own
|
|
45
|
+
* schema, not app/element fields, so there's no `elementum_*_field`
|
|
46
|
+
* resource to reference (same raw-id convention as
|
|
47
|
+
* `TableRecordsSearchOptions.table`).
|
|
48
|
+
*/
|
|
49
|
+
export interface AgentSearchTableField {
|
|
50
|
+
readonly fieldId: string;
|
|
51
|
+
readonly name?: string;
|
|
22
52
|
readonly description?: string;
|
|
23
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* A field exposed to a searchTable tool's legacy `return_fields` wire shape
|
|
56
|
+
* (field_id/name/display_name, no description) — the dialect most existing
|
|
57
|
+
* elementum_agent_ai_search_tool resources still use; the provider is
|
|
58
|
+
* deprecating it in favor of the same shape as {@link AgentSearchTableField},
|
|
59
|
+
* but both are live on the platform today (see `agentSearchTable`'s doc
|
|
60
|
+
* comment). Same raw field_id convention as `AgentSearchTableField`.
|
|
61
|
+
*/
|
|
62
|
+
export interface AgentSearchReturnField {
|
|
63
|
+
readonly fieldId: string;
|
|
64
|
+
readonly name?: string;
|
|
65
|
+
readonly displayName?: string;
|
|
66
|
+
}
|
|
24
67
|
/** A field the agent can populate/modify via a create/update record tool. */
|
|
25
68
|
export interface AgentRecordField {
|
|
26
69
|
readonly field: FieldRef;
|
|
27
70
|
readonly name?: string;
|
|
28
|
-
|
|
71
|
+
/** Required by the provider on every tool field. */
|
|
72
|
+
readonly description: string;
|
|
29
73
|
readonly required?: boolean;
|
|
30
74
|
readonly defaultValue?: string;
|
|
31
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* A create/update-record field identified by a raw platform id rather than
|
|
78
|
+
* a FieldRef token — same raw-id fallback as {@link AgentSearchRawIdField}
|
|
79
|
+
* (board issue #169), for createRecord/updateRecord tools instead of search.
|
|
80
|
+
*/
|
|
81
|
+
export interface AgentRecordRawIdField {
|
|
82
|
+
readonly fieldId: string;
|
|
83
|
+
readonly name?: string;
|
|
84
|
+
/** Required by the provider on every tool field. */
|
|
85
|
+
readonly description: string;
|
|
86
|
+
readonly required?: boolean;
|
|
87
|
+
}
|
|
88
|
+
export type AgentRecordFieldInput = AgentRecordField | AgentRecordRawIdField;
|
|
32
89
|
/** Input-parameter mapping for an execute-workflow tool. */
|
|
33
90
|
export interface AgentExecuteWorkflowInput {
|
|
34
91
|
readonly name: string;
|
|
@@ -57,7 +114,7 @@ interface CommonToolOptions {
|
|
|
57
114
|
export interface SearchAspectToolV2 extends CommonToolOptions {
|
|
58
115
|
readonly aspect: AspectRef;
|
|
59
116
|
readonly queryDescription: string;
|
|
60
|
-
readonly fields?: readonly
|
|
117
|
+
readonly fields?: readonly AgentSearchFieldInput[];
|
|
61
118
|
/** Pre-built wire `Filter` (may embed `FieldRef` tokens — resolved at deploy). */
|
|
62
119
|
readonly filter?: Record<string, unknown>;
|
|
63
120
|
/** Pre-built wire `Sort` (`{ orders: [{ field, direction }] }`). */
|
|
@@ -65,24 +122,46 @@ export interface SearchAspectToolV2 extends CommonToolOptions {
|
|
|
65
122
|
readonly limit?: number;
|
|
66
123
|
}
|
|
67
124
|
export declare function agentSearchAspect(opts: SearchAspectToolV2): AgentTool;
|
|
125
|
+
/**
|
|
126
|
+
* Unlike the other search tools, a search table has no import/reference
|
|
127
|
+
* mechanism yet (mirrors `TableRecordsSearchOptions.table`'s same raw-id
|
|
128
|
+
* convention): `table` is the platform's raw search table id, not a catalog
|
|
129
|
+
* token — confirmed live, ei's own export never resolves `search_table_id`
|
|
130
|
+
* to a reference for any of these tools. `aspect` is also optional here
|
|
131
|
+
* (unlike searchAspect) — a search table tool doesn't always need a live
|
|
132
|
+
* record target. `fields`/`returnFields` are mutually exclusive: most
|
|
133
|
+
* existing tools use the legacy `return_fields` wire shape (`returnFields`,
|
|
134
|
+
* field_id/name/displayName), which the provider is deprecating in favor of
|
|
135
|
+
* the same shape searchAspect already uses (`fields`, field_id/name/
|
|
136
|
+
* description) — both are live on the platform today, so both round-trip.
|
|
137
|
+
*/
|
|
68
138
|
export interface SearchTableToolV2 extends CommonToolOptions {
|
|
69
|
-
readonly aspect
|
|
70
|
-
readonly table:
|
|
139
|
+
readonly aspect?: AspectRef;
|
|
140
|
+
readonly table: string;
|
|
71
141
|
readonly queryDescription: string;
|
|
72
|
-
|
|
142
|
+
/** searchTable's newer field shape — mutually exclusive with `returnFields`. */
|
|
143
|
+
readonly fields?: readonly AgentSearchTableField[];
|
|
144
|
+
/** searchTable's legacy field shape — mutually exclusive with `fields`. */
|
|
145
|
+
readonly returnFields?: readonly AgentSearchReturnField[];
|
|
73
146
|
readonly filter?: Record<string, unknown>;
|
|
74
147
|
readonly limit?: number;
|
|
75
148
|
}
|
|
76
149
|
export declare function agentSearchTable(opts: SearchTableToolV2): AgentTool;
|
|
77
150
|
export interface CreateRecordToolV2 extends CommonToolOptions {
|
|
78
151
|
readonly aspect: AspectRef;
|
|
79
|
-
readonly fields?: readonly
|
|
152
|
+
readonly fields?: readonly AgentRecordFieldInput[];
|
|
80
153
|
}
|
|
81
154
|
export declare function agentCreateRecord(opts: CreateRecordToolV2): AgentTool;
|
|
82
155
|
export interface UpdateRecordToolV2 extends CommonToolOptions {
|
|
83
156
|
readonly aspect: AspectRef;
|
|
84
|
-
readonly fields?: readonly
|
|
85
|
-
|
|
157
|
+
readonly fields?: readonly AgentRecordFieldInput[];
|
|
158
|
+
/**
|
|
159
|
+
* How the agent should identify which record to update — the provider
|
|
160
|
+
* requires this (there's no way to infer it) and rejects an empty value
|
|
161
|
+
* at apply with an opaque "Unable to validate" error, so it's required
|
|
162
|
+
* here instead. Example: "Identify the ticket by its ID or subject line."
|
|
163
|
+
*/
|
|
164
|
+
readonly handleDescription: string;
|
|
86
165
|
}
|
|
87
166
|
export declare function agentUpdateRecord(opts: UpdateRecordToolV2): AgentTool;
|
|
88
167
|
export interface RelateRecordToolV2 extends CommonToolOptions {
|
|
@@ -20,19 +20,56 @@ function common(opts) {
|
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
function searchFieldToken(f) {
|
|
23
|
+
if ("fieldId" in f) {
|
|
24
|
+
// Raw platform id fallback — see AgentSearchRawIdField's comment.
|
|
25
|
+
return {
|
|
26
|
+
fieldId: f.fieldId,
|
|
27
|
+
...(f.name !== undefined ? { name: f.name } : {}),
|
|
28
|
+
description: f.description,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
// Provider requires `name` on every tool field — default to the field's
|
|
32
|
+
// display name when the author omits an override. `description` is required
|
|
33
|
+
// on the authoring type and always emitted.
|
|
23
34
|
return {
|
|
24
35
|
fieldId: f.field, // token → resolved to the field id at deploy
|
|
25
36
|
clientHandle: f.field, // token → resolved to the field clientHandle at deploy
|
|
37
|
+
name: f.name ?? f.field.name,
|
|
38
|
+
description: f.description,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function searchTableFieldToken(f) {
|
|
42
|
+
return {
|
|
43
|
+
fieldId: f.fieldId, // raw platform id - not a catalog token, see AgentSearchTableField's comment
|
|
26
44
|
...(f.name !== undefined ? { name: f.name } : {}),
|
|
27
45
|
...(f.description !== undefined ? { description: f.description } : {}),
|
|
28
46
|
};
|
|
29
47
|
}
|
|
48
|
+
function returnFieldToken(f) {
|
|
49
|
+
return {
|
|
50
|
+
fieldId: f.fieldId, // raw platform id - not a catalog token, see AgentSearchReturnField's comment
|
|
51
|
+
...(f.name !== undefined ? { name: f.name } : {}),
|
|
52
|
+
...(f.displayName !== undefined ? { displayName: f.displayName } : {}),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
30
55
|
function recordFieldToken(f) {
|
|
56
|
+
if ("fieldId" in f) {
|
|
57
|
+
// Raw platform id fallback — see AgentRecordRawIdField's comment.
|
|
58
|
+
return {
|
|
59
|
+
fieldId: f.fieldId,
|
|
60
|
+
...(f.name !== undefined ? { name: f.name } : {}),
|
|
61
|
+
description: f.description,
|
|
62
|
+
...(f.required !== undefined ? { required: f.required } : {}),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
// Provider requires `name` on every tool field — default to the field's
|
|
66
|
+
// display name when the author omits an override. `description` is required
|
|
67
|
+
// on the authoring type and always emitted.
|
|
31
68
|
return {
|
|
32
69
|
fieldId: f.field,
|
|
33
70
|
clientHandle: f.field,
|
|
34
|
-
|
|
35
|
-
|
|
71
|
+
name: f.name ?? f.field.name,
|
|
72
|
+
description: f.description,
|
|
36
73
|
...(f.required !== undefined ? { required: f.required } : {}),
|
|
37
74
|
...(f.defaultValue !== undefined ? { defaultValue: f.defaultValue } : {}),
|
|
38
75
|
};
|
|
@@ -54,10 +91,14 @@ export function agentSearchTable(opts) {
|
|
|
54
91
|
return {
|
|
55
92
|
searchTable: {
|
|
56
93
|
...common(opts),
|
|
57
|
-
aspectId: opts.aspect,
|
|
94
|
+
...(opts.aspect !== undefined ? { aspectId: opts.aspect } : {}),
|
|
58
95
|
searchTableId: opts.table,
|
|
59
96
|
queryDescription: opts.queryDescription,
|
|
60
|
-
|
|
97
|
+
// Distinct wire key from every other tool's `fields` (which carries
|
|
98
|
+
// FieldRef tokens) - searchTable's own field/returnField shapes carry
|
|
99
|
+
// raw platform ids instead, see AgentSearchTableField's comment.
|
|
100
|
+
...(opts.fields !== undefined ? { searchTableFields: opts.fields.map(searchTableFieldToken) } : {}),
|
|
101
|
+
...(opts.returnFields !== undefined ? { returnFields: opts.returnFields.map(returnFieldToken) } : {}),
|
|
61
102
|
...(opts.filter !== undefined ? { filter: opts.filter } : {}),
|
|
62
103
|
...(opts.limit !== undefined ? { limit: opts.limit } : {}),
|
|
63
104
|
},
|
|
@@ -78,9 +119,7 @@ export function agentUpdateRecord(opts) {
|
|
|
78
119
|
...common(opts),
|
|
79
120
|
aspectId: opts.aspect,
|
|
80
121
|
...(opts.fields !== undefined ? { fields: opts.fields.map(recordFieldToken) } : {}),
|
|
81
|
-
|
|
82
|
-
? { handleDescription: opts.handleDescription }
|
|
83
|
-
: {}),
|
|
122
|
+
handleDescription: opts.handleDescription,
|
|
84
123
|
},
|
|
85
124
|
};
|
|
86
125
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type FromTfContext } from "../../engine/pull/context.js";
|
|
2
|
+
import type { TfBlock } from "../../engine/tf/index.js";
|
|
3
|
+
export interface NormalizedA2ASkill {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly description: string;
|
|
6
|
+
readonly tags?: readonly string[];
|
|
7
|
+
readonly examples?: readonly string[];
|
|
8
|
+
readonly inputModes?: readonly string[];
|
|
9
|
+
readonly outputModes?: readonly string[];
|
|
10
|
+
}
|
|
11
|
+
export interface A2ASkillOwner {
|
|
12
|
+
/** The owning agent's resource type + tfLabel. */
|
|
13
|
+
readonly agentType: string;
|
|
14
|
+
readonly agentLabel: string;
|
|
15
|
+
}
|
|
16
|
+
/** One a2a-skill block → its normalized shape; undefined = skipped with a diagnostic (wrong owner, missing required attr). */
|
|
17
|
+
export declare function a2aSkillFromTf(block: TfBlock, owner: A2ASkillOwner, ctx: FromTfContext): NormalizedA2ASkill | undefined;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A2A skill extraction: one `elementum_agent_a2a_skill` block → its
|
|
3
|
+
* normalized shape. Pure metadata (no target/field refs, no `app_id` on
|
|
4
|
+
* the wire — see `provider/docs/resources/agent_a2a_skill.md`), so this is
|
|
5
|
+
* the simplest owned-child extractor in the agent family.
|
|
6
|
+
*/
|
|
7
|
+
import { EntityTfError } from "../../engine/entity.js";
|
|
8
|
+
import { optionalString, resourceRefLabel } from "../../engine/pull/context.js";
|
|
9
|
+
import { AGENT_A2A_SKILL_RESOURCE_TYPE } from "./module.js";
|
|
10
|
+
const KNOWN_A2A_SKILL_ATTRS = new Set(["agent_id", "name", "description", "tags", "examples", "input_modes", "output_modes"]);
|
|
11
|
+
function optionalStringArray(attrs, key, where, ctx) {
|
|
12
|
+
const v = attrs[key];
|
|
13
|
+
if (v === undefined)
|
|
14
|
+
return undefined;
|
|
15
|
+
if (!Array.isArray(v) || !v.every((item) => typeof item === "string")) {
|
|
16
|
+
ctx.diagnostics.push(`${where}: expected a list of strings "${key}", got ${JSON.stringify(v)}; dropped`);
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
return v;
|
|
20
|
+
}
|
|
21
|
+
/** One a2a-skill block → its normalized shape; undefined = skipped with a diagnostic (wrong owner, missing required attr). */
|
|
22
|
+
export function a2aSkillFromTf(block, owner, ctx) {
|
|
23
|
+
if (block.type !== AGENT_A2A_SKILL_RESOURCE_TYPE) {
|
|
24
|
+
ctx.diagnostics.push(`resource "${block.type}" is not a known a2a skill resource; skipped`);
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
const label = block.label;
|
|
28
|
+
if (label === undefined || label === "") {
|
|
29
|
+
throw new EntityTfError(`${block.type} block is missing its label`);
|
|
30
|
+
}
|
|
31
|
+
const attrs = block.attrs;
|
|
32
|
+
const name = optionalString(attrs, "name", `a2a skill (${block.type}.${label})`, ctx) ?? "";
|
|
33
|
+
const where = `a2a skill "${name}" (${block.type}.${label})`;
|
|
34
|
+
for (const key of Object.keys(attrs)) {
|
|
35
|
+
if (!KNOWN_A2A_SKILL_ATTRS.has(key)) {
|
|
36
|
+
ctx.diagnostics.push(`${where}: unhandled attribute "${key}" — the export dialect grew; extend a2aSkillFromTf deliberately`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (resourceRefLabel(attrs["agent_id"], owner.agentType) !== owner.agentLabel) {
|
|
40
|
+
ctx.diagnostics.push(`${where}: agent_id does not reference ${owner.agentType}.${owner.agentLabel}; skipped`);
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
if (name === "") {
|
|
44
|
+
ctx.diagnostics.push(`${where}: name is required; skipped`);
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
const description = optionalString(attrs, "description", where, ctx);
|
|
48
|
+
if (description === undefined || description === "") {
|
|
49
|
+
ctx.diagnostics.push(`${where}: description is required; skipped`);
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
const tags = optionalStringArray(attrs, "tags", where, ctx);
|
|
53
|
+
const examples = optionalStringArray(attrs, "examples", where, ctx);
|
|
54
|
+
const inputModes = optionalStringArray(attrs, "input_modes", where, ctx);
|
|
55
|
+
const outputModes = optionalStringArray(attrs, "output_modes", where, ctx);
|
|
56
|
+
return {
|
|
57
|
+
name,
|
|
58
|
+
description,
|
|
59
|
+
...(tags !== undefined && tags.length > 0 && { tags }),
|
|
60
|
+
...(examples !== undefined && examples.length > 0 && { examples }),
|
|
61
|
+
...(inputModes !== undefined && inputModes.length > 0 && { inputModes }),
|
|
62
|
+
...(outputModes !== undefined && outputModes.length > 0 && { outputModes }),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** The agent-a2a-skill entity's registry entry (see src/graph/). */
|
|
2
|
+
import { type EntityKindModule } from "../../graph/types.js";
|
|
3
|
+
export declare const AGENT_A2A_SKILL_RESOURCE_TYPE = "elementum_agent_a2a_skill";
|
|
4
|
+
export declare const agentA2ASkillModule: EntityKindModule;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** The agent-a2a-skill entity's registry entry (see src/graph/). */
|
|
2
|
+
import { NO_CATALOG, NO_DATA, NO_LIFECYCLE } from "../../graph/types.js";
|
|
3
|
+
export const AGENT_A2A_SKILL_RESOURCE_TYPE = "elementum_agent_a2a_skill";
|
|
4
|
+
export const agentA2ASkillModule = {
|
|
5
|
+
kind: "agent-a2a-skill",
|
|
6
|
+
stream: { role: "streamMember" },
|
|
7
|
+
authoring: { unit: "inline", bag: "a2aSkills" },
|
|
8
|
+
parents: [{ parent: "agent", child: "agent-a2a-skill" }],
|
|
9
|
+
resource: { shape: "single", resourceType: AGENT_A2A_SKILL_RESOURCE_TYPE, adoptable: true },
|
|
10
|
+
data: NO_DATA,
|
|
11
|
+
lifecycle: NO_LIFECYCLE,
|
|
12
|
+
canvas: { participates: true, label: "A2A Skills", glyph: "⇄", component: "generic" },
|
|
13
|
+
catalog: NO_CATALOG,
|
|
14
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A2A skill emission: one authored `A2ASkill` entry → its
|
|
3
|
+
* `elementum_agent_a2a_skill` resource block. Unlike agent tools, an A2A
|
|
4
|
+
* skill carries no `app_id` and no target/field references — it's pure
|
|
5
|
+
* metadata (name/description/tags/examples/input+output modes) describing
|
|
6
|
+
* what the agent offers to OTHER agents (provider/docs/resources/
|
|
7
|
+
* agent_a2a_skill.md). Owner passed in — this module never names the
|
|
8
|
+
* owning app.
|
|
9
|
+
*/
|
|
10
|
+
import { type TfBlock } from "../../engine/tf/index.js";
|
|
11
|
+
export interface A2ASkillWire {
|
|
12
|
+
readonly name?: string;
|
|
13
|
+
readonly description?: string;
|
|
14
|
+
readonly tags?: readonly string[];
|
|
15
|
+
readonly examples?: readonly string[];
|
|
16
|
+
readonly inputModes?: readonly string[];
|
|
17
|
+
readonly outputModes?: readonly string[];
|
|
18
|
+
}
|
|
19
|
+
export interface A2ASkillToTfContext {
|
|
20
|
+
/** The owning app's tfLabel (namespace) — scopes the child label. */
|
|
21
|
+
readonly appTfLabel: string;
|
|
22
|
+
/** The owning agent's bare tfLabel (before the apps_ prefix). */
|
|
23
|
+
readonly agentBareTfLabel: string;
|
|
24
|
+
/**
|
|
25
|
+
* Cross-agent disambiguation suffix ("", "_1", "_2", …) — mirrors ei's
|
|
26
|
+
* own a2a-skill collision handling across different agents in the same
|
|
27
|
+
* app (board issue #294). Computed by the caller (`agentToTf`) via
|
|
28
|
+
* `computeA2ASkillLabelSuffixes`; empty when absent (single-agent
|
|
29
|
+
* contexts, most unit tests).
|
|
30
|
+
*/
|
|
31
|
+
readonly labelSuffix?: string;
|
|
32
|
+
/** Degradations land here — reported by the caller, never silent. */
|
|
33
|
+
readonly diagnostics: string[];
|
|
34
|
+
}
|
|
35
|
+
export interface A2ASkillToTfResult {
|
|
36
|
+
readonly block: TfBlock;
|
|
37
|
+
readonly address: string;
|
|
38
|
+
}
|
|
39
|
+
/** One authored `A2ASkill` entry → its resource block; undefined = degraded (diagnostic already pushed). */
|
|
40
|
+
export declare function a2aSkillToTf(entry: A2ASkillWire, ctx: A2ASkillToTfContext): A2ASkillToTfResult | undefined;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A2A skill emission: one authored `A2ASkill` entry → its
|
|
3
|
+
* `elementum_agent_a2a_skill` resource block. Unlike agent tools, an A2A
|
|
4
|
+
* skill carries no `app_id` and no target/field references — it's pure
|
|
5
|
+
* metadata (name/description/tags/examples/input+output modes) describing
|
|
6
|
+
* what the agent offers to OTHER agents (provider/docs/resources/
|
|
7
|
+
* agent_a2a_skill.md). Owner passed in — this module never names the
|
|
8
|
+
* owning app.
|
|
9
|
+
*/
|
|
10
|
+
import { appScopedResourceLabel, expr, sanitizeName } from "../../engine/tf/index.js";
|
|
11
|
+
import { AGENT_A2A_SKILL_RESOURCE_TYPE } from "./module.js";
|
|
12
|
+
/** One authored `A2ASkill` entry → its resource block; undefined = degraded (diagnostic already pushed). */
|
|
13
|
+
export function a2aSkillToTf(entry, ctx) {
|
|
14
|
+
const name = entry.name ?? "";
|
|
15
|
+
if (name === "") {
|
|
16
|
+
ctx.diagnostics.push("a2a skill entry has no name; dropped");
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
const where = `a2a skill "${name}"`;
|
|
20
|
+
if (entry.description === undefined || entry.description === "") {
|
|
21
|
+
ctx.diagnostics.push(`${where}: description is required; dropped`);
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
const agentTfLabel = appScopedResourceLabel(ctx.appTfLabel, ctx.agentBareTfLabel);
|
|
25
|
+
// edk#286: ei's own export scopes an a2a skill's label by the APP only
|
|
26
|
+
// (apps_<ns>_<ns>_<skill-name>) — no owning-agent segment, unlike agent
|
|
27
|
+
// tools. Confirmed live; a prior version of this line prefixed
|
|
28
|
+
// ctx.agentBareTfLabel here, which build-vs-export never actually
|
|
29
|
+
// matched (only became visible once a fully successful agent-adoption
|
|
30
|
+
// cycle reached that check).
|
|
31
|
+
const tfLabel = appScopedResourceLabel(ctx.appTfLabel, `${sanitizeName(name)}${ctx.labelSuffix ?? ""}`);
|
|
32
|
+
const attrs = {
|
|
33
|
+
agent_id: expr.resourceAttr("elementum_agent", agentTfLabel, ["id"]),
|
|
34
|
+
name,
|
|
35
|
+
description: entry.description,
|
|
36
|
+
};
|
|
37
|
+
if (entry.tags !== undefined && entry.tags.length > 0)
|
|
38
|
+
attrs["tags"] = entry.tags;
|
|
39
|
+
if (entry.examples !== undefined && entry.examples.length > 0)
|
|
40
|
+
attrs["examples"] = entry.examples;
|
|
41
|
+
if (entry.inputModes !== undefined && entry.inputModes.length > 0)
|
|
42
|
+
attrs["input_modes"] = entry.inputModes;
|
|
43
|
+
if (entry.outputModes !== undefined && entry.outputModes.length > 0)
|
|
44
|
+
attrs["output_modes"] = entry.outputModes;
|
|
45
|
+
const block = { kind: "resource", type: AGENT_A2A_SKILL_RESOURCE_TYPE, label: tfLabel, attrs };
|
|
46
|
+
return { block, address: `${AGENT_A2A_SKILL_RESOURCE_TYPE}.${tfLabel}` };
|
|
47
|
+
}
|
|
@@ -7,18 +7,49 @@
|
|
|
7
7
|
import { type FromTfContext } from "../../engine/pull/context.js";
|
|
8
8
|
import { type TfBlock } from "../../engine/tf/index.js";
|
|
9
9
|
export interface NormalizedToolField {
|
|
10
|
-
/** The field's bag key in the
|
|
11
|
-
readonly key
|
|
10
|
+
/** The field's bag key in the TARGET aspect's `fields: {}` (bijective image of its label). Mutually exclusive with `rawFieldId`. */
|
|
11
|
+
readonly key?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Raw platform field id — board issue #169. When the tool's target is a
|
|
14
|
+
* foreign/out-of-scope aspect (not recursively exported), ei has no field
|
|
15
|
+
* resource to reference and falls back to a bare id, same convention as
|
|
16
|
+
* `NormalizedAgentTool.searchTableId`. Mutually exclusive with `key`;
|
|
17
|
+
* exactly one is always set.
|
|
18
|
+
*/
|
|
19
|
+
readonly rawFieldId?: string;
|
|
12
20
|
readonly name?: string;
|
|
13
21
|
readonly description?: string;
|
|
14
22
|
readonly required?: boolean;
|
|
15
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* searchTable's own field shapes. Unlike createRecord/searchAspect/
|
|
26
|
+
* updateRecord, field_id here is NEVER a resource reference — confirmed
|
|
27
|
+
* live, 161/161 field_id values across every real elementum_agent_ai_search_tool
|
|
28
|
+
* capture are raw strings. These describe columns of the search table's own
|
|
29
|
+
* schema, not app/element fields, so there's no `elementum_*_field` resource
|
|
30
|
+
* (and therefore no catalog bag key) to resolve them to.
|
|
31
|
+
*/
|
|
32
|
+
export interface NormalizedSearchTableField {
|
|
33
|
+
readonly fieldId: string;
|
|
34
|
+
readonly name?: string;
|
|
35
|
+
readonly description?: string;
|
|
36
|
+
}
|
|
37
|
+
/** searchTable's legacy return_fields shape (field_id/name/display_name) — no description, no required. */
|
|
38
|
+
export interface NormalizedSearchTableReturnField {
|
|
39
|
+
readonly fieldId: string;
|
|
40
|
+
readonly name?: string;
|
|
41
|
+
readonly displayName?: string;
|
|
42
|
+
}
|
|
16
43
|
export type NormalizedToolTarget = {
|
|
17
44
|
readonly kind: "self";
|
|
18
45
|
} | {
|
|
19
46
|
/** A foreign app via `data.elementum_app.<label>` — `name` from the stream's data block. */
|
|
20
47
|
readonly kind: "foreignApp";
|
|
21
48
|
readonly name: string;
|
|
49
|
+
} | {
|
|
50
|
+
/** A foreign ELEMENT via `data.elementum_element.<label>` — `name` from the stream's data block (board issue #42). */
|
|
51
|
+
readonly kind: "foreignElement";
|
|
52
|
+
readonly name: string;
|
|
22
53
|
};
|
|
23
54
|
export interface NormalizedExecuteWorkflowInput {
|
|
24
55
|
/** The published workflow's declared trigger parameter name. */
|
|
@@ -34,24 +65,40 @@ export interface NormalizedExecuteWorkflowOutput {
|
|
|
34
65
|
readonly description?: string;
|
|
35
66
|
}
|
|
36
67
|
export interface NormalizedAgentTool {
|
|
37
|
-
readonly typeKey: "createRecord" | "searchAspect" | "executeWorkflow";
|
|
68
|
+
readonly typeKey: "createRecord" | "searchAspect" | "updateRecord" | "executeWorkflow" | "searchTable";
|
|
38
69
|
readonly name: string;
|
|
39
70
|
readonly description: string;
|
|
40
71
|
readonly startMessage?: string;
|
|
41
|
-
/** absent for executeWorkflow — its target is an automation, not an aspect. */
|
|
72
|
+
/** absent for executeWorkflow — its target is an automation, not an aspect. searchTable's target is also optional. */
|
|
42
73
|
readonly target?: NormalizedToolTarget;
|
|
74
|
+
/** createRecord/searchAspect/updateRecord only — searchTable's own field shapes never resolve to a catalog key, see below. */
|
|
43
75
|
readonly fields?: readonly NormalizedToolField[];
|
|
76
|
+
/** searchTable's newer field shape (field_id/name/description) — mutually exclusive with `returnFields`. */
|
|
77
|
+
readonly searchTableFields?: readonly NormalizedSearchTableField[];
|
|
78
|
+
/** searchTable's legacy field shape (field_id/name/display_name) — mutually exclusive with `searchTableFields`. */
|
|
79
|
+
readonly returnFields?: readonly NormalizedSearchTableReturnField[];
|
|
44
80
|
readonly queryDescription?: string;
|
|
45
81
|
readonly limit?: number;
|
|
82
|
+
/** updateRecord: how the agent should identify the record to update. */
|
|
83
|
+
readonly handleDescription?: string;
|
|
46
84
|
/** executeWorkflow: the target automation's bag key (bijective image of its tf label). */
|
|
47
85
|
readonly automationKey?: string;
|
|
48
86
|
readonly inputs?: readonly NormalizedExecuteWorkflowInput[];
|
|
49
87
|
readonly outputs?: readonly NormalizedExecuteWorkflowOutput[];
|
|
88
|
+
/**
|
|
89
|
+
* searchTable's search_table_id. Always a raw platform id on the wire —
|
|
90
|
+
* confirmed live, ei's own export never resolves it to a reference (it
|
|
91
|
+
* writes a bare id with a "# TODO: Replace with data source or variable"
|
|
92
|
+
* comment), so there is no data-source lookup to reconstruct here.
|
|
93
|
+
*/
|
|
94
|
+
readonly searchTableId?: string;
|
|
50
95
|
}
|
|
51
96
|
export interface ToolOwner {
|
|
52
97
|
/** The owning app's resource type + tfLabel. */
|
|
53
98
|
readonly appType: string;
|
|
54
99
|
readonly appLabel: string;
|
|
100
|
+
/** Namespace tf label for stripping `apps_<ns>_` child labels. */
|
|
101
|
+
readonly ownerTfLabel: string;
|
|
55
102
|
/** The owning agent's resource type + tfLabel. */
|
|
56
103
|
readonly agentType: string;
|
|
57
104
|
readonly agentLabel: string;
|