@esri/solutions-components 5.1.15 → 5.1.16
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/247Q2TXM.js +2 -0
- package/dist/cdn/{VCKCRMSD.js → 2C4JBZR3.js} +1 -1
- package/dist/cdn/{VW4UJ7IY.js → 2DTIYSOT.js} +1 -1
- package/dist/cdn/{JNQB7T54.js → 2QR2IHMG.js} +1 -1
- package/dist/cdn/3ODUV7DM.js +2 -0
- package/dist/cdn/{CPWYI2FO.js → 3TZRVL3S.js} +1 -1
- package/dist/cdn/{IBSFJBIL.js → 447ZMCY3.js} +1 -1
- package/dist/cdn/{XRQNNWH3.js → 4JE4ZZEO.js} +1 -1
- package/dist/cdn/4O622WUQ.js +2 -0
- package/dist/cdn/4OZKMC4H.js +2 -0
- package/dist/cdn/{T6F3TWF6.js → 4RPDNW6C.js} +1 -1
- package/dist/cdn/{24U5P7WR.js → 4W4LIIXK.js} +1 -1
- package/dist/cdn/{SNRLIWGC.js → 56OXNE5M.js} +1 -1
- package/dist/cdn/{5DZ55HIG.js → 5E2X2LIC.js} +1 -1
- package/dist/cdn/{XL66TA6C.js → 5LSAVYFC.js} +1 -1
- package/dist/cdn/5MVOXMG2.js +2 -0
- package/dist/cdn/5QGU6U72.js +2 -0
- package/dist/cdn/{KN2PNGQX.js → 6HPH3E35.js} +1 -1
- package/dist/cdn/{5AGI2QC2.js → 6IWBGRKB.js} +1 -1
- package/dist/cdn/6PKGJDEH.js +2 -0
- package/dist/cdn/6TGGKMQB.js +2 -0
- package/dist/cdn/{BOA6VQK6.js → 75QFNN26.js} +1 -1
- package/dist/cdn/{HB56DBBP.js → 7EKT4XZ2.js} +5 -5
- package/dist/cdn/{7MJZYDDW.js → 7FGKODSI.js} +1 -1
- package/dist/cdn/{BFYYWPZY.js → 7RX3CC2H.js} +1 -1
- package/dist/cdn/{KJTTBON2.js → ACR7LXQM.js} +1 -1
- package/dist/cdn/{65VKA5R3.js → AIJ5KNSJ.js} +1 -1
- package/dist/cdn/AVMD543K.js +2 -0
- package/dist/cdn/{JIOMWIMT.js → B33ONN6M.js} +1 -1
- package/dist/cdn/{OZVQRDTO.js → BE4N7HFP.js} +1 -1
- package/dist/cdn/{Z4LGN5M5.js → BSPAXBDY.js} +1 -1
- package/dist/cdn/{DERWSE25.js → C5IHV5FJ.js} +1 -1
- package/dist/cdn/{EV55ZAHX.js → C7D3FPWP.js} +1 -1
- package/dist/cdn/{2GBCVJXZ.js → D62YOY7Q.js} +1 -1
- package/dist/cdn/{4VUQR74S.js → DCNEGYEC.js} +1 -1
- package/dist/cdn/DG2BBLXW.js +2 -0
- package/dist/cdn/{7GWFZ23D.js → DTXW7GR2.js} +1 -1
- package/dist/cdn/DXWCRPU7.js +2 -0
- package/dist/cdn/{ABPXUFXN.js → E7CD7GZL.js} +1 -1
- package/dist/cdn/EOMG2X5B.js +357 -0
- package/dist/cdn/{O4MNHPWI.js → EWCJJNT5.js} +1 -1
- package/dist/cdn/{WQUZG2NJ.js → FILRH4BY.js} +1 -1
- package/dist/cdn/{OQMMSCLX.js → FUEOEICW.js} +1 -1
- package/dist/cdn/{2CIYQPV2.js → FWRCG7QJ.js} +1 -1
- package/dist/cdn/{O62JG2Y6.js → FXGWLBJ7.js} +1 -1
- package/dist/cdn/{6MQWDLJ6.js → GMAV5T2N.js} +1 -1
- package/dist/cdn/{LGJMYSGU.js → GPODLJUL.js} +1 -1
- package/dist/cdn/{CNNBPMQT.js → GRFNUGBT.js} +1 -1
- package/dist/cdn/{JXERXJF5.js → GTX5TOX6.js} +1 -1
- package/dist/cdn/GWKUM5FJ.js +456 -0
- package/dist/cdn/{5TNQ4S67.js → H3GN63Y3.js} +1 -1
- package/dist/cdn/{T7JWS4CF.js → HIVXXDHM.js} +1 -1
- package/dist/cdn/I4WRVQPK.js +2 -0
- package/dist/cdn/{36LRAUE4.js → IPQDASPD.js} +1 -1
- package/dist/cdn/{RSPNBIIE.js → IWLPFHJF.js} +1 -1
- package/dist/cdn/{ZXHMBCGN.js → J4Y2UUE5.js} +1 -1
- package/dist/cdn/{YR6F4HW7.js → JDGAPNOB.js} +1 -1
- package/dist/cdn/{7SZY3VBD.js → JMFXUBR7.js} +1 -1
- package/dist/cdn/{GNX2VU4F.js → JSKYS7P5.js} +1 -1
- package/dist/cdn/{AQ2USXUY.js → JY2FA5F3.js} +1 -1
- package/dist/cdn/{TRNQ5OTY.js → JYKJLNCR.js} +1 -1
- package/dist/cdn/K5DU5RWF.js +2 -0
- package/dist/cdn/{N5DZRJNH.js → KH4ZYXHD.js} +1 -1
- package/dist/cdn/{DT7GQICF.js → KMKWVYPI.js} +1 -1
- package/dist/cdn/{QPMXVWMP.js → L6LA4X2Q.js} +1 -1
- package/dist/cdn/{FTWOLF7Y.js → L76QNBH4.js} +1 -1
- package/dist/cdn/{SSNO5VHY.js → LC7635YE.js} +1 -1
- package/dist/cdn/{COKMQSEA.js → LEZRHZSL.js} +1 -1
- package/dist/cdn/{COEHM4BJ.js → LSPJWXOL.js} +1 -1
- package/dist/cdn/{PHGSNNMQ.js → LULZPSZK.js} +1 -1
- package/dist/cdn/{5O6E2RIA.js → LVFCQS24.js} +1 -1
- package/dist/cdn/{QMUSSZL2.js → M3BC47EX.js} +1 -1
- package/dist/cdn/{IYZ2PDYK.js → MD2W2CNY.js} +1 -1
- package/dist/cdn/{MECI4R4R.js → MH3W3N6T.js} +3 -3
- package/dist/cdn/{XOPNEAS5.js → MIC565TO.js} +1 -1
- package/dist/cdn/{FJAUOTG7.js → MKGWQ7ED.js} +1 -1
- package/dist/cdn/{XSJOQTEM.js → MTGZHZYF.js} +1 -1
- package/dist/cdn/{G2OBSHPX.js → N74SSEHF.js} +1 -1
- package/dist/cdn/{KOIHVAUY.js → NLXWDQUL.js} +1 -1
- package/dist/cdn/{CDZW34JV.js → NWI63TZX.js} +1 -1
- package/dist/cdn/{CAPXLC6T.js → O2Y2MGL7.js} +1 -1
- package/dist/cdn/{2A7FDE6T.js → O4Q74CU3.js} +1 -1
- package/dist/cdn/{SYHEO472.js → O7KEBYBS.js} +1 -1
- package/dist/cdn/PB4KDDNX.js +2 -0
- package/dist/cdn/{HW4LYJUR.js → PCRICJQB.js} +1 -1
- package/dist/cdn/{53YBLXWP.js → PFGAF7W7.js} +1 -1
- package/dist/cdn/{IDJHBEJC.js → PJ556LHC.js} +3 -3
- package/dist/cdn/{AONULVO2.js → PRBMUEIU.js} +1 -1
- package/dist/cdn/{2WXIVPKA.js → PUBYJMMF.js} +1 -1
- package/dist/cdn/Q5ALOX6G.js +2 -0
- package/dist/cdn/{FLPXST7W.js → QIYUCOCH.js} +1 -1
- package/dist/cdn/{RLDOLDG5.js → QT66ATR6.js} +1 -1
- package/dist/cdn/{K3ALRIQF.js → R22ZBXMU.js} +1 -1
- package/dist/cdn/{6RHFFYNC.js → RBA5LP53.js} +1 -1
- package/dist/cdn/{4M55FA2L.js → RJJEDOA5.js} +1 -1
- package/dist/cdn/{3JF7PWPA.js → RTHNTV3C.js} +1 -1
- package/dist/cdn/{VQ5ZAQUF.js → RWYVVDWD.js} +1 -1
- package/dist/cdn/{RPLXKWJA.js → SWZW76QC.js} +1 -1
- package/dist/cdn/{AO7XKW2U.js → SY25U3KI.js} +1 -1
- package/dist/cdn/T5RT73MF.js +2 -0
- package/dist/cdn/{W6GIBBBE.js → TWELRTPF.js} +1 -1
- package/dist/cdn/U3D2IIAX.js +2 -0
- package/dist/cdn/UAWJNBXB.js +4 -0
- package/dist/cdn/{KF64ALRP.js → ULAU7YYD.js} +1 -1
- package/dist/cdn/{VZWYFHPJ.js → UPYHIGTA.js} +1 -1
- package/dist/cdn/{VHAXJPRY.js → UR2RYZ4Q.js} +1 -1
- package/dist/cdn/{L5DQOHD5.js → V3QY6GGE.js} +1 -1
- package/dist/cdn/{YGVATVII.js → VEBARNK2.js} +1 -1
- package/dist/cdn/VSTISYVL.js +2 -0
- package/dist/cdn/{JMY4B4WQ.js → VT35RTGD.js} +1 -1
- package/dist/cdn/{RGOUIRT7.js → WFDP33EC.js} +1 -1
- package/dist/cdn/{4QGYS5DL.js → WMY3JAPO.js} +1 -1
- package/dist/cdn/{CWW74G2W.js → WNSJ26IM.js} +1 -1
- package/dist/cdn/{RI7U6FA5.js → WP3FT4MH.js} +1 -1
- package/dist/cdn/{AIUJXRA5.js → WSGJL4QG.js} +1 -1
- package/dist/cdn/{WVRDKKBC.js → WWRJFSPK.js} +1 -1
- package/dist/cdn/XGF4Z7DL.js +2 -0
- package/dist/cdn/{67RAW3TG.js → XTMKQTKS.js} +1 -1
- package/dist/cdn/{BDVFJJR4.js → XUQJ6TZ4.js} +1 -1
- package/dist/cdn/{RD7MZ7SN.js → XWMICWSU.js} +1 -1
- package/dist/cdn/{D4HAXELR.js → XZE3UIAE.js} +1 -1
- package/dist/cdn/{5OMXJXRL.js → Y376MZ7V.js} +1 -1
- package/dist/cdn/{2ZH3GVSR.js → YGHICFBD.js} +1 -1
- package/dist/cdn/{GWLE7PJQ.js → YJCJZHBN.js} +1 -1
- package/dist/cdn/{VYOCZUVH.js → YP46NHDO.js} +1 -1
- package/dist/cdn/{MQQ2SHRV.js → YSZNDZHZ.js} +1 -1
- package/dist/cdn/{P3YHSJCB.js → Z7NC4HTS.js} +1 -1
- package/dist/cdn/{5DMFGBJJ.js → ZBXJES7E.js} +1 -1
- package/dist/cdn/{5USMP4M7.js → ZZIJOG6A.js} +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/runtime.js +1 -1
- package/dist/chunks/solution-builder-assistant.js +2 -2
- package/dist/components/arcgis-solutions-assistant/customElement.js +324 -335
- package/dist/components/create-feature/customElement.js +77 -48
- package/dist/components/layer-table/customElement.js +2 -2
- package/dist/components/map-card/customElement.js +2 -2
- package/dist/components/solutions-deploy-app/customElement.js +3 -3
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/solutions-components_commit.txt +7 -7
- package/package.json +9 -7
- package/dist/cdn/3TAQSXLA.js +0 -2
- package/dist/cdn/4ESJPQUS.js +0 -2
- package/dist/cdn/64DMFXX3.js +0 -459
- package/dist/cdn/6JPXLTNI.js +0 -358
- package/dist/cdn/7LP2DUHS.js +0 -2
- package/dist/cdn/ACTGIDKO.js +0 -4
- package/dist/cdn/BA3J7L5N.js +0 -2
- package/dist/cdn/BPHZAC66.js +0 -2
- package/dist/cdn/ECJQJ4BY.js +0 -2
- package/dist/cdn/F5EJPIW4.js +0 -2
- package/dist/cdn/FX2C3BL4.js +0 -2
- package/dist/cdn/GEEQWXOZ.js +0 -2
- package/dist/cdn/H3QX6XOJ.js +0 -2
- package/dist/cdn/JRUIRTL7.js +0 -2
- package/dist/cdn/NF77ALHM.js +0 -2
- package/dist/cdn/OJH4NUGT.js +0 -2
- package/dist/cdn/SV2XM7U2.js +0 -2
- package/dist/cdn/TTXN5R4E.js +0 -2
- package/dist/cdn/VM2LS6TR.js +0 -2
- package/dist/cdn/VNWIFVKC.js +0 -2
- package/dist/cdn/VWNMKVMJ.js +0 -2
- package/dist/cdn/X3YWKGD7.js +0 -2
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import { c as
|
|
3
|
-
import { u as
|
|
4
|
-
import { LitElement as
|
|
5
|
-
import { css as
|
|
2
|
+
import { c as Ne } from "../../chunks/runtime.js";
|
|
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
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
|
|
9
|
-
import { T as
|
|
10
|
-
import { m as
|
|
8
|
+
import { c as Be, b as qe } from "../../chunks/deployAppContexts.js";
|
|
9
|
+
import { T as M } from "../../chunks/interfaces.js";
|
|
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
|
|
14
|
-
import { createAgentRuntimeState as X, sendTraceMessage as
|
|
15
|
-
import c, { z as
|
|
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 { t as me, g as
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
const
|
|
25
|
-
async function
|
|
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";
|
|
22
|
+
import Xe from "@arcgis/core/portal/Portal.js";
|
|
23
|
+
import Ye from "@arcgis/core/portal/PortalItem.js";
|
|
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)}`;
|
|
25
|
+
async function v(s, e) {
|
|
26
26
|
const t = Object.entries(s).find(
|
|
27
27
|
([i]) => i.endsWith(`/${e}.md`)
|
|
28
28
|
);
|
|
@@ -35,7 +35,7 @@ ${Object.keys(s).join(`
|
|
|
35
35
|
);
|
|
36
36
|
return await t[1]();
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function U(s) {
|
|
39
39
|
return s?.configurable?.context?.translations;
|
|
40
40
|
}
|
|
41
41
|
function fe(s) {
|
|
@@ -70,17 +70,17 @@ function ye(s) {
|
|
|
70
70
|
});
|
|
71
71
|
window.dispatchEvent(e);
|
|
72
72
|
}
|
|
73
|
-
const
|
|
74
|
-
needsContext:
|
|
75
|
-
rewrittenQuery:
|
|
73
|
+
const et = E.object({
|
|
74
|
+
needsContext: E.boolean().describe("True when the explorer query requires added context from prior turns."),
|
|
75
|
+
rewrittenQuery: E.string().min(1).describe("The final query to send to doc AI. Keep original query if no context is needed.")
|
|
76
76
|
}), ce = (s) => s?.signal?.aborted ?? !1, be = /* @__PURE__ */ Object.assign({
|
|
77
77
|
"./prompts/solutions_explorer_description.md": () => import("../../chunks/solutions_explorer_description.js").then((s) => s.default),
|
|
78
78
|
"./prompts/transformQuery.md": () => import("../../chunks/transformQuery.js").then((s) => s.default)
|
|
79
79
|
});
|
|
80
|
-
function
|
|
80
|
+
function tt(s) {
|
|
81
81
|
return s.replace(/<sup>\[\[(\d+)\]\]\(([^)]+)\)<\/sup>/g, '<sup><a href="$2">[$1]</a></sup>');
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function st(s) {
|
|
84
84
|
return s.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, (e, t, i) => `<img src="${i}" alt="${t}" style="width: 100%;">`);
|
|
85
85
|
}
|
|
86
86
|
function xe(s) {
|
|
@@ -90,7 +90,7 @@ function xe(s) {
|
|
|
90
90
|
const t = e.split(/[-_]/)[0]?.toLowerCase();
|
|
91
91
|
return t ? t.slice(0, 2) : "en";
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function it(s, e) {
|
|
94
94
|
const t = [];
|
|
95
95
|
return (e?.configurable?.context?.configContext.allCards ?? []).forEach((n) => {
|
|
96
96
|
const o = n.title;
|
|
@@ -98,9 +98,9 @@ function nt(s, e) {
|
|
|
98
98
|
return;
|
|
99
99
|
const a = new RegExp(`(?<![\\p{L}\\p{N}])${o}(?![\\p{L}\\p{N}])`, "giu");
|
|
100
100
|
let r = !1;
|
|
101
|
-
s = s.replace(a, (l, d,
|
|
102
|
-
const
|
|
103
|
-
return /<img[^>]*alt\s*=\s*["'][^"']*$/i.test(
|
|
101
|
+
s = s.replace(a, (l, d, h) => {
|
|
102
|
+
const y = h.slice(0, d);
|
|
103
|
+
return /<img[^>]*alt\s*=\s*["'][^"']*$/i.test(y) ? l : (r = !0, `<a href="" target="solutionId:${n.deployCommonId}">${o}</a>`);
|
|
104
104
|
}), r && t.push({
|
|
105
105
|
solution: {
|
|
106
106
|
title: n.title,
|
|
@@ -112,7 +112,7 @@ function nt(s, e) {
|
|
|
112
112
|
});
|
|
113
113
|
}), { source: s, allMatches: t };
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function nt(s) {
|
|
116
116
|
return s && s.helperServices.aiAssistantServices ? `${s.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/chat` : null;
|
|
117
117
|
}
|
|
118
118
|
function ve(s) {
|
|
@@ -131,17 +131,17 @@ async function Q(s, e, t) {
|
|
|
131
131
|
throw new Error(`HTTP ${i.status} calling ${e}`);
|
|
132
132
|
return i.json();
|
|
133
133
|
}
|
|
134
|
-
const
|
|
135
|
-
async function
|
|
134
|
+
const ot = (s) => new Promise((e) => setTimeout(e, s));
|
|
135
|
+
async function at(s, e) {
|
|
136
136
|
const t = s.agentExecutionContext.userRequest, i = e?.configurable?.context?.lastTurnAgent, n = s.agentExecutionContext.messages ?? [];
|
|
137
137
|
if (!i || n.length <= 1)
|
|
138
138
|
return t;
|
|
139
139
|
try {
|
|
140
|
-
const o = await
|
|
140
|
+
const o = await v(be, "transformQuery"), a = await C({
|
|
141
141
|
promptText: o,
|
|
142
142
|
modelTier: "advanced",
|
|
143
143
|
temperature: 0,
|
|
144
|
-
schema:
|
|
144
|
+
schema: et,
|
|
145
145
|
messages: n.slice(-11),
|
|
146
146
|
inputVariables: { query: t, lastTurnAgent: i }
|
|
147
147
|
});
|
|
@@ -151,28 +151,28 @@ async function rt(s, e) {
|
|
|
151
151
|
}
|
|
152
152
|
return t;
|
|
153
153
|
}
|
|
154
|
-
const
|
|
154
|
+
const rt = b.Root({
|
|
155
155
|
// Provides agentExecutionContext, outputMessage, summary, and status
|
|
156
156
|
// channels with the orchestrator's standard reducers/defaults so the
|
|
157
157
|
// sub-agent reports back through the same shape the orchestrator
|
|
158
158
|
// persists into priorSteps.
|
|
159
159
|
...X(),
|
|
160
|
-
solutionResponse:
|
|
160
|
+
solutionResponse: b({
|
|
161
161
|
reducer: (s, e) => e ?? null,
|
|
162
162
|
default: () => null
|
|
163
163
|
}),
|
|
164
|
-
documentSkillUrl:
|
|
164
|
+
documentSkillUrl: b({
|
|
165
165
|
reducer: (s, e) => e ?? null,
|
|
166
166
|
default: () => null
|
|
167
167
|
}),
|
|
168
168
|
// Persisted across turns via the graph checkpointer so follow-up questions
|
|
169
169
|
// continue the same service conversation. Null on the very first interaction
|
|
170
170
|
// or after messages are cleared.
|
|
171
|
-
conversationId:
|
|
171
|
+
conversationId: b({
|
|
172
172
|
reducer: (s, e) => e ?? s,
|
|
173
173
|
default: () => null
|
|
174
174
|
})
|
|
175
|
-
}),
|
|
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) => {
|
|
176
176
|
if (!s) return;
|
|
177
177
|
const n = ve(s);
|
|
178
178
|
if (!n) return;
|
|
@@ -187,13 +187,13 @@ const lt = x.Root({
|
|
|
187
187
|
}
|
|
188
188
|
} };
|
|
189
189
|
i && (a.conversationId = i), Q(a, n, e ?? "");
|
|
190
|
-
},
|
|
190
|
+
}, ct = async (s, e) => {
|
|
191
191
|
if (ce(e))
|
|
192
192
|
return {};
|
|
193
|
-
const t =
|
|
193
|
+
const t = U(e), i = s.documentSkillUrl;
|
|
194
194
|
let n = [];
|
|
195
|
-
const o = await
|
|
196
|
-
await
|
|
195
|
+
const o = await at(s, e);
|
|
196
|
+
await w(
|
|
197
197
|
{ text: t.agentProgress.explorerAgentSearching },
|
|
198
198
|
e
|
|
199
199
|
);
|
|
@@ -227,27 +227,27 @@ const lt = x.Root({
|
|
|
227
227
|
ackSequenceNumber: a.sequenceNumber,
|
|
228
228
|
inquiryId: a.inquiryId
|
|
229
229
|
}, l = "";
|
|
230
|
-
const d = async (
|
|
231
|
-
const u =
|
|
230
|
+
const d = async (y) => {
|
|
231
|
+
const u = y.context?.results?.[0]?.reply ?? "";
|
|
232
232
|
if (u !== "") {
|
|
233
|
-
const
|
|
234
|
-
l =
|
|
233
|
+
const I = tt(u), F = st(I), T = it(F, e);
|
|
234
|
+
l = T.source, n = [
|
|
235
235
|
...n,
|
|
236
|
-
...
|
|
237
|
-
(
|
|
236
|
+
...T.allMatches.filter(
|
|
237
|
+
(z) => !n.some((S) => S.solution.id === z.solution.id)
|
|
238
238
|
)
|
|
239
239
|
];
|
|
240
240
|
}
|
|
241
|
-
const
|
|
242
|
-
if (
|
|
243
|
-
let
|
|
244
|
-
|
|
241
|
+
const g = y.context?.results?.[0]?.status?.currentStatusStep;
|
|
242
|
+
if (g) {
|
|
243
|
+
let I = "";
|
|
244
|
+
g === 1 ? I = t.agentProgress.explorerAgentReading : g === 2 ? I = t.agentProgress.explorerAgentReviewing : g === 3 && (I = t.agentProgress.explorerAgentPreparing), await w({ text: I }, e);
|
|
245
245
|
}
|
|
246
246
|
};
|
|
247
247
|
for (await d(a); r.hasMore; ) {
|
|
248
248
|
if (ce(e))
|
|
249
249
|
return {};
|
|
250
|
-
await
|
|
250
|
+
await ot(500), a = await Q(
|
|
251
251
|
{
|
|
252
252
|
conversationId: r.conversationId,
|
|
253
253
|
ackSequenceNumber: r.ackSequenceNumber,
|
|
@@ -263,7 +263,7 @@ const lt = x.Root({
|
|
|
263
263
|
inquiryId: a.inquiryId
|
|
264
264
|
}, await d(a);
|
|
265
265
|
}
|
|
266
|
-
return ve(e?.configurable?.context.portal) &&
|
|
266
|
+
return ve(e?.configurable?.context.portal) && _e(
|
|
267
267
|
e?.configurable?.context.portal,
|
|
268
268
|
e?.configurable?.context.token ?? "",
|
|
269
269
|
e?.configurable?.context.configContext.locale ?? "en",
|
|
@@ -275,14 +275,14 @@ const lt = x.Root({
|
|
|
275
275
|
solutionResponse: r,
|
|
276
276
|
conversationId: r.conversationId
|
|
277
277
|
};
|
|
278
|
-
},
|
|
278
|
+
}, ut = async (s, e) => {
|
|
279
279
|
let t = null;
|
|
280
|
-
return s.documentSkillUrl === null && e?.configurable?.context?.portal && (t =
|
|
280
|
+
return s.documentSkillUrl === null && e?.configurable?.context?.portal && (t = nt(e.configurable.context.portal)), {
|
|
281
281
|
documentSkillUrl: t
|
|
282
282
|
};
|
|
283
283
|
};
|
|
284
|
-
await
|
|
285
|
-
const
|
|
284
|
+
await v(be, "solutions_explorer_description");
|
|
285
|
+
const we = (s) => {
|
|
286
286
|
if (s && Array.isArray(s.id) && s.id.length > 0)
|
|
287
287
|
return s.id[s.id.length - 1].replace("Message", "").toLowerCase();
|
|
288
288
|
if (s && typeof s._getType == "function")
|
|
@@ -292,8 +292,8 @@ const _e = (s) => {
|
|
|
292
292
|
return "human";
|
|
293
293
|
}
|
|
294
294
|
return "human";
|
|
295
|
-
},
|
|
296
|
-
const e =
|
|
295
|
+
}, dt = (s) => {
|
|
296
|
+
const e = we(s);
|
|
297
297
|
if (s && s.kwargs)
|
|
298
298
|
return {
|
|
299
299
|
role: e,
|
|
@@ -308,10 +308,10 @@ const _e = (s) => {
|
|
|
308
308
|
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;
|
|
309
309
|
}
|
|
310
310
|
return { role: "human", content: String(s) };
|
|
311
|
-
},
|
|
312
|
-
builderMessages:
|
|
311
|
+
}, 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 = {
|
|
312
|
+
builderMessages: gt
|
|
313
313
|
};
|
|
314
|
-
class
|
|
314
|
+
class x {
|
|
315
315
|
//--------------------------------------------------------------------------
|
|
316
316
|
//
|
|
317
317
|
// Public API
|
|
@@ -514,7 +514,7 @@ class v {
|
|
|
514
514
|
if (o.isValid || this._tryFixName(o.errorType, n, (a) => {
|
|
515
515
|
this.response.solution.title = a;
|
|
516
516
|
}, "Solution title", "Solution Title") || this._logIssue(`Solution title is invalid (${o.errorType}).`), t) {
|
|
517
|
-
const a = H(t,
|
|
517
|
+
const a = H(t, x.DESCRIPTION_MAX_LENGTH, !0);
|
|
518
518
|
a.isValid || this._tryFixDescription(t, (r) => {
|
|
519
519
|
this.response.solution.description = r;
|
|
520
520
|
}, "Solution description") || this._logIssue(`Solution description is invalid (${a.errorType}).`);
|
|
@@ -529,7 +529,7 @@ class v {
|
|
|
529
529
|
if (t.isValid || this._tryFixName(t.errorType, e.title ?? "", (i) => {
|
|
530
530
|
e.title = i;
|
|
531
531
|
}, `Item '${e.id}' title`, "Item Title") || this._logIssue(`Item '${e.id}' title is invalid (${t.errorType}).`), e.description) {
|
|
532
|
-
const i = H(e.description,
|
|
532
|
+
const i = H(e.description, x.DESCRIPTION_MAX_LENGTH, !0);
|
|
533
533
|
i.isValid || this._tryFixDescription(e.description, (n) => {
|
|
534
534
|
e.description = n;
|
|
535
535
|
}, `Item '${e.id}' description`) || this._logIssue(`Item '${e.id}' description is invalid (${i.errorType}).`);
|
|
@@ -571,7 +571,7 @@ class v {
|
|
|
571
571
|
if (i.isValid || this._tryFixName(i.errorType, e.name ?? "", (n) => {
|
|
572
572
|
e.name = n;
|
|
573
573
|
}, `Layer '${e.name}' name`, "Layer Title") || this._logIssue(`Layer '${e.name}' name is invalid (${i.errorType}).`), e.description) {
|
|
574
|
-
const n = H(e.description,
|
|
574
|
+
const n = H(e.description, x.DESCRIPTION_MAX_LENGTH, !0);
|
|
575
575
|
n.isValid || this._tryFixDescription(e.description, (o) => {
|
|
576
576
|
e.description = o;
|
|
577
577
|
}, `Layer '${e.name}' description`) || this._logIssue(`Layer '${e.name}' description is invalid (${n.errorType}).`);
|
|
@@ -624,26 +624,26 @@ class v {
|
|
|
624
624
|
n || this._logIssue(`Field '${e.name}' does not start with a letter.`), o || this._logIssue(
|
|
625
625
|
`Field '${e.name}' contains invalid characters (only letters from any writing system, numbers, and underscores are allowed; emojis and punctuation are not allowed).`
|
|
626
626
|
);
|
|
627
|
-
if (e.name.length >
|
|
627
|
+
if (e.name.length > x.FIELD_NAME_MAX_LENGTH)
|
|
628
628
|
if (this.newDesign) {
|
|
629
629
|
const l = e.name;
|
|
630
|
-
e.name = this._getUniqueTruncatedFieldName(e.name, this.fieldNameRegistry), this.fieldNameRegistry.add(e.name.toLowerCase()), this._logAutoFix(`Field '${l}' exceeds ${
|
|
630
|
+
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}'.`);
|
|
631
631
|
} else
|
|
632
|
-
this._logIssue(`Field '${e.name}' exceeds ${
|
|
633
|
-
if (
|
|
632
|
+
this._logIssue(`Field '${e.name}' exceeds ${x.FIELD_NAME_MAX_LENGTH} characters.`);
|
|
633
|
+
if (Ve.has(e.name.toLowerCase()))
|
|
634
634
|
if (this.newDesign) {
|
|
635
635
|
const l = e.name;
|
|
636
636
|
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}'.`);
|
|
637
637
|
} else
|
|
638
638
|
this._logIssue(`Field '${e.name}' is a SQL reserved keyword.`);
|
|
639
|
-
if (
|
|
639
|
+
if (Qe.has(e.name.toLowerCase()))
|
|
640
640
|
if (this.newDesign) {
|
|
641
641
|
const l = e.name;
|
|
642
642
|
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}'.`);
|
|
643
643
|
} else
|
|
644
644
|
this._logIssue(`Field '${e.name}' is a reserved system field name.`);
|
|
645
645
|
const a = e.type ?? "", r = a.toLowerCase();
|
|
646
|
-
if (a !== r && (e.type = r), !
|
|
646
|
+
if (a !== r && (e.type = r), !x.ALLOWED_FIELD_TYPES.has(r))
|
|
647
647
|
if (this.newDesign) {
|
|
648
648
|
const l = e.type;
|
|
649
649
|
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}'.`);
|
|
@@ -687,7 +687,7 @@ class v {
|
|
|
687
687
|
return;
|
|
688
688
|
}
|
|
689
689
|
const t = e.length;
|
|
690
|
-
if (!
|
|
690
|
+
if (!Ke(t).isValid) {
|
|
691
691
|
const n = t > 4e3 ? 4e3 : 256;
|
|
692
692
|
this._handleInvalidStringFieldLength(e, n);
|
|
693
693
|
}
|
|
@@ -719,7 +719,7 @@ class v {
|
|
|
719
719
|
* appending a numeric suffix as needed.
|
|
720
720
|
*/
|
|
721
721
|
_getUniqueTruncatedFieldName(e, t) {
|
|
722
|
-
const i =
|
|
722
|
+
const i = x.FIELD_NAME_MAX_LENGTH, n = e.slice(0, i);
|
|
723
723
|
let o = n, a = 1;
|
|
724
724
|
for (; t.has(o.toLowerCase()); ) {
|
|
725
725
|
const r = `_${a}`, l = Math.max(1, i - r.length);
|
|
@@ -732,15 +732,15 @@ class v {
|
|
|
732
732
|
* collapsing whitespace, trimming, and truncating to the name length limit.
|
|
733
733
|
* May return an empty string when no valid characters remain.
|
|
734
734
|
*/
|
|
735
|
-
_sanitizeItemName(e, t =
|
|
736
|
-
let i = (e ?? "").replace(new RegExp(
|
|
735
|
+
_sanitizeItemName(e, t = x.NAME_MAX_LENGTH) {
|
|
736
|
+
let i = (e ?? "").replace(new RegExp(We.source, "gu"), "").replace(x.INVALID_NAME_CHARS, "").replace(/\s+/gu, " ").trim();
|
|
737
737
|
return i.length > t && (i = i.slice(0, t).trim()), i;
|
|
738
738
|
}
|
|
739
739
|
/**
|
|
740
740
|
* Sanitizes a description by stripping the disallowed `<` and `>` characters
|
|
741
741
|
* (forward slash is allowed) and truncating to the description length limit.
|
|
742
742
|
*/
|
|
743
|
-
_sanitizeDescription(e, t =
|
|
743
|
+
_sanitizeDescription(e, t = x.DESCRIPTION_MAX_LENGTH) {
|
|
744
744
|
let i = (e ?? "").replace(/[<>]/gu, "");
|
|
745
745
|
return i.length > t && (i = i.slice(0, t)), i;
|
|
746
746
|
}
|
|
@@ -788,11 +788,11 @@ class v {
|
|
|
788
788
|
console.debug(e), this.issues.push(e), this.isValid = !1;
|
|
789
789
|
}
|
|
790
790
|
}
|
|
791
|
-
const
|
|
791
|
+
const yt = c.object({
|
|
792
792
|
key: c.string().describe("Stable key identifier for the string."),
|
|
793
793
|
value: c.string().describe("Display value for the string."),
|
|
794
794
|
description: c.string().describe("Explanation of where/how the string is used.")
|
|
795
|
-
}),
|
|
795
|
+
}), bt = c.object({
|
|
796
796
|
id: c.string().describe("ArcGIS item id (32 hex characters)."),
|
|
797
797
|
title: c.string().describe("Item title."),
|
|
798
798
|
description: c.string().describe("Item description."),
|
|
@@ -824,7 +824,7 @@ const bt = c.object({
|
|
|
824
824
|
"List of allowed values for string fields with a controlled vocabulary. Null if unrestricted or not applicable."
|
|
825
825
|
),
|
|
826
826
|
length: c.number().int().nullable().describe("Maximum string length for string fields. Null for non-string fields.")
|
|
827
|
-
}),
|
|
827
|
+
}), xt = c.object({
|
|
828
828
|
id: c.number().int().describe("Layer/table id within the feature service."),
|
|
829
829
|
type: c.enum(["Point", "Polyline", "Polygon", "Table"]).describe("Layer type."),
|
|
830
830
|
typeMutable: c.boolean().describe("Indicates whether the layer type can be changed."),
|
|
@@ -832,10 +832,10 @@ const bt = c.object({
|
|
|
832
832
|
description: c.string().describe("Layer/table description."),
|
|
833
833
|
customFields: c.array(ue).describe("User/business fields specific to the solution."),
|
|
834
834
|
requiredFields: c.array(ue).describe("Fields required for solution functionality (e.g., relationship keys).")
|
|
835
|
-
}),
|
|
835
|
+
}), vt = c.object({
|
|
836
836
|
itemId: c.string().describe("ArcGIS item id for the feature layer."),
|
|
837
837
|
addLayers: c.boolean().describe("Indicates whether new layers can be added during solution design."),
|
|
838
|
-
layers: c.array(
|
|
838
|
+
layers: c.array(xt)
|
|
839
839
|
}), Z = c.object({
|
|
840
840
|
response: c.string().describe("Conversational response to the user's query."),
|
|
841
841
|
solution: c.object({
|
|
@@ -843,35 +843,35 @@ const bt = c.object({
|
|
|
843
843
|
title: c.string().describe("Title of the solution."),
|
|
844
844
|
description: c.string().describe("Description of the solution."),
|
|
845
845
|
tags: c.array(c.string()).describe("Keywords/tags associated with the solution."),
|
|
846
|
-
strings: c.array(
|
|
846
|
+
strings: c.array(yt).describe("Localized strings/labels used by apps (dashboards, forms, etc.).")
|
|
847
847
|
}),
|
|
848
|
-
items: c.array(
|
|
849
|
-
featureLayer:
|
|
848
|
+
items: c.array(bt).describe("ArcGIS items that belong to the solution (apps, maps, layers, etc.)."),
|
|
849
|
+
featureLayer: vt.describe("Primary feature layer item and its schema/layers/tables details.")
|
|
850
850
|
}), _t = c.object({
|
|
851
851
|
op: c.enum(["add", "remove", "replace", "move", "copy"]).describe("RFC 6902 operation type."),
|
|
852
852
|
path: c.string().describe("RFC 6901 JSON Pointer to the target location."),
|
|
853
853
|
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.`),
|
|
854
854
|
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.")
|
|
855
|
-
}),
|
|
855
|
+
}), wt = c.object({
|
|
856
856
|
response: c.string().describe("Conversational response describing the accepted design changes."),
|
|
857
857
|
patches: c.array(_t).describe("Minimal RFC 6902 patch operations needed to update the current design.")
|
|
858
|
-
}),
|
|
858
|
+
}), It = c.object({
|
|
859
859
|
response: c.string().describe("Short, user-friendly explanation of why the requested update was not applied.")
|
|
860
|
-
}),
|
|
860
|
+
}), St = c.object({
|
|
861
861
|
assistantResponse: c.string().describe("Natural-language response for the user."),
|
|
862
862
|
isValidUpdate: c.boolean().describe("True only when the request is in scope for supported design updates.")
|
|
863
|
-
}),
|
|
863
|
+
}), At = c.object({
|
|
864
864
|
matchedTitles: c.array(c.string()).describe("Titles of solutions that match the user's request. Empty array if no strong match.")
|
|
865
|
-
}),
|
|
865
|
+
}), Ct = c.object({
|
|
866
866
|
templateId: c.string().min(1).describe("Template id from the available template list."),
|
|
867
867
|
confidence: c.number().min(0).max(1).describe("Confidence score from 0 to 1 for this template match."),
|
|
868
868
|
templateDescription: c.string().min(1).describe("Short action‑oriented description of the template in the user's use case/workflow, starting with a verb.")
|
|
869
|
-
}),
|
|
869
|
+
}), Tt = c.object({
|
|
870
870
|
assistantResponse: c.string().nullable().describe("Natural-language response for the user."),
|
|
871
871
|
isValidUseCase: c.boolean().describe("True only when the request is concrete, appropriate, and has at least one matching template."),
|
|
872
|
-
matchedTemplates: c.array(
|
|
872
|
+
matchedTemplates: c.array(Ct).describe("Ordered list of matching templates, best match first. Empty when no valid match exists.")
|
|
873
873
|
}), Lt = (s) => s.length ? s.map((e, t) => `${t + 1}. ${e}`).join(`
|
|
874
|
-
`) : "No validation errors were provided.",
|
|
874
|
+
`) : "No validation errors were provided.", Et = async (s) => {
|
|
875
875
|
const {
|
|
876
876
|
query: e,
|
|
877
877
|
validationIssues: t,
|
|
@@ -880,11 +880,11 @@ const bt = c.object({
|
|
|
880
880
|
promptModules: o
|
|
881
881
|
} = s;
|
|
882
882
|
try {
|
|
883
|
-
return (await
|
|
884
|
-
promptText: await
|
|
883
|
+
return (await C({
|
|
884
|
+
promptText: await v(o, "explainValidationFailure"),
|
|
885
885
|
modelTier: "fast",
|
|
886
886
|
temperature: 0,
|
|
887
|
-
schema:
|
|
887
|
+
schema: It,
|
|
888
888
|
messages: i,
|
|
889
889
|
inputVariables: {
|
|
890
890
|
query: e,
|
|
@@ -898,9 +898,9 @@ const bt = c.object({
|
|
|
898
898
|
{ error: a }
|
|
899
899
|
), n;
|
|
900
900
|
}
|
|
901
|
-
}, ee = (s) => s in
|
|
902
|
-
let
|
|
903
|
-
const
|
|
901
|
+
}, ee = (s) => s in N, $t = 5, kt = 0.8, Ft = 0.5, Nt = "Web Mapping Application", Dt = "Embeddings";
|
|
902
|
+
let R = null, V = null, P = null, B = null;
|
|
903
|
+
const Mt = "Build", $ = /* @__PURE__ */ Object.assign({
|
|
904
904
|
"./prompts/assessBuildRequest.md": () => import("../../chunks/assessBuildRequest.js").then((s) => s.default),
|
|
905
905
|
"./prompts/assessUpdateRequest.md": () => import("../../chunks/assessUpdateRequest.js").then((s) => s.default),
|
|
906
906
|
"./prompts/description.md": () => import("../../chunks/description2.js").then((s) => s.default),
|
|
@@ -908,13 +908,13 @@ const Rt = "Build", k = /* @__PURE__ */ Object.assign({
|
|
|
908
908
|
"./prompts/explainValidationFailure.md": () => import("../../chunks/explainValidationFailure.js").then((s) => s.default),
|
|
909
909
|
"./prompts/findExistingSolution.md": () => import("../../chunks/findExistingSolution.js").then((s) => s.default),
|
|
910
910
|
"./prompts/updateDesign.md": () => import("../../chunks/updateDesign.js").then((s) => s.default)
|
|
911
|
-
}),
|
|
911
|
+
}), Rt = ft.builderMessages, m = (s) => s?.signal?.aborted ?? !1, f = (s, e, t) => U(e)?.builderMessages?.[s] ?? Rt[s], Ie = (s) => {
|
|
912
912
|
typeof window < "u" && window.dispatchEvent(new CustomEvent("arcgis-solution-design-update", {
|
|
913
913
|
detail: s
|
|
914
914
|
}));
|
|
915
915
|
}, Pt = async (s, e, t) => {
|
|
916
916
|
if (!s) return null;
|
|
917
|
-
const i = `type:"${
|
|
917
|
+
const i = `type:"${Nt}" AND typekeywords:${Dt} AND group:${s}`;
|
|
918
918
|
return (await Y.searchItems({
|
|
919
919
|
q: i,
|
|
920
920
|
params: e ? { token: e } : void 0,
|
|
@@ -922,27 +922,27 @@ const Rt = "Build", k = /* @__PURE__ */ Object.assign({
|
|
|
922
922
|
num: 1
|
|
923
923
|
}))?.results?.[0] ?? null;
|
|
924
924
|
};
|
|
925
|
-
async function
|
|
925
|
+
async function Bt(s, e, t, i) {
|
|
926
926
|
try {
|
|
927
927
|
const n = await Pt(s, e, t);
|
|
928
|
-
if (!n ||
|
|
928
|
+
if (!n || m(i))
|
|
929
929
|
return null;
|
|
930
|
-
const o = new
|
|
931
|
-
return await o.load(),
|
|
930
|
+
const o = new Ye({ id: n.id });
|
|
931
|
+
return await o.load(), m(i) ? null : await o.fetchData("json");
|
|
932
932
|
} catch {
|
|
933
933
|
return null;
|
|
934
934
|
}
|
|
935
935
|
}
|
|
936
|
-
const
|
|
936
|
+
const qt = async (s, e, t) => {
|
|
937
937
|
if (!s) return [];
|
|
938
|
-
const i = `type:Solution AND typekeywords:${
|
|
938
|
+
const i = `type:Solution AND typekeywords:${Mt} AND group:${s}`;
|
|
939
939
|
return (await Y.searchItems({
|
|
940
940
|
q: i,
|
|
941
941
|
params: e ? { token: e } : void 0,
|
|
942
942
|
portal: t,
|
|
943
943
|
num: 100
|
|
944
944
|
}))?.results ?? [];
|
|
945
|
-
},
|
|
945
|
+
}, Ut = async (s, e, t) => {
|
|
946
946
|
try {
|
|
947
947
|
const i = await Y.getItemData(s, {
|
|
948
948
|
params: e ? { token: e } : void 0,
|
|
@@ -954,7 +954,7 @@ const Ut = async (s, e, t) => {
|
|
|
954
954
|
} catch {
|
|
955
955
|
return null;
|
|
956
956
|
}
|
|
957
|
-
},
|
|
957
|
+
}, k = (s, e = {}) => {
|
|
958
958
|
let t = s;
|
|
959
959
|
return "itemId" in e && (t = {
|
|
960
960
|
...t,
|
|
@@ -986,51 +986,46 @@ const Ut = async (s, e, t) => {
|
|
|
986
986
|
}
|
|
987
987
|
}, te = async (s) => {
|
|
988
988
|
if (V) {
|
|
989
|
-
Object.entries(V).forEach(([
|
|
990
|
-
|
|
989
|
+
Object.entries(V).forEach(([a, r]) => {
|
|
990
|
+
N[a] && (N[a].initialTemplate = r);
|
|
991
991
|
});
|
|
992
992
|
return;
|
|
993
993
|
}
|
|
994
|
-
const e = s?.configurable?.context?.token, t = Ce(s), i =
|
|
994
|
+
const e = s?.configurable?.context?.token, t = Ce(s), i = Te(s);
|
|
995
995
|
if (!t) {
|
|
996
996
|
console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping live template hydration.");
|
|
997
997
|
return;
|
|
998
998
|
}
|
|
999
|
-
const n =
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
return;
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
if (!g || typeof g != "object") return;
|
|
1008
|
-
const u = g.id;
|
|
1009
|
-
if (typeof u != "string" || d[u]) return;
|
|
1010
|
-
const f = await Ot(m.id, e, r);
|
|
1011
|
-
if (!f || h(s))
|
|
999
|
+
const n = await qt(t, e, i), o = {};
|
|
1000
|
+
m(s) || (await Promise.all(n.map(async (a) => {
|
|
1001
|
+
const r = a.properties?.templateInfo;
|
|
1002
|
+
if (!r || typeof r != "object") return;
|
|
1003
|
+
const l = r.id;
|
|
1004
|
+
if (typeof l != "string" || o[l]) return;
|
|
1005
|
+
const d = await Ut(a.id, e, i);
|
|
1006
|
+
if (!d || m(s))
|
|
1012
1007
|
return;
|
|
1013
|
-
const { buildSolution:
|
|
1014
|
-
if (typeof
|
|
1015
|
-
const
|
|
1016
|
-
|
|
1008
|
+
const { buildSolution: h, params: y } = d;
|
|
1009
|
+
if (typeof h == "object" && h !== null && "solution" in h) {
|
|
1010
|
+
const g = h.solution;
|
|
1011
|
+
g.thumbnailUrl = a.thumbnail ? `${i ?? "https://www.arcgis.com/sharing/rest"}/content/items/${a.id}/info/${a.thumbnail}` : void 0, g.item = a;
|
|
1017
1012
|
}
|
|
1018
|
-
const
|
|
1019
|
-
...
|
|
1020
|
-
buildSolution:
|
|
1013
|
+
const u = {
|
|
1014
|
+
...r,
|
|
1015
|
+
buildSolution: h
|
|
1021
1016
|
};
|
|
1022
|
-
|
|
1023
|
-
new pe(
|
|
1017
|
+
o[l] = k(
|
|
1018
|
+
new pe(u).dumpToLlmTemplate(),
|
|
1024
1019
|
{
|
|
1025
|
-
itemId:
|
|
1026
|
-
sourceBuildSolution: structuredClone(
|
|
1027
|
-
params:
|
|
1020
|
+
itemId: a.id,
|
|
1021
|
+
sourceBuildSolution: structuredClone(h),
|
|
1022
|
+
params: y ? structuredClone(y) : null
|
|
1028
1023
|
}
|
|
1029
|
-
),
|
|
1030
|
-
...
|
|
1031
|
-
initialTemplate:
|
|
1024
|
+
), N[l] = {
|
|
1025
|
+
...r,
|
|
1026
|
+
initialTemplate: o[l]
|
|
1032
1027
|
};
|
|
1033
|
-
})), V =
|
|
1028
|
+
})), V = o);
|
|
1034
1029
|
}, Ae = (s) => {
|
|
1035
1030
|
const e = s?.configurable?.context?.token;
|
|
1036
1031
|
return typeof e != "string" || !e.trim() ? null : e;
|
|
@@ -1038,54 +1033,48 @@ const Ut = async (s, e, t) => {
|
|
|
1038
1033
|
const e = s?.configurable?.context?.configContext?.primarySolutionsGroupId;
|
|
1039
1034
|
return typeof e != "string" || !e.trim() ? null : e;
|
|
1040
1035
|
}, Te = (s) => {
|
|
1041
|
-
const e = s?.configurable?.context?.configContext?.agoBasedEnterpriseSolutionsGroupId;
|
|
1042
|
-
return typeof e != "string" || !e.trim() ? null : e;
|
|
1043
|
-
}, Ee = (s) => {
|
|
1044
1036
|
const e = s?.configurable?.context?.configContext?.portalURL;
|
|
1045
1037
|
if (!(typeof e != "string" || !e.trim()))
|
|
1046
1038
|
return `${e.replace(/\/+$/, "")}/sharing/rest`;
|
|
1047
|
-
},
|
|
1039
|
+
}, Ot = async (s) => {
|
|
1048
1040
|
await Promise.all([
|
|
1049
|
-
|
|
1041
|
+
Ee(s),
|
|
1050
1042
|
te(s)
|
|
1051
1043
|
]);
|
|
1052
1044
|
}, Le = async (s) => {
|
|
1053
1045
|
const e = Ae(s);
|
|
1054
|
-
(!P || e && e !==
|
|
1055
|
-
throw P = null,
|
|
1046
|
+
(!P || e && e !== B) && (B = e ?? B, P = Ot(s).catch((i) => {
|
|
1047
|
+
throw P = null, B = null, i;
|
|
1056
1048
|
})), await P;
|
|
1057
1049
|
};
|
|
1058
|
-
async function
|
|
1059
|
-
if (
|
|
1050
|
+
async function Ee(s) {
|
|
1051
|
+
if (R) return R;
|
|
1060
1052
|
const e = Ce(s);
|
|
1061
1053
|
if (!e)
|
|
1062
1054
|
return console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping embeddings load."), null;
|
|
1063
|
-
const t =
|
|
1064
|
-
if (await new
|
|
1055
|
+
const t = Te(s), i = s?.configurable?.context?.configContext?.portalURL;
|
|
1056
|
+
if (await new Xe(i ? { url: i } : void 0).load(), m(s))
|
|
1065
1057
|
return null;
|
|
1066
|
-
const o = Ae(s) ?? void 0, a =
|
|
1067
|
-
|
|
1068
|
-
return console.warn("Solution Builder: missing solutions group ID for embeddings; skipping embeddings load."), null;
|
|
1069
|
-
const m = await qt(l, o, d, s);
|
|
1070
|
-
return h(s) ? null : m ? (B = m.items, B) : null;
|
|
1058
|
+
const o = Ae(s) ?? void 0, a = await Bt(e, o, t, s);
|
|
1059
|
+
return m(s) ? null : a ? (R = a.items, R) : null;
|
|
1071
1060
|
}
|
|
1072
|
-
const
|
|
1061
|
+
const zt = () => Object.entries(N).map(([s, e]) => `ID: ${s}
|
|
1073
1062
|
Label: ${e.label}
|
|
1074
1063
|
Description: ${e.description}`).join(`
|
|
1075
1064
|
|
|
1076
|
-
`),
|
|
1065
|
+
`), jt = (s) => {
|
|
1077
1066
|
const e = s?.configurable?.context?.solutionDesignJson;
|
|
1078
1067
|
if (typeof e != "string" || !e.trim())
|
|
1079
1068
|
return null;
|
|
1080
1069
|
try {
|
|
1081
|
-
const t = JSON.parse(e), i =
|
|
1070
|
+
const t = JSON.parse(e), i = k(
|
|
1082
1071
|
{ response: "", ...t },
|
|
1083
1072
|
{ itemId: t?.solution?.itemId ?? null }
|
|
1084
1073
|
), n = Z.safeParse(i);
|
|
1085
1074
|
if (!n.success)
|
|
1086
1075
|
return null;
|
|
1087
1076
|
const { response: o, ...a } = n.data, r = t.templateId, l = typeof r == "string" && ee(r) ? r : null;
|
|
1088
|
-
return
|
|
1077
|
+
return k(
|
|
1089
1078
|
a,
|
|
1090
1079
|
{
|
|
1091
1080
|
sourceBuildSolution: t.sourceBuildSolution,
|
|
@@ -1096,57 +1085,57 @@ Description: ${e.description}`).join(`
|
|
|
1096
1085
|
} catch {
|
|
1097
1086
|
return null;
|
|
1098
1087
|
}
|
|
1099
|
-
},
|
|
1088
|
+
}, Gt = b.Root({
|
|
1100
1089
|
...X(),
|
|
1101
1090
|
/** Optional human-readable template description retained for UI use. */
|
|
1102
|
-
templateDescription:
|
|
1091
|
+
templateDescription: b({
|
|
1103
1092
|
reducer: (s, e) => typeof e == "string" || e === null ? e : s ?? null,
|
|
1104
1093
|
default: () => null
|
|
1105
1094
|
}),
|
|
1106
1095
|
/** Current editable design payload being refined across turns. */
|
|
1107
|
-
currentDesign:
|
|
1096
|
+
currentDesign: b({
|
|
1108
1097
|
reducer: (s = null, e) => e === void 0 ? s : e ?? null,
|
|
1109
1098
|
default: () => null
|
|
1110
1099
|
}),
|
|
1111
1100
|
/** Initial request assessment produced by the intake prompt. */
|
|
1112
|
-
assessment:
|
|
1101
|
+
assessment: b({
|
|
1113
1102
|
reducer: (s = null, e) => e === void 0 ? s : e ?? null,
|
|
1114
1103
|
default: () => null
|
|
1115
1104
|
}),
|
|
1116
1105
|
/** Template selected automatically or by human-in-the-loop choice. */
|
|
1117
|
-
selectedTemplate:
|
|
1106
|
+
selectedTemplate: b({
|
|
1118
1107
|
reducer: (s = null, e) => e === void 0 ? s : e ?? null,
|
|
1119
1108
|
default: () => null
|
|
1120
1109
|
}),
|
|
1121
1110
|
/** Update request assessment produced when an active design exists. */
|
|
1122
|
-
updateAssessment:
|
|
1111
|
+
updateAssessment: b({
|
|
1123
1112
|
reducer: (s = null, e) => e === void 0 ? s : e ?? null,
|
|
1124
1113
|
default: () => null
|
|
1125
1114
|
}),
|
|
1126
1115
|
/** Existing solution matches surfaced before building a new solution. */
|
|
1127
|
-
existingMatches:
|
|
1116
|
+
existingMatches: b({
|
|
1128
1117
|
reducer: (s = [], e) => e === void 0 ? s : e ?? [],
|
|
1129
1118
|
default: () => []
|
|
1130
1119
|
}),
|
|
1131
1120
|
/** User decision for whether to continue building after existing matches are shown. */
|
|
1132
|
-
continueBuilding:
|
|
1121
|
+
continueBuilding: b({
|
|
1133
1122
|
reducer: (s = null, e) => e === void 0 ? s : e ?? null,
|
|
1134
1123
|
default: () => null
|
|
1135
1124
|
})
|
|
1136
|
-
}),
|
|
1137
|
-
if (
|
|
1125
|
+
}), Jt = (s, e) => {
|
|
1126
|
+
if (m(e))
|
|
1138
1127
|
return {};
|
|
1139
|
-
const t =
|
|
1128
|
+
const t = jt(e), i = t?.templateId ?? null, n = {};
|
|
1140
1129
|
return JSON.stringify(s.currentDesign) !== JSON.stringify(t) && (n.currentDesign = t), i && s.selectedTemplate !== i && (n.selectedTemplate = i), n;
|
|
1141
|
-
},
|
|
1142
|
-
if (
|
|
1130
|
+
}, Ht = async (s, e) => {
|
|
1131
|
+
if (m(e))
|
|
1143
1132
|
return {};
|
|
1144
|
-
await
|
|
1145
|
-
const t = s.agentExecutionContext.userRequest, i =
|
|
1146
|
-
promptText: await
|
|
1133
|
+
await w({ text: f("understandingRequest", e) }, e), await Le(e);
|
|
1134
|
+
const t = s.agentExecutionContext.userRequest, i = zt(), n = s.agentExecutionContext.messages.slice(-11), o = await C({
|
|
1135
|
+
promptText: await v($, "assessBuildRequest"),
|
|
1147
1136
|
modelTier: "advanced",
|
|
1148
1137
|
temperature: 0,
|
|
1149
|
-
schema:
|
|
1138
|
+
schema: Tt,
|
|
1150
1139
|
messages: n,
|
|
1151
1140
|
inputVariables: { query: t, availableTemplates: i }
|
|
1152
1141
|
}), a = o.matchedTemplates.filter(
|
|
@@ -1154,22 +1143,22 @@ Description: ${e.description}`).join(`
|
|
|
1154
1143
|
), r = {
|
|
1155
1144
|
...o,
|
|
1156
1145
|
matchedTemplates: a
|
|
1157
|
-
}, [l, d] = a,
|
|
1146
|
+
}, [l, d] = a, y = !!l && l.confidence >= kt && (d === void 0 || l.confidence - d.confidence >= Ft) ? l.templateId : null;
|
|
1158
1147
|
return {
|
|
1159
1148
|
assessment: r,
|
|
1160
|
-
selectedTemplate:
|
|
1149
|
+
selectedTemplate: y,
|
|
1161
1150
|
existingMatches: [],
|
|
1162
1151
|
continueBuilding: null
|
|
1163
1152
|
};
|
|
1164
|
-
},
|
|
1153
|
+
}, Vt = (s) => {
|
|
1165
1154
|
const e = s.assessment?.assistantResponse ?? "";
|
|
1166
1155
|
return {
|
|
1167
1156
|
outputMessage: e,
|
|
1168
1157
|
summary: e,
|
|
1169
1158
|
status: "success"
|
|
1170
1159
|
};
|
|
1171
|
-
},
|
|
1172
|
-
if (
|
|
1160
|
+
}, Qt = async (s, e) => {
|
|
1161
|
+
if (m(e))
|
|
1173
1162
|
return {};
|
|
1174
1163
|
const { currentDesign: t } = s;
|
|
1175
1164
|
if (!t)
|
|
@@ -1179,14 +1168,14 @@ Description: ${e.description}`).join(`
|
|
|
1179
1168
|
isValidUpdate: !0
|
|
1180
1169
|
}
|
|
1181
1170
|
};
|
|
1182
|
-
await
|
|
1171
|
+
await w({ text: f("understandingRequest", e) }, e);
|
|
1183
1172
|
const i = s.agentExecutionContext.userRequest, n = s.agentExecutionContext.messages.slice(-11);
|
|
1184
1173
|
return {
|
|
1185
|
-
updateAssessment: await
|
|
1186
|
-
promptText: await
|
|
1174
|
+
updateAssessment: await C({
|
|
1175
|
+
promptText: await v($, "assessUpdateRequest"),
|
|
1187
1176
|
modelTier: "advanced",
|
|
1188
1177
|
temperature: 0,
|
|
1189
|
-
schema:
|
|
1178
|
+
schema: St,
|
|
1190
1179
|
messages: n,
|
|
1191
1180
|
inputVariables: {
|
|
1192
1181
|
currentDesign: JSON.stringify(me(t)),
|
|
@@ -1194,15 +1183,15 @@ Description: ${e.description}`).join(`
|
|
|
1194
1183
|
}
|
|
1195
1184
|
})
|
|
1196
1185
|
};
|
|
1197
|
-
},
|
|
1198
|
-
const t = s.updateAssessment?.assistantResponse ??
|
|
1186
|
+
}, Wt = (s, e) => {
|
|
1187
|
+
const t = s.updateAssessment?.assistantResponse ?? f("applyChangeFailed", e);
|
|
1199
1188
|
return {
|
|
1200
1189
|
outputMessage: t,
|
|
1201
1190
|
summary: t,
|
|
1202
1191
|
status: "success"
|
|
1203
1192
|
};
|
|
1204
|
-
},
|
|
1205
|
-
if (
|
|
1193
|
+
}, Kt = (s, e) => {
|
|
1194
|
+
if (m(e))
|
|
1206
1195
|
return {};
|
|
1207
1196
|
const { hitlResponse: t } = e.configurable, i = "selectTemplate", n = s.assessment?.matchedTemplates.filter(
|
|
1208
1197
|
(d) => ee(d.templateId)
|
|
@@ -1212,7 +1201,7 @@ Description: ${e.description}`).join(`
|
|
|
1212
1201
|
agentId: "solutionBuilder",
|
|
1213
1202
|
id: i,
|
|
1214
1203
|
kind: "singleSelection",
|
|
1215
|
-
message:
|
|
1204
|
+
message: f("selectTemplatePrompt", e),
|
|
1216
1205
|
metadata: [...o]
|
|
1217
1206
|
};
|
|
1218
1207
|
throw new de(d);
|
|
@@ -1221,26 +1210,26 @@ Description: ${e.description}`).join(`
|
|
|
1221
1210
|
return {
|
|
1222
1211
|
selectedTemplate: (r >= 0 ? n[r] : void 0)?.templateId ?? n[0]?.templateId ?? null
|
|
1223
1212
|
};
|
|
1224
|
-
},
|
|
1225
|
-
if (
|
|
1213
|
+
}, Xt = async (s, e) => {
|
|
1214
|
+
if (m(e))
|
|
1226
1215
|
return {};
|
|
1227
|
-
await
|
|
1228
|
-
const t = s.agentExecutionContext.userRequest, i = ht(s.agentExecutionContext.messages) || t, n = await
|
|
1229
|
-
if (
|
|
1216
|
+
await w({ text: f("searchingExistingSolutions", e) }, e);
|
|
1217
|
+
const t = s.agentExecutionContext.userRequest, i = ht(s.agentExecutionContext.messages) || t, n = await Ee(e);
|
|
1218
|
+
if (m(e))
|
|
1230
1219
|
return {};
|
|
1231
1220
|
if (!n)
|
|
1232
1221
|
return console.warn("Solutions Search: failed to load solution embeddings cache; skipping search."), { existingMatches: [] };
|
|
1233
1222
|
if (!n.length)
|
|
1234
1223
|
return { existingMatches: [] };
|
|
1235
|
-
const [o] = await
|
|
1236
|
-
if (
|
|
1224
|
+
const [o] = await je([i]);
|
|
1225
|
+
if (m(e))
|
|
1237
1226
|
return {};
|
|
1238
1227
|
const a = n.map((u) => ({
|
|
1239
1228
|
solution: u,
|
|
1240
|
-
score:
|
|
1229
|
+
score: Ge(o, u.embedding)
|
|
1241
1230
|
}));
|
|
1242
|
-
a.sort((u,
|
|
1243
|
-
const r = a.slice(0,
|
|
1231
|
+
a.sort((u, g) => g.score - u.score);
|
|
1232
|
+
const r = a.slice(0, $t);
|
|
1244
1233
|
if (!r.length)
|
|
1245
1234
|
return { existingMatches: [] };
|
|
1246
1235
|
const l = r.map(({ solution: u }) => `${u.title}
|
|
@@ -1248,127 +1237,127 @@ Snippet: ${u.snippet}
|
|
|
1248
1237
|
Description: ${u.description}`).join(`
|
|
1249
1238
|
|
|
1250
1239
|
`), d = s.agentExecutionContext.messages.slice(-11);
|
|
1251
|
-
return { existingMatches: (await
|
|
1252
|
-
promptText: await
|
|
1240
|
+
return { existingMatches: (await C({
|
|
1241
|
+
promptText: await v($, "findExistingSolution"),
|
|
1253
1242
|
modelTier: "fast",
|
|
1254
1243
|
temperature: 0,
|
|
1255
|
-
schema:
|
|
1244
|
+
schema: At,
|
|
1256
1245
|
messages: d,
|
|
1257
1246
|
inputVariables: { query: t, candidates: l }
|
|
1258
|
-
})).matchedTitles.map((u) => r.find(({ solution:
|
|
1259
|
-
},
|
|
1260
|
-
if (
|
|
1247
|
+
})).matchedTitles.map((u) => r.find(({ solution: g }) => g.title === u)).filter((u) => u !== void 0) };
|
|
1248
|
+
}, Yt = (s, e) => {
|
|
1249
|
+
if (m(e))
|
|
1261
1250
|
return {};
|
|
1262
1251
|
const { existingMatches: t } = s, { hitlResponse: i } = e.configurable, n = `confirmExistingSolution:${t[0].solution.id}`;
|
|
1263
1252
|
if (i?.agentId !== "solutionBuilder" || i.id !== n) {
|
|
1264
1253
|
t.length === 1 ? ye(t[0].solution.id) : fe(t);
|
|
1265
|
-
const l =
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
],
|
|
1254
|
+
const l = f("existingSolutionMatch", e), d = [
|
|
1255
|
+
f("continueBuildingYes", e),
|
|
1256
|
+
f("continueBuildingNo", e)
|
|
1257
|
+
], h = {
|
|
1269
1258
|
agentId: "solutionBuilder",
|
|
1270
1259
|
id: n,
|
|
1271
1260
|
kind: "singleSelection",
|
|
1272
1261
|
message: l,
|
|
1273
1262
|
metadata: d
|
|
1274
1263
|
};
|
|
1275
|
-
throw new de(
|
|
1264
|
+
throw new de(h);
|
|
1276
1265
|
}
|
|
1277
|
-
const o = String(i.payload ?? "").trim(), a =
|
|
1266
|
+
const o = String(i.payload ?? "").trim(), a = f("continueBuildingNo", e);
|
|
1278
1267
|
return { continueBuilding: o !== a };
|
|
1279
|
-
},
|
|
1280
|
-
const t =
|
|
1268
|
+
}, Zt = (s, e) => {
|
|
1269
|
+
const t = f("continueBuildingDeclined", e);
|
|
1281
1270
|
return {
|
|
1282
1271
|
outputMessage: t,
|
|
1283
1272
|
summary: t,
|
|
1284
1273
|
status: "success"
|
|
1285
1274
|
};
|
|
1286
|
-
},
|
|
1287
|
-
if (
|
|
1275
|
+
}, $e = async (s, e) => {
|
|
1276
|
+
if (m(e))
|
|
1288
1277
|
return {};
|
|
1289
|
-
if (await Le(e),
|
|
1278
|
+
if (await Le(e), m(e))
|
|
1290
1279
|
return {};
|
|
1291
1280
|
const { currentDesign: t } = s, i = s.agentExecutionContext.userRequest;
|
|
1292
|
-
await
|
|
1293
|
-
let n =
|
|
1294
|
-
if (n?.initialTemplate || (await te(e), n =
|
|
1281
|
+
await w({ text: f("creatingDesign", e) }, e);
|
|
1282
|
+
let n = q(s.selectedTemplate);
|
|
1283
|
+
if (n?.initialTemplate || (await te(e), n = q(s.selectedTemplate)), m(e))
|
|
1295
1284
|
return {};
|
|
1296
1285
|
if (!n?.initialTemplate)
|
|
1297
1286
|
throw new Error("No hydrated templates are available for solution design.");
|
|
1298
|
-
const o =
|
|
1287
|
+
const o = k(
|
|
1299
1288
|
t ?? n.initialTemplate,
|
|
1300
1289
|
{
|
|
1301
1290
|
itemId: (t ?? n.initialTemplate)?.solution?.itemId ?? null,
|
|
1302
1291
|
sourceBuildSolution: t?.sourceBuildSolution ?? n.initialTemplate.sourceBuildSolution,
|
|
1303
1292
|
params: t?.params ?? n.initialTemplate.params ?? null
|
|
1304
1293
|
}
|
|
1305
|
-
), a = s.agentExecutionContext.messages.slice(-11), r = await
|
|
1306
|
-
promptText: await
|
|
1294
|
+
), a = s.agentExecutionContext.messages.slice(-11), r = await C({
|
|
1295
|
+
promptText: await v($, "designSolution"),
|
|
1307
1296
|
modelTier: "advanced",
|
|
1308
1297
|
temperature: 0,
|
|
1309
1298
|
schema: Z,
|
|
1310
1299
|
messages: a,
|
|
1311
1300
|
inputVariables: {
|
|
1312
|
-
currentDesign: JSON.stringify(
|
|
1301
|
+
currentDesign: JSON.stringify(he(o)),
|
|
1313
1302
|
templateInstructions: n.instructions,
|
|
1314
1303
|
query: i
|
|
1315
1304
|
}
|
|
1316
1305
|
});
|
|
1317
|
-
if (await
|
|
1306
|
+
if (await w({ text: " of design solution 1" }, e), m(e))
|
|
1318
1307
|
return {};
|
|
1319
|
-
const { response: l, featureLayer: d, ...
|
|
1308
|
+
const { response: l, featureLayer: d, ...h } = r, y = ge(
|
|
1320
1309
|
d,
|
|
1321
1310
|
o.featureLayer
|
|
1322
|
-
), u =
|
|
1323
|
-
{ ...
|
|
1311
|
+
), u = k(
|
|
1312
|
+
{ ...h, featureLayer: y },
|
|
1324
1313
|
{
|
|
1325
1314
|
itemId: o?.solution?.itemId,
|
|
1326
1315
|
sourceBuildSolution: o.sourceBuildSolution,
|
|
1327
1316
|
templateId: s.selectedTemplate ?? null,
|
|
1328
1317
|
params: o.params ?? null
|
|
1329
1318
|
}
|
|
1330
|
-
),
|
|
1331
|
-
if (!
|
|
1319
|
+
), g = new x(u, n.initialTemplate);
|
|
1320
|
+
if (!g.isValid)
|
|
1332
1321
|
return console.warn(
|
|
1333
1322
|
"[SolutionBuilder] designSolution validation failed:",
|
|
1334
|
-
{ issues:
|
|
1323
|
+
{ issues: g.issues, llmResponse: r }
|
|
1335
1324
|
), {
|
|
1336
|
-
outputMessage:
|
|
1325
|
+
outputMessage: f("createDesignFailed", e)
|
|
1337
1326
|
};
|
|
1338
|
-
const
|
|
1339
|
-
if (!
|
|
1327
|
+
const I = u.sourceBuildSolution, F = Se(u, I);
|
|
1328
|
+
if (!F.ok) {
|
|
1340
1329
|
console.warn(
|
|
1341
1330
|
"[SolutionBuilder] designSolution Esri JSON conversion failed:",
|
|
1342
|
-
{ error:
|
|
1331
|
+
{ error: F.error, llmResponse: r, design: u }
|
|
1343
1332
|
);
|
|
1344
|
-
const
|
|
1333
|
+
const T = f("createDesignFailed", e);
|
|
1345
1334
|
return {
|
|
1346
|
-
outputMessage:
|
|
1347
|
-
summary:
|
|
1335
|
+
outputMessage: T,
|
|
1336
|
+
summary: T,
|
|
1348
1337
|
status: "success"
|
|
1349
1338
|
};
|
|
1350
1339
|
}
|
|
1351
|
-
return
|
|
1340
|
+
return m(e) ? {} : (Ie(u), {
|
|
1352
1341
|
outputMessage: l,
|
|
1353
1342
|
summary: l,
|
|
1354
1343
|
status: "success",
|
|
1355
1344
|
currentDesign: u
|
|
1356
1345
|
});
|
|
1357
|
-
},
|
|
1358
|
-
if (
|
|
1346
|
+
}, es = async (s, e) => {
|
|
1347
|
+
if (m(e))
|
|
1359
1348
|
return {};
|
|
1360
1349
|
const { currentDesign: t } = s;
|
|
1361
1350
|
if (!t)
|
|
1362
|
-
return
|
|
1351
|
+
return $e(s, e);
|
|
1363
1352
|
const i = s.agentExecutionContext.userRequest, n = s.agentExecutionContext.messages.slice(-11);
|
|
1364
|
-
await
|
|
1353
|
+
await w({ text: f("updatingDesign", e) }, e);
|
|
1365
1354
|
let o;
|
|
1366
1355
|
try {
|
|
1367
|
-
o = await
|
|
1368
|
-
promptText: await
|
|
1356
|
+
o = await C({
|
|
1357
|
+
promptText: await v($, "updateDesign"),
|
|
1369
1358
|
modelTier: "advanced",
|
|
1370
1359
|
temperature: 0,
|
|
1371
|
-
schema:
|
|
1360
|
+
schema: wt,
|
|
1372
1361
|
messages: n,
|
|
1373
1362
|
inputVariables: {
|
|
1374
1363
|
currentDesign: JSON.stringify(me(t)),
|
|
@@ -1377,7 +1366,7 @@ Description: ${u.description}`).join(`
|
|
|
1377
1366
|
});
|
|
1378
1367
|
} catch (p) {
|
|
1379
1368
|
console.warn("[SolutionBuilder] updateDesign structured prompt failed:", p);
|
|
1380
|
-
const _ =
|
|
1369
|
+
const _ = f("applyChangeFailed", e);
|
|
1381
1370
|
return {
|
|
1382
1371
|
outputMessage: _,
|
|
1383
1372
|
summary: _,
|
|
@@ -1418,49 +1407,49 @@ Description: ${u.description}`).join(`
|
|
|
1418
1407
|
return p;
|
|
1419
1408
|
}
|
|
1420
1409
|
}
|
|
1421
|
-
},
|
|
1410
|
+
}, h = [...r.map((p) => ({
|
|
1422
1411
|
op: p.op,
|
|
1423
1412
|
path: p.path.replace(/\/+$/, ""),
|
|
1424
1413
|
...p.value != null && p.value !== "" ? { value: l(p.value) } : {},
|
|
1425
1414
|
...p.from != null && p.from !== "" ? { from: p.from } : {}
|
|
1426
|
-
}))].sort((p, _) => p.op !== "remove" || _.op !== "remove" ? 0 : _.path.localeCompare(p.path, void 0, { numeric: !0 })),
|
|
1427
|
-
|
|
1415
|
+
}))].sort((p, _) => p.op !== "remove" || _.op !== "remove" ? 0 : _.path.localeCompare(p.path, void 0, { numeric: !0 })), y = structuredClone(
|
|
1416
|
+
he(t)
|
|
1428
1417
|
);
|
|
1429
1418
|
try {
|
|
1430
|
-
|
|
1419
|
+
He(y, h, !0);
|
|
1431
1420
|
} catch (p) {
|
|
1432
1421
|
console.warn(
|
|
1433
1422
|
"[SolutionBuilder] updateDesign JSON patch failed:",
|
|
1434
|
-
{ error: p, llmResponse: o, patches:
|
|
1423
|
+
{ error: p, llmResponse: o, patches: h, patchTarget: y }
|
|
1435
1424
|
);
|
|
1436
|
-
const _ =
|
|
1425
|
+
const _ = f("applyChangeFailed", e);
|
|
1437
1426
|
return {
|
|
1438
1427
|
outputMessage: _,
|
|
1439
1428
|
summary: _,
|
|
1440
1429
|
status: "success"
|
|
1441
1430
|
};
|
|
1442
1431
|
}
|
|
1443
|
-
const u =
|
|
1444
|
-
{ response: "", ...
|
|
1432
|
+
const u = k(
|
|
1433
|
+
{ response: "", ...y },
|
|
1445
1434
|
{ itemId: t.solution?.itemId ?? null }
|
|
1446
|
-
),
|
|
1447
|
-
if (!
|
|
1435
|
+
), g = Z.safeParse(u);
|
|
1436
|
+
if (!g.success) {
|
|
1448
1437
|
console.warn(
|
|
1449
1438
|
"[SolutionBuilder] updateDesign schema validation failed:",
|
|
1450
|
-
{ errors:
|
|
1439
|
+
{ errors: g.error.issues, llmResponse: o, patchedDesign: u }
|
|
1451
1440
|
);
|
|
1452
|
-
const p =
|
|
1441
|
+
const p = f("applyChangeFailed", e);
|
|
1453
1442
|
return {
|
|
1454
1443
|
outputMessage: p,
|
|
1455
1444
|
summary: p,
|
|
1456
1445
|
status: "success"
|
|
1457
1446
|
};
|
|
1458
1447
|
}
|
|
1459
|
-
const { response:
|
|
1460
|
-
|
|
1448
|
+
const { response: I, featureLayer: F, ...T } = g.data, z = ge(
|
|
1449
|
+
F,
|
|
1461
1450
|
t.featureLayer
|
|
1462
|
-
),
|
|
1463
|
-
{ ...
|
|
1451
|
+
), S = k(
|
|
1452
|
+
{ ...T, featureLayer: z },
|
|
1464
1453
|
{
|
|
1465
1454
|
itemId: t.solution?.itemId,
|
|
1466
1455
|
sourceBuildSolution: t.sourceBuildSolution,
|
|
@@ -1468,23 +1457,23 @@ Description: ${u.description}`).join(`
|
|
|
1468
1457
|
params: t.params ?? null
|
|
1469
1458
|
}
|
|
1470
1459
|
);
|
|
1471
|
-
let
|
|
1472
|
-
if (
|
|
1460
|
+
let D = q(s.selectedTemplate);
|
|
1461
|
+
if (D?.initialTemplate || (await te(e), D = q(s.selectedTemplate)), m(e))
|
|
1473
1462
|
return {};
|
|
1474
|
-
if (!
|
|
1463
|
+
if (!D?.initialTemplate)
|
|
1475
1464
|
throw new Error("No hydrated templates are available for solution design.");
|
|
1476
|
-
const j = new
|
|
1465
|
+
const j = new x(S, D.initialTemplate, !1);
|
|
1477
1466
|
if (!j.isValid) {
|
|
1478
1467
|
console.warn(
|
|
1479
1468
|
"[SolutionBuilder] updateDesign validation failed:",
|
|
1480
|
-
{ issues: j.issues, llmResponse: o, patchedDesign:
|
|
1469
|
+
{ issues: j.issues, llmResponse: o, patchedDesign: S }
|
|
1481
1470
|
);
|
|
1482
|
-
const p = await
|
|
1471
|
+
const p = await Et({
|
|
1483
1472
|
query: i,
|
|
1484
1473
|
validationIssues: j.issues,
|
|
1485
1474
|
recentMessages: n,
|
|
1486
|
-
fallbackMessage:
|
|
1487
|
-
promptModules:
|
|
1475
|
+
fallbackMessage: f("applyChangeFailed", e),
|
|
1476
|
+
promptModules: $
|
|
1488
1477
|
});
|
|
1489
1478
|
return {
|
|
1490
1479
|
outputMessage: p,
|
|
@@ -1492,52 +1481,52 @@ Description: ${u.description}`).join(`
|
|
|
1492
1481
|
status: "success"
|
|
1493
1482
|
};
|
|
1494
1483
|
}
|
|
1495
|
-
const
|
|
1484
|
+
const Fe = S.sourceBuildSolution, ne = Se(S, Fe);
|
|
1496
1485
|
if (!ne.ok) {
|
|
1497
1486
|
console.warn(
|
|
1498
1487
|
"[SolutionBuilder] updateDesign Esri JSON conversion failed:",
|
|
1499
|
-
{ error: ne.error, llmResponse: o, design:
|
|
1488
|
+
{ error: ne.error, llmResponse: o, design: S }
|
|
1500
1489
|
);
|
|
1501
|
-
const p =
|
|
1490
|
+
const p = f("applyChangeFailed", e);
|
|
1502
1491
|
return {
|
|
1503
1492
|
outputMessage: p,
|
|
1504
1493
|
summary: p,
|
|
1505
1494
|
status: "success"
|
|
1506
1495
|
};
|
|
1507
1496
|
}
|
|
1508
|
-
return
|
|
1497
|
+
return m(e) ? {} : (Ie(S), {
|
|
1509
1498
|
outputMessage: a,
|
|
1510
1499
|
summary: a,
|
|
1511
1500
|
status: "success",
|
|
1512
|
-
currentDesign:
|
|
1501
|
+
currentDesign: S
|
|
1513
1502
|
});
|
|
1514
|
-
},
|
|
1503
|
+
}, 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, {
|
|
1515
1504
|
assessUpdateRequest: "assessUpdateRequest",
|
|
1516
1505
|
assessBuildRequest: "assessBuildRequest"
|
|
1517
|
-
}).addConditionalEdges("assessUpdateRequest",
|
|
1506
|
+
}).addConditionalEdges("assessUpdateRequest", ss, {
|
|
1518
1507
|
invalidUpdateExit: "invalidUpdateExit",
|
|
1519
1508
|
updateDesign: "updateDesign"
|
|
1520
|
-
}).addConditionalEdges("assessBuildRequest",
|
|
1509
|
+
}).addConditionalEdges("assessBuildRequest", is, {
|
|
1521
1510
|
invalidBuildExit: "invalidBuildExit",
|
|
1522
1511
|
selectTemplateHIL: "selectTemplateHIL",
|
|
1523
1512
|
findExistingSolutions: "findExistingSolutions"
|
|
1524
|
-
}).addEdge("invalidBuildExit",
|
|
1513
|
+
}).addEdge("invalidBuildExit", A).addEdge("invalidUpdateExit", A).addEdge("selectTemplateHIL", "findExistingSolutions").addConditionalEdges("findExistingSolutions", ns, {
|
|
1525
1514
|
confirmContinueBuildingHIL: "confirmContinueBuildingHIL",
|
|
1526
1515
|
designSolution: "designSolution"
|
|
1527
|
-
}).addConditionalEdges("confirmContinueBuildingHIL",
|
|
1516
|
+
}).addConditionalEdges("confirmContinueBuildingHIL", os, {
|
|
1528
1517
|
declineContinueBuildingExit: "declineContinueBuildingExit",
|
|
1529
1518
|
designSolution: "designSolution"
|
|
1530
|
-
}).addEdge("declineContinueBuildingExit",
|
|
1531
|
-
await
|
|
1532
|
-
const
|
|
1533
|
-
tool:
|
|
1534
|
-
confidence:
|
|
1535
|
-
rationale:
|
|
1536
|
-
}),
|
|
1519
|
+
}).addEdge("declineContinueBuildingExit", A).addEdge("designSolution", A).addEdge("updateDesign", A);
|
|
1520
|
+
await v($, "description");
|
|
1521
|
+
const rs = E.object({
|
|
1522
|
+
tool: E.enum(["explorer", "builder", "other"]).describe("The selected tool based on the user’s intent using the conversation context."),
|
|
1523
|
+
confidence: E.number().min(0).max(1).describe("A confidence score (0.00–1.00)."),
|
|
1524
|
+
rationale: E.string().min(1).describe("A brief rationale for the tool choice (≤140 characters)")
|
|
1525
|
+
}), O = (s) => s?.signal?.aborted ?? !1, se = /* @__PURE__ */ Object.assign({
|
|
1537
1526
|
"./prompts/assistantResponse.md": () => import("../../chunks/assistantResponse.js").then((s) => s.default),
|
|
1538
1527
|
"./prompts/classifyIntent.md": () => import("../../chunks/classifyIntent.js").then((s) => s.default),
|
|
1539
1528
|
"./prompts/description.md": () => import("../../chunks/description.js").then((s) => s.default)
|
|
1540
|
-
}),
|
|
1529
|
+
}), ls = (s) => {
|
|
1541
1530
|
const e = s?.configurable?.context?.solutionDesignJson, t = s?.configurable?.context?.lastTurnAgent, i = t === "assistant" ? "other" : t;
|
|
1542
1531
|
let n = !1;
|
|
1543
1532
|
if (typeof e == "string" && e.trim())
|
|
@@ -1554,29 +1543,29 @@ const ls = $.object({
|
|
|
1554
1543
|
detail: { finished: !0, agent: e }
|
|
1555
1544
|
});
|
|
1556
1545
|
window.dispatchEvent(i);
|
|
1557
|
-
},
|
|
1546
|
+
}, ke = b.Root({
|
|
1558
1547
|
...X(),
|
|
1559
|
-
selectedTool:
|
|
1548
|
+
selectedTool: b({
|
|
1560
1549
|
reducer: (s, e) => e ?? null,
|
|
1561
1550
|
default: () => null
|
|
1562
1551
|
}),
|
|
1563
|
-
intentRationale:
|
|
1552
|
+
intentRationale: b({
|
|
1564
1553
|
reducer: (s, e) => e ?? null,
|
|
1565
1554
|
default: () => null
|
|
1566
1555
|
})
|
|
1567
|
-
}),
|
|
1568
|
-
if (
|
|
1556
|
+
}), cs = async (s, e) => {
|
|
1557
|
+
if (O(e))
|
|
1569
1558
|
return {};
|
|
1570
|
-
const t =
|
|
1571
|
-
await
|
|
1559
|
+
const t = U(e);
|
|
1560
|
+
await w(
|
|
1572
1561
|
{ text: t?.builderMessages.understandingRequest },
|
|
1573
1562
|
e
|
|
1574
1563
|
);
|
|
1575
|
-
const i = s.agentExecutionContext.userRequest, n = s.agentExecutionContext.messages.slice(-11), { activeSolutionDesign: o, lastTool: a } =
|
|
1564
|
+
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({
|
|
1576
1565
|
promptText: r,
|
|
1577
1566
|
modelTier: "advanced",
|
|
1578
1567
|
temperature: 0,
|
|
1579
|
-
schema:
|
|
1568
|
+
schema: rs,
|
|
1580
1569
|
messages: n,
|
|
1581
1570
|
inputVariables: { query: i, activeSolutionDesign: o, lastTool: a }
|
|
1582
1571
|
});
|
|
@@ -1584,25 +1573,25 @@ const ls = $.object({
|
|
|
1584
1573
|
selectedTool: l.tool,
|
|
1585
1574
|
intentRationale: l.rationale
|
|
1586
1575
|
};
|
|
1587
|
-
},
|
|
1588
|
-
if (
|
|
1576
|
+
}, us = async (s, e) => {
|
|
1577
|
+
if (O(e))
|
|
1589
1578
|
return {};
|
|
1590
|
-
const i = await
|
|
1579
|
+
const i = await lt().compile().invoke(s, e);
|
|
1591
1580
|
return ie(e, "explorer"), i;
|
|
1592
|
-
},
|
|
1593
|
-
if (
|
|
1581
|
+
}, ds = async (s, e) => {
|
|
1582
|
+
if (O(e))
|
|
1594
1583
|
return {};
|
|
1595
|
-
const i = await
|
|
1584
|
+
const i = await as().compile().invoke(s, e);
|
|
1596
1585
|
return ie(e, "builder"), i;
|
|
1597
|
-
},
|
|
1598
|
-
if (
|
|
1586
|
+
}, ps = async (s, e) => {
|
|
1587
|
+
if (O(e))
|
|
1599
1588
|
return {};
|
|
1600
|
-
const t =
|
|
1601
|
-
await
|
|
1589
|
+
const t = U(e), i = s.agentExecutionContext.userRequest;
|
|
1590
|
+
await w(
|
|
1602
1591
|
{ text: t?.executingSolutionsAssistantAgent },
|
|
1603
1592
|
e
|
|
1604
1593
|
);
|
|
1605
|
-
const n = await
|
|
1594
|
+
const n = await v(se, "assistantResponse"), o = s.agentExecutionContext.messages.slice(-11), a = await Je({
|
|
1606
1595
|
promptText: n,
|
|
1607
1596
|
modelTier: "advanced",
|
|
1608
1597
|
temperature: 0,
|
|
@@ -1614,31 +1603,31 @@ const ls = $.object({
|
|
|
1614
1603
|
summary: a,
|
|
1615
1604
|
status: "success"
|
|
1616
1605
|
};
|
|
1617
|
-
},
|
|
1606
|
+
}, 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, {
|
|
1618
1607
|
explorer: "routeToExplorer",
|
|
1619
1608
|
builder: "routeToBuilder",
|
|
1620
1609
|
other: "assistantResponse"
|
|
1621
|
-
}).addEdge("routeToExplorer",
|
|
1610
|
+
}).addEdge("routeToExplorer", A).addEdge("routeToBuilder", A).addEdge("assistantResponse", A), gs = await v(se, "description"), fs = {
|
|
1622
1611
|
id: "solutionsAssistant",
|
|
1623
1612
|
name: "Solutions Assistant Agent",
|
|
1624
|
-
description:
|
|
1613
|
+
description: gs,
|
|
1625
1614
|
createGraph: hs,
|
|
1626
|
-
workspace:
|
|
1627
|
-
},
|
|
1628
|
-
class
|
|
1615
|
+
workspace: ke
|
|
1616
|
+
}, ys = "https://links.esri.com/solutions/agol-organizational-account", bs = "https://links.esri.com/solutions/configure-assistants";
|
|
1617
|
+
class xs extends Me {
|
|
1629
1618
|
constructor() {
|
|
1630
1619
|
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 = {
|
|
1631
1620
|
aiAssistantsEnabled: !1,
|
|
1632
1621
|
blockBetaApps: !0,
|
|
1633
1622
|
colocateCompute: !1
|
|
1634
|
-
}, this._suggestedPrompts = [], this._hasInteracted = !1, this._isMobile = window.innerWidth <= 800, this._translations =
|
|
1635
|
-
context:
|
|
1623
|
+
}, 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({
|
|
1624
|
+
context: Be,
|
|
1636
1625
|
subscribe: !0,
|
|
1637
1626
|
callback: (e) => {
|
|
1638
1627
|
e?.portalURL && (G.portalUrl = e.portalURL), e?.userSession && !this.userFirstName && this._loadUserFirstName(), e?.authentication?.PortalSubset?.orgSettings && (this._orgSettings = e?.authentication?.PortalSubset?.orgSettings);
|
|
1639
1628
|
}
|
|
1640
1629
|
}), this._builderDesignContextConsumer = le({
|
|
1641
|
-
context:
|
|
1630
|
+
context: qe,
|
|
1642
1631
|
subscribe: !0,
|
|
1643
1632
|
callback: (e) => {
|
|
1644
1633
|
e?.design && (this._solutionDesignJson = JSON.stringify(e.design, null, 2));
|
|
@@ -1650,9 +1639,9 @@ class vs extends Re {
|
|
|
1650
1639
|
if (t.detail?.finished && this._chatStartTime !== null) {
|
|
1651
1640
|
const i = t.detail.agent;
|
|
1652
1641
|
this._lastResponseAgent = i, this._pendingResponseAgent = i;
|
|
1653
|
-
const n =
|
|
1642
|
+
const n = Ue(this._chatStartTime);
|
|
1654
1643
|
this._telemetry?.logEvent({
|
|
1655
|
-
category:
|
|
1644
|
+
category: M.ASSISTANT,
|
|
1656
1645
|
action: "Chat",
|
|
1657
1646
|
dimensions: [i],
|
|
1658
1647
|
metrics: [n]
|
|
@@ -1684,7 +1673,7 @@ class vs extends Re {
|
|
|
1684
1673
|
this.properties = { open: 5, userFirstName: 1, builderVisible: 5, hasActiveBuilderDesign: 5, _conversationId: 16, _lastTurnAgent: 16, _lastResponseAgent: 16, _orgSettings: 16, _suggestedPrompts: 16, _hasInteracted: 16, _isMobile: 16, _translations: 16, _builderWidth: 16, _solutionDesignJson: 16, _isAssistantBusy: 16, _isBuilderBusy: 16, _preChatCheck: 16, _showNewChatConfirm: 16 };
|
|
1685
1674
|
}
|
|
1686
1675
|
static {
|
|
1687
|
-
this.styles =
|
|
1676
|
+
this.styles = Ze;
|
|
1688
1677
|
}
|
|
1689
1678
|
get _telemetry() {
|
|
1690
1679
|
return this._configContextConsumer.value?.telemetrySession;
|
|
@@ -1705,19 +1694,19 @@ class vs extends Re {
|
|
|
1705
1694
|
this._loadUserFirstName();
|
|
1706
1695
|
}
|
|
1707
1696
|
willUpdate(e) {
|
|
1708
|
-
e.has("open") && this.open && window.dispatchEvent(new CustomEvent("openAssistant")), this._configContextConsumer.value?.authentication && this._configContextConsumer.value?.userSession?.token && (this._preChatCheck || (
|
|
1697
|
+
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;
|
|
1709
1698
|
}
|
|
1710
1699
|
_renderNoSign() {
|
|
1711
1700
|
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>`;
|
|
1712
1701
|
}
|
|
1713
1702
|
_renderNoPermission() {
|
|
1714
|
-
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}}",
|
|
1703
|
+
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>`;
|
|
1715
1704
|
}
|
|
1716
1705
|
render() {
|
|
1717
1706
|
let e = this._suggestedPrompts.length > 0 ? this._suggestedPrompts : this._hasInteracted ? [] : Object.values(this._translations.defaultFollowUpQuestions);
|
|
1718
1707
|
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=${() => {
|
|
1719
1708
|
this._telemetry?.logEvent({
|
|
1720
|
-
category:
|
|
1709
|
+
category: M.ASSISTANT,
|
|
1721
1710
|
action: "Toggle Builder Panel",
|
|
1722
1711
|
dimensions: [this.builderVisible ? "Close" : "Open"]
|
|
1723
1712
|
}), window.dispatchEvent(new CustomEvent("toggleSolutionBuilder"));
|
|
@@ -1738,13 +1727,13 @@ class vs extends Re {
|
|
|
1738
1727
|
requestAnimationFrame(() => i(1));
|
|
1739
1728
|
}
|
|
1740
1729
|
this.assistantProcessing.emit(!1);
|
|
1741
|
-
}} ${
|
|
1730
|
+
}} ${ze(this._assistantRef)}><calcite-button appearance=transparent id=newChatButton icon-start=speech-bubble-plus kind=neutral .label=${this._translations.tooltips.newChat} @click=${() => {
|
|
1742
1731
|
this.hasActiveBuilderDesign ? this._showNewChatConfirm = !0 : (this._telemetry?.logEvent({
|
|
1743
|
-
category:
|
|
1732
|
+
category: M.ASSISTANT,
|
|
1744
1733
|
action: "New Chat",
|
|
1745
1734
|
dimensions: ["No Active Design"]
|
|
1746
1735
|
}), this._clearConversation());
|
|
1747
|
-
}} round scale=m slot=entry-actions-start>${this._translations.tooltips.newChat}</calcite-button><arcgis-assistant-agent .agent=${
|
|
1736
|
+
}} round scale=m slot=entry-actions-start>${this._translations.tooltips.newChat}</calcite-button><arcgis-assistant-agent .agent=${fs} .context=${{
|
|
1748
1737
|
token: this._configContextConsumer.value?.userSession?.token,
|
|
1749
1738
|
configContext: this._configContextConsumer.value,
|
|
1750
1739
|
convoId: this._conversationId,
|
|
@@ -1766,7 +1755,7 @@ class vs extends Re {
|
|
|
1766
1755
|
this._showNewChatConfirm = !1;
|
|
1767
1756
|
}} slot=footer-end>${this._translations.cancel}</calcite-button><calcite-button appearance=solid kind=danger @click=${() => {
|
|
1768
1757
|
this._telemetry?.logEvent({
|
|
1769
|
-
category:
|
|
1758
|
+
category: M.ASSISTANT,
|
|
1770
1759
|
action: "New Chat",
|
|
1771
1760
|
dimensions: ["With Design Discard"]
|
|
1772
1761
|
}), this._showNewChatConfirm = !1, window.dispatchEvent(new CustomEvent("requestBuilderDiscard"));
|
|
@@ -1810,14 +1799,14 @@ class vs extends Re {
|
|
|
1810
1799
|
return !1;
|
|
1811
1800
|
}
|
|
1812
1801
|
_parseAgentPickedAndTask(e) {
|
|
1813
|
-
const t = Array.from(this._assistantRef.value?.messages || []), i = e.log || [], a = [...t].sort((u,
|
|
1802
|
+
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;
|
|
1814
1803
|
if (!r)
|
|
1815
1804
|
return { agentPicked: null, taskAssigned: null, userMessage: a };
|
|
1816
1805
|
const l = /Agent picked:\s*(.*?)\s*(?:\\n|\r?\n)\s*Task Assigned:\s*([\s\S]*)$/i, d = r.match(l);
|
|
1817
1806
|
if (!d)
|
|
1818
1807
|
return { agentPicked: null, taskAssigned: null, userMessage: a };
|
|
1819
|
-
const
|
|
1820
|
-
return { agentPicked:
|
|
1808
|
+
const h = d[1].trim(), y = d[2].trim();
|
|
1809
|
+
return { agentPicked: h, taskAssigned: y, userMessage: a };
|
|
1821
1810
|
}
|
|
1822
1811
|
_emitItemIdFromAI(e) {
|
|
1823
1812
|
const t = new CustomEvent("solutionIDFromAssistant", {
|
|
@@ -1828,7 +1817,7 @@ class vs extends Re {
|
|
|
1828
1817
|
window.dispatchEvent(t);
|
|
1829
1818
|
}
|
|
1830
1819
|
}
|
|
1831
|
-
|
|
1820
|
+
Ne("arcgis-solutions-assistant", xs);
|
|
1832
1821
|
export {
|
|
1833
|
-
|
|
1822
|
+
xs as ArcgisSolutionsAssistant
|
|
1834
1823
|
};
|