@esri/solutions-components 5.1.0-next.129 → 5.1.0-next.130
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/CSS4AELA.js +2 -0
- package/dist/cdn/EVGXFAJU.js +2 -0
- package/dist/cdn/J5K2SIY6.js +4 -0
- package/dist/cdn/{HZOBBQYW.js → JSQHZGE3.js} +91 -91
- package/dist/cdn/RMCQZMLA.js +2 -0
- package/dist/cdn/U4A4FLFF.js +2 -0
- package/dist/cdn/{N2UNOXJ6.js → W5L4RUZC.js} +1 -1
- package/dist/cdn/{DYCGZ67C.js → WK7CB4GW.js} +1 -1
- package/dist/cdn/{6IMLSV3Z.js → YZVDT3ZT.js} +1 -1
- package/dist/cdn/Z4BCFJUQ.js +88 -0
- package/dist/cdn/ZTO4S3BZ.js +2 -0
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.json +1 -1
- package/dist/cdn/assets/create-feature/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/create-feature/t9n/messages.json +1 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/crowdsource-reporter/t9n/messages.json +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/updateDesign.js +1 -1
- package/dist/components/arcgis-solutions-assistant/customElement.d.ts +6 -0
- package/dist/components/arcgis-solutions-assistant/customElement.js +340 -340
- package/dist/components/create-feature/customElement.d.ts +35 -3
- package/dist/components/create-feature/customElement.js +176 -76
- package/dist/components/create-feature/index.js +2 -1
- package/dist/components/create-related-feature/customElement.d.ts +4 -4
- package/dist/components/create-related-feature/customElement.js +60 -80
- package/dist/components/create-related-feature/index.js +1 -0
- package/dist/components/crowdsource-reporter/customElement.d.ts +16 -2
- package/dist/components/crowdsource-reporter/customElement.js +75 -49
- package/dist/components/feature-list/customElement.d.ts +1 -1
- package/dist/components/feature-list/customElement.js +2 -2
- package/dist/components/layer-list/customElement.d.ts +1 -1
- package/dist/components/solution-builder-assistant/customElement.js +97 -98
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/loader.js +2 -2
- package/dist/solutions-components_commit.txt +7 -7
- package/dist/types/lumina.d.ts +2 -2
- package/dist/types/preact.d.ts +2 -2
- package/dist/types/react.d.ts +2 -2
- package/dist/types/stencil.d.ts +2 -2
- package/dist/utils/interfaces.d.ts +17 -0
- package/package.json +1 -1
- package/dist/cdn/53MDMQSB.js +0 -88
- package/dist/cdn/H4YPSJ5G.js +0 -2
- package/dist/cdn/KLCBAO3U.js +0 -4
- package/dist/cdn/NSKVOAA7.js +0 -2
- package/dist/cdn/ODB4CELR.js +0 -2
- package/dist/cdn/QYWT7Y5Q.js +0 -2
- package/dist/cdn/UYOTCDME.js +0 -2
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import { c as
|
|
3
|
-
import { u as
|
|
4
|
-
import { LitElement as
|
|
5
|
-
import { css as
|
|
6
|
-
import { unsafeHTML as
|
|
7
|
-
import { useContextConsumer as
|
|
8
|
-
import { c as
|
|
9
|
-
import { T as
|
|
10
|
-
import { c as
|
|
11
|
-
import
|
|
12
|
-
import { createRef as
|
|
13
|
-
import { Annotation as
|
|
14
|
-
import { createAgentRuntimeState as z, sendTraceMessage as
|
|
15
|
-
import "@langchain/core/messages";
|
|
2
|
+
import { c as Ie } from "../../chunks/runtime.js";
|
|
3
|
+
import { u as Ce } from "../../chunks/useT9n.js";
|
|
4
|
+
import { LitElement as _e, createEvent as K, nothing as W } from "@arcgis/lumina";
|
|
5
|
+
import { css as ke, html as T } from "lit";
|
|
6
|
+
import { unsafeHTML as Te } from "lit/directives/unsafe-html.js";
|
|
7
|
+
import { useContextConsumer as Y } from "@arcgis/lumina/context";
|
|
8
|
+
import { c as Ae, b as Ee } from "../../chunks/deployAppContexts.js";
|
|
9
|
+
import { T as Le } from "../../chunks/interfaces.js";
|
|
10
|
+
import { c as De } from "../../chunks/helpers.js";
|
|
11
|
+
import Z from "@arcgis/core/config.js";
|
|
12
|
+
import { createRef as Me, ref as $e } from "lit-html/directives/ref.js";
|
|
13
|
+
import { Annotation as y, StateGraph as U, START as q, END as E, NodeInterrupt as ee } from "@langchain/langgraph/web";
|
|
14
|
+
import { createAgentRuntimeState as z, sendTraceMessage as C, invokeTextPrompt as Pe, invokeStructuredPrompt as R, getEmbeddings as Fe, cosineSimilarity as Re } from "@arcgis/ai-orchestrator";
|
|
16
15
|
import * as O from "@esri/arcgis-rest-portal";
|
|
17
|
-
import { applyPatch as
|
|
18
|
-
import
|
|
16
|
+
import { applyPatch as Ne } from "fast-json-patch";
|
|
17
|
+
import "@langchain/core/messages";
|
|
18
|
+
import { C as te } from "../../chunks/converter.js";
|
|
19
19
|
import a from "zod";
|
|
20
|
-
import { g as F, d as
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
const
|
|
20
|
+
import { g as F, d as se, r as ie, t as Be, T as L } from "../../chunks/templates.js";
|
|
21
|
+
import Ue from "@arcgis/core/portal/Portal.js";
|
|
22
|
+
import qe from "@arcgis/core/portal/PortalItem.js";
|
|
23
|
+
const ze = ke`:host{display:block;height:100%}.margin-lg{margin:var(--calcite-spacing-lg)}.display-flex-row{display:flex;flex-direction:row}.assistant-split-container{display:flex;width:100%;height:calc(100vh - 78px);overflow:hidden;border-radius:10px}.assistant-panel{display:flex;flex-direction:column;height:100%;border:1px solid var(--calcite-color-surface-3);background-color:var(--calcite-color-surface-2);overflow:hidden}.chat-panel{min-width:320px}.builder-panel{min-width:320px;max-width:100%;border-left:1px solid var(--calcite-color-surface-3)}.panel-actions{display:flex;gap:8px;padding:6px;align-items:center}.builder-header,.builder-footer{padding:10px;background:var(--calcite-color-surface-1);border-bottom:1px solid var(--calcite-color-surface-3)}.builder-content{flex:1;overflow:auto;padding:12px}.builder-content pre{white-space:pre-wrap;word-wrap:break-word;max-height:100%;overflow:auto}.builder-actions{display:flex;gap:6px;align-items:center}.padding-left-10{padding-left:10px}.chat-container{display:flex;flex-direction:column;gap:0px;max-width:600px;height:75%;background-color:var(--calcite-color-surface-4);padding:1px}.chat-container_expanded{display:flex;flex-direction:column;gap:0px;max-width:100%;height:95%;background-color:var(--calcite-color-surface-1);border-radius:10px;padding:10px}.chat-panel{--calcite-color-focus: var(--calcite-color-brand);--calcite-panel-border-color: var(--calcite-color-border-2);--calcite-internal-panel-header-vertical-padding: 0px;--calcite-panel-header-content-space: 0px;border:var(--calcite-border-width-sm) solid var(--calcite-color-border-2);height:100%}.header-content{display:flex;align-items:center;gap:var(--calcite-spacing-sm);height:65px;box-sizing:border-box;padding-inline-start:var(--calcite-space-2xl)}.header-title{font-size:var(--calcite-font-size-md);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-text-1)}.beta-chip{--calcite-chip-corner-radius: var(--calcite-corner-radius-half)}.chat-panel calcite-card,.chat-panel calcite-text-area,.chat-panel calcite-button,.chat-panel .chat-messages,.chat-panel .chat-input{--calcite-color-focus: var(--calcite-color-brand)}.assistant-followup-chip:focus{outline:2px solid var(--calcite-color-brand)}.chat-panel-heading{font-size:var(--calcite-font-size-0);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-surface-1, var(--calcite-color-text-1))}.chat-messages{display:flex;flex-direction:column;gap:20px;padding:4px;height:100%;overflow-y:auto}.user-message{align-self:flex-end;background:var(--calcite-color-brand);border-radius:8px;max-width:90%;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-brand);--calcite-card-border-color: var(--calcite-color-brand);color:var(--calcite-color-text-inverse);text-align:left}.system-message{align-self:flex-start;background:var(--calcite-color-surface-3);border-radius:8px;max-width:90%;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-surface-4);--calcite-card-border-color: var(--calcite-color-surface-4);color:var(--calcite-color-inverse);text-align:left}.loader-message{align-self:flex-start;background:var(--calcite-color-surface-4);border-radius:8px;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-surface-4);--calcite-card-border-color: var(--calcite-color-surface-4)}.message-content{padding:0;font-size:14px}.response-message.message-content>p:first-of-type{margin-top:0}.message-content img{max-width:100%;height:auto;display:block;object-fit:contain}.message-content-pad{padding-bottom:10px;font-size:14px}.message-content-summary{padding-bottom:14px}.message-content-alignment{display:flex;align-items:center;gap:var(--calcite-spacing-md);font-size:var(--calcite-font-size--1);color:var(--calcite-color-text-1)}.padding-top-10{padding-top:10px}.padding-right-8{padding-right:8px}.padding-left-right-5{padding-right:5px;padding-left:5px}.chip-content{padding:5px 5px 5px 0}.chat-input{display:flex;flex-direction:row;flex-grow:1}.table-cell{--calcite-table-cell-background: var(--calcite-color-surface-4)}.cursor-pointer{cursor:pointer}.notice-border-color{--temp-initial-brand: var(--calcite-color-brand)}.notice-border-color calcite-notice{--calcite-color-brand: #ddd;--calcite-icon-color: var(--temp-initial-brand)}.notice-border-color calcite-notice *{--calcite-color-brand: var(--temp-initial-brand)}.solution-card{padding:5px 0;text-decoration:none;display:block;width:100%;cursor:pointer}.solution-card calcite-card{display:flex;flex-direction:column;max-width:520px;overflow:hidden;--calcite-card-corner-radius: var(--calcite-corner-radius-round) !important;--calcite-card-shadow: var(--calcite-shadow-sm);--calcite-card-background-color: var(--calcite-card-background-color) }.solution-card div[slot=thumbnail]{max-height:100%;width:100%;position:relative;&:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;transition:all .15s ease-in-out}}.solution-card div[slot=thumbnail] img{max-height:100%;width:100%;object-fit:cover}.solution-card span[slot=description]{padding-top:10px}.solution-card calcite-chip{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);visibility:hidden;pointer-events:none;opacity:0;transition:all .15s ease-in-out;z-index:9999}.solution-card:hover calcite-chip{visibility:visible;opacity:1}.solution-card:hover div[slot=thumbnail]:after{background-color:#00000080}.solution-card:hover h3{text-decoration:underline}.solution-card:focus{outline:2px solid var(--calcite-color-brand)}.references-container{padding-top:10px;display:block}.references-container.collapsed{display:none}.width-100{width:100%}.disclaimer-div{display:flex;align-items:center;gap:var(--calcite-spacing-sm);font-size:var(--calcite-font-size--0);color:var(--calcite-color-text-1)}.display-none{display:none}.chat-messages calcite-fab{position:absolute;bottom:16px;left:50%;transform:translate(-50%);z-index:999}.icon-color-background{--calcite-button-icon-color: var(--calcite-color-surface-1)}#closeAssistantButton{--calcite-action-text-color: var(--calcite-color-text-1)}.icon-color-background:focus{--calcite-color-focus: var(--calcite-color-surface-1)}@media(max-width:430px){.solution-card .solution-snippet{display:none}}.height-32-flex-auto{height:32px;flex:0 0 auto}.margin-top-0.message-content>p:first-of-type{margin-top:0}a:not(.solution-card){color:var(--calcite-link-text-color, var(--calcite-color-text-link));cursor:pointer;text-decoration:none;line-height:inherit;background-image:linear-gradient(currentColor,currentColor),linear-gradient(var(--calcite-color-brand-underline),var(--calcite-color-brand-underline));background-position-x:0%,100%;background-position-y:min(1.5em,100%);background-repeat:no-repeat,no-repeat;background-size:0% 1px,100% 1px;transition-property:background-size,color;transition-duration:var(--calcite-animation-timing, .15s);transition-timing-function:ease-in-out;outline-color:transparent;position:relative}a:not(.solution-card):hover{background-size:100% 1px,100% 1px}a:not(.solution-card):focus{outline:2px solid var(--calcite-color-brand);outline-offset:2px;outline-color:var(--calcite-color-brand)}a:not(.solution-card):active{color:var(--calcite-color-brand-press)}`;
|
|
24
24
|
async function w(t, e) {
|
|
25
25
|
const s = Object.entries(t).find(
|
|
26
26
|
([i]) => i.endsWith(`/${e}.md`)
|
|
@@ -37,7 +37,7 @@ ${Object.keys(t).join(`
|
|
|
37
37
|
function j(t) {
|
|
38
38
|
return t?.configurable?.context?.translations;
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function ne(t) {
|
|
41
41
|
if (typeof window > "u" || t.length <= 1)
|
|
42
42
|
return;
|
|
43
43
|
const e = t.map((i) => i.solution.id), s = t.map((i) => i.solution.title);
|
|
@@ -59,7 +59,7 @@ function ie(t) {
|
|
|
59
59
|
}
|
|
60
60
|
}));
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function oe(t) {
|
|
63
63
|
if (typeof window > "u" || !t)
|
|
64
64
|
return;
|
|
65
65
|
const e = new CustomEvent("solutionIDFromAssistant", {
|
|
@@ -69,7 +69,35 @@ function ne(t) {
|
|
|
69
69
|
});
|
|
70
70
|
window.dispatchEvent(e);
|
|
71
71
|
}
|
|
72
|
-
const
|
|
72
|
+
const ae = /* @__PURE__ */ Object.assign({
|
|
73
|
+
"./prompts/solutions_assistant_description.md": () => import("../../chunks/solutions_assistant_description.js").then((t) => t.default),
|
|
74
|
+
"./prompts/solutions_assistant_prompts.md": () => import("../../chunks/solutions_assistant_prompts.js").then((t) => t.default)
|
|
75
|
+
}), re = y.Root({
|
|
76
|
+
...z()
|
|
77
|
+
}), Oe = async (t, e) => {
|
|
78
|
+
const s = j(e);
|
|
79
|
+
await C(
|
|
80
|
+
{ text: s?.executingSolutionsAssistantAgent || "Preparing a response..." },
|
|
81
|
+
e
|
|
82
|
+
);
|
|
83
|
+
const i = await w(ae, "solutions_assistant_prompts"), n = t.agentExecutionContext.messages.slice(-11), o = await Pe({
|
|
84
|
+
promptText: i,
|
|
85
|
+
modelTier: "fast",
|
|
86
|
+
temperature: 0,
|
|
87
|
+
messages: n
|
|
88
|
+
}), r = e?.configurable?.context?.clearSuggestedPrompts;
|
|
89
|
+
r && r();
|
|
90
|
+
const l = new CustomEvent("assistantProcessing", {
|
|
91
|
+
detail: !1
|
|
92
|
+
});
|
|
93
|
+
return window.dispatchEvent(l), { outputMessage: o, summary: o, status: "success" };
|
|
94
|
+
}, je = () => new U(re).addNode("assistantLLM", Oe).addEdge(q, "assistantLLM").addEdge("assistantLLM", E), Je = await w(ae, "solutions_assistant_description"), Ge = {
|
|
95
|
+
id: "solutionsAssistant",
|
|
96
|
+
name: "Solutions Assistant Agent",
|
|
97
|
+
description: Je,
|
|
98
|
+
createGraph: je,
|
|
99
|
+
workspace: re
|
|
100
|
+
}, le = (t) => {
|
|
73
101
|
if (t && Array.isArray(t.id) && t.id.length > 0)
|
|
74
102
|
return t.id[t.id.length - 1].replace("Message", "").toLowerCase();
|
|
75
103
|
if (t && typeof t._getType == "function")
|
|
@@ -79,8 +107,8 @@ const oe = (t) => {
|
|
|
79
107
|
return "human";
|
|
80
108
|
}
|
|
81
109
|
return "human";
|
|
82
|
-
},
|
|
83
|
-
const e =
|
|
110
|
+
}, He = (t) => {
|
|
111
|
+
const e = le(t);
|
|
84
112
|
if (t && t.kwargs)
|
|
85
113
|
return {
|
|
86
114
|
role: e,
|
|
@@ -95,44 +123,9 @@ const oe = (t) => {
|
|
|
95
123
|
return t.id && (s.id = t.id), t.name && (s.name = t.name), t.additional_kwargs && (s.additional_kwargs = t.additional_kwargs), t.response_metadata && (s.response_metadata = t.response_metadata), s;
|
|
96
124
|
}
|
|
97
125
|
return { role: "human", content: String(t) };
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return [];
|
|
102
|
-
const i = s.length > e ? s[s.length - e] : s[0];
|
|
103
|
-
return t.slice(i).map(ze);
|
|
104
|
-
}, ae = /* @__PURE__ */ Object.assign({
|
|
105
|
-
"./prompts/solutions_assistant_description.md": () => import("../../chunks/solutions_assistant_description.js").then((t) => t.default),
|
|
106
|
-
"./prompts/solutions_assistant_prompts.md": () => import("../../chunks/solutions_assistant_prompts.js").then((t) => t.default)
|
|
107
|
-
}), re = v.Root({
|
|
108
|
-
...z()
|
|
109
|
-
}), Je = async (t, e) => {
|
|
110
|
-
const s = j(e);
|
|
111
|
-
await I(
|
|
112
|
-
{ text: s?.executingSolutionsAssistantAgent || "Preparing a response..." },
|
|
113
|
-
e
|
|
114
|
-
);
|
|
115
|
-
const i = await w(ae, "solutions_assistant_prompts"), n = t.agentExecutionContext.messages.slice(-10), o = await $e({
|
|
116
|
-
promptText: i,
|
|
117
|
-
modelTier: "default",
|
|
118
|
-
temperature: 0.7,
|
|
119
|
-
// getAgentContext returns MessageFieldWithRole format which LangChain coerces to BaseMessage
|
|
120
|
-
messages: je(n)
|
|
121
|
-
}), r = e?.configurable?.context?.clearSuggestedPrompts;
|
|
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 = {
|
|
128
|
-
id: "solutionsAssistant",
|
|
129
|
-
name: "Solutions Assistant Agent",
|
|
130
|
-
description: He,
|
|
131
|
-
createGraph: Ge,
|
|
132
|
-
workspace: re
|
|
133
|
-
}, Ke = { 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 an existing solution that closely matches your use case and may already meet your needs: {{solutionMatch}}. Do you want to continue building your solution?", 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." }, We = {
|
|
134
|
-
builderMessages: Ke
|
|
135
|
-
}, Qe = /* @__PURE__ */ new Set([
|
|
126
|
+
}, Qe = (t) => le(t) === "human", Ve = (t, e = 3) => t.filter((s) => Qe(s)).slice(-e).map(He), Ke = (t, e = " ") => Ve(t).map((n) => n.content).join(e).trim(), We = { 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 an existing solution that closely matches your use case and may already meet your needs: {{solutionMatch}}. Do you want to continue building your solution?", 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?" }, Ye = {
|
|
127
|
+
builderMessages: We
|
|
128
|
+
}, Ze = /* @__PURE__ */ new Set([
|
|
136
129
|
"add",
|
|
137
130
|
"all",
|
|
138
131
|
"alter",
|
|
@@ -195,7 +188,7 @@ const oe = (t) => {
|
|
|
195
188
|
"view",
|
|
196
189
|
"where"
|
|
197
190
|
]);
|
|
198
|
-
class
|
|
191
|
+
class ce {
|
|
199
192
|
constructor(e, s, i = !0) {
|
|
200
193
|
this.isValid = !0, this.issues = [], this.response = e, this.template = s, this.newDesign = i, this.validate();
|
|
201
194
|
}
|
|
@@ -267,7 +260,7 @@ class le {
|
|
|
267
260
|
this.validateField(o);
|
|
268
261
|
}
|
|
269
262
|
validateField(e) {
|
|
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.`),
|
|
263
|
+
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.`), Ze.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)) {
|
|
271
264
|
const s = Math.max(...e.choiceList.map((i) => i.length));
|
|
272
265
|
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}.`));
|
|
273
266
|
}
|
|
@@ -276,11 +269,11 @@ class le {
|
|
|
276
269
|
console.debug(e), this.issues.push(e), this.isValid = !1;
|
|
277
270
|
}
|
|
278
271
|
}
|
|
279
|
-
const
|
|
272
|
+
const Xe = a.object({
|
|
280
273
|
key: a.string().describe("Stable key identifier for the string."),
|
|
281
274
|
value: a.string().describe("Display value for the string."),
|
|
282
275
|
description: a.string().describe("Explanation of where/how the string is used.")
|
|
283
|
-
}),
|
|
276
|
+
}), et = a.object({
|
|
284
277
|
id: a.string().describe("ArcGIS item id (32 hex characters)."),
|
|
285
278
|
title: a.string().describe("Item title."),
|
|
286
279
|
description: a.string().describe("Item description."),
|
|
@@ -303,7 +296,7 @@ const Ye = a.object({
|
|
|
303
296
|
"Notebook",
|
|
304
297
|
"QuickCapture Project"
|
|
305
298
|
]).describe("ArcGIS item type.")
|
|
306
|
-
}),
|
|
299
|
+
}), X = a.object({
|
|
307
300
|
name: a.string().describe("Field name."),
|
|
308
301
|
type: a.enum(["string", "integer", "double", "date", "oid", "guid", "globalid"]).describe("Field data type."),
|
|
309
302
|
alias: a.string().describe("Field alias for display."),
|
|
@@ -312,17 +305,17 @@ const Ye = a.object({
|
|
|
312
305
|
"List of allowed values for string fields with a controlled vocabulary. Null if unrestricted or not applicable."
|
|
313
306
|
),
|
|
314
307
|
length: a.number().int().nullable().describe("Maximum string length for string fields. Null for non-string fields.")
|
|
315
|
-
}),
|
|
308
|
+
}), tt = a.object({
|
|
316
309
|
id: a.number().int().describe("Layer/table id within the feature service."),
|
|
317
310
|
type: a.enum(["Point", "Polyline", "Polygon", "Table"]).describe("Layer type."),
|
|
318
311
|
name: a.string().describe("Layer/table name."),
|
|
319
312
|
description: a.string().describe("Layer/table description."),
|
|
320
|
-
customFields: a.array(
|
|
321
|
-
requiredFields: a.array(
|
|
322
|
-
}),
|
|
313
|
+
customFields: a.array(X).describe("User/business fields specific to the solution."),
|
|
314
|
+
requiredFields: a.array(X).describe("Fields required for solution functionality (e.g., relationship keys).")
|
|
315
|
+
}), st = a.object({
|
|
323
316
|
itemId: a.string().describe("ArcGIS item id for the feature layer."),
|
|
324
317
|
addLayers: a.boolean().describe("Indicates whether new layers can be added during solution design."),
|
|
325
|
-
layers: a.array(
|
|
318
|
+
layers: a.array(tt)
|
|
326
319
|
}), J = a.object({
|
|
327
320
|
response: a.string().describe("Conversational response to the user's query."),
|
|
328
321
|
solution: a.object({
|
|
@@ -330,50 +323,50 @@ const Ye = a.object({
|
|
|
330
323
|
title: a.string().describe("Title of the solution."),
|
|
331
324
|
description: a.string().describe("Description of the solution."),
|
|
332
325
|
tags: a.array(a.string()).describe("Keywords/tags associated with the solution."),
|
|
333
|
-
strings: a.array(
|
|
326
|
+
strings: a.array(Xe).describe("Localized strings/labels used by apps (dashboards, forms, etc.).")
|
|
334
327
|
}),
|
|
335
|
-
items: a.array(
|
|
336
|
-
featureLayer:
|
|
337
|
-
}),
|
|
328
|
+
items: a.array(et).describe("ArcGIS items that belong to the solution (apps, maps, layers, etc.)."),
|
|
329
|
+
featureLayer: st.describe("Primary feature layer item and its schema/layers/tables details.")
|
|
330
|
+
}), it = a.object({
|
|
338
331
|
op: a.enum(["add", "remove", "replace", "move", "copy"]).describe("RFC 6902 operation type."),
|
|
339
332
|
path: a.string().describe("RFC 6901 JSON Pointer to the target location."),
|
|
340
333
|
value: a.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.`),
|
|
341
334
|
from: a.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.")
|
|
342
|
-
}),
|
|
335
|
+
}), nt = a.object({
|
|
343
336
|
response: a.string().describe("Conversational response describing the accepted design changes."),
|
|
344
|
-
patches: a.array(
|
|
345
|
-
}),
|
|
337
|
+
patches: a.array(it).describe("Minimal RFC 6902 patch operations needed to update the current design.")
|
|
338
|
+
}), ot = a.object({
|
|
346
339
|
matchedTitles: a.array(a.string()).describe("Titles of solutions that match the user's request. Empty array if no strong match.")
|
|
347
|
-
}),
|
|
340
|
+
}), at = a.object({
|
|
348
341
|
templateId: a.string().min(1).describe("Template id from the available template list."),
|
|
349
342
|
confidence: a.number().min(0).max(1).describe("Confidence score from 0 to 1 for this template match."),
|
|
350
343
|
templateDescription: a.string().min(1).describe("Short description this template in the user's use case/workflow.")
|
|
351
|
-
}),
|
|
344
|
+
}), rt = a.object({
|
|
352
345
|
assistantResponse: a.string().describe("Natural-language response for the user."),
|
|
353
346
|
isValidUseCase: a.boolean().describe("True only when the request is concrete, appropriate, and has at least one matching template."),
|
|
354
|
-
matchedTemplates: a.array(
|
|
355
|
-
}), G = (t) => t in
|
|
356
|
-
let
|
|
357
|
-
const
|
|
347
|
+
matchedTemplates: a.array(at).describe("Ordered list of matching templates, best match first. Empty when no valid match exists.")
|
|
348
|
+
}), G = (t) => t in L, lt = 5, ct = 0.8, dt = 0.15, ut = "Web Mapping Application", pt = "Embeddings";
|
|
349
|
+
let M = null, N = null, $ = null, P = null;
|
|
350
|
+
const mt = "Build", D = /* @__PURE__ */ Object.assign({
|
|
358
351
|
"./prompts/description.md": () => import("../../chunks/description.js").then((t) => t.default),
|
|
359
352
|
"./prompts/designSolution.md": () => import("../../chunks/designSolution.js").then((t) => t.default),
|
|
360
353
|
"./prompts/findExistingSolution.md": () => import("../../chunks/findExistingSolution.js").then((t) => t.default),
|
|
361
354
|
"./prompts/initialAssessment.md": () => import("../../chunks/initialAssessment.js").then((t) => t.default),
|
|
362
355
|
"./prompts/updateDesign.md": () => import("../../chunks/updateDesign.js").then((t) => t.default)
|
|
363
|
-
}),
|
|
364
|
-
let n = j(e)?.builderMessages?.[t] ??
|
|
356
|
+
}), gt = Ye.builderMessages, f = (t, e, s) => {
|
|
357
|
+
let n = j(e)?.builderMessages?.[t] ?? gt[t];
|
|
365
358
|
if (!s)
|
|
366
359
|
return n;
|
|
367
360
|
for (const [o, r] of Object.entries(s))
|
|
368
361
|
n = n.replaceAll(`{{${o}}}`, r);
|
|
369
362
|
return n;
|
|
370
|
-
},
|
|
363
|
+
}, de = (t) => {
|
|
371
364
|
typeof window < "u" && window.dispatchEvent(new CustomEvent("arcgis-solution-design-update", {
|
|
372
365
|
detail: t
|
|
373
366
|
}));
|
|
374
|
-
},
|
|
367
|
+
}, ht = async (t, e, s) => {
|
|
375
368
|
if (!t) return null;
|
|
376
|
-
const i = `type:"${
|
|
369
|
+
const i = `type:"${ut}" AND typekeywords:${pt} AND group:${t}`;
|
|
377
370
|
return (await O.searchItems({
|
|
378
371
|
q: i,
|
|
379
372
|
params: e ? { token: e } : void 0,
|
|
@@ -381,26 +374,26 @@ const ut = "Build", L = /* @__PURE__ */ Object.assign({
|
|
|
381
374
|
num: 1
|
|
382
375
|
}))?.results?.[0] ?? null;
|
|
383
376
|
};
|
|
384
|
-
async function
|
|
377
|
+
async function ft(t, e, s) {
|
|
385
378
|
try {
|
|
386
|
-
const i = await
|
|
379
|
+
const i = await ht(t, e, s);
|
|
387
380
|
if (!i) return null;
|
|
388
|
-
const n = new
|
|
381
|
+
const n = new qe({ id: i.id });
|
|
389
382
|
return await n.load(), await n.fetchData("json");
|
|
390
383
|
} catch {
|
|
391
384
|
return null;
|
|
392
385
|
}
|
|
393
386
|
}
|
|
394
|
-
const
|
|
387
|
+
const bt = async (t, e, s) => {
|
|
395
388
|
if (!t) return [];
|
|
396
|
-
const i = `type:Solution AND typekeywords:${
|
|
389
|
+
const i = `type:Solution AND typekeywords:${mt} AND group:${t}`;
|
|
397
390
|
return (await O.searchItems({
|
|
398
391
|
q: i,
|
|
399
392
|
params: e ? { token: e } : void 0,
|
|
400
393
|
portal: s,
|
|
401
394
|
num: 100
|
|
402
395
|
}))?.results ?? [];
|
|
403
|
-
},
|
|
396
|
+
}, yt = async (t, e, s) => {
|
|
404
397
|
try {
|
|
405
398
|
const i = await O.getItemData(t, {
|
|
406
399
|
params: e ? { token: e } : void 0,
|
|
@@ -412,7 +405,7 @@ const ht = async (t, e, s) => {
|
|
|
412
405
|
} catch {
|
|
413
406
|
return null;
|
|
414
407
|
}
|
|
415
|
-
},
|
|
408
|
+
}, _ = (t, e = {}) => {
|
|
416
409
|
let s = t;
|
|
417
410
|
return "itemId" in e && (s = {
|
|
418
411
|
...s,
|
|
@@ -430,12 +423,12 @@ const ht = async (t, e, s) => {
|
|
|
430
423
|
...s,
|
|
431
424
|
templateId: e.templateId ?? null
|
|
432
425
|
}), s;
|
|
433
|
-
},
|
|
426
|
+
}, ue = (t, e) => {
|
|
434
427
|
if (t == null || e == null)
|
|
435
428
|
return { ok: !1, error: "design or sourceBuildSolution is null/undefined" };
|
|
436
429
|
try {
|
|
437
430
|
const s = structuredClone(e);
|
|
438
|
-
return new
|
|
431
|
+
return new te({ buildSolution: s }).applyLlmTemplate(t), { ok: !0 };
|
|
439
432
|
} catch (s) {
|
|
440
433
|
return {
|
|
441
434
|
ok: !1,
|
|
@@ -445,339 +438,346 @@ const ht = async (t, e, s) => {
|
|
|
445
438
|
}, H = async (t) => {
|
|
446
439
|
if (N) {
|
|
447
440
|
Object.entries(N).forEach(([r, l]) => {
|
|
448
|
-
|
|
441
|
+
L[r] && (L[r].initialTemplate = l);
|
|
449
442
|
});
|
|
450
443
|
return;
|
|
451
444
|
}
|
|
452
|
-
const e = t?.configurable?.context?.token, s =
|
|
445
|
+
const e = t?.configurable?.context?.token, s = me(t), i = ge(t);
|
|
453
446
|
if (!s) {
|
|
454
447
|
console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping live template hydration.");
|
|
455
448
|
return;
|
|
456
449
|
}
|
|
457
|
-
const n = await
|
|
450
|
+
const n = await bt(s, e, i), o = {};
|
|
458
451
|
await Promise.all(n.map(async (r) => {
|
|
459
452
|
const l = r.properties?.templateInfo;
|
|
460
453
|
if (!l || typeof l != "object") return;
|
|
461
|
-
const
|
|
462
|
-
if (typeof
|
|
463
|
-
const
|
|
464
|
-
if (!
|
|
465
|
-
const { buildSolution:
|
|
454
|
+
const d = l.id;
|
|
455
|
+
if (typeof d != "string" || o[d]) return;
|
|
456
|
+
const u = await yt(r.id, e, i);
|
|
457
|
+
if (!u) return;
|
|
458
|
+
const { buildSolution: m, params: h } = u;
|
|
459
|
+
if (typeof m == "object" && m !== null && "solution" in m) {
|
|
460
|
+
const g = m.solution;
|
|
461
|
+
g.thumbnailUrl = r.thumbnail ? `${i ?? "https://www.arcgis.com/sharing/rest"}/content/items/${r.id}/info/${r.thumbnail}` : void 0;
|
|
462
|
+
}
|
|
463
|
+
const c = {
|
|
466
464
|
...l,
|
|
467
|
-
buildSolution:
|
|
465
|
+
buildSolution: m
|
|
468
466
|
};
|
|
469
|
-
o[
|
|
470
|
-
new
|
|
467
|
+
o[d] = _(
|
|
468
|
+
new te(c).dumpToLlmTemplate(),
|
|
471
469
|
{
|
|
472
470
|
itemId: r.id,
|
|
473
|
-
sourceBuildSolution: structuredClone(
|
|
474
|
-
params:
|
|
471
|
+
sourceBuildSolution: structuredClone(m),
|
|
472
|
+
params: h ? structuredClone(h) : null
|
|
475
473
|
}
|
|
476
|
-
),
|
|
474
|
+
), L[d] = {
|
|
477
475
|
...l,
|
|
478
|
-
initialTemplate: o[
|
|
476
|
+
initialTemplate: o[d]
|
|
479
477
|
};
|
|
480
478
|
})), N = o;
|
|
481
|
-
},
|
|
479
|
+
}, pe = (t) => {
|
|
482
480
|
const e = t?.configurable?.context?.token;
|
|
483
481
|
return typeof e != "string" || !e.trim() ? null : e;
|
|
484
|
-
},
|
|
482
|
+
}, me = (t) => {
|
|
485
483
|
const e = t?.configurable?.context?.configContext?.primarySolutionsGroupId;
|
|
486
484
|
return typeof e != "string" || !e.trim() ? null : e;
|
|
487
|
-
},
|
|
485
|
+
}, ge = (t) => {
|
|
488
486
|
const e = t?.configurable?.context?.configContext?.portalURL;
|
|
489
487
|
if (!(typeof e != "string" || !e.trim()))
|
|
490
488
|
return `${e.replace(/\/+$/, "")}/sharing/rest`;
|
|
491
|
-
},
|
|
489
|
+
}, vt = async (t) => {
|
|
492
490
|
await Promise.all([
|
|
493
|
-
|
|
491
|
+
fe(t),
|
|
494
492
|
H(t)
|
|
495
493
|
]);
|
|
496
|
-
},
|
|
497
|
-
const e =
|
|
498
|
-
(!$ || e && e !==
|
|
499
|
-
throw $ = null,
|
|
494
|
+
}, he = async (t) => {
|
|
495
|
+
const e = pe(t);
|
|
496
|
+
(!$ || e && e !== P) && (P = e ?? P, $ = vt(t).catch((i) => {
|
|
497
|
+
throw $ = null, P = null, i;
|
|
500
498
|
})), await $;
|
|
501
499
|
};
|
|
502
|
-
async function
|
|
503
|
-
if (
|
|
504
|
-
const e =
|
|
500
|
+
async function fe(t) {
|
|
501
|
+
if (M) return M;
|
|
502
|
+
const e = me(t);
|
|
505
503
|
if (!e)
|
|
506
504
|
return console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping embeddings load."), null;
|
|
507
|
-
const s =
|
|
508
|
-
await new
|
|
509
|
-
const o =
|
|
510
|
-
return r ? (
|
|
505
|
+
const s = ge(t), i = t?.configurable?.context?.configContext?.portalURL;
|
|
506
|
+
await new Ue(i ? { url: i } : void 0).load();
|
|
507
|
+
const o = pe(t) ?? void 0, r = await ft(e, o, s);
|
|
508
|
+
return r ? (M = r.items, M) : null;
|
|
511
509
|
}
|
|
512
|
-
const
|
|
510
|
+
const xt = () => Object.entries(L).map(([t, e]) => `ID: ${t}
|
|
513
511
|
Label: ${e.label}
|
|
514
512
|
Description: ${e.description}`).join(`
|
|
515
513
|
|
|
516
|
-
`),
|
|
514
|
+
`), wt = (t) => {
|
|
517
515
|
const e = t?.configurable?.context?.solutionDesignJson;
|
|
518
516
|
if (typeof e != "string" || !e.trim())
|
|
519
517
|
return null;
|
|
520
518
|
try {
|
|
521
|
-
const s = JSON.parse(e), i =
|
|
519
|
+
const s = JSON.parse(e), i = _(
|
|
522
520
|
{ response: "", ...s },
|
|
523
521
|
{ itemId: s?.solution?.itemId ?? null }
|
|
524
522
|
), n = J.safeParse(i);
|
|
525
523
|
if (!n.success)
|
|
526
524
|
return null;
|
|
527
|
-
const { response: o, ...r } = n.data, l = s.templateId,
|
|
528
|
-
return
|
|
525
|
+
const { response: o, ...r } = n.data, l = s.templateId, d = typeof l == "string" && G(l) ? l : null;
|
|
526
|
+
return _(
|
|
529
527
|
r,
|
|
530
528
|
{
|
|
531
529
|
sourceBuildSolution: s.sourceBuildSolution,
|
|
532
|
-
templateId:
|
|
530
|
+
templateId: d,
|
|
533
531
|
params: s.params ?? null
|
|
534
532
|
}
|
|
535
533
|
);
|
|
536
534
|
} catch {
|
|
537
535
|
return null;
|
|
538
536
|
}
|
|
539
|
-
},
|
|
537
|
+
}, I = (t) => {
|
|
540
538
|
const e = new CustomEvent("assistantProcessing", {
|
|
541
539
|
detail: t
|
|
542
540
|
});
|
|
543
541
|
window.dispatchEvent(e);
|
|
544
|
-
},
|
|
542
|
+
}, be = y.Root({
|
|
545
543
|
...z(),
|
|
546
544
|
/** Optional human-readable template description retained for UI use. */
|
|
547
|
-
templateDescription:
|
|
545
|
+
templateDescription: y({
|
|
548
546
|
reducer: (t, e) => typeof e == "string" || e === null ? e : t ?? null,
|
|
549
547
|
default: () => null
|
|
550
548
|
}),
|
|
551
549
|
/** Current editable design payload being refined across turns. */
|
|
552
|
-
currentDesign:
|
|
550
|
+
currentDesign: y({
|
|
553
551
|
reducer: (t = null, e) => e === void 0 ? t : e ?? null,
|
|
554
552
|
default: () => null
|
|
555
553
|
}),
|
|
556
554
|
/** Initial request assessment produced by the intake prompt. */
|
|
557
|
-
assessment:
|
|
555
|
+
assessment: y({
|
|
558
556
|
reducer: (t = null, e) => e === void 0 ? t : e ?? null,
|
|
559
557
|
default: () => null
|
|
560
558
|
}),
|
|
561
559
|
/** Template selected automatically or by human-in-the-loop choice. */
|
|
562
|
-
selectedTemplate:
|
|
560
|
+
selectedTemplate: y({
|
|
563
561
|
reducer: (t = null, e) => e === void 0 ? t : e ?? null,
|
|
564
562
|
default: () => null
|
|
565
563
|
}),
|
|
566
564
|
/** Existing solution matches surfaced before building a new solution. */
|
|
567
|
-
existingMatches:
|
|
565
|
+
existingMatches: y({
|
|
568
566
|
reducer: (t = [], e) => e === void 0 ? t : e ?? [],
|
|
569
567
|
default: () => []
|
|
570
568
|
})
|
|
571
|
-
}),
|
|
572
|
-
const s =
|
|
569
|
+
}), St = (t, e) => {
|
|
570
|
+
const s = wt(e), i = s?.templateId ?? null, n = {};
|
|
573
571
|
return JSON.stringify(t.currentDesign) !== JSON.stringify(s) && (n.currentDesign = s), i && t.selectedTemplate !== i && (n.selectedTemplate = i), n;
|
|
574
|
-
},
|
|
575
|
-
await
|
|
576
|
-
const s = t.agentExecutionContext.userRequest
|
|
577
|
-
|
|
578
|
-
const i = vt(), n = await R({
|
|
579
|
-
promptText: await w(L, "initialAssessment"),
|
|
572
|
+
}, It = async (t, e) => {
|
|
573
|
+
await C({ text: f("understandingRequest", e) }, e), await he(e);
|
|
574
|
+
const s = t.agentExecutionContext.userRequest, i = xt(), n = t.agentExecutionContext.messages.slice(-11), o = await R({
|
|
575
|
+
promptText: await w(D, "initialAssessment"),
|
|
580
576
|
modelTier: "advanced",
|
|
581
577
|
temperature: 0,
|
|
582
|
-
schema:
|
|
578
|
+
schema: rt,
|
|
579
|
+
messages: n,
|
|
583
580
|
inputVariables: { query: s, availableTemplates: i }
|
|
584
|
-
}),
|
|
585
|
-
(
|
|
586
|
-
),
|
|
587
|
-
...
|
|
588
|
-
matchedTemplates:
|
|
589
|
-
}, [
|
|
581
|
+
}), r = o.matchedTemplates.filter(
|
|
582
|
+
(c) => G(c.templateId)
|
|
583
|
+
), l = {
|
|
584
|
+
...o,
|
|
585
|
+
matchedTemplates: r
|
|
586
|
+
}, [d, u] = r, h = !!d && d.confidence >= ct && (u === void 0 || d.confidence - u.confidence >= dt) ? d.templateId : null;
|
|
590
587
|
return {
|
|
591
|
-
assessment:
|
|
592
|
-
selectedTemplate:
|
|
588
|
+
assessment: l,
|
|
589
|
+
selectedTemplate: h,
|
|
593
590
|
existingMatches: []
|
|
594
591
|
};
|
|
595
|
-
},
|
|
592
|
+
}, Ct = (t) => {
|
|
596
593
|
const e = t.assessment?.assistantResponse ?? "";
|
|
597
|
-
return
|
|
594
|
+
return I(!1), {
|
|
598
595
|
outputMessage: e,
|
|
599
596
|
summary: e,
|
|
600
597
|
status: "success"
|
|
601
598
|
};
|
|
602
|
-
},
|
|
599
|
+
}, _t = (t, e) => {
|
|
603
600
|
const { hitlResponse: s } = e.configurable, i = "selectTemplate", n = t.assessment?.matchedTemplates.filter(
|
|
604
|
-
(
|
|
605
|
-
) ?? [], o = n.map((
|
|
601
|
+
(u) => G(u.templateId)
|
|
602
|
+
) ?? [], o = n.map((u) => `${u.templateDescription}`);
|
|
606
603
|
if (s?.agentId !== "solutionBuilder" || s.id !== i) {
|
|
607
|
-
const
|
|
604
|
+
const u = {
|
|
608
605
|
agentId: "solutionBuilder",
|
|
609
606
|
id: i,
|
|
610
607
|
kind: "singleSelection",
|
|
611
|
-
message:
|
|
608
|
+
message: f("selectTemplatePrompt", e),
|
|
612
609
|
metadata: [...o]
|
|
613
610
|
};
|
|
614
|
-
throw new
|
|
611
|
+
throw new ee(u);
|
|
615
612
|
}
|
|
616
|
-
const r = String(s.payload ?? ""), l = o.findIndex((
|
|
613
|
+
const r = String(s.payload ?? ""), l = o.findIndex((u) => u === r);
|
|
617
614
|
return {
|
|
618
615
|
selectedTemplate: (l >= 0 ? n[l] : void 0)?.templateId ?? n[0]?.templateId ?? null
|
|
619
616
|
};
|
|
620
|
-
},
|
|
621
|
-
await
|
|
622
|
-
const s = t.agentExecutionContext.userRequest, i = await
|
|
623
|
-
if (!
|
|
617
|
+
}, kt = async (t, e) => {
|
|
618
|
+
await C({ text: f("searchingExistingSolutions", e) }, e);
|
|
619
|
+
const s = t.agentExecutionContext.userRequest, i = Ke(t.agentExecutionContext.messages) || s, n = await fe(e);
|
|
620
|
+
if (!n)
|
|
624
621
|
return console.warn("Solutions Search: failed to load solution embeddings cache; skipping search."), { existingMatches: [] };
|
|
625
|
-
if (!
|
|
622
|
+
if (!n.length)
|
|
626
623
|
return { existingMatches: [] };
|
|
627
|
-
const [
|
|
628
|
-
solution:
|
|
629
|
-
score:
|
|
624
|
+
const [o] = await Fe([i]), r = n.map((c) => ({
|
|
625
|
+
solution: c,
|
|
626
|
+
score: Re(o, c.embedding)
|
|
630
627
|
}));
|
|
631
|
-
|
|
632
|
-
const
|
|
633
|
-
if (!
|
|
628
|
+
r.sort((c, g) => g.score - c.score);
|
|
629
|
+
const l = r.slice(0, lt);
|
|
630
|
+
if (!l.length)
|
|
634
631
|
return { existingMatches: [] };
|
|
635
|
-
const
|
|
636
|
-
Snippet: ${
|
|
637
|
-
Description: ${
|
|
632
|
+
const d = l.map(({ solution: c }) => `${c.title}
|
|
633
|
+
Snippet: ${c.snippet}
|
|
634
|
+
Description: ${c.description}`).join(`
|
|
638
635
|
|
|
639
|
-
`);
|
|
636
|
+
`), u = t.agentExecutionContext.messages.slice(-11);
|
|
640
637
|
return { existingMatches: (await R({
|
|
641
|
-
promptText: await w(
|
|
642
|
-
modelTier: "
|
|
638
|
+
promptText: await w(D, "findExistingSolution"),
|
|
639
|
+
modelTier: "fast",
|
|
643
640
|
temperature: 0,
|
|
644
|
-
schema:
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
}
|
|
641
|
+
schema: ot,
|
|
642
|
+
messages: u,
|
|
643
|
+
inputVariables: { query: s, candidates: d }
|
|
644
|
+
})).matchedTitles.map((c) => l.find(({ solution: g }) => g.title === c)).filter((c) => c !== void 0) };
|
|
645
|
+
}, Tt = (t, e) => {
|
|
648
646
|
const { existingMatches: s } = t, { hitlResponse: i } = e.configurable, n = `confirmExistingSolution:${s[0].solution.id}`;
|
|
649
647
|
if (i?.agentId !== "solutionBuilder" || i.id !== n) {
|
|
650
|
-
s.length === 1 ?
|
|
651
|
-
const o = s.map((
|
|
648
|
+
s.length === 1 ? oe(s[0].solution.id) : ne(s);
|
|
649
|
+
const o = s.map((d) => `${d.solution.title}`).join(", "), r = f("existingSolutionMatch", e, { solutionMatch: o }), l = {
|
|
652
650
|
agentId: "solutionBuilder",
|
|
653
651
|
id: n,
|
|
654
652
|
kind: "booleanChoice",
|
|
655
653
|
message: r,
|
|
656
654
|
metadata: []
|
|
657
655
|
};
|
|
658
|
-
throw new
|
|
656
|
+
throw new ee(l);
|
|
659
657
|
}
|
|
660
658
|
return {};
|
|
661
|
-
},
|
|
662
|
-
await
|
|
659
|
+
}, ye = async (t, e) => {
|
|
660
|
+
await he(e);
|
|
663
661
|
const { currentDesign: s } = t, i = t.agentExecutionContext.userRequest;
|
|
664
|
-
await
|
|
662
|
+
await C({ text: f("creatingDesign", e) }, e);
|
|
665
663
|
let n = F(t.selectedTemplate);
|
|
666
664
|
if (n?.initialTemplate || (await H(e), n = F(t.selectedTemplate)), !n?.initialTemplate)
|
|
667
665
|
throw new Error("No hydrated templates are available for solution design.");
|
|
668
|
-
const o =
|
|
666
|
+
const o = _(
|
|
669
667
|
s ?? n.initialTemplate,
|
|
670
668
|
{
|
|
671
669
|
itemId: (s ?? n.initialTemplate)?.solution?.itemId ?? null,
|
|
672
670
|
sourceBuildSolution: s?.sourceBuildSolution ?? n.initialTemplate.sourceBuildSolution,
|
|
673
671
|
params: s?.params ?? n.initialTemplate.params ?? null
|
|
674
672
|
}
|
|
675
|
-
), r = await R({
|
|
676
|
-
promptText: await w(
|
|
673
|
+
), r = t.agentExecutionContext.messages.slice(-11), l = await R({
|
|
674
|
+
promptText: await w(D, "designSolution"),
|
|
677
675
|
modelTier: "advanced",
|
|
678
676
|
temperature: 0,
|
|
679
677
|
schema: J,
|
|
678
|
+
messages: r,
|
|
680
679
|
inputVariables: {
|
|
681
|
-
currentDesign: JSON.stringify(
|
|
680
|
+
currentDesign: JSON.stringify(se(o)),
|
|
682
681
|
templateInstructions: n.instructions,
|
|
683
682
|
query: i
|
|
684
683
|
}
|
|
685
|
-
}), { response:
|
|
686
|
-
|
|
684
|
+
}), { response: d, featureLayer: u, ...m } = l, h = ie(
|
|
685
|
+
u,
|
|
687
686
|
o.featureLayer
|
|
688
|
-
),
|
|
689
|
-
{ ...
|
|
687
|
+
), c = _(
|
|
688
|
+
{ ...m, featureLayer: h },
|
|
690
689
|
{
|
|
691
690
|
itemId: o?.solution?.itemId,
|
|
692
691
|
sourceBuildSolution: o.sourceBuildSolution,
|
|
693
692
|
templateId: t.selectedTemplate ?? null,
|
|
694
693
|
params: o.params ?? null
|
|
695
694
|
}
|
|
696
|
-
),
|
|
697
|
-
if (!
|
|
695
|
+
), g = new ce(c, n.initialTemplate);
|
|
696
|
+
if (!g.isValid)
|
|
698
697
|
return console.warn(
|
|
699
698
|
"[SolutionBuilder] designSolution validation failed:",
|
|
700
|
-
{ issues:
|
|
699
|
+
{ issues: g.issues, llmResponse: l }
|
|
701
700
|
), {
|
|
702
|
-
outputMessage:
|
|
701
|
+
outputMessage: f("createDesignFailed", e)
|
|
703
702
|
};
|
|
704
|
-
const
|
|
705
|
-
if (!
|
|
703
|
+
const x = c.sourceBuildSolution, b = ue(c, x);
|
|
704
|
+
if (!b.ok) {
|
|
706
705
|
console.warn(
|
|
707
706
|
"[SolutionBuilder] designSolution Esri JSON conversion failed:",
|
|
708
|
-
{ error:
|
|
707
|
+
{ error: b.error, llmResponse: l, design: c }
|
|
709
708
|
);
|
|
710
|
-
const
|
|
709
|
+
const S = f("createDesignFailed", e);
|
|
711
710
|
return {
|
|
712
|
-
outputMessage:
|
|
713
|
-
summary:
|
|
711
|
+
outputMessage: S,
|
|
712
|
+
summary: S,
|
|
714
713
|
status: "success"
|
|
715
714
|
};
|
|
716
715
|
}
|
|
717
|
-
return
|
|
718
|
-
outputMessage:
|
|
719
|
-
summary:
|
|
716
|
+
return I(!1), de(c), {
|
|
717
|
+
outputMessage: d,
|
|
718
|
+
summary: d,
|
|
720
719
|
status: "success",
|
|
721
|
-
currentDesign:
|
|
720
|
+
currentDesign: c
|
|
722
721
|
};
|
|
723
|
-
},
|
|
722
|
+
}, At = async (t, e) => {
|
|
724
723
|
const { currentDesign: s } = t;
|
|
725
724
|
if (!s)
|
|
726
|
-
return
|
|
727
|
-
const i = t.agentExecutionContext.userRequest;
|
|
728
|
-
await
|
|
729
|
-
const
|
|
730
|
-
promptText: await w(
|
|
725
|
+
return ye(t, e);
|
|
726
|
+
const i = t.agentExecutionContext.userRequest, n = t.agentExecutionContext.messages.slice(-11);
|
|
727
|
+
await C({ text: f("updatingDesign", e) }, e);
|
|
728
|
+
const o = await R({
|
|
729
|
+
promptText: await w(D, "updateDesign"),
|
|
731
730
|
modelTier: "advanced",
|
|
732
731
|
temperature: 0,
|
|
733
|
-
schema:
|
|
732
|
+
schema: nt,
|
|
733
|
+
messages: n,
|
|
734
734
|
inputVariables: {
|
|
735
|
-
currentDesign: JSON.stringify(
|
|
735
|
+
currentDesign: JSON.stringify(Be(s)),
|
|
736
736
|
query: i
|
|
737
737
|
}
|
|
738
|
-
}), { response:
|
|
739
|
-
op:
|
|
740
|
-
path:
|
|
741
|
-
...
|
|
742
|
-
...
|
|
743
|
-
}))].sort((
|
|
744
|
-
|
|
738
|
+
}), { response: r, patches: l } = o, u = [...l.map((p) => ({
|
|
739
|
+
op: p.op,
|
|
740
|
+
path: p.path.replace(/\/+$/, ""),
|
|
741
|
+
...p.value != null && p.value !== "" ? { value: JSON.parse(p.value) } : {},
|
|
742
|
+
...p.from != null && p.from !== "" ? { from: p.from } : {}
|
|
743
|
+
}))].sort((p, A) => p.op !== "remove" || A.op !== "remove" ? 0 : A.path.localeCompare(p.path, void 0, { numeric: !0 })), m = structuredClone(
|
|
744
|
+
se(s)
|
|
745
745
|
);
|
|
746
746
|
try {
|
|
747
|
-
|
|
748
|
-
} catch (
|
|
747
|
+
Ne(m, u, !0);
|
|
748
|
+
} catch (p) {
|
|
749
749
|
console.warn(
|
|
750
750
|
"[SolutionBuilder] updateDesign JSON patch failed:",
|
|
751
|
-
{ error:
|
|
752
|
-
),
|
|
753
|
-
const
|
|
751
|
+
{ error: p, llmResponse: o, patches: u, patchTarget: m }
|
|
752
|
+
), I(!1);
|
|
753
|
+
const A = f("applyChangeFailed", e);
|
|
754
754
|
return {
|
|
755
|
-
outputMessage:
|
|
756
|
-
summary:
|
|
755
|
+
outputMessage: A,
|
|
756
|
+
summary: A,
|
|
757
757
|
status: "success"
|
|
758
758
|
};
|
|
759
759
|
}
|
|
760
|
-
const
|
|
761
|
-
{ response: "", ...
|
|
760
|
+
const h = _(
|
|
761
|
+
{ response: "", ...m },
|
|
762
762
|
{ itemId: s.solution?.itemId ?? null }
|
|
763
|
-
),
|
|
764
|
-
if (!
|
|
763
|
+
), c = J.safeParse(h);
|
|
764
|
+
if (!c.success) {
|
|
765
765
|
console.warn(
|
|
766
766
|
"[SolutionBuilder] updateDesign schema validation failed:",
|
|
767
|
-
{ errors:
|
|
768
|
-
),
|
|
769
|
-
const
|
|
767
|
+
{ errors: c.error.issues, llmResponse: o, patchedDesign: h }
|
|
768
|
+
), I(!1);
|
|
769
|
+
const p = f("applyChangeFailed", e);
|
|
770
770
|
return {
|
|
771
|
-
outputMessage:
|
|
772
|
-
summary:
|
|
771
|
+
outputMessage: p,
|
|
772
|
+
summary: p,
|
|
773
773
|
status: "success"
|
|
774
774
|
};
|
|
775
775
|
}
|
|
776
|
-
const { response:
|
|
777
|
-
|
|
776
|
+
const { response: g, featureLayer: x, ...b } = c.data, S = ie(
|
|
777
|
+
x,
|
|
778
778
|
s.featureLayer
|
|
779
|
-
),
|
|
780
|
-
{ ...
|
|
779
|
+
), v = _(
|
|
780
|
+
{ ...b, featureLayer: S },
|
|
781
781
|
{
|
|
782
782
|
itemId: s.solution?.itemId,
|
|
783
783
|
sourceBuildSolution: s.sourceBuildSolution,
|
|
@@ -785,59 +785,59 @@ Description: ${u.description}`).join(`
|
|
|
785
785
|
params: s.params ?? null
|
|
786
786
|
}
|
|
787
787
|
);
|
|
788
|
-
let
|
|
789
|
-
if (
|
|
788
|
+
let k = F(t.selectedTemplate);
|
|
789
|
+
if (k?.initialTemplate || (await H(e), k = F(t.selectedTemplate)), !k?.initialTemplate)
|
|
790
790
|
throw new Error("No hydrated templates are available for solution design.");
|
|
791
|
-
const
|
|
792
|
-
if (!
|
|
791
|
+
const Q = new ce(v, k.initialTemplate, !1);
|
|
792
|
+
if (!Q.isValid)
|
|
793
793
|
return console.warn(
|
|
794
794
|
"[SolutionBuilder] updateDesign validation failed:",
|
|
795
|
-
{ issues:
|
|
796
|
-
),
|
|
797
|
-
outputMessage:
|
|
795
|
+
{ issues: Q.issues, llmResponse: o, patchedDesign: v }
|
|
796
|
+
), I(!1), {
|
|
797
|
+
outputMessage: f("applyChangeFailed", e)
|
|
798
798
|
};
|
|
799
|
-
const
|
|
799
|
+
const Se = v.sourceBuildSolution, V = ue(v, Se);
|
|
800
800
|
if (!V.ok) {
|
|
801
801
|
console.warn(
|
|
802
802
|
"[SolutionBuilder] updateDesign Esri JSON conversion failed:",
|
|
803
|
-
{ error: V.error, llmResponse:
|
|
803
|
+
{ error: V.error, llmResponse: o, design: v }
|
|
804
804
|
);
|
|
805
|
-
const
|
|
806
|
-
return
|
|
807
|
-
outputMessage:
|
|
808
|
-
summary:
|
|
805
|
+
const p = f("applyChangeFailed", e);
|
|
806
|
+
return I(!1), {
|
|
807
|
+
outputMessage: p,
|
|
808
|
+
summary: p,
|
|
809
809
|
status: "success"
|
|
810
810
|
};
|
|
811
811
|
}
|
|
812
|
-
return
|
|
813
|
-
outputMessage:
|
|
814
|
-
summary:
|
|
812
|
+
return I(!1), de(v), {
|
|
813
|
+
outputMessage: r,
|
|
814
|
+
summary: r,
|
|
815
815
|
status: "success",
|
|
816
|
-
currentDesign:
|
|
816
|
+
currentDesign: v
|
|
817
817
|
};
|
|
818
|
-
},
|
|
818
|
+
}, Et = (t) => t.currentDesign !== null ? "updateDesign" : "assessInitialRequest", Lt = (t) => !t.assessment || !t.assessment.isValidUseCase ? "invalidUseCaseExit" : !t.selectedTemplate && t.assessment.matchedTemplates.length > 1 ? "selectTemplateHIL" : "findExistingSolutions", Dt = (t) => t.existingMatches.length > 0 ? "confirmContinueBuildingHIL" : "designSolution", Mt = () => new U(be).addNode("syncCurrentDesignFromContext", St).addNode("assessInitialRequest", It).addNode("invalidUseCaseExit", Ct).addNode("selectTemplateHIL", _t).addNode("findExistingSolutions", kt).addNode("confirmContinueBuildingHIL", Tt).addNode("designSolution", ye).addNode("updateDesign", At).addEdge(q, "syncCurrentDesignFromContext").addConditionalEdges("syncCurrentDesignFromContext", Et, {
|
|
819
819
|
updateDesign: "updateDesign",
|
|
820
820
|
assessInitialRequest: "assessInitialRequest"
|
|
821
|
-
}).addConditionalEdges("assessInitialRequest",
|
|
821
|
+
}).addConditionalEdges("assessInitialRequest", Lt, {
|
|
822
822
|
invalidUseCaseExit: "invalidUseCaseExit",
|
|
823
823
|
selectTemplateHIL: "selectTemplateHIL",
|
|
824
824
|
findExistingSolutions: "findExistingSolutions"
|
|
825
|
-
}).addEdge("invalidUseCaseExit",
|
|
825
|
+
}).addEdge("invalidUseCaseExit", E).addEdge("selectTemplateHIL", "findExistingSolutions").addConditionalEdges("findExistingSolutions", Dt, {
|
|
826
826
|
confirmContinueBuildingHIL: "confirmContinueBuildingHIL",
|
|
827
827
|
designSolution: "designSolution"
|
|
828
|
-
}).addEdge("confirmContinueBuildingHIL", "designSolution").addEdge("designSolution",
|
|
828
|
+
}).addEdge("confirmContinueBuildingHIL", "designSolution").addEdge("designSolution", E).addEdge("updateDesign", E), $t = await w(D, "description"), Pt = {
|
|
829
829
|
id: "solutionsBuilder",
|
|
830
830
|
name: "Solutions Builder Agent",
|
|
831
|
-
description:
|
|
832
|
-
createGraph:
|
|
833
|
-
workspace:
|
|
834
|
-
},
|
|
831
|
+
description: $t,
|
|
832
|
+
createGraph: Mt,
|
|
833
|
+
workspace: be
|
|
834
|
+
}, Ft = /* @__PURE__ */ Object.assign({
|
|
835
835
|
"./prompts/solutions_explorer_description.md": () => import("../../chunks/solutions_explorer_description.js").then((t) => t.default)
|
|
836
836
|
});
|
|
837
|
-
function
|
|
837
|
+
function Rt(t) {
|
|
838
838
|
return t.replace(/<sup>\[\[(\d+)\]\]\(([^)]+)\)<\/sup>/g, '<sup><a href="$2">[$1]</a></sup>');
|
|
839
839
|
}
|
|
840
|
-
function
|
|
840
|
+
function Nt(t, e) {
|
|
841
841
|
const s = [];
|
|
842
842
|
return (e?.configurable?.context?.configContext.allCards ?? []).forEach((n) => {
|
|
843
843
|
const o = n.title;
|
|
@@ -855,7 +855,7 @@ function Ft(t, e) {
|
|
|
855
855
|
}
|
|
856
856
|
}), { source: t, allMatches: s };
|
|
857
857
|
}
|
|
858
|
-
function
|
|
858
|
+
function Bt(t) {
|
|
859
859
|
return t && t.helperServices.aiAssistantServices ? `${t.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/chat` : null;
|
|
860
860
|
}
|
|
861
861
|
function ve(t) {
|
|
@@ -874,28 +874,28 @@ async function B(t, e, s) {
|
|
|
874
874
|
throw new Error(`HTTP ${i.status} calling ${e}`);
|
|
875
875
|
return i.json();
|
|
876
876
|
}
|
|
877
|
-
const
|
|
877
|
+
const Ut = (t) => new Promise((e) => setTimeout(e, t)), xe = y.Root({
|
|
878
878
|
// Provides agentExecutionContext, outputMessage, summary, and status
|
|
879
879
|
// channels with the orchestrator's standard reducers/defaults so the
|
|
880
880
|
// sub-agent reports back through the same shape the orchestrator
|
|
881
881
|
// persists into priorSteps.
|
|
882
882
|
...z(),
|
|
883
|
-
solutionResponse:
|
|
883
|
+
solutionResponse: y({
|
|
884
884
|
reducer: (t, e) => e ?? null,
|
|
885
885
|
default: () => null
|
|
886
886
|
}),
|
|
887
|
-
documentSkillUrl:
|
|
887
|
+
documentSkillUrl: y({
|
|
888
888
|
reducer: (t, e) => e ?? null,
|
|
889
889
|
default: () => null
|
|
890
890
|
}),
|
|
891
891
|
// Persisted across turns via the graph checkpointer so follow-up questions
|
|
892
892
|
// continue the same service conversation. Null on the very first interaction
|
|
893
893
|
// or after messages are cleared.
|
|
894
|
-
conversationId:
|
|
894
|
+
conversationId: y({
|
|
895
895
|
reducer: (t, e) => e ?? t,
|
|
896
896
|
default: () => null
|
|
897
897
|
})
|
|
898
|
-
}),
|
|
898
|
+
}), qt = () => new U(xe).addNode("initializeAgent", Ot).addNode("askSolutionsQuestions", zt).addEdge(q, "initializeAgent").addEdge("initializeAgent", "askSolutionsQuestions").addEdge("askSolutionsQuestions", E), we = async (t, e, s) => {
|
|
899
899
|
if (!t) return;
|
|
900
900
|
const i = ve(t);
|
|
901
901
|
if (!i) return;
|
|
@@ -907,10 +907,10 @@ const Nt = (t) => new Promise((e) => setTimeout(e, t)), ye = v.Root({
|
|
|
907
907
|
}
|
|
908
908
|
} };
|
|
909
909
|
s && (o.conversationId = s), B(o, i, e ?? "");
|
|
910
|
-
},
|
|
910
|
+
}, zt = async (t, e) => {
|
|
911
911
|
const s = j(e), i = t.documentSkillUrl;
|
|
912
912
|
let n = [];
|
|
913
|
-
await
|
|
913
|
+
await C(
|
|
914
914
|
{ text: s.agentProgress.explorerAgentSearching },
|
|
915
915
|
e
|
|
916
916
|
);
|
|
@@ -936,27 +936,27 @@ const Nt = (t) => new Promise((e) => setTimeout(e, t)), ye = v.Root({
|
|
|
936
936
|
hasMore: o.hasMore,
|
|
937
937
|
ackSequenceNumber: o.sequenceNumber,
|
|
938
938
|
inquiryId: o.inquiryId
|
|
939
|
-
}, l = "",
|
|
940
|
-
const
|
|
941
|
-
const
|
|
942
|
-
if (
|
|
943
|
-
const b =
|
|
944
|
-
l =
|
|
939
|
+
}, l = "", d = null;
|
|
940
|
+
const u = async (c) => {
|
|
941
|
+
const g = c.context?.results?.[0]?.reply ?? "";
|
|
942
|
+
if (g !== "") {
|
|
943
|
+
const b = Rt(g), S = Nt(b, e);
|
|
944
|
+
l = S.source, n = [
|
|
945
945
|
...n,
|
|
946
|
-
...
|
|
947
|
-
(
|
|
946
|
+
...S.allMatches.filter(
|
|
947
|
+
(v) => !n.some((k) => k.solution.id === v.solution.id)
|
|
948
948
|
)
|
|
949
949
|
];
|
|
950
950
|
}
|
|
951
|
-
|
|
952
|
-
const x =
|
|
951
|
+
g !== "" && c.context?.results?.[0]?.followupQuestions && (d = c.context.results[0].followupQuestions);
|
|
952
|
+
const x = c.context?.results?.[0]?.status?.currentStatusStep;
|
|
953
953
|
if (x) {
|
|
954
954
|
let b = "";
|
|
955
|
-
x === 1 ? b = s.agentProgress.explorerAgentReading : x === 2 ? b = s.agentProgress.explorerAgentReviewing : x === 3 && (b = s.agentProgress.explorerAgentPreparing), await
|
|
955
|
+
x === 1 ? b = s.agentProgress.explorerAgentReading : x === 2 ? b = s.agentProgress.explorerAgentReviewing : x === 3 && (b = s.agentProgress.explorerAgentPreparing), await C({ text: b }, e);
|
|
956
956
|
}
|
|
957
957
|
};
|
|
958
|
-
for (await
|
|
959
|
-
await
|
|
958
|
+
for (await u(o); r.hasMore; )
|
|
959
|
+
await Ut(500), o = await B(
|
|
960
960
|
{
|
|
961
961
|
conversationId: r.conversationId,
|
|
962
962
|
ackSequenceNumber: r.ackSequenceNumber,
|
|
@@ -970,48 +970,48 @@ const Nt = (t) => new Promise((e) => setTimeout(e, t)), ye = v.Root({
|
|
|
970
970
|
hasMore: o.hasMore,
|
|
971
971
|
ackSequenceNumber: o.sequenceNumber,
|
|
972
972
|
inquiryId: o.inquiryId
|
|
973
|
-
}, await
|
|
974
|
-
if (
|
|
975
|
-
const
|
|
976
|
-
setTimeout(() =>
|
|
973
|
+
}, await u(o);
|
|
974
|
+
if (d && e?.configurable?.context?.updateSuggestedPrompts) {
|
|
975
|
+
const c = e.configurable.context.updateSuggestedPrompts, g = d;
|
|
976
|
+
setTimeout(() => c(g), 0);
|
|
977
977
|
}
|
|
978
|
-
ve(e?.configurable?.context.portal) &&
|
|
979
|
-
const
|
|
978
|
+
ve(e?.configurable?.context.portal) && we(e?.configurable?.context.portal, e?.configurable?.context.token ?? "", r.conversationId), n.length && (n.length === 1 ? oe(n[0].solution.id) : ne(n));
|
|
979
|
+
const h = new CustomEvent("assistantProcessing", {
|
|
980
980
|
detail: !1
|
|
981
981
|
});
|
|
982
|
-
return window.dispatchEvent(
|
|
982
|
+
return window.dispatchEvent(h), {
|
|
983
983
|
outputMessage: l,
|
|
984
984
|
summary: l,
|
|
985
985
|
status: "success",
|
|
986
986
|
solutionResponse: r,
|
|
987
987
|
conversationId: r.conversationId
|
|
988
988
|
};
|
|
989
|
-
},
|
|
989
|
+
}, Ot = async (t, e) => {
|
|
990
990
|
let s = null;
|
|
991
|
-
return t.documentSkillUrl === null && e?.configurable?.context?.portal && (s =
|
|
991
|
+
return t.documentSkillUrl === null && e?.configurable?.context?.portal && (s = Bt(e.configurable.context.portal)), {
|
|
992
992
|
documentSkillUrl: s
|
|
993
993
|
};
|
|
994
|
-
},
|
|
994
|
+
}, jt = await w(Ft, "solutions_explorer_description"), Jt = {
|
|
995
995
|
id: "solutionsExplorer",
|
|
996
996
|
name: "Solutions Explorer Agent",
|
|
997
|
-
description:
|
|
998
|
-
createGraph:
|
|
999
|
-
workspace:
|
|
1000
|
-
},
|
|
1001
|
-
class
|
|
997
|
+
description: jt,
|
|
998
|
+
createGraph: qt,
|
|
999
|
+
workspace: xe
|
|
1000
|
+
}, Gt = "https://links.esri.com/solutions/agol-organizational-account", Ht = "https://links.esri.com/solutions/configure-assistants";
|
|
1001
|
+
class Qt extends _e {
|
|
1002
1002
|
constructor() {
|
|
1003
1003
|
super(), this.open = !1, this.userFirstName = "", this.builderVisible = !1, this.hasActiveBuilderDesign = !1, this._conversationId = void 0, this._orgSettings = {
|
|
1004
1004
|
aiAssistantsEnabled: !1,
|
|
1005
1005
|
blockBetaApps: !0,
|
|
1006
1006
|
colocateCompute: !1
|
|
1007
|
-
}, this._suggestedPrompts = [], this._hasInteracted = !1, this._isMobile = window.innerWidth <= 800, this._translations =
|
|
1008
|
-
context:
|
|
1007
|
+
}, this._suggestedPrompts = [], this._hasInteracted = !1, this._isMobile = window.innerWidth <= 800, this._translations = Ce({ name: "arcgis-solutions-assistant", blocking: !0 }), this._builderWidth = 48, this._solutionDesignJson = '{ "solution": null }', this._isAssistantBusy = !1, this._isBuilderBusy = !1, this._preChatCheck = !1, this._assistantRef = Me(), this._configContextConsumer = Y({
|
|
1008
|
+
context: Ae,
|
|
1009
1009
|
subscribe: !0,
|
|
1010
1010
|
callback: (e) => {
|
|
1011
|
-
e?.portalURL && (
|
|
1011
|
+
e?.portalURL && (Z.portalUrl = e.portalURL), e?.userSession && !this.userFirstName && this._loadUserFirstName(), e?.authentication?.PortalSubset?.orgSettings && (this._orgSettings = e?.authentication?.PortalSubset?.orgSettings);
|
|
1012
1012
|
}
|
|
1013
|
-
}), this._builderDesignContextConsumer =
|
|
1014
|
-
context:
|
|
1013
|
+
}), this._builderDesignContextConsumer = Y({
|
|
1014
|
+
context: Ee,
|
|
1015
1015
|
subscribe: !0,
|
|
1016
1016
|
callback: (e) => {
|
|
1017
1017
|
e?.design && (this._solutionDesignJson = JSON.stringify(e.design, null, 2));
|
|
@@ -1042,7 +1042,7 @@ class Gt extends Ce {
|
|
|
1042
1042
|
this.properties = { open: 5, userFirstName: 1, builderVisible: 5, hasActiveBuilderDesign: 5, _conversationId: 16, _orgSettings: 16, _suggestedPrompts: 16, _hasInteracted: 16, _isMobile: 16, _translations: 16, _builderWidth: 16, _solutionDesignJson: 16, _isAssistantBusy: 16, _isBuilderBusy: 16, _preChatCheck: 16 };
|
|
1043
1043
|
}
|
|
1044
1044
|
static {
|
|
1045
|
-
this.styles =
|
|
1045
|
+
this.styles = ze;
|
|
1046
1046
|
}
|
|
1047
1047
|
get _telemetry() {
|
|
1048
1048
|
return this._configContextConsumer.value?.telemetrySession;
|
|
@@ -1057,38 +1057,38 @@ class Gt extends Ce {
|
|
|
1057
1057
|
this._checkURLOpenParameter();
|
|
1058
1058
|
}
|
|
1059
1059
|
load() {
|
|
1060
|
-
this._configContextConsumer.value?.portalURL && (
|
|
1060
|
+
this._configContextConsumer.value?.portalURL && (Z.portalUrl = this._configContextConsumer.value.portalURL);
|
|
1061
1061
|
}
|
|
1062
1062
|
firstUpdated(e) {
|
|
1063
1063
|
this._loadUserFirstName();
|
|
1064
1064
|
}
|
|
1065
1065
|
willUpdate(e) {
|
|
1066
|
-
e.has("open") && this.open && window.dispatchEvent(new CustomEvent("openAssistant")), this._configContextConsumer.value?.authentication && this._configContextConsumer.value?.userSession?.token && (this._preChatCheck || (
|
|
1066
|
+
e.has("open") && this.open && window.dispatchEvent(new CustomEvent("openAssistant")), this._configContextConsumer.value?.authentication && this._configContextConsumer.value?.userSession?.token && (this._preChatCheck || (we(this._configContextConsumer.value?.authentication.Portal, this._configContextConsumer.value?.userSession?.token), this._preChatCheck = !0)), this._configContextConsumer.value?.userSession?.token && this._configContextConsumer.value?.authentication?.CanUseAI;
|
|
1067
1067
|
}
|
|
1068
1068
|
_renderNoSign() {
|
|
1069
|
-
return
|
|
1069
|
+
return T`<calcite-notice class="margin-lg" open scale=m icon=effects kind=info><div slot=message>${this._translations.signInMessage}</div><calcite-link @click=${this._handleSignIn} slot=link title=${this._translations.signInMessage ?? W} class="padding-top-10">${this._translations.signIn}</calcite-link></calcite-notice>`;
|
|
1070
1070
|
}
|
|
1071
1071
|
_renderNoPermission() {
|
|
1072
|
-
return
|
|
1072
|
+
return T`<calcite-notice open scale=m icon=effects kind=info><div slot=title>${this._translations.noPermissionTitle}</div><div slot=message class="padding-top-10">${Te(this._translations.noPermissionMessage.replace("{{orgUrl}}", Gt).replace("{{configAI}}", Ht))}</div></calcite-notice>`;
|
|
1073
1073
|
}
|
|
1074
1074
|
render() {
|
|
1075
1075
|
let e = this._suggestedPrompts.length > 0 ? this._suggestedPrompts : this._hasInteracted ? [] : Object.values(this._translations.defaultFollowUpQuestions);
|
|
1076
|
-
return this._suggestedPrompts.length > 0 ? e = this._suggestedPrompts : this._hasInteracted || (e = [...Object.values(this._translations.defaultFollowUpQuestions)]),
|
|
1076
|
+
return this._suggestedPrompts.length > 0 ? e = this._suggestedPrompts : this._hasInteracted || (e = [...Object.values(this._translations.defaultFollowUpQuestions)]), T`<calcite-panel class="chat-panel"><div class="header-content" slot=header-content><span class="header-title">${this._translations.solutionAssistantTitle}</span></div>${this._configContextConsumer.value?.userSession?.token ? this._configContextConsumer.value?.authentication?.CanUseAI ? T`${!this._isMobile && T`<calcite-action id=solutionBuilderAction icon=pencil-square .text=${this._translations.tooltips.solutionBuilder} .indicator=${this.hasActiveBuilderDesign} .disabled=${!this.hasActiveBuilderDesign} .active=${this.builderVisible} selection-appearance=highlight @click=${() => {
|
|
1077
1077
|
window.dispatchEvent(new CustomEvent("toggleSolutionBuilder"));
|
|
1078
1078
|
}} scale=m slot=header-actions-end></calcite-action>` || ""}<calcite-action id=newChatButton icon=speech-bubble-plus .text=${this._translations.tooltips.newConversation} @click=${() => {
|
|
1079
1079
|
this._conversationId = void 0, this._suggestedPrompts = [], this._hasInteracted = !1, this._assistantRef.value?.clearChatHistory();
|
|
1080
|
-
}} scale=m slot=header-actions-end></calcite-action><calcite-tooltip placement=bottom reference-element=newChatButton><span>${this._translations.tooltips.newConversation}</span></calcite-tooltip>${!this._isMobile &&
|
|
1080
|
+
}} scale=m slot=header-actions-end></calcite-action><calcite-tooltip placement=bottom reference-element=newChatButton><span>${this._translations.tooltips.newConversation}</span></calcite-tooltip>${!this._isMobile && T`<calcite-tooltip placement=bottom reference-element=solutionBuilderAction><span>${this._translations.tooltips.toggleSolutionBuilder}</span></calcite-tooltip>` || ""}<arcgis-assistant reference-element copy-enabled feedback-enabled heading description entry-message=${this._translations.defaultStartUpMessage ?? W} .suggestedPrompts=${e} @arcgisSubmit=${(s) => {
|
|
1081
1081
|
console.log("arcgis submit: ", s.detail), this._suggestedPrompts = [], e = [], this._hasInteracted = !0;
|
|
1082
|
-
const i = Date.now(), n =
|
|
1082
|
+
const i = Date.now(), n = De(i), o = s.detail || "Unknown";
|
|
1083
1083
|
this._telemetry?.logEvent({
|
|
1084
|
-
category:
|
|
1084
|
+
category: Le.ASSISTANT,
|
|
1085
1085
|
action: "Chat",
|
|
1086
1086
|
dimensions: [o],
|
|
1087
1087
|
metrics: [n]
|
|
1088
1088
|
}), this.assistantProcessing.emit(!0);
|
|
1089
1089
|
}} @arcgisFeedback=${(s) => {
|
|
1090
1090
|
s.detail;
|
|
1091
|
-
}} ${
|
|
1091
|
+
}} ${$e(this._assistantRef)}><arcgis-assistant-agent .agent=${Jt} .context=${{
|
|
1092
1092
|
token: this._configContextConsumer.value?.userSession?.token,
|
|
1093
1093
|
configContext: this._configContextConsumer.value,
|
|
1094
1094
|
convoId: this._conversationId,
|
|
@@ -1101,7 +1101,7 @@ class Gt extends Ce {
|
|
|
1101
1101
|
setConversationId: (s) => {
|
|
1102
1102
|
this._conversationId = s;
|
|
1103
1103
|
}
|
|
1104
|
-
}}></arcgis-assistant-agent><arcgis-assistant-agent .agent=${
|
|
1104
|
+
}}></arcgis-assistant-agent><arcgis-assistant-agent .agent=${Ge} .context=${{
|
|
1105
1105
|
translations: this._translations,
|
|
1106
1106
|
clearSuggestedPrompts: () => {
|
|
1107
1107
|
this._suggestedPrompts = [];
|
|
@@ -1130,14 +1130,14 @@ class Gt extends Ce {
|
|
|
1130
1130
|
}
|
|
1131
1131
|
}
|
|
1132
1132
|
_parseAgentPickedAndTask(e) {
|
|
1133
|
-
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((c, g) => g.id - c.id).find((c) => c.role === "user" && c.id <= e.id)?.content || null, l = i.find((c) => typeof c == "string" && c.includes("Agent picked:")) ?? null;
|
|
1134
1134
|
if (!l)
|
|
1135
1135
|
return { agentPicked: null, taskAssigned: null, userMessage: r };
|
|
1136
|
-
const
|
|
1137
|
-
if (!
|
|
1136
|
+
const d = /Agent picked:\s*(.*?)\s*(?:\\n|\r?\n)\s*Task Assigned:\s*([\s\S]*)$/i, u = l.match(d);
|
|
1137
|
+
if (!u)
|
|
1138
1138
|
return { agentPicked: null, taskAssigned: null, userMessage: r };
|
|
1139
|
-
const
|
|
1140
|
-
return { agentPicked:
|
|
1139
|
+
const m = u[1].trim(), h = u[2].trim();
|
|
1140
|
+
return { agentPicked: m, taskAssigned: h, userMessage: r };
|
|
1141
1141
|
}
|
|
1142
1142
|
_emitItemIdFromAI(e) {
|
|
1143
1143
|
const s = new CustomEvent("solutionIDFromAssistant", {
|
|
@@ -1148,7 +1148,7 @@ class Gt extends Ce {
|
|
|
1148
1148
|
window.dispatchEvent(s);
|
|
1149
1149
|
}
|
|
1150
1150
|
}
|
|
1151
|
-
|
|
1151
|
+
Ie("arcgis-solutions-assistant", Qt);
|
|
1152
1152
|
export {
|
|
1153
|
-
|
|
1153
|
+
Qt as ArcgisSolutionsAssistant
|
|
1154
1154
|
};
|