@arcgis/ai-components 5.2.0-next.76 → 5.2.0-next.78

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 (156) hide show
  1. package/dist/agents/tools/filter/clearFilters/adapter.d.ts +8 -0
  2. package/dist/{chunks/adapter12.js → agents/tools/filter/clearFilters/adapter.js} +1 -1
  3. package/dist/agents/tools/filter/resetMap/adapter.d.ts +8 -0
  4. package/dist/{chunks/adapter13.js → agents/tools/filter/resetMap/adapter.js} +1 -1
  5. package/dist/agents/tools/filter/setFeatureEffect/adapter.d.ts +8 -0
  6. package/dist/{chunks/adapter14.js → agents/tools/filter/setFeatureEffect/adapter.js} +2 -2
  7. package/dist/agents/tools/help/listFields/adapter.d.ts +11 -0
  8. package/dist/{chunks/adapter11.js → agents/tools/help/listFields/adapter.js} +1 -1
  9. package/dist/agents/tools/navigation/goToAddress/adapter.d.ts +10 -0
  10. package/dist/{chunks/adapter2.js → agents/tools/navigation/goToAddress/adapter.js} +1 -1
  11. package/dist/agents/tools/navigation/goToBookmark/adapter.d.ts +8 -0
  12. package/dist/{chunks/adapter3.js → agents/tools/navigation/goToBookmark/adapter.js} +1 -1
  13. package/dist/agents/tools/navigation/goToFeatures/adapter.d.ts +8 -0
  14. package/dist/{chunks/adapter4.js → agents/tools/navigation/goToFeatures/adapter.js} +1 -1
  15. package/dist/agents/tools/navigation/goToFullExtent/adapter.d.ts +8 -0
  16. package/dist/{chunks/adapter5.js → agents/tools/navigation/goToFullExtent/adapter.js} +1 -1
  17. package/dist/agents/tools/navigation/goToHomeExtent/adapter.d.ts +8 -0
  18. package/dist/{chunks/adapter6.js → agents/tools/navigation/goToHomeExtent/adapter.js} +1 -1
  19. package/dist/agents/tools/navigation/goToLayer/adapter.d.ts +8 -0
  20. package/dist/{chunks/adapter7.js → agents/tools/navigation/goToLayer/adapter.js} +1 -1
  21. package/dist/agents/tools/navigation/goToScale/adapter.d.ts +8 -0
  22. package/dist/{chunks/adapter8.js → agents/tools/navigation/goToScale/adapter.js} +1 -1
  23. package/dist/agents/tools/navigation/goToViewpoint/adapter.d.ts +8 -0
  24. package/dist/{chunks/adapter9.js → agents/tools/navigation/goToViewpoint/adapter.js} +1 -1
  25. package/dist/agents/tools/navigation/goToZoom/adapter.d.ts +8 -0
  26. package/dist/{chunks/adapter10.js → agents/tools/navigation/goToZoom/adapter.js} +1 -1
  27. package/dist/agents/tools/query/getAttribute/adapter.d.ts +8 -0
  28. package/dist/{chunks/adapter15.js → agents/tools/query/getAttribute/adapter.js} +2 -2
  29. package/dist/agents/tools/query/getStatistics/adapter.d.ts +8 -0
  30. package/dist/{chunks/adapter16.js → agents/tools/query/getStatistics/adapter.js} +4 -4
  31. package/dist/agents/tools/query/getTopFeatures/adapter.d.ts +8 -0
  32. package/dist/{chunks/adapter17.js → agents/tools/query/getTopFeatures/adapter.js} +4 -4
  33. package/dist/agents/tools/query/queryFeatures/adapter.d.ts +8 -0
  34. package/dist/{chunks/adapter18.js → agents/tools/query/queryFeatures/adapter.js} +4 -4
  35. package/dist/cdn/{GRHIFCQX.js → 2EY3BQQX.js} +1 -1
  36. package/dist/cdn/3LILAJUD.js +2 -0
  37. package/dist/cdn/{S6OYR4VI.js → 3ORURUNE.js} +7 -7
  38. package/dist/cdn/4F7Y4RNW.js +2 -0
  39. package/dist/cdn/{MM33KJPF.js → 4OGR5QKS.js} +1 -1
  40. package/dist/cdn/{66SKMECC.js → 4WIDLQUH.js} +1 -1
  41. package/dist/cdn/{WMZ24LWS.js → 5X7EG7D2.js} +1 -1
  42. package/dist/cdn/{B6CJG5UH.js → 6U4GTCLJ.js} +14 -14
  43. package/dist/cdn/{7E2QMWK6.js → 7V6OSTFC.js} +1 -1
  44. package/dist/cdn/{5WLNL4HZ.js → 7ZFAFKJT.js} +1 -1
  45. package/dist/cdn/ADJ63EDN.js +3 -0
  46. package/dist/cdn/ATFNWFKG.js +2 -0
  47. package/dist/cdn/{VYTYVWR6.js → BGD2CCRJ.js} +1 -1
  48. package/dist/cdn/{253R5CBD.js → BS3HNSXX.js} +1 -1
  49. package/dist/cdn/{QZ3NQTNQ.js → BWLXDT75.js} +1 -1
  50. package/dist/cdn/{I6PD2HSL.js → CJMUJXPL.js} +1 -1
  51. package/dist/cdn/CZLLPKMS.js +2 -0
  52. package/dist/cdn/{CWD37QFT.js → CZM4URK7.js} +1 -1
  53. package/dist/cdn/EBNVLMUU.js +2 -0
  54. package/dist/cdn/{UPWAOZXQ.js → ERNYKCUJ.js} +1 -1
  55. package/dist/cdn/G5XE5D36.js +2 -0
  56. package/dist/cdn/{5RVELJU4.js → GAPKW32H.js} +1 -1
  57. package/dist/cdn/{HZ5ARNAM.js → GFEOVHJK.js} +1 -1
  58. package/dist/cdn/{U3XIDLHO.js → HPU6K67Y.js} +1 -1
  59. package/dist/cdn/{2VBPA27M.js → I7KCB7KE.js} +1 -1
  60. package/dist/cdn/{323DHVYA.js → IIIUSDQR.js} +1 -1
  61. package/dist/cdn/{TQXLSW4A.js → J7OJABFU.js} +1 -1
  62. package/dist/cdn/{TKYI5QRL.js → JO5ETMPS.js} +1 -1
  63. package/dist/cdn/LXQFE5PJ.js +2 -0
  64. package/dist/cdn/NLEBWLVV.js +2 -0
  65. package/dist/cdn/ORRMONGJ.js +2 -0
  66. package/dist/cdn/{MDM2K3U7.js → PBMQI4MV.js} +1 -1
  67. package/dist/cdn/{6CLF7KIK.js → PKJY7FBV.js} +1 -1
  68. package/dist/cdn/{K33MZ726.js → PUHRBGKB.js} +1 -1
  69. package/dist/cdn/{5DVRVY4L.js → Q57QWN5W.js} +1 -1
  70. package/dist/cdn/QUMNJVKX.js +2 -0
  71. package/dist/cdn/{QRHZXLZN.js → RBE55SWR.js} +1 -1
  72. package/dist/cdn/{RADWN4ZP.js → T4RIGOXB.js} +1 -1
  73. package/dist/cdn/{5R6QUF5B.js → UHZG7SKO.js} +1 -1
  74. package/dist/cdn/{DUSILSNJ.js → XHGVCL22.js} +3 -3
  75. package/dist/cdn/XLHTQ7CF.js +2 -0
  76. package/dist/cdn/{V6HOUZPZ.js → YLGKKWZK.js} +1 -1
  77. package/dist/cdn/YLVJA4ZE.js +2 -0
  78. package/dist/cdn/{NIY32GK2.js → YWULKUQV.js} +1 -1
  79. package/dist/cdn/{IRNSIUBT.js → YYSRYOHL.js} +1 -1
  80. package/dist/cdn/ZOEMBHRF.js +2 -0
  81. package/dist/cdn/ZWBFTKHF.js +2 -0
  82. package/dist/cdn/agent-utils/index.js +1 -1
  83. package/dist/cdn/assets/assistant/t9n/messages.en.json +1 -1
  84. package/dist/cdn/assets/assistant-interrupt/t9n/messages.en.json +1 -1
  85. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.en.json +1 -0
  86. package/dist/cdn/assets/assistant-message/t9n/messages.en.json +1 -0
  87. package/dist/cdn/assets/assistant-message-loading/t9n/messages.en.json +1 -0
  88. package/dist/cdn/index.js +1 -1
  89. package/dist/chunks/adapter.js +57 -60
  90. package/dist/chunks/converterUtils.js +66 -48
  91. package/dist/chunks/helpGraph.js +1 -1
  92. package/dist/chunks/navigationGraph.js +9 -9
  93. package/dist/chunks/utils2.js +10 -41
  94. package/dist/chunks/utils3.js +41 -10
  95. package/dist/components/arcgis-assistant/customElement.d.ts +30 -1
  96. package/dist/components/arcgis-assistant/customElement.js +133 -135
  97. package/dist/components/arcgis-assistant-agent/customElement.js +18 -18
  98. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +11 -11
  99. package/dist/components/arcgis-assistant-help-agent/customElement.js +17 -17
  100. package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +4 -0
  101. package/dist/components/arcgis-assistant-interrupt/customElement.js +10 -11
  102. package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +12 -8
  103. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +18 -18
  104. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +18 -18
  105. package/dist/components/arcgis-assistant-message/customElement.d.ts +3 -0
  106. package/dist/components/arcgis-assistant-message/customElement.js +9 -8
  107. package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +3 -0
  108. package/dist/components/arcgis-assistant-message-loading/customElement.js +11 -10
  109. package/dist/components/arcgis-assistant-message-text/customElement.js +4 -4
  110. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +9 -9
  111. package/dist/components/arcgis-assistant-user-message/customElement.d.ts +2 -0
  112. package/dist/components/arcgis-assistant-user-message/customElement.js +13 -10
  113. package/dist/docs/api.json +1 -1
  114. package/dist/docs/docs.json +1 -1
  115. package/dist/docs/vscode.html-custom-data.json +1 -1
  116. package/dist/docs/web-types.json +1 -1
  117. package/dist/loader.js +4 -4
  118. package/dist/types/lumina.d.ts +2 -2
  119. package/dist/types/preact.d.ts +2 -2
  120. package/dist/types/react.d.ts +2 -2
  121. package/dist/types/stencil.d.ts +2 -2
  122. package/package.json +22 -5
  123. package/dist/cdn/2GH3K5JP.js +0 -2
  124. package/dist/cdn/2Y4DTOGT.js +0 -2
  125. package/dist/cdn/3S5G5SIX.js +0 -2
  126. package/dist/cdn/5TI2F5XX.js +0 -2
  127. package/dist/cdn/DCSZPL7R.js +0 -2
  128. package/dist/cdn/FSGIG7UN.js +0 -2
  129. package/dist/cdn/GLBE7OW2.js +0 -2
  130. package/dist/cdn/IDUC4CPV.js +0 -2
  131. package/dist/cdn/K335IAIE.js +0 -2
  132. package/dist/cdn/KKLAQF3Z.js +0 -2
  133. package/dist/cdn/KLYNL2ZT.js +0 -2
  134. package/dist/cdn/OKMZQXBQ.js +0 -2
  135. package/dist/cdn/T4ECSHM7.js +0 -2
  136. package/dist/cdn/U6FBRUM4.js +0 -3
  137. package/dist/cdn/WSHWQDO2.js +0 -2
  138. package/dist/cdn/XRE5USHA.js +0 -2
  139. /package/dist/cdn/{BS2PFNU4.js → 5WYRJMBW.js} +0 -0
  140. /package/dist/cdn/{RU2T7GUX.js → 5ZFUGNRN.js} +0 -0
  141. /package/dist/cdn/{4YXYLX4H.js → 6HF36IKA.js} +0 -0
  142. /package/dist/cdn/{77QFSIWW.js → 7SRLZQVC.js} +0 -0
  143. /package/dist/cdn/{KA3FF3ZO.js → JKIESH74.js} +0 -0
  144. /package/dist/cdn/{CGXQAB3A.js → K2R6XVK3.js} +0 -0
  145. /package/dist/cdn/{LCFIADOZ.js → KITIP6J2.js} +0 -0
  146. /package/dist/cdn/{T2GJLEYV.js → KWD2ECTM.js} +0 -0
  147. /package/dist/cdn/{DYASSC7Z.js → LLUGJKAQ.js} +0 -0
  148. /package/dist/cdn/{3UEKINYC.js → MMHDT4KV.js} +0 -0
  149. /package/dist/cdn/{WS3T73IY.js → OAKRPM7D.js} +0 -0
  150. /package/dist/cdn/{Q4IQUEZN.js → U2D53TAX.js} +0 -0
  151. /package/dist/cdn/{4MFEKBKL.js → V52XWEGV.js} +0 -0
  152. /package/dist/cdn/{EAEQONP7.js → VLLZ2FFU.js} +0 -0
  153. /package/dist/cdn/{DY36ATOA.js → WKTQVBFJ.js} +0 -0
  154. /package/dist/cdn/{5PJXNTLZ.js → Y7XD7ZRD.js} +0 -0
  155. /package/dist/cdn/{UIXX3XEN.js → YEZ3AMNX.js} +0 -0
  156. /package/dist/cdn/{QVOMX3R6.js → Z5W4V7RC.js} +0 -0
