@arcgis/ai-components 6.0.0-next.1 → 6.0.0-next.3
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.js +1 -1
- package/dist/agent-utils/SkillAgent.js +1 -1
- package/dist/agent-utils/WorkflowAgent.js +1 -1
- package/dist/agent-utils/createSchema.js +1 -1
- package/dist/agent-utils/middlewares/humanInTheLoop.js +23 -21
- package/dist/agent-utils/middlewares/middleware.js +1 -1
- package/dist/agent-utils/middlewares/trace.js +1 -1
- package/dist/agent-utils/middlewares/types.js +1 -1
- package/dist/agent-utils/tools/FunctionTool.js +1 -1
- package/dist/agent-utils/tools/MCPToolProvider.js +1 -1
- package/dist/agent-utils/tools/WebMCPToolProvider.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/agents/agents/arcgisKnowledge/graph/arcgisKnowledgeGraph.js +1 -1
- package/dist/agents/agents/dataExploration/dataExplorationAgent.js +1 -1
- package/dist/agents/agents/dataExplorationGraph/graph/dataExplorationGraph.js +1 -1
- package/dist/agents/agents/help/helpAgent.js +11 -11
- package/dist/agents/agents/helpGraph/graph/helpGraph.js +1 -1
- package/dist/agents/agents/layerStyling/context/layerStylingContext.js +1 -1
- package/dist/agents/agents/layerStyling/graph/layerStylingGraph.js +1 -1
- package/dist/agents/agents/navigation/navigationAgent.js +1 -1
- package/dist/agents/agents/navigationGraph/graph/navigationGraph.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 +35 -18
- 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/24KEZCPF.js +2 -0
- package/dist/cdn/{2UKFCF2J.js → 272R36XK.js} +2 -2
- package/dist/cdn/{FX4LV2S3.js → 2H32MDP2.js} +1 -1
- package/dist/cdn/{VAXH6RUQ.js → 2HNGMLFD.js} +2 -2
- package/dist/cdn/{24TK55FP.js → 2JD3G7IW.js} +2 -2
- package/dist/cdn/{P4CHI7W3.js → 2NOLMOEP.js} +2 -2
- package/dist/cdn/{ZU2FHVNK.js → 2OW3DCUT.js} +2 -2
- package/dist/cdn/2PGZDONH.js +2 -0
- package/dist/cdn/2WY5MPMY.js +2 -0
- package/dist/cdn/{2DWN3SKH.js → 3COVQI26.js} +2 -2
- package/dist/cdn/{VIJVRJHL.js → 3UVQLYUK.js} +2 -2
- package/dist/cdn/46NXKDIE.js +2 -0
- package/dist/cdn/{BIEX4MVV.js → 5HNKH5OK.js} +2 -2
- package/dist/cdn/{46DT6BIG.js → 5INBG23U.js} +1 -1
- package/dist/cdn/{YJXRCO4T.js → 5LBUP33F.js} +2 -2
- package/dist/cdn/{JEWJ4M25.js → 5OGABLOF.js} +5 -5
- package/dist/cdn/{UZLQALHY.js → 5PV2GUZW.js} +1 -1
- package/dist/cdn/{EEHDAYOG.js → 5XZ5VL42.js} +2 -2
- package/dist/cdn/{DI3VGUJY.js → 63OF33IL.js} +2 -2
- package/dist/cdn/{NHWT7CXX.js → 6ELWX4W5.js} +2 -2
- package/dist/cdn/{OKVLGJAG.js → 6J3J7VLW.js} +2 -2
- package/dist/cdn/{AOVJ34QE.js → 6QOSUG64.js} +2 -2
- package/dist/cdn/{GVFJHADC.js → 6UGT2UG5.js} +2 -2
- package/dist/cdn/{QEGO4B2W.js → 7GDMXAF5.js} +2 -2
- package/dist/cdn/7JIXXYZR.js +2 -0
- package/dist/cdn/{X5ET73QZ.js → 7OQK2F7O.js} +2 -2
- package/dist/cdn/{FSLPYC4Y.js → A4ZVCRVF.js} +2 -2
- package/dist/cdn/{OVIQ5NSE.js → AGDGDULE.js} +2 -2
- package/dist/cdn/{TPULIO6I.js → AMA67DVI.js} +2 -2
- package/dist/cdn/AO42IPOX.js +2 -0
- package/dist/cdn/{UOKYHQNO.js → AOT3PM2Q.js} +2 -2
- package/dist/cdn/{EG5BMYZO.js → AQ7KG25Q.js} +2 -2
- package/dist/cdn/AY2ZONWQ.js +2 -0
- package/dist/cdn/{JZPPP4QY.js → BMVPOFHU.js} +2 -2
- package/dist/cdn/BWUQRZPK.js +2 -0
- package/dist/cdn/{XWNZMKQF.js → C3VLDYS2.js} +2 -2
- package/dist/cdn/{PQ2DPOFM.js → C5Q6E7UC.js} +2 -2
- package/dist/cdn/{FDOMMK2M.js → CETIZ4IQ.js} +1 -1
- package/dist/cdn/CKDKQVS3.js +2 -0
- package/dist/cdn/{TENUVOFJ.js → COANVCKH.js} +2 -2
- package/dist/cdn/CV5YAJMD.js +2 -0
- package/dist/cdn/{BBB5EJUB.js → CWZG7DML.js} +3 -3
- package/dist/cdn/{2O52MJ3D.js → D7CRICBG.js} +2 -2
- package/dist/cdn/D7FEOAW3.js +2 -0
- package/dist/cdn/{PGUEODFA.js → DY6MO2CA.js} +2 -2
- package/dist/cdn/EKMCGN6R.js +2 -0
- package/dist/cdn/EUIURCPS.js +2 -0
- package/dist/cdn/{RFDMNYTA.js → EWZNZZ5S.js} +2 -2
- package/dist/cdn/{DGCWQYN3.js → FGQH46Z2.js} +2 -2
- package/dist/cdn/FIZMK7GS.js +1 -0
- package/dist/cdn/FONIQ7VF.js +2 -0
- package/dist/cdn/G4L7RUTK.js +49 -0
- package/dist/cdn/{FYZATVB3.js → G7MCIFV2.js} +2 -2
- package/dist/cdn/{SDWWUWAF.js → GGAXXX5X.js} +2 -2
- package/dist/cdn/GS5JDPZH.js +2 -0
- package/dist/cdn/{T3SCINN5.js → H4QWVTEZ.js} +2 -2
- package/dist/cdn/H653UVNH.js +2 -0
- package/dist/cdn/{ZSLHB6MF.js → H6J65TWL.js} +2 -2
- package/dist/cdn/{UHEYPSOR.js → HCPI2RJE.js} +2 -2
- package/dist/cdn/{PCAMBPOA.js → HJOWCZPL.js} +2 -2
- package/dist/cdn/{5REENYPV.js → HTNKDDEV.js} +2 -2
- package/dist/cdn/{6WYVG3JI.js → HU527DML.js} +2 -2
- package/dist/cdn/{DJG6DBCU.js → I2RQZAFF.js} +3 -3
- package/dist/cdn/I37ZJHTM.js +2 -0
- package/dist/cdn/{GHFOAS7T.js → I724KIFI.js} +2 -2
- package/dist/cdn/IH5P2PWJ.js +2 -0
- package/dist/cdn/{C67KQCPS.js → J3T5HB77.js} +2 -2
- package/dist/cdn/{EXLDRGUC.js → JCWFLYB4.js} +2 -2
- package/dist/cdn/{IHP25JWI.js → JSRNLNOE.js} +2 -2
- package/dist/cdn/JZT4ECVH.js +2 -0
- package/dist/cdn/{MPWEXYYB.js → KDA5VPLO.js} +2 -2
- package/dist/cdn/KRPPMEOF.js +2 -0
- package/dist/cdn/{GBFRJF4F.js → KURNYULZ.js} +2 -2
- package/dist/cdn/{ZKWXHSEQ.js → L46O52F7.js} +2 -2
- package/dist/cdn/{FJV7CI7O.js → LDDP7NSY.js} +2 -2
- package/dist/cdn/{ZQTCPJUV.js → LGIXZLOP.js} +2 -2
- package/dist/cdn/{OGZFST2A.js → LMAIOLS2.js} +2 -2
- package/dist/cdn/{CFAC4FN3.js → LWEKPFV6.js} +2 -2
- package/dist/cdn/{L5IPMRHC.js → M52LKZN7.js} +2 -2
- package/dist/cdn/{AQF6BBWC.js → M5UMOOL2.js} +2 -2
- package/dist/cdn/MNMCIS4E.js +15 -0
- package/dist/cdn/{7X22QXJP.js → MR3R5YHQ.js} +2 -2
- package/dist/cdn/{MD2FTKQT.js → MSHEHZYP.js} +3 -3
- package/dist/cdn/{M6JQGHCE.js → MUSLUFKI.js} +2 -2
- package/dist/cdn/MYLY2ABI.js +2 -0
- package/dist/cdn/{AMP43OT2.js → N2GN5WOI.js} +2 -2
- package/dist/cdn/{RE7MJTEF.js → NAVK5JJ2.js} +3 -3
- package/dist/cdn/NDSYDURO.js +2 -0
- package/dist/cdn/{7ZTYHZIN.js → NK2QRPS6.js} +2 -2
- package/dist/cdn/{GMZUN5SF.js → NYFL2F5L.js} +2 -2
- package/dist/cdn/{PGH7POKS.js → OKDXM5D4.js} +2 -2
- package/dist/cdn/{JFL5IWPK.js → OMUWBY75.js} +2 -2
- package/dist/cdn/{34O57OGV.js → OPQCY33W.js} +1 -1
- package/dist/cdn/{R74ZHFA6.js → OUMTV5H5.js} +1 -1
- package/dist/cdn/OVH4S4ZB.js +3 -0
- package/dist/cdn/{5FDBJI24.js → OZDRETY2.js} +2 -2
- package/dist/cdn/{DYSPEU7W.js → PR4VMSKD.js} +1 -1
- package/dist/cdn/{HSMAXOOA.js → PXBS2FXE.js} +2 -2
- package/dist/cdn/{XEJFVUNQ.js → QAVDW7A7.js} +1 -1
- package/dist/cdn/{ONQ6JSBJ.js → QBZP6XOE.js} +1 -1
- package/dist/cdn/RNJ7T5GF.js +2 -0
- package/dist/cdn/{YBWRFVA6.js → RQYDIQVD.js} +3 -3
- package/dist/cdn/{BMPBJXD7.js → S6OUM5X2.js} +2 -2
- package/dist/cdn/{A22375P3.js → SUMXIUIS.js} +2 -2
- package/dist/cdn/SW3D6QD4.js +2 -0
- package/dist/cdn/{GEFFWUB2.js → T2OYUOSO.js} +1 -1
- package/dist/cdn/T7LYQ56H.js +2 -0
- package/dist/cdn/{DZOQFEOB.js → TFXK2POV.js} +2 -2
- package/dist/cdn/{XQ3NBBQ3.js → TIQUULA4.js} +1 -1
- package/dist/cdn/{LCI5MEDN.js → TOUYGIGK.js} +2 -2
- package/dist/cdn/TZQ6XEKW.js +2 -0
- package/dist/cdn/{5LA77ZBW.js → UMTRLI63.js} +2 -2
- package/dist/cdn/{NPV4MEAZ.js → UP7RW5K2.js} +2 -2
- package/dist/cdn/{XCLICBG7.js → UR2S7L6Z.js} +2 -2
- package/dist/cdn/{CEKOEHB3.js → UWHRBGWN.js} +2 -2
- package/dist/cdn/{UQRBY7ID.js → UXDRYDOD.js} +2 -2
- package/dist/cdn/{JUPTVXLY.js → UZ7XFHYI.js} +2 -2
- package/dist/cdn/{AAUVOBPS.js → VINKTQFR.js} +1 -1
- package/dist/cdn/{SWXUQFB6.js → VU7IOGNS.js} +2 -2
- package/dist/cdn/{HC5DJL2U.js → W2SIOY2B.js} +2 -2
- package/dist/cdn/{FBARYPZ7.js → W36IUEUB.js} +2 -2
- package/dist/cdn/{5TW2NFES.js → WEBAQIUT.js} +2 -2
- package/dist/cdn/{WSIZ2OTL.js → WHIWOYHN.js} +1 -1
- package/dist/cdn/WOL5YMJ2.js +2 -0
- package/dist/cdn/{66VWTARH.js → X3YFCWQZ.js} +2 -2
- package/dist/cdn/{ICBIUFK7.js → X4EQEKM7.js} +2 -2
- package/dist/cdn/{TJBU5BQK.js → XBWGOD6I.js} +2 -2
- package/dist/cdn/{6E6T6U7W.js → XGDXTTYW.js} +2 -2
- package/dist/cdn/{CDS2HGQY.js → XLHYQNAM.js} +2 -2
- package/dist/cdn/{NEV6OZN3.js → XMQJWPXI.js} +2 -2
- package/dist/cdn/{QT3B5K4R.js → XQUKC4YK.js} +2 -2
- package/dist/cdn/{JEBRN3EU.js → XSH4B7FP.js} +2 -2
- package/dist/cdn/{LK7ZIQW6.js → XVWSIDZV.js} +2 -2
- package/dist/cdn/{J6A4AS7E.js → XYMIFFBW.js} +2 -2
- package/dist/cdn/{MPQ2OZXN.js → Y3ZKMD47.js} +2 -2
- package/dist/cdn/{YPLPDUMB.js → YAANCUW2.js} +2 -2
- package/dist/cdn/{KY7M4WHO.js → YD5LVM7V.js} +2 -2
- package/dist/cdn/{AMURN3LO.js → YGI277SH.js} +2 -2
- package/dist/cdn/{YI6NIHNI.js → YGSDJ4V3.js} +2 -2
- package/dist/cdn/YIF2OD6F.js +2 -0
- package/dist/cdn/YJEARDAZ.js +2 -0
- package/dist/cdn/{XC3T3Z5R.js → YSEHJQ4L.js} +2 -2
- package/dist/cdn/Z44NI2YQ.js +2 -0
- package/dist/cdn/{UYP5PH5E.js → ZUKM4DGB.js} +2 -2
- package/dist/cdn/ZVVNATCX.js +2 -0
- package/dist/cdn/agent-utils/BaseAgent.js +2 -2
- package/dist/cdn/agent-utils/FunctionAgent.js +2 -2
- package/dist/cdn/agent-utils/LLMAgent.js +2 -2
- package/dist/cdn/agent-utils/SkillAgent.js +2 -2
- package/dist/cdn/agent-utils/WorkflowAgent.js +2 -2
- package/dist/cdn/agent-utils/createSchema.js +2 -2
- package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +2 -2
- package/dist/cdn/agent-utils/middlewares/middleware.js +2 -2
- package/dist/cdn/agent-utils/middlewares/trace.js +2 -2
- package/dist/cdn/agent-utils/tools/FunctionTool.js +2 -2
- package/dist/cdn/agent-utils/tools/MCPToolProvider.js +2 -2
- package/dist/cdn/agent-utils/tools/WebMCPToolProvider.js +2 -2
- package/dist/cdn/agent-utils/workflows/ConditionalWorkflow.js +2 -2
- package/dist/cdn/agent-utils/workflows/LoopWorkflow.js +2 -2
- package/dist/cdn/agent-utils/workflows/ParallelWorkflow.js +2 -2
- package/dist/cdn/agent-utils/workflows/RouterWorkflow.js +2 -2
- package/dist/cdn/agent-utils/workflows/SequentialWorkflow.js +2 -2
- package/dist/cdn/agent-utils/workflows/SwitchWorkflow.js +2 -2
- package/dist/cdn/index.js +2 -2
- package/dist/cdn/orchestrator/embeddings/getEmbeddings.js +2 -2
- package/dist/cdn/orchestrator/models/chatModel.js +2 -2
- package/dist/cdn/orchestrator/models/prompts.js +2 -2
- package/dist/cdn/orchestrator/signals.js +2 -2
- package/dist/cdn/orchestrator/state/runtime.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 +7 -11
- package/dist/chunks/SKILL4.js +1 -1
- package/dist/chunks/adapter.js +1 -1
- package/dist/chunks/adapter2.js +1 -1
- package/dist/chunks/aiFactory.js +1 -1
- package/dist/chunks/aiUtilityService.js +1 -1
- 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/converterUtils.js +1 -1
- package/dist/chunks/createSkillAgent.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/fetchUtils.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/getPrompt.js +1 -1
- package/dist/chunks/graph.js +1 -1
- package/dist/chunks/helpState.js +1 -1
- package/dist/chunks/help_prompt.js +1 -1
- package/dist/chunks/intent_prompt.js +19 -108
- package/dist/chunks/layerQueryToolCalling.js +1 -1
- package/dist/chunks/layerStylingState.js +1 -1
- package/dist/chunks/layer_descriptions_prompt.js +1 -1
- package/dist/chunks/layer_styling_prompt.js +1 -1
- package/dist/chunks/localization.js +1 -1
- package/dist/chunks/mergeWhereClauses.js +1 -1
- package/dist/chunks/modelConfig.js +1 -1
- package/dist/chunks/modelPricing.js +1 -1
- package/dist/chunks/navigationState.js +1 -1
- package/dist/chunks/navigation_intent_prompt.js +1 -1
- package/dist/chunks/navigation_tool_prompt.js +1 -1
- package/dist/chunks/observationSnapshot.js +1 -1
- package/dist/chunks/reducers.js +1 -1
- package/dist/chunks/requireAgentServices.js +1 -1
- package/dist/chunks/resolveFieldNames.js +1 -1
- package/dist/chunks/resolveGeometryFilter.js +1 -1
- package/dist/chunks/runtime.js +2 -2
- package/dist/chunks/runtime2.js +1 -1
- package/dist/chunks/runtimeSpans.js +1 -1
- package/dist/chunks/schema.js +1 -1
- package/dist/chunks/slottableRequestUtils.js +1 -1
- package/dist/chunks/state.js +1 -1
- package/dist/chunks/summarize_query_response_prompt.js +1 -1
- package/dist/chunks/textFormatters.js +1 -1
- package/dist/chunks/toolCallResponse.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/chunks/webmapSchema.js +1 -1
- package/dist/components/arcgis-assistant/customElement.js +101 -101
- package/dist/components/arcgis-assistant/types.d.ts +2 -0
- package/dist/components/arcgis-assistant-agent/customElement.js +1 -1
- 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.d.ts +6 -0
- package/dist/components/arcgis-assistant-interrupt/customElement.js +25 -24
- 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-observation-inspector/customElement.js +1 -1
- package/dist/components/arcgis-assistant-observation-latency/customElement.js +1 -1
- package/dist/components/arcgis-assistant-observation-panel/customElement.js +1 -1
- package/dist/components/arcgis-assistant-observation-run/customElement.js +1 -1
- package/dist/components/arcgis-assistant-observation-usage/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/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/index.js +1 -1
- package/dist/loader.js +2 -2
- package/dist/orchestrator/embeddings/cosineSimilarity.js +1 -1
- package/dist/orchestrator/embeddings/getEmbeddings.js +1 -1
- package/dist/orchestrator/embeddings/webmapEmbeddings.js +1 -1
- package/dist/orchestrator/models/chatModel.js +1 -1
- package/dist/orchestrator/models/prompts.js +1 -1
- package/dist/orchestrator/orchestrator/orchestrator.js +1 -1
- package/dist/orchestrator/orchestrator/orchestratorEvents.js +1 -1
- package/dist/orchestrator/signals.js +1 -1
- package/dist/orchestrator/state/runtime.js +1 -1
- package/dist/orchestrator/state/types.js +1 -1
- package/dist/orchestrator/types.d.ts +6 -0
- package/dist/orchestrator/types.js +1 -1
- package/dist/types/lumina.d.ts +1 -1
- package/dist/types/preact.d.ts +1 -1
- package/dist/types/react.d.ts +1 -1
- package/dist/types/stencil.d.ts +1 -1
- package/dist/utils/index.js +1 -1
- package/package.json +5 -5
- package/dist/cdn/2UDDCWNW.js +0 -2
- package/dist/cdn/434TAA3J.js +0 -2
- package/dist/cdn/4KFTUBFL.js +0 -2
- package/dist/cdn/6PK2UPG3.js +0 -2
- package/dist/cdn/74CVYM72.js +0 -19
- package/dist/cdn/7HVIVV3O.js +0 -2
- package/dist/cdn/7MCFHVEH.js +0 -3
- package/dist/cdn/AO2G4EXA.js +0 -2
- package/dist/cdn/AWPLRVPS.js +0 -2
- package/dist/cdn/C76HLPKU.js +0 -2
- package/dist/cdn/CADNOKIK.js +0 -2
- package/dist/cdn/CHHC6YNW.js +0 -2
- package/dist/cdn/DBRBT54R.js +0 -2
- package/dist/cdn/DJKEGIQZ.js +0 -2
- package/dist/cdn/EGSD465U.js +0 -2
- package/dist/cdn/HLWG7OIR.js +0 -2
- package/dist/cdn/HWIM4KWF.js +0 -2
- package/dist/cdn/KKWCHNYQ.js +0 -2
- package/dist/cdn/KX6CZEVZ.js +0 -2
- package/dist/cdn/M2G44RTS.js +0 -2
- package/dist/cdn/MB7SEHPZ.js +0 -2
- package/dist/cdn/MC2V5WT3.js +0 -2
- package/dist/cdn/MZFWD5CQ.js +0 -2
- package/dist/cdn/NMFEXE4D.js +0 -2
- package/dist/cdn/OT5ECP4V.js +0 -138
- package/dist/cdn/OYHYHALE.js +0 -2
- package/dist/cdn/QUZTFUWM.js +0 -1
- package/dist/cdn/RF6HWZMB.js +0 -2
- package/dist/cdn/RFPTOFM4.js +0 -2
- package/dist/cdn/RKURZ5T2.js +0 -2
- package/dist/cdn/SJ4UMNIS.js +0 -2
- package/dist/cdn/USPB2QBX.js +0 -2
- package/dist/cdn/V6EX4YCY.js +0 -2
- package/dist/cdn/VA4M72JC.js +0 -2
- package/dist/cdn/VQ67NANV.js +0 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
2
|
-
import{a as
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
+
import{a as U}from"./5INBG23U.js";import{a as j}from"./7JIXXYZR.js";import{b as Z}from"./ZUKM4DGB.js";import{b as pe}from"./AGDGDULE.js";import"./FIZMK7GS.js";import a from"./TOUYGIGK.js";import{a as I,b as R}from"./W36IUEUB.js";import"./SUMXIUIS.js";import"./PR4VMSKD.js";import{a as he}from"./TFXK2POV.js";import{a as F}from"./2JD3G7IW.js";import"./LDDP7NSY.js";import{b as K}from"./WHIWOYHN.js";import{A as C,C as J,g as B,h as y,l as V,m as G,o as w,v as P,w as M,x as Q}from"./NAVK5JJ2.js";import{b as q}from"./OUMTV5H5.js";import"./GS5JDPZH.js";import{a as b}from"./2WY5MPMY.js";import{c as de,d as ue,e as ge}from"./S6OUM5X2.js";import{a as A,b as oe,c as le,d as ce}from"./XLHYQNAM.js";import{Ea as ae,M as ie,S as x,a as Y,b as ee,y as te}from"./7GDMXAF5.js";import{c as ne}from"./5XZ5VL42.js";import"./C3VLDYS2.js";import"./A4ZVCRVF.js";import{N as p}from"./N2GN5WOI.js";import{La as re,fa as O,ra as se}from"./272R36XK.js";import"./5PV2GUZW.js";export default $arcgis.t(([vt,{whenOnce:Et,watch:_t,when:kt},xt,Me,Te,Ee,De,Le,It,{property:k,subclass:Rt},ke,{b:X}])=>{var Re=(t,e,s)=>{let r=t[e];return r?typeof r=="function"?r():Promise.resolve(r):new Promise((n,i)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(i.bind(null,new Error("Unknown variable dynamic import: "+e+(e.split("/").length!==s?". Note that variables only represent file names one level deep.":""))))})},me=async t=>(await Re(Object.assign({"./field_descriptions_prompt.md":()=>import("./2OW3DCUT.js"),"./intent_prompt.md":()=>import("./G4L7RUTK.js"),"./layer_descriptions_prompt.md":()=>import("./XVWSIDZV.js")}),`./${t}.md`,2)).default,Se="0.1",$=1536,Ce="openai",Ae=K.default,$e=`Name: {name}
|
|
3
3
|
Title: {title}
|
|
4
4
|
Description: {description}`,Pe=`Name: {name}
|
|
5
5
|
Alias: {alias}
|
|
6
|
-
Description: {description}`,ye=p.object({schemaVersion:p.literal(Se),modified:p.number().int().nonnegative(),embeddings:p.object({modelProvider:p.literal(Ce),model:p.literal(Ae),dimensions:p.literal($),templates:p.object({layer:p.string().default($e),field:p.string().default(Pe)})}),layers:p.array(p.object({id:p.string().min(1),name:p.string().min(1),title:p.string().catch(""),description:p.string().catch(""),vector:p.array(p.number()).length($,{message:`Layer vector must be exactly ${$} dimensions`}),fields:p.array(p.object({name:p.string().min(1),alias:p.string().catch(""),description:p.string().catch(""),vector:p.array(p.number()).length($,{message:`Field vector must be exactly ${$} dimensions`})}))})).default([])});var qe=async t=>{let e=await
|
|
7
|
-
[truncated]`:d;o.push(new F(l))}return{...t,stepCount:t.stepCount+1,lastExecutedAgent:i.agent.id,requiresFollowUp:a.status==="failed"?!0:t.requiresFollowUp,finalOutputMessage:d??"",agentExecutionContext:{...t.agentExecutionContext,messages:o,priorSteps:[...t.agentExecutionContext.priorSteps??[],{agentId:i.agent.id,assignedTask:t.agentExecutionContext.assignedTask,summary:a?.summary||r.noSummaryProvided,status:a?.status||"unknown"}],sharedState:ze({previousSharedState:t.agentExecutionContext.sharedState,patch:a.sharedStatePatch,agentId:i.agent.id}),sharedResources:Je({previousSharedResources:t.agentExecutionContext.sharedResources,additions:a.sharedResourceAdditions,agentId:i.agent.id})}}},Ye=async t=>{let{agent:e,messages:s,config:r}=t;return{structuredResponse:(await e.invoke({messages:s},r)).structuredResponse}},et=p.object({id:p.string().min(1),name:p.string().min(1),description:p.string().min(1)});p.array(et);var ve=t=>JSON.stringify(t,null,2),tt=t=>{let e=t.map(r=>r.id),s=p.enum(e);return p.object({intent:s.nullable(),assignedTask:p.string().nullable(),requiresFollowUp:p.boolean()})},st=async(t,e)=>{let s=N(e),r=await R({path:"./assets/orchestrator/t9n",locale:I(e)});if(e?.signal?.aborted)return await b({text:r.runCancelled},e),{...t,currentIntent:"none",finalOutputMessage:r.runCancelled,requiresFollowUp:!1};try{await b({text:r.routingToAgent},e);let n=s.services.agentRegistry?.list()??[],i=n.map(({agent:E})=>({id:E.id,name:E.name,description:E.description}));if(!i.length)return await b({text:r.noAgentsRegisteredTrace},e),{...t,currentIntent:"none",finalOutputMessage:r.noAgentsRegisteredMessage};let c=await me("intent_prompt"),a=ve(i),d=tt(i),o={registeredAgents:a,priorSteps:ve(t.agentExecutionContext.priorSteps),userRequest:t.agentExecutionContext.userRequest},l=await ne.fromTemplate(c).format(o),u=de({model:await U({modelTier:"fast",config:e}),tools:[],systemPrompt:l,responseFormat:d,middleware:[ue({model:await U({modelTier:"fast",config:e}),trigger:{tokens:4e3},keep:{messages:6}}),ge({runLimit:2})]}),{structuredResponse:g}=await Ye({agent:u,messages:t.agentExecutionContext.messages,config:e}),h=d.parse(g??{intent:null,assignedTask:null,requiresFollowUp:!1}),m=h.intent??"none",f={...t,currentIntent:m,requiresFollowUp:h.requiresFollowUp,agentExecutionContext:{...t.agentExecutionContext,assignedTask:h.assignedTask??""}};if(m==="none"){let E=r.noMatchingAgentMessage.replace("{agentNames}",n.map(({agent:S})=>S.name).join(", "));return await b({text:r.noMatchingAgentTrace},e),{...t,currentIntent:m,requiresFollowUp:!1,finalOutputMessage:E,agentExecutionContext:{...t.agentExecutionContext,assignedTask:"",messages:[...t.agentExecutionContext.messages,new F(E)],priorSteps:[...t.agentExecutionContext.priorSteps??[],{agentId:"no-intent-router",assignedTask:t.agentExecutionContext.userRequest,summary:"No matching agent found; asked user to rephrase.",status:"failed"}]}}}return await b({text:r.agentPicked.replace("{intent}",m).replace("{assignedTask}",h.assignedTask??"").replace("{requiresFollowUp}",String(h.requiresFollowUp))},e),f}catch(n){throw await b({text:r.intentDetectionErrorTrace},e),new Error(r.intentDetectionError.replace("{error}",n instanceof Error?n.message:String(n)))}},rt=async(t,e)=>{let s=await R({path:"./assets/orchestrator/t9n",locale:I(e)});if(t.routing.mode!=="direct")throw new Error(s.directAgentAssignmentRequiresDirectRouting);return await b({text:s.directRouteToAgent.replace("{agentId}",t.routing.agentId)},e),{...t,currentIntent:t.routing.agentId,requiresFollowUp:!1,agentExecutionContext:{...t.agentExecutionContext,assignedTask:t.agentExecutionContext.userRequest}}},nt=3,it=t=>t.routing.mode==="direct"?"assignDirectAgent":"intentLLM",at=t=>t.routing.mode==="direct"||t.stepCount>=nt||!t.requiresFollowUp?"exit":"intentLLM",ot=()=>new ae(Ue).addNode("ingestInput",We).addNode("assignDirectAgent",rt).addNode("intentLLM",st).addNode("executeRegisteredAgent",Xe).addNode("exit",Ne).addEdge(Y,"ingestInput").addConditionalEdges("ingestInput",it).addEdge("assignDirectAgent","executeRegisteredAgent").addConditionalEdges("intentLLM",t=>t.currentIntent==="none"||t.currentIntent===t.lastExecutedAgent?"exit":"executeRegisteredAgent").addConditionalEdges("executeRegisteredAgent",at).addEdge("exit",ee),lt=(t,e)=>{let s=t.output?.usage_metadata??e.usage_metadata,r=t.output?.llmOutput?.tokenUsage,n=s?.input_tokens??r?.promptTokens,i=s?.output_tokens??r?.completionTokens,c=s?.total_tokens??r?.totalTokens;if(n===void 0||i===void 0||c===void 0)return;let a=s?.input_token_details?.cache_read,d=s?.input_token_details?.cache_creation,o=s?.output_token_details?.reasoning;return{input:n,output:i,total:c,...a!==void 0&&{cacheRead:a},...d!==void 0&&{cacheWrite:d},...o!==void 0&&{reasoning:o}}},ct=(t,e,s,r)=>{switch(t){case"chat_model":case"llm":return"model";case"tool":case"retriever":return t;case"chain":return!r||e==="LangGraph"?"workflow":s===e?"node":"chain";default:return}},dt=t=>{if(t instanceof Error)return{message:t.message,name:t.name};let e=t,s=typeof e?.message=="string"?e.message:String(t??"Unknown runtime error"),r=typeof e?.name=="string"?e.name:void 0;return{message:s,...r&&{name:r}}},ut=({event:t,runId:e,parentSpanId:s,timestamp:r})=>{let n=/^on_(.+)_(start|end|error)$/u.exec(t.event);if(!n)return;let[,i,c]=n,a=t.metadata??{},d=a.langgraph_node,o=ct(i,t.name,d,s);if(!o)return;let l=a.agentId,u=a.model??a.ls_model_name,g=t.data,h=c==="end"&&o==="model"?lt(g,a):void 0,m=t.tags?.includes("langsmith:hidden")||d==="__start__",f={...u&&{model:u},...h&&{tokenUsage:h},...m&&{internal:!0}},E={id:t.run_id,...s&&{parentId:s},label:t.name,type:o,...Object.keys(f).length&&{metadata:f}},S={runId:e,timestamp:r,type:"runtime",...l&&{agentId:l}};switch(c){case"start":return{...S,phase:"started",span:{...E,...g?.input!==void 0&&{input:g.input}}};case"end":return{...S,phase:"completed",span:{...E,...g?.output!==void 0&&{output:g.output}}};case"error":return{...S,phase:"failed",span:{...E,error:dt(g?.error)}};default:return}},T=class{constructor(){this.agentRegistry=new Map}register(e){let{agent:s}=e;if(this.agentRegistry.has(s.id))throw new Error(`Duplicate agent id: ${s.id}`);this.agentRegistry.set(s.id,e)}get(e){return this.agentRegistry.get(e)}list(){return[...this.agentRegistry.values()]}},W=class{constructor(e,s){this.graph=e,this.config={...s}}async waitForUser(){return await new Promise((e,s)=>{this.resolveWait=e,this.rejectWait=s})}handle(e,s){try{let r={agentId:e.agentId,id:e.id,payload:s},n=this.graph.streamEvents(null,{...this.config,configurable:{...this.config.configurable,hitlResponse:r},subgraphs:!0,version:"v2"});this.resolveWait?.(n)}catch(r){this.rejectWait?.(r)}finally{this.resolveWait=void 0,this.rejectWait=void 0}}cancel(){this.rejectWait&&(this.rejectWait(new Error("Request cancelled by user.")),this.resolveWait=void 0,this.rejectWait=void 0)}},_e=async(t,e)=>{let s=e.get(t);if(s)return s;let r=await he([t]);return e.set(t,r[0]),r[0]};async function gt(t,e,s,r){let n=`req-${Date.now()}`,i={type:"layerSearch",precomputedEmbedding:r?await _e(t,r):void 0,requestId:n,minScore:s};return await new Promise(c=>{let a=d=>{d.data.requestId===n&&c(d.data.results)};e.addEventListener("message",a,{once:!0}),e.postMessage(i)})}function ht(t){let{worker:e}=t;return{async searchLayers({text:s,minScore:r,embeddingCache:n}){return await gt(s,e,r,n)}}}var pt=async({combinedQuery:t,layerIds:e,embeddingsWorker:s,minScore:r,topResults:n,embeddingCache:i})=>{let c=`req-${Date.now()}`,a=i?await _e(t,i):void 0,d={type:"fieldSearch",layerIdForFieldsSearch:e,precomputedEmbedding:a,requestId:c,minScore:r,topResults:n};return await new Promise(o=>{let l=u=>{if(u.data.requestId!==c)return;let g=u.data.results.map(({layerId:h,results:m})=>({layerId:h,results:m}));o(g)};s.addEventListener("message",l,{once:!0}),s.postMessage(d)})};function mt(t){let{worker:e}=t;return{async searchFields({text:s,layerIds:r,minScore:n,topResults:i,embeddingCache:c}){return await pt({combinedQuery:s,layerIds:r,embeddingsWorker:e,minScore:n,topResults:i,embeddingCache:c})}}}var yt=t=>{let e=ye.safeParse(t);if(!e.success)throw new Error("Embeddings response validation failed. Regenerate embeddings.");return e.data},ft=(t,e)=>{let s=new Map,r=new Map;if(e.allLayers.forEach(n=>{n instanceof De&&r.set(n.id,n)}),t.length!==r.size)throw new Error("Layer count mismatch during registry restoration. Regenerate embeddings.");for(let n of t){let i=r.get(n.id);if(!i)throw new Error(`Layer with ID ${n.id} not found in the original map during registry restoration. Regenerate embeddings.`);if(n.fields.length!==i.fields.length)throw new Error(`Field count mismatch for layer ID ${n.id} during registry restoration. Regenerate embeddings.`);let c={name:n.name,title:n.title,description:n.description},a=new Map;for(let d of n.fields){let o=i.fieldsIndex.get(d.name);if(!o)throw new Error(`Field with name ${d.name} not found in the original layer ${n.id} during registry restoration. Regenerate embeddings.`);a.set(d.name,{name:d.name,alias:i.getFieldAlias(d.name)??d.alias,description:d.description,type:o.type||"unknown",valueType:o.valueType||"unknown",domain:i.getFieldDomain(d.name)??void 0})}s.set(n.id,{layerItem:c,fieldRegistry:a})}return s},bt=async t=>{try{return(await Le(t,{responseType:"json"})).data}catch(e){throw new Error(`Failed to fetch data from ${t}: ${String(e)}`)}},wt=async t=>{let e=t.map;if(!e?.portalItem)throw new Error("WebMap portal item is missing.");let{resources:s}=await e.portalItem.fetchResources(),r=s.find(i=>i.resource.path==="embeddings-v01.json");if(!r?.resource.url)throw new Error("Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.");let n=await bt(r.resource.url);return yt(n)},D=class t{constructor(){this.orchestratorReady=!1,this.chatHistory=[],this.priorSteps=[],this.sharedState={},this.sharedResources=[],this.agentRegistry=new T,this.activeRunId="",this.cancelledRunIds=new Set,this.parentRunIds=new Map,this.activeRuntimeSpans=new Map,this.runtimeEventsEnabled=!1,this.streamEpoch=0}static async init(e){let s=new t;s.runtimeEventsEnabled=e.runtimeEventsEnabled??!1;try{if(e.view?.map){await Ee.whenOnce(()=>e.view.ready);let r=await wt(e.view),n=ft(r.layers,e.view.map);s.layersAndFieldsRegistry=n,s.embeddingsWorker=await qe(r)}return e.agents?.forEach(r=>{s.agentRegistry.register(r)}),s.orchestratorReady=!0,s}catch(r){throw console.error("Orchestrator initialization failed:",r),r}}async*ask(e,s={}){if(!this.orchestratorReady)throw new Error("Orchestrator is not ready yet.");if(!this.agentRegistry.list().length)throw new Error("Orchestrator has no registered agents.");let r=this.createRequestAgentRegistry(s);if(!r.list().length)throw new Error("Orchestrator has no agents selected for this request.");if(++this.streamEpoch,!e.trim()&&!s.inputParts?.length)return;if(!e.trim()&&s.routing!=="direct")throw new Error("Requests containing only structured input require direct agent routing.");let n=q();this.parentRunIds.clear(),this.activeRuntimeSpans.clear(),this.activeRunId=n,this.activeAbortController=new AbortController,this.graph||(this.graph=ot().compile({checkpointer:new ie}));let i=this.embeddingsWorker?ht({worker:this.embeddingsWorker}):void 0,c=this.embeddingsWorker?mt({worker:this.embeddingsWorker}):void 0,a=new Map,d=s.routing==="direct"?{mode:"direct",agentId:s.agentId}:{mode:"auto"},o={thread_id:n,locale:s.locale??"en",hitlResponse:null,services:{layerSearch:i,fieldSearch:c,layersAndFieldsRegistry:this.layersAndFieldsRegistry,agentRegistry:r,embeddingCache:a}},l={version:"v2",streamMode:"custom",signal:this.activeAbortController.signal,...this.runtimeEventsEnabled&&{callbacks:[this.createHierarchyCallback()]},configurable:o,subgraphs:!0},u=this.graph?.streamEvents({routing:d,agentExecutionContext:{userRequest:e,inputParts:[...s.inputParts??[]],messages:this.chatHistory,priorSteps:this.priorSteps,sharedState:this.sharedState,sharedResources:this.sharedResources}},l),g=++this.streamEpoch;if(yield*this.pipeStream(u,g,n),this.isRunCancelled(n)){yield*this.createCancellationEvents(n);return}for(;;){if(this.isRunCancelled(n)){yield*this.createCancellationEvents(n);return}let m=(await this.graph.getState(l,{subgraphs:!0})).tasks.find(f=>f.interrupts.length>0)?.interrupts[0]?.value;if(!m)break;this.currentInterrupt=m,this.interruptHandler=new W(this.graph,l),yield*this.closeActiveRuntimeSpans(n,"interrupted"),yield{runId:n,timestamp:Date.now(),type:"interrupt",interrupt:m};try{let f=await this.interruptHandler.waitForUser(),E=++this.streamEpoch;yield*this.pipeStream(f,E,n)}catch(f){if(this.isRunCancelled(n)){yield*this.createCancellationEvents(n);return}if(f){yield{runId:n,timestamp:Date.now(),type:"error",error:{message:f?.message}};return}}}if(this.isRunCancelled(n)){yield*this.createCancellationEvents(n);return}let h=(await this.graph.getState(l,{subgraphs:!0})).values;if(this.isRunCancelled(n)){yield*this.createCancellationEvents(n);return}this.chatHistory=h.agentExecutionContext.messages.length?h.agentExecutionContext.messages:this.chatHistory,this.priorSteps=h.agentExecutionContext.priorSteps?.slice(-5)??[],this.sharedState=h.agentExecutionContext.sharedState??{},this.sharedResources=h.agentExecutionContext.sharedResources??[],yield{runId:n,timestamp:Date.now(),type:"completed",result:{content:h.finalOutputMessage}}}newConversation(){this.chatHistory=[],this.priorSteps=[],this.sharedState={},this.sharedResources=[]}resumeInterrupt(e){if(!this.currentInterrupt||!this.interruptHandler)throw new Error("No pending interrupt to resume.");this.interruptHandler.handle(this.currentInterrupt,e)}cancelInterrupt(){this.interruptHandler&&this.interruptHandler.cancel()}cancel(){this.activeRunId&&(this.cancelledRunIds.add(this.activeRunId),this.activeAbortController?.abort(),++this.streamEpoch,this.interruptHandler?.cancel())}async*pipeStream(e,s,r){try{for await(let n of e){if(this.isRunCancelled(r)||s!==this.streamEpoch)break;if(this.runtimeEventsEnabled){let i=ut({event:n,runId:r,parentSpanId:this.parentRunIds.get(n.run_id),timestamp:Date.now()});i&&(i.phase==="started"?this.activeRuntimeSpans.set(i.span.id,i):this.activeRuntimeSpans.delete(i.span.id),yield i)}n.event==="on_custom_event"&&n.name==="trace_message"?yield{runId:r,timestamp:Date.now(),type:"trace",data:n.data}:n.name==="graph_ux_suggestion"&&(yield{runId:r,timestamp:Date.now(),type:"ux-suggestion",suggestion:n.data})}}catch(n){if(!this.isRunCancelled(r))throw n}}*createCancellationEvents(e){yield*this.closeActiveRuntimeSpans(e,"cancelled"),yield{runId:e,timestamp:Date.now(),type:"cancelled",reason:"user"}}*closeActiveRuntimeSpans(e,s){let r=Date.now(),n=[...this.activeRuntimeSpans.values()].reverse();this.activeRuntimeSpans.clear();for(let i of n){let{input:c,...a}=i.span;yield{type:"runtime",phase:s,runId:e,timestamp:r,...i.agentId&&{agentId:i.agentId},span:a}}}createHierarchyCallback(){let e=(s,r)=>{r&&this.parentRunIds.set(s,r)};return re.fromMethods({handleLLMStart:(s,r,n,i)=>e(n,i),handleChatModelStart:(s,r,n,i)=>e(n,i),handleChainStart:(s,r,n,i)=>e(n,i),handleToolStart:(s,r,n,i)=>e(n,i),handleRetrieverStart:(s,r,n,i)=>e(n,i)})}isRunCancelled(e){return this.cancelledRunIds.has(e)}createRequestAgentRegistry(e){let s=e.routing==="direct"?[e.agentId]:e.agentIds,r=s?s.map(i=>{let c=this.agentRegistry.get(i);if(!c)throw new Error(`Agent is not registered: ${i}`);return c}):this.agentRegistry.list(),n=new T;return r.forEach(i=>n.register(i)),n}dispose(){this.sharedResources=[],this.embeddingsWorker&&(this.embeddingsWorker.terminate(),this.embeddingsWorker=void 0),this.orchestratorReady=!1}};var St=B`: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)}`;function H(t){return t.trim()?O.lexer(t).filter(e=>e.type!=="space").map(e=>O.parser([e])):[]}var L=class{constructor(){this._stableParts=[],this._stableText="",this._rawText=""}push(e){return this._rawText+=e,this._advanceStableBoundary(),this.getParts()}finalize(){let e=this._rawText.slice(this._stableText.length);return e.trim()&&(this._stableParts.push(...H(e)),this._stableText=this._rawText),this._stableParts}getParts(){let e=this._trimIncompleteTail(this._rawText.slice(this._stableText.length)),s=e.trim()?H(e):[];return[...this._stableParts,...s]}reset(){this._stableParts=[],this._stableText="",this._rawText=""}_advanceStableBoundary(){let e=this._rawText.slice(this._stableText.length),s=this._lastSafeBoundary(e);if(s<=0)return;let r=e.slice(0,s);this._stableParts.push(...H(r)),this._stableText+=r}_lastSafeBoundary(e){let s=e.split(`
|
|
8
|
-
`),r=!1,n=0,i=0;for(let c of s)/^\s*(```|~~~)/u.test(c)&&(r=!r),i+=c.length+1,c.trim()===""&&!r&&(n=i);return n<e.length?n:0}_trimIncompleteTail(e){let s=e.lastIndexOf("<");if(s!==-1&&!e.includes(">",s))return e.slice(0,s);let r=this._earliestUnclosedTag(e);if(r!==-1)return e.slice(0,r);let n=e.lastIndexOf("[");if(n!==-1){let i=e.slice(n);if(!/\[[^\]]*\]\([^)]*\)/u.test(i))return e.slice(0,n)}return e}_earliestUnclosedTag(e){let s=new Set(["br","img","hr","input","meta","link","area","base","col","embed","source","track","wbr"]),r=/<(\/?)([a-zA-Z][\w-]*)\b[^>]*?(\/?)>/gu,n=[];for(let i=r.exec(e);i;i=r.exec(e)){let[,c,a,d]=i,o=a.toLowerCase();if(!(s.has(o)||d==="/"))if(c==="/"){for(let l=n.length-1;l>=0;l--)if(n[l].name===o){n.splice(l);break}}else n.push({name:o,index:i.index})}return n.length?n[0].index:-1}};function Ct(t){let e=new L;return e.push(t),e.finalize()}var At=async t=>await new Promise(e=>setTimeout(e,t));async function*$t(t,{chunkSize:e=15,delay:s=50}={}){let r=new L;for(let n=0;n<t.length;n+=e)yield r.push(t.slice(n,n+e)),await At(s);yield r.finalize()}var Pt=Object.defineProperty,Mt=Object.getOwnPropertyDescriptor,_=(t,e,s,r)=>{for(var n=r>1?void 0:r?Mt(e,s):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(n=(r?c(e,s,n):c(n))||n);return r&&n&&Pt(e,s,n),n},xe=t=>!t||typeof t!="object"?!1:t.name==="AbortError";async function*Ie(t,e,s,r,n=!1){if(n){if(r?.aborted){yield{type:"cancelled",log:s,runId:e};return}yield{type:"block-data",blockType:"text",data:{parts:Ct(t)},runId:e};return}for await(let i of $t(t)){if(r?.aborted){yield{type:"cancelled",log:s,runId:e};return}yield{type:"block-data",blockType:"text",data:{parts:i},runId:e}}}var v=class extends It{constructor(t){super(t),this.view=null,this.streamingDisabled=!1,this.runtimeEventsEnabled=!1,this.loading=!1,this.processing=!1,this.processingStep=""}async load(){this._set("loading",!0);try{await this._initialize()}finally{this._set("loading",!1)}}destroy(){this.orchestrator?.dispose(),super.destroy()}async _initialize(){this.removeHandles(),await Promise.all([this.portal.load(),this.view?.when()]),this.view&&await Et(()=>!this.view.updating),this._set("orchestrator",await D.init({agents:[...this.agents],runtimeEventsEnabled:this.runtimeEventsEnabled,view:this.view??void 0})),this.addHandles([_t(()=>[this.view,this.agents],()=>{this._initialize()})])}clearChatHistory(){this.orchestrator?.newConversation()}async*ask(t,e,s){if(!this.orchestrator)throw new Error("Orchestrator not initialized yet.");this._set("processing",!0),this._set("processingStep","");let r=[],n,i="pending";try{let c=this.orchestrator.ask(t,e);for await(let a of c)switch(i=a.runId,a.type){case"runtime":{yield{type:"runtime",event:a,runId:i};break}case"trace":{this._set("processingStep",a.data.text),r.push(a.data.text);break}case"completed":{this._set("processing",!1),this._set("processingStep","");let d=a.result,o=!!d.content.length,l=!!n?.length;if(!o&&!l){yield{type:"completed",error:"No response received.",log:r,runId:i};return}let u=d.content;if(yield{type:"block-start",blockType:"text",runId:i},yield*Ie(u,i,r,s,this.streamingDisabled),yield{type:"block-end",blockType:"text",runId:i},l)for(let g of n){if(s?.aborted){yield{type:"cancelled",log:r,runId:i};return}let{type:h,data:m}=g;if(yield{type:"block-start",blockType:h,runId:i},h==="text"){let f=typeof m?.content=="string"?m.content:"";yield*Ie(f,i,r,s,this.streamingDisabled)}else yield{type:"block-data",blockType:h,data:m,runId:i};yield{type:"block-end",blockType:h,runId:i}}yield{type:"completed",response:u,blocks:n,log:r,runId:i};return}case"ux-suggestion":{let d=a.suggestion;n=n?[...n,d]:[d];break}case"interrupt":{let{kind:d,message:o,metadata:l}=a.interrupt,u=Array.isArray(l)?l.filter(h=>typeof h=="string"):[],g=(()=>{switch(d){case"booleanChoice":return{type:"boolean-choice",message:o,options:u};case"singleSelection":return{type:"single-select",message:o,options:u};case"multipleSelection":return{type:"multi-select",message:o,options:u};case"textInput":return{type:"text-input",message:o};default:return{type:d,message:o,options:u}}})();this._set("processingStep","Waiting for user input..."),yield{type:"interrupt",payload:g,runId:i};break}case"cancelled":{yield{type:"cancelled",log:r,runId:i};return}case"error":{if(s?.aborted||xe(a.error)){yield{type:"cancelled",log:r,runId:i};return}yield{type:"completed",error:a.error.message,log:r,runId:i};return}default:{console.warn("Unknown event type:",a);break}}}catch(c){if(s?.aborted||xe(c)){yield{type:"cancelled",log:r,runId:i};return}console.warn("Error during message processing:",c),yield{type:"completed",error:this.messages.messageProcessingErrorMessage,log:r,runId:"error"};return}finally{this._set("processing",!1)}}cancel(){this.orchestrator?.cancel()}};_([k({readOnly:!0})],v.prototype,"orchestrator",2);_([k()],v.prototype,"agents",2);_([k()],v.prototype,"portal",2);_([k()],v.prototype,"view",2);_([k()],v.prototype,"messages",2);_([k()],v.prototype,"streamingDisabled",2);_([k()],v.prototype,"runtimeEventsEnabled",2);_([k({readOnly:!0})],v.prototype,"loading",2);_([k({readOnly:!0})],v.prototype,"processing",2);_([k({readOnly:!0})],v.prototype,"processingStep",2);v=_([Rt("OrchestratorController")],v);var Tt="Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.",Dt="Embeddings not found for this web map.",Lt="https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings",z=class extends Q{constructor(){super(...arguments),this._messages=Z({blocking:!0}),this.#e=P(),this.#o=P(),this.#r=P(),this.#t=null,this.#n=new Map,this.#s=xt.getDefault(),this.#i=e=>{e.stopPropagation(),this.cancelInterrupt()},this.#a=e=>{e.stopPropagation();let s=e.detail;this.submitInterrupt(s)},this.#l=e=>{if(e.stopPropagation(),e.defaultPrevented)return;let s=e.detail,r=typeof s=="string"?s:s.prompt,n=typeof s=="string"?void 0:{displayText:s.displayText,parts:s.parts};if(!this.#y(r,n?.parts??[])){e.preventDefault();return}if(this.arcgisSubmit.emit(s).defaultPrevented){e.preventDefault();return}this.keepSuggestedPrompts||(this.suggestedPrompts=[]),this._inputValue="",this.submitMessage(r,n)},this.#c=e=>{if(this._canceling=!0,e.stopPropagation(),this.arcgisCancel.emit(),this._interrupt){this.orchestrator?.cancelInterrupt(),this._interrupt=null;return}this._orchestratorController?.cancel(),this.#t?.abort(),this.#t=null},this.#d=e=>{e.stopPropagation();let s=e.detail;this.arcgisFeedback.emit(s)},this.#u=e=>{e.stopPropagation();let s=e.detail;this._inputValue=s.prompt,this.arcgisPromptSelect.emit(s)},this.#p=e=>{this.arcgisSlottableRequest.emit(e.detail)},this._orchestratorController=null,this._interrupt=null,this._interruptDetails=[],this._error=null,this._submissionError=null,this._inputValue="",this._isAnswering=!1,this._canceling=!1,this.messages=new vt([]),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=w(),this.arcgisError=w(),this.arcgisFeedback=w(),this.arcgisInterrupt=w(),this.arcgisInterruptCancel=w(),this.arcgisInterruptSubmit=w(),this.arcgisPromptSelect=w(),this.arcgisReady=w(),this.arcgisResponse=w(),this.arcgisRuntime=w({bubbles:!1,composed:!1}),this.arcgisSlottableRequest=w({bubbles:!1,composed:!1}),this.arcgisSubmit=w({cancelable:!0})}static{this.properties={_orchestratorController:16,_interrupt:16,_interruptDetails:16,_error:16,_submissionError: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:[1,{type:Array}],commandProvider:0,entityProviders:0,suggestedPrompts:[1,{type:Array}],feedbackEnabled:5,keepSuggestedPrompts:5,streamingDisabled:5,runtimeEventsEnabled:5,logEnabled:5,copyEnabled:5,voiceInputEnabled:5,readAloudEnabled:5,assistantAvatarEnabled:5,userAvatarEnabled:5}}static{this.styles=St}#e;#o;#r;#t;#n;#s;#i;#a;#l;#c;#d;#u;#p;get _isSignedIn(){return!!this.#s?.user||!!this._signedInUserId}get _user(){return this.#s?.user?.fullName||this.#s?.user?.username}get awaitingResponse(){return this._orchestratorController?.processing??!1}get awaitingResponseStep(){return this._orchestratorController?.processingStep??""}get interrupt(){return this._interrupt}get orchestrator(){return this._orchestratorController?.orchestrator}cancelInterrupt(){this.arcgisInterruptCancel.emit(),this.orchestrator?.cancelInterrupt(),this._interrupt=null}async clearChatHistory(){this._reset(),this._orchestratorController?.clearChatHistory()}register(e){this.#n.set(e.agent.id,e),this._orchestratorController&&this.#g()}submitInterrupt(e){this.arcgisInterruptSubmit.emit(e),this._interrupt&&(this._interruptDetails=[...this._interruptDetails,{interrupt:this._interrupt,response:e}]),this.orchestrator?.resumeInterrupt(e),this._interrupt=null}async submitMessage(e,s){let r=e.trim(),n=s?.parts??[];if(!r&&!n.length||!this.#y(r,n)||(this.messages.push({id:Date.now().toString(),role:"user",content:s?.displayText?.trim()||r||n.map(o=>this.#f(o)).join(" "),parts:n}),!this._orchestratorController))return;this.#t=new AbortController,this._orchestratorController.streamingDisabled=this.streamingDisabled;let i=this.#m(n),c=this._messages._t9nLocale||"en",a={...s?.parts?{inputParts:s.parts}:{},...i?{routing:"direct",agentId:i}:{routing:"auto",agentIds:this.allowedAgentIds},locale:c},d=this._orchestratorController.ask(r,a,this.#t?.signal);for await(let o of d){let l=o.runId,u=this.messages.at(-1);switch(o.type){case"runtime":this.arcgisRuntime.emit(o.event);break;case"block-start":{this._isAnswering=!0;let g={type:o.blockType,isPending:!0};if(u?.role==="assistant"&&u.id===l){let h=[...u.blocks??[],g];this.messages.splice(-1,1,{...u,blocks:h})}else this.messages.push({role:"assistant",blocks:[g],id:l,isStreaming:!0,interrupts:this._interruptDetails}),this._interruptDetails=[];break}case"block-data":{if(u?.role!=="assistant"||u?.id!==l)break;let g=[...u.blocks??[]],h=g[g.length-1],{blockType:m,data:f}=o;if(h?.type!==m||!h.isPending)break;m==="text"?g[g.length-1]={...h,data:{...h.data,parts:f?.parts}}:g[g.length-1]={...h,data:{...h.data,...f??{}}},this.messages.splice(-1,1,{...u,blocks:g});break}case"block-end":{if(u?.role!=="assistant"||u?.id!==l)break;let g=[...u.blocks??[]],h=g[g.length-1];if(h?.type!==o.blockType||!h.isPending)break;let m=h;g[g.length-1]={...m,data:{...m.data},isPending:!1},this.messages.splice(-1,1,{...u,blocks:g});break}case"completed":o.error?(this.messages.push({role:"assistant",log:o.log,error:o.error,id:l,interrupts:this._interruptDetails}),this._interruptDetails=[]):u?.role==="assistant"&&u.id===l&&this.messages.splice(-1,1,{...u,content:o.response,blocks:u.blocks?.map(g=>({...g,data:{...g.data},isPending:!1}))??[],isStreaming:!1,log:o.log}),this._isAnswering=!1,this.#t=null,this._canceling=!1;break;case"interrupt":this._interrupt={...o.payload,id:l},this.arcgisInterrupt.emit(this._interrupt);break;case"cancelled":u?.role==="assistant"&&u.id===l?this.messages.splice(-1,1,{...u,blocks:u.blocks?.filter(g=>g.type==="text"||!g.isPending)??[],isStreaming:!1,log:o.log,error:`(${this._messages.stoppedByUserLabel})`}):(this.messages.push({role:"assistant",log:o.log,error:`(${this._messages.stoppedByUserLabel})`,id:l,interrupts:this._interruptDetails}),this._interruptDetails=[]),this._isAnswering=!1,this.#t=null,this._canceling=!1;break}}}unregister(e){this.#n.delete(e),this._orchestratorController&&this.#g()}load(){this.manager.onLifecycle(this._reset.bind(this))}loaded(){this.manager.onLifecycle(()=>{this.#e.value?.addEventListener("arcgisPromptSelect",this.#u),this.#e.value?.addEventListener("arcgisSubmit",this.#l),this.#e.value?.addEventListener("arcgisCancel",this.#c),this.#e.value?.addEventListener("arcgisFeedback",this.#d);let e=kt(()=>!!this._interrupt&&!!this.#r.value,()=>{let r=this.#r.value;r.removeEventListener("arcgisSubmit",this.#a),r.removeEventListener("arcgisCancel",this.#i),r.addEventListener("arcgisSubmit",this.#a,{once:!0}),r.addEventListener("arcgisCancel",this.#i,{once:!0})}),s=this.messages.on("after-add",r=>{let n=r.item;n.role==="assistant"&&(n.error||n.content)&&this.arcgisResponse.emit(n)});return queueMicrotask(()=>{this.#h()}),()=>{e.remove(),s.remove(),this.#e.value?.removeEventListener("arcgisPromptSelect",this.#u),this.#r.value?.removeEventListener("arcgisSubmit",this.#a),this.#r.value?.removeEventListener("arcgisCancel",this.#i),this.#e.value?.removeEventListener("arcgisSubmit",this.#l),this.#e.value?.removeEventListener("arcgisCancel",this.#c),this.#e.value?.removeEventListener("arcgisFeedback",this.#d),this._orchestratorController?.destroy(),this._orchestratorController=null}})}willUpdate(e){this.hasUpdated&&e.has("runtimeEventsEnabled")&&this._orchestratorController&&(this._orchestratorController.destroy(),this._orchestratorController=null,this.#h())}#f(e){return e.kind==="command"?`/${e.id}`:`${e.trigger}${e.id}`}#m(e){for(let s of e)if(s.kind==="command"&&s.agentId)return s.agentId;return this.alwaysUseAgentId}#y(e,s){let r=s.filter(n=>n.kind==="command").length>1;return this._submissionError=r?this._messages.multipleCommands:!e.trim()&&s.length>0&&!this.#m(s)?this._messages.partsOnlyRequiresAgent:null,this._submissionError?(this.arcgisError.emit(new Error(this._submissionError)),!1):!0}async#b(){await ke.checkSignInStatus(this.#s.url);let e=await this.#s.load();if(!e.helperServices?.aiAssistantServices?.url)throw new Error(this._messages.serviceUrlNotAvailableMessage);let s=!1,r=await e.fetchSettings();if(r.aiConfig?s=r.aiConfig.aiForOrg?.enabled===!0&&r.aiConfig.aiForOrg?.aiCapabilities?.aiAgents?.enabled===!0:s=r.aiAssistantsEnabled===!0,!s)throw new Error(this._messages.aiAssistantsNotEnabledMessage);if(!e.isPortal&&e?.user?.privileges?.includes("portal:user:useAIAssistants")!==!0)throw new Error(this._messages.userPrivilegesNotSufficientMessage)}async#g(){try{this._error=null;let e=pe(this.el,this.referenceElement);await e?.componentOnReady();let s=[...this.#n.values()];return s.length?(await this.#b(),this._orchestratorController?.destroy(),this._orchestratorController=new v({agents:s,portal:this.#s,runtimeEventsEnabled:this.runtimeEventsEnabled,streamingDisabled:this.streamingDisabled,view:e?.view,messages:this._messages}),await this._orchestratorController.load(),this.requestUpdate(),!0):(this._error=this._messages.noAgentsFoundMessage,!1)}catch(e){return this._error=e?.message??this._messages.orchestratorInitializationErrorMessage,G(this)(e),!1}}async#h(){await this.#g()?this.arcgisReady.emit():this._error&&this.arcgisError.emit(new Error(this._error))}_reset(){this._orchestratorController?.cancel(),this.#t?.abort(),this._interrupt=null,this.messages.removeAll(),this._error=null,this._submissionError=null,this._inputValue="",this._signedInUserId=void 0}_renderEntryMessage(){return this._isSignedIn?this._error?this._renderErrorNotice():this.entryMessage?this.messages.length>0?null:y`<calcite-notice open kind=brand closable icon width=full><div slot=message>${this.entryMessage}</div></calcite-notice>`:y`<slot name=entry-message></slot>`:this._renderSignInNotice()}_renderSignInNotice(){let e=this.#s;return y`<calcite-notice slot=entry-message open kind=brand icon width=full><div slot=message>${this._messages.signInRequiredMessage}</div>${e?y`<calcite-link slot=link @click=${async()=>{try{let s=await ke.getCredential(`${e.url}/sharing`);this._signedInUserId=s.userId,this._error=null,this.requestUpdate(),await this.#h()}catch(s){this._error=s?.message??this._messages.signInErrorMessage,this.arcgisError.emit(new Error(this._error)),V("error",this,"Error signing in:",{detail:{error:s}})}}} target=_blank title=${this._messages.signInToArcGISOnlineLabel??C}>${this._messages.signInLabel}</calcite-link>`:y`<div slot=link>${this._messages.noPortalInformationMessage}</div>`}</calcite-notice>`}_renderErrorNotice(){return this._error?y`<calcite-notice slot=entry-message open kind=brand icon width=full>${this._error===Tt?y`<div slot=message>${Dt}</div><calcite-link slot=link .href=${Lt} target=_blank title=${this._messages.learnAboutWebMapEmbeddingsLabel??C}>${this._messages.readMoreLabel}</calcite-link>`:y`<div slot=message>${this._error}</div>`}</calcite-notice>`:null}render(){return y`<calcite-panel .loading=${!this._orchestratorController&&!this._error||this._orchestratorController?.loading} .heading=${this.heading??this._messages.assistantLabel} .description=${this.description} ${M(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"?y`<arcgis-assistant-message .message=${e} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled} @arcgisSlottableRequest=${this.#p} .assistantAvatarEnabled=${this.assistantAvatarEnabled}>${e.blocks?.map((s,r)=>y`<slot name=${j(e.id,r)??C} slot=${j(e.id,r)??C}><arcgis-assistant-message-block .block=${s}></arcgis-assistant-message-block></slot>`)}</arcgis-assistant-message>`:y`<arcgis-assistant-user-message .message=${e} .user=${this._user} .userAvatarEnabled=${this.userAvatarEnabled}></arcgis-assistant-user-message>`)}</slot>${this._interrupt?y`<div slot=message-loading><div class="interrupt-waiting-message">${this._messages.waitingForUserInputMessage}</div></div>`:y`<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?y`<slot name=interrupt><arcgis-assistant-interrupt slot=content-bottom .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${M(this.#r)}></arcgis-assistant-interrupt></slot>`:this.suggestedPrompts?.length?y`<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()}${this._submissionError?y`<div role=alert>${this._submissionError}</div>`:null}<slot name=chat-entry><arcgis-assistant-chat-entry .awaitingResponse=${this.awaitingResponse||this._isAnswering} .commandProvider=${this.commandProvider} .entityProviders=${this.entityProviders} .inputValue=${this._inputValue} .messages=${this.messages} .voiceInputEnabled=${this.voiceInputEnabled} .disabled=${this._canceling||!this._isSignedIn||!!this._interrupt||!!this._error} ${M(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=${()=>{this.#o.value?.submitMessage()}} 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>`}};J("arcgis-assistant",z);return z},"core/Collection","core/reactiveUtils","portal/Portal","identity/IdentityManager","portal/Portal","core/reactiveUtils","layers/FeatureLayer","request","core/Accessor","core/accessorSupport/decorators","identity/IdentityManager",a)
|
|
6
|
+
Description: {description}`,ye=p.object({schemaVersion:p.literal(Se),modified:p.number().int().nonnegative(),embeddings:p.object({modelProvider:p.literal(Ce),model:p.literal(Ae),dimensions:p.literal($),templates:p.object({layer:p.string().default($e),field:p.string().default(Pe)})}),layers:p.array(p.object({id:p.string().min(1),name:p.string().min(1),title:p.string().catch(""),description:p.string().catch(""),vector:p.array(p.number()).length($,{message:`Layer vector must be exactly ${$} dimensions`}),fields:p.array(p.object({name:p.string().min(1),alias:p.string().catch(""),description:p.string().catch(""),vector:p.array(p.number()).length($,{message:`Field vector must be exactly ${$} dimensions`})}))})).default([])});var qe=async t=>{let e=await Oe(),s=await X("default"),r=Te.getDefault(),n=(await Me.getCredential(`${r.url}/sharing`)).token,i={type:"generateEmbeddings",webmapEmbeddings:t,auth:{apiUrl:s,token:n}};return e.postMessage(i),await new Promise((c,a)=>{let d=l=>{l.data==="completed"&&(e.removeEventListener("message",d),c())},o=l=>{e.removeEventListener("message",d),a(l instanceof Error?l:new Error("Embeddings worker error"))};e.addEventListener("message",d),e.addEventListener("error",o,{once:!0})}),e},Oe=async()=>{{let t=(await import("./6J3J7VLW.js")).default;return new t}},Fe=x.Root({agentExecutionContext:x({default:ce,reducer:oe}),currentIntent:x({default:()=>"none",reducer:A}),routing:x({default:()=>({mode:"auto"}),reducer:A}),lastExecutedAgent:x({default:()=>"",reducer:A}),requiresFollowUp:x({default:()=>!0,reducer:A}),stepCount:x({default:()=>0,reducer:(t,e)=>e??t+1}),finalOutputMessage:x({default:()=>"",reducer:le})}),Ue=t=>{if(!t||typeof t!="object"||!("services"in t))return!1;let e=t.services;return!!e&&typeof e=="object"&&"agentRegistry"in e},N=t=>{let e=t?.configurable;return Ue(e)?e:void 0},je=t=>{t.currentIntent="none"},We=async(t,e)=>{let s=N(e),r=await R({path:"./assets/orchestrator/t9n",locale:I(e)});if(t.agentExecutionContext.userRequest){let i=new se(t.agentExecutionContext.userRequest.trim());t.agentExecutionContext.messages=[...t.agentExecutionContext.messages,i],je(t)}let n=s?.services.agentRegistry.list().map(i=>i.agent.id)??[];return await b({text:r.availableAgents.replace("{agentIds}",[...n].join(", "))},e),await b({text:r.analyzingUserInput},e),t},Ne=async(t,e)=>{let s=await R({path:"./assets/orchestrator/t9n",locale:I(e)});return await b({text:s.exiting},e),t},fe=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),He=(t,e)=>{if(!fe(t)){t!==void 0&&console.warn(`Agent "${e}" returned invalid sharedStatePatch. Ignoring it.`);return}let s={};for(let[r,n]of Object.entries(t)){if(!fe(n)||!("value"in n)){console.warn(`Agent "${e}" returned invalid sharedStatePatch entry for key "${r}". Ignoring that entry.`);continue}s[r]={value:n.value}}return s},ze=t=>{let{previousSharedState:e,patch:s,agentId:r}=t;if(!s)return e;let n=Date.now(),i={...e};for(let[c,a]of Object.entries(s))a?.value!==void 0&&(i[c]={value:a.value,meta:{updatedByAgentId:r,updatedAt:n}});return i},Be=256,Ve=new Set(["point","polyline","polygon","extent","custom"]),Ge=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),Qe=(t,e)=>{if(t===void 0)return;if(!Array.isArray(t)){console.warn(`Agent "${e}" returned invalid sharedResourceAdditions. Ignoring it.`);return}let s=[];for(let[r,n]of t.entries()){if(!Ge(n)||typeof n.kind!="string"||!Ve.has(n.kind)||typeof n.description!="string"||!n.description.trim()||!("payload"in n)||n.payload===void 0){console.warn(`Agent "${e}" returned invalid sharedResourceAdditions entry at index ${r}. Ignoring that entry.`);continue}let i;try{i=structuredClone(n.payload)}catch{console.warn(`Agent "${e}" returned invalid sharedResourceAdditions entry at index ${r}. Ignoring that entry.`);continue}s.push({kind:n.kind,description:n.description.trim().slice(0,Be),payload:i})}return s.length?s:void 0},Je=t=>{let{previousSharedResources:e,additions:s,agentId:r}=t;if(!s?.length)return e;let n=Date.now(),i=s.map(c=>({...c,id:q(),meta:{createdByAgentId:r,createdAt:n}}));return[...e,...i].slice(-50)},be=t=>typeof t!="string"?void 0:t.trim()||void 0,Ze=t=>{switch(t){case"failed":return"Agent failed without a summary.";case"unknown":return"Agent returned with unknown status.";case"success":return"Agent completed without a summary.";default:return"Agent completed without a summary."}},Ke=(t,e)=>{let s=be(e?.outputMessage),r=be(e?.summary),n=e?.status,i=n==="success"||n==="failed"?n:"unknown";i==="unknown"&&console.warn(`Agent "${t}" returned missing/invalid status. Defaulting to "unknown".`);let c=He(e?.sharedStatePatch,t),a=Qe(e?.sharedResourceAdditions,t);return{outputMessage:s,summary:r??s??Ze(i),status:i,sharedStatePatch:c,sharedResourceAdditions:a}},we=4e3,Xe=async(t,e)=>{let s=N(e),r=await R({path:"./assets/orchestrator/t9n",locale:I(e)});if(e?.signal?.aborted)return await b({text:r.runCancelledAgentExecution},e),{...t,currentIntent:"none",requiresFollowUp:!1};let{agentRegistry:n}=s?.services??{},i=n?.get(t.currentIntent);if(!i)return console.warn(r.noAgentFoundForIntent.replace("{intent}",t.currentIntent)),t;await b({text:r.executingRegisteredAgent.replace("{agentName}",i.agent.name)},e);let c={...e??{},metadata:{...e?.metadata,agentId:i.agent.id},configurable:{...s??{},agentId:i.agent.id,context:i.getContext?await i.getContext():void 0}},a;try{let l=await i.agent.createGraph().compile().invoke({agentExecutionContext:{...t.agentExecutionContext,messages:[...t.agentExecutionContext.messages],priorSteps:structuredClone(t.agentExecutionContext.priorSteps??[]),sharedState:structuredClone(t.agentExecutionContext.sharedState??{}),sharedResources:structuredClone(t.agentExecutionContext.sharedResources??[])}},c);a=Ke(i.agent.name,l),await b({text:r.finishedExecutingRegisteredAgent.replace("{agentName}",i.agent.name)},e)}catch(l){if(te(l)||e?.signal?.aborted||l instanceof Error&&l.name==="AbortError")throw l;let g=l instanceof Error?l.message:String(l);console.error(`Agent "${i.agent.name}" failed:`,l),await b({text:r.registeredAgentFailed.replace("{agentName}",i.agent.name).replace("{error}",g)},e),a={status:"failed",outputMessage:r.agentExecutionFailed.replace("{error}",g),summary:r.agentExecutionFailed.replace("{error}",g)}}let d=a.outputMessage,o=[...t.agentExecutionContext.messages];if(d){let l=d.length>we?`${d.slice(0,we-14)}
|
|
7
|
+
[truncated]`:d;o.push(new O(l))}return{...t,stepCount:t.stepCount+1,lastExecutedAgent:i.agent.id,requiresFollowUp:a.status==="failed"?!0:t.requiresFollowUp,finalOutputMessage:d??"",agentExecutionContext:{...t.agentExecutionContext,messages:o,priorSteps:[...t.agentExecutionContext.priorSteps??[],{agentId:i.agent.id,assignedTask:t.agentExecutionContext.assignedTask,summary:a?.summary||r.noSummaryProvided,status:a?.status||"unknown"}],sharedState:ze({previousSharedState:t.agentExecutionContext.sharedState,patch:a.sharedStatePatch,agentId:i.agent.id}),sharedResources:Je({previousSharedResources:t.agentExecutionContext.sharedResources,additions:a.sharedResourceAdditions,agentId:i.agent.id})}}},Ye=async t=>{let{agent:e,messages:s,config:r}=t;return{structuredResponse:(await e.invoke({messages:s},r)).structuredResponse}},et=p.object({id:p.string().min(1),name:p.string().min(1),description:p.string().min(1)});p.array(et);var ve=t=>JSON.stringify(t,null,2),tt=t=>{let e=t.map(r=>r.id),s=p.enum(e);return p.object({intent:s.nullable(),assignedTask:p.string().nullable(),requiresFollowUp:p.boolean()})},st=async(t,e)=>{let s=N(e),r=await R({path:"./assets/orchestrator/t9n",locale:I(e)});if(e?.signal?.aborted)return await b({text:r.runCancelled},e),{...t,currentIntent:"none",finalOutputMessage:r.runCancelled,requiresFollowUp:!1};try{await b({text:r.routingToAgent},e);let n=s.services.agentRegistry?.list()??[],i=n.map(({agent:E})=>({id:E.id,name:E.name,description:E.description}));if(!i.length)return await b({text:r.noAgentsRegisteredTrace},e),{...t,currentIntent:"none",finalOutputMessage:r.noAgentsRegisteredMessage};let c=await me("intent_prompt"),a=ve(i),d=tt(i),o={registeredAgents:a,priorSteps:ve(t.agentExecutionContext.priorSteps),userRequest:t.agentExecutionContext.userRequest},l=await ne.fromTemplate(c).format(o),g=de({model:await F({modelTier:"fast",config:e}),tools:[],systemPrompt:l,responseFormat:d,middleware:[ue({model:await F({modelTier:"fast",config:e}),trigger:{tokens:4e3},keep:{messages:6}}),ge({runLimit:2})]}),{structuredResponse:u}=await Ye({agent:g,messages:t.agentExecutionContext.messages,config:e}),h=d.parse(u??{intent:null,assignedTask:null,requiresFollowUp:!1}),m=h.intent??"none",f={...t,currentIntent:m,requiresFollowUp:h.requiresFollowUp,agentExecutionContext:{...t.agentExecutionContext,assignedTask:h.assignedTask??""}};if(m==="none"){let E=r.noMatchingAgentMessage.replace("{agentNames}",n.map(({agent:S})=>S.name).join(", "));return await b({text:r.noMatchingAgentTrace},e),{...t,currentIntent:m,requiresFollowUp:!1,finalOutputMessage:E,agentExecutionContext:{...t.agentExecutionContext,assignedTask:"",messages:[...t.agentExecutionContext.messages,new O(E)],priorSteps:[...t.agentExecutionContext.priorSteps??[],{agentId:"no-intent-router",assignedTask:t.agentExecutionContext.userRequest,summary:"No matching agent found; asked user to rephrase.",status:"failed"}]}}}return await b({text:r.agentPicked.replace("{intent}",m).replace("{assignedTask}",h.assignedTask??"").replace("{requiresFollowUp}",String(h.requiresFollowUp))},e),f}catch(n){throw await b({text:r.intentDetectionErrorTrace},e),new Error(r.intentDetectionError.replace("{error}",n instanceof Error?n.message:String(n)))}},rt=async(t,e)=>{let s=await R({path:"./assets/orchestrator/t9n",locale:I(e)});if(t.routing.mode!=="direct")throw new Error(s.directAgentAssignmentRequiresDirectRouting);return await b({text:s.directRouteToAgent.replace("{agentId}",t.routing.agentId)},e),{...t,currentIntent:t.routing.agentId,requiresFollowUp:!1,agentExecutionContext:{...t.agentExecutionContext,assignedTask:t.agentExecutionContext.userRequest}}},nt=3,it=t=>t.routing.mode==="direct"?"assignDirectAgent":"intentLLM",at=t=>t.routing.mode==="direct"||t.stepCount>=nt||!t.requiresFollowUp?"exit":"intentLLM",ot=()=>new ae(Fe).addNode("ingestInput",We).addNode("assignDirectAgent",rt).addNode("intentLLM",st).addNode("executeRegisteredAgent",Xe).addNode("exit",Ne).addEdge(Y,"ingestInput").addConditionalEdges("ingestInput",it).addEdge("assignDirectAgent","executeRegisteredAgent").addConditionalEdges("intentLLM",t=>t.currentIntent==="none"||t.currentIntent===t.lastExecutedAgent?"exit":"executeRegisteredAgent").addConditionalEdges("executeRegisteredAgent",at).addEdge("exit",ee),lt=(t,e)=>{let s=t.output?.usage_metadata??e.usage_metadata,r=t.output?.llmOutput?.tokenUsage,n=s?.input_tokens??r?.promptTokens,i=s?.output_tokens??r?.completionTokens,c=s?.total_tokens??r?.totalTokens;if(n===void 0||i===void 0||c===void 0)return;let a=s?.input_token_details?.cache_read,d=s?.input_token_details?.cache_creation,o=s?.output_token_details?.reasoning;return{input:n,output:i,total:c,...a!==void 0&&{cacheRead:a},...d!==void 0&&{cacheWrite:d},...o!==void 0&&{reasoning:o}}},ct=(t,e,s,r)=>{switch(t){case"chat_model":case"llm":return"model";case"tool":case"retriever":return t;case"chain":return!r||e==="LangGraph"?"workflow":s===e?"node":"chain";default:return}},dt=t=>{if(t instanceof Error)return{message:t.message,name:t.name};let e=t,s=typeof e?.message=="string"?e.message:String(t??"Unknown runtime error"),r=typeof e?.name=="string"?e.name:void 0;return{message:s,...r&&{name:r}}},ut=({event:t,runId:e,parentSpanId:s,timestamp:r})=>{let n=/^on_(.+)_(start|end|error)$/u.exec(t.event);if(!n)return;let[,i,c]=n,a=t.metadata??{},d=a.langgraph_node,o=ct(i,t.name,d,s);if(!o)return;let l=a.agentId,g=a.model??a.ls_model_name,u=t.data,h=c==="end"&&o==="model"?lt(u,a):void 0,m=t.tags?.includes("langsmith:hidden")||d==="__start__",f={...g&&{model:g},...h&&{tokenUsage:h},...m&&{internal:!0}},E={id:t.run_id,...s&&{parentId:s},label:t.name,type:o,...Object.keys(f).length&&{metadata:f}},S={runId:e,timestamp:r,type:"runtime",...l&&{agentId:l}};switch(c){case"start":return{...S,phase:"started",span:{...E,...u?.input!==void 0&&{input:u.input}}};case"end":return{...S,phase:"completed",span:{...E,...u?.output!==void 0&&{output:u.output}}};case"error":return{...S,phase:"failed",span:{...E,error:dt(u?.error)}};default:return}},T=class{constructor(){this.agentRegistry=new Map}register(e){let{agent:s}=e;if(this.agentRegistry.has(s.id))throw new Error(`Duplicate agent id: ${s.id}`);this.agentRegistry.set(s.id,e)}get(e){return this.agentRegistry.get(e)}list(){return[...this.agentRegistry.values()]}},W=class{constructor(e,s){this.graph=e,this.config={...s}}async waitForUser(){return await new Promise((e,s)=>{this.resolveWait=e,this.rejectWait=s})}handle(e,s){try{let r={agentId:e.agentId,id:e.id,payload:s},n=this.graph.streamEvents(null,{...this.config,configurable:{...this.config.configurable,hitlResponse:r},subgraphs:!0,version:"v2"});this.resolveWait?.(n)}catch(r){this.rejectWait?.(r)}finally{this.resolveWait=void 0,this.rejectWait=void 0}}cancel(){this.rejectWait&&(this.rejectWait(new Error("Request cancelled by user.")),this.resolveWait=void 0,this.rejectWait=void 0)}},_e=async(t,e)=>{let s=e.get(t);if(s)return s;let r=await he([t]);return e.set(t,r[0]),r[0]};async function gt(t,e,s,r){let n=`req-${Date.now()}`,i={type:"layerSearch",precomputedEmbedding:r?await _e(t,r):void 0,requestId:n,minScore:s};return await new Promise(c=>{let a=d=>{d.data.requestId===n&&c(d.data.results)};e.addEventListener("message",a,{once:!0}),e.postMessage(i)})}function ht(t){let{worker:e}=t;return{async searchLayers({text:s,minScore:r,embeddingCache:n}){return await gt(s,e,r,n)}}}var pt=async({combinedQuery:t,layerIds:e,embeddingsWorker:s,minScore:r,topResults:n,embeddingCache:i})=>{let c=`req-${Date.now()}`,a=i?await _e(t,i):void 0,d={type:"fieldSearch",layerIdForFieldsSearch:e,precomputedEmbedding:a,requestId:c,minScore:r,topResults:n};return await new Promise(o=>{let l=g=>{if(g.data.requestId!==c)return;let u=g.data.results.map(({layerId:h,results:m})=>({layerId:h,results:m}));o(u)};s.addEventListener("message",l,{once:!0}),s.postMessage(d)})};function mt(t){let{worker:e}=t;return{async searchFields({text:s,layerIds:r,minScore:n,topResults:i,embeddingCache:c}){return await pt({combinedQuery:s,layerIds:r,embeddingsWorker:e,minScore:n,topResults:i,embeddingCache:c})}}}var yt=t=>{let e=ye.safeParse(t);if(!e.success)throw new Error("Embeddings response validation failed. Regenerate embeddings.");return e.data},ft=(t,e)=>{let s=new Map,r=new Map;if(e.allLayers.forEach(n=>{n instanceof De&&r.set(n.id,n)}),t.length!==r.size)throw new Error("Layer count mismatch during registry restoration. Regenerate embeddings.");for(let n of t){let i=r.get(n.id);if(!i)throw new Error(`Layer with ID ${n.id} not found in the original map during registry restoration. Regenerate embeddings.`);if(n.fields.length!==i.fields.length)throw new Error(`Field count mismatch for layer ID ${n.id} during registry restoration. Regenerate embeddings.`);let c={name:n.name,title:n.title,description:n.description},a=new Map;for(let d of n.fields){let o=i.fieldsIndex.get(d.name);if(!o)throw new Error(`Field with name ${d.name} not found in the original layer ${n.id} during registry restoration. Regenerate embeddings.`);a.set(d.name,{name:d.name,alias:i.getFieldAlias(d.name)??d.alias,description:d.description,type:o.type||"unknown",valueType:o.valueType||"unknown",domain:i.getFieldDomain(d.name)??void 0})}s.set(n.id,{layerItem:c,fieldRegistry:a})}return s},bt=async t=>{try{return(await Le(t,{responseType:"json"})).data}catch(e){throw new Error(`Failed to fetch data from ${t}: ${String(e)}`)}},wt=async t=>{let e=t.map;if(!e?.portalItem)throw new Error("WebMap portal item is missing.");let{resources:s}=await e.portalItem.fetchResources(),r=s.find(i=>i.resource.path==="embeddings-v01.json");if(!r?.resource.url)throw new Error("Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.");let n=await bt(r.resource.url);return yt(n)},D=class t{constructor(){this.orchestratorReady=!1,this.chatHistory=[],this.priorSteps=[],this.sharedState={},this.sharedResources=[],this.agentRegistry=new T,this.activeRunId="",this.cancelledRunIds=new Set,this.parentRunIds=new Map,this.activeRuntimeSpans=new Map,this.runtimeEventsEnabled=!1,this.streamEpoch=0}static async init(e){let s=new t;s.runtimeEventsEnabled=e.runtimeEventsEnabled??!1;try{if(e.view?.map){await Ee.whenOnce(()=>e.view.ready);let r=await wt(e.view),n=ft(r.layers,e.view.map);s.layersAndFieldsRegistry=n,s.embeddingsWorker=await qe(r)}return e.agents?.forEach(r=>{s.agentRegistry.register(r)}),s.orchestratorReady=!0,s}catch(r){throw console.error("Orchestrator initialization failed:",r),r}}async*ask(e,s={}){if(!this.orchestratorReady)throw new Error("Orchestrator is not ready yet.");if(!this.agentRegistry.list().length)throw new Error("Orchestrator has no registered agents.");let r=this.createRequestAgentRegistry(s);if(!r.list().length)throw new Error("Orchestrator has no agents selected for this request.");if(++this.streamEpoch,!e.trim()&&!s.inputParts?.length)return;if(!e.trim()&&s.routing!=="direct")throw new Error("Requests containing only structured input require direct agent routing.");let n=q();this.parentRunIds.clear(),this.activeRuntimeSpans.clear(),this.activeRunId=n,this.activeAbortController=new AbortController,this.graph||(this.graph=ot().compile({checkpointer:new ie}));let i=this.embeddingsWorker?ht({worker:this.embeddingsWorker}):void 0,c=this.embeddingsWorker?mt({worker:this.embeddingsWorker}):void 0,a=new Map,d=s.routing==="direct"?{mode:"direct",agentId:s.agentId}:{mode:"auto"},o={thread_id:n,locale:s.locale??"en",hitlResponse:null,services:{layerSearch:i,fieldSearch:c,layersAndFieldsRegistry:this.layersAndFieldsRegistry,agentRegistry:r,embeddingCache:a}},l={version:"v2",streamMode:"custom",signal:this.activeAbortController.signal,...this.runtimeEventsEnabled&&{callbacks:[this.createHierarchyCallback()]},configurable:o,subgraphs:!0},g=this.graph?.streamEvents({routing:d,agentExecutionContext:{userRequest:e,inputParts:[...s.inputParts??[]],messages:this.chatHistory,priorSteps:this.priorSteps,sharedState:this.sharedState,sharedResources:this.sharedResources}},l),u=++this.streamEpoch;if(yield*this.pipeStream(g,u,n),this.isRunCancelled(n)){yield*this.createCancellationEvents(n);return}for(;;){if(this.isRunCancelled(n)){yield*this.createCancellationEvents(n);return}let m=(await this.graph.getState(l,{subgraphs:!0})).tasks.find(f=>f.interrupts.length>0)?.interrupts[0]?.value;if(!m)break;this.currentInterrupt=m,this.interruptHandler=new W(this.graph,l),yield*this.closeActiveRuntimeSpans(n,"interrupted"),yield{runId:n,timestamp:Date.now(),type:"interrupt",interrupt:m};try{let f=await this.interruptHandler.waitForUser(),E=++this.streamEpoch;yield*this.pipeStream(f,E,n)}catch(f){if(this.isRunCancelled(n)){yield*this.createCancellationEvents(n);return}if(f){yield{runId:n,timestamp:Date.now(),type:"error",error:{message:f?.message}};return}}}if(this.isRunCancelled(n)){yield*this.createCancellationEvents(n);return}let h=(await this.graph.getState(l,{subgraphs:!0})).values;if(this.isRunCancelled(n)){yield*this.createCancellationEvents(n);return}this.chatHistory=h.agentExecutionContext.messages.length?h.agentExecutionContext.messages:this.chatHistory,this.priorSteps=h.agentExecutionContext.priorSteps?.slice(-5)??[],this.sharedState=h.agentExecutionContext.sharedState??{},this.sharedResources=h.agentExecutionContext.sharedResources??[],yield{runId:n,timestamp:Date.now(),type:"completed",result:{content:h.finalOutputMessage}}}newConversation(){this.chatHistory=[],this.priorSteps=[],this.sharedState={},this.sharedResources=[]}resumeInterrupt(e){if(!this.currentInterrupt||!this.interruptHandler)throw new Error("No pending interrupt to resume.");this.interruptHandler.handle(this.currentInterrupt,e)}cancelInterrupt(){this.interruptHandler&&this.interruptHandler.cancel()}cancel(){this.activeRunId&&(this.cancelledRunIds.add(this.activeRunId),this.activeAbortController?.abort(),++this.streamEpoch,this.interruptHandler?.cancel())}async*pipeStream(e,s,r){try{for await(let n of e){if(this.isRunCancelled(r)||s!==this.streamEpoch)break;if(this.runtimeEventsEnabled){let i=ut({event:n,runId:r,parentSpanId:this.parentRunIds.get(n.run_id),timestamp:Date.now()});i&&(i.phase==="started"?this.activeRuntimeSpans.set(i.span.id,i):this.activeRuntimeSpans.delete(i.span.id),yield i)}n.event==="on_custom_event"&&n.name==="trace_message"?yield{runId:r,timestamp:Date.now(),type:"trace",data:n.data}:n.name==="graph_ux_suggestion"&&(yield{runId:r,timestamp:Date.now(),type:"ux-suggestion",suggestion:n.data})}}catch(n){if(!this.isRunCancelled(r))throw n}}*createCancellationEvents(e){yield*this.closeActiveRuntimeSpans(e,"cancelled"),yield{runId:e,timestamp:Date.now(),type:"cancelled",reason:"user"}}*closeActiveRuntimeSpans(e,s){let r=Date.now(),n=[...this.activeRuntimeSpans.values()].reverse();this.activeRuntimeSpans.clear();for(let i of n){let{input:c,...a}=i.span;yield{type:"runtime",phase:s,runId:e,timestamp:r,...i.agentId&&{agentId:i.agentId},span:a}}}createHierarchyCallback(){let e=(s,r)=>{r&&this.parentRunIds.set(s,r)};return re.fromMethods({handleLLMStart:(s,r,n,i)=>e(n,i),handleChatModelStart:(s,r,n,i)=>e(n,i),handleChainStart:(s,r,n,i)=>e(n,i),handleToolStart:(s,r,n,i)=>e(n,i),handleRetrieverStart:(s,r,n,i)=>e(n,i)})}isRunCancelled(e){return this.cancelledRunIds.has(e)}createRequestAgentRegistry(e){let s=e.routing==="direct"?[e.agentId]:e.agentIds,r=s?s.map(i=>{let c=this.agentRegistry.get(i);if(!c)throw new Error(`Agent is not registered: ${i}`);return c}):this.agentRegistry.list(),n=new T;return r.forEach(i=>n.register(i)),n}dispose(){this.sharedResources=[],this.embeddingsWorker&&(this.embeddingsWorker.terminate(),this.embeddingsWorker=void 0),this.orchestratorReady=!1}};var St=B`: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)}`;function H(t){return t.trim()?U.lexer(t).filter(e=>e.type!=="space").map(e=>U.parser([e])):[]}var L=class{constructor(){this._stableParts=[],this._stableText="",this._rawText=""}push(e){return this._rawText+=e,this._advanceStableBoundary(),this.getParts()}finalize(){let e=this._rawText.slice(this._stableText.length);return e.trim()&&(this._stableParts.push(...H(e)),this._stableText=this._rawText),this._stableParts}getParts(){let e=this._trimIncompleteTail(this._rawText.slice(this._stableText.length)),s=e.trim()?H(e):[];return[...this._stableParts,...s]}reset(){this._stableParts=[],this._stableText="",this._rawText=""}_advanceStableBoundary(){let e=this._rawText.slice(this._stableText.length),s=this._lastSafeBoundary(e);if(s<=0)return;let r=e.slice(0,s);this._stableParts.push(...H(r)),this._stableText+=r}_lastSafeBoundary(e){let s=e.split(`
|
|
8
|
+
`),r=!1,n=0,i=0;for(let c of s)/^\s*(```|~~~)/u.test(c)&&(r=!r),i+=c.length+1,c.trim()===""&&!r&&(n=i);return n<e.length?n:0}_trimIncompleteTail(e){let s=e.lastIndexOf("<");if(s!==-1&&!e.includes(">",s))return e.slice(0,s);let r=this._earliestUnclosedTag(e);if(r!==-1)return e.slice(0,r);let n=e.lastIndexOf("[");if(n!==-1){let i=e.slice(n);if(!/\[[^\]]*\]\([^)]*\)/u.test(i))return e.slice(0,n)}return e}_earliestUnclosedTag(e){let s=new Set(["br","img","hr","input","meta","link","area","base","col","embed","source","track","wbr"]),r=/<(\/?)([a-zA-Z][\w-]*)\b[^>]*?(\/?)>/gu,n=[];for(let i=r.exec(e);i;i=r.exec(e)){let[,c,a,d]=i,o=a.toLowerCase();if(!(s.has(o)||d==="/"))if(c==="/"){for(let l=n.length-1;l>=0;l--)if(n[l].name===o){n.splice(l);break}}else n.push({name:o,index:i.index})}return n.length?n[0].index:-1}};function Ct(t){let e=new L;return e.push(t),e.finalize()}var At=async t=>await new Promise(e=>setTimeout(e,t));async function*$t(t,{chunkSize:e=15,delay:s=50}={}){let r=new L;for(let n=0;n<t.length;n+=e)yield r.push(t.slice(n,n+e)),await At(s);yield r.finalize()}var Pt=Object.defineProperty,Mt=Object.getOwnPropertyDescriptor,_=(t,e,s,r)=>{for(var n=r>1?void 0:r?Mt(e,s):e,i=t.length-1,c;i>=0;i--)(c=t[i])&&(n=(r?c(e,s,n):c(n))||n);return r&&n&&Pt(e,s,n),n},xe=t=>!t||typeof t!="object"?!1:t.name==="AbortError";async function*Ie(t,e,s,r,n=!1){if(n){if(r?.aborted){yield{type:"cancelled",log:s,runId:e};return}yield{type:"block-data",blockType:"text",data:{parts:Ct(t)},runId:e};return}for await(let i of $t(t)){if(r?.aborted){yield{type:"cancelled",log:s,runId:e};return}yield{type:"block-data",blockType:"text",data:{parts:i},runId:e}}}var v=class extends It{constructor(t){super(t),this.view=null,this.streamingDisabled=!1,this.runtimeEventsEnabled=!1,this.loading=!1,this.processing=!1,this.processingStep=""}async load(){this._set("loading",!0);try{await this._initialize()}finally{this._set("loading",!1)}}destroy(){this.orchestrator?.dispose(),super.destroy()}async _initialize(){this.removeHandles(),await Promise.all([this.portal.load(),this.view?.when()]),this.view&&await Et(()=>!this.view.updating),this._set("orchestrator",await D.init({agents:[...this.agents],runtimeEventsEnabled:this.runtimeEventsEnabled,view:this.view??void 0})),this.addHandles([_t(()=>[this.view,this.agents],()=>{this._initialize()})])}clearChatHistory(){this.orchestrator?.newConversation()}async*ask(t,e,s){if(!this.orchestrator)throw new Error("Orchestrator not initialized yet.");this._set("processing",!0),this._set("processingStep","");let r=[],n,i="pending";try{let c=this.orchestrator.ask(t,e);for await(let a of c)switch(i=a.runId,a.type){case"runtime":{yield{type:"runtime",event:a,runId:i};break}case"trace":{this._set("processingStep",a.data.text),r.push(a.data.text);break}case"completed":{this._set("processing",!1),this._set("processingStep","");let d=a.result,o=!!d.content.length,l=!!n?.length;if(!o&&!l){yield{type:"completed",error:"No response received.",log:r,runId:i};return}let g=d.content;if(yield{type:"block-start",blockType:"text",runId:i},yield*Ie(g,i,r,s,this.streamingDisabled),yield{type:"block-end",blockType:"text",runId:i},l)for(let u of n){if(s?.aborted){yield{type:"cancelled",log:r,runId:i};return}let{type:h,data:m}=u;if(yield{type:"block-start",blockType:h,runId:i},h==="text"){let f=typeof m?.content=="string"?m.content:"";yield*Ie(f,i,r,s,this.streamingDisabled)}else yield{type:"block-data",blockType:h,data:m,runId:i};yield{type:"block-end",blockType:h,runId:i}}yield{type:"completed",response:g,blocks:n,log:r,runId:i};return}case"ux-suggestion":{let d=a.suggestion;n=n?[...n,d]:[d];break}case"interrupt":{let{kind:d,message:o,metadata:l,showOtherOption:g}=a.interrupt,u=Array.isArray(l)?l.filter(m=>typeof m=="string"):[],h=(()=>{switch(d){case"booleanChoice":return{type:"boolean-choice",message:o,options:u};case"singleSelection":return{type:"single-select",message:o,options:u};case"multipleSelection":return{type:"multi-select",message:o,options:u};case"textInput":return{type:"text-input",message:o};default:return{type:d,message:o,options:u}}})();this._set("processingStep","Waiting for user input..."),yield{type:"interrupt",payload:{...h,showOtherOption:g},runId:i};break}case"cancelled":{yield{type:"cancelled",log:r,runId:i};return}case"error":{if(s?.aborted||xe(a.error)){yield{type:"cancelled",log:r,runId:i};return}yield{type:"completed",error:a.error.message,log:r,runId:i};return}default:{console.warn("Unknown event type:",a);break}}}catch(c){if(s?.aborted||xe(c)){yield{type:"cancelled",log:r,runId:i};return}console.warn("Error during message processing:",c),yield{type:"completed",error:this.messages.messageProcessingErrorMessage,log:r,runId:"error"};return}finally{this._set("processing",!1)}}cancel(){this.orchestrator?.cancel()}};_([k({readOnly:!0})],v.prototype,"orchestrator",2);_([k()],v.prototype,"agents",2);_([k()],v.prototype,"portal",2);_([k()],v.prototype,"view",2);_([k()],v.prototype,"messages",2);_([k()],v.prototype,"streamingDisabled",2);_([k()],v.prototype,"runtimeEventsEnabled",2);_([k({readOnly:!0})],v.prototype,"loading",2);_([k({readOnly:!0})],v.prototype,"processing",2);_([k({readOnly:!0})],v.prototype,"processingStep",2);v=_([Rt("OrchestratorController")],v);var Tt="Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.",Dt="Embeddings not found for this web map.",Lt="https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings",z=class extends Q{constructor(){super(...arguments),this._messages=Z({blocking:!0}),this.#e=P(),this.#o=P(),this.#r=P(),this.#t=null,this.#n=new Map,this.#s=xt.getDefault(),this.#i=e=>{e.stopPropagation(),this.cancelInterrupt()},this.#a=e=>{e.stopPropagation();let s=e.detail;this.submitInterrupt(s)},this.#l=e=>{if(e.stopPropagation(),e.defaultPrevented)return;let s=e.detail,r=typeof s=="string"?s:s.prompt,n=typeof s=="string"?void 0:{displayText:s.displayText,parts:s.parts};if(!this.#y(r,n?.parts??[])){e.preventDefault();return}if(this.arcgisSubmit.emit(s).defaultPrevented){e.preventDefault();return}this.keepSuggestedPrompts||(this.suggestedPrompts=[]),this._inputValue="",this.submitMessage(r,n)},this.#c=e=>{if(this._canceling=!0,e.stopPropagation(),this.arcgisCancel.emit(),this._interrupt){this.orchestrator?.cancelInterrupt(),this._interrupt=null;return}this._orchestratorController?.cancel(),this.#t?.abort(),this.#t=null},this.#d=e=>{e.stopPropagation();let s=e.detail;this.arcgisFeedback.emit(s)},this.#u=e=>{e.stopPropagation();let s=e.detail;this._inputValue=s.prompt,this.arcgisPromptSelect.emit(s)},this.#p=e=>{this.arcgisSlottableRequest.emit(e.detail)},this._orchestratorController=null,this._interrupt=null,this._interruptDetails=[],this._error=null,this._submissionError=null,this._inputValue="",this._isAnswering=!1,this._canceling=!1,this.messages=new vt([]),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=w(),this.arcgisError=w(),this.arcgisFeedback=w(),this.arcgisInterrupt=w(),this.arcgisInterruptCancel=w(),this.arcgisInterruptSubmit=w(),this.arcgisPromptSelect=w(),this.arcgisReady=w(),this.arcgisResponse=w(),this.arcgisRuntime=w({bubbles:!1,composed:!1}),this.arcgisSlottableRequest=w({bubbles:!1,composed:!1}),this.arcgisSubmit=w({cancelable:!0})}static{this.properties={_orchestratorController:16,_interrupt:16,_interruptDetails:16,_error:16,_submissionError: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:[1,{type:Array}],commandProvider:0,entityProviders:0,suggestedPrompts:[1,{type:Array}],feedbackEnabled:5,keepSuggestedPrompts:5,streamingDisabled:5,runtimeEventsEnabled:5,logEnabled:5,copyEnabled:5,voiceInputEnabled:5,readAloudEnabled:5,assistantAvatarEnabled:5,userAvatarEnabled:5}}static{this.styles=St}#e;#o;#r;#t;#n;#s;#i;#a;#l;#c;#d;#u;#p;get _isSignedIn(){return!!this.#s?.user||!!this._signedInUserId}get _user(){return this.#s?.user?.fullName||this.#s?.user?.username}get awaitingResponse(){return this._orchestratorController?.processing??!1}get awaitingResponseStep(){return this._orchestratorController?.processingStep??""}get interrupt(){return this._interrupt}get orchestrator(){return this._orchestratorController?.orchestrator}cancelInterrupt(){this.arcgisInterruptCancel.emit(),this.orchestrator?.cancelInterrupt(),this._interrupt=null}async clearChatHistory(){this._reset(),this._orchestratorController?.clearChatHistory()}register(e){this.#n.set(e.agent.id,e),this._orchestratorController&&this.#g()}submitInterrupt(e){this.arcgisInterruptSubmit.emit(e),this._interrupt&&(this._interruptDetails=[...this._interruptDetails,{interrupt:this._interrupt,response:e}]),this.orchestrator?.resumeInterrupt(e),this._interrupt=null}async submitMessage(e,s){let r=e.trim(),n=s?.parts??[];if(!r&&!n.length||!this.#y(r,n)||(this.messages.push({id:Date.now().toString(),role:"user",content:s?.displayText?.trim()||r||n.map(o=>this.#f(o)).join(" "),parts:n}),!this._orchestratorController))return;this.#t=new AbortController,this._orchestratorController.streamingDisabled=this.streamingDisabled;let i=this.#m(n),c=this._messages._t9nLocale||"en",a={...s?.parts?{inputParts:s.parts}:{},...i?{routing:"direct",agentId:i}:{routing:"auto",agentIds:this.allowedAgentIds},locale:c},d=this._orchestratorController.ask(r,a,this.#t?.signal);for await(let o of d){let l=o.runId,g=this.messages.at(-1);switch(o.type){case"runtime":this.arcgisRuntime.emit(o.event);break;case"block-start":{this._isAnswering=!0;let u={type:o.blockType,isPending:!0};if(g?.role==="assistant"&&g.id===l){let h=[...g.blocks??[],u];this.messages.splice(-1,1,{...g,blocks:h})}else this.messages.push({role:"assistant",blocks:[u],id:l,isStreaming:!0,interrupts:this._interruptDetails}),this._interruptDetails=[];break}case"block-data":{if(g?.role!=="assistant"||g?.id!==l)break;let u=[...g.blocks??[]],h=u[u.length-1],{blockType:m,data:f}=o;if(h?.type!==m||!h.isPending)break;m==="text"?u[u.length-1]={...h,data:{...h.data,parts:f?.parts}}:u[u.length-1]={...h,data:{...h.data,...f??{}}},this.messages.splice(-1,1,{...g,blocks:u});break}case"block-end":{if(g?.role!=="assistant"||g?.id!==l)break;let u=[...g.blocks??[]],h=u[u.length-1];if(h?.type!==o.blockType||!h.isPending)break;let m=h;u[u.length-1]={...m,data:{...m.data},isPending:!1},this.messages.splice(-1,1,{...g,blocks:u});break}case"completed":o.error?(this.messages.push({role:"assistant",log:o.log,error:o.error,id:l,interrupts:this._interruptDetails}),this._interruptDetails=[]):g?.role==="assistant"&&g.id===l&&this.messages.splice(-1,1,{...g,content:o.response,blocks:g.blocks?.map(u=>({...u,data:{...u.data},isPending:!1}))??[],isStreaming:!1,log:o.log}),this._isAnswering=!1,this.#t=null,this._canceling=!1;break;case"interrupt":this._interrupt={...o.payload,id:l},this.arcgisInterrupt.emit(this._interrupt);break;case"cancelled":g?.role==="assistant"&&g.id===l?this.messages.splice(-1,1,{...g,blocks:g.blocks?.filter(u=>u.type==="text"||!u.isPending)??[],isStreaming:!1,log:o.log,error:`(${this._messages.stoppedByUserLabel})`}):(this.messages.push({role:"assistant",log:o.log,error:`(${this._messages.stoppedByUserLabel})`,id:l,interrupts:this._interruptDetails}),this._interruptDetails=[]),this._isAnswering=!1,this.#t=null,this._canceling=!1;break}}}unregister(e){this.#n.delete(e),this._orchestratorController&&this.#g()}load(){this.manager.onLifecycle(this._reset.bind(this))}loaded(){this.manager.onLifecycle(()=>{this.#e.value?.addEventListener("arcgisPromptSelect",this.#u),this.#e.value?.addEventListener("arcgisSubmit",this.#l),this.#e.value?.addEventListener("arcgisCancel",this.#c),this.#e.value?.addEventListener("arcgisFeedback",this.#d);let e=kt(()=>!!this._interrupt&&!!this.#r.value,()=>{let r=this.#r.value;r.removeEventListener("arcgisSubmit",this.#a),r.removeEventListener("arcgisCancel",this.#i),r.addEventListener("arcgisSubmit",this.#a,{once:!0}),r.addEventListener("arcgisCancel",this.#i,{once:!0})}),s=this.messages.on("after-add",r=>{let n=r.item;n.role==="assistant"&&(n.error||n.content)&&this.arcgisResponse.emit(n)});return queueMicrotask(()=>{this.#h()}),()=>{e.remove(),s.remove(),this.#e.value?.removeEventListener("arcgisPromptSelect",this.#u),this.#r.value?.removeEventListener("arcgisSubmit",this.#a),this.#r.value?.removeEventListener("arcgisCancel",this.#i),this.#e.value?.removeEventListener("arcgisSubmit",this.#l),this.#e.value?.removeEventListener("arcgisCancel",this.#c),this.#e.value?.removeEventListener("arcgisFeedback",this.#d),this._orchestratorController?.destroy(),this._orchestratorController=null}})}willUpdate(e){this.hasUpdated&&e.has("runtimeEventsEnabled")&&this._orchestratorController&&(this._orchestratorController.destroy(),this._orchestratorController=null,this.#h())}#f(e){return e.kind==="command"?`/${e.id}`:`${e.trigger}${e.id}`}#m(e){for(let s of e)if(s.kind==="command"&&s.agentId)return s.agentId;return this.alwaysUseAgentId}#y(e,s){let r=s.filter(n=>n.kind==="command").length>1;return this._submissionError=r?this._messages.multipleCommands:!e.trim()&&s.length>0&&!this.#m(s)?this._messages.partsOnlyRequiresAgent:null,this._submissionError?(this.arcgisError.emit(new Error(this._submissionError)),!1):!0}async#b(){await ke.checkSignInStatus(this.#s.url);let e=await this.#s.load();if(!e.helperServices?.aiAssistantServices?.url)throw new Error(this._messages.serviceUrlNotAvailableMessage);let s=!1,r=await e.fetchSettings();if(r.aiConfig?s=r.aiConfig.aiForOrg?.enabled===!0&&r.aiConfig.aiForOrg?.aiCapabilities?.aiAgents?.enabled===!0:s=r.aiAssistantsEnabled===!0,!s)throw new Error(this._messages.aiAssistantsNotEnabledMessage);if(!e.isPortal&&e?.user?.privileges?.includes("portal:user:useAIAssistants")!==!0)throw new Error(this._messages.userPrivilegesNotSufficientMessage)}async#g(){try{this._error=null;let e=pe(this.el,this.referenceElement);await e?.componentOnReady();let s=[...this.#n.values()];return s.length?(await this.#b(),this._orchestratorController?.destroy(),this._orchestratorController=new v({agents:s,portal:this.#s,runtimeEventsEnabled:this.runtimeEventsEnabled,streamingDisabled:this.streamingDisabled,view:e?.view,messages:this._messages}),await this._orchestratorController.load(),this.requestUpdate(),!0):(this._error=this._messages.noAgentsFoundMessage,!1)}catch(e){return this._error=e?.message??this._messages.orchestratorInitializationErrorMessage,G(this)(e),!1}}async#h(){await this.#g()?this.arcgisReady.emit():this._error&&this.arcgisError.emit(new Error(this._error))}_reset(){this._orchestratorController?.cancel(),this.#t?.abort(),this._interrupt=null,this.messages.removeAll(),this._error=null,this._submissionError=null,this._inputValue="",this._signedInUserId=void 0}_renderEntryMessage(){return this._isSignedIn?this._error?this._renderErrorNotice():this.entryMessage?this.messages.length>0?null:y`<calcite-notice open kind=brand closable icon width=full><div slot=message>${this.entryMessage}</div></calcite-notice>`:y`<slot name=entry-message></slot>`:this._renderSignInNotice()}_renderSignInNotice(){let e=this.#s;return y`<calcite-notice slot=entry-message open kind=brand icon width=full><div slot=message>${this._messages.signInRequiredMessage}</div>${e?y`<calcite-link slot=link @click=${async()=>{try{let s=await ke.getCredential(`${e.url}/sharing`);this._signedInUserId=s.userId,this._error=null,this.requestUpdate(),await this.#h()}catch(s){this._error=s?.message??this._messages.signInErrorMessage,this.arcgisError.emit(new Error(this._error)),V("error",this,"Error signing in:",{detail:{error:s}})}}} target=_blank title=${this._messages.signInToArcGISOnlineLabel??C}>${this._messages.signInLabel}</calcite-link>`:y`<div slot=link>${this._messages.noPortalInformationMessage}</div>`}</calcite-notice>`}_renderErrorNotice(){return this._error?y`<calcite-notice slot=entry-message open kind=brand icon width=full>${this._error===Tt?y`<div slot=message>${Dt}</div><calcite-link slot=link .href=${Lt} target=_blank title=${this._messages.learnAboutWebMapEmbeddingsLabel??C}>${this._messages.readMoreLabel}</calcite-link>`:y`<div slot=message>${this._error}</div>`}</calcite-notice>`:null}render(){return y`<calcite-panel .loading=${!this._orchestratorController&&!this._error||this._orchestratorController?.loading} .heading=${this.heading??this._messages.assistantLabel} .description=${this.description} ${M(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"?y`<arcgis-assistant-message .message=${e} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled} @arcgisSlottableRequest=${this.#p} .assistantAvatarEnabled=${this.assistantAvatarEnabled}>${e.blocks?.map((s,r)=>y`<slot name=${j(e.id,r)??C} slot=${j(e.id,r)??C}><arcgis-assistant-message-block .block=${s}></arcgis-assistant-message-block></slot>`)}</arcgis-assistant-message>`:y`<arcgis-assistant-user-message .message=${e} .user=${this._user} .userAvatarEnabled=${this.userAvatarEnabled}></arcgis-assistant-user-message>`)}</slot>${this._interrupt?y`<div slot=message-loading><div class="interrupt-waiting-message">${this._messages.waitingForUserInputMessage}</div></div>`:y`<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?y`<slot name=interrupt><arcgis-assistant-interrupt slot=content-bottom .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} .showOtherOption=${this._interrupt.showOtherOption??!1} ${M(this.#r)}></arcgis-assistant-interrupt></slot>`:this.suggestedPrompts?.length?y`<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()}${this._submissionError?y`<div role=alert>${this._submissionError}</div>`:null}<slot name=chat-entry><arcgis-assistant-chat-entry .awaitingResponse=${this.awaitingResponse||this._isAnswering} .commandProvider=${this.commandProvider} .entityProviders=${this.entityProviders} .inputValue=${this._inputValue} .messages=${this.messages} .voiceInputEnabled=${this.voiceInputEnabled} .disabled=${this._canceling||!this._isSignedIn||!!this._interrupt||!!this._error} ${M(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=${()=>{this.#o.value?.submitMessage()}} 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>`}};J("arcgis-assistant",z);return z},"core/Collection","core/reactiveUtils","portal/Portal","identity/IdentityManager","portal/Portal","core/reactiveUtils","layers/FeatureLayer","request","core/Accessor","core/accessorSupport/decorators","identity/IdentityManager",a)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
2
|
var g=Object.create;var e=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(b,a)=>()=>{try{return a||b((a={exports:{}}).exports,a),a.exports}catch(c){throw a=0,c}},n=(b,a)=>{for(var c in a)e(b,c,{get:a[c],enumerable:!0})},l=(b,a,c,f)=>{if(a&&typeof a=="object"||typeof a=="function")for(let d of i(a))!k.call(b,d)&&d!==c&&e(b,d,{get:()=>a[d],enumerable:!(f=h(a,d))||f.enumerable});return b};var o=(b,a,c)=>(c=b!=null?g(j(b)):{},l(a||!b||!b.__esModule?e(c,"default",{value:b,enumerable:!0}):c,b));export{m as a,n as b,o as c};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
2
|
-
import{da as F,ea as be,ra as Pe,sa as ve,ta as Te}from"./
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
+
import{da as F,ea as be,ra as Pe,sa as ve,ta as Te}from"./A4ZVCRVF.js";import{Ba as H,J as G,R as ge,a as he,fa as de,ja as X,ra as ye,s as W,wa as we}from"./272R36XK.js";var w=class extends F{lc_serializable=!0;lc_namespace=["langchain_core","prompts",this._getPromptType()];get lc_attributes(){return{partialVariables:void 0}}inputVariables;outputParser;partialVariables;metadata;tags;constructor(s){super(s);let{inputVariables:e}=s;if(e.includes("stop"))throw new Error("Cannot have an input variable named 'stop', as it is used internally, please rename.");Object.assign(this,s)}async mergePartialAndUserVariables(s){let e=this.partialVariables??{},t={};for(let[r,a]of Object.entries(e))typeof a=="string"?t[r]=a:t[r]=await a();return{...t,...s}}async invoke(s,e){let t={...this.metadata,...e?.metadata},r=[...this.tags??[],...e?.tags??[]];return this._callWithConfig(a=>this.formatPromptValue(a),s,{...e,tags:r,metadata:t,runType:"prompt"})}};var v=class extends w{async formatPromptValue(s){return new Pe(await this.format(s))}};var Oe=Object.prototype.toString,C=Array.isArray||function(e){return Oe.call(e)==="[object Array]"};function Z(s){return typeof s=="function"}function ke(s){return C(s)?"array":typeof s}function Y(s){return s.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function xe(s,e){return s!=null&&typeof s=="object"&&e in s}function Be(s,e){return s!=null&&typeof s!="object"&&s.hasOwnProperty&&s.hasOwnProperty(e)}var Ue=RegExp.prototype.test;function Ne(s,e){return Ue.call(s,e)}var De=/\S/;function $e(s){return!Ne(De,s)}var ze={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function We(s){return String(s).replace(/[&<>"'`=\/]/g,function(t){return ze[t]})}var Ge=/\s*/,He=/\s+/,_e=/\s*=/,qe=/\s*\}/,Le=/#|\^|\/|>|\{|&|=|!/;function Je(s,e){if(!s)return[];var t=!1,r=[],a=[],i=[],n=!1,o=!1,l="",p=0;function f(){if(n&&!o)for(;i.length;)delete a[i.pop()];else i=[];n=!1,o=!1}var b,_,ue;function fe(P){if(typeof P=="string"&&(P=P.split(He,2)),!C(P)||P.length!==2)throw new Error("Invalid tags: "+P);b=new RegExp(Y(P[0])+"\\s*"),_=new RegExp("\\s*"+Y(P[1])),ue=new RegExp("\\s*"+Y("}"+P[1]))}fe(e||d.tags);for(var m=new k(s),x,h,g,R,z,V;!m.eos();){if(x=m.pos,g=m.scanUntil(b),g)for(var Q=0,Re=g.length;Q<Re;++Q)R=g.charAt(Q),$e(R)?(i.push(a.length),l+=R):(o=!0,t=!0,l+=" "),a.push(["text",R,x,x+1]),x+=1,R===`
|
|
3
3
|
`&&(f(),l="",p=0,t=!1);if(!m.scan(b))break;if(n=!0,h=m.scan(Le)||"name",m.scan(Ge),h==="="?(g=m.scanUntil(_e),m.scan(_e),m.scanUntil(_)):h==="{"?(g=m.scanUntil(ue),m.scan(qe),m.scanUntil(_),h="&"):g=m.scanUntil(_),!m.scan(_))throw new Error("Unclosed tag at "+m.pos);if(h==">"?z=[h,g,x,m.pos,l,p,t]:z=[h,g,x,m.pos],p++,a.push(z),h==="#"||h==="^")r.push(z);else if(h==="/"){if(V=r.pop(),!V)throw new Error('Unopened section "'+g+'" at '+x);if(V[1]!==g)throw new Error('Unclosed section "'+V[1]+'" at '+x)}else h==="name"||h==="{"||h==="&"?o=!0:h==="="&&fe(g)}if(f(),V=r.pop(),V)throw new Error('Unclosed section "'+V[1]+'" at '+m.pos);return Qe(Ke(a))}function Ke(s){for(var e=[],t,r,a=0,i=s.length;a<i;++a)t=s[a],t&&(t[0]==="text"&&r&&r[0]==="text"?(r[1]+=t[1],r[3]=t[3]):(e.push(t),r=t));return e}function Qe(s){for(var e=[],t=e,r=[],a,i,n=0,o=s.length;n<o;++n)switch(a=s[n],a[0]){case"#":case"^":t.push(a),r.push(a),t=a[4]=[];break;case"/":i=r.pop(),i[5]=a[2],t=r.length>0?r[r.length-1][4]:e;break;default:t.push(a)}return e}function k(s){this.string=s,this.tail=s,this.pos=0}k.prototype.eos=function(){return this.tail===""};k.prototype.scan=function(e){var t=this.tail.match(e);if(!t||t.index!==0)return"";var r=t[0];return this.tail=this.tail.substring(r.length),this.pos+=r.length,r};k.prototype.scanUntil=function(e){var t=this.tail.search(e),r;switch(t){case-1:r=this.tail,this.tail="";break;case 0:r="";break;default:r=this.tail.substring(0,t),this.tail=this.tail.substring(t)}return this.pos+=r.length,r};function E(s,e){this.view=s,this.cache={".":this.view},this.parent=e}E.prototype.push=function(e){return new E(e,this)};E.prototype.lookup=function(e){var t=this.cache,r;if(t.hasOwnProperty(e))r=t[e];else{for(var a=this,i,n,o,l=!1;a;){if(e.indexOf(".")>0)for(i=a.view,n=e.split("."),o=0;i!=null&&o<n.length;)o===n.length-1&&(l=xe(i,n[o])||Be(i,n[o])),i=i[n[o++]];else i=a.view[e],l=xe(a.view,e);if(l){r=i;break}a=a.parent}t[e]=r}return Z(r)&&(r=r.call(this.view)),r};function u(){this.templateCache={_cache:{},set:function(e,t){this._cache[e]=t},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}u.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};u.prototype.parse=function(e,t){var r=this.templateCache,a=e+":"+(t||d.tags).join(":"),i=typeof r<"u",n=i?r.get(a):void 0;return n==null&&(n=Je(e,t),i&&r.set(a,n)),n};u.prototype.render=function(e,t,r,a){var i=this.getConfigTags(a),n=this.parse(e,i),o=t instanceof E?t:new E(t,void 0);return this.renderTokens(n,o,r,e,a)};u.prototype.renderTokens=function(e,t,r,a,i){for(var n="",o,l,p,f=0,b=e.length;f<b;++f)p=void 0,o=e[f],l=o[0],l==="#"?p=this.renderSection(o,t,r,a,i):l==="^"?p=this.renderInverted(o,t,r,a,i):l===">"?p=this.renderPartial(o,t,r,i):l==="&"?p=this.unescapedValue(o,t):l==="name"?p=this.escapedValue(o,t,i):l==="text"&&(p=this.rawValue(o)),p!==void 0&&(n+=p);return n};u.prototype.renderSection=function(e,t,r,a,i){var n=this,o="",l=t.lookup(e[1]);function p(_){return n.render(_,t,r,i)}if(l){if(C(l))for(var f=0,b=l.length;f<b;++f)o+=this.renderTokens(e[4],t.push(l[f]),r,a,i);else if(typeof l=="object"||typeof l=="string"||typeof l=="number")o+=this.renderTokens(e[4],t.push(l),r,a,i);else if(Z(l)){if(typeof a!="string")throw new Error("Cannot use higher-order sections without the original template");l=l.call(t.view,a.slice(e[3],e[5]),p),l!=null&&(o+=l)}else o+=this.renderTokens(e[4],t,r,a,i);return o}};u.prototype.renderInverted=function(e,t,r,a,i){var n=t.lookup(e[1]);if(!n||C(n)&&n.length===0)return this.renderTokens(e[4],t,r,a,i)};u.prototype.indentPartial=function(e,t,r){for(var a=t.replace(/[^ \t]/g,""),i=e.split(`
|
|
4
4
|
`),n=0;n<i.length;n++)i[n].length&&(n>0||!r)&&(i[n]=a+i[n]);return i.join(`
|
|
5
5
|
`)};u.prototype.renderPartial=function(e,t,r,a){if(r){var i=this.getConfigTags(a),n=Z(r)?r(e[1]):r[e[1]];if(n!=null){var o=e[6],l=e[5],p=e[4],f=n;l==0&&p&&(f=this.indentPartial(n,p,o));var b=this.parse(f,i);return this.renderTokens(b,t,r,f,a)}}};u.prototype.unescapedValue=function(e,t){var r=t.lookup(e[1]);if(r!=null)return r};u.prototype.escapedValue=function(e,t,r){var a=this.getConfigEscape(r)||d.escape,i=t.lookup(e[1]);if(i!=null)return typeof i=="number"&&a===d.escape?String(i):a(i)};u.prototype.rawValue=function(e){return e[1]};u.prototype.getConfigTags=function(e){return C(e)?e:e&&typeof e=="object"?e.tags:void 0};u.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!C(e))return e.escape};var d={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(s){O.templateCache=s},get templateCache(){return O.templateCache}},O=new u;d.clearCache=function(){return O.clearCache()};d.parse=function(e,t){return O.parse(e,t)};d.render=function(e,t,r,a){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+ke(e)+'" was given as the first argument for mustache#render(template, view, partials)');return O.render(e,t,r,a)};d.escape=We;d.Scanner=k;d.Context=E;d.Writer=u;var ee=d;var Xe={escape:s=>s},M=s=>{let e=s.split(""),t=[],r=(i,n)=>{for(let o=n;o<e.length;o+=1)if(i.includes(e[o]))return o;return-1},a=0;for(;a<e.length;)if(e[a]==="{"&&a+1<e.length&&e[a+1]==="{")t.push({type:"literal",text:"{"}),a+=2;else if(e[a]==="}"&&a+1<e.length&&e[a+1]==="}")t.push({type:"literal",text:"}"}),a+=2;else if(e[a]==="{"){let i=r("}",a);if(i<0)throw new Error("Unclosed '{' in template.");t.push({type:"variable",name:e.slice(a+1,i).join("")}),a=i+1}else{if(e[a]==="}")throw new Error("Single '}' in template.");{let i=r("{}",a),n=(i<0?e.slice(a):e.slice(a,i)).join("");t.push({type:"literal",text:n}),a=i<0?e.length:i}}return t},Ve=(s,e=[])=>{let t=[];for(let r of s)if(r[0]==="name"){let a=r[1].includes(".")?r[1].split(".")[0]:r[1];t.push({type:"variable",name:a})}else if(["#","&","^",">"].includes(r[0])){if(t.push({type:"variable",name:r[1]}),r[0]==="#"&&r.length>4&&Array.isArray(r[4])){let a=[...e,r[1]],i=Ve(r[4],a);t.push(...i)}}else t.push({type:"literal",text:r[1]});return t},I=s=>{let e=ee.parse(s);return Ve(e)},te=(s,e)=>M(s).reduce((t,r)=>{if(r.type==="variable"){if(r.name in e)return t+(typeof e[r.name]=="string"?e[r.name]:JSON.stringify(e[r.name]));throw new Error(`(f-string) Missing value for input ${r.name}`)}return t+r.text},""),re=(s,e)=>ee.render(s,e,void 0,Xe),B={"f-string":te,mustache:re},ae={"f-string":M,mustache:I},c=(s,e,t)=>{try{return B[e](s,t)}catch(r){throw W(r,"INVALID_PROMPT_INPUT")}},S=(s,e)=>ae[e](s),T=(s,e,t)=>{if(!(e in B)){let r=Object.keys(B);throw new Error(`Invalid template format. Got \`${e}\`;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
2
|
-
import{b as p}from"./
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
+
import{b as p}from"./S6OUM5X2.js";function f(r,e,o){return{name:r,handler:async(a,t)=>{let n=async l=>{let u=await e.beforeAgent?.(l),w=u?{...l,state:{...l.state,...u}}:l,i=await t(w),d=await e.afterAgent?.({...w,result:i});return d?{...i,...d}:i};return e.wrapAgent?await e.wrapAgent(a,n):await n(a)},hooks:e,outputKey:o?.outputKey}}function M(r,e,o){return{name:r,handler:async(a,t)=>e.wrapToolCall?await e.wrapToolCall(a,t):await t(a),outputKey:o?.outputKey}}function y(r){return r.map(e=>s(e.name,e.hooks??{})).filter(e=>!!e)}function s(r,e){let{afterModel:o,beforeModel:a,wrapModelCall:t,wrapToolCall:n}=e;if(!(!o&&!a&&!t&&!n))return p({afterModel:o,beforeModel:a,name:r,wrapModelCall:t,wrapToolCall:n})}export{f as a,M as b,y as c};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
2
|
-
import{$,A as z,Aa as za,B as A,Ba as Aa,C as B,D as C,E as D,Ea as Ba,F as E,Fa as Ca,G as F,Ga as Da,H as G,Ha as Ea,I as H,Ia as Fa,J,Ja as Ga,K,Ka as Ha,L,La as Ia,M,Ma as Ja,N,Na as Ka,O,Oa as La,P,Q,R,S,T,U,V,W,X,Y,Z,_,a,aa,b,ba,c,ca,d,da,e,ea,f,fa,ga,h as g,ha,i as h,ia,j as i,ja,k as j,ka,l as k,m as l,ma as la,n as m,na as ma,o as n,oa as na,p as o,pa as oa,q as p,qa as pa,r as q,ra as qa,s as r,sa as ra,t as s,ta as sa,u as t,ua as ta,v as u,va as ua,w as v,wa as va,x as w,xa as wa,y as x,ya as xa,z as y,za as ya}from"./
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
+
import{$,A as z,Aa as za,B as A,Ba as Aa,C as B,D as C,E as D,Ea as Ba,F as E,Fa as Ca,G as F,Ga as Da,H as G,Ha as Ea,I as H,Ia as Fa,J,Ja as Ga,K,Ka as Ha,L,La as Ia,M,Ma as Ja,N,Na as Ka,O,Oa as La,P,Q,R,S,T,U,V,W,X,Y,Z,_,a,aa,b,ba,c,ca,d,da,e,ea,f,fa,ga,h as g,ha,i as h,ia,j as i,ja,k as j,ka,l as k,m as l,ma as la,n as m,na as ma,o as n,oa as na,p as o,pa as oa,q as p,qa as pa,r as q,ra as qa,s as r,sa as ra,t as s,ta as sa,u as t,ua as ta,v as u,va as ua,w as v,wa as va,x as w,xa as wa,y as x,ya as xa,z as y,za as ya}from"./7GDMXAF5.js";import"./5XZ5VL42.js";import{v as I}from"./C3VLDYS2.js";import"./A4ZVCRVF.js";import"./N2GN5WOI.js";import"./272R36XK.js";import"./5PV2GUZW.js";export{S as Annotation,O as AsyncBatchedStore,Q as BaseChannel,L as BaseCheckpointSaver,k as BaseLangGraphError,N as BaseStore,R as BinaryOperatorAggregate,d as COMMAND_SYMBOL,I as ChatModelStreamImpl,i as Command,e as CommandInstance,Ca as CompiledStateGraph,qa as DeltaChannel,ua as DeltaValue,b as END,B as EmptyChannelError,A as EmptyInputError,$ as EventLog,la as Graph,l as GraphBubbleUp,o as GraphDrained,q as GraphInterrupt,m as GraphRecursionError,ha as GraphRunStream,n as GraphValueError,c as INTERRUPT,P as InMemoryStore,C as InvalidUpdateError,M as MemorySaver,Da as MessageGraph,Ia as MessagesAnnotation,Aa as MessagesDeltaValue,za as MessagesValue,Ja as MessagesZodMeta,Ka as MessagesZodState,D as MultipleSubgraphsError,s as NodeError,r as NodeInterrupt,y as NodeTimeoutError,g as Overwrite,u as ParentCommand,wa as REMOVE_ALL_MESSAGES,sa as ReducedValue,F as RemoteException,X as RunControl,a as START,Y as STREAM_EVENTS_V3_MODES,f as Send,Ba as StateGraph,G as StateGraphInputError,va as StateSchema,$ as StreamChannel,ia as SubgraphRunStream,E as UnreachableNodeError,ta as UntrackedValue,ra as UntrackedValueChannel,xa as addMessages,_ as convertToProtocolEvent,K as copyCheckpoint,ja as createGraphRunStream,ba as createLifecycleTransformer,ca as createMessagesTransformer,ea as createSubgraphDiscoveryTransformer,fa as createValuesTransformer,J as emptyCheckpoint,Ga as entrypoint,aa as filterLifecycleEntries,da as filterSubgraphHandles,V as getConfig,W as getCurrentTaskInput,oa as getJsonSchemaFromSchema,Ha as getPreviousState,pa as getSchemaDefaultGetter,T as getStore,H as getSubgraphsSeenSet,U as getWriter,ka as interrupt,Z as isCheckpointEnvelope,j as isCommand,w as isGraphBubbleUp,p as isGraphDrained,x as isGraphInterrupt,h as isInterrupted,ga as isNativeTransformer,t as isNodeError,z as isNodeTimeoutError,v as isParentCommand,na as isSerializableSchema,ma as isStandardSchema,ya as messagesDeltaReducer,xa as messagesStateReducer,Ea as pushMessage,Fa as task,La as writer};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
2
|
-
import"./
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
+
import"./5PV2GUZW.js";var o=`(function(){"use strict";const h=(a,r)=>{if(a.length!==r.length)throw new Error("Vectors must be the same length");let c=0,t=0,e=0;for(let n=0;n<a.length;++n){const s=a[n],l=r[n];c+=s*l,t+=s*s,e+=l*l}const i=Math.sqrt(t*e);if(i===0)return 0;const m=c/i;return Math.max(-1,Math.min(1,m))},f=(a,r,c=.6)=>{const t=[],e=[...a];for(;t.length<r&&e.length>0;){let i=-1,m=-1/0;for(let n=0;n<e.length;n++){const s=e[n].score,l=t.length===0?0:Math.max(...t.map(o=>h(e[n].vector,o.vector))),d=c*s-(1-c)*l;d>m&&(m=d,i=n)}t.push(e[i]),e.splice(i,1)}return t.map(({name:i,score:m})=>({name:i,score:m}))};let p=[];const u=new Map,v=12,y=10,M=a=>{p=a.layers.map(r=>({id:r.id,vector:r.vector}))},E=a=>{u.clear();for(const r of a.layers){const c=r.fields.map(t=>({name:t.name,vector:t.vector}));u.set(r.id,c)}};globalThis.addEventListener("message",a=>{(async()=>{const{type:r,webmapEmbeddings:c,layerIdForFieldsSearch:t=[],requestId:e,precomputedEmbedding:i,minScore:m=0,topResults:n=v}=a.data;switch(r){case"generateEmbeddings":{c&&(M(c),E(c)),globalThis.postMessage("completed");break}case"layerSearch":{if(p.length>0)try{const s=p.map(o=>({id:o.id,vector:o.vector,score:h(i,o.vector)})),d=f(s.map(o=>({name:o.id,vector:o.vector,score:o.score})),y).map(({name:o,score:b})=>({id:o,score:b}));globalThis.postMessage({requestId:e,results:d})}catch(s){globalThis.postMessage({requestId:e,results:[],error:s instanceof Error?s.message:"Calculation error"})}else globalThis.postMessage({requestId:e,results:[],error:"Layer embeddings not initialized"});break}case"fieldSearch":{if(t.length>0)try{const s=t.map(l=>{const d=u.get(l);if(!d)return{layerId:l,results:[]};const o=d.map(g=>({name:g.name,vector:g.vector,score:h(i,g.vector)})).filter(({score:g})=>g>=m),b=f(o,n);return{layerId:l,results:b}});globalThis.postMessage({requestId:e,results:s})}catch(s){globalThis.postMessage({requestId:e,results:[],error:s instanceof Error?s.message:"Field search calculation error"})}break}default:console.warn("Unknown message type:",r)}})()})})();
|
|
3
3
|
`,r=typeof self<"u"&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",o],{type:"text/javascript;charset=utf-8"});function a(t){let e;try{if(e=r&&(self.URL||self.webkitURL).createObjectURL(r),!e)throw"";let s=new Worker(e,{name:t?.name});return s.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),s}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(o),{name:t?.name})}}export{a as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
2
|
-
import"./
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
+
import"./5PV2GUZW.js";var e=`# ArcgisKnowledge Tool Instructions
|
|
3
3
|
|
|
4
4
|
You are an assistant that helps users answer questions and perform operations on their knowledge graph, map or link chart. You have been assigned the task below, which must be achieved by calling a single tool.
|
|
5
5
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
2
|
-
import{b as p}from"./
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
+
import{b as p}from"./OUMTV5H5.js";export default $arcgis.t(([m,y,S,b])=>{var q=t=>typeof t=="string"&&t.length>0?t:void 0,w=()=>p(),E=t=>typeof t!="string"||t.trim().length===0?"MapsSDK":`MapsSDK - ${t.trim()}`,I=t=>{let n=t?.configurable;return{conversationId:q(n?.thread_id),abortSignal:t?.signal,requestId:w(),requestSource:E(S.applicationName)}},v=t=>{if(t==null||typeof t=="string"||t instanceof FormData||t instanceof HTMLFormElement)return t;if(t instanceof URLSearchParams)return t.toString();throw new TypeError(`Unsupported request body type: ${Object.prototype.toString.call(t)}`)},k=async({config:t,withCredentials:n})=>{let g=y.getDefault(),f=await m.getCredential(`${g.url}/sharing`);return async(o,r)=>{let{conversationId:a,abortSignal:s,requestId:u,requestSource:i}=I(t),e=new Headers(r?.headers);for(let d of[...e.keys()]){let c=d.toLowerCase();(c==="authorization"||c==="api-key"||c.startsWith("x-stainless-"))&&e.delete(d)}let l=f?.token;l&&l.length>0&&e.set("X-Esri-Authorization",`Bearer ${l}`),g.isPortal||(i&&i.length>0&&e.set("X-Esri-Request-Source",i),a&&a.length>0&&e.set("X-Esri-Conversation-Id",a),u.length>0&&e.set("X-Esri-Request-Id",u));let h=s&&r?.signal?AbortSignal.any([s,r.signal]):r?.signal??s;return(await b(o instanceof Request?o.url:o.toString(),{body:v(r?.body),headers:Object.fromEntries(e),responseType:"native",withCredentials:n,signal:h})).data}};return k},"identity/IdentityManager","portal/Portal","config","request")
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
2
|
-
import{d as Sa}from"./
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
+
import{d as Sa}from"./5XZ5VL42.js";import{A as wa,C as va,D as Is,E as ba,F as Ca,H as xa,J as Ia,b as na,c as sa,d as Cs,e as ca,f as la,g as ua,h as xs,i as ha,j as pa,l as fa,m as da,q as ma,u as ga,v as tn,w as _a,y as ya,z as Yt}from"./C3VLDYS2.js";import{$ as Qe,D as zt,Da as ka,E as Ss,Ea,M as de,N as vr,O as Qo,P as Jt,S as Zo,X as ks,_ as ea,a as Ao,aa as ta,b as To,ba as Es,c as Po,da as X,e as Wo,ea as ra,f as wr,ha as Tt,j as Ko,ja as en,k as qo,l as zo,ma as $e,o as Zr,p as Jo,qa as ia,r as Yo,u as Xo,ua as oa,va as aa}from"./A4ZVCRVF.js";import{N as ut}from"./N2GN5WOI.js";import{$a as be,Ba as At,Ia as Do,J as ae,La as lt,Na as jo,Oa as $o,P as ys,Pa as Kt,Qa as Lo,R as Ye,S as ws,Sa as Ho,T as No,Ta as Uo,Ua as Fo,V as It,Va as Bo,Wa as qt,Xa as bs,Y as Ro,Ya as Y,Za as Vo,a as O,ab as Go,b as yo,bb as Xe,c as _r,ca as vs,d as yr,e as wo,fa as ne,g as _s,h as vo,i as bo,ia as Vt,j as So,k as ko,l as Eo,m as Co,n as xe,o as xo,q as Io,r as Oo,ra as Gt,va as Wt,wa as Mo}from"./272R36XK.js";function Aa(e,t){if(e!=null){if(typeof e!="number"||Number.isNaN(e)||e<=0)throw new Error(`${t} must be greater than 0`);return e}}function ht(e){if(e==null)return;let t=typeof e=="number"?{runTimeout:e}:e,r=t.refreshOn??"auto";if(r!=="auto"&&r!=="heartbeat")throw new Error('refreshOn must be "auto" or "heartbeat"');let n=Aa(t.runTimeout,"runTimeout"),s=Aa(t.idleTimeout,"idleTimeout");if(!(n===void 0&&s===void 0))return{runTimeout:n,idleTimeout:s,refreshOn:r}}var G="__start__",W="__end__",He="__input__";var pt="__error__",Sr="__error_source_node__",rn="__pregel_ns_writes";function Ta(){let e=typeof process<"u"?process.env?.LANGGRAPH_DELTA_MAX_SUPERSTEPS_SINCE_SNAPSHOT:void 0;if(e!==void 0&&e!==""){let t=Number.parseInt(e,10);if(Number.isFinite(t)&&t>0)return t}return 5e3}var ie="__pregel_send",Ue="__pregel_call",ce="__pregel_read",Se="__pregel_checkpointer",Nt="__pregel_resuming",Xt="__pregel_task_id",kr="__pregel_stream",Hu="__pregel_resume_value",Rt="__pregel_resume_map",le="__pregel_scratchpad",ft="__pregel_previous",Uu="__pregel_durability",dt="checkpoint_id",we="checkpoint_ns",Oa="__pregel_node_finished",Er="__pregel_node_error",oe="checkpoint_map",nn="__pregel_replay_state",Na="__pregel_abort_signals",U="__interrupt__",ue="__resume__",Cr="__no_writes__",mt="__return__",gt="__previous__",q="langsmith:hidden";var Ts="__self__",Fe="__pregel_tasks",he="__pregel_push",sn="__pregel_pull",pe="00000000-0000-0000-0000-000000000000",Ra=[q,He,U,ue,pt,Sr,Cr,ie,ce,Se,Uu,kr,Nt,Xt,Ue,Hu,le,ft,oe,we,dt,nn],As=Symbol.for("langgraph.command"),Ma=class{[As];constructor(e){this[As]=e}};function on(e){let t=e;return t!=null&&typeof t.node=="string"&&t.args!==void 0}var Ot=class{lg_name="Send";node;args;timeout;constructor(e,t,r){this.node=e,this.args=br(t),this.timeout=ht(r?.timeout)}toJSON(){return{lg_name:this.lg_name,node:this.node,args:this.args,timeout:this.timeout}}};function Q(e){return e instanceof Ot}var Le="__overwrite__",Fu=class{lg_name="Overwrite";[Le];constructor(e){this[Le]=e}get value(){return this[Le]}toJSON(){return{[Le]:this[Le]}}static isInstance(e){return!e||typeof e!="object"?!1:"__overwrite__"in e||"lg_name"in e&&e.lg_name==="Overwrite"}};function Ie(e){if(typeof e=="object"&&e!==null){if("__overwrite__"in e)return[!0,e[Le]];let t=e;if(t.type==="__overwrite__"&&"value"in t)return[!0,t.value]}return[!1,void 0]}function Mt(e){return Ie(e)[0]}function Pt(e){return!e||typeof e!="object"||!("__interrupt__"in e)?!1:Array.isArray(e[U])}var me=class extends Ma{lg_name="Command";lc_direct_tool_output=!0;graph;update;resume;goto=[];static PARENT="__parent__";constructor(e){super(e),this.resume=e.resume,this.graph=e.graph,this.update=e.update,e.goto&&(this.goto=Array.isArray(e.goto)?br(e.goto):[br(e.goto)])}_updateAsTuples(){return this.update&&typeof this.update=="object"&&!Array.isArray(this.update)?Object.entries(this.update):Array.isArray(this.update)&&this.update.every(e=>Array.isArray(e)&&e.length===2&&typeof e[0]=="string")?this.update:[["__root__",this.update]]}toJSON(){let e;return typeof this.goto=="string"?e=this.goto:Q(this.goto)?e=this.goto.toJSON():e=this.goto?.map(t=>typeof t=="string"?t:t.toJSON()),{lg_name:this.lg_name,update:this.update,resume:this.resume,goto:e}}};function te(e){return typeof e!="object"||e==null?!1:"lg_name"in e&&e.lg_name==="Command"}function Bu(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function br(e,t=new Map){if(e!=null&&typeof e=="object"){if(t.has(e))return t.get(e);let r;if(Array.isArray(e))r=[],t.set(e,r),e.forEach((n,s)=>{r[s]=br(n,t)});else if(e instanceof me||e instanceof Ot||!Bu(e))r=e,t.set(e,r);else if(te(e))r=new me(e),t.set(e,r);else if(on(e))r=new Ot(e.node,e.args,e.timeout!==void 0?{timeout:e.timeout}:void 0),t.set(e,r);else if("lc_serializable"in e&&e.lc_serializable)r=e,t.set(e,r);else{r={},t.set(e,r);for(let[n,s]of Object.entries(e))r[n]=br(s,t)}return r}return e}var ke=class extends Error{lc_error_code;constructor(e,t){let r=e??"";t?.lc_error_code&&(r=`${r}
|
|
3
3
|
|
|
4
4
|
Troubleshooting URL: https://docs.langchain.com/oss/javascript/langgraph/${t.lc_error_code}/
|
|
5
5
|
`),super(r),this.lc_error_code=t?.lc_error_code}},an=class extends ke{get is_bubble_up(){return!0}},Os=class extends ke{constructor(e,t){super(e,t),this.name="GraphRecursionError"}static get unminifiable_name(){return"GraphRecursionError"}},Dt=class extends ke{constructor(e,t){super(e,t),this.name="GraphValueError"}static get unminifiable_name(){return"GraphValueError"}},cn=class extends an{reason;constructor(e="shutdown",t){super(`Graph drained: ${e}`,t),this.name="GraphDrained",this.reason=e}static get unminifiable_name(){return"GraphDrained"}};function ln(e){return e!==void 0&&e.name===cn.unminifiable_name}var Ze=class extends an{interrupts;constructor(e,t){super(JSON.stringify(e,null,2),t),this.name="GraphInterrupt",this.interrupts=e??[]}static get unminifiable_name(){return"GraphInterrupt"}},un=class extends Ze{constructor(e,t){super([{value:e}],t),this.name="NodeInterrupt"}static get unminifiable_name(){return"NodeInterrupt"}},hn=class{node;error;constructor(e,t){this.node=e,this.error=t}static get unminifiable_name(){return"NodeError"}};function Vu(e){return e!=null&&typeof e=="object"&&e.constructor!=null&&e.constructor.unminifiable_name===hn.unminifiable_name}var pn=class extends an{command;constructor(e){super(),this.name="ParentCommand",this.command=e}static get unminifiable_name(){return"ParentCommand"}};function Ns(e){return e!==void 0&&e.name===pn.unminifiable_name}function _t(e){return e!==void 0&&e.is_bubble_up===!0}function et(e){return e!==void 0&&[Ze.unminifiable_name,un.unminifiable_name].includes(e.name)}var fn=class extends ke{node;kind;timeout;elapsed;runTimeout;idleTimeout;constructor(e,t){let{node:r,elapsed:n,kind:s,runTimeout:i,idleTimeout:o}=e,a,c;if(s==="idle"){if(o===void 0)throw new Error("idleTimeout is required when kind='idle'");c=o,a=`Node "${r}" exceeded its idle timeout of ${o}ms without making progress (elapsed: ${n}ms).`}else{if(i===void 0)throw new Error("runTimeout is required when kind='run'");c=i,a=`Node "${r}" exceeded its run timeout of ${i}ms (elapsed: ${n}ms).`}super(a,t),this.name="NodeTimeoutError",this.node=r,this.kind=s,this.timeout=c,this.elapsed=n,this.runTimeout=i,this.idleTimeout=o}static get unminifiable_name(){return"NodeTimeoutError"}};function Gu(e){return e!==void 0&&e.name===fn.unminifiable_name}var dn=class extends ke{constructor(e,t){super(e,t),this.name="EmptyInputError"}static get unminifiable_name(){return"EmptyInputError"}},$=class extends ke{constructor(e,t){let r=Error.stackTraceLimit;Error.stackTraceLimit=0,super(e,t),Error.stackTraceLimit=r,this.name="EmptyChannelError"}static get unminifiable_name(){return"EmptyChannelError"}},M=class extends ke{constructor(e,t){super(e,t),this.name="InvalidUpdateError"}static get unminifiable_name(){return"InvalidUpdateError"}},Wu=class extends ke{constructor(e,t){super(e,t),this.name="MultipleSubgraphError"}static get unminifiable_name(){return"MultipleSubgraphError"}},Rs=class extends ke{constructor(e,t){super(e,t),this.name="UnreachableNodeError"}static get unminifiable_name(){return"UnreachableNodeError"}},Ku=class extends ke{constructor(e,t){super(e,t),this.name="RemoteException"}static get unminifiable_name(){return"RemoteException"}},xr=class extends ke{constructor(e,t){super(e,t),this.name="StateGraphInputError",this.message="Invalid StateGraph input. Make sure to pass a valid StateDefinition, Annotation.Root, or Zod schema."}static get unminifiable_name(){return"StateGraphInputError"}},qu=()=>(globalThis[Symbol.for("LG_CHECKPOINT_SEEN_NS_SET")]===void 0&&(globalThis[Symbol.for("LG_CHECKPOINT_SEEN_NS_SET")]=new Set),globalThis[Symbol.for("LG_CHECKPOINT_SEEN_NS_SET")]);var Ms=0,Ir=0;function Ar(e){let t=Date.now();return t<=Ms?(Ir+=1,Ir>=1e4&&(Ir=0,t=Ms+1)):Ir=0,Ms=t,wo({clockseq:e,msecs:t,nsecs:Ir})}function Be(e,t){let r=t.replace(/-/g,"").match(/.{2}/g).map(n=>parseInt(n,16));return yr(e,new Uint8Array(r))}var Tr="__pregel_tasks",Ps="__error__",jt="__scheduled__",Ds="__interrupt__",js="__resume__",Qt=class{lg_name="DeltaSnapshot";value;constructor(e){this.value=e}};function $s(e){return e!=null&&typeof e=="object"&&e.lg_name==="DeltaSnapshot"}var Pa="[...]",zu="[Circular]",mn=[],Zt=[];function Ju(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function Da(e,t,r,n){typeof n>"u"&&(n=Ju()),Hs(e,"",0,[],void 0,0,n);var s;try{Zt.length===0?s=JSON.stringify(e,t,r):s=JSON.stringify(e,Yu(t),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;mn.length!==0;){var i=mn.pop();i.length===4?Object.defineProperty(i[0],i[1],i[3]):i[0][i[1]]=i[2]}}return s}function Ls(e,t,r,n){var s=Object.getOwnPropertyDescriptor(n,r);s.get!==void 0?s.configurable?(Object.defineProperty(n,r,{value:e}),mn.push([n,r,t,s])):Zt.push([t,r,e]):(n[r]=e,mn.push([n,r,t]))}function Hs(e,t,r,n,s,i,o){i+=1;var a;if(typeof e=="object"&&e!==null){for(a=0;a<n.length;a++)if(n[a]===e){Ls(zu,e,t,s);return}if(typeof o.depthLimit<"u"&&i>o.depthLimit){Ls(Pa,e,t,s);return}if(typeof o.edgesLimit<"u"&&r+1>o.edgesLimit){Ls(Pa,e,t,s);return}if(n.push(e),Array.isArray(e))for(a=0;a<e.length;a++)Hs(e[a],a,a,n,e,i,o);else{var c=Object.keys(e);for(a=0;a<c.length;a++){var l=c[a];Hs(e[l],l,a,n,e,i,o)}}n.pop()}}function Yu(e){return e=typeof e<"u"?e:function(t,r){return r},function(t,r){if(Zt.length>0)for(var n=0;n<Zt.length;n++){var s=Zt[n];if(s[1]===t&&s[0]===r){r=s[2],Zt.splice(n,1);break}}return e.call(this,t,r)}}var ja=[];var $a=O({});var La=O({});var Ha=O({BaseChatMessageHistory:()=>Us,BaseListChatMessageHistory:()=>gn,InMemoryChatMessageHistory:()=>Xu}),Us=class extends xe{async addMessages(e){for(let t of e)await this.addMessage(t)}},gn=class extends xe{addUserMessage(e){return this.addMessage(new Gt(e))}addAIMessage(e){return this.addMessage(new ne(e))}async addMessages(e){for(let t of e)await this.addMessage(t)}clear(){throw new Error("Not implemented.")}},Xu=class extends gn{lc_namespace=["langchain","stores","message","in_memory"];messages=[];constructor(e){super(...arguments),this.messages=e??[]}async getMessages(){return this.messages}async addMessage(e){this.messages.push(e)}async clear(){this.messages=[]}};var ve=class{pageContent;metadata;id;constructor(e){this.pageContent=e.pageContent!==void 0?e.pageContent.toString():"",this.metadata=e.metadata??{},this.id=e.id}};var Fs=class extends X{lc_namespace=["langchain_core","documents","transformers"];invoke(e,t){return this.transformDocuments(e)}},Ua=class extends Fs{async transformDocuments(e){let t=[];for(let r of e){let n=await this._transformDocument(r);t.push(n)}return t}};var Fa=O({BaseDocumentTransformer:()=>Fs,Document:()=>ve,MappingDocumentTransformer:()=>Ua});var Ba=O({BaseDocumentLoader:()=>Bs}),Bs=class{};var Va=O({LangSmithLoader:()=>Qu}),Qu=class extends Bs{datasetId;datasetName;exampleIds;asOf;splits;inlineS3Urls;offset;limit;metadata;filter;contentKey;formatContent;client;constructor(e){if(super(),e.client&&e.clientConfig)throw new Error("client and clientConfig cannot both be provided.");this.client=e.client??new jo(e?.clientConfig),this.contentKey=e.contentKey?e.contentKey.split("."):[],this.formatContent=e.formatContent??Zu,this.datasetId=e.datasetId,this.datasetName=e.datasetName,this.exampleIds=e.exampleIds,this.asOf=e.asOf,this.splits=e.splits,this.inlineS3Urls=e.inlineS3Urls,this.offset=e.offset,this.limit=e.limit,this.metadata=e.metadata,this.filter=e.filter}async load(){let e=[];for await(let t of this.client.listExamples({datasetId:this.datasetId,datasetName:this.datasetName,exampleIds:this.exampleIds,asOf:this.asOf,splits:this.splits,inlineS3Urls:this.inlineS3Urls,offset:this.offset,limit:this.limit,metadata:this.metadata,filter:this.filter})){let r=t.inputs;for(let i of this.contentKey)r=r[i];let n=this.formatContent(r),s=t;["created_at","modified_at"].forEach(i=>{i in s&&typeof s[i]=="object"&&(s[i]=s[i].toString())}),e.push({pageContent:n,metadata:s})}return e}};function Zu(e){if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}var er=class extends xe{lc_namespace=["langchain_core","example_selectors","base"]};var Vs=class{async getPromptAsync(e,t){return this.getPrompt(e).partial(t?.partialVariables??{})}},Ga=class extends Vs{defaultPrompt;conditionals;constructor(e,t=[]){super(),this.defaultPrompt=e,this.conditionals=t}getPrompt(e){for(let[t,r]of this.conditionals)if(t(e))return r;return this.defaultPrompt}};function Wa(e){return e._modelType()==="base_llm"}function Ka(e){return e._modelType()==="base_chat_model"}function qa(e){return e.split(/\n| /).length}var za=class Ja extends er{examples=[];examplePrompt;getTextLength=qa;maxLength=2048;exampleTextLengths=[];constructor(t){super(t),this.examplePrompt=t.examplePrompt,this.maxLength=t.maxLength??2048,this.getTextLength=t.getTextLength??qa}async addExample(t){this.examples.push(t);let r=await this.examplePrompt.format(t);this.exampleTextLengths.push(this.getTextLength(r))}async calculateExampleTextLengths(t,r){if(t.length>0)return t;let{examples:n,examplePrompt:s}=r;return(await Promise.all(n.map(i=>s.format(i)))).map(i=>this.getTextLength(i))}async selectExamples(t){let r=Object.values(t).join(" "),n=this.maxLength-this.getTextLength(r),s=0,i=[];for(;n>0&&s<this.examples.length;){let o=n-this.exampleTextLengths[s];if(o<0)break;i.push(this.examples[s]),n=o,s+=1}return i}static async fromExamples(t,r){let n=new Ja(r);return await Promise.all(t.map(s=>n.addExample(s))),n}};function Gs(e){return Object.keys(e).sort().map(t=>e[t])}var Ya=class Xa extends er{vectorStoreRetriever;exampleKeys;inputKeys;constructor(t){if(super(t),this.exampleKeys=t.exampleKeys,this.inputKeys=t.inputKeys,t.vectorStore!==void 0)this.vectorStoreRetriever=t.vectorStore.asRetriever({k:t.k??4,filter:t.filter});else if(t.vectorStoreRetriever)this.vectorStoreRetriever=t.vectorStoreRetriever;else throw new Error('You must specify one of "vectorStore" and "vectorStoreRetriever".')}async addExample(t){let r=Gs((this.inputKeys??Object.keys(t)).reduce((n,s)=>({...n,[s]:t[s]}),{})).join(" ");await this.vectorStoreRetriever.addDocuments([new ve({pageContent:r,metadata:t})])}async selectExamples(t){let r=Gs((this.inputKeys??Object.keys(t)).reduce((s,i)=>({...s,[i]:t[i]}),{})).join(" "),n=(await this.vectorStoreRetriever.invoke(r)).map(s=>s.metadata);return this.exampleKeys?n.map(s=>this.exampleKeys.reduce((i,o)=>({...i,[o]:s[o]}),{})):n}static async fromExamples(t,r,n,s={}){let i=s.inputKeys??null,o=t.map(c=>Gs(i?i.reduce((l,u)=>({...l,[u]:c[u]}),{}):c).join(" ")),a=await n.fromTexts(o,t,r,s);return new Xa({vectorStore:a,k:s.k??4,exampleKeys:s.exampleKeys,inputKeys:s.inputKeys})}};var Qa=O({BaseExampleSelector:()=>er,BasePromptSelector:()=>Vs,ConditionalPromptSelector:()=>Ga,LengthBasedExampleSelector:()=>za,SemanticSimilarityExampleSelector:()=>Ya,isChatModel:()=>Ka,isLLM:()=>Wa});var Or="10f90ea3-90a4-4962-bf75-83a0f3c1c62a",Za=class extends xe{lc_namespace=["langchain","recordmanagers"]};var Ws=class{uid;hash_;contentHash;metadataHash;pageContent;metadata;keyEncoder=Ao;constructor(e){this.uid=e.uid,this.pageContent=e.pageContent,this.metadata=e.metadata}makeDefaultKeyEncoder(e){this.keyEncoder=e}calculateHashes(){let e=["hash_","content_hash","metadata_hash"];for(let r of e)if(r in this.metadata)throw new Error(`Metadata cannot contain key ${r} as it is reserved for internal use. Restricted keys: [${e.join(", ")}]`);let t=this._hashStringToUUID(this.pageContent);try{let r=this._hashNestedDictToUUID(this.metadata);this.contentHash=t,this.metadataHash=r}catch(r){throw new Error(`Failed to hash metadata: ${r}. Please use a dict that can be serialized using json.`)}this.hash_=this._hashStringToUUID(this.contentHash+this.metadataHash),this.uid||(this.uid=this.hash_)}toDocument(){return new ve({pageContent:this.pageContent,metadata:this.metadata})}static fromDocument(e,t){let r=new this({pageContent:e.pageContent,metadata:e.metadata,uid:t||e.uid});return r.calculateHashes(),r}_hashStringToUUID(e){return yr(this.keyEncoder(e),Or)}_hashNestedDictToUUID(e){let t=JSON.stringify(e,Object.keys(e).sort());return yr(this.keyEncoder(t),Or)}};function Ks(e,t){let r=[],n=[];return t.forEach(s=>{n.push(s),n.length>=e&&(r.push(n),n=[])}),n.length>0&&r.push(n),r}function qs(e){let t=new Set,r=[];for(let n of e){if(!n.hash_)throw new Error("Hashed document does not have a hash");t.has(n.hash_)||(t.add(n.hash_),r.push(n))}return r}function zs(e){if(e===null)return t=>null;if(typeof e=="string")return t=>t.metadata[e];if(typeof e=="function")return e;throw new Error(`sourceIdKey should be null, a string or a function, got ${typeof e}`)}var Js=e=>"load"in e&&typeof e.load=="function"&&"loadAndSplit"in e&&typeof e.loadAndSplit=="function";async function ec(e){let{docsSource:t,recordManager:r,vectorStore:n,options:s}=e,{batchSize:i=100,cleanup:o,sourceIdKey:a,cleanupBatchSize:c=1e3,forceUpdate:l=!1}=s??{};if(o==="incremental"&&!a)throw new Error("sourceIdKey is required when cleanup mode is incremental. Please provide through 'options.sourceIdKey'.");let u=Js(t)?await t.load():t,h=zs(a??null),p=await r.getTime(),f=0,d=0,m=0,g=0,_=Ks(i??100,u);for(let y of _){let S=qs(y.map(C=>Ws.fromDocument(C))),w=S.map(C=>h(C));o==="incremental"&&S.forEach((C,H)=>{if(w[H]===null)throw new Error("sourceIdKey must be provided when cleanup is incremental")});let x=await r.exists(S.map(C=>C.uid)),A=[],k=[],b=[],I=new Set;if(S.forEach((C,H)=>{if(x[H])if(l)I.add(C.uid);else{b.push(C.uid);return}A.push(C.uid),k.push(C.toDocument())}),b.length>0&&(await r.update(b,{timeAtLeast:p}),g+=b.length),k.length>0&&(await n.addDocuments(k,{ids:A}),f+=k.length-I.size,m+=I.size),await r.update(S.map(C=>C.uid),{timeAtLeast:p,groupIds:w}),o==="incremental"){w.forEach(H=>{if(!H)throw new Error("Source id cannot be null")});let C=await r.listKeys({before:p,groupIds:w});C.length>0&&(await n.delete({ids:C}),await r.deleteKeys(C),d+=C.length)}}if(o==="full"){let y=await r.listKeys({before:p,limit:c});for(;y.length>0;)await n.delete({ids:y}),await r.deleteKeys(y),d+=y.length,y=await r.listKeys({before:p,limit:c})}return{numAdded:f,numDeleted:d,numUpdated:m,numSkipped:g}}var tc=O({RecordManager:()=>Za,UUIDV5_NAMESPACE:()=>Or,_HashedDocument:()=>Ws,_batch:()=>Ks,_deduplicateInOrder:()=>qs,_getSourceIdAssigner:()=>zs,_isBaseDocumentLoader:()=>Js,index:()=>ec});var rc=O({});var nc=O({});var sc=O({BaseMemory:()=>eh,getInputValue:()=>th,getOutputValue:()=>rh,getPromptInputKey:()=>nh}),eh=class{},ic=(e,t)=>{if(t!==void 0)return e[t];let r=Object.keys(e);if(r.length===1)return e[r[0]]},th=(e,t)=>{let r=ic(e,t);if(!r){let n=Object.keys(e);throw new Error(`input values have ${n.length} keys, you must specify an input key or pass only 1 key as input`)}return r},rh=(e,t)=>{let r=ic(e,t);if(!r&&r!==""){let n=Object.keys(e);throw new Error(`output values have ${n.length} keys, you must specify an output key or pass only 1 key as output`)}return r};function nh(e,t){let r=Object.keys(e).filter(n=>!t.includes(n)&&n!=="stop");if(r.length!==1)throw new Error(`One input key expected, but got ${r.length}`);return r[0]}var Ys=class extends xs{static lc_name(){return"OutputFunctionsParser"}lc_namespace=["langchain","output_parsers","openai_functions"];lc_serializable=!0;argsOnly=!0;constructor(e){super(),this.argsOnly=e?.argsOnly??this.argsOnly}async parseResult(e){if("message"in e[0]){let t=e[0].message.additional_kwargs.function_call;if(!t)throw new Error(`No function_call in message ${JSON.stringify(e)}`);if(!t.arguments)throw new Error(`No arguments in function_call ${JSON.stringify(e)}`);return this.argsOnly?t.arguments:JSON.stringify(t)}else throw new Error(`No message in generations ${JSON.stringify(e)}`)}},Xs=class extends pa{static lc_name(){return"JsonOutputFunctionsParser"}lc_namespace=["langchain","output_parsers","openai_functions"];lc_serializable=!0;outputParser;argsOnly=!0;constructor(e){super(e),this.argsOnly=e?.argsOnly??this.argsOnly,this.outputParser=new Ys(e)}_diff(e,t){if(t)return Ko(e??{},t)}async parsePartialResult(e){let t=e[0];if(!t.message)return;let{message:r}=t,n=r.additional_kwargs.function_call;if(n)return this.argsOnly?vs(n.arguments):{...n,arguments:vs(n.arguments)}}async parseResult(e){let t=await this.outputParser.parseResult(e);if(!t)throw new Error(`No result from "OutputFunctionsParser" ${JSON.stringify(e)}`);return this.parse(t)}async parse(e){let t=JSON.parse(e);return this.argsOnly||(t.arguments=JSON.parse(t.arguments)),t}getFormatInstructions(){return""}},oc=class extends xs{static lc_name(){return"JsonKeyOutputFunctionsParser"}lc_namespace=["langchain","output_parsers","openai_functions"];lc_serializable=!0;outputParser=new Xs;attrName;get lc_aliases(){return{attrName:"key_name"}}constructor(e){super(e),this.attrName=e.attrName}async parseResult(e){return(await this.outputParser.parseResult(e))[this.attrName]}};var ac=O({JsonKeyOutputFunctionsParser:()=>oc,JsonOutputFunctionsParser:()=>Xs,OutputFunctionsParser:()=>Ys});var cc=O({BaseDocumentCompressor:()=>sh}),sh=class{static isBaseDocumentCompressor(e){return e?.compressDocuments!==void 0}};var lc=O({BaseRetriever:()=>Nr}),Nr=class extends X{callbacks;tags;metadata;verbose;constructor(e){super(e),this.callbacks=e?.callbacks,this.tags=e?.tags??[],this.metadata=e?.metadata??{},this.verbose=e?.verbose??!1}_getRelevantDocuments(e,t){throw new Error("Not implemented!")}async invoke(e,t){let r=Go(Bo(t)),n=await(await qt.configure(r.callbacks,this.callbacks,r.tags,this.tags,r.metadata,this.metadata,{verbose:this.verbose}))?.handleRetrieverStart(this.toJSON(),e,r.runId,void 0,void 0,void 0,r.runName);try{let s=await this._getRelevantDocuments(e,n);return await n?.handleRetrieverEnd(s),s}catch(s){throw await n?.handleRetrieverError(s),s}}};var uc=O({BaseStore:()=>hc,InMemoryStore:()=>ih}),hc=class extends xe{},ih=class extends hc{lc_namespace=["langchain","storage"];store={};async mget(e){return e.map(t=>this.store[t])}async mset(e){for(let[t,r]of e)this.store[t]=r}async mdelete(e){for(let t of e)delete this.store[t]}async*yieldKeys(e){let t=Object.keys(this.store);for(let r of t)(e===void 0||r.startsWith(e))&&(yield r)}};var Ae={and:"and",or:"or",not:"not"},j={eq:"eq",ne:"ne",lt:"lt",gt:"gt",lte:"lte",gte:"gte"},_n=class{},yn=class{accept(e){if(this.exprName==="Operation")return e.visitOperation(this);if(this.exprName==="Comparison")return e.visitComparison(this);if(this.exprName==="StructuredQuery")return e.visitStructuredQuery(this);throw new Error("Unknown Expression type")}},wn=class extends yn{},pc=class extends wn{comparator;attribute;value;exprName="Comparison";constructor(e,t,r){super(),this.comparator=e,this.attribute=t,this.value=r}},fc=class extends wn{operator;args;exprName="Operation";constructor(e,t){super(),this.operator=e,this.args=t}},dc=class extends yn{query;filter;exprName="StructuredQuery";constructor(e,t){super(),this.query=e,this.filter=t}};function Qs(e){return e&&typeof e=="object"&&!Array.isArray(e)}function ge(e){return e?typeof e=="string"&&e.length>0||typeof e=="function"?!1:Qs(e)&&Object.keys(e).length===0:!0}function Zs(e){if(typeof e=="number")return e%1===0;if(typeof e=="string"){let t=parseInt(e,10);return!Number.isNaN(t)&&t%1===0&&t.toString()===e}return!1}function ei(e){if(typeof e=="number")return e%1!==0;if(typeof e=="string"){let t=parseFloat(e);return!Number.isNaN(t)&&t%1!==0&&t.toString()===e}return!1}function ti(e){return typeof e=="string"&&(Number.isNaN(parseFloat(e))||parseFloat(e).toString()!==e)}function ri(e){return typeof e=="boolean"}function tr(e){let t;if(ti(e))t=e;else if(Zs(e))t=parseInt(e,10);else if(ei(e))t=parseFloat(e);else if(ri(e))t=!!e;else throw new Error("Unsupported value type");return t}var Rr=class extends _n{},mc=class extends Rr{allowedOperators;allowedComparators;constructor(e){super(),this.allowedOperators=e?.allowedOperators??[Ae.and,Ae.or],this.allowedComparators=e?.allowedComparators??[j.eq,j.ne,j.gt,j.gte,j.lt,j.lte]}formatFunction(e){if(e in j){if(this.allowedComparators.length>0&&this.allowedComparators.indexOf(e)===-1)throw new Error(`Comparator ${e} not allowed. Allowed comparators: ${this.allowedComparators.join(", ")}`)}else if(e in Ae){if(this.allowedOperators.length>0&&this.allowedOperators.indexOf(e)===-1)throw new Error(`Operator ${e} not allowed. Allowed operators: ${this.allowedOperators.join(", ")}`)}else throw new Error("Unknown comparator or operator");return`$${e}`}visitOperation(e){let t=e.args?.map(r=>r.accept(this));return{[this.formatFunction(e.operator)]:t}}visitComparison(e){return{[e.attribute]:{[this.formatFunction(e.comparator)]:tr(e.value)}}}visitStructuredQuery(e){let t={};return e.filter&&(t={filter:e.filter.accept(this)}),t}mergeFilters(e,t,r="and",n=!1){if(!(ge(e)&&ge(t))){if(ge(e)||r==="replace")return ge(t)?void 0:t;if(ge(t))return n?e:r==="and"?void 0:e;if(r==="and")return{$and:[e,t]};if(r==="or")return{$or:[e,t]};throw new Error("Unknown merge type")}}};var gc=class extends Rr{allowedOperators=[Ae.and,Ae.or];allowedComparators=[j.eq,j.ne,j.gt,j.gte,j.lt,j.lte];formatFunction(){throw new Error("Not implemented")}getAllowedComparatorsForType(e){switch(e){case"string":return[j.eq,j.ne,j.gt,j.gte,j.lt,j.lte];case"number":return[j.eq,j.ne,j.gt,j.gte,j.lt,j.lte];case"boolean":return[j.eq,j.ne];default:throw new Error(`Unsupported data type: ${e}`)}}getComparatorFunction(e){switch(e){case j.eq:return(t,r)=>t===r;case j.ne:return(t,r)=>t!==r;case j.gt:return(t,r)=>t>r;case j.gte:return(t,r)=>t>=r;case j.lt:return(t,r)=>t<r;case j.lte:return(t,r)=>t<=r;default:throw new Error("Unknown comparator")}}getOperatorFunction(e){switch(e){case Ae.and:return(t,r)=>t&&r;case Ae.or:return(t,r)=>t||r;default:throw new Error("Unknown operator")}}visitOperation(e){let{operator:t,args:r}=e;if(this.allowedOperators.includes(t)){let n=this.getOperatorFunction(t);return s=>r?r.reduce((i,o)=>{let a=o.accept(this);if(typeof a=="function")return n(i,a(s));throw new Error("Filter is not a function")},!0):!0}else throw new Error("Operator not allowed")}visitComparison(e){let{comparator:t,attribute:r,value:n}=e,s=[j.ne];if(this.allowedComparators.includes(t)){if(!this.getAllowedComparatorsForType(typeof n).includes(t))throw new Error(`'${t}' comparator not allowed to be used with ${typeof n}`);let i=this.getComparatorFunction(t);return o=>{let a=o.metadata[r];return a===void 0?!!s.includes(t):i(a,tr(n))}}else throw new Error("Comparator not allowed")}visitStructuredQuery(e){if(!e.filter)return{};let t=e.filter?.accept(this);if(typeof t!="function")throw new Error("Structured query filter is not a function");return{filter:t}}mergeFilters(e,t,r="and"){if(!(ge(e)&&ge(t))){if(ge(e)||r==="replace")return ge(t)?void 0:t;if(ge(t))return r==="and"?void 0:e;if(r==="and")return n=>e(n)&&t(n);if(r==="or")return n=>e(n)||t(n);throw new Error("Unknown merge type")}}};var _c=O({BaseTranslator:()=>Rr,BasicTranslator:()=>mc,Comparators:()=>j,Comparison:()=>pc,Expression:()=>yn,FilterDirective:()=>wn,FunctionalTranslator:()=>gc,Operation:()=>fc,Operators:()=>Ae,StructuredQuery:()=>dc,Visitor:()=>_n,castValue:()=>tr,isBoolean:()=>ri,isFilterEmpty:()=>ge,isFloat:()=>ei,isInt:()=>Zs,isObject:()=>Qs,isString:()=>ti});function Mr(e){if(e==null||typeof e!="object")return!1;let t=e;return typeof t.text<"u"&&typeof t.toolCalls<"u"&&typeof t.reasoning<"u"&&typeof t.usage<"u"&&typeof t.output<"u"&&typeof t[Symbol.asyncIterator]=="function"}function yc(e,t,r){return e==null?!1:Object.entries(t).every(([n,s])=>r(e[n],s))}function wc(e,t,r){return e==null?!1:yc(e,t,r)}function vc(e){return e.content.find(t=>t.type==="text")?.text}function oh(e,t,r){if(t.id!==void 0&&e.id!==t.id||t.text!==void 0&&vc(e)!==t.text)return!1;if(t.toolCalls!==void 0){let n=e.tool_calls??[];if(n.length!==t.toolCalls.length)return!1;for(let s=0;s<t.toolCalls.length;s++){let i=n[s],o=t.toolCalls[s];if(i?.name!==o.name||!r(i.args,o.args))return!1}}return!(t.usage!==void 0&&!wc(e.usage_metadata,t.usage,r)||t.responseMetadata!==void 0&&!yc(e.response_metadata,t.responseMetadata,r))}function Pr(e,t,r){return{pass:!1,message:()=>`${r.matcherHint(t)}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
2
|
-
import{a as s}from"./
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
+
import{a as s}from"./QBZP6XOE.js";import{a as i}from"./GS5JDPZH.js";import{Ga as o}from"./A4ZVCRVF.js";var n=async t=>{t.map?.allLayers.filter(e=>e.type==="feature")?.forEach(e=>{let r=e;r.featureEffect&&(r.featureEffect=null)});let a=t.map.initialViewProperties?.viewpoint?.targetGeometry;return a?(await t.goTo(a),"Cleared all filters and returned to home extent."):"Cleared all filters. Could not determine home extent."},l=async(t,a)=>{let{mapView:e}=s(a,["mapView"]);return await n(e)},c=o(l,{name:"resetMap",description:"Clears all feature effects/filters from the map AND zooms to the home extent (initial map view). Use when user says 'reset map', 'reset the map', 'start over', or wants to both clear filters and return to the initial view.",schema:i.object({})});export{c as a};
|