@esri/solutions-components 5.1.0 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/{LV5KMTCD.js → 224NND54.js} +1 -1
- package/dist/cdn/{Y2MAVMNV.js → 2MDEEI52.js} +1 -1
- package/dist/cdn/{R27S3IDW.js → 3BL4GCSN.js} +1 -1
- package/dist/cdn/{MKSUYITL.js → 3T56IY7B.js} +1 -1
- package/dist/cdn/{SEG43OPO.js → 4G5PYXFM.js} +1 -1
- package/dist/cdn/{CVXDL2AT.js → 4MAH5ULJ.js} +1 -1
- package/dist/cdn/4RWJ22V3.js +2 -0
- package/dist/cdn/{PIAGRMMB.js → 4SYZADNV.js} +47 -47
- package/dist/cdn/{FSHV53TK.js → 4VP3KTLL.js} +1 -1
- package/dist/cdn/{EWS72RFR.js → 5A5W5PLO.js} +1 -1
- package/dist/cdn/{TWN7DOAU.js → 5FW45CM6.js} +1 -1
- package/dist/cdn/{YUI2MSOK.js → 5VUSSAPX.js} +1 -1
- package/dist/cdn/{5UW2NTSN.js → 5YD3IE6V.js} +1 -1
- package/dist/cdn/{TWJ6DAY5.js → 65I4AUS4.js} +1 -1
- package/dist/cdn/{GMAAQEP7.js → 67KMG355.js} +1 -1
- package/dist/cdn/{2R7Y2ZVX.js → 6CVQ3V2G.js} +1 -1
- package/dist/cdn/{RCWYHGZ5.js → 6FNUCCS3.js} +1 -1
- package/dist/cdn/{OYRMCWNZ.js → 7GVLJERR.js} +1 -1
- package/dist/cdn/{BI3I22IR.js → AIM6JKQK.js} +3 -3
- package/dist/cdn/{DIBK4RSG.js → AIZ2P72X.js} +1 -1
- package/dist/cdn/{KSIYOSLP.js → AXEZNIEX.js} +1 -1
- package/dist/cdn/{TZHRYPII.js → B7CVHLVL.js} +1 -1
- package/dist/cdn/{3A3CPQX4.js → B7TH7XYI.js} +1 -1
- package/dist/cdn/{JO6WZKYF.js → BQ2LFMED.js} +1 -1
- package/dist/cdn/{VPXGD2H4.js → CJJEWE3Q.js} +1 -1
- package/dist/cdn/{WNVC3PSY.js → D25JFQEK.js} +1 -1
- package/dist/cdn/D5OMLQMV.js +2 -0
- package/dist/cdn/{6FY64JKN.js → DEATAJID.js} +1 -1
- package/dist/cdn/{LGWAEUZM.js → DGY2VKHA.js} +1 -1
- package/dist/cdn/{5X43GK3C.js → DJXQKOIX.js} +1 -1
- package/dist/cdn/DQPIAF2T.js +3 -0
- package/dist/cdn/{V5UJ5VTY.js → DXQBDTBG.js} +1 -1
- package/dist/cdn/{BIX5DRQP.js → E4OPUBGE.js} +1 -1
- package/dist/cdn/{NXX22DHX.js → E5A7A2YY.js} +1 -1
- package/dist/cdn/{47FRMYZ4.js → ECUD4NU6.js} +1 -1
- package/dist/cdn/EL34IIAJ.js +2 -0
- package/dist/cdn/{Y6JJY3IC.js → ERQAH6G3.js} +1 -1
- package/dist/cdn/{SXTON3QW.js → EWIPITVN.js} +1 -1
- package/dist/cdn/{7O4E4IAA.js → F6LBLCUM.js} +1 -1
- package/dist/cdn/{M6AOD7GG.js → FDNEF4QD.js} +1 -1
- package/dist/cdn/{SXEL7KTE.js → G772MFBV.js} +1 -1
- package/dist/cdn/{O4DB2EXV.js → GSLDFLWZ.js} +1 -1
- package/dist/cdn/{6GBSXKKJ.js → GSOMYPWB.js} +1 -1
- package/dist/cdn/{Q4UI3ZGH.js → GV3GU3O3.js} +1 -1
- package/dist/cdn/{PUYJYHQM.js → GYVIOOMC.js} +1 -1
- package/dist/cdn/{PM4EFNB2.js → HMZ4VIJQ.js} +1 -1
- package/dist/cdn/{G4V4JPFI.js → HOSSEVH5.js} +1 -1
- package/dist/cdn/{RRWG2OJP.js → HQIM7CQS.js} +1 -1
- package/dist/cdn/{IXRFWVBT.js → IGY23J7D.js} +1 -1
- package/dist/cdn/{56DNSWXG.js → IVMHEGLY.js} +1 -1
- package/dist/cdn/{F4MS4NQL.js → JB5XLSNA.js} +1 -1
- package/dist/cdn/{IAEFPE3L.js → JF2ASXUT.js} +1 -1
- package/dist/cdn/{7QKF26VG.js → JGSZS6VC.js} +1 -1
- package/dist/cdn/{D22STVK5.js → JKUPRPWA.js} +1 -1
- package/dist/cdn/{2TEBTKD4.js → K5EP7XDM.js} +1 -1
- package/dist/cdn/{BOFA5RH7.js → K6GC6RUA.js} +1 -1
- package/dist/cdn/{SJLSYFK3.js → KENYVRIH.js} +1 -1
- package/dist/cdn/{CLHUIZMU.js → KLFAQLC6.js} +1 -1
- package/dist/cdn/{5IDPOFIN.js → KLZWOBGK.js} +1 -1
- package/dist/cdn/{XQ7SXIHI.js → KPEPW4QL.js} +1 -1
- package/dist/cdn/{3JCHYXHA.js → KPKJ2OVD.js} +1 -1
- package/dist/cdn/{BHLMO6KY.js → KWOBLDUS.js} +1 -1
- package/dist/cdn/{463CZQF6.js → KXANPOG5.js} +1 -1
- package/dist/cdn/LADUP3BG.js +2 -0
- package/dist/cdn/{HOCCKT72.js → LIEHXKWK.js} +1 -1
- package/dist/cdn/{XKFX43FE.js → LKVPVQIC.js} +1 -1
- package/dist/cdn/{GUSPFJUQ.js → LQFA6HOT.js} +1 -1
- package/dist/cdn/{UCYR537P.js → LRGW6G5E.js} +1 -1
- package/dist/cdn/{H4LZV33O.js → LSMP2ZCO.js} +1 -1
- package/dist/cdn/{5LSNDSHW.js → M5VGNDPK.js} +1 -1
- package/dist/cdn/{NX7HKBFH.js → MHMM4RFR.js} +1 -1
- package/dist/cdn/{2RL6H5TB.js → MVSQRD5M.js} +1 -1
- package/dist/cdn/MXPZF4RB.js +2 -0
- package/dist/cdn/{ZHCAZ2TH.js → MZOWOFAE.js} +1 -1
- package/dist/cdn/{54A4C4RG.js → N5D7USS3.js} +1 -1
- package/dist/cdn/{7P57UVVG.js → NEZAEPUJ.js} +1 -1
- package/dist/cdn/{SSCE4O7V.js → NQP26Q5H.js} +1 -1
- package/dist/cdn/{3BG6WS6Q.js → NWNUNME7.js} +1 -1
- package/dist/cdn/{HM2QALUN.js → O6IGMQN7.js} +1 -1
- package/dist/cdn/{ZZZPISEE.js → ONAAPGO3.js} +1 -1
- package/dist/cdn/{NIYY6XUQ.js → OSOSX7F3.js} +1 -1
- package/dist/cdn/{QEUKNYOL.js → OTTBXOCQ.js} +1 -1
- package/dist/cdn/{UIZL3C3H.js → OU4VLS5H.js} +1 -1
- package/dist/cdn/{BT6SXXE2.js → OYMJFSWN.js} +1 -1
- package/dist/cdn/{MIV34H66.js → P2QNOVPZ.js} +1 -1
- package/dist/cdn/{SWY74BKB.js → P4ZYEBFM.js} +1 -1
- package/dist/cdn/{2AWUR4ZA.js → P734JXTN.js} +1 -1
- package/dist/cdn/{5N4KGIIY.js → PDJXTJHO.js} +1 -1
- package/dist/cdn/{4PDT6TEX.js → PEI3LZZL.js} +1 -1
- package/dist/cdn/{KTW6BSEC.js → PGFW2YO5.js} +1 -1
- package/dist/cdn/{SGQEHPTT.js → Q5LSIHQ4.js} +1 -1
- package/dist/cdn/{MDWJ6JLF.js → Q5XHG472.js} +1 -1
- package/dist/cdn/{BWWX52HV.js → Q6CXYCV6.js} +1 -1
- package/dist/cdn/{37P3IMFV.js → QKPUJ5CZ.js} +1 -1
- package/dist/cdn/{FQTDRS3G.js → QKQXW6OQ.js} +1 -1
- package/dist/cdn/{PLQEDCUG.js → QMQAQSIA.js} +1 -1
- package/dist/cdn/{FFZ2XVRE.js → QTCXH2O3.js} +1 -1
- package/dist/cdn/{4CSMWYIO.js → QWQ535RX.js} +1 -1
- package/dist/cdn/{RLYEATAS.js → R6ANOQU2.js} +1 -1
- package/dist/cdn/{KDDHPA54.js → R7DGMKJ5.js} +1 -1
- package/dist/cdn/{GFBJLNEH.js → RPUUOIRT.js} +1 -1
- package/dist/cdn/{EUI2Y6R4.js → RY7S2ICL.js} +1 -1
- package/dist/cdn/{5FWKODDH.js → S57RXN34.js} +1 -1
- package/dist/cdn/{GSR2GEY7.js → SD3DV4KO.js} +1 -1
- package/dist/cdn/{77753TPX.js → SEII6Y3C.js} +1 -1
- package/dist/cdn/{I4QWYULN.js → SUOJTOE2.js} +1 -1
- package/dist/cdn/{HIB4BVGK.js → SWUMBQ6T.js} +1 -1
- package/dist/cdn/{6WNKGSHD.js → TDDVICGP.js} +1 -1
- package/dist/cdn/{KRP5SGSU.js → US5ONKMV.js} +1 -1
- package/dist/cdn/{BXSBR2GT.js → V24CDHGH.js} +1 -1
- package/dist/cdn/{376KPQCJ.js → VEBBZ2RS.js} +1 -1
- package/dist/cdn/{XYKQ6M25.js → VIZY55AV.js} +1 -1
- package/dist/cdn/{KFRHOPZY.js → VNYXOWZX.js} +113 -113
- package/dist/cdn/{AZKNC2SR.js → VPHEAUEZ.js} +1 -1
- package/dist/cdn/{4SORDX5Z.js → VTRC64F6.js} +1 -1
- package/dist/cdn/{FSF3T3OT.js → VX3K6KJB.js} +1 -1
- package/dist/cdn/{FYJMHXWV.js → VXIWNY5G.js} +1 -1
- package/dist/cdn/{743J2ZUC.js → VZ2ZZK3Y.js} +1 -1
- package/dist/cdn/{X257ACPD.js → W3SEKNJO.js} +1 -1
- package/dist/cdn/{JHOJZDXC.js → WJRVHF3G.js} +1 -1
- package/dist/cdn/WNM5Z4SM.js +2 -0
- package/dist/cdn/{AIM7NSD3.js → WZHA7MTK.js} +1 -1
- package/dist/cdn/{VKHBBAXO.js → XA6ZDTKA.js} +1 -1
- package/dist/cdn/{X3YRR4BO.js → XDLYXP3W.js} +58 -58
- package/dist/cdn/{ARFBMFQW.js → XXRBPKMI.js} +1 -1
- package/dist/cdn/{INLWMPGE.js → XYAVR2MM.js} +1 -1
- package/dist/cdn/{6HZBPFHA.js → XYJU325L.js} +1 -1
- package/dist/cdn/{NNY2YF2L.js → Y3PEQHDX.js} +1 -1
- package/dist/cdn/{4RCC4KA2.js → Y7Z6LFBH.js} +1 -1
- package/dist/cdn/YJ3DKEEZ.js +2 -0
- package/dist/cdn/{HKFXHTYU.js → YVNBCXBJ.js} +1 -1
- package/dist/cdn/{VUXNHQGR.js → Z324WI3X.js} +1 -1
- package/dist/cdn/{A6ZTIX3P.js → ZSATEDPE.js} +1 -1
- package/dist/cdn/{LO35PCP7.js → ZX5GQTIE.js} +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/converter.js +88 -88
- package/dist/chunks/interfaces.js +19 -19
- package/dist/chunks/runtime.js +2 -2
- package/dist/chunks/solution-builder-assistant.js +1 -1
- package/dist/components/arcgis-solutions-assistant/customElement.js +331 -321
- package/dist/components/create-feature/customElement.js +23 -18
- package/dist/components/create-related-feature/customElement.js +8 -6
- package/dist/components/layer-table/customElement.js +1 -1
- package/dist/components/map-tools/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 +4 -7
- package/package.json +5 -5
- package/dist/cdn/E3F63VW4.js +0 -2
- package/dist/cdn/F7XCLL7U.js +0 -3
- package/dist/cdn/HIPZRG2Q.js +0 -2
- package/dist/cdn/IXPNZCW6.js +0 -2
- package/dist/cdn/J3SDL3LR.js +0 -2
- package/dist/cdn/KR2PPIBX.js +0 -2
- package/dist/cdn/QPHNKFC6.js +0 -2
- package/dist/cdn/S4GBMN37.js +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import { c as
|
|
3
|
-
import { u as
|
|
2
|
+
import { c as Fe } from "../../chunks/runtime.js";
|
|
3
|
+
import { u as Ne } from "../../chunks/useT9n.js";
|
|
4
4
|
import { LitElement as De, createEvent as ae, nothing as re } from "@arcgis/lumina";
|
|
5
5
|
import { css as Me, html as T } from "lit";
|
|
6
6
|
import { unsafeHTML as Re } from "lit/directives/unsafe-html.js";
|
|
@@ -10,16 +10,16 @@ import { T as M } from "../../chunks/interfaces.js";
|
|
|
10
10
|
import { m as qe } from "../../chunks/helpers.js";
|
|
11
11
|
import G from "@arcgis/core/config.js";
|
|
12
12
|
import { createRef as Ue, ref as Oe } from "lit-html/directives/ref.js";
|
|
13
|
-
import { Annotation as b, StateGraph as
|
|
14
|
-
import { createAgentRuntimeState as X, sendTraceMessage as w, invokeStructuredPrompt as
|
|
15
|
-
import
|
|
13
|
+
import { Annotation as b, StateGraph as W, START as K, END as A, NodeInterrupt as de } from "@langchain/langgraph/web";
|
|
14
|
+
import { createAgentRuntimeState as X, sendTraceMessage as w, invokeStructuredPrompt as k, getEmbeddings as ze, cosineSimilarity as je, invokeTextPrompt as Ge } from "@arcgis/ai-components/utils/index.js";
|
|
15
|
+
import c, { z as L } from "zod";
|
|
16
16
|
import * as Y from "@esri/arcgis-rest-portal";
|
|
17
17
|
import { applyPatch as Je } from "fast-json-patch";
|
|
18
18
|
import "@langchain/core/messages";
|
|
19
19
|
import { C as pe } from "../../chunks/converter.js";
|
|
20
|
-
import { v as J, b as H, S as He, h as Ve, E as Qe, g as
|
|
21
|
-
import { invokeStructuredPrompt as
|
|
22
|
-
import { t as me, g as q, c as he, r as ge, d as
|
|
20
|
+
import { v as J, b as H, S as He, h as Ve, E as Qe, g as We } from "../../chunks/validators.js";
|
|
21
|
+
import { invokeStructuredPrompt as Ke } from "@arcgis/ai-orchestrator";
|
|
22
|
+
import { t as me, g as q, c as he, r as ge, d as N } from "../../chunks/templates.js";
|
|
23
23
|
import Xe from "@arcgis/core/portal/Portal.js";
|
|
24
24
|
import Ye from "@arcgis/core/portal/PortalItem.js";
|
|
25
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)}`;
|
|
@@ -71,9 +71,9 @@ function ye(s) {
|
|
|
71
71
|
});
|
|
72
72
|
window.dispatchEvent(e);
|
|
73
73
|
}
|
|
74
|
-
const et =
|
|
75
|
-
needsContext:
|
|
76
|
-
rewrittenQuery:
|
|
74
|
+
const et = L.object({
|
|
75
|
+
needsContext: L.boolean().describe("True when the explorer query requires added context from prior turns."),
|
|
76
|
+
rewrittenQuery: L.string().min(1).describe("The final query to send to doc AI. Keep original query if no context is needed.")
|
|
77
77
|
}), ce = (s) => s?.signal?.aborted ?? !1, be = /* @__PURE__ */ Object.assign({
|
|
78
78
|
"./prompts/solutions_explorer_description.md": () => import("../../chunks/solutions_explorer_description.js").then((s) => s.default),
|
|
79
79
|
"./prompts/transformQuery.md": () => import("../../chunks/transformQuery.js").then((s) => s.default)
|
|
@@ -87,14 +87,14 @@ function st(s) {
|
|
|
87
87
|
function it(s, e) {
|
|
88
88
|
const t = [];
|
|
89
89
|
return (e?.configurable?.context?.configContext.allCards ?? []).forEach((n) => {
|
|
90
|
-
const
|
|
91
|
-
if (!
|
|
90
|
+
const o = n.title;
|
|
91
|
+
if (!o)
|
|
92
92
|
return;
|
|
93
|
-
const
|
|
93
|
+
const a = new RegExp(`(?<![\\p{L}\\p{N}])${o}(?![\\p{L}\\p{N}])`, "giu");
|
|
94
94
|
let r = !1;
|
|
95
|
-
s = s.replace(
|
|
95
|
+
s = s.replace(a, (l, d, h) => {
|
|
96
96
|
const y = h.slice(0, d);
|
|
97
|
-
return /<img[^>]*alt\s*=\s*["'][^"']*$/i.test(y) ?
|
|
97
|
+
return /<img[^>]*alt\s*=\s*["'][^"']*$/i.test(y) ? l : (r = !0, `<a href="" target="solutionId:${n.deployCommonId}">${o}</a>`);
|
|
98
98
|
}), r && t.push({
|
|
99
99
|
solution: {
|
|
100
100
|
title: n.title,
|
|
@@ -131,16 +131,16 @@ async function at(s, e) {
|
|
|
131
131
|
if (!i || n.length <= 1 || i === "explorer")
|
|
132
132
|
return t;
|
|
133
133
|
try {
|
|
134
|
-
const
|
|
135
|
-
promptText:
|
|
134
|
+
const o = await v(be, "transformQuery"), a = await k({
|
|
135
|
+
promptText: o,
|
|
136
136
|
modelTier: "advanced",
|
|
137
137
|
temperature: 0,
|
|
138
138
|
schema: et,
|
|
139
139
|
messages: n.slice(-11),
|
|
140
140
|
inputVariables: { query: t, lastTurnAgent: i }
|
|
141
141
|
});
|
|
142
|
-
if (
|
|
143
|
-
return console.debug(`Rephrased query from "${t}" to "${
|
|
142
|
+
if (a.needsContext && a.rewrittenQuery.trim())
|
|
143
|
+
return console.debug(`Rephrased query from "${t}" to "${a.rewrittenQuery.trim()}"`), a.rewrittenQuery.trim();
|
|
144
144
|
} catch {
|
|
145
145
|
}
|
|
146
146
|
return t;
|
|
@@ -166,11 +166,11 @@ const rt = b.Root({
|
|
|
166
166
|
reducer: (s, e) => e ?? s,
|
|
167
167
|
default: () => null
|
|
168
168
|
})
|
|
169
|
-
}), lt = () => new
|
|
169
|
+
}), lt = () => new W(rt).addNode("initializeAgent", ut).addNode("askSolutionsQuestions", ct).addEdge(K, "initializeAgent").addEdge("initializeAgent", "askSolutionsQuestions").addEdge("askSolutionsQuestions", A), ve = async (s, e, t, i) => {
|
|
170
170
|
if (!s) return;
|
|
171
171
|
const n = xe(s);
|
|
172
172
|
if (!n) return;
|
|
173
|
-
const
|
|
173
|
+
const a = { context: {
|
|
174
174
|
kind: "DocAIAssistantRequest",
|
|
175
175
|
filters: {
|
|
176
176
|
products: "ArcGIS Solutions",
|
|
@@ -180,20 +180,20 @@ const rt = b.Root({
|
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
} };
|
|
183
|
-
i && (
|
|
183
|
+
i && (a.conversationId = i), Q(a, n, e ?? "");
|
|
184
184
|
}, ct = async (s, e) => {
|
|
185
185
|
if (ce(e))
|
|
186
186
|
return {};
|
|
187
187
|
const t = U(e), i = s.documentSkillUrl;
|
|
188
188
|
let n = [];
|
|
189
|
-
const
|
|
189
|
+
const o = await at(s, e);
|
|
190
190
|
await w(
|
|
191
191
|
{ text: t.agentProgress.explorerAgentSearching },
|
|
192
192
|
e
|
|
193
193
|
);
|
|
194
|
-
let
|
|
194
|
+
let a = await Q(
|
|
195
195
|
{
|
|
196
|
-
message:
|
|
196
|
+
message: o,
|
|
197
197
|
conversationId: e?.configurable?.context?.convoId ?? void 0,
|
|
198
198
|
context: {
|
|
199
199
|
kind: "DocAIAssistantRequest",
|
|
@@ -209,19 +209,19 @@ const rt = b.Root({
|
|
|
209
209
|
i,
|
|
210
210
|
e?.configurable?.context?.token ?? ""
|
|
211
211
|
);
|
|
212
|
-
|
|
212
|
+
a.conversationId && e?.configurable?.context?.setConversationId && e.configurable.context.setConversationId(a.conversationId);
|
|
213
213
|
let r = {
|
|
214
|
-
message:
|
|
215
|
-
conversationId:
|
|
216
|
-
hasMore:
|
|
217
|
-
ackSequenceNumber:
|
|
218
|
-
inquiryId:
|
|
219
|
-
},
|
|
214
|
+
message: a.message,
|
|
215
|
+
conversationId: a.conversationId,
|
|
216
|
+
hasMore: a.hasMore,
|
|
217
|
+
ackSequenceNumber: a.sequenceNumber,
|
|
218
|
+
inquiryId: a.inquiryId
|
|
219
|
+
}, l = "";
|
|
220
220
|
const d = async (y) => {
|
|
221
221
|
const u = y.context?.results?.[0]?.reply ?? "";
|
|
222
222
|
if (u !== "") {
|
|
223
|
-
const S = tt(u),
|
|
224
|
-
|
|
223
|
+
const S = tt(u), F = st(S), C = it(F, e);
|
|
224
|
+
l = C.source, n = [
|
|
225
225
|
...n,
|
|
226
226
|
...C.allMatches.filter(
|
|
227
227
|
(z) => !n.some((I) => I.solution.id === z.solution.id)
|
|
@@ -234,10 +234,10 @@ const rt = b.Root({
|
|
|
234
234
|
g === 1 ? S = t.agentProgress.explorerAgentReading : g === 2 ? S = t.agentProgress.explorerAgentReviewing : g === 3 && (S = t.agentProgress.explorerAgentPreparing), await w({ text: S }, e);
|
|
235
235
|
}
|
|
236
236
|
};
|
|
237
|
-
for (await d(
|
|
237
|
+
for (await d(a); r.hasMore; ) {
|
|
238
238
|
if (ce(e))
|
|
239
239
|
return {};
|
|
240
|
-
await ot(500),
|
|
240
|
+
await ot(500), a = await Q(
|
|
241
241
|
{
|
|
242
242
|
conversationId: r.conversationId,
|
|
243
243
|
ackSequenceNumber: r.ackSequenceNumber,
|
|
@@ -246,12 +246,12 @@ const rt = b.Root({
|
|
|
246
246
|
i,
|
|
247
247
|
e?.configurable?.context?.token ?? ""
|
|
248
248
|
), r = {
|
|
249
|
-
message:
|
|
250
|
-
conversationId:
|
|
251
|
-
hasMore:
|
|
252
|
-
ackSequenceNumber:
|
|
253
|
-
inquiryId:
|
|
254
|
-
}, await d(
|
|
249
|
+
message: a.message,
|
|
250
|
+
conversationId: a.conversationId,
|
|
251
|
+
hasMore: a.hasMore,
|
|
252
|
+
ackSequenceNumber: a.sequenceNumber,
|
|
253
|
+
inquiryId: a.inquiryId
|
|
254
|
+
}, await d(a);
|
|
255
255
|
}
|
|
256
256
|
return xe(e?.configurable?.context.portal) && ve(
|
|
257
257
|
e?.configurable?.context.portal,
|
|
@@ -259,8 +259,8 @@ const rt = b.Root({
|
|
|
259
259
|
e?.configurable?.context.configContext.locale ?? "en",
|
|
260
260
|
r.conversationId
|
|
261
261
|
), n.length && (n.length === 1 ? ye(n[0].solution.id) : fe(n)), {
|
|
262
|
-
outputMessage:
|
|
263
|
-
summary:
|
|
262
|
+
outputMessage: l,
|
|
263
|
+
summary: l,
|
|
264
264
|
status: "success",
|
|
265
265
|
solutionResponse: r,
|
|
266
266
|
conversationId: r.conversationId
|
|
@@ -322,6 +322,9 @@ class x {
|
|
|
322
322
|
static {
|
|
323
323
|
this.FIELD_NAME_MAX_LENGTH = 31;
|
|
324
324
|
}
|
|
325
|
+
static {
|
|
326
|
+
this.ALLOWED_FIELD_TYPES = /* @__PURE__ */ new Set(["string", "integer", "double", "date", "guid"]);
|
|
327
|
+
}
|
|
325
328
|
/**
|
|
326
329
|
* Runs all validation checks on the response.
|
|
327
330
|
*/
|
|
@@ -359,8 +362,8 @@ class x {
|
|
|
359
362
|
for (const n of this.response.solution.strings) {
|
|
360
363
|
if (n.value)
|
|
361
364
|
continue;
|
|
362
|
-
const
|
|
363
|
-
this.newDesign &&
|
|
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.`);
|
|
364
367
|
}
|
|
365
368
|
}
|
|
366
369
|
/**
|
|
@@ -392,23 +395,23 @@ class x {
|
|
|
392
395
|
* any other user-edited properties on the item.
|
|
393
396
|
*/
|
|
394
397
|
_reconcileItems() {
|
|
395
|
-
const e = new Set(this.template.items.map((
|
|
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));
|
|
396
399
|
if (e.size === t.size && i.length === 1 && n.length === 1) {
|
|
397
|
-
const
|
|
398
|
-
if (
|
|
399
|
-
|
|
400
|
+
const a = i[0], r = n[0], l = this.response.items.find((d) => d.id === a);
|
|
401
|
+
if (l) {
|
|
402
|
+
l.id = r, this._logAutoFix(`Item id '${a}' did not match the template id '${r}'. Auto-fixed in place.`);
|
|
400
403
|
return;
|
|
401
404
|
}
|
|
402
405
|
}
|
|
403
|
-
i.length && (this.response.items = this.response.items.filter((
|
|
404
|
-
const
|
|
405
|
-
if (
|
|
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) {
|
|
406
409
|
this.response.items = [
|
|
407
|
-
...
|
|
410
|
+
...o.map((a) => ({ ...a })),
|
|
408
411
|
...this.response.items
|
|
409
412
|
];
|
|
410
|
-
for (const
|
|
411
|
-
this._logAutoFix(`Item '${
|
|
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.`);
|
|
412
415
|
}
|
|
413
416
|
}
|
|
414
417
|
/**
|
|
@@ -421,22 +424,22 @@ class x {
|
|
|
421
424
|
t.itemId = e.itemId, this._logAutoFix(`Feature Layer itemId '${i}' did not match the template. Auto-fixed to '${e.itemId}'.`);
|
|
422
425
|
}
|
|
423
426
|
if (!e.addLayers) {
|
|
424
|
-
const i = new Set(e.layers.map((
|
|
425
|
-
if (!(i.size === n.size && [...i].every((
|
|
427
|
+
const i = new Set(e.layers.map((o) => o.id)), n = new Set(t.layers.map((o) => o.id));
|
|
428
|
+
if (!(i.size === n.size && [...i].every((o) => n.has(o))))
|
|
426
429
|
this._logIssue(`Feature Layer '${e.itemId}' had its layer ids altered.`);
|
|
427
430
|
else
|
|
428
|
-
for (const
|
|
429
|
-
if (
|
|
430
|
-
const r = t.layers.find((
|
|
431
|
-
if (r && r.type !==
|
|
431
|
+
for (const o of e.layers) {
|
|
432
|
+
if (o.type) {
|
|
433
|
+
const r = t.layers.find((l) => l.id === o.id);
|
|
434
|
+
if (r && r.type !== o.type)
|
|
432
435
|
if (this.newDesign) {
|
|
433
|
-
const
|
|
434
|
-
r.type =
|
|
436
|
+
const l = r.type;
|
|
437
|
+
r.type = o.type, this._logAutoFix(`Layer '${o.id}' type '${l}' is immutable. Auto-fixed back to template type '${o.type}'.`);
|
|
435
438
|
} else
|
|
436
|
-
this._logIssue(`Layer '${
|
|
439
|
+
this._logIssue(`Layer '${o.id}' type '${r.type}' does not match template type '${o.type}'. This layer type is immutable.`);
|
|
437
440
|
}
|
|
438
|
-
const
|
|
439
|
-
|
|
441
|
+
const a = t.layers.find((r) => r.id === o.id);
|
|
442
|
+
a && this._validateRequiredFields(a, o);
|
|
440
443
|
}
|
|
441
444
|
}
|
|
442
445
|
}
|
|
@@ -453,12 +456,12 @@ class x {
|
|
|
453
456
|
e.requiredFields.map((n) => [n.name.toLowerCase(), n])
|
|
454
457
|
);
|
|
455
458
|
for (const n of t.requiredFields) {
|
|
456
|
-
const
|
|
457
|
-
if (!
|
|
459
|
+
const o = i.get(n.name.toLowerCase());
|
|
460
|
+
if (!o) {
|
|
458
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}'.`);
|
|
459
462
|
continue;
|
|
460
463
|
}
|
|
461
|
-
this._enforceRequiredFieldImmutability(e,
|
|
464
|
+
this._enforceRequiredFieldImmutability(e, o, n);
|
|
462
465
|
}
|
|
463
466
|
}
|
|
464
467
|
/**
|
|
@@ -470,8 +473,8 @@ class x {
|
|
|
470
473
|
const n = [];
|
|
471
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)
|
|
472
475
|
return;
|
|
473
|
-
const
|
|
474
|
-
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 ${
|
|
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.`);
|
|
475
478
|
}
|
|
476
479
|
/**
|
|
477
480
|
* Set-based equality check for two choiceList values (order-insensitive),
|
|
@@ -483,8 +486,8 @@ class x {
|
|
|
483
486
|
return !0;
|
|
484
487
|
if (i === null || n === null)
|
|
485
488
|
return !1;
|
|
486
|
-
const
|
|
487
|
-
return
|
|
489
|
+
const o = new Set(i), a = new Set(n);
|
|
490
|
+
return o.size === a.size && [...o].every((r) => a.has(r));
|
|
488
491
|
}
|
|
489
492
|
//--------------------------------------------------------------------------
|
|
490
493
|
//
|
|
@@ -497,14 +500,14 @@ class x {
|
|
|
497
500
|
_validateSolutionProps() {
|
|
498
501
|
const e = this.response.solution.title ?? "", t = this.response.solution.description, i = /[/\\]/u.test(e), n = this.newDesign ? e.replace(/[/\\]/gu, "") : e;
|
|
499
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.");
|
|
500
|
-
const
|
|
501
|
-
if (
|
|
502
|
-
this.response.solution.title =
|
|
503
|
-
}, "Solution title", "Solution Title") || this._logIssue(`Solution title is invalid (${
|
|
504
|
-
const
|
|
505
|
-
|
|
503
|
+
const o = J(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 = H(t, x.DESCRIPTION_MAX_LENGTH, !0);
|
|
508
|
+
a.isValid || this._tryFixDescription(t, (r) => {
|
|
506
509
|
this.response.solution.description = r;
|
|
507
|
-
}, "Solution description") || this._logIssue(`Solution description is invalid (${
|
|
510
|
+
}, "Solution description") || this._logIssue(`Solution description is invalid (${a.errorType}).`);
|
|
508
511
|
}
|
|
509
512
|
}
|
|
510
513
|
/**
|
|
@@ -541,8 +544,8 @@ class x {
|
|
|
541
544
|
for (const i of e) {
|
|
542
545
|
const n = (i.name ?? "").toLowerCase();
|
|
543
546
|
if (t.has(n)) {
|
|
544
|
-
const
|
|
545
|
-
i.name = this._makeUniqueName(i.name ?? "Layer", t), this._logAutoFix(`Duplicate layer name '${
|
|
547
|
+
const o = i.name;
|
|
548
|
+
i.name = this._makeUniqueName(i.name ?? "Layer", t), this._logAutoFix(`Duplicate layer name '${o}'. Auto-fixed to '${i.name}'.`);
|
|
546
549
|
}
|
|
547
550
|
t.add(i.name.toLowerCase());
|
|
548
551
|
}
|
|
@@ -559,8 +562,8 @@ class x {
|
|
|
559
562
|
e.name = n;
|
|
560
563
|
}, `Layer '${e.name}' name`, "Layer Title") || this._logIssue(`Layer '${e.name}' name is invalid (${i.errorType}).`), e.description) {
|
|
561
564
|
const n = H(e.description, x.DESCRIPTION_MAX_LENGTH, !0);
|
|
562
|
-
n.isValid || this._tryFixDescription(e.description, (
|
|
563
|
-
e.description =
|
|
565
|
+
n.isValid || this._tryFixDescription(e.description, (o) => {
|
|
566
|
+
e.description = o;
|
|
564
567
|
}, `Layer '${e.name}' description`) || this._logIssue(`Layer '${e.name}' description is invalid (${n.errorType}).`);
|
|
565
568
|
}
|
|
566
569
|
this._validateLayerFields(e);
|
|
@@ -577,23 +580,23 @@ class x {
|
|
|
577
580
|
_validateLayerFields(e) {
|
|
578
581
|
const t = e.systemFields ?? [];
|
|
579
582
|
this.fieldNameRegistry = new Set(
|
|
580
|
-
[...e.customFields, ...e.requiredFields, ...t].map((
|
|
583
|
+
[...e.customFields, ...e.requiredFields, ...t].map((o) => o.name.toLowerCase())
|
|
581
584
|
);
|
|
582
|
-
for (const
|
|
583
|
-
this._validateField(
|
|
585
|
+
for (const o of [...e.customFields, ...e.requiredFields])
|
|
586
|
+
this._validateField(o);
|
|
584
587
|
this.fieldNameRegistry = null;
|
|
585
|
-
const i = new Set(e.requiredFields.map((
|
|
586
|
-
for (const
|
|
587
|
-
const
|
|
588
|
-
if (n.has(
|
|
589
|
-
const r = i.has(
|
|
588
|
+
const i = new Set(e.requiredFields.map((o) => o.name.toLowerCase())), n = new Set(i);
|
|
589
|
+
for (const o of e.customFields) {
|
|
590
|
+
const a = o.name.toLowerCase();
|
|
591
|
+
if (n.has(a)) {
|
|
592
|
+
const r = i.has(a) ? "a required field name" : "another field with the same name";
|
|
590
593
|
if (this.newDesign) {
|
|
591
|
-
const
|
|
592
|
-
|
|
594
|
+
const l = o.name;
|
|
595
|
+
o.name = this._makeUniqueName(o.name, n), this._logAutoFix(`Layer '${e.name}' field '${l}' collided with ${r}. Auto-fixed to '${o.name}'.`);
|
|
593
596
|
} else
|
|
594
|
-
this._logIssue(`Layer '${e.name}' field '${
|
|
597
|
+
this._logIssue(`Layer '${e.name}' field '${o.name}' collides with ${r}.`);
|
|
595
598
|
}
|
|
596
|
-
n.add(
|
|
599
|
+
n.add(o.name.toLowerCase());
|
|
597
600
|
}
|
|
598
601
|
}
|
|
599
602
|
/**
|
|
@@ -601,37 +604,44 @@ class x {
|
|
|
601
604
|
*/
|
|
602
605
|
_validateField(e) {
|
|
603
606
|
const t = /^\p{L}/u, i = /^.[\p{L}\p{M}\p{N}_]*$/u;
|
|
604
|
-
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).`));
|
|
605
|
-
const n = t.test(e.name),
|
|
606
|
-
if (!n || !
|
|
607
|
+
e.alias?.trim() || (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).`));
|
|
608
|
+
const n = t.test(e.name), o = i.test(e.name);
|
|
609
|
+
if (!n || !o)
|
|
607
610
|
if (this.newDesign) {
|
|
608
|
-
const
|
|
609
|
-
e.name = this._makeUniqueName(this._sanitizeFieldName(e.name), this.fieldNameRegistry), this.fieldNameRegistry.add(e.name.toLowerCase()), this._logAutoFix(`Field '${
|
|
611
|
+
const l = e.name;
|
|
612
|
+
e.name = this._makeUniqueName(this._sanitizeFieldName(e.name), this.fieldNameRegistry), this.fieldNameRegistry.add(e.name.toLowerCase()), this._logAutoFix(`Field '${l}' had an invalid name. Auto-fixed to '${e.name}'.`);
|
|
610
613
|
} else
|
|
611
|
-
n || this._logIssue(`Field '${e.name}' does not start with a letter.`),
|
|
614
|
+
n || this._logIssue(`Field '${e.name}' does not start with a letter.`), o || this._logIssue(
|
|
612
615
|
`Field '${e.name}' contains invalid characters (only letters from any writing system, numbers, and underscores are allowed; emojis and punctuation are not allowed).`
|
|
613
616
|
);
|
|
614
617
|
if (e.name.length > x.FIELD_NAME_MAX_LENGTH)
|
|
615
618
|
if (this.newDesign) {
|
|
616
|
-
const
|
|
617
|
-
e.name = this._getUniqueTruncatedFieldName(e.name, this.fieldNameRegistry), this.fieldNameRegistry.add(e.name.toLowerCase()), this._logAutoFix(`Field '${
|
|
619
|
+
const l = e.name;
|
|
620
|
+
e.name = this._getUniqueTruncatedFieldName(e.name, this.fieldNameRegistry), this.fieldNameRegistry.add(e.name.toLowerCase()), this._logAutoFix(`Field '${l}' exceeds ${x.FIELD_NAME_MAX_LENGTH} characters. Auto-fixing to '${e.name}'.`);
|
|
618
621
|
} else
|
|
619
622
|
this._logIssue(`Field '${e.name}' exceeds ${x.FIELD_NAME_MAX_LENGTH} characters.`);
|
|
620
623
|
if (He.has(e.name.toLowerCase()))
|
|
621
624
|
if (this.newDesign) {
|
|
622
|
-
const
|
|
623
|
-
e.name = this._getUniqueTruncatedFieldName(
|
|
625
|
+
const l = e.name;
|
|
626
|
+
e.name = this._getUniqueTruncatedFieldName(l, this.fieldNameRegistry), this.fieldNameRegistry.add(e.name.toLowerCase()), this._logAutoFix(`Field '${l}' is a SQL reserved keyword. Auto-fixing to '${e.name}'.`);
|
|
624
627
|
} else
|
|
625
628
|
this._logIssue(`Field '${e.name}' is a SQL reserved keyword.`);
|
|
626
629
|
if (Ve.has(e.name.toLowerCase()))
|
|
627
630
|
if (this.newDesign) {
|
|
628
|
-
const
|
|
629
|
-
e.name = this._getUniqueTruncatedFieldName(
|
|
631
|
+
const l = e.name;
|
|
632
|
+
e.name = this._getUniqueTruncatedFieldName(l, this.fieldNameRegistry), this.fieldNameRegistry.add(e.name.toLowerCase()), this._logAutoFix(`Field '${l}' is a reserved system field name. Auto-fixing to '${e.name}'.`);
|
|
630
633
|
} else
|
|
631
634
|
this._logIssue(`Field '${e.name}' is a reserved system field name.`);
|
|
635
|
+
const a = e.type ?? "", r = a.toLowerCase();
|
|
636
|
+
if (a !== r && (e.type = r), !x.ALLOWED_FIELD_TYPES.has(r))
|
|
637
|
+
if (this.newDesign) {
|
|
638
|
+
const l = e.type;
|
|
639
|
+
r === "globalid" ? e.type = "guid" : r === "oid" ? e.type = "integer" : e.type = "string", this._logAutoFix(`Field '${e.name}' had unsupported type '${l}'. Auto-fixed to '${e.type}'.`);
|
|
640
|
+
} else
|
|
641
|
+
this._logIssue(`Field '${e.name}' has unsupported type '${e.type}'. Allowed types are: string, integer, double, date.`);
|
|
632
642
|
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) {
|
|
633
|
-
const
|
|
634
|
-
|
|
643
|
+
const l = Math.max(...e.choiceList.map((d) => d.length));
|
|
644
|
+
l > 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 ${l} characters. Auto-fixing to ${l}.`), e.length = l) : this._logIssue(`The choice provided for field '${e.name}' is too long. It must fit within ${e.length} characters, but the choice requires ${l} characters.`));
|
|
635
645
|
}
|
|
636
646
|
}
|
|
637
647
|
/**
|
|
@@ -640,7 +650,7 @@ class x {
|
|
|
640
650
|
*/
|
|
641
651
|
_autoFixChoiceList(e) {
|
|
642
652
|
let t = e.choiceList;
|
|
643
|
-
const i = t.filter((
|
|
653
|
+
const i = t.filter((o) => o?.trim());
|
|
644
654
|
i.length !== t.length && (this._logAutoFix(`Field '${e.name}' had blank domain values. Auto-fixed by removing them.`), t = i, e.choiceList = t);
|
|
645
655
|
const n = [...new Set(t)];
|
|
646
656
|
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);
|
|
@@ -667,7 +677,7 @@ class x {
|
|
|
667
677
|
return;
|
|
668
678
|
}
|
|
669
679
|
const t = e.length;
|
|
670
|
-
if (!
|
|
680
|
+
if (!We(t).isValid) {
|
|
671
681
|
const n = t > 4e3 ? 4e3 : 256;
|
|
672
682
|
this._handleInvalidStringFieldLength(e, n);
|
|
673
683
|
}
|
|
@@ -700,12 +710,12 @@ class x {
|
|
|
700
710
|
*/
|
|
701
711
|
_getUniqueTruncatedFieldName(e, t) {
|
|
702
712
|
const i = x.FIELD_NAME_MAX_LENGTH, n = e.slice(0, i);
|
|
703
|
-
let
|
|
704
|
-
for (; t.has(
|
|
705
|
-
const r = `_${
|
|
706
|
-
|
|
713
|
+
let o = n, a = 1;
|
|
714
|
+
for (; t.has(o.toLowerCase()); ) {
|
|
715
|
+
const r = `_${a}`, l = Math.max(1, i - r.length);
|
|
716
|
+
o = `${n.slice(0, l)}${r}`, a += 1;
|
|
707
717
|
}
|
|
708
|
-
return
|
|
718
|
+
return o;
|
|
709
719
|
}
|
|
710
720
|
/**
|
|
711
721
|
* Sanitizes an item-style name by stripping emojis and disallowed characters,
|
|
@@ -737,12 +747,12 @@ class x {
|
|
|
737
747
|
* (or values that sanitize to empty) fall back to the supplied placeholder.
|
|
738
748
|
* Returns true when fixed.
|
|
739
749
|
*/
|
|
740
|
-
_tryFixName(e, t, i, n,
|
|
750
|
+
_tryFixName(e, t, i, n, o) {
|
|
741
751
|
if (!this.newDesign)
|
|
742
752
|
return !1;
|
|
743
753
|
if (e === "empty")
|
|
744
|
-
return i(
|
|
745
|
-
const r = this._sanitizeItemName(t) ||
|
|
754
|
+
return i(o), this._logAutoFix(`${n} was empty. Auto-fixed to '${o}'.`), !0;
|
|
755
|
+
const r = this._sanitizeItemName(t) || o;
|
|
746
756
|
return i(r), this._logAutoFix(`${n} was invalid (${e}). Auto-fixed to '${r}'.`), !0;
|
|
747
757
|
}
|
|
748
758
|
/**
|
|
@@ -768,15 +778,15 @@ class x {
|
|
|
768
778
|
console.debug(e), this.issues.push(e), this.isValid = !1;
|
|
769
779
|
}
|
|
770
780
|
}
|
|
771
|
-
const yt =
|
|
772
|
-
key:
|
|
773
|
-
value:
|
|
774
|
-
description:
|
|
775
|
-
}), bt =
|
|
776
|
-
id:
|
|
777
|
-
title:
|
|
778
|
-
description:
|
|
779
|
-
type:
|
|
781
|
+
const yt = c.object({
|
|
782
|
+
key: c.string().describe("Stable key identifier for the string."),
|
|
783
|
+
value: c.string().describe("Display value for the string."),
|
|
784
|
+
description: c.string().describe("Explanation of where/how the string is used.")
|
|
785
|
+
}), bt = c.object({
|
|
786
|
+
id: c.string().describe("ArcGIS item id (32 hex characters)."),
|
|
787
|
+
title: c.string().describe("Item title."),
|
|
788
|
+
description: c.string().describe("Item description."),
|
|
789
|
+
type: c.enum([
|
|
780
790
|
"Feature Layer (hosted)",
|
|
781
791
|
"Feature Layer (hosted, view)",
|
|
782
792
|
"Web Map",
|
|
@@ -795,73 +805,73 @@ const yt = l.object({
|
|
|
795
805
|
"Notebook",
|
|
796
806
|
"QuickCapture Project"
|
|
797
807
|
]).describe("ArcGIS item type.")
|
|
798
|
-
}), ue =
|
|
799
|
-
name:
|
|
800
|
-
type:
|
|
801
|
-
alias:
|
|
802
|
-
description:
|
|
803
|
-
choiceList:
|
|
808
|
+
}), ue = c.object({
|
|
809
|
+
name: c.string().describe("Field name."),
|
|
810
|
+
type: c.enum(["string", "integer", "double", "date", "oid", "guid", "globalid"]).describe("Field data type."),
|
|
811
|
+
alias: c.string().describe("Field alias for display."),
|
|
812
|
+
description: c.string().describe("Field description."),
|
|
813
|
+
choiceList: c.array(c.string()).nullable().describe(
|
|
804
814
|
"List of allowed values for string fields with a controlled vocabulary. Null if unrestricted or not applicable."
|
|
805
815
|
),
|
|
806
|
-
length:
|
|
807
|
-
}), xt =
|
|
808
|
-
id:
|
|
809
|
-
type:
|
|
810
|
-
typeMutable:
|
|
811
|
-
name:
|
|
812
|
-
description:
|
|
813
|
-
customFields:
|
|
814
|
-
requiredFields:
|
|
815
|
-
}), vt =
|
|
816
|
-
itemId:
|
|
817
|
-
addLayers:
|
|
818
|
-
layers:
|
|
819
|
-
}), Z =
|
|
820
|
-
response:
|
|
821
|
-
solution:
|
|
822
|
-
itemId:
|
|
823
|
-
title:
|
|
824
|
-
description:
|
|
825
|
-
tags:
|
|
826
|
-
strings:
|
|
816
|
+
length: c.number().int().nullable().describe("Maximum string length for string fields. Null for non-string fields.")
|
|
817
|
+
}), xt = c.object({
|
|
818
|
+
id: c.number().int().describe("Layer/table id within the feature service."),
|
|
819
|
+
type: c.enum(["Point", "Polyline", "Polygon", "Table"]).describe("Layer type."),
|
|
820
|
+
typeMutable: c.boolean().describe("Indicates whether the layer type can be changed."),
|
|
821
|
+
name: c.string().describe("Layer/table name."),
|
|
822
|
+
description: c.string().describe("Layer/table description."),
|
|
823
|
+
customFields: c.array(ue).describe("User/business fields specific to the solution."),
|
|
824
|
+
requiredFields: c.array(ue).describe("Fields required for solution functionality (e.g., relationship keys).")
|
|
825
|
+
}), vt = c.object({
|
|
826
|
+
itemId: c.string().describe("ArcGIS item id for the feature layer."),
|
|
827
|
+
addLayers: c.boolean().describe("Indicates whether new layers can be added during solution design."),
|
|
828
|
+
layers: c.array(xt)
|
|
829
|
+
}), Z = c.object({
|
|
830
|
+
response: c.string().describe("Conversational response to the user's query."),
|
|
831
|
+
solution: c.object({
|
|
832
|
+
itemId: c.string().nullable().describe("ArcGIS item id of the source Solution template used for deployment. Preserve the existing value exactly when known; otherwise use null."),
|
|
833
|
+
title: c.string().describe("Title of the solution."),
|
|
834
|
+
description: c.string().describe("Description of the solution."),
|
|
835
|
+
tags: c.array(c.string()).describe("Keywords/tags associated with the solution."),
|
|
836
|
+
strings: c.array(yt).describe("Localized strings/labels used by apps (dashboards, forms, etc.).")
|
|
827
837
|
}),
|
|
828
|
-
items:
|
|
838
|
+
items: c.array(bt).describe("ArcGIS items that belong to the solution (apps, maps, layers, etc.)."),
|
|
829
839
|
featureLayer: vt.describe("Primary feature layer item and its schema/layers/tables details.")
|
|
830
|
-
}), _t =
|
|
831
|
-
op:
|
|
832
|
-
path:
|
|
833
|
-
value:
|
|
834
|
-
from:
|
|
835
|
-
}), wt =
|
|
836
|
-
response:
|
|
837
|
-
patches:
|
|
838
|
-
}), St =
|
|
839
|
-
response:
|
|
840
|
-
}), It =
|
|
841
|
-
assistantResponse:
|
|
842
|
-
isValidUpdate:
|
|
843
|
-
}), At =
|
|
844
|
-
matchedTitles:
|
|
845
|
-
}), Ct =
|
|
846
|
-
templateId:
|
|
847
|
-
confidence:
|
|
848
|
-
templateDescription:
|
|
849
|
-
}), Tt =
|
|
850
|
-
assistantResponse:
|
|
851
|
-
isValidUseCase:
|
|
852
|
-
matchedTemplates:
|
|
853
|
-
}),
|
|
854
|
-
`) : "No validation errors were provided.",
|
|
840
|
+
}), _t = c.object({
|
|
841
|
+
op: c.enum(["add", "remove", "replace", "move", "copy"]).describe("RFC 6902 operation type."),
|
|
842
|
+
path: c.string().describe("RFC 6901 JSON Pointer to the target location."),
|
|
843
|
+
value: c.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.`),
|
|
844
|
+
from: c.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.")
|
|
845
|
+
}), wt = c.object({
|
|
846
|
+
response: c.string().describe("Conversational response describing the accepted design changes."),
|
|
847
|
+
patches: c.array(_t).describe("Minimal RFC 6902 patch operations needed to update the current design.")
|
|
848
|
+
}), St = c.object({
|
|
849
|
+
response: c.string().describe("Short, user-friendly explanation of why the requested update was not applied.")
|
|
850
|
+
}), It = c.object({
|
|
851
|
+
assistantResponse: c.string().describe("Natural-language response for the user."),
|
|
852
|
+
isValidUpdate: c.boolean().describe("True only when the request is in scope for supported design updates.")
|
|
853
|
+
}), At = c.object({
|
|
854
|
+
matchedTitles: c.array(c.string()).describe("Titles of solutions that match the user's request. Empty array if no strong match.")
|
|
855
|
+
}), Ct = c.object({
|
|
856
|
+
templateId: c.string().min(1).describe("Template id from the available template list."),
|
|
857
|
+
confidence: c.number().min(0).max(1).describe("Confidence score from 0 to 1 for this template match."),
|
|
858
|
+
templateDescription: c.string().min(1).describe("Short action‑oriented description of the template in the user's use case/workflow, starting with a verb.")
|
|
859
|
+
}), Tt = c.object({
|
|
860
|
+
assistantResponse: c.string().nullable().describe("Natural-language response for the user."),
|
|
861
|
+
isValidUseCase: c.boolean().describe("True only when the request is concrete, appropriate, and has at least one matching template."),
|
|
862
|
+
matchedTemplates: c.array(Ct).describe("Ordered list of matching templates, best match first. Empty when no valid match exists.")
|
|
863
|
+
}), Lt = (s) => s.length ? s.map((e, t) => `${t + 1}. ${e}`).join(`
|
|
864
|
+
`) : "No validation errors were provided.", Et = async (s) => {
|
|
855
865
|
const {
|
|
856
866
|
query: e,
|
|
857
867
|
validationIssues: t,
|
|
858
868
|
recentMessages: i,
|
|
859
869
|
fallbackMessage: n,
|
|
860
|
-
promptModules:
|
|
870
|
+
promptModules: o
|
|
861
871
|
} = s;
|
|
862
872
|
try {
|
|
863
|
-
return (await
|
|
864
|
-
promptText: await v(
|
|
873
|
+
return (await Ke({
|
|
874
|
+
promptText: await v(o, "explainValidationFailure"),
|
|
865
875
|
modelTier: "fast",
|
|
866
876
|
temperature: 0,
|
|
867
877
|
schema: St,
|
|
@@ -869,18 +879,18 @@ const yt = l.object({
|
|
|
869
879
|
inputVariables: {
|
|
870
880
|
query: e,
|
|
871
881
|
validationIssueCount: String(t.length),
|
|
872
|
-
validationIssues:
|
|
882
|
+
validationIssues: Lt(t)
|
|
873
883
|
}
|
|
874
884
|
})).response?.trim() || n;
|
|
875
|
-
} catch (
|
|
885
|
+
} catch (a) {
|
|
876
886
|
return console.warn(
|
|
877
887
|
"Natural language response failed:",
|
|
878
|
-
{ error:
|
|
888
|
+
{ error: a }
|
|
879
889
|
), n;
|
|
880
890
|
}
|
|
881
|
-
}, ee = (s) => s in
|
|
891
|
+
}, ee = (s) => s in N, $t = 5, kt = 0.8, Ft = 0.5, Nt = "Web Mapping Application", Dt = "Embeddings";
|
|
882
892
|
let R = null, V = null, P = null, B = null;
|
|
883
|
-
const Mt = "Build",
|
|
893
|
+
const Mt = "Build", E = /* @__PURE__ */ Object.assign({
|
|
884
894
|
"./prompts/assessBuildRequest.md": () => import("../../chunks/assessBuildRequest.js").then((s) => s.default),
|
|
885
895
|
"./prompts/assessUpdateRequest.md": () => import("../../chunks/assessUpdateRequest.js").then((s) => s.default),
|
|
886
896
|
"./prompts/description.md": () => import("../../chunks/description2.js").then((s) => s.default),
|
|
@@ -894,7 +904,7 @@ const Mt = "Build", L = /* @__PURE__ */ Object.assign({
|
|
|
894
904
|
}));
|
|
895
905
|
}, Pt = async (s, e, t) => {
|
|
896
906
|
if (!s) return null;
|
|
897
|
-
const i = `type:"${
|
|
907
|
+
const i = `type:"${Nt}" AND typekeywords:${Dt} AND group:${s}`;
|
|
898
908
|
return (await Y.searchItems({
|
|
899
909
|
q: i,
|
|
900
910
|
params: e ? { token: e } : void 0,
|
|
@@ -907,8 +917,8 @@ async function Bt(s, e, t, i) {
|
|
|
907
917
|
const n = await Pt(s, e, t);
|
|
908
918
|
if (!n || m(i))
|
|
909
919
|
return null;
|
|
910
|
-
const
|
|
911
|
-
return await
|
|
920
|
+
const o = new Ye({ id: n.id });
|
|
921
|
+
return await o.load(), m(i) ? null : await o.fetchData("json");
|
|
912
922
|
} catch {
|
|
913
923
|
return null;
|
|
914
924
|
}
|
|
@@ -929,12 +939,12 @@ const qt = async (s, e, t) => {
|
|
|
929
939
|
portal: t
|
|
930
940
|
}), n = i?.buildSolution;
|
|
931
941
|
if (!n) return null;
|
|
932
|
-
const
|
|
933
|
-
return { buildSolution: n, params:
|
|
942
|
+
const o = i?.params, a = o && typeof o == "object" && !Array.isArray(o) ? o : null;
|
|
943
|
+
return { buildSolution: n, params: a };
|
|
934
944
|
} catch {
|
|
935
945
|
return null;
|
|
936
946
|
}
|
|
937
|
-
},
|
|
947
|
+
}, $ = (s, e = {}) => {
|
|
938
948
|
let t = s;
|
|
939
949
|
return "itemId" in e && (t = {
|
|
940
950
|
...t,
|
|
@@ -966,8 +976,8 @@ const qt = async (s, e, t) => {
|
|
|
966
976
|
}
|
|
967
977
|
}, te = async (s) => {
|
|
968
978
|
if (V) {
|
|
969
|
-
Object.entries(V).forEach(([
|
|
970
|
-
|
|
979
|
+
Object.entries(V).forEach(([a, r]) => {
|
|
980
|
+
N[a] && (N[a].initialTemplate = r);
|
|
971
981
|
});
|
|
972
982
|
return;
|
|
973
983
|
}
|
|
@@ -976,36 +986,36 @@ const qt = async (s, e, t) => {
|
|
|
976
986
|
console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping live template hydration.");
|
|
977
987
|
return;
|
|
978
988
|
}
|
|
979
|
-
const n = await qt(t, e, i),
|
|
980
|
-
m(s) || (await Promise.all(n.map(async (
|
|
981
|
-
const r =
|
|
989
|
+
const n = await qt(t, e, i), o = {};
|
|
990
|
+
m(s) || (await Promise.all(n.map(async (a) => {
|
|
991
|
+
const r = a.properties?.templateInfo;
|
|
982
992
|
if (!r || typeof r != "object") return;
|
|
983
|
-
const
|
|
984
|
-
if (typeof
|
|
985
|
-
const d = await Ut(
|
|
993
|
+
const l = r.id;
|
|
994
|
+
if (typeof l != "string" || o[l]) return;
|
|
995
|
+
const d = await Ut(a.id, e, i);
|
|
986
996
|
if (!d || m(s))
|
|
987
997
|
return;
|
|
988
998
|
const { buildSolution: h, params: y } = d;
|
|
989
999
|
if (typeof h == "object" && h !== null && "solution" in h) {
|
|
990
1000
|
const g = h.solution;
|
|
991
|
-
g.thumbnailUrl =
|
|
1001
|
+
g.thumbnailUrl = a.thumbnail ? `${i ?? "https://www.arcgis.com/sharing/rest"}/content/items/${a.id}/info/${a.thumbnail}` : void 0, g.item = a;
|
|
992
1002
|
}
|
|
993
1003
|
const u = {
|
|
994
1004
|
...r,
|
|
995
1005
|
buildSolution: h
|
|
996
1006
|
};
|
|
997
|
-
|
|
1007
|
+
o[l] = $(
|
|
998
1008
|
new pe(u).dumpToLlmTemplate(),
|
|
999
1009
|
{
|
|
1000
|
-
itemId:
|
|
1010
|
+
itemId: a.id,
|
|
1001
1011
|
sourceBuildSolution: structuredClone(h),
|
|
1002
1012
|
params: y ? structuredClone(y) : null
|
|
1003
1013
|
}
|
|
1004
|
-
),
|
|
1014
|
+
), N[l] = {
|
|
1005
1015
|
...r,
|
|
1006
|
-
initialTemplate:
|
|
1016
|
+
initialTemplate: o[l]
|
|
1007
1017
|
};
|
|
1008
|
-
})), V =
|
|
1018
|
+
})), V = o);
|
|
1009
1019
|
}, Ie = (s) => {
|
|
1010
1020
|
const e = s?.configurable?.context?.token;
|
|
1011
1021
|
return typeof e != "string" || !e.trim() ? null : e;
|
|
@@ -1018,7 +1028,7 @@ const qt = async (s, e, t) => {
|
|
|
1018
1028
|
return `${e.replace(/\/+$/, "")}/sharing/rest`;
|
|
1019
1029
|
}, Ot = async (s) => {
|
|
1020
1030
|
await Promise.all([
|
|
1021
|
-
|
|
1031
|
+
Le(s),
|
|
1022
1032
|
te(s)
|
|
1023
1033
|
]);
|
|
1024
1034
|
}, Te = async (s) => {
|
|
@@ -1027,7 +1037,7 @@ const qt = async (s, e, t) => {
|
|
|
1027
1037
|
throw P = null, B = null, i;
|
|
1028
1038
|
})), await P;
|
|
1029
1039
|
};
|
|
1030
|
-
async function
|
|
1040
|
+
async function Le(s) {
|
|
1031
1041
|
if (R) return R;
|
|
1032
1042
|
const e = Ae(s);
|
|
1033
1043
|
if (!e)
|
|
@@ -1035,10 +1045,10 @@ async function Ee(s) {
|
|
|
1035
1045
|
const t = Ce(s), i = s?.configurable?.context?.configContext?.portalURL;
|
|
1036
1046
|
if (await new Xe(i ? { url: i } : void 0).load(), m(s))
|
|
1037
1047
|
return null;
|
|
1038
|
-
const
|
|
1039
|
-
return m(s) ? null :
|
|
1048
|
+
const o = Ie(s) ?? void 0, a = await Bt(e, o, t, s);
|
|
1049
|
+
return m(s) ? null : a ? (R = a.items, R) : null;
|
|
1040
1050
|
}
|
|
1041
|
-
const zt = () => Object.entries(
|
|
1051
|
+
const zt = () => Object.entries(N).map(([s, e]) => `ID: ${s}
|
|
1042
1052
|
Label: ${e.label}
|
|
1043
1053
|
Description: ${e.description}`).join(`
|
|
1044
1054
|
|
|
@@ -1047,18 +1057,18 @@ Description: ${e.description}`).join(`
|
|
|
1047
1057
|
if (typeof e != "string" || !e.trim())
|
|
1048
1058
|
return null;
|
|
1049
1059
|
try {
|
|
1050
|
-
const t = JSON.parse(e), i =
|
|
1060
|
+
const t = JSON.parse(e), i = $(
|
|
1051
1061
|
{ response: "", ...t },
|
|
1052
1062
|
{ itemId: t?.solution?.itemId ?? null }
|
|
1053
1063
|
), n = Z.safeParse(i);
|
|
1054
1064
|
if (!n.success)
|
|
1055
1065
|
return null;
|
|
1056
|
-
const { response:
|
|
1057
|
-
return
|
|
1058
|
-
|
|
1066
|
+
const { response: o, ...a } = n.data, r = t.templateId, l = typeof r == "string" && ee(r) ? r : null;
|
|
1067
|
+
return $(
|
|
1068
|
+
a,
|
|
1059
1069
|
{
|
|
1060
1070
|
sourceBuildSolution: t.sourceBuildSolution,
|
|
1061
|
-
templateId:
|
|
1071
|
+
templateId: l,
|
|
1062
1072
|
params: t.params ?? null
|
|
1063
1073
|
}
|
|
1064
1074
|
);
|
|
@@ -1111,19 +1121,19 @@ Description: ${e.description}`).join(`
|
|
|
1111
1121
|
if (m(e))
|
|
1112
1122
|
return {};
|
|
1113
1123
|
await w({ text: f("understandingRequest", e) }, e), await Te(e);
|
|
1114
|
-
const t = s.agentExecutionContext.userRequest, i = zt(), n = s.agentExecutionContext.messages.slice(-11),
|
|
1115
|
-
promptText: await v(
|
|
1124
|
+
const t = s.agentExecutionContext.userRequest, i = zt(), n = s.agentExecutionContext.messages.slice(-11), o = await k({
|
|
1125
|
+
promptText: await v(E, "assessBuildRequest"),
|
|
1116
1126
|
modelTier: "advanced",
|
|
1117
1127
|
temperature: 0,
|
|
1118
1128
|
schema: Tt,
|
|
1119
1129
|
messages: n,
|
|
1120
1130
|
inputVariables: { query: t, availableTemplates: i }
|
|
1121
|
-
}),
|
|
1131
|
+
}), a = o.matchedTemplates.filter(
|
|
1122
1132
|
(u) => ee(u.templateId)
|
|
1123
1133
|
), r = {
|
|
1124
|
-
...
|
|
1125
|
-
matchedTemplates:
|
|
1126
|
-
}, [
|
|
1134
|
+
...o,
|
|
1135
|
+
matchedTemplates: a
|
|
1136
|
+
}, [l, d] = a, y = !!l && l.confidence >= kt && (d === void 0 || l.confidence - d.confidence >= Ft) ? l.templateId : null;
|
|
1127
1137
|
return {
|
|
1128
1138
|
assessment: r,
|
|
1129
1139
|
selectedTemplate: y,
|
|
@@ -1151,8 +1161,8 @@ Description: ${e.description}`).join(`
|
|
|
1151
1161
|
await w({ text: f("understandingRequest", e) }, e);
|
|
1152
1162
|
const i = s.agentExecutionContext.userRequest, n = s.agentExecutionContext.messages.slice(-11);
|
|
1153
1163
|
return {
|
|
1154
|
-
updateAssessment: await
|
|
1155
|
-
promptText: await v(
|
|
1164
|
+
updateAssessment: await k({
|
|
1165
|
+
promptText: await v(E, "assessUpdateRequest"),
|
|
1156
1166
|
modelTier: "advanced",
|
|
1157
1167
|
temperature: 0,
|
|
1158
1168
|
schema: It,
|
|
@@ -1163,30 +1173,30 @@ Description: ${e.description}`).join(`
|
|
|
1163
1173
|
}
|
|
1164
1174
|
})
|
|
1165
1175
|
};
|
|
1166
|
-
},
|
|
1176
|
+
}, Wt = (s, e) => {
|
|
1167
1177
|
const t = s.updateAssessment?.assistantResponse ?? f("applyChangeFailed", e);
|
|
1168
1178
|
return {
|
|
1169
1179
|
outputMessage: t,
|
|
1170
1180
|
summary: t,
|
|
1171
1181
|
status: "success"
|
|
1172
1182
|
};
|
|
1173
|
-
},
|
|
1183
|
+
}, Kt = (s, e) => {
|
|
1174
1184
|
if (m(e))
|
|
1175
1185
|
return {};
|
|
1176
1186
|
const { hitlResponse: t } = e.configurable, i = "selectTemplate", n = s.assessment?.matchedTemplates.filter(
|
|
1177
1187
|
(d) => ee(d.templateId)
|
|
1178
|
-
) ?? [],
|
|
1188
|
+
) ?? [], o = n.map((d) => `${d.templateDescription}`);
|
|
1179
1189
|
if (t?.agentId !== "solutionBuilder" || t.id !== i) {
|
|
1180
1190
|
const d = {
|
|
1181
1191
|
agentId: "solutionBuilder",
|
|
1182
1192
|
id: i,
|
|
1183
1193
|
kind: "singleSelection",
|
|
1184
1194
|
message: f("selectTemplatePrompt", e),
|
|
1185
|
-
metadata: [...
|
|
1195
|
+
metadata: [...o]
|
|
1186
1196
|
};
|
|
1187
1197
|
throw new de(d);
|
|
1188
1198
|
}
|
|
1189
|
-
const
|
|
1199
|
+
const a = String(t.payload ?? ""), r = o.findIndex((d) => d === a);
|
|
1190
1200
|
return {
|
|
1191
1201
|
selectedTemplate: (r >= 0 ? n[r] : void 0)?.templateId ?? n[0]?.templateId ?? null
|
|
1192
1202
|
};
|
|
@@ -1194,36 +1204,36 @@ Description: ${e.description}`).join(`
|
|
|
1194
1204
|
if (m(e))
|
|
1195
1205
|
return {};
|
|
1196
1206
|
await w({ text: f("searchingExistingSolutions", e) }, e);
|
|
1197
|
-
const t = s.agentExecutionContext.userRequest, i = ht(s.agentExecutionContext.messages) || t, n = await
|
|
1207
|
+
const t = s.agentExecutionContext.userRequest, i = ht(s.agentExecutionContext.messages) || t, n = await Le(e);
|
|
1198
1208
|
if (m(e))
|
|
1199
1209
|
return {};
|
|
1200
1210
|
if (!n)
|
|
1201
1211
|
return console.warn("Solutions Search: failed to load solution embeddings cache; skipping search."), { existingMatches: [] };
|
|
1202
1212
|
if (!n.length)
|
|
1203
1213
|
return { existingMatches: [] };
|
|
1204
|
-
const [
|
|
1214
|
+
const [o] = await ze([i]);
|
|
1205
1215
|
if (m(e))
|
|
1206
1216
|
return {};
|
|
1207
|
-
const
|
|
1217
|
+
const a = n.map((u) => ({
|
|
1208
1218
|
solution: u,
|
|
1209
|
-
score: je(
|
|
1219
|
+
score: je(o, u.embedding)
|
|
1210
1220
|
}));
|
|
1211
|
-
|
|
1212
|
-
const r =
|
|
1221
|
+
a.sort((u, g) => g.score - u.score);
|
|
1222
|
+
const r = a.slice(0, $t);
|
|
1213
1223
|
if (!r.length)
|
|
1214
1224
|
return { existingMatches: [] };
|
|
1215
|
-
const
|
|
1225
|
+
const l = r.map(({ solution: u }) => `${u.title}
|
|
1216
1226
|
Snippet: ${u.snippet}
|
|
1217
1227
|
Description: ${u.description}`).join(`
|
|
1218
1228
|
|
|
1219
1229
|
`), d = s.agentExecutionContext.messages.slice(-11);
|
|
1220
|
-
return { existingMatches: (await
|
|
1221
|
-
promptText: await v(
|
|
1230
|
+
return { existingMatches: (await k({
|
|
1231
|
+
promptText: await v(E, "findExistingSolution"),
|
|
1222
1232
|
modelTier: "fast",
|
|
1223
1233
|
temperature: 0,
|
|
1224
1234
|
schema: At,
|
|
1225
1235
|
messages: d,
|
|
1226
|
-
inputVariables: { query: t, candidates:
|
|
1236
|
+
inputVariables: { query: t, candidates: l }
|
|
1227
1237
|
})).matchedTitles.map((u) => r.find(({ solution: g }) => g.title === u)).filter((u) => u !== void 0) };
|
|
1228
1238
|
}, Yt = (s, e) => {
|
|
1229
1239
|
if (m(e))
|
|
@@ -1231,20 +1241,20 @@ Description: ${u.description}`).join(`
|
|
|
1231
1241
|
const { existingMatches: t } = s, { hitlResponse: i } = e.configurable, n = `confirmExistingSolution:${t[0].solution.id}`;
|
|
1232
1242
|
if (i?.agentId !== "solutionBuilder" || i.id !== n) {
|
|
1233
1243
|
t.length === 1 ? ye(t[0].solution.id) : fe(t);
|
|
1234
|
-
const
|
|
1244
|
+
const l = f("existingSolutionMatch", e), d = [
|
|
1235
1245
|
f("continueBuildingYes", e),
|
|
1236
1246
|
f("continueBuildingNo", e)
|
|
1237
1247
|
], h = {
|
|
1238
1248
|
agentId: "solutionBuilder",
|
|
1239
1249
|
id: n,
|
|
1240
1250
|
kind: "singleSelection",
|
|
1241
|
-
message:
|
|
1251
|
+
message: l,
|
|
1242
1252
|
metadata: d
|
|
1243
1253
|
};
|
|
1244
1254
|
throw new de(h);
|
|
1245
1255
|
}
|
|
1246
|
-
const
|
|
1247
|
-
return { continueBuilding:
|
|
1256
|
+
const o = String(i.payload ?? "").trim(), a = f("continueBuildingNo", e);
|
|
1257
|
+
return { continueBuilding: o !== a };
|
|
1248
1258
|
}, Zt = (s, e) => {
|
|
1249
1259
|
const t = f("continueBuildingDeclined", e);
|
|
1250
1260
|
return {
|
|
@@ -1252,7 +1262,7 @@ Description: ${u.description}`).join(`
|
|
|
1252
1262
|
summary: t,
|
|
1253
1263
|
status: "success"
|
|
1254
1264
|
};
|
|
1255
|
-
},
|
|
1265
|
+
}, Ee = async (s, e) => {
|
|
1256
1266
|
if (m(e))
|
|
1257
1267
|
return {};
|
|
1258
1268
|
if (await Te(e), m(e))
|
|
@@ -1264,37 +1274,37 @@ Description: ${u.description}`).join(`
|
|
|
1264
1274
|
return {};
|
|
1265
1275
|
if (!n?.initialTemplate)
|
|
1266
1276
|
throw new Error("No hydrated templates are available for solution design.");
|
|
1267
|
-
const
|
|
1277
|
+
const o = $(
|
|
1268
1278
|
t ?? n.initialTemplate,
|
|
1269
1279
|
{
|
|
1270
1280
|
itemId: (t ?? n.initialTemplate)?.solution?.itemId ?? null,
|
|
1271
1281
|
sourceBuildSolution: t?.sourceBuildSolution ?? n.initialTemplate.sourceBuildSolution,
|
|
1272
1282
|
params: t?.params ?? n.initialTemplate.params ?? null
|
|
1273
1283
|
}
|
|
1274
|
-
),
|
|
1275
|
-
promptText: await v(
|
|
1284
|
+
), a = s.agentExecutionContext.messages.slice(-11), r = await k({
|
|
1285
|
+
promptText: await v(E, "designSolution"),
|
|
1276
1286
|
modelTier: "advanced",
|
|
1277
1287
|
temperature: 0,
|
|
1278
1288
|
schema: Z,
|
|
1279
|
-
messages:
|
|
1289
|
+
messages: a,
|
|
1280
1290
|
inputVariables: {
|
|
1281
|
-
currentDesign: JSON.stringify(he(
|
|
1291
|
+
currentDesign: JSON.stringify(he(o)),
|
|
1282
1292
|
templateInstructions: n.instructions,
|
|
1283
1293
|
query: i
|
|
1284
1294
|
}
|
|
1285
1295
|
});
|
|
1286
1296
|
if (await w({ text: " of design solution 1" }, e), m(e))
|
|
1287
1297
|
return {};
|
|
1288
|
-
const { response:
|
|
1298
|
+
const { response: l, featureLayer: d, ...h } = r, y = ge(
|
|
1289
1299
|
d,
|
|
1290
|
-
|
|
1291
|
-
), u =
|
|
1300
|
+
o.featureLayer
|
|
1301
|
+
), u = $(
|
|
1292
1302
|
{ ...h, featureLayer: y },
|
|
1293
1303
|
{
|
|
1294
|
-
itemId:
|
|
1295
|
-
sourceBuildSolution:
|
|
1304
|
+
itemId: o?.solution?.itemId,
|
|
1305
|
+
sourceBuildSolution: o.sourceBuildSolution,
|
|
1296
1306
|
templateId: s.selectedTemplate ?? null,
|
|
1297
|
-
params:
|
|
1307
|
+
params: o.params ?? null
|
|
1298
1308
|
}
|
|
1299
1309
|
), g = new x(u, n.initialTemplate);
|
|
1300
1310
|
if (!g.isValid)
|
|
@@ -1304,11 +1314,11 @@ Description: ${u.description}`).join(`
|
|
|
1304
1314
|
), {
|
|
1305
1315
|
outputMessage: f("createDesignFailed", e)
|
|
1306
1316
|
};
|
|
1307
|
-
const S = u.sourceBuildSolution,
|
|
1308
|
-
if (!
|
|
1317
|
+
const S = u.sourceBuildSolution, F = Se(u, S);
|
|
1318
|
+
if (!F.ok) {
|
|
1309
1319
|
console.warn(
|
|
1310
1320
|
"[SolutionBuilder] designSolution Esri JSON conversion failed:",
|
|
1311
|
-
{ error:
|
|
1321
|
+
{ error: F.error, llmResponse: r, design: u }
|
|
1312
1322
|
);
|
|
1313
1323
|
const C = f("createDesignFailed", e);
|
|
1314
1324
|
return {
|
|
@@ -1318,8 +1328,8 @@ Description: ${u.description}`).join(`
|
|
|
1318
1328
|
};
|
|
1319
1329
|
}
|
|
1320
1330
|
return m(e) ? {} : (we(u), {
|
|
1321
|
-
outputMessage:
|
|
1322
|
-
summary:
|
|
1331
|
+
outputMessage: l,
|
|
1332
|
+
summary: l,
|
|
1323
1333
|
status: "success",
|
|
1324
1334
|
currentDesign: u
|
|
1325
1335
|
});
|
|
@@ -1328,13 +1338,13 @@ Description: ${u.description}`).join(`
|
|
|
1328
1338
|
return {};
|
|
1329
1339
|
const { currentDesign: t } = s;
|
|
1330
1340
|
if (!t)
|
|
1331
|
-
return
|
|
1341
|
+
return Ee(s, e);
|
|
1332
1342
|
const i = s.agentExecutionContext.userRequest, n = s.agentExecutionContext.messages.slice(-11);
|
|
1333
1343
|
await w({ text: f("updatingDesign", e) }, e);
|
|
1334
|
-
let
|
|
1344
|
+
let o;
|
|
1335
1345
|
try {
|
|
1336
|
-
|
|
1337
|
-
promptText: await v(
|
|
1346
|
+
o = await k({
|
|
1347
|
+
promptText: await v(E, "updateDesign"),
|
|
1338
1348
|
modelTier: "advanced",
|
|
1339
1349
|
temperature: 0,
|
|
1340
1350
|
schema: wt,
|
|
@@ -1353,14 +1363,14 @@ Description: ${u.description}`).join(`
|
|
|
1353
1363
|
status: "success"
|
|
1354
1364
|
};
|
|
1355
1365
|
}
|
|
1356
|
-
const { response:
|
|
1366
|
+
const { response: a, patches: r } = o;
|
|
1357
1367
|
if (!r || r.length === 0)
|
|
1358
1368
|
return {
|
|
1359
|
-
outputMessage:
|
|
1360
|
-
summary:
|
|
1369
|
+
outputMessage: a,
|
|
1370
|
+
summary: a,
|
|
1361
1371
|
status: "success"
|
|
1362
1372
|
};
|
|
1363
|
-
const
|
|
1373
|
+
const l = (p) => {
|
|
1364
1374
|
try {
|
|
1365
1375
|
return JSON.parse(p);
|
|
1366
1376
|
} catch {
|
|
@@ -1390,7 +1400,7 @@ Description: ${u.description}`).join(`
|
|
|
1390
1400
|
}, h = [...r.map((p) => ({
|
|
1391
1401
|
op: p.op,
|
|
1392
1402
|
path: p.path.replace(/\/+$/, ""),
|
|
1393
|
-
...p.value != null && p.value !== "" ? { value:
|
|
1403
|
+
...p.value != null && p.value !== "" ? { value: l(p.value) } : {},
|
|
1394
1404
|
...p.from != null && p.from !== "" ? { from: p.from } : {}
|
|
1395
1405
|
}))].sort((p, _) => p.op !== "remove" || _.op !== "remove" ? 0 : _.path.localeCompare(p.path, void 0, { numeric: !0 })), y = structuredClone(
|
|
1396
1406
|
he(t)
|
|
@@ -1400,7 +1410,7 @@ Description: ${u.description}`).join(`
|
|
|
1400
1410
|
} catch (p) {
|
|
1401
1411
|
console.warn(
|
|
1402
1412
|
"[SolutionBuilder] updateDesign JSON patch failed:",
|
|
1403
|
-
{ error: p, llmResponse:
|
|
1413
|
+
{ error: p, llmResponse: o, patches: h, patchTarget: y }
|
|
1404
1414
|
);
|
|
1405
1415
|
const _ = f("applyChangeFailed", e);
|
|
1406
1416
|
return {
|
|
@@ -1409,14 +1419,14 @@ Description: ${u.description}`).join(`
|
|
|
1409
1419
|
status: "success"
|
|
1410
1420
|
};
|
|
1411
1421
|
}
|
|
1412
|
-
const u =
|
|
1422
|
+
const u = $(
|
|
1413
1423
|
{ response: "", ...y },
|
|
1414
1424
|
{ itemId: t.solution?.itemId ?? null }
|
|
1415
1425
|
), g = Z.safeParse(u);
|
|
1416
1426
|
if (!g.success) {
|
|
1417
1427
|
console.warn(
|
|
1418
1428
|
"[SolutionBuilder] updateDesign schema validation failed:",
|
|
1419
|
-
{ errors: g.error.issues, llmResponse:
|
|
1429
|
+
{ errors: g.error.issues, llmResponse: o, patchedDesign: u }
|
|
1420
1430
|
);
|
|
1421
1431
|
const p = f("applyChangeFailed", e);
|
|
1422
1432
|
return {
|
|
@@ -1425,10 +1435,10 @@ Description: ${u.description}`).join(`
|
|
|
1425
1435
|
status: "success"
|
|
1426
1436
|
};
|
|
1427
1437
|
}
|
|
1428
|
-
const { response: S, featureLayer:
|
|
1429
|
-
|
|
1438
|
+
const { response: S, featureLayer: F, ...C } = g.data, z = ge(
|
|
1439
|
+
F,
|
|
1430
1440
|
t.featureLayer
|
|
1431
|
-
), I =
|
|
1441
|
+
), I = $(
|
|
1432
1442
|
{ ...C, featureLayer: z },
|
|
1433
1443
|
{
|
|
1434
1444
|
itemId: t.solution?.itemId,
|
|
@@ -1446,14 +1456,14 @@ Description: ${u.description}`).join(`
|
|
|
1446
1456
|
if (!j.isValid) {
|
|
1447
1457
|
console.warn(
|
|
1448
1458
|
"[SolutionBuilder] updateDesign validation failed:",
|
|
1449
|
-
{ issues: j.issues, llmResponse:
|
|
1459
|
+
{ issues: j.issues, llmResponse: o, patchedDesign: I }
|
|
1450
1460
|
);
|
|
1451
|
-
const p = await
|
|
1461
|
+
const p = await Et({
|
|
1452
1462
|
query: i,
|
|
1453
1463
|
validationIssues: j.issues,
|
|
1454
1464
|
recentMessages: n,
|
|
1455
1465
|
fallbackMessage: f("applyChangeFailed", e),
|
|
1456
|
-
promptModules:
|
|
1466
|
+
promptModules: E
|
|
1457
1467
|
});
|
|
1458
1468
|
return {
|
|
1459
1469
|
outputMessage: p,
|
|
@@ -1461,11 +1471,11 @@ Description: ${u.description}`).join(`
|
|
|
1461
1471
|
status: "success"
|
|
1462
1472
|
};
|
|
1463
1473
|
}
|
|
1464
|
-
const
|
|
1474
|
+
const ke = I.sourceBuildSolution, ne = Se(I, ke);
|
|
1465
1475
|
if (!ne.ok) {
|
|
1466
1476
|
console.warn(
|
|
1467
1477
|
"[SolutionBuilder] updateDesign Esri JSON conversion failed:",
|
|
1468
|
-
{ error: ne.error, llmResponse:
|
|
1478
|
+
{ error: ne.error, llmResponse: o, design: I }
|
|
1469
1479
|
);
|
|
1470
1480
|
const p = f("applyChangeFailed", e);
|
|
1471
1481
|
return {
|
|
@@ -1475,12 +1485,12 @@ Description: ${u.description}`).join(`
|
|
|
1475
1485
|
};
|
|
1476
1486
|
}
|
|
1477
1487
|
return m(e) ? {} : (we(I), {
|
|
1478
|
-
outputMessage:
|
|
1479
|
-
summary:
|
|
1488
|
+
outputMessage: a,
|
|
1489
|
+
summary: a,
|
|
1480
1490
|
status: "success",
|
|
1481
1491
|
currentDesign: I
|
|
1482
1492
|
});
|
|
1483
|
-
}, 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
|
|
1493
|
+
}, 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 W(Gt).addNode("syncCurrentDesignFromContext", Jt).addNode("assessBuildRequest", Ht).addNode("assessUpdateRequest", Qt).addNode("invalidBuildExit", Vt).addNode("invalidUpdateExit", Wt).addNode("selectTemplateHIL", Kt).addNode("findExistingSolutions", Xt).addNode("confirmContinueBuildingHIL", Yt).addNode("declineContinueBuildingExit", Zt).addNode("designSolution", Ee).addNode("updateDesign", es).addEdge(K, "syncCurrentDesignFromContext").addConditionalEdges("syncCurrentDesignFromContext", ts, {
|
|
1484
1494
|
assessUpdateRequest: "assessUpdateRequest",
|
|
1485
1495
|
assessBuildRequest: "assessBuildRequest"
|
|
1486
1496
|
}).addConditionalEdges("assessUpdateRequest", ss, {
|
|
@@ -1497,11 +1507,11 @@ Description: ${u.description}`).join(`
|
|
|
1497
1507
|
declineContinueBuildingExit: "declineContinueBuildingExit",
|
|
1498
1508
|
designSolution: "designSolution"
|
|
1499
1509
|
}).addEdge("declineContinueBuildingExit", A).addEdge("designSolution", A).addEdge("updateDesign", A);
|
|
1500
|
-
await v(
|
|
1501
|
-
const rs =
|
|
1502
|
-
tool:
|
|
1503
|
-
confidence:
|
|
1504
|
-
rationale:
|
|
1510
|
+
await v(E, "description");
|
|
1511
|
+
const rs = L.object({
|
|
1512
|
+
tool: L.enum(["explorer", "builder", "other"]).describe("The selected tool based on the user’s intent using the conversation context."),
|
|
1513
|
+
confidence: L.number().min(0).max(1).describe("A confidence score (0.00–1.00)."),
|
|
1514
|
+
rationale: L.string().min(1).describe("A brief rationale for the tool choice (≤140 characters)")
|
|
1505
1515
|
}), O = (s) => s?.signal?.aborted ?? !1, se = /* @__PURE__ */ Object.assign({
|
|
1506
1516
|
"./prompts/assistantResponse.md": () => import("../../chunks/assistantResponse.js").then((s) => s.default),
|
|
1507
1517
|
"./prompts/classifyIntent.md": () => import("../../chunks/classifyIntent.js").then((s) => s.default),
|
|
@@ -1523,7 +1533,7 @@ const rs = E.object({
|
|
|
1523
1533
|
detail: { finished: !0, agent: e }
|
|
1524
1534
|
});
|
|
1525
1535
|
window.dispatchEvent(i);
|
|
1526
|
-
},
|
|
1536
|
+
}, $e = b.Root({
|
|
1527
1537
|
...X(),
|
|
1528
1538
|
selectedTool: b({
|
|
1529
1539
|
reducer: (s, e) => e ?? null,
|
|
@@ -1541,17 +1551,17 @@ const rs = E.object({
|
|
|
1541
1551
|
{ text: t?.builderMessages.understandingRequest },
|
|
1542
1552
|
e
|
|
1543
1553
|
);
|
|
1544
|
-
const i = s.agentExecutionContext.userRequest, n = s.agentExecutionContext.messages.slice(-11), { activeSolutionDesign:
|
|
1554
|
+
const i = s.agentExecutionContext.userRequest, n = s.agentExecutionContext.messages.slice(-11), { activeSolutionDesign: o, lastTool: a } = ls(e), r = await v(se, "classifyIntent"), l = await k({
|
|
1545
1555
|
promptText: r,
|
|
1546
1556
|
modelTier: "advanced",
|
|
1547
1557
|
temperature: 0,
|
|
1548
1558
|
schema: rs,
|
|
1549
1559
|
messages: n,
|
|
1550
|
-
inputVariables: { query: i, activeSolutionDesign:
|
|
1560
|
+
inputVariables: { query: i, activeSolutionDesign: o, lastTool: a }
|
|
1551
1561
|
});
|
|
1552
1562
|
return {
|
|
1553
|
-
selectedTool:
|
|
1554
|
-
intentRationale:
|
|
1563
|
+
selectedTool: l.tool,
|
|
1564
|
+
intentRationale: l.rationale
|
|
1555
1565
|
};
|
|
1556
1566
|
}, us = async (s, e) => {
|
|
1557
1567
|
if (O(e))
|
|
@@ -1571,19 +1581,19 @@ const rs = E.object({
|
|
|
1571
1581
|
{ text: t?.executingSolutionsAssistantAgent },
|
|
1572
1582
|
e
|
|
1573
1583
|
);
|
|
1574
|
-
const n = await v(se, "assistantResponse"),
|
|
1584
|
+
const n = await v(se, "assistantResponse"), o = s.agentExecutionContext.messages.slice(-11), a = await Ge({
|
|
1575
1585
|
promptText: n,
|
|
1576
1586
|
modelTier: "advanced",
|
|
1577
1587
|
temperature: 0,
|
|
1578
|
-
messages:
|
|
1588
|
+
messages: o,
|
|
1579
1589
|
inputVariables: { query: i }
|
|
1580
1590
|
});
|
|
1581
1591
|
return ie(e, "assistant"), {
|
|
1582
|
-
outputMessage:
|
|
1583
|
-
summary:
|
|
1592
|
+
outputMessage: a,
|
|
1593
|
+
summary: a,
|
|
1584
1594
|
status: "success"
|
|
1585
1595
|
};
|
|
1586
|
-
}, ms = (s) => s.selectedTool ?? "other", hs = () => new
|
|
1596
|
+
}, ms = (s) => s.selectedTool ?? "other", hs = () => new W($e).addNode("classifyIntent", cs).addNode("routeToExplorer", us).addNode("routeToBuilder", ds).addNode("assistantResponse", ps).addEdge(K, "classifyIntent").addConditionalEdges("classifyIntent", ms, {
|
|
1587
1597
|
explorer: "routeToExplorer",
|
|
1588
1598
|
builder: "routeToBuilder",
|
|
1589
1599
|
other: "assistantResponse"
|
|
@@ -1592,7 +1602,7 @@ const rs = E.object({
|
|
|
1592
1602
|
name: "Solutions Assistant Agent",
|
|
1593
1603
|
description: gs,
|
|
1594
1604
|
createGraph: hs,
|
|
1595
|
-
workspace:
|
|
1605
|
+
workspace: $e
|
|
1596
1606
|
}, ys = "https://links.esri.com/solutions/agol-organizational-account", bs = "https://links.esri.com/solutions/configure-assistants";
|
|
1597
1607
|
class xs extends De {
|
|
1598
1608
|
constructor() {
|
|
@@ -1600,7 +1610,7 @@ class xs extends De {
|
|
|
1600
1610
|
aiAssistantsEnabled: !1,
|
|
1601
1611
|
blockBetaApps: !0,
|
|
1602
1612
|
colocateCompute: !1
|
|
1603
|
-
}, this._suggestedPrompts = [], this._hasInteracted = !1, this._isMobile = window.innerWidth <= 800, this._translations =
|
|
1613
|
+
}, this._suggestedPrompts = [], this._hasInteracted = !1, this._isMobile = window.innerWidth <= 800, this._translations = Ne({ 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({
|
|
1604
1614
|
context: Pe,
|
|
1605
1615
|
subscribe: !0,
|
|
1606
1616
|
callback: (e) => {
|
|
@@ -1643,8 +1653,8 @@ class xs extends De {
|
|
|
1643
1653
|
}, this._checkURLOpenParameter = () => {
|
|
1644
1654
|
this.open = this._configContextConsumer.value?.authentication?.SignInParam === "aiOpen" || this.open;
|
|
1645
1655
|
}, this.listenOn(window, "arcgisFeedback", (e) => {
|
|
1646
|
-
const t = e.detail, { agentPicked: i, taskAssigned: n, userMessage:
|
|
1647
|
-
this._sendFeedback(t.content,
|
|
1656
|
+
const t = e.detail, { agentPicked: i, taskAssigned: n, userMessage: o } = this._parseAgentPickedAndTask(t), a = this._responseMetadata.get(t.id), r = a?.agent ?? i ?? "", l = a?.userMessage ?? a?.userMessage ?? o ?? n ?? "";
|
|
1657
|
+
this._sendFeedback(t.content, l, t.feedback?.positive ? "Good" : t.feedback?.positive === !1 ? "Bad" : "N/A", r);
|
|
1648
1658
|
}), this.listenOn(window, "clearAssistantConversation", () => {
|
|
1649
1659
|
this._clearConversation();
|
|
1650
1660
|
});
|
|
@@ -1747,8 +1757,8 @@ class xs extends De {
|
|
|
1747
1757
|
this._conversationId = void 0, this._lastTurnAgent = void 0, this._lastResponseAgent = void 0, this._pendingResponseAgent = void 0, this._suggestedPrompts = [], this._hasInteracted = !1, this._responseMetadata.clear(), this._assistantRef.value?.clearChatHistory();
|
|
1748
1758
|
}
|
|
1749
1759
|
_sendFeedback(e, t, i, n) {
|
|
1750
|
-
const
|
|
1751
|
-
window.open(
|
|
1760
|
+
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")}`;
|
|
1761
|
+
window.open(o, "_blank");
|
|
1752
1762
|
}
|
|
1753
1763
|
async _loadUserFirstName() {
|
|
1754
1764
|
try {
|
|
@@ -1765,28 +1775,28 @@ class xs extends De {
|
|
|
1765
1775
|
for (let i = t.length - 1; i >= 0; i--) {
|
|
1766
1776
|
const n = t[i];
|
|
1767
1777
|
if (n.role === "assistant" && !this._responseMetadata.has(n.id)) {
|
|
1768
|
-
let
|
|
1769
|
-
for (let
|
|
1770
|
-
const r = t[
|
|
1778
|
+
let o;
|
|
1779
|
+
for (let a = i - 1; a >= 0; a--) {
|
|
1780
|
+
const r = t[a];
|
|
1771
1781
|
if (r.role === "user") {
|
|
1772
|
-
|
|
1782
|
+
o = r.content;
|
|
1773
1783
|
break;
|
|
1774
1784
|
}
|
|
1775
1785
|
}
|
|
1776
|
-
return this._responseMetadata.set(n.id, { agent: e, userMessage:
|
|
1786
|
+
return this._responseMetadata.set(n.id, { agent: e, userMessage: o }), !0;
|
|
1777
1787
|
}
|
|
1778
1788
|
}
|
|
1779
1789
|
return !1;
|
|
1780
1790
|
}
|
|
1781
1791
|
_parseAgentPickedAndTask(e) {
|
|
1782
|
-
const t = Array.from(this._assistantRef.value?.messages || []), i = e.log || [],
|
|
1792
|
+
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;
|
|
1783
1793
|
if (!r)
|
|
1784
|
-
return { agentPicked: null, taskAssigned: null, userMessage:
|
|
1785
|
-
const
|
|
1794
|
+
return { agentPicked: null, taskAssigned: null, userMessage: a };
|
|
1795
|
+
const l = /Agent picked:\s*(.*?)\s*(?:\\n|\r?\n)\s*Task Assigned:\s*([\s\S]*)$/i, d = r.match(l);
|
|
1786
1796
|
if (!d)
|
|
1787
|
-
return { agentPicked: null, taskAssigned: null, userMessage:
|
|
1797
|
+
return { agentPicked: null, taskAssigned: null, userMessage: a };
|
|
1788
1798
|
const h = d[1].trim(), y = d[2].trim();
|
|
1789
|
-
return { agentPicked: h, taskAssigned: y, userMessage:
|
|
1799
|
+
return { agentPicked: h, taskAssigned: y, userMessage: a };
|
|
1790
1800
|
}
|
|
1791
1801
|
_emitItemIdFromAI(e) {
|
|
1792
1802
|
const t = new CustomEvent("solutionIDFromAssistant", {
|
|
@@ -1797,7 +1807,7 @@ class xs extends De {
|
|
|
1797
1807
|
window.dispatchEvent(t);
|
|
1798
1808
|
}
|
|
1799
1809
|
}
|
|
1800
|
-
|
|
1810
|
+
Fe("arcgis-solutions-assistant", xs);
|
|
1801
1811
|
export {
|
|
1802
1812
|
xs as ArcgisSolutionsAssistant
|
|
1803
1813
|
};
|