@@ -0,0 +1,8 @@
1
+ import type { StructuredToolInterface } from "@langchain/core/tools";
2
+
3
+ /**
4
+ * Clears all feature effects without changing the current map view.
5
+ *
6
+ * @internal
7
+ */
8
+ export const clearFiltersTool: StructuredToolInterface;
@@ -1,7 +1,7 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import { tool as l } from "@langchain/core/tools";
3
3
  import o from "zod";
4
- import { f } from "./fetchAgentContext.js";
4
+ import { f } from "../../../../chunks/fetchAgentContext.js";
5
5
  const i = (a) => {
6
6
  const r = a.map?.allLayers.filter((t) => t.type === "feature");
7
7
  let e = 0;
@@ -0,0 +1,8 @@
1
+ import type { StructuredToolInterface } from "@langchain/core/tools";
2
+
3
+ /**
4
+ * Clears all feature effects and returns the map to its initial viewpoint.
5
+ *
6
+ * @internal
7
+ */
8
+ export const resetMapTool: StructuredToolInterface;
@@ -1,7 +1,7 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import { tool as n } from "@langchain/core/tools";
3
3
  import i from "zod";
4
- import { f as l } from "./fetchAgentContext.js";
4
+ import { f as l } from "../../../../chunks/fetchAgentContext.js";
5
5
  const f = async (e) => {
6
6
  e.map?.allLayers.filter((t) => t.type === "feature")?.forEach((t) => {
7
7
  const s = t;
@@ -0,0 +1,8 @@
1
+ import type { StructuredToolInterface } from "@langchain/core/tools";
2
+
3
+ /**
4
+ * Applies include and exclude effects to layer features with optional spatial filtering.
5
+ *
6
+ * @internal
7
+ */
8
+ export const setFeatureEffectTool: StructuredToolInterface;
@@ -3,8 +3,8 @@ import e from "zod";
3
3
  import { tool as h } from "@langchain/core/tools";
4
4
  import m from "@arcgis/core/layers/support/FeatureEffect.js";
5
5
  import b from "@arcgis/core/layers/support/FeatureFilter.js";
6
- import { g as y, d } from "./types.js";
7
- import { f as w } from "./fetchAgentContext.js";
6
+ import { g as y, d } from "../../../../chunks/types.js";
7
+ import { f as w } from "../../../../chunks/fetchAgentContext.js";
8
8
  const g = async (t, o, u, n, r, c) => {
9
9
  const a = t.map?.allLayers.find((i) => i.id === o);
10
10
  if (!a)
@@ -0,0 +1,11 @@
1
+ import type { StructuredToolInterface } from "@langchain/core/tools";
2
+
3
+ /**
4
+ * Lists registered fields for a user-specified layer.
5
+ *
6
+ * Use only when the user explicitly requests fields, columns, or attributes
7
+ * for a named layer.
8
+ *
9
+ * @internal
10
+ */
11
+ export const listLayerFieldsTool: StructuredToolInterface;
@@ -1,7 +1,7 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import { tool as n } from "@langchain/core/tools";
3
3
  import s from "zod";
4
- import { f as c } from "./fetchService.js";
4
+ import { f as c } from "../../../../chunks/fetchService.js";
5
5
  const y = (i, r) => {
6
6
  const t = Array.from(i.values()).find(
7
7
  ({ layerItem: e }) => e.title?.toLowerCase().includes(r.toLowerCase())
@@ -0,0 +1,10 @@
1
+ import type { StructuredToolInterface } from "@langchain/core/tools";
2
+
3
+ /**
4
+ * A tool that geocodes an address or place name and navigates the map to the result.
5
+ * It uses the map view provided by the agent's runtime context.
6
+ *
7
+ * @internal
8
+ * @since 5.2
9
+ */
10
+ export const goToAddressTool: StructuredToolInterface;
@@ -5,7 +5,7 @@ import f from "@arcgis/core/Graphic.js";
5
5
  import u from "@arcgis/core/portal/Portal.js";
6
6
  import { addressToLocations as S } from "@arcgis/core/rest/locator.js";
7
7
  import v from "@arcgis/core/symbols/PictureMarkerSymbol.js";
8
- import { f as w } from "./fetchAgentContext.js";
8
+ import { f as w } from "../../../../chunks/fetchAgentContext.js";
9
9
  import c from "zod";
10
10
  async function y(e, t) {
11
11
  const a = u.getDefault().helperServices, n = a.geocode.find((h) => h.name === "ArcGIS World Geocoding Service") ?? a.geocode[0];
@@ -0,0 +1,8 @@
1
+ import type { StructuredToolInterface } from "@langchain/core/tools";
2
+
3
+ /**
4
+ * Navigates the map to a named bookmark.
5
+ *
6
+ * @internal
7
+ */
8
+ export const goToBookmarkTool: StructuredToolInterface;
@@ -1,7 +1,7 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import { z as i } from "zod";
3
3
  import { tool as k } from "@langchain/core/tools";
4
- import { f as s } from "./fetchAgentContext.js";
4
+ import { f as s } from "../../../../chunks/fetchAgentContext.js";
5
5
  async function c(o, t) {
6
6
  const e = t.map.bookmarks;
7
7
  if (!e || e.length === 0)
@@ -0,0 +1,8 @@
1
+ import type { StructuredToolInterface } from "@langchain/core/tools";
2
+
3
+ /**
4
+ * Navigates to features that match a layer and SQL where clause.
5
+ *
6
+ * @internal
7
+ */
8
+ export const goToFeaturesTool: StructuredToolInterface;
@@ -1,7 +1,7 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import { z as i } from "zod";
3
3
  import { tool as u } from "@langchain/core/tools";
4
- import { f as c } from "./fetchAgentContext.js";
4
+ import { f as c } from "../../../../chunks/fetchAgentContext.js";
5
5
  async function f(o, a, n) {
6
6
  const e = n.map?.allLayers.find((r) => r.id === o);
7
7
  if (!e)
@@ -0,0 +1,8 @@
1
+ import type { StructuredToolInterface } from "@langchain/core/tools";
2
+
3
+ /**
4
+ * Navigates the map to the full world extent.
5
+ *
6
+ * @internal
7
+ */
8
+ export const goToFullExtentTool: StructuredToolInterface;
@@ -2,7 +2,7 @@
2
2
  import { z as n } from "zod";
3
3
  import r from "@arcgis/core/geometry/Extent.js";
4
4
  import { tool as i } from "@langchain/core/tools";
5
- import { f as l } from "./fetchAgentContext.js";
5
+ import { f as l } from "../../../../chunks/fetchAgentContext.js";
6
6
  async function m(o) {
7
7
  const t = new r({
8
8
  xmin: -180,
@@ -0,0 +1,8 @@
1
+ import type { StructuredToolInterface } from "@langchain/core/tools";
2
+
3
+ /**
4
+ * Returns the map to its initial viewpoint.
5
+ *
6
+ * @internal
7
+ */
8
+ export const goToHomeExtentTool: StructuredToolInterface;
@@ -1,7 +1,7 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import { tool as n } from "@langchain/core/tools";
3
3
  import i from "zod";
4
- import { f as r } from "./fetchAgentContext.js";
4
+ import { f as r } from "../../../../chunks/fetchAgentContext.js";
5
5
  async function a(e) {
6
6
  const t = e.map.initialViewProperties?.viewpoint?.targetGeometry;
7
7
  if (t)
@@ -0,0 +1,8 @@
1
+ import type { StructuredToolInterface } from "@langchain/core/tools";
2
+
3
+ /**
4
+ * Navigates to the full extent of a layer.
5
+ *
6
+ * @internal
7
+ */
8
+ export const goToLayerTool: StructuredToolInterface;
@@ -1,7 +1,7 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import { z as r } from "zod";
3
3
  import { tool as i } from "@langchain/core/tools";
4
- import { f as c } from "./fetchAgentContext.js";
4
+ import { f as c } from "../../../../chunks/fetchAgentContext.js";
5
5
  async function l(o, t) {
6
6
  await t.when();
7
7
  const e = t.map?.allLayers.find((n) => n.id === o);
@@ -0,0 +1,8 @@
1
+ import type { StructuredToolInterface } from "@langchain/core/tools";
2
+
3
+ /**
4
+ * Navigates the map to a specified scale.
5
+ *
6
+ * @internal
7
+ */
8
+ export const goToScaleTool: StructuredToolInterface;
@@ -1,7 +1,7 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import t from "zod";
3
3
  import { tool as a } from "@langchain/core/tools";
4
- import { f as i } from "./fetchAgentContext.js";
4
+ import { f as i } from "../../../../chunks/fetchAgentContext.js";
5
5
  async function n(o, e) {
6
6
  return await e.goTo({ scale: o }), { text: `Successfully zoomed to: ${o}` };
7
7
  }
@@ -0,0 +1,8 @@
1
+ import type { StructuredToolInterface } from "@langchain/core/tools";
2
+
3
+ /**
4
+ * Navigates to a center point with optional zoom and scale values.
5
+ *
6
+ * @internal
7
+ */
8
+ export const goToViewpointTool: StructuredToolInterface;
@@ -2,7 +2,7 @@
2
2
  import t from "zod";
3
3
  import { tool as c } from "@langchain/core/tools";
4
4
  import l from "@arcgis/core/geometry/Point.js";
5
- import { f as r } from "./fetchAgentContext.js";
5
+ import { f as r } from "../../../../chunks/fetchAgentContext.js";
6
6
  async function m(e, a, o) {
7
7
  const i = {
8
8
  target: new l({
@@ -0,0 +1,8 @@
1
+ import type { StructuredToolInterface } from "@langchain/core/tools";
2
+
3
+ /**
4
+ * Navigates the map to a specified zoom level.
5
+ *
6
+ * @internal
7
+ */
8
+ export const goToZoomTool: StructuredToolInterface;
@@ -1,7 +1,7 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import t from "zod";
3
3
  import { tool as m } from "@langchain/core/tools";
4
- import { f as i } from "./fetchAgentContext.js";
4
+ import { f as i } from "../../../../chunks/fetchAgentContext.js";
5
5
  async function r(o, e) {
6
6
  return await e.goTo({ zoom: o }), { text: `Successfully zoomed to: ${o}` };
7
7
  }
@@ -0,0 +1,8 @@
1
+ import type { StructuredToolInterface } from "@langchain/core/tools";
2
+
3
+ /**
4
+ * Returns a formatted field value from the first feature matching a query.
5
+ *
6
+ * @internal
7
+ */
8
+ export const getAttributeTool: StructuredToolInterface;
@@ -1,8 +1,8 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import { tool as f } from "@langchain/core/tools";
3
3
  import i from "zod";
4
- import { f as h, g } from "./formatFeatureAttributes.js";
5
- import { f as y } from "./fetchAgentContext.js";
4
+ import { f as h, g } from "../../../../chunks/formatFeatureAttributes.js";
5
+ import { f as y } from "../../../../chunks/fetchAgentContext.js";
6
6
  const b = (a, e, o) => {
7
7
  const t = a.createQuery();
8
8
  return t.outFields = [e], t.where = o || "1=1", t.num = 1, t;
@@ -0,0 +1,8 @@
1
+ import type { StructuredToolInterface } from "@langchain/core/tools";
2
+
3
+ /**
4
+ * Calculates an aggregate statistic for a field with optional spatial filtering.
5
+ *
6
+ * @internal
7
+ */
8
+ export const getStatisticsTool: StructuredToolInterface;
@@ -4,10 +4,10 @@ import t from "zod";
4
4
  import V from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
5
5
  import E from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
6
6
  import O from "@arcgis/core/layers/support/FeatureFilter.js";
7
- import { c as x, m as b } from "./mergeWhereClauses.js";
8
- import { g as N, i as v, a as C, d as S } from "./types.js";
9
- import { f as R } from "./fetchAgentContext.js";
10
- import { f as U } from "./fetchService.js";
7
+ import { c as x, m as b } from "../../../../chunks/mergeWhereClauses.js";
8
+ import { g as N, i as v, a as C, d as S } from "../../../../chunks/types.js";
9
+ import { f as R } from "../../../../chunks/fetchAgentContext.js";
10
+ import { f as U } from "../../../../chunks/fetchService.js";
11
11
  const W = async (h) => {
12
12
  const { targetLayer: r, fieldName: n, statisticType: l, mapView: a, layersAndFieldsRegistry: p, geometryFilter: e } = h, s = a.map?.allLayers.find((i) => i.id === r.layerId);
13
13
  if (!s)
@@ -0,0 +1,8 @@
1
+ import type { StructuredToolInterface } from "@langchain/core/tools";
2
+
3
+ /**
4
+ * Returns top-ranked features based on grouping and ordering criteria.
5
+ *
6
+ * @internal
7
+ */
8
+ export const getTopFeaturesTool: StructuredToolInterface;
@@ -3,10 +3,10 @@ import { tool as T } from "@langchain/core/tools";
3
3
  import e from "zod";
4
4
  import S from "@arcgis/core/rest/support/TopFeaturesQuery.js";
5
5
  import B from "@arcgis/core/rest/support/TopFilter.js";
6
- import { m as C, c as v } from "./mergeWhereClauses.js";
7
- import { a as I } from "./formatFeatureAttributes.js";
8
- import { g as q, d as y } from "./types.js";
9
- import { f as N } from "./fetchAgentContext.js";
6
+ import { m as C, c as v } from "../../../../chunks/mergeWhereClauses.js";
7
+ import { a as I } from "../../../../chunks/formatFeatureAttributes.js";
8
+ import { g as q, d as y } from "../../../../chunks/types.js";
9
+ import { f as N } from "../../../../chunks/fetchAgentContext.js";
10
10
  const k = (i) => i.flatMap((t) => t.split(",")).map((t) => t.trim()).map((t) => t.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((t) => !!t), x = async (i, t, a, s, l) => {
11
11
  const n = a.map?.allLayers.find((o) => o.id === i.layerId), d = await a.whenLayerView(n), c = n.title ?? i.layerId;
12
12
  let u;
@@ -0,0 +1,8 @@
1
+ import type { StructuredToolInterface } from "@langchain/core/tools";
2
+
3
+ /**
4
+ * Returns the count and attributes of features matching query constraints.
5
+ *
6
+ * @internal
7
+ */
8
+ export const queryFeaturesTool: StructuredToolInterface;
@@ -1,10 +1,10 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import { tool as v } from "@langchain/core/tools";
3
- import { a as C } from "./formatFeatureAttributes.js";
4
- import { g as O, i as S, a as F, d as I } from "./types.js";
5
- import { c as j, m as N } from "./mergeWhereClauses.js";
3
+ import { a as C } from "../../../../chunks/formatFeatureAttributes.js";
4
+ import { g as O, i as S, a as F, d as I } from "../../../../chunks/types.js";
5
+ import { c as j, m as N } from "../../../../chunks/mergeWhereClauses.js";
6
6
  import t from "zod";
7
- import { f as R } from "./fetchAgentContext.js";
7
+ import { f as R } from "../../../../chunks/fetchAgentContext.js";
8
8
  const p = 25, x = (i) => i.flatMap((r) => r.split(",")).map((r) => r.trim()).map((r) => r.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((r) => !!r), W = async (i, r, e, f) => {
9
9
  const a = r.map?.allLayers.find((u) => u.id === i.layerId), l = await r.whenLayerView(a), y = a.title ?? i.layerId;
10
10
  let c;
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a}from"./5PJXNTLZ.js";import"./ONQ6JSBJ.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export{a as goToBookmarkTool};
2
+ import{a}from"./Y7XD7ZRD.js";import"./ONQ6JSBJ.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export{a as goToBookmarkTool};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a,b as s,c as o}from"./XHGVCL22.js";import"./6U4GTCLJ.js";import{g as r,h as t,v as i,z as c}from"./6TA5KFAQ.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var l=r`.container{color:var(--calcite-color-text-1);min-width:0}.content{min-width:0;overflow-wrap:anywhere}.content>*{margin:0}.content>*+*{margin-block-start:var(--calcite-spacing-sm)}.content :is(ol,ul){padding-inline-start:var(--calcite-spacing-lg)}.content>calcite-table{display:block;max-width:100%}.content pre{background-color:var(--calcite-color-foreground-1);padding:var(--calcite-spacing-sm);border-radius:var(--calcite-border-radius);color:var(--calcite-color-text-1);direction:ltr;max-width:100%;overflow:auto}.content pre code{display:block;white-space:pre;font-family:var(--calcite-code-family)}.part{animation:part-reveal calc(3 * var(--calcite-animation-timing)) ease-out}@keyframes part-reveal{0%{opacity:0;transform:translateY(var(--calcite-size-fixed-xxs))}to{opacity:1;transform:translateY(0)}}@media(prefers-reduced-motion:reduce){.part{animation:none}}`,e=class extends i{static{this.properties={content:1,parts:0}}static{this.styles=l}render(){return t`<div class="container"><div class="content">${this.parts?.map(n=>t`<span class="part">${a(o(n))}</span>`)??a(s(this.content))}</div></div>`}};c("arcgis-assistant-message-text",e);export{e as ArcgisAssistantMessageText};
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import i from"./T2GJLEYV.js";import h from"./Q4IQUEZN.js";import f from"./WS3T73IY.js";import e from"./4MFEKBKL.js";import c from"./AT4XVTJR.js";import{e as R,f as le}from"./7M6VKBTK.js";import{a as de}from"./BS2PFNU4.js";import{a as ue}from"./UIXX3XEN.js";import a from"./KA3FF3ZO.js";import{a as b,b as T}from"./7VAQUCBU.js";import{Fa as se,Sa as A,g as ne,j as D,k as P,ka as y,y as ie}from"./EWLXNGKH.js";import{Dc as g,S as $,W as B,fa as N}from"./AI6DYOKR.js";import{a as d}from"./VXFQANGJ.js";export default $arcgis.t(([ve,_,Se,,_e,,{createRenderer:Fe},{getSchemesByTag:Le,getSchemes:Qe},{getBackgroundColorTheme:xe},{createAgeRenderer:Ge,createContinuousRenderer:Ve},{getSchemesByTag:re},{createContinuousRenderer:Be},{createRenderer:Ke},{getSchemesByTag:Ue},{createRenderer:He},{getSchemesByTag:We},{createRenderer:Je},{getSchemesByTag:Ze},{createRenderer:Ye},{getSchemesByTag:Xe},{createAgeRenderer:et,createContinuousRenderer:tt},{createRenderer:rt},{getSchemesByTag:ot},at,ke,,{fetchKnowledgeGraph:Ee,executeQueryStreaming:nt,executeSearchStreaming:it},st,{getBindParametersFromCypherQuery:lt},pe,{o:ce},fe,ye,he,me])=>{var Te=e=>Array.isArray(e)&&e.every($),De=e=>typeof e=="object"&&e!=null&&"messages"in e&&Te(e.messages),Pe=e=>typeof e=="object"&&e!=null&&"lg_tool_call"in e,O=class extends se{tools;handleToolErrors=!0;trace=!1;constructor(e,t){let{name:r,tags:o,handleToolErrors:a}=t??{};super({name:r,tags:o,func:(i,s)=>this.run(i,s)}),this.tools=e,this.handleToolErrors=a??this.handleToolErrors}async runTool(e,t,r){let o=this.tools.find(a=>a.name===e.name);try{if(o===void 0)throw new Error(`Tool "${e.name}" not found.`);let a={...e,type:"tool_call"},i={...t,state:r,toolCallId:e.id??"",config:t,context:t.context,store:t.store??null,writer:t.writer??t.configurable?.writer??null},s=await o.invoke(a,i);return $(s)&&s.getType()==="tool"||P(s)?s:new B({status:"success",name:o.name,content:typeof s=="string"?s:JSON.stringify(s),tool_call_id:e.id})}catch(a){if(!this.handleToolErrors||ie(a))throw a;return new B({status:"error",content:`Error: ${a.message}
2
+ import i from"./KWD2ECTM.js";import h from"./U2D53TAX.js";import f from"./OAKRPM7D.js";import e from"./V52XWEGV.js";import c from"./AT4XVTJR.js";import{e as R,f as le}from"./7M6VKBTK.js";import{a as de}from"./5WYRJMBW.js";import{a as ue}from"./YEZ3AMNX.js";import a from"./JKIESH74.js";import{a as b,b as T}from"./7VAQUCBU.js";import{Fa as se,Sa as A,g as ne,j as D,k as P,ka as y,y as ie}from"./EWLXNGKH.js";import{Dc as g,S as $,W as B,fa as N}from"./AI6DYOKR.js";import{a as d}from"./VXFQANGJ.js";export default $arcgis.t(([ve,_,Se,,_e,,{createRenderer:Fe},{getSchemesByTag:Le,getSchemes:Qe},{getBackgroundColorTheme:xe},{createAgeRenderer:Ge,createContinuousRenderer:Ve},{getSchemesByTag:re},{createContinuousRenderer:Be},{createRenderer:Ke},{getSchemesByTag:Ue},{createRenderer:He},{getSchemesByTag:We},{createRenderer:Je},{getSchemesByTag:Ze},{createRenderer:Ye},{getSchemesByTag:Xe},{createAgeRenderer:et,createContinuousRenderer:tt},{createRenderer:rt},{getSchemesByTag:ot},at,ke,,{fetchKnowledgeGraph:Ee,executeQueryStreaming:nt,executeSearchStreaming:it},st,{getBindParametersFromCypherQuery:lt},pe,{o:ce},fe,ye,he,me])=>{var Te=e=>Array.isArray(e)&&e.every($),De=e=>typeof e=="object"&&e!=null&&"messages"in e&&Te(e.messages),Pe=e=>typeof e=="object"&&e!=null&&"lg_tool_call"in e,O=class extends se{tools;handleToolErrors=!0;trace=!1;constructor(e,t){let{name:r,tags:o,handleToolErrors:a}=t??{};super({name:r,tags:o,func:(i,s)=>this.run(i,s)}),this.tools=e,this.handleToolErrors=a??this.handleToolErrors}async runTool(e,t,r){let o=this.tools.find(a=>a.name===e.name);try{if(o===void 0)throw new Error(`Tool "${e.name}" not found.`);let a={...e,type:"tool_call"},i={...t,state:r,toolCallId:e.id??"",config:t,context:t.context,store:t.store??null,writer:t.writer??t.configurable?.writer??null},s=await o.invoke(a,i);return $(s)&&s.getType()==="tool"||P(s)?s:new B({status:"success",name:o.name,content:typeof s=="string"?s:JSON.stringify(s),tool_call_id:e.id})}catch(a){if(!this.handleToolErrors||ie(a))throw a;return new B({status:"error",content:`Error: ${a.message}
3
3
  Please fix your mistakes.`,name:e.name,tool_call_id:e.id??""})}}async run(e,t){let r;if(Pe(e)){let{lg_tool_call:i,...s}=e;r=[await this.runTool(i,t,s)]}else{let i;if(Te(e))i=e;else if(De(e))i=e.messages;else throw new Error("ToolNode only accepts BaseMessage[] or { messages: BaseMessage[] } as input.");let s=new Set(i.filter(c=>c.getType()==="tool").map(c=>c.tool_call_id)),n;for(let c=i.length-1;c>=0;c-=1){let l=i[c];if(N(l)){n=l;break}}if(n==null||!N(n))throw new Error("ToolNode only accepts AIMessages as input.");r=await Promise.all(n.tool_calls?.filter(c=>c.id==null||!s.has(c.id)).map(c=>this.runTool(c,t,e))??[])}if(!r.some(P))return Array.isArray(e)?r:{messages:r};let o=[],a=null;for(let i of r)P(i)?i.graph===D.PARENT&&Array.isArray(i.goto)&&i.goto.every(s=>ne(s))?a?a.goto.push(...i.goto):a=new D({graph:D.PARENT,goto:i.goto}):o.push(i):o.push(Array.isArray(e)?[i]:{messages:[i]});return a&&o.push(a),o}};var zo=y.Root({llmInputMessages:y({reducer:(e,t)=>A([],t),default:()=>[]})});var I=(e,t)=>t??e,La=y.Root({...le(),intent:y({reducer:I}),vectorSearchLayerResults:y({reducer:I,default:()=>[]}),vectorSearchFieldResults:y({reducer:I}),navigationInternalState:y({reducer:I,default:()=>({toolCallMessage:void 0})})}),Me=Object.assign({"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_lc_context.md":()=>import("./J6A4AS7E.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_map_context.md":()=>import("./TPULIO6I.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_cypher_query_prompt.md":()=>import("./IHP25JWI.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_lucene_generation_prompt.md":()=>import("./CEKOEHB3.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_summarize_result_prompt.md":()=>import("./VAXH6RUQ.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_tool_prompt.md":()=>import("./AOVJ34QE.js").then(e=>e.default),"../agents/dataExploration/prompts/data_explore_filter_prompt.md":()=>import("./PQ2DPOFM.js").then(e=>e.default),"../agents/dataExploration/prompts/data_explore_query_prompt.md":()=>import("./SDWWUWAF.js").then(e=>e.default),"../agents/dataExploration/prompts/summarize_query_response_prompt.md":()=>import("./FYZATVB3.js").then(e=>e.default),"../agents/help/prompts/help_prompt.md":()=>import("./NEV6OZN3.js").then(e=>e.default),"../agents/layerStyling/prompts/layer_styling_prompt.md":()=>import("./ICBIUFK7.js").then(e=>e.default),"../agents/navigation/prompts/navigation_intent_prompt.md":()=>import("./JEBRN3EU.js").then(e=>e.default),"../agents/navigation/prompts/navigation_tool_prompt.md":()=>import("./UHEYPSOR.js").then(e=>e.default)});async function L(e){let t=Object.entries(Me).find(([r])=>r.endsWith(`/${e}.md`));if(!t)throw new Error(`Prompt not found: ${e}
4
4
  Available prompts:
5
5
  ${Object.keys(Me).join(`
@@ -73,7 +73,7 @@ Description: Represent features as categories with different symbol colors or sh
73
73
  Keywords: categorical, category, type, unique, discrete, point of interest, region, group
74
74
  Example: Color each feature based on the region it belongs to
75
75
  Fields: This style requires a single field which may be a string, number, or date type. It is usually a string.`,schema:ur}),en=y.Root({...R(),vectorSearchLayerIds:y(),vectorSearchFieldResults:y(),layerFieldInfo:y(),selectedLayerId:y()}),tn=y.Root({...R(),vectorSearchLayerIds:y(),vectorSearchFieldResults:y(),layerFieldInfo:y(),queryResponse:y(),dataExplorationMessages:y({reducer:A,default:()=>[]})}),pr=[me,he,ye,fe],rn=[pe,ue,de],mr=new O(pr,{handleToolErrors:!1});async function on(e,t){let{messages:r}=await mr.invoke({messages:e.dataExplorationMessages},t),o=[],a=[];for(let i of r){let s=i.content,n;typeof s!="string"&&(n={tool:i.name??"unknown",layerName:"unknown",summary:"Query failed",details:{error:"Skipping non-string tool output:",raw:s}});try{typeof s=="string"?n=JSON.parse(s):n={tool:i.name??"unknown",layerName:"unknown",summary:"Query failed",details:{error:"Invalid tool output type",raw:s}}}catch{n={tool:i.name??"unknown",layerName:"unknown",summary:"Query failed",details:{error:s}}}o.push(n),n.details&&typeof n.details=="object"&&"error"in n.details?a.push(`- ${n.tool}: Error - ${String(n.details.error)}`):a.push(`- ${n.layerName}: ${n.summary}`)}return await b({text:`Finished executing layer query tool: ${a.join(", ")}`},t),{...e,dataExplorationMessages:[...e.dataExplorationMessages,...r],queryResponse:o,status:"success",summary:a.length>0?ct(a.join(`
76
- `)):"Query executed."}}var an=y.Root({...R(),helpInternalState:y({reducer:I,default:()=>({toolCallMessage:void 0})})}),nn=y.Root({...R(),intent:y({reducer:(e,t)=>t}),arcgisKnowledgeMessages:y({reducer:A,default:()=>[]}),arcgisKnowledgeToolResult:y({reducer:(e,t)=>t,default:()=>null})});function oe(e){let t=e.map?.allLayers.filter(r=>r.type==="knowledge-graph");if(!t||t?.length!==1)throw new Error("The Knowledge Agent currently only supports maps with exactly one Knowledge Graph Layer.")}function x(e){return!!e?.map&&!("activeLinkChartLayer"in e.map)}async function Q(e){!e||x(e)||!e.map?.diagramNodesExtent||await e.goTo(e.map.diagramNodesExtent)}function q(e){let t=e?.configurable?.context;if(!t||typeof t!="object")throw new Error("ArcgisKnowledgeAgent context missing");if(!("view"in t))throw new Error("View context missing");let r=t.view;return r.map&&!("activeLinkChartLayer"in r.map)&&oe(r),{view:r}}function sn(e){let t=e?.configurable?.context;if($e(e)==="knowledgeGraph")return"knowledgeGraph";let r=t.view;return x(r)?(oe(r),"map"):"linkChart"}async function z(e){let t=e?.configurable?.context;if($e(e)==="knowledgeGraph")return t;{let r=t.view.map;if(r&&"activeLinkChartLayer"in r){let o=r.knowledgeGraph?.url;if(!o)throw new Error("Knowledge graph url missing from link chart.");return{knowledgeGraph:await Ee(o)}}else{oe(t.view);let o=(t.view.map?.allLayers.find(a=>a.type==="knowledge-graph")).url;if(!o)throw new Error("Knowledge graph url missing from map.");return{knowledgeGraph:await Ee(o)}}}}function $e(e){let t=e?.configurable?.context;if(!t||typeof t!="object")throw new Error("ArcgisKnowledgeAgent context missing");if("knowledgeGraph"in t&&"view"in t)throw new Error("Knowledge Graph context should only have a view or knowledgeGraph, but never both.");if("knowledgeGraph"in t)return"knowledgeGraph";if("view"in t)return"view";throw new Error("ArcgisKnowledgeAgent context must have either a view or knowledgeGraph property.")}var H=class{constructor(t){this.dataModel=t,this.kind="GraphQueryGenerationRequest",this.explainQuery=!0,this.schemaInformation=W.fromDataModel(t)}},W=class e{constructor(){this.schemaType="ArcgisGraphSchema",this.entityTypes=[],this.relationshipTypes=[],this.identifierInfo={mappingInfo:{identifierMapsTo:"UniformPropertyIdentifier",identifierPropertyName:"globalid"}}}static fromDataModel(t){let r=new e;for(let o of t.entityTypes)r.entityTypes.push(C.fromEntityType(o));for(let o of t.relationshipTypes)r.relationshipTypes.push(J.fromRelationshipType(o));return r.identifierInfo={mappingInfo:{identifierMapsTo:hr(t.identifierInfo.identifierMappingInfo.identifierInfoType),identifierPropertyName:t.identifierInfo.identifierMappingInfo.uniformPropertyIdentifier.identifierPropertyName}},r.spatialReference=JSON.parse(JSON.stringify(t.spatialReference)),r}static getDataModelTypesSummary(t){let r=t.entityTypes.map(a=>a.name).join(", "),o=t.relationshipTypes.map(a=>a.name).join(", ");return`Entity Types: ${r}.
76
+ `)):"Query executed."}}var an=y.Root({...R(),helpInternalState:y({reducer:I,default:()=>({toolCallMessage:void 0})})}),nn=y.Root({...R(),intent:y({reducer:(e,t)=>t}),arcgisKnowledgeMessages:y({reducer:A,default:()=>[]}),arcgisKnowledgeToolResult:y({reducer:(e,t)=>t,default:()=>null})});function oe(e){let t=e.map?.allLayers.filter(r=>r.type==="knowledge-graph");if(!t||t?.length!==1)throw new Error("The Knowledge Agent currently only supports maps with exactly one Knowledge Graph Layer.")}function x(e){return!!e?.map&&"activeLinkChartLayer"in e.map}async function Q(e){!x(e)||!e.map.diagramNodesExtent||await e.goTo(e.map.diagramNodesExtent)}function q(e){let t=e?.configurable?.context;if(!t||typeof t!="object")throw new Error("ArcgisKnowledgeAgent context missing");if(!("view"in t))throw new Error("View context missing");let r=t.view;return r.map&&!("activeLinkChartLayer"in r.map)&&oe(r),{view:r}}function sn(e){let t=e?.configurable?.context;if($e(e)==="knowledgeGraph")return"knowledgeGraph";let r=t.view;return x(r)?"linkChart":(oe(r),"map")}async function z(e){let t=e?.configurable?.context;if($e(e)==="knowledgeGraph")return t;{let r=t.view.map;if(r&&"activeLinkChartLayer"in r){let o=r.knowledgeGraph?.url;if(!o)throw new Error("Knowledge graph url missing from link chart.");return{knowledgeGraph:await Ee(o)}}else{oe(t.view);let o=(t.view.map?.allLayers.find(a=>a.type==="knowledge-graph")).url;if(!o)throw new Error("Knowledge graph url missing from map.");return{knowledgeGraph:await Ee(o)}}}}function $e(e){let t=e?.configurable?.context;if(!t||typeof t!="object")throw new Error("ArcgisKnowledgeAgent context missing");if("knowledgeGraph"in t&&"view"in t)throw new Error("Knowledge Graph context should only have a view or knowledgeGraph, but never both.");if("knowledgeGraph"in t)return"knowledgeGraph";if("view"in t)return"view";throw new Error("ArcgisKnowledgeAgent context must have either a view or knowledgeGraph property.")}var H=class{constructor(t){this.dataModel=t,this.kind="GraphQueryGenerationRequest",this.explainQuery=!0,this.schemaInformation=W.fromDataModel(t)}},W=class e{constructor(){this.schemaType="ArcgisGraphSchema",this.entityTypes=[],this.relationshipTypes=[],this.identifierInfo={mappingInfo:{identifierMapsTo:"UniformPropertyIdentifier",identifierPropertyName:"globalid"}}}static fromDataModel(t){let r=new e;for(let o of t.entityTypes)r.entityTypes.push(C.fromEntityType(o));for(let o of t.relationshipTypes)r.relationshipTypes.push(J.fromRelationshipType(o));return r.identifierInfo={mappingInfo:{identifierMapsTo:hr(t.identifierInfo.identifierMappingInfo.identifierInfoType),identifierPropertyName:t.identifierInfo.identifierMappingInfo.uniformPropertyIdentifier.identifierPropertyName}},r.spatialReference=JSON.parse(JSON.stringify(t.spatialReference)),r}static getDataModelTypesSummary(t){let r=t.entityTypes.map(a=>a.name).join(", "),o=t.relationshipTypes.map(a=>a.name).join(", ");return`Entity Types: ${r}.
77
77
  Relationship Types: ${o}.`}},C=class e{constructor(){this.name="",this.properties=[]}static fromEntityType(t){let r=new e;r.name=t.name,r.alias=t.alias?t.alias:void 0,r.role=yr(t.role);for(let o of t.properties){let a={name:o.name,alias:o.alias?o.alias:void 0,fieldType:o.fieldType,role:fr(o.role),geometryDef:o.fieldType==="esriFieldTypeGeometry"?{geometryType:o.geometryType??"esriGeometryAny",hasM:o.hasM?o.hasM:void 0,hasZ:o.hasZ?o.hasZ:void 0}:void 0};r.properties.push(a)}return r}},J=class extends C{constructor(){super(...arguments),this.observedEndPoints=[]}static fromRelationshipType(t){let r=C.fromEntityType(t);r.observedEndPoints=[];for(let o of t.endPoints)r.observedEndPoints.push({originEntityType:o.originEntityType,destinationEntityType:o.destinationEntityType});return r}},hr=e=>{switch(e){case"esriIdentifierInfoTypeUNSPECIFIED":return"UNSPECIFIED";case"esriIdentifierInfoTypeDatabaseNative":return"DatabaseNative";case"esriIdentifierInfoTypeUniformProperty":return"UniformPropertyIdentifier";default:return e}},yr=e=>{switch(e){case"Regular":return"esriGraphNamedObjectRegular";case"Provenance":return"esriGraphNamedObjectProvenance";case"Document":return"esriGraphNamedObjectDocument";default:return e}};function fr(e){switch(e){case"esriGraphPropertyRegular":return"Regular";case"esriGraphPropertyDocumentName":return"Document_Name";case"esriGraphPropertyDocumentTitle":return"Document_Title";case"esriGraphPropertyDocumentUrl":return"Document_Url";case"esriGraphPropertyDocumentText":return"Document_Text";case"esriGraphPropertyDocumentKeywords":return"Document_Keywords";case"esriGraphPropertyDocumentContentType":return"Document_ContentType";case"esriGraphPropertyDocumentMetadata":return"Document_Metadata";case"esriGraphPropertyDocumentFileExtension":return"Document_FileExtension";case"esriGraphPropertyProvenanceInstanceId":return"Provenance_InstanceId";case"esriGraphPropertyProvenanceSourceType":return"Provenance_SourceType";case"esriGraphPropertyProvenanceSourceName":return"Provenance_SourceName";case"esriGraphPropertyProvenanceSource":return"Provenance_Source";case"esriGraphPropertyProvenanceComment":return"Provenance_Comment";case"esriGraphPropertyProvenanceTypeName":return"Provenance_TypeName";case"esriGraphPropertyProvenancePropertyName":return"Provenance_PropertyName";default:return"Regular"}}function G(e){return e?.signal}async function gr(e,t){let r=await L("arcgis_knowledge_cypher_query_prompt");return t?`${e} ${r}
78
78
 
79
79
  Your previous attempt to generate a cypher query failed. See the details below and generate a new cypher query that avoids this error.
@@ -81,13 +81,13 @@ Your previous attempt to generate a cypher query failed. See the details below a
81
81
  Attempt Number: ${t.attemptCount}
82
82
  Execution Error: ${t.executionError}
83
83
  Failed Query:
84
- ${t.failedGraphQuery}`:`${e} ${r}`}async function wr(e,t,r,o){let{graphQuery:a,explanation:i}=await ae(e,t,r,o);return{graphQuery:a,explanation:i}}async function ae(e,t,r,o,a){let i={message:await gr(e,a),context:new H(t)},s=G(o);await b({text:"Attempting to generate a cypher query from your prompt..."},o);let n=await Se(`${r}/chat`,{method:"post",body:JSON.stringify(i),headers:{"Content-Type":"application/json",token:ve.findCredential(_.getDefault().url)?.token??""},signal:s});if(n.httpStatus!==200)throw new Error(`Graph query service returned an error: ${n.httpStatus}`,{cause:n.data});let c=!1,l=Date.now(),u=n.data.sequenceNumber,p="",m="",w=1;for(;!c;){await new Promise(f=>setTimeout(f,1e3)),await b({text:`Periodically requesting status of job from ArcGIS AI Services${"...".substring(0,w)}`},o),w=w%3+1;let h=await Se(`${r}/chat`,{method:"post",body:JSON.stringify({conversationId:n.data.conversationId,inquiryId:n.data.inquiryId,ackSequenceNumber:u}),headers:{"Content-Type":"application/json",token:ve.findCredential(_.getDefault().url)?.token??""},signal:s});if(h.httpStatus!==200)throw new Error(`Graph query service polling returned an error: ${h.httpStatus}`,{cause:h.data});if(h.data.context?.kind){if(h.data.context.kind!=="GraphQueryGenerationResponse")throw new Error(`Unexpected response from graph query service polling. Message: ${h.data.message}`,{cause:h.data});p=h.data.context.graphQuery,m=h.data.message||"",c=!0}else if(!h.data.hasMore)c=!0;else if(Date.now()-l>6e4)throw new Error("Graph query service polling timed out after 1 minute.");u=h.data.sequenceNumber}return{graphQuery:p,explanation:m}}function br(e,t){E(e,r=>{t.set(`${r.typeName}__${r.id}`,{id:r.id,typeName:r.typeName})})}function E(e,t){if(!(!e||typeof e!="object")){if(vr(e))for(let r of e.path)E(r,t);else if(Tr(e))t(e);else if(Array.isArray(e))for(let r of e)E(r,t);else if(Sr(e))for(let r of Object.values(e.properties??{}))E(r,t)}}function Tr(e){return!e||typeof e!="object"||Array.isArray(e)?!1:"id"in e&&"typeName"in e}function vr(e){return!e||typeof e!="object"||Array.isArray(e)?!1:e&&"path"in e&&Array.isArray(e.path)}function Sr(e){return!e||typeof e!="object"||Array.isArray(e)||"id"in e?!1:"properties"in e&&typeof e.properties=="object"}function xr(e,t){let r=[],o=[],a=[[t.dataModel.entityTypes,r],[t.dataModel.relationshipTypes,o]];for(let[i,s]of a)for(let n of i){let c=e.getMemberIdsByType(n.name);s.push(...c)}return{entityIds:r,relationshipIds:o}}function Er(e,t){let r={entityIds:new Array,relationshipIds:new Array},o=[],a=e?.allLayers.find(n=>n.type==="knowledge-graph")?.inclusionModeDefinition;if(!a)return{allNamedTypesFullyDynamic:!0,bindParameters:r,nonDynamicTypes:o};let i=[[t.dataModel.entityTypes,r.entityIds],[t.dataModel.relationshipTypes,r.relationshipIds]],s=!0;for(let[n,c]of i)for(let l of n){let u=a.namedTypeDefinitions.get(l.name);if(!u){s=!1,o.push(l.name);continue}if(!u.useAllData){s=!1,o.push(l.name);for(let[p]of u.members||[])c.push(p)}}return{allNamedTypesFullyDynamic:s,bindParameters:r,nonDynamicTypes:o}}var M=3;function Ne(e,t=100){let r={};for(let o of Object.entries(e.properties??{})){let[a,i]=o;typeof i=="string"&&i.length>t?r[a]=`${i.slice(0,t)}... (truncated, original length: ${i.length})`:r[a]=i}return e.properties=r,e}function k(e){return typeof e!="object"||e===null?String(e):"details"in e&&typeof e.details=="object"&&e.details!==null&&"errorMessage"in e.details&&typeof e.details.errorMessage=="string"?e.details.errorMessage:"message"in e&&typeof e.message=="string"?e.message:String(e)}var Mr=async({kg:e,queryParams:t,targetStructure:r,targetStructureReducer:o,requestOptions:a,queryRowLimit:i,queryTimeoutMs:s})=>{let n=null,c=r,l=new AbortController,u=a?.signal,p=()=>{l.abort(u?.reason)};u&&(u.aborted?l.abort(u.reason):u.addEventListener("abort",p,{once:!0}));try{let m=await nt(e,t,a);n=m.resultHeader;let w=m.resultRowsStream.getReader(),h=0,f=Date.now(),S=!1;for(;;){let{done:V,value:Ce}=await w.read();if(V)break;if(!S&&s&&Date.now()-f>s)return l.abort(),{type:"timeout"};for(let qe of Ce){if(h++,i&&h>i)return l.abort(),{type:"success",rowLimitReached:!0,resultHeader:n,processedResult:c};c=o(c,qe)}}}catch(m){return l.signal.aborted?{type:"aborted"}:{type:"error",errorMessage:k(m),error:m}}finally{u?.removeEventListener("abort",p)}return{type:"success",rowLimitReached:!1,resultHeader:n,processedResult:c}};async function Ae({prompt:e,bindParameters:t,kg:r,graphQueryServiceUrl:o,targetStructure:a,targetStructureReducer:i,requestOptions:s,queryRowLimit:n,queryTimeoutMs:c,config:l}){let u;for(let p=1;p<=M;p++){let m;try{m=await ae(e,r.dataModel,o,l,u)}catch(S){return{type:"generation-error",errorMessage:k(S),error:S}}await b({text:`Attempting to execute query: ${m.graphQuery.substring(0,500)}${m.graphQuery.length>500?"...":""}`},l);let w=await _r(m.graphQuery,t),h=await Mr({kg:r,queryParams:new ke({openCypherQuery:m.graphQuery,bindParameters:w}),targetStructure:a,targetStructureReducer:i,requestOptions:s,queryRowLimit:n,queryTimeoutMs:c}),f=h.type==="aborted"?"Query execution was aborted.":h.type==="timeout"?"Query execution timed out.":h.type==="error"?`Query failed with error: ${h.errorMessage}`:"";if(h.type==="success")return{type:"success",graphQuery:m.graphQuery,explanation:m.explanation,rowLimitReached:h.rowLimitReached,resultHeader:h.resultHeader,processedResult:h.processedResult};if(h.type==="aborted")return{type:"aborted",errorMessage:f,graphQuery:m.graphQuery,explanation:m.explanation};if(p>=M)return h.type==="timeout"?{type:"timeout",errorMessage:f,graphQuery:m.graphQuery,explanation:m.explanation}:{type:"execution-error",errorMessage:f,error:h.error,graphQuery:m.graphQuery,explanation:m.explanation};u={failedGraphQuery:m.graphQuery,executionError:f,attemptCount:p},await b({text:`Attempt ${p} failed with error: ${f}. Retrying...`},l)}throw new Error(`Failed to execute generated cypher due to an unexpected error after ${M} attempts.`)}var _r=async(e,t)=>{if(!t)return{};let{bindParameters:r,parseErrors:o}=await lt(e);if(o)return t;let a={};for(let i of r)i in t&&(a[i]=t[i]);return a},kr=async({kg:e,searchQuery:t,typeCategoryFilter:r,namedTypesFilter:o,searchResultLimit:a,requestOptions:i})=>{let s=[],n=[r];r==="both"&&!e.serviceDefinition.serviceCapabilities.searchCapabilities.searchTypeFilterCapabilities.includes("esriTypeBoth")&&(n=["entity","relationship"]);let c=a??1/0;try{for(let l of n){let u=c-s.length;if(u<=0)break;let p=(await it(e,new st({searchQuery:t,typeCategoryFilter:l,namedTypesFilter:o??void 0,num:u}),i)).resultRowsStream.getReader(),m=!1;for(;!m;){let{done:w,value:h}=await p.read();if(w){m=!0;break}for(let f of h)for(let S of f)s.push(S)}}}catch(l){let u=k(l);return i?.signal?.aborted?{type:"aborted",errorMessage:u,error:l}:{type:"error",errorMessage:u,error:l}}return{type:"success",results:s}},Re="IMPORTANT: The generated cypher query must return entire entities and relationships ONLY.";async function Ie({prompt:e,view:t,knowledgeGraph:r,includeReturnEntityAndRelationshipContext:o=!1}){let a=[e];if(o&&a.push(Re),!x(t)&&t.map){let u=await L("arcgis_knowledge_current_lc_context"),p=xr(t.map,r);return a.push(u),{enhancedPrompt:a.join(`
84
+ ${t.failedGraphQuery}`:`${e} ${r}`}async function wr(e,t,r,o){let{graphQuery:a,explanation:i}=await ae(e,t,r,o);return{graphQuery:a,explanation:i}}async function ae(e,t,r,o,a){let i={message:await gr(e,a),context:new H(t)},s=G(o);await b({text:"Attempting to generate a cypher query from your prompt..."},o);let n=await Se(`${r}/chat`,{method:"post",body:JSON.stringify(i),headers:{"Content-Type":"application/json",token:ve.findCredential(_.getDefault().url)?.token??""},signal:s});if(n.httpStatus!==200)throw new Error(`Graph query service returned an error: ${n.httpStatus}`,{cause:n.data});let c=!1,l=Date.now(),u=n.data.sequenceNumber,p="",m="",w=1;for(;!c;){await new Promise(f=>setTimeout(f,1e3)),await b({text:`Periodically requesting status of job from ArcGIS AI Services${"...".substring(0,w)}`},o),w=w%3+1;let h=await Se(`${r}/chat`,{method:"post",body:JSON.stringify({conversationId:n.data.conversationId,inquiryId:n.data.inquiryId,ackSequenceNumber:u}),headers:{"Content-Type":"application/json",token:ve.findCredential(_.getDefault().url)?.token??""},signal:s});if(h.httpStatus!==200)throw new Error(`Graph query service polling returned an error: ${h.httpStatus}`,{cause:h.data});if(h.data.context?.kind){if(h.data.context.kind!=="GraphQueryGenerationResponse")throw new Error(`Unexpected response from graph query service polling. Message: ${h.data.message}`,{cause:h.data});p=h.data.context.graphQuery,m=h.data.message||"",c=!0}else if(!h.data.hasMore)c=!0;else if(Date.now()-l>6e4)throw new Error("Graph query service polling timed out after 1 minute.");u=h.data.sequenceNumber}return{graphQuery:p,explanation:m}}function br(e,t){E(e,r=>{t.set(`${r.typeName}__${r.id}`,{id:r.id,typeName:r.typeName})})}function E(e,t){if(!(!e||typeof e!="object")){if(vr(e))for(let r of e.path)E(r,t);else if(Tr(e))t(e);else if(Array.isArray(e))for(let r of e)E(r,t);else if(Sr(e))for(let r of Object.values(e.properties??{}))E(r,t)}}function Tr(e){return!e||typeof e!="object"||Array.isArray(e)?!1:"id"in e&&"typeName"in e}function vr(e){return!e||typeof e!="object"||Array.isArray(e)?!1:e&&"path"in e&&Array.isArray(e.path)}function Sr(e){return!e||typeof e!="object"||Array.isArray(e)||"id"in e?!1:"properties"in e&&typeof e.properties=="object"}function xr(e,t){let r=[],o=[],a=[[t.dataModel.entityTypes,r],[t.dataModel.relationshipTypes,o]];for(let[i,s]of a)for(let n of i){let c=e.getMemberIdsByType(n.name);s.push(...c)}return{entityIds:r,relationshipIds:o}}function Er(e,t){let r={entityIds:new Array,relationshipIds:new Array},o=[],a=e?.allLayers.find(n=>n.type==="knowledge-graph")?.inclusionModeDefinition;if(!a)return{allNamedTypesFullyDynamic:!0,bindParameters:r,nonDynamicTypes:o};let i=[[t.dataModel.entityTypes,r.entityIds],[t.dataModel.relationshipTypes,r.relationshipIds]],s=!0;for(let[n,c]of i)for(let l of n){let u=a.namedTypeDefinitions.get(l.name);if(!u){s=!1,o.push(l.name);continue}if(!u.useAllData){s=!1,o.push(l.name);for(let[p]of u.members||[])c.push(p)}}return{allNamedTypesFullyDynamic:s,bindParameters:r,nonDynamicTypes:o}}var M=3;function Ne(e,t=100){let r={};for(let o of Object.entries(e.properties??{})){let[a,i]=o;typeof i=="string"&&i.length>t?r[a]=`${i.slice(0,t)}... (truncated, original length: ${i.length})`:r[a]=i}return e.properties=r,e}function k(e){return typeof e!="object"||e===null?String(e):"details"in e&&typeof e.details=="object"&&e.details!==null&&"errorMessage"in e.details&&typeof e.details.errorMessage=="string"?e.details.errorMessage:"message"in e&&typeof e.message=="string"?e.message:String(e)}var Mr=async({kg:e,queryParams:t,targetStructure:r,targetStructureReducer:o,requestOptions:a,queryRowLimit:i,queryTimeoutMs:s})=>{let n=null,c=r,l=new AbortController,u=a?.signal,p=()=>{l.abort(u?.reason)};u&&(u.aborted?l.abort(u.reason):u.addEventListener("abort",p,{once:!0}));try{let m=await nt(e,t,a);n=m.resultHeader;let w=m.resultRowsStream.getReader(),h=0,f=Date.now(),S=!1;for(;;){let{done:V,value:Ce}=await w.read();if(V)break;if(!S&&s&&Date.now()-f>s)return l.abort(),{type:"timeout"};for(let qe of Ce){if(h++,i&&h>i)return l.abort(),{type:"success",rowLimitReached:!0,resultHeader:n,processedResult:c};c=o(c,qe)}}}catch(m){return l.signal.aborted?{type:"aborted"}:{type:"error",errorMessage:k(m),error:m}}finally{u?.removeEventListener("abort",p)}return{type:"success",rowLimitReached:!1,resultHeader:n,processedResult:c}};async function Ae({prompt:e,bindParameters:t,kg:r,graphQueryServiceUrl:o,targetStructure:a,targetStructureReducer:i,requestOptions:s,queryRowLimit:n,queryTimeoutMs:c,config:l}){let u;for(let p=1;p<=M;p++){let m;try{m=await ae(e,r.dataModel,o,l,u)}catch(S){return{type:"generation-error",errorMessage:k(S),error:S}}await b({text:`Attempting to execute query: ${m.graphQuery.substring(0,500)}${m.graphQuery.length>500?"...":""}`},l);let w=await _r(m.graphQuery,t),h=await Mr({kg:r,queryParams:new ke({openCypherQuery:m.graphQuery,bindParameters:w}),targetStructure:a,targetStructureReducer:i,requestOptions:s,queryRowLimit:n,queryTimeoutMs:c}),f=h.type==="aborted"?"Query execution was aborted.":h.type==="timeout"?"Query execution timed out.":h.type==="error"?`Query failed with error: ${h.errorMessage}`:"";if(h.type==="success")return{type:"success",graphQuery:m.graphQuery,explanation:m.explanation,rowLimitReached:h.rowLimitReached,resultHeader:h.resultHeader,processedResult:h.processedResult};if(h.type==="aborted")return{type:"aborted",errorMessage:f,graphQuery:m.graphQuery,explanation:m.explanation};if(p>=M)return h.type==="timeout"?{type:"timeout",errorMessage:f,graphQuery:m.graphQuery,explanation:m.explanation}:{type:"execution-error",errorMessage:f,error:h.error,graphQuery:m.graphQuery,explanation:m.explanation};u={failedGraphQuery:m.graphQuery,executionError:f,attemptCount:p},await b({text:`Attempt ${p} failed with error: ${f}. Retrying...`},l)}throw new Error(`Failed to execute generated cypher due to an unexpected error after ${M} attempts.`)}var _r=async(e,t)=>{if(!t)return{};let{bindParameters:r,parseErrors:o}=await lt(e);if(o)return t;let a={};for(let i of r)i in t&&(a[i]=t[i]);return a},kr=async({kg:e,searchQuery:t,typeCategoryFilter:r,namedTypesFilter:o,searchResultLimit:a,requestOptions:i})=>{let s=[],n=[r];r==="both"&&!e.serviceDefinition.serviceCapabilities.searchCapabilities.searchTypeFilterCapabilities.includes("esriTypeBoth")&&(n=["entity","relationship"]);let c=a??1/0;try{for(let l of n){let u=c-s.length;if(u<=0)break;let p=(await it(e,new st({searchQuery:t,typeCategoryFilter:l,namedTypesFilter:o??void 0,num:u}),i)).resultRowsStream.getReader(),m=!1;for(;!m;){let{done:w,value:h}=await p.read();if(w){m=!0;break}for(let f of h)for(let S of f)s.push(S)}}}catch(l){let u=k(l);return i?.signal?.aborted?{type:"aborted",errorMessage:u,error:l}:{type:"error",errorMessage:u,error:l}}return{type:"success",results:s}},Re="IMPORTANT: The generated cypher query must return entire entities and relationships ONLY.";async function Ie({prompt:e,view:t,knowledgeGraph:r,includeReturnEntityAndRelationshipContext:o=!1}){let a=[e];if(o&&a.push(Re),x(t)){let u=await L("arcgis_knowledge_current_lc_context"),p=xr(t.map,r);return a.push(u),{enhancedPrompt:a.join(`
85
85
 
86
86
  `),bindParameters:p,allNamedTypesFullyDynamic:!1}}let i=t.map,{allNamedTypesFullyDynamic:s,bindParameters:n,nonDynamicTypes:c}=Er(i,r);if(s)return{enhancedPrompt:a.join(`
87
87
 
88
88
  `),bindParameters:n,allNamedTypesFullyDynamic:!0};let l=(await L("arcgis_knowledge_current_map_context")).replaceAll("{nonDynamicTypes}",JSON.stringify(c));return a.push(l),{enhancedPrompt:a.join(`
89
89
 
90
- `),bindParameters:n,allNamedTypesFullyDynamic:s}}async function $r(e,t,r,o,a,i){let{view:s}=a,n=await Ae({prompt:e,bindParameters:t,kg:r,graphQueryServiceUrl:o,targetStructure:new Map,targetStructureReducer:(m,w)=>{for(let h of w)br(h,m);return m},requestOptions:{signal:G(i),timeout:i?.timeout},config:i});if(n.type!=="success"){let m=n.type==="generation-error"?n.errorMessage:`${n.errorMessage} Cypher query: ${n.graphQuery}`;throw new Error(`Failed to add records to the link chart. ${m}`)}let{graphQuery:c,explanation:l,processedResult:u}=n,p=Array.from(u.values());return await b({text:`Query Results parsed into ${p.length} unique relationships and entities. Atempting to add to link chart...`},i),!x(s)&&s?.map?(await s.map.addRecords(p),await Q(s),{generatedQuery:c,explanation:l,addedIdTypePairs:p}):(await s?.map?.allLayers.find(m=>m.type==="knowledge-graph")?.addRecords(p),{generatedQuery:c,explanation:l,addedIdTypePairs:p})}var j="addRecords",Nr=d.object({prompt:d.string().describe("The user's inquiry and context required in order to generate a cypher query that will be used to add records to the link chart.")}),Ar=async({prompt:e},t)=>{let{knowledgeGraph:r}=await z(t),o=q(t),{view:a}=o,i=_.getDefault().helperServices,{enhancedPrompt:s,bindParameters:n,allNamedTypesFullyDynamic:c}=await Ie({prompt:e,view:a,knowledgeGraph:r,includeReturnEntityAndRelationshipContext:!0});if(c)return{toolName:j,status:"success",summary:"No records have been added to the map because all data in the knowledge graph is contained in the map.",details:{generatedQuery:"N/A",explanation:"All named types in the knowledge graph are fully dynamic and therefore all data is already contained in the map. No records have been added.",addedIdTypePairs:[]}};try{let{generatedQuery:l,explanation:u,addedIdTypePairs:p}=await $r(s,n,r,`${i.aiAssistantServices.url}${i.aiAssistantServices.graphQueryAssistant}`,o,t);return{toolName:j,status:"success",summary:`Records added successfully. Cypher Query used: ${l}
90
+ `),bindParameters:n,allNamedTypesFullyDynamic:s}}async function $r(e,t,r,o,a,i){let{view:s}=a,n=await Ae({prompt:e,bindParameters:t,kg:r,graphQueryServiceUrl:o,targetStructure:new Map,targetStructureReducer:(m,w)=>{for(let h of w)br(h,m);return m},requestOptions:{signal:G(i),timeout:i?.timeout},config:i});if(n.type!=="success"){let m=n.type==="generation-error"?n.errorMessage:`${n.errorMessage} Cypher query: ${n.graphQuery}`;throw new Error(`Failed to add records to the link chart. ${m}`)}let{graphQuery:c,explanation:l,processedResult:u}=n,p=Array.from(u.values());return await b({text:`Query Results parsed into ${p.length} unique relationships and entities. Atempting to add to link chart...`},i),x(s)?(await s.map.addRecords(p),await Q(s),{generatedQuery:c,explanation:l,addedIdTypePairs:p}):(await s?.map?.allLayers.find(m=>m.type==="knowledge-graph")?.addRecords(p),{generatedQuery:c,explanation:l,addedIdTypePairs:p})}var j="addRecords",Nr=d.object({prompt:d.string().describe("The user's inquiry and context required in order to generate a cypher query that will be used to add records to the link chart.")}),Ar=async({prompt:e},t)=>{let{knowledgeGraph:r}=await z(t),o=q(t),{view:a}=o,i=_.getDefault().helperServices,{enhancedPrompt:s,bindParameters:n,allNamedTypesFullyDynamic:c}=await Ie({prompt:e,view:a,knowledgeGraph:r,includeReturnEntityAndRelationshipContext:!0});if(c)return{toolName:j,status:"success",summary:"No records have been added to the map because all data in the knowledge graph is contained in the map.",details:{generatedQuery:"N/A",explanation:"All named types in the knowledge graph are fully dynamic and therefore all data is already contained in the map. No records have been added.",addedIdTypePairs:[]}};try{let{generatedQuery:l,explanation:u,addedIdTypePairs:p}=await $r(s,n,r,`${i.aiAssistantServices.url}${i.aiAssistantServices.graphQueryAssistant}`,o,t);return{toolName:j,status:"success",summary:`Records added successfully. Cypher Query used: ${l}
91
91
 
92
92
  Number of records added: ${p.length}`,details:{generatedQuery:l,explanation:u,addedIdTypePairs:p}}}catch(l){let u=k(l);return{toolName:j,status:"error",errorMessage:`Failed to add records to the link chart. ${u}`,error:l}}},ln=g(Ar,{name:j,description:`Adds records (entities or relationships) to the current link chart visualization from an inquiry into the knowledge graph data. The inquiry will retrieve data from the graph database that will serve as the basis for the records to be added to the link chart. The user should have explicitly requested to add records to the current link chart from their prompt. "add to new link chart" is not a valid prompt for this tool.
93
93
 
@@ -99,15 +99,15 @@ Number of records added: ${p.length}`,details:{generatedQuery:l,explanation:u,ad
99
99
  - "expand company x through all the buildings it owns"
100
100
  - "connect company x and company y"
101
101
  - "connect all buildings on the link chart"
102
- `,schema:Nr});async function Rr(e,t){return await t.map?.applyLayout(e),await Q(t),{appliedLayout:e}}var Z="applyLayout",Ir=d.object({layout:d.enum(["organic-standard","organic-community","basic-grid","hierarchical-bottom-to-top","radial-root-centric","tree-left-to-right","geographic-organic-standard","chronological-mono-timeline","chronological-multi-timeline"]).describe("The layout mode to apply to the link chart. The value must be one of the following: organic-standard, organic-community, basic-grid, hierarchical-bottom-to-top, radial-root-centric, tree-left-to-right, geographic-organic-standard, chronological-mono-timeline, chronological-multi-timeline")}),Cr=async({layout:e},t)=>{let{view:r}=q(t);if(x(r))return{toolName:Z,status:"error",errorMessage:"The applyLayout tool can only be used with a LinkChartView.",error:new Error};{let{appliedLayout:o}=await Rr(e,r);return{toolName:Z,status:"success",summary:`Successfully applied layout: ${o}.`,details:{appliedLayout:o}}}},cn=g(Cr,{name:Z,description:"Apply a diagram layout to the link chart",schema:Ir});async function qr(e,t){return t.map?.changeNonspatialDataDisplay(e),await Q(t),{appliedNonspatialDataDisplayMode:e}}var Y="changeNonspatialVisibility",zr=d.object({setting:d.enum(["hidden","visible"]).describe("The setting of nonspatial visibility")}),Dr=async({setting:e},t)=>{let{view:r}=q(t);if(x(r))return{toolName:Y,status:"error",errorMessage:"The changeNonspatialVisibility tool can only be used with a LinkChartView.",error:new Error};{let{appliedNonspatialDataDisplayMode:o}=await qr(e,r);return{toolName:Y,status:"success",summary:`Successfully applied nonspatial visibility setting: ${o}.`,details:{appliedNonspatialDataDisplayMode:o}}}},dn=g(Dr,{name:Y,description:"Change whether or not nonspatial data is visible in the link chart. The value must be either 'hidden' or 'visible'.",schema:zr});async function Pr(e,t,r,o,a){let i,s="";for(let n=1;n<=M;n++){let{graphQuery:c,explanation:l}=await ae(e,t.dataModel,r,a,i);try{await b({text:`Attempting to create link chart from derived query: ${c}`},a);let u=await at.fromCypherQuery(t,new ke({openCypherQuery:c}));await b({text:"Link chart created successfully, loading..."},a),await u.load();let p=o.map;return o.map=u,await o.when(),await _e.whenOnce(()=>!o.updating),u.entityCount===0&&u.relationshipCount===0?(o.map===u&&(o.map=p),u.destroy(),{type:"error",errorMessage:`Query returned no results. Cypher Query used to create the link chart:
102
+ `,schema:Nr});async function Rr(e,t){return await t.map?.applyLayout(e),await Q(t),{appliedLayout:e}}var Z="applyLayout",Ir=d.object({layout:d.enum(["organic-standard","organic-community","basic-grid","hierarchical-bottom-to-top","radial-root-centric","tree-left-to-right","geographic-organic-standard","chronological-mono-timeline","chronological-multi-timeline"]).describe("The layout mode to apply to the link chart. The value must be one of the following: organic-standard, organic-community, basic-grid, hierarchical-bottom-to-top, radial-root-centric, tree-left-to-right, geographic-organic-standard, chronological-mono-timeline, chronological-multi-timeline")}),Cr=async({layout:e},t)=>{let{view:r}=q(t);if(x(r)){let{appliedLayout:o}=await Rr(e,r);return{toolName:Z,status:"success",summary:`Successfully applied layout: ${o}.`,details:{appliedLayout:o}}}else return{toolName:Z,status:"error",errorMessage:"The applyLayout tool can only be used with a LinkChartView.",error:new Error}},cn=g(Cr,{name:Z,description:"Apply a diagram layout to the link chart",schema:Ir});async function qr(e,t){return t.map?.changeNonspatialDataDisplay(e),await Q(t),{appliedNonspatialDataDisplayMode:e}}var Y="changeNonspatialVisibility",zr=d.object({setting:d.enum(["hidden","visible"]).describe("The setting of nonspatial visibility")}),Dr=async({setting:e},t)=>{let{view:r}=q(t);if(x(r)){let{appliedNonspatialDataDisplayMode:o}=await qr(e,r);return{toolName:Y,status:"success",summary:`Successfully applied nonspatial visibility setting: ${o}.`,details:{appliedNonspatialDataDisplayMode:o}}}else return{toolName:Y,status:"error",errorMessage:"The changeNonspatialVisibility tool can only be used with a LinkChartView.",error:new Error}},dn=g(Dr,{name:Y,description:"Change whether or not nonspatial data is visible in the link chart. The value must be either 'hidden' or 'visible'.",schema:zr});async function Pr(e,t,r,o,a){let i,s="";for(let n=1;n<=M;n++){let{graphQuery:c,explanation:l}=await ae(e,t.dataModel,r,a,i);try{await b({text:`Attempting to create link chart from derived query: ${c}`},a);let u=await at.fromCypherQuery(t,new ke({openCypherQuery:c}));await b({text:"Link chart created successfully, loading..."},a),await u.load();let p=o.map;return o.map=u,await o.when(),await _e.whenOnce(()=>!o.updating),u.entityCount===0&&u.relationshipCount===0?(o.map===u&&(o.map=p),u.destroy(),{type:"error",errorMessage:`Query returned no results. Cypher Query used to create the link chart:
103
103
  ${c}
104
104
 
105
- Explanation: ${l}`}):(await Q(o),{type:"success",graphQuery:c,explanation:l})}catch(u){let p=k(u);if(n>=M){s=p;break}i={failedGraphQuery:c,executionError:p,attemptCount:n},await b({text:`Attempt ${n} to create link chart failed with error: ${p}. Retrying ...`},a)}}return{type:"error",errorMessage:`Failed to create link chart after ${M} attempts. Last error: ${s}`}}var F="createLinkChart",Or=d.object({prompt:d.string().describe("The user's inquiry and context required in order to generate a cypher query that will be used to create a link chart visualization. Only include information relevant to generating a cypher query. Do not suggest entity types, relationship types or properties. Do not include limits or formatting instructions for the query results unless specifically requested by the user. The prompt should be focused on the data the user wants to see in the link chart, not how to generate it.")}),jr=async({prompt:e},t)=>{let{knowledgeGraph:r}=await z(t),{view:o}=q(t);if(x(o))return{toolName:F,status:"error",errorMessage:"The createLinkChart tool can only be used with a LinkChartView.",error:new Error};{let a=_.getDefault().helperServices,i=await Pr(`${e}
105
+ Explanation: ${l}`}):(await Q(o),{type:"success",graphQuery:c,explanation:l})}catch(u){let p=k(u);if(n>=M){s=p;break}i={failedGraphQuery:c,executionError:p,attemptCount:n},await b({text:`Attempt ${n} to create link chart failed with error: ${p}. Retrying ...`},a)}}return{type:"error",errorMessage:`Failed to create link chart after ${M} attempts. Last error: ${s}`}}var F="createLinkChart",Or=d.object({prompt:d.string().describe("The user's inquiry and context required in order to generate a cypher query that will be used to create a link chart visualization. Only include information relevant to generating a cypher query. Do not suggest entity types, relationship types or properties. Do not include limits or formatting instructions for the query results unless specifically requested by the user. The prompt should be focused on the data the user wants to see in the link chart, not how to generate it.")}),jr=async({prompt:e},t)=>{let{knowledgeGraph:r}=await z(t),{view:o}=q(t);if(x(o)){let a=_.getDefault().helperServices,i=await Pr(`${e}
106
106
 
107
107
  ${Re}`,r,`${a.aiAssistantServices.url}${a.aiAssistantServices.graphQueryAssistant}`,o,t);if(i.type==="error")return{toolName:F,status:"error",errorMessage:i.errorMessage,error:new Error};let{graphQuery:s,explanation:n}=i;return{toolName:F,status:"success",summary:`Link chart created successfully. Cypher Query used to create the link chart:
108
108
  ${s}
109
109
 
110
- Explanation: ${n}`,details:{generatedQuery:s,explanation:n}}}},un=g(jr,{name:F,description:"Creates a new link chart visualization from an inquiry into the knowledge graph data. The inquiry will retrieve data from the graph database that will serve as the basis for the new link chart. The user should have explicitly requested the creation of a new link chart from their prompt using language like 'create new link chart' or 'add to new link chart'.",schema:Or}),X="queryGraphData",Fr=d.object({prompt:d.string().describe("The user's inquiry into the knowledge graph, from which a cypher query will be generated and executed to answer the inquiry. Only include entity types, relationship types or properties if they are provided in the user prompt or prior steps. Do not suggest entity types, relationship types or properties. Do not include limits, information on what to return, instructions on how to write the query, or formatting instructions for the query results unless specifically requested by the user.")}),Lr=async({prompt:e},t)=>{let{knowledgeGraph:r}=await z(t),o=_.getDefault().helperServices,a=e,i=null,s=null;try{({view:s}=q(t))}catch{}s&&({enhancedPrompt:a,bindParameters:i}=await Ie({prompt:e,view:s,knowledgeGraph:r,includeReturnEntityAndRelationshipContext:!1}));let n=await Ae({prompt:a,bindParameters:i,kg:r,graphQueryServiceUrl:`${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,targetStructure:new Array,targetStructureReducer:(f,S)=>(f.push(S),f),requestOptions:{signal:G(t),timeout:t?.timeout},config:t});if(n.type!=="success"){let f=n.type==="generation-error"?n.errorMessage:`${n.errorMessage} Cypher query: ${n.graphQuery}`;return{toolName:X,status:"error",errorMessage:`Failed to query the knowledge graph. ${f}`,error:"error"in n?n.error:null}}let{graphQuery:c,explanation:l,processedResult:u,resultHeader:p}=n,m=p.headerKeys;for(let f of u)for(let S of f)E(S,V=>Ne(V));let w=50,h=u.slice(0,w).map(f=>JSON.stringify(f));return{toolName:X,status:"success",summary:`To answer the inquiry, the following cypher query was executed against the knowledge graph:
110
+ Explanation: ${n}`,details:{generatedQuery:s,explanation:n}}}else return{toolName:F,status:"error",errorMessage:"The createLinkChart tool can only be used with a LinkChartView.",error:new Error}},un=g(jr,{name:F,description:"Creates a new link chart visualization from an inquiry into the knowledge graph data. The inquiry will retrieve data from the graph database that will serve as the basis for the new link chart. The user should have explicitly requested the creation of a new link chart from their prompt using language like 'create new link chart' or 'add to new link chart'.",schema:Or}),X="queryGraphData",Fr=d.object({prompt:d.string().describe("The user's inquiry into the knowledge graph, from which a cypher query will be generated and executed to answer the inquiry. Only include entity types, relationship types or properties if they are provided in the user prompt or prior steps. Do not suggest entity types, relationship types or properties. Do not include limits, information on what to return, instructions on how to write the query, or formatting instructions for the query results unless specifically requested by the user.")}),Lr=async({prompt:e},t)=>{let{knowledgeGraph:r}=await z(t),o=_.getDefault().helperServices,a=e,i=null,s=null;try{({view:s}=q(t))}catch{}s&&({enhancedPrompt:a,bindParameters:i}=await Ie({prompt:e,view:s,knowledgeGraph:r,includeReturnEntityAndRelationshipContext:!1}));let n=await Ae({prompt:a,bindParameters:i,kg:r,graphQueryServiceUrl:`${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,targetStructure:new Array,targetStructureReducer:(f,S)=>(f.push(S),f),requestOptions:{signal:G(t),timeout:t?.timeout},config:t});if(n.type!=="success"){let f=n.type==="generation-error"?n.errorMessage:`${n.errorMessage} Cypher query: ${n.graphQuery}`;return{toolName:X,status:"error",errorMessage:`Failed to query the knowledge graph. ${f}`,error:"error"in n?n.error:null}}let{graphQuery:c,explanation:l,processedResult:u,resultHeader:p}=n,m=p.headerKeys;for(let f of u)for(let S of f)E(S,V=>Ne(V));let w=50,h=u.slice(0,w).map(f=>JSON.stringify(f));return{toolName:X,status:"success",summary:`To answer the inquiry, the following cypher query was executed against the knowledge graph:
111
111
 
112
112
  \`\`\`cypher
113
113
  ${c}
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{b as g}from"./LXQFE5PJ.js";import"./RLEHNAIA.js";import{h as u,v as c,z as h}from"./6TA5KFAQ.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";export default $arcgis.t(([{watch:_},y,{property:m,subclass:f}])=>{var A=Object.defineProperty,S=Object.getOwnPropertyDescriptor,p=(e,s,i,a)=>{for(var r=a>1?void 0:a?S(s,i):s,t=e.length-1,n;t>=0;t--)(n=e[t])&&(r=(a?n(s,i,r):n(r))||r);return a&&r&&A(s,i,r),r};function l(){return typeof window>"u"?null:window}var o=class extends y{constructor(){super(...arguments),this._utterance=null,this.state="idle",this.supported=o.isSupported()}destroy(){this.stop(),super.destroy()}start(e){let s=e.trim(),i=l(),a=i?.SpeechSynthesisUtterance,r=i?.speechSynthesis;if(this._set("supported",o.isSupported(i)),!s||!a||!r)return;this.stop();let t=new a(s);t.rate=.9,t.pitch=1.1,t.volume=1,t.onend=()=>{this._utterance===t&&this._reset()},t.onerror=()=>{this._utterance===t&&this._reset()};try{r.speak(t),this._utterance=t,this._set("state","playing")}catch{t.onend=null,t.onerror=null,this._reset()}}stop(){let e=l(),s=e?.speechSynthesis;if(this._set("supported",o.isSupported(e)),s)try{(s.speaking||s.pending)&&s.cancel()}catch{}this._reset()}toggle(e){if(this.state==="playing"){this.stop();return}this.start(e)}static isSupported(e=l()){return!!e?.speechSynthesis&&typeof e.SpeechSynthesisUtterance=="function"}_reset(){this._utterance&&(this._utterance.onend=null,this._utterance.onerror=null),this._utterance=null,this._set("state","idle")}};p([m({readOnly:!0})],o.prototype,"state",2);p([m({readOnly:!0})],o.prototype,"supported",2);o=p([f("ReadAloudController")],o);var d=class extends c{constructor(){super(...arguments),this._messages=g({blocking:!0}),this._readAloudController=new o,this.readAloudEnabled=!1}static{this.properties={readAloudEnabled:5,message:0}}loaded(){this.manager.onLifecycle(()=>[_(()=>this._readAloudController.state,()=>this.requestUpdate(),{initial:!0}),{remove:()=>{this._readAloudController.stop()}}])}_toggleReadAloud(){this._readAloudController.toggle(this.message?.content??"")}render(){return this.readAloudEnabled&&!this.message?.error&&this.message?.content?.trim()&&this._readAloudController.supported?u`<calcite-action id=action-read-aloud .icon=${this._readAloudController.state==="playing"?"sound-off":"sound"} scale=s .active=${this._readAloudController.state==="playing"} @click=${()=>this._toggleReadAloud()} text></calcite-action><calcite-tooltip reference-element=action-read-aloud overlay-positioning=fixed placement=bottom><span>${this._readAloudController.state==="playing"?this._messages.stopReadingButtonLabel:this._messages.readAloudButtonLabel}</span></calcite-tooltip>`:null}};h("arcgis-assistant-message-read-aloud",d);return d},"core/reactiveUtils","core/Accessor","core/accessorSupport/decorators")
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a}from"./CGXQAB3A.js";import"./ONQ6JSBJ.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export{a as goToScaleTool};
2
+ import{a}from"./K2R6XVK3.js";import"./ONQ6JSBJ.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export{a as goToScaleTool};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import b from"./Q4IQUEZN.js";import"./34O57OGV.js";import"./FDOMMK2M.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,a])=>{return a},a,b)
2
+ import b from"./U2D53TAX.js";import"./34O57OGV.js";import"./FDOMMK2M.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,a])=>{return a},a,b)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a}from"./EAEQONP7.js";import"./ONQ6JSBJ.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export{a as goToFeaturesTool};
2
+ import{a}from"./VLLZ2FFU.js";import"./ONQ6JSBJ.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export{a as goToFeaturesTool};