@esri/solutions-components 5.1.0-next.163 → 5.1.0-next.165
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/22BT2PBE.js +338 -0
- package/dist/cdn/{CYEFGPUM.js → 25HVM373.js} +1 -1
- package/dist/cdn/{CFJ4FEY3.js → 26LDC3OX.js} +1 -1
- package/dist/cdn/275IZ5I6.js +5 -0
- package/dist/cdn/{FA5CJT2S.js → 2D6HFQD5.js} +1 -1
- package/dist/cdn/{QTFTJ4DQ.js → 2EXGHOIM.js} +1 -1
- package/dist/cdn/{F3A22NPP.js → 2NSMAAXL.js} +1 -1
- package/dist/cdn/{A2VP46QZ.js → 2R7Y2ZVX.js} +1 -1
- package/dist/cdn/{3KRXI2TQ.js → 2RL6H5TB.js} +1 -1
- package/dist/cdn/{A6VVARNG.js → 2TEBTKD4.js} +1 -1
- package/dist/cdn/354D2K6F.js +2 -0
- package/dist/cdn/{D4TEADUS.js → 37P3IMFV.js} +1 -1
- package/dist/cdn/{C5BQAX2M.js → 3A3CPQX4.js} +1 -1
- package/dist/cdn/{V74POSPP.js → 3J5ZSELO.js} +1 -1
- package/dist/cdn/{Q4X6GXRI.js → 3JCHYXHA.js} +1 -1
- package/dist/cdn/3SMHMC4L.js +2 -0
- package/dist/cdn/{S4ZMJ42A.js → 3UCDO65S.js} +1 -1
- package/dist/cdn/{CPOZIWVH.js → 463CZQF6.js} +1 -1
- package/dist/cdn/{BQ7O62CG.js → 47FRMYZ4.js} +1 -1
- package/dist/cdn/4A77MNRM.js +2 -0
- package/dist/cdn/{UXN2MYLX.js → 4HRGPGDM.js} +1 -1
- package/dist/cdn/{U6DXEFHP.js → 4RCC4KA2.js} +1 -1
- package/dist/cdn/{WXM3KMEV.js → 4SORDX5Z.js} +1 -1
- package/dist/cdn/{EHSIODIO.js → 54A4C4RG.js} +1 -1
- package/dist/cdn/54TJQLYJ.js +69 -0
- package/dist/cdn/{D5JF7XQN.js → 56DNSWXG.js} +1 -1
- package/dist/cdn/{OMRM5EXN.js → 5FWKODDH.js} +1 -1
- package/dist/cdn/{G63OYQ7G.js → 5IDPOFIN.js} +1 -1
- package/dist/cdn/{TLRBE2TZ.js → 5LSNDSHW.js} +1 -1
- package/dist/cdn/{I4EEOB6Y.js → 5N4KGIIY.js} +1 -1
- package/dist/cdn/{QLX3XORL.js → 5W7G3TSG.js} +6 -4
- package/dist/cdn/{MDKHW7NM.js → 62GTPPV5.js} +1 -1
- package/dist/cdn/{MLNGJEKI.js → 67CEWYTY.js} +1 -1
- package/dist/cdn/6FY64JKN.js +2 -0
- package/dist/cdn/{EYJQEBDF.js → 6HZBPFHA.js} +1 -1
- package/dist/cdn/{YCIKY6QN.js → 6PZSOVYB.js} +1 -1
- package/dist/cdn/{FZNRD2XJ.js → 6WNKGSHD.js} +1 -1
- package/dist/cdn/{KMKZEHDS.js → 6WVYNWVR.js} +1 -1
- package/dist/cdn/{MBVY6OPY.js → 743J2ZUC.js} +1 -1
- package/dist/cdn/{7YJMTZFC.js → 77753TPX.js} +1 -1
- package/dist/cdn/{W7VD3QDN.js → 7VY3RI7C.js} +1 -1
- package/dist/cdn/A2A3RFJ6.js +2 -0
- package/dist/cdn/{GABDTUB7.js → A6ZTIX3P.js} +1 -1
- package/dist/cdn/{6LHIJG7J.js → AAUM57XI.js} +1 -1
- package/dist/cdn/{MTEVQC6W.js → ADURBGIK.js} +1 -1
- package/dist/cdn/{IGQJLEEJ.js → APNDTPBA.js} +1 -1
- package/dist/cdn/{S47SVZPE.js → ARFBMFQW.js} +1 -1
- package/dist/cdn/ATEW4U4A.js +2 -0
- package/dist/cdn/{3SDEIO24.js → AYHTQTVS.js} +1 -1
- package/dist/cdn/{KU2LYW6K.js → BIX5DRQP.js} +1 -1
- package/dist/cdn/{G2RMWJ7R.js → BOFA5RH7.js} +1 -1
- package/dist/cdn/{P7LSYADG.js → BWWX52HV.js} +1 -1
- package/dist/cdn/{QPX33Y62.js → BXSBR2GT.js} +1 -1
- package/dist/cdn/{QBARJMJE.js → CMCEF65U.js} +1 -1
- package/dist/cdn/CRDFUDM4.js +45 -0
- package/dist/cdn/{4AFANEZZ.js → CS5N3DOL.js} +1 -1
- package/dist/cdn/{3D5OFNW5.js → CU2JLCTZ.js} +1 -1
- package/dist/cdn/{F6J3OLVZ.js → CV4B2O7J.js} +1 -1
- package/dist/cdn/{TTCTODAR.js → CVXDL2AT.js} +1 -1
- package/dist/cdn/{XHFFDKEQ.js → D22STVK5.js} +1 -1
- package/dist/cdn/{XF5N3NI5.js → DIBK4RSG.js} +1 -1
- package/dist/cdn/{JCQQIAIE.js → DQ47P6ES.js} +1 -1
- package/dist/cdn/{X52T6DJT.js → DVPYGOBV.js} +1 -1
- package/dist/cdn/E3F63VW4.js +2 -0
- package/dist/cdn/EL3OIP52.js +31 -0
- package/dist/cdn/{WQHJMFGP.js → ENXQ33P7.js} +1 -1
- package/dist/cdn/{SGU3KCZB.js → ERLDQUNI.js} +1 -1
- package/dist/cdn/EUI6UDCN.js +43 -0
- package/dist/cdn/{RQIGAX6O.js → EWS72RFR.js} +1 -1
- package/dist/cdn/{4PNNKMNH.js → F4MS4NQL.js} +1 -1
- package/dist/cdn/{UA6XD7SQ.js → FFZ2XVRE.js} +1 -1
- package/dist/cdn/{7FZDDT7D.js → FMPY32BG.js} +1 -1
- package/dist/cdn/{XKEKXTL2.js → FSF3T3OT.js} +1 -1
- package/dist/cdn/{3A5WS2II.js → FUW3T6S6.js} +1 -1
- package/dist/cdn/{JFLG3EKT.js → FYJMHXWV.js} +1 -1
- package/dist/cdn/{57SZHKM5.js → G4V4JPFI.js} +1 -1
- package/dist/cdn/GSCHQNQD.js +56 -0
- package/dist/cdn/{SHI2ULEO.js → GSR2GEY7.js} +1 -1
- package/dist/cdn/{2OCRSUSE.js → GUSPFJUQ.js} +1 -1
- package/dist/cdn/{LY3WRG7K.js → GVMTSUDH.js} +1 -1
- package/dist/cdn/{A62EWI7L.js → H4LZV33O.js} +1 -1
- package/dist/cdn/{SC4UAHYZ.js → HAMYUUYZ.js} +1 -1
- package/dist/cdn/{4ALVWOG7.js → HDMAFAEM.js} +1 -1
- package/dist/cdn/{X65HFYH4.js → HIB4BVGK.js} +1 -1
- package/dist/cdn/{2I5LGZNX.js → HIPZRG2Q.js} +1 -1
- package/dist/cdn/{LXGY2E55.js → HKFXHTYU.js} +1 -1
- package/dist/cdn/{EKK5FR2V.js → HM2QALUN.js} +1 -1
- package/dist/cdn/{MISU75DC.js → HQCHD3FH.js} +1 -1
- package/dist/cdn/HRQVJBRJ.js +2 -0
- package/dist/cdn/HXNARVYH.js +3 -0
- package/dist/cdn/{H3NPAQ3U.js → I4PBOBUM.js} +1 -1
- package/dist/cdn/{V7WSQCQY.js → IAEFPE3L.js} +1 -1
- package/dist/cdn/INLWMPGE.js +2 -0
- package/dist/cdn/ITCC5G26.js +136 -0
- package/dist/cdn/IXPNZCW6.js +2 -0
- package/dist/cdn/{SMN3CVM5.js → IXRFWVBT.js} +1 -1
- package/dist/cdn/JFMNVOWH.js +2 -0
- package/dist/cdn/{WCD4U7UJ.js → JFPR5QIQ.js} +1 -1
- package/dist/cdn/{DF7TCZUS.js → KDDHPA54.js} +1 -1
- package/dist/cdn/{3IO2JXVB.js → KR2PPIBX.js} +1 -1
- package/dist/cdn/LGBRHJBY.js +109 -0
- package/dist/cdn/{5K5GHKON.js → LV5KMTCD.js} +1 -1
- package/dist/cdn/LVYAW6XF.js +2 -0
- package/dist/cdn/LWJF6EXD.js +85 -0
- package/dist/cdn/{55QBAVPE.js → M6AOD7GG.js} +1 -1
- package/dist/cdn/{MJ6JD7WX.js → MFFM74RG.js} +1 -1
- package/dist/cdn/{XM3SRZWV.js → MIV34H66.js} +1 -1
- package/dist/cdn/{EF2TTWG5.js → MKSUYITL.js} +1 -1
- package/dist/cdn/{HGOYPWOK.js → MOSQBUUZ.js} +1 -1
- package/dist/cdn/MV7GEGP5.js +98 -0
- package/dist/cdn/{26QXT6ZT.js → O4DB2EXV.js} +1 -1
- package/dist/cdn/OAUHQK3Y.js +54 -0
- package/dist/cdn/{CZVHNBQN.js → OBCXHY24.js} +1 -1
- package/dist/cdn/{UUIKE2AH.js → ON4EBR25.js} +1 -1
- package/dist/cdn/{R2JOPHL5.js → OUMIC7G7.js} +1 -1
- package/dist/cdn/{F5SUVMAE.js → OZ4IYASP.js} +1 -1
- package/dist/cdn/{FBSKACM2.js → P666D4WT.js} +1 -1
- package/dist/cdn/PGTLLFW6.js +3 -0
- package/dist/cdn/{WCXR46D4.js → PLQEDCUG.js} +1 -1
- package/dist/cdn/PLXHBQBF.js +146 -0
- package/dist/cdn/{22BJ76LD.js → PM4EFNB2.js} +1 -1
- package/dist/cdn/PPFEO3UH.js +2 -0
- package/dist/cdn/{IE5TTSUW.js → QH6PUU3Q.js} +15 -16
- package/dist/cdn/{UBPOT5V3.js → QMAV4UTN.js} +1 -1
- package/dist/cdn/{CAXDDYGL.js → QYCERRRZ.js} +1 -1
- package/dist/cdn/{7JC52SFZ.js → QZ2ZMWIH.js} +1 -1
- package/dist/cdn/{CAYWD56D.js → R27S3IDW.js} +1 -1
- package/dist/cdn/RDJIKSXN.js +439 -0
- package/dist/cdn/{ACTJS4TX.js → RDRCAA3H.js} +1 -1
- package/dist/cdn/{I2NTSKBD.js → RLSY4VUQ.js} +1 -1
- package/dist/cdn/{HVT2WBVC.js → S4GBMN37.js} +1 -1
- package/dist/cdn/{KTRKTBPS.js → SGFSVWTY.js} +1 -1
- package/dist/cdn/{UNBGBQPR.js → SHEDDVHQ.js} +1 -1
- package/dist/cdn/{5F6KCXYP.js → SJLSYFK3.js} +1 -1
- package/dist/cdn/T3EPRHTT.js +4 -0
- package/dist/cdn/TLIIJ2QC.js +122 -0
- package/dist/cdn/{BM4VSEDV.js → TWJ6DAY5.js} +1 -1
- package/dist/cdn/{KKEERGX7.js → TZHRYPII.js} +1 -1
- package/dist/cdn/U27263JW.js +2 -0
- package/dist/cdn/{DKXVDY6L.js → U2FC3BET.js} +1 -1
- package/dist/cdn/{FBGCV6YJ.js → UCYR537P.js} +1 -1
- package/dist/cdn/{LM46YQCN.js → UDPMO6YN.js} +1 -1
- package/dist/cdn/{DJYT367X.js → V5BIPD5T.js} +1 -1
- package/dist/cdn/{IOFIC3IG.js → VBJJQPZT.js} +1 -1
- package/dist/cdn/VDI7SDRK.js +5 -0
- package/dist/cdn/VDZT4UXB.js +36 -0
- package/dist/cdn/{24DOFCUH.js → VKHBBAXO.js} +1 -1
- package/dist/cdn/{O7VRD3Z3.js → VL2NVCIB.js} +1 -1
- package/dist/cdn/{RLYLBYMX.js → VN3AKGAY.js} +1 -1
- package/dist/cdn/{VTAQ6NBB.js → VUXNHQGR.js} +1 -1
- package/dist/cdn/{KIKSO3OQ.js → W5TNQMAJ.js} +1 -1
- package/dist/cdn/{PYPVVSIX.js → WDASGI72.js} +1 -1
- package/dist/cdn/{BATEZR3T.js → WNVC3PSY.js} +1 -1
- package/dist/cdn/WXDMML76.js +2 -0
- package/dist/cdn/{JEIP7CJK.js → XKFX43FE.js} +1 -1
- package/dist/cdn/{GLC7JVKG.js → XQ7SXIHI.js} +1 -1
- package/dist/cdn/{ISFTCFSJ.js → Y2AUIXNK.js} +1 -1
- package/dist/cdn/{L4BYLII5.js → Y3GFBLXF.js} +1 -1
- package/dist/cdn/{T6FQ2A4O.js → YEDC2OLI.js} +1 -1
- package/dist/cdn/{PEQUHMTU.js → YLIWN2J2.js} +1 -1
- package/dist/cdn/{LSBUPU7F.js → YOBHTTO5.js} +1 -1
- package/dist/cdn/YPDXQEUA.js +77 -0
- package/dist/cdn/{BVG2SE55.js → YSQDSGSF.js} +1 -1
- package/dist/cdn/{BEKMMPB7.js → YUI2MSOK.js} +1 -1
- package/dist/cdn/{ONARC6AZ.js → YUWXPLTE.js} +1 -1
- package/dist/cdn/{D2EVPZ5K.js → YW2WMW6B.js} +1 -1
- package/dist/cdn/{QWNRGCQS.js → ZWASNOIQ.js} +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/assessBuildRequest.js +15 -16
- package/dist/chunks/assessUpdateRequest.js +6 -4
- package/dist/chunks/classifyIntent.js +31 -44
- package/dist/chunks/interfaces.js +47 -47
- package/dist/chunks/solution-builder-assistant.js +24 -13
- package/dist/chunks/updateDesign.js +1 -1
- package/dist/chunks/validators.js +4 -3
- package/dist/components/arcgis-solutions-assistant/customElement.js +1031 -792
- package/dist/components/solutions-all-panel/customElement.js +1 -1
- package/dist/components/solutions-all-shell/customElement.js +22 -32
- package/dist/components/solutions-deploy-app/customElement.js +9 -9
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/solutions-components_commit.txt +5 -5
- package/package.json +1 -1
- package/dist/cdn/26EKIZQ3.js +0 -2
- package/dist/cdn/3Z7EYDFO.js +0 -434
- package/dist/cdn/5EXKQXLZ.js +0 -2
- package/dist/cdn/7VD3Y4IF.js +0 -2
- package/dist/cdn/DKQRECGR.js +0 -2
- package/dist/cdn/FE7HMUSZ.js +0 -2
- package/dist/cdn/FFF5HUPM.js +0 -4
- package/dist/cdn/J6OVONBB.js +0 -2
- package/dist/cdn/JDI57IEI.js +0 -98
- package/dist/cdn/JJDAJ7CL.js +0 -2
- package/dist/cdn/LHLLMC6K.js +0 -2
- package/dist/cdn/NRQI7YO3.js +0 -90
- package/dist/cdn/O4VFFJLQ.js +0 -2
- package/dist/cdn/R4PQI4LJ.js +0 -2
- package/dist/cdn/TLY6ZEKN.js +0 -2
- package/dist/cdn/UBPCOTIY.js +0 -2
- package/dist/cdn/VHYS3SP3.js +0 -2
- package/dist/cdn/XA3SV62A.js +0 -2
- package/dist/cdn/YGWYD3LU.js +0 -3
- package/dist/cdn/ZI7OWB5M.js +0 -2
|
@@ -1,47 +1,48 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import { c as
|
|
3
|
-
import { u as
|
|
4
|
-
import { LitElement as
|
|
5
|
-
import { css as
|
|
6
|
-
import { unsafeHTML as
|
|
7
|
-
import { useContextConsumer as
|
|
8
|
-
import { c as
|
|
9
|
-
import { T as
|
|
10
|
-
import { m as
|
|
11
|
-
import
|
|
12
|
-
import { createRef as
|
|
13
|
-
import { Annotation as
|
|
14
|
-
import { createAgentRuntimeState as
|
|
15
|
-
import
|
|
16
|
-
import * as
|
|
17
|
-
import { applyPatch as
|
|
2
|
+
import { c as Ne } from "../../chunks/runtime.js";
|
|
3
|
+
import { u as Fe } from "../../chunks/useT9n.js";
|
|
4
|
+
import { LitElement as De, createEvent as ae, nothing as re } from "@arcgis/lumina";
|
|
5
|
+
import { css as Me, html as T } from "lit";
|
|
6
|
+
import { unsafeHTML as Re } from "lit/directives/unsafe-html.js";
|
|
7
|
+
import { useContextConsumer as le } from "@arcgis/lumina/context";
|
|
8
|
+
import { c as Be, b as Pe } from "../../chunks/deployAppContexts.js";
|
|
9
|
+
import { T as M } from "../../chunks/interfaces.js";
|
|
10
|
+
import { m as qe } from "../../chunks/helpers.js";
|
|
11
|
+
import G from "@arcgis/core/config.js";
|
|
12
|
+
import { createRef as Ue, ref as Oe } from "lit-html/directives/ref.js";
|
|
13
|
+
import { Annotation as x, StateGraph as K, START as W, END as A, NodeInterrupt as de } from "@langchain/langgraph/web";
|
|
14
|
+
import { createAgentRuntimeState as X, sendTraceMessage as _, invokeStructuredPrompt as k, getEmbeddings as ze, cosineSimilarity as je, invokeTextPrompt as Ge } from "@arcgis/ai-components/utils/index.js";
|
|
15
|
+
import l, { z as E } from "zod";
|
|
16
|
+
import * as Y from "@esri/arcgis-rest-portal";
|
|
17
|
+
import { applyPatch as He } from "fast-json-patch";
|
|
18
18
|
import "@langchain/core/messages";
|
|
19
|
-
import { C as
|
|
20
|
-
import { v as
|
|
21
|
-
import {
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
import { C as pe } from "../../chunks/converter.js";
|
|
20
|
+
import { v as H, b as J, S as Je, h as Ve, E as Qe, g as Ke } from "../../chunks/validators.js";
|
|
21
|
+
import { invokeStructuredPrompt as We } from "@arcgis/ai-orchestrator";
|
|
22
|
+
import { t as me, g as q, c as he, r as ge, d as F } from "../../chunks/templates.js";
|
|
23
|
+
import Xe from "@arcgis/core/portal/Portal.js";
|
|
24
|
+
import Ye from "@arcgis/core/portal/PortalItem.js";
|
|
25
|
+
const Ze = Me`:host{display:block;height:100%}.margin-lg{margin:var(--calcite-spacing-lg)}.display-flex-row{display:flex;flex-direction:row}.assistant-split-container{display:flex;width:100%;height:calc(100vh - 78px);overflow:hidden;border-radius:10px}.assistant-panel{display:flex;flex-direction:column;height:100%;border:1px solid var(--calcite-color-surface-3);background-color:var(--calcite-color-surface-2);overflow:hidden}.chat-panel{min-width:320px}.builder-panel{min-width:320px;max-width:100%;border-left:1px solid var(--calcite-color-surface-3)}.panel-actions{display:flex;gap:8px;padding:6px;align-items:center}.builder-header,.builder-footer{padding:10px;background:var(--calcite-color-surface-1);border-bottom:1px solid var(--calcite-color-surface-3)}.builder-content{flex:1;overflow:auto;padding:12px}.builder-content pre{white-space:pre-wrap;word-wrap:break-word;max-height:100%;overflow:auto}.builder-actions{display:flex;gap:6px;align-items:center}.padding-left-10{padding-left:10px}.chat-container{display:flex;flex-direction:column;gap:0px;max-width:600px;height:75%;background-color:var(--calcite-color-surface-4);padding:1px}.chat-container_expanded{display:flex;flex-direction:column;gap:0px;max-width:100%;height:95%;background-color:var(--calcite-color-surface-1);border-radius:10px;padding:10px}.chat-panel{--calcite-color-focus: var(--calcite-color-brand);--calcite-panel-border-color: var(--calcite-color-border-2);--calcite-internal-panel-header-vertical-padding: 0px;--calcite-panel-header-content-space: 0px;border:var(--calcite-border-width-sm) solid var(--calcite-color-border-2);height:100%}.header-content{display:flex;align-items:center;gap:var(--calcite-spacing-sm);height:65px;box-sizing:border-box;padding-inline-start:var(--calcite-space-2xl)}.header-title{font-size:var(--calcite-font-size-md);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-text-1)}.beta-chip{--calcite-chip-corner-radius: var(--calcite-corner-radius-half)}.chat-panel calcite-card,.chat-panel calcite-text-area,.chat-panel calcite-button,.chat-panel .chat-messages,.chat-panel .chat-input{--calcite-color-focus: var(--calcite-color-brand)}.assistant-followup-chip:focus{outline:2px solid var(--calcite-color-brand)}.chat-panel-heading{font-size:var(--calcite-font-size-0);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-surface-1, var(--calcite-color-text-1))}.chat-messages{display:flex;flex-direction:column;gap:20px;padding:4px;height:100%;overflow-y:auto}.user-message{align-self:flex-end;background:var(--calcite-color-brand);border-radius:8px;max-width:90%;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-brand);--calcite-card-border-color: var(--calcite-color-brand);color:var(--calcite-color-text-inverse);text-align:left}.system-message{align-self:flex-start;background:var(--calcite-color-surface-3);border-radius:8px;max-width:90%;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-surface-4);--calcite-card-border-color: var(--calcite-color-surface-4);color:var(--calcite-color-inverse);text-align:left}.loader-message{align-self:flex-start;background:var(--calcite-color-surface-4);border-radius:8px;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-surface-4);--calcite-card-border-color: var(--calcite-color-surface-4)}.message-content{padding:0;font-size:14px}.response-message.message-content>p:first-of-type{margin-top:0}.message-content img{max-width:100%;height:auto;display:block;object-fit:contain}.message-content-pad{padding-bottom:10px;font-size:14px}.message-content-summary{padding-bottom:14px}.message-content-alignment{display:flex;align-items:center;gap:var(--calcite-spacing-md);font-size:var(--calcite-font-size--1);color:var(--calcite-color-text-1)}.padding-top-10{padding-top:10px}.padding-right-8{padding-right:8px}.padding-left-right-5{padding-right:5px;padding-left:5px}.chip-content{padding:5px 5px 5px 0}.chat-input{display:flex;flex-direction:row;flex-grow:1}.table-cell{--calcite-table-cell-background: var(--calcite-color-surface-4)}.cursor-pointer{cursor:pointer}.notice-border-color{--temp-initial-brand: var(--calcite-color-brand)}.notice-border-color calcite-notice{--calcite-color-brand: #ddd;--calcite-icon-color: var(--temp-initial-brand)}.notice-border-color calcite-notice *{--calcite-color-brand: var(--temp-initial-brand)}.solution-card{padding:5px 0;text-decoration:none;display:block;width:100%;cursor:pointer}.solution-card calcite-card{display:flex;flex-direction:column;max-width:520px;overflow:hidden;--calcite-card-corner-radius: var(--calcite-corner-radius-round) !important;--calcite-card-shadow: var(--calcite-shadow-sm);--calcite-card-background-color: var(--calcite-card-background-color) }.solution-card div[slot=thumbnail]{max-height:100%;width:100%;position:relative;&:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;transition:all .15s ease-in-out}}.solution-card div[slot=thumbnail] img{max-height:100%;width:100%;object-fit:cover}.solution-card span[slot=description]{padding-top:10px}.solution-card calcite-chip{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);visibility:hidden;pointer-events:none;opacity:0;transition:all .15s ease-in-out;z-index:9999}.solution-card:hover calcite-chip{visibility:visible;opacity:1}.solution-card:hover div[slot=thumbnail]:after{background-color:#00000080}.solution-card:hover h3{text-decoration:underline}.solution-card:focus{outline:2px solid var(--calcite-color-brand)}.references-container{padding-top:10px;display:block}.references-container.collapsed{display:none}.width-100{width:100%}.disclaimer-div{display:flex;align-items:center;gap:var(--calcite-spacing-sm);font-size:var(--calcite-font-size--0);color:var(--calcite-color-text-1)}.display-none{display:none}.chat-messages calcite-fab{position:absolute;bottom:16px;left:50%;transform:translate(-50%);z-index:999}.icon-color-background{--calcite-button-icon-color: var(--calcite-color-surface-1)}#closeAssistantButton{--calcite-action-text-color: var(--calcite-color-text-1)}.icon-color-background:focus{--calcite-color-focus: var(--calcite-color-surface-1)}@media(max-width:430px){.solution-card .solution-snippet{display:none}}.height-32-flex-auto{height:32px;flex:0 0 auto}.margin-top-0.message-content>p:first-of-type{margin-top:0}a:not(.solution-card){color:var(--calcite-link-text-color, var(--calcite-color-text-link));cursor:pointer;text-decoration:none;line-height:inherit;background-image:linear-gradient(currentColor,currentColor),linear-gradient(var(--calcite-color-brand-underline),var(--calcite-color-brand-underline));background-position-x:0%,100%;background-position-y:min(1.5em,100%);background-repeat:no-repeat,no-repeat;background-size:0% 1px,100% 1px;transition-property:background-size,color;transition-duration:var(--calcite-animation-timing, .15s);transition-timing-function:ease-in-out;outline-color:transparent;position:relative}a:not(.solution-card):hover{background-size:100% 1px,100% 1px}a:not(.solution-card):focus{outline:2px solid var(--calcite-color-brand);outline-offset:2px;outline-color:var(--calcite-color-brand)}a:not(.solution-card):active{color:var(--calcite-color-brand-press)}`;
|
|
26
|
+
async function v(s, e) {
|
|
27
|
+
const t = Object.entries(s).find(
|
|
28
|
+
([n]) => n.endsWith(`/${e}.md`)
|
|
28
29
|
);
|
|
29
|
-
if (!
|
|
30
|
+
if (!t)
|
|
30
31
|
throw new Error(
|
|
31
32
|
`Prompt not found: ${e}
|
|
32
33
|
Available prompts:
|
|
33
|
-
${Object.keys(
|
|
34
|
+
${Object.keys(s).join(`
|
|
34
35
|
`)}`
|
|
35
36
|
);
|
|
36
|
-
return await
|
|
37
|
+
return await t[1]();
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
-
return
|
|
39
|
+
function U(s) {
|
|
40
|
+
return s?.configurable?.context?.translations;
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
-
if (typeof window > "u" ||
|
|
42
|
+
function fe(s) {
|
|
43
|
+
if (typeof window > "u" || s.length <= 1)
|
|
43
44
|
return;
|
|
44
|
-
const e =
|
|
45
|
+
const e = s.map((n) => n.solution.id), t = s.map((n) => n.solution.title);
|
|
45
46
|
window.dispatchEvent(new CustomEvent("searchTermSet", {
|
|
46
47
|
detail: {
|
|
47
48
|
scope: "all-solutions",
|
|
@@ -50,7 +51,7 @@ function me(t) {
|
|
|
50
51
|
})), window.dispatchEvent(new CustomEvent("solutionMatchesFromAssistant", {
|
|
51
52
|
detail: {
|
|
52
53
|
solutionIds: e,
|
|
53
|
-
solutionTitles:
|
|
54
|
+
solutionTitles: t
|
|
54
55
|
},
|
|
55
56
|
bubbles: !0,
|
|
56
57
|
composed: !0
|
|
@@ -60,137 +61,137 @@ function me(t) {
|
|
|
60
61
|
}
|
|
61
62
|
}));
|
|
62
63
|
}
|
|
63
|
-
function
|
|
64
|
-
if (typeof window > "u" || !
|
|
64
|
+
function ye(s) {
|
|
65
|
+
if (typeof window > "u" || !s)
|
|
65
66
|
return;
|
|
66
67
|
const e = new CustomEvent("solutionIDFromAssistant", {
|
|
67
|
-
detail:
|
|
68
|
+
detail: s,
|
|
68
69
|
bubbles: !0,
|
|
69
70
|
composed: !0
|
|
70
71
|
});
|
|
71
72
|
window.dispatchEvent(e);
|
|
72
73
|
}
|
|
73
|
-
const
|
|
74
|
-
needsContext:
|
|
75
|
-
rewrittenQuery:
|
|
76
|
-
}),
|
|
77
|
-
"./prompts/solutions_explorer_description.md": () => import("../../chunks/solutions_explorer_description.js").then((
|
|
78
|
-
"./prompts/transformQuery.md": () => import("../../chunks/transformQuery.js").then((
|
|
74
|
+
const et = E.object({
|
|
75
|
+
needsContext: E.boolean().describe("True when the explorer query requires added context from prior turns."),
|
|
76
|
+
rewrittenQuery: E.string().min(1).describe("The final query to send to doc AI. Keep original query if no context is needed.")
|
|
77
|
+
}), ce = (s) => s?.signal?.aborted ?? !1, be = /* @__PURE__ */ Object.assign({
|
|
78
|
+
"./prompts/solutions_explorer_description.md": () => import("../../chunks/solutions_explorer_description.js").then((s) => s.default),
|
|
79
|
+
"./prompts/transformQuery.md": () => import("../../chunks/transformQuery.js").then((s) => s.default)
|
|
79
80
|
});
|
|
80
|
-
function
|
|
81
|
-
return
|
|
81
|
+
function tt(s) {
|
|
82
|
+
return s.replace(/<sup>\[\[(\d+)\]\]\(([^)]+)\)<\/sup>/g, '<sup><a href="$2">[$1]</a></sup>');
|
|
82
83
|
}
|
|
83
|
-
function
|
|
84
|
-
return
|
|
84
|
+
function st(s) {
|
|
85
|
+
return s.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, (e, t, n) => `<img src="${n}" alt="${t}" style="width: 100%;">`);
|
|
85
86
|
}
|
|
86
|
-
function
|
|
87
|
-
const
|
|
88
|
-
return (e?.configurable?.context?.configContext.allCards ?? []).forEach((
|
|
89
|
-
const o =
|
|
87
|
+
function it(s, e) {
|
|
88
|
+
const t = [];
|
|
89
|
+
return (e?.configurable?.context?.configContext.allCards ?? []).forEach((i) => {
|
|
90
|
+
const o = i.title;
|
|
90
91
|
if (!o)
|
|
91
92
|
return;
|
|
92
93
|
const a = new RegExp(`(?<![\\p{L}\\p{N}])${o}(?![\\p{L}\\p{N}])`, "giu");
|
|
93
|
-
let
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
return /<img[^>]*alt\s*=\s*["'][^"']*$/i.test(
|
|
97
|
-
}),
|
|
94
|
+
let r = !1;
|
|
95
|
+
s = s.replace(a, (c, d, h) => {
|
|
96
|
+
const y = h.slice(0, d);
|
|
97
|
+
return /<img[^>]*alt\s*=\s*["'][^"']*$/i.test(y) ? c : (r = !0, `<a href="" target="solutionId:${i.deployCommonId}">${o}</a>`);
|
|
98
|
+
}), r && t.push({
|
|
98
99
|
solution: {
|
|
99
|
-
title:
|
|
100
|
-
id:
|
|
101
|
-
snippet:
|
|
102
|
-
description:
|
|
100
|
+
title: i.title,
|
|
101
|
+
id: i.deployCommonId,
|
|
102
|
+
snippet: i.snippet,
|
|
103
|
+
description: i.description
|
|
103
104
|
},
|
|
104
105
|
score: 100
|
|
105
106
|
});
|
|
106
|
-
}), { source:
|
|
107
|
+
}), { source: s, allMatches: t };
|
|
107
108
|
}
|
|
108
|
-
function
|
|
109
|
-
return
|
|
109
|
+
function nt(s) {
|
|
110
|
+
return s && s.helperServices.aiAssistantServices ? `${s.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/chat` : null;
|
|
110
111
|
}
|
|
111
|
-
function
|
|
112
|
-
return
|
|
112
|
+
function xe(s) {
|
|
113
|
+
return s && s.helperServices.aiAssistantServices ? `${s.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/api/pre-chat` : null;
|
|
113
114
|
}
|
|
114
|
-
async function
|
|
115
|
-
const
|
|
115
|
+
async function Q(s, e, t) {
|
|
116
|
+
const n = await fetch(e, {
|
|
116
117
|
method: "POST",
|
|
117
118
|
headers: {
|
|
118
119
|
"Content-Type": "application/json",
|
|
119
|
-
token:
|
|
120
|
+
token: t
|
|
120
121
|
},
|
|
121
|
-
body: JSON.stringify(
|
|
122
|
+
body: JSON.stringify(s)
|
|
122
123
|
});
|
|
123
|
-
if (!
|
|
124
|
-
throw new Error(`HTTP ${
|
|
125
|
-
return
|
|
124
|
+
if (!n.ok)
|
|
125
|
+
throw new Error(`HTTP ${n.status} calling ${e}`);
|
|
126
|
+
return n.json();
|
|
126
127
|
}
|
|
127
|
-
const
|
|
128
|
-
async function
|
|
129
|
-
const
|
|
130
|
-
if (!
|
|
131
|
-
return
|
|
128
|
+
const ot = (s) => new Promise((e) => setTimeout(e, s));
|
|
129
|
+
async function at(s, e) {
|
|
130
|
+
const t = s.agentExecutionContext.userRequest, n = e?.configurable?.context?.lastTurnAgent, i = s.agentExecutionContext.messages ?? [];
|
|
131
|
+
if (!n || i.length <= 1 || n === "explorer")
|
|
132
|
+
return t;
|
|
132
133
|
try {
|
|
133
|
-
const o = await v(
|
|
134
|
+
const o = await v(be, "transformQuery"), a = await k({
|
|
134
135
|
promptText: o,
|
|
135
136
|
modelTier: "fast",
|
|
136
137
|
temperature: 0,
|
|
137
|
-
schema:
|
|
138
|
-
messages:
|
|
139
|
-
inputVariables: { query:
|
|
138
|
+
schema: et,
|
|
139
|
+
messages: i.slice(-11),
|
|
140
|
+
inputVariables: { query: t, lastTurnAgent: n }
|
|
140
141
|
});
|
|
141
142
|
if (a.needsContext && a.rewrittenQuery.trim())
|
|
142
|
-
return console.debug(`Rephrased query from "${
|
|
143
|
+
return console.debug(`Rephrased query from "${t}" to "${a.rewrittenQuery.trim()}"`), a.rewrittenQuery.trim();
|
|
143
144
|
} catch {
|
|
144
145
|
}
|
|
145
|
-
return
|
|
146
|
+
return t;
|
|
146
147
|
}
|
|
147
|
-
const
|
|
148
|
+
const rt = x.Root({
|
|
148
149
|
// Provides agentExecutionContext, outputMessage, summary, and status
|
|
149
150
|
// channels with the orchestrator's standard reducers/defaults so the
|
|
150
151
|
// sub-agent reports back through the same shape the orchestrator
|
|
151
152
|
// persists into priorSteps.
|
|
152
|
-
...
|
|
153
|
-
solutionResponse:
|
|
154
|
-
reducer: (
|
|
153
|
+
...X(),
|
|
154
|
+
solutionResponse: x({
|
|
155
|
+
reducer: (s, e) => e ?? null,
|
|
155
156
|
default: () => null
|
|
156
157
|
}),
|
|
157
|
-
documentSkillUrl:
|
|
158
|
-
reducer: (
|
|
158
|
+
documentSkillUrl: x({
|
|
159
|
+
reducer: (s, e) => e ?? null,
|
|
159
160
|
default: () => null
|
|
160
161
|
}),
|
|
161
162
|
// Persisted across turns via the graph checkpointer so follow-up questions
|
|
162
163
|
// continue the same service conversation. Null on the very first interaction
|
|
163
164
|
// or after messages are cleared.
|
|
164
|
-
conversationId:
|
|
165
|
-
reducer: (
|
|
165
|
+
conversationId: x({
|
|
166
|
+
reducer: (s, e) => e ?? s,
|
|
166
167
|
default: () => null
|
|
167
168
|
})
|
|
168
|
-
}),
|
|
169
|
-
if (!
|
|
170
|
-
const
|
|
171
|
-
if (!
|
|
169
|
+
}), lt = () => new K(rt).addNode("initializeAgent", ut).addNode("askSolutionsQuestions", ct).addEdge(W, "initializeAgent").addEdge("initializeAgent", "askSolutionsQuestions").addEdge("askSolutionsQuestions", A), ve = async (s, e, t, n) => {
|
|
170
|
+
if (!s) return;
|
|
171
|
+
const i = xe(s);
|
|
172
|
+
if (!i) return;
|
|
172
173
|
const a = { context: {
|
|
173
174
|
kind: "DocAIAssistantRequest",
|
|
174
175
|
filters: {
|
|
175
176
|
products: "ArcGIS Solutions",
|
|
176
177
|
persona: { persona: "apps-solutions" },
|
|
177
178
|
pipeline: {
|
|
178
|
-
translation: { allow: !0, language:
|
|
179
|
+
translation: { allow: !0, language: t, use_llm: !1 }
|
|
179
180
|
}
|
|
180
181
|
}
|
|
181
182
|
} };
|
|
182
|
-
|
|
183
|
-
},
|
|
184
|
-
if (e
|
|
183
|
+
n && (a.conversationId = n), Q(a, i, e ?? "");
|
|
184
|
+
}, ct = async (s, e) => {
|
|
185
|
+
if (ce(e))
|
|
185
186
|
return {};
|
|
186
|
-
const
|
|
187
|
-
let
|
|
188
|
-
const o = await
|
|
189
|
-
await
|
|
190
|
-
{ text:
|
|
187
|
+
const t = U(e), n = s.documentSkillUrl;
|
|
188
|
+
let i = [];
|
|
189
|
+
const o = await at(s, e);
|
|
190
|
+
await _(
|
|
191
|
+
{ text: t.agentProgress.explorerAgentSearching },
|
|
191
192
|
e
|
|
192
193
|
);
|
|
193
|
-
let a = await
|
|
194
|
+
let a = await Q(
|
|
194
195
|
{
|
|
195
196
|
message: o,
|
|
196
197
|
conversationId: e?.configurable?.context?.convoId ?? void 0,
|
|
@@ -205,104 +206,124 @@ const st = y.Root({
|
|
|
205
206
|
}
|
|
206
207
|
}
|
|
207
208
|
},
|
|
208
|
-
|
|
209
|
+
n,
|
|
209
210
|
e?.configurable?.context?.token ?? ""
|
|
210
211
|
);
|
|
211
212
|
a.conversationId && e?.configurable?.context?.setConversationId && e.configurable.context.setConversationId(a.conversationId);
|
|
212
|
-
let
|
|
213
|
+
let r = {
|
|
213
214
|
message: a.message,
|
|
214
215
|
conversationId: a.conversationId,
|
|
215
216
|
hasMore: a.hasMore,
|
|
216
217
|
ackSequenceNumber: a.sequenceNumber,
|
|
217
218
|
inquiryId: a.inquiryId
|
|
218
|
-
},
|
|
219
|
-
const
|
|
220
|
-
const u =
|
|
219
|
+
}, c = "";
|
|
220
|
+
const d = async (y) => {
|
|
221
|
+
const u = y.context?.results?.[0]?.reply ?? "";
|
|
221
222
|
if (u !== "") {
|
|
222
|
-
const S =
|
|
223
|
-
|
|
224
|
-
...
|
|
225
|
-
...
|
|
226
|
-
(
|
|
223
|
+
const S = tt(u), N = st(S), C = it(N, e);
|
|
224
|
+
c = C.source, i = [
|
|
225
|
+
...i,
|
|
226
|
+
...C.allMatches.filter(
|
|
227
|
+
(z) => !i.some((I) => I.solution.id === z.solution.id)
|
|
227
228
|
)
|
|
228
229
|
];
|
|
229
230
|
}
|
|
230
|
-
const
|
|
231
|
-
if (
|
|
231
|
+
const g = y.context?.results?.[0]?.status?.currentStatusStep;
|
|
232
|
+
if (g) {
|
|
232
233
|
let S = "";
|
|
233
|
-
|
|
234
|
+
g === 1 ? S = t.agentProgress.explorerAgentReading : g === 2 ? S = t.agentProgress.explorerAgentReviewing : g === 3 && (S = t.agentProgress.explorerAgentPreparing), await _({ text: S }, e);
|
|
234
235
|
}
|
|
235
236
|
};
|
|
236
|
-
for (await
|
|
237
|
-
if (e
|
|
237
|
+
for (await d(a); r.hasMore; ) {
|
|
238
|
+
if (ce(e))
|
|
238
239
|
return {};
|
|
239
|
-
await
|
|
240
|
+
await ot(500), a = await Q(
|
|
240
241
|
{
|
|
241
|
-
conversationId:
|
|
242
|
-
ackSequenceNumber:
|
|
243
|
-
inquiryId:
|
|
242
|
+
conversationId: r.conversationId,
|
|
243
|
+
ackSequenceNumber: r.ackSequenceNumber,
|
|
244
|
+
inquiryId: r.inquiryId
|
|
244
245
|
},
|
|
245
|
-
|
|
246
|
+
n,
|
|
246
247
|
e?.configurable?.context?.token ?? ""
|
|
247
|
-
),
|
|
248
|
+
), r = {
|
|
248
249
|
message: a.message,
|
|
249
250
|
conversationId: a.conversationId,
|
|
250
251
|
hasMore: a.hasMore,
|
|
251
252
|
ackSequenceNumber: a.sequenceNumber,
|
|
252
253
|
inquiryId: a.inquiryId
|
|
253
|
-
}, await
|
|
254
|
+
}, await d(a);
|
|
254
255
|
}
|
|
255
|
-
return
|
|
256
|
+
return xe(e?.configurable?.context.portal) && ve(
|
|
256
257
|
e?.configurable?.context.portal,
|
|
257
258
|
e?.configurable?.context.token ?? "",
|
|
258
259
|
e?.configurable?.context.configContext.locale ?? "en",
|
|
259
|
-
|
|
260
|
-
),
|
|
261
|
-
outputMessage:
|
|
262
|
-
summary:
|
|
260
|
+
r.conversationId
|
|
261
|
+
), i.length && (i.length === 1 ? ye(i[0].solution.id) : fe(i)), {
|
|
262
|
+
outputMessage: c,
|
|
263
|
+
summary: c,
|
|
263
264
|
status: "success",
|
|
264
|
-
solutionResponse:
|
|
265
|
-
conversationId:
|
|
265
|
+
solutionResponse: r,
|
|
266
|
+
conversationId: r.conversationId
|
|
266
267
|
};
|
|
267
|
-
},
|
|
268
|
-
let
|
|
269
|
-
return
|
|
270
|
-
documentSkillUrl:
|
|
268
|
+
}, ut = async (s, e) => {
|
|
269
|
+
let t = null;
|
|
270
|
+
return s.documentSkillUrl === null && e?.configurable?.context?.portal && (t = nt(e.configurable.context.portal)), {
|
|
271
|
+
documentSkillUrl: t
|
|
271
272
|
};
|
|
272
273
|
};
|
|
273
|
-
await v(
|
|
274
|
-
const
|
|
275
|
-
if (
|
|
276
|
-
return
|
|
277
|
-
if (
|
|
274
|
+
await v(be, "solutions_explorer_description");
|
|
275
|
+
const we = (s) => {
|
|
276
|
+
if (s && Array.isArray(s.id) && s.id.length > 0)
|
|
277
|
+
return s.id[s.id.length - 1].replace("Message", "").toLowerCase();
|
|
278
|
+
if (s && typeof s._getType == "function")
|
|
278
279
|
try {
|
|
279
|
-
return
|
|
280
|
+
return s._getType();
|
|
280
281
|
} catch {
|
|
281
282
|
return "human";
|
|
282
283
|
}
|
|
283
284
|
return "human";
|
|
284
|
-
},
|
|
285
|
-
const e =
|
|
286
|
-
if (
|
|
285
|
+
}, dt = (s) => {
|
|
286
|
+
const e = we(s);
|
|
287
|
+
if (s && s.kwargs)
|
|
287
288
|
return {
|
|
288
289
|
role: e,
|
|
289
|
-
...
|
|
290
|
+
...s.kwargs
|
|
290
291
|
// Includes content, id, additional_kwargs, response_metadata, etc.
|
|
291
292
|
};
|
|
292
|
-
if (
|
|
293
|
-
const
|
|
293
|
+
if (s && typeof s == "object") {
|
|
294
|
+
const t = {
|
|
294
295
|
role: e,
|
|
295
|
-
content: typeof
|
|
296
|
+
content: typeof s.content == "string" ? s.content : String(s.content || "")
|
|
296
297
|
};
|
|
297
|
-
return
|
|
298
|
+
return s.id && (t.id = s.id), s.name && (t.name = s.name), s.additional_kwargs && (t.additional_kwargs = s.additional_kwargs), s.response_metadata && (t.response_metadata = s.response_metadata), t;
|
|
298
299
|
}
|
|
299
|
-
return { role: "human", content: String(
|
|
300
|
-
},
|
|
301
|
-
builderMessages:
|
|
300
|
+
return { role: "human", content: String(s) };
|
|
301
|
+
}, pt = (s) => we(s) === "human", mt = (s, e = 3) => s.filter((t) => pt(t)).slice(-e).map(dt), ht = (s, e = " ") => mt(s).map((i) => i.content).join(e).trim(), gt = { understandingRequest: "Understanding your request...", selectTemplatePrompt: "This use case could be supported in a few different ways. Choose the option that best matches what you want to accomplish.", searchingExistingSolutions: "Searching for existing solutions...", existingSolutionMatch: "I found one or more existing solutions that match your use case. These are ready-to-use solutions that may already meet your needs and can be deployed now. Do you want to continue building your own solution?", continueBuildingYes: "Yes, I want to build a new solution", continueBuildingNo: "No, I’ll review existing solutions", continueBuildingDeclined: "Sounds good. We can focus on existing solutions. Let me know if I can help answer any questions or provide more details.", creatingDesign: "Generating solution design...", updatingDesign: "Updating solution design...", applyChangeFailed: "I wasn't able to apply that change. The design was not modified. Please try rephrasing your request.", createDesignFailed: "I wasn't able to create a solution design from that request. Please try rephrasing and try again.", discardMessage: "Are you sure you want to discard your solution?", discardForNewSolution: "I can help you build a new solution, but I will need to discard your current solution design. Do you want to continue?" }, ft = {
|
|
302
|
+
builderMessages: gt
|
|
302
303
|
};
|
|
303
|
-
class
|
|
304
|
-
|
|
305
|
-
|
|
304
|
+
class b {
|
|
305
|
+
//--------------------------------------------------------------------------
|
|
306
|
+
//
|
|
307
|
+
// Public API
|
|
308
|
+
//
|
|
309
|
+
//--------------------------------------------------------------------------
|
|
310
|
+
constructor(e, t, n = !0) {
|
|
311
|
+
this.isValid = !0, this.issues = [], this.fieldNameRegistry = null, this.response = e, this.template = t, this.newDesign = n, this.validate();
|
|
312
|
+
}
|
|
313
|
+
static {
|
|
314
|
+
this.INVALID_NAME_CHARS = /[><~`$^+=|]/gu;
|
|
315
|
+
}
|
|
316
|
+
static {
|
|
317
|
+
this.NAME_MAX_LENGTH = 250;
|
|
318
|
+
}
|
|
319
|
+
static {
|
|
320
|
+
this.DESCRIPTION_MAX_LENGTH = 2048;
|
|
321
|
+
}
|
|
322
|
+
static {
|
|
323
|
+
this.SERVICE_NAME_MAX_LENGTH = 100;
|
|
324
|
+
}
|
|
325
|
+
static {
|
|
326
|
+
this.FIELD_NAME_MAX_LENGTH = 31;
|
|
306
327
|
}
|
|
307
328
|
/**
|
|
308
329
|
* Runs all validation checks on the response.
|
|
@@ -322,51 +343,153 @@ class ve {
|
|
|
322
343
|
validateResponse() {
|
|
323
344
|
this._validateSolutionProps(), this._validateItems(), this._validateFeatureLayer();
|
|
324
345
|
}
|
|
346
|
+
//--------------------------------------------------------------------------
|
|
347
|
+
//
|
|
348
|
+
// Compare
|
|
349
|
+
//
|
|
350
|
+
//--------------------------------------------------------------------------
|
|
325
351
|
/**
|
|
326
352
|
* Compares string keys and values between response and template.
|
|
353
|
+
*
|
|
354
|
+
* On new designs the response is reconciled against the template: missing
|
|
355
|
+
* keys are re-injected and empty values are restored from the template.
|
|
356
|
+
* Otherwise, issues are logged. Extra response keys are ignored — the
|
|
357
|
+
* downstream app discards them.
|
|
327
358
|
*/
|
|
328
359
|
_compareStrings() {
|
|
329
|
-
const e = new Set(this.
|
|
330
|
-
|
|
331
|
-
for (const i of this.response.solution.strings)
|
|
332
|
-
|
|
360
|
+
const e = new Set(this.response.solution.strings.map((i) => i.key)), t = new Map(this.template.solution.strings.map((i) => [i.key, i]));
|
|
361
|
+
[...t.keys()].every((i) => e.has(i)) || (this.newDesign ? this._reconcileStringKeys() : this._logIssue("String keys in llm response do not match the template."));
|
|
362
|
+
for (const i of this.response.solution.strings) {
|
|
363
|
+
if (i.value)
|
|
364
|
+
continue;
|
|
365
|
+
const o = t.get(i.key)?.value;
|
|
366
|
+
this.newDesign && o ? (i.value = o, this._logAutoFix(`String key '${i.key}' had no value. Auto-fixed by restoring the template value.`)) : this._logIssue(`String key '${i.key}' has no value in the design. It must be populated.`);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Re-adds template string keys missing from the response (new-design only),
|
|
371
|
+
* carrying over the template value and description.
|
|
372
|
+
*/
|
|
373
|
+
_reconcileStringKeys() {
|
|
374
|
+
const e = new Set(this.response.solution.strings.map((t) => t.key));
|
|
375
|
+
for (const t of this.template.solution.strings)
|
|
376
|
+
e.has(t.key) || (this.response.solution.strings.push({ ...t }), this._logAutoFix(`String key '${t.key}' was missing from the design. Auto-fixed by re-adding it from the template.`));
|
|
333
377
|
}
|
|
334
378
|
/**
|
|
335
379
|
* Compares item IDs between response and template.
|
|
380
|
+
*
|
|
381
|
+
* On new designs the response items are reconciled against the template:
|
|
382
|
+
* missing items are added and items not present in the template are removed.
|
|
383
|
+
* Otherwise, an issue is logged.
|
|
336
384
|
*/
|
|
337
385
|
_compareItems() {
|
|
338
|
-
const e = new Set(this.template.items.map((i) => i.id)),
|
|
339
|
-
e.size ===
|
|
386
|
+
const e = new Set(this.template.items.map((i) => i.id)), t = new Set(this.response.items.map((i) => i.id));
|
|
387
|
+
e.size === t.size && [...e].every((i) => t.has(i)) || (this.newDesign ? this._reconcileItems() : this._logIssue("Item IDs in design do not match the template."));
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Reconciles response items against the template (new-design only): removes
|
|
391
|
+
* response items not present in the template and adds missing template items.
|
|
392
|
+
*/
|
|
393
|
+
_reconcileItems() {
|
|
394
|
+
const e = new Set(this.template.items.map((i) => i.id)), t = new Set(this.response.items.map((i) => i.id)), n = [...t].filter((i) => !e.has(i));
|
|
395
|
+
n.length && (this.response.items = this.response.items.filter((i) => e.has(i.id)), this._logAutoFix(`Removed items not present in the template: ${n.join(", ")}.`));
|
|
396
|
+
for (const i of this.template.items)
|
|
397
|
+
t.has(i.id) || (this.response.items.push({ ...i }), this._logAutoFix(`Item '${i.id}' was missing from the design. Auto-fixed by adding it from the template.`));
|
|
340
398
|
}
|
|
341
399
|
/**
|
|
342
400
|
* Compares feature layer configuration between response and template.
|
|
343
401
|
*/
|
|
344
402
|
_compareFeatureLayers() {
|
|
345
|
-
const e = this.template.featureLayer,
|
|
346
|
-
if (e.itemId !==
|
|
347
|
-
|
|
348
|
-
|
|
403
|
+
const e = this.template.featureLayer, t = this.response.featureLayer;
|
|
404
|
+
if (e.itemId !== t.itemId) {
|
|
405
|
+
const n = t.itemId;
|
|
406
|
+
t.itemId = e.itemId, this._logAutoFix(`Feature Layer itemId '${n}' did not match the template. Auto-fixed to '${e.itemId}'.`);
|
|
349
407
|
}
|
|
350
408
|
if (!e.addLayers) {
|
|
351
|
-
const
|
|
352
|
-
if (!(
|
|
409
|
+
const n = new Set(e.layers.map((o) => o.id)), i = new Set(t.layers.map((o) => o.id));
|
|
410
|
+
if (!(n.size === i.size && [...n].every((o) => i.has(o))))
|
|
353
411
|
this._logIssue(`Feature Layer '${e.itemId}' had its layer ids altered.`);
|
|
354
412
|
else
|
|
355
|
-
for (const o of e.layers)
|
|
413
|
+
for (const o of e.layers) {
|
|
356
414
|
if (o.type) {
|
|
357
|
-
const
|
|
358
|
-
|
|
415
|
+
const r = t.layers.find((c) => c.id === o.id);
|
|
416
|
+
if (r && r.type !== o.type)
|
|
417
|
+
if (this.newDesign) {
|
|
418
|
+
const c = r.type;
|
|
419
|
+
r.type = o.type, this._logAutoFix(`Layer '${o.id}' type '${c}' is immutable. Auto-fixed back to template type '${o.type}'.`);
|
|
420
|
+
} else
|
|
421
|
+
this._logIssue(`Layer '${o.id}' type '${r.type}' does not match template type '${o.type}'. This layer type is immutable.`);
|
|
359
422
|
}
|
|
423
|
+
const a = t.layers.find((r) => r.id === o.id);
|
|
424
|
+
a && this._validateRequiredFields(a, o);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Validates required fields against the template. Required fields are matched by
|
|
430
|
+
* name. Users may change a required field's `alias` and `description`, but its
|
|
431
|
+
* `name`, `type`, `length`, and `choiceList` are immutable.
|
|
432
|
+
*
|
|
433
|
+
* On new designs, missing required fields are re-injected and tampered immutable
|
|
434
|
+
* properties are reverted to the template. Otherwise, issues are logged.
|
|
435
|
+
*/
|
|
436
|
+
_validateRequiredFields(e, t) {
|
|
437
|
+
const n = new Map(
|
|
438
|
+
e.requiredFields.map((i) => [i.name.toLowerCase(), i])
|
|
439
|
+
);
|
|
440
|
+
for (const i of t.requiredFields) {
|
|
441
|
+
const o = n.get(i.name.toLowerCase());
|
|
442
|
+
if (!o) {
|
|
443
|
+
this.newDesign ? (e.requiredFields.push({ ...i }), this._logAutoFix(`Layer '${e.name}' was missing required field '${i.name}'. Auto-fixed by re-adding it from the template.`)) : this._logIssue(`Layer '${e.name}' is missing required field '${i.name}'.`);
|
|
444
|
+
continue;
|
|
445
|
+
}
|
|
446
|
+
this._enforceRequiredFieldImmutability(e, o, i);
|
|
360
447
|
}
|
|
361
448
|
}
|
|
449
|
+
/**
|
|
450
|
+
* Enforces immutability of a required field's `type`, `length`, and `choiceList`
|
|
451
|
+
* (its `name` is the match key, so it is equal by construction). On new designs the
|
|
452
|
+
* properties are reverted to the template; otherwise an issue is logged.
|
|
453
|
+
*/
|
|
454
|
+
_enforceRequiredFieldImmutability(e, t, n) {
|
|
455
|
+
const i = [];
|
|
456
|
+
if (t.type !== n.type && i.push("type"), (t.length ?? null) !== (n.length ?? null) && i.push("length"), this._choiceListsEqual(t.choiceList, n.choiceList) || i.push("choiceList"), !i.length)
|
|
457
|
+
return;
|
|
458
|
+
const o = i.length === 1 ? "property" : "properties";
|
|
459
|
+
this.newDesign ? (t.type = n.type, t.length = n.length, t.choiceList = Array.isArray(n.choiceList) ? [...n.choiceList] : n.choiceList ?? null, this._logAutoFix(`Layer '${e.name}' required field '${n.name}' changed immutable ${o} (${i.join(", ")}). Auto-fixed by reverting to the template.`)) : this._logIssue(`Layer '${e.name}' required field '${n.name}' changed immutable ${o} (${i.join(", ")}). These cannot be modified.`);
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Set-based equality check for two choiceList values (order-insensitive),
|
|
463
|
+
* treating null/undefined/non-array as "no domain".
|
|
464
|
+
*/
|
|
465
|
+
_choiceListsEqual(e, t) {
|
|
466
|
+
const n = Array.isArray(e) ? e : null, i = Array.isArray(t) ? t : null;
|
|
467
|
+
if (n === null && i === null)
|
|
468
|
+
return !0;
|
|
469
|
+
if (n === null || i === null)
|
|
470
|
+
return !1;
|
|
471
|
+
const o = new Set(n), a = new Set(i);
|
|
472
|
+
return o.size === a.size && [...o].every((r) => a.has(r));
|
|
473
|
+
}
|
|
474
|
+
//--------------------------------------------------------------------------
|
|
475
|
+
//
|
|
476
|
+
// Validate
|
|
477
|
+
//
|
|
478
|
+
//--------------------------------------------------------------------------
|
|
362
479
|
/**
|
|
363
480
|
* Validates solution title and description.
|
|
364
481
|
*/
|
|
365
482
|
_validateSolutionProps() {
|
|
366
|
-
const e = this.response.solution.title,
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
483
|
+
const e = this.response.solution.title ?? "", t = this.response.solution.description, n = /[/\\]/u.test(e), i = this.newDesign ? e.replace(/[/\\]/gu, "") : e;
|
|
484
|
+
this.newDesign && i !== e ? (this.response.solution.title = i, this._logAutoFix("Solution title contained forward or back slashes. Auto-fixed by removing them.")) : !this.newDesign && n && this._logIssue("Solution title contains forbidden forward or back slashes.");
|
|
485
|
+
const o = H(i);
|
|
486
|
+
if (o.isValid || this._tryFixName(o.errorType, i, (a) => {
|
|
487
|
+
this.response.solution.title = a;
|
|
488
|
+
}, "Solution title", "Solution Title") || this._logIssue(`Solution title is invalid (${o.errorType}).`), t) {
|
|
489
|
+
const a = J(t, b.DESCRIPTION_MAX_LENGTH, !0);
|
|
490
|
+
a.isValid || this._tryFixDescription(t, (r) => {
|
|
491
|
+
this.response.solution.description = r;
|
|
492
|
+
}, "Solution description") || this._logIssue(`Solution description is invalid (${a.errorType}).`);
|
|
370
493
|
}
|
|
371
494
|
}
|
|
372
495
|
/**
|
|
@@ -377,12 +500,21 @@ class ve {
|
|
|
377
500
|
"Feature Layer (hosted)",
|
|
378
501
|
"Feature Layer (hosted, view)"
|
|
379
502
|
]);
|
|
380
|
-
for (const
|
|
381
|
-
e.has(
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
503
|
+
for (const t of this.response.items) {
|
|
504
|
+
if (e.has(t.type) && t.title.length > b.SERVICE_NAME_MAX_LENGTH)
|
|
505
|
+
if (this.newDesign) {
|
|
506
|
+
const i = t.title;
|
|
507
|
+
t.title = t.title.slice(0, b.SERVICE_NAME_MAX_LENGTH).trim(), this._logAutoFix(`Service name '${i}' exceeded ${b.SERVICE_NAME_MAX_LENGTH} characters. Auto-fixed to '${t.title}'.`);
|
|
508
|
+
} else
|
|
509
|
+
this._logIssue(`Service name '${t.title}' exceeds 100 characters.`);
|
|
510
|
+
const n = H(t.title ?? "");
|
|
511
|
+
if (n.isValid || this._tryFixName(n.errorType, t.title ?? "", (i) => {
|
|
512
|
+
t.title = i;
|
|
513
|
+
}, `Item '${t.id}' title`, "Item Title") || this._logIssue(`Item '${t.id}' title is invalid (${n.errorType}).`), t.description) {
|
|
514
|
+
const i = J(t.description, b.DESCRIPTION_MAX_LENGTH, !0);
|
|
515
|
+
i.isValid || this._tryFixDescription(t.description, (o) => {
|
|
516
|
+
t.description = o;
|
|
517
|
+
}, `Item '${t.id}' description`) || this._logIssue(`Item '${t.id}' description is invalid (${i.errorType}).`);
|
|
386
518
|
}
|
|
387
519
|
}
|
|
388
520
|
}
|
|
@@ -390,112 +522,134 @@ class ve {
|
|
|
390
522
|
* Validates feature layer structure and layers.
|
|
391
523
|
*/
|
|
392
524
|
_validateFeatureLayer() {
|
|
393
|
-
const e = this.template.featureLayer.layers;
|
|
394
525
|
this.response.featureLayer.layers.length || this._logIssue("Feature layer item must contain at least one layer.");
|
|
395
|
-
const
|
|
396
|
-
|
|
397
|
-
for (const
|
|
398
|
-
this._validateLayer(
|
|
399
|
-
const n = e.find((o) => o.id === i.id);
|
|
400
|
-
n && this._validateRequiredFields(i, n);
|
|
401
|
-
}
|
|
526
|
+
const e = this.response.featureLayer.layers.map((t) => t.name.toLowerCase());
|
|
527
|
+
e.length !== new Set(e).size && (this.newDesign ? this._dedupeLayerNames(this.response.featureLayer.layers) : this._logIssue(`Layer names must be unique (case-insensitive). Layer names in design: ${e}.`));
|
|
528
|
+
for (const t of this.response.featureLayer.layers)
|
|
529
|
+
this._validateLayer(t, this.response.featureLayer.addLayers);
|
|
402
530
|
}
|
|
403
531
|
/**
|
|
404
|
-
*
|
|
532
|
+
* Renames duplicate (case-insensitive) layer names by appending a numeric suffix.
|
|
405
533
|
*/
|
|
406
|
-
|
|
407
|
-
const
|
|
408
|
-
for (const n of
|
|
409
|
-
i
|
|
534
|
+
_dedupeLayerNames(e) {
|
|
535
|
+
const t = /* @__PURE__ */ new Set();
|
|
536
|
+
for (const n of e) {
|
|
537
|
+
const i = (n.name ?? "").toLowerCase();
|
|
538
|
+
if (t.has(i)) {
|
|
539
|
+
const o = n.name;
|
|
540
|
+
n.name = this._makeUniqueName(n.name ?? "Layer", t), this._logAutoFix(`Duplicate layer name '${o}'. Auto-fixed to '${n.name}'.`);
|
|
541
|
+
}
|
|
542
|
+
t.add(n.name.toLowerCase());
|
|
543
|
+
}
|
|
410
544
|
}
|
|
411
545
|
/**
|
|
412
546
|
* Validates a single layer configuration including name, description, and fields.
|
|
413
547
|
*/
|
|
414
|
-
_validateLayer(e,
|
|
415
|
-
!
|
|
548
|
+
_validateLayer(e, t) {
|
|
549
|
+
!t && e.typeMutable === !0 && e.type === "Table" && (this.newDesign ? (e.type = "Point", this._logAutoFix(`Layer '${e.name}' cannot be a Table. Auto-fixed to 'Point'.`)) : this._logIssue(
|
|
416
550
|
`Layer '${e.name}' cannot be a Table. It may be a Point, Line, or Polygon.`
|
|
417
|
-
);
|
|
418
|
-
const
|
|
419
|
-
if (
|
|
420
|
-
|
|
421
|
-
|
|
551
|
+
));
|
|
552
|
+
const n = H(e.name ?? "");
|
|
553
|
+
if (n.isValid || this._tryFixName(n.errorType, e.name ?? "", (i) => {
|
|
554
|
+
e.name = i;
|
|
555
|
+
}, `Layer '${e.name}' name`, "Layer Title") || this._logIssue(`Layer '${e.name}' name is invalid (${n.errorType}).`), e.description) {
|
|
556
|
+
const i = J(e.description, b.DESCRIPTION_MAX_LENGTH, !0);
|
|
557
|
+
i.isValid || this._tryFixDescription(e.description, (o) => {
|
|
558
|
+
e.description = o;
|
|
559
|
+
}, `Layer '${e.name}' description`) || this._logIssue(`Layer '${e.name}' description is invalid (${i.errorType}).`);
|
|
422
560
|
}
|
|
423
561
|
this._validateLayerFields(e);
|
|
424
562
|
}
|
|
425
563
|
/**
|
|
426
564
|
* Validates all fields in a layer including custom, required, and system fields.
|
|
565
|
+
*
|
|
566
|
+
* Each field is validated individually first, which (among other checks)
|
|
567
|
+
* resolves collisions with reserved system field names. A final pass then
|
|
568
|
+
* ensures custom field names do not collide (case-insensitively) with required
|
|
569
|
+
* field names or one another — auto-fixed via {@link _makeUniqueName} on new
|
|
570
|
+
* designs, otherwise logged.
|
|
427
571
|
*/
|
|
428
572
|
_validateLayerFields(e) {
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
"last_edited_user"
|
|
436
|
-
]), i = e.customFields.map((c) => c.name), n = new Set(e.requiredFields.map((c) => c.name)), o = [...new Set(
|
|
437
|
-
i.filter((c) => s.has(c))
|
|
438
|
-
)];
|
|
439
|
-
for (const c of o)
|
|
440
|
-
this._logIssue(`Layer '${e.name}' field '${c}' collides with a reserved system field name.`);
|
|
441
|
-
const a = [...new Set(
|
|
442
|
-
i.filter((c) => n.has(c))
|
|
443
|
-
)];
|
|
444
|
-
for (const c of a)
|
|
445
|
-
this._logIssue(`Layer '${e.name}' field '${c}' collides with a required field name.`);
|
|
446
|
-
if (!o.length && !a.length) {
|
|
447
|
-
const c = e.systemFields ?? [], m = [
|
|
448
|
-
...e.customFields,
|
|
449
|
-
...e.requiredFields,
|
|
450
|
-
...c
|
|
451
|
-
].map((h) => h.name);
|
|
452
|
-
m.length !== new Set(m).size && this._logIssue(`Layer '${e.name}' has duplicate fields: ${JSON.stringify(m)}.`);
|
|
453
|
-
}
|
|
454
|
-
const l = e.systemFields ?? [], d = [...e.customFields, ...e.requiredFields, ...l].map((c) => c.name.toLowerCase());
|
|
455
|
-
this.fieldNameRegistry = new Set(d);
|
|
456
|
-
for (const c of [...e.customFields, ...e.requiredFields])
|
|
457
|
-
this._validateField(c);
|
|
573
|
+
const t = e.systemFields ?? [];
|
|
574
|
+
this.fieldNameRegistry = new Set(
|
|
575
|
+
[...e.customFields, ...e.requiredFields, ...t].map((o) => o.name.toLowerCase())
|
|
576
|
+
);
|
|
577
|
+
for (const o of [...e.customFields, ...e.requiredFields])
|
|
578
|
+
this._validateField(o);
|
|
458
579
|
this.fieldNameRegistry = null;
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
for (; i.has(a.toLowerCase()); ) {
|
|
472
|
-
const d = `_${l}`, c = Math.max(1, 31 - d.length);
|
|
473
|
-
a = `${o.slice(0, c)}${d}`, l += 1;
|
|
580
|
+
const n = new Set(e.requiredFields.map((o) => o.name.toLowerCase())), i = new Set(n);
|
|
581
|
+
for (const o of e.customFields) {
|
|
582
|
+
const a = o.name.toLowerCase();
|
|
583
|
+
if (i.has(a)) {
|
|
584
|
+
const r = n.has(a) ? "a required field name" : "another field with the same name";
|
|
585
|
+
if (this.newDesign) {
|
|
586
|
+
const c = o.name;
|
|
587
|
+
o.name = this._makeUniqueName(o.name, i), this._logAutoFix(`Layer '${e.name}' field '${c}' collided with ${r}. Auto-fixed to '${o.name}'.`);
|
|
588
|
+
} else
|
|
589
|
+
this._logIssue(`Layer '${e.name}' field '${o.name}' collides with ${r}.`);
|
|
590
|
+
}
|
|
591
|
+
i.add(o.name.toLowerCase());
|
|
474
592
|
}
|
|
475
|
-
return i.add(a.toLowerCase()), a;
|
|
476
593
|
}
|
|
477
594
|
/**
|
|
478
595
|
* Validates a single field including name, type, length, and domain constraints.
|
|
479
596
|
*/
|
|
480
597
|
_validateField(e) {
|
|
481
|
-
const
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
598
|
+
const t = /^\p{L}/u, n = /^.[\p{L}\p{M}\p{N}_]*$/u;
|
|
599
|
+
e.alias || (this.newDesign ? (e.alias = e.name, this._logAutoFix(`Field '${e.name}' had no display name (alias). Auto-fixed to '${e.alias}'.`)) : this._logIssue(`Field '${e.name}' has no display name (alias).`));
|
|
600
|
+
const i = t.test(e.name), o = n.test(e.name);
|
|
601
|
+
if (!i || !o)
|
|
485
602
|
if (this.newDesign) {
|
|
486
|
-
const
|
|
487
|
-
e.name = this.
|
|
603
|
+
const a = e.name;
|
|
604
|
+
e.name = this._makeUniqueName(this._sanitizeFieldName(e.name), this.fieldNameRegistry), this.fieldNameRegistry.add(e.name.toLowerCase()), this._logAutoFix(`Field '${a}' had an invalid name. Auto-fixed to '${e.name}'.`);
|
|
488
605
|
} else
|
|
489
|
-
this._logIssue(`Field '${e.name}'
|
|
490
|
-
|
|
606
|
+
i || this._logIssue(`Field '${e.name}' does not start with a letter.`), o || this._logIssue(
|
|
607
|
+
`Field '${e.name}' contains invalid characters (only letters from any writing system, numbers, and underscores are allowed; emojis and punctuation are not allowed).`
|
|
608
|
+
);
|
|
609
|
+
if (e.name.length > b.FIELD_NAME_MAX_LENGTH)
|
|
610
|
+
if (this.newDesign) {
|
|
611
|
+
const a = e.name;
|
|
612
|
+
e.name = this._getUniqueTruncatedFieldName(e.name, this.fieldNameRegistry), this.fieldNameRegistry.add(e.name.toLowerCase()), this._logAutoFix(`Field '${a}' exceeds ${b.FIELD_NAME_MAX_LENGTH} characters. Auto-fixing to '${e.name}'.`);
|
|
613
|
+
} else
|
|
614
|
+
this._logIssue(`Field '${e.name}' exceeds ${b.FIELD_NAME_MAX_LENGTH} characters.`);
|
|
615
|
+
if (Je.has(e.name.toLowerCase()))
|
|
491
616
|
if (this.newDesign) {
|
|
492
|
-
const
|
|
493
|
-
e.name =
|
|
617
|
+
const a = e.name;
|
|
618
|
+
e.name = this._getUniqueTruncatedFieldName(a, this.fieldNameRegistry), this.fieldNameRegistry.add(e.name.toLowerCase()), this._logAutoFix(`Field '${a}' is a SQL reserved keyword. Auto-fixing to '${e.name}'.`);
|
|
494
619
|
} else
|
|
495
620
|
this._logIssue(`Field '${e.name}' is a SQL reserved keyword.`);
|
|
496
|
-
if (
|
|
497
|
-
|
|
498
|
-
|
|
621
|
+
if (Ve.has(e.name.toLowerCase()))
|
|
622
|
+
if (this.newDesign) {
|
|
623
|
+
const a = e.name;
|
|
624
|
+
e.name = this._getUniqueTruncatedFieldName(a, this.fieldNameRegistry), this.fieldNameRegistry.add(e.name.toLowerCase()), this._logAutoFix(`Field '${a}' is a reserved system field name. Auto-fixing to '${e.name}'.`);
|
|
625
|
+
} else
|
|
626
|
+
this._logIssue(`Field '${e.name}' is a reserved system field name.`);
|
|
627
|
+
if (Array.isArray(e.choiceList) && e.type !== "string" && (this.newDesign ? e.choiceList.length ? (e.type = "string", this._logAutoFix(`Field '${e.name}' had a domain but was not of type 'string'. Auto-fixed by setting the type to 'string'.`)) : (e.choiceList = null, this._logAutoFix(`Field '${e.name}' had an empty domain but is not of type 'string'. Auto-fixed by removing the domain.`)) : this._logIssue(`Field '${e.name}' must be of type 'string' to have a domain.`)), e.type === "string" && this._validateStringFieldLength(e), Array.isArray(e.choiceList) && (this.newDesign ? this._autoFixChoiceList(e) : this._logChoiceListIssues(e)), Array.isArray(e.choiceList) && e.length != null) {
|
|
628
|
+
const a = Math.max(...e.choiceList.map((r) => r.length));
|
|
629
|
+
a > e.length && (this.newDesign ? (this._logAutoFix(`The choice provided for field '${e.name}' is too long. It must fit within ${e.length} characters, but the choice requires ${a} characters. Auto-fixing to ${a}.`), e.length = a) : this._logIssue(`The choice provided for field '${e.name}' is too long. It must fit within ${e.length} characters, but the choice requires ${a} characters.`));
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* New-design behavior: removes blank and duplicate domain values, and drops an
|
|
634
|
+
* empty domain entirely.
|
|
635
|
+
*/
|
|
636
|
+
_autoFixChoiceList(e) {
|
|
637
|
+
let t = e.choiceList;
|
|
638
|
+
const n = t.filter((o) => o?.trim());
|
|
639
|
+
n.length !== t.length && (this._logAutoFix(`Field '${e.name}' had blank domain values. Auto-fixed by removing them.`), t = n, e.choiceList = t);
|
|
640
|
+
const i = [...new Set(t)];
|
|
641
|
+
i.length !== t.length && (this._logAutoFix(`Field '${e.name}' had duplicate domain values. Auto-fixed by removing duplicates.`), t = i, e.choiceList = t), t.length || (this._logAutoFix(`Field '${e.name}' had an empty domain. Auto-fixed by removing the domain.`), e.choiceList = null);
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Legacy behavior: logs domain (choiceList) content issues as validation issues.
|
|
645
|
+
*/
|
|
646
|
+
_logChoiceListIssues(e) {
|
|
647
|
+
if (Array.isArray(e.choiceList)) {
|
|
648
|
+
if (!e.choiceList.length) {
|
|
649
|
+
this._logIssue(`Field '${e.name}' has an empty domain. At least one value is required.`);
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
e.choiceList.some((t) => !t?.trim()) && this._logIssue(`A blank domain value was added to Field '${e.name}'.`), e.choiceList.length !== new Set(e.choiceList).size && this._logIssue(`Field '${e.name}' has duplicate domain values.`);
|
|
499
653
|
}
|
|
500
654
|
}
|
|
501
655
|
/**
|
|
@@ -507,17 +661,100 @@ class ve {
|
|
|
507
661
|
this._handleInvalidStringFieldLength(e, 256);
|
|
508
662
|
return;
|
|
509
663
|
}
|
|
510
|
-
const
|
|
511
|
-
if (!
|
|
512
|
-
const
|
|
513
|
-
this._handleInvalidStringFieldLength(e,
|
|
664
|
+
const t = e.length;
|
|
665
|
+
if (!Ke(t).isValid) {
|
|
666
|
+
const i = t > 4e3 ? 4e3 : 256;
|
|
667
|
+
this._handleInvalidStringFieldLength(e, i);
|
|
514
668
|
}
|
|
515
669
|
}
|
|
516
670
|
/**
|
|
517
671
|
* Applies an auto-fix to a string field's length on new designs, or logs an issue on update design.
|
|
518
672
|
*/
|
|
519
|
-
_handleInvalidStringFieldLength(e,
|
|
520
|
-
this.newDesign ? (
|
|
673
|
+
_handleInvalidStringFieldLength(e, t) {
|
|
674
|
+
this.newDesign ? (this._logAutoFix(`Field '${e.name}' has an invalid length. Auto-fixing to ${t}.`), e.length = t) : this._logIssue(`Field '${e.name}' length is invalid (must be a number between 1 and 4000).`);
|
|
675
|
+
}
|
|
676
|
+
//--------------------------------------------------------------------------
|
|
677
|
+
//
|
|
678
|
+
// Helpers / Utilities
|
|
679
|
+
//
|
|
680
|
+
//--------------------------------------------------------------------------
|
|
681
|
+
/**
|
|
682
|
+
* Returns a name not present (case-insensitively) in the taken set by appending
|
|
683
|
+
* a numeric suffix when needed.
|
|
684
|
+
*/
|
|
685
|
+
_makeUniqueName(e, t) {
|
|
686
|
+
let n = e, i = 1;
|
|
687
|
+
for (; t.has(n.toLowerCase()); )
|
|
688
|
+
n = `${e}_${i}`, i += 1;
|
|
689
|
+
return n;
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* Returns a field name truncated to the 31-character limit that does not collide
|
|
693
|
+
* (case-insensitively) with the supplied taken set, shortening the base and
|
|
694
|
+
* appending a numeric suffix as needed.
|
|
695
|
+
*/
|
|
696
|
+
_getUniqueTruncatedFieldName(e, t) {
|
|
697
|
+
const n = b.FIELD_NAME_MAX_LENGTH, i = e.slice(0, n);
|
|
698
|
+
let o = i, a = 1;
|
|
699
|
+
for (; t.has(o.toLowerCase()); ) {
|
|
700
|
+
const r = `_${a}`, c = Math.max(1, n - r.length);
|
|
701
|
+
o = `${i.slice(0, c)}${r}`, a += 1;
|
|
702
|
+
}
|
|
703
|
+
return o;
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* Sanitizes an item-style name by stripping emojis and disallowed characters,
|
|
707
|
+
* collapsing whitespace, trimming, and truncating to the name length limit.
|
|
708
|
+
* May return an empty string when no valid characters remain.
|
|
709
|
+
*/
|
|
710
|
+
_sanitizeItemName(e, t = b.NAME_MAX_LENGTH) {
|
|
711
|
+
let n = (e ?? "").replace(new RegExp(Qe.source, "gu"), "").replace(b.INVALID_NAME_CHARS, "").replace(/\s+/gu, " ").trim();
|
|
712
|
+
return n.length > t && (n = n.slice(0, t).trim()), n;
|
|
713
|
+
}
|
|
714
|
+
/**
|
|
715
|
+
* Sanitizes a description by stripping the disallowed `<` and `>` characters
|
|
716
|
+
* (forward slash is allowed) and truncating to the description length limit.
|
|
717
|
+
*/
|
|
718
|
+
_sanitizeDescription(e, t = b.DESCRIPTION_MAX_LENGTH) {
|
|
719
|
+
let n = (e ?? "").replace(/[<>]/gu, "");
|
|
720
|
+
return n.length > t && (n = n.slice(0, t)), n;
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Sanitizes a field name so it starts with a letter and contains only
|
|
724
|
+
* letters, combining marks, numbers, and underscores.
|
|
725
|
+
*/
|
|
726
|
+
_sanitizeFieldName(e) {
|
|
727
|
+
let t = (e ?? "").replace(/[^\p{L}\p{M}\p{N}_]/gu, "");
|
|
728
|
+
return t.length === 0 ? t = "field" : /^\p{L}/u.test(t) || (t = `f_${t}`), t;
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* Attempts to auto-fix an invalid item-style name on new designs. Empty values
|
|
732
|
+
* (or values that sanitize to empty) fall back to the supplied placeholder.
|
|
733
|
+
* Returns true when fixed.
|
|
734
|
+
*/
|
|
735
|
+
_tryFixName(e, t, n, i, o) {
|
|
736
|
+
if (!this.newDesign)
|
|
737
|
+
return !1;
|
|
738
|
+
if (e === "empty")
|
|
739
|
+
return n(o), this._logAutoFix(`${i} was empty. Auto-fixed to '${o}'.`), !0;
|
|
740
|
+
const r = this._sanitizeItemName(t) || o;
|
|
741
|
+
return n(r), this._logAutoFix(`${i} was invalid (${e}). Auto-fixed to '${r}'.`), !0;
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* Attempts to auto-fix an invalid description on new designs. Returns true when fixed.
|
|
745
|
+
*/
|
|
746
|
+
_tryFixDescription(e, t, n) {
|
|
747
|
+
if (!this.newDesign)
|
|
748
|
+
return !1;
|
|
749
|
+
const i = this._sanitizeDescription(e);
|
|
750
|
+
return t(i), this._logAutoFix(`${n} was invalid. Auto-fixed to a sanitized value.`), !0;
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* Records an auto-fix that was applied (new-design only). Auto-fixes are
|
|
754
|
+
* informational: they are logged but do NOT mark validation invalid.
|
|
755
|
+
*/
|
|
756
|
+
_logAutoFix(e) {
|
|
757
|
+
console.debug(e);
|
|
521
758
|
}
|
|
522
759
|
/**
|
|
523
760
|
* Records an issue and marks the validation as invalid.
|
|
@@ -526,15 +763,15 @@ class ve {
|
|
|
526
763
|
console.debug(e), this.issues.push(e), this.isValid = !1;
|
|
527
764
|
}
|
|
528
765
|
}
|
|
529
|
-
const
|
|
530
|
-
key:
|
|
531
|
-
value:
|
|
532
|
-
description:
|
|
533
|
-
}),
|
|
534
|
-
id:
|
|
535
|
-
title:
|
|
536
|
-
description:
|
|
537
|
-
type:
|
|
766
|
+
const yt = l.object({
|
|
767
|
+
key: l.string().describe("Stable key identifier for the string."),
|
|
768
|
+
value: l.string().describe("Display value for the string."),
|
|
769
|
+
description: l.string().describe("Explanation of where/how the string is used.")
|
|
770
|
+
}), bt = l.object({
|
|
771
|
+
id: l.string().describe("ArcGIS item id (32 hex characters)."),
|
|
772
|
+
title: l.string().describe("Item title."),
|
|
773
|
+
description: l.string().describe("Item description."),
|
|
774
|
+
type: l.enum([
|
|
538
775
|
"Feature Layer (hosted)",
|
|
539
776
|
"Feature Layer (hosted, view)",
|
|
540
777
|
"Web Map",
|
|
@@ -553,577 +790,577 @@ const pt = r.object({
|
|
|
553
790
|
"Notebook",
|
|
554
791
|
"QuickCapture Project"
|
|
555
792
|
]).describe("ArcGIS item type.")
|
|
556
|
-
}),
|
|
557
|
-
name:
|
|
558
|
-
type:
|
|
559
|
-
alias:
|
|
560
|
-
description:
|
|
561
|
-
choiceList:
|
|
793
|
+
}), ue = l.object({
|
|
794
|
+
name: l.string().describe("Field name."),
|
|
795
|
+
type: l.enum(["string", "integer", "double", "date", "oid", "guid", "globalid"]).describe("Field data type."),
|
|
796
|
+
alias: l.string().describe("Field alias for display."),
|
|
797
|
+
description: l.string().describe("Field description."),
|
|
798
|
+
choiceList: l.array(l.string()).nullable().describe(
|
|
562
799
|
"List of allowed values for string fields with a controlled vocabulary. Null if unrestricted or not applicable."
|
|
563
800
|
),
|
|
564
|
-
length:
|
|
565
|
-
}),
|
|
566
|
-
id:
|
|
567
|
-
type:
|
|
568
|
-
typeMutable:
|
|
569
|
-
name:
|
|
570
|
-
description:
|
|
571
|
-
customFields:
|
|
572
|
-
requiredFields:
|
|
573
|
-
}),
|
|
574
|
-
itemId:
|
|
575
|
-
addLayers:
|
|
576
|
-
layers:
|
|
577
|
-
}),
|
|
578
|
-
response:
|
|
579
|
-
solution:
|
|
580
|
-
itemId:
|
|
581
|
-
title:
|
|
582
|
-
description:
|
|
583
|
-
tags:
|
|
584
|
-
strings:
|
|
801
|
+
length: l.number().int().nullable().describe("Maximum string length for string fields. Null for non-string fields.")
|
|
802
|
+
}), xt = l.object({
|
|
803
|
+
id: l.number().int().describe("Layer/table id within the feature service."),
|
|
804
|
+
type: l.enum(["Point", "Polyline", "Polygon", "Table"]).describe("Layer type."),
|
|
805
|
+
typeMutable: l.boolean().describe("Indicates whether the layer type can be changed."),
|
|
806
|
+
name: l.string().describe("Layer/table name."),
|
|
807
|
+
description: l.string().describe("Layer/table description."),
|
|
808
|
+
customFields: l.array(ue).describe("User/business fields specific to the solution."),
|
|
809
|
+
requiredFields: l.array(ue).describe("Fields required for solution functionality (e.g., relationship keys).")
|
|
810
|
+
}), vt = l.object({
|
|
811
|
+
itemId: l.string().describe("ArcGIS item id for the feature layer."),
|
|
812
|
+
addLayers: l.boolean().describe("Indicates whether new layers can be added during solution design."),
|
|
813
|
+
layers: l.array(xt)
|
|
814
|
+
}), Z = l.object({
|
|
815
|
+
response: l.string().describe("Conversational response to the user's query."),
|
|
816
|
+
solution: l.object({
|
|
817
|
+
itemId: l.string().nullable().describe("ArcGIS item id of the source Solution template used for deployment. Preserve the existing value exactly when known; otherwise use null."),
|
|
818
|
+
title: l.string().describe("Title of the solution."),
|
|
819
|
+
description: l.string().describe("Description of the solution."),
|
|
820
|
+
tags: l.array(l.string()).describe("Keywords/tags associated with the solution."),
|
|
821
|
+
strings: l.array(yt).describe("Localized strings/labels used by apps (dashboards, forms, etc.).")
|
|
585
822
|
}),
|
|
586
|
-
items:
|
|
587
|
-
featureLayer:
|
|
588
|
-
}),
|
|
589
|
-
op:
|
|
590
|
-
path:
|
|
591
|
-
value:
|
|
592
|
-
from:
|
|
593
|
-
}),
|
|
594
|
-
response:
|
|
595
|
-
patches:
|
|
596
|
-
}),
|
|
597
|
-
response:
|
|
598
|
-
}),
|
|
599
|
-
assistantResponse:
|
|
600
|
-
isValidUpdate:
|
|
601
|
-
}),
|
|
602
|
-
matchedTitles:
|
|
603
|
-
}),
|
|
604
|
-
templateId:
|
|
605
|
-
confidence:
|
|
606
|
-
templateDescription:
|
|
607
|
-
}),
|
|
608
|
-
assistantResponse:
|
|
609
|
-
isValidUseCase:
|
|
610
|
-
matchedTemplates:
|
|
611
|
-
}),
|
|
612
|
-
`) : "No validation errors were provided.",
|
|
823
|
+
items: l.array(bt).describe("ArcGIS items that belong to the solution (apps, maps, layers, etc.)."),
|
|
824
|
+
featureLayer: vt.describe("Primary feature layer item and its schema/layers/tables details.")
|
|
825
|
+
}), wt = l.object({
|
|
826
|
+
op: l.enum(["add", "remove", "replace", "move", "copy"]).describe("RFC 6902 operation type."),
|
|
827
|
+
path: l.string().describe("RFC 6901 JSON Pointer to the target location."),
|
|
828
|
+
value: l.string().nullable().describe(`JSON-encoded value to apply (required for add and replace). Must be null — not an empty string — for remove, move, and copy operations. Serialize as a JSON string, e.g. '\\"text\\"' for a string, '[\\"a\\",\\"b\\"]' for an array, or '{\\"name\\":\\"x\\"}' for an object.`),
|
|
829
|
+
from: l.string().nullable().describe("RFC 6901 JSON Pointer to the source location (required for move and copy). Must be null — not an empty string — for all other operations.")
|
|
830
|
+
}), _t = l.object({
|
|
831
|
+
response: l.string().describe("Conversational response describing the accepted design changes."),
|
|
832
|
+
patches: l.array(wt).describe("Minimal RFC 6902 patch operations needed to update the current design.")
|
|
833
|
+
}), St = l.object({
|
|
834
|
+
response: l.string().describe("Short, user-friendly explanation of why the requested update was not applied.")
|
|
835
|
+
}), It = l.object({
|
|
836
|
+
assistantResponse: l.string().describe("Natural-language response for the user."),
|
|
837
|
+
isValidUpdate: l.boolean().describe("True only when the request is in scope for supported design updates.")
|
|
838
|
+
}), At = l.object({
|
|
839
|
+
matchedTitles: l.array(l.string()).describe("Titles of solutions that match the user's request. Empty array if no strong match.")
|
|
840
|
+
}), Ct = l.object({
|
|
841
|
+
templateId: l.string().min(1).describe("Template id from the available template list."),
|
|
842
|
+
confidence: l.number().min(0).max(1).describe("Confidence score from 0 to 1 for this template match."),
|
|
843
|
+
templateDescription: l.string().min(1).describe("Short action‑oriented description of the template in the user's use case/workflow, starting with a verb.")
|
|
844
|
+
}), Tt = l.object({
|
|
845
|
+
assistantResponse: l.string().nullable().describe("Natural-language response for the user."),
|
|
846
|
+
isValidUseCase: l.boolean().describe("True only when the request is concrete, appropriate, and has at least one matching template."),
|
|
847
|
+
matchedTemplates: l.array(Ct).describe("Ordered list of matching templates, best match first. Empty when no valid match exists.")
|
|
848
|
+
}), Et = (s) => s.length ? s.map((e, t) => `${t + 1}. ${e}`).join(`
|
|
849
|
+
`) : "No validation errors were provided.", Lt = async (s) => {
|
|
613
850
|
const {
|
|
614
851
|
query: e,
|
|
615
|
-
validationIssues:
|
|
616
|
-
recentMessages:
|
|
617
|
-
fallbackMessage:
|
|
852
|
+
validationIssues: t,
|
|
853
|
+
recentMessages: n,
|
|
854
|
+
fallbackMessage: i,
|
|
618
855
|
promptModules: o
|
|
619
|
-
} =
|
|
856
|
+
} = s;
|
|
620
857
|
try {
|
|
621
|
-
return (await
|
|
858
|
+
return (await We({
|
|
622
859
|
promptText: await v(o, "explainValidationFailure"),
|
|
623
860
|
modelTier: "fast",
|
|
624
861
|
temperature: 0,
|
|
625
|
-
schema:
|
|
626
|
-
messages:
|
|
862
|
+
schema: St,
|
|
863
|
+
messages: n,
|
|
627
864
|
inputVariables: {
|
|
628
865
|
query: e,
|
|
629
|
-
validationIssueCount: String(
|
|
630
|
-
validationIssues:
|
|
866
|
+
validationIssueCount: String(t.length),
|
|
867
|
+
validationIssues: Et(t)
|
|
631
868
|
}
|
|
632
|
-
})).response?.trim() ||
|
|
869
|
+
})).response?.trim() || i;
|
|
633
870
|
} catch (a) {
|
|
634
871
|
return console.warn(
|
|
635
872
|
"Natural language response failed:",
|
|
636
873
|
{ error: a }
|
|
637
|
-
),
|
|
638
|
-
}
|
|
639
|
-
},
|
|
640
|
-
let
|
|
641
|
-
const
|
|
642
|
-
"./prompts/assessBuildRequest.md": () => import("../../chunks/assessBuildRequest.js").then((
|
|
643
|
-
"./prompts/assessUpdateRequest.md": () => import("../../chunks/assessUpdateRequest.js").then((
|
|
644
|
-
"./prompts/description.md": () => import("../../chunks/description2.js").then((
|
|
645
|
-
"./prompts/designSolution.md": () => import("../../chunks/designSolution.js").then((
|
|
646
|
-
"./prompts/explainValidationFailure.md": () => import("../../chunks/explainValidationFailure.js").then((
|
|
647
|
-
"./prompts/findExistingSolution.md": () => import("../../chunks/findExistingSolution.js").then((
|
|
648
|
-
"./prompts/updateDesign.md": () => import("../../chunks/updateDesign.js").then((
|
|
649
|
-
}),
|
|
874
|
+
), i;
|
|
875
|
+
}
|
|
876
|
+
}, ee = (s) => s in F, $t = 5, kt = 0.8, Nt = 0.5, Ft = "Web Mapping Application", Dt = "Embeddings";
|
|
877
|
+
let R = null, V = null, B = null, P = null;
|
|
878
|
+
const Mt = "Build", L = /* @__PURE__ */ Object.assign({
|
|
879
|
+
"./prompts/assessBuildRequest.md": () => import("../../chunks/assessBuildRequest.js").then((s) => s.default),
|
|
880
|
+
"./prompts/assessUpdateRequest.md": () => import("../../chunks/assessUpdateRequest.js").then((s) => s.default),
|
|
881
|
+
"./prompts/description.md": () => import("../../chunks/description2.js").then((s) => s.default),
|
|
882
|
+
"./prompts/designSolution.md": () => import("../../chunks/designSolution.js").then((s) => s.default),
|
|
883
|
+
"./prompts/explainValidationFailure.md": () => import("../../chunks/explainValidationFailure.js").then((s) => s.default),
|
|
884
|
+
"./prompts/findExistingSolution.md": () => import("../../chunks/findExistingSolution.js").then((s) => s.default),
|
|
885
|
+
"./prompts/updateDesign.md": () => import("../../chunks/updateDesign.js").then((s) => s.default)
|
|
886
|
+
}), Rt = ft.builderMessages, m = (s) => s?.signal?.aborted ?? !1, f = (s, e, t) => U(e)?.builderMessages?.[s] ?? Rt[s], _e = (s) => {
|
|
650
887
|
typeof window < "u" && window.dispatchEvent(new CustomEvent("arcgis-solution-design-update", {
|
|
651
|
-
detail:
|
|
888
|
+
detail: s
|
|
652
889
|
}));
|
|
653
|
-
},
|
|
654
|
-
if (!
|
|
655
|
-
const
|
|
656
|
-
return (await
|
|
657
|
-
q:
|
|
890
|
+
}, Bt = async (s, e, t) => {
|
|
891
|
+
if (!s) return null;
|
|
892
|
+
const n = `type:"${Ft}" AND typekeywords:${Dt} AND group:${s}`;
|
|
893
|
+
return (await Y.searchItems({
|
|
894
|
+
q: n,
|
|
658
895
|
params: e ? { token: e } : void 0,
|
|
659
|
-
portal:
|
|
896
|
+
portal: t,
|
|
660
897
|
num: 1
|
|
661
898
|
}))?.results?.[0] ?? null;
|
|
662
899
|
};
|
|
663
|
-
async function
|
|
900
|
+
async function Pt(s, e, t, n) {
|
|
664
901
|
try {
|
|
665
|
-
const
|
|
666
|
-
if (!
|
|
902
|
+
const i = await Bt(s, e, t);
|
|
903
|
+
if (!i || m(n))
|
|
667
904
|
return null;
|
|
668
|
-
const o = new
|
|
669
|
-
return await o.load(),
|
|
905
|
+
const o = new Ye({ id: i.id });
|
|
906
|
+
return await o.load(), m(n) ? null : await o.fetchData("json");
|
|
670
907
|
} catch {
|
|
671
908
|
return null;
|
|
672
909
|
}
|
|
673
910
|
}
|
|
674
|
-
const
|
|
675
|
-
if (!
|
|
676
|
-
const
|
|
677
|
-
return (await
|
|
678
|
-
q:
|
|
911
|
+
const qt = async (s, e, t) => {
|
|
912
|
+
if (!s) return [];
|
|
913
|
+
const n = `type:Solution AND typekeywords:${Mt} AND group:${s}`;
|
|
914
|
+
return (await Y.searchItems({
|
|
915
|
+
q: n,
|
|
679
916
|
params: e ? { token: e } : void 0,
|
|
680
|
-
portal:
|
|
917
|
+
portal: t,
|
|
681
918
|
num: 100
|
|
682
919
|
}))?.results ?? [];
|
|
683
|
-
},
|
|
920
|
+
}, Ut = async (s, e, t) => {
|
|
684
921
|
try {
|
|
685
|
-
const
|
|
922
|
+
const n = await Y.getItemData(s, {
|
|
686
923
|
params: e ? { token: e } : void 0,
|
|
687
|
-
portal:
|
|
688
|
-
}),
|
|
689
|
-
if (!
|
|
690
|
-
const o =
|
|
691
|
-
return { buildSolution:
|
|
924
|
+
portal: t
|
|
925
|
+
}), i = n?.buildSolution;
|
|
926
|
+
if (!i) return null;
|
|
927
|
+
const o = n?.params, a = o && typeof o == "object" && !Array.isArray(o) ? o : null;
|
|
928
|
+
return { buildSolution: i, params: a };
|
|
692
929
|
} catch {
|
|
693
930
|
return null;
|
|
694
931
|
}
|
|
695
|
-
},
|
|
696
|
-
let
|
|
697
|
-
return "itemId" in e && (
|
|
698
|
-
...
|
|
932
|
+
}, $ = (s, e = {}) => {
|
|
933
|
+
let t = s;
|
|
934
|
+
return "itemId" in e && (t = {
|
|
935
|
+
...t,
|
|
699
936
|
solution: {
|
|
700
|
-
...
|
|
937
|
+
...t.solution,
|
|
701
938
|
itemId: e.itemId ?? null
|
|
702
939
|
}
|
|
703
|
-
}), e.sourceBuildSolution != null && (
|
|
704
|
-
...
|
|
940
|
+
}), e.sourceBuildSolution != null && (t = {
|
|
941
|
+
...t,
|
|
705
942
|
sourceBuildSolution: e.sourceBuildSolution
|
|
706
|
-
}), "params" in e && (
|
|
707
|
-
...
|
|
943
|
+
}), "params" in e && (t = {
|
|
944
|
+
...t,
|
|
708
945
|
params: e.params ?? null
|
|
709
|
-
}), "templateId" in e && (
|
|
710
|
-
...
|
|
946
|
+
}), "templateId" in e && (t = {
|
|
947
|
+
...t,
|
|
711
948
|
templateId: e.templateId ?? null
|
|
712
|
-
}),
|
|
713
|
-
},
|
|
714
|
-
if (
|
|
949
|
+
}), t;
|
|
950
|
+
}, Se = (s, e) => {
|
|
951
|
+
if (s == null || e == null)
|
|
715
952
|
return { ok: !1, error: "design or sourceBuildSolution is null/undefined" };
|
|
716
953
|
try {
|
|
717
|
-
const
|
|
718
|
-
return new
|
|
719
|
-
} catch (
|
|
954
|
+
const t = structuredClone(e);
|
|
955
|
+
return new pe({ buildSolution: t }).applyLlmTemplate(s), { ok: !0 };
|
|
956
|
+
} catch (t) {
|
|
720
957
|
return {
|
|
721
958
|
ok: !1,
|
|
722
|
-
error:
|
|
959
|
+
error: t instanceof Error ? t.stack ?? t.message : String(t)
|
|
723
960
|
};
|
|
724
961
|
}
|
|
725
|
-
},
|
|
726
|
-
if (
|
|
727
|
-
Object.entries(
|
|
728
|
-
F[a] && (F[a].initialTemplate =
|
|
962
|
+
}, te = async (s) => {
|
|
963
|
+
if (V) {
|
|
964
|
+
Object.entries(V).forEach(([a, r]) => {
|
|
965
|
+
F[a] && (F[a].initialTemplate = r);
|
|
729
966
|
});
|
|
730
967
|
return;
|
|
731
968
|
}
|
|
732
|
-
const e =
|
|
733
|
-
if (!
|
|
969
|
+
const e = s?.configurable?.context?.token, t = Ae(s), n = Ce(s);
|
|
970
|
+
if (!t) {
|
|
734
971
|
console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping live template hydration.");
|
|
735
972
|
return;
|
|
736
973
|
}
|
|
737
|
-
const
|
|
738
|
-
|
|
739
|
-
const
|
|
740
|
-
if (!
|
|
741
|
-
const
|
|
742
|
-
if (typeof
|
|
743
|
-
const
|
|
744
|
-
if (!
|
|
974
|
+
const i = await qt(t, e, n), o = {};
|
|
975
|
+
m(s) || (await Promise.all(i.map(async (a) => {
|
|
976
|
+
const r = a.properties?.templateInfo;
|
|
977
|
+
if (!r || typeof r != "object") return;
|
|
978
|
+
const c = r.id;
|
|
979
|
+
if (typeof c != "string" || o[c]) return;
|
|
980
|
+
const d = await Ut(a.id, e, n);
|
|
981
|
+
if (!d || m(s))
|
|
745
982
|
return;
|
|
746
|
-
const { buildSolution:
|
|
747
|
-
if (typeof
|
|
748
|
-
const
|
|
749
|
-
|
|
983
|
+
const { buildSolution: h, params: y } = d;
|
|
984
|
+
if (typeof h == "object" && h !== null && "solution" in h) {
|
|
985
|
+
const g = h.solution;
|
|
986
|
+
g.thumbnailUrl = a.thumbnail ? `${n ?? "https://www.arcgis.com/sharing/rest"}/content/items/${a.id}/info/${a.thumbnail}` : void 0, g.item = a;
|
|
750
987
|
}
|
|
751
988
|
const u = {
|
|
752
|
-
...
|
|
753
|
-
buildSolution:
|
|
989
|
+
...r,
|
|
990
|
+
buildSolution: h
|
|
754
991
|
};
|
|
755
|
-
o[
|
|
756
|
-
new
|
|
992
|
+
o[c] = $(
|
|
993
|
+
new pe(u).dumpToLlmTemplate(),
|
|
757
994
|
{
|
|
758
995
|
itemId: a.id,
|
|
759
|
-
sourceBuildSolution: structuredClone(
|
|
760
|
-
params:
|
|
996
|
+
sourceBuildSolution: structuredClone(h),
|
|
997
|
+
params: y ? structuredClone(y) : null
|
|
761
998
|
}
|
|
762
|
-
), F[
|
|
763
|
-
...
|
|
764
|
-
initialTemplate: o[
|
|
999
|
+
), F[c] = {
|
|
1000
|
+
...r,
|
|
1001
|
+
initialTemplate: o[c]
|
|
765
1002
|
};
|
|
766
|
-
})),
|
|
767
|
-
},
|
|
768
|
-
const e =
|
|
1003
|
+
})), V = o);
|
|
1004
|
+
}, Ie = (s) => {
|
|
1005
|
+
const e = s?.configurable?.context?.token;
|
|
769
1006
|
return typeof e != "string" || !e.trim() ? null : e;
|
|
770
|
-
},
|
|
771
|
-
const e =
|
|
1007
|
+
}, Ae = (s) => {
|
|
1008
|
+
const e = s?.configurable?.context?.configContext?.primarySolutionsGroupId;
|
|
772
1009
|
return typeof e != "string" || !e.trim() ? null : e;
|
|
773
|
-
},
|
|
774
|
-
const e =
|
|
1010
|
+
}, Ce = (s) => {
|
|
1011
|
+
const e = s?.configurable?.context?.configContext?.portalURL;
|
|
775
1012
|
if (!(typeof e != "string" || !e.trim()))
|
|
776
1013
|
return `${e.replace(/\/+$/, "")}/sharing/rest`;
|
|
777
|
-
},
|
|
1014
|
+
}, Ot = async (s) => {
|
|
778
1015
|
await Promise.all([
|
|
779
|
-
|
|
780
|
-
|
|
1016
|
+
Ee(s),
|
|
1017
|
+
te(s)
|
|
781
1018
|
]);
|
|
782
|
-
},
|
|
783
|
-
const e =
|
|
784
|
-
(!
|
|
785
|
-
throw
|
|
786
|
-
})), await
|
|
1019
|
+
}, Te = async (s) => {
|
|
1020
|
+
const e = Ie(s);
|
|
1021
|
+
(!B || e && e !== P) && (P = e ?? P, B = Ot(s).catch((n) => {
|
|
1022
|
+
throw B = null, P = null, n;
|
|
1023
|
+
})), await B;
|
|
787
1024
|
};
|
|
788
|
-
async function
|
|
789
|
-
if (
|
|
790
|
-
const e =
|
|
1025
|
+
async function Ee(s) {
|
|
1026
|
+
if (R) return R;
|
|
1027
|
+
const e = Ae(s);
|
|
791
1028
|
if (!e)
|
|
792
1029
|
return console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping embeddings load."), null;
|
|
793
|
-
const
|
|
794
|
-
if (await new
|
|
1030
|
+
const t = Ce(s), n = s?.configurable?.context?.configContext?.portalURL;
|
|
1031
|
+
if (await new Xe(n ? { url: n } : void 0).load(), m(s))
|
|
795
1032
|
return null;
|
|
796
|
-
const o =
|
|
797
|
-
return
|
|
1033
|
+
const o = Ie(s) ?? void 0, a = await Pt(e, o, t, s);
|
|
1034
|
+
return m(s) ? null : a ? (R = a.items, R) : null;
|
|
798
1035
|
}
|
|
799
|
-
const
|
|
1036
|
+
const zt = () => Object.entries(F).map(([s, e]) => `ID: ${s}
|
|
800
1037
|
Label: ${e.label}
|
|
801
1038
|
Description: ${e.description}`).join(`
|
|
802
1039
|
|
|
803
|
-
`),
|
|
804
|
-
const e =
|
|
1040
|
+
`), jt = (s) => {
|
|
1041
|
+
const e = s?.configurable?.context?.solutionDesignJson;
|
|
805
1042
|
if (typeof e != "string" || !e.trim())
|
|
806
1043
|
return null;
|
|
807
1044
|
try {
|
|
808
|
-
const
|
|
809
|
-
{ response: "", ...
|
|
810
|
-
{ itemId:
|
|
811
|
-
),
|
|
812
|
-
if (!
|
|
1045
|
+
const t = JSON.parse(e), n = $(
|
|
1046
|
+
{ response: "", ...t },
|
|
1047
|
+
{ itemId: t?.solution?.itemId ?? null }
|
|
1048
|
+
), i = Z.safeParse(n);
|
|
1049
|
+
if (!i.success)
|
|
813
1050
|
return null;
|
|
814
|
-
const { response: o, ...a } =
|
|
815
|
-
return
|
|
1051
|
+
const { response: o, ...a } = i.data, r = t.templateId, c = typeof r == "string" && ee(r) ? r : null;
|
|
1052
|
+
return $(
|
|
816
1053
|
a,
|
|
817
1054
|
{
|
|
818
|
-
sourceBuildSolution:
|
|
819
|
-
templateId:
|
|
820
|
-
params:
|
|
1055
|
+
sourceBuildSolution: t.sourceBuildSolution,
|
|
1056
|
+
templateId: c,
|
|
1057
|
+
params: t.params ?? null
|
|
821
1058
|
}
|
|
822
1059
|
);
|
|
823
1060
|
} catch {
|
|
824
1061
|
return null;
|
|
825
1062
|
}
|
|
826
|
-
},
|
|
827
|
-
...
|
|
1063
|
+
}, Gt = x.Root({
|
|
1064
|
+
...X(),
|
|
828
1065
|
/** Optional human-readable template description retained for UI use. */
|
|
829
|
-
templateDescription:
|
|
830
|
-
reducer: (
|
|
1066
|
+
templateDescription: x({
|
|
1067
|
+
reducer: (s, e) => typeof e == "string" || e === null ? e : s ?? null,
|
|
831
1068
|
default: () => null
|
|
832
1069
|
}),
|
|
833
1070
|
/** Current editable design payload being refined across turns. */
|
|
834
|
-
currentDesign:
|
|
835
|
-
reducer: (
|
|
1071
|
+
currentDesign: x({
|
|
1072
|
+
reducer: (s = null, e) => e === void 0 ? s : e ?? null,
|
|
836
1073
|
default: () => null
|
|
837
1074
|
}),
|
|
838
1075
|
/** Initial request assessment produced by the intake prompt. */
|
|
839
|
-
assessment:
|
|
840
|
-
reducer: (
|
|
1076
|
+
assessment: x({
|
|
1077
|
+
reducer: (s = null, e) => e === void 0 ? s : e ?? null,
|
|
841
1078
|
default: () => null
|
|
842
1079
|
}),
|
|
843
1080
|
/** Template selected automatically or by human-in-the-loop choice. */
|
|
844
|
-
selectedTemplate:
|
|
845
|
-
reducer: (
|
|
1081
|
+
selectedTemplate: x({
|
|
1082
|
+
reducer: (s = null, e) => e === void 0 ? s : e ?? null,
|
|
846
1083
|
default: () => null
|
|
847
1084
|
}),
|
|
848
1085
|
/** Update request assessment produced when an active design exists. */
|
|
849
|
-
updateAssessment:
|
|
850
|
-
reducer: (
|
|
1086
|
+
updateAssessment: x({
|
|
1087
|
+
reducer: (s = null, e) => e === void 0 ? s : e ?? null,
|
|
851
1088
|
default: () => null
|
|
852
1089
|
}),
|
|
853
1090
|
/** Existing solution matches surfaced before building a new solution. */
|
|
854
|
-
existingMatches:
|
|
855
|
-
reducer: (
|
|
1091
|
+
existingMatches: x({
|
|
1092
|
+
reducer: (s = [], e) => e === void 0 ? s : e ?? [],
|
|
856
1093
|
default: () => []
|
|
857
1094
|
}),
|
|
858
1095
|
/** User decision for whether to continue building after existing matches are shown. */
|
|
859
|
-
continueBuilding:
|
|
860
|
-
reducer: (
|
|
1096
|
+
continueBuilding: x({
|
|
1097
|
+
reducer: (s = null, e) => e === void 0 ? s : e ?? null,
|
|
861
1098
|
default: () => null
|
|
862
1099
|
})
|
|
863
|
-
}),
|
|
864
|
-
if (
|
|
1100
|
+
}), Ht = (s, e) => {
|
|
1101
|
+
if (m(e))
|
|
865
1102
|
return {};
|
|
866
|
-
const
|
|
867
|
-
return JSON.stringify(
|
|
868
|
-
},
|
|
869
|
-
if (
|
|
1103
|
+
const t = jt(e), n = t?.templateId ?? null, i = {};
|
|
1104
|
+
return JSON.stringify(s.currentDesign) !== JSON.stringify(t) && (i.currentDesign = t), n && s.selectedTemplate !== n && (i.selectedTemplate = n), i;
|
|
1105
|
+
}, Jt = async (s, e) => {
|
|
1106
|
+
if (m(e))
|
|
870
1107
|
return {};
|
|
871
|
-
await
|
|
872
|
-
const
|
|
873
|
-
promptText: await v(
|
|
1108
|
+
await _({ text: f("understandingRequest", e) }, e), await Te(e);
|
|
1109
|
+
const t = s.agentExecutionContext.userRequest, n = zt(), i = s.agentExecutionContext.messages.slice(-11), o = await k({
|
|
1110
|
+
promptText: await v(L, "assessBuildRequest"),
|
|
874
1111
|
modelTier: "advanced",
|
|
875
1112
|
temperature: 0,
|
|
876
|
-
schema:
|
|
877
|
-
messages:
|
|
878
|
-
inputVariables: { query:
|
|
1113
|
+
schema: Tt,
|
|
1114
|
+
messages: i,
|
|
1115
|
+
inputVariables: { query: t, availableTemplates: n }
|
|
879
1116
|
}), a = o.matchedTemplates.filter(
|
|
880
|
-
(u) =>
|
|
881
|
-
),
|
|
1117
|
+
(u) => ee(u.templateId)
|
|
1118
|
+
), r = {
|
|
882
1119
|
...o,
|
|
883
1120
|
matchedTemplates: a
|
|
884
|
-
}, [
|
|
1121
|
+
}, [c, d] = a, y = !!c && c.confidence >= kt && (d === void 0 || c.confidence - d.confidence >= Nt) ? c.templateId : null;
|
|
885
1122
|
return {
|
|
886
|
-
assessment:
|
|
887
|
-
selectedTemplate:
|
|
1123
|
+
assessment: r,
|
|
1124
|
+
selectedTemplate: y,
|
|
888
1125
|
existingMatches: [],
|
|
889
1126
|
continueBuilding: null
|
|
890
1127
|
};
|
|
891
|
-
},
|
|
892
|
-
const e =
|
|
1128
|
+
}, Vt = (s) => {
|
|
1129
|
+
const e = s.assessment?.assistantResponse ?? "";
|
|
893
1130
|
return {
|
|
894
1131
|
outputMessage: e,
|
|
895
1132
|
summary: e,
|
|
896
1133
|
status: "success"
|
|
897
1134
|
};
|
|
898
|
-
},
|
|
899
|
-
if (
|
|
1135
|
+
}, Qt = async (s, e) => {
|
|
1136
|
+
if (m(e))
|
|
900
1137
|
return {};
|
|
901
|
-
const { currentDesign:
|
|
902
|
-
if (!
|
|
1138
|
+
const { currentDesign: t } = s;
|
|
1139
|
+
if (!t)
|
|
903
1140
|
return {
|
|
904
1141
|
updateAssessment: {
|
|
905
1142
|
assistantResponse: "",
|
|
906
1143
|
isValidUpdate: !0
|
|
907
1144
|
}
|
|
908
1145
|
};
|
|
909
|
-
await
|
|
910
|
-
const
|
|
1146
|
+
await _({ text: f("understandingRequest", e) }, e);
|
|
1147
|
+
const n = s.agentExecutionContext.userRequest, i = s.agentExecutionContext.messages.slice(-11);
|
|
911
1148
|
return {
|
|
912
|
-
updateAssessment: await
|
|
913
|
-
promptText: await v(
|
|
1149
|
+
updateAssessment: await k({
|
|
1150
|
+
promptText: await v(L, "assessUpdateRequest"),
|
|
914
1151
|
modelTier: "advanced",
|
|
915
1152
|
temperature: 0,
|
|
916
|
-
schema:
|
|
917
|
-
messages:
|
|
1153
|
+
schema: It,
|
|
1154
|
+
messages: i,
|
|
918
1155
|
inputVariables: {
|
|
919
|
-
currentDesign: JSON.stringify(
|
|
920
|
-
query:
|
|
1156
|
+
currentDesign: JSON.stringify(me(t)),
|
|
1157
|
+
query: n
|
|
921
1158
|
}
|
|
922
1159
|
})
|
|
923
1160
|
};
|
|
924
|
-
},
|
|
925
|
-
const
|
|
1161
|
+
}, Kt = (s, e) => {
|
|
1162
|
+
const t = s.updateAssessment?.assistantResponse ?? f("applyChangeFailed", e);
|
|
926
1163
|
return {
|
|
927
|
-
outputMessage:
|
|
928
|
-
summary:
|
|
1164
|
+
outputMessage: t,
|
|
1165
|
+
summary: t,
|
|
929
1166
|
status: "success"
|
|
930
1167
|
};
|
|
931
|
-
},
|
|
932
|
-
if (
|
|
1168
|
+
}, Wt = (s, e) => {
|
|
1169
|
+
if (m(e))
|
|
933
1170
|
return {};
|
|
934
|
-
const { hitlResponse:
|
|
935
|
-
(
|
|
936
|
-
) ?? [], o =
|
|
937
|
-
if (
|
|
938
|
-
const
|
|
1171
|
+
const { hitlResponse: t } = e.configurable, n = "selectTemplate", i = s.assessment?.matchedTemplates.filter(
|
|
1172
|
+
(d) => ee(d.templateId)
|
|
1173
|
+
) ?? [], o = i.map((d) => `${d.templateDescription}`);
|
|
1174
|
+
if (t?.agentId !== "solutionBuilder" || t.id !== n) {
|
|
1175
|
+
const d = {
|
|
939
1176
|
agentId: "solutionBuilder",
|
|
940
|
-
id:
|
|
1177
|
+
id: n,
|
|
941
1178
|
kind: "singleSelection",
|
|
942
|
-
message:
|
|
1179
|
+
message: f("selectTemplatePrompt", e),
|
|
943
1180
|
metadata: [...o]
|
|
944
1181
|
};
|
|
945
|
-
throw new
|
|
1182
|
+
throw new de(d);
|
|
946
1183
|
}
|
|
947
|
-
const a = String(
|
|
1184
|
+
const a = String(t.payload ?? ""), r = o.findIndex((d) => d === a);
|
|
948
1185
|
return {
|
|
949
|
-
selectedTemplate: (
|
|
1186
|
+
selectedTemplate: (r >= 0 ? i[r] : void 0)?.templateId ?? i[0]?.templateId ?? null
|
|
950
1187
|
};
|
|
951
|
-
},
|
|
952
|
-
if (
|
|
1188
|
+
}, Xt = async (s, e) => {
|
|
1189
|
+
if (m(e))
|
|
953
1190
|
return {};
|
|
954
|
-
await
|
|
955
|
-
const
|
|
956
|
-
if (
|
|
1191
|
+
await _({ text: f("searchingExistingSolutions", e) }, e);
|
|
1192
|
+
const t = s.agentExecutionContext.userRequest, n = ht(s.agentExecutionContext.messages) || t, i = await Ee(e);
|
|
1193
|
+
if (m(e))
|
|
957
1194
|
return {};
|
|
958
|
-
if (!
|
|
1195
|
+
if (!i)
|
|
959
1196
|
return console.warn("Solutions Search: failed to load solution embeddings cache; skipping search."), { existingMatches: [] };
|
|
960
|
-
if (!
|
|
1197
|
+
if (!i.length)
|
|
961
1198
|
return { existingMatches: [] };
|
|
962
|
-
const [o] = await
|
|
963
|
-
if (
|
|
1199
|
+
const [o] = await ze([n]);
|
|
1200
|
+
if (m(e))
|
|
964
1201
|
return {};
|
|
965
|
-
const a =
|
|
1202
|
+
const a = i.map((u) => ({
|
|
966
1203
|
solution: u,
|
|
967
|
-
score:
|
|
1204
|
+
score: je(o, u.embedding)
|
|
968
1205
|
}));
|
|
969
|
-
a.sort((u,
|
|
970
|
-
const
|
|
971
|
-
if (!
|
|
1206
|
+
a.sort((u, g) => g.score - u.score);
|
|
1207
|
+
const r = a.slice(0, $t);
|
|
1208
|
+
if (!r.length)
|
|
972
1209
|
return { existingMatches: [] };
|
|
973
|
-
const
|
|
1210
|
+
const c = r.map(({ solution: u }) => `${u.title}
|
|
974
1211
|
Snippet: ${u.snippet}
|
|
975
1212
|
Description: ${u.description}`).join(`
|
|
976
1213
|
|
|
977
|
-
`),
|
|
978
|
-
return { existingMatches: (await
|
|
979
|
-
promptText: await v(
|
|
1214
|
+
`), d = s.agentExecutionContext.messages.slice(-11);
|
|
1215
|
+
return { existingMatches: (await k({
|
|
1216
|
+
promptText: await v(L, "findExistingSolution"),
|
|
980
1217
|
modelTier: "fast",
|
|
981
1218
|
temperature: 0,
|
|
982
|
-
schema:
|
|
983
|
-
messages:
|
|
984
|
-
inputVariables: { query:
|
|
985
|
-
})).matchedTitles.map((u) =>
|
|
986
|
-
},
|
|
987
|
-
if (
|
|
1219
|
+
schema: At,
|
|
1220
|
+
messages: d,
|
|
1221
|
+
inputVariables: { query: t, candidates: c }
|
|
1222
|
+
})).matchedTitles.map((u) => r.find(({ solution: g }) => g.title === u)).filter((u) => u !== void 0) };
|
|
1223
|
+
}, Yt = (s, e) => {
|
|
1224
|
+
if (m(e))
|
|
988
1225
|
return {};
|
|
989
|
-
const { existingMatches:
|
|
990
|
-
if (
|
|
991
|
-
|
|
992
|
-
const
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
],
|
|
1226
|
+
const { existingMatches: t } = s, { hitlResponse: n } = e.configurable, i = `confirmExistingSolution:${t[0].solution.id}`;
|
|
1227
|
+
if (n?.agentId !== "solutionBuilder" || n.id !== i) {
|
|
1228
|
+
t.length === 1 ? ye(t[0].solution.id) : fe(t);
|
|
1229
|
+
const c = f("existingSolutionMatch", e), d = [
|
|
1230
|
+
f("continueBuildingYes", e),
|
|
1231
|
+
f("continueBuildingNo", e)
|
|
1232
|
+
], h = {
|
|
996
1233
|
agentId: "solutionBuilder",
|
|
997
|
-
id:
|
|
1234
|
+
id: i,
|
|
998
1235
|
kind: "singleSelection",
|
|
999
|
-
message:
|
|
1000
|
-
metadata:
|
|
1236
|
+
message: c,
|
|
1237
|
+
metadata: d
|
|
1001
1238
|
};
|
|
1002
|
-
throw new
|
|
1239
|
+
throw new de(h);
|
|
1003
1240
|
}
|
|
1004
|
-
const o = String(
|
|
1241
|
+
const o = String(n.payload ?? "").trim(), a = f("continueBuildingNo", e);
|
|
1005
1242
|
return { continueBuilding: o !== a };
|
|
1006
|
-
},
|
|
1007
|
-
const
|
|
1243
|
+
}, Zt = (s, e) => {
|
|
1244
|
+
const t = f("continueBuildingDeclined", e);
|
|
1008
1245
|
return {
|
|
1009
|
-
outputMessage:
|
|
1010
|
-
summary:
|
|
1246
|
+
outputMessage: t,
|
|
1247
|
+
summary: t,
|
|
1011
1248
|
status: "success"
|
|
1012
1249
|
};
|
|
1013
|
-
},
|
|
1014
|
-
if (
|
|
1250
|
+
}, Le = async (s, e) => {
|
|
1251
|
+
if (m(e))
|
|
1015
1252
|
return {};
|
|
1016
|
-
if (await
|
|
1253
|
+
if (await Te(e), m(e))
|
|
1017
1254
|
return {};
|
|
1018
|
-
const { currentDesign:
|
|
1019
|
-
await
|
|
1020
|
-
let
|
|
1021
|
-
if (
|
|
1255
|
+
const { currentDesign: t } = s, n = s.agentExecutionContext.userRequest;
|
|
1256
|
+
await _({ text: f("creatingDesign", e) }, e);
|
|
1257
|
+
let i = q(s.selectedTemplate);
|
|
1258
|
+
if (i?.initialTemplate || (await te(e), i = q(s.selectedTemplate)), m(e))
|
|
1022
1259
|
return {};
|
|
1023
|
-
if (!
|
|
1260
|
+
if (!i?.initialTemplate)
|
|
1024
1261
|
throw new Error("No hydrated templates are available for solution design.");
|
|
1025
|
-
const o =
|
|
1026
|
-
|
|
1262
|
+
const o = $(
|
|
1263
|
+
t ?? i.initialTemplate,
|
|
1027
1264
|
{
|
|
1028
|
-
itemId: (
|
|
1029
|
-
sourceBuildSolution:
|
|
1030
|
-
params:
|
|
1265
|
+
itemId: (t ?? i.initialTemplate)?.solution?.itemId ?? null,
|
|
1266
|
+
sourceBuildSolution: t?.sourceBuildSolution ?? i.initialTemplate.sourceBuildSolution,
|
|
1267
|
+
params: t?.params ?? i.initialTemplate.params ?? null
|
|
1031
1268
|
}
|
|
1032
|
-
), a =
|
|
1033
|
-
promptText: await v(
|
|
1269
|
+
), a = s.agentExecutionContext.messages.slice(-11), r = await k({
|
|
1270
|
+
promptText: await v(L, "designSolution"),
|
|
1034
1271
|
modelTier: "advanced",
|
|
1035
1272
|
temperature: 0,
|
|
1036
|
-
schema:
|
|
1273
|
+
schema: Z,
|
|
1037
1274
|
messages: a,
|
|
1038
1275
|
inputVariables: {
|
|
1039
|
-
currentDesign: JSON.stringify(
|
|
1040
|
-
templateInstructions:
|
|
1041
|
-
query:
|
|
1276
|
+
currentDesign: JSON.stringify(he(o)),
|
|
1277
|
+
templateInstructions: i.instructions,
|
|
1278
|
+
query: n
|
|
1042
1279
|
}
|
|
1043
1280
|
});
|
|
1044
|
-
if (await
|
|
1281
|
+
if (await _({ text: " of design solution 1" }, e), m(e))
|
|
1045
1282
|
return {};
|
|
1046
|
-
const { response:
|
|
1047
|
-
|
|
1283
|
+
const { response: c, featureLayer: d, ...h } = r, y = ge(
|
|
1284
|
+
d,
|
|
1048
1285
|
o.featureLayer
|
|
1049
|
-
), u =
|
|
1050
|
-
{ ...
|
|
1286
|
+
), u = $(
|
|
1287
|
+
{ ...h, featureLayer: y },
|
|
1051
1288
|
{
|
|
1052
1289
|
itemId: o?.solution?.itemId,
|
|
1053
1290
|
sourceBuildSolution: o.sourceBuildSolution,
|
|
1054
|
-
templateId:
|
|
1291
|
+
templateId: s.selectedTemplate ?? null,
|
|
1055
1292
|
params: o.params ?? null
|
|
1056
1293
|
}
|
|
1057
|
-
),
|
|
1058
|
-
if (!
|
|
1294
|
+
), g = new b(u, i.initialTemplate);
|
|
1295
|
+
if (!g.isValid)
|
|
1059
1296
|
return console.warn(
|
|
1060
1297
|
"[SolutionBuilder] designSolution validation failed:",
|
|
1061
|
-
{ issues:
|
|
1298
|
+
{ issues: g.issues, llmResponse: r }
|
|
1062
1299
|
), {
|
|
1063
|
-
outputMessage:
|
|
1300
|
+
outputMessage: f("createDesignFailed", e)
|
|
1064
1301
|
};
|
|
1065
|
-
const S = u.sourceBuildSolution,
|
|
1066
|
-
if (
|
|
1302
|
+
const S = u.sourceBuildSolution, N = Se(u, S);
|
|
1303
|
+
if (!N.ok) {
|
|
1067
1304
|
console.warn(
|
|
1068
1305
|
"[SolutionBuilder] designSolution Esri JSON conversion failed:",
|
|
1069
|
-
{ error:
|
|
1306
|
+
{ error: N.error, llmResponse: r, design: u }
|
|
1070
1307
|
);
|
|
1071
|
-
const
|
|
1308
|
+
const C = f("createDesignFailed", e);
|
|
1072
1309
|
return {
|
|
1073
|
-
outputMessage:
|
|
1074
|
-
summary:
|
|
1310
|
+
outputMessage: C,
|
|
1311
|
+
summary: C,
|
|
1075
1312
|
status: "success"
|
|
1076
1313
|
};
|
|
1077
1314
|
}
|
|
1078
|
-
return
|
|
1079
|
-
outputMessage:
|
|
1080
|
-
summary:
|
|
1315
|
+
return m(e) ? {} : (_e(u), {
|
|
1316
|
+
outputMessage: c,
|
|
1317
|
+
summary: c,
|
|
1081
1318
|
status: "success",
|
|
1082
1319
|
currentDesign: u
|
|
1083
1320
|
});
|
|
1084
|
-
},
|
|
1085
|
-
if (
|
|
1321
|
+
}, es = async (s, e) => {
|
|
1322
|
+
if (m(e))
|
|
1086
1323
|
return {};
|
|
1087
|
-
const { currentDesign:
|
|
1088
|
-
if (!
|
|
1089
|
-
return
|
|
1090
|
-
const
|
|
1091
|
-
await
|
|
1324
|
+
const { currentDesign: t } = s;
|
|
1325
|
+
if (!t)
|
|
1326
|
+
return Le(s, e);
|
|
1327
|
+
const n = s.agentExecutionContext.userRequest, i = s.agentExecutionContext.messages.slice(-11);
|
|
1328
|
+
await _({ text: f("updatingDesign", e) }, e);
|
|
1092
1329
|
let o;
|
|
1093
1330
|
try {
|
|
1094
|
-
o = await
|
|
1095
|
-
promptText: await v(
|
|
1331
|
+
o = await k({
|
|
1332
|
+
promptText: await v(L, "updateDesign"),
|
|
1096
1333
|
modelTier: "advanced",
|
|
1097
1334
|
temperature: 0,
|
|
1098
|
-
schema:
|
|
1099
|
-
messages:
|
|
1335
|
+
schema: _t,
|
|
1336
|
+
messages: i,
|
|
1100
1337
|
inputVariables: {
|
|
1101
|
-
currentDesign: JSON.stringify(
|
|
1102
|
-
query:
|
|
1338
|
+
currentDesign: JSON.stringify(me(t)),
|
|
1339
|
+
query: n
|
|
1103
1340
|
}
|
|
1104
1341
|
});
|
|
1105
1342
|
} catch (p) {
|
|
1106
1343
|
console.warn("[SolutionBuilder] updateDesign structured prompt failed:", p);
|
|
1107
|
-
const
|
|
1344
|
+
const w = f("applyChangeFailed", e);
|
|
1108
1345
|
return {
|
|
1109
|
-
outputMessage:
|
|
1110
|
-
summary:
|
|
1346
|
+
outputMessage: w,
|
|
1347
|
+
summary: w,
|
|
1111
1348
|
status: "success"
|
|
1112
1349
|
};
|
|
1113
1350
|
}
|
|
1114
|
-
const { response: a, patches:
|
|
1115
|
-
if (!
|
|
1351
|
+
const { response: a, patches: r } = o;
|
|
1352
|
+
if (!r || r.length === 0)
|
|
1116
1353
|
return {
|
|
1117
1354
|
outputMessage: a,
|
|
1118
1355
|
summary: a,
|
|
1119
1356
|
status: "success"
|
|
1120
1357
|
};
|
|
1121
|
-
const
|
|
1358
|
+
const c = (p) => {
|
|
1122
1359
|
try {
|
|
1123
1360
|
return JSON.parse(p);
|
|
1124
1361
|
} catch {
|
|
1125
|
-
const
|
|
1126
|
-
switch (
|
|
1362
|
+
const w = p.replace(/[\u0000-\u001F]/g, (oe) => {
|
|
1363
|
+
switch (oe) {
|
|
1127
1364
|
case "\b":
|
|
1128
1365
|
return "\\b";
|
|
1129
1366
|
case "\f":
|
|
@@ -1136,82 +1373,82 @@ Description: ${u.description}`).join(`
|
|
|
1136
1373
|
case " ":
|
|
1137
1374
|
return "\\t";
|
|
1138
1375
|
default:
|
|
1139
|
-
return "\\u" +
|
|
1376
|
+
return "\\u" + oe.charCodeAt(0).toString(16).padStart(4, "0");
|
|
1140
1377
|
}
|
|
1141
1378
|
});
|
|
1142
1379
|
try {
|
|
1143
|
-
return JSON.parse(
|
|
1380
|
+
return JSON.parse(w);
|
|
1144
1381
|
} catch {
|
|
1145
1382
|
return p;
|
|
1146
1383
|
}
|
|
1147
1384
|
}
|
|
1148
|
-
},
|
|
1385
|
+
}, h = [...r.map((p) => ({
|
|
1149
1386
|
op: p.op,
|
|
1150
1387
|
path: p.path.replace(/\/+$/, ""),
|
|
1151
|
-
...p.value != null && p.value !== "" ? { value:
|
|
1388
|
+
...p.value != null && p.value !== "" ? { value: c(p.value) } : {},
|
|
1152
1389
|
...p.from != null && p.from !== "" ? { from: p.from } : {}
|
|
1153
|
-
}))].sort((p,
|
|
1154
|
-
|
|
1390
|
+
}))].sort((p, w) => p.op !== "remove" || w.op !== "remove" ? 0 : w.path.localeCompare(p.path, void 0, { numeric: !0 })), y = structuredClone(
|
|
1391
|
+
he(t)
|
|
1155
1392
|
);
|
|
1156
1393
|
try {
|
|
1157
|
-
|
|
1394
|
+
He(y, h, !0);
|
|
1158
1395
|
} catch (p) {
|
|
1159
1396
|
console.warn(
|
|
1160
1397
|
"[SolutionBuilder] updateDesign JSON patch failed:",
|
|
1161
|
-
{ error: p, llmResponse: o, patches:
|
|
1398
|
+
{ error: p, llmResponse: o, patches: h, patchTarget: y }
|
|
1162
1399
|
);
|
|
1163
|
-
const
|
|
1400
|
+
const w = f("applyChangeFailed", e);
|
|
1164
1401
|
return {
|
|
1165
|
-
outputMessage:
|
|
1166
|
-
summary:
|
|
1402
|
+
outputMessage: w,
|
|
1403
|
+
summary: w,
|
|
1167
1404
|
status: "success"
|
|
1168
1405
|
};
|
|
1169
1406
|
}
|
|
1170
|
-
const u =
|
|
1171
|
-
{ response: "", ...
|
|
1172
|
-
{ itemId:
|
|
1173
|
-
),
|
|
1174
|
-
if (!
|
|
1407
|
+
const u = $(
|
|
1408
|
+
{ response: "", ...y },
|
|
1409
|
+
{ itemId: t.solution?.itemId ?? null }
|
|
1410
|
+
), g = Z.safeParse(u);
|
|
1411
|
+
if (!g.success) {
|
|
1175
1412
|
console.warn(
|
|
1176
1413
|
"[SolutionBuilder] updateDesign schema validation failed:",
|
|
1177
|
-
{ errors:
|
|
1414
|
+
{ errors: g.error.issues, llmResponse: o, patchedDesign: u }
|
|
1178
1415
|
);
|
|
1179
|
-
const p =
|
|
1416
|
+
const p = f("applyChangeFailed", e);
|
|
1180
1417
|
return {
|
|
1181
1418
|
outputMessage: p,
|
|
1182
1419
|
summary: p,
|
|
1183
1420
|
status: "success"
|
|
1184
1421
|
};
|
|
1185
1422
|
}
|
|
1186
|
-
const { response: S, featureLayer:
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
),
|
|
1190
|
-
{ ...
|
|
1423
|
+
const { response: S, featureLayer: N, ...C } = g.data, z = ge(
|
|
1424
|
+
N,
|
|
1425
|
+
t.featureLayer
|
|
1426
|
+
), I = $(
|
|
1427
|
+
{ ...C, featureLayer: z },
|
|
1191
1428
|
{
|
|
1192
|
-
itemId:
|
|
1193
|
-
sourceBuildSolution:
|
|
1194
|
-
templateId:
|
|
1195
|
-
params:
|
|
1429
|
+
itemId: t.solution?.itemId,
|
|
1430
|
+
sourceBuildSolution: t.sourceBuildSolution,
|
|
1431
|
+
templateId: t.templateId ?? s.selectedTemplate ?? null,
|
|
1432
|
+
params: t.params ?? null
|
|
1196
1433
|
}
|
|
1197
1434
|
);
|
|
1198
|
-
let
|
|
1199
|
-
if (
|
|
1435
|
+
let D = q(s.selectedTemplate);
|
|
1436
|
+
if (D?.initialTemplate || (await te(e), D = q(s.selectedTemplate)), m(e))
|
|
1200
1437
|
return {};
|
|
1201
|
-
if (!
|
|
1438
|
+
if (!D?.initialTemplate)
|
|
1202
1439
|
throw new Error("No hydrated templates are available for solution design.");
|
|
1203
|
-
const
|
|
1204
|
-
if (!
|
|
1440
|
+
const j = new b(I, D.initialTemplate, !1);
|
|
1441
|
+
if (!j.isValid) {
|
|
1205
1442
|
console.warn(
|
|
1206
1443
|
"[SolutionBuilder] updateDesign validation failed:",
|
|
1207
|
-
{ issues:
|
|
1444
|
+
{ issues: j.issues, llmResponse: o, patchedDesign: I }
|
|
1208
1445
|
);
|
|
1209
|
-
const p = await
|
|
1210
|
-
query:
|
|
1211
|
-
validationIssues:
|
|
1212
|
-
recentMessages:
|
|
1213
|
-
fallbackMessage:
|
|
1214
|
-
promptModules:
|
|
1446
|
+
const p = await Lt({
|
|
1447
|
+
query: n,
|
|
1448
|
+
validationIssues: j.issues,
|
|
1449
|
+
recentMessages: i,
|
|
1450
|
+
fallbackMessage: f("applyChangeFailed", e),
|
|
1451
|
+
promptModules: L
|
|
1215
1452
|
});
|
|
1216
1453
|
return {
|
|
1217
1454
|
outputMessage: p,
|
|
@@ -1219,151 +1456,153 @@ Description: ${u.description}`).join(`
|
|
|
1219
1456
|
status: "success"
|
|
1220
1457
|
};
|
|
1221
1458
|
}
|
|
1222
|
-
const
|
|
1223
|
-
if (!
|
|
1459
|
+
const ke = I.sourceBuildSolution, ne = Se(I, ke);
|
|
1460
|
+
if (!ne.ok) {
|
|
1224
1461
|
console.warn(
|
|
1225
1462
|
"[SolutionBuilder] updateDesign Esri JSON conversion failed:",
|
|
1226
|
-
{ error:
|
|
1463
|
+
{ error: ne.error, llmResponse: o, design: I }
|
|
1227
1464
|
);
|
|
1228
|
-
const p =
|
|
1465
|
+
const p = f("applyChangeFailed", e);
|
|
1229
1466
|
return {
|
|
1230
1467
|
outputMessage: p,
|
|
1231
1468
|
summary: p,
|
|
1232
1469
|
status: "success"
|
|
1233
1470
|
};
|
|
1234
1471
|
}
|
|
1235
|
-
return
|
|
1472
|
+
return m(e) ? {} : (_e(I), {
|
|
1236
1473
|
outputMessage: a,
|
|
1237
1474
|
summary: a,
|
|
1238
1475
|
status: "success",
|
|
1239
|
-
currentDesign:
|
|
1476
|
+
currentDesign: I
|
|
1240
1477
|
});
|
|
1241
|
-
},
|
|
1478
|
+
}, ts = (s) => s.currentDesign !== null ? "assessUpdateRequest" : "assessBuildRequest", ss = (s) => !s.updateAssessment || !s.updateAssessment.isValidUpdate ? "invalidUpdateExit" : "updateDesign", is = (s) => !s.assessment || !s.assessment.isValidUseCase ? "invalidBuildExit" : !s.selectedTemplate && s.assessment.matchedTemplates.length > 1 ? "selectTemplateHIL" : "findExistingSolutions", ns = (s) => s.existingMatches.length > 0 ? "confirmContinueBuildingHIL" : "designSolution", os = (s) => s.continueBuilding === !1 ? "declineContinueBuildingExit" : "designSolution", as = () => new K(Gt).addNode("syncCurrentDesignFromContext", Ht).addNode("assessBuildRequest", Jt).addNode("assessUpdateRequest", Qt).addNode("invalidBuildExit", Vt).addNode("invalidUpdateExit", Kt).addNode("selectTemplateHIL", Wt).addNode("findExistingSolutions", Xt).addNode("confirmContinueBuildingHIL", Yt).addNode("declineContinueBuildingExit", Zt).addNode("designSolution", Le).addNode("updateDesign", es).addEdge(W, "syncCurrentDesignFromContext").addConditionalEdges("syncCurrentDesignFromContext", ts, {
|
|
1242
1479
|
assessUpdateRequest: "assessUpdateRequest",
|
|
1243
1480
|
assessBuildRequest: "assessBuildRequest"
|
|
1244
|
-
}).addConditionalEdges("assessUpdateRequest",
|
|
1481
|
+
}).addConditionalEdges("assessUpdateRequest", ss, {
|
|
1245
1482
|
invalidUpdateExit: "invalidUpdateExit",
|
|
1246
1483
|
updateDesign: "updateDesign"
|
|
1247
|
-
}).addConditionalEdges("assessBuildRequest",
|
|
1484
|
+
}).addConditionalEdges("assessBuildRequest", is, {
|
|
1248
1485
|
invalidBuildExit: "invalidBuildExit",
|
|
1249
1486
|
selectTemplateHIL: "selectTemplateHIL",
|
|
1250
1487
|
findExistingSolutions: "findExistingSolutions"
|
|
1251
|
-
}).addEdge("invalidBuildExit",
|
|
1488
|
+
}).addEdge("invalidBuildExit", A).addEdge("invalidUpdateExit", A).addEdge("selectTemplateHIL", "findExistingSolutions").addConditionalEdges("findExistingSolutions", ns, {
|
|
1252
1489
|
confirmContinueBuildingHIL: "confirmContinueBuildingHIL",
|
|
1253
1490
|
designSolution: "designSolution"
|
|
1254
|
-
}).addConditionalEdges("confirmContinueBuildingHIL",
|
|
1491
|
+
}).addConditionalEdges("confirmContinueBuildingHIL", os, {
|
|
1255
1492
|
declineContinueBuildingExit: "declineContinueBuildingExit",
|
|
1256
1493
|
designSolution: "designSolution"
|
|
1257
|
-
}).addEdge("declineContinueBuildingExit",
|
|
1258
|
-
await v(
|
|
1259
|
-
const
|
|
1260
|
-
tool:
|
|
1261
|
-
confidence:
|
|
1262
|
-
rationale:
|
|
1263
|
-
}),
|
|
1264
|
-
"./prompts/assistantResponse.md": () => import("../../chunks/assistantResponse.js").then((
|
|
1265
|
-
"./prompts/classifyIntent.md": () => import("../../chunks/classifyIntent.js").then((
|
|
1266
|
-
"./prompts/description.md": () => import("../../chunks/description.js").then((
|
|
1267
|
-
}),
|
|
1268
|
-
const s =
|
|
1269
|
-
|
|
1270
|
-
|
|
1494
|
+
}).addEdge("declineContinueBuildingExit", A).addEdge("designSolution", A).addEdge("updateDesign", A);
|
|
1495
|
+
await v(L, "description");
|
|
1496
|
+
const rs = E.object({
|
|
1497
|
+
tool: E.enum(["explorer", "builder", "other"]).describe("The selected tool based on the user’s intent using the conversation context."),
|
|
1498
|
+
confidence: E.number().min(0).max(1).describe("A confidence score (0.00–1.00)."),
|
|
1499
|
+
rationale: E.string().min(1).describe("A brief rationale for the tool choice (≤140 characters)")
|
|
1500
|
+
}), O = (s) => s?.signal?.aborted ?? !1, se = /* @__PURE__ */ Object.assign({
|
|
1501
|
+
"./prompts/assistantResponse.md": () => import("../../chunks/assistantResponse.js").then((s) => s.default),
|
|
1502
|
+
"./prompts/classifyIntent.md": () => import("../../chunks/classifyIntent.js").then((s) => s.default),
|
|
1503
|
+
"./prompts/description.md": () => import("../../chunks/description.js").then((s) => s.default)
|
|
1504
|
+
}), ls = (s) => {
|
|
1505
|
+
const e = s?.configurable?.context?.solutionDesignJson, t = s?.configurable?.context?.lastTurnAgent, n = t === "assistant" ? "other" : t;
|
|
1506
|
+
let i = !1;
|
|
1507
|
+
if (typeof e == "string" && e.trim())
|
|
1508
|
+
try {
|
|
1509
|
+
i = JSON.parse(e).solution != null;
|
|
1510
|
+
} catch {
|
|
1511
|
+
i = !1;
|
|
1512
|
+
}
|
|
1513
|
+
return { activeSolutionDesign: i, lastTool: n };
|
|
1514
|
+
}, ie = (s, e) => {
|
|
1515
|
+
const t = s?.configurable?.context?.setLastTurnAgent;
|
|
1516
|
+
typeof t == "function" && t(e);
|
|
1517
|
+
const n = new CustomEvent("assistantProcessing", {
|
|
1271
1518
|
detail: { finished: !0, agent: e }
|
|
1272
1519
|
});
|
|
1273
|
-
window.dispatchEvent(
|
|
1274
|
-
},
|
|
1275
|
-
...
|
|
1276
|
-
selectedTool:
|
|
1277
|
-
reducer: (
|
|
1520
|
+
window.dispatchEvent(n);
|
|
1521
|
+
}, $e = x.Root({
|
|
1522
|
+
...X(),
|
|
1523
|
+
selectedTool: x({
|
|
1524
|
+
reducer: (s, e) => e ?? null,
|
|
1278
1525
|
default: () => null
|
|
1279
1526
|
}),
|
|
1280
|
-
intentRationale:
|
|
1281
|
-
reducer: (
|
|
1527
|
+
intentRationale: x({
|
|
1528
|
+
reducer: (s, e) => e ?? null,
|
|
1282
1529
|
default: () => null
|
|
1283
1530
|
})
|
|
1284
|
-
}),
|
|
1285
|
-
if (e
|
|
1531
|
+
}), cs = async (s, e) => {
|
|
1532
|
+
if (O(e))
|
|
1286
1533
|
return {};
|
|
1287
|
-
const
|
|
1288
|
-
await
|
|
1289
|
-
{ text:
|
|
1534
|
+
const t = U(e);
|
|
1535
|
+
await _(
|
|
1536
|
+
{ text: t?.builderMessages.understandingRequest },
|
|
1290
1537
|
e
|
|
1291
1538
|
);
|
|
1292
|
-
const
|
|
1293
|
-
|
|
1294
|
-
if (typeof o == "string" && o.trim())
|
|
1295
|
-
try {
|
|
1296
|
-
a = JSON.parse(o).solution != null;
|
|
1297
|
-
} catch {
|
|
1298
|
-
a = !1;
|
|
1299
|
-
}
|
|
1300
|
-
const l = await v(ee, "classifyIntent"), d = await C({
|
|
1301
|
-
promptText: l,
|
|
1539
|
+
const n = s.agentExecutionContext.userRequest, i = s.agentExecutionContext.messages.slice(-11), { activeSolutionDesign: o, lastTool: a } = ls(e), r = await v(se, "classifyIntent"), c = await k({
|
|
1540
|
+
promptText: r,
|
|
1302
1541
|
modelTier: "advanced",
|
|
1303
1542
|
temperature: 0,
|
|
1304
|
-
schema:
|
|
1305
|
-
messages:
|
|
1306
|
-
inputVariables: { query:
|
|
1543
|
+
schema: rs,
|
|
1544
|
+
messages: i,
|
|
1545
|
+
inputVariables: { query: n, activeSolutionDesign: o, lastTool: a }
|
|
1307
1546
|
});
|
|
1308
1547
|
return {
|
|
1309
|
-
selectedTool:
|
|
1310
|
-
intentRationale:
|
|
1548
|
+
selectedTool: c.tool,
|
|
1549
|
+
intentRationale: c.rationale
|
|
1311
1550
|
};
|
|
1312
|
-
},
|
|
1313
|
-
if (e
|
|
1551
|
+
}, us = async (s, e) => {
|
|
1552
|
+
if (O(e))
|
|
1314
1553
|
return {};
|
|
1315
|
-
const
|
|
1316
|
-
return
|
|
1317
|
-
},
|
|
1318
|
-
if (e
|
|
1554
|
+
const n = await lt().compile().invoke(s, e);
|
|
1555
|
+
return ie(e, "explorer"), n;
|
|
1556
|
+
}, ds = async (s, e) => {
|
|
1557
|
+
if (O(e))
|
|
1319
1558
|
return {};
|
|
1320
|
-
const
|
|
1321
|
-
return
|
|
1322
|
-
},
|
|
1323
|
-
if (e
|
|
1559
|
+
const n = await as().compile().invoke(s, e);
|
|
1560
|
+
return ie(e, "builder"), n;
|
|
1561
|
+
}, ps = async (s, e) => {
|
|
1562
|
+
if (O(e))
|
|
1324
1563
|
return {};
|
|
1325
|
-
const
|
|
1326
|
-
await
|
|
1327
|
-
{ text:
|
|
1564
|
+
const t = U(e), n = s.agentExecutionContext.userRequest, i = s.intentRationale ?? "No rationale available.";
|
|
1565
|
+
await _(
|
|
1566
|
+
{ text: t?.executingSolutionsAssistantAgent },
|
|
1328
1567
|
e
|
|
1329
1568
|
);
|
|
1330
|
-
const o = await v(
|
|
1569
|
+
const o = await v(se, "assistantResponse"), a = s.agentExecutionContext.messages.slice(-11), r = await Ge({
|
|
1331
1570
|
promptText: o,
|
|
1332
1571
|
modelTier: "advanced",
|
|
1333
1572
|
temperature: 0,
|
|
1334
1573
|
messages: a,
|
|
1335
|
-
inputVariables: { query:
|
|
1574
|
+
inputVariables: { query: n, rationale: i }
|
|
1336
1575
|
});
|
|
1337
|
-
return
|
|
1338
|
-
outputMessage:
|
|
1339
|
-
summary:
|
|
1576
|
+
return ie(e, "assistant"), {
|
|
1577
|
+
outputMessage: r,
|
|
1578
|
+
summary: r,
|
|
1340
1579
|
status: "success"
|
|
1341
1580
|
};
|
|
1342
|
-
},
|
|
1581
|
+
}, ms = (s) => s.selectedTool ?? "other", hs = () => new K($e).addNode("classifyIntent", cs).addNode("routeToExplorer", us).addNode("routeToBuilder", ds).addNode("assistantResponse", ps).addEdge(W, "classifyIntent").addConditionalEdges("classifyIntent", ms, {
|
|
1343
1582
|
explorer: "routeToExplorer",
|
|
1344
1583
|
builder: "routeToBuilder",
|
|
1345
1584
|
other: "assistantResponse"
|
|
1346
|
-
}).addEdge("routeToExplorer",
|
|
1585
|
+
}).addEdge("routeToExplorer", A).addEdge("routeToBuilder", A).addEdge("assistantResponse", A), gs = await v(se, "description"), fs = {
|
|
1347
1586
|
id: "solutionsAssistant",
|
|
1348
1587
|
name: "Solutions Assistant Agent",
|
|
1349
|
-
description:
|
|
1350
|
-
createGraph:
|
|
1351
|
-
workspace:
|
|
1352
|
-
},
|
|
1353
|
-
class
|
|
1588
|
+
description: gs,
|
|
1589
|
+
createGraph: hs,
|
|
1590
|
+
workspace: $e
|
|
1591
|
+
}, ys = "https://links.esri.com/solutions/agol-organizational-account", bs = "https://links.esri.com/solutions/configure-assistants";
|
|
1592
|
+
class xs extends De {
|
|
1354
1593
|
constructor() {
|
|
1355
1594
|
super(), this.open = !1, this.userFirstName = "", this.builderVisible = !1, this.hasActiveBuilderDesign = !1, this._conversationId = void 0, this._lastTurnAgent = void 0, this._orgSettings = {
|
|
1356
1595
|
aiAssistantsEnabled: !1,
|
|
1357
1596
|
blockBetaApps: !0,
|
|
1358
1597
|
colocateCompute: !1
|
|
1359
|
-
}, this._suggestedPrompts = [], this._hasInteracted = !1, this._isMobile = window.innerWidth <= 800, this._translations =
|
|
1360
|
-
context:
|
|
1598
|
+
}, this._suggestedPrompts = [], this._hasInteracted = !1, this._isMobile = window.innerWidth <= 800, this._translations = Fe({ name: "arcgis-solutions-assistant", blocking: !0 }), this._builderWidth = 48, this._solutionDesignJson = '{ "solution": null }', this._isAssistantBusy = !1, this._isBuilderBusy = !1, this._preChatCheck = !1, this._showNewChatConfirm = !1, this._assistantRef = Ue(), this._configContextConsumer = le({
|
|
1599
|
+
context: Be,
|
|
1361
1600
|
subscribe: !0,
|
|
1362
1601
|
callback: (e) => {
|
|
1363
|
-
e?.portalURL && (
|
|
1602
|
+
e?.portalURL && (G.portalUrl = e.portalURL), e?.userSession && !this.userFirstName && this._loadUserFirstName(), e?.authentication?.PortalSubset?.orgSettings && (this._orgSettings = e?.authentication?.PortalSubset?.orgSettings);
|
|
1364
1603
|
}
|
|
1365
|
-
}), this._builderDesignContextConsumer =
|
|
1366
|
-
context:
|
|
1604
|
+
}), this._builderDesignContextConsumer = le({
|
|
1605
|
+
context: Pe,
|
|
1367
1606
|
subscribe: !0,
|
|
1368
1607
|
callback: (e) => {
|
|
1369
1608
|
e?.design && (this._solutionDesignJson = JSON.stringify(e.design, null, 2));
|
|
@@ -1371,34 +1610,34 @@ class ms extends Fe {
|
|
|
1371
1610
|
}), this._handleResize = () => {
|
|
1372
1611
|
this._isMobile = window.innerWidth <= 800;
|
|
1373
1612
|
}, this._chatStartTime = null, this._handleAssistantProcessingFinished = (e) => {
|
|
1374
|
-
const
|
|
1375
|
-
if (
|
|
1376
|
-
const
|
|
1613
|
+
const t = e;
|
|
1614
|
+
if (t.detail?.finished && this._chatStartTime !== null) {
|
|
1615
|
+
const n = qe(this._chatStartTime);
|
|
1377
1616
|
this._telemetry?.logEvent({
|
|
1378
|
-
category:
|
|
1617
|
+
category: M.ASSISTANT,
|
|
1379
1618
|
action: "Chat",
|
|
1380
|
-
dimensions: [
|
|
1381
|
-
metrics: [
|
|
1619
|
+
dimensions: [t.detail.agent],
|
|
1620
|
+
metrics: [n]
|
|
1382
1621
|
}), this._chatStartTime = null, this.assistantProcessing.emit(!1);
|
|
1383
1622
|
}
|
|
1384
|
-
}, this.closeAssistant =
|
|
1385
|
-
const
|
|
1386
|
-
if (
|
|
1387
|
-
if (e.preventDefault(),
|
|
1388
|
-
const
|
|
1389
|
-
this._emitItemIdFromAI(
|
|
1623
|
+
}, this.closeAssistant = ae(), this.assistantProcessing = ae(), this._handleAssistantLinkClick = (e) => {
|
|
1624
|
+
const t = e.composedPath().find((n) => n instanceof HTMLAnchorElement);
|
|
1625
|
+
if (t?.href)
|
|
1626
|
+
if (e.preventDefault(), t.target.indexOf("solutionId:") > -1) {
|
|
1627
|
+
const n = t.target.split("solutionId:")[1];
|
|
1628
|
+
this._emitItemIdFromAI(n);
|
|
1390
1629
|
} else
|
|
1391
|
-
window.open(
|
|
1630
|
+
window.open(t.href, "_blank", "noopener,noreferrer");
|
|
1392
1631
|
}, this._onSolutionDesignUpdate = (e) => {
|
|
1393
|
-
const
|
|
1394
|
-
this._solutionDesignJson =
|
|
1632
|
+
const n = e.detail;
|
|
1633
|
+
this._solutionDesignJson = n ? JSON.stringify(n, null, 2) : '{ "solution": null }';
|
|
1395
1634
|
}, this._handleSignIn = () => {
|
|
1396
1635
|
this._configContextConsumer.value?.authentication?.signIn("aiOpen");
|
|
1397
1636
|
}, this._checkURLOpenParameter = () => {
|
|
1398
1637
|
this.open = this._configContextConsumer.value?.authentication?.SignInParam === "aiOpen" || this.open;
|
|
1399
1638
|
}, this.listenOn(window, "arcgisFeedback", (e) => {
|
|
1400
|
-
const
|
|
1401
|
-
this._sendFeedback(
|
|
1639
|
+
const t = e.detail, { agentPicked: n, taskAssigned: i, userMessage: o } = this._parseAgentPickedAndTask(t);
|
|
1640
|
+
this._sendFeedback(t.content, o ?? i ?? "", t.feedback?.positive ? "Good" : t.feedback?.positive == "Bad" ? "Bad" : "N/A", n ?? "");
|
|
1402
1641
|
}), this.listenOn(window, "clearAssistantConversation", () => {
|
|
1403
1642
|
this._clearConversation();
|
|
1404
1643
|
});
|
|
@@ -1407,7 +1646,7 @@ class ms extends Fe {
|
|
|
1407
1646
|
this.properties = { open: 5, userFirstName: 1, builderVisible: 5, hasActiveBuilderDesign: 5, _conversationId: 16, _lastTurnAgent: 16, _orgSettings: 16, _suggestedPrompts: 16, _hasInteracted: 16, _isMobile: 16, _translations: 16, _builderWidth: 16, _solutionDesignJson: 16, _isAssistantBusy: 16, _isBuilderBusy: 16, _preChatCheck: 16, _showNewChatConfirm: 16 };
|
|
1408
1647
|
}
|
|
1409
1648
|
static {
|
|
1410
|
-
this.styles =
|
|
1649
|
+
this.styles = Ze;
|
|
1411
1650
|
}
|
|
1412
1651
|
get _telemetry() {
|
|
1413
1652
|
return this._configContextConsumer.value?.telemetrySession;
|
|
@@ -1422,39 +1661,39 @@ class ms extends Fe {
|
|
|
1422
1661
|
this._checkURLOpenParameter();
|
|
1423
1662
|
}
|
|
1424
1663
|
load() {
|
|
1425
|
-
|
|
1664
|
+
G.applicationName = "Solutions", this._configContextConsumer.value?.portalURL && (G.portalUrl = this._configContextConsumer.value.portalURL);
|
|
1426
1665
|
}
|
|
1427
1666
|
firstUpdated(e) {
|
|
1428
1667
|
this._loadUserFirstName();
|
|
1429
1668
|
}
|
|
1430
1669
|
willUpdate(e) {
|
|
1431
|
-
e.has("open") && this.open && window.dispatchEvent(new CustomEvent("openAssistant")), this._configContextConsumer.value?.authentication && this._configContextConsumer.value?.userSession?.token && (this._preChatCheck || (
|
|
1670
|
+
e.has("open") && this.open && window.dispatchEvent(new CustomEvent("openAssistant")), this._configContextConsumer.value?.authentication && this._configContextConsumer.value?.userSession?.token && (this._preChatCheck || (ve(this._configContextConsumer.value?.authentication.Portal, this._configContextConsumer.value?.userSession?.token, this._configContextConsumer.value?.locale ?? "en"), this._preChatCheck = !0)), this._configContextConsumer.value?.userSession?.token && this._configContextConsumer.value?.authentication?.CanUseAI;
|
|
1432
1671
|
}
|
|
1433
1672
|
_renderNoSign() {
|
|
1434
|
-
return
|
|
1673
|
+
return T`<calcite-notice class="margin-lg" open scale=m icon=effects kind=info><div slot=message>${this._translations.signInMessage}</div><calcite-link @click=${this._handleSignIn} slot=link title=${this._translations.signInMessage ?? re} class="padding-top-10">${this._translations.signIn}</calcite-link></calcite-notice>`;
|
|
1435
1674
|
}
|
|
1436
1675
|
_renderNoPermission() {
|
|
1437
|
-
return
|
|
1676
|
+
return T`<calcite-notice class="margin-lg" open scale=m icon=effects kind=info><div slot=title>${this._translations.noPermissionTitle}</div><div slot=message class="padding-top-10">${Re(this._translations.noPermissionMessage.replace("{{orgUrl}}", ys).replace("{{configAI}}", bs))}</div></calcite-notice>`;
|
|
1438
1677
|
}
|
|
1439
1678
|
render() {
|
|
1440
1679
|
let e = this._suggestedPrompts.length > 0 ? this._suggestedPrompts : this._hasInteracted ? [] : Object.values(this._translations.defaultFollowUpQuestions);
|
|
1441
|
-
return this._suggestedPrompts.length > 0 ? e = this._suggestedPrompts : this._hasInteracted || (e = [...Object.values(this._translations.defaultFollowUpQuestions)]),
|
|
1680
|
+
return this._suggestedPrompts.length > 0 ? e = this._suggestedPrompts : this._hasInteracted || (e = [...Object.values(this._translations.defaultFollowUpQuestions)]), T`<calcite-panel class="chat-panel"><div class="header-content" slot=header-content><span class="header-title">${this._translations.solutionAssistantTitle}</span></div>${this._configContextConsumer.value?.userSession?.token ? this._configContextConsumer.value?.authentication?.CanUseAI ? T`${!this._isMobile && T`<calcite-action id=solutionBuilderAction icon=pencil-square .text=${this._translations.tooltips.builder} text-enabled .indicator=${this.hasActiveBuilderDesign} .disabled=${!this.hasActiveBuilderDesign} .active=${this.builderVisible} selection-appearance=highlight @click=${() => {
|
|
1442
1681
|
this._telemetry?.logEvent({
|
|
1443
|
-
category:
|
|
1682
|
+
category: M.ASSISTANT,
|
|
1444
1683
|
action: "Toggle Builder Panel",
|
|
1445
1684
|
dimensions: [this.builderVisible ? "Close" : "Open"]
|
|
1446
1685
|
}), window.dispatchEvent(new CustomEvent("toggleSolutionBuilder"));
|
|
1447
|
-
}} scale=m slot=header-actions-end></calcite-action>` || ""}${!this._isMobile &&
|
|
1448
|
-
console.log("arcgis submit: ",
|
|
1449
|
-
}} @arcgisFeedback=${(
|
|
1450
|
-
|
|
1451
|
-
}} ${
|
|
1686
|
+
}} scale=m slot=header-actions-end></calcite-action>` || ""}${!this._isMobile && T`<calcite-tooltip placement=bottom reference-element=solutionBuilderAction><span>${this._translations.tooltips.solutionBuilder}</span></calcite-tooltip>` || ""}<arcgis-assistant reference-element copy-enabled feedback-enabled heading description entry-message=${this._translations.defaultStartUpMessage ?? re} .suggestedPrompts=${e} @arcgisSubmit=${(t) => {
|
|
1687
|
+
console.log("arcgis submit: ", t.detail), this._suggestedPrompts = [], e = [], this._hasInteracted = !0, this._chatStartTime = Date.now(), this.assistantProcessing.emit(!0);
|
|
1688
|
+
}} @arcgisFeedback=${(t) => {
|
|
1689
|
+
t.detail;
|
|
1690
|
+
}} ${Oe(this._assistantRef)}><calcite-button appearance=transparent id=newChatButton icon-start=speech-bubble-plus kind=neutral .label=${this._translations.tooltips.newChat} @click=${() => {
|
|
1452
1691
|
this.hasActiveBuilderDesign ? this._showNewChatConfirm = !0 : (this._telemetry?.logEvent({
|
|
1453
|
-
category:
|
|
1692
|
+
category: M.ASSISTANT,
|
|
1454
1693
|
action: "New Chat",
|
|
1455
1694
|
dimensions: ["No Active Design"]
|
|
1456
1695
|
}), this._clearConversation());
|
|
1457
|
-
}} round scale=m slot=entry-actions-start>${this._translations.tooltips.newChat}</calcite-button><arcgis-assistant-agent .agent=${
|
|
1696
|
+
}} round scale=m slot=entry-actions-start>${this._translations.tooltips.newChat}</calcite-button><arcgis-assistant-agent .agent=${fs} .context=${{
|
|
1458
1697
|
token: this._configContextConsumer.value?.userSession?.token,
|
|
1459
1698
|
configContext: this._configContextConsumer.value,
|
|
1460
1699
|
convoId: this._conversationId,
|
|
@@ -1463,20 +1702,20 @@ class ms extends Fe {
|
|
|
1463
1702
|
translations: this._translations,
|
|
1464
1703
|
solutionDesignJson: this._solutionDesignJson,
|
|
1465
1704
|
lastTurnAgent: this._lastTurnAgent,
|
|
1466
|
-
setConversationId: (
|
|
1467
|
-
this._conversationId =
|
|
1705
|
+
setConversationId: (t) => {
|
|
1706
|
+
this._conversationId = t;
|
|
1468
1707
|
},
|
|
1469
|
-
setLastTurnAgent: (
|
|
1470
|
-
this._lastTurnAgent =
|
|
1708
|
+
setLastTurnAgent: (t) => {
|
|
1709
|
+
this._lastTurnAgent = t;
|
|
1471
1710
|
},
|
|
1472
1711
|
clearSuggestedPrompts: () => {
|
|
1473
1712
|
this._suggestedPrompts = [];
|
|
1474
1713
|
}
|
|
1475
|
-
}}></arcgis-assistant-agent></arcgis-assistant><div slot=footer class="disclaimer-div width-100"><calcite-chip class="beta-chip" appearance=solid kind=neutral .label=${this._translations.betaTag} scale=s>${this._translations.betaTag}</calcite-chip><span>${this._translations.disclaimerMessage} <a href=https://links.esri.com/solutions/security-concern rel="noopener noreferrer" target=_blank>${this._translations.reportConcern}</a></span></div>` : this._renderNoPermission() : this._renderNoSign()}${this._showNewChatConfirm &&
|
|
1714
|
+
}}></arcgis-assistant-agent></arcgis-assistant><div slot=footer class="disclaimer-div width-100"><calcite-chip class="beta-chip" appearance=solid kind=neutral .label=${this._translations.betaTag} scale=s>${this._translations.betaTag}</calcite-chip><span>${this._translations.disclaimerMessage} <a href=https://links.esri.com/solutions/security-concern rel="noopener noreferrer" target=_blank>${this._translations.reportConcern}</a></span></div>` : this._renderNoPermission() : this._renderNoSign()}${this._showNewChatConfirm && T`<calcite-dialog close-disabled escape-disabled .heading=${this._translations.newConversationConfirmTitle} modal open outside-close-disabled>${this._translations.builderMessages.discardMessage}<calcite-button appearance=outline @click=${() => {
|
|
1476
1715
|
this._showNewChatConfirm = !1;
|
|
1477
1716
|
}} slot=footer-end>${this._translations.cancel}</calcite-button><calcite-button appearance=solid kind=danger @click=${() => {
|
|
1478
1717
|
this._telemetry?.logEvent({
|
|
1479
|
-
category:
|
|
1718
|
+
category: M.ASSISTANT,
|
|
1480
1719
|
action: "New Chat",
|
|
1481
1720
|
dimensions: ["With Design Discard"]
|
|
1482
1721
|
}), this._showNewChatConfirm = !1, window.dispatchEvent(new CustomEvent("requestBuilderDiscard"));
|
|
@@ -1487,40 +1726,40 @@ class ms extends Fe {
|
|
|
1487
1726
|
_clearConversation() {
|
|
1488
1727
|
this._conversationId = void 0, this._lastTurnAgent = void 0, this._suggestedPrompts = [], this._hasInteracted = !1, this._assistantRef.value?.clearChatHistory();
|
|
1489
1728
|
}
|
|
1490
|
-
_sendFeedback(e,
|
|
1491
|
-
const o = `https://survey123.arcgis.com/share/6e349a50b4504ca6b6107216d568db5f?field:_source=${encodeURIComponent("Solutions Assistant")}&field:user_evaluation=${encodeURIComponent(
|
|
1729
|
+
_sendFeedback(e, t, n, i) {
|
|
1730
|
+
const o = `https://survey123.arcgis.com/share/6e349a50b4504ca6b6107216d568db5f?field:_source=${encodeURIComponent("Solutions Assistant")}&field:user_evaluation=${encodeURIComponent(n)}&field:question=${encodeURIComponent(t)}&field:answer=${encodeURIComponent(e)}&field:context=${encodeURIComponent(JSON.stringify({ agent: i }))}&field:version=${encodeURIComponent("v2")}`;
|
|
1492
1731
|
window.open(o, "_blank");
|
|
1493
1732
|
}
|
|
1494
1733
|
async _loadUserFirstName() {
|
|
1495
1734
|
try {
|
|
1496
1735
|
const e = await this._configContextConsumer.value?.userSession?.getUser();
|
|
1497
1736
|
if (e?.fullName) {
|
|
1498
|
-
const
|
|
1499
|
-
this.userFirstName =
|
|
1737
|
+
const t = e.fullName.split(" ")[0];
|
|
1738
|
+
this.userFirstName = t;
|
|
1500
1739
|
}
|
|
1501
1740
|
} catch {
|
|
1502
1741
|
}
|
|
1503
1742
|
}
|
|
1504
1743
|
_parseAgentPickedAndTask(e) {
|
|
1505
|
-
const
|
|
1506
|
-
if (!
|
|
1744
|
+
const t = Array.from(this._assistantRef.value?.messages || []), n = e.log || [], a = [...t].sort((u, g) => g.id - u.id).find((u) => u.role === "user" && u.id <= e.id)?.content || null, r = n.find((u) => typeof u == "string" && u.includes("Agent picked:")) ?? null;
|
|
1745
|
+
if (!r)
|
|
1507
1746
|
return { agentPicked: null, taskAssigned: null, userMessage: a };
|
|
1508
|
-
const
|
|
1509
|
-
if (!
|
|
1747
|
+
const c = /Agent picked:\s*(.*?)\s*(?:\\n|\r?\n)\s*Task Assigned:\s*([\s\S]*)$/i, d = r.match(c);
|
|
1748
|
+
if (!d)
|
|
1510
1749
|
return { agentPicked: null, taskAssigned: null, userMessage: a };
|
|
1511
|
-
const
|
|
1512
|
-
return { agentPicked:
|
|
1750
|
+
const h = d[1].trim(), y = d[2].trim();
|
|
1751
|
+
return { agentPicked: h, taskAssigned: y, userMessage: a };
|
|
1513
1752
|
}
|
|
1514
1753
|
_emitItemIdFromAI(e) {
|
|
1515
|
-
const
|
|
1754
|
+
const t = new CustomEvent("solutionIDFromAssistant", {
|
|
1516
1755
|
detail: e,
|
|
1517
1756
|
bubbles: !0,
|
|
1518
1757
|
composed: !0
|
|
1519
1758
|
});
|
|
1520
|
-
window.dispatchEvent(
|
|
1759
|
+
window.dispatchEvent(t);
|
|
1521
1760
|
}
|
|
1522
1761
|
}
|
|
1523
|
-
|
|
1762
|
+
Ne("arcgis-solutions-assistant", xs);
|
|
1524
1763
|
export {
|
|
1525
|
-
|
|
1764
|
+
xs as ArcgisSolutionsAssistant
|
|
1526
1765
|
};
|