@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
|
@@ -1,255 +1,237 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import { Annotation as
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import
|
|
2
|
+
import { Annotation as g } from "@langchain/langgraph/web";
|
|
3
|
+
import { d as z, r as T, m as V, c as K } from "./baseAgentState.js";
|
|
4
|
+
import m, { z as r } from "zod";
|
|
5
|
+
import { ChatPromptTemplate as q, SystemMessagePromptTemplate as B } from "@langchain/core/prompts";
|
|
6
|
+
import { s as h } from "./index.js";
|
|
7
|
+
import { AIMessage as H, isAIMessage as W, isToolMessage as X } from "@langchain/core/messages";
|
|
8
|
+
import { createAgent as G, summarizationMiddleware as J, modelCallLimitMiddleware as Q } from "langchain";
|
|
9
|
+
import { ChatOpenAI as Y, OpenAIEmbeddings as Z } from "@langchain/openai";
|
|
10
|
+
import F from "@arcgis/core/portal/Portal.js";
|
|
11
|
+
import U from "@arcgis/core/request.js";
|
|
12
|
+
import ee from "@arcgis/core/identity/IdentityManager.js";
|
|
13
|
+
import { generateGuid as te } from "@arcgis/toolkit/string";
|
|
14
|
+
import ne from "@arcgis/core/config.js";
|
|
11
15
|
const P = {
|
|
12
|
-
advanced: "gpt-5.
|
|
13
|
-
default: "gpt-5-
|
|
14
|
-
fast: "gpt-5.
|
|
15
|
-
},
|
|
16
|
+
advanced: "gpt-5.6-sol",
|
|
17
|
+
default: "gpt-5.6-terra",
|
|
18
|
+
fast: "gpt-5.6-luna"
|
|
19
|
+
}, k = {
|
|
16
20
|
default: "text-embedding-ada-002"
|
|
17
|
-
},
|
|
18
|
-
let
|
|
19
|
-
const
|
|
20
|
-
const t =
|
|
21
|
+
}, S = /* @__PURE__ */ new Map();
|
|
22
|
+
let M = null;
|
|
23
|
+
const se = () => {
|
|
24
|
+
const t = F.getDefault().helperServices;
|
|
21
25
|
if (!t?.aiModels?.url)
|
|
22
26
|
throw new Error("AI Models Service URL is not defined in the portal's helper services.");
|
|
23
27
|
return t.aiModels.url;
|
|
24
|
-
},
|
|
25
|
-
const t =
|
|
26
|
-
|
|
28
|
+
}, j = async (e) => {
|
|
29
|
+
const t = se();
|
|
30
|
+
S.size === 0 && (M || (M = (async () => {
|
|
27
31
|
try {
|
|
28
|
-
|
|
29
|
-
if (!n.ok)
|
|
30
|
-
throw new Error("Failed to fetch AI service discovery data.");
|
|
31
|
-
(await n.json()).models.forEach((i) => M.set(i.name, i));
|
|
32
|
+
(await U(`${t}/models`)).data.models.forEach((s) => S.set(s.name, s));
|
|
32
33
|
} catch (n) {
|
|
33
|
-
throw
|
|
34
|
+
throw M = null, n;
|
|
34
35
|
}
|
|
35
|
-
})()), await
|
|
36
|
-
const
|
|
37
|
-
if (!
|
|
36
|
+
})()), await M);
|
|
37
|
+
const o = S.get(e);
|
|
38
|
+
if (!o)
|
|
38
39
|
throw new Error(`Model '${e}' is not available in the discovery service.`);
|
|
39
|
-
return
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const s = typeof t == "string" ? t.trim() : "";
|
|
45
|
-
if (!s)
|
|
46
|
-
return e;
|
|
47
|
-
const n = e.trim();
|
|
48
|
-
if (!n)
|
|
49
|
-
return s;
|
|
50
|
-
if (n === s)
|
|
51
|
-
return e;
|
|
52
|
-
const a = n.split(`
|
|
53
|
-
|
|
54
|
-
`);
|
|
55
|
-
return a[a.length - 1]?.trim() === s ? e : `${e}
|
|
56
|
-
|
|
57
|
-
${s}`;
|
|
58
|
-
}, N = () => ({
|
|
59
|
-
userRequest: "",
|
|
60
|
-
assignedTask: "",
|
|
61
|
-
messages: [],
|
|
62
|
-
priorSteps: [],
|
|
63
|
-
sharedState: {}
|
|
64
|
-
}), ae = () => ({
|
|
65
|
-
agentExecutionContext: d({
|
|
66
|
-
reducer: j,
|
|
67
|
-
default: N
|
|
68
|
-
}),
|
|
69
|
-
outputMessage: d({
|
|
70
|
-
reducer: $,
|
|
71
|
-
default: () => ""
|
|
40
|
+
return o.endpoint;
|
|
41
|
+
}, oe = async (e = "default") => await j(P[e]), ie = async (e = "default") => await j(k[e]), Le = g.Root({
|
|
42
|
+
agentExecutionContext: g({
|
|
43
|
+
default: K,
|
|
44
|
+
reducer: V
|
|
72
45
|
}),
|
|
73
|
-
|
|
74
|
-
reducer: h,
|
|
75
|
-
default: () => ""
|
|
76
|
-
}),
|
|
77
|
-
status: d({
|
|
78
|
-
reducer: h
|
|
79
|
-
})
|
|
80
|
-
}), De = () => ({
|
|
81
|
-
...ae(),
|
|
82
|
-
sharedStatePatch: d({
|
|
83
|
-
reducer: h
|
|
84
|
-
})
|
|
85
|
-
}), Fe = d.Root({
|
|
86
|
-
agentExecutionContext: d({
|
|
87
|
-
default: N,
|
|
88
|
-
reducer: j
|
|
89
|
-
}),
|
|
90
|
-
currentIntent: d({
|
|
46
|
+
currentIntent: g({
|
|
91
47
|
default: () => "none",
|
|
92
|
-
reducer:
|
|
48
|
+
reducer: T
|
|
49
|
+
}),
|
|
50
|
+
routing: g({
|
|
51
|
+
default: () => ({ mode: "auto" }),
|
|
52
|
+
reducer: T
|
|
93
53
|
}),
|
|
94
|
-
lastExecutedAgent:
|
|
54
|
+
lastExecutedAgent: g({
|
|
95
55
|
default: () => "",
|
|
96
|
-
reducer:
|
|
56
|
+
reducer: T
|
|
97
57
|
}),
|
|
98
|
-
requiresFollowUp:
|
|
58
|
+
requiresFollowUp: g({
|
|
99
59
|
default: () => !0,
|
|
100
|
-
reducer:
|
|
60
|
+
reducer: T
|
|
101
61
|
}),
|
|
102
|
-
stepCount:
|
|
62
|
+
stepCount: g({
|
|
103
63
|
default: () => 0,
|
|
104
64
|
reducer: (e, t) => t ?? e + 1
|
|
105
65
|
}),
|
|
106
|
-
finalOutputMessage:
|
|
66
|
+
finalOutputMessage: g({
|
|
107
67
|
default: () => "",
|
|
108
|
-
reducer:
|
|
68
|
+
reducer: z
|
|
109
69
|
})
|
|
110
|
-
}),
|
|
111
|
-
await U("trace_message", e, t);
|
|
112
|
-
}, Ue = async (e, t) => {
|
|
113
|
-
await U("graph_ux_suggestion", e, t);
|
|
114
|
-
}, ie = (e) => {
|
|
70
|
+
}), re = (e) => {
|
|
115
71
|
if (!e || typeof e != "object" || !("services" in e))
|
|
116
72
|
return !1;
|
|
117
73
|
const t = e.services;
|
|
118
74
|
return !!t && typeof t == "object" && "agentRegistry" in t;
|
|
119
|
-
},
|
|
75
|
+
}, ae = (e) => {
|
|
120
76
|
const t = e?.configurable;
|
|
121
|
-
return
|
|
122
|
-
},
|
|
77
|
+
return re(t) ? t : void 0;
|
|
78
|
+
}, ce = (e, t, o) => {
|
|
123
79
|
const n = e[t];
|
|
124
|
-
return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((
|
|
125
|
-
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
|
|
80
|
+
return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((i, s) => {
|
|
81
|
+
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(s.bind(null, /* @__PURE__ */ new Error("Unknown variable dynamic import: " + t + (t.split("/").length !== o ? ". Note that variables only represent file names one level deep." : ""))));
|
|
126
82
|
});
|
|
127
|
-
},
|
|
128
|
-
const { agent: t, messages:
|
|
83
|
+
}, E = async (e) => (await ce(/* @__PURE__ */ Object.assign({ "./field_descriptions_prompt.md": () => import("./field_descriptions_prompt.js"), "./intent_prompt.md": () => import("./intent_prompt.js"), "./layer_descriptions_prompt.md": () => import("./layer_descriptions_prompt.js") }), `./${e}.md`, 2)).default, le = async (e) => {
|
|
84
|
+
const { agent: t, messages: o, config: n } = e;
|
|
129
85
|
return { structuredResponse: (await t.invoke(
|
|
130
86
|
{
|
|
131
|
-
messages:
|
|
87
|
+
messages: o
|
|
132
88
|
},
|
|
133
89
|
n
|
|
134
90
|
)).structuredResponse };
|
|
135
|
-
},
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
91
|
+
}, de = (e) => typeof e == "string" && e.length > 0 ? e : void 0, pe = () => te(), me = (e) => typeof e != "string" || e.trim().length === 0 ? "MapsSDK" : `MapsSDK - ${e.trim()}`, ue = (e) => {
|
|
92
|
+
const t = e?.configurable;
|
|
93
|
+
return {
|
|
94
|
+
conversationId: de(t?.thread_id),
|
|
95
|
+
abortSignal: e?.signal,
|
|
96
|
+
requestId: pe(),
|
|
97
|
+
requestSource: me(ne.applicationName)
|
|
98
|
+
};
|
|
99
|
+
}, ge = (e) => {
|
|
100
|
+
if (e == null || typeof e == "string" || e instanceof FormData || e instanceof HTMLFormElement)
|
|
101
|
+
return e;
|
|
102
|
+
if (e instanceof URLSearchParams)
|
|
103
|
+
return e.toString();
|
|
104
|
+
throw new TypeError(`Unsupported request body type: ${Object.prototype.toString.call(e)}`);
|
|
105
|
+
}, _ = async ({ config: e }) => {
|
|
106
|
+
const t = F.getDefault(), n = (await ee.getCredential(`${t.url}/sharing`))?.token;
|
|
107
|
+
return async (i, s) => {
|
|
108
|
+
const { conversationId: a, abortSignal: c, requestId: l, requestSource: p } = ue(e), d = new Headers(s?.headers);
|
|
109
|
+
for (const v of [...d.keys()]) {
|
|
110
|
+
const u = v.toLowerCase();
|
|
111
|
+
(u === "authorization" || u === "api-key" || u.startsWith("x-stainless-")) && d.delete(v);
|
|
112
|
+
}
|
|
113
|
+
n && n.length > 0 && d.set("X-Esri-Authorization", `Bearer ${n}`), t.isPortal || (p && p.length > 0 && d.set("X-Esri-Request-Source", p), a && a.length > 0 && d.set("X-Esri-Conversation-Id", a), l.length > 0 && d.set("X-Esri-Request-Id", l));
|
|
114
|
+
const b = c && s?.signal ? AbortSignal.any([c, s.signal]) : s?.signal ?? c;
|
|
115
|
+
return (await U(i instanceof Request ? i.url : i.toString(), {
|
|
116
|
+
body: ge(s?.body),
|
|
117
|
+
headers: Object.fromEntries(d),
|
|
118
|
+
responseType: "native",
|
|
119
|
+
signal: b
|
|
120
|
+
})).data;
|
|
121
|
+
};
|
|
122
|
+
}, w = async (e = {}) => {
|
|
123
|
+
const { modelTier: t = "default", config: o } = e, n = P[t], i = await oe(t);
|
|
124
|
+
return new Y({
|
|
125
|
+
modelName: n,
|
|
148
126
|
apiKey: "dummy-key",
|
|
149
|
-
// 5-mini does not support temperature parameter
|
|
150
|
-
...t !== "default" && { temperature: s },
|
|
151
127
|
configuration: {
|
|
152
|
-
baseURL:
|
|
153
|
-
fetch:
|
|
128
|
+
baseURL: i,
|
|
129
|
+
fetch: await _({ config: o })
|
|
154
130
|
}
|
|
155
131
|
});
|
|
156
|
-
},
|
|
157
|
-
const
|
|
158
|
-
return new
|
|
159
|
-
modelName:
|
|
132
|
+
}, ze = async (e = {}) => {
|
|
133
|
+
const { tier: t = "default", config: o } = e, n = k[t], i = await ie(t);
|
|
134
|
+
return new Z({
|
|
135
|
+
modelName: n,
|
|
160
136
|
apiKey: "dummy-key",
|
|
161
137
|
configuration: {
|
|
162
138
|
baseURL: i,
|
|
163
|
-
fetch:
|
|
139
|
+
fetch: await _({ config: o })
|
|
164
140
|
},
|
|
165
141
|
batchSize: 2048,
|
|
166
142
|
maxConcurrency: 10
|
|
167
143
|
});
|
|
168
|
-
},
|
|
169
|
-
id:
|
|
170
|
-
name:
|
|
171
|
-
description:
|
|
144
|
+
}, fe = r.object({
|
|
145
|
+
id: r.string().min(1),
|
|
146
|
+
name: r.string().min(1),
|
|
147
|
+
description: r.string().min(1)
|
|
172
148
|
});
|
|
173
|
-
|
|
174
|
-
const
|
|
175
|
-
const t = e.map((n) => n.id),
|
|
176
|
-
return
|
|
177
|
-
intent:
|
|
178
|
-
assignedTask:
|
|
179
|
-
requiresFollowUp:
|
|
149
|
+
r.array(fe);
|
|
150
|
+
const A = (e) => JSON.stringify(e, null, 2), he = (e) => {
|
|
151
|
+
const t = e.map((n) => n.id), o = r.enum(t);
|
|
152
|
+
return r.object({
|
|
153
|
+
intent: o.nullable(),
|
|
154
|
+
assignedTask: r.string().nullable(),
|
|
155
|
+
requiresFollowUp: r.boolean()
|
|
180
156
|
});
|
|
181
|
-
},
|
|
182
|
-
const
|
|
183
|
-
if (
|
|
184
|
-
return await
|
|
157
|
+
}, Ve = async (e, t) => {
|
|
158
|
+
const o = ae(t);
|
|
159
|
+
if (t?.signal?.aborted)
|
|
160
|
+
return await h({ text: "Run cancelled; skipping intent routing" }, t), {
|
|
185
161
|
...e,
|
|
186
162
|
currentIntent: "none",
|
|
187
163
|
finalOutputMessage: "Operation cancelled.",
|
|
188
164
|
requiresFollowUp: !1
|
|
189
165
|
};
|
|
190
166
|
try {
|
|
191
|
-
await
|
|
192
|
-
const
|
|
193
|
-
id:
|
|
194
|
-
name:
|
|
195
|
-
description:
|
|
167
|
+
await h({ text: "Asking LLM to route to an agent" }, t);
|
|
168
|
+
const i = o.services.agentRegistry?.list() ?? [], s = i.map(({ agent: f }) => ({
|
|
169
|
+
id: f.id,
|
|
170
|
+
name: f.name,
|
|
171
|
+
description: f.description
|
|
196
172
|
}));
|
|
197
|
-
if (!
|
|
198
|
-
return await
|
|
173
|
+
if (!s.length)
|
|
174
|
+
return await h({ text: "No agents registered; skipping intent detection" }, t), {
|
|
199
175
|
...e,
|
|
200
176
|
currentIntent: "none",
|
|
201
177
|
finalOutputMessage: "No agents registered; skipping intent detection."
|
|
202
178
|
};
|
|
203
|
-
const
|
|
179
|
+
const a = await E("intent_prompt"), c = A(s), l = he(s), p = {
|
|
204
180
|
registeredAgents: c,
|
|
205
|
-
priorSteps:
|
|
181
|
+
priorSteps: A(e.agentExecutionContext.priorSteps),
|
|
206
182
|
userRequest: e.agentExecutionContext.userRequest
|
|
207
|
-
},
|
|
208
|
-
model: await
|
|
183
|
+
}, b = await q.fromTemplate(a).format(p), C = G({
|
|
184
|
+
model: await w({
|
|
185
|
+
modelTier: "fast",
|
|
186
|
+
config: t
|
|
187
|
+
}),
|
|
209
188
|
tools: [],
|
|
210
|
-
systemPrompt:
|
|
189
|
+
systemPrompt: b,
|
|
211
190
|
responseFormat: l,
|
|
212
191
|
middleware: [
|
|
213
192
|
// Preserve recent conversation context while summarizing older messages
|
|
214
193
|
// to control token usage without losing important intent signals.
|
|
215
194
|
// The trigger and keep parameters can be tuned based on token limits and behavior.
|
|
216
|
-
|
|
217
|
-
model: await
|
|
195
|
+
J({
|
|
196
|
+
model: await w({
|
|
197
|
+
modelTier: "fast",
|
|
198
|
+
config: t
|
|
199
|
+
}),
|
|
218
200
|
trigger: { tokens: 4e3 },
|
|
219
201
|
keep: { messages: 6 }
|
|
220
202
|
}),
|
|
221
203
|
// Enforce no loop/retry.
|
|
222
204
|
// 1 usual LLM call and 1 optional summarization call.
|
|
223
|
-
|
|
205
|
+
Q({ runLimit: 2 })
|
|
224
206
|
]
|
|
225
|
-
}), { structuredResponse:
|
|
207
|
+
}), { structuredResponse: v } = await le({
|
|
226
208
|
agent: C,
|
|
227
209
|
messages: e.agentExecutionContext.messages,
|
|
228
210
|
config: t
|
|
229
|
-
}),
|
|
230
|
-
|
|
231
|
-
), x =
|
|
211
|
+
}), u = l.parse(
|
|
212
|
+
v ?? { intent: null, assignedTask: null, requiresFollowUp: !1 }
|
|
213
|
+
), x = u.intent ?? "none", N = {
|
|
232
214
|
...e,
|
|
233
215
|
currentIntent: x,
|
|
234
|
-
requiresFollowUp:
|
|
216
|
+
requiresFollowUp: u.requiresFollowUp,
|
|
235
217
|
agentExecutionContext: {
|
|
236
218
|
...e.agentExecutionContext,
|
|
237
|
-
assignedTask:
|
|
219
|
+
assignedTask: u.assignedTask ?? ""
|
|
238
220
|
}
|
|
239
221
|
};
|
|
240
222
|
if (x === "none") {
|
|
241
|
-
const
|
|
223
|
+
const f = `I could not find an agent that can handle that request. I have access to the following agents: ${i.map(({ agent: L }) => L.name).join(", ")}.
|
|
242
224
|
|
|
243
225
|
Please ask a question that can be answered by one of these agents.`;
|
|
244
|
-
return await
|
|
226
|
+
return await h({ text: "LLM did not identify a clear intent." }, t), {
|
|
245
227
|
...e,
|
|
246
228
|
currentIntent: x,
|
|
247
229
|
requiresFollowUp: !1,
|
|
248
|
-
finalOutputMessage:
|
|
230
|
+
finalOutputMessage: f,
|
|
249
231
|
agentExecutionContext: {
|
|
250
232
|
...e.agentExecutionContext,
|
|
251
233
|
assignedTask: "",
|
|
252
|
-
messages: [...e.agentExecutionContext.messages, new H(
|
|
234
|
+
messages: [...e.agentExecutionContext.messages, new H(f)],
|
|
253
235
|
priorSteps: [
|
|
254
236
|
...e.agentExecutionContext.priorSteps ?? [],
|
|
255
237
|
{
|
|
@@ -262,179 +244,174 @@ Please ask a question that can be answered by one of these agents.`;
|
|
|
262
244
|
}
|
|
263
245
|
};
|
|
264
246
|
}
|
|
265
|
-
return await
|
|
247
|
+
return await h(
|
|
266
248
|
{
|
|
267
249
|
text: `Agent picked: ${x}
|
|
268
|
-
Task Assigned: ${
|
|
269
|
-
Requires Follow-Up: ${
|
|
250
|
+
Task Assigned: ${u.assignedTask ?? ""}
|
|
251
|
+
Requires Follow-Up: ${u.requiresFollowUp}`
|
|
270
252
|
},
|
|
271
253
|
t
|
|
272
|
-
),
|
|
254
|
+
), N;
|
|
273
255
|
} catch (n) {
|
|
274
|
-
throw await
|
|
256
|
+
throw await h({ text: "Error during intent detection" }, t), new Error(`Error during intent detection: ${n instanceof Error ? n.message : String(n)}`);
|
|
275
257
|
}
|
|
276
|
-
},
|
|
258
|
+
}, ye = "0.1", y = 1536, we = "openai", be = k.default, ve = `Name: {name}
|
|
277
259
|
Title: {title}
|
|
278
|
-
Description: {description}`,
|
|
260
|
+
Description: {description}`, xe = `Name: {name}
|
|
279
261
|
Alias: {alias}
|
|
280
|
-
Description: {description}`,
|
|
281
|
-
schemaVersion:
|
|
282
|
-
modified:
|
|
283
|
-
embeddings:
|
|
284
|
-
modelProvider:
|
|
285
|
-
model:
|
|
286
|
-
dimensions:
|
|
287
|
-
templates:
|
|
288
|
-
layer:
|
|
289
|
-
field:
|
|
262
|
+
Description: {description}`, Ke = r.object({
|
|
263
|
+
schemaVersion: r.literal(ye),
|
|
264
|
+
modified: r.number().int().nonnegative(),
|
|
265
|
+
embeddings: r.object({
|
|
266
|
+
modelProvider: r.literal(we),
|
|
267
|
+
model: r.literal(be),
|
|
268
|
+
dimensions: r.literal(y),
|
|
269
|
+
templates: r.object({
|
|
270
|
+
layer: r.string().default(ve),
|
|
271
|
+
field: r.string().default(xe)
|
|
290
272
|
})
|
|
291
273
|
}),
|
|
292
|
-
layers:
|
|
293
|
-
|
|
294
|
-
id:
|
|
295
|
-
name:
|
|
296
|
-
title:
|
|
297
|
-
description:
|
|
298
|
-
vector:
|
|
299
|
-
message: `Layer vector must be exactly ${
|
|
274
|
+
layers: r.array(
|
|
275
|
+
r.object({
|
|
276
|
+
id: r.string().min(1),
|
|
277
|
+
name: r.string().min(1),
|
|
278
|
+
title: r.string().catch(""),
|
|
279
|
+
description: r.string().catch(""),
|
|
280
|
+
vector: r.array(r.number()).length(y, {
|
|
281
|
+
message: `Layer vector must be exactly ${y} dimensions`
|
|
300
282
|
}),
|
|
301
|
-
fields:
|
|
302
|
-
|
|
303
|
-
name:
|
|
304
|
-
alias:
|
|
305
|
-
description:
|
|
306
|
-
vector:
|
|
307
|
-
message: `Field vector must be exactly ${
|
|
283
|
+
fields: r.array(
|
|
284
|
+
r.object({
|
|
285
|
+
name: r.string().min(1),
|
|
286
|
+
alias: r.string().catch(""),
|
|
287
|
+
description: r.string().catch(""),
|
|
288
|
+
vector: r.array(r.number()).length(y, {
|
|
289
|
+
message: `Field vector must be exactly ${y} dimensions`
|
|
308
290
|
})
|
|
309
291
|
})
|
|
310
292
|
)
|
|
311
293
|
})
|
|
312
294
|
).default([])
|
|
313
|
-
}),
|
|
295
|
+
}), Te = (e) => {
|
|
314
296
|
const t = /* @__PURE__ */ new Set();
|
|
315
297
|
for (const n of e)
|
|
316
|
-
if (
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
|
|
298
|
+
if (W(n)) {
|
|
299
|
+
const i = n;
|
|
300
|
+
i.tool_calls && i.tool_calls.length > 0 && i.tool_calls.forEach((s) => {
|
|
301
|
+
s.id && t.add(s.id);
|
|
320
302
|
});
|
|
321
303
|
}
|
|
322
304
|
return e.filter((n) => {
|
|
323
305
|
if (X(n)) {
|
|
324
|
-
const
|
|
325
|
-
return t.has(
|
|
306
|
+
const i = n;
|
|
307
|
+
return t.has(i.tool_call_id);
|
|
326
308
|
}
|
|
327
309
|
return !0;
|
|
328
310
|
});
|
|
329
|
-
},
|
|
330
|
-
const
|
|
331
|
-
return
|
|
332
|
-
},
|
|
333
|
-
const { promptText: t, modelTier:
|
|
334
|
-
return
|
|
335
|
-
},
|
|
336
|
-
const { promptText: t, modelTier:
|
|
311
|
+
}, R = (e, t) => {
|
|
312
|
+
const o = B.fromTemplate(e);
|
|
313
|
+
return q.fromMessages([o, ...t]);
|
|
314
|
+
}, Me = async (e) => {
|
|
315
|
+
const { promptText: t, modelTier: o, messages: n, config: i } = e, s = R(t, n ?? []), a = await w({ modelTier: o, config: i });
|
|
316
|
+
return s.pipe(a);
|
|
317
|
+
}, Be = async (e) => {
|
|
318
|
+
const { promptText: t, modelTier: o = "default", messages: n, inputVariables: i, config: s } = e, c = await (await Me({
|
|
337
319
|
promptText: t,
|
|
338
|
-
modelTier:
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
},
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
return !!(s && s !== (t.alias ?? ""));
|
|
320
|
+
modelTier: o,
|
|
321
|
+
messages: n,
|
|
322
|
+
config: s
|
|
323
|
+
})).invoke(i ?? {}, s);
|
|
324
|
+
if (typeof c == "string")
|
|
325
|
+
return c;
|
|
326
|
+
const l = c.content;
|
|
327
|
+
return typeof l == "string" ? l : JSON.stringify(l);
|
|
328
|
+
}, O = async (e) => {
|
|
329
|
+
const { promptText: t, modelTier: o = "default", messages: n, inputVariables: i, schema: s, config: a } = e, c = R(t, n ?? []), p = (await w({ modelTier: o, config: a })).withStructuredOutput(s);
|
|
330
|
+
return await c.pipe(p).invoke(i ?? {}, a);
|
|
331
|
+
}, He = async (e) => {
|
|
332
|
+
const { promptText: t, modelTier: o = "default", messages: n, inputVariables: i, tools: s, config: a } = e, c = s.length > 0 ? Te(n ?? []) : n ?? [], l = R(t, c), p = await w({ modelTier: o, config: a });
|
|
333
|
+
return await l.pipe(p.bindTools(s)).invoke(i ?? {}, a);
|
|
334
|
+
}, Se = m.object({
|
|
335
|
+
name: m.string(),
|
|
336
|
+
description: m.string(),
|
|
337
|
+
valueType: m.string(),
|
|
338
|
+
alias: m.string()
|
|
339
|
+
}), Ie = m.object({
|
|
340
|
+
fields: m.array(Se)
|
|
341
|
+
}), $ = (e, t) => e.getFieldAlias(t) ?? void 0, I = (e, t) => $(e, t.name) ?? t.alias ?? "", ke = (e, t) => {
|
|
342
|
+
const o = $(e, t.name);
|
|
343
|
+
return !!(o && o !== (t.alias ?? ""));
|
|
363
344
|
};
|
|
364
345
|
function D(e, t) {
|
|
365
|
-
const
|
|
346
|
+
const o = /* @__PURE__ */ new Map();
|
|
366
347
|
for (const n of e.fields) {
|
|
367
|
-
const
|
|
348
|
+
const i = t.fields.find((l) => l.name === n.name), s = I(e, n), a = ke(e, n), c = {
|
|
368
349
|
name: n.name,
|
|
369
350
|
type: n.type,
|
|
370
|
-
alias:
|
|
371
|
-
description:
|
|
372
|
-
valueType:
|
|
351
|
+
alias: a ? s : i?.alias ?? s,
|
|
352
|
+
description: i?.description ?? n.description ?? "",
|
|
353
|
+
valueType: i?.valueType ?? n.valueType ?? "",
|
|
373
354
|
domain: e.getFieldDomain(n.name) ?? void 0
|
|
374
355
|
};
|
|
375
|
-
|
|
356
|
+
o.set(n.name, c);
|
|
376
357
|
}
|
|
377
|
-
return
|
|
358
|
+
return o;
|
|
378
359
|
}
|
|
379
|
-
const
|
|
380
|
-
const
|
|
381
|
-
const { name: c, type: l, description:
|
|
382
|
-
return [`Name: ${c}`, `Type: ${l}`, `Alias: ${
|
|
360
|
+
const We = async (e) => {
|
|
361
|
+
const o = await E("field_descriptions_prompt"), n = e.fields.filter((a) => !(I(e, a) && a.description)).map((a) => {
|
|
362
|
+
const { name: c, type: l, description: p } = a, d = I(e, a);
|
|
363
|
+
return [`Name: ${c}`, `Type: ${l}`, `Alias: ${d}`, `Description: ${p ?? "N/A"}`].join(", ");
|
|
383
364
|
}).join(`
|
|
384
365
|
`);
|
|
385
366
|
if (n.length === 0)
|
|
386
367
|
return D(e, { fields: [] });
|
|
387
|
-
const
|
|
368
|
+
const i = {
|
|
388
369
|
existingItemTitle: e.portalItem?.title,
|
|
389
370
|
existingItemDescription: e.portalItem?.description,
|
|
390
371
|
existingLayerTitle: e.title,
|
|
391
372
|
existingLayerDescription: e.portalItem?.description,
|
|
392
373
|
fieldInformation: n
|
|
393
|
-
},
|
|
394
|
-
promptText:
|
|
395
|
-
schema:
|
|
396
|
-
inputVariables:
|
|
374
|
+
}, s = await O({
|
|
375
|
+
promptText: o,
|
|
376
|
+
schema: Ie,
|
|
377
|
+
inputVariables: i
|
|
397
378
|
});
|
|
398
|
-
return D(e,
|
|
399
|
-
},
|
|
400
|
-
title:
|
|
401
|
-
description:
|
|
402
|
-
name:
|
|
403
|
-
}),
|
|
404
|
-
const n = await
|
|
405
|
-
fieldInformation: JSON.stringify(
|
|
379
|
+
return D(e, s);
|
|
380
|
+
}, Ee = m.object({
|
|
381
|
+
title: m.string(),
|
|
382
|
+
description: m.string(),
|
|
383
|
+
name: m.string().nullable()
|
|
384
|
+
}), Xe = async (e, t) => {
|
|
385
|
+
const n = await E("layer_descriptions_prompt"), i = Array.from(t.values()), s = {
|
|
386
|
+
fieldInformation: JSON.stringify(i, null, 2),
|
|
406
387
|
existingLayerTitle: e.title,
|
|
407
388
|
existingLayerDescription: e.portalItem?.description,
|
|
408
389
|
existingLayerSnippet: e.portalItem?.snippet,
|
|
409
390
|
layerGeometryType: e.geometryType
|
|
410
391
|
};
|
|
411
|
-
return { ...await
|
|
392
|
+
return { ...await O({
|
|
412
393
|
promptText: n,
|
|
413
|
-
schema:
|
|
414
|
-
inputVariables:
|
|
394
|
+
schema: Ee,
|
|
395
|
+
inputVariables: s
|
|
415
396
|
}), name: e.title ?? null };
|
|
416
397
|
};
|
|
417
398
|
export {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
399
|
+
Le as D,
|
|
400
|
+
Ke as W,
|
|
401
|
+
Xe as a,
|
|
402
|
+
we as b,
|
|
403
|
+
w as c,
|
|
404
|
+
y as d,
|
|
405
|
+
Be as e,
|
|
406
|
+
xe as f,
|
|
407
|
+
We as g,
|
|
408
|
+
He as h,
|
|
409
|
+
O as i,
|
|
410
|
+
ie as j,
|
|
430
411
|
ae as k,
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
oe as q,
|
|
437
|
-
Pe as r,
|
|
438
|
-
f as s,
|
|
439
|
-
_e as t
|
|
412
|
+
ve as l,
|
|
413
|
+
be as m,
|
|
414
|
+
Ve as n,
|
|
415
|
+
ze as o,
|
|
416
|
+
ye as s
|
|
440
417
|
};
|