@arcgis/ai-components 5.2.0-next.4 → 5.2.0-next.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-utils/LLMAgent.js +22 -22
- package/dist/cdn/{YY2SBO3V.js → 3NI46YCE.js} +1 -1
- package/dist/cdn/{V5YEZSRY.js → 47FWPQ2A.js} +1 -1
- package/dist/cdn/{FHVXO2WG.js → AEJHYRGT.js} +4 -4
- package/dist/cdn/{JY6LLOUJ.js → BFZJNJL6.js} +1 -1
- package/dist/cdn/{MDVYQQUG.js → GCQLVNNC.js} +1 -1
- package/dist/cdn/{GSEPHN3A.js → JV4SI65E.js} +31 -29
- package/dist/cdn/R6HV42YW.js +3 -0
- package/dist/cdn/{S6W6HV4T.js → V7OJRG26.js} +1 -1
- package/dist/cdn/{4HU7735A.js → VOQX4AVB.js} +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/cdn/main.css +1 -1
- package/dist/chunks/adapter.js +6 -6
- package/dist/chunks/generateLayerDescriptions.js +236 -208
- package/dist/chunks/orchestrator.js +240 -201
- package/dist/components/arcgis-assistant-chat/customElement.d.ts +6 -1
- package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +2 -1
- package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-message/customElement.d.ts +21 -0
- package/dist/components/arcgis-assistant-message/index.d.ts +1 -0
- package/dist/components/arcgis-assistant-message-block/customElement.d.ts +1 -1
- package/dist/components/arcgis-assistant-message-feedback/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-message-footer/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-message-log/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-message-read-aloud/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-message-text/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-speech-input/customElement.d.ts +6 -1
- package/dist/components/arcgis-assistant-suggested-prompts/customElement.d.ts +4 -1
- package/dist/components/arcgis-assistant-user-message/customElement.d.ts +4 -1
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/types/lumina.d.ts +5 -0
- package/dist/types/preact.d.ts +6 -0
- package/dist/types/react.d.ts +7 -0
- package/dist/types/stencil.d.ts +5 -0
- package/dist/utils/index.d.ts +10 -14
- package/dist/utils/index.js +68 -78
- package/package.json +5 -5
- package/dist/cdn/ON2V5XI2.js +0 -3
|
@@ -16,10 +16,10 @@ import { convertToLangChainMiddlewares as l } from "./middlewares/middleware.js"
|
|
|
16
16
|
import { c as y } from "../chunks/graph.js";
|
|
17
17
|
import { c as T } from "../chunks/state.js";
|
|
18
18
|
import { c as d, h as M, g as x } from "../chunks/utils.js";
|
|
19
|
-
var P = Object.defineProperty, b = Object.getOwnPropertyDescriptor, n = (t,
|
|
20
|
-
for (var o = e > 1 ? void 0 : e ? b(
|
|
21
|
-
(i = t[p]) && (o = (e ? i(
|
|
22
|
-
return e && o && P(
|
|
19
|
+
var P = Object.defineProperty, b = Object.getOwnPropertyDescriptor, n = (t, r, s, e) => {
|
|
20
|
+
for (var o = e > 1 ? void 0 : e ? b(r, s) : r, p = t.length - 1, i; p >= 0; p--)
|
|
21
|
+
(i = t[p]) && (o = (e ? i(r, s, o) : i(o)) || o);
|
|
22
|
+
return e && o && P(r, s, o), o;
|
|
23
23
|
};
|
|
24
24
|
let a = class extends v {
|
|
25
25
|
//#region Lifecycle
|
|
@@ -53,52 +53,52 @@ let a = class extends v {
|
|
|
53
53
|
generate() {
|
|
54
54
|
const t = T(this.getSchemas());
|
|
55
55
|
this._set("workspace", t);
|
|
56
|
-
const
|
|
56
|
+
const r = this.id, s = { [r]: this._invoke.bind(this) }, e = [{ from: r, decide: () => {
|
|
57
57
|
} }];
|
|
58
58
|
this._set(
|
|
59
59
|
"createGraph",
|
|
60
|
-
() => y(
|
|
60
|
+
() => y(s, e, t, {
|
|
61
61
|
agent: this,
|
|
62
|
-
entryNode:
|
|
62
|
+
entryNode: r,
|
|
63
63
|
middlewares: this.middlewares
|
|
64
64
|
})
|
|
65
65
|
);
|
|
66
66
|
}
|
|
67
67
|
//#endregion
|
|
68
68
|
//#region Private Methods
|
|
69
|
-
async _invoke(t,
|
|
69
|
+
async _invoke(t, r) {
|
|
70
70
|
try {
|
|
71
|
-
return this.outputSchema ? await this._invokeStructured(t,
|
|
72
|
-
} catch (
|
|
73
|
-
if (f(
|
|
74
|
-
throw
|
|
75
|
-
const e =
|
|
71
|
+
return this.outputSchema ? await this._invokeStructured(t, r) : await this._invokeUnstructured(t, r);
|
|
72
|
+
} catch (s) {
|
|
73
|
+
if (f(s))
|
|
74
|
+
throw s;
|
|
75
|
+
const e = s instanceof Error ? s.message : String(s);
|
|
76
76
|
return d({ outputMessage: e }, "failed", e);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
async _invokeStructured(t,
|
|
79
|
+
async _invokeStructured(t, r) {
|
|
80
80
|
if (!this.outputSchema)
|
|
81
81
|
throw new Error("Output schema is required for structured invocation.");
|
|
82
82
|
const e = await h({
|
|
83
|
-
model: await u(this.modelTier),
|
|
83
|
+
model: await u({ modelTier: this.modelTier }),
|
|
84
84
|
systemPrompt: await this._getPromptWithInputVariables(t),
|
|
85
85
|
tools: this._getTools(),
|
|
86
86
|
checkpointer: !0,
|
|
87
87
|
middleware: l(this.middlewares),
|
|
88
88
|
responseFormat: this.outputSchema
|
|
89
|
-
}).invoke({ messages: t.agentExecutionContext.messages },
|
|
89
|
+
}).invoke({ messages: t.agentExecutionContext.messages }, r);
|
|
90
90
|
if (!("structuredResponse" in e) || e.structuredResponse === void 0)
|
|
91
91
|
throw new Error("LLMAgent did not receive structured output from createAgent.");
|
|
92
92
|
return M(e.structuredResponse, this.outputSchema, e.messages);
|
|
93
93
|
}
|
|
94
|
-
async _invokeUnstructured(t,
|
|
94
|
+
async _invokeUnstructured(t, r) {
|
|
95
95
|
const o = (await h({
|
|
96
|
-
model: await u(this.modelTier),
|
|
96
|
+
model: await u({ modelTier: this.modelTier }),
|
|
97
97
|
systemPrompt: await this._getPromptWithInputVariables(t),
|
|
98
98
|
tools: this._getTools(),
|
|
99
99
|
checkpointer: !0,
|
|
100
100
|
middleware: l(this.middlewares)
|
|
101
|
-
}).invoke({ messages: t.agentExecutionContext.messages },
|
|
101
|
+
}).invoke({ messages: t.agentExecutionContext.messages }, r)).messages, i = o.at(-1)?.content ?? "", c = typeof i == "string" ? i : JSON.stringify(i), g = c.trim() || "LLMAgent completed.";
|
|
102
102
|
return d(
|
|
103
103
|
{ agentExecutionContext: { ...t.agentExecutionContext, messages: o }, outputMessage: c },
|
|
104
104
|
"success",
|
|
@@ -106,10 +106,10 @@ let a = class extends v {
|
|
|
106
106
|
);
|
|
107
107
|
}
|
|
108
108
|
async _getPromptWithInputVariables(t) {
|
|
109
|
-
const
|
|
109
|
+
const r = x(t, this.inputSchema);
|
|
110
110
|
for (const { outputKey: e } of this.middlewares)
|
|
111
|
-
e && (
|
|
112
|
-
return await S.fromTemplate(this.prompt).format(
|
|
111
|
+
e && (r[String(e)] = t[e]);
|
|
112
|
+
return await S.fromTemplate(this.prompt).format(r);
|
|
113
113
|
}
|
|
114
114
|
_getTools() {
|
|
115
115
|
return this.tools?.map((t) => t.getTool()) ?? [];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import a from"./
|
|
2
|
+
import a from"./JV4SI65E.js";export default $arcgis.t(([,,,,,{f:t}])=>{var y=async(o,r)=>{let i=o.tool_calls??[];if(i.length===0){await t({text:`LLM did not request any tool calls: ${String(o?.content)}`},r);return}await Promise.all(i.map(async a=>await t({text:`LLM invoked ${a.name} tool with arguments: ${JSON.stringify(a.args,null,2)}`},r)))};return y},"identity/IdentityManager","portal/Portal","core/reactiveUtils","layers/FeatureLayer","request",a)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import d from"./
|
|
2
|
+
import d from"./3NI46YCE.js";import c from"./AEJHYRGT.js";import a from"./JV4SI65E.js";import{Fb as k,Q as V,a as N,b as E}from"./462JBSEV.js";import{a as D,c as O}from"./HB5A5R2E.js";import"./AMP6IALT.js";import"./OAVEHGB6.js";import{v as b,y as A}from"./OH64RMOR.js";import"./YIMNOUTF.js";export default $arcgis.t(([,,,,,,,,,,K,X,,,{f:n,l:z,n:T},{C:R,D:G,E:L,F:P,G:F,H:U,a:j,m:S,n:M,o:p,p:Q},C])=>{var Y=async(e,t)=>(await n({text:"Exiting Data Exploration agent"},t),e),Z=async(e,t)=>{await n({text:"Requesting LLM for layer filter results"},t);let a=await S("data_explore_filter_prompt");if(!t?.configurable)throw new Error("config.configurable is required for layer filter tools");let{userTimezone:c,userTimezoneOffset:l}=L(),s={layerFieldInfo:e.layerFieldInfo,userTimezone:c,userTimezoneOffset:l,queryResponse:e.queryResponse,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},r=await T({promptText:a,modelTier:"advanced",messages:e.dataExplorationMessages,inputVariables:s,tools:F}),i=[...e.dataExplorationMessages,r];if(!((r.tool_calls?.length??0)>0))return await n({text:"LLM determined no filter changes needed"},t),{...e,dataExplorationMessages:i};let u=[...i,r],o=r.content.toString();return await C(r,t),{...e,dataExplorationMessages:u,outputMessage:o}},ee=async(e,t)=>{await n({text:"Requesting LLM for layer query results"},t);let a=await S("data_explore_query_prompt");if(!t?.configurable)throw new Error("config.configurable is required for layer query tools");let{userTimezone:c,userTimezoneOffset:l}=L(),s=e.agentExecutionContext.sharedState.lastNavigatedFeatures,r=s&&typeof s=="object"&&"value"in s?s.value:s,i="none";if(r!=null)try{i=JSON.stringify(r)}catch{i="none"}let u={layerFieldInfo:e.layerFieldInfo,userTimezone:c,userTimezoneOffset:l,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps,lastNavigatedFeatures:i},o=await T({promptText:a,modelTier:"advanced",messages:e.dataExplorationMessages,inputVariables:u,tools:P}),m=o.content.toString();return await C(o,t),{...e,dataExplorationMessages:[...e.dataExplorationMessages,o],outputMessage:m,status:"success",summary:m?M(m):"Query executed."}},te=async(e,t)=>{try{await n({text:"Requesting LLM for summary on query results"},t);let a=await S("summarize_query_response_prompt"),c={queryResponse:e.queryResponse,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},l=await z({promptText:a,modelTier:"fast",messages:e.dataExplorationMessages,inputVariables:c}),s=typeof l=="string"?l:l.content,r=new V(s);await n({text:`Received response from LLM: ${s}`},t);let i=s;return{...e,outputMessage:i,status:"success",summary:i?M(i):"Summary generated.",dataExplorationMessages:[...e.dataExplorationMessages,r]}}catch(a){throw await n({text:"Error during filter LLM request"},t),new Error(`Error during filter LLM request: ${a instanceof Error?a.message:String(a)}`)}};async function ae(e,t){let a=await new j(F).invoke({messages:e.dataExplorationMessages},t);return await n({text:`Finished executing layer filter tool: ${a.messages.map(c=>c.content).join(", ")}`},t),{...e}}var se=10,re=["string","small-integer","integer"],ie=async(e,t,{includeSummaryStatistics:a=!0,includeUniqueValues:c=!0}={})=>{let l=null,s=null;try{if(t.type!=="geometry"&&t.type!=="oid"&&t.type!=="global-id"){a&&(l=await K({layer:e,field:t.name}));let r=t.domain?.type==="coded-value"?t.domain:null;c&&(re.includes(t.type)||r)&&(s=(await X({layer:e,field:t.name})).uniqueValueInfos.sort((i,u)=>u.count-i.count).slice(0,se),r&&(s=s.map(i=>({...i,value:r.getName(i.value)??i.value}))))}}catch(r){console.error(`Error fetching statistics for field ${t.name}:`,r)}return{summaryStatistics:l,uniqueValues:s}};function oe(e,t){return["string","small-integer","integer"].includes(e)||t==="coded-value"}async function ne(e,t,a,c=!0){let l=[],s=[],r=[];for(let i of e){let u=function(g){let d=t.get(g)?.layerItem;return d?[d.name&&`Name: ${d.name}`,d.title&&`Title: ${d.title}`,d.description&&`Description: ${d.description}`].filter(Boolean).join(" | "):g},{layerId:o,results:m}=i,f=a.map?.allLayers.find(g=>g.id===o),w=t.get(o)?.fieldRegistry;if(!w)continue;let h=l.find(g=>g.layerId===o);h||(h={layerId:o,layerSummary:u(o),fieldInfos:[]},l.push(h));for(let g of m){let d=w.get(g.name);if(!d)continue;let y=d.statistics,v=c&&!y?.summaryStatistics,q=oe(d.type,d.domain?.type)&&!y?.uniqueValues,_=v||q;if(r.push({layerId:o,fieldName:d.name,didFetchStatistics:_}),_){let J=ie(f,d,{includeSummaryStatistics:v,includeUniqueValues:q}).then($=>{let x={summaryStatistics:y?.summaryStatistics??null,uniqueValues:y?.uniqueValues??null};v&&(x.summaryStatistics=$.summaryStatistics),q&&(x.uniqueValues=$.uniqueValues),w.set(d.name,{...d,statistics:x}),d.statistics=x});s.push(J)}h.fieldInfos.push(d)}}return await Promise.all(s),{layerFieldInfo:l,didFetchStatistics:s.length>0,fieldStatisticsFetchStatus:r}}var W=/\b(average|avg|mean|median|max(?:imum)?|min(?:imum)?|sum|total|count|std(?:dev|\s*deviation)|variance|null\s*count|missing\s*values?|range)\b/iu;function le(e,t){return W.test(e)||W.test(t)}var de=async(e,t)=>{try{await n({text:"Preparing field information for vector search results"},t);let a=p(t,"layersAndFieldsRegistry"),{mapView:c}=G(t),{assignedTask:l,userRequest:s}=e.agentExecutionContext,r=le(l,s),{layerFieldInfo:i,didFetchStatistics:u,fieldStatisticsFetchStatus:o}=await ne(e.vectorSearchFieldResults,a,c,r);u?await n({text:"Statistics fetched"},t):await n({text:"Statistics skipped"},t);for(let m of o)await n({text:` - ${m.fieldName} - stats ${m.didFetchStatistics?"fetched":"skipped"}`},t);return await n({text:"Field information prepared"},t),{...e,layerFieldInfo:i}}catch(a){throw await n({text:"Error during fetching statistics"},t),new Error(`Error during fetching statistics: ${a instanceof Error?a.message:String(a)}`)}},B=.7,ce=10,ue=async(e,t)=>{try{await n({text:"Similarity search to find fields"},t);let a=p(t,"fieldSearch"),c=p(t,"layersAndFieldsRegistry"),l=p(t,"embeddingCache"),s=await a.searchFields({text:e.agentExecutionContext.assignedTask,layerIds:e.vectorSearchLayerIds,minScore:B,topResults:ce,embeddingCache:l}),r=s.map(({layerId:u,results:o})=>{let m=o.map(f=>` - ${f.name} (${f.score.toFixed(2)})`).join(`
|
|
3
3
|
`);return`${c.get(u)?.layerItem.name??u}:
|
|
4
4
|
${m}`}).join(`
|
|
5
5
|
`),i;return s.length>0?i=`Vector search completed. Matching layers and fields with scores:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import a from"./
|
|
2
|
+
import a from"./JV4SI65E.js";import{Bb as j,L as q,M as ee,R as z,Za as I,_a as h,g as ge,j as V,k as Q,kb as g,qb as be,u as we}from"./462JBSEV.js";export default $arcgis.t(([$e,M,Ce,,Ne,oe,tt,{addressToLocations:rt},ot,at,Re,{createRenderer:nt},{getSchemesByTag:it,getSchemes:st},{getBackgroundColorTheme:ke},{createAgeRenderer:lt,createContinuousRenderer:ct},{getSchemesByTag:pe},{createContinuousRenderer:ut},{createRenderer:dt},{getSchemesByTag:pt},{createRenderer:mt},{getSchemesByTag:ht},{createRenderer:ft},{getSchemesByTag:yt},{createRenderer:gt},{getSchemesByTag:wt},{createAgeRenderer:bt,createContinuousRenderer:vt},{createRenderer:Tt},{getSchemesByTag:St},xt,_e,qe,{formatDateOnly:Et,convertDateFormatToIntlOptions:U,formatTimeOnly:It,formatDate:Fe},$t,Nt,kt,Ft,Mt,ze,,{fetchKnowledgeGraph:Me,executeQueryStreaming:At,executeSearchStreaming:Ct},Rt,{a:i,c:L,d:ve,f:T,g:S,m:Te}])=>{var Ie=e=>Array.isArray(e)&&e.every(q),Ze=e=>typeof e=="object"&&e!=null&&"messages"in e&&Ie(e.messages),Ye=e=>typeof e=="object"&&e!=null&&"lg_tool_call"in e,B=class extends be{tools;handleToolErrors=!0;trace=!1;constructor(e,t){let{name:r,tags:o,handleToolErrors:a}=t??{};super({name:r,tags:o,func:(n,s)=>this.run(n,s)}),this.tools=e,this.handleToolErrors=a??this.handleToolErrors}async runTool(e,t){let r=this.tools.find(o=>o.name===e.name);try{if(r===void 0)throw new Error(`Tool "${e.name}" not found.`);let o=await r.invoke({...e,type:"tool_call"},t);return q(o)&&o.getType()==="tool"||Q(o)?o:new ee({status:"success",name:r.name,content:typeof o=="string"?o:JSON.stringify(o),tool_call_id:e.id})}catch(o){if(!this.handleToolErrors||we(o))throw o;return new ee({status:"error",content:`Error: ${o.message}
|
|
3
3
|
Please fix your mistakes.`,name:e.name,tool_call_id:e.id??""})}}async run(e,t){let r;if(Ye(e))r=[await this.runTool(e.lg_tool_call,t)];else{let n;if(Ie(e))n=e;else if(Ze(e))n=e.messages;else throw new Error("ToolNode only accepts BaseMessage[] or { messages: BaseMessage[] } as input.");let s=new Set(n.filter(u=>u.getType()==="tool").map(u=>u.tool_call_id)),l;for(let u=n.length-1;u>=0;u-=1){let c=n[u];if(z(c)){l=c;break}}if(l==null||!z(l))throw new Error("ToolNode only accepts AIMessages as input.");r=await Promise.all(l.tool_calls?.filter(u=>u.id==null||!s.has(u.id)).map(u=>this.runTool(u,t))??[])}if(!r.some(Q))return Array.isArray(e)?r:{messages:r};let o=[],a=null;for(let n of r)Q(n)?n.graph===V.PARENT&&Array.isArray(n.goto)&&n.goto.every(s=>ge(s))?a?a.goto.push(...n.goto):a=new V({graph:V.PARENT,goto:n.goto}):o.push(n):o.push(Array.isArray(e)?[n]:{messages:[n]});return a&&o.push(a),o}};var Fn=g.Root({llmInputMessages:g({reducer:(e,t)=>j([],t),default:()=>[]})});var O=(e,t)=>t??e,ji=g.Root({...ve(),intent:g({reducer:O}),vectorSearchLayerResults:g({reducer:O,default:()=>[]}),vectorSearchFieldResults:g({reducer:O}),navigationInternalState:g({reducer:O,default:()=>({toolCallMessage:void 0})})});async function _t(e,t){let r=M.getDefault().helperServices,o=r.geocode.find(d=>d.name==="ArcGIS World Geocoding Service")??r.geocode[0];if(!o)throw new Error("No geocoding service found in helperServices.");let a=o.url,n=`${oe.assetsPath?.endsWith("/")?oe.assetsPath:`${oe.assetsPath}/`}esri/images/search/search-symbol-32.png`,s=(await rt(a,{address:{SingleLine:e},outFields:["Match_addr"]}))?.[0];if(!s?.extent||!s.location)throw new Error(`Could not find location for: ${e}`);let l=new ot({url:n,width:24,height:24}),u=new tt({geometry:s.location,symbol:l});t.graphics.removeAll(),t.graphics.add(u),await t.goTo(s.extent);let c={address:s.address??"",location:s.location?s.location.toJSON():null,extent:s.extent?s.extent.toJSON():null};return{text:`Successfully zoomed to ${e}.`,sharedStatePatch:{lastResolvedLocation:{value:c}}}}var qt=["mapView"];function $(e){let t=e?.configurable?.context;if(!t||typeof t!="object")throw new Error("NavigationAgent context missing");let r=qt.filter(o=>!(o in t));if(r.length)throw new Error(`NavigationAgent context missing: ${r.join(", ")}`);return t}async function zt({address:e},t){let{mapView:r}=$(t);return await _t(e,r)}var jt=i.object({address:i.string().describe("The full address or place name to locate.")}),Li=h(zt,{name:"goToAddress",description:"Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",schema:jt});async function Lt(e,t){let r=t.map.bookmarks;if(!r||r.length===0)throw new Error("No bookmarks found in the map.");let o=r.find(n=>n.name===e);if(!o)throw new Error(`Bookmark with name "${e}" not found.`);let a=o.viewpoint;if(!a)throw new Error(`Bookmark with name "${e}" does not have a valid viewpoint.`);return await t.goTo(a),{text:`Navigated to bookmark: ${e}`}}async function Ot({bookmarkName:e},t){let{mapView:r}=$(t);return await Promise.resolve(Lt(e,r))}var Dt=I.object({bookmarkName:I.string().describe("The name of the bookmark to navigate to.")}),Oi=h(Ot,{name:"goToBookmark",description:"Go to the extent of the bookmark with the given name.",schema:Dt});async function Pt(e,t,r){let o=r.map?.allLayers.find(s=>s.id===e);if(!o)return{text:`Error: Layer with id ${e} not found`};let a=t?.trim()?t:"1=1",n=o.createQuery();n.where=a;try{let{extent:s,count:l}=await o.queryExtent(n);if(l===0)return{text:`No features found in ${o.title} matching: ${a}`,where:a};if(s)await r.goTo(s);else return{text:`Error: Unable to determine extent for ${o.title}`,where:a};let u={layerId:e,layerTitle:o.title??e,where:a,count:l};return{text:`Successfully zoomed to ${l} feature(s) in ${o.title} matching: ${a}`,where:a,sharedStatePatch:{lastNavigatedFeatures:{value:u}}}}catch(s){return console.error("Error in goToFeatures:",s),{text:`Error: ${s instanceof Error?s.message:"Unknown error"}`,where:a}}}async function Gt({layerId:e,where:t},r){let{mapView:o}=$(r);return await Pt(e,t,o)}var Vt=I.object({layerId:I.string().describe("The layerId of the layer to zoom to."),where:I.string().describe("The sql-92 where clause used to query features to zoom to")}),Di=h(Gt,{name:"goToFeatures",description:"Go to the features that match the given filter related to the given layerId.",schema:Vt});async function Qt(e){let t=new at({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:{wkid:4326}}).expand(.7);return await e.goTo(t),{text:"Successfully zoomed to world extent"}}async function Bt(e,t){let{mapView:r}=$(t);return await Qt(r)}var Ut=I.object({}),Pi=h(Bt,{name:"goToFullExtent",description:"Zooms the map to the full world extent using Esri's Geocoding Service.",schema:Ut});async function Kt(e){let t=e.map.initialViewProperties?.viewpoint?.targetGeometry;if(t)await e.goTo(t);else throw new Error("Initial extent is undefined");return{text:"Successfully zoomed to home extent"}}async function Wt(e,t){let{mapView:r}=$(t);return await Kt(r)}var Ht=i.object({}),Gi=h(Wt,{name:"goToHomeExtent",description:"Go to the initial web map view extent",schema:Ht});async function Jt(e,t){await t.when();let r=t.map?.allLayers.find(a=>a.id===e);if(!r)return console.warn(`[goToLayer] No matching FeatureLayer found for: ${e}`),{text:`Could not find layer for: ${e}`};let o;return(r.type==="link-chart"||r.type==="knowledge-graph-sublayer")&&t.map?.activeLinkChartLayer?o=t.map.diagramNodesExtent:o=r.fullExtent,o?(await t.goTo(o),r.visible=!0,{text:`Successfully zoomed to: ${r.title??""}`}):{text:"Layer has no defined extent. Cannot zoom to layer."}}async function Zt({layerId:e},t){let{mapView:r}=$(t);return await Jt(e,r)}var Yt=I.object({layerId:I.string().describe("The id of the layer to navigate to")}),Vi=h(Zt,{name:"goToLayer",description:"Zooms the map view to the full extent of the top matching layer.",schema:Yt});async function Xt(e,t){return await t.goTo({scale:e}),{text:`Successfully zoomed to: ${e}`}}async function er({scale:e},t){let{mapView:r}=$(t);return await Xt(e,r)}var tr=i.object({scale:i.number().describe("The map scale of the view to go to.")}),Qi=h(er,{name:"goToScale",description:"Go to the specified view scale.",schema:tr});async function rr(e,t,r){let o={target:new Re({longitude:e.longitude,latitude:e.latitude,spatialReference:{wkid:4326}})};return r?.zoom!==void 0&&(o.zoom=r.zoom),r?.scale!==void 0&&(o.scale=r.scale),await t.goTo(o),{text:`Successfully navigated to: ${[`(${e.latitude}\xB0, ${e.longitude}\xB0)`,r?.zoom!==void 0?`zoom ${r.zoom}`:"",r?.scale!==void 0?`scale 1:${r.scale}`:""].filter(Boolean).join(", ")}`}}async function or({center:e,zoom:t,scale:r},o){let{mapView:a}=$(o);return await rr(e,a,{zoom:t,scale:r})}var ar=i.object({center:i.object({longitude:i.number().describe("The longitude (x-coordinate) of the point to navigate to."),latitude:i.number().describe("The latitude (y-coordinate) of the point to navigate to.")}),zoom:i.number().optional().describe("The zoom level. Higher values = more zoomed in."),scale:i.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")}),Bi=h(or,{name:"goToViewpoint",description:"Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",schema:ar});async function nr(e,t){return await t.goTo({zoom:e}),{text:`Successfully zoomed to: ${e}`}}async function ir({zoom:e},t){let{mapView:r}=$(t);return await nr(e,r)}var sr=i.object({zoom:i.number().min(1).max(20).describe("The zoom level of the view to go to.")}),Ui=h(ir,{name:"goToZoom",description:'Go to the specified zoom level. If input is generic (e.g. "zoom in", then only zoom to the next appropriate level - increase level for zooming in and decrease for zooming out.).',schema:sr}),Ae=Object.assign({"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_lc_context.md":()=>import("./KMQ3SP4I.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_map_context.md":()=>import("./5QAHYX7Y.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_lucene_generation_prompt.md":()=>import("./5ZZGKP7N.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_summarize_result_prompt.md":()=>import("./AXDZBBNL.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_tool_prompt.md":()=>import("./ZS2TZ6BF.js").then(e=>e.default),"../agents/dataExploration/prompts/data_explore_filter_prompt.md":()=>import("./LQ6R5YRN.js").then(e=>e.default),"../agents/dataExploration/prompts/data_explore_query_prompt.md":()=>import("./X2ZDYHCG.js").then(e=>e.default),"../agents/dataExploration/prompts/summarize_query_response_prompt.md":()=>import("./ZLXN7NMF.js").then(e=>e.default),"../agents/help/prompts/help_prompt.md":()=>import("./F2AHA4GB.js").then(e=>e.default),"../agents/layerStyling/prompts/layer_styling_prompt.md":()=>import("./FX7UOGHP.js").then(e=>e.default),"../agents/navigation/prompts/navigation_intent_prompt.md":()=>import("./NE7E52YR.js").then(e=>e.default),"../agents/navigation/prompts/navigation_tool_prompt.md":()=>import("./6YMR4QSD.js").then(e=>e.default)});async function ne(e){let t=Object.entries(Ae).find(([r])=>r.endsWith(`/${e}.md`));if(!t)throw new Error(`Prompt not found: ${e}
|
|
4
4
|
Available prompts:
|
|
5
5
|
${Object.keys(Ae).join(`
|
|
@@ -115,11 +115,11 @@ ${l}
|
|
|
115
115
|
Explanation: ${u}`):(await n?.map?.allLayers.find(p=>p.type==="knowledge-graph")?.addRecords(d),`Map updated successfully. Cypher Query used:
|
|
116
116
|
${l}
|
|
117
117
|
|
|
118
|
-
Explanation: ${u}`)}var Be="addRecords",xa=i.object({prompt:i.string().describe("The user's inquiry into the knowledge graph that needs to be run.")}),Ea=async({prompt:e},t)=>{let{knowledgeGraph:r}=await G(t),o=X(t),{view:a}=o,n=M.getDefault().helperServices,s=e;if(C(a)){let u=a.map,
|
|
118
|
+
Explanation: ${u}`)}var Be="addRecords",xa=i.object({prompt:i.string().describe("The user's inquiry into the knowledge graph that needs to be run.")}),Ea=async({prompt:e},t)=>{let{knowledgeGraph:r}=await G(t),o=X(t),{view:a}=o,n=M.getDefault().helperServices,s=e;if(!C(a)&&a.map){let u=a.map,c=await ne("arcgis_knowledge_current_lc_context"),d=va(u,r);s=`${e}
|
|
119
119
|
|
|
120
|
-
${
|
|
120
|
+
${c}${JSON.stringify(d)}`}else{let u=a.map,{allNamedTypesFullyDynamic:c,idTypePairs:d,dynamicTypes:p}=Ta(u),m=await ne("arcgis_knowledge_current_map_context");if(s=`${e}
|
|
121
121
|
|
|
122
|
-
${
|
|
122
|
+
${m}${JSON.stringify(d)} and all entities or relationships with the the following typeNames in the array: ${JSON.stringify(p)}`,c)throw new Error("No records have been added to the map because all data in the knowledge graph is contained in the map.")}let l=await Sa(s,r,`${n.aiAssistantServices.url}${n.aiAssistantServices.graphQueryAssistant}`,o,t);return{toolName:Be,status:"success",summary:l}},hs=h(Ea,{name:Be,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.",schema:xa});async function Ia(e,t){return await t.map?.applyLayout(e),await Y(t),`Successfully applied layout: ${e}.`}var ue="applyLayout",$a=i.object({layout:i.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")}),Na=async({layout:e},t)=>{let{view:r}=X(t);if(C(r))return{toolName:ue,status:"error",errorMessage:"The applyLayout tool can only be used with a LinkChartView.",error:new Error};{let o=await Ia(e,r);return{toolName:ue,status:"success",summary:o}}},fs=h(Na,{name:ue,description:"Apply a diagram layout to the link chart",schema:$a});async function ka(e,t){return t.map?.changeNonspatialDataDisplay(e),await Y(t),`Successfully applied nonspatial visibility setting: ${e}.`}var de="changeNonspatialVisibility",Fa=i.object({setting:i.enum(["hidden","visible"]).describe("The setting of nonspatial visibility")}),Ma=async({setting:e},t)=>{let{view:r}=X(t);if(C(r))return{toolName:de,status:"error",errorMessage:"The changeNonspatialVisibility tool can only be used with a LinkChartView.",error:new Error};{let o=await ka(e,r);return{toolName:de,status:"success",summary:o}}},ys=h(Ma,{name:de,description:"Change whether or not nonspatial data is visible in the link chart. The value must be either 'hidden' or 'visible'.",schema:Fa});async function Aa(e,t,r,o,a){let n;for(let s=1;s<=F;s++){let{graphQuery:l,explanation:u}=await fe(e,t.dataModel,r,a,n);try{await T({text:`Attempting to create link chart from derived query: ${l}`},a);let c=await Mt.fromCypherQuery(t,new ze({openCypherQuery:l}));await T({text:"Link chart created successfully, loading..."},a),await c.load();let d=o.map;return o.map=c,await o.when(),await Ce.whenOnce(()=>!o.updating),c.entityCount===0&&c.relationshipCount===0?(o.map===c&&(o.map=d),c.destroy(),{type:"error",message:`Query returned no results. Cypher Query used to create the link chart:
|
|
123
123
|
${l}
|
|
124
124
|
|
|
125
125
|
Explanation: ${u}`}):(await Y(o),{type:"success",message:`Link chart created successfully. Cypher Query used to create the link chart:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import b from"./
|
|
2
|
+
import b from"./AEJHYRGT.js";import a from"./JV4SI65E.js";import{Fb as f,a as h,b as l}from"./462JBSEV.js";import{a as y,c as E}from"./HB5A5R2E.js";import"./AMP6IALT.js";import"./OAVEHGB6.js";import{v as u,y as d}from"./OH64RMOR.js";import"./YIMNOUTF.js";export default $arcgis.t(([,,,,,,,,,,,,,,,{f:p,n:x},{I:c,J:H,a:S,m:_,n:w,o:m,p:v}])=>{var C=[H],b=e=>{if(!e||e.size===0)return"No layers available in this map.";let t=Array.from(e.values()).map(({layerItem:o,fieldRegistry:a},s)=>{let r=Array.from(a.values()).map(n=>n.name).slice(0,10).join(", "),i=a.size>10?` (and ${a.size-10} more)`:"";return`${s+1}. "${o.title}". Description: ${o.description}
|
|
3
3
|
Fields: ${r}${i}`}).join(`
|
|
4
4
|
|
|
5
5
|
`);return`This map contains ${e.size} layer(s):
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import c from"./
|
|
2
|
+
import c from"./3NI46YCE.js";import b from"./AEJHYRGT.js";import a from"./JV4SI65E.js";import{Fb as I,a as w,b as h,q as E}from"./462JBSEV.js";import{a as v,c as F}from"./HB5A5R2E.js";import"./AMP6IALT.js";import"./OAVEHGB6.js";import{v as x,y as S}from"./OH64RMOR.js";import"./YIMNOUTF.js";export default $arcgis.t(([,,,,,,,,,,,,,,,{f:n,n:L},{A:z,B:u,a:$,m:C,o:y,p:N,q:A,r:R,s:T,t:b,u:_,v:V,w:q,x:j,y:k,z:M},D])=>{var B=.7,P=10,J=async(t,r)=>{try{await n({text:"Similarity search to find fields"},r);let e=y(r,"fieldSearch"),i=y(r,"layersAndFieldsRegistry"),o=y(r,"embeddingCache"),a=await e.searchFields({text:t.agentExecutionContext.assignedTask,layerIds:t.vectorSearchLayerIds,minScore:B,topResults:P,embeddingCache:o}),m=a.map(({layerId:c,results:d})=>{let g=d.map(s=>` - ${s.name} (${s.score.toFixed(2)})`).join(`
|
|
3
3
|
`);return`${i.get(c)?.layerItem.name??c}:
|
|
4
4
|
${g}`}).join(`
|
|
5
5
|
`),l;return a.length>0?l=`Vector search completed. Matching layers and fields with scores:
|