@arcgis/ai-components 5.2.0-next.11 → 5.2.0-next.110
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +4 -2
- package/README.md +2 -2
- package/dist/agent-utils/BaseAgent.js +1 -1
- package/dist/agent-utils/FunctionAgent.js +1 -1
- package/dist/agent-utils/LLMAgent.d.ts +5 -2
- package/dist/agent-utils/LLMAgent.js +7 -4
- package/dist/agent-utils/WorkflowAgent.js +15 -16
- package/dist/agent-utils/index.d.ts +78 -0
- package/dist/agent-utils/index.js +117 -98
- package/dist/agent-utils/middlewares/humanInTheLoop.js +1 -1
- package/dist/agent-utils/middlewares/middleware.js +1 -1
- package/dist/agent-utils/middlewares/trace.d.ts +2 -0
- 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/types.d.ts +13 -13
- package/dist/agent-utils/workflows/ConditionalWorkflow.js +1 -1
- package/dist/agent-utils/workflows/LoopWorkflow.js +1 -1
- package/dist/agent-utils/workflows/ParallelWorkflow.js +1 -1
- package/dist/agent-utils/workflows/RouterWorkflow.js +1 -1
- package/dist/agent-utils/workflows/SequentialWorkflow.js +1 -1
- package/dist/agent-utils/workflows/SwitchWorkflow.js +1 -1
- package/dist/agentic-workflow/AgenticWorkflowRuntime.d.ts +24 -0
- package/dist/agentic-workflow/Edge.d.ts +16 -0
- package/dist/agentic-workflow/WebAgent.d.ts +39 -0
- package/dist/agentic-workflow/jsonTypes.d.ts +189 -0
- package/dist/agentic-workflow/nodes/AgentNode.d.ts +28 -0
- package/dist/agentic-workflow/nodes/BaseNode.d.ts +35 -0
- package/dist/agentic-workflow/nodes/EndMessageNode.d.ts +25 -0
- package/dist/agentic-workflow/nodes/StartNode.d.ts +21 -0
- package/dist/agentic-workflow/nodes/tools/ArcgisTool.d.ts +21 -0
- package/dist/agentic-workflow/types.d.ts +29 -0
- package/dist/agents/runtime/skill/createSkillAgent.d.ts +31 -0
- package/dist/agents/runtime/skill/createSkillAgent.js +260 -0
- package/dist/agents/runtime/skill/loadAgentSkills.d.ts +16 -0
- package/dist/agents/runtime/skill/types.d.ts +28 -0
- package/dist/agents/runtime/skill/types.js +2 -0
- package/dist/agents/tools/filter/clearFilters/adapter.d.ts +8 -0
- package/dist/agents/tools/filter/clearFilters/adapter.js +22 -0
- package/dist/agents/tools/filter/resetMap/adapter.d.ts +8 -0
- package/dist/agents/tools/filter/resetMap/adapter.js +22 -0
- package/dist/agents/tools/filter/setFeatureEffect/adapter.d.ts +8 -0
- package/dist/agents/tools/filter/setFeatureEffect/adapter.js +122 -0
- package/dist/agents/tools/help/listFields/adapter.d.ts +11 -0
- package/dist/agents/tools/help/listFields/adapter.js +30 -0
- package/dist/agents/tools/navigation/goToAddress/adapter.d.ts +10 -0
- package/dist/agents/tools/navigation/goToAddress/adapter.js +60 -0
- package/dist/agents/tools/navigation/goToBookmark/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToBookmark/adapter.js +30 -0
- package/dist/agents/tools/navigation/goToFeatures/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToFeatures/adapter.js +50 -0
- package/dist/agents/tools/navigation/goToFullExtent/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToFullExtent/adapter.js +27 -0
- package/dist/agents/tools/navigation/goToHomeExtent/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToHomeExtent/adapter.js +24 -0
- package/dist/agents/tools/navigation/goToLayer/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToLayer/adapter.js +26 -0
- package/dist/agents/tools/navigation/goToScale/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToScale/adapter.js +21 -0
- package/dist/agents/tools/navigation/goToViewpoint/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToViewpoint/adapter.js +42 -0
- package/dist/agents/tools/navigation/goToZoom/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToZoom/adapter.js +21 -0
- package/dist/agents/tools/query/getAttribute/adapter.d.ts +8 -0
- package/dist/agents/tools/query/getAttribute/adapter.js +40 -0
- package/dist/agents/tools/query/getStatistics/adapter.d.ts +8 -0
- package/dist/agents/tools/query/getStatistics/adapter.js +158 -0
- package/dist/agents/tools/query/getTopFeatures/adapter.d.ts +8 -0
- package/dist/agents/tools/query/getTopFeatures/adapter.js +145 -0
- package/dist/agents/tools/query/queryFeatures/adapter.d.ts +8 -0
- package/dist/agents/tools/query/queryFeatures/adapter.js +131 -0
- package/dist/agents/tools/search/findRelevantFields/adapter.d.ts +8 -0
- package/dist/agents/tools/search/findRelevantFields/adapter.js +57 -0
- package/dist/agents/tools/search/findRelevantLayers/adapter.d.ts +8 -0
- package/dist/agents/tools/search/findRelevantLayers/adapter.js +38 -0
- package/dist/agents/tools/shared/resolveToolArtifact.d.ts +22 -0
- package/dist/agents/tools/shared/resolveToolArtifact.js +20 -0
- package/dist/agents/tools/shared/types.d.ts +22 -0
- package/dist/agents/tools/shared/types.js +6 -0
- package/dist/cdn/24EIZVUM.js +2 -0
- package/dist/cdn/25MBI4PD.js +2 -0
- package/dist/cdn/275FFTBE.js +2 -0
- package/dist/cdn/27CK3JHY.js +2 -0
- package/dist/cdn/2F4TPWZQ.js +2 -0
- package/dist/cdn/2LVYAXHG.js +44 -0
- package/dist/cdn/2UJPYWWZ.js +3 -0
- package/dist/cdn/2WXXSZP5.js +2 -0
- package/dist/cdn/{Q7TL5Q5N.js → 3KNLFIM3.js} +2 -2
- package/dist/cdn/3PPXAIRE.js +14 -0
- package/dist/cdn/45BDE3MG.js +2 -0
- package/dist/cdn/477I66FH.js +56 -0
- package/dist/cdn/4CFCV47G.js +2 -0
- package/dist/cdn/4IWDBEMN.js +34 -0
- package/dist/cdn/4OI4QEV7.js +6 -0
- package/dist/cdn/{DXVU45KM.js → 4VBOTWC3.js} +2 -2
- package/dist/cdn/4YOG5F3W.js +2 -0
- package/dist/cdn/53KIFJFA.js +4 -0
- package/dist/cdn/5X23DDDZ.js +2 -0
- package/dist/cdn/65LCK3GG.js +3 -0
- package/dist/cdn/6KWGSXIN.js +2 -0
- package/dist/cdn/7DOYUO7L.js +71 -0
- package/dist/cdn/{WAIFKDR3.js → 7UBTNDV6.js} +2 -2
- package/dist/cdn/7Y43R7QJ.js +2 -0
- package/dist/cdn/A6LBMS7A.js +2 -0
- package/dist/cdn/AP3KPOHN.js +2 -0
- package/dist/cdn/AUCKEB52.js +2 -0
- package/dist/cdn/B3HXSEBN.js +2 -0
- package/dist/cdn/BBEGLIZC.js +2 -0
- package/dist/cdn/BJMGT6GV.js +19 -0
- package/dist/cdn/BTOBEN7Q.js +2 -0
- package/dist/cdn/BTTCBEPW.js +2 -0
- package/dist/cdn/BVUCNXC5.js +2 -0
- package/dist/cdn/CAOMMQSY.js +66 -0
- package/dist/cdn/CKUUYQLO.js +2 -0
- package/dist/cdn/{ZEYIBYSF.js → CSE6BHOJ.js} +2 -2
- package/dist/cdn/CX2HJ67C.js +2 -0
- package/dist/cdn/EGRRZTF6.js +2 -0
- package/dist/cdn/EK3PM4L5.js +2 -0
- package/dist/cdn/EXMEB4X2.js +2 -0
- package/dist/cdn/EYGZJKVD.js +2 -0
- package/dist/cdn/{24QNMEFG.js → FDRAKF5D.js} +2 -2
- package/dist/cdn/FHBRXZLV.js +2 -0
- package/dist/cdn/{5CV7R5IS.js → FK2CVSXW.js} +6 -6
- package/dist/cdn/FLUI6GCU.js +2 -0
- package/dist/cdn/{ZTBA5PM7.js → FPH52WOH.js} +2 -2
- package/dist/cdn/FRYS2PZJ.js +2 -0
- package/dist/cdn/FSLQCZRN.js +2 -0
- package/dist/cdn/{LQ6R5YRN.js → FTTLFIBV.js} +2 -2
- package/dist/cdn/FV6FHLYW.js +2 -0
- package/dist/cdn/G24MNC7D.js +6 -0
- package/dist/cdn/{F6QHMKF5.js → GW3IVAAZ.js} +2 -2
- package/dist/cdn/HI3XKFHD.js +2 -0
- package/dist/cdn/HKIA5PWU.js +2 -0
- package/dist/cdn/{6ZW7Z36F.js → HMMYCSOK.js} +4 -4
- package/dist/cdn/HNTSDY3J.js +2 -0
- package/dist/cdn/HV7MVIQV.js +2 -0
- package/dist/cdn/I3SUE2TR.js +2 -0
- package/dist/cdn/I72ST4JR.js +134 -0
- package/dist/cdn/{T537PKP4.js → IHUWQOMK.js} +2 -2
- package/dist/cdn/JMXXRRKQ.js +22 -0
- package/dist/cdn/JUNMTIB3.js +2 -0
- package/dist/cdn/{6YMR4QSD.js → JYNHWJUZ.js} +2 -2
- package/dist/cdn/KAX4A7SF.js +2 -0
- package/dist/cdn/KBSXHSBX.js +2 -0
- package/dist/cdn/KKCLHXHG.js +2 -0
- package/dist/cdn/L2HLFWCV.js +72 -0
- package/dist/cdn/{7RCQFLPP.js → L3BTURBA.js} +2 -2
- package/dist/cdn/LBTGOMCT.js +2 -0
- package/dist/cdn/LIRT72WY.js +2 -0
- package/dist/cdn/LL324IL6.js +2 -0
- package/dist/cdn/LLY5A2E2.js +2 -0
- package/dist/cdn/LXIKAXUT.js +2 -0
- package/dist/cdn/M2U456J5.js +181 -0
- package/dist/cdn/M3KKORBG.js +2 -0
- package/dist/cdn/M5B6X46F.js +2 -0
- package/dist/cdn/{X2ZDYHCG.js → MZUDIQQH.js} +11 -6
- package/dist/cdn/NBDOPGSN.js +2 -0
- package/dist/cdn/NGR5NVZE.js +2 -0
- package/dist/cdn/{5ZZGKP7N.js → NNPA3NLK.js} +2 -2
- package/dist/cdn/NV7CL4S3.js +2 -0
- package/dist/cdn/{5W7S2RS4.js → OALQBAZR.js} +2 -2
- package/dist/cdn/OF3TAARW.js +2 -0
- package/dist/cdn/{AZGGTNA3.js → OXC2WP7W.js} +2 -2
- package/dist/cdn/PJPP6LOS.js +3 -0
- package/dist/cdn/PUZ6RAFQ.js +2 -0
- package/dist/cdn/QAX6UF4L.js +99 -0
- package/dist/cdn/{NE7E52YR.js → QTEPFTAU.js} +10 -4
- package/dist/cdn/ROS22KOA.js +2 -0
- package/dist/cdn/RSM7MEVT.js +9 -0
- package/dist/cdn/SBNNJ5WA.js +2 -0
- package/dist/cdn/SDX46GZY.js +2 -0
- package/dist/cdn/SI22EJLC.js +2 -0
- package/dist/cdn/SJMAKF4P.js +2 -0
- package/dist/cdn/SNG3WODY.js +2 -0
- package/dist/cdn/STOGCXJH.js +2 -0
- package/dist/cdn/SUC2MIGE.js +2 -0
- package/dist/cdn/SXYKNDOF.js +2 -0
- package/dist/cdn/SZ2L5556.js +2 -0
- package/dist/cdn/T6W6F4TF.js +2 -0
- package/dist/cdn/TB2GJALS.js +2 -0
- package/dist/cdn/TFAJNKBC.js +2 -0
- package/dist/cdn/TLPZELG3.js +2 -0
- package/dist/cdn/TXZQZR3I.js +2 -0
- package/dist/cdn/UAZPINUQ.js +2 -0
- package/dist/cdn/UGIHS7OA.js +2 -0
- package/dist/cdn/{FX7UOGHP.js → V266DJ5V.js} +2 -2
- package/dist/cdn/V4PJMCJZ.js +2 -0
- package/dist/cdn/{P7DG5T3Z.js → V52GSTOC.js} +2 -2
- package/dist/cdn/VGLBH473.js +2 -0
- package/dist/cdn/VK6CCPTG.js +2 -0
- package/dist/cdn/{ZS2TZ6BF.js → VLPELJUS.js} +2 -2
- package/dist/cdn/VT5EWFH7.js +2 -0
- package/dist/cdn/{7CYGX4F4.js → VXLKTQ36.js} +2 -2
- package/dist/cdn/W54XYT2A.js +2 -0
- package/dist/cdn/X42ACC66.js +5 -0
- package/dist/cdn/XNUWVZN7.js +2 -0
- package/dist/cdn/XOTPSCNF.js +2 -0
- package/dist/cdn/XRVGYRXL.js +14 -0
- package/dist/cdn/XV7RMYLR.js +2 -0
- package/dist/cdn/XVJFPZTW.js +2 -0
- package/dist/cdn/XZF7Y6B2.js +2 -0
- package/dist/cdn/{UPEEHMSY.js → Y4TYL2AL.js} +2 -2
- package/dist/cdn/Y4ZOB6UH.js +2 -0
- package/dist/cdn/Y6CV2NZR.js +2 -0
- package/dist/cdn/YIXASZUW.js +2 -0
- package/dist/cdn/YOW3YKWR.js +11 -0
- package/dist/cdn/{23EQTPO3.js → ZA7ZU2F7.js} +2 -2
- package/dist/cdn/ZJWR4W2S.js +208 -0
- package/dist/cdn/ZWIKFBOU.js +2 -0
- package/dist/cdn/ZY3JQCZQ.js +179 -0
- package/dist/cdn/agent-utils/index.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/assets/assistant/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.en.json +1 -0
- package/dist/cdn/assets/assistant-message/t9n/messages.en.json +1 -0
- package/dist/cdn/assets/assistant-message-loading/t9n/messages.en.json +1 -0
- package/dist/cdn/index.js +2 -2
- package/dist/chunks/BaseWorkflow.js +1 -1
- package/dist/chunks/SKILL.js +5 -0
- package/dist/chunks/SKILL2.js +5 -0
- package/dist/chunks/SKILL3.js +22 -0
- package/dist/chunks/SKILL4.js +5 -0
- package/dist/chunks/adapter.js +1127 -2011
- package/dist/chunks/aiFactory.js +94 -0
- package/dist/chunks/arcgisKnowledgeGraph.js +97 -77
- package/dist/chunks/arcgisToolRegistry.js +88 -0
- package/dist/chunks/arcgis_knowledge_current_lc_context.js +20 -3
- package/dist/chunks/arcgis_knowledge_current_map_context.js +32 -3
- package/dist/chunks/arcgis_knowledge_cypher_query_prompt.js +102 -0
- package/dist/chunks/arcgis_knowledge_lucene_generation_prompt.js +1 -1
- package/dist/chunks/arcgis_knowledge_summarize_result_prompt.js +117 -28
- package/dist/chunks/arcgis_knowledge_tool_prompt.js +1 -1
- package/dist/chunks/baseAgentState.js +58 -0
- package/dist/chunks/converterUtils.js +67 -42
- package/dist/chunks/dataExplorationAgent.js +19 -0
- package/dist/chunks/data_explore_filter_prompt.js +1 -1
- package/dist/chunks/data_explore_query_prompt.js +10 -5
- package/dist/chunks/embeddings.worker.js +1 -1
- package/dist/chunks/fetchAgentContext.js +13 -0
- package/dist/chunks/fetchService.js +10 -0
- package/dist/chunks/fieldStatistics.js +79 -0
- package/dist/chunks/field_descriptions_prompt.js +1 -1
- package/dist/chunks/formatFeatureAttributes.js +132 -0
- package/dist/chunks/generateLayerDescriptions.js +190 -311
- package/dist/chunks/graph.js +1 -1
- package/dist/chunks/helpAgent.js +34 -0
- package/dist/chunks/help_prompt.js +35 -18
- package/dist/chunks/index.js +1 -1
- package/dist/chunks/intent_prompt.js +3 -3
- package/dist/chunks/layerStylingGraph.js +102 -84
- package/dist/chunks/layer_descriptions_prompt.js +1 -1
- package/dist/chunks/layer_styling_prompt.js +1 -1
- package/dist/chunks/mergeWhereClauses.js +15 -0
- package/dist/chunks/navigationAgent.js +27 -0
- package/dist/chunks/navigation_intent_prompt.js +9 -3
- package/dist/chunks/navigation_tool_prompt.js +1 -1
- package/dist/chunks/orchestrator.js +446 -235
- package/dist/chunks/requireAgentServices.js +11 -0
- package/dist/chunks/resolvePointGeometryFilter.js +92 -0
- package/dist/chunks/runtime.js +1 -1
- package/dist/chunks/slottableRequestUtils.js +1 -1
- package/dist/chunks/state.js +22 -28
- package/dist/chunks/summarize_query_response_prompt.js +1 -1
- package/dist/chunks/useT9n.js +1 -1
- package/dist/chunks/utils.js +1 -1
- package/dist/chunks/utils2.js +12 -12
- package/dist/chunks/utils3.js +1 -1
- package/dist/components/arcgis-assistant/customElement.d.ts +102 -1
- package/dist/components/arcgis-assistant/customElement.js +332 -184
- package/dist/components/arcgis-assistant-agent/customElement.d.ts +13 -1
- package/dist/components/arcgis-assistant-agent/customElement.js +533 -11
- package/dist/components/arcgis-assistant-chat/customElement.js +23 -18
- package/dist/components/arcgis-assistant-chat-entry/customElement.js +1 -1
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +35 -9
- package/dist/components/arcgis-assistant-help-agent/customElement.js +32 -9
- package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +4 -0
- package/dist/components/arcgis-assistant-interrupt/customElement.js +12 -13
- package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +13 -9
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.d.ts +1 -1
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +41 -17
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +31 -8
- package/dist/components/arcgis-assistant-message/customElement.d.ts +3 -0
- package/dist/components/arcgis-assistant-message/customElement.js +10 -9
- package/dist/components/arcgis-assistant-message-block/customElement.js +2 -2
- 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.d.ts +3 -0
- package/dist/components/arcgis-assistant-message-loading/customElement.js +12 -11
- 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.d.ts +1 -0
- package/dist/components/arcgis-assistant-message-text/customElement.js +13 -13
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +34 -10
- package/dist/components/arcgis-assistant-speech-input/customElement.js +35 -53
- package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +1 -1
- package/dist/components/arcgis-assistant-user-message/customElement.d.ts +2 -0
- package/dist/components/arcgis-assistant-user-message/customElement.js +16 -11
- 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 +7 -7
- package/dist/oauth-callback.html +1 -1
- package/dist/orchestrator/models/types.d.ts +1 -0
- package/dist/orchestrator/orchestrator/orchestratorEvents.d.ts +78 -0
- package/dist/orchestrator/providers/arcgis/aiFactory.d.ts +15 -0
- package/dist/orchestrator/types/types.d.ts +17 -0
- package/dist/types/lumina.d.ts +5 -4
- package/dist/types/preact.d.ts +5 -4
- package/dist/types/react.d.ts +5 -4
- package/dist/types/stencil.d.ts +7 -6
- package/dist/utils/index.d.ts +75 -39
- package/dist/utils/index.js +708 -84
- package/package.json +35 -12
- package/dist/cdn/34SG44C3.js +0 -72
- package/dist/cdn/3JGWGKT6.js +0 -2
- package/dist/cdn/3NBDVZ2I.js +0 -2
- package/dist/cdn/3VOQD2MR.js +0 -2
- package/dist/cdn/434TAA3J.js +0 -2
- package/dist/cdn/53NTYC4I.js +0 -2
- package/dist/cdn/5QAHYX7Y.js +0 -5
- package/dist/cdn/AXDZBBNL.js +0 -45
- package/dist/cdn/B7WJFBOZ.js +0 -2
- package/dist/cdn/BX7FSMUU.js +0 -56
- package/dist/cdn/CHPQM77M.js +0 -181
- package/dist/cdn/DHKUXLU3.js +0 -179
- package/dist/cdn/DQSEBKOX.js +0 -2
- package/dist/cdn/DZ2QWNUA.js +0 -3
- package/dist/cdn/EBISDZ5H.js +0 -2
- package/dist/cdn/ERL2CB2Y.js +0 -14
- package/dist/cdn/F2AHA4GB.js +0 -54
- package/dist/cdn/FUIGPHBH.js +0 -2
- package/dist/cdn/H2CHHGGH.js +0 -2
- package/dist/cdn/HWKDNS4K.js +0 -4
- package/dist/cdn/IMQ4TVHF.js +0 -16
- package/dist/cdn/IOD3GDA7.js +0 -2
- package/dist/cdn/IR7PTESF.js +0 -2
- package/dist/cdn/IRZDTYO2.js +0 -2
- package/dist/cdn/JIWK6QK6.js +0 -2
- package/dist/cdn/JLKGS6Y5.js +0 -36
- package/dist/cdn/K3JCH4XW.js +0 -2
- package/dist/cdn/KHXUWZHB.js +0 -2
- package/dist/cdn/KMQ3SP4I.js +0 -5
- package/dist/cdn/LIFK3QSD.js +0 -2
- package/dist/cdn/NXKKG5TK.js +0 -2
- package/dist/cdn/O3EN27N5.js +0 -2
- package/dist/cdn/O3RFFPU3.js +0 -6
- package/dist/cdn/PBO6FZN6.js +0 -2
- package/dist/cdn/Q3ZW4FYA.js +0 -3
- package/dist/cdn/Q6LRANX6.js +0 -2
- package/dist/cdn/QCSN44H4.js +0 -2
- package/dist/cdn/R56X6ZKR.js +0 -161
- package/dist/cdn/RUURNLTP.js +0 -2
- package/dist/cdn/T43LEBBE.js +0 -47
- package/dist/cdn/TR4GFL7X.js +0 -2
- package/dist/cdn/WNS5ZUF5.js +0 -2
- package/dist/cdn/X4XY5HIE.js +0 -2
- package/dist/cdn/XOH56EQ2.js +0 -2
- package/dist/cdn/XON27U6U.js +0 -2
- package/dist/cdn/YIMNOUTF.js +0 -2
- package/dist/cdn/YLN2BZ5J.js +0 -2
- package/dist/cdn/YUKR4AZW.js +0 -2
- package/dist/cdn/Z2G7MP5L.js +0 -22
- package/dist/chunks/dataExplorationGraph.js +0 -310
- package/dist/chunks/helpGraph.js +0 -126
- package/dist/chunks/navigationGraph.js +0 -270
- package/dist/chunks/toolCallResponse.js +0 -31
|
@@ -1,81 +1,128 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { isGraphInterrupt as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/1.0/LICENSE.txt */
|
|
2
|
+
import M from "@arcgis/core/identity/IdentityManager.js";
|
|
3
|
+
import _ from "@arcgis/core/portal/Portal.js";
|
|
4
|
+
import { g as $, a as D } from "./aiFactory.js";
|
|
5
|
+
import { isGraphInterrupt as F, StateGraph as L, START as W, END as q, MemorySaver as T } from "@langchain/langgraph/web";
|
|
6
|
+
import { generateGuid as b } from "@arcgis/toolkit/string";
|
|
7
|
+
import { g as A, D as j, b as H, W as P } from "./generateLayerDescriptions.js";
|
|
8
|
+
import { HumanMessage as U, AIMessage as O } from "@langchain/core/messages";
|
|
9
|
+
import { s as p } from "./index.js";
|
|
10
|
+
import { BaseCallbackHandler as G } from "@langchain/core/callbacks/base";
|
|
11
|
+
import * as N from "@arcgis/core/core/reactiveUtils.js";
|
|
12
|
+
import V from "@arcgis/core/layers/FeatureLayer.js";
|
|
13
|
+
import z from "@arcgis/core/request.js";
|
|
14
|
+
const B = async (n) => {
|
|
15
|
+
const e = await Q(), r = await $("default"), s = _.getDefault(), a = (await M.getCredential(`${s.url}/sharing`)).token, i = {
|
|
13
16
|
type: "generateEmbeddings",
|
|
14
|
-
webmapEmbeddings:
|
|
17
|
+
webmapEmbeddings: n,
|
|
15
18
|
auth: { apiUrl: r, token: a }
|
|
16
19
|
};
|
|
17
|
-
return e.postMessage(i), await new Promise((
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
e.removeEventListener("message",
|
|
20
|
+
return e.postMessage(i), await new Promise((o, d) => {
|
|
21
|
+
const c = (g) => {
|
|
22
|
+
g.data === "completed" && (e.removeEventListener("message", c), o());
|
|
23
|
+
}, u = (g) => {
|
|
24
|
+
e.removeEventListener("message", c), d(g instanceof Error ? g : new Error("Embeddings worker error"));
|
|
22
25
|
};
|
|
23
|
-
e.addEventListener("message",
|
|
26
|
+
e.addEventListener("message", c), e.addEventListener("error", u, { once: !0 });
|
|
24
27
|
}), e;
|
|
25
|
-
},
|
|
28
|
+
}, Q = async () => {
|
|
26
29
|
{
|
|
27
|
-
const
|
|
28
|
-
return new
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
const r =
|
|
34
|
-
if (
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
const s = r?.services.agentRegistry.list().map((
|
|
39
|
-
return await
|
|
40
|
-
},
|
|
41
|
-
if (!
|
|
42
|
-
|
|
30
|
+
const n = (await import("./embeddings.worker.js")).default;
|
|
31
|
+
return new n();
|
|
32
|
+
}
|
|
33
|
+
}, K = (n) => {
|
|
34
|
+
n.currentIntent = "none";
|
|
35
|
+
}, J = async (n, e) => {
|
|
36
|
+
const r = A(e);
|
|
37
|
+
if (n.agentExecutionContext.userRequest) {
|
|
38
|
+
const t = new U(n.agentExecutionContext.userRequest.trim());
|
|
39
|
+
n.agentExecutionContext.messages = [...n.agentExecutionContext.messages, t], K(n);
|
|
40
|
+
}
|
|
41
|
+
const s = r?.services.agentRegistry.list().map((t) => t.agent.id) ?? [];
|
|
42
|
+
return await p({ text: `Available agents: ${[...s].join(", ")}` }, e), await p({ text: "Analyzing user input" }, e), n;
|
|
43
|
+
}, X = async (n, e) => (await p({ text: "Exiting..." }, e), n), E = (n) => typeof n == "object" && n !== null && !Array.isArray(n), Y = (n, e) => {
|
|
44
|
+
if (!E(n)) {
|
|
45
|
+
n !== void 0 && console.warn(`Agent "${e}" returned invalid sharedStatePatch. Ignoring it.`);
|
|
43
46
|
return;
|
|
44
47
|
}
|
|
45
48
|
const r = {};
|
|
46
|
-
for (const [s,
|
|
47
|
-
if (!
|
|
49
|
+
for (const [s, t] of Object.entries(n)) {
|
|
50
|
+
if (!E(t) || !("value" in t)) {
|
|
48
51
|
console.warn(
|
|
49
52
|
`Agent "${e}" returned invalid sharedStatePatch entry for key "${s}". Ignoring that entry.`
|
|
50
53
|
);
|
|
51
54
|
continue;
|
|
52
55
|
}
|
|
53
|
-
r[s] = { value:
|
|
56
|
+
r[s] = { value: t.value };
|
|
54
57
|
}
|
|
55
58
|
return r;
|
|
56
|
-
},
|
|
57
|
-
const { previousSharedState: e, patch: r, agentId: s } =
|
|
59
|
+
}, Z = (n) => {
|
|
60
|
+
const { previousSharedState: e, patch: r, agentId: s } = n;
|
|
58
61
|
if (!r)
|
|
59
62
|
return e;
|
|
60
|
-
const
|
|
63
|
+
const t = Date.now(), a = {
|
|
61
64
|
...e
|
|
62
65
|
};
|
|
63
|
-
for (const [i,
|
|
64
|
-
|
|
65
|
-
value:
|
|
66
|
+
for (const [i, o] of Object.entries(r))
|
|
67
|
+
o?.value !== void 0 && (a[i] = {
|
|
68
|
+
value: o.value,
|
|
66
69
|
meta: {
|
|
67
70
|
updatedByAgentId: s,
|
|
68
|
-
updatedAt:
|
|
71
|
+
updatedAt: t
|
|
69
72
|
}
|
|
70
73
|
});
|
|
71
74
|
return a;
|
|
72
|
-
},
|
|
73
|
-
if (
|
|
75
|
+
}, ee = 256, te = /* @__PURE__ */ new Set(["point", "polyline", "polygon", "extent", "custom"]), ne = (n) => typeof n == "object" && n !== null && !Array.isArray(n), re = (n, e) => {
|
|
76
|
+
if (n === void 0)
|
|
74
77
|
return;
|
|
75
|
-
|
|
78
|
+
if (!Array.isArray(n)) {
|
|
79
|
+
console.warn(`Agent "${e}" returned invalid sharedResourceAdditions. Ignoring it.`);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const r = [];
|
|
83
|
+
for (const [s, t] of n.entries()) {
|
|
84
|
+
if (!ne(t) || typeof t.kind != "string" || !te.has(t.kind) || typeof t.description != "string" || !t.description.trim() || !("payload" in t) || t.payload === void 0) {
|
|
85
|
+
console.warn(
|
|
86
|
+
`Agent "${e}" returned invalid sharedResourceAdditions entry at index ${s}. Ignoring that entry.`
|
|
87
|
+
);
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
let a;
|
|
91
|
+
try {
|
|
92
|
+
a = structuredClone(t.payload);
|
|
93
|
+
} catch {
|
|
94
|
+
console.warn(
|
|
95
|
+
`Agent "${e}" returned invalid sharedResourceAdditions entry at index ${s}. Ignoring that entry.`
|
|
96
|
+
);
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
r.push({
|
|
100
|
+
kind: t.kind,
|
|
101
|
+
description: t.description.trim().slice(0, ee),
|
|
102
|
+
payload: a
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return r.length ? r : void 0;
|
|
106
|
+
}, se = (n) => {
|
|
107
|
+
const { previousSharedResources: e, additions: r, agentId: s } = n;
|
|
108
|
+
if (!r?.length)
|
|
109
|
+
return e;
|
|
110
|
+
const t = Date.now(), a = r.map((i) => ({
|
|
111
|
+
...i,
|
|
112
|
+
id: b(),
|
|
113
|
+
meta: {
|
|
114
|
+
createdByAgentId: s,
|
|
115
|
+
createdAt: t
|
|
116
|
+
}
|
|
117
|
+
}));
|
|
118
|
+
return [...e, ...a].slice(-50);
|
|
119
|
+
}, R = (n) => {
|
|
120
|
+
if (typeof n != "string")
|
|
121
|
+
return;
|
|
122
|
+
const e = n.trim();
|
|
76
123
|
return e || void 0;
|
|
77
|
-
},
|
|
78
|
-
switch (
|
|
124
|
+
}, ae = (n) => {
|
|
125
|
+
switch (n) {
|
|
79
126
|
case "failed":
|
|
80
127
|
return "Agent failed without a summary.";
|
|
81
128
|
case "unknown":
|
|
@@ -85,98 +132,195 @@ const T = async (t) => {
|
|
|
85
132
|
default:
|
|
86
133
|
return "Agent completed without a summary.";
|
|
87
134
|
}
|
|
88
|
-
},
|
|
89
|
-
const r =
|
|
90
|
-
a === "unknown" && console.warn(`Agent "${
|
|
91
|
-
const i =
|
|
135
|
+
}, ie = (n, e) => {
|
|
136
|
+
const r = R(e?.outputMessage), s = R(e?.summary), t = e?.status, a = t === "success" || t === "failed" ? t : "unknown";
|
|
137
|
+
a === "unknown" && console.warn(`Agent "${n}" returned missing/invalid status. Defaulting to "unknown".`);
|
|
138
|
+
const i = Y(e?.sharedStatePatch, n), o = re(e?.sharedResourceAdditions, n);
|
|
92
139
|
return {
|
|
93
140
|
outputMessage: r,
|
|
94
|
-
summary: s ?? r ??
|
|
141
|
+
summary: s ?? r ?? ae(a),
|
|
95
142
|
status: a,
|
|
96
|
-
sharedStatePatch: i
|
|
143
|
+
sharedStatePatch: i,
|
|
144
|
+
sharedResourceAdditions: o
|
|
97
145
|
};
|
|
98
|
-
},
|
|
99
|
-
const r =
|
|
100
|
-
if (
|
|
101
|
-
return await
|
|
102
|
-
...
|
|
146
|
+
}, x = 4e3, oe = async (n, e) => {
|
|
147
|
+
const r = A(e);
|
|
148
|
+
if (e?.signal?.aborted)
|
|
149
|
+
return await p({ text: "Run cancelled; skipping agent execution" }, e), {
|
|
150
|
+
...n,
|
|
103
151
|
currentIntent: "none",
|
|
104
152
|
requiresFollowUp: !1
|
|
105
153
|
};
|
|
106
|
-
const { agentRegistry: s } = r?.services ?? {},
|
|
107
|
-
if (!
|
|
108
|
-
return console.warn(`No agent found for intent: ${
|
|
109
|
-
await
|
|
154
|
+
const { agentRegistry: s } = r?.services ?? {}, t = s?.get(n.currentIntent);
|
|
155
|
+
if (!t)
|
|
156
|
+
return console.warn(`No agent found for intent: ${n.currentIntent}`), n;
|
|
157
|
+
await p({ text: `Executing registered agent: ${t.agent.name}` }, e);
|
|
110
158
|
const a = {
|
|
111
159
|
...e ?? {},
|
|
160
|
+
metadata: {
|
|
161
|
+
...e?.metadata,
|
|
162
|
+
agentId: t.agent.id
|
|
163
|
+
},
|
|
112
164
|
configurable: {
|
|
113
165
|
...r ?? {},
|
|
114
|
-
agentId:
|
|
115
|
-
context:
|
|
166
|
+
agentId: t.agent.id,
|
|
167
|
+
context: t.getContext ? await t.getContext() : void 0
|
|
116
168
|
}
|
|
117
169
|
};
|
|
118
170
|
let i;
|
|
119
171
|
try {
|
|
120
|
-
const
|
|
172
|
+
const c = await t.agent.createGraph().compile().invoke(
|
|
121
173
|
{
|
|
122
174
|
agentExecutionContext: {
|
|
123
|
-
...
|
|
175
|
+
...n.agentExecutionContext,
|
|
124
176
|
// deep clone on messages did not work in agents, so its a shallow clone here.
|
|
125
|
-
messages: [...
|
|
177
|
+
messages: [...n.agentExecutionContext.messages],
|
|
126
178
|
// deep clone to prevent accidental mutations by agents
|
|
127
|
-
priorSteps: structuredClone(
|
|
128
|
-
sharedState: structuredClone(
|
|
179
|
+
priorSteps: structuredClone(n.agentExecutionContext.priorSteps ?? []),
|
|
180
|
+
sharedState: structuredClone(n.agentExecutionContext.sharedState ?? {}),
|
|
181
|
+
sharedResources: structuredClone(n.agentExecutionContext.sharedResources ?? [])
|
|
129
182
|
}
|
|
130
183
|
},
|
|
131
184
|
a
|
|
132
185
|
);
|
|
133
|
-
i =
|
|
134
|
-
} catch (
|
|
135
|
-
if (
|
|
136
|
-
throw
|
|
137
|
-
const
|
|
138
|
-
console.error(`Agent "${
|
|
186
|
+
i = ie(t.agent.name, c), await p({ text: `Finished executing registered agent: ${t.agent.name}` }, e);
|
|
187
|
+
} catch (c) {
|
|
188
|
+
if (F(c) || e?.signal?.aborted || c instanceof Error && c.name === "AbortError")
|
|
189
|
+
throw c;
|
|
190
|
+
const u = c instanceof Error ? c.message : String(c);
|
|
191
|
+
console.error(`Agent "${t.agent.name}" failed:`, c), await p({ text: `Registered agent failed: ${t.agent.name}. ${u}` }, e), i = {
|
|
139
192
|
status: "failed",
|
|
140
|
-
outputMessage: `Agent execution failed: ${
|
|
141
|
-
summary: `Agent execution failed: ${
|
|
193
|
+
outputMessage: `Agent execution failed: ${u}`,
|
|
194
|
+
summary: `Agent execution failed: ${u}`
|
|
142
195
|
};
|
|
143
196
|
}
|
|
144
|
-
const
|
|
145
|
-
if (
|
|
146
|
-
const
|
|
147
|
-
[truncated]` :
|
|
148
|
-
d.push(new
|
|
197
|
+
const o = i.outputMessage, d = [...n.agentExecutionContext.messages];
|
|
198
|
+
if (o) {
|
|
199
|
+
const c = o.length > x ? `${o.slice(0, x - 14)}
|
|
200
|
+
[truncated]` : o;
|
|
201
|
+
d.push(new O(c));
|
|
149
202
|
}
|
|
150
203
|
return {
|
|
151
|
-
...
|
|
152
|
-
stepCount:
|
|
153
|
-
lastExecutedAgent:
|
|
154
|
-
requiresFollowUp: i.status === "failed" ? !0 :
|
|
155
|
-
finalOutputMessage:
|
|
204
|
+
...n,
|
|
205
|
+
stepCount: n.stepCount + 1,
|
|
206
|
+
lastExecutedAgent: t.agent.id,
|
|
207
|
+
requiresFollowUp: i.status === "failed" ? !0 : n.requiresFollowUp,
|
|
208
|
+
finalOutputMessage: o ?? "",
|
|
156
209
|
agentExecutionContext: {
|
|
157
|
-
...
|
|
210
|
+
...n.agentExecutionContext,
|
|
158
211
|
messages: d,
|
|
159
212
|
priorSteps: [
|
|
160
|
-
...
|
|
213
|
+
...n.agentExecutionContext.priorSteps ?? [],
|
|
161
214
|
{
|
|
162
|
-
agentId:
|
|
163
|
-
assignedTask:
|
|
215
|
+
agentId: t.agent.id,
|
|
216
|
+
assignedTask: n.agentExecutionContext.assignedTask,
|
|
164
217
|
summary: i?.summary || "No summary provided.",
|
|
165
218
|
status: i?.status || "unknown"
|
|
166
219
|
}
|
|
167
220
|
],
|
|
168
|
-
sharedState:
|
|
169
|
-
previousSharedState:
|
|
221
|
+
sharedState: Z({
|
|
222
|
+
previousSharedState: n.agentExecutionContext.sharedState,
|
|
170
223
|
patch: i.sharedStatePatch,
|
|
171
|
-
agentId:
|
|
224
|
+
agentId: t.agent.id
|
|
225
|
+
}),
|
|
226
|
+
sharedResources: se({
|
|
227
|
+
previousSharedResources: n.agentExecutionContext.sharedResources,
|
|
228
|
+
additions: i.sharedResourceAdditions,
|
|
229
|
+
agentId: t.agent.id
|
|
172
230
|
})
|
|
173
231
|
}
|
|
174
232
|
};
|
|
175
|
-
},
|
|
176
|
-
"
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
233
|
+
}, ce = async (n, e) => {
|
|
234
|
+
if (n.routing.mode !== "direct")
|
|
235
|
+
throw new Error("Direct agent assignment requires direct routing.");
|
|
236
|
+
return await p({ text: `Doing a direct route to agent: ${n.routing.agentId}` }, e), {
|
|
237
|
+
...n,
|
|
238
|
+
currentIntent: n.routing.agentId,
|
|
239
|
+
requiresFollowUp: !1,
|
|
240
|
+
agentExecutionContext: {
|
|
241
|
+
...n.agentExecutionContext,
|
|
242
|
+
assignedTask: n.agentExecutionContext.userRequest
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
}, de = 3, ue = (n) => n.routing.mode === "direct" ? "assignDirectAgent" : "intentLLM", ge = (n) => n.routing.mode === "direct" || n.stepCount >= de || !n.requiresFollowUp ? "exit" : "intentLLM", le = () => new L(j).addNode("ingestInput", J).addNode("assignDirectAgent", ce).addNode("intentLLM", H).addNode("executeRegisteredAgent", oe).addNode("exit", X).addEdge(W, "ingestInput").addConditionalEdges("ingestInput", ue).addEdge("assignDirectAgent", "executeRegisteredAgent").addConditionalEdges("intentLLM", (e) => e.currentIntent === "none" || e.currentIntent === e.lastExecutedAgent ? "exit" : "executeRegisteredAgent").addConditionalEdges("executeRegisteredAgent", ge).addEdge("exit", q), he = (n, e) => {
|
|
246
|
+
const r = n.output?.usage_metadata ?? e.usage_metadata, s = n.output?.llmOutput?.tokenUsage, t = r?.input_tokens ?? s?.promptTokens, a = r?.output_tokens ?? s?.completionTokens, i = r?.total_tokens ?? s?.totalTokens;
|
|
247
|
+
if (t === void 0 || a === void 0 || i === void 0)
|
|
248
|
+
return;
|
|
249
|
+
const o = r?.input_token_details?.cache_read, d = r?.output_token_details?.reasoning;
|
|
250
|
+
return {
|
|
251
|
+
input: t,
|
|
252
|
+
output: a,
|
|
253
|
+
total: i,
|
|
254
|
+
...o !== void 0 && { cacheRead: o },
|
|
255
|
+
...d !== void 0 && { reasoning: d }
|
|
256
|
+
};
|
|
257
|
+
}, pe = (n, e, r, s) => {
|
|
258
|
+
switch (n) {
|
|
259
|
+
case "chat_model":
|
|
260
|
+
case "llm":
|
|
261
|
+
return "model";
|
|
262
|
+
case "tool":
|
|
263
|
+
case "retriever":
|
|
264
|
+
return n;
|
|
265
|
+
case "chain":
|
|
266
|
+
return !s || e === "LangGraph" ? "workflow" : r === e ? "node" : "chain";
|
|
267
|
+
default:
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
}, me = (n) => {
|
|
271
|
+
if (n instanceof Error)
|
|
272
|
+
return { message: n.message, name: n.name };
|
|
273
|
+
const e = n, r = typeof e?.message == "string" ? e.message : String(n ?? "Unknown runtime error"), s = typeof e?.name == "string" ? e.name : void 0;
|
|
274
|
+
return { message: r, ...s && { name: s } };
|
|
275
|
+
}, ye = ({
|
|
276
|
+
event: n,
|
|
277
|
+
runId: e,
|
|
278
|
+
parentSpanId: r,
|
|
279
|
+
timestamp: s
|
|
280
|
+
}) => {
|
|
281
|
+
const t = /^on_(.+)_(start|end|error)$/u.exec(n.event);
|
|
282
|
+
if (!t)
|
|
283
|
+
return;
|
|
284
|
+
const [, a, i] = t, o = n.metadata ?? {}, d = o.langgraph_node, c = pe(a, n.name, d, r);
|
|
285
|
+
if (!c)
|
|
286
|
+
return;
|
|
287
|
+
const u = o.agentId, g = o.model ?? o.ls_model_name, l = n.data, f = i === "end" && c === "model" ? he(l, o) : void 0, h = n.tags?.includes("langsmith:hidden") || d === "__start__", v = {
|
|
288
|
+
...g && { model: g },
|
|
289
|
+
...f && { tokenUsage: f },
|
|
290
|
+
...h && { internal: !0 }
|
|
291
|
+
}, w = {
|
|
292
|
+
id: n.run_id,
|
|
293
|
+
...r && { parentId: r },
|
|
294
|
+
label: n.name,
|
|
295
|
+
type: c,
|
|
296
|
+
...Object.keys(v).length && { metadata: v }
|
|
297
|
+
}, m = { runId: e, timestamp: s, type: "runtime", ...u && { agentId: u } };
|
|
298
|
+
switch (i) {
|
|
299
|
+
case "start":
|
|
300
|
+
return {
|
|
301
|
+
...m,
|
|
302
|
+
phase: "started",
|
|
303
|
+
span: {
|
|
304
|
+
...w,
|
|
305
|
+
...l?.input !== void 0 && { input: l.input }
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
case "end":
|
|
309
|
+
return {
|
|
310
|
+
...m,
|
|
311
|
+
phase: "completed",
|
|
312
|
+
span: {
|
|
313
|
+
...w,
|
|
314
|
+
...l?.output !== void 0 && { output: l.output }
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
case "error":
|
|
318
|
+
return { ...m, phase: "failed", span: { ...w, error: me(l?.error) } };
|
|
319
|
+
default:
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
class S {
|
|
180
324
|
constructor() {
|
|
181
325
|
this.agentRegistry = /* @__PURE__ */ new Map();
|
|
182
326
|
}
|
|
@@ -193,7 +337,7 @@ class Z {
|
|
|
193
337
|
return [...this.agentRegistry.values()];
|
|
194
338
|
}
|
|
195
339
|
}
|
|
196
|
-
class
|
|
340
|
+
class fe {
|
|
197
341
|
/**
|
|
198
342
|
* Create a new InterruptHandler tied to a specific compiled graph and config.
|
|
199
343
|
*/
|
|
@@ -217,7 +361,7 @@ class ee {
|
|
|
217
361
|
agentId: e.agentId,
|
|
218
362
|
id: e.id,
|
|
219
363
|
payload: r
|
|
220
|
-
},
|
|
364
|
+
}, t = this.graph.streamEvents(null, {
|
|
221
365
|
...this.config,
|
|
222
366
|
configurable: {
|
|
223
367
|
...this.config.configurable,
|
|
@@ -226,7 +370,7 @@ class ee {
|
|
|
226
370
|
subgraphs: !0,
|
|
227
371
|
version: "v2"
|
|
228
372
|
});
|
|
229
|
-
this.resolveWait?.(
|
|
373
|
+
this.resolveWait?.(t);
|
|
230
374
|
} catch (s) {
|
|
231
375
|
this.rejectWait?.(s);
|
|
232
376
|
} finally {
|
|
@@ -240,157 +384,157 @@ class ee {
|
|
|
240
384
|
this.rejectWait && (this.rejectWait(new Error("Request cancelled by user.")), this.resolveWait = void 0, this.rejectWait = void 0);
|
|
241
385
|
}
|
|
242
386
|
}
|
|
243
|
-
const
|
|
387
|
+
const we = async (n) => {
|
|
244
388
|
try {
|
|
245
|
-
return await (await
|
|
389
|
+
return await (await D()).embedDocuments(n);
|
|
246
390
|
} catch (e) {
|
|
247
391
|
throw console.error("Failed to generate embeddings:", e), e;
|
|
248
392
|
}
|
|
249
|
-
},
|
|
250
|
-
const r = e.get(
|
|
393
|
+
}, C = async (n, e) => {
|
|
394
|
+
const r = e.get(n);
|
|
251
395
|
if (r)
|
|
252
396
|
return r;
|
|
253
|
-
const s = await
|
|
254
|
-
return e.set(
|
|
397
|
+
const s = await we([n]);
|
|
398
|
+
return e.set(n, s[0]), s[0];
|
|
255
399
|
};
|
|
256
|
-
async function
|
|
257
|
-
const
|
|
400
|
+
async function ve(n, e, r, s) {
|
|
401
|
+
const t = `req-${Date.now()}`, i = {
|
|
258
402
|
type: "layerSearch",
|
|
259
|
-
precomputedEmbedding: s ? await
|
|
260
|
-
requestId:
|
|
403
|
+
precomputedEmbedding: s ? await C(n, s) : void 0,
|
|
404
|
+
requestId: t,
|
|
261
405
|
minScore: r
|
|
262
406
|
};
|
|
263
|
-
return await new Promise((
|
|
264
|
-
const d = (
|
|
265
|
-
|
|
407
|
+
return await new Promise((o) => {
|
|
408
|
+
const d = (c) => {
|
|
409
|
+
c.data.requestId === t && o(c.data.results);
|
|
266
410
|
};
|
|
267
411
|
e.addEventListener("message", d, { once: !0 }), e.postMessage(i);
|
|
268
412
|
});
|
|
269
413
|
}
|
|
270
|
-
function
|
|
271
|
-
const { worker: e } =
|
|
414
|
+
function Ee(n) {
|
|
415
|
+
const { worker: e } = n;
|
|
272
416
|
return {
|
|
273
417
|
async searchLayers({
|
|
274
418
|
text: r,
|
|
275
419
|
minScore: s,
|
|
276
|
-
embeddingCache:
|
|
420
|
+
embeddingCache: t
|
|
277
421
|
}) {
|
|
278
|
-
return await
|
|
422
|
+
return await ve(r, e, s, t);
|
|
279
423
|
}
|
|
280
424
|
};
|
|
281
425
|
}
|
|
282
|
-
const
|
|
283
|
-
combinedQuery:
|
|
426
|
+
const Re = async ({
|
|
427
|
+
combinedQuery: n,
|
|
284
428
|
layerIds: e,
|
|
285
429
|
embeddingsWorker: r,
|
|
286
430
|
minScore: s,
|
|
287
|
-
topResults:
|
|
431
|
+
topResults: t,
|
|
288
432
|
embeddingCache: a
|
|
289
433
|
}) => {
|
|
290
|
-
const i = `req-${Date.now()}`,
|
|
434
|
+
const i = `req-${Date.now()}`, o = a ? await C(n, a) : void 0, d = {
|
|
291
435
|
type: "fieldSearch",
|
|
292
436
|
layerIdForFieldsSearch: e,
|
|
293
|
-
precomputedEmbedding:
|
|
437
|
+
precomputedEmbedding: o,
|
|
294
438
|
requestId: i,
|
|
295
439
|
minScore: s,
|
|
296
|
-
topResults:
|
|
440
|
+
topResults: t
|
|
297
441
|
};
|
|
298
|
-
return await new Promise((
|
|
299
|
-
const
|
|
300
|
-
if (
|
|
442
|
+
return await new Promise((c) => {
|
|
443
|
+
const u = (g) => {
|
|
444
|
+
if (g.data.requestId !== i)
|
|
301
445
|
return;
|
|
302
|
-
const
|
|
303
|
-
layerId:
|
|
304
|
-
results:
|
|
446
|
+
const l = g.data.results.map(({ layerId: f, results: h }) => ({
|
|
447
|
+
layerId: f,
|
|
448
|
+
results: h
|
|
305
449
|
}));
|
|
306
|
-
|
|
450
|
+
c(l);
|
|
307
451
|
};
|
|
308
|
-
r.addEventListener("message",
|
|
452
|
+
r.addEventListener("message", u, { once: !0 }), r.postMessage(d);
|
|
309
453
|
});
|
|
310
454
|
};
|
|
311
|
-
function
|
|
312
|
-
const { worker: e } =
|
|
455
|
+
function xe(n) {
|
|
456
|
+
const { worker: e } = n;
|
|
313
457
|
return {
|
|
314
|
-
async searchFields({ text: r, layerIds: s, minScore:
|
|
315
|
-
return await
|
|
458
|
+
async searchFields({ text: r, layerIds: s, minScore: t, topResults: a, embeddingCache: i }) {
|
|
459
|
+
return await Re({
|
|
316
460
|
combinedQuery: r,
|
|
317
461
|
layerIds: s,
|
|
318
462
|
embeddingsWorker: e,
|
|
319
|
-
minScore:
|
|
463
|
+
minScore: t,
|
|
320
464
|
topResults: a,
|
|
321
465
|
embeddingCache: i
|
|
322
466
|
});
|
|
323
467
|
}
|
|
324
468
|
};
|
|
325
469
|
}
|
|
326
|
-
const
|
|
327
|
-
const e =
|
|
470
|
+
const Se = (n) => {
|
|
471
|
+
const e = P.safeParse(n);
|
|
328
472
|
if (!e.success)
|
|
329
473
|
throw new Error("Embeddings response validation failed. Regenerate embeddings.");
|
|
330
474
|
return e.data;
|
|
331
|
-
},
|
|
475
|
+
}, be = (n, e) => {
|
|
332
476
|
const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
333
|
-
if (e.allLayers.forEach((
|
|
334
|
-
|
|
335
|
-
}),
|
|
477
|
+
if (e.allLayers.forEach((t) => {
|
|
478
|
+
t instanceof V && s.set(t.id, t);
|
|
479
|
+
}), n.length !== s.size)
|
|
336
480
|
throw new Error("Layer count mismatch during registry restoration. Regenerate embeddings.");
|
|
337
|
-
for (const
|
|
338
|
-
const a = s.get(
|
|
481
|
+
for (const t of n) {
|
|
482
|
+
const a = s.get(t.id);
|
|
339
483
|
if (!a)
|
|
340
484
|
throw new Error(
|
|
341
|
-
`Layer with ID ${
|
|
485
|
+
`Layer with ID ${t.id} not found in the original map during registry restoration. Regenerate embeddings.`
|
|
342
486
|
);
|
|
343
|
-
if (
|
|
487
|
+
if (t.fields.length !== a.fields.length)
|
|
344
488
|
throw new Error(
|
|
345
|
-
`Field count mismatch for layer ID ${
|
|
489
|
+
`Field count mismatch for layer ID ${t.id} during registry restoration. Regenerate embeddings.`
|
|
346
490
|
);
|
|
347
491
|
const i = {
|
|
348
|
-
name:
|
|
349
|
-
title:
|
|
350
|
-
description:
|
|
351
|
-
},
|
|
352
|
-
for (const d of
|
|
353
|
-
const
|
|
354
|
-
if (!
|
|
492
|
+
name: t.name,
|
|
493
|
+
title: t.title,
|
|
494
|
+
description: t.description
|
|
495
|
+
}, o = /* @__PURE__ */ new Map();
|
|
496
|
+
for (const d of t.fields) {
|
|
497
|
+
const c = a.fieldsIndex.get(d.name);
|
|
498
|
+
if (!c)
|
|
355
499
|
throw new Error(
|
|
356
|
-
`Field with name ${d.name} not found in the original layer ${
|
|
500
|
+
`Field with name ${d.name} not found in the original layer ${t.id} during registry restoration. Regenerate embeddings.`
|
|
357
501
|
);
|
|
358
|
-
|
|
502
|
+
o.set(d.name, {
|
|
359
503
|
name: d.name,
|
|
360
504
|
alias: a.getFieldAlias(d.name) ?? d.alias,
|
|
361
505
|
description: d.description,
|
|
362
|
-
type:
|
|
363
|
-
valueType:
|
|
506
|
+
type: c.type || "unknown",
|
|
507
|
+
valueType: c.valueType || "unknown",
|
|
364
508
|
domain: a.getFieldDomain(d.name) ?? void 0
|
|
365
509
|
});
|
|
366
510
|
}
|
|
367
|
-
r.set(
|
|
511
|
+
r.set(t.id, {
|
|
368
512
|
layerItem: i,
|
|
369
|
-
fieldRegistry:
|
|
513
|
+
fieldRegistry: o
|
|
370
514
|
});
|
|
371
515
|
}
|
|
372
516
|
return r;
|
|
373
|
-
},
|
|
517
|
+
}, Ae = async (n) => {
|
|
374
518
|
try {
|
|
375
|
-
return (await
|
|
519
|
+
return (await z(n, {
|
|
376
520
|
responseType: "json"
|
|
377
521
|
})).data;
|
|
378
522
|
} catch (e) {
|
|
379
|
-
throw new Error(`Failed to fetch data from ${
|
|
523
|
+
throw new Error(`Failed to fetch data from ${n}: ${String(e)}`);
|
|
380
524
|
}
|
|
381
|
-
},
|
|
382
|
-
const e =
|
|
525
|
+
}, Ce = async (n) => {
|
|
526
|
+
const e = n.map;
|
|
383
527
|
if (!e?.portalItem)
|
|
384
528
|
throw new Error("WebMap portal item is missing.");
|
|
385
529
|
const { resources: r } = await e.portalItem.fetchResources(), s = r.find((i) => i.resource.path === "embeddings-v01.json");
|
|
386
530
|
if (!s?.resource.url)
|
|
387
531
|
throw new Error("Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.");
|
|
388
|
-
const
|
|
389
|
-
return
|
|
532
|
+
const t = await Ae(s.resource.url);
|
|
533
|
+
return Se(t);
|
|
390
534
|
};
|
|
391
|
-
class
|
|
535
|
+
class k {
|
|
392
536
|
constructor() {
|
|
393
|
-
this.orchestratorReady = !1, this.chatHistory = [], this.priorSteps = [], this.sharedState = {}, this.agentRegistry = new
|
|
537
|
+
this.orchestratorReady = !1, this.chatHistory = [], this.priorSteps = [], this.sharedState = {}, this.sharedResources = [], this.agentRegistry = new S(), this.activeRunId = "", this.cancelledRunIds = /* @__PURE__ */ new Set(), this.parentRunIds = /* @__PURE__ */ new Map(), this.activeRuntimeSpans = /* @__PURE__ */ new Map(), this.runtimeEventsEnabled = !1, this.streamEpoch = 0;
|
|
394
538
|
}
|
|
395
539
|
/**
|
|
396
540
|
* Creates and returns an AI-ready Orchestrator instance.
|
|
@@ -398,15 +542,16 @@ class x {
|
|
|
398
542
|
* @returns Ready Orchestrator.
|
|
399
543
|
*/
|
|
400
544
|
static async init(e) {
|
|
401
|
-
const r = new
|
|
545
|
+
const r = new k();
|
|
546
|
+
r.runtimeEventsEnabled = e.runtimeEventsEnabled ?? !1;
|
|
402
547
|
try {
|
|
403
548
|
if (e.view?.map) {
|
|
404
|
-
await
|
|
405
|
-
const s = await
|
|
549
|
+
await N.whenOnce(() => e.view.ready);
|
|
550
|
+
const s = await Ce(e.view), t = be(
|
|
406
551
|
s.layers,
|
|
407
552
|
e.view.map
|
|
408
553
|
);
|
|
409
|
-
r.layersAndFieldsRegistry =
|
|
554
|
+
r.layersAndFieldsRegistry = t, r.embeddingsWorker = await B(s);
|
|
410
555
|
}
|
|
411
556
|
return e.agents?.forEach((s) => {
|
|
412
557
|
r.agentRegistry.register(s);
|
|
@@ -422,97 +567,105 @@ class x {
|
|
|
422
567
|
* - `interrupt`: HITL required, wait for `resumeInterrupt()`
|
|
423
568
|
* - `completed`: final result with chat history + layer styling
|
|
424
569
|
* - `cancelled`: user aborted the run
|
|
570
|
+
* @param userInput User request to process.
|
|
571
|
+
* @param options Agent selection and routing behavior for this run.
|
|
425
572
|
*/
|
|
426
|
-
async *ask(e) {
|
|
573
|
+
async *ask(e, r = {}) {
|
|
427
574
|
if (!this.orchestratorReady)
|
|
428
575
|
throw new Error("Orchestrator is not ready yet.");
|
|
429
576
|
if (!this.agentRegistry.list().length)
|
|
430
577
|
throw new Error("Orchestrator has no registered agents.");
|
|
578
|
+
const s = this.createRequestAgentRegistry(r);
|
|
579
|
+
if (!s.list().length)
|
|
580
|
+
throw new Error("Orchestrator has no agents selected for this request.");
|
|
431
581
|
if (++this.streamEpoch, !e.trim())
|
|
432
582
|
return;
|
|
433
|
-
const
|
|
434
|
-
this.activeRunId =
|
|
435
|
-
const
|
|
583
|
+
const t = b();
|
|
584
|
+
this.parentRunIds.clear(), this.activeRuntimeSpans.clear(), this.activeRunId = t, this.activeAbortController = new AbortController(), this.graph || (this.graph = le().compile({ checkpointer: new T() }));
|
|
585
|
+
const a = this.embeddingsWorker ? Ee({ worker: this.embeddingsWorker }) : void 0, i = this.embeddingsWorker ? xe({ worker: this.embeddingsWorker }) : void 0, o = /* @__PURE__ */ new Map(), d = r.routing === "direct" ? { mode: "direct", agentId: r.agentId } : { mode: "auto" }, c = {
|
|
586
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
587
|
+
thread_id: t,
|
|
588
|
+
hitlResponse: null,
|
|
589
|
+
services: {
|
|
590
|
+
layerSearch: a,
|
|
591
|
+
fieldSearch: i,
|
|
592
|
+
layersAndFieldsRegistry: this.layersAndFieldsRegistry,
|
|
593
|
+
agentRegistry: s,
|
|
594
|
+
embeddingCache: o
|
|
595
|
+
}
|
|
596
|
+
}, u = {
|
|
436
597
|
version: "v2",
|
|
437
598
|
streamMode: "custom",
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
abortSignal: this.activeAbortController.signal,
|
|
442
|
-
hitlResponse: null,
|
|
443
|
-
services: {
|
|
444
|
-
layerSearch: s,
|
|
445
|
-
fieldSearch: n,
|
|
446
|
-
layersAndFieldsRegistry: this.layersAndFieldsRegistry,
|
|
447
|
-
agentRegistry: this.agentRegistry,
|
|
448
|
-
embeddingCache: a
|
|
449
|
-
}
|
|
450
|
-
},
|
|
599
|
+
signal: this.activeAbortController.signal,
|
|
600
|
+
...this.runtimeEventsEnabled && { callbacks: [this.createHierarchyCallback()] },
|
|
601
|
+
configurable: c,
|
|
451
602
|
subgraphs: !0
|
|
452
|
-
},
|
|
603
|
+
}, g = this.graph?.streamEvents(
|
|
453
604
|
{
|
|
605
|
+
routing: d,
|
|
454
606
|
agentExecutionContext: {
|
|
455
607
|
userRequest: e,
|
|
456
608
|
messages: this.chatHistory,
|
|
457
609
|
priorSteps: this.priorSteps,
|
|
458
|
-
sharedState: this.sharedState
|
|
610
|
+
sharedState: this.sharedState,
|
|
611
|
+
sharedResources: this.sharedResources
|
|
459
612
|
}
|
|
460
613
|
},
|
|
461
|
-
|
|
462
|
-
),
|
|
463
|
-
if (yield* this.pipeStream(
|
|
464
|
-
yield
|
|
614
|
+
u
|
|
615
|
+
), l = ++this.streamEpoch;
|
|
616
|
+
if (yield* this.pipeStream(g, l, t), this.isRunCancelled(t)) {
|
|
617
|
+
yield* this.createCancellationEvents(t);
|
|
465
618
|
return;
|
|
466
619
|
}
|
|
467
620
|
for (; ; ) {
|
|
468
|
-
if (this.isRunCancelled(
|
|
469
|
-
yield
|
|
621
|
+
if (this.isRunCancelled(t)) {
|
|
622
|
+
yield* this.createCancellationEvents(t);
|
|
470
623
|
return;
|
|
471
624
|
}
|
|
472
|
-
const m = (await this.graph.getState(
|
|
625
|
+
const m = (await this.graph.getState(u, { subgraphs: !0 })).tasks.find((y) => y.interrupts.length > 0)?.interrupts[0]?.value;
|
|
473
626
|
if (!m)
|
|
474
627
|
break;
|
|
475
|
-
this.currentInterrupt = m, this.interruptHandler = new
|
|
628
|
+
this.currentInterrupt = m, this.interruptHandler = new fe(this.graph, u), yield* this.closeActiveRuntimeSpans(t, "interrupted"), yield { runId: t, timestamp: Date.now(), type: "interrupt", interrupt: m };
|
|
476
629
|
try {
|
|
477
|
-
const
|
|
478
|
-
yield* this.pipeStream(
|
|
479
|
-
} catch (
|
|
480
|
-
if (this.isRunCancelled(
|
|
481
|
-
yield
|
|
630
|
+
const y = await this.interruptHandler.waitForUser(), I = ++this.streamEpoch;
|
|
631
|
+
yield* this.pipeStream(y, I, t);
|
|
632
|
+
} catch (y) {
|
|
633
|
+
if (this.isRunCancelled(t)) {
|
|
634
|
+
yield* this.createCancellationEvents(t);
|
|
482
635
|
return;
|
|
483
636
|
}
|
|
484
|
-
if (
|
|
637
|
+
if (y) {
|
|
485
638
|
yield {
|
|
486
|
-
runId:
|
|
639
|
+
runId: t,
|
|
487
640
|
timestamp: Date.now(),
|
|
488
641
|
type: "error",
|
|
489
|
-
error: { message:
|
|
642
|
+
error: { message: y?.message }
|
|
490
643
|
};
|
|
491
644
|
return;
|
|
492
645
|
}
|
|
493
646
|
}
|
|
494
647
|
}
|
|
495
|
-
if (this.isRunCancelled(
|
|
496
|
-
yield
|
|
648
|
+
if (this.isRunCancelled(t)) {
|
|
649
|
+
yield* this.createCancellationEvents(t);
|
|
497
650
|
return;
|
|
498
651
|
}
|
|
499
|
-
const
|
|
500
|
-
if (this.isRunCancelled(
|
|
501
|
-
yield
|
|
652
|
+
const h = (await this.graph.getState(u, { subgraphs: !0 })).values;
|
|
653
|
+
if (this.isRunCancelled(t)) {
|
|
654
|
+
yield* this.createCancellationEvents(t);
|
|
502
655
|
return;
|
|
503
656
|
}
|
|
504
|
-
this.chatHistory =
|
|
505
|
-
runId:
|
|
657
|
+
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 {
|
|
658
|
+
runId: t,
|
|
506
659
|
timestamp: Date.now(),
|
|
507
660
|
type: "completed",
|
|
508
|
-
result: { content:
|
|
661
|
+
result: { content: h.finalOutputMessage }
|
|
509
662
|
};
|
|
510
663
|
}
|
|
511
664
|
/**
|
|
512
665
|
* Start a new conversation by clearing chat history, prior steps, and shared state.
|
|
513
666
|
*/
|
|
514
667
|
newConversation() {
|
|
515
|
-
this.chatHistory = [], this.priorSteps = [], this.sharedState = {};
|
|
668
|
+
this.chatHistory = [], this.priorSteps = [], this.sharedState = {}, this.sharedResources = [];
|
|
516
669
|
}
|
|
517
670
|
/**
|
|
518
671
|
* Generic resume for any HITL interrupt.
|
|
@@ -540,29 +693,87 @@ class x {
|
|
|
540
693
|
this.activeRunId && (this.cancelledRunIds.add(this.activeRunId), this.activeAbortController?.abort(), ++this.streamEpoch, this.interruptHandler?.cancel());
|
|
541
694
|
}
|
|
542
695
|
async *pipeStream(e, r, s) {
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
696
|
+
try {
|
|
697
|
+
for await (const t of e) {
|
|
698
|
+
if (this.isRunCancelled(s) || r !== this.streamEpoch)
|
|
699
|
+
break;
|
|
700
|
+
if (this.runtimeEventsEnabled) {
|
|
701
|
+
const a = ye({
|
|
702
|
+
event: t,
|
|
703
|
+
runId: s,
|
|
704
|
+
parentSpanId: this.parentRunIds.get(t.run_id),
|
|
705
|
+
timestamp: Date.now()
|
|
706
|
+
});
|
|
707
|
+
a && (a.phase === "started" ? this.activeRuntimeSpans.set(a.span.id, a) : this.activeRuntimeSpans.delete(a.span.id), yield a);
|
|
708
|
+
}
|
|
709
|
+
t.event === "on_custom_event" && t.name === "trace_message" ? yield { runId: s, timestamp: Date.now(), type: "trace", data: t.data } : t.name === "graph_ux_suggestion" && (yield {
|
|
710
|
+
runId: s,
|
|
711
|
+
timestamp: Date.now(),
|
|
712
|
+
type: "ux-suggestion",
|
|
713
|
+
suggestion: t.data
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
} catch (t) {
|
|
717
|
+
if (!this.isRunCancelled(s))
|
|
718
|
+
throw t;
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
*createCancellationEvents(e) {
|
|
722
|
+
yield* this.closeActiveRuntimeSpans(e, "cancelled"), yield { runId: e, timestamp: Date.now(), type: "cancelled", reason: "user" };
|
|
723
|
+
}
|
|
724
|
+
*closeActiveRuntimeSpans(e, r) {
|
|
725
|
+
const s = Date.now(), t = [...this.activeRuntimeSpans.values()].reverse();
|
|
726
|
+
this.activeRuntimeSpans.clear();
|
|
727
|
+
for (const a of t) {
|
|
728
|
+
const { input: i, ...o } = a.span;
|
|
729
|
+
yield {
|
|
730
|
+
type: "runtime",
|
|
731
|
+
phase: r,
|
|
732
|
+
runId: e,
|
|
733
|
+
timestamp: s,
|
|
734
|
+
...a.agentId && { agentId: a.agentId },
|
|
735
|
+
span: o
|
|
736
|
+
};
|
|
552
737
|
}
|
|
553
738
|
}
|
|
739
|
+
// v2 stream events omit parent run IDs, so capture them through callbacks to preserve the normalized span hierarchy.
|
|
740
|
+
createHierarchyCallback() {
|
|
741
|
+
const e = (r, s) => {
|
|
742
|
+
s && this.parentRunIds.set(r, s);
|
|
743
|
+
};
|
|
744
|
+
return G.fromMethods({
|
|
745
|
+
handleLLMStart: (r, s, t, a) => e(t, a),
|
|
746
|
+
handleChatModelStart: (r, s, t, a) => e(t, a),
|
|
747
|
+
handleChainStart: (r, s, t, a) => e(t, a),
|
|
748
|
+
handleToolStart: (r, s, t, a) => e(t, a),
|
|
749
|
+
handleRetrieverStart: (r, s, t, a) => e(t, a)
|
|
750
|
+
});
|
|
751
|
+
}
|
|
554
752
|
isRunCancelled(e) {
|
|
555
753
|
return this.cancelledRunIds.has(e);
|
|
556
754
|
}
|
|
755
|
+
/**
|
|
756
|
+
* Creates a request-scoped registry containing all agents by default,
|
|
757
|
+
* or only the explicitly selected agents when filtering is requested.
|
|
758
|
+
*/
|
|
759
|
+
createRequestAgentRegistry(e) {
|
|
760
|
+
const r = e.routing === "direct" ? [e.agentId] : e.agentIds, s = r ? r.map((a) => {
|
|
761
|
+
const i = this.agentRegistry.get(a);
|
|
762
|
+
if (!i)
|
|
763
|
+
throw new Error(`Agent is not registered: ${a}`);
|
|
764
|
+
return i;
|
|
765
|
+
}) : this.agentRegistry.list(), t = new S();
|
|
766
|
+
return s.forEach((a) => t.register(a)), t;
|
|
767
|
+
}
|
|
557
768
|
/**
|
|
558
769
|
* Disposes this instance by terminating the embeddings worker
|
|
559
770
|
* and cleaning up all related resources.
|
|
560
771
|
*/
|
|
561
772
|
dispose() {
|
|
562
|
-
this.embeddingsWorker && (this.embeddingsWorker.terminate(), this.embeddingsWorker = void 0), this.orchestratorReady = !1;
|
|
773
|
+
this.sharedResources = [], this.embeddingsWorker && (this.embeddingsWorker.terminate(), this.embeddingsWorker = void 0), this.orchestratorReady = !1;
|
|
563
774
|
}
|
|
564
775
|
}
|
|
565
776
|
export {
|
|
566
|
-
|
|
567
|
-
|
|
777
|
+
k as O,
|
|
778
|
+
we as g
|
|
568
779
|
};
|