@arcgis/ai-agents 5.1.0-next.105 → 5.1.0-next.107

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.
@@ -4,7 +4,7 @@ export declare const arcgisKnowledgeState: import('@langchain/langgraph/web').An
4
4
  intent: import('@langchain/langgraph/web').BaseChannel<string, string | import('@langchain/langgraph/web').OverwriteValue<string>, unknown>;
5
5
  arcgisKnowledgeMessages: import('@langchain/langgraph/web').BaseChannel<ChatHistory, ChatHistory | import('@langchain/langgraph/web').OverwriteValue<ChatHistory>, unknown>;
6
6
  arcgisKnowledgeToolResult: import('@langchain/langgraph/web').BaseChannel<ArcgisKnowledgeToolResult[] | null, ArcgisKnowledgeToolResult[] | import('@langchain/langgraph/web').OverwriteValue<ArcgisKnowledgeToolResult[] | null> | null, unknown>;
7
- agentExecutionContext: import('@langchain/langgraph/web').BaseChannel<import('@arcgis/ai-orchestrator').AgentExecutionContext, unknown, unknown>;
7
+ agentExecutionContext: import('@langchain/langgraph/web').BaseChannel<Readonly<import('@arcgis/ai-orchestrator').AgentExecutionContextShape<import('@arcgis/ai-orchestrator').SharedState<Record<string, unknown>>>>, unknown, unknown>;
8
8
  outputMessage: import('@langchain/langgraph/web').BaseChannel<string, unknown, unknown>;
9
9
  summary: import('@langchain/langgraph/web').BaseChannel<string, unknown, unknown>;
10
10
  status: import('@langchain/langgraph/web').BaseChannel<import('@arcgis/ai-orchestrator').AgentStatus | undefined, unknown, unknown>;
@@ -7,7 +7,7 @@ export declare const DataExplorationState: import('@langchain/langgraph/web').An
7
7
  layerFieldInfo: import('@langchain/langgraph/web').LastValue<LayerFieldInfo>;
8
8
  queryResponse: import('@langchain/langgraph/web').LastValue<QueryResponse[]>;
9
9
  dataExplorationMessages: import('@langchain/langgraph/web').BaseChannel<ChatHistory, ChatHistory | import('@langchain/langgraph/web').OverwriteValue<ChatHistory>, unknown>;
10
- agentExecutionContext: import('@langchain/langgraph/web').BaseChannel<import('@arcgis/ai-orchestrator').AgentExecutionContext, unknown, unknown>;
10
+ agentExecutionContext: import('@langchain/langgraph/web').BaseChannel<Readonly<import('@arcgis/ai-orchestrator').AgentExecutionContextShape<import('@arcgis/ai-orchestrator').SharedState<Record<string, unknown>>>>, unknown, unknown>;
11
11
  outputMessage: import('@langchain/langgraph/web').BaseChannel<string, unknown, unknown>;
12
12
  summary: import('@langchain/langgraph/web').BaseChannel<string, unknown, unknown>;
13
13
  status: import('@langchain/langgraph/web').BaseChannel<import('@arcgis/ai-orchestrator').AgentStatus | undefined, unknown, unknown>;
@@ -1,7 +1,7 @@
1
1
  import { HelpInternalState } from '../types/types';
