@esri/solutions-components 5.1.0 → 5.1.2
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/{NXX22DHX.js → 3CSSTWYC.js} +1 -1
- package/dist/cdn/{BT6SXXE2.js → 3DNEBMT3.js} +1 -1
- package/dist/cdn/{4SORDX5Z.js → 3FIRDPVD.js} +1 -1
- package/dist/cdn/{5UW2NTSN.js → 3KYCZII7.js} +1 -1
- package/dist/cdn/{MIV34H66.js → 3NI2BJYO.js} +1 -1
- package/dist/cdn/{G2H3X6NS.js → 3W7ANZME.js} +1 -1
- package/dist/cdn/{CVXDL2AT.js → 4MAH5ULJ.js} +1 -1
- package/dist/cdn/{SWY74BKB.js → 4RH7N22O.js} +1 -1
- package/dist/cdn/{RCWYHGZ5.js → 5F6WBFDO.js} +1 -1
- package/dist/cdn/{TWN7DOAU.js → 5FW45CM6.js} +1 -1
- package/dist/cdn/{5FWKODDH.js → 5IO4VX4R.js} +1 -1
- package/dist/cdn/{463CZQF6.js → 5Q64VY2E.js} +1 -1
- package/dist/cdn/{TWJ6DAY5.js → 65I4AUS4.js} +1 -1
- package/dist/cdn/{54A4C4RG.js → 65OXHGCN.js} +1 -1
- package/dist/cdn/{LGWAEUZM.js → 6F6YFDOY.js} +1 -1
- package/dist/cdn/{KTW6BSEC.js → 6KBY56R4.js} +1 -1
- package/dist/cdn/{6HZBPFHA.js → 6L6JOGWD.js} +1 -1
- package/dist/cdn/{MDWJ6JLF.js → 6OKLCUSH.js} +1 -1
- package/dist/cdn/{LV5KMTCD.js → 6RQBPR56.js} +1 -1
- package/dist/cdn/{Y6JJY3IC.js → 74Z5A6E2.js} +1 -1
- package/dist/cdn/{JHOJZDXC.js → 7AHZBLTM.js} +1 -1
- package/dist/cdn/{KSIYOSLP.js → 7EJXZVSX.js} +1 -1
- package/dist/cdn/{BOFA5RH7.js → 7NQYBMRX.js} +1 -1
- package/dist/cdn/{HIB4BVGK.js → 7XPOQHB4.js} +1 -1
- package/dist/cdn/A4KEZALJ.js +2 -0
- package/dist/cdn/{OYRMCWNZ.js → AS7PVOU3.js} +1 -1
- package/dist/cdn/{TZHRYPII.js → B7CVHLVL.js} +1 -1
- package/dist/cdn/{LO35PCP7.js → BFFHQBDI.js} +1 -1
- package/dist/cdn/{MKSUYITL.js → BKIKLE4Z.js} +1 -1
- package/dist/cdn/{WNVC3PSY.js → BWNEUQZZ.js} +1 -1
- package/dist/cdn/{KFRHOPZY.js → BZWJ3KFS.js} +129 -129
- package/dist/cdn/{SEG43OPO.js → C2GWD5VP.js} +1 -1
- package/dist/cdn/{KRP5SGSU.js → C3SIGIJC.js} +1 -1
- package/dist/cdn/CC7JGR5Q.js +2 -0
- package/dist/cdn/{KDDHPA54.js → CKPQTIAF.js} +1 -1
- package/dist/cdn/{VUXNHQGR.js → CRTJERAB.js} +1 -1
- package/dist/cdn/{5X43GK3C.js → CVKCFLNY.js} +1 -1
- package/dist/cdn/{VPXGD2H4.js → CVNW2AU2.js} +1 -1
- package/dist/cdn/{X3YRR4BO.js → CXTHIJOC.js} +65 -73
- package/dist/cdn/{RLYEATAS.js → DE7GSGUB.js} +1 -1
- package/dist/cdn/{YUI2MSOK.js → DEVAXAP7.js} +1 -1
- package/dist/cdn/{2TEBTKD4.js → DF2U7HIU.js} +1 -1
- package/dist/cdn/{7P57UVVG.js → DLV7AZZ6.js} +1 -1
- package/dist/cdn/DQJ36YEL.js +2 -0
- package/dist/cdn/{ZHCAZ2TH.js → DXI5HEQM.js} +1 -1
- package/dist/cdn/E3O6DPAL.js +2 -0
- package/dist/cdn/{X257ACPD.js → E5YZOOW3.js} +1 -1
- package/dist/cdn/{I4QWYULN.js → EBDDUQNC.js} +1 -1
- package/dist/cdn/{47FRMYZ4.js → ECUD4NU6.js} +1 -1
- package/dist/cdn/{EUI2Y6R4.js → EHIUCEAX.js} +1 -1
- package/dist/cdn/{AIM7NSD3.js → EJRV6YWD.js} +1 -1
- package/dist/cdn/EX4K4RKP.js +2 -0
- package/dist/cdn/{M6AOD7GG.js → FDNEF4QD.js} +1 -1
- package/dist/cdn/{Y2MAVMNV.js → FSFVH74N.js} +1 -1
- package/dist/cdn/{XYKQ6M25.js → GHVPHEOH.js} +1 -1
- package/dist/cdn/GPIIJWNM.js +2 -0
- package/dist/cdn/{BHLMO6KY.js → GRVDJVOF.js} +1 -1
- package/dist/cdn/{2AWUR4ZA.js → GSI62QHB.js} +1 -1
- package/dist/cdn/{O4DB2EXV.js → GSLDFLWZ.js} +1 -1
- package/dist/cdn/{3A3CPQX4.js → GWIC6C6P.js} +1 -1
- package/dist/cdn/{2R7Y2ZVX.js → GZZMHIFA.js} +1 -1
- package/dist/cdn/{G4V4JPFI.js → HOSSEVH5.js} +1 -1
- package/dist/cdn/{6WNKGSHD.js → HQFL3NGM.js} +1 -1
- package/dist/cdn/{IXRFWVBT.js → IGY23J7D.js} +1 -1
- package/dist/cdn/{FQTDRS3G.js → INFZEU32.js} +1 -1
- package/dist/cdn/{56DNSWXG.js → IVMHEGLY.js} +1 -1
- package/dist/cdn/{SGQEHPTT.js → J7DTCWOP.js} +1 -1
- package/dist/cdn/{F4MS4NQL.js → JB5XLSNA.js} +1 -1
- package/dist/cdn/{IAEFPE3L.js → JF2ASXUT.js} +1 -1
- package/dist/cdn/{6GBSXKKJ.js → KB7CXY4N.js} +1 -1
- package/dist/cdn/{5IDPOFIN.js → KLZWOBGK.js} +1 -1
- package/dist/cdn/{UIZL3C3H.js → KMY4AVEA.js} +1 -1
- package/dist/cdn/{XQ7SXIHI.js → KPEPW4QL.js} +1 -1
- package/dist/cdn/{3JCHYXHA.js → KPKJ2OVD.js} +1 -1
- package/dist/cdn/{SJLSYFK3.js → L6XSVTY3.js} +1 -1
- package/dist/cdn/LCDURBN6.js +3 -0
- package/dist/cdn/{D22STVK5.js → LFIP5DV3.js} +1 -1
- package/dist/cdn/{5N4KGIIY.js → LK6WQCXQ.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/{ZZZPISEE.js → LSDYUCCZ.js} +1 -1
- package/dist/cdn/{H4LZV33O.js → LSMP2ZCO.js} +1 -1
- package/dist/cdn/{376KPQCJ.js → LXJI7FYN.js} +1 -1
- package/dist/cdn/{NX7HKBFH.js → MHMM4RFR.js} +1 -1
- package/dist/cdn/{2RL6H5TB.js → MVSQRD5M.js} +1 -1
- package/dist/cdn/{PIAGRMMB.js → MVXK7UGO.js} +47 -47
- package/dist/cdn/MXPZF4RB.js +2 -0
- package/dist/cdn/{HOCCKT72.js → MZ5XI2CY.js} +1 -1
- package/dist/cdn/{3BG6WS6Q.js → NIUKLQOT.js} +1 -1
- package/dist/cdn/{BI3I22IR.js → NJSQ3NUT.js} +3 -3
- package/dist/cdn/{SXEL7KTE.js → NVNB4L52.js} +1 -1
- package/dist/cdn/{CLHUIZMU.js → NWOPIQFN.js} +1 -1
- package/dist/cdn/{5LSNDSHW.js → O6HS2AMH.js} +1 -1
- package/dist/cdn/{HM2QALUN.js → O6IGMQN7.js} +1 -1
- package/dist/cdn/{RRWG2OJP.js → OPWMEQVM.js} +1 -1
- package/dist/cdn/{FSF3T3OT.js → OVAQRVFG.js} +1 -1
- package/dist/cdn/{PM4EFNB2.js → P2FSR5OV.js} +1 -1
- package/dist/cdn/{BIX5DRQP.js → PQVA7SKB.js} +1 -1
- package/dist/cdn/{4CSMWYIO.js → PSM4UX7K.js} +1 -1
- package/dist/cdn/{SXTON3QW.js → Q5N7I65T.js} +1 -1
- package/dist/cdn/{BWWX52HV.js → Q6CXYCV6.js} +1 -1
- package/dist/cdn/{PLQEDCUG.js → QMQAQSIA.js} +1 -1
- package/dist/cdn/{GFBJLNEH.js → QODVIACF.js} +1 -1
- package/dist/cdn/{FFZ2XVRE.js → QTCXH2O3.js} +1 -1
- package/dist/cdn/{FYJMHXWV.js → QVD3AXIP.js} +1 -1
- package/dist/cdn/{6FY64JKN.js → RAL6IXW5.js} +1 -1
- package/dist/cdn/{NNY2YF2L.js → RJLEYL7O.js} +1 -1
- package/dist/cdn/{7QKF26VG.js → RNNEZRGA.js} +1 -1
- package/dist/cdn/{77753TPX.js → RPL5Q7IL.js} +1 -1
- package/dist/cdn/{4PDT6TEX.js → RQVXDCWL.js} +1 -1
- package/dist/cdn/{GSR2GEY7.js → SD3DV4KO.js} +1 -1
- package/dist/cdn/SQEPSAKG.js +2 -0
- package/dist/cdn/{V5UJ5VTY.js → T7O4WZGU.js} +1 -1
- package/dist/cdn/{7O4E4IAA.js → UDWEFNJE.js} +1 -1
- package/dist/cdn/{AZKNC2SR.js → UILBHLN7.js} +1 -1
- package/dist/cdn/{BXSBR2GT.js → V24CDHGH.js} +1 -1
- package/dist/cdn/{DIBK4RSG.js → VSRNGZ43.js} +1 -1
- package/dist/cdn/{R27S3IDW.js → WNYAZ4ME.js} +1 -1
- package/dist/cdn/{PUYJYHQM.js → WRMREY3V.js} +1 -1
- package/dist/cdn/{EWS72RFR.js → WVCL5OUK.js} +1 -1
- package/dist/cdn/{VKHBBAXO.js → XA6ZDTKA.js} +1 -1
- package/dist/cdn/{37P3IMFV.js → XIUYVZYL.js} +1 -1
- package/dist/cdn/{ARFBMFQW.js → XXRBPKMI.js} +1 -1
- package/dist/cdn/{INLWMPGE.js → XYAVR2MM.js} +1 -1
- package/dist/cdn/{743J2ZUC.js → Y2KRCLNN.js} +1 -1
- package/dist/cdn/{4RCC4KA2.js → Y7Z6LFBH.js} +1 -1
- package/dist/cdn/{GMAAQEP7.js → YBJ6AHAG.js} +1 -1
- package/dist/cdn/{QEUKNYOL.js → YHF3Q7QB.js} +1 -1
- package/dist/cdn/{HKFXHTYU.js → YVNBCXBJ.js} +1 -1
- package/dist/cdn/{Q4UI3ZGH.js → Z6CZ7GFZ.js} +1 -1
- package/dist/cdn/ZB5UCRCG.js +2 -0
- package/dist/cdn/{SSCE4O7V.js → ZHVO477V.js} +1 -1
- package/dist/cdn/{A6ZTIX3P.js → ZSATEDPE.js} +1 -1
- package/dist/cdn/{NIYY6XUQ.js → ZXGNDW3R.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 +374 -358
- package/dist/components/create-feature/customElement.js +23 -18
- package/dist/components/create-related-feature/customElement.js +8 -6
- package/dist/components/crowdsource-manager/customElement.d.ts +0 -6
- package/dist/components/crowdsource-manager/customElement.js +14 -11
- package/dist/components/layer-table/customElement.js +3 -3
- 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/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/loader.js +1 -1
- package/dist/solutions-components_commit.txt +6 -6
- package/dist/types/lumina.d.ts +1 -1
- package/dist/types/preact.d.ts +1 -1
- package/dist/types/react.d.ts +1 -1
- package/dist/types/stencil.d.ts +1 -1
- package/dist/utils/interfaces.d.ts +1 -0
- package/package.json +5 -7
- package/dist/cdn/E3F63VW4.js +0 -2
- package/dist/cdn/F7XCLL7U.js +0 -3
- package/dist/cdn/FSHV53TK.js +0 -2
- package/dist/cdn/HIPZRG2Q.js +0 -2
- package/dist/cdn/IXPNZCW6.js +0 -2
- package/dist/cdn/J3SDL3LR.js +0 -2
- package/dist/cdn/JO6WZKYF.js +0 -2
- package/dist/cdn/KR2PPIBX.js +0 -2
- package/dist/cdn/OGH565H7.js +0 -3
- package/dist/cdn/QH343537.js +0 -56
- package/dist/cdn/QPHNKFC6.js +0 -2
- package/dist/cdn/S4GBMN37.js +0 -2
- package/dist/cdn/UUKV62PY.js +0 -109
- package/dist/cdn/ZPEVEBJD.js +0 -121
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
2
|
import { c as Ne } from "../../chunks/runtime.js";
|
|
3
|
-
import { u as
|
|
4
|
-
import { LitElement as
|
|
5
|
-
import { css as
|
|
6
|
-
import { unsafeHTML as
|
|
3
|
+
import { u as De } from "../../chunks/useT9n.js";
|
|
4
|
+
import { LitElement as Me, createEvent as ae, nothing as re } from "@arcgis/lumina";
|
|
5
|
+
import { css as Re, html as L } from "lit";
|
|
6
|
+
import { unsafeHTML as Pe } from "lit/directives/unsafe-html.js";
|
|
7
7
|
import { useContextConsumer as le } from "@arcgis/lumina/context";
|
|
8
|
-
import { c as
|
|
8
|
+
import { c as Be, b as qe } from "../../chunks/deployAppContexts.js";
|
|
9
9
|
import { T as M } from "../../chunks/interfaces.js";
|
|
10
|
-
import { m as
|
|
10
|
+
import { m as Ue } from "../../chunks/helpers.js";
|
|
11
11
|
import G from "@arcgis/core/config.js";
|
|
12
|
-
import { createRef as
|
|
13
|
-
import { Annotation as b, StateGraph as
|
|
14
|
-
import { createAgentRuntimeState as X, sendTraceMessage as w, invokeStructuredPrompt as
|
|
15
|
-
import
|
|
12
|
+
import { createRef as Oe, ref as ze } from "lit-html/directives/ref.js";
|
|
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 C, getEmbeddings as je, cosineSimilarity as Ge, invokeTextPrompt as Je } from "@arcgis/ai-components/utils/index.js";
|
|
15
|
+
import c, { z as E } from "zod";
|
|
16
16
|
import * as Y from "@esri/arcgis-rest-portal";
|
|
17
|
-
import { applyPatch as
|
|
17
|
+
import { applyPatch as He } 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
|
|
21
|
-
import {
|
|
22
|
-
import { t as me, g as q, c as he, r as ge, d as F } from "../../chunks/templates.js";
|
|
20
|
+
import { v as J, b as H, S as Ve, h as Qe, E as We, g as Ke } from "../../chunks/validators.js";
|
|
21
|
+
import { t as me, g as q, c as he, r as ge, d as N } from "../../chunks/templates.js";
|
|
23
22
|
import Xe from "@arcgis/core/portal/Portal.js";
|
|
24
23
|
import Ye from "@arcgis/core/portal/PortalItem.js";
|
|
25
|
-
const Ze =
|
|
24
|
+
const Ze = Re`: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
25
|
async function v(s, e) {
|
|
27
26
|
const t = Object.entries(s).find(
|
|
28
27
|
([i]) => i.endsWith(`/${e}.md`)
|
|
@@ -84,17 +83,24 @@ function tt(s) {
|
|
|
84
83
|
function st(s) {
|
|
85
84
|
return s.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, (e, t, i) => `<img src="${i}" alt="${t}" style="width: 100%;">`);
|
|
86
85
|
}
|
|
86
|
+
function xe(s) {
|
|
87
|
+
const e = (s ?? "").trim();
|
|
88
|
+
if (!e)
|
|
89
|
+
return "en";
|
|
90
|
+
const t = e.split(/[-_]/)[0]?.toLowerCase();
|
|
91
|
+
return t ? t.slice(0, 2) : "en";
|
|
92
|
+
}
|
|
87
93
|
function it(s, e) {
|
|
88
94
|
const t = [];
|
|
89
95
|
return (e?.configurable?.context?.configContext.allCards ?? []).forEach((n) => {
|
|
90
|
-
const
|
|
91
|
-
if (!
|
|
96
|
+
const o = n.title;
|
|
97
|
+
if (!o)
|
|
92
98
|
return;
|
|
93
|
-
const
|
|
99
|
+
const a = new RegExp(`(?<![\\p{L}\\p{N}])${o}(?![\\p{L}\\p{N}])`, "giu");
|
|
94
100
|
let r = !1;
|
|
95
|
-
s = s.replace(
|
|
101
|
+
s = s.replace(a, (l, d, h) => {
|
|
96
102
|
const y = h.slice(0, d);
|
|
97
|
-
return /<img[^>]*alt\s*=\s*["'][^"']*$/i.test(y) ?
|
|
103
|
+
return /<img[^>]*alt\s*=\s*["'][^"']*$/i.test(y) ? l : (r = !0, `<a href="" target="solutionId:${n.deployCommonId}">${o}</a>`);
|
|
98
104
|
}), r && t.push({
|
|
99
105
|
solution: {
|
|
100
106
|
title: n.title,
|
|
@@ -109,7 +115,7 @@ function it(s, e) {
|
|
|
109
115
|
function nt(s) {
|
|
110
116
|
return s && s.helperServices.aiAssistantServices ? `${s.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/chat` : null;
|
|
111
117
|
}
|
|
112
|
-
function
|
|
118
|
+
function ve(s) {
|
|
113
119
|
return s && s.helperServices.aiAssistantServices ? `${s.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/api/pre-chat` : null;
|
|
114
120
|
}
|
|
115
121
|
async function Q(s, e, t) {
|
|
@@ -131,16 +137,16 @@ async function at(s, e) {
|
|
|
131
137
|
if (!i || n.length <= 1 || i === "explorer")
|
|
132
138
|
return t;
|
|
133
139
|
try {
|
|
134
|
-
const
|
|
135
|
-
promptText:
|
|
140
|
+
const o = await v(be, "transformQuery"), a = await C({
|
|
141
|
+
promptText: o,
|
|
136
142
|
modelTier: "advanced",
|
|
137
143
|
temperature: 0,
|
|
138
144
|
schema: et,
|
|
139
145
|
messages: n.slice(-11),
|
|
140
146
|
inputVariables: { query: t, lastTurnAgent: i }
|
|
141
147
|
});
|
|
142
|
-
if (
|
|
143
|
-
return console.debug(`Rephrased query from "${t}" to "${
|
|
148
|
+
if (a.needsContext && a.rewrittenQuery.trim())
|
|
149
|
+
return console.debug(`Rephrased query from "${t}" to "${a.rewrittenQuery.trim()}"`), a.rewrittenQuery.trim();
|
|
144
150
|
} catch {
|
|
145
151
|
}
|
|
146
152
|
return t;
|
|
@@ -166,34 +172,34 @@ const rt = b.Root({
|
|
|
166
172
|
reducer: (s, e) => e ?? s,
|
|
167
173
|
default: () => null
|
|
168
174
|
})
|
|
169
|
-
}), lt = () => new
|
|
175
|
+
}), lt = () => new W(rt).addNode("initializeAgent", ut).addNode("askSolutionsQuestions", ct).addEdge(K, "initializeAgent").addEdge("initializeAgent", "askSolutionsQuestions").addEdge("askSolutionsQuestions", A), _e = async (s, e, t, i) => {
|
|
170
176
|
if (!s) return;
|
|
171
|
-
const n =
|
|
177
|
+
const n = ve(s);
|
|
172
178
|
if (!n) return;
|
|
173
|
-
const
|
|
179
|
+
const a = { context: {
|
|
174
180
|
kind: "DocAIAssistantRequest",
|
|
175
181
|
filters: {
|
|
176
182
|
products: "ArcGIS Solutions",
|
|
177
183
|
persona: { persona: "apps-solutions" },
|
|
178
184
|
pipeline: {
|
|
179
|
-
translation: { allow: !0, language: t, use_llm: !1 }
|
|
185
|
+
translation: { allow: !0, language: xe(t), use_llm: !1 }
|
|
180
186
|
}
|
|
181
187
|
}
|
|
182
188
|
} };
|
|
183
|
-
i && (
|
|
189
|
+
i && (a.conversationId = i), Q(a, n, e ?? "");
|
|
184
190
|
}, ct = async (s, e) => {
|
|
185
191
|
if (ce(e))
|
|
186
192
|
return {};
|
|
187
193
|
const t = U(e), i = s.documentSkillUrl;
|
|
188
194
|
let n = [];
|
|
189
|
-
const
|
|
195
|
+
const o = await at(s, e);
|
|
190
196
|
await w(
|
|
191
197
|
{ text: t.agentProgress.explorerAgentSearching },
|
|
192
198
|
e
|
|
193
199
|
);
|
|
194
|
-
let
|
|
200
|
+
let a = await Q(
|
|
195
201
|
{
|
|
196
|
-
message:
|
|
202
|
+
message: o,
|
|
197
203
|
conversationId: e?.configurable?.context?.convoId ?? void 0,
|
|
198
204
|
context: {
|
|
199
205
|
kind: "DocAIAssistantRequest",
|
|
@@ -201,7 +207,7 @@ const rt = b.Root({
|
|
|
201
207
|
products: "ArcGIS Solutions",
|
|
202
208
|
persona: { persona: "apps-solutions" },
|
|
203
209
|
pipeline: {
|
|
204
|
-
translation: { allow: !0, language: e?.configurable?.context?.configContext.locale
|
|
210
|
+
translation: { allow: !0, language: xe(e?.configurable?.context?.configContext.locale), use_llm: !1 }
|
|
205
211
|
}
|
|
206
212
|
}
|
|
207
213
|
}
|
|
@@ -209,35 +215,35 @@ const rt = b.Root({
|
|
|
209
215
|
i,
|
|
210
216
|
e?.configurable?.context?.token ?? ""
|
|
211
217
|
);
|
|
212
|
-
|
|
218
|
+
a.conversationId && e?.configurable?.context?.setConversationId && e.configurable.context.setConversationId(a.conversationId);
|
|
213
219
|
let r = {
|
|
214
|
-
message:
|
|
215
|
-
conversationId:
|
|
216
|
-
hasMore:
|
|
217
|
-
ackSequenceNumber:
|
|
218
|
-
inquiryId:
|
|
219
|
-
},
|
|
220
|
+
message: a.message,
|
|
221
|
+
conversationId: a.conversationId,
|
|
222
|
+
hasMore: a.hasMore,
|
|
223
|
+
ackSequenceNumber: a.sequenceNumber,
|
|
224
|
+
inquiryId: a.inquiryId
|
|
225
|
+
}, l = "";
|
|
220
226
|
const d = async (y) => {
|
|
221
227
|
const u = y.context?.results?.[0]?.reply ?? "";
|
|
222
228
|
if (u !== "") {
|
|
223
|
-
const
|
|
224
|
-
|
|
229
|
+
const I = tt(u), F = st(I), T = it(F, e);
|
|
230
|
+
l = T.source, n = [
|
|
225
231
|
...n,
|
|
226
|
-
...
|
|
227
|
-
(z) => !n.some((
|
|
232
|
+
...T.allMatches.filter(
|
|
233
|
+
(z) => !n.some((S) => S.solution.id === z.solution.id)
|
|
228
234
|
)
|
|
229
235
|
];
|
|
230
236
|
}
|
|
231
237
|
const g = y.context?.results?.[0]?.status?.currentStatusStep;
|
|
232
238
|
if (g) {
|
|
233
|
-
let
|
|
234
|
-
g === 1 ?
|
|
239
|
+
let I = "";
|
|
240
|
+
g === 1 ? I = t.agentProgress.explorerAgentReading : g === 2 ? I = t.agentProgress.explorerAgentReviewing : g === 3 && (I = t.agentProgress.explorerAgentPreparing), await w({ text: I }, e);
|
|
235
241
|
}
|
|
236
242
|
};
|
|
237
|
-
for (await d(
|
|
243
|
+
for (await d(a); r.hasMore; ) {
|
|
238
244
|
if (ce(e))
|
|
239
245
|
return {};
|
|
240
|
-
await ot(500),
|
|
246
|
+
await ot(500), a = await Q(
|
|
241
247
|
{
|
|
242
248
|
conversationId: r.conversationId,
|
|
243
249
|
ackSequenceNumber: r.ackSequenceNumber,
|
|
@@ -246,21 +252,21 @@ const rt = b.Root({
|
|
|
246
252
|
i,
|
|
247
253
|
e?.configurable?.context?.token ?? ""
|
|
248
254
|
), r = {
|
|
249
|
-
message:
|
|
250
|
-
conversationId:
|
|
251
|
-
hasMore:
|
|
252
|
-
ackSequenceNumber:
|
|
253
|
-
inquiryId:
|
|
254
|
-
}, await d(
|
|
255
|
-
}
|
|
256
|
-
return
|
|
255
|
+
message: a.message,
|
|
256
|
+
conversationId: a.conversationId,
|
|
257
|
+
hasMore: a.hasMore,
|
|
258
|
+
ackSequenceNumber: a.sequenceNumber,
|
|
259
|
+
inquiryId: a.inquiryId
|
|
260
|
+
}, await d(a);
|
|
261
|
+
}
|
|
262
|
+
return ve(e?.configurable?.context.portal) && _e(
|
|
257
263
|
e?.configurable?.context.portal,
|
|
258
264
|
e?.configurable?.context.token ?? "",
|
|
259
265
|
e?.configurable?.context.configContext.locale ?? "en",
|
|
260
266
|
r.conversationId
|
|
261
267
|
), n.length && (n.length === 1 ? ye(n[0].solution.id) : fe(n)), {
|
|
262
|
-
outputMessage:
|
|
263
|
-
summary:
|
|
268
|
+
outputMessage: l,
|
|
269
|
+
summary: l,
|
|
264
270
|
status: "success",
|
|
265
271
|
solutionResponse: r,
|
|
266
272
|
conversationId: r.conversationId
|
|
@@ -272,7 +278,7 @@ const rt = b.Root({
|
|
|
272
278
|
};
|
|
273
279
|
};
|
|
274
280
|
await v(be, "solutions_explorer_description");
|
|
275
|
-
const
|
|
281
|
+
const we = (s) => {
|
|
276
282
|
if (s && Array.isArray(s.id) && s.id.length > 0)
|
|
277
283
|
return s.id[s.id.length - 1].replace("Message", "").toLowerCase();
|
|
278
284
|
if (s && typeof s._getType == "function")
|
|
@@ -283,7 +289,7 @@ const _e = (s) => {
|
|
|
283
289
|
}
|
|
284
290
|
return "human";
|
|
285
291
|
}, dt = (s) => {
|
|
286
|
-
const e =
|
|
292
|
+
const e = we(s);
|
|
287
293
|
if (s && s.kwargs)
|
|
288
294
|
return {
|
|
289
295
|
role: e,
|
|
@@ -298,7 +304,7 @@ const _e = (s) => {
|
|
|
298
304
|
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;
|
|
299
305
|
}
|
|
300
306
|
return { role: "human", content: String(s) };
|
|
301
|
-
}, pt = (s) =>
|
|
307
|
+
}, 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
308
|
builderMessages: gt
|
|
303
309
|
};
|
|
304
310
|
class x {
|
|
@@ -322,6 +328,9 @@ class x {
|
|
|
322
328
|
static {
|
|
323
329
|
this.FIELD_NAME_MAX_LENGTH = 31;
|
|
324
330
|
}
|
|
331
|
+
static {
|
|
332
|
+
this.ALLOWED_FIELD_TYPES = /* @__PURE__ */ new Set(["string", "integer", "double", "date", "guid"]);
|
|
333
|
+
}
|
|
325
334
|
/**
|
|
326
335
|
* Runs all validation checks on the response.
|
|
327
336
|
*/
|
|
@@ -359,8 +368,8 @@ class x {
|
|
|
359
368
|
for (const n of this.response.solution.strings) {
|
|
360
369
|
if (n.value)
|
|
361
370
|
continue;
|
|
362
|
-
const
|
|
363
|
-
this.newDesign &&
|
|
371
|
+
const o = t.get(n.key)?.value;
|
|
372
|
+
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
373
|
}
|
|
365
374
|
}
|
|
366
375
|
/**
|
|
@@ -392,23 +401,23 @@ class x {
|
|
|
392
401
|
* any other user-edited properties on the item.
|
|
393
402
|
*/
|
|
394
403
|
_reconcileItems() {
|
|
395
|
-
const e = new Set(this.template.items.map((
|
|
404
|
+
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
405
|
if (e.size === t.size && i.length === 1 && n.length === 1) {
|
|
397
|
-
const
|
|
398
|
-
if (
|
|
399
|
-
|
|
406
|
+
const a = i[0], r = n[0], l = this.response.items.find((d) => d.id === a);
|
|
407
|
+
if (l) {
|
|
408
|
+
l.id = r, this._logAutoFix(`Item id '${a}' did not match the template id '${r}'. Auto-fixed in place.`);
|
|
400
409
|
return;
|
|
401
410
|
}
|
|
402
411
|
}
|
|
403
|
-
i.length && (this.response.items = this.response.items.filter((
|
|
404
|
-
const
|
|
405
|
-
if (
|
|
412
|
+
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(", ")}.`));
|
|
413
|
+
const o = this.template.items.filter((a) => !t.has(a.id));
|
|
414
|
+
if (o.length) {
|
|
406
415
|
this.response.items = [
|
|
407
|
-
...
|
|
416
|
+
...o.map((a) => ({ ...a })),
|
|
408
417
|
...this.response.items
|
|
409
418
|
];
|
|
410
|
-
for (const
|
|
411
|
-
this._logAutoFix(`Item '${
|
|
419
|
+
for (const a of o)
|
|
420
|
+
this._logAutoFix(`Item '${a.id}' was missing from the design. Auto-fixed by adding it from the template.`);
|
|
412
421
|
}
|
|
413
422
|
}
|
|
414
423
|
/**
|
|
@@ -421,22 +430,22 @@ class x {
|
|
|
421
430
|
t.itemId = e.itemId, this._logAutoFix(`Feature Layer itemId '${i}' did not match the template. Auto-fixed to '${e.itemId}'.`);
|
|
422
431
|
}
|
|
423
432
|
if (!e.addLayers) {
|
|
424
|
-
const i = new Set(e.layers.map((
|
|
425
|
-
if (!(i.size === n.size && [...i].every((
|
|
433
|
+
const i = new Set(e.layers.map((o) => o.id)), n = new Set(t.layers.map((o) => o.id));
|
|
434
|
+
if (!(i.size === n.size && [...i].every((o) => n.has(o))))
|
|
426
435
|
this._logIssue(`Feature Layer '${e.itemId}' had its layer ids altered.`);
|
|
427
436
|
else
|
|
428
|
-
for (const
|
|
429
|
-
if (
|
|
430
|
-
const r = t.layers.find((
|
|
431
|
-
if (r && r.type !==
|
|
437
|
+
for (const o of e.layers) {
|
|
438
|
+
if (o.type) {
|
|
439
|
+
const r = t.layers.find((l) => l.id === o.id);
|
|
440
|
+
if (r && r.type !== o.type)
|
|
432
441
|
if (this.newDesign) {
|
|
433
|
-
const
|
|
434
|
-
r.type =
|
|
442
|
+
const l = r.type;
|
|
443
|
+
r.type = o.type, this._logAutoFix(`Layer '${o.id}' type '${l}' is immutable. Auto-fixed back to template type '${o.type}'.`);
|
|
435
444
|
} else
|
|
436
|
-
this._logIssue(`Layer '${
|
|
445
|
+
this._logIssue(`Layer '${o.id}' type '${r.type}' does not match template type '${o.type}'. This layer type is immutable.`);
|
|
437
446
|
}
|
|
438
|
-
const
|
|
439
|
-
|
|
447
|
+
const a = t.layers.find((r) => r.id === o.id);
|
|
448
|
+
a && this._validateRequiredFields(a, o);
|
|
440
449
|
}
|
|
441
450
|
}
|
|
442
451
|
}
|
|
@@ -453,12 +462,12 @@ class x {
|
|
|
453
462
|
e.requiredFields.map((n) => [n.name.toLowerCase(), n])
|
|
454
463
|
);
|
|
455
464
|
for (const n of t.requiredFields) {
|
|
456
|
-
const
|
|
457
|
-
if (!
|
|
465
|
+
const o = i.get(n.name.toLowerCase());
|
|
466
|
+
if (!o) {
|
|
458
467
|
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
468
|
continue;
|
|
460
469
|
}
|
|
461
|
-
this._enforceRequiredFieldImmutability(e,
|
|
470
|
+
this._enforceRequiredFieldImmutability(e, o, n);
|
|
462
471
|
}
|
|
463
472
|
}
|
|
464
473
|
/**
|
|
@@ -470,8 +479,8 @@ class x {
|
|
|
470
479
|
const n = [];
|
|
471
480
|
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
481
|
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 ${
|
|
482
|
+
const o = n.length === 1 ? "property" : "properties";
|
|
483
|
+
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
484
|
}
|
|
476
485
|
/**
|
|
477
486
|
* Set-based equality check for two choiceList values (order-insensitive),
|
|
@@ -483,8 +492,8 @@ class x {
|
|
|
483
492
|
return !0;
|
|
484
493
|
if (i === null || n === null)
|
|
485
494
|
return !1;
|
|
486
|
-
const
|
|
487
|
-
return
|
|
495
|
+
const o = new Set(i), a = new Set(n);
|
|
496
|
+
return o.size === a.size && [...o].every((r) => a.has(r));
|
|
488
497
|
}
|
|
489
498
|
//--------------------------------------------------------------------------
|
|
490
499
|
//
|
|
@@ -497,14 +506,14 @@ class x {
|
|
|
497
506
|
_validateSolutionProps() {
|
|
498
507
|
const e = this.response.solution.title ?? "", t = this.response.solution.description, i = /[/\\]/u.test(e), n = this.newDesign ? e.replace(/[/\\]/gu, "") : e;
|
|
499
508
|
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
|
-
|
|
509
|
+
const o = J(n);
|
|
510
|
+
if (o.isValid || this._tryFixName(o.errorType, n, (a) => {
|
|
511
|
+
this.response.solution.title = a;
|
|
512
|
+
}, "Solution title", "Solution Title") || this._logIssue(`Solution title is invalid (${o.errorType}).`), t) {
|
|
513
|
+
const a = H(t, x.DESCRIPTION_MAX_LENGTH, !0);
|
|
514
|
+
a.isValid || this._tryFixDescription(t, (r) => {
|
|
506
515
|
this.response.solution.description = r;
|
|
507
|
-
}, "Solution description") || this._logIssue(`Solution description is invalid (${
|
|
516
|
+
}, "Solution description") || this._logIssue(`Solution description is invalid (${a.errorType}).`);
|
|
508
517
|
}
|
|
509
518
|
}
|
|
510
519
|
/**
|
|
@@ -541,8 +550,8 @@ class x {
|
|
|
541
550
|
for (const i of e) {
|
|
542
551
|
const n = (i.name ?? "").toLowerCase();
|
|
543
552
|
if (t.has(n)) {
|
|
544
|
-
const
|
|
545
|
-
i.name = this._makeUniqueName(i.name ?? "Layer", t), this._logAutoFix(`Duplicate layer name '${
|
|
553
|
+
const o = i.name;
|
|
554
|
+
i.name = this._makeUniqueName(i.name ?? "Layer", t), this._logAutoFix(`Duplicate layer name '${o}'. Auto-fixed to '${i.name}'.`);
|
|
546
555
|
}
|
|
547
556
|
t.add(i.name.toLowerCase());
|
|
548
557
|
}
|
|
@@ -559,8 +568,8 @@ class x {
|
|
|
559
568
|
e.name = n;
|
|
560
569
|
}, `Layer '${e.name}' name`, "Layer Title") || this._logIssue(`Layer '${e.name}' name is invalid (${i.errorType}).`), e.description) {
|
|
561
570
|
const n = H(e.description, x.DESCRIPTION_MAX_LENGTH, !0);
|
|
562
|
-
n.isValid || this._tryFixDescription(e.description, (
|
|
563
|
-
e.description =
|
|
571
|
+
n.isValid || this._tryFixDescription(e.description, (o) => {
|
|
572
|
+
e.description = o;
|
|
564
573
|
}, `Layer '${e.name}' description`) || this._logIssue(`Layer '${e.name}' description is invalid (${n.errorType}).`);
|
|
565
574
|
}
|
|
566
575
|
this._validateLayerFields(e);
|
|
@@ -577,23 +586,23 @@ class x {
|
|
|
577
586
|
_validateLayerFields(e) {
|
|
578
587
|
const t = e.systemFields ?? [];
|
|
579
588
|
this.fieldNameRegistry = new Set(
|
|
580
|
-
[...e.customFields, ...e.requiredFields, ...t].map((
|
|
589
|
+
[...e.customFields, ...e.requiredFields, ...t].map((o) => o.name.toLowerCase())
|
|
581
590
|
);
|
|
582
|
-
for (const
|
|
583
|
-
this._validateField(
|
|
591
|
+
for (const o of [...e.customFields, ...e.requiredFields])
|
|
592
|
+
this._validateField(o);
|
|
584
593
|
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(
|
|
594
|
+
const i = new Set(e.requiredFields.map((o) => o.name.toLowerCase())), n = new Set(i);
|
|
595
|
+
for (const o of e.customFields) {
|
|
596
|
+
const a = o.name.toLowerCase();
|
|
597
|
+
if (n.has(a)) {
|
|
598
|
+
const r = i.has(a) ? "a required field name" : "another field with the same name";
|
|
590
599
|
if (this.newDesign) {
|
|
591
|
-
const
|
|
592
|
-
|
|
600
|
+
const l = o.name;
|
|
601
|
+
o.name = this._makeUniqueName(o.name, n), this._logAutoFix(`Layer '${e.name}' field '${l}' collided with ${r}. Auto-fixed to '${o.name}'.`);
|
|
593
602
|
} else
|
|
594
|
-
this._logIssue(`Layer '${e.name}' field '${
|
|
603
|
+
this._logIssue(`Layer '${e.name}' field '${o.name}' collides with ${r}.`);
|
|
595
604
|
}
|
|
596
|
-
n.add(
|
|
605
|
+
n.add(o.name.toLowerCase());
|
|
597
606
|
}
|
|
598
607
|
}
|
|
599
608
|
/**
|
|
@@ -601,37 +610,44 @@ class x {
|
|
|
601
610
|
*/
|
|
602
611
|
_validateField(e) {
|
|
603
612
|
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 || !
|
|
613
|
+
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).`));
|
|
614
|
+
const n = t.test(e.name), o = i.test(e.name);
|
|
615
|
+
if (!n || !o)
|
|
607
616
|
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 '${
|
|
617
|
+
const l = e.name;
|
|
618
|
+
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
619
|
} else
|
|
611
|
-
n || this._logIssue(`Field '${e.name}' does not start with a letter.`),
|
|
620
|
+
n || this._logIssue(`Field '${e.name}' does not start with a letter.`), o || this._logIssue(
|
|
612
621
|
`Field '${e.name}' contains invalid characters (only letters from any writing system, numbers, and underscores are allowed; emojis and punctuation are not allowed).`
|
|
613
622
|
);
|
|
614
623
|
if (e.name.length > x.FIELD_NAME_MAX_LENGTH)
|
|
615
624
|
if (this.newDesign) {
|
|
616
|
-
const
|
|
617
|
-
e.name = this._getUniqueTruncatedFieldName(e.name, this.fieldNameRegistry), this.fieldNameRegistry.add(e.name.toLowerCase()), this._logAutoFix(`Field '${
|
|
625
|
+
const l = e.name;
|
|
626
|
+
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
627
|
} else
|
|
619
628
|
this._logIssue(`Field '${e.name}' exceeds ${x.FIELD_NAME_MAX_LENGTH} characters.`);
|
|
620
|
-
if (
|
|
629
|
+
if (Ve.has(e.name.toLowerCase()))
|
|
621
630
|
if (this.newDesign) {
|
|
622
|
-
const
|
|
623
|
-
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 SQL reserved keyword. Auto-fixing to '${e.name}'.`);
|
|
624
633
|
} else
|
|
625
634
|
this._logIssue(`Field '${e.name}' is a SQL reserved keyword.`);
|
|
626
|
-
if (
|
|
635
|
+
if (Qe.has(e.name.toLowerCase()))
|
|
627
636
|
if (this.newDesign) {
|
|
628
|
-
const
|
|
629
|
-
e.name = this._getUniqueTruncatedFieldName(
|
|
637
|
+
const l = e.name;
|
|
638
|
+
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
639
|
} else
|
|
631
640
|
this._logIssue(`Field '${e.name}' is a reserved system field name.`);
|
|
641
|
+
const a = e.type ?? "", r = a.toLowerCase();
|
|
642
|
+
if (a !== r && (e.type = r), !x.ALLOWED_FIELD_TYPES.has(r))
|
|
643
|
+
if (this.newDesign) {
|
|
644
|
+
const l = e.type;
|
|
645
|
+
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}'.`);
|
|
646
|
+
} else
|
|
647
|
+
this._logIssue(`Field '${e.name}' has unsupported type '${e.type}'. Allowed types are: string, integer, double, date.`);
|
|
632
648
|
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
|
-
|
|
649
|
+
const l = Math.max(...e.choiceList.map((d) => d.length));
|
|
650
|
+
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
651
|
}
|
|
636
652
|
}
|
|
637
653
|
/**
|
|
@@ -640,7 +656,7 @@ class x {
|
|
|
640
656
|
*/
|
|
641
657
|
_autoFixChoiceList(e) {
|
|
642
658
|
let t = e.choiceList;
|
|
643
|
-
const i = t.filter((
|
|
659
|
+
const i = t.filter((o) => o?.trim());
|
|
644
660
|
i.length !== t.length && (this._logAutoFix(`Field '${e.name}' had blank domain values. Auto-fixed by removing them.`), t = i, e.choiceList = t);
|
|
645
661
|
const n = [...new Set(t)];
|
|
646
662
|
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);
|
|
@@ -700,12 +716,12 @@ class x {
|
|
|
700
716
|
*/
|
|
701
717
|
_getUniqueTruncatedFieldName(e, t) {
|
|
702
718
|
const i = x.FIELD_NAME_MAX_LENGTH, n = e.slice(0, i);
|
|
703
|
-
let
|
|
704
|
-
for (; t.has(
|
|
705
|
-
const r = `_${
|
|
706
|
-
|
|
719
|
+
let o = n, a = 1;
|
|
720
|
+
for (; t.has(o.toLowerCase()); ) {
|
|
721
|
+
const r = `_${a}`, l = Math.max(1, i - r.length);
|
|
722
|
+
o = `${n.slice(0, l)}${r}`, a += 1;
|
|
707
723
|
}
|
|
708
|
-
return
|
|
724
|
+
return o;
|
|
709
725
|
}
|
|
710
726
|
/**
|
|
711
727
|
* Sanitizes an item-style name by stripping emojis and disallowed characters,
|
|
@@ -713,7 +729,7 @@ class x {
|
|
|
713
729
|
* May return an empty string when no valid characters remain.
|
|
714
730
|
*/
|
|
715
731
|
_sanitizeItemName(e, t = x.NAME_MAX_LENGTH) {
|
|
716
|
-
let i = (e ?? "").replace(new RegExp(
|
|
732
|
+
let i = (e ?? "").replace(new RegExp(We.source, "gu"), "").replace(x.INVALID_NAME_CHARS, "").replace(/\s+/gu, " ").trim();
|
|
717
733
|
return i.length > t && (i = i.slice(0, t).trim()), i;
|
|
718
734
|
}
|
|
719
735
|
/**
|
|
@@ -737,12 +753,12 @@ class x {
|
|
|
737
753
|
* (or values that sanitize to empty) fall back to the supplied placeholder.
|
|
738
754
|
* Returns true when fixed.
|
|
739
755
|
*/
|
|
740
|
-
_tryFixName(e, t, i, n,
|
|
756
|
+
_tryFixName(e, t, i, n, o) {
|
|
741
757
|
if (!this.newDesign)
|
|
742
758
|
return !1;
|
|
743
759
|
if (e === "empty")
|
|
744
|
-
return i(
|
|
745
|
-
const r = this._sanitizeItemName(t) ||
|
|
760
|
+
return i(o), this._logAutoFix(`${n} was empty. Auto-fixed to '${o}'.`), !0;
|
|
761
|
+
const r = this._sanitizeItemName(t) || o;
|
|
746
762
|
return i(r), this._logAutoFix(`${n} was invalid (${e}). Auto-fixed to '${r}'.`), !0;
|
|
747
763
|
}
|
|
748
764
|
/**
|
|
@@ -768,15 +784,15 @@ class x {
|
|
|
768
784
|
console.debug(e), this.issues.push(e), this.isValid = !1;
|
|
769
785
|
}
|
|
770
786
|
}
|
|
771
|
-
const yt =
|
|
772
|
-
key:
|
|
773
|
-
value:
|
|
774
|
-
description:
|
|
775
|
-
}), bt =
|
|
776
|
-
id:
|
|
777
|
-
title:
|
|
778
|
-
description:
|
|
779
|
-
type:
|
|
787
|
+
const yt = c.object({
|
|
788
|
+
key: c.string().describe("Stable key identifier for the string."),
|
|
789
|
+
value: c.string().describe("Display value for the string."),
|
|
790
|
+
description: c.string().describe("Explanation of where/how the string is used.")
|
|
791
|
+
}), bt = c.object({
|
|
792
|
+
id: c.string().describe("ArcGIS item id (32 hex characters)."),
|
|
793
|
+
title: c.string().describe("Item title."),
|
|
794
|
+
description: c.string().describe("Item description."),
|
|
795
|
+
type: c.enum([
|
|
780
796
|
"Feature Layer (hosted)",
|
|
781
797
|
"Feature Layer (hosted, view)",
|
|
782
798
|
"Web Map",
|
|
@@ -795,92 +811,92 @@ const yt = l.object({
|
|
|
795
811
|
"Notebook",
|
|
796
812
|
"QuickCapture Project"
|
|
797
813
|
]).describe("ArcGIS item type.")
|
|
798
|
-
}), ue =
|
|
799
|
-
name:
|
|
800
|
-
type:
|
|
801
|
-
alias:
|
|
802
|
-
description:
|
|
803
|
-
choiceList:
|
|
814
|
+
}), ue = c.object({
|
|
815
|
+
name: c.string().describe("Field name."),
|
|
816
|
+
type: c.enum(["string", "integer", "double", "date", "oid", "guid", "globalid"]).describe("Field data type."),
|
|
817
|
+
alias: c.string().describe("Field alias for display."),
|
|
818
|
+
description: c.string().describe("Field description."),
|
|
819
|
+
choiceList: c.array(c.string()).nullable().describe(
|
|
804
820
|
"List of allowed values for string fields with a controlled vocabulary. Null if unrestricted or not applicable."
|
|
805
821
|
),
|
|
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:
|
|
822
|
+
length: c.number().int().nullable().describe("Maximum string length for string fields. Null for non-string fields.")
|
|
823
|
+
}), xt = c.object({
|
|
824
|
+
id: c.number().int().describe("Layer/table id within the feature service."),
|
|
825
|
+
type: c.enum(["Point", "Polyline", "Polygon", "Table"]).describe("Layer type."),
|
|
826
|
+
typeMutable: c.boolean().describe("Indicates whether the layer type can be changed."),
|
|
827
|
+
name: c.string().describe("Layer/table name."),
|
|
828
|
+
description: c.string().describe("Layer/table description."),
|
|
829
|
+
customFields: c.array(ue).describe("User/business fields specific to the solution."),
|
|
830
|
+
requiredFields: c.array(ue).describe("Fields required for solution functionality (e.g., relationship keys).")
|
|
831
|
+
}), vt = c.object({
|
|
832
|
+
itemId: c.string().describe("ArcGIS item id for the feature layer."),
|
|
833
|
+
addLayers: c.boolean().describe("Indicates whether new layers can be added during solution design."),
|
|
834
|
+
layers: c.array(xt)
|
|
835
|
+
}), Z = c.object({
|
|
836
|
+
response: c.string().describe("Conversational response to the user's query."),
|
|
837
|
+
solution: c.object({
|
|
838
|
+
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."),
|
|
839
|
+
title: c.string().describe("Title of the solution."),
|
|
840
|
+
description: c.string().describe("Description of the solution."),
|
|
841
|
+
tags: c.array(c.string()).describe("Keywords/tags associated with the solution."),
|
|
842
|
+
strings: c.array(yt).describe("Localized strings/labels used by apps (dashboards, forms, etc.).")
|
|
827
843
|
}),
|
|
828
|
-
items:
|
|
844
|
+
items: c.array(bt).describe("ArcGIS items that belong to the solution (apps, maps, layers, etc.)."),
|
|
829
845
|
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
|
-
}),
|
|
839
|
-
response:
|
|
840
|
-
}),
|
|
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.",
|
|
846
|
+
}), _t = c.object({
|
|
847
|
+
op: c.enum(["add", "remove", "replace", "move", "copy"]).describe("RFC 6902 operation type."),
|
|
848
|
+
path: c.string().describe("RFC 6901 JSON Pointer to the target location."),
|
|
849
|
+
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.`),
|
|
850
|
+
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.")
|
|
851
|
+
}), wt = c.object({
|
|
852
|
+
response: c.string().describe("Conversational response describing the accepted design changes."),
|
|
853
|
+
patches: c.array(_t).describe("Minimal RFC 6902 patch operations needed to update the current design.")
|
|
854
|
+
}), It = c.object({
|
|
855
|
+
response: c.string().describe("Short, user-friendly explanation of why the requested update was not applied.")
|
|
856
|
+
}), St = c.object({
|
|
857
|
+
assistantResponse: c.string().describe("Natural-language response for the user."),
|
|
858
|
+
isValidUpdate: c.boolean().describe("True only when the request is in scope for supported design updates.")
|
|
859
|
+
}), At = c.object({
|
|
860
|
+
matchedTitles: c.array(c.string()).describe("Titles of solutions that match the user's request. Empty array if no strong match.")
|
|
861
|
+
}), Ct = c.object({
|
|
862
|
+
templateId: c.string().min(1).describe("Template id from the available template list."),
|
|
863
|
+
confidence: c.number().min(0).max(1).describe("Confidence score from 0 to 1 for this template match."),
|
|
864
|
+
templateDescription: c.string().min(1).describe("Short action‑oriented description of the template in the user's use case/workflow, starting with a verb.")
|
|
865
|
+
}), Tt = c.object({
|
|
866
|
+
assistantResponse: c.string().nullable().describe("Natural-language response for the user."),
|
|
867
|
+
isValidUseCase: c.boolean().describe("True only when the request is concrete, appropriate, and has at least one matching template."),
|
|
868
|
+
matchedTemplates: c.array(Ct).describe("Ordered list of matching templates, best match first. Empty when no valid match exists.")
|
|
869
|
+
}), Lt = (s) => s.length ? s.map((e, t) => `${t + 1}. ${e}`).join(`
|
|
870
|
+
`) : "No validation errors were provided.", Et = async (s) => {
|
|
855
871
|
const {
|
|
856
872
|
query: e,
|
|
857
873
|
validationIssues: t,
|
|
858
874
|
recentMessages: i,
|
|
859
875
|
fallbackMessage: n,
|
|
860
|
-
promptModules:
|
|
876
|
+
promptModules: o
|
|
861
877
|
} = s;
|
|
862
878
|
try {
|
|
863
|
-
return (await
|
|
864
|
-
promptText: await v(
|
|
879
|
+
return (await C({
|
|
880
|
+
promptText: await v(o, "explainValidationFailure"),
|
|
865
881
|
modelTier: "fast",
|
|
866
882
|
temperature: 0,
|
|
867
|
-
schema:
|
|
883
|
+
schema: It,
|
|
868
884
|
messages: i,
|
|
869
885
|
inputVariables: {
|
|
870
886
|
query: e,
|
|
871
887
|
validationIssueCount: String(t.length),
|
|
872
|
-
validationIssues:
|
|
888
|
+
validationIssues: Lt(t)
|
|
873
889
|
}
|
|
874
890
|
})).response?.trim() || n;
|
|
875
|
-
} catch (
|
|
891
|
+
} catch (a) {
|
|
876
892
|
return console.warn(
|
|
877
893
|
"Natural language response failed:",
|
|
878
|
-
{ error:
|
|
894
|
+
{ error: a }
|
|
879
895
|
), n;
|
|
880
896
|
}
|
|
881
|
-
}, ee = (s) => s in
|
|
897
|
+
}, ee = (s) => s in N, $t = 5, kt = 0.8, Ft = 0.5, Nt = "Web Mapping Application", Dt = "Embeddings";
|
|
882
898
|
let R = null, V = null, P = null, B = null;
|
|
883
|
-
const Mt = "Build",
|
|
899
|
+
const Mt = "Build", $ = /* @__PURE__ */ Object.assign({
|
|
884
900
|
"./prompts/assessBuildRequest.md": () => import("../../chunks/assessBuildRequest.js").then((s) => s.default),
|
|
885
901
|
"./prompts/assessUpdateRequest.md": () => import("../../chunks/assessUpdateRequest.js").then((s) => s.default),
|
|
886
902
|
"./prompts/description.md": () => import("../../chunks/description2.js").then((s) => s.default),
|
|
@@ -888,13 +904,13 @@ const Mt = "Build", L = /* @__PURE__ */ Object.assign({
|
|
|
888
904
|
"./prompts/explainValidationFailure.md": () => import("../../chunks/explainValidationFailure.js").then((s) => s.default),
|
|
889
905
|
"./prompts/findExistingSolution.md": () => import("../../chunks/findExistingSolution.js").then((s) => s.default),
|
|
890
906
|
"./prompts/updateDesign.md": () => import("../../chunks/updateDesign.js").then((s) => s.default)
|
|
891
|
-
}), Rt = ft.builderMessages, m = (s) => s?.signal?.aborted ?? !1, f = (s, e, t) => U(e)?.builderMessages?.[s] ?? Rt[s],
|
|
907
|
+
}), Rt = ft.builderMessages, m = (s) => s?.signal?.aborted ?? !1, f = (s, e, t) => U(e)?.builderMessages?.[s] ?? Rt[s], Ie = (s) => {
|
|
892
908
|
typeof window < "u" && window.dispatchEvent(new CustomEvent("arcgis-solution-design-update", {
|
|
893
909
|
detail: s
|
|
894
910
|
}));
|
|
895
911
|
}, Pt = async (s, e, t) => {
|
|
896
912
|
if (!s) return null;
|
|
897
|
-
const i = `type:"${
|
|
913
|
+
const i = `type:"${Nt}" AND typekeywords:${Dt} AND group:${s}`;
|
|
898
914
|
return (await Y.searchItems({
|
|
899
915
|
q: i,
|
|
900
916
|
params: e ? { token: e } : void 0,
|
|
@@ -907,8 +923,8 @@ async function Bt(s, e, t, i) {
|
|
|
907
923
|
const n = await Pt(s, e, t);
|
|
908
924
|
if (!n || m(i))
|
|
909
925
|
return null;
|
|
910
|
-
const
|
|
911
|
-
return await
|
|
926
|
+
const o = new Ye({ id: n.id });
|
|
927
|
+
return await o.load(), m(i) ? null : await o.fetchData("json");
|
|
912
928
|
} catch {
|
|
913
929
|
return null;
|
|
914
930
|
}
|
|
@@ -929,8 +945,8 @@ const qt = async (s, e, t) => {
|
|
|
929
945
|
portal: t
|
|
930
946
|
}), n = i?.buildSolution;
|
|
931
947
|
if (!n) return null;
|
|
932
|
-
const
|
|
933
|
-
return { buildSolution: n, params:
|
|
948
|
+
const o = i?.params, a = o && typeof o == "object" && !Array.isArray(o) ? o : null;
|
|
949
|
+
return { buildSolution: n, params: a };
|
|
934
950
|
} catch {
|
|
935
951
|
return null;
|
|
936
952
|
}
|
|
@@ -966,53 +982,53 @@ const qt = async (s, e, t) => {
|
|
|
966
982
|
}
|
|
967
983
|
}, te = async (s) => {
|
|
968
984
|
if (V) {
|
|
969
|
-
Object.entries(V).forEach(([
|
|
970
|
-
|
|
985
|
+
Object.entries(V).forEach(([a, r]) => {
|
|
986
|
+
N[a] && (N[a].initialTemplate = r);
|
|
971
987
|
});
|
|
972
988
|
return;
|
|
973
989
|
}
|
|
974
|
-
const e = s?.configurable?.context?.token, t =
|
|
990
|
+
const e = s?.configurable?.context?.token, t = Ce(s), i = Te(s);
|
|
975
991
|
if (!t) {
|
|
976
992
|
console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping live template hydration.");
|
|
977
993
|
return;
|
|
978
994
|
}
|
|
979
|
-
const n = await qt(t, e, i),
|
|
980
|
-
m(s) || (await Promise.all(n.map(async (
|
|
981
|
-
const r =
|
|
995
|
+
const n = await qt(t, e, i), o = {};
|
|
996
|
+
m(s) || (await Promise.all(n.map(async (a) => {
|
|
997
|
+
const r = a.properties?.templateInfo;
|
|
982
998
|
if (!r || typeof r != "object") return;
|
|
983
|
-
const
|
|
984
|
-
if (typeof
|
|
985
|
-
const d = await Ut(
|
|
999
|
+
const l = r.id;
|
|
1000
|
+
if (typeof l != "string" || o[l]) return;
|
|
1001
|
+
const d = await Ut(a.id, e, i);
|
|
986
1002
|
if (!d || m(s))
|
|
987
1003
|
return;
|
|
988
1004
|
const { buildSolution: h, params: y } = d;
|
|
989
1005
|
if (typeof h == "object" && h !== null && "solution" in h) {
|
|
990
1006
|
const g = h.solution;
|
|
991
|
-
g.thumbnailUrl =
|
|
1007
|
+
g.thumbnailUrl = a.thumbnail ? `${i ?? "https://www.arcgis.com/sharing/rest"}/content/items/${a.id}/info/${a.thumbnail}` : void 0, g.item = a;
|
|
992
1008
|
}
|
|
993
1009
|
const u = {
|
|
994
1010
|
...r,
|
|
995
1011
|
buildSolution: h
|
|
996
1012
|
};
|
|
997
|
-
|
|
1013
|
+
o[l] = k(
|
|
998
1014
|
new pe(u).dumpToLlmTemplate(),
|
|
999
1015
|
{
|
|
1000
|
-
itemId:
|
|
1016
|
+
itemId: a.id,
|
|
1001
1017
|
sourceBuildSolution: structuredClone(h),
|
|
1002
1018
|
params: y ? structuredClone(y) : null
|
|
1003
1019
|
}
|
|
1004
|
-
),
|
|
1020
|
+
), N[l] = {
|
|
1005
1021
|
...r,
|
|
1006
|
-
initialTemplate:
|
|
1022
|
+
initialTemplate: o[l]
|
|
1007
1023
|
};
|
|
1008
|
-
})), V =
|
|
1009
|
-
},
|
|
1024
|
+
})), V = o);
|
|
1025
|
+
}, Ae = (s) => {
|
|
1010
1026
|
const e = s?.configurable?.context?.token;
|
|
1011
1027
|
return typeof e != "string" || !e.trim() ? null : e;
|
|
1012
|
-
},
|
|
1028
|
+
}, Ce = (s) => {
|
|
1013
1029
|
const e = s?.configurable?.context?.configContext?.primarySolutionsGroupId;
|
|
1014
1030
|
return typeof e != "string" || !e.trim() ? null : e;
|
|
1015
|
-
},
|
|
1031
|
+
}, Te = (s) => {
|
|
1016
1032
|
const e = s?.configurable?.context?.configContext?.portalURL;
|
|
1017
1033
|
if (!(typeof e != "string" || !e.trim()))
|
|
1018
1034
|
return `${e.replace(/\/+$/, "")}/sharing/rest`;
|
|
@@ -1021,24 +1037,24 @@ const qt = async (s, e, t) => {
|
|
|
1021
1037
|
Ee(s),
|
|
1022
1038
|
te(s)
|
|
1023
1039
|
]);
|
|
1024
|
-
},
|
|
1025
|
-
const e =
|
|
1040
|
+
}, Le = async (s) => {
|
|
1041
|
+
const e = Ae(s);
|
|
1026
1042
|
(!P || e && e !== B) && (B = e ?? B, P = Ot(s).catch((i) => {
|
|
1027
1043
|
throw P = null, B = null, i;
|
|
1028
1044
|
})), await P;
|
|
1029
1045
|
};
|
|
1030
1046
|
async function Ee(s) {
|
|
1031
1047
|
if (R) return R;
|
|
1032
|
-
const e =
|
|
1048
|
+
const e = Ce(s);
|
|
1033
1049
|
if (!e)
|
|
1034
1050
|
return console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping embeddings load."), null;
|
|
1035
|
-
const t =
|
|
1051
|
+
const t = Te(s), i = s?.configurable?.context?.configContext?.portalURL;
|
|
1036
1052
|
if (await new Xe(i ? { url: i } : void 0).load(), m(s))
|
|
1037
1053
|
return null;
|
|
1038
|
-
const
|
|
1039
|
-
return m(s) ? null :
|
|
1054
|
+
const o = Ae(s) ?? void 0, a = await Bt(e, o, t, s);
|
|
1055
|
+
return m(s) ? null : a ? (R = a.items, R) : null;
|
|
1040
1056
|
}
|
|
1041
|
-
const zt = () => Object.entries(
|
|
1057
|
+
const zt = () => Object.entries(N).map(([s, e]) => `ID: ${s}
|
|
1042
1058
|
Label: ${e.label}
|
|
1043
1059
|
Description: ${e.description}`).join(`
|
|
1044
1060
|
|
|
@@ -1053,12 +1069,12 @@ Description: ${e.description}`).join(`
|
|
|
1053
1069
|
), n = Z.safeParse(i);
|
|
1054
1070
|
if (!n.success)
|
|
1055
1071
|
return null;
|
|
1056
|
-
const { response:
|
|
1072
|
+
const { response: o, ...a } = n.data, r = t.templateId, l = typeof r == "string" && ee(r) ? r : null;
|
|
1057
1073
|
return k(
|
|
1058
|
-
|
|
1074
|
+
a,
|
|
1059
1075
|
{
|
|
1060
1076
|
sourceBuildSolution: t.sourceBuildSolution,
|
|
1061
|
-
templateId:
|
|
1077
|
+
templateId: l,
|
|
1062
1078
|
params: t.params ?? null
|
|
1063
1079
|
}
|
|
1064
1080
|
);
|
|
@@ -1110,20 +1126,20 @@ Description: ${e.description}`).join(`
|
|
|
1110
1126
|
}, Ht = async (s, e) => {
|
|
1111
1127
|
if (m(e))
|
|
1112
1128
|
return {};
|
|
1113
|
-
await w({ text: f("understandingRequest", e) }, e), await
|
|
1114
|
-
const t = s.agentExecutionContext.userRequest, i = zt(), n = s.agentExecutionContext.messages.slice(-11),
|
|
1115
|
-
promptText: await v(
|
|
1129
|
+
await w({ text: f("understandingRequest", e) }, e), await Le(e);
|
|
1130
|
+
const t = s.agentExecutionContext.userRequest, i = zt(), n = s.agentExecutionContext.messages.slice(-11), o = await C({
|
|
1131
|
+
promptText: await v($, "assessBuildRequest"),
|
|
1116
1132
|
modelTier: "advanced",
|
|
1117
1133
|
temperature: 0,
|
|
1118
1134
|
schema: Tt,
|
|
1119
1135
|
messages: n,
|
|
1120
1136
|
inputVariables: { query: t, availableTemplates: i }
|
|
1121
|
-
}),
|
|
1137
|
+
}), a = o.matchedTemplates.filter(
|
|
1122
1138
|
(u) => ee(u.templateId)
|
|
1123
1139
|
), r = {
|
|
1124
|
-
...
|
|
1125
|
-
matchedTemplates:
|
|
1126
|
-
}, [
|
|
1140
|
+
...o,
|
|
1141
|
+
matchedTemplates: a
|
|
1142
|
+
}, [l, d] = a, y = !!l && l.confidence >= kt && (d === void 0 || l.confidence - d.confidence >= Ft) ? l.templateId : null;
|
|
1127
1143
|
return {
|
|
1128
1144
|
assessment: r,
|
|
1129
1145
|
selectedTemplate: y,
|
|
@@ -1151,11 +1167,11 @@ Description: ${e.description}`).join(`
|
|
|
1151
1167
|
await w({ text: f("understandingRequest", e) }, e);
|
|
1152
1168
|
const i = s.agentExecutionContext.userRequest, n = s.agentExecutionContext.messages.slice(-11);
|
|
1153
1169
|
return {
|
|
1154
|
-
updateAssessment: await
|
|
1155
|
-
promptText: await v(
|
|
1170
|
+
updateAssessment: await C({
|
|
1171
|
+
promptText: await v($, "assessUpdateRequest"),
|
|
1156
1172
|
modelTier: "advanced",
|
|
1157
1173
|
temperature: 0,
|
|
1158
|
-
schema:
|
|
1174
|
+
schema: St,
|
|
1159
1175
|
messages: n,
|
|
1160
1176
|
inputVariables: {
|
|
1161
1177
|
currentDesign: JSON.stringify(me(t)),
|
|
@@ -1163,30 +1179,30 @@ Description: ${e.description}`).join(`
|
|
|
1163
1179
|
}
|
|
1164
1180
|
})
|
|
1165
1181
|
};
|
|
1166
|
-
},
|
|
1182
|
+
}, Wt = (s, e) => {
|
|
1167
1183
|
const t = s.updateAssessment?.assistantResponse ?? f("applyChangeFailed", e);
|
|
1168
1184
|
return {
|
|
1169
1185
|
outputMessage: t,
|
|
1170
1186
|
summary: t,
|
|
1171
1187
|
status: "success"
|
|
1172
1188
|
};
|
|
1173
|
-
},
|
|
1189
|
+
}, Kt = (s, e) => {
|
|
1174
1190
|
if (m(e))
|
|
1175
1191
|
return {};
|
|
1176
1192
|
const { hitlResponse: t } = e.configurable, i = "selectTemplate", n = s.assessment?.matchedTemplates.filter(
|
|
1177
1193
|
(d) => ee(d.templateId)
|
|
1178
|
-
) ?? [],
|
|
1194
|
+
) ?? [], o = n.map((d) => `${d.templateDescription}`);
|
|
1179
1195
|
if (t?.agentId !== "solutionBuilder" || t.id !== i) {
|
|
1180
1196
|
const d = {
|
|
1181
1197
|
agentId: "solutionBuilder",
|
|
1182
1198
|
id: i,
|
|
1183
1199
|
kind: "singleSelection",
|
|
1184
1200
|
message: f("selectTemplatePrompt", e),
|
|
1185
|
-
metadata: [...
|
|
1201
|
+
metadata: [...o]
|
|
1186
1202
|
};
|
|
1187
1203
|
throw new de(d);
|
|
1188
1204
|
}
|
|
1189
|
-
const
|
|
1205
|
+
const a = String(t.payload ?? ""), r = o.findIndex((d) => d === a);
|
|
1190
1206
|
return {
|
|
1191
1207
|
selectedTemplate: (r >= 0 ? n[r] : void 0)?.templateId ?? n[0]?.templateId ?? null
|
|
1192
1208
|
};
|
|
@@ -1201,29 +1217,29 @@ Description: ${e.description}`).join(`
|
|
|
1201
1217
|
return console.warn("Solutions Search: failed to load solution embeddings cache; skipping search."), { existingMatches: [] };
|
|
1202
1218
|
if (!n.length)
|
|
1203
1219
|
return { existingMatches: [] };
|
|
1204
|
-
const [
|
|
1220
|
+
const [o] = await je([i]);
|
|
1205
1221
|
if (m(e))
|
|
1206
1222
|
return {};
|
|
1207
|
-
const
|
|
1223
|
+
const a = n.map((u) => ({
|
|
1208
1224
|
solution: u,
|
|
1209
|
-
score:
|
|
1225
|
+
score: Ge(o, u.embedding)
|
|
1210
1226
|
}));
|
|
1211
|
-
|
|
1212
|
-
const r =
|
|
1227
|
+
a.sort((u, g) => g.score - u.score);
|
|
1228
|
+
const r = a.slice(0, $t);
|
|
1213
1229
|
if (!r.length)
|
|
1214
1230
|
return { existingMatches: [] };
|
|
1215
|
-
const
|
|
1231
|
+
const l = r.map(({ solution: u }) => `${u.title}
|
|
1216
1232
|
Snippet: ${u.snippet}
|
|
1217
1233
|
Description: ${u.description}`).join(`
|
|
1218
1234
|
|
|
1219
1235
|
`), d = s.agentExecutionContext.messages.slice(-11);
|
|
1220
|
-
return { existingMatches: (await
|
|
1221
|
-
promptText: await v(
|
|
1236
|
+
return { existingMatches: (await C({
|
|
1237
|
+
promptText: await v($, "findExistingSolution"),
|
|
1222
1238
|
modelTier: "fast",
|
|
1223
1239
|
temperature: 0,
|
|
1224
1240
|
schema: At,
|
|
1225
1241
|
messages: d,
|
|
1226
|
-
inputVariables: { query: t, candidates:
|
|
1242
|
+
inputVariables: { query: t, candidates: l }
|
|
1227
1243
|
})).matchedTitles.map((u) => r.find(({ solution: g }) => g.title === u)).filter((u) => u !== void 0) };
|
|
1228
1244
|
}, Yt = (s, e) => {
|
|
1229
1245
|
if (m(e))
|
|
@@ -1231,20 +1247,20 @@ Description: ${u.description}`).join(`
|
|
|
1231
1247
|
const { existingMatches: t } = s, { hitlResponse: i } = e.configurable, n = `confirmExistingSolution:${t[0].solution.id}`;
|
|
1232
1248
|
if (i?.agentId !== "solutionBuilder" || i.id !== n) {
|
|
1233
1249
|
t.length === 1 ? ye(t[0].solution.id) : fe(t);
|
|
1234
|
-
const
|
|
1250
|
+
const l = f("existingSolutionMatch", e), d = [
|
|
1235
1251
|
f("continueBuildingYes", e),
|
|
1236
1252
|
f("continueBuildingNo", e)
|
|
1237
1253
|
], h = {
|
|
1238
1254
|
agentId: "solutionBuilder",
|
|
1239
1255
|
id: n,
|
|
1240
1256
|
kind: "singleSelection",
|
|
1241
|
-
message:
|
|
1257
|
+
message: l,
|
|
1242
1258
|
metadata: d
|
|
1243
1259
|
};
|
|
1244
1260
|
throw new de(h);
|
|
1245
1261
|
}
|
|
1246
|
-
const
|
|
1247
|
-
return { continueBuilding:
|
|
1262
|
+
const o = String(i.payload ?? "").trim(), a = f("continueBuildingNo", e);
|
|
1263
|
+
return { continueBuilding: o !== a };
|
|
1248
1264
|
}, Zt = (s, e) => {
|
|
1249
1265
|
const t = f("continueBuildingDeclined", e);
|
|
1250
1266
|
return {
|
|
@@ -1252,10 +1268,10 @@ Description: ${u.description}`).join(`
|
|
|
1252
1268
|
summary: t,
|
|
1253
1269
|
status: "success"
|
|
1254
1270
|
};
|
|
1255
|
-
},
|
|
1271
|
+
}, $e = async (s, e) => {
|
|
1256
1272
|
if (m(e))
|
|
1257
1273
|
return {};
|
|
1258
|
-
if (await
|
|
1274
|
+
if (await Le(e), m(e))
|
|
1259
1275
|
return {};
|
|
1260
1276
|
const { currentDesign: t } = s, i = s.agentExecutionContext.userRequest;
|
|
1261
1277
|
await w({ text: f("creatingDesign", e) }, e);
|
|
@@ -1264,37 +1280,37 @@ Description: ${u.description}`).join(`
|
|
|
1264
1280
|
return {};
|
|
1265
1281
|
if (!n?.initialTemplate)
|
|
1266
1282
|
throw new Error("No hydrated templates are available for solution design.");
|
|
1267
|
-
const
|
|
1283
|
+
const o = k(
|
|
1268
1284
|
t ?? n.initialTemplate,
|
|
1269
1285
|
{
|
|
1270
1286
|
itemId: (t ?? n.initialTemplate)?.solution?.itemId ?? null,
|
|
1271
1287
|
sourceBuildSolution: t?.sourceBuildSolution ?? n.initialTemplate.sourceBuildSolution,
|
|
1272
1288
|
params: t?.params ?? n.initialTemplate.params ?? null
|
|
1273
1289
|
}
|
|
1274
|
-
),
|
|
1275
|
-
promptText: await v(
|
|
1290
|
+
), a = s.agentExecutionContext.messages.slice(-11), r = await C({
|
|
1291
|
+
promptText: await v($, "designSolution"),
|
|
1276
1292
|
modelTier: "advanced",
|
|
1277
1293
|
temperature: 0,
|
|
1278
1294
|
schema: Z,
|
|
1279
|
-
messages:
|
|
1295
|
+
messages: a,
|
|
1280
1296
|
inputVariables: {
|
|
1281
|
-
currentDesign: JSON.stringify(he(
|
|
1297
|
+
currentDesign: JSON.stringify(he(o)),
|
|
1282
1298
|
templateInstructions: n.instructions,
|
|
1283
1299
|
query: i
|
|
1284
1300
|
}
|
|
1285
1301
|
});
|
|
1286
1302
|
if (await w({ text: " of design solution 1" }, e), m(e))
|
|
1287
1303
|
return {};
|
|
1288
|
-
const { response:
|
|
1304
|
+
const { response: l, featureLayer: d, ...h } = r, y = ge(
|
|
1289
1305
|
d,
|
|
1290
|
-
|
|
1306
|
+
o.featureLayer
|
|
1291
1307
|
), u = k(
|
|
1292
1308
|
{ ...h, featureLayer: y },
|
|
1293
1309
|
{
|
|
1294
|
-
itemId:
|
|
1295
|
-
sourceBuildSolution:
|
|
1310
|
+
itemId: o?.solution?.itemId,
|
|
1311
|
+
sourceBuildSolution: o.sourceBuildSolution,
|
|
1296
1312
|
templateId: s.selectedTemplate ?? null,
|
|
1297
|
-
params:
|
|
1313
|
+
params: o.params ?? null
|
|
1298
1314
|
}
|
|
1299
1315
|
), g = new x(u, n.initialTemplate);
|
|
1300
1316
|
if (!g.isValid)
|
|
@@ -1304,22 +1320,22 @@ Description: ${u.description}`).join(`
|
|
|
1304
1320
|
), {
|
|
1305
1321
|
outputMessage: f("createDesignFailed", e)
|
|
1306
1322
|
};
|
|
1307
|
-
const
|
|
1308
|
-
if (!
|
|
1323
|
+
const I = u.sourceBuildSolution, F = Se(u, I);
|
|
1324
|
+
if (!F.ok) {
|
|
1309
1325
|
console.warn(
|
|
1310
1326
|
"[SolutionBuilder] designSolution Esri JSON conversion failed:",
|
|
1311
|
-
{ error:
|
|
1327
|
+
{ error: F.error, llmResponse: r, design: u }
|
|
1312
1328
|
);
|
|
1313
|
-
const
|
|
1329
|
+
const T = f("createDesignFailed", e);
|
|
1314
1330
|
return {
|
|
1315
|
-
outputMessage:
|
|
1316
|
-
summary:
|
|
1331
|
+
outputMessage: T,
|
|
1332
|
+
summary: T,
|
|
1317
1333
|
status: "success"
|
|
1318
1334
|
};
|
|
1319
1335
|
}
|
|
1320
|
-
return m(e) ? {} : (
|
|
1321
|
-
outputMessage:
|
|
1322
|
-
summary:
|
|
1336
|
+
return m(e) ? {} : (Ie(u), {
|
|
1337
|
+
outputMessage: l,
|
|
1338
|
+
summary: l,
|
|
1323
1339
|
status: "success",
|
|
1324
1340
|
currentDesign: u
|
|
1325
1341
|
});
|
|
@@ -1328,13 +1344,13 @@ Description: ${u.description}`).join(`
|
|
|
1328
1344
|
return {};
|
|
1329
1345
|
const { currentDesign: t } = s;
|
|
1330
1346
|
if (!t)
|
|
1331
|
-
return
|
|
1347
|
+
return $e(s, e);
|
|
1332
1348
|
const i = s.agentExecutionContext.userRequest, n = s.agentExecutionContext.messages.slice(-11);
|
|
1333
1349
|
await w({ text: f("updatingDesign", e) }, e);
|
|
1334
|
-
let
|
|
1350
|
+
let o;
|
|
1335
1351
|
try {
|
|
1336
|
-
|
|
1337
|
-
promptText: await v(
|
|
1352
|
+
o = await C({
|
|
1353
|
+
promptText: await v($, "updateDesign"),
|
|
1338
1354
|
modelTier: "advanced",
|
|
1339
1355
|
temperature: 0,
|
|
1340
1356
|
schema: wt,
|
|
@@ -1353,14 +1369,14 @@ Description: ${u.description}`).join(`
|
|
|
1353
1369
|
status: "success"
|
|
1354
1370
|
};
|
|
1355
1371
|
}
|
|
1356
|
-
const { response:
|
|
1372
|
+
const { response: a, patches: r } = o;
|
|
1357
1373
|
if (!r || r.length === 0)
|
|
1358
1374
|
return {
|
|
1359
|
-
outputMessage:
|
|
1360
|
-
summary:
|
|
1375
|
+
outputMessage: a,
|
|
1376
|
+
summary: a,
|
|
1361
1377
|
status: "success"
|
|
1362
1378
|
};
|
|
1363
|
-
const
|
|
1379
|
+
const l = (p) => {
|
|
1364
1380
|
try {
|
|
1365
1381
|
return JSON.parse(p);
|
|
1366
1382
|
} catch {
|
|
@@ -1390,17 +1406,17 @@ Description: ${u.description}`).join(`
|
|
|
1390
1406
|
}, h = [...r.map((p) => ({
|
|
1391
1407
|
op: p.op,
|
|
1392
1408
|
path: p.path.replace(/\/+$/, ""),
|
|
1393
|
-
...p.value != null && p.value !== "" ? { value:
|
|
1409
|
+
...p.value != null && p.value !== "" ? { value: l(p.value) } : {},
|
|
1394
1410
|
...p.from != null && p.from !== "" ? { from: p.from } : {}
|
|
1395
1411
|
}))].sort((p, _) => p.op !== "remove" || _.op !== "remove" ? 0 : _.path.localeCompare(p.path, void 0, { numeric: !0 })), y = structuredClone(
|
|
1396
1412
|
he(t)
|
|
1397
1413
|
);
|
|
1398
1414
|
try {
|
|
1399
|
-
|
|
1415
|
+
He(y, h, !0);
|
|
1400
1416
|
} catch (p) {
|
|
1401
1417
|
console.warn(
|
|
1402
1418
|
"[SolutionBuilder] updateDesign JSON patch failed:",
|
|
1403
|
-
{ error: p, llmResponse:
|
|
1419
|
+
{ error: p, llmResponse: o, patches: h, patchTarget: y }
|
|
1404
1420
|
);
|
|
1405
1421
|
const _ = f("applyChangeFailed", e);
|
|
1406
1422
|
return {
|
|
@@ -1416,7 +1432,7 @@ Description: ${u.description}`).join(`
|
|
|
1416
1432
|
if (!g.success) {
|
|
1417
1433
|
console.warn(
|
|
1418
1434
|
"[SolutionBuilder] updateDesign schema validation failed:",
|
|
1419
|
-
{ errors: g.error.issues, llmResponse:
|
|
1435
|
+
{ errors: g.error.issues, llmResponse: o, patchedDesign: u }
|
|
1420
1436
|
);
|
|
1421
1437
|
const p = f("applyChangeFailed", e);
|
|
1422
1438
|
return {
|
|
@@ -1425,11 +1441,11 @@ Description: ${u.description}`).join(`
|
|
|
1425
1441
|
status: "success"
|
|
1426
1442
|
};
|
|
1427
1443
|
}
|
|
1428
|
-
const { response:
|
|
1429
|
-
|
|
1444
|
+
const { response: I, featureLayer: F, ...T } = g.data, z = ge(
|
|
1445
|
+
F,
|
|
1430
1446
|
t.featureLayer
|
|
1431
|
-
),
|
|
1432
|
-
{ ...
|
|
1447
|
+
), S = k(
|
|
1448
|
+
{ ...T, featureLayer: z },
|
|
1433
1449
|
{
|
|
1434
1450
|
itemId: t.solution?.itemId,
|
|
1435
1451
|
sourceBuildSolution: t.sourceBuildSolution,
|
|
@@ -1442,18 +1458,18 @@ Description: ${u.description}`).join(`
|
|
|
1442
1458
|
return {};
|
|
1443
1459
|
if (!D?.initialTemplate)
|
|
1444
1460
|
throw new Error("No hydrated templates are available for solution design.");
|
|
1445
|
-
const j = new x(
|
|
1461
|
+
const j = new x(S, D.initialTemplate, !1);
|
|
1446
1462
|
if (!j.isValid) {
|
|
1447
1463
|
console.warn(
|
|
1448
1464
|
"[SolutionBuilder] updateDesign validation failed:",
|
|
1449
|
-
{ issues: j.issues, llmResponse:
|
|
1465
|
+
{ issues: j.issues, llmResponse: o, patchedDesign: S }
|
|
1450
1466
|
);
|
|
1451
|
-
const p = await
|
|
1467
|
+
const p = await Et({
|
|
1452
1468
|
query: i,
|
|
1453
1469
|
validationIssues: j.issues,
|
|
1454
1470
|
recentMessages: n,
|
|
1455
1471
|
fallbackMessage: f("applyChangeFailed", e),
|
|
1456
|
-
promptModules:
|
|
1472
|
+
promptModules: $
|
|
1457
1473
|
});
|
|
1458
1474
|
return {
|
|
1459
1475
|
outputMessage: p,
|
|
@@ -1461,11 +1477,11 @@ Description: ${u.description}`).join(`
|
|
|
1461
1477
|
status: "success"
|
|
1462
1478
|
};
|
|
1463
1479
|
}
|
|
1464
|
-
const
|
|
1480
|
+
const Fe = S.sourceBuildSolution, ne = Se(S, Fe);
|
|
1465
1481
|
if (!ne.ok) {
|
|
1466
1482
|
console.warn(
|
|
1467
1483
|
"[SolutionBuilder] updateDesign Esri JSON conversion failed:",
|
|
1468
|
-
{ error: ne.error, llmResponse:
|
|
1484
|
+
{ error: ne.error, llmResponse: o, design: S }
|
|
1469
1485
|
);
|
|
1470
1486
|
const p = f("applyChangeFailed", e);
|
|
1471
1487
|
return {
|
|
@@ -1474,13 +1490,13 @@ Description: ${u.description}`).join(`
|
|
|
1474
1490
|
status: "success"
|
|
1475
1491
|
};
|
|
1476
1492
|
}
|
|
1477
|
-
return m(e) ? {} : (
|
|
1478
|
-
outputMessage:
|
|
1479
|
-
summary:
|
|
1493
|
+
return m(e) ? {} : (Ie(S), {
|
|
1494
|
+
outputMessage: a,
|
|
1495
|
+
summary: a,
|
|
1480
1496
|
status: "success",
|
|
1481
|
-
currentDesign:
|
|
1497
|
+
currentDesign: S
|
|
1482
1498
|
});
|
|
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
|
|
1499
|
+
}, 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", $e).addNode("updateDesign", es).addEdge(K, "syncCurrentDesignFromContext").addConditionalEdges("syncCurrentDesignFromContext", ts, {
|
|
1484
1500
|
assessUpdateRequest: "assessUpdateRequest",
|
|
1485
1501
|
assessBuildRequest: "assessBuildRequest"
|
|
1486
1502
|
}).addConditionalEdges("assessUpdateRequest", ss, {
|
|
@@ -1497,7 +1513,7 @@ Description: ${u.description}`).join(`
|
|
|
1497
1513
|
declineContinueBuildingExit: "declineContinueBuildingExit",
|
|
1498
1514
|
designSolution: "designSolution"
|
|
1499
1515
|
}).addEdge("declineContinueBuildingExit", A).addEdge("designSolution", A).addEdge("updateDesign", A);
|
|
1500
|
-
await v(
|
|
1516
|
+
await v($, "description");
|
|
1501
1517
|
const rs = E.object({
|
|
1502
1518
|
tool: E.enum(["explorer", "builder", "other"]).describe("The selected tool based on the user’s intent using the conversation context."),
|
|
1503
1519
|
confidence: E.number().min(0).max(1).describe("A confidence score (0.00–1.00)."),
|
|
@@ -1541,17 +1557,17 @@ const rs = E.object({
|
|
|
1541
1557
|
{ text: t?.builderMessages.understandingRequest },
|
|
1542
1558
|
e
|
|
1543
1559
|
);
|
|
1544
|
-
const i = s.agentExecutionContext.userRequest, n = s.agentExecutionContext.messages.slice(-11), { activeSolutionDesign:
|
|
1560
|
+
const i = s.agentExecutionContext.userRequest, n = s.agentExecutionContext.messages.slice(-11), { activeSolutionDesign: o, lastTool: a } = ls(e), r = await v(se, "classifyIntent"), l = await C({
|
|
1545
1561
|
promptText: r,
|
|
1546
1562
|
modelTier: "advanced",
|
|
1547
1563
|
temperature: 0,
|
|
1548
1564
|
schema: rs,
|
|
1549
1565
|
messages: n,
|
|
1550
|
-
inputVariables: { query: i, activeSolutionDesign:
|
|
1566
|
+
inputVariables: { query: i, activeSolutionDesign: o, lastTool: a }
|
|
1551
1567
|
});
|
|
1552
1568
|
return {
|
|
1553
|
-
selectedTool:
|
|
1554
|
-
intentRationale:
|
|
1569
|
+
selectedTool: l.tool,
|
|
1570
|
+
intentRationale: l.rationale
|
|
1555
1571
|
};
|
|
1556
1572
|
}, us = async (s, e) => {
|
|
1557
1573
|
if (O(e))
|
|
@@ -1571,19 +1587,19 @@ const rs = E.object({
|
|
|
1571
1587
|
{ text: t?.executingSolutionsAssistantAgent },
|
|
1572
1588
|
e
|
|
1573
1589
|
);
|
|
1574
|
-
const n = await v(se, "assistantResponse"),
|
|
1590
|
+
const n = await v(se, "assistantResponse"), o = s.agentExecutionContext.messages.slice(-11), a = await Je({
|
|
1575
1591
|
promptText: n,
|
|
1576
1592
|
modelTier: "advanced",
|
|
1577
1593
|
temperature: 0,
|
|
1578
|
-
messages:
|
|
1594
|
+
messages: o,
|
|
1579
1595
|
inputVariables: { query: i }
|
|
1580
1596
|
});
|
|
1581
1597
|
return ie(e, "assistant"), {
|
|
1582
|
-
outputMessage:
|
|
1583
|
-
summary:
|
|
1598
|
+
outputMessage: a,
|
|
1599
|
+
summary: a,
|
|
1584
1600
|
status: "success"
|
|
1585
1601
|
};
|
|
1586
|
-
}, ms = (s) => s.selectedTool ?? "other", hs = () => new
|
|
1602
|
+
}, ms = (s) => s.selectedTool ?? "other", hs = () => new W(ke).addNode("classifyIntent", cs).addNode("routeToExplorer", us).addNode("routeToBuilder", ds).addNode("assistantResponse", ps).addEdge(K, "classifyIntent").addConditionalEdges("classifyIntent", ms, {
|
|
1587
1603
|
explorer: "routeToExplorer",
|
|
1588
1604
|
builder: "routeToBuilder",
|
|
1589
1605
|
other: "assistantResponse"
|
|
@@ -1594,20 +1610,20 @@ const rs = E.object({
|
|
|
1594
1610
|
createGraph: hs,
|
|
1595
1611
|
workspace: ke
|
|
1596
1612
|
}, ys = "https://links.esri.com/solutions/agol-organizational-account", bs = "https://links.esri.com/solutions/configure-assistants";
|
|
1597
|
-
class xs extends
|
|
1613
|
+
class xs extends Me {
|
|
1598
1614
|
constructor() {
|
|
1599
1615
|
super(), this.open = !1, this.userFirstName = "", this.builderVisible = !1, this.hasActiveBuilderDesign = !1, this._conversationId = void 0, this._lastTurnAgent = void 0, this._lastResponseAgent = void 0, this._orgSettings = {
|
|
1600
1616
|
aiAssistantsEnabled: !1,
|
|
1601
1617
|
blockBetaApps: !0,
|
|
1602
1618
|
colocateCompute: !1
|
|
1603
|
-
}, this._suggestedPrompts = [], this._hasInteracted = !1, this._isMobile = window.innerWidth <= 800, this._translations =
|
|
1604
|
-
context:
|
|
1619
|
+
}, this._suggestedPrompts = [], this._hasInteracted = !1, this._isMobile = window.innerWidth <= 800, this._translations = De({ 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 = Oe(), this._configContextConsumer = le({
|
|
1620
|
+
context: Be,
|
|
1605
1621
|
subscribe: !0,
|
|
1606
1622
|
callback: (e) => {
|
|
1607
1623
|
e?.portalURL && (G.portalUrl = e.portalURL), e?.userSession && !this.userFirstName && this._loadUserFirstName(), e?.authentication?.PortalSubset?.orgSettings && (this._orgSettings = e?.authentication?.PortalSubset?.orgSettings);
|
|
1608
1624
|
}
|
|
1609
1625
|
}), this._builderDesignContextConsumer = le({
|
|
1610
|
-
context:
|
|
1626
|
+
context: qe,
|
|
1611
1627
|
subscribe: !0,
|
|
1612
1628
|
callback: (e) => {
|
|
1613
1629
|
e?.design && (this._solutionDesignJson = JSON.stringify(e.design, null, 2));
|
|
@@ -1619,7 +1635,7 @@ class xs extends De {
|
|
|
1619
1635
|
if (t.detail?.finished && this._chatStartTime !== null) {
|
|
1620
1636
|
const i = t.detail.agent;
|
|
1621
1637
|
this._lastResponseAgent = i, this._pendingResponseAgent = i;
|
|
1622
|
-
const n =
|
|
1638
|
+
const n = Ue(this._chatStartTime);
|
|
1623
1639
|
this._telemetry?.logEvent({
|
|
1624
1640
|
category: M.ASSISTANT,
|
|
1625
1641
|
action: "Chat",
|
|
@@ -1643,8 +1659,8 @@ class xs extends De {
|
|
|
1643
1659
|
}, this._checkURLOpenParameter = () => {
|
|
1644
1660
|
this.open = this._configContextConsumer.value?.authentication?.SignInParam === "aiOpen" || this.open;
|
|
1645
1661
|
}, this.listenOn(window, "arcgisFeedback", (e) => {
|
|
1646
|
-
const t = e.detail, { agentPicked: i, taskAssigned: n, userMessage:
|
|
1647
|
-
this._sendFeedback(t.content,
|
|
1662
|
+
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 ?? "";
|
|
1663
|
+
this._sendFeedback(t.content, l, t.feedback?.positive ? "Good" : t.feedback?.positive === !1 ? "Bad" : "N/A", r);
|
|
1648
1664
|
}), this.listenOn(window, "clearAssistantConversation", () => {
|
|
1649
1665
|
this._clearConversation();
|
|
1650
1666
|
});
|
|
@@ -1674,23 +1690,23 @@ class xs extends De {
|
|
|
1674
1690
|
this._loadUserFirstName();
|
|
1675
1691
|
}
|
|
1676
1692
|
willUpdate(e) {
|
|
1677
|
-
e.has("open") && this.open && window.dispatchEvent(new CustomEvent("openAssistant")), this._configContextConsumer.value?.authentication && this._configContextConsumer.value?.userSession?.token && (this._preChatCheck || (
|
|
1693
|
+
e.has("open") && this.open && window.dispatchEvent(new CustomEvent("openAssistant")), this._configContextConsumer.value?.authentication && this._configContextConsumer.value?.userSession?.token && (this._preChatCheck || (_e(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;
|
|
1678
1694
|
}
|
|
1679
1695
|
_renderNoSign() {
|
|
1680
|
-
return
|
|
1696
|
+
return L`<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>`;
|
|
1681
1697
|
}
|
|
1682
1698
|
_renderNoPermission() {
|
|
1683
|
-
return
|
|
1699
|
+
return L`<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">${Pe(this._translations.noPermissionMessage.replace("{{orgUrl}}", ys).replace("{{configAI}}", bs))}</div></calcite-notice>`;
|
|
1684
1700
|
}
|
|
1685
1701
|
render() {
|
|
1686
1702
|
let e = this._suggestedPrompts.length > 0 ? this._suggestedPrompts : this._hasInteracted ? [] : Object.values(this._translations.defaultFollowUpQuestions);
|
|
1687
|
-
return this._suggestedPrompts.length > 0 ? e = this._suggestedPrompts : this._hasInteracted || (e = [...Object.values(this._translations.defaultFollowUpQuestions)]),
|
|
1703
|
+
return this._suggestedPrompts.length > 0 ? e = this._suggestedPrompts : this._hasInteracted || (e = [...Object.values(this._translations.defaultFollowUpQuestions)]), L`<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 ? L`${!this._isMobile && L`<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=${() => {
|
|
1688
1704
|
this._telemetry?.logEvent({
|
|
1689
1705
|
category: M.ASSISTANT,
|
|
1690
1706
|
action: "Toggle Builder Panel",
|
|
1691
1707
|
dimensions: [this.builderVisible ? "Close" : "Open"]
|
|
1692
1708
|
}), window.dispatchEvent(new CustomEvent("toggleSolutionBuilder"));
|
|
1693
|
-
}} scale=m slot=header-actions-end></calcite-action>` || ""}${!this._isMobile &&
|
|
1709
|
+
}} scale=m slot=header-actions-end></calcite-action>` || ""}${!this._isMobile && L`<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=${() => {
|
|
1694
1710
|
this._suggestedPrompts = [], e = [], this._hasInteracted = !0, this._chatStartTime = Date.now(), this.assistantProcessing.emit(!0);
|
|
1695
1711
|
}} @arcgisFeedback=${(t) => {
|
|
1696
1712
|
t.detail && console.log("arcgis feedback: ", t.detail);
|
|
@@ -1707,7 +1723,7 @@ class xs extends De {
|
|
|
1707
1723
|
requestAnimationFrame(() => i(1));
|
|
1708
1724
|
}
|
|
1709
1725
|
this.assistantProcessing.emit(!1);
|
|
1710
|
-
}} ${
|
|
1726
|
+
}} ${ze(this._assistantRef)}><calcite-button appearance=transparent id=newChatButton icon-start=speech-bubble-plus kind=neutral .label=${this._translations.tooltips.newChat} @click=${() => {
|
|
1711
1727
|
this.hasActiveBuilderDesign ? this._showNewChatConfirm = !0 : (this._telemetry?.logEvent({
|
|
1712
1728
|
category: M.ASSISTANT,
|
|
1713
1729
|
action: "New Chat",
|
|
@@ -1731,7 +1747,7 @@ class xs extends De {
|
|
|
1731
1747
|
clearSuggestedPrompts: () => {
|
|
1732
1748
|
this._suggestedPrompts = [];
|
|
1733
1749
|
}
|
|
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 &&
|
|
1750
|
+
}}></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 && L`<calcite-dialog close-disabled escape-disabled .heading=${this._translations.newConversationConfirmTitle} modal open outside-close-disabled>${this._translations.builderMessages.discardMessage}<calcite-button appearance=outline @click=${() => {
|
|
1735
1751
|
this._showNewChatConfirm = !1;
|
|
1736
1752
|
}} slot=footer-end>${this._translations.cancel}</calcite-button><calcite-button appearance=solid kind=danger @click=${() => {
|
|
1737
1753
|
this._telemetry?.logEvent({
|
|
@@ -1747,8 +1763,8 @@ class xs extends De {
|
|
|
1747
1763
|
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
1764
|
}
|
|
1749
1765
|
_sendFeedback(e, t, i, n) {
|
|
1750
|
-
const
|
|
1751
|
-
window.open(
|
|
1766
|
+
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")}`;
|
|
1767
|
+
window.open(o, "_blank");
|
|
1752
1768
|
}
|
|
1753
1769
|
async _loadUserFirstName() {
|
|
1754
1770
|
try {
|
|
@@ -1765,28 +1781,28 @@ class xs extends De {
|
|
|
1765
1781
|
for (let i = t.length - 1; i >= 0; i--) {
|
|
1766
1782
|
const n = t[i];
|
|
1767
1783
|
if (n.role === "assistant" && !this._responseMetadata.has(n.id)) {
|
|
1768
|
-
let
|
|
1769
|
-
for (let
|
|
1770
|
-
const r = t[
|
|
1784
|
+
let o;
|
|
1785
|
+
for (let a = i - 1; a >= 0; a--) {
|
|
1786
|
+
const r = t[a];
|
|
1771
1787
|
if (r.role === "user") {
|
|
1772
|
-
|
|
1788
|
+
o = r.content;
|
|
1773
1789
|
break;
|
|
1774
1790
|
}
|
|
1775
1791
|
}
|
|
1776
|
-
return this._responseMetadata.set(n.id, { agent: e, userMessage:
|
|
1792
|
+
return this._responseMetadata.set(n.id, { agent: e, userMessage: o }), !0;
|
|
1777
1793
|
}
|
|
1778
1794
|
}
|
|
1779
1795
|
return !1;
|
|
1780
1796
|
}
|
|
1781
1797
|
_parseAgentPickedAndTask(e) {
|
|
1782
|
-
const t = Array.from(this._assistantRef.value?.messages || []), i = e.log || [],
|
|
1798
|
+
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
1799
|
if (!r)
|
|
1784
|
-
return { agentPicked: null, taskAssigned: null, userMessage:
|
|
1785
|
-
const
|
|
1800
|
+
return { agentPicked: null, taskAssigned: null, userMessage: a };
|
|
1801
|
+
const l = /Agent picked:\s*(.*?)\s*(?:\\n|\r?\n)\s*Task Assigned:\s*([\s\S]*)$/i, d = r.match(l);
|
|
1786
1802
|
if (!d)
|
|
1787
|
-
return { agentPicked: null, taskAssigned: null, userMessage:
|
|
1803
|
+
return { agentPicked: null, taskAssigned: null, userMessage: a };
|
|
1788
1804
|
const h = d[1].trim(), y = d[2].trim();
|
|
1789
|
-
return { agentPicked: h, taskAssigned: y, userMessage:
|
|
1805
|
+
return { agentPicked: h, taskAssigned: y, userMessage: a };
|
|
1790
1806
|
}
|
|
1791
1807
|
_emitItemIdFromAI(e) {
|
|
1792
1808
|
const t = new CustomEvent("solutionIDFromAssistant", {
|