@arcgis/ai-components 5.2.0-next.110 → 5.2.0-next.112
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/dist/agent-utils/BaseAgent.js +1 -1
- package/dist/agent-utils/FunctionAgent.js +1 -1
- package/dist/agent-utils/LLMAgent.d.ts +4 -5
- package/dist/agent-utils/LLMAgent.js +59 -59
- package/dist/agent-utils/WorkflowAgent.js +1 -1
- package/dist/agent-utils/index.js +1 -1
- package/dist/agent-utils/middlewares/humanInTheLoop.js +1 -1
- package/dist/agent-utils/middlewares/middleware.js +1 -1
- package/dist/agent-utils/middlewares/trace.js +6 -6
- package/dist/agent-utils/middlewares/types.js +1 -1
- package/dist/agent-utils/tools/FunctionTool.js +1 -1
- package/dist/agent-utils/workflows/ConditionalWorkflow.js +1 -1
- package/dist/agent-utils/workflows/LoopWorkflow.js +1 -1
- package/dist/agent-utils/workflows/ParallelWorkflow.js +1 -1
- package/dist/agent-utils/workflows/RouterWorkflow.js +1 -1
- package/dist/agent-utils/workflows/SequentialWorkflow.js +1 -1
- package/dist/agent-utils/workflows/SwitchWorkflow.js +1 -1
- package/dist/agentic-workflow/jsonTypes.d.ts +48 -8
- package/dist/agentic-workflow/nodes/HumanInTheLoopNode.d.ts +37 -0
- package/dist/agentic-workflow/types.d.ts +1 -1
- package/dist/agents/runtime/skill/createSkillAgent.d.ts +0 -1
- package/dist/agents/runtime/skill/createSkillAgent.js +50 -50
- package/dist/agents/runtime/skill/types.d.ts +2 -10
- package/dist/agents/runtime/skill/types.js +1 -1
- package/dist/agents/tools/filter/clearFilters/adapter.js +1 -1
- package/dist/agents/tools/filter/resetMap/adapter.js +1 -1
- package/dist/agents/tools/filter/setFeatureEffect/adapter.js +1 -1
- package/dist/agents/tools/help/listFields/adapter.js +1 -1
- package/dist/agents/tools/navigation/goToAddress/adapter.js +1 -1
- package/dist/agents/tools/navigation/goToBookmark/adapter.js +1 -1
- package/dist/agents/tools/navigation/goToFeatures/adapter.js +1 -1
- package/dist/agents/tools/navigation/goToFullExtent/adapter.js +1 -1
- package/dist/agents/tools/navigation/goToHomeExtent/adapter.js +1 -1
- package/dist/agents/tools/navigation/goToLayer/adapter.js +1 -1
- package/dist/agents/tools/navigation/goToScale/adapter.js +1 -1
- package/dist/agents/tools/navigation/goToViewpoint/adapter.js +1 -1
- package/dist/agents/tools/navigation/goToZoom/adapter.js +1 -1
- package/dist/agents/tools/query/getAttribute/adapter.js +1 -1
- package/dist/agents/tools/query/getStatistics/adapter.js +1 -1
- package/dist/agents/tools/query/getTopFeatures/adapter.js +1 -1
- package/dist/agents/tools/query/queryFeatures/adapter.js +1 -1
- package/dist/agents/tools/search/findRelevantFields/adapter.js +1 -1
- package/dist/agents/tools/search/findRelevantLayers/adapter.js +1 -1
- package/dist/agents/tools/shared/resolveToolArtifact.js +1 -1
- package/dist/agents/tools/shared/types.js +1 -1
- package/dist/cdn/2BNQ6A6J.js +2 -0
- package/dist/cdn/{FV6FHLYW.js → 2MWUBKWI.js} +2 -2
- package/dist/cdn/{GW3IVAAZ.js → 2O4DON37.js} +2 -2
- package/dist/cdn/33PB7ALY.js +2 -0
- package/dist/cdn/{FK2CVSXW.js → 33SFAZQG.js} +4 -4
- package/dist/cdn/{LLY5A2E2.js → 34O57OGV.js} +1 -1
- package/dist/cdn/{OALQBAZR.js → 3UEKINYC.js} +2 -2
- package/dist/cdn/434TAA3J.js +2 -0
- package/dist/cdn/4AQBRGO2.js +3 -0
- package/dist/cdn/{ZWIKFBOU.js → 4IU63OWQ.js} +2 -2
- package/dist/cdn/{XRVGYRXL.js → 5A355PGH.js} +2 -2
- package/dist/cdn/5BBXNT75.js +66 -0
- package/dist/cdn/{TB2GJALS.js → 5HBAJ57P.js} +2 -2
- package/dist/cdn/{7Y43R7QJ.js → 5MK44FNO.js} +2 -2
- package/dist/cdn/{LXIKAXUT.js → 5Q2XRQS6.js} +2 -2
- package/dist/cdn/{UAZPINUQ.js → 6ECRQVHY.js} +2 -2
- package/dist/cdn/{BBEGLIZC.js → 6OOZSZRJ.js} +2 -2
- package/dist/cdn/6OUIUXAJ.js +2 -0
- package/dist/cdn/{Y4TYL2AL.js → 6P44KOKX.js} +2 -2
- package/dist/cdn/{LBTGOMCT.js → 73TMZQI5.js} +2 -2
- package/dist/cdn/{BJMGT6GV.js → 74CVYM72.js} +2 -2
- package/dist/cdn/{PJPP6LOS.js → 7EHOFQ2P.js} +2 -2
- package/dist/cdn/{24EIZVUM.js → 7KSFIRXB.js} +2 -2
- package/dist/cdn/{STOGCXJH.js → AHCXG7XF.js} +2 -2
- package/dist/cdn/{VLPELJUS.js → AOVJ34QE.js} +2 -2
- package/dist/cdn/{3KNLFIM3.js → APFZY4PI.js} +2 -2
- package/dist/cdn/{KBSXHSBX.js → AVRS6UCQ.js} +2 -2
- package/dist/cdn/{YOW3YKWR.js → AVZ5Y6BK.js} +2 -2
- package/dist/cdn/{477I66FH.js → AXTQU5YL.js} +11 -11
- package/dist/cdn/BBPD2AS7.js +2 -0
- package/dist/cdn/{HV7MVIQV.js → BFZ5S7NF.js} +2 -2
- package/dist/cdn/{HMMYCSOK.js → BL273EGZ.js} +2 -2
- package/dist/cdn/C7JPWFZE.js +2 -0
- package/dist/cdn/{KKCLHXHG.js → CCC6LBMY.js} +1 -1
- package/dist/cdn/{NNPA3NLK.js → CEKOEHB3.js} +2 -2
- package/dist/cdn/{W54XYT2A.js → CFAC4FN3.js} +2 -2
- package/dist/cdn/{53KIFJFA.js → COH3QXWG.js} +2 -2
- package/dist/cdn/{CX2HJ67C.js → DB2TFPIO.js} +2 -2
- package/dist/cdn/{EYGZJKVD.js → DE26DAW5.js} +2 -2
- package/dist/cdn/DG27JEYG.js +50 -0
- package/dist/cdn/DKA6PSYN.js +2 -0
- package/dist/cdn/DWH23NJN.js +2 -0
- package/dist/cdn/EDXTPEEU.js +2 -0
- package/dist/cdn/{6KWGSXIN.js → ENM3L4AC.js} +2 -2
- package/dist/cdn/{XV7RMYLR.js → EVMIYZWD.js} +2 -2
- package/dist/cdn/{FHBRXZLV.js → EYOWRGDP.js} +2 -2
- package/dist/cdn/{45BDE3MG.js → EYY367WR.js} +2 -2
- package/dist/cdn/{2UJPYWWZ.js → F3CSORDI.js} +2 -2
- package/dist/cdn/{27CK3JHY.js → F5NIRETW.js} +2 -2
- package/dist/cdn/{TFAJNKBC.js → FCI6M62J.js} +2 -2
- package/dist/cdn/{V4PJMCJZ.js → FDOMMK2M.js} +1 -1
- package/dist/cdn/{4OI4QEV7.js → FS7GXTTQ.js} +2 -2
- package/dist/cdn/{IHUWQOMK.js → FYZATVB3.js} +2 -2
- package/dist/cdn/{3PPXAIRE.js → H6P3WP5D.js} +2 -2
- package/dist/cdn/HHP5YLUI.js +2 -0
- package/dist/cdn/HIAQARIQ.js +2 -0
- package/dist/cdn/HMIDFTEI.js +2 -0
- package/dist/cdn/{4CFCV47G.js → HMNBUGH2.js} +2 -2
- package/dist/cdn/HR6GWPKX.js +2 -0
- package/dist/cdn/{V266DJ5V.js → ICBIUFK7.js} +2 -2
- package/dist/cdn/{BTOBEN7Q.js → IH26MIYY.js} +2 -2
- package/dist/cdn/{QAX6UF4L.js → IHP25JWI.js} +2 -2
- package/dist/cdn/{M2U456J5.js → IYLFJCJ2.js} +4 -4
- package/dist/cdn/{JMXXRRKQ.js → J6A4AS7E.js} +2 -2
- package/dist/cdn/{QTEPFTAU.js → JEBRN3EU.js} +2 -2
- package/dist/cdn/{G24MNC7D.js → JICNSK6Y.js} +2 -2
- package/dist/cdn/JQYLMTDP.js +2 -0
- package/dist/cdn/{275FFTBE.js → K5JVB6FU.js} +2 -2
- package/dist/cdn/K7XWGSLN.js +2 -0
- package/dist/cdn/{M3KKORBG.js → K7YQIJFT.js} +2 -2
- package/dist/cdn/KH4V4I3W.js +2 -0
- package/dist/cdn/KMLJS2VW.js +2 -0
- package/dist/cdn/{HNTSDY3J.js → LAVFUDUG.js} +2 -2
- package/dist/cdn/{LL324IL6.js → LFQLCCJJ.js} +2 -2
- package/dist/cdn/{L3BTURBA.js → LK7ZIQW6.js} +2 -2
- package/dist/cdn/{ZJWR4W2S.js → LOQ2PKV5.js} +58 -58
- package/dist/cdn/{X42ACC66.js → LXPGQNXQ.js} +2 -2
- package/dist/cdn/{TXZQZR3I.js → MJSIYEWN.js} +2 -2
- package/dist/cdn/{CSE6BHOJ.js → MWYBF3F3.js} +2 -2
- package/dist/cdn/{FDRAKF5D.js → MXTXJKFE.js} +2 -2
- package/dist/cdn/{7DOYUO7L.js → NEV6OZN3.js} +2 -2
- package/dist/cdn/{NBDOPGSN.js → O4NVW75A.js} +2 -2
- package/dist/cdn/{ZA7ZU2F7.js → OKVLGJAG.js} +2 -2
- package/dist/cdn/{SUC2MIGE.js → OMF6ITSG.js} +2 -2
- package/dist/cdn/{A6LBMS7A.js → ONQ6JSBJ.js} +1 -1
- package/dist/cdn/{CKUUYQLO.js → OZAZ277H.js} +2 -2
- package/dist/cdn/{XNUWVZN7.js → P4XZMBU5.js} +2 -2
- package/dist/cdn/{L2HLFWCV.js → POL6HKCG.js} +3 -3
- package/dist/cdn/{AP3KPOHN.js → POZYDAU2.js} +2 -2
- package/dist/cdn/{FTTLFIBV.js → PQ2DPOFM.js} +2 -2
- package/dist/cdn/{ZY3JQCZQ.js → QNXI3WOF.js} +36 -36
- package/dist/cdn/{4VBOTWC3.js → QRMRID2M.js} +2 -2
- package/dist/cdn/{TLPZELG3.js → R74ZHFA6.js} +1 -1
- package/dist/cdn/{OF3TAARW.js → RHYNE5OE.js} +1 -1
- package/dist/cdn/{4YOG5F3W.js → RLEHNAIA.js} +1 -1
- package/dist/cdn/RXF2NUOL.js +2 -0
- package/dist/cdn/{MZUDIQQH.js → SDWWUWAF.js} +2 -2
- package/dist/cdn/SHI76XUV.js +2 -0
- package/dist/cdn/SITY6L4S.js +2 -0
- package/dist/cdn/{RSM7MEVT.js → SLR75R32.js} +2 -2
- package/dist/cdn/STHBRTTD.js +2 -0
- package/dist/cdn/{7UBTNDV6.js → SXM4NUT5.js} +2 -2
- package/dist/cdn/{XVJFPZTW.js → SZRJTQ54.js} +2 -2
- package/dist/cdn/TO2NY7EA.js +2 -0
- package/dist/cdn/{4IWDBEMN.js → TPULIO6I.js} +2 -2
- package/dist/cdn/TVEEQSMF.js +2 -0
- package/dist/cdn/TWU3QXAS.js +2 -0
- package/dist/cdn/{EGRRZTF6.js → TYATJUNF.js} +2 -2
- package/dist/cdn/UCTC4JN4.js +3 -0
- package/dist/cdn/{HI3XKFHD.js → UDRKUVZP.js} +2 -2
- package/dist/cdn/{JYNHWJUZ.js → UHEYPSOR.js} +2 -2
- package/dist/cdn/{VGLBH473.js → UHICISBZ.js} +2 -2
- package/dist/cdn/UO5PBOQR.js +2 -0
- package/dist/cdn/{BVUCNXC5.js → UZLQALHY.js} +1 -1
- package/dist/cdn/{SNG3WODY.js → V6HOUZPZ.js} +2 -2
- package/dist/cdn/{V52GSTOC.js → V7Y22FRP.js} +2 -2
- package/dist/cdn/{I72ST4JR.js → VAXH6RUQ.js} +2 -2
- package/dist/cdn/{NV7CL4S3.js → VNLSYVPE.js} +2 -2
- package/dist/cdn/VR3CF3ZY.js +2 -0
- package/dist/cdn/{VK6CCPTG.js → VWP2B4LB.js} +2 -2
- package/dist/cdn/VXFQANGJ.js +2 -0
- package/dist/cdn/WKZHFSH3.js +2 -0
- package/dist/cdn/{OXC2WP7W.js → WSWB3B7B.js} +2 -2
- package/dist/cdn/{EK3PM4L5.js → WVP73XWD.js} +2 -2
- package/dist/cdn/{SJMAKF4P.js → WXQ26G5Q.js} +2 -2
- package/dist/cdn/{2F4TPWZQ.js → XQ3NBBQ3.js} +1 -1
- package/dist/cdn/{JUNMTIB3.js → XV3DHHYJ.js} +2 -2
- package/dist/cdn/{VXLKTQ36.js → YHWYTHID.js} +2 -2
- package/dist/cdn/{XOTPSCNF.js → YIZ7PR2G.js} +2 -2
- package/dist/cdn/{T6W6F4TF.js → Z5XQLSYH.js} +2 -2
- package/dist/cdn/{Y6CV2NZR.js → ZFOG3KXV.js} +2 -2
- package/dist/cdn/{FPH52WOH.js → ZU2FHVNK.js} +2 -2
- package/dist/cdn/agent-utils/index.js +2 -2
- package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +2 -3
- package/dist/cdn/agent-utils/middlewares/middleware.js +2 -2
- package/dist/cdn/agent-utils/middlewares/trace.js +2 -2
- package/dist/cdn/assets/assistant/t9n/messages.en.json +1 -1
- package/dist/cdn/index.js +2 -2
- package/dist/chunks/BaseWorkflow.js +1 -1
- package/dist/chunks/SKILL.js +1 -1
- package/dist/chunks/SKILL2.js +1 -1
- package/dist/chunks/SKILL3.js +1 -1
- package/dist/chunks/SKILL4.js +1 -1
- package/dist/chunks/adapter.js +1 -1
- package/dist/chunks/aiFactory.js +56 -50
- package/dist/chunks/arcgisKnowledgeGraph.js +2 -2
- package/dist/chunks/arcgisToolRegistry.js +1 -1
- package/dist/chunks/arcgis_knowledge_current_lc_context.js +1 -1
- package/dist/chunks/arcgis_knowledge_current_map_context.js +1 -1
- package/dist/chunks/arcgis_knowledge_cypher_query_prompt.js +1 -1
- package/dist/chunks/arcgis_knowledge_lucene_generation_prompt.js +1 -1
- package/dist/chunks/arcgis_knowledge_summarize_result_prompt.js +1 -1
- package/dist/chunks/arcgis_knowledge_tool_prompt.js +1 -1
- package/dist/chunks/baseAgentState.js +1 -1
- package/dist/chunks/converterUtils.js +1 -1
- package/dist/chunks/dataExplorationAgent.js +1 -1
- package/dist/chunks/data_explore_filter_prompt.js +1 -1
- package/dist/chunks/data_explore_query_prompt.js +1 -1
- package/dist/chunks/embeddings.worker.js +1 -1
- package/dist/chunks/fetchAgentContext.js +1 -1
- package/dist/chunks/fetchService.js +1 -1
- package/dist/chunks/fieldStatistics.js +1 -1
- package/dist/chunks/field_descriptions_prompt.js +1 -1
- package/dist/chunks/formatFeatureAttributes.js +1 -1
- package/dist/chunks/generateLayerDescriptions.js +60 -63
- package/dist/chunks/graph.js +1 -1
- package/dist/chunks/helpAgent.js +1 -1
- package/dist/chunks/help_prompt.js +1 -1
- package/dist/chunks/index.js +1 -1
- package/dist/chunks/intent_prompt.js +1 -1
- package/dist/chunks/layerStylingGraph.js +1 -1
- package/dist/chunks/layer_descriptions_prompt.js +1 -1
- package/dist/chunks/layer_styling_prompt.js +1 -1
- package/dist/chunks/mergeWhereClauses.js +1 -1
- package/dist/chunks/navigationAgent.js +1 -1
- package/dist/chunks/navigation_intent_prompt.js +1 -1
- package/dist/chunks/navigation_tool_prompt.js +1 -1
- package/dist/chunks/orchestrator.js +1 -1
- package/dist/chunks/requireAgentServices.js +1 -1
- package/dist/chunks/resolvePointGeometryFilter.js +1 -1
- package/dist/chunks/runtime.js +1 -1
- package/dist/chunks/slottableRequestUtils.js +1 -1
- package/dist/chunks/state.js +26 -26
- package/dist/chunks/summarize_query_response_prompt.js +1 -1
- package/dist/chunks/useT9n.js +1 -1
- package/dist/chunks/utils.js +1 -1
- package/dist/chunks/utils2.js +1 -1
- package/dist/chunks/utils3.js +1 -1
- package/dist/components/arcgis-assistant/customElement.d.ts +6 -0
- package/dist/components/arcgis-assistant/customElement.js +126 -114
- package/dist/components/arcgis-assistant-agent/customElement.js +362 -220
- package/dist/components/arcgis-assistant-chat/customElement.js +1 -1
- package/dist/components/arcgis-assistant-chat-entry/customElement.js +1 -1
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-help-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-interrupt/customElement.js +1 -1
- package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +1 -1
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-message/customElement.js +1 -1
- package/dist/components/arcgis-assistant-message-block/customElement.js +1 -1
- package/dist/components/arcgis-assistant-message-feedback/customElement.js +1 -1
- package/dist/components/arcgis-assistant-message-footer/customElement.js +1 -1
- package/dist/components/arcgis-assistant-message-loading/customElement.js +1 -1
- package/dist/components/arcgis-assistant-message-log/customElement.js +1 -1
- package/dist/components/arcgis-assistant-message-read-aloud/customElement.js +1 -1
- package/dist/components/arcgis-assistant-message-text/customElement.js +1 -1
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-speech-input/customElement.js +1 -1
- package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +1 -1
- package/dist/components/arcgis-assistant-user-message/customElement.js +1 -1
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/index.js +1 -1
- package/dist/loader.js +1 -1
- package/dist/utils/index.js +3 -3
- package/package.json +11 -11
- package/dist/cdn/25MBI4PD.js +0 -2
- package/dist/cdn/2LVYAXHG.js +0 -44
- package/dist/cdn/2WXXSZP5.js +0 -2
- package/dist/cdn/5X23DDDZ.js +0 -2
- package/dist/cdn/65LCK3GG.js +0 -3
- package/dist/cdn/AUCKEB52.js +0 -2
- package/dist/cdn/B3HXSEBN.js +0 -2
- package/dist/cdn/BTTCBEPW.js +0 -2
- package/dist/cdn/CAOMMQSY.js +0 -66
- package/dist/cdn/EXMEB4X2.js +0 -2
- package/dist/cdn/FLUI6GCU.js +0 -2
- package/dist/cdn/FRYS2PZJ.js +0 -2
- package/dist/cdn/FSLQCZRN.js +0 -2
- package/dist/cdn/HKIA5PWU.js +0 -2
- package/dist/cdn/I3SUE2TR.js +0 -2
- package/dist/cdn/KAX4A7SF.js +0 -2
- package/dist/cdn/LIRT72WY.js +0 -2
- package/dist/cdn/M5B6X46F.js +0 -2
- package/dist/cdn/NGR5NVZE.js +0 -2
- package/dist/cdn/PUZ6RAFQ.js +0 -2
- package/dist/cdn/ROS22KOA.js +0 -2
- package/dist/cdn/SBNNJ5WA.js +0 -2
- package/dist/cdn/SDX46GZY.js +0 -2
- package/dist/cdn/SI22EJLC.js +0 -2
- package/dist/cdn/SXYKNDOF.js +0 -2
- package/dist/cdn/SZ2L5556.js +0 -2
- package/dist/cdn/UGIHS7OA.js +0 -2
- package/dist/cdn/VT5EWFH7.js +0 -2
- package/dist/cdn/XZF7Y6B2.js +0 -2
- package/dist/cdn/Y4ZOB6UH.js +0 -2
- package/dist/cdn/YIXASZUW.js +0 -2
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
2
|
-
import { c as
|
|
3
|
-
import { css as
|
|
4
|
-
import
|
|
5
|
-
import { whenOnce as R, watch as D, when as
|
|
6
|
-
import
|
|
7
|
-
import { LitElement as
|
|
8
|
-
import * as
|
|
9
|
-
import { rethrowError as
|
|
10
|
-
import { createRef as w, ref as
|
|
11
|
-
import { u as
|
|
12
|
-
import { O as
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { c as L } from "../../chunks/runtime.js";
|
|
3
|
+
import { css as T, html as g } from "lit";
|
|
4
|
+
import M from "@arcgis/core/core/Collection.js";
|
|
5
|
+
import { whenOnce as R, watch as D, when as O } from "@arcgis/core/core/reactiveUtils.js";
|
|
6
|
+
import U from "@arcgis/core/portal/Portal.js";
|
|
7
|
+
import { LitElement as B, createEvent as d, nothing as _ } from "@arcgis/lumina";
|
|
8
|
+
import * as z from "@arcgis/toolkit/log";
|
|
9
|
+
import { rethrowError as N } from "@arcgis/toolkit/log";
|
|
10
|
+
import { createRef as w, ref as E } from "lit/directives/ref.js";
|
|
11
|
+
import { u as F } from "../../chunks/useT9n.js";
|
|
12
|
+
import { O as q } from "../../chunks/orchestrator.js";
|
|
13
13
|
import "@langchain/core/callbacks/dispatch/web";
|
|
14
14
|
import "@langchain/core/prompts";
|
|
15
15
|
import "@langchain/openai";
|
|
16
16
|
import "@arcgis/core/request.js";
|
|
17
|
-
import
|
|
17
|
+
import S from "@arcgis/core/identity/IdentityManager.js";
|
|
18
18
|
import "@arcgis/toolkit/string";
|
|
19
19
|
import "@arcgis/core/config.js";
|
|
20
20
|
import "@langchain/core/messages";
|
|
21
21
|
import "@arcgis/core/layers/FeatureLayer.js";
|
|
22
22
|
import "../../chunks/generateLayerDescriptions.js";
|
|
23
23
|
import "@langchain/langgraph/web";
|
|
24
|
-
import
|
|
25
|
-
import { property as b, subclass as
|
|
26
|
-
import { marked as
|
|
27
|
-
import { g as
|
|
28
|
-
import { g as
|
|
29
|
-
const W =
|
|
30
|
-
function
|
|
31
|
-
return o.trim() ?
|
|
24
|
+
import H from "@arcgis/core/core/Accessor.js";
|
|
25
|
+
import { property as b, subclass as V } from "@arcgis/core/core/accessorSupport/decorators.js";
|
|
26
|
+
import { marked as I } from "marked";
|
|
27
|
+
import { g as j } from "../../chunks/utils3.js";
|
|
28
|
+
import { g as $ } from "../../chunks/slottableRequestUtils.js";
|
|
29
|
+
const W = T`: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 k(o) {
|
|
31
|
+
return o.trim() ? I.lexer(o).filter((t) => t.type !== "space").map((t) => I.parser([t])) : [];
|
|
32
32
|
}
|
|
33
|
-
class
|
|
33
|
+
class P {
|
|
34
34
|
constructor() {
|
|
35
35
|
this._stableParts = [], this._stableText = "", this._rawText = "";
|
|
36
36
|
}
|
|
@@ -42,11 +42,11 @@ class A {
|
|
|
42
42
|
// Parse the remaining live tail. Call once at stream end.
|
|
43
43
|
finalize() {
|
|
44
44
|
const t = this._rawText.slice(this._stableText.length);
|
|
45
|
-
return t.trim() && (this._stableParts.push(...
|
|
45
|
+
return t.trim() && (this._stableParts.push(...k(t)), this._stableText = this._rawText), this._stableParts;
|
|
46
46
|
}
|
|
47
47
|
// Get full output: stable segments + current live tail.
|
|
48
48
|
getParts() {
|
|
49
|
-
const t = this._trimIncompleteTail(this._rawText.slice(this._stableText.length)), e = t.trim() ?
|
|
49
|
+
const t = this._trimIncompleteTail(this._rawText.slice(this._stableText.length)), e = t.trim() ? k(t) : [];
|
|
50
50
|
return [...this._stableParts, ...e];
|
|
51
51
|
}
|
|
52
52
|
reset() {
|
|
@@ -57,8 +57,8 @@ class A {
|
|
|
57
57
|
const t = this._rawText.slice(this._stableText.length), e = this._lastSafeBoundary(t);
|
|
58
58
|
if (e <= 0)
|
|
59
59
|
return;
|
|
60
|
-
const
|
|
61
|
-
this._stableParts.push(...
|
|
60
|
+
const s = t.slice(0, e);
|
|
61
|
+
this._stableParts.push(...k(s)), this._stableText += s;
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
64
|
* Find the last blank-line boundary that is outside code fences.
|
|
@@ -67,9 +67,9 @@ class A {
|
|
|
67
67
|
_lastSafeBoundary(t) {
|
|
68
68
|
const e = t.split(`
|
|
69
69
|
`);
|
|
70
|
-
let
|
|
70
|
+
let s = !1, r = 0, i = 0;
|
|
71
71
|
for (const l of e)
|
|
72
|
-
/^\s*(```|~~~)/u.test(l) && (
|
|
72
|
+
/^\s*(```|~~~)/u.test(l) && (s = !s), i += l.length + 1, l.trim() === "" && !s && (r = i);
|
|
73
73
|
return r < t.length ? r : 0;
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
@@ -83,13 +83,13 @@ class A {
|
|
|
83
83
|
const e = t.lastIndexOf("<");
|
|
84
84
|
if (e !== -1 && !t.includes(">", e))
|
|
85
85
|
return t.slice(0, e);
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
88
|
-
return t.slice(0,
|
|
86
|
+
const s = this._earliestUnclosedTag(t);
|
|
87
|
+
if (s !== -1)
|
|
88
|
+
return t.slice(0, s);
|
|
89
89
|
const r = t.lastIndexOf("[");
|
|
90
90
|
if (r !== -1) {
|
|
91
|
-
const
|
|
92
|
-
if (!/\[[^\]]*\]\([^)]*\)/u.test(
|
|
91
|
+
const i = t.slice(r);
|
|
92
|
+
if (!/\[[^\]]*\]\([^)]*\)/u.test(i))
|
|
93
93
|
return t.slice(0, r);
|
|
94
94
|
}
|
|
95
95
|
return t;
|
|
@@ -113,9 +113,9 @@ class A {
|
|
|
113
113
|
"source",
|
|
114
114
|
"track",
|
|
115
115
|
"wbr"
|
|
116
|
-
]),
|
|
117
|
-
for (let
|
|
118
|
-
const [, l, a, n] =
|
|
116
|
+
]), s = /<(\/?)([a-zA-Z][\w-]*)\b[^>]*?(\/?)>/gu, r = [];
|
|
117
|
+
for (let i = s.exec(t); i; i = s.exec(t)) {
|
|
118
|
+
const [, l, a, n] = i, c = a.toLowerCase();
|
|
119
119
|
if (!(e.has(c) || n === "/"))
|
|
120
120
|
if (l === "/") {
|
|
121
121
|
for (let h = r.length - 1; h >= 0; h--)
|
|
@@ -124,46 +124,46 @@ class A {
|
|
|
124
124
|
break;
|
|
125
125
|
}
|
|
126
126
|
} else
|
|
127
|
-
r.push({ name: c, index:
|
|
127
|
+
r.push({ name: c, index: i.index });
|
|
128
128
|
}
|
|
129
129
|
return r.length ? r[0].index : -1;
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
function G(o) {
|
|
133
|
-
const t = new
|
|
133
|
+
const t = new P();
|
|
134
134
|
return t.push(o), t.finalize();
|
|
135
135
|
}
|
|
136
136
|
const Z = async (o) => await new Promise((t) => setTimeout(t, o));
|
|
137
137
|
async function* J(o, { chunkSize: t = 15, delay: e = 50 } = {}) {
|
|
138
|
-
const
|
|
138
|
+
const s = new P();
|
|
139
139
|
for (let r = 0; r < o.length; r += t)
|
|
140
|
-
yield
|
|
141
|
-
yield
|
|
140
|
+
yield s.push(o.slice(r, r + t)), await Z(e);
|
|
141
|
+
yield s.finalize();
|
|
142
142
|
}
|
|
143
|
-
var K = Object.defineProperty, Q = Object.getOwnPropertyDescriptor, m = (o, t, e,
|
|
144
|
-
for (var r =
|
|
145
|
-
(l = o[
|
|
146
|
-
return
|
|
143
|
+
var K = Object.defineProperty, Q = Object.getOwnPropertyDescriptor, m = (o, t, e, s) => {
|
|
144
|
+
for (var r = s > 1 ? void 0 : s ? Q(t, e) : t, i = o.length - 1, l; i >= 0; i--)
|
|
145
|
+
(l = o[i]) && (r = (s ? l(t, e, r) : l(r)) || r);
|
|
146
|
+
return s && r && K(t, e, r), r;
|
|
147
147
|
};
|
|
148
|
-
const
|
|
149
|
-
async function* C(o, t, e,
|
|
148
|
+
const A = (o) => !o || typeof o != "object" ? !1 : o.name === "AbortError";
|
|
149
|
+
async function* C(o, t, e, s, r = !1) {
|
|
150
150
|
if (r) {
|
|
151
|
-
if (
|
|
151
|
+
if (s?.aborted) {
|
|
152
152
|
yield { type: "cancelled", log: e, runId: t };
|
|
153
153
|
return;
|
|
154
154
|
}
|
|
155
155
|
yield { type: "block-data", blockType: "text", data: { parts: G(o) }, runId: t };
|
|
156
156
|
return;
|
|
157
157
|
}
|
|
158
|
-
for await (const
|
|
159
|
-
if (
|
|
158
|
+
for await (const i of J(o)) {
|
|
159
|
+
if (s?.aborted) {
|
|
160
160
|
yield { type: "cancelled", log: e, runId: t };
|
|
161
161
|
return;
|
|
162
162
|
}
|
|
163
|
-
yield { type: "block-data", blockType: "text", data: { parts:
|
|
163
|
+
yield { type: "block-data", blockType: "text", data: { parts: i }, runId: t };
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
let p = class extends
|
|
166
|
+
let p = class extends H {
|
|
167
167
|
constructor(o) {
|
|
168
168
|
super(o), this.view = null, this.streamingDisabled = !1, this.runtimeEventsEnabled = !1, this.loading = !1, this.processing = !1, this.processingStep = "";
|
|
169
169
|
}
|
|
@@ -181,7 +181,7 @@ let p = class extends F {
|
|
|
181
181
|
async _initialize() {
|
|
182
182
|
this.removeHandles(), await Promise.all([this.portal.load(), this.view?.when()]), this.view && await R(() => !this.view.updating), this._set(
|
|
183
183
|
"orchestrator",
|
|
184
|
-
await
|
|
184
|
+
await q.init({
|
|
185
185
|
agents: [...this.agents],
|
|
186
186
|
runtimeEventsEnabled: this.runtimeEventsEnabled,
|
|
187
187
|
view: this.view ?? void 0
|
|
@@ -202,43 +202,43 @@ let p = class extends F {
|
|
|
202
202
|
if (!this.orchestrator)
|
|
203
203
|
throw new Error("Orchestrator not initialized yet.");
|
|
204
204
|
this._set("processing", !0), this._set("processingStep", "");
|
|
205
|
-
const
|
|
206
|
-
let r,
|
|
205
|
+
const s = [];
|
|
206
|
+
let r, i = "pending";
|
|
207
207
|
try {
|
|
208
208
|
const l = this.orchestrator.ask(o, t);
|
|
209
209
|
for await (const a of l)
|
|
210
|
-
switch (
|
|
210
|
+
switch (i = a.runId, a.type) {
|
|
211
211
|
case "runtime": {
|
|
212
|
-
yield { type: "runtime", event: a, runId:
|
|
212
|
+
yield { type: "runtime", event: a, runId: i };
|
|
213
213
|
break;
|
|
214
214
|
}
|
|
215
215
|
case "trace": {
|
|
216
|
-
this._set("processingStep", a.data.text),
|
|
216
|
+
this._set("processingStep", a.data.text), s.push(a.data.text);
|
|
217
217
|
break;
|
|
218
218
|
}
|
|
219
219
|
case "completed": {
|
|
220
220
|
this._set("processing", !1), this._set("processingStep", "");
|
|
221
221
|
const n = a.result, c = !!n.content.length, h = !!r?.length;
|
|
222
222
|
if (!c && !h) {
|
|
223
|
-
yield { type: "completed", error: "No response received.", log:
|
|
223
|
+
yield { type: "completed", error: "No response received.", log: s, runId: i };
|
|
224
224
|
return;
|
|
225
225
|
}
|
|
226
226
|
const u = n.content;
|
|
227
|
-
if (yield { type: "block-start", blockType: "text", runId:
|
|
227
|
+
if (yield { type: "block-start", blockType: "text", runId: i }, yield* C(u, i, s, e, this.streamingDisabled), yield { type: "block-end", blockType: "text", runId: i }, h)
|
|
228
228
|
for (const y of r) {
|
|
229
229
|
if (e?.aborted) {
|
|
230
|
-
yield { type: "cancelled", log:
|
|
230
|
+
yield { type: "cancelled", log: s, runId: i };
|
|
231
231
|
return;
|
|
232
232
|
}
|
|
233
233
|
const { type: f, data: v } = y;
|
|
234
|
-
if (yield { type: "block-start", blockType: f, runId:
|
|
235
|
-
const
|
|
236
|
-
yield* C(
|
|
234
|
+
if (yield { type: "block-start", blockType: f, runId: i }, f === "text") {
|
|
235
|
+
const x = typeof v?.content == "string" ? v.content : "";
|
|
236
|
+
yield* C(x, i, s, e, this.streamingDisabled);
|
|
237
237
|
} else
|
|
238
|
-
yield { type: "block-data", blockType: f, data: v, runId:
|
|
239
|
-
yield { type: "block-end", blockType: f, runId:
|
|
238
|
+
yield { type: "block-data", blockType: f, data: v, runId: i };
|
|
239
|
+
yield { type: "block-end", blockType: f, runId: i };
|
|
240
240
|
}
|
|
241
|
-
yield { type: "completed", response: u, blocks: r, log:
|
|
241
|
+
yield { type: "completed", response: u, blocks: r, log: s, runId: i };
|
|
242
242
|
return;
|
|
243
243
|
}
|
|
244
244
|
case "ux-suggestion": {
|
|
@@ -261,19 +261,19 @@ let p = class extends F {
|
|
|
261
261
|
return { type: n, message: c, options: u };
|
|
262
262
|
}
|
|
263
263
|
})();
|
|
264
|
-
this._set("processingStep", "Waiting for user input..."), yield { type: "interrupt", payload: y, runId:
|
|
264
|
+
this._set("processingStep", "Waiting for user input..."), yield { type: "interrupt", payload: y, runId: i };
|
|
265
265
|
break;
|
|
266
266
|
}
|
|
267
267
|
case "cancelled": {
|
|
268
|
-
yield { type: "cancelled", log:
|
|
268
|
+
yield { type: "cancelled", log: s, runId: i };
|
|
269
269
|
return;
|
|
270
270
|
}
|
|
271
271
|
case "error": {
|
|
272
|
-
if (e?.aborted ||
|
|
273
|
-
yield { type: "cancelled", log:
|
|
272
|
+
if (e?.aborted || A(a.error)) {
|
|
273
|
+
yield { type: "cancelled", log: s, runId: i };
|
|
274
274
|
return;
|
|
275
275
|
}
|
|
276
|
-
yield { type: "completed", error: a.error.message, log:
|
|
276
|
+
yield { type: "completed", error: a.error.message, log: s, runId: i };
|
|
277
277
|
return;
|
|
278
278
|
}
|
|
279
279
|
default: {
|
|
@@ -282,11 +282,11 @@ let p = class extends F {
|
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
284
|
} catch (l) {
|
|
285
|
-
if (e?.aborted ||
|
|
286
|
-
yield { type: "cancelled", log:
|
|
285
|
+
if (e?.aborted || A(l)) {
|
|
286
|
+
yield { type: "cancelled", log: s, runId: i };
|
|
287
287
|
return;
|
|
288
288
|
}
|
|
289
|
-
console.warn("Error during message processing:", l), yield { type: "completed", error: "An error occurred during message processing.", log:
|
|
289
|
+
console.warn("Error during message processing:", l), yield { type: "completed", error: "An error occurred during message processing.", log: s, runId: "error" };
|
|
290
290
|
return;
|
|
291
291
|
} finally {
|
|
292
292
|
this._set("processing", !1);
|
|
@@ -324,12 +324,12 @@ m([
|
|
|
324
324
|
b({ readOnly: !0 })
|
|
325
325
|
], p.prototype, "processingStep", 2);
|
|
326
326
|
p = m([
|
|
327
|
-
|
|
327
|
+
V("OrchestratorController")
|
|
328
328
|
], p);
|
|
329
329
|
const X = "Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.", Y = "Embeddings not found for this web map.", tt = "https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings";
|
|
330
|
-
class et extends
|
|
330
|
+
class et extends B {
|
|
331
331
|
constructor() {
|
|
332
|
-
super(...arguments), this._messages =
|
|
332
|
+
super(...arguments), this._messages = F({ blocking: !0 }), this.#t = w(), this.#o = w(), this.#i = w(), this.#e = null, this.#r = /* @__PURE__ */ new Map(), this.#s = U.getDefault(), this.#a = (t) => {
|
|
333
333
|
t.stopPropagation(), this.cancelInterrupt();
|
|
334
334
|
}, this.#n = (t) => {
|
|
335
335
|
t.stopPropagation();
|
|
@@ -355,7 +355,7 @@ class et extends U {
|
|
|
355
355
|
this._inputValue = e.prompt, this.arcgisPromptSelect.emit(e);
|
|
356
356
|
}, this.#u = (t) => {
|
|
357
357
|
this.arcgisSlottableRequest.emit(t.detail);
|
|
358
|
-
}, this._orchestratorController = null, this._interrupt = null, this._interruptDetails = [], this._error = null, this._inputValue = "", this._isAnswering = !1, this._canceling = !1, this.messages = new
|
|
358
|
+
}, this._orchestratorController = null, this._interrupt = null, this._interruptDetails = [], this._error = null, this._inputValue = "", this._isAnswering = !1, this._canceling = !1, this.messages = new M([]), 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 = d(), this.arcgisError = d(), this.arcgisFeedback = d(), this.arcgisInterrupt = d(), this.arcgisInterruptCancel = d(), this.arcgisInterruptSubmit = d(), this.arcgisPromptSelect = d(), this.arcgisReady = d(), this.arcgisResponse = d(), this.arcgisRuntime = d({ bubbles: !1, composed: !1 }), this.arcgisSlottableRequest = d({ bubbles: !1, composed: !1 }), this.arcgisSubmit = d();
|
|
359
359
|
}
|
|
360
360
|
static {
|
|
361
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, alwaysUseAgentId: 1, allowedAgentIds: 0, suggestedPrompts: 0, feedbackEnabled: 5, keepSuggestedPrompts: 5, streamingDisabled: 5, runtimeEventsEnabled: 5, logEnabled: 5, copyEnabled: 5, voiceInputEnabled: 5, readAloudEnabled: 5, assistantAvatarEnabled: 5, userAvatarEnabled: 5 };
|
|
@@ -365,10 +365,10 @@ class et extends U {
|
|
|
365
365
|
}
|
|
366
366
|
#t;
|
|
367
367
|
#o;
|
|
368
|
-
#
|
|
368
|
+
#i;
|
|
369
369
|
#e;
|
|
370
370
|
#r;
|
|
371
|
-
#
|
|
371
|
+
#s;
|
|
372
372
|
#a;
|
|
373
373
|
#n;
|
|
374
374
|
#l;
|
|
@@ -377,10 +377,10 @@ class et extends U {
|
|
|
377
377
|
#g;
|
|
378
378
|
#u;
|
|
379
379
|
get _isSignedIn() {
|
|
380
|
-
return !!this.#
|
|
380
|
+
return !!this.#s?.user || !!this._signedInUserId;
|
|
381
381
|
}
|
|
382
382
|
get _user() {
|
|
383
|
-
return this.#
|
|
383
|
+
return this.#s?.user?.fullName || this.#s?.user?.username;
|
|
384
384
|
}
|
|
385
385
|
get awaitingResponse() {
|
|
386
386
|
return this._orchestratorController?.processing ?? !1;
|
|
@@ -416,16 +416,16 @@ class et extends U {
|
|
|
416
416
|
}), !this._orchestratorController))
|
|
417
417
|
return;
|
|
418
418
|
this.#e = new AbortController(), this._orchestratorController.streamingDisabled = this.streamingDisabled;
|
|
419
|
-
const
|
|
420
|
-
for await (const
|
|
421
|
-
const l =
|
|
422
|
-
switch (
|
|
419
|
+
const s = this.alwaysUseAgentId ? { routing: "direct", agentId: this.alwaysUseAgentId } : { routing: "auto", agentIds: this.allowedAgentIds }, r = this._orchestratorController.ask(e, s, this.#e?.signal);
|
|
420
|
+
for await (const i of r) {
|
|
421
|
+
const l = i.runId, a = this.messages.at(-1);
|
|
422
|
+
switch (i.type) {
|
|
423
423
|
case "runtime":
|
|
424
|
-
this.arcgisRuntime.emit(
|
|
424
|
+
this.arcgisRuntime.emit(i.event);
|
|
425
425
|
break;
|
|
426
426
|
case "block-start": {
|
|
427
427
|
this._isAnswering = !0;
|
|
428
|
-
const n = { type:
|
|
428
|
+
const n = { type: i.blockType, isPending: !0 };
|
|
429
429
|
if (a?.role === "assistant" && a.id === l) {
|
|
430
430
|
const c = [...a.blocks ?? [], n];
|
|
431
431
|
this.messages.splice(-1, 1, { ...a, blocks: c });
|
|
@@ -442,7 +442,7 @@ class et extends U {
|
|
|
442
442
|
case "block-data": {
|
|
443
443
|
if (a?.role !== "assistant" || a?.id !== l)
|
|
444
444
|
break;
|
|
445
|
-
const n = [...a.blocks ?? []], c = n[n.length - 1], { blockType: h, data: u } =
|
|
445
|
+
const n = [...a.blocks ?? []], c = n[n.length - 1], { blockType: h, data: u } = i;
|
|
446
446
|
if (c?.type !== h || !c.isPending)
|
|
447
447
|
break;
|
|
448
448
|
h === "text" ? n[n.length - 1] = {
|
|
@@ -458,40 +458,40 @@ class et extends U {
|
|
|
458
458
|
if (a?.role !== "assistant" || a?.id !== l)
|
|
459
459
|
break;
|
|
460
460
|
const n = [...a.blocks ?? []], c = n[n.length - 1];
|
|
461
|
-
if (c?.type !==
|
|
461
|
+
if (c?.type !== i.blockType || !c.isPending)
|
|
462
462
|
break;
|
|
463
463
|
const h = c;
|
|
464
464
|
n[n.length - 1] = { ...h, data: { ...h.data }, isPending: !1 }, this.messages.splice(-1, 1, { ...a, blocks: n });
|
|
465
465
|
break;
|
|
466
466
|
}
|
|
467
467
|
case "completed":
|
|
468
|
-
|
|
468
|
+
i.error ? (this.messages.push({
|
|
469
469
|
role: "assistant",
|
|
470
|
-
log:
|
|
471
|
-
error:
|
|
470
|
+
log: i.log,
|
|
471
|
+
error: i.error,
|
|
472
472
|
id: l,
|
|
473
473
|
interrupts: this._interruptDetails
|
|
474
474
|
}), this._interruptDetails = []) : a?.role === "assistant" && a.id === l && this.messages.splice(-1, 1, {
|
|
475
475
|
...a,
|
|
476
|
-
content:
|
|
476
|
+
content: i.response,
|
|
477
477
|
blocks: a.blocks?.map((n) => ({ ...n, data: { ...n.data }, isPending: !1 })) ?? [],
|
|
478
478
|
isStreaming: !1,
|
|
479
|
-
log:
|
|
479
|
+
log: i.log
|
|
480
480
|
}), this._isAnswering = !1, this.#e = null, this._canceling = !1;
|
|
481
481
|
break;
|
|
482
482
|
case "interrupt":
|
|
483
|
-
this._interrupt = { ...
|
|
483
|
+
this._interrupt = { ...i.payload, id: l }, this.arcgisInterrupt.emit(this._interrupt);
|
|
484
484
|
break;
|
|
485
485
|
case "cancelled":
|
|
486
486
|
a?.role === "assistant" && a.id === l ? this.messages.splice(-1, 1, {
|
|
487
487
|
...a,
|
|
488
488
|
blocks: a.blocks?.filter((n) => n.type === "text" || !n.isPending) ?? [],
|
|
489
489
|
isStreaming: !1,
|
|
490
|
-
log:
|
|
490
|
+
log: i.log,
|
|
491
491
|
error: `(${this._messages.stoppedByUserLabel})`
|
|
492
492
|
}) : (this.messages.push({
|
|
493
493
|
role: "assistant",
|
|
494
|
-
log:
|
|
494
|
+
log: i.log,
|
|
495
495
|
error: `(${this._messages.stoppedByUserLabel})`,
|
|
496
496
|
id: l,
|
|
497
497
|
interrupts: this._interruptDetails
|
|
@@ -509,38 +509,50 @@ class et extends U {
|
|
|
509
509
|
loaded() {
|
|
510
510
|
this.manager.onLifecycle(() => {
|
|
511
511
|
this.#t.value?.addEventListener("arcgisPromptSelect", this.#g), this.#t.value?.addEventListener("arcgisSubmit", this.#l), this.#t.value?.addEventListener("arcgisCancel", this.#c), this.#t.value?.addEventListener("arcgisFeedback", this.#h);
|
|
512
|
-
const t =
|
|
513
|
-
const
|
|
514
|
-
|
|
515
|
-
}), e = this.messages.on("after-add", (
|
|
516
|
-
const r =
|
|
512
|
+
const t = O(() => !!this._interrupt && !!this.#i.value, () => {
|
|
513
|
+
const s = this.#i.value;
|
|
514
|
+
s.removeEventListener("arcgisSubmit", this.#n), s.removeEventListener("arcgisCancel", this.#a), s.addEventListener("arcgisSubmit", this.#n, { once: !0 }), s.addEventListener("arcgisCancel", this.#a, { once: !0 });
|
|
515
|
+
}), e = this.messages.on("after-add", (s) => {
|
|
516
|
+
const r = s.item;
|
|
517
517
|
r.role === "assistant" && (r.error || r.content) && this.arcgisResponse.emit(r);
|
|
518
518
|
});
|
|
519
519
|
return queueMicrotask(() => {
|
|
520
520
|
this.#p();
|
|
521
521
|
}), () => {
|
|
522
|
-
t.remove(), e.remove(), this.#t.value?.removeEventListener("arcgisPromptSelect", this.#g), this.#
|
|
522
|
+
t.remove(), e.remove(), this.#t.value?.removeEventListener("arcgisPromptSelect", this.#g), this.#i.value?.removeEventListener("arcgisSubmit", this.#n), this.#i.value?.removeEventListener("arcgisCancel", this.#a), this.#t.value?.removeEventListener("arcgisSubmit", this.#l), this.#t.value?.removeEventListener("arcgisCancel", this.#c), this.#t.value?.removeEventListener("arcgisFeedback", this.#h), this._orchestratorController?.destroy(), this._orchestratorController = null;
|
|
523
523
|
};
|
|
524
524
|
});
|
|
525
525
|
}
|
|
526
526
|
willUpdate(t) {
|
|
527
527
|
this.hasUpdated && t.has("runtimeEventsEnabled") && this._orchestratorController && (this._orchestratorController.destroy(), this._orchestratorController = null, this.#p());
|
|
528
528
|
}
|
|
529
|
+
async #m() {
|
|
530
|
+
await S.checkSignInStatus(this.#s.url);
|
|
531
|
+
const t = await this.#s.load();
|
|
532
|
+
if (!t.helperServices?.aiAssistantServices?.url)
|
|
533
|
+
throw new Error(this._messages.serviceUrlNotAvailableMessage);
|
|
534
|
+
let s = !1;
|
|
535
|
+
const r = await t.fetchSettings();
|
|
536
|
+
if (r.aiConfig ? s = r.aiConfig.aiForOrg?.enabled === !0 && r.aiConfig.aiForOrg?.aiCapabilities?.aiAgents?.enabled === !0 : s = r.aiAssistantsEnabled === !0, !s)
|
|
537
|
+
throw new Error(this._messages.aiAssistantsNotEnabledMessage);
|
|
538
|
+
if (!t.isPortal && !(t?.user?.privileges?.includes("portal:user:useAIAssistants") === !0))
|
|
539
|
+
throw new Error(this._messages.userPrivilegesNotSufficientMessage);
|
|
540
|
+
}
|
|
529
541
|
async #d() {
|
|
530
542
|
try {
|
|
531
543
|
this._error = null;
|
|
532
|
-
const t =
|
|
544
|
+
const t = j(this.el, this.referenceElement);
|
|
533
545
|
await t?.componentOnReady();
|
|
534
546
|
const e = [...this.#r.values()];
|
|
535
|
-
return e.length ? (this._orchestratorController?.destroy(), this._orchestratorController = new p({
|
|
547
|
+
return e.length ? (await this.#m(), this._orchestratorController?.destroy(), this._orchestratorController = new p({
|
|
536
548
|
agents: e,
|
|
537
|
-
portal: this.#
|
|
549
|
+
portal: this.#s,
|
|
538
550
|
runtimeEventsEnabled: this.runtimeEventsEnabled,
|
|
539
551
|
streamingDisabled: this.streamingDisabled,
|
|
540
552
|
view: t?.view
|
|
541
553
|
}), await this._orchestratorController.load(), this.requestUpdate(), !0) : (this._error = this._messages.noAgentsFoundMessage, !1);
|
|
542
554
|
} catch (t) {
|
|
543
|
-
return this._error = t?.message ?? this._messages.orchestratorInitializationErrorMessage,
|
|
555
|
+
return this._error = t?.message ?? this._messages.orchestratorInitializationErrorMessage, N(this)(t), !1;
|
|
544
556
|
}
|
|
545
557
|
}
|
|
546
558
|
async #p() {
|
|
@@ -553,13 +565,13 @@ class et extends U {
|
|
|
553
565
|
return this._isSignedIn ? this._error ? this._renderErrorNotice() : this.entryMessage ? this.messages.length > 0 ? null : g`<calcite-notice open kind=brand closable icon width=full><div slot=message>${this.entryMessage}</div></calcite-notice>` : g`<slot name=entry-message></slot>` : this._renderSignInNotice();
|
|
554
566
|
}
|
|
555
567
|
_renderSignInNotice() {
|
|
556
|
-
const t = this.#
|
|
568
|
+
const t = this.#s;
|
|
557
569
|
return g`<calcite-notice slot=entry-message open kind=brand icon width=full><div slot=message>${this._messages.signInRequiredMessage}</div>${t ? g`<calcite-link slot=link @click=${async () => {
|
|
558
570
|
try {
|
|
559
|
-
const e = await
|
|
571
|
+
const e = await S.getCredential(`${t.url}/sharing`);
|
|
560
572
|
this._signedInUserId = e.userId, this._error = null, this.requestUpdate(), await this.#p();
|
|
561
573
|
} catch (e) {
|
|
562
|
-
this._error = e?.message ?? this._messages.signInErrorMessage, this.arcgisError.emit(new Error(this._error)),
|
|
574
|
+
this._error = e?.message ?? this._messages.signInErrorMessage, this.arcgisError.emit(new Error(this._error)), z.log("error", this, "Error signing in:", { detail: { error: e } });
|
|
563
575
|
}
|
|
564
576
|
}} target=_blank title=${this._messages.signInToArcGISOnlineLabel ?? _}>${this._messages.signInLabel}</calcite-link>` : g`<div slot=link>${this._messages.noPortalInformationMessage}</div>`}</calcite-notice>`;
|
|
565
577
|
}
|
|
@@ -567,12 +579,12 @@ class et extends U {
|
|
|
567
579
|
return this._error ? g`<calcite-notice slot=entry-message open kind=brand icon width=full>${this._error === X ? g`<div slot=message>${Y}</div><calcite-link slot=link .href=${tt} target=_blank title=${this._messages.learnAboutWebMapEmbeddingsLabel ?? _}>${this._messages.readMoreLabel}</calcite-link>` : g`<div slot=message>${this._error}</div>`}</calcite-notice>` : null;
|
|
568
580
|
}
|
|
569
581
|
render() {
|
|
570
|
-
return g`<calcite-panel .loading=${!this._orchestratorController && !this._error || this._orchestratorController?.loading} .heading=${this.heading ?? this._messages.assistantLabel} .description=${this.description} ${
|
|
582
|
+
return g`<calcite-panel .loading=${!this._orchestratorController && !this._error || this._orchestratorController?.loading} .heading=${this.heading ?? this._messages.assistantLabel} .description=${this.description} ${E(this.#t)}><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((t) => t.role === "assistant" ? g`<arcgis-assistant-message .message=${t} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled} @arcgisSlottableRequest=${this.#u} .assistantAvatarEnabled=${this.assistantAvatarEnabled}>${t.blocks?.map((e, s) => g`<slot name=${$(t.id, s) ?? _} slot=${$(t.id, s) ?? _}><arcgis-assistant-message-block .block=${e}></arcgis-assistant-message-block></slot>`)}</arcgis-assistant-message>` : g`<arcgis-assistant-user-message .message=${t} .user=${this._user} .userAvatarEnabled=${this.userAvatarEnabled}></arcgis-assistant-user-message>`)}</slot>${this._interrupt ? g`<div slot=message-loading><div class="interrupt-waiting-message">${this._messages.waitingForUserInputMessage}</div></div>` : g`<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 ? g`<slot name=interrupt><arcgis-assistant-interrupt slot=content-bottom .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${E(this.#i)}></arcgis-assistant-interrupt></slot>` : this.suggestedPrompts?.length ? g`<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 || !!this._error} ${E(this.#o)}><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=${() => {
|
|
571
583
|
this.#o.value?.submitMessage();
|
|
572
584
|
}} 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>`;
|
|
573
585
|
}
|
|
574
586
|
}
|
|
575
|
-
|
|
587
|
+
L("arcgis-assistant", et);
|
|
576
588
|
export {
|
|
577
589
|
et as ArcgisAssistant
|
|
578
590
|
};
|