n8n-editor-ui
Version:
Workflow Editor UI for n8n
4 lines (3 loc) • 142 kB
JavaScript
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`n8n@2.16.1`}}catch{}})();try{(function(){var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`8e131001-feda-486e-9b5e-8db2f495aa0d`,e._sentryDebugIdIdentifier=`sentry-dbid-8e131001-feda-486e-9b5e-8db2f495aa0d`)})()}catch{}import{o as e}from"./chunk-CACdhNlC.js";import{$ as t,A as n,C as r,E as i,Ft as a,N as o,O as s,Q as c,R as l,S as u,Sn as d,T as f,W as p,Wt as m,X as h,Z as g,_,_n as v,at as y,bt as b,c as x,f as S,gt as C,h as w,it as T,j as E,m as D,n as O,p as k,pt as A,q as j,r as M,rt as N,tt as P,w as F,yn as ee,yt as I}from"./vue.runtime.esm-bundler-C3C09Zii.js";import{C as te,at as L,k as ne,x as re}from"./core-Bz5WjPxS.js";import{A as R,Ai as z,Di as B,Gi as V,Ji as H,Mi as U,Mt as W,Qi as G,Ui as K,Wi as ie,Xi as q,Zi as J,ct as ae,dt as oe,ji as Y,k as X,lt as se,m as ce,tt as le}from"./src-XqE2yCpG.js";import{t as Z}from"./_plugin-vue_export-helper-CIL7EULb.js";import{Aa as ue,Bn as de,Pn as Q,Rt as fe,gr as pe,it as me,lr as he,r as ge,s as _e,sr as ve,w as ye,zi as be}from"./users.store-xP93bV7X.js";import{O as xe,t as Se}from"./ParameterInputList-CnpfSyOD.js";import{$i as Ce,Qo as we,bc as Te,ja as Ee}from"./constants-DuQbSl-q.js";import{T as De,t as Oe}from"./useRootStore-XEREVjMN.js";import{t as ke}from"./usePageRedirectionHelper-CC6sh9o0.js";import{t as Ae}from"./dataTable.store-DVN6vAE2.js";import{t as je}from"./useClipboard-D2UtD35U.js";import{t as Me}from"./CredentialIcon-BVAlIa2j.js";import{t as Ne}from"./pushConnection.store-D7Wwlyyp.js";import{i as Pe,n as Fe,t as Ie}from"./constants-Dn3JdkLw.js";import{t as Le}from"./useExpressionResolveCtx-C0HlqAoX.js";import{p as Re,t as ze}from"./fileUtils-D6dhtxVJ.js";import{t as Be}from"./instanceAiSettings.store-T1CQqwB0.js";import{a as Ve,c as He,i as Ue,n as We,o as Ge,r as $,s as Ke,t as qe}from"./CreditWarningBanner-qtsaNkFV.js";import{t as Je}from"./ChatFile-BWveoZV5.js";import{t as Ye}from"./ChatMarkdownChunk-4B441pzM.js";import{t as Xe}from"./WorkflowPreview-C5OyFGa3.js";import{t as Ze}from"./DataTableTable-tR9cLBoN.js";function Qe(e){for(let t=e.children.length-1;t>=0;t--){let n=Qe(e.children[t]);if(n)return n}for(let t=e.toolCalls.length-1;t>=0;t--){let n=e.toolCalls[t];if((n.toolName===`build-workflow`||n.toolName===`submit-workflow`)&&!n.isLoading&&n.result&&typeof n.result==`object`){let e=n.result;if(e.success===!0&&typeof e.workflowId==`string`)return{workflowId:e.workflowId,toolCallId:n.toolCallId}}}}function $e(e){for(let t=e.children.length-1;t>=0;t--){let n=$e(e.children[t]);if(n)return n}for(let t=e.toolCalls.length-1;t>=0;t--){let n=e.toolCalls[t];if(n.toolName===`run-workflow`&&!n.isLoading&&n.result&&typeof n.result==`object`){let e=n.result,t=n.args;if(typeof e.executionId==`string`&&typeof t?.workflowId==`string`)return{executionId:e.executionId,workflowId:t.workflowId}}}}var et=new Set([`create-data-table`,`insert-data-table-rows`,`update-data-table-rows`,`delete-data-table-rows`,`add-data-table-column`,`delete-data-table-column`,`rename-data-table-column`,`move-data-table-column`]),tt={"insert-data-table-rows":e=>typeof e.insertedCount==`number`,"update-data-table-rows":e=>typeof e.updatedCount==`number`,"add-data-table-column":e=>e.column!==null&&e.column!==void 0&&typeof e.column==`object`,"delete-data-table-rows":e=>e.success===!0,"delete-data-table-column":e=>e.success===!0,"rename-data-table-column":e=>e.success===!0,"move-data-table-column":e=>e.success===!0};function nt(e,t,n){if(e===`create-data-table`){if(t.table&&typeof t.table==`object`){let e=t.table;if(typeof e.id==`string`)return e.id}return}let r=tt[e];if(r?.(t)&&typeof n?.dataTableId==`string`)return n.dataTableId}function rt(e){for(let t=e.children.length-1;t>=0;t--){let n=rt(e.children[t]);if(n)return n}for(let t=e.toolCalls.length-1;t>=0;t--){let n=e.toolCalls[t];if(n.toolName===`delete-data-table`&&!n.isLoading&&n.result&&typeof n.result==`object`){let e=n.result,t=n.args;if(e.success===!0&&typeof t?.dataTableId==`string`)return t.dataTableId}}}function it(e){for(let t=e.children.length-1;t>=0;t--){let n=it(e.children[t]);if(n)return n}for(let t=e.toolCalls.length-1;t>=0;t--){let n=e.toolCalls[t];if(et.has(n.toolName)&&!n.isLoading&&n.result&&typeof n.result==`object`){let e=n.result,t=n.args,r=nt(n.toolName,e,t);if(r)return{dataTableId:r,toolCallId:n.toolCallId}}}}function at(e){let t=new Map;return ot(e,t),t}function ot(e,t){for(let n of e.toolCalls){if(n.toolName!==`run-workflow`||n.isLoading)continue;let e=n.result,r=n.args;typeof e==`object`&&e&&typeof r==`object`&&r&&`workflowId`in r&&typeof r.workflowId==`string`&&`executionId`in e&&typeof e.executionId==`string`&&`status`in e&&(e.status===`success`||e.status===`error`)&&t.set(r.workflowId,{executionId:e.executionId,status:e.status,...`finishedAt`in e&&typeof e.finishedAt==`string`?{finishedAt:e.finishedAt}:{}})}for(let n of e.children)ot(n,t)}var st={workflow:`workflow`,"data-table":`table`};function ct({store:e,route:t,workflowExecutions:n}){let r=ve(),i=a(null),o=a(null),s=u(()=>{let t=new Map;for(let n of e.messages)if(n.agentTree)for(let[e,r]of at(n.agentTree))t.set(e,r);for(let[e,n]of t){if(!n.finishedAt)continue;let i=r.getWorkflowById(e);i?.updatedAt&&new Date(i.updatedAt)>new Date(n.finishedAt)&&t.delete(e)}return t}),c=u(()=>{let t=[],r=n?.value,i=s.value;for(let n of e.resourceRegistry.values())if(n.type===`workflow`||n.type===`data-table`){let e=n.type===`workflow`?r?.get(n.id)?.status??i.get(n.id)?.status:void 0;t.push({id:n.id,type:n.type,name:n.name,icon:st[n.type]??`file`,projectId:n.projectId,executionStatus:e})}return t}),l=u(()=>{let e=c.value.find(e=>e.id===i.value);return e?.type===`workflow`?e.id:null}),d=u(()=>{let e=c.value.find(e=>e.id===i.value);return e?.type===`data-table`?e.id:null}),f=u(()=>{let e=c.value.find(e=>e.id===i.value);return e?.type===`data-table`?e.projectId??null:null}),p=a(0),m=u(()=>i.value!==null),h=a(!1),g=a(!1);function _(e){i.value=e}function v(){i.value=null,o.value=null}function y(e){i.value=e}function b(e,t){o.value=null,i.value=e}function x(){h.value=!0}C(()=>{if(!(!n||!i.value))return n.value.get(i.value)?.status},e=>{e===`running`&&(o.value=null)}),C(i,(e,t)=>{if(!e||n?.value.get(e)?.status===`running`)return;let r=s.value.get(e);r?o.value=r.executionId:t&&(o.value=null)}),C(c,e=>{i.value===null||e.length===0||e.some(e=>e.id===i.value)||(i.value=e[0].id)}),C(()=>t.params.threadId,()=>{g.value=m.value,i.value=null,o.value=null,h.value=!1});let S=a(0),w=u(()=>{for(let t=e.messages.length-1;t>=0;t--){let n=e.messages[t];if(n.agentTree){let e=Qe(n.agentTree);if(e)return e}}return null});C(()=>w.value?.toolCallId,t=>{if(!t||!w.value)return;let r=w.value.workflowId;if(!(!m.value&&!e.isStreaming&&!h.value&&!g.value)){if(n?.value.has(r)){let e=new Map(n.value);e.delete(r),n.value=e}if(m.value&&i.value!==null&&i.value!==r){S.value++;return}g.value=!1,o.value=null,i.value=r,S.value++}});let T=u(()=>{for(let t=e.messages.length-1;t>=0;t--){let n=e.messages[t];if(n.agentTree){let e=$e(n.agentTree);if(e)return e}}return null});C(()=>T.value?.executionId,()=>{let t=T.value;t&&(!m.value&&!e.isStreaming&&!h.value||m.value&&i.value!==null&&i.value!==t.workflowId||(o.value=t.executionId,i.value=t.workflowId,m.value||S.value++))});let E=u(()=>{for(let t=e.messages.length-1;t>=0;t--){let n=e.messages[t];if(n.agentTree){let e=it(n.agentTree);if(e)return e}}return null});return C(()=>E.value?.toolCallId,t=>{if(!t||!E.value)return;let n=E.value.dataTableId;if(!(!m.value&&!e.isStreaming&&!h.value&&!g.value)){if(m.value&&i.value!==null&&i.value!==n){p.value++;return}g.value=!1,o.value=null,i.value=n,p.value++}}),C(u(()=>{for(let t=e.messages.length-1;t>=0;t--){let n=e.messages[t];if(n.agentTree){let e=rt(n.agentTree);if(e)return e}}return null}),e=>{if(e&&e===i.value){let t=c.value.filter(t=>t.id!==e);i.value=t.length>0?t[0].id:null}}),{activeTabId:i,allArtifactTabs:c,activeWorkflowId:l,activeExecutionId:o,activeDataTableId:d,activeDataTableProjectId:f,dataTableRefreshKey:p,isPreviewVisible:m,userSentMessage:h,workflowRefreshKey:S,selectTab:_,closePreview:v,openWorkflowPreview:y,openDataTablePreview:b,markUserSentMessage:x}}function lt({workflowExecutions:e,activeWorkflowId:t,getBufferedEvents:n,relay:r}){function i(){p(()=>{let e=t.value;if(!e)return;let i=n(e);for(let e of i)r(e)})}let a=new Map;return C(()=>e.value,e=>{let n=t.value;if(!n)return;let i=e.get(n);if(!i)return;let o=a.get(n);if(a.set(n,i.status),i.status===`running`){let e=i.eventLog;e.length>0&&r(e[e.length-1])}else o===`running`&&r({type:`executionFinished`,data:{executionId:i.executionId,workflowId:i.workflowId,status:i.status}})}),{handleIframeReady:i}}var ut=new Set([`executionStarted`,`executionFinished`,`nodeExecuteBefore`,`nodeExecuteAfter`,`nodeExecuteAfterData`]);function dt(){let e=a(new Map),t=new Map,n=Ne();function r(n){if(!ut.has(n.type))return;if(n.type===`executionStarted`){let{executionId:r,workflowId:i}=n.data;t.set(r,i);let a=new Map(e.value);a.set(i,{executionId:r,workflowId:i,status:`running`,eventLog:[n]}),e.value=a;return}if(n.type===`executionFinished`){let{executionId:r,workflowId:i,status:a}=n.data,o=e.value.get(i);if(!o||o.executionId!==r)return;let s=new Map(e.value);s.set(i,{...o,status:a===`success`?`success`:`error`,eventLog:[]}),e.value=s,t.delete(r);return}let r=n.data.executionId,i=t.get(r);if(!i)return;let a=e.value.get(i);if(!a||a.executionId!==r)return;let o=new Map(e.value);o.set(i,{...a,eventLog:[...a.eventLog,n]}),e.value=o}let i=n.addEventListener(r);function o(t){return e.value.get(t)?.status}function s(t){return e.value.get(t)?.eventLog??[]}function c(){e.value=new Map,t.clear()}function l(){i()}return{workflowExecutions:e,getStatus:o,getBufferedEvents:s,clearAll:c,cleanup:l}}var ft=[`src`,`alt`],pt=Z(o({__name:`AttachmentPreview`,props:{file:{},attachment:{},isRemovable:{type:Boolean}},emits:[`remove`],setup(e,{emit:n}){let o=e,s=n,c=a(!0),l=u(()=>o.file?.type??o.attachment?.mimeType??``),d=u(()=>o.file?.name??o.attachment?.fileName??``),p=u(()=>l.value.startsWith(`image/`)),h=u(()=>o.file&&p.value?URL.createObjectURL(o.file):null),g=u(()=>h.value?h.value:o.attachment&&p.value?`data:${o.attachment.mimeType};base64,${o.attachment.data}`:null),_=u(()=>o.file?o.file:o.attachment?new File([],o.attachment.fileName,{type:o.attachment.mimeType}):new File([],`unknown`));function y(){c.value=!1}function b(){o.file&&s(`remove`,o.file)}return j(()=>{h.value&&URL.revokeObjectURL(h.value)}),(n,a)=>p.value&&g.value?(t(),i(`div`,{key:0,class:v(n.$style.thumbnailWrapper)},[c.value?(t(),i(`div`,{key:0,class:v(n.$style.loadingSkeleton)},[E(m(G),{icon:`spinner`,spin:``,size:`small`})],2)):f(``,!0),r(`img`,{src:g.value,alt:d.value,class:v(n.$style.thumbnail),onLoad:y},null,42,ft),e.isRemovable?(t(),i(`button`,{key:1,class:v(n.$style.removeBtn),"data-test-id":`attachment-preview-remove`,onClick:w(b,[`stop`])},[E(m(G),{icon:`x`,size:`small`})],2)):f(``,!0)],2)):(t(),F(Je,{key:1,file:_.value,"is-removable":e.isRemovable??!1,onRemove:a[0]||=e=>s(`remove`,e)},null,8,[`file`,`is-removable`]))}}),[[`__cssModules`,{$style:{thumbnailWrapper:`_thumbnailWrapper_22ink_125`,thumbnail:`_thumbnail_22ink_125`,loadingSkeleton:`_loadingSkeleton_22ink_142`,removeBtn:`_removeBtn_22ink_152`}}]]),mt=Z(o({__name:`InstanceAiMarkdown`,props:{content:{}},setup(e){let n=e,r=$(),o=x(),s=a(null),d=l(`openWorkflowPreview`,void 0),f=l(`openDataTablePreview`,void 0),p={workflow:`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21.17 8H7.83a1.83 1.83 0 1 0 0 3.66h8.34a1.83 1.83 0 0 1 0 3.66H2.83"/><path d="m18 2 4 4-4 4"/><path d="m6 20-4-4 4-4"/></svg>`,credential:`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/></svg>`,"data-table":`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3v18"/><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/></svg>`},m={workflow:e=>`/workflow/${e}`,credential:()=>`/credentials`,"data-table":()=>`/data-tables`},g=u(()=>{let e=r.resourceRegistry;if(e.size===0)return n.content;let t=n.content,i=[...e.values()].filter(e=>e.name.length>=3).sort((e,t)=>t.name.length-e.name.length);for(let e of i){let n=e.name.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),r=RegExp(`(?<![\\[\`\\/])\\b(${n})\\b(?![\\]\`]|\\(|://)`,`g`);t=t.replace(r,(t,n)=>`[${n}](${`n8n-resource://${e.type}/${e.id}`})`)}return t}),_=u(()=>({type:`text`,content:g.value})),v=[{pattern:/^(?:https?:\/\/[^/]+)?\/workflow\/([a-zA-Z0-9]+)/,type:`workflow`},{pattern:/^(?:https?:\/\/[^/]+)?\/credentials(?:\/|$)/,type:`credential`},{pattern:/^(?:https?:\/\/[^/]+)?\/data-tables(?:\/|$)/,type:`data-table`}];function y(e,t){e.dataset.resourceChip=t,e.classList.add(o.resourceChip);let n=p[t];if(n){let t=document.createElement(`span`);t.classList.add(o.resourceChipIcon),t.innerHTML=n,e.prepend(t)}}function b(){if(!s.value)return;let e=s.value.querySelectorAll(`a`);for(let t of e){if(t.dataset.resourceChip)continue;let e=t.getAttribute(`href`)??``,n=/^n8n-resource:\/\/(workflow|credential|data-table)\/(.+)$/.exec(e);if(n){let[,e,i]=n,a=e===`data-table`?[...r.resourceRegistry.values()].find(e=>e.type===`data-table`&&e.id===i):void 0;t.href=e===`data-table`&&a?.projectId?`/projects/${a.projectId}/datatables/${i}`:m[e]?.(i)??`#`,t.target=`_blank`,t.dataset.resourceId=i,y(t,e),t.addEventListener(`click`,t=>{t.metaKey||t.ctrlKey||(e===`workflow`&&d||e===`data-table`&&a?.projectId&&f)&&(t.preventDefault(),e===`workflow`?d?.(i):e===`data-table`&&a?.projectId&&f?.(i,a.projectId))});continue}for(let{pattern:n,type:r}of v)if(n.test(e)){t.target=`_blank`,y(t,r);break}}}return h(b),c(b),(e,n)=>(t(),i(`div`,{ref_key:`wrapperRef`,ref:s},[E(Ye,{source:_.value},null,8,[`source`])],512))}}),[[`__cssModules`,{$style:{resourceChip:`_resourceChip_1129p_125`,resourceChipIcon:`_resourceChipIcon_1129p_145`}}]]),ht=new Set([`updateWorkingMemory`,`plan`,`cancel-background-task`]);function gt(e){return e===`delegate`||e.endsWith(`-with-agent`)?`share`:e.includes(`data-table`)?`table`:e.includes(`workflow`)||e===`search-nodes`||e.startsWith(`get-node`)||e===`submit-workflow`||e===`run-workflow`||e===`activate-workflow`||e===`list-nodes`||e===`explore-node-resources`||e===`get-suggested-nodes`||e===`list-executions`||e===`get-execution`||e===`debug-execution`||e===`stop-execution`||e===`materialize-node-type`?`workflow`:e===`web-search`||e===`fetch-url`?`search`:e===`updateWorkingMemory`||e===`plan`?`brain`:e.includes(`credential`)||e===`browser-credential-setup`?`key-round`:`settings`}function _t(){let e=L();function t(t){let n=`instanceAi.tools.${t}`,r=e.baseText(n);return r===n?t:r}function n(t){if(!ht.has(t.toolName))return t.toolName===`delegate`?e.baseText(`instanceAi.stepTimeline.showBrief`):e.baseText(`instanceAi.stepTimeline.showData`)}function r(t){if(!ht.has(t.toolName))return t.toolName===`delegate`?e.baseText(`instanceAi.stepTimeline.hideBrief`):e.baseText(`instanceAi.stepTimeline.hideData`)}return{getToolLabel:t,getToggleLabel:n,getHideLabel:r}}var vt=e(de(),1),yt=[`innerHTML`],bt=1e5,xt=Z(o({__name:`ToolResultJson`,props:{value:{}},setup(e){let n=e,a=L();function o(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function s(e){return o(e).replace(/("(?:\\.|[^&]|&(?!quot;))*?")\s*:|("(?:\\.|[^&]|&(?!quot;))*?")|(true|false|null)|(\d+\.?\d*)/g,(e,t,n,r,i)=>t?`<span class="json-key">${t}</span>:`:n?`<span class="json-string">${n}</span>`:r?`<span class="json-bool">${r}</span>`:i?`<span class="json-number">${i}</span>`:e)}let c=u(()=>JSON.stringify(n.value,null,2)??String(n.value)),l=u(()=>c.value.length>bt),p=u(()=>s(l.value?c.value.slice(0,bt):c.value));function h(){(0,vt.saveAs)(new Blob([c.value],{type:`application/json`}),`tool-result.json`)}return(e,n)=>(t(),i(`div`,null,[r(`pre`,{class:v(e.$style.json),innerHTML:p.value},null,10,yt),l.value?(t(),i(`div`,{key:0,class:v(e.$style.truncatedNotice)},[r(`span`,{class:v(e.$style.truncatedText)},d(m(a).baseText(`instanceAi.toolResult.dataTruncated`)),3),E(m(J),{variant:`outline`,size:`mini`,label:m(a).baseText(`runData.downloadBinaryData`),onClick:h},null,8,[`label`])],2)):f(``,!0)]))}}),[[`__cssModules`,{$style:{json:`_json_1lfbf_125`,truncatedNotice:`_truncatedNotice_1lfbf_137`,truncatedText:`_truncatedText_1lfbf_144`}}]]),St=20,Ct=Z(o({__name:`ToolResultTable`,props:{rows:{}},setup(e){let n=e,a=L(),o=u(()=>n.rows.length===0?[]:Object.keys(n.rows[0])),s=u(()=>n.rows.slice(0,St)),c=u(()=>n.rows.length>St);function l(e){return e==null?`—`:typeof e==`boolean`?e?`Yes`:`No`:typeof e==`object`?JSON.stringify(e):String(e)}return(e,u)=>(t(),i(`div`,{class:v(e.$style.wrapper)},[r(`table`,{class:v(e.$style.table)},[r(`thead`,null,[r(`tr`,null,[(t(!0),i(_,null,N(o.value,n=>(t(),i(`th`,{key:n,class:v(e.$style.th)},d(n),3))),128))])]),r(`tbody`,null,[(t(!0),i(_,null,N(s.value,(n,r)=>(t(),i(`tr`,{key:r,class:v(e.$style.tr)},[(t(!0),i(_,null,N(o.value,r=>(t(),i(`td`,{key:r,class:v(e.$style.td)},d(l(n[r])),3))),128))],2))),128))])],2),c.value?(t(),i(`div`,{key:0,class:v(e.$style.more)},d(m(a).baseText(`instanceAi.toolResult.moreRows`,{interpolate:{count:String(n.rows.length-St)}})),3)):f(``,!0)],2))}}),[[`__cssModules`,{$style:{wrapper:`_wrapper_fhbtz_125`,table:`_table_fhbtz_131`,th:`_th_fhbtz_138`,tr:`_tr_fhbtz_152`,td:`_td_fhbtz_156`,more:`_more_fhbtz_165`}}]]),wt=Z(o({__name:`ToolResultCode`,props:{code:{}},setup(e){let n=e,o=je(),s=a(!1);async function c(){await o.copy(n.code),s.value=!0,setTimeout(()=>{s.value=!1},2e3)}return(e,a)=>(t(),i(`div`,{class:v(e.$style.wrapper)},[E(m(U),{icon:s.value?`check`:`copy`,variant:`ghost`,size:`xsmall`,class:v(e.$style.copyBtn),onClick:c},null,8,[`icon`,`class`]),r(`pre`,{class:v(e.$style.code)},d(n.code),3)],2))}}),[[`__cssModules`,{$style:{wrapper:`_wrapper_144ps_125`,copyBtn:`_copyBtn_144ps_133`,code:`_code_144ps_144`}}]]),Tt=[`src`],Et=Z(o({__name:`ToolResultMedia`,props:{data:{},mimeType:{}},setup(e){return(n,r)=>(t(),i(`img`,{src:`data:${e.mimeType};base64,${e.data}`,class:v(n.$style.image)},null,10,Tt))}}),[[`__cssModules`,{$style:{image:`_image_1l1xi_2`}}]]),Dt=[`textContent`],Ot=Z(o({__name:`ToolResultText`,props:{text:{}},setup(e){return(n,r)=>(t(),i(`pre`,{class:v(n.$style.text),textContent:d(e.text)},null,10,Dt))}}),[[`__cssModules`,{$style:{text:`_text_1xlo6_2`}}]]),kt=Z(o({__name:`ToolResultRenderer`,props:{result:{},toolName:{}},setup(e){let n=e,r=new Set([`get-workflow-as-code`,`get-node-type-definition`]),a=new Set([`query-data-table-rows`,`list-workflows`,`list-executions`,`list-credentials`,`search-nodes`,`list-nodes`,`list-data-tables`]);function o(e){return Array.isArray(e)?e:typeof e==`object`&&e&&`content`in e&&Array.isArray(e.content)?e.content:null}function s(e,t){return o(e)===null?r.has(t)?`code`:a.has(t)&&e&&typeof e==`object`?`table`:`json`:`content`}function c(e,t){if(!e||typeof e!=`object`)return null;let n=e;return t===`get-workflow-as-code`&&typeof n.code==`string`?n.code:t===`get-node-type-definition`&&Array.isArray(n.definitions)?n.definitions.filter(e=>typeof e.content==`string`).map(e=>e.content).join(`
`):null}function l(e){if(!e||typeof e!=`object`)return null;let t=e;for(let e of[`data`,`workflows`,`executions`,`credentials`,`results`,`nodes`,`tables`])if(Array.isArray(t[e])&&t[e].length>0&&typeof t[e][0]==`object`)return t[e];return null}let d=u(()=>s(n.result,n.toolName)),p=u(()=>o(n.result)),m=u(()=>c(n.result,n.toolName)),h=u(()=>l(n.result));return(e,r)=>d.value===`content`&&p.value?(t(),i(`div`,{key:0,class:v(e.$style.contentList)},[(t(!0),i(_,null,N(p.value,(e,n)=>(t(),i(_,{key:n},[e.type===`image`?(t(),F(Et,{key:0,data:e.data,"mime-type":e.mimeType},null,8,[`data`,`mime-type`])):e.type===`text`?(t(),F(Ot,{key:1,text:e.text},null,8,[`text`])):f(``,!0)],64))),128))],2)):d.value===`code`&&m.value?(t(),F(wt,{key:1,code:m.value},null,8,[`code`])):d.value===`table`&&h.value?(t(),F(Ct,{key:2,rows:h.value},null,8,[`rows`])):(t(),F(xt,{key:3,value:n.result},null,8,[`value`]))}}),[[`__cssModules`,{$style:{contentList:`_contentList_1ooyo_2`}}]]),At=Z(o({__name:`ToolCallStep`,props:{toolCall:{},label:{},showConnector:{type:Boolean}},setup(e){let a=e,{getToolLabel:o,getToggleLabel:s,getHideLabel:c}=_t();function l(e){let t=o(e.toolName)||e.toolName;if(e.toolName===`delegate`){let n=typeof e.args?.role==`string`?e.args.role:``;return n?`${t} (${n})`:t}return e.toolName===`web-search`&&typeof e.args?.query==`string`?`${t}: "${e.args.query}"`:e.toolName===`fetch-url`&&typeof e.args?.url==`string`?`${t}: ${e.args.url}`:t}return(e,o)=>(t(),i(`div`,{class:v(e.$style.step)},[r(`div`,{class:v(e.$style.iconColumn)},[E(m(G),{icon:a.toolCall.isLoading?`spinner`:m(gt)(a.toolCall.toolName),size:`small`,spin:a.toolCall.isLoading,class:v([e.$style.stepIcon,a.toolCall.isLoading&&e.$style.loadingIcon])},null,8,[`icon`,`spin`,`class`]),a.showConnector?(t(),i(`div`,{key:0,class:v(e.$style.connector)},null,2)):f(``,!0)],2),r(`div`,{class:v(e.$style.stepContent)},[r(`span`,{class:v(e.$style.stepLabel)},d(a.label??l(a.toolCall)),3),m(s)(a.toolCall)?(t(),F(m(V),{key:0,class:v(e.$style.toggleBlock)},{default:I(({open:r})=>[E(m(K),{class:v(e.$style.toggleButton)},{default:I(()=>[n(d(r?m(c)(a.toolCall):m(s)(a.toolCall)),1)]),_:2},1032,[`class`]),E(m(ie),{class:v(e.$style.toggleContent)},{default:I(()=>[a.toolCall.args?(t(),i(`div`,{key:0,class:v(e.$style.dataSection)},[E(xt,{value:a.toolCall.args},null,8,[`value`])],2)):f(``,!0),a.toolCall.result===void 0?f(``,!0):(t(),i(`div`,{key:1,class:v(e.$style.dataSection)},[E(kt,{result:a.toolCall.result,"tool-name":a.toolCall.toolName},null,8,[`result`,`tool-name`])],2)),a.toolCall.error===void 0?f(``,!0):(t(),i(`div`,{key:2,class:v([e.$style.dataSection,e.$style.errorText])},d(a.toolCall.error),3))]),_:1},8,[`class`])]),_:1},8,[`class`])):f(``,!0),T(e.$slots,`default`)],2)],2))}}),[[`__cssModules`,{$style:{step:`_step_1cfr8_125`,iconColumn:`_iconColumn_1cfr8_130`,connector:`_connector_1cfr8_139`,stepIcon:`_stepIcon_1cfr8_146`,loadingIcon:`_loadingIcon_1cfr8_151`,stepContent:`_stepContent_1cfr8_155`,stepLabel:`_stepLabel_1cfr8_163`,toggleBlock:`_toggleBlock_1cfr8_169`,toggleButton:`_toggleButton_1cfr8_173`,toggleContent:`_toggleContent_1cfr8_190`,dataSection:`_dataSection_1cfr8_196`,errorText:`_errorText_1cfr8_212`}}]]),jt=Z(o({__name:`SubagentStepTimeline`,props:{agentNode:{}},setup(e){let a=e,o=L(),{getToolLabel:s,getToggleLabel:c,getHideLabel:l}=_t(),p=/```/;function h(e){let t=e.replace(/```[\s\S]*?```/g,``).trim().split(`
`).find(e=>e.trim().length>0)??``;return t?t.length>80?t.slice(0,80)+`…`:t:o.baseText(`instanceAi.stepTimeline.craftingWorkflow`)}function g(e){return p.test(e)}let y=u(()=>{let e={};for(let t of a.agentNode.toolCalls)e[t.toolCallId]=t;return e}),b=u(()=>{let e=[];for(let t of a.agentNode.timeline)if(t.type===`text`){let n=g(t.content);e.push({type:`text`,icon:`brain`,label:n?h(t.content):t.content,isLoading:!1,textContent:t.content,isLongText:n,shortLabel:n?h(t.content):void 0})}else if(t.type===`tool-call`){let n=y.value[t.toolCallId];if(!n)continue;e.push({type:`tool-call`,icon:n.isLoading?`spinner`:gt(n.toolName),label:s(n.toolName),isLoading:n.isLoading,toggleLabel:c(n),hideLabel:l(n),toolCall:n})}return a.agentNode.status===`completed`&&e.push({type:`done`,icon:`circle-check`,label:o.baseText(`instanceAi.stepTimeline.done`),isLoading:!1}),e});return(e,a)=>(t(),i(`div`,{class:v(e.$style.timeline)},[(t(!0),i(_,null,N(b.value,(a,s)=>(t(),i(_,{key:s},[a.type===`tool-call`&&a.toolCall?(t(),F(At,{key:0,"tool-call":a.toolCall,label:a.label,"show-connector":s<b.value.length-1},null,8,[`tool-call`,`label`,`show-connector`])):(t(),i(`div`,{key:1,class:v(e.$style.step)},[r(`div`,{class:v(e.$style.iconColumn)},[E(m(G),{icon:a.icon,size:`small`,spin:a.isLoading,class:v([e.$style.stepIcon,a.type===`done`&&e.$style.doneIcon,a.isLoading&&e.$style.loadingIcon])},null,8,[`icon`,`spin`,`class`]),s<b.value.length-1?(t(),i(`div`,{key:0,class:v(e.$style.connector)},null,2)):f(``,!0)],2),r(`div`,{class:v(e.$style.content)},[a.type===`text`?(t(),i(_,{key:0},[a.isLongText?(t(),i(_,{key:0},[r(`span`,{class:v(e.$style.textLabel)},d(a.shortLabel),3),E(m(V),{class:v(e.$style.toggleBlock)},{default:I(({open:t})=>[E(m(K),{class:v(e.$style.toggleButton)},{default:I(()=>[n(d(m(o).baseText(t?`instanceAi.stepTimeline.hideData`:`instanceAi.stepTimeline.showData`)),1)]),_:2},1032,[`class`]),E(m(ie),{class:v(e.$style.toggleContent)},{default:I(()=>[r(`div`,{class:v(e.$style.dataSection)},[E(mt,{content:a.textContent},null,8,[`content`])],2)]),_:2},1032,[`class`])]),_:2},1032,[`class`])],64)):(t(),i(`div`,{key:1,class:v(e.$style.textLabel)},[E(mt,{content:a.textContent},null,8,[`content`])],2))],64)):a.type===`done`?(t(),i(`span`,{key:1,class:v(e.$style.doneLabel)},d(a.label),3)):f(``,!0)],2)],2))],64))),128))],2))}}),[[`__cssModules`,{$style:{timeline:`_timeline_2n97n_125`,step:`_step_2n97n_130`,iconColumn:`_iconColumn_2n97n_135`,connector:`_connector_2n97n_144`,stepIcon:`_stepIcon_2n97n_151`,doneIcon:`_doneIcon_2n97n_156`,loadingIcon:`_loadingIcon_2n97n_160`,content:`_content_2n97n_164`,textLabel:`_textLabel_2n97n_172`,doneLabel:`_doneLabel_2n97n_178`,toggleBlock:`_toggleBlock_2n97n_184`,toggleButton:`_toggleButton_2n97n_188`,toggleContent:`_toggleContent_2n97n_205`,dataSection:`_dataSection_2n97n_211`}}]]),Mt=Z(o({__name:`AgentSection`,props:{agentNode:{}},setup(e){let o=e,s=L(),c=$(),l=a(!1),h=A(`peekContainer`),g=u(()=>o.agentNode.status===`active`),_=u(()=>o.agentNode.status===`error`),y=u(()=>o.agentNode.subtitle??o.agentNode.role??`Working...`);function b(){c.amendAgent(o.agentNode.agentId,o.agentNode.role,o.agentNode.taskId)}function x(){l.value=!l.value}C(()=>o.agentNode.status,e=>{e===`completed`&&(l.value=!1)});function S(){h.value&&!l.value&&(h.value.scrollTop=h.value.scrollHeight)}return C(()=>o.agentNode.timeline.length,async()=>{await p(),S()}),C(l,async e=>{e||(await p(),S())},{flush:`post`}),(e,a)=>(t(),i(`div`,{class:v(e.$style.root)},[r(`div`,{class:v(e.$style.header),role:`button`,tabindex:`0`,onClick:x,onKeydown:D(x,[`enter`])},[E(m(G),{icon:l.value?`chevron-down`:`chevron-right`,size:`small`,class:v(e.$style.chevron)},null,8,[`icon`,`class`]),r(`span`,{class:v([e.$style.title,g.value&&e.$style.shimmer])},d(y.value),3),g.value?(t(),i(`button`,{key:0,class:v(e.$style.stopButton),onClick:w(b,[`stop`])},[E(m(G),{icon:`square`,size:`small`}),n(` `+d(m(s).baseText(`instanceAi.agent.stop`)),1)],2)):f(``,!0)],34),l.value?(t(),i(`div`,{key:0,class:v(e.$style.content)},[E(jt,{"agent-node":o.agentNode},null,8,[`agent-node`])],2)):g.value?(t(),i(`div`,{key:1,class:v(e.$style.peekWrapper),onClick:x},[r(`div`,{class:v(e.$style.peekGradient)},null,2),r(`div`,{ref:`peekContainer`,class:v(e.$style.peekContainer)},[E(jt,{"agent-node":o.agentNode},null,8,[`agent-node`])],2)],2)):f(``,!0),_.value&&o.agentNode.error?(t(),i(`div`,{key:2,class:v(e.$style.errorResult)},[E(m(G),{icon:`triangle-alert`,size:`small`,class:v(e.$style.errorIcon)},null,8,[`class`]),r(`span`,null,d(o.agentNode.error),1)],2)):f(``,!0)],2))}}),[[`__cssModules`,{$style:{root:`_root_zyypu_125`,header:`_header_zyypu_129`,title:`_title_zyypu_142`,chevron:`_chevron_zyypu_151`,content:`_content_zyypu_156`,peekWrapper:`_peekWrapper_zyypu_160`,peekGradient:`_peekGradient_zyypu_165`,peekContainer:`_peekContainer_zyypu_176`,errorResult:`_errorResult_zyypu_181`,errorIcon:`_errorIcon_zyypu_190`,stopButton:`_stopButton_zyypu_195`,shimmer:`_shimmer_zyypu_213`}}]]),Nt=Z(o({__name:`ArtifactCard`,props:{type:{},name:{},resourceId:{},projectId:{},metadata:{}},setup(e){let n=e,a=l(`openWorkflowPreview`,void 0),o=l(`openDataTablePreview`,void 0),s={workflow:`workflow`,"data-table":`table`},c=u(()=>s[n.type]??`file`);function p(e){if(n.type===`workflow`){if(e.metaKey||e.ctrlKey){window.open(`/workflow/${n.resourceId}`,`_blank`);return}a?.(n.resourceId)}else if(n.type===`data-table`){if(e.metaKey||e.ctrlKey){let e=n.projectId?`/projects/${n.projectId}/datatables/${n.resourceId}`:`/data-tables`;window.open(e,`_blank`);return}n.projectId&&o?.(n.resourceId,n.projectId)}}return(e,a)=>(t(),i(`div`,{class:v(e.$style.card),onClick:p},[E(m(G),{icon:c.value,size:`medium`,class:v(e.$style.icon)},null,8,[`icon`,`class`]),r(`div`,{class:v(e.$style.content)},[r(`span`,{class:v(e.$style.name)},d(n.name),3),n.metadata?(t(),i(`span`,{key:0,class:v(e.$style.metadata)},d(n.metadata),3)):f(``,!0)],2)],2))}}),[[`__cssModules`,{$style:{card:`_card_nvrxo_125`,icon:`_icon_nvrxo_142`,content:`_content_nvrxo_147`,name:`_name_nvrxo_154`,metadata:`_metadata_nvrxo_163`}}]]),Pt=Z(o({__name:`DelegateCard`,props:{args:{},result:{},isLoading:{type:Boolean},toolCallId:{}},setup(e){let n=e,o=L(),{getToolLabel:s}=_t(),c=a(!1),l=u(()=>typeof n.args.role==`string`?n.args.role:``),p=u(()=>Array.isArray(n.args.tools)&&n.args.tools.every(e=>typeof e==`string`)?n.args.tools:[]),h=u(()=>typeof n.args.briefing==`string`?n.args.briefing:``);return(e,a)=>(t(),i(`div`,{class:v(e.$style.root)},[r(`div`,{class:v(e.$style.header)},[r(`div`,{class:v(e.$style.headerLeft)},[n.isLoading?(t(),F(m(G),{key:0,icon:`spinner`,class:v(e.$style.spinner),spin:``,size:`small`},null,8,[`class`])):(t(),F(m(G),{key:1,icon:`check`,class:v(e.$style.successIcon),size:`small`},null,8,[`class`])),r(`span`,{class:v(e.$style.delegatingLabel)},d(m(o).baseText(`instanceAi.delegateCard.delegatingTo`))+`: `,3),r(`span`,{class:v(e.$style.role)},d(l.value),3)],2)],2),p.value.length>0?(t(),i(`div`,{key:0,class:v(e.$style.toolsRow)},[r(`span`,{class:v(e.$style.toolsLabel)},d(m(o).baseText(`instanceAi.delegateCard.tools`)),3),(t(!0),i(_,null,N(p.value,n=>(t(),i(`span`,{key:n,class:v(e.$style.toolBadge)},d(m(s)(n)),3))),128))],2)):f(``,!0),h.value?(t(),F(m(V),{key:1,open:c.value,"onUpdate:open":a[0]||=e=>c.value=e,class:v(e.$style.briefingBlock)},{default:I(()=>[E(m(K),{class:v(e.$style.briefingTrigger)},{default:I(()=>[r(`span`,null,d(m(o).baseText(`instanceAi.delegateCard.briefing`)),1),E(m(G),{icon:c.value?`chevron-up`:`chevron-down`,size:`small`},null,8,[`icon`])]),_:1},8,[`class`]),E(m(ie),{class:v(e.$style.briefingContent)},{default:I(()=>[r(`p`,null,d(h.value),1)]),_:1},8,[`class`])]),_:1},8,[`open`,`class`])):f(``,!0)],2))}}),[[`__cssModules`,{$style:{root:`_root_1kgxr_125`,header:`_header_1kgxr_133`,headerLeft:`_headerLeft_1kgxr_140`,delegatingLabel:`_delegatingLabel_1kgxr_147`,role:`_role_1kgxr_151`,spinner:`_spinner_1kgxr_156`,successIcon:`_successIcon_1kgxr_160`,toolsRow:`_toolsRow_1kgxr_164`,toolsLabel:`_toolsLabel_1kgxr_172`,toolBadge:`_toolBadge_1kgxr_181`,briefingBlock:`_briefingBlock_1kgxr_192`,briefingTrigger:`_briefingTrigger_1kgxr_196`,briefingContent:`_briefingContent_1kgxr_216`}}]]),Ft=Z(o({__name:`TaskChecklist`,props:{tasks:{}},setup(e){let n={todo:{icon:`circle`,spin:!1,className:`todoIcon`},in_progress:{icon:`spinner`,spin:!0,className:`activeIcon`},done:{icon:`check`,spin:!1,className:`doneIcon`},failed:{icon:`triangle-alert`,spin:!1,className:`failedIcon`},cancelled:{icon:`x`,spin:!1,className:`cancelledIcon`}};function a(e){return n[e]??n.todo}return(n,o)=>e.tasks?.tasks?.length?(t(),i(`div`,{key:0,class:v(n.$style.root)},[(t(!0),i(_,null,N(e.tasks.tasks,e=>(t(),i(`div`,{key:e.id,class:v(n.$style.row)},[E(m(G),{icon:a(e.status).icon,spin:a(e.status).spin,size:`small`,class:v(n.$style[a(e.status).className])},null,8,[`icon`,`spin`,`class`]),r(`span`,{class:v([n.$style.label,e.status===`done`&&n.$style.labelDone,e.status===`cancelled`&&n.$style.labelCancelled])},d(e.description),3)],2))),128))],2)):f(``,!0)}}),[[`__cssModules`,{$style:{root:`_root_1b06l_125`,row:`_row_1b06l_136`,label:`_label_1b06l_144`,labelDone:`_labelDone_1b06l_148`,labelCancelled:`_labelCancelled_1b06l_152`,todoIcon:`_todoIcon_1b06l_157`,activeIcon:`_activeIcon_1b06l_161`,doneIcon:`_doneIcon_1b06l_165`,failedIcon:`_failedIcon_1b06l_169`,cancelledIcon:`_cancelledIcon_1b06l_173`}}]]),It=Z(o({__name:`AnsweredQuestions`,props:{toolCall:{}},setup(e){let r=e;function a(){let e=r.toolCall.confirmation?.questions??[],t=r.toolCall.result?.answers??[];return e.map(e=>{let n=t.find(t=>t.questionId===e.id);if(!n||n.skipped)return{question:e.question,answer:``,skipped:!0};let r=[];return Array.isArray(n.selectedOptions)&&n.selectedOptions.length>0&&r.push(n.selectedOptions.join(`, `)),typeof n.customText==`string`&&n.customText.trim()&&r.push(n.customText.trim()),{question:e.question,answer:r.join(` — `)||``,skipped:r.length===0}})}return(e,r)=>(t(),i(`div`,{class:v(e.$style.container),"data-test-id":`instance-ai-answered-questions`},[(t(!0),i(_,null,N(a(),(a,o)=>(t(),i(`div`,{key:o,class:v(e.$style.answerItem)},[E(m(q),{bold:!0,class:v(e.$style.question)},{default:I(()=>[n(d(a.question),1)]),_:2},1032,[`class`]),a.skipped?(t(),F(m(q),{key:0,class:v(e.$style.skipped)},{default:I(()=>[...r[0]||=[n(`Skipped`,-1)]]),_:1},8,[`class`])):(t(),F(m(q),{key:1},{default:I(()=>[n(d(a.answer),1)]),_:2},1024))],2))),128))],2))}}),[[`__cssModules`,{$style:{container:`_container_1qtcc_125`,answerItem:`_answerItem_1qtcc_132`,question:`_question_1qtcc_141`,skipped:`_skipped_1qtcc_145`}}]]),Lt=[`onClick`],Rt=[`placeholder`,`disabled`],zt=o({__name:`PlanReviewPanel`,props:{plannedTasks:{},message:{},disabled:{type:Boolean},readOnly:{type:Boolean}},emits:[`approve`,`request-changes`],setup(e,{emit:o}){let s=e,c=L(),l=o,p=a(new Set),h=a(``),g=a(!1),y=a(null),x=u(()=>h.value.trim().length>0),C={"build-workflow":{icon:`workflow`,label:`Workflow`},"manage-data-tables":{icon:`table`,label:`Data table`},research:{icon:`search`,label:`Research`},delegate:{icon:`share`,label:`Task`}};function w(e){return C[e]??{icon:`circle`,label:e}}function T(e){p.value.has(e)?p.value.delete(e):p.value.add(e)}function D(e){return e.deps.length?e.deps.map(e=>s.plannedTasks.find(t=>t.id===e)?.title??e):[]}function O(){g.value||(g.value=!0,y.value=`approved`,l(`approve`))}function k(){g.value||!x.value||(g.value=!0,y.value=`changes-requested`,l(`request-changes`,h.value.trim()))}return(a,o)=>(t(),i(`div`,{class:v(a.$style.root),"data-test-id":`instance-ai-plan-review`},[r(`div`,{class:v(a.$style.header)},[E(m(G),{icon:`scroll-text`,size:`small`,class:v(a.$style.headerIcon)},null,8,[`class`]),r(`span`,{class:v(a.$style.headerTitle)},d(m(c).baseText(`instanceAi.planReview.title`)),3),r(`span`,{class:v(a.$style.taskCount)},d(e.plannedTasks.length)+` tasks`,3),s.readOnly?(t(),i(`span`,{key:0,class:v(a.$style.badgeApproved)},d(m(c).baseText(`instanceAi.planReview.approved`)),3)):g.value?y.value===`approved`?(t(),i(`span`,{key:2,class:v(a.$style.badgeApproved)},d(m(c).baseText(`instanceAi.planReview.approved`)),3)):f(``,!0):(t(),i(`span`,{key:1,class:v(a.$style.badge)},d(m(c).baseText(`instanceAi.planReview.awaitingApproval`)),3))],2),r(`div`,{class:v(a.$style.tasks)},[(t(!0),i(_,null,N(e.plannedTasks,(e,n)=>(t(),i(`div`,{key:e.id,class:v(a.$style.taskItem)},[r(`button`,{class:v([a.$style.taskRow,p.value.has(e.id)&&a.$style.taskRowExpanded]),type:`button`,onClick:t=>T(e.id)},[r(`span`,{class:v(a.$style.taskNumber)},d(n+1),3),E(m(G),{icon:w(e.kind).icon,size:`small`,class:v(a.$style.taskKindIcon)},null,8,[`icon`,`class`]),r(`span`,{class:v(a.$style.taskTitle)},d(e.title),3),r(`span`,{class:v(a.$style.taskKindBadge)},d(w(e.kind).label),3),E(m(G),{icon:p.value.has(e.id)?`chevron-up`:`chevron-down`,size:`small`,class:v(a.$style.chevron)},null,8,[`icon`,`class`])],10,Lt),p.value.has(e.id)?(t(),i(`div`,{key:0,class:v(a.$style.taskDetail)},[r(`p`,{class:v(a.$style.taskSpec)},d(e.spec),3),D(e).length>0?(t(),i(`div`,{key:0,class:v(a.$style.taskDeps)},[r(`span`,{class:v(a.$style.depsLabel)},`Depends on:`,2),(t(!0),i(_,null,N(D(e),e=>(t(),i(`span`,{key:e,class:v(a.$style.depChip)},d(e),3))),128))],2)):f(``,!0)],2)):f(``,!0)],2))),128))],2),!g.value&&!s.readOnly?(t(),i(`div`,{key:0,class:v(a.$style.footer)},[b(r(`textarea`,{"onUpdate:modelValue":o[0]||=e=>h.value=e,class:v(a.$style.feedbackTextarea),placeholder:m(c).baseText(`instanceAi.planReview.feedbackPlaceholder`),disabled:e.disabled,rows:`2`},null,10,Rt),[[S,h.value]]),r(`div`,{class:v(a.$style.actions)},[E(m(J),{variant:`outline`,size:`small`,disabled:e.disabled||!x.value,"data-test-id":`instance-ai-plan-request-changes`,onClick:k},{default:I(()=>[n(d(m(c).baseText(`instanceAi.planReview.requestChanges`)),1)]),_:1},8,[`disabled`]),E(m(J),{type:`primary`,size:`small`,disabled:e.disabled,"data-test-id":`instance-ai-plan-approve`,onClick:O},{default:I(()=>[n(d(m(c).baseText(`instanceAi.planReview.approve`)),1)]),_:1},8,[`disabled`])],2)],2)):f(``,!0)],2))}}),Bt=`_root_c6qwn_125`,Vt=`_header_c6qwn_132`,Ht=`_headerIcon_c6qwn_140`,Ut=`_headerTitle_c6qwn_145`,Wt=`_taskCount_c6qwn_151`,Gt=`_badge_c6qwn_156`,Kt=`_badgeApproved_c6qwn_167`,qt=`_tasks_c6qwn_178`,Jt=`_taskItem_c6qwn_183`,Yt=`_taskRow_c6qwn_187`,Xt=`_taskNumber_c6qwn_204`,Zt=`_taskKindIcon_c6qwn_218`,Qt=`_taskTitle_c6qwn_223`,$t=`_taskKindBadge_c6qwn_234`,en=`_chevron_c6qwn_244`,tn=`_taskDetail_c6qwn_249`,nn=`_taskSpec_c6qwn_265`,rn=`_taskDeps_c6qwn_274`,an=`_depsLabel_c6qwn_282`,on=`_depChip_c6qwn_288`,sn=`_footer_c6qwn_297`,cn=`_feedbackTextarea_c6qwn_305`,ln=`_actions_c6qwn_324`,un=Z(zt,[[`__cssModules`,{$style:{root:Bt,header:Vt,headerIcon:Ht,headerTitle:Ut,taskCount:Wt,badge:Gt,badgeApproved:Kt,tasks:qt,taskItem:Jt,taskRow:Yt,taskNumber:Xt,taskKindIcon:Zt,taskTitle:Qt,taskKindBadge:$t,chevron:en,taskDetail:tn,"detail-slide-in":`_detail-slide-in_c6qwn_1`,taskSpec:nn,taskDeps:rn,depsLabel:an,depChip:on,footer:sn,feedbackTextarea:cn,actions:ln}}]]);function dn(e){if(e.status!==`completed`)return[];let t=[],n=new Set;if(e.targetResource?.id&&e.targetResource.type){let r=e.targetResource.type;(r===`workflow`||r===`data-table`)&&(n.add(e.targetResource.id),t.push({type:r,resourceId:e.targetResource.id,name:e.targetResource.name??e.subtitle??`Untitled`,completedAt:void 0}))}for(let r of e.toolCalls){if(!r.result||typeof r.result!=`object`)continue;let e=r.result;if((r.toolName===`build-workflow`||r.toolName===`submit-workflow`)&&typeof e.workflowId==`string`&&!n.has(e.workflowId)){n.add(e.workflowId);let i=(typeof e.workflowName==`string`?e.workflowName:void 0)??(typeof r.args?.name==`string`?r.args.name:void 0)??`Untitled`;t.push({type:`workflow`,resourceId:e.workflowId,name:i,completedAt:r.completedAt});continue}let i,a,o;typeof e.tableId==`string`&&(i=e.tableId),typeof e.dataTableId==`string`&&(i=e.dataTableId),typeof e.name==`string`&&(a=e.name),typeof e.tableName==`string`&&(a=e.tableName),typeof e.projectId==`string`&&(o=e.projectId);let s=e.table;if(s&&typeof s==`object`){let e=s;typeof e.id==`string`&&(i=e.id),typeof e.name==`string`&&(a=e.name),typeof e.projectId==`string`&&(o=e.projectId)}i&&!n.has(i)&&(n.add(i),t.push({type:`data-table`,resourceId:i,name:a??`Untitled`,projectId:o,completedAt:r.completedAt}))}for(let r of e.children)for(let e of dn(r))n.has(e.resourceId)||(n.add(e.resourceId),t.push(e));return t}var fn=Z(o({__name:`AgentTimeline`,props:{agentNode:{},compact:{type:Boolean,default:!1}},setup(e){let n=L(),r=$();function a(e){for(let t of r.resourceRegistry.values())if(t.id===e.resourceId)return t.name;return e.name}function o(e){let t=Date.now()-new Date(e).getTime(),r=Math.floor(t/6e4);if(r<1)return n.baseText(`instanceAi.artifactCard.updatedJustNow`);let i=Math.floor(r/60);if(i<1){let e=r===1?`instanceAi.artifactCard.minute`:`instanceAi.artifactCard.minutes`,t=n.baseText(e,{interpolate:{count:`${r}`}});return n.baseText(`instanceAi.artifactCard.updatedAgo`,{interpolate:{time:t}})}let a=i===1?`instanceAi.artifactCard.hour`:`instanceAi.artifactCard.hours`,o=n.baseText(a,{interpolate:{count:`${i}`}});return n.baseText(`instanceAi.artifactCard.updatedAgo`,{interpolate:{time:o}})}function s(e){let t=new Date(e),r=t.getDate(),i=t.toLocaleString(`en`,{month:`long`});return n.baseText(`instanceAi.artifactCard.createdAt`,{interpolate:{date:`${r} ${i}`}})}function c(e){let t=[];return e.completedAt?(t.push(o(e.completedAt)),t.push(s(e.completedAt))):t.push(n.baseText(`instanceAi.artifactCard.updatedJustNow`)),t.join(` │ `)}let l=e,d=new Set([`updateWorkingMemory`]),p=u(()=>{let e={};for(let t of l.agentNode.toolCalls)e[t.toolCallId]=t;return e}),h=u(()=>{let e={};for(let t of l.agentNode.children)e[t.agentId]=t;return e});function g(e,t,n){let i=e.confirmation?.requestId;i&&(r.resolveConfirmation(i,t?`approved`:`denied`),r.confirmAction(i,t,void 0,void 0,void 0,n))}return(e,n)=>(t(),i(`div`,{class:v(e.$style.timeline)},[(t(!0),i(_,null,N(l.agentNode.timeline,(n,r)=>(t(),i(_,{key:r},[n.type===`text`?(t(),i(`div`,{key:0,class:v([e.$style.textContent,l.compact&&e.$style.compactText])},[E(mt,{content:n.content},null,8,[`content`])],2)):n.type===`tool-call`&&p.value[n.toolCallId]&&!m(d).has(p.value[n.toolCallId].toolName)?(t(),i(_,{key:1},[p.value[n.toolCallId].renderHint===`tasks`?(t(),F(Ft,{key:0,tasks:l.agentNode.tasks},null,8,[`tasks`])):p.value[n.toolCallId].renderHint===`delegate`?(t(),F(Pt,{key:1,args:p.value[n.toolCallId].args,result:p.value[n.toolCallId].result,"is-loading":p.value[n.toolCallId].isLoading,"tool-call-id":p.value[n.toolCallId].toolCallId},null,8,[`args`,`result`,`is-loading`,`tool-call-id`])):p.value[n.toolCallId].renderHint===`builder`?(t(),i(_,{key:2},[],64)):p.value[n.toolCallId].renderHint===`data-table`?(t(),i(_,{key:3},[],64)):p.value[n.toolCallId].renderHint===`researcher`?(t(),i(_,{key:4},[],64)):p.value[n.toolCallId].confirmation?.inputType===`questions`&&!p.value[n.toolCallId].isLoading?(t(),F(It,{key:5,"tool-call":p.value[n.toolCallId]},null,8,[`tool-call`])):p.value[n.toolCallId].confirmation?.inputType===`plan-review`?(t(),F(un,{key:6,"planned-tasks":p.value[n.toolCallId].args?.tasks??[],"read-only":!p.value[n.toolCallId].isLoading,onApprove:e=>g(p.value[n.toolCallId],!0),onRequestChanges:e=>g(p.value[n.toolCallId],!1,e)},null,8,[`planned-tasks`,`read-only`,`onApprove`,`onRequestChanges`])):p.value[n.toolCallId].confirmation?.inputType===`questions`&&p.value[n.toolCallId].isLoading?(t(),i(_,{key:7},[],64)):(t(),F(At,{key:8,"tool-call":p.value[n.toolCallId],"show-connector":!0},{default:I(()=>[T(e.$slots,`after-tool-call`,{toolCall:p.value[n.toolCallId]})]),_:2},1032,[`tool-call`]))],64)):n.type===`child`&&h.value[n.agentId]?(t(),i(_,{key:2},[E(Mt,{"agent-node":h.value[n.agentId]},null,8,[`agent-node`]),(t(!0),i(_,null,N(m(dn)(h.value[n.agentId]),e=>(t(),F(Nt,{key:e.resourceId,type:e.type,name:a(e),"resource-id":e.resourceId,"project-id":e.projectId,metadata:c(e)},null,8,[`type`,`name`,`resource-id`,`project-id`,`metadata`]))),128))],64)):f(``,!0)],64))),128))],2))}}),[[`__cssModules`,{$style:{timeline:`_timeline_15b7h_125`,textContent:`_textContent_15b7h_129`,compactText:`_compactText_15b7h_136`}}]]),pn=Z(o({__name:`AgentActivityTree`,props:{agentNode:{},isRoot:{type:Boolean,default:!1}},setup(e){let n=e,a=L(),o=u(()=>n.agentNode.reasoning.length>0);return(s,c)=>(t(),i(`div`,{class:v(s.$style.tree)},[e.isRoot&&o.value?(t(),F(m(V),{key:0,class:v(s.$style.reasoningBlock)},{default:I(()=>[E(m(K),{class:v(s.$style.reasoningTrigger)},{default:I(()=>[E(m(G),{icon:`brain`,size:`small`}),r(`span`,null,d(m(a).baseText(`instanceAi.message.reasoning`)),1)]),_:1},8,[`class`]),E(m(ie),{class:v(s.$style.reasoningContent)},{default:I(()=>[r(`p`,null,d(n.agentNode.reasoning),1)]),_:1},8,[`class`])]),_:1},8,[`class`])):f(``,!0),E(fn,{"agent-node":n.agentNode},null,8,[`agent-node`])],2))}}),[[`__cssModules`,{$style:{tree:`_tree_yl6ea_125`,reasoningBlock:`_reasoningBlock_yl6ea_129`,reasoningTrigger:`_reasoningTrigger_yl6ea_133`,reasoningContent:`_reasoningContent_yl6ea_149`}}]]),mn=o({__name:`InstanceAiMessage`,props:{message:{}},setup(e){let n=e,o=L(),s=$(),c=a(!1),l=u(()=>n.message.role===`user`),p=u(()=>n.message.isStreaming),h=u(()=>n.message.content.length>0||p.value),g=u(()=>{let e=n.message.agentTree;return!e||e.status!==`error`||!e.error?null:e.error}),y=u(()=>{let e=n.message.agentTree;return!e||e.status!==`error`?null:e.errorDetails??null}),b=u(()=>!!y.value?.provider),x=u(()=>b.value?`${y.value.provider} ${o.baseText(`instanceAi.agentTree.error`)}`:g.value??o.baseText(`instanceAi.error.title`)),S=u(()=>{let e=y.value;if(!e?.technicalDetails)return null;try{return JSON.stringify(JSON.parse(e.technicalDetails),null,2)}catch{return e.technicalDetails}}),C=u(()=>n.message.attachments??[]),w=u(()=>!p.value||!n.message.agentTree?``:n.message.agentTree.statusMessage??``),T=u(()=>!n.message.agentTree||n.message.isStreaming?!1:n.message.agentTree.children.some(e=>e.status===`active`)),D=u(()=>n.message.messageGroupId??n.message.id),O=u(()=>!l.value&&s.rateableResponseId===D.value&&!(D.value in s.feedbackByResponseId)),k=u(()=>!l.value&&D.value in s.feedbackByResponseId);function A(e){s.submitFeedback(D.value,e)}function j(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}return(e,a)=>(t(),i(`div`,{class:v([e.$style.message,l.value?e.$style.userMessage:e.$style.assistantMessage])},[l.value?(t(),i(`div`,{key:0,class:v(e.$style.userBubble),"data-test-id":`instance-ai-user-message`},[C.value.length>0?(t(),i(`div`,{key:0,class:v(e.$style.userAttachments)},[(t(!0),i(_,null,N(C.value,(e,n)=>(t(),F(pt,{key:n,attachment:e,"is-removable":!1},null,8,[`attachment`]))),128))],2)):f(``,!0),r(`span`,null,d(n.message.content),1)],2)):(t(),i(`div`,{key:1,class:v(e.$style.assistantWrapper),"data-test-id":`instance-ai-assistant-message`},[r(`div`,{class:v(e.$style.assistantContent)},[n.message.agentTree?(t(),F(pn,{key:0,"agent-node":n.message.agentTree,"is-root":!0},null,8,[`agent-node`])):f(``,!0),g.value?(t(),i(`div`,{key:1,class:v(e.$style.errorBubble),role:`alert`},[r(`div`,{class:v(e.$style.errorIcon)},[E(m(G),{icon:`triangle-alert`,size:`medium`})],2),r(`div`,{class:v(e.$style.errorBody)},[r(`div`,{class:v(e.$style.errorHeader)},[r(`span`,{class:v(e.$style.errorTitle)},d(x.value),3),y.value?.statusCode?(t(),i(`span`,{key:0,class:v(e.$style.errorStatusCode)},d(y.value.statusCode),3)):f(``,!0)],2),b.value?(t(),i(`p`,{key:0,class:v(e.$style.errorDescription)},d(g.value),3)):f(``,!0),S.value?(t(),i(`details`,{key:1,class:v(e.$style.errorDetailsCollapsible)},[r(`summary`,{class:v(e.$style.errorDetailsSummary)},d(m(o).baseText(`instanceAi.error.technicalDetails`)),3),r(`pre`,{class:v(e.$style.errorDetailsContent)},d(S.value),3)],2)):f(``,!0)],2)],2)):f(``,!0),h.value&&!n.message.agentTree?(t(),i(`div`,{key:2,class:v(e.$style.textContent)},[n.message.content?(t(),F(mt,{key:0,content:n.message.content},null,8,[`content`])):f(``,!0)],2)):f(``,!0),w.value&&!n.message.content?(t(),i(`div`,{key:3,class:v(e.$style.statusIndicator)},[r(`span`,{class:v(e.$style.statusDot)},null,2),r(`span`,null,d(w.value),1)],2)):p.value&&!n.message.content&&!n.message.agentTree?(t(),i(`span`,{key:4,class:v(e.$style.blinkingCursor)},null,2)):f(``,!0),T.value?(t(),i(`div`,{key:5,class:v(e.$style.backgroundStatus)},[E(m(G),{icon:`spinner`,spin:``,size:`small`}),r(`span`,null,d(m(o).baseText(`instanceAi.backgroundTask.running`)),1)],2)):f(``,!0)],2),O.value?(t(),F(m(z),{key:0,minimal:``,"data-test-id":`instance-ai-message-rating`,onFeedback:A})):k.value?(t(),i(`p`,{key:1,class:v(e.$style.feedbackSuccess),"data-test-id":`instance-ai-feedback-success`},d(m(o).baseText(`instanceAi.feedback.success`)),3)):f(``,!0),r(`div`,{class:v(e.$style.actionButtons)},[m(s).debugMode&&!l.value?(t(),F(m(U),{key:0,icon:`code`,variant:`ghost`,size:`xsmall`,class:v(e.$style.actionBtn),onClick:a[0]||=e=>c.value=!c.value},null,8,[`class`])):f(``,!0)],2),c.value?(t(),i(`pre`,{key:2,class:v(e.$style.debugJson)},d(j(n.message)),3)):f(``,!0)],2))],2))}}),hn=`_message_9om9q_125`,gn=`_userMessage_9om9q_129`,_n=`_assistantMessage_9om9q_134`,vn=`_userAttachments_9om9q_139`,yn=`_userBubble_9om9q_146`,bn=`_assistantWrapper_9om9q_158`,xn=`_actionBtn_9om9q_163`,Sn=`_assistantContent_9om9q_167`,Cn=`_textContent_9om9q_171`,wn=`_actionButtons_9om9q_177`,Tn=`_feedbackSuccess_9om9q_195`,En=`_backgroundStatus_9om9q_201`,Dn=`_statusIndicator_9om9q_211`,On=`_statusDot_9om9q_221`,kn=`_pulse_9om9q_1`,An=`_blinkingCursor_9om9q_245`,jn=`_errorBubble_9om9q_262`,Mn=`_errorIcon_9om9q_275`,Nn=`_errorBody_9om9q_282`,Pn=`_errorHeader_9om9q_287`,Fn=`_errorTitle_9om9q_293`,In=`_errorStatusCode_9om9q_297`,Ln=`_errorDescription_9om9q_303`,Rn=`_errorDetailsCollapsible_9om9q_309`,zn=`_errorDetailsSummary_9om9q_313`,Bn=`_errorDetailsContent_9om9q_322`,Vn=`_debugJson_9om9q_336`,Hn=Z(mn,[[`__cssModules`,{$style:{message:hn,userMessage:gn,assistantMessage:_n,userAttachments:vn,userBubble:yn,assistantWrapper:bn,actionBtn:xn,assistantContent:Sn,textContent:Cn,actionButtons:wn,feedbackSuccess:Tn,backgroundStatus:En,statusIndicator:Dn,"status-fade-in":`_status-fade-in_9om9q_1`,statusDot:On,pulse:kn,blinkingCursor:An,"cursor-blink":`_cursor-blink_9om9q_1`,errorBubble:jn,errorIcon:Mn,errorBody:Nn,errorHeader:Pn,errorTitle:Fn,errorStatusCode:In,errorDescription:Ln,errorDetailsCollapsible:Rn,errorDetailsSummary:zn,errorDetailsContent:Bn,debugJson:Vn}}]]),Un=[`accept`],Wn=Z(o({__name:`ChatInputBase`,props:{modelValue:{},placeholder:{},isStreaming:{type:Boolean},canSubmit:{type:Boolean},disabled:{type:Boolean},showVoice:{type:Boolean},showAttach:{type:Boolean},