@arcgis/ai-components 5.2.0-next.16 → 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.
Files changed (105) 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/types.d.ts +12 -12
  4. package/dist/cdn/27NEUQN3.js +2 -0
  5. package/dist/cdn/{IR7PTESF.js → 2NMR43NW.js} +1 -1
  6. package/dist/cdn/4I4MCV7V.js +71 -0
  7. package/dist/cdn/{P7DG5T3Z.js → 4RZPOYZ7.js} +1 -1
  8. package/dist/cdn/5SBLS4NW.js +2 -0
  9. package/dist/cdn/{BX7FSMUU.js → 6LZ6GOHF.js} +1 -1
  10. package/dist/cdn/{K3JCH4XW.js → C7E7MJSR.js} +1 -1
  11. package/dist/cdn/{JIWK6QK6.js → CIW3QMKV.js} +1 -1
  12. package/dist/cdn/{DHKUXLU3.js → CJIV4KJZ.js} +1 -1
  13. package/dist/cdn/CVHJMR5X.js +2 -0
  14. package/dist/cdn/ETD76QRC.js +14 -0
  15. package/dist/cdn/FC2ZX3SS.js +2 -0
  16. package/dist/cdn/{4UDYY3HL.js → HOCTVCHH.js} +1 -1
  17. package/dist/cdn/I64KIZG3.js +2 -0
  18. package/dist/cdn/{S75VFYR4.js → I76F57I2.js} +19 -18
  19. package/dist/cdn/IB4WTK74.js +2 -0
  20. package/dist/cdn/{3JGWGKT6.js → IC5P5NYY.js} +1 -1
  21. package/dist/cdn/{QYR3NSF2.js → IDZTJLVN.js} +2 -2
  22. package/dist/cdn/IW43UAIS.js +3 -0
  23. package/dist/cdn/{22IT5TDB.js → JBNITHPO.js} +5 -5
  24. package/dist/cdn/{7CYGX4F4.js → JEIMRNYM.js} +1 -1
  25. package/dist/cdn/K37GTMOF.js +18 -0
  26. package/dist/cdn/{NE7E52YR.js → KTK4HNL2.js} +8 -2
  27. package/dist/cdn/{TR4GFL7X.js → L77BTGXY.js} +1 -1
  28. package/dist/cdn/{XOH56EQ2.js → LODKJRS4.js} +1 -1
  29. package/dist/cdn/LSNMNSYS.js +2 -0
  30. package/dist/cdn/NNC3UYMR.js +2 -0
  31. package/dist/cdn/NOJYPREL.js +3 -0
  32. package/dist/cdn/{Q6LRANX6.js → O3F47IO5.js} +1 -1
  33. package/dist/cdn/{O3RFFPU3.js → O7TGCM5P.js} +1 -1
  34. package/dist/cdn/PBTINZTK.js +65 -0
  35. package/dist/cdn/PSWI3MFB.js +2 -0
  36. package/dist/cdn/RNLQZV6U.js +36 -0
  37. package/dist/cdn/RX45PCYB.js +9 -0
  38. package/dist/cdn/SLNLQG3A.js +2 -0
  39. package/dist/cdn/{X4XY5HIE.js → SMADRJ67.js} +1 -1
  40. package/dist/cdn/{GBYLKQIL.js → T7CQZ27H.js} +1 -1
  41. package/dist/cdn/UNFG4ZJ5.js +3 -0
  42. package/dist/cdn/V6TM3MTN.js +22 -0
  43. package/dist/cdn/{IOD3GDA7.js → VKU4WAQV.js} +1 -1
  44. package/dist/cdn/{RUURNLTP.js → W2JAKE2M.js} +1 -1
  45. package/dist/cdn/{3VOQD2MR.js → WAVKMZA6.js} +1 -1
  46. package/dist/cdn/WQQRLD5F.js +2 -0
  47. package/dist/cdn/XAI6OR2N.js +2 -0
  48. package/dist/cdn/{DXVU45KM.js → XVQJBUMY.js} +1 -1
  49. package/dist/cdn/YJ3QQXF6.js +2 -0
  50. package/dist/cdn/{DQSEBKOX.js → YYY7HKYX.js} +1 -1
  51. package/dist/cdn/agent-utils/index.js +1 -1
  52. package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +1 -1
  53. package/dist/cdn/agent-utils/middlewares/middleware.js +1 -1
  54. package/dist/cdn/agent-utils/middlewares/trace.js +1 -1
  55. package/dist/cdn/index.js +1 -1
  56. package/dist/chunks/converterUtils.js +39 -32
  57. package/dist/chunks/dataExplorationGraph.js +12 -10
  58. package/dist/chunks/helpGraph.js +8 -8
  59. package/dist/chunks/help_prompt.js +34 -17
  60. package/dist/chunks/navigationGraph.js +4 -4
  61. package/dist/chunks/navigation_intent_prompt.js +8 -2
  62. package/dist/chunks/state.js +1 -1
  63. package/dist/chunks/utils2.js +8 -8
  64. package/dist/components/arcgis-assistant/customElement.d.ts +7 -0
  65. package/dist/components/arcgis-assistant/customElement.js +301 -181
  66. package/dist/components/arcgis-assistant-agent/customElement.js +5 -1
  67. package/dist/components/arcgis-assistant-chat/customElement.js +22 -17
  68. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +9 -5
  69. package/dist/components/arcgis-assistant-help-agent/customElement.js +6 -2
  70. package/dist/components/arcgis-assistant-interrupt/customElement.js +4 -4
  71. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +16 -12
  72. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +8 -4
  73. package/dist/components/arcgis-assistant-message-block/customElement.js +1 -1
  74. package/dist/components/arcgis-assistant-message-text/customElement.d.ts +1 -0
  75. package/dist/components/arcgis-assistant-message-text/customElement.js +12 -12
  76. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +9 -5
  77. package/dist/components/arcgis-assistant-user-message/customElement.js +10 -8
  78. package/dist/docs/api.json +1 -1
  79. package/dist/docs/docs.json +1 -1
  80. package/dist/docs/vscode.html-custom-data.json +1 -1
  81. package/dist/docs/web-types.json +1 -1
  82. package/dist/loader.js +2 -2
  83. package/dist/types/lumina.d.ts +2 -2
  84. package/dist/types/preact.d.ts +2 -2
  85. package/dist/types/react.d.ts +2 -2
  86. package/dist/types/stencil.d.ts +2 -2
  87. package/dist/utils/index.d.ts +1 -2
  88. package/package.json +4 -4
  89. package/dist/cdn/7PANDHIL.js +0 -16
  90. package/dist/cdn/CE6VDP2D.js +0 -72
  91. package/dist/cdn/CI3QSFPS.js +0 -2
  92. package/dist/cdn/F2AHA4GB.js +0 -54
  93. package/dist/cdn/FUIGPHBH.js +0 -2
  94. package/dist/cdn/GPYYAQVI.js +0 -2
  95. package/dist/cdn/I2Y67HBL.js +0 -14
  96. package/dist/cdn/JG2BIENI.js +0 -3
  97. package/dist/cdn/K475UT3E.js +0 -2
  98. package/dist/cdn/L4XF4H6V.js +0 -36
  99. package/dist/cdn/PB2ODJC7.js +0 -2
  100. package/dist/cdn/SBHLUL3Q.js +0 -2
  101. package/dist/cdn/XBW4MWQR.js +0 -2
  102. package/dist/cdn/XU6NCSE2.js +0 -22
  103. package/dist/cdn/Z7UWJ4AI.js +0 -3
  104. package/dist/orchestrator/registry/agentRegistry.d.ts +0 -33
  105. /package/dist/cdn/{CHPQM77M.js → IKEF7ZHH.js} +0 -0
