@esri/solutions-components 5.1.0-next.135 → 5.1.0-next.137

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.
Files changed (63) hide show
  1. package/dist/cdn/{JSQHZGE3.js → 33UAZ7BX.js} +42 -42
  2. package/dist/cdn/3CSMIYZV.js +2 -0
  3. package/dist/cdn/{PYXXT5H5.js → 3RSUBJQ5.js} +1 -1
  4. package/dist/cdn/{SAWMNQJD.js → 4753O4WX.js} +1 -1
  5. package/dist/cdn/{FOTFZKKU.js → 52QHFDTC.js} +1 -1
  6. package/dist/cdn/{YZVDT3ZT.js → 6RHH635X.js} +1 -1
  7. package/dist/cdn/{S5F6KJQM.js → 7J2F4TFI.js} +1 -1
  8. package/dist/cdn/{K4XOBDPS.js → 7MFLK6JZ.js} +1 -1
  9. package/dist/cdn/{6SSQ6MIC.js → 7NAC32PQ.js} +1 -1
  10. package/dist/cdn/{WQVOA4KV.js → AYQT4HC4.js} +1 -1
  11. package/dist/cdn/BNRFT546.js +2 -0
  12. package/dist/cdn/{ZF5NIURZ.js → BQE2XAKC.js} +1 -1
  13. package/dist/cdn/{75WQ7UGJ.js → D4MZYBH7.js} +1 -1
  14. package/dist/cdn/DGNAMFJN.js +9 -0
  15. package/dist/cdn/{ADNSBINK.js → DNZ5U52C.js} +1 -1
  16. package/dist/cdn/{ZTO4S3BZ.js → E5EU4SVV.js} +1 -1
  17. package/dist/cdn/F3NG6RFP.js +117 -0
  18. package/dist/cdn/GLQZHYJP.js +4 -0
  19. package/dist/cdn/GWWU6HWB.js +48 -0
  20. package/dist/cdn/{DW44YGCV.js → JMCZPJDW.js} +1 -1
  21. package/dist/cdn/{TWJSFINX.js → KGSB4I6Y.js} +1 -1
  22. package/dist/cdn/{PX4CIW7K.js → NPYWZIAM.js} +1 -1
  23. package/dist/cdn/{VFBFI3KQ.js → NWCKV677.js} +1 -1
  24. package/dist/cdn/{P6ANTPJW.js → OYBEDO63.js} +1 -1
  25. package/dist/cdn/{SNK53NIO.js → P2TNN5UL.js} +1 -1
  26. package/dist/cdn/{JW3GYKLH.js → RDAHPMNW.js} +1 -1
  27. package/dist/cdn/{TV3ZHJ7B.js → SAJPXZDW.js} +1 -1
  28. package/dist/cdn/SEHNIZKR.js +2 -0
  29. package/dist/cdn/WGOI2WQZ.js +2 -0
  30. package/dist/cdn/{Z4BCFJUQ.js → XVRJTKAB.js} +25 -25
  31. package/dist/cdn/{L3CMOE2U.js → Z6UCVV4K.js} +1 -1
  32. package/dist/cdn/{PPRV6EZZ.js → ZIX74MNU.js} +1 -1
  33. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.en.json +1 -1
  34. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.json +1 -1
  35. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.en.json +1 -1
  36. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.json +1 -1
  37. package/dist/cdn/index.js +1 -1
  38. package/dist/chunks/assistantResponse.js +51 -0
  39. package/dist/chunks/classifyIntent.js +120 -0
  40. package/dist/chunks/description.js +7 -31
  41. package/dist/chunks/description2.js +36 -0
  42. package/dist/chunks/solution-builder-assistant.js +935 -0
  43. package/dist/chunks/validators.js +1 -1
  44. package/dist/components/arcgis-solutions-assistant/customElement.js +599 -560
  45. package/dist/components/crowdsource-manager/customElement.js +7 -6
  46. package/dist/components/solution-builder-assistant/customElement.d.ts +62 -2
  47. package/dist/components/solution-builder-assistant/customElement.js +14 -872
  48. package/dist/components/solutions-deploy-app/customElement.js +21 -20
  49. package/dist/docs/api.json +1 -1
  50. package/dist/docs/docs.json +1 -1
  51. package/dist/docs/web-types.json +1 -1
  52. package/dist/solutions-components_commit.txt +6 -6
  53. package/package.json +5 -4
  54. package/dist/cdn/6SJB46SK.js +0 -2
  55. package/dist/cdn/BTVZM7QH.js +0 -2
  56. package/dist/cdn/DJMULVG5.js +0 -2
  57. package/dist/cdn/JMO7ZFWL.js +0 -26
  58. package/dist/cdn/JQLLXM7G.js +0 -11
  59. package/dist/cdn/LQPPEXL2.js +0 -4
  60. package/dist/cdn/ZS3UOY5Q.js +0 -2
  61. package/dist/chunks/solutions_assistant_description.js +0 -14
  62. package/dist/chunks/solutions_assistant_prompts.js +0 -29
  63. /package/dist/cdn/{GYL4W6ZG.js → JDCZUOU6.js} +0 -0
@@ -1,29 +1,29 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
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";
2
+ import { c as Se } from "../../chunks/runtime.js";
3
+ import { u as Ie } from "../../chunks/useT9n.js";
4
+ import { LitElement as Ce, createEvent as Y, nothing as Z } from "@arcgis/lumina";
5
+ import { css as _e, html as k } from "lit";
6
+ import { unsafeHTML as ke } from "lit/directives/unsafe-html.js";
7
+ import { useContextConsumer as X } from "@arcgis/lumina/context";
8
+ import { c as Te, b as Ee } from "../../chunks/deployAppContexts.js";
9
+ import { T as Ae } from "../../chunks/interfaces.js";
10
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";
15
- import * as O from "@esri/arcgis-rest-portal";
16
- import { applyPatch as Ne } from "fast-json-patch";
11
+ import ee from "@arcgis/core/config.js";
12
+ import { createRef as Le, ref as Me } from "lit-html/directives/ref.js";
13
+ import { StateGraph as U, START as z, END as I, Annotation as f, NodeInterrupt as se } from "@langchain/langgraph/web";
14
+ import { createAgentRuntimeState as O, sendTraceMessage as w, invokeStructuredPrompt as A, getEmbeddings as Re, cosineSimilarity as $e, invokeTextPrompt as Fe } from "@arcgis/ai-orchestrator";
15
+ import r, { z as M } from "zod";
16
+ import * as j from "@esri/arcgis-rest-portal";
17
+ import { applyPatch as Pe } from "fast-json-patch";
17
18
  import "@langchain/core/messages";
