@arcgis/ai-components 5.0.0-next.139 → 5.0.0-next.140
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/{QS6457MX.js → 25PBMZHS.js} +2 -2
- package/dist/cdn/2GEDY3GN.js +134 -0
- package/dist/cdn/{B4GME3XE.js → 2IHKAUDX.js} +2 -2
- package/dist/cdn/{3FXMITU4.js → 2Q7VQTLU.js} +2 -2
- package/dist/cdn/{HBQRKPCT.js → 2WYLKFGP.js} +2 -2
- package/dist/cdn/{GVW52DIA.js → 4CWTGTNY.js} +2 -2
- package/dist/cdn/{HA4E5AC2.js → 56XBBDA6.js} +2 -2
- package/dist/cdn/5ZLN2JFL.js +4 -0
- package/dist/cdn/{72JQRHOG.js → 6C35AMCX.js} +2 -2
- package/dist/cdn/{CLP7HMEW.js → 7QHFU3KO.js} +2 -2
- package/dist/cdn/{JLY2B5AJ.js → AAVZOXSC.js} +2 -2
- package/dist/cdn/{UJTPKXBP.js → ASN7ZWEH.js} +33 -33
- package/dist/cdn/{3QTHBF2F.js → AUYVELDF.js} +2 -2
- package/dist/cdn/{LZRFQZSB.js → AXRNMFPI.js} +1 -1
- package/dist/cdn/{E3XZJC24.js → FDJXRQUK.js} +2 -2
- package/dist/cdn/{RYLC4RYQ.js → FWPGJBO5.js} +2 -2
- package/dist/cdn/{IXKVVRW7.js → H3KORP5U.js} +1 -1
- package/dist/cdn/IXX5ULW6.js +4 -0
- package/dist/cdn/{CFFB4JKG.js → KNSCW6SS.js} +2 -2
- package/dist/cdn/{RQY4555K.js → KSVU7VLD.js} +2 -2
- package/dist/cdn/{NSMIL2SL.js → LGW5HXAG.js} +1 -1
- package/dist/cdn/{RKR7CXWK.js → LYVHBLUQ.js} +2 -2
- package/dist/cdn/{WCFPWMZ6.js → MTNAHLA4.js} +2 -2
- package/dist/cdn/{LWPYJABR.js → N3QH6TX7.js} +2 -2
- package/dist/cdn/{6JDNCSC3.js → N5EBFHDA.js} +2 -2
- package/dist/cdn/{42IBUNOA.js → O2ASMWKU.js} +2 -2
- package/dist/cdn/{IB7MSLQX.js → PC6FKJYU.js} +2 -2
- package/dist/cdn/{UPQ7HXXV.js → QSJZ4GJQ.js} +2 -2
- package/dist/cdn/{TJJX6UKQ.js → RBSKMLWF.js} +2 -2
- package/dist/cdn/SNPQLJY2.js +6 -0
- package/dist/cdn/{YKVAJ4AV.js → TAK5SQLW.js} +2 -2
- package/dist/cdn/{6UMV2K64.js → UNM6E7R2.js} +2 -2
- package/dist/cdn/{GNIBW6BM.js → VWVB7I6H.js} +2 -2
- package/dist/cdn/{DBKCPK5I.js → WH2GVTFQ.js} +3 -3
- package/dist/cdn/{Z5SVRVZN.js → WJVFWLIR.js} +2 -2
- package/dist/cdn/{5BR5YVZ6.js → WPLOP4RM.js} +2 -2
- package/dist/cdn/{RHI6IEK3.js → WQAFSEHQ.js} +2 -2
- package/dist/cdn/{D532Z7XU.js → XGRSVMCO.js} +2 -2
- package/dist/cdn/{TFW2C2V3.js → YLSYEE4Q.js} +2 -2
- package/dist/cdn/index.js +2 -2
- package/dist/chunks/runtime.js +1 -1
- package/dist/chunks/useT9n.js +1 -1
- package/dist/chunks/utils.js +1 -1
- package/dist/chunks/utils2.js +1 -1
- package/dist/components/arcgis-assistant/customElement.js +1 -1
- package/dist/components/arcgis-assistant-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-chat/customElement.js +1 -1
- package/dist/components/arcgis-assistant-chat-card/customElement.js +1 -1
- package/dist/components/arcgis-assistant-chat-card-content/customElement.js +1 -1
- package/dist/components/arcgis-assistant-chat-entry/customElement.js +1 -1
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-interrupt/customElement.js +1 -1
- package/dist/components/arcgis-assistant-layer-filter-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-layer-query-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-shell/customElement.js +1 -1
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/index.js +1 -1
- package/dist/loader.js +1 -1
- package/package.json +7 -7
- package/dist/cdn/BN3XKJOK.js +0 -6
- package/dist/cdn/ILSPDWE2.js +0 -4
- package/dist/cdn/X5OTOFCC.js +0 -134
- package/dist/cdn/YQJWHNVD.js +0 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
2
2
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
3
|
-
v5.0.0-next.
|
|
4
|
-
import"./
|
|
3
|
+
v5.0.0-next.140 */
|
|
4
|
+
import"./LGW5HXAG.js";var e=`# Navigation Tool Instructions
|
|
5
5
|
|
|
6
6
|
CRITICAL: You are FORBIDDEN from making multiple tool calls. You MUST make exactly ONE tool call.
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
2
2
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
3
|
-
v5.0.0-next.
|
|
4
|
-
import"./
|
|
3
|
+
v5.0.0-next.140 */
|
|
4
|
+
import"./LGW5HXAG.js";var e=`## Navigation Agent - Tool Intent Classifier
|
|
5
5
|
|
|
6
6
|
You are an assistant that classifies user intent for navigation agent.
|
|
7
7
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
2
2
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
3
|
-
v5.0.0-next.
|
|
4
|
-
import{g as i,h as t,p as r,q as e,t as o}from"./
|
|
3
|
+
v5.0.0-next.140 */
|
|
4
|
+
import{g as i,h as t,p as r,q as e,t as o}from"./SNPQLJY2.js";import"./LGW5HXAG.js";var c=i`.assistant-chat-card-content__skeleton-block{display:flex;flex-direction:column;gap:var(--calcite-spacing-sm);width:100%}.assistant-chat-card-content__skeleton-text{display:block;height:.95em;border-radius:6px;background:linear-gradient(90deg,color-mix(in srgb,var(--calcite-color-foreground-2) 65%,transparent),color-mix(in srgb,var(--calcite-color-foreground-3) 85%,transparent),color-mix(in srgb,var(--calcite-color-foreground-2) 65%,transparent));background-size:200% 100%;animation:assistant-chat-card-content-shimmer 1.2s ease-in-out infinite;width:85%}.assistant-chat-card-content__skeleton-text:last-child{width:70%}@keyframes assistant-chat-card-content-shimmer{0%{background-position:-150% 0}to{background-position:150% 0}}@media(prefers-reduced-motion){.assistant-chat-card-content__skeleton-text{animation:none}}.assistant-chat-card-content__text-container{padding:var(--calcite-spacing-sm);display:flex;flex-direction:column;gap:var(--calcite-spacing-sm);color:var(--calcite-color-text-1)}.assistant-chat-card-content__text-loading{font-style:italic;word-wrap:break-word;word-break:break-all;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical}.assistant-chat-card-content__error-notice{padding:var(--calcite-spacing-sm)}`,n="assistant-chat-card-content",a={textLoading:`${n}__text-loading`,skeletonBlock:`${n}__skeleton-block`,skeletonText:`${n}__skeleton-text`},s=class extends r{constructor(){super(...arguments),this.loading=!1,this.type="text"}static{this.properties={loading:5,type:1,content:1,loadingMessage:1}}static{this.styles=c}_renderText(){return t`<div class="assistant-chat-card-content__text-container"><div><span class=${e(this.loading?a.textLoading:void 0)}>${this.loading?this.loadingMessage:this.content}</span></div>${this.loading?t`<div class=${e(a.skeletonBlock)}><span class=${e(a.skeletonText)}></span><span class=${e(a.skeletonText)}></span></div>`:null}</div>`}_renderError(){return t`<calcite-notice class="assistant-chat-card-content__error-notice" open icon kind=warning width=auto><div slot=message>${this.content}</div></calcite-notice>`}render(){switch(this.type){case"text":return this._renderText();case"error":return this._renderError();default:return t`<p>Unsupported content type</p>`}}};o("arcgis-assistant-chat-card-content",s);export{s as ArcgisAssistantChatCardContent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
2
2
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
3
|
-
v5.0.0-next.
|
|
4
|
-
import{a as c}from"./
|
|
3
|
+
v5.0.0-next.140 */
|
|
4
|
+
import{a as c}from"./XGRSVMCO.js";import"./H3KORP5U.js";import{g as e,h as t,p as s,t as i}from"./SNPQLJY2.js";import"./LGW5HXAG.js";var r=e`.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);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;font-size:var(--calcite-font-size-sm);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1);width:100%;overflow:auto}.assistant-chat-card__footer-start{display:flex;gap:var(--calcite-spacing-xxs)}@media(min-width:1280px){.assistant-chat-card__prompt-container,.assistant-chat-card__response-container{max-width:80%}}`,a=class extends s{constructor(){super(...arguments),this._messages=c({blocking:!0}),this._showLog=!1,this.loading=!1,this.type="prompt",this.feedbackDisabled=!1,this.timestampDisabled=!1}static{this.properties={_showLog:16,loading:5,type:1,feedbackDisabled:5,timestampDisabled:5,content:1,loadingMessage:1,log:1,error:1,user:1}}static{this.styles=r}_renderLog(){return this.log&&this._showLog?t`<div class="assistant-chat-card__log-container"><pre class="assistant-chat-card__log">${this.log}</pre></div>`:null}_renderThumbsUpButton(){return t`<calcite-action id=action-thumbs-up icon=thumbs-up scale=s appearance=transparent @click=${()=>{}} 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 appearance=transparent @click=${()=>{}} 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.feedbackDisabled&&!this.error?t`<div class="assistant-chat-card__feedback-actions">${this._renderThumbsUpButton()}${this._renderThumbsDownButton()}</div>`:null}_renderCopyButton(){return this.error?null:t`<calcite-action id=action-copy icon=copy-to-clipboard scale=s appearance=transparent @click=${async()=>{try{this.content&&await navigator.clipboard.writeText(this.content)}catch(n){console.error("Failed to copy text to clipboard:",n)}}} text></calcite-action><calcite-tooltip reference-element=action-copy overlay-positioning=fixed placement=bottom><span>${this._messages.copyButtonLabel}</span></calcite-tooltip>`}_renderLogButton(){return this.log?t`<calcite-action id=action-log icon=access-string-results scale=s appearance=transparent @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"><slot name=footer-start class="assistant-chat-card__footer-start">${this._renderCopyButton()}${this._renderLogButton()}</slot>${this._renderFeedback()}</div>`}render(){return this.type==="prompt"?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"></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>`}};i("arcgis-assistant-chat-card",a);export{a as ArcgisAssistantChatCard};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
2
2
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
3
|
-
v5.0.0-next.
|
|
4
|
-
import d from"./
|
|
3
|
+
v5.0.0-next.140 */
|
|
4
|
+
import d from"./WH2GVTFQ.js";import{a as s,b as a}from"./KSVU7VLD.js";import c from"./2GEDY3GN.js";import"./AXRNMFPI.js";import"./H3KORP5U.js";import{p as r,t as e}from"./SNPQLJY2.js";import b from"./6C35AMCX.js";import"./ASN7ZWEH.js";import"./LGW5HXAG.js";export default $arcgis.t(([,,{c:i}])=>{var t=class extends r{constructor(){super(...arguments),this.agent=i}static{this.properties={referenceElement:1}}#t;getContext(){if(!this.#t)throw new Error("arcgis-assistant-layer-filter-agent requires a mapView");return{mapView:this.#t}}async load(){this.#t=await s(this,"arcgis-assistant-layer-filter-agent"),a(this)}};e("arcgis-assistant-layer-filter-agent",t);return t},b,c,d)
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
2
|
+
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
3
|
+
v5.0.0-next.140 */
|
|
4
|
+
import a from"./6C35AMCX.js";import"./ASN7ZWEH.js";import"./LGW5HXAG.js";export default $arcgis.t(([{m:a,n:b}])=>{return{FewShotChatMessagePromptTemplate:b,FewShotPromptTemplate:a}},a)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
2
2
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
3
|
-
v5.0.0-next.
|
|
4
|
-
import{$ as
|
|
3
|
+
v5.0.0-next.140 */
|
|
4
|
+
import{$ as Ge,$b as C,A as ke,B as Ee,Bb as U,C as M,D as Ae,E as Ie,F as $e,G as Ne,H as ze,Hb as B,I as Re,J as q,K,M as P,N as T,O as le,P as ue,Pb as pe,Q as w,Qb as me,R as Ue,S as Be,Sb as j,T as E,Tb as Q,U as y,Ub as X,V as A,W as De,X as He,Y as I,Z as $,Zb as d,_ as We,_b as Y,aa as x,ac as h,ba as N,bc as D,ca as Je,da as qe,ea as z,fa as g,ga as v,ha as Ke,ia as Qe,ja as V,ka as Xe,l as oe,la as Ye,ma as Ze,na as Le,oa as R,r as Me,s as Pe,t as Te,u as Ve,v as je,w as Ce,x as Oe,y as Fe,z as Se}from"./ASN7ZWEH.js";import{b as _e}from"./LGW5HXAG.js";export default $arcgis.t(_=>{var it={};_e(it,{AIMessage:()=>w,AIMessageChunk:()=>E,BaseMessage:()=>M,BaseMessageChunk:()=>ze,ChatMessage:()=>y,ChatMessageChunk:()=>A,FunctionMessage:()=>I,FunctionMessageChunk:()=>$,HumanMessage:()=>x,HumanMessageChunk:()=>N,RemoveMessage:()=>z,SystemMessage:()=>g,SystemMessageChunk:()=>v,ToolMessage:()=>P,ToolMessageChunk:()=>T,_isMessageFieldWithRole:()=>Re,_mergeDicts:()=>Ie,_mergeLists:()=>$e,_mergeObj:()=>Ne,_mergeStatus:()=>Ee,coerceMessageLikeToMessage:()=>V,convertToChunk:()=>R,convertToOpenAIImageBlock:()=>Ce,convertToProviderContentBlock:()=>Se,defaultTextSplitter:()=>de,filterMessages:()=>et,getBufferString:()=>Xe,isAIMessage:()=>Ue,isAIMessageChunk:()=>Be,isBase64ContentBlock:()=>Te,isBaseMessage:()=>q,isBaseMessageChunk:()=>K,isChatMessage:()=>De,isChatMessageChunk:()=>He,isDataContentBlock:()=>Me,isFunctionMessage:()=>We,isFunctionMessageChunk:()=>Ge,isHumanMessage:()=>Je,isHumanMessageChunk:()=>qe,isIDContentBlock:()=>je,isOpenAIToolCallArray:()=>Ae,isPlainTextContentBlock:()=>Ve,isSystemMessage:()=>Ke,isSystemMessageChunk:()=>Qe,isToolMessage:()=>le,isToolMessageChunk:()=>ue,isURLContentBlock:()=>Pe,mapChatMessagesToStoredMessages:()=>Le,mapStoredMessageToChatMessage:()=>Ye,mapStoredMessagesToChatMessages:()=>Ze,mergeContent:()=>ke,mergeMessageRuns:()=>tt,parseBase64DataUrl:()=>Fe,parseMimeType:()=>Oe,trimMessages:()=>rt});var H=(i,e)=>{let t=[...new Set(e?.map(r=>{if(typeof r=="string")return r;let s=new r({});if(!("getType"in s)||typeof s.getType!="function")throw new Error("Invalid type provided.");return s.getType()}))],a=i.getType();return t.some(r=>r===a)};function et(i,e){return Array.isArray(i)?ce(i,e):B.from(t=>ce(t,i))}function ce(i,e={}){let{includeNames:t,excludeNames:a,includeTypes:r,excludeTypes:s,includeIds:o,excludeIds:n}=e,u=[];for(let l of i)if(!(a&&l.name&&a.includes(l.name))){{if(s&&H(l,s))continue;if(n&&l.id&&n.includes(l.id))continue}r||o||t?(t&&l.name&&t.some(p=>p===l.name)||r&&H(l,r)||o&&l.id&&o.some(p=>p===l.id))&&u.push(l):u.push(l)}return u}function tt(i){return Array.isArray(i)?fe(i):B.from(fe)}function fe(i){if(!i.length)return[];let e=[];for(let t of i){let a=t,r=e.pop();if(!r)e.push(a);else if(a.getType()==="tool"||a.getType()!==r.getType())e.push(r,a);else{let s=R(r),o=R(a),n=s.concat(o);typeof s.content=="string"&&typeof o.content=="string"&&(n.content=`${s.content}
|
|
5
5
|
${o.content}`),e.push(st(n))}}return e}function rt(i,e){if(Array.isArray(i)){let t=i;if(!e)throw new Error("Options parameter is required when providing messages.");return he(t,e)}else{let t=i;return B.from(a=>he(a,t)).withConfig({runName:"trim_messages"})}}async function he(i,e){let{maxTokens:t,tokenCounter:a,strategy:r="last",allowPartial:s=!1,endOn:o,startOn:n,includeSystem:u=!1,textSplitter:l}=e;if(n&&r==="first")throw new Error("`startOn` should only be specified if `strategy` is 'last'.");if(u&&r==="first")throw new Error("`includeSystem` should only be specified if `strategy` is 'last'.");let p;"getNumTokens"in a?p=async m=>(await Promise.all(m.map(b=>a.getNumTokens(b.content)))).reduce((b,J)=>b+J,0):p=async m=>a(m);let c=de;if(l&&("splitText"in l?c=l.splitText:c=async m=>l(m)),r==="first")return ge(i,{maxTokens:t,tokenCounter:p,textSplitter:c,partialStrategy:s?"first":void 0,endOn:o});if(r==="last")return at(i,{maxTokens:t,tokenCounter:p,textSplitter:c,allowPartial:s,includeSystem:u,startOn:n,endOn:o});throw new Error(`Unrecognized strategy: '${r}'. Must be one of 'first' or 'last'.`)}async function ge(i,e){let{maxTokens:t,tokenCounter:a,textSplitter:r,partialStrategy:s,endOn:o}=e,n=[...i],u=0;for(let l=0;l<n.length;l+=1){let p=l>0?n.slice(0,-l):n;if(await a(p)<=t){u=n.length-l;break}}if(u<n.length&&s){let l=!1;if(Array.isArray(n[u].content)){let p=n[u];if(typeof p.content=="string")throw new Error("Expected content to be an array.");let c=p.content.length,m=s==="last"?[...p.content].reverse():p.content;for(let f=1;f<=c;f+=1){let b=s==="first"?m.slice(0,f):m.slice(-f),J=Object.fromEntries(Object.entries(p).filter(([ne])=>ne!=="type"&&!ne.startsWith("lc_"))),ve=Z(p.getType(),{...J,content:b}),ie=[...n.slice(0,u),ve];if(await a(ie)<=t)n=ie,u+=1,l=!0;else break}l&&s==="last"&&(p.content=[...m].reverse())}if(!l){let p=n[u],c;if(Array.isArray(p.content)&&p.content.some(m=>typeof m=="string"||m.type==="text")?c=p.content.find(f=>f.type==="text"&&f.text)?.text:typeof p.content=="string"&&(c=p.content),c){let m=await r(c),f=m.length;s==="last"&&m.reverse();for(let b=0;b<f-1;b+=1)if(m.pop(),p.content=m.join(""),await a([...n.slice(0,u),p])<=t){s==="last"&&(p.content=[...m].reverse().join("")),n=[...n.slice(0,u),p],u+=1;break}}}}if(o){let l=Array.isArray(o)?o:[o];for(;u>0&&!H(n[u-1],l);)u-=1}return n.slice(0,u)}async function at(i,e){let{allowPartial:t=!1,includeSystem:a=!1,endOn:r,startOn:s,...o}=e,n=i.map(p=>{let c=Object.fromEntries(Object.entries(p).filter(([m])=>m!=="type"&&!m.startsWith("lc_")));return Z(p.getType(),c,K(p))});if(r){let p=Array.isArray(r)?r:[r];for(;n.length>0&&!H(n[n.length-1],p);)n=n.slice(0,-1)}let u=a&&n[0]?.getType()==="system",l=u?n.slice(0,1).concat(n.slice(1).reverse()):n.reverse();return l=await ge(l,{...o,partialStrategy:t?"last":void 0,endOn:s}),u?[l[0],...l.slice(1).reverse()]:l.reverse()}var be={human:{message:x,messageChunk:N},ai:{message:w,messageChunk:E},system:{message:g,messageChunk:v},developer:{message:g,messageChunk:v},tool:{message:P,messageChunk:T},function:{message:I,messageChunk:$},generic:{message:y,messageChunk:A},remove:{message:z,messageChunk:z}};function Z(i,e,t){let a,r;switch(i){case"human":t?a=new N(e):r=new x(e);break;case"ai":if(t){let s={...e};"tool_calls"in s&&(s={...s,tool_call_chunks:s.tool_calls?.map(o=>({...o,type:"tool_call_chunk",index:void 0,args:JSON.stringify(o.args)}))}),a=new E(s)}else r=new w(e);break;case"system":t?a=new v(e):r=new g(e);break;case"developer":t?a=new v({...e,additional_kwargs:{...e.additional_kwargs,__openai_role__:"developer"}}):r=new g({...e,additional_kwargs:{...e.additional_kwargs,__openai_role__:"developer"}});break;case"tool":if("tool_call_id"in e)t?a=new T(e):r=new P(e);else throw new Error("Can not convert ToolMessage to ToolMessageChunk if 'tool_call_id' field is not defined.");break;case"function":if(t)a=new $(e);else{if(!e.name)throw new Error("FunctionMessage must have a 'name' field");r=new I(e)}break;case"generic":if("role"in e)t?a=new A(e):r=new y(e);else throw new Error("Can not convert ChatMessage to ChatMessageChunk if 'role' field is not defined.");break;default:throw new Error(`Unrecognized message type ${i}`)}if(t&&a)return a;if(r)return r;throw new Error(`Unrecognized message type ${i}`)}function st(i){let e=i.getType(),t,a=Object.fromEntries(Object.entries(i).filter(([r])=>!["type","tool_call_chunks"].includes(r)&&!r.startsWith("lc_")));if(e in be&&(t=Z(e,a)),!t)throw new Error(`Unrecognized message chunk class ${e}. Supported classes are ${Object.keys(be)}`);return t}function de(i){let e=i.split(`
|
|
6
6
|
`);return Promise.resolve([...e.slice(0,-1).map(t=>`${t}
|
|
7
7
|
`),e[e.length-1]])}var _=class i extends D{static lc_name(){return"ImagePromptTemplate"}constructor(e){if(super(e),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompts","image"]}),Object.defineProperty(this,"template",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"templateFormat",{enumerable:!0,configurable:!0,writable:!0,value:"f-string"}),Object.defineProperty(this,"validateTemplate",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"additionalContentFields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.template=e.template,this.templateFormat=e.templateFormat??this.templateFormat,this.validateTemplate=e.validateTemplate??this.validateTemplate,this.additionalContentFields=e.additionalContentFields,this.validateTemplate){let t=this.inputVariables;this.partialVariables&&(t=t.concat(Object.keys(this.partialVariables))),C([{type:"image_url",image_url:this.template}],this.templateFormat,t)}}_getPromptType(){return"prompt"}async partial(e){let t=this.inputVariables.filter(s=>!(s in e)),a={...this.partialVariables??{},...e},r={...this,inputVariables:t,partialVariables:a};return new i(r)}async format(e){let t={};for(let[o,n]of Object.entries(this.template))typeof n=="string"?t[o]=d(n,this.templateFormat,e):t[o]=n;let a=e.url||t.url,r=e.detail||t.detail;if(!a)throw new Error("Must provide either an image URL.");if(typeof a!="string")throw new Error("url must be a string.");let s={url:a};return r&&(s.detail=r),s}async formatPromptValue(e){let t=await this.format(e);return new me(t)}};var O=class extends U{static lc_name(){return"DictPromptTemplate"}constructor(e){let t=e.templateFormat??"f-string",a=L(e.template,t);super({inputVariables:a,...e}),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompts","dict"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"template",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"templateFormat",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputVariables",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.template=e.template,this.templateFormat=t,this.inputVariables=a}async format(e){return ee(this.template,e,this.templateFormat)}async invoke(e){return await this._callWithConfig(this.format.bind(this),e,{runType:"prompt"})}};function L(i,e){let t=[];for(let a of Object.values(i))if(typeof a=="string")Y(a,e).forEach(r=>{r.type==="variable"&&t.push(r.name)});else if(Array.isArray(a))for(let r of a)typeof r=="string"?Y(r,e).forEach(s=>{s.type==="variable"&&t.push(s.name)}):typeof r=="object"&&t.push(...L(r,e));else typeof a=="object"&&a!==null&&t.push(...L(a,e));return Array.from(new Set(t))}function ee(i,e,t){let a={};for(let[r,s]of Object.entries(i))if(typeof s=="string")a[r]=d(s,t,e);else if(Array.isArray(s)){let o=[];for(let n of s)typeof n=="string"?o.push(d(n,t,e)):typeof n=="object"&&o.push(ee(n,e,t));a[r]=o}else typeof s=="object"&&s!==null?a[r]=ee(s,e,t):a[r]=s;return a}var F=class extends U{constructor(){super(...arguments),Object.defineProperty(this,"lc_namespace",{enumerable:!0,configurable:!0,writable:!0,value:["langchain_core","prompts","chat"]}),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!0})}async invoke(e,t){return this._callWithConfig(a=>this.formatMessages(a),e,{...t,runType:"prompt"})}},W=class extends F{static lc_name(){return"MessagesPlaceholder"}constructor(e){typeof e=="string"&&(e={variableName:e}),super(e),Object.defineProperty(this,"variableName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"optional",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.variableName=e.variableName,this.optional=e.optional??!1}get inputVariables(){return[this.variableName]}async formatMessages(e){let t=e[this.variableName];if(this.optional&&!t)return[];if(!t){let r=new Error(`Field "${this.variableName}" in prompt uses a MessagesPlaceholder, which expects an array of BaseMessages as an input value. Received: undefined`);throw r.name="InputFormatError",r}let a;try{Array.isArray(t)?a=t.map(V):a=[V(t)]}catch(r){let s=typeof t=="string"?t:JSON.stringify(t,null,2),o=new Error([`Field "${this.variableName}" in prompt uses a MessagesPlaceholder, which expects an array of BaseMessages or coerceable values as input.`,`Received value: ${s}`,`Additional message: ${r.message}`].join(`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
2
2
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
3
|
-
v5.0.0-next.
|
|
4
|
-
import"./
|
|
3
|
+
v5.0.0-next.140 */
|
|
4
|
+
import"./LGW5HXAG.js";var e=`# ArcGIS JavaScript SDK FeatureLayerView Query Assistant
|
|
5
5
|
|
|
6
6
|
You are a GIS assistant that generates query parameters for the ArcGIS JavaScript SDK FeatureLayerView \`queryFeatures()\` method.
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
2
2
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
3
|
-
v5.0.0-next.
|
|
4
|
-
import{a as b}from"./
|
|
3
|
+
v5.0.0-next.140 */
|
|
4
|
+
import{a as b}from"./XGRSVMCO.js";import c from"./2GEDY3GN.js";import{a as f}from"./AXRNMFPI.js";import"./H3KORP5U.js";import{g as y,h,n as g,o as u,p as v,t as _}from"./SNPQLJY2.js";import a from"./6C35AMCX.js";import"./ASN7ZWEH.js";import"./LGW5HXAG.js";export default $arcgis.t(([E,{whenOnce:k,watch:L,when:S},O,P,{property:c,subclass:C},,{s:w}])=>{var H=y`:host{height:100%}`,M=Object.defineProperty,x=Object.getOwnPropertyDescriptor,n=(l,t,e,r)=>{for(var s=r>1?void 0:r?x(t,e):t,a=l.length-1,o;a>=0;a--)(o=l[a])&&(s=(r?o(t,e,s):o(s))||s);return r&&s&&M(t,e,s),s},i=class extends P{constructor(l){super(l),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 k(()=>!this.view.updating),this._set("orchestrator",await w.init({agents:[...this.agents],portal:this.portal,view:this.view??void 0})),this.addHandles([L(()=>[this.view,this.agents],()=>void this._initialize())])}async*ask(l,t){if(!this.orchestrator)throw new Error("Orchestrator not initialized yet.");this._set("processing",!0),this._set("processingStep","");let e="";try{let r=this.orchestrator.ask(l);for await(let s of r){if(t?.aborted){yield{type:"cancelled"};break}switch(s.type){case"trace":{this._set("processingStep",s.data.text),e+=`${s.data.text}
|
|
5
5
|
|
|
6
6
|
`;break}case"completed":{if(!s.result.content.length){yield{type:"completed",error:"Could not process the request.",log:e};return}let a=s.result.content;this._set("processingStep",""),yield{type:"completed",response:a,log:e};return}case"interrupt":{console.log("Orchestrator interrupt:",s);let{kind:a,message:o,metadata:m}=s.interrupt,p=Array.isArray(m)?[...m]:[],$=(()=>{switch(a){case"booleanChoice":return{type:"boolean-choice",message:o,options:p};case"singleSelection":return{type:"single-select",message:o,options:p};case"multipleSelection":return{type:"multi-select",message:o,options:p};case"textInput":return{type:"text-input",message:o};default:return{type:a,message:o,options:p}}})();this._set("processingStep","Waiting for user input..."),yield{type:"interrupt",payload:$};break}case"cancelled":{yield{type:"cancelled"};return}default:{console.warn("Unknown event type:",s);break}}}}catch(r){console.warn("Error during message processing:",r),yield{type:"completed",error:"An error occurred during message processing.",log:e};return}finally{this._set("processing",!1)}}};n([c({readOnly:!0})],i.prototype,"orchestrator",2);n([c()],i.prototype,"agents",2);n([c()],i.prototype,"portal",2);n([c()],i.prototype,"view",2);n([c({readOnly:!0})],i.prototype,"loading",2);n([c({readOnly:!0})],i.prototype,"processing",2);n([c({readOnly:!0})],i.prototype,"processingStep",2);i=n([C("OrchestratorController")],i);var d=class extends v{constructor(){super(...arguments),this._messages=b({blocking:!0}),this.#e=g(),this.#s=g(),this.#t=null,this.#r=null,this.#a=new Map,this.#i=t=>{t.stopPropagation(),this.orchestrator?.cancelInterrupt(),this._interrupt=null},this.#o=t=>{t.stopPropagation();let e=t.detail;this.orchestrator?.resumeInterrupt(e),this._interrupt=null},this.#n=t=>{t.stopPropagation(),this.suggestedPrompts=[];let e=t.detail;this.#h(e)},this.#l=t=>{if(t.stopPropagation(),this._interrupt){this.orchestrator?.cancelInterrupt(),this._interrupt=null;return}this.#r?.abort()},this._interrupt=null,this._chatHistory=new E([]),this._error=null,this.referenceElement=null,this.portal=new O,this.suggestedPrompts=[]}static{this.properties={_interrupt:16,_chatHistory:16,_error:16,orchestrator:32,entryMessage:1,heading:1,description:1,referenceElement:1,portal:0,suggestedPrompts:0}}static{this.styles=H}#e;#s;#t;#r;#a;#i;#o;#n;#l;get orchestrator(){return this.#t?.orchestrator}register(t){this.#a.set(t.agent.id,t)}load(){this.manager.onLifecycle(()=>()=>{this.#r?.abort(),this._interrupt=null,this._chatHistory.removeAll(),this._error=null})}loaded(){this.manager.onLifecycle(()=>{this.#e.value?.addEventListener("arcgisSubmit",this.#n),this.#e.value?.addEventListener("arcgisCancel",this.#l);let t=S(()=>!!this._interrupt&&!!this.#s.value,()=>{let e=this.#s.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})});return queueMicrotask(()=>void this.#c()),()=>{t.remove(),this.#s.value?.removeEventListener("arcgisSubmit",this.#o),this.#s.value?.removeEventListener("arcgisCancel",this.#i),this.#e.value?.removeEventListener("arcgisSubmit",this.#n),this.#e.value?.removeEventListener("arcgisCancel",this.#l),this.#t?.destroy(),this.#t=null}})}async#c(){try{let t=f(this.referenceElement);await t?.componentOnReady();let e=[...this.#a.values()];this.#t=new i({agents:e,portal:this.portal,view:t?.view}),await this.#t.load()}catch(t){console.warn(t),this._error="Error initializing orchestrator."}}async#h(t){let e=t.trim();if(!e||(this._chatHistory.push({type:"prompt",content:e}),!this.#t))return;this.#r=new AbortController;let r=this.#t.ask(e,this.#r.signal);for await(let s of r)switch(s.type){case"completed":this._chatHistory.push({type:"response",content:s.response,log:s.log,error:s.error});break;case"interrupt":this._interrupt=s.payload;break;case"cancelled":this._chatHistory.push({type:"response",error:"Request cancelled."});break}}render(){return h`<arcgis-assistant-shell .loading=${this.#t?.loading} .heading=${this.heading??this._messages.assistantLabel} .description=${this.description} .entryMessage=${this.entryMessage} .entryMessageClosed=${this._chatHistory.length>0} .awaitingResponse=${this.#t?.processing} .suggestedPrompts=${this.suggestedPrompts} .status=${this.#t?.processing?"working":this._error?"error":"ready"} ${u(this.#e)}>${this._error?h`<calcite-notice slot=entry-message open kind=danger icon width=full><div slot=message>${this._error}</div></calcite-notice>`:null}${this._interrupt?h`<arcgis-assistant-interrupt slot=entry-message .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${u(this.#s)}></arcgis-assistant-interrupt>`:null}<arcgis-assistant-chat .loading=${this.#t?.processing} .loadingMessage=${this.#t?.processingStep||""} .messages=${this._chatHistory} .user=${this.portal?.user?.fullName||this.portal?.user?.username}><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>`}};_("arcgis-assistant",d);return d},"core/Collection","core/reactiveUtils","portal/Portal","core/Accessor","core/accessorSupport/decorators",a,c)
|