@esri/solutions-components 5.1.0-next.127 → 5.1.0-next.129
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/{FTY7YPLA.js → 53MDMQSB.js} +14 -14
- package/dist/cdn/{5U2GHXOV.js → DYCGZ67C.js} +1 -1
- package/dist/cdn/{5AAG5ERI.js → N2UNOXJ6.js} +1 -1
- package/dist/cdn/{DQ7NBBUU.js → P6ANTPJW.js} +1 -1
- package/dist/cdn/{EOSKMSMP.js → QYWT7Y5Q.js} +1 -1
- package/dist/cdn/{XGODSNWZ.js → WQVOA4KV.js} +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.ar.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.bg.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.bs.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.ca.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.cs.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.da.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.de.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.el.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.es.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.et.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.fi.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.fr.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.he.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.hr.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.hu.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.id.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.it.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.ja.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.ko.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.lt.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.lv.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.nl.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.no.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.pl.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.pt-BR.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.pt-PT.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.ro.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.ru.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.sk.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.sl.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.sr.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.sv.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.th.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.tr.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.uk.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.vi.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.zh-CN.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.zh-HK.json +1 -1
- package/dist/cdn/assets/solution-details-panel/t9n/messages.zh-TW.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ar.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.bg.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.bs.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ca.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.cs.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.da.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.de.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.el.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.es.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.et.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.fi.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.fr.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.he.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.hr.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.hu.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.id.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.it.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ja.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ko.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.lt.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.lv.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.nl.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.no.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.pl.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.pt-BR.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.pt-PT.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ro.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ru.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.sk.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.sl.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.sr.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.sv.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.th.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.tr.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.uk.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.vi.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.zh-CN.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.zh-HK.json +1 -1
- package/dist/cdn/assets/solutions-deploy-app/t9n/messages.zh-TW.json +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/components/arcgis-solutions-assistant/customElement.js +201 -179
- package/dist/components/solution-builder-assistant/customElement.js +29 -22
- package/dist/components/solution-details-panel/customElement.js +1 -1
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/solutions-components_commit.txt +8 -5
- package/dist/utils/interfaces.d.ts +6 -0
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
2
|
import { c as Se } from "../../chunks/runtime.js";
|
|
3
3
|
import { u as Ie } from "../../chunks/useT9n.js";
|
|
4
|
-
import { LitElement as
|
|
5
|
-
import { css as
|
|
4
|
+
import { LitElement as Ce, createEvent as K, nothing as W } from "@arcgis/lumina";
|
|
5
|
+
import { css as _e, html as k } from "lit";
|
|
6
6
|
import { unsafeHTML as ke } from "lit/directives/unsafe-html.js";
|
|
7
7
|
import { useContextConsumer as Q } from "@arcgis/lumina/context";
|
|
8
8
|
import { c as Te, b as Ae } from "../../chunks/deployAppContexts.js";
|
|
@@ -10,18 +10,18 @@ import { T as Ee } from "../../chunks/interfaces.js";
|
|
|
10
10
|
import { c as Le } from "../../chunks/helpers.js";
|
|
11
11
|
import Y from "@arcgis/core/config.js";
|
|
12
12
|
import { createRef as De, ref as Pe } from "lit-html/directives/ref.js";
|
|
13
|
-
import { Annotation as
|
|
14
|
-
import { createAgentRuntimeState as
|
|
13
|
+
import { Annotation as v, StateGraph as U, START as q, END as A, NodeInterrupt as X } from "@langchain/langgraph/web";
|
|
14
|
+
import { createAgentRuntimeState as z, sendTraceMessage as I, invokeTextPrompt as $e, invokeStructuredPrompt as R, getEmbeddings as Me, cosineSimilarity as Fe } from "@arcgis/ai-orchestrator";
|
|
15
15
|
import "@langchain/core/messages";
|
|
16
|
-
import * as
|
|
16
|
+
import * as O from "@esri/arcgis-rest-portal";
|
|
17
17
|
import { applyPatch as Re } from "fast-json-patch";
|
|
18
18
|
import { C as ee } from "../../chunks/converter.js";
|
|
19
19
|
import a from "zod";
|
|
20
|
-
import { g as
|
|
20
|
+
import { g as F, d as te, r as se, t as Ne, T as E } from "../../chunks/templates.js";
|
|
21
21
|
import Be from "@arcgis/core/portal/Portal.js";
|
|
22
22
|
import Ue from "@arcgis/core/portal/PortalItem.js";
|
|
23
|
-
const qe =
|
|
24
|
-
async function
|
|
23
|
+
const qe = _e`: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
|
+
async function w(t, e) {
|
|
25
25
|
const s = Object.entries(t).find(
|
|
26
26
|
([i]) => i.endsWith(`/${e}.md`)
|
|
27
27
|
);
|
|
@@ -34,7 +34,7 @@ ${Object.keys(t).join(`
|
|
|
34
34
|
);
|
|
35
35
|
return await s[1]();
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function j(t) {
|
|
38
38
|
return t?.configurable?.context?.translations;
|
|
39
39
|
}
|
|
40
40
|
function ie(t) {
|
|
@@ -104,23 +104,27 @@ const oe = (t) => {
|
|
|
104
104
|
}, ae = /* @__PURE__ */ Object.assign({
|
|
105
105
|
"./prompts/solutions_assistant_description.md": () => import("../../chunks/solutions_assistant_description.js").then((t) => t.default),
|
|
106
106
|
"./prompts/solutions_assistant_prompts.md": () => import("../../chunks/solutions_assistant_prompts.js").then((t) => t.default)
|
|
107
|
-
}), re =
|
|
108
|
-
...
|
|
107
|
+
}), re = v.Root({
|
|
108
|
+
...z()
|
|
109
109
|
}), Je = async (t, e) => {
|
|
110
|
-
const s =
|
|
110
|
+
const s = j(e);
|
|
111
111
|
await I(
|
|
112
112
|
{ text: s?.executingSolutionsAssistantAgent || "Preparing a response..." },
|
|
113
113
|
e
|
|
114
114
|
);
|
|
115
|
-
const i = await
|
|
115
|
+
const i = await w(ae, "solutions_assistant_prompts"), n = t.agentExecutionContext.messages.slice(-10), o = await $e({
|
|
116
116
|
promptText: i,
|
|
117
117
|
modelTier: "default",
|
|
118
118
|
temperature: 0.7,
|
|
119
119
|
// getAgentContext returns MessageFieldWithRole format which LangChain coerces to BaseMessage
|
|
120
120
|
messages: je(n)
|
|
121
121
|
}), r = e?.configurable?.context?.clearSuggestedPrompts;
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
r && r();
|
|
123
|
+
const l = new CustomEvent("assistantProcessing", {
|
|
124
|
+
detail: !1
|
|
125
|
+
});
|
|
126
|
+
return window.dispatchEvent(l), { outputMessage: o, summary: o, status: "success" };
|
|
127
|
+
}, Ge = () => new U(re).addNode("assistantLLM", Je).addEdge(q, "assistantLLM").addEdge("assistantLLM", A), He = await w(ae, "solutions_assistant_description"), Ve = {
|
|
124
128
|
id: "solutionsAssistant",
|
|
125
129
|
name: "Solutions Assistant Agent",
|
|
126
130
|
description: He,
|
|
@@ -192,8 +196,8 @@ const oe = (t) => {
|
|
|
192
196
|
"where"
|
|
193
197
|
]);
|
|
194
198
|
class le {
|
|
195
|
-
constructor(e, s) {
|
|
196
|
-
this.isValid = !0, this.issues = [], this.response = e, this.template = s, this.validate();
|
|
199
|
+
constructor(e, s, i = !0) {
|
|
200
|
+
this.isValid = !0, this.issues = [], this.response = e, this.template = s, this.newDesign = i, this.validate();
|
|
197
201
|
}
|
|
198
202
|
validate() {
|
|
199
203
|
this.compareModels(), this.validateResponse();
|
|
@@ -265,7 +269,7 @@ class le {
|
|
|
265
269
|
validateField(e) {
|
|
266
270
|
if (e.alias || this.logIssue(`Field '${e.name}' has no display name (alias).`), /^[A-Za-z]/u.test(e.name) || this.logIssue(`Field '${e.name}' does not start with a letter.`), /^[A-Za-z][A-Za-z0-9_]*$/u.test(e.name) || this.logIssue(`Field '${e.name}' contains invalid characters (only letters, numbers, and underscores allowed).`), e.name.length > 31 && this.logIssue(`Field '${e.name}' exceeds 31 characters.`), Qe.has(e.name.toLowerCase()) && this.logIssue(`Field '${e.name}' is a SQL reserved keyword.`), e.choiceList && (e.choiceList.some((s) => !s) && this.logIssue(`Field '${e.name}' has empty domain values.`), e.choiceList.length !== new Set(e.choiceList).size && this.logIssue(`Field '${e.name}' has duplicate domain values.`), e.length != null)) {
|
|
267
271
|
const s = Math.max(...e.choiceList.map((i) => i.length));
|
|
268
|
-
s > e.length && (console.debug(`Field '${e.name}' length ${e.length} is insufficient for choiceList value of length ${s}. Auto-fixing to ${s}.`), e.length = s);
|
|
272
|
+
s > e.length && (this.newDesign ? (console.debug(`Field '${e.name}' length ${e.length} is insufficient for choiceList value of length ${s}. Auto-fixing to ${s}.`), e.length = s) : this.logIssue(`Field '${e.name}' length ${e.length} is insufficient for choiceList value of length ${s}.`));
|
|
269
273
|
}
|
|
270
274
|
}
|
|
271
275
|
logIssue(e) {
|
|
@@ -319,7 +323,7 @@ const Ye = a.object({
|
|
|
319
323
|
itemId: a.string().describe("ArcGIS item id for the feature layer."),
|
|
320
324
|
addLayers: a.boolean().describe("Indicates whether new layers can be added during solution design."),
|
|
321
325
|
layers: a.array(Xe)
|
|
322
|
-
}),
|
|
326
|
+
}), J = a.object({
|
|
323
327
|
response: a.string().describe("Conversational response to the user's query."),
|
|
324
328
|
solution: a.object({
|
|
325
329
|
itemId: a.string().nullable().describe("ArcGIS item id of the source Solution template used for deployment. Preserve the existing value exactly when known; otherwise use null."),
|
|
@@ -348,8 +352,8 @@ const Ye = a.object({
|
|
|
348
352
|
assistantResponse: a.string().describe("Natural-language response for the user."),
|
|
349
353
|
isValidUseCase: a.boolean().describe("True only when the request is concrete, appropriate, and has at least one matching template."),
|
|
350
354
|
matchedTemplates: a.array(nt).describe("Ordered list of matching templates, best match first. Empty when no valid match exists.")
|
|
351
|
-
}),
|
|
352
|
-
let
|
|
355
|
+
}), G = (t) => t in E, at = 5, rt = 0.8, lt = 0.15, ct = "Web Mapping Application", dt = "Embeddings";
|
|
356
|
+
let P = null, N = null, $ = null, M = null;
|
|
353
357
|
const ut = "Build", L = /* @__PURE__ */ Object.assign({
|
|
354
358
|
"./prompts/description.md": () => import("../../chunks/description.js").then((t) => t.default),
|
|
355
359
|
"./prompts/designSolution.md": () => import("../../chunks/designSolution.js").then((t) => t.default),
|
|
@@ -357,7 +361,7 @@ const ut = "Build", L = /* @__PURE__ */ Object.assign({
|
|
|
357
361
|
"./prompts/initialAssessment.md": () => import("../../chunks/initialAssessment.js").then((t) => t.default),
|
|
358
362
|
"./prompts/updateDesign.md": () => import("../../chunks/updateDesign.js").then((t) => t.default)
|
|
359
363
|
}), pt = We.builderMessages, h = (t, e, s) => {
|
|
360
|
-
let n =
|
|
364
|
+
let n = j(e)?.builderMessages?.[t] ?? pt[t];
|
|
361
365
|
if (!s)
|
|
362
366
|
return n;
|
|
363
367
|
for (const [o, r] of Object.entries(s))
|
|
@@ -370,7 +374,7 @@ const ut = "Build", L = /* @__PURE__ */ Object.assign({
|
|
|
370
374
|
}, mt = async (t, e, s) => {
|
|
371
375
|
if (!t) return null;
|
|
372
376
|
const i = `type:"${ct}" AND typekeywords:${dt} AND group:${t}`;
|
|
373
|
-
return (await
|
|
377
|
+
return (await O.searchItems({
|
|
374
378
|
q: i,
|
|
375
379
|
params: e ? { token: e } : void 0,
|
|
376
380
|
portal: s,
|
|
@@ -390,7 +394,7 @@ async function gt(t, e, s) {
|
|
|
390
394
|
const ht = async (t, e, s) => {
|
|
391
395
|
if (!t) return [];
|
|
392
396
|
const i = `type:Solution AND typekeywords:${ut} AND group:${t}`;
|
|
393
|
-
return (await
|
|
397
|
+
return (await O.searchItems({
|
|
394
398
|
q: i,
|
|
395
399
|
params: e ? { token: e } : void 0,
|
|
396
400
|
portal: s,
|
|
@@ -398,14 +402,17 @@ const ht = async (t, e, s) => {
|
|
|
398
402
|
}))?.results ?? [];
|
|
399
403
|
}, ft = async (t, e, s) => {
|
|
400
404
|
try {
|
|
401
|
-
|
|
405
|
+
const i = await O.getItemData(t, {
|
|
402
406
|
params: e ? { token: e } : void 0,
|
|
403
407
|
portal: s
|
|
404
|
-
})
|
|
408
|
+
}), n = i?.buildSolution;
|
|
409
|
+
if (!n) return null;
|
|
410
|
+
const o = i?.params, r = o && typeof o == "object" && !Array.isArray(o) ? o : null;
|
|
411
|
+
return { buildSolution: n, params: r };
|
|
405
412
|
} catch {
|
|
406
413
|
return null;
|
|
407
414
|
}
|
|
408
|
-
},
|
|
415
|
+
}, C = (t, e = {}) => {
|
|
409
416
|
let s = t;
|
|
410
417
|
return "itemId" in e && (s = {
|
|
411
418
|
...s,
|
|
@@ -416,6 +423,9 @@ const ht = async (t, e, s) => {
|
|
|
416
423
|
}), e.sourceBuildSolution != null && (s = {
|
|
417
424
|
...s,
|
|
418
425
|
sourceBuildSolution: e.sourceBuildSolution
|
|
426
|
+
}), "params" in e && (s = {
|
|
427
|
+
...s,
|
|
428
|
+
params: e.params ?? null
|
|
419
429
|
}), "templateId" in e && (s = {
|
|
420
430
|
...s,
|
|
421
431
|
templateId: e.templateId ?? null
|
|
@@ -432,9 +442,9 @@ const ht = async (t, e, s) => {
|
|
|
432
442
|
error: s instanceof Error ? s.stack ?? s.message : String(s)
|
|
433
443
|
};
|
|
434
444
|
}
|
|
435
|
-
},
|
|
436
|
-
if (
|
|
437
|
-
Object.entries(
|
|
445
|
+
}, H = async (t) => {
|
|
446
|
+
if (N) {
|
|
447
|
+
Object.entries(N).forEach(([r, l]) => {
|
|
438
448
|
E[r] && (E[r].initialTemplate = l);
|
|
439
449
|
});
|
|
440
450
|
return;
|
|
@@ -448,22 +458,26 @@ const ht = async (t, e, s) => {
|
|
|
448
458
|
await Promise.all(n.map(async (r) => {
|
|
449
459
|
const l = r.properties?.templateInfo;
|
|
450
460
|
if (!l || typeof l != "object") return;
|
|
451
|
-
const
|
|
452
|
-
if (typeof
|
|
453
|
-
const
|
|
454
|
-
if (!
|
|
455
|
-
const p = {
|
|
461
|
+
const c = l.id;
|
|
462
|
+
if (typeof c != "string" || o[c]) return;
|
|
463
|
+
const d = await ft(r.id, e, i);
|
|
464
|
+
if (!d) return;
|
|
465
|
+
const { buildSolution: u, params: p } = d, m = {
|
|
456
466
|
...l,
|
|
457
|
-
buildSolution:
|
|
467
|
+
buildSolution: u
|
|
458
468
|
};
|
|
459
|
-
o[
|
|
460
|
-
new ee(
|
|
461
|
-
{
|
|
462
|
-
|
|
469
|
+
o[c] = C(
|
|
470
|
+
new ee(m).dumpToLlmTemplate(),
|
|
471
|
+
{
|
|
472
|
+
itemId: r.id,
|
|
473
|
+
sourceBuildSolution: structuredClone(u),
|
|
474
|
+
params: p ? structuredClone(p) : null
|
|
475
|
+
}
|
|
476
|
+
), E[c] = {
|
|
463
477
|
...l,
|
|
464
|
-
initialTemplate: o[
|
|
478
|
+
initialTemplate: o[c]
|
|
465
479
|
};
|
|
466
|
-
})),
|
|
480
|
+
})), N = o;
|
|
467
481
|
}, ue = (t) => {
|
|
468
482
|
const e = t?.configurable?.context?.token;
|
|
469
483
|
return typeof e != "string" || !e.trim() ? null : e;
|
|
@@ -477,23 +491,23 @@ const ht = async (t, e, s) => {
|
|
|
477
491
|
}, bt = async (t) => {
|
|
478
492
|
await Promise.all([
|
|
479
493
|
he(t),
|
|
480
|
-
|
|
494
|
+
H(t)
|
|
481
495
|
]);
|
|
482
496
|
}, ge = async (t) => {
|
|
483
497
|
const e = ue(t);
|
|
484
|
-
(
|
|
485
|
-
throw
|
|
486
|
-
})), await
|
|
498
|
+
(!$ || e && e !== M) && (M = e ?? M, $ = bt(t).catch((i) => {
|
|
499
|
+
throw $ = null, M = null, i;
|
|
500
|
+
})), await $;
|
|
487
501
|
};
|
|
488
502
|
async function he(t) {
|
|
489
|
-
if (
|
|
503
|
+
if (P) return P;
|
|
490
504
|
const e = pe(t);
|
|
491
505
|
if (!e)
|
|
492
506
|
return console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping embeddings load."), null;
|
|
493
507
|
const s = me(t), i = t?.configurable?.context?.configContext?.portalURL;
|
|
494
508
|
await new Be(i ? { url: i } : void 0).load();
|
|
495
509
|
const o = ue(t) ?? void 0, r = await gt(e, o, s);
|
|
496
|
-
return r ? (
|
|
510
|
+
return r ? (P = r.items, P) : null;
|
|
497
511
|
}
|
|
498
512
|
const vt = () => Object.entries(E).map(([t, e]) => `ID: ${t}
|
|
499
513
|
Label: ${e.label}
|
|
@@ -504,18 +518,19 @@ Description: ${e.description}`).join(`
|
|
|
504
518
|
if (typeof e != "string" || !e.trim())
|
|
505
519
|
return null;
|
|
506
520
|
try {
|
|
507
|
-
const s = JSON.parse(e), i =
|
|
521
|
+
const s = JSON.parse(e), i = C(
|
|
508
522
|
{ response: "", ...s },
|
|
509
523
|
{ itemId: s?.solution?.itemId ?? null }
|
|
510
|
-
), n =
|
|
524
|
+
), n = J.safeParse(i);
|
|
511
525
|
if (!n.success)
|
|
512
526
|
return null;
|
|
513
|
-
const { response: o, ...r } = n.data, l = s.templateId,
|
|
514
|
-
return
|
|
527
|
+
const { response: o, ...r } = n.data, l = s.templateId, c = typeof l == "string" && G(l) ? l : null;
|
|
528
|
+
return C(
|
|
515
529
|
r,
|
|
516
530
|
{
|
|
517
531
|
sourceBuildSolution: s.sourceBuildSolution,
|
|
518
|
-
templateId:
|
|
532
|
+
templateId: c,
|
|
533
|
+
params: s.params ?? null
|
|
519
534
|
}
|
|
520
535
|
);
|
|
521
536
|
} catch {
|
|
@@ -526,30 +541,30 @@ Description: ${e.description}`).join(`
|
|
|
526
541
|
detail: t
|
|
527
542
|
});
|
|
528
543
|
window.dispatchEvent(e);
|
|
529
|
-
}, fe =
|
|
530
|
-
...
|
|
544
|
+
}, fe = v.Root({
|
|
545
|
+
...z(),
|
|
531
546
|
/** Optional human-readable template description retained for UI use. */
|
|
532
|
-
templateDescription:
|
|
547
|
+
templateDescription: v({
|
|
533
548
|
reducer: (t, e) => typeof e == "string" || e === null ? e : t ?? null,
|
|
534
549
|
default: () => null
|
|
535
550
|
}),
|
|
536
551
|
/** Current editable design payload being refined across turns. */
|
|
537
|
-
currentDesign:
|
|
552
|
+
currentDesign: v({
|
|
538
553
|
reducer: (t = null, e) => e === void 0 ? t : e ?? null,
|
|
539
554
|
default: () => null
|
|
540
555
|
}),
|
|
541
556
|
/** Initial request assessment produced by the intake prompt. */
|
|
542
|
-
assessment:
|
|
557
|
+
assessment: v({
|
|
543
558
|
reducer: (t = null, e) => e === void 0 ? t : e ?? null,
|
|
544
559
|
default: () => null
|
|
545
560
|
}),
|
|
546
561
|
/** Template selected automatically or by human-in-the-loop choice. */
|
|
547
|
-
selectedTemplate:
|
|
562
|
+
selectedTemplate: v({
|
|
548
563
|
reducer: (t = null, e) => e === void 0 ? t : e ?? null,
|
|
549
564
|
default: () => null
|
|
550
565
|
}),
|
|
551
566
|
/** Existing solution matches surfaced before building a new solution. */
|
|
552
|
-
existingMatches:
|
|
567
|
+
existingMatches: v({
|
|
553
568
|
reducer: (t = [], e) => e === void 0 ? t : e ?? [],
|
|
554
569
|
default: () => []
|
|
555
570
|
})
|
|
@@ -560,21 +575,21 @@ Description: ${e.description}`).join(`
|
|
|
560
575
|
await ge(e);
|
|
561
576
|
const s = t.agentExecutionContext.userRequest;
|
|
562
577
|
await I({ text: h("understandingRequest", e) }, e);
|
|
563
|
-
const i = vt(), n = await
|
|
564
|
-
promptText: await
|
|
578
|
+
const i = vt(), n = await R({
|
|
579
|
+
promptText: await w(L, "initialAssessment"),
|
|
565
580
|
modelTier: "advanced",
|
|
566
581
|
temperature: 0,
|
|
567
582
|
schema: ot,
|
|
568
583
|
inputVariables: { query: s, availableTemplates: i }
|
|
569
584
|
}), o = n.matchedTemplates.filter(
|
|
570
|
-
(
|
|
585
|
+
(p) => G(p.templateId)
|
|
571
586
|
), r = {
|
|
572
587
|
...n,
|
|
573
588
|
matchedTemplates: o
|
|
574
|
-
}, [l,
|
|
589
|
+
}, [l, c] = o, u = !!l && l.confidence >= rt && (c === void 0 || l.confidence - c.confidence >= lt) ? l.templateId : null;
|
|
575
590
|
return {
|
|
576
591
|
assessment: r,
|
|
577
|
-
selectedTemplate:
|
|
592
|
+
selectedTemplate: u,
|
|
578
593
|
existingMatches: []
|
|
579
594
|
};
|
|
580
595
|
}, St = (t) => {
|
|
@@ -586,54 +601,54 @@ Description: ${e.description}`).join(`
|
|
|
586
601
|
};
|
|
587
602
|
}, It = (t, e) => {
|
|
588
603
|
const { hitlResponse: s } = e.configurable, i = "selectTemplate", n = t.assessment?.matchedTemplates.filter(
|
|
589
|
-
(
|
|
590
|
-
) ?? [], o = n.map((
|
|
604
|
+
(d) => G(d.templateId)
|
|
605
|
+
) ?? [], o = n.map((d) => `${d.templateDescription}`);
|
|
591
606
|
if (s?.agentId !== "solutionBuilder" || s.id !== i) {
|
|
592
|
-
const
|
|
607
|
+
const d = {
|
|
593
608
|
agentId: "solutionBuilder",
|
|
594
609
|
id: i,
|
|
595
610
|
kind: "singleSelection",
|
|
596
611
|
message: h("selectTemplatePrompt", e),
|
|
597
612
|
metadata: [...o]
|
|
598
613
|
};
|
|
599
|
-
throw new X(
|
|
614
|
+
throw new X(d);
|
|
600
615
|
}
|
|
601
|
-
const r = String(s.payload ?? ""), l = o.findIndex((
|
|
616
|
+
const r = String(s.payload ?? ""), l = o.findIndex((d) => d === r);
|
|
602
617
|
return {
|
|
603
618
|
selectedTemplate: (l >= 0 ? n[l] : void 0)?.templateId ?? n[0]?.templateId ?? null
|
|
604
619
|
};
|
|
605
|
-
},
|
|
620
|
+
}, Ct = async (t, e) => {
|
|
606
621
|
await I({ text: h("searchingExistingSolutions", e) }, e);
|
|
607
622
|
const s = t.agentExecutionContext.userRequest, i = await he(e);
|
|
608
623
|
if (!i)
|
|
609
624
|
return console.warn("Solutions Search: failed to load solution embeddings cache; skipping search."), { existingMatches: [] };
|
|
610
625
|
if (!i.length)
|
|
611
626
|
return { existingMatches: [] };
|
|
612
|
-
const [n] = await Me([s]), o = i.map((
|
|
613
|
-
solution:
|
|
614
|
-
score: Fe(n,
|
|
627
|
+
const [n] = await Me([s]), o = i.map((u) => ({
|
|
628
|
+
solution: u,
|
|
629
|
+
score: Fe(n, u.embedding)
|
|
615
630
|
}));
|
|
616
|
-
o.sort((
|
|
631
|
+
o.sort((u, p) => p.score - u.score);
|
|
617
632
|
const r = o.slice(0, at);
|
|
618
633
|
if (!r.length)
|
|
619
634
|
return { existingMatches: [] };
|
|
620
|
-
const l = r.map(({ solution:
|
|
621
|
-
Snippet: ${
|
|
622
|
-
Description: ${
|
|
635
|
+
const l = r.map(({ solution: u }) => `${u.title}
|
|
636
|
+
Snippet: ${u.snippet}
|
|
637
|
+
Description: ${u.description}`).join(`
|
|
623
638
|
|
|
624
639
|
`);
|
|
625
|
-
return { existingMatches: (await
|
|
626
|
-
promptText: await
|
|
640
|
+
return { existingMatches: (await R({
|
|
641
|
+
promptText: await w(L, "findExistingSolution"),
|
|
627
642
|
modelTier: "advanced",
|
|
628
643
|
temperature: 0,
|
|
629
644
|
schema: it,
|
|
630
645
|
inputVariables: { query: s, candidates: l }
|
|
631
|
-
})).matchedTitles.map((
|
|
632
|
-
},
|
|
646
|
+
})).matchedTitles.map((u) => r.find(({ solution: p }) => p.title === u)).filter((u) => u !== void 0) };
|
|
647
|
+
}, _t = (t, e) => {
|
|
633
648
|
const { existingMatches: s } = t, { hitlResponse: i } = e.configurable, n = `confirmExistingSolution:${s[0].solution.id}`;
|
|
634
649
|
if (i?.agentId !== "solutionBuilder" || i.id !== n) {
|
|
635
650
|
s.length === 1 ? ne(s[0].solution.id) : ie(s);
|
|
636
|
-
const o = s.map((
|
|
651
|
+
const o = s.map((c) => `${c.solution.title}`).join(", "), r = h("existingSolutionMatch", e, { solutionMatch: o }), l = {
|
|
637
652
|
agentId: "solutionBuilder",
|
|
638
653
|
id: n,
|
|
639
654
|
kind: "booleanChoice",
|
|
@@ -647,61 +662,63 @@ Description: ${p.description}`).join(`
|
|
|
647
662
|
await ge(e);
|
|
648
663
|
const { currentDesign: s } = t, i = t.agentExecutionContext.userRequest;
|
|
649
664
|
await I({ text: h("creatingDesign", e) }, e);
|
|
650
|
-
let n =
|
|
651
|
-
if (n?.initialTemplate || (await
|
|
665
|
+
let n = F(t.selectedTemplate);
|
|
666
|
+
if (n?.initialTemplate || (await H(e), n = F(t.selectedTemplate)), !n?.initialTemplate)
|
|
652
667
|
throw new Error("No hydrated templates are available for solution design.");
|
|
653
|
-
const o =
|
|
668
|
+
const o = C(
|
|
654
669
|
s ?? n.initialTemplate,
|
|
655
670
|
{
|
|
656
671
|
itemId: (s ?? n.initialTemplate)?.solution?.itemId ?? null,
|
|
657
|
-
sourceBuildSolution: s?.sourceBuildSolution ?? n.initialTemplate.sourceBuildSolution
|
|
672
|
+
sourceBuildSolution: s?.sourceBuildSolution ?? n.initialTemplate.sourceBuildSolution,
|
|
673
|
+
params: s?.params ?? n.initialTemplate.params ?? null
|
|
658
674
|
}
|
|
659
|
-
), r = await
|
|
660
|
-
promptText: await
|
|
675
|
+
), r = await R({
|
|
676
|
+
promptText: await w(L, "designSolution"),
|
|
661
677
|
modelTier: "advanced",
|
|
662
678
|
temperature: 0,
|
|
663
|
-
schema:
|
|
679
|
+
schema: J,
|
|
664
680
|
inputVariables: {
|
|
665
681
|
currentDesign: JSON.stringify(te(o)),
|
|
666
682
|
templateInstructions: n.instructions,
|
|
667
683
|
query: i
|
|
668
684
|
}
|
|
669
|
-
}), { response: l, featureLayer:
|
|
670
|
-
|
|
685
|
+
}), { response: l, featureLayer: c, ...d } = r, u = se(
|
|
686
|
+
c,
|
|
671
687
|
o.featureLayer
|
|
672
|
-
),
|
|
673
|
-
{ ...
|
|
688
|
+
), p = C(
|
|
689
|
+
{ ...d, featureLayer: u },
|
|
674
690
|
{
|
|
675
691
|
itemId: o?.solution?.itemId,
|
|
676
692
|
sourceBuildSolution: o.sourceBuildSolution,
|
|
677
|
-
templateId: t.selectedTemplate ?? null
|
|
693
|
+
templateId: t.selectedTemplate ?? null,
|
|
694
|
+
params: o.params ?? null
|
|
678
695
|
}
|
|
679
|
-
),
|
|
680
|
-
if (!
|
|
696
|
+
), m = new le(p, n.initialTemplate);
|
|
697
|
+
if (!m.isValid)
|
|
681
698
|
return console.warn(
|
|
682
699
|
"[SolutionBuilder] designSolution validation failed:",
|
|
683
|
-
{ issues:
|
|
700
|
+
{ issues: m.issues, llmResponse: r }
|
|
684
701
|
), {
|
|
685
702
|
outputMessage: h("createDesignFailed", e)
|
|
686
703
|
};
|
|
687
|
-
const
|
|
688
|
-
if (!
|
|
704
|
+
const f = p.sourceBuildSolution, x = de(p, f);
|
|
705
|
+
if (!x.ok) {
|
|
689
706
|
console.warn(
|
|
690
707
|
"[SolutionBuilder] designSolution Esri JSON conversion failed:",
|
|
691
|
-
{ error:
|
|
708
|
+
{ error: x.error, llmResponse: r, design: p }
|
|
692
709
|
);
|
|
693
|
-
const
|
|
710
|
+
const b = h("createDesignFailed", e);
|
|
694
711
|
return {
|
|
695
|
-
outputMessage:
|
|
696
|
-
summary:
|
|
712
|
+
outputMessage: b,
|
|
713
|
+
summary: b,
|
|
697
714
|
status: "success"
|
|
698
715
|
};
|
|
699
716
|
}
|
|
700
|
-
return S(!1), ce(
|
|
717
|
+
return S(!1), ce(p), {
|
|
701
718
|
outputMessage: l,
|
|
702
719
|
summary: l,
|
|
703
720
|
status: "success",
|
|
704
|
-
currentDesign:
|
|
721
|
+
currentDesign: p
|
|
705
722
|
};
|
|
706
723
|
}, kt = async (t, e) => {
|
|
707
724
|
const { currentDesign: s } = t;
|
|
@@ -709,8 +726,8 @@ Description: ${p.description}`).join(`
|
|
|
709
726
|
return be(t, e);
|
|
710
727
|
const i = t.agentExecutionContext.userRequest;
|
|
711
728
|
await I({ text: h("updatingDesign", e) }, e);
|
|
712
|
-
const n = await
|
|
713
|
-
promptText: await
|
|
729
|
+
const n = await R({
|
|
730
|
+
promptText: await w(L, "updateDesign"),
|
|
714
731
|
modelTier: "advanced",
|
|
715
732
|
temperature: 0,
|
|
716
733
|
schema: st,
|
|
@@ -718,20 +735,20 @@ Description: ${p.description}`).join(`
|
|
|
718
735
|
currentDesign: JSON.stringify(Ne(s)),
|
|
719
736
|
query: i
|
|
720
737
|
}
|
|
721
|
-
}), { response: o, patches: r } = n,
|
|
722
|
-
op:
|
|
723
|
-
path:
|
|
724
|
-
...
|
|
725
|
-
...
|
|
726
|
-
}))].sort((
|
|
738
|
+
}), { response: o, patches: r } = n, c = [...r.map((g) => ({
|
|
739
|
+
op: g.op,
|
|
740
|
+
path: g.path.replace(/\/+$/, ""),
|
|
741
|
+
...g.value != null && g.value !== "" ? { value: JSON.parse(g.value) } : {},
|
|
742
|
+
...g.from != null && g.from !== "" ? { from: g.from } : {}
|
|
743
|
+
}))].sort((g, T) => g.op !== "remove" || T.op !== "remove" ? 0 : T.path.localeCompare(g.path, void 0, { numeric: !0 })), d = structuredClone(
|
|
727
744
|
te(s)
|
|
728
745
|
);
|
|
729
746
|
try {
|
|
730
|
-
Re(
|
|
731
|
-
} catch (
|
|
747
|
+
Re(d, c, !0);
|
|
748
|
+
} catch (g) {
|
|
732
749
|
console.warn(
|
|
733
750
|
"[SolutionBuilder] updateDesign JSON patch failed:",
|
|
734
|
-
{ error:
|
|
751
|
+
{ error: g, llmResponse: n, patches: c, patchTarget: d }
|
|
735
752
|
), S(!1);
|
|
736
753
|
const T = h("applyChangeFailed", e);
|
|
737
754
|
return {
|
|
@@ -740,41 +757,42 @@ Description: ${p.description}`).join(`
|
|
|
740
757
|
status: "success"
|
|
741
758
|
};
|
|
742
759
|
}
|
|
743
|
-
const
|
|
744
|
-
{ response: "", ...
|
|
760
|
+
const u = C(
|
|
761
|
+
{ response: "", ...d },
|
|
745
762
|
{ itemId: s.solution?.itemId ?? null }
|
|
746
|
-
),
|
|
747
|
-
if (!
|
|
763
|
+
), p = J.safeParse(u);
|
|
764
|
+
if (!p.success) {
|
|
748
765
|
console.warn(
|
|
749
766
|
"[SolutionBuilder] updateDesign schema validation failed:",
|
|
750
|
-
{ errors:
|
|
767
|
+
{ errors: p.error.issues, llmResponse: n, patchedDesign: u }
|
|
751
768
|
), S(!1);
|
|
752
|
-
const
|
|
769
|
+
const g = h("applyChangeFailed", e);
|
|
753
770
|
return {
|
|
754
|
-
outputMessage:
|
|
755
|
-
summary:
|
|
771
|
+
outputMessage: g,
|
|
772
|
+
summary: g,
|
|
756
773
|
status: "success"
|
|
757
774
|
};
|
|
758
775
|
}
|
|
759
|
-
const { response:
|
|
760
|
-
|
|
776
|
+
const { response: m, featureLayer: f, ...x } = p.data, b = se(
|
|
777
|
+
f,
|
|
761
778
|
s.featureLayer
|
|
762
|
-
), y =
|
|
763
|
-
{ ...
|
|
779
|
+
), y = C(
|
|
780
|
+
{ ...x, featureLayer: b },
|
|
764
781
|
{
|
|
765
782
|
itemId: s.solution?.itemId,
|
|
766
783
|
sourceBuildSolution: s.sourceBuildSolution,
|
|
767
|
-
templateId: s.templateId ?? t.selectedTemplate ?? null
|
|
784
|
+
templateId: s.templateId ?? t.selectedTemplate ?? null,
|
|
785
|
+
params: s.params ?? null
|
|
768
786
|
}
|
|
769
787
|
);
|
|
770
|
-
let
|
|
771
|
-
if (
|
|
788
|
+
let _ = F(t.selectedTemplate);
|
|
789
|
+
if (_?.initialTemplate || (await H(e), _ = F(t.selectedTemplate)), !_?.initialTemplate)
|
|
772
790
|
throw new Error("No hydrated templates are available for solution design.");
|
|
773
|
-
const
|
|
774
|
-
if (!
|
|
791
|
+
const D = new le(y, _.initialTemplate, !1);
|
|
792
|
+
if (!D.isValid)
|
|
775
793
|
return console.warn(
|
|
776
794
|
"[SolutionBuilder] updateDesign validation failed:",
|
|
777
|
-
{ issues:
|
|
795
|
+
{ issues: D.issues, llmResponse: n, patchedDesign: y }
|
|
778
796
|
), S(!1), {
|
|
779
797
|
outputMessage: h("applyChangeFailed", e)
|
|
780
798
|
};
|
|
@@ -784,10 +802,10 @@ Description: ${p.description}`).join(`
|
|
|
784
802
|
"[SolutionBuilder] updateDesign Esri JSON conversion failed:",
|
|
785
803
|
{ error: V.error, llmResponse: n, design: y }
|
|
786
804
|
);
|
|
787
|
-
const
|
|
805
|
+
const g = h("applyChangeFailed", e);
|
|
788
806
|
return S(!1), {
|
|
789
|
-
outputMessage:
|
|
790
|
-
summary:
|
|
807
|
+
outputMessage: g,
|
|
808
|
+
summary: g,
|
|
791
809
|
status: "success"
|
|
792
810
|
};
|
|
793
811
|
}
|
|
@@ -797,7 +815,7 @@ Description: ${p.description}`).join(`
|
|
|
797
815
|
status: "success",
|
|
798
816
|
currentDesign: y
|
|
799
817
|
};
|
|
800
|
-
}, Tt = (t) => t.currentDesign !== null ? "updateDesign" : "assessInitialRequest", At = (t) => !t.assessment || !t.assessment.isValidUseCase ? "invalidUseCaseExit" : !t.selectedTemplate && t.assessment.matchedTemplates.length > 1 ? "selectTemplateHIL" : "findExistingSolutions", Et = (t) => t.existingMatches.length > 0 ? "confirmContinueBuildingHIL" : "designSolution", Lt = () => new
|
|
818
|
+
}, Tt = (t) => t.currentDesign !== null ? "updateDesign" : "assessInitialRequest", At = (t) => !t.assessment || !t.assessment.isValidUseCase ? "invalidUseCaseExit" : !t.selectedTemplate && t.assessment.matchedTemplates.length > 1 ? "selectTemplateHIL" : "findExistingSolutions", Et = (t) => t.existingMatches.length > 0 ? "confirmContinueBuildingHIL" : "designSolution", Lt = () => new U(fe).addNode("syncCurrentDesignFromContext", xt).addNode("assessInitialRequest", wt).addNode("invalidUseCaseExit", St).addNode("selectTemplateHIL", It).addNode("findExistingSolutions", Ct).addNode("confirmContinueBuildingHIL", _t).addNode("designSolution", be).addNode("updateDesign", kt).addEdge(q, "syncCurrentDesignFromContext").addConditionalEdges("syncCurrentDesignFromContext", Tt, {
|
|
801
819
|
updateDesign: "updateDesign",
|
|
802
820
|
assessInitialRequest: "assessInitialRequest"
|
|
803
821
|
}).addConditionalEdges("assessInitialRequest", At, {
|
|
@@ -807,7 +825,7 @@ Description: ${p.description}`).join(`
|
|
|
807
825
|
}).addEdge("invalidUseCaseExit", A).addEdge("selectTemplateHIL", "findExistingSolutions").addConditionalEdges("findExistingSolutions", Et, {
|
|
808
826
|
confirmContinueBuildingHIL: "confirmContinueBuildingHIL",
|
|
809
827
|
designSolution: "designSolution"
|
|
810
|
-
}).addEdge("confirmContinueBuildingHIL", "designSolution").addEdge("designSolution", A).addEdge("updateDesign", A), Dt = await
|
|
828
|
+
}).addEdge("confirmContinueBuildingHIL", "designSolution").addEdge("designSolution", A).addEdge("updateDesign", A), Dt = await w(L, "description"), Pt = {
|
|
811
829
|
id: "solutionsBuilder",
|
|
812
830
|
name: "Solutions Builder Agent",
|
|
813
831
|
description: Dt,
|
|
@@ -843,7 +861,7 @@ function Rt(t) {
|
|
|
843
861
|
function ve(t) {
|
|
844
862
|
return t && t.helperServices.aiAssistantServices ? `${t.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/api/pre-chat` : null;
|
|
845
863
|
}
|
|
846
|
-
async function
|
|
864
|
+
async function B(t, e, s) {
|
|
847
865
|
const i = await fetch(e, {
|
|
848
866
|
method: "POST",
|
|
849
867
|
headers: {
|
|
@@ -856,28 +874,28 @@ async function N(t, e, s) {
|
|
|
856
874
|
throw new Error(`HTTP ${i.status} calling ${e}`);
|
|
857
875
|
return i.json();
|
|
858
876
|
}
|
|
859
|
-
const Nt = (t) => new Promise((e) => setTimeout(e, t)), ye =
|
|
877
|
+
const Nt = (t) => new Promise((e) => setTimeout(e, t)), ye = v.Root({
|
|
860
878
|
// Provides agentExecutionContext, outputMessage, summary, and status
|
|
861
879
|
// channels with the orchestrator's standard reducers/defaults so the
|
|
862
880
|
// sub-agent reports back through the same shape the orchestrator
|
|
863
881
|
// persists into priorSteps.
|
|
864
|
-
...
|
|
865
|
-
solutionResponse:
|
|
882
|
+
...z(),
|
|
883
|
+
solutionResponse: v({
|
|
866
884
|
reducer: (t, e) => e ?? null,
|
|
867
885
|
default: () => null
|
|
868
886
|
}),
|
|
869
|
-
documentSkillUrl:
|
|
887
|
+
documentSkillUrl: v({
|
|
870
888
|
reducer: (t, e) => e ?? null,
|
|
871
889
|
default: () => null
|
|
872
890
|
}),
|
|
873
891
|
// Persisted across turns via the graph checkpointer so follow-up questions
|
|
874
892
|
// continue the same service conversation. Null on the very first interaction
|
|
875
893
|
// or after messages are cleared.
|
|
876
|
-
conversationId:
|
|
894
|
+
conversationId: v({
|
|
877
895
|
reducer: (t, e) => e ?? t,
|
|
878
896
|
default: () => null
|
|
879
897
|
})
|
|
880
|
-
}), Bt = () => new
|
|
898
|
+
}), Bt = () => new U(ye).addNode("initializeAgent", qt).addNode("askSolutionsQuestions", Ut).addEdge(q, "initializeAgent").addEdge("initializeAgent", "askSolutionsQuestions").addEdge("askSolutionsQuestions", A), xe = async (t, e, s) => {
|
|
881
899
|
if (!t) return;
|
|
882
900
|
const i = ve(t);
|
|
883
901
|
if (!i) return;
|
|
@@ -885,18 +903,18 @@ const Nt = (t) => new Promise((e) => setTimeout(e, t)), ye = b.Root({
|
|
|
885
903
|
kind: "DocAIAssistantRequest",
|
|
886
904
|
filters: {
|
|
887
905
|
products: "ArcGIS Solutions",
|
|
888
|
-
persona: { persona: "solutions" }
|
|
906
|
+
persona: { persona: "apps-solutions" }
|
|
889
907
|
}
|
|
890
908
|
} };
|
|
891
|
-
s && (o.conversationId = s),
|
|
909
|
+
s && (o.conversationId = s), B(o, i, e ?? "");
|
|
892
910
|
}, Ut = async (t, e) => {
|
|
893
|
-
const s =
|
|
911
|
+
const s = j(e), i = t.documentSkillUrl;
|
|
894
912
|
let n = [];
|
|
895
913
|
await I(
|
|
896
914
|
{ text: s.agentProgress.explorerAgentSearching },
|
|
897
915
|
e
|
|
898
916
|
);
|
|
899
|
-
let o = await
|
|
917
|
+
let o = await B(
|
|
900
918
|
{
|
|
901
919
|
message: t.agentExecutionContext.userRequest,
|
|
902
920
|
conversationId: e?.configurable?.context?.convoId ?? void 0,
|
|
@@ -904,7 +922,7 @@ const Nt = (t) => new Promise((e) => setTimeout(e, t)), ye = b.Root({
|
|
|
904
922
|
kind: "DocAIAssistantRequest",
|
|
905
923
|
filters: {
|
|
906
924
|
products: "ArcGIS Solutions",
|
|
907
|
-
persona: { persona: "solutions" }
|
|
925
|
+
persona: { persona: "apps-solutions" }
|
|
908
926
|
}
|
|
909
927
|
}
|
|
910
928
|
},
|
|
@@ -918,27 +936,27 @@ const Nt = (t) => new Promise((e) => setTimeout(e, t)), ye = b.Root({
|
|
|
918
936
|
hasMore: o.hasMore,
|
|
919
937
|
ackSequenceNumber: o.sequenceNumber,
|
|
920
938
|
inquiryId: o.inquiryId
|
|
921
|
-
}, l = "",
|
|
922
|
-
const
|
|
923
|
-
const
|
|
924
|
-
if (
|
|
925
|
-
const
|
|
926
|
-
l =
|
|
939
|
+
}, l = "", c = null;
|
|
940
|
+
const d = async (m) => {
|
|
941
|
+
const f = m.context?.results?.[0]?.reply ?? "";
|
|
942
|
+
if (f !== "") {
|
|
943
|
+
const b = Mt(f), y = Ft(b, e);
|
|
944
|
+
l = y.source, n = [
|
|
927
945
|
...n,
|
|
928
|
-
...
|
|
929
|
-
(
|
|
946
|
+
...y.allMatches.filter(
|
|
947
|
+
(_) => !n.some((D) => D.solution.id === _.solution.id)
|
|
930
948
|
)
|
|
931
949
|
];
|
|
932
950
|
}
|
|
933
|
-
|
|
934
|
-
const
|
|
935
|
-
if (
|
|
936
|
-
let
|
|
937
|
-
|
|
951
|
+
f !== "" && m.context?.results?.[0]?.followupQuestions && (c = m.context.results[0].followupQuestions);
|
|
952
|
+
const x = m.context?.results?.[0]?.status?.currentStatusStep;
|
|
953
|
+
if (x) {
|
|
954
|
+
let b = "";
|
|
955
|
+
x === 1 ? b = s.agentProgress.explorerAgentReading : x === 2 ? b = s.agentProgress.explorerAgentReviewing : x === 3 && (b = s.agentProgress.explorerAgentPreparing), await I({ text: b }, e);
|
|
938
956
|
}
|
|
939
957
|
};
|
|
940
|
-
for (await
|
|
941
|
-
await Nt(500), o = await
|
|
958
|
+
for (await d(o); r.hasMore; )
|
|
959
|
+
await Nt(500), o = await B(
|
|
942
960
|
{
|
|
943
961
|
conversationId: r.conversationId,
|
|
944
962
|
ackSequenceNumber: r.ackSequenceNumber,
|
|
@@ -952,12 +970,16 @@ const Nt = (t) => new Promise((e) => setTimeout(e, t)), ye = b.Root({
|
|
|
952
970
|
hasMore: o.hasMore,
|
|
953
971
|
ackSequenceNumber: o.sequenceNumber,
|
|
954
972
|
inquiryId: o.inquiryId
|
|
955
|
-
}, await
|
|
956
|
-
if (
|
|
957
|
-
const
|
|
958
|
-
setTimeout(() =>
|
|
973
|
+
}, await d(o);
|
|
974
|
+
if (c && e?.configurable?.context?.updateSuggestedPrompts) {
|
|
975
|
+
const m = e.configurable.context.updateSuggestedPrompts, f = c;
|
|
976
|
+
setTimeout(() => m(f), 0);
|
|
959
977
|
}
|
|
960
|
-
|
|
978
|
+
ve(e?.configurable?.context.portal) && xe(e?.configurable?.context.portal, e?.configurable?.context.token ?? "", r.conversationId), n.length && (n.length === 1 ? ne(n[0].solution.id) : ie(n));
|
|
979
|
+
const p = new CustomEvent("assistantProcessing", {
|
|
980
|
+
detail: !1
|
|
981
|
+
});
|
|
982
|
+
return window.dispatchEvent(p), {
|
|
961
983
|
outputMessage: l,
|
|
962
984
|
summary: l,
|
|
963
985
|
status: "success",
|
|
@@ -969,14 +991,14 @@ const Nt = (t) => new Promise((e) => setTimeout(e, t)), ye = b.Root({
|
|
|
969
991
|
return t.documentSkillUrl === null && e?.configurable?.context?.portal && (s = Rt(e.configurable.context.portal)), {
|
|
970
992
|
documentSkillUrl: s
|
|
971
993
|
};
|
|
972
|
-
}, zt = await
|
|
994
|
+
}, zt = await w($t, "solutions_explorer_description"), Ot = {
|
|
973
995
|
id: "solutionsExplorer",
|
|
974
996
|
name: "Solutions Explorer Agent",
|
|
975
997
|
description: zt,
|
|
976
998
|
createGraph: Bt,
|
|
977
999
|
workspace: ye
|
|
978
1000
|
}, jt = "https://links.esri.com/solutions/agol-organizational-account", Jt = "https://links.esri.com/solutions/configure-assistants";
|
|
979
|
-
class Gt extends
|
|
1001
|
+
class Gt extends Ce {
|
|
980
1002
|
constructor() {
|
|
981
1003
|
super(), this.open = !1, this.userFirstName = "", this.builderVisible = !1, this.hasActiveBuilderDesign = !1, this._conversationId = void 0, this._orgSettings = {
|
|
982
1004
|
aiAssistantsEnabled: !1,
|
|
@@ -1108,14 +1130,14 @@ class Gt extends _e {
|
|
|
1108
1130
|
}
|
|
1109
1131
|
}
|
|
1110
1132
|
_parseAgentPickedAndTask(e) {
|
|
1111
|
-
const s = Array.from(this._assistantRef.value?.messages || []), i = e.log || [], r = [...s].sort((
|
|
1133
|
+
const s = Array.from(this._assistantRef.value?.messages || []), i = e.log || [], r = [...s].sort((m, f) => f.id - m.id).find((m) => m.role === "user" && m.id <= e.id)?.content || null, l = i.find((m) => typeof m == "string" && m.includes("Agent picked:")) ?? null;
|
|
1112
1134
|
if (!l)
|
|
1113
1135
|
return { agentPicked: null, taskAssigned: null, userMessage: r };
|
|
1114
|
-
const
|
|
1115
|
-
if (!
|
|
1136
|
+
const c = /Agent picked:\s*(.*?)\s*(?:\\n|\r?\n)\s*Task Assigned:\s*([\s\S]*)$/i, d = l.match(c);
|
|
1137
|
+
if (!d)
|
|
1116
1138
|
return { agentPicked: null, taskAssigned: null, userMessage: r };
|
|
1117
|
-
const
|
|
1118
|
-
return { agentPicked:
|
|
1139
|
+
const u = d[1].trim(), p = d[2].trim();
|
|
1140
|
+
return { agentPicked: u, taskAssigned: p, userMessage: r };
|
|
1119
1141
|
}
|
|
1120
1142
|
_emitItemIdFromAI(e) {
|
|
1121
1143
|
const s = new CustomEvent("solutionIDFromAssistant", {
|