@esri/solutions-components 5.1.0-next.164 → 5.1.0-next.166
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/{XXQVYXGC.js → 25QYS4LE.js} +1 -1
- package/dist/cdn/275IZ5I6.js +5 -0
- package/dist/cdn/{KSAJFFJI.js → 2BI4S6V2.js} +1 -1
- package/dist/cdn/{SS6AENH6.js → 2BRPSISV.js} +1 -1
- package/dist/cdn/{QTFTJ4DQ.js → 2EXGHOIM.js} +1 -1
- package/dist/cdn/{S37TPZAO.js → 2LCG2XWX.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/2VG5GRFH.js +2 -0
- package/dist/cdn/{44EC2SD3.js → 2YC25V3L.js} +1 -1
- package/dist/cdn/{D4TEADUS.js → 37P3IMFV.js} +1 -1
- package/dist/cdn/{C5BQAX2M.js → 3A3CPQX4.js} +1 -1
- package/dist/cdn/{7RIJ2EMD.js → 3FKVBTJC.js} +1 -1
- package/dist/cdn/{Q4X6GXRI.js → 3JCHYXHA.js} +1 -1
- package/dist/cdn/{CPOZIWVH.js → 463CZQF6.js} +1 -1
- package/dist/cdn/{2V64PFN2.js → 46I7FRQJ.js} +1 -1
- package/dist/cdn/{BQ7O62CG.js → 47FRMYZ4.js} +1 -1
- package/dist/cdn/4A77MNRM.js +2 -0
- 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/66N4ZZKC.js +2 -0
- package/dist/cdn/6FY64JKN.js +2 -0
- package/dist/cdn/{EYJQEBDF.js → 6HZBPFHA.js} +1 -1
- package/dist/cdn/{FZNRD2XJ.js → 6WNKGSHD.js} +1 -1
- package/dist/cdn/6WPQPRJ5.js +49 -0
- package/dist/cdn/{MBVY6OPY.js → 743J2ZUC.js} +1 -1
- package/dist/cdn/{7YJMTZFC.js → 77753TPX.js} +1 -1
- package/dist/cdn/{LY3WRG7K.js → 7P57UVVG.js} +1 -1
- package/dist/cdn/{5W7G3TSG.js → 7X2SPNNK.js} +21 -19
- package/dist/cdn/{GABDTUB7.js → A6ZTIX3P.js} +1 -1
- package/dist/cdn/{Z226R5SF.js → ADURBGIK.js} +1 -1
- package/dist/cdn/{GUMEOBNQ.js → AFLXI5U2.js} +1 -1
- package/dist/cdn/{GVFCX2FF.js → APNDTPBA.js} +1 -1
- package/dist/cdn/{S47SVZPE.js → ARFBMFQW.js} +1 -1
- package/dist/cdn/{KU2LYW6K.js → BIX5DRQP.js} +1 -1
- package/dist/cdn/{G2RMWJ7R.js → BOFA5RH7.js} +1 -1
- package/dist/cdn/{H5KFQMYD.js → BT3FYIEX.js} +1 -1
- package/dist/cdn/{P7LSYADG.js → BWWX52HV.js} +1 -1
- package/dist/cdn/{QPX33Y62.js → BXSBR2GT.js} +1 -1
- package/dist/cdn/C47WRU5U.js +2 -0
- package/dist/cdn/{OG4BNL2Z.js → CDT6E3VG.js} +1 -1
- package/dist/cdn/CKWEF3KW.js +2 -0
- package/dist/cdn/{PN2P5EVA.js → CMCEF65U.js} +1 -1
- package/dist/cdn/CRDFUDM4.js +45 -0
- package/dist/cdn/{4AFANEZZ.js → CS5N3DOL.js} +1 -1
- package/dist/cdn/{J6CXULUZ.js → CVHZAZLS.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/{Q3MHT47G.js → DKZ4FZKK.js} +1 -1
- package/dist/cdn/{JCQQIAIE.js → DQ47P6ES.js} +1 -1
- package/dist/cdn/E3F63VW4.js +2 -0
- package/dist/cdn/EL3OIP52.js +31 -0
- package/dist/cdn/{Q6WCNWQE.js → ERLDQUNI.js} +1 -1
- 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/{XKEKXTL2.js → FSF3T3OT.js} +1 -1
- package/dist/cdn/{JFLG3EKT.js → FYJMHXWV.js} +1 -1
- package/dist/cdn/{C4F2OOUL.js → G2H3X6NS.js} +1 -1
- package/dist/cdn/{57SZHKM5.js → G4V4JPFI.js} +1 -1
- package/dist/cdn/{S4ZMJ42A.js → GDUCH242.js} +1 -1
- package/dist/cdn/{AV2Q4PBA.js → GI33DSVT.js} +1 -1
- package/dist/cdn/GJWHFH2F.js +2 -0
- 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/{A62EWI7L.js → H4LZV33O.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/{F5SUVMAE.js → HOCCKT72.js} +1 -1
- package/dist/cdn/{MISU75DC.js → HQCHD3FH.js} +1 -1
- package/dist/cdn/HXNARVYH.js +3 -0
- package/dist/cdn/{V7WSQCQY.js → IAEFPE3L.js} +1 -1
- package/dist/cdn/INLWMPGE.js +2 -0
- package/dist/cdn/{DVCYL5TO.js → IVKRYKER.js} +1 -1
- package/dist/cdn/IXPNZCW6.js +2 -0
- package/dist/cdn/{SMN3CVM5.js → IXRFWVBT.js} +1 -1
- package/dist/cdn/{XEYYUNNX.js → JGL4WYTO.js} +1 -1
- package/dist/cdn/{4G6CA64M.js → JS2MTHHP.js} +1 -1
- package/dist/cdn/{3LZFERNW.js → K4LZRLGL.js} +1 -1
- package/dist/cdn/{YNCRTGYJ.js → K5ZYDQR7.js} +1 -1
- package/dist/cdn/{QH6PUU3Q.js → KD4IHPH6.js} +1 -6
- package/dist/cdn/{DF7TCZUS.js → KDDHPA54.js} +1 -1
- package/dist/cdn/{3IO2JXVB.js → KR2PPIBX.js} +1 -1
- package/dist/cdn/KWAQEZ3T.js +136 -0
- 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/{MICWKD3Q.js → LXNQ32NZ.js} +1 -1
- package/dist/cdn/{55QBAVPE.js → M6AOD7GG.js} +1 -1
- package/dist/cdn/{SNZRQPXI.js → MFVXFKKM.js} +1 -1
- package/dist/cdn/{XM3SRZWV.js → MIV34H66.js} +1 -1
- package/dist/cdn/{EF2TTWG5.js → MKSUYITL.js} +1 -1
- package/dist/cdn/MV7GEGP5.js +98 -0
- package/dist/cdn/{OZSFGLR6.js → MVDJOENC.js} +2 -2
- package/dist/cdn/{26QXT6ZT.js → O4DB2EXV.js} +1 -1
- package/dist/cdn/P5RZHVDH.js +2 -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/PVPKXQBE.js +340 -0
- package/dist/cdn/{UBPOT5V3.js → QMAV4UTN.js} +1 -1
- package/dist/cdn/{WGRSVQHE.js → QVUBUYP6.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/{R3PYC2H6.js → RHAHQ4DB.js} +1 -1
- package/dist/cdn/{I2NTSKBD.js → RLSY4VUQ.js} +1 -1
- package/dist/cdn/{TSUSILGP.js → RSCCUNJ4.js} +1 -1
- package/dist/cdn/{EFYLYWPE.js → RYJ556XB.js} +1 -1
- package/dist/cdn/{HVT2WBVC.js → S4GBMN37.js} +1 -1
- package/dist/cdn/{L4BYLII5.js → S5RB3GMN.js} +1 -1
- package/dist/cdn/{KTRKTBPS.js → SGFSVWTY.js} +1 -1
- package/dist/cdn/SHQFXQEI.js +2 -0
- package/dist/cdn/{IXBI3PV7.js → SJ2IGQMX.js} +1 -1
- package/dist/cdn/{5F6KCXYP.js → SJLSYFK3.js} +1 -1
- package/dist/cdn/T26SIBKB.js +3 -0
- package/dist/cdn/T3EPRHTT.js +4 -0
- package/dist/cdn/{IXLVTSCY.js → TCRMAQDF.js} +1 -1
- package/dist/cdn/TFO2AK45.js +2 -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/U76GHEKJ.js +71 -0
- package/dist/cdn/{FBGCV6YJ.js → UCYR537P.js} +1 -1
- package/dist/cdn/{NQBHAESW.js → UEYON3AE.js} +1 -1
- package/dist/cdn/UIZL3C3H.js +2 -0
- package/dist/cdn/{WQHJMFGP.js → UTUOUV3E.js} +1 -1
- package/dist/cdn/{DJYT367X.js → V5BIPD5T.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/{RBSOCHJT.js → VTFLDHVU.js} +1 -1
- package/dist/cdn/{VTAQ6NBB.js → VUXNHQGR.js} +1 -1
- package/dist/cdn/{BATEZR3T.js → WNVC3PSY.js} +1 -1
- package/dist/cdn/{JEIP7CJK.js → XKFX43FE.js} +1 -1
- package/dist/cdn/XLGAHCS7.js +2 -0
- package/dist/cdn/{GLC7JVKG.js → XQ7SXIHI.js} +1 -1
- package/dist/cdn/{CKURBJFW.js → XXCHYJ3I.js} +1 -1
- package/dist/cdn/{ISFTCFSJ.js → Y2AUIXNK.js} +1 -1
- package/dist/cdn/{CZ4A24AM.js → Y32IJPXS.js} +1 -1
- package/dist/cdn/{QWGJAD3Z.js → YPBSKBT2.js} +1 -1
- package/dist/cdn/YPDXQEUA.js +77 -0
- package/dist/cdn/{SXECIQ6Q.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/YVWFYZTI.js +4 -0
- package/dist/cdn/{3QONPAFM.js → YWX2U5OD.js} +1 -1
- package/dist/cdn/{V5WXJLJN.js → Z7VXHUQA.js} +1 -1
- package/dist/cdn/{X7WLU5YB.js → ZOFZVFBV.js} +1 -1
- package/dist/cdn/ZSTC2DJY.js +2 -0
- package/dist/cdn/{IEXNY45H.js → ZWASNOIQ.js} +1 -1
- package/dist/cdn/{5NZT27OV.js → ZZOMKTFL.js} +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/assessBuildRequest.js +1 -6
- package/dist/chunks/assessUpdateRequest.js +21 -19
- package/dist/chunks/classifyIntent.js +31 -44
- package/dist/chunks/converter.js +75 -44
- package/dist/chunks/interfaces.js +26 -26
- package/dist/chunks/solution-builder-assistant.js +21 -23
- package/dist/chunks/transformQuery.js +1 -1
- package/dist/chunks/updateDesign.js +1 -1
- package/dist/chunks/validators.js +4 -3
- package/dist/components/arcgis-solutions-assistant/customElement.js +996 -737
- package/dist/components/solutions-deploy-app/customElement.js +1 -1
- package/dist/components/solutions-searchsort-toolbar/customElement.js +1 -1
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/solutions-components_commit.txt +8 -5
- package/package.json +1 -1
- package/dist/cdn/5M3PCZM5.js +0 -2
- package/dist/cdn/62GTPPV5.js +0 -2
- package/dist/cdn/7VD3Y4IF.js +0 -2
- package/dist/cdn/B5JYLQYP.js +0 -2
- package/dist/cdn/DKXVDY6L.js +0 -2
- package/dist/cdn/FE7HMUSZ.js +0 -2
- package/dist/cdn/FFF5HUPM.js +0 -4
- package/dist/cdn/FZUI77EG.js +0 -2
- package/dist/cdn/I7MO6UJB.js +0 -2
- package/dist/cdn/J6OVONBB.js +0 -2
- package/dist/cdn/JDI57IEI.js +0 -98
- package/dist/cdn/LDSV7DEV.js +0 -2
- package/dist/cdn/LHTDVWX2.js +0 -90
- package/dist/cdn/LQXIFBIM.js +0 -3
- package/dist/cdn/O4VFFJLQ.js +0 -2
- package/dist/cdn/SIODWUWX.js +0 -2
- package/dist/cdn/SYISCXZY.js +0 -4
- package/dist/cdn/TGMVIKID.js +0 -2
- package/dist/cdn/UHJVBWUV.js +0 -434
- package/dist/cdn/V4O3KYPD.js +0 -2
- package/dist/cdn/V4ZJH2HP.js +0 -2
- package/dist/cdn/VCLTCEIQ.js +0 -2
- package/dist/cdn/VHYS3SP3.js +0 -2
- package/dist/cdn/WRQXYCRH.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
|
-
|
|
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)}@media(resolution:1.25dppx),(resolution:1.75dppx){.chat-panel{margin-top:.5px}}.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(
|
|
27
28
|
([i]) => i.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((i) => i.solution.id), t = s.map((i) => i.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,41 +61,41 @@ 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, i) => `<img src="${i}" alt="${t}" style="width: 100%;">`);
|
|
85
86
|
}
|
|
86
|
-
function
|
|
87
|
-
const
|
|
87
|
+
function it(s, e) {
|
|
88
|
+
const t = [];
|
|
88
89
|
return (e?.configurable?.context?.configContext.allCards ?? []).forEach((n) => {
|
|
89
90
|
const o = n.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:${n.deployCommonId}">${o}</a>`);
|
|
98
|
+
}), r && t.push({
|
|
98
99
|
solution: {
|
|
99
100
|
title: n.title,
|
|
100
101
|
id: n.deployCommonId,
|
|
@@ -103,71 +104,71 @@ function Xe(t, e) {
|
|
|
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
|
+
async function Q(s, e, t) {
|
|
115
116
|
const i = 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
124
|
if (!i.ok)
|
|
124
125
|
throw new Error(`HTTP ${i.status} calling ${e}`);
|
|
125
126
|
return i.json();
|
|
126
127
|
}
|
|
127
|
-
const
|
|
128
|
-
async function
|
|
129
|
-
const
|
|
128
|
+
const ot = (s) => new Promise((e) => setTimeout(e, s));
|
|
129
|
+
async function at(s, e) {
|
|
130
|
+
const t = s.agentExecutionContext.userRequest, i = e?.configurable?.context?.lastTurnAgent, n = s.agentExecutionContext.messages ?? [];
|
|
130
131
|
if (!i || n.length <= 1 || i === "explorer")
|
|
131
|
-
return
|
|
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
|
-
modelTier: "
|
|
136
|
+
modelTier: "advanced",
|
|
136
137
|
temperature: 0,
|
|
137
|
-
schema:
|
|
138
|
+
schema: et,
|
|
138
139
|
messages: n.slice(-11),
|
|
139
|
-
inputVariables: { query:
|
|
140
|
+
inputVariables: { query: t, lastTurnAgent: i }
|
|
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 n =
|
|
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, i) => {
|
|
170
|
+
if (!s) return;
|
|
171
|
+
const n = xe(s);
|
|
171
172
|
if (!n) return;
|
|
172
173
|
const a = { context: {
|
|
173
174
|
kind: "DocAIAssistantRequest",
|
|
@@ -175,22 +176,22 @@ const st = y.Root({
|
|
|
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
|
-
i && (a.conversationId = i),
|
|
183
|
-
},
|
|
184
|
-
if (e
|
|
183
|
+
i && (a.conversationId = i), Q(a, n, e ?? "");
|
|
184
|
+
}, ct = async (s, e) => {
|
|
185
|
+
if (ce(e))
|
|
185
186
|
return {};
|
|
186
|
-
const
|
|
187
|
+
const t = U(e), i = s.documentSkillUrl;
|
|
187
188
|
let n = [];
|
|
188
|
-
const o = await
|
|
189
|
-
await
|
|
190
|
-
{ text:
|
|
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,
|
|
@@ -209,100 +210,120 @@ const st = y.Root({
|
|
|
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
|
-
|
|
223
|
+
const S = tt(u), N = st(S), C = it(N, e);
|
|
224
|
+
c = C.source, n = [
|
|
224
225
|
...n,
|
|
225
|
-
...
|
|
226
|
-
(
|
|
226
|
+
...C.allMatches.filter(
|
|
227
|
+
(z) => !n.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
|
i,
|
|
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
|
-
), n.length && (n.length === 1 ?
|
|
261
|
-
outputMessage:
|
|
262
|
-
summary:
|
|
260
|
+
r.conversationId
|
|
261
|
+
), n.length && (n.length === 1 ? ye(n[0].solution.id) : fe(n)), {
|
|
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((n) => n.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, i = !0) {
|
|
311
|
+
this.isValid = !0, this.issues = [], this.fieldNameRegistry = null, this.response = e, this.template = t, this.newDesign = i, 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,171 @@ 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
|
|
332
|
-
|
|
360
|
+
const e = new Set(this.response.solution.strings.map((n) => n.key)), t = new Map(this.template.solution.strings.map((n) => [n.key, n]));
|
|
361
|
+
[...t.keys()].every((n) => e.has(n)) || (this.newDesign ? this._reconcileStringKeys() : this._logIssue("String keys in llm response do not match the template."));
|
|
362
|
+
for (const n of this.response.solution.strings) {
|
|
363
|
+
if (n.value)
|
|
364
|
+
continue;
|
|
365
|
+
const o = t.get(n.key)?.value;
|
|
366
|
+
this.newDesign && o ? (n.value = o, this._logAutoFix(`String key '${n.key}' had no value. Auto-fixed by restoring the template value.`)) : this._logIssue(`String key '${n.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((
|
|
339
|
-
e.size ===
|
|
386
|
+
const e = new Set(this.template.items.map((n) => n.id)), t = new Set(this.response.items.map((n) => n.id));
|
|
387
|
+
e.size === t.size && [...e].every((n) => t.has(n)) || (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
|
+
* Special case: when both sides have the same number of unique item ids and
|
|
394
|
+
* exactly one id differs, update that response item id in place to preserve
|
|
395
|
+
* any other user-edited properties on the item.
|
|
396
|
+
*/
|
|
397
|
+
_reconcileItems() {
|
|
398
|
+
const e = new Set(this.template.items.map((a) => a.id)), t = new Set(this.response.items.map((a) => a.id)), i = [...t].filter((a) => !e.has(a)), n = [...e].filter((a) => !t.has(a));
|
|
399
|
+
if (e.size === t.size && i.length === 1 && n.length === 1) {
|
|
400
|
+
const a = i[0], r = n[0], c = this.response.items.find((d) => d.id === a);
|
|
401
|
+
if (c) {
|
|
402
|
+
c.id = r, this._logAutoFix(`Item id '${a}' did not match the template id '${r}'. Auto-fixed in place.`);
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
i.length && (this.response.items = this.response.items.filter((a) => e.has(a.id)), this._logAutoFix(`Removed items not present in the template: ${i.join(", ")}.`));
|
|
407
|
+
const o = this.template.items.filter((a) => !t.has(a.id));
|
|
408
|
+
if (o.length) {
|
|
409
|
+
this.response.items = [
|
|
410
|
+
...o.map((a) => ({ ...a })),
|
|
411
|
+
...this.response.items
|
|
412
|
+
];
|
|
413
|
+
for (const a of o)
|
|
414
|
+
this._logAutoFix(`Item '${a.id}' was missing from the design. Auto-fixed by adding it from the template.`);
|
|
415
|
+
}
|
|
340
416
|
}
|
|
341
417
|
/**
|
|
342
418
|
* Compares feature layer configuration between response and template.
|
|
343
419
|
*/
|
|
344
420
|
_compareFeatureLayers() {
|
|
345
|
-
const e = this.template.featureLayer,
|
|
346
|
-
if (e.itemId !==
|
|
347
|
-
|
|
348
|
-
|
|
421
|
+
const e = this.template.featureLayer, t = this.response.featureLayer;
|
|
422
|
+
if (e.itemId !== t.itemId) {
|
|
423
|
+
const i = t.itemId;
|
|
424
|
+
t.itemId = e.itemId, this._logAutoFix(`Feature Layer itemId '${i}' did not match the template. Auto-fixed to '${e.itemId}'.`);
|
|
349
425
|
}
|
|
350
426
|
if (!e.addLayers) {
|
|
351
|
-
const i = new Set(e.layers.map((o) => o.id)), n = new Set(
|
|
427
|
+
const i = new Set(e.layers.map((o) => o.id)), n = new Set(t.layers.map((o) => o.id));
|
|
352
428
|
if (!(i.size === n.size && [...i].every((o) => n.has(o))))
|
|
353
429
|
this._logIssue(`Feature Layer '${e.itemId}' had its layer ids altered.`);
|
|
354
430
|
else
|
|
355
|
-
for (const o of e.layers)
|
|
431
|
+
for (const o of e.layers) {
|
|
356
432
|
if (o.type) {
|
|
357
|
-
const
|
|
358
|
-
|
|
433
|
+
const r = t.layers.find((c) => c.id === o.id);
|
|
434
|
+
if (r && r.type !== o.type)
|
|
435
|
+
if (this.newDesign) {
|
|
436
|
+
const c = r.type;
|
|
437
|
+
r.type = o.type, this._logAutoFix(`Layer '${o.id}' type '${c}' is immutable. Auto-fixed back to template type '${o.type}'.`);
|
|
438
|
+
} else
|
|
439
|
+
this._logIssue(`Layer '${o.id}' type '${r.type}' does not match template type '${o.type}'. This layer type is immutable.`);
|
|
359
440
|
}
|
|
441
|
+
const a = t.layers.find((r) => r.id === o.id);
|
|
442
|
+
a && this._validateRequiredFields(a, o);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Validates required fields against the template. Required fields are matched by
|
|
448
|
+
* name. Users may change a required field's `alias` and `description`, but its
|
|
449
|
+
* `name`, `type`, `length`, and `choiceList` are immutable.
|
|
450
|
+
*
|
|
451
|
+
* On new designs, missing required fields are re-injected and tampered immutable
|
|
452
|
+
* properties are reverted to the template. Otherwise, issues are logged.
|
|
453
|
+
*/
|
|
454
|
+
_validateRequiredFields(e, t) {
|
|
455
|
+
const i = new Map(
|
|
456
|
+
e.requiredFields.map((n) => [n.name.toLowerCase(), n])
|
|
457
|
+
);
|
|
458
|
+
for (const n of t.requiredFields) {
|
|
459
|
+
const o = i.get(n.name.toLowerCase());
|
|
460
|
+
if (!o) {
|
|
461
|
+
this.newDesign ? (e.requiredFields.push({ ...n }), this._logAutoFix(`Layer '${e.name}' was missing required field '${n.name}'. Auto-fixed by re-adding it from the template.`)) : this._logIssue(`Layer '${e.name}' is missing required field '${n.name}'.`);
|
|
462
|
+
continue;
|
|
463
|
+
}
|
|
464
|
+
this._enforceRequiredFieldImmutability(e, o, n);
|
|
360
465
|
}
|
|
361
466
|
}
|
|
467
|
+
/**
|
|
468
|
+
* Enforces immutability of a required field's `type`, `length`, and `choiceList`
|
|
469
|
+
* (its `name` is the match key, so it is equal by construction). On new designs the
|
|
470
|
+
* properties are reverted to the template; otherwise an issue is logged.
|
|
471
|
+
*/
|
|
472
|
+
_enforceRequiredFieldImmutability(e, t, i) {
|
|
473
|
+
const n = [];
|
|
474
|
+
if (t.type !== i.type && n.push("type"), (t.length ?? null) !== (i.length ?? null) && n.push("length"), this._choiceListsEqual(t.choiceList, i.choiceList) || n.push("choiceList"), !n.length)
|
|
475
|
+
return;
|
|
476
|
+
const o = n.length === 1 ? "property" : "properties";
|
|
477
|
+
this.newDesign ? (t.type = i.type, t.length = i.length, t.choiceList = Array.isArray(i.choiceList) ? [...i.choiceList] : i.choiceList ?? null, this._logAutoFix(`Layer '${e.name}' required field '${i.name}' changed immutable ${o} (${n.join(", ")}). Auto-fixed by reverting to the template.`)) : this._logIssue(`Layer '${e.name}' required field '${i.name}' changed immutable ${o} (${n.join(", ")}). These cannot be modified.`);
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Set-based equality check for two choiceList values (order-insensitive),
|
|
481
|
+
* treating null/undefined/non-array as "no domain".
|
|
482
|
+
*/
|
|
483
|
+
_choiceListsEqual(e, t) {
|
|
484
|
+
const i = Array.isArray(e) ? e : null, n = Array.isArray(t) ? t : null;
|
|
485
|
+
if (i === null && n === null)
|
|
486
|
+
return !0;
|
|
487
|
+
if (i === null || n === null)
|
|
488
|
+
return !1;
|
|
489
|
+
const o = new Set(i), a = new Set(n);
|
|
490
|
+
return o.size === a.size && [...o].every((r) => a.has(r));
|
|
491
|
+
}
|
|
492
|
+
//--------------------------------------------------------------------------
|
|
493
|
+
//
|
|
494
|
+
// Validate
|
|
495
|
+
//
|
|
496
|
+
//--------------------------------------------------------------------------
|
|
362
497
|
/**
|
|
363
498
|
* Validates solution title and description.
|
|
364
499
|
*/
|
|
365
500
|
_validateSolutionProps() {
|
|
366
|
-
const e = this.response.solution.title,
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
501
|
+
const e = this.response.solution.title ?? "", t = this.response.solution.description, i = /[/\\]/u.test(e), n = this.newDesign ? e.replace(/[/\\]/gu, "") : e;
|
|
502
|
+
this.newDesign && n !== e ? (this.response.solution.title = n, this._logAutoFix("Solution title contained forward or back slashes. Auto-fixed by removing them.")) : !this.newDesign && i && this._logIssue("Solution title contains forbidden forward or back slashes.");
|
|
503
|
+
const o = H(n);
|
|
504
|
+
if (o.isValid || this._tryFixName(o.errorType, n, (a) => {
|
|
505
|
+
this.response.solution.title = a;
|
|
506
|
+
}, "Solution title", "Solution Title") || this._logIssue(`Solution title is invalid (${o.errorType}).`), t) {
|
|
507
|
+
const a = J(t, b.DESCRIPTION_MAX_LENGTH, !0);
|
|
508
|
+
a.isValid || this._tryFixDescription(t, (r) => {
|
|
509
|
+
this.response.solution.description = r;
|
|
510
|
+
}, "Solution description") || this._logIssue(`Solution description is invalid (${a.errorType}).`);
|
|
370
511
|
}
|
|
371
512
|
}
|
|
372
513
|
/**
|
|
@@ -377,12 +518,21 @@ class ve {
|
|
|
377
518
|
"Feature Layer (hosted)",
|
|
378
519
|
"Feature Layer (hosted, view)"
|
|
379
520
|
]);
|
|
380
|
-
for (const
|
|
381
|
-
e.has(
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
521
|
+
for (const t of this.response.items) {
|
|
522
|
+
if (e.has(t.type) && t.title.length > b.SERVICE_NAME_MAX_LENGTH)
|
|
523
|
+
if (this.newDesign) {
|
|
524
|
+
const n = t.title;
|
|
525
|
+
t.title = t.title.slice(0, b.SERVICE_NAME_MAX_LENGTH).trim(), this._logAutoFix(`Service name '${n}' exceeded ${b.SERVICE_NAME_MAX_LENGTH} characters. Auto-fixed to '${t.title}'.`);
|
|
526
|
+
} else
|
|
527
|
+
this._logIssue(`Service name '${t.title}' exceeds 100 characters.`);
|
|
528
|
+
const i = H(t.title ?? "");
|
|
529
|
+
if (i.isValid || this._tryFixName(i.errorType, t.title ?? "", (n) => {
|
|
530
|
+
t.title = n;
|
|
531
|
+
}, `Item '${t.id}' title`, "Item Title") || this._logIssue(`Item '${t.id}' title is invalid (${i.errorType}).`), t.description) {
|
|
532
|
+
const n = J(t.description, b.DESCRIPTION_MAX_LENGTH, !0);
|
|
533
|
+
n.isValid || this._tryFixDescription(t.description, (o) => {
|
|
534
|
+
t.description = o;
|
|
535
|
+
}, `Item '${t.id}' description`) || this._logIssue(`Item '${t.id}' description is invalid (${n.errorType}).`);
|
|
386
536
|
}
|
|
387
537
|
}
|
|
388
538
|
}
|
|
@@ -390,112 +540,134 @@ class ve {
|
|
|
390
540
|
* Validates feature layer structure and layers.
|
|
391
541
|
*/
|
|
392
542
|
_validateFeatureLayer() {
|
|
393
|
-
const e = this.template.featureLayer.layers;
|
|
394
543
|
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
|
-
}
|
|
544
|
+
const e = this.response.featureLayer.layers.map((t) => t.name.toLowerCase());
|
|
545
|
+
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}.`));
|
|
546
|
+
for (const t of this.response.featureLayer.layers)
|
|
547
|
+
this._validateLayer(t, this.response.featureLayer.addLayers);
|
|
402
548
|
}
|
|
403
549
|
/**
|
|
404
|
-
*
|
|
550
|
+
* Renames duplicate (case-insensitive) layer names by appending a numeric suffix.
|
|
405
551
|
*/
|
|
406
|
-
|
|
407
|
-
const
|
|
408
|
-
for (const
|
|
409
|
-
|
|
552
|
+
_dedupeLayerNames(e) {
|
|
553
|
+
const t = /* @__PURE__ */ new Set();
|
|
554
|
+
for (const i of e) {
|
|
555
|
+
const n = (i.name ?? "").toLowerCase();
|
|
556
|
+
if (t.has(n)) {
|
|
557
|
+
const o = i.name;
|
|
558
|
+
i.name = this._makeUniqueName(i.name ?? "Layer", t), this._logAutoFix(`Duplicate layer name '${o}'. Auto-fixed to '${i.name}'.`);
|
|
559
|
+
}
|
|
560
|
+
t.add(i.name.toLowerCase());
|
|
561
|
+
}
|
|
410
562
|
}
|
|
411
563
|
/**
|
|
412
564
|
* Validates a single layer configuration including name, description, and fields.
|
|
413
565
|
*/
|
|
414
|
-
_validateLayer(e,
|
|
415
|
-
!
|
|
566
|
+
_validateLayer(e, t) {
|
|
567
|
+
!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
568
|
`Layer '${e.name}' cannot be a Table. It may be a Point, Line, or Polygon.`
|
|
417
|
-
);
|
|
418
|
-
const i =
|
|
419
|
-
if (i.isValid || this.
|
|
420
|
-
|
|
421
|
-
|
|
569
|
+
));
|
|
570
|
+
const i = H(e.name ?? "");
|
|
571
|
+
if (i.isValid || this._tryFixName(i.errorType, e.name ?? "", (n) => {
|
|
572
|
+
e.name = n;
|
|
573
|
+
}, `Layer '${e.name}' name`, "Layer Title") || this._logIssue(`Layer '${e.name}' name is invalid (${i.errorType}).`), e.description) {
|
|
574
|
+
const n = J(e.description, b.DESCRIPTION_MAX_LENGTH, !0);
|
|
575
|
+
n.isValid || this._tryFixDescription(e.description, (o) => {
|
|
576
|
+
e.description = o;
|
|
577
|
+
}, `Layer '${e.name}' description`) || this._logIssue(`Layer '${e.name}' description is invalid (${n.errorType}).`);
|
|
422
578
|
}
|
|
423
579
|
this._validateLayerFields(e);
|
|
424
580
|
}
|
|
425
581
|
/**
|
|
426
582
|
* Validates all fields in a layer including custom, required, and system fields.
|
|
583
|
+
*
|
|
584
|
+
* Each field is validated individually first, which (among other checks)
|
|
585
|
+
* resolves collisions with reserved system field names. A final pass then
|
|
586
|
+
* ensures custom field names do not collide (case-insensitively) with required
|
|
587
|
+
* field names or one another — auto-fixed via {@link _makeUniqueName} on new
|
|
588
|
+
* designs, otherwise logged.
|
|
427
589
|
*/
|
|
428
590
|
_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);
|
|
591
|
+
const t = e.systemFields ?? [];
|
|
592
|
+
this.fieldNameRegistry = new Set(
|
|
593
|
+
[...e.customFields, ...e.requiredFields, ...t].map((o) => o.name.toLowerCase())
|
|
594
|
+
);
|
|
595
|
+
for (const o of [...e.customFields, ...e.requiredFields])
|
|
596
|
+
this._validateField(o);
|
|
458
597
|
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;
|
|
598
|
+
const i = new Set(e.requiredFields.map((o) => o.name.toLowerCase())), n = new Set(i);
|
|
599
|
+
for (const o of e.customFields) {
|
|
600
|
+
const a = o.name.toLowerCase();
|
|
601
|
+
if (n.has(a)) {
|
|
602
|
+
const r = i.has(a) ? "a required field name" : "another field with the same name";
|
|
603
|
+
if (this.newDesign) {
|
|
604
|
+
const c = o.name;
|
|
605
|
+
o.name = this._makeUniqueName(o.name, n), this._logAutoFix(`Layer '${e.name}' field '${c}' collided with ${r}. Auto-fixed to '${o.name}'.`);
|
|
606
|
+
} else
|
|
607
|
+
this._logIssue(`Layer '${e.name}' field '${o.name}' collides with ${r}.`);
|
|
608
|
+
}
|
|
609
|
+
n.add(o.name.toLowerCase());
|
|
474
610
|
}
|
|
475
|
-
return i.add(a.toLowerCase()), a;
|
|
476
611
|
}
|
|
477
612
|
/**
|
|
478
613
|
* Validates a single field including name, type, length, and domain constraints.
|
|
479
614
|
*/
|
|
480
615
|
_validateField(e) {
|
|
481
|
-
const
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
616
|
+
const t = /^\p{L}/u, i = /^.[\p{L}\p{M}\p{N}_]*$/u;
|
|
617
|
+
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).`));
|
|
618
|
+
const n = t.test(e.name), o = i.test(e.name);
|
|
619
|
+
if (!n || !o)
|
|
485
620
|
if (this.newDesign) {
|
|
486
|
-
const
|
|
487
|
-
e.name = this.
|
|
621
|
+
const a = e.name;
|
|
622
|
+
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
623
|
} else
|
|
489
|
-
this._logIssue(`Field '${e.name}'
|
|
490
|
-
|
|
624
|
+
n || this._logIssue(`Field '${e.name}' does not start with a letter.`), o || this._logIssue(
|
|
625
|
+
`Field '${e.name}' contains invalid characters (only letters from any writing system, numbers, and underscores are allowed; emojis and punctuation are not allowed).`
|
|
626
|
+
);
|
|
627
|
+
if (e.name.length > b.FIELD_NAME_MAX_LENGTH)
|
|
491
628
|
if (this.newDesign) {
|
|
492
|
-
const
|
|
493
|
-
e.name =
|
|
629
|
+
const a = e.name;
|
|
630
|
+
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}'.`);
|
|
631
|
+
} else
|
|
632
|
+
this._logIssue(`Field '${e.name}' exceeds ${b.FIELD_NAME_MAX_LENGTH} characters.`);
|
|
633
|
+
if (Je.has(e.name.toLowerCase()))
|
|
634
|
+
if (this.newDesign) {
|
|
635
|
+
const a = e.name;
|
|
636
|
+
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
637
|
} else
|
|
495
638
|
this._logIssue(`Field '${e.name}' is a SQL reserved keyword.`);
|
|
496
|
-
if (
|
|
497
|
-
|
|
498
|
-
|
|
639
|
+
if (Ve.has(e.name.toLowerCase()))
|
|
640
|
+
if (this.newDesign) {
|
|
641
|
+
const a = e.name;
|
|
642
|
+
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}'.`);
|
|
643
|
+
} else
|
|
644
|
+
this._logIssue(`Field '${e.name}' is a reserved system field name.`);
|
|
645
|
+
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) {
|
|
646
|
+
const a = Math.max(...e.choiceList.map((r) => r.length));
|
|
647
|
+
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.`));
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* New-design behavior: removes blank and duplicate domain values, and drops an
|
|
652
|
+
* empty domain entirely.
|
|
653
|
+
*/
|
|
654
|
+
_autoFixChoiceList(e) {
|
|
655
|
+
let t = e.choiceList;
|
|
656
|
+
const i = t.filter((o) => o?.trim());
|
|
657
|
+
i.length !== t.length && (this._logAutoFix(`Field '${e.name}' had blank domain values. Auto-fixed by removing them.`), t = i, e.choiceList = t);
|
|
658
|
+
const n = [...new Set(t)];
|
|
659
|
+
n.length !== t.length && (this._logAutoFix(`Field '${e.name}' had duplicate domain values. Auto-fixed by removing duplicates.`), t = n, e.choiceList = t), t.length || (this._logAutoFix(`Field '${e.name}' had an empty domain. Auto-fixed by removing the domain.`), e.choiceList = null);
|
|
660
|
+
}
|
|
661
|
+
/**
|
|
662
|
+
* Legacy behavior: logs domain (choiceList) content issues as validation issues.
|
|
663
|
+
*/
|
|
664
|
+
_logChoiceListIssues(e) {
|
|
665
|
+
if (Array.isArray(e.choiceList)) {
|
|
666
|
+
if (!e.choiceList.length) {
|
|
667
|
+
this._logIssue(`Field '${e.name}' has an empty domain. At least one value is required.`);
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
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
671
|
}
|
|
500
672
|
}
|
|
501
673
|
/**
|
|
@@ -507,17 +679,100 @@ class ve {
|
|
|
507
679
|
this._handleInvalidStringFieldLength(e, 256);
|
|
508
680
|
return;
|
|
509
681
|
}
|
|
510
|
-
const
|
|
511
|
-
if (!
|
|
512
|
-
const n =
|
|
682
|
+
const t = e.length;
|
|
683
|
+
if (!Ke(t).isValid) {
|
|
684
|
+
const n = t > 4e3 ? 4e3 : 256;
|
|
513
685
|
this._handleInvalidStringFieldLength(e, n);
|
|
514
686
|
}
|
|
515
687
|
}
|
|
516
688
|
/**
|
|
517
689
|
* Applies an auto-fix to a string field's length on new designs, or logs an issue on update design.
|
|
518
690
|
*/
|
|
519
|
-
_handleInvalidStringFieldLength(e,
|
|
520
|
-
this.newDesign ? (
|
|
691
|
+
_handleInvalidStringFieldLength(e, t) {
|
|
692
|
+
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).`);
|
|
693
|
+
}
|
|
694
|
+
//--------------------------------------------------------------------------
|
|
695
|
+
//
|
|
696
|
+
// Helpers / Utilities
|
|
697
|
+
//
|
|
698
|
+
//--------------------------------------------------------------------------
|
|
699
|
+
/**
|
|
700
|
+
* Returns a name not present (case-insensitively) in the taken set by appending
|
|
701
|
+
* a numeric suffix when needed.
|
|
702
|
+
*/
|
|
703
|
+
_makeUniqueName(e, t) {
|
|
704
|
+
let i = e, n = 1;
|
|
705
|
+
for (; t.has(i.toLowerCase()); )
|
|
706
|
+
i = `${e}_${n}`, n += 1;
|
|
707
|
+
return i;
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* Returns a field name truncated to the 31-character limit that does not collide
|
|
711
|
+
* (case-insensitively) with the supplied taken set, shortening the base and
|
|
712
|
+
* appending a numeric suffix as needed.
|
|
713
|
+
*/
|
|
714
|
+
_getUniqueTruncatedFieldName(e, t) {
|
|
715
|
+
const i = b.FIELD_NAME_MAX_LENGTH, n = e.slice(0, i);
|
|
716
|
+
let o = n, a = 1;
|
|
717
|
+
for (; t.has(o.toLowerCase()); ) {
|
|
718
|
+
const r = `_${a}`, c = Math.max(1, i - r.length);
|
|
719
|
+
o = `${n.slice(0, c)}${r}`, a += 1;
|
|
720
|
+
}
|
|
721
|
+
return o;
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Sanitizes an item-style name by stripping emojis and disallowed characters,
|
|
725
|
+
* collapsing whitespace, trimming, and truncating to the name length limit.
|
|
726
|
+
* May return an empty string when no valid characters remain.
|
|
727
|
+
*/
|
|
728
|
+
_sanitizeItemName(e, t = b.NAME_MAX_LENGTH) {
|
|
729
|
+
let i = (e ?? "").replace(new RegExp(Qe.source, "gu"), "").replace(b.INVALID_NAME_CHARS, "").replace(/\s+/gu, " ").trim();
|
|
730
|
+
return i.length > t && (i = i.slice(0, t).trim()), i;
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
733
|
+
* Sanitizes a description by stripping the disallowed `<` and `>` characters
|
|
734
|
+
* (forward slash is allowed) and truncating to the description length limit.
|
|
735
|
+
*/
|
|
736
|
+
_sanitizeDescription(e, t = b.DESCRIPTION_MAX_LENGTH) {
|
|
737
|
+
let i = (e ?? "").replace(/[<>]/gu, "");
|
|
738
|
+
return i.length > t && (i = i.slice(0, t)), i;
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* Sanitizes a field name so it starts with a letter and contains only
|
|
742
|
+
* letters, combining marks, numbers, and underscores.
|
|
743
|
+
*/
|
|
744
|
+
_sanitizeFieldName(e) {
|
|
745
|
+
let t = (e ?? "").replace(/[^\p{L}\p{M}\p{N}_]/gu, "");
|
|
746
|
+
return t.length === 0 ? t = "field" : /^\p{L}/u.test(t) || (t = `f_${t}`), t;
|
|
747
|
+
}
|
|
748
|
+
/**
|
|
749
|
+
* Attempts to auto-fix an invalid item-style name on new designs. Empty values
|
|
750
|
+
* (or values that sanitize to empty) fall back to the supplied placeholder.
|
|
751
|
+
* Returns true when fixed.
|
|
752
|
+
*/
|
|
753
|
+
_tryFixName(e, t, i, n, o) {
|
|
754
|
+
if (!this.newDesign)
|
|
755
|
+
return !1;
|
|
756
|
+
if (e === "empty")
|
|
757
|
+
return i(o), this._logAutoFix(`${n} was empty. Auto-fixed to '${o}'.`), !0;
|
|
758
|
+
const r = this._sanitizeItemName(t) || o;
|
|
759
|
+
return i(r), this._logAutoFix(`${n} was invalid (${e}). Auto-fixed to '${r}'.`), !0;
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* Attempts to auto-fix an invalid description on new designs. Returns true when fixed.
|
|
763
|
+
*/
|
|
764
|
+
_tryFixDescription(e, t, i) {
|
|
765
|
+
if (!this.newDesign)
|
|
766
|
+
return !1;
|
|
767
|
+
const n = this._sanitizeDescription(e);
|
|
768
|
+
return t(n), this._logAutoFix(`${i} was invalid. Auto-fixed to a sanitized value.`), !0;
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Records an auto-fix that was applied (new-design only). Auto-fixes are
|
|
772
|
+
* informational: they are logged but do NOT mark validation invalid.
|
|
773
|
+
*/
|
|
774
|
+
_logAutoFix(e) {
|
|
775
|
+
console.debug(e);
|
|
521
776
|
}
|
|
522
777
|
/**
|
|
523
778
|
* Records an issue and marks the validation as invalid.
|
|
@@ -526,15 +781,15 @@ class ve {
|
|
|
526
781
|
console.debug(e), this.issues.push(e), this.isValid = !1;
|
|
527
782
|
}
|
|
528
783
|
}
|
|
529
|
-
const
|
|
530
|
-
key:
|
|
531
|
-
value:
|
|
532
|
-
description:
|
|
533
|
-
}),
|
|
534
|
-
id:
|
|
535
|
-
title:
|
|
536
|
-
description:
|
|
537
|
-
type:
|
|
784
|
+
const yt = l.object({
|
|
785
|
+
key: l.string().describe("Stable key identifier for the string."),
|
|
786
|
+
value: l.string().describe("Display value for the string."),
|
|
787
|
+
description: l.string().describe("Explanation of where/how the string is used.")
|
|
788
|
+
}), bt = l.object({
|
|
789
|
+
id: l.string().describe("ArcGIS item id (32 hex characters)."),
|
|
790
|
+
title: l.string().describe("Item title."),
|
|
791
|
+
description: l.string().describe("Item description."),
|
|
792
|
+
type: l.enum([
|
|
538
793
|
"Feature Layer (hosted)",
|
|
539
794
|
"Feature Layer (hosted, view)",
|
|
540
795
|
"Web Map",
|
|
@@ -553,81 +808,81 @@ const pt = r.object({
|
|
|
553
808
|
"Notebook",
|
|
554
809
|
"QuickCapture Project"
|
|
555
810
|
]).describe("ArcGIS item type.")
|
|
556
|
-
}),
|
|
557
|
-
name:
|
|
558
|
-
type:
|
|
559
|
-
alias:
|
|
560
|
-
description:
|
|
561
|
-
choiceList:
|
|
811
|
+
}), ue = l.object({
|
|
812
|
+
name: l.string().describe("Field name."),
|
|
813
|
+
type: l.enum(["string", "integer", "double", "date", "oid", "guid", "globalid"]).describe("Field data type."),
|
|
814
|
+
alias: l.string().describe("Field alias for display."),
|
|
815
|
+
description: l.string().describe("Field description."),
|
|
816
|
+
choiceList: l.array(l.string()).nullable().describe(
|
|
562
817
|
"List of allowed values for string fields with a controlled vocabulary. Null if unrestricted or not applicable."
|
|
563
818
|
),
|
|
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:
|
|
819
|
+
length: l.number().int().nullable().describe("Maximum string length for string fields. Null for non-string fields.")
|
|
820
|
+
}), xt = l.object({
|
|
821
|
+
id: l.number().int().describe("Layer/table id within the feature service."),
|
|
822
|
+
type: l.enum(["Point", "Polyline", "Polygon", "Table"]).describe("Layer type."),
|
|
823
|
+
typeMutable: l.boolean().describe("Indicates whether the layer type can be changed."),
|
|
824
|
+
name: l.string().describe("Layer/table name."),
|
|
825
|
+
description: l.string().describe("Layer/table description."),
|
|
826
|
+
customFields: l.array(ue).describe("User/business fields specific to the solution."),
|
|
827
|
+
requiredFields: l.array(ue).describe("Fields required for solution functionality (e.g., relationship keys).")
|
|
828
|
+
}), vt = l.object({
|
|
829
|
+
itemId: l.string().describe("ArcGIS item id for the feature layer."),
|
|
830
|
+
addLayers: l.boolean().describe("Indicates whether new layers can be added during solution design."),
|
|
831
|
+
layers: l.array(xt)
|
|
832
|
+
}), Z = l.object({
|
|
833
|
+
response: l.string().describe("Conversational response to the user's query."),
|
|
834
|
+
solution: l.object({
|
|
835
|
+
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."),
|
|
836
|
+
title: l.string().describe("Title of the solution."),
|
|
837
|
+
description: l.string().describe("Description of the solution."),
|
|
838
|
+
tags: l.array(l.string()).describe("Keywords/tags associated with the solution."),
|
|
839
|
+
strings: l.array(yt).describe("Localized strings/labels used by apps (dashboards, forms, etc.).")
|
|
585
840
|
}),
|
|
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.",
|
|
841
|
+
items: l.array(bt).describe("ArcGIS items that belong to the solution (apps, maps, layers, etc.)."),
|
|
842
|
+
featureLayer: vt.describe("Primary feature layer item and its schema/layers/tables details.")
|
|
843
|
+
}), wt = l.object({
|
|
844
|
+
op: l.enum(["add", "remove", "replace", "move", "copy"]).describe("RFC 6902 operation type."),
|
|
845
|
+
path: l.string().describe("RFC 6901 JSON Pointer to the target location."),
|
|
846
|
+
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.`),
|
|
847
|
+
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.")
|
|
848
|
+
}), _t = l.object({
|
|
849
|
+
response: l.string().describe("Conversational response describing the accepted design changes."),
|
|
850
|
+
patches: l.array(wt).describe("Minimal RFC 6902 patch operations needed to update the current design.")
|
|
851
|
+
}), St = l.object({
|
|
852
|
+
response: l.string().describe("Short, user-friendly explanation of why the requested update was not applied.")
|
|
853
|
+
}), It = l.object({
|
|
854
|
+
assistantResponse: l.string().describe("Natural-language response for the user."),
|
|
855
|
+
isValidUpdate: l.boolean().describe("True only when the request is in scope for supported design updates.")
|
|
856
|
+
}), At = l.object({
|
|
857
|
+
matchedTitles: l.array(l.string()).describe("Titles of solutions that match the user's request. Empty array if no strong match.")
|
|
858
|
+
}), Ct = l.object({
|
|
859
|
+
templateId: l.string().min(1).describe("Template id from the available template list."),
|
|
860
|
+
confidence: l.number().min(0).max(1).describe("Confidence score from 0 to 1 for this template match."),
|
|
861
|
+
templateDescription: l.string().min(1).describe("Short action‑oriented description of the template in the user's use case/workflow, starting with a verb.")
|
|
862
|
+
}), Tt = l.object({
|
|
863
|
+
assistantResponse: l.string().nullable().describe("Natural-language response for the user."),
|
|
864
|
+
isValidUseCase: l.boolean().describe("True only when the request is concrete, appropriate, and has at least one matching template."),
|
|
865
|
+
matchedTemplates: l.array(Ct).describe("Ordered list of matching templates, best match first. Empty when no valid match exists.")
|
|
866
|
+
}), Et = (s) => s.length ? s.map((e, t) => `${t + 1}. ${e}`).join(`
|
|
867
|
+
`) : "No validation errors were provided.", Lt = async (s) => {
|
|
613
868
|
const {
|
|
614
869
|
query: e,
|
|
615
|
-
validationIssues:
|
|
870
|
+
validationIssues: t,
|
|
616
871
|
recentMessages: i,
|
|
617
872
|
fallbackMessage: n,
|
|
618
873
|
promptModules: o
|
|
619
|
-
} =
|
|
874
|
+
} = s;
|
|
620
875
|
try {
|
|
621
|
-
return (await
|
|
876
|
+
return (await We({
|
|
622
877
|
promptText: await v(o, "explainValidationFailure"),
|
|
623
878
|
modelTier: "fast",
|
|
624
879
|
temperature: 0,
|
|
625
|
-
schema:
|
|
880
|
+
schema: St,
|
|
626
881
|
messages: i,
|
|
627
882
|
inputVariables: {
|
|
628
883
|
query: e,
|
|
629
|
-
validationIssueCount: String(
|
|
630
|
-
validationIssues:
|
|
884
|
+
validationIssueCount: String(t.length),
|
|
885
|
+
validationIssues: Et(t)
|
|
631
886
|
}
|
|
632
887
|
})).response?.trim() || n;
|
|
633
888
|
} catch (a) {
|
|
@@ -636,55 +891,55 @@ const pt = r.object({
|
|
|
636
891
|
{ error: a }
|
|
637
892
|
), n;
|
|
638
893
|
}
|
|
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
|
-
}),
|
|
894
|
+
}, ee = (s) => s in F, $t = 5, kt = 0.8, Nt = 0.5, Ft = "Web Mapping Application", Dt = "Embeddings";
|
|
895
|
+
let R = null, V = null, B = null, P = null;
|
|
896
|
+
const Mt = "Build", L = /* @__PURE__ */ Object.assign({
|
|
897
|
+
"./prompts/assessBuildRequest.md": () => import("../../chunks/assessBuildRequest.js").then((s) => s.default),
|
|
898
|
+
"./prompts/assessUpdateRequest.md": () => import("../../chunks/assessUpdateRequest.js").then((s) => s.default),
|
|
899
|
+
"./prompts/description.md": () => import("../../chunks/description2.js").then((s) => s.default),
|
|
900
|
+
"./prompts/designSolution.md": () => import("../../chunks/designSolution.js").then((s) => s.default),
|
|
901
|
+
"./prompts/explainValidationFailure.md": () => import("../../chunks/explainValidationFailure.js").then((s) => s.default),
|
|
902
|
+
"./prompts/findExistingSolution.md": () => import("../../chunks/findExistingSolution.js").then((s) => s.default),
|
|
903
|
+
"./prompts/updateDesign.md": () => import("../../chunks/updateDesign.js").then((s) => s.default)
|
|
904
|
+
}), Rt = ft.builderMessages, m = (s) => s?.signal?.aborted ?? !1, f = (s, e, t) => U(e)?.builderMessages?.[s] ?? Rt[s], _e = (s) => {
|
|
650
905
|
typeof window < "u" && window.dispatchEvent(new CustomEvent("arcgis-solution-design-update", {
|
|
651
|
-
detail:
|
|
906
|
+
detail: s
|
|
652
907
|
}));
|
|
653
|
-
},
|
|
654
|
-
if (!
|
|
655
|
-
const i = `type:"${
|
|
656
|
-
return (await
|
|
908
|
+
}, Bt = async (s, e, t) => {
|
|
909
|
+
if (!s) return null;
|
|
910
|
+
const i = `type:"${Ft}" AND typekeywords:${Dt} AND group:${s}`;
|
|
911
|
+
return (await Y.searchItems({
|
|
657
912
|
q: i,
|
|
658
913
|
params: e ? { token: e } : void 0,
|
|
659
|
-
portal:
|
|
914
|
+
portal: t,
|
|
660
915
|
num: 1
|
|
661
916
|
}))?.results?.[0] ?? null;
|
|
662
917
|
};
|
|
663
|
-
async function
|
|
918
|
+
async function Pt(s, e, t, i) {
|
|
664
919
|
try {
|
|
665
|
-
const n = await
|
|
666
|
-
if (!n ||
|
|
920
|
+
const n = await Bt(s, e, t);
|
|
921
|
+
if (!n || m(i))
|
|
667
922
|
return null;
|
|
668
|
-
const o = new
|
|
669
|
-
return await o.load(),
|
|
923
|
+
const o = new Ye({ id: n.id });
|
|
924
|
+
return await o.load(), m(i) ? null : await o.fetchData("json");
|
|
670
925
|
} catch {
|
|
671
926
|
return null;
|
|
672
927
|
}
|
|
673
928
|
}
|
|
674
|
-
const
|
|
675
|
-
if (!
|
|
676
|
-
const i = `type:Solution AND typekeywords:${
|
|
677
|
-
return (await
|
|
929
|
+
const qt = async (s, e, t) => {
|
|
930
|
+
if (!s) return [];
|
|
931
|
+
const i = `type:Solution AND typekeywords:${Mt} AND group:${s}`;
|
|
932
|
+
return (await Y.searchItems({
|
|
678
933
|
q: i,
|
|
679
934
|
params: e ? { token: e } : void 0,
|
|
680
|
-
portal:
|
|
935
|
+
portal: t,
|
|
681
936
|
num: 100
|
|
682
937
|
}))?.results ?? [];
|
|
683
|
-
},
|
|
938
|
+
}, Ut = async (s, e, t) => {
|
|
684
939
|
try {
|
|
685
|
-
const i = await
|
|
940
|
+
const i = await Y.getItemData(s, {
|
|
686
941
|
params: e ? { token: e } : void 0,
|
|
687
|
-
portal:
|
|
942
|
+
portal: t
|
|
688
943
|
}), n = i?.buildSolution;
|
|
689
944
|
if (!n) return null;
|
|
690
945
|
const o = i?.params, a = o && typeof o == "object" && !Array.isArray(o) ? o : null;
|
|
@@ -692,438 +947,438 @@ const Dt = async (t, e, s) => {
|
|
|
692
947
|
} catch {
|
|
693
948
|
return null;
|
|
694
949
|
}
|
|
695
|
-
},
|
|
696
|
-
let
|
|
697
|
-
return "itemId" in e && (
|
|
698
|
-
...
|
|
950
|
+
}, $ = (s, e = {}) => {
|
|
951
|
+
let t = s;
|
|
952
|
+
return "itemId" in e && (t = {
|
|
953
|
+
...t,
|
|
699
954
|
solution: {
|
|
700
|
-
...
|
|
955
|
+
...t.solution,
|
|
701
956
|
itemId: e.itemId ?? null
|
|
702
957
|
}
|
|
703
|
-
}), e.sourceBuildSolution != null && (
|
|
704
|
-
...
|
|
958
|
+
}), e.sourceBuildSolution != null && (t = {
|
|
959
|
+
...t,
|
|
705
960
|
sourceBuildSolution: e.sourceBuildSolution
|
|
706
|
-
}), "params" in e && (
|
|
707
|
-
...
|
|
961
|
+
}), "params" in e && (t = {
|
|
962
|
+
...t,
|
|
708
963
|
params: e.params ?? null
|
|
709
|
-
}), "templateId" in e && (
|
|
710
|
-
...
|
|
964
|
+
}), "templateId" in e && (t = {
|
|
965
|
+
...t,
|
|
711
966
|
templateId: e.templateId ?? null
|
|
712
|
-
}),
|
|
713
|
-
},
|
|
714
|
-
if (
|
|
967
|
+
}), t;
|
|
968
|
+
}, Se = (s, e) => {
|
|
969
|
+
if (s == null || e == null)
|
|
715
970
|
return { ok: !1, error: "design or sourceBuildSolution is null/undefined" };
|
|
716
971
|
try {
|
|
717
|
-
const
|
|
718
|
-
return new
|
|
719
|
-
} catch (
|
|
972
|
+
const t = structuredClone(e);
|
|
973
|
+
return new pe({ buildSolution: t }).applyLlmTemplate(s), { ok: !0 };
|
|
974
|
+
} catch (t) {
|
|
720
975
|
return {
|
|
721
976
|
ok: !1,
|
|
722
|
-
error:
|
|
977
|
+
error: t instanceof Error ? t.stack ?? t.message : String(t)
|
|
723
978
|
};
|
|
724
979
|
}
|
|
725
|
-
},
|
|
726
|
-
if (
|
|
727
|
-
Object.entries(
|
|
728
|
-
F[a] && (F[a].initialTemplate =
|
|
980
|
+
}, te = async (s) => {
|
|
981
|
+
if (V) {
|
|
982
|
+
Object.entries(V).forEach(([a, r]) => {
|
|
983
|
+
F[a] && (F[a].initialTemplate = r);
|
|
729
984
|
});
|
|
730
985
|
return;
|
|
731
986
|
}
|
|
732
|
-
const e =
|
|
733
|
-
if (!
|
|
987
|
+
const e = s?.configurable?.context?.token, t = Ae(s), i = Ce(s);
|
|
988
|
+
if (!t) {
|
|
734
989
|
console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping live template hydration.");
|
|
735
990
|
return;
|
|
736
991
|
}
|
|
737
|
-
const n = await
|
|
738
|
-
|
|
739
|
-
const
|
|
740
|
-
if (!
|
|
741
|
-
const
|
|
742
|
-
if (typeof
|
|
743
|
-
const
|
|
744
|
-
if (!
|
|
992
|
+
const n = await qt(t, e, i), o = {};
|
|
993
|
+
m(s) || (await Promise.all(n.map(async (a) => {
|
|
994
|
+
const r = a.properties?.templateInfo;
|
|
995
|
+
if (!r || typeof r != "object") return;
|
|
996
|
+
const c = r.id;
|
|
997
|
+
if (typeof c != "string" || o[c]) return;
|
|
998
|
+
const d = await Ut(a.id, e, i);
|
|
999
|
+
if (!d || m(s))
|
|
745
1000
|
return;
|
|
746
|
-
const { buildSolution:
|
|
747
|
-
if (typeof
|
|
748
|
-
const
|
|
749
|
-
|
|
1001
|
+
const { buildSolution: h, params: y } = d;
|
|
1002
|
+
if (typeof h == "object" && h !== null && "solution" in h) {
|
|
1003
|
+
const g = h.solution;
|
|
1004
|
+
g.thumbnailUrl = a.thumbnail ? `${i ?? "https://www.arcgis.com/sharing/rest"}/content/items/${a.id}/info/${a.thumbnail}` : void 0, g.item = a;
|
|
750
1005
|
}
|
|
751
1006
|
const u = {
|
|
752
|
-
...
|
|
753
|
-
buildSolution:
|
|
1007
|
+
...r,
|
|
1008
|
+
buildSolution: h
|
|
754
1009
|
};
|
|
755
|
-
o[
|
|
756
|
-
new
|
|
1010
|
+
o[c] = $(
|
|
1011
|
+
new pe(u).dumpToLlmTemplate(),
|
|
757
1012
|
{
|
|
758
1013
|
itemId: a.id,
|
|
759
|
-
sourceBuildSolution: structuredClone(
|
|
760
|
-
params:
|
|
1014
|
+
sourceBuildSolution: structuredClone(h),
|
|
1015
|
+
params: y ? structuredClone(y) : null
|
|
761
1016
|
}
|
|
762
|
-
), F[
|
|
763
|
-
...
|
|
764
|
-
initialTemplate: o[
|
|
1017
|
+
), F[c] = {
|
|
1018
|
+
...r,
|
|
1019
|
+
initialTemplate: o[c]
|
|
765
1020
|
};
|
|
766
|
-
})),
|
|
767
|
-
},
|
|
768
|
-
const e =
|
|
1021
|
+
})), V = o);
|
|
1022
|
+
}, Ie = (s) => {
|
|
1023
|
+
const e = s?.configurable?.context?.token;
|
|
769
1024
|
return typeof e != "string" || !e.trim() ? null : e;
|
|
770
|
-
},
|
|
771
|
-
const e =
|
|
1025
|
+
}, Ae = (s) => {
|
|
1026
|
+
const e = s?.configurable?.context?.configContext?.primarySolutionsGroupId;
|
|
772
1027
|
return typeof e != "string" || !e.trim() ? null : e;
|
|
773
|
-
},
|
|
774
|
-
const e =
|
|
1028
|
+
}, Ce = (s) => {
|
|
1029
|
+
const e = s?.configurable?.context?.configContext?.portalURL;
|
|
775
1030
|
if (!(typeof e != "string" || !e.trim()))
|
|
776
1031
|
return `${e.replace(/\/+$/, "")}/sharing/rest`;
|
|
777
|
-
},
|
|
1032
|
+
}, Ot = async (s) => {
|
|
778
1033
|
await Promise.all([
|
|
779
|
-
|
|
780
|
-
|
|
1034
|
+
Ee(s),
|
|
1035
|
+
te(s)
|
|
781
1036
|
]);
|
|
782
|
-
},
|
|
783
|
-
const e =
|
|
784
|
-
(!
|
|
785
|
-
throw
|
|
786
|
-
})), await
|
|
1037
|
+
}, Te = async (s) => {
|
|
1038
|
+
const e = Ie(s);
|
|
1039
|
+
(!B || e && e !== P) && (P = e ?? P, B = Ot(s).catch((i) => {
|
|
1040
|
+
throw B = null, P = null, i;
|
|
1041
|
+
})), await B;
|
|
787
1042
|
};
|
|
788
|
-
async function
|
|
789
|
-
if (
|
|
790
|
-
const e =
|
|
1043
|
+
async function Ee(s) {
|
|
1044
|
+
if (R) return R;
|
|
1045
|
+
const e = Ae(s);
|
|
791
1046
|
if (!e)
|
|
792
1047
|
return console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping embeddings load."), null;
|
|
793
|
-
const
|
|
794
|
-
if (await new
|
|
1048
|
+
const t = Ce(s), i = s?.configurable?.context?.configContext?.portalURL;
|
|
1049
|
+
if (await new Xe(i ? { url: i } : void 0).load(), m(s))
|
|
795
1050
|
return null;
|
|
796
|
-
const o =
|
|
797
|
-
return
|
|
1051
|
+
const o = Ie(s) ?? void 0, a = await Pt(e, o, t, s);
|
|
1052
|
+
return m(s) ? null : a ? (R = a.items, R) : null;
|
|
798
1053
|
}
|
|
799
|
-
const
|
|
1054
|
+
const zt = () => Object.entries(F).map(([s, e]) => `ID: ${s}
|
|
800
1055
|
Label: ${e.label}
|
|
801
1056
|
Description: ${e.description}`).join(`
|
|
802
1057
|
|
|
803
|
-
`),
|
|
804
|
-
const e =
|
|
1058
|
+
`), jt = (s) => {
|
|
1059
|
+
const e = s?.configurable?.context?.solutionDesignJson;
|
|
805
1060
|
if (typeof e != "string" || !e.trim())
|
|
806
1061
|
return null;
|
|
807
1062
|
try {
|
|
808
|
-
const
|
|
809
|
-
{ response: "", ...
|
|
810
|
-
{ itemId:
|
|
811
|
-
), n =
|
|
1063
|
+
const t = JSON.parse(e), i = $(
|
|
1064
|
+
{ response: "", ...t },
|
|
1065
|
+
{ itemId: t?.solution?.itemId ?? null }
|
|
1066
|
+
), n = Z.safeParse(i);
|
|
812
1067
|
if (!n.success)
|
|
813
1068
|
return null;
|
|
814
|
-
const { response: o, ...a } = n.data,
|
|
815
|
-
return
|
|
1069
|
+
const { response: o, ...a } = n.data, r = t.templateId, c = typeof r == "string" && ee(r) ? r : null;
|
|
1070
|
+
return $(
|
|
816
1071
|
a,
|
|
817
1072
|
{
|
|
818
|
-
sourceBuildSolution:
|
|
819
|
-
templateId:
|
|
820
|
-
params:
|
|
1073
|
+
sourceBuildSolution: t.sourceBuildSolution,
|
|
1074
|
+
templateId: c,
|
|
1075
|
+
params: t.params ?? null
|
|
821
1076
|
}
|
|
822
1077
|
);
|
|
823
1078
|
} catch {
|
|
824
1079
|
return null;
|
|
825
1080
|
}
|
|
826
|
-
},
|
|
827
|
-
...
|
|
1081
|
+
}, Gt = x.Root({
|
|
1082
|
+
...X(),
|
|
828
1083
|
/** Optional human-readable template description retained for UI use. */
|
|
829
|
-
templateDescription:
|
|
830
|
-
reducer: (
|
|
1084
|
+
templateDescription: x({
|
|
1085
|
+
reducer: (s, e) => typeof e == "string" || e === null ? e : s ?? null,
|
|
831
1086
|
default: () => null
|
|
832
1087
|
}),
|
|
833
1088
|
/** Current editable design payload being refined across turns. */
|
|
834
|
-
currentDesign:
|
|
835
|
-
reducer: (
|
|
1089
|
+
currentDesign: x({
|
|
1090
|
+
reducer: (s = null, e) => e === void 0 ? s : e ?? null,
|
|
836
1091
|
default: () => null
|
|
837
1092
|
}),
|
|
838
1093
|
/** Initial request assessment produced by the intake prompt. */
|
|
839
|
-
assessment:
|
|
840
|
-
reducer: (
|
|
1094
|
+
assessment: x({
|
|
1095
|
+
reducer: (s = null, e) => e === void 0 ? s : e ?? null,
|
|
841
1096
|
default: () => null
|
|
842
1097
|
}),
|
|
843
1098
|
/** Template selected automatically or by human-in-the-loop choice. */
|
|
844
|
-
selectedTemplate:
|
|
845
|
-
reducer: (
|
|
1099
|
+
selectedTemplate: x({
|
|
1100
|
+
reducer: (s = null, e) => e === void 0 ? s : e ?? null,
|
|
846
1101
|
default: () => null
|
|
847
1102
|
}),
|
|
848
1103
|
/** Update request assessment produced when an active design exists. */
|
|
849
|
-
updateAssessment:
|
|
850
|
-
reducer: (
|
|
1104
|
+
updateAssessment: x({
|
|
1105
|
+
reducer: (s = null, e) => e === void 0 ? s : e ?? null,
|
|
851
1106
|
default: () => null
|
|
852
1107
|
}),
|
|
853
1108
|
/** Existing solution matches surfaced before building a new solution. */
|
|
854
|
-
existingMatches:
|
|
855
|
-
reducer: (
|
|
1109
|
+
existingMatches: x({
|
|
1110
|
+
reducer: (s = [], e) => e === void 0 ? s : e ?? [],
|
|
856
1111
|
default: () => []
|
|
857
1112
|
}),
|
|
858
1113
|
/** User decision for whether to continue building after existing matches are shown. */
|
|
859
|
-
continueBuilding:
|
|
860
|
-
reducer: (
|
|
1114
|
+
continueBuilding: x({
|
|
1115
|
+
reducer: (s = null, e) => e === void 0 ? s : e ?? null,
|
|
861
1116
|
default: () => null
|
|
862
1117
|
})
|
|
863
|
-
}),
|
|
864
|
-
if (
|
|
1118
|
+
}), Ht = (s, e) => {
|
|
1119
|
+
if (m(e))
|
|
865
1120
|
return {};
|
|
866
|
-
const
|
|
867
|
-
return JSON.stringify(
|
|
868
|
-
},
|
|
869
|
-
if (
|
|
1121
|
+
const t = jt(e), i = t?.templateId ?? null, n = {};
|
|
1122
|
+
return JSON.stringify(s.currentDesign) !== JSON.stringify(t) && (n.currentDesign = t), i && s.selectedTemplate !== i && (n.selectedTemplate = i), n;
|
|
1123
|
+
}, Jt = async (s, e) => {
|
|
1124
|
+
if (m(e))
|
|
870
1125
|
return {};
|
|
871
|
-
await
|
|
872
|
-
const
|
|
873
|
-
promptText: await v(
|
|
1126
|
+
await _({ text: f("understandingRequest", e) }, e), await Te(e);
|
|
1127
|
+
const t = s.agentExecutionContext.userRequest, i = zt(), n = s.agentExecutionContext.messages.slice(-11), o = await k({
|
|
1128
|
+
promptText: await v(L, "assessBuildRequest"),
|
|
874
1129
|
modelTier: "advanced",
|
|
875
1130
|
temperature: 0,
|
|
876
|
-
schema:
|
|
1131
|
+
schema: Tt,
|
|
877
1132
|
messages: n,
|
|
878
|
-
inputVariables: { query:
|
|
1133
|
+
inputVariables: { query: t, availableTemplates: i }
|
|
879
1134
|
}), a = o.matchedTemplates.filter(
|
|
880
|
-
(u) =>
|
|
881
|
-
),
|
|
1135
|
+
(u) => ee(u.templateId)
|
|
1136
|
+
), r = {
|
|
882
1137
|
...o,
|
|
883
1138
|
matchedTemplates: a
|
|
884
|
-
}, [
|
|
1139
|
+
}, [c, d] = a, y = !!c && c.confidence >= kt && (d === void 0 || c.confidence - d.confidence >= Nt) ? c.templateId : null;
|
|
885
1140
|
return {
|
|
886
|
-
assessment:
|
|
887
|
-
selectedTemplate:
|
|
1141
|
+
assessment: r,
|
|
1142
|
+
selectedTemplate: y,
|
|
888
1143
|
existingMatches: [],
|
|
889
1144
|
continueBuilding: null
|
|
890
1145
|
};
|
|
891
|
-
},
|
|
892
|
-
const e =
|
|
1146
|
+
}, Vt = (s) => {
|
|
1147
|
+
const e = s.assessment?.assistantResponse ?? "";
|
|
893
1148
|
return {
|
|
894
1149
|
outputMessage: e,
|
|
895
1150
|
summary: e,
|
|
896
1151
|
status: "success"
|
|
897
1152
|
};
|
|
898
|
-
},
|
|
899
|
-
if (
|
|
1153
|
+
}, Qt = async (s, e) => {
|
|
1154
|
+
if (m(e))
|
|
900
1155
|
return {};
|
|
901
|
-
const { currentDesign:
|
|
902
|
-
if (!
|
|
1156
|
+
const { currentDesign: t } = s;
|
|
1157
|
+
if (!t)
|
|
903
1158
|
return {
|
|
904
1159
|
updateAssessment: {
|
|
905
1160
|
assistantResponse: "",
|
|
906
1161
|
isValidUpdate: !0
|
|
907
1162
|
}
|
|
908
1163
|
};
|
|
909
|
-
await
|
|
910
|
-
const i =
|
|
1164
|
+
await _({ text: f("understandingRequest", e) }, e);
|
|
1165
|
+
const i = s.agentExecutionContext.userRequest, n = s.agentExecutionContext.messages.slice(-11);
|
|
911
1166
|
return {
|
|
912
|
-
updateAssessment: await
|
|
913
|
-
promptText: await v(
|
|
1167
|
+
updateAssessment: await k({
|
|
1168
|
+
promptText: await v(L, "assessUpdateRequest"),
|
|
914
1169
|
modelTier: "advanced",
|
|
915
1170
|
temperature: 0,
|
|
916
|
-
schema:
|
|
1171
|
+
schema: It,
|
|
917
1172
|
messages: n,
|
|
918
1173
|
inputVariables: {
|
|
919
|
-
currentDesign: JSON.stringify(
|
|
1174
|
+
currentDesign: JSON.stringify(me(t)),
|
|
920
1175
|
query: i
|
|
921
1176
|
}
|
|
922
1177
|
})
|
|
923
1178
|
};
|
|
924
|
-
},
|
|
925
|
-
const
|
|
1179
|
+
}, Kt = (s, e) => {
|
|
1180
|
+
const t = s.updateAssessment?.assistantResponse ?? f("applyChangeFailed", e);
|
|
926
1181
|
return {
|
|
927
|
-
outputMessage:
|
|
928
|
-
summary:
|
|
1182
|
+
outputMessage: t,
|
|
1183
|
+
summary: t,
|
|
929
1184
|
status: "success"
|
|
930
1185
|
};
|
|
931
|
-
},
|
|
932
|
-
if (
|
|
1186
|
+
}, Wt = (s, e) => {
|
|
1187
|
+
if (m(e))
|
|
933
1188
|
return {};
|
|
934
|
-
const { hitlResponse:
|
|
935
|
-
(
|
|
936
|
-
) ?? [], o = n.map((
|
|
937
|
-
if (
|
|
938
|
-
const
|
|
1189
|
+
const { hitlResponse: t } = e.configurable, i = "selectTemplate", n = s.assessment?.matchedTemplates.filter(
|
|
1190
|
+
(d) => ee(d.templateId)
|
|
1191
|
+
) ?? [], o = n.map((d) => `${d.templateDescription}`);
|
|
1192
|
+
if (t?.agentId !== "solutionBuilder" || t.id !== i) {
|
|
1193
|
+
const d = {
|
|
939
1194
|
agentId: "solutionBuilder",
|
|
940
1195
|
id: i,
|
|
941
1196
|
kind: "singleSelection",
|
|
942
|
-
message:
|
|
1197
|
+
message: f("selectTemplatePrompt", e),
|
|
943
1198
|
metadata: [...o]
|
|
944
1199
|
};
|
|
945
|
-
throw new
|
|
1200
|
+
throw new de(d);
|
|
946
1201
|
}
|
|
947
|
-
const a = String(
|
|
1202
|
+
const a = String(t.payload ?? ""), r = o.findIndex((d) => d === a);
|
|
948
1203
|
return {
|
|
949
|
-
selectedTemplate: (
|
|
1204
|
+
selectedTemplate: (r >= 0 ? n[r] : void 0)?.templateId ?? n[0]?.templateId ?? null
|
|
950
1205
|
};
|
|
951
|
-
},
|
|
952
|
-
if (
|
|
1206
|
+
}, Xt = async (s, e) => {
|
|
1207
|
+
if (m(e))
|
|
953
1208
|
return {};
|
|
954
|
-
await
|
|
955
|
-
const
|
|
956
|
-
if (
|
|
1209
|
+
await _({ text: f("searchingExistingSolutions", e) }, e);
|
|
1210
|
+
const t = s.agentExecutionContext.userRequest, i = ht(s.agentExecutionContext.messages) || t, n = await Ee(e);
|
|
1211
|
+
if (m(e))
|
|
957
1212
|
return {};
|
|
958
1213
|
if (!n)
|
|
959
1214
|
return console.warn("Solutions Search: failed to load solution embeddings cache; skipping search."), { existingMatches: [] };
|
|
960
1215
|
if (!n.length)
|
|
961
1216
|
return { existingMatches: [] };
|
|
962
|
-
const [o] = await
|
|
963
|
-
if (
|
|
1217
|
+
const [o] = await ze([i]);
|
|
1218
|
+
if (m(e))
|
|
964
1219
|
return {};
|
|
965
1220
|
const a = n.map((u) => ({
|
|
966
1221
|
solution: u,
|
|
967
|
-
score:
|
|
1222
|
+
score: je(o, u.embedding)
|
|
968
1223
|
}));
|
|
969
|
-
a.sort((u,
|
|
970
|
-
const
|
|
971
|
-
if (!
|
|
1224
|
+
a.sort((u, g) => g.score - u.score);
|
|
1225
|
+
const r = a.slice(0, $t);
|
|
1226
|
+
if (!r.length)
|
|
972
1227
|
return { existingMatches: [] };
|
|
973
|
-
const
|
|
1228
|
+
const c = r.map(({ solution: u }) => `${u.title}
|
|
974
1229
|
Snippet: ${u.snippet}
|
|
975
1230
|
Description: ${u.description}`).join(`
|
|
976
1231
|
|
|
977
|
-
`),
|
|
978
|
-
return { existingMatches: (await
|
|
979
|
-
promptText: await v(
|
|
1232
|
+
`), d = s.agentExecutionContext.messages.slice(-11);
|
|
1233
|
+
return { existingMatches: (await k({
|
|
1234
|
+
promptText: await v(L, "findExistingSolution"),
|
|
980
1235
|
modelTier: "fast",
|
|
981
1236
|
temperature: 0,
|
|
982
|
-
schema:
|
|
983
|
-
messages:
|
|
984
|
-
inputVariables: { query:
|
|
985
|
-
})).matchedTitles.map((u) =>
|
|
986
|
-
},
|
|
987
|
-
if (
|
|
1237
|
+
schema: At,
|
|
1238
|
+
messages: d,
|
|
1239
|
+
inputVariables: { query: t, candidates: c }
|
|
1240
|
+
})).matchedTitles.map((u) => r.find(({ solution: g }) => g.title === u)).filter((u) => u !== void 0) };
|
|
1241
|
+
}, Yt = (s, e) => {
|
|
1242
|
+
if (m(e))
|
|
988
1243
|
return {};
|
|
989
|
-
const { existingMatches:
|
|
1244
|
+
const { existingMatches: t } = s, { hitlResponse: i } = e.configurable, n = `confirmExistingSolution:${t[0].solution.id}`;
|
|
990
1245
|
if (i?.agentId !== "solutionBuilder" || i.id !== n) {
|
|
991
|
-
|
|
992
|
-
const
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
],
|
|
1246
|
+
t.length === 1 ? ye(t[0].solution.id) : fe(t);
|
|
1247
|
+
const c = f("existingSolutionMatch", e), d = [
|
|
1248
|
+
f("continueBuildingYes", e),
|
|
1249
|
+
f("continueBuildingNo", e)
|
|
1250
|
+
], h = {
|
|
996
1251
|
agentId: "solutionBuilder",
|
|
997
1252
|
id: n,
|
|
998
1253
|
kind: "singleSelection",
|
|
999
|
-
message:
|
|
1000
|
-
metadata:
|
|
1254
|
+
message: c,
|
|
1255
|
+
metadata: d
|
|
1001
1256
|
};
|
|
1002
|
-
throw new
|
|
1257
|
+
throw new de(h);
|
|
1003
1258
|
}
|
|
1004
|
-
const o = String(i.payload ?? "").trim(), a =
|
|
1259
|
+
const o = String(i.payload ?? "").trim(), a = f("continueBuildingNo", e);
|
|
1005
1260
|
return { continueBuilding: o !== a };
|
|
1006
|
-
},
|
|
1007
|
-
const
|
|
1261
|
+
}, Zt = (s, e) => {
|
|
1262
|
+
const t = f("continueBuildingDeclined", e);
|
|
1008
1263
|
return {
|
|
1009
|
-
outputMessage:
|
|
1010
|
-
summary:
|
|
1264
|
+
outputMessage: t,
|
|
1265
|
+
summary: t,
|
|
1011
1266
|
status: "success"
|
|
1012
1267
|
};
|
|
1013
|
-
},
|
|
1014
|
-
if (
|
|
1268
|
+
}, Le = async (s, e) => {
|
|
1269
|
+
if (m(e))
|
|
1015
1270
|
return {};
|
|
1016
|
-
if (await
|
|
1271
|
+
if (await Te(e), m(e))
|
|
1017
1272
|
return {};
|
|
1018
|
-
const { currentDesign:
|
|
1019
|
-
await
|
|
1020
|
-
let n =
|
|
1021
|
-
if (n?.initialTemplate || (await
|
|
1273
|
+
const { currentDesign: t } = s, i = s.agentExecutionContext.userRequest;
|
|
1274
|
+
await _({ text: f("creatingDesign", e) }, e);
|
|
1275
|
+
let n = q(s.selectedTemplate);
|
|
1276
|
+
if (n?.initialTemplate || (await te(e), n = q(s.selectedTemplate)), m(e))
|
|
1022
1277
|
return {};
|
|
1023
1278
|
if (!n?.initialTemplate)
|
|
1024
1279
|
throw new Error("No hydrated templates are available for solution design.");
|
|
1025
|
-
const o =
|
|
1026
|
-
|
|
1280
|
+
const o = $(
|
|
1281
|
+
t ?? n.initialTemplate,
|
|
1027
1282
|
{
|
|
1028
|
-
itemId: (
|
|
1029
|
-
sourceBuildSolution:
|
|
1030
|
-
params:
|
|
1283
|
+
itemId: (t ?? n.initialTemplate)?.solution?.itemId ?? null,
|
|
1284
|
+
sourceBuildSolution: t?.sourceBuildSolution ?? n.initialTemplate.sourceBuildSolution,
|
|
1285
|
+
params: t?.params ?? n.initialTemplate.params ?? null
|
|
1031
1286
|
}
|
|
1032
|
-
), a =
|
|
1033
|
-
promptText: await v(
|
|
1287
|
+
), a = s.agentExecutionContext.messages.slice(-11), r = await k({
|
|
1288
|
+
promptText: await v(L, "designSolution"),
|
|
1034
1289
|
modelTier: "advanced",
|
|
1035
1290
|
temperature: 0,
|
|
1036
|
-
schema:
|
|
1291
|
+
schema: Z,
|
|
1037
1292
|
messages: a,
|
|
1038
1293
|
inputVariables: {
|
|
1039
|
-
currentDesign: JSON.stringify(
|
|
1294
|
+
currentDesign: JSON.stringify(he(o)),
|
|
1040
1295
|
templateInstructions: n.instructions,
|
|
1041
1296
|
query: i
|
|
1042
1297
|
}
|
|
1043
1298
|
});
|
|
1044
|
-
if (await
|
|
1299
|
+
if (await _({ text: " of design solution 1" }, e), m(e))
|
|
1045
1300
|
return {};
|
|
1046
|
-
const { response:
|
|
1047
|
-
|
|
1301
|
+
const { response: c, featureLayer: d, ...h } = r, y = ge(
|
|
1302
|
+
d,
|
|
1048
1303
|
o.featureLayer
|
|
1049
|
-
), u =
|
|
1050
|
-
{ ...
|
|
1304
|
+
), u = $(
|
|
1305
|
+
{ ...h, featureLayer: y },
|
|
1051
1306
|
{
|
|
1052
1307
|
itemId: o?.solution?.itemId,
|
|
1053
1308
|
sourceBuildSolution: o.sourceBuildSolution,
|
|
1054
|
-
templateId:
|
|
1309
|
+
templateId: s.selectedTemplate ?? null,
|
|
1055
1310
|
params: o.params ?? null
|
|
1056
1311
|
}
|
|
1057
|
-
),
|
|
1058
|
-
if (!
|
|
1312
|
+
), g = new b(u, n.initialTemplate);
|
|
1313
|
+
if (!g.isValid)
|
|
1059
1314
|
return console.warn(
|
|
1060
1315
|
"[SolutionBuilder] designSolution validation failed:",
|
|
1061
|
-
{ issues:
|
|
1316
|
+
{ issues: g.issues, llmResponse: r }
|
|
1062
1317
|
), {
|
|
1063
|
-
outputMessage:
|
|
1318
|
+
outputMessage: f("createDesignFailed", e)
|
|
1064
1319
|
};
|
|
1065
|
-
const S = u.sourceBuildSolution,
|
|
1066
|
-
if (
|
|
1320
|
+
const S = u.sourceBuildSolution, N = Se(u, S);
|
|
1321
|
+
if (!N.ok) {
|
|
1067
1322
|
console.warn(
|
|
1068
1323
|
"[SolutionBuilder] designSolution Esri JSON conversion failed:",
|
|
1069
|
-
{ error:
|
|
1324
|
+
{ error: N.error, llmResponse: r, design: u }
|
|
1070
1325
|
);
|
|
1071
|
-
const
|
|
1326
|
+
const C = f("createDesignFailed", e);
|
|
1072
1327
|
return {
|
|
1073
|
-
outputMessage:
|
|
1074
|
-
summary:
|
|
1328
|
+
outputMessage: C,
|
|
1329
|
+
summary: C,
|
|
1075
1330
|
status: "success"
|
|
1076
1331
|
};
|
|
1077
1332
|
}
|
|
1078
|
-
return
|
|
1079
|
-
outputMessage:
|
|
1080
|
-
summary:
|
|
1333
|
+
return m(e) ? {} : (_e(u), {
|
|
1334
|
+
outputMessage: c,
|
|
1335
|
+
summary: c,
|
|
1081
1336
|
status: "success",
|
|
1082
1337
|
currentDesign: u
|
|
1083
1338
|
});
|
|
1084
|
-
},
|
|
1085
|
-
if (
|
|
1339
|
+
}, es = async (s, e) => {
|
|
1340
|
+
if (m(e))
|
|
1086
1341
|
return {};
|
|
1087
|
-
const { currentDesign:
|
|
1088
|
-
if (!
|
|
1089
|
-
return
|
|
1090
|
-
const i =
|
|
1091
|
-
await
|
|
1342
|
+
const { currentDesign: t } = s;
|
|
1343
|
+
if (!t)
|
|
1344
|
+
return Le(s, e);
|
|
1345
|
+
const i = s.agentExecutionContext.userRequest, n = s.agentExecutionContext.messages.slice(-11);
|
|
1346
|
+
await _({ text: f("updatingDesign", e) }, e);
|
|
1092
1347
|
let o;
|
|
1093
1348
|
try {
|
|
1094
|
-
o = await
|
|
1095
|
-
promptText: await v(
|
|
1349
|
+
o = await k({
|
|
1350
|
+
promptText: await v(L, "updateDesign"),
|
|
1096
1351
|
modelTier: "advanced",
|
|
1097
1352
|
temperature: 0,
|
|
1098
|
-
schema:
|
|
1353
|
+
schema: _t,
|
|
1099
1354
|
messages: n,
|
|
1100
1355
|
inputVariables: {
|
|
1101
|
-
currentDesign: JSON.stringify(
|
|
1356
|
+
currentDesign: JSON.stringify(me(t)),
|
|
1102
1357
|
query: i
|
|
1103
1358
|
}
|
|
1104
1359
|
});
|
|
1105
1360
|
} catch (p) {
|
|
1106
1361
|
console.warn("[SolutionBuilder] updateDesign structured prompt failed:", p);
|
|
1107
|
-
const
|
|
1362
|
+
const w = f("applyChangeFailed", e);
|
|
1108
1363
|
return {
|
|
1109
|
-
outputMessage:
|
|
1110
|
-
summary:
|
|
1364
|
+
outputMessage: w,
|
|
1365
|
+
summary: w,
|
|
1111
1366
|
status: "success"
|
|
1112
1367
|
};
|
|
1113
1368
|
}
|
|
1114
|
-
const { response: a, patches:
|
|
1115
|
-
if (!
|
|
1369
|
+
const { response: a, patches: r } = o;
|
|
1370
|
+
if (!r || r.length === 0)
|
|
1116
1371
|
return {
|
|
1117
1372
|
outputMessage: a,
|
|
1118
1373
|
summary: a,
|
|
1119
1374
|
status: "success"
|
|
1120
1375
|
};
|
|
1121
|
-
const
|
|
1376
|
+
const c = (p) => {
|
|
1122
1377
|
try {
|
|
1123
1378
|
return JSON.parse(p);
|
|
1124
1379
|
} catch {
|
|
1125
|
-
const
|
|
1126
|
-
switch (
|
|
1380
|
+
const w = p.replace(/[\u0000-\u001F]/g, (oe) => {
|
|
1381
|
+
switch (oe) {
|
|
1127
1382
|
case "\b":
|
|
1128
1383
|
return "\\b";
|
|
1129
1384
|
case "\f":
|
|
@@ -1136,82 +1391,82 @@ Description: ${u.description}`).join(`
|
|
|
1136
1391
|
case " ":
|
|
1137
1392
|
return "\\t";
|
|
1138
1393
|
default:
|
|
1139
|
-
return "\\u" +
|
|
1394
|
+
return "\\u" + oe.charCodeAt(0).toString(16).padStart(4, "0");
|
|
1140
1395
|
}
|
|
1141
1396
|
});
|
|
1142
1397
|
try {
|
|
1143
|
-
return JSON.parse(
|
|
1398
|
+
return JSON.parse(w);
|
|
1144
1399
|
} catch {
|
|
1145
1400
|
return p;
|
|
1146
1401
|
}
|
|
1147
1402
|
}
|
|
1148
|
-
},
|
|
1403
|
+
}, h = [...r.map((p) => ({
|
|
1149
1404
|
op: p.op,
|
|
1150
1405
|
path: p.path.replace(/\/+$/, ""),
|
|
1151
|
-
...p.value != null && p.value !== "" ? { value:
|
|
1406
|
+
...p.value != null && p.value !== "" ? { value: c(p.value) } : {},
|
|
1152
1407
|
...p.from != null && p.from !== "" ? { from: p.from } : {}
|
|
1153
|
-
}))].sort((p,
|
|
1154
|
-
|
|
1408
|
+
}))].sort((p, w) => p.op !== "remove" || w.op !== "remove" ? 0 : w.path.localeCompare(p.path, void 0, { numeric: !0 })), y = structuredClone(
|
|
1409
|
+
he(t)
|
|
1155
1410
|
);
|
|
1156
1411
|
try {
|
|
1157
|
-
|
|
1412
|
+
He(y, h, !0);
|
|
1158
1413
|
} catch (p) {
|
|
1159
1414
|
console.warn(
|
|
1160
1415
|
"[SolutionBuilder] updateDesign JSON patch failed:",
|
|
1161
|
-
{ error: p, llmResponse: o, patches:
|
|
1416
|
+
{ error: p, llmResponse: o, patches: h, patchTarget: y }
|
|
1162
1417
|
);
|
|
1163
|
-
const
|
|
1418
|
+
const w = f("applyChangeFailed", e);
|
|
1164
1419
|
return {
|
|
1165
|
-
outputMessage:
|
|
1166
|
-
summary:
|
|
1420
|
+
outputMessage: w,
|
|
1421
|
+
summary: w,
|
|
1167
1422
|
status: "success"
|
|
1168
1423
|
};
|
|
1169
1424
|
}
|
|
1170
|
-
const u =
|
|
1171
|
-
{ response: "", ...
|
|
1172
|
-
{ itemId:
|
|
1173
|
-
),
|
|
1174
|
-
if (!
|
|
1425
|
+
const u = $(
|
|
1426
|
+
{ response: "", ...y },
|
|
1427
|
+
{ itemId: t.solution?.itemId ?? null }
|
|
1428
|
+
), g = Z.safeParse(u);
|
|
1429
|
+
if (!g.success) {
|
|
1175
1430
|
console.warn(
|
|
1176
1431
|
"[SolutionBuilder] updateDesign schema validation failed:",
|
|
1177
|
-
{ errors:
|
|
1432
|
+
{ errors: g.error.issues, llmResponse: o, patchedDesign: u }
|
|
1178
1433
|
);
|
|
1179
|
-
const p =
|
|
1434
|
+
const p = f("applyChangeFailed", e);
|
|
1180
1435
|
return {
|
|
1181
1436
|
outputMessage: p,
|
|
1182
1437
|
summary: p,
|
|
1183
1438
|
status: "success"
|
|
1184
1439
|
};
|
|
1185
1440
|
}
|
|
1186
|
-
const { response: S, featureLayer:
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
),
|
|
1190
|
-
{ ...
|
|
1441
|
+
const { response: S, featureLayer: N, ...C } = g.data, z = ge(
|
|
1442
|
+
N,
|
|
1443
|
+
t.featureLayer
|
|
1444
|
+
), I = $(
|
|
1445
|
+
{ ...C, featureLayer: z },
|
|
1191
1446
|
{
|
|
1192
|
-
itemId:
|
|
1193
|
-
sourceBuildSolution:
|
|
1194
|
-
templateId:
|
|
1195
|
-
params:
|
|
1447
|
+
itemId: t.solution?.itemId,
|
|
1448
|
+
sourceBuildSolution: t.sourceBuildSolution,
|
|
1449
|
+
templateId: t.templateId ?? s.selectedTemplate ?? null,
|
|
1450
|
+
params: t.params ?? null
|
|
1196
1451
|
}
|
|
1197
1452
|
);
|
|
1198
|
-
let
|
|
1199
|
-
if (
|
|
1453
|
+
let D = q(s.selectedTemplate);
|
|
1454
|
+
if (D?.initialTemplate || (await te(e), D = q(s.selectedTemplate)), m(e))
|
|
1200
1455
|
return {};
|
|
1201
|
-
if (!
|
|
1456
|
+
if (!D?.initialTemplate)
|
|
1202
1457
|
throw new Error("No hydrated templates are available for solution design.");
|
|
1203
|
-
const
|
|
1204
|
-
if (!
|
|
1458
|
+
const j = new b(I, D.initialTemplate, !1);
|
|
1459
|
+
if (!j.isValid) {
|
|
1205
1460
|
console.warn(
|
|
1206
1461
|
"[SolutionBuilder] updateDesign validation failed:",
|
|
1207
|
-
{ issues:
|
|
1462
|
+
{ issues: j.issues, llmResponse: o, patchedDesign: I }
|
|
1208
1463
|
);
|
|
1209
|
-
const p = await
|
|
1464
|
+
const p = await Lt({
|
|
1210
1465
|
query: i,
|
|
1211
|
-
validationIssues:
|
|
1466
|
+
validationIssues: j.issues,
|
|
1212
1467
|
recentMessages: n,
|
|
1213
|
-
fallbackMessage:
|
|
1214
|
-
promptModules:
|
|
1468
|
+
fallbackMessage: f("applyChangeFailed", e),
|
|
1469
|
+
promptModules: L
|
|
1215
1470
|
});
|
|
1216
1471
|
return {
|
|
1217
1472
|
outputMessage: p,
|
|
@@ -1219,151 +1474,153 @@ Description: ${u.description}`).join(`
|
|
|
1219
1474
|
status: "success"
|
|
1220
1475
|
};
|
|
1221
1476
|
}
|
|
1222
|
-
const
|
|
1223
|
-
if (!
|
|
1477
|
+
const ke = I.sourceBuildSolution, ne = Se(I, ke);
|
|
1478
|
+
if (!ne.ok) {
|
|
1224
1479
|
console.warn(
|
|
1225
1480
|
"[SolutionBuilder] updateDesign Esri JSON conversion failed:",
|
|
1226
|
-
{ error:
|
|
1481
|
+
{ error: ne.error, llmResponse: o, design: I }
|
|
1227
1482
|
);
|
|
1228
|
-
const p =
|
|
1483
|
+
const p = f("applyChangeFailed", e);
|
|
1229
1484
|
return {
|
|
1230
1485
|
outputMessage: p,
|
|
1231
1486
|
summary: p,
|
|
1232
1487
|
status: "success"
|
|
1233
1488
|
};
|
|
1234
1489
|
}
|
|
1235
|
-
return
|
|
1490
|
+
return m(e) ? {} : (_e(I), {
|
|
1236
1491
|
outputMessage: a,
|
|
1237
1492
|
summary: a,
|
|
1238
1493
|
status: "success",
|
|
1239
|
-
currentDesign:
|
|
1494
|
+
currentDesign: I
|
|
1240
1495
|
});
|
|
1241
|
-
},
|
|
1496
|
+
}, 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
1497
|
assessUpdateRequest: "assessUpdateRequest",
|
|
1243
1498
|
assessBuildRequest: "assessBuildRequest"
|
|
1244
|
-
}).addConditionalEdges("assessUpdateRequest",
|
|
1499
|
+
}).addConditionalEdges("assessUpdateRequest", ss, {
|
|
1245
1500
|
invalidUpdateExit: "invalidUpdateExit",
|
|
1246
1501
|
updateDesign: "updateDesign"
|
|
1247
|
-
}).addConditionalEdges("assessBuildRequest",
|
|
1502
|
+
}).addConditionalEdges("assessBuildRequest", is, {
|
|
1248
1503
|
invalidBuildExit: "invalidBuildExit",
|
|
1249
1504
|
selectTemplateHIL: "selectTemplateHIL",
|
|
1250
1505
|
findExistingSolutions: "findExistingSolutions"
|
|
1251
|
-
}).addEdge("invalidBuildExit",
|
|
1506
|
+
}).addEdge("invalidBuildExit", A).addEdge("invalidUpdateExit", A).addEdge("selectTemplateHIL", "findExistingSolutions").addConditionalEdges("findExistingSolutions", ns, {
|
|
1252
1507
|
confirmContinueBuildingHIL: "confirmContinueBuildingHIL",
|
|
1253
1508
|
designSolution: "designSolution"
|
|
1254
|
-
}).addConditionalEdges("confirmContinueBuildingHIL",
|
|
1509
|
+
}).addConditionalEdges("confirmContinueBuildingHIL", os, {
|
|
1255
1510
|
declineContinueBuildingExit: "declineContinueBuildingExit",
|
|
1256
1511
|
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
|
-
|
|
1512
|
+
}).addEdge("declineContinueBuildingExit", A).addEdge("designSolution", A).addEdge("updateDesign", A);
|
|
1513
|
+
await v(L, "description");
|
|
1514
|
+
const rs = E.object({
|
|
1515
|
+
tool: E.enum(["explorer", "builder", "other"]).describe("The selected tool based on the user’s intent using the conversation context."),
|
|
1516
|
+
confidence: E.number().min(0).max(1).describe("A confidence score (0.00–1.00)."),
|
|
1517
|
+
rationale: E.string().min(1).describe("A brief rationale for the tool choice (≤140 characters)")
|
|
1518
|
+
}), O = (s) => s?.signal?.aborted ?? !1, se = /* @__PURE__ */ Object.assign({
|
|
1519
|
+
"./prompts/assistantResponse.md": () => import("../../chunks/assistantResponse.js").then((s) => s.default),
|
|
1520
|
+
"./prompts/classifyIntent.md": () => import("../../chunks/classifyIntent.js").then((s) => s.default),
|
|
1521
|
+
"./prompts/description.md": () => import("../../chunks/description.js").then((s) => s.default)
|
|
1522
|
+
}), ls = (s) => {
|
|
1523
|
+
const e = s?.configurable?.context?.solutionDesignJson, t = s?.configurable?.context?.lastTurnAgent, i = t === "assistant" ? "other" : t;
|
|
1524
|
+
let n = !1;
|
|
1525
|
+
if (typeof e == "string" && e.trim())
|
|
1526
|
+
try {
|
|
1527
|
+
n = JSON.parse(e).solution != null;
|
|
1528
|
+
} catch {
|
|
1529
|
+
n = !1;
|
|
1530
|
+
}
|
|
1531
|
+
return { activeSolutionDesign: n, lastTool: i };
|
|
1532
|
+
}, ie = (s, e) => {
|
|
1533
|
+
const t = s?.configurable?.context?.setLastTurnAgent;
|
|
1534
|
+
typeof t == "function" && t(e);
|
|
1270
1535
|
const i = new CustomEvent("assistantProcessing", {
|
|
1271
1536
|
detail: { finished: !0, agent: e }
|
|
1272
1537
|
});
|
|
1273
1538
|
window.dispatchEvent(i);
|
|
1274
|
-
},
|
|
1275
|
-
...
|
|
1276
|
-
selectedTool:
|
|
1277
|
-
reducer: (
|
|
1539
|
+
}, $e = x.Root({
|
|
1540
|
+
...X(),
|
|
1541
|
+
selectedTool: x({
|
|
1542
|
+
reducer: (s, e) => e ?? null,
|
|
1278
1543
|
default: () => null
|
|
1279
1544
|
}),
|
|
1280
|
-
intentRationale:
|
|
1281
|
-
reducer: (
|
|
1545
|
+
intentRationale: x({
|
|
1546
|
+
reducer: (s, e) => e ?? null,
|
|
1282
1547
|
default: () => null
|
|
1283
1548
|
})
|
|
1284
|
-
}),
|
|
1285
|
-
if (e
|
|
1549
|
+
}), cs = async (s, e) => {
|
|
1550
|
+
if (O(e))
|
|
1286
1551
|
return {};
|
|
1287
|
-
const
|
|
1288
|
-
await
|
|
1289
|
-
{ text:
|
|
1552
|
+
const t = U(e);
|
|
1553
|
+
await _(
|
|
1554
|
+
{ text: t?.builderMessages.understandingRequest },
|
|
1290
1555
|
e
|
|
1291
1556
|
);
|
|
1292
|
-
const i =
|
|
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,
|
|
1557
|
+
const i = s.agentExecutionContext.userRequest, n = s.agentExecutionContext.messages.slice(-11), { activeSolutionDesign: o, lastTool: a } = ls(e), r = await v(se, "classifyIntent"), c = await k({
|
|
1558
|
+
promptText: r,
|
|
1302
1559
|
modelTier: "advanced",
|
|
1303
1560
|
temperature: 0,
|
|
1304
|
-
schema:
|
|
1561
|
+
schema: rs,
|
|
1305
1562
|
messages: n,
|
|
1306
|
-
inputVariables: { query: i, activeSolutionDesign: a }
|
|
1563
|
+
inputVariables: { query: i, activeSolutionDesign: o, lastTool: a }
|
|
1307
1564
|
});
|
|
1308
1565
|
return {
|
|
1309
|
-
selectedTool:
|
|
1310
|
-
intentRationale:
|
|
1566
|
+
selectedTool: c.tool,
|
|
1567
|
+
intentRationale: c.rationale
|
|
1311
1568
|
};
|
|
1312
|
-
},
|
|
1313
|
-
if (e
|
|
1569
|
+
}, us = async (s, e) => {
|
|
1570
|
+
if (O(e))
|
|
1314
1571
|
return {};
|
|
1315
|
-
const i = await
|
|
1316
|
-
return
|
|
1317
|
-
},
|
|
1318
|
-
if (e
|
|
1572
|
+
const i = await lt().compile().invoke(s, e);
|
|
1573
|
+
return ie(e, "explorer"), i;
|
|
1574
|
+
}, ds = async (s, e) => {
|
|
1575
|
+
if (O(e))
|
|
1319
1576
|
return {};
|
|
1320
|
-
const i = await
|
|
1321
|
-
return
|
|
1322
|
-
},
|
|
1323
|
-
if (e
|
|
1577
|
+
const i = await as().compile().invoke(s, e);
|
|
1578
|
+
return ie(e, "builder"), i;
|
|
1579
|
+
}, ps = async (s, e) => {
|
|
1580
|
+
if (O(e))
|
|
1324
1581
|
return {};
|
|
1325
|
-
const
|
|
1326
|
-
await
|
|
1327
|
-
{ text:
|
|
1582
|
+
const t = U(e), i = s.agentExecutionContext.userRequest, n = s.intentRationale ?? "No rationale available.";
|
|
1583
|
+
await _(
|
|
1584
|
+
{ text: t?.executingSolutionsAssistantAgent },
|
|
1328
1585
|
e
|
|
1329
1586
|
);
|
|
1330
|
-
const o = await v(
|
|
1587
|
+
const o = await v(se, "assistantResponse"), a = s.agentExecutionContext.messages.slice(-11), r = await Ge({
|
|
1331
1588
|
promptText: o,
|
|
1332
1589
|
modelTier: "advanced",
|
|
1333
1590
|
temperature: 0,
|
|
1334
1591
|
messages: a,
|
|
1335
1592
|
inputVariables: { query: i, rationale: n }
|
|
1336
1593
|
});
|
|
1337
|
-
return
|
|
1338
|
-
outputMessage:
|
|
1339
|
-
summary:
|
|
1594
|
+
return ie(e, "assistant"), {
|
|
1595
|
+
outputMessage: r,
|
|
1596
|
+
summary: r,
|
|
1340
1597
|
status: "success"
|
|
1341
1598
|
};
|
|
1342
|
-
},
|
|
1599
|
+
}, 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
1600
|
explorer: "routeToExplorer",
|
|
1344
1601
|
builder: "routeToBuilder",
|
|
1345
1602
|
other: "assistantResponse"
|
|
1346
|
-
}).addEdge("routeToExplorer",
|
|
1603
|
+
}).addEdge("routeToExplorer", A).addEdge("routeToBuilder", A).addEdge("assistantResponse", A), gs = await v(se, "description"), fs = {
|
|
1347
1604
|
id: "solutionsAssistant",
|
|
1348
1605
|
name: "Solutions Assistant Agent",
|
|
1349
|
-
description:
|
|
1350
|
-
createGraph:
|
|
1351
|
-
workspace:
|
|
1352
|
-
},
|
|
1353
|
-
class
|
|
1606
|
+
description: gs,
|
|
1607
|
+
createGraph: hs,
|
|
1608
|
+
workspace: $e
|
|
1609
|
+
}, ys = "https://links.esri.com/solutions/agol-organizational-account", bs = "https://links.esri.com/solutions/configure-assistants";
|
|
1610
|
+
class xs extends De {
|
|
1354
1611
|
constructor() {
|
|
1355
1612
|
super(), this.open = !1, this.userFirstName = "", this.builderVisible = !1, this.hasActiveBuilderDesign = !1, this._conversationId = void 0, this._lastTurnAgent = void 0, this._orgSettings = {
|
|
1356
1613
|
aiAssistantsEnabled: !1,
|
|
1357
1614
|
blockBetaApps: !0,
|
|
1358
1615
|
colocateCompute: !1
|
|
1359
|
-
}, this._suggestedPrompts = [], this._hasInteracted = !1, this._isMobile = window.innerWidth <= 800, this._translations =
|
|
1360
|
-
context:
|
|
1616
|
+
}, 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({
|
|
1617
|
+
context: Be,
|
|
1361
1618
|
subscribe: !0,
|
|
1362
1619
|
callback: (e) => {
|
|
1363
|
-
e?.portalURL && (
|
|
1620
|
+
e?.portalURL && (G.portalUrl = e.portalURL), e?.userSession && !this.userFirstName && this._loadUserFirstName(), e?.authentication?.PortalSubset?.orgSettings && (this._orgSettings = e?.authentication?.PortalSubset?.orgSettings);
|
|
1364
1621
|
}
|
|
1365
|
-
}), this._builderDesignContextConsumer =
|
|
1366
|
-
context:
|
|
1622
|
+
}), this._builderDesignContextConsumer = le({
|
|
1623
|
+
context: Pe,
|
|
1367
1624
|
subscribe: !0,
|
|
1368
1625
|
callback: (e) => {
|
|
1369
1626
|
e?.design && (this._solutionDesignJson = JSON.stringify(e.design, null, 2));
|
|
@@ -1371,24 +1628,24 @@ class ms extends Fe {
|
|
|
1371
1628
|
}), this._handleResize = () => {
|
|
1372
1629
|
this._isMobile = window.innerWidth <= 800;
|
|
1373
1630
|
}, this._chatStartTime = null, this._handleAssistantProcessingFinished = (e) => {
|
|
1374
|
-
const
|
|
1375
|
-
if (
|
|
1376
|
-
const i =
|
|
1631
|
+
const t = e;
|
|
1632
|
+
if (t.detail?.finished && this._chatStartTime !== null) {
|
|
1633
|
+
const i = qe(this._chatStartTime);
|
|
1377
1634
|
this._telemetry?.logEvent({
|
|
1378
|
-
category:
|
|
1635
|
+
category: M.ASSISTANT,
|
|
1379
1636
|
action: "Chat",
|
|
1380
|
-
dimensions: [
|
|
1637
|
+
dimensions: [t.detail.agent],
|
|
1381
1638
|
metrics: [i]
|
|
1382
|
-
}), this._chatStartTime = null
|
|
1639
|
+
}), this._chatStartTime = null;
|
|
1383
1640
|
}
|
|
1384
|
-
}, this.closeAssistant =
|
|
1385
|
-
const
|
|
1386
|
-
if (
|
|
1387
|
-
if (e.preventDefault(),
|
|
1388
|
-
const i =
|
|
1641
|
+
}, this.closeAssistant = ae(), this.assistantProcessing = ae(), this._handleAssistantLinkClick = (e) => {
|
|
1642
|
+
const t = e.composedPath().find((i) => i instanceof HTMLAnchorElement);
|
|
1643
|
+
if (t?.href)
|
|
1644
|
+
if (e.preventDefault(), t.target.indexOf("solutionId:") > -1) {
|
|
1645
|
+
const i = t.target.split("solutionId:")[1];
|
|
1389
1646
|
this._emitItemIdFromAI(i);
|
|
1390
1647
|
} else
|
|
1391
|
-
window.open(
|
|
1648
|
+
window.open(t.href, "_blank", "noopener,noreferrer");
|
|
1392
1649
|
}, this._onSolutionDesignUpdate = (e) => {
|
|
1393
1650
|
const i = e.detail;
|
|
1394
1651
|
this._solutionDesignJson = i ? JSON.stringify(i, null, 2) : '{ "solution": null }';
|
|
@@ -1397,8 +1654,8 @@ class ms extends Fe {
|
|
|
1397
1654
|
}, this._checkURLOpenParameter = () => {
|
|
1398
1655
|
this.open = this._configContextConsumer.value?.authentication?.SignInParam === "aiOpen" || this.open;
|
|
1399
1656
|
}, this.listenOn(window, "arcgisFeedback", (e) => {
|
|
1400
|
-
const
|
|
1401
|
-
this._sendFeedback(
|
|
1657
|
+
const t = e.detail, { agentPicked: i, taskAssigned: n, userMessage: o } = this._parseAgentPickedAndTask(t);
|
|
1658
|
+
this._sendFeedback(t.content, o ?? n ?? "", t.feedback?.positive ? "Good" : t.feedback?.positive == "Bad" ? "Bad" : "N/A", i ?? "");
|
|
1402
1659
|
}), this.listenOn(window, "clearAssistantConversation", () => {
|
|
1403
1660
|
this._clearConversation();
|
|
1404
1661
|
});
|
|
@@ -1407,7 +1664,7 @@ class ms extends Fe {
|
|
|
1407
1664
|
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
1665
|
}
|
|
1409
1666
|
static {
|
|
1410
|
-
this.styles =
|
|
1667
|
+
this.styles = Ze;
|
|
1411
1668
|
}
|
|
1412
1669
|
get _telemetry() {
|
|
1413
1670
|
return this._configContextConsumer.value?.telemetrySession;
|
|
@@ -1422,39 +1679,41 @@ class ms extends Fe {
|
|
|
1422
1679
|
this._checkURLOpenParameter();
|
|
1423
1680
|
}
|
|
1424
1681
|
load() {
|
|
1425
|
-
|
|
1682
|
+
G.applicationName = "Solutions", this._configContextConsumer.value?.portalURL && (G.portalUrl = this._configContextConsumer.value.portalURL);
|
|
1426
1683
|
}
|
|
1427
1684
|
firstUpdated(e) {
|
|
1428
1685
|
this._loadUserFirstName();
|
|
1429
1686
|
}
|
|
1430
1687
|
willUpdate(e) {
|
|
1431
|
-
e.has("open") && this.open && window.dispatchEvent(new CustomEvent("openAssistant")), this._configContextConsumer.value?.authentication && this._configContextConsumer.value?.userSession?.token && (this._preChatCheck || (
|
|
1688
|
+
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
1689
|
}
|
|
1433
1690
|
_renderNoSign() {
|
|
1434
|
-
return
|
|
1691
|
+
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
1692
|
}
|
|
1436
1693
|
_renderNoPermission() {
|
|
1437
|
-
return
|
|
1694
|
+
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
1695
|
}
|
|
1439
1696
|
render() {
|
|
1440
1697
|
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)]),
|
|
1698
|
+
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
1699
|
this._telemetry?.logEvent({
|
|
1443
|
-
category:
|
|
1700
|
+
category: M.ASSISTANT,
|
|
1444
1701
|
action: "Toggle Builder Panel",
|
|
1445
1702
|
dimensions: [this.builderVisible ? "Close" : "Open"]
|
|
1446
1703
|
}), 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
|
-
}}
|
|
1704
|
+
}} 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) => {
|
|
1705
|
+
console.log("arcgis submit: ", t.detail), this._suggestedPrompts = [], e = [], this._hasInteracted = !0, this._chatStartTime = Date.now(), this.assistantProcessing.emit(!0);
|
|
1706
|
+
}} @arcgisFeedback=${(t) => {
|
|
1707
|
+
t.detail;
|
|
1708
|
+
}} @arcgisResponse=${() => {
|
|
1709
|
+
this.assistantProcessing.emit(!1);
|
|
1710
|
+
}} ${Oe(this._assistantRef)}><calcite-button appearance=transparent id=newChatButton icon-start=speech-bubble-plus kind=neutral .label=${this._translations.tooltips.newChat} @click=${() => {
|
|
1452
1711
|
this.hasActiveBuilderDesign ? this._showNewChatConfirm = !0 : (this._telemetry?.logEvent({
|
|
1453
|
-
category:
|
|
1712
|
+
category: M.ASSISTANT,
|
|
1454
1713
|
action: "New Chat",
|
|
1455
1714
|
dimensions: ["No Active Design"]
|
|
1456
1715
|
}), this._clearConversation());
|
|
1457
|
-
}} round scale=m slot=entry-actions-start>${this._translations.tooltips.newChat}</calcite-button><arcgis-assistant-agent .agent=${
|
|
1716
|
+
}} round scale=m slot=entry-actions-start>${this._translations.tooltips.newChat}</calcite-button><arcgis-assistant-agent .agent=${fs} .context=${{
|
|
1458
1717
|
token: this._configContextConsumer.value?.userSession?.token,
|
|
1459
1718
|
configContext: this._configContextConsumer.value,
|
|
1460
1719
|
convoId: this._conversationId,
|
|
@@ -1463,20 +1722,20 @@ class ms extends Fe {
|
|
|
1463
1722
|
translations: this._translations,
|
|
1464
1723
|
solutionDesignJson: this._solutionDesignJson,
|
|
1465
1724
|
lastTurnAgent: this._lastTurnAgent,
|
|
1466
|
-
setConversationId: (
|
|
1467
|
-
this._conversationId =
|
|
1725
|
+
setConversationId: (t) => {
|
|
1726
|
+
this._conversationId = t;
|
|
1468
1727
|
},
|
|
1469
|
-
setLastTurnAgent: (
|
|
1470
|
-
this._lastTurnAgent =
|
|
1728
|
+
setLastTurnAgent: (t) => {
|
|
1729
|
+
this._lastTurnAgent = t;
|
|
1471
1730
|
},
|
|
1472
1731
|
clearSuggestedPrompts: () => {
|
|
1473
1732
|
this._suggestedPrompts = [];
|
|
1474
1733
|
}
|
|
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 &&
|
|
1734
|
+
}}></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
1735
|
this._showNewChatConfirm = !1;
|
|
1477
1736
|
}} slot=footer-end>${this._translations.cancel}</calcite-button><calcite-button appearance=solid kind=danger @click=${() => {
|
|
1478
1737
|
this._telemetry?.logEvent({
|
|
1479
|
-
category:
|
|
1738
|
+
category: M.ASSISTANT,
|
|
1480
1739
|
action: "New Chat",
|
|
1481
1740
|
dimensions: ["With Design Discard"]
|
|
1482
1741
|
}), this._showNewChatConfirm = !1, window.dispatchEvent(new CustomEvent("requestBuilderDiscard"));
|
|
@@ -1487,40 +1746,40 @@ class ms extends Fe {
|
|
|
1487
1746
|
_clearConversation() {
|
|
1488
1747
|
this._conversationId = void 0, this._lastTurnAgent = void 0, this._suggestedPrompts = [], this._hasInteracted = !1, this._assistantRef.value?.clearChatHistory();
|
|
1489
1748
|
}
|
|
1490
|
-
_sendFeedback(e,
|
|
1491
|
-
const o = `https://survey123.arcgis.com/share/6e349a50b4504ca6b6107216d568db5f?field:_source=${encodeURIComponent("Solutions Assistant")}&field:user_evaluation=${encodeURIComponent(i)}&field:question=${encodeURIComponent(
|
|
1749
|
+
_sendFeedback(e, t, i, n) {
|
|
1750
|
+
const o = `https://survey123.arcgis.com/share/6e349a50b4504ca6b6107216d568db5f?field:_source=${encodeURIComponent("Solutions Assistant")}&field:user_evaluation=${encodeURIComponent(i)}&field:question=${encodeURIComponent(t)}&field:answer=${encodeURIComponent(e)}&field:context=${encodeURIComponent(JSON.stringify({ agent: n }))}&field:version=${encodeURIComponent("v2")}`;
|
|
1492
1751
|
window.open(o, "_blank");
|
|
1493
1752
|
}
|
|
1494
1753
|
async _loadUserFirstName() {
|
|
1495
1754
|
try {
|
|
1496
1755
|
const e = await this._configContextConsumer.value?.userSession?.getUser();
|
|
1497
1756
|
if (e?.fullName) {
|
|
1498
|
-
const
|
|
1499
|
-
this.userFirstName =
|
|
1757
|
+
const t = e.fullName.split(" ")[0];
|
|
1758
|
+
this.userFirstName = t;
|
|
1500
1759
|
}
|
|
1501
1760
|
} catch {
|
|
1502
1761
|
}
|
|
1503
1762
|
}
|
|
1504
1763
|
_parseAgentPickedAndTask(e) {
|
|
1505
|
-
const
|
|
1506
|
-
if (!
|
|
1764
|
+
const t = Array.from(this._assistantRef.value?.messages || []), i = e.log || [], a = [...t].sort((u, g) => g.id - u.id).find((u) => u.role === "user" && u.id <= e.id)?.content || null, r = i.find((u) => typeof u == "string" && u.includes("Agent picked:")) ?? null;
|
|
1765
|
+
if (!r)
|
|
1507
1766
|
return { agentPicked: null, taskAssigned: null, userMessage: a };
|
|
1508
|
-
const
|
|
1509
|
-
if (!
|
|
1767
|
+
const c = /Agent picked:\s*(.*?)\s*(?:\\n|\r?\n)\s*Task Assigned:\s*([\s\S]*)$/i, d = r.match(c);
|
|
1768
|
+
if (!d)
|
|
1510
1769
|
return { agentPicked: null, taskAssigned: null, userMessage: a };
|
|
1511
|
-
const
|
|
1512
|
-
return { agentPicked:
|
|
1770
|
+
const h = d[1].trim(), y = d[2].trim();
|
|
1771
|
+
return { agentPicked: h, taskAssigned: y, userMessage: a };
|
|
1513
1772
|
}
|
|
1514
1773
|
_emitItemIdFromAI(e) {
|
|
1515
|
-
const
|
|
1774
|
+
const t = new CustomEvent("solutionIDFromAssistant", {
|
|
1516
1775
|
detail: e,
|
|
1517
1776
|
bubbles: !0,
|
|
1518
1777
|
composed: !0
|
|
1519
1778
|
});
|
|
1520
|
-
window.dispatchEvent(
|
|
1779
|
+
window.dispatchEvent(t);
|
|
1521
1780
|
}
|
|
1522
1781
|
}
|
|
1523
|
-
|
|
1782
|
+
Ne("arcgis-solutions-assistant", xs);
|
|
1524
1783
|
export {
|
|
1525
|
-
|
|
1784
|
+
xs as ArcgisSolutionsAssistant
|
|
1526
1785
|
};
|