2
2
  export declare const HelpState: import('@langchain/langgraph/web').AnnotationRoot<{
3
3
  helpInternalState: import('@langchain/langgraph/web').BaseChannel<HelpInternalState, HelpInternalState | import('@langchain/langgraph/web').OverwriteValue<HelpInternalState>, unknown>;
4
- agentExecutionContext: import('@langchain/langgraph/web').BaseChannel<import('@arcgis/ai-orchestrator').AgentExecutionContext, unknown, unknown>;
4
+ agentExecutionContext: import('@langchain/langgraph/web').BaseChannel<Readonly<import('@arcgis/ai-orchestrator').AgentExecutionContextShape<import('@arcgis/ai-orchestrator').SharedState<Record<string, unknown>>>>, unknown, unknown>;
5
5
  outputMessage: import('@langchain/langgraph/web').BaseChannel<string, unknown, unknown>;
6
6
  summary: import('@langchain/langgraph/web').BaseChannel<string, unknown, unknown>;
7
7
  status: import('@langchain/langgraph/web').BaseChannel<import('@arcgis/ai-orchestrator').AgentStatus | undefined, unknown, unknown>;
@@ -5,7 +5,7 @@ export declare const LayerStylingState: import('@langchain/langgraph/web').Annot
5
5
  vectorSearchFieldResults: import('@langchain/langgraph/web').LastValue<VectorSearchFieldResults>;
6
6
  layerFieldInfo: import('@langchain/langgraph/web').LastValue<LayerFieldInfo>;
7
7
  selectedLayerId: import('@langchain/langgraph/web').LastValue<string>;
8
- agentExecutionContext: import('@langchain/langgraph/web').BaseChannel<import('@arcgis/ai-orchestrator').AgentExecutionContext, unknown, unknown>;
8
+ agentExecutionContext: import('@langchain/langgraph/web').BaseChannel<Readonly<import('@arcgis/ai-orchestrator').AgentExecutionContextShape<import('@arcgis/ai-orchestrator').SharedState<Record<string, unknown>>>>, unknown, unknown>;
9
9
  outputMessage: import('@langchain/langgraph/web').BaseChannel<string, unknown, unknown>;
10
10
  summary: import('@langchain/langgraph/web').BaseChannel<string, unknown, unknown>;
11
11
  status: import('@langchain/langgraph/web').BaseChannel<import('@arcgis/ai-orchestrator').AgentStatus | undefined, unknown, unknown>;
@@ -1,5 +1,5 @@
1
1
  import { VectorSearchFieldResults } from '@arcgis/ai-orchestrator';
2
- import { NavigationInternalState } from '../types/types';
2
+ import { NavigationInternalState, NavigationSharedState } from '../types/types';
3
3
  export declare const NavigationState: import('@langchain/langgraph/web').AnnotationRoot<{
4
4
  intent: import('@langchain/langgraph/web').BaseChannel<string, string | import('@langchain/langgraph/web').OverwriteValue<string>, unknown>;
5
5
  vectorSearchLayerResults: import('@langchain/langgraph/web').BaseChannel<{
@@ -20,12 +20,10 @@ export declare const NavigationState: import('@langchain/langgraph/web').Annotat
20
20
  }[]>, unknown>;
21
21
  vectorSearchFieldResults: import('@langchain/langgraph/web').BaseChannel<VectorSearchFieldResults, VectorSearchFieldResults | import('@langchain/langgraph/web').OverwriteValue<VectorSearchFieldResults>, unknown>;
22
22
  navigationInternalState: import('@langchain/langgraph/web').BaseChannel<NavigationInternalState, NavigationInternalState | import('@langchain/langgraph/web').OverwriteValue<NavigationInternalState>, unknown>;
23
- agentExecutionContext: import('@langchain/langgraph/web').BaseChannel<import('@arcgis/ai-orchestrator').AgentExecutionContext, unknown, unknown>;
23
+ agentExecutionContext: import('@langchain/langgraph/web').BaseChannel<Readonly<import('@arcgis/ai-orchestrator').AgentExecutionContextShape<import('@arcgis/ai-orchestrator').SharedState<NavigationSharedState>>>, unknown, unknown>;
24
24
  outputMessage: import('@langchain/langgraph/web').BaseChannel<string, unknown, unknown>;
25
25
  summary: import('@langchain/langgraph/web').BaseChannel<string, unknown, unknown>;
26
26
  status: import('@langchain/langgraph/web').BaseChannel<import('@arcgis/ai-orchestrator').AgentStatus | undefined, unknown, unknown>;
27
- sharedStatePatch: import('@langchain/langgraph/web').BaseChannel<import('@arcgis/ai-orchestrator').SharedStatePatch<{
28
- lastResolvedLocation?: import('../types/types').LastResolvedLocation;
29
- }> | undefined, unknown, unknown>;
27
+ sharedStatePatch: import('@langchain/langgraph/web').BaseChannel<import('@arcgis/ai-orchestrator').SharedStatePatch<NavigationSharedState> | undefined, unknown, unknown>;
30
28
  }>;
31
29
  export type NavigationGraphStateType = typeof NavigationState.State;
@@ -1,4 +1,3 @@
1
- import { SharedStatePatch } from '@arcgis/ai-orchestrator';
2
1
  import { AIMessage } from '@langchain/core/messages';
3
2
  export type NavigationInternalState = {
4
3
  toolCallMessage?: AIMessage;
@@ -8,6 +7,6 @@ export type LastResolvedLocation = {
8
7
  location: unknown;
9
8
  extent: unknown;
10
9
  };
11
- export type NavigationSharedStatePatch = SharedStatePatch<{
12
- lastResolvedLocation?: LastResolvedLocation;
13
- }>;
10
+ export interface NavigationSharedState extends Record<string, unknown> {
11
+ lastResolvedLocation: LastResolvedLocation;
12
+ }
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { Annotation as v, StateGraph as W, START as U, END as C, messagesStateReducer as ke, NodeInterrupt as lt } from "@langchain/langgraph/web";
2
2
  import { createAgentRuntimeStateWithSharedState as ct, invokeToolPrompt as P, sendTraceMessage as m, invokeStructuredPrompt as Fe, createAgentRuntimeState as ee, invokeTextPrompt as qe, sendUXSuggestion as k } from "@arcgis/ai-orchestrator";
3
3
  import { tool as b } from "@langchain/core/tools";
4
+ import oe from "@arcgis/core/config.js";
4
5
  import dt from "@arcgis/core/Graphic.js";
5
- import ut from "@arcgis/core/symbols/PictureMarkerSymbol.js";
6
- import { addressToLocations as pt } from "@arcgis/core/rest/locator.js";
7
6
  import _ from "@arcgis/core/portal/Portal.js";
8
- import oe from "@arcgis/core/config.js";
7
+ import { addressToLocations as ut } from "@arcgis/core/rest/locator.js";
8
+ import pt from "@arcgis/core/symbols/PictureMarkerSymbol.js";
9
9
  import l, { z as I } from "zod";
10
10
  import Le from "@arcgis/core/geometry/Extent.js";
11
11
  import Ie from "@arcgis/core/geometry/Point.js";
@@ -64,16 +64,16 @@ const V = (e, t) => t ?? e, De = v.Root({
64
64
  })
65
65
  });
