@arcgis/ai-components 5.1.0-next.99 → 5.2.0-next.1
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/README.md +2 -2
- package/dist/agent-utils/BaseAgent.d.ts +90 -0
- package/dist/agent-utils/BaseAgent.js +87 -0
- package/dist/agent-utils/FunctionAgent.d.ts +64 -0
- package/dist/agent-utils/FunctionAgent.js +98 -0
- package/dist/agent-utils/LLMAgent.d.ts +65 -0
- package/dist/agent-utils/LLMAgent.js +139 -0
- package/dist/agent-utils/WorkflowAgent.d.ts +44 -0
- package/dist/agent-utils/WorkflowAgent.js +70 -0
- package/dist/agent-utils/middlewares/humanInTheLoop.d.ts +152 -0
- package/dist/agent-utils/middlewares/humanInTheLoop.js +94 -0
- package/dist/agent-utils/middlewares/middleware.d.ts +25 -0
- package/dist/agent-utils/middlewares/middleware.js +44 -0
- package/dist/agent-utils/middlewares/trace.d.ts +25 -0
- package/dist/agent-utils/middlewares/trace.js +50 -0
- package/dist/agent-utils/middlewares/types.d.ts +123 -0
- package/dist/agent-utils/middlewares/types.js +2 -0
- package/dist/agent-utils/tools/FunctionTool.d.ts +127 -0
- package/dist/agent-utils/tools/FunctionTool.js +80 -0
- package/dist/agent-utils/types.d.ts +152 -0
- package/dist/agent-utils/workflows/BaseWorkflow.d.ts +87 -0
- package/dist/agent-utils/workflows/ConditionalWorkflow.d.ts +72 -0
- package/dist/agent-utils/workflows/ConditionalWorkflow.js +61 -0
- package/dist/agent-utils/workflows/LoopWorkflow.d.ts +58 -0
- package/dist/agent-utils/workflows/LoopWorkflow.js +56 -0
- package/dist/agent-utils/workflows/ParallelWorkflow.d.ts +68 -0
- package/dist/agent-utils/workflows/ParallelWorkflow.js +129 -0
- package/dist/agent-utils/workflows/RouterWorkflow.d.ts +63 -0
- package/dist/agent-utils/workflows/RouterWorkflow.js +75 -0
- package/dist/agent-utils/workflows/SequentialWorkflow.d.ts +56 -0
- package/dist/agent-utils/workflows/SequentialWorkflow.js +69 -0
- package/dist/agent-utils/workflows/SwitchWorkflow.d.ts +74 -0
- package/dist/agent-utils/workflows/SwitchWorkflow.js +84 -0
- package/dist/assets/embeddings.worker-k9_Ou679.js +1 -0
- package/dist/cdn/{24MYCR6F.js → 23EQTPO3.js} +2 -2
- package/dist/cdn/{Z3DVGFEE.js → 2AXF774U.js} +2 -2
- package/dist/cdn/{UK6CP7BR.js → 3PKJWIC3.js} +2 -2
- package/dist/cdn/462JBSEV.js +422 -0
- package/dist/cdn/4HU7735A.js +42 -0
- package/dist/cdn/5QAHYX7Y.js +5 -0
- package/dist/cdn/{YVTKUITE.js → 5ZZGKP7N.js} +2 -2
- package/dist/cdn/{DMLSCJAM.js → 6YMR4QSD.js} +2 -2
- package/dist/cdn/{LXFCO34K.js → 7BCR6TUO.js} +2 -2
- package/dist/cdn/{EUNEQNYC.js → 7GH7VSB2.js} +1 -1
- package/dist/cdn/{YNJYG2RG.js → 7PLV4QH6.js} +2 -2
- package/dist/cdn/{JDL3HFFX.js → 7RCQFLPP.js} +2 -2
- package/dist/cdn/AMP6IALT.js +2 -0
- package/dist/cdn/{Y3AUHNRX.js → AO7BQHKC.js} +2 -2
- package/dist/cdn/{K6LVZHWM.js → AXDZBBNL.js} +2 -2
- package/dist/cdn/{WBRZZ4FB.js → DDLZOMUY.js} +2 -2
- package/dist/cdn/DHOVCT6R.js +2 -0
- package/dist/cdn/{ESTSYVJP.js → F2AHA4GB.js} +2 -2
- package/dist/cdn/FHVXO2WG.js +166 -0
- package/dist/cdn/{VHOF6SUZ.js → FL4W4VYN.js} +3 -3
- package/dist/cdn/FX5JFRDL.js +2 -0
- package/dist/cdn/{CFT5BBC6.js → FX7UOGHP.js} +2 -2
- package/dist/cdn/GSEPHN3A.js +106 -0
- package/dist/cdn/H7422XUG.js +2 -0
- package/dist/cdn/HB5A5R2E.js +2 -0
- package/dist/cdn/JY6LLOUJ.js +22 -0
- package/dist/cdn/{LSGRWCAO.js → KMQ3SP4I.js} +2 -2
- package/dist/cdn/{MZJGADGH.js → LQ6R5YRN.js} +2 -2
- package/dist/cdn/MDVYQQUG.js +14 -0
- package/dist/cdn/{3QC3BRZP.js → MH5RPXHM.js} +2 -2
- package/dist/cdn/{54ATSQPS.js → NAUXSHIE.js} +18 -18
- package/dist/cdn/{SFREIREB.js → NE7E52YR.js} +2 -2
- package/dist/cdn/{2YEKZADB.js → NVI3I46B.js} +2 -2
- package/dist/cdn/{YGW7TUNX.js → OAVEHGB6.js} +1 -1
- package/dist/cdn/{DSEMD4M2.js → OH64RMOR.js} +3 -3
- package/dist/cdn/ON2V5XI2.js +3 -0
- package/dist/cdn/{PTGKT5P6.js → P6OPJQMC.js} +2 -2
- package/dist/cdn/{TRDKA5Y6.js → QR54T33D.js} +2 -2
- package/dist/cdn/{457RLS3H.js → RVOAPUBN.js} +2 -2
- package/dist/cdn/S6W6HV4T.js +36 -0
- package/dist/cdn/{5JBT3YNY.js → SXDLXCIM.js} +2 -2
- package/dist/cdn/{G4SVCCJH.js → USMDJUFS.js} +2 -2
- package/dist/cdn/{Q5D5LJS5.js → V2P4AIGG.js} +2 -2
- package/dist/cdn/V5YEZSRY.js +16 -0
- package/dist/cdn/{5PT7ZFXF.js → X2ZDYHCG.js} +20 -7
- package/dist/cdn/Y333DGV6.js +2 -0
- package/dist/cdn/{CFDTXKJ6.js → YIMNOUTF.js} +1 -1
- package/dist/cdn/YY2SBO3V.js +2 -0
- package/dist/cdn/{7EXACS27.js → ZLXN7NMF.js} +3 -2
- package/dist/cdn/ZS2TZ6BF.js +31 -0
- package/dist/cdn/{W5CHGOOR.js → ZTBA5PM7.js} +2 -2
- package/dist/cdn/assets/assistant/t9n/messages.ar.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.bg.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.bs.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.ca.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.cs.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.da.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.de.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.el.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.es.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.et.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.fi.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.fr.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.he.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.hr.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.hu.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.id.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.it.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.ja.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.ko.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.lt.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.lv.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.nl.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.no.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.pl.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.pt-BR.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.pt-PT.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.ro.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.ru.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.sk.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.sl.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.sr.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.sv.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.th.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.tr.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.uk.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.vi.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.zh-CN.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.zh-HK.json +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.zh-TW.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.ar.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.bg.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.bs.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.ca.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.cs.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.da.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.de.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.el.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.es.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.et.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.fi.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.fr.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.he.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.hr.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.hu.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.id.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.it.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.ja.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.ko.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.lt.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.lv.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.nl.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.no.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.pl.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.pt-BR.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.pt-PT.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.ro.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.ru.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.sk.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.sl.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.sr.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.sv.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.th.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.tr.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.uk.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.vi.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.zh-CN.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.zh-HK.json +1 -1
- package/dist/cdn/assets/assistant-message-feedback/t9n/messages.zh-TW.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.ar.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.bg.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.bs.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.ca.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.cs.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.da.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.de.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.el.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.es.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.et.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.fi.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.fr.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.he.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.hr.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.hu.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.id.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.it.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.ja.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.ko.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.lt.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.lv.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.nl.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.no.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.pl.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.pt-BR.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.pt-PT.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.ro.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.ru.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.sk.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.sl.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.sr.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.sv.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.th.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.tr.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.uk.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.vi.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.zh-CN.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.zh-HK.json +1 -1
- package/dist/cdn/assets/assistant-message-footer/t9n/messages.zh-TW.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.ar.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.bg.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.bs.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.ca.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.cs.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.da.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.de.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.el.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.es.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.et.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.fi.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.fr.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.he.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.hr.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.hu.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.id.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.it.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.ja.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.ko.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.lt.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.lv.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.nl.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.no.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.pl.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.pt-BR.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.pt-PT.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.ro.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.ru.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.sk.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.sl.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.sr.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.sv.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.th.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.tr.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.uk.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.vi.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.zh-CN.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.zh-HK.json +1 -1
- package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.zh-TW.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.ar.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.bg.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.bs.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.ca.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.cs.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.da.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.de.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.el.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.es.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.et.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.fi.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.fr.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.he.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.hr.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.hu.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.id.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.it.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.ja.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.ko.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.lt.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.lv.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.nl.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.no.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.pl.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.pt-BR.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.pt-PT.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.ro.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.ru.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.sk.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.sl.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.sr.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.sv.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.th.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.tr.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.uk.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.vi.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.zh-CN.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.zh-HK.json +1 -1
- package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.zh-TW.json +1 -1
- package/dist/cdn/index.js +2 -2
- package/dist/cdn/main.css +1 -1
- package/dist/chunks/BaseWorkflow.js +107 -0
- package/dist/chunks/adapter.js +2974 -0
- package/dist/chunks/arcgisKnowledgeGraph.js +174 -0
- package/dist/chunks/arcgis_knowledge_current_lc_context.js +8 -0
- package/dist/chunks/arcgis_knowledge_current_map_context.js +8 -0
- package/dist/chunks/arcgis_knowledge_lucene_generation_prompt.js +101 -0
- package/dist/chunks/arcgis_knowledge_summarize_result_prompt.js +48 -0
- package/dist/chunks/arcgis_knowledge_tool_prompt.js +34 -0
- package/dist/chunks/converterUtils.js +1 -1
- package/dist/chunks/dataExplorationGraph.js +298 -0
- package/dist/chunks/data_explore_filter_prompt.js +125 -0
- package/dist/chunks/data_explore_query_prompt.js +144 -0
- package/dist/chunks/embeddings.worker.js +25 -0
- package/dist/chunks/field_descriptions_prompt.js +112 -0
- package/dist/chunks/generateLayerDescriptions.js +413 -0
- package/dist/chunks/graph.js +86 -0
- package/dist/chunks/helpGraph.js +123 -0
- package/dist/chunks/help_prompt.js +57 -0
- package/dist/chunks/intent_prompt.js +123 -0
- package/dist/chunks/layerStylingGraph.js +189 -0
- package/dist/chunks/layer_descriptions_prompt.js +59 -0
- package/dist/chunks/layer_styling_prompt.js +72 -0
- package/dist/chunks/navigationGraph.js +266 -0
- package/dist/chunks/navigation_intent_prompt.js +46 -0
- package/dist/chunks/navigation_tool_prompt.js +39 -0
- package/dist/chunks/orchestrator.js +528 -0
- package/dist/chunks/runtime.js +2 -2
- package/dist/chunks/slottableRequestUtils.js +1 -1
- package/dist/chunks/state.js +71 -0
- package/dist/chunks/summarize_query_response_prompt.js +78 -0
- package/dist/chunks/toolCallResponse.js +29 -0
- package/dist/chunks/useT9n.js +1 -1
- package/dist/chunks/utils.js +47 -29
- package/dist/chunks/utils2.js +42 -7
- package/dist/chunks/utils3.js +16 -0
- package/dist/components/arcgis-assistant/customElement.d.ts +60 -8
- package/dist/components/arcgis-assistant/customElement.js +32 -24
- package/dist/components/arcgis-assistant/types.d.ts +1 -1
- package/dist/components/arcgis-assistant-agent/customElement.d.ts +1 -1
- package/dist/components/arcgis-assistant-agent/customElement.js +2 -2
- 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 +25 -9
- package/dist/components/arcgis-assistant-help-agent/customElement.js +28 -9
- package/dist/components/arcgis-assistant-interrupt/customElement.js +8 -12
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.d.ts +158 -0
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +68 -0
- package/dist/components/arcgis-assistant-knowledge-agent/index.d.ts +1 -0
- package/dist/components/arcgis-assistant-knowledge-agent/index.js +1 -0
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +28 -9
- package/dist/components/arcgis-assistant-message/customElement.js +1 -1
- package/dist/components/arcgis-assistant-message-block/customElement.d.ts +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 +24 -28
- package/dist/components/arcgis-assistant-message-text/customElement.js +1 -1
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +26 -8
- package/dist/components/arcgis-assistant-speech-input/customElement.js +1 -1
- package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +1 -1
- package/dist/components/arcgis-assistant-user-message/customElement.js +1 -1
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1 -1
- package/dist/loader.js +2 -1
- package/dist/types/lumina.d.ts +6 -1
- package/dist/types/preact.d.ts +7 -1
- package/dist/types/react.d.ts +8 -1
- package/dist/types/stencil.d.ts +6 -1
- package/dist/utils/index.d.ts +203 -9
- package/dist/utils/index.js +109 -11
- package/package.json +26 -11
- package/dist/cdn/4QVKWA2Z.js +0 -24
- package/dist/cdn/5L7OZ37N.js +0 -2
- package/dist/cdn/6ALN3KMA.js +0 -269
- package/dist/cdn/ARCP5UZY.js +0 -2
- package/dist/cdn/B4DEC7PH.js +0 -2
- package/dist/cdn/D7WNBUVK.js +0 -106
- package/dist/cdn/GER6EQYH.js +0 -2
- package/dist/cdn/KVH3PDVW.js +0 -2
- package/dist/cdn/O62HTIOD.js +0 -2
- package/dist/cdn/R5FWFRWW.js +0 -2
- package/dist/cdn/SZBOIYZZ.js +0 -2
- package/dist/cdn/WNDUCHXU.js +0 -2
- package/dist/cdn/YW52XJMM.js +0 -396
- package/dist/cdn/ZLO73NU6.js +0 -2
- package/dist/cdn/ZPNJGIAF.js +0 -2
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import type { FunctionToolMiddleware, FunctionToolMiddlewareRequest } from "../tools/FunctionTool.js";
|
|
2
|
+
import type { AgentData, AgentExecutionConfig, AgentGraphState } from "../types.js";
|
|
3
|
+
import type { AgentMiddleware, AgentRunRequest } from "./types.js";
|
|
4
|
+
import type { UiInterrupt } from "../../utils/index.js";
|
|
5
|
+
|
|
6
|
+
/** @since 5.1 */
|
|
7
|
+
export interface HumanInTheLoopInterruptRequest<TCustomState extends AgentData = AgentData> extends AgentRunRequest<TCustomState> {
|
|
8
|
+
/**
|
|
9
|
+
* The ID of the agent requesting human intervention. This can be used to correlate the
|
|
10
|
+
* interrupt with a specific agent, especially in cases where
|
|
11
|
+
* multiple agents may be running concurrently and using the same middleware.
|
|
12
|
+
*
|
|
13
|
+
* @since 5.1
|
|
14
|
+
*/
|
|
15
|
+
agentId: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** @since 5.1 */
|
|
19
|
+
export type HumanInTheLoopInterrupt = Partial<UiInterrupt>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Options for configuring the HumanInTheLoopMiddleware.
|
|
23
|
+
*
|
|
24
|
+
* @since 5.1
|
|
25
|
+
*/
|
|
26
|
+
export interface HumanInTheLoopMiddlewareOptions<TCustomState extends AgentData = AgentData> {
|
|
27
|
+
/**
|
|
28
|
+
* An optional function that generates a custom interrupt object based on the agent run request. This allows for dynamic messages and
|
|
29
|
+
* metadata to be included in the interrupt, providing context to the user when prompting for input or approval.
|
|
30
|
+
*
|
|
31
|
+
* If not provided, a default interrupt with a generic approval message will be used.
|
|
32
|
+
*
|
|
33
|
+
* @param request - The agent run request that triggered the interrupt, containing details about the agent, node, and execution context.
|
|
34
|
+
* @returns An object containing the interrupt details, which will be thrown as a NodeInterrupt to pause the agent's execution.
|
|
35
|
+
* @since 5.1
|
|
36
|
+
*/
|
|
37
|
+
interrupt?(request: HumanInTheLoopInterruptRequest<TCustomState>): HumanInTheLoopInterrupt | Promise<HumanInTheLoopInterrupt>;
|
|
38
|
+
/**
|
|
39
|
+
* An optional key in the agent state where the human response should be stored.
|
|
40
|
+
*
|
|
41
|
+
* @since 5.1
|
|
42
|
+
*/
|
|
43
|
+
outputKey?: keyof AgentGraphState<TCustomState>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** @since 5.1 */
|
|
47
|
+
export interface HumanInTheLoopToolMessageRequest<TInput extends AgentData = AgentData> extends FunctionToolMiddlewareRequest<TInput> {
|
|
48
|
+
/**
|
|
49
|
+
* The arguments passed to the tool that is requesting human intervention.
|
|
50
|
+
*
|
|
51
|
+
* @since 5.1
|
|
52
|
+
*/
|
|
53
|
+
args: object;
|
|
54
|
+
/**
|
|
55
|
+
* The id of the tool call that is requesting human intervention.
|
|
56
|
+
*
|
|
57
|
+
* @since 5.1
|
|
58
|
+
*/
|
|
59
|
+
toolCallId?: string;
|
|
60
|
+
/**
|
|
61
|
+
* The name of the tool that is requesting human intervention.
|
|
62
|
+
*
|
|
63
|
+
* @since 5.1
|
|
64
|
+
*/
|
|
65
|
+
toolName: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* This middleware is designed to allow for human intervention during agent execution by throwing an interrupt that can be handled by the orchestrator to pause the agent and
|
|
70
|
+
* prompt the user for input or approval.
|
|
71
|
+
*
|
|
72
|
+
* @since 5.1
|
|
73
|
+
*/
|
|
74
|
+
export interface HumanInTheLoopToolMiddlewareOptions<TInput extends AgentData = AgentData> {
|
|
75
|
+
/**
|
|
76
|
+
* An optional function that generates a custom interrupt object based on the tool middleware request. This allows for dynamic messages and
|
|
77
|
+
* metadata to be included in the interrupt, providing context to the user when prompting for input or approval at the tool execution level.
|
|
78
|
+
*
|
|
79
|
+
* @param request - The tool middleware request that triggered the interrupt, containing details about the tool, input arguments, and execution context.
|
|
80
|
+
* @since 5.1
|
|
81
|
+
* @return An object containing the interrupt details, which will be thrown as a NodeInterrupt to pause the tool's execution.
|
|
82
|
+
*/
|
|
83
|
+
interrupt?(request: HumanInTheLoopToolMessageRequest<TInput>): HumanInTheLoopInterrupt | Promise<HumanInTheLoopInterrupt>;
|
|
84
|
+
/**
|
|
85
|
+
* An optional key in the tool input where the human response should be stored.
|
|
86
|
+
*
|
|
87
|
+
* @since 5.1
|
|
88
|
+
*/
|
|
89
|
+
outputKey?: keyof TInput;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* This middleware allows for human intervention during agent execution by throwing an interrupt
|
|
94
|
+
* to pause the agent and prompt the user for input or approval prior to proceeding. It can be used
|
|
95
|
+
* to implement a human-in-the-loop workflow, where certain decisions or actions require human approval before proceeding.
|
|
96
|
+
*
|
|
97
|
+
* The interrupt includes customizable messages and metadata to provide context to the user.
|
|
98
|
+
*
|
|
99
|
+
* @param options - Configuration options for the middleware, including the interrupt handler and optional output key for storing the human response in
|
|
100
|
+
* the agent state.
|
|
101
|
+
* @returns An agent middleware that can be added to an agent's middleware stack.
|
|
102
|
+
* @since 5.1
|
|
103
|
+
* @example
|
|
104
|
+
* ```ts
|
|
105
|
+
* const agent = new WorkflowAgent({
|
|
106
|
+
* workflow: myWorkflow,
|
|
107
|
+
* middlewares: [
|
|
108
|
+
* createHumanInTheLoopMiddleware({
|
|
109
|
+
* interrupt: async ({ agentId }) => ({
|
|
110
|
+
* message: `Agent ${agentId} is requesting approval to continue. Do you approve?`,
|
|
111
|
+
* }),
|
|
112
|
+
* }),
|
|
113
|
+
* ],
|
|
114
|
+
* });
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
export function createHumanInTheLoopMiddleware<TCustomState extends AgentData = AgentData>(options?: HumanInTheLoopMiddlewareOptions<TCustomState>): AgentMiddleware<TCustomState>;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* This middleware is designed to wrap tool calls within an agent, allowing for human intervention at the tool execution level. When a tool wrapped with this middleware is invoked,
|
|
121
|
+
* it will throw an interrupt similar to the agent-level middleware, prompting the user for input or approval before the tool executes.
|
|
122
|
+
*
|
|
123
|
+
* @param options - Configuration options for the middleware, including the interrupt handler and optional output key for storing the human response in the tool input.
|
|
124
|
+
* @returns A function tool middleware that can be added to a tool's middleware stack.
|
|
125
|
+
* @since 5.1
|
|
126
|
+
* @example
|
|
127
|
+
* ```ts
|
|
128
|
+
* const myTool = new FunctionTool({
|
|
129
|
+
* name: "sensitiveOperation",
|
|
130
|
+
* execute: async (input) => {
|
|
131
|
+
* // perform sensitive operation
|
|
132
|
+
* },
|
|
133
|
+
* middlewares: [
|
|
134
|
+
* createHumanInTheLoopToolMiddleware({
|
|
135
|
+
* interrupt: async ({ toolName, args }) => ({
|
|
136
|
+
* message: `Tool ${toolName} is requesting approval to execute with arguments: ${JSON.stringify(args)}. Do you approve?`,
|
|
137
|
+
* }),
|
|
138
|
+
* }),
|
|
139
|
+
* ],
|
|
140
|
+
* });
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
export function createHumanInTheLoopToolMiddleware<TInput extends AgentData = AgentData, TOutput = unknown>(options?: HumanInTheLoopToolMiddlewareOptions<TInput>): FunctionToolMiddleware<TInput, TOutput>;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* This function retrieves the human-in-the-loop (HITL) response payload from the agent execution configuration.
|
|
147
|
+
*
|
|
148
|
+
* @param config - The agent execution configuration that may contain a HITL response.
|
|
149
|
+
* @returns The payload from the HITL response if available; otherwise, undefined.
|
|
150
|
+
* @since 5.1
|
|
151
|
+
*/
|
|
152
|
+
export function getHumanInTheLoopPayload<TPayload = unknown>(config: AgentExecutionConfig | undefined): TPayload | undefined;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { NodeInterrupt as s } from "@langchain/langgraph/web";
|
|
3
|
+
import { createAgentMiddleware as f, createToolMiddleware as I } from "./middleware.js";
|
|
4
|
+
const m = "human-in-the-loop", w = "Agent execution requires approval", p = "Agent execution rejected by the user.", h = "human-in-the-loop-tool", y = "Tool execution requires approval";
|
|
5
|
+
function k(t = {}) {
|
|
6
|
+
const { outputKey: n } = t;
|
|
7
|
+
return f(
|
|
8
|
+
m,
|
|
9
|
+
{
|
|
10
|
+
wrapAgent: async (e, r) => {
|
|
11
|
+
const a = T(e), o = M(a, e), i = u(e.config?.configurable);
|
|
12
|
+
if (i?.agentId !== a)
|
|
13
|
+
throw new s(await g({ agentId: a, interruptId: o, options: t, request: e }));
|
|
14
|
+
if (i.id !== o) {
|
|
15
|
+
if (b(a, i.id))
|
|
16
|
+
return await r(e);
|
|
17
|
+
throw new s(await g({ agentId: a, interruptId: o, options: t, request: e }));
|
|
18
|
+
}
|
|
19
|
+
if (i.payload === !1)
|
|
20
|
+
return { outputMessage: p, status: "failed", summary: p };
|
|
21
|
+
const l = n ? { ...e.state, [n]: i.payload } : e.state, d = { ...e, state: l };
|
|
22
|
+
return await r(d);
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{ outputKey: n }
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
function v(t = {}) {
|
|
29
|
+
const { outputKey: n } = t;
|
|
30
|
+
return I(h, {
|
|
31
|
+
wrapToolCall: async (e, r) => {
|
|
32
|
+
const a = e.tool.name, o = A(e.config?.configurable), i = R(o, e.toolCallId ?? a), l = u(e.config?.configurable);
|
|
33
|
+
if (l?.agentId !== o || l.id !== i)
|
|
34
|
+
throw new s(await $({ agentId: o, interruptId: i, options: t, request: e }));
|
|
35
|
+
if (l.payload === !1)
|
|
36
|
+
return `Tool call "${a}" was rejected by the user.`;
|
|
37
|
+
const d = n ? { ...e.input, [n]: l.payload } : e.input, c = { ...e, input: d };
|
|
38
|
+
return await r(c);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
async function g(t) {
|
|
43
|
+
const { agentId: n, interruptId: e, options: r, request: a } = t, o = await r.interrupt?.({ ...a, agentId: n });
|
|
44
|
+
return {
|
|
45
|
+
agentId: n,
|
|
46
|
+
id: e,
|
|
47
|
+
kind: o?.kind ?? "booleanChoice",
|
|
48
|
+
message: o?.message ?? w,
|
|
49
|
+
metadata: o?.metadata
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function T(t) {
|
|
53
|
+
return typeof t.config?.configurable?.agentId == "string" ? t.config.configurable.agentId : t.agent.id;
|
|
54
|
+
}
|
|
55
|
+
function M(t, n) {
|
|
56
|
+
const e = n.config?.configurable?.thread_id, r = typeof e == "string" && e ? `${e}:` : "";
|
|
57
|
+
return `${t}:${r}${n.nodeName}`;
|
|
58
|
+
}
|
|
59
|
+
function b(t, n) {
|
|
60
|
+
return n.startsWith(`${t}:tool:`);
|
|
61
|
+
}
|
|
62
|
+
function A(t) {
|
|
63
|
+
return typeof t?.agentId == "string" ? t.agentId : "llm-agent";
|
|
64
|
+
}
|
|
65
|
+
function R(t, n) {
|
|
66
|
+
return `${t}:tool:${n}`;
|
|
67
|
+
}
|
|
68
|
+
async function $(t) {
|
|
69
|
+
const { agentId: n, interruptId: e, options: r, request: a } = t, { input: o, tool: i, toolCallId: l } = a, d = i.name, c = await r.interrupt?.({ ...a, args: o, toolName: d, toolCallId: l });
|
|
70
|
+
return {
|
|
71
|
+
agentId: n,
|
|
72
|
+
id: e,
|
|
73
|
+
kind: c?.kind ?? "booleanChoice",
|
|
74
|
+
message: c?.message ?? `${y}
|
|
75
|
+
Tool: ${d}`,
|
|
76
|
+
metadata: c?.metadata ?? {
|
|
77
|
+
args: o,
|
|
78
|
+
toolCallId: l,
|
|
79
|
+
toolName: d
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function H(t) {
|
|
84
|
+
return u(t?.configurable)?.payload;
|
|
85
|
+
}
|
|
86
|
+
function u(t) {
|
|
87
|
+
const n = t?.hitlResponse;
|
|
88
|
+
return n && typeof n == "object" && "id" in n && "agentId" in n ? n : null;
|
|
89
|
+
}
|
|
90
|
+
export {
|
|
91
|
+
k as createHumanInTheLoopMiddleware,
|
|
92
|
+
v as createHumanInTheLoopToolMiddleware,
|
|
93
|
+
H as getHumanInTheLoopPayload
|
|
94
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { FunctionToolMiddleware } from "../tools/FunctionTool.js";
|
|
2
|
+
import type { AgentData, AgentGraphState, EmptyAgentData } from "../types.js";
|
|
3
|
+
import type { AgentMiddleware, AgentMiddlewareHooks, ToolMiddlewareHooks } from "./types.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Creates an agent middleware with the specified hooks and options.
|
|
7
|
+
*
|
|
8
|
+
* @param name - The name of the middleware.
|
|
9
|
+
* @param hooks - The hooks to be used in the middleware.
|
|
10
|
+
* @param options - Optional configuration for the middleware, such as the output key.
|
|
11
|
+
* @returns The created agent middleware.
|
|
12
|
+
* @since 5.1
|
|
13
|
+
*/
|
|
14
|
+
export function createAgentMiddleware<TCustomState extends AgentData = EmptyAgentData>(name: string, hooks: AgentMiddlewareHooks<TCustomState>, options?: { outputKey?: keyof AgentGraphState<TCustomState>; }): AgentMiddleware<TCustomState>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Creates a tool middleware with the specified hooks and options.
|
|
18
|
+
*
|
|
19
|
+
* @param name - The name of the middleware.
|
|
20
|
+
* @param hooks - The hooks to be used in the middleware.
|
|
21
|
+
* @param options - Optional configuration for the middleware, such as the output key.
|
|
22
|
+
* @returns The created function tool middleware.
|
|
23
|
+
* @since 5.1
|
|
24
|
+
*/
|
|
25
|
+
export function createToolMiddleware<TInput extends AgentData = AgentData, TOutput = unknown>(name: string, hooks: ToolMiddlewareHooks<TInput, TOutput>, options?: { outputKey?: string; }): FunctionToolMiddleware<TInput, TOutput>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { createMiddleware as p } from "langchain";
|
|
3
|
+
function g(e, t, r) {
|
|
4
|
+
return {
|
|
5
|
+
name: e,
|
|
6
|
+
handler: async (a, n) => {
|
|
7
|
+
const c = async (l) => {
|
|
8
|
+
const d = await t.beforeAgent?.(l), u = d ? {
|
|
9
|
+
...l,
|
|
10
|
+
state: {
|
|
11
|
+
...l.state,
|
|
12
|
+
...d
|
|
13
|
+
}
|
|
14
|
+
} : l, i = await n(u), w = await t.afterAgent?.({ ...u, result: i });
|
|
15
|
+
return w ? { ...i, ...w } : i;
|
|
16
|
+
};
|
|
17
|
+
return t.wrapAgent ? await t.wrapAgent(a, c) : await c(a);
|
|
18
|
+
},
|
|
19
|
+
hooks: t,
|
|
20
|
+
outputKey: r?.outputKey
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function y(e, t, r) {
|
|
24
|
+
return { name: e, handler: async (a, n) => t.wrapToolCall ? await t.wrapToolCall(a, n) : await n(a), outputKey: r?.outputKey };
|
|
25
|
+
}
|
|
26
|
+
function C(e) {
|
|
27
|
+
return e.map((t) => f(t.name, t.hooks ?? {})).filter((t) => !!t);
|
|
28
|
+
}
|
|
29
|
+
function f(e, t) {
|
|
30
|
+
const { afterModel: r, beforeModel: o, wrapModelCall: a, wrapToolCall: n } = t;
|
|
31
|
+
if (!(!r && !o && !a && !n))
|
|
32
|
+
return p({
|
|
33
|
+
afterModel: r,
|
|
34
|
+
beforeModel: o,
|
|
35
|
+
name: e,
|
|
36
|
+
wrapModelCall: a,
|
|
37
|
+
wrapToolCall: n
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
C as convertToLangChainMiddlewares,
|
|
42
|
+
g as createAgentMiddleware,
|
|
43
|
+
y as createToolMiddleware
|
|
44
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { FunctionToolMiddleware } from "../tools/FunctionTool.js";
|
|
2
|
+
import type { AgentMiddleware } from "./types.js";
|
|
3
|
+
import type { AgentData } from "../types.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This middleware is responsible for sending trace messages whenever the agent makes a call to the language model or executes a tool.
|
|
7
|
+
*
|
|
8
|
+
* It uses the `sendTraceMessage` function from the orchestrator to send messages that include
|
|
9
|
+
* details about the model calls and tool
|
|
10
|
+
* executions, which can be useful for debugging and monitoring the agent's behavior.
|
|
11
|
+
*
|
|
12
|
+
* @returns An agent middleware that wraps model calls and sends trace messages.
|
|
13
|
+
* @since 5.1
|
|
14
|
+
*/
|
|
15
|
+
export function createAgentTraceMiddleware(): AgentMiddleware;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* This middleware is responsible for sending trace messages whenever a tool is executed by the agent. It wraps tool calls and uses the `sendTraceMessage`
|
|
19
|
+
* function from the orchestrator to send messages that include details about the tool execution, such as the tool name and its result. This can be useful for
|
|
20
|
+
* debugging and monitoring the behavior of tools within the agent's execution.
|
|
21
|
+
*
|
|
22
|
+
* @returns A function tool middleware that wraps tool calls and sends trace messages.
|
|
23
|
+
* @since 5.1
|
|
24
|
+
*/
|
|
25
|
+
export function createToolTraceMiddleware<TInput extends AgentData = AgentData, TOutput = unknown>(): FunctionToolMiddleware<TInput, TOutput>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import "@arcgis/core/identity/IdentityManager.js";
|
|
3
|
+
import "@arcgis/core/portal/Portal.js";
|
|
4
|
+
import "@langchain/langgraph/web";
|
|
5
|
+
import { s as n } from "../../chunks/generateLayerDescriptions.js";
|
|
6
|
+
import { AIMessage as l, ToolMessage as s } from "@langchain/core/messages";
|
|
7
|
+
import "@langchain/openai";
|
|
8
|
+
import "@arcgis/core/core/reactiveUtils.js";
|
|
9
|
+
import "@arcgis/core/layers/FeatureLayer.js";
|
|
10
|
+
import "@arcgis/core/request.js";
|
|
11
|
+
import "@langchain/core/prompts";
|
|
12
|
+
import { createAgentMiddleware as c, createToolMiddleware as m } from "./middleware.js";
|
|
13
|
+
const d = "agent-trace", g = "tool-trace";
|
|
14
|
+
function $() {
|
|
15
|
+
return c(d, {
|
|
16
|
+
wrapModelCall: async (t, o) => {
|
|
17
|
+
const e = await o(t), a = t.runtime, i = p(e);
|
|
18
|
+
return await Promise.all(
|
|
19
|
+
i.map(
|
|
20
|
+
async (r) => await n(
|
|
21
|
+
{
|
|
22
|
+
text: `LLM requested tool call "${r.name}" with arguments: ${JSON.stringify(r.args, null, 2)}`
|
|
23
|
+
},
|
|
24
|
+
a
|
|
25
|
+
)
|
|
26
|
+
)
|
|
27
|
+
), e;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function h() {
|
|
32
|
+
return m(g, {
|
|
33
|
+
wrapToolCall: async (t, o) => {
|
|
34
|
+
const e = await o(t), a = t.config;
|
|
35
|
+
return await n(
|
|
36
|
+
{
|
|
37
|
+
text: `Finished executing tool: ${s.isInstance(e) ? e.content.toString() : typeof e == "string" ? e : t.tool.name}`
|
|
38
|
+
},
|
|
39
|
+
a
|
|
40
|
+
), e;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function p(t) {
|
|
45
|
+
return !l.isInstance(t) || !Array.isArray(t.tool_calls) ? [] : t.tool_calls.filter((o) => typeof o?.name == "string");
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
$ as createAgentTraceMiddleware,
|
|
49
|
+
h as createToolTraceMiddleware
|
|
50
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import type { FunctionToolMiddlewareHandler } from "../tools/FunctionTool.js";
|
|
2
|
+
import type { AgentData, AgentExecutionConfig, AgentGraphState, EmptyAgentData } from "../types.js";
|
|
3
|
+
import type { AgentMiddleware as LangChainAgentMiddleware } from "langchain";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Handles a middleware request and returns the resulting value.
|
|
7
|
+
*
|
|
8
|
+
* @param request - The request payload for the current middleware stage.
|
|
9
|
+
*/
|
|
10
|
+
export type MiddlewareHandler<TRequest, TResult> = (request: TRequest) => Promise<TResult> | TResult;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Wraps a middleware request and delegates to the next handler.
|
|
14
|
+
*
|
|
15
|
+
* @param request - The request payload for the current middleware stage.
|
|
16
|
+
* @param handler - The next handler in the middleware chain.
|
|
17
|
+
*/
|
|
18
|
+
export type Middleware<TRequest, TResult> = (request: TRequest, handler: MiddlewareHandler<TRequest, TResult>) => Promise<TResult> | TResult;
|
|
19
|
+
|
|
20
|
+
export interface AgentMiddlewareAgent {
|
|
21
|
+
/**
|
|
22
|
+
* Description of the agent, which can be used to provide context in middleware hooks and interrupts.
|
|
23
|
+
*
|
|
24
|
+
* @since 5.1
|
|
25
|
+
*/
|
|
26
|
+
description?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Unique identifier for the agent, used for registration and invocation purposes.
|
|
29
|
+
*
|
|
30
|
+
* @since 5.1
|
|
31
|
+
*/
|
|
32
|
+
id: string;
|
|
33
|
+
/**
|
|
34
|
+
* Name of the agent, used for display and identification purposes.
|
|
35
|
+
*
|
|
36
|
+
* @since 5.1
|
|
37
|
+
*/
|
|
38
|
+
name: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface AgentRunRequest<TCustomState extends AgentData = EmptyAgentData> {
|
|
42
|
+
/**
|
|
43
|
+
* The agent that is being executed. This can be used in middleware hooks to access agent metadata and provide context for interrupts or other middleware behavior.
|
|
44
|
+
*
|
|
45
|
+
* @since 5.1
|
|
46
|
+
*/
|
|
47
|
+
agent: AgentMiddlewareAgent;
|
|
48
|
+
/**
|
|
49
|
+
* The current execution configuration for the agent run, which may include configurable parameters, metadata, and other contextual information. This can be used in middleware
|
|
50
|
+
* hooks to make decisions based on the execution context or to store and retrieve information related to the agent run.
|
|
51
|
+
*
|
|
52
|
+
* @since 5.1
|
|
53
|
+
*/
|
|
54
|
+
config?: AgentExecutionConfig;
|
|
55
|
+
/**
|
|
56
|
+
* The name of the current node being executed in the agent's workflow. This can be used in middleware hooks to provide context or make decisions based on the specific node.
|
|
57
|
+
*
|
|
58
|
+
* @since 5.1
|
|
59
|
+
*/
|
|
60
|
+
nodeName: string;
|
|
61
|
+
/**
|
|
62
|
+
* The current state of the agent's workflow, which may include custom data and intermediate results. This can be used in middleware hooks to access or modify the agent's state during execution.
|
|
63
|
+
*
|
|
64
|
+
* @since 5.1
|
|
65
|
+
*/
|
|
66
|
+
state: Partial<AgentGraphState<TCustomState>>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export type AgentMiddlewareHandler<TCustomState extends AgentData = EmptyAgentData> = Middleware<AgentRunRequest<TCustomState>, AgentGraphState<TCustomState>>;
|
|
70
|
+
|
|
71
|
+
export interface AgentMiddleware<TCustomState extends AgentData = EmptyAgentData> {
|
|
72
|
+
name: string;
|
|
73
|
+
handler: AgentMiddlewareHandler<TCustomState>;
|
|
74
|
+
hooks?: AgentMiddlewareHooks<TCustomState>;
|
|
75
|
+
outputKey?: keyof AgentGraphState<TCustomState>;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface AfterAgentRequest<TCustomState extends AgentData = EmptyAgentData> extends AgentRunRequest<TCustomState> {
|
|
79
|
+
result: AgentGraphState<TCustomState>;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface AgentMiddlewareHooks<TCustomState extends AgentData = EmptyAgentData> {
|
|
83
|
+
/**
|
|
84
|
+
* An optional hook that is called after the agent has executed, allowing for modification of the result or additional side effects.
|
|
85
|
+
*
|
|
86
|
+
* @param request - The request payload for the afterAgent hook, including the original request and the result of the agent's execution.
|
|
87
|
+
* @returns A partial update to the agent's state or other modifications to be applied to the final result, or a promise that resolves to such an update.
|
|
88
|
+
* @since 5.1
|
|
89
|
+
*/
|
|
90
|
+
afterAgent?(request: AfterAgentRequest<TCustomState>): Partial<AgentGraphState<TCustomState>> | Promise<Partial<AgentGraphState<TCustomState>> | void> | void;
|
|
91
|
+
readonly afterModel?: ModelLifecycleHook;
|
|
92
|
+
readonly beforeModel?: ModelLifecycleHook;
|
|
93
|
+
/**
|
|
94
|
+
* An optional hook that is called before the agent executes, allowing for modification of the request or additional side effects.
|
|
95
|
+
*
|
|
96
|
+
* @param request - The request payload for the beforeAgent hook, including the original request.
|
|
97
|
+
* @returns A partial update to the agent's state or other modifications to be applied to the request, or a promise that resolves to such an update.
|
|
98
|
+
* @since 5.1
|
|
99
|
+
*/
|
|
100
|
+
beforeAgent?(request: AgentRunRequest<TCustomState>): Partial<AgentGraphState<TCustomState>> | Promise<Partial<AgentGraphState<TCustomState>> | void> | void;
|
|
101
|
+
/**
|
|
102
|
+
* An optional hook that wraps the entire agent execution, allowing for complete control over the execution flow.
|
|
103
|
+
*
|
|
104
|
+
* @since 5.1
|
|
105
|
+
*/
|
|
106
|
+
readonly wrapAgent?: AgentMiddlewareHandler<TCustomState>;
|
|
107
|
+
readonly wrapModelCall?: LangChainMiddlewareHooks["wrapModelCall"];
|
|
108
|
+
readonly wrapToolCall?: LangChainMiddlewareHooks["wrapToolCall"];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** @since 5.1 */
|
|
112
|
+
export interface ToolMiddlewareHooks<TInput extends AgentData = AgentData, TOutput = unknown> {
|
|
113
|
+
/**
|
|
114
|
+
* Hook that wraps a tool call, allowing you to intercept and modify the request and response of a tool execution. This can be used for logging, modifying inputs/outputs, or implementing custom behavior around tool calls.
|
|
115
|
+
*
|
|
116
|
+
* @since 5.1
|
|
117
|
+
*/
|
|
118
|
+
readonly wrapToolCall?: FunctionToolMiddlewareHandler<TInput, TOutput>;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export type LangChainMiddlewareHooks = Pick<LangChainAgentMiddleware, "afterModel" | "beforeModel" | "wrapModelCall" | "wrapToolCall">;
|
|
122
|
+
|
|
123
|
+
export type ModelLifecycleHook = NonNullable<LangChainMiddlewareHooks["beforeModel"]>;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import type Accessor from "@arcgis/core/core/Accessor.js";
|
|
2
|
+
import type z from "zod";
|
|
3
|
+
import type { StructuredToolInterface } from "@langchain/core/tools";
|
|
4
|
+
import type { Middleware } from "../middlewares/types.js";
|
|
5
|
+
import type { AgentData, AgentExecutionConfig } from "../types.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Execute function used by `FunctionTool`.
|
|
9
|
+
*
|
|
10
|
+
* @param input - Structured tool input.
|
|
11
|
+
* @param config - Optional execution configuration.
|
|
12
|
+
*/
|
|
13
|
+
export type FunctionToolExecute<TInput extends object, TOutput> = (input: TInput, config?: AgentExecutionConfig) => Promise<TOutput> | TOutput;
|
|
14
|
+
|
|
15
|
+
export type FunctionToolResult<TOutput = unknown> = TOutput | string;
|
|
16
|
+
|
|
17
|
+
export interface FunctionToolMiddlewareRequest<TInput extends AgentData = AgentData> {
|
|
18
|
+
config?: AgentExecutionConfig;
|
|
19
|
+
input: TInput;
|
|
20
|
+
tool: FunctionToolMiddlewareTool;
|
|
21
|
+
toolCallId?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type FunctionToolMiddlewareHandler<TInput extends AgentData = AgentData, TOutput = unknown> = Middleware<FunctionToolMiddlewareRequest<TInput>, FunctionToolResult<TOutput>>;
|
|
25
|
+
|
|
26
|
+
export interface FunctionToolMiddleware<TInput extends AgentData = AgentData, TOutput = unknown> {
|
|
27
|
+
name: string;
|
|
28
|
+
handler: FunctionToolMiddlewareHandler<TInput, TOutput>;
|
|
29
|
+
outputKey?: keyof TInput;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type ToolResultMode = "continue" | "terminal";
|
|
33
|
+
|
|
34
|
+
export interface FunctionToolLike {
|
|
35
|
+
/**
|
|
36
|
+
* Name of the tool, used for invocation by agents. This should be unique among the tools available to an agent.
|
|
37
|
+
*
|
|
38
|
+
* @since 5.1
|
|
39
|
+
*/
|
|
40
|
+
name?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Result mode determines how the agent should treat the output of this tool. If set to "terminal", the agent will return the tool's output directly as its final response. If set to "continue", the agent will continue processing after invoking the tool, allowing for further reasoning or tool calls.
|
|
43
|
+
*
|
|
44
|
+
* @since 5.1
|
|
45
|
+
*/
|
|
46
|
+
resultMode?: ToolResultMode;
|
|
47
|
+
getTool: () => StructuredToolInterface;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* FunctionTool is a tool implementation that allows users to define custom logic through a provided execute function,
|
|
52
|
+
* along with input/output schemas for validation and optional middleware for extensibility.
|
|
53
|
+
*
|
|
54
|
+
* The FunctionTool is passed to LLMAgents as part of their tools array, and can be invoked by the agent during execution
|
|
55
|
+
* based on the agent's prompt and reasoning process. The resultMode property allows the tool to either return
|
|
56
|
+
* a final response directly or continue the agent's processing after execution, providing flexibility in how the tool's
|
|
57
|
+
* output is used within the agent's workflow.
|
|
58
|
+
*
|
|
59
|
+
* @since 5.1
|
|
60
|
+
*/
|
|
61
|
+
export class FunctionTool<TInput extends AgentData, TOutput = unknown> extends Accessor {
|
|
62
|
+
constructor(properties?: ConstructProperties<TInput, TOutput>);
|
|
63
|
+
/**
|
|
64
|
+
* A concise, but clear description of the tool's functionality.
|
|
65
|
+
* This should provide enough information for the agent to understand when and why to use the tool.
|
|
66
|
+
* You can include examples of a user's input that would trigger the tool, the values to extract, and
|
|
67
|
+
* sample output to illustrate its purpose.
|
|
68
|
+
*
|
|
69
|
+
* @required
|
|
70
|
+
*/
|
|
71
|
+
accessor description: string;
|
|
72
|
+
/**
|
|
73
|
+
* The execute function contains the custom logic that will be executed when the tool is invoked
|
|
74
|
+
* by an agent. It receives
|
|
75
|
+
* the input object and an optional execution configuration, and returns either a result directly
|
|
76
|
+
* or a promise that resolves to the result.
|
|
77
|
+
*
|
|
78
|
+
* The result is validated against the output schema, if provided.
|
|
79
|
+
*
|
|
80
|
+
* @required
|
|
81
|
+
* @since 5.1
|
|
82
|
+
*/
|
|
83
|
+
accessor execute: FunctionToolExecute<TInput, TOutput>;
|
|
84
|
+
/**
|
|
85
|
+
* The input schema defines the expected structure of the input object when invoking the tool.
|
|
86
|
+
* This should be a Zod schema object.
|
|
87
|
+
* The agent will validate the input against this schema before execution.
|
|
88
|
+
*/
|
|
89
|
+
accessor inputSchema: z.ZodType<TInput> | undefined;
|
|
90
|
+
/** Middleware that can wrap this tool's execution. */
|
|
91
|
+
accessor middlewares: FunctionToolMiddleware<TInput, TOutput>[];
|
|
92
|
+
/**
|
|
93
|
+
* The name of the tool, which will be used to invoke it. This should be unique among the tools
|
|
94
|
+
* available to an agent. It should also be descriptive of the tool's functionality to make it
|
|
95
|
+
* clear to the agent when to use it.
|
|
96
|
+
*
|
|
97
|
+
* @required
|
|
98
|
+
*/
|
|
99
|
+
accessor name: string;
|
|
100
|
+
/**
|
|
101
|
+
* The output schema defines the expected structure of the result returned by the tool.
|
|
102
|
+
* This should be a Zod schema object.
|
|
103
|
+
* The agent will validate the output against this schema after execution.
|
|
104
|
+
*/
|
|
105
|
+
accessor outputSchema: z.ZodType<TOutput> | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* The result mode determines how the agent should treat the output of this tool.
|
|
108
|
+
* If set to `terminal`, the agent will
|
|
109
|
+
* return the tool's output directly as its final response. If set to `continue`,
|
|
110
|
+
* the agent will continue processing after
|
|
111
|
+
* invoking the tool, allowing for further reasoning or tool calls.
|
|
112
|
+
*
|
|
113
|
+
* @default "continue"
|
|
114
|
+
*/
|
|
115
|
+
accessor resultMode: ToolResultMode;
|
|
116
|
+
/** Builds the LangChain tool adapter used by LLM agents. */
|
|
117
|
+
getTool(): StructuredToolInterface;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface FunctionToolMiddlewareTool {
|
|
121
|
+
description: string;
|
|
122
|
+
name: string;
|
|
123
|
+
resultMode: ToolResultMode;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export type ConstructProperties<TInput extends AgentData, TOutput> = Partial<Pick<FunctionTool<TInput, TOutput>, "inputSchema" | "middlewares" | "outputSchema" | "resultMode">>
|
|
127
|
+
& Pick<FunctionTool<TInput, TOutput>, "description" | "execute" | "name">;
|