@arcgis/ai-components 5.2.0-next.17 → 5.2.0-next.18
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/dist/agent-utils/index.d.ts +78 -0
- package/dist/agent-utils/index.js +116 -97
- package/dist/agent-utils/types.d.ts +12 -12
- package/dist/cdn/27NEUQN3.js +2 -0
- package/dist/cdn/{VKR2CBLM.js → 2NMR43NW.js} +1 -1
- package/dist/cdn/4I4MCV7V.js +71 -0
- package/dist/cdn/5SBLS4NW.js +2 -0
- package/dist/cdn/{LBSOW7OW.js → C7E7MJSR.js} +1 -1
- package/dist/cdn/{DECSD3LN.js → CIW3QMKV.js} +1 -1
- package/dist/cdn/CVHJMR5X.js +2 -0
- package/dist/cdn/ETD76QRC.js +14 -0
- package/dist/cdn/FC2ZX3SS.js +2 -0
- package/dist/cdn/I64KIZG3.js +2 -0
- package/dist/cdn/{NRMBMWI5.js → I76F57I2.js} +19 -18
- package/dist/cdn/IB4WTK74.js +2 -0
- package/dist/cdn/{LQSZTK26.js → IC5P5NYY.js} +1 -1
- package/dist/cdn/{QZVAGRWA.js → IDZTJLVN.js} +2 -2
- package/dist/cdn/IW43UAIS.js +3 -0
- package/dist/cdn/{6EVF6NFG.js → JBNITHPO.js} +5 -5
- package/dist/cdn/K37GTMOF.js +18 -0
- package/dist/cdn/{NE7E52YR.js → KTK4HNL2.js} +8 -2
- package/dist/cdn/{VV57ZUOI.js → L77BTGXY.js} +1 -1
- package/dist/cdn/LSNMNSYS.js +2 -0
- package/dist/cdn/NNC3UYMR.js +2 -0
- package/dist/cdn/NOJYPREL.js +3 -0
- package/dist/cdn/{FZIT3DLD.js → O3F47IO5.js} +1 -1
- package/dist/cdn/{OLJC5BM3.js → O7TGCM5P.js} +1 -1
- package/dist/cdn/PBTINZTK.js +65 -0
- package/dist/cdn/PSWI3MFB.js +2 -0
- package/dist/cdn/RNLQZV6U.js +36 -0
- package/dist/cdn/RX45PCYB.js +9 -0
- package/dist/cdn/SLNLQG3A.js +2 -0
- package/dist/cdn/{W5DLXSAP.js → SMADRJ67.js} +1 -1
- package/dist/cdn/{C4KITTT5.js → T7CQZ27H.js} +1 -1
- package/dist/cdn/UNFG4ZJ5.js +3 -0
- package/dist/cdn/V6TM3MTN.js +22 -0
- package/dist/cdn/{RUURNLTP.js → W2JAKE2M.js} +1 -1
- package/dist/cdn/{RHF452M7.js → WAVKMZA6.js} +1 -1
- package/dist/cdn/WQQRLD5F.js +2 -0
- package/dist/cdn/XAI6OR2N.js +2 -0
- package/dist/cdn/YJ3QQXF6.js +2 -0
- package/dist/cdn/{X4UZCTIG.js → YYY7HKYX.js} +1 -1
- package/dist/cdn/agent-utils/index.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/converterUtils.js +39 -32
- package/dist/chunks/dataExplorationGraph.js +12 -10
- package/dist/chunks/helpGraph.js +8 -8
- package/dist/chunks/help_prompt.js +34 -17
- package/dist/chunks/navigationGraph.js +4 -4
- package/dist/chunks/navigation_intent_prompt.js +8 -2
- package/dist/chunks/state.js +1 -1
- package/dist/chunks/utils2.js +8 -8
- package/dist/components/arcgis-assistant/customElement.d.ts +7 -0
- package/dist/components/arcgis-assistant/customElement.js +301 -181
- package/dist/components/arcgis-assistant-agent/customElement.js +5 -1
- package/dist/components/arcgis-assistant-chat/customElement.js +22 -17
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +9 -5
- package/dist/components/arcgis-assistant-help-agent/customElement.js +6 -2
- package/dist/components/arcgis-assistant-interrupt/customElement.js +4 -4
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +16 -12
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +8 -4
- package/dist/components/arcgis-assistant-message-block/customElement.js +1 -1
- package/dist/components/arcgis-assistant-message-text/customElement.d.ts +1 -0
- package/dist/components/arcgis-assistant-message-text/customElement.js +12 -12
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +9 -5
- package/dist/components/arcgis-assistant-user-message/customElement.js +10 -8
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/loader.js +2 -2
- package/dist/types/lumina.d.ts +2 -2
- package/dist/types/preact.d.ts +2 -2
- package/dist/types/react.d.ts +2 -2
- package/dist/types/stencil.d.ts +2 -2
- package/dist/utils/index.d.ts +1 -2
- package/package.json +4 -4
- package/dist/cdn/3S7PBYVD.js +0 -2
- package/dist/cdn/5VXRVWAX.js +0 -16
- package/dist/cdn/CE6VDP2D.js +0 -72
- package/dist/cdn/CI3QSFPS.js +0 -2
- package/dist/cdn/F2AHA4GB.js +0 -54
- package/dist/cdn/GPYYAQVI.js +0 -2
- package/dist/cdn/K475UT3E.js +0 -2
- package/dist/cdn/KIQUEMI4.js +0 -14
- package/dist/cdn/NTGC53UD.js +0 -36
- package/dist/cdn/PB2ODJC7.js +0 -2
- package/dist/cdn/SBHLUL3Q.js +0 -2
- package/dist/cdn/TR3OKQPQ.js +0 -22
- package/dist/cdn/WIJRNMBG.js +0 -3
- package/dist/cdn/XBW4MWQR.js +0 -2
- package/dist/cdn/Z7UWJ4AI.js +0 -3
- package/dist/orchestrator/registry/agentRegistry.d.ts +0 -33
|
@@ -9,15 +9,93 @@ import type { ParallelWorkflow, ParallelWorkflowConstructProperties } from "./wo
|
|
|
9
9
|
import type { RouterWorkflow, RouterWorkflowConstructProperties } from "./workflows/RouterWorkflow.js";
|
|
10
10
|
import type { SequentialWorkflow, SequentialWorkflowConstructProperties } from "./workflows/SequentialWorkflow.js";
|
|
11
11
|
import type { SwitchWorkflow, SwitchWorkflowConstructProperties } from "./workflows/SwitchWorkflow.js";
|
|
12
|
+
import type { RunnableConfig } from "@langchain/core/runnables";
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Creates a Zod schema from a plain object schema definition.
|
|
15
16
|
*
|
|
17
|
+
* Supports all schema field variants:
|
|
18
|
+
* - `string` (with optional `enum`)
|
|
19
|
+
* - `number`
|
|
20
|
+
* - `boolean`
|
|
21
|
+
* - `array` with primitive or nested item definitions
|
|
22
|
+
* - `object` with nested `fields`
|
|
23
|
+
*
|
|
16
24
|
* @param definition
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const primitiveSchema = await createSchema({
|
|
28
|
+
* name: { type: "string", description: "Search location name", required: true },
|
|
29
|
+
* radius: { type: "number", description: "Search radius in miles" },
|
|
30
|
+
* active: { type: "boolean", description: "Whether the search is enabled" },
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* const nestedObjectSchema = await createSchema({
|
|
36
|
+
* query: { type: "string", description: "User search text", required: true },
|
|
37
|
+
* options: {
|
|
38
|
+
* type: "object",
|
|
39
|
+
* description: "Search options",
|
|
40
|
+
* required: true,
|
|
41
|
+
* fields: {
|
|
42
|
+
* center: {
|
|
43
|
+
* type: "object",
|
|
44
|
+
* description: "Map center point",
|
|
45
|
+
* fields: {
|
|
46
|
+
* latitude: { type: "number", description: "Center latitude", required: true },
|
|
47
|
+
* longitude: { type: "number", description: "Center longitude", required: true },
|
|
48
|
+
* },
|
|
49
|
+
* },
|
|
50
|
+
* categories: { type: "array", description: "Selected categories", itemType: "string" },
|
|
51
|
+
* },
|
|
52
|
+
* },
|
|
53
|
+
* });
|
|
54
|
+
* ```
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const arrayOfObjectsSchema = await createSchema({
|
|
58
|
+
* constraints: {
|
|
59
|
+
* type: "array",
|
|
60
|
+
* description: "Constraint rules",
|
|
61
|
+
* itemType: {
|
|
62
|
+
* type: "object",
|
|
63
|
+
* description: "Single constraint rule",
|
|
64
|
+
* fields: {
|
|
65
|
+
* key: { type: "string", description: "Constraint key", required: true },
|
|
66
|
+
* enabled: { type: "boolean", description: "Whether this rule is active" },
|
|
67
|
+
* values: { type: "array", description: "Rule values", itemType: "string" },
|
|
68
|
+
* },
|
|
69
|
+
* },
|
|
70
|
+
* },
|
|
71
|
+
* });
|
|
72
|
+
* ```
|
|
17
73
|
* @since 5.1
|
|
18
74
|
*/
|
|
19
75
|
export function createSchema<const TDefinition extends SchemaDefinition>(definition: TDefinition): Promise<ZodObjectSchema<SchemaDefinitionData<TDefinition>>>;
|
|
20
76
|
|
|
77
|
+
/**
|
|
78
|
+
* The suggestions emitted by the agent to the user interface.
|
|
79
|
+
*
|
|
80
|
+
* @since 5.1
|
|
81
|
+
*/
|
|
82
|
+
export type UXSuggestion = {
|
|
83
|
+
/** The type of suggestion being made. */
|
|
84
|
+
type: string;
|
|
85
|
+
/** Optional additional data associated with the suggestion. */
|
|
86
|
+
data?: Record<string, unknown>;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Sends an optional UX suggestion from an agent run to the host application.
|
|
91
|
+
* Use this for non-blocking hints (for example, recommended next actions or UI prompts) that the app may choose to display.
|
|
92
|
+
*
|
|
93
|
+
* @param suggestion
|
|
94
|
+
* @param config
|
|
95
|
+
* @since 5.1
|
|
96
|
+
*/
|
|
97
|
+
export function sendUXSuggestion(suggestion: UXSuggestion, config?: RunnableConfig): Promise<void>;
|
|
98
|
+
|
|
21
99
|
/**
|
|
22
100
|
* Creates a FunctionAgent instance from the existing agent implementation.
|
|
23
101
|
*
|
|
@@ -1,148 +1,167 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
let
|
|
3
|
-
async function n(
|
|
4
|
-
if (
|
|
5
|
-
return
|
|
6
|
-
if ("default" in
|
|
7
|
-
const
|
|
8
|
-
return typeof
|
|
2
|
+
let i, a, c, u, l, s, w, m, f, p, d, g;
|
|
3
|
+
async function n(e, t) {
|
|
4
|
+
if (t in e)
|
|
5
|
+
return e[t];
|
|
6
|
+
if ("default" in e) {
|
|
7
|
+
const o = await e.default;
|
|
8
|
+
return typeof o == "object" && o !== null && t in o ? o[t] : o;
|
|
9
9
|
}
|
|
10
|
-
throw new Error(`Unable to resolve ${String(
|
|
10
|
+
throw new Error(`Unable to resolve ${String(t)} from module.`);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
const
|
|
14
|
-
for (const [
|
|
15
|
-
|
|
16
|
-
return
|
|
12
|
+
function y(e, t) {
|
|
13
|
+
const o = {};
|
|
14
|
+
for (const [r, k] of Object.entries(t))
|
|
15
|
+
o[r] = S(e, k);
|
|
16
|
+
return o;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
return
|
|
18
|
+
function W(e, t) {
|
|
19
|
+
return e.object(y(e, t));
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const
|
|
23
|
-
return
|
|
21
|
+
function S(e, t) {
|
|
22
|
+
const o = h(e, t);
|
|
23
|
+
return t.required === !0 ? o : o.optional();
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
let
|
|
27
|
-
return
|
|
25
|
+
function h(e, t) {
|
|
26
|
+
let o = P(e, t);
|
|
27
|
+
return t.description !== void 0 && (o = o.describe(t.description)), o;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
switch (
|
|
29
|
+
function b(e, t) {
|
|
30
|
+
switch (t) {
|
|
31
31
|
case "string":
|
|
32
|
-
return
|
|
32
|
+
return e.string();
|
|
33
33
|
case "number":
|
|
34
|
-
return
|
|
34
|
+
return e.number();
|
|
35
35
|
case "boolean":
|
|
36
|
-
return
|
|
36
|
+
return e.boolean();
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
|
|
39
|
+
function M(e) {
|
|
40
|
+
return e === "string" || e === "number" || e === "boolean";
|
|
41
|
+
}
|
|
42
|
+
function P(e, t) {
|
|
43
|
+
switch (t.type) {
|
|
41
44
|
case "string": {
|
|
42
|
-
if (
|
|
43
|
-
if (
|
|
45
|
+
if (t.enum != null) {
|
|
46
|
+
if (t.enum.length === 0)
|
|
44
47
|
throw new Error("String schema field enum must include at least one value.");
|
|
45
|
-
return
|
|
48
|
+
return e.enum(t.enum);
|
|
46
49
|
}
|
|
47
|
-
return
|
|
50
|
+
return e.string();
|
|
48
51
|
}
|
|
49
52
|
case "number":
|
|
50
|
-
return
|
|
53
|
+
return e.number();
|
|
51
54
|
case "boolean":
|
|
52
|
-
return
|
|
55
|
+
return e.boolean();
|
|
53
56
|
case "array": {
|
|
54
|
-
if (
|
|
57
|
+
if (t.itemType == null)
|
|
55
58
|
throw new Error("Array schema field requires an itemType definition.");
|
|
56
|
-
return
|
|
59
|
+
return e.array(
|
|
60
|
+
M(t.itemType) ? b(e, t.itemType) : h(e, t.itemType)
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
case "object": {
|
|
64
|
+
if (t.fields == null)
|
|
65
|
+
throw new Error("Object schema field requires a fields definition.");
|
|
66
|
+
return W(e, t.fields);
|
|
57
67
|
}
|
|
58
68
|
}
|
|
59
69
|
}
|
|
60
|
-
async function
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
return
|
|
64
|
-
}
|
|
65
|
-
async function
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
70
|
+
async function A(e) {
|
|
71
|
+
d ??= import("zod");
|
|
72
|
+
const t = await d;
|
|
73
|
+
return W(t.z, e);
|
|
74
|
+
}
|
|
75
|
+
async function T(e, t) {
|
|
76
|
+
g ??= import("../utils/index.js");
|
|
77
|
+
const o = await g;
|
|
78
|
+
return await (await n(
|
|
79
|
+
o,
|
|
80
|
+
"sendUXSuggestion"
|
|
81
|
+
))(e, t);
|
|
82
|
+
}
|
|
83
|
+
async function L(e) {
|
|
84
|
+
i ??= import("./FunctionAgent.js");
|
|
85
|
+
const t = await i, o = await n(
|
|
86
|
+
t,
|
|
69
87
|
"FunctionAgent"
|
|
70
88
|
);
|
|
71
|
-
return new
|
|
89
|
+
return new o(e);
|
|
72
90
|
}
|
|
73
|
-
async function
|
|
91
|
+
async function q(e) {
|
|
74
92
|
a ??= import("./tools/FunctionTool.js");
|
|
75
|
-
const
|
|
76
|
-
|
|
93
|
+
const t = await a, o = await n(
|
|
94
|
+
t,
|
|
77
95
|
"FunctionTool"
|
|
78
96
|
);
|
|
79
|
-
return new
|
|
97
|
+
return new o(e);
|
|
80
98
|
}
|
|
81
|
-
async function
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
return new
|
|
99
|
+
async function F(e) {
|
|
100
|
+
c ??= import("./LLMAgent.js");
|
|
101
|
+
const t = await c, o = await n(t, "LLMAgent");
|
|
102
|
+
return new o(e);
|
|
85
103
|
}
|
|
86
|
-
async function
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
|
|
104
|
+
async function j(e) {
|
|
105
|
+
u ??= import("./WorkflowAgent.js");
|
|
106
|
+
const t = await u, o = await n(
|
|
107
|
+
t,
|
|
90
108
|
"WorkflowAgent"
|
|
91
109
|
);
|
|
92
|
-
return new
|
|
110
|
+
return new o(e);
|
|
93
111
|
}
|
|
94
|
-
async function
|
|
95
|
-
|
|
96
|
-
const
|
|
97
|
-
return new
|
|
112
|
+
async function E(e) {
|
|
113
|
+
l ??= import("./workflows/ConditionalWorkflow.js");
|
|
114
|
+
const t = await l, o = await n(t, "ConditionalWorkflow");
|
|
115
|
+
return new o(e);
|
|
98
116
|
}
|
|
99
|
-
async function
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
|
|
117
|
+
async function v(e) {
|
|
118
|
+
s ??= import("./workflows/LoopWorkflow.js");
|
|
119
|
+
const t = await s, o = await n(
|
|
120
|
+
t,
|
|
103
121
|
"LoopWorkflow"
|
|
104
122
|
);
|
|
105
|
-
return new
|
|
123
|
+
return new o(e);
|
|
106
124
|
}
|
|
107
|
-
async function
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
|
|
125
|
+
async function U(e) {
|
|
126
|
+
w ??= import("./workflows/ParallelWorkflow.js");
|
|
127
|
+
const t = await w, o = await n(
|
|
128
|
+
t,
|
|
111
129
|
"ParallelWorkflow"
|
|
112
130
|
);
|
|
113
|
-
return new
|
|
131
|
+
return new o(e);
|
|
114
132
|
}
|
|
115
|
-
async function
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
|
|
133
|
+
async function R(e) {
|
|
134
|
+
m ??= import("./workflows/RouterWorkflow.js");
|
|
135
|
+
const t = await m, o = await n(
|
|
136
|
+
t,
|
|
119
137
|
"RouterWorkflow"
|
|
120
138
|
);
|
|
121
|
-
return new
|
|
139
|
+
return new o(e);
|
|
122
140
|
}
|
|
123
|
-
async function
|
|
141
|
+
async function X(e) {
|
|
124
142
|
f ??= import("./workflows/SequentialWorkflow.js");
|
|
125
|
-
const
|
|
126
|
-
return new
|
|
143
|
+
const t = await f, o = await n(t, "SequentialWorkflow");
|
|
144
|
+
return new o(e);
|
|
127
145
|
}
|
|
128
|
-
async function
|
|
129
|
-
|
|
130
|
-
const
|
|
131
|
-
|
|
146
|
+
async function x(e) {
|
|
147
|
+
p ??= import("./workflows/SwitchWorkflow.js");
|
|
148
|
+
const t = await p, o = await n(
|
|
149
|
+
t,
|
|
132
150
|
"SwitchWorkflow"
|
|
133
151
|
);
|
|
134
|
-
return new
|
|
152
|
+
return new o(e);
|
|
135
153
|
}
|
|
136
154
|
export {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
155
|
+
E as createConditionalWorkflow,
|
|
156
|
+
L as createFunctionAgent,
|
|
157
|
+
q as createFunctionTool,
|
|
158
|
+
F as createLLMAgent,
|
|
159
|
+
v as createLoopWorkflow,
|
|
160
|
+
U as createParallelWorkflow,
|
|
161
|
+
R as createRouterWorkflow,
|
|
162
|
+
A as createSchema,
|
|
163
|
+
X as createSequentialWorkflow,
|
|
164
|
+
x as createSwitchWorkflow,
|
|
165
|
+
j as createWorkflowAgent,
|
|
166
|
+
T as sendUXSuggestion
|
|
148
167
|
};
|
|
@@ -3,10 +3,8 @@ import type { BaseChannel, BinaryOperatorAggregate } from "@langchain/langgraph/
|
|
|
3
3
|
import type { AnnotationRoot, StateDefinitionInit, StateGraph } from "@langchain/langgraph/web";
|
|
4
4
|
import type { AgentExecutionContext, AgentRegistration, AgentStatus } from "../utils/index.js";
|
|
5
5
|
|
|
6
|
-
/** @internal */
|
|
7
6
|
export type AgentData = Record<string, unknown>;
|
|
8
7
|
|
|
9
|
-
/** @internal */
|
|
10
8
|
export type EmptyAgentData = Record<never, never>;
|
|
11
9
|
|
|
12
10
|
/** @internal */
|
|
@@ -16,13 +14,18 @@ export type ZodModule = {
|
|
|
16
14
|
|
|
17
15
|
export type SchemaPrimitiveFieldType = "boolean" | "number" | "string";
|
|
18
16
|
|
|
17
|
+
export type SchemaArrayItemDefinition = SchemaFieldDefinition | SchemaPrimitiveFieldType;
|
|
18
|
+
|
|
19
19
|
export type SchemaFieldDefinition = ({
|
|
20
|
-
enum?: readonly string[];
|
|
21
|
-
type: "string";
|
|
22
|
-
} | {
|
|
23
|
-
itemType: SchemaPrimitiveFieldType;
|
|
24
20
|
type: "array";
|
|
25
|
-
|
|
21
|
+
itemType: SchemaArrayItemDefinition;
|
|
22
|
+
} | { type: "boolean" | "number"; } | {
|
|
23
|
+
type: "object";
|
|
24
|
+
fields: SchemaDefinition;
|
|
25
|
+
} | {
|
|
26
|
+
type: "string";
|
|
27
|
+
enum?: readonly string[];
|
|
28
|
+
}) & {
|
|
26
29
|
description?: string;
|
|
27
30
|
required?: boolean;
|
|
28
31
|
};
|
|
@@ -36,7 +39,7 @@ export type SchemaDefinitionData<TDefinition extends SchemaDefinition> = {
|
|
|
36
39
|
[K in keyof TDefinition as TDefinition[K] extends { required: true; } ? never : K]?: SchemaFieldData<TDefinition[K]>;
|
|
37
40
|
};
|
|
38
41
|
|
|
39
|
-
/** @privateRemark All
|
|
42
|
+
/** @privateRemark All agents are orchestrator-driven, so these channels exist for every agent graph. */
|
|
40
43
|
export type AgentRuntimeState = {
|
|
41
44
|
agentExecutionContext: AgentExecutionContext;
|
|
42
45
|
/** The outputMessage is a string representing the output of an agent execution. */
|
|
@@ -128,7 +131,6 @@ export type AgentNodeUpdate<TInput extends AgentData, TOutput extends AgentData>
|
|
|
128
131
|
* AgentStateAnnotation defines the shape of the agent state used in LangGraph nodes, including both the built-in runtime channels
|
|
129
132
|
* and any custom fields defined by the agent.
|
|
130
133
|
*
|
|
131
|
-
* @internal
|
|
132
134
|
* @since 5.1
|
|
133
135
|
*/
|
|
134
136
|
export type AgentStateAnnotation<TState extends AgentData> = AnnotationRoot<{
|
|
@@ -150,7 +152,6 @@ export type RunnableUpdate<TState extends AgentData> = Partial<TState> extends o
|
|
|
150
152
|
/**
|
|
151
153
|
* Internal type representing the compiled graph used for agent execution.
|
|
152
154
|
*
|
|
153
|
-
* @internal
|
|
154
155
|
* @since 5.1
|
|
155
156
|
*/
|
|
156
157
|
export type TypedStateGraph<TState extends AgentData> = StateGraph<StateDefinitionInit, AgentGraphState<TState>, RunnableUpdate<AgentGraphState<TState>>, string>;
|
|
@@ -159,7 +160,6 @@ export type TypedStateGraph<TState extends AgentData> = StateGraph<StateDefiniti
|
|
|
159
160
|
* The shape of the `createGraph` function used by agents to generate their internal graph representation.
|
|
160
161
|
* This function is responsible for defining the nodes and edges of the graph, as well as any associated state and middleware.
|
|
161
162
|
*
|
|
162
|
-
* @internal
|
|
163
163
|
* @since 5.1
|
|
164
164
|
*/
|
|
165
165
|
export type AgentCreateGraph<TState extends AgentData> = () => TypedStateGraph<TState>;
|
|
@@ -178,4 +178,4 @@ export type GraphEdge<S extends AgentData> = {
|
|
|
178
178
|
to: string;
|
|
179
179
|
};
|
|
180
180
|
|
|
181
|
-
export type SchemaFieldData<TField extends SchemaFieldDefinition> = TField extends { type: "string"; } ? TField["enum"] extends readonly (infer TValue extends string)[] ? TValue : string : TField extends { type: "array"; } ? (TField["itemType"] extends "string" ? string : TField["itemType"] extends "number" ? number : boolean)[] : TField extends { type: "number"; } ? number : boolean;
|
|
181
|
+
export type SchemaFieldData<TField extends SchemaFieldDefinition> = TField extends { type: "string"; } ? TField["enum"] extends readonly (infer TValue extends string)[] ? TValue : string : TField extends { type: "array"; } ? (TField["itemType"] extends "string" ? string : TField["itemType"] extends "number" ? number : TField["itemType"] extends "boolean" ? boolean : TField["itemType"] extends SchemaFieldDefinition ? SchemaFieldData<TField["itemType"]> : never)[] : TField extends { type: "object"; } ? SchemaDefinitionData<TField["fields"]> : TField extends { type: "number"; } ? number : boolean;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{b as i,c as a}from"./W2JAKE2M.js";import"./5W7S2RS4.js";import"./NXKKG5TK.js";import{v as s,z as e}from"./MAV3DW27.js";import"./ADYIXCSG.js";import"./YIMNOUTF.js";var t=class extends s{static{this.properties={agent:0,context:0}}#t;async getContext(){return i(this.context)?await this.context():this.context}load(){this.#t=a(this)}disconnectedCallback(){this.#t?.unregister(this.agent.id),super.disconnectedCallback()}};e("arcgis-assistant-agent",t);export{t as ArcgisAssistantAgent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as u,b as g,c as S}from"./LODKJRS4.js";import a from"./
|
|
2
|
+
import{a as u,b as g,c as S}from"./LODKJRS4.js";import a from"./L77BTGXY.js";import{b as m,c as f}from"./CVHJMR5X.js";import{u as p}from"./CJIV4KJZ.js";import"./IKEF7ZHH.js";import"./ZEYIBYSF.js";import"./YIMNOUTF.js";export default $arcgis.t(([{property:h,subclass:l},{watch:w},d])=>{var v=Object.defineProperty,y=Object.getOwnPropertyDescriptor,o=(t,e,s,r)=>{for(var i=r>1?void 0:r?y(e,s):e,a=t.length-1,c;a>=0;a--)(c=t[a])&&(i=(r?c(e,s,i):c(i))||i);return r&&i&&v(e,s,i),i},n=class extends d{constructor(t){super(t)}initialize(){this.addHandles(w(()=>[this.name,this.description,this.inputSchema,this.outputSchema,this.execute],()=>{this.generate()},{initial:!0,sync:!0}))}getSchemas(){return[this.inputSchema,this.outputSchema].filter(Boolean)}generate(){let t=m(this.getSchemas());this._set("workspace",t);let e=`${this.id}-execute`,s={[e]:this._invokeExecuteNode.bind(this)},r=[{from:e,decide:()=>{}}];this._set("createGraph",()=>f(s,r,t,{agent:this,entryNode:e,middlewares:this.middlewares}))}async _invokeExecuteNode(t,e){try{return this.outputSchema?await this._invokeStructured(t,e):await this._invokeUnstructured(t,e)}catch(s){if(p(s))throw s;let r=s instanceof Error?s.message:String(s);return u({outputMessage:r},"failed",r)}}async _invokeStructured(t,e){if(!this.outputSchema)throw new Error("Output schema is required for structured invocation.");let s=this._validateInputState(t),r=await this.execute(s,e);if(typeof r=="string")throw new Error("Expected execute function to return an object matching the output schema, but received a string.");return g(r,this.outputSchema,t.agentExecutionContext.messages)}async _invokeUnstructured(t,e){let s=this._validateInputState(t),r=await this.execute(s,e),i=typeof r=="string"?r:JSON.stringify(r),a=i.trim()||"FunctionAgent completed.";return u({outputMessage:i},"success",a)}_validateInputState(t){if(!this.inputSchema)return t;let e=this.inputSchema.safeParse(S(t,this.inputSchema));if(!e.success)throw new Error(`FunctionAgent input schema validation failed: ${e.error.message}`);return{...t,...e.data}}};o([h()],n.prototype,"inputSchema",2);o([h()],n.prototype,"outputSchema",2);o([h()],n.prototype,"execute",2);n=o([l("FunctionAgent")],n);return n},"core/accessorSupport/decorators","core/reactiveUtils",a)
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import"./YIMNOUTF.js";var e=`## Who you are
|
|
3
|
+
|
|
4
|
+
You are a map assistant embedded inside a GIS application. You have no knowledge of history, science, people, events, cooking, or anything outside of this map and its data. You only know what is described in the Map Context below.
|
|
5
|
+
|
|
6
|
+
If asked anything outside of that context, you simply don't have that information \u2014 respond naturally and redirect to something you _can_ help with, using specific layer and field names from the map context.
|
|
7
|
+
|
|
8
|
+
Example of how to handle unknown topics:
|
|
9
|
+
"I don't have information on that \u2014 I only know about this map. You could ask me to list all layers in the map, or capabilities of this assistant."
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Your capabilities
|
|
14
|
+
|
|
15
|
+
You can help users with:
|
|
16
|
+
|
|
17
|
+
- Listing the layers in this map
|
|
18
|
+
- Listing the fields in a specific layer (use the tool)
|
|
19
|
+
- Suggesting specific queries using actual layer and field names
|
|
20
|
+
- Summarizing what this map contains and what users can do with it
|
|
21
|
+
- Letting users know when a map-related action isn't supported (e.g. charts, tables), and that it may be added in the future
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Input
|
|
26
|
+
|
|
27
|
+
Assigned task:
|
|
28
|
+
{assignedTask}
|
|
29
|
+
|
|
30
|
+
Latest user request:
|
|
31
|
+
{userRequest}
|
|
32
|
+
|
|
33
|
+
Prior steps:
|
|
34
|
+
{priorSteps}
|
|
35
|
+
|
|
36
|
+
Use the assigned task as the primary instruction. The question will **not** be restated again here.
|
|
37
|
+
Use the latest user request as supporting context.
|
|
38
|
+
Use prior steps only to explain a previous result, failure, or likely next action.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Map Context
|
|
43
|
+
|
|
44
|
+
{layerSummary}
|
|
45
|
+
|
|
46
|
+
## Available agents (capabilities)
|
|
47
|
+
|
|
48
|
+
{agents}
|
|
49
|
+
|
|
50
|
+
### Response Guidelines
|
|
51
|
+
|
|
52
|
+
When suggesting what users can ask, be SPECIFIC using actual layer names:
|
|
53
|
+
|
|
54
|
+
- "Show me water sources with elevation above 500"
|
|
55
|
+
- "Filter Protected Areas in Panama by protection level"
|
|
56
|
+
- "Zoom to Watershed Boundaries"
|
|
57
|
+
|
|
58
|
+
For "what can I ask" responses, provide 3-5 specific example queries using fields from the context.
|
|
59
|
+
|
|
60
|
+
For off-topic questions:
|
|
61
|
+
"I can only help with this map. Try asking me to filter [LayerName] by [FieldName], or zoom to a location."
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Format
|
|
66
|
+
|
|
67
|
+
- Keep responses concise
|
|
68
|
+
- Use bullet points for lists
|
|
69
|
+
- Use new lines (\\n) and appropriate formatting in your response
|
|
70
|
+
- Use actual layer and field names from the map context in any suggestions
|
|
71
|
+
`;export{e as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{g as t,h as e,t as i,u as a,v as n,z as r}from"./MAV3DW27.js";import"./ADYIXCSG.js";import"./YIMNOUTF.js";export default $arcgis.t(([l,{when:o,watch:c}])=>{var h=t`.messages-container{display:flex;flex:1;flex-direction:column;line-height:var(--calcite-font-line-height-relative-snug)}.messages-list{padding:var(--calcite-spacing-lg);display:flex;flex-direction:column;gap:var(--calcite-spacing-xxl);flex:1 1 auto;min-height:0;justify-content:flex-end;overflow:auto}.end-ref{margin-top:var(--calcite-spacing-lg)}`,s=class extends n{constructor(){super(...arguments),this.#t=i(),this.#s=!1,this.loading=!1,this.messages=new l([]),this.interrupt=null}static{this.properties={loading:5,messages:0,interrupt:0}}static{this.styles=h}#t;#s;firstUpdated(){this.#e()}loaded(){this.manager.onLifecycle(()=>[this.messages.on("change",()=>{this.#e()}),o(()=>!this.loading,()=>{this.#s=!1}),c(()=>[this.loading,this.interrupt],()=>this.#e())])}#e(){requestAnimationFrame(()=>{this.#s||this.#t.value?.scrollIntoView({behavior:"smooth",block:"end"})})}#i(){this.#s=!0}render(){return e`<div class="messages-container" @wheel=${this.#i}><div class="messages-list"><slot name=message-starter></slot><slot name=messages></slot><slot name=message-loading></slot></div><div class="end-ref" ${a(this.#t)}></div></div>`}};r("arcgis-assistant-chat",s);return s},"core/Collection","core/reactiveUtils")
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import a from"./
|
|
2
|
+
import a from"./WAVKMZA6.js";import"./CVHJMR5X.js";import"./CJIV4KJZ.js";import"./IKEF7ZHH.js";import"./ZEYIBYSF.js";import"./YIMNOUTF.js";export default $arcgis.t(([{property:g,subclass:p},{c:d,d:u}])=>{var f=Object.defineProperty,w=Object.getOwnPropertyDescriptor,c=(e,r,n,o)=>{for(var t=o>1?void 0:o?w(r,n):r,i=e.length-1,a;i>=0;i--)(a=e[i])&&(t=(o?a(r,n,t):a(t))||t);return o&&t&&f(r,n,t),t},s=class extends u{constructor(e){super(e)}getAgents(){return this.agents}buildNodes(e){let r=super.buildNodes(e);return r[l]=()=>({}),r}buildEdges(e){let r=this.condition;if(!r)throw new Error("ConditionalWorkflow requires a condition.");let n=d(e[0],0),o=d(e[1],1);return[{from:l,decide:async(t,i)=>await Promise.resolve(r(t,i))?n:o}]}getEntryNode(){return l}isTerminalAgent(){return!0}validateAgents(e){if(super.validateAgents(e),e.length!==2)throw new Error(`ConditionalWorkflow requires exactly 2 agents; received ${e.length}.`)}};c([g()],s.prototype,"condition",2);c([g()],s.prototype,"agents",2);s=c([p("ConditionalWorkflow")],s);var l="__conditional_decide";return s},"core/accessorSupport/decorators",a)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import a from"./
|
|
2
|
+
import a from"./WAVKMZA6.js";import"./CVHJMR5X.js";import"./CJIV4KJZ.js";import"./IKEF7ZHH.js";import"./ZEYIBYSF.js";import"./YIMNOUTF.js";export default $arcgis.t(([{property:l,subclass:w},{c:p,d:d}])=>{var y=Object.defineProperty,m=Object.getOwnPropertyDescriptor,f=e=>{throw TypeError(e)},h=(e,t,o,n)=>{for(var r=n>1?void 0:n?m(t,o):t,s=e.length-1,g;s>=0;s--)(g=e[s])&&(r=(n?g(t,o,r):g(r))||r);return n&&r&&y(t,o,r),r},k=(e,t,o)=>t.has(e)||f("Cannot "+o),b=(e,t,o)=>t.has(e)?f("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,o),c=(e,t,o)=>(k(e,t,"access private method"),o),a,i,u=class extends d{constructor(e){super(e),b(this,a)}getAgents(){return c(this,a,i).call(this),[this.routerAgent,...Object.values(this.agentsMap)]}buildEdges(e){c(this,a,i).call(this);let t=p(this.routerAgent,0),o=new Map;for(let[n,[r]]of Object.entries(this.agentsMap).entries())o.set(r,p(e[n+1],n+1));return[{from:t,decide:n=>{let r=n[this.routerOutputKey];if(typeof r!="string"||!r)throw new Error("RouterWorkflow decideRoute could not determine next agent from state.");let s=o.get(r);if(!s)throw new Error(`RouterWorkflow decideRoute returned unknown agent: ${r}. Expected one of: ${Object.keys(this.agentsMap).join(", ")||"(none)"}.`);return s}}]}getEntryNode(){return c(this,a,i).call(this),p(this.routerAgent,0)}isTerminalAgent(e,t){return t>0}validateAgents(e){c(this,a,i).call(this),super.validateAgents(e)}};a=new WeakSet;i=function(){if(!Object.keys(this.agentsMap).length)throw new Error("RouterWorkflow requires a non-empty agentsMap.")};h([l()],u.prototype,"agentsMap",2);h([l()],u.prototype,"routerAgent",2);h([l()],u.prototype,"routerOutputKey",2);u=h([w("RouterWorkflow")],u);return u},"core/accessorSupport/decorators",a)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{_ as h,a as E,b as y,ta as k}from"./CJIV4KJZ.js";var j=new Set(["agentExecutionContext","outputMessage","summary","status"]);function x(){return{assignedTask:"",messages:[],priorSteps:[],sharedState:{},userRequest:""}}function O(r){let o=[...new Set([...r].filter(n=>j.has(n)))];if(o.length!==0)throw new Error(`custom state cannot define reserved runtime fields: ${o.join(", ")}.`)}function S(r){let o=Object.entries(r);return Object.fromEntries(o.map(([n,t])=>[n,h({reducer:(i,g)=>g,default:()=>t})]))}function $(r={}){O(Object.keys(r));let o=S(r);return h.Root({...o,agentExecutionContext:h({reducer:(n,t)=>({...n,...t}),default:x}),outputMessage:h({reducer:(n="",t)=>typeof t=="string"&&t.trim()?t:n,default:()=>""}),summary:h({reducer:(n="",t)=>typeof t=="string"?t:n,default:()=>""}),status:h({reducer:(n,t)=>t??n,default:()=>{}})})}function M(r){let o=new Set;for(let t of r)for(let i of Object.keys(t.shape??{}))o.add(i);let n=Object.fromEntries([...o].map(t=>[t,void 0]));return $(n)}function T(r,o,n,t={}){let{agent:i,entryNode:g,middlewares:c=[]}=t,a=new k(n);if(Object.keys(r).length===0)throw new Error("Graph requires at least one node.");if(o.length===0)throw new Error("Graph requires at least one edge.");if(c.length>0&&!i)throw new Error("Graph middleware requires agent metadata.");let s=new Set(Object.keys(r)),l=new Map,w=new Map;for(let e of s)l.set(e,0),w.set(e,0);for(let e of o)"to"in e?(s.has(e.from)&&w.set(e.from,(w.get(e.from)??0)+1),s.has(e.to)&&l.set(e.to,(l.get(e.to)??0)+1)):s.has(e.from)&&w.set(e.from,(w.get(e.from)??0)+1);for(let[e,f]of Object.entries(r)){let u=N(i,e,c,async(d,p)=>await Promise.resolve(f(d,p))),m=async(d,p)=>await u(d,p);a=a.addNode(e,m)}for(let e of o)if("to"in e){let f=e.from,u=e.to;if(!s.has(f))throw new Error(`Graph edge references unknown from-node: ${f}`);if(!s.has(u))throw new Error(`Graph edge references unknown to-node: ${u}`);a.addEdge(f,u)}else{let f=e.from;if(!s.has(f))throw new Error(`Graph conditional edge references unknown from-node: ${f}`);a.addConditionalEdges(f,async(u,m)=>{let d=await e.decide(u,m);if(!d)return y;if(!s.has(d))throw new Error(`Graph conditional edge returned unknown node: ${d}`);return d})}let G=q(s,l,g);a.addEdge(E,G);let b=[...s].filter(e=>(w.get(e)??0)===0);for(let e of b)a.addEdge(e,y);return a}function N(r,o,n,t){return!n.length||!r?t:async(i,g)=>await n.reduceRight((c,a)=>async s=>await a.handler(s,c),async c=>{let a=await t(c.state,c.config);return{...c.state,...a}})({agent:r,config:g,nodeName:o,state:i})}function q(r,o,n){if(n){if(!r.has(n))throw new Error(`Graph entry node references unknown node: ${n}`);return n}let t=[...r].filter(i=>(o.get(i)??0)===0);if(t.length!==1)throw new Error(`Graph could not infer a single entry node (found ${t.length}). Provide an explicit entryNode or ensure exactly one node has no incoming edges.`);return t[0]}export{$ as a,M as b,T as c};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import c from"./HOCTVCHH.js";import b from"./IDZTJLVN.js";import a from"./I76F57I2.js";import{a as i}from"./4RZPOYZ7.js";import{a as u,b as p,q as f,ta as S}from"./CJIV4KJZ.js";export default $arcgis.t(([,,,,,,{r:x},{A:_,B:h,a:w,m:E,o:y,p:I,q:L,r:v,s:F,t:$,u:C,v:N,w:R,x:T,y:b,z:A},q])=>{var V=.7,z=10,D=async(a,t)=>{try{await i({text:"Similarity search to find fields"},t);let e=y(t,"fieldSearch"),n=y(t,"layersAndFieldsRegistry"),o=y(t,"embeddingCache"),r=await e.searchFields({text:a.agentExecutionContext.assignedTask,layerIds:a.vectorSearchLayerIds,minScore:V,topResults:z,embeddingCache:o}),m=r.map(({layerId:d,results:c})=>{let g=c.map(s=>` - ${s.name} (${s.score.toFixed(2)})`).join(`
|
|
3
|
+
`);return`${n.get(d)?.layerItem.name??d}:
|
|
4
|
+
${g}`}).join(`
|
|
5
|
+
`),l;return r.length>0?l=`Vector search completed. Matching layers and fields with scores:
|
|
6
|
+
${m}`:l=`No vector search results found for score over ${V}.`,await i({text:l},t),{...a,vectorSearchFieldResults:r}}catch(e){throw await i({text:`Error during vector search: ${e instanceof Error?e.message:String(e)}`},t),new Error(`Vector search failed: ${e instanceof Error?e.message:String(e)}`)}},B=.7,G=async(a,t)=>{try{await i({text:`Similarity search to find layers: ${a.agentExecutionContext.assignedTask}`},t);let e=y(t,"layerSearch"),n=y(t,"layersAndFieldsRegistry"),o=await e.searchLayers({text:a.agentExecutionContext.assignedTask,minScore:B}),r=o.map(d=>d.id),m=o.map(({id:d,score:c})=>`${n.get(d)?.layerItem.name??d} (${c.toFixed(2)})`).join(`
|
|
7
|
+
`),l;return r.length>0?l=`Vector search completed. Matching layers with scores:
|
|
8
|
+
${m}`:l="Vector search completed. No matching layers found.",await i({text:l},t),{...a,vectorSearchLayerIds:r}}catch(e){throw await i({text:`Error during vector search: ${e instanceof Error?e.message:String(e)}`},t),new Error(`Vector search failed: ${e instanceof Error?e.message:String(e)}`)}},k=[L,v,F,$,C,N,R,T,b,A,_],M=(a,t=3)=>{let e=a.map((o,r)=>o.type==="human"?r:-1).filter(o=>o!==-1);if(e.length===0)return[];let n=e.length>t?e[e.length-t]:e[0];return a.slice(n)},H=async(a,t)=>{await i({text:"Requesting LLM for layer query results"},t);let e=await E("navigation_intent_prompt");if(!t?.configurable)throw new Error("config.configurable is required for layer query tools");let n={layerFieldInfo:a.layerFieldInfo},o=await x({promptText:e,modelTier:"advanced",config:t,messages:M(a.agentExecutionContext.messages),inputVariables:n,tools:k});return await q(o,t),{...a,agentExecutionContext:{...a.agentExecutionContext,messages:[...a.agentExecutionContext.messages,o]}}};async function P(a,t){let e=await new w(k,{handleToolErrors:!1}).invoke({messages:M(a.agentExecutionContext.messages)},t),n=e.messages.map(r=>r.text).join(`
|
|
9
|
+
`);await i({text:`Finished executing layer filter tool: ${n}`},t);let o=e.messages.map(r=>r.text).join(`
|
|
10
|
+
`);return{...a,outputMessage:o}}var J=async(a,t)=>(await i({text:"Exiting Layer Styling agent"},t),a),K=async(a,t)=>{try{await i({text:"Populating layer and field info"},t);let e=[];for(let n of a.vectorSearchFieldResults){let o=function(g){let s=l.get(g)?.layerItem;return s?[s.name&&`Name: ${s.name}`,s.title&&`Title: ${s.title}`,s.description&&`Description: ${s.description}`].filter(Boolean).join(" | "):g},{layerId:r,results:m}=n,l=y(t,"layersAndFieldsRegistry"),d=l.get(r)?.fieldRegistry;if(!d)continue;let c=e.find(g=>g.layerId===r);c||(c={layerId:r,layerSummary:o(r),fieldInfos:[]},e.push(c));for(let g of m){let s=d.get(g.name);s&&c.fieldInfos.push(s)}}return await i({text:"Populated layerFieldInfo"},t),{...a,layerFieldInfo:e}}catch(e){throw await i({text:"Error populating layerFieldInfo"},t),new Error(`Error populating layerFieldInfo: ${e instanceof Error?e.message:String(e)}`)}},U=(a,t)=>{let e=a.vectorSearchLayerIds??[];if(e.length<=1)return{...a,selectedLayerId:a.vectorSearchLayerIds[0]};let{hitlResponse:n}=t.configurable;if(n?.agentId!==j.id||n.id!=="reviewLayerSelection"){let r={agentId:j.id,id:"reviewLayerSelection",kind:"singleSelection",message:"Choose a layer to apply the styles.",metadata:[...e]};throw new f(r)}let o=null;return Array.isArray(n.payload)&&n.payload.length>0&&(o=n.payload[0]),{...a,selectedLayerId:o??a.vectorSearchLayerIds[0]}},O=(a,t)=>I(["layerSearch","fieldSearch","layersAndFieldsRegistry"],"Layer Styling Agent")(a,t),Q=()=>new S(h).addNode("requireLayerStylingServices",O).addNode("vectorSearchLayers",G).addNode("layerSelectionHITL",U).addNode("vectorSearchFields",D).addNode("populateLayerFieldInfo",K).addNode("agent",H).addNode("tools",P).addNode("earlyExit",J).addEdge(u,"requireLayerStylingServices").addEdge("requireLayerStylingServices","vectorSearchLayers").addConditionalEdges("layerSelectionHITL",a=>a.vectorSearchLayerIds.length?"vectorSearchFields":"earlyExit").addConditionalEdges("vectorSearchFields",a=>a.vectorSearchFieldResults.length?"populateLayerFieldInfo":"earlyExit").addEdge("populateLayerFieldInfo","agent").addEdge("agent","tools").addEdge("tools",p).addEdge("earlyExit",p),W=String.raw`- **layerStyling** — User wants to change how features are drawn or styled on the map based on their data, such as applying color, size, transparency, symbols, or charts according to field values.
|
|
11
|
+
_Example: “Color points by sales amount”_
|
|
12
|
+
_Example: “Show population density with a color gradient”_
|
|
13
|
+
_Example: “Create a relationship map between height and depth”_
|
|
14
|
+
_Example: “Vary circle sizes according to population”_`,j={id:"layerStyling",name:"Layer Styling Agent",description:W,createGraph:Q,workspace:h};return j},"identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request",a,b,c)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import c from"./RNLQZV6U.js";import b from"./IDZTJLVN.js";import a from"./I76F57I2.js";import{a as s,c as o}from"./W2JAKE2M.js";import"./5W7S2RS4.js";import"./NXKKG5TK.js";import{v as i,z as r}from"./MAV3DW27.js";import"./ADYIXCSG.js";import"./4RZPOYZ7.js";import"./6LZ6GOHF.js";import"./CJIV4KJZ.js";import"./IKEF7ZHH.js";import"./WNS5ZUF5.js";import"./ZEYIBYSF.js";import"./YIMNOUTF.js";export default $arcgis.t(([,,,,,,,,,,,,,a])=>{var t=class extends i{constructor(){super(...arguments),this.agent=a}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-navigation-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=s(this,"arcgis-assistant-navigation-agent"),this.#i=o(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-navigation-agent",t);return t},"identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","views/LinkChartView","rest/knowledgeGraphService",a,b,c)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{g as i,h as s,v as n,z as o}from"./MAV3DW27.js";import"./ADYIXCSG.js";import"./YIMNOUTF.js";var c=i`:host{display:block}`,e=class extends n{static{this.properties={block:0}}static{this.styles=c}_renderSuggestedPrompts(t){if(t.type!=="suggested-prompts")return null;let r=t.data?.prompts,a=Array.isArray(r)?r.filter(p=>typeof p=="string"):[];return a.length?s`<arcgis-assistant-suggested-prompts .prompts=${a}></arcgis-assistant-suggested-prompts>`:null}_renderBlock(t){switch(t.type){case"suggested-prompts":return this._renderSuggestedPrompts(t);case"text":return s`<arcgis-assistant-message-text .content=${t.data?.content} .parts=${t.data?.parts}></arcgis-assistant-message-text>`;default:return null}}render(){return this.block?this._renderBlock(this.block):null}};o("arcgis-assistant-message-block",e);export{e as ArcgisAssistantMessageBlock};
|