@@ -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
  };
@@ -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"./XOH56EQ2.js";import a from"./TR4GFL7X.js";import{b as m,c as f}from"./FUIGPHBH.js";import{u as p}from"./DHKUXLU3.js";import"./CHPQM77M.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,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};
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{Ra as i}from"./CHPQM77M.js";async function n(a,t,e){if(e===void 0)throw new Error(["Unable to dispatch a custom event without a parent run id.",'"dispatchCustomEvent" can only be called from within an existing run (e.g.,',"inside a tool or a RunnableLambda).",`
2
+ import{Ra as i}from"./IKEF7ZHH.js";async function n(a,t,e){if(e===void 0)throw new Error(["Unable to dispatch a custom event without a parent run id.",'"dispatchCustomEvent" can only be called from within an existing run (e.g.,',"inside a tool or a RunnableLambda).",`
3
3
 
4
4
  If you continue to see this error, please import from "@langchain/core/callbacks/dispatch/web"`,"and explicitly pass in a config parameter.",`
5
5
 
@@ -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,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{D as Je,M as Ve,Q as Tt,a as rt,b as S,f as $,j,k as F,la as ee,ma as Ze,na as W,oa as bt,qa as ve,ra as fe,sa as Ce,t as st,ta as _t,u as at}from"./DHKUXLU3.js";import{Ba as ze,D as $e,Db as q,Eb as Te,Gb as gt,Jb as be,Lb as wt,Ob as a,P as M,Pa as We,Qb as He,Sa as H,Sb as _e,Ta as de,U as it,Va as ct,Wa as dt,Wb as me,Xb as Z,Ya as Fe,Z as w,_a as ut,_b as ae,aa as Ue,ac as xe,ja as K,jb as ue,kb as ye,na as Be,nb as Me,nc as Ge,oa as B,pc as yt,rb as ft,tb as pt,tc as Mt,ua as lt,ub as Q,vb as ht}from"./CHPQM77M.js";import{Dd as z,s as mt}from"./ZEYIBYSF.js";var Ye=Symbol.for("AgentMiddleware");function A(e){return{[Ye]:!0,name:e.name,stateSchema:e.stateSchema,contextSchema:e.contextSchema,wrapToolCall:e.wrapToolCall,wrapModelCall:e.wrapModelCall,beforeAgent:e.beforeAgent,beforeModel:e.beforeModel,afterModel:e.afterModel,afterAgent:e.afterAgent,tools:e.tools}}var Se=class extends Error{constructor(){super("The provided LLM already has bound tools. Please provide an LLM without bound tools to createAgent. The agent will bind the tools provided in the 'tools' parameter.")}},ke=class extends Error{toolNames;constructor(e){super(`The model has called multiple tools: ${e.join(", ")} to return a structured output. This is not supported. Please provide a single structured output.`),this.toolNames=e}},Ke=class extends Error{toolName;errors;constructor(e,t){super(`Failed to parse structured output for tool '${e}':${t.map(n=>`
2
+ import{D as Je,M as Ve,Q as Tt,a as rt,b as S,f as $,j,k as F,la as ee,ma as Ze,na as W,oa as bt,qa as ve,ra as fe,sa as Ce,t as st,ta as _t,u as at}from"./CJIV4KJZ.js";import{Ba as ze,D as $e,Db as q,Eb as Te,Gb as gt,Jb as be,Lb as wt,Ob as a,P as M,Pa as We,Qb as He,Sa as H,Sb as _e,Ta as de,U as it,Va as ct,Wa as dt,Wb as me,Xb as Z,Ya as Fe,Z as w,_a as ut,_b as ae,aa as Ue,ac as xe,ja as K,jb as ue,kb as ye,na as Be,nb as Me,nc as Ge,oa as B,pc as yt,rb as ft,tb as pt,tc as Mt,ua as lt,ub as Q,vb as ht}from"./IKEF7ZHH.js";import{Dd as z,s as mt}from"./ZEYIBYSF.js";var Ye=Symbol.for("AgentMiddleware");function A(e){return{[Ye]:!0,name:e.name,stateSchema:e.stateSchema,contextSchema:e.contextSchema,wrapToolCall:e.wrapToolCall,wrapModelCall:e.wrapModelCall,beforeAgent:e.beforeAgent,beforeModel:e.beforeModel,afterModel:e.afterModel,afterAgent:e.afterAgent,tools:e.tools}}var Se=class extends Error{constructor(){super("The provided LLM already has bound tools. Please provide an LLM without bound tools to createAgent. The agent will bind the tools provided in the 'tools' parameter.")}},ke=class extends Error{toolNames;constructor(e){super(`The model has called multiple tools: ${e.join(", ")} to return a structured output. This is not supported. Please provide a single structured output.`),this.toolNames=e}},Ke=class extends Error{toolName;errors;constructor(e,t){super(`Failed to parse structured output for tool '${e}':${t.map(n=>`
3
3
  - ${n}`).join("")}.`),this.toolName=e,this.errors=t}},Ee=class extends Error{toolCall;toolError;constructor(e,t){let n=e instanceof Error?e:new Error(String(e)),o=JSON.stringify(t.args);super(`Error invoking tool '${t.name}' with kwargs ${o} with error: ${n.stack}
4
4
  Please fix the error and try again.`),this.toolCall=t,this.toolError=n}},pe=class xt extends Error{static"~brand"="MiddlewareError";constructor(t,n){let o=t instanceof Error?t.message:String(t);super(o),this.name=t instanceof Error?t.name:`${n[0].toUpperCase()+n.slice(1)}Error`,t instanceof Error&&(this.cause=t)}static wrap(t,n){return st(t)?t:new xt(t,n)}static isInstance(t){return t instanceof Error&&"~brand"in t&&t["~brand"]==="MiddlewareError"}};function he(e){return"invoke"in e&&typeof e.invoke=="function"&&"_streamResponseChunks"in e}function ie(e){return typeof e=="object"&&e!=null&&"_queuedMethodOperations"in e&&"_getModelInstance"in e&&typeof e._getModelInstance=="function"}var vt=!0,ao=0,J=class qe{constructor(t,n,o){this.schema=t,this.tool=n,this.options=o}get name(){return this.tool.function.name}static fromSchema(t,n){function o(s){return s??`extract-${++ao}`}if(ue(t)||Me(t)){let s=_e(t);return new qe(s,{type:"function",function:{name:o(s.title),strict:!1,description:s.description??"Tool for extracting structured output from the model's response.",parameters:s}},n)}let r;return typeof t.name=="string"&&typeof t.parameters=="object"&&t.parameters!=null?r=t:r={name:o(t.title),description:t.description??"",parameters:t.schema||t},new qe(_e(t),{type:"function",function:r},n)}parse(t){let n=new He(this.schema).validate(t);if(!n.valid)throw new Ke(this.name,n.errors.map(o=>o.error));return t}},te=class Ct{_schemaType;schema;strict;constructor(t,n){if("schema"in t&&typeof t.schema=="object"&&t.schema!==null&&!("type"in t)){let o=t;this.schema=o.schema,this.strict=o.strict??vt}else this.schema=t,this.strict=n??vt}static fromSchema(t,n){return new Ct(_e(t),n)}parse(t){let n;if(typeof t.content=="string")n=t.content;else if(Array.isArray(t.content)){for(let o of t.content)if(typeof o=="object"&&o!==null&&"type"in o&&o.type==="text"&&"text"in o&&typeof o.text=="string"){n=o.text;break}}if(!(!n||n===""))try{let o=JSON.parse(n);return new He(this.schema).validate(o).valid?o:void 0}catch{}}};function St(e,t,n){if(!e)return[];if(typeof e=="object"&&e!==null&&"__responseFormatUndefined"in e)return[];if(Array.isArray(e)){if(e.every(r=>r instanceof J||r instanceof te))return e;if(e.every(r=>ue(r)))return e.map(r=>J.fromSchema(r,t));if(e.every(r=>q(r)))return e.map(r=>J.fromSchema(r,t));if(e.every(r=>typeof r=="object"&&r!==null&&!q(r)&&!ue(r)))return e.map(r=>J.fromSchema(r,t));throw new Error(`Invalid response format: list contains mixed types.
5
5
  All items must be either InteropZodObject, Standard Schema, or plain JSON schema objects.`)}if(e instanceof J||e instanceof te)return[e];let o=io(n);if(ue(e))return o?[te.fromSchema(e)]:[J.fromSchema(e,t)];if(q(e))return o?[te.fromSchema(e)]:[J.fromSchema(e,t)];if(typeof e=="object"&&e!==null&&"properties"in e)return o?[te.fromSchema(e)]:[J.fromSchema(e,t)];throw new Error(`Invalid response format: ${String(e)}`)}function io(e){return!e||!he(e)||!("profile"in e)||typeof e.profile!="object"||!e.profile?!1:"structuredOutput"in e.profile&&e.profile.structuredOutput===!0}var Xe=Symbol.for("langgraph-zod");Xe in globalThis||(globalThis[Xe]=new WeakSet);function kt(e){let t=globalThis[Xe];t.has(e)||(Object.defineProperty(e,"langgraph",{get(){let n=this;return{metadata(o){return Ce(n,{jsonSchemaExtra:o})},reducer(o,r){return Ce(n,{default:be(n),reducer:{schema:r,fn:o}})}}}}),t.add(e))}try{kt(a.ZodType.prototype),kt(z.ZodType.prototype)}catch(e){throw new Error("Failed to extend Zod with LangGraph-related methods. This is most likely a bug, consider opening an issue and/or using `withLangGraph` to augment your Zod schema.",{cause:e})}var Et=class extends mt{constructor(e){super(),this.parent=e,this._map=this.parent._map}add(e,...t){let n=t[0];if(n&&!n?.default){let o=be(e);o!=null&&(n.default=o)}return super.add(e,...t)}},lo=new Et(fe);function It(e=!0,t,n=[]){let o={jumpTo:new Ze},r={},s={},i=l=>{if(W.isInstance(l)){for(let[c,d]of Object.entries(l.fields))if(!(c in o)){if(o[c]=d,c.startsWith("_"))continue;ee.isInstance(d)?(r[c]=d.inputSchema||d.valueSchema,s[c]=d.valueSchema):(r[c]=d,s[c]=d)}return}let u=Te(l);for(let[c,d]of Object.entries(u)){let g=c.startsWith("_");if(!(c in o)){if(ye(d)){let p=fe.get(d);if(p?.reducer){p.reducer.schema?(o[c]=new ee(d,{inputSchema:p.reducer.schema,reducer:p.reducer.fn}),g||(r[c]=p.reducer.schema,s[c]=d)):(o[c]=new ee(d,{reducer:p.reducer.fn}),g||(r[c]=d,s[c]=d));continue}}o[c]=d,g||(r[c]=d,s[c]=d)}}};t&&(W.isInstance(t)||q(t))&&i(t);for(let l of n)l.stateSchema&&(W.isInstance(l.stateSchema)||q(l.stateSchema))&&i(l.stateSchema);return e&&(s.structuredResponse=new Ze),{state:new W({messages:ve,...o}),input:new W({messages:ve,...r}),output:new W({messages:ve,...s})}}var Qe=/<name>(.*?)<\/name>/s,et=/<content>(.*?)<\/content>/s;function co(e,t){if(W.isInstance(e)){let n={};for(let o of Object.keys(e.fields))o in t&&(n[o]=t[o]);return n}if(Me(e))return Q(e,t);throw new Error(`Invalid state schema type: ${typeof e}`)}function Rt(e){if(!w.isInstance(e)||Ue.isInstance(e)||!e.name)return e;let{name:t}=e;if(typeof e.content=="string")return new w({...e.lc_kwargs,content:`<name>${t}</name><content>${e.content}</content>`,name:void 0});let n=[],o=0;for(let r of e.content)typeof r=="string"?(o+=1,n.push(`<name>${t}</name><content>${r}</content>`)):typeof r=="object"&&"type"in r&&r.type==="text"?(o+=1,n.push({...r,text:`<name>${t}</name><content>${r.text}</content>`})):n.push(r);return o||n.unshift({type:"text",text:`<name>${t}</name><content></content>`}),new w({...e.lc_kwargs,content:n,name:void 0})}function Ot(e){if(!w.isInstance(e)||!e.content)return e;let t=[],n;if(Array.isArray(e.content))t=e.content.filter(o=>{if(o.type==="text"&&typeof o.text=="string"){let r=o.text.match(Qe),s=o.text.match(et);return r&&(!s||s[1]==="")?(n=r[1],!1):!0}return!0}).map(o=>{if(o.type==="text"&&typeof o.text=="string"){let r=o.text.match(Qe),s=o.text.match(et);return!r||!s?o:(n=r[1],{...o,text:s[1]})}return o});else{let o=e.content,r=o.match(Qe),s=o.match(et);if(!r||!s)return e;n=r[1],t=s[1]}return new w({...Object.keys(e.lc_kwargs??{}).length>0?e.lc_kwargs:e,content:t,name:n})}function re(e){return me.isRunnable(e)}function At(e){return he(e)?"bindTools"in e&&typeof e.bindTools=="function":!1}var tt=(e,t,n={})=>{if(At(e))return e.bindTools(t,n);if(Z.isRunnableBinding(e)&&At(e.bound)){let o=e.bound.bindTools(t,n);return Z.isRunnableBinding(o)?new Z({bound:o.bound,config:{...e.config,...o.config},kwargs:{...e.kwargs,...o.kwargs},configFactories:o.configFactories??e.configFactories}):new Z({bound:o,config:e.config,kwargs:e.kwargs,configFactories:e.configFactories})}return null};function Ie(e){if(typeof e=="function")return;let t=e;if(ae.isRunnableSequence(t)&&(t=t.steps.find(n=>Z.isRunnableBinding(n))||t),!ie(t)){if(Z.isRunnableBinding(t)){let n=t.kwargs!=null&&typeof t.kwargs=="object"&&"tools"in t.kwargs&&Array.isArray(t.kwargs.tools)&&t.kwargs.tools.length>0,o=t.config!=null&&typeof t.config=="object"&&"tools"in t.config&&Array.isArray(t.config.tools)&&t.config.tools.length>0;if(n||o)throw new Se}if("tools"in t&&t.tools!==void 0&&Array.isArray(t.tools)&&t.tools.length>0)throw new Se}}function le(e){return!!(w.isInstance(e)&&e.tool_calls&&e.tool_calls.length>0)}function Nt(e){if(e==null)return new B("");if(B.isInstance(e))return e;if(typeof e=="string")return new B({content:[{type:"text",text:e}]});throw new Error(`Invalid systemPrompt type: expected string or SystemMessage, got ${typeof e}`)}async function jt(e,t,n={}){let o=tt(e,t,n);if(o)return o;if(ie(e)){let r=tt(await e._getModelInstance(),t,n);if(r)return r}if(ae.isRunnableSequence(e)){let r=e.steps.findIndex(s=>Z.isRunnableBinding(s)||he(s)||ie(s));if(r>=0){let s=tt(e.steps[r],t,n);if(s){let i=e.steps.slice();return i.splice(r,1,s),ae.from(i)}}}throw new Error(`llm ${e} must define bindTools method.`)}function uo(e){if(e.length===0)return;if(e.length===1)return e[0];function t(o,r){return async(s,i)=>o(s,async u=>r(u,i))}let n=e[e.length-1];for(let o=e.length-2;o>=0;o--)n=t(e[o],n);return n}function Pt(e){let t=e.filter(n=>n.wrapToolCall);if(t.length!==0)return uo(t.map(n=>{let o=n.wrapToolCall;return async(s,i)=>{let l=s.state,u=async c=>{let d={...l,...c.state};return i({...c,state:d})};try{let c=await o({...s,state:{messages:l.messages,...n.stateSchema?co(n.stateSchema,{...l}):{}}},u);if(!M.isInstance(c)&&!F(c))throw new Error(`Invalid response from "wrapToolCall" in middleware "${n.name}": expected ToolMessage or Command, got ${typeof c}`);return c}catch(c){throw pe.wrap(c,n.name)}}}))}async function Lt(e,t){let n={};for(let o of e){if(!o.stateSchema)continue;let r=o.stateSchema;if(W.isInstance(o.stateSchema)){let l={};for(let[u,c]of Object.entries(o.stateSchema.fields))ee.isInstance(c)?l[u]=c.inputSchema||c.valueSchema:l[u]=c;r=z.object(l)}let s=await ft(wt(r,l=>l.startsWith("_")),t);if(s.success){Object.assign(n,s.data);continue}let i=s.error.issues.filter(l=>l.code==="invalid_type").map(l=>` - ${l.path.join(".")}: Required`).join(`
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import a from"./3VOQD2MR.js";import"./FUIGPHBH.js";import"./DHKUXLU3.js";import"./CHPQM77M.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"./3VOQD2MR.js";import"./FUIGPHBH.js";import"./DHKUXLU3.js";import"./CHPQM77M.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)