@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
|
@@ -1,19 +1,623 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import { c as
|
|
3
|
-
import { LitElement as
|
|
4
|
-
import {
|
|
5
|
-
|
|
2
|
+
import { c as q } from "../../chunks/runtime.js";
|
|
3
|
+
import { LitElement as M } from "@arcgis/lumina";
|
|
4
|
+
import { b as W, i as L } from "../../chunks/utils2.js";
|
|
5
|
+
import C from "@arcgis/core/portal/PortalItem.js";
|
|
6
|
+
import j from "@arcgis/core/portal/Portal.js";
|
|
7
|
+
import { property as n, subclass as l } from "@arcgis/core/core/accessorSupport/decorators.js";
|
|
8
|
+
import { BaseAgent as G } from "../../agent-utils/BaseAgent.js";
|
|
9
|
+
import b from "@arcgis/core/core/Error.js";
|
|
10
|
+
import { z as c } from "zod";
|
|
11
|
+
import { c as B } from "../../chunks/graph.js";
|
|
12
|
+
import T from "@arcgis/core/core/Accessor.js";
|
|
13
|
+
import { LLMAgent as z } from "../../agent-utils/LLMAgent.js";
|
|
14
|
+
import { PromptTemplate as Z } from "@langchain/core/prompts";
|
|
15
|
+
import { Annotation as x } from "@langchain/langgraph";
|
|
16
|
+
import { b as H, d as U } from "../../chunks/state.js";
|
|
17
|
+
import "@arcgis/core/identity/IdentityManager.js";
|
|
18
|
+
import "@arcgis/core/request.js";
|
|
19
|
+
import "@langchain/langgraph/web";
|
|
20
|
+
import "@arcgis/toolkit/string";
|
|
21
|
+
import "../../chunks/generateLayerDescriptions.js";
|
|
22
|
+
import "@langchain/core/messages";
|
|
23
|
+
import "@langchain/core/callbacks/dispatch/web";
|
|
24
|
+
import "@langchain/core/callbacks/base";
|
|
25
|
+
import "@langchain/openai";
|
|
26
|
+
import "@arcgis/core/config.js";
|
|
27
|
+
import "@arcgis/core/core/reactiveUtils.js";
|
|
28
|
+
import "@arcgis/core/layers/FeatureLayer.js";
|
|
29
|
+
import { a as V } from "../../chunks/baseAgentState.js";
|
|
30
|
+
var K = Object.defineProperty, Q = Object.getOwnPropertyDescriptor, f = (e, t, r, s) => {
|
|
31
|
+
for (var o = s > 1 ? void 0 : s ? Q(t, r) : t, a = e.length - 1, i; a >= 0; a--)
|
|
32
|
+
(i = e[a]) && (o = (s ? i(t, r, o) : i(o)) || o);
|
|
33
|
+
return s && o && K(t, r, o), o;
|
|
34
|
+
};
|
|
35
|
+
let p = class extends T {
|
|
36
|
+
//#region Lifecycle
|
|
37
|
+
constructor(e) {
|
|
38
|
+
super(e);
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region Public Methods
|
|
42
|
+
static fromJSON(e) {
|
|
43
|
+
return new p({
|
|
44
|
+
id: e.id,
|
|
45
|
+
sourceAnchorId: e.source_anchor_id,
|
|
46
|
+
sourceNodeId: e.source_node_id,
|
|
47
|
+
targetAnchorId: e.target_anchor_id,
|
|
48
|
+
targetNodeId: e.target_node_id
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
};
|
|
53
|
+
f([
|
|
54
|
+
n()
|
|
55
|
+
], p.prototype, "id", 2);
|
|
56
|
+
f([
|
|
57
|
+
n()
|
|
58
|
+
], p.prototype, "sourceAnchorId", 2);
|
|
59
|
+
f([
|
|
60
|
+
n()
|
|
61
|
+
], p.prototype, "sourceNodeId", 2);
|
|
62
|
+
f([
|
|
63
|
+
n()
|
|
64
|
+
], p.prototype, "targetAnchorId", 2);
|
|
65
|
+
f([
|
|
66
|
+
n()
|
|
67
|
+
], p.prototype, "targetNodeId", 2);
|
|
68
|
+
p = f([
|
|
69
|
+
l("Edge")
|
|
70
|
+
], p);
|
|
71
|
+
var X = Object.defineProperty, Y = Object.getOwnPropertyDescriptor, v = (e, t, r, s) => {
|
|
72
|
+
for (var o = s > 1 ? void 0 : s ? Y(t, r) : t, a = e.length - 1, i; a >= 0; a--)
|
|
73
|
+
(i = e[a]) && (o = (s ? i(t, r, o) : i(o)) || o);
|
|
74
|
+
return s && o && X(t, r, o), o;
|
|
75
|
+
};
|
|
76
|
+
let u = class extends T {
|
|
77
|
+
//#region Lifecycle
|
|
78
|
+
constructor(e) {
|
|
79
|
+
super(e);
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region Public Methods
|
|
83
|
+
async load() {
|
|
84
|
+
return await Promise.resolve(this);
|
|
85
|
+
}
|
|
86
|
+
compile(e) {
|
|
87
|
+
return {
|
|
88
|
+
runtimeNode: this.createRuntimeNode(),
|
|
89
|
+
edges: e.outgoingEdges.map((t) => ({
|
|
90
|
+
from: this.id,
|
|
91
|
+
to: t.targetNodeId
|
|
92
|
+
}))
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
static fromJSON(e) {
|
|
96
|
+
throw new Error("BaseNode is abstract and cannot be instantiated directly.");
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region Private Methods
|
|
100
|
+
//#endregion
|
|
101
|
+
};
|
|
102
|
+
v([
|
|
103
|
+
n()
|
|
104
|
+
], u.prototype, "id", 2);
|
|
105
|
+
v([
|
|
106
|
+
n()
|
|
107
|
+
], u.prototype, "label", 2);
|
|
108
|
+
v([
|
|
109
|
+
n()
|
|
110
|
+
], u.prototype, "type", 2);
|
|
111
|
+
u = v([
|
|
112
|
+
l("BaseNode")
|
|
113
|
+
], u);
|
|
114
|
+
function I(e) {
|
|
115
|
+
const t = new Set(e.required), r = Object.fromEntries(
|
|
116
|
+
Object.entries(e.properties).map(([s, o]) => {
|
|
117
|
+
const a = $(o);
|
|
118
|
+
return [s, t.has(s) ? a : a.optional()];
|
|
119
|
+
})
|
|
120
|
+
);
|
|
121
|
+
return c.object(r);
|
|
122
|
+
}
|
|
123
|
+
function $(e) {
|
|
124
|
+
let t;
|
|
125
|
+
switch (e.type) {
|
|
126
|
+
case "array":
|
|
127
|
+
t = c.array(e.items ? $(e.items) : c.unknown());
|
|
128
|
+
break;
|
|
129
|
+
case "boolean":
|
|
130
|
+
t = c.boolean();
|
|
131
|
+
break;
|
|
132
|
+
case "number":
|
|
133
|
+
t = c.number();
|
|
134
|
+
break;
|
|
135
|
+
case "object":
|
|
136
|
+
t = I({
|
|
137
|
+
properties: e.properties ?? {},
|
|
138
|
+
required: e.required
|
|
139
|
+
});
|
|
140
|
+
break;
|
|
141
|
+
case "string":
|
|
142
|
+
t = e.enum?.length ? c.enum(e.enum) : c.string();
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
return e.description ? t.describe(e.description) : t;
|
|
146
|
+
}
|
|
147
|
+
const k = /* @__PURE__ */ new Map([
|
|
148
|
+
[
|
|
149
|
+
"clear_filters",
|
|
150
|
+
async () => (await import("../../agents/tools/filter/clearFilters/adapter.js")).clearFiltersTool
|
|
151
|
+
],
|
|
152
|
+
[
|
|
153
|
+
"reset_map",
|
|
154
|
+
async () => (await import("../../agents/tools/filter/resetMap/adapter.js")).resetMapTool
|
|
155
|
+
],
|
|
156
|
+
[
|
|
157
|
+
"set_feature_effect",
|
|
158
|
+
async () => (await import("../../agents/tools/filter/setFeatureEffect/adapter.js")).setFeatureEffectTool
|
|
159
|
+
],
|
|
160
|
+
[
|
|
161
|
+
"list_layer_fields",
|
|
162
|
+
async () => (await import("../../agents/tools/help/listFields/adapter.js")).listLayerFieldsTool
|
|
163
|
+
],
|
|
164
|
+
[
|
|
165
|
+
"go_to_address",
|
|
166
|
+
async () => (await import("../../agents/tools/navigation/goToAddress/adapter.js")).goToAddressTool
|
|
167
|
+
],
|
|
168
|
+
[
|
|
169
|
+
"go_to_bookmark",
|
|
170
|
+
async () => (await import("../../agents/tools/navigation/goToBookmark/adapter.js")).goToBookmarkTool
|
|
171
|
+
],
|
|
172
|
+
[
|
|
173
|
+
"go_to_features",
|
|
174
|
+
async () => (await import("../../agents/tools/navigation/goToFeatures/adapter.js")).goToFeaturesTool
|
|
175
|
+
],
|
|
176
|
+
[
|
|
177
|
+
"go_to_full_extent",
|
|
178
|
+
async () => (await import("../../agents/tools/navigation/goToFullExtent/adapter.js")).goToFullExtentTool
|
|
179
|
+
],
|
|
180
|
+
[
|
|
181
|
+
"go_to_home_extent",
|
|
182
|
+
async () => (await import("../../agents/tools/navigation/goToHomeExtent/adapter.js")).goToHomeExtentTool
|
|
183
|
+
],
|
|
184
|
+
[
|
|
185
|
+
"go_to_layer",
|
|
186
|
+
async () => (await import("../../agents/tools/navigation/goToLayer/adapter.js")).goToLayerTool
|
|
187
|
+
],
|
|
188
|
+
[
|
|
189
|
+
"go_to_scale",
|
|
190
|
+
async () => (await import("../../agents/tools/navigation/goToScale/adapter.js")).goToScaleTool
|
|
191
|
+
],
|
|
192
|
+
[
|
|
193
|
+
"go_to_viewpoint",
|
|
194
|
+
async () => (await import("../../agents/tools/navigation/goToViewpoint/adapter.js")).goToViewpointTool
|
|
195
|
+
],
|
|
196
|
+
[
|
|
197
|
+
"go_to_zoom",
|
|
198
|
+
async () => (await import("../../agents/tools/navigation/goToZoom/adapter.js")).goToZoomTool
|
|
199
|
+
],
|
|
200
|
+
[
|
|
201
|
+
"find_relevant_fields",
|
|
202
|
+
async () => (await import("../../agents/tools/search/findRelevantFields/adapter.js")).findRelevantFieldsTool
|
|
203
|
+
],
|
|
204
|
+
[
|
|
205
|
+
"find_relevant_layers",
|
|
206
|
+
async () => (await import("../../agents/tools/search/findRelevantLayers/adapter.js")).findRelevantLayersTool
|
|
207
|
+
],
|
|
208
|
+
[
|
|
209
|
+
"get_attribute",
|
|
210
|
+
async () => (await import("../../agents/tools/query/getAttribute/adapter.js")).getAttributeTool
|
|
211
|
+
],
|
|
212
|
+
[
|
|
213
|
+
"get_statistics",
|
|
214
|
+
async () => (await import("../../agents/tools/query/getStatistics/adapter.js")).getStatisticsTool
|
|
215
|
+
],
|
|
216
|
+
[
|
|
217
|
+
"get_top_features",
|
|
218
|
+
async () => (await import("../../agents/tools/query/getTopFeatures/adapter.js")).getTopFeaturesTool
|
|
219
|
+
],
|
|
220
|
+
[
|
|
221
|
+
"query_features",
|
|
222
|
+
async () => (await import("../../agents/tools/query/queryFeatures/adapter.js")).queryFeaturesTool
|
|
223
|
+
]
|
|
224
|
+
]);
|
|
225
|
+
async function ee(e) {
|
|
226
|
+
const t = k.get(e);
|
|
227
|
+
if (!t)
|
|
228
|
+
throw new Error(`ArcGIS tool is not supported in the browser runtime: ${e}`);
|
|
229
|
+
return await t();
|
|
230
|
+
}
|
|
231
|
+
var te = Object.defineProperty, oe = Object.getOwnPropertyDescriptor, N = (e, t, r, s) => {
|
|
232
|
+
for (var o = s > 1 ? void 0 : s ? oe(t, r) : t, a = e.length - 1, i; a >= 0; a--)
|
|
233
|
+
(i = e[a]) && (o = (s ? i(t, r, o) : i(o)) || o);
|
|
234
|
+
return s && o && te(t, r, o), o;
|
|
235
|
+
};
|
|
236
|
+
let d = class extends T {
|
|
237
|
+
//#region Lifecycle
|
|
238
|
+
constructor(e) {
|
|
239
|
+
super(e), this.type = "arcgis-tool";
|
|
240
|
+
}
|
|
241
|
+
//#endregion
|
|
242
|
+
//#region Public Methods
|
|
243
|
+
async createRuntimeTools() {
|
|
244
|
+
if (!this.name)
|
|
245
|
+
throw new Error("ArcgisTool name is required");
|
|
246
|
+
return [await ee(this.name)];
|
|
247
|
+
}
|
|
248
|
+
static fromJSON(e) {
|
|
249
|
+
return new d({
|
|
250
|
+
name: e.name,
|
|
251
|
+
requireApproval: e.require_approval
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
//#endregion
|
|
255
|
+
};
|
|
256
|
+
N([
|
|
257
|
+
n()
|
|
258
|
+
], d.prototype, "name", 2);
|
|
259
|
+
N([
|
|
260
|
+
n()
|
|
261
|
+
], d.prototype, "requireApproval", 2);
|
|
262
|
+
N([
|
|
263
|
+
n()
|
|
264
|
+
], d.prototype, "type", 2);
|
|
265
|
+
d = N([
|
|
266
|
+
l("ArcgisTool")
|
|
267
|
+
], d);
|
|
268
|
+
var re = Object.defineProperty, se = Object.getOwnPropertyDescriptor, J = (e) => {
|
|
269
|
+
throw TypeError(e);
|
|
270
|
+
}, _ = (e, t, r, s) => {
|
|
271
|
+
for (var o = s > 1 ? void 0 : s ? se(t, r) : t, a = e.length - 1, i; a >= 0; a--)
|
|
272
|
+
(i = e[a]) && (o = (s ? i(t, r, o) : i(o)) || o);
|
|
273
|
+
return s && o && re(t, r, o), o;
|
|
274
|
+
}, ae = (e, t, r) => t.has(e) || J("Cannot " + r), ie = (e, t, r) => t.has(e) ? J("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, r), ne = (e, t, r) => (ae(e, t, "access private method"), r), S, R;
|
|
275
|
+
let m = class extends u {
|
|
276
|
+
//#region Lifecycle
|
|
277
|
+
constructor(e) {
|
|
278
|
+
super(e), ie(this, S), this.type = "agent-node";
|
|
279
|
+
}
|
|
280
|
+
//#endregion
|
|
281
|
+
//#region Public Methods
|
|
282
|
+
createRuntimeNode() {
|
|
283
|
+
let e;
|
|
284
|
+
return async (t, r) => {
|
|
285
|
+
e ??= ne(this, S, R).call(this);
|
|
286
|
+
const o = await (await e).run(t, r), a = this.outputSchema?.safeParse(o);
|
|
287
|
+
if (a && !a.success)
|
|
288
|
+
throw a.error;
|
|
289
|
+
const i = a?.data, O = i ?? o.outputMessage;
|
|
290
|
+
return {
|
|
291
|
+
agentExecutionContext: o.agentExecutionContext,
|
|
292
|
+
...i ? {} : { outputMessage: o.outputMessage },
|
|
293
|
+
status: o.status,
|
|
294
|
+
summary: o.summary,
|
|
295
|
+
nodes: {
|
|
296
|
+
[this.id]: { output: O }
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
compile(e) {
|
|
302
|
+
const t = e.outgoingEdges[0]?.targetNodeId;
|
|
303
|
+
return {
|
|
304
|
+
runtimeNode: this.createRuntimeNode(),
|
|
305
|
+
edges: [
|
|
306
|
+
{
|
|
307
|
+
from: this.id,
|
|
308
|
+
decide: (r) => r.status === "failed" ? void 0 : t
|
|
309
|
+
}
|
|
310
|
+
],
|
|
311
|
+
schemas: [
|
|
312
|
+
c.object({
|
|
313
|
+
output: this.outputSchema ?? c.string()
|
|
314
|
+
})
|
|
315
|
+
]
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
static fromJSON(e) {
|
|
319
|
+
const t = new m({
|
|
320
|
+
id: e.id,
|
|
321
|
+
label: e.label,
|
|
322
|
+
prompt: e.prompt?.content,
|
|
323
|
+
type: "agent-node",
|
|
324
|
+
modelTier: e.llm_model?.model_tier
|
|
325
|
+
});
|
|
326
|
+
return e.structured_output && (t.outputSchema = I(e.structured_output)), t.tools = e.tools?.filter((r) => r.type === "arcgis_tool").map((r) => d.fromJSON(r)), t;
|
|
327
|
+
}
|
|
328
|
+
//#endregion
|
|
329
|
+
};
|
|
330
|
+
S = /* @__PURE__ */ new WeakSet();
|
|
331
|
+
R = async function() {
|
|
332
|
+
const e = this.prompt;
|
|
333
|
+
if (!e?.trim())
|
|
334
|
+
throw new Error(`WebAgent agent node "${this.id}" requires a prompt.`);
|
|
335
|
+
const t = [];
|
|
336
|
+
if (this.tools)
|
|
337
|
+
for (const r of this.tools) {
|
|
338
|
+
const s = await r.createRuntimeTools();
|
|
339
|
+
t.push(...s);
|
|
340
|
+
}
|
|
341
|
+
return new z({
|
|
342
|
+
name: this.id,
|
|
343
|
+
// TODO: change to label
|
|
344
|
+
outputSchema: this.outputSchema,
|
|
345
|
+
modelTier: this.modelTier,
|
|
346
|
+
prompt: e,
|
|
347
|
+
tools: t
|
|
348
|
+
});
|
|
349
|
+
};
|
|
350
|
+
_([
|
|
351
|
+
n()
|
|
352
|
+
], m.prototype, "type", 2);
|
|
353
|
+
_([
|
|
354
|
+
n()
|
|
355
|
+
], m.prototype, "prompt", 2);
|
|
356
|
+
_([
|
|
357
|
+
n()
|
|
358
|
+
], m.prototype, "outputSchema", 2);
|
|
359
|
+
_([
|
|
360
|
+
n()
|
|
361
|
+
], m.prototype, "tools", 2);
|
|
362
|
+
_([
|
|
363
|
+
n()
|
|
364
|
+
], m.prototype, "modelTier", 2);
|
|
365
|
+
m = _([
|
|
366
|
+
l("AgentNode")
|
|
367
|
+
], m);
|
|
368
|
+
var ce = Object.defineProperty, pe = Object.getOwnPropertyDescriptor, A = (e, t, r, s) => {
|
|
369
|
+
for (var o = s > 1 ? void 0 : s ? pe(t, r) : t, a = e.length - 1, i; a >= 0; a--)
|
|
370
|
+
(i = e[a]) && (o = (s ? i(t, r, o) : i(o)) || o);
|
|
371
|
+
return s && o && ce(t, r, o), o;
|
|
372
|
+
};
|
|
373
|
+
let h = class extends u {
|
|
374
|
+
//#region Lifecycle
|
|
375
|
+
constructor(e) {
|
|
376
|
+
super(e), this.type = "end-message-node";
|
|
377
|
+
}
|
|
378
|
+
//#endregion
|
|
379
|
+
//#region Public Methods
|
|
380
|
+
createRuntimeNode() {
|
|
381
|
+
return async (e) => {
|
|
382
|
+
const t = await Z.fromTemplate(this.message, { templateFormat: "mustache" }).format(e);
|
|
383
|
+
return {
|
|
384
|
+
outputMessage: t,
|
|
385
|
+
status: "success",
|
|
386
|
+
summary: t
|
|
387
|
+
};
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
compile(e) {
|
|
391
|
+
return {
|
|
392
|
+
runtimeNode: this.createRuntimeNode(),
|
|
393
|
+
edges: []
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
static fromJSON(e) {
|
|
397
|
+
const t = new h({
|
|
398
|
+
id: e.id,
|
|
399
|
+
label: e.label,
|
|
400
|
+
type: "end-message-node"
|
|
401
|
+
});
|
|
402
|
+
return t.message = e.message, t;
|
|
403
|
+
}
|
|
404
|
+
//#endregion
|
|
405
|
+
//#region Private Methods
|
|
406
|
+
//#endregion
|
|
407
|
+
};
|
|
408
|
+
A([
|
|
409
|
+
n()
|
|
410
|
+
], h.prototype, "type", 2);
|
|
411
|
+
A([
|
|
412
|
+
n()
|
|
413
|
+
], h.prototype, "message", 2);
|
|
414
|
+
h = A([
|
|
415
|
+
l("EndMessageNode")
|
|
416
|
+
], h);
|
|
417
|
+
var me = Object.defineProperty, ue = Object.getOwnPropertyDescriptor, D = (e, t, r, s) => {
|
|
418
|
+
for (var o = s > 1 ? void 0 : s ? ue(t, r) : t, a = e.length - 1, i; a >= 0; a--)
|
|
419
|
+
(i = e[a]) && (o = (s ? i(t, r, o) : i(o)) || o);
|
|
420
|
+
return s && o && me(t, r, o), o;
|
|
421
|
+
};
|
|
422
|
+
let w = class extends u {
|
|
423
|
+
//#region Lifecycle
|
|
424
|
+
constructor(e) {
|
|
425
|
+
super(e), this.type = "start-node";
|
|
426
|
+
}
|
|
427
|
+
//#endregion
|
|
428
|
+
//#region Public Methods
|
|
429
|
+
createRuntimeNode() {
|
|
430
|
+
return (e) => ({ question: e.agentExecutionContext.userRequest });
|
|
431
|
+
}
|
|
432
|
+
static fromJSON(e) {
|
|
433
|
+
return new w({
|
|
434
|
+
id: e.id,
|
|
435
|
+
label: e.label,
|
|
436
|
+
type: "start-node"
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
//#endregion
|
|
440
|
+
//#region Private Methods
|
|
441
|
+
//#endregion
|
|
442
|
+
};
|
|
443
|
+
D([
|
|
444
|
+
n()
|
|
445
|
+
], w.prototype, "type", 2);
|
|
446
|
+
w = D([
|
|
447
|
+
l("StartNode")
|
|
448
|
+
], w);
|
|
449
|
+
function de(e) {
|
|
450
|
+
switch (e.type) {
|
|
451
|
+
case "agent_node":
|
|
452
|
+
return m.fromJSON(e);
|
|
453
|
+
case "end_message_node":
|
|
454
|
+
return h.fromJSON(e);
|
|
455
|
+
case "start_node":
|
|
456
|
+
return w.fromJSON(e);
|
|
457
|
+
default:
|
|
458
|
+
throw new Error(`WebAgent node "${e.id}" uses unsupported type "${e.type}".`);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
function le(e = {}) {
|
|
462
|
+
const t = Object.keys(e);
|
|
463
|
+
if (H(t), t.includes("nodes"))
|
|
464
|
+
throw new Error("node state cannot define reserved field: nodes.");
|
|
465
|
+
const r = U(e);
|
|
466
|
+
return x.Root({
|
|
467
|
+
...r,
|
|
468
|
+
nodes: x({
|
|
469
|
+
reducer: (s, o) => ({ ...s, ...o }),
|
|
470
|
+
default: () => ({})
|
|
471
|
+
}),
|
|
472
|
+
...V()
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
function F(e) {
|
|
476
|
+
const t = /* @__PURE__ */ new Set();
|
|
477
|
+
for (const s of e)
|
|
478
|
+
for (const o of Object.keys(s.shape ?? {}))
|
|
479
|
+
o !== "nodes" && t.add(o);
|
|
480
|
+
const r = Object.fromEntries([...t].map((s) => [s, void 0]));
|
|
481
|
+
return le(r);
|
|
482
|
+
}
|
|
483
|
+
class P {
|
|
484
|
+
//#endregion Private Properties
|
|
485
|
+
//#region Lifecycle
|
|
486
|
+
constructor(t, r, s) {
|
|
487
|
+
this.sourceJSON = t, this.edges = r, this.nodes = s, this._loaded = !1;
|
|
488
|
+
}
|
|
489
|
+
//#endregion Lifecycle
|
|
490
|
+
//#region Public Methods
|
|
491
|
+
static fromJSON(t) {
|
|
492
|
+
return new P(
|
|
493
|
+
t,
|
|
494
|
+
t.graph.edges.map((r) => p.fromJSON(r)),
|
|
495
|
+
t.graph.nodes.map((r) => de(r))
|
|
496
|
+
);
|
|
497
|
+
}
|
|
498
|
+
async load() {
|
|
499
|
+
return this._loadPromise ??= Promise.all(this.nodes.map(async (t) => await t.load())).then(() => {
|
|
500
|
+
this._loaded = !0;
|
|
501
|
+
}), await this._loadPromise, this;
|
|
502
|
+
}
|
|
503
|
+
getSchemas() {
|
|
504
|
+
const t = Object.fromEntries(
|
|
505
|
+
this._getNodeCompilations().flatMap((s, o) => {
|
|
506
|
+
const a = this.nodes[o];
|
|
507
|
+
return s.schemas?.map((i) => [a.id, i]) ?? [];
|
|
508
|
+
})
|
|
509
|
+
);
|
|
510
|
+
return [c.object({
|
|
511
|
+
loopCounts: c.record(c.string(), c.number()).optional(),
|
|
512
|
+
nodes: c.object(t).partial().optional(),
|
|
513
|
+
question: c.string().optional()
|
|
514
|
+
})];
|
|
515
|
+
}
|
|
516
|
+
generate() {
|
|
517
|
+
this._assertLoaded(), this._nodeCompilations = void 0;
|
|
518
|
+
const t = this._getNodeCompilations(), r = F(this.getSchemas()), s = this.nodes.find((i) => i.type === "start-node")?.id, o = {}, a = [];
|
|
519
|
+
for (const [i, O] of this.nodes.entries()) {
|
|
520
|
+
const y = t[i];
|
|
521
|
+
y && (y.runtimeNode && (o[O.id] = y.runtimeNode), a.push(...y.edges));
|
|
522
|
+
}
|
|
523
|
+
return {
|
|
524
|
+
createGraph: () => B(o, a, r, { entryNode: s }),
|
|
525
|
+
workspace: r
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
//#endregion Public Methods
|
|
529
|
+
//#region Private Methods
|
|
530
|
+
_assertLoaded() {
|
|
531
|
+
if (!this._loaded)
|
|
532
|
+
throw new Error("AgenticWorkflowRuntime must be loaded before it can generate a graph.");
|
|
533
|
+
}
|
|
534
|
+
_getNodeCompilations() {
|
|
535
|
+
return this._assertLoaded(), this._nodeCompilations ??= this.nodes.map(
|
|
536
|
+
(t) => t.compile({
|
|
537
|
+
outgoingEdges: this.edges.filter((r) => r.sourceNodeId === t.id)
|
|
538
|
+
})
|
|
539
|
+
);
|
|
540
|
+
}
|
|
541
|
+
//#endregion Private Methods
|
|
542
|
+
}
|
|
543
|
+
var he = Object.defineProperty, ge = Object.getOwnPropertyDescriptor, E = (e, t, r, s) => {
|
|
544
|
+
for (var o = s > 1 ? void 0 : s ? ge(t, r) : t, a = e.length - 1, i; a >= 0; a--)
|
|
545
|
+
(i = e[a]) && (o = (s ? i(t, r, o) : i(o)) || o);
|
|
546
|
+
return s && o && he(t, r, o), o;
|
|
547
|
+
};
|
|
548
|
+
const fe = () => {
|
|
549
|
+
throw new Error("WebAgent must be loaded before it can run.");
|
|
550
|
+
};
|
|
551
|
+
let g = class extends G {
|
|
552
|
+
//#region Lifecycle
|
|
553
|
+
constructor(e) {
|
|
554
|
+
super(e);
|
|
555
|
+
}
|
|
556
|
+
//#endregion
|
|
557
|
+
//#region Public Methods
|
|
558
|
+
async load() {
|
|
559
|
+
if (this.portalItem) {
|
|
560
|
+
try {
|
|
561
|
+
await this.portalItem.load();
|
|
562
|
+
} catch (r) {
|
|
563
|
+
throw new b("web-agent:load-portal-item", "Failed to load portal item", { error: r });
|
|
564
|
+
}
|
|
565
|
+
const t = await this.portalItem.fetchData();
|
|
566
|
+
if (this.sourceJSON = t, !this.portalItem.title)
|
|
567
|
+
throw new b("web-agent:missing-title", "The portal item is missing a title");
|
|
568
|
+
}
|
|
569
|
+
if (!this.sourceJSON)
|
|
570
|
+
throw new b("web-agent:missing-source-json", "The source JSON is missing");
|
|
571
|
+
if (!this.sourceJSON.description)
|
|
572
|
+
throw new b("web-agent:missing-description", "The source JSON is missing a description");
|
|
573
|
+
const e = P.fromJSON(this.sourceJSON);
|
|
574
|
+
return await e.load(), this._runtime = e, this.description = this.sourceJSON.description, this.name = this.portalItem?.title ?? `web-agent-${Date.now()}`, this.generate(), this;
|
|
575
|
+
}
|
|
576
|
+
getSchemas() {
|
|
577
|
+
return this._runtime?.getSchemas() ?? [];
|
|
578
|
+
}
|
|
579
|
+
generate() {
|
|
580
|
+
if (!this._runtime) {
|
|
581
|
+
this._set("workspace", F([])), this._set("createGraph", fe);
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
const { createGraph: e, workspace: t } = this._runtime.generate();
|
|
585
|
+
this._set("workspace", t), this._set("createGraph", e);
|
|
586
|
+
}
|
|
587
|
+
//#endregion
|
|
588
|
+
};
|
|
589
|
+
E([
|
|
590
|
+
n({ type: C })
|
|
591
|
+
], g.prototype, "portalItem", 2);
|
|
592
|
+
E([
|
|
593
|
+
n()
|
|
594
|
+
], g.prototype, "sourceJSON", 2);
|
|
595
|
+
g = E([
|
|
596
|
+
l("WebAgent")
|
|
597
|
+
], g);
|
|
598
|
+
class _e extends M {
|
|
6
599
|
static {
|
|
7
|
-
this.properties = { agent: 0, context: 0 };
|
|
600
|
+
this.properties = { agent: 0, context: 0, itemId: 1, workflow: 0 };
|
|
8
601
|
}
|
|
602
|
+
#e;
|
|
9
603
|
async getContext() {
|
|
10
|
-
return
|
|
604
|
+
return W(this.context) ? await this.context() : this.context;
|
|
605
|
+
}
|
|
606
|
+
async load() {
|
|
607
|
+
let t;
|
|
608
|
+
if (this.itemId) {
|
|
609
|
+
const r = j.getDefault();
|
|
610
|
+
t = new g({ portalItem: new C({ id: this.itemId, portal: r }) });
|
|
611
|
+
} else this.workflow && (t = new g({ sourceJSON: this.workflow }));
|
|
612
|
+
if (t && (await t.load(), this.agent = t.registration), !this.agent)
|
|
613
|
+
throw new Error("Failed to initialize the assistant agent because the agent registration is missing.");
|
|
614
|
+
this.#e = L(this);
|
|
11
615
|
}
|
|
12
|
-
|
|
13
|
-
|
|
616
|
+
disconnectedCallback() {
|
|
617
|
+
this.#e?.unregister(this.agent.id), super.disconnectedCallback();
|
|
14
618
|
}
|
|
15
619
|
}
|
|
16
|
-
|
|
620
|
+
q("arcgis-assistant-agent", _e);
|
|
17
621
|
export {
|
|
18
|
-
|
|
622
|
+
_e as ArcgisAssistantAgent
|
|
19
623
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference path="../../index.d.ts" />
|
|
2
2
|
import type Collection from "@arcgis/core/core/Collection.js";
|
|
3
3
|
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
|
|
4
|
-
import type { ChatMessage } from "../arcgis-assistant/types.js";
|
|
4
|
+
import type { ChatMessage, Interrupt } from "../arcgis-assistant/types.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Wraps and renders the conversation area. Use it as the container for message list content.
|
|
@@ -10,6 +10,7 @@ import type { ChatMessage } from "../arcgis-assistant/types.js";
|
|
|
10
10
|
* @internal
|
|
11
11
|
*/
|
|
12
12
|
export abstract class ArcgisAssistantChat extends LitElement {
|
|
13
|
+
accessor interrupt: Interrupt | null;
|
|
13
14
|
/** @default false */
|
|
14
15
|
accessor loading: boolean;
|
|
15
16
|
accessor messages: Collection<ChatMessage>;
|