@esri/solutions-components 5.1.0-next.156 → 5.1.0-next.158
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/{L2XO4YLV.js → 4SABCB6V.js} +1 -1
- package/dist/cdn/{ALQFRJNC.js → 57DEUKTH.js} +1 -1
- package/dist/cdn/{OL5LAOD5.js → 67UYAVGW.js} +1 -1
- package/dist/cdn/{GJ7QMCFT.js → 7HJCFDJN.js} +1 -1
- package/dist/cdn/{FS5WR74E.js → A4RRYLNO.js} +1 -1
- package/dist/cdn/{IR55PBAU.js → AHYKJXK2.js} +1 -1
- package/dist/cdn/{WAJG744H.js → AUZDYI27.js} +1 -1
- package/dist/cdn/{DQ7I7HGP.js → BRARQOMY.js} +1 -1
- package/dist/cdn/{ENTBR5YC.js → C5PGLCTJ.js} +1 -1
- package/dist/cdn/{G5PL37M5.js → CA4YH6B3.js} +1 -1
- package/dist/cdn/{IMJTIIHG.js → CM5MBWMG.js} +1 -1
- package/dist/cdn/{EKFKOS5K.js → CPAUDT36.js} +1 -1
- package/dist/cdn/{ARFCWGCB.js → CRDJXHSQ.js} +1 -1
- package/dist/cdn/{HS55CSUO.js → CTREZRNZ.js} +1 -1
- package/dist/cdn/{6RTL3IJQ.js → DOHGEFCF.js} +1 -1
- package/dist/cdn/EDNQFSEX.js +3 -0
- package/dist/cdn/EJQJPFFI.js +46 -0
- package/dist/cdn/EW4MNCWO.js +2 -0
- package/dist/cdn/{I3A27HFS.js → F7FCYGIB.js} +1 -1
- package/dist/cdn/{7LKPG6HJ.js → FE7HMUSZ.js} +1 -1
- package/dist/cdn/{QCCLUBLV.js → HGONAEKC.js} +1 -1
- package/dist/cdn/{IBAJ7OFO.js → HIGIIHUC.js} +1 -1
- package/dist/cdn/HXAKVGDN.js +2 -0
- package/dist/cdn/{UBEU6ULP.js → IEAOGMAM.js} +1 -1
- package/dist/cdn/{7CZG6NDM.js → JQ7K6OQ5.js} +1 -1
- package/dist/cdn/{AKQEDHUS.js → K6P6WBLX.js} +1 -1
- package/dist/cdn/{LOPXSWVG.js → KFUO64SR.js} +1 -1
- package/dist/cdn/{CFQKZMGC.js → KR7U7SH5.js} +1 -1
- package/dist/cdn/{IZDAQGZD.js → KVYNN3MF.js} +1 -1
- package/dist/cdn/{7ZEDJMU7.js → L5WLXC4P.js} +1 -1
- package/dist/cdn/{IM3C52I6.js → LKVCSRAJ.js} +1 -1
- package/dist/cdn/{C76SZF3J.js → LLDACDFC.js} +1 -1
- package/dist/cdn/{3N4FGXFE.js → LQABMPPT.js} +1 -1
- package/dist/cdn/{GBDBGOCT.js → MG4GXXGQ.js} +1 -1
- package/dist/cdn/{AE5HNAOV.js → MSUQVQBX.js} +3 -3
- package/dist/cdn/{BYGOJ5ML.js → N3ENJ6TJ.js} +66 -66
- package/dist/cdn/{LZTAD4IE.js → NO74CJDB.js} +1 -1
- package/dist/cdn/{PBENK36A.js → NR5ZHMQJ.js} +1 -1
- package/dist/cdn/{ZZJHOJM5.js → O7O4T4G4.js} +1 -1
- package/dist/cdn/{QA3SYWWX.js → OBD737XY.js} +1 -1
- package/dist/cdn/{UY66XIX3.js → PIJDUFKZ.js} +1 -1
- package/dist/cdn/{MDMFIEM7.js → PKKPFNOP.js} +1 -1
- package/dist/cdn/{R7A62RZ4.js → POVGKQPO.js} +1 -1
- package/dist/cdn/{KDSK7F55.js → PQEOFKJR.js} +27 -27
- package/dist/cdn/{N2LDQKCJ.js → QUG6GIG2.js} +1 -1
- package/dist/cdn/{GDX4FWG7.js → RCF3ARQ3.js} +1 -1
- package/dist/cdn/{QCXOGAWW.js → RFRP75GX.js} +1 -1
- package/dist/cdn/{IZ7DJL5P.js → RKWTJT6L.js} +1 -1
- package/dist/cdn/{SJ7HTNAT.js → RPBIUBGZ.js} +1 -1
- package/dist/cdn/{RCOHFQC5.js → S4MPBLJP.js} +1 -1
- package/dist/cdn/{XKBOPER7.js → TRIDH4TQ.js} +1 -1
- package/dist/cdn/{GFEDQ7WH.js → U6M4Q7V3.js} +1 -1
- package/dist/cdn/{Q7GMS6X2.js → VYFFJEA4.js} +1 -1
- package/dist/cdn/{7NKBQ4G6.js → W5M4XQVO.js} +1 -1
- package/dist/cdn/{OZFVLORO.js → WKZOT33F.js} +1 -1
- package/dist/cdn/{VYCVNEK2.js → X67LNBJP.js} +1 -1
- package/dist/cdn/{S2A7SDYB.js → XA2AVWSV.js} +1 -1
- package/dist/cdn/{V2DYKK6V.js → XLB42ULH.js} +1 -1
- package/dist/cdn/{JET6MYZJ.js → XSOTJ56B.js} +1 -1
- package/dist/cdn/{XDONARND.js → YAUQSIXM.js} +1 -1
- package/dist/cdn/{S2Y44VZV.js → YELTRFZZ.js} +1 -1
- package/dist/cdn/{WUEJANIZ.js → YXCHECNE.js} +1 -1
- package/dist/cdn/{EZ5PKNLU.js → YZ3OYKNY.js} +1 -1
- package/dist/cdn/{5MPDXVRM.js → ZFK6UU3O.js} +1 -1
- package/dist/cdn/{37SYO65U.js → ZIDWIYAR.js} +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ar.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.bg.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.bs.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ca.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.cs.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.da.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.de.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.el.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.es.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.et.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.fi.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.fr.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.he.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.hr.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.hu.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.id.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.it.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ja.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ko.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.lt.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.lv.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.nl.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.no.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.pl.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.pt-BR.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.pt-PT.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ro.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ru.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.sk.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.sl.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.sr.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.sv.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.th.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.tr.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.uk.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.vi.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.zh-CN.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.zh-HK.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.zh-TW.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ar.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.bg.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.bs.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ca.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.cs.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.da.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.de.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.el.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.es.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.et.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.fi.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.fr.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.he.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.hr.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.hu.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.id.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.it.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ja.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ko.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.lt.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.lv.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.nl.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.no.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.pl.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.pt-BR.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.pt-PT.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ro.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ru.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.sk.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.sl.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.sr.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.sv.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.th.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.tr.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.uk.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.vi.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.zh-CN.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.zh-HK.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.zh-TW.json +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/solution-builder-assistant.js +141 -129
- package/dist/chunks/transformQuery.js +49 -0
- package/dist/chunks/updateDesign.js +1 -1
- package/dist/components/arcgis-solutions-assistant/customElement.js +580 -491
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/solutions-components_commit.txt +8 -5
- package/package.json +4 -4
- package/dist/cdn/EKRMEQQI.js +0 -2
- package/dist/cdn/JAYARGS3.js +0 -2
- package/dist/cdn/OVKPT3QA.js +0 -2
- /package/dist/cdn/{C4T4HSG2.js → HNFDCPQY.js} +0 -0
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import { c as
|
|
3
|
-
import { u as
|
|
4
|
-
import { LitElement as
|
|
5
|
-
import { css as
|
|
6
|
-
import { unsafeHTML as
|
|
7
|
-
import { useContextConsumer as
|
|
8
|
-
import { c as
|
|
9
|
-
import { T as
|
|
10
|
-
import { m as
|
|
11
|
-
import
|
|
12
|
-
import { createRef as
|
|
13
|
-
import { Annotation as y, StateGraph as
|
|
14
|
-
import { createAgentRuntimeState as
|
|
15
|
-
import r, { z as
|
|
16
|
-
import * as
|
|
17
|
-
import { applyPatch as
|
|
2
|
+
import { c as Le } from "../../chunks/runtime.js";
|
|
3
|
+
import { u as $e } from "../../chunks/useT9n.js";
|
|
4
|
+
import { LitElement as Fe, createEvent as ne, nothing as ae } from "@arcgis/lumina";
|
|
5
|
+
import { css as Re, html as k } from "lit";
|
|
6
|
+
import { unsafeHTML as De } from "lit/directives/unsafe-html.js";
|
|
7
|
+
import { useContextConsumer as oe } from "@arcgis/lumina/context";
|
|
8
|
+
import { c as Ne, b as Me } from "../../chunks/deployAppContexts.js";
|
|
9
|
+
import { T as D } from "../../chunks/interfaces.js";
|
|
10
|
+
import { m as Be } from "../../chunks/helpers.js";
|
|
11
|
+
import z from "@arcgis/core/config.js";
|
|
12
|
+
import { createRef as Pe, ref as qe } from "lit-html/directives/ref.js";
|
|
13
|
+
import { Annotation as y, StateGraph as Q, START as H, END as I, NodeInterrupt as le } from "@langchain/langgraph/web";
|
|
14
|
+
import { createAgentRuntimeState as W, sendTraceMessage as w, invokeStructuredPrompt as C, getEmbeddings as Ue, cosineSimilarity as Oe, invokeTextPrompt as ze } from "@arcgis/ai-orchestrator";
|
|
15
|
+
import r, { z as A } from "zod";
|
|
16
|
+
import * as K from "@esri/arcgis-rest-portal";
|
|
17
|
+
import { applyPatch as je } from "fast-json-patch";
|
|
18
18
|
import "@langchain/core/messages";
|
|
19
|
-
import { C as
|
|
20
|
-
import { v as
|
|
21
|
-
import { t as
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
const He =
|
|
19
|
+
import { C as ce } from "../../chunks/converter.js";
|
|
20
|
+
import { v as j, b as V, S as Ve, g as Je } from "../../chunks/validators.js";
|
|
21
|
+
import { t as de, g as P, c as ue, r as pe, d as F } from "../../chunks/templates.js";
|
|
22
|
+
import Ge from "@arcgis/core/portal/Portal.js";
|
|
23
|
+
import Qe from "@arcgis/core/portal/PortalItem.js";
|
|
24
|
+
const He = 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)}.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
25
|
async function v(t, e) {
|
|
26
26
|
const s = Object.entries(t).find(
|
|
27
27
|
([i]) => i.endsWith(`/${e}.md`)
|
|
@@ -38,7 +38,7 @@ ${Object.keys(t).join(`
|
|
|
38
38
|
function q(t) {
|
|
39
39
|
return t?.configurable?.context?.translations;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function me(t) {
|
|
42
42
|
if (typeof window > "u" || t.length <= 1)
|
|
43
43
|
return;
|
|
44
44
|
const e = t.map((i) => i.solution.id), s = t.map((i) => i.solution.title);
|
|
@@ -60,7 +60,7 @@ function pe(t) {
|
|
|
60
60
|
}
|
|
61
61
|
}));
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function ge(t) {
|
|
64
64
|
if (typeof window > "u" || !t)
|
|
65
65
|
return;
|
|
66
66
|
const e = new CustomEvent("solutionIDFromAssistant", {
|
|
@@ -70,21 +70,31 @@ function me(t) {
|
|
|
70
70
|
});
|
|
71
71
|
window.dispatchEvent(e);
|
|
72
72
|
}
|
|
73
|
-
const We =
|
|
74
|
-
|
|
73
|
+
const We = A.object({
|
|
74
|
+
needsContext: A.boolean().describe("True when the explorer query requires added context from prior turns."),
|
|
75
|
+
rewrittenQuery: A.string().min(1).describe("The final query to send to doc AI. Keep original query if no context is needed.")
|
|
76
|
+
}), he = /* @__PURE__ */ Object.assign({
|
|
77
|
+
"./prompts/solutions_explorer_description.md": () => import("../../chunks/solutions_explorer_description.js").then((t) => t.default),
|
|
78
|
+
"./prompts/transformQuery.md": () => import("../../chunks/transformQuery.js").then((t) => t.default)
|
|
75
79
|
});
|
|
76
|
-
function
|
|
80
|
+
function Ke(t) {
|
|
77
81
|
return t.replace(/<sup>\[\[(\d+)\]\]\(([^)]+)\)<\/sup>/g, '<sup><a href="$2">[$1]</a></sup>');
|
|
78
82
|
}
|
|
79
|
-
function
|
|
83
|
+
function Ye(t) {
|
|
84
|
+
return t.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, (e, s, i) => `<img src="${i}" alt="${s}" style="width: 100%;">`);
|
|
85
|
+
}
|
|
86
|
+
function Xe(t, e) {
|
|
80
87
|
const s = [];
|
|
81
88
|
return (e?.configurable?.context?.configContext.allCards ?? []).forEach((n) => {
|
|
82
|
-
const
|
|
83
|
-
if (!
|
|
89
|
+
const o = n.title;
|
|
90
|
+
if (!o)
|
|
84
91
|
return;
|
|
85
|
-
const
|
|
92
|
+
const a = new RegExp(`(?<![\\p{L}\\p{N}])${o}(?![\\p{L}\\p{N}])`, "giu");
|
|
86
93
|
let l = !1;
|
|
87
|
-
t = t.replace(
|
|
94
|
+
t = t.replace(a, (d, c, m) => {
|
|
95
|
+
const h = m.slice(0, c);
|
|
96
|
+
return /<img[^>]*alt\s*=\s*["'][^"']*$/i.test(h) ? d : (l = !0, `<a href="" target="solutionId:${n.deployCommonId}">${o}</a>`);
|
|
97
|
+
}), l && s.push({
|
|
88
98
|
solution: {
|
|
89
99
|
title: n.title,
|
|
90
100
|
id: n.deployCommonId,
|
|
@@ -95,13 +105,13 @@ function Ke(t, e) {
|
|
|
95
105
|
});
|
|
96
106
|
}), { source: t, allMatches: s };
|
|
97
107
|
}
|
|
98
|
-
function
|
|
108
|
+
function Ze(t) {
|
|
99
109
|
return t && t.helperServices.aiAssistantServices ? `${t.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/chat` : null;
|
|
100
110
|
}
|
|
101
|
-
function
|
|
111
|
+
function fe(t) {
|
|
102
112
|
return t && t.helperServices.aiAssistantServices ? `${t.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/api/pre-chat` : null;
|
|
103
113
|
}
|
|
104
|
-
async function
|
|
114
|
+
async function G(t, e, s) {
|
|
105
115
|
const i = await fetch(e, {
|
|
106
116
|
method: "POST",
|
|
107
117
|
headers: {
|
|
@@ -114,12 +124,32 @@ async function V(t, e, s) {
|
|
|
114
124
|
throw new Error(`HTTP ${i.status} calling ${e}`);
|
|
115
125
|
return i.json();
|
|
116
126
|
}
|
|
117
|
-
const
|
|
127
|
+
const et = (t) => new Promise((e) => setTimeout(e, t));
|
|
128
|
+
async function tt(t, e) {
|
|
129
|
+
const s = t.agentExecutionContext.userRequest, i = e?.configurable?.context?.lastTurnAgent, n = t.agentExecutionContext.messages ?? [];
|
|
130
|
+
if (!i || n.length <= 1 || i === "explorer")
|
|
131
|
+
return s;
|
|
132
|
+
try {
|
|
133
|
+
const o = await v(he, "transformQuery"), a = await C({
|
|
134
|
+
promptText: o,
|
|
135
|
+
modelTier: "fast",
|
|
136
|
+
temperature: 0,
|
|
137
|
+
schema: We,
|
|
138
|
+
messages: n.slice(-11),
|
|
139
|
+
inputVariables: { query: s, lastTurnAgent: i }
|
|
140
|
+
});
|
|
141
|
+
if (a.needsContext && a.rewrittenQuery.trim())
|
|
142
|
+
return console.debug(`Rephrased query from "${s}" to "${a.rewrittenQuery.trim()}"`), a.rewrittenQuery.trim();
|
|
143
|
+
} catch {
|
|
144
|
+
}
|
|
145
|
+
return s;
|
|
146
|
+
}
|
|
147
|
+
const st = y.Root({
|
|
118
148
|
// Provides agentExecutionContext, outputMessage, summary, and status
|
|
119
149
|
// channels with the orchestrator's standard reducers/defaults so the
|
|
120
150
|
// sub-agent reports back through the same shape the orchestrator
|
|
121
151
|
// persists into priorSteps.
|
|
122
|
-
...
|
|
152
|
+
...W(),
|
|
123
153
|
solutionResponse: y({
|
|
124
154
|
reducer: (t, e) => e ?? null,
|
|
125
155
|
default: () => null
|
|
@@ -135,11 +165,11 @@ const Xe = (t) => new Promise((e) => setTimeout(e, t)), Ze = y.Root({
|
|
|
135
165
|
reducer: (t, e) => e ?? t,
|
|
136
166
|
default: () => null
|
|
137
167
|
})
|
|
138
|
-
}),
|
|
168
|
+
}), it = () => new Q(st).addNode("initializeAgent", at).addNode("askSolutionsQuestions", nt).addEdge(H, "initializeAgent").addEdge("initializeAgent", "askSolutionsQuestions").addEdge("askSolutionsQuestions", I), be = async (t, e, s, i) => {
|
|
139
169
|
if (!t) return;
|
|
140
|
-
const n =
|
|
170
|
+
const n = fe(t);
|
|
141
171
|
if (!n) return;
|
|
142
|
-
const
|
|
172
|
+
const a = { context: {
|
|
143
173
|
kind: "DocAIAssistantRequest",
|
|
144
174
|
filters: {
|
|
145
175
|
products: "ArcGIS Solutions",
|
|
@@ -149,19 +179,20 @@ const Xe = (t) => new Promise((e) => setTimeout(e, t)), Ze = y.Root({
|
|
|
149
179
|
}
|
|
150
180
|
}
|
|
151
181
|
} };
|
|
152
|
-
i && (
|
|
153
|
-
},
|
|
182
|
+
i && (a.conversationId = i), G(a, n, e ?? "");
|
|
183
|
+
}, nt = async (t, e) => {
|
|
154
184
|
if (e?.configurable?.abortSignal?.aborted)
|
|
155
185
|
return {};
|
|
156
186
|
const s = q(e), i = t.documentSkillUrl;
|
|
157
187
|
let n = [];
|
|
188
|
+
const o = await tt(t, e);
|
|
158
189
|
await w(
|
|
159
190
|
{ text: s.agentProgress.explorerAgentSearching },
|
|
160
191
|
e
|
|
161
192
|
);
|
|
162
|
-
let a = await
|
|
193
|
+
let a = await G(
|
|
163
194
|
{
|
|
164
|
-
message:
|
|
195
|
+
message: o,
|
|
165
196
|
conversationId: e?.configurable?.context?.convoId ?? void 0,
|
|
166
197
|
context: {
|
|
167
198
|
kind: "DocAIAssistantRequest",
|
|
@@ -178,69 +209,69 @@ const Xe = (t) => new Promise((e) => setTimeout(e, t)), Ze = y.Root({
|
|
|
178
209
|
e?.configurable?.context?.token ?? ""
|
|
179
210
|
);
|
|
180
211
|
a.conversationId && e?.configurable?.context?.setConversationId && e.configurable.context.setConversationId(a.conversationId);
|
|
181
|
-
let
|
|
212
|
+
let l = {
|
|
182
213
|
message: a.message,
|
|
183
214
|
conversationId: a.conversationId,
|
|
184
215
|
hasMore: a.hasMore,
|
|
185
216
|
ackSequenceNumber: a.sequenceNumber,
|
|
186
217
|
inquiryId: a.inquiryId
|
|
187
|
-
},
|
|
188
|
-
const
|
|
189
|
-
const
|
|
190
|
-
if (
|
|
191
|
-
const
|
|
192
|
-
|
|
218
|
+
}, d = "";
|
|
219
|
+
const c = async (h) => {
|
|
220
|
+
const u = h.context?.results?.[0]?.reply ?? "";
|
|
221
|
+
if (u !== "") {
|
|
222
|
+
const S = Ke(u), $ = Ye(S), T = Xe($, e);
|
|
223
|
+
d = T.source, n = [
|
|
193
224
|
...n,
|
|
194
|
-
...
|
|
195
|
-
(
|
|
225
|
+
...T.allMatches.filter(
|
|
226
|
+
(U) => !n.some((_) => _.solution.id === U.solution.id)
|
|
196
227
|
)
|
|
197
228
|
];
|
|
198
229
|
}
|
|
199
|
-
const
|
|
200
|
-
if (
|
|
201
|
-
let
|
|
202
|
-
|
|
230
|
+
const f = h.context?.results?.[0]?.status?.currentStatusStep;
|
|
231
|
+
if (f) {
|
|
232
|
+
let S = "";
|
|
233
|
+
f === 1 ? S = s.agentProgress.explorerAgentReading : f === 2 ? S = s.agentProgress.explorerAgentReviewing : f === 3 && (S = s.agentProgress.explorerAgentPreparing), await w({ text: S }, e);
|
|
203
234
|
}
|
|
204
235
|
};
|
|
205
|
-
for (await
|
|
236
|
+
for (await c(a); l.hasMore; ) {
|
|
206
237
|
if (e?.configurable?.abortSignal?.aborted)
|
|
207
238
|
return {};
|
|
208
|
-
await
|
|
239
|
+
await et(500), a = await G(
|
|
209
240
|
{
|
|
210
|
-
conversationId:
|
|
211
|
-
ackSequenceNumber:
|
|
212
|
-
inquiryId:
|
|
241
|
+
conversationId: l.conversationId,
|
|
242
|
+
ackSequenceNumber: l.ackSequenceNumber,
|
|
243
|
+
inquiryId: l.inquiryId
|
|
213
244
|
},
|
|
214
245
|
i,
|
|
215
246
|
e?.configurable?.context?.token ?? ""
|
|
216
|
-
),
|
|
247
|
+
), l = {
|
|
217
248
|
message: a.message,
|
|
218
249
|
conversationId: a.conversationId,
|
|
219
250
|
hasMore: a.hasMore,
|
|
220
251
|
ackSequenceNumber: a.sequenceNumber,
|
|
221
252
|
inquiryId: a.inquiryId
|
|
222
|
-
}, await
|
|
253
|
+
}, await c(a);
|
|
223
254
|
}
|
|
224
|
-
return
|
|
255
|
+
return fe(e?.configurable?.context.portal) && be(
|
|
225
256
|
e?.configurable?.context.portal,
|
|
226
257
|
e?.configurable?.context.token ?? "",
|
|
227
258
|
e?.configurable?.context.configContext.locale ?? "en",
|
|
228
|
-
|
|
229
|
-
), n.length && (n.length === 1 ?
|
|
230
|
-
outputMessage:
|
|
231
|
-
summary:
|
|
259
|
+
l.conversationId
|
|
260
|
+
), n.length && (n.length === 1 ? ge(n[0].solution.id) : me(n)), {
|
|
261
|
+
outputMessage: d,
|
|
262
|
+
summary: d,
|
|
232
263
|
status: "success",
|
|
233
|
-
solutionResponse:
|
|
234
|
-
conversationId:
|
|
264
|
+
solutionResponse: l,
|
|
265
|
+
conversationId: l.conversationId
|
|
235
266
|
};
|
|
236
|
-
},
|
|
267
|
+
}, at = async (t, e) => {
|
|
237
268
|
let s = null;
|
|
238
|
-
return t.documentSkillUrl === null && e?.configurable?.context?.portal && (s =
|
|
269
|
+
return t.documentSkillUrl === null && e?.configurable?.context?.portal && (s = Ze(e.configurable.context.portal)), {
|
|
239
270
|
documentSkillUrl: s
|
|
240
271
|
};
|
|
241
272
|
};
|
|
242
|
-
await v(
|
|
243
|
-
const
|
|
273
|
+
await v(he, "solutions_explorer_description");
|
|
274
|
+
const ye = (t) => {
|
|
244
275
|
if (t && Array.isArray(t.id) && t.id.length > 0)
|
|
245
276
|
return t.id[t.id.length - 1].replace("Message", "").toLowerCase();
|
|
246
277
|
if (t && typeof t._getType == "function")
|
|
@@ -250,8 +281,8 @@ const fe = (t) => {
|
|
|
250
281
|
return "human";
|
|
251
282
|
}
|
|
252
283
|
return "human";
|
|
253
|
-
},
|
|
254
|
-
const e =
|
|
284
|
+
}, ot = (t) => {
|
|
285
|
+
const e = ye(t);
|
|
255
286
|
if (t && t.kwargs)
|
|
256
287
|
return {
|
|
257
288
|
role: e,
|
|
@@ -266,99 +297,135 @@ const fe = (t) => {
|
|
|
266
297
|
return t.id && (s.id = t.id), t.name && (s.name = t.name), t.additional_kwargs && (s.additional_kwargs = t.additional_kwargs), t.response_metadata && (s.response_metadata = t.response_metadata), s;
|
|
267
298
|
}
|
|
268
299
|
return { role: "human", content: String(t) };
|
|
269
|
-
},
|
|
270
|
-
builderMessages:
|
|
300
|
+
}, rt = (t) => ye(t) === "human", lt = (t, e = 3) => t.filter((s) => rt(s)).slice(-e).map(ot), ct = (t, e = " ") => lt(t).map((n) => n.content).join(e).trim(), dt = { 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?" }, ut = {
|
|
301
|
+
builderMessages: dt
|
|
271
302
|
};
|
|
272
|
-
class
|
|
303
|
+
class ve {
|
|
273
304
|
constructor(e, s, i = !0) {
|
|
274
305
|
this.isValid = !0, this.issues = [], this.fieldNameRegistry = null, this.response = e, this.template = s, this.newDesign = i, this.validate();
|
|
275
306
|
}
|
|
307
|
+
/**
|
|
308
|
+
* Runs all validation checks on the response.
|
|
309
|
+
*/
|
|
276
310
|
validate() {
|
|
277
311
|
this.compareModels(), this.validateResponse();
|
|
278
312
|
}
|
|
313
|
+
/**
|
|
314
|
+
* Compares response models against template models.
|
|
315
|
+
*/
|
|
279
316
|
compareModels() {
|
|
280
|
-
this.
|
|
317
|
+
this._compareStrings(), this._compareItems(), this._compareFeatureLayers();
|
|
281
318
|
}
|
|
319
|
+
/**
|
|
320
|
+
* Validates response properties and structure.
|
|
321
|
+
*/
|
|
282
322
|
validateResponse() {
|
|
283
|
-
this.
|
|
323
|
+
this._validateSolutionProps(), this._validateItems(), this._validateFeatureLayer();
|
|
284
324
|
}
|
|
285
|
-
|
|
325
|
+
/**
|
|
326
|
+
* Compares string keys and values between response and template.
|
|
327
|
+
*/
|
|
328
|
+
_compareStrings() {
|
|
286
329
|
const e = new Set(this.template.solution.strings.map((i) => i.key)), s = new Set(this.response.solution.strings.map((i) => i.key));
|
|
287
|
-
e.size === s.size && [...e].every((i) => s.has(i)) || this.
|
|
330
|
+
e.size === s.size && [...e].every((i) => s.has(i)) || this._logIssue("String keys in llm response do not match the template.");
|
|
288
331
|
for (const i of this.response.solution.strings)
|
|
289
|
-
i.value || this.
|
|
332
|
+
i.value || this._logIssue(`String key '${i.key}' has no value in the design. It must be populated.`);
|
|
290
333
|
}
|
|
291
|
-
|
|
334
|
+
/**
|
|
335
|
+
* Compares item IDs between response and template.
|
|
336
|
+
*/
|
|
337
|
+
_compareItems() {
|
|
292
338
|
const e = new Set(this.template.items.map((i) => i.id)), s = new Set(this.response.items.map((i) => i.id));
|
|
293
|
-
e.size === s.size && [...e].every((i) => s.has(i)) || this.
|
|
339
|
+
e.size === s.size && [...e].every((i) => s.has(i)) || this._logIssue("Item IDs in design do not match the template.");
|
|
294
340
|
}
|
|
295
|
-
|
|
341
|
+
/**
|
|
342
|
+
* Compares feature layer configuration between response and template.
|
|
343
|
+
*/
|
|
344
|
+
_compareFeatureLayers() {
|
|
296
345
|
const e = this.template.featureLayer, s = this.response.featureLayer;
|
|
297
346
|
if (e.itemId !== s.itemId) {
|
|
298
|
-
this.
|
|
347
|
+
this._logIssue(`Feature Layer itemId '${s.itemId}' does not match template '${e.itemId}'.`);
|
|
299
348
|
return;
|
|
300
349
|
}
|
|
301
350
|
if (!e.addLayers) {
|
|
302
|
-
const i = new Set(e.layers.map((
|
|
303
|
-
if (!(i.size === n.size && [...i].every((
|
|
304
|
-
this.
|
|
351
|
+
const i = new Set(e.layers.map((o) => o.id)), n = new Set(s.layers.map((o) => o.id));
|
|
352
|
+
if (!(i.size === n.size && [...i].every((o) => n.has(o))))
|
|
353
|
+
this._logIssue(`Feature Layer '${e.itemId}' had its layer ids altered.`);
|
|
305
354
|
else
|
|
306
|
-
for (const
|
|
307
|
-
if (
|
|
308
|
-
const
|
|
309
|
-
|
|
355
|
+
for (const o of e.layers)
|
|
356
|
+
if (o.type) {
|
|
357
|
+
const a = s.layers.find((l) => l.id === o.id);
|
|
358
|
+
a && a.type !== o.type && this._logIssue(`Layer '${o.id}' type '${a.type}' does not match template type '${o.type}'. This layer type is immutable.`);
|
|
310
359
|
}
|
|
311
360
|
}
|
|
312
361
|
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
362
|
+
/**
|
|
363
|
+
* Validates solution title and description.
|
|
364
|
+
*/
|
|
365
|
+
_validateSolutionProps() {
|
|
366
|
+
const e = this.response.solution.title, s = this.response.solution.description, i = j(e ?? "");
|
|
367
|
+
if (i.isValid || this._logIssue(`Solution title is invalid (${i.errorType}).`), s) {
|
|
368
|
+
const n = V(s, 2048);
|
|
369
|
+
n.isValid || this._logIssue(`Solution description is invalid (${n.errorType}).`);
|
|
318
370
|
}
|
|
319
371
|
}
|
|
320
|
-
|
|
372
|
+
/**
|
|
373
|
+
* Validates all items in the response.
|
|
374
|
+
*/
|
|
375
|
+
_validateItems() {
|
|
321
376
|
const e = /* @__PURE__ */ new Set([
|
|
322
377
|
"Feature Layer (hosted)",
|
|
323
378
|
"Feature Layer (hosted, view)"
|
|
324
379
|
]);
|
|
325
380
|
for (const s of this.response.items) {
|
|
326
|
-
e.has(s.type) && s.title.length > 100 && this.
|
|
327
|
-
const i =
|
|
328
|
-
if (i.isValid || this.
|
|
329
|
-
const n =
|
|
330
|
-
n.isValid || this.
|
|
381
|
+
e.has(s.type) && s.title.length > 100 && this._logIssue(`Service name '${s.title}' exceeds 100 characters.`);
|
|
382
|
+
const i = j(s.title ?? "");
|
|
383
|
+
if (i.isValid || this._logIssue(`Item '${s.id}' title is invalid (${i.errorType}).`), s.description) {
|
|
384
|
+
const n = V(s.description, 2048);
|
|
385
|
+
n.isValid || this._logIssue(`Item '${s.id}' description is invalid (${n.errorType}).`);
|
|
331
386
|
}
|
|
332
387
|
}
|
|
333
388
|
}
|
|
334
|
-
|
|
389
|
+
/**
|
|
390
|
+
* Validates feature layer structure and layers.
|
|
391
|
+
*/
|
|
392
|
+
_validateFeatureLayer() {
|
|
335
393
|
const e = this.template.featureLayer.layers;
|
|
336
|
-
this.response.featureLayer.layers.length || this.
|
|
394
|
+
this.response.featureLayer.layers.length || this._logIssue("Feature layer item must contain at least one layer.");
|
|
337
395
|
const s = this.response.featureLayer.layers.map((i) => i.name.toLowerCase());
|
|
338
|
-
s.length !== new Set(s).size && this.
|
|
396
|
+
s.length !== new Set(s).size && this._logIssue(`Layer names must be unique (case-insensitive). Layer names in design: ${s}.`);
|
|
339
397
|
for (const i of this.response.featureLayer.layers) {
|
|
340
|
-
this.
|
|
341
|
-
const n = e.find((
|
|
342
|
-
n && this.
|
|
398
|
+
this._validateLayer(i, this.response.featureLayer.addLayers);
|
|
399
|
+
const n = e.find((o) => o.id === i.id);
|
|
400
|
+
n && this._validateRequiredFields(i, n);
|
|
343
401
|
}
|
|
344
402
|
}
|
|
345
|
-
|
|
403
|
+
/**
|
|
404
|
+
* Validates that all required fields from template are present in layer.
|
|
405
|
+
*/
|
|
406
|
+
_validateRequiredFields(e, s) {
|
|
346
407
|
const i = new Set(e.requiredFields.map((n) => n.name));
|
|
347
408
|
for (const n of s.requiredFields)
|
|
348
|
-
i.has(n.name) || this.
|
|
409
|
+
i.has(n.name) || this._logIssue(`Layer '${e.name}' is missing required field '${n.name}'.`);
|
|
349
410
|
}
|
|
350
|
-
|
|
351
|
-
|
|
411
|
+
/**
|
|
412
|
+
* Validates a single layer configuration including name, description, and fields.
|
|
413
|
+
*/
|
|
414
|
+
_validateLayer(e, s) {
|
|
415
|
+
!s && e.typeMutable === !0 && e.type === "Table" && this._logIssue(
|
|
352
416
|
`Layer '${e.name}' cannot be a Table. It may be a Point, Line, or Polygon.`
|
|
353
417
|
);
|
|
354
|
-
const i =
|
|
355
|
-
if (i.isValid || this.
|
|
356
|
-
const n =
|
|
357
|
-
n.isValid || this.
|
|
418
|
+
const i = j(e.name ?? "");
|
|
419
|
+
if (i.isValid || this._logIssue(`Layer '${e.name}' name is invalid (${i.errorType}).`), e.description) {
|
|
420
|
+
const n = V(e.description, 2048);
|
|
421
|
+
n.isValid || this._logIssue(`Layer '${e.name}' description is invalid (${n.errorType}).`);
|
|
358
422
|
}
|
|
359
|
-
this.
|
|
423
|
+
this._validateLayerFields(e);
|
|
360
424
|
}
|
|
361
|
-
|
|
425
|
+
/**
|
|
426
|
+
* Validates all fields in a layer including custom, required, and system fields.
|
|
427
|
+
*/
|
|
428
|
+
_validateLayerFields(e) {
|
|
362
429
|
const s = /* @__PURE__ */ new Set([
|
|
363
430
|
"objectid",
|
|
364
431
|
"globalid",
|
|
@@ -366,88 +433,104 @@ class be {
|
|
|
366
433
|
"created_user",
|
|
367
434
|
"last_edited_date",
|
|
368
435
|
"last_edited_user"
|
|
369
|
-
]), i = e.customFields.map((c) => c.name), n = new Set(e.requiredFields.map((c) => c.name)),
|
|
436
|
+
]), i = e.customFields.map((c) => c.name), n = new Set(e.requiredFields.map((c) => c.name)), o = [...new Set(
|
|
370
437
|
i.filter((c) => s.has(c))
|
|
371
438
|
)];
|
|
372
|
-
for (const c of
|
|
373
|
-
this.
|
|
374
|
-
const
|
|
439
|
+
for (const c of o)
|
|
440
|
+
this._logIssue(`Layer '${e.name}' field '${c}' collides with a reserved system field name.`);
|
|
441
|
+
const a = [...new Set(
|
|
375
442
|
i.filter((c) => n.has(c))
|
|
376
443
|
)];
|
|
377
|
-
for (const c of
|
|
378
|
-
this.
|
|
379
|
-
if (!
|
|
444
|
+
for (const c of a)
|
|
445
|
+
this._logIssue(`Layer '${e.name}' field '${c}' collides with a required field name.`);
|
|
446
|
+
if (!o.length && !a.length) {
|
|
380
447
|
const c = e.systemFields ?? [], m = [
|
|
381
448
|
...e.customFields,
|
|
382
449
|
...e.requiredFields,
|
|
383
450
|
...c
|
|
384
|
-
].map((
|
|
385
|
-
m.length !== new Set(m).size && this.
|
|
451
|
+
].map((h) => h.name);
|
|
452
|
+
m.length !== new Set(m).size && this._logIssue(`Layer '${e.name}' has duplicate fields: ${JSON.stringify(m)}.`);
|
|
386
453
|
}
|
|
387
|
-
const l = e.systemFields ?? [],
|
|
388
|
-
this.fieldNameRegistry = new Set(
|
|
454
|
+
const l = e.systemFields ?? [], d = [...e.customFields, ...e.requiredFields, ...l].map((c) => c.name.toLowerCase());
|
|
455
|
+
this.fieldNameRegistry = new Set(d);
|
|
389
456
|
for (const c of [...e.customFields, ...e.requiredFields])
|
|
390
|
-
this.
|
|
457
|
+
this._validateField(c);
|
|
391
458
|
this.fieldNameRegistry = null;
|
|
392
459
|
}
|
|
393
|
-
|
|
460
|
+
/**
|
|
461
|
+
* Generates a unique truncated field name within the 31-character limit.
|
|
462
|
+
*/
|
|
463
|
+
_getUniqueTruncatedFieldName(e) {
|
|
394
464
|
const i = this.fieldNameRegistry;
|
|
395
465
|
if (!i)
|
|
396
466
|
return e.slice(0, 31);
|
|
397
467
|
const n = e.toLowerCase();
|
|
398
468
|
i.delete(n);
|
|
399
|
-
const
|
|
400
|
-
let
|
|
401
|
-
for (; i.has(
|
|
402
|
-
const
|
|
403
|
-
|
|
469
|
+
const o = e.slice(0, 31);
|
|
470
|
+
let a = o, l = 1;
|
|
471
|
+
for (; i.has(a.toLowerCase()); ) {
|
|
472
|
+
const d = `_${l}`, c = Math.max(1, 31 - d.length);
|
|
473
|
+
a = `${o.slice(0, c)}${d}`, l += 1;
|
|
404
474
|
}
|
|
405
|
-
return i.add(
|
|
475
|
+
return i.add(a.toLowerCase()), a;
|
|
406
476
|
}
|
|
407
|
-
|
|
477
|
+
/**
|
|
478
|
+
* Validates a single field including name, type, length, and domain constraints.
|
|
479
|
+
*/
|
|
480
|
+
_validateField(e) {
|
|
408
481
|
const s = /^\p{L}/u, i = /^.[\p{L}\p{M}\p{N}_]*$/u;
|
|
409
|
-
if (e.alias || this.
|
|
482
|
+
if (e.alias || this._logIssue(`Field '${e.name}' has no display name (alias).`), s.test(e.name) || this._logIssue(`Field '${e.name}' does not start with a letter.`), i.test(e.name) || this._logIssue(
|
|
410
483
|
`Field '${e.name}' contains invalid characters (only letters from any writing system, numbers, and underscores are allowed; emojis and punctuation are not allowed).`
|
|
411
484
|
), e.name.length > 31)
|
|
412
485
|
if (this.newDesign) {
|
|
413
486
|
const n = e.name;
|
|
414
|
-
e.name = this.
|
|
487
|
+
e.name = this._getUniqueTruncatedFieldName(e.name), console.debug(`Field '${n}' exceeds 31 characters. Auto-fixing to '${e.name}'.`);
|
|
415
488
|
} else
|
|
416
|
-
this.
|
|
417
|
-
if (
|
|
489
|
+
this._logIssue(`Field '${e.name}' exceeds 31 characters.`);
|
|
490
|
+
if (Ve.has(e.name.toLowerCase()))
|
|
418
491
|
if (this.newDesign) {
|
|
419
492
|
const n = e.name;
|
|
420
493
|
e.name = `${n}_`, console.debug(`Field '${n}' is a SQL reserved keyword. Auto-fixing to '${e.name}'.`);
|
|
421
494
|
} else
|
|
422
|
-
this.
|
|
423
|
-
if (e.type === "string" && this.
|
|
424
|
-
const n = Math.max(...e.choiceList.map((
|
|
425
|
-
n > e.length && (this.newDesign ? (console.debug(`The choice provided for field '${e.name}' is too long. It must fit within ${e.length} characters, but the choice requires ${n} characters. Auto-fixing to ${n}.`), e.length = n) : this.
|
|
495
|
+
this._logIssue(`Field '${e.name}' is a SQL reserved keyword.`);
|
|
496
|
+
if (e.type === "string" && this._validateStringFieldLength(e), Array.isArray(e.choiceList) && (e.type !== "string" && this._logIssue(`Field '${e.name}' must be of type 'string' to have a domain.`), e.choiceList.length || this._logIssue(`Field '${e.name}' has an empty domain. At least one value is required.`), e.choiceList.some((n) => !n?.trim()) && this._logIssue(`A blank domain value was added to Field '${e.name}'.`), e.choiceList.length !== new Set(e.choiceList).size && this._logIssue(`Field '${e.name}' has duplicate domain values.`), e.length != null)) {
|
|
497
|
+
const n = Math.max(...e.choiceList.map((o) => o.length));
|
|
498
|
+
n > e.length && (this.newDesign ? (console.debug(`The choice provided for field '${e.name}' is too long. It must fit within ${e.length} characters, but the choice requires ${n} characters. Auto-fixing to ${n}.`), e.length = n) : this._logIssue(`The choice provided for field '${e.name}' is too long. It must fit within ${e.length} characters, but the choice requires ${n} characters.`));
|
|
426
499
|
}
|
|
427
500
|
}
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
501
|
+
/**
|
|
502
|
+
* Validates the length of a string field, silently migrating 255 -> 256 for new designs,
|
|
503
|
+
* and auto-fixing or logging out-of-range values accordingly.
|
|
504
|
+
*/
|
|
505
|
+
_validateStringFieldLength(e) {
|
|
432
506
|
if (this.newDesign && e.length === 255 && (e.length = 256), typeof e.length != "number" || Number.isNaN(e.length)) {
|
|
433
|
-
this.
|
|
507
|
+
this._handleInvalidStringFieldLength(e, 256);
|
|
434
508
|
return;
|
|
435
509
|
}
|
|
436
510
|
const s = e.length;
|
|
437
|
-
if (!
|
|
511
|
+
if (!Je(s).isValid) {
|
|
438
512
|
const n = s > 4e3 ? 4e3 : 256;
|
|
439
|
-
this.
|
|
513
|
+
this._handleInvalidStringFieldLength(e, n);
|
|
440
514
|
}
|
|
441
515
|
}
|
|
442
|
-
|
|
443
|
-
|
|
516
|
+
/**
|
|
517
|
+
* Applies an auto-fix to a string field's length on new designs, or logs an issue on update design.
|
|
518
|
+
*/
|
|
519
|
+
_handleInvalidStringFieldLength(e, s) {
|
|
520
|
+
this.newDesign ? (console.debug(`Field '${e.name}' has an invalid length. Auto-fixing to ${s}.`), e.length = s) : this._logIssue(`Field '${e.name}' length is invalid (must be a number between 1 and 4000).`);
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Records an issue and marks the validation as invalid.
|
|
524
|
+
*/
|
|
525
|
+
_logIssue(e) {
|
|
526
|
+
console.debug(e), this.issues.push(e), this.isValid = !1;
|
|
444
527
|
}
|
|
445
528
|
}
|
|
446
|
-
const
|
|
529
|
+
const pt = r.object({
|
|
447
530
|
key: r.string().describe("Stable key identifier for the string."),
|
|
448
531
|
value: r.string().describe("Display value for the string."),
|
|
449
532
|
description: r.string().describe("Explanation of where/how the string is used.")
|
|
450
|
-
}),
|
|
533
|
+
}), mt = r.object({
|
|
451
534
|
id: r.string().describe("ArcGIS item id (32 hex characters)."),
|
|
452
535
|
title: r.string().describe("Item title."),
|
|
453
536
|
description: r.string().describe("Item description."),
|
|
@@ -470,7 +553,7 @@ const ct = r.object({
|
|
|
470
553
|
"Notebook",
|
|
471
554
|
"QuickCapture Project"
|
|
472
555
|
]).describe("ArcGIS item type.")
|
|
473
|
-
}),
|
|
556
|
+
}), re = r.object({
|
|
474
557
|
name: r.string().describe("Field name."),
|
|
475
558
|
type: r.enum(["string", "integer", "double", "date", "oid", "guid", "globalid"]).describe("Field data type."),
|
|
476
559
|
alias: r.string().describe("Field alias for display."),
|
|
@@ -479,83 +562,83 @@ const ct = r.object({
|
|
|
479
562
|
"List of allowed values for string fields with a controlled vocabulary. Null if unrestricted or not applicable."
|
|
480
563
|
),
|
|
481
564
|
length: r.number().int().nullable().describe("Maximum string length for string fields. Null for non-string fields.")
|
|
482
|
-
}),
|
|
565
|
+
}), gt = r.object({
|
|
483
566
|
id: r.number().int().describe("Layer/table id within the feature service."),
|
|
484
567
|
type: r.enum(["Point", "Polyline", "Polygon", "Table"]).describe("Layer type."),
|
|
485
568
|
typeMutable: r.boolean().describe("Indicates whether the layer type can be changed."),
|
|
486
569
|
name: r.string().describe("Layer/table name."),
|
|
487
570
|
description: r.string().describe("Layer/table description."),
|
|
488
|
-
customFields: r.array(
|
|
489
|
-
requiredFields: r.array(
|
|
490
|
-
}),
|
|
571
|
+
customFields: r.array(re).describe("User/business fields specific to the solution."),
|
|
572
|
+
requiredFields: r.array(re).describe("Fields required for solution functionality (e.g., relationship keys).")
|
|
573
|
+
}), ht = r.object({
|
|
491
574
|
itemId: r.string().describe("ArcGIS item id for the feature layer."),
|
|
492
575
|
addLayers: r.boolean().describe("Indicates whether new layers can be added during solution design."),
|
|
493
|
-
layers: r.array(
|
|
494
|
-
}),
|
|
576
|
+
layers: r.array(gt)
|
|
577
|
+
}), Y = r.object({
|
|
495
578
|
response: r.string().describe("Conversational response to the user's query."),
|
|
496
579
|
solution: r.object({
|
|
497
580
|
itemId: r.string().nullable().describe("ArcGIS item id of the source Solution template used for deployment. Preserve the existing value exactly when known; otherwise use null."),
|
|
498
581
|
title: r.string().describe("Title of the solution."),
|
|
499
582
|
description: r.string().describe("Description of the solution."),
|
|
500
583
|
tags: r.array(r.string()).describe("Keywords/tags associated with the solution."),
|
|
501
|
-
strings: r.array(
|
|
584
|
+
strings: r.array(pt).describe("Localized strings/labels used by apps (dashboards, forms, etc.).")
|
|
502
585
|
}),
|
|
503
|
-
items: r.array(
|
|
504
|
-
featureLayer:
|
|
505
|
-
}),
|
|
586
|
+
items: r.array(mt).describe("ArcGIS items that belong to the solution (apps, maps, layers, etc.)."),
|
|
587
|
+
featureLayer: ht.describe("Primary feature layer item and its schema/layers/tables details.")
|
|
588
|
+
}), ft = r.object({
|
|
506
589
|
op: r.enum(["add", "remove", "replace", "move", "copy"]).describe("RFC 6902 operation type."),
|
|
507
590
|
path: r.string().describe("RFC 6901 JSON Pointer to the target location."),
|
|
508
591
|
value: r.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.`),
|
|
509
592
|
from: r.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.")
|
|
510
|
-
}),
|
|
593
|
+
}), bt = r.object({
|
|
511
594
|
response: r.string().describe("Conversational response describing the accepted design changes."),
|
|
512
|
-
patches: r.array(
|
|
513
|
-
}),
|
|
595
|
+
patches: r.array(ft).describe("Minimal RFC 6902 patch operations needed to update the current design.")
|
|
596
|
+
}), yt = r.object({
|
|
514
597
|
response: r.string().describe("Short, user-friendly explanation of why the requested update was not applied.")
|
|
515
|
-
}),
|
|
598
|
+
}), vt = r.object({
|
|
516
599
|
assistantResponse: r.string().describe("Natural-language response for the user."),
|
|
517
600
|
isValidUpdate: r.boolean().describe("True only when the request is in scope for supported design updates.")
|
|
518
|
-
}),
|
|
601
|
+
}), xt = r.object({
|
|
519
602
|
matchedTitles: r.array(r.string()).describe("Titles of solutions that match the user's request. Empty array if no strong match.")
|
|
520
|
-
}),
|
|
603
|
+
}), wt = r.object({
|
|
521
604
|
templateId: r.string().min(1).describe("Template id from the available template list."),
|
|
522
605
|
confidence: r.number().min(0).max(1).describe("Confidence score from 0 to 1 for this template match."),
|
|
523
606
|
templateDescription: r.string().min(1).describe("Short action‑oriented description of the template in the user's use case/workflow, starting with a verb.")
|
|
524
|
-
}),
|
|
607
|
+
}), St = r.object({
|
|
525
608
|
assistantResponse: r.string().nullable().describe("Natural-language response for the user."),
|
|
526
609
|
isValidUseCase: r.boolean().describe("True only when the request is concrete, appropriate, and has at least one matching template."),
|
|
527
|
-
matchedTemplates: r.array(
|
|
528
|
-
}),
|
|
529
|
-
`) : "No validation errors were provided.",
|
|
610
|
+
matchedTemplates: r.array(wt).describe("Ordered list of matching templates, best match first. Empty when no valid match exists.")
|
|
611
|
+
}), _t = (t) => t.length ? t.map((e, s) => `${s + 1}. ${e}`).join(`
|
|
612
|
+
`) : "No validation errors were provided.", It = async (t) => {
|
|
530
613
|
const {
|
|
531
614
|
query: e,
|
|
532
615
|
validationIssues: s,
|
|
533
616
|
recentMessages: i,
|
|
534
617
|
fallbackMessage: n,
|
|
535
|
-
promptModules:
|
|
618
|
+
promptModules: o
|
|
536
619
|
} = t;
|
|
537
620
|
try {
|
|
538
|
-
return (await
|
|
539
|
-
promptText: await v(
|
|
621
|
+
return (await C({
|
|
622
|
+
promptText: await v(o, "explainValidationFailure"),
|
|
540
623
|
modelTier: "fast",
|
|
541
624
|
temperature: 0,
|
|
542
|
-
schema:
|
|
625
|
+
schema: yt,
|
|
543
626
|
messages: i,
|
|
544
627
|
inputVariables: {
|
|
545
628
|
query: e,
|
|
546
629
|
validationIssueCount: String(s.length),
|
|
547
|
-
validationIssues:
|
|
630
|
+
validationIssues: _t(s)
|
|
548
631
|
}
|
|
549
632
|
})).response?.trim() || n;
|
|
550
|
-
} catch (
|
|
633
|
+
} catch (a) {
|
|
551
634
|
return console.warn(
|
|
552
635
|
"Natural language response failed:",
|
|
553
|
-
{ error:
|
|
636
|
+
{ error: a }
|
|
554
637
|
), n;
|
|
555
638
|
}
|
|
556
|
-
},
|
|
557
|
-
let N = null,
|
|
558
|
-
const
|
|
639
|
+
}, X = (t) => t in F, Ct = 5, Tt = 0.8, kt = 0.15, At = "Web Mapping Application", Et = "Embeddings";
|
|
640
|
+
let N = null, J = null, M = null, B = null;
|
|
641
|
+
const Lt = "Build", E = /* @__PURE__ */ Object.assign({
|
|
559
642
|
"./prompts/assessBuildRequest.md": () => import("../../chunks/assessBuildRequest.js").then((t) => t.default),
|
|
560
643
|
"./prompts/assessUpdateRequest.md": () => import("../../chunks/assessUpdateRequest.js").then((t) => t.default),
|
|
561
644
|
"./prompts/description.md": () => import("../../chunks/description2.js").then((t) => t.default),
|
|
@@ -563,53 +646,53 @@ const kt = "Build", _ = /* @__PURE__ */ Object.assign({
|
|
|
563
646
|
"./prompts/explainValidationFailure.md": () => import("../../chunks/explainValidationFailure.js").then((t) => t.default),
|
|
564
647
|
"./prompts/findExistingSolution.md": () => import("../../chunks/findExistingSolution.js").then((t) => t.default),
|
|
565
648
|
"./prompts/updateDesign.md": () => import("../../chunks/updateDesign.js").then((t) => t.default)
|
|
566
|
-
}),
|
|
649
|
+
}), $t = ut.builderMessages, g = (t) => t?.configurable?.abortSignal.aborted ?? !1, b = (t, e, s) => q(e)?.builderMessages?.[t] ?? $t[t], xe = (t) => {
|
|
567
650
|
typeof window < "u" && window.dispatchEvent(new CustomEvent("arcgis-solution-design-update", {
|
|
568
651
|
detail: t
|
|
569
652
|
}));
|
|
570
|
-
},
|
|
653
|
+
}, Ft = async (t, e, s) => {
|
|
571
654
|
if (!t) return null;
|
|
572
|
-
const i = `type:"${
|
|
573
|
-
return (await
|
|
655
|
+
const i = `type:"${At}" AND typekeywords:${Et} AND group:${t}`;
|
|
656
|
+
return (await K.searchItems({
|
|
574
657
|
q: i,
|
|
575
658
|
params: e ? { token: e } : void 0,
|
|
576
659
|
portal: s,
|
|
577
660
|
num: 1
|
|
578
661
|
}))?.results?.[0] ?? null;
|
|
579
662
|
};
|
|
580
|
-
async function
|
|
663
|
+
async function Rt(t, e, s, i) {
|
|
581
664
|
try {
|
|
582
|
-
const n = await
|
|
583
|
-
if (!n ||
|
|
665
|
+
const n = await Ft(t, e, s);
|
|
666
|
+
if (!n || g(i))
|
|
584
667
|
return null;
|
|
585
|
-
const
|
|
586
|
-
return await
|
|
668
|
+
const o = new Qe({ id: n.id });
|
|
669
|
+
return await o.load(), g(i) ? null : await o.fetchData("json");
|
|
587
670
|
} catch {
|
|
588
671
|
return null;
|
|
589
672
|
}
|
|
590
673
|
}
|
|
591
|
-
const
|
|
674
|
+
const Dt = async (t, e, s) => {
|
|
592
675
|
if (!t) return [];
|
|
593
|
-
const i = `type:Solution AND typekeywords:${
|
|
594
|
-
return (await
|
|
676
|
+
const i = `type:Solution AND typekeywords:${Lt} AND group:${t}`;
|
|
677
|
+
return (await K.searchItems({
|
|
595
678
|
q: i,
|
|
596
679
|
params: e ? { token: e } : void 0,
|
|
597
680
|
portal: s,
|
|
598
681
|
num: 100
|
|
599
682
|
}))?.results ?? [];
|
|
600
|
-
},
|
|
683
|
+
}, Nt = async (t, e, s) => {
|
|
601
684
|
try {
|
|
602
|
-
const i = await
|
|
685
|
+
const i = await K.getItemData(t, {
|
|
603
686
|
params: e ? { token: e } : void 0,
|
|
604
687
|
portal: s
|
|
605
688
|
}), n = i?.buildSolution;
|
|
606
689
|
if (!n) return null;
|
|
607
|
-
const
|
|
608
|
-
return { buildSolution: n, params:
|
|
690
|
+
const o = i?.params, a = o && typeof o == "object" && !Array.isArray(o) ? o : null;
|
|
691
|
+
return { buildSolution: n, params: a };
|
|
609
692
|
} catch {
|
|
610
693
|
return null;
|
|
611
694
|
}
|
|
612
|
-
},
|
|
695
|
+
}, L = (t, e = {}) => {
|
|
613
696
|
let s = t;
|
|
614
697
|
return "itemId" in e && (s = {
|
|
615
698
|
...s,
|
|
@@ -627,121 +710,121 @@ const $t = async (t, e, s) => {
|
|
|
627
710
|
...s,
|
|
628
711
|
templateId: e.templateId ?? null
|
|
629
712
|
}), s;
|
|
630
|
-
},
|
|
713
|
+
}, we = (t, e) => {
|
|
631
714
|
if (t == null || e == null)
|
|
632
715
|
return { ok: !1, error: "design or sourceBuildSolution is null/undefined" };
|
|
633
716
|
try {
|
|
634
717
|
const s = structuredClone(e);
|
|
635
|
-
return new
|
|
718
|
+
return new ce({ buildSolution: s }).applyLlmTemplate(t), { ok: !0 };
|
|
636
719
|
} catch (s) {
|
|
637
720
|
return {
|
|
638
721
|
ok: !1,
|
|
639
722
|
error: s instanceof Error ? s.stack ?? s.message : String(s)
|
|
640
723
|
};
|
|
641
724
|
}
|
|
642
|
-
},
|
|
643
|
-
if (
|
|
644
|
-
Object.entries(
|
|
645
|
-
|
|
725
|
+
}, Z = async (t) => {
|
|
726
|
+
if (J) {
|
|
727
|
+
Object.entries(J).forEach(([a, l]) => {
|
|
728
|
+
F[a] && (F[a].initialTemplate = l);
|
|
646
729
|
});
|
|
647
730
|
return;
|
|
648
731
|
}
|
|
649
|
-
const e = t?.configurable?.context?.token, s =
|
|
732
|
+
const e = t?.configurable?.context?.token, s = _e(t), i = Ie(t);
|
|
650
733
|
if (!s) {
|
|
651
734
|
console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping live template hydration.");
|
|
652
735
|
return;
|
|
653
736
|
}
|
|
654
|
-
const n = await
|
|
655
|
-
|
|
656
|
-
const l =
|
|
737
|
+
const n = await Dt(s, e, i), o = {};
|
|
738
|
+
g(t) || (await Promise.all(n.map(async (a) => {
|
|
739
|
+
const l = a.properties?.templateInfo;
|
|
657
740
|
if (!l || typeof l != "object") return;
|
|
658
|
-
const
|
|
659
|
-
if (typeof
|
|
660
|
-
const c = await
|
|
661
|
-
if (!c ||
|
|
741
|
+
const d = l.id;
|
|
742
|
+
if (typeof d != "string" || o[d]) return;
|
|
743
|
+
const c = await Nt(a.id, e, i);
|
|
744
|
+
if (!c || g(t))
|
|
662
745
|
return;
|
|
663
|
-
const { buildSolution: m, params:
|
|
746
|
+
const { buildSolution: m, params: h } = c;
|
|
664
747
|
if (typeof m == "object" && m !== null && "solution" in m) {
|
|
665
|
-
const
|
|
666
|
-
|
|
748
|
+
const f = m.solution;
|
|
749
|
+
f.thumbnailUrl = a.thumbnail ? `${i ?? "https://www.arcgis.com/sharing/rest"}/content/items/${a.id}/info/${a.thumbnail}` : void 0, f.item = a;
|
|
667
750
|
}
|
|
668
|
-
const
|
|
751
|
+
const u = {
|
|
669
752
|
...l,
|
|
670
753
|
buildSolution: m
|
|
671
754
|
};
|
|
672
|
-
|
|
673
|
-
new
|
|
755
|
+
o[d] = L(
|
|
756
|
+
new ce(u).dumpToLlmTemplate(),
|
|
674
757
|
{
|
|
675
|
-
itemId:
|
|
758
|
+
itemId: a.id,
|
|
676
759
|
sourceBuildSolution: structuredClone(m),
|
|
677
|
-
params:
|
|
760
|
+
params: h ? structuredClone(h) : null
|
|
678
761
|
}
|
|
679
|
-
),
|
|
762
|
+
), F[d] = {
|
|
680
763
|
...l,
|
|
681
|
-
initialTemplate:
|
|
764
|
+
initialTemplate: o[d]
|
|
682
765
|
};
|
|
683
|
-
})),
|
|
684
|
-
},
|
|
766
|
+
})), J = o);
|
|
767
|
+
}, Se = (t) => {
|
|
685
768
|
const e = t?.configurable?.context?.token;
|
|
686
769
|
return typeof e != "string" || !e.trim() ? null : e;
|
|
687
|
-
},
|
|
770
|
+
}, _e = (t) => {
|
|
688
771
|
const e = t?.configurable?.context?.configContext?.primarySolutionsGroupId;
|
|
689
772
|
return typeof e != "string" || !e.trim() ? null : e;
|
|
690
|
-
},
|
|
773
|
+
}, Ie = (t) => {
|
|
691
774
|
const e = t?.configurable?.context?.configContext?.portalURL;
|
|
692
775
|
if (!(typeof e != "string" || !e.trim()))
|
|
693
776
|
return `${e.replace(/\/+$/, "")}/sharing/rest`;
|
|
694
|
-
},
|
|
777
|
+
}, Mt = async (t) => {
|
|
695
778
|
await Promise.all([
|
|
696
|
-
|
|
697
|
-
|
|
779
|
+
Te(t),
|
|
780
|
+
Z(t)
|
|
698
781
|
]);
|
|
699
|
-
},
|
|
700
|
-
const e =
|
|
701
|
-
(!M || e && e !== B) && (B = e ?? B, M =
|
|
782
|
+
}, Ce = async (t) => {
|
|
783
|
+
const e = Se(t);
|
|
784
|
+
(!M || e && e !== B) && (B = e ?? B, M = Mt(t).catch((i) => {
|
|
702
785
|
throw M = null, B = null, i;
|
|
703
786
|
})), await M;
|
|
704
787
|
};
|
|
705
|
-
async function
|
|
788
|
+
async function Te(t) {
|
|
706
789
|
if (N) return N;
|
|
707
|
-
const e =
|
|
790
|
+
const e = _e(t);
|
|
708
791
|
if (!e)
|
|
709
792
|
return console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping embeddings load."), null;
|
|
710
|
-
const s =
|
|
711
|
-
if (await new
|
|
793
|
+
const s = Ie(t), i = t?.configurable?.context?.configContext?.portalURL;
|
|
794
|
+
if (await new Ge(i ? { url: i } : void 0).load(), g(t))
|
|
712
795
|
return null;
|
|
713
|
-
const
|
|
714
|
-
return
|
|
796
|
+
const o = Se(t) ?? void 0, a = await Rt(e, o, s, t);
|
|
797
|
+
return g(t) ? null : a ? (N = a.items, N) : null;
|
|
715
798
|
}
|
|
716
|
-
const
|
|
799
|
+
const Bt = () => Object.entries(F).map(([t, e]) => `ID: ${t}
|
|
717
800
|
Label: ${e.label}
|
|
718
801
|
Description: ${e.description}`).join(`
|
|
719
802
|
|
|
720
|
-
`),
|
|
803
|
+
`), Pt = (t) => {
|
|
721
804
|
const e = t?.configurable?.context?.solutionDesignJson;
|
|
722
805
|
if (typeof e != "string" || !e.trim())
|
|
723
806
|
return null;
|
|
724
807
|
try {
|
|
725
|
-
const s = JSON.parse(e), i =
|
|
808
|
+
const s = JSON.parse(e), i = L(
|
|
726
809
|
{ response: "", ...s },
|
|
727
810
|
{ itemId: s?.solution?.itemId ?? null }
|
|
728
|
-
), n =
|
|
811
|
+
), n = Y.safeParse(i);
|
|
729
812
|
if (!n.success)
|
|
730
813
|
return null;
|
|
731
|
-
const { response:
|
|
732
|
-
return
|
|
733
|
-
|
|
814
|
+
const { response: o, ...a } = n.data, l = s.templateId, d = typeof l == "string" && X(l) ? l : null;
|
|
815
|
+
return L(
|
|
816
|
+
a,
|
|
734
817
|
{
|
|
735
818
|
sourceBuildSolution: s.sourceBuildSolution,
|
|
736
|
-
templateId:
|
|
819
|
+
templateId: d,
|
|
737
820
|
params: s.params ?? null
|
|
738
821
|
}
|
|
739
822
|
);
|
|
740
823
|
} catch {
|
|
741
824
|
return null;
|
|
742
825
|
}
|
|
743
|
-
},
|
|
744
|
-
...
|
|
826
|
+
}, qt = y.Root({
|
|
827
|
+
...W(),
|
|
745
828
|
/** Optional human-readable template description retained for UI use. */
|
|
746
829
|
templateDescription: y({
|
|
747
830
|
reducer: (t, e) => typeof e == "string" || e === null ? e : t ?? null,
|
|
@@ -777,43 +860,43 @@ Description: ${e.description}`).join(`
|
|
|
777
860
|
reducer: (t = null, e) => e === void 0 ? t : e ?? null,
|
|
778
861
|
default: () => null
|
|
779
862
|
})
|
|
780
|
-
}),
|
|
781
|
-
if (
|
|
863
|
+
}), Ut = (t, e) => {
|
|
864
|
+
if (g(e))
|
|
782
865
|
return {};
|
|
783
|
-
const s =
|
|
866
|
+
const s = Pt(e), i = s?.templateId ?? null, n = {};
|
|
784
867
|
return JSON.stringify(t.currentDesign) !== JSON.stringify(s) && (n.currentDesign = s), i && t.selectedTemplate !== i && (n.selectedTemplate = i), n;
|
|
785
|
-
},
|
|
786
|
-
if (
|
|
868
|
+
}, Ot = async (t, e) => {
|
|
869
|
+
if (g(e))
|
|
787
870
|
return {};
|
|
788
|
-
await w({ text:
|
|
789
|
-
const s = t.agentExecutionContext.userRequest, i =
|
|
790
|
-
promptText: await v(
|
|
871
|
+
await w({ text: b("understandingRequest", e) }, e), await Ce(e);
|
|
872
|
+
const s = t.agentExecutionContext.userRequest, i = Bt(), n = t.agentExecutionContext.messages.slice(-11), o = await C({
|
|
873
|
+
promptText: await v(E, "assessBuildRequest"),
|
|
791
874
|
modelTier: "advanced",
|
|
792
875
|
temperature: 0,
|
|
793
|
-
schema:
|
|
876
|
+
schema: St,
|
|
794
877
|
messages: n,
|
|
795
878
|
inputVariables: { query: s, availableTemplates: i }
|
|
796
|
-
}),
|
|
797
|
-
(
|
|
879
|
+
}), a = o.matchedTemplates.filter(
|
|
880
|
+
(u) => X(u.templateId)
|
|
798
881
|
), l = {
|
|
799
|
-
...
|
|
800
|
-
matchedTemplates:
|
|
801
|
-
}, [
|
|
882
|
+
...o,
|
|
883
|
+
matchedTemplates: a
|
|
884
|
+
}, [d, c] = a, h = !!d && d.confidence >= Tt && (c === void 0 || d.confidence - c.confidence >= kt) ? d.templateId : null;
|
|
802
885
|
return {
|
|
803
886
|
assessment: l,
|
|
804
|
-
selectedTemplate:
|
|
887
|
+
selectedTemplate: h,
|
|
805
888
|
existingMatches: [],
|
|
806
889
|
continueBuilding: null
|
|
807
890
|
};
|
|
808
|
-
},
|
|
891
|
+
}, zt = (t) => {
|
|
809
892
|
const e = t.assessment?.assistantResponse ?? "";
|
|
810
893
|
return {
|
|
811
894
|
outputMessage: e,
|
|
812
895
|
summary: e,
|
|
813
896
|
status: "success"
|
|
814
897
|
};
|
|
815
|
-
},
|
|
816
|
-
if (
|
|
898
|
+
}, jt = async (t, e) => {
|
|
899
|
+
if (g(e))
|
|
817
900
|
return {};
|
|
818
901
|
const { currentDesign: s } = t;
|
|
819
902
|
if (!s)
|
|
@@ -823,224 +906,224 @@ Description: ${e.description}`).join(`
|
|
|
823
906
|
isValidUpdate: !0
|
|
824
907
|
}
|
|
825
908
|
};
|
|
826
|
-
await w({ text:
|
|
909
|
+
await w({ text: b("understandingRequest", e) }, e);
|
|
827
910
|
const i = t.agentExecutionContext.userRequest, n = t.agentExecutionContext.messages.slice(-11);
|
|
828
911
|
return {
|
|
829
|
-
updateAssessment: await
|
|
830
|
-
promptText: await v(
|
|
912
|
+
updateAssessment: await C({
|
|
913
|
+
promptText: await v(E, "assessUpdateRequest"),
|
|
831
914
|
modelTier: "advanced",
|
|
832
915
|
temperature: 0,
|
|
833
|
-
schema:
|
|
916
|
+
schema: vt,
|
|
834
917
|
messages: n,
|
|
835
918
|
inputVariables: {
|
|
836
|
-
currentDesign: JSON.stringify(
|
|
919
|
+
currentDesign: JSON.stringify(de(s)),
|
|
837
920
|
query: i
|
|
838
921
|
}
|
|
839
922
|
})
|
|
840
923
|
};
|
|
841
|
-
},
|
|
842
|
-
const s = t.updateAssessment?.assistantResponse ??
|
|
924
|
+
}, Vt = (t, e) => {
|
|
925
|
+
const s = t.updateAssessment?.assistantResponse ?? b("applyChangeFailed", e);
|
|
843
926
|
return {
|
|
844
927
|
outputMessage: s,
|
|
845
928
|
summary: s,
|
|
846
929
|
status: "success"
|
|
847
930
|
};
|
|
848
|
-
},
|
|
849
|
-
if (
|
|
931
|
+
}, Jt = (t, e) => {
|
|
932
|
+
if (g(e))
|
|
850
933
|
return {};
|
|
851
934
|
const { hitlResponse: s } = e.configurable, i = "selectTemplate", n = t.assessment?.matchedTemplates.filter(
|
|
852
|
-
(c) =>
|
|
853
|
-
) ?? [],
|
|
935
|
+
(c) => X(c.templateId)
|
|
936
|
+
) ?? [], o = n.map((c) => `${c.templateDescription}`);
|
|
854
937
|
if (s?.agentId !== "solutionBuilder" || s.id !== i) {
|
|
855
938
|
const c = {
|
|
856
939
|
agentId: "solutionBuilder",
|
|
857
940
|
id: i,
|
|
858
941
|
kind: "singleSelection",
|
|
859
|
-
message:
|
|
860
|
-
metadata: [...
|
|
942
|
+
message: b("selectTemplatePrompt", e),
|
|
943
|
+
metadata: [...o]
|
|
861
944
|
};
|
|
862
|
-
throw new
|
|
945
|
+
throw new le(c);
|
|
863
946
|
}
|
|
864
|
-
const
|
|
947
|
+
const a = String(s.payload ?? ""), l = o.findIndex((c) => c === a);
|
|
865
948
|
return {
|
|
866
949
|
selectedTemplate: (l >= 0 ? n[l] : void 0)?.templateId ?? n[0]?.templateId ?? null
|
|
867
950
|
};
|
|
868
|
-
},
|
|
869
|
-
if (
|
|
951
|
+
}, Gt = async (t, e) => {
|
|
952
|
+
if (g(e))
|
|
870
953
|
return {};
|
|
871
|
-
await w({ text:
|
|
872
|
-
const s = t.agentExecutionContext.userRequest, i =
|
|
873
|
-
if (
|
|
954
|
+
await w({ text: b("searchingExistingSolutions", e) }, e);
|
|
955
|
+
const s = t.agentExecutionContext.userRequest, i = ct(t.agentExecutionContext.messages) || s, n = await Te(e);
|
|
956
|
+
if (g(e))
|
|
874
957
|
return {};
|
|
875
958
|
if (!n)
|
|
876
959
|
return console.warn("Solutions Search: failed to load solution embeddings cache; skipping search."), { existingMatches: [] };
|
|
877
960
|
if (!n.length)
|
|
878
961
|
return { existingMatches: [] };
|
|
879
|
-
const [
|
|
880
|
-
if (
|
|
962
|
+
const [o] = await Ue([i]);
|
|
963
|
+
if (g(e))
|
|
881
964
|
return {};
|
|
882
|
-
const
|
|
883
|
-
solution:
|
|
884
|
-
score:
|
|
965
|
+
const a = n.map((u) => ({
|
|
966
|
+
solution: u,
|
|
967
|
+
score: Oe(o, u.embedding)
|
|
885
968
|
}));
|
|
886
|
-
|
|
887
|
-
const l =
|
|
969
|
+
a.sort((u, f) => f.score - u.score);
|
|
970
|
+
const l = a.slice(0, Ct);
|
|
888
971
|
if (!l.length)
|
|
889
972
|
return { existingMatches: [] };
|
|
890
|
-
const
|
|
891
|
-
Snippet: ${
|
|
892
|
-
Description: ${
|
|
973
|
+
const d = l.map(({ solution: u }) => `${u.title}
|
|
974
|
+
Snippet: ${u.snippet}
|
|
975
|
+
Description: ${u.description}`).join(`
|
|
893
976
|
|
|
894
977
|
`), c = t.agentExecutionContext.messages.slice(-11);
|
|
895
|
-
return { existingMatches: (await
|
|
896
|
-
promptText: await v(
|
|
978
|
+
return { existingMatches: (await C({
|
|
979
|
+
promptText: await v(E, "findExistingSolution"),
|
|
897
980
|
modelTier: "fast",
|
|
898
981
|
temperature: 0,
|
|
899
|
-
schema:
|
|
982
|
+
schema: xt,
|
|
900
983
|
messages: c,
|
|
901
|
-
inputVariables: { query: s, candidates:
|
|
902
|
-
})).matchedTitles.map((
|
|
903
|
-
},
|
|
904
|
-
if (
|
|
984
|
+
inputVariables: { query: s, candidates: d }
|
|
985
|
+
})).matchedTitles.map((u) => l.find(({ solution: f }) => f.title === u)).filter((u) => u !== void 0) };
|
|
986
|
+
}, Qt = (t, e) => {
|
|
987
|
+
if (g(e))
|
|
905
988
|
return {};
|
|
906
989
|
const { existingMatches: s } = t, { hitlResponse: i } = e.configurable, n = `confirmExistingSolution:${s[0].solution.id}`;
|
|
907
990
|
if (i?.agentId !== "solutionBuilder" || i.id !== n) {
|
|
908
|
-
s.length === 1 ?
|
|
909
|
-
const
|
|
910
|
-
|
|
911
|
-
|
|
991
|
+
s.length === 1 ? ge(s[0].solution.id) : me(s);
|
|
992
|
+
const d = b("existingSolutionMatch", e), c = [
|
|
993
|
+
b("continueBuildingYes", e),
|
|
994
|
+
b("continueBuildingNo", e)
|
|
912
995
|
], m = {
|
|
913
996
|
agentId: "solutionBuilder",
|
|
914
997
|
id: n,
|
|
915
998
|
kind: "singleSelection",
|
|
916
|
-
message:
|
|
999
|
+
message: d,
|
|
917
1000
|
metadata: c
|
|
918
1001
|
};
|
|
919
|
-
throw new
|
|
1002
|
+
throw new le(m);
|
|
920
1003
|
}
|
|
921
|
-
const
|
|
922
|
-
return { continueBuilding:
|
|
923
|
-
},
|
|
924
|
-
const s =
|
|
1004
|
+
const o = String(i.payload ?? "").trim(), a = b("continueBuildingNo", e);
|
|
1005
|
+
return { continueBuilding: o !== a };
|
|
1006
|
+
}, Ht = (t, e) => {
|
|
1007
|
+
const s = b("continueBuildingDeclined", e);
|
|
925
1008
|
return {
|
|
926
1009
|
outputMessage: s,
|
|
927
1010
|
summary: s,
|
|
928
1011
|
status: "success"
|
|
929
1012
|
};
|
|
930
|
-
},
|
|
931
|
-
if (
|
|
1013
|
+
}, ke = async (t, e) => {
|
|
1014
|
+
if (g(e))
|
|
932
1015
|
return {};
|
|
933
|
-
if (await
|
|
1016
|
+
if (await Ce(e), g(e))
|
|
934
1017
|
return {};
|
|
935
1018
|
const { currentDesign: s } = t, i = t.agentExecutionContext.userRequest;
|
|
936
|
-
await w({ text:
|
|
1019
|
+
await w({ text: b("creatingDesign", e) }, e);
|
|
937
1020
|
let n = P(t.selectedTemplate);
|
|
938
|
-
if (n?.initialTemplate || (await
|
|
1021
|
+
if (n?.initialTemplate || (await Z(e), n = P(t.selectedTemplate)), g(e))
|
|
939
1022
|
return {};
|
|
940
1023
|
if (!n?.initialTemplate)
|
|
941
1024
|
throw new Error("No hydrated templates are available for solution design.");
|
|
942
|
-
const
|
|
1025
|
+
const o = L(
|
|
943
1026
|
s ?? n.initialTemplate,
|
|
944
1027
|
{
|
|
945
1028
|
itemId: (s ?? n.initialTemplate)?.solution?.itemId ?? null,
|
|
946
1029
|
sourceBuildSolution: s?.sourceBuildSolution ?? n.initialTemplate.sourceBuildSolution,
|
|
947
1030
|
params: s?.params ?? n.initialTemplate.params ?? null
|
|
948
1031
|
}
|
|
949
|
-
),
|
|
950
|
-
promptText: await v(
|
|
1032
|
+
), a = t.agentExecutionContext.messages.slice(-11), l = await C({
|
|
1033
|
+
promptText: await v(E, "designSolution"),
|
|
951
1034
|
modelTier: "advanced",
|
|
952
1035
|
temperature: 0,
|
|
953
|
-
schema:
|
|
954
|
-
messages:
|
|
1036
|
+
schema: Y,
|
|
1037
|
+
messages: a,
|
|
955
1038
|
inputVariables: {
|
|
956
|
-
currentDesign: JSON.stringify(
|
|
1039
|
+
currentDesign: JSON.stringify(ue(o)),
|
|
957
1040
|
templateInstructions: n.instructions,
|
|
958
1041
|
query: i
|
|
959
1042
|
}
|
|
960
1043
|
});
|
|
961
|
-
if (await w({ text: " of design solution 1" }, e),
|
|
1044
|
+
if (await w({ text: " of design solution 1" }, e), g(e))
|
|
962
1045
|
return {};
|
|
963
|
-
const { response:
|
|
1046
|
+
const { response: d, featureLayer: c, ...m } = l, h = pe(
|
|
964
1047
|
c,
|
|
965
|
-
|
|
966
|
-
),
|
|
967
|
-
{ ...m, featureLayer:
|
|
1048
|
+
o.featureLayer
|
|
1049
|
+
), u = L(
|
|
1050
|
+
{ ...m, featureLayer: h },
|
|
968
1051
|
{
|
|
969
|
-
itemId:
|
|
970
|
-
sourceBuildSolution:
|
|
1052
|
+
itemId: o?.solution?.itemId,
|
|
1053
|
+
sourceBuildSolution: o.sourceBuildSolution,
|
|
971
1054
|
templateId: t.selectedTemplate ?? null,
|
|
972
|
-
params:
|
|
1055
|
+
params: o.params ?? null
|
|
973
1056
|
}
|
|
974
|
-
),
|
|
975
|
-
if (!
|
|
1057
|
+
), f = new ve(u, n.initialTemplate);
|
|
1058
|
+
if (!f.isValid)
|
|
976
1059
|
return console.warn(
|
|
977
1060
|
"[SolutionBuilder] designSolution validation failed:",
|
|
978
|
-
{ issues:
|
|
1061
|
+
{ issues: f.issues, llmResponse: l }
|
|
979
1062
|
), {
|
|
980
|
-
outputMessage:
|
|
1063
|
+
outputMessage: b("createDesignFailed", e)
|
|
981
1064
|
};
|
|
982
|
-
const
|
|
983
|
-
if (
|
|
1065
|
+
const S = u.sourceBuildSolution, $ = we(u, S);
|
|
1066
|
+
if (!$.ok) {
|
|
984
1067
|
console.warn(
|
|
985
1068
|
"[SolutionBuilder] designSolution Esri JSON conversion failed:",
|
|
986
|
-
{ error:
|
|
1069
|
+
{ error: $.error, llmResponse: l, design: u }
|
|
987
1070
|
);
|
|
988
|
-
const
|
|
1071
|
+
const T = b("createDesignFailed", e);
|
|
989
1072
|
return {
|
|
990
|
-
outputMessage:
|
|
991
|
-
summary:
|
|
1073
|
+
outputMessage: T,
|
|
1074
|
+
summary: T,
|
|
992
1075
|
status: "success"
|
|
993
1076
|
};
|
|
994
1077
|
}
|
|
995
|
-
return
|
|
996
|
-
outputMessage:
|
|
997
|
-
summary:
|
|
1078
|
+
return g(e) ? {} : (xe(u), {
|
|
1079
|
+
outputMessage: d,
|
|
1080
|
+
summary: d,
|
|
998
1081
|
status: "success",
|
|
999
|
-
currentDesign:
|
|
1082
|
+
currentDesign: u
|
|
1000
1083
|
});
|
|
1001
|
-
},
|
|
1002
|
-
if (
|
|
1084
|
+
}, Wt = async (t, e) => {
|
|
1085
|
+
if (g(e))
|
|
1003
1086
|
return {};
|
|
1004
1087
|
const { currentDesign: s } = t;
|
|
1005
1088
|
if (!s)
|
|
1006
|
-
return
|
|
1089
|
+
return ke(t, e);
|
|
1007
1090
|
const i = t.agentExecutionContext.userRequest, n = t.agentExecutionContext.messages.slice(-11);
|
|
1008
|
-
await w({ text:
|
|
1009
|
-
let
|
|
1091
|
+
await w({ text: b("updatingDesign", e) }, e);
|
|
1092
|
+
let o;
|
|
1010
1093
|
try {
|
|
1011
|
-
|
|
1012
|
-
promptText: await v(
|
|
1094
|
+
o = await C({
|
|
1095
|
+
promptText: await v(E, "updateDesign"),
|
|
1013
1096
|
modelTier: "advanced",
|
|
1014
1097
|
temperature: 0,
|
|
1015
|
-
schema:
|
|
1098
|
+
schema: bt,
|
|
1016
1099
|
messages: n,
|
|
1017
1100
|
inputVariables: {
|
|
1018
|
-
currentDesign: JSON.stringify(
|
|
1101
|
+
currentDesign: JSON.stringify(de(s)),
|
|
1019
1102
|
query: i
|
|
1020
1103
|
}
|
|
1021
1104
|
});
|
|
1022
1105
|
} catch (p) {
|
|
1023
1106
|
console.warn("[SolutionBuilder] updateDesign structured prompt failed:", p);
|
|
1024
|
-
const x =
|
|
1107
|
+
const x = b("applyChangeFailed", e);
|
|
1025
1108
|
return {
|
|
1026
1109
|
outputMessage: x,
|
|
1027
1110
|
summary: x,
|
|
1028
1111
|
status: "success"
|
|
1029
1112
|
};
|
|
1030
1113
|
}
|
|
1031
|
-
const { response:
|
|
1114
|
+
const { response: a, patches: l } = o;
|
|
1032
1115
|
if (!l || l.length === 0)
|
|
1033
1116
|
return {
|
|
1034
|
-
outputMessage:
|
|
1035
|
-
summary:
|
|
1117
|
+
outputMessage: a,
|
|
1118
|
+
summary: a,
|
|
1036
1119
|
status: "success"
|
|
1037
1120
|
};
|
|
1038
|
-
const
|
|
1121
|
+
const d = (p) => {
|
|
1039
1122
|
try {
|
|
1040
1123
|
return JSON.parse(p);
|
|
1041
1124
|
} catch {
|
|
1042
|
-
const x = p.replace(/[\u0000-\u001F]/g, (
|
|
1043
|
-
switch (
|
|
1125
|
+
const x = p.replace(/[\u0000-\u001F]/g, (ie) => {
|
|
1126
|
+
switch (ie) {
|
|
1044
1127
|
case "\b":
|
|
1045
1128
|
return "\\b";
|
|
1046
1129
|
case "\f":
|
|
@@ -1053,7 +1136,7 @@ Description: ${d.description}`).join(`
|
|
|
1053
1136
|
case " ":
|
|
1054
1137
|
return "\\t";
|
|
1055
1138
|
default:
|
|
1056
|
-
return "\\u" +
|
|
1139
|
+
return "\\u" + ie.charCodeAt(0).toString(16).padStart(4, "0");
|
|
1057
1140
|
}
|
|
1058
1141
|
});
|
|
1059
1142
|
try {
|
|
@@ -1065,46 +1148,46 @@ Description: ${d.description}`).join(`
|
|
|
1065
1148
|
}, m = [...l.map((p) => ({
|
|
1066
1149
|
op: p.op,
|
|
1067
1150
|
path: p.path.replace(/\/+$/, ""),
|
|
1068
|
-
...p.value != null && p.value !== "" ? { value:
|
|
1151
|
+
...p.value != null && p.value !== "" ? { value: d(p.value) } : {},
|
|
1069
1152
|
...p.from != null && p.from !== "" ? { from: p.from } : {}
|
|
1070
|
-
}))].sort((p, x) => p.op !== "remove" || x.op !== "remove" ? 0 : x.path.localeCompare(p.path, void 0, { numeric: !0 })),
|
|
1071
|
-
|
|
1153
|
+
}))].sort((p, x) => p.op !== "remove" || x.op !== "remove" ? 0 : x.path.localeCompare(p.path, void 0, { numeric: !0 })), h = structuredClone(
|
|
1154
|
+
ue(s)
|
|
1072
1155
|
);
|
|
1073
1156
|
try {
|
|
1074
|
-
|
|
1157
|
+
je(h, m, !0);
|
|
1075
1158
|
} catch (p) {
|
|
1076
1159
|
console.warn(
|
|
1077
1160
|
"[SolutionBuilder] updateDesign JSON patch failed:",
|
|
1078
|
-
{ error: p, llmResponse:
|
|
1161
|
+
{ error: p, llmResponse: o, patches: m, patchTarget: h }
|
|
1079
1162
|
);
|
|
1080
|
-
const x =
|
|
1163
|
+
const x = b("applyChangeFailed", e);
|
|
1081
1164
|
return {
|
|
1082
1165
|
outputMessage: x,
|
|
1083
1166
|
summary: x,
|
|
1084
1167
|
status: "success"
|
|
1085
1168
|
};
|
|
1086
1169
|
}
|
|
1087
|
-
const
|
|
1088
|
-
{ response: "", ...
|
|
1170
|
+
const u = L(
|
|
1171
|
+
{ response: "", ...h },
|
|
1089
1172
|
{ itemId: s.solution?.itemId ?? null }
|
|
1090
|
-
),
|
|
1091
|
-
if (!
|
|
1173
|
+
), f = Y.safeParse(u);
|
|
1174
|
+
if (!f.success) {
|
|
1092
1175
|
console.warn(
|
|
1093
1176
|
"[SolutionBuilder] updateDesign schema validation failed:",
|
|
1094
|
-
{ errors:
|
|
1177
|
+
{ errors: f.error.issues, llmResponse: o, patchedDesign: u }
|
|
1095
1178
|
);
|
|
1096
|
-
const p =
|
|
1179
|
+
const p = b("applyChangeFailed", e);
|
|
1097
1180
|
return {
|
|
1098
1181
|
outputMessage: p,
|
|
1099
1182
|
summary: p,
|
|
1100
1183
|
status: "success"
|
|
1101
1184
|
};
|
|
1102
1185
|
}
|
|
1103
|
-
const { response:
|
|
1104
|
-
|
|
1186
|
+
const { response: S, featureLayer: $, ...T } = f.data, U = pe(
|
|
1187
|
+
$,
|
|
1105
1188
|
s.featureLayer
|
|
1106
|
-
),
|
|
1107
|
-
{ ...
|
|
1189
|
+
), _ = L(
|
|
1190
|
+
{ ...T, featureLayer: U },
|
|
1108
1191
|
{
|
|
1109
1192
|
itemId: s.solution?.itemId,
|
|
1110
1193
|
sourceBuildSolution: s.sourceBuildSolution,
|
|
@@ -1112,23 +1195,23 @@ Description: ${d.description}`).join(`
|
|
|
1112
1195
|
params: s.params ?? null
|
|
1113
1196
|
}
|
|
1114
1197
|
);
|
|
1115
|
-
let
|
|
1116
|
-
if (
|
|
1198
|
+
let R = P(t.selectedTemplate);
|
|
1199
|
+
if (R?.initialTemplate || (await Z(e), R = P(t.selectedTemplate)), g(e))
|
|
1117
1200
|
return {};
|
|
1118
|
-
if (!
|
|
1201
|
+
if (!R?.initialTemplate)
|
|
1119
1202
|
throw new Error("No hydrated templates are available for solution design.");
|
|
1120
|
-
const
|
|
1121
|
-
if (!
|
|
1203
|
+
const O = new ve(_, R.initialTemplate, !1);
|
|
1204
|
+
if (!O.isValid) {
|
|
1122
1205
|
console.warn(
|
|
1123
1206
|
"[SolutionBuilder] updateDesign validation failed:",
|
|
1124
|
-
{ issues:
|
|
1207
|
+
{ issues: O.issues, llmResponse: o, patchedDesign: _ }
|
|
1125
1208
|
);
|
|
1126
|
-
const p = await
|
|
1209
|
+
const p = await It({
|
|
1127
1210
|
query: i,
|
|
1128
|
-
validationIssues:
|
|
1211
|
+
validationIssues: O.issues,
|
|
1129
1212
|
recentMessages: n,
|
|
1130
|
-
fallbackMessage:
|
|
1131
|
-
promptModules:
|
|
1213
|
+
fallbackMessage: b("applyChangeFailed", e),
|
|
1214
|
+
promptModules: E
|
|
1132
1215
|
});
|
|
1133
1216
|
return {
|
|
1134
1217
|
outputMessage: p,
|
|
@@ -1136,58 +1219,60 @@ Description: ${d.description}`).join(`
|
|
|
1136
1219
|
status: "success"
|
|
1137
1220
|
};
|
|
1138
1221
|
}
|
|
1139
|
-
const Ee =
|
|
1140
|
-
if (!
|
|
1222
|
+
const Ee = _.sourceBuildSolution, se = we(_, Ee);
|
|
1223
|
+
if (!se.ok) {
|
|
1141
1224
|
console.warn(
|
|
1142
1225
|
"[SolutionBuilder] updateDesign Esri JSON conversion failed:",
|
|
1143
|
-
{ error:
|
|
1226
|
+
{ error: se.error, llmResponse: o, design: _ }
|
|
1144
1227
|
);
|
|
1145
|
-
const p =
|
|
1228
|
+
const p = b("applyChangeFailed", e);
|
|
1146
1229
|
return {
|
|
1147
1230
|
outputMessage: p,
|
|
1148
1231
|
summary: p,
|
|
1149
1232
|
status: "success"
|
|
1150
1233
|
};
|
|
1151
1234
|
}
|
|
1152
|
-
return
|
|
1153
|
-
outputMessage:
|
|
1154
|
-
summary:
|
|
1235
|
+
return g(e) ? {} : (xe(_), {
|
|
1236
|
+
outputMessage: a,
|
|
1237
|
+
summary: a,
|
|
1155
1238
|
status: "success",
|
|
1156
|
-
currentDesign:
|
|
1239
|
+
currentDesign: _
|
|
1157
1240
|
});
|
|
1158
|
-
},
|
|
1241
|
+
}, Kt = (t) => t.currentDesign !== null ? "assessUpdateRequest" : "assessBuildRequest", Yt = (t) => !t.updateAssessment || !t.updateAssessment.isValidUpdate ? "invalidUpdateExit" : "updateDesign", Xt = (t) => !t.assessment || !t.assessment.isValidUseCase ? "invalidBuildExit" : !t.selectedTemplate && t.assessment.matchedTemplates.length > 1 ? "selectTemplateHIL" : "findExistingSolutions", Zt = (t) => t.existingMatches.length > 0 ? "confirmContinueBuildingHIL" : "designSolution", es = (t) => t.continueBuilding === !1 ? "declineContinueBuildingExit" : "designSolution", ts = () => new Q(qt).addNode("syncCurrentDesignFromContext", Ut).addNode("assessBuildRequest", Ot).addNode("assessUpdateRequest", jt).addNode("invalidBuildExit", zt).addNode("invalidUpdateExit", Vt).addNode("selectTemplateHIL", Jt).addNode("findExistingSolutions", Gt).addNode("confirmContinueBuildingHIL", Qt).addNode("declineContinueBuildingExit", Ht).addNode("designSolution", ke).addNode("updateDesign", Wt).addEdge(H, "syncCurrentDesignFromContext").addConditionalEdges("syncCurrentDesignFromContext", Kt, {
|
|
1159
1242
|
assessUpdateRequest: "assessUpdateRequest",
|
|
1160
1243
|
assessBuildRequest: "assessBuildRequest"
|
|
1161
|
-
}).addConditionalEdges("assessUpdateRequest",
|
|
1244
|
+
}).addConditionalEdges("assessUpdateRequest", Yt, {
|
|
1162
1245
|
invalidUpdateExit: "invalidUpdateExit",
|
|
1163
1246
|
updateDesign: "updateDesign"
|
|
1164
|
-
}).addConditionalEdges("assessBuildRequest",
|
|
1247
|
+
}).addConditionalEdges("assessBuildRequest", Xt, {
|
|
1165
1248
|
invalidBuildExit: "invalidBuildExit",
|
|
1166
1249
|
selectTemplateHIL: "selectTemplateHIL",
|
|
1167
1250
|
findExistingSolutions: "findExistingSolutions"
|
|
1168
|
-
}).addEdge("invalidBuildExit",
|
|
1251
|
+
}).addEdge("invalidBuildExit", I).addEdge("invalidUpdateExit", I).addEdge("selectTemplateHIL", "findExistingSolutions").addConditionalEdges("findExistingSolutions", Zt, {
|
|
1169
1252
|
confirmContinueBuildingHIL: "confirmContinueBuildingHIL",
|
|
1170
1253
|
designSolution: "designSolution"
|
|
1171
|
-
}).addConditionalEdges("confirmContinueBuildingHIL",
|
|
1254
|
+
}).addConditionalEdges("confirmContinueBuildingHIL", es, {
|
|
1172
1255
|
declineContinueBuildingExit: "declineContinueBuildingExit",
|
|
1173
1256
|
designSolution: "designSolution"
|
|
1174
|
-
}).addEdge("declineContinueBuildingExit",
|
|
1175
|
-
await v(
|
|
1176
|
-
const
|
|
1177
|
-
tool:
|
|
1178
|
-
confidence:
|
|
1179
|
-
rationale:
|
|
1180
|
-
}),
|
|
1257
|
+
}).addEdge("declineContinueBuildingExit", I).addEdge("designSolution", I).addEdge("updateDesign", I);
|
|
1258
|
+
await v(E, "description");
|
|
1259
|
+
const ss = A.object({
|
|
1260
|
+
tool: A.enum(["explorer", "builder", "other"]).describe("The selected tool based on the user's query."),
|
|
1261
|
+
confidence: A.number().min(0).max(1).describe("A confidence score (0.00–1.00)."),
|
|
1262
|
+
rationale: A.string().min(1).describe("A brief rationale for the tool choice (≤140 characters)")
|
|
1263
|
+
}), ee = /* @__PURE__ */ Object.assign({
|
|
1181
1264
|
"./prompts/assistantResponse.md": () => import("../../chunks/assistantResponse.js").then((t) => t.default),
|
|
1182
1265
|
"./prompts/classifyIntent.md": () => import("../../chunks/classifyIntent.js").then((t) => t.default),
|
|
1183
1266
|
"./prompts/description.md": () => import("../../chunks/description.js").then((t) => t.default)
|
|
1184
|
-
}),
|
|
1185
|
-
const
|
|
1186
|
-
|
|
1267
|
+
}), te = (t, e) => {
|
|
1268
|
+
const s = t?.configurable?.context?.setLastTurnAgent;
|
|
1269
|
+
typeof s == "function" && s(e);
|
|
1270
|
+
const i = new CustomEvent("assistantProcessing", {
|
|
1271
|
+
detail: { finished: !0, agent: e }
|
|
1187
1272
|
});
|
|
1188
|
-
window.dispatchEvent(
|
|
1189
|
-
},
|
|
1190
|
-
...
|
|
1273
|
+
window.dispatchEvent(i);
|
|
1274
|
+
}, Ae = y.Root({
|
|
1275
|
+
...W(),
|
|
1191
1276
|
selectedTool: y({
|
|
1192
1277
|
reducer: (t, e) => e ?? null,
|
|
1193
1278
|
default: () => null
|
|
@@ -1196,7 +1281,7 @@ const Zt = D.object({
|
|
|
1196
1281
|
reducer: (t, e) => e ?? null,
|
|
1197
1282
|
default: () => null
|
|
1198
1283
|
})
|
|
1199
|
-
}),
|
|
1284
|
+
}), is = async (t, e) => {
|
|
1200
1285
|
if (e?.configurable?.abortSignal?.aborted)
|
|
1201
1286
|
return {};
|
|
1202
1287
|
const s = q(e);
|
|
@@ -1204,37 +1289,37 @@ const Zt = D.object({
|
|
|
1204
1289
|
{ text: s?.builderMessages.understandingRequest },
|
|
1205
1290
|
e
|
|
1206
1291
|
);
|
|
1207
|
-
const i = t.agentExecutionContext.userRequest, n = t.agentExecutionContext.messages.slice(-11),
|
|
1208
|
-
let
|
|
1209
|
-
if (typeof
|
|
1292
|
+
const i = t.agentExecutionContext.userRequest, n = t.agentExecutionContext.messages.slice(-11), o = e?.configurable?.context?.solutionDesignJson;
|
|
1293
|
+
let a = !1;
|
|
1294
|
+
if (typeof o == "string" && o.trim())
|
|
1210
1295
|
try {
|
|
1211
|
-
|
|
1296
|
+
a = JSON.parse(o).solution != null;
|
|
1212
1297
|
} catch {
|
|
1213
|
-
|
|
1298
|
+
a = !1;
|
|
1214
1299
|
}
|
|
1215
|
-
const l = await v(
|
|
1300
|
+
const l = await v(ee, "classifyIntent"), d = await C({
|
|
1216
1301
|
promptText: l,
|
|
1217
1302
|
modelTier: "advanced",
|
|
1218
1303
|
temperature: 0,
|
|
1219
|
-
schema:
|
|
1304
|
+
schema: ss,
|
|
1220
1305
|
messages: n,
|
|
1221
|
-
inputVariables: { query: i, activeSolutionDesign:
|
|
1306
|
+
inputVariables: { query: i, activeSolutionDesign: a }
|
|
1222
1307
|
});
|
|
1223
1308
|
return {
|
|
1224
|
-
selectedTool:
|
|
1225
|
-
intentRationale:
|
|
1309
|
+
selectedTool: d.tool,
|
|
1310
|
+
intentRationale: d.rationale
|
|
1226
1311
|
};
|
|
1227
|
-
},
|
|
1312
|
+
}, ns = async (t, e) => {
|
|
1228
1313
|
if (e?.configurable?.abortSignal?.aborted)
|
|
1229
1314
|
return {};
|
|
1230
|
-
const i = await
|
|
1231
|
-
return
|
|
1232
|
-
},
|
|
1315
|
+
const i = await it().compile().invoke(t, e);
|
|
1316
|
+
return te(e, "explorer"), i;
|
|
1317
|
+
}, as = async (t, e) => {
|
|
1233
1318
|
if (e?.configurable?.abortSignal?.aborted)
|
|
1234
1319
|
return {};
|
|
1235
|
-
const i = await
|
|
1236
|
-
return
|
|
1237
|
-
},
|
|
1320
|
+
const i = await ts().compile().invoke(t, e);
|
|
1321
|
+
return te(e, "builder"), i;
|
|
1322
|
+
}, os = async (t, e) => {
|
|
1238
1323
|
if (e?.configurable?.abortSignal?.aborted)
|
|
1239
1324
|
return {};
|
|
1240
1325
|
const s = q(e), i = t.agentExecutionContext.userRequest, n = t.intentRationale ?? "No rationale available.";
|
|
@@ -1242,43 +1327,43 @@ const Zt = D.object({
|
|
|
1242
1327
|
{ text: s?.executingSolutionsAssistantAgent },
|
|
1243
1328
|
e
|
|
1244
1329
|
);
|
|
1245
|
-
const
|
|
1246
|
-
promptText:
|
|
1330
|
+
const o = await v(ee, "assistantResponse"), a = t.agentExecutionContext.messages.slice(-11), l = await ze({
|
|
1331
|
+
promptText: o,
|
|
1247
1332
|
modelTier: "advanced",
|
|
1248
1333
|
temperature: 0,
|
|
1249
|
-
messages:
|
|
1334
|
+
messages: a,
|
|
1250
1335
|
inputVariables: { query: i, rationale: n }
|
|
1251
1336
|
});
|
|
1252
|
-
return
|
|
1337
|
+
return te(e, "assistant"), {
|
|
1253
1338
|
outputMessage: l,
|
|
1254
1339
|
summary: l,
|
|
1255
1340
|
status: "success"
|
|
1256
1341
|
};
|
|
1257
|
-
},
|
|
1342
|
+
}, rs = (t) => t.selectedTool ?? "other", ls = () => new Q(Ae).addNode("classifyIntent", is).addNode("routeToExplorer", ns).addNode("routeToBuilder", as).addNode("assistantResponse", os).addEdge(H, "classifyIntent").addConditionalEdges("classifyIntent", rs, {
|
|
1258
1343
|
explorer: "routeToExplorer",
|
|
1259
1344
|
builder: "routeToBuilder",
|
|
1260
1345
|
other: "assistantResponse"
|
|
1261
|
-
}).addEdge("routeToExplorer",
|
|
1346
|
+
}).addEdge("routeToExplorer", I).addEdge("routeToBuilder", I).addEdge("assistantResponse", I), cs = await v(ee, "description"), ds = {
|
|
1262
1347
|
id: "solutionsAssistant",
|
|
1263
1348
|
name: "Solutions Assistant Agent",
|
|
1264
|
-
description:
|
|
1265
|
-
createGraph:
|
|
1266
|
-
workspace:
|
|
1267
|
-
},
|
|
1268
|
-
class
|
|
1349
|
+
description: cs,
|
|
1350
|
+
createGraph: ls,
|
|
1351
|
+
workspace: Ae
|
|
1352
|
+
}, us = "https://links.esri.com/solutions/agol-organizational-account", ps = "https://links.esri.com/solutions/configure-assistants";
|
|
1353
|
+
class ms extends Fe {
|
|
1269
1354
|
constructor() {
|
|
1270
|
-
super(), this.open = !1, this.userFirstName = "", this.builderVisible = !1, this.hasActiveBuilderDesign = !1, this._conversationId = void 0, this._orgSettings = {
|
|
1355
|
+
super(), this.open = !1, this.userFirstName = "", this.builderVisible = !1, this.hasActiveBuilderDesign = !1, this._conversationId = void 0, this._lastTurnAgent = void 0, this._orgSettings = {
|
|
1271
1356
|
aiAssistantsEnabled: !1,
|
|
1272
1357
|
blockBetaApps: !0,
|
|
1273
1358
|
colocateCompute: !1
|
|
1274
|
-
}, this._suggestedPrompts = [], this._hasInteracted = !1, this._isMobile = window.innerWidth <= 800, this._translations =
|
|
1275
|
-
context:
|
|
1359
|
+
}, this._suggestedPrompts = [], this._hasInteracted = !1, this._isMobile = window.innerWidth <= 800, this._translations = $e({ 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 = Pe(), this._configContextConsumer = oe({
|
|
1360
|
+
context: Ne,
|
|
1276
1361
|
subscribe: !0,
|
|
1277
1362
|
callback: (e) => {
|
|
1278
|
-
e?.portalURL && (
|
|
1363
|
+
e?.portalURL && (z.portalUrl = e.portalURL), e?.userSession && !this.userFirstName && this._loadUserFirstName(), e?.authentication?.PortalSubset?.orgSettings && (this._orgSettings = e?.authentication?.PortalSubset?.orgSettings);
|
|
1279
1364
|
}
|
|
1280
|
-
}), this._builderDesignContextConsumer =
|
|
1281
|
-
context:
|
|
1365
|
+
}), this._builderDesignContextConsumer = oe({
|
|
1366
|
+
context: Me,
|
|
1282
1367
|
subscribe: !0,
|
|
1283
1368
|
callback: (e) => {
|
|
1284
1369
|
e?.design && (this._solutionDesignJson = JSON.stringify(e.design, null, 2));
|
|
@@ -1288,15 +1373,15 @@ class ds extends $e {
|
|
|
1288
1373
|
}, this._chatStartTime = null, this._handleAssistantProcessingFinished = (e) => {
|
|
1289
1374
|
const s = e;
|
|
1290
1375
|
if (s.detail?.finished && this._chatStartTime !== null) {
|
|
1291
|
-
const i =
|
|
1376
|
+
const i = Be(this._chatStartTime);
|
|
1292
1377
|
this._telemetry?.logEvent({
|
|
1293
|
-
category:
|
|
1378
|
+
category: D.ASSISTANT,
|
|
1294
1379
|
action: "Chat",
|
|
1295
1380
|
dimensions: [s.detail.agent],
|
|
1296
1381
|
metrics: [i]
|
|
1297
1382
|
}), this._chatStartTime = null, this.assistantProcessing.emit(!1);
|
|
1298
1383
|
}
|
|
1299
|
-
}, this.closeAssistant =
|
|
1384
|
+
}, this.closeAssistant = ne(), this.assistantProcessing = ne(), this._handleAssistantLinkClick = (e) => {
|
|
1300
1385
|
const s = e.composedPath().find((i) => i instanceof HTMLAnchorElement);
|
|
1301
1386
|
if (s?.href)
|
|
1302
1387
|
if (e.preventDefault(), s.target.indexOf("solutionId:") > -1) {
|
|
@@ -1312,14 +1397,14 @@ class ds extends $e {
|
|
|
1312
1397
|
}, this._checkURLOpenParameter = () => {
|
|
1313
1398
|
this.open = this._configContextConsumer.value?.authentication?.SignInParam === "aiOpen" || this.open;
|
|
1314
1399
|
}, this.listenOn(window, "arcgisFeedback", (e) => {
|
|
1315
|
-
const s = e.detail, { agentPicked: i, taskAssigned: n, userMessage:
|
|
1316
|
-
this._sendFeedback(s.content,
|
|
1400
|
+
const s = e.detail, { agentPicked: i, taskAssigned: n, userMessage: o } = this._parseAgentPickedAndTask(s);
|
|
1401
|
+
this._sendFeedback(s.content, o ?? n ?? "", s.feedback?.positive ? "Good" : s.feedback?.positive == "Bad" ? "Bad" : "N/A", i ?? "");
|
|
1317
1402
|
}), this.listenOn(window, "clearAssistantConversation", () => {
|
|
1318
1403
|
this._clearConversation();
|
|
1319
1404
|
});
|
|
1320
1405
|
}
|
|
1321
1406
|
static {
|
|
1322
|
-
this.properties = { open: 5, userFirstName: 1, builderVisible: 5, hasActiveBuilderDesign: 5, _conversationId: 16, _orgSettings: 16, _suggestedPrompts: 16, _hasInteracted: 16, _isMobile: 16, _translations: 16, _builderWidth: 16, _solutionDesignJson: 16, _isAssistantBusy: 16, _isBuilderBusy: 16, _preChatCheck: 16, _showNewChatConfirm: 16 };
|
|
1407
|
+
this.properties = { open: 5, userFirstName: 1, builderVisible: 5, hasActiveBuilderDesign: 5, _conversationId: 16, _lastTurnAgent: 16, _orgSettings: 16, _suggestedPrompts: 16, _hasInteracted: 16, _isMobile: 16, _translations: 16, _builderWidth: 16, _solutionDesignJson: 16, _isAssistantBusy: 16, _isBuilderBusy: 16, _preChatCheck: 16, _showNewChatConfirm: 16 };
|
|
1323
1408
|
}
|
|
1324
1409
|
static {
|
|
1325
1410
|
this.styles = He;
|
|
@@ -1337,39 +1422,39 @@ class ds extends $e {
|
|
|
1337
1422
|
this._checkURLOpenParameter();
|
|
1338
1423
|
}
|
|
1339
1424
|
load() {
|
|
1340
|
-
this._configContextConsumer.value?.portalURL && (
|
|
1425
|
+
z.applicationName = "Solutions", this._configContextConsumer.value?.portalURL && (z.portalUrl = this._configContextConsumer.value.portalURL);
|
|
1341
1426
|
}
|
|
1342
1427
|
firstUpdated(e) {
|
|
1343
1428
|
this._loadUserFirstName();
|
|
1344
1429
|
}
|
|
1345
1430
|
willUpdate(e) {
|
|
1346
|
-
e.has("open") && this.open && window.dispatchEvent(new CustomEvent("openAssistant")), this._configContextConsumer.value?.authentication && this._configContextConsumer.value?.userSession?.token && (this._preChatCheck || (
|
|
1431
|
+
e.has("open") && this.open && window.dispatchEvent(new CustomEvent("openAssistant")), this._configContextConsumer.value?.authentication && this._configContextConsumer.value?.userSession?.token && (this._preChatCheck || (be(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;
|
|
1347
1432
|
}
|
|
1348
1433
|
_renderNoSign() {
|
|
1349
|
-
return
|
|
1434
|
+
return k`<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 ?? ae} class="padding-top-10">${this._translations.signIn}</calcite-link></calcite-notice>`;
|
|
1350
1435
|
}
|
|
1351
1436
|
_renderNoPermission() {
|
|
1352
|
-
return
|
|
1437
|
+
return k`<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">${De(this._translations.noPermissionMessage.replace("{{orgUrl}}", us).replace("{{configAI}}", ps))}</div></calcite-notice>`;
|
|
1353
1438
|
}
|
|
1354
1439
|
render() {
|
|
1355
1440
|
let e = this._suggestedPrompts.length > 0 ? this._suggestedPrompts : this._hasInteracted ? [] : Object.values(this._translations.defaultFollowUpQuestions);
|
|
1356
|
-
return this._suggestedPrompts.length > 0 ? e = this._suggestedPrompts : this._hasInteracted || (e = [...Object.values(this._translations.defaultFollowUpQuestions)]),
|
|
1441
|
+
return this._suggestedPrompts.length > 0 ? e = this._suggestedPrompts : this._hasInteracted || (e = [...Object.values(this._translations.defaultFollowUpQuestions)]), k`<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 ? k`${!this._isMobile && k`<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=${() => {
|
|
1357
1442
|
this._telemetry?.logEvent({
|
|
1358
|
-
category:
|
|
1443
|
+
category: D.ASSISTANT,
|
|
1359
1444
|
action: "Toggle Builder Panel",
|
|
1360
1445
|
dimensions: [this.builderVisible ? "Close" : "Open"]
|
|
1361
1446
|
}), window.dispatchEvent(new CustomEvent("toggleSolutionBuilder"));
|
|
1362
|
-
}} scale=m slot=header-actions-end></calcite-action>` || ""}${!this._isMobile &&
|
|
1447
|
+
}} scale=m slot=header-actions-end></calcite-action>` || ""}${!this._isMobile && k`<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 ?? ae} .suggestedPrompts=${e} @arcgisSubmit=${(s) => {
|
|
1363
1448
|
console.log("arcgis submit: ", s.detail), this._suggestedPrompts = [], e = [], this._hasInteracted = !0, this._chatStartTime = Date.now(), this.assistantProcessing.emit(!0);
|
|
1364
1449
|
}} @arcgisFeedback=${(s) => {
|
|
1365
1450
|
s.detail;
|
|
1366
|
-
}} ${
|
|
1451
|
+
}} ${qe(this._assistantRef)}><calcite-button appearance=transparent id=newChatButton icon-start=speech-bubble-plus kind=neutral .label=${this._translations.tooltips.newChat} @click=${() => {
|
|
1367
1452
|
this.hasActiveBuilderDesign ? this._showNewChatConfirm = !0 : (this._telemetry?.logEvent({
|
|
1368
|
-
category:
|
|
1453
|
+
category: D.ASSISTANT,
|
|
1369
1454
|
action: "New Chat",
|
|
1370
1455
|
dimensions: ["No Active Design"]
|
|
1371
1456
|
}), this._clearConversation());
|
|
1372
|
-
}} round scale=m slot=entry-actions-start>${this._translations.tooltips.newChat}</calcite-button><arcgis-assistant-agent .agent=${
|
|
1457
|
+
}} round scale=m slot=entry-actions-start>${this._translations.tooltips.newChat}</calcite-button><arcgis-assistant-agent .agent=${ds} .context=${{
|
|
1373
1458
|
token: this._configContextConsumer.value?.userSession?.token,
|
|
1374
1459
|
configContext: this._configContextConsumer.value,
|
|
1375
1460
|
convoId: this._conversationId,
|
|
@@ -1377,17 +1462,21 @@ class ds extends $e {
|
|
|
1377
1462
|
assistantRef: this._assistantRef,
|
|
1378
1463
|
translations: this._translations,
|
|
1379
1464
|
solutionDesignJson: this._solutionDesignJson,
|
|
1465
|
+
lastTurnAgent: this._lastTurnAgent,
|
|
1380
1466
|
setConversationId: (s) => {
|
|
1381
1467
|
this._conversationId = s;
|
|
1382
1468
|
},
|
|
1469
|
+
setLastTurnAgent: (s) => {
|
|
1470
|
+
this._lastTurnAgent = s;
|
|
1471
|
+
},
|
|
1383
1472
|
clearSuggestedPrompts: () => {
|
|
1384
1473
|
this._suggestedPrompts = [];
|
|
1385
1474
|
}
|
|
1386
|
-
}}></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 &&
|
|
1475
|
+
}}></arcgis-assistant-agent></arcgis-assistant><div slot=footer class="disclaimer-div width-100"><calcite-chip class="beta-chip" appearance=solid kind=neutral .label=${this._translations.betaTag} scale=s>${this._translations.betaTag}</calcite-chip><span>${this._translations.disclaimerMessage} <a href=https://links.esri.com/solutions/security-concern rel="noopener noreferrer" target=_blank>${this._translations.reportConcern}</a></span></div>` : this._renderNoPermission() : this._renderNoSign()}${this._showNewChatConfirm && k`<calcite-dialog close-disabled escape-disabled .heading=${this._translations.newConversationConfirmTitle} modal open outside-close-disabled>${this._translations.builderMessages.discardMessage}<calcite-button appearance=outline @click=${() => {
|
|
1387
1476
|
this._showNewChatConfirm = !1;
|
|
1388
1477
|
}} slot=footer-end>${this._translations.cancel}</calcite-button><calcite-button appearance=solid kind=danger @click=${() => {
|
|
1389
1478
|
this._telemetry?.logEvent({
|
|
1390
|
-
category:
|
|
1479
|
+
category: D.ASSISTANT,
|
|
1391
1480
|
action: "New Chat",
|
|
1392
1481
|
dimensions: ["With Design Discard"]
|
|
1393
1482
|
}), this._showNewChatConfirm = !1, window.dispatchEvent(new CustomEvent("requestBuilderDiscard"));
|
|
@@ -1396,11 +1485,11 @@ class ds extends $e {
|
|
|
1396
1485
|
}} slot=header-actions-end .text=${this._translations.tooltips.close}></calcite-action><calcite-tooltip placement=bottom reference-element=closeAssistantButton><span>${this._translations.tooltips.close}</span></calcite-tooltip></calcite-panel>`;
|
|
1397
1486
|
}
|
|
1398
1487
|
_clearConversation() {
|
|
1399
|
-
this._conversationId = void 0, this._suggestedPrompts = [], this._hasInteracted = !1, this._assistantRef.value?.clearChatHistory();
|
|
1488
|
+
this._conversationId = void 0, this._lastTurnAgent = void 0, this._suggestedPrompts = [], this._hasInteracted = !1, this._assistantRef.value?.clearChatHistory();
|
|
1400
1489
|
}
|
|
1401
1490
|
_sendFeedback(e, s, i, n) {
|
|
1402
|
-
const
|
|
1403
|
-
window.open(
|
|
1491
|
+
const o = `https://survey123.arcgis.com/share/6e349a50b4504ca6b6107216d568db5f?field:_source=${encodeURIComponent("Solutions Assistant")}&field:user_evaluation=${encodeURIComponent(i)}&field:question=${encodeURIComponent(s)}&field:answer=${encodeURIComponent(e)}&field:context=${encodeURIComponent(JSON.stringify({ agent: n }))}&field:version=${encodeURIComponent("v2")}`;
|
|
1492
|
+
window.open(o, "_blank");
|
|
1404
1493
|
}
|
|
1405
1494
|
async _loadUserFirstName() {
|
|
1406
1495
|
try {
|
|
@@ -1413,14 +1502,14 @@ class ds extends $e {
|
|
|
1413
1502
|
}
|
|
1414
1503
|
}
|
|
1415
1504
|
_parseAgentPickedAndTask(e) {
|
|
1416
|
-
const s = Array.from(this._assistantRef.value?.messages || []), i = e.log || [],
|
|
1505
|
+
const s = Array.from(this._assistantRef.value?.messages || []), i = e.log || [], a = [...s].sort((u, f) => f.id - u.id).find((u) => u.role === "user" && u.id <= e.id)?.content || null, l = i.find((u) => typeof u == "string" && u.includes("Agent picked:")) ?? null;
|
|
1417
1506
|
if (!l)
|
|
1418
|
-
return { agentPicked: null, taskAssigned: null, userMessage:
|
|
1419
|
-
const
|
|
1507
|
+
return { agentPicked: null, taskAssigned: null, userMessage: a };
|
|
1508
|
+
const d = /Agent picked:\s*(.*?)\s*(?:\\n|\r?\n)\s*Task Assigned:\s*([\s\S]*)$/i, c = l.match(d);
|
|
1420
1509
|
if (!c)
|
|
1421
|
-
return { agentPicked: null, taskAssigned: null, userMessage:
|
|
1422
|
-
const m = c[1].trim(),
|
|
1423
|
-
return { agentPicked: m, taskAssigned:
|
|
1510
|
+
return { agentPicked: null, taskAssigned: null, userMessage: a };
|
|
1511
|
+
const m = c[1].trim(), h = c[2].trim();
|
|
1512
|
+
return { agentPicked: m, taskAssigned: h, userMessage: a };
|
|
1424
1513
|
}
|
|
1425
1514
|
_emitItemIdFromAI(e) {
|
|
1426
1515
|
const s = new CustomEvent("solutionIDFromAssistant", {
|
|
@@ -1431,7 +1520,7 @@ class ds extends $e {
|
|
|
1431
1520
|
window.dispatchEvent(s);
|
|
1432
1521
|
}
|
|
1433
1522
|
}
|
|
1434
|
-
|
|
1523
|
+
Le("arcgis-solutions-assistant", ms);
|
|
1435
1524
|
export {
|
|
1436
|
-
|
|
1525
|
+
ms as ArcgisSolutionsAssistant
|
|
1437
1526
|
};
|