66
66
  async function Gt(e, t) {
67
- const a = _.getDefault().helperServices, o = a.geocode.find((y) => y.name === "ArcGIS World Geocoding Service") ?? a.geocode[0];
67
+ const a = _.getDefault().helperServices, o = a.geocode.find((h) => h.name === "ArcGIS World Geocoding Service") ?? a.geocode[0];
68
68
  if (!o)
69
69
  throw new Error("No geocoding service found in helperServices.");
70
- const n = o.url, s = `${oe.assetsPath?.endsWith("/") ? oe.assetsPath : `${oe.assetsPath}/`}esri/images/search/search-symbol-32.png`, c = (await pt(n, {
70
+ const n = o.url, s = `${oe.assetsPath?.endsWith("/") ? oe.assetsPath : `${oe.assetsPath}/`}esri/images/search/search-symbol-32.png`, c = (await ut(n, {
71
71
  address: { SingleLine: e },
72
72
  outFields: ["Match_addr"]
73
73
  }))?.[0];
74
74
  if (!c?.extent || !c.location)
75
75
  throw new Error(`Could not find location for: ${e}`);
76
- const d = new ut({
76
+ const d = new pt({
77
77
  url: s,
78
78
  width: 24,
79
79
  height: 24
@@ -82,18 +82,14 @@ async function Gt(e, t) {
82
82
  symbol: d
83
83
  });
84
84
  t.graphics.removeAll(), t.graphics.add(u), await t.goTo(c.extent);
85
- const h = {
86
- lastResolvedLocation: {
87
- value: {
88
- address: c.address ?? "",
89
- location: c.location ? c.location.toJSON() : null,
90
- extent: c.extent ? c.extent.toJSON() : null
91
- }
92
- }
85
+ const p = {
86
+ address: c.address ?? "",
87
+ location: c.location ? c.location.toJSON() : null,
88
+ extent: c.extent ? c.extent.toJSON() : null
93
89
  };
94
90
  return {
95
91
  text: `Successfully zoomed to ${e}.`,
96
- sharedStatePatch: h
92
+ sharedStatePatch: { lastResolvedLocation: { value: p } }
97
93
  };
98
94
  }
99
95
  const Ot = ["mapView"];
@@ -342,16 +338,16 @@ ${i}` : "", p = {
342
338
  modelTier: "fast",
343
339
  inputVariables: p,
344
340
  tools: pe
345
- }), y = (h.tool_calls?.length ?? 0) > 0, w = typeof h.text == "string" ? h.text.trim() : "", g = w.length > 0;
341
+ }), g = (h.tool_calls?.length ?? 0) > 0, w = typeof h.text == "string" ? h.text.trim() : "", y = w.length > 0;
346
342
  return {
347
343
  ...e,
348
344
  navigationInternalState: {
349
345
  ...e.navigationInternalState,
350
- toolCallMessage: y ? h : void 0
346
+ toolCallMessage: g ? h : void 0
351
347
  },
352
348
  // No tool call => surface fallback text now. Tool call => tool node will set output.
353
- outputMessage: y ? e.outputMessage : w,
354
- status: y ? e.status : g ? "success" : "failed"
349
+ outputMessage: g ? e.outputMessage : w,
350
+ status: g ? e.status : y ? "success" : "failed"
355
351
  };
356
352
  }
357
353
  const N = (e, t = 300) => {
@@ -422,7 +418,7 @@ async function Cr(e, t) {
422
418
  })), s = a.map.bookmarks?.map((h) => h.name).filter(Boolean) ?? [], i = s.length ? `Available bookmarks:
423
419
  ${s.map((h) => `- ${h}`).join(`
424
420
  `)}` : "", c = {
425
- tools: o.map(({ name: h, description: y, schema: w }) => `${h}: ${y}, ${JSON.stringify(w)}`).join(`
421
+ tools: o.map(({ name: h, description: g, schema: w }) => `${h}: ${g}, ${JSON.stringify(w)}`).join(`
426
422
  `),
427
423
  bookmarks: i,
428
424
  assignedTask: e.agentExecutionContext.assignedTask,
@@ -496,14 +492,14 @@ ${s.map((c) => `- layerId=${c.id} | title=${c.title ?? ""} | name=${c.name ?? ""
496
492
  layerId: d,
497
493
  layerName: a.get(d)?.layerItem.name,
498
494
  results: u.map((h) => {
499
- const y = p?.get(h.name);
495
+ const g = p?.get(h.name);
500
496
  return {
501
497
  name: h.name,
502
498
  score: h.score,
503
- type: y?.type,
504
- alias: y?.alias,
505
- description: y?.description,
506
- statistics: y?.statistics
499
+ type: g?.type,
500
+ alias: g?.alias,
501
+ description: g?.description,
502
+ statistics: g?.statistics
507
503
  };
508
504
  })
509
505
  };
@@ -928,7 +924,7 @@ const ua = async (e) => {
928
924
  const c = await o.whenLayerView(i), u = n.get(t.layerId)?.fieldRegistry.get(r), p = u?.alias;
929
925
  if (!u)
930
926
  throw new Error(`Field '${r}' not found.`);
931
- let h, y;
927
+ let h, g;
932
928
  if (s) {
933
929
  const T = await te(s, o);
934
930
  if ("error" in T)
@@ -951,7 +947,7 @@ const ua = async (e) => {
951
947
  units: s.units,
952
948
  applied: !0
953
949
  });
954
- y = new Ne({
950
+ g = new Ne({
955
951
  geometry: T.geometry,
956
952
  distance: s.distance,
957
953
  units: s.units,
@@ -959,7 +955,7 @@ const ua = async (e) => {
959
955
  });
960
956
  }
961
957
  const w = me(c, [r], !1);
962
- let g = null, f = null;
958
+ let y = null, f = null;
963
959
  const x = 10;
964
960
  if (u.type !== "geometry" && u.type !== "oid" && u.type !== "global-id")
965
961
  try {
@@ -969,10 +965,10 @@ const ua = async (e) => {
969
965
  view: w ? o : void 0,
970
966
  field: r,
971
967
  sqlWhere: X(i.definitionExpression, t.where),
972
- ...y && { filter: y },
968
+ ...g && { filter: g },
973
969
  outStatisticTypes: { include: [a] }
974
970
  };
975
- g = await Ae(T);
971
+ y = await Ae(T);
976
972
  const D = ["string", "small-integer", "integer"], L = u.domain?.type === "coded-value" ? u.domain : null;
977
973
  (D.includes(u.type) || L) && (f = (await Me({
978
974
  layer: i,
@@ -980,7 +976,7 @@ const ua = async (e) => {
980
976
  view: w ? o : void 0,
981
977
  field: r,
982
978
  sqlWhere: X(i.definitionExpression, t.where),
983
- ...y && { filter: y }
979
+ ...g && { filter: g }
984
980
  })).uniqueValueInfos.sort(($, it) => it.count - $.count).slice(0, x)), f && u.domain?.type === "coded-value" && (f = f.map(($) => ({
985
981
  ...$,
986
982
  value: L ? L.getName($.value) ?? $.value : $.value
@@ -991,13 +987,13 @@ const ua = async (e) => {
991
987
  return {
992
988
  tool: "getStatistics",
993
989
  layerName: i.title ?? t.layerId,
994
- summary: `${a} = ${typeof g?.[a] == "number" ? g[a] : "N/A"}`,
990
+ summary: `${a} = ${typeof y?.[a] == "number" ? y[a] : "N/A"}`,
995
991
  details: {
996
992
  fieldName: r,
997
993
  fieldAlias: p,
998
994
  statisticType: a,
999
- statistic: g?.[a] ?? null,
1000
- summaryStatistics: g,
995
+ statistic: y?.[a] ?? null,
996
+ summaryStatistics: y,
1001
997
  uniqueValues: f,
1002
998
  where: t.where,
1003
999
  spatialFilterInfo: h
@@ -1088,7 +1084,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1088
1084
  try {
1089
1085
  let h;
1090
1086
  if (d) {
1091
- const g = new ft({
1087
+ const y = new ft({
1092
1088
  where: e.where || "1=1",
1093
1089
  outFields: p,
1094
1090
  orderByFields: e.orderByFields,
@@ -1102,18 +1098,18 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1102
1098
  orderByFields: t.orderByFields
1103
1099
  })
1104
1100
  });
1105
- h = await n.queryTopFeatures(g);
1101
+ h = await n.queryTopFeatures(y);
1106
1102
  } else {
1107
- const g = n.createQuery();
1108
- g.where = X(n.definitionExpression, e.where || "1=1"), g.outFields = p.length ? p : ["*"], g.orderByFields = t.orderByFields, g.num = t.topCount, c && (g.geometry = c, g.spatialRelationship = "intersects"), a?.distance && (g.distance = a.distance), a?.units && (g.units = a.units), g.outSpatialReference = r.spatialReference;
1103
+ const y = n.createQuery();
1104
+ y.where = X(n.definitionExpression, e.where || "1=1"), y.outFields = p.length ? p : ["*"], y.orderByFields = t.orderByFields, y.num = t.topCount, c && (y.geometry = c, y.spatialRelationship = "intersects"), a?.distance && (y.distance = a.distance), a?.units && (y.units = a.units), y.outSpatialReference = r.spatialReference;
1109
1105
  const f = me(s, e.outFields, o ?? !1);
1110
1106
  try {
1111
- h = f ? await s.queryFeatures(g) : await n.queryFeatures(g);
1107
+ h = f ? await s.queryFeatures(y) : await n.queryFeatures(y);
1112
1108
  } catch (x) {
1113
- console.warn("Client-side query failed, falling back to server:", x), h = await n.queryFeatures(g);
1109
+ console.warn("Client-side query failed, falling back to server:", x), h = await n.queryFeatures(y);
1114
1110
  }
1115
1111
  }
1116
- const y = h.features.map((g) => g.attributes[u]), { attributes: w } = Qe(n, h, r.timeZone);
1112
+ const g = h.features.map((y) => y.attributes[u]), { attributes: w } = Qe(n, h, r.timeZone);
1117
1113
  return {
1118
1114
  tool: "getTopFeatures",
1119
1115
  layerName: i,
@@ -1121,7 +1117,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1121
1117
  details: {
1122
1118
  topCount: t.topCount,
1123
1119
  attributes: w,
1124
- objectIds: y,
1120
+ objectIds: g,
1125
1121
  objectIdField: u,
1126
1122
  where: e.where,
1127
1123
  orderByFields: t.orderByFields,
@@ -1188,12 +1184,12 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1188
1184
  description: 'Returns top N features ranked by an existing field value. Use for "highest", "lowest", "top N" questions where ranking is based on a field that already exists in the data (e.g., population, value, date, depth). orderByFields must be actual field names with ASC/DESC. Do NOT use aggregate functions like COUNT(), SUM(), AVG() - those require getStatistics.',
1189
1185
  schema: va
1190
1186
  }), ne = 25, Ta = async (e, t, r, a) => {
1191
- const o = t.map?.allLayers.find((g) => g.id === e.layerId), n = await t.whenLayerView(o), s = o.title ?? e.layerId;
1187
+ const o = t.map?.allLayers.find((y) => y.id === e.layerId), n = await t.whenLayerView(o), s = o.title ?? e.layerId;
1192
1188
  let i;
1193
1189
  if (r) {
1194
- const g = await te(r, t);
1195
- if ("error" in g) {
1196
- const f = { error: g.error };
1190
+ const y = await te(r, t);
1191
+ if ("error" in y) {
1192
+ const f = { error: y.error };
1197
1193
  if (Q(r)) {
1198
1194
  const x = t.map?.allLayers.find((E) => E.id === r.layerId);
1199
1195
  f.geometryLayerName = x?.title ?? x?.id, f.geometryLayerId = r.layerId, f.geometryWhere = r.where;
@@ -1205,7 +1201,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1205
1201
  details: f
1206
1202
  };
1207
1203
  }
1208
- if (!g.geometry) {
1204
+ if (!y.geometry) {
1209
1205
  const f = {};
1210
1206
  if (Q(r)) {
1211
1207
  const x = t.map?.allLayers.find((E) => E.id === r.layerId);
@@ -1218,17 +1214,17 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1218
1214
  details: f
1219
1215
  };
1220
1216
  }
1221
- i = g.geometry;
1217
+ i = y.geometry;
1222
1218
  } else a && (i = t.extent.clone());
1223
1219
  const c = me(n, e.outFields, a ?? !1), d = o.objectIdField, u = o.createQuery();
1224
1220
  u.where = X(o.definitionExpression, e.where || "1=1"), u.outFields = e.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...e.outFields, d])], u.orderByFields = e.orderByFields, i && (u.geometry = i, u.spatialRelationship = "intersects"), r?.distance && (u.distance = r.distance), r?.units && (u.units = r.units), u.outSpatialReference = t.spatialReference;
1225
1221
  let p, h;
1226
1222
  try {
1227
1223
  p = c ? await n.queryFeatureCount(u) : await o.queryFeatureCount(u), p > 0 && p <= ne && (h = c ? await n.queryFeatures(u) : await o.queryFeatures(u));
1228
- } catch (g) {
1229
- console.warn("Client-side query failed, falling back to server:", g), p = await o.queryFeatureCount(u), p > 0 && p <= ne && (h = await o.queryFeatures(u));
1224
+ } catch (y) {
1225
+ console.warn("Client-side query failed, falling back to server:", y), p = await o.queryFeatureCount(u), p > 0 && p <= ne && (h = await o.queryFeatures(u));
1230
1226
  }
1231
- const { objectIds: y, attributes: w } = h ? Qe(o, h, t.timeZone) : { objectIds: void 0, attributes: void 0 };
1227
+ const { objectIds: g, attributes: w } = h ? Qe(o, h, t.timeZone) : { objectIds: void 0, attributes: void 0 };
1232
1228
  return {
1233
1229
  tool: "queryFeatures",
1234
1230
  layerName: s,
@@ -1238,7 +1234,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1238
1234
  where: e.where,
1239
1235
  orderByFields: e.orderByFields,
1240
1236
  outFields: e.outFields,
1241
- ...y && { objectIds: y, objectIdField: d },
1237
+ ...g && { objectIds: g, objectIdField: d },
1242
1238
  ...w && { attributes: w },
1243
1239
  ...p > ne && {
1244
1240
  note: `${p} features found.`
@@ -1460,33 +1456,33 @@ async function ja(e, t, r, a = !0) {
1460
1456
  const o = [], n = [], s = [];
1461
1457
  for (const i of e) {
1462
1458
  let c = function(w) {
1463
- const g = t.get(w)?.layerItem;
1464
- return g ? [
1465
- g.name && `Name: ${g.name}`,
1466
- g.title && `Title: ${g.title}`,
1467
- g.description && `Description: ${g.description}`
1459
+ const y = t.get(w)?.layerItem;
1460
+ return y ? [
1461
+ y.name && `Name: ${y.name}`,
1462
+ y.title && `Title: ${y.title}`,
1463
+ y.description && `Description: ${y.description}`
1468
1464
  ].filter(Boolean).join(" | ") : w;
1469
1465
  };
1470
1466
  const { layerId: d, results: u } = i, p = r.map?.allLayers.find((w) => w.id === d), h = t.get(d)?.fieldRegistry;
1471
1467
  if (!h)
1472
1468
  continue;
1473
- let y = o.find((w) => w.layerId === d);
1474
- y || (y = {
1469
+ let g = o.find((w) => w.layerId === d);
1470
+ g || (g = {
1475
1471
  layerId: d,
1476
1472
  layerSummary: c(d),
1477
1473
  fieldInfos: []
1478
- }, o.push(y));
1474
+ }, o.push(g));
1479
1475
  for (const w of u) {
1480
- const g = h.get(w.name);
1481
- if (!g)
1476
+ const y = h.get(w.name);
1477
+ if (!y)
1482
1478
  continue;
1483
- const f = g.statistics, x = a && !f?.summaryStatistics, E = Da(g.type, g.domain?.type) && !f?.uniqueValues, T = x || E;
1479
+ const f = y.statistics, x = a && !f?.summaryStatistics, E = Da(y.type, y.domain?.type) && !f?.uniqueValues, T = x || E;
1484
1480
  if (s.push({
1485
1481
  layerId: d,
1486
- fieldName: g.name,
1482
+ fieldName: y.name,
1487
1483
  didFetchStatistics: T
1488
1484
  }), T) {
1489
- const D = _a(p, g, {
1485
+ const D = _a(p, y, {
1490
1486
  includeSummaryStatistics: x,
1491
1487
  includeUniqueValues: E
1492
1488
  }).then((L) => {
@@ -1494,11 +1490,11 @@ async function ja(e, t, r, a = !0) {
1494
1490
  summaryStatistics: f?.summaryStatistics ?? null,
1495
1491
  uniqueValues: f?.uniqueValues ?? null
1496
1492
  };
1497
- x && ($.summaryStatistics = L.summaryStatistics), E && ($.uniqueValues = L.uniqueValues), h.set(g.name, { ...g, statistics: $ }), g.statistics = $;
1493
+ x && ($.summaryStatistics = L.summaryStatistics), E && ($.uniqueValues = L.uniqueValues), h.set(y.name, { ...y, statistics: $ }), y.statistics = $;
1498
1494
  });
1499
1495
  n.push(D);
1500
1496
  }
1501
- y.fieldInfos.push(g);
1497
+ g.fieldInfos.push(y);
1502
1498
  }
1503
1499
  }
1504
1500
  return await Promise.all(n), {
@@ -2620,7 +2616,7 @@ const He = v.Root({
2620
2616
  if (r.length <= 1)
2621
2617
  return { ...e, selectedLayerId: e.vectorSearchLayerIds[0] };
2622
2618
  const { hitlResponse: a } = t.configurable;
2623
- if (!a || a.agentId !== Ce.id || a.id !== "reviewLayerSelection") {
2619
+ if (a?.agentId !== Ce.id || a.id !== "reviewLayerSelection") {
2624
2620
  const n = {
2625
2621
  agentId: Ce.id,
2626
2622
  id: "reviewLayerSelection",
@@ -3034,7 +3030,7 @@ async function ye(e, t, r, a, o) {
3034
3030
  { text: `Periodically requesting status of job from ArcGIS AI Services${"...".substring(0, h)}` },
3035
3031
  a
3036
3032
  ), h = h % 3 + 1;
3037
- const y = await Se(`${r}/chat`, {
3033
+ const g = await Se(`${r}/chat`, {
3038
3034
  method: "post",
3039
3035
  body: JSON.stringify({
3040
3036
  conversationId: s.data.conversationId,
@@ -3046,17 +3042,17 @@ async function ye(e, t, r, a, o) {
3046
3042
  token: ve.findCredential(_.getDefault().url)?.token ?? ""
3047
3043
  }
3048
3044
  });
3049
- if (y.httpStatus !== 200)
3050
- throw new Error(`Graph query service polling returned an error: ${y.httpStatus}`, {
3051
- cause: y.data
3045
+ if (g.httpStatus !== 200)
3046
+ throw new Error(`Graph query service polling returned an error: ${g.httpStatus}`, {
3047
+ cause: g.data
3052
3048
  });
3053
- if (y.data.context)
3054
- u = y.data.context.graphQuery, p = y.data.message || "";
3055
- else if (!y.data.hasMore)
3049
+ if (g.data.context)
3050
+ u = g.data.context.graphQuery, p = g.data.message || "";
3051
+ else if (!g.data.hasMore)
3056
3052
  i = !0;
3057
3053
  else if (Date.now() - c > 6e4)
3058
3054
  throw new Error("Graph query service polling timed out after 1 minute.");
3059
- d = y.data.sequenceNumber;
3055
+ d = g.data.sequenceNumber;
3060
3056
  }
3061
3057
  return { graphQuery: u, explanation: p };
3062
3058
  }
@@ -3089,14 +3085,14 @@ const Pn = async ({
3089
3085
  try {
3090
3086
  const h = await _t(e, t, o);
3091
3087
  i = h.resultHeader;
3092
- const y = h.resultRowsStream.getReader();
3088
+ const g = h.resultRowsStream.getReader();
3093
3089
  let w = 0;
3094
- const g = Date.now(), f = !1;
3090
+ const y = Date.now(), f = !1;
3095
3091
  for (; ; ) {
3096
- const { done: x, value: E } = await y.read();
3092
+ const { done: x, value: E } = await g.read();
3097
3093
  if (x)
3098
3094
  break;
3099
- if (!f && s && Date.now() - g > s)
3095
+ if (!f && s && Date.now() - y > s)
3100
3096
  return d.abort(), { type: "timeout" };
3101
3097
  for (const T of E) {
3102
3098
  if (w++, n && w > n)
@@ -3150,7 +3146,7 @@ async function tt({
3150
3146
  requestOptions: n,
3151
3147
  queryRowLimit: s,
3152
3148
  queryTimeoutMs: i
3153
- }), y = h.type === "aborted" ? "Query execution was aborted." : h.type === "timeout" ? "Query execution timed out." : h.type === "error" ? `Query failed with error: ${h.errorMessage}` : "";
3149
+ }), g = h.type === "aborted" ? "Query execution was aborted." : h.type === "timeout" ? "Query execution timed out." : h.type === "error" ? `Query failed with error: ${h.errorMessage}` : "";
3154
3150
  if (h.type === "success")
3155
3151
  return {
3156
3152
  type: "success",
@@ -3163,29 +3159,29 @@ async function tt({
3163
3159
  if (h.type === "aborted")
3164
3160
  return {
3165
3161
  type: "aborted",
3166
- errorMessage: y,
3162
+ errorMessage: g,
3167
3163
  graphQuery: p.graphQuery,
3168
3164
  explanation: p.explanation
3169
3165
  };
3170
3166
  if (u >= z)
3171
3167
  return h.type === "timeout" ? {
3172
3168
  type: "timeout",
3173
- errorMessage: y,
3169
+ errorMessage: g,
3174
3170
  graphQuery: p.graphQuery,
3175
3171
  explanation: p.explanation
3176
3172
  } : {
3177
3173
  type: "execution-error",
3178
- errorMessage: y,
3174
+ errorMessage: g,
3179
3175
  error: h.error,
3180
3176
  graphQuery: p.graphQuery,
3181
3177
  explanation: p.explanation
3182
3178
  };
3183
3179
  d = {
3184
3180
  failedGraphQuery: p.graphQuery,
3185
- executionError: y,
3181
+ executionError: g,
3186
3182
  attemptCount: u
3187
3183
  }, await m(
3188
- { text: `Attempt ${u} failed with error: ${y}. Retrying...` },
3184
+ { text: `Attempt ${u} failed with error: ${g}. Retrying...` },
3189
3185
  c
3190
3186
  );
3191
3187
  }
@@ -3210,7 +3206,7 @@ const Gn = async ({
3210
3206
  const u = c - s.length;
3211
3207
  if (u <= 0)
3212
3208
  break;
3213
- const y = (await Dt(
3209
+ const g = (await Dt(
3214
3210
  e,
3215
3211
  new jt({
3216
3212
  searchQuery: t,
@@ -3222,8 +3218,8 @@ const Gn = async ({
3222
3218
  )).resultRowsStream.getReader();
3223
3219
  let w = !1;
3224
3220
  for (; !w; ) {
3225
- const { done: g, value: f } = await y.read();
3226
- if (g) {
3221
+ const { done: y, value: f } = await g.read();
3222
+ if (y) {
3227
3223
  w = !0;
3228
3224
  break;
3229
3225
  }
@@ -3302,8 +3298,8 @@ async function Bn(e, t, r, a, o) {
3302
3298
  graphQueryServiceUrl: r,
3303
3299
  targetStructure: /* @__PURE__ */ new Map(),
3304
3300
  targetStructureReducer: (p, h) => {
3305
- for (const y of h)
3306
- On(y, p);
3301
+ for (const g of h)
3302
+ On(g, p);
3307
3303
  return p;
3308
3304
  },
3309
3305
  requestOptions: {
@@ -3342,10 +3338,10 @@ const rt = "addRecords", Hn = l.object({
3342
3338
  const { knowledgeGraph: r } = await O(t), a = re(t), { view: o } = a, s = _.getDefault().helperServices;
3343
3339
  let i = e;
3344
3340
  if (H(o)) {
3345
- const d = o.map, { allNamedTypesFullyDynamic: u, idTypePairs: p, dynamicTypes: h } = Un(d), y = await R("arcgis_knowledge_current_map_context");
3341
+ const d = o.map, { allNamedTypesFullyDynamic: u, idTypePairs: p, dynamicTypes: h } = Un(d), g = await R("arcgis_knowledge_current_map_context");
3346
3342
  if (i = `${e}
3347
3343
 
3348
- ${y}${JSON.stringify(p)} and all entities or relationships with the the following typeNames in the array: ${JSON.stringify(h)}`, u)
3344
+ ${g}${JSON.stringify(p)} and all entities or relationships with the the following typeNames in the array: ${JSON.stringify(h)}`, u)
3349
3345
  throw new Error(
3350
3346
  "No records have been added to the map because all data in the knowledge graph is contained in the map."
3351
3347
  );
@@ -3522,7 +3518,7 @@ DESCRIPTIVE COLUMN NAMES: If the user's prompt does not explicitly request for s
3522
3518
  kg: r,
3523
3519
  graphQueryServiceUrl: `${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,
3524
3520
  targetStructure: new Array(),
3525
- targetStructureReducer: (h, y) => (h.push(y), h),
3521
+ targetStructureReducer: (h, g) => (h.push(g), h),
3526
3522
  requestOptions: {
3527
3523
  signal: t?.signal,
3528
3524
  timeout: t?.timeout
@@ -3535,9 +3531,9 @@ DESCRIPTIVE COLUMN NAMES: If the user's prompt does not explicitly request for s
3535
3531
  }
3536
3532
  const { graphQuery: s, processedResult: i, resultHeader: c } = n, d = c.headerKeys;
3537
3533
  for (const h of i)
3538
- for (const y of h)
3534
+ for (const g of h)
3539
3535
  j(
3540
- y,
3536
+ g,
3541
3537
  (w) => et(w)
3542
3538
  );
3543
3539
  const u = 50, p = i.slice(0, u).map((h) => JSON.stringify(h));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/ai-agents",
3
- "version": "5.1.0-next.105",
3
+ "version": "5.1.0-next.107",
4
4
  "description": "ArcGIS AI Agents Package",
5
5
  "homepage": "https://developers.arcgis.com/javascript/latest/",
6
6
  "type": "module",
@@ -20,7 +20,7 @@
20
20
  "@langchain/langgraph": "^1.2.6",
21
21
  "tslib": "^2.8.1",
22
22
  "zod": "^4.3.6",
23
- "@arcgis/ai-orchestrator": "5.1.0-next.105"
23
+ "@arcgis/ai-orchestrator": "5.1.0-next.107"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "@arcgis/core": "^5.1.0-next"