@arcgis/ai-components 5.2.0-next.8 → 5.2.0-next.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +4 -2
- package/README.md +2 -2
- package/dist/agent-utils/FunctionAgent.d.ts +2 -2
- package/dist/agent-utils/LLMAgent.d.ts +7 -4
- package/dist/agent-utils/LLMAgent.js +3 -2
- package/dist/agent-utils/WorkflowAgent.d.ts +2 -2
- package/dist/agent-utils/index.d.ts +177 -0
- package/dist/agent-utils/index.js +167 -0
- package/dist/agent-utils/middlewares/trace.d.ts +2 -0
- package/dist/agent-utils/middlewares/trace.js +25 -33
- package/dist/agent-utils/tools/FunctionTool.d.ts +2 -2
- package/dist/agent-utils/types.d.ts +37 -8
- package/dist/agent-utils/workflows/ConditionalWorkflow.d.ts +2 -2
- package/dist/agent-utils/workflows/LoopWorkflow.d.ts +2 -2
- package/dist/agent-utils/workflows/ParallelWorkflow.d.ts +2 -2
- package/dist/agent-utils/workflows/RouterWorkflow.d.ts +2 -2
- package/dist/agent-utils/workflows/SequentialWorkflow.d.ts +2 -2
- package/dist/agent-utils/workflows/SwitchWorkflow.d.ts +2 -2
- package/dist/agentic-workflow/AgenticWorkflowRuntime.d.ts +24 -0
- package/dist/agentic-workflow/Edge.d.ts +16 -0
- package/dist/agentic-workflow/WebAgent.d.ts +39 -0
- package/dist/agentic-workflow/jsonTypes.d.ts +183 -0
- package/dist/agentic-workflow/nodes/AgentNode.d.ts +27 -0
- package/dist/agentic-workflow/nodes/BaseNode.d.ts +35 -0
- package/dist/agentic-workflow/nodes/EndMessageNode.d.ts +25 -0
- package/dist/agentic-workflow/nodes/StartNode.d.ts +21 -0
- package/dist/agentic-workflow/nodes/tools/ArcgisTool.d.ts +21 -0
- package/dist/agentic-workflow/types.d.ts +29 -0
- package/dist/agents/tools/filter/clearFilters/adapter.d.ts +8 -0
- package/dist/agents/tools/filter/clearFilters/adapter.js +22 -0
- package/dist/agents/tools/filter/resetMap/adapter.d.ts +8 -0
- package/dist/agents/tools/filter/resetMap/adapter.js +22 -0
- package/dist/agents/tools/filter/setFeatureEffect/adapter.d.ts +8 -0
- package/dist/agents/tools/filter/setFeatureEffect/adapter.js +109 -0
- package/dist/agents/tools/help/listFields/adapter.d.ts +11 -0
- package/dist/agents/tools/help/listFields/adapter.js +30 -0
- package/dist/agents/tools/navigation/goToAddress/adapter.d.ts +10 -0
- package/dist/agents/tools/navigation/goToAddress/adapter.js +52 -0
- package/dist/agents/tools/navigation/goToBookmark/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToBookmark/adapter.js +30 -0
- package/dist/agents/tools/navigation/goToFeatures/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToFeatures/adapter.js +50 -0
- package/dist/agents/tools/navigation/goToFullExtent/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToFullExtent/adapter.js +27 -0
- package/dist/agents/tools/navigation/goToHomeExtent/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToHomeExtent/adapter.js +24 -0
- package/dist/agents/tools/navigation/goToLayer/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToLayer/adapter.js +26 -0
- package/dist/agents/tools/navigation/goToScale/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToScale/adapter.js +21 -0
- package/dist/agents/tools/navigation/goToViewpoint/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToViewpoint/adapter.js +42 -0
- package/dist/agents/tools/navigation/goToZoom/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToZoom/adapter.js +21 -0
- package/dist/agents/tools/query/getAttribute/adapter.d.ts +8 -0
- package/dist/agents/tools/query/getAttribute/adapter.js +40 -0
- package/dist/agents/tools/query/getStatistics/adapter.d.ts +8 -0
- package/dist/agents/tools/query/getStatistics/adapter.js +154 -0
- package/dist/agents/tools/query/getTopFeatures/adapter.d.ts +8 -0
- package/dist/agents/tools/query/getTopFeatures/adapter.js +141 -0
- package/dist/agents/tools/query/queryFeatures/adapter.d.ts +8 -0
- package/dist/agents/tools/query/queryFeatures/adapter.js +127 -0
- package/dist/agents/tools/search/findRelevantFields/adapter.d.ts +8 -0
- package/dist/agents/tools/search/findRelevantFields/adapter.js +57 -0
- package/dist/agents/tools/search/findRelevantLayers/adapter.d.ts +8 -0
- package/dist/agents/tools/search/findRelevantLayers/adapter.js +38 -0
- package/dist/cdn/2EY3BQQX.js +2 -0
- package/dist/cdn/34O57OGV.js +2 -0
- package/dist/cdn/3POGAH2X.js +2 -0
- package/dist/cdn/3SEKXQVK.js +9 -0
- package/dist/cdn/{AMP6IALT.js → 3UEKINYC.js} +1 -1
- package/dist/cdn/434TAA3J.js +2 -0
- package/dist/cdn/4HDDRBIY.js +2 -0
- package/dist/cdn/4NJ2FF7H.js +2 -0
- package/dist/cdn/4OGR5QKS.js +2 -0
- package/dist/cdn/4QGVOLW6.js +22 -0
- package/dist/cdn/4WIDLQUH.js +2 -0
- package/dist/cdn/5WYRJMBW.js +2 -0
- package/dist/cdn/5X7EG7D2.js +2 -0
- package/dist/cdn/5ZFUGNRN.js +2 -0
- package/dist/cdn/6HF36IKA.js +2 -0
- package/dist/cdn/6KFMRBAA.js +2 -0
- package/dist/cdn/6NHYXISD.js +2 -0
- package/dist/cdn/6U4GTCLJ.js +66 -0
- package/dist/cdn/7BCQMK6D.js +2 -0
- package/dist/cdn/7GMCLVSZ.js +2 -0
- package/dist/cdn/7M6VKBTK.js +6 -0
- package/dist/cdn/{GGSZM7KV.js → 7Q5EESAR.js} +6 -4
- package/dist/cdn/7SRLZQVC.js +5 -0
- package/dist/cdn/7TXR75RG.js +2 -0
- package/dist/cdn/7V6OSTFC.js +2 -0
- package/dist/cdn/7VAQUCBU.js +9 -0
- package/dist/cdn/7ZFAFKJT.js +2 -0
- package/dist/cdn/ACJTJLZN.js +2 -0
- package/dist/cdn/AI6DYOKR.js +181 -0
- package/dist/cdn/{ZS2TZ6BF.js → AOVJ34QE.js} +1 -1
- package/dist/cdn/APFZY4PI.js +2 -0
- package/dist/cdn/AT4XVTJR.js +44 -0
- package/dist/cdn/AZ5G7YZH.js +3 -0
- package/dist/cdn/{FL4W4VYN.js → BL273EGZ.js} +17 -1
- package/dist/cdn/BM3WFHJG.js +2 -0
- package/dist/cdn/{DHOVCT6R.js → BPCBE7J6.js} +1 -1
- package/dist/cdn/CCC6LBMY.js +2 -0
- package/dist/cdn/{5ZZGKP7N.js → CEKOEHB3.js} +1 -1
- package/dist/cdn/CJMUJXPL.js +2 -0
- package/dist/cdn/CP5BVGJU.js +2 -0
- package/dist/cdn/CZM4URK7.js +2 -0
- package/dist/cdn/DPALM2OW.js +2 -0
- package/dist/cdn/E7JZ7GUW.js +18 -0
- package/dist/cdn/EMLOVMD4.js +2 -0
- package/dist/cdn/EWLXNGKH.js +208 -0
- package/dist/cdn/F2J6BMMX.js +36 -0
- package/dist/cdn/FAR3DFFK.js +2 -0
- package/dist/cdn/FDOMMK2M.js +2 -0
- package/dist/cdn/{ZLXN7NMF.js → FYZATVB3.js} +10 -8
- package/dist/cdn/GFEOVHJK.js +2 -0
- package/dist/cdn/HDM2D2GD.js +2 -0
- package/dist/cdn/HHFNQR6Z.js +2 -0
- package/dist/cdn/HMUWQCXU.js +2 -0
- package/dist/cdn/I3ONG4AX.js +2 -0
- package/dist/cdn/IBZ2NEAO.js +2 -0
- package/dist/cdn/{FX7UOGHP.js → ICBIUFK7.js} +1 -1
- package/dist/cdn/IFJM5XEQ.js +2 -0
- package/dist/cdn/IHP25JWI.js +99 -0
- package/dist/cdn/J6A4AS7E.js +22 -0
- package/dist/cdn/J6SZIQJA.js +2 -0
- package/dist/cdn/{NE7E52YR.js → JEBRN3EU.js} +9 -3
- package/dist/cdn/JKIESH74.js +2 -0
- package/dist/cdn/JO5ETMPS.js +2 -0
- package/dist/cdn/JWIE3YK3.js +2 -0
- package/dist/cdn/K2R6XVK3.js +2 -0
- package/dist/cdn/KITIP6J2.js +2 -0
- package/dist/cdn/KPO4XX6J.js +2 -0
- package/dist/cdn/KWD2ECTM.js +2 -0
- package/dist/cdn/L7XTRDFM.js +3 -0
- package/dist/cdn/{7RCQFLPP.js → LK7ZIQW6.js} +1 -1
- package/dist/cdn/LLUGJKAQ.js +2 -0
- package/dist/cdn/LMPNXXTQ.js +2 -0
- package/dist/cdn/LYKCYBGB.js +2 -0
- package/dist/cdn/{3PKJWIC3.js → M2L5R4LA.js} +1 -1
- package/dist/cdn/{V2P4AIGG.js → M4URMXDS.js} +1 -1
- package/dist/cdn/MDAKBX7N.js +2 -0
- package/dist/cdn/MWYBF3F3.js +66 -0
- package/dist/cdn/NEV6OZN3.js +71 -0
- package/dist/cdn/NQDOAPE3.js +2 -0
- package/dist/cdn/OAKRPM7D.js +2 -0
- package/dist/cdn/{23EQTPO3.js → OKVLGJAG.js} +1 -1
- package/dist/cdn/ONMNQBPO.js +2 -0
- package/dist/cdn/ONQ6JSBJ.js +2 -0
- package/dist/cdn/OWTGH34K.js +2 -0
- package/dist/cdn/{LQ6R5YRN.js → PQ2DPOFM.js} +1 -1
- package/dist/cdn/PSYRZMX2.js +2 -0
- package/dist/cdn/PUHRBGKB.js +2 -0
- package/dist/cdn/Q57QWN5W.js +2 -0
- package/dist/cdn/QNNGPA3Q.js +2 -0
- package/dist/cdn/R74ZHFA6.js +2 -0
- package/dist/cdn/RBE55SWR.js +2 -0
- package/dist/cdn/RHYNE5OE.js +2 -0
- package/dist/cdn/RLEHNAIA.js +2 -0
- package/dist/cdn/RV55GABG.js +2 -0
- package/dist/cdn/RWWOOC7S.js +2 -0
- package/dist/cdn/{X2ZDYHCG.js → SDWWUWAF.js} +10 -5
- package/dist/cdn/T4RIGOXB.js +2 -0
- package/dist/cdn/TACBKKBI.js +2 -0
- package/dist/cdn/TMJMDCSA.js +4 -0
- package/dist/cdn/TPULIO6I.js +34 -0
- package/dist/cdn/U2D53TAX.js +14 -0
- package/dist/cdn/UEEH5ZQK.js +156 -0
- package/dist/cdn/{6YMR4QSD.js → UHEYPSOR.js} +1 -1
- package/dist/cdn/UHZG7SKO.js +2 -0
- package/dist/cdn/UZLQALHY.js +2 -0
- package/dist/cdn/V52XWEGV.js +11 -0
- package/dist/cdn/V6HOUZPZ.js +2 -0
- package/dist/cdn/VAXH6RUQ.js +134 -0
- package/dist/cdn/VLLZ2FFU.js +2 -0
- package/dist/cdn/VNJMTA6O.js +2 -0
- package/dist/cdn/VOKXKU7M.js +56 -0
- package/dist/cdn/VXFQANGJ.js +2 -0
- package/dist/cdn/W5G35GO4.js +2 -0
- package/dist/cdn/WKTQVBFJ.js +2 -0
- package/dist/cdn/WLH47YFC.js +14 -0
- package/dist/cdn/WP7ORLSB.js +6 -0
- package/dist/cdn/Y7XD7ZRD.js +2 -0
- package/dist/cdn/YEZ3AMNX.js +2 -0
- package/dist/cdn/YLVJA4ZE.js +2 -0
- package/dist/cdn/Z5W4V7RC.js +2 -0
- package/dist/cdn/ZLWWWTH4.js +2 -0
- package/dist/cdn/ZOEMBHRF.js +2 -0
- package/dist/cdn/ZQMBJ6MI.js +2 -0
- package/dist/cdn/ZRESBCJL.js +2 -0
- package/dist/cdn/{ZTBA5PM7.js → ZU2FHVNK.js} +1 -1
- package/dist/cdn/ZUNLFO6M.js +3 -0
- package/dist/cdn/agent-utils/index.js +2 -0
- package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +3 -0
- package/dist/cdn/agent-utils/middlewares/middleware.js +2 -0
- package/dist/cdn/agent-utils/middlewares/trace.js +2 -0
- package/dist/cdn/assets/assistant/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.en.json +1 -0
- package/dist/cdn/assets/assistant-message/t9n/messages.en.json +1 -0
- package/dist/cdn/assets/assistant-message-loading/t9n/messages.en.json +1 -0
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/adapter.js +1294 -2112
- package/dist/chunks/arcgisKnowledgeGraph.js +127 -72
- package/dist/chunks/arcgis_knowledge_current_lc_context.js +19 -2
- package/dist/chunks/arcgis_knowledge_current_map_context.js +31 -2
- package/dist/chunks/arcgis_knowledge_cypher_query_prompt.js +102 -0
- package/dist/chunks/arcgis_knowledge_summarize_result_prompt.js +116 -27
- package/dist/chunks/baseAgentState.js +56 -0
- package/dist/chunks/converterUtils.js +66 -41
- package/dist/chunks/dataExplorationGraph.js +132 -177
- package/dist/chunks/data_explore_query_prompt.js +9 -4
- package/dist/chunks/fetchAgentContext.js +13 -0
- package/dist/chunks/fetchService.js +10 -0
- package/dist/chunks/fieldStatistics.js +79 -0
- package/dist/chunks/formatFeatureAttributes.js +132 -0
- package/dist/chunks/generateLayerDescriptions.js +259 -282
- package/dist/chunks/helpGraph.js +34 -25
- package/dist/chunks/help_prompt.js +34 -17
- package/dist/chunks/index.js +11 -0
- package/dist/chunks/intent_prompt.js +16 -0
- package/dist/chunks/layerStylingGraph.js +36 -31
- package/dist/chunks/mergeWhereClauses.js +15 -0
- package/dist/chunks/navigationGraph.js +123 -103
- package/dist/chunks/navigation_intent_prompt.js +8 -2
- package/dist/chunks/orchestrator.js +205 -175
- package/dist/chunks/slottableRequestUtils.js +3 -7
- package/dist/chunks/state.js +21 -27
- package/dist/chunks/summarize_query_response_prompt.js +9 -7
- package/dist/chunks/toolCallResponse.js +13 -10
- package/dist/chunks/types.js +59 -0
- package/dist/chunks/utils2.js +11 -11
- package/dist/components/arcgis-assistant/customElement.d.ts +56 -0
- package/dist/components/arcgis-assistant/customElement.js +387 -155
- package/dist/components/arcgis-assistant/index.js +2 -3
- package/dist/components/arcgis-assistant/types.d.ts +14 -1
- package/dist/components/arcgis-assistant-agent/customElement.d.ts +13 -1
- package/dist/components/arcgis-assistant-agent/customElement.js +608 -10
- package/dist/components/arcgis-assistant-chat/customElement.d.ts +2 -1
- package/dist/components/arcgis-assistant-chat/customElement.js +23 -18
- package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +2 -0
- package/dist/components/arcgis-assistant-chat-entry/customElement.js +25 -18
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +19 -3
- package/dist/components/arcgis-assistant-help-agent/customElement.js +28 -6
- package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +4 -0
- package/dist/components/arcgis-assistant-interrupt/customElement.js +17 -14
- package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +24 -0
- package/dist/components/arcgis-assistant-interrupt-preview/index.js +2 -0
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.d.ts +7 -7
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +39 -16
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +29 -6
- package/dist/components/arcgis-assistant-message/customElement.d.ts +5 -0
- package/dist/components/arcgis-assistant-message/customElement.js +29 -26
- package/dist/components/arcgis-assistant-message/index.js +2 -0
- package/dist/components/arcgis-assistant-message-block/customElement.js +18 -11
- package/dist/components/arcgis-assistant-message-block/index.js +1 -0
- package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +7 -0
- package/dist/components/arcgis-assistant-message-loading/customElement.js +8 -7
- package/dist/components/arcgis-assistant-message-loading/index.js +1 -0
- package/dist/components/arcgis-assistant-message-text/customElement.d.ts +1 -0
- package/dist/components/arcgis-assistant-message-text/customElement.js +12 -12
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +17 -3
- package/dist/components/arcgis-assistant-speech-input/customElement.js +29 -46
- package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +8 -8
- package/dist/components/arcgis-assistant-user-message/customElement.d.ts +2 -0
- package/dist/components/arcgis-assistant-user-message/customElement.js +15 -10
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/loader.js +9 -8
- package/dist/oauth-callback.html +1 -1
- package/dist/types/lumina.d.ts +9 -8
- package/dist/types/preact.d.ts +9 -8
- package/dist/types/react.d.ts +9 -8
- package/dist/types/stencil.d.ts +11 -10
- package/dist/utils/index.d.ts +10 -10
- package/dist/utils/index.js +56 -55
- package/package.json +32 -12
- package/dist/cdn/2AXF774U.js +0 -2
- package/dist/cdn/462JBSEV.js +0 -422
- package/dist/cdn/53ZCUPKK.js +0 -22
- package/dist/cdn/5QAHYX7Y.js +0 -5
- package/dist/cdn/5XRDJL7R.js +0 -14
- package/dist/cdn/7BCR6TUO.js +0 -2
- package/dist/cdn/7GH7VSB2.js +0 -2
- package/dist/cdn/7PLV4QH6.js +0 -2
- package/dist/cdn/AO7BQHKC.js +0 -2
- package/dist/cdn/AXDZBBNL.js +0 -45
- package/dist/cdn/DDLZOMUY.js +0 -2
- package/dist/cdn/EECZLT6C.js +0 -166
- package/dist/cdn/ETRWZ3MS.js +0 -108
- package/dist/cdn/F2AHA4GB.js +0 -54
- package/dist/cdn/FX5JFRDL.js +0 -2
- package/dist/cdn/H7422XUG.js +0 -2
- package/dist/cdn/HB5A5R2E.js +0 -2
- package/dist/cdn/I6HNBTWY.js +0 -2
- package/dist/cdn/IG6YKZH3.js +0 -3
- package/dist/cdn/KMQ3SP4I.js +0 -5
- package/dist/cdn/MH5RPXHM.js +0 -2
- package/dist/cdn/NAUXSHIE.js +0 -72
- package/dist/cdn/NVI3I46B.js +0 -2
- package/dist/cdn/OAVEHGB6.js +0 -2
- package/dist/cdn/OH64RMOR.js +0 -4
- package/dist/cdn/P26NON3Z.js +0 -16
- package/dist/cdn/P6OPJQMC.js +0 -3
- package/dist/cdn/QR54T33D.js +0 -2
- package/dist/cdn/RVOAPUBN.js +0 -2
- package/dist/cdn/S3VPZFWQ.js +0 -36
- package/dist/cdn/SXDLXCIM.js +0 -2
- package/dist/cdn/USMDJUFS.js +0 -2
- package/dist/cdn/Y333DGV6.js +0 -2
- package/dist/cdn/YIMNOUTF.js +0 -2
package/dist/chunks/helpGraph.js
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
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 {
|
|
3
|
+
import { g as h, r as f, t as x, H as u } from "./adapter.js";
|
|
4
4
|
import "@arcgis/core/identity/IdentityManager.js";
|
|
5
5
|
import "@arcgis/core/portal/Portal.js";
|
|
6
|
-
import
|
|
6
|
+
import "@arcgis/core/request.js";
|
|
7
|
+
import "@arcgis/toolkit/string";
|
|
8
|
+
import { h as y } from "./generateLayerDescriptions.js";
|
|
7
9
|
import "@langchain/core/messages";
|
|
8
10
|
import "@langchain/core/callbacks/dispatch/web";
|
|
9
11
|
import "@langchain/openai";
|
|
12
|
+
import "@arcgis/core/config.js";
|
|
10
13
|
import "@arcgis/core/core/reactiveUtils.js";
|
|
11
14
|
import "@arcgis/core/layers/FeatureLayer.js";
|
|
12
|
-
import "
|
|
13
|
-
import {
|
|
15
|
+
import { f as p } from "./fetchService.js";
|
|
16
|
+
import { listLayerFieldsTool as S } from "../agents/tools/help/listFields/adapter.js";
|
|
17
|
+
import { h as E } from "./toolCallResponse.js";
|
|
18
|
+
import { ToolNode as T } from "@langchain/langgraph/prebuilt";
|
|
19
|
+
import { s as m } from "./index.js";
|
|
14
20
|
import "@langchain/core/prompts";
|
|
15
|
-
const
|
|
21
|
+
const c = [S], v = (e) => {
|
|
16
22
|
if (!e || e.size === 0)
|
|
17
23
|
return "No layers available in this map.";
|
|
18
24
|
const t = Array.from(e.values()).map(({ layerItem: r, fieldRegistry: s }, l) => {
|
|
@@ -25,26 +31,29 @@ const m = [h], v = (e) => {
|
|
|
25
31
|
return `This map contains ${e.size} layer(s):
|
|
26
32
|
|
|
27
33
|
${t}`;
|
|
28
|
-
},
|
|
34
|
+
}, C = (e) => {
|
|
29
35
|
const t = e?.list() ?? [];
|
|
30
36
|
return t.length ? t.map((r) => `- ${r.agent.name}: ${r.agent.description}`).join(`
|
|
31
37
|
`) : "No agents currently available.";
|
|
32
38
|
};
|
|
33
39
|
async function _(e, t) {
|
|
34
|
-
const r = await
|
|
40
|
+
const r = await h("help_prompt"), s = p(t, "layersAndFieldsRegistry"), l = p(t, "agentRegistry");
|
|
35
41
|
try {
|
|
36
|
-
const a = await
|
|
42
|
+
const a = await y({
|
|
37
43
|
promptText: r,
|
|
38
|
-
modelTier: "
|
|
39
|
-
|
|
44
|
+
modelTier: "default",
|
|
45
|
+
config: t,
|
|
46
|
+
tools: c,
|
|
40
47
|
inputVariables: {
|
|
41
48
|
layerSummary: v(s),
|
|
42
|
-
agents:
|
|
49
|
+
agents: C(l),
|
|
43
50
|
assignedTask: e.agentExecutionContext.assignedTask,
|
|
44
51
|
userRequest: e.agentExecutionContext.userRequest,
|
|
45
52
|
priorSteps: e.agentExecutionContext.priorSteps
|
|
46
53
|
}
|
|
47
|
-
})
|
|
54
|
+
});
|
|
55
|
+
await E(a, t);
|
|
56
|
+
const o = (a.tool_calls?.length ?? 0) > 0, n = typeof a.text == "string" ? a.text.trim() : "";
|
|
48
57
|
return {
|
|
49
58
|
...e,
|
|
50
59
|
helpInternalState: {
|
|
@@ -65,20 +74,20 @@ async function _(e, t) {
|
|
|
65
74
|
};
|
|
66
75
|
}
|
|
67
76
|
}
|
|
68
|
-
const
|
|
69
|
-
async function
|
|
70
|
-
const r = new
|
|
77
|
+
const H = (e, t) => f(["agentRegistry"], "Help Agent")(e, t);
|
|
78
|
+
async function b(e, t) {
|
|
79
|
+
const r = new T(c, { handleToolErrors: !1 });
|
|
71
80
|
try {
|
|
72
81
|
const s = e.helpInternalState.toolCallMessage;
|
|
73
82
|
if (!s)
|
|
74
83
|
throw new Error("helpToolCalling: missing helpInternalState.toolCallMessage");
|
|
75
84
|
const a = (await r.invoke({ messages: [s] }, t)).messages.map((o) => o.text).join(`
|
|
76
85
|
`);
|
|
77
|
-
return await
|
|
86
|
+
return await m({ text: `Finished executing help tool: ${a}` }, t), {
|
|
78
87
|
...e,
|
|
79
88
|
outputMessage: a,
|
|
80
89
|
status: "success",
|
|
81
|
-
summary: a ?
|
|
90
|
+
summary: a ? x(a) : "Help executed.",
|
|
82
91
|
helpInternalState: {
|
|
83
92
|
...e.helpInternalState,
|
|
84
93
|
toolCallMessage: void 0
|
|
@@ -86,7 +95,7 @@ async function H(e, t) {
|
|
|
86
95
|
};
|
|
87
96
|
} catch (s) {
|
|
88
97
|
const l = s instanceof Error ? s.message : String(s);
|
|
89
|
-
return await
|
|
98
|
+
return await m({ text: `Help tool execution failed: ${l}` }, t), {
|
|
90
99
|
...e,
|
|
91
100
|
outputMessage: `Help tool execution failed: ${l}`,
|
|
92
101
|
status: "failed",
|
|
@@ -98,7 +107,7 @@ async function H(e, t) {
|
|
|
98
107
|
};
|
|
99
108
|
}
|
|
100
109
|
}
|
|
101
|
-
const
|
|
110
|
+
const M = () => new d(u).addNode("requireHelpServices", H).addNode("agent", _).addNode("tools", b).addEdge(g, "requireHelpServices").addEdge("requireHelpServices", "agent").addConditionalEdges("agent", (t) => t.helpInternalState.toolCallMessage ? "tools" : i).addEdge("tools", i), k = String.raw`- **help** — Enables users to ask questions about the map, layers, fields, and it's capabilities.
|
|
102
111
|
|
|
103
112
|
_Example: “Tell me about this map”_
|
|
104
113
|
_Example: “List all layers in this map”_
|
|
@@ -107,17 +116,17 @@ const b = () => new d(u).addNode("requireHelpServices", C).addNode("agent", _).a
|
|
|
107
116
|
_Example: “What can you do?”_
|
|
108
117
|
_Example: “What can I ask”_
|
|
109
118
|
|
|
110
|
-
|
|
119
|
+
If the user asks unrelated queries like "What are the vowels in English alphabet" or "How to cook", call this agent so it can politely refuse and redirect to map-related questions.
|
|
111
120
|
|
|
112
|
-
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
|
|
121
|
+
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 that the requested action is not supported.
|
|
113
122
|
_Example: "Create a chart"_
|
|
114
|
-
_Example: "Create a table"_`,
|
|
123
|
+
_Example: "Create a table"_`, O = {
|
|
115
124
|
id: "help",
|
|
116
125
|
name: "Help Agent",
|
|
117
|
-
description:
|
|
118
|
-
createGraph:
|
|
126
|
+
description: k,
|
|
127
|
+
createGraph: M,
|
|
119
128
|
workspace: u
|
|
120
129
|
};
|
|
121
130
|
export {
|
|
122
|
-
|
|
131
|
+
O as H
|
|
123
132
|
};
|
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
const
|
|
2
|
+
const n = `## Who you are
|
|
3
3
|
|
|
4
|
-
|
|
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 — 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 — 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
|
|
5
26
|
|
|
6
27
|
Assigned task:
|
|
7
28
|
{assignedTask}
|
|
@@ -12,11 +33,13 @@ Latest user request:
|
|
|
12
33
|
Prior steps:
|
|
13
34
|
{priorSteps}
|
|
14
35
|
|
|
15
|
-
Use the assigned task as the primary instruction
|
|
16
|
-
Use the latest user request as supporting context
|
|
17
|
-
Use prior steps only
|
|
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
|
+
---
|
|
18
41
|
|
|
19
|
-
|
|
42
|
+
## Map Context
|
|
20
43
|
|
|
21
44
|
{layerSummary}
|
|
22
45
|
|
|
@@ -24,15 +47,6 @@ Use prior steps only when needed to explain a previous result, failure, or likel
|
|
|
24
47
|
|
|
25
48
|
{agents}
|
|
26
49
|
|
|
27
|
-
### Rules
|
|
28
|
-
|
|
29
|
-
- "What layers are in this map?" → List the layer names
|
|
30
|
-
- "What fields are in this layer?" → Call the tool to list the field names for that layer
|
|
31
|
-
- "What can you do?" / "What can I ask?" → Suggest specific queries using EXACT layer and field names from the context above
|
|
32
|
-
- "Tell me about this map" → Summarize layers and capabilities
|
|
33
|
-
- "Create a chart of all wells ans their depth" → If a question is map related but not supported by available capabilities, say so. Add that support for this might be added in the future.
|
|
34
|
-
- Questions completely unrelated to maps/GIS → Politely explain you only help with the map |
|
|
35
|
-
|
|
36
50
|
### Response Guidelines
|
|
37
51
|
|
|
38
52
|
When suggesting what users can ask, be SPECIFIC using actual layer names:
|
|
@@ -46,12 +60,15 @@ For "what can I ask" responses, provide 3-5 specific example queries using field
|
|
|
46
60
|
For off-topic questions:
|
|
47
61
|
"I can only help with this map. Try asking me to filter [LayerName] by [FieldName], or zoom to a location."
|
|
48
62
|
|
|
49
|
-
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Format
|
|
50
66
|
|
|
51
67
|
- Keep responses concise
|
|
52
68
|
- Use bullet points for lists
|
|
53
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
|
|
54
71
|
`;
|
|
55
72
|
export {
|
|
56
|
-
|
|
73
|
+
n as default
|
|
57
74
|
};
|
|
@@ -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", "the previous results", "this", "it", "that one", "this parcel", "this location", or "that feature", 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", "them", "this", or "it" 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,32 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import { NodeInterrupt as
|
|
2
|
+
import { NodeInterrupt as w, StateGraph as L, START as E, 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
|
|
5
|
+
import "@arcgis/core/request.js";
|
|
6
|
+
import "@arcgis/toolkit/string";
|
|
7
|
+
import { h as v } from "./generateLayerDescriptions.js";
|
|
6
8
|
import "@langchain/core/messages";
|
|
9
|
+
import { s as i } from "./index.js";
|
|
7
10
|
import "@langchain/openai";
|
|
11
|
+
import "@arcgis/core/config.js";
|
|
8
12
|
import "@arcgis/core/core/reactiveUtils.js";
|
|
9
13
|
import "@arcgis/core/layers/FeatureLayer.js";
|
|
10
|
-
import "@arcgis/core/request.js";
|
|
11
14
|
import "@langchain/core/prompts";
|
|
12
|
-
import { f as
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
15
|
+
import { f as g } from "./fetchService.js";
|
|
16
|
+
import { m as I, n as T, o as R, p as F, u as C, v as A, w as $, x as N, y as b, z as q, A as _, g as M, r as k, L as S } from "./adapter.js";
|
|
17
|
+
import { h as V } from "./toolCallResponse.js";
|
|
18
|
+
import { ToolNode as j } from "@langchain/langgraph/prebuilt";
|
|
19
|
+
const h = 0.7, z = 10, P = async (t, e) => {
|
|
16
20
|
try {
|
|
17
21
|
await i({ text: "Similarity search to find fields" }, e);
|
|
18
|
-
const r =
|
|
22
|
+
const r = g(e, "fieldSearch"), a = g(e, "layersAndFieldsRegistry"), o = g(e, "embeddingCache"), n = await r.searchFields({
|
|
19
23
|
text: t.agentExecutionContext.assignedTask,
|
|
20
24
|
layerIds: t.vectorSearchLayerIds,
|
|
21
25
|
minScore: h,
|
|
22
26
|
topResults: z,
|
|
23
27
|
embeddingCache: o
|
|
24
|
-
}), c = n.map(({ layerId: d, results:
|
|
25
|
-
const y =
|
|
28
|
+
}), c = n.map(({ layerId: d, results: p }) => {
|
|
29
|
+
const y = p.map((s) => ` - ${s.name} (${s.score.toFixed(2)})`).join(`
|
|
26
30
|
`);
|
|
27
31
|
return `${a.get(d)?.layerItem.name ?? d}:
|
|
28
32
|
${y}`;
|
|
@@ -40,16 +44,16 @@ ${c}` : l = `No vector search results found for score over ${h}.`, await i({ tex
|
|
|
40
44
|
e
|
|
41
45
|
), new Error(`Vector search failed: ${r instanceof Error ? r.message : String(r)}`);
|
|
42
46
|
}
|
|
43
|
-
},
|
|
47
|
+
}, D = 0.7, H = async (t, e) => {
|
|
44
48
|
try {
|
|
45
49
|
await i(
|
|
46
50
|
{ text: `Similarity search to find layers: ${t.agentExecutionContext.assignedTask}` },
|
|
47
51
|
e
|
|
48
52
|
);
|
|
49
|
-
const r =
|
|
53
|
+
const r = g(e, "layerSearch"), a = g(e, "layersAndFieldsRegistry"), o = await r.searchLayers({
|
|
50
54
|
text: t.agentExecutionContext.assignedTask,
|
|
51
|
-
minScore:
|
|
52
|
-
}), n = o.map((d) => d.id), c = o.map(({ id: d, score:
|
|
55
|
+
minScore: D
|
|
56
|
+
}), n = o.map((d) => d.id), c = o.map(({ id: d, score: p }) => `${a.get(d)?.layerItem.name ?? d} (${p.toFixed(2)})`).join(`
|
|
53
57
|
`);
|
|
54
58
|
let l;
|
|
55
59
|
return n.length > 0 ? l = `Vector search completed. Matching layers with scores:
|
|
@@ -64,9 +68,9 @@ ${c}` : l = "Vector search completed. No matching layers found.", await i({ text
|
|
|
64
68
|
), new Error(`Vector search failed: ${r instanceof Error ? r.message : String(r)}`);
|
|
65
69
|
}
|
|
66
70
|
}, f = [
|
|
67
|
-
|
|
68
|
-
R,
|
|
71
|
+
I,
|
|
69
72
|
T,
|
|
73
|
+
R,
|
|
70
74
|
F,
|
|
71
75
|
C,
|
|
72
76
|
A,
|
|
@@ -74,7 +78,7 @@ ${c}` : l = "Vector search completed. No matching layers found.", await i({ text
|
|
|
74
78
|
N,
|
|
75
79
|
b,
|
|
76
80
|
q,
|
|
77
|
-
|
|
81
|
+
_
|
|
78
82
|
], x = (t, e = 3) => {
|
|
79
83
|
const r = t.map((o, n) => o.type === "human" ? n : -1).filter((o) => o !== -1);
|
|
80
84
|
if (r.length === 0)
|
|
@@ -83,19 +87,20 @@ ${c}` : l = "Vector search completed. No matching layers found.", await i({ text
|
|
|
83
87
|
return t.slice(a);
|
|
84
88
|
}, G = async (t, e) => {
|
|
85
89
|
await i({ text: "Requesting LLM for layer query results" }, e);
|
|
86
|
-
const r = await
|
|
90
|
+
const r = await M("navigation_intent_prompt");
|
|
87
91
|
if (!e?.configurable)
|
|
88
92
|
throw new Error("config.configurable is required for layer query tools");
|
|
89
93
|
const a = {
|
|
90
94
|
layerFieldInfo: t.layerFieldInfo
|
|
91
|
-
}, o = await
|
|
95
|
+
}, o = await v({
|
|
92
96
|
promptText: r,
|
|
93
97
|
modelTier: "advanced",
|
|
98
|
+
config: e,
|
|
94
99
|
messages: x(t.agentExecutionContext.messages),
|
|
95
100
|
inputVariables: a,
|
|
96
101
|
tools: f
|
|
97
102
|
});
|
|
98
|
-
return await
|
|
103
|
+
return await V(o, e), {
|
|
99
104
|
...t,
|
|
100
105
|
agentExecutionContext: {
|
|
101
106
|
...t.agentExecutionContext,
|
|
@@ -103,8 +108,8 @@ ${c}` : l = "Vector search completed. No matching layers found.", await i({ text
|
|
|
103
108
|
}
|
|
104
109
|
};
|
|
105
110
|
};
|
|
106
|
-
async function
|
|
107
|
-
const a = await new
|
|
111
|
+
async function U(t, e) {
|
|
112
|
+
const a = await new j(f, { handleToolErrors: !1 }).invoke(
|
|
108
113
|
{
|
|
109
114
|
messages: x(t.agentExecutionContext.messages)
|
|
110
115
|
},
|
|
@@ -116,7 +121,7 @@ async function B(t, e) {
|
|
|
116
121
|
`);
|
|
117
122
|
return { ...t, outputMessage: n };
|
|
118
123
|
}
|
|
119
|
-
const
|
|
124
|
+
const B = async (t, e) => (await i({ text: "Exiting Layer Styling agent" }, e), t), O = async (t, e) => {
|
|
120
125
|
try {
|
|
121
126
|
await i({ text: "Populating layer and field info" }, e);
|
|
122
127
|
const r = [];
|
|
@@ -129,25 +134,25 @@ const U = async (t, e) => (await i({ text: "Exiting Layer Styling agent" }, e),
|
|
|
129
134
|
s.description && `Description: ${s.description}`
|
|
130
135
|
].filter(Boolean).join(" | ") : y;
|
|
131
136
|
};
|
|
132
|
-
const { layerId: n, results: c } = a, l =
|
|
137
|
+
const { layerId: n, results: c } = a, l = g(e, "layersAndFieldsRegistry"), d = l.get(n)?.fieldRegistry;
|
|
133
138
|
if (!d)
|
|
134
139
|
continue;
|
|
135
|
-
let
|
|
136
|
-
|
|
140
|
+
let p = r.find((y) => y.layerId === n);
|
|
141
|
+
p || (p = {
|
|
137
142
|
layerId: n,
|
|
138
143
|
layerSummary: o(n),
|
|
139
144
|
fieldInfos: []
|
|
140
|
-
}, r.push(
|
|
145
|
+
}, r.push(p));
|
|
141
146
|
for (const y of c) {
|
|
142
147
|
const s = d.get(y.name);
|
|
143
|
-
s &&
|
|
148
|
+
s && p.fieldInfos.push(s);
|
|
144
149
|
}
|
|
145
150
|
}
|
|
146
151
|
return await i({ text: "Populated layerFieldInfo" }, e), { ...t, layerFieldInfo: r };
|
|
147
152
|
} catch (r) {
|
|
148
153
|
throw await i({ text: "Error populating layerFieldInfo" }, e), new Error(`Error populating layerFieldInfo: ${r instanceof Error ? r.message : String(r)}`);
|
|
149
154
|
}
|
|
150
|
-
},
|
|
155
|
+
}, J = (t, e) => {
|
|
151
156
|
const r = t.vectorSearchLayerIds ?? [];
|
|
152
157
|
if (r.length <= 1)
|
|
153
158
|
return { ...t, selectedLayerId: t.vectorSearchLayerIds[0] };
|
|
@@ -160,14 +165,14 @@ const U = async (t, e) => (await i({ text: "Exiting Layer Styling agent" }, e),
|
|
|
160
165
|
message: "Choose a layer to apply the styles.",
|
|
161
166
|
metadata: [...r]
|
|
162
167
|
};
|
|
163
|
-
throw new
|
|
168
|
+
throw new w(n);
|
|
164
169
|
}
|
|
165
170
|
let o = null;
|
|
166
171
|
return Array.isArray(a.payload) && a.payload.length > 0 && (o = a.payload[0]), {
|
|
167
172
|
...t,
|
|
168
173
|
selectedLayerId: o ?? t.vectorSearchLayerIds[0]
|
|
169
174
|
};
|
|
170
|
-
},
|
|
175
|
+
}, K = (t, e) => k(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Layer Styling Agent")(t, e), Q = () => new L(S).addNode("requireLayerStylingServices", K).addNode("vectorSearchLayers", H).addNode("layerSelectionHITL", J).addNode("vectorSearchFields", P).addNode("populateLayerFieldInfo", O).addNode("agent", G).addNode("tools", U).addNode("earlyExit", B).addEdge(E, "requireLayerStylingServices").addEdge("requireLayerStylingServices", "vectorSearchLayers").addConditionalEdges(
|
|
171
176
|
"layerSelectionHITL",
|
|
172
177
|
(e) => e.vectorSearchLayerIds.length ? "vectorSearchFields" : "earlyExit"
|
|
173
178
|
).addConditionalEdges(
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
const r = (e, s, a) => {
|
|
3
|
+
if (!(a ? e.hasAllFeaturesInView : e.hasAllFeatures))
|
|
4
|
+
return !1;
|
|
5
|
+
const n = new Set((e.availableFields ?? []).map((t) => t.toLowerCase()));
|
|
6
|
+
return n.has("*") ? !0 : s.every((t) => n.has(t.toLowerCase()));
|
|
7
|
+
};
|
|
8
|
+
function u(e, s) {
|
|
9
|
+
let a = e ?? "";
|
|
10
|
+
return s != null && s && (a = a ? `(${a}) AND (${s})` : s), a || null;
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
r as c,
|
|
14
|
+
u as m
|
|
15
|
+
};
|