@esri/solutions-components 5.1.0-next.145 → 5.1.0-next.146
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/{LL647FJR.js → 2IGILR4T.js} +1 -1
- package/dist/cdn/{ZHXREM2D.js → 3KYQE6O5.js} +1 -1
- package/dist/cdn/{IEN3TA4W.js → 463VANZI.js} +1 -1
- package/dist/cdn/{5OFQVDNK.js → 4MAZNAHZ.js} +1 -1
- package/dist/cdn/{I7XBRB6B.js → 4NZDPHHF.js} +1 -1
- package/dist/cdn/{4JVDUPVW.js → 7WD3GNG4.js} +1 -1
- package/dist/cdn/{RSCBZIAN.js → 7WIFBTQF.js} +12 -1
- package/dist/cdn/{C5ZH23YO.js → B5MBF4JC.js} +13 -13
- package/dist/cdn/BG4LNU44.js +2 -0
- package/dist/cdn/D3XPV5W4.js +2 -0
- package/dist/cdn/{MEZL3ZHS.js → E6YCTW3S.js} +25 -25
- package/dist/cdn/{3V2UWENT.js → FAIQTEVJ.js} +1 -1
- package/dist/cdn/{5NQNJZTE.js → FCJSMT5G.js} +1 -1
- package/dist/cdn/FSWG7SUT.js +2 -0
- package/dist/cdn/{A27DLHRU.js → IFONVCBL.js} +1 -1
- package/dist/cdn/{G3F52QRW.js → JOAEH3CI.js} +1 -1
- package/dist/cdn/KIPRPYME.js +2 -0
- package/dist/cdn/{NIHPHDXG.js → LWT3JEQ6.js} +21 -52
- package/dist/cdn/LZDMYPQ2.js +75 -0
- package/dist/cdn/{Y6QJCLML.js → M3NML7ZV.js} +1 -1
- package/dist/cdn/{6MOTC6CE.js → NV2DLQDN.js} +1 -1
- package/dist/cdn/{XGWDWPRK.js → O6ZQYZKL.js} +1 -1
- package/dist/cdn/{HPWNNMVU.js → QU25YPPX.js} +1 -1
- package/dist/cdn/{HLKEBN2O.js → RRD4QUQS.js} +1 -1
- package/dist/cdn/U56TK45K.js +113 -0
- package/dist/cdn/{UM3P3Q52.js → U6JZYJ4D.js} +1 -1
- package/dist/cdn/{34CZ4EWR.js → V3MSUKLX.js} +6 -4
- package/dist/cdn/{72X4E4QW.js → WC37HMOI.js} +1 -1
- package/dist/cdn/{LJY6BB64.js → X6JL6SAH.js} +1 -1
- package/dist/cdn/{QFZK4TD4.js → Z23BVIGQ.js} +1 -1
- package/dist/cdn/{QQXQAU33.js → ZCPVOS4Q.js} +1 -1
- package/dist/cdn/{25NZZKXC.js → ZM27FRZG.js} +1 -1
- package/dist/cdn/ZUPXKH75.js +2 -0
- package/dist/cdn/{G3FTF6WH.js → ZYLKUZID.js} +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/assessBuildRequest.js +116 -0
- package/dist/chunks/assessUpdateRequest.js +78 -0
- package/dist/chunks/assistantResponse.js +12 -1
- package/dist/chunks/classifyIntent.js +21 -52
- package/dist/chunks/designSolution.js +6 -4
- package/dist/chunks/templates.js +2 -2
- package/dist/chunks/updateDesign.js +1 -1
- package/dist/components/arcgis-solutions-assistant/customElement.js +304 -259
- package/dist/components/solution-deployed-card-panel/customElement.js +4 -4
- package/dist/components/solution-details-panel/customElement.js +1 -1
- package/dist/components/solution-item-diagram/customElement.js +321 -285
- package/dist/components/solutions-all-panel/customElement.js +4 -4
- package/dist/components/solutions-deploy-app/customElement.js +5 -5
- 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 -9
- package/package.json +1 -1
- package/dist/cdn/56A5UMZG.js +0 -9
- package/dist/cdn/AZN2E5DL.js +0 -2
- package/dist/cdn/DFZZNKPK.js +0 -76
- package/dist/cdn/NIYB3TEW.js +0 -2
- package/dist/cdn/Q5TICZRX.js +0 -15
- package/dist/cdn/VO53567V.js +0 -2
- package/dist/cdn/WKS3TKDC.js +0 -2
- package/dist/cdn/YVIEKHQQ.js +0 -2
- package/dist/chunks/initialAssessment.js +0 -79
- package/dist/chunks/responseOptionsBuilderExclusion.js +0 -12
- package/dist/chunks/responseOptionsDefault.js +0 -18
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import { c as
|
|
3
|
-
import { u as
|
|
2
|
+
import { c as _e } from "../../chunks/runtime.js";
|
|
3
|
+
import { u as Te } from "../../chunks/useT9n.js";
|
|
4
4
|
import { LitElement as ke, createEvent as X, nothing as Z } from "@arcgis/lumina";
|
|
5
|
-
import { css as
|
|
6
|
-
import { unsafeHTML as
|
|
5
|
+
import { css as Ee, html as E } from "lit";
|
|
6
|
+
import { unsafeHTML as Ae } from "lit/directives/unsafe-html.js";
|
|
7
7
|
import { useContextConsumer as ee } from "@arcgis/lumina/context";
|
|
8
|
-
import { c as
|
|
8
|
+
import { c as Le, b as Re } from "../../chunks/deployAppContexts.js";
|
|
9
9
|
import { T as De } from "../../chunks/interfaces.js";
|
|
10
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 Me } from "lit-html/directives/ref.js";
|
|
13
|
+
import { Annotation as b, StateGraph as O, START as z, END as v, NodeInterrupt as ne } from "@langchain/langgraph/web";
|
|
14
|
+
import { createAgentRuntimeState as j, sendTraceMessage as w, invokeStructuredPrompt as _, getEmbeddings as Be, cosineSimilarity as Ne, invokeTextPrompt as qe } from "@arcgis/ai-orchestrator";
|
|
15
|
+
import r, { z as D } from "zod";
|
|
16
|
+
import * as J from "@esri/arcgis-rest-portal";
|
|
17
|
+
import { applyPatch as Pe } from "fast-json-patch";
|
|
18
18
|
import "@langchain/core/messages";
|
|
19
19
|
import { C as ie } from "../../chunks/converter.js";
|
|
20
|
-
import {
|
|
20
|
+
import { t as oe, g as B, c as ae, r as re, d as L } 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 = Ee`: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,10 +34,10 @@ ${Object.keys(t).join(`
|
|
|
34
34
|
);
|
|
35
35
|
return await s[1]();
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function N(t) {
|
|
38
38
|
return t?.configurable?.context?.translations;
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function le(t) {
|
|
41
41
|
if (typeof window > "u" || t.length <= 1)
|
|
42
42
|
return;
|
|
43
43
|
const e = t.map((n) => n.solution.id), s = t.map((n) => n.solution.title);
|
|
@@ -59,7 +59,7 @@ function re(t) {
|
|
|
59
59
|
}
|
|
60
60
|
}));
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function ce(t) {
|
|
63
63
|
if (typeof window > "u" || !t)
|
|
64
64
|
return;
|
|
65
65
|
const e = new CustomEvent("solutionIDFromAssistant", {
|
|
@@ -96,10 +96,10 @@ function Ge(t, e) {
|
|
|
96
96
|
function Ve(t) {
|
|
97
97
|
return t && t.helperServices.aiAssistantServices ? `${t.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/chat` : null;
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function de(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 U(t, e, s) {
|
|
103
103
|
const n = await fetch(e, {
|
|
104
104
|
method: "POST",
|
|
105
105
|
headers: {
|
|
@@ -117,7 +117,7 @@ const He = (t) => new Promise((e) => setTimeout(e, t)), We = b.Root({
|
|
|
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,9 +133,9 @@ const He = (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 O(We).addNode("initializeAgent", Ye).addNode("askSolutionsQuestions", Qe).addEdge(z, "initializeAgent").addEdge("initializeAgent", "askSolutionsQuestions").addEdge("askSolutionsQuestions", v), ue = async (t, e, s, n) => {
|
|
137
137
|
if (!t) return;
|
|
138
|
-
const i =
|
|
138
|
+
const i = de(t);
|
|
139
139
|
if (!i) return;
|
|
140
140
|
const a = { context: {
|
|
141
141
|
kind: "DocAIAssistantRequest",
|
|
@@ -147,15 +147,15 @@ const He = (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), U(a, i, e ?? "");
|
|
151
151
|
}, Qe = async (t, e) => {
|
|
152
|
-
const s =
|
|
152
|
+
const s = N(e), n = t.documentSkillUrl;
|
|
153
153
|
let i = [];
|
|
154
|
-
await
|
|
154
|
+
await w(
|
|
155
155
|
{ text: s.agentProgress.explorerAgentSearching },
|
|
156
156
|
e
|
|
157
157
|
);
|
|
158
|
-
let o = await
|
|
158
|
+
let o = await U(
|
|
159
159
|
{
|
|
160
160
|
message: t.agentExecutionContext.userRequest,
|
|
161
161
|
conversationId: e?.configurable?.context?.convoId ?? void 0,
|
|
@@ -182,24 +182,24 @@ const He = (t) => new Promise((e) => setTimeout(e, t)), We = b.Root({
|
|
|
182
182
|
inquiryId: o.inquiryId
|
|
183
183
|
}, l = "";
|
|
184
184
|
const u = async (m) => {
|
|
185
|
-
const
|
|
186
|
-
if (
|
|
187
|
-
const g = Je(
|
|
185
|
+
const f = m.context?.results?.[0]?.reply ?? "";
|
|
186
|
+
if (f !== "") {
|
|
187
|
+
const g = Je(f), A = Ge(g, e);
|
|
188
188
|
l = A.source, i = [
|
|
189
189
|
...i,
|
|
190
190
|
...A.allMatches.filter(
|
|
191
|
-
(
|
|
191
|
+
(T) => !i.some((k) => k.solution.id === T.solution.id)
|
|
192
192
|
)
|
|
193
193
|
];
|
|
194
194
|
}
|
|
195
195
|
const d = m.context?.results?.[0]?.status?.currentStatusStep;
|
|
196
196
|
if (d) {
|
|
197
197
|
let g = "";
|
|
198
|
-
d === 1 ? g = s.agentProgress.explorerAgentReading : d === 2 ? g = s.agentProgress.explorerAgentReviewing : d === 3 && (g = s.agentProgress.explorerAgentPreparing), await
|
|
198
|
+
d === 1 ? g = s.agentProgress.explorerAgentReading : d === 2 ? g = s.agentProgress.explorerAgentReviewing : d === 3 && (g = s.agentProgress.explorerAgentPreparing), await w({ text: g }, e);
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
201
|
for (await u(o); a.hasMore; )
|
|
202
|
-
await He(500), o = await
|
|
202
|
+
await He(500), o = await U(
|
|
203
203
|
{
|
|
204
204
|
conversationId: a.conversationId,
|
|
205
205
|
ackSequenceNumber: a.ackSequenceNumber,
|
|
@@ -214,12 +214,12 @@ const He = (t) => new Promise((e) => setTimeout(e, t)), We = b.Root({
|
|
|
214
214
|
ackSequenceNumber: o.sequenceNumber,
|
|
215
215
|
inquiryId: o.inquiryId
|
|
216
216
|
}, await u(o);
|
|
217
|
-
return
|
|
217
|
+
return de(e?.configurable?.context.portal) && ue(
|
|
218
218
|
e?.configurable?.context.portal,
|
|
219
219
|
e?.configurable?.context.token ?? "",
|
|
220
220
|
e?.configurable?.context.configContext.locale ?? "en",
|
|
221
221
|
a.conversationId
|
|
222
|
-
), i.length && (i.length === 1 ?
|
|
222
|
+
), i.length && (i.length === 1 ? ce(i[0].solution.id) : le(i)), {
|
|
223
223
|
outputMessage: l,
|
|
224
224
|
summary: l,
|
|
225
225
|
status: "success",
|
|
@@ -233,7 +233,7 @@ const He = (t) => new Promise((e) => setTimeout(e, t)), We = b.Root({
|
|
|
233
233
|
};
|
|
234
234
|
};
|
|
235
235
|
await y(je, "solutions_explorer_description");
|
|
236
|
-
const
|
|
236
|
+
const pe = (t) => {
|
|
237
237
|
if (t && Array.isArray(t.id) && t.id.length > 0)
|
|
238
238
|
return t.id[t.id.length - 1].replace("Message", "").toLowerCase();
|
|
239
239
|
if (t && typeof t._getType == "function")
|
|
@@ -244,7 +244,7 @@ const ue = (t) => {
|
|
|
244
244
|
}
|
|
245
245
|
return "human";
|
|
246
246
|
}, Xe = (t) => {
|
|
247
|
-
const e =
|
|
247
|
+
const e = pe(t);
|
|
248
248
|
if (t && t.kwargs)
|
|
249
249
|
return {
|
|
250
250
|
role: e,
|
|
@@ -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
|
-
}, Ze = (t) =>
|
|
262
|
+
}, Ze = (t) => pe(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",
|
|
@@ -326,7 +326,7 @@ const ue = (t) => {
|
|
|
326
326
|
"view",
|
|
327
327
|
"where"
|
|
328
328
|
]);
|
|
329
|
-
class
|
|
329
|
+
class me {
|
|
330
330
|
constructor(e, s, n = !0) {
|
|
331
331
|
this.isValid = !0, this.issues = [], this.fieldNameRegistry = null, this.response = e, this.template = s, this.newDesign = n, this.validate();
|
|
332
332
|
}
|
|
@@ -414,7 +414,7 @@ class pe {
|
|
|
414
414
|
...e.customFields,
|
|
415
415
|
...e.requiredFields,
|
|
416
416
|
...c
|
|
417
|
-
].map((
|
|
417
|
+
].map((f) => f.name);
|
|
418
418
|
m.length !== new Set(m).size && this.logIssue(`Layer '${e.name}' has duplicate fields: ${JSON.stringify(m)}.`);
|
|
419
419
|
}
|
|
420
420
|
const l = e.systemFields ?? [], u = [...e.customFields, ...e.requiredFields, ...l].map((c) => c.name.toLowerCase());
|
|
@@ -504,7 +504,7 @@ const ot = r.object({
|
|
|
504
504
|
itemId: r.string().describe("ArcGIS item id for the feature layer."),
|
|
505
505
|
addLayers: r.boolean().describe("Indicates whether new layers can be added during solution design."),
|
|
506
506
|
layers: r.array(rt)
|
|
507
|
-
}),
|
|
507
|
+
}), G = r.object({
|
|
508
508
|
response: r.string().describe("Conversational response to the user's query."),
|
|
509
509
|
solution: r.object({
|
|
510
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."),
|
|
@@ -526,17 +526,21 @@ const ot = r.object({
|
|
|
526
526
|
}), ut = r.object({
|
|
527
527
|
response: r.string().describe("Short, user-friendly explanation of why the requested update was not applied.")
|
|
528
528
|
}), pt = r.object({
|
|
529
|
-
|
|
529
|
+
assistantResponse: r.string().describe("Natural-language response for the user."),
|
|
530
|
+
isValidUpdate: r.boolean().describe("True only when the request is in scope for supported design updates.")
|
|
530
531
|
}), mt = r.object({
|
|
532
|
+
matchedTitles: r.array(r.string()).describe("Titles of solutions that match the user's request. Empty array if no strong match.")
|
|
533
|
+
}), gt = r.object({
|
|
531
534
|
templateId: r.string().min(1).describe("Template id from the available template list."),
|
|
532
535
|
confidence: r.number().min(0).max(1).describe("Confidence score from 0 to 1 for this template match."),
|
|
533
|
-
templateDescription: r.string().min(1).describe("Short description
|
|
534
|
-
}),
|
|
535
|
-
assistantResponse: r.string().describe("Natural-language response for the user."),
|
|
536
|
+
templateDescription: r.string().min(1).describe("Short action‑oriented description of the template in the user's use case/workflow, starting with a verb.")
|
|
537
|
+
}), ht = r.object({
|
|
538
|
+
assistantResponse: r.string().nullable().describe("Natural-language response for the user."),
|
|
536
539
|
isValidUseCase: r.boolean().describe("True only when the request is concrete, appropriate, and has at least one matching template."),
|
|
537
|
-
matchedTemplates: r.array(
|
|
538
|
-
|
|
539
|
-
|
|
540
|
+
matchedTemplates: r.array(gt).describe("Ordered list of matching templates, best match first. Empty when no valid match exists."),
|
|
541
|
+
rationale: r.string().min(1).describe("A brief rationale for the choice for isValidUseCase and matchedTemplates (≤140 characters)")
|
|
542
|
+
}), ft = (t) => t.length ? t.map((e, s) => `${s + 1}. ${e}`).join(`
|
|
543
|
+
`) : "No validation errors were provided.", bt = async (t) => {
|
|
540
544
|
const {
|
|
541
545
|
query: e,
|
|
542
546
|
validationIssues: s,
|
|
@@ -545,7 +549,7 @@ const ot = r.object({
|
|
|
545
549
|
promptModules: o
|
|
546
550
|
} = t;
|
|
547
551
|
try {
|
|
548
|
-
return (await
|
|
552
|
+
return (await _({
|
|
549
553
|
promptText: await y(o, "explainValidationFailure"),
|
|
550
554
|
modelTier: "fast",
|
|
551
555
|
temperature: 0,
|
|
@@ -554,7 +558,7 @@ const ot = r.object({
|
|
|
554
558
|
inputVariables: {
|
|
555
559
|
query: e,
|
|
556
560
|
validationIssueCount: String(s.length),
|
|
557
|
-
validationIssues:
|
|
561
|
+
validationIssues: ft(s)
|
|
558
562
|
}
|
|
559
563
|
})).response?.trim() || i;
|
|
560
564
|
} catch (a) {
|
|
@@ -563,32 +567,33 @@ const ot = r.object({
|
|
|
563
567
|
{ error: a }
|
|
564
568
|
), i;
|
|
565
569
|
}
|
|
566
|
-
},
|
|
567
|
-
let
|
|
568
|
-
const
|
|
570
|
+
}, V = (t) => t in L, yt = 5, xt = 0.8, vt = 0.15, wt = "Web Mapping Application", St = "Embeddings";
|
|
571
|
+
let F = null, P = null, $ = null, M = null;
|
|
572
|
+
const It = "Build", I = /* @__PURE__ */ Object.assign({
|
|
573
|
+
"./prompts/assessBuildRequest.md": () => import("../../chunks/assessBuildRequest.js").then((t) => t.default),
|
|
574
|
+
"./prompts/assessUpdateRequest.md": () => import("../../chunks/assessUpdateRequest.js").then((t) => t.default),
|
|
569
575
|
"./prompts/description.md": () => import("../../chunks/description2.js").then((t) => t.default),
|
|
570
576
|
"./prompts/designSolution.md": () => import("../../chunks/designSolution.js").then((t) => t.default),
|
|
571
577
|
"./prompts/explainValidationFailure.md": () => import("../../chunks/explainValidationFailure.js").then((t) => t.default),
|
|
572
578
|
"./prompts/findExistingSolution.md": () => import("../../chunks/findExistingSolution.js").then((t) => t.default),
|
|
573
|
-
"./prompts/initialAssessment.md": () => import("../../chunks/initialAssessment.js").then((t) => t.default),
|
|
574
579
|
"./prompts/updateDesign.md": () => import("../../chunks/updateDesign.js").then((t) => t.default)
|
|
575
|
-
}),
|
|
580
|
+
}), Ct = nt.builderMessages, h = (t, e, s) => N(e)?.builderMessages?.[t] ?? Ct[t], ge = (t) => {
|
|
576
581
|
typeof window < "u" && window.dispatchEvent(new CustomEvent("arcgis-solution-design-update", {
|
|
577
582
|
detail: t
|
|
578
583
|
}));
|
|
579
|
-
},
|
|
584
|
+
}, _t = async (t, e, s) => {
|
|
580
585
|
if (!t) return null;
|
|
581
|
-
const n = `type:"${
|
|
582
|
-
return (await
|
|
586
|
+
const n = `type:"${wt}" AND typekeywords:${St} AND group:${t}`;
|
|
587
|
+
return (await J.searchItems({
|
|
583
588
|
q: n,
|
|
584
589
|
params: e ? { token: e } : void 0,
|
|
585
590
|
portal: s,
|
|
586
591
|
num: 1
|
|
587
592
|
}))?.results?.[0] ?? null;
|
|
588
593
|
};
|
|
589
|
-
async function
|
|
594
|
+
async function Tt(t, e, s) {
|
|
590
595
|
try {
|
|
591
|
-
const n = await
|
|
596
|
+
const n = await _t(t, e, s);
|
|
592
597
|
if (!n) return null;
|
|
593
598
|
const i = new Oe({ id: n.id });
|
|
594
599
|
return await i.load(), await i.fetchData("json");
|
|
@@ -598,16 +603,16 @@ async function _t(t, e, s) {
|
|
|
598
603
|
}
|
|
599
604
|
const kt = async (t, e, s) => {
|
|
600
605
|
if (!t) return [];
|
|
601
|
-
const n = `type:Solution AND typekeywords:${
|
|
602
|
-
return (await
|
|
606
|
+
const n = `type:Solution AND typekeywords:${It} AND group:${t}`;
|
|
607
|
+
return (await J.searchItems({
|
|
603
608
|
q: n,
|
|
604
609
|
params: e ? { token: e } : void 0,
|
|
605
610
|
portal: s,
|
|
606
611
|
num: 100
|
|
607
612
|
}))?.results ?? [];
|
|
608
|
-
},
|
|
613
|
+
}, Et = async (t, e, s) => {
|
|
609
614
|
try {
|
|
610
|
-
const n = await
|
|
615
|
+
const n = await J.getItemData(t, {
|
|
611
616
|
params: e ? { token: e } : void 0,
|
|
612
617
|
portal: s
|
|
613
618
|
}), i = n?.buildSolution;
|
|
@@ -617,7 +622,7 @@ const kt = async (t, e, s) => {
|
|
|
617
622
|
} catch {
|
|
618
623
|
return null;
|
|
619
624
|
}
|
|
620
|
-
},
|
|
625
|
+
}, C = (t, e = {}) => {
|
|
621
626
|
let s = t;
|
|
622
627
|
return "itemId" in e && (s = {
|
|
623
628
|
...s,
|
|
@@ -635,7 +640,7 @@ const kt = async (t, e, s) => {
|
|
|
635
640
|
...s,
|
|
636
641
|
templateId: e.templateId ?? null
|
|
637
642
|
}), s;
|
|
638
|
-
},
|
|
643
|
+
}, he = (t, e) => {
|
|
639
644
|
if (t == null || e == null)
|
|
640
645
|
return { ok: !1, error: "design or sourceBuildSolution is null/undefined" };
|
|
641
646
|
try {
|
|
@@ -647,14 +652,14 @@ const kt = async (t, e, s) => {
|
|
|
647
652
|
error: s instanceof Error ? s.stack ?? s.message : String(s)
|
|
648
653
|
};
|
|
649
654
|
}
|
|
650
|
-
},
|
|
651
|
-
if (
|
|
652
|
-
Object.entries(
|
|
653
|
-
|
|
655
|
+
}, H = async (t) => {
|
|
656
|
+
if (P) {
|
|
657
|
+
Object.entries(P).forEach(([a, l]) => {
|
|
658
|
+
L[a] && (L[a].initialTemplate = l);
|
|
654
659
|
});
|
|
655
660
|
return;
|
|
656
661
|
}
|
|
657
|
-
const e = t?.configurable?.context?.token, s =
|
|
662
|
+
const e = t?.configurable?.context?.token, s = be(t), n = ye(t);
|
|
658
663
|
if (!s) {
|
|
659
664
|
console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping live template hydration.");
|
|
660
665
|
return;
|
|
@@ -665,9 +670,9 @@ const kt = async (t, e, s) => {
|
|
|
665
670
|
if (!l || typeof l != "object") return;
|
|
666
671
|
const u = l.id;
|
|
667
672
|
if (typeof u != "string" || o[u]) return;
|
|
668
|
-
const c = await
|
|
673
|
+
const c = await Et(a.id, e, n);
|
|
669
674
|
if (!c) return;
|
|
670
|
-
const { buildSolution: m, params:
|
|
675
|
+
const { buildSolution: m, params: f } = c;
|
|
671
676
|
if (typeof m == "object" && m !== null && "solution" in m) {
|
|
672
677
|
const g = m.solution;
|
|
673
678
|
g.thumbnailUrl = a.thumbnail ? `${n ?? "https://www.arcgis.com/sharing/rest"}/content/items/${a.id}/info/${a.thumbnail}` : void 0, g.item = a;
|
|
@@ -676,66 +681,66 @@ const kt = async (t, e, s) => {
|
|
|
676
681
|
...l,
|
|
677
682
|
buildSolution: m
|
|
678
683
|
};
|
|
679
|
-
o[u] =
|
|
684
|
+
o[u] = C(
|
|
680
685
|
new ie(d).dumpToLlmTemplate(),
|
|
681
686
|
{
|
|
682
687
|
itemId: a.id,
|
|
683
688
|
sourceBuildSolution: structuredClone(m),
|
|
684
|
-
params:
|
|
689
|
+
params: f ? structuredClone(f) : null
|
|
685
690
|
}
|
|
686
|
-
),
|
|
691
|
+
), L[u] = {
|
|
687
692
|
...l,
|
|
688
693
|
initialTemplate: o[u]
|
|
689
694
|
};
|
|
690
|
-
})),
|
|
691
|
-
},
|
|
695
|
+
})), P = o;
|
|
696
|
+
}, fe = (t) => {
|
|
692
697
|
const e = t?.configurable?.context?.token;
|
|
693
698
|
return typeof e != "string" || !e.trim() ? null : e;
|
|
694
|
-
},
|
|
699
|
+
}, be = (t) => {
|
|
695
700
|
const e = t?.configurable?.context?.configContext?.primarySolutionsGroupId;
|
|
696
701
|
return typeof e != "string" || !e.trim() ? null : e;
|
|
697
|
-
},
|
|
702
|
+
}, ye = (t) => {
|
|
698
703
|
const e = t?.configurable?.context?.configContext?.portalURL;
|
|
699
704
|
if (!(typeof e != "string" || !e.trim()))
|
|
700
705
|
return `${e.replace(/\/+$/, "")}/sharing/rest`;
|
|
701
|
-
},
|
|
706
|
+
}, At = async (t) => {
|
|
702
707
|
await Promise.all([
|
|
703
|
-
|
|
704
|
-
|
|
708
|
+
ve(t),
|
|
709
|
+
H(t)
|
|
705
710
|
]);
|
|
706
|
-
},
|
|
707
|
-
const e = he(t);
|
|
708
|
-
(!R || e && e !== M) && (M = e ?? M, R = Et(t).catch((n) => {
|
|
709
|
-
throw R = null, M = null, n;
|
|
710
|
-
})), await R;
|
|
711
|
-
};
|
|
712
|
-
async function xe(t) {
|
|
713
|
-
if ($) return $;
|
|
711
|
+
}, xe = async (t) => {
|
|
714
712
|
const e = fe(t);
|
|
713
|
+
(!$ || e && e !== M) && (M = e ?? M, $ = At(t).catch((n) => {
|
|
714
|
+
throw $ = null, M = null, n;
|
|
715
|
+
})), await $;
|
|
716
|
+
};
|
|
717
|
+
async function ve(t) {
|
|
718
|
+
if (F) return F;
|
|
719
|
+
const e = be(t);
|
|
715
720
|
if (!e)
|
|
716
721
|
return console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping embeddings load."), null;
|
|
717
|
-
const s =
|
|
722
|
+
const s = ye(t), n = t?.configurable?.context?.configContext?.portalURL;
|
|
718
723
|
await new Ue(n ? { url: n } : void 0).load();
|
|
719
|
-
const o =
|
|
720
|
-
return a ? (
|
|
724
|
+
const o = fe(t) ?? void 0, a = await Tt(e, o, s);
|
|
725
|
+
return a ? (F = a.items, F) : null;
|
|
721
726
|
}
|
|
722
|
-
const
|
|
727
|
+
const Lt = () => Object.entries(L).map(([t, e]) => `ID: ${t}
|
|
723
728
|
Label: ${e.label}
|
|
724
729
|
Description: ${e.description}`).join(`
|
|
725
730
|
|
|
726
|
-
`),
|
|
731
|
+
`), Rt = (t) => {
|
|
727
732
|
const e = t?.configurable?.context?.solutionDesignJson;
|
|
728
733
|
if (typeof e != "string" || !e.trim())
|
|
729
734
|
return null;
|
|
730
735
|
try {
|
|
731
|
-
const s = JSON.parse(e), n =
|
|
736
|
+
const s = JSON.parse(e), n = C(
|
|
732
737
|
{ response: "", ...s },
|
|
733
738
|
{ itemId: s?.solution?.itemId ?? null }
|
|
734
|
-
), i =
|
|
739
|
+
), i = G.safeParse(n);
|
|
735
740
|
if (!i.success)
|
|
736
741
|
return null;
|
|
737
|
-
const { response: o, ...a } = i.data, l = s.templateId, u = typeof l == "string" &&
|
|
738
|
-
return
|
|
742
|
+
const { response: o, ...a } = i.data, l = s.templateId, u = typeof l == "string" && V(l) ? l : null;
|
|
743
|
+
return C(
|
|
739
744
|
a,
|
|
740
745
|
{
|
|
741
746
|
sourceBuildSolution: s.sourceBuildSolution,
|
|
@@ -747,7 +752,7 @@ Description: ${e.description}`).join(`
|
|
|
747
752
|
return null;
|
|
748
753
|
}
|
|
749
754
|
}, Dt = b.Root({
|
|
750
|
-
...
|
|
755
|
+
...j(),
|
|
751
756
|
/** Optional human-readable template description retained for UI use. */
|
|
752
757
|
templateDescription: b({
|
|
753
758
|
reducer: (t, e) => typeof e == "string" || e === null ? e : t ?? null,
|
|
@@ -768,6 +773,11 @@ Description: ${e.description}`).join(`
|
|
|
768
773
|
reducer: (t = null, e) => e === void 0 ? t : e ?? null,
|
|
769
774
|
default: () => null
|
|
770
775
|
}),
|
|
776
|
+
/** Update request assessment produced when an active design exists. */
|
|
777
|
+
updateAssessment: b({
|
|
778
|
+
reducer: (t = null, e) => e === void 0 ? t : e ?? null,
|
|
779
|
+
default: () => null
|
|
780
|
+
}),
|
|
771
781
|
/** Existing solution matches surfaced before building a new solution. */
|
|
772
782
|
existingMatches: b({
|
|
773
783
|
reducer: (t = [], e) => e === void 0 ? t : e ?? [],
|
|
@@ -779,46 +789,77 @@ Description: ${e.description}`).join(`
|
|
|
779
789
|
default: () => null
|
|
780
790
|
})
|
|
781
791
|
}), Ft = (t, e) => {
|
|
782
|
-
const s =
|
|
792
|
+
const s = Rt(e), n = s?.templateId ?? null, i = {};
|
|
783
793
|
return JSON.stringify(t.currentDesign) !== JSON.stringify(s) && (i.currentDesign = s), n && t.selectedTemplate !== n && (i.selectedTemplate = n), i;
|
|
784
794
|
}, $t = async (t, e) => {
|
|
785
|
-
await
|
|
786
|
-
const s = t.agentExecutionContext.userRequest, n =
|
|
787
|
-
promptText: await y(
|
|
795
|
+
await w({ text: h("understandingRequest", e) }, e), await xe(e);
|
|
796
|
+
const s = t.agentExecutionContext.userRequest, n = Lt(), i = t.agentExecutionContext.messages.slice(-11), o = await _({
|
|
797
|
+
promptText: await y(I, "assessBuildRequest"),
|
|
788
798
|
modelTier: "advanced",
|
|
789
799
|
temperature: 0,
|
|
790
|
-
schema:
|
|
800
|
+
schema: ht,
|
|
791
801
|
messages: i,
|
|
792
802
|
inputVariables: { query: s, availableTemplates: n }
|
|
793
803
|
}), a = o.matchedTemplates.filter(
|
|
794
|
-
(d) =>
|
|
804
|
+
(d) => V(d.templateId)
|
|
795
805
|
), l = {
|
|
796
806
|
...o,
|
|
797
807
|
matchedTemplates: a
|
|
798
|
-
}, [u, c] = a,
|
|
808
|
+
}, [u, c] = a, f = !!u && u.confidence >= xt && (c === void 0 || u.confidence - c.confidence >= vt) ? u.templateId : null;
|
|
799
809
|
return {
|
|
800
810
|
assessment: l,
|
|
801
|
-
selectedTemplate:
|
|
811
|
+
selectedTemplate: f,
|
|
802
812
|
existingMatches: [],
|
|
803
813
|
continueBuilding: null
|
|
804
814
|
};
|
|
805
|
-
},
|
|
815
|
+
}, Mt = (t) => {
|
|
806
816
|
const e = t.assessment?.assistantResponse ?? "";
|
|
807
817
|
return {
|
|
808
818
|
outputMessage: e,
|
|
809
819
|
summary: e,
|
|
810
820
|
status: "success"
|
|
811
821
|
};
|
|
812
|
-
},
|
|
822
|
+
}, Bt = async (t, e) => {
|
|
823
|
+
const { currentDesign: s } = t;
|
|
824
|
+
if (!s)
|
|
825
|
+
return {
|
|
826
|
+
updateAssessment: {
|
|
827
|
+
assistantResponse: "",
|
|
828
|
+
isValidUpdate: !0
|
|
829
|
+
}
|
|
830
|
+
};
|
|
831
|
+
await w({ text: h("understandingRequest", e) }, e);
|
|
832
|
+
const n = t.agentExecutionContext.userRequest, i = t.agentExecutionContext.messages.slice(-11);
|
|
833
|
+
return {
|
|
834
|
+
updateAssessment: await _({
|
|
835
|
+
promptText: await y(I, "assessUpdateRequest"),
|
|
836
|
+
modelTier: "advanced",
|
|
837
|
+
temperature: 0,
|
|
838
|
+
schema: pt,
|
|
839
|
+
messages: i,
|
|
840
|
+
inputVariables: {
|
|
841
|
+
currentDesign: JSON.stringify(oe(s)),
|
|
842
|
+
query: n
|
|
843
|
+
}
|
|
844
|
+
})
|
|
845
|
+
};
|
|
846
|
+
}, Nt = (t, e) => {
|
|
847
|
+
const s = t.updateAssessment?.assistantResponse ?? h("applyChangeFailed", e);
|
|
848
|
+
return {
|
|
849
|
+
outputMessage: s,
|
|
850
|
+
summary: s,
|
|
851
|
+
status: "success"
|
|
852
|
+
};
|
|
853
|
+
}, qt = (t, e) => {
|
|
813
854
|
const { hitlResponse: s } = e.configurable, n = "selectTemplate", i = t.assessment?.matchedTemplates.filter(
|
|
814
|
-
(c) =>
|
|
855
|
+
(c) => V(c.templateId)
|
|
815
856
|
) ?? [], o = i.map((c) => `${c.templateDescription}`);
|
|
816
857
|
if (s?.agentId !== "solutionBuilder" || s.id !== n) {
|
|
817
858
|
const c = {
|
|
818
859
|
agentId: "solutionBuilder",
|
|
819
860
|
id: n,
|
|
820
861
|
kind: "singleSelection",
|
|
821
|
-
message:
|
|
862
|
+
message: h("selectTemplatePrompt", e),
|
|
822
863
|
metadata: [...o]
|
|
823
864
|
};
|
|
824
865
|
throw new ne(c);
|
|
@@ -827,19 +868,19 @@ Description: ${e.description}`).join(`
|
|
|
827
868
|
return {
|
|
828
869
|
selectedTemplate: (l >= 0 ? i[l] : void 0)?.templateId ?? i[0]?.templateId ?? null
|
|
829
870
|
};
|
|
830
|
-
},
|
|
831
|
-
await
|
|
832
|
-
const s = t.agentExecutionContext.userRequest, n = tt(t.agentExecutionContext.messages) || s, i = await
|
|
871
|
+
}, Pt = async (t, e) => {
|
|
872
|
+
await w({ text: h("searchingExistingSolutions", e) }, e);
|
|
873
|
+
const s = t.agentExecutionContext.userRequest, n = tt(t.agentExecutionContext.messages) || s, i = await ve(e);
|
|
833
874
|
if (!i)
|
|
834
875
|
return console.warn("Solutions Search: failed to load solution embeddings cache; skipping search."), { existingMatches: [] };
|
|
835
876
|
if (!i.length)
|
|
836
877
|
return { existingMatches: [] };
|
|
837
|
-
const [o] = await
|
|
878
|
+
const [o] = await Be([n]), a = i.map((d) => ({
|
|
838
879
|
solution: d,
|
|
839
880
|
score: Ne(o, d.embedding)
|
|
840
881
|
}));
|
|
841
882
|
a.sort((d, g) => g.score - d.score);
|
|
842
|
-
const l = a.slice(0,
|
|
883
|
+
const l = a.slice(0, yt);
|
|
843
884
|
if (!l.length)
|
|
844
885
|
return { existingMatches: [] };
|
|
845
886
|
const u = l.map(({ solution: d }) => `${d.title}
|
|
@@ -847,21 +888,21 @@ Snippet: ${d.snippet}
|
|
|
847
888
|
Description: ${d.description}`).join(`
|
|
848
889
|
|
|
849
890
|
`), c = t.agentExecutionContext.messages.slice(-11);
|
|
850
|
-
return { existingMatches: (await
|
|
851
|
-
promptText: await y(
|
|
891
|
+
return { existingMatches: (await _({
|
|
892
|
+
promptText: await y(I, "findExistingSolution"),
|
|
852
893
|
modelTier: "fast",
|
|
853
894
|
temperature: 0,
|
|
854
|
-
schema:
|
|
895
|
+
schema: mt,
|
|
855
896
|
messages: c,
|
|
856
897
|
inputVariables: { query: s, candidates: u }
|
|
857
898
|
})).matchedTitles.map((d) => l.find(({ solution: g }) => g.title === d)).filter((d) => d !== void 0) };
|
|
858
|
-
},
|
|
899
|
+
}, Ut = (t, e) => {
|
|
859
900
|
const { existingMatches: s } = t, { hitlResponse: n } = e.configurable, i = `confirmExistingSolution:${s[0].solution.id}`;
|
|
860
901
|
if (n?.agentId !== "solutionBuilder" || n.id !== i) {
|
|
861
|
-
s.length === 1 ?
|
|
862
|
-
const u =
|
|
863
|
-
|
|
864
|
-
|
|
902
|
+
s.length === 1 ? ce(s[0].solution.id) : le(s);
|
|
903
|
+
const u = h("existingSolutionMatch", e), c = [
|
|
904
|
+
h("continueBuildingYes", e),
|
|
905
|
+
h("continueBuildingNo", e)
|
|
865
906
|
], m = {
|
|
866
907
|
agentId: "solutionBuilder",
|
|
867
908
|
id: i,
|
|
@@ -871,95 +912,107 @@ Description: ${d.description}`).join(`
|
|
|
871
912
|
};
|
|
872
913
|
throw new ne(m);
|
|
873
914
|
}
|
|
874
|
-
const o = String(n.payload ?? "").trim(), a =
|
|
915
|
+
const o = String(n.payload ?? "").trim(), a = h("continueBuildingNo", e);
|
|
875
916
|
return { continueBuilding: o !== a };
|
|
876
|
-
},
|
|
877
|
-
const s =
|
|
917
|
+
}, Ot = (t, e) => {
|
|
918
|
+
const s = h("continueBuildingDeclined", e);
|
|
878
919
|
return {
|
|
879
920
|
outputMessage: s,
|
|
880
921
|
summary: s,
|
|
881
922
|
status: "success"
|
|
882
923
|
};
|
|
883
|
-
},
|
|
884
|
-
await
|
|
924
|
+
}, we = async (t, e) => {
|
|
925
|
+
await xe(e);
|
|
885
926
|
const { currentDesign: s } = t, n = t.agentExecutionContext.userRequest;
|
|
886
|
-
await
|
|
887
|
-
let i =
|
|
888
|
-
if (i?.initialTemplate || (await
|
|
927
|
+
await w({ text: h("creatingDesign", e) }, e);
|
|
928
|
+
let i = B(t.selectedTemplate);
|
|
929
|
+
if (i?.initialTemplate || (await H(e), i = B(t.selectedTemplate)), !i?.initialTemplate)
|
|
889
930
|
throw new Error("No hydrated templates are available for solution design.");
|
|
890
|
-
const o =
|
|
931
|
+
const o = C(
|
|
891
932
|
s ?? i.initialTemplate,
|
|
892
933
|
{
|
|
893
934
|
itemId: (s ?? i.initialTemplate)?.solution?.itemId ?? null,
|
|
894
935
|
sourceBuildSolution: s?.sourceBuildSolution ?? i.initialTemplate.sourceBuildSolution,
|
|
895
936
|
params: s?.params ?? i.initialTemplate.params ?? null
|
|
896
937
|
}
|
|
897
|
-
), a = t.agentExecutionContext.messages.slice(-11), l = await
|
|
898
|
-
promptText: await y(
|
|
938
|
+
), a = t.agentExecutionContext.messages.slice(-11), l = await _({
|
|
939
|
+
promptText: await y(I, "designSolution"),
|
|
899
940
|
modelTier: "advanced",
|
|
900
941
|
temperature: 0,
|
|
901
|
-
schema:
|
|
942
|
+
schema: G,
|
|
902
943
|
messages: a,
|
|
903
944
|
inputVariables: {
|
|
904
|
-
currentDesign: JSON.stringify(
|
|
945
|
+
currentDesign: JSON.stringify(ae(o)),
|
|
905
946
|
templateInstructions: i.instructions,
|
|
906
947
|
query: n
|
|
907
948
|
}
|
|
908
|
-
}), { response: u, featureLayer: c, ...m } = l,
|
|
949
|
+
}), { response: u, featureLayer: c, ...m } = l, f = re(
|
|
909
950
|
c,
|
|
910
951
|
o.featureLayer
|
|
911
|
-
), d =
|
|
912
|
-
{ ...m, featureLayer:
|
|
952
|
+
), d = C(
|
|
953
|
+
{ ...m, featureLayer: f },
|
|
913
954
|
{
|
|
914
955
|
itemId: o?.solution?.itemId,
|
|
915
956
|
sourceBuildSolution: o.sourceBuildSolution,
|
|
916
957
|
templateId: t.selectedTemplate ?? null,
|
|
917
958
|
params: o.params ?? null
|
|
918
959
|
}
|
|
919
|
-
), g = new
|
|
960
|
+
), g = new me(d, i.initialTemplate);
|
|
920
961
|
if (!g.isValid)
|
|
921
962
|
return console.warn(
|
|
922
963
|
"[SolutionBuilder] designSolution validation failed:",
|
|
923
964
|
{ issues: g.issues, llmResponse: l }
|
|
924
965
|
), {
|
|
925
|
-
outputMessage:
|
|
966
|
+
outputMessage: h("createDesignFailed", e)
|
|
926
967
|
};
|
|
927
|
-
const A = d.sourceBuildSolution,
|
|
928
|
-
if (!
|
|
968
|
+
const A = d.sourceBuildSolution, T = he(d, A);
|
|
969
|
+
if (!T.ok) {
|
|
929
970
|
console.warn(
|
|
930
971
|
"[SolutionBuilder] designSolution Esri JSON conversion failed:",
|
|
931
|
-
{ error:
|
|
972
|
+
{ error: T.error, llmResponse: l, design: d }
|
|
932
973
|
);
|
|
933
|
-
const
|
|
974
|
+
const k = h("createDesignFailed", e);
|
|
934
975
|
return {
|
|
935
|
-
outputMessage:
|
|
936
|
-
summary:
|
|
976
|
+
outputMessage: k,
|
|
977
|
+
summary: k,
|
|
937
978
|
status: "success"
|
|
938
979
|
};
|
|
939
980
|
}
|
|
940
|
-
return
|
|
981
|
+
return ge(d), {
|
|
941
982
|
outputMessage: u,
|
|
942
983
|
summary: u,
|
|
943
984
|
status: "success",
|
|
944
985
|
currentDesign: d
|
|
945
986
|
};
|
|
946
|
-
},
|
|
987
|
+
}, zt = async (t, e) => {
|
|
947
988
|
const { currentDesign: s } = t;
|
|
948
989
|
if (!s)
|
|
949
|
-
return
|
|
990
|
+
return we(t, e);
|
|
950
991
|
const n = t.agentExecutionContext.userRequest, i = t.agentExecutionContext.messages.slice(-11);
|
|
951
|
-
await
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
992
|
+
await w({ text: h("updatingDesign", e) }, e);
|
|
993
|
+
let o;
|
|
994
|
+
try {
|
|
995
|
+
o = await _({
|
|
996
|
+
promptText: await y(I, "updateDesign"),
|
|
997
|
+
modelTier: "advanced",
|
|
998
|
+
temperature: 0,
|
|
999
|
+
schema: dt,
|
|
1000
|
+
messages: i,
|
|
1001
|
+
inputVariables: {
|
|
1002
|
+
currentDesign: JSON.stringify(oe(s)),
|
|
1003
|
+
query: n
|
|
1004
|
+
}
|
|
1005
|
+
});
|
|
1006
|
+
} catch (p) {
|
|
1007
|
+
console.warn("[SolutionBuilder] updateDesign structured prompt failed:", p);
|
|
1008
|
+
const x = h("applyChangeFailed", e);
|
|
1009
|
+
return {
|
|
1010
|
+
outputMessage: x,
|
|
1011
|
+
summary: x,
|
|
1012
|
+
status: "success"
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
1015
|
+
const { response: a, patches: l } = o;
|
|
963
1016
|
if (!l || l.length === 0)
|
|
964
1017
|
return {
|
|
965
1018
|
outputMessage: a,
|
|
@@ -970,7 +1023,7 @@ Description: ${d.description}`).join(`
|
|
|
970
1023
|
try {
|
|
971
1024
|
return JSON.parse(p);
|
|
972
1025
|
} catch {
|
|
973
|
-
const
|
|
1026
|
+
const x = p.replace(/[\u0000-\u001F]/g, (Y) => {
|
|
974
1027
|
switch (Y) {
|
|
975
1028
|
case "\b":
|
|
976
1029
|
return "\\b";
|
|
@@ -988,7 +1041,7 @@ Description: ${d.description}`).join(`
|
|
|
988
1041
|
}
|
|
989
1042
|
});
|
|
990
1043
|
try {
|
|
991
|
-
return JSON.parse(
|
|
1044
|
+
return JSON.parse(x);
|
|
992
1045
|
} catch {
|
|
993
1046
|
return p;
|
|
994
1047
|
}
|
|
@@ -998,44 +1051,44 @@ Description: ${d.description}`).join(`
|
|
|
998
1051
|
path: p.path.replace(/\/+$/, ""),
|
|
999
1052
|
...p.value != null && p.value !== "" ? { value: u(p.value) } : {},
|
|
1000
1053
|
...p.from != null && p.from !== "" ? { from: p.from } : {}
|
|
1001
|
-
}))].sort((p,
|
|
1002
|
-
|
|
1054
|
+
}))].sort((p, x) => p.op !== "remove" || x.op !== "remove" ? 0 : x.path.localeCompare(p.path, void 0, { numeric: !0 })), f = structuredClone(
|
|
1055
|
+
ae(s)
|
|
1003
1056
|
);
|
|
1004
1057
|
try {
|
|
1005
|
-
|
|
1058
|
+
Pe(f, m, !0);
|
|
1006
1059
|
} catch (p) {
|
|
1007
1060
|
console.warn(
|
|
1008
1061
|
"[SolutionBuilder] updateDesign JSON patch failed:",
|
|
1009
|
-
{ error: p, llmResponse: o, patches: m, patchTarget:
|
|
1062
|
+
{ error: p, llmResponse: o, patches: m, patchTarget: f }
|
|
1010
1063
|
);
|
|
1011
|
-
const
|
|
1064
|
+
const x = h("applyChangeFailed", e);
|
|
1012
1065
|
return {
|
|
1013
|
-
outputMessage:
|
|
1014
|
-
summary:
|
|
1066
|
+
outputMessage: x,
|
|
1067
|
+
summary: x,
|
|
1015
1068
|
status: "success"
|
|
1016
1069
|
};
|
|
1017
1070
|
}
|
|
1018
|
-
const d =
|
|
1019
|
-
{ response: "", ...
|
|
1071
|
+
const d = C(
|
|
1072
|
+
{ response: "", ...f },
|
|
1020
1073
|
{ itemId: s.solution?.itemId ?? null }
|
|
1021
|
-
), g =
|
|
1074
|
+
), g = G.safeParse(d);
|
|
1022
1075
|
if (!g.success) {
|
|
1023
1076
|
console.warn(
|
|
1024
1077
|
"[SolutionBuilder] updateDesign schema validation failed:",
|
|
1025
1078
|
{ errors: g.error.issues, llmResponse: o, patchedDesign: d }
|
|
1026
1079
|
);
|
|
1027
|
-
const p =
|
|
1080
|
+
const p = h("applyChangeFailed", e);
|
|
1028
1081
|
return {
|
|
1029
1082
|
outputMessage: p,
|
|
1030
1083
|
summary: p,
|
|
1031
1084
|
status: "success"
|
|
1032
1085
|
};
|
|
1033
1086
|
}
|
|
1034
|
-
const { response: A, featureLayer:
|
|
1035
|
-
|
|
1087
|
+
const { response: A, featureLayer: T, ...k } = g.data, Ie = re(
|
|
1088
|
+
T,
|
|
1036
1089
|
s.featureLayer
|
|
1037
|
-
),
|
|
1038
|
-
{ ...
|
|
1090
|
+
), S = C(
|
|
1091
|
+
{ ...k, featureLayer: Ie },
|
|
1039
1092
|
{
|
|
1040
1093
|
itemId: s.solution?.itemId,
|
|
1041
1094
|
sourceBuildSolution: s.sourceBuildSolution,
|
|
@@ -1043,21 +1096,21 @@ Description: ${d.description}`).join(`
|
|
|
1043
1096
|
params: s.params ?? null
|
|
1044
1097
|
}
|
|
1045
1098
|
);
|
|
1046
|
-
let
|
|
1047
|
-
if (
|
|
1099
|
+
let R = B(t.selectedTemplate);
|
|
1100
|
+
if (R?.initialTemplate || (await H(e), R = B(t.selectedTemplate)), !R?.initialTemplate)
|
|
1048
1101
|
throw new Error("No hydrated templates are available for solution design.");
|
|
1049
|
-
const q = new
|
|
1102
|
+
const q = new me(S, R.initialTemplate, !1);
|
|
1050
1103
|
if (!q.isValid) {
|
|
1051
1104
|
console.warn(
|
|
1052
1105
|
"[SolutionBuilder] updateDesign validation failed:",
|
|
1053
|
-
{ issues: q.issues, llmResponse: o, patchedDesign:
|
|
1106
|
+
{ issues: q.issues, llmResponse: o, patchedDesign: S }
|
|
1054
1107
|
);
|
|
1055
|
-
const p = await
|
|
1108
|
+
const p = await bt({
|
|
1056
1109
|
query: n,
|
|
1057
1110
|
validationIssues: q.issues,
|
|
1058
1111
|
recentMessages: i,
|
|
1059
|
-
fallbackMessage:
|
|
1060
|
-
promptModules:
|
|
1112
|
+
fallbackMessage: h("applyChangeFailed", e),
|
|
1113
|
+
promptModules: I
|
|
1061
1114
|
});
|
|
1062
1115
|
return {
|
|
1063
1116
|
outputMessage: p,
|
|
@@ -1065,58 +1118,58 @@ Description: ${d.description}`).join(`
|
|
|
1065
1118
|
status: "success"
|
|
1066
1119
|
};
|
|
1067
1120
|
}
|
|
1068
|
-
const
|
|
1121
|
+
const Ce = S.sourceBuildSolution, Q = he(S, Ce);
|
|
1069
1122
|
if (!Q.ok) {
|
|
1070
1123
|
console.warn(
|
|
1071
1124
|
"[SolutionBuilder] updateDesign Esri JSON conversion failed:",
|
|
1072
|
-
{ error: Q.error, llmResponse: o, design:
|
|
1125
|
+
{ error: Q.error, llmResponse: o, design: S }
|
|
1073
1126
|
);
|
|
1074
|
-
const p =
|
|
1127
|
+
const p = h("applyChangeFailed", e);
|
|
1075
1128
|
return {
|
|
1076
1129
|
outputMessage: p,
|
|
1077
1130
|
summary: p,
|
|
1078
1131
|
status: "success"
|
|
1079
1132
|
};
|
|
1080
1133
|
}
|
|
1081
|
-
return
|
|
1134
|
+
return ge(S), {
|
|
1082
1135
|
outputMessage: a,
|
|
1083
1136
|
summary: a,
|
|
1084
1137
|
status: "success",
|
|
1085
|
-
currentDesign:
|
|
1138
|
+
currentDesign: S
|
|
1086
1139
|
};
|
|
1087
|
-
},
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
}).addConditionalEdges("
|
|
1091
|
-
|
|
1140
|
+
}, jt = (t) => t.currentDesign !== null ? "assessUpdateRequest" : "assessBuildRequest", Jt = (t) => !t.updateAssessment || !t.updateAssessment.isValidUpdate ? "invalidUpdateExit" : "updateDesign", Gt = (t) => !t.assessment || !t.assessment.isValidUseCase ? "invalidBuildExit" : !t.selectedTemplate && t.assessment.matchedTemplates.length > 1 ? "selectTemplateHIL" : "findExistingSolutions", Vt = (t) => t.existingMatches.length > 0 ? "confirmContinueBuildingHIL" : "designSolution", Ht = (t) => t.continueBuilding === !1 ? "declineContinueBuildingExit" : "designSolution", Wt = () => new O(Dt).addNode("syncCurrentDesignFromContext", Ft).addNode("assessBuildRequest", $t).addNode("assessUpdateRequest", Bt).addNode("invalidBuildExit", Mt).addNode("invalidUpdateExit", Nt).addNode("selectTemplateHIL", qt).addNode("findExistingSolutions", Pt).addNode("confirmContinueBuildingHIL", Ut).addNode("declineContinueBuildingExit", Ot).addNode("designSolution", we).addNode("updateDesign", zt).addEdge(z, "syncCurrentDesignFromContext").addConditionalEdges("syncCurrentDesignFromContext", jt, {
|
|
1141
|
+
assessUpdateRequest: "assessUpdateRequest",
|
|
1142
|
+
assessBuildRequest: "assessBuildRequest"
|
|
1143
|
+
}).addConditionalEdges("assessUpdateRequest", Jt, {
|
|
1144
|
+
invalidUpdateExit: "invalidUpdateExit",
|
|
1145
|
+
updateDesign: "updateDesign"
|
|
1146
|
+
}).addConditionalEdges("assessBuildRequest", Gt, {
|
|
1147
|
+
invalidBuildExit: "invalidBuildExit",
|
|
1092
1148
|
selectTemplateHIL: "selectTemplateHIL",
|
|
1093
1149
|
findExistingSolutions: "findExistingSolutions"
|
|
1094
|
-
}).addEdge("
|
|
1150
|
+
}).addEdge("invalidBuildExit", v).addEdge("invalidUpdateExit", v).addEdge("selectTemplateHIL", "findExistingSolutions").addConditionalEdges("findExistingSolutions", Vt, {
|
|
1095
1151
|
confirmContinueBuildingHIL: "confirmContinueBuildingHIL",
|
|
1096
1152
|
designSolution: "designSolution"
|
|
1097
|
-
}).addConditionalEdges("confirmContinueBuildingHIL",
|
|
1153
|
+
}).addConditionalEdges("confirmContinueBuildingHIL", Ht, {
|
|
1098
1154
|
declineContinueBuildingExit: "declineContinueBuildingExit",
|
|
1099
1155
|
designSolution: "designSolution"
|
|
1100
|
-
}).addEdge("declineContinueBuildingExit",
|
|
1101
|
-
await y(
|
|
1102
|
-
const
|
|
1103
|
-
tool:
|
|
1104
|
-
confidence:
|
|
1105
|
-
rationale:
|
|
1106
|
-
|
|
1107
|
-
}), P = /* @__PURE__ */ Object.assign({
|
|
1156
|
+
}).addEdge("declineContinueBuildingExit", v).addEdge("designSolution", v).addEdge("updateDesign", v);
|
|
1157
|
+
await y(I, "description");
|
|
1158
|
+
const Kt = D.object({
|
|
1159
|
+
tool: D.enum(["explorer", "builder", "other"]).describe("The selected tool based on the user's query."),
|
|
1160
|
+
confidence: D.number().min(0).max(1).describe("A confidence score (0.00–1.00)."),
|
|
1161
|
+
rationale: D.string().min(1).describe("A brief rationale for the tool choice (≤140 characters)")
|
|
1162
|
+
}), W = /* @__PURE__ */ Object.assign({
|
|
1108
1163
|
"./prompts/assistantResponse.md": () => import("../../chunks/assistantResponse.js").then((t) => t.default),
|
|
1109
1164
|
"./prompts/classifyIntent.md": () => import("../../chunks/classifyIntent.js").then((t) => t.default),
|
|
1110
|
-
"./prompts/description.md": () => import("../../chunks/description.js").then((t) => t.default)
|
|
1111
|
-
"./prompts/responseOptionsBuilderExclusion.md": () => import("../../chunks/responseOptionsBuilderExclusion.js").then((t) => t.default),
|
|
1112
|
-
"./prompts/responseOptionsDefault.md": () => import("../../chunks/responseOptionsDefault.js").then((t) => t.default)
|
|
1165
|
+
"./prompts/description.md": () => import("../../chunks/description.js").then((t) => t.default)
|
|
1113
1166
|
}), K = () => {
|
|
1114
1167
|
const t = new CustomEvent("assistantProcessing", {
|
|
1115
1168
|
detail: !1
|
|
1116
1169
|
});
|
|
1117
1170
|
window.dispatchEvent(t);
|
|
1118
|
-
},
|
|
1119
|
-
...
|
|
1171
|
+
}, Se = b.Root({
|
|
1172
|
+
...j(),
|
|
1120
1173
|
selectedTool: b({
|
|
1121
1174
|
reducer: (t, e) => e ?? null,
|
|
1122
1175
|
default: () => null
|
|
@@ -1124,14 +1177,10 @@ const Gt = L.object({
|
|
|
1124
1177
|
intentRationale: b({
|
|
1125
1178
|
reducer: (t, e) => e ?? null,
|
|
1126
1179
|
default: () => null
|
|
1127
|
-
}),
|
|
1128
|
-
builderExclusion: b({
|
|
1129
|
-
reducer: (t, e) => e ?? !1,
|
|
1130
|
-
default: () => !1
|
|
1131
1180
|
})
|
|
1132
|
-
}),
|
|
1133
|
-
const s =
|
|
1134
|
-
await
|
|
1181
|
+
}), Qt = async (t, e) => {
|
|
1182
|
+
const s = N(e);
|
|
1183
|
+
await w(
|
|
1135
1184
|
{ text: s?.builderMessages.understandingRequest },
|
|
1136
1185
|
e
|
|
1137
1186
|
);
|
|
@@ -1143,71 +1192,67 @@ const Gt = L.object({
|
|
|
1143
1192
|
} catch {
|
|
1144
1193
|
a = !1;
|
|
1145
1194
|
}
|
|
1146
|
-
const l = await y(
|
|
1195
|
+
const l = await y(W, "classifyIntent"), u = await _({
|
|
1147
1196
|
promptText: l,
|
|
1148
1197
|
modelTier: "advanced",
|
|
1149
1198
|
temperature: 0,
|
|
1150
|
-
schema:
|
|
1199
|
+
schema: Kt,
|
|
1151
1200
|
messages: i,
|
|
1152
1201
|
inputVariables: { query: n, activeSolutionDesign: a }
|
|
1153
1202
|
});
|
|
1154
1203
|
return {
|
|
1155
1204
|
selectedTool: u.tool,
|
|
1156
|
-
intentRationale: u.rationale
|
|
1157
|
-
builderExclusion: u.builderExclusion
|
|
1205
|
+
intentRationale: u.rationale
|
|
1158
1206
|
};
|
|
1159
|
-
},
|
|
1207
|
+
}, Yt = async (t, e) => {
|
|
1160
1208
|
const n = await Ke().compile().invoke(t, e);
|
|
1161
1209
|
return K(), n;
|
|
1162
|
-
},
|
|
1163
|
-
const n = await
|
|
1210
|
+
}, Xt = async (t, e) => {
|
|
1211
|
+
const n = await Wt().compile().invoke(t, e);
|
|
1164
1212
|
return K(), n;
|
|
1165
|
-
},
|
|
1166
|
-
const s =
|
|
1167
|
-
await
|
|
1213
|
+
}, Zt = async (t, e) => {
|
|
1214
|
+
const s = N(e), n = t.agentExecutionContext.userRequest, i = t.intentRationale ?? "No rationale available.";
|
|
1215
|
+
await w(
|
|
1168
1216
|
{ text: s?.executingSolutionsAssistantAgent },
|
|
1169
1217
|
e
|
|
1170
1218
|
);
|
|
1171
|
-
const
|
|
1172
|
-
|
|
1173
|
-
o
|
|
1174
|
-
), u = t.agentExecutionContext.messages.slice(-11), c = await Pe({
|
|
1175
|
-
promptText: a,
|
|
1219
|
+
const o = await y(W, "assistantResponse"), a = t.agentExecutionContext.messages.slice(-11), l = await qe({
|
|
1220
|
+
promptText: o,
|
|
1176
1221
|
modelTier: "advanced",
|
|
1177
1222
|
temperature: 0,
|
|
1178
|
-
messages:
|
|
1179
|
-
inputVariables: { query: n, rationale: i
|
|
1223
|
+
messages: a,
|
|
1224
|
+
inputVariables: { query: n, rationale: i }
|
|
1180
1225
|
});
|
|
1181
1226
|
return K(), {
|
|
1182
|
-
outputMessage:
|
|
1183
|
-
summary:
|
|
1227
|
+
outputMessage: l,
|
|
1228
|
+
summary: l,
|
|
1184
1229
|
status: "success"
|
|
1185
1230
|
};
|
|
1186
|
-
},
|
|
1231
|
+
}, es = (t) => t.selectedTool ?? "other", ts = () => new O(Se).addNode("classifyIntent", Qt).addNode("routeToExplorer", Yt).addNode("routeToBuilder", Xt).addNode("assistantResponse", Zt).addEdge(z, "classifyIntent").addConditionalEdges("classifyIntent", es, {
|
|
1187
1232
|
explorer: "routeToExplorer",
|
|
1188
1233
|
builder: "routeToBuilder",
|
|
1189
1234
|
other: "assistantResponse"
|
|
1190
|
-
}).addEdge("routeToExplorer",
|
|
1235
|
+
}).addEdge("routeToExplorer", v).addEdge("routeToBuilder", v).addEdge("assistantResponse", v), ss = await y(W, "description"), ns = {
|
|
1191
1236
|
id: "solutionsAssistant",
|
|
1192
1237
|
name: "Solutions Assistant Agent",
|
|
1193
|
-
description:
|
|
1194
|
-
createGraph:
|
|
1195
|
-
workspace:
|
|
1196
|
-
},
|
|
1197
|
-
class
|
|
1238
|
+
description: ss,
|
|
1239
|
+
createGraph: ts,
|
|
1240
|
+
workspace: Se
|
|
1241
|
+
}, is = "https://links.esri.com/solutions/agol-organizational-account", os = "https://links.esri.com/solutions/configure-assistants";
|
|
1242
|
+
class as extends ke {
|
|
1198
1243
|
constructor() {
|
|
1199
1244
|
super(), this.open = !1, this.userFirstName = "", this.builderVisible = !1, this.hasActiveBuilderDesign = !1, this._conversationId = void 0, this._orgSettings = {
|
|
1200
1245
|
aiAssistantsEnabled: !1,
|
|
1201
1246
|
blockBetaApps: !0,
|
|
1202
1247
|
colocateCompute: !1
|
|
1203
|
-
}, this._suggestedPrompts = [], this._hasInteracted = !1, this._isMobile = window.innerWidth <= 800, this._translations =
|
|
1204
|
-
context:
|
|
1248
|
+
}, this._suggestedPrompts = [], this._hasInteracted = !1, this._isMobile = window.innerWidth <= 800, this._translations = Te({ name: "arcgis-solutions-assistant", blocking: !0 }), this._builderWidth = 48, this._solutionDesignJson = '{ "solution": null }', this._isAssistantBusy = !1, this._isBuilderBusy = !1, this._preChatCheck = !1, this._assistantRef = $e(), this._configContextConsumer = ee({
|
|
1249
|
+
context: Le,
|
|
1205
1250
|
subscribe: !0,
|
|
1206
1251
|
callback: (e) => {
|
|
1207
1252
|
e?.portalURL && (te.portalUrl = e.portalURL), e?.userSession && !this.userFirstName && this._loadUserFirstName(), e?.authentication?.PortalSubset?.orgSettings && (this._orgSettings = e?.authentication?.PortalSubset?.orgSettings);
|
|
1208
1253
|
}
|
|
1209
1254
|
}), this._builderDesignContextConsumer = ee({
|
|
1210
|
-
context:
|
|
1255
|
+
context: Re,
|
|
1211
1256
|
subscribe: !0,
|
|
1212
1257
|
callback: (e) => {
|
|
1213
1258
|
e?.design && (this._solutionDesignJson = JSON.stringify(e.design, null, 2));
|
|
@@ -1259,19 +1304,19 @@ class ss extends ke {
|
|
|
1259
1304
|
this._loadUserFirstName();
|
|
1260
1305
|
}
|
|
1261
1306
|
willUpdate(e) {
|
|
1262
|
-
e.has("open") && this.open && window.dispatchEvent(new CustomEvent("openAssistant")), this._configContextConsumer.value?.authentication && this._configContextConsumer.value?.userSession?.token && (this._preChatCheck || (
|
|
1307
|
+
e.has("open") && this.open && window.dispatchEvent(new CustomEvent("openAssistant")), this._configContextConsumer.value?.authentication && this._configContextConsumer.value?.userSession?.token && (this._preChatCheck || (ue(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;
|
|
1263
1308
|
}
|
|
1264
1309
|
_renderNoSign() {
|
|
1265
|
-
return
|
|
1310
|
+
return E`<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>`;
|
|
1266
1311
|
}
|
|
1267
1312
|
_renderNoPermission() {
|
|
1268
|
-
return
|
|
1313
|
+
return E`<calcite-notice open scale=m icon=effects kind=info><div slot=title>${this._translations.noPermissionTitle}</div><div slot=message class="padding-top-10">${Ae(this._translations.noPermissionMessage.replace("{{orgUrl}}", is).replace("{{configAI}}", os))}</div></calcite-notice>`;
|
|
1269
1314
|
}
|
|
1270
1315
|
render() {
|
|
1271
1316
|
let e = this._suggestedPrompts.length > 0 ? this._suggestedPrompts : this._hasInteracted ? [] : Object.values(this._translations.defaultFollowUpQuestions);
|
|
1272
|
-
return this._suggestedPrompts.length > 0 ? e = this._suggestedPrompts : this._hasInteracted || (e = [...Object.values(this._translations.defaultFollowUpQuestions)]),
|
|
1317
|
+
return this._suggestedPrompts.length > 0 ? e = this._suggestedPrompts : this._hasInteracted || (e = [...Object.values(this._translations.defaultFollowUpQuestions)]), E`<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 ? E`${!this._isMobile && E`<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=${() => {
|
|
1273
1318
|
window.dispatchEvent(new CustomEvent("toggleSolutionBuilder"));
|
|
1274
|
-
}} scale=m slot=header-actions-end></calcite-action>` || ""}${!this._isMobile &&
|
|
1319
|
+
}} scale=m slot=header-actions-end></calcite-action>` || ""}${!this._isMobile && E`<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) => {
|
|
1275
1320
|
console.log("arcgis submit: ", s.detail), this._suggestedPrompts = [], e = [], this._hasInteracted = !0;
|
|
1276
1321
|
const n = Date.now(), i = Fe(n), o = s.detail || "Unknown";
|
|
1277
1322
|
this._telemetry?.logEvent({
|
|
@@ -1288,9 +1333,9 @@ class ss extends ke {
|
|
|
1288
1333
|
this._queryElementInShadowDom(this.el, ".footer-container", !1);
|
|
1289
1334
|
}} @arcgisInterruptSubmit=${() => {
|
|
1290
1335
|
this._queryElementInShadowDom(this.el, ".footer-container", !1);
|
|
1291
|
-
}} ${
|
|
1336
|
+
}} ${Me(this._assistantRef)}><calcite-button appearance=transparent id=newChatButton icon-start=speech-bubble-plus kind=neutral .label=${this._translations.tooltips.newChat} @click=${() => {
|
|
1292
1337
|
this._conversationId = void 0, this._suggestedPrompts = [], this._hasInteracted = !1, this._assistantRef.value?.clearChatHistory(), this._queryElementInShadowDom(this.el, ".footer-container", !1);
|
|
1293
|
-
}} round scale=m slot=entry-actions-start>${this._translations.tooltips.newChat}</calcite-button><arcgis-assistant-agent .agent=${
|
|
1338
|
+
}} round scale=m slot=entry-actions-start>${this._translations.tooltips.newChat}</calcite-button><arcgis-assistant-agent .agent=${ns} .context=${{
|
|
1294
1339
|
token: this._configContextConsumer.value?.userSession?.token,
|
|
1295
1340
|
configContext: this._configContextConsumer.value,
|
|
1296
1341
|
convoId: this._conversationId,
|
|
@@ -1329,8 +1374,8 @@ class ss extends ke {
|
|
|
1329
1374
|
const u = /Agent picked:\s*(.*?)\s*(?:\\n|\r?\n)\s*Task Assigned:\s*([\s\S]*)$/i, c = l.match(u);
|
|
1330
1375
|
if (!c)
|
|
1331
1376
|
return { agentPicked: null, taskAssigned: null, userMessage: a };
|
|
1332
|
-
const m = c[1].trim(),
|
|
1333
|
-
return { agentPicked: m, taskAssigned:
|
|
1377
|
+
const m = c[1].trim(), f = c[2].trim();
|
|
1378
|
+
return { agentPicked: m, taskAssigned: f, userMessage: a };
|
|
1334
1379
|
}
|
|
1335
1380
|
_emitItemIdFromAI(e) {
|
|
1336
1381
|
const s = new CustomEvent("solutionIDFromAssistant", {
|
|
@@ -1363,7 +1408,7 @@ class ss extends ke {
|
|
|
1363
1408
|
});
|
|
1364
1409
|
}
|
|
1365
1410
|
}
|
|
1366
|
-
|
|
1411
|
+
_e("arcgis-solutions-assistant", as);
|
|
1367
1412
|
export {
|
|
1368
|
-
|
|
1413
|
+
as as ArcgisSolutionsAssistant
|
|
1369
1414
|
};
|