@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,35 +1,171 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import { c as
|
|
3
|
-
import { css as
|
|
4
|
-
import
|
|
5
|
-
import { whenOnce as
|
|
6
|
-
import
|
|
7
|
-
import { LitElement as
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
2
|
+
import { c as x } from "../../chunks/runtime.js";
|
|
3
|
+
import { css as A, html as c } from "lit";
|
|
4
|
+
import L from "@arcgis/core/core/Collection.js";
|
|
5
|
+
import { whenOnce as T, watch as R, when as D } from "@arcgis/core/core/reactiveUtils.js";
|
|
6
|
+
import M from "@arcgis/core/portal/Portal.js";
|
|
7
|
+
import { LitElement as O, createEvent as p, nothing as f } from "@arcgis/lumina";
|
|
8
|
+
import * as B from "@arcgis/toolkit/log";
|
|
9
|
+
import { rethrowError as z } from "@arcgis/toolkit/log";
|
|
10
|
+
import { createRef as v, ref as k } from "lit/directives/ref.js";
|
|
11
|
+
import { u as U } from "../../chunks/useT9n.js";
|
|
12
|
+
import { O as q } from "../../chunks/orchestrator.js";
|
|
12
13
|
import "@langchain/core/callbacks/dispatch/web";
|
|
13
14
|
import "@langchain/core/prompts";
|
|
14
15
|
import "@langchain/openai";
|
|
15
|
-
import "@arcgis/core/
|
|
16
|
+
import "@arcgis/core/request.js";
|
|
17
|
+
import N from "@arcgis/core/identity/IdentityManager.js";
|
|
18
|
+
import "@arcgis/toolkit/string";
|
|
19
|
+
import "@arcgis/core/config.js";
|
|
16
20
|
import "@langchain/core/messages";
|
|
17
21
|
import "@arcgis/core/layers/FeatureLayer.js";
|
|
18
22
|
import "../../chunks/generateLayerDescriptions.js";
|
|
19
23
|
import "@langchain/langgraph/web";
|
|
20
|
-
import
|
|
21
|
-
import { property as
|
|
22
|
-
import {
|
|
23
|
-
import { g as
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
import V from "@arcgis/core/core/Accessor.js";
|
|
25
|
+
import { property as m, subclass as F } from "@arcgis/core/core/accessorSupport/decorators.js";
|
|
26
|
+
import { marked as E } from "marked";
|
|
27
|
+
import { g as j } from "../../chunks/utils3.js";
|
|
28
|
+
import { g as $ } from "../../chunks/slottableRequestUtils.js";
|
|
29
|
+
const H = A`:host{display:block;width:var(--arcgis-internal-panel-width, 100%);height:var(--arcgis-internal-expand-max-height, 100%);--calcite-panel-content-bottom-space: 0}.footer-container{display:flex;flex-direction:column;flex:1 1 0;gap:var(--calcite-spacing-md)}.content-container{display:flex;flex-direction:column;flex:1 1 0;min-height:0;position:relative;overflow:auto}.suggested-prompts-container{display:flex;justify-content:center;width:100%;background:var(--calcite-panel-background-color, var(--calcite-color-background))}.suggested-prompts{display:block;padding:var(--calcite-spacing-md);max-width:100%;box-sizing:border-box}.error-notice{padding:var(--calcite-spacing-sm)}.interrupt-waiting-message{font-style:italic;color:var(--calcite-color-text-2)}`;
|
|
30
|
+
function w(o) {
|
|
31
|
+
return o.trim() ? E.lexer(o).filter((e) => e.type !== "space").map((e) => E.parser([e])) : [];
|
|
32
|
+
}
|
|
33
|
+
class C {
|
|
34
|
+
constructor() {
|
|
35
|
+
this._stableParts = [], this._stableText = "", this._rawText = "";
|
|
36
|
+
}
|
|
37
|
+
// full streamed markdown so far
|
|
38
|
+
// Add one chunk and return all current segments.
|
|
39
|
+
push(e) {
|
|
40
|
+
return this._rawText += e, this._advanceStableBoundary(), this.getParts();
|
|
41
|
+
}
|
|
42
|
+
// Parse the remaining live tail. Call once at stream end.
|
|
43
|
+
finalize() {
|
|
44
|
+
const e = this._rawText.slice(this._stableText.length);
|
|
45
|
+
return e.trim() && (this._stableParts.push(...w(e)), this._stableText = this._rawText), this._stableParts;
|
|
46
|
+
}
|
|
47
|
+
// Get full output: stable segments + current live tail.
|
|
48
|
+
getParts() {
|
|
49
|
+
const e = this._trimIncompleteTail(this._rawText.slice(this._stableText.length)), s = e.trim() ? w(e) : [];
|
|
50
|
+
return [...this._stableParts, ...s];
|
|
51
|
+
}
|
|
52
|
+
reset() {
|
|
53
|
+
this._stableParts = [], this._stableText = "", this._rawText = "";
|
|
54
|
+
}
|
|
55
|
+
// Move parse-safe content from live tail into stable content.
|
|
56
|
+
_advanceStableBoundary() {
|
|
57
|
+
const e = this._rawText.slice(this._stableText.length), s = this._lastSafeBoundary(e);
|
|
58
|
+
if (s <= 0)
|
|
59
|
+
return;
|
|
60
|
+
const i = e.slice(0, s);
|
|
61
|
+
this._stableParts.push(...w(i)), this._stableText += i;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Find the last blank-line boundary that is outside code fences.
|
|
65
|
+
* Returns 0 if no safe boundary is available yet.
|
|
66
|
+
*/
|
|
67
|
+
_lastSafeBoundary(e) {
|
|
68
|
+
const s = e.split(`
|
|
69
|
+
`);
|
|
70
|
+
let i = !1, t = 0, n = 0;
|
|
71
|
+
for (const r of s)
|
|
72
|
+
/^\s*(```|~~~)/u.test(r) && (i = !i), n += r.length + 1, r.trim() === "" && !i && (t = n);
|
|
73
|
+
return t < e.length ? t : 0;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Remove incomplete syntax at the end so we do not render partial markup.
|
|
77
|
+
* Handles:
|
|
78
|
+
* - open HTML tags without closing '>'
|
|
79
|
+
* - HTML elements missing closing tags
|
|
80
|
+
* - markdown links missing closing ')'
|
|
81
|
+
*/
|
|
82
|
+
_trimIncompleteTail(e) {
|
|
83
|
+
const s = e.lastIndexOf("<");
|
|
84
|
+
if (s !== -1 && !e.includes(">", s))
|
|
85
|
+
return e.slice(0, s);
|
|
86
|
+
const i = this._earliestUnclosedTag(e);
|
|
87
|
+
if (i !== -1)
|
|
88
|
+
return e.slice(0, i);
|
|
89
|
+
const t = e.lastIndexOf("[");
|
|
90
|
+
if (t !== -1) {
|
|
91
|
+
const n = e.slice(t);
|
|
92
|
+
if (!/\[[^\]]*\]\([^)]*\)/u.test(n))
|
|
93
|
+
return e.slice(0, t);
|
|
94
|
+
}
|
|
95
|
+
return e;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Return the index of the earliest unclosed opening tag, or -1.
|
|
99
|
+
* Ignores void elements (img, br, input, etc.) and self-closing tags.
|
|
100
|
+
*/
|
|
101
|
+
_earliestUnclosedTag(e) {
|
|
102
|
+
const s = /* @__PURE__ */ new Set([
|
|
103
|
+
"br",
|
|
104
|
+
"img",
|
|
105
|
+
"hr",
|
|
106
|
+
"input",
|
|
107
|
+
"meta",
|
|
108
|
+
"link",
|
|
109
|
+
"area",
|
|
110
|
+
"base",
|
|
111
|
+
"col",
|
|
112
|
+
"embed",
|
|
113
|
+
"source",
|
|
114
|
+
"track",
|
|
115
|
+
"wbr"
|
|
116
|
+
]), i = /<(\/?)([a-zA-Z][\w-]*)\b[^>]*?(\/?)>/gu, t = [];
|
|
117
|
+
for (let n = i.exec(e); n; n = i.exec(e)) {
|
|
118
|
+
const [, r, a, l] = n, h = a.toLowerCase();
|
|
119
|
+
if (!(s.has(h) || l === "/"))
|
|
120
|
+
if (r === "/") {
|
|
121
|
+
for (let g = t.length - 1; g >= 0; g--)
|
|
122
|
+
if (t[g].name === h) {
|
|
123
|
+
t.splice(g);
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
} else
|
|
127
|
+
t.push({ name: h, index: n.index });
|
|
128
|
+
}
|
|
129
|
+
return t.length ? t[0].index : -1;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function W(o) {
|
|
133
|
+
const e = new C();
|
|
134
|
+
return e.push(o), e.finalize();
|
|
135
|
+
}
|
|
136
|
+
const G = async (o) => await new Promise((e) => setTimeout(e, o));
|
|
137
|
+
async function* Z(o, { chunkSize: e = 15, delay: s = 50 } = {}) {
|
|
138
|
+
const i = new C();
|
|
139
|
+
for (let t = 0; t < o.length; t += e)
|
|
140
|
+
yield i.push(o.slice(t, t + e)), await G(s);
|
|
141
|
+
yield i.finalize();
|
|
142
|
+
}
|
|
143
|
+
var J = Object.defineProperty, K = Object.getOwnPropertyDescriptor, u = (o, e, s, i) => {
|
|
144
|
+
for (var t = i > 1 ? void 0 : i ? K(e, s) : e, n = o.length - 1, r; n >= 0; n--)
|
|
145
|
+
(r = o[n]) && (t = (i ? r(e, s, t) : r(t)) || t);
|
|
146
|
+
return i && t && J(e, s, t), t;
|
|
29
147
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
148
|
+
const S = (o) => !o || typeof o != "object" ? !1 : o.name === "AbortError";
|
|
149
|
+
async function* I(o, e, s, i, t = !1) {
|
|
150
|
+
if (t) {
|
|
151
|
+
if (i?.aborted) {
|
|
152
|
+
yield { type: "cancelled", log: s, runId: e };
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
yield { type: "block-data", blockType: "text", data: { parts: W(o) }, runId: e };
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
for await (const n of Z(o)) {
|
|
159
|
+
if (i?.aborted) {
|
|
160
|
+
yield { type: "cancelled", log: s, runId: e };
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
yield { type: "block-data", blockType: "text", data: { parts: n }, runId: e };
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
let d = class extends V {
|
|
167
|
+
constructor(o) {
|
|
168
|
+
super(o), this.view = null, this.streamingDisabled = !1, this.runtimeEventsEnabled = !1, this.loading = !1, this.processing = !1, this.processingStep = "";
|
|
33
169
|
}
|
|
34
170
|
async load() {
|
|
35
171
|
this._set("loading", !0);
|
|
@@ -43,14 +179,15 @@ let l = class extends A {
|
|
|
43
179
|
this.orchestrator?.dispose(), super.destroy();
|
|
44
180
|
}
|
|
45
181
|
async _initialize() {
|
|
46
|
-
this.removeHandles(), await Promise.all([this.portal.load(), this.view?.when()]), this.view && await
|
|
182
|
+
this.removeHandles(), await Promise.all([this.portal.load(), this.view?.when()]), this.view && await T(() => !this.view.updating), this._set(
|
|
47
183
|
"orchestrator",
|
|
48
|
-
await
|
|
184
|
+
await q.init({
|
|
49
185
|
agents: [...this.agents],
|
|
186
|
+
runtimeEventsEnabled: this.runtimeEventsEnabled,
|
|
50
187
|
view: this.view ?? void 0
|
|
51
188
|
})
|
|
52
189
|
), this.addHandles([
|
|
53
|
-
|
|
190
|
+
R(
|
|
54
191
|
() => [this.view, this.agents],
|
|
55
192
|
() => {
|
|
56
193
|
this._initialize();
|
|
@@ -61,64 +198,82 @@ let l = class extends A {
|
|
|
61
198
|
clearChatHistory() {
|
|
62
199
|
this.orchestrator?.newConversation();
|
|
63
200
|
}
|
|
64
|
-
async *ask(
|
|
201
|
+
async *ask(o, e) {
|
|
65
202
|
if (!this.orchestrator)
|
|
66
203
|
throw new Error("Orchestrator not initialized yet.");
|
|
67
204
|
this._set("processing", !0), this._set("processingStep", "");
|
|
68
|
-
const
|
|
69
|
-
let i;
|
|
205
|
+
const s = [];
|
|
206
|
+
let i, t = "pending";
|
|
70
207
|
try {
|
|
71
|
-
const
|
|
72
|
-
for await (const r of
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
switch (r.type) {
|
|
208
|
+
const n = this.orchestrator.ask(o);
|
|
209
|
+
for await (const r of n)
|
|
210
|
+
switch (t = r.runId, r.type) {
|
|
211
|
+
case "runtime": {
|
|
212
|
+
yield { type: "runtime", event: r, runId: t };
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
79
215
|
case "trace": {
|
|
80
|
-
this._set("processingStep", r.data.text),
|
|
216
|
+
this._set("processingStep", r.data.text), s.push(r.data.text);
|
|
81
217
|
break;
|
|
82
218
|
}
|
|
83
219
|
case "completed": {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
220
|
+
this._set("processing", !1), this._set("processingStep", "");
|
|
221
|
+
const a = r.result, l = !!a.content.length, h = !!i?.length;
|
|
222
|
+
if (!l && !h) {
|
|
223
|
+
yield { type: "completed", error: "No response received.", log: s, runId: t };
|
|
87
224
|
return;
|
|
88
225
|
}
|
|
89
|
-
const
|
|
90
|
-
|
|
226
|
+
const g = a.content;
|
|
227
|
+
if (yield { type: "block-start", blockType: "text", runId: t }, yield* I(g, t, s, e, this.streamingDisabled), yield { type: "block-end", blockType: "text", runId: t }, h)
|
|
228
|
+
for (const _ of i) {
|
|
229
|
+
if (e?.aborted) {
|
|
230
|
+
yield { type: "cancelled", log: s, runId: t };
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
const { type: b, data: y } = _;
|
|
234
|
+
if (yield { type: "block-start", blockType: b, runId: t }, b === "text") {
|
|
235
|
+
const P = typeof y?.content == "string" ? y.content : "";
|
|
236
|
+
yield* I(P, t, s, e, this.streamingDisabled);
|
|
237
|
+
} else
|
|
238
|
+
yield { type: "block-data", blockType: b, data: y, runId: t };
|
|
239
|
+
yield { type: "block-end", blockType: b, runId: t };
|
|
240
|
+
}
|
|
241
|
+
yield { type: "completed", response: g, blocks: i, log: s, runId: t };
|
|
91
242
|
return;
|
|
92
243
|
}
|
|
93
244
|
case "ux-suggestion": {
|
|
94
|
-
const
|
|
95
|
-
i = i ? [...i,
|
|
245
|
+
const a = r.suggestion;
|
|
246
|
+
i = i ? [...i, a] : [a];
|
|
96
247
|
break;
|
|
97
248
|
}
|
|
98
249
|
case "interrupt": {
|
|
99
|
-
const { kind:
|
|
100
|
-
switch (
|
|
250
|
+
const { kind: a, message: l, metadata: h } = r.interrupt, g = Array.isArray(h) ? h.filter((b) => typeof b == "string") : [], _ = (() => {
|
|
251
|
+
switch (a) {
|
|
101
252
|
case "booleanChoice":
|
|
102
|
-
return { type: "boolean-choice", message:
|
|
253
|
+
return { type: "boolean-choice", message: l, options: g };
|
|
103
254
|
case "singleSelection":
|
|
104
|
-
return { type: "single-select", message:
|
|
255
|
+
return { type: "single-select", message: l, options: g };
|
|
105
256
|
case "multipleSelection":
|
|
106
|
-
return { type: "multi-select", message:
|
|
257
|
+
return { type: "multi-select", message: l, options: g };
|
|
107
258
|
case "textInput":
|
|
108
|
-
return { type: "text-input", message:
|
|
259
|
+
return { type: "text-input", message: l };
|
|
109
260
|
default:
|
|
110
|
-
return { type:
|
|
261
|
+
return { type: a, message: l, options: g };
|
|
111
262
|
}
|
|
112
263
|
})();
|
|
113
|
-
this._set("processingStep", "Waiting for user input..."), yield { type: "interrupt", payload:
|
|
264
|
+
this._set("processingStep", "Waiting for user input..."), yield { type: "interrupt", payload: _, runId: t };
|
|
114
265
|
break;
|
|
115
266
|
}
|
|
116
267
|
case "cancelled": {
|
|
117
|
-
yield { type: "cancelled", runId:
|
|
268
|
+
yield { type: "cancelled", log: s, runId: t };
|
|
118
269
|
return;
|
|
119
270
|
}
|
|
120
271
|
case "error": {
|
|
121
|
-
|
|
272
|
+
if (e?.aborted || S(r.error)) {
|
|
273
|
+
yield { type: "cancelled", log: s, runId: t };
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
yield { type: "completed", error: r.error.message, log: s, runId: t };
|
|
122
277
|
return;
|
|
123
278
|
}
|
|
124
279
|
default: {
|
|
@@ -126,105 +281,106 @@ let l = class extends A {
|
|
|
126
281
|
break;
|
|
127
282
|
}
|
|
128
283
|
}
|
|
284
|
+
} catch (n) {
|
|
285
|
+
if (e?.aborted || S(n)) {
|
|
286
|
+
yield { type: "cancelled", log: s, runId: t };
|
|
287
|
+
return;
|
|
129
288
|
}
|
|
130
|
-
|
|
131
|
-
console.warn("Error during message processing:", s), yield { type: "completed", error: "An error occurred during message processing.", log: e, runId: "error" };
|
|
289
|
+
console.warn("Error during message processing:", n), yield { type: "completed", error: "An error occurred during message processing.", log: s, runId: "error" };
|
|
132
290
|
return;
|
|
133
291
|
} finally {
|
|
134
292
|
this._set("processing", !1);
|
|
135
293
|
}
|
|
136
294
|
}
|
|
295
|
+
cancel() {
|
|
296
|
+
this.orchestrator?.cancel();
|
|
297
|
+
}
|
|
137
298
|
};
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
],
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
],
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
],
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
],
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
],
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
],
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
],
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
],
|
|
162
|
-
|
|
163
|
-
|
|
299
|
+
u([
|
|
300
|
+
m({ readOnly: !0 })
|
|
301
|
+
], d.prototype, "orchestrator", 2);
|
|
302
|
+
u([
|
|
303
|
+
m()
|
|
304
|
+
], d.prototype, "agents", 2);
|
|
305
|
+
u([
|
|
306
|
+
m()
|
|
307
|
+
], d.prototype, "portal", 2);
|
|
308
|
+
u([
|
|
309
|
+
m()
|
|
310
|
+
], d.prototype, "view", 2);
|
|
311
|
+
u([
|
|
312
|
+
m()
|
|
313
|
+
], d.prototype, "streamingDisabled", 2);
|
|
314
|
+
u([
|
|
315
|
+
m()
|
|
316
|
+
], d.prototype, "runtimeEventsEnabled", 2);
|
|
317
|
+
u([
|
|
318
|
+
m({ readOnly: !0 })
|
|
319
|
+
], d.prototype, "loading", 2);
|
|
320
|
+
u([
|
|
321
|
+
m({ readOnly: !0 })
|
|
322
|
+
], d.prototype, "processing", 2);
|
|
323
|
+
u([
|
|
324
|
+
m({ readOnly: !0 })
|
|
325
|
+
], d.prototype, "processingStep", 2);
|
|
326
|
+
d = u([
|
|
327
|
+
F("OrchestratorController")
|
|
328
|
+
], d);
|
|
329
|
+
const Q = "Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.", X = "Embeddings not found for this web map.", Y = "https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings";
|
|
330
|
+
class ee extends O {
|
|
164
331
|
constructor() {
|
|
165
|
-
super(...arguments), this._messages =
|
|
166
|
-
|
|
167
|
-
}, this.#
|
|
168
|
-
|
|
169
|
-
const
|
|
170
|
-
this.submitInterrupt(
|
|
171
|
-
}, this.#
|
|
172
|
-
|
|
173
|
-
const
|
|
174
|
-
this._inputValue = "", this.arcgisSubmit.emit(
|
|
175
|
-
}, this.#
|
|
176
|
-
if (
|
|
332
|
+
super(...arguments), this._messages = U({ blocking: !0 }), this.#e = v(), this.#l = v(), this.#s = v(), this.#t = null, this.#r = /* @__PURE__ */ new Map(), this.#i = M.getDefault(), this.#a = (e) => {
|
|
333
|
+
e.stopPropagation(), this.cancelInterrupt();
|
|
334
|
+
}, this.#n = (e) => {
|
|
335
|
+
e.stopPropagation();
|
|
336
|
+
const s = e.detail;
|
|
337
|
+
this.submitInterrupt(s);
|
|
338
|
+
}, this.#c = (e) => {
|
|
339
|
+
e.stopPropagation(), this.keepSuggestedPrompts || (this.suggestedPrompts = []);
|
|
340
|
+
const s = e.detail;
|
|
341
|
+
this._inputValue = "", this.arcgisSubmit.emit(s), this.submitMessage(s);
|
|
342
|
+
}, this.#h = (e) => {
|
|
343
|
+
if (this._canceling = !0, e.stopPropagation(), this.arcgisCancel.emit(), this._interrupt) {
|
|
177
344
|
this.orchestrator?.cancelInterrupt(), this._interrupt = null;
|
|
178
345
|
return;
|
|
179
346
|
}
|
|
180
|
-
this.#
|
|
181
|
-
}, this.#
|
|
182
|
-
|
|
183
|
-
const
|
|
184
|
-
this.arcgisFeedback.emit(
|
|
185
|
-
}, this.#p = (
|
|
186
|
-
|
|
187
|
-
const
|
|
188
|
-
this._inputValue =
|
|
189
|
-
}, this.#
|
|
190
|
-
this.arcgisSlottableRequest.emit(
|
|
191
|
-
}, this._orchestratorController = null, this._interrupt = null, this._error = null, this._inputValue = "", this.messages = new
|
|
347
|
+
this._orchestratorController?.cancel(), this.#t?.abort(), this.#t = null;
|
|
348
|
+
}, this.#g = (e) => {
|
|
349
|
+
e.stopPropagation();
|
|
350
|
+
const s = e.detail;
|
|
351
|
+
this.arcgisFeedback.emit(s);
|
|
352
|
+
}, this.#p = (e) => {
|
|
353
|
+
e.stopPropagation();
|
|
354
|
+
const s = e.detail;
|
|
355
|
+
this._inputValue = s.prompt, this.arcgisPromptSelect.emit(s);
|
|
356
|
+
}, this.#d = (e) => {
|
|
357
|
+
this.arcgisSlottableRequest.emit(e.detail);
|
|
358
|
+
}, this._orchestratorController = null, this._interrupt = null, this._interruptDetails = [], this._error = null, this._inputValue = "", this._isAnswering = !1, this._canceling = !1, this.messages = new L([]), this.referenceElement = null, this.suggestedPrompts = [], this.feedbackEnabled = !1, this.keepSuggestedPrompts = !1, this.streamingDisabled = !1, this.runtimeEventsEnabled = !1, this.logEnabled = !1, this.copyEnabled = !1, this.voiceInputEnabled = !1, this.readAloudEnabled = !1, this.assistantAvatarEnabled = !1, this.userAvatarEnabled = !1, this.arcgisCancel = p(), this.arcgisError = p(), this.arcgisFeedback = p(), this.arcgisInterrupt = p(), this.arcgisInterruptCancel = p(), this.arcgisInterruptSubmit = p(), this.arcgisPromptSelect = p(), this.arcgisReady = p(), this.arcgisResponse = p(), this.arcgisRuntime = p({ bubbles: !1, composed: !1 }), this.arcgisSlottableRequest = p({ bubbles: !1, composed: !1 }), this.arcgisSubmit = p();
|
|
192
359
|
}
|
|
193
360
|
static {
|
|
194
|
-
this.properties = { _orchestratorController: 16, _interrupt: 16, _error: 16, _inputValue: 16, _user: 16, awaitingResponse: 32, awaitingResponseStep: 32, interrupt: 32, messages: 0, orchestrator: 32, entryMessage: 1, heading: 1, description: 1, referenceElement: 1, suggestedPrompts: 0, feedbackEnabled: 5, keepSuggestedPrompts: 5, logEnabled: 5, copyEnabled: 5, voiceInputEnabled: 5, readAloudEnabled: 5 };
|
|
361
|
+
this.properties = { _orchestratorController: 16, _interrupt: 16, _interruptDetails: 16, _error: 16, _inputValue: 16, _isAnswering: 16, _signedInUserId: 16, _canceling: 16, _isSignedIn: 16, _user: 16, awaitingResponse: 32, awaitingResponseStep: 32, interrupt: 32, messages: 0, orchestrator: 32, entryMessage: 1, heading: 1, description: 1, referenceElement: 1, suggestedPrompts: 0, feedbackEnabled: 5, keepSuggestedPrompts: 5, streamingDisabled: 5, runtimeEventsEnabled: 5, logEnabled: 5, copyEnabled: 5, voiceInputEnabled: 5, readAloudEnabled: 5, assistantAvatarEnabled: 5, userAvatarEnabled: 5 };
|
|
195
362
|
}
|
|
196
363
|
static {
|
|
197
|
-
this.styles =
|
|
364
|
+
this.styles = H;
|
|
198
365
|
}
|
|
199
|
-
#t;
|
|
200
|
-
#n;
|
|
201
366
|
#e;
|
|
367
|
+
#l;
|
|
202
368
|
#s;
|
|
203
|
-
#
|
|
369
|
+
#t;
|
|
204
370
|
#r;
|
|
205
371
|
#i;
|
|
206
372
|
#a;
|
|
207
|
-
#
|
|
373
|
+
#n;
|
|
208
374
|
#c;
|
|
209
375
|
#h;
|
|
210
|
-
#p;
|
|
211
376
|
#g;
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
const e = [...this.#o.values()];
|
|
217
|
-
return e.length ? (this._orchestratorController = new l({
|
|
218
|
-
agents: e,
|
|
219
|
-
portal: this.#r,
|
|
220
|
-
view: t?.view
|
|
221
|
-
}), await this._orchestratorController.load(), !0) : (this._error = "No agents found.", !1);
|
|
222
|
-
} catch (t) {
|
|
223
|
-
return this._error = t?.message ?? "Error initializing orchestrator.", x(this)(t), !1;
|
|
224
|
-
}
|
|
377
|
+
#p;
|
|
378
|
+
#d;
|
|
379
|
+
get _isSignedIn() {
|
|
380
|
+
return !!this.#i?.user || !!this._signedInUserId;
|
|
225
381
|
}
|
|
226
382
|
get _user() {
|
|
227
|
-
return this.#
|
|
383
|
+
return this.#i?.user?.fullName || this.#i?.user?.username;
|
|
228
384
|
}
|
|
229
385
|
get awaitingResponse() {
|
|
230
386
|
return this._orchestratorController?.processing ?? !1;
|
|
@@ -238,92 +394,180 @@ class F extends R {
|
|
|
238
394
|
get orchestrator() {
|
|
239
395
|
return this._orchestratorController?.orchestrator;
|
|
240
396
|
}
|
|
397
|
+
cancelInterrupt() {
|
|
398
|
+
this.arcgisInterruptCancel.emit(), this.orchestrator?.cancelInterrupt(), this._interrupt = null;
|
|
399
|
+
}
|
|
241
400
|
async clearChatHistory() {
|
|
242
401
|
this._reset(), this._orchestratorController?.clearChatHistory();
|
|
243
402
|
}
|
|
244
|
-
|
|
245
|
-
this.
|
|
403
|
+
register(e) {
|
|
404
|
+
this.#r.set(e.agent.id, e), this._orchestratorController && this.#o();
|
|
246
405
|
}
|
|
247
|
-
|
|
248
|
-
this
|
|
406
|
+
submitInterrupt(e) {
|
|
407
|
+
this.arcgisInterruptSubmit.emit(e), this._interrupt && (this._interruptDetails = [...this._interruptDetails, { interrupt: this._interrupt, response: e }]), this.orchestrator?.resumeInterrupt(e), this._interrupt = null;
|
|
249
408
|
}
|
|
250
|
-
async submitMessage(
|
|
251
|
-
const
|
|
252
|
-
if (!
|
|
409
|
+
async submitMessage(e) {
|
|
410
|
+
const s = e.trim();
|
|
411
|
+
if (!s || (this.messages.push({
|
|
253
412
|
id: Date.now().toString(),
|
|
254
413
|
// TODO: Replace with a more robust ID generation method or get from orchestrator
|
|
255
414
|
role: "user",
|
|
256
|
-
content:
|
|
415
|
+
content: s
|
|
257
416
|
}), !this._orchestratorController))
|
|
258
417
|
return;
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
418
|
+
this.#t = new AbortController(), this._orchestratorController.streamingDisabled = this.streamingDisabled;
|
|
419
|
+
const i = this._orchestratorController.ask(s, this.#t?.signal);
|
|
420
|
+
for await (const t of i) {
|
|
421
|
+
const n = t.runId, r = this.messages.at(-1);
|
|
422
|
+
switch (t.type) {
|
|
423
|
+
case "runtime":
|
|
424
|
+
this.arcgisRuntime.emit(t.event);
|
|
425
|
+
break;
|
|
426
|
+
case "block-start": {
|
|
427
|
+
this._isAnswering = !0;
|
|
428
|
+
const a = { type: t.blockType, isPending: !0 };
|
|
429
|
+
if (r?.role === "assistant" && r.id === n) {
|
|
430
|
+
const l = [...r.blocks ?? [], a];
|
|
431
|
+
this.messages.splice(-1, 1, { ...r, blocks: l });
|
|
432
|
+
} else
|
|
433
|
+
this.messages.push({
|
|
434
|
+
role: "assistant",
|
|
435
|
+
blocks: [a],
|
|
436
|
+
id: n,
|
|
437
|
+
isStreaming: !0,
|
|
438
|
+
interrupts: this._interruptDetails
|
|
439
|
+
}), this._interruptDetails = [];
|
|
440
|
+
break;
|
|
441
|
+
}
|
|
442
|
+
case "block-data": {
|
|
443
|
+
if (r?.role !== "assistant" || r?.id !== n)
|
|
444
|
+
break;
|
|
445
|
+
const a = [...r.blocks ?? []], l = a[a.length - 1], { blockType: h, data: g } = t;
|
|
446
|
+
if (l?.type !== h || !l.isPending)
|
|
447
|
+
break;
|
|
448
|
+
h === "text" ? a[a.length - 1] = {
|
|
449
|
+
...l,
|
|
450
|
+
data: {
|
|
451
|
+
...l.data,
|
|
452
|
+
parts: g?.parts
|
|
453
|
+
}
|
|
454
|
+
} : a[a.length - 1] = { ...l, data: { ...l.data, ...g ?? {} } }, this.messages.splice(-1, 1, { ...r, blocks: a });
|
|
455
|
+
break;
|
|
456
|
+
}
|
|
457
|
+
case "block-end": {
|
|
458
|
+
if (r?.role !== "assistant" || r?.id !== n)
|
|
459
|
+
break;
|
|
460
|
+
const a = [...r.blocks ?? []], l = a[a.length - 1];
|
|
461
|
+
if (l?.type !== t.blockType || !l.isPending)
|
|
462
|
+
break;
|
|
463
|
+
const h = l;
|
|
464
|
+
a[a.length - 1] = { ...h, data: { ...h.data }, isPending: !1 }, this.messages.splice(-1, 1, { ...r, blocks: a });
|
|
465
|
+
break;
|
|
466
|
+
}
|
|
263
467
|
case "completed":
|
|
264
|
-
this.messages.push({
|
|
468
|
+
t.error ? (this.messages.push({
|
|
265
469
|
role: "assistant",
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
470
|
+
log: t.log,
|
|
471
|
+
error: t.error,
|
|
472
|
+
id: n,
|
|
473
|
+
interrupts: this._interruptDetails
|
|
474
|
+
}), this._interruptDetails = []) : r?.role === "assistant" && r.id === n && this.messages.splice(-1, 1, {
|
|
475
|
+
...r,
|
|
476
|
+
content: t.response,
|
|
477
|
+
blocks: r.blocks?.map((a) => ({ ...a, data: { ...a.data }, isPending: !1 })) ?? [],
|
|
478
|
+
isStreaming: !1,
|
|
479
|
+
log: t.log
|
|
480
|
+
}), this._isAnswering = !1, this.#t = null, this._canceling = !1;
|
|
272
481
|
break;
|
|
273
482
|
case "interrupt":
|
|
274
|
-
this._interrupt = { ...
|
|
483
|
+
this._interrupt = { ...t.payload, id: n }, this.arcgisInterrupt.emit(this._interrupt);
|
|
275
484
|
break;
|
|
276
485
|
case "cancelled":
|
|
277
|
-
this.messages.
|
|
486
|
+
r?.role === "assistant" && r.id === n ? this.messages.splice(-1, 1, {
|
|
487
|
+
...r,
|
|
488
|
+
blocks: r.blocks?.filter((a) => a.type === "text" || !a.isPending) ?? [],
|
|
489
|
+
isStreaming: !1,
|
|
490
|
+
log: t.log,
|
|
491
|
+
error: `(${this._messages.stoppedByUserLabel})`
|
|
492
|
+
}) : (this.messages.push({
|
|
278
493
|
role: "assistant",
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
494
|
+
log: t.log,
|
|
495
|
+
error: `(${this._messages.stoppedByUserLabel})`,
|
|
496
|
+
id: n,
|
|
497
|
+
interrupts: this._interruptDetails
|
|
498
|
+
}), this._interruptDetails = []), this._isAnswering = !1, this.#t = null, this._canceling = !1;
|
|
282
499
|
break;
|
|
283
500
|
}
|
|
284
501
|
}
|
|
285
502
|
}
|
|
286
|
-
|
|
287
|
-
this.
|
|
503
|
+
unregister(e) {
|
|
504
|
+
this.#r.delete(e), this._orchestratorController && this.#o();
|
|
288
505
|
}
|
|
289
506
|
load() {
|
|
290
507
|
this.manager.onLifecycle(this._reset.bind(this));
|
|
291
508
|
}
|
|
292
509
|
loaded() {
|
|
293
510
|
this.manager.onLifecycle(() => {
|
|
294
|
-
this.#
|
|
295
|
-
const
|
|
296
|
-
const
|
|
297
|
-
|
|
511
|
+
this.#e.value?.addEventListener("arcgisPromptSelect", this.#p), this.#e.value?.addEventListener("arcgisSubmit", this.#c), this.#e.value?.addEventListener("arcgisCancel", this.#h), this.#e.value?.addEventListener("arcgisFeedback", this.#g);
|
|
512
|
+
const e = D(() => !!this._interrupt && !!this.#s.value, () => {
|
|
513
|
+
const i = this.#s.value;
|
|
514
|
+
i.removeEventListener("arcgisSubmit", this.#n), i.removeEventListener("arcgisCancel", this.#a), i.addEventListener("arcgisSubmit", this.#n, { once: !0 }), i.addEventListener("arcgisCancel", this.#a, { once: !0 });
|
|
515
|
+
}), s = this.messages.on("after-add", (i) => {
|
|
516
|
+
const t = i.item;
|
|
517
|
+
t.role === "assistant" && (t.error || t.content) && this.arcgisResponse.emit(t);
|
|
298
518
|
});
|
|
299
519
|
return queueMicrotask(() => {
|
|
300
|
-
this.#
|
|
301
|
-
|
|
520
|
+
this.#o().then((i) => {
|
|
521
|
+
i ? this.arcgisReady.emit() : this._error && this.arcgisError.emit(new Error(this._error));
|
|
302
522
|
});
|
|
303
523
|
}), () => {
|
|
304
|
-
|
|
524
|
+
e.remove(), s.remove(), this.#e.value?.removeEventListener("arcgisPromptSelect", this.#p), this.#s.value?.removeEventListener("arcgisSubmit", this.#n), this.#s.value?.removeEventListener("arcgisCancel", this.#a), this.#e.value?.removeEventListener("arcgisSubmit", this.#c), this.#e.value?.removeEventListener("arcgisCancel", this.#h), this.#e.value?.removeEventListener("arcgisFeedback", this.#g), this._orchestratorController?.destroy(), this._orchestratorController = null;
|
|
305
525
|
};
|
|
306
526
|
});
|
|
307
527
|
}
|
|
528
|
+
async #o() {
|
|
529
|
+
try {
|
|
530
|
+
const e = j(this.el, this.referenceElement);
|
|
531
|
+
await e?.componentOnReady();
|
|
532
|
+
const s = [...this.#r.values()];
|
|
533
|
+
return s.length ? (this._orchestratorController?.destroy(), this._orchestratorController = new d({
|
|
534
|
+
agents: s,
|
|
535
|
+
portal: this.#i,
|
|
536
|
+
runtimeEventsEnabled: this.runtimeEventsEnabled,
|
|
537
|
+
streamingDisabled: this.streamingDisabled,
|
|
538
|
+
view: e?.view
|
|
539
|
+
}), await this._orchestratorController.load(), this.requestUpdate(), !0) : (this._error = this._messages.noAgentsFoundMessage, !1);
|
|
540
|
+
} catch (e) {
|
|
541
|
+
return this._error = e?.message ?? this._messages.orchestratorInitializationErrorMessage, z(this)(e), !1;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
308
544
|
_reset() {
|
|
309
|
-
this.#
|
|
545
|
+
this._orchestratorController?.cancel(), this.#t?.abort(), this._interrupt = null, this.messages.removeAll(), this._error = null, this._inputValue = "", this._signedInUserId = void 0;
|
|
310
546
|
}
|
|
311
547
|
_renderEntryMessage() {
|
|
312
|
-
return this.
|
|
548
|
+
return this._isSignedIn ? this._error ? this._renderErrorNotice() : this.entryMessage ? this.messages.length > 0 ? null : c`<calcite-notice open kind=brand closable icon width=full><div slot=message>${this.entryMessage}</div></calcite-notice>` : c`<slot name=entry-message></slot>` : this._renderSignInNotice();
|
|
313
549
|
}
|
|
314
|
-
|
|
315
|
-
|
|
550
|
+
_renderSignInNotice() {
|
|
551
|
+
const e = this.#i;
|
|
552
|
+
return c`<calcite-notice slot=entry-message open kind=brand icon width=full><div slot=message>${this._messages.signInRequiredMessage}</div>${e ? c`<calcite-link slot=link @click=${async () => {
|
|
553
|
+
try {
|
|
554
|
+
const s = await N.getCredential(`${e.url}/sharing`);
|
|
555
|
+
this._signedInUserId = s.userId, this._error = null, this.requestUpdate(), await this.#o() ? this.arcgisReady.emit() : this._error && this.arcgisError.emit(new Error(this._error));
|
|
556
|
+
} catch (s) {
|
|
557
|
+
this._error = s?.message ?? this._messages.signInErrorMessage, this.arcgisError.emit(new Error(this._error)), B.log("error", this, "Error signing in:", { detail: { error: s } });
|
|
558
|
+
}
|
|
559
|
+
}} target=_blank title=${this._messages.signInToArcGISOnlineLabel ?? f}>${this._messages.signInLabel}</calcite-link>` : c`<div slot=link>${this._messages.noPortalInformationMessage}</div>`}</calcite-notice>`;
|
|
316
560
|
}
|
|
317
|
-
|
|
318
|
-
return this.
|
|
561
|
+
_renderErrorNotice() {
|
|
562
|
+
return this._error ? c`<calcite-notice slot=entry-message open kind=brand icon width=full>${this._error === Q ? c`<div slot=message>${X}</div><calcite-link slot=link .href=${Y} target=_blank title=${this._messages.learnAboutWebMapEmbeddingsLabel ?? f}>${this._messages.readMoreLabel}</calcite-link>` : c`<div slot=message>${this._error}</div>`}</calcite-notice>` : null;
|
|
319
563
|
}
|
|
320
564
|
render() {
|
|
321
|
-
return
|
|
322
|
-
this.#
|
|
323
|
-
}} round>${this.awaitingResponse ? this._messages.stopButtonLabel : this._messages.askButtonLabel}</calcite-button></slot></arcgis-assistant-chat-entry></slot><slot name=footer-content></slot></div></calcite-panel>`;
|
|
565
|
+
return c`<calcite-panel .loading=${!this._orchestratorController && !this._error || this._orchestratorController?.loading} .heading=${this.heading ?? this._messages.assistantLabel} .description=${this.description} ${k(this.#e)}><slot name=header-actions-start slot=header-actions-start></slot><slot name=header-actions-end slot=header-actions-end></slot><div class="content-container"><arcgis-assistant-chat .loading=${this.awaitingResponse} .messages=${this.messages} .interrupt=${this._interrupt}><slot name=message-starter slot=message-starter></slot><slot name=messages slot=messages>${this.messages.map((e) => e.role === "assistant" ? c`<arcgis-assistant-message .message=${e} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled} @arcgisSlottableRequest=${this.#d} .assistantAvatarEnabled=${this.assistantAvatarEnabled}>${e.blocks?.map((s, i) => c`<slot name=${$(e.id, i) ?? f} slot=${$(e.id, i) ?? f}><arcgis-assistant-message-block .block=${s}></arcgis-assistant-message-block></slot>`)}</arcgis-assistant-message>` : c`<arcgis-assistant-user-message .message=${e} .user=${this._user} .userAvatarEnabled=${this.userAvatarEnabled}></arcgis-assistant-user-message>`)}</slot>${this._interrupt ? c`<div slot=message-loading><div class="interrupt-waiting-message">${this._messages.waitingForUserInputMessage}</div></div>` : c`<slot name=message-loading slot=message-loading><arcgis-assistant-message-loading .loading=${this.awaitingResponse} .loadingMessage=${this.awaitingResponseStep} .assistantAvatarEnabled=${this.assistantAvatarEnabled} .interrupts=${this._interruptDetails}></arcgis-assistant-message-loading></slot>`}</arcgis-assistant-chat></div>${this._interrupt ? c`<slot name=interrupt><arcgis-assistant-interrupt slot=content-bottom .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${k(this.#s)}></arcgis-assistant-interrupt></slot>` : this.suggestedPrompts?.length ? c`<div class="suggested-prompts-container" slot=content-bottom><arcgis-assistant-suggested-prompts class="suggested-prompts" .prompts=${this.suggestedPrompts}></arcgis-assistant-suggested-prompts></div>` : null}<div class="footer-container" slot=footer>${this._renderEntryMessage()}<slot name=chat-entry><arcgis-assistant-chat-entry .awaitingResponse=${this.awaitingResponse || this._isAnswering} .inputValue=${this._inputValue} .messages=${this.messages} .voiceInputEnabled=${this.voiceInputEnabled} .disabled=${this._canceling || !this._isSignedIn || !!this._interrupt} ${k(this.#l)}><slot name=entry-actions-start slot=entry-actions-start></slot><slot name=entry-actions-end slot=entry-actions-end><calcite-button .iconStart=${this.awaitingResponse || this._isAnswering ? "circle-stop" : "send"} @click=${() => {
|
|
566
|
+
this.#l.value?.submitMessage();
|
|
567
|
+
}} round>${this.awaitingResponse || this._isAnswering ? this._messages.stopButtonLabel : this._messages.askButtonLabel}</calcite-button></slot></arcgis-assistant-chat-entry></slot><slot name=footer-content></slot></div></calcite-panel>`;
|
|
324
568
|
}
|
|
325
569
|
}
|
|
326
|
-
|
|
570
|
+
x("arcgis-assistant", ee);
|
|
327
571
|
export {
|
|
328
|
-
|
|
572
|
+
ee as ArcgisAssistant
|
|
329
573
|
};
|