@arcgis/ai-components 5.0.0-next.172 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/{L5SDXDWS.js → 2NGJKVKI.js} +2 -0
- package/dist/cdn/{XJBDOKVO.js → 3NUCOIH7.js} +1 -1
- package/dist/cdn/{EEDB5R5I.js → 47ISWZWF.js} +1 -1
- package/dist/cdn/{S2AISX2B.js → 4BCBYUA5.js} +1 -1
- package/dist/cdn/{X32CEQPR.js → 6EWGJPEC.js} +1 -1
- package/dist/cdn/{7U2D75VS.js → BZME25Z4.js} +1 -1
- package/dist/cdn/{X6KG7ER5.js → CHLH5JPV.js} +1 -1
- package/dist/cdn/{2LLHYNFN.js → DDSISLRG.js} +1 -1
- package/dist/cdn/{FEJ3AX3C.js → ECWTYXXJ.js} +1 -1
- package/dist/cdn/{RSCAEBPM.js → EFAKOLKM.js} +54 -54
- package/dist/cdn/{24DH2UEG.js → EFEB7MEM.js} +1 -1
- package/dist/cdn/{GHF3DNLD.js → IJUMNRZE.js} +1 -1
- package/dist/cdn/{WWTWOB2N.js → IPZPHBUD.js} +1 -1
- package/dist/cdn/{SWW34SX4.js → L4SPLYLI.js} +1 -1
- package/dist/cdn/{SCEUBKWE.js → LM63GUX3.js} +1 -1
- package/dist/cdn/{4GEEK3VW.js → MEF5KWID.js} +1 -1
- package/dist/cdn/{7GTFRRWF.js → MGKFU4HC.js} +1 -1
- package/dist/cdn/OI4KO2XF.js +2 -0
- package/dist/cdn/{ZGBJH7GR.js → Q7HZOMWK.js} +1 -1
- package/dist/cdn/{AIF7B65D.js → VL4VHVEB.js} +2 -0
- package/dist/cdn/{7KB4R4Z2.js → XCT2OBFX.js} +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/runtime.js +1 -1
- package/dist/components/arcgis-assistant/customElement.d.ts +25 -8
- package/dist/components/arcgis-assistant/customElement.js +29 -25
- package/dist/components/arcgis-assistant/index.js +2 -1
- package/dist/components/arcgis-assistant-agent/customElement.d.ts +12 -2
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.d.ts +5 -0
- package/dist/components/arcgis-assistant-help-agent/customElement.d.ts +7 -3
- package/dist/components/arcgis-assistant-navigation-agent/customElement.d.ts +10 -5
- 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/utils/index.d.ts +11 -7
- package/package.json +7 -7
- package/dist/cdn/TU25CAM4.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
|
|
2
|
-
import c from"./
|
|
2
|
+
import c from"./EFAKOLKM.js";import b from"./LM63GUX3.js";import{a as s,b as a}from"./GIZ3VXFU.js";import"./JA77AZOL.js";import"./2LSVWAZO.js";import{v as e,z as r}from"./3NUCOIH7.js";import"./2GMCG6SX.js";export default $arcgis.t(([,{d:i}])=>{var t=class extends e{constructor(){super(...arguments),this.agent=i}static{this.properties={referenceElement:1}}#t;getContext(){if(!this.#t)throw new Error("arcgis-assistant-layer-query-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=s(this,"arcgis-assistant-layer-query-agent"),a(this)}};r("arcgis-assistant-layer-query-agent",t);return t},b,c)
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
|
|
2
|
-
import{a as h,b as g}from"./
|
|
2
|
+
import{a as h,b as g}from"./47ISWZWF.js";import{a as d}from"./IPZPHBUD.js";import"./2LSVWAZO.js";import{g as i,h as t,n as c,t as o,u as n,v as r,z as l}from"./3NUCOIH7.js";import"./2GMCG6SX.js";export default $arcgis.t(([{watch:p}])=>{var _=i`:host{display:block;container-type:inline-size}.assistant-chat-card__prompt-container{display:flex;align-items:center;gap:var(--calcite-spacing-md);background:color-mix(in srgb,var(--calcite-color-brand) 25%,transparent);color:var(--calcite-color-text-1);padding:var(--calcite-spacing-md);border-radius:var(--calcite-border-radius);width:fit-content;margin-left:auto;justify-content:flex-end}.assistant-chat-card__prompt-avatar{display:flex;align-items:center;justify-content:center}.assistant-chat-card__content-container{display:flex;flex:1;flex-direction:column;width:100%}.assistant-chat-card__response-container{display:flex;flex-direction:column;align-items:flex-start;gap:var(--calcite-spacing-sm);width:100%;text-align:left}.assistant-chat-card__response-icon{padding:var(--calcite-spacing-sm);border-radius:var(--calcite-spacing-xl);background:var(--calcite-color-brand);color:var(--calcite-color-foreground-1)}.assistant-chat-card__footer{display:flex;width:100%;justify-content:space-between;padding:0 var(--calcite-spacing-xxs)}.assistant-chat-card__feedback-actions{display:flex;flex-direction:row;gap:var(--calcite-spacing-xxs)}.assistant-chat-card__log-container{padding:0 var(--calcite-spacing-sm);border-radius:var(--calcite-border-radius);margin-bottom:var(--calcite-spacing-sm)}.assistant-chat-card__log{margin:0;background-color:var(--calcite-color-foreground-1);width:100%;max-height:300px;overflow:auto}.assistant-chat-card__log-entry{margin-left:var(--calcite-spacing-sm);padding:var(--calcite-spacing-xxs) var(--calcite-spacing-lg);border-left:1px solid var(--calcite-color-border-1)}.assistant-chat-card__footer-start,.assistant-chat-card__footer-end{display:flex;gap:var(--calcite-spacing-xxs)}@container (min-width: 480px){.assistant-chat-card__prompt-container,.assistant-chat-card__response-container{max-width:80%}}`,s=class extends r{constructor(){super(...arguments),this._messages=d({blocking:!0}),this._endRef=o(),this._showLog=!1,this.loading=!1,this.feedbackEnabled=!1,this.logEnabled=!1,this.copyEnabled=!1,this.arcgisFeedback=c()}static{this.properties={_showLog:16,_role:16,_content:16,_log:16,_error:16,_feedback:16,loading:5,messageRole:1,feedbackEnabled:5,logEnabled:5,copyEnabled:5,content:1,loadingMessage:1,log:0,error:1,user:1,message:0}}static{this.styles=_}get _role(){return this.message?.role??this.messageRole}get _content(){return this.message?.content??this.content}get _log(){return(this.message?.role==="assistant"?this.message?.log:void 0)??this.log}get _error(){return(this.message?.role==="assistant"?this.message?.error:void 0)??this.error}get _feedback(){return this.message?.role==="assistant"?this.message?.feedback?.positive:void 0}loaded(){this.manager.onLifecycle(()=>[p(()=>this._showLog,()=>this._scrollToEnd())])}_scrollToEnd(){requestAnimationFrame(()=>{this._endRef.value?.scrollIntoView({behavior:"smooth",block:"end"})})}_handleFeedback(a){this.message?.role==="assistant"&&(this.message.feedback=this.message.feedback?.positive===a?void 0:{positive:a},this.arcgisFeedback.emit(this.message),this.requestUpdate())}_renderLog(){return this._log&&this._showLog&&this.logEnabled?t`<div class="assistant-chat-card__log-container"><div class="assistant-chat-card__log"><calcite-accordion appearance=transparent icon-position=start icon-type=chevron scale=s>${this._log.map(a=>{let e=a.includes(`
|
|
3
3
|
`)||a.length>70;return t`<calcite-accordion-item .heading=${e?`${a.substring(0,70)}...`:a} .expanded=${e}><div class="assistant-chat-card__log-entry">${e?h(g(a)):null}</div></calcite-accordion-item>`})}</calcite-accordion></div></div>`:null}_renderThumbsUpButton(){return t`<calcite-action id=action-thumbs-up icon=thumbs-up scale=s .active=${this._feedback===!0} @click=${()=>this._handleFeedback(!0)} text></calcite-action><calcite-tooltip reference-element=action-thumbs-up overlay-positioning=fixed placement=bottom><span>${this._messages.thumbsUpLabel}</span></calcite-tooltip>`}_renderThumbsDownButton(){return t`<calcite-action id=action-thumbs-down icon=thumbs-down scale=s .active=${this._feedback===!1} @click=${()=>this._handleFeedback(!1)} text></calcite-action><calcite-tooltip reference-element=action-thumbs-down overlay-positioning=fixed placement=bottom><span>${this._messages.thumbsDownLabel}</span></calcite-tooltip>`}_renderFeedback(){return this.feedbackEnabled&&!this._error?t`<div class="assistant-chat-card__feedback-actions">${this._renderThumbsUpButton()}${this._renderThumbsDownButton()}</div>`:null}_renderCopyButton(){return!this._error&&this.copyEnabled?t`<calcite-action id=action-copy icon=copy-to-clipboard scale=s @click=${async()=>{try{this._content&&await navigator.clipboard.writeText(this._content)}catch(a){console.error("Failed to copy text to clipboard:",a)}}} text></calcite-action><calcite-tooltip reference-element=action-copy overlay-positioning=fixed placement=bottom><span>${this._messages.copyButtonLabel}</span></calcite-tooltip>`:null}_renderLogButton(){return this._log&&this.logEnabled?t`<calcite-action id=action-log icon=access-string-results scale=s @click=${()=>this._showLog=!this._showLog} .text=${this._messages.logButtonLabel} .active=${this._showLog}></calcite-action><calcite-tooltip reference-element=action-log overlay-positioning=fixed placement=bottom><span>${this._messages.logButtonLabel}</span></calcite-tooltip>`:null}_renderFooter(){return this.loading?null:t`<div class="assistant-chat-card__footer"><div class="assistant-chat-card__footer-start">${this._renderCopyButton()}${this._renderLogButton()}<slot name=footer-actions-start></slot></div><div class="assistant-chat-card__footer-end"><slot name=footer-actions-end></slot>${this._renderFeedback()}</div></div>`}render(){return this._role==="user"?t`<div class="assistant-chat-card__prompt-container"><div>${this._content}</div><div class="assistant-chat-card__prompt-avatar"><calcite-avatar .fullName=${this.user} scale=s></calcite-avatar></div></div>`:t`<div class="assistant-chat-card__response-container"><calcite-icon icon=effects class="assistant-chat-card__response-icon" scale=s></calcite-icon><div class="assistant-chat-card__content-container"><arcgis-assistant-chat-card-content .loading=${this.loading} .loadingMessage=${this.loadingMessage} .type=${this._error?"error":"text"} .content=${this._error??this._content}></arcgis-assistant-chat-card-content>${this._renderLog()}${this._renderFooter()}</div><div ${n(this._endRef)}></div></div>`}};l("arcgis-assistant-chat-card",s);return s},"core/reactiveUtils")
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
|
|
2
|
-
import{a as $,c as k}from"./2LSVWAZO.js";import{A as N,a as C,b as L,c as m,d as f,e as P,f as O,k as g,m as v,o as w}from"./
|
|
2
|
+
import{a as $,c as k}from"./2LSVWAZO.js";import{A as N,a as C,b as L,c as m,d as f,e as P,f as O,k as g,m as v,o as w}from"./3NUCOIH7.js";var _=t=>(...s)=>{let o=f(),e=new t(...s),r=e.exports;m(o.at(-1));let n=e.component.manager;n.W(e,r),e.watchExports(n.W.bind(n,e)),P(e);let a=[e.component,...o].reverse();return v(a,i=>i===void 0?void 0:j(e,i,r),r)},j=(t,{host:s,key:o,isReactive:e},r)=>{let n=s,a=n[o]!==t.exports,i=n[o]!==r,c=r!==t.exports;if(a&&!i&&c&&(n[o]=t.exports),s===t.component){if(e){let l=t.component.manager;i&&l.W(t,n[o]),t.onUpdate(u=>{if(u.has(o)){let x=n[o];x!==t.exports&&l.W(t,x)}})}t.O=e?void 0:o}let d=t.component.constructor.elementProperties.get(o)?.readOnly;t.watchExports(()=>{n[o]!==t.exports&&(d?O(()=>{n[o]=t.exports}):n[o]=t.exports)})};var z="ar,bg,bs,ca,cs,da,de,el,en,es,et,fi,fr,he,hr,hu,id,it,ja,ko,lt,lv,nl,nb,no,pl,pt-BR,pt-PT,ro,ru,sk,sl,sr,sv,th,tr,uk,vi,zh-CN,zh-HK,zh-TW".split(","),M=new Set(z),h="en",U={pt:"pt-PT",nb:"no",nn:"no",zh:"zh-CN"},F=async(t,s,o="")=>{let e=`${s}/${o}`,r=`${e}${t}.json`;return b[r]??(b[r]=A(t,e)),await b[r]},b={},A=async(t,s)=>{let o=`${s}${t}.json`;try{let e=await fetch(o);if(e.ok)return await e.json()}catch(e){return g("error","intl",`An unknown error occurred while fetching localization strings at ${o}`,{detail:{error:e}}),{}}return t===h?{}:await A(h,s)},y=t=>{let s=k(t,"lang",globalThis.navigator?.language||h);return{lang:s,t9nLocale:T(s)}},T=t=>{let[s,o]=t.split("-"),e=s.toLowerCase(),r=e;return o&&(r=`${e}-${o.toUpperCase()}`),r=U[r]??r,M.has(r)?r:o?T(e):h},D=(t,s,o,e)=>{let r,n=()=>K(t,s(),e).then(a=>{(r?.lang!==a.lang||r.t9nLocale!==a.t9nLocale||r.t9nStrings!==a.t9nStrings)&&o(a),r=a}).catch(a=>{g("error","intl","Error updating component locale state",{detail:{error:a}})});return queueMicrotask(n),$(t,["lang"],n)},K=async(t,s,o=t.localName.split("-").slice(1).join("-"))=>{let{lang:e,t9nLocale:r}=y(t),n=`${s}/${o}/t9n`,i=o===null?{}:await F(r,n,"messages.");return{lang:e,t9nLocale:r,t9nStrings:i}};var W=t=>I(void 0,t);var E=class extends w{constructor(s,o){super(s);let e=this.exports;try{L(this.component);let r=o(this.component,this),n=this.exports!==e;if(C(r)){n||this.setProvisionalExports(r);let a=r.then(i=>{this.exports=i,super.catchUpLifecycle()}).catch(i=>{this.P.reject(i)});this.onLoad(async()=>await a)}else(!n||r!==void 0)&&(this.exports=r),queueMicrotask(()=>super.catchUpLifecycle())}catch(r){this.P.reject(r)}}catchUpLifecycle(){}},I=_(E);var S=t=>(s={})=>W((o,e)=>{let r=y(o.el),n={_lang:r.lang,_t9nLocale:r.t9nLocale,_loading:!0},a=o;e.onLifecycle(()=>D(o.el,()=>t("./assets"),({t9nLocale:c,t9nStrings:p,lang:d})=>{let l={...p,_lang:d,_t9nLocale:c,_loading:!1};e.exports=l;let u=p.componentLabel;typeof u=="string"&&"label"in o&&o.label==null&&(o.label??=u),i(a.messageOverrides)},s.name));let i=c=>{let p=e.exports,d=p._original??p,l=V(d,c);c&&(l._original=d),e.exports=l};return"messageOverrides"in a&&e.onUpdate(c=>{c.has("messageOverrides")&&i(a.messageOverrides)}),s.blocking?(e.setProvisionalExports(n,!1),e.ready):n}),V=(t,s)=>{if(!s)return t;let o={...t};return Object.entries(s).forEach(([e,r])=>{t[e]!==void 0&&(typeof r=="object"?o[e]=V(t[e],r):o[e]=r??t[e])}),o};var ct=S(N);export{ct as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
|
|
2
|
-
import c from"./
|
|
2
|
+
import c from"./EFAKOLKM.js";import b from"./LM63GUX3.js";import{a as r,b as e}from"./GIZ3VXFU.js";import"./JA77AZOL.js";import"./2LSVWAZO.js";import{v as a,z as s}from"./3NUCOIH7.js";import"./2GMCG6SX.js";export default $arcgis.t(([,{b:i}])=>{var t=class extends a{constructor(){super(...arguments),this.agent=i}static{this.properties={referenceElement:1}}#t;getContext(){if(!this.#t)throw new Error("arcgis-assistant-data-exploration-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=r(this,"arcgis-assistant-data-exploration-agent"),e(this)}};s("arcgis-assistant-data-exploration-agent",t);return t},b,c)
|
|
@@ -267,4 +267,4 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
|
267
267
|
Title: {title}
|
|
268
268
|
Description: {description}`,qq=`Name: {name}
|
|
269
269
|
Alias: {alias}
|
|
270
|
-
Description: {description}`,Hq=ce.object({schemaVersion:ce.literal(Vq),modified:ce.number().int().nonnegative(),embeddings:ce.object({modelProvider:ce.literal(Zq),model:ce.literal(Gq),dimensions:ce.literal(Fd),templates:ce.object({layer:ce.string().default(Kq),field:ce.string().default(qq)})}),layers:ce.array(ce.object({id:ce.string().min(1),name:ce.string().min(1),title:ce.string().catch(""),description:ce.string().catch(""),vector:ce.array(ce.number()).length(Fd,{message:`Layer vector must be exactly ${Fd} dimensions`}),fields:ce.array(ce.object({name:ce.string().min(1),alias:ce.string().catch(""),description:ce.string().catch(""),vector:ce.array(ce.number()).length(Fd,{message:`Field vector must be exactly ${Fd} dimensions`})}))})).default([])}),Wq=e=>{let t=Hq.safeParse(e);if(!t.success)throw new Error("Embeddings response validation failed. Regenerate embeddings.");return t.data},Jq=(e,t)=>{let r=new Map,n=new Map;if(t.allLayers.forEach(i=>{i instanceof mq&&n.set(i.id,i)}),e.length!==n.size)throw new Error("Layer count mismatch during registry restoration. Regenerate embeddings.");for(let i of e){let s=n.get(i.id);if(!s)throw new Error(`Layer with ID ${i.id} not found in the original map during registry restoration. Regenerate embeddings.`);if(i.fields.length!==s.fields.length)throw new Error(`Field count mismatch for layer ID ${i.id} during registry restoration. Regenerate embeddings.`);let o={name:i.name,title:i.title,description:i.description},a=new Map;for(let c of i.fields){let u=s.fieldsIndex.get(c.name);if(!u)throw new Error(`Field with name ${c.name} not found in the original layer ${i.id} during registry restoration. Regenerate embeddings.`);a.set(c.name,{name:c.name,alias:c.alias,description:c.description,type:u.type||"unknown",valueType:u.valueType||"unknown"})}r.set(i.id,{layerItem:o,fieldRegistry:a})}return r},Xq=async e=>{try{return(await hq(e,{responseType:"json"})).data}catch(t){throw new Error(`Failed to fetch data from ${e}: ${String(t)}`)}},Yq=async e=>{let t=e.map;if(!t?.portalItem)throw new Error("WebMap portal item is missing.");let{resources:r}=await t.portalItem.fetchResources(),n=r.find(s=>s.resource.path==="embeddings-v01.json");if(!n?.resource.url)throw new Error("Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.");let i=await Xq(n.resource.url);return Wq(i)},vz=class e{constructor(){this.orchestratorReady=!1,this.chatHistory=[],this.threadId="",this.agentRegistry=new ZE,this.streamEpoch=0}static async init(t){let r=new e;try{if(t.view?.map){await bz.whenOnce(()=>t.view.ready);let n=await Yq(t.view),i=Jq(n.layers,t.view.map);r.layersAndFieldsRegistry=i,r.embeddingsWorker=await yq(n)}return t.agents?.forEach(n=>{r.agentRegistry.register(n)}),r.orchestratorReady=!0,r}catch(n){throw console.error("Orchestrator initialization failed:",n),n}}async*ask(t){if(!this.orchestratorReady)throw new Error("Orchestrator is not ready yet.");if(!this.agentRegistry.list().length)throw new Error("Orchestrator has no registered agents.");if(++this.streamEpoch,!t.trim())return;this.threadId=String(Date.now()),this.graph||(this.graph=Dq().compile({checkpointer:new lg}));let r=this.embeddingsWorker?Uq({worker:this.embeddingsWorker}):void 0,n=this.embeddingsWorker?Bq({worker:this.embeddingsWorker}):void 0,i=new Map,s={version:"v2",streamMode:"custom",configurable:{thread_id:this.threadId,hitlResponse:null,services:{layerSearch:r,fieldSearch:n,layersAndFieldsRegistry:this.layersAndFieldsRegistry,agentRegistry:this.agentRegistry,embeddingCache:i}},subgraphs:!0},o=this.graph?.streamEvents({userInput:t,messages:this.chatHistory},s),a=++this.streamEpoch;for(yield*this.pipeStream(o,a);;){let u=(await this.graph.getState(s,{subgraphs:!0})).tasks.find(l=>l.interrupts.length>0)?.interrupts[0]?.value;if(!u)break;this.currentInterrupt=u,this.interruptHandler=new GE(this.graph,s),yield{runId:this.threadId,timestamp:Date.now(),type:"interrupt",interrupt:u};try{let l=await this.interruptHandler.waitForUser(),p=++this.streamEpoch;yield*this.pipeStream(l,p)}catch(l){if(l){yield{runId:this.threadId,timestamp:Date.now(),type:"error",error:{message:l?.message}};return}yield{runId:this.threadId,timestamp:Date.now(),type:"cancelled"};return}}let c=(await this.graph.getState(s,{subgraphs:!0})).values;this.chatHistory=c.messages.length?c.messages:this.chatHistory,yield{runId:this.threadId,timestamp:Date.now(),type:"completed",result:{content:Oq(c.messages)}}}newConversation(){this.chatHistory=[]}resumeInterrupt(t){if(!this.currentInterrupt||!this.interruptHandler)throw new Error("No pending interrupt to resume.");this.interruptHandler.handle(this.currentInterrupt,t)}cancelInterrupt(){this.interruptHandler&&this.interruptHandler.cancel()}async*pipeStream(t,r){for await(let n of t){if(r!==this.streamEpoch){console.log("Stale stream detected, aborting.");break}n.event==="on_custom_event"&&n.name==="trace_message"?yield{runId:this.threadId,timestamp:Date.now(),type:"trace",data:n.data}:n.name==="graph_ux_suggestion"&&(yield{runId:this.threadId,timestamp:Date.now(),type:"ux-suggestion",suggestion:n.data})}}dispose(){this.embeddingsWorker&&(this.embeddingsWorker.terminate(),this.embeddingsWorker=void 0),this.orchestratorReady=!1}},Qq=wn.object({name:wn.string(),description:wn.string(),valueType:wn.string(),alias:wn.string()}),VDe=wn.object({fields:wn.array(Qq)});var ZDe=wn.object({title:wn.string(),description:wn.string(),name:wn.string().nullable()});return{a:Vd,b:Ri,c:ot,d:Wt,e:at,f:$e,g:si,h:ce,i:Jp,j:Fn,k:Ae,l:xe,m:$t,n:jr,o:Pt,p:sr,q:ds,r:zg,s:wn,t:Os,u:UDe,v:FDe,w:Nq,x:BDe,y:vz}},"identity/IdentityManager","portal/Portal","core/reactiveUtils","layers/FeatureLayer","request")
|
|
270
|
+
Description: {description}`,Hq=ce.object({schemaVersion:ce.literal(Vq),modified:ce.number().int().nonnegative(),embeddings:ce.object({modelProvider:ce.literal(Zq),model:ce.literal(Gq),dimensions:ce.literal(Fd),templates:ce.object({layer:ce.string().default(Kq),field:ce.string().default(qq)})}),layers:ce.array(ce.object({id:ce.string().min(1),name:ce.string().min(1),title:ce.string().catch(""),description:ce.string().catch(""),vector:ce.array(ce.number()).length(Fd,{message:`Layer vector must be exactly ${Fd} dimensions`}),fields:ce.array(ce.object({name:ce.string().min(1),alias:ce.string().catch(""),description:ce.string().catch(""),vector:ce.array(ce.number()).length(Fd,{message:`Field vector must be exactly ${Fd} dimensions`})}))})).default([])}),Wq=e=>{let t=Hq.safeParse(e);if(!t.success)throw new Error("Embeddings response validation failed. Regenerate embeddings.");return t.data},Jq=(e,t)=>{let r=new Map,n=new Map;if(t.allLayers.forEach(i=>{i instanceof mq&&n.set(i.id,i)}),e.length!==n.size)throw new Error("Layer count mismatch during registry restoration. Regenerate embeddings.");for(let i of e){let s=n.get(i.id);if(!s)throw new Error(`Layer with ID ${i.id} not found in the original map during registry restoration. Regenerate embeddings.`);if(i.fields.length!==s.fields.length)throw new Error(`Field count mismatch for layer ID ${i.id} during registry restoration. Regenerate embeddings.`);let o={name:i.name,title:i.title,description:i.description},a=new Map;for(let c of i.fields){let u=s.fieldsIndex.get(c.name);if(!u)throw new Error(`Field with name ${c.name} not found in the original layer ${i.id} during registry restoration. Regenerate embeddings.`);a.set(c.name,{name:c.name,alias:c.alias,description:c.description,type:u.type||"unknown",valueType:u.valueType||"unknown",domain:s.getFieldDomain(c.name)??void 0})}r.set(i.id,{layerItem:o,fieldRegistry:a})}return r},Xq=async e=>{try{return(await hq(e,{responseType:"json"})).data}catch(t){throw new Error(`Failed to fetch data from ${e}: ${String(t)}`)}},Yq=async e=>{let t=e.map;if(!t?.portalItem)throw new Error("WebMap portal item is missing.");let{resources:r}=await t.portalItem.fetchResources(),n=r.find(s=>s.resource.path==="embeddings-v01.json");if(!n?.resource.url)throw new Error("Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.");let i=await Xq(n.resource.url);return Wq(i)},vz=class e{constructor(){this.orchestratorReady=!1,this.chatHistory=[],this.threadId="",this.agentRegistry=new ZE,this.streamEpoch=0}static async init(t){let r=new e;try{if(t.view?.map){await bz.whenOnce(()=>t.view.ready);let n=await Yq(t.view),i=Jq(n.layers,t.view.map);r.layersAndFieldsRegistry=i,r.embeddingsWorker=await yq(n)}return t.agents?.forEach(n=>{r.agentRegistry.register(n)}),r.orchestratorReady=!0,r}catch(n){throw console.error("Orchestrator initialization failed:",n),n}}async*ask(t){if(!this.orchestratorReady)throw new Error("Orchestrator is not ready yet.");if(!this.agentRegistry.list().length)throw new Error("Orchestrator has no registered agents.");if(++this.streamEpoch,!t.trim())return;this.threadId=String(Date.now()),this.graph||(this.graph=Dq().compile({checkpointer:new lg}));let r=this.embeddingsWorker?Uq({worker:this.embeddingsWorker}):void 0,n=this.embeddingsWorker?Bq({worker:this.embeddingsWorker}):void 0,i=new Map,s={version:"v2",streamMode:"custom",configurable:{thread_id:this.threadId,hitlResponse:null,services:{layerSearch:r,fieldSearch:n,layersAndFieldsRegistry:this.layersAndFieldsRegistry,agentRegistry:this.agentRegistry,embeddingCache:i}},subgraphs:!0},o=this.graph?.streamEvents({userInput:t,messages:this.chatHistory},s),a=++this.streamEpoch;for(yield*this.pipeStream(o,a);;){let u=(await this.graph.getState(s,{subgraphs:!0})).tasks.find(l=>l.interrupts.length>0)?.interrupts[0]?.value;if(!u)break;this.currentInterrupt=u,this.interruptHandler=new GE(this.graph,s),yield{runId:this.threadId,timestamp:Date.now(),type:"interrupt",interrupt:u};try{let l=await this.interruptHandler.waitForUser(),p=++this.streamEpoch;yield*this.pipeStream(l,p)}catch(l){if(l){yield{runId:this.threadId,timestamp:Date.now(),type:"error",error:{message:l?.message}};return}yield{runId:this.threadId,timestamp:Date.now(),type:"cancelled"};return}}let c=(await this.graph.getState(s,{subgraphs:!0})).values;this.chatHistory=c.messages.length?c.messages:this.chatHistory,yield{runId:this.threadId,timestamp:Date.now(),type:"completed",result:{content:Oq(c.messages)}}}newConversation(){this.chatHistory=[]}resumeInterrupt(t){if(!this.currentInterrupt||!this.interruptHandler)throw new Error("No pending interrupt to resume.");this.interruptHandler.handle(this.currentInterrupt,t)}cancelInterrupt(){this.interruptHandler&&this.interruptHandler.cancel()}async*pipeStream(t,r){for await(let n of t){if(r!==this.streamEpoch){console.log("Stale stream detected, aborting.");break}n.event==="on_custom_event"&&n.name==="trace_message"?yield{runId:this.threadId,timestamp:Date.now(),type:"trace",data:n.data}:n.name==="graph_ux_suggestion"&&(yield{runId:this.threadId,timestamp:Date.now(),type:"ux-suggestion",suggestion:n.data})}}dispose(){this.embeddingsWorker&&(this.embeddingsWorker.terminate(),this.embeddingsWorker=void 0),this.orchestratorReady=!1}},Qq=wn.object({name:wn.string(),description:wn.string(),valueType:wn.string(),alias:wn.string()}),VDe=wn.object({fields:wn.array(Qq)});var ZDe=wn.object({title:wn.string(),description:wn.string(),name:wn.string().nullable()});return{a:Vd,b:Ri,c:ot,d:Wt,e:at,f:$e,g:si,h:ce,i:Jp,j:Fn,k:Ae,l:xe,m:$t,n:jr,o:Pt,p:sr,q:ds,r:zg,s:wn,t:Os,u:UDe,v:FDe,w:Nq,x:BDe,y:vz}},"identity/IdentityManager","portal/Portal","core/reactiveUtils","layers/FeatureLayer","request")
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
|
|
2
|
-
import{a as v}from"./
|
|
2
|
+
import{a as v}from"./IPZPHBUD.js";import"./2LSVWAZO.js";import{g as u,h as i,n as r,t as d,u as p,v as g,x as m,z as y}from"./3NUCOIH7.js";import"./2GMCG6SX.js";export default $arcgis.t(([{watch:_},f])=>{var w=u`.assistant-chat-entry__input-container{display:flex;flex-direction:column}.assistant-chat-entry__footer-start{display:flex;gap:var(--calcite-spacing-md);flex-wrap:wrap;align-items:center}.assistant-chat-entry__footer-end{display:flex;gap:var(--calcite-spacing-md);align-items:center}.assistant-chat-entry__status-indicator{width:9px;height:9px;border-radius:100%;background-color:var(--calcite-color-status-success)}.assistant-chat-entry__status-indicator[data-status=working]{background-color:var(--calcite-color-status-warning)}.assistant-chat-entry__status-indicator[data-status=error]{background-color:var(--calcite-color-status-danger)}.assistant-chat-entry__status-text{text-transform:capitalize}`,n=class extends g{constructor(){super(...arguments),this.#s=d(),this.#t=-1,this.#a="",this._messages=v({blocking:!0}),this.keyboardShortcutsDisabled=!1,this.awaitingResponse=!1,this.inputValue="",this.messages=new f([]),this.arcgisCancel=r(),this.arcgisSubmit=r()}static{this.properties={_userMessages:16,keyboardShortcutsDisabled:5,entryPlaceholder:1,awaitingResponse:5,inputValue:1,status:1,messages:0}}static{this.styles=w}#s;#t;#a;get _userMessages(){return this.messages.toArray().filter(t=>t.role==="user").map(({content:t})=>t)}loaded(){this.manager.onLifecycle(()=>[_(()=>this.inputValue,t=>{this.#s.value&&(this.#s.value.value=t)},{initial:!0})])}async _submitMessage(){if(this.awaitingResponse){this.arcgisCancel.emit();return}let t=this.#s.value?.value.trim();t&&(this.arcgisSubmit.emit(t),this.#t=-1,this.#a="",this.#s.value&&(this.#s.value.value="",await this.#s.value.setFocus()))}async _navigateHistory(t,o){let s=this.#s.value;if(!s)return;let a=this._userMessages;if(a.length===0)return;let c=s.value??"",l=s.shadowRoot?.querySelector("textarea"),e=l?.selectionStart,h=l?.selectionEnd;if(!(e==null||h==null)&&!(e!==h||t==="up"&&e!==0||t==="down"&&e!==c.length)){if(t==="up"){this.#t===-1?(this.#a=c,this.#t=a.length-1):this.#t=Math.max(0,this.#t-1),s.value=a[this.#t]??"",o.preventDefault();return}this.#t!==-1&&(this.#t<a.length-1?(this.#t+=1,s.value=a[this.#t]??""):(this.#t=-1,s.value=this.#a),o.preventDefault())}}render(){return i`<div class="assistant-chat-entry__input-container"><calcite-text-area .value=${this.#s.value?.value} .placeholder=${this.entryPlaceholder??this._messages.entryPlaceholder} resize=vertical @keydown=${async t=>{t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||this.keyboardShortcutsDisabled||(t.key==="Enter"?(t.preventDefault(),await this._submitMessage()):t.key==="ArrowUp"?await this._navigateHistory("up",t):t.key==="ArrowDown"&&await this._navigateHistory("down",t))}} ${p(this.#s)}><div slot=footer-start class="assistant-chat-entry__footer-start"><slot name=entry-actions-start></slot></div><div slot=footer-end class="assistant-chat-entry__footer-end">${this.status?i`<div id=tooltip-status class="assistant-chat-entry__status-indicator" data-status=${this.status??m}></div><calcite-tooltip reference-element=tooltip-status offset-distance=12><span class="assistant-chat-entry__status-text">${this.status}</span></calcite-tooltip>`:null}<calcite-button .iconStart=${this.awaitingResponse?"circle-stop":"send"} slot=footer-end round @click=${()=>void this._submitMessage()}>${this.awaitingResponse?this._messages.stopButtonLabel:this._messages.askButtonLabel}</calcite-button></div></calcite-text-area></div>`}};y("arcgis-assistant-chat-entry",n);return n},"core/reactiveUtils","core/Collection")
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
|
|
2
|
-
import{b as a}from"./GIZ3VXFU.js";import"./JA77AZOL.js";import"./2LSVWAZO.js";import{v as s,z as e}from"./
|
|
2
|
+
import{b as a}from"./GIZ3VXFU.js";import"./JA77AZOL.js";import"./2LSVWAZO.js";import{v as s,z as e}from"./3NUCOIH7.js";import"./2GMCG6SX.js";var t=class extends s{static{this.properties={agent:0,context:0}}getContext(){return this.context}load(){a(this)}};e("arcgis-assistant-agent",t);export{t as ArcgisAssistantAgent};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
|
|
2
|
+
import{a as k}from"./IPZPHBUD.js";import c from"./LM63GUX3.js";import{a as C}from"./JA77AZOL.js";import"./2LSVWAZO.js";import{g as b,h,l as v,n as a,t as u,u as m,v as f,z as w}from"./3NUCOIH7.js";import"./2GMCG6SX.js";export default $arcgis.t(([S,{whenOnce:I,watch:L,when:P},O,M,{property:p,subclass:x},{y:E}])=>{var R=b`:host{display:block;width:var(--arcgis-internal-panel-width, 100%);height:var(--arcgis-internal-expand-max-height, 100%)}`,A=Object.defineProperty,z=Object.getOwnPropertyDescriptor,l=(c,t,e,i)=>{for(var s=i>1?void 0:i?z(t,e):t,r=c.length-1,n;r>=0;r--)(n=c[r])&&(s=(i?n(t,e,s):n(s))||s);return i&&s&&A(t,e,s),s},o=class extends M{constructor(c){super(c),this.view=null,this.loading=!1,this.processing=!1,this.processingStep=""}async load(){this._set("loading",!0);try{await this._initialize()}finally{this._set("loading",!1)}}destroy(){this.orchestrator?.dispose(),super.destroy()}async _initialize(){this.removeHandles(),await Promise.all([this.portal.load(),this.view?.when()]),this.view&&await I(()=>!this.view.updating),this._set("orchestrator",await E.init({agents:[...this.agents],view:this.view??void 0})),this.addHandles([L(()=>[this.view,this.agents],()=>void this._initialize())])}clearChatHistory(){this.orchestrator?.newConversation()}async*ask(c,t){if(!this.orchestrator)throw new Error("Orchestrator not initialized yet.");this._set("processing",!0),this._set("processingStep","");let e=[];try{let i=this.orchestrator.ask(c);for await(let s of i){let r=s.runId;if(t?.aborted){yield{type:"cancelled",runId:r};break}switch(s.type){case"trace":{this._set("processingStep",s.data.text),e.push(s.data.text);break}case"completed":{if(!s.result.content.length){yield{type:"completed",error:"Could not process the request.",log:e,runId:r};return}let n=s.result.content;this._set("processingStep",""),yield{type:"completed",response:n,log:e,runId:r};return}case"interrupt":{let{kind:n,message:g,metadata:_}=s.interrupt,d=Array.isArray(_)?[..._]:[],$=(()=>{switch(n){case"booleanChoice":return{type:"boolean-choice",message:g,options:d};case"singleSelection":return{type:"single-select",message:g,options:d};case"multipleSelection":return{type:"multi-select",message:g,options:d};case"textInput":return{type:"text-input",message:g};default:return{type:n,message:g,options:d}}})();this._set("processingStep","Waiting for user input..."),yield{type:"interrupt",payload:$,runId:r};break}case"cancelled":{yield{type:"cancelled",runId:r};return}case"error":{yield{type:"completed",error:s.error.message,log:e,runId:r};return}default:{console.warn("Unknown event type:",s);break}}}}catch(i){console.warn("Error during message processing:",i),yield{type:"completed",error:"An error occurred during message processing.",log:e,runId:"error"};return}finally{this._set("processing",!1)}}};l([p({readOnly:!0})],o.prototype,"orchestrator",2);l([p()],o.prototype,"agents",2);l([p()],o.prototype,"portal",2);l([p()],o.prototype,"view",2);l([p({readOnly:!0})],o.prototype,"loading",2);l([p({readOnly:!0})],o.prototype,"processing",2);l([p({readOnly:!0})],o.prototype,"processingStep",2);o=l([x("OrchestratorController")],o);var H="Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.",j="Embeddings not found for this web map.",F="https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings",y=class extends f{constructor(){super(...arguments),this._messages=k({blocking:!0}),this.#t=u(),this.#e=u(),this.#s=null,this.#a=new Map,this.#r=O.getDefault(),this.#i=t=>{t.stopPropagation(),this.arcgisInterruptCancel.emit(),this.orchestrator?.cancelInterrupt(),this._interrupt=null},this.#o=t=>{t.stopPropagation();let e=t.detail;this.arcgisInterruptSubmit.emit(e),this.orchestrator?.resumeInterrupt(e),this._interrupt=null},this.#n=t=>{t.stopPropagation(),this.keepSuggestedPrompts||(this.suggestedPrompts=[]);let e=t.detail;this.arcgisSubmit.emit(e),this.submitMessage(e)},this.#l=t=>{if(t.stopPropagation(),this.arcgisCancel.emit(),this._interrupt){this.orchestrator?.cancelInterrupt(),this._interrupt=null;return}this.#s?.abort()},this.#c=t=>{t.stopPropagation();let e=t.detail;this.arcgisFeedback.emit(e)},this._orchestratorController=null,this._interrupt=null,this._error=null,this.messages=new S([]),this.referenceElement=null,this.suggestedPrompts=[],this.feedbackEnabled=!1,this.keepSuggestedPrompts=!1,this.logEnabled=!1,this.copyEnabled=!1,this.arcgisCancel=a(),this.arcgisError=a(),this.arcgisFeedback=a(),this.arcgisInterrupt=a(),this.arcgisInterruptCancel=a(),this.arcgisInterruptSubmit=a(),this.arcgisReady=a(),this.arcgisSubmit=a()}static{this.properties={_orchestratorController:16,_interrupt:16,_error:16,_user:16,messages:0,orchestrator:32,entryMessage:1,heading:1,description:1,referenceElement:1,suggestedPrompts:0,feedbackEnabled:5,keepSuggestedPrompts:5,logEnabled:5,copyEnabled:5}}static{this.styles=R}#t;#e;#s;#a;#r;#i;#o;#n;#l;#c;async#h(){try{let t=C(this.el,this.referenceElement);await t?.componentOnReady();let e=[...this.#a.values()];return e.length?(this._orchestratorController=new o({agents:e,portal:this.#r,view:t?.view}),await this._orchestratorController.load(),!0):(this._error="No agents found.",!1)}catch(t){return this._error=t?.message??"Error initializing orchestrator.",v(this)(t),!1}}get _user(){return this.#r?.user?.fullName||this.#r?.user?.username}get orchestrator(){return this._orchestratorController?.orchestrator}async clearChatHistory(){this._reset(),this._orchestratorController?.clearChatHistory()}register(t){this.#a.set(t.agent.id,t)}async submitMessage(t){let e=t.trim();if(!e||(this.messages.push({id:Date.now().toString(),role:"user",content:e}),!this._orchestratorController))return;let i=this._orchestratorController.ask(e,this.#s?.signal);for await(let s of i){let r=s.runId;switch(s.type){case"completed":this.messages.push({role:"assistant",content:s.response,log:s.log,error:s.error,id:r});break;case"interrupt":this._interrupt={...s.payload,id:r};break;case"cancelled":this.messages.push({role:"assistant",error:"Request cancelled.",id:r});break}}}load(){this.manager.onLifecycle(this._reset.bind(this))}loaded(){this.manager.onLifecycle(()=>{this.#t.value?.addEventListener("arcgisSubmit",this.#n),this.#t.value?.addEventListener("arcgisCancel",this.#l),this.#t.value?.addEventListener("arcgisFeedback",this.#c);let t=P(()=>!!this._interrupt&&!!this.#e.value,()=>{let e=this.#e.value;e.removeEventListener("arcgisSubmit",this.#o),e.removeEventListener("arcgisCancel",this.#i),e.addEventListener("arcgisSubmit",this.#o,{once:!0}),e.addEventListener("arcgisCancel",this.#i,{once:!0}),this._interrupt&&this.arcgisInterrupt.emit(this._interrupt)});return queueMicrotask(()=>{this.#h().then(e=>{e?this.arcgisReady.emit():this._error&&this.arcgisError.emit(new Error(this._error))})}),()=>{t.remove(),this.#e.value?.removeEventListener("arcgisSubmit",this.#o),this.#e.value?.removeEventListener("arcgisCancel",this.#i),this.#t.value?.removeEventListener("arcgisSubmit",this.#n),this.#t.value?.removeEventListener("arcgisCancel",this.#l),this.#t.value?.removeEventListener("arcgisFeedback",this.#c),this._orchestratorController?.destroy(),this._orchestratorController=null}})}_reset(){this.#s?.abort(),this._interrupt=null,this.messages.removeAll(),this._error=null}_renderErrorNotice(){return this._error?h`<calcite-notice closable slot=entry-message open kind=danger icon width=full>${this._error===H?h`<div slot=message>${j}</div><calcite-link slot=link .href=${F} target=_blank title="Learn about web map embeddings">Read more</calcite-link>`:h`<div slot=message>${this._error}</div>`}</calcite-notice>`:null}render(){return h`<arcgis-assistant-shell .loading=${!this._orchestratorController&&!this._error||this._orchestratorController?.loading} .heading=${this.heading??this._messages.assistantLabel} .description=${this.description} .entryMessage=${this.entryMessage} .entryMessageClosed=${this.messages.length>0} .awaitingResponse=${this._orchestratorController?.processing} .suggestedPrompts=${this.suggestedPrompts} .messages=${this.messages} ${m(this.#t)}>${this._renderErrorNotice()}${this._interrupt?h`<arcgis-assistant-interrupt slot=entry-message .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${m(this.#e)}></arcgis-assistant-interrupt>`:null}<arcgis-assistant-chat .loading=${this._orchestratorController?.processing} .loadingMessage=${this._orchestratorController?.processingStep||""} .messages=${this.messages} .user=${this._user} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled}><slot></slot></arcgis-assistant-chat><slot name=header-actions-end slot=header-actions-end></slot>${this.entryMessage?null:h`<slot name=entry-message slot=entry-message></slot>`}<slot name=entry-actions-start slot=entry-actions-start></slot><slot name=footer-content slot=footer-content></slot></arcgis-assistant-shell>`}};w("arcgis-assistant",y);return y},"core/Collection","core/reactiveUtils","portal/Portal","core/Accessor","core/accessorSupport/decorators",c)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
|
|
2
|
-
import b from"./
|
|
2
|
+
import b from"./EFAKOLKM.js";import a from"./LM63GUX3.js";import{a as e,b as i}from"./GIZ3VXFU.js";import"./JA77AZOL.js";import"./2LSVWAZO.js";import{v as s,z as r}from"./3NUCOIH7.js";import"./2GMCG6SX.js";export default $arcgis.t(([,{e:a}])=>{var t=class extends s{constructor(){super(...arguments),this.agent=a}static{this.properties={referenceElement:1}}#t;getContext(){if(!this.#t)throw new Error("arcgis-assistant-layer-styling-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=e(this,"arcgis-assistant-layer-styling-agent"),i(this)}};r("arcgis-assistant-layer-styling-agent",t);return t},a,b)
|
|
@@ -39,6 +39,8 @@ Use the most recent relevant user question from the chat history. The question w
|
|
|
39
39
|
- Use fields with the **highest \`relevanceScore\`**.
|
|
40
40
|
- DO NOT use subqueries or \`SELECT\` keyword.
|
|
41
41
|
- Combine conditions with \`AND\`, \`OR\`, or \`NOT\` as appropriate.
|
|
42
|
+
- **Coded-value domain fields** \u2192 Always use the numeric/string **code** in WHERE clauses, never the domain name. Domain values are listed under each field as \`code=name\` pairs
|
|
43
|
+
- **Range domain fields** \u2192 Use the listed min/max as valid bounds for comparisons.
|
|
42
44
|
- If no meaningful layer filter can be generated, do not call a tool.
|
|
43
45
|
|
|
44
46
|
### Mixed Questions
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
|
|
2
|
-
import{a as n}from"./
|
|
2
|
+
import{a as n}from"./IPZPHBUD.js";import"./2LSVWAZO.js";import{g as a,h as e,n as s,v as c,z as l}from"./3NUCOIH7.js";import"./2GMCG6SX.js";var o=a``,i=class extends c{constructor(){super(...arguments),this.#t=[],this._messages=n({blocking:!0}),this.arcgisCancel=s(),this.arcgisSubmit=s()}static{this.properties={type:1,message:1,options:0}}static{this.styles=o}#t;_renderInterruptOptions(){switch(this.type){case"single-select":return e`<calcite-list selection-mode=single-persist .label=${this._messages.optionsLabel} @calciteListChange=${t=>this.#t=t.target.selectedItems[0]?.value}>${this.options?.map(t=>e`<calcite-list-item .label=${t} .value=${t}></calcite-list-item>`)}</calcite-list>`;case"multi-select":return e`<calcite-list selection-mode=multiple .label=${this._messages.optionsLabel} @calciteListChange=${t=>this.#t=t.target.selectedItems.map(r=>r.value)}>${this.options?.map(t=>e`<calcite-list-item .label=${t} .value=${t}></calcite-list-item>`)}</calcite-list>`;case"boolean-choice":return null;case"text-input":return e`<calcite-input .label=${this._messages.enterTextLabel} @calciteInputInput=${t=>this.#t=t.target.value}></calcite-input>`}}render(){return e`<calcite-panel .description=${this.message}>${this._renderInterruptOptions()}<calcite-button slot=footer-end appearance=outline @click=${()=>this.arcgisCancel.emit()}>${this._messages.cancelButtonLabel}</calcite-button><calcite-button slot=footer-end appearance=solid @click=${()=>this.arcgisSubmit.emit(this.type==="boolean-choice"?!0:this.#t)}>${this._messages.submitButtonLabel}</calcite-button></calcite-panel>`}};l("arcgis-assistant-interrupt",i);export{i as ArcgisAssistantInterrupt};
|
package/dist/cdn/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
|
|
2
|
-
import{p as e,y as s}from"./
|
|
2
|
+
import{p as e,y as s}from"./3NUCOIH7.js";import"./2GMCG6SX.js";var t=e(s,{"arcgis-assistant":[()=>import("./OI4KO2XF.js"),"_messages:,copyEnabled,description,entryMessage,feedbackEnabled,heading,keepSuggestedPrompts,logEnabled,messages:,orchestrator:,referenceElement,suggestedPrompts:;clearChatHistory,submitMessage;register"],"arcgis-assistant-agent":[()=>import("./MGKFU4HC.js"),"agent:,context:;;getContext"],"arcgis-assistant-data-exploration-agent":[()=>import("./L4SPLYLI.js"),"referenceElement;;getContext"],"arcgis-assistant-help-agent":[()=>import("./DDSISLRG.js"),"referenceElement;;getContext"],"arcgis-assistant-layer-filter-agent":[()=>import("./4BCBYUA5.js"),"referenceElement;;getContext"],"arcgis-assistant-layer-query-agent":[()=>import("./EFEB7MEM.js"),"referenceElement;;getContext"],"arcgis-assistant-layer-styling-agent":[()=>import("./Q7HZOMWK.js"),"referenceElement;;getContext"],"arcgis-assistant-navigation-agent":[()=>import("./CHLH5JPV.js"),"referenceElement;;getContext"],"arcgis-assistant-chat":[()=>import("./BZME25Z4.js"),"copyEnabled,feedbackEnabled,loading,loadingMessage,logEnabled,messages:,user"],"arcgis-assistant-chat-card":[()=>import("./IJUMNRZE.js"),"_messages:,content,copyEnabled,error,feedbackEnabled,loading,loadingMessage,log:,logEnabled,message:,messageRole,user"],"arcgis-assistant-chat-card-content":[()=>import("./6EWGJPEC.js"),"content,loading,loadingMessage,type"],"arcgis-assistant-chat-entry":[()=>import("./MEF5KWID.js"),"_messages:,awaitingResponse,entryPlaceholder,inputValue,keyboardShortcutsDisabled,messages:,status"],"arcgis-assistant-interrupt":[()=>import("./XCT2OBFX.js"),"_messages:,message,options:,type"],"arcgis-assistant-shell":[()=>import("./ECWTYXXJ.js"),"_messages:,awaitingResponse,description,entryMessage,entryMessageClosed,heading,inputValue,loading,messages:,status,suggestedPrompts:"]});t({resourcesUrl:import.meta.url});var a=new CSSStyleSheet;a.replaceSync("@layer{:not([hydrated]):is(arcgis-assistant,arcgis-assistant-agent,arcgis-assistant-data-exploration-agent,arcgis-assistant-help-agent,arcgis-assistant-layer-filter-agent,arcgis-assistant-layer-query-agent,arcgis-assistant-layer-styling-agent,arcgis-assistant-navigation-agent,arcgis-assistant-chat,arcgis-assistant-chat-card,arcgis-assistant-chat-card-content,arcgis-assistant-chat-entry,arcgis-assistant-interrupt,arcgis-assistant-shell){visibility:hidden}}");document.adoptedStyleSheets=[...document.adoptedStyleSheets,a];window.$arcgis||Object.defineProperty(window,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),((a,r)=>{a.t=(c,...x)=>Promise.all(x.map(x=>x.then?x:(!a?.forceESM&&a?.import||(x=>import(x+".js").then(m=>m.default??m)))("@arcgis/core/"+x))).then(c);r.p=a.t(([m])=>{r.t=m.trackAccess;r.o=m.createObservable;r.c=m.createTrackingTarget;r.r=m.runTracked},"applications/Components/reactiveUtils")})($arcgis,s)
|
package/dist/chunks/runtime.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import "../cdn/main.css";
|
|
3
3
|
import { makeRuntime as e } from "@arcgis/lumina";
|
|
4
4
|
import { trackAccess as s, createObservable as a, createTrackingTarget as r, runTracked as c } from "@arcgis/core/applications/Components/reactiveUtils.js";
|
|
5
|
-
const t = e({ defaultAssetPath: "https://
|
|
5
|
+
const t = e({ defaultAssetPath: "https://js.arcgis.com/5.0.0/ai-components/", hydratedAttribute: "hydrated" }), { customElement: n, getAssetPath: i, setAssetPath: d } = t;
|
|
6
6
|
t.t = s;
|
|
7
7
|
t.o = a;
|
|
8
8
|
t.c = r;
|
|
@@ -15,13 +15,14 @@ import type { ArcgisMap as ArcgisMap } from "@arcgis/map-components/components/a
|
|
|
15
15
|
* agent for the assistant to function. You can register agents declaratively using any of the
|
|
16
16
|
* available agent components, or you can register custom agents.
|
|
17
17
|
*
|
|
18
|
-
* ## Register
|
|
18
|
+
* ## Register agents
|
|
19
19
|
*
|
|
20
|
-
* To register
|
|
20
|
+
* To register agents declaratively, include one or more agent components as children
|
|
21
21
|
* of the `arcgis-assistant` component. This can be done in HTML or programmatically using JavaScript.
|
|
22
22
|
*
|
|
23
23
|
* ```html
|
|
24
|
-
* <arcgis-
|
|
24
|
+
* <arcgis-map id="my-map"></arcgis-map>
|
|
25
|
+
* <arcgis-assistant reference-element="#my-map">
|
|
25
26
|
* <arcgis-assistant-navigation-agent></arcgis-assistant-navigation-agent>
|
|
26
27
|
* <arcgis-assistant-data-exploration-agent></arcgis-assistant-data-exploration-agent>
|
|
27
28
|
* <arcgis-assistant-help-agent></arcgis-assistant-help-agent>
|
|
@@ -36,6 +37,10 @@ import type { ArcgisMap as ArcgisMap } from "@arcgis/map-components/components/a
|
|
|
36
37
|
* assistant.appendChild(dataExplorationAgent);
|
|
37
38
|
* ```
|
|
38
39
|
*
|
|
40
|
+
* Note that the `reference-element` property on the `arcgis-assistant` component must point to a valid `arcgis-map` element
|
|
41
|
+
* for the included ArcGIS agents to function properly, as they rely on the map context to perform their tasks. This is not
|
|
42
|
+
* a requirement for [custom agents](https://developers.arcgis.com/javascript/latest/agentic-apps/ai-custom-agents/).
|
|
43
|
+
*
|
|
39
44
|
* ## Context
|
|
40
45
|
*
|
|
41
46
|
* Use the [referenceElement](https://developers.arcgis.com/javascript/latest/references/ai-components/components/arcgis-assistant/#referenceElement) property to provide a web map as context to the assistant and its agents.
|
|
@@ -44,6 +49,16 @@ import type { ArcgisMap as ArcgisMap } from "@arcgis/map-components/components/a
|
|
|
44
49
|
*
|
|
45
50
|
* To learn more about this component, try out the [demo](https://developers.arcgis.com/javascript/latest/references/ai-components/components/arcgis-assistant/#demos)
|
|
46
51
|
*
|
|
52
|
+
* ## Important considerations and best practices
|
|
53
|
+
*
|
|
54
|
+
* Due to the non-deterministic nature of generative AI, there may be inaccuracies or unexpected behavior when using the
|
|
55
|
+
* out-of-the-box agents. Therefore, it is important to set clear expectations
|
|
56
|
+
* for end users and provide guidance on how to interact with the assistant to help mitigate these issues. Some ways to do this include:
|
|
57
|
+
*
|
|
58
|
+
* - Provide [suggestedPrompts](https://developers.arcgis.com/javascript/latest/references/ai-components/components/arcgis-assistant/#suggestedPrompts). This helps users understand the bounds of the assistant
|
|
59
|
+
* and gives them an idea of how to phrase questions to get the best results.
|
|
60
|
+
* - Use the [entryMessage](https://developers.arcgis.com/javascript/latest/references/ai-components/components/arcgis-assistant/#entryMessage) property to provide an entry message with instructions and guidance.
|
|
61
|
+
*
|
|
47
62
|
* @slot - This is the default slot
|
|
48
63
|
* @slot [header-actions-end] - Slot for adding actions to the end of the header.
|
|
49
64
|
* @slot [entry-message] - Slot for adding a welcome or entry message on load.
|
|
@@ -51,6 +66,8 @@ import type { ArcgisMap as ArcgisMap } from "@arcgis/map-components/components/a
|
|
|
51
66
|
* @slot [footer-content] - Slot for adding content to the footer.
|
|
52
67
|
* @since 5.0
|
|
53
68
|
* @beta
|
|
69
|
+
* @see [Intro to building agentic mapping applications](https://developers.arcgis.com/javascript/latest/agentic-apps/ai-introduction/)
|
|
70
|
+
* @see [AI Assistant component sample](https://developers.arcgis.com/javascript/latest/sample-code/ai-assistant/)
|
|
54
71
|
* @see [arcgis-assistant-data-exploration-agent](https://developers.arcgis.com/javascript/latest/references/ai-components/components/arcgis-assistant-data-exploration-agent/)
|
|
55
72
|
* @see [arcgis-assistant-navigation-agent](https://developers.arcgis.com/javascript/latest/references/ai-components/components/arcgis-assistant-navigation-agent/)
|
|
56
73
|
* @see [arcgis-assistant-help-agent](https://developers.arcgis.com/javascript/latest/references/ai-components/components/arcgis-assistant-help-agent/)
|
|
@@ -59,7 +76,7 @@ export abstract class ArcgisAssistant extends LitElement {
|
|
|
59
76
|
/** @internal */
|
|
60
77
|
protected _messages: { assistantLabel: string; } & T9nMeta<{ assistantLabel: string; }>;
|
|
61
78
|
/**
|
|
62
|
-
* When `true`, enables the copy action that when clicked copies the content of the message to the clipboard. This can be helpful for users to easily copy and share
|
|
79
|
+
* When `true`, enables the copy action that, when clicked, copies the content of the message to the clipboard. This can be helpful for users to easily copy and share
|
|
63
80
|
* information provided by the assistant, such as a summary of findings, a set of instructions, or any other relevant details. Enabling this property can enhance the user experience by providing a convenient way for users to capture and utilize the information generated by the assistant.
|
|
64
81
|
*
|
|
65
82
|
* @default false
|
|
@@ -90,7 +107,7 @@ export abstract class ArcgisAssistant extends LitElement {
|
|
|
90
107
|
*/
|
|
91
108
|
accessor description: string | undefined;
|
|
92
109
|
/**
|
|
93
|
-
* The
|
|
110
|
+
* The instructions to display when the assistant is first loaded. This is intended to be a welcome or entry message that
|
|
94
111
|
* provides guidance to users on how to interact with the assistant. Once the user submits their first message,
|
|
95
112
|
* the entry message will be closed and replaced with the chat interface. You can use this property to provide
|
|
96
113
|
* instructions, suggest prompts, or simply welcome users to the assistant.
|
|
@@ -134,7 +151,7 @@ export abstract class ArcgisAssistant extends LitElement {
|
|
|
134
151
|
*
|
|
135
152
|
* For applications where the primary interface is the assistant, this heading could also be used as the
|
|
136
153
|
* application title. In cases where the assistant could be collapsed or is a secondary interface to a standard
|
|
137
|
-
* GUI
|
|
154
|
+
* GUI, the heading should be more specific to the assistant's function to avoid confusion with the overall
|
|
138
155
|
* application title.
|
|
139
156
|
*
|
|
140
157
|
* @example
|
|
@@ -144,7 +161,7 @@ export abstract class ArcgisAssistant extends LitElement {
|
|
|
144
161
|
* @example
|
|
145
162
|
* ```js
|
|
146
163
|
* const assistant = document.querySelector("arcgis-assistant");
|
|
147
|
-
* assistant.heading = "
|
|
164
|
+
* assistant.heading = "Zoning Assistant";
|
|
148
165
|
* ```
|
|
149
166
|
*/
|
|
150
167
|
accessor heading: string | undefined;
|
|
@@ -196,7 +213,7 @@ export abstract class ArcgisAssistant extends LitElement {
|
|
|
196
213
|
/**
|
|
197
214
|
* The reference element to the map that provides context for the assistant and its agents. Currently,
|
|
198
215
|
* this is only scoped to `arcgis-map` elements. This is required when ArcGIS agents are registered to the assistant.
|
|
199
|
-
* For example, this allows the navigation agent to
|
|
216
|
+
* For example, this allows the navigation agent to execute a map navigation tool for a specific map.
|
|
200
217
|
*
|
|
201
218
|
* @example
|
|
202
219
|
* ```html
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
|
|
2
2
|
import { c as _ } from "../../chunks/runtime.js";
|
|
3
|
-
import { css as
|
|
4
|
-
import
|
|
3
|
+
import { css as b, html as p } from "lit";
|
|
4
|
+
import v from "@arcgis/core/core/Collection.js";
|
|
5
5
|
import { whenOnce as w, watch as E, when as C } from "@arcgis/core/core/reactiveUtils.js";
|
|
6
6
|
import k from "@arcgis/core/portal/Portal.js";
|
|
7
7
|
import { LitElement as $, createEvent as n } from "@arcgis/lumina";
|
|
@@ -10,13 +10,13 @@ import { Orchestrator as S } from "@arcgis/ai-orchestrator";
|
|
|
10
10
|
import L from "@arcgis/core/core/Accessor.js";
|
|
11
11
|
import { property as h, subclass as P } from "@arcgis/core/core/accessorSupport/decorators.js";
|
|
12
12
|
import { g as I } from "../../chunks/utils2.js";
|
|
13
|
-
import { u as
|
|
14
|
-
import { rethrowError as
|
|
15
|
-
const
|
|
16
|
-
var
|
|
13
|
+
import { u as M } from "../../chunks/useT9n.js";
|
|
14
|
+
import { rethrowError as O } from "@arcgis/toolkit/log";
|
|
15
|
+
const R = b`:host{display:block;width:var(--arcgis-internal-panel-width, 100%);height:var(--arcgis-internal-expand-max-height, 100%)}`;
|
|
16
|
+
var x = Object.defineProperty, A = Object.getOwnPropertyDescriptor, l = (c, e, t, i) => {
|
|
17
17
|
for (var s = i > 1 ? void 0 : i ? A(e, t) : e, r = c.length - 1, o; r >= 0; r--)
|
|
18
18
|
(o = c[r]) && (s = (i ? o(e, t, s) : o(s)) || s);
|
|
19
|
-
return i && s &&
|
|
19
|
+
return i && s && x(e, t, s), s;
|
|
20
20
|
};
|
|
21
21
|
let a = class extends L {
|
|
22
22
|
constructor(c) {
|
|
@@ -78,18 +78,18 @@ let a = class extends L {
|
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
80
|
case "interrupt": {
|
|
81
|
-
const { kind: o, message:
|
|
81
|
+
const { kind: o, message: g, metadata: d } = s.interrupt, u = Array.isArray(d) ? [...d] : [], f = (() => {
|
|
82
82
|
switch (o) {
|
|
83
83
|
case "booleanChoice":
|
|
84
|
-
return { type: "boolean-choice", message:
|
|
84
|
+
return { type: "boolean-choice", message: g, options: u };
|
|
85
85
|
case "singleSelection":
|
|
86
|
-
return { type: "single-select", message:
|
|
86
|
+
return { type: "single-select", message: g, options: u };
|
|
87
87
|
case "multipleSelection":
|
|
88
|
-
return { type: "multi-select", message:
|
|
88
|
+
return { type: "multi-select", message: g, options: u };
|
|
89
89
|
case "textInput":
|
|
90
|
-
return { type: "text-input", message:
|
|
90
|
+
return { type: "text-input", message: g };
|
|
91
91
|
default:
|
|
92
|
-
return { type: o, message:
|
|
92
|
+
return { type: o, message: g, options: u };
|
|
93
93
|
}
|
|
94
94
|
})();
|
|
95
95
|
this._set("processingStep", "Waiting for user input..."), yield { type: "interrupt", payload: f, runId: r };
|
|
@@ -141,9 +141,10 @@ l([
|
|
|
141
141
|
a = l([
|
|
142
142
|
P("OrchestratorController")
|
|
143
143
|
], a);
|
|
144
|
-
|
|
144
|
+
const z = "Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.", H = "Embeddings not found for this web map.", j = "https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings";
|
|
145
|
+
class D extends $ {
|
|
145
146
|
constructor() {
|
|
146
|
-
super(...arguments), this._messages =
|
|
147
|
+
super(...arguments), this._messages = M({ blocking: !0 }), this.#e = m(), this.#t = m(), this.#s = null, this.#o = /* @__PURE__ */ new Map(), this.#r = k.getDefault(), this.#i = (e) => {
|
|
147
148
|
e.stopPropagation(), this.arcgisInterruptCancel.emit(), this.orchestrator?.cancelInterrupt(), this._interrupt = null;
|
|
148
149
|
}, this.#a = (e) => {
|
|
149
150
|
e.stopPropagation();
|
|
@@ -163,13 +164,13 @@ class z extends $ {
|
|
|
163
164
|
e.stopPropagation();
|
|
164
165
|
const t = e.detail;
|
|
165
166
|
this.arcgisFeedback.emit(t);
|
|
166
|
-
}, this._orchestratorController = null, this._interrupt = null, this._error = null, this.messages = new
|
|
167
|
+
}, this._orchestratorController = null, this._interrupt = null, this._error = null, this.messages = new v([]), this.referenceElement = null, this.suggestedPrompts = [], this.feedbackEnabled = !1, this.keepSuggestedPrompts = !1, this.logEnabled = !1, this.copyEnabled = !1, this.arcgisCancel = n(), this.arcgisError = n(), this.arcgisFeedback = n(), this.arcgisInterrupt = n(), this.arcgisInterruptCancel = n(), this.arcgisInterruptSubmit = n(), this.arcgisReady = n(), this.arcgisSubmit = n();
|
|
167
168
|
}
|
|
168
169
|
static {
|
|
169
170
|
this.properties = { _orchestratorController: 16, _interrupt: 16, _error: 16, _user: 16, messages: 0, orchestrator: 32, entryMessage: 1, heading: 1, description: 1, referenceElement: 1, suggestedPrompts: 0, feedbackEnabled: 5, keepSuggestedPrompts: 5, logEnabled: 5, copyEnabled: 5 };
|
|
170
171
|
}
|
|
171
172
|
static {
|
|
172
|
-
this.styles =
|
|
173
|
+
this.styles = R;
|
|
173
174
|
}
|
|
174
175
|
#e;
|
|
175
176
|
#t;
|
|
@@ -192,7 +193,7 @@ class z extends $ {
|
|
|
192
193
|
view: e?.view
|
|
193
194
|
}), await this._orchestratorController.load(), !0) : (this._error = "No agents found.", !1);
|
|
194
195
|
} catch (e) {
|
|
195
|
-
return this._error = e?.message ?? "Error initializing orchestrator.",
|
|
196
|
+
return this._error = e?.message ?? "Error initializing orchestrator.", O(this)(e), !1;
|
|
196
197
|
}
|
|
197
198
|
}
|
|
198
199
|
get _user() {
|
|
@@ -201,12 +202,12 @@ class z extends $ {
|
|
|
201
202
|
get orchestrator() {
|
|
202
203
|
return this._orchestratorController?.orchestrator;
|
|
203
204
|
}
|
|
204
|
-
register(e) {
|
|
205
|
-
this.#o.set(e.agent.id, e);
|
|
206
|
-
}
|
|
207
205
|
async clearChatHistory() {
|
|
208
206
|
this._reset(), this._orchestratorController?.clearChatHistory();
|
|
209
207
|
}
|
|
208
|
+
register(e) {
|
|
209
|
+
this.#o.set(e.agent.id, e);
|
|
210
|
+
}
|
|
210
211
|
async submitMessage(e) {
|
|
211
212
|
const t = e.trim();
|
|
212
213
|
if (!t || (this.messages.push({
|
|
@@ -254,7 +255,7 @@ class z extends $ {
|
|
|
254
255
|
});
|
|
255
256
|
return queueMicrotask(() => {
|
|
256
257
|
this.#h().then((t) => {
|
|
257
|
-
t ? this.arcgisReady.emit() : this.arcgisError.emit(new Error(this._error
|
|
258
|
+
t ? this.arcgisReady.emit() : this._error && this.arcgisError.emit(new Error(this._error));
|
|
258
259
|
});
|
|
259
260
|
}), () => {
|
|
260
261
|
e.remove(), this.#t.value?.removeEventListener("arcgisSubmit", this.#a), this.#t.value?.removeEventListener("arcgisCancel", this.#i), this.#e.value?.removeEventListener("arcgisSubmit", this.#n), this.#e.value?.removeEventListener("arcgisCancel", this.#l), this.#e.value?.removeEventListener("arcgisFeedback", this.#c), this._orchestratorController?.destroy(), this._orchestratorController = null;
|
|
@@ -264,11 +265,14 @@ class z extends $ {
|
|
|
264
265
|
_reset() {
|
|
265
266
|
this.#s?.abort(), this._interrupt = null, this.messages.removeAll(), this._error = null;
|
|
266
267
|
}
|
|
268
|
+
_renderErrorNotice() {
|
|
269
|
+
return this._error ? p`<calcite-notice closable slot=entry-message open kind=danger icon width=full>${this._error === z ? p`<div slot=message>${H}</div><calcite-link slot=link .href=${j} target=_blank title="Learn about web map embeddings">Read more</calcite-link>` : p`<div slot=message>${this._error}</div>`}</calcite-notice>` : null;
|
|
270
|
+
}
|
|
267
271
|
render() {
|
|
268
|
-
return
|
|
272
|
+
return p`<arcgis-assistant-shell .loading=${!this._orchestratorController && !this._error || this._orchestratorController?.loading} .heading=${this.heading ?? this._messages.assistantLabel} .description=${this.description} .entryMessage=${this.entryMessage} .entryMessageClosed=${this.messages.length > 0} .awaitingResponse=${this._orchestratorController?.processing} .suggestedPrompts=${this.suggestedPrompts} .messages=${this.messages} ${y(this.#e)}>${this._renderErrorNotice()}${this._interrupt ? p`<arcgis-assistant-interrupt slot=entry-message .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${y(this.#t)}></arcgis-assistant-interrupt>` : null}<arcgis-assistant-chat .loading=${this._orchestratorController?.processing} .loadingMessage=${this._orchestratorController?.processingStep || ""} .messages=${this.messages} .user=${this._user} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled}><slot></slot></arcgis-assistant-chat><slot name=header-actions-end slot=header-actions-end></slot>${this.entryMessage ? null : p`<slot name=entry-message slot=entry-message></slot>`}<slot name=entry-actions-start slot=entry-actions-start></slot><slot name=footer-content slot=footer-content></slot></arcgis-assistant-shell>`;
|
|
269
273
|
}
|
|
270
274
|
}
|
|
271
|
-
_("arcgis-assistant",
|
|
275
|
+
_("arcgis-assistant", D);
|
|
272
276
|
export {
|
|
273
|
-
|
|
277
|
+
D as ArcgisAssistant
|
|
274
278
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import "../arcgis-assistant-shell/index.js";
|
|
2
1
|
import "@esri/calcite-components/components/calcite-notice";
|
|
2
|
+
import "@esri/calcite-components/components/calcite-link";
|
|
3
|
+
import "../arcgis-assistant-shell/index.js";
|
|
3
4
|
import "../arcgis-assistant-interrupt/index.js";
|
|
4
5
|
import "../arcgis-assistant-chat/index.js";
|
|
5
6
|
export * from "./customElement.js";
|
|
@@ -14,6 +14,9 @@ import type { PublicLitElement as LitElement } from "@arcgis/lumina";
|
|
|
14
14
|
* Use the [utils](https://developers.arcgis.com/javascript/latest/references/ai-components/utils/index/) module for helper functions and types related to building custom agents, including the `AgentRegistration`
|
|
15
15
|
* type and functions for making LLM calls, managing agent state, and setting up human-in-the-loop workflows.
|
|
16
16
|
*
|
|
17
|
+
* > We recommend that developers building custom agents have experience working with LLMs and generative AI, and have a good
|
|
18
|
+
* understanding of the limitations of these technologies when building applications for end users.
|
|
19
|
+
*
|
|
17
20
|
* This is an unrendered component that must be added as a child of the `arcgis-assistant` component in either HTML or JavaScript.
|
|
18
21
|
*
|
|
19
22
|
* ```html
|
|
@@ -45,7 +48,12 @@ import type { PublicLitElement as LitElement } from "@arcgis/lumina";
|
|
|
45
48
|
* @beta
|
|
46
49
|
* @see [arcgis-assistant](https://developers.arcgis.com/javascript/latest/references/ai-components/components/arcgis-assistant/)
|
|
47
50
|
* @see [LangGraph documentation](https://docs.langchain.com/oss/javascript/langgraph/overview)
|
|
48
|
-
* @see [Custom
|
|
51
|
+
* @see [Custom agents guide](https://developers.arcgis.com/javascript/latest/agentic-apps/ai-custom-agents/)
|
|
52
|
+
* @see [AI Assistant component sample](https://developers.arcgis.com/javascript/latest/sample-code/ai-assistant/)
|
|
53
|
+
* @see [AgentRegistration](https://developers.arcgis.com/javascript/latest/references/ai-components/utils/index/#AgentRegistration)
|
|
54
|
+
* @see [invokeStructuredPrompt](https://developers.arcgis.com/javascript/latest/references/ai-components/utils/index/#invokeStructuredPrompt)
|
|
55
|
+
* @see [invokeToolPrompt](https://developers.arcgis.com/javascript/latest/references/ai-components/utils/index/#invokeToolPrompt)
|
|
56
|
+
* @see [invokeTextPrompt](https://developers.arcgis.com/javascript/latest/references/ai-components/utils/index/#invokeTextPrompt)
|
|
49
57
|
*/
|
|
50
58
|
export abstract class ArcgisAssistantAgent<TContext = Record<string, unknown>> extends LitElement {
|
|
51
59
|
/**
|
|
@@ -56,10 +64,12 @@ export abstract class ArcgisAssistantAgent<TContext = Record<string, unknown>> e
|
|
|
56
64
|
* This is an agent defined in the client and can be invoked by the assistant from the browser to perform specific tasks
|
|
57
65
|
* using functions defined in the client.
|
|
58
66
|
*
|
|
59
|
-
* See the [Custom Agents guide](https://developers.arcgis.com/javascript/latest/agentic-apps/ai-custom-agents/) for more instructions
|
|
67
|
+
* See the [Custom Agents guide](https://developers.arcgis.com/javascript/latest/agentic-apps/ai-custom-agents/) for more instructions
|
|
68
|
+
* and links to samples demonstrating how to create custom agents.
|
|
60
69
|
*
|
|
61
70
|
* @required
|
|
62
71
|
* @see [LangGraph documentation](https://docs.langchain.com/oss/javascript/langgraph/overview)
|
|
72
|
+
* @see [Custom agents guide](https://developers.arcgis.com/javascript/latest/agentic-apps/ai-custom-agents/)
|
|
63
73
|
* @example
|
|
64
74
|
* ```js
|
|
65
75
|
* // An example graph that updates a component property and replies with a confirmation message
|
|
@@ -70,9 +70,14 @@ import type { ArcgisMap as ArcgisMap } from "@arcgis/map-components/components/a
|
|
|
70
70
|
* - "Show me the population of cities in this map on a graph." (the data exploration agent can only
|
|
71
71
|
* provide answers in text form, not visualizations)
|
|
72
72
|
*
|
|
73
|
+
* > Due to the non-deterministic nature of generative AI, there may be inaccuracies or unexpected behavior when using the
|
|
74
|
+
* out-of-the-box agents.
|
|
75
|
+
*
|
|
73
76
|
* @since 5.0
|
|
74
77
|
* @beta
|
|
75
78
|
* @see [arcgis-assistant](https://developers.arcgis.com/javascript/latest/references/ai-components/components/arcgis-assistant/)
|
|
79
|
+
* @see [Intro to building agentic mapping applications](https://developers.arcgis.com/javascript/latest/agentic-apps/ai-introduction/)
|
|
80
|
+
* @see [AI Assistant component sample](https://developers.arcgis.com/javascript/latest/sample-code/ai-assistant/)
|
|
76
81
|
*/
|
|
77
82
|
export abstract class ArcgisAssistantDataExplorationAgent extends LitElement {
|
|
78
83
|
/**
|
|
@@ -32,8 +32,7 @@ import type { ArcgisMap as ArcgisMap } from "@arcgis/map-components/components/a
|
|
|
32
32
|
*
|
|
33
33
|
* - "What kind of questions can I ask?"
|
|
34
34
|
* - "What layers are in this map?"
|
|
35
|
-
* - "What
|
|
36
|
-
* - "How do I use the navigation agent?"
|
|
35
|
+
* - "What kind of data can I ask questions about?"
|
|
37
36
|
*
|
|
38
37
|
* The following are examples of the types of questions that fall outside the bounds of the
|
|
39
38
|
* help agent and should therefore be avoided:
|
|
@@ -43,14 +42,19 @@ import type { ArcgisMap as ArcgisMap } from "@arcgis/map-components/components/a
|
|
|
43
42
|
* - "How do I bake a cake?"
|
|
44
43
|
* - "How does map navigation work in ArcGIS?"
|
|
45
44
|
*
|
|
45
|
+
* > Due to the non-deterministic nature of generative AI, there may be inaccuracies or unexpected behavior when using the
|
|
46
|
+
* out-of-the-box agents.
|
|
47
|
+
*
|
|
46
48
|
* @since 5.0
|
|
47
49
|
* @beta
|
|
48
50
|
* @see [arcgis-assistant](https://developers.arcgis.com/javascript/latest/references/ai-components/components/arcgis-assistant/)
|
|
51
|
+
* @see [Intro to building agentic mapping applications](https://developers.arcgis.com/javascript/latest/agentic-apps/ai-introduction/)
|
|
52
|
+
* @see [AI Assistant component sample](https://developers.arcgis.com/javascript/latest/sample-code/ai-assistant/)
|
|
49
53
|
*/
|
|
50
54
|
export abstract class ArcgisAssistantHelpAgent extends LitElement {
|
|
51
55
|
/**
|
|
52
56
|
* The reference element to the map that provides context for the help agent. Currently,
|
|
53
|
-
* this is only scoped to `arcgis-map` elements. This shows the help agent which
|
|
57
|
+
* this is only scoped to `arcgis-map` elements. This shows the help agent which map for which to
|
|
54
58
|
* provide assistance. This allows users to ask questions about the specific map provided to the agent.
|
|
55
59
|
*
|
|
56
60
|
* Setting this property is not necessary if you set the reference element on the parent
|
|
@@ -27,11 +27,11 @@ import type { ArcgisMap as ArcgisMap } from "@arcgis/map-components/components/a
|
|
|
27
27
|
*
|
|
28
28
|
* The navigation agent provides the following capabilities related to map navigation:
|
|
29
29
|
*
|
|
30
|
-
* - **Geocoding** - Navigate to an address using Esri's World Geocoding Service
|
|
30
|
+
* - **Geocoding** - Navigate to an address using Esri's World Geocoding Service.
|
|
31
31
|
* - **Go to extent** - Navigate to the extent of a bookmark in the map, the home extent of the web map,
|
|
32
32
|
* or the extent of a layer.
|
|
33
|
-
* - **Go to features** -
|
|
34
|
-
* - **Go to viewpoint** -
|
|
33
|
+
* - **Go to features** - Navigate to a specified feature or set of features.
|
|
34
|
+
* - **Go to viewpoint** - Navigate to a specified viewpoint, which can include center, zoom, and/or
|
|
35
35
|
* rotation.
|
|
36
36
|
*
|
|
37
37
|
* ### Example questions
|
|
@@ -39,7 +39,7 @@ import type { ArcgisMap as ArcgisMap } from "@arcgis/map-components/components/a
|
|
|
39
39
|
* The following are example questions a user can ask within the bounds of the navigation agent:
|
|
40
40
|
*
|
|
41
41
|
* - "Go to the Golden Gate Bridge"
|
|
42
|
-
* - "Zoom to a 1
|
|
42
|
+
* - "Zoom to a 1 to 24,000 scale"
|
|
43
43
|
* - "Zoom in"
|
|
44
44
|
* - "Go to the parks layer"
|
|
45
45
|
*
|
|
@@ -50,14 +50,19 @@ import type { ArcgisMap as ArcgisMap } from "@arcgis/map-components/components/a
|
|
|
50
50
|
* - "Make this map 3D and tilt the view to a 45 degree angle" (3D navigation is currently not supported)
|
|
51
51
|
* - "Where am I?" (the navigation agent does not have access to the user's location)
|
|
52
52
|
*
|
|
53
|
+
* > Due to the non-deterministic nature of generative AI, there may be inaccuracies or unexpected behavior when using the
|
|
54
|
+
* out-of-the-box agents.
|
|
55
|
+
*
|
|
53
56
|
* @since 5.0
|
|
54
57
|
* @beta
|
|
55
58
|
* @see [arcgis-assistant](https://developers.arcgis.com/javascript/latest/references/ai-components/components/arcgis-assistant/)
|
|
59
|
+
* @see [Intro to building agentic mapping applications](https://developers.arcgis.com/javascript/latest/agentic-apps/ai-introduction/)
|
|
60
|
+
* @see [AI Assistant component sample](https://developers.arcgis.com/javascript/latest/sample-code/ai-assistant/)
|
|
56
61
|
*/
|
|
57
62
|
export abstract class ArcgisAssistantNavigationAgent extends LitElement {
|
|
58
63
|
/**
|
|
59
64
|
* The reference element to the map that provides context for the navigation agent. Currently,
|
|
60
|
-
* this is only scoped to `arcgis-map` elements. This shows the navigation agent which
|
|
65
|
+
* this is only scoped to `arcgis-map` elements. This shows the navigation agent which map on which to
|
|
61
66
|
* perform navigation actions. This is required for the navigation agent to function properly.
|
|
62
67
|
*
|
|
63
68
|
* Setting this property is not necessary if you set the reference element on the parent
|