@arcgis/ai-components 5.2.0-next.9 → 5.2.0-next.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +4 -2
- package/README.md +2 -2
- package/dist/agent-utils/FunctionAgent.d.ts +2 -2
- package/dist/agent-utils/LLMAgent.d.ts +7 -4
- package/dist/agent-utils/LLMAgent.js +4 -2
- package/dist/agent-utils/WorkflowAgent.d.ts +2 -2
- package/dist/agent-utils/WorkflowAgent.js +14 -15
- package/dist/agent-utils/index.d.ts +177 -0
- package/dist/agent-utils/index.js +167 -0
- package/dist/agent-utils/middlewares/trace.d.ts +2 -0
- package/dist/agent-utils/middlewares/trace.js +25 -33
- package/dist/agent-utils/tools/FunctionTool.d.ts +2 -2
- package/dist/agent-utils/types.d.ts +37 -8
- package/dist/agent-utils/workflows/ConditionalWorkflow.d.ts +2 -2
- package/dist/agent-utils/workflows/LoopWorkflow.d.ts +2 -2
- package/dist/agent-utils/workflows/ParallelWorkflow.d.ts +2 -2
- package/dist/agent-utils/workflows/RouterWorkflow.d.ts +2 -2
- package/dist/agent-utils/workflows/SequentialWorkflow.d.ts +2 -2
- package/dist/agent-utils/workflows/SwitchWorkflow.d.ts +2 -2
- package/dist/agentic-workflow/AgenticWorkflowRuntime.d.ts +24 -0
- package/dist/agentic-workflow/Edge.d.ts +16 -0
- package/dist/agentic-workflow/WebAgent.d.ts +39 -0
- package/dist/agentic-workflow/jsonTypes.d.ts +189 -0
- package/dist/agentic-workflow/nodes/AgentNode.d.ts +28 -0
- package/dist/agentic-workflow/nodes/BaseNode.d.ts +35 -0
- package/dist/agentic-workflow/nodes/EndMessageNode.d.ts +25 -0
- package/dist/agentic-workflow/nodes/StartNode.d.ts +21 -0
- package/dist/agentic-workflow/nodes/tools/ArcgisTool.d.ts +21 -0
- package/dist/agentic-workflow/types.d.ts +29 -0
- package/dist/agents/tools/filter/clearFilters/adapter.d.ts +8 -0
- package/dist/agents/tools/filter/clearFilters/adapter.js +22 -0
- package/dist/agents/tools/filter/resetMap/adapter.d.ts +8 -0
- package/dist/agents/tools/filter/resetMap/adapter.js +22 -0
- package/dist/agents/tools/filter/setFeatureEffect/adapter.d.ts +8 -0
- package/dist/agents/tools/filter/setFeatureEffect/adapter.js +109 -0
- package/dist/agents/tools/help/listFields/adapter.d.ts +11 -0
- package/dist/agents/tools/help/listFields/adapter.js +30 -0
- package/dist/agents/tools/navigation/goToAddress/adapter.d.ts +10 -0
- package/dist/agents/tools/navigation/goToAddress/adapter.js +52 -0
- package/dist/agents/tools/navigation/goToBookmark/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToBookmark/adapter.js +30 -0
- package/dist/agents/tools/navigation/goToFeatures/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToFeatures/adapter.js +50 -0
- package/dist/agents/tools/navigation/goToFullExtent/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToFullExtent/adapter.js +27 -0
- package/dist/agents/tools/navigation/goToHomeExtent/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToHomeExtent/adapter.js +24 -0
- package/dist/agents/tools/navigation/goToLayer/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToLayer/adapter.js +26 -0
- package/dist/agents/tools/navigation/goToScale/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToScale/adapter.js +21 -0
- package/dist/agents/tools/navigation/goToViewpoint/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToViewpoint/adapter.js +42 -0
- package/dist/agents/tools/navigation/goToZoom/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToZoom/adapter.js +21 -0
- package/dist/agents/tools/query/getAttribute/adapter.d.ts +8 -0
- package/dist/agents/tools/query/getAttribute/adapter.js +40 -0
- package/dist/agents/tools/query/getStatistics/adapter.d.ts +8 -0
- package/dist/agents/tools/query/getStatistics/adapter.js +154 -0
- package/dist/agents/tools/query/getTopFeatures/adapter.d.ts +8 -0
- package/dist/agents/tools/query/getTopFeatures/adapter.js +141 -0
- package/dist/agents/tools/query/queryFeatures/adapter.d.ts +8 -0
- package/dist/agents/tools/query/queryFeatures/adapter.js +127 -0
- package/dist/agents/tools/search/findRelevantFields/adapter.d.ts +8 -0
- package/dist/agents/tools/search/findRelevantFields/adapter.js +57 -0
- package/dist/agents/tools/search/findRelevantLayers/adapter.d.ts +8 -0
- package/dist/agents/tools/search/findRelevantLayers/adapter.js +38 -0
- package/dist/cdn/2EY3BQQX.js +2 -0
- package/dist/cdn/2PTPBAIN.js +2 -0
- package/dist/cdn/34O57OGV.js +2 -0
- package/dist/cdn/{AMP6IALT.js → 3UEKINYC.js} +1 -1
- package/dist/cdn/434TAA3J.js +2 -0
- package/dist/cdn/4EBLRHYE.js +2 -0
- package/dist/cdn/4HDDRBIY.js +2 -0
- package/dist/cdn/4KOV2NEI.js +9 -0
- package/dist/cdn/4NJ2FF7H.js +2 -0
- package/dist/cdn/4OGR5QKS.js +2 -0
- package/dist/cdn/4WIDLQUH.js +2 -0
- package/dist/cdn/5FL5BTTX.js +66 -0
- package/dist/cdn/5WYRJMBW.js +2 -0
- package/dist/cdn/5X7EG7D2.js +2 -0
- package/dist/cdn/5ZFUGNRN.js +2 -0
- package/dist/cdn/6HF36IKA.js +2 -0
- package/dist/cdn/6KFMRBAA.js +2 -0
- package/dist/cdn/6VJXUIXY.js +3 -0
- package/dist/cdn/7BCQMK6D.js +2 -0
- package/dist/cdn/7DFXYMEA.js +2 -0
- package/dist/cdn/7M6VKBTK.js +6 -0
- package/dist/cdn/7SRLZQVC.js +5 -0
- package/dist/cdn/7V6OSTFC.js +2 -0
- package/dist/cdn/7VAQUCBU.js +9 -0
- package/dist/cdn/7ZFAFKJT.js +2 -0
- package/dist/cdn/ACJTJLZN.js +2 -0
- package/dist/cdn/AI6DYOKR.js +181 -0
- package/dist/cdn/{ZS2TZ6BF.js → AOVJ34QE.js} +1 -1
- package/dist/cdn/APFZY4PI.js +2 -0
- package/dist/cdn/AT4XVTJR.js +44 -0
- package/dist/cdn/AZCIDPML.js +2 -0
- package/dist/cdn/{FL4W4VYN.js → BL273EGZ.js} +17 -1
- package/dist/cdn/C5ZL5Z52.js +18 -0
- package/dist/cdn/CCC6LBMY.js +2 -0
- package/dist/cdn/{5ZZGKP7N.js → CEKOEHB3.js} +1 -1
- package/dist/cdn/CJMUJXPL.js +2 -0
- package/dist/cdn/COL6QYGQ.js +2 -0
- package/dist/cdn/CP5BVGJU.js +2 -0
- package/dist/cdn/CZM4URK7.js +2 -0
- package/dist/cdn/DP6O6PMH.js +2 -0
- package/dist/cdn/{V2P4AIGG.js → EKB7CAMM.js} +1 -1
- package/dist/cdn/EWLXNGKH.js +208 -0
- package/dist/cdn/EYNEYD34.js +2 -0
- package/dist/cdn/FDDQ67BG.js +2 -0
- package/dist/cdn/FDOMMK2M.js +2 -0
- package/dist/cdn/FQH3HOFH.js +2 -0
- package/dist/cdn/{GGSZM7KV.js → FUZ77UGP.js} +6 -4
- package/dist/cdn/{ZLXN7NMF.js → FYZATVB3.js} +10 -8
- package/dist/cdn/GFEOVHJK.js +2 -0
- package/dist/cdn/HHFNQR6Z.js +2 -0
- package/dist/cdn/HIPQ3VRW.js +2 -0
- package/dist/cdn/HKSFWTWK.js +14 -0
- package/dist/cdn/HMUWQCXU.js +2 -0
- package/dist/cdn/IBZ2NEAO.js +2 -0
- package/dist/cdn/{FX7UOGHP.js → ICBIUFK7.js} +1 -1
- package/dist/cdn/IHP25JWI.js +99 -0
- package/dist/cdn/J6A4AS7E.js +22 -0
- package/dist/cdn/J6SZIQJA.js +2 -0
- package/dist/cdn/{NE7E52YR.js → JEBRN3EU.js} +9 -3
- package/dist/cdn/JJJZ7FOM.js +2 -0
- package/dist/cdn/JKIESH74.js +2 -0
- package/dist/cdn/JO5ETMPS.js +2 -0
- package/dist/cdn/K2R6XVK3.js +2 -0
- package/dist/cdn/KCU4FWF7.js +2 -0
- package/dist/cdn/KITIP6J2.js +2 -0
- package/dist/cdn/KWD2ECTM.js +2 -0
- package/dist/cdn/{7RCQFLPP.js → LK7ZIQW6.js} +1 -1
- package/dist/cdn/LLUGJKAQ.js +2 -0
- package/dist/cdn/LPR72QZF.js +36 -0
- package/dist/cdn/{DHOVCT6R.js → MKOQJXQQ.js} +1 -1
- package/dist/cdn/MWYBF3F3.js +66 -0
- package/dist/cdn/NEV6OZN3.js +71 -0
- package/dist/cdn/OAKRPM7D.js +2 -0
- package/dist/cdn/{23EQTPO3.js → OKVLGJAG.js} +1 -1
- package/dist/cdn/OL5656NI.js +2 -0
- package/dist/cdn/ONQ6JSBJ.js +2 -0
- package/dist/cdn/OWTGH34K.js +2 -0
- package/dist/cdn/OYSPNIJI.js +156 -0
- package/dist/cdn/PEYYWXFE.js +2 -0
- package/dist/cdn/PKUDO2RC.js +3 -0
- package/dist/cdn/{LQ6R5YRN.js → PQ2DPOFM.js} +1 -1
- package/dist/cdn/PSYRZMX2.js +2 -0
- package/dist/cdn/PUHRBGKB.js +2 -0
- package/dist/cdn/Q57QWN5W.js +2 -0
- package/dist/cdn/QCFICJ7U.js +3 -0
- package/dist/cdn/QNNGPA3Q.js +2 -0
- package/dist/cdn/R74ZHFA6.js +2 -0
- package/dist/cdn/RBE55SWR.js +2 -0
- package/dist/cdn/RHYNE5OE.js +2 -0
- package/dist/cdn/RLEHNAIA.js +2 -0
- package/dist/cdn/RSNGZQCQ.js +2 -0
- package/dist/cdn/{X2ZDYHCG.js → SDWWUWAF.js} +10 -5
- package/dist/cdn/SHD6YFSR.js +2 -0
- package/dist/cdn/SUYWKYWI.js +22 -0
- package/dist/cdn/SZ2QSSB3.js +2 -0
- package/dist/cdn/T4RIGOXB.js +2 -0
- package/dist/cdn/{3PKJWIC3.js → TMZ6DF22.js} +1 -1
- package/dist/cdn/TPULIO6I.js +34 -0
- package/dist/cdn/U2D53TAX.js +14 -0
- package/dist/cdn/{6YMR4QSD.js → UHEYPSOR.js} +1 -1
- package/dist/cdn/UHZG7SKO.js +2 -0
- package/dist/cdn/UZLQALHY.js +2 -0
- package/dist/cdn/V52XWEGV.js +11 -0
- package/dist/cdn/V6F3HEK7.js +2 -0
- package/dist/cdn/V6HOUZPZ.js +2 -0
- package/dist/cdn/VAXH6RUQ.js +134 -0
- package/dist/cdn/VLLZ2FFU.js +2 -0
- package/dist/cdn/VNJMTA6O.js +2 -0
- package/dist/cdn/VOKXKU7M.js +56 -0
- package/dist/cdn/VXFQANGJ.js +2 -0
- package/dist/cdn/W5JPJWMM.js +2 -0
- package/dist/cdn/WKTQVBFJ.js +2 -0
- package/dist/cdn/WNNMKCKS.js +2 -0
- package/dist/cdn/WP7ORLSB.js +6 -0
- package/dist/cdn/WR2SQX3J.js +2 -0
- package/dist/cdn/X3COUAXY.js +4 -0
- package/dist/cdn/Y7XD7ZRD.js +2 -0
- package/dist/cdn/YEZ3AMNX.js +2 -0
- package/dist/cdn/YLVJA4ZE.js +2 -0
- package/dist/cdn/YQSU6IUO.js +2 -0
- package/dist/cdn/Z5W4V7RC.js +2 -0
- package/dist/cdn/ZLWWWTH4.js +2 -0
- package/dist/cdn/ZOEMBHRF.js +2 -0
- package/dist/cdn/ZQMBJ6MI.js +2 -0
- package/dist/cdn/{ZTBA5PM7.js → ZU2FHVNK.js} +1 -1
- package/dist/cdn/ZVGUAOXE.js +2 -0
- package/dist/cdn/agent-utils/index.js +2 -0
- package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +3 -0
- package/dist/cdn/agent-utils/middlewares/middleware.js +2 -0
- package/dist/cdn/agent-utils/middlewares/trace.js +2 -0
- package/dist/cdn/assets/assistant/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.en.json +1 -0
- package/dist/cdn/assets/assistant-message/t9n/messages.en.json +1 -0
- package/dist/cdn/assets/assistant-message-loading/t9n/messages.en.json +1 -0
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/adapter.js +1299 -2113
- package/dist/chunks/arcgisKnowledgeGraph.js +128 -72
- package/dist/chunks/arcgis_knowledge_current_lc_context.js +19 -2
- package/dist/chunks/arcgis_knowledge_current_map_context.js +31 -2
- package/dist/chunks/arcgis_knowledge_cypher_query_prompt.js +102 -0
- package/dist/chunks/arcgis_knowledge_summarize_result_prompt.js +116 -27
- package/dist/chunks/baseAgentState.js +56 -0
- package/dist/chunks/converterUtils.js +66 -41
- package/dist/chunks/dataExplorationGraph.js +133 -177
- package/dist/chunks/data_explore_query_prompt.js +9 -4
- package/dist/chunks/fetchAgentContext.js +13 -0
- package/dist/chunks/fetchService.js +10 -0
- package/dist/chunks/fieldStatistics.js +79 -0
- package/dist/chunks/formatFeatureAttributes.js +132 -0
- package/dist/chunks/generateLayerDescriptions.js +259 -282
- package/dist/chunks/helpGraph.js +35 -25
- package/dist/chunks/help_prompt.js +34 -17
- package/dist/chunks/index.js +11 -0
- package/dist/chunks/intent_prompt.js +16 -0
- package/dist/chunks/layerStylingGraph.js +37 -31
- package/dist/chunks/mergeWhereClauses.js +15 -0
- package/dist/chunks/navigationGraph.js +124 -103
- package/dist/chunks/navigation_intent_prompt.js +8 -2
- package/dist/chunks/orchestrator.js +298 -139
- package/dist/chunks/slottableRequestUtils.js +3 -7
- package/dist/chunks/state.js +21 -27
- package/dist/chunks/summarize_query_response_prompt.js +9 -7
- package/dist/chunks/toolCallResponse.js +14 -10
- package/dist/chunks/types.js +59 -0
- package/dist/chunks/utils2.js +11 -11
- package/dist/components/arcgis-assistant/customElement.d.ts +72 -0
- package/dist/components/arcgis-assistant/customElement.js +416 -172
- package/dist/components/arcgis-assistant/index.js +2 -3
- package/dist/components/arcgis-assistant/types.d.ts +14 -1
- package/dist/components/arcgis-assistant-agent/customElement.d.ts +13 -1
- package/dist/components/arcgis-assistant-agent/customElement.js +614 -10
- package/dist/components/arcgis-assistant-chat/customElement.d.ts +2 -1
- package/dist/components/arcgis-assistant-chat/customElement.js +23 -18
- package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +2 -0
- package/dist/components/arcgis-assistant-chat-entry/customElement.js +25 -18
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +20 -4
- package/dist/components/arcgis-assistant-help-agent/customElement.js +29 -7
- package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +4 -0
- package/dist/components/arcgis-assistant-interrupt/customElement.js +17 -14
- package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +24 -0
- package/dist/components/arcgis-assistant-interrupt-preview/index.js +2 -0
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.d.ts +7 -7
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +40 -16
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +30 -7
- package/dist/components/arcgis-assistant-message/customElement.d.ts +5 -0
- package/dist/components/arcgis-assistant-message/customElement.js +29 -26
- package/dist/components/arcgis-assistant-message/index.js +2 -0
- package/dist/components/arcgis-assistant-message-block/customElement.js +18 -11
- package/dist/components/arcgis-assistant-message-block/index.js +1 -0
- package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +7 -0
- package/dist/components/arcgis-assistant-message-loading/customElement.js +8 -7
- package/dist/components/arcgis-assistant-message-loading/index.js +1 -0
- package/dist/components/arcgis-assistant-message-text/customElement.d.ts +1 -0
- package/dist/components/arcgis-assistant-message-text/customElement.js +12 -12
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +18 -4
- package/dist/components/arcgis-assistant-speech-input/customElement.js +34 -52
- package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +8 -8
- package/dist/components/arcgis-assistant-user-message/customElement.d.ts +2 -0
- package/dist/components/arcgis-assistant-user-message/customElement.js +15 -10
- 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/loader.js +9 -8
- package/dist/oauth-callback.html +1 -1
- package/dist/orchestrator/orchestrator/orchestratorEvents.d.ts +78 -0
- package/dist/types/lumina.d.ts +10 -8
- package/dist/types/preact.d.ts +10 -8
- package/dist/types/react.d.ts +10 -8
- package/dist/types/stencil.d.ts +12 -10
- package/dist/utils/index.d.ts +8 -8
- package/dist/utils/index.js +56 -55
- package/package.json +32 -12
- package/dist/cdn/2AXF774U.js +0 -2
- package/dist/cdn/462JBSEV.js +0 -422
- package/dist/cdn/53ZCUPKK.js +0 -22
- package/dist/cdn/5QAHYX7Y.js +0 -5
- package/dist/cdn/5XRDJL7R.js +0 -14
- package/dist/cdn/7BCR6TUO.js +0 -2
- package/dist/cdn/7GH7VSB2.js +0 -2
- package/dist/cdn/7PLV4QH6.js +0 -2
- package/dist/cdn/AXDZBBNL.js +0 -45
- package/dist/cdn/DDLZOMUY.js +0 -2
- package/dist/cdn/EECZLT6C.js +0 -166
- package/dist/cdn/ETRWZ3MS.js +0 -108
- package/dist/cdn/F2AHA4GB.js +0 -54
- package/dist/cdn/FX5JFRDL.js +0 -2
- package/dist/cdn/H7422XUG.js +0 -2
- package/dist/cdn/HB5A5R2E.js +0 -2
- package/dist/cdn/I6HNBTWY.js +0 -2
- package/dist/cdn/I7SRZPVS.js +0 -72
- package/dist/cdn/IG6YKZH3.js +0 -3
- package/dist/cdn/JVIKKZND.js +0 -3
- package/dist/cdn/KMQ3SP4I.js +0 -5
- package/dist/cdn/MH5RPXHM.js +0 -2
- package/dist/cdn/NVI3I46B.js +0 -2
- package/dist/cdn/OAVEHGB6.js +0 -2
- package/dist/cdn/OH64RMOR.js +0 -4
- package/dist/cdn/P26NON3Z.js +0 -16
- package/dist/cdn/QR54T33D.js +0 -2
- package/dist/cdn/RVOAPUBN.js +0 -2
- package/dist/cdn/S3VPZFWQ.js +0 -36
- package/dist/cdn/SXDLXCIM.js +0 -2
- package/dist/cdn/TR7RL3IK.js +0 -2
- package/dist/cdn/USMDJUFS.js +0 -2
- package/dist/cdn/Y333DGV6.js +0 -2
- package/dist/cdn/YIMNOUTF.js +0 -2
package/LICENSE.md
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
# Licensing
|
|
2
2
|
|
|
3
|
-
COPYRIGHT
|
|
3
|
+
COPYRIGHT Esri
|
|
4
4
|
|
|
5
5
|
All rights reserved under the copyright laws of the United States and applicable international laws, treaties, and conventions.
|
|
6
6
|
|
|
7
|
-
This material is licensed for use under the
|
|
7
|
+
This material is licensed for use under the Esri Master License Agreement (MLA), and is bound by the terms of that agreement.
|
|
8
8
|
You may redistribute and use this code without modification, provided you adhere to the terms of the MLA and include this copyright notice.
|
|
9
9
|
|
|
10
|
+
See use restrictions at https://www.esri.com/content/dam/esrisites/en-us/media/legal/ma-full/ma-full.pdf.
|
|
11
|
+
|
|
10
12
|
For additional information, contact:
|
|
11
13
|
Environmental Systems Research Institute, Inc.
|
|
12
14
|
Attn: Contracts and Legal Services Department
|
package/README.md
CHANGED
|
@@ -6,5 +6,5 @@ The ArcGIS Maps SDK for JavaScript provides a suite of ready-to-use UI component
|
|
|
6
6
|
|
|
7
7
|
## License
|
|
8
8
|
|
|
9
|
-
This package is licensed under the terms described in the `LICENSE.md` file, located in the root of the package, and at https://js.arcgis.com/5.
|
|
10
|
-
For third party notices, see https://js.arcgis.com/5.
|
|
9
|
+
This package is licensed under the terms described in the `LICENSE.md` file, located in the root of the package, and at https://js.arcgis.com/5.2/LICENSE.txt.
|
|
10
|
+
For third party notices, see https://js.arcgis.com/5.2/third-party-notices.txt.
|
|
@@ -18,7 +18,7 @@ export type FunctionAgentExecute<TInput extends AgentData, TOutput extends Agent
|
|
|
18
18
|
* @since 5.1
|
|
19
19
|
*/
|
|
20
20
|
export class FunctionAgent<TInput extends AgentData = AgentData, TOutput extends AgentData = AgentData> extends BaseAgent<AgentCustomState<TInput, TOutput>> {
|
|
21
|
-
constructor(properties?:
|
|
21
|
+
constructor(properties?: FunctionAgentConstructProperties<TInput, TOutput>);
|
|
22
22
|
/**
|
|
23
23
|
* The execute function contains the core logic of the FunctionAgent.
|
|
24
24
|
* It receives the current agent state and an optional execution configuration,
|
|
@@ -60,5 +60,5 @@ export class FunctionAgent<TInput extends AgentData = AgentData, TOutput extends
|
|
|
60
60
|
initialize(): void;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
export type
|
|
63
|
+
export type FunctionAgentConstructProperties<TInput extends AgentData, TOutput extends AgentData> = Partial<Pick<FunctionAgent<TInput, TOutput>, "description" | "inputSchema" | "middlewares" | "outputSchema">>
|
|
64
64
|
& Pick<FunctionAgent<TInput, TOutput>, "execute" | "name">;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import type { StructuredToolInterface } from "@langchain/core/tools";
|
|
1
2
|
import type { BaseAgent } from "./BaseAgent.js";
|
|
2
3
|
import type { FunctionToolLike } from "./tools/FunctionTool.js";
|
|
3
4
|
import type { AgentCustomState, AgentData, ZodObjectSchema } from "./types.js";
|
|
4
5
|
|
|
6
|
+
export type LLMAgentTool = FunctionToolLike | StructuredToolInterface;
|
|
7
|
+
|
|
5
8
|
/**
|
|
6
9
|
* LLMAgent uses a language model to generate its output based on a provided prompt template and optional tools.
|
|
7
10
|
* It supports structured input and output through Zod schemas, allowing for validation and type safety. The agent's logic is defined by the prompt and the tools it has access to, making it a flexible option for a wide range of use cases.
|
|
@@ -9,7 +12,7 @@ import type { AgentCustomState, AgentData, ZodObjectSchema } from "./types.js";
|
|
|
9
12
|
* @since 5.1
|
|
10
13
|
*/
|
|
11
14
|
export class LLMAgent<TInput extends AgentData = AgentData, TOutput extends AgentData = AgentData> extends BaseAgent<AgentCustomState<TInput, TOutput>> {
|
|
12
|
-
constructor(properties?:
|
|
15
|
+
constructor(properties?: LLMAgentConstructProperties<TInput, TOutput>);
|
|
13
16
|
/**
|
|
14
17
|
* The inputSchema property is an optional Zod schema describing the expected structured input for the agent.
|
|
15
18
|
* This can be used for validation of the input state before execution and also to extract variables from the input
|
|
@@ -39,8 +42,8 @@ export class LLMAgent<TInput extends AgentData = AgentData, TOutput extends Agen
|
|
|
39
42
|
* @required
|
|
40
43
|
*/
|
|
41
44
|
accessor prompt: string;
|
|
42
|
-
/** The tools property is an optional array of
|
|
43
|
-
accessor tools:
|
|
45
|
+
/** The tools property is an optional array of tools that the agent can use during execution. */
|
|
46
|
+
accessor tools: LLMAgentTool[] | undefined;
|
|
44
47
|
/**
|
|
45
48
|
* Rebuilds internal workspace and createGraph wiring. This is automatically called during initialization and whenever
|
|
46
49
|
* the name or description properties change, but can also be called manually if needed to refresh the agent's graph definition.
|
|
@@ -61,5 +64,5 @@ export class LLMAgent<TInput extends AgentData = AgentData, TOutput extends Agen
|
|
|
61
64
|
initialize(): void;
|
|
62
65
|
}
|
|
63
66
|
|
|
64
|
-
export type
|
|
67
|
+
export type LLMAgentConstructProperties<TInput extends AgentData, TOutput extends AgentData> = Partial<Pick<LLMAgent<TInput, TOutput>, "description" | "inputSchema" | "middlewares" | "modelTier" | "outputSchema" | "tools">>
|
|
65
68
|
& Pick<LLMAgent<TInput, TOutput>, "name" | "prompt">;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
2
|
import "@arcgis/core/identity/IdentityManager.js";
|
|
3
3
|
import "@arcgis/core/portal/Portal.js";
|
|
4
|
+
import "@arcgis/core/request.js";
|
|
4
5
|
import { isGraphInterrupt as f } from "@langchain/langgraph/web";
|
|
6
|
+
import "@arcgis/toolkit/string";
|
|
5
7
|
import { c as u } from "../chunks/generateLayerDescriptions.js";
|
|
6
8
|
import "@langchain/core/messages";
|
|
7
9
|
import "@langchain/core/callbacks/dispatch/web";
|
|
10
|
+
import "@langchain/core/callbacks/base";
|
|
8
11
|
import { watch as w } from "@arcgis/core/core/reactiveUtils.js";
|
|
9
12
|
import "@arcgis/core/layers/FeatureLayer.js";
|
|
10
|
-
import "@arcgis/core/request.js";
|
|
11
13
|
import { ChatPromptTemplate as S } from "@langchain/core/prompts";
|
|
12
14
|
import { property as m, subclass as _ } from "@arcgis/core/core/accessorSupport/decorators.js";
|
|
13
15
|
import { createAgent as h } from "langchain";
|
|
@@ -112,7 +114,7 @@ let a = class extends v {
|
|
|
112
114
|
return await S.fromTemplate(this.prompt).format(r);
|
|
113
115
|
}
|
|
114
116
|
_getTools() {
|
|
115
|
-
return this.tools?.map((t) => t.getTool()) ?? [];
|
|
117
|
+
return this.tools?.map((t) => "getTool" in t ? t.getTool() : t) ?? [];
|
|
116
118
|
}
|
|
117
119
|
//#endregion
|
|
118
120
|
};
|
|
@@ -9,7 +9,7 @@ import type { AgentData, ZodObjectSchema } from "./types.js";
|
|
|
9
9
|
* @since 5.1
|
|
10
10
|
*/
|
|
11
11
|
export class WorkflowAgent<TState extends AgentData = AgentData> extends BaseAgent<TState> {
|
|
12
|
-
constructor(properties:
|
|
12
|
+
constructor(properties: WorkflowAgentConstructProperties<TState>);
|
|
13
13
|
/** Optional structured input schema for the workflow wrapper. */
|
|
14
14
|
accessor inputSchema: ZodObjectSchema<object> | undefined;
|
|
15
15
|
/** Optional structured output schema for the workflow wrapper. */
|
|
@@ -40,5 +40,5 @@ export class WorkflowAgent<TState extends AgentData = AgentData> extends BaseAge
|
|
|
40
40
|
initialize(): void;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
export type
|
|
43
|
+
export type WorkflowAgentConstructProperties<TState extends AgentData = AgentData> = Partial<Pick<WorkflowAgent<TState>, "description" | "inputSchema" | "middlewares" | "outputSchema">>
|
|
44
44
|
& Pick<WorkflowAgent<TState>, "name" | "workflow">;
|
|
@@ -3,13 +3,12 @@ import { property as h, subclass as c } from "@arcgis/core/core/accessorSupport/
|
|
|
3
3
|
import { watch as l } from "@arcgis/core/core/reactiveUtils.js";
|
|
4
4
|
import { BaseAgent as m } from "./BaseAgent.js";
|
|
5
5
|
import { c as u } from "../chunks/graph.js";
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
(a = e[i]) && (t = (o ? a(r, s, t) : a(t)) || t);
|
|
6
|
+
var f = Object.defineProperty, w = Object.getOwnPropertyDescriptor, p = (e, r, s, o) => {
|
|
7
|
+
for (var t = o > 1 ? void 0 : o ? w(r, s) : r, a = e.length - 1, i; a >= 0; a--)
|
|
8
|
+
(i = e[a]) && (t = (o ? i(r, s, t) : i(t)) || t);
|
|
10
9
|
return o && t && f(r, s, t), t;
|
|
11
10
|
};
|
|
12
|
-
let
|
|
11
|
+
let n = class extends m {
|
|
13
12
|
//#region Lifecycle
|
|
14
13
|
constructor(e) {
|
|
15
14
|
super(e);
|
|
@@ -38,7 +37,7 @@ let p = class extends m {
|
|
|
38
37
|
this._set("createGraph", r);
|
|
39
38
|
else {
|
|
40
39
|
const s = this.id, o = {
|
|
41
|
-
[s]: async (
|
|
40
|
+
[s]: async (a, i) => await r().compile().invoke(a, i)
|
|
42
41
|
}, t = [{ from: s, decide: () => {
|
|
43
42
|
} }];
|
|
44
43
|
this._set(
|
|
@@ -53,18 +52,18 @@ let p = class extends m {
|
|
|
53
52
|
}
|
|
54
53
|
//#endregion
|
|
55
54
|
};
|
|
56
|
-
|
|
55
|
+
p([
|
|
57
56
|
h()
|
|
58
|
-
],
|
|
59
|
-
|
|
57
|
+
], n.prototype, "workflow", 2);
|
|
58
|
+
p([
|
|
60
59
|
h()
|
|
61
|
-
],
|
|
62
|
-
|
|
60
|
+
], n.prototype, "inputSchema", 2);
|
|
61
|
+
p([
|
|
63
62
|
h()
|
|
64
|
-
],
|
|
65
|
-
|
|
63
|
+
], n.prototype, "outputSchema", 2);
|
|
64
|
+
n = p([
|
|
66
65
|
c("WorkflowAgent")
|
|
67
|
-
],
|
|
66
|
+
], n);
|
|
68
67
|
export {
|
|
69
|
-
|
|
68
|
+
n as WorkflowAgent
|
|
70
69
|
};
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import type { FunctionAgent, FunctionAgentConstructProperties } from "./FunctionAgent.js";
|
|
2
|
+
import type { LLMAgent, LLMAgentConstructProperties } from "./LLMAgent.js";
|
|
3
|
+
import type { WorkflowAgent, WorkflowAgentConstructProperties } from "./WorkflowAgent.js";
|
|
4
|
+
import type { AgentData, SchemaDefinition, SchemaDefinitionData, ZodObjectSchema } from "./types.js";
|
|
5
|
+
import type { FunctionTool, FunctionToolConstructProperties } from "./tools/FunctionTool.js";
|
|
6
|
+
import type { ConditionalWorkflow, ConditionalWorkflowConstructProperties } from "./workflows/ConditionalWorkflow.js";
|
|
7
|
+
import type { LoopWorkflow, LoopWorkflowConstructProperties } from "./workflows/LoopWorkflow.js";
|
|
8
|
+
import type { ParallelWorkflow, ParallelWorkflowConstructProperties } from "./workflows/ParallelWorkflow.js";
|
|
9
|
+
import type { RouterWorkflow, RouterWorkflowConstructProperties } from "./workflows/RouterWorkflow.js";
|
|
10
|
+
import type { SequentialWorkflow, SequentialWorkflowConstructProperties } from "./workflows/SequentialWorkflow.js";
|
|
11
|
+
import type { SwitchWorkflow, SwitchWorkflowConstructProperties } from "./workflows/SwitchWorkflow.js";
|
|
12
|
+
import type { RunnableConfig } from "@langchain/core/runnables";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Creates a Zod schema from a plain object schema definition.
|
|
16
|
+
*
|
|
17
|
+
* Supports all schema field variants:
|
|
18
|
+
* - `string` (with optional `enum`)
|
|
19
|
+
* - `number`
|
|
20
|
+
* - `boolean`
|
|
21
|
+
* - `array` with primitive or nested item definitions
|
|
22
|
+
* - `object` with nested `fields`
|
|
23
|
+
*
|
|
24
|
+
* @param definition
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const primitiveSchema = await createSchema({
|
|
28
|
+
* name: { type: "string", description: "Search location name", required: true },
|
|
29
|
+
* radius: { type: "number", description: "Search radius in miles" },
|
|
30
|
+
* active: { type: "boolean", description: "Whether the search is enabled" },
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* const nestedObjectSchema = await createSchema({
|
|
36
|
+
* query: { type: "string", description: "User search text", required: true },
|
|
37
|
+
* options: {
|
|
38
|
+
* type: "object",
|
|
39
|
+
* description: "Search options",
|
|
40
|
+
* required: true,
|
|
41
|
+
* fields: {
|
|
42
|
+
* center: {
|
|
43
|
+
* type: "object",
|
|
44
|
+
* description: "Map center point",
|
|
45
|
+
* fields: {
|
|
46
|
+
* latitude: { type: "number", description: "Center latitude", required: true },
|
|
47
|
+
* longitude: { type: "number", description: "Center longitude", required: true },
|
|
48
|
+
* },
|
|
49
|
+
* },
|
|
50
|
+
* categories: { type: "array", description: "Selected categories", itemType: "string" },
|
|
51
|
+
* },
|
|
52
|
+
* },
|
|
53
|
+
* });
|
|
54
|
+
* ```
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const arrayOfObjectsSchema = await createSchema({
|
|
58
|
+
* constraints: {
|
|
59
|
+
* type: "array",
|
|
60
|
+
* description: "Constraint rules",
|
|
61
|
+
* itemType: {
|
|
62
|
+
* type: "object",
|
|
63
|
+
* description: "Single constraint rule",
|
|
64
|
+
* fields: {
|
|
65
|
+
* key: { type: "string", description: "Constraint key", required: true },
|
|
66
|
+
* enabled: { type: "boolean", description: "Whether this rule is active" },
|
|
67
|
+
* values: { type: "array", description: "Rule values", itemType: "string" },
|
|
68
|
+
* },
|
|
69
|
+
* },
|
|
70
|
+
* },
|
|
71
|
+
* });
|
|
72
|
+
* ```
|
|
73
|
+
* @since 5.1
|
|
74
|
+
*/
|
|
75
|
+
export function createSchema<const TDefinition extends SchemaDefinition>(definition: TDefinition): Promise<ZodObjectSchema<SchemaDefinitionData<TDefinition>>>;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The suggestions emitted by the agent to the user interface.
|
|
79
|
+
*
|
|
80
|
+
* @since 5.1
|
|
81
|
+
*/
|
|
82
|
+
export type UXSuggestion = {
|
|
83
|
+
/** The type of suggestion being made. */
|
|
84
|
+
type: string;
|
|
85
|
+
/** Optional additional data associated with the suggestion. */
|
|
86
|
+
data?: Record<string, unknown>;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Sends an optional UX suggestion from an agent run to the host application.
|
|
91
|
+
* Use this for non-blocking hints (for example, recommended next actions or UI prompts) that the app may choose to display.
|
|
92
|
+
*
|
|
93
|
+
* @param suggestion
|
|
94
|
+
* @param config
|
|
95
|
+
* @since 5.1
|
|
96
|
+
*/
|
|
97
|
+
export function sendUXSuggestion(suggestion: UXSuggestion, config?: RunnableConfig): Promise<void>;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Creates a FunctionAgent instance from the existing agent implementation.
|
|
101
|
+
*
|
|
102
|
+
* @param properties
|
|
103
|
+
* @since 5.1
|
|
104
|
+
*/
|
|
105
|
+
export function createFunctionAgent<TInput extends AgentData = AgentData, TOutput extends AgentData = AgentData>(properties: FunctionAgentConstructProperties<TInput, TOutput>): Promise<FunctionAgent<TInput, TOutput>>;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Creates a FunctionTool instance from the existing tool implementation.
|
|
109
|
+
*
|
|
110
|
+
* @param properties
|
|
111
|
+
* @since 5.1
|
|
112
|
+
*/
|
|
113
|
+
export function createFunctionTool<TInput extends AgentData, TOutput = unknown>(properties: FunctionToolConstructProperties<TInput, TOutput>): Promise<FunctionTool<TInput, TOutput>>;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Creates an LLMAgent instance from the existing agent implementation.
|
|
117
|
+
*
|
|
118
|
+
* @param properties
|
|
119
|
+
* @since 5.1
|
|
120
|
+
*/
|
|
121
|
+
export function createLLMAgent<TInput extends AgentData = AgentData, TOutput extends AgentData = AgentData>(properties: LLMAgentConstructProperties<TInput, TOutput>): Promise<LLMAgent<TInput, TOutput>>;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Creates a WorkflowAgent instance from the existing workflow agent implementation.
|
|
125
|
+
*
|
|
126
|
+
* @param properties
|
|
127
|
+
* @since 5.1
|
|
128
|
+
*/
|
|
129
|
+
export function createWorkflowAgent<TState extends AgentData = AgentData>(properties: WorkflowAgentConstructProperties<TState>): Promise<WorkflowAgent<TState>>;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Creates a ConditionalWorkflow instance from the existing workflow implementation.
|
|
133
|
+
*
|
|
134
|
+
* @param properties
|
|
135
|
+
* @since 5.1
|
|
136
|
+
*/
|
|
137
|
+
export function createConditionalWorkflow<TState extends AgentData = AgentData>(properties: ConditionalWorkflowConstructProperties<TState>): Promise<ConditionalWorkflow<TState>>;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Creates a LoopWorkflow instance from the existing workflow implementation.
|
|
141
|
+
*
|
|
142
|
+
* @param properties
|
|
143
|
+
* @since 5.1
|
|
144
|
+
*/
|
|
145
|
+
export function createLoopWorkflow<TState extends AgentData = AgentData>(properties: LoopWorkflowConstructProperties<TState>): Promise<LoopWorkflow<TState>>;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Creates a ParallelWorkflow instance from the existing workflow implementation.
|
|
149
|
+
*
|
|
150
|
+
* @param properties
|
|
151
|
+
* @since 5.1
|
|
152
|
+
*/
|
|
153
|
+
export function createParallelWorkflow<TState extends AgentData = AgentData>(properties: ParallelWorkflowConstructProperties<TState>): Promise<ParallelWorkflow<TState>>;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Creates a RouterWorkflow instance from the existing workflow implementation.
|
|
157
|
+
*
|
|
158
|
+
* @param properties
|
|
159
|
+
* @since 5.1
|
|
160
|
+
*/
|
|
161
|
+
export function createRouterWorkflow<TState extends AgentData = AgentData>(properties: RouterWorkflowConstructProperties<TState>): Promise<RouterWorkflow<TState>>;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Creates a SequentialWorkflow instance from the existing workflow implementation.
|
|
165
|
+
*
|
|
166
|
+
* @param properties
|
|
167
|
+
* @since 5.1
|
|
168
|
+
*/
|
|
169
|
+
export function createSequentialWorkflow<TState extends AgentData = AgentData>(properties: SequentialWorkflowConstructProperties<TState>): Promise<SequentialWorkflow<TState>>;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Creates a SwitchWorkflow instance from the existing workflow implementation.
|
|
173
|
+
*
|
|
174
|
+
* @param properties
|
|
175
|
+
* @since 5.1
|
|
176
|
+
*/
|
|
177
|
+
export function createSwitchWorkflow<TState extends AgentData = AgentData>(properties: SwitchWorkflowConstructProperties<TState>): Promise<SwitchWorkflow<TState>>;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
let i, a, c, u, l, s, w, m, f, p, d, g;
|
|
3
|
+
async function n(e, t) {
|
|
4
|
+
if (t in e)
|
|
5
|
+
return e[t];
|
|
6
|
+
if ("default" in e) {
|
|
7
|
+
const o = await e.default;
|
|
8
|
+
return typeof o == "object" && o !== null && t in o ? o[t] : o;
|
|
9
|
+
}
|
|
10
|
+
throw new Error(`Unable to resolve ${String(t)} from module.`);
|
|
11
|
+
}
|
|
12
|
+
function y(e, t) {
|
|
13
|
+
const o = {};
|
|
14
|
+
for (const [r, k] of Object.entries(t))
|
|
15
|
+
o[r] = S(e, k);
|
|
16
|
+
return o;
|
|
17
|
+
}
|
|
18
|
+
function W(e, t) {
|
|
19
|
+
return e.object(y(e, t));
|
|
20
|
+
}
|
|
21
|
+
function S(e, t) {
|
|
22
|
+
const o = h(e, t);
|
|
23
|
+
return t.required === !0 ? o : o.optional();
|
|
24
|
+
}
|
|
25
|
+
function h(e, t) {
|
|
26
|
+
let o = P(e, t);
|
|
27
|
+
return t.description !== void 0 && (o = o.describe(t.description)), o;
|
|
28
|
+
}
|
|
29
|
+
function b(e, t) {
|
|
30
|
+
switch (t) {
|
|
31
|
+
case "string":
|
|
32
|
+
return e.string();
|
|
33
|
+
case "number":
|
|
34
|
+
return e.number();
|
|
35
|
+
case "boolean":
|
|
36
|
+
return e.boolean();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function M(e) {
|
|
40
|
+
return e === "string" || e === "number" || e === "boolean";
|
|
41
|
+
}
|
|
42
|
+
function P(e, t) {
|
|
43
|
+
switch (t.type) {
|
|
44
|
+
case "string": {
|
|
45
|
+
if (t.enum != null) {
|
|
46
|
+
if (t.enum.length === 0)
|
|
47
|
+
throw new Error("String schema field enum must include at least one value.");
|
|
48
|
+
return e.enum(t.enum);
|
|
49
|
+
}
|
|
50
|
+
return e.string();
|
|
51
|
+
}
|
|
52
|
+
case "number":
|
|
53
|
+
return e.number();
|
|
54
|
+
case "boolean":
|
|
55
|
+
return e.boolean();
|
|
56
|
+
case "array": {
|
|
57
|
+
if (t.itemType == null)
|
|
58
|
+
throw new Error("Array schema field requires an itemType definition.");
|
|
59
|
+
return e.array(
|
|
60
|
+
M(t.itemType) ? b(e, t.itemType) : h(e, t.itemType)
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
case "object": {
|
|
64
|
+
if (t.fields == null)
|
|
65
|
+
throw new Error("Object schema field requires a fields definition.");
|
|
66
|
+
return W(e, t.fields);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async function A(e) {
|
|
71
|
+
d ??= import("zod");
|
|
72
|
+
const t = await d;
|
|
73
|
+
return W(t.z, e);
|
|
74
|
+
}
|
|
75
|
+
async function T(e, t) {
|
|
76
|
+
g ??= import("../utils/index.js");
|
|
77
|
+
const o = await g;
|
|
78
|
+
return await (await n(
|
|
79
|
+
o,
|
|
80
|
+
"sendUXSuggestion"
|
|
81
|
+
))(e, t);
|
|
82
|
+
}
|
|
83
|
+
async function L(e) {
|
|
84
|
+
i ??= import("./FunctionAgent.js");
|
|
85
|
+
const t = await i, o = await n(
|
|
86
|
+
t,
|
|
87
|
+
"FunctionAgent"
|
|
88
|
+
);
|
|
89
|
+
return new o(e);
|
|
90
|
+
}
|
|
91
|
+
async function q(e) {
|
|
92
|
+
a ??= import("./tools/FunctionTool.js");
|
|
93
|
+
const t = await a, o = await n(
|
|
94
|
+
t,
|
|
95
|
+
"FunctionTool"
|
|
96
|
+
);
|
|
97
|
+
return new o(e);
|
|
98
|
+
}
|
|
99
|
+
async function F(e) {
|
|
100
|
+
c ??= import("./LLMAgent.js");
|
|
101
|
+
const t = await c, o = await n(t, "LLMAgent");
|
|
102
|
+
return new o(e);
|
|
103
|
+
}
|
|
104
|
+
async function j(e) {
|
|
105
|
+
u ??= import("./WorkflowAgent.js");
|
|
106
|
+
const t = await u, o = await n(
|
|
107
|
+
t,
|
|
108
|
+
"WorkflowAgent"
|
|
109
|
+
);
|
|
110
|
+
return new o(e);
|
|
111
|
+
}
|
|
112
|
+
async function E(e) {
|
|
113
|
+
l ??= import("./workflows/ConditionalWorkflow.js");
|
|
114
|
+
const t = await l, o = await n(t, "ConditionalWorkflow");
|
|
115
|
+
return new o(e);
|
|
116
|
+
}
|
|
117
|
+
async function v(e) {
|
|
118
|
+
s ??= import("./workflows/LoopWorkflow.js");
|
|
119
|
+
const t = await s, o = await n(
|
|
120
|
+
t,
|
|
121
|
+
"LoopWorkflow"
|
|
122
|
+
);
|
|
123
|
+
return new o(e);
|
|
124
|
+
}
|
|
125
|
+
async function U(e) {
|
|
126
|
+
w ??= import("./workflows/ParallelWorkflow.js");
|
|
127
|
+
const t = await w, o = await n(
|
|
128
|
+
t,
|
|
129
|
+
"ParallelWorkflow"
|
|
130
|
+
);
|
|
131
|
+
return new o(e);
|
|
132
|
+
}
|
|
133
|
+
async function R(e) {
|
|
134
|
+
m ??= import("./workflows/RouterWorkflow.js");
|
|
135
|
+
const t = await m, o = await n(
|
|
136
|
+
t,
|
|
137
|
+
"RouterWorkflow"
|
|
138
|
+
);
|
|
139
|
+
return new o(e);
|
|
140
|
+
}
|
|
141
|
+
async function X(e) {
|
|
142
|
+
f ??= import("./workflows/SequentialWorkflow.js");
|
|
143
|
+
const t = await f, o = await n(t, "SequentialWorkflow");
|
|
144
|
+
return new o(e);
|
|
145
|
+
}
|
|
146
|
+
async function x(e) {
|
|
147
|
+
p ??= import("./workflows/SwitchWorkflow.js");
|
|
148
|
+
const t = await p, o = await n(
|
|
149
|
+
t,
|
|
150
|
+
"SwitchWorkflow"
|
|
151
|
+
);
|
|
152
|
+
return new o(e);
|
|
153
|
+
}
|
|
154
|
+
export {
|
|
155
|
+
E as createConditionalWorkflow,
|
|
156
|
+
L as createFunctionAgent,
|
|
157
|
+
q as createFunctionTool,
|
|
158
|
+
F as createLLMAgent,
|
|
159
|
+
v as createLoopWorkflow,
|
|
160
|
+
U as createParallelWorkflow,
|
|
161
|
+
R as createRouterWorkflow,
|
|
162
|
+
A as createSchema,
|
|
163
|
+
X as createSequentialWorkflow,
|
|
164
|
+
x as createSwitchWorkflow,
|
|
165
|
+
j as createWorkflowAgent,
|
|
166
|
+
T as sendUXSuggestion
|
|
167
|
+
};
|
|
@@ -10,6 +10,7 @@ import type { AgentData } from "../types.js";
|
|
|
10
10
|
* executions, which can be useful for debugging and monitoring the agent's behavior.
|
|
11
11
|
*
|
|
12
12
|
* @returns An agent middleware that wraps model calls and sends trace messages.
|
|
13
|
+
* @internal
|
|
13
14
|
* @since 5.1
|
|
14
15
|
*/
|
|
15
16
|
export function createAgentTraceMiddleware(): AgentMiddleware;
|
|
@@ -20,6 +21,7 @@ export function createAgentTraceMiddleware(): AgentMiddleware;
|
|
|
20
21
|
* debugging and monitoring the behavior of tools within the agent's execution.
|
|
21
22
|
*
|
|
22
23
|
* @returns A function tool middleware that wraps tool calls and sends trace messages.
|
|
24
|
+
* @internal
|
|
23
25
|
* @since 5.1
|
|
24
26
|
*/
|
|
25
27
|
export function createToolTraceMiddleware<TInput extends AgentData = AgentData, TOutput = unknown>(): FunctionToolMiddleware<TInput, TOutput>;
|
|
@@ -1,50 +1,42 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import "
|
|
3
|
-
import "@
|
|
4
|
-
import "
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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);
|
|
2
|
+
import { s as r } from "../../chunks/index.js";
|
|
3
|
+
import { AIMessage as i, ToolMessage as s } from "@langchain/core/messages";
|
|
4
|
+
import { createAgentMiddleware as c, createToolMiddleware as d } from "./middleware.js";
|
|
5
|
+
const g = "agent-trace", f = "tool-trace";
|
|
6
|
+
function p() {
|
|
7
|
+
return c(g, {
|
|
8
|
+
wrapModelCall: async (e, a) => {
|
|
9
|
+
const t = await a(e), o = e.runtime, l = m(t);
|
|
18
10
|
return await Promise.all(
|
|
19
|
-
|
|
20
|
-
async (
|
|
11
|
+
l.map(
|
|
12
|
+
async (n) => await r(
|
|
21
13
|
{
|
|
22
|
-
text: `LLM requested tool call "${
|
|
14
|
+
text: `LLM requested tool call "${n.name}" with arguments: ${JSON.stringify(n.args, null, 2)}`
|
|
23
15
|
},
|
|
24
|
-
|
|
16
|
+
o
|
|
25
17
|
)
|
|
26
18
|
)
|
|
27
|
-
),
|
|
19
|
+
), t;
|
|
28
20
|
}
|
|
29
21
|
});
|
|
30
22
|
}
|
|
31
|
-
function
|
|
32
|
-
return
|
|
33
|
-
wrapToolCall: async (
|
|
34
|
-
const
|
|
35
|
-
return await
|
|
23
|
+
function T() {
|
|
24
|
+
return d(f, {
|
|
25
|
+
wrapToolCall: async (e, a) => {
|
|
26
|
+
const t = await a(e), o = e.config;
|
|
27
|
+
return await r(
|
|
36
28
|
{
|
|
37
|
-
text: `Finished executing tool: ${s.isInstance(
|
|
29
|
+
text: `Finished executing tool: ${s.isInstance(t) ? t.content.toString() : typeof t == "string" ? t : e.tool.name}`
|
|
38
30
|
},
|
|
39
|
-
|
|
40
|
-
),
|
|
31
|
+
o
|
|
32
|
+
), t;
|
|
41
33
|
}
|
|
42
34
|
});
|
|
43
35
|
}
|
|
44
|
-
function
|
|
45
|
-
return !
|
|
36
|
+
function m(e) {
|
|
37
|
+
return !i.isInstance(e) || !Array.isArray(e.tool_calls) ? [] : e.tool_calls.filter((a) => typeof a?.name == "string");
|
|
46
38
|
}
|
|
47
39
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
p as createAgentTraceMiddleware,
|
|
41
|
+
T as createToolTraceMiddleware
|
|
50
42
|
};
|
|
@@ -59,7 +59,7 @@ export interface FunctionToolLike {
|
|
|
59
59
|
* @since 5.1
|
|
60
60
|
*/
|
|
61
61
|
export class FunctionTool<TInput extends AgentData, TOutput = unknown> extends Accessor {
|
|
62
|
-
constructor(properties?:
|
|
62
|
+
constructor(properties?: FunctionToolConstructProperties<TInput, TOutput>);
|
|
63
63
|
/**
|
|
64
64
|
* A concise, but clear description of the tool's functionality.
|
|
65
65
|
* This should provide enough information for the agent to understand when and why to use the tool.
|
|
@@ -123,5 +123,5 @@ export interface FunctionToolMiddlewareTool {
|
|
|
123
123
|
resultMode: ToolResultMode;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
export type
|
|
126
|
+
export type FunctionToolConstructProperties<TInput extends AgentData, TOutput> = Partial<Pick<FunctionTool<TInput, TOutput>, "inputSchema" | "middlewares" | "outputSchema" | "resultMode">>
|
|
127
127
|
& Pick<FunctionTool<TInput, TOutput>, "description" | "execute" | "name">;
|