@arcgis/ai-components 5.2.0-next.1 → 5.2.0-next.11

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 (162) hide show
  1. package/dist/agent-utils/FunctionAgent.d.ts +2 -2
  2. package/dist/agent-utils/LLMAgent.d.ts +2 -2
  3. package/dist/agent-utils/LLMAgent.js +22 -22
  4. package/dist/agent-utils/WorkflowAgent.d.ts +2 -2
  5. package/dist/agent-utils/index.d.ts +99 -0
  6. package/dist/agent-utils/index.js +148 -0
  7. package/dist/agent-utils/middlewares/trace.js +25 -33
  8. package/dist/agent-utils/tools/FunctionTool.d.ts +2 -2
  9. package/dist/agent-utils/types.d.ts +30 -1
  10. package/dist/agent-utils/workflows/ConditionalWorkflow.d.ts +2 -2
  11. package/dist/agent-utils/workflows/LoopWorkflow.d.ts +2 -2
  12. package/dist/agent-utils/workflows/ParallelWorkflow.d.ts +2 -2
  13. package/dist/agent-utils/workflows/RouterWorkflow.d.ts +2 -2
  14. package/dist/agent-utils/workflows/SequentialWorkflow.d.ts +2 -2
  15. package/dist/agent-utils/workflows/SwitchWorkflow.d.ts +2 -2
  16. package/dist/cdn/{V2P4AIGG.js → 24QNMEFG.js} +1 -1
  17. package/dist/cdn/{NAUXSHIE.js → 34SG44C3.js} +2 -2
  18. package/dist/cdn/3JGWGKT6.js +2 -0
  19. package/dist/cdn/3NBDVZ2I.js +2 -0
  20. package/dist/cdn/3VOQD2MR.js +2 -0
  21. package/dist/cdn/434TAA3J.js +2 -0
  22. package/dist/cdn/53NTYC4I.js +2 -0
  23. package/dist/cdn/{4HU7735A.js → 5CV7R5IS.js} +6 -4
  24. package/dist/cdn/{AMP6IALT.js → 5W7S2RS4.js} +1 -1
  25. package/dist/cdn/{FL4W4VYN.js → 6ZW7Z36F.js} +16 -0
  26. package/dist/cdn/7CYGX4F4.js +2 -0
  27. package/dist/cdn/{DHOVCT6R.js → AZGGTNA3.js} +1 -1
  28. package/dist/cdn/B7WJFBOZ.js +2 -0
  29. package/dist/cdn/BX7FSMUU.js +56 -0
  30. package/dist/cdn/CHPQM77M.js +181 -0
  31. package/dist/cdn/DHKUXLU3.js +179 -0
  32. package/dist/cdn/DQSEBKOX.js +2 -0
  33. package/dist/cdn/DXVU45KM.js +2 -0
  34. package/dist/cdn/{P6OPJQMC.js → DZ2QWNUA.js} +1 -1
  35. package/dist/cdn/EBISDZ5H.js +2 -0
  36. package/dist/cdn/{MDVYQQUG.js → ERL2CB2Y.js} +5 -5
  37. package/dist/cdn/F6QHMKF5.js +2 -0
  38. package/dist/cdn/FUIGPHBH.js +2 -0
  39. package/dist/cdn/{AO7BQHKC.js → H2CHHGGH.js} +1 -1
  40. package/dist/cdn/{OH64RMOR.js → HWKDNS4K.js} +2 -2
  41. package/dist/cdn/IMQ4TVHF.js +16 -0
  42. package/dist/cdn/IOD3GDA7.js +2 -0
  43. package/dist/cdn/IR7PTESF.js +2 -0
  44. package/dist/cdn/IRZDTYO2.js +2 -0
  45. package/dist/cdn/JIWK6QK6.js +2 -0
  46. package/dist/cdn/{S6W6HV4T.js → JLKGS6Y5.js} +12 -12
  47. package/dist/cdn/K3JCH4XW.js +2 -0
  48. package/dist/cdn/KHXUWZHB.js +2 -0
  49. package/dist/cdn/LIFK3QSD.js +2 -0
  50. package/dist/cdn/NXKKG5TK.js +2 -0
  51. package/dist/cdn/{FX5JFRDL.js → O3EN27N5.js} +1 -1
  52. package/dist/cdn/O3RFFPU3.js +6 -0
  53. package/dist/cdn/P7DG5T3Z.js +9 -0
  54. package/dist/cdn/PBO6FZN6.js +2 -0
  55. package/dist/cdn/Q3ZW4FYA.js +3 -0
  56. package/dist/cdn/Q6LRANX6.js +2 -0
  57. package/dist/cdn/Q7TL5Q5N.js +2 -0
  58. package/dist/cdn/QCSN44H4.js +2 -0
  59. package/dist/cdn/R56X6ZKR.js +161 -0
  60. package/dist/cdn/{HB5A5R2E.js → RUURNLTP.js} +1 -1
  61. package/dist/cdn/T43LEBBE.js +47 -0
  62. package/dist/cdn/{ZLXN7NMF.js → T537PKP4.js} +9 -7
  63. package/dist/cdn/TR4GFL7X.js +2 -0
  64. package/dist/cdn/{3PKJWIC3.js → UPEEHMSY.js} +1 -1
  65. package/dist/cdn/WAIFKDR3.js +2 -0
  66. package/dist/cdn/WNS5ZUF5.js +2 -0
  67. package/dist/cdn/X4XY5HIE.js +2 -0
  68. package/dist/cdn/XOH56EQ2.js +2 -0
  69. package/dist/cdn/XON27U6U.js +2 -0
  70. package/dist/cdn/{H7422XUG.js → YLN2BZ5J.js} +1 -1
  71. package/dist/cdn/{2AXF774U.js → YUKR4AZW.js} +1 -1
  72. package/dist/cdn/{JY6LLOUJ.js → Z2G7MP5L.js} +3 -3
  73. package/dist/cdn/ZEYIBYSF.js +66 -0
  74. package/dist/cdn/agent-utils/index.js +2 -0
  75. package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +3 -0
  76. package/dist/cdn/agent-utils/middlewares/middleware.js +2 -0
  77. package/dist/cdn/agent-utils/middlewares/trace.js +2 -0
  78. package/dist/cdn/index.js +1 -1
  79. package/dist/cdn/main.css +1 -1
  80. package/dist/chunks/adapter.js +1390 -1323
  81. package/dist/chunks/arcgisKnowledgeGraph.js +109 -72
  82. package/dist/chunks/dataExplorationGraph.js +108 -96
  83. package/dist/chunks/generateLayerDescriptions.js +206 -168
  84. package/dist/chunks/helpGraph.js +16 -13
  85. package/dist/chunks/index.js +11 -0
  86. package/dist/chunks/intent_prompt.js +16 -0
  87. package/dist/chunks/layerStylingGraph.js +23 -20
  88. package/dist/chunks/navigationGraph.js +34 -30
  89. package/dist/chunks/orchestrator.js +241 -201
  90. package/dist/chunks/slottableRequestUtils.js +3 -7
  91. package/dist/chunks/summarize_query_response_prompt.js +9 -7
  92. package/dist/chunks/toolCallResponse.js +5 -3
  93. package/dist/components/arcgis-assistant/customElement.d.ts +15 -0
  94. package/dist/components/arcgis-assistant/customElement.js +228 -127
  95. package/dist/components/arcgis-assistant/index.js +2 -3
  96. package/dist/components/arcgis-assistant/types.d.ts +14 -1
  97. package/dist/components/arcgis-assistant-chat/customElement.d.ts +8 -2
  98. package/dist/components/arcgis-assistant-chat/customElement.js +7 -7
  99. package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +4 -1
  100. package/dist/components/arcgis-assistant-chat-entry/customElement.js +25 -18
  101. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +1 -0
  102. package/dist/components/arcgis-assistant-help-agent/customElement.js +1 -0
  103. package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +4 -1
  104. package/dist/components/arcgis-assistant-interrupt/customElement.js +13 -9
  105. package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +20 -0
  106. package/dist/components/arcgis-assistant-interrupt-preview/index.js +2 -0
  107. package/dist/components/arcgis-assistant-knowledge-agent/customElement.d.ts +7 -7
  108. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +1 -0
  109. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -0
  110. package/dist/components/arcgis-assistant-message/customElement.d.ts +23 -0
  111. package/dist/components/arcgis-assistant-message/customElement.js +28 -26
  112. package/dist/components/arcgis-assistant-message/index.d.ts +1 -0
  113. package/dist/components/arcgis-assistant-message/index.js +2 -0
  114. package/dist/components/arcgis-assistant-message-block/customElement.d.ts +1 -1
  115. package/dist/components/arcgis-assistant-message-block/customElement.js +18 -11
  116. package/dist/components/arcgis-assistant-message-block/index.js +1 -0
  117. package/dist/components/arcgis-assistant-message-feedback/customElement.d.ts +4 -1
  118. package/dist/components/arcgis-assistant-message-footer/customElement.d.ts +4 -1
  119. package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +8 -1
  120. package/dist/components/arcgis-assistant-message-loading/customElement.js +8 -8
  121. package/dist/components/arcgis-assistant-message-loading/index.js +1 -0
  122. package/dist/components/arcgis-assistant-message-log/customElement.d.ts +4 -1
  123. package/dist/components/arcgis-assistant-message-read-aloud/customElement.d.ts +4 -1
  124. package/dist/components/arcgis-assistant-message-text/customElement.d.ts +4 -1
  125. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +1 -0
  126. package/dist/components/arcgis-assistant-speech-input/customElement.d.ts +6 -1
  127. package/dist/components/arcgis-assistant-suggested-prompts/customElement.d.ts +4 -1
  128. package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +8 -8
  129. package/dist/components/arcgis-assistant-user-message/customElement.d.ts +4 -1
  130. package/dist/components/arcgis-assistant-user-message/customElement.js +1 -1
  131. package/dist/docs/api.json +1 -1
  132. package/dist/docs/docs.json +1 -1
  133. package/dist/docs/vscode.html-custom-data.json +1 -1
  134. package/dist/docs/web-types.json +1 -1
  135. package/dist/index.d.ts +4 -0
  136. package/dist/loader.js +6 -5
  137. package/dist/orchestrator/registry/agentRegistry.d.ts +33 -0
  138. package/dist/types/lumina.d.ts +10 -4
  139. package/dist/types/preact.d.ts +11 -4
  140. package/dist/types/react.d.ts +12 -4
  141. package/dist/types/stencil.d.ts +10 -4
  142. package/dist/utils/index.d.ts +87 -43
  143. package/dist/utils/index.js +54 -49
  144. package/package.json +8 -7
  145. package/dist/cdn/462JBSEV.js +0 -422
  146. package/dist/cdn/7BCR6TUO.js +0 -2
  147. package/dist/cdn/7GH7VSB2.js +0 -2
  148. package/dist/cdn/7PLV4QH6.js +0 -2
  149. package/dist/cdn/DDLZOMUY.js +0 -2
  150. package/dist/cdn/FHVXO2WG.js +0 -166
  151. package/dist/cdn/GSEPHN3A.js +0 -106
  152. package/dist/cdn/MH5RPXHM.js +0 -2
  153. package/dist/cdn/NVI3I46B.js +0 -2
  154. package/dist/cdn/OAVEHGB6.js +0 -2
  155. package/dist/cdn/ON2V5XI2.js +0 -3
  156. package/dist/cdn/QR54T33D.js +0 -2
  157. package/dist/cdn/RVOAPUBN.js +0 -2
  158. package/dist/cdn/SXDLXCIM.js +0 -2
  159. package/dist/cdn/USMDJUFS.js +0 -2
  160. package/dist/cdn/V5YEZSRY.js +0 -16
  161. package/dist/cdn/Y333DGV6.js +0 -2
  162. package/dist/cdn/YY2SBO3V.js +0 -2
