@arcgis/ai-components 5.2.0-next.110 → 5.2.0-next.111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-utils/BaseAgent.js +1 -1
- package/dist/agent-utils/FunctionAgent.js +1 -1
- package/dist/agent-utils/LLMAgent.d.ts +4 -5
- package/dist/agent-utils/LLMAgent.js +59 -59
- package/dist/agent-utils/WorkflowAgent.js +1 -1
- package/dist/agent-utils/index.js +1 -1
- package/dist/agent-utils/middlewares/humanInTheLoop.js +1 -1
- package/dist/agent-utils/middlewares/middleware.js +1 -1
- package/dist/agent-utils/middlewares/trace.js +6 -6
- package/dist/agent-utils/middlewares/types.js +1 -1
- package/dist/agent-utils/tools/FunctionTool.js +1 -1
- package/dist/agent-utils/workflows/ConditionalWorkflow.js +1 -1
- package/dist/agent-utils/workflows/LoopWorkflow.js +1 -1
- package/dist/agent-utils/workflows/ParallelWorkflow.js +1 -1
- package/dist/agent-utils/workflows/RouterWorkflow.js +1 -1
- package/dist/agent-utils/workflows/SequentialWorkflow.js +1 -1
- package/dist/agent-utils/workflows/SwitchWorkflow.js +1 -1
- package/dist/agentic-workflow/jsonTypes.d.ts +48 -8
- package/dist/agentic-workflow/nodes/HumanInTheLoopNode.d.ts +37 -0
- package/dist/agentic-workflow/types.d.ts +1 -1
- package/dist/agents/runtime/skill/createSkillAgent.d.ts +0 -1
- package/dist/agents/runtime/skill/createSkillAgent.js +50 -50
- package/dist/agents/runtime/skill/types.d.ts +2 -10
- package/dist/agents/runtime/skill/types.js +1 -1
- package/dist/agents/tools/filter/clearFilters/adapter.js +1 -1
- package/dist/agents/tools/filter/resetMap/adapter.js +1 -1
- package/dist/agents/tools/filter/setFeatureEffect/adapter.js +1 -1
- package/dist/agents/tools/help/listFields/adapter.js +1 -1
- package/dist/agents/tools/navigation/goToAddress/adapter.js +1 -1
- package/dist/agents/tools/navigation/goToBookmark/adapter.js +1 -1
- package/dist/agents/tools/navigation/goToFeatures/adapter.js +1 -1
- package/dist/agents/tools/navigation/goToFullExtent/adapter.js +1 -1
- package/dist/agents/tools/navigation/goToHomeExtent/adapter.js +1 -1
- package/dist/agents/tools/navigation/goToLayer/adapter.js +1 -1
- package/dist/agents/tools/navigation/goToScale/adapter.js +1 -1
- package/dist/agents/tools/navigation/goToViewpoint/adapter.js +1 -1
- package/dist/agents/tools/navigation/goToZoom/adapter.js +1 -1
- package/dist/agents/tools/query/getAttribute/adapter.js +1 -1
- package/dist/agents/tools/query/getStatistics/adapter.js +1 -1
- package/dist/agents/tools/query/getTopFeatures/adapter.js +1 -1
- package/dist/agents/tools/query/queryFeatures/adapter.js +1 -1
- package/dist/agents/tools/search/findRelevantFields/adapter.js +1 -1
- package/dist/agents/tools/search/findRelevantLayers/adapter.js +1 -1
- package/dist/agents/tools/shared/resolveToolArtifact.js +1 -1
- package/dist/agents/tools/shared/types.js +1 -1
- package/dist/cdn/2BNQ6A6J.js +2 -0
- package/dist/cdn/{FV6FHLYW.js → 2MWUBKWI.js} +2 -2
- package/dist/cdn/{GW3IVAAZ.js → 2O4DON37.js} +2 -2
- package/dist/cdn/{LL324IL6.js → 2W7LK4HA.js} +2 -2
- package/dist/cdn/33PB7ALY.js +2 -0
- package/dist/cdn/{FK2CVSXW.js → 33SFAZQG.js} +4 -4
- package/dist/cdn/{LLY5A2E2.js → 34O57OGV.js} +1 -1
- package/dist/cdn/{OALQBAZR.js → 3UEKINYC.js} +2 -2
- package/dist/cdn/434TAA3J.js +2 -0
- package/dist/cdn/{ZWIKFBOU.js → 4IU63OWQ.js} +2 -2
- package/dist/cdn/{XRVGYRXL.js → 5A355PGH.js} +2 -2
- package/dist/cdn/{TB2GJALS.js → 5HBAJ57P.js} +2 -2
- package/dist/cdn/{7Y43R7QJ.js → 5MK44FNO.js} +2 -2
- package/dist/cdn/{LXIKAXUT.js → 5Q2XRQS6.js} +2 -2
- package/dist/cdn/{UAZPINUQ.js → 6ECRQVHY.js} +2 -2
- package/dist/cdn/{BBEGLIZC.js → 6OOZSZRJ.js} +2 -2
- package/dist/cdn/6OUIUXAJ.js +2 -0
- package/dist/cdn/{Y4TYL2AL.js → 6P44KOKX.js} +2 -2
- package/dist/cdn/{LBTGOMCT.js → 73TMZQI5.js} +2 -2
- package/dist/cdn/{BJMGT6GV.js → 74CVYM72.js} +2 -2
- package/dist/cdn/{PJPP6LOS.js → 7EHOFQ2P.js} +2 -2
- package/dist/cdn/{24EIZVUM.js → 7KSFIRXB.js} +2 -2
- package/dist/cdn/{STOGCXJH.js → AHCXG7XF.js} +2 -2
- package/dist/cdn/{VLPELJUS.js → AOVJ34QE.js} +2 -2
- package/dist/cdn/{3KNLFIM3.js → APFZY4PI.js} +2 -2
- package/dist/cdn/{KBSXHSBX.js → AVRS6UCQ.js} +2 -2
- package/dist/cdn/{YOW3YKWR.js → AVZ5Y6BK.js} +2 -2
- package/dist/cdn/{477I66FH.js → AXTQU5YL.js} +11 -11
- package/dist/cdn/BBPD2AS7.js +2 -0
- package/dist/cdn/{HV7MVIQV.js → BFZ5S7NF.js} +2 -2
- package/dist/cdn/{HMMYCSOK.js → BL273EGZ.js} +2 -2
- package/dist/cdn/C7JPWFZE.js +2 -0
- package/dist/cdn/{KKCLHXHG.js → CCC6LBMY.js} +1 -1
- package/dist/cdn/{NNPA3NLK.js → CEKOEHB3.js} +2 -2
- package/dist/cdn/{W54XYT2A.js → CFAC4FN3.js} +2 -2
- package/dist/cdn/{53KIFJFA.js → COH3QXWG.js} +2 -2
- package/dist/cdn/{CX2HJ67C.js → DB2TFPIO.js} +2 -2
- package/dist/cdn/{EYGZJKVD.js → DE26DAW5.js} +2 -2
- package/dist/cdn/DG27JEYG.js +50 -0
- package/dist/cdn/DKA6PSYN.js +2 -0
- package/dist/cdn/{65LCK3GG.js → DQ2Z65UO.js} +2 -2
- package/dist/cdn/DWH23NJN.js +2 -0
- package/dist/cdn/EDXTPEEU.js +2 -0
- package/dist/cdn/{6KWGSXIN.js → ENM3L4AC.js} +2 -2
- package/dist/cdn/{XV7RMYLR.js → EVMIYZWD.js} +2 -2
- package/dist/cdn/{FHBRXZLV.js → EYOWRGDP.js} +2 -2
- package/dist/cdn/{45BDE3MG.js → EYY367WR.js} +2 -2
- package/dist/cdn/{27CK3JHY.js → F5NIRETW.js} +2 -2
- package/dist/cdn/{TFAJNKBC.js → FCI6M62J.js} +2 -2
- package/dist/cdn/{V4PJMCJZ.js → FDOMMK2M.js} +1 -1
- package/dist/cdn/{4OI4QEV7.js → FS7GXTTQ.js} +2 -2
- package/dist/cdn/{IHUWQOMK.js → FYZATVB3.js} +2 -2
- package/dist/cdn/{3PPXAIRE.js → H6P3WP5D.js} +2 -2
- package/dist/cdn/HHP5YLUI.js +2 -0
- package/dist/cdn/HIAQARIQ.js +2 -0
- package/dist/cdn/HMIDFTEI.js +2 -0
- package/dist/cdn/{4CFCV47G.js → HMNBUGH2.js} +2 -2
- package/dist/cdn/HR6GWPKX.js +2 -0
- package/dist/cdn/{V266DJ5V.js → ICBIUFK7.js} +2 -2
- package/dist/cdn/{BTOBEN7Q.js → IH26MIYY.js} +2 -2
- package/dist/cdn/{QAX6UF4L.js → IHP25JWI.js} +2 -2
- package/dist/cdn/{M2U456J5.js → IYLFJCJ2.js} +4 -4
- package/dist/cdn/{JMXXRRKQ.js → J6A4AS7E.js} +2 -2
- package/dist/cdn/{QTEPFTAU.js → JEBRN3EU.js} +2 -2
- package/dist/cdn/{G24MNC7D.js → JICNSK6Y.js} +2 -2
- package/dist/cdn/JQYLMTDP.js +2 -0
- package/dist/cdn/{275FFTBE.js → K5JVB6FU.js} +2 -2
- package/dist/cdn/K7XWGSLN.js +2 -0
- package/dist/cdn/{M3KKORBG.js → K7YQIJFT.js} +2 -2
- package/dist/cdn/KH4V4I3W.js +2 -0
- package/dist/cdn/KMLJS2VW.js +2 -0
- package/dist/cdn/{HNTSDY3J.js → LAVFUDUG.js} +2 -2
- package/dist/cdn/{L3BTURBA.js → LK7ZIQW6.js} +2 -2
- package/dist/cdn/{ZJWR4W2S.js → LOQ2PKV5.js} +58 -58
- package/dist/cdn/{X42ACC66.js → LXPGQNXQ.js} +2 -2
- package/dist/cdn/{TXZQZR3I.js → MJSIYEWN.js} +2 -2
- package/dist/cdn/{CSE6BHOJ.js → MWYBF3F3.js} +2 -2
- package/dist/cdn/{FDRAKF5D.js → MXTXJKFE.js} +2 -2
- package/dist/cdn/{7DOYUO7L.js → NEV6OZN3.js} +2 -2
- package/dist/cdn/{NBDOPGSN.js → O4NVW75A.js} +2 -2
- package/dist/cdn/{ZA7ZU2F7.js → OKVLGJAG.js} +2 -2
- package/dist/cdn/{SUC2MIGE.js → OMF6ITSG.js} +2 -2
- package/dist/cdn/{A6LBMS7A.js → ONQ6JSBJ.js} +1 -1
- package/dist/cdn/{CKUUYQLO.js → OZAZ277H.js} +2 -2
- package/dist/cdn/{2UJPYWWZ.js → P4GFYBBO.js} +2 -2
- package/dist/cdn/{XNUWVZN7.js → P4XZMBU5.js} +2 -2
- package/dist/cdn/{L2HLFWCV.js → POL6HKCG.js} +3 -3
- package/dist/cdn/{AP3KPOHN.js → POZYDAU2.js} +2 -2
- package/dist/cdn/{FTTLFIBV.js → PQ2DPOFM.js} +2 -2
- package/dist/cdn/{JUNMTIB3.js → PYGX4HN7.js} +2 -2
- package/dist/cdn/{ZY3JQCZQ.js → QNXI3WOF.js} +36 -36
- package/dist/cdn/{4VBOTWC3.js → QRMRID2M.js} +2 -2
- package/dist/cdn/{TLPZELG3.js → R74ZHFA6.js} +1 -1
- package/dist/cdn/{CAOMMQSY.js → RFVZ7KCG.js} +1 -1
- package/dist/cdn/{OF3TAARW.js → RHYNE5OE.js} +1 -1
- package/dist/cdn/{4YOG5F3W.js → RLEHNAIA.js} +1 -1
- package/dist/cdn/{RSM7MEVT.js → ROQGPAR5.js} +2 -2
- package/dist/cdn/RXF2NUOL.js +2 -0
- package/dist/cdn/{MZUDIQQH.js → SDWWUWAF.js} +2 -2
- package/dist/cdn/SHI76XUV.js +2 -0
- package/dist/cdn/SITY6L4S.js +2 -0
- package/dist/cdn/STHBRTTD.js +2 -0
- package/dist/cdn/{7UBTNDV6.js → SXM4NUT5.js} +2 -2
- package/dist/cdn/{XVJFPZTW.js → SZRJTQ54.js} +2 -2
- package/dist/cdn/TO2NY7EA.js +2 -0
- package/dist/cdn/{4IWDBEMN.js → TPULIO6I.js} +2 -2
- package/dist/cdn/TVEEQSMF.js +2 -0
- package/dist/cdn/TWU3QXAS.js +2 -0
- package/dist/cdn/{EGRRZTF6.js → TYATJUNF.js} +2 -2
- package/dist/cdn/UCTC4JN4.js +3 -0
- package/dist/cdn/{HI3XKFHD.js → UDRKUVZP.js} +2 -2
- package/dist/cdn/{JYNHWJUZ.js → UHEYPSOR.js} +2 -2
- package/dist/cdn/{VGLBH473.js → UHICISBZ.js} +2 -2
- package/dist/cdn/UO5PBOQR.js +2 -0
- package/dist/cdn/{BVUCNXC5.js → UZLQALHY.js} +1 -1
- package/dist/cdn/{SNG3WODY.js → V6HOUZPZ.js} +2 -2
- package/dist/cdn/{V52GSTOC.js → V7Y22FRP.js} +2 -2
- package/dist/cdn/{I72ST4JR.js → VAXH6RUQ.js} +2 -2
- package/dist/cdn/{NV7CL4S3.js → VNLSYVPE.js} +2 -2
- package/dist/cdn/VR3CF3ZY.js +2 -0
- package/dist/cdn/{VK6CCPTG.js → VWP2B4LB.js} +2 -2
- package/dist/cdn/VXFQANGJ.js +2 -0
- package/dist/cdn/WKZHFSH3.js +2 -0
- package/dist/cdn/{OXC2WP7W.js → WSWB3B7B.js} +2 -2
- package/dist/cdn/{EK3PM4L5.js → WVP73XWD.js} +2 -2
- package/dist/cdn/{SJMAKF4P.js → WXQ26G5Q.js} +2 -2
- package/dist/cdn/{2F4TPWZQ.js → XQ3NBBQ3.js} +1 -1
- package/dist/cdn/{VXLKTQ36.js → YHWYTHID.js} +2 -2
- package/dist/cdn/{XOTPSCNF.js → YIZ7PR2G.js} +2 -2
- package/dist/cdn/{T6W6F4TF.js → Z5XQLSYH.js} +2 -2
- package/dist/cdn/{Y6CV2NZR.js → ZFOG3KXV.js} +2 -2
- package/dist/cdn/{FPH52WOH.js → ZU2FHVNK.js} +2 -2
- package/dist/cdn/agent-utils/index.js +2 -2
- package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +2 -3
- package/dist/cdn/agent-utils/middlewares/middleware.js +2 -2
- package/dist/cdn/agent-utils/middlewares/trace.js +2 -2
- package/dist/cdn/index.js +2 -2
- package/dist/chunks/BaseWorkflow.js +1 -1
- package/dist/chunks/SKILL.js +1 -1
- package/dist/chunks/SKILL2.js +1 -1
- package/dist/chunks/SKILL3.js +1 -1
- package/dist/chunks/SKILL4.js +1 -1
- package/dist/chunks/adapter.js +1 -1
- package/dist/chunks/aiFactory.js +56 -50
- package/dist/chunks/arcgisKnowledgeGraph.js +2 -2
- package/dist/chunks/arcgisToolRegistry.js +1 -1
- package/dist/chunks/arcgis_knowledge_current_lc_context.js +1 -1
- package/dist/chunks/arcgis_knowledge_current_map_context.js +1 -1
- package/dist/chunks/arcgis_knowledge_cypher_query_prompt.js +1 -1
- package/dist/chunks/arcgis_knowledge_lucene_generation_prompt.js +1 -1
- package/dist/chunks/arcgis_knowledge_summarize_result_prompt.js +1 -1
- package/dist/chunks/arcgis_knowledge_tool_prompt.js +1 -1
- package/dist/chunks/baseAgentState.js +1 -1
- package/dist/chunks/converterUtils.js +1 -1
- package/dist/chunks/dataExplorationAgent.js +1 -1
- package/dist/chunks/data_explore_filter_prompt.js +1 -1
- package/dist/chunks/data_explore_query_prompt.js +1 -1
- package/dist/chunks/embeddings.worker.js +1 -1
- package/dist/chunks/fetchAgentContext.js +1 -1
- package/dist/chunks/fetchService.js +1 -1
- package/dist/chunks/fieldStatistics.js +1 -1
- package/dist/chunks/field_descriptions_prompt.js +1 -1
- package/dist/chunks/formatFeatureAttributes.js +1 -1
- package/dist/chunks/generateLayerDescriptions.js +60 -63
- package/dist/chunks/graph.js +1 -1
- package/dist/chunks/helpAgent.js +1 -1
- package/dist/chunks/help_prompt.js +1 -1
- package/dist/chunks/index.js +1 -1
- package/dist/chunks/intent_prompt.js +1 -1
- package/dist/chunks/layerStylingGraph.js +1 -1
- package/dist/chunks/layer_descriptions_prompt.js +1 -1
- package/dist/chunks/layer_styling_prompt.js +1 -1
- package/dist/chunks/mergeWhereClauses.js +1 -1
- package/dist/chunks/navigationAgent.js +1 -1
- package/dist/chunks/navigation_intent_prompt.js +1 -1
- package/dist/chunks/navigation_tool_prompt.js +1 -1
- package/dist/chunks/orchestrator.js +1 -1
- package/dist/chunks/requireAgentServices.js +1 -1
- package/dist/chunks/resolvePointGeometryFilter.js +1 -1
- package/dist/chunks/runtime.js +1 -1
- package/dist/chunks/slottableRequestUtils.js +1 -1
- package/dist/chunks/state.js +26 -26
- package/dist/chunks/summarize_query_response_prompt.js +1 -1
- package/dist/chunks/useT9n.js +1 -1
- package/dist/chunks/utils.js +1 -1
- package/dist/chunks/utils2.js +1 -1
- package/dist/chunks/utils3.js +1 -1
- package/dist/components/arcgis-assistant/customElement.js +1 -1
- package/dist/components/arcgis-assistant-agent/customElement.js +362 -220
- package/dist/components/arcgis-assistant-chat/customElement.js +1 -1
- package/dist/components/arcgis-assistant-chat-entry/customElement.js +1 -1
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-help-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-interrupt/customElement.js +1 -1
- package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +1 -1
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-message/customElement.js +1 -1
- package/dist/components/arcgis-assistant-message-block/customElement.js +1 -1
- package/dist/components/arcgis-assistant-message-feedback/customElement.js +1 -1
- package/dist/components/arcgis-assistant-message-footer/customElement.js +1 -1
- package/dist/components/arcgis-assistant-message-loading/customElement.js +1 -1
- package/dist/components/arcgis-assistant-message-log/customElement.js +1 -1
- package/dist/components/arcgis-assistant-message-read-aloud/customElement.js +1 -1
- package/dist/components/arcgis-assistant-message-text/customElement.js +1 -1
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-speech-input/customElement.js +1 -1
- package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +1 -1
- package/dist/components/arcgis-assistant-user-message/customElement.js +1 -1
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/index.js +1 -1
- package/dist/loader.js +1 -1
- package/dist/utils/index.js +3 -3
- package/package.json +9 -9
- package/dist/cdn/25MBI4PD.js +0 -2
- package/dist/cdn/2LVYAXHG.js +0 -44
- package/dist/cdn/2WXXSZP5.js +0 -2
- package/dist/cdn/5X23DDDZ.js +0 -2
- package/dist/cdn/AUCKEB52.js +0 -2
- package/dist/cdn/B3HXSEBN.js +0 -2
- package/dist/cdn/BTTCBEPW.js +0 -2
- package/dist/cdn/EXMEB4X2.js +0 -2
- package/dist/cdn/FLUI6GCU.js +0 -2
- package/dist/cdn/FRYS2PZJ.js +0 -2
- package/dist/cdn/FSLQCZRN.js +0 -2
- package/dist/cdn/HKIA5PWU.js +0 -2
- package/dist/cdn/I3SUE2TR.js +0 -2
- package/dist/cdn/KAX4A7SF.js +0 -2
- package/dist/cdn/LIRT72WY.js +0 -2
- package/dist/cdn/M5B6X46F.js +0 -2
- package/dist/cdn/NGR5NVZE.js +0 -2
- package/dist/cdn/PUZ6RAFQ.js +0 -2
- package/dist/cdn/ROS22KOA.js +0 -2
- package/dist/cdn/SBNNJ5WA.js +0 -2
- package/dist/cdn/SDX46GZY.js +0 -2
- package/dist/cdn/SI22EJLC.js +0 -2
- package/dist/cdn/SXYKNDOF.js +0 -2
- package/dist/cdn/SZ2L5556.js +0 -2
- package/dist/cdn/UGIHS7OA.js +0 -2
- package/dist/cdn/VT5EWFH7.js +0 -2
- package/dist/cdn/XZF7Y6B2.js +0 -2
- package/dist/cdn/Y4ZOB6UH.js +0 -2
- package/dist/cdn/YIXASZUW.js +0 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
2
|
-
import{A as L,B as H,Na as oe,O as st,Oa as at,P as Rt,Qa as W,Ra as Ot,Ua as Le,Wa as
|
|
3
|
-
- ${o}`).join("")}.`),this.toolName=e,this.errors=t}},
|
|
4
|
-
Please fix the error and try again.`),this.toolCall=t,this.toolError=o}static isInstance(e){return e instanceof Error&&"~brand"in e&&e["~brand"]==="ToolInvocationError"}static[Symbol.hasInstance](e){return this.isInstance(e)}},ne=class jt extends Error{"~brand"="MiddlewareError";constructor(t,o){let n=t instanceof Error?t.message:String(t);super(n),this.name=t instanceof Error?t.name:`${o[0].toUpperCase()+o.slice(1)}Error`,t instanceof Error&&(this.cause=t)}static wrap(t,o){return st(t)?t:new jt(t,o)}static isInstance(t){return t instanceof Error&&"~brand"in t&&t["~brand"]==="MiddlewareError"}static[Symbol.hasInstance](t){return this.isInstance(t)}};
|
|
5
|
-
All items must be either InteropZodObject, Standard Schema, or plain JSON schema objects.`)}if(e instanceof G||e instanceof q)return[e];let n=Co(o);if(Me(e))return n?[q.fromSchema(e)]:[G.fromSchema(e,t)];if(F(e))return n?[q.fromSchema(e)]:[G.fromSchema(e,t)];if(typeof e=="object"&&e!==null&&"properties"in e)return n?[q.fromSchema(e)]:[G.fromSchema(e,t)];throw new Error(`Invalid response format: ${String(e)}`)}function Co(e){return!e||!_e(e)||!("profile"in e)||typeof e.profile!="object"||!e.profile?!1:"structuredOutput"in e.profile&&e.profile.structuredOutput===!0}function _o(e,t){if(e.length<t.length||e.length>t.length+1)return!1;for(let o=0;o<t.length;o+=1)if(e[o]!==t[o])return!1;return!0}function xo(e){let t;try{t=JSON.parse(e)}catch{return!1}return!Array.isArray(t)||t.length===0?!1:t.every(o=>{if(o==null||typeof o!="object")return!1;let n=o;return typeof n.id=="string"&&"value"in n})}function So(e){if(e==null||typeof e!="object")return!1;let t=e;return t.type!=="constructor"||!Array.isArray(t.id)?!1:t.id[t.id.length-1]==="ToolMessage"}function ko(e){return M.isInstance(e)?e.content:So(e)?e.kwargs?.content:e}function ae(e){return()=>{let t=je.local(),o=new Map;function n(r,s,a){if(o.has(r))return;let l=typeof a=="string"?JSON.parse(a):a,u,m,c,h,d=new Promise((x,y)=>{u=x,m=y}),f=new Promise(x=>{c=x}),g=new Promise(x=>{h=x});o.set(r,{resolveOutput:u,rejectOutput:m,resolveStatus:c,resolveError:h}),t.push({name:s,callId:r,input:l,output:d,status:f,error:g})}return{__native:!0,init:()=>({toolCalls:t}),process(r){if(!_o(r.params.namespace,e))return!0;if(r.method==="messages"){let s=r.params.data;if(s.event==="content-block-finish"){let a=s.contentBlock??s.content_block;a?.type==="tool_call"&&n(String(a.id??""),String(a.name??""),a.args??a.input)}}if(r.method==="tools"){let s=r.params.data,a=s.tool_call_id;s.event==="tool-started"&&n(a,s.tool_name??"unknown",s.input);let l=a?o.get(a):void 0;if(l){if(s.event==="tool-finished")l.resolveOutput(ko(s.output)),l.resolveStatus("finished"),l.resolveError(void 0),o.delete(a);else if(s.event==="tool-error"){let u=s.message??"unknown error";if(xo(u))return!0;l.rejectOutput(new Error(u)),l.resolveStatus("error"),l.resolveError(u),o.delete(a)}}}return!0},finalize(){for(let r of o.values())r.resolveStatus("finished"),r.resolveError(void 0),r.resolveOutput(void 0);o.clear(),t.close()},fail(r){for(let s of o.values())s.resolveStatus("error"),s.resolveError(r instanceof Error?r.message:String(r)),s.rejectOutput(r);o.clear(),t.fail(r)}}}}function Z(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function xe(e){return e.join("\0")}function Bt(e,t){if(t.length>e.length)return!1;for(let o=0;o<t.length;o+=1)if(e[o]!==t[o])return!1;return!0}function he(e=[]){return()=>{let t=je.local(),o=new Map,n=new Map,r=new Map,s=new Map,a=e.length;function l(d,f){let g=xe(d);if(o.has(g))return;let x=(Z(f)&&Z(f.metadata)?f.metadata:void 0)?.lc_agent_name;o.set(g,typeof x=="string"?x:void 0)}function u(d){if(!Z(d))return;let f=d.id;if(typeof f!="string")return;let g=d.input,x;if(Z(g)&&Z(g.tool_call)){let y=g.tool_call.id;typeof y=="string"&&(x=y)}else if(Array.isArray(g)){for(let y of g)if(Z(y)&&typeof y.id=="string"){x=y.id;break}}x!=null&&n.set(f,x)}function m(d){let f=r.get(xe(d));if(typeof f=="string"&&f.length>0)return{type:"toolCall",tool_call_id:f};let g=d[d.length-1],x=g.indexOf(":");if(x===-1)return;let y=g.slice(x+1);if(y.length===0)return;let w=n.get(y);if(!(typeof w!="string"||w.length===0))return{type:"toolCall",tool_call_id:w}}function c(d){if(d.length!==a+1||!Bt(d,e))return;let f=xe(d);if(s.has(f))return;let g=o.get(f);if(typeof g!="string"||g.length===0)return;let x=Pt(d),y=x.init(),w=ae(d)(),O=w.init(),A=he(d)(),N=A.init(),K,j,b=new Promise((J,le)=>{K=J,j=le});s.set(f,{key:f,path:d,name:g,messages:x,toolCall:w,nested:A,resolveOutput:K,rejectOutput:j,latestValues:void 0,done:!1}),t.push({name:g,cause:m(d),output:b,messages:y.messages,toolCalls:O.toolCalls,subagents:N.subagents})}function h(d,f){d.done||(d.done=!0,f.type==="resolve"?d.resolveOutput(d.latestValues):d.rejectOutput(f.error),d.messages.finalize?.(),d.toolCall.finalize?.(),d.nested.finalize?.())}return{__native:!0,init:()=>({subagents:t}),process(d){let f=d.params.namespace,g=d.params.data,x=d.method==="tasks"&&Z(g)&&"result"in g;d.method==="tools"&&Z(g)&&g.event==="tool-started"&&typeof g.tool_call_id=="string"&&g.tool_call_id.length>0&&r.set(xe(f),g.tool_call_id),d.method==="tasks"&&!x&&(l(f,g),u(g),c(f));for(let y of s.values())if(!y.done&&Bt(f,y.path)&&(y.messages.process(d),y.toolCall.process(d),y.nested.process(d),xe(f)===y.key)){if(d.method==="values"&&Z(g))y.latestValues=g;else if(d.method==="lifecycle"&&Z(g)){let w=g.event;w==="completed"||w==="interrupted"?h(y,{type:"resolve"}):w==="failed"&&h(y,{type:"reject",error:new Error(`Subagent ${y.name} failed`)})}}return!0},finalize(){for(let d of s.values())h(d,{type:"resolve"});t.close()},fail(d){for(let f of s.values())h(f,{type:"reject",error:d});t.fail(d)}}}}var lt=Symbol.for("langgraph-zod");lt in globalThis||(globalThis[lt]=new WeakSet);function Ut(e){let t=globalThis[lt];t.has(e)||(Object.defineProperty(e,"langgraph",{get(){let o=this;return{metadata(n){return De(o,{jsonSchemaExtra:n})},reducer(n,r){return De(o,{default:Pe(o),reducer:{schema:r,fn:n}})}}}}),t.add(e))}try{Ut(i.ZodType.prototype),Ut(B.ZodType.prototype)}catch(e){throw new Error("Failed to extend Zod with LangGraph-related methods. This is most likely a bug, consider opening an issue and/or using `withLangGraph` to augment your Zod schema.",{cause:e})}var zt=class extends Mt{constructor(e){super(),this.parent=e,this._map=this.parent._map}add(e,...t){let o=t[0];if(o&&!o?.default){let n=Pe(e);n!=null&&(o.default=n)}return super.add(e,...t)}},Eo=new zt(be);function Ft(e=!0,t,o=[]){let n={jumpTo:new at},r={},s={},a=l=>{if(W.isInstance(l)){for(let[m,c]of Object.entries(l.fields))if(!(m in n)){if(n[m]=c,m.startsWith("_"))continue;oe.isInstance(c)?(r[m]=c.inputSchema||c.valueSchema,s[m]=c.valueSchema):(r[m]=c,s[m]=c)}return}let u=de(l);for(let[m,c]of Object.entries(u)){let h=m.startsWith("_");if(!(m in n)){if(Ie(c)){let d=be.get(c);if(d?.reducer){d.reducer.schema?(n[m]=new oe(c,{inputSchema:d.reducer.schema,reducer:d.reducer.fn}),h||(r[m]=d.reducer.schema,s[m]=c)):(n[m]=new oe(c,{reducer:d.reducer.fn}),h||(r[m]=c,s[m]=c));continue}}n[m]=c,h||(r[m]=c,s[m]=c)}}};t&&(W.isInstance(t)||F(t))&&a(t);for(let l of o)l.stateSchema&&(W.isInstance(l.stateSchema)||F(l.stateSchema))&&a(l.stateSchema);return e&&(s.structuredResponse=new at),{state:new W({messages:Le,...n}),input:new W({messages:Le,...r}),output:new W({messages:Le,...s})}}var ct=/<name>(.*?)<\/name>/s,dt=/<content>(.*?)<\/content>/s;function Ao(e,t){if(W.isInstance(e)){let o={};for(let n of Object.keys(e.fields))n in t&&(o[n]=t[n]);return o}if(Re(e))return te(e,t);throw new Error(`Invalid state schema type: ${typeof e}`)}function Ht(e){if(!T.isInstance(e)||Ze.isInstance(e)||!e.name)return e;let{name:t}=e;if(typeof e.content=="string")return new T({...e.lc_kwargs,content:`<name>${t}</name><content>${e.content}</content>`,name:void 0});let o=[],n=0;for(let r of e.content)typeof r=="string"?(n+=1,o.push(`<name>${t}</name><content>${r}</content>`)):typeof r=="object"&&"type"in r&&r.type==="text"?(n+=1,o.push({...r,text:`<name>${t}</name><content>${r.text}</content>`})):o.push(r);return n||o.unshift({type:"text",text:`<name>${t}</name><content></content>`}),new T({...e.lc_kwargs,content:o,name:void 0})}function Gt(e){if(!T.isInstance(e)||!e.content)return e;let t=[],o;if(Array.isArray(e.content))t=e.content.filter(n=>{if(n.type==="text"&&typeof n.text=="string"){let r=n.text.match(ct),s=n.text.match(dt);return r&&(!s||s[1]==="")?(o=r[1],!1):!0}return!0}).map(n=>{if(n.type==="text"&&typeof n.text=="string"){let r=n.text.match(ct),s=n.text.match(dt);return!r||!s?n:(o=r[1],{...n,text:s[1]})}return n});else{let n=e.content,r=n.match(ct),s=n.match(dt);if(!r||!s)return e;o=r[1],t=s[1]}return new T({...Object.keys(e.lc_kwargs??{}).length>0?e.lc_kwargs:e,content:t,name:o})}function ie(e){return Te.isRunnable(e)}function Wt(e){return _e(e)?"bindTools"in e&&typeof e.bindTools=="function":!1}var ut=(e,t,o={})=>{if(Wt(e))return e.bindTools(t,o);if(Y.isRunnableBinding(e)&&Wt(e.bound)){let n=e.bound.bindTools(t,o);return Y.isRunnableBinding(n)?new Y({bound:n.bound,config:{...e.config,...n.config},kwargs:{...e.kwargs,...n.kwargs},configFactories:n.configFactories??e.configFactories}):new Y({bound:n,config:e.config,kwargs:e.kwargs,configFactories:e.configFactories})}return null};function Be(e){if(typeof e=="function")return;let t=e;if(ue.isRunnableSequence(t)&&(t=t.steps.find(o=>Y.isRunnableBinding(o))||t),!pe(t)){if(Y.isRunnableBinding(t)){let o=t.kwargs!=null&&typeof t.kwargs=="object"&&"tools"in t.kwargs&&Array.isArray(t.kwargs.tools)&&t.kwargs.tools.length>0,n=t.config!=null&&typeof t.config=="object"&&"tools"in t.config&&Array.isArray(t.config.tools)&&t.config.tools.length>0;if(o||n)throw new ve}if("tools"in t&&t.tools!==void 0&&Array.isArray(t.tools)&&t.tools.length>0)throw new ve}}function ge(e){return!!(T.isInstance(e)&&e.tool_calls&&e.tool_calls.length>0)}function Jt(e){if(e==null)return new z("");if(z.isInstance(e))return e;if(typeof e=="string")return new z({content:[{type:"text",text:e}]});throw new Error(`Invalid systemPrompt type: expected string or SystemMessage, got ${typeof e}`)}async function Vt(e,t,o={}){let n=ut(e,t,o);if(n)return n;if(pe(e)){let r=ut(await e._getModelInstance(),t,o);if(r)return r}if(ue.isRunnableSequence(e)){let r=e.steps.findIndex(s=>Y.isRunnableBinding(s)||_e(s)||pe(s));if(r>=0){let s=ut(e.steps[r],t,o);if(s){let a=e.steps.slice();return a.splice(r,1,s),ue.from(a)}}}throw new Error(`llm ${e} must define bindTools method.`)}function Io(e){if(e.length===0)return;if(e.length===1)return e[0];function t(n,r){return async(s,a)=>n(s,async u=>r(u,a))}let o=e[e.length-1];for(let n=e.length-2;n>=0;n--)o=t(e[n],o);return o}function Kt(e){let t=e.filter(o=>o.wrapToolCall);if(t.length!==0)return Io(t.map(o=>{let n=o.wrapToolCall;return async(s,a)=>{let l=s.state,u=new Set,m=async c=>{let h={...l,...c.state};try{return await a({...c,state:h})}catch(d){throw u.add(d),d}};try{let c=await n({...s,state:{messages:l.messages,...o.stateSchema?Ao(o.stateSchema,{...l}):{}}},m);if(!M.isInstance(c)&&!H(c))throw new Error(`Invalid response from "wrapToolCall" in middleware "${o.name}": expected ToolMessage or Command, got ${typeof c}`);return c}catch(c){throw u.has(c)?c:ne.wrap(c,o.name)}}}))}var Ro=["tags","metadata","runName","maxConcurrency","recursionLimit","configurable"];function Yt(e){let t={};for(let o of Ro){let n=e[o];n!==void 0&&(t[o]=n)}return t}async function Zt(e,t){let o={};for(let n of e){if(!n.stateSchema)continue;let r;if(W.isInstance(n.stateSchema)){let l={};for(let[u,m]of Object.entries(n.stateSchema.fields))oe.isInstance(m)?l[u]=m.inputSchema||m.valueSchema:l[u]=m;r=B.object(l)}else if(F(n.stateSchema))r=n.stateSchema;else continue;let s=await Tt(_t(r,l=>l.startsWith("_")),t);if(s.success){Object.assign(o,s.data);continue}let a=s.error.issues.filter(l=>l.code==="invalid_type").map(l=>` - ${l.path.join(".")}: Required`).join(`
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{A as L,B as H,Na as oe,O as st,Oa as at,P as Rt,Qa as W,Ra as Ot,Ua as Le,Wa as ve,Xa as De,Ya as Nt,a as tt,b as xt,c as St,d as kt,l as At,n as rt,r as It,s as R,ta as je,w as U,wa as Pt}from"./LOQ2PKV5.js";import{$b as Z,A as Ke,Ac as Et,Ea as Xe,Fb as F,Gb as de,Ib as Ct,Lb as Pe,Nb as _t,O as M,Qb as i,Sb as ue,T as pt,Ta as Qe,Ub as et,Wa as $,Wb as Oe,Xa as ce,Za as Ie,_a as wt,_b as be,ab as qe,ca as q,cb as yt,cc as me,e as ft,ec as Ne,ga as Ye,ha as z,mb as Re,na as ht,oc as ot,pb as Te,ta as T,tb as Tt,vb as bt,wa as Ze,wb as te,xb as vt,ya as gt,yc as nt}from"./IYLFJCJ2.js";import{Dd as B,s as Mt}from"./MWYBF3F3.js";function Ce(e){return"invoke"in e&&typeof e.invoke=="function"&&"_streamResponseChunks"in e}function fe(e){return typeof e=="object"&&e!=null&&"_queuedMethodOperations"in e&&"_getModelInstance"in e&&typeof e._getModelInstance=="function"}var _e=class extends Error{constructor(){super("The provided LLM already has bound tools. Please provide an LLM without bound tools to createAgent. The agent will bind the tools provided in the 'tools' parameter.")}},xe=class extends Error{toolNames;constructor(e){super(`The model has called multiple tools: ${e.join(", ")} to return a structured output. This is not supported. Please provide a single structured output.`),this.toolNames=e}},pe=class extends Error{toolName;errors;constructor(e,t){super(`Failed to parse structured output for tool '${e}':${t.map(o=>`
|
|
3
|
+
- ${o}`).join("")}.`),this.toolName=e,this.errors=t}},he=class extends Error{"~brand"="ToolInvocationError";toolCall;toolError;constructor(e,t){let o=e instanceof Error?e:new Error(String(e)),n=JSON.stringify(t.args);super(`Error invoking tool '${t.name}' with kwargs ${n} with error: ${o.stack}
|
|
4
|
+
Please fix the error and try again.`),this.toolCall=t,this.toolError=o}static isInstance(e){return e instanceof Error&&"~brand"in e&&e["~brand"]==="ToolInvocationError"}static[Symbol.hasInstance](e){return this.isInstance(e)}},ne=class jt extends Error{"~brand"="MiddlewareError";constructor(t,o){let n=t instanceof Error?t.message:String(t);super(n),this.name=t instanceof Error?t.name:`${o[0].toUpperCase()+o.slice(1)}Error`,t instanceof Error&&(this.cause=t)}static wrap(t,o){return st(t)?t:new jt(t,o)}static isInstance(t){return t instanceof Error&&"~brand"in t&&t["~brand"]==="MiddlewareError"}static[Symbol.hasInstance](t){return this.isInstance(t)}};var Lt=!0,Co=0,G=class it{schema;tool;options;constructor(t,o,n){this.schema=t,this.tool=o,this.options=n}get name(){return this.tool.function.name}static fromSchema(t,o){function n(a){return a??`extract-${++Co}`}if(ue(t)||Te(t)){let a=Oe(t),l={type:"function",function:{name:n(a.title),strict:!1,description:a.description??"Tool for extracting structured output from the model's response.",parameters:a}};return new it(a,l,o)}let r;typeof t.name=="string"&&typeof t.parameters=="object"&&t.parameters!=null?r=t:r={name:n(t.title),description:t.description??"",parameters:t.schema||t};let s=Oe(t);return new it(s,{type:"function",function:r},o)}parse(t){let o=new et(this.schema).validate(t);if(!o.valid)throw new pe(this.name,o.errors.map(n=>n.error));return t}},V=class Dt{_schemaType;schema;strict;constructor(t,o){if("schema"in t&&typeof t.schema=="object"&&t.schema!==null&&!("type"in t)){let n=t;this.schema=n.schema,this.strict=n.strict??Lt}else this.schema=t,this.strict=o??Lt}static fromSchema(t,o){let n=Oe(t);return new Dt(n,o)}parse(t){let o;if(typeof t.content=="string")o=t.content;else if(Array.isArray(t.content)){for(let n of t.content)if(typeof n=="object"&&n!==null&&"type"in n&&n.type==="text"&&"text"in n&&typeof n.text=="string"){o=n.text;break}}if(!(!o||o===""))try{let n=JSON.parse(o);return new et(this.schema).validate(n).valid?n:void 0}catch{}}};function $t(e,t,o){if(!e)return[];if(typeof e=="object"&&e!==null&&"__responseFormatUndefined"in e)return[];if(Array.isArray(e)){if(e.every(r=>r instanceof G||r instanceof V))return e;if(e.every(r=>ue(r)))return e.map(r=>G.fromSchema(r,t));if(e.every(r=>F(r)))return e.map(r=>G.fromSchema(r,t));if(e.every(r=>typeof r=="object"&&r!==null&&!F(r)&&!ue(r)))return e.map(r=>G.fromSchema(r,t));throw new Error(`Invalid response format: list contains mixed types.
|
|
5
|
+
All items must be either InteropZodObject, Standard Schema, or plain JSON schema objects.`)}if(e instanceof G||e instanceof V)return[e];let n=_o(o);if(ue(e))return n?[V.fromSchema(e)]:[G.fromSchema(e,t)];if(F(e))return n?[V.fromSchema(e)]:[G.fromSchema(e,t)];if(typeof e=="object"&&e!==null&&"properties"in e)return n?[V.fromSchema(e)]:[G.fromSchema(e,t)];throw new Error(`Invalid response format: ${String(e)}`)}function Bt(e){if(typeof e=="object"&&e!==null&&"schema"in e&&!Te(e)&&!ue(e)&&!("type"in e)){let{schema:t,strict:o}=e;return V.fromSchema(t,o)}return V.fromSchema(e)}function _o(e){return!e||!Ce(e)||!("profile"in e)||typeof e.profile!="object"||!e.profile?!1:"structuredOutput"in e.profile&&e.profile.structuredOutput===!0}var $e=Symbol.for("AgentMiddleware");function E(e){return{[$e]:!0,name:e.name,stateSchema:e.stateSchema,contextSchema:e.contextSchema,wrapToolCall:e.wrapToolCall,wrapModelCall:e.wrapModelCall,beforeAgent:e.beforeAgent,beforeModel:e.beforeModel,afterModel:e.afterModel,afterAgent:e.afterAgent,tools:e.tools,streamTransformers:e.streamTransformers}}function xo(e,t){if(e.length<t.length||e.length>t.length+1)return!1;for(let o=0;o<t.length;o+=1)if(e[o]!==t[o])return!1;return!0}function So(e){let t;try{t=JSON.parse(e)}catch{return!1}return!Array.isArray(t)||t.length===0?!1:t.every(o=>{if(o==null||typeof o!="object")return!1;let n=o;return typeof n.id=="string"&&"value"in n})}function ko(e){if(e==null||typeof e!="object")return!1;let t=e;return t.type!=="constructor"||!Array.isArray(t.id)?!1:t.id[t.id.length-1]==="ToolMessage"}function Eo(e){return M.isInstance(e)?e.content:ko(e)?e.kwargs?.content:e}function ae(e){return()=>{let t=je.local(),o=new Map;function n(r,s,a){if(o.has(r))return;let l=typeof a=="string"?JSON.parse(a):a,u,m,c,h,d=new Promise((x,y)=>{u=x,m=y}),f=new Promise(x=>{c=x}),g=new Promise(x=>{h=x});o.set(r,{resolveOutput:u,rejectOutput:m,resolveStatus:c,resolveError:h}),t.push({name:s,callId:r,input:l,output:d,status:f,error:g})}return{__native:!0,init:()=>({toolCalls:t}),process(r){if(!xo(r.params.namespace,e))return!0;if(r.method==="messages"){let s=r.params.data;if(s.event==="content-block-finish"){let a=s.contentBlock??s.content_block;a?.type==="tool_call"&&n(String(a.id??""),String(a.name??""),a.args??a.input)}}if(r.method==="tools"){let s=r.params.data,a=s.tool_call_id;s.event==="tool-started"&&n(a,s.tool_name??"unknown",s.input);let l=a?o.get(a):void 0;if(l){if(s.event==="tool-finished")l.resolveOutput(Eo(s.output)),l.resolveStatus("finished"),l.resolveError(void 0),o.delete(a);else if(s.event==="tool-error"){let u=s.message??"unknown error";if(So(u))return!0;l.rejectOutput(new Error(u)),l.resolveStatus("error"),l.resolveError(u),o.delete(a)}}}return!0},finalize(){for(let r of o.values())r.resolveStatus("finished"),r.resolveError(void 0),r.resolveOutput(void 0);o.clear(),t.close()},fail(r){for(let s of o.values())s.resolveStatus("error"),s.resolveError(r instanceof Error?r.message:String(r)),s.rejectOutput(r);o.clear(),t.fail(r)}}}}function X(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Se(e){return e.join("\0")}function Ut(e,t){if(t.length>e.length)return!1;for(let o=0;o<t.length;o+=1)if(e[o]!==t[o])return!1;return!0}function ge(e=[]){return()=>{let t=je.local(),o=new Map,n=new Map,r=new Map,s=new Map,a=e.length;function l(d,f){let g=Se(d);if(o.has(g))return;let x=(X(f)&&X(f.metadata)?f.metadata:void 0)?.lc_agent_name;o.set(g,typeof x=="string"?x:void 0)}function u(d){if(!X(d))return;let f=d.id;if(typeof f!="string")return;let g=d.input,x;if(X(g)&&X(g.tool_call)){let y=g.tool_call.id;typeof y=="string"&&(x=y)}else if(Array.isArray(g)){for(let y of g)if(X(y)&&typeof y.id=="string"){x=y.id;break}}x!=null&&n.set(f,x)}function m(d){let f=r.get(Se(d));if(typeof f=="string"&&f.length>0)return{type:"toolCall",tool_call_id:f};let g=d[d.length-1],x=g.indexOf(":");if(x===-1)return;let y=g.slice(x+1);if(y.length===0)return;let w=n.get(y);if(!(typeof w!="string"||w.length===0))return{type:"toolCall",tool_call_id:w}}function c(d){if(d.length!==a+1||!Ut(d,e))return;let f=Se(d);if(s.has(f))return;let g=o.get(f);if(typeof g!="string"||g.length===0)return;let x=Pt(d),y=x.init(),w=ae(d)(),O=w.init(),A=ge(d)(),N=A.init(),Y,j,b=new Promise((J,le)=>{Y=J,j=le});s.set(f,{key:f,path:d,name:g,messages:x,toolCall:w,nested:A,resolveOutput:Y,rejectOutput:j,latestValues:void 0,done:!1}),t.push({name:g,cause:m(d),output:b,messages:y.messages,toolCalls:O.toolCalls,subagents:N.subagents})}function h(d,f){d.done||(d.done=!0,f.type==="resolve"?d.resolveOutput(d.latestValues):d.rejectOutput(f.error),d.messages.finalize?.(),d.toolCall.finalize?.(),d.nested.finalize?.())}return{__native:!0,init:()=>({subagents:t}),process(d){let f=d.params.namespace,g=d.params.data,x=d.method==="tasks"&&X(g)&&"result"in g;d.method==="tools"&&X(g)&&g.event==="tool-started"&&typeof g.tool_call_id=="string"&&g.tool_call_id.length>0&&r.set(Se(f),g.tool_call_id),d.method==="tasks"&&!x&&(l(f,g),u(g),c(f));for(let y of s.values())if(!y.done&&Ut(f,y.path)&&(y.messages.process(d),y.toolCall.process(d),y.nested.process(d),Se(f)===y.key)){if(d.method==="values"&&X(g))y.latestValues=g;else if(d.method==="lifecycle"&&X(g)){let w=g.event;w==="completed"||w==="interrupted"?h(y,{type:"resolve"}):w==="failed"&&h(y,{type:"reject",error:new Error(`Subagent ${y.name} failed`)})}}return!0},finalize(){for(let d of s.values())h(d,{type:"resolve"});t.close()},fail(d){for(let f of s.values())h(f,{type:"reject",error:d});t.fail(d)}}}}var lt=Symbol.for("langgraph-zod");lt in globalThis||(globalThis[lt]=new WeakSet);function zt(e){let t=globalThis[lt];t.has(e)||(Object.defineProperty(e,"langgraph",{get(){let o=this;return{metadata(n){return De(o,{jsonSchemaExtra:n})},reducer(n,r){return De(o,{default:Pe(o),reducer:{schema:r,fn:n}})}}}}),t.add(e))}try{zt(i.ZodType.prototype),zt(B.ZodType.prototype)}catch(e){throw new Error("Failed to extend Zod with LangGraph-related methods. This is most likely a bug, consider opening an issue and/or using `withLangGraph` to augment your Zod schema.",{cause:e})}var Ft=class extends Mt{constructor(e){super(),this.parent=e,this._map=this.parent._map}add(e,...t){let o=t[0];if(o&&!o?.default){let n=Pe(e);n!=null&&(o.default=n)}return super.add(e,...t)}},Ao=new Ft(ve);function Wt(e=!0,t,o=[]){let n={jumpTo:new at},r={},s={},a=l=>{if(W.isInstance(l)){for(let[m,c]of Object.entries(l.fields))if(!(m in n)){if(n[m]=c,m.startsWith("_"))continue;oe.isInstance(c)?(r[m]=c.inputSchema||c.valueSchema,s[m]=c.valueSchema):(r[m]=c,s[m]=c)}return}let u=de(l);for(let[m,c]of Object.entries(u)){let h=m.startsWith("_");if(!(m in n)){if(Re(c)){let d=ve.get(c);if(d?.reducer){d.reducer.schema?(n[m]=new oe(c,{inputSchema:d.reducer.schema,reducer:d.reducer.fn}),h||(r[m]=d.reducer.schema,s[m]=c)):(n[m]=new oe(c,{reducer:d.reducer.fn}),h||(r[m]=c,s[m]=c));continue}}n[m]=c,h||(r[m]=c,s[m]=c)}}};t&&(W.isInstance(t)||F(t))&&a(t);for(let l of o)l.stateSchema&&(W.isInstance(l.stateSchema)||F(l.stateSchema))&&a(l.stateSchema);return e&&(s.structuredResponse=new at),{state:new W({messages:Le,...n}),input:new W({messages:Le,...r}),output:new W({messages:Le,...s})}}var ct=/<name>(.*?)<\/name>/s,dt=/<content>(.*?)<\/content>/s;function Io(e,t){if(W.isInstance(e)){let o={};for(let n of Object.keys(e.fields))n in t&&(o[n]=t[n]);return o}if(Te(e))return te(e,t);throw new Error(`Invalid state schema type: ${typeof e}`)}function Gt(e){if(!T.isInstance(e)||Ze.isInstance(e)||!e.name)return e;let{name:t}=e;if(typeof e.content=="string")return new T({...e.lc_kwargs,content:`<name>${t}</name><content>${e.content}</content>`,name:void 0});let o=[],n=0;for(let r of e.content)typeof r=="string"?(n+=1,o.push(`<name>${t}</name><content>${r}</content>`)):typeof r=="object"&&"type"in r&&r.type==="text"?(n+=1,o.push({...r,text:`<name>${t}</name><content>${r.text}</content>`})):o.push(r);return n||o.unshift({type:"text",text:`<name>${t}</name><content></content>`}),new T({...e.lc_kwargs,content:o,name:void 0})}function Jt(e){if(!T.isInstance(e)||!e.content)return e;let t=[],o;if(Array.isArray(e.content))t=e.content.filter(n=>{if(n.type==="text"&&typeof n.text=="string"){let r=n.text.match(ct),s=n.text.match(dt);return r&&(!s||s[1]==="")?(o=r[1],!1):!0}return!0}).map(n=>{if(n.type==="text"&&typeof n.text=="string"){let r=n.text.match(ct),s=n.text.match(dt);return!r||!s?n:(o=r[1],{...n,text:s[1]})}return n});else{let n=e.content,r=n.match(ct),s=n.match(dt);if(!r||!s)return e;o=r[1],t=s[1]}return new T({...Object.keys(e.lc_kwargs??{}).length>0?e.lc_kwargs:e,content:t,name:o})}function ie(e){return be.isRunnable(e)}function Ht(e){return Ce(e)?"bindTools"in e&&typeof e.bindTools=="function":!1}var ut=(e,t,o={})=>{if(Ht(e))return e.bindTools(t,o);if(Z.isRunnableBinding(e)&&Ht(e.bound)){let n=e.bound.bindTools(t,o);return Z.isRunnableBinding(n)?new Z({bound:n.bound,config:{...e.config,...n.config},kwargs:{...e.kwargs,...n.kwargs},configFactories:n.configFactories??e.configFactories}):new Z({bound:n,config:e.config,kwargs:e.kwargs,configFactories:e.configFactories})}return null};function Be(e){if(typeof e=="function")return;let t=e;if(me.isRunnableSequence(t)&&(t=t.steps.find(o=>Z.isRunnableBinding(o))||t),!fe(t)){if(Z.isRunnableBinding(t)){let o=t.kwargs!=null&&typeof t.kwargs=="object"&&"tools"in t.kwargs&&Array.isArray(t.kwargs.tools)&&t.kwargs.tools.length>0,n=t.config!=null&&typeof t.config=="object"&&"tools"in t.config&&Array.isArray(t.config.tools)&&t.config.tools.length>0;if(o||n)throw new _e}if("tools"in t&&t.tools!==void 0&&Array.isArray(t.tools)&&t.tools.length>0)throw new _e}}function we(e){return!!(T.isInstance(e)&&e.tool_calls&&e.tool_calls.length>0)}function Vt(e){if(e==null)return new z("");if(z.isInstance(e))return e;if(typeof e=="string")return new z({content:[{type:"text",text:e}]});throw new Error(`Invalid systemPrompt type: expected string or SystemMessage, got ${typeof e}`)}async function Kt(e,t,o={}){let n=ut(e,t,o);if(n)return n;if(fe(e)){let r=ut(await e._getModelInstance(),t,o);if(r)return r}if(me.isRunnableSequence(e)){let r=e.steps.findIndex(s=>Z.isRunnableBinding(s)||Ce(s)||fe(s));if(r>=0){let s=ut(e.steps[r],t,o);if(s){let a=e.steps.slice();return a.splice(r,1,s),me.from(a)}}}throw new Error(`llm ${e} must define bindTools method.`)}function Ro(e){if(e.length===0)return;if(e.length===1)return e[0];function t(n,r){return async(s,a)=>n(s,async u=>r(u,a))}let o=e[e.length-1];for(let n=e.length-2;n>=0;n--)o=t(e[n],o);return o}function Yt(e){let t=e.filter(o=>o.wrapToolCall);if(t.length!==0)return Ro(t.map(o=>{let n=o.wrapToolCall;return async(s,a)=>{let l=s.state,u=new Set,m=async c=>{let h={...l,...c.state};try{return await a({...c,state:h})}catch(d){throw u.add(d),d}};try{let c=await n({...s,state:{messages:l.messages,...o.stateSchema?Io(o.stateSchema,{...l}):{}}},m);if(!M.isInstance(c)&&!H(c))throw new Error(`Invalid response from "wrapToolCall" in middleware "${o.name}": expected ToolMessage or Command, got ${typeof c}`);return c}catch(c){throw u.has(c)?c:ne.wrap(c,o.name)}}}))}var Po=["tags","metadata","runName","maxConcurrency","recursionLimit","configurable"];function Zt(e){let t={};for(let o of Po){let n=e[o];n!==void 0&&(t[o]=n)}return t}async function Xt(e,t){let o={};for(let n of e){if(!n.stateSchema)continue;let r;if(W.isInstance(n.stateSchema)){let l={};for(let[u,m]of Object.entries(n.stateSchema.fields))oe.isInstance(m)?l[u]=m.inputSchema||m.valueSchema:l[u]=m;r=B.object(l)}else if(F(n.stateSchema))r=n.stateSchema;else continue;let s=await Tt(_t(r,l=>l.startsWith("_")),t);if(s.success){Object.assign(o,s.data);continue}let a=s.error.issues.filter(l=>l.code==="invalid_type").map(l=>` - ${l.path.join(".")}: Required`).join(`
|
|
6
6
|
`);throw new Error(`Middleware "${n.name}" has required state fields that must be initialized:
|
|
7
7
|
${a}
|
|
8
8
|
|
|
@@ -21,11 +21,11 @@ To fix this, either:
|
|
|
21
21
|
agent.invoke({
|
|
22
22
|
messages: [...],
|
|
23
23
|
${s.error.issues[0]?.path.join(".")}: "value"
|
|
24
|
-
})`)}return o}function
|
|
24
|
+
})`)}return o}function Qt(e){let t={messages:B.custom(()=>[]),structuredResponse:B.any().optional()};if(!e)return B.object(t);let o;if(W.isInstance(e)){o={};for(let[r,s]of Object.entries(e.fields))oe.isInstance(s)?o[r]=s.inputSchema||s.valueSchema:o[r]=s}else if(F(e))o=de(e);else return B.object(t);let n={...t};for(let[r,s]of Object.entries(o))r.startsWith("_")?n[r]=s.optional():n[r]=s;return B.object(n)}function qt(e){if(F(e))return Ct(e);if(W.isInstance(e)){let t={};for(let[o,n]of Object.entries(e.fields)){let r;oe.isInstance(n)?r=n.inputSchema||n.valueSchema:r=n,t[o]=Re(r)?r.optional():B.any().optional()}return B.object(t)}return B.object({})}function K(e){if(e){if(["model_request","tools",R].includes(e))return e;if(e==="model")return"model_request";if(e==="tools")return"tools";if(e==="end")return R;throw new Error(`Invalid jump target: ${e}, must be "model", "tools" or "end".`)}}function Ue(...e){return AbortSignal.any(e.filter(t=>t!=null&&typeof t=="object"&&"aborted"in t&&typeof t.aborted=="boolean"))}function No({apiKey:e,configuration:t={}}){let o=kt({baseURL:t.baseURL,providerPath:"v1"});return{apiKey:e??t.apiKey??o.apiKey??(Xe("LANGSMITH_GATEWAY_API_KEY")||Xe("LANGSMITH_API_KEY")),configuration:{...t,baseURL:o.baseURL??`${St}/v1`},useResponsesApi:!0}}var Fe={openai:{package:"@langchain/openai",className:"ChatOpenAI"},anthropic:{package:"@langchain/anthropic",className:"ChatAnthropic"},azure_openai:{package:"@langchain/openai",className:"AzureChatOpenAI"},langsmith:{package:"@langchain/openai",className:"ChatOpenAI"},cohere:{package:"@langchain/cohere",className:"ChatCohere"},google:{package:"@langchain/google",className:"ChatGoogle"},"google-vertexai":{package:"@langchain/google-vertexai",className:"ChatVertexAI"},"google-vertexai-web":{package:"@langchain/google-vertexai-web",className:"ChatVertexAI"},"google-genai":{package:"@langchain/google-genai",className:"ChatGoogleGenerativeAI"},ollama:{package:"@langchain/ollama",className:"ChatOllama"},mistralai:{package:"@langchain/mistralai",className:"ChatMistralAI"},mistral:{package:"@langchain/mistralai",className:"ChatMistralAI"},groq:{package:"@langchain/groq",className:"ChatGroq"},bedrock:{package:"@langchain/aws",className:"ChatBedrockConverse"},aws:{package:"@langchain/aws",className:"ChatBedrockConverse"},deepseek:{package:"@langchain/deepseek",className:"ChatDeepSeek"},xai:{package:"@langchain/xai",className:"ChatXAI"},cerebras:{package:"@langchain/cerebras",className:"ChatCerebras"},fireworks:{package:"@langchain/fireworks",className:"ChatFireworks"},together:{package:"@langchain/together-ai",className:"ChatTogetherAI",hasCircularDependency:!0},perplexity:{package:"@langchain/perplexity",className:"ChatPerplexity"}},to=Object.keys(Fe);async function jo(e,t){let o;if(t)o=Fe[t];else{let n=Object.entries(Fe).find(([,r])=>r.className===e);o=n?n[1]:void 0}if(o)try{return(await import(o.package))[o.className]}catch(n){let r=n;if("code"in r&&r.code?.toString().includes("ERR_MODULE_NOT_FOUND")&&"message"in r&&typeof r.message=="string"){let s=(r.message.startsWith("Error: ")?r.message.slice(7):r.message).split("Cannot find package '")[1].split("'")[0];throw new Error(`Unable to import ${s}. Please install with \`npm install ${s}\` or \`pnpm install ${s}\``)}throw n}}async function Lo(e,t,o={}){let n=t||Do(e);if(!n)throw new Error(`Unable to infer model provider for { model: ${e} }, please specify modelProvider directly.`);let r=Fe[n];if(!r){let l=to.join(", ");throw new Error(`Unsupported { modelProvider: ${n} }.
|
|
25
25
|
|
|
26
|
-
Supported model providers are: ${l}`)}let{modelProvider:s,...a}=o;return new(await No(r.className,n))({model:e,...a,...n==="langsmith"?Oo(a):{}})}function Lo(e){return e.startsWith("gpt-3")||e.startsWith("gpt-4")||e.startsWith("gpt-5")||e.startsWith("o1")||e.startsWith("o3")||e.startsWith("o4")?"openai":e.startsWith("claude")?"anthropic":e.startsWith("command")?"cohere":e.startsWith("accounts/fireworks")?"fireworks":e.startsWith("gemini")?"google-vertexai":e.startsWith("amazon.")?"bedrock":e.startsWith("mistral")?"mistralai":e.startsWith("sonar")||e.startsWith("pplx")?"perplexity":void 0}var qt=class ze extends rt{_llmType(){return"chat_model"}lc_namespace=["langchain","chat_models"];_defaultConfig={};_configurableFields="any";_configPrefix;_queuedMethodOperations={};_modelInstanceCache=new Map;_profile;constructor(t){super(t),this._defaultConfig=t.defaultConfig??{},t.configurableFields==="any"?this._configurableFields="any":this._configurableFields=t.configurableFields??["model","modelProvider"],t.configPrefix?this._configPrefix=t.configPrefix.endsWith("_")?t.configPrefix:`${t.configPrefix}_`:this._configPrefix="",this._queuedMethodOperations=t.queuedMethodOperations??this._queuedMethodOperations,this._profile=t.profile??void 0,this.metadata={...this.metadata,ls_integration:"langchain_init_chat_model"}}async _getModelInstance(t){let o=this._getCacheKey(t),n=this._modelInstanceCache.get(o);if(n)return n;let r={...this._defaultConfig,...this._modelParams(t)},s=await jo(r.model,r.modelProvider,r);for(let[a,l]of Object.entries(this._queuedMethodOperations))a in s&&typeof s[a]=="function"&&(s=await s[a](...l));return this._modelInstanceCache.set(o,s),s}async _generate(t,o,n){return(await this._getModelInstance(o))._generate(t,o??{},n)}bindTools(t,o){let n={...this._queuedMethodOperations};return n.bindTools=[t,o],new ze({defaultConfig:this._defaultConfig,configurableFields:this._configurableFields,configPrefix:this._configPrefix,queuedMethodOperations:n})}withStructuredOutput=(t,...o)=>{let n={...this._queuedMethodOperations};return n.withStructuredOutput=[t,...o],new ze({defaultConfig:this._defaultConfig,configurableFields:this._configurableFields,configPrefix:this._configPrefix,queuedMethodOperations:n})};_modelParams(t){let o=t?.configurable??{},n={};for(let[r,s]of Object.entries(o))if(r.startsWith(this._configPrefix)){let a=this._removePrefix(r,this._configPrefix);n[a]=s}return this._configurableFields!=="any"&&(n=Object.fromEntries(Object.entries(n).filter(([r])=>this._configurableFields.includes(r)))),n}_removePrefix(t,o){return t.startsWith(o)?t.slice(o.length):t}withConfig(t){let o={...t||{}},n=this._modelParams(o),r=Object.fromEntries(Object.entries(o).filter(([s])=>s!=="configurable"));return r.configurable=Object.fromEntries(Object.entries(o.configurable||{}).filter(([s])=>this._configPrefix&&!Object.keys(n).includes(this._removePrefix(s,this._configPrefix)))),new Y({config:o,bound:new ze({defaultConfig:{...this._defaultConfig,...n},configurableFields:Array.isArray(this._configurableFields)?[...this._configurableFields]:this._configurableFields,configPrefix:this._configPrefix,queuedMethodOperations:this._queuedMethodOperations})})}async invoke(t,o){let n=await this._getModelInstance(o),r=ce(o);return n.invoke(t,r)}async stream(t,o){let n=new yt({generator:await(await this._getModelInstance(o)).stream(t,o),config:o});return await n.setup,qe.fromAsyncGenerator(n)}async batch(t,o,n){return super.batch(t,o,n)}async*transform(t,o){let n=await this._getModelInstance(o),r=ce(o);yield*n.transform(t,r)}async*streamLog(t,o,n){let r=await this._getModelInstance(o),s=ce(o);yield*r.streamLog(t,s,{...n,_schemaFormat:"original",includeNames:n?.includeNames,includeTypes:n?.includeTypes,includeTags:n?.includeTags,excludeNames:n?.excludeNames,excludeTypes:n?.excludeTypes,excludeTags:n?.excludeTags})}streamEvents(t,o,n){if(o?.version==="v1"||o?.version==="v2"){let a=this,l=o;async function*u(){let m=await a._getModelInstance(l),c={...ce(l),version:l.version,...l.encoding!==void 0?{encoding:l.encoding}:{}},h;l.version==="v1"&&l.encoding==="text/event-stream"||l.version==="v1"||l.version==="v2"&&l.encoding,h=m.streamEvents(t,c,n);for await(let d of h)yield d}return qe.fromAsyncGenerator(u())}let r=this;async function*s(){let a=await r._getModelInstance(o),l=ce(o);yield*a.streamEvents(t,l)}return new At(s())}get profile(){if(this._profile)return this._profile;let t=this._getCacheKey({});return this._modelInstanceCache.get(t)?.profile??{}}_getCacheKey(t){let o=t??{};if(o.configurable){let{configurable:n}=o,r={};for(let[s,a]of Object.entries(n))s.startsWith("__pregel_")||(r[s]=a);o={...o,configurable:r}}return JSON.stringify(o)}};async function ee(e,t){let{configurableFields:o,configPrefix:n,modelProvider:r,profile:s,...a}={configPrefix:"",...t??{}};if(r===void 0&&e?.includes(":")){let[c,...h]=e.split(":"),d=h.length===0?[c]:[c,h.join(":")];eo.includes(d[0])&&([r,e]=d)}let l=Array.isArray(o)?[...o]:o;!e&&l===void 0&&(l=["model","modelProvider"]),n&&l===void 0&&console.warn(`{ configPrefix: ${n} } has been set but no fields are configurable. Set { configurableFields: [...] } to specify the model params that are configurable.`);let u={...a},m;return l===void 0?m=new qt({defaultConfig:{...u,model:e,modelProvider:r},configPrefix:n,profile:s}):(e&&(u.model=e),r&&(u.modelProvider=r),m=new qt({defaultConfig:u,configPrefix:n,configurableFields:l,profile:s})),await m._getModelInstance(),m}var we=class extends Te{lc_namespace=["langgraph"];func;tags;config;trace=!0;recurse=!0;#e;constructor(e){super(),this.name=e.name??e.func.name,this.func=e.func,this.config=e.tags?{tags:e.tags}:void 0,this.recurse=e.recurse??this.recurse}getState(){return this.#e}setState(e){this.#e={...this.#e,...e}}async invoke(e,t){let o=$(this.config,t),n=await Qe.runWithConfig(o,async()=>this.func(e,o));return Te.isRunnable(n)&&this.recurse?await Qe.runWithConfig(o,async()=>n.invoke(e,o)):(this.#e=n,n)}};function to(e,t){let o,n;if(t==="inline")o=Ht,n=Gt;else throw new Error(`Invalid agent name mode: ${t}. Needs to be one of: "inline"`);function r(s){return s.map(o)}return ue.from([Ne.from(r),e,Ne.from(n)])}function Do(e){return T.isInstance(e)||H(e)||typeof e=="object"&&e!==null&&"structuredResponse"in e&&"messages"in e}var P="model_request",oo=class extends we{#e;#o;constructor(e){super({name:e.name??"model",func:(t,o)=>this.#t(t,o)}),this.#e=e,this.#o=e.systemMessage}async#r(e,t=this.#e.responseFormat){if(!t)return;let o;pe(e)?o=await e._getModelInstance():typeof e!="string"&&(o=e);let n=$t(t,void 0,o);if(n.length!==0)return n.every(r=>r instanceof q)?{type:"native",strategy:n[0]}:{type:"tool",tools:n.filter(r=>r instanceof G).reduce((r,s)=>(r[s.name]=s,r),{})}}async#t(e,t){let o=e.messages.at(-1);if(o&&M.isInstance(o)&&o.name&&this.#e.shouldReturnDirect.has(o.name))return[new L({update:{messages:[]}})];let{response:n,lastAiMessage:r,collectedCommands:s}=await this.#a(e,t);if(typeof n=="object"&&n!==null&&"structuredResponse"in n&&"messages"in n){let{structuredResponse:u,messages:m}=n;return{messages:[...e.messages,...m],structuredResponse:u}}let a=[],l=T.isInstance(n)?n:r;return l&&(l.name=this.name,l.lc_kwargs.name=this.name,this.#c(e,l)?a.push(new L({update:{messages:[new T({content:"Sorry, need more steps to process this request.",name:this.name,id:l.id})]}})):a.push(new L({update:{messages:[l]}}))),H(n)&&!s.includes(n)&&a.push(n),a.push(...s),a}#s(){if(typeof this.#e.model=="string")return ee(this.#e.model);if(this.#e.model)return this.#e.model;throw new Error("No model option was provided, either via `model` option.")}async#a(e,t,o={}){let n=await this.#s(),r=t,s=this.#o,a=null,l=[],u=async d=>{Be(d.model);let f=await this.#r(d.model,d.responseFormat),g=await this.#d(d.model,d,f),x=[...s.text===""?[]:[s],...d.messages],y=Ue(this.#e.signal,t.signal),w=await wt(g.invoke(x,{...t,signal:y}),y);if(a=w,f?.type==="native"){let N=f.strategy.parse(w);if(N)return{structuredResponse:N,messages:[w]};if(!w.tool_calls||w.tool_calls.length===0)throw new me(typeof f.strategy.schema?.title=="string"?f.strategy.schema.title:"providerStrategy",["Model output did not satisfy the provided response schema."]);return w}if(!f||!w.tool_calls)return w;let O=w.tool_calls.filter(N=>N.name in f.tools);if(O.length===0)return w;if(O.length>1)return this.#i(w,O,f);let A=f.tools[O[0].name]?.options?.toolMessageContent;return this.#l(w,O[0],f,A??o.lastMessage)},m=this.#e.wrapModelCallHookMiddleware??[],c=u;for(let d=m.length-1;d>=0;d--){let f=m[d],g=Array.isArray(f)?f[0]:f;if(g.wrapModelCall){let x=c,y=g;c=async w=>{let O=s,A=y.contextSchema?te(y.contextSchema,r?.context||{}):r?.context,N=Object.freeze({context:A,store:r.store,configurable:r.configurable,writer:r.writer,interrupt:r.interrupt,signal:r.signal}),K={...w,state:{...g.stateSchema?te(Qt(g.stateSchema),e):{},messages:e.messages},runtime:N},j=async b=>{s=O;let J=b.tools??[],le=new Map(this.#e.toolClasses.filter(ie).map(_=>[_.name,_])),Ee=J.filter(_=>ie(_)&&!le.has(_.name)),ye=J.filter(_=>{if(!ie(_))return!1;let v=le.get(_.name);return v!=null&&v!==_});if(Ee.length>0&&!this.#e.middleware?.some(_=>_.wrapToolCall!=null))throw new Error(`You have added a new tool in "wrapModelCall" hook of middleware "${y.name}": ${Ee.map(_=>_.name).join(", ")}. This is not supported unless a middleware provides a "wrapToolCall" handler to execute it.`);if(ye.length>0)throw new Error(`You have modified a tool in "wrapModelCall" hook of middleware "${y.name}": ${ye.map(_=>_.name).join(", ")}. This is not supported.`);let p=b,C=b.systemPrompt!==s.text,I=b.systemMessage!==s;if(C&&I)throw new Error("Cannot change both systemPrompt and systemMessage in the same request.");C&&(s=new z({content:[{type:"text",text:b.systemPrompt}]}),p={...b,systemPrompt:s.text,systemMessage:s}),I&&(s=new z({...b.systemMessage}),p={...b,systemPrompt:s.text,systemMessage:s});let k=await x(p);return H(k)&&a?(l.includes(k)||l.push(k),a):k};if(!y.wrapModelCall)return j(K);try{let b=await y.wrapModelCall(K,j);if(!Do(b))throw new Error(`Invalid response from "wrapModelCall" in middleware "${y.name}": expected AIMessage or Command, got ${typeof b}`);return T.isInstance(b)?a=b:H(b)&&l.push(b),b}catch(b){throw ne.wrap(b,y.name)}}}}s=this.#o;let h={model:n,responseFormat:this.#e.responseFormat,systemPrompt:s?.text,systemMessage:s,messages:e.messages,tools:this.#e.toolClasses,state:e,runtime:Object.freeze({context:r?.context,store:r.store,configurable:r.configurable,writer:r.writer,interrupt:r.interrupt,signal:r.signal})};return{response:await c(h),lastAiMessage:a,collectedCommands:l}}#i(e,t,o){let n=new Ce(t.map(r=>r.name));return this.#n(n,e,t[0],o)}#l(e,t,o,n){let r=o.tools[t.name];try{let s=r.parse(t.args);return{structuredResponse:s,messages:[e,new M({tool_call_id:t.id??"",content:JSON.stringify(s),name:t.name}),new T(n??`Returning structured response: ${JSON.stringify(s)}`)]}}catch(s){return this.#n(s,e,t,o)}}async#n(e,t,o,n){let r=Object.values(n.tools).at(0)?.options?.handleError,s=o.id;if(!s)throw new Error("Tool call ID is required to handle tool output errors. Please provide a tool call ID.");if(r===!1)throw e;if(r===void 0||typeof r=="boolean"&&r||Array.isArray(r)&&r.some(a=>a instanceof Ce))return new L({update:{messages:[t,new M({content:e.message,tool_call_id:s})]},goto:P});if(typeof r=="string")return new L({update:{messages:[t,new M({content:r,tool_call_id:s})]},goto:P});if(typeof r=="function"){let a=await r(e);if(typeof a!="string")throw new Error("Error handler must return a string.");return new L({update:{messages:[t,new M({content:a,tool_call_id:s})]},goto:P})}return new L({update:{messages:[t,new M({content:e.message,tool_call_id:s})]},goto:P})}#c(e,t){let o=T.isInstance(t)&&t.tool_calls?.every(r=>this.#e.shouldReturnDirect.has(r.name)),n="remainingSteps"in e?e.remainingSteps:void 0;return!!(n&&(n<1&&o||n<2&&ge(e.messages.at(-1))))}async#d(e,t,o){let n={},r=Object.values(o&&"tools"in o?o.tools:{}),s=[...t?.tools??this.#e.toolClasses,...r.map(u=>u.tool)],a=t?.toolChoice||(r.length>0?"any":void 0);if(o?.type==="native"){let u=t?.modelSettings?.strict??o?.strategy?.strict??!0,m={name:o.strategy.schema?.name??"extract",description:vt(o.strategy.schema),schema:o.strategy.schema,strict:u};Object.assign(n,{response_format:{type:"json_schema",json_schema:m},outputConfig:{format:{type:"json_schema",schema:o.strategy.schema}},responseSchema:o.strategy.schema,ls_structured_output_format:{kwargs:{method:"json_schema"},schema:o.strategy.schema},strict:t?.modelSettings?.strict})}let l=await Vt(e,s,{...n,...t?.modelSettings,tool_choice:a});return this.#e.includeAgentName==="inline"?to(l,this.#e.includeAgentName):l}getState(){let e=super.getState();return{messages:[],...e&&!H(e)?e:{}}}};var no=(e,t)=>`Error: ${e} is not a valid tool, try one of [${t.join(", ")}].`,D="tools",ro=e=>Array.isArray(e)&&e.every(Ke.isInstance),$o=e=>typeof e=="object"&&e!=null&&"messages"in e&&ro(e.messages),Bo=e=>typeof e=="object"&&e!=null&&"lg_tool_call"in e;function Uo(e,t){return fe.isInstance(e)?new M({content:e.message,tool_call_id:t.id,name:t.name}):new M({content:`${e}
|
|
27
|
-
Please fix your mistakes.`,tool_call_id:t.id,name:t.name})}var
|
|
28
|
-
Please fix your mistakes.`,tool_call_id:t.id});throw n}async runTool(e,t,o){let n=t,r={context:n?.context,store:n?.store,configurable:n?.configurable,writer:n?.writer,interrupt:n?.interrupt,signal:n?.signal},s=this.tools.find(u=>u.name===e.name),a=async u=>{let{toolCall:m,tool:c}=u,h=c??this.tools.find(f=>f.name===m.name);if(h===void 0){let f=this.tools.map(g=>g.name);return new M({content:no(m.name,f),tool_call_id:m.id,name:m.name,status:"error"})}let d=h;try{let f=await d.invoke({...m,type:"tool_call"},{...t,config:t,toolCallId:m.id,state:t.configurable?.__pregel_scratchpad?.currentTaskInput,signal:Ue(this.signal,t.signal)});return M.isInstance(f)||H(f)?f:new M({name:d.name,content:typeof f=="string"?f:JSON.stringify(f),tool_call_id:m.id})}catch(f){throw f instanceof pt?new fe(f,m):f}},l={toolCall:e,tool:s,state:o,runtime:r};if(this.wrapToolCall)try{return await this.wrapToolCall(l,a)}catch(u){return this.#e(u,e,!0)}if(!s){let u=this.tools.map(m=>m.name);return new M({content:no(e.name,u),tool_call_id:e.id,name:e.name,status:"error"})}try{return await a(l)}catch(u){return this.#e(u,e,!1)}}async run(e,t){let o;if(Bo(e)){let{lg_tool_call:s,jumpTo:a,...l}=e;o=[await this.runTool(e.lg_tool_call,t,l)]}else{let s;if(ro(e))s=e;else if($o(e))s=e.messages;else throw new Error("ToolNode only accepts BaseMessage[] or { messages: BaseMessage[] } as input.");let a=new Set(s.filter(u=>u.getType()==="tool").map(u=>u.tool_call_id)),l;for(let u=s.length-1;u>=0;u-=1){let m=s[u];if(T.isInstance(m)){l=m;break}}if(!T.isInstance(l))throw new Error("ToolNode only accepts AIMessages as input.");o=await Promise.all(l.tool_calls?.filter(u=>u.id==null||!a.has(u.id)).map(u=>this.runTool(u,t,e))??[])}if(!o.some(H))return Array.isArray(e)?o:{messages:o};let n=[],r=null;for(let s of o)H(s)?s.graph===L.PARENT&&Array.isArray(s.goto)&&s.goto.every(a=>zo(a))?r?r.goto.push(...s.goto):r=new L({graph:L.PARENT,goto:s.goto}):n.push(s):n.push(Array.isArray(e)?[s]:{messages:[s]});return r&&n.push(r),n}};function zo(e){return e instanceof U}function Se(e,t){let n=0;if(t&&t.length>0){let r=0;for(let s of t){let a=ot(s)?xt(s):s;r+=JSON.stringify(a).length}n+=r}for(let r of e){let s;typeof r.content=="string"?s=r.content:Array.isArray(r.content)?s=r.content.map(a=>typeof a=="string"?a:a.type==="text"&&"text"in a?a.text:"").join(""):s="",T.isInstance(r)&&Array.isArray(r.tool_calls)&&r.tool_calls.length>0&&(s+=JSON.stringify(r.tool_calls)),M.isInstance(r)&&(s+=r.tool_call_id??""),n+=s.length}return Math.ceil(n/4)}function X(e){if(!(!e||typeof e=="function"))return e.canJumpTo}function re(e){return typeof e=="function"?e:e.hook}var Fo=class{},Wo=class{},se=class extends we{constructor(e){super(e)}async invokeMiddleware(e,t){let o={};if(this.middleware.contextSchema&&F(this.middleware.contextSchema)){let u=de(this.middleware.contextSchema);if(u){let m={},c=t?.context||{};for(let h of Object.keys(u))h in c&&(m[h]=c[h]);o=te(this.middleware.contextSchema,m)}}let n={...e,messages:e.messages},r={context:o,store:t?.store,configurable:t?.configurable,writer:t?.writer,interrupt:t?.interrupt,signal:t?.signal},s=await this.runHook(n,Object.freeze(Object.assign(new Wo,{...r,context:Object.freeze(Object.assign(new Fo,o))})));if(!s)return{jumpTo:void 0};let a,l;if(this.name?.startsWith("BeforeAgentNode_")?(a=X(this.middleware.beforeAgent),l="beforeAgent.canJumpTo"):this.name?.startsWith("BeforeModelNode_")?(a=X(this.middleware.beforeModel),l="beforeModel.canJumpTo"):this.name?.startsWith("AfterAgentNode_")?(a=X(this.middleware.afterAgent),l="afterAgent.canJumpTo"):this.name?.startsWith("AfterModelNode_")&&(a=X(this.middleware.afterModel),l="afterModel.canJumpTo"),typeof s.jumpTo=="string"&&!a?.includes(s.jumpTo)){let u=a&&a.length>0?`must be one of: ${a?.join(", ")}.`:l?`no ${l} defined in middleware ${this.middleware.name}`:"";throw new Error(`Invalid jump target: ${s.jumpTo}, ${u}.`)}if(typeof s=="object"&&"type"in s){if(s.type==="terminate"){if(s.error)throw s.error;return{...n,...s.result||{},jumpTo:s.jumpTo}}throw new Error(`Invalid control action: ${JSON.stringify(s)}`)}return{...n,...s,jumpTo:s.jumpTo}}get nodeOptions(){return{input:Xt(this.middleware.stateSchema)}}};var ao=class extends se{middleware;lc_namespace=["langchain","agents","beforeAgentNodes"];constructor(e){super({name:`BeforeAgentNode_${e.name}`,func:async(t,o)=>this.invokeMiddleware(t,o)}),this.middleware=e}runHook(e,t){return re(this.middleware.beforeAgent)(e,t)}};var io=class extends se{middleware;lc_namespace=["langchain","agents","beforeModelNodes"];constructor(e){super({name:`BeforeModelNode_${e.name}`,func:async(t,o)=>this.invokeMiddleware(t,o)}),this.middleware=e}runHook(e,t){return re(this.middleware.beforeModel)(e,t)}};var lo=class extends se{middleware;lc_namespace=["langchain","agents","afterModelNodes"];constructor(e){super({name:`AfterModelNode_${e.name}`,func:async(t,o)=>this.invokeMiddleware(t,o)}),this.middleware=e}runHook(e,t){return re(this.middleware.afterModel)(e,t)}};var co=class extends se{middleware;lc_namespace=["langchain","agents","afterAgentNodes"];constructor(e){super({name:`AfterAgentNode_${e.name}`,func:async(t,o)=>this.invokeMiddleware(t,o)}),this.middleware=e}runHook(e,t){return re(this.middleware.afterAgent)(e,t)}};var uo=class mo{options;#e;#o="v2";#r;#t;constructor(t,o){if(this.options=t,this.#t=$(o??{},{metadata:{ls_integration:"langchain_create_agent"},configurable:{ls_agent_type:"root"}}),t.name&&(this.#t=$(this.#t,{metadata:{lc_agent_name:t.name}})),this.#o=t.version??this.#o,!t.model)throw new Error("`model` option is required to create an agent.");typeof t.model!="string"&&Be(t.model);let n=this.options.middleware?.filter(p=>p.tools).flatMap(p=>p.tools)??[],r=[...t.tools??[],...n],s=new Set(r.filter(ie).filter(p=>"returnDirect"in p&&p.returnDirect).map(p=>p.name)),a=!!this.options.middleware?.some(p=>p.wrapModelCall),{state:l,input:u,output:m}=Ft(this.options.responseFormat!==void 0||a,this.options.stateSchema,this.options.middleware),c=new Nt(l,{input:u,output:m,context:this.options.contextSchema}),h=[],d=[],f=[],g=[],x=[];this.#r=new oo({model:this.options.model,systemMessage:Jt(this.options.systemPrompt),includeAgentName:this.options.includeAgentName,name:this.options.name,responseFormat:this.options.responseFormat,middleware:this.options.middleware,toolClasses:r,shouldReturnDirect:s,signal:this.options.signal,wrapModelCallHookMiddleware:x});let y=new Set,w=this.options.middleware??[];for(let p=0;p<w.length;p++){let C,I,k,_,v=w[p];if(y.has(v.name))throw new Error(`Middleware ${v.name} is defined multiple times`);if(y.add(v.name),v.beforeAgent){C=new ao(v);let S=`${v.name}.before_agent`;h.push({index:p,name:S,allowed:X(v.beforeAgent)}),c.addNode(S,C,C.nodeOptions)}if(v.beforeModel){I=new io(v);let S=`${v.name}.before_model`;d.push({index:p,name:S,allowed:X(v.beforeModel)}),c.addNode(S,I,I.nodeOptions)}if(v.afterModel){k=new lo(v);let S=`${v.name}.after_model`;f.push({index:p,name:S,allowed:X(v.afterModel)}),c.addNode(S,k,k.nodeOptions)}if(v.afterAgent){_=new co(v);let S=`${v.name}.after_agent`;g.push({index:p,name:S,allowed:X(v.afterAgent)}),c.addNode(S,_,_.nodeOptions)}v.wrapModelCall&&x.push(v)}c.addNode(P,this.#r);let O=w.some(p=>p.wrapToolCall),A=r.filter(ie);if(A.length>0||O){let p=new so(A,{signal:this.options.signal,wrapToolCall:Kt(w)});c.addNode(D,p)}let N;h.length>0?N=h[0].name:d.length>0?N=d[0].name:N=P;let K=d.length>0?d[0].name:P,j=g.length>0?g[g.length-1].name:R;c.addEdge(It,N);let b=A.length>0||O;for(let p=0;p<h.length;p++){let C=h[p],I=C.name,k=p===h.length-1?K:h[p+1].name;if(C.allowed&&C.allowed.length>0){let _=C.allowed.map(S=>V(S)).filter(S=>S!=="tools"||b),v=Array.from(new Set([k,..._.map(S=>S===R?j:S)]));c.addConditionalEdges(I,this.#c(A,k,j,b),v)}else c.addEdge(I,k)}for(let p=0;p<d.length;p++){let C=d[p],I=C.name,k=p===d.length-1?P:d[p+1].name;if(C.allowed&&C.allowed.length>0){let _=C.allowed.map(S=>V(S)).filter(S=>S!=="tools"||b),v=Array.from(new Set([k,..._]));c.addConditionalEdges(I,this.#d(A,k,b),v)}else c.addEdge(I,k)}let J=f.at(-1);if(f.length>0&&J)c.addEdge(P,J.name);else{let p=this.#s(A,!1,b).map(C=>C===R?j:C);p.length===1?c.addEdge(P,p[0]):c.addConditionalEdges(P,this.#i(j),p)}for(let p=f.length-1;p>0;p--){let C=f[p],I=C.name,k=f[p-1].name;if(C.allowed&&C.allowed.length>0){let _=C.allowed.map(S=>V(S)).filter(S=>S!=="tools"||b),v=Array.from(new Set([k,..._]));c.addConditionalEdges(I,this.#n(A,C.allowed,k,b),v)}else c.addEdge(I,k)}if(f.length>0){let p=f[0],C=p.name,I=this.#s(A,!0,b).filter(v=>v!=="tools"||b),k=!!(p.allowed&&p.allowed.length>0),_=I.map(v=>v===R?j:v);c.addConditionalEdges(C,this.#l(A,k,j,b),_)}for(let p=g.length-1;p>0;p--){let C=g[p],I=C.name,k=g[p-1].name;if(C.allowed&&C.allowed.length>0){let _=C.allowed.map(S=>V(S)).filter(S=>S!=="tools"||b),v=Array.from(new Set([k,..._]));c.addConditionalEdges(I,this.#n(A,C.allowed,k,b),v)}else c.addEdge(I,k)}if(g.length>0){let p=g[0],C=p.name;if(p.allowed&&p.allowed.length>0){let I=p.allowed.map(_=>V(_)).filter(_=>_!=="tools"||b),k=Array.from(new Set([R,...I]));c.addConditionalEdges(C,this.#n(A,p.allowed,R,b),k)}else c.addEdge(C,R)}if(b){let p=K;s.size>0?c.addConditionalEdges(D,this.#a(s,j,p),[p,j]):c.addEdge(D,p)}let le=(this.options.middleware??[]).flatMap(p=>p.streamTransformers??[]),Ee=[ae([]),he([]),...le,...this.options.streamTransformers??[]];this.#e=c.compile({checkpointer:this.options.checkpointer,store:this.options.store,name:this.options.name,description:this.options.description,transformers:Ee});let ye=Yt(this.#t);Object.keys(ye).length>0&&(this.#e=this.#e.withConfig(ye))}get graph(){return this.#e}get checkpointer(){return this.#e.checkpointer}set checkpointer(t){this.#e.checkpointer=t}get store(){return this.#e.store}set store(t){this.#e.store=t}withConfig(t){return new mo(this.options,$(this.#t,t))}#s(t,o=!1,n=t.length>0){let r=[];return n&&r.push(D),o&&r.push(P),r.push(R),r}#a(t,o,n){return r=>{let s=r.messages,a=s[s.length-1];return M.isInstance(a)&&a.name&&t.has(a.name)?this.options.responseFormat?n:o:n}}#i(t=R){return o=>{let n=o.messages.at(-1);if(!T.isInstance(n)||!n.tool_calls||n.tool_calls.length===0||n.tool_calls.every(s=>s.name.startsWith("extract-")))return t;if(this.#o==="v1")return D;let r=n.tool_calls.filter(s=>!s.name.startsWith("extract-"));return r.length===0?t:r.map(s=>new U(D,{...o,lg_tool_call:s}))}}#l(t,o,n,r=t.length>0){let s=!!this.options.responseFormat;return a=>{let l=a,u=l.messages,m=u.at(-1);if(T.isInstance(m)&&(!m.tool_calls||m.tool_calls.length===0))return n;if(o&&l.jumpTo){let w=V(l.jumpTo);return w===R?n:w==="tools"?r?new U(D,{...a,jumpTo:void 0}):n:new U(P,{...a,jumpTo:void 0})}let c=u.filter(M.isInstance),h=u.filter(T.isInstance).at(-1),d=h?.tool_calls?.filter(w=>!c.some(O=>O.tool_call_id===w.id));if(d&&d.length>0)return this.#o==="v1"?D:d.map(w=>new U(D,{...a,lg_tool_call:w}));let f=h?.tool_calls?.some(w=>w.name.startsWith("extract-"));if(d&&d.length===0&&!f&&s)return P;if(!T.isInstance(m)||!m.tool_calls||m.tool_calls.length===0)return n;let g=m.tool_calls.every(w=>w.name.startsWith("extract-")),x=m.tool_calls.some(w=>!w.name.startsWith("extract-"));if(g||!x)return n;if(this.#o==="v1")return D;let y=m.tool_calls.filter(w=>!w.name.startsWith("extract-"));return y.length===0?n:y.map(w=>new U(D,{...a,lg_tool_call:w}))}}#n(t,o,n,r=t.length>0){let s=new Set(o.map(a=>V(a)));return a=>{let l=a;if(l.jumpTo){let u=V(l.jumpTo);if(u===R&&s.has(R))return R;if(u==="tools"&&s.has("tools"))return r?new U(D,{...a,jumpTo:void 0}):R;if(u==="model_request"&&s.has("model_request"))return new U(P,{...a,jumpTo:void 0})}return n}}#c(t,o,n,r=t.length>0){return s=>{let a=s;if(!a.jumpTo)return o;let l=V(a.jumpTo);return l===R?n:l==="tools"?r?new U(D,{...s,jumpTo:void 0}):n:new U(P,{...s,jumpTo:void 0})}}#d(t,o,n=t.length>0){return r=>{let s=r;if(!s.jumpTo)return o;let a=V(s.jumpTo);return a===R?R:a==="tools"?n?new U(D,{...r,jumpTo:void 0}):R:new U(P,{...r,jumpTo:void 0})}}async#u(t,o){if(!this.options.middleware||this.options.middleware.length===0||t instanceof L||!t)return t;let n=await Zt(this.options.middleware,t),r={...(await this.#e.getState(o).catch(()=>({values:{}}))).values,...t};if(!r)return r;for(let[s,a]of Object.entries(n))s in r||(r[s]=a);return r}async invoke(t,o){let n=$(this.#t,o),r=await this.#u(t,n);return this.#e.invoke(r,n)}async stream(t,o){let n=$(this.#t,o),r=await this.#u(t,n);return this.#e.stream(r,n)}streamEvents(t,o,n){if(o?.version!=="v3"||n!=null){let r=$(this.#t,o),s=o?.version==="v1"||o?.version==="v2"?o.version:"v2";return this.#e.streamEvents(t,{...r,version:s},n)}return(async()=>{let{transformers:r,version:s,...a}=o??{},l=$(this.#t,a),u=await this.#u(t,l);return await this.#e.streamEvents(u,{...l,version:"v3",transformers:r})})()}async drawMermaidPng(t){let o=await(await(await this.#e.getGraphAsync()).drawMermaidPng(t)).arrayBuffer();return new Uint8Array(o)}async drawMermaid(t){return(await this.#e.getGraphAsync()).drawMermaid(t)}getGraphAsync(t){return this.#e.getGraphAsync(t)}getState(t,o){return this.#e.getState(t,o)}getStateHistory(t,o){return this.#e.getStateHistory(t,o)}getSubgraphs(t,o){return this.#e.getSubgraphs(t,o)}getSubgraphsAsync(t,o){return this.#e.getSubgraphsAsync(t,o)}updateState(t,o,n){return this.#e.updateState(t,o,n)}get builder(){return this.#e.builder}};function Vo(e){return new uo(e)}var Yo=i.function().args(i.custom()).returns(i.union([i.boolean(),i.promise(i.boolean())])),Zo=i.function().args(i.custom(),i.custom(),i.custom()).returns(i.union([i.string(),i.promise(i.string())])),Xo=["approve","edit","reject"],Qo=i.enum(Xo),qo=i.object({allowedDecisions:i.array(Qo),description:i.union([i.string(),Zo]).optional(),argsSchema:i.record(i.any()).optional(),when:Yo.optional()}),qa=i.object({interruptOn:i.record(i.union([i.boolean(),qo])).optional(),descriptionPrefix:i.string().default("Tool execution requires approval")});var We="nostream",He=i.object({maxRetries:i.number().min(0).default(2),retryOn:i.union([i.function().args(i.instanceof(Error)).returns(i.boolean()),i.array(i.custom())]).default(()=>e=>ft(e)??!0),backoffFactor:i.number().min(0).default(2),initialDelayMs:i.number().min(0).default(1e3),maxDelayMs:i.number().min(0).default(6e4),jitter:i.boolean().default(!0)});var Ge=`<role>
|
|
26
|
+
Supported model providers are: ${l}`)}let{modelProvider:s,...a}=o;return new(await jo(r.className,n))({model:e,...a,...n==="langsmith"?No(a):{}})}function Do(e){return e.startsWith("gpt-3")||e.startsWith("gpt-4")||e.startsWith("gpt-5")||e.startsWith("o1")||e.startsWith("o3")||e.startsWith("o4")?"openai":e.startsWith("claude")?"anthropic":e.startsWith("command")?"cohere":e.startsWith("accounts/fireworks")?"fireworks":e.startsWith("gemini")?"google-vertexai":e.startsWith("amazon.")?"bedrock":e.startsWith("mistral")?"mistralai":e.startsWith("sonar")||e.startsWith("pplx")?"perplexity":void 0}var eo=class ze extends rt{_llmType(){return"chat_model"}lc_namespace=["langchain","chat_models"];_defaultConfig={};_configurableFields="any";_configPrefix;_queuedMethodOperations={};_modelInstanceCache=new Map;_profile;constructor(t){super(t),this._defaultConfig=t.defaultConfig??{},t.configurableFields==="any"?this._configurableFields="any":this._configurableFields=t.configurableFields??["model","modelProvider"],t.configPrefix?this._configPrefix=t.configPrefix.endsWith("_")?t.configPrefix:`${t.configPrefix}_`:this._configPrefix="",this._queuedMethodOperations=t.queuedMethodOperations??this._queuedMethodOperations,this._profile=t.profile??void 0,this.metadata={...this.metadata,ls_integration:"langchain_init_chat_model"}}async _getModelInstance(t){let o=this._getCacheKey(t),n=this._modelInstanceCache.get(o);if(n)return n;let r={...this._defaultConfig,...this._modelParams(t)},s=await Lo(r.model,r.modelProvider,r);for(let[a,l]of Object.entries(this._queuedMethodOperations))a in s&&typeof s[a]=="function"&&(s=await s[a](...l));return this._modelInstanceCache.set(o,s),s}async _generate(t,o,n){return(await this._getModelInstance(o))._generate(t,o??{},n)}bindTools(t,o){let n={...this._queuedMethodOperations};return n.bindTools=[t,o],new ze({defaultConfig:this._defaultConfig,configurableFields:this._configurableFields,configPrefix:this._configPrefix,queuedMethodOperations:n})}withStructuredOutput=(t,...o)=>{let n={...this._queuedMethodOperations};return n.withStructuredOutput=[t,...o],new ze({defaultConfig:this._defaultConfig,configurableFields:this._configurableFields,configPrefix:this._configPrefix,queuedMethodOperations:n})};_modelParams(t){let o=t?.configurable??{},n={};for(let[r,s]of Object.entries(o))if(r.startsWith(this._configPrefix)){let a=this._removePrefix(r,this._configPrefix);n[a]=s}return this._configurableFields!=="any"&&(n=Object.fromEntries(Object.entries(n).filter(([r])=>this._configurableFields.includes(r)))),n}_removePrefix(t,o){return t.startsWith(o)?t.slice(o.length):t}withConfig(t){let o={...t||{}},n=this._modelParams(o),r=Object.fromEntries(Object.entries(o).filter(([s])=>s!=="configurable"));return r.configurable=Object.fromEntries(Object.entries(o.configurable||{}).filter(([s])=>this._configPrefix&&!Object.keys(n).includes(this._removePrefix(s,this._configPrefix)))),new Z({config:o,bound:new ze({defaultConfig:{...this._defaultConfig,...n},configurableFields:Array.isArray(this._configurableFields)?[...this._configurableFields]:this._configurableFields,configPrefix:this._configPrefix,queuedMethodOperations:this._queuedMethodOperations})})}async invoke(t,o){let n=await this._getModelInstance(o),r=ce(o);return n.invoke(t,r)}async stream(t,o){let n=new yt({generator:await(await this._getModelInstance(o)).stream(t,o),config:o});return await n.setup,qe.fromAsyncGenerator(n)}async batch(t,o,n){return super.batch(t,o,n)}async*transform(t,o){let n=await this._getModelInstance(o),r=ce(o);yield*n.transform(t,r)}async*streamLog(t,o,n){let r=await this._getModelInstance(o),s=ce(o);yield*r.streamLog(t,s,{...n,_schemaFormat:"original",includeNames:n?.includeNames,includeTypes:n?.includeTypes,includeTags:n?.includeTags,excludeNames:n?.excludeNames,excludeTypes:n?.excludeTypes,excludeTags:n?.excludeTags})}streamEvents(t,o,n){if(o?.version==="v1"||o?.version==="v2"){let a=this,l=o;async function*u(){let m=await a._getModelInstance(l),c={...ce(l),version:l.version,...l.encoding!==void 0?{encoding:l.encoding}:{}},h;l.version==="v1"&&l.encoding==="text/event-stream"||l.version==="v1"||l.version==="v2"&&l.encoding,h=m.streamEvents(t,c,n);for await(let d of h)yield d}return qe.fromAsyncGenerator(u())}let r=this;async function*s(){let a=await r._getModelInstance(o),l=ce(o);yield*a.streamEvents(t,l)}return new At(s())}get profile(){if(this._profile)return this._profile;let t=this._getCacheKey({});return this._modelInstanceCache.get(t)?.profile??{}}_getCacheKey(t){let o=t??{};if(o.configurable){let{configurable:n}=o,r={};for(let[s,a]of Object.entries(n))s.startsWith("__pregel_")||(r[s]=a);o={...o,configurable:r}}return JSON.stringify(o)}};async function ee(e,t){let{configurableFields:o,configPrefix:n,modelProvider:r,profile:s,...a}={configPrefix:"",...t??{}};if(r===void 0&&e?.includes(":")){let[c,...h]=e.split(":"),d=h.length===0?[c]:[c,h.join(":")];to.includes(d[0])&&([r,e]=d)}let l=Array.isArray(o)?[...o]:o;!e&&l===void 0&&(l=["model","modelProvider"]),n&&l===void 0&&console.warn(`{ configPrefix: ${n} } has been set but no fields are configurable. Set { configurableFields: [...] } to specify the model params that are configurable.`);let u={...a},m;return l===void 0?m=new eo({defaultConfig:{...u,model:e,modelProvider:r},configPrefix:n,profile:s}):(e&&(u.model=e),r&&(u.modelProvider=r),m=new eo({defaultConfig:u,configPrefix:n,configurableFields:l,profile:s})),await m._getModelInstance(),m}var ye=class extends be{lc_namespace=["langgraph"];func;tags;config;trace=!0;recurse=!0;#e;constructor(e){super(),this.name=e.name??e.func.name,this.func=e.func,this.config=e.tags?{tags:e.tags}:void 0,this.recurse=e.recurse??this.recurse}getState(){return this.#e}setState(e){this.#e={...this.#e,...e}}async invoke(e,t){let o=$(this.config,t),n=await Qe.runWithConfig(o,async()=>this.func(e,o));return be.isRunnable(n)&&this.recurse?await Qe.runWithConfig(o,async()=>n.invoke(e,o)):(this.#e=n,n)}};function oo(e,t){let o,n;if(t==="inline")o=Gt,n=Jt;else throw new Error(`Invalid agent name mode: ${t}. Needs to be one of: "inline"`);function r(s){return s.map(o)}return me.from([Ne.from(r),e,Ne.from(n)])}function $o(e){return T.isInstance(e)||H(e)||typeof e=="object"&&e!==null&&"structuredResponse"in e&&"messages"in e}var P="model_request",no=class extends ye{#e;#o;constructor(e){super({name:e.name??"model",func:(t,o)=>this.#t(t,o)}),this.#e=e,this.#o=e.systemMessage}async#r(e,t=this.#e.responseFormat){if(!t)return;let o;fe(e)?o=await e._getModelInstance():typeof e!="string"&&(o=e);let n=$t(t,void 0,o);if(n.length!==0)return n.every(r=>r instanceof V)?{type:"native",strategy:n[0]}:{type:"tool",tools:n.filter(r=>r instanceof G).reduce((r,s)=>(r[s.name]=s,r),{})}}async#t(e,t){let o=e.messages.at(-1);if(o&&M.isInstance(o)&&o.name&&this.#e.shouldReturnDirect.has(o.name))return[new L({update:{messages:[]}})];let{response:n,lastAiMessage:r,collectedCommands:s}=await this.#a(e,t);if(typeof n=="object"&&n!==null&&"structuredResponse"in n&&"messages"in n){let{structuredResponse:u,messages:m}=n;return{messages:[...e.messages,...m],structuredResponse:u}}let a=[],l=T.isInstance(n)?n:r;return l&&(l.name=this.name,l.lc_kwargs.name=this.name,this.#c(e,l)?a.push(new L({update:{messages:[new T({content:"Sorry, need more steps to process this request.",name:this.name,id:l.id})]}})):a.push(new L({update:{messages:[l]}}))),H(n)&&!s.includes(n)&&a.push(n),a.push(...s),a}#s(){if(typeof this.#e.model=="string")return ee(this.#e.model);if(this.#e.model)return this.#e.model;throw new Error("No model option was provided, either via `model` option.")}async#a(e,t,o={}){let n=await this.#s(),r=t,s=this.#o,a=null,l=[],u=async d=>{Be(d.model);let f=await this.#r(d.model,d.responseFormat),g=await this.#d(d.model,d,f),x=[...s.text===""?[]:[s],...d.messages],y=Ue(this.#e.signal,t.signal),w=await wt(g.invoke(x,{...t,signal:y}),y);if(a=w,f?.type==="native"){let N=f.strategy.parse(w);if(N)return{structuredResponse:N,messages:[w]};if(!w.tool_calls||w.tool_calls.length===0)throw new pe(typeof f.strategy.schema?.title=="string"?f.strategy.schema.title:"providerStrategy",["Model output did not satisfy the provided response schema."]);return w}if(!f||!w.tool_calls)return w;let O=w.tool_calls.filter(N=>N.name in f.tools);if(O.length===0)return w;if(O.length>1)return this.#i(w,O,f);let A=f.tools[O[0].name]?.options?.toolMessageContent;return this.#l(w,O[0],f,A??o.lastMessage)},m=this.#e.wrapModelCallHookMiddleware??[],c=u;for(let d=m.length-1;d>=0;d--){let f=m[d],g=Array.isArray(f)?f[0]:f;if(g.wrapModelCall){let x=c,y=g;c=async w=>{let O=s,A=y.contextSchema?te(y.contextSchema,r?.context||{}):r?.context,N=Object.freeze({context:A,store:r.store,configurable:r.configurable,writer:r.writer,interrupt:r.interrupt,signal:r.signal}),Y={...w,state:{...g.stateSchema?te(qt(g.stateSchema),e):{},messages:e.messages},runtime:N},j=async b=>{s=O;let J=b.tools??[],le=new Map(this.#e.toolClasses.filter(ie).map(_=>[_.name,_])),Ae=J.filter(_=>ie(_)&&!le.has(_.name)),Me=J.filter(_=>{if(!ie(_))return!1;let v=le.get(_.name);return v!=null&&v!==_});if(Ae.length>0&&!this.#e.middleware?.some(_=>_.wrapToolCall!=null))throw new Error(`You have added a new tool in "wrapModelCall" hook of middleware "${y.name}": ${Ae.map(_=>_.name).join(", ")}. This is not supported unless a middleware provides a "wrapToolCall" handler to execute it.`);if(Me.length>0)throw new Error(`You have modified a tool in "wrapModelCall" hook of middleware "${y.name}": ${Me.map(_=>_.name).join(", ")}. This is not supported.`);let p=b,C=b.systemPrompt!==s.text,I=b.systemMessage!==s;if(C&&I)throw new Error("Cannot change both systemPrompt and systemMessage in the same request.");C&&(s=new z({content:[{type:"text",text:b.systemPrompt}]}),p={...b,systemPrompt:s.text,systemMessage:s}),I&&(s=new z({...b.systemMessage}),p={...b,systemPrompt:s.text,systemMessage:s});let k=await x(p);return H(k)&&a?(l.includes(k)||l.push(k),a):k};if(!y.wrapModelCall)return j(Y);try{let b=await y.wrapModelCall(Y,j);if(!$o(b))throw new Error(`Invalid response from "wrapModelCall" in middleware "${y.name}": expected AIMessage or Command, got ${typeof b}`);return T.isInstance(b)?a=b:H(b)&&l.push(b),b}catch(b){throw ne.wrap(b,y.name)}}}}s=this.#o;let h={model:n,responseFormat:this.#e.responseFormat,systemPrompt:s?.text,systemMessage:s,messages:e.messages,tools:this.#e.toolClasses,state:e,runtime:Object.freeze({context:r?.context,store:r.store,configurable:r.configurable,writer:r.writer,interrupt:r.interrupt,signal:r.signal})};return{response:await c(h),lastAiMessage:a,collectedCommands:l}}#i(e,t,o){let n=new xe(t.map(r=>r.name));return this.#n(n,e,t[0],o)}#l(e,t,o,n){let r=o.tools[t.name];try{let s=r.parse(t.args);return{structuredResponse:s,messages:[e,new M({tool_call_id:t.id??"",content:JSON.stringify(s),name:t.name}),new T(n??`Returning structured response: ${JSON.stringify(s)}`)]}}catch(s){return this.#n(s,e,t,o)}}async#n(e,t,o,n){let r=Object.values(n.tools).at(0)?.options?.handleError,s=o.id;if(!s)throw new Error("Tool call ID is required to handle tool output errors. Please provide a tool call ID.");if(r===!1)throw e;if(r===void 0||typeof r=="boolean"&&r||Array.isArray(r)&&r.some(a=>a instanceof xe))return new L({update:{messages:[t,new M({content:e.message,tool_call_id:s})]},goto:P});if(typeof r=="string")return new L({update:{messages:[t,new M({content:r,tool_call_id:s})]},goto:P});if(typeof r=="function"){let a=await r(e);if(typeof a!="string")throw new Error("Error handler must return a string.");return new L({update:{messages:[t,new M({content:a,tool_call_id:s})]},goto:P})}return new L({update:{messages:[t,new M({content:e.message,tool_call_id:s})]},goto:P})}#c(e,t){let o=T.isInstance(t)&&t.tool_calls?.every(r=>this.#e.shouldReturnDirect.has(r.name)),n="remainingSteps"in e?e.remainingSteps:void 0;return!!(n&&(n<1&&o||n<2&&we(e.messages.at(-1))))}async#d(e,t,o){let n={},r=Object.values(o&&"tools"in o?o.tools:{}),s=[...t?.tools??this.#e.toolClasses,...r.map(u=>u.tool)],a=t?.toolChoice||(r.length>0?"any":void 0);if(o?.type==="native"){let u=t?.modelSettings?.strict??o?.strategy?.strict??!0,m={name:o.strategy.schema?.name??"extract",description:vt(o.strategy.schema),schema:o.strategy.schema,strict:u};Object.assign(n,{response_format:{type:"json_schema",json_schema:m},outputConfig:{format:{type:"json_schema",schema:o.strategy.schema}},responseSchema:o.strategy.schema,ls_structured_output_format:{kwargs:{method:"json_schema"},schema:o.strategy.schema},strict:t?.modelSettings?.strict})}let l=await Kt(e,s,{...n,...t?.modelSettings,tool_choice:a});return this.#e.includeAgentName==="inline"?oo(l,this.#e.includeAgentName):l}getState(){let e=super.getState();return{messages:[],...e&&!H(e)?e:{}}}};var ro=(e,t)=>`Error: ${e} is not a valid tool, try one of [${t.join(", ")}].`,D="tools",so=e=>Array.isArray(e)&&e.every(Ke.isInstance),Bo=e=>typeof e=="object"&&e!=null&&"messages"in e&&so(e.messages),Uo=e=>typeof e=="object"&&e!=null&&"lg_tool_call"in e;function zo(e,t){return he.isInstance(e)?new M({content:e.message,tool_call_id:t.id,name:t.name}):new M({content:`${e}
|
|
27
|
+
Please fix your mistakes.`,tool_call_id:t.id,name:t.name})}var ao=class extends ye{options;tools;trace=!1;signal;handleToolErrors=zo;wrapToolCall;constructor(e,t){let{name:o,tags:n,handleToolErrors:r,signal:s,wrapToolCall:a}=t??{};super({name:o,tags:n,func:(l,u)=>this.run(l,u)}),this.options=t,this.tools=e,this.handleToolErrors=r??this.handleToolErrors,this.signal=s,this.wrapToolCall=a}#e(e,t,o){if(Rt(e)||this.signal?.aborted)throw e;let n=e,r=o;if(o){let s=e;for(;ne.isInstance(s);)s=s.cause;he.isInstance(s)&&(n=s,r=!1)}if(r&&this.handleToolErrors!==!0||!this.handleToolErrors)throw n;if(typeof this.handleToolErrors=="function"){let s=this.handleToolErrors(n,t);if(s&&M.isInstance(s))return s;throw n}else if(this.handleToolErrors)return new M({name:t.name,content:`${n}
|
|
28
|
+
Please fix your mistakes.`,tool_call_id:t.id});throw n}async runTool(e,t,o){let n=t,r={context:n?.context,store:n?.store,configurable:n?.configurable,writer:n?.writer,interrupt:n?.interrupt,signal:n?.signal},s=this.tools.find(u=>u.name===e.name),a=async u=>{let{toolCall:m,tool:c}=u,h=c??this.tools.find(f=>f.name===m.name);if(h===void 0){let f=this.tools.map(g=>g.name);return new M({content:ro(m.name,f),tool_call_id:m.id,name:m.name,status:"error"})}let d=h;try{let f=await d.invoke({...m,type:"tool_call"},{...t,config:t,toolCallId:m.id,state:t.configurable?.__pregel_scratchpad?.currentTaskInput,signal:Ue(this.signal,t.signal)});return M.isInstance(f)||H(f)?f:new M({name:d.name,content:typeof f=="string"?f:JSON.stringify(f),tool_call_id:m.id})}catch(f){throw f instanceof pt?new he(f,m):f}},l={toolCall:e,tool:s,state:o,runtime:r};if(this.wrapToolCall)try{return await this.wrapToolCall(l,a)}catch(u){return this.#e(u,e,!0)}if(!s){let u=this.tools.map(m=>m.name);return new M({content:ro(e.name,u),tool_call_id:e.id,name:e.name,status:"error"})}try{return await a(l)}catch(u){return this.#e(u,e,!1)}}async run(e,t){let o;if(Uo(e)){let{lg_tool_call:s,jumpTo:a,...l}=e;o=[await this.runTool(e.lg_tool_call,t,l)]}else{let s;if(so(e))s=e;else if(Bo(e))s=e.messages;else throw new Error("ToolNode only accepts BaseMessage[] or { messages: BaseMessage[] } as input.");let a=new Set(s.filter(u=>u.getType()==="tool").map(u=>u.tool_call_id)),l;for(let u=s.length-1;u>=0;u-=1){let m=s[u];if(T.isInstance(m)){l=m;break}}if(!T.isInstance(l))throw new Error("ToolNode only accepts AIMessages as input.");o=await Promise.all(l.tool_calls?.filter(u=>u.id==null||!a.has(u.id)).map(u=>this.runTool(u,t,e))??[])}if(!o.some(H))return Array.isArray(e)?o:{messages:o};let n=[],r=null;for(let s of o)H(s)?s.graph===L.PARENT&&Array.isArray(s.goto)&&s.goto.every(a=>Fo(a))?r?r.goto.push(...s.goto):r=new L({graph:L.PARENT,goto:s.goto}):n.push(s):n.push(Array.isArray(e)?[s]:{messages:[s]});return r&&n.push(r),n}};function Fo(e){return e instanceof U}function ke(e,t){let n=0;if(t&&t.length>0){let r=0;for(let s of t){let a=ot(s)?xt(s):s;r+=JSON.stringify(a).length}n+=r}for(let r of e){let s;typeof r.content=="string"?s=r.content:Array.isArray(r.content)?s=r.content.map(a=>typeof a=="string"?a:a.type==="text"&&"text"in a?a.text:"").join(""):s="",T.isInstance(r)&&Array.isArray(r.tool_calls)&&r.tool_calls.length>0&&(s+=JSON.stringify(r.tool_calls)),M.isInstance(r)&&(s+=r.tool_call_id??""),n+=s.length}return Math.ceil(n/4)}function Q(e){if(!(!e||typeof e=="function"))return e.canJumpTo}function re(e){return typeof e=="function"?e:e.hook}var Wo=class{},Ho=class{},se=class extends ye{constructor(e){super(e)}async invokeMiddleware(e,t){let o={};if(this.middleware.contextSchema&&F(this.middleware.contextSchema)){let u=de(this.middleware.contextSchema);if(u){let m={},c=t?.context||{};for(let h of Object.keys(u))h in c&&(m[h]=c[h]);o=te(this.middleware.contextSchema,m)}}let n={...e,messages:e.messages},r={context:o,store:t?.store,configurable:t?.configurable,writer:t?.writer,interrupt:t?.interrupt,signal:t?.signal},s=await this.runHook(n,Object.freeze(Object.assign(new Ho,{...r,context:Object.freeze(Object.assign(new Wo,o))})));if(!s)return{jumpTo:void 0};let a,l;if(this.name?.startsWith("BeforeAgentNode_")?(a=Q(this.middleware.beforeAgent),l="beforeAgent.canJumpTo"):this.name?.startsWith("BeforeModelNode_")?(a=Q(this.middleware.beforeModel),l="beforeModel.canJumpTo"):this.name?.startsWith("AfterAgentNode_")?(a=Q(this.middleware.afterAgent),l="afterAgent.canJumpTo"):this.name?.startsWith("AfterModelNode_")&&(a=Q(this.middleware.afterModel),l="afterModel.canJumpTo"),typeof s.jumpTo=="string"&&!a?.includes(s.jumpTo)){let u=a&&a.length>0?`must be one of: ${a?.join(", ")}.`:l?`no ${l} defined in middleware ${this.middleware.name}`:"";throw new Error(`Invalid jump target: ${s.jumpTo}, ${u}.`)}if(typeof s=="object"&&"type"in s){if(s.type==="terminate"){if(s.error)throw s.error;return{...n,...s.result||{},jumpTo:s.jumpTo}}throw new Error(`Invalid control action: ${JSON.stringify(s)}`)}return{...n,...s,jumpTo:s.jumpTo}}get nodeOptions(){return{input:Qt(this.middleware.stateSchema)}}};var io=class extends se{middleware;lc_namespace=["langchain","agents","beforeAgentNodes"];constructor(e){super({name:`BeforeAgentNode_${e.name}`,func:async(t,o)=>this.invokeMiddleware(t,o)}),this.middleware=e}runHook(e,t){return re(this.middleware.beforeAgent)(e,t)}};var lo=class extends se{middleware;lc_namespace=["langchain","agents","beforeModelNodes"];constructor(e){super({name:`BeforeModelNode_${e.name}`,func:async(t,o)=>this.invokeMiddleware(t,o)}),this.middleware=e}runHook(e,t){return re(this.middleware.beforeModel)(e,t)}};var co=class extends se{middleware;lc_namespace=["langchain","agents","afterModelNodes"];constructor(e){super({name:`AfterModelNode_${e.name}`,func:async(t,o)=>this.invokeMiddleware(t,o)}),this.middleware=e}runHook(e,t){return re(this.middleware.afterModel)(e,t)}};var uo=class extends se{middleware;lc_namespace=["langchain","agents","afterAgentNodes"];constructor(e){super({name:`AfterAgentNode_${e.name}`,func:async(t,o)=>this.invokeMiddleware(t,o)}),this.middleware=e}runHook(e,t){return re(this.middleware.afterAgent)(e,t)}};var mo=class fo{options;#e;#o="v2";#r;#t;constructor(t,o){if(this.options=t,this.#t=$(o??{},{metadata:{ls_integration:"langchain_create_agent"},configurable:{ls_agent_type:"root"}}),t.name&&(this.#t=$(this.#t,{metadata:{lc_agent_name:t.name}})),this.#o=t.version??this.#o,!t.model)throw new Error("`model` option is required to create an agent.");typeof t.model!="string"&&Be(t.model);let n=this.options.middleware?.filter(p=>p.tools).flatMap(p=>p.tools)??[],r=[...t.tools??[],...n],s=new Set(r.filter(ie).filter(p=>"returnDirect"in p&&p.returnDirect).map(p=>p.name)),a=!!this.options.middleware?.some(p=>p.wrapModelCall),{state:l,input:u,output:m}=Wt(this.options.responseFormat!==void 0||a,this.options.stateSchema,this.options.middleware),c=new Nt(l,{input:u,output:m,context:this.options.contextSchema}),h=[],d=[],f=[],g=[],x=[];this.#r=new no({model:this.options.model,systemMessage:Vt(this.options.systemPrompt),includeAgentName:this.options.includeAgentName,name:this.options.name,responseFormat:this.options.responseFormat,middleware:this.options.middleware,toolClasses:r,shouldReturnDirect:s,signal:this.options.signal,wrapModelCallHookMiddleware:x});let y=new Set,w=this.options.middleware??[];for(let p=0;p<w.length;p++){let C,I,k,_,v=w[p];if(y.has(v.name))throw new Error(`Middleware ${v.name} is defined multiple times`);if(y.add(v.name),v.beforeAgent){C=new io(v);let S=`${v.name}.before_agent`;h.push({index:p,name:S,allowed:Q(v.beforeAgent)}),c.addNode(S,C,C.nodeOptions)}if(v.beforeModel){I=new lo(v);let S=`${v.name}.before_model`;d.push({index:p,name:S,allowed:Q(v.beforeModel)}),c.addNode(S,I,I.nodeOptions)}if(v.afterModel){k=new co(v);let S=`${v.name}.after_model`;f.push({index:p,name:S,allowed:Q(v.afterModel)}),c.addNode(S,k,k.nodeOptions)}if(v.afterAgent){_=new uo(v);let S=`${v.name}.after_agent`;g.push({index:p,name:S,allowed:Q(v.afterAgent)}),c.addNode(S,_,_.nodeOptions)}v.wrapModelCall&&x.push(v)}c.addNode(P,this.#r);let O=w.some(p=>p.wrapToolCall),A=r.filter(ie);if(A.length>0||O){let p=new ao(A,{signal:this.options.signal,wrapToolCall:Yt(w)});c.addNode(D,p)}let N;h.length>0?N=h[0].name:d.length>0?N=d[0].name:N=P;let Y=d.length>0?d[0].name:P,j=g.length>0?g[g.length-1].name:R;c.addEdge(It,N);let b=A.length>0||O;for(let p=0;p<h.length;p++){let C=h[p],I=C.name,k=p===h.length-1?Y:h[p+1].name;if(C.allowed&&C.allowed.length>0){let _=C.allowed.map(S=>K(S)).filter(S=>S!=="tools"||b),v=Array.from(new Set([k,..._.map(S=>S===R?j:S)]));c.addConditionalEdges(I,this.#c(A,k,j,b),v)}else c.addEdge(I,k)}for(let p=0;p<d.length;p++){let C=d[p],I=C.name,k=p===d.length-1?P:d[p+1].name;if(C.allowed&&C.allowed.length>0){let _=C.allowed.map(S=>K(S)).filter(S=>S!=="tools"||b),v=Array.from(new Set([k,..._]));c.addConditionalEdges(I,this.#d(A,k,b),v)}else c.addEdge(I,k)}let J=f.at(-1);if(f.length>0&&J)c.addEdge(P,J.name);else{let p=this.#s(A,!1,b).map(C=>C===R?j:C);p.length===1?c.addEdge(P,p[0]):c.addConditionalEdges(P,this.#i(j),p)}for(let p=f.length-1;p>0;p--){let C=f[p],I=C.name,k=f[p-1].name;if(C.allowed&&C.allowed.length>0){let _=C.allowed.map(S=>K(S)).filter(S=>S!=="tools"||b),v=Array.from(new Set([k,..._]));c.addConditionalEdges(I,this.#n(A,C.allowed,k,b),v)}else c.addEdge(I,k)}if(f.length>0){let p=f[0],C=p.name,I=this.#s(A,!0,b).filter(v=>v!=="tools"||b),k=!!(p.allowed&&p.allowed.length>0),_=I.map(v=>v===R?j:v);c.addConditionalEdges(C,this.#l(A,k,j,b),_)}for(let p=g.length-1;p>0;p--){let C=g[p],I=C.name,k=g[p-1].name;if(C.allowed&&C.allowed.length>0){let _=C.allowed.map(S=>K(S)).filter(S=>S!=="tools"||b),v=Array.from(new Set([k,..._]));c.addConditionalEdges(I,this.#n(A,C.allowed,k,b),v)}else c.addEdge(I,k)}if(g.length>0){let p=g[0],C=p.name;if(p.allowed&&p.allowed.length>0){let I=p.allowed.map(_=>K(_)).filter(_=>_!=="tools"||b),k=Array.from(new Set([R,...I]));c.addConditionalEdges(C,this.#n(A,p.allowed,R,b),k)}else c.addEdge(C,R)}if(b){let p=Y;s.size>0?c.addConditionalEdges(D,this.#a(s,j,p),[p,j]):c.addEdge(D,p)}let le=(this.options.middleware??[]).flatMap(p=>p.streamTransformers??[]),Ae=[ae([]),ge([]),...le,...this.options.streamTransformers??[]];this.#e=c.compile({checkpointer:this.options.checkpointer,store:this.options.store,name:this.options.name,description:this.options.description,transformers:Ae});let Me=Zt(this.#t);Object.keys(Me).length>0&&(this.#e=this.#e.withConfig(Me))}get graph(){return this.#e}get checkpointer(){return this.#e.checkpointer}set checkpointer(t){this.#e.checkpointer=t}get store(){return this.#e.store}set store(t){this.#e.store=t}withConfig(t){return new fo(this.options,$(this.#t,t))}#s(t,o=!1,n=t.length>0){let r=[];return n&&r.push(D),o&&r.push(P),r.push(R),r}#a(t,o,n){return r=>{let s=r.messages,a=s[s.length-1];return M.isInstance(a)&&a.name&&t.has(a.name)?this.options.responseFormat?n:o:n}}#i(t=R){return o=>{let n=o.messages.at(-1);if(!T.isInstance(n)||!n.tool_calls||n.tool_calls.length===0||n.tool_calls.every(s=>s.name.startsWith("extract-")))return t;if(this.#o==="v1")return D;let r=n.tool_calls.filter(s=>!s.name.startsWith("extract-"));return r.length===0?t:r.map(s=>new U(D,{...o,lg_tool_call:s}))}}#l(t,o,n,r=t.length>0){let s=!!this.options.responseFormat;return a=>{let l=a,u=l.messages,m=u.at(-1);if(T.isInstance(m)&&(!m.tool_calls||m.tool_calls.length===0))return n;if(o&&l.jumpTo){let w=K(l.jumpTo);return w===R?n:w==="tools"?r?new U(D,{...a,jumpTo:void 0}):n:new U(P,{...a,jumpTo:void 0})}let c=u.filter(M.isInstance),h=u.filter(T.isInstance).at(-1),d=h?.tool_calls?.filter(w=>!c.some(O=>O.tool_call_id===w.id));if(d&&d.length>0)return this.#o==="v1"?D:d.map(w=>new U(D,{...a,lg_tool_call:w}));let f=h?.tool_calls?.some(w=>w.name.startsWith("extract-"));if(d&&d.length===0&&!f&&s)return P;if(!T.isInstance(m)||!m.tool_calls||m.tool_calls.length===0)return n;let g=m.tool_calls.every(w=>w.name.startsWith("extract-")),x=m.tool_calls.some(w=>!w.name.startsWith("extract-"));if(g||!x)return n;if(this.#o==="v1")return D;let y=m.tool_calls.filter(w=>!w.name.startsWith("extract-"));return y.length===0?n:y.map(w=>new U(D,{...a,lg_tool_call:w}))}}#n(t,o,n,r=t.length>0){let s=new Set(o.map(a=>K(a)));return a=>{let l=a;if(l.jumpTo){let u=K(l.jumpTo);if(u===R&&s.has(R))return R;if(u==="tools"&&s.has("tools"))return r?new U(D,{...a,jumpTo:void 0}):R;if(u==="model_request"&&s.has("model_request"))return new U(P,{...a,jumpTo:void 0})}return n}}#c(t,o,n,r=t.length>0){return s=>{let a=s;if(!a.jumpTo)return o;let l=K(a.jumpTo);return l===R?n:l==="tools"?r?new U(D,{...s,jumpTo:void 0}):n:new U(P,{...s,jumpTo:void 0})}}#d(t,o,n=t.length>0){return r=>{let s=r;if(!s.jumpTo)return o;let a=K(s.jumpTo);return a===R?R:a==="tools"?n?new U(D,{...r,jumpTo:void 0}):R:new U(P,{...r,jumpTo:void 0})}}async#u(t,o){if(!this.options.middleware||this.options.middleware.length===0||t instanceof L||!t)return t;let n=await Xt(this.options.middleware,t),r={...(await this.#e.getState(o).catch(()=>({values:{}}))).values,...t};if(!r)return r;for(let[s,a]of Object.entries(n))s in r||(r[s]=a);return r}async invoke(t,o){let n=$(this.#t,o),r=await this.#u(t,n);return this.#e.invoke(r,n)}async stream(t,o){let n=$(this.#t,o),r=await this.#u(t,n);return this.#e.stream(r,n)}streamEvents(t,o,n){if(o?.version!=="v3"||n!=null){let r=$(this.#t,o),s=o?.version==="v1"||o?.version==="v2"?o.version:"v2";return this.#e.streamEvents(t,{...r,version:s},n)}return(async()=>{let{transformers:r,version:s,...a}=o??{},l=$(this.#t,a),u=await this.#u(t,l);return await this.#e.streamEvents(u,{...l,version:"v3",transformers:r})})()}async drawMermaidPng(t){let o=await(await(await this.#e.getGraphAsync()).drawMermaidPng(t)).arrayBuffer();return new Uint8Array(o)}async drawMermaid(t){return(await this.#e.getGraphAsync()).drawMermaid(t)}getGraphAsync(t){return this.#e.getGraphAsync(t)}getState(t,o){return this.#e.getState(t,o)}getStateHistory(t,o){return this.#e.getStateHistory(t,o)}getSubgraphs(t,o){return this.#e.getSubgraphs(t,o)}getSubgraphsAsync(t,o){return this.#e.getSubgraphsAsync(t,o)}updateState(t,o,n){return this.#e.updateState(t,o,n)}get builder(){return this.#e.builder}};function Vo(e){return new mo(e)}var Yo=i.function().args(i.custom()).returns(i.union([i.boolean(),i.promise(i.boolean())])),Zo=i.function().args(i.custom(),i.custom(),i.custom()).returns(i.union([i.string(),i.promise(i.string())])),Xo=["approve","edit","reject"],Qo=i.enum(Xo),qo=i.object({allowedDecisions:i.array(Qo),description:i.union([i.string(),Zo]).optional(),argsSchema:i.record(i.any()).optional(),when:Yo.optional()}),qa=i.object({interruptOn:i.record(i.union([i.boolean(),qo])).optional(),descriptionPrefix:i.string().default("Tool execution requires approval")});var We="nostream",He=i.object({maxRetries:i.number().min(0).default(2),retryOn:i.union([i.function().args(i.instanceof(Error)).returns(i.boolean()),i.array(i.custom())]).default(()=>e=>ft(e)??!0),backoffFactor:i.number().min(0).default(2),initialDelayMs:i.number().min(0).default(1e3),maxDelayMs:i.number().min(0).default(6e4),jitter:i.boolean().default(!0)});var Ge=`<role>
|
|
29
29
|
Context Extraction Assistant
|
|
30
30
|
</role>
|
|
31
31
|
|
|
@@ -51,6 +51,6 @@ Respond ONLY with the extracted context. Do not include any additional informati
|
|
|
51
51
|
<messages>
|
|
52
52
|
Messages to summarize:
|
|
53
53
|
{messages}
|
|
54
|
-
</messages>`,en="Here is a summary of the conversation to date:",Je=20,tn=4e3,
|
|
54
|
+
</messages>`,en="Here is a summary of the conversation to date:",Je=20,tn=4e3,po=5,on=i.function().args(i.array(i.custom())).returns(i.union([i.number(),i.promise(i.number())])),Ee=i.object({fraction:i.number().gt(0,"Fraction must be greater than 0").max(1,"Fraction must be less than or equal to 1").optional(),tokens:i.number().positive("Tokens must be greater than 0").optional(),messages:i.number().int("Messages must be an integer").positive("Messages must be greater than 0").optional()}).refine(e=>[e.fraction,e.tokens,e.messages].filter(t=>t!==void 0).length>=1,{message:"At least one of fraction, tokens, or messages must be provided"}),mt=i.object({fraction:i.number().min(0,"Messages must be non-negative").max(1,"Fraction must be less than or equal to 1").optional(),tokens:i.number().min(0,"Tokens must be greater than or equal to 0").optional(),messages:i.number().int("Messages must be an integer").min(0,"Messages must be non-negative").optional()}).refine(e=>[e.fraction,e.tokens,e.messages].filter(t=>t!==void 0).length===1,{message:"Exactly one of fraction, tokens, or messages must be provided"}),ho=i.object({model:i.custom(),trigger:i.union([Ee,i.array(Ee)]).optional(),keep:mt.optional(),tokenCounter:on.optional(),summaryPrompt:i.string().default(Ge),trimTokensToSummarize:i.number().optional(),summaryPrefix:i.string().optional(),maxTokensBeforeSummary:i.number().optional(),messagesToKeep:i.number().optional()});function Ve(e){if("profile"in e&&typeof e.profile=="object"&&e.profile&&"maxInputTokens"in e.profile&&(typeof e.profile.maxInputTokens=="number"||e.profile.maxInputTokens==null))return e.profile.maxInputTokens??void 0;if("model"in e&&typeof e.model=="string")return nt(e.model);if("modelName"in e&&typeof e.modelName=="string")return nt(e.modelName)}function wo(e){let{data:t,error:o}=bt(ho,e);if(o)throw new Error(`Invalid summarization middleware options: ${B.prettifyError(o)}`);return E({name:"SummarizationMiddleware",contextSchema:ho.extend({model:i.custom().optional()}),beforeModel:async(n,r)=>{let s=t.trigger,a=t.keep;t.maxTokensBeforeSummary!==void 0&&(console.warn("maxTokensBeforeSummary is deprecated. Use `trigger: { tokens: value }` instead."),s===void 0&&(s={tokens:t.maxTokensBeforeSummary})),t.messagesToKeep!==void 0&&(console.warn("messagesToKeep is deprecated. Use `keep: { messages: value }` instead."),(!a||a&&"messages"in a&&a.messages===Je)&&(a={messages:t.messagesToKeep}));let l=r.context?.trigger!==void 0?r.context.trigger:s,u=r.context?.keep!==void 0?r.context.keep:a??{messages:Je},m=mt.parse(u),c=[];l===void 0?c=[]:Array.isArray(l)?c=l.map(J=>Ee.parse(J)):c=[Ee.parse(l)];let h=c.some(J=>"fraction"in J)||"fraction"in m,d=typeof t.model=="string"?await ee(t.model):t.model;if(h&&!Ve(d))throw new Error("Model profile information is required to use fractional token limits. Use absolute token counts instead.");let f=r.context?.summaryPrompt===Ge?t.summaryPrompt??Ge:r.context?.summaryPrompt??t.summaryPrompt??Ge,g=r.context.summaryPrefix??t.summaryPrefix??en,x=r.context?.trimTokensToSummarize!==void 0?r.context.trimTokensToSummarize:t.trimTokensToSummarize??tn;nn(n.messages);let y=r.context?.tokenCounter!==void 0?r.context.tokenCounter:t.tokenCounter??ke,w=await y(n.messages);if(!await an(n.messages,w,c,d))return;let{systemPrompt:O,conversationMessages:A}=rn(n.messages),N=await ln(A,m,y,d);if(N<=0)return;let{messagesToSummarize:Y,preservedMessages:j}=sn(O,A,N),b=new q({content:`${g}
|
|
55
55
|
|
|
56
|
-
${await un(
|
|
56
|
+
${await un(Y,d,f,y,x,r)}`,id:A[0].id,additional_kwargs:{lc_source:"summarization"}});return{messages:[new Ye({id:Ot}),b,...j]}}})}function nn(e){for(let t of e)t.id||(t.id=gt())}function rn(e){return e.length>0&&z.isInstance(e[0])?{systemPrompt:e[0],conversationMessages:e.slice(1)}:{conversationMessages:e}}function sn(e,t,o){let n=t.slice(0,o),r=t.slice(o);return e&&n.unshift(e),{messagesToSummarize:n,preservedMessages:r}}async function an(e,t,o,n){if(o.length===0)return!1;for(let r of o){let s=!0,a=!1;if(r.messages!==void 0&&(a=!0,e.length<r.messages&&(s=!1)),r.tokens!==void 0&&(a=!0,t<r.tokens&&(s=!1)),r.fraction!==void 0){a=!0;let l=Ve(n);typeof l=="number"?t<Math.floor(l*r.fraction)&&(s=!1):s=!1}if(a&&s)return!0}return!1}async function ln(e,t,o,n){if("tokens"in t||"fraction"in t){let r=await cn(e,t,o,n);return typeof r=="number"?r:go(e,Je)}return go(e,t.messages??Je)}async function cn(e,t,o,n){if(e.length===0)return 0;let r;if("fraction"in t&&t.fraction!==void 0){let c=Ve(n);if(typeof c!="number")return;r=Math.floor(c*t.fraction)}else if("tokens"in t&&t.tokens!==void 0)r=Math.floor(t.tokens);else return;if(r<=0&&(r=1),await o(e)<=r)return 0;let s=0,a=e.length,l=e.length,u=Math.floor(Math.log2(e.length))+1;for(let c=0;c<u&&!(s>=a);c++){let h=Math.floor((s+a)/2);await o(e.slice(h))<=r?(l=h,a=h):s=h+1}if(l===e.length&&(l=s),l>=e.length){if(e.length===1)return 0;l=e.length-1}let m=To(e,l);if(m<=l)return m;for(let c=l;c>=0;c--)if(yo(e,c))return c;return 0}function go(e,t){if(e.length<=t)return 0;let o=e.length-t,n=To(e,o);if(n<=o)return n;for(let r=o;r>=0;r--)if(yo(e,r))return r;return 0}function yo(e,t){if(t>=e.length)return!0;if(t<e.length&&T.isInstance(e[t])&&we(e[t]))return!1;let o=Math.max(0,t-po),n=Math.min(e.length,t+po);for(let r=o;r<n;r++){if(!we(e[r]))continue;let s=Mo(e[r]);if(dn(e,r,t,s))return!1}return!0}function Mo(e){let t=new Set;if(e.tool_calls)for(let o of e.tool_calls){let n=typeof o=="object"&&"id"in o?o.id:null;n&&t.add(n)}return t}function To(e,t){if(t>=e.length||!M.isInstance(e[t]))return t;let o=new Set,n=t;for(;n<e.length&&M.isInstance(e[n]);){let r=e[n];r.tool_call_id&&o.add(r.tool_call_id),n++}for(let r=t-1;r>=0;r--){let s=e[r];if(T.isInstance(s)&&we(s)){let a=Mo(s);for(let l of o)if(a.has(l))return r}}return n}function dn(e,t,o,n){for(let r=t+1;r<e.length;r++){let s=e[r];if(M.isInstance(s)&&n.has(s.tool_call_id)&&t<o!=r<o)return!0}return!1}async function un(e,t,o,n,r,s){if(!e.length)return"No previous conversation history.";let a=await mn(e,n,r);if(!a.length)return"Previous conversation was too long to summarize.";let l=ht(a);try{let u=o.replace("{messages}",l),m=$(Ie(s)??{},{metadata:{lc_source:"summarization"},tags:[We]}),c=(await t.invoke(u,m)).content;return typeof c=="string"?c.trim():Array.isArray(c)?c.map(h=>typeof h=="string"?h:typeof h=="object"&&h!==null&&"text"in h?h.text:"").join("").trim():"Error generating summary: Invalid response format"}catch(u){return`Error generating summary: ${u}`}}async function mn(e,t,o){if(o===void 0)return e;try{return await tt(e,{maxTokens:o,tokenCounter:async n=>t(n),strategy:"last",allowPartial:!0,includeSystem:!0})}catch{return e.slice(-15)}}var Ei=i.object({model:i.string().or(i.instanceof(Et)).optional(),systemPrompt:i.string().optional(),maxTools:i.number().optional(),alwaysInclude:i.array(i.string()).optional()});var ji=i.object({applyToInput:i.boolean().optional(),applyToOutput:i.boolean().optional(),applyToToolResults:i.boolean().optional()});var Ui=i.object({rules:i.record(i.string(),i.instanceof(RegExp).describe("Regular expression pattern to match PII")).optional()});var fn=["continue","error","end"],pn="continue";var hn=i.enum(fn).default(pn);i.object({toolName:i.string().optional(),threadLimit:i.number().optional(),runLimit:i.number().optional(),exitBehavior:hn});var Zi=i.object({threadToolCallCount:i.record(i.string(),i.number()).default({}),runToolCallCount:i.record(i.string(),i.number()).default({})});var gn=i.enum(["pending","in_progress","completed"]).describe("Status of the todo"),wn=i.object({content:i.string().describe("Content of the todo item"),status:gn}),rl=i.object({todos:i.array(wn).default([])});var yn="end",Mn=i.object({threadLimit:i.number().optional(),runLimit:i.number().optional(),exitBehavior:i.enum(["error","end"]).optional()}),Tn=i.object({threadModelCallCount:i.number().default(0),runModelCallCount:i.number().default(0)}),bo=class extends Error{constructor({threadLimit:e,runLimit:t,threadCount:o,runCount:n}){let r=[];typeof e=="number"&&typeof o=="number"&&r.push(`thread level call limit reached with ${o} model calls`),typeof t=="number"&&typeof n=="number"&&r.push(`run level call limit reached with ${n} model calls`),super(`Model call limits exceeded${r.length>0?`: ${r.join(", ")}`:""}`),this.name="ModelCallLimitMiddlewareError"}};function vo(e){return E({name:"ModelCallLimitMiddleware",contextSchema:Mn,stateSchema:Tn,beforeModel:{canJumpTo:["end"],hook:(t,o)=>{let n=o.context.exitBehavior??e?.exitBehavior??yn;n==="throw"&&(console.warn("The 'throw' exit behavior is deprecated. Please use 'error' instead."),n="error");let r=o.context.threadLimit??e?.threadLimit,s=o.context.runLimit??e?.runLimit,a=t.threadModelCallCount,l=t.runModelCallCount;if(typeof r=="number"&&r<=a){let u=new bo({threadLimit:r,threadCount:a});if(n==="end")return{jumpTo:"end",messages:[new T(u.message)]};throw u}if(typeof s=="number"&&s<=l){let u=new bo({runLimit:s,runCount:l});if(n==="end")return{jumpTo:"end",messages:[new T(u.message)]};throw u}return t}},afterModel:t=>({runModelCallCount:t.runModelCallCount+1,threadModelCallCount:t.threadModelCallCount+1}),afterAgent:()=>({runModelCallCount:0})})}var bl=i.object({onFailure:i.union([i.literal("error"),i.literal("continue"),i.function().args(i.instanceof(Error)).returns(i.string())]).default("continue")}).merge(He);var Al=i.object({tools:i.array(i.union([i.custom(),i.custom(),i.string()])).optional(),onFailure:i.union([i.literal("error"),i.literal("continue"),i.literal("raise"),i.literal("return_message"),i.function().args(i.instanceof(Error)).returns(i.string())]).default("continue")}).merge(He);var Zl=i.object({enableCaching:i.boolean().optional(),ttl:i.enum(["5m","1h"]).optional(),minMessagesToCache:i.number().optional(),unsupportedModelBehavior:i.enum(["ignore","warn","raise"]).optional()});var ec=i.object({enableCaching:i.boolean().optional(),ttl:i.enum(["5m","1h"]).optional(),minMessagesToCache:i.number().optional(),unsupportedModelBehavior:i.enum(["ignore","warn","raise"]).optional()});export{Bt as a,E as b,Vo as c,wo as d,vo as e};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import n from"./VNLSYVPE.js";import m from"./QNXI3WOF.js";import{a as o,c as p}from"./V6HOUZPZ.js";import"./TWU3QXAS.js";import l from"./VWP2B4LB.js";import"./5Q2XRQS6.js";import k from"./K7YQIJFT.js";import j from"./H6P3WP5D.js";import h from"./SZRJTQ54.js";import g from"./AVZ5Y6BK.js";import f from"./CCC6LBMY.js";import"./34O57OGV.js";import"./LXPGQNXQ.js";import"./FDOMMK2M.js";import e from"./WVP73XWD.js";import"./Z5XQLSYH.js";import"./OZAZ277H.js";import d from"./AVRS6UCQ.js";import"./K5JVB6FU.js";import"./FCI6M62J.js";import"./BFZ5S7NF.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import c from"./DG27JEYG.js";import"./FS7GXTTQ.js";import"./WXQ26G5Q.js";import"./MJSIYEWN.js";import b from"./AHCXG7XF.js";import a from"./UHICISBZ.js";import"./ONQ6JSBJ.js";import{v as i,z as r}from"./COH3QXWG.js";import"./R74ZHFA6.js";import"./V7Y22FRP.js";import"./AXTQU5YL.js";import"./LOQ2PKV5.js";import"./IYLFJCJ2.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,,,,,,,,,,m])=>{var t=class extends i{constructor(){super(...arguments),this.agent=m}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-help-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=o(this,"arcgis-assistant-help-agent"),this.#i=p(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-help-agent",t);return t},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/knowledgeGraphService",a,b,c,d,e,f,g,h,j,k,l,m,n)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
2
|
-
import{a as c}from"./
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a as c}from"./ONQ6JSBJ.js";import{Dc as a}from"./IYLFJCJ2.js";import{a as t}from"./VXFQANGJ.js";async function i(o,e){return await e.goTo({scale:o}),{text:`Successfully zoomed to: ${o}`}}async function r({scale:o},e){let{mapView:s}=c(e,["mapView"]);return await i(o,s)}var m=t.object({scale:t.number().describe("The map scale of the view to go to.")}),p=a(r,{name:"goToScale",description:"Go to the specified view scale.",schema:m});export{p as a};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
2
|
-
import"./
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import"./UZLQALHY.js";var e=`## GIS Agent Orchestrator
|
|
3
3
|
|
|
4
4
|
You are an orchestrator for an ArcGIS Maps SDK for JavaScript system.
|
|
5
5
|
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import c from"./SHI76XUV.js";import"./P4XZMBU5.js";import b from"./TYATJUNF.js";import"./JQYLMTDP.js";import a from"./DG27JEYG.js";import"./FS7GXTTQ.js";import"./R74ZHFA6.js";import"./V7Y22FRP.js";import"./QRMRID2M.js";import"./AXTQU5YL.js";import"./LOQ2PKV5.js";import"./IYLFJCJ2.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,a])=>{return a},a,b,c)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
2
|
export default $arcgis.t(([{formatDateOnly:h,convertDateFormatToIntlOptions:m,formatTimeOnly:N,formatDate:c}])=>{var T=new Set(["date","esrifieldtypedate","date-only","dateonly","esrifieldtypedateonly","time-only","timeonly","esrifieldtypetimeonly","timestamp-offset","timestampoffset","esrifieldtypetimestampoffset"]),y=e=>{if(!e)return!1;let t=e.toLowerCase();return T.has(t)},f=e=>{if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e=="number"&&Number.isFinite(e)){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}return null},S=e=>!e||e==="system"?Intl.DateTimeFormat().resolvedOptions().timeZone:e==="unknown"?"UTC":e,w=e=>{if(typeof e=="string"&&e)return e;let t=f(e);return t?t.toISOString().slice(0,10):null},j=()=>{let e=new Date().getTimezoneOffset(),t=e<=0?"+":"-",n=Math.floor(Math.abs(e)/60).toString().padStart(2,"0"),r=(Math.abs(e)%60).toString().padStart(2,"0"),i=`${t}${n}:${r}`;return{userTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone,userTimezoneOffset:i}},I=(e,t,n)=>{let r=t?.toLowerCase();if(r&&!y(r))return e;if(r==="date-only"){let o=w(e);return o?h(o,m("short-date")):e}if(r==="time-only"){if(typeof e=="string"&&e)return N(e,m("long-time"));let o=f(e);return o?c(o,{...m("long-time"),timeZone:"UTC"}):e}let i=f(e);return i?c(i,{...m("short-date-short-time"),timeZone:S(n)}):e},g=(e,t,n)=>{if(e&&typeof e!="function"){let r="getField"in n&&n.getField?.(e),i=r&&"getFieldDomain"in n&&n.getFieldDomain?n.getFieldDomain(r.name):null;if(i?.type==="coded-value"){let o=i.codedValues.find(s=>s.code===t);return o?o.name:null}}return null},O=e=>!e||e==="system"?Intl.DateTimeFormat().resolvedOptions().timeZone:e==="unknown"?"UTC":e,v=e=>{if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e=="number"&&Number.isFinite(e)){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}if(typeof e=="string"&&e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}return null},x=(e,t)=>{if(typeof e!="number")return e;let n={};t.minimumFractionDigits!==void 0&&(n.minimumFractionDigits=t.minimumFractionDigits),t.maximumFractionDigits!==void 0&&(n.maximumFractionDigits=t.maximumFractionDigits),t.useGrouping==="always"?n.useGrouping=!0:t.useGrouping==="never"&&(n.useGrouping=!1);try{return new Intl.NumberFormat(void 0,n).format(e)}catch{return e}},C=(e,t,n)=>{let r=v(e);if(!r)return e;let i={};t.dateStyle?i.dateStyle=t.dateStyle:(t.year&&(i.year=t.year),t.month&&(i.month=t.month)),t.timeStyle&&(i.timeStyle=t.timeStyle),t.timeStyle&&t.hour12==="always"?i.hour12=!0:t.timeStyle&&t.hour12==="never"&&(i.hour12=!1),i.timeZone=O(n);try{return new Intl.DateTimeFormat(void 0,i).format(r)}catch{return e}},p=(e,t)=>e.getFieldAlias?.(t)??e.fieldsIndex?.get(t)?.alias??e.fieldsIndex?.get(t)?.name??t,F=(e,t,n,r,i)=>{if(n==null)return n;let o=e.getFieldConfiguration?.(t)?.fieldFormat;return o?.type==="number"?x(n,o):o?.type==="date-time"?!r||y(r)?C(n,o,i):n:I(n,r,i)},G=(e,t,n,r)=>{let i=e.fieldsIndex?.get(t),o=g(t,n,e)??n;return F(e,t,o,i?.type,r)},$=(e,t)=>p(e,t),k=(e,t,n)=>{let r=e.objectIdField,i=t.features.map(s=>s.attributes[r]),o=t.features.map(s=>{let d=s.attributes,u={};return e.fields.forEach(a=>{if(!Object.hasOwn(d,a.name))return;let l=d[a.name];if(a.name===r){u[a.name]=l;return}let D=g(a.name,l,e)??l,b=p(e,a.name);u[b]=F(e,a.name,D,a.type,n)}),u});return{objectIds:i,attributes:o}};return{a:j,b:G,c:$,d:k}},"intl")
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
2
|
-
import"./
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import"./UZLQALHY.js";var e=`## ArcgisKnowledge Agent - Lucene Generation for Graph Search
|
|
3
3
|
|
|
4
4
|
You are an assistant that generates a lucene query for graph query searching.
|
|
5
5
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
2
|
-
import"./
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import"./UZLQALHY.js";var e="---\nname: navigation\ndescription: Navigates the map to addresses, bookmarks, layers, matching features, extents, scales, zoom levels, and viewpoints using live map context and semantic layer and field search.\nallowed-tools: findRelevantLayers findRelevantFields goToAddress goToBookmark goToFeatures goToFullExtent goToHomeExtent goToLayer goToScale goToViewpoint goToZoom\n---\n\n# Navigation\n\n- Complete exactly one map-changing navigation action for the assigned task. Semantic search calls do not count as navigation actions.\n- Use the runtime context as the authoritative source for the current zoom level and exact available bookmark names.\n- Prefer an available bookmark over a feature or address when it clearly matches the requested place. Prefer a matching map feature over geocoding when the request identifies a layer or feature. Otherwise use `goToAddress` for an address or place name.\n- Use `goToZoom`, `goToScale`, or `goToViewpoint` directly for explicit numeric requests. For a relative zoom request, calculate one level above or below the current zoom from the runtime context and keep it within the tool's supported range.\n- Use `goToHomeExtent` to reset the map and `goToFullExtent` for the full-world extent. These actions do not require semantic search.\n- Before `goToLayer`, call `findRelevantLayers` with a concise query describing the requested layer. Use only a returned `layerId`. If there is no clear match, do not invent an ID or navigate.\n- Before `goToFeatures`, call `findRelevantLayers`, then call `findRelevantFields` with the relevant returned layer IDs and a query describing the requested condition. Use only the exact layer IDs returned by `findRelevantLayers`. Use only the exact field names and categorical values returned by `findRelevantFields`.\n- Build `goToFeatures` filters with valid ArcGIS SQL-92. Use field names rather than aliases, use coded-value domain codes when supplied, quote string values, and use `1=1` when all features in the selected layer are requested.\n- Do not call `findRelevantFields` for layer-only navigation or direct address, bookmark, extent, scale, viewpoint, or zoom navigation.\n- If required map context or semantic search results are missing or ambiguous, explain what is missing instead of guessing.\n- Report the navigation tool result faithfully. Never claim the map moved when the tool failed.\n";export{e as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
2
|
-
import{a as Y}from"./
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a as Y}from"./R74ZHFA6.js";var X=globalThis,Z=X.ShadowRoot&&(X.ShadyCSS===void 0||X.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,vt=Symbol(),kt=new WeakMap,I=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==vt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(Z&&t===void 0){let s=e!==void 0&&e.length===1;s&&(t=kt.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&kt.set(e,t))}return t}toString(){return this.cssText}},jt=o=>new I(typeof o=="string"?o:o+"",void 0,vt),be=(o,...t)=>{let e=o.length===1?o[0]:t.reduce((s,r,n)=>s+(i=>{if(i._$cssResult$===!0)return i.cssText;if(typeof i=="number")return i;throw Error("Value passed to 'css' function must be a 'css' function result: "+i+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+o[n+1],o[0]);return new I(e,o,vt)},Ht=(o,t)=>{if(Z)o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let s=document.createElement("style"),r=X.litNonce;r!==void 0&&s.setAttribute("nonce",r),s.textContent=e.cssText,o.appendChild(s)}},Et=Z?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(let s of t.cssRules)e+=s.cssText;return jt(e)})(o):o;var{is:_e,defineProperty:Ae,getOwnPropertyDescriptor:Ce,getOwnPropertyNames:we,getOwnPropertySymbols:Oe,getPrototypeOf:Te}=Object,et=globalThis,Vt=et.trustedTypes,Se=Vt?Vt.emptyScript:"",Pe=et.reactiveElementPolyfillSupport,k=(o,t)=>o,tt={toAttribute(o,t){switch(t){case Boolean:o=o?Se:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,t){let e=o;switch(t){case Boolean:e=o!==null;break;case Number:e=o===null?null:Number(o);break;case Object:case Array:try{e=JSON.parse(o)}catch{e=null}}return e}},j=(o,t)=>!_e(o,t),zt={attribute:!0,type:String,converter:tt,reflect:!1,useDefault:!1,hasChanged:j};Symbol.metadata??=Symbol("metadata"),et.litPropertyMetadata??=new WeakMap;var _=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=zt){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let s=Symbol(),r=this.getPropertyDescriptor(t,s,e);r!==void 0&&Ae(this.prototype,t,r)}}static getPropertyDescriptor(t,e,s){let{get:r,set:n}=Ce(this.prototype,t)??{get(){return this[e]},set(i){this[e]=i}};return{get:r,set(i){let a=r?.call(this);n?.call(this,i),this.requestUpdate(t,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??zt}static _$Ei(){if(this.hasOwnProperty(k("elementProperties")))return;let t=Te(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(k("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(k("properties"))){let e=this.properties,s=[...we(e),...Oe(e)];for(let r of s)this.createProperty(r,e[r])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[s,r]of e)this.elementProperties.set(s,r)}this._$Eh=new Map;for(let[e,s]of this.elementProperties){let r=this._$Eu(e,s);r!==void 0&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let s=new Set(t.flat(1/0).reverse());for(let r of s)e.unshift(Et(r))}else t!==void 0&&e.push(Et(t));return e}static _$Eu(t,e){let s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ht(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){let s=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,s);if(r!==void 0&&s.reflect===!0){let n=(s.converter?.toAttribute!==void 0?s.converter:tt).toAttribute(e,s.type);this._$Em=t,n==null?this.removeAttribute(r):this.setAttribute(r,n),this._$Em=null}}_$AK(t,e){let s=this.constructor,r=s._$Eh.get(t);if(r!==void 0&&this._$Em!==r){let n=s.getPropertyOptions(r),i=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:tt;this._$Em=r;let a=i.fromAttribute(e,n.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(t,e,s,r=!1,n){if(t!==void 0){let i=this.constructor;if(r===!1&&(n=this[t]),s??=i.getPropertyOptions(t),!((s.hasChanged??j)(n,e)||s.useDefault&&s.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,s))))return;this.C(t,e,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:r,wrapped:n},i){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,i??e??this[t]),n!==!0||i!==void 0)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),r===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[r,n]of this._$Ep)this[r]=n;this._$Ep=void 0}let s=this.constructor.elementProperties;if(s.size>0)for(let[r,n]of s){let{wrapped:i}=n,a=this[r];i!==!0||this._$AL.has(r)||a===void 0||this.C(r,void 0,n,a)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(e)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}};_.elementStyles=[],_.shadowRootOptions={mode:"open"},_[k("elementProperties")]=new Map,_[k("finalized")]=new Map,Pe?.({ReactiveElement:_}),(et.reactiveElementVersions??=[]).push("2.1.2");var bt=globalThis,Bt=o=>o,st=bt.trustedTypes,Wt=st?st.createPolicy("lit-html",{createHTML:o=>o}):void 0,_t="$lit$",A=`lit$${Math.random().toFixed(9).slice(2)}$`,At="?"+A,Ne=`<${At}>`,T=document,V=()=>T.createComment(""),z=o=>o===null||typeof o!="object"&&typeof o!="function",Ct=Array.isArray,Qt=o=>Ct(o)||typeof o?.[Symbol.iterator]=="function",$t=`[
|
|
3
3
|
\f\r]`,H=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ft=/-->/g,qt=/>/g,w=RegExp(`>|${$t}(?:([^\\s"'>=/]+)(${$t}*=${$t}*(?:[^
|
|
4
4
|
\f\r"'\`<>=]|("|')|))|$)`,"g"),Gt=/'/g,Kt=/"/g,Yt=/^(?:script|style|textarea|title)$/i,wt=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),ds=wt(1),ps=wt(2),us=wt(3),f=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),Jt=new WeakMap,O=T.createTreeWalker(T,129);function Xt(o,t){if(!Ct(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Wt!==void 0?Wt.createHTML(t):t}var Zt=(o,t)=>{let e=o.length-1,s=[],r,n=t===2?"<svg>":t===3?"<math>":"",i=H;for(let a=0;a<e;a++){let l=o[a],h,u,c=-1,m=0;for(;m<l.length&&(i.lastIndex=m,u=i.exec(l),u!==null);)m=i.lastIndex,i===H?u[1]==="!--"?i=Ft:u[1]!==void 0?i=qt:u[2]!==void 0?(Yt.test(u[2])&&(r=RegExp("</"+u[2],"g")),i=w):u[3]!==void 0&&(i=w):i===w?u[0]===">"?(i=r??H,c=-1):u[1]===void 0?c=-2:(c=i.lastIndex-u[2].length,h=u[1],i=u[3]===void 0?w:u[3]==='"'?Kt:Gt):i===Kt||i===Gt?i=w:i===Ft||i===qt?i=H:(i=w,r=void 0);let v=i===w&&o[a+1].startsWith("/>")?" ":"";n+=i===H?l+Ne:c>=0?(s.push(h),l.slice(0,c)+_t+l.slice(c)+A+v):l+A+(c===-2?a:v)}return[Xt(o,n+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]},B=class o{constructor({strings:t,_$litType$:e},s){let r;this.parts=[];let n=0,i=0,a=t.length-1,l=this.parts,[h,u]=Zt(t,e);if(this.el=o.createElement(h,s),O.currentNode=this.el.content,e===2||e===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(r=O.nextNode())!==null&&l.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(let c of r.getAttributeNames())if(c.endsWith(_t)){let m=u[i++],v=r.getAttribute(c).split(A),C=/([.?@])?(.*)/.exec(m);l.push({type:1,index:n,name:C[2],strings:v,ctor:C[1]==="."?rt:C[1]==="?"?nt:C[1]==="@"?it:P}),r.removeAttribute(c)}else c.startsWith(A)&&(l.push({type:6,index:n}),r.removeAttribute(c));if(Yt.test(r.tagName)){let c=r.textContent.split(A),m=c.length-1;if(m>0){r.textContent=st?st.emptyScript:"";for(let v=0;v<m;v++)r.append(c[v],V()),O.nextNode(),l.push({type:2,index:++n});r.append(c[m],V())}}}else if(r.nodeType===8)if(r.data===At)l.push({type:2,index:n});else{let c=-1;for(;(c=r.data.indexOf(A,c+1))!==-1;)l.push({type:7,index:n}),c+=A.length-1}n++}}static createElement(t,e){let s=T.createElement("template");return s.innerHTML=t,s}};function S(o,t,e=o,s){if(t===f)return t;let r=s!==void 0?e._$Co?.[s]:e._$Cl,n=z(t)?void 0:t._$litDirective$;return r?.constructor!==n&&(r?._$AO?.(!1),n===void 0?r=void 0:(r=new n(o),r._$AT(o,e,s)),s!==void 0?(e._$Co??=[])[s]=r:e._$Cl=r),r!==void 0&&(t=S(o,r._$AS(o,t.values),r,s)),t}var ot=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:s}=this._$AD,r=(t?.creationScope??T).importNode(e,!0);O.currentNode=r;let n=O.nextNode(),i=0,a=0,l=s[0];for(;l!==void 0;){if(i===l.index){let h;l.type===2?h=new L(n,n.nextSibling,this,t):l.type===1?h=new l.ctor(n,l.name,l.strings,this,t):l.type===6&&(h=new at(n,this,t)),this._$AV.push(h),l=s[++a]}i!==l?.index&&(n=O.nextNode(),i++)}return O.currentNode=T,r}p(t){let e=0;for(let s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}},L=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,r){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=S(this,t,e),z(t)?t===d||t==null||t===""?(this._$AH!==d&&this._$AR(),this._$AH=d):t!==this._$AH&&t!==f&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Qt(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==d&&z(this._$AH)?this._$AA.nextSibling.data=t:this.T(T.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:s}=t,r=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=B.createElement(Xt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===r)this._$AH.p(e);else{let n=new ot(r,this),i=n.u(this.options);n.p(e),this.T(i),this._$AH=n}}_$AC(t){let e=Jt.get(t.strings);return e===void 0&&Jt.set(t.strings,e=new B(t)),e}k(t){Ct(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,s,r=0;for(let n of t)r===e.length?e.push(s=new o(this.O(V()),this.O(V()),this,this.options)):s=e[r],s._$AI(n),r++;r<e.length&&(this._$AR(s&&s._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let s=Bt(t).nextSibling;Bt(t).remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},P=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,r,n){this.type=1,this._$AH=d,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=d}_$AI(t,e=this,s,r){let n=this.strings,i=!1;if(n===void 0)t=S(this,t,e,0),i=!z(t)||t!==this._$AH&&t!==f,i&&(this._$AH=t);else{let a=t,l,h;for(t=n[0],l=0;l<n.length-1;l++)h=S(this,a[s+l],e,l),h===f&&(h=this._$AH[l]),i||=!z(h)||h!==this._$AH[l],h===d?t=d:t!==d&&(t+=(h??"")+n[l+1]),this._$AH[l]=h}i&&!r&&this.j(t)}j(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},rt=class extends P{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===d?void 0:t}},nt=class extends P{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==d)}},it=class extends P{constructor(t,e,s,r,n){super(t,e,s,r,n),this.type=5}_$AI(t,e=this){if((t=S(this,t,e,0)??d)===f)return;let s=this._$AH,r=t===d&&s!==d||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==d&&(s===d||r);r&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},at=class{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){S(this,t)}},te={M:_t,P:A,A:At,C:1,L:Zt,R:ot,D:Qt,V:S,I:L,H:P,N:nt,U:it,B:rt,F:at},De=bt.litHtmlPolyfillSupport;De?.(B,L),(bt.litHtmlVersions??=[]).push("3.3.2");var Ot=(o,t,e)=>{let s=e?.renderBefore??t,r=s._$litPart$;if(r===void 0){let n=e?.renderBefore??null;s._$litPart$=r=new L(t.insertBefore(V(),n),n,void 0,e??{})}return r._$AI(o),r};var Tt=globalThis,E=class extends _{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Ot(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return f}};E._$litElement$=!0,E.finalized=!0,Tt.litElementHydrateSupport?.({LitElement:E});var xe=Tt.litElementPolyfillSupport;xe?.({LitElement:E});(Tt.litElementVersions??=[]).push("4.2.2");var ee=new Set,se;var oe=o=>typeof o=="string"?o:"el"in o?o.el.localName:"localName"in o?o.localName:o.declaredClass,Os=(o,t,e,s)=>{let r=oe(t);if(s?.once){let i=`${o}${r}${e}`;if(ee.has(i))return;ee.add(i)}let n;if(s?.detail){n={};for(let[i,a]of Object.entries(s.detail))if((typeof a=="object"||typeof a=="function")&&a!==null){let l=new WeakRef(a);Object.defineProperty(n,i,{enumerable:!0,get(){return l.deref()}})}else n[i]=a;se?.log.interceptors?.forEach(i=>i(o,r,e,n)),console[o](`[${r}]: ${e}`,n)}else se?.log.interceptors?.forEach(i=>i(o,r,e)),console[o](`[${r}]: ${e}`)},re=o=>{let t=`[${oe(o)}] `;return e=>{let s=e instanceof Error&&e.message?e:new Error(String(e));s.message=`${t}${s.message}`,setTimeout(()=>{throw e})}};var p=(o,t,...e)=>{try{return o?.call(t,...e)}catch(s){console.error(s,o)}},W=async(o,t,...e)=>{try{return await o?.call(t,...e)}catch(s){console.error(s,o)}};var q=Symbol.for("controller"),Le=o=>typeof o=="object"&&o!==null&&(q in o||"hostConnected"in o||"hostDisconnected"in o||"hostUpdate"in o||"hostUpdated"in o),Ps=o=>typeof o?.then=="function";var F,D=o=>{F!==o&&(F=o,queueMicrotask(()=>F===o?F=void 0:0))},G=o=>F,N=[],ct=o=>{if(o===void 0){N=[];return}let t=N.indexOf(o);N=t===-1?[...N,o]:N.slice(0,t+1),queueMicrotask(()=>N=[])},ne=()=>N,U,Ns=o=>{U!==o&&(U=o,queueMicrotask(()=>U===o?U=void 0:0))},Ue=()=>{let o=U;return U=void 0,o},ie=async(o,t)=>{let e=ht(o);if(e===void 0)return o;if(await e.ready,typeof t=="function"){let s=e.watchExports(r=>t(r,s))}return e.exports},ae=async o=>{let t=ht(o);return await t.ready,t},ht=o=>{let e=G().manager.X(o);if(e!==void 0)return e;if(Le(o))return o;let s=Ue();if(s!==void 0)return s},lt=!1,Ds=o=>{lt=!0;try{return o()}finally{lt=!1}};var b=class{constructor(){this.promise=new Promise((t,e)=>{this.resolve=t,this.reject=e})}};var le=(o,t)=>{let e=t>Re?Me:t/Ie,s=0,r=setInterval(()=>{s+=e,s>=t&&(clearInterval(r),o())},e);return r},Re=4e3,Me=2e3,Ie=4;var ke=(o,t,e)=>{let s=Object.keys(o),r=s.length;R===void 0&&queueMicrotask(M),R??=new Map;let n=R.get(o);return n===void 0&&(n={callbacks:[],keyCount:r},R.set(o,n)),n.keyCount!==r&&(n.callbacks.forEach(i=>i(s)),n.callbacks=[],n.keyCount=r),n.callbacks.push(i=>{let a=h=>p(t,null,h),l=i[r];l===void 0?a(void 0):o[l]===e?a(l):a(void 0)}),e},R,M=()=>{R?.forEach(({callbacks:o},t)=>{let e=Object.keys(t);o.forEach(s=>s(e))}),R=void 0},je=(o,t,e)=>{let s=o.manager;return s.V!==d&&s.V!==e&&s.S(void 0,void 0),s.T.length===0&&queueMicrotask(()=>s.S(void 0,void 0)),s.V=e,s.T.push((r,n)=>p(t,void 0,e===n?r:void 0)),e},He=(o=[G(),...ne()],t,e)=>{let s=Array.isArray(o)?o:[o],r=s.length+1,n=i=>{r-=1,i!==void 0&&(r=Math.min(r,0)),r===0&&t(i)};s.forEach(i=>ke(i,a=>n(a===void 0?void 0:{key:a,host:i,isReactive:!1}),e));for(let i of s)if("manager"in i&&i.manager.component===i){je(i,a=>n(a===void 0?void 0:{key:a,host:i,isReactive:!0}),e);break}return e},Ve=(o="",t={},e=G())=>{let s={emit:r=>{o===""&&M();let n=new CustomEvent(o,{detail:r,cancelable:!0,bubbles:!0,composed:!0,...t});return e.el.dispatchEvent(n),n}};return o===""&&He(void 0,r=>o=r.key,s),s},ze=Ve.bind(null,""),de;de=q;var St=class{constructor(t){this.#t=[],this.#e=[],this.#s=[],this.#r=[],this.#n=[],this.#l=[],this.#c=[],this.#d=[],this.#i=[],this.#p=!1,this.P=new b,this.connectedCalled=!1,this.loadedCalled=!1,this[de]=!0,this.#h=[];let e=this,s=t??G(new.target.name);e.#o=s,e.ready=e.P.promise,e.#a=he(e),e.component=s,e.#o.addController(e),e.#o.manager===void 0||(ct(e),queueMicrotask(()=>e.catchUpLifecycle()))}#t;#e;#s;#r;#n;#l;#c;#d;#i;#p;#o;catchUpLifecycle(){let{manager:t}=this.#o;t.connectedCalled&&!this.connectedCalled&&this.triggerConnected(),t.#p&&this.triggerLoad().then(()=>t.loadedCalled&&this.triggerLoaded()).catch(re(this.#o))}#a;get exports(){return this.#a}set exports(t){let e=this.#a;e!==t&&(this.#a=t,this.#h.forEach(p),this.connectedCalled&&this.O!==!1&&this.#o.requestUpdate(this.O,e)),this.P.resolve(t)}setProvisionalExports(t,e=!0){this.#a=e?he(t):t,this.#h.forEach(p)}#h;watchExports(t){let e=()=>t(this.#a);return this.#h.push(e),()=>{this.#h.splice(this.#h.indexOf(e),1)}}get use(){return D(this.#o),ie}get useRef(){return D(this.#o),ae}get useRefSync(){return D(this.#o),ht}controllerRemoved(){this.#o.el.isConnected&&this.triggerDisconnected(),this.triggerDestroy()}onConnected(t){this.#t.push(t)}onDisconnected(t){this.#e.push(t)}onLoad(t){this.#s.push(t)}onLoaded(t){this.#r.push(t)}onUpdate(t){this.#n.push(t)}onUpdated(t){this.#l.push(t)}onDestroy(t){this.#c.push(t)}onLifecycle(t){this.#d.push(t),this.connectedCalled&&this.#o.el.isConnected&&this.#u(t)}triggerConnected(){let t=this;t.hostConnected&&p(t.hostConnected,t),t.#t.forEach(p),t.triggerLifecycle(),t.connectedCalled=!0}triggerDisconnected(){let t=this;t.hostDisconnected&&p(t.hostDisconnected,t),t.#e.forEach(p),t.#i.forEach(p),t.#i=[]}async triggerLoad(){if(this.#p)return;this.#p=!0;let t=this;t.hostLoad&&await W(t.hostLoad,t),this.#s.length>0&&await Promise.allSettled(this.#s.map(W)),this.P.resolve(this.#a)}triggerLoaded(){this.loadedCalled||(this.hostLoaded&&p(this.hostLoaded,this),this.#r.forEach(p),this.loadedCalled=!0)}triggerUpdate(t){this.hostUpdate&&p(this.hostUpdate,this,t),this.#n.forEach(ce,t)}triggerUpdated(t){this.hostUpdated&&p(this.hostUpdated,this,t),this.#l.forEach(ce,t)}triggerDestroy(){this.hostDestroy&&p(this.hostDestroy,this),this.#c.forEach(p)}triggerLifecycle(){this.hostLifecycle&&this.#u(()=>this.hostLifecycle()),this.#d.forEach(this.#u,this)}#u(t){D(this.#o);let e=p(t);(Array.isArray(e)?e:[e]).forEach(r=>{typeof r=="function"?this.#i.push(r):typeof r=="object"&&typeof r.remove=="function"&&this.#i.push(r.remove)})}};function ce(o){p(o,void 0,this)}var he=o=>{if(typeof o!="object"&&typeof o!="function"||o===null)return o;let t={get(s,r,n){if(!((r==="exports"||r==="_exports")&&r in s&&s[r]===e)&&(r in s||r in Promise.prototype||typeof r=="symbol"))return typeof s=="function"?s[r]:Reflect.get(s,r,n)}},e=new Proxy(o,t);return e};var pe=St;var{I:zs}=te;var dt=o=>o.strings===void 0;var Be={},ue=(o,t=Be)=>o._$AH=t;var y={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},$=o=>(...t)=>({_$litDirective$:o,values:t}),g=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var K=(o,t)=>{let e=o._$AN;if(e===void 0)return!1;for(let s of e)s._$AO?.(t,!1),K(s,t);return!0},pt=o=>{let t,e;do{if((t=o._$AM)===void 0)break;e=t._$AN,e.delete(o),o=t}while(e?.size===0)},fe=o=>{for(let t;t=o._$AM;o=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(o))break;e.add(o),qe(t)}};function We(o){this._$AN!==void 0?(pt(this),this._$AM=o,fe(this)):this._$AM=o}function Fe(o,t=!1,e=0){let s=this._$AH,r=this._$AN;if(r!==void 0&&r.size!==0)if(t)if(Array.isArray(s))for(let n=e;n<s.length;n++)K(s[n],!1),pt(s[n]);else s!=null&&(K(s,!1),pt(s));else K(this,o)}var qe=o=>{o.type==y.CHILD&&(o._$AP??=Fe,o._$AQ??=We)},ut=class extends g{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),fe(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(K(this,t),pt(this))}setValue(t){if(dt(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var Xs=()=>new Nt,Nt=class{},Pt=new WeakMap,Dt=$(class extends ut{render(o){return d}update(o,[t]){let e=t!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=o.options?.host,this.rt(this.ct=o.element)),d}rt(o){if(this.isConnected||(o=void 0),typeof this.G=="function"){let t=this.ht??globalThis,e=Pt.get(t);e===void 0&&(e=new WeakMap,Pt.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,o),o!==void 0&&this.G.call(this.ht,o)}else this.G.value=o}get lt(){return typeof this.G=="function"?Pt.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var Lt=o=>{let t=o;for(;t=t.parentNode??t.host;)if(t?.constructor?.lumina){let e=t;return e.manager?.loadedCalled||(e.J??e._offspring).push(o),(e.I??e._postLoad).promise}return!1},Ut={};function Rt(){}function Mt(o){for(let t of["Associated","Disabled","Reset","StateRestore"]){let e=`orm${t}Callback`;o.prototype["f"+e]=async function(...s){await this.componentOnReady(),(this.el??this).dispatchEvent(new CustomEvent(`luminaF${e}`,{detail:s}))}}}var Ke=(o,t)=>function(s,r){if(!globalThis.customElements)return;let i=(r??s??{}).resourcesUrl;i&&o.setAssetPath(i);for(let[a,[l,h="",u=0]]of Object.entries(t)){if(customElements.get(a))continue;let[c,m,v]=h.split(";"),C=c?c?.split(",").map(Je):void 0,gt=C?.map(([x])=>x),Q=class extends xt{static{this.formAssociated=u===1}static{this.observedAttributes=C?.map(([,x])=>x).filter(x=>x!=="")}static{this.C=gt}static{this.E=m?m?.split(","):void 0}static{this.D=v?.split(",")}static{this.L=a}static{this.K=o}constructor(){!Q.B&&(Q.B=l(),Q.F()),super()}};customElements.define(a,Q)}},ft=Object.defineProperty,Je=o=>{let t=o.split(":");return t.length===1?[t[0],Y(t[0])]:t},Qe=globalThis.HTMLElement??Rt,xt=class extends Qe{constructor(){super(),this.#e={},this.#s=[],this.I=new b,this.H=new b,this.J=[];let t=this,e=t.constructor;t._offspring=t.J,t._postLoad=t.I,e.C?.forEach(s=>{Object.hasOwn(t,s)&&(t.#e[s]=t[s],delete t[s])}),e.A?t.#r({a:e.A}):e.B.then(async s=>{await e.K.p,t.#r(await(s.default?.then(r=>typeof r=="function"?{a:r}:r)??s))}).catch(s=>{t.H.reject(s),setTimeout(()=>{throw s})})}static{this.lumina=!0}static F(){for(let t of this.C??[])ft(this.prototype,t,{configurable:!0,enumerable:!0,get(){return this.#e[t]},set(e){this.#e[t]=e}});for(let t of this.E??[])ft(this.prototype,t,{async value(...e){return this.#t||await this.H.promise,await this.#t[t](...e)},configurable:!0});for(let t of this.D??[])ft(this.prototype,t,{value(...e){return this.#t[t](...e)},configurable:!0})}static{Mt(this)}#t;#e;#s;get manager(){return this.#t?.manager}attributeChangedCallback(t,e,s){this.#t?.attributeChangedCallback(t,e,s),this.#t||this.#s.push(t)}connectedCallback(){this.#t?this.#t.connectedCallback?.():queueMicrotask(()=>this.G=Lt(this))}disconnectedCallback(){this.#t?.disconnectedCallback?.()}async componentOnReady(){return await this.H.promise,this}#r(t){let e=this.constructor,s=e.L,r=this.#e,n=Object.values(t).find(c=>c.L===s),i=`${s}--lazy`,a=n;for(;a&&!Object.hasOwn(a,"lumina");)a=Object.getPrototypeOf(a);Xe(a),!e.A&&(e.A=n,customElements.define(i,n)),n.N=this;let h=document.createElement(i);n.N=void 0,this.#t=h,this.#e=h,this.#s.forEach(c=>h.attributeChangedCallback(c,null,this.getAttribute(c))),Object.entries(r).forEach(Ye,h);let u=this.isConnected;(u||this.G)&&(h.connectedCallback?.(),u||h.disconnectedCallback())}addController(){}requestUpdate(){this.#t?.requestUpdate()}};function Ye([o,t]){this[o]=t}var Xe=o=>{let t=o.prototype,e=Element.prototype;Object.hasOwn(t,"isConnected")||(t.setAttribute=function(r,n){e.setAttribute.call(this.el,r,n)},t.removeAttribute=function(r){e.removeAttribute.call(this.el,r)},t.hasAttribute=function(r){return e.hasAttribute.call(this.el,r)},ft(t,"isConnected",{get(){return Reflect.get(e,"isConnected",this.el)}}))};var mt=class extends pe{constructor(t){super(t),this.destroyed=!1,this.R=!1,this.V=d,this.T=[],this.#s=new WeakMap,this.#e=t,this.exports=void 0,this.hasDestroy=yt in t&&typeof t.destroy=="function",E.prototype.addController.call(t,{hostConnected:()=>{if(this.destroyed){let e=t.el.localName;throw t.el.remove(),new Error(`The ${e} component has already been destroyed. It cannot be used again. If you meant to disconnect and reconnect a component without automatic destroy, set the ${yt} prop.`)}this.#t!==void 0&&clearTimeout(this.#t),M();for(let e of t.M)"triggerConnected"in e?e.triggerConnected():p(e.hostConnected,e)},hostDisconnected:()=>{for(let e of t.M)"triggerDisconnected"in e?e.triggerDisconnected():p(e.hostDisconnected,e);this.hasDestroy&&!this.destroyed&&this.U()},hostUpdate:()=>{for(let e of t.M)"triggerUpdate"in e?e.triggerUpdate(this.Q):p(e.hostUpdate,e,this.Q)},hostUpdated:()=>{for(let e of t.M)"triggerUpdated"in e?e.triggerUpdated(this.Q):p(e.hostUpdated,e,this.Q);this.Q=void 0}}),queueMicrotask(()=>this.R=!0),ct(void 0),D(t)}#t;#e;async destroy(){if(!this.destroyed){this.#e.el.isConnected&&(this.hasDestroy=!1,this.#e.el.remove()),this.#t=void 0,this.destroyed=!0;for(let t of this.#e.M)"triggerDestroy"in t?t.triggerDestroy():p(t.hostDestroy,t);this.#e.M.splice(0)}}U(){if(this.#t!==void 0&&clearTimeout(this.#t),!this.#e.el.isConnected&&!this.#e.autoDestroyDisabled){let t=()=>{this.#e.destroy()};this.#t=le(t,Ze)}}S(t,e){let s=this.T;this.V=d,this.T=[],s.forEach(r=>r(t,e))}#s;W(t,e){(typeof e=="object"&&e!==null||typeof e=="function")&&this.#s.set(e,t)}X(t){if(typeof t=="object"&&t!==null||typeof t=="function")return this.#s.get(t)}},Ze=1e3,yt="autoDestroyDisabled";var ye=$(class extends g{constructor(o){if(super(o),o.type!==y.ATTRIBUTE||o.name!=="class"||o.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(o){return" "+Object.keys(o).filter(t=>o[t]).join(" ")+" "}update(o,[t]){if(this.st===void 0){this.st=new Set,o.strings!==void 0&&(this.nt=new Set(o.strings.join(" ").split(/\s/).filter(s=>s!=="")));for(let s in t)t[s]&&!this.nt?.has(s)&&this.st.add(s);return this.render(t)}let e=o.element.classList;for(let s of this.st)s in t||(e.remove(s),this.st.delete(s));for(let s in t){let r=!!t[s];r===this.st.has(s)||this.nt?.has(s)||(r?(e.add(s),this.st.add(s)):(e.remove(s),this.st.delete(s)))}return f}});var ge="important",ts=" !"+ge,es=$(class extends g{constructor(o){if(super(o),o.type!==y.ATTRIBUTE||o.name!=="style"||o.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(o){return Object.keys(o).reduce((t,e)=>{let s=o[e];return s==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`},"")}update(o,[t]){let{style:e}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let s of this.ft)t[s]==null&&(this.ft.delete(s),s.includes("-")?e.removeProperty(s):e[s]=null);for(let s in t){let r=t[s];if(r!=null){this.ft.add(s);let n=typeof r=="string"&&r.endsWith(ts);s.includes("-")||n?e.setProperty(s,n?r.slice(0,-11):r,n?ge:""):e[s]=r}}return f}});var ss=$(class extends g{constructor(o){if(super(o),o.type!==y.PROPERTY&&o.type!==y.ATTRIBUTE&&o.type!==y.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!dt(o))throw Error("`live` bindings can only contain a single expression")}render(o){return o}update(o,[t]){if(t===f||t===d)return t;let e=o.element,s=o.name;if(o.type===y.PROPERTY){if(t===e[s])return f}else if(o.type===y.BOOLEAN_ATTRIBUTE){if(!!t===e.hasAttribute(s))return f}else if(o.type===y.ATTRIBUTE&&e.getAttribute(s)===t+"")return f;return ue(o),t}});var ve=class o extends E{constructor(){super(),this.M=[],this.manager=new mt(this);let t=this,e=t.constructor,s=e.N,r=e.K.o,n=o.prototype.shouldUpdate;t.#r=s?.H??new b,t.I=s?.I??new b,t.J=s?.J??[],t._offspring=t.J,t._postLoad=t.I,t.el=s??t,t.#s=t.enableUpdating,t.enableUpdating=Rt,t.shouldUpdate!==n&&(t.#e=t.shouldUpdate,t.shouldUpdate=n),r&&(t.#t=new Map,e.elementProperties.forEach((i,a)=>t.#t.set(a,r()))),!1}static finalizeStyles(t){let e=super.finalizeStyles(t),s=this.shadowRootOptions===Ut;return this.K?.commonStyles===void 0||s?e:[this.K.commonStyles,...e]}static createProperty(t,e){let s=typeof e=="number"?e:Array.isArray(e)?e[0]:0,r=Array.isArray(e)?e[1]:void 0,n=r?.hasChanged??j,i={attribute:s&1&&typeof t=="string"?Y(t):!1,reflect:!!(s&2),type:s&4?Boolean:s&8?Number:void 0,state:!!(s&16),readOnly:!!(s&32),noAccessor:!!(s&64),useDefault:!!(s&128),c:!1,...r,hasChanged(a,l){let h=n(a,l);return i.c=h,h}};super.createProperty(t,i)}static getPropertyDescriptor(t,e,s){let r=this.K,n=super.getPropertyDescriptor(t,e,s);return s.d=n,{...n,get(){return r.t?.(this.#t.get(t)),n.get?.call(this)},set(i){let a=this.manager;if(s.readOnly&&!lt&&(a.R||a.connectedCalled))throw Error(`Cannot assign to read-only property "${t}" of ${this.el.localName}. Trying to assign "${i}"`);n.set.call(this,i??void 0),s.c&&this.#t?.get(t)?.notify(),a.T.length>0&&(M(),a?.S(t,i))}}}static{this.lumina=!0}static{Mt(this)}#t;#e;#s;#r;#n;#l;get elementInternals(){return this.#l??=this.el.attachInternals(),this.#l}connectedCallback(){this.hasAttribute("defer-hydration")||this.#c(!0)}#c(t){let e=this.constructor.K.c?.(()=>this.requestUpdate());this.#n=e;let s=!this.manager.connectedCalled;t&&super.connectedCallback(),s?queueMicrotask(()=>this.#i().catch(r=>{this.#r.reject(r),setTimeout(()=>{throw r})})):e&&this.requestUpdate()}#d(t){try{this.#n.clear(),this.constructor.K.r(this.#n,()=>super.update(t))}catch(e){throw this.#n.clear(),e}}disconnectedCallback(){super.disconnectedCallback(),this.#n?.destroy(),this.#n=void 0}createRenderRoot(){let t=this.el.shadowRoot,e=this.constructor,s=e.shadowRootOptions,n=t??(s===Ut?this.el:this.el.attachShadow(s));if(t)return this.manager.connectedCalled||this.#c(!1),E.prototype.createRenderRoot.call(this),t;if(this.isConnected){let i=n.getRootNode();i.adoptedStyleSheets=[...i.adoptedStyleSheets,...e.elementStyles.map(a=>"styleSheet"in a?a.styleSheet:a)]}return n}async#i(){let t=this.el.G??Lt(this.el);t&&await t;let e=[];for(let r of this.M)"triggerLoad"in r?e.push(r.triggerLoad()):e.push(W(r.hostLoad,r));await Promise.all(e),await this.load?.(),this.manager.hasDestroy&&this.manager.onUpdate(r=>r.has(yt)&&this.manager.U()),this.#s(!0),this.performUpdate(),this.I.resolve(),await 0;let s=this.J.filter(r=>!r.manager?.loadedCalled);s.length&&await Promise.allSettled(s.map(async r=>await r.componentOnReady())),this.J.length=0,this.el.setAttribute(this.constructor.K.hydratedAttribute,"");for(let r of this.M)"triggerLoaded"in r?r.triggerLoaded():p(r.hostLoaded,r);this.loaded?.(),this.#r.resolve()}shouldUpdate(t){return this.manager.Q=t,this.#e?.(t)??!0}update(t){this.#n?this.#d(t):super.update(t)}listen(t,e,s){let r=e?.bind(this)??e;this.manager.onLifecycle(()=>(this.el.addEventListener(t,r,s),()=>this.el.removeEventListener(t,r,s)))}listenOn(t,e,s,r){let n=s?.bind(this)??s;this.manager.onLifecycle(()=>(t.addEventListener(e,n,r),()=>t.removeEventListener(e,n,r)))}async componentOnReady(){return await this.#r.promise,this}addController(t){this.M.push(t),!(q in t)&&this.renderRoot&&this.el.isConnected&&t.hostConnected?.()}removeController(t){this.M.splice(this.M.indexOf(t),1),t.controllerRemoved?.()}};var $e=o=>{let t,e=r=>{t=new URL(r,globalThis.location?.href||void 0).href},s={...o,getAssetPath(r){let n=new URL(r,t);return n.origin!==globalThis.location?.origin?n.href:n.pathname},setAssetPath:e,customElement(r,n){n.K=s,n.L=r,customElements.get(r)||customElements.define(r,n)}};return e(o.defaultAssetPath),s};var $r=o=>typeof o=="object"&&o!=null?ye(o):o;var It=class extends g{#t;#e;constructor(t){super(t);let e=this;this.#e=function(r){return e.#t.call(this,r)}}render(t){return typeof t=="function"?(this.#t=t,Dt(this.#e)):Dt(t)}},br=$(It);var _r=d;var J=$e({defaultAssetPath:"https://jsdev.arcgis.com/5.2.0-next/ai-components/",hydratedAttribute:"hydrated"}),{customElement:Tr,getAssetPath:Sr,setAssetPath:Pr}=J;J.t=void 0;J.o=void 0;J.c=void 0;J.r=void 0;export{Ps as a,D as b,ct as c,ne as d,Ns as e,Ds as f,be as g,ds as h,f as i,d as j,Os as k,re as l,He as m,ze as n,St as o,Ke as p,y as q,$ as r,g as s,Xs as t,Dt as u,ve as v,$r as w,_r as x,J as y,Tr as z,Sr as A};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
2
|
-
import b from"./
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import b from"./RHYNE5OE.js";import{a as t}from"./FDOMMK2M.js";import{a as l}from"./ONQ6JSBJ.js";import{Dc as d}from"./IYLFJCJ2.js";import{a}from"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([o])=>{var g=.7,b=10;async function S(i){let{query:e,layerIds:s,includeSummaryStatistics:r=!1,fieldSearch:c,layersAndFieldsRegistry:m,embeddingCache:y,mapView:u,minScore:f=g,topResults:h=b}=i,n=await c.searchFields({text:e,layerIds:s,minScore:f,topResults:h,embeddingCache:y}),p=await o(n,m,u,r);return{matches:n,...p}}var v=a.object({query:a.string().describe("A concise semantic description of the fields relevant to the user's task."),layerIds:a.array(a.string()).min(1).describe("Layer IDs returned by findRelevantLayers, restricted to layers relevant to the current task."),includeSummaryStatistics:a.boolean().optional().default(!1).describe("Set to true only when the task directly asks for numeric summaries such as average, minimum, maximum, total, variance, or range.")});async function w(i,e){let{mapView:s}=l(e,["mapView"]),r=await S({...i,fieldSearch:t(e,"fieldSearch"),layersAndFieldsRegistry:t(e,"layersAndFieldsRegistry"),embeddingCache:t(e,"embeddingCache"),mapView:s});return JSON.stringify(r,null,2)}var A=d(w,{name:"findRelevantFields",description:"Finds relevant fields within candidate layers. Returns ranked matches, field metadata, categorical values, and optional numeric summary statistics. Call findRelevantLayers first when layer IDs are not already known.",schema:v});return A},b)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
2
|
-
import a from"./
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import a from"./EVMIYZWD.js";import"./JQYLMTDP.js";import"./FS7GXTTQ.js";import"./LOQ2PKV5.js";import"./IYLFJCJ2.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:l,subclass:w},{c:p,d:d}])=>{var y=Object.defineProperty,m=Object.getOwnPropertyDescriptor,f=e=>{throw TypeError(e)},h=(e,t,o,n)=>{for(var r=n>1?void 0:n?m(t,o):t,s=e.length-1,g;s>=0;s--)(g=e[s])&&(r=(n?g(t,o,r):g(r))||r);return n&&r&&y(t,o,r),r},k=(e,t,o)=>t.has(e)||f("Cannot "+o),b=(e,t,o)=>t.has(e)?f("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,o),c=(e,t,o)=>(k(e,t,"access private method"),o),a,i,u=class extends d{constructor(e){super(e),b(this,a)}getAgents(){return c(this,a,i).call(this),[this.routerAgent,...Object.values(this.agentsMap)]}buildEdges(e){c(this,a,i).call(this);let t=p(this.routerAgent,0),o=new Map;for(let[n,[r]]of Object.entries(this.agentsMap).entries())o.set(r,p(e[n+1],n+1));return[{from:t,decide:n=>{let r=n[this.routerOutputKey];if(typeof r!="string"||!r)throw new Error("RouterWorkflow decideRoute could not determine next agent from state.");let s=o.get(r);if(!s)throw new Error(`RouterWorkflow decideRoute returned unknown agent: ${r}. Expected one of: ${Object.keys(this.agentsMap).join(", ")||"(none)"}.`);return s}}]}getEntryNode(){return c(this,a,i).call(this),p(this.routerAgent,0)}isTerminalAgent(e,t){return t>0}validateAgents(e){c(this,a,i).call(this),super.validateAgents(e)}};a=new WeakSet;i=function(){if(!Object.keys(this.agentsMap).length)throw new Error("RouterWorkflow requires a non-empty agentsMap.")};h([l()],u.prototype,"agentsMap",2);h([l()],u.prototype,"routerAgent",2);h([l()],u.prototype,"routerOutputKey",2);u=h([w("RouterWorkflow")],u);return u},"core/accessorSupport/decorators",a)
|