@esri/solutions-components 5.1.0-next.167 → 5.1.0-next.169
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/{MXF4BYLT.js → 6F7QJJQO.js} +1 -1
- package/dist/cdn/6KO7AYJN.js +2 -0
- package/dist/cdn/{TSDKMOES.js → CONTIW5Q.js} +4 -4
- package/dist/cdn/{YPBSKBT2.js → D6U5SMQX.js} +1 -1
- package/dist/cdn/{2LCG2XWX.js → ESJJVBZM.js} +1 -1
- package/dist/cdn/{ZWL4JFKS.js → IZSQYFWM.js} +1 -1
- package/dist/cdn/{BYOO7TWU.js → JINR6G2D.js} +1 -1
- package/dist/cdn/{ZSTC2DJY.js → MBT2S4J5.js} +1 -1
- package/dist/cdn/{CVHZAZLS.js → RLMMQ5UC.js} +1 -1
- package/dist/cdn/{UOQSRV3X.js → S26SZJC7.js} +3 -2
- package/dist/cdn/{LXGPZJIZ.js → S7HFWITF.js} +1 -1
- package/dist/cdn/{VXGLGWIF.js → SNA7NRRQ.js} +3 -3
- package/dist/cdn/{HLCHUP24.js → WRWWRMHZ.js} +3 -3
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ar.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.bg.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.bs.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ca.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.cs.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.da.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.de.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.el.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.es.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.et.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.fi.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.fr.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.he.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.hr.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.hu.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.id.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.it.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ja.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ko.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.lt.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.lv.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.nl.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.no.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.pl.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.pt-BR.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.pt-PT.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ro.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ru.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.sk.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.sl.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.sr.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.sv.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.th.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.tr.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.uk.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.vi.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.zh-CN.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.zh-HK.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.zh-TW.json +1 -1
- package/dist/cdn/assets/solution-details-card/t9n/messages.ar.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ar.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.bg.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.bs.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ca.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.cs.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.da.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.de.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.el.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.es.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.et.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.fi.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.fr.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.he.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.hr.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.hu.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.id.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.it.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ja.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ko.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.lt.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.lv.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.nl.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.no.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.pl.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.pt-BR.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.pt-PT.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ro.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ru.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.sk.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.sl.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.sr.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.sv.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.th.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.tr.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.uk.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.vi.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.zh-CN.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.zh-HK.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.zh-TW.json +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/assessBuildRequest.js +3 -2
- package/dist/chunks/converter.js +1 -1
- package/dist/chunks/designSolution.js +3 -3
- package/dist/chunks/updateDesign.js +1 -1
- package/dist/components/arcgis-solutions-assistant/customElement.js +307 -289
- package/dist/components/create-feature/customElement.js +63 -56
- package/dist/components/create-related-feature/customElement.js +12 -9
- 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/2NSMAAXL.js +0 -2
|
@@ -5,19 +5,19 @@ import { LitElement as De, createEvent as ae, nothing as re } from "@arcgis/lumi
|
|
|
5
5
|
import { css as Me, html as T } from "lit";
|
|
6
6
|
import { unsafeHTML as Re } from "lit/directives/unsafe-html.js";
|
|
7
7
|
import { useContextConsumer as le } from "@arcgis/lumina/context";
|
|
8
|
-
import { c as
|
|
8
|
+
import { c as Pe, b as Be } from "../../chunks/deployAppContexts.js";
|
|
9
9
|
import { T as M } from "../../chunks/interfaces.js";
|
|
10
10
|
import { m as qe } from "../../chunks/helpers.js";
|
|
11
11
|
import G from "@arcgis/core/config.js";
|
|
12
12
|
import { createRef as Ue, ref as Oe } from "lit-html/directives/ref.js";
|
|
13
|
-
import { Annotation as
|
|
14
|
-
import { createAgentRuntimeState as X, sendTraceMessage as
|
|
13
|
+
import { Annotation as b, StateGraph as K, START as W, END as A, NodeInterrupt as de } from "@langchain/langgraph/web";
|
|
14
|
+
import { createAgentRuntimeState as X, sendTraceMessage as w, invokeStructuredPrompt as $, getEmbeddings as ze, cosineSimilarity as je, invokeTextPrompt as Ge } from "@arcgis/ai-components/utils/index.js";
|
|
15
15
|
import l, { z as E } from "zod";
|
|
16
16
|
import * as Y from "@esri/arcgis-rest-portal";
|
|
17
|
-
import { applyPatch as
|
|
17
|
+
import { applyPatch as Je } from "fast-json-patch";
|
|
18
18
|
import "@langchain/core/messages";
|
|
19
19
|
import { C as pe } from "../../chunks/converter.js";
|
|
20
|
-
import { v as
|
|
20
|
+
import { v as J, b as H, S as He, h as Ve, E as Qe, g as Ke } from "../../chunks/validators.js";
|
|
21
21
|
import { invokeStructuredPrompt as We } from "@arcgis/ai-orchestrator";
|
|
22
22
|
import { t as me, g as q, c as he, r as ge, d as F } from "../../chunks/templates.js";
|
|
23
23
|
import Xe from "@arcgis/core/portal/Portal.js";
|
|
@@ -87,14 +87,14 @@ function st(s) {
|
|
|
87
87
|
function it(s, e) {
|
|
88
88
|
const t = [];
|
|
89
89
|
return (e?.configurable?.context?.configContext.allCards ?? []).forEach((n) => {
|
|
90
|
-
const
|
|
91
|
-
if (!
|
|
90
|
+
const a = n.title;
|
|
91
|
+
if (!a)
|
|
92
92
|
return;
|
|
93
|
-
const
|
|
93
|
+
const o = new RegExp(`(?<![\\p{L}\\p{N}])${a}(?![\\p{L}\\p{N}])`, "giu");
|
|
94
94
|
let r = !1;
|
|
95
|
-
s = s.replace(
|
|
95
|
+
s = s.replace(o, (c, d, h) => {
|
|
96
96
|
const y = h.slice(0, d);
|
|
97
|
-
return /<img[^>]*alt\s*=\s*["'][^"']*$/i.test(y) ? c : (r = !0, `<a href="" target="solutionId:${n.deployCommonId}">${
|
|
97
|
+
return /<img[^>]*alt\s*=\s*["'][^"']*$/i.test(y) ? c : (r = !0, `<a href="" target="solutionId:${n.deployCommonId}">${a}</a>`);
|
|
98
98
|
}), r && t.push({
|
|
99
99
|
solution: {
|
|
100
100
|
title: n.title,
|
|
@@ -131,38 +131,38 @@ async function at(s, e) {
|
|
|
131
131
|
if (!i || n.length <= 1 || i === "explorer")
|
|
132
132
|
return t;
|
|
133
133
|
try {
|
|
134
|
-
const
|
|
135
|
-
promptText:
|
|
134
|
+
const a = await v(be, "transformQuery"), o = await $({
|
|
135
|
+
promptText: a,
|
|
136
136
|
modelTier: "advanced",
|
|
137
137
|
temperature: 0,
|
|
138
138
|
schema: et,
|
|
139
139
|
messages: n.slice(-11),
|
|
140
140
|
inputVariables: { query: t, lastTurnAgent: i }
|
|
141
141
|
});
|
|
142
|
-
if (
|
|
143
|
-
return console.debug(`Rephrased query from "${t}" to "${
|
|
142
|
+
if (o.needsContext && o.rewrittenQuery.trim())
|
|
143
|
+
return console.debug(`Rephrased query from "${t}" to "${o.rewrittenQuery.trim()}"`), o.rewrittenQuery.trim();
|
|
144
144
|
} catch {
|
|
145
145
|
}
|
|
146
146
|
return t;
|
|
147
147
|
}
|
|
148
|
-
const rt =
|
|
148
|
+
const rt = b.Root({
|
|
149
149
|
// Provides agentExecutionContext, outputMessage, summary, and status
|
|
150
150
|
// channels with the orchestrator's standard reducers/defaults so the
|
|
151
151
|
// sub-agent reports back through the same shape the orchestrator
|
|
152
152
|
// persists into priorSteps.
|
|
153
153
|
...X(),
|
|
154
|
-
solutionResponse:
|
|
154
|
+
solutionResponse: b({
|
|
155
155
|
reducer: (s, e) => e ?? null,
|
|
156
156
|
default: () => null
|
|
157
157
|
}),
|
|
158
|
-
documentSkillUrl:
|
|
158
|
+
documentSkillUrl: b({
|
|
159
159
|
reducer: (s, e) => e ?? null,
|
|
160
160
|
default: () => null
|
|
161
161
|
}),
|
|
162
162
|
// Persisted across turns via the graph checkpointer so follow-up questions
|
|
163
163
|
// continue the same service conversation. Null on the very first interaction
|
|
164
164
|
// or after messages are cleared.
|
|
165
|
-
conversationId:
|
|
165
|
+
conversationId: b({
|
|
166
166
|
reducer: (s, e) => e ?? s,
|
|
167
167
|
default: () => null
|
|
168
168
|
})
|
|
@@ -170,7 +170,7 @@ const rt = x.Root({
|
|
|
170
170
|
if (!s) return;
|
|
171
171
|
const n = xe(s);
|
|
172
172
|
if (!n) return;
|
|
173
|
-
const
|
|
173
|
+
const o = { context: {
|
|
174
174
|
kind: "DocAIAssistantRequest",
|
|
175
175
|
filters: {
|
|
176
176
|
products: "ArcGIS Solutions",
|
|
@@ -180,20 +180,20 @@ const rt = x.Root({
|
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
} };
|
|
183
|
-
i && (
|
|
183
|
+
i && (o.conversationId = i), Q(o, n, e ?? "");
|
|
184
184
|
}, ct = async (s, e) => {
|
|
185
185
|
if (ce(e))
|
|
186
186
|
return {};
|
|
187
187
|
const t = U(e), i = s.documentSkillUrl;
|
|
188
188
|
let n = [];
|
|
189
|
-
const
|
|
190
|
-
await
|
|
189
|
+
const a = await at(s, e);
|
|
190
|
+
await w(
|
|
191
191
|
{ text: t.agentProgress.explorerAgentSearching },
|
|
192
192
|
e
|
|
193
193
|
);
|
|
194
|
-
let
|
|
194
|
+
let o = await Q(
|
|
195
195
|
{
|
|
196
|
-
message:
|
|
196
|
+
message: a,
|
|
197
197
|
conversationId: e?.configurable?.context?.convoId ?? void 0,
|
|
198
198
|
context: {
|
|
199
199
|
kind: "DocAIAssistantRequest",
|
|
@@ -209,13 +209,13 @@ const rt = x.Root({
|
|
|
209
209
|
i,
|
|
210
210
|
e?.configurable?.context?.token ?? ""
|
|
211
211
|
);
|
|
212
|
-
|
|
212
|
+
o.conversationId && e?.configurable?.context?.setConversationId && e.configurable.context.setConversationId(o.conversationId);
|
|
213
213
|
let r = {
|
|
214
|
-
message:
|
|
215
|
-
conversationId:
|
|
216
|
-
hasMore:
|
|
217
|
-
ackSequenceNumber:
|
|
218
|
-
inquiryId:
|
|
214
|
+
message: o.message,
|
|
215
|
+
conversationId: o.conversationId,
|
|
216
|
+
hasMore: o.hasMore,
|
|
217
|
+
ackSequenceNumber: o.sequenceNumber,
|
|
218
|
+
inquiryId: o.inquiryId
|
|
219
219
|
}, c = "";
|
|
220
220
|
const d = async (y) => {
|
|
221
221
|
const u = y.context?.results?.[0]?.reply ?? "";
|
|
@@ -231,13 +231,13 @@ const rt = x.Root({
|
|
|
231
231
|
const g = y.context?.results?.[0]?.status?.currentStatusStep;
|
|
232
232
|
if (g) {
|
|
233
233
|
let S = "";
|
|
234
|
-
g === 1 ? S = t.agentProgress.explorerAgentReading : g === 2 ? S = t.agentProgress.explorerAgentReviewing : g === 3 && (S = t.agentProgress.explorerAgentPreparing), await
|
|
234
|
+
g === 1 ? S = t.agentProgress.explorerAgentReading : g === 2 ? S = t.agentProgress.explorerAgentReviewing : g === 3 && (S = t.agentProgress.explorerAgentPreparing), await w({ text: S }, e);
|
|
235
235
|
}
|
|
236
236
|
};
|
|
237
|
-
for (await d(
|
|
237
|
+
for (await d(o); r.hasMore; ) {
|
|
238
238
|
if (ce(e))
|
|
239
239
|
return {};
|
|
240
|
-
await ot(500),
|
|
240
|
+
await ot(500), o = await Q(
|
|
241
241
|
{
|
|
242
242
|
conversationId: r.conversationId,
|
|
243
243
|
ackSequenceNumber: r.ackSequenceNumber,
|
|
@@ -246,12 +246,12 @@ const rt = x.Root({
|
|
|
246
246
|
i,
|
|
247
247
|
e?.configurable?.context?.token ?? ""
|
|
248
248
|
), r = {
|
|
249
|
-
message:
|
|
250
|
-
conversationId:
|
|
251
|
-
hasMore:
|
|
252
|
-
ackSequenceNumber:
|
|
253
|
-
inquiryId:
|
|
254
|
-
}, await d(
|
|
249
|
+
message: o.message,
|
|
250
|
+
conversationId: o.conversationId,
|
|
251
|
+
hasMore: o.hasMore,
|
|
252
|
+
ackSequenceNumber: o.sequenceNumber,
|
|
253
|
+
inquiryId: o.inquiryId
|
|
254
|
+
}, await d(o);
|
|
255
255
|
}
|
|
256
256
|
return xe(e?.configurable?.context.portal) && ve(
|
|
257
257
|
e?.configurable?.context.portal,
|
|
@@ -272,7 +272,7 @@ const rt = x.Root({
|
|
|
272
272
|
};
|
|
273
273
|
};
|
|
274
274
|
await v(be, "solutions_explorer_description");
|
|
275
|
-
const
|
|
275
|
+
const _e = (s) => {
|
|
276
276
|
if (s && Array.isArray(s.id) && s.id.length > 0)
|
|
277
277
|
return s.id[s.id.length - 1].replace("Message", "").toLowerCase();
|
|
278
278
|
if (s && typeof s._getType == "function")
|
|
@@ -283,7 +283,7 @@ const we = (s) => {
|
|
|
283
283
|
}
|
|
284
284
|
return "human";
|
|
285
285
|
}, dt = (s) => {
|
|
286
|
-
const e =
|
|
286
|
+
const e = _e(s);
|
|
287
287
|
if (s && s.kwargs)
|
|
288
288
|
return {
|
|
289
289
|
role: e,
|
|
@@ -298,10 +298,10 @@ const we = (s) => {
|
|
|
298
298
|
return s.id && (t.id = s.id), s.name && (t.name = s.name), s.additional_kwargs && (t.additional_kwargs = s.additional_kwargs), s.response_metadata && (t.response_metadata = s.response_metadata), t;
|
|
299
299
|
}
|
|
300
300
|
return { role: "human", content: String(s) };
|
|
301
|
-
}, pt = (s) =>
|
|
301
|
+
}, pt = (s) => _e(s) === "human", mt = (s, e = 3) => s.filter((t) => pt(t)).slice(-e).map(dt), ht = (s, e = " ") => mt(s).map((n) => n.content).join(e).trim(), gt = { understandingRequest: "Understanding your request...", selectTemplatePrompt: "This use case could be supported in a few different ways. Choose the option that best matches what you want to accomplish.", searchingExistingSolutions: "Searching for existing solutions...", existingSolutionMatch: "I found one or more existing solutions that match your use case. These are ready-to-use solutions that may already meet your needs and can be deployed now. Do you want to continue building your own solution?", continueBuildingYes: "Yes, I want to build a new solution", continueBuildingNo: "No, I’ll review existing solutions", continueBuildingDeclined: "Sounds good. We can focus on existing solutions. Let me know if I can help answer any questions or provide more details.", creatingDesign: "Generating solution design...", updatingDesign: "Updating solution design...", applyChangeFailed: "I wasn't able to apply that change. The design was not modified. Please try rephrasing your request.", createDesignFailed: "I wasn't able to create a solution design from that request. Please try rephrasing and try again.", discardMessage: "Are you sure you want to discard your solution?", discardForNewSolution: "I can help you build a new solution, but I will need to discard your current solution design. Do you want to continue?" }, ft = {
|
|
302
302
|
builderMessages: gt
|
|
303
303
|
};
|
|
304
|
-
class
|
|
304
|
+
class x {
|
|
305
305
|
//--------------------------------------------------------------------------
|
|
306
306
|
//
|
|
307
307
|
// Public API
|
|
@@ -319,9 +319,6 @@ class b {
|
|
|
319
319
|
static {
|
|
320
320
|
this.DESCRIPTION_MAX_LENGTH = 2048;
|
|
321
321
|
}
|
|
322
|
-
static {
|
|
323
|
-
this.SERVICE_NAME_MAX_LENGTH = 100;
|
|
324
|
-
}
|
|
325
322
|
static {
|
|
326
323
|
this.FIELD_NAME_MAX_LENGTH = 31;
|
|
327
324
|
}
|
|
@@ -362,8 +359,8 @@ class b {
|
|
|
362
359
|
for (const n of this.response.solution.strings) {
|
|
363
360
|
if (n.value)
|
|
364
361
|
continue;
|
|
365
|
-
const
|
|
366
|
-
this.newDesign &&
|
|
362
|
+
const a = t.get(n.key)?.value;
|
|
363
|
+
this.newDesign && a ? (n.value = a, this._logAutoFix(`String key '${n.key}' had no value. Auto-fixed by restoring the template value.`)) : this._logIssue(`String key '${n.key}' has no value in the design. It must be populated.`);
|
|
367
364
|
}
|
|
368
365
|
}
|
|
369
366
|
/**
|
|
@@ -395,23 +392,23 @@ class b {
|
|
|
395
392
|
* any other user-edited properties on the item.
|
|
396
393
|
*/
|
|
397
394
|
_reconcileItems() {
|
|
398
|
-
const e = new Set(this.template.items.map((
|
|
395
|
+
const e = new Set(this.template.items.map((o) => o.id)), t = new Set(this.response.items.map((o) => o.id)), i = [...t].filter((o) => !e.has(o)), n = [...e].filter((o) => !t.has(o));
|
|
399
396
|
if (e.size === t.size && i.length === 1 && n.length === 1) {
|
|
400
|
-
const
|
|
397
|
+
const o = i[0], r = n[0], c = this.response.items.find((d) => d.id === o);
|
|
401
398
|
if (c) {
|
|
402
|
-
c.id = r, this._logAutoFix(`Item id '${
|
|
399
|
+
c.id = r, this._logAutoFix(`Item id '${o}' did not match the template id '${r}'. Auto-fixed in place.`);
|
|
403
400
|
return;
|
|
404
401
|
}
|
|
405
402
|
}
|
|
406
|
-
i.length && (this.response.items = this.response.items.filter((
|
|
407
|
-
const
|
|
408
|
-
if (
|
|
403
|
+
i.length && (this.response.items = this.response.items.filter((o) => e.has(o.id)), this._logAutoFix(`Removed items not present in the template: ${i.join(", ")}.`));
|
|
404
|
+
const a = this.template.items.filter((o) => !t.has(o.id));
|
|
405
|
+
if (a.length) {
|
|
409
406
|
this.response.items = [
|
|
410
|
-
...
|
|
407
|
+
...a.map((o) => ({ ...o })),
|
|
411
408
|
...this.response.items
|
|
412
409
|
];
|
|
413
|
-
for (const
|
|
414
|
-
this._logAutoFix(`Item '${
|
|
410
|
+
for (const o of a)
|
|
411
|
+
this._logAutoFix(`Item '${o.id}' was missing from the design. Auto-fixed by adding it from the template.`);
|
|
415
412
|
}
|
|
416
413
|
}
|
|
417
414
|
/**
|
|
@@ -424,22 +421,22 @@ class b {
|
|
|
424
421
|
t.itemId = e.itemId, this._logAutoFix(`Feature Layer itemId '${i}' did not match the template. Auto-fixed to '${e.itemId}'.`);
|
|
425
422
|
}
|
|
426
423
|
if (!e.addLayers) {
|
|
427
|
-
const i = new Set(e.layers.map((
|
|
428
|
-
if (!(i.size === n.size && [...i].every((
|
|
424
|
+
const i = new Set(e.layers.map((a) => a.id)), n = new Set(t.layers.map((a) => a.id));
|
|
425
|
+
if (!(i.size === n.size && [...i].every((a) => n.has(a))))
|
|
429
426
|
this._logIssue(`Feature Layer '${e.itemId}' had its layer ids altered.`);
|
|
430
427
|
else
|
|
431
|
-
for (const
|
|
432
|
-
if (
|
|
433
|
-
const r = t.layers.find((c) => c.id ===
|
|
434
|
-
if (r && r.type !==
|
|
428
|
+
for (const a of e.layers) {
|
|
429
|
+
if (a.type) {
|
|
430
|
+
const r = t.layers.find((c) => c.id === a.id);
|
|
431
|
+
if (r && r.type !== a.type)
|
|
435
432
|
if (this.newDesign) {
|
|
436
433
|
const c = r.type;
|
|
437
|
-
r.type =
|
|
434
|
+
r.type = a.type, this._logAutoFix(`Layer '${a.id}' type '${c}' is immutable. Auto-fixed back to template type '${a.type}'.`);
|
|
438
435
|
} else
|
|
439
|
-
this._logIssue(`Layer '${
|
|
436
|
+
this._logIssue(`Layer '${a.id}' type '${r.type}' does not match template type '${a.type}'. This layer type is immutable.`);
|
|
440
437
|
}
|
|
441
|
-
const
|
|
442
|
-
|
|
438
|
+
const o = t.layers.find((r) => r.id === a.id);
|
|
439
|
+
o && this._validateRequiredFields(o, a);
|
|
443
440
|
}
|
|
444
441
|
}
|
|
445
442
|
}
|
|
@@ -456,12 +453,12 @@ class b {
|
|
|
456
453
|
e.requiredFields.map((n) => [n.name.toLowerCase(), n])
|
|
457
454
|
);
|
|
458
455
|
for (const n of t.requiredFields) {
|
|
459
|
-
const
|
|
460
|
-
if (!
|
|
456
|
+
const a = i.get(n.name.toLowerCase());
|
|
457
|
+
if (!a) {
|
|
461
458
|
this.newDesign ? (e.requiredFields.push({ ...n }), this._logAutoFix(`Layer '${e.name}' was missing required field '${n.name}'. Auto-fixed by re-adding it from the template.`)) : this._logIssue(`Layer '${e.name}' is missing required field '${n.name}'.`);
|
|
462
459
|
continue;
|
|
463
460
|
}
|
|
464
|
-
this._enforceRequiredFieldImmutability(e,
|
|
461
|
+
this._enforceRequiredFieldImmutability(e, a, n);
|
|
465
462
|
}
|
|
466
463
|
}
|
|
467
464
|
/**
|
|
@@ -473,8 +470,8 @@ class b {
|
|
|
473
470
|
const n = [];
|
|
474
471
|
if (t.type !== i.type && n.push("type"), (t.length ?? null) !== (i.length ?? null) && n.push("length"), this._choiceListsEqual(t.choiceList, i.choiceList) || n.push("choiceList"), !n.length)
|
|
475
472
|
return;
|
|
476
|
-
const
|
|
477
|
-
this.newDesign ? (t.type = i.type, t.length = i.length, t.choiceList = Array.isArray(i.choiceList) ? [...i.choiceList] : i.choiceList ?? null, this._logAutoFix(`Layer '${e.name}' required field '${i.name}' changed immutable ${
|
|
473
|
+
const a = n.length === 1 ? "property" : "properties";
|
|
474
|
+
this.newDesign ? (t.type = i.type, t.length = i.length, t.choiceList = Array.isArray(i.choiceList) ? [...i.choiceList] : i.choiceList ?? null, this._logAutoFix(`Layer '${e.name}' required field '${i.name}' changed immutable ${a} (${n.join(", ")}). Auto-fixed by reverting to the template.`)) : this._logIssue(`Layer '${e.name}' required field '${i.name}' changed immutable ${a} (${n.join(", ")}). These cannot be modified.`);
|
|
478
475
|
}
|
|
479
476
|
/**
|
|
480
477
|
* Set-based equality check for two choiceList values (order-insensitive),
|
|
@@ -486,8 +483,8 @@ class b {
|
|
|
486
483
|
return !0;
|
|
487
484
|
if (i === null || n === null)
|
|
488
485
|
return !1;
|
|
489
|
-
const
|
|
490
|
-
return
|
|
486
|
+
const a = new Set(i), o = new Set(n);
|
|
487
|
+
return a.size === o.size && [...a].every((r) => o.has(r));
|
|
491
488
|
}
|
|
492
489
|
//--------------------------------------------------------------------------
|
|
493
490
|
//
|
|
@@ -500,39 +497,29 @@ class b {
|
|
|
500
497
|
_validateSolutionProps() {
|
|
501
498
|
const e = this.response.solution.title ?? "", t = this.response.solution.description, i = /[/\\]/u.test(e), n = this.newDesign ? e.replace(/[/\\]/gu, "") : e;
|
|
502
499
|
this.newDesign && n !== e ? (this.response.solution.title = n, this._logAutoFix("Solution title contained forward or back slashes. Auto-fixed by removing them.")) : !this.newDesign && i && this._logIssue("Solution title contains forbidden forward or back slashes.");
|
|
503
|
-
const
|
|
504
|
-
if (
|
|
505
|
-
this.response.solution.title =
|
|
506
|
-
}, "Solution title", "Solution Title") || this._logIssue(`Solution title is invalid (${
|
|
507
|
-
const
|
|
508
|
-
|
|
500
|
+
const a = J(n);
|
|
501
|
+
if (a.isValid || this._tryFixName(a.errorType, n, (o) => {
|
|
502
|
+
this.response.solution.title = o;
|
|
503
|
+
}, "Solution title", "Solution Title") || this._logIssue(`Solution title is invalid (${a.errorType}).`), t) {
|
|
504
|
+
const o = H(t, x.DESCRIPTION_MAX_LENGTH, !0);
|
|
505
|
+
o.isValid || this._tryFixDescription(t, (r) => {
|
|
509
506
|
this.response.solution.description = r;
|
|
510
|
-
}, "Solution description") || this._logIssue(`Solution description is invalid (${
|
|
507
|
+
}, "Solution description") || this._logIssue(`Solution description is invalid (${o.errorType}).`);
|
|
511
508
|
}
|
|
512
509
|
}
|
|
513
510
|
/**
|
|
514
511
|
* Validates all items in the response.
|
|
515
512
|
*/
|
|
516
513
|
_validateItems() {
|
|
517
|
-
const e
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
} else
|
|
527
|
-
this._logIssue(`Service name '${t.title}' exceeds 100 characters.`);
|
|
528
|
-
const i = H(t.title ?? "");
|
|
529
|
-
if (i.isValid || this._tryFixName(i.errorType, t.title ?? "", (n) => {
|
|
530
|
-
t.title = n;
|
|
531
|
-
}, `Item '${t.id}' title`, "Item Title") || this._logIssue(`Item '${t.id}' title is invalid (${i.errorType}).`), t.description) {
|
|
532
|
-
const n = J(t.description, b.DESCRIPTION_MAX_LENGTH, !0);
|
|
533
|
-
n.isValid || this._tryFixDescription(t.description, (o) => {
|
|
534
|
-
t.description = o;
|
|
535
|
-
}, `Item '${t.id}' description`) || this._logIssue(`Item '${t.id}' description is invalid (${n.errorType}).`);
|
|
514
|
+
for (const e of this.response.items) {
|
|
515
|
+
const t = J(e.title ?? "");
|
|
516
|
+
if (t.isValid || this._tryFixName(t.errorType, e.title ?? "", (i) => {
|
|
517
|
+
e.title = i;
|
|
518
|
+
}, `Item '${e.id}' title`, "Item Title") || this._logIssue(`Item '${e.id}' title is invalid (${t.errorType}).`), e.description) {
|
|
519
|
+
const i = H(e.description, x.DESCRIPTION_MAX_LENGTH, !0);
|
|
520
|
+
i.isValid || this._tryFixDescription(e.description, (n) => {
|
|
521
|
+
e.description = n;
|
|
522
|
+
}, `Item '${e.id}' description`) || this._logIssue(`Item '${e.id}' description is invalid (${i.errorType}).`);
|
|
536
523
|
}
|
|
537
524
|
}
|
|
538
525
|
}
|
|
@@ -554,8 +541,8 @@ class b {
|
|
|
554
541
|
for (const i of e) {
|
|
555
542
|
const n = (i.name ?? "").toLowerCase();
|
|
556
543
|
if (t.has(n)) {
|
|
557
|
-
const
|
|
558
|
-
i.name = this._makeUniqueName(i.name ?? "Layer", t), this._logAutoFix(`Duplicate layer name '${
|
|
544
|
+
const a = i.name;
|
|
545
|
+
i.name = this._makeUniqueName(i.name ?? "Layer", t), this._logAutoFix(`Duplicate layer name '${a}'. Auto-fixed to '${i.name}'.`);
|
|
559
546
|
}
|
|
560
547
|
t.add(i.name.toLowerCase());
|
|
561
548
|
}
|
|
@@ -567,13 +554,13 @@ class b {
|
|
|
567
554
|
!t && e.typeMutable === !0 && e.type === "Table" && (this.newDesign ? (e.type = "Point", this._logAutoFix(`Layer '${e.name}' cannot be a Table. Auto-fixed to 'Point'.`)) : this._logIssue(
|
|
568
555
|
`Layer '${e.name}' cannot be a Table. It may be a Point, Line, or Polygon.`
|
|
569
556
|
));
|
|
570
|
-
const i =
|
|
557
|
+
const i = J(e.name ?? "");
|
|
571
558
|
if (i.isValid || this._tryFixName(i.errorType, e.name ?? "", (n) => {
|
|
572
559
|
e.name = n;
|
|
573
560
|
}, `Layer '${e.name}' name`, "Layer Title") || this._logIssue(`Layer '${e.name}' name is invalid (${i.errorType}).`), e.description) {
|
|
574
|
-
const n =
|
|
575
|
-
n.isValid || this._tryFixDescription(e.description, (
|
|
576
|
-
e.description =
|
|
561
|
+
const n = H(e.description, x.DESCRIPTION_MAX_LENGTH, !0);
|
|
562
|
+
n.isValid || this._tryFixDescription(e.description, (a) => {
|
|
563
|
+
e.description = a;
|
|
577
564
|
}, `Layer '${e.name}' description`) || this._logIssue(`Layer '${e.name}' description is invalid (${n.errorType}).`);
|
|
578
565
|
}
|
|
579
566
|
this._validateLayerFields(e);
|
|
@@ -590,23 +577,23 @@ class b {
|
|
|
590
577
|
_validateLayerFields(e) {
|
|
591
578
|
const t = e.systemFields ?? [];
|
|
592
579
|
this.fieldNameRegistry = new Set(
|
|
593
|
-
[...e.customFields, ...e.requiredFields, ...t].map((
|
|
580
|
+
[...e.customFields, ...e.requiredFields, ...t].map((a) => a.name.toLowerCase())
|
|
594
581
|
);
|
|
595
|
-
for (const
|
|
596
|
-
this._validateField(
|
|
582
|
+
for (const a of [...e.customFields, ...e.requiredFields])
|
|
583
|
+
this._validateField(a);
|
|
597
584
|
this.fieldNameRegistry = null;
|
|
598
|
-
const i = new Set(e.requiredFields.map((
|
|
599
|
-
for (const
|
|
600
|
-
const
|
|
601
|
-
if (n.has(
|
|
602
|
-
const r = i.has(
|
|
585
|
+
const i = new Set(e.requiredFields.map((a) => a.name.toLowerCase())), n = new Set(i);
|
|
586
|
+
for (const a of e.customFields) {
|
|
587
|
+
const o = a.name.toLowerCase();
|
|
588
|
+
if (n.has(o)) {
|
|
589
|
+
const r = i.has(o) ? "a required field name" : "another field with the same name";
|
|
603
590
|
if (this.newDesign) {
|
|
604
|
-
const c =
|
|
605
|
-
|
|
591
|
+
const c = a.name;
|
|
592
|
+
a.name = this._makeUniqueName(a.name, n), this._logAutoFix(`Layer '${e.name}' field '${c}' collided with ${r}. Auto-fixed to '${a.name}'.`);
|
|
606
593
|
} else
|
|
607
|
-
this._logIssue(`Layer '${e.name}' field '${
|
|
594
|
+
this._logIssue(`Layer '${e.name}' field '${a.name}' collides with ${r}.`);
|
|
608
595
|
}
|
|
609
|
-
n.add(
|
|
596
|
+
n.add(a.name.toLowerCase());
|
|
610
597
|
}
|
|
611
598
|
}
|
|
612
599
|
/**
|
|
@@ -615,36 +602,36 @@ class b {
|
|
|
615
602
|
_validateField(e) {
|
|
616
603
|
const t = /^\p{L}/u, i = /^.[\p{L}\p{M}\p{N}_]*$/u;
|
|
617
604
|
e.alias || (this.newDesign ? (e.alias = e.name, this._logAutoFix(`Field '${e.name}' had no display name (alias). Auto-fixed to '${e.alias}'.`)) : this._logIssue(`Field '${e.name}' has no display name (alias).`));
|
|
618
|
-
const n = t.test(e.name),
|
|
619
|
-
if (!n || !
|
|
605
|
+
const n = t.test(e.name), a = i.test(e.name);
|
|
606
|
+
if (!n || !a)
|
|
620
607
|
if (this.newDesign) {
|
|
621
|
-
const
|
|
622
|
-
e.name = this._makeUniqueName(this._sanitizeFieldName(e.name), this.fieldNameRegistry), this.fieldNameRegistry.add(e.name.toLowerCase()), this._logAutoFix(`Field '${
|
|
608
|
+
const o = e.name;
|
|
609
|
+
e.name = this._makeUniqueName(this._sanitizeFieldName(e.name), this.fieldNameRegistry), this.fieldNameRegistry.add(e.name.toLowerCase()), this._logAutoFix(`Field '${o}' had an invalid name. Auto-fixed to '${e.name}'.`);
|
|
623
610
|
} else
|
|
624
|
-
n || this._logIssue(`Field '${e.name}' does not start with a letter.`),
|
|
611
|
+
n || this._logIssue(`Field '${e.name}' does not start with a letter.`), a || this._logIssue(
|
|
625
612
|
`Field '${e.name}' contains invalid characters (only letters from any writing system, numbers, and underscores are allowed; emojis and punctuation are not allowed).`
|
|
626
613
|
);
|
|
627
|
-
if (e.name.length >
|
|
614
|
+
if (e.name.length > x.FIELD_NAME_MAX_LENGTH)
|
|
628
615
|
if (this.newDesign) {
|
|
629
|
-
const
|
|
630
|
-
e.name = this._getUniqueTruncatedFieldName(e.name, this.fieldNameRegistry), this.fieldNameRegistry.add(e.name.toLowerCase()), this._logAutoFix(`Field '${
|
|
616
|
+
const o = e.name;
|
|
617
|
+
e.name = this._getUniqueTruncatedFieldName(e.name, this.fieldNameRegistry), this.fieldNameRegistry.add(e.name.toLowerCase()), this._logAutoFix(`Field '${o}' exceeds ${x.FIELD_NAME_MAX_LENGTH} characters. Auto-fixing to '${e.name}'.`);
|
|
631
618
|
} else
|
|
632
|
-
this._logIssue(`Field '${e.name}' exceeds ${
|
|
633
|
-
if (
|
|
619
|
+
this._logIssue(`Field '${e.name}' exceeds ${x.FIELD_NAME_MAX_LENGTH} characters.`);
|
|
620
|
+
if (He.has(e.name.toLowerCase()))
|
|
634
621
|
if (this.newDesign) {
|
|
635
|
-
const
|
|
636
|
-
e.name = this._getUniqueTruncatedFieldName(
|
|
622
|
+
const o = e.name;
|
|
623
|
+
e.name = this._getUniqueTruncatedFieldName(o, this.fieldNameRegistry), this.fieldNameRegistry.add(e.name.toLowerCase()), this._logAutoFix(`Field '${o}' is a SQL reserved keyword. Auto-fixing to '${e.name}'.`);
|
|
637
624
|
} else
|
|
638
625
|
this._logIssue(`Field '${e.name}' is a SQL reserved keyword.`);
|
|
639
626
|
if (Ve.has(e.name.toLowerCase()))
|
|
640
627
|
if (this.newDesign) {
|
|
641
|
-
const
|
|
642
|
-
e.name = this._getUniqueTruncatedFieldName(
|
|
628
|
+
const o = e.name;
|
|
629
|
+
e.name = this._getUniqueTruncatedFieldName(o, this.fieldNameRegistry), this.fieldNameRegistry.add(e.name.toLowerCase()), this._logAutoFix(`Field '${o}' is a reserved system field name. Auto-fixing to '${e.name}'.`);
|
|
643
630
|
} else
|
|
644
631
|
this._logIssue(`Field '${e.name}' is a reserved system field name.`);
|
|
645
632
|
if (Array.isArray(e.choiceList) && e.type !== "string" && (this.newDesign ? e.choiceList.length ? (e.type = "string", this._logAutoFix(`Field '${e.name}' had a domain but was not of type 'string'. Auto-fixed by setting the type to 'string'.`)) : (e.choiceList = null, this._logAutoFix(`Field '${e.name}' had an empty domain but is not of type 'string'. Auto-fixed by removing the domain.`)) : this._logIssue(`Field '${e.name}' must be of type 'string' to have a domain.`)), e.type === "string" && this._validateStringFieldLength(e), Array.isArray(e.choiceList) && (this.newDesign ? this._autoFixChoiceList(e) : this._logChoiceListIssues(e)), Array.isArray(e.choiceList) && e.length != null) {
|
|
646
|
-
const
|
|
647
|
-
|
|
633
|
+
const o = Math.max(...e.choiceList.map((r) => r.length));
|
|
634
|
+
o > e.length && (this.newDesign ? (this._logAutoFix(`The choice provided for field '${e.name}' is too long. It must fit within ${e.length} characters, but the choice requires ${o} characters. Auto-fixing to ${o}.`), e.length = o) : this._logIssue(`The choice provided for field '${e.name}' is too long. It must fit within ${e.length} characters, but the choice requires ${o} characters.`));
|
|
648
635
|
}
|
|
649
636
|
}
|
|
650
637
|
/**
|
|
@@ -653,7 +640,7 @@ class b {
|
|
|
653
640
|
*/
|
|
654
641
|
_autoFixChoiceList(e) {
|
|
655
642
|
let t = e.choiceList;
|
|
656
|
-
const i = t.filter((
|
|
643
|
+
const i = t.filter((a) => a?.trim());
|
|
657
644
|
i.length !== t.length && (this._logAutoFix(`Field '${e.name}' had blank domain values. Auto-fixed by removing them.`), t = i, e.choiceList = t);
|
|
658
645
|
const n = [...new Set(t)];
|
|
659
646
|
n.length !== t.length && (this._logAutoFix(`Field '${e.name}' had duplicate domain values. Auto-fixed by removing duplicates.`), t = n, e.choiceList = t), t.length || (this._logAutoFix(`Field '${e.name}' had an empty domain. Auto-fixed by removing the domain.`), e.choiceList = null);
|
|
@@ -712,28 +699,28 @@ class b {
|
|
|
712
699
|
* appending a numeric suffix as needed.
|
|
713
700
|
*/
|
|
714
701
|
_getUniqueTruncatedFieldName(e, t) {
|
|
715
|
-
const i =
|
|
716
|
-
let
|
|
717
|
-
for (; t.has(
|
|
718
|
-
const r = `_${
|
|
719
|
-
|
|
702
|
+
const i = x.FIELD_NAME_MAX_LENGTH, n = e.slice(0, i);
|
|
703
|
+
let a = n, o = 1;
|
|
704
|
+
for (; t.has(a.toLowerCase()); ) {
|
|
705
|
+
const r = `_${o}`, c = Math.max(1, i - r.length);
|
|
706
|
+
a = `${n.slice(0, c)}${r}`, o += 1;
|
|
720
707
|
}
|
|
721
|
-
return
|
|
708
|
+
return a;
|
|
722
709
|
}
|
|
723
710
|
/**
|
|
724
711
|
* Sanitizes an item-style name by stripping emojis and disallowed characters,
|
|
725
712
|
* collapsing whitespace, trimming, and truncating to the name length limit.
|
|
726
713
|
* May return an empty string when no valid characters remain.
|
|
727
714
|
*/
|
|
728
|
-
_sanitizeItemName(e, t =
|
|
729
|
-
let i = (e ?? "").replace(new RegExp(Qe.source, "gu"), "").replace(
|
|
715
|
+
_sanitizeItemName(e, t = x.NAME_MAX_LENGTH) {
|
|
716
|
+
let i = (e ?? "").replace(new RegExp(Qe.source, "gu"), "").replace(x.INVALID_NAME_CHARS, "").replace(/\s+/gu, " ").trim();
|
|
730
717
|
return i.length > t && (i = i.slice(0, t).trim()), i;
|
|
731
718
|
}
|
|
732
719
|
/**
|
|
733
720
|
* Sanitizes a description by stripping the disallowed `<` and `>` characters
|
|
734
721
|
* (forward slash is allowed) and truncating to the description length limit.
|
|
735
722
|
*/
|
|
736
|
-
_sanitizeDescription(e, t =
|
|
723
|
+
_sanitizeDescription(e, t = x.DESCRIPTION_MAX_LENGTH) {
|
|
737
724
|
let i = (e ?? "").replace(/[<>]/gu, "");
|
|
738
725
|
return i.length > t && (i = i.slice(0, t)), i;
|
|
739
726
|
}
|
|
@@ -750,12 +737,12 @@ class b {
|
|
|
750
737
|
* (or values that sanitize to empty) fall back to the supplied placeholder.
|
|
751
738
|
* Returns true when fixed.
|
|
752
739
|
*/
|
|
753
|
-
_tryFixName(e, t, i, n,
|
|
740
|
+
_tryFixName(e, t, i, n, a) {
|
|
754
741
|
if (!this.newDesign)
|
|
755
742
|
return !1;
|
|
756
743
|
if (e === "empty")
|
|
757
|
-
return i(
|
|
758
|
-
const r = this._sanitizeItemName(t) ||
|
|
744
|
+
return i(a), this._logAutoFix(`${n} was empty. Auto-fixed to '${a}'.`), !0;
|
|
745
|
+
const r = this._sanitizeItemName(t) || a;
|
|
759
746
|
return i(r), this._logAutoFix(`${n} was invalid (${e}). Auto-fixed to '${r}'.`), !0;
|
|
760
747
|
}
|
|
761
748
|
/**
|
|
@@ -840,14 +827,14 @@ const yt = l.object({
|
|
|
840
827
|
}),
|
|
841
828
|
items: l.array(bt).describe("ArcGIS items that belong to the solution (apps, maps, layers, etc.)."),
|
|
842
829
|
featureLayer: vt.describe("Primary feature layer item and its schema/layers/tables details.")
|
|
843
|
-
}),
|
|
830
|
+
}), _t = l.object({
|
|
844
831
|
op: l.enum(["add", "remove", "replace", "move", "copy"]).describe("RFC 6902 operation type."),
|
|
845
832
|
path: l.string().describe("RFC 6901 JSON Pointer to the target location."),
|
|
846
833
|
value: l.string().nullable().describe(`JSON-encoded value to apply (required for add and replace). Must be null — not an empty string — for remove, move, and copy operations. Serialize as a JSON string, e.g. '\\"text\\"' for a string, '[\\"a\\",\\"b\\"]' for an array, or '{\\"name\\":\\"x\\"}' for an object.`),
|
|
847
834
|
from: l.string().nullable().describe("RFC 6901 JSON Pointer to the source location (required for move and copy). Must be null — not an empty string — for all other operations.")
|
|
848
|
-
}),
|
|
835
|
+
}), wt = l.object({
|
|
849
836
|
response: l.string().describe("Conversational response describing the accepted design changes."),
|
|
850
|
-
patches: l.array(
|
|
837
|
+
patches: l.array(_t).describe("Minimal RFC 6902 patch operations needed to update the current design.")
|
|
851
838
|
}), St = l.object({
|
|
852
839
|
response: l.string().describe("Short, user-friendly explanation of why the requested update was not applied.")
|
|
853
840
|
}), It = l.object({
|
|
@@ -870,11 +857,11 @@ const yt = l.object({
|
|
|
870
857
|
validationIssues: t,
|
|
871
858
|
recentMessages: i,
|
|
872
859
|
fallbackMessage: n,
|
|
873
|
-
promptModules:
|
|
860
|
+
promptModules: a
|
|
874
861
|
} = s;
|
|
875
862
|
try {
|
|
876
863
|
return (await We({
|
|
877
|
-
promptText: await v(
|
|
864
|
+
promptText: await v(a, "explainValidationFailure"),
|
|
878
865
|
modelTier: "fast",
|
|
879
866
|
temperature: 0,
|
|
880
867
|
schema: St,
|
|
@@ -885,14 +872,14 @@ const yt = l.object({
|
|
|
885
872
|
validationIssues: Et(t)
|
|
886
873
|
}
|
|
887
874
|
})).response?.trim() || n;
|
|
888
|
-
} catch (
|
|
875
|
+
} catch (o) {
|
|
889
876
|
return console.warn(
|
|
890
877
|
"Natural language response failed:",
|
|
891
|
-
{ error:
|
|
878
|
+
{ error: o }
|
|
892
879
|
), n;
|
|
893
880
|
}
|
|
894
|
-
}, ee = (s) => s in F,
|
|
895
|
-
let R = null, V = null,
|
|
881
|
+
}, ee = (s) => s in F, kt = 5, $t = 0.8, Nt = 0.5, Ft = "Web Mapping Application", Dt = "Embeddings";
|
|
882
|
+
let R = null, V = null, P = null, B = null;
|
|
896
883
|
const Mt = "Build", L = /* @__PURE__ */ Object.assign({
|
|
897
884
|
"./prompts/assessBuildRequest.md": () => import("../../chunks/assessBuildRequest.js").then((s) => s.default),
|
|
898
885
|
"./prompts/assessUpdateRequest.md": () => import("../../chunks/assessUpdateRequest.js").then((s) => s.default),
|
|
@@ -901,11 +888,11 @@ const Mt = "Build", L = /* @__PURE__ */ Object.assign({
|
|
|
901
888
|
"./prompts/explainValidationFailure.md": () => import("../../chunks/explainValidationFailure.js").then((s) => s.default),
|
|
902
889
|
"./prompts/findExistingSolution.md": () => import("../../chunks/findExistingSolution.js").then((s) => s.default),
|
|
903
890
|
"./prompts/updateDesign.md": () => import("../../chunks/updateDesign.js").then((s) => s.default)
|
|
904
|
-
}), Rt = ft.builderMessages, m = (s) => s?.signal?.aborted ?? !1, f = (s, e, t) => U(e)?.builderMessages?.[s] ?? Rt[s],
|
|
891
|
+
}), Rt = ft.builderMessages, m = (s) => s?.signal?.aborted ?? !1, f = (s, e, t) => U(e)?.builderMessages?.[s] ?? Rt[s], we = (s) => {
|
|
905
892
|
typeof window < "u" && window.dispatchEvent(new CustomEvent("arcgis-solution-design-update", {
|
|
906
893
|
detail: s
|
|
907
894
|
}));
|
|
908
|
-
},
|
|
895
|
+
}, Pt = async (s, e, t) => {
|
|
909
896
|
if (!s) return null;
|
|
910
897
|
const i = `type:"${Ft}" AND typekeywords:${Dt} AND group:${s}`;
|
|
911
898
|
return (await Y.searchItems({
|
|
@@ -915,13 +902,13 @@ const Mt = "Build", L = /* @__PURE__ */ Object.assign({
|
|
|
915
902
|
num: 1
|
|
916
903
|
}))?.results?.[0] ?? null;
|
|
917
904
|
};
|
|
918
|
-
async function
|
|
905
|
+
async function Bt(s, e, t, i) {
|
|
919
906
|
try {
|
|
920
|
-
const n = await
|
|
907
|
+
const n = await Pt(s, e, t);
|
|
921
908
|
if (!n || m(i))
|
|
922
909
|
return null;
|
|
923
|
-
const
|
|
924
|
-
return await
|
|
910
|
+
const a = new Ye({ id: n.id });
|
|
911
|
+
return await a.load(), m(i) ? null : await a.fetchData("json");
|
|
925
912
|
} catch {
|
|
926
913
|
return null;
|
|
927
914
|
}
|
|
@@ -942,12 +929,12 @@ const qt = async (s, e, t) => {
|
|
|
942
929
|
portal: t
|
|
943
930
|
}), n = i?.buildSolution;
|
|
944
931
|
if (!n) return null;
|
|
945
|
-
const
|
|
946
|
-
return { buildSolution: n, params:
|
|
932
|
+
const a = i?.params, o = a && typeof a == "object" && !Array.isArray(a) ? a : null;
|
|
933
|
+
return { buildSolution: n, params: o };
|
|
947
934
|
} catch {
|
|
948
935
|
return null;
|
|
949
936
|
}
|
|
950
|
-
},
|
|
937
|
+
}, k = (s, e = {}) => {
|
|
951
938
|
let t = s;
|
|
952
939
|
return "itemId" in e && (t = {
|
|
953
940
|
...t,
|
|
@@ -979,8 +966,8 @@ const qt = async (s, e, t) => {
|
|
|
979
966
|
}
|
|
980
967
|
}, te = async (s) => {
|
|
981
968
|
if (V) {
|
|
982
|
-
Object.entries(V).forEach(([
|
|
983
|
-
F[
|
|
969
|
+
Object.entries(V).forEach(([o, r]) => {
|
|
970
|
+
F[o] && (F[o].initialTemplate = r);
|
|
984
971
|
});
|
|
985
972
|
return;
|
|
986
973
|
}
|
|
@@ -989,36 +976,36 @@ const qt = async (s, e, t) => {
|
|
|
989
976
|
console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping live template hydration.");
|
|
990
977
|
return;
|
|
991
978
|
}
|
|
992
|
-
const n = await qt(t, e, i),
|
|
993
|
-
m(s) || (await Promise.all(n.map(async (
|
|
994
|
-
const r =
|
|
979
|
+
const n = await qt(t, e, i), a = {};
|
|
980
|
+
m(s) || (await Promise.all(n.map(async (o) => {
|
|
981
|
+
const r = o.properties?.templateInfo;
|
|
995
982
|
if (!r || typeof r != "object") return;
|
|
996
983
|
const c = r.id;
|
|
997
|
-
if (typeof c != "string" ||
|
|
998
|
-
const d = await Ut(
|
|
984
|
+
if (typeof c != "string" || a[c]) return;
|
|
985
|
+
const d = await Ut(o.id, e, i);
|
|
999
986
|
if (!d || m(s))
|
|
1000
987
|
return;
|
|
1001
988
|
const { buildSolution: h, params: y } = d;
|
|
1002
989
|
if (typeof h == "object" && h !== null && "solution" in h) {
|
|
1003
990
|
const g = h.solution;
|
|
1004
|
-
g.thumbnailUrl =
|
|
991
|
+
g.thumbnailUrl = o.thumbnail ? `${i ?? "https://www.arcgis.com/sharing/rest"}/content/items/${o.id}/info/${o.thumbnail}` : void 0, g.item = o;
|
|
1005
992
|
}
|
|
1006
993
|
const u = {
|
|
1007
994
|
...r,
|
|
1008
995
|
buildSolution: h
|
|
1009
996
|
};
|
|
1010
|
-
|
|
997
|
+
a[c] = k(
|
|
1011
998
|
new pe(u).dumpToLlmTemplate(),
|
|
1012
999
|
{
|
|
1013
|
-
itemId:
|
|
1000
|
+
itemId: o.id,
|
|
1014
1001
|
sourceBuildSolution: structuredClone(h),
|
|
1015
1002
|
params: y ? structuredClone(y) : null
|
|
1016
1003
|
}
|
|
1017
1004
|
), F[c] = {
|
|
1018
1005
|
...r,
|
|
1019
|
-
initialTemplate:
|
|
1006
|
+
initialTemplate: a[c]
|
|
1020
1007
|
};
|
|
1021
|
-
})), V =
|
|
1008
|
+
})), V = a);
|
|
1022
1009
|
}, Ie = (s) => {
|
|
1023
1010
|
const e = s?.configurable?.context?.token;
|
|
1024
1011
|
return typeof e != "string" || !e.trim() ? null : e;
|
|
@@ -1036,9 +1023,9 @@ const qt = async (s, e, t) => {
|
|
|
1036
1023
|
]);
|
|
1037
1024
|
}, Te = async (s) => {
|
|
1038
1025
|
const e = Ie(s);
|
|
1039
|
-
(!
|
|
1040
|
-
throw
|
|
1041
|
-
})), await
|
|
1026
|
+
(!P || e && e !== B) && (B = e ?? B, P = Ot(s).catch((i) => {
|
|
1027
|
+
throw P = null, B = null, i;
|
|
1028
|
+
})), await P;
|
|
1042
1029
|
};
|
|
1043
1030
|
async function Ee(s) {
|
|
1044
1031
|
if (R) return R;
|
|
@@ -1048,8 +1035,8 @@ async function Ee(s) {
|
|
|
1048
1035
|
const t = Ce(s), i = s?.configurable?.context?.configContext?.portalURL;
|
|
1049
1036
|
if (await new Xe(i ? { url: i } : void 0).load(), m(s))
|
|
1050
1037
|
return null;
|
|
1051
|
-
const
|
|
1052
|
-
return m(s) ? null :
|
|
1038
|
+
const a = Ie(s) ?? void 0, o = await Bt(e, a, t, s);
|
|
1039
|
+
return m(s) ? null : o ? (R = o.items, R) : null;
|
|
1053
1040
|
}
|
|
1054
1041
|
const zt = () => Object.entries(F).map(([s, e]) => `ID: ${s}
|
|
1055
1042
|
Label: ${e.label}
|
|
@@ -1060,15 +1047,15 @@ Description: ${e.description}`).join(`
|
|
|
1060
1047
|
if (typeof e != "string" || !e.trim())
|
|
1061
1048
|
return null;
|
|
1062
1049
|
try {
|
|
1063
|
-
const t = JSON.parse(e), i =
|
|
1050
|
+
const t = JSON.parse(e), i = k(
|
|
1064
1051
|
{ response: "", ...t },
|
|
1065
1052
|
{ itemId: t?.solution?.itemId ?? null }
|
|
1066
1053
|
), n = Z.safeParse(i);
|
|
1067
1054
|
if (!n.success)
|
|
1068
1055
|
return null;
|
|
1069
|
-
const { response:
|
|
1070
|
-
return
|
|
1071
|
-
|
|
1056
|
+
const { response: a, ...o } = n.data, r = t.templateId, c = typeof r == "string" && ee(r) ? r : null;
|
|
1057
|
+
return k(
|
|
1058
|
+
o,
|
|
1072
1059
|
{
|
|
1073
1060
|
sourceBuildSolution: t.sourceBuildSolution,
|
|
1074
1061
|
templateId: c,
|
|
@@ -1078,65 +1065,65 @@ Description: ${e.description}`).join(`
|
|
|
1078
1065
|
} catch {
|
|
1079
1066
|
return null;
|
|
1080
1067
|
}
|
|
1081
|
-
}, Gt =
|
|
1068
|
+
}, Gt = b.Root({
|
|
1082
1069
|
...X(),
|
|
1083
1070
|
/** Optional human-readable template description retained for UI use. */
|
|
1084
|
-
templateDescription:
|
|
1071
|
+
templateDescription: b({
|
|
1085
1072
|
reducer: (s, e) => typeof e == "string" || e === null ? e : s ?? null,
|
|
1086
1073
|
default: () => null
|
|
1087
1074
|
}),
|
|
1088
1075
|
/** Current editable design payload being refined across turns. */
|
|
1089
|
-
currentDesign:
|
|
1076
|
+
currentDesign: b({
|
|
1090
1077
|
reducer: (s = null, e) => e === void 0 ? s : e ?? null,
|
|
1091
1078
|
default: () => null
|
|
1092
1079
|
}),
|
|
1093
1080
|
/** Initial request assessment produced by the intake prompt. */
|
|
1094
|
-
assessment:
|
|
1081
|
+
assessment: b({
|
|
1095
1082
|
reducer: (s = null, e) => e === void 0 ? s : e ?? null,
|
|
1096
1083
|
default: () => null
|
|
1097
1084
|
}),
|
|
1098
1085
|
/** Template selected automatically or by human-in-the-loop choice. */
|
|
1099
|
-
selectedTemplate:
|
|
1086
|
+
selectedTemplate: b({
|
|
1100
1087
|
reducer: (s = null, e) => e === void 0 ? s : e ?? null,
|
|
1101
1088
|
default: () => null
|
|
1102
1089
|
}),
|
|
1103
1090
|
/** Update request assessment produced when an active design exists. */
|
|
1104
|
-
updateAssessment:
|
|
1091
|
+
updateAssessment: b({
|
|
1105
1092
|
reducer: (s = null, e) => e === void 0 ? s : e ?? null,
|
|
1106
1093
|
default: () => null
|
|
1107
1094
|
}),
|
|
1108
1095
|
/** Existing solution matches surfaced before building a new solution. */
|
|
1109
|
-
existingMatches:
|
|
1096
|
+
existingMatches: b({
|
|
1110
1097
|
reducer: (s = [], e) => e === void 0 ? s : e ?? [],
|
|
1111
1098
|
default: () => []
|
|
1112
1099
|
}),
|
|
1113
1100
|
/** User decision for whether to continue building after existing matches are shown. */
|
|
1114
|
-
continueBuilding:
|
|
1101
|
+
continueBuilding: b({
|
|
1115
1102
|
reducer: (s = null, e) => e === void 0 ? s : e ?? null,
|
|
1116
1103
|
default: () => null
|
|
1117
1104
|
})
|
|
1118
|
-
}),
|
|
1105
|
+
}), Jt = (s, e) => {
|
|
1119
1106
|
if (m(e))
|
|
1120
1107
|
return {};
|
|
1121
1108
|
const t = jt(e), i = t?.templateId ?? null, n = {};
|
|
1122
1109
|
return JSON.stringify(s.currentDesign) !== JSON.stringify(t) && (n.currentDesign = t), i && s.selectedTemplate !== i && (n.selectedTemplate = i), n;
|
|
1123
|
-
},
|
|
1110
|
+
}, Ht = async (s, e) => {
|
|
1124
1111
|
if (m(e))
|
|
1125
1112
|
return {};
|
|
1126
|
-
await
|
|
1127
|
-
const t = s.agentExecutionContext.userRequest, i = zt(), n = s.agentExecutionContext.messages.slice(-11),
|
|
1113
|
+
await w({ text: f("understandingRequest", e) }, e), await Te(e);
|
|
1114
|
+
const t = s.agentExecutionContext.userRequest, i = zt(), n = s.agentExecutionContext.messages.slice(-11), a = await $({
|
|
1128
1115
|
promptText: await v(L, "assessBuildRequest"),
|
|
1129
1116
|
modelTier: "advanced",
|
|
1130
1117
|
temperature: 0,
|
|
1131
1118
|
schema: Tt,
|
|
1132
1119
|
messages: n,
|
|
1133
1120
|
inputVariables: { query: t, availableTemplates: i }
|
|
1134
|
-
}),
|
|
1121
|
+
}), o = a.matchedTemplates.filter(
|
|
1135
1122
|
(u) => ee(u.templateId)
|
|
1136
1123
|
), r = {
|
|
1137
|
-
...
|
|
1138
|
-
matchedTemplates:
|
|
1139
|
-
}, [c, d] =
|
|
1124
|
+
...a,
|
|
1125
|
+
matchedTemplates: o
|
|
1126
|
+
}, [c, d] = o, y = !!c && c.confidence >= $t && (d === void 0 || c.confidence - d.confidence >= Nt) ? c.templateId : null;
|
|
1140
1127
|
return {
|
|
1141
1128
|
assessment: r,
|
|
1142
1129
|
selectedTemplate: y,
|
|
@@ -1161,10 +1148,10 @@ Description: ${e.description}`).join(`
|
|
|
1161
1148
|
isValidUpdate: !0
|
|
1162
1149
|
}
|
|
1163
1150
|
};
|
|
1164
|
-
await
|
|
1151
|
+
await w({ text: f("understandingRequest", e) }, e);
|
|
1165
1152
|
const i = s.agentExecutionContext.userRequest, n = s.agentExecutionContext.messages.slice(-11);
|
|
1166
1153
|
return {
|
|
1167
|
-
updateAssessment: await
|
|
1154
|
+
updateAssessment: await $({
|
|
1168
1155
|
promptText: await v(L, "assessUpdateRequest"),
|
|
1169
1156
|
modelTier: "advanced",
|
|
1170
1157
|
temperature: 0,
|
|
@@ -1188,25 +1175,25 @@ Description: ${e.description}`).join(`
|
|
|
1188
1175
|
return {};
|
|
1189
1176
|
const { hitlResponse: t } = e.configurable, i = "selectTemplate", n = s.assessment?.matchedTemplates.filter(
|
|
1190
1177
|
(d) => ee(d.templateId)
|
|
1191
|
-
) ?? [],
|
|
1178
|
+
) ?? [], a = n.map((d) => `${d.templateDescription}`);
|
|
1192
1179
|
if (t?.agentId !== "solutionBuilder" || t.id !== i) {
|
|
1193
1180
|
const d = {
|
|
1194
1181
|
agentId: "solutionBuilder",
|
|
1195
1182
|
id: i,
|
|
1196
1183
|
kind: "singleSelection",
|
|
1197
1184
|
message: f("selectTemplatePrompt", e),
|
|
1198
|
-
metadata: [...
|
|
1185
|
+
metadata: [...a]
|
|
1199
1186
|
};
|
|
1200
1187
|
throw new de(d);
|
|
1201
1188
|
}
|
|
1202
|
-
const
|
|
1189
|
+
const o = String(t.payload ?? ""), r = a.findIndex((d) => d === o);
|
|
1203
1190
|
return {
|
|
1204
1191
|
selectedTemplate: (r >= 0 ? n[r] : void 0)?.templateId ?? n[0]?.templateId ?? null
|
|
1205
1192
|
};
|
|
1206
1193
|
}, Xt = async (s, e) => {
|
|
1207
1194
|
if (m(e))
|
|
1208
1195
|
return {};
|
|
1209
|
-
await
|
|
1196
|
+
await w({ text: f("searchingExistingSolutions", e) }, e);
|
|
1210
1197
|
const t = s.agentExecutionContext.userRequest, i = ht(s.agentExecutionContext.messages) || t, n = await Ee(e);
|
|
1211
1198
|
if (m(e))
|
|
1212
1199
|
return {};
|
|
@@ -1214,15 +1201,15 @@ Description: ${e.description}`).join(`
|
|
|
1214
1201
|
return console.warn("Solutions Search: failed to load solution embeddings cache; skipping search."), { existingMatches: [] };
|
|
1215
1202
|
if (!n.length)
|
|
1216
1203
|
return { existingMatches: [] };
|
|
1217
|
-
const [
|
|
1204
|
+
const [a] = await ze([i]);
|
|
1218
1205
|
if (m(e))
|
|
1219
1206
|
return {};
|
|
1220
|
-
const
|
|
1207
|
+
const o = n.map((u) => ({
|
|
1221
1208
|
solution: u,
|
|
1222
|
-
score: je(
|
|
1209
|
+
score: je(a, u.embedding)
|
|
1223
1210
|
}));
|
|
1224
|
-
|
|
1225
|
-
const r =
|
|
1211
|
+
o.sort((u, g) => g.score - u.score);
|
|
1212
|
+
const r = o.slice(0, kt);
|
|
1226
1213
|
if (!r.length)
|
|
1227
1214
|
return { existingMatches: [] };
|
|
1228
1215
|
const c = r.map(({ solution: u }) => `${u.title}
|
|
@@ -1230,7 +1217,7 @@ Snippet: ${u.snippet}
|
|
|
1230
1217
|
Description: ${u.description}`).join(`
|
|
1231
1218
|
|
|
1232
1219
|
`), d = s.agentExecutionContext.messages.slice(-11);
|
|
1233
|
-
return { existingMatches: (await
|
|
1220
|
+
return { existingMatches: (await $({
|
|
1234
1221
|
promptText: await v(L, "findExistingSolution"),
|
|
1235
1222
|
modelTier: "fast",
|
|
1236
1223
|
temperature: 0,
|
|
@@ -1256,8 +1243,8 @@ Description: ${u.description}`).join(`
|
|
|
1256
1243
|
};
|
|
1257
1244
|
throw new de(h);
|
|
1258
1245
|
}
|
|
1259
|
-
const
|
|
1260
|
-
return { continueBuilding:
|
|
1246
|
+
const a = String(i.payload ?? "").trim(), o = f("continueBuildingNo", e);
|
|
1247
|
+
return { continueBuilding: a !== o };
|
|
1261
1248
|
}, Zt = (s, e) => {
|
|
1262
1249
|
const t = f("continueBuildingDeclined", e);
|
|
1263
1250
|
return {
|
|
@@ -1271,45 +1258,45 @@ Description: ${u.description}`).join(`
|
|
|
1271
1258
|
if (await Te(e), m(e))
|
|
1272
1259
|
return {};
|
|
1273
1260
|
const { currentDesign: t } = s, i = s.agentExecutionContext.userRequest;
|
|
1274
|
-
await
|
|
1261
|
+
await w({ text: f("creatingDesign", e) }, e);
|
|
1275
1262
|
let n = q(s.selectedTemplate);
|
|
1276
1263
|
if (n?.initialTemplate || (await te(e), n = q(s.selectedTemplate)), m(e))
|
|
1277
1264
|
return {};
|
|
1278
1265
|
if (!n?.initialTemplate)
|
|
1279
1266
|
throw new Error("No hydrated templates are available for solution design.");
|
|
1280
|
-
const
|
|
1267
|
+
const a = k(
|
|
1281
1268
|
t ?? n.initialTemplate,
|
|
1282
1269
|
{
|
|
1283
1270
|
itemId: (t ?? n.initialTemplate)?.solution?.itemId ?? null,
|
|
1284
1271
|
sourceBuildSolution: t?.sourceBuildSolution ?? n.initialTemplate.sourceBuildSolution,
|
|
1285
1272
|
params: t?.params ?? n.initialTemplate.params ?? null
|
|
1286
1273
|
}
|
|
1287
|
-
),
|
|
1274
|
+
), o = s.agentExecutionContext.messages.slice(-11), r = await $({
|
|
1288
1275
|
promptText: await v(L, "designSolution"),
|
|
1289
1276
|
modelTier: "advanced",
|
|
1290
1277
|
temperature: 0,
|
|
1291
1278
|
schema: Z,
|
|
1292
|
-
messages:
|
|
1279
|
+
messages: o,
|
|
1293
1280
|
inputVariables: {
|
|
1294
|
-
currentDesign: JSON.stringify(he(
|
|
1281
|
+
currentDesign: JSON.stringify(he(a)),
|
|
1295
1282
|
templateInstructions: n.instructions,
|
|
1296
1283
|
query: i
|
|
1297
1284
|
}
|
|
1298
1285
|
});
|
|
1299
|
-
if (await
|
|
1286
|
+
if (await w({ text: " of design solution 1" }, e), m(e))
|
|
1300
1287
|
return {};
|
|
1301
1288
|
const { response: c, featureLayer: d, ...h } = r, y = ge(
|
|
1302
1289
|
d,
|
|
1303
|
-
|
|
1304
|
-
), u =
|
|
1290
|
+
a.featureLayer
|
|
1291
|
+
), u = k(
|
|
1305
1292
|
{ ...h, featureLayer: y },
|
|
1306
1293
|
{
|
|
1307
|
-
itemId:
|
|
1308
|
-
sourceBuildSolution:
|
|
1294
|
+
itemId: a?.solution?.itemId,
|
|
1295
|
+
sourceBuildSolution: a.sourceBuildSolution,
|
|
1309
1296
|
templateId: s.selectedTemplate ?? null,
|
|
1310
|
-
params:
|
|
1297
|
+
params: a.params ?? null
|
|
1311
1298
|
}
|
|
1312
|
-
), g = new
|
|
1299
|
+
), g = new x(u, n.initialTemplate);
|
|
1313
1300
|
if (!g.isValid)
|
|
1314
1301
|
return console.warn(
|
|
1315
1302
|
"[SolutionBuilder] designSolution validation failed:",
|
|
@@ -1330,7 +1317,7 @@ Description: ${u.description}`).join(`
|
|
|
1330
1317
|
status: "success"
|
|
1331
1318
|
};
|
|
1332
1319
|
}
|
|
1333
|
-
return m(e) ? {} : (
|
|
1320
|
+
return m(e) ? {} : (we(u), {
|
|
1334
1321
|
outputMessage: c,
|
|
1335
1322
|
summary: c,
|
|
1336
1323
|
status: "success",
|
|
@@ -1343,14 +1330,14 @@ Description: ${u.description}`).join(`
|
|
|
1343
1330
|
if (!t)
|
|
1344
1331
|
return Le(s, e);
|
|
1345
1332
|
const i = s.agentExecutionContext.userRequest, n = s.agentExecutionContext.messages.slice(-11);
|
|
1346
|
-
await
|
|
1347
|
-
let
|
|
1333
|
+
await w({ text: f("updatingDesign", e) }, e);
|
|
1334
|
+
let a;
|
|
1348
1335
|
try {
|
|
1349
|
-
|
|
1336
|
+
a = await $({
|
|
1350
1337
|
promptText: await v(L, "updateDesign"),
|
|
1351
1338
|
modelTier: "advanced",
|
|
1352
1339
|
temperature: 0,
|
|
1353
|
-
schema:
|
|
1340
|
+
schema: wt,
|
|
1354
1341
|
messages: n,
|
|
1355
1342
|
inputVariables: {
|
|
1356
1343
|
currentDesign: JSON.stringify(me(t)),
|
|
@@ -1359,25 +1346,25 @@ Description: ${u.description}`).join(`
|
|
|
1359
1346
|
});
|
|
1360
1347
|
} catch (p) {
|
|
1361
1348
|
console.warn("[SolutionBuilder] updateDesign structured prompt failed:", p);
|
|
1362
|
-
const
|
|
1349
|
+
const _ = f("applyChangeFailed", e);
|
|
1363
1350
|
return {
|
|
1364
|
-
outputMessage:
|
|
1365
|
-
summary:
|
|
1351
|
+
outputMessage: _,
|
|
1352
|
+
summary: _,
|
|
1366
1353
|
status: "success"
|
|
1367
1354
|
};
|
|
1368
1355
|
}
|
|
1369
|
-
const { response:
|
|
1356
|
+
const { response: o, patches: r } = a;
|
|
1370
1357
|
if (!r || r.length === 0)
|
|
1371
1358
|
return {
|
|
1372
|
-
outputMessage:
|
|
1373
|
-
summary:
|
|
1359
|
+
outputMessage: o,
|
|
1360
|
+
summary: o,
|
|
1374
1361
|
status: "success"
|
|
1375
1362
|
};
|
|
1376
1363
|
const c = (p) => {
|
|
1377
1364
|
try {
|
|
1378
1365
|
return JSON.parse(p);
|
|
1379
1366
|
} catch {
|
|
1380
|
-
const
|
|
1367
|
+
const _ = p.replace(/[\u0000-\u001F]/g, (oe) => {
|
|
1381
1368
|
switch (oe) {
|
|
1382
1369
|
case "\b":
|
|
1383
1370
|
return "\\b";
|
|
@@ -1395,7 +1382,7 @@ Description: ${u.description}`).join(`
|
|
|
1395
1382
|
}
|
|
1396
1383
|
});
|
|
1397
1384
|
try {
|
|
1398
|
-
return JSON.parse(
|
|
1385
|
+
return JSON.parse(_);
|
|
1399
1386
|
} catch {
|
|
1400
1387
|
return p;
|
|
1401
1388
|
}
|
|
@@ -1405,31 +1392,31 @@ Description: ${u.description}`).join(`
|
|
|
1405
1392
|
path: p.path.replace(/\/+$/, ""),
|
|
1406
1393
|
...p.value != null && p.value !== "" ? { value: c(p.value) } : {},
|
|
1407
1394
|
...p.from != null && p.from !== "" ? { from: p.from } : {}
|
|
1408
|
-
}))].sort((p,
|
|
1395
|
+
}))].sort((p, _) => p.op !== "remove" || _.op !== "remove" ? 0 : _.path.localeCompare(p.path, void 0, { numeric: !0 })), y = structuredClone(
|
|
1409
1396
|
he(t)
|
|
1410
1397
|
);
|
|
1411
1398
|
try {
|
|
1412
|
-
|
|
1399
|
+
Je(y, h, !0);
|
|
1413
1400
|
} catch (p) {
|
|
1414
1401
|
console.warn(
|
|
1415
1402
|
"[SolutionBuilder] updateDesign JSON patch failed:",
|
|
1416
|
-
{ error: p, llmResponse:
|
|
1403
|
+
{ error: p, llmResponse: a, patches: h, patchTarget: y }
|
|
1417
1404
|
);
|
|
1418
|
-
const
|
|
1405
|
+
const _ = f("applyChangeFailed", e);
|
|
1419
1406
|
return {
|
|
1420
|
-
outputMessage:
|
|
1421
|
-
summary:
|
|
1407
|
+
outputMessage: _,
|
|
1408
|
+
summary: _,
|
|
1422
1409
|
status: "success"
|
|
1423
1410
|
};
|
|
1424
1411
|
}
|
|
1425
|
-
const u =
|
|
1412
|
+
const u = k(
|
|
1426
1413
|
{ response: "", ...y },
|
|
1427
1414
|
{ itemId: t.solution?.itemId ?? null }
|
|
1428
1415
|
), g = Z.safeParse(u);
|
|
1429
1416
|
if (!g.success) {
|
|
1430
1417
|
console.warn(
|
|
1431
1418
|
"[SolutionBuilder] updateDesign schema validation failed:",
|
|
1432
|
-
{ errors: g.error.issues, llmResponse:
|
|
1419
|
+
{ errors: g.error.issues, llmResponse: a, patchedDesign: u }
|
|
1433
1420
|
);
|
|
1434
1421
|
const p = f("applyChangeFailed", e);
|
|
1435
1422
|
return {
|
|
@@ -1441,7 +1428,7 @@ Description: ${u.description}`).join(`
|
|
|
1441
1428
|
const { response: S, featureLayer: N, ...C } = g.data, z = ge(
|
|
1442
1429
|
N,
|
|
1443
1430
|
t.featureLayer
|
|
1444
|
-
), I =
|
|
1431
|
+
), I = k(
|
|
1445
1432
|
{ ...C, featureLayer: z },
|
|
1446
1433
|
{
|
|
1447
1434
|
itemId: t.solution?.itemId,
|
|
@@ -1455,11 +1442,11 @@ Description: ${u.description}`).join(`
|
|
|
1455
1442
|
return {};
|
|
1456
1443
|
if (!D?.initialTemplate)
|
|
1457
1444
|
throw new Error("No hydrated templates are available for solution design.");
|
|
1458
|
-
const j = new
|
|
1445
|
+
const j = new x(I, D.initialTemplate, !1);
|
|
1459
1446
|
if (!j.isValid) {
|
|
1460
1447
|
console.warn(
|
|
1461
1448
|
"[SolutionBuilder] updateDesign validation failed:",
|
|
1462
|
-
{ issues: j.issues, llmResponse:
|
|
1449
|
+
{ issues: j.issues, llmResponse: a, patchedDesign: I }
|
|
1463
1450
|
);
|
|
1464
1451
|
const p = await Lt({
|
|
1465
1452
|
query: i,
|
|
@@ -1474,11 +1461,11 @@ Description: ${u.description}`).join(`
|
|
|
1474
1461
|
status: "success"
|
|
1475
1462
|
};
|
|
1476
1463
|
}
|
|
1477
|
-
const
|
|
1464
|
+
const $e = I.sourceBuildSolution, ne = Se(I, $e);
|
|
1478
1465
|
if (!ne.ok) {
|
|
1479
1466
|
console.warn(
|
|
1480
1467
|
"[SolutionBuilder] updateDesign Esri JSON conversion failed:",
|
|
1481
|
-
{ error: ne.error, llmResponse:
|
|
1468
|
+
{ error: ne.error, llmResponse: a, design: I }
|
|
1482
1469
|
);
|
|
1483
1470
|
const p = f("applyChangeFailed", e);
|
|
1484
1471
|
return {
|
|
@@ -1487,13 +1474,13 @@ Description: ${u.description}`).join(`
|
|
|
1487
1474
|
status: "success"
|
|
1488
1475
|
};
|
|
1489
1476
|
}
|
|
1490
|
-
return m(e) ? {} : (
|
|
1491
|
-
outputMessage:
|
|
1492
|
-
summary:
|
|
1477
|
+
return m(e) ? {} : (we(I), {
|
|
1478
|
+
outputMessage: o,
|
|
1479
|
+
summary: o,
|
|
1493
1480
|
status: "success",
|
|
1494
1481
|
currentDesign: I
|
|
1495
1482
|
});
|
|
1496
|
-
}, ts = (s) => s.currentDesign !== null ? "assessUpdateRequest" : "assessBuildRequest", ss = (s) => !s.updateAssessment || !s.updateAssessment.isValidUpdate ? "invalidUpdateExit" : "updateDesign", is = (s) => !s.assessment || !s.assessment.isValidUseCase ? "invalidBuildExit" : !s.selectedTemplate && s.assessment.matchedTemplates.length > 1 ? "selectTemplateHIL" : "findExistingSolutions", ns = (s) => s.existingMatches.length > 0 ? "confirmContinueBuildingHIL" : "designSolution", os = (s) => s.continueBuilding === !1 ? "declineContinueBuildingExit" : "designSolution", as = () => new K(Gt).addNode("syncCurrentDesignFromContext",
|
|
1483
|
+
}, ts = (s) => s.currentDesign !== null ? "assessUpdateRequest" : "assessBuildRequest", ss = (s) => !s.updateAssessment || !s.updateAssessment.isValidUpdate ? "invalidUpdateExit" : "updateDesign", is = (s) => !s.assessment || !s.assessment.isValidUseCase ? "invalidBuildExit" : !s.selectedTemplate && s.assessment.matchedTemplates.length > 1 ? "selectTemplateHIL" : "findExistingSolutions", ns = (s) => s.existingMatches.length > 0 ? "confirmContinueBuildingHIL" : "designSolution", os = (s) => s.continueBuilding === !1 ? "declineContinueBuildingExit" : "designSolution", as = () => new K(Gt).addNode("syncCurrentDesignFromContext", Jt).addNode("assessBuildRequest", Ht).addNode("assessUpdateRequest", Qt).addNode("invalidBuildExit", Vt).addNode("invalidUpdateExit", Kt).addNode("selectTemplateHIL", Wt).addNode("findExistingSolutions", Xt).addNode("confirmContinueBuildingHIL", Yt).addNode("declineContinueBuildingExit", Zt).addNode("designSolution", Le).addNode("updateDesign", es).addEdge(W, "syncCurrentDesignFromContext").addConditionalEdges("syncCurrentDesignFromContext", ts, {
|
|
1497
1484
|
assessUpdateRequest: "assessUpdateRequest",
|
|
1498
1485
|
assessBuildRequest: "assessBuildRequest"
|
|
1499
1486
|
}).addConditionalEdges("assessUpdateRequest", ss, {
|
|
@@ -1536,13 +1523,13 @@ const rs = E.object({
|
|
|
1536
1523
|
detail: { finished: !0, agent: e }
|
|
1537
1524
|
});
|
|
1538
1525
|
window.dispatchEvent(i);
|
|
1539
|
-
},
|
|
1526
|
+
}, ke = b.Root({
|
|
1540
1527
|
...X(),
|
|
1541
|
-
selectedTool:
|
|
1528
|
+
selectedTool: b({
|
|
1542
1529
|
reducer: (s, e) => e ?? null,
|
|
1543
1530
|
default: () => null
|
|
1544
1531
|
}),
|
|
1545
|
-
intentRationale:
|
|
1532
|
+
intentRationale: b({
|
|
1546
1533
|
reducer: (s, e) => e ?? null,
|
|
1547
1534
|
default: () => null
|
|
1548
1535
|
})
|
|
@@ -1550,17 +1537,17 @@ const rs = E.object({
|
|
|
1550
1537
|
if (O(e))
|
|
1551
1538
|
return {};
|
|
1552
1539
|
const t = U(e);
|
|
1553
|
-
await
|
|
1540
|
+
await w(
|
|
1554
1541
|
{ text: t?.builderMessages.understandingRequest },
|
|
1555
1542
|
e
|
|
1556
1543
|
);
|
|
1557
|
-
const i = s.agentExecutionContext.userRequest, n = s.agentExecutionContext.messages.slice(-11), { activeSolutionDesign:
|
|
1544
|
+
const i = s.agentExecutionContext.userRequest, n = s.agentExecutionContext.messages.slice(-11), { activeSolutionDesign: a, lastTool: o } = ls(e), r = await v(se, "classifyIntent"), c = await $({
|
|
1558
1545
|
promptText: r,
|
|
1559
1546
|
modelTier: "advanced",
|
|
1560
1547
|
temperature: 0,
|
|
1561
1548
|
schema: rs,
|
|
1562
1549
|
messages: n,
|
|
1563
|
-
inputVariables: { query: i, activeSolutionDesign:
|
|
1550
|
+
inputVariables: { query: i, activeSolutionDesign: a, lastTool: o }
|
|
1564
1551
|
});
|
|
1565
1552
|
return {
|
|
1566
1553
|
selectedTool: c.tool,
|
|
@@ -1580,23 +1567,23 @@ const rs = E.object({
|
|
|
1580
1567
|
if (O(e))
|
|
1581
1568
|
return {};
|
|
1582
1569
|
const t = U(e), i = s.agentExecutionContext.userRequest;
|
|
1583
|
-
await
|
|
1570
|
+
await w(
|
|
1584
1571
|
{ text: t?.executingSolutionsAssistantAgent },
|
|
1585
1572
|
e
|
|
1586
1573
|
);
|
|
1587
|
-
const n = await v(se, "assistantResponse"),
|
|
1574
|
+
const n = await v(se, "assistantResponse"), a = s.agentExecutionContext.messages.slice(-11), o = await Ge({
|
|
1588
1575
|
promptText: n,
|
|
1589
1576
|
modelTier: "advanced",
|
|
1590
1577
|
temperature: 0,
|
|
1591
|
-
messages:
|
|
1578
|
+
messages: a,
|
|
1592
1579
|
inputVariables: { query: i }
|
|
1593
1580
|
});
|
|
1594
1581
|
return ie(e, "assistant"), {
|
|
1595
|
-
outputMessage:
|
|
1596
|
-
summary:
|
|
1582
|
+
outputMessage: o,
|
|
1583
|
+
summary: o,
|
|
1597
1584
|
status: "success"
|
|
1598
1585
|
};
|
|
1599
|
-
}, ms = (s) => s.selectedTool ?? "other", hs = () => new K(
|
|
1586
|
+
}, ms = (s) => s.selectedTool ?? "other", hs = () => new K(ke).addNode("classifyIntent", cs).addNode("routeToExplorer", us).addNode("routeToBuilder", ds).addNode("assistantResponse", ps).addEdge(W, "classifyIntent").addConditionalEdges("classifyIntent", ms, {
|
|
1600
1587
|
explorer: "routeToExplorer",
|
|
1601
1588
|
builder: "routeToBuilder",
|
|
1602
1589
|
other: "assistantResponse"
|
|
@@ -1605,37 +1592,39 @@ const rs = E.object({
|
|
|
1605
1592
|
name: "Solutions Assistant Agent",
|
|
1606
1593
|
description: gs,
|
|
1607
1594
|
createGraph: hs,
|
|
1608
|
-
workspace:
|
|
1595
|
+
workspace: ke
|
|
1609
1596
|
}, ys = "https://links.esri.com/solutions/agol-organizational-account", bs = "https://links.esri.com/solutions/configure-assistants";
|
|
1610
1597
|
class xs extends De {
|
|
1611
1598
|
constructor() {
|
|
1612
|
-
super(), this.open = !1, this.userFirstName = "", this.builderVisible = !1, this.hasActiveBuilderDesign = !1, this._conversationId = void 0, this._lastTurnAgent = void 0, this._orgSettings = {
|
|
1599
|
+
super(), this.open = !1, this.userFirstName = "", this.builderVisible = !1, this.hasActiveBuilderDesign = !1, this._conversationId = void 0, this._lastTurnAgent = void 0, this._lastResponseAgent = void 0, this._orgSettings = {
|
|
1613
1600
|
aiAssistantsEnabled: !1,
|
|
1614
1601
|
blockBetaApps: !0,
|
|
1615
1602
|
colocateCompute: !1
|
|
1616
1603
|
}, this._suggestedPrompts = [], this._hasInteracted = !1, this._isMobile = window.innerWidth <= 800, this._translations = Fe({ name: "arcgis-solutions-assistant", blocking: !0 }), this._builderWidth = 48, this._solutionDesignJson = '{ "solution": null }', this._isAssistantBusy = !1, this._isBuilderBusy = !1, this._preChatCheck = !1, this._showNewChatConfirm = !1, this._assistantRef = Ue(), this._configContextConsumer = le({
|
|
1617
|
-
context:
|
|
1604
|
+
context: Pe,
|
|
1618
1605
|
subscribe: !0,
|
|
1619
1606
|
callback: (e) => {
|
|
1620
1607
|
e?.portalURL && (G.portalUrl = e.portalURL), e?.userSession && !this.userFirstName && this._loadUserFirstName(), e?.authentication?.PortalSubset?.orgSettings && (this._orgSettings = e?.authentication?.PortalSubset?.orgSettings);
|
|
1621
1608
|
}
|
|
1622
1609
|
}), this._builderDesignContextConsumer = le({
|
|
1623
|
-
context:
|
|
1610
|
+
context: Be,
|
|
1624
1611
|
subscribe: !0,
|
|
1625
1612
|
callback: (e) => {
|
|
1626
1613
|
e?.design && (this._solutionDesignJson = JSON.stringify(e.design, null, 2));
|
|
1627
1614
|
}
|
|
1628
1615
|
}), this._handleResize = () => {
|
|
1629
1616
|
this._isMobile = window.innerWidth <= 800;
|
|
1630
|
-
}, this._chatStartTime = null, this._handleAssistantProcessingFinished = (e) => {
|
|
1617
|
+
}, this._chatStartTime = null, this._responseMetadata = /* @__PURE__ */ new Map(), this._pendingResponseAgent = void 0, this._handleAssistantProcessingFinished = (e) => {
|
|
1631
1618
|
const t = e;
|
|
1632
1619
|
if (t.detail?.finished && this._chatStartTime !== null) {
|
|
1633
|
-
const i =
|
|
1620
|
+
const i = t.detail.agent;
|
|
1621
|
+
this._lastResponseAgent = i, this._pendingResponseAgent = i;
|
|
1622
|
+
const n = qe(this._chatStartTime);
|
|
1634
1623
|
this._telemetry?.logEvent({
|
|
1635
1624
|
category: M.ASSISTANT,
|
|
1636
1625
|
action: "Chat",
|
|
1637
|
-
dimensions: [
|
|
1638
|
-
metrics: [
|
|
1626
|
+
dimensions: [i],
|
|
1627
|
+
metrics: [n]
|
|
1639
1628
|
}), this._chatStartTime = null;
|
|
1640
1629
|
}
|
|
1641
1630
|
}, this.closeAssistant = ae(), this.assistantProcessing = ae(), this._handleAssistantLinkClick = (e) => {
|
|
@@ -1654,14 +1643,14 @@ class xs extends De {
|
|
|
1654
1643
|
}, this._checkURLOpenParameter = () => {
|
|
1655
1644
|
this.open = this._configContextConsumer.value?.authentication?.SignInParam === "aiOpen" || this.open;
|
|
1656
1645
|
}, this.listenOn(window, "arcgisFeedback", (e) => {
|
|
1657
|
-
const t = e.detail, { agentPicked: i, taskAssigned: n, userMessage:
|
|
1658
|
-
this._sendFeedback(t.content,
|
|
1646
|
+
const t = e.detail, { agentPicked: i, taskAssigned: n, userMessage: a } = this._parseAgentPickedAndTask(t), o = this._responseMetadata.get(t.id), r = o?.agent ?? i ?? "", c = o?.userMessage ?? o?.userMessage ?? a ?? n ?? "";
|
|
1647
|
+
this._sendFeedback(t.content, c, t.feedback?.positive ? "Good" : t.feedback?.positive === !1 ? "Bad" : "N/A", r);
|
|
1659
1648
|
}), this.listenOn(window, "clearAssistantConversation", () => {
|
|
1660
1649
|
this._clearConversation();
|
|
1661
1650
|
});
|
|
1662
1651
|
}
|
|
1663
1652
|
static {
|
|
1664
|
-
this.properties = { open: 5, userFirstName: 1, builderVisible: 5, hasActiveBuilderDesign: 5, _conversationId: 16, _lastTurnAgent: 16, _orgSettings: 16, _suggestedPrompts: 16, _hasInteracted: 16, _isMobile: 16, _translations: 16, _builderWidth: 16, _solutionDesignJson: 16, _isAssistantBusy: 16, _isBuilderBusy: 16, _preChatCheck: 16, _showNewChatConfirm: 16 };
|
|
1653
|
+
this.properties = { open: 5, userFirstName: 1, builderVisible: 5, hasActiveBuilderDesign: 5, _conversationId: 16, _lastTurnAgent: 16, _lastResponseAgent: 16, _orgSettings: 16, _suggestedPrompts: 16, _hasInteracted: 16, _isMobile: 16, _translations: 16, _builderWidth: 16, _solutionDesignJson: 16, _isAssistantBusy: 16, _isBuilderBusy: 16, _preChatCheck: 16, _showNewChatConfirm: 16 };
|
|
1665
1654
|
}
|
|
1666
1655
|
static {
|
|
1667
1656
|
this.styles = Ze;
|
|
@@ -1704,8 +1693,19 @@ class xs extends De {
|
|
|
1704
1693
|
}} scale=m slot=header-actions-end></calcite-action>` || ""}${!this._isMobile && T`<calcite-tooltip placement=bottom reference-element=solutionBuilderAction><span>${this._translations.tooltips.solutionBuilder}</span></calcite-tooltip>` || ""}<arcgis-assistant reference-element copy-enabled feedback-enabled heading description entry-message=${this._translations.defaultStartUpMessage ?? re} .suggestedPrompts=${e} @arcgisSubmit=${() => {
|
|
1705
1694
|
this._suggestedPrompts = [], e = [], this._hasInteracted = !0, this._chatStartTime = Date.now(), this.assistantProcessing.emit(!0);
|
|
1706
1695
|
}} @arcgisFeedback=${(t) => {
|
|
1707
|
-
t.detail;
|
|
1696
|
+
t.detail && console.log("arcgis feedback: ", t.detail);
|
|
1708
1697
|
}} @arcgisResponse=${() => {
|
|
1698
|
+
const t = this._pendingResponseAgent ?? this._lastResponseAgent;
|
|
1699
|
+
if (t) {
|
|
1700
|
+
const i = (n) => {
|
|
1701
|
+
if (this._captureResponseMetadata(t)) {
|
|
1702
|
+
this._pendingResponseAgent = void 0;
|
|
1703
|
+
return;
|
|
1704
|
+
}
|
|
1705
|
+
n < 3 && requestAnimationFrame(() => i(n + 1));
|
|
1706
|
+
};
|
|
1707
|
+
requestAnimationFrame(() => i(1));
|
|
1708
|
+
}
|
|
1709
1709
|
this.assistantProcessing.emit(!1);
|
|
1710
1710
|
}} ${Oe(this._assistantRef)}><calcite-button appearance=transparent id=newChatButton icon-start=speech-bubble-plus kind=neutral .label=${this._translations.tooltips.newChat} @click=${() => {
|
|
1711
1711
|
this.hasActiveBuilderDesign ? this._showNewChatConfirm = !0 : (this._telemetry?.logEvent({
|
|
@@ -1744,11 +1744,11 @@ class xs extends De {
|
|
|
1744
1744
|
}} 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>`;
|
|
1745
1745
|
}
|
|
1746
1746
|
_clearConversation() {
|
|
1747
|
-
this._conversationId = void 0, this._lastTurnAgent = void 0, this._suggestedPrompts = [], this._hasInteracted = !1, this._assistantRef.value?.clearChatHistory();
|
|
1747
|
+
this._conversationId = void 0, this._lastTurnAgent = void 0, this._lastResponseAgent = void 0, this._pendingResponseAgent = void 0, this._suggestedPrompts = [], this._hasInteracted = !1, this._responseMetadata.clear(), this._assistantRef.value?.clearChatHistory();
|
|
1748
1748
|
}
|
|
1749
1749
|
_sendFeedback(e, t, i, n) {
|
|
1750
|
-
const
|
|
1751
|
-
window.open(
|
|
1750
|
+
const a = `https://survey123.arcgis.com/share/6e349a50b4504ca6b6107216d568db5f?field:_source=${encodeURIComponent("Solutions Assistant")}&field:user_evaluation=${encodeURIComponent(i)}&field:question=${encodeURIComponent(t)}&field:answer=${encodeURIComponent(e)}&field:context=${encodeURIComponent(JSON.stringify({ agent: n }))}&field:version=${encodeURIComponent("v2")}`;
|
|
1751
|
+
window.open(a, "_blank");
|
|
1752
1752
|
}
|
|
1753
1753
|
async _loadUserFirstName() {
|
|
1754
1754
|
try {
|
|
@@ -1760,15 +1760,33 @@ class xs extends De {
|
|
|
1760
1760
|
} catch {
|
|
1761
1761
|
}
|
|
1762
1762
|
}
|
|
1763
|
+
_captureResponseMetadata(e) {
|
|
1764
|
+
const t = Array.from(this._assistantRef.value?.messages || []);
|
|
1765
|
+
for (let i = t.length - 1; i >= 0; i--) {
|
|
1766
|
+
const n = t[i];
|
|
1767
|
+
if (n.role === "assistant" && !this._responseMetadata.has(n.id)) {
|
|
1768
|
+
let a;
|
|
1769
|
+
for (let o = i - 1; o >= 0; o--) {
|
|
1770
|
+
const r = t[o];
|
|
1771
|
+
if (r.role === "user") {
|
|
1772
|
+
a = r.content;
|
|
1773
|
+
break;
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
return this._responseMetadata.set(n.id, { agent: e, userMessage: a }), !0;
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
return !1;
|
|
1780
|
+
}
|
|
1763
1781
|
_parseAgentPickedAndTask(e) {
|
|
1764
|
-
const t = Array.from(this._assistantRef.value?.messages || []), i = e.log || [],
|
|
1782
|
+
const t = Array.from(this._assistantRef.value?.messages || []), i = e.log || [], o = [...t].sort((u, g) => g.id - u.id).find((u) => u.role === "user" && u.id <= e.id)?.content || null, r = i.find((u) => typeof u == "string" && u.includes("Agent picked:")) ?? null;
|
|
1765
1783
|
if (!r)
|
|
1766
|
-
return { agentPicked: null, taskAssigned: null, userMessage:
|
|
1784
|
+
return { agentPicked: null, taskAssigned: null, userMessage: o };
|
|
1767
1785
|
const c = /Agent picked:\s*(.*?)\s*(?:\\n|\r?\n)\s*Task Assigned:\s*([\s\S]*)$/i, d = r.match(c);
|
|
1768
1786
|
if (!d)
|
|
1769
|
-
return { agentPicked: null, taskAssigned: null, userMessage:
|
|
1787
|
+
return { agentPicked: null, taskAssigned: null, userMessage: o };
|
|
1770
1788
|
const h = d[1].trim(), y = d[2].trim();
|
|
1771
|
-
return { agentPicked: h, taskAssigned: y, userMessage:
|
|
1789
|
+
return { agentPicked: h, taskAssigned: y, userMessage: o };
|
|
1772
1790
|
}
|
|
1773
1791
|
_emitItemIdFromAI(e) {
|
|
1774
1792
|
const t = new CustomEvent("solutionIDFromAssistant", {
|