@esri/solutions-components 5.1.0-next.144 → 5.1.0-next.145
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/{LEK4P4OY.js → 25NZZKXC.js} +1 -1
- package/dist/cdn/2BIUOM64.js +2 -0
- package/dist/cdn/{S5AQVTR2.js → 2PUK3PST.js} +1 -1
- package/dist/cdn/{KUGXNF5Y.js → 2UMMLVCR.js} +1 -1
- package/dist/cdn/{LYAXTCCM.js → 34CZ4EWR.js} +4 -3
- package/dist/cdn/{SOLCNPHW.js → 3DCFUYKP.js} +1 -1
- package/dist/cdn/{65L2LQGD.js → 3JQ2RXVJ.js} +1 -1
- package/dist/cdn/3V2UWENT.js +2 -0
- package/dist/cdn/{7WD3GNG4.js → 4JVDUPVW.js} +1 -1
- package/dist/cdn/{BNRFT546.js → 5DEYOM7D.js} +1 -1
- package/dist/cdn/{WLM4HMMF.js → 5LF6C3S5.js} +1 -1
- package/dist/cdn/{4JGB6WLL.js → 5NQNJZTE.js} +1 -1
- package/dist/cdn/{4MAZNAHZ.js → 5OFQVDNK.js} +1 -1
- package/dist/cdn/{NV2DLQDN.js → 6MOTC6CE.js} +1 -1
- package/dist/cdn/{PUCDO65D.js → 6T35OGRG.js} +1 -1
- package/dist/cdn/{FVOCVCEE.js → 72X4E4QW.js} +1 -1
- package/dist/cdn/{Y77RX7KL.js → 7ADKNWWI.js} +1 -1
- package/dist/cdn/{DKEYOEI7.js → 7CLM77HQ.js} +1 -1
- package/dist/cdn/{IFONVCBL.js → A27DLHRU.js} +1 -1
- package/dist/cdn/{3UKDJZ2D.js → AE5HNAOV.js} +1 -1
- package/dist/cdn/{YQWQG523.js → AOWNMC3W.js} +1 -1
- package/dist/cdn/{U4RHWD57.js → AZN2E5DL.js} +1 -1
- package/dist/cdn/BMMIXOTR.js +2 -0
- package/dist/cdn/{6Z3DXRF6.js → BQE6IVEF.js} +1 -1
- package/dist/cdn/{EDZIFJZR.js → C5ZH23YO.js} +1 -1
- package/dist/cdn/{7GXMCAWQ.js → CVRBLJ5O.js} +1 -1
- package/dist/cdn/{ENG5BCAV.js → DXQQQNOF.js} +1 -1
- package/dist/cdn/{BGLTC5SO.js → F26SXWZ5.js} +1 -1
- package/dist/cdn/{4RLG6MXK.js → G3F52QRW.js} +1 -1
- package/dist/cdn/{IEOFEUZI.js → G3FTF6WH.js} +1 -1
- package/dist/cdn/{AHB7W7RI.js → GJD7AOUI.js} +1 -1
- package/dist/cdn/{RRD4QUQS.js → HLKEBN2O.js} +1 -1
- package/dist/cdn/{J3HJC4SO.js → HPWNNMVU.js} +2 -2
- package/dist/cdn/{ZCSF2MJ5.js → I7XBRB6B.js} +1 -1
- package/dist/cdn/{SGQBWAPU.js → IDEOFV22.js} +1 -1
- package/dist/cdn/{FW2HWQC7.js → IEC46RE7.js} +1 -1
- package/dist/cdn/{ULFPP7PF.js → IEN3TA4W.js} +1 -1
- package/dist/cdn/{LKZFKOG4.js → KDNGZ47C.js} +1 -1
- package/dist/cdn/{7FJTZ7VA.js → L3UI7EZZ.js} +1 -1
- package/dist/cdn/{MC5ARLKZ.js → L6P26BYB.js} +1 -1
- package/dist/cdn/{YLC2EM5A.js → LCV5GKUD.js} +2 -2
- package/dist/cdn/{X6JL6SAH.js → LJY6BB64.js} +1 -1
- package/dist/cdn/{MT5J66WR.js → LL647FJR.js} +1 -1
- package/dist/cdn/{KSQHSNTW.js → M4II4TSX.js} +1 -1
- package/dist/cdn/{5YXQ4UXZ.js → MEZL3ZHS.js} +24 -23
- package/dist/cdn/MHVLVLRA.js +2 -0
- package/dist/cdn/{UOGZGAJD.js → MIH5YMTN.js} +1 -1
- package/dist/cdn/{K4TDKKPB.js → MPCJZCL5.js} +1 -1
- package/dist/cdn/MZ73EAAV.js +29 -0
- package/dist/cdn/{C4OXBZJK.js → NIYB3TEW.js} +1 -1
- package/dist/cdn/{TX3LBQ6V.js → NOXANMDF.js} +1 -1
- package/dist/cdn/{QHDEVLC3.js → P4XNRWG7.js} +1 -1
- package/dist/cdn/{EPOIEXNS.js → PBGG3TGN.js} +1 -1
- package/dist/cdn/{H2UL463J.js → PBMTIFFX.js} +1 -1
- package/dist/cdn/{VBJSVR6T.js → PECGJO2P.js} +1 -1
- package/dist/cdn/{FILMKUOU.js → PNESECPO.js} +1 -1
- package/dist/cdn/{Z23BVIGQ.js → QFZK4TD4.js} +1 -1
- package/dist/cdn/QGCF64WY.js +2 -0
- package/dist/cdn/{5LIR6BQY.js → QKJJHBMB.js} +1 -1
- package/dist/cdn/{ZCPVOS4Q.js → QQXQAU33.js} +1 -1
- package/dist/cdn/{56XVVIG7.js → RIHOGDUV.js} +1 -1
- package/dist/cdn/{AGB374BK.js → RUQ4RO4T.js} +1 -1
- package/dist/cdn/{MVF7I3RU.js → UKQPYE7U.js} +1 -1
- package/dist/cdn/{BVSSQNES.js → ULUJKWT5.js} +1 -1
- package/dist/cdn/{U6JZYJ4D.js → UM3P3Q52.js} +1 -1
- package/dist/cdn/VO53567V.js +2 -0
- package/dist/cdn/WKS3TKDC.js +2 -0
- package/dist/cdn/WUKFT5AY.js +4 -0
- package/dist/cdn/{QQEYWBVV.js → XGWDWPRK.js} +1 -1
- package/dist/cdn/{XXGM7HGO.js → XGYNSCTA.js} +1 -1
- package/dist/cdn/{DNPN62O5.js → Y4KGXRSD.js} +1 -1
- package/dist/cdn/{SSIUWTQX.js → Y6QJCLML.js} +1 -1
- package/dist/cdn/{WGS5W6W5.js → YVIEKHQQ.js} +1 -1
- package/dist/cdn/{I22C4HE4.js → ZHXREM2D.js} +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.ar.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.bg.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.bs.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.ca.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.cs.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.da.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.de.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.el.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.es.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.et.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.fi.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.fr.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.he.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.hr.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.hu.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.id.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.it.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.ja.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.ko.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.lt.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.lv.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.nl.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.no.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.pl.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.pt-BR.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.pt-PT.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.ro.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.ru.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.sk.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.sl.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.sr.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.sv.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.th.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.tr.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.uk.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.vi.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.zh-CN.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.zh-HK.json +1 -1
- package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.zh-TW.json +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/converter.js +633 -367
- package/dist/chunks/deployFlowController.js +46 -0
- package/dist/chunks/designSolution.js +4 -3
- package/dist/chunks/explainValidationFailure.js +32 -0
- package/dist/chunks/solution-builder-assistant.js +157 -71
- package/dist/chunks/updateDesign.js +1 -1
- package/dist/components/arcgis-solutions-assistant/customElement.js +334 -248
- package/dist/components/solution-builder-assistant/customElement.js +3 -2
- package/dist/components/solution-deploying-dialog/customElement.js +12 -12
- package/dist/components/solution-details-panel/customElement.js +112 -102
- 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 +6 -6
- package/package.json +1 -1
- package/dist/cdn/5MPYPIR2.js +0 -2
- package/dist/cdn/CGCNGFBL.js +0 -2
- package/dist/cdn/FE2GEHNL.js +0 -2
- package/dist/cdn/GLQZHYJP.js +0 -4
- package/dist/cdn/LYK2CASU.js +0 -2
- package/dist/cdn/S6U6SXMD.js +0 -2
- package/dist/cdn/SYZEWVHU.js +0 -2
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
2
|
import { c as Ce } from "../../chunks/runtime.js";
|
|
3
3
|
import { u as _e } from "../../chunks/useT9n.js";
|
|
4
|
-
import { LitElement as ke, createEvent as
|
|
5
|
-
import { css as
|
|
6
|
-
import { unsafeHTML as
|
|
4
|
+
import { LitElement as ke, createEvent as X, nothing as Z } from "@arcgis/lumina";
|
|
5
|
+
import { css as Te, html as k } from "lit";
|
|
6
|
+
import { unsafeHTML as Ee } from "lit/directives/unsafe-html.js";
|
|
7
7
|
import { useContextConsumer as ee } from "@arcgis/lumina/context";
|
|
8
|
-
import { c as Ae, b as
|
|
9
|
-
import { T as
|
|
10
|
-
import { l as
|
|
8
|
+
import { c as Ae, b as Le } from "../../chunks/deployAppContexts.js";
|
|
9
|
+
import { T as De } from "../../chunks/interfaces.js";
|
|
10
|
+
import { l as Fe } from "../../chunks/helpers.js";
|
|
11
11
|
import te from "@arcgis/core/config.js";
|
|
12
|
-
import { createRef as $e, ref as
|
|
13
|
-
import { Annotation as b, StateGraph as
|
|
14
|
-
import { createAgentRuntimeState as
|
|
15
|
-
import r, { z as
|
|
16
|
-
import * as
|
|
17
|
-
import { applyPatch as
|
|
12
|
+
import { createRef as $e, ref as Re } from "lit-html/directives/ref.js";
|
|
13
|
+
import { Annotation as b, StateGraph as z, START as j, END as x, NodeInterrupt as ne } from "@langchain/langgraph/web";
|
|
14
|
+
import { createAgentRuntimeState as J, sendTraceMessage as v, invokeStructuredPrompt as E, getEmbeddings as Me, cosineSimilarity as Ne, invokeTextPrompt as Pe } from "@arcgis/ai-orchestrator";
|
|
15
|
+
import r, { z as L } from "zod";
|
|
16
|
+
import * as G from "@esri/arcgis-rest-portal";
|
|
17
|
+
import { applyPatch as Be } from "fast-json-patch";
|
|
18
18
|
import "@langchain/core/messages";
|
|
19
19
|
import { C as ie } from "../../chunks/converter.js";
|
|
20
|
-
import { g as
|
|
20
|
+
import { g as N, t as oe, r as ae, c as qe, d as D } from "../../chunks/templates.js";
|
|
21
21
|
import Ue from "@arcgis/core/portal/Portal.js";
|
|
22
22
|
import Oe from "@arcgis/core/portal/PortalItem.js";
|
|
23
|
-
const ze =
|
|
23
|
+
const ze = Te`: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)}`;
|
|
24
24
|
async function y(t, e) {
|
|
25
25
|
const s = Object.entries(t).find(
|
|
26
26
|
([n]) => n.endsWith(`/${e}.md`)
|
|
@@ -34,7 +34,7 @@ ${Object.keys(t).join(`
|
|
|
34
34
|
);
|
|
35
35
|
return await s[1]();
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function B(t) {
|
|
38
38
|
return t?.configurable?.context?.translations;
|
|
39
39
|
}
|
|
40
40
|
function re(t) {
|
|
@@ -93,13 +93,13 @@ function Ge(t, e) {
|
|
|
93
93
|
}
|
|
94
94
|
}), { source: t, allMatches: s };
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function Ve(t) {
|
|
97
97
|
return t && t.helperServices.aiAssistantServices ? `${t.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/chat` : null;
|
|
98
98
|
}
|
|
99
99
|
function ce(t) {
|
|
100
100
|
return t && t.helperServices.aiAssistantServices ? `${t.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/api/pre-chat` : null;
|
|
101
101
|
}
|
|
102
|
-
async function
|
|
102
|
+
async function O(t, e, s) {
|
|
103
103
|
const n = await fetch(e, {
|
|
104
104
|
method: "POST",
|
|
105
105
|
headers: {
|
|
@@ -112,12 +112,12 @@ async function U(t, e, s) {
|
|
|
112
112
|
throw new Error(`HTTP ${n.status} calling ${e}`);
|
|
113
113
|
return n.json();
|
|
114
114
|
}
|
|
115
|
-
const
|
|
115
|
+
const He = (t) => new Promise((e) => setTimeout(e, t)), We = b.Root({
|
|
116
116
|
// Provides agentExecutionContext, outputMessage, summary, and status
|
|
117
117
|
// channels with the orchestrator's standard reducers/defaults so the
|
|
118
118
|
// sub-agent reports back through the same shape the orchestrator
|
|
119
119
|
// persists into priorSteps.
|
|
120
|
-
...
|
|
120
|
+
...J(),
|
|
121
121
|
solutionResponse: b({
|
|
122
122
|
reducer: (t, e) => e ?? null,
|
|
123
123
|
default: () => null
|
|
@@ -133,7 +133,7 @@ const Ve = (t) => new Promise((e) => setTimeout(e, t)), We = b.Root({
|
|
|
133
133
|
reducer: (t, e) => e ?? t,
|
|
134
134
|
default: () => null
|
|
135
135
|
})
|
|
136
|
-
}), Ke = () => new
|
|
136
|
+
}), Ke = () => new z(We).addNode("initializeAgent", Ye).addNode("askSolutionsQuestions", Qe).addEdge(j, "initializeAgent").addEdge("initializeAgent", "askSolutionsQuestions").addEdge("askSolutionsQuestions", x), de = async (t, e, s, n) => {
|
|
137
137
|
if (!t) return;
|
|
138
138
|
const i = ce(t);
|
|
139
139
|
if (!i) return;
|
|
@@ -147,15 +147,15 @@ const Ve = (t) => new Promise((e) => setTimeout(e, t)), We = b.Root({
|
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
} };
|
|
150
|
-
n && (a.conversationId = n),
|
|
150
|
+
n && (a.conversationId = n), O(a, i, e ?? "");
|
|
151
151
|
}, Qe = async (t, e) => {
|
|
152
|
-
const s =
|
|
152
|
+
const s = B(e), n = t.documentSkillUrl;
|
|
153
153
|
let i = [];
|
|
154
154
|
await v(
|
|
155
155
|
{ text: s.agentProgress.explorerAgentSearching },
|
|
156
156
|
e
|
|
157
157
|
);
|
|
158
|
-
let o = await
|
|
158
|
+
let o = await O(
|
|
159
159
|
{
|
|
160
160
|
message: t.agentExecutionContext.userRequest,
|
|
161
161
|
conversationId: e?.configurable?.context?.convoId ?? void 0,
|
|
@@ -181,25 +181,25 @@ const Ve = (t) => new Promise((e) => setTimeout(e, t)), We = b.Root({
|
|
|
181
181
|
ackSequenceNumber: o.sequenceNumber,
|
|
182
182
|
inquiryId: o.inquiryId
|
|
183
183
|
}, l = "";
|
|
184
|
-
const
|
|
185
|
-
const h =
|
|
184
|
+
const u = async (m) => {
|
|
185
|
+
const h = m.context?.results?.[0]?.reply ?? "";
|
|
186
186
|
if (h !== "") {
|
|
187
|
-
const
|
|
188
|
-
l =
|
|
187
|
+
const g = Je(h), A = Ge(g, e);
|
|
188
|
+
l = A.source, i = [
|
|
189
189
|
...i,
|
|
190
|
-
...
|
|
190
|
+
...A.allMatches.filter(
|
|
191
191
|
(C) => !i.some((_) => _.solution.id === C.solution.id)
|
|
192
192
|
)
|
|
193
193
|
];
|
|
194
194
|
}
|
|
195
|
-
const
|
|
196
|
-
if (
|
|
197
|
-
let
|
|
198
|
-
|
|
195
|
+
const d = m.context?.results?.[0]?.status?.currentStatusStep;
|
|
196
|
+
if (d) {
|
|
197
|
+
let g = "";
|
|
198
|
+
d === 1 ? g = s.agentProgress.explorerAgentReading : d === 2 ? g = s.agentProgress.explorerAgentReviewing : d === 3 && (g = s.agentProgress.explorerAgentPreparing), await v({ text: g }, e);
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
for (await
|
|
202
|
-
await
|
|
201
|
+
for (await u(o); a.hasMore; )
|
|
202
|
+
await He(500), o = await O(
|
|
203
203
|
{
|
|
204
204
|
conversationId: a.conversationId,
|
|
205
205
|
ackSequenceNumber: a.ackSequenceNumber,
|
|
@@ -213,7 +213,7 @@ const Ve = (t) => new Promise((e) => setTimeout(e, t)), We = b.Root({
|
|
|
213
213
|
hasMore: o.hasMore,
|
|
214
214
|
ackSequenceNumber: o.sequenceNumber,
|
|
215
215
|
inquiryId: o.inquiryId
|
|
216
|
-
}, await
|
|
216
|
+
}, await u(o);
|
|
217
217
|
return ce(e?.configurable?.context.portal) && de(
|
|
218
218
|
e?.configurable?.context.portal,
|
|
219
219
|
e?.configurable?.context.token ?? "",
|
|
@@ -228,7 +228,7 @@ const Ve = (t) => new Promise((e) => setTimeout(e, t)), We = b.Root({
|
|
|
228
228
|
};
|
|
229
229
|
}, Ye = async (t, e) => {
|
|
230
230
|
let s = null;
|
|
231
|
-
return t.documentSkillUrl === null && e?.configurable?.context?.portal && (s =
|
|
231
|
+
return t.documentSkillUrl === null && e?.configurable?.context?.portal && (s = Ve(e.configurable.context.portal)), {
|
|
232
232
|
documentSkillUrl: s
|
|
233
233
|
};
|
|
234
234
|
};
|
|
@@ -243,7 +243,7 @@ const ue = (t) => {
|
|
|
243
243
|
return "human";
|
|
244
244
|
}
|
|
245
245
|
return "human";
|
|
246
|
-
},
|
|
246
|
+
}, Xe = (t) => {
|
|
247
247
|
const e = ue(t);
|
|
248
248
|
if (t && t.kwargs)
|
|
249
249
|
return {
|
|
@@ -259,7 +259,7 @@ const ue = (t) => {
|
|
|
259
259
|
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;
|
|
260
260
|
}
|
|
261
261
|
return { role: "human", content: String(t) };
|
|
262
|
-
},
|
|
262
|
+
}, Ze = (t) => ue(t) === "human", et = (t, e = 3) => t.filter((s) => Ze(s)).slice(-e).map(Xe), tt = (t, e = " ") => et(t).map((i) => i.content).join(e).trim(), st = { 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?" }, nt = {
|
|
263
263
|
builderMessages: st
|
|
264
264
|
}, it = /* @__PURE__ */ new Set([
|
|
265
265
|
"add",
|
|
@@ -314,6 +314,8 @@ const ue = (t) => {
|
|
|
314
314
|
"rownum",
|
|
315
315
|
"select",
|
|
316
316
|
"set",
|
|
317
|
+
"shape",
|
|
318
|
+
"subtype",
|
|
317
319
|
"table",
|
|
318
320
|
"top",
|
|
319
321
|
"truncate",
|
|
@@ -326,7 +328,7 @@ const ue = (t) => {
|
|
|
326
328
|
]);
|
|
327
329
|
class pe {
|
|
328
330
|
constructor(e, s, n = !0) {
|
|
329
|
-
this.isValid = !0, this.issues = [], this.response = e, this.template = s, this.newDesign = n, this.validate();
|
|
331
|
+
this.isValid = !0, this.issues = [], this.fieldNameRegistry = null, this.response = e, this.template = s, this.newDesign = n, this.validate();
|
|
330
332
|
}
|
|
331
333
|
validate() {
|
|
332
334
|
this.compareModels(), this.validateResponse();
|
|
@@ -338,11 +340,11 @@ class pe {
|
|
|
338
340
|
const e = new Set(this.template.solution.strings.map((n) => n.key)), s = new Set(this.response.solution.strings.map((n) => n.key));
|
|
339
341
|
e.size === s.size && [...e].every((n) => s.has(n)) || this.logIssue("String keys in llm response do not match the template.");
|
|
340
342
|
for (const n of this.response.solution.strings)
|
|
341
|
-
n.value || this.logIssue(`String key '${n.key}' has no value.`);
|
|
343
|
+
n.value || this.logIssue(`String key '${n.key}' has no value in the design. It must be populated.`);
|
|
342
344
|
}
|
|
343
345
|
compareItems() {
|
|
344
346
|
const e = new Set(this.template.items.map((n) => n.id)), s = new Set(this.response.items.map((n) => n.id));
|
|
345
|
-
e.size === s.size && [...e].every((n) => s.has(n)) || this.logIssue("Item
|
|
347
|
+
e.size === s.size && [...e].every((n) => s.has(n)) || this.logIssue("Item IDs in design do not match the template.");
|
|
346
348
|
}
|
|
347
349
|
compareFeatureLayers() {
|
|
348
350
|
const e = this.template.featureLayer, s = this.response.featureLayer;
|
|
@@ -363,14 +365,20 @@ class pe {
|
|
|
363
365
|
}
|
|
364
366
|
}
|
|
365
367
|
validateResponse() {
|
|
366
|
-
const e =
|
|
368
|
+
const e = /* @__PURE__ */ new Set([
|
|
369
|
+
"Feature Layer (hosted)",
|
|
370
|
+
"Feature Layer (hosted, view)"
|
|
371
|
+
]);
|
|
372
|
+
for (const i of this.response.items)
|
|
373
|
+
e.has(i.type) && i.title.length > 100 && this.logIssue(`Service name '${i.title}' exceeds 100 characters.`);
|
|
374
|
+
const s = this.template.featureLayer.layers;
|
|
367
375
|
this.response.featureLayer.layers.length || this.logIssue("Feature layer item must contain at least one layer.");
|
|
368
|
-
const
|
|
369
|
-
|
|
370
|
-
for (const
|
|
371
|
-
this.validateLayer(
|
|
372
|
-
const
|
|
373
|
-
|
|
376
|
+
const n = this.response.featureLayer.layers.map((i) => i.name.toLowerCase());
|
|
377
|
+
n.length !== new Set(n).size && this.logIssue(`Layer names must be unique (case-insensitive). Layer names in design: ${n}.`);
|
|
378
|
+
for (const i of this.response.featureLayer.layers) {
|
|
379
|
+
this.validateLayer(i, this.response.featureLayer.addLayers);
|
|
380
|
+
const o = s.find((a) => a.id === i.id);
|
|
381
|
+
o && this.validateRequiredFields(i, o);
|
|
374
382
|
}
|
|
375
383
|
}
|
|
376
384
|
validateRequiredFields(e, s) {
|
|
@@ -378,7 +386,12 @@ class pe {
|
|
|
378
386
|
for (const i of s.requiredFields)
|
|
379
387
|
n.has(i.name) || this.logIssue(`Layer '${e.name}' is missing required field '${i.name}'.`);
|
|
380
388
|
}
|
|
381
|
-
validateLayer(e) {
|
|
389
|
+
validateLayer(e, s) {
|
|
390
|
+
!s && e.typeMutable === !0 && e.type === "Table" && this.logIssue(
|
|
391
|
+
`Layer '${e.name}' cannot be a Table. It may be a Point, Line, or Polygon.`
|
|
392
|
+
), this.validateLayerFields(e);
|
|
393
|
+
}
|
|
394
|
+
validateLayerFields(e) {
|
|
382
395
|
const s = /* @__PURE__ */ new Set([
|
|
383
396
|
"objectid",
|
|
384
397
|
"globalid",
|
|
@@ -386,26 +399,57 @@ class pe {
|
|
|
386
399
|
"created_user",
|
|
387
400
|
"last_edited_date",
|
|
388
401
|
"last_edited_user"
|
|
389
|
-
]), n = e.
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
402
|
+
]), n = e.customFields.map((c) => c.name), i = new Set(e.requiredFields.map((c) => c.name)), o = [...new Set(
|
|
403
|
+
n.filter((c) => s.has(c))
|
|
404
|
+
)];
|
|
405
|
+
for (const c of o)
|
|
406
|
+
this.logIssue(`Layer '${e.name}' field '${c}' collides with a reserved system field name.`);
|
|
407
|
+
const a = [...new Set(
|
|
408
|
+
n.filter((c) => i.has(c))
|
|
409
|
+
)];
|
|
410
|
+
for (const c of a)
|
|
411
|
+
this.logIssue(`Layer '${e.name}' field '${c}' collides with a required field name.`);
|
|
412
|
+
if (!o.length && !a.length) {
|
|
413
|
+
const c = e.systemFields ?? [], m = [
|
|
414
|
+
...e.customFields,
|
|
415
|
+
...e.requiredFields,
|
|
416
|
+
...c
|
|
417
|
+
].map((h) => h.name);
|
|
418
|
+
m.length !== new Set(m).size && this.logIssue(`Layer '${e.name}' has duplicate fields: ${JSON.stringify(m)}.`);
|
|
419
|
+
}
|
|
420
|
+
const l = e.systemFields ?? [], u = [...e.customFields, ...e.requiredFields, ...l].map((c) => c.name.toLowerCase());
|
|
421
|
+
this.fieldNameRegistry = new Set(u);
|
|
422
|
+
for (const c of [...e.customFields, ...e.requiredFields])
|
|
423
|
+
this.validateField(c);
|
|
424
|
+
this.fieldNameRegistry = null;
|
|
425
|
+
}
|
|
426
|
+
getUniqueTruncatedFieldName(e) {
|
|
427
|
+
const n = this.fieldNameRegistry;
|
|
428
|
+
if (!n)
|
|
429
|
+
return e.slice(0, 31);
|
|
430
|
+
const i = e.toLowerCase();
|
|
431
|
+
n.delete(i);
|
|
432
|
+
const o = e.slice(0, 31);
|
|
433
|
+
let a = o, l = 1;
|
|
434
|
+
for (; n.has(a.toLowerCase()); ) {
|
|
435
|
+
const u = `_${l}`, c = Math.max(1, 31 - u.length);
|
|
436
|
+
a = `${o.slice(0, c)}${u}`, l += 1;
|
|
395
437
|
}
|
|
396
|
-
|
|
397
|
-
...e.customFields,
|
|
398
|
-
...e.requiredFields,
|
|
399
|
-
...n
|
|
400
|
-
].map((o) => o.name);
|
|
401
|
-
i.length !== new Set(i).size && this.logIssue(`Layer '${e.name}' has duplicate fields: ${JSON.stringify(i)}.`);
|
|
402
|
-
for (const o of [...e.customFields, ...e.requiredFields, ...n])
|
|
403
|
-
this.validateField(o);
|
|
438
|
+
return n.add(a.toLowerCase()), a;
|
|
404
439
|
}
|
|
405
440
|
validateField(e) {
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
441
|
+
const s = /^\p{L}/u, n = /^.[\p{L}\p{M}\p{N}_]*$/u;
|
|
442
|
+
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.`), n.test(e.name) || this.logIssue(
|
|
443
|
+
`Field '${e.name}' contains invalid characters (only letters from any writing system, numbers, and underscores are allowed; emojis and punctuation are not allowed).`
|
|
444
|
+
), e.name.length > 31)
|
|
445
|
+
if (this.newDesign) {
|
|
446
|
+
const i = e.name;
|
|
447
|
+
e.name = this.getUniqueTruncatedFieldName(e.name), console.debug(`Field '${i}' exceeds 31 characters. Auto-fixing to '${e.name}'.`);
|
|
448
|
+
} else
|
|
449
|
+
this.logIssue(`Field '${e.name}' exceeds 31 characters.`);
|
|
450
|
+
if (it.has(e.name.toLowerCase()) && this.logIssue(`Field '${e.name}' is a SQL reserved keyword.`), e.choiceList && (e.type !== "string" && this.logIssue(`Field '${e.name}' must be of type 'string' to have a domain.`), e.choiceList.some((i) => !i) && this.logIssue(`Field '${e.name}' has empty domain values.`), e.choiceList.length !== new Set(e.choiceList).size && this.logIssue(`Field '${e.name}' has duplicate domain values.`), e.length != null)) {
|
|
451
|
+
const i = Math.max(...e.choiceList.map((o) => o.length));
|
|
452
|
+
i > e.length && (this.newDesign ? (console.debug(`Field '${e.name}' length ${e.length} is insufficient for choiceList value of length ${i}. Auto-fixing to ${i}.`), e.length = i) : this.logIssue(`Field '${e.name}' length ${e.length} is insufficient for choiceList value of length ${i}.`));
|
|
409
453
|
}
|
|
410
454
|
}
|
|
411
455
|
logIssue(e) {
|
|
@@ -460,7 +504,7 @@ const ot = r.object({
|
|
|
460
504
|
itemId: r.string().describe("ArcGIS item id for the feature layer."),
|
|
461
505
|
addLayers: r.boolean().describe("Indicates whether new layers can be added during solution design."),
|
|
462
506
|
layers: r.array(rt)
|
|
463
|
-
}),
|
|
507
|
+
}), V = r.object({
|
|
464
508
|
response: r.string().describe("Conversational response to the user's query."),
|
|
465
509
|
solution: r.object({
|
|
466
510
|
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."),
|
|
@@ -480,40 +524,71 @@ const ot = r.object({
|
|
|
480
524
|
response: r.string().describe("Conversational response describing the accepted design changes."),
|
|
481
525
|
patches: r.array(ct).describe("Minimal RFC 6902 patch operations needed to update the current design.")
|
|
482
526
|
}), ut = r.object({
|
|
483
|
-
|
|
527
|
+
response: r.string().describe("Short, user-friendly explanation of why the requested update was not applied.")
|
|
484
528
|
}), pt = r.object({
|
|
529
|
+
matchedTitles: r.array(r.string()).describe("Titles of solutions that match the user's request. Empty array if no strong match.")
|
|
530
|
+
}), mt = r.object({
|
|
485
531
|
templateId: r.string().min(1).describe("Template id from the available template list."),
|
|
486
532
|
confidence: r.number().min(0).max(1).describe("Confidence score from 0 to 1 for this template match."),
|
|
487
533
|
templateDescription: r.string().min(1).describe("Short description this template in the user's use case/workflow.")
|
|
488
|
-
}),
|
|
534
|
+
}), gt = r.object({
|
|
489
535
|
assistantResponse: r.string().describe("Natural-language response for the user."),
|
|
490
536
|
isValidUseCase: r.boolean().describe("True only when the request is concrete, appropriate, and has at least one matching template."),
|
|
491
|
-
matchedTemplates: r.array(
|
|
492
|
-
}),
|
|
493
|
-
|
|
494
|
-
const
|
|
537
|
+
matchedTemplates: r.array(mt).describe("Ordered list of matching templates, best match first. Empty when no valid match exists.")
|
|
538
|
+
}), ht = (t) => t.length ? t.map((e, s) => `${s + 1}. ${e}`).join(`
|
|
539
|
+
`) : "No validation errors were provided.", ft = async (t) => {
|
|
540
|
+
const {
|
|
541
|
+
query: e,
|
|
542
|
+
validationIssues: s,
|
|
543
|
+
recentMessages: n,
|
|
544
|
+
fallbackMessage: i,
|
|
545
|
+
promptModules: o
|
|
546
|
+
} = t;
|
|
547
|
+
try {
|
|
548
|
+
return (await E({
|
|
549
|
+
promptText: await y(o, "explainValidationFailure"),
|
|
550
|
+
modelTier: "fast",
|
|
551
|
+
temperature: 0,
|
|
552
|
+
schema: ut,
|
|
553
|
+
messages: n,
|
|
554
|
+
inputVariables: {
|
|
555
|
+
query: e,
|
|
556
|
+
validationIssueCount: String(s.length),
|
|
557
|
+
validationIssues: ht(s)
|
|
558
|
+
}
|
|
559
|
+
})).response?.trim() || i;
|
|
560
|
+
} catch (a) {
|
|
561
|
+
return console.warn(
|
|
562
|
+
"Natural language response failed:",
|
|
563
|
+
{ error: a }
|
|
564
|
+
), i;
|
|
565
|
+
}
|
|
566
|
+
}, H = (t) => t in D, bt = 5, yt = 0.8, xt = 0.15, vt = "Web Mapping Application", wt = "Embeddings";
|
|
567
|
+
let $ = null, U = null, R = null, M = null;
|
|
568
|
+
const St = "Build", T = /* @__PURE__ */ Object.assign({
|
|
495
569
|
"./prompts/description.md": () => import("../../chunks/description2.js").then((t) => t.default),
|
|
496
570
|
"./prompts/designSolution.md": () => import("../../chunks/designSolution.js").then((t) => t.default),
|
|
571
|
+
"./prompts/explainValidationFailure.md": () => import("../../chunks/explainValidationFailure.js").then((t) => t.default),
|
|
497
572
|
"./prompts/findExistingSolution.md": () => import("../../chunks/findExistingSolution.js").then((t) => t.default),
|
|
498
573
|
"./prompts/initialAssessment.md": () => import("../../chunks/initialAssessment.js").then((t) => t.default),
|
|
499
574
|
"./prompts/updateDesign.md": () => import("../../chunks/updateDesign.js").then((t) => t.default)
|
|
500
|
-
}),
|
|
575
|
+
}), It = nt.builderMessages, f = (t, e, s) => B(e)?.builderMessages?.[t] ?? It[t], me = (t) => {
|
|
501
576
|
typeof window < "u" && window.dispatchEvent(new CustomEvent("arcgis-solution-design-update", {
|
|
502
577
|
detail: t
|
|
503
578
|
}));
|
|
504
|
-
},
|
|
579
|
+
}, Ct = async (t, e, s) => {
|
|
505
580
|
if (!t) return null;
|
|
506
|
-
const n = `type:"${
|
|
507
|
-
return (await
|
|
581
|
+
const n = `type:"${vt}" AND typekeywords:${wt} AND group:${t}`;
|
|
582
|
+
return (await G.searchItems({
|
|
508
583
|
q: n,
|
|
509
584
|
params: e ? { token: e } : void 0,
|
|
510
585
|
portal: s,
|
|
511
586
|
num: 1
|
|
512
587
|
}))?.results?.[0] ?? null;
|
|
513
588
|
};
|
|
514
|
-
async function
|
|
589
|
+
async function _t(t, e, s) {
|
|
515
590
|
try {
|
|
516
|
-
const n = await
|
|
591
|
+
const n = await Ct(t, e, s);
|
|
517
592
|
if (!n) return null;
|
|
518
593
|
const i = new Oe({ id: n.id });
|
|
519
594
|
return await i.load(), await i.fetchData("json");
|
|
@@ -521,18 +596,18 @@ async function St(t, e, s) {
|
|
|
521
596
|
return null;
|
|
522
597
|
}
|
|
523
598
|
}
|
|
524
|
-
const
|
|
599
|
+
const kt = async (t, e, s) => {
|
|
525
600
|
if (!t) return [];
|
|
526
|
-
const n = `type:Solution AND typekeywords:${
|
|
527
|
-
return (await
|
|
601
|
+
const n = `type:Solution AND typekeywords:${St} AND group:${t}`;
|
|
602
|
+
return (await G.searchItems({
|
|
528
603
|
q: n,
|
|
529
604
|
params: e ? { token: e } : void 0,
|
|
530
605
|
portal: s,
|
|
531
606
|
num: 100
|
|
532
607
|
}))?.results ?? [];
|
|
533
|
-
},
|
|
608
|
+
}, Tt = async (t, e, s) => {
|
|
534
609
|
try {
|
|
535
|
-
const n = await
|
|
610
|
+
const n = await G.getItemData(t, {
|
|
536
611
|
params: e ? { token: e } : void 0,
|
|
537
612
|
portal: s
|
|
538
613
|
}), i = n?.buildSolution;
|
|
@@ -572,10 +647,10 @@ const It = async (t, e, s) => {
|
|
|
572
647
|
error: s instanceof Error ? s.stack ?? s.message : String(s)
|
|
573
648
|
};
|
|
574
649
|
}
|
|
575
|
-
},
|
|
576
|
-
if (
|
|
577
|
-
Object.entries(
|
|
578
|
-
|
|
650
|
+
}, W = async (t) => {
|
|
651
|
+
if (U) {
|
|
652
|
+
Object.entries(U).forEach(([a, l]) => {
|
|
653
|
+
D[a] && (D[a].initialTemplate = l);
|
|
579
654
|
});
|
|
580
655
|
return;
|
|
581
656
|
}
|
|
@@ -584,35 +659,35 @@ const It = async (t, e, s) => {
|
|
|
584
659
|
console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping live template hydration.");
|
|
585
660
|
return;
|
|
586
661
|
}
|
|
587
|
-
const i = await
|
|
662
|
+
const i = await kt(s, e, n), o = {};
|
|
588
663
|
await Promise.all(i.map(async (a) => {
|
|
589
664
|
const l = a.properties?.templateInfo;
|
|
590
665
|
if (!l || typeof l != "object") return;
|
|
591
|
-
const
|
|
592
|
-
if (typeof
|
|
593
|
-
const
|
|
594
|
-
if (!
|
|
595
|
-
const { buildSolution:
|
|
596
|
-
if (typeof
|
|
597
|
-
const
|
|
598
|
-
|
|
666
|
+
const u = l.id;
|
|
667
|
+
if (typeof u != "string" || o[u]) return;
|
|
668
|
+
const c = await Tt(a.id, e, n);
|
|
669
|
+
if (!c) return;
|
|
670
|
+
const { buildSolution: m, params: h } = c;
|
|
671
|
+
if (typeof m == "object" && m !== null && "solution" in m) {
|
|
672
|
+
const g = m.solution;
|
|
673
|
+
g.thumbnailUrl = a.thumbnail ? `${n ?? "https://www.arcgis.com/sharing/rest"}/content/items/${a.id}/info/${a.thumbnail}` : void 0, g.item = a;
|
|
599
674
|
}
|
|
600
|
-
const
|
|
675
|
+
const d = {
|
|
601
676
|
...l,
|
|
602
|
-
buildSolution:
|
|
677
|
+
buildSolution: m
|
|
603
678
|
};
|
|
604
|
-
o[
|
|
605
|
-
new ie(
|
|
679
|
+
o[u] = I(
|
|
680
|
+
new ie(d).dumpToLlmTemplate(),
|
|
606
681
|
{
|
|
607
682
|
itemId: a.id,
|
|
608
|
-
sourceBuildSolution: structuredClone(
|
|
683
|
+
sourceBuildSolution: structuredClone(m),
|
|
609
684
|
params: h ? structuredClone(h) : null
|
|
610
685
|
}
|
|
611
|
-
),
|
|
686
|
+
), D[u] = {
|
|
612
687
|
...l,
|
|
613
|
-
initialTemplate: o[
|
|
688
|
+
initialTemplate: o[u]
|
|
614
689
|
};
|
|
615
|
-
})),
|
|
690
|
+
})), U = o;
|
|
616
691
|
}, he = (t) => {
|
|
617
692
|
const e = t?.configurable?.context?.token;
|
|
618
693
|
return typeof e != "string" || !e.trim() ? null : e;
|
|
@@ -623,16 +698,16 @@ const It = async (t, e, s) => {
|
|
|
623
698
|
const e = t?.configurable?.context?.configContext?.portalURL;
|
|
624
699
|
if (!(typeof e != "string" || !e.trim()))
|
|
625
700
|
return `${e.replace(/\/+$/, "")}/sharing/rest`;
|
|
626
|
-
},
|
|
701
|
+
}, Et = async (t) => {
|
|
627
702
|
await Promise.all([
|
|
628
703
|
xe(t),
|
|
629
|
-
|
|
704
|
+
W(t)
|
|
630
705
|
]);
|
|
631
706
|
}, ye = async (t) => {
|
|
632
707
|
const e = he(t);
|
|
633
|
-
(!
|
|
634
|
-
throw
|
|
635
|
-
})), await
|
|
708
|
+
(!R || e && e !== M) && (M = e ?? M, R = Et(t).catch((n) => {
|
|
709
|
+
throw R = null, M = null, n;
|
|
710
|
+
})), await R;
|
|
636
711
|
};
|
|
637
712
|
async function xe(t) {
|
|
638
713
|
if ($) return $;
|
|
@@ -641,14 +716,14 @@ async function xe(t) {
|
|
|
641
716
|
return console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping embeddings load."), null;
|
|
642
717
|
const s = be(t), n = t?.configurable?.context?.configContext?.portalURL;
|
|
643
718
|
await new Ue(n ? { url: n } : void 0).load();
|
|
644
|
-
const o = he(t) ?? void 0, a = await
|
|
719
|
+
const o = he(t) ?? void 0, a = await _t(e, o, s);
|
|
645
720
|
return a ? ($ = a.items, $) : null;
|
|
646
721
|
}
|
|
647
|
-
const
|
|
722
|
+
const At = () => Object.entries(D).map(([t, e]) => `ID: ${t}
|
|
648
723
|
Label: ${e.label}
|
|
649
724
|
Description: ${e.description}`).join(`
|
|
650
725
|
|
|
651
|
-
`),
|
|
726
|
+
`), Lt = (t) => {
|
|
652
727
|
const e = t?.configurable?.context?.solutionDesignJson;
|
|
653
728
|
if (typeof e != "string" || !e.trim())
|
|
654
729
|
return null;
|
|
@@ -656,23 +731,23 @@ Description: ${e.description}`).join(`
|
|
|
656
731
|
const s = JSON.parse(e), n = I(
|
|
657
732
|
{ response: "", ...s },
|
|
658
733
|
{ itemId: s?.solution?.itemId ?? null }
|
|
659
|
-
), i =
|
|
734
|
+
), i = V.safeParse(n);
|
|
660
735
|
if (!i.success)
|
|
661
736
|
return null;
|
|
662
|
-
const { response: o, ...a } = i.data, l = s.templateId,
|
|
737
|
+
const { response: o, ...a } = i.data, l = s.templateId, u = typeof l == "string" && H(l) ? l : null;
|
|
663
738
|
return I(
|
|
664
739
|
a,
|
|
665
740
|
{
|
|
666
741
|
sourceBuildSolution: s.sourceBuildSolution,
|
|
667
|
-
templateId:
|
|
742
|
+
templateId: u,
|
|
668
743
|
params: s.params ?? null
|
|
669
744
|
}
|
|
670
745
|
);
|
|
671
746
|
} catch {
|
|
672
747
|
return null;
|
|
673
748
|
}
|
|
674
|
-
},
|
|
675
|
-
...
|
|
749
|
+
}, Dt = b.Root({
|
|
750
|
+
...J(),
|
|
676
751
|
/** Optional human-readable template description retained for UI use. */
|
|
677
752
|
templateDescription: b({
|
|
678
753
|
reducer: (t, e) => typeof e == "string" || e === null ? e : t ?? null,
|
|
@@ -703,98 +778,98 @@ Description: ${e.description}`).join(`
|
|
|
703
778
|
reducer: (t = null, e) => e === void 0 ? t : e ?? null,
|
|
704
779
|
default: () => null
|
|
705
780
|
})
|
|
706
|
-
}),
|
|
707
|
-
const s =
|
|
781
|
+
}), Ft = (t, e) => {
|
|
782
|
+
const s = Lt(e), n = s?.templateId ?? null, i = {};
|
|
708
783
|
return JSON.stringify(t.currentDesign) !== JSON.stringify(s) && (i.currentDesign = s), n && t.selectedTemplate !== n && (i.selectedTemplate = n), i;
|
|
709
|
-
},
|
|
784
|
+
}, $t = async (t, e) => {
|
|
710
785
|
await v({ text: f("understandingRequest", e) }, e), await ye(e);
|
|
711
|
-
const s = t.agentExecutionContext.userRequest, n =
|
|
712
|
-
promptText: await y(
|
|
786
|
+
const s = t.agentExecutionContext.userRequest, n = At(), i = t.agentExecutionContext.messages.slice(-11), o = await E({
|
|
787
|
+
promptText: await y(T, "initialAssessment"),
|
|
713
788
|
modelTier: "advanced",
|
|
714
789
|
temperature: 0,
|
|
715
|
-
schema:
|
|
790
|
+
schema: gt,
|
|
716
791
|
messages: i,
|
|
717
792
|
inputVariables: { query: s, availableTemplates: n }
|
|
718
793
|
}), a = o.matchedTemplates.filter(
|
|
719
|
-
(
|
|
794
|
+
(d) => H(d.templateId)
|
|
720
795
|
), l = {
|
|
721
796
|
...o,
|
|
722
797
|
matchedTemplates: a
|
|
723
|
-
}, [
|
|
798
|
+
}, [u, c] = a, h = !!u && u.confidence >= yt && (c === void 0 || u.confidence - c.confidence >= xt) ? u.templateId : null;
|
|
724
799
|
return {
|
|
725
800
|
assessment: l,
|
|
726
801
|
selectedTemplate: h,
|
|
727
802
|
existingMatches: [],
|
|
728
803
|
continueBuilding: null
|
|
729
804
|
};
|
|
730
|
-
},
|
|
805
|
+
}, Rt = (t) => {
|
|
731
806
|
const e = t.assessment?.assistantResponse ?? "";
|
|
732
807
|
return {
|
|
733
808
|
outputMessage: e,
|
|
734
809
|
summary: e,
|
|
735
810
|
status: "success"
|
|
736
811
|
};
|
|
737
|
-
},
|
|
812
|
+
}, Mt = (t, e) => {
|
|
738
813
|
const { hitlResponse: s } = e.configurable, n = "selectTemplate", i = t.assessment?.matchedTemplates.filter(
|
|
739
|
-
(
|
|
740
|
-
) ?? [], o = i.map((
|
|
814
|
+
(c) => H(c.templateId)
|
|
815
|
+
) ?? [], o = i.map((c) => `${c.templateDescription}`);
|
|
741
816
|
if (s?.agentId !== "solutionBuilder" || s.id !== n) {
|
|
742
|
-
const
|
|
817
|
+
const c = {
|
|
743
818
|
agentId: "solutionBuilder",
|
|
744
819
|
id: n,
|
|
745
820
|
kind: "singleSelection",
|
|
746
821
|
message: f("selectTemplatePrompt", e),
|
|
747
822
|
metadata: [...o]
|
|
748
823
|
};
|
|
749
|
-
throw new ne(
|
|
824
|
+
throw new ne(c);
|
|
750
825
|
}
|
|
751
|
-
const a = String(s.payload ?? ""), l = o.findIndex((
|
|
826
|
+
const a = String(s.payload ?? ""), l = o.findIndex((c) => c === a);
|
|
752
827
|
return {
|
|
753
828
|
selectedTemplate: (l >= 0 ? i[l] : void 0)?.templateId ?? i[0]?.templateId ?? null
|
|
754
829
|
};
|
|
755
|
-
},
|
|
830
|
+
}, Nt = async (t, e) => {
|
|
756
831
|
await v({ text: f("searchingExistingSolutions", e) }, e);
|
|
757
832
|
const s = t.agentExecutionContext.userRequest, n = tt(t.agentExecutionContext.messages) || s, i = await xe(e);
|
|
758
833
|
if (!i)
|
|
759
834
|
return console.warn("Solutions Search: failed to load solution embeddings cache; skipping search."), { existingMatches: [] };
|
|
760
835
|
if (!i.length)
|
|
761
836
|
return { existingMatches: [] };
|
|
762
|
-
const [o] = await
|
|
763
|
-
solution:
|
|
764
|
-
score:
|
|
837
|
+
const [o] = await Me([n]), a = i.map((d) => ({
|
|
838
|
+
solution: d,
|
|
839
|
+
score: Ne(o, d.embedding)
|
|
765
840
|
}));
|
|
766
|
-
a.sort((
|
|
767
|
-
const l = a.slice(0,
|
|
841
|
+
a.sort((d, g) => g.score - d.score);
|
|
842
|
+
const l = a.slice(0, bt);
|
|
768
843
|
if (!l.length)
|
|
769
844
|
return { existingMatches: [] };
|
|
770
|
-
const
|
|
771
|
-
Snippet: ${
|
|
772
|
-
Description: ${
|
|
845
|
+
const u = l.map(({ solution: d }) => `${d.title}
|
|
846
|
+
Snippet: ${d.snippet}
|
|
847
|
+
Description: ${d.description}`).join(`
|
|
773
848
|
|
|
774
|
-
`),
|
|
775
|
-
return { existingMatches: (await
|
|
776
|
-
promptText: await y(
|
|
849
|
+
`), c = t.agentExecutionContext.messages.slice(-11);
|
|
850
|
+
return { existingMatches: (await E({
|
|
851
|
+
promptText: await y(T, "findExistingSolution"),
|
|
777
852
|
modelTier: "fast",
|
|
778
853
|
temperature: 0,
|
|
779
|
-
schema:
|
|
780
|
-
messages:
|
|
781
|
-
inputVariables: { query: s, candidates:
|
|
782
|
-
})).matchedTitles.map((
|
|
783
|
-
},
|
|
854
|
+
schema: pt,
|
|
855
|
+
messages: c,
|
|
856
|
+
inputVariables: { query: s, candidates: u }
|
|
857
|
+
})).matchedTitles.map((d) => l.find(({ solution: g }) => g.title === d)).filter((d) => d !== void 0) };
|
|
858
|
+
}, Pt = (t, e) => {
|
|
784
859
|
const { existingMatches: s } = t, { hitlResponse: n } = e.configurable, i = `confirmExistingSolution:${s[0].solution.id}`;
|
|
785
860
|
if (n?.agentId !== "solutionBuilder" || n.id !== i) {
|
|
786
861
|
s.length === 1 ? le(s[0].solution.id) : re(s);
|
|
787
|
-
const
|
|
862
|
+
const u = f("existingSolutionMatch", e), c = [
|
|
788
863
|
f("continueBuildingYes", e),
|
|
789
864
|
f("continueBuildingNo", e)
|
|
790
|
-
],
|
|
865
|
+
], m = {
|
|
791
866
|
agentId: "solutionBuilder",
|
|
792
867
|
id: i,
|
|
793
868
|
kind: "singleSelection",
|
|
794
|
-
message:
|
|
795
|
-
metadata:
|
|
869
|
+
message: u,
|
|
870
|
+
metadata: c
|
|
796
871
|
};
|
|
797
|
-
throw new ne(
|
|
872
|
+
throw new ne(m);
|
|
798
873
|
}
|
|
799
874
|
const o = String(n.payload ?? "").trim(), a = f("continueBuildingNo", e);
|
|
800
875
|
return { continueBuilding: o !== a };
|
|
@@ -809,8 +884,8 @@ Description: ${c.description}`).join(`
|
|
|
809
884
|
await ye(e);
|
|
810
885
|
const { currentDesign: s } = t, n = t.agentExecutionContext.userRequest;
|
|
811
886
|
await v({ text: f("creatingDesign", e) }, e);
|
|
812
|
-
let i =
|
|
813
|
-
if (i?.initialTemplate || (await
|
|
887
|
+
let i = N(t.selectedTemplate);
|
|
888
|
+
if (i?.initialTemplate || (await W(e), i = N(t.selectedTemplate)), !i?.initialTemplate)
|
|
814
889
|
throw new Error("No hydrated templates are available for solution design.");
|
|
815
890
|
const o = I(
|
|
816
891
|
s ?? i.initialTemplate,
|
|
@@ -819,41 +894,41 @@ Description: ${c.description}`).join(`
|
|
|
819
894
|
sourceBuildSolution: s?.sourceBuildSolution ?? i.initialTemplate.sourceBuildSolution,
|
|
820
895
|
params: s?.params ?? i.initialTemplate.params ?? null
|
|
821
896
|
}
|
|
822
|
-
), a = t.agentExecutionContext.messages.slice(-11), l = await
|
|
823
|
-
promptText: await y(
|
|
897
|
+
), a = t.agentExecutionContext.messages.slice(-11), l = await E({
|
|
898
|
+
promptText: await y(T, "designSolution"),
|
|
824
899
|
modelTier: "advanced",
|
|
825
900
|
temperature: 0,
|
|
826
|
-
schema:
|
|
901
|
+
schema: V,
|
|
827
902
|
messages: a,
|
|
828
903
|
inputVariables: {
|
|
829
904
|
currentDesign: JSON.stringify(oe(o)),
|
|
830
905
|
templateInstructions: i.instructions,
|
|
831
906
|
query: n
|
|
832
907
|
}
|
|
833
|
-
}), { response:
|
|
834
|
-
|
|
908
|
+
}), { response: u, featureLayer: c, ...m } = l, h = ae(
|
|
909
|
+
c,
|
|
835
910
|
o.featureLayer
|
|
836
|
-
),
|
|
837
|
-
{ ...
|
|
911
|
+
), d = I(
|
|
912
|
+
{ ...m, featureLayer: h },
|
|
838
913
|
{
|
|
839
914
|
itemId: o?.solution?.itemId,
|
|
840
915
|
sourceBuildSolution: o.sourceBuildSolution,
|
|
841
916
|
templateId: t.selectedTemplate ?? null,
|
|
842
917
|
params: o.params ?? null
|
|
843
918
|
}
|
|
844
|
-
),
|
|
845
|
-
if (!
|
|
919
|
+
), g = new pe(d, i.initialTemplate);
|
|
920
|
+
if (!g.isValid)
|
|
846
921
|
return console.warn(
|
|
847
922
|
"[SolutionBuilder] designSolution validation failed:",
|
|
848
|
-
{ issues:
|
|
923
|
+
{ issues: g.issues, llmResponse: l }
|
|
849
924
|
), {
|
|
850
925
|
outputMessage: f("createDesignFailed", e)
|
|
851
926
|
};
|
|
852
|
-
const
|
|
927
|
+
const A = d.sourceBuildSolution, C = ge(d, A);
|
|
853
928
|
if (!C.ok) {
|
|
854
929
|
console.warn(
|
|
855
930
|
"[SolutionBuilder] designSolution Esri JSON conversion failed:",
|
|
856
|
-
{ error: C.error, llmResponse: l, design:
|
|
931
|
+
{ error: C.error, llmResponse: l, design: d }
|
|
857
932
|
);
|
|
858
933
|
const _ = f("createDesignFailed", e);
|
|
859
934
|
return {
|
|
@@ -862,20 +937,20 @@ Description: ${c.description}`).join(`
|
|
|
862
937
|
status: "success"
|
|
863
938
|
};
|
|
864
939
|
}
|
|
865
|
-
return me(
|
|
866
|
-
outputMessage:
|
|
867
|
-
summary:
|
|
940
|
+
return me(d), {
|
|
941
|
+
outputMessage: u,
|
|
942
|
+
summary: u,
|
|
868
943
|
status: "success",
|
|
869
|
-
currentDesign:
|
|
944
|
+
currentDesign: d
|
|
870
945
|
};
|
|
871
|
-
},
|
|
946
|
+
}, qt = async (t, e) => {
|
|
872
947
|
const { currentDesign: s } = t;
|
|
873
948
|
if (!s)
|
|
874
949
|
return ve(t, e);
|
|
875
950
|
const n = t.agentExecutionContext.userRequest, i = t.agentExecutionContext.messages.slice(-11);
|
|
876
951
|
await v({ text: f("updatingDesign", e) }, e);
|
|
877
|
-
const o = await
|
|
878
|
-
promptText: await y(
|
|
952
|
+
const o = await E({
|
|
953
|
+
promptText: await y(T, "updateDesign"),
|
|
879
954
|
modelTier: "advanced",
|
|
880
955
|
temperature: 0,
|
|
881
956
|
schema: dt,
|
|
@@ -891,7 +966,7 @@ Description: ${c.description}`).join(`
|
|
|
891
966
|
summary: a,
|
|
892
967
|
status: "success"
|
|
893
968
|
};
|
|
894
|
-
const
|
|
969
|
+
const u = (p) => {
|
|
895
970
|
try {
|
|
896
971
|
return JSON.parse(p);
|
|
897
972
|
} catch {
|
|
@@ -918,20 +993,20 @@ Description: ${c.description}`).join(`
|
|
|
918
993
|
return p;
|
|
919
994
|
}
|
|
920
995
|
}
|
|
921
|
-
},
|
|
996
|
+
}, m = [...l.map((p) => ({
|
|
922
997
|
op: p.op,
|
|
923
998
|
path: p.path.replace(/\/+$/, ""),
|
|
924
|
-
...p.value != null && p.value !== "" ? { value:
|
|
999
|
+
...p.value != null && p.value !== "" ? { value: u(p.value) } : {},
|
|
925
1000
|
...p.from != null && p.from !== "" ? { from: p.from } : {}
|
|
926
1001
|
}))].sort((p, S) => p.op !== "remove" || S.op !== "remove" ? 0 : S.path.localeCompare(p.path, void 0, { numeric: !0 })), h = structuredClone(
|
|
927
1002
|
oe(s)
|
|
928
1003
|
);
|
|
929
1004
|
try {
|
|
930
|
-
|
|
1005
|
+
Be(h, m, !0);
|
|
931
1006
|
} catch (p) {
|
|
932
1007
|
console.warn(
|
|
933
1008
|
"[SolutionBuilder] updateDesign JSON patch failed:",
|
|
934
|
-
{ error: p, llmResponse: o, patches:
|
|
1009
|
+
{ error: p, llmResponse: o, patches: m, patchTarget: h }
|
|
935
1010
|
);
|
|
936
1011
|
const S = f("applyChangeFailed", e);
|
|
937
1012
|
return {
|
|
@@ -940,14 +1015,14 @@ Description: ${c.description}`).join(`
|
|
|
940
1015
|
status: "success"
|
|
941
1016
|
};
|
|
942
1017
|
}
|
|
943
|
-
const
|
|
1018
|
+
const d = I(
|
|
944
1019
|
{ response: "", ...h },
|
|
945
1020
|
{ itemId: s.solution?.itemId ?? null }
|
|
946
|
-
),
|
|
947
|
-
if (!
|
|
1021
|
+
), g = V.safeParse(d);
|
|
1022
|
+
if (!g.success) {
|
|
948
1023
|
console.warn(
|
|
949
1024
|
"[SolutionBuilder] updateDesign schema validation failed:",
|
|
950
|
-
{ errors:
|
|
1025
|
+
{ errors: g.error.issues, llmResponse: o, patchedDesign: d }
|
|
951
1026
|
);
|
|
952
1027
|
const p = f("applyChangeFailed", e);
|
|
953
1028
|
return {
|
|
@@ -956,7 +1031,7 @@ Description: ${c.description}`).join(`
|
|
|
956
1031
|
status: "success"
|
|
957
1032
|
};
|
|
958
1033
|
}
|
|
959
|
-
const { response:
|
|
1034
|
+
const { response: A, featureLayer: C, ..._ } = g.data, Se = ae(
|
|
960
1035
|
C,
|
|
961
1036
|
s.featureLayer
|
|
962
1037
|
), w = I(
|
|
@@ -968,17 +1043,28 @@ Description: ${c.description}`).join(`
|
|
|
968
1043
|
params: s.params ?? null
|
|
969
1044
|
}
|
|
970
1045
|
);
|
|
971
|
-
let
|
|
972
|
-
if (
|
|
1046
|
+
let F = N(t.selectedTemplate);
|
|
1047
|
+
if (F?.initialTemplate || (await W(e), F = N(t.selectedTemplate)), !F?.initialTemplate)
|
|
973
1048
|
throw new Error("No hydrated templates are available for solution design.");
|
|
974
|
-
const
|
|
975
|
-
if (!
|
|
976
|
-
|
|
1049
|
+
const q = new pe(w, F.initialTemplate, !1);
|
|
1050
|
+
if (!q.isValid) {
|
|
1051
|
+
console.warn(
|
|
977
1052
|
"[SolutionBuilder] updateDesign validation failed:",
|
|
978
|
-
{ issues:
|
|
979
|
-
)
|
|
980
|
-
|
|
1053
|
+
{ issues: q.issues, llmResponse: o, patchedDesign: w }
|
|
1054
|
+
);
|
|
1055
|
+
const p = await ft({
|
|
1056
|
+
query: n,
|
|
1057
|
+
validationIssues: q.issues,
|
|
1058
|
+
recentMessages: i,
|
|
1059
|
+
fallbackMessage: f("applyChangeFailed", e),
|
|
1060
|
+
promptModules: T
|
|
1061
|
+
});
|
|
1062
|
+
return {
|
|
1063
|
+
outputMessage: p,
|
|
1064
|
+
summary: p,
|
|
1065
|
+
status: "success"
|
|
981
1066
|
};
|
|
1067
|
+
}
|
|
982
1068
|
const Ie = w.sourceBuildSolution, Q = ge(w, Ie);
|
|
983
1069
|
if (!Q.ok) {
|
|
984
1070
|
console.warn(
|
|
@@ -998,39 +1084,39 @@ Description: ${c.description}`).join(`
|
|
|
998
1084
|
status: "success",
|
|
999
1085
|
currentDesign: w
|
|
1000
1086
|
};
|
|
1001
|
-
},
|
|
1087
|
+
}, Ut = (t) => t.currentDesign !== null ? "updateDesign" : "assessInitialRequest", Ot = (t) => !t.assessment || !t.assessment.isValidUseCase ? "invalidUseCaseExit" : !t.selectedTemplate && t.assessment.matchedTemplates.length > 1 ? "selectTemplateHIL" : "findExistingSolutions", zt = (t) => t.existingMatches.length > 0 ? "confirmContinueBuildingHIL" : "designSolution", jt = (t) => t.continueBuilding === !1 ? "declineContinueBuildingExit" : "designSolution", Jt = () => new z(Dt).addNode("syncCurrentDesignFromContext", Ft).addNode("assessInitialRequest", $t).addNode("invalidUseCaseExit", Rt).addNode("selectTemplateHIL", Mt).addNode("findExistingSolutions", Nt).addNode("confirmContinueBuildingHIL", Pt).addNode("declineContinueBuildingExit", Bt).addNode("designSolution", ve).addNode("updateDesign", qt).addEdge(j, "syncCurrentDesignFromContext").addConditionalEdges("syncCurrentDesignFromContext", Ut, {
|
|
1002
1088
|
updateDesign: "updateDesign",
|
|
1003
1089
|
assessInitialRequest: "assessInitialRequest"
|
|
1004
|
-
}).addConditionalEdges("assessInitialRequest",
|
|
1090
|
+
}).addConditionalEdges("assessInitialRequest", Ot, {
|
|
1005
1091
|
invalidUseCaseExit: "invalidUseCaseExit",
|
|
1006
1092
|
selectTemplateHIL: "selectTemplateHIL",
|
|
1007
1093
|
findExistingSolutions: "findExistingSolutions"
|
|
1008
|
-
}).addEdge("invalidUseCaseExit", x).addEdge("selectTemplateHIL", "findExistingSolutions").addConditionalEdges("findExistingSolutions",
|
|
1094
|
+
}).addEdge("invalidUseCaseExit", x).addEdge("selectTemplateHIL", "findExistingSolutions").addConditionalEdges("findExistingSolutions", zt, {
|
|
1009
1095
|
confirmContinueBuildingHIL: "confirmContinueBuildingHIL",
|
|
1010
1096
|
designSolution: "designSolution"
|
|
1011
|
-
}).addConditionalEdges("confirmContinueBuildingHIL",
|
|
1097
|
+
}).addConditionalEdges("confirmContinueBuildingHIL", jt, {
|
|
1012
1098
|
declineContinueBuildingExit: "declineContinueBuildingExit",
|
|
1013
1099
|
designSolution: "designSolution"
|
|
1014
1100
|
}).addEdge("declineContinueBuildingExit", x).addEdge("designSolution", x).addEdge("updateDesign", x);
|
|
1015
|
-
await y(
|
|
1016
|
-
const
|
|
1017
|
-
tool:
|
|
1018
|
-
confidence:
|
|
1019
|
-
rationale:
|
|
1020
|
-
builderExclusion:
|
|
1101
|
+
await y(T, "description");
|
|
1102
|
+
const Gt = L.object({
|
|
1103
|
+
tool: L.enum(["explorer", "builder", "other"]).describe("The selected tool based on the user's query."),
|
|
1104
|
+
confidence: L.number().min(0).max(1).describe("A confidence score (0.00–1.00)."),
|
|
1105
|
+
rationale: L.string().min(1).describe("A brief rationale for the tool choice (≤140 characters)"),
|
|
1106
|
+
builderExclusion: L.boolean().describe("True only when tool is other specifically due to Builder Exclusion Override.")
|
|
1021
1107
|
}), P = /* @__PURE__ */ Object.assign({
|
|
1022
1108
|
"./prompts/assistantResponse.md": () => import("../../chunks/assistantResponse.js").then((t) => t.default),
|
|
1023
1109
|
"./prompts/classifyIntent.md": () => import("../../chunks/classifyIntent.js").then((t) => t.default),
|
|
1024
1110
|
"./prompts/description.md": () => import("../../chunks/description.js").then((t) => t.default),
|
|
1025
1111
|
"./prompts/responseOptionsBuilderExclusion.md": () => import("../../chunks/responseOptionsBuilderExclusion.js").then((t) => t.default),
|
|
1026
1112
|
"./prompts/responseOptionsDefault.md": () => import("../../chunks/responseOptionsDefault.js").then((t) => t.default)
|
|
1027
|
-
}),
|
|
1113
|
+
}), K = () => {
|
|
1028
1114
|
const t = new CustomEvent("assistantProcessing", {
|
|
1029
1115
|
detail: !1
|
|
1030
1116
|
});
|
|
1031
1117
|
window.dispatchEvent(t);
|
|
1032
1118
|
}, we = b.Root({
|
|
1033
|
-
...
|
|
1119
|
+
...J(),
|
|
1034
1120
|
selectedTool: b({
|
|
1035
1121
|
reducer: (t, e) => e ?? null,
|
|
1036
1122
|
default: () => null
|
|
@@ -1043,8 +1129,8 @@ const zt = T.object({
|
|
|
1043
1129
|
reducer: (t, e) => e ?? !1,
|
|
1044
1130
|
default: () => !1
|
|
1045
1131
|
})
|
|
1046
|
-
}),
|
|
1047
|
-
const s =
|
|
1132
|
+
}), Vt = async (t, e) => {
|
|
1133
|
+
const s = B(e);
|
|
1048
1134
|
await v(
|
|
1049
1135
|
{ text: s?.builderMessages.understandingRequest },
|
|
1050
1136
|
e
|
|
@@ -1057,27 +1143,27 @@ const zt = T.object({
|
|
|
1057
1143
|
} catch {
|
|
1058
1144
|
a = !1;
|
|
1059
1145
|
}
|
|
1060
|
-
const l = await y(P, "classifyIntent"),
|
|
1146
|
+
const l = await y(P, "classifyIntent"), u = await E({
|
|
1061
1147
|
promptText: l,
|
|
1062
1148
|
modelTier: "advanced",
|
|
1063
1149
|
temperature: 0,
|
|
1064
|
-
schema:
|
|
1150
|
+
schema: Gt,
|
|
1065
1151
|
messages: i,
|
|
1066
1152
|
inputVariables: { query: n, activeSolutionDesign: a }
|
|
1067
1153
|
});
|
|
1068
1154
|
return {
|
|
1069
|
-
selectedTool:
|
|
1070
|
-
intentRationale:
|
|
1071
|
-
builderExclusion:
|
|
1155
|
+
selectedTool: u.tool,
|
|
1156
|
+
intentRationale: u.rationale,
|
|
1157
|
+
builderExclusion: u.builderExclusion
|
|
1072
1158
|
};
|
|
1073
|
-
}, Jt = async (t, e) => {
|
|
1074
|
-
const n = await Ke().compile().invoke(t, e);
|
|
1075
|
-
return W(), n;
|
|
1076
|
-
}, Gt = async (t, e) => {
|
|
1077
|
-
const n = await Ot().compile().invoke(t, e);
|
|
1078
|
-
return W(), n;
|
|
1079
1159
|
}, Ht = async (t, e) => {
|
|
1080
|
-
const
|
|
1160
|
+
const n = await Ke().compile().invoke(t, e);
|
|
1161
|
+
return K(), n;
|
|
1162
|
+
}, Wt = async (t, e) => {
|
|
1163
|
+
const n = await Jt().compile().invoke(t, e);
|
|
1164
|
+
return K(), n;
|
|
1165
|
+
}, Kt = async (t, e) => {
|
|
1166
|
+
const s = B(e), n = t.agentExecutionContext.userRequest, i = t.intentRationale ?? "No rationale available.", o = t.builderExclusion ? "responseOptionsBuilderExclusion" : "responseOptionsDefault";
|
|
1081
1167
|
await v(
|
|
1082
1168
|
{ text: s?.executingSolutionsAssistantAgent },
|
|
1083
1169
|
e
|
|
@@ -1085,30 +1171,30 @@ const zt = T.object({
|
|
|
1085
1171
|
const a = await y(P, "assistantResponse"), l = await y(
|
|
1086
1172
|
P,
|
|
1087
1173
|
o
|
|
1088
|
-
),
|
|
1174
|
+
), u = t.agentExecutionContext.messages.slice(-11), c = await Pe({
|
|
1089
1175
|
promptText: a,
|
|
1090
1176
|
modelTier: "advanced",
|
|
1091
1177
|
temperature: 0,
|
|
1092
|
-
messages:
|
|
1178
|
+
messages: u,
|
|
1093
1179
|
inputVariables: { query: n, rationale: i, responseOptions: l }
|
|
1094
1180
|
});
|
|
1095
|
-
return
|
|
1096
|
-
outputMessage:
|
|
1097
|
-
summary:
|
|
1181
|
+
return K(), {
|
|
1182
|
+
outputMessage: c,
|
|
1183
|
+
summary: c,
|
|
1098
1184
|
status: "success"
|
|
1099
1185
|
};
|
|
1100
|
-
},
|
|
1186
|
+
}, Qt = (t) => t.selectedTool ?? "other", Yt = () => new z(we).addNode("classifyIntent", Vt).addNode("routeToExplorer", Ht).addNode("routeToBuilder", Wt).addNode("assistantResponse", Kt).addEdge(j, "classifyIntent").addConditionalEdges("classifyIntent", Qt, {
|
|
1101
1187
|
explorer: "routeToExplorer",
|
|
1102
1188
|
builder: "routeToBuilder",
|
|
1103
1189
|
other: "assistantResponse"
|
|
1104
|
-
}).addEdge("routeToExplorer", x).addEdge("routeToBuilder", x).addEdge("assistantResponse", x),
|
|
1190
|
+
}).addEdge("routeToExplorer", x).addEdge("routeToBuilder", x).addEdge("assistantResponse", x), Xt = await y(P, "description"), Zt = {
|
|
1105
1191
|
id: "solutionsAssistant",
|
|
1106
1192
|
name: "Solutions Assistant Agent",
|
|
1107
|
-
description:
|
|
1108
|
-
createGraph:
|
|
1193
|
+
description: Xt,
|
|
1194
|
+
createGraph: Yt,
|
|
1109
1195
|
workspace: we
|
|
1110
|
-
},
|
|
1111
|
-
class
|
|
1196
|
+
}, es = "https://links.esri.com/solutions/agol-organizational-account", ts = "https://links.esri.com/solutions/configure-assistants";
|
|
1197
|
+
class ss extends ke {
|
|
1112
1198
|
constructor() {
|
|
1113
1199
|
super(), this.open = !1, this.userFirstName = "", this.builderVisible = !1, this.hasActiveBuilderDesign = !1, this._conversationId = void 0, this._orgSettings = {
|
|
1114
1200
|
aiAssistantsEnabled: !1,
|
|
@@ -1121,14 +1207,14 @@ class Xt extends ke {
|
|
|
1121
1207
|
e?.portalURL && (te.portalUrl = e.portalURL), e?.userSession && !this.userFirstName && this._loadUserFirstName(), e?.authentication?.PortalSubset?.orgSettings && (this._orgSettings = e?.authentication?.PortalSubset?.orgSettings);
|
|
1122
1208
|
}
|
|
1123
1209
|
}), this._builderDesignContextConsumer = ee({
|
|
1124
|
-
context:
|
|
1210
|
+
context: Le,
|
|
1125
1211
|
subscribe: !0,
|
|
1126
1212
|
callback: (e) => {
|
|
1127
1213
|
e?.design && (this._solutionDesignJson = JSON.stringify(e.design, null, 2));
|
|
1128
1214
|
}
|
|
1129
1215
|
}), this._handleResize = () => {
|
|
1130
1216
|
this._isMobile = window.innerWidth <= 800;
|
|
1131
|
-
}, this.closeAssistant =
|
|
1217
|
+
}, this.closeAssistant = X(), this.assistantProcessing = X(), this._handleAssistantLinkClick = (e) => {
|
|
1132
1218
|
const s = e.composedPath().find((n) => n instanceof HTMLAnchorElement);
|
|
1133
1219
|
if (s?.href)
|
|
1134
1220
|
if (e.preventDefault(), s.target.indexOf("solutionId:") > -1) {
|
|
@@ -1176,20 +1262,20 @@ class Xt extends ke {
|
|
|
1176
1262
|
e.has("open") && this.open && window.dispatchEvent(new CustomEvent("openAssistant")), this._configContextConsumer.value?.authentication && this._configContextConsumer.value?.userSession?.token && (this._preChatCheck || (de(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;
|
|
1177
1263
|
}
|
|
1178
1264
|
_renderNoSign() {
|
|
1179
|
-
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 ??
|
|
1265
|
+
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 ?? Z} class="padding-top-10">${this._translations.signIn}</calcite-link></calcite-notice>`;
|
|
1180
1266
|
}
|
|
1181
1267
|
_renderNoPermission() {
|
|
1182
|
-
return k`<calcite-notice open scale=m icon=effects kind=info><div slot=title>${this._translations.noPermissionTitle}</div><div slot=message class="padding-top-10">${
|
|
1268
|
+
return k`<calcite-notice open scale=m icon=effects kind=info><div slot=title>${this._translations.noPermissionTitle}</div><div slot=message class="padding-top-10">${Ee(this._translations.noPermissionMessage.replace("{{orgUrl}}", es).replace("{{configAI}}", ts))}</div></calcite-notice>`;
|
|
1183
1269
|
}
|
|
1184
1270
|
render() {
|
|
1185
1271
|
let e = this._suggestedPrompts.length > 0 ? this._suggestedPrompts : this._hasInteracted ? [] : Object.values(this._translations.defaultFollowUpQuestions);
|
|
1186
1272
|
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=${() => {
|
|
1187
1273
|
window.dispatchEvent(new CustomEvent("toggleSolutionBuilder"));
|
|
1188
|
-
}} 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 ??
|
|
1274
|
+
}} 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 ?? Z} .suggestedPrompts=${e} @arcgisSubmit=${(s) => {
|
|
1189
1275
|
console.log("arcgis submit: ", s.detail), this._suggestedPrompts = [], e = [], this._hasInteracted = !0;
|
|
1190
|
-
const n = Date.now(), i =
|
|
1276
|
+
const n = Date.now(), i = Fe(n), o = s.detail || "Unknown";
|
|
1191
1277
|
this._telemetry?.logEvent({
|
|
1192
|
-
category:
|
|
1278
|
+
category: De.ASSISTANT,
|
|
1193
1279
|
action: "Chat",
|
|
1194
1280
|
dimensions: [o],
|
|
1195
1281
|
metrics: [i]
|
|
@@ -1202,9 +1288,9 @@ class Xt extends ke {
|
|
|
1202
1288
|
this._queryElementInShadowDom(this.el, ".footer-container", !1);
|
|
1203
1289
|
}} @arcgisInterruptSubmit=${() => {
|
|
1204
1290
|
this._queryElementInShadowDom(this.el, ".footer-container", !1);
|
|
1205
|
-
}} ${
|
|
1291
|
+
}} ${Re(this._assistantRef)}><calcite-button appearance=transparent id=newChatButton icon-start=speech-bubble-plus kind=neutral .label=${this._translations.tooltips.newChat} @click=${() => {
|
|
1206
1292
|
this._conversationId = void 0, this._suggestedPrompts = [], this._hasInteracted = !1, this._assistantRef.value?.clearChatHistory(), this._queryElementInShadowDom(this.el, ".footer-container", !1);
|
|
1207
|
-
}} round scale=
|
|
1293
|
+
}} round scale=m slot=entry-actions-start>${this._translations.tooltips.newChat}</calcite-button><arcgis-assistant-agent .agent=${Zt} .context=${{
|
|
1208
1294
|
token: this._configContextConsumer.value?.userSession?.token,
|
|
1209
1295
|
configContext: this._configContextConsumer.value,
|
|
1210
1296
|
convoId: this._conversationId,
|
|
@@ -1218,7 +1304,7 @@ class Xt extends ke {
|
|
|
1218
1304
|
clearSuggestedPrompts: () => {
|
|
1219
1305
|
this._suggestedPrompts = [];
|
|
1220
1306
|
}
|
|
1221
|
-
}}></arcgis-assistant-agent></arcgis-assistant><div slot=footer class="disclaimer-div width-100"><calcite-chip class="beta-chip" appearance=
|
|
1307
|
+
}}></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()}<calcite-action icon=x id=closeAssistantButton .label=${this._translations.tooltips.close} @click=${() => {
|
|
1222
1308
|
this.closeAssistant.emit(!0);
|
|
1223
1309
|
}} 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>`;
|
|
1224
1310
|
}
|
|
@@ -1237,14 +1323,14 @@ class Xt extends ke {
|
|
|
1237
1323
|
}
|
|
1238
1324
|
}
|
|
1239
1325
|
_parseAgentPickedAndTask(e) {
|
|
1240
|
-
const s = Array.from(this._assistantRef.value?.messages || []), n = e.log || [], a = [...s].sort((
|
|
1326
|
+
const s = Array.from(this._assistantRef.value?.messages || []), n = e.log || [], a = [...s].sort((d, g) => g.id - d.id).find((d) => d.role === "user" && d.id <= e.id)?.content || null, l = n.find((d) => typeof d == "string" && d.includes("Agent picked:")) ?? null;
|
|
1241
1327
|
if (!l)
|
|
1242
1328
|
return { agentPicked: null, taskAssigned: null, userMessage: a };
|
|
1243
|
-
const
|
|
1244
|
-
if (!
|
|
1329
|
+
const u = /Agent picked:\s*(.*?)\s*(?:\\n|\r?\n)\s*Task Assigned:\s*([\s\S]*)$/i, c = l.match(u);
|
|
1330
|
+
if (!c)
|
|
1245
1331
|
return { agentPicked: null, taskAssigned: null, userMessage: a };
|
|
1246
|
-
const
|
|
1247
|
-
return { agentPicked:
|
|
1332
|
+
const m = c[1].trim(), h = c[2].trim();
|
|
1333
|
+
return { agentPicked: m, taskAssigned: h, userMessage: a };
|
|
1248
1334
|
}
|
|
1249
1335
|
_emitItemIdFromAI(e) {
|
|
1250
1336
|
const s = new CustomEvent("solutionIDFromAssistant", {
|
|
@@ -1277,7 +1363,7 @@ class Xt extends ke {
|
|
|
1277
1363
|
});
|
|
1278
1364
|
}
|
|
1279
1365
|
}
|
|
1280
|
-
Ce("arcgis-solutions-assistant",
|
|
1366
|
+
Ce("arcgis-solutions-assistant", ss);
|
|
1281
1367
|
export {
|
|
1282
|
-
|
|
1368
|
+
ss as ArcgisSolutionsAssistant
|
|
1283
1369
|
};
|