18
- import { C as te } from "../../chunks/converter.js";
19
- import a from "zod";
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";
19
+ import { C as ne } from "../../chunks/converter.js";
20
+ import { g as P, d as ie, r as oe, t as Ne, T as E } from "../../chunks/templates.js";
21
+ import Be from "@arcgis/core/portal/Portal.js";
22
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
- async function w(t, e) {
23
+ const Ue = _e`:host{display:block;height:100%}.margin-lg{margin:var(--calcite-spacing-lg)}.display-flex-row{display:flex;flex-direction:row}.assistant-split-container{display:flex;width:100%;height:calc(100vh - 78px);overflow:hidden;border-radius:10px}.assistant-panel{display:flex;flex-direction:column;height:100%;border:1px solid var(--calcite-color-surface-3);background-color:var(--calcite-color-surface-2);overflow:hidden}.chat-panel{min-width:320px}.builder-panel{min-width:320px;max-width:100%;border-left:1px solid var(--calcite-color-surface-3)}.panel-actions{display:flex;gap:8px;padding:6px;align-items:center}.builder-header,.builder-footer{padding:10px;background:var(--calcite-color-surface-1);border-bottom:1px solid var(--calcite-color-surface-3)}.builder-content{flex:1;overflow:auto;padding:12px}.builder-content pre{white-space:pre-wrap;word-wrap:break-word;max-height:100%;overflow:auto}.builder-actions{display:flex;gap:6px;align-items:center}.padding-left-10{padding-left:10px}.chat-container{display:flex;flex-direction:column;gap:0px;max-width:600px;height:75%;background-color:var(--calcite-color-surface-4);padding:1px}.chat-container_expanded{display:flex;flex-direction:column;gap:0px;max-width:100%;height:95%;background-color:var(--calcite-color-surface-1);border-radius:10px;padding:10px}.chat-panel{--calcite-color-focus: var(--calcite-color-brand);--calcite-panel-border-color: var(--calcite-color-border-2);--calcite-internal-panel-header-vertical-padding: 0px;--calcite-panel-header-content-space: 0px;border:var(--calcite-border-width-sm) solid var(--calcite-color-border-2);height:100%}.header-content{display:flex;align-items:center;gap:var(--calcite-spacing-sm);height:65px;box-sizing:border-box;padding-inline-start:var(--calcite-space-2xl)}.header-title{font-size:var(--calcite-font-size-md);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-text-1)}.beta-chip{--calcite-chip-corner-radius: var(--calcite-corner-radius-half)}.chat-panel calcite-card,.chat-panel calcite-text-area,.chat-panel calcite-button,.chat-panel .chat-messages,.chat-panel .chat-input{--calcite-color-focus: var(--calcite-color-brand)}.assistant-followup-chip:focus{outline:2px solid var(--calcite-color-brand)}.chat-panel-heading{font-size:var(--calcite-font-size-0);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-surface-1, var(--calcite-color-text-1))}.chat-messages{display:flex;flex-direction:column;gap:20px;padding:4px;height:100%;overflow-y:auto}.user-message{align-self:flex-end;background:var(--calcite-color-brand);border-radius:8px;max-width:90%;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-brand);--calcite-card-border-color: var(--calcite-color-brand);color:var(--calcite-color-text-inverse);text-align:left}.system-message{align-self:flex-start;background:var(--calcite-color-surface-3);border-radius:8px;max-width:90%;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-surface-4);--calcite-card-border-color: var(--calcite-color-surface-4);color:var(--calcite-color-inverse);text-align:left}.loader-message{align-self:flex-start;background:var(--calcite-color-surface-4);border-radius:8px;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-surface-4);--calcite-card-border-color: var(--calcite-color-surface-4)}.message-content{padding:0;font-size:14px}.response-message.message-content>p:first-of-type{margin-top:0}.message-content img{max-width:100%;height:auto;display:block;object-fit:contain}.message-content-pad{padding-bottom:10px;font-size:14px}.message-content-summary{padding-bottom:14px}.message-content-alignment{display:flex;align-items:center;gap:var(--calcite-spacing-md);font-size:var(--calcite-font-size--1);color:var(--calcite-color-text-1)}.padding-top-10{padding-top:10px}.padding-right-8{padding-right:8px}.padding-left-right-5{padding-right:5px;padding-left:5px}.chip-content{padding:5px 5px 5px 0}.chat-input{display:flex;flex-direction:row;flex-grow:1}.table-cell{--calcite-table-cell-background: var(--calcite-color-surface-4)}.cursor-pointer{cursor:pointer}.notice-border-color{--temp-initial-brand: var(--calcite-color-brand)}.notice-border-color calcite-notice{--calcite-color-brand: #ddd;--calcite-icon-color: var(--temp-initial-brand)}.notice-border-color calcite-notice *{--calcite-color-brand: var(--temp-initial-brand)}.solution-card{padding:5px 0;text-decoration:none;display:block;width:100%;cursor:pointer}.solution-card calcite-card{display:flex;flex-direction:column;max-width:520px;overflow:hidden;--calcite-card-corner-radius: var(--calcite-corner-radius-round) !important;--calcite-card-shadow: var(--calcite-shadow-sm);--calcite-card-background-color: var(--calcite-card-background-color) }.solution-card div[slot=thumbnail]{max-height:100%;width:100%;position:relative;&:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;transition:all .15s ease-in-out}}.solution-card div[slot=thumbnail] img{max-height:100%;width:100%;object-fit:cover}.solution-card span[slot=description]{padding-top:10px}.solution-card calcite-chip{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);visibility:hidden;pointer-events:none;opacity:0;transition:all .15s ease-in-out;z-index:9999}.solution-card:hover calcite-chip{visibility:visible;opacity:1}.solution-card:hover div[slot=thumbnail]:after{background-color:#00000080}.solution-card:hover h3{text-decoration:underline}.solution-card:focus{outline:2px solid var(--calcite-color-brand)}.references-container{padding-top:10px;display:block}.references-container.collapsed{display:none}.width-100{width:100%}.disclaimer-div{display:flex;align-items:center;gap:var(--calcite-spacing-sm);font-size:var(--calcite-font-size--0);color:var(--calcite-color-text-1)}.display-none{display:none}.chat-messages calcite-fab{position:absolute;bottom:16px;left:50%;transform:translate(-50%);z-index:999}.icon-color-background{--calcite-button-icon-color: var(--calcite-color-surface-1)}#closeAssistantButton{--calcite-action-text-color: var(--calcite-color-text-1)}.icon-color-background:focus{--calcite-color-focus: var(--calcite-color-surface-1)}@media(max-width:430px){.solution-card .solution-snippet{display:none}}.height-32-flex-auto{height:32px;flex:0 0 auto}.margin-top-0.message-content>p:first-of-type{margin-top:0}a:not(.solution-card){color:var(--calcite-link-text-color, var(--calcite-color-text-link));cursor:pointer;text-decoration:none;line-height:inherit;background-image:linear-gradient(currentColor,currentColor),linear-gradient(var(--calcite-color-brand-underline),var(--calcite-color-brand-underline));background-position-x:0%,100%;background-position-y:min(1.5em,100%);background-repeat:no-repeat,no-repeat;background-size:0% 1px,100% 1px;transition-property:background-size,color;transition-duration:var(--calcite-animation-timing, .15s);transition-timing-function:ease-in-out;outline-color:transparent;position:relative}a:not(.solution-card):hover{background-size:100% 1px,100% 1px}a:not(.solution-card):focus{outline:2px solid var(--calcite-color-brand);outline-offset:2px;outline-color:var(--calcite-color-brand)}a:not(.solution-card):active{color:var(--calcite-color-brand-press)}`;
24
+ async function x(t, e) {
25
25
  const s = Object.entries(t).find(
26
- ([i]) => i.endsWith(`/${e}.md`)
26
+ ([n]) => n.endsWith(`/${e}.md`)
27
27
  );
28
28
  if (!s)
29
29
  throw new Error(
@@ -34,13 +34,13 @@ ${Object.keys(t).join(`
34
34
  );
35
35
  return await s[1]();
36
36
  }
37
- function j(t) {
37
+ function N(t) {
38
38
  return t?.configurable?.context?.translations;
39
39
  }
40
- function ne(t) {
40
+ function ae(t) {
41
41
  if (typeof window > "u" || t.length <= 1)
42
42
  return;
43
- const e = t.map((i) => i.solution.id), s = t.map((i) => i.solution.title);
43
+ const e = t.map((n) => n.solution.id), s = t.map((n) => n.solution.title);
44
44
  window.dispatchEvent(new CustomEvent("searchTermSet", {
45
45
  detail: {
46
46
  scope: "all-solutions",
@@ -59,7 +59,7 @@ function ne(t) {
59
59
  }
60
60
  }));
61
61
  }
62
- function oe(t) {
62
+ function re(t) {
63
63
  if (typeof window > "u" || !t)
64
64
  return;
65
65
  const e = new CustomEvent("solutionIDFromAssistant", {
@@ -69,35 +69,165 @@ function oe(t) {
69
69
  });
70
70
  window.dispatchEvent(e);
71
71
  }
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..." },
72
+ const ze = /* @__PURE__ */ Object.assign({
73
+ "./prompts/solutions_explorer_description.md": () => import("../../chunks/solutions_explorer_description.js").then((t) => t.default)
74
+ });
75
+ function Oe(t) {
76
+ return t.replace(/<sup>\[\[(\d+)\]\]\(([^)]+)\)<\/sup>/g, '<sup><a href="$2">&#91;$1&#93;</a></sup>');
77
+ }
78
+ function je(t, e) {
79
+ const s = [];
80
+ return (e?.configurable?.context?.configContext.allCards ?? []).forEach((i) => {
81
+ const o = i.title;
82
+ if (t.toLowerCase().includes(o.toLowerCase())) {
83
+ const a = `<a href="" target="solutionId:${i.deployCommonId}">${o}</a>`, l = new RegExp(o, "gi");
84
+ t = t.replace(l, a), s.push({
85
+ solution: {
86
+ title: i.title,
87
+ id: i.deployCommonId,
88
+ snippet: i.snippet,
89
+ description: i.description
90
+ },
91
+ score: 100
92
+ });
93
+ }
94
+ }), { source: t, allMatches: s };
95
+ }
96
+ function Je(t) {
97
+ return t && t.helperServices.aiAssistantServices ? `${t.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/chat` : null;
98
+ }
99
+ function le(t) {
100
+ return t && t.helperServices.aiAssistantServices ? `${t.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/api/pre-chat` : null;
101
+ }
102
+ async function q(t, e, s) {
103
+ const n = await fetch(e, {
104
+ method: "POST",
105
+ headers: {
106
+ "Content-Type": "application/json",
107
+ token: s
108
+ },
109
+ body: JSON.stringify(t)
110
+ });
111
+ if (!n.ok)
112
+ throw new Error(`HTTP ${n.status} calling ${e}`);
113
+ return n.json();
114
+ }
115
+ const Ge = (t) => new Promise((e) => setTimeout(e, t)), He = f.Root({
116
+ // Provides agentExecutionContext, outputMessage, summary, and status
117
+ // channels with the orchestrator's standard reducers/defaults so the
118
+ // sub-agent reports back through the same shape the orchestrator
119
+ // persists into priorSteps.
120
+ ...O(),
121
+ solutionResponse: f({
122
+ reducer: (t, e) => e ?? null,
123
+ default: () => null
124
+ }),
125
+ documentSkillUrl: f({
126
+ reducer: (t, e) => e ?? null,
127
+ default: () => null
128
+ }),
129
+ // Persisted across turns via the graph checkpointer so follow-up questions
130
+ // continue the same service conversation. Null on the very first interaction
131
+ // or after messages are cleared.
132
+ conversationId: f({
133
+ reducer: (t, e) => e ?? t,
134
+ default: () => null
135
+ })
136
+ }), Ve = () => new U(He).addNode("initializeAgent", Ke).addNode("askSolutionsQuestions", Qe).addEdge(z, "initializeAgent").addEdge("initializeAgent", "askSolutionsQuestions").addEdge("askSolutionsQuestions", I), ce = async (t, e, s) => {
137
+ if (!t) return;
138
+ const n = le(t);
139
+ if (!n) return;
140
+ const o = { context: {
141
+ kind: "DocAIAssistantRequest",
142
+ filters: {
143
+ products: "ArcGIS Solutions",
144
+ persona: { persona: "apps-solutions" }
145
+ }
146
+ } };
147
+ s && (o.conversationId = s), q(o, n, e ?? "");
148
+ }, Qe = async (t, e) => {
149
+ const s = N(e), n = t.documentSkillUrl;
150
+ let i = [];
151
+ await w(
152
+ { text: s.agentProgress.explorerAgentSearching },
81
153
  e
82
154
  );
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) => {
155
+ let o = await q(
156
+ {
157
+ message: t.agentExecutionContext.userRequest,
158
+ conversationId: e?.configurable?.context?.convoId ?? void 0,
159
+ context: {
160
+ kind: "DocAIAssistantRequest",
161
+ filters: {
162
+ products: "ArcGIS Solutions",
163
+ persona: { persona: "apps-solutions" }
164
+ }
165
+ }
166
+ },
167
+ n,
168
+ e?.configurable?.context?.token ?? ""
169
+ );
170
+ o.conversationId && e?.configurable?.context?.setConversationId && e.configurable.context.setConversationId(o.conversationId);
171
+ let a = {
172
+ message: o.message,
173
+ conversationId: o.conversationId,
174
+ hasMore: o.hasMore,
175
+ ackSequenceNumber: o.sequenceNumber,
176
+ inquiryId: o.inquiryId
177
+ }, l = "", d = null;
178
+ const u = async (p) => {
179
+ const c = p.context?.results?.[0]?.reply ?? "";
180
+ if (c !== "") {
181
+ const y = Oe(c), S = je(y, e);
182
+ l = S.source, i = [
183
+ ...i,
184
+ ...S.allMatches.filter(
185
+ (_) => !i.some((v) => v.solution.id === _.solution.id)
186
+ )
187
+ ];
188
+ }
189
+ c !== "" && p.context?.results?.[0]?.followupQuestions && (d = p.context.results[0].followupQuestions);
190
+ const h = p.context?.results?.[0]?.status?.currentStatusStep;
191
+ if (h) {
192
+ let y = "";
193
+ h === 1 ? y = s.agentProgress.explorerAgentReading : h === 2 ? y = s.agentProgress.explorerAgentReviewing : h === 3 && (y = s.agentProgress.explorerAgentPreparing), await w({ text: y }, e);
194
+ }
195
+ };
196
+ for (await u(o); a.hasMore; )
197
+ await Ge(500), o = await q(
198
+ {
199
+ conversationId: a.conversationId,
200
+ ackSequenceNumber: a.ackSequenceNumber,
201
+ inquiryId: a.inquiryId
202
+ },
203
+ n,
204
+ e?.configurable?.context?.token ?? ""
205
+ ), a = {
206
+ message: o.message,
207
+ conversationId: o.conversationId,
208
+ hasMore: o.hasMore,
209
+ ackSequenceNumber: o.sequenceNumber,
210
+ inquiryId: o.inquiryId
211
+ }, await u(o);
212
+ if (d && e?.configurable?.context?.updateSuggestedPrompts) {
213
+ const p = e.configurable.context.updateSuggestedPrompts, c = d;
214
+ setTimeout(() => p(c), 0);
215
+ }
216
+ return le(e?.configurable?.context.portal) && ce(e?.configurable?.context.portal, e?.configurable?.context.token ?? "", a.conversationId), i.length && (i.length === 1 ? re(i[0].solution.id) : ae(i)), {
217
+ outputMessage: l,
218
+ summary: l,
219
+ status: "success",
220
+ solutionResponse: a,
221
+ conversationId: a.conversationId
222
+ };
223
+ }, Ke = async (t, e) => {
224
+ let s = null;
225
+ return t.documentSkillUrl === null && e?.configurable?.context?.portal && (s = Je(e.configurable.context.portal)), {
226
+ documentSkillUrl: s
227
+ };
228
+ };
229
+ await x(ze, "solutions_explorer_description");
230
+ const de = (t) => {
101
231
  if (t && Array.isArray(t.id) && t.id.length > 0)
102
232
  return t.id[t.id.length - 1].replace("Message", "").toLowerCase();
103
233
  if (t && typeof t._getType == "function")
@@ -107,8 +237,8 @@ const ae = /* @__PURE__ */ Object.assign({
107
237
  return "human";
108
238
  }
109
239
  return "human";
110
- }, He = (t) => {
111
- const e = le(t);
240
+ }, We = (t) => {
241
+ const e = de(t);
112
242
  if (t && t.kwargs)
113
243
  return {
114
244
  role: e,
@@ -123,9 +253,9 @@ const ae = /* @__PURE__ */ Object.assign({
123
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;
124
254
  }
125
255
  return { role: "human", content: String(t) };
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([
256
+ }, Ye = (t) => de(t) === "human", Ze = (t, e = 3) => t.filter((s) => Ye(s)).slice(-e).map(We), Xe = (t, e = " ") => Ze(t).map((i) => i.content).join(e).trim(), et = { 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?" }, tt = {
257
+ builderMessages: et
258
+ }, st = /* @__PURE__ */ new Set([
129
259
  "add",
130
260
  "all",
131
261
  "alter",
@@ -188,9 +318,9 @@ const ae = /* @__PURE__ */ Object.assign({
188
318
  "view",
189
319
  "where"
190
320
  ]);
191
- class ce {
192
- constructor(e, s, i = !0) {
193
- this.isValid = !0, this.issues = [], this.response = e, this.template = s, this.newDesign = i, this.validate();
321
+ class ue {
322
+ constructor(e, s, n = !0) {
323
+ this.isValid = !0, this.issues = [], this.response = e, this.template = s, this.newDesign = n, this.validate();
194
324
  }
195
325
  validate() {
196
326
  this.compareModels(), this.validateResponse();
@@ -199,14 +329,14 @@ class ce {
199
329
  this.compareStrings(), this.compareItems(), this.compareFeatureLayers();
200
330
  }
201
331
  compareStrings() {
202
- const e = new Set(this.template.solution.strings.map((i) => i.key)), s = new Set(this.response.solution.strings.map((i) => i.key));
203
- (e.size !== s.size || [...e].some((i) => !s.has(i))) && this.logIssue("String keys in llm response do not match the template.");
204
- for (const i of this.response.solution.strings)
205
- i.value || this.logIssue(`String key '${i.key}' has no value.`);
332
+ const e = new Set(this.template.solution.strings.map((n) => n.key)), s = new Set(this.response.solution.strings.map((n) => n.key));
333
+ (e.size !== s.size || [...e].some((n) => !s.has(n))) && this.logIssue("String keys in llm response do not match the template.");
334
+ for (const n of this.response.solution.strings)
335
+ n.value || this.logIssue(`String key '${n.key}' has no value.`);
206
336
  }
207
337
  compareItems() {
208
- const e = new Set(this.template.items.map((i) => i.id)), s = new Set(this.response.items.map((i) => i.id));
209
- (e.size !== s.size || [...e].some((i) => !s.has(i))) && this.logIssue("Item ids in llm response do not match the template.");
338
+ const e = new Set(this.template.items.map((n) => n.id)), s = new Set(this.response.items.map((n) => n.id));
339
+ (e.size !== s.size || [...e].some((n) => !s.has(n))) && this.logIssue("Item ids in llm response do not match the template.");
210
340
  }
211
341
  compareFeatureLayers() {
212
342
  const e = this.template.featureLayer, s = this.response.featureLayer;
@@ -215,25 +345,25 @@ class ce {
215
345
  return;
216
346
  }
217
347
  if (!e.addLayers) {
218
- const i = new Set(e.layers.map((o) => o.id)), n = new Set(s.layers.map((o) => o.id));
219
- (i.size !== n.size || [...i].some((o) => !n.has(o))) && this.logIssue(`Feature Layer '${e.itemId}' had its layer ids altered.`);
348
+ const n = new Set(e.layers.map((o) => o.id)), i = new Set(s.layers.map((o) => o.id));
349
+ (n.size !== i.size || [...n].some((o) => !i.has(o))) && this.logIssue(`Feature Layer '${e.itemId}' had its layer ids altered.`);
220
350
  }
221
351
  }
222
352
  validateResponse() {
223
353
  const e = this.template.featureLayer.layers;
224
354
  this.response.featureLayer.layers.length || this.logIssue("Feature layer item must contain at least one layer.");
225
- const s = this.response.featureLayer.layers.map((i) => i.name.toLowerCase());
355
+ const s = this.response.featureLayer.layers.map((n) => n.name.toLowerCase());
226
356
  s.length !== new Set(s).size && this.logIssue("Layer names must be unique (case-insensitive).");
227
- for (const i of this.response.featureLayer.layers) {
228
- this.validateLayer(i);
229
- const n = e.find((o) => o.id === i.id);
230
- n && this.validateRequiredFields(i, n);
357
+ for (const n of this.response.featureLayer.layers) {
358
+ this.validateLayer(n);
359
+ const i = e.find((o) => o.id === n.id);
360
+ i && this.validateRequiredFields(n, i);
231
361
  }
232
362
  }
233
363
  validateRequiredFields(e, s) {
234
- const i = new Set(e.requiredFields.map((n) => n.name));
235
- for (const n of s.requiredFields)
236
- i.has(n.name) || this.logIssue(`Layer '${e.name}' is missing required field '${n.name}'.`);
364
+ const n = new Set(e.requiredFields.map((i) => i.name));
365
+ for (const i of s.requiredFields)
366
+ n.has(i.name) || this.logIssue(`Layer '${e.name}' is missing required field '${i.name}'.`);
237
367
  }
238
368
  validateLayer(e) {
239
369
  const s = /* @__PURE__ */ new Set([
@@ -243,25 +373,25 @@ class ce {
243
373
  "created_user",
244
374
  "last_edited_date",
245
375
  "last_edited_user"
246
- ]), i = e.systemFields ?? [];
247
- if (i.length) {
248
- const o = new Set(i.map((l) => l.name));
376
+ ]), n = e.systemFields ?? [];
377
+ if (n.length) {
378
+ const o = new Set(n.map((l) => l.name));
249
379
  (o.size !== s.size || [...s].some((l) => !o.has(l))) && this.logIssue(
250
380
  `Layer '${e.name}' has invalid system fields: ${JSON.stringify([...o])}.`
251
381
  );
252
382
  }
253
- const n = [
383
+ const i = [
254
384
  ...e.customFields,
255
385
  ...e.requiredFields,
256
- ...i
386
+ ...n
257
387
  ].map((o) => o.name);
258
- n.length !== new Set(n).size && this.logIssue(`Layer '${e.name}' has duplicate fields: ${JSON.stringify(n)}.`);
259
- for (const o of [...e.customFields, ...e.requiredFields, ...i])
388
+ i.length !== new Set(i).size && this.logIssue(`Layer '${e.name}' has duplicate fields: ${JSON.stringify(i)}.`);
389
+ for (const o of [...e.customFields, ...e.requiredFields, ...n])
260
390
  this.validateField(o);
261
391
  }
262
392
  validateField(e) {
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)) {
264
- const s = Math.max(...e.choiceList.map((i) => i.length));
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.`), st.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
+ const s = Math.max(...e.choiceList.map((n) => n.length));
265
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}.`));
266
396
  }
267
397
  }
@@ -269,15 +399,15 @@ class ce {
269
399
  console.debug(e), this.issues.push(e), this.isValid = !1;
270
400
  }
271
401
  }
272
- const Xe = a.object({
273
- key: a.string().describe("Stable key identifier for the string."),
274
- value: a.string().describe("Display value for the string."),
275
- description: a.string().describe("Explanation of where/how the string is used.")
276
- }), et = a.object({
277
- id: a.string().describe("ArcGIS item id (32 hex characters)."),
278
- title: a.string().describe("Item title."),
279
- description: a.string().describe("Item description."),
280
- type: a.enum([
402
+ const nt = r.object({
403
+ key: r.string().describe("Stable key identifier for the string."),
404
+ value: r.string().describe("Display value for the string."),
405
+ description: r.string().describe("Explanation of where/how the string is used.")
406
+ }), it = r.object({
407
+ id: r.string().describe("ArcGIS item id (32 hex characters)."),
408
+ title: r.string().describe("Item title."),
409
+ description: r.string().describe("Item description."),
410
+ type: r.enum([
281
411
  "Feature Layer (hosted)",
282
412
  "Feature Layer (hosted, view)",
283
413
  "Web Map",
@@ -296,116 +426,116 @@ const Xe = a.object({
296
426
  "Notebook",
297
427
  "QuickCapture Project"
298
428
  ]).describe("ArcGIS item type.")
299
- }), X = a.object({
300
- name: a.string().describe("Field name."),
301
- type: a.enum(["string", "integer", "double", "date", "oid", "guid", "globalid"]).describe("Field data type."),
302
- alias: a.string().describe("Field alias for display."),
303
- description: a.string().describe("Field description."),
304
- choiceList: a.array(a.string()).nullable().describe(
429
+ }), te = r.object({
430
+ name: r.string().describe("Field name."),
431
+ type: r.enum(["string", "integer", "double", "date", "oid", "guid", "globalid"]).describe("Field data type."),
432
+ alias: r.string().describe("Field alias for display."),
433
+ description: r.string().describe("Field description."),
434
+ choiceList: r.array(r.string()).nullable().describe(
305
435
  "List of allowed values for string fields with a controlled vocabulary. Null if unrestricted or not applicable."
306
436
  ),
307
- length: a.number().int().nullable().describe("Maximum string length for string fields. Null for non-string fields.")
308
- }), tt = a.object({
309
- id: a.number().int().describe("Layer/table id within the feature service."),
310
- type: a.enum(["Point", "Polyline", "Polygon", "Table"]).describe("Layer type."),
311
- name: a.string().describe("Layer/table name."),
312
- description: a.string().describe("Layer/table description."),
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({
316
- itemId: a.string().describe("ArcGIS item id for the feature layer."),
317
- addLayers: a.boolean().describe("Indicates whether new layers can be added during solution design."),
318
- layers: a.array(tt)
319
- }), J = a.object({
320
- response: a.string().describe("Conversational response to the user's query."),
321
- solution: a.object({
322
- itemId: a.string().nullable().describe("ArcGIS item id of the source Solution template used for deployment. Preserve the existing value exactly when known; otherwise use null."),
323
- title: a.string().describe("Title of the solution."),
324
- description: a.string().describe("Description of the solution."),
325
- tags: a.array(a.string()).describe("Keywords/tags associated with the solution."),
326
- strings: a.array(Xe).describe("Localized strings/labels used by apps (dashboards, forms, etc.).")
437
+ length: r.number().int().nullable().describe("Maximum string length for string fields. Null for non-string fields.")
438
+ }), ot = r.object({
439
+ id: r.number().int().describe("Layer/table id within the feature service."),
440
+ type: r.enum(["Point", "Polyline", "Polygon", "Table"]).describe("Layer type."),
441
+ name: r.string().describe("Layer/table name."),
442
+ description: r.string().describe("Layer/table description."),
443
+ customFields: r.array(te).describe("User/business fields specific to the solution."),
444
+ requiredFields: r.array(te).describe("Fields required for solution functionality (e.g., relationship keys).")
445
+ }), at = r.object({
446
+ itemId: r.string().describe("ArcGIS item id for the feature layer."),
447
+ addLayers: r.boolean().describe("Indicates whether new layers can be added during solution design."),
448
+ layers: r.array(ot)
449
+ }), J = r.object({
450
+ response: r.string().describe("Conversational response to the user's query."),
451
+ solution: r.object({
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
+ title: r.string().describe("Title of the solution."),
454
+ description: r.string().describe("Description of the solution."),
455
+ tags: r.array(r.string()).describe("Keywords/tags associated with the solution."),
456
+ strings: r.array(nt).describe("Localized strings/labels used by apps (dashboards, forms, etc.).")
327
457
  }),
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({
331
- op: a.enum(["add", "remove", "replace", "move", "copy"]).describe("RFC 6902 operation type."),
332
- path: a.string().describe("RFC 6901 JSON Pointer to the target location."),
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.`),
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.")
335
- }), nt = a.object({
336
- response: a.string().describe("Conversational response describing the accepted design changes."),
337
- patches: a.array(it).describe("Minimal RFC 6902 patch operations needed to update the current design.")
338
- }), ot = a.object({
339
- matchedTitles: a.array(a.string()).describe("Titles of solutions that match the user's request. Empty array if no strong match.")
340
- }), at = a.object({
341
- templateId: a.string().min(1).describe("Template id from the available template list."),
342
- confidence: a.number().min(0).max(1).describe("Confidence score from 0 to 1 for this template match."),
343
- templateDescription: a.string().min(1).describe("Short description this template in the user's use case/workflow.")
344
- }), rt = a.object({
345
- assistantResponse: a.string().describe("Natural-language response for the user."),
346
- isValidUseCase: a.boolean().describe("True only when the request is concrete, appropriate, and has at least one matching template."),
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({
351
- "./prompts/description.md": () => import("../../chunks/description.js").then((t) => t.default),
458
+ items: r.array(it).describe("ArcGIS items that belong to the solution (apps, maps, layers, etc.)."),
459
+ featureLayer: at.describe("Primary feature layer item and its schema/layers/tables details.")
460
+ }), rt = r.object({
461
+ op: r.enum(["add", "remove", "replace", "move", "copy"]).describe("RFC 6902 operation type."),
462
+ path: r.string().describe("RFC 6901 JSON Pointer to the target location."),
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
+ 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
+ }), lt = r.object({
466
+ response: r.string().describe("Conversational response describing the accepted design changes."),
467
+ patches: r.array(rt).describe("Minimal RFC 6902 patch operations needed to update the current design.")
468
+ }), ct = r.object({
469
+ matchedTitles: r.array(r.string()).describe("Titles of solutions that match the user's request. Empty array if no strong match.")
470
+ }), dt = r.object({
471
+ templateId: r.string().min(1).describe("Template id from the available template list."),
472
+ confidence: r.number().min(0).max(1).describe("Confidence score from 0 to 1 for this template match."),
473
+ templateDescription: r.string().min(1).describe("Short description this template in the user's use case/workflow.")
474
+ }), ut = r.object({
475
+ assistantResponse: r.string().describe("Natural-language response for the user."),
476
+ isValidUseCase: r.boolean().describe("True only when the request is concrete, appropriate, and has at least one matching template."),
477
+ matchedTemplates: r.array(dt).describe("Ordered list of matching templates, best match first. Empty when no valid match exists.")
478
+ }), G = (t) => t in E, pt = 5, mt = 0.8, gt = 0.15, ht = "Web Mapping Application", ft = "Embeddings";
479
+ let R = null, B = null, $ = null, F = null;
480
+ const bt = "Build", D = /* @__PURE__ */ Object.assign({
481
+ "./prompts/description.md": () => import("../../chunks/description2.js").then((t) => t.default),
352
482
  "./prompts/designSolution.md": () => import("../../chunks/designSolution.js").then((t) => t.default),
353
483
  "./prompts/findExistingSolution.md": () => import("../../chunks/findExistingSolution.js").then((t) => t.default),
354
484
  "./prompts/initialAssessment.md": () => import("../../chunks/initialAssessment.js").then((t) => t.default),
355
485
  "./prompts/updateDesign.md": () => import("../../chunks/updateDesign.js").then((t) => t.default)
356
- }), gt = Ye.builderMessages, f = (t, e, s) => {
357
- let n = j(e)?.builderMessages?.[t] ?? gt[t];
486
+ }), yt = tt.builderMessages, b = (t, e, s) => {
487
+ let i = N(e)?.builderMessages?.[t] ?? yt[t];
358
488
  if (!s)
359
- return n;
360
- for (const [o, r] of Object.entries(s))
361
- n = n.replaceAll(`{{${o}}}`, r);
362
- return n;
363
- }, de = (t) => {
489
+ return i;
490
+ for (const [o, a] of Object.entries(s))
491
+ i = i.replaceAll(`{{${o}}}`, a);
492
+ return i;
493
+ }, pe = (t) => {
364
494
  typeof window < "u" && window.dispatchEvent(new CustomEvent("arcgis-solution-design-update", {
365
495
  detail: t
366
496
  }));
367
- }, ht = async (t, e, s) => {
497
+ }, vt = async (t, e, s) => {
368
498
  if (!t) return null;
369
- const i = `type:"${ut}" AND typekeywords:${pt} AND group:${t}`;
370
- return (await O.searchItems({
371
- q: i,
499
+ const n = `type:"${ht}" AND typekeywords:${ft} AND group:${t}`;
500
+ return (await j.searchItems({
501
+ q: n,
372
502
  params: e ? { token: e } : void 0,
373
503
  portal: s,
374
504
  num: 1
375
505
  }))?.results?.[0] ?? null;
376
506
  };
377
- async function ft(t, e, s) {
507
+ async function xt(t, e, s) {
378
508
  try {
379
- const i = await ht(t, e, s);
380
- if (!i) return null;
381
- const n = new qe({ id: i.id });
382
- return await n.load(), await n.fetchData("json");
509
+ const n = await vt(t, e, s);
510
+ if (!n) return null;
511
+ const i = new qe({ id: n.id });
512
+ return await i.load(), await i.fetchData("json");
383
513
  } catch {
384
514
  return null;
385
515
  }
386
516
  }
387
- const bt = async (t, e, s) => {
517
+ const wt = async (t, e, s) => {
388
518
  if (!t) return [];
389
- const i = `type:Solution AND typekeywords:${mt} AND group:${t}`;
390
- return (await O.searchItems({
391
- q: i,
519
+ const n = `type:Solution AND typekeywords:${bt} AND group:${t}`;
520
+ return (await j.searchItems({
521
+ q: n,
392
522
  params: e ? { token: e } : void 0,
393
523
  portal: s,
394
524
  num: 100
395
525
  }))?.results ?? [];
396
- }, yt = async (t, e, s) => {
526
+ }, St = async (t, e, s) => {
397
527
  try {
398
- const i = await O.getItemData(t, {
528
+ const n = await j.getItemData(t, {
399
529
  params: e ? { token: e } : void 0,
400
530
  portal: s
401
- }), n = i?.buildSolution;
402
- if (!n) return null;
403
- const o = i?.params, r = o && typeof o == "object" && !Array.isArray(o) ? o : null;
404
- return { buildSolution: n, params: r };
531
+ }), i = n?.buildSolution;
532
+ if (!i) return null;
533
+ const o = n?.params, a = o && typeof o == "object" && !Array.isArray(o) ? o : null;
534
+ return { buildSolution: i, params: a };
405
535
  } catch {
406
536
  return null;
407
537
  }
408
- }, _ = (t, e = {}) => {
538
+ }, C = (t, e = {}) => {
409
539
  let s = t;
410
540
  return "itemId" in e && (s = {
411
541
  ...s,
@@ -423,12 +553,12 @@ const bt = async (t, e, s) => {
423
553
  ...s,
424
554
  templateId: e.templateId ?? null
425
555
  }), s;
426
- }, ue = (t, e) => {
556
+ }, me = (t, e) => {
427
557
  if (t == null || e == null)
428
558
  return { ok: !1, error: "design or sourceBuildSolution is null/undefined" };
429
559
  try {
430
560
  const s = structuredClone(e);
431
- return new te({ buildSolution: s }).applyLlmTemplate(t), { ok: !0 };
561
+ return new ne({ buildSolution: s }).applyLlmTemplate(t), { ok: !0 };
432
562
  } catch (s) {
433
563
  return {
434
564
  ok: !1,
@@ -436,95 +566,95 @@ const bt = async (t, e, s) => {
436
566
  };
437
567
  }
438
568
  }, H = async (t) => {
439
- if (N) {
440
- Object.entries(N).forEach(([r, l]) => {
441
- L[r] && (L[r].initialTemplate = l);
569
+ if (B) {
570
+ Object.entries(B).forEach(([a, l]) => {
571
+ E[a] && (E[a].initialTemplate = l);
442
572
  });
443
573
  return;
444
574
  }
445
- const e = t?.configurable?.context?.token, s = me(t), i = ge(t);
575
+ const e = t?.configurable?.context?.token, s = he(t), n = fe(t);
446
576
  if (!s) {
447
577
  console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping live template hydration.");
448
578
  return;
449
579
  }
450
- const n = await bt(s, e, i), o = {};
451
- await Promise.all(n.map(async (r) => {
452
- const l = r.properties?.templateInfo;
580
+ const i = await wt(s, e, n), o = {};
581
+ await Promise.all(i.map(async (a) => {
582
+ const l = a.properties?.templateInfo;
453
583
  if (!l || typeof l != "object") return;
454
584
  const d = l.id;
455
585
  if (typeof d != "string" || o[d]) return;
456
- const u = await yt(r.id, e, i);
586
+ const u = await St(a.id, e, n);
457
587
  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;
588
+ const { buildSolution: g, params: p } = u;
589
+ if (typeof g == "object" && g !== null && "solution" in g) {
590
+ const h = g.solution;
591
+ h.thumbnailUrl = a.thumbnail ? `${n ?? "https://www.arcgis.com/sharing/rest"}/content/items/${a.id}/info/${a.thumbnail}` : void 0;
462
592
  }
463
593
  const c = {
464
594
  ...l,
465
- buildSolution: m
595
+ buildSolution: g
466
596
  };
467
- o[d] = _(
468
- new te(c).dumpToLlmTemplate(),
597
+ o[d] = C(
598
+ new ne(c).dumpToLlmTemplate(),
469
599
  {
470
- itemId: r.id,
471
- sourceBuildSolution: structuredClone(m),
472
- params: h ? structuredClone(h) : null
600
+ itemId: a.id,
601
+ sourceBuildSolution: structuredClone(g),
602
+ params: p ? structuredClone(p) : null
473
603
  }
474
- ), L[d] = {
604
+ ), E[d] = {
475
605
  ...l,
476
606
  initialTemplate: o[d]
477
607
  };
478
- })), N = o;
479
- }, pe = (t) => {
608
+ })), B = o;
609
+ }, ge = (t) => {
480
610
  const e = t?.configurable?.context?.token;
481
611
  return typeof e != "string" || !e.trim() ? null : e;
482
- }, me = (t) => {
612
+ }, he = (t) => {
483
613
  const e = t?.configurable?.context?.configContext?.primarySolutionsGroupId;
484
614
  return typeof e != "string" || !e.trim() ? null : e;
485
- }, ge = (t) => {
615
+ }, fe = (t) => {
486
616
  const e = t?.configurable?.context?.configContext?.portalURL;
487
617
  if (!(typeof e != "string" || !e.trim()))
488
618
  return `${e.replace(/\/+$/, "")}/sharing/rest`;
489
- }, vt = async (t) => {
619
+ }, It = async (t) => {
490
620
  await Promise.all([
491
- fe(t),
621
+ ye(t),
492
622
  H(t)
493
623
  ]);
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;
624
+ }, be = async (t) => {
625
+ const e = ge(t);
626
+ (!$ || e && e !== F) && (F = e ?? F, $ = It(t).catch((n) => {
627
+ throw $ = null, F = null, n;
498
628
  })), await $;
499
629
  };
500
- async function fe(t) {
501
- if (M) return M;
502
- const e = me(t);
630
+ async function ye(t) {
631
+ if (R) return R;
632
+ const e = he(t);
503
633
  if (!e)
504
634
  return console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping embeddings load."), null;
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;
635
+ const s = fe(t), n = t?.configurable?.context?.configContext?.portalURL;
636
+ await new Be(n ? { url: n } : void 0).load();
637
+ const o = ge(t) ?? void 0, a = await xt(e, o, s);
638
+ return a ? (R = a.items, R) : null;
509
639
  }
510
- const xt = () => Object.entries(L).map(([t, e]) => `ID: ${t}
640
+ const Ct = () => Object.entries(E).map(([t, e]) => `ID: ${t}
511
641
  Label: ${e.label}
512
642
  Description: ${e.description}`).join(`
513
643
 
514
- `), wt = (t) => {
644
+ `), _t = (t) => {
515
645
  const e = t?.configurable?.context?.solutionDesignJson;
516
646
  if (typeof e != "string" || !e.trim())
517
647
  return null;
518
648
  try {
519
- const s = JSON.parse(e), i = _(
649
+ const s = JSON.parse(e), n = C(
520
650
  { response: "", ...s },
521
651
  { itemId: s?.solution?.itemId ?? null }
522
- ), n = J.safeParse(i);
523
- if (!n.success)
652
+ ), i = J.safeParse(n);
653
+ if (!i.success)
524
654
  return null;
525
- const { response: o, ...r } = n.data, l = s.templateId, d = typeof l == "string" && G(l) ? l : null;
526
- return _(
527
- r,
655
+ const { response: o, ...a } = i.data, l = s.templateId, d = typeof l == "string" && G(l) ? l : null;
656
+ return C(
657
+ a,
528
658
  {
529
659
  sourceBuildSolution: s.sourceBuildSolution,
530
660
  templateId: d,
@@ -534,99 +664,94 @@ Description: ${e.description}`).join(`
534
664
  } catch {
535
665
  return null;
536
666
  }
537
- }, I = (t) => {
538
- const e = new CustomEvent("assistantProcessing", {
539
- detail: t
540
- });
541
- window.dispatchEvent(e);
542
- }, be = y.Root({
543
- ...z(),
667
+ }, kt = f.Root({
668
+ ...O(),
544
669
  /** Optional human-readable template description retained for UI use. */
545
- templateDescription: y({
670
+ templateDescription: f({
546
671
  reducer: (t, e) => typeof e == "string" || e === null ? e : t ?? null,
547
672
  default: () => null
548
673
  }),
549
674
  /** Current editable design payload being refined across turns. */
550
- currentDesign: y({
675
+ currentDesign: f({
551
676
  reducer: (t = null, e) => e === void 0 ? t : e ?? null,
552
677
  default: () => null
553
678
  }),
554
679
  /** Initial request assessment produced by the intake prompt. */
555
- assessment: y({
680
+ assessment: f({
556
681
  reducer: (t = null, e) => e === void 0 ? t : e ?? null,
557
682
  default: () => null
558
683
  }),
559
684
  /** Template selected automatically or by human-in-the-loop choice. */
560
- selectedTemplate: y({
685
+ selectedTemplate: f({
561
686
  reducer: (t = null, e) => e === void 0 ? t : e ?? null,
562
687
  default: () => null
563
688
  }),
564
689
  /** Existing solution matches surfaced before building a new solution. */
565
- existingMatches: y({
690
+ existingMatches: f({
566
691
  reducer: (t = [], e) => e === void 0 ? t : e ?? [],
567
692
  default: () => []
568
693
  })
569
- }), St = (t, e) => {
570
- const s = wt(e), i = s?.templateId ?? null, n = {};
571
- return JSON.stringify(t.currentDesign) !== JSON.stringify(s) && (n.currentDesign = s), i && t.selectedTemplate !== i && (n.selectedTemplate = i), n;
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"),
694
+ }), Tt = (t, e) => {
695
+ const s = _t(e), n = s?.templateId ?? null, i = {};
696
+ return JSON.stringify(t.currentDesign) !== JSON.stringify(s) && (i.currentDesign = s), n && t.selectedTemplate !== n && (i.selectedTemplate = n), i;
697
+ }, Et = async (t, e) => {
698
+ await w({ text: b("understandingRequest", e) }, e), await be(e);
699
+ const s = t.agentExecutionContext.userRequest, n = Ct(), i = t.agentExecutionContext.messages.slice(-11), o = await A({
700
+ promptText: await x(D, "initialAssessment"),
576
701
  modelTier: "advanced",
577
702
  temperature: 0,
578
- schema: rt,
579
- messages: n,
580
- inputVariables: { query: s, availableTemplates: i }
581
- }), r = o.matchedTemplates.filter(
703
+ schema: ut,
704
+ messages: i,
705
+ inputVariables: { query: s, availableTemplates: n }
706
+ }), a = o.matchedTemplates.filter(
582
707
  (c) => G(c.templateId)
583
708
  ), l = {
584
709
  ...o,
585
- matchedTemplates: r
586
- }, [d, u] = r, h = !!d && d.confidence >= ct && (u === void 0 || d.confidence - u.confidence >= dt) ? d.templateId : null;
710
+ matchedTemplates: a
711
+ }, [d, u] = a, p = !!d && d.confidence >= mt && (u === void 0 || d.confidence - u.confidence >= gt) ? d.templateId : null;
587
712
  return {
588
713
  assessment: l,
589
- selectedTemplate: h,
714
+ selectedTemplate: p,
590
715
  existingMatches: []
591
716
  };
592
- }, Ct = (t) => {
717
+ }, At = (t) => {
593
718
  const e = t.assessment?.assistantResponse ?? "";
594
- return I(!1), {
719
+ return {
595
720
  outputMessage: e,
596
721
  summary: e,
597
722
  status: "success"
598
723
  };
599
- }, _t = (t, e) => {
600
- const { hitlResponse: s } = e.configurable, i = "selectTemplate", n = t.assessment?.matchedTemplates.filter(
724
+ }, Dt = (t, e) => {
725
+ const { hitlResponse: s } = e.configurable, n = "selectTemplate", i = t.assessment?.matchedTemplates.filter(
601
726
  (u) => G(u.templateId)
602
- ) ?? [], o = n.map((u) => `${u.templateDescription}`);
603
- if (s?.agentId !== "solutionBuilder" || s.id !== i) {
727
+ ) ?? [], o = i.map((u) => `${u.templateDescription}`);
728
+ if (s?.agentId !== "solutionBuilder" || s.id !== n) {
604
729
  const u = {
605
730
  agentId: "solutionBuilder",
606
- id: i,
731
+ id: n,
607
732
  kind: "singleSelection",
608
- message: f("selectTemplatePrompt", e),
733
+ message: b("selectTemplatePrompt", e),
609
734
  metadata: [...o]
610
735
  };
611
- throw new ee(u);
736
+ throw new se(u);
612
737
  }
613
- const r = String(s.payload ?? ""), l = o.findIndex((u) => u === r);
738
+ const a = String(s.payload ?? ""), l = o.findIndex((u) => u === a);
614
739
  return {
615
- selectedTemplate: (l >= 0 ? n[l] : void 0)?.templateId ?? n[0]?.templateId ?? null
740
+ selectedTemplate: (l >= 0 ? i[l] : void 0)?.templateId ?? i[0]?.templateId ?? null
616
741
  };
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)
742
+ }, Lt = async (t, e) => {
743
+ await w({ text: b("searchingExistingSolutions", e) }, e);
744
+ const s = t.agentExecutionContext.userRequest, n = Xe(t.agentExecutionContext.messages) || s, i = await ye(e);
745
+ if (!i)
621
746
  return console.warn("Solutions Search: failed to load solution embeddings cache; skipping search."), { existingMatches: [] };
622
- if (!n.length)
747
+ if (!i.length)
623
748
  return { existingMatches: [] };
624
- const [o] = await Fe([i]), r = n.map((c) => ({
749
+ const [o] = await Re([n]), a = i.map((c) => ({
625
750
  solution: c,
626
- score: Re(o, c.embedding)
751
+ score: $e(o, c.embedding)
627
752
  }));
628
- r.sort((c, g) => g.score - c.score);
629
- const l = r.slice(0, lt);
753
+ a.sort((c, h) => h.score - c.score);
754
+ const l = a.slice(0, pt);
630
755
  if (!l.length)
631
756
  return { existingMatches: [] };
632
757
  const d = l.map(({ solution: c }) => `${c.title}
@@ -634,150 +759,157 @@ Snippet: ${c.snippet}
634
759
  Description: ${c.description}`).join(`
635
760
 
636
761
  `), u = t.agentExecutionContext.messages.slice(-11);
637
- return { existingMatches: (await R({
638
- promptText: await w(D, "findExistingSolution"),
762
+ return { existingMatches: (await A({
763
+ promptText: await x(D, "findExistingSolution"),
639
764
  modelTier: "fast",
640
765
  temperature: 0,
641
- schema: ot,
766
+ schema: ct,
642
767
  messages: u,
643
768
  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) => {
646
- const { existingMatches: s } = t, { hitlResponse: i } = e.configurable, n = `confirmExistingSolution:${s[0].solution.id}`;
647
- if (i?.agentId !== "solutionBuilder" || i.id !== n) {
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 = {
769
+ })).matchedTitles.map((c) => l.find(({ solution: h }) => h.title === c)).filter((c) => c !== void 0) };
770
+ }, Mt = (t, e) => {
771
+ const { existingMatches: s } = t, { hitlResponse: n } = e.configurable, i = `confirmExistingSolution:${s[0].solution.id}`;
772
+ if (n?.agentId !== "solutionBuilder" || n.id !== i) {
773
+ s.length === 1 ? re(s[0].solution.id) : ae(s);
774
+ const o = s.map((d) => `${d.solution.title}`).join(", "), a = b("existingSolutionMatch", e, { solutionMatch: o }), l = {
650
775
  agentId: "solutionBuilder",
651
- id: n,
776
+ id: i,
652
777
  kind: "booleanChoice",
653
- message: r,
778
+ message: a,
654
779
  metadata: []
655
780
  };
656
- throw new ee(l);
781
+ throw new se(l);
657
782
  }
658
783
  return {};
659
- }, ye = async (t, e) => {
660
- await he(e);
661
- const { currentDesign: s } = t, i = t.agentExecutionContext.userRequest;
662
- await C({ text: f("creatingDesign", e) }, e);
663
- let n = F(t.selectedTemplate);
664
- if (n?.initialTemplate || (await H(e), n = F(t.selectedTemplate)), !n?.initialTemplate)
784
+ }, ve = async (t, e) => {
785
+ await be(e);
786
+ const { currentDesign: s } = t, n = t.agentExecutionContext.userRequest;
787
+ await w({ text: b("creatingDesign", e) }, e);
788
+ let i = P(t.selectedTemplate);
789
+ if (i?.initialTemplate || (await H(e), i = P(t.selectedTemplate)), !i?.initialTemplate)
665
790
  throw new Error("No hydrated templates are available for solution design.");
666
- const o = _(
667
- s ?? n.initialTemplate,
791
+ const o = C(
792
+ s ?? i.initialTemplate,
668
793
  {
669
- itemId: (s ?? n.initialTemplate)?.solution?.itemId ?? null,
670
- sourceBuildSolution: s?.sourceBuildSolution ?? n.initialTemplate.sourceBuildSolution,
671
- params: s?.params ?? n.initialTemplate.params ?? null
794
+ itemId: (s ?? i.initialTemplate)?.solution?.itemId ?? null,
795
+ sourceBuildSolution: s?.sourceBuildSolution ?? i.initialTemplate.sourceBuildSolution,
796
+ params: s?.params ?? i.initialTemplate.params ?? null
672
797
  }
673
- ), r = t.agentExecutionContext.messages.slice(-11), l = await R({
674
- promptText: await w(D, "designSolution"),
798
+ ), a = t.agentExecutionContext.messages.slice(-11), l = await A({
799
+ promptText: await x(D, "designSolution"),
675
800
  modelTier: "advanced",
676
801
  temperature: 0,
677
802
  schema: J,
678
- messages: r,
803
+ messages: a,
679
804
  inputVariables: {
680
- currentDesign: JSON.stringify(se(o)),
681
- templateInstructions: n.instructions,
682
- query: i
805
+ currentDesign: JSON.stringify(ie(o)),
806
+ templateInstructions: i.instructions,
807
+ query: n
683
808
  }
684
- }), { response: d, featureLayer: u, ...m } = l, h = ie(
809
+ }), { response: d, featureLayer: u, ...g } = l, p = oe(
685
810
  u,
686
811
  o.featureLayer
687
- ), c = _(
688
- { ...m, featureLayer: h },
812
+ ), c = C(
813
+ { ...g, featureLayer: p },
689
814
  {
690
815
  itemId: o?.solution?.itemId,
691
816
  sourceBuildSolution: o.sourceBuildSolution,
692
817
  templateId: t.selectedTemplate ?? null,
693
818
  params: o.params ?? null
694
819
  }
695
- ), g = new ce(c, n.initialTemplate);
696
- if (!g.isValid)
820
+ ), h = new ue(c, i.initialTemplate);
821
+ if (!h.isValid)
697
822
  return console.warn(
698
823
  "[SolutionBuilder] designSolution validation failed:",
699
- { issues: g.issues, llmResponse: l }
824
+ { issues: h.issues, llmResponse: l }
700
825
  ), {
701
- outputMessage: f("createDesignFailed", e)
826
+ outputMessage: b("createDesignFailed", e)
702
827
  };
703
- const x = c.sourceBuildSolution, b = ue(c, x);
704
- if (!b.ok) {
828
+ const y = c.sourceBuildSolution, S = me(c, y);
829
+ if (!S.ok) {
705
830
  console.warn(
706
831
  "[SolutionBuilder] designSolution Esri JSON conversion failed:",
707
- { error: b.error, llmResponse: l, design: c }
832
+ { error: S.error, llmResponse: l, design: c }
708
833
  );
709
- const S = f("createDesignFailed", e);
834
+ const _ = b("createDesignFailed", e);
710
835
  return {
711
- outputMessage: S,
712
- summary: S,
836
+ outputMessage: _,
837
+ summary: _,
713
838
  status: "success"
714
839
  };
715
840
  }
716
- return I(!1), de(c), {
841
+ return pe(c), {
717
842
  outputMessage: d,
718
843
  summary: d,
719
844
  status: "success",
720
845
  currentDesign: c
721
846
  };
722
- }, At = async (t, e) => {
847
+ }, Rt = async (t, e) => {
723
848
  const { currentDesign: s } = t;
724
849
  if (!s)
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"),
850
+ return ve(t, e);
851
+ const n = t.agentExecutionContext.userRequest, i = t.agentExecutionContext.messages.slice(-11);
852
+ await w({ text: b("updatingDesign", e) }, e);
853
+ const o = await A({
854
+ promptText: await x(D, "updateDesign"),
730
855
  modelTier: "advanced",
731
856
  temperature: 0,
732
- schema: nt,
733
- messages: n,
857
+ schema: lt,
858
+ messages: i,
734
859
  inputVariables: {
735
- currentDesign: JSON.stringify(Be(s)),
736
- query: i
860
+ currentDesign: JSON.stringify(Ne(s)),
861
+ query: n
737
862
  }
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)
863
+ }), { response: a, patches: l } = o;
864
+ if (!l || l.length === 0)
865
+ return {
866
+ outputMessage: a,
867
+ summary: a,
868
+ status: "success"
869
+ };
870
+ const u = [...l.map((m) => ({
871
+ op: m.op,
872
+ path: m.path.replace(/\/+$/, ""),
873
+ ...m.value != null && m.value !== "" ? { value: JSON.parse(m.value) } : {},
874
+ ...m.from != null && m.from !== "" ? { from: m.from } : {}
875
+ }))].sort((m, T) => m.op !== "remove" || T.op !== "remove" ? 0 : T.path.localeCompare(m.path, void 0, { numeric: !0 })), g = structuredClone(
876
+ ie(s)
745
877
  );
746
878
  try {
747
- Ne(m, u, !0);
748
- } catch (p) {
879
+ Pe(g, u, !0);
880
+ } catch (m) {
749
881
  console.warn(
750
882
  "[SolutionBuilder] updateDesign JSON patch failed:",
751
- { error: p, llmResponse: o, patches: u, patchTarget: m }
752
- ), I(!1);
753
- const A = f("applyChangeFailed", e);
883
+ { error: m, llmResponse: o, patches: u, patchTarget: g }
884
+ );
885
+ const T = b("applyChangeFailed", e);
754
886
  return {
755
- outputMessage: A,
756
- summary: A,
887
+ outputMessage: T,
888
+ summary: T,
757
889
  status: "success"
758
890
  };
759
891
  }
760
- const h = _(
761
- { response: "", ...m },
892
+ const p = C(
893
+ { response: "", ...g },
762
894
  { itemId: s.solution?.itemId ?? null }
763
- ), c = J.safeParse(h);
895
+ ), c = J.safeParse(p);
764
896
  if (!c.success) {
765
897
  console.warn(
766
898
  "[SolutionBuilder] updateDesign schema validation failed:",
767
- { errors: c.error.issues, llmResponse: o, patchedDesign: h }
768
- ), I(!1);
769
- const p = f("applyChangeFailed", e);
899
+ { errors: c.error.issues, llmResponse: o, patchedDesign: p }
900
+ );
901
+ const m = b("applyChangeFailed", e);
770
902
  return {
771
- outputMessage: p,
772
- summary: p,
903
+ outputMessage: m,
904
+ summary: m,
773
905
  status: "success"
774
906
  };
775
907
  }
776
- const { response: g, featureLayer: x, ...b } = c.data, S = ie(
777
- x,
908
+ const { response: h, featureLayer: y, ...S } = c.data, _ = oe(
909
+ y,
778
910
  s.featureLayer
779
- ), v = _(
780
- { ...b, featureLayer: S },
911
+ ), v = C(
912
+ { ...S, featureLayer: _ },
781
913
  {
782
914
  itemId: s.solution?.itemId,
783
915
  sourceBuildSolution: s.sourceBuildSolution,
@@ -785,232 +917,145 @@ Description: ${c.description}`).join(`
785
917
  params: s.params ?? null
786
918
  }
787
919
  );
788
- let k = F(t.selectedTemplate);
789
- if (k?.initialTemplate || (await H(e), k = F(t.selectedTemplate)), !k?.initialTemplate)
920
+ let L = P(t.selectedTemplate);
921
+ if (L?.initialTemplate || (await H(e), L = P(t.selectedTemplate)), !L?.initialTemplate)
790
922
  throw new Error("No hydrated templates are available for solution design.");
791
- const Q = new ce(v, k.initialTemplate, !1);
792
- if (!Q.isValid)
923
+ const K = new ue(v, L.initialTemplate, !1);
924
+ if (!K.isValid)
793
925
  return console.warn(
794
926
  "[SolutionBuilder] updateDesign validation failed:",
795
- { issues: Q.issues, llmResponse: o, patchedDesign: v }
796
- ), I(!1), {
797
- outputMessage: f("applyChangeFailed", e)
927
+ { issues: K.issues, llmResponse: o, patchedDesign: v }
928
+ ), {
929
+ outputMessage: b("applyChangeFailed", e)
798
930
  };
799
- const Se = v.sourceBuildSolution, V = ue(v, Se);
800
- if (!V.ok) {
931
+ const we = v.sourceBuildSolution, W = me(v, we);
932
+ if (!W.ok) {
801
933
  console.warn(
802
934
  "[SolutionBuilder] updateDesign Esri JSON conversion failed:",
803
- { error: V.error, llmResponse: o, design: v }
935
+ { error: W.error, llmResponse: o, design: v }
804
936
  );
805
- const p = f("applyChangeFailed", e);
806
- return I(!1), {
807
- outputMessage: p,
808
- summary: p,
937
+ const m = b("applyChangeFailed", e);
938
+ return {
939
+ outputMessage: m,
940
+ summary: m,
809
941
  status: "success"
810
942
  };
811
943
  }
812
- return I(!1), de(v), {
813
- outputMessage: r,
814
- summary: r,
944
+ return pe(v), {
945
+ outputMessage: a,
946
+ summary: a,
815
947
  status: "success",
816
948
  currentDesign: v
817
949
  };
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, {
950
+ }, $t = (t) => t.currentDesign !== null ? "updateDesign" : "assessInitialRequest", Ft = (t) => !t.assessment || !t.assessment.isValidUseCase ? "invalidUseCaseExit" : !t.selectedTemplate && t.assessment.matchedTemplates.length > 1 ? "selectTemplateHIL" : "findExistingSolutions", Pt = (t) => t.existingMatches.length > 0 ? "confirmContinueBuildingHIL" : "designSolution", Nt = () => new U(kt).addNode("syncCurrentDesignFromContext", Tt).addNode("assessInitialRequest", Et).addNode("invalidUseCaseExit", At).addNode("selectTemplateHIL", Dt).addNode("findExistingSolutions", Lt).addNode("confirmContinueBuildingHIL", Mt).addNode("designSolution", ve).addNode("updateDesign", Rt).addEdge(z, "syncCurrentDesignFromContext").addConditionalEdges("syncCurrentDesignFromContext", $t, {
819
951
  updateDesign: "updateDesign",
820
952
  assessInitialRequest: "assessInitialRequest"
821
- }).addConditionalEdges("assessInitialRequest", Lt, {
953
+ }).addConditionalEdges("assessInitialRequest", Ft, {
822
954
  invalidUseCaseExit: "invalidUseCaseExit",
823
955
  selectTemplateHIL: "selectTemplateHIL",
824
956
  findExistingSolutions: "findExistingSolutions"
825
- }).addEdge("invalidUseCaseExit", E).addEdge("selectTemplateHIL", "findExistingSolutions").addConditionalEdges("findExistingSolutions", Dt, {
957
+ }).addEdge("invalidUseCaseExit", I).addEdge("selectTemplateHIL", "findExistingSolutions").addConditionalEdges("findExistingSolutions", Pt, {
826
958
  confirmContinueBuildingHIL: "confirmContinueBuildingHIL",
827
959
  designSolution: "designSolution"
828
- }).addEdge("confirmContinueBuildingHIL", "designSolution").addEdge("designSolution", E).addEdge("updateDesign", E), $t = await w(D, "description"), Pt = {
829
- id: "solutionsBuilder",
830
- name: "Solutions Builder Agent",
831
- description: $t,
832
- createGraph: Mt,
833
- workspace: be
834
- }, Ft = /* @__PURE__ */ Object.assign({
835
- "./prompts/solutions_explorer_description.md": () => import("../../chunks/solutions_explorer_description.js").then((t) => t.default)
836
- });
837
- function Rt(t) {
838
- return t.replace(/<sup>\[\[(\d+)\]\]\(([^)]+)\)<\/sup>/g, '<sup><a href="$2">&#91;$1&#93;</a></sup>');
839
- }
840
- function Nt(t, e) {
841
- const s = [];
842
- return (e?.configurable?.context?.configContext.allCards ?? []).forEach((n) => {
843
- const o = n.title;
844
- if (t.toLowerCase().includes(o.toLowerCase())) {
845
- const r = `<a href="" target="solutionId:${n.deployCommonId}">${o}</a>`, l = new RegExp(o, "gi");
846
- t = t.replace(l, r), s.push({
847
- solution: {
848
- title: n.title,
849
- id: n.deployCommonId,
850
- snippet: n.snippet,
851
- description: n.description
852
- },
853
- score: 100
854
- });
855
- }
856
- }), { source: t, allMatches: s };
857
- }
858
- function Bt(t) {
859
- return t && t.helperServices.aiAssistantServices ? `${t.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/chat` : null;
860
- }
861
- function ve(t) {
862
- return t && t.helperServices.aiAssistantServices ? `${t.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/api/pre-chat` : null;
863
- }
864
- async function B(t, e, s) {
865
- const i = await fetch(e, {
866
- method: "POST",
867
- headers: {
868
- "Content-Type": "application/json",
869
- token: s
870
- },
871
- body: JSON.stringify(t)
960
+ }).addEdge("confirmContinueBuildingHIL", "designSolution").addEdge("designSolution", I).addEdge("updateDesign", I);
961
+ await x(D, "description");
962
+ const Bt = M.object({
963
+ tool: M.enum(["explorer", "builder", "other"]).describe("The selected tool based on the user's query."),
964
+ confidence: M.number().min(0).max(1).describe("A confidence score (0.00–1.00)."),
965
+ rationale: M.string().min(1).describe("A brief rationale for the tool choice (≤140 characters)")
966
+ }), V = /* @__PURE__ */ Object.assign({
967
+ "./prompts/assistantResponse.md": () => import("../../chunks/assistantResponse.js").then((t) => t.default),
968
+ "./prompts/classifyIntent.md": () => import("../../chunks/classifyIntent.js").then((t) => t.default),
969
+ "./prompts/description.md": () => import("../../chunks/description.js").then((t) => t.default)
970
+ }), Q = () => {
971
+ const t = new CustomEvent("assistantProcessing", {
972
+ detail: !1
872
973
  });
873
- if (!i.ok)
874
- throw new Error(`HTTP ${i.status} calling ${e}`);
875
- return i.json();
876
- }
877
- const Ut = (t) => new Promise((e) => setTimeout(e, t)), xe = y.Root({
878
- // Provides agentExecutionContext, outputMessage, summary, and status
879
- // channels with the orchestrator's standard reducers/defaults so the
880
- // sub-agent reports back through the same shape the orchestrator
881
- // persists into priorSteps.
882
- ...z(),
883
- solutionResponse: y({
974
+ window.dispatchEvent(t);
975
+ }, xe = f.Root({
976
+ ...O(),
977
+ selectedTool: f({
884
978
  reducer: (t, e) => e ?? null,
885
979
  default: () => null
886
980
  }),
887
- documentSkillUrl: y({
981
+ intentRationale: f({
888
982
  reducer: (t, e) => e ?? null,
889
983
  default: () => null
890
- }),
891
- // Persisted across turns via the graph checkpointer so follow-up questions
892
- // continue the same service conversation. Null on the very first interaction
893
- // or after messages are cleared.
894
- conversationId: y({
895
- reducer: (t, e) => e ?? t,
896
- default: () => null
897
984
  })
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
- if (!t) return;
900
- const i = ve(t);
901
- if (!i) return;
902
- const o = { context: {
903
- kind: "DocAIAssistantRequest",
904
- filters: {
905
- products: "ArcGIS Solutions",
906
- persona: { persona: "apps-solutions" }
907
- }
908
- } };
909
- s && (o.conversationId = s), B(o, i, e ?? "");
910
- }, zt = async (t, e) => {
911
- const s = j(e), i = t.documentSkillUrl;
912
- let n = [];
913
- await C(
914
- { text: s.agentProgress.explorerAgentSearching },
985
+ }), qt = async (t, e) => {
986
+ const s = N(e);
987
+ await w(
988
+ { text: s?.builderMessages.understandingRequest },
915
989
  e
916
990
  );
917
- let o = await B(
918
- {
919
- message: t.agentExecutionContext.userRequest,
920
- conversationId: e?.configurable?.context?.convoId ?? void 0,
921
- context: {
922
- kind: "DocAIAssistantRequest",
923
- filters: {
924
- products: "ArcGIS Solutions",
925
- persona: { persona: "apps-solutions" }
926
- }
927
- }
928
- },
929
- i,
930
- e?.configurable?.context?.token ?? ""
931
- );
932
- o.conversationId && e?.configurable?.context?.setConversationId && e.configurable.context.setConversationId(o.conversationId);
933
- let r = {
934
- message: o.message,
935
- conversationId: o.conversationId,
936
- hasMore: o.hasMore,
937
- ackSequenceNumber: o.sequenceNumber,
938
- inquiryId: o.inquiryId
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
- ...n,
946
- ...S.allMatches.filter(
947
- (v) => !n.some((k) => k.solution.id === v.solution.id)
948
- )
949
- ];
950
- }
951
- g !== "" && c.context?.results?.[0]?.followupQuestions && (d = c.context.results[0].followupQuestions);
952
- const x = c.context?.results?.[0]?.status?.currentStatusStep;
953
- if (x) {
954
- let b = "";
955
- x === 1 ? b = s.agentProgress.explorerAgentReading : x === 2 ? b = s.agentProgress.explorerAgentReviewing : x === 3 && (b = s.agentProgress.explorerAgentPreparing), await C({ text: b }, e);
991
+ const n = t.agentExecutionContext.userRequest, i = t.agentExecutionContext.messages.slice(-11), o = e?.configurable?.context?.solutionDesignJson;
992
+ let a = !1;
993
+ if (typeof o == "string" && o.trim())
994
+ try {
995
+ a = JSON.parse(o).solution != null;
996
+ } catch {
997
+ a = !1;
956
998
  }
999
+ const l = await x(V, "classifyIntent"), d = await A({
1000
+ promptText: l,
1001
+ modelTier: "advanced",
1002
+ temperature: 0,
1003
+ schema: Bt,
1004
+ messages: i,
1005
+ inputVariables: { query: n, activeSolutionDesign: a }
1006
+ });
1007
+ return {
1008
+ selectedTool: d.tool,
1009
+ intentRationale: d.rationale
957
1010
  };
958
- for (await u(o); r.hasMore; )
959
- await Ut(500), o = await B(
960
- {
961
- conversationId: r.conversationId,
962
- ackSequenceNumber: r.ackSequenceNumber,
963
- inquiryId: r.inquiryId
964
- },
965
- i,
966
- e?.configurable?.context?.token ?? ""
967
- ), r = {
968
- message: o.message,
969
- conversationId: o.conversationId,
970
- hasMore: o.hasMore,
971
- ackSequenceNumber: o.sequenceNumber,
972
- inquiryId: o.inquiryId
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
- }
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
- detail: !1
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
+ }, Ot = async (t, e) => {
1018
+ const s = N(e), n = t.agentExecutionContext.userRequest, i = t.intentRationale ?? "No rationale available.";
1019
+ await w(
1020
+ { text: s?.executingSolutionsAssistantAgent },
1021
+ e
1022
+ );
1023
+ const o = await x(V, "assistantResponse"), a = t.agentExecutionContext.messages.slice(-11), l = await Fe({
1024
+ promptText: o,
1025
+ modelTier: "fast",
1026
+ temperature: 0,
1027
+ messages: a,
1028
+ inputVariables: { query: n, rationale: i }
981
1029
  });
982
- return window.dispatchEvent(h), {
1030
+ return Q(), {
983
1031
  outputMessage: l,
984
1032
  summary: l,
985
- status: "success",
986
- solutionResponse: r,
987
- conversationId: r.conversationId
988
- };
989
- }, Ot = async (t, e) => {
990
- let s = null;
991
- return t.documentSkillUrl === null && e?.configurable?.context?.portal && (s = Bt(e.configurable.context.portal)), {
992
- documentSkillUrl: s
1033
+ status: "success"
993
1034
  };
994
- }, jt = await w(Ft, "solutions_explorer_description"), Jt = {
995
- id: "solutionsExplorer",
996
- name: "Solutions Explorer Agent",
997
- description: jt,
998
- createGraph: qt,
1035
+ }, jt = (t) => t.selectedTool ?? "other", Jt = () => new U(xe).addNode("classifyIntent", qt).addNode("routeToExplorer", Ut).addNode("routeToBuilder", zt).addNode("assistantResponse", Ot).addEdge(z, "classifyIntent").addConditionalEdges("classifyIntent", jt, {
1036
+ explorer: "routeToExplorer",
1037
+ builder: "routeToBuilder",
1038
+ other: "assistantResponse"
1039
+ }).addEdge("routeToExplorer", I).addEdge("routeToBuilder", I).addEdge("assistantResponse", I), Gt = await x(V, "description"), Ht = {
1040
+ id: "solutionsAssistant",
1041
+ name: "Solutions Assistant Agent",
1042
+ description: Gt,
1043
+ createGraph: Jt,
999
1044
  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 {
1045
+ }, Vt = "https://links.esri.com/solutions/agol-organizational-account", Qt = "https://links.esri.com/solutions/configure-assistants";
1046
+ class Kt extends Ce {
1002
1047
  constructor() {
1003
1048
  super(), this.open = !1, this.userFirstName = "", this.builderVisible = !1, this.hasActiveBuilderDesign = !1, this._conversationId = void 0, this._orgSettings = {
1004
1049
  aiAssistantsEnabled: !1,
1005
1050
  blockBetaApps: !0,
1006
1051
  colocateCompute: !1
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,
1052
+ }, this._suggestedPrompts = [], this._hasInteracted = !1, this._isMobile = window.innerWidth <= 800, this._translations = Ie({ name: "arcgis-solutions-assistant", blocking: !0 }), this._builderWidth = 48, this._solutionDesignJson = '{ "solution": null }', this._isAssistantBusy = !1, this._isBuilderBusy = !1, this._preChatCheck = !1, this._assistantRef = Le(), this._configContextConsumer = X({
1053
+ context: Te,
1009
1054
  subscribe: !0,
1010
1055
  callback: (e) => {
1011
- e?.portalURL && (Z.portalUrl = e.portalURL), e?.userSession && !this.userFirstName && this._loadUserFirstName(), e?.authentication?.PortalSubset?.orgSettings && (this._orgSettings = e?.authentication?.PortalSubset?.orgSettings);
1056
+ e?.portalURL && (ee.portalUrl = e.portalURL), e?.userSession && !this.userFirstName && this._loadUserFirstName(), e?.authentication?.PortalSubset?.orgSettings && (this._orgSettings = e?.authentication?.PortalSubset?.orgSettings);
1012
1057
  }
1013
- }), this._builderDesignContextConsumer = Y({
1058
+ }), this._builderDesignContextConsumer = X({
1014
1059
  context: Ee,
1015
1060
  subscribe: !0,
1016
1061
  callback: (e) => {
@@ -1018,31 +1063,31 @@ class Qt extends _e {
1018
1063
  }
1019
1064
  }), this._handleResize = () => {
1020
1065
  this._isMobile = window.innerWidth <= 800;
1021
- }, this.closeAssistant = K(), this.assistantProcessing = K(), this._handleAssistantLinkClick = (e) => {
1022
- const s = e.composedPath().find((i) => i instanceof HTMLAnchorElement);
1066
+ }, this.closeAssistant = Y(), this.assistantProcessing = Y(), this._handleAssistantLinkClick = (e) => {
1067
+ const s = e.composedPath().find((n) => n instanceof HTMLAnchorElement);
1023
1068
  if (s?.href)
1024
1069
  if (e.preventDefault(), s.target.indexOf("solutionId:") > -1) {
1025
- const i = s.target.split("solutionId:")[1];
1026
- this._emitItemIdFromAI(i);
1070
+ const n = s.target.split("solutionId:")[1];
1071
+ this._emitItemIdFromAI(n);
1027
1072
  } else
1028
1073
  window.open(s.href, "_blank", "noopener,noreferrer");
1029
1074
  }, this._onSolutionDesignUpdate = (e) => {
1030
- const i = e.detail;
1031
- this._solutionDesignJson = i ? JSON.stringify(i, null, 2) : '{ "solution": null }';
1075
+ const n = e.detail;
1076
+ this._solutionDesignJson = n ? JSON.stringify(n, null, 2) : '{ "solution": null }';
1032
1077
  }, this._handleSignIn = () => {
1033
1078
  this._configContextConsumer.value?.authentication?.signIn("aiOpen");
1034
1079
  }, this._checkURLOpenParameter = () => {
1035
1080
  this.open = this._configContextConsumer.value?.authentication?.SignInParam === "aiOpen" || this.open;
1036
1081
  }, this.listenOn(window, "arcgisFeedback", (e) => {
1037
- const s = e.detail, { agentPicked: i, taskAssigned: n, userMessage: o } = this._parseAgentPickedAndTask(s);
1038
- this._sendFeedback(s.content, o ?? n ?? "", s.feedback?.positive ? "Good" : s.feedback?.positive == "Bad" ? "Bad" : "N/A", i ?? "");
1082
+ const s = e.detail, { agentPicked: n, taskAssigned: i, userMessage: o } = this._parseAgentPickedAndTask(s);
1083
+ this._sendFeedback(s.content, o ?? i ?? "", s.feedback?.positive ? "Good" : s.feedback?.positive == "Bad" ? "Bad" : "N/A", n ?? "");
1039
1084
  });
1040
1085
  }
1041
1086
  static {
1042
1087
  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
1088
  }
1044
1089
  static {
1045
- this.styles = ze;
1090
+ this.styles = Ue;
1046
1091
  }
1047
1092
  get _telemetry() {
1048
1093
  return this._configContextConsumer.value?.telemetrySession;
@@ -1057,66 +1102,60 @@ class Qt extends _e {
1057
1102
  this._checkURLOpenParameter();
1058
1103
  }
1059
1104
  load() {
1060
- this._configContextConsumer.value?.portalURL && (Z.portalUrl = this._configContextConsumer.value.portalURL);
1105
+ this._configContextConsumer.value?.portalURL && (ee.portalUrl = this._configContextConsumer.value.portalURL);
1061
1106
  }
1062
1107
  firstUpdated(e) {
1063
1108
  this._loadUserFirstName();
1064
1109
  }
1065
1110
  willUpdate(e) {
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;
1111
+ e.has("open") && this.open && window.dispatchEvent(new CustomEvent("openAssistant")), this._configContextConsumer.value?.authentication && this._configContextConsumer.value?.userSession?.token && (this._preChatCheck || (ce(this._configContextConsumer.value?.authentication.Portal, this._configContextConsumer.value?.userSession?.token), this._preChatCheck = !0)), this._configContextConsumer.value?.userSession?.token && this._configContextConsumer.value?.authentication?.CanUseAI;
1067
1112
  }
1068
1113
  _renderNoSign() {
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>`;
1114
+ return k`<calcite-notice class="margin-lg" open scale=m icon=effects kind=info><div slot=message>${this._translations.signInMessage}</div><calcite-link @click=${this._handleSignIn} slot=link title=${this._translations.signInMessage ?? Z} class="padding-top-10">${this._translations.signIn}</calcite-link></calcite-notice>`;
1070
1115
  }
1071
1116
  _renderNoPermission() {
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>`;
1117
+ return k`<calcite-notice open scale=m icon=effects kind=info><div slot=title>${this._translations.noPermissionTitle}</div><div slot=message class="padding-top-10">${ke(this._translations.noPermissionMessage.replace("{{orgUrl}}", Vt).replace("{{configAI}}", Qt))}</div></calcite-notice>`;
1073
1118
  }
1074
1119
  render() {
1075
1120
  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)]), 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=${() => {
1121
+ return this._suggestedPrompts.length > 0 ? e = this._suggestedPrompts : this._hasInteracted || (e = [...Object.values(this._translations.defaultFollowUpQuestions)]), k`<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 ? k`${!this._isMobile && k`<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
1122
  window.dispatchEvent(new CustomEvent("toggleSolutionBuilder"));
1078
1123
  }} scale=m slot=header-actions-end></calcite-action>` || ""}<calcite-action id=newChatButton icon=speech-bubble-plus .text=${this._translations.tooltips.newConversation} @click=${() => {
1079
1124
  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 && 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) => {
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 && k`<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 ?? Z} .suggestedPrompts=${e} @arcgisSubmit=${(s) => {
1081
1126
  console.log("arcgis submit: ", s.detail), this._suggestedPrompts = [], e = [], this._hasInteracted = !0;
1082
- const i = Date.now(), n = De(i), o = s.detail || "Unknown";
1127
+ const n = Date.now(), i = De(n), o = s.detail || "Unknown";
1083
1128
  this._telemetry?.logEvent({
1084
- category: Le.ASSISTANT,
1129
+ category: Ae.ASSISTANT,
1085
1130
  action: "Chat",
1086
1131
  dimensions: [o],
1087
- metrics: [n]
1132
+ metrics: [i]
1088
1133
  }), this.assistantProcessing.emit(!0);
1089
1134
  }} @arcgisFeedback=${(s) => {
1090
1135
  s.detail;
1091
- }} ${$e(this._assistantRef)}><arcgis-assistant-agent .agent=${Jt} .context=${{
1136
+ }} ${Me(this._assistantRef)}><arcgis-assistant-agent .agent=${Ht} .context=${{
1092
1137
  token: this._configContextConsumer.value?.userSession?.token,
1093
1138
  configContext: this._configContextConsumer.value,
1094
1139
  convoId: this._conversationId,
1095
1140
  portal: this._configContextConsumer.value?.authentication.Portal,
1096
1141
  assistantRef: this._assistantRef,
1097
1142
  translations: this._translations,
1143
+ solutionDesignJson: this._solutionDesignJson,
1098
1144
  updateSuggestedPrompts: (s) => {
1099
1145
  this._suggestedPrompts = s;
1100
1146
  },
1101
1147
  setConversationId: (s) => {
1102
1148
  this._conversationId = s;
1103
- }
1104
- }}></arcgis-assistant-agent><arcgis-assistant-agent .agent=${Ge} .context=${{
1105
- translations: this._translations,
1149
+ },
1106
1150
  clearSuggestedPrompts: () => {
1107
1151
  this._suggestedPrompts = [];
1108
1152
  }
1109
- }}></arcgis-assistant-agent><arcgis-assistant-agent .agent=${Pt} .context=${{
1110
- solutionDesignJson: this._solutionDesignJson,
1111
- translations: this._translations,
1112
- token: this._configContextConsumer.value?.userSession?.token,
1113
- configContext: this._configContextConsumer.value
1114
1153
  }}></arcgis-assistant-agent></arcgis-assistant><div slot=footer class="disclaimer-div width-100"><calcite-chip class="beta-chip" appearance=outline kind=neutral .label=${this._translations.betaTag} scale=s>${this._translations.betaTag}</calcite-chip><span>${this._translations.disclaimerMessage} <a href=https://links.esri.com/solutions/security-concern rel="noopener noreferrer" target=_blank>${this._translations.reportConcern}</a></span></div>` : this._renderNoPermission() : this._renderNoSign()}<calcite-action icon=x id=closeAssistantButton .label=${this._translations.tooltips.close} @click=${() => {
1115
1154
  this.closeAssistant.emit(!0);
1116
1155
  }} slot=header-actions-end .text=${this._translations.tooltips.close}></calcite-action><calcite-tooltip placement=bottom reference-element=closeAssistantButton><span>${this._translations.tooltips.close}</span></calcite-tooltip></calcite-panel>`;
1117
1156
  }
1118
- _sendFeedback(e, s, i, n) {
1119
- const o = `https://survey123.arcgis.com/share/6e349a50b4504ca6b6107216d568db5f?field:_source=${encodeURIComponent("Solutions Assistant")}&field:user_evaluation=${encodeURIComponent(i)}&field:question=${encodeURIComponent(s)}&field:answer=${encodeURIComponent(e)}&field:context=${encodeURIComponent(JSON.stringify({ agent: n }))}&field:version=${encodeURIComponent("v2")}`;
1157
+ _sendFeedback(e, s, n, i) {
1158
+ const o = `https://survey123.arcgis.com/share/6e349a50b4504ca6b6107216d568db5f?field:_source=${encodeURIComponent("Solutions Assistant")}&field:user_evaluation=${encodeURIComponent(n)}&field:question=${encodeURIComponent(s)}&field:answer=${encodeURIComponent(e)}&field:context=${encodeURIComponent(JSON.stringify({ agent: i }))}&field:version=${encodeURIComponent("v2")}`;
1120
1159
  window.open(o, "_blank");
1121
1160
  }
1122
1161
  async _loadUserFirstName() {
@@ -1130,14 +1169,14 @@ class Qt extends _e {
1130
1169
  }
1131
1170
  }
1132
1171
  _parseAgentPickedAndTask(e) {
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;
1172
+ const s = Array.from(this._assistantRef.value?.messages || []), n = e.log || [], a = [...s].sort((c, h) => h.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;
1134
1173
  if (!l)
1135
- return { agentPicked: null, taskAssigned: null, userMessage: r };
1174
+ return { agentPicked: null, taskAssigned: null, userMessage: a };
1136
1175
  const d = /Agent picked:\s*(.*?)\s*(?:\\n|\r?\n)\s*Task Assigned:\s*([\s\S]*)$/i, u = l.match(d);
1137
1176
  if (!u)
1138
- return { agentPicked: null, taskAssigned: null, userMessage: r };
1139
- const m = u[1].trim(), h = u[2].trim();
1140
- return { agentPicked: m, taskAssigned: h, userMessage: r };
1177
+ return { agentPicked: null, taskAssigned: null, userMessage: a };
1178
+ const g = u[1].trim(), p = u[2].trim();
1179
+ return { agentPicked: g, taskAssigned: p, userMessage: a };
1141
1180
  }
1142
1181
  _emitItemIdFromAI(e) {
1143
1182
  const s = new CustomEvent("solutionIDFromAssistant", {
@@ -1148,7 +1187,7 @@ class Qt extends _e {
1148
1187
  window.dispatchEvent(s);
1149
1188
  }
1150
1189
  }
1151
- Ie("arcgis-solutions-assistant", Qt);
1190
+ Se("arcgis-solutions-assistant", Kt);
1152
1191
  export {
1153
- Qt as ArcgisSolutionsAssistant
1192
+ Kt as ArcgisSolutionsAssistant
1154
1193
  };