@arcgis/ai-components 5.2.0-next.17 → 5.2.0-next.19

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.
Files changed (96) hide show
  1. package/dist/agent-utils/index.d.ts +78 -0
  2. package/dist/agent-utils/index.js +116 -97
  3. package/dist/agent-utils/middlewares/trace.d.ts +2 -0
  4. package/dist/agent-utils/types.d.ts +12 -12
  5. package/dist/cdn/27NEUQN3.js +2 -0
  6. package/dist/cdn/{VKR2CBLM.js → 2NMR43NW.js} +1 -1
  7. package/dist/cdn/3YMSOD5D.js +2 -0
  8. package/dist/cdn/4I4MCV7V.js +71 -0
  9. package/dist/cdn/5SBLS4NW.js +2 -0
  10. package/dist/cdn/ASSH4WSC.js +36 -0
  11. package/dist/cdn/BFPMQT3A.js +2 -0
  12. package/dist/cdn/{LBSOW7OW.js → C7E7MJSR.js} +1 -1
  13. package/dist/cdn/{DECSD3LN.js → CIW3QMKV.js} +1 -1
  14. package/dist/cdn/CVHJMR5X.js +2 -0
  15. package/dist/cdn/E7TMP4YV.js +3 -0
  16. package/dist/cdn/{NRMBMWI5.js → EBRNMPPO.js} +19 -18
  17. package/dist/cdn/GJUD7EA3.js +3 -0
  18. package/dist/cdn/HCR23HJB.js +2 -0
  19. package/dist/cdn/I64KIZG3.js +2 -0
  20. package/dist/cdn/IB4WTK74.js +2 -0
  21. package/dist/cdn/{LQSZTK26.js → IC5P5NYY.js} +1 -1
  22. package/dist/cdn/{QZVAGRWA.js → ICA7JOSU.js} +2 -2
  23. package/dist/cdn/{C4KITTT5.js → IXAKT6L3.js} +1 -1
  24. package/dist/cdn/{NE7E52YR.js → KTK4HNL2.js} +8 -2
  25. package/dist/cdn/{6EVF6NFG.js → KTOL6IN7.js} +5 -5
  26. package/dist/cdn/{VV57ZUOI.js → L77BTGXY.js} +1 -1
  27. package/dist/cdn/NOJYPREL.js +3 -0
  28. package/dist/cdn/{FZIT3DLD.js → O3F47IO5.js} +1 -1
  29. package/dist/cdn/{OLJC5BM3.js → O7TGCM5P.js} +1 -1
  30. package/dist/cdn/PBTINZTK.js +65 -0
  31. package/dist/cdn/PDEBKVBO.js +22 -0
  32. package/dist/cdn/PDT6I6TZ.js +2 -0
  33. package/dist/cdn/PSWI3MFB.js +2 -0
  34. package/dist/cdn/ROLXMEVE.js +18 -0
  35. package/dist/cdn/RX45PCYB.js +9 -0
  36. package/dist/cdn/{W5DLXSAP.js → SMADRJ67.js} +1 -1
  37. package/dist/cdn/U53OEX6L.js +2 -0
  38. package/dist/cdn/VDXSALQI.js +2 -0
  39. package/dist/cdn/{RUURNLTP.js → W2JAKE2M.js} +1 -1
  40. package/dist/cdn/{RHF452M7.js → WAVKMZA6.js} +1 -1
  41. package/dist/cdn/{6ZW7Z36F.js → X7GE26KU.js} +2 -2
  42. package/dist/cdn/XGS5EIA5.js +14 -0
  43. package/dist/cdn/YJ3QQXF6.js +2 -0
  44. package/dist/cdn/{X4UZCTIG.js → YYY7HKYX.js} +1 -1
  45. package/dist/cdn/agent-utils/index.js +1 -1
  46. package/dist/cdn/index.js +1 -1
  47. package/dist/chunks/converterUtils.js +39 -32
  48. package/dist/chunks/dataExplorationGraph.js +12 -10
  49. package/dist/chunks/helpGraph.js +8 -8
  50. package/dist/chunks/help_prompt.js +34 -17
  51. package/dist/chunks/intent_prompt.js +2 -2
  52. package/dist/chunks/navigationGraph.js +4 -4
  53. package/dist/chunks/navigation_intent_prompt.js +8 -2
  54. package/dist/chunks/state.js +1 -1
  55. package/dist/chunks/utils2.js +8 -8
  56. package/dist/components/arcgis-assistant/customElement.d.ts +7 -0
  57. package/dist/components/arcgis-assistant/customElement.js +301 -181
  58. package/dist/components/arcgis-assistant-agent/customElement.js +5 -1
  59. package/dist/components/arcgis-assistant-chat/customElement.js +22 -17
  60. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +9 -5
  61. package/dist/components/arcgis-assistant-help-agent/customElement.js +6 -2
  62. package/dist/components/arcgis-assistant-interrupt/customElement.js +4 -4
  63. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +16 -12
  64. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +8 -4
  65. package/dist/components/arcgis-assistant-message-block/customElement.js +1 -1
  66. package/dist/components/arcgis-assistant-message-text/customElement.d.ts +1 -0
  67. package/dist/components/arcgis-assistant-message-text/customElement.js +12 -12
  68. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +9 -5
  69. package/dist/components/arcgis-assistant-user-message/customElement.js +10 -8
  70. package/dist/docs/api.json +1 -1
  71. package/dist/docs/docs.json +1 -1
  72. package/dist/docs/vscode.html-custom-data.json +1 -1
  73. package/dist/docs/web-types.json +1 -1
  74. package/dist/loader.js +2 -2
  75. package/dist/types/lumina.d.ts +2 -2
  76. package/dist/types/preact.d.ts +2 -2
  77. package/dist/types/react.d.ts +2 -2
  78. package/dist/types/stencil.d.ts +2 -2
  79. package/dist/utils/index.d.ts +1 -2
  80. package/package.json +4 -4
  81. package/dist/cdn/3S7PBYVD.js +0 -2
  82. package/dist/cdn/5VXRVWAX.js +0 -16
  83. package/dist/cdn/CE6VDP2D.js +0 -72
  84. package/dist/cdn/CI3QSFPS.js +0 -2
  85. package/dist/cdn/F2AHA4GB.js +0 -54
  86. package/dist/cdn/GPYYAQVI.js +0 -2
  87. package/dist/cdn/K475UT3E.js +0 -2
  88. package/dist/cdn/KIQUEMI4.js +0 -14
  89. package/dist/cdn/NTGC53UD.js +0 -36
  90. package/dist/cdn/PB2ODJC7.js +0 -2
  91. package/dist/cdn/SBHLUL3Q.js +0 -2
  92. package/dist/cdn/TR3OKQPQ.js +0 -22
  93. package/dist/cdn/WIJRNMBG.js +0 -3
  94. package/dist/cdn/XBW4MWQR.js +0 -2
  95. package/dist/cdn/Z7UWJ4AI.js +0 -3
  96. 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 r, a, i, c, u, l, s, w, f, m, p;