@@ -1,18 +1,20 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import { StateGraph as d, START as g, END as i } from "@langchain/langgraph/web";
3
- import { l as h, g as x, f as p, r as f, t as y, H as u } from "./adapter.js";
3
+ import { l as h, g as f, f as p, r as x, t as y, H as c } from "./adapter.js";
4
4
  import "@arcgis/core/identity/IdentityManager.js";
5
5
  import "@arcgis/core/portal/Portal.js";
6
- import { j as S, s as c } from "./generateLayerDescriptions.js";
6
+ import { h as S } from "./generateLayerDescriptions.js";
7
7
  import "@langchain/core/messages";
8
8
  import "@langchain/core/callbacks/dispatch/web";
9
9
  import "@langchain/openai";
10
+ import "@arcgis/core/config.js";
10
11
  import "@arcgis/core/core/reactiveUtils.js";
11
12
  import "@arcgis/core/layers/FeatureLayer.js";
12
13
  import "@arcgis/core/request.js";
13
14
  import { ToolNode as E } from "@langchain/langgraph/prebuilt";
15
+ import { s as m } from "./index.js";
14
16
  import "@langchain/core/prompts";
15
- const m = [h], v = (e) => {
17
+ const u = [h], v = (e) => {
16
18
  if (!e || e.size === 0)
17
19
  return "No layers available in this map.";
18
20
  const t = Array.from(e.values()).map(({ layerItem: r, fieldRegistry: s }, l) => {
@@ -31,12 +33,13 @@ ${t}`;
31
33
  `) : "No agents currently available.";
32
34
  };
33
35
  async function _(e, t) {
34
- const r = await x("help_prompt"), s = p(t, "layersAndFieldsRegistry"), l = p(t, "agentRegistry");
36
+ const r = await f("help_prompt"), s = p(t, "layersAndFieldsRegistry"), l = p(t, "agentRegistry");
35
37
  try {
36
38
  const a = await S({
37
39
  promptText: r,
38
40
  modelTier: "fast",
39
- tools: m,
41
+ config: t,
42
+ tools: u,
40
43
  inputVariables: {
41
44
  layerSummary: v(s),
42
45
  agents: T(l),
@@ -65,16 +68,16 @@ async function _(e, t) {
65
68
  };
66
69
  }
67
70
  }
68
- const C = (e, t) => f(["agentRegistry"], "Help Agent")(e, t);
71
+ const C = (e, t) => x(["agentRegistry"], "Help Agent")(e, t);
69
72
  async function H(e, t) {
70
- const r = new E(m);
73
+ const r = new E(u, { handleToolErrors: !1 });
71
74
  try {
72
75
  const s = e.helpInternalState.toolCallMessage;
73
76
  if (!s)
74
77
  throw new Error("helpToolCalling: missing helpInternalState.toolCallMessage");
75
78
  const a = (await r.invoke({ messages: [s] }, t)).messages.map((o) => o.text).join(`
76
79
  `);
77
- return await c({ text: `Finished executing help tool: ${a}` }, t), {
80
+ return await m({ text: `Finished executing help tool: ${a}` }, t), {
78
81
  ...e,
79
82
  outputMessage: a,
80
83
  status: "success",
@@ -86,7 +89,7 @@ async function H(e, t) {
86
89
  };
87
90
  } catch (s) {
88
91
  const l = s instanceof Error ? s.message : String(s);
89
- return await c({ text: `Help tool execution failed: ${l}` }, t), {
92
+ return await m({ text: `Help tool execution failed: ${l}` }, t), {
90
93
  ...e,
91
94
  outputMessage: `Help tool execution failed: ${l}`,
92
95
  status: "failed",
@@ -98,7 +101,7 @@ async function H(e, t) {
98
101
  };
99
102
  }
100
103
  }
101
- const b = () => new d(u).addNode("requireHelpServices", C).addNode("agent", _).addNode("tools", H).addEdge(g, "requireHelpServices").addEdge("requireHelpServices", "agent").addConditionalEdges("agent", (t) => t.helpInternalState.toolCallMessage ? "tools" : i).addEdge("tools", i), M = String.raw`- **help** — Enables users to ask questions about the map, layers, fields, and it's capabilities.
104
+ const b = () => new d(c).addNode("requireHelpServices", C).addNode("agent", _).addNode("tools", H).addEdge(g, "requireHelpServices").addEdge("requireHelpServices", "agent").addConditionalEdges("agent", (t) => t.helpInternalState.toolCallMessage ? "tools" : i).addEdge("tools", i), M = String.raw`- **help** — Enables users to ask questions about the map, layers, fields, and it's capabilities.
102
105
 
103
106
  _Example: “Tell me about this map”_
104
107
  _Example: “List all layers in this map”_
@@ -111,13 +114,13 @@ const b = () => new d(u).addNode("requireHelpServices", C).addNode("agent", _).a
111
114
 
112
115
  IF the user asks map related queries, but those that are not performed by any of the agents, call this agent so we can respond accordingly.
113
116
  _Example: "Create a chart"_
114
- _Example: "Create a table"_`, D = {
117
+ _Example: "Create a table"_`, G = {
115
118
  id: "help",
116
119
  name: "Help Agent",
117
120
  description: M,
118
121
  createGraph: b,
119
- workspace: u
122
+ workspace: c
120
123
  };
121
124
  export {
122
- D as H
125
+ G as H
123
126
  };
@@ -0,0 +1,11 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import { dispatchCustomEvent as e } from "@langchain/core/callbacks/dispatch/web";
3
+ const n = async (s, a) => {
4
+ await e("trace_message", s, a);
5
+ }, o = async (s, a) => {
6
+ await e("graph_ux_suggestion", s, a);
7
+ };
8
+ export {
9
+ o as a,
10
+ n as s
11
+ };
@@ -97,6 +97,20 @@ Do not reinterpret the request into a different form.
97
97
 
98
98
  ---
99
99
 
100
+ ## Follow-up Reference Resolution
101
+
102
+ If the latest user request refers to prior results or prior context using a referential phrase such as "these", "those", "them", "that set", or "the previous results", then the request depends on earlier context.
103
+
104
+ This also applies to equivalent referential wording in other languages.
105
+
106
+ Resolve the reference using the most recent relevant chat history or successful prior step.
107
+
108
+ In this case, the \`assignedTask\` should be standalone and should preserve the referenced prior constraints while adding only the new constraint or question from the latest user request.
109
+
110
+ Do not leave ambiguous references like "these", "those", or "them" in \`assignedTask\` when they can be resolved from context.
111
+
112
+ ---
113
+
100
114
  ## Assigned Task Guidelines (IMPORTANT)
101
115
 
102
116
  - The \`assignedTask\` must match the user’s request exactly in meaning
@@ -106,6 +120,8 @@ Do not reinterpret the request into a different form.
106
120
 
107
121
  - Keep the task short, specific, and directly executable
108
122
  - Keep wording close to the user’s request with minimal transformation
123
+ - When resolving follow-up references, only replace the ambiguous reference with the resolved prior context; keep the rest of the user’s wording as close as possible.
124
+
109
125
  - Use only information explicitly present in the user request or provided context
110
126
 
111
127
  - The \`assignedTask\` may represent only part of the user’s request when multiple steps are necessary
@@ -1,28 +1,30 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import { NodeInterrupt as L, StateGraph as w, START as E, END as m } from "@langchain/langgraph/web";
2
+ import { NodeInterrupt as E, StateGraph as L, START as w, END as m } from "@langchain/langgraph/web";
3
3
  import "@arcgis/core/identity/IdentityManager.js";
4
4
  import "@arcgis/core/portal/Portal.js";
5
- import { s as i, j as I } from "./generateLayerDescriptions.js";
5
+ import { h as I } from "./generateLayerDescriptions.js";
6
6
  import "@langchain/core/messages";
7
+ import { s as i } from "./index.js";
7
8
  import "@langchain/openai";
9
+ import "@arcgis/core/config.js";
8
10
  import "@arcgis/core/core/reactiveUtils.js";
9
11
  import "@arcgis/core/layers/FeatureLayer.js";
10
12
  import "@arcgis/core/request.js";
11
13
  import "@langchain/core/prompts";
12
- import { f as p, z as v, A as R, B as T, C as F, D as C, E as A, F as $, I as N, J as b, K as q, L as M, g as _, r as j, M as S } from "./adapter.js";
13
- import { h as k } from "./toolCallResponse.js";
14
- import { ToolNode as V } from "@langchain/langgraph/prebuilt";
14
+ import { f as g, z as v, A as T, B as R, C as F, D as C, E as A, F as $, I as N, J as b, K as q, L as M, g as _, r as k, M as S } from "./adapter.js";
15
+ import { h as V } from "./toolCallResponse.js";
16
+ import { ToolNode as j } from "@langchain/langgraph/prebuilt";
15
17
  const h = 0.7, z = 10, D = async (t, e) => {
16
18
  try {
17
19
  await i({ text: "Similarity search to find fields" }, e);
18
- const r = p(e, "fieldSearch"), a = p(e, "layersAndFieldsRegistry"), o = p(e, "embeddingCache"), n = await r.searchFields({
20
+ const r = g(e, "fieldSearch"), a = g(e, "layersAndFieldsRegistry"), o = g(e, "embeddingCache"), n = await r.searchFields({
19
21
  text: t.agentExecutionContext.assignedTask,
20
22
  layerIds: t.vectorSearchLayerIds,
21
23
  minScore: h,
22
24
  topResults: z,
23
25
  embeddingCache: o
24
- }), c = n.map(({ layerId: d, results: g }) => {
25
- const y = g.map((s) => ` - ${s.name} (${s.score.toFixed(2)})`).join(`
26
+ }), c = n.map(({ layerId: d, results: p }) => {
27
+ const y = p.map((s) => ` - ${s.name} (${s.score.toFixed(2)})`).join(`
26
28
  `);
27
29
  return `${a.get(d)?.layerItem.name ?? d}:
28
30
  ${y}`;
@@ -46,10 +48,10 @@ ${c}` : l = `No vector search results found for score over ${h}.`, await i({ tex
46
48
  { text: `Similarity search to find layers: ${t.agentExecutionContext.assignedTask}` },
47
49
  e
48
50
  );
49
- const r = p(e, "layerSearch"), a = p(e, "layersAndFieldsRegistry"), o = await r.searchLayers({
51
+ const r = g(e, "layerSearch"), a = g(e, "layersAndFieldsRegistry"), o = await r.searchLayers({
50
52
  text: t.agentExecutionContext.assignedTask,
51
53
  minScore: P
52
- }), n = o.map((d) => d.id), c = o.map(({ id: d, score: g }) => `${a.get(d)?.layerItem.name ?? d} (${g.toFixed(2)})`).join(`
54
+ }), n = o.map((d) => d.id), c = o.map(({ id: d, score: p }) => `${a.get(d)?.layerItem.name ?? d} (${p.toFixed(2)})`).join(`
53
55
  `);
54
56
  let l;
55
57
  return n.length > 0 ? l = `Vector search completed. Matching layers with scores:
@@ -65,8 +67,8 @@ ${c}` : l = "Vector search completed. No matching layers found.", await i({ text
65
67
  }
66
68
  }, f = [
67
69
  v,
68
- R,
69
70
  T,
71
+ R,
70
72
  F,
71
73
  C,
72
74
  A,
@@ -91,11 +93,12 @@ ${c}` : l = "Vector search completed. No matching layers found.", await i({ text
91
93
  }, o = await I({
92
94
  promptText: r,
93
95
  modelTier: "advanced",
96
+ config: e,
94
97
  messages: x(t.agentExecutionContext.messages),
95
98
  inputVariables: a,
96
99
  tools: f
97
100
  });
98
- return await k(o, e), {
101
+ return await V(o, e), {
99
102
  ...t,
100
103
  agentExecutionContext: {
101
104
  ...t.agentExecutionContext,
@@ -104,7 +107,7 @@ ${c}` : l = "Vector search completed. No matching layers found.", await i({ text
104
107
  };
105
108
  };
106
109
  async function B(t, e) {
107
- const a = await new V(f).invoke(
110
+ const a = await new j(f, { handleToolErrors: !1 }).invoke(
108
111
  {
109
112
  messages: x(t.agentExecutionContext.messages)
110
113
  },
@@ -129,18 +132,18 @@ const U = async (t, e) => (await i({ text: "Exiting Layer Styling agent" }, e),
129
132
  s.description && `Description: ${s.description}`
130
133
  ].filter(Boolean).join(" | ") : y;
131
134
  };
132
- const { layerId: n, results: c } = a, l = p(e, "layersAndFieldsRegistry"), d = l.get(n)?.fieldRegistry;
135
+ const { layerId: n, results: c } = a, l = g(e, "layersAndFieldsRegistry"), d = l.get(n)?.fieldRegistry;
133
136
  if (!d)
134
137
  continue;
135
- let g = r.find((y) => y.layerId === n);
136
- g || (g = {
138
+ let p = r.find((y) => y.layerId === n);
139
+ p || (p = {
137
140
  layerId: n,
138
141
  layerSummary: o(n),
139
142
  fieldInfos: []
140
- }, r.push(g));
143
+ }, r.push(p));
141
144
  for (const y of c) {
142
145
  const s = d.get(y.name);
143
- s && g.fieldInfos.push(s);
146
+ s && p.fieldInfos.push(s);
144
147
  }
145
148
  }
146
149
  return await i({ text: "Populated layerFieldInfo" }, e), { ...t, layerFieldInfo: r };
@@ -160,14 +163,14 @@ const U = async (t, e) => (await i({ text: "Exiting Layer Styling agent" }, e),
160
163
  message: "Choose a layer to apply the styles.",
161
164
  metadata: [...r]
162
165
  };
163
- throw new L(n);
166
+ throw new E(n);
164
167
  }
165
168
  let o = null;
166
169
  return Array.isArray(a.payload) && a.payload.length > 0 && (o = a.payload[0]), {
167
170
  ...t,
168
171
  selectedLayerId: o ?? t.vectorSearchLayerIds[0]
169
172
  };
170
- }, O = (t, e) => j(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Layer Styling Agent")(t, e), Q = () => new w(S).addNode("requireLayerStylingServices", O).addNode("vectorSearchLayers", H).addNode("layerSelectionHITL", K).addNode("vectorSearchFields", D).addNode("populateLayerFieldInfo", J).addNode("agent", G).addNode("tools", B).addNode("earlyExit", U).addEdge(E, "requireLayerStylingServices").addEdge("requireLayerStylingServices", "vectorSearchLayers").addConditionalEdges(
173
+ }, O = (t, e) => k(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Layer Styling Agent")(t, e), Q = () => new L(S).addNode("requireLayerStylingServices", O).addNode("vectorSearchLayers", H).addNode("layerSelectionHITL", K).addNode("vectorSearchFields", D).addNode("populateLayerFieldInfo", J).addNode("agent", G).addNode("tools", B).addNode("earlyExit", U).addEdge(w, "requireLayerStylingServices").addEdge("requireLayerStylingServices", "vectorSearchLayers").addConditionalEdges(
171
174
  "layerSelectionHITL",
172
175
  (e) => e.vectorSearchLayerIds.length ? "vectorSearchFields" : "earlyExit"
173
176
  ).addConditionalEdges(
@@ -1,15 +1,17 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import { StateGraph as E, START as $, END as C } from "@langchain/langgraph/web";
2
+ import { StateGraph as b, START as $, END as C } from "@langchain/langgraph/web";
3
3
  import { k as F, m as R, n as L, o as M, p as A, u as _, v as I, w as q, x as Z, g as T, y as k, t as j, f as u, r as P, N as w } from "./adapter.js";
4
4
  import "@arcgis/core/identity/IdentityManager.js";
5
5
  import "@arcgis/core/portal/Portal.js";
6
- import { j as V, s as h, i as z } from "./generateLayerDescriptions.js";
6
+ import { h as V, i as z } from "./generateLayerDescriptions.js";
7
7
  import "@langchain/core/messages";
8
8
  import "@langchain/core/callbacks/dispatch/web";
9
9
  import "@langchain/openai";
10
+ import "@arcgis/core/config.js";
10
11
  import "@arcgis/core/core/reactiveUtils.js";
11
12
  import "@arcgis/core/layers/FeatureLayer.js";
12
13
  import "@arcgis/core/request.js";
14
+ import { s as h } from "./index.js";
13
15
  import "@langchain/core/prompts";
14
16
  import { ToolNode as G } from "@langchain/langgraph/prebuilt";
15
17
  import x from "zod";
@@ -25,14 +27,14 @@ const S = [
25
27
  Z
26
28
  ];
27
29
  async function O(e, t) {
28
- const o = await T("navigation_tool_prompt"), { mapView: s } = k(t), i = s.map.bookmarks?.map((p) => p.name).filter(Boolean) ?? [], c = e.vectorSearchLayerResults?.length > 0 ? e.vectorSearchLayerResults.map(
29
- (p, b) => `${b + 1}. layerId=${p.id} | title=${p.title ?? ""} | name=${p.name ?? ""} | score=${p.score.toFixed(2)}`
30
+ const o = await T("navigation_tool_prompt"), { mapView: s } = k(t), i = s.map.bookmarks?.map((p) => p.name).filter(Boolean) ?? [], l = e.vectorSearchLayerResults?.length > 0 ? e.vectorSearchLayerResults.map(
31
+ (p, E) => `${E + 1}. layerId=${p.id} | title=${p.title ?? ""} | name=${p.name ?? ""} | score=${p.score.toFixed(2)}`
30
32
  ).join(`
31
- `) : "", l = e.vectorSearchFieldResults?.length > 0 ? JSON.stringify(e.vectorSearchFieldResults, null, 2) : "", a = e.intent === "goToBookmark" && i.length ? `Available bookmarks:
33
+ `) : "", c = e.vectorSearchFieldResults?.length > 0 ? JSON.stringify(e.vectorSearchFieldResults, null, 2) : "", a = e.intent === "goToBookmark" && i.length ? `Available bookmarks:
32
34
  ${i.map((p) => `- ${p}`).join(`
33
35
  `)}` : "", r = (e.intent === "goToLayer" || e.intent === "goToFeatures") && e.vectorSearchLayerResults?.length ? `Candidate layers:
34
- ${c}` : "", d = e.intent === "goToFeatures" && e.vectorSearchFieldResults?.length ? `Candidate fields:
35
- ${l}` : "", y = {
36
+ ${l}` : "", d = e.intent === "goToFeatures" && e.vectorSearchFieldResults?.length ? `Candidate fields:
37
+ ${c}` : "", y = {
36
38
  intent: e.intent,
37
39
  bookmarksSection: a,
38
40
  layersSection: r,
@@ -44,6 +46,7 @@ ${l}` : "", y = {
44
46
  }, n = await V({
45
47
  promptText: o,
46
48
  modelTier: "fast",
49
+ config: t,
47
50
  inputVariables: y,
48
51
  tools: S
49
52
  }), m = (n.tool_calls?.length ?? 0) > 0, v = typeof n.text == "string" ? n.text.trim() : "", N = v.length > 0;
@@ -70,7 +73,7 @@ const B = (e) => {
70
73
  return { text: t };
71
74
  };
72
75
  async function D(e, t) {
73
- const o = new G(S);
76
+ const o = new G(S, { handleToolErrors: !1 });
74
77
  try {
75
78
  const s = e.navigationInternalState.toolCallMessage;
76
79
  if (!s)
@@ -81,19 +84,19 @@ async function D(e, t) {
81
84
  },
82
85
  t
83
86
  );
84
- let i = "", c;
85
- for (const l of g) {
86
- const a = B(l.content);
87
+ let i = "", l;
88
+ for (const c of g) {
89
+ const a = B(c.content);
87
90
  a.text && (i += `${a.text}
88
- `), a.sharedStatePatch && (c = {
89
- ...c,
91
+ `), a.sharedStatePatch && (l = {
92
+ ...l,
90
93
  ...a.sharedStatePatch
91
94
  });
92
95
  }
93
96
  return await h({ text: `Finished executing navigation tool: ${i}` }, t), {
94
97
  ...e,
95
98
  outputMessage: i,
96
- sharedStatePatch: c,
99
+ sharedStatePatch: l,
97
100
  status: "success",
98
101
  summary: i ? j(i) : "Navigation executed.",
99
102
  navigationInternalState: {
@@ -120,12 +123,12 @@ async function J(e, t) {
120
123
  name: n.name,
121
124
  description: n.description,
122
125
  schema: n.schema
123
- })), c = s.map.bookmarks?.map((n) => n.name).filter(Boolean) ?? [], l = c.length ? `Available bookmarks:
124
- ${c.map((n) => `- ${n}`).join(`
126
+ })), l = s.map.bookmarks?.map((n) => n.name).filter(Boolean) ?? [], c = l.length ? `Available bookmarks:
127
+ ${l.map((n) => `- ${n}`).join(`
125
128
  `)}` : "", a = {
126
129
  tools: g.map(({ name: n, description: m, schema: v }) => `${n}: ${m}, ${JSON.stringify(v)}`).join(`
127
130
  `),
128
- bookmarks: l,
131
+ bookmarks: c,
129
132
  assignedTask: e.agentExecutionContext.assignedTask,
130
133
  userRequest: e.agentExecutionContext.userRequest,
131
134
  priorSteps: e.agentExecutionContext.priorSteps
@@ -133,6 +136,7 @@ ${c.map((n) => `- ${n}`).join(`
133
136
  intent: x.string()
134
137
  }), d = await z({
135
138
  promptText: o,
139
+ config: t,
136
140
  inputVariables: a,
137
141
  schema: r,
138
142
  modelTier: "fast"
@@ -145,7 +149,7 @@ const H = 0.7, U = async (e, t) => {
145
149
  { text: `Similarity search to find layers: ${e.agentExecutionContext.assignedTask}` },
146
150
  t
147
151
  );
148
- const o = u(t, "layerSearch"), s = u(t, "layersAndFieldsRegistry"), g = u(t, "embeddingCache"), c = (await o.searchLayers({
152
+ const o = u(t, "layerSearch"), s = u(t, "layersAndFieldsRegistry"), g = u(t, "embeddingCache"), l = (await o.searchLayers({
149
153
  text: e.agentExecutionContext.assignedTask,
150
154
  minScore: H,
151
155
  embeddingCache: g
@@ -158,12 +162,12 @@ const H = 0.7, U = async (e, t) => {
158
162
  score: r
159
163
  };
160
164
  });
161
- let l;
162
- return c.length > 0 ? l = `Vector search completed. Matching layers:
163
- ${c.map((a) => `- layerId=${a.id} | title=${a.title ?? ""} | name=${a.name ?? ""} | score=${a.score.toFixed(2)}`).join(`
164
- `)}` : l = "Vector search completed. No matching layers found.", await h({ text: l }, t), {
165
+ let c;
166
+ return l.length > 0 ? c = `Vector search completed. Matching layers:
167
+ ${l.map((a) => `- layerId=${a.id} | title=${a.title ?? ""} | name=${a.name ?? ""} | score=${a.score.toFixed(2)}`).join(`
168
+ `)}` : c = "Vector search completed. No matching layers found.", await h({ text: c }, t), {
165
169
  ...e,
166
- vectorSearchLayerResults: c
170
+ vectorSearchLayerResults: l
167
171
  };
168
172
  } catch (o) {
169
173
  throw await h(
@@ -180,7 +184,7 @@ ${c.map((a) => `- layerId=${a.id} | title=${a.title ?? ""} | name=${a.name ?? ""
180
184
  const o = u(t, "fieldSearch"), s = u(t, "layersAndFieldsRegistry"), g = u(t, "embeddingCache"), i = e.vectorSearchLayerResults?.map((r) => r.id) ?? [];
181
185
  if (i.length === 0)
182
186
  return await h({ text: "No candidate layers for field search" }, t), e;
183
- const l = (await o.searchFields({
187
+ const c = (await o.searchFields({
184
188
  text: e.agentExecutionContext.assignedTask,
185
189
  layerIds: i,
186
190
  minScore: f,
@@ -205,15 +209,15 @@ ${c.map((a) => `- layerId=${a.id} | title=${a.title ?? ""} | name=${a.name ?? ""
205
209
  };
206
210
  });
207
211
  let a;
208
- return l.length > 0 ? a = `Vector search completed. Matching layers and fields:
209
- ${l.map(
212
+ return c.length > 0 ? a = `Vector search completed. Matching layers and fields:
213
+ ${c.map(
210
214
  (r) => `${r.layerName ?? r.layerId}:
211
215
  ${r.results.map((d) => ` - ${d.name} (${d.score.toFixed(2)})`).join(`
212
216
  `)}`
213
217
  ).join(`
214
218
  `)}` : a = `No vector search field results found for score over ${f}.`, await h({ text: a }, t), {
215
219
  ...e,
216
- vectorSearchFieldResults: l
220
+ vectorSearchFieldResults: c
217
221
  };
218
222
  } catch (o) {
219
223
  throw await h(
@@ -221,7 +225,7 @@ ${r.results.map((d) => ` - ${d.name} (${d.score.toFixed(2)})`).join(`
221
225
  t
222
226
  ), o;
223
227
  }
224
- }, Q = (e, t) => P(["layerSearch", "layersAndFieldsRegistry"], "Navigation Agent")(e, t), X = () => new E(w).addNode("requireNavigationServices", Q).addNode("intentLLM", J).addNode("vectorSearchLayers", U).addNode("vectorSearchFields", K).addNode("agent", O).addNode("tools", D).addEdge($, "requireNavigationServices").addEdge("requireNavigationServices", "intentLLM").addConditionalEdges(
228
+ }, Q = (e, t) => P(["layerSearch", "layersAndFieldsRegistry"], "Navigation Agent")(e, t), X = () => new b(w).addNode("requireNavigationServices", Q).addNode("intentLLM", J).addNode("vectorSearchLayers", U).addNode("vectorSearchFields", K).addNode("agent", O).addNode("tools", D).addEdge($, "requireNavigationServices").addEdge("requireNavigationServices", "intentLLM").addConditionalEdges(
225
229
  "intentLLM",
226
230
  (t) => t.intent === "goToLayer" || t.intent === "goToFeatures" ? "vectorSearchLayers" : "agent",
227
231
  {
@@ -254,7 +258,7 @@ ${r.results.map((d) => ` - ${d.name} (${d.score.toFixed(2)})`).join(`
254
258
  _Example: “Center the map on San Francisco at scale 50000”_
255
259
  _Example: “Zoom to the features in the schools layer where city = 'Austin'”_
256
260
  _Example: “Go to the Downtown bookmark”_
257
- _Example: “Where is Mount Rainier?”_`, pe = {
261
+ _Example: “Where is Mount Rainier?”_`, ye = {
258
262
  id: "navigation",
259
263
  name: "Navigation Agent",
260
264
  description: Y,
@@ -262,5 +266,5 @@ ${r.results.map((d) => ` - ${d.name} (${d.score.toFixed(2)})`).join(`
262
266
  workspace: w
263
267
  };
264
268
  export {
265
- pe as N
269
+ ye as N
266
270
  };