@esri/solutions-components 5.1.0-next.137 → 5.1.0-next.139
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/{33UAZ7BX.js → ATHNXWV4.js} +96 -96
- package/dist/cdn/{3CSMIYZV.js → CUJ3M6UT.js} +1 -1
- package/dist/cdn/FMTXVLZB.js +2 -0
- package/dist/cdn/{7MFLK6JZ.js → HNWINTTY.js} +1 -1
- package/dist/cdn/LDNPRHOM.js +2 -0
- package/dist/cdn/{SEHNIZKR.js → NN52IXXG.js} +1 -1
- package/dist/cdn/{RDAHPMNW.js → PQNFWMST.js} +1 -1
- package/dist/cdn/{4753O4WX.js → PV6MK2E6.js} +1 -1
- package/dist/cdn/{XVRJTKAB.js → QTZMCFZB.js} +22 -21
- package/dist/cdn/SRT2KXZG.js +2 -0
- package/dist/cdn/{6RHH635X.js → UFPB7JD3.js} +1 -1
- package/dist/cdn/{VFH27Y7F.js → UWSHU7MG.js} +1 -1
- package/dist/cdn/ZCPVOS4Q.js +2 -0
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ar.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.bg.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.bs.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ca.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.cs.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.da.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.de.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.el.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.es.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.et.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.fi.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.fr.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.he.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.hr.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.hu.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.id.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.it.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ja.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ko.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.lt.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.lv.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.nl.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.no.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.pl.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.pt-BR.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.pt-PT.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ro.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ru.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.sk.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.sl.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.sr.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.sv.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.th.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.tr.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.uk.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.vi.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.zh-CN.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.zh-HK.json +1 -1
- package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.zh-TW.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.ar.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.bg.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.bs.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.ca.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.cs.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.da.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.de.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.el.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.es.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.et.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.fi.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.fr.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.he.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.hr.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.hu.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.id.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.it.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.ja.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.ko.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.lt.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.lv.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.nl.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.no.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.pl.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.pt-BR.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.pt-PT.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.ro.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.ru.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.sk.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.sl.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.sr.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.sv.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.th.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.tr.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.uk.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.vi.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.zh-CN.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.zh-HK.json +1 -1
- package/dist/cdn/assets/solution-builder-assistant/t9n/messages.zh-TW.json +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/solution-builder-assistant.js +16 -16
- package/dist/components/arcgis-solutions-assistant/customElement.d.ts +2 -0
- package/dist/components/arcgis-solutions-assistant/customElement.js +302 -275
- package/dist/components/crowdsource-manager/customElement.js +5 -5
- package/dist/components/info-card/customElement.js +1 -1
- package/dist/components/layer-table/customElement.js +15 -8
- package/dist/components/map-layer-picker/customElement.js +5 -4
- package/dist/components/map-tools/customElement.js +66 -66
- package/dist/components/solution-builder-assistant/customElement.d.ts +2 -0
- 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 +7 -7
- package/package.json +1 -1
- package/dist/cdn/2LVPFOS7.js +0 -2
- package/dist/cdn/3RSUBJQ5.js +0 -2
- package/dist/cdn/NPYWZIAM.js +0 -2
- package/dist/cdn/WGOI2WQZ.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 { StateGraph as
|
|
14
|
-
import { createAgentRuntimeState as
|
|
2
|
+
import { c as Ce } from "../../chunks/runtime.js";
|
|
3
|
+
import { u as _e } from "../../chunks/useT9n.js";
|
|
4
|
+
import { LitElement as ke, createEvent as X, nothing as ee } from "@arcgis/lumina";
|
|
5
|
+
import { css as Te, html as T } from "lit";
|
|
6
|
+
import { unsafeHTML as Ee } from "lit/directives/unsafe-html.js";
|
|
7
|
+
import { useContextConsumer as te } from "@arcgis/lumina/context";
|
|
8
|
+
import { c as Ae, b as De } from "../../chunks/deployAppContexts.js";
|
|
9
|
+
import { T as Le } from "../../chunks/interfaces.js";
|
|
10
|
+
import { c as Me } from "../../chunks/helpers.js";
|
|
11
|
+
import se from "@arcgis/core/config.js";
|
|
12
|
+
import { createRef as Re, ref as $e } from "lit-html/directives/ref.js";
|
|
13
|
+
import { StateGraph as z, START as O, END as C, Annotation as f, NodeInterrupt as ie } from "@langchain/langgraph/web";
|
|
14
|
+
import { createAgentRuntimeState as j, sendTraceMessage as v, invokeStructuredPrompt as A, getEmbeddings as Fe, cosineSimilarity as Pe, invokeTextPrompt as Ne } from "@arcgis/ai-orchestrator";
|
|
15
15
|
import r, { z as M } from "zod";
|
|
16
|
-
import * as
|
|
17
|
-
import { applyPatch as
|
|
16
|
+
import * as J from "@esri/arcgis-rest-portal";
|
|
17
|
+
import { applyPatch as Be } from "fast-json-patch";
|
|
18
18
|
import "@langchain/core/messages";
|
|
19
|
-
import { C as
|
|
20
|
-
import { g as P, d as
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
const
|
|
19
|
+
import { C as oe } from "../../chunks/converter.js";
|
|
20
|
+
import { g as P, d as ae, r as re, t as qe, T as E } from "../../chunks/templates.js";
|
|
21
|
+
import Ue from "@arcgis/core/portal/Portal.js";
|
|
22
|
+
import ze from "@arcgis/core/portal/PortalItem.js";
|
|
23
|
+
const Oe = Te`:host{display:block;height:100%}.margin-lg{margin:var(--calcite-spacing-lg)}.display-flex-row{display:flex;flex-direction:row}.assistant-split-container{display:flex;width:100%;height:calc(100vh - 78px);overflow:hidden;border-radius:10px}.assistant-panel{display:flex;flex-direction:column;height:100%;border:1px solid var(--calcite-color-surface-3);background-color:var(--calcite-color-surface-2);overflow:hidden}.chat-panel{min-width:320px}.builder-panel{min-width:320px;max-width:100%;border-left:1px solid var(--calcite-color-surface-3)}.panel-actions{display:flex;gap:8px;padding:6px;align-items:center}.builder-header,.builder-footer{padding:10px;background:var(--calcite-color-surface-1);border-bottom:1px solid var(--calcite-color-surface-3)}.builder-content{flex:1;overflow:auto;padding:12px}.builder-content pre{white-space:pre-wrap;word-wrap:break-word;max-height:100%;overflow:auto}.builder-actions{display:flex;gap:6px;align-items:center}.padding-left-10{padding-left:10px}.chat-container{display:flex;flex-direction:column;gap:0px;max-width:600px;height:75%;background-color:var(--calcite-color-surface-4);padding:1px}.chat-container_expanded{display:flex;flex-direction:column;gap:0px;max-width:100%;height:95%;background-color:var(--calcite-color-surface-1);border-radius:10px;padding:10px}.chat-panel{--calcite-color-focus: var(--calcite-color-brand);--calcite-panel-border-color: var(--calcite-color-border-2);--calcite-internal-panel-header-vertical-padding: 0px;--calcite-panel-header-content-space: 0px;border:var(--calcite-border-width-sm) solid var(--calcite-color-border-2);height:100%}.header-content{display:flex;align-items:center;gap:var(--calcite-spacing-sm);height:65px;box-sizing:border-box;padding-inline-start:var(--calcite-space-2xl)}.header-title{font-size:var(--calcite-font-size-md);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-text-1)}.beta-chip{--calcite-chip-corner-radius: var(--calcite-corner-radius-half)}.chat-panel calcite-card,.chat-panel calcite-text-area,.chat-panel calcite-button,.chat-panel .chat-messages,.chat-panel .chat-input{--calcite-color-focus: var(--calcite-color-brand)}.assistant-followup-chip:focus{outline:2px solid var(--calcite-color-brand)}.chat-panel-heading{font-size:var(--calcite-font-size-0);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-surface-1, var(--calcite-color-text-1))}.chat-messages{display:flex;flex-direction:column;gap:20px;padding:4px;height:100%;overflow-y:auto}.user-message{align-self:flex-end;background:var(--calcite-color-brand);border-radius:8px;max-width:90%;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-brand);--calcite-card-border-color: var(--calcite-color-brand);color:var(--calcite-color-text-inverse);text-align:left}.system-message{align-self:flex-start;background:var(--calcite-color-surface-3);border-radius:8px;max-width:90%;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-surface-4);--calcite-card-border-color: var(--calcite-color-surface-4);color:var(--calcite-color-inverse);text-align:left}.loader-message{align-self:flex-start;background:var(--calcite-color-surface-4);border-radius:8px;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-surface-4);--calcite-card-border-color: var(--calcite-color-surface-4)}.message-content{padding:0;font-size:14px}.response-message.message-content>p:first-of-type{margin-top:0}.message-content img{max-width:100%;height:auto;display:block;object-fit:contain}.message-content-pad{padding-bottom:10px;font-size:14px}.message-content-summary{padding-bottom:14px}.message-content-alignment{display:flex;align-items:center;gap:var(--calcite-spacing-md);font-size:var(--calcite-font-size--1);color:var(--calcite-color-text-1)}.padding-top-10{padding-top:10px}.padding-right-8{padding-right:8px}.padding-left-right-5{padding-right:5px;padding-left:5px}.chip-content{padding:5px 5px 5px 0}.chat-input{display:flex;flex-direction:row;flex-grow:1}.table-cell{--calcite-table-cell-background: var(--calcite-color-surface-4)}.cursor-pointer{cursor:pointer}.notice-border-color{--temp-initial-brand: var(--calcite-color-brand)}.notice-border-color calcite-notice{--calcite-color-brand: #ddd;--calcite-icon-color: var(--temp-initial-brand)}.notice-border-color calcite-notice *{--calcite-color-brand: var(--temp-initial-brand)}.solution-card{padding:5px 0;text-decoration:none;display:block;width:100%;cursor:pointer}.solution-card calcite-card{display:flex;flex-direction:column;max-width:520px;overflow:hidden;--calcite-card-corner-radius: var(--calcite-corner-radius-round) !important;--calcite-card-shadow: var(--calcite-shadow-sm);--calcite-card-background-color: var(--calcite-card-background-color) }.solution-card div[slot=thumbnail]{max-height:100%;width:100%;position:relative;&:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;transition:all .15s ease-in-out}}.solution-card div[slot=thumbnail] img{max-height:100%;width:100%;object-fit:cover}.solution-card span[slot=description]{padding-top:10px}.solution-card calcite-chip{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);visibility:hidden;pointer-events:none;opacity:0;transition:all .15s ease-in-out;z-index:9999}.solution-card:hover calcite-chip{visibility:visible;opacity:1}.solution-card:hover div[slot=thumbnail]:after{background-color:#00000080}.solution-card:hover h3{text-decoration:underline}.solution-card:focus{outline:2px solid var(--calcite-color-brand)}.references-container{padding-top:10px;display:block}.references-container.collapsed{display:none}.width-100{width:100%}.disclaimer-div{display:flex;align-items:center;gap:var(--calcite-spacing-sm);font-size:var(--calcite-font-size--0);color:var(--calcite-color-text-1)}.display-none{display:none}.chat-messages calcite-fab{position:absolute;bottom:16px;left:50%;transform:translate(-50%);z-index:999}.icon-color-background{--calcite-button-icon-color: var(--calcite-color-surface-1)}#closeAssistantButton{--calcite-action-text-color: var(--calcite-color-text-1)}.icon-color-background:focus{--calcite-color-focus: var(--calcite-color-surface-1)}@media(max-width:430px){.solution-card .solution-snippet{display:none}}.height-32-flex-auto{height:32px;flex:0 0 auto}.margin-top-0.message-content>p:first-of-type{margin-top:0}a:not(.solution-card){color:var(--calcite-link-text-color, var(--calcite-color-text-link));cursor:pointer;text-decoration:none;line-height:inherit;background-image:linear-gradient(currentColor,currentColor),linear-gradient(var(--calcite-color-brand-underline),var(--calcite-color-brand-underline));background-position-x:0%,100%;background-position-y:min(1.5em,100%);background-repeat:no-repeat,no-repeat;background-size:0% 1px,100% 1px;transition-property:background-size,color;transition-duration:var(--calcite-animation-timing, .15s);transition-timing-function:ease-in-out;outline-color:transparent;position:relative}a:not(.solution-card):hover{background-size:100% 1px,100% 1px}a:not(.solution-card):focus{outline:2px solid var(--calcite-color-brand);outline-offset:2px;outline-color:var(--calcite-color-brand)}a:not(.solution-card):active{color:var(--calcite-color-brand-press)}`;
|
|
24
24
|
async function x(t, e) {
|
|
25
25
|
const s = Object.entries(t).find(
|
|
26
26
|
([n]) => n.endsWith(`/${e}.md`)
|
|
@@ -37,7 +37,7 @@ ${Object.keys(t).join(`
|
|
|
37
37
|
function N(t) {
|
|
38
38
|
return t?.configurable?.context?.translations;
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function le(t) {
|
|
41
41
|
if (typeof window > "u" || t.length <= 1)
|
|
42
42
|
return;
|
|
43
43
|
const e = t.map((n) => n.solution.id), s = t.map((n) => n.solution.title);
|
|
@@ -59,7 +59,7 @@ function ae(t) {
|
|
|
59
59
|
}
|
|
60
60
|
}));
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function ce(t) {
|
|
63
63
|
if (typeof window > "u" || !t)
|
|
64
64
|
return;
|
|
65
65
|
const e = new CustomEvent("solutionIDFromAssistant", {
|
|
@@ -69,13 +69,13 @@ function re(t) {
|
|
|
69
69
|
});
|
|
70
70
|
window.dispatchEvent(e);
|
|
71
71
|
}
|
|
72
|
-
const
|
|
72
|
+
const je = /* @__PURE__ */ Object.assign({
|
|
73
73
|
"./prompts/solutions_explorer_description.md": () => import("../../chunks/solutions_explorer_description.js").then((t) => t.default)
|
|
74
74
|
});
|
|
75
|
-
function
|
|
75
|
+
function Je(t) {
|
|
76
76
|
return t.replace(/<sup>\[\[(\d+)\]\]\(([^)]+)\)<\/sup>/g, '<sup><a href="$2">[$1]</a></sup>');
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function Ge(t, e) {
|
|
79
79
|
const s = [];
|
|
80
80
|
return (e?.configurable?.context?.configContext.allCards ?? []).forEach((i) => {
|
|
81
81
|
const o = i.title;
|
|
@@ -93,13 +93,13 @@ function je(t, e) {
|
|
|
93
93
|
}
|
|
94
94
|
}), { source: t, allMatches: s };
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function He(t) {
|
|
97
97
|
return t && t.helperServices.aiAssistantServices ? `${t.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/chat` : null;
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function de(t) {
|
|
100
100
|
return t && t.helperServices.aiAssistantServices ? `${t.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/api/pre-chat` : null;
|
|
101
101
|
}
|
|
102
|
-
async function
|
|
102
|
+
async function U(t, e, s) {
|
|
103
103
|
const n = await fetch(e, {
|
|
104
104
|
method: "POST",
|
|
105
105
|
headers: {
|
|
@@ -112,12 +112,12 @@ async function q(t, e, s) {
|
|
|
112
112
|
throw new Error(`HTTP ${n.status} calling ${e}`);
|
|
113
113
|
return n.json();
|
|
114
114
|
}
|
|
115
|
-
const
|
|
115
|
+
const Ve = (t) => new Promise((e) => setTimeout(e, t)), Qe = f.Root({
|
|
116
116
|
// Provides agentExecutionContext, outputMessage, summary, and status
|
|
117
117
|
// channels with the orchestrator's standard reducers/defaults so the
|
|
118
118
|
// sub-agent reports back through the same shape the orchestrator
|
|
119
119
|
// persists into priorSteps.
|
|
120
|
-
...
|
|
120
|
+
...j(),
|
|
121
121
|
solutionResponse: f({
|
|
122
122
|
reducer: (t, e) => e ?? null,
|
|
123
123
|
default: () => null
|
|
@@ -133,9 +133,9 @@ const Ge = (t) => new Promise((e) => setTimeout(e, t)), He = f.Root({
|
|
|
133
133
|
reducer: (t, e) => e ?? t,
|
|
134
134
|
default: () => null
|
|
135
135
|
})
|
|
136
|
-
}),
|
|
136
|
+
}), Ke = () => new z(Qe).addNode("initializeAgent", Ye).addNode("askSolutionsQuestions", We).addEdge(O, "initializeAgent").addEdge("initializeAgent", "askSolutionsQuestions").addEdge("askSolutionsQuestions", C), ue = async (t, e, s) => {
|
|
137
137
|
if (!t) return;
|
|
138
|
-
const n =
|
|
138
|
+
const n = de(t);
|
|
139
139
|
if (!n) return;
|
|
140
140
|
const o = { context: {
|
|
141
141
|
kind: "DocAIAssistantRequest",
|
|
@@ -144,15 +144,15 @@ const Ge = (t) => new Promise((e) => setTimeout(e, t)), He = f.Root({
|
|
|
144
144
|
persona: { persona: "apps-solutions" }
|
|
145
145
|
}
|
|
146
146
|
} };
|
|
147
|
-
s && (o.conversationId = s),
|
|
148
|
-
},
|
|
147
|
+
s && (o.conversationId = s), U(o, n, e ?? "");
|
|
148
|
+
}, We = async (t, e) => {
|
|
149
149
|
const s = N(e), n = t.documentSkillUrl;
|
|
150
150
|
let i = [];
|
|
151
|
-
await
|
|
151
|
+
await v(
|
|
152
152
|
{ text: s.agentProgress.explorerAgentSearching },
|
|
153
153
|
e
|
|
154
154
|
);
|
|
155
|
-
let o = await
|
|
155
|
+
let o = await U(
|
|
156
156
|
{
|
|
157
157
|
message: t.agentExecutionContext.userRequest,
|
|
158
158
|
conversationId: e?.configurable?.context?.convoId ?? void 0,
|
|
@@ -175,26 +175,26 @@ const Ge = (t) => new Promise((e) => setTimeout(e, t)), He = f.Root({
|
|
|
175
175
|
ackSequenceNumber: o.sequenceNumber,
|
|
176
176
|
inquiryId: o.inquiryId
|
|
177
177
|
}, l = "", d = null;
|
|
178
|
-
const u = async (
|
|
179
|
-
const c =
|
|
178
|
+
const u = async (m) => {
|
|
179
|
+
const c = m.context?.results?.[0]?.reply ?? "";
|
|
180
180
|
if (c !== "") {
|
|
181
|
-
const y =
|
|
182
|
-
l =
|
|
181
|
+
const y = Je(c), w = Ge(y, e);
|
|
182
|
+
l = w.source, i = [
|
|
183
183
|
...i,
|
|
184
|
-
...
|
|
185
|
-
(
|
|
184
|
+
...w.allMatches.filter(
|
|
185
|
+
(k) => !i.some((B) => B.solution.id === k.solution.id)
|
|
186
186
|
)
|
|
187
187
|
];
|
|
188
188
|
}
|
|
189
|
-
c !== "" &&
|
|
190
|
-
const
|
|
191
|
-
if (
|
|
189
|
+
c !== "" && m.context?.results?.[0]?.followupQuestions && (d = m.context.results[0].followupQuestions);
|
|
190
|
+
const g = m.context?.results?.[0]?.status?.currentStatusStep;
|
|
191
|
+
if (g) {
|
|
192
192
|
let y = "";
|
|
193
|
-
|
|
193
|
+
g === 1 ? y = s.agentProgress.explorerAgentReading : g === 2 ? y = s.agentProgress.explorerAgentReviewing : g === 3 && (y = s.agentProgress.explorerAgentPreparing), await v({ text: y }, e);
|
|
194
194
|
}
|
|
195
195
|
};
|
|
196
196
|
for (await u(o); a.hasMore; )
|
|
197
|
-
await
|
|
197
|
+
await Ve(500), o = await U(
|
|
198
198
|
{
|
|
199
199
|
conversationId: a.conversationId,
|
|
200
200
|
ackSequenceNumber: a.ackSequenceNumber,
|
|
@@ -210,24 +210,24 @@ const Ge = (t) => new Promise((e) => setTimeout(e, t)), He = f.Root({
|
|
|
210
210
|
inquiryId: o.inquiryId
|
|
211
211
|
}, await u(o);
|
|
212
212
|
if (d && e?.configurable?.context?.updateSuggestedPrompts) {
|
|
213
|
-
const
|
|
214
|
-
setTimeout(() =>
|
|
213
|
+
const m = e.configurable.context.updateSuggestedPrompts, c = d;
|
|
214
|
+
setTimeout(() => m(c), 0);
|
|
215
215
|
}
|
|
216
|
-
return
|
|
216
|
+
return de(e?.configurable?.context.portal) && ue(e?.configurable?.context.portal, e?.configurable?.context.token ?? "", a.conversationId), i.length && (i.length === 1 ? ce(i[0].solution.id) : le(i)), {
|
|
217
217
|
outputMessage: l,
|
|
218
218
|
summary: l,
|
|
219
219
|
status: "success",
|
|
220
220
|
solutionResponse: a,
|
|
221
221
|
conversationId: a.conversationId
|
|
222
222
|
};
|
|
223
|
-
},
|
|
223
|
+
}, Ye = async (t, e) => {
|
|
224
224
|
let s = null;
|
|
225
|
-
return t.documentSkillUrl === null && e?.configurable?.context?.portal && (s =
|
|
225
|
+
return t.documentSkillUrl === null && e?.configurable?.context?.portal && (s = He(e.configurable.context.portal)), {
|
|
226
226
|
documentSkillUrl: s
|
|
227
227
|
};
|
|
228
228
|
};
|
|
229
|
-
await x(
|
|
230
|
-
const
|
|
229
|
+
await x(je, "solutions_explorer_description");
|
|
230
|
+
const pe = (t) => {
|
|
231
231
|
if (t && Array.isArray(t.id) && t.id.length > 0)
|
|
232
232
|
return t.id[t.id.length - 1].replace("Message", "").toLowerCase();
|
|
233
233
|
if (t && typeof t._getType == "function")
|
|
@@ -237,8 +237,8 @@ const de = (t) => {
|
|
|
237
237
|
return "human";
|
|
238
238
|
}
|
|
239
239
|
return "human";
|
|
240
|
-
},
|
|
241
|
-
const e =
|
|
240
|
+
}, Ze = (t) => {
|
|
241
|
+
const e = pe(t);
|
|
242
242
|
if (t && t.kwargs)
|
|
243
243
|
return {
|
|
244
244
|
role: e,
|
|
@@ -253,9 +253,9 @@ const de = (t) => {
|
|
|
253
253
|
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;
|
|
254
254
|
}
|
|
255
255
|
return { role: "human", content: String(t) };
|
|
256
|
-
},
|
|
257
|
-
builderMessages:
|
|
258
|
-
},
|
|
256
|
+
}, Xe = (t) => pe(t) === "human", et = (t, e = 3) => t.filter((s) => Xe(s)).slice(-e).map(Ze), tt = (t, e = " ") => et(t).map((i) => i.content).join(e).trim(), st = { understandingRequest: "Understanding your request...", selectTemplatePrompt: "This use case could be supported in a few different ways. Choose the option that best matches what you want to accomplish.", searchingExistingSolutions: "Searching for existing solutions...", existingSolutionMatch: "I found 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?" }, nt = {
|
|
257
|
+
builderMessages: st
|
|
258
|
+
}, it = /* @__PURE__ */ new Set([
|
|
259
259
|
"add",
|
|
260
260
|
"all",
|
|
261
261
|
"alter",
|
|
@@ -318,7 +318,7 @@ const de = (t) => {
|
|
|
318
318
|
"view",
|
|
319
319
|
"where"
|
|
320
320
|
]);
|
|
321
|
-
class
|
|
321
|
+
class me {
|
|
322
322
|
constructor(e, s, n = !0) {
|
|
323
323
|
this.isValid = !0, this.issues = [], this.response = e, this.template = s, this.newDesign = n, this.validate();
|
|
324
324
|
}
|
|
@@ -390,7 +390,7 @@ class ue {
|
|
|
390
390
|
this.validateField(o);
|
|
391
391
|
}
|
|
392
392
|
validateField(e) {
|
|
393
|
-
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.`),
|
|
393
|
+
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.`), it.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)) {
|
|
394
394
|
const s = Math.max(...e.choiceList.map((n) => n.length));
|
|
395
395
|
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}.`));
|
|
396
396
|
}
|
|
@@ -399,11 +399,11 @@ class ue {
|
|
|
399
399
|
console.debug(e), this.issues.push(e), this.isValid = !1;
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
|
-
const
|
|
402
|
+
const ot = r.object({
|
|
403
403
|
key: r.string().describe("Stable key identifier for the string."),
|
|
404
404
|
value: r.string().describe("Display value for the string."),
|
|
405
405
|
description: r.string().describe("Explanation of where/how the string is used.")
|
|
406
|
-
}),
|
|
406
|
+
}), at = r.object({
|
|
407
407
|
id: r.string().describe("ArcGIS item id (32 hex characters)."),
|
|
408
408
|
title: r.string().describe("Item title."),
|
|
409
409
|
description: r.string().describe("Item description."),
|
|
@@ -426,7 +426,7 @@ const nt = r.object({
|
|
|
426
426
|
"Notebook",
|
|
427
427
|
"QuickCapture Project"
|
|
428
428
|
]).describe("ArcGIS item type.")
|
|
429
|
-
}),
|
|
429
|
+
}), ne = r.object({
|
|
430
430
|
name: r.string().describe("Field name."),
|
|
431
431
|
type: r.enum(["string", "integer", "double", "date", "oid", "guid", "globalid"]).describe("Field data type."),
|
|
432
432
|
alias: r.string().describe("Field alias for display."),
|
|
@@ -435,97 +435,97 @@ const nt = r.object({
|
|
|
435
435
|
"List of allowed values for string fields with a controlled vocabulary. Null if unrestricted or not applicable."
|
|
436
436
|
),
|
|
437
437
|
length: r.number().int().nullable().describe("Maximum string length for string fields. Null for non-string fields.")
|
|
438
|
-
}),
|
|
438
|
+
}), rt = r.object({
|
|
439
439
|
id: r.number().int().describe("Layer/table id within the feature service."),
|
|
440
440
|
type: r.enum(["Point", "Polyline", "Polygon", "Table"]).describe("Layer type."),
|
|
441
441
|
name: r.string().describe("Layer/table name."),
|
|
442
442
|
description: r.string().describe("Layer/table description."),
|
|
443
|
-
customFields: r.array(
|
|
444
|
-
requiredFields: r.array(
|
|
445
|
-
}),
|
|
443
|
+
customFields: r.array(ne).describe("User/business fields specific to the solution."),
|
|
444
|
+
requiredFields: r.array(ne).describe("Fields required for solution functionality (e.g., relationship keys).")
|
|
445
|
+
}), lt = r.object({
|
|
446
446
|
itemId: r.string().describe("ArcGIS item id for the feature layer."),
|
|
447
447
|
addLayers: r.boolean().describe("Indicates whether new layers can be added during solution design."),
|
|
448
|
-
layers: r.array(
|
|
449
|
-
}),
|
|
448
|
+
layers: r.array(rt)
|
|
449
|
+
}), G = r.object({
|
|
450
450
|
response: r.string().describe("Conversational response to the user's query."),
|
|
451
451
|
solution: r.object({
|
|
452
452
|
itemId: r.string().nullable().describe("ArcGIS item id of the source Solution template used for deployment. Preserve the existing value exactly when known; otherwise use null."),
|
|
453
453
|
title: r.string().describe("Title of the solution."),
|
|
454
454
|
description: r.string().describe("Description of the solution."),
|
|
455
455
|
tags: r.array(r.string()).describe("Keywords/tags associated with the solution."),
|
|
456
|
-
strings: r.array(
|
|
456
|
+
strings: r.array(ot).describe("Localized strings/labels used by apps (dashboards, forms, etc.).")
|
|
457
457
|
}),
|
|
458
|
-
items: r.array(
|
|
459
|
-
featureLayer:
|
|
460
|
-
}),
|
|
458
|
+
items: r.array(at).describe("ArcGIS items that belong to the solution (apps, maps, layers, etc.)."),
|
|
459
|
+
featureLayer: lt.describe("Primary feature layer item and its schema/layers/tables details.")
|
|
460
|
+
}), ct = r.object({
|
|
461
461
|
op: r.enum(["add", "remove", "replace", "move", "copy"]).describe("RFC 6902 operation type."),
|
|
462
462
|
path: r.string().describe("RFC 6901 JSON Pointer to the target location."),
|
|
463
463
|
value: r.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.`),
|
|
464
464
|
from: r.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.")
|
|
465
|
-
}),
|
|
465
|
+
}), dt = r.object({
|
|
466
466
|
response: r.string().describe("Conversational response describing the accepted design changes."),
|
|
467
|
-
patches: r.array(
|
|
468
|
-
}),
|
|
467
|
+
patches: r.array(ct).describe("Minimal RFC 6902 patch operations needed to update the current design.")
|
|
468
|
+
}), ut = r.object({
|
|
469
469
|
matchedTitles: r.array(r.string()).describe("Titles of solutions that match the user's request. Empty array if no strong match.")
|
|
470
|
-
}),
|
|
470
|
+
}), pt = r.object({
|
|
471
471
|
templateId: r.string().min(1).describe("Template id from the available template list."),
|
|
472
472
|
confidence: r.number().min(0).max(1).describe("Confidence score from 0 to 1 for this template match."),
|
|
473
473
|
templateDescription: r.string().min(1).describe("Short description this template in the user's use case/workflow.")
|
|
474
|
-
}),
|
|
474
|
+
}), mt = r.object({
|
|
475
475
|
assistantResponse: r.string().describe("Natural-language response for the user."),
|
|
476
476
|
isValidUseCase: r.boolean().describe("True only when the request is concrete, appropriate, and has at least one matching template."),
|
|
477
|
-
matchedTemplates: r.array(
|
|
478
|
-
}),
|
|
479
|
-
let R = null,
|
|
480
|
-
const
|
|
477
|
+
matchedTemplates: r.array(pt).describe("Ordered list of matching templates, best match first. Empty when no valid match exists.")
|
|
478
|
+
}), H = (t) => t in E, gt = 5, ht = 0.8, ft = 0.15, bt = "Web Mapping Application", yt = "Embeddings";
|
|
479
|
+
let R = null, q = null, $ = null, F = null;
|
|
480
|
+
const xt = "Build", D = /* @__PURE__ */ Object.assign({
|
|
481
481
|
"./prompts/description.md": () => import("../../chunks/description2.js").then((t) => t.default),
|
|
482
482
|
"./prompts/designSolution.md": () => import("../../chunks/designSolution.js").then((t) => t.default),
|
|
483
483
|
"./prompts/findExistingSolution.md": () => import("../../chunks/findExistingSolution.js").then((t) => t.default),
|
|
484
484
|
"./prompts/initialAssessment.md": () => import("../../chunks/initialAssessment.js").then((t) => t.default),
|
|
485
485
|
"./prompts/updateDesign.md": () => import("../../chunks/updateDesign.js").then((t) => t.default)
|
|
486
|
-
}),
|
|
487
|
-
let i = N(e)?.builderMessages?.[t] ??
|
|
486
|
+
}), vt = nt.builderMessages, b = (t, e, s) => {
|
|
487
|
+
let i = N(e)?.builderMessages?.[t] ?? vt[t];
|
|
488
488
|
if (!s)
|
|
489
489
|
return i;
|
|
490
490
|
for (const [o, a] of Object.entries(s))
|
|
491
491
|
i = i.replaceAll(`{{${o}}}`, a);
|
|
492
492
|
return i;
|
|
493
|
-
},
|
|
493
|
+
}, ge = (t) => {
|
|
494
494
|
typeof window < "u" && window.dispatchEvent(new CustomEvent("arcgis-solution-design-update", {
|
|
495
495
|
detail: t
|
|
496
496
|
}));
|
|
497
|
-
},
|
|
497
|
+
}, wt = async (t, e, s) => {
|
|
498
498
|
if (!t) return null;
|
|
499
|
-
const n = `type:"${
|
|
500
|
-
return (await
|
|
499
|
+
const n = `type:"${bt}" AND typekeywords:${yt} AND group:${t}`;
|
|
500
|
+
return (await J.searchItems({
|
|
501
501
|
q: n,
|
|
502
502
|
params: e ? { token: e } : void 0,
|
|
503
503
|
portal: s,
|
|
504
504
|
num: 1
|
|
505
505
|
}))?.results?.[0] ?? null;
|
|
506
506
|
};
|
|
507
|
-
async function
|
|
507
|
+
async function St(t, e, s) {
|
|
508
508
|
try {
|
|
509
|
-
const n = await
|
|
509
|
+
const n = await wt(t, e, s);
|
|
510
510
|
if (!n) return null;
|
|
511
|
-
const i = new
|
|
511
|
+
const i = new ze({ id: n.id });
|
|
512
512
|
return await i.load(), await i.fetchData("json");
|
|
513
513
|
} catch {
|
|
514
514
|
return null;
|
|
515
515
|
}
|
|
516
516
|
}
|
|
517
|
-
const
|
|
517
|
+
const It = async (t, e, s) => {
|
|
518
518
|
if (!t) return [];
|
|
519
|
-
const n = `type:Solution AND typekeywords:${
|
|
520
|
-
return (await
|
|
519
|
+
const n = `type:Solution AND typekeywords:${xt} AND group:${t}`;
|
|
520
|
+
return (await J.searchItems({
|
|
521
521
|
q: n,
|
|
522
522
|
params: e ? { token: e } : void 0,
|
|
523
523
|
portal: s,
|
|
524
524
|
num: 100
|
|
525
525
|
}))?.results ?? [];
|
|
526
|
-
},
|
|
526
|
+
}, Ct = async (t, e, s) => {
|
|
527
527
|
try {
|
|
528
|
-
const n = await
|
|
528
|
+
const n = await J.getItemData(t, {
|
|
529
529
|
params: e ? { token: e } : void 0,
|
|
530
530
|
portal: s
|
|
531
531
|
}), i = n?.buildSolution;
|
|
@@ -535,7 +535,7 @@ const wt = async (t, e, s) => {
|
|
|
535
535
|
} catch {
|
|
536
536
|
return null;
|
|
537
537
|
}
|
|
538
|
-
},
|
|
538
|
+
}, _ = (t, e = {}) => {
|
|
539
539
|
let s = t;
|
|
540
540
|
return "itemId" in e && (s = {
|
|
541
541
|
...s,
|
|
@@ -553,107 +553,107 @@ const wt = async (t, e, s) => {
|
|
|
553
553
|
...s,
|
|
554
554
|
templateId: e.templateId ?? null
|
|
555
555
|
}), s;
|
|
556
|
-
},
|
|
556
|
+
}, he = (t, e) => {
|
|
557
557
|
if (t == null || e == null)
|
|
558
558
|
return { ok: !1, error: "design or sourceBuildSolution is null/undefined" };
|
|
559
559
|
try {
|
|
560
560
|
const s = structuredClone(e);
|
|
561
|
-
return new
|
|
561
|
+
return new oe({ buildSolution: s }).applyLlmTemplate(t), { ok: !0 };
|
|
562
562
|
} catch (s) {
|
|
563
563
|
return {
|
|
564
564
|
ok: !1,
|
|
565
565
|
error: s instanceof Error ? s.stack ?? s.message : String(s)
|
|
566
566
|
};
|
|
567
567
|
}
|
|
568
|
-
},
|
|
569
|
-
if (
|
|
570
|
-
Object.entries(
|
|
568
|
+
}, V = async (t) => {
|
|
569
|
+
if (q) {
|
|
570
|
+
Object.entries(q).forEach(([a, l]) => {
|
|
571
571
|
E[a] && (E[a].initialTemplate = l);
|
|
572
572
|
});
|
|
573
573
|
return;
|
|
574
574
|
}
|
|
575
|
-
const e = t?.configurable?.context?.token, s =
|
|
575
|
+
const e = t?.configurable?.context?.token, s = be(t), n = ye(t);
|
|
576
576
|
if (!s) {
|
|
577
577
|
console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping live template hydration.");
|
|
578
578
|
return;
|
|
579
579
|
}
|
|
580
|
-
const i = await
|
|
580
|
+
const i = await It(s, e, n), o = {};
|
|
581
581
|
await Promise.all(i.map(async (a) => {
|
|
582
582
|
const l = a.properties?.templateInfo;
|
|
583
583
|
if (!l || typeof l != "object") return;
|
|
584
584
|
const d = l.id;
|
|
585
585
|
if (typeof d != "string" || o[d]) return;
|
|
586
|
-
const u = await
|
|
586
|
+
const u = await Ct(a.id, e, n);
|
|
587
587
|
if (!u) return;
|
|
588
|
-
const { buildSolution:
|
|
589
|
-
if (typeof
|
|
590
|
-
const
|
|
591
|
-
|
|
588
|
+
const { buildSolution: h, params: m } = u;
|
|
589
|
+
if (typeof h == "object" && h !== null && "solution" in h) {
|
|
590
|
+
const g = h.solution;
|
|
591
|
+
g.thumbnailUrl = a.thumbnail ? `${n ?? "https://www.arcgis.com/sharing/rest"}/content/items/${a.id}/info/${a.thumbnail}` : void 0;
|
|
592
592
|
}
|
|
593
593
|
const c = {
|
|
594
594
|
...l,
|
|
595
|
-
buildSolution:
|
|
595
|
+
buildSolution: h
|
|
596
596
|
};
|
|
597
|
-
o[d] =
|
|
598
|
-
new
|
|
597
|
+
o[d] = _(
|
|
598
|
+
new oe(c).dumpToLlmTemplate(),
|
|
599
599
|
{
|
|
600
600
|
itemId: a.id,
|
|
601
|
-
sourceBuildSolution: structuredClone(
|
|
602
|
-
params:
|
|
601
|
+
sourceBuildSolution: structuredClone(h),
|
|
602
|
+
params: m ? structuredClone(m) : null
|
|
603
603
|
}
|
|
604
604
|
), E[d] = {
|
|
605
605
|
...l,
|
|
606
606
|
initialTemplate: o[d]
|
|
607
607
|
};
|
|
608
|
-
})),
|
|
609
|
-
},
|
|
608
|
+
})), q = o;
|
|
609
|
+
}, fe = (t) => {
|
|
610
610
|
const e = t?.configurable?.context?.token;
|
|
611
611
|
return typeof e != "string" || !e.trim() ? null : e;
|
|
612
|
-
},
|
|
612
|
+
}, be = (t) => {
|
|
613
613
|
const e = t?.configurable?.context?.configContext?.primarySolutionsGroupId;
|
|
614
614
|
return typeof e != "string" || !e.trim() ? null : e;
|
|
615
|
-
},
|
|
615
|
+
}, ye = (t) => {
|
|
616
616
|
const e = t?.configurable?.context?.configContext?.portalURL;
|
|
617
617
|
if (!(typeof e != "string" || !e.trim()))
|
|
618
618
|
return `${e.replace(/\/+$/, "")}/sharing/rest`;
|
|
619
|
-
},
|
|
619
|
+
}, _t = async (t) => {
|
|
620
620
|
await Promise.all([
|
|
621
|
-
|
|
622
|
-
|
|
621
|
+
ve(t),
|
|
622
|
+
V(t)
|
|
623
623
|
]);
|
|
624
|
-
},
|
|
625
|
-
const e =
|
|
626
|
-
(!$ || e && e !== F) && (F = e ?? F, $ =
|
|
624
|
+
}, xe = async (t) => {
|
|
625
|
+
const e = fe(t);
|
|
626
|
+
(!$ || e && e !== F) && (F = e ?? F, $ = _t(t).catch((n) => {
|
|
627
627
|
throw $ = null, F = null, n;
|
|
628
628
|
})), await $;
|
|
629
629
|
};
|
|
630
|
-
async function
|
|
630
|
+
async function ve(t) {
|
|
631
631
|
if (R) return R;
|
|
632
|
-
const e =
|
|
632
|
+
const e = be(t);
|
|
633
633
|
if (!e)
|
|
634
634
|
return console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping embeddings load."), null;
|
|
635
|
-
const s =
|
|
636
|
-
await new
|
|
637
|
-
const o =
|
|
635
|
+
const s = ye(t), n = t?.configurable?.context?.configContext?.portalURL;
|
|
636
|
+
await new Ue(n ? { url: n } : void 0).load();
|
|
637
|
+
const o = fe(t) ?? void 0, a = await St(e, o, s);
|
|
638
638
|
return a ? (R = a.items, R) : null;
|
|
639
639
|
}
|
|
640
|
-
const
|
|
640
|
+
const kt = () => Object.entries(E).map(([t, e]) => `ID: ${t}
|
|
641
641
|
Label: ${e.label}
|
|
642
642
|
Description: ${e.description}`).join(`
|
|
643
643
|
|
|
644
|
-
`),
|
|
644
|
+
`), Tt = (t) => {
|
|
645
645
|
const e = t?.configurable?.context?.solutionDesignJson;
|
|
646
646
|
if (typeof e != "string" || !e.trim())
|
|
647
647
|
return null;
|
|
648
648
|
try {
|
|
649
|
-
const s = JSON.parse(e), n =
|
|
649
|
+
const s = JSON.parse(e), n = _(
|
|
650
650
|
{ response: "", ...s },
|
|
651
651
|
{ itemId: s?.solution?.itemId ?? null }
|
|
652
|
-
), i =
|
|
652
|
+
), i = G.safeParse(n);
|
|
653
653
|
if (!i.success)
|
|
654
654
|
return null;
|
|
655
|
-
const { response: o, ...a } = i.data, l = s.templateId, d = typeof l == "string" &&
|
|
656
|
-
return
|
|
655
|
+
const { response: o, ...a } = i.data, l = s.templateId, d = typeof l == "string" && H(l) ? l : null;
|
|
656
|
+
return _(
|
|
657
657
|
a,
|
|
658
658
|
{
|
|
659
659
|
sourceBuildSolution: s.sourceBuildSolution,
|
|
@@ -664,8 +664,8 @@ Description: ${e.description}`).join(`
|
|
|
664
664
|
} catch {
|
|
665
665
|
return null;
|
|
666
666
|
}
|
|
667
|
-
},
|
|
668
|
-
...
|
|
667
|
+
}, Et = f.Root({
|
|
668
|
+
...j(),
|
|
669
669
|
/** Optional human-readable template description retained for UI use. */
|
|
670
670
|
templateDescription: f({
|
|
671
671
|
reducer: (t, e) => typeof e == "string" || e === null ? e : t ?? null,
|
|
@@ -691,39 +691,39 @@ Description: ${e.description}`).join(`
|
|
|
691
691
|
reducer: (t = [], e) => e === void 0 ? t : e ?? [],
|
|
692
692
|
default: () => []
|
|
693
693
|
})
|
|
694
|
-
}),
|
|
695
|
-
const s =
|
|
694
|
+
}), At = (t, e) => {
|
|
695
|
+
const s = Tt(e), n = s?.templateId ?? null, i = {};
|
|
696
696
|
return JSON.stringify(t.currentDesign) !== JSON.stringify(s) && (i.currentDesign = s), n && t.selectedTemplate !== n && (i.selectedTemplate = n), i;
|
|
697
|
-
},
|
|
698
|
-
await
|
|
699
|
-
const s = t.agentExecutionContext.userRequest, n =
|
|
697
|
+
}, Dt = async (t, e) => {
|
|
698
|
+
await v({ text: b("understandingRequest", e) }, e), await xe(e);
|
|
699
|
+
const s = t.agentExecutionContext.userRequest, n = kt(), i = t.agentExecutionContext.messages.slice(-11), o = await A({
|
|
700
700
|
promptText: await x(D, "initialAssessment"),
|
|
701
701
|
modelTier: "advanced",
|
|
702
702
|
temperature: 0,
|
|
703
|
-
schema:
|
|
703
|
+
schema: mt,
|
|
704
704
|
messages: i,
|
|
705
705
|
inputVariables: { query: s, availableTemplates: n }
|
|
706
706
|
}), a = o.matchedTemplates.filter(
|
|
707
|
-
(c) =>
|
|
707
|
+
(c) => H(c.templateId)
|
|
708
708
|
), l = {
|
|
709
709
|
...o,
|
|
710
710
|
matchedTemplates: a
|
|
711
|
-
}, [d, u] = a,
|
|
711
|
+
}, [d, u] = a, m = !!d && d.confidence >= ht && (u === void 0 || d.confidence - u.confidence >= ft) ? d.templateId : null;
|
|
712
712
|
return {
|
|
713
713
|
assessment: l,
|
|
714
|
-
selectedTemplate:
|
|
714
|
+
selectedTemplate: m,
|
|
715
715
|
existingMatches: []
|
|
716
716
|
};
|
|
717
|
-
},
|
|
717
|
+
}, Lt = (t) => {
|
|
718
718
|
const e = t.assessment?.assistantResponse ?? "";
|
|
719
719
|
return {
|
|
720
720
|
outputMessage: e,
|
|
721
721
|
summary: e,
|
|
722
722
|
status: "success"
|
|
723
723
|
};
|
|
724
|
-
},
|
|
724
|
+
}, Mt = (t, e) => {
|
|
725
725
|
const { hitlResponse: s } = e.configurable, n = "selectTemplate", i = t.assessment?.matchedTemplates.filter(
|
|
726
|
-
(u) =>
|
|
726
|
+
(u) => H(u.templateId)
|
|
727
727
|
) ?? [], o = i.map((u) => `${u.templateDescription}`);
|
|
728
728
|
if (s?.agentId !== "solutionBuilder" || s.id !== n) {
|
|
729
729
|
const u = {
|
|
@@ -733,25 +733,25 @@ Description: ${e.description}`).join(`
|
|
|
733
733
|
message: b("selectTemplatePrompt", e),
|
|
734
734
|
metadata: [...o]
|
|
735
735
|
};
|
|
736
|
-
throw new
|
|
736
|
+
throw new ie(u);
|
|
737
737
|
}
|
|
738
738
|
const a = String(s.payload ?? ""), l = o.findIndex((u) => u === a);
|
|
739
739
|
return {
|
|
740
740
|
selectedTemplate: (l >= 0 ? i[l] : void 0)?.templateId ?? i[0]?.templateId ?? null
|
|
741
741
|
};
|
|
742
|
-
},
|
|
743
|
-
await
|
|
744
|
-
const s = t.agentExecutionContext.userRequest, n =
|
|
742
|
+
}, Rt = async (t, e) => {
|
|
743
|
+
await v({ text: b("searchingExistingSolutions", e) }, e);
|
|
744
|
+
const s = t.agentExecutionContext.userRequest, n = tt(t.agentExecutionContext.messages) || s, i = await ve(e);
|
|
745
745
|
if (!i)
|
|
746
746
|
return console.warn("Solutions Search: failed to load solution embeddings cache; skipping search."), { existingMatches: [] };
|
|
747
747
|
if (!i.length)
|
|
748
748
|
return { existingMatches: [] };
|
|
749
|
-
const [o] = await
|
|
749
|
+
const [o] = await Fe([n]), a = i.map((c) => ({
|
|
750
750
|
solution: c,
|
|
751
|
-
score:
|
|
751
|
+
score: Pe(o, c.embedding)
|
|
752
752
|
}));
|
|
753
|
-
a.sort((c,
|
|
754
|
-
const l = a.slice(0,
|
|
753
|
+
a.sort((c, g) => g.score - c.score);
|
|
754
|
+
const l = a.slice(0, gt);
|
|
755
755
|
if (!l.length)
|
|
756
756
|
return { existingMatches: [] };
|
|
757
757
|
const d = l.map(({ solution: c }) => `${c.title}
|
|
@@ -763,14 +763,14 @@ Description: ${c.description}`).join(`
|
|
|
763
763
|
promptText: await x(D, "findExistingSolution"),
|
|
764
764
|
modelTier: "fast",
|
|
765
765
|
temperature: 0,
|
|
766
|
-
schema:
|
|
766
|
+
schema: ut,
|
|
767
767
|
messages: u,
|
|
768
768
|
inputVariables: { query: s, candidates: d }
|
|
769
|
-
})).matchedTitles.map((c) => l.find(({ solution:
|
|
770
|
-
},
|
|
769
|
+
})).matchedTitles.map((c) => l.find(({ solution: g }) => g.title === c)).filter((c) => c !== void 0) };
|
|
770
|
+
}, $t = (t, e) => {
|
|
771
771
|
const { existingMatches: s } = t, { hitlResponse: n } = e.configurable, i = `confirmExistingSolution:${s[0].solution.id}`;
|
|
772
772
|
if (n?.agentId !== "solutionBuilder" || n.id !== i) {
|
|
773
|
-
s.length === 1 ?
|
|
773
|
+
s.length === 1 ? ce(s[0].solution.id) : le(s);
|
|
774
774
|
const o = s.map((d) => `${d.solution.title}`).join(", "), a = b("existingSolutionMatch", e, { solutionMatch: o }), l = {
|
|
775
775
|
agentId: "solutionBuilder",
|
|
776
776
|
id: i,
|
|
@@ -778,17 +778,17 @@ Description: ${c.description}`).join(`
|
|
|
778
778
|
message: a,
|
|
779
779
|
metadata: []
|
|
780
780
|
};
|
|
781
|
-
throw new
|
|
781
|
+
throw new ie(l);
|
|
782
782
|
}
|
|
783
783
|
return {};
|
|
784
|
-
},
|
|
785
|
-
await
|
|
784
|
+
}, we = async (t, e) => {
|
|
785
|
+
await xe(e);
|
|
786
786
|
const { currentDesign: s } = t, n = t.agentExecutionContext.userRequest;
|
|
787
|
-
await
|
|
787
|
+
await v({ text: b("creatingDesign", e) }, e);
|
|
788
788
|
let i = P(t.selectedTemplate);
|
|
789
|
-
if (i?.initialTemplate || (await
|
|
789
|
+
if (i?.initialTemplate || (await V(e), i = P(t.selectedTemplate)), !i?.initialTemplate)
|
|
790
790
|
throw new Error("No hydrated templates are available for solution design.");
|
|
791
|
-
const o =
|
|
791
|
+
const o = _(
|
|
792
792
|
s ?? i.initialTemplate,
|
|
793
793
|
{
|
|
794
794
|
itemId: (s ?? i.initialTemplate)?.solution?.itemId ?? null,
|
|
@@ -799,65 +799,65 @@ Description: ${c.description}`).join(`
|
|
|
799
799
|
promptText: await x(D, "designSolution"),
|
|
800
800
|
modelTier: "advanced",
|
|
801
801
|
temperature: 0,
|
|
802
|
-
schema:
|
|
802
|
+
schema: G,
|
|
803
803
|
messages: a,
|
|
804
804
|
inputVariables: {
|
|
805
|
-
currentDesign: JSON.stringify(
|
|
805
|
+
currentDesign: JSON.stringify(ae(o)),
|
|
806
806
|
templateInstructions: i.instructions,
|
|
807
807
|
query: n
|
|
808
808
|
}
|
|
809
|
-
}), { response: d, featureLayer: u, ...
|
|
809
|
+
}), { response: d, featureLayer: u, ...h } = l, m = re(
|
|
810
810
|
u,
|
|
811
811
|
o.featureLayer
|
|
812
|
-
), c =
|
|
813
|
-
{ ...
|
|
812
|
+
), c = _(
|
|
813
|
+
{ ...h, featureLayer: m },
|
|
814
814
|
{
|
|
815
815
|
itemId: o?.solution?.itemId,
|
|
816
816
|
sourceBuildSolution: o.sourceBuildSolution,
|
|
817
817
|
templateId: t.selectedTemplate ?? null,
|
|
818
818
|
params: o.params ?? null
|
|
819
819
|
}
|
|
820
|
-
),
|
|
821
|
-
if (!
|
|
820
|
+
), g = new me(c, i.initialTemplate);
|
|
821
|
+
if (!g.isValid)
|
|
822
822
|
return console.warn(
|
|
823
823
|
"[SolutionBuilder] designSolution validation failed:",
|
|
824
|
-
{ issues:
|
|
824
|
+
{ issues: g.issues, llmResponse: l }
|
|
825
825
|
), {
|
|
826
826
|
outputMessage: b("createDesignFailed", e)
|
|
827
827
|
};
|
|
828
|
-
const y = c.sourceBuildSolution,
|
|
829
|
-
if (!
|
|
828
|
+
const y = c.sourceBuildSolution, w = he(c, y);
|
|
829
|
+
if (!w.ok) {
|
|
830
830
|
console.warn(
|
|
831
831
|
"[SolutionBuilder] designSolution Esri JSON conversion failed:",
|
|
832
|
-
{ error:
|
|
832
|
+
{ error: w.error, llmResponse: l, design: c }
|
|
833
833
|
);
|
|
834
|
-
const
|
|
834
|
+
const k = b("createDesignFailed", e);
|
|
835
835
|
return {
|
|
836
|
-
outputMessage:
|
|
837
|
-
summary:
|
|
836
|
+
outputMessage: k,
|
|
837
|
+
summary: k,
|
|
838
838
|
status: "success"
|
|
839
839
|
};
|
|
840
840
|
}
|
|
841
|
-
return
|
|
841
|
+
return ge(c), {
|
|
842
842
|
outputMessage: d,
|
|
843
843
|
summary: d,
|
|
844
844
|
status: "success",
|
|
845
845
|
currentDesign: c
|
|
846
846
|
};
|
|
847
|
-
},
|
|
847
|
+
}, Ft = async (t, e) => {
|
|
848
848
|
const { currentDesign: s } = t;
|
|
849
849
|
if (!s)
|
|
850
|
-
return
|
|
850
|
+
return we(t, e);
|
|
851
851
|
const n = t.agentExecutionContext.userRequest, i = t.agentExecutionContext.messages.slice(-11);
|
|
852
|
-
await
|
|
852
|
+
await v({ text: b("updatingDesign", e) }, e);
|
|
853
853
|
const o = await A({
|
|
854
854
|
promptText: await x(D, "updateDesign"),
|
|
855
855
|
modelTier: "advanced",
|
|
856
856
|
temperature: 0,
|
|
857
|
-
schema:
|
|
857
|
+
schema: dt,
|
|
858
858
|
messages: i,
|
|
859
859
|
inputVariables: {
|
|
860
|
-
currentDesign: JSON.stringify(
|
|
860
|
+
currentDesign: JSON.stringify(qe(s)),
|
|
861
861
|
query: n
|
|
862
862
|
}
|
|
863
863
|
}), { response: a, patches: l } = o;
|
|
@@ -867,49 +867,76 @@ Description: ${c.description}`).join(`
|
|
|
867
867
|
summary: a,
|
|
868
868
|
status: "success"
|
|
869
869
|
};
|
|
870
|
-
const
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
870
|
+
const d = (p) => {
|
|
871
|
+
try {
|
|
872
|
+
return JSON.parse(p);
|
|
873
|
+
} catch {
|
|
874
|
+
const I = p.replace(/[\u0000-\u001F]/g, (Z) => {
|
|
875
|
+
switch (Z) {
|
|
876
|
+
case "\b":
|
|
877
|
+
return "\\b";
|
|
878
|
+
case "\f":
|
|
879
|
+
return "\\f";
|
|
880
|
+
case `
|
|
881
|
+
`:
|
|
882
|
+
return "\\n";
|
|
883
|
+
case "\r":
|
|
884
|
+
return "\\r";
|
|
885
|
+
case " ":
|
|
886
|
+
return "\\t";
|
|
887
|
+
default:
|
|
888
|
+
return "\\u" + Z.charCodeAt(0).toString(16).padStart(4, "0");
|
|
889
|
+
}
|
|
890
|
+
});
|
|
891
|
+
try {
|
|
892
|
+
return JSON.parse(I);
|
|
893
|
+
} catch {
|
|
894
|
+
return p;
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
}, h = [...l.map((p) => ({
|
|
898
|
+
op: p.op,
|
|
899
|
+
path: p.path.replace(/\/+$/, ""),
|
|
900
|
+
...p.value != null && p.value !== "" ? { value: d(p.value) } : {},
|
|
901
|
+
...p.from != null && p.from !== "" ? { from: p.from } : {}
|
|
902
|
+
}))].sort((p, I) => p.op !== "remove" || I.op !== "remove" ? 0 : I.path.localeCompare(p.path, void 0, { numeric: !0 })), m = structuredClone(
|
|
903
|
+
ae(s)
|
|
877
904
|
);
|
|
878
905
|
try {
|
|
879
|
-
|
|
880
|
-
} catch (
|
|
906
|
+
Be(m, h, !0);
|
|
907
|
+
} catch (p) {
|
|
881
908
|
console.warn(
|
|
882
909
|
"[SolutionBuilder] updateDesign JSON patch failed:",
|
|
883
|
-
{ error:
|
|
910
|
+
{ error: p, llmResponse: o, patches: h, patchTarget: m }
|
|
884
911
|
);
|
|
885
|
-
const
|
|
912
|
+
const I = b("applyChangeFailed", e);
|
|
886
913
|
return {
|
|
887
|
-
outputMessage:
|
|
888
|
-
summary:
|
|
914
|
+
outputMessage: I,
|
|
915
|
+
summary: I,
|
|
889
916
|
status: "success"
|
|
890
917
|
};
|
|
891
918
|
}
|
|
892
|
-
const
|
|
893
|
-
{ response: "", ...
|
|
919
|
+
const c = _(
|
|
920
|
+
{ response: "", ...m },
|
|
894
921
|
{ itemId: s.solution?.itemId ?? null }
|
|
895
|
-
),
|
|
896
|
-
if (!
|
|
922
|
+
), g = G.safeParse(c);
|
|
923
|
+
if (!g.success) {
|
|
897
924
|
console.warn(
|
|
898
925
|
"[SolutionBuilder] updateDesign schema validation failed:",
|
|
899
|
-
{ errors:
|
|
926
|
+
{ errors: g.error.issues, llmResponse: o, patchedDesign: c }
|
|
900
927
|
);
|
|
901
|
-
const
|
|
928
|
+
const p = b("applyChangeFailed", e);
|
|
902
929
|
return {
|
|
903
|
-
outputMessage:
|
|
904
|
-
summary:
|
|
930
|
+
outputMessage: p,
|
|
931
|
+
summary: p,
|
|
905
932
|
status: "success"
|
|
906
933
|
};
|
|
907
934
|
}
|
|
908
|
-
const { response:
|
|
909
|
-
|
|
935
|
+
const { response: y, featureLayer: w, ...k } = g.data, B = re(
|
|
936
|
+
w,
|
|
910
937
|
s.featureLayer
|
|
911
|
-
),
|
|
912
|
-
{ ...
|
|
938
|
+
), S = _(
|
|
939
|
+
{ ...k, featureLayer: B },
|
|
913
940
|
{
|
|
914
941
|
itemId: s.solution?.itemId,
|
|
915
942
|
sourceBuildSolution: s.sourceBuildSolution,
|
|
@@ -918,62 +945,62 @@ Description: ${c.description}`).join(`
|
|
|
918
945
|
}
|
|
919
946
|
);
|
|
920
947
|
let L = P(t.selectedTemplate);
|
|
921
|
-
if (L?.initialTemplate || (await
|
|
948
|
+
if (L?.initialTemplate || (await V(e), L = P(t.selectedTemplate)), !L?.initialTemplate)
|
|
922
949
|
throw new Error("No hydrated templates are available for solution design.");
|
|
923
|
-
const
|
|
924
|
-
if (!
|
|
950
|
+
const W = new me(S, L.initialTemplate, !1);
|
|
951
|
+
if (!W.isValid)
|
|
925
952
|
return console.warn(
|
|
926
953
|
"[SolutionBuilder] updateDesign validation failed:",
|
|
927
|
-
{ issues:
|
|
954
|
+
{ issues: W.issues, llmResponse: o, patchedDesign: S }
|
|
928
955
|
), {
|
|
929
956
|
outputMessage: b("applyChangeFailed", e)
|
|
930
957
|
};
|
|
931
|
-
const
|
|
932
|
-
if (!
|
|
958
|
+
const Ie = S.sourceBuildSolution, Y = he(S, Ie);
|
|
959
|
+
if (!Y.ok) {
|
|
933
960
|
console.warn(
|
|
934
961
|
"[SolutionBuilder] updateDesign Esri JSON conversion failed:",
|
|
935
|
-
{ error:
|
|
962
|
+
{ error: Y.error, llmResponse: o, design: S }
|
|
936
963
|
);
|
|
937
|
-
const
|
|
964
|
+
const p = b("applyChangeFailed", e);
|
|
938
965
|
return {
|
|
939
|
-
outputMessage:
|
|
940
|
-
summary:
|
|
966
|
+
outputMessage: p,
|
|
967
|
+
summary: p,
|
|
941
968
|
status: "success"
|
|
942
969
|
};
|
|
943
970
|
}
|
|
944
|
-
return
|
|
971
|
+
return ge(S), {
|
|
945
972
|
outputMessage: a,
|
|
946
973
|
summary: a,
|
|
947
974
|
status: "success",
|
|
948
|
-
currentDesign:
|
|
975
|
+
currentDesign: S
|
|
949
976
|
};
|
|
950
|
-
},
|
|
977
|
+
}, Pt = (t) => t.currentDesign !== null ? "updateDesign" : "assessInitialRequest", Nt = (t) => !t.assessment || !t.assessment.isValidUseCase ? "invalidUseCaseExit" : !t.selectedTemplate && t.assessment.matchedTemplates.length > 1 ? "selectTemplateHIL" : "findExistingSolutions", Bt = (t) => t.existingMatches.length > 0 ? "confirmContinueBuildingHIL" : "designSolution", qt = () => new z(Et).addNode("syncCurrentDesignFromContext", At).addNode("assessInitialRequest", Dt).addNode("invalidUseCaseExit", Lt).addNode("selectTemplateHIL", Mt).addNode("findExistingSolutions", Rt).addNode("confirmContinueBuildingHIL", $t).addNode("designSolution", we).addNode("updateDesign", Ft).addEdge(O, "syncCurrentDesignFromContext").addConditionalEdges("syncCurrentDesignFromContext", Pt, {
|
|
951
978
|
updateDesign: "updateDesign",
|
|
952
979
|
assessInitialRequest: "assessInitialRequest"
|
|
953
|
-
}).addConditionalEdges("assessInitialRequest",
|
|
980
|
+
}).addConditionalEdges("assessInitialRequest", Nt, {
|
|
954
981
|
invalidUseCaseExit: "invalidUseCaseExit",
|
|
955
982
|
selectTemplateHIL: "selectTemplateHIL",
|
|
956
983
|
findExistingSolutions: "findExistingSolutions"
|
|
957
|
-
}).addEdge("invalidUseCaseExit",
|
|
984
|
+
}).addEdge("invalidUseCaseExit", C).addEdge("selectTemplateHIL", "findExistingSolutions").addConditionalEdges("findExistingSolutions", Bt, {
|
|
958
985
|
confirmContinueBuildingHIL: "confirmContinueBuildingHIL",
|
|
959
986
|
designSolution: "designSolution"
|
|
960
|
-
}).addEdge("confirmContinueBuildingHIL", "designSolution").addEdge("designSolution",
|
|
987
|
+
}).addEdge("confirmContinueBuildingHIL", "designSolution").addEdge("designSolution", C).addEdge("updateDesign", C);
|
|
961
988
|
await x(D, "description");
|
|
962
|
-
const
|
|
989
|
+
const Ut = M.object({
|
|
963
990
|
tool: M.enum(["explorer", "builder", "other"]).describe("The selected tool based on the user's query."),
|
|
964
991
|
confidence: M.number().min(0).max(1).describe("A confidence score (0.00–1.00)."),
|
|
965
992
|
rationale: M.string().min(1).describe("A brief rationale for the tool choice (≤140 characters)")
|
|
966
|
-
}),
|
|
993
|
+
}), Q = /* @__PURE__ */ Object.assign({
|
|
967
994
|
"./prompts/assistantResponse.md": () => import("../../chunks/assistantResponse.js").then((t) => t.default),
|
|
968
995
|
"./prompts/classifyIntent.md": () => import("../../chunks/classifyIntent.js").then((t) => t.default),
|
|
969
996
|
"./prompts/description.md": () => import("../../chunks/description.js").then((t) => t.default)
|
|
970
|
-
}),
|
|
997
|
+
}), K = () => {
|
|
971
998
|
const t = new CustomEvent("assistantProcessing", {
|
|
972
999
|
detail: !1
|
|
973
1000
|
});
|
|
974
1001
|
window.dispatchEvent(t);
|
|
975
|
-
},
|
|
976
|
-
...
|
|
1002
|
+
}, Se = f.Root({
|
|
1003
|
+
...j(),
|
|
977
1004
|
selectedTool: f({
|
|
978
1005
|
reducer: (t, e) => e ?? null,
|
|
979
1006
|
default: () => null
|
|
@@ -982,9 +1009,9 @@ const Bt = M.object({
|
|
|
982
1009
|
reducer: (t, e) => e ?? null,
|
|
983
1010
|
default: () => null
|
|
984
1011
|
})
|
|
985
|
-
}),
|
|
1012
|
+
}), zt = async (t, e) => {
|
|
986
1013
|
const s = N(e);
|
|
987
|
-
await
|
|
1014
|
+
await v(
|
|
988
1015
|
{ text: s?.builderMessages.understandingRequest },
|
|
989
1016
|
e
|
|
990
1017
|
);
|
|
@@ -996,11 +1023,11 @@ const Bt = M.object({
|
|
|
996
1023
|
} catch {
|
|
997
1024
|
a = !1;
|
|
998
1025
|
}
|
|
999
|
-
const l = await x(
|
|
1026
|
+
const l = await x(Q, "classifyIntent"), d = await A({
|
|
1000
1027
|
promptText: l,
|
|
1001
1028
|
modelTier: "advanced",
|
|
1002
1029
|
temperature: 0,
|
|
1003
|
-
schema:
|
|
1030
|
+
schema: Ut,
|
|
1004
1031
|
messages: i,
|
|
1005
1032
|
inputVariables: { query: n, activeSolutionDesign: a }
|
|
1006
1033
|
});
|
|
@@ -1008,62 +1035,62 @@ const Bt = M.object({
|
|
|
1008
1035
|
selectedTool: d.tool,
|
|
1009
1036
|
intentRationale: d.rationale
|
|
1010
1037
|
};
|
|
1011
|
-
}, Ut = async (t, e) => {
|
|
1012
|
-
const n = await Ve().compile().invoke(t, e);
|
|
1013
|
-
return Q(), n;
|
|
1014
|
-
}, zt = async (t, e) => {
|
|
1015
|
-
const n = await Nt().compile().invoke(t, e);
|
|
1016
|
-
return Q(), n;
|
|
1017
1038
|
}, Ot = async (t, e) => {
|
|
1039
|
+
const n = await Ke().compile().invoke(t, e);
|
|
1040
|
+
return K(), n;
|
|
1041
|
+
}, jt = async (t, e) => {
|
|
1042
|
+
const n = await qt().compile().invoke(t, e);
|
|
1043
|
+
return K(), n;
|
|
1044
|
+
}, Jt = async (t, e) => {
|
|
1018
1045
|
const s = N(e), n = t.agentExecutionContext.userRequest, i = t.intentRationale ?? "No rationale available.";
|
|
1019
|
-
await
|
|
1046
|
+
await v(
|
|
1020
1047
|
{ text: s?.executingSolutionsAssistantAgent },
|
|
1021
1048
|
e
|
|
1022
1049
|
);
|
|
1023
|
-
const o = await x(
|
|
1050
|
+
const o = await x(Q, "assistantResponse"), a = t.agentExecutionContext.messages.slice(-11), l = await Ne({
|
|
1024
1051
|
promptText: o,
|
|
1025
1052
|
modelTier: "fast",
|
|
1026
1053
|
temperature: 0,
|
|
1027
1054
|
messages: a,
|
|
1028
1055
|
inputVariables: { query: n, rationale: i }
|
|
1029
1056
|
});
|
|
1030
|
-
return
|
|
1057
|
+
return K(), {
|
|
1031
1058
|
outputMessage: l,
|
|
1032
1059
|
summary: l,
|
|
1033
1060
|
status: "success"
|
|
1034
1061
|
};
|
|
1035
|
-
},
|
|
1062
|
+
}, Gt = (t) => t.selectedTool ?? "other", Ht = () => new z(Se).addNode("classifyIntent", zt).addNode("routeToExplorer", Ot).addNode("routeToBuilder", jt).addNode("assistantResponse", Jt).addEdge(O, "classifyIntent").addConditionalEdges("classifyIntent", Gt, {
|
|
1036
1063
|
explorer: "routeToExplorer",
|
|
1037
1064
|
builder: "routeToBuilder",
|
|
1038
1065
|
other: "assistantResponse"
|
|
1039
|
-
}).addEdge("routeToExplorer",
|
|
1066
|
+
}).addEdge("routeToExplorer", C).addEdge("routeToBuilder", C).addEdge("assistantResponse", C), Vt = await x(Q, "description"), Qt = {
|
|
1040
1067
|
id: "solutionsAssistant",
|
|
1041
1068
|
name: "Solutions Assistant Agent",
|
|
1042
|
-
description:
|
|
1043
|
-
createGraph:
|
|
1044
|
-
workspace:
|
|
1045
|
-
},
|
|
1046
|
-
class
|
|
1069
|
+
description: Vt,
|
|
1070
|
+
createGraph: Ht,
|
|
1071
|
+
workspace: Se
|
|
1072
|
+
}, Kt = "https://links.esri.com/solutions/agol-organizational-account", Wt = "https://links.esri.com/solutions/configure-assistants";
|
|
1073
|
+
class Yt extends ke {
|
|
1047
1074
|
constructor() {
|
|
1048
1075
|
super(), this.open = !1, this.userFirstName = "", this.builderVisible = !1, this.hasActiveBuilderDesign = !1, this._conversationId = void 0, this._orgSettings = {
|
|
1049
1076
|
aiAssistantsEnabled: !1,
|
|
1050
1077
|
blockBetaApps: !0,
|
|
1051
1078
|
colocateCompute: !1
|
|
1052
|
-
}, this._suggestedPrompts = [], this._hasInteracted = !1, this._isMobile = window.innerWidth <= 800, this._translations =
|
|
1053
|
-
context:
|
|
1079
|
+
}, this._suggestedPrompts = [], this._hasInteracted = !1, this._isMobile = window.innerWidth <= 800, this._translations = _e({ name: "arcgis-solutions-assistant", blocking: !0 }), this._builderWidth = 48, this._solutionDesignJson = '{ "solution": null }', this._isAssistantBusy = !1, this._isBuilderBusy = !1, this._preChatCheck = !1, this._assistantRef = Re(), this._configContextConsumer = te({
|
|
1080
|
+
context: Ae,
|
|
1054
1081
|
subscribe: !0,
|
|
1055
1082
|
callback: (e) => {
|
|
1056
|
-
e?.portalURL && (
|
|
1083
|
+
e?.portalURL && (se.portalUrl = e.portalURL), e?.userSession && !this.userFirstName && this._loadUserFirstName(), e?.authentication?.PortalSubset?.orgSettings && (this._orgSettings = e?.authentication?.PortalSubset?.orgSettings);
|
|
1057
1084
|
}
|
|
1058
|
-
}), this._builderDesignContextConsumer =
|
|
1059
|
-
context:
|
|
1085
|
+
}), this._builderDesignContextConsumer = te({
|
|
1086
|
+
context: De,
|
|
1060
1087
|
subscribe: !0,
|
|
1061
1088
|
callback: (e) => {
|
|
1062
1089
|
e?.design && (this._solutionDesignJson = JSON.stringify(e.design, null, 2));
|
|
1063
1090
|
}
|
|
1064
1091
|
}), this._handleResize = () => {
|
|
1065
1092
|
this._isMobile = window.innerWidth <= 800;
|
|
1066
|
-
}, this.closeAssistant =
|
|
1093
|
+
}, this.closeAssistant = X(), this.assistantProcessing = X(), this._handleAssistantLinkClick = (e) => {
|
|
1067
1094
|
const s = e.composedPath().find((n) => n instanceof HTMLAnchorElement);
|
|
1068
1095
|
if (s?.href)
|
|
1069
1096
|
if (e.preventDefault(), s.target.indexOf("solutionId:") > -1) {
|
|
@@ -1087,7 +1114,7 @@ class Kt extends Ce {
|
|
|
1087
1114
|
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 };
|
|
1088
1115
|
}
|
|
1089
1116
|
static {
|
|
1090
|
-
this.styles =
|
|
1117
|
+
this.styles = Oe;
|
|
1091
1118
|
}
|
|
1092
1119
|
get _telemetry() {
|
|
1093
1120
|
return this._configContextConsumer.value?.telemetrySession;
|
|
@@ -1102,38 +1129,38 @@ class Kt extends Ce {
|
|
|
1102
1129
|
this._checkURLOpenParameter();
|
|
1103
1130
|
}
|
|
1104
1131
|
load() {
|
|
1105
|
-
this._configContextConsumer.value?.portalURL && (
|
|
1132
|
+
this._configContextConsumer.value?.portalURL && (se.portalUrl = this._configContextConsumer.value.portalURL);
|
|
1106
1133
|
}
|
|
1107
1134
|
firstUpdated(e) {
|
|
1108
1135
|
this._loadUserFirstName();
|
|
1109
1136
|
}
|
|
1110
1137
|
willUpdate(e) {
|
|
1111
|
-
e.has("open") && this.open && window.dispatchEvent(new CustomEvent("openAssistant")), this._configContextConsumer.value?.authentication && this._configContextConsumer.value?.userSession?.token && (this._preChatCheck || (
|
|
1138
|
+
e.has("open") && this.open && window.dispatchEvent(new CustomEvent("openAssistant")), this._configContextConsumer.value?.authentication && this._configContextConsumer.value?.userSession?.token && (this._preChatCheck || (ue(this._configContextConsumer.value?.authentication.Portal, this._configContextConsumer.value?.userSession?.token), this._preChatCheck = !0)), this._configContextConsumer.value?.userSession?.token && this._configContextConsumer.value?.authentication?.CanUseAI;
|
|
1112
1139
|
}
|
|
1113
1140
|
_renderNoSign() {
|
|
1114
|
-
return
|
|
1141
|
+
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 ?? ee} class="padding-top-10">${this._translations.signIn}</calcite-link></calcite-notice>`;
|
|
1115
1142
|
}
|
|
1116
1143
|
_renderNoPermission() {
|
|
1117
|
-
return
|
|
1144
|
+
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">${Ee(this._translations.noPermissionMessage.replace("{{orgUrl}}", Kt).replace("{{configAI}}", Wt))}</div></calcite-notice>`;
|
|
1118
1145
|
}
|
|
1119
1146
|
render() {
|
|
1120
1147
|
let e = this._suggestedPrompts.length > 0 ? this._suggestedPrompts : this._hasInteracted ? [] : Object.values(this._translations.defaultFollowUpQuestions);
|
|
1121
|
-
return this._suggestedPrompts.length > 0 ? e = this._suggestedPrompts : this._hasInteracted || (e = [...Object.values(this._translations.defaultFollowUpQuestions)]),
|
|
1148
|
+
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.builder} text-enabled .indicator=${this.hasActiveBuilderDesign} .disabled=${!this.hasActiveBuilderDesign} .active=${this.builderVisible} selection-appearance=highlight @click=${() => {
|
|
1122
1149
|
window.dispatchEvent(new CustomEvent("toggleSolutionBuilder"));
|
|
1123
1150
|
}} scale=m slot=header-actions-end></calcite-action>` || ""}<calcite-action id=newChatButton icon=speech-bubble-plus .text=${this._translations.tooltips.newConversation} @click=${() => {
|
|
1124
1151
|
this._conversationId = void 0, this._suggestedPrompts = [], this._hasInteracted = !1, this._assistantRef.value?.clearChatHistory();
|
|
1125
|
-
}} 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 &&
|
|
1152
|
+
}} 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 ?? ee} .suggestedPrompts=${e} @arcgisSubmit=${(s) => {
|
|
1126
1153
|
console.log("arcgis submit: ", s.detail), this._suggestedPrompts = [], e = [], this._hasInteracted = !0;
|
|
1127
|
-
const n = Date.now(), i =
|
|
1154
|
+
const n = Date.now(), i = Me(n), o = s.detail || "Unknown";
|
|
1128
1155
|
this._telemetry?.logEvent({
|
|
1129
|
-
category:
|
|
1156
|
+
category: Le.ASSISTANT,
|
|
1130
1157
|
action: "Chat",
|
|
1131
1158
|
dimensions: [o],
|
|
1132
1159
|
metrics: [i]
|
|
1133
1160
|
}), this.assistantProcessing.emit(!0);
|
|
1134
1161
|
}} @arcgisFeedback=${(s) => {
|
|
1135
1162
|
s.detail;
|
|
1136
|
-
}} ${
|
|
1163
|
+
}} ${$e(this._assistantRef)}><arcgis-assistant-agent .agent=${Qt} .context=${{
|
|
1137
1164
|
token: this._configContextConsumer.value?.userSession?.token,
|
|
1138
1165
|
configContext: this._configContextConsumer.value,
|
|
1139
1166
|
convoId: this._conversationId,
|
|
@@ -1169,14 +1196,14 @@ class Kt extends Ce {
|
|
|
1169
1196
|
}
|
|
1170
1197
|
}
|
|
1171
1198
|
_parseAgentPickedAndTask(e) {
|
|
1172
|
-
const s = Array.from(this._assistantRef.value?.messages || []), n = e.log || [], a = [...s].sort((c,
|
|
1199
|
+
const s = Array.from(this._assistantRef.value?.messages || []), n = e.log || [], a = [...s].sort((c, g) => g.id - c.id).find((c) => c.role === "user" && c.id <= e.id)?.content || null, l = n.find((c) => typeof c == "string" && c.includes("Agent picked:")) ?? null;
|
|
1173
1200
|
if (!l)
|
|
1174
1201
|
return { agentPicked: null, taskAssigned: null, userMessage: a };
|
|
1175
1202
|
const d = /Agent picked:\s*(.*?)\s*(?:\\n|\r?\n)\s*Task Assigned:\s*([\s\S]*)$/i, u = l.match(d);
|
|
1176
1203
|
if (!u)
|
|
1177
1204
|
return { agentPicked: null, taskAssigned: null, userMessage: a };
|
|
1178
|
-
const
|
|
1179
|
-
return { agentPicked:
|
|
1205
|
+
const h = u[1].trim(), m = u[2].trim();
|
|
1206
|
+
return { agentPicked: h, taskAssigned: m, userMessage: a };
|
|
1180
1207
|
}
|
|
1181
1208
|
_emitItemIdFromAI(e) {
|
|
1182
1209
|
const s = new CustomEvent("solutionIDFromAssistant", {
|
|
@@ -1187,7 +1214,7 @@ class Kt extends Ce {
|
|
|
1187
1214
|
window.dispatchEvent(s);
|
|
1188
1215
|
}
|
|
1189
1216
|
}
|
|
1190
|
-
|
|
1217
|
+
Ce("arcgis-solutions-assistant", Yt);
|
|
1191
1218
|
export {
|
|
1192
|
-
|
|
1219
|
+
Yt as ArcgisSolutionsAssistant
|
|
1193
1220
|
};
|