3
- async function n(o, e) {
4
- if (e in o)
5
- return o[e];
6
- if ("default" in o) {
7
- const t = await o.default;
8
- return typeof t == "object" && t !== null && e in t ? t[e] : t;
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(e)} from module.`);
10
+ throw new Error(`Unable to resolve ${String(t)} from module.`);
11
11
  }
12
- function k(o, e) {
13
- const t = {};
14
- for (const [d, W] of Object.entries(e))
15
- t[d] = g(o, W);
16
- return t;
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 h(o, e) {
19
- return o.object(k(o, e));
18
+ function W(e, t) {
19
+ return e.object(y(e, t));
20
20
  }
21
- function g(o, e) {
22
- const t = y(o, e);
23
- return e.required === !0 ? t : t.optional();
21
+ function S(e, t) {
22
+ const o = h(e, t);
23
+ return t.required === !0 ? o : o.optional();
24
24
  }
25
- function y(o, e) {
26
- let t = P(o, e);
27
- return e.description !== void 0 && (t = t.describe(e.description)), t;
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 M(o, e) {
30
- switch (e) {
29
+ function b(e, t) {
30
+ switch (t) {
31
31
  case "string":
32
- return o.string();
32
+ return e.string();
33
33
  case "number":
34
- return o.number();
34
+ return e.number();
35
35
  case "boolean":
36
- return o.boolean();
36
+ return e.boolean();
37
37
  }
38
38
  }
39
- function P(o, e) {
40
- switch (e.type) {
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 (e.enum !== void 0) {
43
- if (e.enum.length === 0)
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 o.enum(e.enum);
48
+ return e.enum(t.enum);
46
49
  }
47
- return o.string();
50
+ return e.string();
48
51
  }
49
52
  case "number":
50
- return o.number();
53
+ return e.number();
51
54
  case "boolean":
52
- return o.boolean();
55
+ return e.boolean();
53
56
  case "array": {
54
- if (e.itemType === void 0)
57
+ if (t.itemType == null)
55
58
  throw new Error("Array schema field requires an itemType definition.");
56
- return o.array(M(o, e.itemType));
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 S(o) {
61
- p ??= import("zod");
62
- const e = await p;
63
- return h(e.z, o);
64
- }
65
- async function b(o) {
66
- r ??= import("./FunctionAgent.js");
67
- const e = await r, t = await n(
68
- e,
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 t(o);
89
+ return new o(e);
72
90
  }
73
- async function A(o) {
91
+ async function q(e) {
74
92
  a ??= import("./tools/FunctionTool.js");
75
- const e = await a, t = await n(
76
- e,
93
+ const t = await a, o = await n(
94
+ t,
77
95
  "FunctionTool"
78
96
  );
79
- return new t(o);
97
+ return new o(e);
80
98
  }
81
- async function L(o) {
82
- i ??= import("./LLMAgent.js");
83
- const e = await i, t = await n(e, "LLMAgent");
84
- return new t(o);
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 q(o) {
87
- c ??= import("./WorkflowAgent.js");
88
- const e = await c, t = await n(
89
- e,
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 t(o);
110
+ return new o(e);
93
111
  }
94
- async function F(o) {
95
- u ??= import("./workflows/ConditionalWorkflow.js");
96
- const e = await u, t = await n(e, "ConditionalWorkflow");
97
- return new t(o);
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 T(o) {
100
- l ??= import("./workflows/LoopWorkflow.js");
101
- const e = await l, t = await n(
102
- e,
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 t(o);
123
+ return new o(e);
106
124
  }
107
- async function v(o) {
108
- s ??= import("./workflows/ParallelWorkflow.js");
109
- const e = await s, t = await n(
110
- e,
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 t(o);
131
+ return new o(e);
114
132
  }
115
- async function E(o) {
116
- w ??= import("./workflows/RouterWorkflow.js");
117
- const e = await w, t = await n(
118
- e,
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 t(o);
139
+ return new o(e);
122
140
  }
123
- async function j(o) {
141
+ async function X(e) {
124
142
  f ??= import("./workflows/SequentialWorkflow.js");
125
- const e = await f, t = await n(e, "SequentialWorkflow");
126
- return new t(o);
143
+ const t = await f, o = await n(t, "SequentialWorkflow");
144
+ return new o(e);
127
145
  }
128
- async function R(o) {
129
- m ??= import("./workflows/SwitchWorkflow.js");
130
- const e = await m, t = await n(
131
- e,
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 t(o);
152
+ return new o(e);
135
153
  }
136
154
  export {
137
- F as createConditionalWorkflow,
138
- b as createFunctionAgent,
139
- A as createFunctionTool,
140
- L as createLLMAgent,
141
- T as createLoopWorkflow,
142
- v as createParallelWorkflow,
143
- E as createRouterWorkflow,
144
- S as createSchema,
145
- j as createSequentialWorkflow,
146
- R as createSwitchWorkflow,
147
- q as createWorkflowAgent
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
  };
@@ -10,6 +10,7 @@ import type { AgentData } from "../types.js";
10
10
  * executions, which can be useful for debugging and monitoring the agent's behavior.
11
11
  *
12
12
  * @returns An agent middleware that wraps model calls and sends trace messages.
13
+ * @internal
13
14
  * @since 5.1
14
15
  */
15
16
  export function createAgentTraceMiddleware(): AgentMiddleware;
@@ -20,6 +21,7 @@ export function createAgentTraceMiddleware(): AgentMiddleware;
20
21
  * debugging and monitoring the behavior of tools within the agent's execution.
21
22
  *
22
23
  * @returns A function tool middleware that wraps tool calls and sends trace messages.
24
+ * @internal
23
25
  * @since 5.1
24
26
  */
25
27
  export function createToolTraceMiddleware<TInput extends AgentData = AgentData, TOutput = unknown>(): FunctionToolMiddleware<TInput, TOutput>;
@@ -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
- } | { type: "boolean" | "number"; }) & {
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 ADK agents are orchestrator-driven, so these channels exist for every agent graph. */
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"./VV57ZUOI.js";import{b as m,c as f}from"./3S7PBYVD.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)
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,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import c from"./ASSH4WSC.js";import b from"./ICA7JOSU.js";import a from"./EBRNMPPO.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,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")
@@ -0,0 +1,36 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import b from"./ICA7JOSU.js";import a from"./EBRNMPPO.js";import{a as m}from"./4RZPOYZ7.js";import{a as k,b as E,ta as $}from"./CJIV4KJZ.js";import{a as f}from"./WNS5ZUF5.js";export default $arcgis.t(([,,,,,,{q:N,r:T},{a:b,b:v,c:x,d:C,e:F,f:R,g:L,h:_,i:I,j:M,k:Z,l:A,m:S,n:q,o:p,p:j}])=>{var w=[C,F,R,L,_,I,M,Z,A];async function G(e,t){let a=await S("navigation_tool_prompt"),{mapView:r}=x(t),c=r.map.bookmarks?.map(h=>h.name).filter(Boolean)??[],s=e.vectorSearchLayerResults?.length>0?e.vectorSearchLayerResults.map((h,z)=>`${z+1}. layerId=${h.id} | title=${h.title??""} | name=${h.name??""} | score=${h.score.toFixed(2)}`).join(`
3
+ `):"",l=e.vectorSearchFieldResults?.length>0?JSON.stringify(e.vectorSearchFieldResults,null,2):"",i=e.intent==="goToBookmark"&&c.length?`Available bookmarks:
4
+ ${c.map(h=>`- ${h}`).join(`
5
+ `)}`:"",o=(e.intent==="goToLayer"||e.intent==="goToFeatures")&&e.vectorSearchLayerResults?.length?`Candidate layers:
6
+ ${s}`:"",d=e.intent==="goToFeatures"&&e.vectorSearchFieldResults?.length?`Candidate fields:
7
+ ${l}`:"",u={intent:e.intent,bookmarksSection:i,layersSection:o,fieldsSection:d,currentZoom:r.zoom,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},n=await T({promptText:a,modelTier:"fast",config:t,inputVariables:u,tools:w}),g=(n.tool_calls?.length??0)>0,y=typeof n.text=="string"?n.text.trim():"",O=y.length>0;return{...e,navigationInternalState:{...e.navigationInternalState,toolCallMessage:g?n:void 0},outputMessage:g?e.outputMessage:y,status:g?e.status:O?"success":"failed"}}var B=e=>{let t=typeof e=="string"?e:String(e);try{let a=JSON.parse(t);if(a&&typeof a=="object"&&typeof a.text=="string")return a}catch{console.warn("Failed to parse tool response as JSON:",t)}return{text:t}};async function D(e,t){let a=new b(w,{handleToolErrors:!1});try{let r=e.navigationInternalState.toolCallMessage;if(!r)throw new Error("navigationToolCalling: missing navigationInternalState.toolCallMessage");let{messages:c}=await a.invoke({messages:[r]},t),s="",l;for(let i of c){let o=B(i.content);o.text&&(s+=`${o.text}
8
+ `),o.sharedStatePatch&&(l={...l,...o.sharedStatePatch})}return await m({text:`Finished executing navigation tool: ${s}`},t),{...e,outputMessage:s,sharedStatePatch:l,status:"success",summary:s?q(s):"Navigation executed.",navigationInternalState:{...e.navigationInternalState,toolCallMessage:void 0}}}catch(r){let c=r instanceof Error?r.message:String(r);return await m({text:`Navigation tool execution failed: ${c}`},t),{...e,outputMessage:`Navigation tool execution failed: ${c}`,status:"failed",summary:`Navigation tool execution failed: ${c}`,navigationInternalState:{...e.navigationInternalState,toolCallMessage:void 0}}}}async function J(e,t){let a=await S("navigation_intent_prompt"),{mapView:r}=x(t),c=w.map(n=>({name:n.name,description:n.description,schema:n.schema})),s=r.map.bookmarks?.map(n=>n.name).filter(Boolean)??[],l=s.length?`Available bookmarks:
9
+ ${s.map(n=>`- ${n}`).join(`
10
+ `)}`:"No bookmarks are available in this map.",i={tools:c.map(({name:n,description:g,schema:y})=>`${n}: ${g}, ${JSON.stringify(y)}`).join(`
11
+ `),bookmarks:l,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},o=f.object({intent:f.string()}),d=await N({promptText:a,config:t,inputVariables:i,schema:o,modelTier:"fast"}),u=typeof d.intent=="string"?d.intent.trim().replace(/^"|"$/gu,""):"";return{...e,intent:u||""}}var P=.7,W=async(e,t)=>{try{await m({text:`Similarity search to find layers: ${e.agentExecutionContext.assignedTask}`},t);let a=p(t,"layerSearch"),r=p(t,"layersAndFieldsRegistry"),c=p(t,"embeddingCache"),s=(await a.searchLayers({text:e.agentExecutionContext.assignedTask,minScore:P,embeddingCache:c})).map(({id:i,score:o})=>{let d=r.get(i)?.layerItem;return{id:i,title:d?.title,name:d?.name??void 0,score:o}}),l;return s.length>0?l=`Vector search completed. Matching layers:
12
+ ${s.map(i=>`- layerId=${i.id} | title=${i.title??""} | name=${i.name??""} | score=${i.score.toFixed(2)}`).join(`
13
+ `)}`:l="Vector search completed. No matching layers found.",await m({text:l},t),{...e,vectorSearchLayerResults:s}}catch(a){throw await m({text:`Error during vector search layers: ${a instanceof Error?a.message:String(a)}`},t),a}},V=.7,H=10,K=async(e,t)=>{try{await m({text:`Similarity search to find fields: ${e.agentExecutionContext.assignedTask}`},t);let a=p(t,"fieldSearch"),r=p(t,"layersAndFieldsRegistry"),c=p(t,"embeddingCache"),s=e.vectorSearchLayerResults?.map(o=>o.id)??[];if(s.length===0)return await m({text:"No candidate layers for field search"},t),e;let l=(await a.searchFields({text:e.agentExecutionContext.assignedTask,layerIds:s,minScore:V,topResults:H,embeddingCache:c})).map(({layerId:o,results:d})=>{let u=r.get(o)?.fieldRegistry;return{layerId:o,layerName:r.get(o)?.layerItem.name,results:d.map(n=>{let g=u?.get(n.name);return{name:n.name,score:n.score,type:g?.type,alias:g?.alias,description:g?.description,statistics:g?.statistics}})}}),i;return l.length>0?i=`Vector search completed. Matching layers and fields:
14
+ ${l.map(o=>`${o.layerName??o.layerId}:
15
+ ${o.results.map(d=>` - ${d.name} (${d.score.toFixed(2)})`).join(`
16
+ `)}`).join(`
17
+ `)}`:i=`No vector search field results found for score over ${V}.`,await m({text:i},t),{...e,vectorSearchFieldResults:l}}catch(a){throw await m({text:`Error during vector search fields: ${a instanceof Error?a.message:String(a)}`},t),a}},Q=(e,t)=>j(["layerSearch","layersAndFieldsRegistry"],"Navigation Agent")(e,t),U=()=>new $(v).addNode("requireNavigationServices",Q).addNode("intentLLM",J).addNode("vectorSearchLayers",W).addNode("vectorSearchFields",K).addNode("agent",G).addNode("tools",D).addEdge(k,"requireNavigationServices").addEdge("requireNavigationServices","intentLLM").addConditionalEdges("intentLLM",e=>e.intent==="goToLayer"||e.intent==="goToFeatures"?"vectorSearchLayers":"agent",{vectorSearchLayers:"vectorSearchLayers",agent:"agent"}).addConditionalEdges("vectorSearchLayers",e=>e.intent==="goToFeatures"?"vectorSearchFields":"agent",{vectorSearchFields:"vectorSearchFields",agent:"agent"}).addEdge("vectorSearchFields","agent").addEdge("agent","tools").addEdge("tools",E),X=String.raw`- **navigation** — Enables users to interact with the map by navigating to specific locations, layers, features, or extents.
18
+ This includes zooming, panning, centering, or geocoding based on user input. The agent is designed to handle explicit map movement requests. NOTE: DO NOT call this agent if the user asks "show me...", that is meant to be handled by another agent. If the query is about where a certain address is, call this agent.
19
+
20
+ Supported actions:
21
+ - **Zooming**: Adjust the map's zoom level (e.g., "Zoom to level 10", "Zoom in").
22
+ - **Viewpoints**: Navigate to a specific center point with optional zoom or scale (e.g., "Center the map on San Francisco at zoom level 16").
23
+ - **Scales**: Set the map to a specific scale (e.g., "Set the map scale to 1:50,000").
24
+ - **Layers**: Zoom to the full extent of a specific layer (e.g., "Go to the water mains layer"). For the purposes of link charts, if the user requests to go to the extent of a link chart or the entities/nodes within it, that should be treated as a request to use the goToLayer tool on the link chart layer
25
+ - **Features**: Zoom to features in a layer that match a filter (e.g., "Zoom to all schools in the city").
26
+ - **Bookmarks**: Navigate to a predefined bookmark extent (e.g., "Go to the Downtown bookmark").
27
+ - **Extents**: Reset to the initial web map extent or zoom to the full world extent (e.g., "Reset the map", "Zoom to the full world extent").
28
+ - **Addresses**: Zoom to an address or place name (e.g., "Zoom to 1600 Pennsylvania Ave").
29
+
30
+ _Example: “Zoom to Texas”_
31
+ _Example: “Go to the water mains layer”_
32
+ _Example: “Zoom to to the extent of my link chart”_
33
+ _Example: “Center the map on San Francisco at scale 50000”_
34
+ _Example: “Zoom to the features in the schools layer where city = 'Austin'”_
35
+ _Example: “Go to the Downtown bookmark”_
36
+ _Example: “Where is Mount Rainier?”_`,ue={id:"navigation",name:"Navigation Agent",description:X,createGraph:U,workspace:v};return ue},"identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request",a,b)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import c from"./KTOL6IN7.js";import b from"./ICA7JOSU.js";import a from"./EBRNMPPO.js";import{c as s,d as n}from"./W2JAKE2M.js";import"./5W7S2RS4.js";import"./NXKKG5TK.js";import{v as r,z as o}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(([,,,,,,,,,{fetchKnowledgeGraph:p},,,a])=>{var i=class extends r{constructor(){super(...arguments),this.agent=a}static{this.properties={referenceElement:1,serviceUrl:3,context:0}}#e;#i;#t;#r;get serviceUrl(){return this.#i}set serviceUrl(t){this.#i=t}async getContext(){let t=this.context?{...this.context,knowledgeGraph:void 0,view:void 0}:{};if(this.#e)return{...t,view:this.#e};if(this.#t)try{let e=await this.#t;return{...t,knowledgeGraph:e}}catch(e){console.error("Failed to load knowledge graph via service URL:",e)}if(!this.context?.knowledgeGraph&&!this.context?.view)throw new Error("arcgis-assistant-knowledge-agent requires either a knowledgeGraph or view in context, and neither were provided");return this.context}willUpdate(t){t.has("serviceUrl")&&this.serviceUrl?this.#t=p(this.serviceUrl):this.#t=void 0}load(){this.#e=n(this)??void 0,this.#r=s(this)}disconnectedCallback(){this.#r?.unregister(this.agent.id),super.disconnectedCallback()}};o("arcgis-assistant-knowledge-agent",i);return i},"identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/knowledgeGraphService",a,b,c)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import a from"./RHF452M7.js";import"./3S7PBYVD.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)
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"./RHF452M7.js";import"./3S7PBYVD.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)
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};