@arcgis/ai-components 5.2.0-next.9 → 5.2.0-next.91
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 +4 -2
- package/dist/agent-utils/WorkflowAgent.d.ts +2 -2
- package/dist/agent-utils/WorkflowAgent.js +14 -15
- 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 +189 -0
- package/dist/agentic-workflow/nodes/AgentNode.d.ts +28 -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/2PTPBAIN.js +2 -0
- package/dist/cdn/34O57OGV.js +2 -0
- package/dist/cdn/{AMP6IALT.js → 3UEKINYC.js} +1 -1
- package/dist/cdn/434TAA3J.js +2 -0
- package/dist/cdn/4EBLRHYE.js +2 -0
- package/dist/cdn/4HDDRBIY.js +2 -0
- package/dist/cdn/4KOV2NEI.js +9 -0
- package/dist/cdn/4NJ2FF7H.js +2 -0
- package/dist/cdn/4OGR5QKS.js +2 -0
- package/dist/cdn/4WIDLQUH.js +2 -0
- package/dist/cdn/5FL5BTTX.js +66 -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/6VJXUIXY.js +3 -0
- package/dist/cdn/7BCQMK6D.js +2 -0
- package/dist/cdn/7DFXYMEA.js +2 -0
- package/dist/cdn/7M6VKBTK.js +6 -0
- package/dist/cdn/7SRLZQVC.js +5 -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/AZCIDPML.js +2 -0
- package/dist/cdn/{FL4W4VYN.js → BL273EGZ.js} +17 -1
- package/dist/cdn/C5ZL5Z52.js +18 -0
- 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/COL6QYGQ.js +2 -0
- package/dist/cdn/CP5BVGJU.js +2 -0
- package/dist/cdn/CZM4URK7.js +2 -0
- package/dist/cdn/DP6O6PMH.js +2 -0
- package/dist/cdn/{V2P4AIGG.js → EKB7CAMM.js} +1 -1
- package/dist/cdn/EWLXNGKH.js +208 -0
- package/dist/cdn/EYNEYD34.js +2 -0
- package/dist/cdn/FDDQ67BG.js +2 -0
- package/dist/cdn/FDOMMK2M.js +2 -0
- package/dist/cdn/FQH3HOFH.js +2 -0
- package/dist/cdn/{GGSZM7KV.js → FUZ77UGP.js} +6 -4
- package/dist/cdn/{ZLXN7NMF.js → FYZATVB3.js} +10 -8
- package/dist/cdn/GFEOVHJK.js +2 -0
- package/dist/cdn/HHFNQR6Z.js +2 -0
- package/dist/cdn/HIPQ3VRW.js +2 -0
- package/dist/cdn/HKSFWTWK.js +14 -0
- package/dist/cdn/HMUWQCXU.js +2 -0
- package/dist/cdn/IBZ2NEAO.js +2 -0
- package/dist/cdn/{FX7UOGHP.js → ICBIUFK7.js} +1 -1
- 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/JJJZ7FOM.js +2 -0
- package/dist/cdn/JKIESH74.js +2 -0
- package/dist/cdn/JO5ETMPS.js +2 -0
- package/dist/cdn/K2R6XVK3.js +2 -0
- package/dist/cdn/KCU4FWF7.js +2 -0
- package/dist/cdn/KITIP6J2.js +2 -0
- package/dist/cdn/KWD2ECTM.js +2 -0
- package/dist/cdn/{7RCQFLPP.js → LK7ZIQW6.js} +1 -1
- package/dist/cdn/LLUGJKAQ.js +2 -0
- package/dist/cdn/LPR72QZF.js +36 -0
- package/dist/cdn/{DHOVCT6R.js → MKOQJXQQ.js} +1 -1
- package/dist/cdn/MWYBF3F3.js +66 -0
- package/dist/cdn/NEV6OZN3.js +71 -0
- package/dist/cdn/OAKRPM7D.js +2 -0
- package/dist/cdn/{23EQTPO3.js → OKVLGJAG.js} +1 -1
- package/dist/cdn/OL5656NI.js +2 -0
- package/dist/cdn/ONQ6JSBJ.js +2 -0
- package/dist/cdn/OWTGH34K.js +2 -0
- package/dist/cdn/OYSPNIJI.js +156 -0
- package/dist/cdn/PEYYWXFE.js +2 -0
- package/dist/cdn/PKUDO2RC.js +3 -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/QCFICJ7U.js +3 -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/RSNGZQCQ.js +2 -0
- package/dist/cdn/{X2ZDYHCG.js → SDWWUWAF.js} +10 -5
- package/dist/cdn/SHD6YFSR.js +2 -0
- package/dist/cdn/SUYWKYWI.js +22 -0
- package/dist/cdn/SZ2QSSB3.js +2 -0
- package/dist/cdn/T4RIGOXB.js +2 -0
- package/dist/cdn/{3PKJWIC3.js → TMZ6DF22.js} +1 -1
- package/dist/cdn/TPULIO6I.js +34 -0
- package/dist/cdn/U2D53TAX.js +14 -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/V6F3HEK7.js +2 -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/W5JPJWMM.js +2 -0
- package/dist/cdn/WKTQVBFJ.js +2 -0
- package/dist/cdn/WNNMKCKS.js +2 -0
- package/dist/cdn/WP7ORLSB.js +6 -0
- package/dist/cdn/WR2SQX3J.js +2 -0
- package/dist/cdn/X3COUAXY.js +4 -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/YQSU6IUO.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/{ZTBA5PM7.js → ZU2FHVNK.js} +1 -1
- package/dist/cdn/ZVGUAOXE.js +2 -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 +1299 -2113
- package/dist/chunks/arcgisKnowledgeGraph.js +128 -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 +133 -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 +35 -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 +37 -31
- package/dist/chunks/mergeWhereClauses.js +15 -0
- package/dist/chunks/navigationGraph.js +124 -103
- package/dist/chunks/navigation_intent_prompt.js +8 -2
- package/dist/chunks/orchestrator.js +298 -139
- 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 +14 -10
- package/dist/chunks/types.js +59 -0
- package/dist/chunks/utils2.js +11 -11
- package/dist/components/arcgis-assistant/customElement.d.ts +72 -0
- package/dist/components/arcgis-assistant/customElement.js +416 -172
- 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 +614 -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 +20 -4
- package/dist/components/arcgis-assistant-help-agent/customElement.js +29 -7
- 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 +40 -16
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +30 -7
- 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 +18 -4
- package/dist/components/arcgis-assistant-speech-input/customElement.js +34 -52
- 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/orchestrator/orchestrator/orchestratorEvents.d.ts +78 -0
- package/dist/types/lumina.d.ts +10 -8
- package/dist/types/preact.d.ts +10 -8
- package/dist/types/react.d.ts +10 -8
- package/dist/types/stencil.d.ts +12 -10
- package/dist/utils/index.d.ts +8 -8
- 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/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/I7SRZPVS.js +0 -72
- package/dist/cdn/IG6YKZH3.js +0 -3
- package/dist/cdn/JVIKKZND.js +0 -3
- package/dist/cdn/KMQ3SP4I.js +0 -5
- package/dist/cdn/MH5RPXHM.js +0 -2
- 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/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/TR7RL3IK.js +0 -2
- package/dist/cdn/USMDJUFS.js +0 -2
- package/dist/cdn/Y333DGV6.js +0 -2
- package/dist/cdn/YIMNOUTF.js +0 -2
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { tool as n } from "@langchain/core/tools";
|
|
3
|
+
import i from "zod";
|
|
4
|
+
import { f as l } from "../../../../chunks/fetchAgentContext.js";
|
|
5
|
+
const f = async (e) => {
|
|
6
|
+
e.map?.allLayers.filter((t) => t.type === "feature")?.forEach((t) => {
|
|
7
|
+
const s = t;
|
|
8
|
+
s.featureEffect && (s.featureEffect = null);
|
|
9
|
+
});
|
|
10
|
+
const o = e.map.initialViewProperties?.viewpoint?.targetGeometry;
|
|
11
|
+
return o ? (await e.goTo(o), "Cleared all filters and returned to home extent.") : "Cleared all filters. Could not determine home extent.";
|
|
12
|
+
}, p = async (e, r) => {
|
|
13
|
+
const { mapView: a } = l(r, ["mapView"]);
|
|
14
|
+
return await f(a);
|
|
15
|
+
}, h = n(p, {
|
|
16
|
+
name: "resetMap",
|
|
17
|
+
description: "Clears all feature effects/filters from the map AND zooms to the home extent (initial map view). Use when user says 'reset map', 'reset the map', 'start over', or wants to both clear filters and return to the initial view.",
|
|
18
|
+
schema: i.object({})
|
|
19
|
+
});
|
|
20
|
+
export {
|
|
21
|
+
h as resetMapTool
|
|
22
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import e from "zod";
|
|
3
|
+
import { tool as h } from "@langchain/core/tools";
|
|
4
|
+
import m from "@arcgis/core/layers/support/FeatureEffect.js";
|
|
5
|
+
import b from "@arcgis/core/layers/support/FeatureFilter.js";
|
|
6
|
+
import { g as y, d } from "../../../../chunks/types.js";
|
|
7
|
+
import { f as w } from "../../../../chunks/fetchAgentContext.js";
|
|
8
|
+
const g = async (t, o, u, n, r, c) => {
|
|
9
|
+
const a = t.map?.allLayers.find((i) => i.id === o);
|
|
10
|
+
if (!a)
|
|
11
|
+
return { success: !1, error: `Layer '${o}' not found.` };
|
|
12
|
+
const s = a.createQuery();
|
|
13
|
+
s.where = u ?? "1=1", n && (s.geometry = n, s.spatialRelationship = "intersects", r && (s.distance = r), c && (s.units = c));
|
|
14
|
+
try {
|
|
15
|
+
const { extent: i, count: l } = await a.queryExtent(s);
|
|
16
|
+
return !i || l === 0 ? {
|
|
17
|
+
success: !1,
|
|
18
|
+
error: `No features found for filter (where: ${s.where}${n ? ", spatial filter used" : ""})`
|
|
19
|
+
} : (await t.goTo(i), { success: !0 });
|
|
20
|
+
} catch (i) {
|
|
21
|
+
return {
|
|
22
|
+
success: !1,
|
|
23
|
+
error: i instanceof Error ? i.message : String(i)
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}, I = async (t, o, u, n, r, c) => {
|
|
27
|
+
const a = o.map?.allLayers.find(
|
|
28
|
+
(f) => f.id === t.layerId
|
|
29
|
+
);
|
|
30
|
+
if (!a)
|
|
31
|
+
return `Could not find target layer with ID: ${t.layerId}`;
|
|
32
|
+
let s;
|
|
33
|
+
if (r) {
|
|
34
|
+
const f = await y(r, o);
|
|
35
|
+
if ("error" in f)
|
|
36
|
+
return f.error;
|
|
37
|
+
s = f.geometry;
|
|
38
|
+
}
|
|
39
|
+
if (a.featureEffect = null, a.featureEffect = new m({
|
|
40
|
+
filter: new b({
|
|
41
|
+
...t.objectIds?.length ? { objectIds: t.objectIds } : { where: t.where },
|
|
42
|
+
geometry: s,
|
|
43
|
+
spatialRelationship: "intersects",
|
|
44
|
+
distance: r?.distance,
|
|
45
|
+
units: r?.units
|
|
46
|
+
}),
|
|
47
|
+
includedEffect: u,
|
|
48
|
+
excludedEffect: n
|
|
49
|
+
}), a.visible = !0, c)
|
|
50
|
+
return `Applied feature effects to "${a.title ?? t.layerId}" within current map extent.`;
|
|
51
|
+
const i = t.objectIds?.length ? `${a.objectIdField} IN (${t.objectIds.join(",")})` : t.where, l = await g(
|
|
52
|
+
o,
|
|
53
|
+
t.layerId,
|
|
54
|
+
i,
|
|
55
|
+
s,
|
|
56
|
+
r?.distance,
|
|
57
|
+
r?.units
|
|
58
|
+
), p = a.title ?? t.layerId;
|
|
59
|
+
return l.success ? `Applied feature effects to target layer "${a.title ?? t.layerId}"${r && "layerId" in r ? ` using geometry from layer "${r.layerId}"` : ""}.` : `Applied filter to "${p}" but no features matched. ${l.error}`;
|
|
60
|
+
}, v = async ({
|
|
61
|
+
targetLayer: t,
|
|
62
|
+
geometryFilter: o,
|
|
63
|
+
useCurrentExtent: u,
|
|
64
|
+
includedEffect: n = "drop-shadow(2px, 2px, 2px, gray)",
|
|
65
|
+
excludedEffect: r = "grayscale(100%) opacity(60%) blur(2px)"
|
|
66
|
+
}, c) => {
|
|
67
|
+
const { mapView: a } = w(c, ["mapView"]);
|
|
68
|
+
return await I(t, a, n, r, o, u);
|
|
69
|
+
}, x = e.object({
|
|
70
|
+
layerId: e.string().describe("The layerId of the layer containing the geometry by which to filter."),
|
|
71
|
+
where: e.string().describe("The SQL-92 where clause representing the features from which to filter."),
|
|
72
|
+
distance: e.number().optional().describe("The buffer distance around the geometry."),
|
|
73
|
+
units: d.optional().describe("The units for the distance buffer.")
|
|
74
|
+
}), j = e.object({
|
|
75
|
+
point: e.object({
|
|
76
|
+
x: e.number().describe("X coordinate (longitude) from navigation result"),
|
|
77
|
+
y: e.number().describe("Y coordinate (latitude) from navigation result"),
|
|
78
|
+
spatialReference: e.object({
|
|
79
|
+
wkid: e.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
|
|
80
|
+
}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
|
|
81
|
+
}).describe("Point coordinates from a previous navigation/geocoding result"),
|
|
82
|
+
distance: e.number().optional().describe("Optional buffer distance around the point."),
|
|
83
|
+
units: d.optional().describe("The units for the distance buffer.")
|
|
84
|
+
}), E = e.object({
|
|
85
|
+
targetLayer: e.object({
|
|
86
|
+
layerId: e.string().describe("The layerId of the layer on which to set a feature effect."),
|
|
87
|
+
where: e.string().describe("The SQL-92 where clause representing the features to emphasize."),
|
|
88
|
+
objectIds: e.array(e.number()).optional().describe(
|
|
89
|
+
"Array of objectIds from a previous query result. Use this instead of a where clause when the query returned objectIds (e.g. top N results). If provided, takes precedence over where clause."
|
|
90
|
+
)
|
|
91
|
+
}),
|
|
92
|
+
geometryFilter: e.union([x, j]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
|
|
93
|
+
useCurrentExtent: e.boolean().optional().describe(
|
|
94
|
+
"Set to true when the previous query used the current map extent as a spatial filter. This ensures the feature effect applies only to features visible in the current view. Default is false."
|
|
95
|
+
),
|
|
96
|
+
includedEffect: e.string().default("drop-shadow(2px, 2px, 2px, gray)").describe(
|
|
97
|
+
"The effect applied to features that meet the filter requirements. Valid effects include: bloom, blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, and sepia. Prefer default unless specified."
|
|
98
|
+
),
|
|
99
|
+
excludedEffect: e.string().default("grayscale(100%) opacity(60%) blur(2px)").describe(
|
|
100
|
+
"The effect applied to features that do not meet the filter requirements. Valid effects include: bloom, blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, and sepia. Prefer default unless specified."
|
|
101
|
+
)
|
|
102
|
+
}), A = h(v, {
|
|
103
|
+
name: "setFeatureEffect",
|
|
104
|
+
description: "Sets a feature effect on a given layer with given filter parameters and feature effects to emphasize certain features that meet a filter requirement. If no feature effect information is provided, then use the default effect provided.",
|
|
105
|
+
schema: E
|
|
106
|
+
});
|
|
107
|
+
export {
|
|
108
|
+
A as setFeatureEffectTool
|
|
109
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { StructuredToolInterface } from "@langchain/core/tools";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Lists registered fields for a user-specified layer.
|
|
5
|
+
*
|
|
6
|
+
* Use only when the user explicitly requests fields, columns, or attributes
|
|
7
|
+
* for a named layer.
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export const listLayerFieldsTool: StructuredToolInterface;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { tool as n } from "@langchain/core/tools";
|
|
3
|
+
import s from "zod";
|
|
4
|
+
import { f as c } from "../../../../chunks/fetchService.js";
|
|
5
|
+
const y = (i, r) => {
|
|
6
|
+
const t = Array.from(i.values()).find(
|
|
7
|
+
({ layerItem: e }) => e.title?.toLowerCase().includes(r.toLowerCase())
|
|
8
|
+
);
|
|
9
|
+
if (!t) {
|
|
10
|
+
const e = Array.from(i.values()).map((o) => o.layerItem.title).join(", ");
|
|
11
|
+
return `Could not find a layer matching "${r}". Available layers: ${e}`;
|
|
12
|
+
}
|
|
13
|
+
const l = Array.from(t.fieldRegistry.values()), a = l.map((e) => `- **${e.alias || e.name}** (\`${e.name}\`, ${e.type})${e.description ? `: ${e.description}` : ""}`).join(`
|
|
14
|
+
`);
|
|
15
|
+
return `**${t.layerItem.title}** has ${l.length} field(s):
|
|
16
|
+
|
|
17
|
+
${a}`;
|
|
18
|
+
}, d = ({ layerTitle: i }, r) => {
|
|
19
|
+
const t = c(r, "layersAndFieldsRegistry");
|
|
20
|
+
return y(t, i);
|
|
21
|
+
}, u = n(d, {
|
|
22
|
+
name: "listLayerFields",
|
|
23
|
+
description: "Lists all fields for a given layer by title. Use ONLY when the user explicitly asks to see fields, columns, or attributes of a specific named layer. Do NOT call this tool for general help questions, capability overviews, or layer listing.",
|
|
24
|
+
schema: s.object({
|
|
25
|
+
layerTitle: s.string().describe("The title or partial title of the layer to list fields for.")
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
export {
|
|
29
|
+
u as listLayerFieldsTool
|
|
30
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { StructuredToolInterface } from "@langchain/core/tools";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A tool that geocodes an address or place name and navigates the map to the result.
|
|
5
|
+
* It uses the map view provided by the agent's runtime context.
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
8
|
+
* @since 5.2
|
|
9
|
+
*/
|
|
10
|
+
export const goToAddressTool: StructuredToolInterface;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { tool as p } from "@langchain/core/tools";
|
|
3
|
+
import r from "@arcgis/core/config.js";
|
|
4
|
+
import f from "@arcgis/core/Graphic.js";
|
|
5
|
+
import u from "@arcgis/core/portal/Portal.js";
|
|
6
|
+
import { addressToLocations as S } from "@arcgis/core/rest/locator.js";
|
|
7
|
+
import v from "@arcgis/core/symbols/PictureMarkerSymbol.js";
|
|
8
|
+
import { f as w } from "../../../../chunks/fetchAgentContext.js";
|
|
9
|
+
import c from "zod";
|
|
10
|
+
async function y(e, t) {
|
|
11
|
+
const a = u.getDefault().helperServices, n = a.geocode.find((h) => h.name === "ArcGIS World Geocoding Service") ?? a.geocode[0];
|
|
12
|
+
if (!n)
|
|
13
|
+
throw new Error("No geocoding service found in helperServices.");
|
|
14
|
+
const i = n.url, d = `${r.assetsPath?.endsWith("/") ? r.assetsPath : `${r.assetsPath}/`}esri/images/search/search-symbol-32.png`, o = (await S(i, {
|
|
15
|
+
address: { SingleLine: e },
|
|
16
|
+
outFields: ["Match_addr"]
|
|
17
|
+
}))?.[0];
|
|
18
|
+
if (!o?.extent || !o.location)
|
|
19
|
+
throw new Error(`Could not find location for: ${e}`);
|
|
20
|
+
const l = new v({
|
|
21
|
+
url: d,
|
|
22
|
+
width: 24,
|
|
23
|
+
height: 24
|
|
24
|
+
}), m = new f({
|
|
25
|
+
geometry: o.location,
|
|
26
|
+
symbol: l
|
|
27
|
+
});
|
|
28
|
+
t.graphics.removeAll(), t.graphics.add(m), await t.goTo(o.extent);
|
|
29
|
+
const g = {
|
|
30
|
+
address: o.address ?? "",
|
|
31
|
+
location: o.location ? o.location.toJSON() : null,
|
|
32
|
+
extent: o.extent ? o.extent.toJSON() : null
|
|
33
|
+
};
|
|
34
|
+
return {
|
|
35
|
+
text: `Successfully zoomed to ${e}.`,
|
|
36
|
+
sharedStatePatch: { lastResolvedLocation: { value: g } }
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
async function T({ address: e }, t) {
|
|
40
|
+
const { mapView: s } = w(t, ["mapView"]);
|
|
41
|
+
return await y(e, s);
|
|
42
|
+
}
|
|
43
|
+
const x = c.object({
|
|
44
|
+
address: c.string().describe("The full address or place name to locate.")
|
|
45
|
+
}), E = p(T, {
|
|
46
|
+
name: "goToAddress",
|
|
47
|
+
description: "Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",
|
|
48
|
+
schema: x
|
|
49
|
+
});
|
|
50
|
+
export {
|
|
51
|
+
E as goToAddressTool
|
|
52
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { z as i } from "zod";
|
|
3
|
+
import { tool as k } from "@langchain/core/tools";
|
|
4
|
+
import { f as s } from "../../../../chunks/fetchAgentContext.js";
|
|
5
|
+
async function c(o, t) {
|
|
6
|
+
const e = t.map.bookmarks;
|
|
7
|
+
if (!e || e.length === 0)
|
|
8
|
+
throw new Error("No bookmarks found in the map.");
|
|
9
|
+
const n = e.find((m) => m.name === o);
|
|
10
|
+
if (!n)
|
|
11
|
+
throw new Error(`Bookmark with name "${o}" not found.`);
|
|
12
|
+
const a = n.viewpoint;
|
|
13
|
+
if (!a)
|
|
14
|
+
throw new Error(`Bookmark with name "${o}" does not have a valid viewpoint.`);
|
|
15
|
+
return await t.goTo(a), { text: `Navigated to bookmark: ${o}` };
|
|
16
|
+
}
|
|
17
|
+
async function h({ bookmarkName: o }, t) {
|
|
18
|
+
const { mapView: r } = s(t, ["mapView"]);
|
|
19
|
+
return await Promise.resolve(c(o, r));
|
|
20
|
+
}
|
|
21
|
+
const w = i.object({
|
|
22
|
+
bookmarkName: i.string().describe("The name of the bookmark to navigate to.")
|
|
23
|
+
}), b = k(h, {
|
|
24
|
+
name: "goToBookmark",
|
|
25
|
+
description: "Go to the extent of the bookmark with the given name.",
|
|
26
|
+
schema: w
|
|
27
|
+
});
|
|
28
|
+
export {
|
|
29
|
+
b as goToBookmarkTool
|
|
30
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { z as i } from "zod";
|
|
3
|
+
import { tool as u } from "@langchain/core/tools";
|
|
4
|
+
import { f as c } from "../../../../chunks/fetchAgentContext.js";
|
|
5
|
+
async function f(o, a, n) {
|
|
6
|
+
const e = n.map?.allLayers.find((r) => r.id === o);
|
|
7
|
+
if (!e)
|
|
8
|
+
return { text: `Error: Layer with id ${o} not found` };
|
|
9
|
+
const t = a?.trim() ? a : "1=1", l = e.createQuery();
|
|
10
|
+
l.where = t;
|
|
11
|
+
try {
|
|
12
|
+
const { extent: r, count: s } = await e.queryExtent(l);
|
|
13
|
+
if (s === 0)
|
|
14
|
+
return { text: `No features found in ${e.title} matching: ${t}`, where: t };
|
|
15
|
+
if (r)
|
|
16
|
+
await n.goTo(r);
|
|
17
|
+
else
|
|
18
|
+
return { text: `Error: Unable to determine extent for ${e.title}`, where: t };
|
|
19
|
+
const d = {
|
|
20
|
+
layerId: o,
|
|
21
|
+
layerTitle: e.title ?? o,
|
|
22
|
+
where: t,
|
|
23
|
+
count: s
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
text: `Successfully zoomed to ${s} feature(s) in ${e.title} matching: ${t}`,
|
|
27
|
+
where: t,
|
|
28
|
+
sharedStatePatch: { lastNavigatedFeatures: { value: d } }
|
|
29
|
+
};
|
|
30
|
+
} catch (r) {
|
|
31
|
+
return console.error("Error in goToFeatures:", r), { text: `Error: ${r instanceof Error ? r.message : "Unknown error"}`, where: t };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async function h({ layerId: o, where: a }, n) {
|
|
35
|
+
const { mapView: e } = c(n, ["mapView"]);
|
|
36
|
+
return await f(o, a, e);
|
|
37
|
+
}
|
|
38
|
+
const m = i.object({
|
|
39
|
+
layerId: i.string().describe("The layerId of the layer to zoom to."),
|
|
40
|
+
where: i.string().describe(
|
|
41
|
+
"ArcGIS SQL-92 WHERE expression used for `query.where` on the selected layer. Start with a fresh filter for the current request unless the task explicitly refers to prior results. Use only field name values from the selected layer, not aliases. Use field metadata only to interpret intent: prefer LIKE '%value%' for string fields, and use =, <, >, BETWEEN, IN, IS NULL, AND/OR/NOT as appropriate for number/date fields. For coded-value domain fields, use the domain code already provided in layerInfo.domain.codedValues, never the display label. Respect range-domain bounds when they are provided. Do NOT include subqueries, nested SELECT, JOIN, GROUP BY, HAVING, ORDER BY, or semicolons."
|
|
42
|
+
)
|
|
43
|
+
}), E = u(h, {
|
|
44
|
+
name: "goToFeatures",
|
|
45
|
+
description: "Go to the features that match the given filter for the given layerId. Use coded-value domain codes from layer field metadata when building the WHERE clause.",
|
|
46
|
+
schema: m
|
|
47
|
+
});
|
|
48
|
+
export {
|
|
49
|
+
E as goToFeaturesTool
|
|
50
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { z as n } from "zod";
|
|
3
|
+
import r from "@arcgis/core/geometry/Extent.js";
|
|
4
|
+
import { tool as i } from "@langchain/core/tools";
|
|
5
|
+
import { f as l } from "../../../../chunks/fetchAgentContext.js";
|
|
6
|
+
async function m(o) {
|
|
7
|
+
const t = new r({
|
|
8
|
+
xmin: -180,
|
|
9
|
+
ymin: -90,
|
|
10
|
+
xmax: 180,
|
|
11
|
+
ymax: 90,
|
|
12
|
+
spatialReference: { wkid: 4326 }
|
|
13
|
+
}).expand(0.7);
|
|
14
|
+
return await o.goTo(t), { text: "Successfully zoomed to world extent" };
|
|
15
|
+
}
|
|
16
|
+
async function a(o, e) {
|
|
17
|
+
const { mapView: t } = l(e, ["mapView"]);
|
|
18
|
+
return await m(t);
|
|
19
|
+
}
|
|
20
|
+
const c = n.object({}), f = i(a, {
|
|
21
|
+
name: "goToFullExtent",
|
|
22
|
+
description: "Zooms the map to the full world extent using Esri's Geocoding Service.",
|
|
23
|
+
schema: c
|
|
24
|
+
});
|
|
25
|
+
export {
|
|
26
|
+
f as goToFullExtentTool
|
|
27
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { tool as n } from "@langchain/core/tools";
|
|
3
|
+
import i from "zod";
|
|
4
|
+
import { f as r } from "../../../../chunks/fetchAgentContext.js";
|
|
5
|
+
async function a(e) {
|
|
6
|
+
const t = e.map.initialViewProperties?.viewpoint?.targetGeometry;
|
|
7
|
+
if (t)
|
|
8
|
+
await e.goTo(t);
|
|
9
|
+
else
|
|
10
|
+
throw new Error("Initial extent is undefined");
|
|
11
|
+
return { text: "Successfully zoomed to home extent" };
|
|
12
|
+
}
|
|
13
|
+
async function m(e, o) {
|
|
14
|
+
const { mapView: t } = r(o, ["mapView"]);
|
|
15
|
+
return await a(t);
|
|
16
|
+
}
|
|
17
|
+
const c = i.object({}), w = n(m, {
|
|
18
|
+
name: "goToHomeExtent",
|
|
19
|
+
description: "Go to the initial web map view extent",
|
|
20
|
+
schema: c
|
|
21
|
+
});
|
|
22
|
+
export {
|
|
23
|
+
w as goToHomeExtentTool
|
|
24
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { z as r } from "zod";
|
|
3
|
+
import { tool as i } from "@langchain/core/tools";
|
|
4
|
+
import { f as c } from "../../../../chunks/fetchAgentContext.js";
|
|
5
|
+
async function l(o, t) {
|
|
6
|
+
await t.when();
|
|
7
|
+
const e = t.map?.allLayers.find((n) => n.id === o);
|
|
8
|
+
if (!e)
|
|
9
|
+
return console.warn(`[goToLayer] No matching FeatureLayer found for: ${o}`), { text: `Could not find layer for: ${o}` };
|
|
10
|
+
let a;
|
|
11
|
+
return (e.type === "link-chart" || e.type === "knowledge-graph-sublayer") && t.map?.activeLinkChartLayer ? a = t.map.diagramNodesExtent : a = e.fullExtent, a ? (await t.goTo(a), e.visible = !0, { text: `Successfully zoomed to: ${e.title ?? ""}` }) : { text: "Layer has no defined extent. Cannot zoom to layer." };
|
|
12
|
+
}
|
|
13
|
+
async function f({ layerId: o }, t) {
|
|
14
|
+
const { mapView: e } = c(t, ["mapView"]);
|
|
15
|
+
return await l(o, e);
|
|
16
|
+
}
|
|
17
|
+
const s = r.object({
|
|
18
|
+
layerId: r.string().describe("The id of the layer to navigate to")
|
|
19
|
+
}), h = i(f, {
|
|
20
|
+
name: "goToLayer",
|
|
21
|
+
description: "Zooms the map view to the full extent of the top matching layer.",
|
|
22
|
+
schema: s
|
|
23
|
+
});
|
|
24
|
+
export {
|
|
25
|
+
h as goToLayerTool
|
|
26
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import t from "zod";
|
|
3
|
+
import { tool as a } from "@langchain/core/tools";
|
|
4
|
+
import { f as i } from "../../../../chunks/fetchAgentContext.js";
|
|
5
|
+
async function n(o, e) {
|
|
6
|
+
return await e.goTo({ scale: o }), { text: `Successfully zoomed to: ${o}` };
|
|
7
|
+
}
|
|
8
|
+
async function r({ scale: o }, e) {
|
|
9
|
+
const { mapView: c } = i(e, ["mapView"]);
|
|
10
|
+
return await n(o, c);
|
|
11
|
+
}
|
|
12
|
+
const m = t.object({
|
|
13
|
+
scale: t.number().describe("The map scale of the view to go to.")
|
|
14
|
+
}), f = a(r, {
|
|
15
|
+
name: "goToScale",
|
|
16
|
+
description: "Go to the specified view scale.",
|
|
17
|
+
schema: m
|
|
18
|
+
});
|
|
19
|
+
export {
|
|
20
|
+
f as goToScaleTool
|
|
21
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import t from "zod";
|
|
3
|
+
import { tool as c } from "@langchain/core/tools";
|
|
4
|
+
import l from "@arcgis/core/geometry/Point.js";
|
|
5
|
+
import { f as r } from "../../../../chunks/fetchAgentContext.js";
|
|
6
|
+
async function m(e, a, o) {
|
|
7
|
+
const i = {
|
|
8
|
+
target: new l({
|
|
9
|
+
longitude: e.longitude,
|
|
10
|
+
latitude: e.latitude,
|
|
11
|
+
spatialReference: { wkid: 4326 }
|
|
12
|
+
})
|
|
13
|
+
};
|
|
14
|
+
return o?.zoom !== void 0 && (i.zoom = o.zoom), o?.scale !== void 0 && (i.scale = o.scale), await a.goTo(i), { text: `Successfully navigated to: ${[
|
|
15
|
+
`(${e.latitude}°, ${e.longitude}°)`,
|
|
16
|
+
o?.zoom !== void 0 ? `zoom ${o.zoom}` : "",
|
|
17
|
+
o?.scale !== void 0 ? `scale 1:${o.scale}` : ""
|
|
18
|
+
].filter(Boolean).join(", ")}` };
|
|
19
|
+
}
|
|
20
|
+
async function d({
|
|
21
|
+
center: e,
|
|
22
|
+
zoom: a,
|
|
23
|
+
scale: o
|
|
24
|
+
}, n) {
|
|
25
|
+
const { mapView: i } = r(n, ["mapView"]);
|
|
26
|
+
return await m(e, i, { zoom: a, scale: o });
|
|
27
|
+
}
|
|
28
|
+
const s = t.object({
|
|
29
|
+
center: t.object({
|
|
30
|
+
longitude: t.number().describe("The longitude (x-coordinate) of the point to navigate to."),
|
|
31
|
+
latitude: t.number().describe("The latitude (y-coordinate) of the point to navigate to.")
|
|
32
|
+
}),
|
|
33
|
+
zoom: t.number().optional().describe("The zoom level. Higher values = more zoomed in."),
|
|
34
|
+
scale: t.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")
|
|
35
|
+
}), T = c(d, {
|
|
36
|
+
name: "goToViewpoint",
|
|
37
|
+
description: "Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",
|
|
38
|
+
schema: s
|
|
39
|
+
});
|
|
40
|
+
export {
|
|
41
|
+
T as goToViewpointTool
|
|
42
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import t from "zod";
|
|
3
|
+
import { tool as m } from "@langchain/core/tools";
|
|
4
|
+
import { f as i } from "../../../../chunks/fetchAgentContext.js";
|
|
5
|
+
async function r(o, e) {
|
|
6
|
+
return await e.goTo({ zoom: o }), { text: `Successfully zoomed to: ${o}` };
|
|
7
|
+
}
|
|
8
|
+
async function a({ zoom: o }, e) {
|
|
9
|
+
const { mapView: n } = i(e, ["mapView"]);
|
|
10
|
+
return await r(o, n);
|
|
11
|
+
}
|
|
12
|
+
const c = t.object({
|
|
13
|
+
zoom: t.number().min(1).max(20).describe("The zoom level of the view to go to.")
|
|
14
|
+
}), l = m(a, {
|
|
15
|
+
name: "goToZoom",
|
|
16
|
+
description: 'Go to the specified zoom level. If input is generic (e.g. "zoom in", then only zoom to the next appropriate level - increase level for zooming in and decrease for zooming out.).',
|
|
17
|
+
schema: c
|
|
18
|
+
});
|
|
19
|
+
export {
|
|
20
|
+
l as goToZoomTool
|
|
21
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { tool as f } from "@langchain/core/tools";
|
|
3
|
+
import i from "zod";
|
|
4
|
+
import { f as h, g } from "../../../../chunks/formatFeatureAttributes.js";
|
|
5
|
+
import { f as y } from "../../../../chunks/fetchAgentContext.js";
|
|
6
|
+
const b = (a, e, o) => {
|
|
7
|
+
const t = a.createQuery();
|
|
8
|
+
return t.outFields = [e], t.where = o || "1=1", t.num = 1, t;
|
|
9
|
+
}, d = async (a, e, o, t) => {
|
|
10
|
+
const r = t.map?.allLayers.find((m) => m.id === a), n = b(r, e, o.where), u = (await r.queryFeatures(n)).features[0], c = u ? u.attributes[e] : null, l = h(r, e, c, t.timeZone), s = g(r, e);
|
|
11
|
+
return {
|
|
12
|
+
tool: "getAttribute",
|
|
13
|
+
layerName: r.title ?? a,
|
|
14
|
+
summary: `${s} = ${l}`,
|
|
15
|
+
details: {
|
|
16
|
+
fieldName: e,
|
|
17
|
+
fieldAlias: s !== e ? s : void 0,
|
|
18
|
+
value: l,
|
|
19
|
+
where: o.where
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
async function p({ layerId: a, fieldName: e, query: o }, t) {
|
|
24
|
+
const { mapView: r } = y(t, ["mapView"]), n = await d(a, e, o, r);
|
|
25
|
+
return JSON.stringify(n, null, 2);
|
|
26
|
+
}
|
|
27
|
+
const w = i.object({
|
|
28
|
+
layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
|
|
29
|
+
fieldName: i.string().describe("The name of the field/attribute from which to get a field value."),
|
|
30
|
+
query: i.object({
|
|
31
|
+
where: i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
|
|
32
|
+
})
|
|
33
|
+
}), Q = f(p, {
|
|
34
|
+
name: "getAttribute",
|
|
35
|
+
description: "Returns an attribute value for a given feature.",
|
|
36
|
+
schema: w
|
|
37
|
+
});
|
|
38
|
+
export {
|
|
39
|
+
Q as getAttributeTool
|
|
40
|
+
};
|