@farero-ai/ui 0.4.7 → 0.4.8
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/chunks/{chunk-MTA5M6VK.js → chunk-7OIEAISL.js} +1 -1
- package/dist/chunks/{chunk-JNOL5TLS.js → chunk-EUYN7WNH.js} +1 -1
- package/dist/chunks/{chunk-BLVH5CWZ.js → chunk-J6G4JKVU.js} +1 -1
- package/dist/chunks/{chunk-MHKNH5JT.js → chunk-OHGCJOUT.js} +1 -1
- package/dist/code.js +1 -1
- package/dist/commands.js +1 -1
- package/dist/fence.js +1 -1
- package/dist/generated-ui.js +1 -1
- package/dist/markdown.js +1 -1
- package/dist/transcript.d.ts +18 -2
- package/dist/transcript.js +15 -15
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import{a as n}from"./chunk-3I4YBQX6.js";import{z as f}from"zod";var O=f.object({sessionId:f.string().min(1),workspaceId:f.string().min(1),title:f.string(),through:f.number().int().positive().optional(),entryId:f.string().optional()}),C=f.object({version:f.literal(1),kind:f.enum(["fork","continue","reference"]),scope:f.enum(["chat","reply"]),sources:f.array(O).min(1)});function S(e){let t=[];for(let r of e.matchAll(/^<farero-chat-handoff>\n([^\n]+)\n[\s\S]*?^<\/farero-chat-handoff>/gm))try{let s=C.safeParse(JSON.parse(r[1]));if(!s.success)continue;t.push({handoff:s.data,token:r[0],start:r.index,end:r.index+r[0].length})}catch{}return t}n(S,"chatHandoffTokens");function I(e){let t=S(e),r=e;for(let s of[...t].reverse()){let i=r.slice(0,s.start).replace(/\n{1,2}$/,""),c=r.slice(s.end).replace(/^\n{1,2}/,"");r=i&&c?`${i}
|
|
2
2
|
|
|
3
|
-
${c}`:i+c}return{handoffs:t,text:r}}n(I,"splitChatHandoffs");function v(e){let t=e.sources.at(-1),r=new URLSearchParams({session:t.sessionId,source:t.sessionId,handoff:e.scope});return t.entryId&&r.set("entry",t.entryId),`/w/${encodeURIComponent(t.workspaceId)}?${r}`}n(v,"chatHandoffHref");var M=["AskUserQuestion","question","request_user_input","request_user_input_async","functions.request_user_input","functions.request_user_input_async","item/tool/requestUserInput","codex/request_user_input_async"],
|
|
3
|
+
${c}`:i+c}return{handoffs:t,text:r}}n(I,"splitChatHandoffs");function v(e){let t=e.sources.at(-1),r=new URLSearchParams({session:t.sessionId,source:t.sessionId,handoff:e.scope});return t.entryId&&r.set("entry",t.entryId),`/w/${encodeURIComponent(t.workspaceId)}?${r}`}n(v,"chatHandoffHref");var M=["AskUserQuestion","question","request_user_input","request_user_input_async","functions.request_user_input","functions.request_user_input_async","item/tool/requestUserInput","codex/request_user_input_async"],J=new Set(M.map(e=>e.toLowerCase().replace(/[_-]/g,"")));var P=1,Xe=`<farero-workflow-private version="${P}">`;function L(e){let t=/^\s*(me|agent)\s*:\s*([\s\S]*)$/i.exec(e);return t?{scope:t[1].toLowerCase(),text:t[2]}:{scope:null,text:e}}n(L,"parseSearchOperator");function Qe(e){let{text:t}=L(e);return t.toLowerCase().match(/[\p{L}\p{N}_]+/gu)??[]}n(Qe,"queryTokens");function Ye(e,t){let r=e.toLowerCase(),s=[...new Set(t.map(a=>a.toLowerCase()).filter(Boolean))];if(!s.length)return null;let i=s.map(a=>{let l=[];for(let d=0;d<=r.length-a.length;){let p=r.indexOf(a,d);if(p<0)break;l.push(p),d=p+1}return l});if(i.some(a=>!a.length))return null;let c=Number.POSITIVE_INFINITY;for(let a of i[0]){let l=a+s[0].length,d=0,p=!0;for(let g=1;g<s.length;g++){let _=i[g].find(T=>T>=l);if(_==null){p=!1;break}d+=_-l,l=_+s[g].length}p&&(c=Math.min(c,d))}if(Number.isFinite(c))return c;let o=i.flatMap((a,l)=>a.map(d=>({start:d,end:d+s[l].length,token:l}))).sort((a,l)=>a.start-l.start||a.end-l.end),u=new Array(s.length).fill(0),h=0,b=0,m=Number.POSITIVE_INFINITY;for(let a=0;a<o.length;a++){let l=o[a];for(u[l.token]++===0&&h++;h===s.length;){let d=0;for(let g=b;g<=a;g++)d=Math.max(d,o[g].end);m=Math.min(m,d-o[b].start);let p=o[b++];--u[p.token]===0&&h--}}let k=s.reduce((a,l)=>a+l.length,0);return 1e9+Math.max(0,m-k)}n(Ye,"textMatchRank");function Je(e){let t=/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)?$/.test(e);return Date.parse(t?`${e.replace(" ","T")}Z`:e)}n(Je,"timestampMs");var E=".context/attachments/",Ze=25*1024*1024;function N(e){return/^(?:[A-Za-z0-9]{6}|native_[a-f0-9]{64}|workflow_[a-f0-9]{40})$/.test(e)}n(N,"isAttachmentId");function et(e){let t=[],r=0;for(;r<e.length;){let s=e.indexOf("@\u27E6",r);if(s<0)break;let i=e.indexOf("\u27E7(",s+2);if(i<0||/[\r\n]/.test(e.slice(s,i))){r=s+2;continue}let c=e.slice(s+2,i),o=i+2,u=o,h=!1;for(;!h&&(u=e.indexOf(")",u),!(u<0));){let b=e.slice(o,u);try{let m=decodeURIComponent(b),k=m.startsWith(E)?m.slice(E.length):"",a=k.indexOf("/"),l=a<0?"":k.slice(0,a),d=a<0?"":k.slice(a+1);if(N(l)&&d===c&&!d.includes("/")){t.push({start:s,end:u+1,name:c,path:m}),r=u+1,h=!0;continue}}catch{}u+=1}h||(r=s+2)}return t}n(et,"attachmentTokens");var D=new Set([".avif",".gif",".jpeg",".jpg",".png",".webp"]);function F(e){let t=e.split(/[\\/]/).pop()??"",r=t.lastIndexOf(".");return r===-1?null:t.slice(r).toLowerCase()}n(F,"fileExtension");function tt(e){let t=F(e);return t!==null&&D.has(t)}n(tt,"isPreviewableImage");var w="Skill",x=["farero_host","farero","native"],U=new Set(["plugin_guide","plugin_prepare","plugin_run","plugin_status","workspace_overview","search_chats","read_chat","list_voice_calls","search_voice_calls","read_voice_call","list_workspaces","list_chats","list_roles","get_role","update_roles","update_workflows","delegate_task","cancel_delegation","ask_delegation_question","answer_delegation_question","list_delegations","workspace_diff","list_repos","plan_usage","create_workspace","create_chat","send_prompt","render_ui","create_tab","split","stop_turn","close_chat","rename_chat","list_models","set_default_model","set_agent_options","set_workspace_status","create_workspace_status","rename_workspace_status","delete_workspace_status","reorder_workspace_statuses","pin_workspace","set_workspace_webhooks","rename_workspace","dev_server","continue_workspace","archive_workspace","unarchive_workspace","dismiss_prompt","keep_awake","relay_logs","request_mcp_sign_in"]),$={read:"Read",edit:"Edit",multiedit:"MultiEdit",write:"Write",grep:"Grep",glob:"Glob",ls:"LS",list:"LS",bash:"Bash",websearch:"WebSearch",webfetch:"WebFetch",agent:"Agent",task:"Agent",subagent:"Agent",skill:w,todowrite:"TodoWrite",todoread:"TodoRead",question:"AskUserQuestion",askuserquestion:"AskUserQuestion",toolsearch:"ToolSearch",notebookedit:"NotebookEdit"};function nt(e,t=""){let r=n((o,u)=>({name:o?`mcp__${o}__${u}`:`mcp__${u}`,label:u,server:o}),"mcp"),s=n(o=>x.includes(o)?"farero_host":o,"host");if(e.startsWith("mcp__")){let o=e.slice(5).split("__");return o.length>1&&o.every(Boolean)?r(s(o.slice(0,-1).join("__")),o.at(-1)):{name:e,label:e,server:null}}if(e==="mcpToolCall"){let o=t&&t!==e?t:"";return o?r(U.has(o)?"farero_host":null,o):{name:e,label:e,server:null}}for(let o of x){let u=e[o.length];if(e.startsWith(o)&&(u==="_"||u===".")&&e.length>o.length+1)return r("farero_host",e.slice(o.length+1))}let i=e.toLowerCase().replace(/[_-]/g,""),c=i.endsWith("spawnagent")?"Agent":$[i];return{name:c??e,label:c??e,server:null}}n(nt,"toolIdentity");function rt(e){return e.role==="tool"&&e.tool===w}n(rt,"isSkillUse");function ot(e){let t=e;for(let r=0;r<3;r++){let s=/^(?:\S+\/)?(zsh|bash|sh|dash|ksh|fish)\s+-l?c\s+([\s\S]+)$/.exec(t.trim());if(!s)return t.trim()||e;let i=s[2].trim();if(i.length>=2){let c=i[0],o=i[i.length-1];(c==='"'&&o==='"'||c==="'"&&o==="'")&&(i=i.slice(1,-1).trim())}if(!i)return e;t=i}return t.trim()||e}n(ot,"unwrapShellCommand");var W=/^(?:\s*<(command-name|command-message|command-args|local-command-stdout|local-command-stderr|local-command-caveat)>[\s\S]*?<\/\1>\s*)+$/;function st(e){return!!e&&W.test(e.trim())}n(st,"isLocalCommandNoise");var q=/^(Delegated|Workflow) (\S+) task (\S+) (completed|failed)/m,H="For earlier investigation, use read_chat(";function it(e){return e.role!=="user"?!1:e.id.startsWith("return-")&&!e.id.includes("-retry")?!0:(e.id.startsWith("workflow_")||e.id.startsWith("return-"))&&q.test(e.text)&&e.text.includes(H)}n(it,"isDelegationReturnEntry");function at(e){return e.origin==="agent"}n(at,"isAgentAuthored");var V="[Automatic retry] ";function lt(e){return e.role==="user"&&e.id.includes("-retry")&&e.text.startsWith(V)}n(lt,"isAutomaticRetryEntry");var K=/^Background task (\w*): ?([\s\S]*)$/;function ct(e){let t=K.exec(e);return t?{status:t[1],summary:t[2]}:null}n(ct,"parseBackgroundTaskNotice");var A=String.raw`fb\.\d{1,2}\.\d{13}\.`,R=String.raw`(?:\.(?:[A-Za-z0-9_-]{2}|[A-Za-z0-9_-]{8}))?`,ut=new RegExp(`^${A}\\d{1,32}${R}$`),dt=new RegExp(`^${A}[A-Za-z0-9_-]{1,500}${R}$`);var ft=720*60*60*1e3;var pt=10*6e4;function y(e){return t=>e[t]===!0}n(y,"statusQuestion");var gt=y({disconnected:!1,connecting:!1,idle:!1,working:!0,waiting:!0,error:!1}),ht=y({disconnected:!1,connecting:!0,idle:!1,working:!0,waiting:!0,error:!1}),mt=y({disconnected:!1,connecting:!0,idle:!1,working:!0,waiting:!1,error:!1}),bt=y({disconnected:!0,connecting:!1,idle:!0,working:!1,waiting:!1,error:!1}),kt=y({disconnected:!1,connecting:!1,idle:!1,working:!1,waiting:!0,error:!0});export{S as a,I as b,v as c,Qe as d,Ye as e,Je as f,et as g,tt as h,nt as i,rt as j,ot as k,st as l,q as m,H as n,it as o,at as p,lt as q,ct as r};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as B}from"./chunk-JMYCJ5PW.js";import{a as k,b as v}from"./chunk-ONVWTQLU.js";import{a as _,j as D}from"./chunk-RWGTJDY3.js";import{e as N}from"./chunk-RR7BB4EQ.js";import{b as W,c as z}from"./chunk-
|
|
1
|
+
import{a as B}from"./chunk-JMYCJ5PW.js";import{a as k,b as v}from"./chunk-ONVWTQLU.js";import{a as _,j as D}from"./chunk-RWGTJDY3.js";import{e as N}from"./chunk-RR7BB4EQ.js";import{b as W,c as z}from"./chunk-J6G4JKVU.js";import{e as w,i as O}from"./chunk-OHGCJOUT.js";import{a as H,c as $,g as y,h as b}from"./chunk-7OIEAISL.js";import{d as I}from"./chunk-HGN4GN2E.js";import{a as S}from"./chunk-5SBKMKFB.js";import{a as s}from"./chunk-3I4YBQX6.js";var x="farero-attachment.invalid";function C(e){return`https://${x}/?path=${encodeURIComponent(e)}`}s(C,"attachmentHref");function E(e,t=!1){let n=H(e);for(let a=n.length-1;a>=0;a--){let l=n[a],u=n[a+1],c=u&&!e.slice(l.end,u.start).trim()?`
|
|
2
2
|
${e.slice(u.start)}`:e.slice(l.end),p=l.handoff.sources.at(-1).title.replace(/[\\`*_[\]<>]/g,"\\$&");e=`${e.slice(0,l.start)}[${p}](${$(l.handoff)})${c}`}let r=y(e);if(!r.length)return e;let i="",o=0;for(let a of r){if(i+=e.slice(o,a.start),!t||!/^Transcript of .+\.md$/.test(a.name)){let l=a.name.replace(/[\\`*_[\]<>]/g,"\\$&");i+=`[${l}](${C(a.path)})`}o=a.end}return i+e.slice(o)}s(E,"markdownSource");function We(e){return/\.(?:md|markdown|mdown|mkd|mkdn)$/i.test(e)}s(We,"isMarkdownFile");import{useId as le,useMemo as X}from"react";import ce from"react-markdown";import ue from"remark-breaks";import de from"remark-gfm";import pe from"remark-math";function T({foldHeadings:e=!0}={}){return t=>{let n=s(r=>{for(let i of r){if(i.type!=="element")continue;let o=i.position?.start.offset;if(o!==void 0&&/^(h[1-6]|p|table|pre)$/.test(i.tagName)&&(i.properties["data-block-id"]=`b${o}`),i.tagName==="pre"){let a=i.children.find(l=>l.type==="element"&&l.tagName==="code");a?.type==="element"&&(i.properties["data-fence-complete"]=a.properties["data-fence-complete"])}n(i.children)}},"anchor");n(t.children),e&&(t.children=U(t.children))}}s(T,"documentStructure");function U(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];if(r.type!=="element"||!/^h[1-6]$/.test(r.tagName)){t.push(r);continue}let i=Number(r.tagName[1]),o=n+1;for(;o<e.length;){let l=e[o];if(l.type==="element"&&/^h[1-6]$/.test(l.tagName)&&Number(l.tagName[1])<=i)break;o++}let a={type:"element",tagName:"summary",properties:{},children:[r]};t.push({type:"element",tagName:"details",properties:{open:!0,"data-document-section":!0},children:[a,...U(e.slice(n+1,o)).filter(l=>l.type!=="doctype")]}),n=o-1}return t}s(U,"sections");function q(){let e="",t,n=!1;return s(function(){let i=this.parser;i&&(this.parser=(o,a)=>{let l,u=o.startsWith(e);u||(n=!1);let c=t&&u&&!n?t.children.slice(0,-2):[],p=t?.children[c.length],f=c.length?p?.position?.start:void 0;f?.offset!==void 0?(l=i(o.slice(f.offset),a),K(l,f),l.children=[...c,...l.children]):l=i(o,a),!n&&l.children.slice(c.length).some(G)&&(n=!0,c.length&&(l=i(o,a)));for(let m of l.children.slice(n?0:c.length))V(m,o);return e=o,t=l,l})},"plugin")}s(q,"incrementalMarkdown");function G(e){return["definition","footnoteDefinition","linkReference","imageReference","footnoteReference"].includes(e.type)||e.type==="text"&&/\[[^\]\n]+\]/.test(e.value)?!0:(e.children??[]).some(G)}s(G,"hasReferences");function K(e,t){if(e.position)for(let n of[e.position.start,e.position.end])n.line===1&&(n.column+=t.column-1),n.line+=t.line-1,n.offset!==void 0&&(n.offset+=t.offset??0);for(let n of e.children??[])K(n,t)}s(K,"shiftPositions");function V(e,t){if(e.type==="code"){let n=t.slice(e.position?.start.offset,e.position?.end.offset),r=n.match(/^ {0,3}(`{3,}|~{3,})/),i=n.slice(n.lastIndexOf(`
|
|
3
3
|
`)+1).replace(/^\s*(?:>\s*)+/,"").trimStart(),o=!r||n.includes(`
|
|
4
4
|
`)&&new RegExp(`^ {0,3}${r[1][0]}{${r[1].length},}[ \\t]*$`).test(i);e.data={...e.data,hProperties:{...e.data?.hProperties,"data-fence-complete":o?"true":"false"}}}for(let n of e.children??[])V(n,t)}s(V,"markFence");import{jsx as Z}from"react/jsx-runtime";var fe=[T],me=[[T,{foldHeadings:!1}]],nt=s(({children:e,components:t,foldHeadings:n=!0,hideTranscriptAttachments:r=!1,onContextMenu:i})=>{let o=X(()=>[de,[pe,{singleDollarTextMath:!1}],q(),ue],[]),a=le(),l=X(()=>({clobberPrefix:`note-${a}-`}),[a]);return Z("div",{className:"md farero-ui",onContextMenu:i,children:Z(ce,{remarkPlugins:o,rehypePlugins:n?fe:me,remarkRehypeOptions:l,components:t,children:E(e,r)})})},"MarkdownBody");function j(e,t=null){return e.startsWith("~/")||/^[A-Za-z]:[\\/]/.test(e)||t&&(e===t||e.startsWith(`${t}/`))?!0:e.startsWith("/Users/")||e.startsWith("/home/")||e.startsWith("/private/")}s(j,"isAbsoluteFilePath");function Y(e){if(!e.startsWith("file://"))return null;let t=e.slice(7),n=t.startsWith("/")?t:t.startsWith("localhost/")?t.slice(9):null;return n?/^\/[A-Za-z]:[\\/]/.test(n)?n.slice(1):n:null}s(Y,"fileUrlToLocalPath");function J(e){let t="",n=s(r=>{for(let i of r)i.type==="text"?t+=i.value:i.type==="element"&&n(i.children)},"walk");return n(e.children),t.replace(/\n$/,"")}s(J,"fenceSource");function h(e){if(!e)return null;try{let t=new URL(e);return t.hostname===x?t.searchParams.get("path"):null}catch{return null}}s(h,"attachmentPath");function P(e){if(!e)return!1;try{let t=new URL(e,location.origin);return t.origin===location.origin&&t.pathname.startsWith("/w/")&&t.searchParams.has("handoff")&&!!t.searchParams.get("session")}catch{return!1}}s(P,"isChatHandoffHref");function L(e){let t=e&&(Y(e)??e);if(!t?.startsWith("/")||!j(t))return null;let n=t.match(/:([1-9]\d*)(?::\d+)?$/),r=n?t.slice(0,-n[0].length):t;return b(r)?null:r.slice(r.lastIndexOf("/")+1).includes(".")?t:null}s(L,"sourceReference");function dt(e){if(!e)return null;let t=e.split(/\r?\n/).filter(Boolean);if(t.length<2)return null;let n=t.map(L);return n.every(r=>r!==null)?n:null}s(dt,"sourceReferences");function pt({reference:e,external:t,externalPreview:n,button:r,metaKey:i,ctrlKey:o,shiftKey:a,altKey:l,defaultPrevented:u}){return u?"browser":r===0&&!i&&!o&&!a&&!l&&!e&&t&&n?"external-preview":e&&(r===0||r===1)?"preview":"browser"}s(pt,"chatLinkAction");var ge=/^[a-z0-9-]+(?:\.[a-z0-9-]+)+$/,he=/^[\d.]+$/,ye=/(?:^|\.)(?:corp|example|home|home\.arpa|internal|intranet|invalid|lan|local|localhost|onion|private|test|ts\.net)$/;function ft(e){let t;try{t=new URL(e).hostname}catch{return null}return!ge.test(t)||he.test(t)||ye.test(t)||t===location.hostname?null:`https://icons.duckduckgo.com/ip3/${t}.ico`}s(ft,"linkFaviconUrl");function mt(e){return typeof e=="string"?e:Array.isArray(e)&&e.filter(n=>typeof n=="string").join("")||null}s(mt,"linkText");import{Children as be,isValidElement as ne}from"react";import{jsx as M,jsxs as te}from"react/jsx-runtime";function Q(e){return typeof e=="string"&&!e.trim()}s(Q,"isBlank");function xe(e){return ne(e)&&e.type==="br"}s(xe,"isLineBreak");function ee(e){if(!ne(e))return null;let{href:t}=e.props;return typeof t!="string"?null:h(t)!==null||P(t)?t:null}s(ee,"referenceHref");var oe=s(({children:e,node:t,...n})=>{let r=be.toArray(e),i=[],o=[],a=[],l=0;for(let c=0;c<=r.length;c++){if(c<r.length&&!xe(r[c])){a.push(r[c]);continue}if(!a.every(p=>Q(p)||ee(p)))break;for(let p of a){let f=ee(p);if(!f)continue;let m=h(f);m&&b(m)?i.push(p):o.push(p)}a=[],l=c+1}if(!i.length&&!o.length)return M("p",{...n,children:e});let u=r.slice(l);return te("p",{...n,children:[te("span",{className:S("flex flex-col gap-1",u.some(c=>!Q(c))&&"mb-[0.5em]"),children:[i.length?M("span",{className:"flex flex-wrap items-start gap-2",children:i}):null,o.length?M("span",{className:"flex flex-wrap items-center gap-1.5",children:o}):null]}),u]})},"ChatParagraph");import{useCallback as Ce,useEffect as Pe,useRef as re,useState as Re}from"react";import{createPortal as we}from"react-dom";import{Fragment as ke,jsx as R,jsxs as ie}from"react/jsx-runtime";var se=s(({href:e,children:t,...n})=>{let[r,i]=Re(),o=re(null),a=re(null),l=Ce(()=>{i(void 0),o.current?.focus({preventScroll:!0})},[]);return Pe(()=>{if(!r)return;a.current?.querySelector("button")?.focus({preventScroll:!0});let u=s(f=>{let m=f.target;!o.current?.contains(m)&&!a.current?.contains(m)&&i(void 0)},"dismiss"),c=s(f=>{f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),i(void 0),o.current?.focus({preventScroll:!0}))},"onEscape"),p=s(f=>{a.current?.contains(f.target)||i(void 0)},"scroll");return document.addEventListener("pointerdown",u),document.addEventListener("keydown",c,!0),document.addEventListener("scroll",p,!0),window.addEventListener("resize",l),()=>{document.removeEventListener("pointerdown",u),document.removeEventListener("keydown",c,!0),document.removeEventListener("scroll",p,!0),window.removeEventListener("resize",l)}},[r,l]),ie(ke,{children:[R("a",{...n,ref:o,href:e,"aria-expanded":!!r,"aria-haspopup":"dialog",onClick:u=>{let c=u.currentTarget.closest(".md"),p=e?.slice(1),f=p?Array.from(c?.querySelectorAll("[id]")??[]).find(g=>g.id===p):void 0;if(!f)return;u.preventDefault();let m=f.cloneNode(!0);for(let g of m.querySelectorAll("[data-footnote-backref]"))g.remove();let F=u.currentTarget.getBoundingClientRect();i(g=>g?void 0:{text:m.textContent?.trim()??"",left:Math.max(8,Math.min(F.left,window.innerWidth-272)),top:Math.max(8,Math.min(F.bottom+6,window.innerHeight-208))})},children:t}),r?we(ie("div",{ref:a,role:"dialog","aria-label":"Footnote","data-document-controls":!0,className:"farero-ui fixed z-50 max-h-48 w-64 max-w-[calc(100vw-1rem)] overflow-auto overscroll-contain rounded-lg border border-border bg-surface p-3 text-text text-xs shadow-xl",style:{left:r.left,top:r.top},children:[R("p",{className:"whitespace-pre-wrap",children:r.text}),R("a",{href:e,className:"mt-2 inline-block text-accent underline",onClick:()=>{let u=e?document.getElementById(e.slice(1)):null;for(let c=u?.closest("details");c;c=c.parentElement?.closest("details")??null)c.open=!0;i(void 0)},children:"Go to note"}),R("button",{type:"button",className:"ml-3 rounded px-1 text-muted",onClick:l,children:"Close"})]}),document.body):null]})},"FootnoteReference");import{MessageSquare as ve,Paperclip as Ne}from"lucide-react";import{lazy as Ee,Suspense as Te}from"react";import{jsx as d,jsxs as A}from"react/jsx-runtime";var Le=Ee(()=>import("./MathEquation-7ZVYQFEK.js")),Me=/^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;function ae(e){return e.startsWith("http://")||e.startsWith("https://")}s(ae,"isHttpUrl");function Ae(e){return typeof e=="string"?e:Array.isArray(e)&&e.every(t=>typeof t=="string")?e.join(""):null}s(Ae,"fenceText");var Fe=s(({href:e,children:t,onOpenFile:n,filePaths:r,node:i,...o})=>{if(i?.properties.dataFootnoteRef)return d(se,{href:e,...o,children:t});if(!e)return d("span",{title:o.title,children:t});let a=h(e);if(a){let[u]=y(C(a)),c=u?u.name:a.slice(a.lastIndexOf("/")+1),p=[N(t??c),o.title,a].filter(Boolean).join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b}from"./chunk-ZVJQ5X63.js";import{i as g}from"./chunk-
|
|
1
|
+
import{b}from"./chunk-ZVJQ5X63.js";import{i as g}from"./chunk-OHGCJOUT.js";import{a as x}from"./chunk-WQZ3EUKA.js";import{b as v}from"./chunk-FW2QVWXL.js";import{d as h}from"./chunk-HGN4GN2E.js";import{a as i}from"./chunk-5SBKMKFB.js";import{a as s}from"./chunk-3I4YBQX6.js";import{jsx as w}from"react/jsx-runtime";function z(e){return e.startsWith("+")&&!e.startsWith("+++")?"text-add":e.startsWith("-")&&!e.startsWith("---")?"text-del":e.startsWith("@@")?"text-accent":e.startsWith("diff ")||e.startsWith("index ")||e.startsWith("+++")||e.startsWith("---")?"text-faint":"text-muted"}s(z,"diffLineClass");var y=s(({patch:e})=>w("pre",{className:"!m-0 !rounded-none !border-0 overflow-x-auto overscroll-x-contain font-mono text-[11.5px] leading-[1.5]",children:e.split(`
|
|
2
2
|
`).map((r,o)=>w("div",{className:i("whitespace-pre",z(r)),children:r||" "},o))}),"PlainDiff");function _(e,r){let o=e.toLowerCase();return o==="diff"||o==="patch"?"diff":(o==="svg"||o==="xml")&&/^\s*(?:<\?xml[^>]*>\s*)?<svg\b/i.test(r.slice(0,512))&&/<\/svg>\s*$/i.test(r.slice(-512))?"svg":o==="html"&&/^\s*(?:<!doctype html[^>]*>\s*)?<html\b/i.test(r.slice(0,512))&&/<\/html>\s*$/i.test(r.slice(-512))?"html":"source"}s(_,"fenceKind");import{Download as R}from"lucide-react";import{lazy as S,Suspense as K,useState as N}from"react";import{jsx as t,jsxs as a}from"react/jsx-runtime";var L=S(()=>import("./IsolatedPreview-HJ6B36KF.js")),U=s(({source:e,language:r,kind:o,complete:n,actions:F,renderDiff:p})=>{let[c,W]=N("source"),[f,C]=N(!1),m=e.length<=1048576,d=o!=="source"&&m&&n,P=o==="diff"?"Diff":"Preview",l=t("pre",{className:i("!m-0 !rounded-none !border-0 overflow-x-auto overscroll-x-contain",f&&"whitespace-pre-wrap [overflow-wrap:anywhere]"),children:t("code",{className:r?`language-${r}`:void 0,children:t(g,{text:e,language:n?r:null})})}),u=a("div",{className:"ml-auto flex items-center gap-1","data-document-controls":!0,children:[c==="source"||!d?t(x,{pressed:f,onToggle:()=>C(D=>!D),size:12,className:"size-6 rounded-md hover:bg-surface-2"}):null,F,t("button",{type:"button",title:"Download source","aria-label":"Download code block",className:"flex size-6 items-center justify-center rounded-md text-muted hover:bg-surface-2",onClick:()=>b(e,o==="svg"?"svg":r??"txt"),children:t(R,{size:12})}),t(h,{text:e,label:"code",size:12,className:"size-6 rounded-md"})]});return o==="source"||!n?a("div",{className:"farero-ui group relative my-3 overflow-hidden rounded-xl border border-border-soft bg-bg",children:[l,t("div",{className:"absolute top-1 right-1 rounded-md border border-border-soft bg-bg/90 opacity-100 transition-opacity sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100",children:u})]}):a("figure",{className:"farero-ui my-3 overflow-hidden rounded-xl border border-border-soft bg-bg",children:[a("figcaption",{className:"flex min-h-8 flex-wrap items-center gap-2 px-2 py-1 text-muted text-xs","data-document-controls":!0,children:[d?t(v,{value:c,options:[{id:"source",label:"Source"},{id:"rich",label:P}],onChange:W}):t("span",{children:r??"Code"}),u]}),c==="rich"&&d?t(K,{fallback:l,children:o==="diff"?t("div",{className:"max-h-[32rem] overflow-auto overscroll-contain",children:p?p(e):t(y,{patch:e})}):t(L,{source:e,kind:o==="svg"?"svg":"html"})}):l,m?null:t("p",{className:"px-3 text-muted text-xs",children:"Preview unavailable above 1 MiB. Full source can be copied or downloaded."})]})},"RichFence");export{z as a,_ as b,U as c};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as g}from"./chunk-
|
|
1
|
+
import{i as g}from"./chunk-7OIEAISL.js";import{a as o,b as E,c as l}from"./chunk-3I4YBQX6.js";import{createCssVariablesTheme as w,createSingletonShorthands as _}from"shiki/core";var i={};E(i,{PIERRE_SYNTAX_LANGUAGES:()=>p,bundledLanguages:()=>f,bundledLanguagesInfo:()=>d,createHighlighter:()=>m,createJavaScriptRegexEngine:()=>T,createOnigurumaEngine:()=>R});l(i,Y);import{createBundledHighlighter as A}from"shiki/core";import{createJavaScriptRegexEngine as T}from"shiki/engine/javascript";import{createOnigurumaEngine as R}from"shiki/engine/oniguruma";import{bundledLanguages as f,bundledLanguagesInfo as d}from"shiki/langs";import*as Y from"shiki/core";var p=new Set(Object.keys(f)),m=A({langs:f,themes:{},engine:o(()=>T(),"engine")});var b=w({name:"farero"}),I=_(m),a=new Map,h=0,O=2e5,c=new Map;for(let n of d){let e=n.id;c.set(n.id,e);for(let t of n.aliases??[])c.set(t.toLowerCase(),e)}var G={h:"c",mm:"objective-cpp",sol:"solidity",svg:"xml",fsx:"fsharp"},P={dockerfile:"dockerfile",makefile:"make","cmakelists.txt":"cmake"},N={Bash:"shellscript"},y=64*1024;function S(n){if(!n||n.length>y||!/^\s*(?:\{|\[)/.test(n))return null;try{return JSON.parse(n),"json"}catch{return null}}o(S,"jsonLanguage");function Q(n,e){return e&&e.length>y?null:n&&N[g(n).name]||S(e)}o(Q,"languageForTool");function j(n){let e=n.slice(n.lastIndexOf("/")+1),t=P[e.toLowerCase()];if(t)return t;let r=e.lastIndexOf(".");if(r<1)return null;let s=e.slice(r+1).toLowerCase();return G[s]??c.get(s)??null}o(j,"languageForPath");function Z(n){switch(n){case"javascript":case"typescript":case"tsx":case"jsx":case"json":return"javascript";case"python":return"python";case"markdown":return"markdown";default:return null}}o(Z,"cmLanguageGroup");function ee(n,e,t){return t&&t.length>y?null:(n&&g(n).name==="Read"&&e?j(e):null)??S(t)}o(ee,"languageForToolOutput");function ne(n){let e=n?.match(/(?:^|\s)language-([\w+-]+)/)?.[1];return e?c.get(e.toLowerCase())??null:null}o(ne,"languageForFence");async function H(n,e){if(!e||!p.has(e)||n.length>1e5)return null;let t=`${e}\0${n}`,r=a.get(t);if(r)return a.delete(t),a.set(t,r),r;let s=F(n,e);for(a.set(t,s),h+=t.length;h>O||a.size>16;){let u=a.keys().next().value;if(u===void 0)break;h-=u.length,a.delete(u)}return s}o(H,"highlightLines");async function F(n,e){try{return await I.codeToTokensBase(n,{lang:e,theme:b})}catch{return null}}o(F,"tokenize");async function L(n,e){let t=await H(n,e);return t?t.flatMap((r,s)=>s?[{content:`
|
|
2
2
|
`,offset:0},...r]:r):null}o(L,"highlightCode");import{memo as v,useEffect as M,useState as U}from"react";import{Fragment as B,jsx as k}from"react/jsx-runtime";var X=o(({tokens:n})=>k(B,{children:n.map((e,t)=>{let r=e.fontStyle??0,s={color:e.color,fontStyle:r&1?"italic":void 0,fontWeight:r&2?600:void 0,textDecoration:r&4?"underline":void 0};return k("span",{style:s,children:e.content},t)})}),"Tokens"),ie=v(o(function({text:e,language:t}){let[r,s]=U(null);return M(()=>{let u=!0,x=setTimeout(()=>{e.length>1e5||!t||L(e,t).then(C=>{u&&s({text:e,tokens:C})})},160);return()=>{u=!1,clearTimeout(x)}},[e,t]),r?.text===e&&r.tokens?k(X,{tokens:r.tokens}):e},"Code"));export{Q as a,j as b,Z as c,ee as d,ne as e,H as f,L as g,X as h,ie as i};
|
package/dist/code.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o,b as e,c as g,d as a,e as n,f as r,g as t,h as l,i as u}from"./chunks/chunk-
|
|
1
|
+
import{a as o,b as e,c as g,d as a,e as n,f as r,g as t,h as l,i as u}from"./chunks/chunk-OHGCJOUT.js";import"./chunks/chunk-7OIEAISL.js";import"./chunks/chunk-3I4YBQX6.js";export{u as Code,l as Tokens,g as cmLanguageGroup,t as highlightCode,r as highlightLines,n as languageForFence,e as languageForPath,o as languageForTool,a as languageForToolOutput};
|
package/dist/commands.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as S,b as v,c as H}from"./chunks/chunk-S3DX6DGB.js";import{d as b,e as w}from"./chunks/chunk-
|
|
1
|
+
import{a as S,b as v,c as H}from"./chunks/chunk-S3DX6DGB.js";import{d as b,e as w}from"./chunks/chunk-7OIEAISL.js";import{a as h}from"./chunks/chunk-5SBKMKFB.js";import{a as r}from"./chunks/chunk-3I4YBQX6.js";import{Check as z,ChevronRight as E}from"lucide-react";var A={ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192"};function m(e,t){let n=A[e.key]??(e.key.length===1?e.key.toUpperCase():e.key),o=n?[n]:[];return t?[...e.ctrl?["\u2303"]:[],...e.alt?["\u2325"]:[],...e.shift?["\u21E7"]:[],...e.mod?["\u2318"]:[],...o]:[...e.mod||e.ctrl?["Ctrl"]:[],...e.alt?["Alt"]:[],...e.shift?["Shift"]:[],...o]}r(m,"formatShortcut");function L(e,t){return m(e,t).join(t?"":"+")}r(L,"shortcutText");function T(e=typeof navigator>"u"?void 0:navigator){return/Mac|iPhone|iPad|iPod/i.test(`${e?.platform??""} ${e?.userAgent??""}`)}r(T,"isApplePlatform");function $(e,t,n){if(e.key.toLowerCase()!==t.key.toLowerCase())return!1;let o=!!t.mod;return e.metaKey===(n&&o)&&e.ctrlKey===(!n&&o||!!t.ctrl)&&e.shiftKey===!!t.shift&&e.altKey===!!t.alt}r($,"matchesShortcut");function g(e,t){return!(e.browserReserved&&!t.desktop)}r(g,"shortcutAvailable");import{jsx as s,jsxs as p}from"react/jsx-runtime";var F=r(({commands:e,grouped:t,platform:n,onRun:o,onHover:a,expandedId:i})=>{if(!e.length)return null;let c=t?I(e):[{label:"Actions",commands:e}];return s("div",{className:"farero-ui flex flex-col gap-2 pb-2",children:c.map(l=>p("section",{"aria-label":l.label,children:[s(N,{children:l.label}),s("div",{role:"menu","aria-label":l.label,className:"flex flex-col",children:l.commands.map(d=>s(K,{command:d,platform:n,breadcrumb:!t,onRun:o,onHover:a,expanded:i===d.id},d.id))})]},l.label))})},"CommandResults"),N=r(({children:e})=>s(S,{as:"h3",className:"px-2.5 pb-1",children:e}),"PaletteHeading");function I(e){let t=new Map;for(let n of e){let o=n.group??"Actions",a=t.get(o);a?a.push(n):t.set(o,[n])}return[...t].map(([n,o])=>({label:n,commands:o}))}r(I,"groupSections");var K=r(({command:e,platform:t,breadcrumb:n,onRun:o,onHover:a,expanded:i=!1,hit:c=!1,option:l})=>{let d=e.icon,k=e.shortcut&&g(e.shortcut,t)?e.shortcut:void 0,f=!!(e.children?.length?e.children.filter(u=>!u.hidden&&u.enabled!==!1):void 0)?.length,P=!f&&e.checked!==void 0,R=`${n&&e.group?`${e.group} \u203A `:""}${e.label}${e.detail?` \xB7 ${e.detail}`:""}`;return p("button",{type:"button",...l?{id:l.id,role:"option","aria-selected":l.selected,"aria-label":R,tabIndex:-1}:P?{role:"menuitemcheckbox","aria-checked":!!e.checked}:f?{role:"menuitem","aria-haspopup":"menu","aria-expanded":i,"data-palette-submenu":""}:{role:"menuitem"},"data-palette-row":"","data-palette-hit":c?"":void 0,"data-command-id":e.id,onClick:u=>o(e,u.currentTarget),onPointerEnter:u=>{u.pointerType!=="touch"&&a?.(e,u.currentTarget)},className:h("flex w-full items-center gap-3 rounded-xl px-2.5 py-2 text-left text-sm text-text hover:bg-surface-2 focus-visible:bg-surface-2 focus-visible:outline-none active:bg-surface-2",(i||l?.selected)&&"bg-surface-2"),children:[e.glyph?s("span",{className:"flex size-4 shrink-0 items-center justify-center text-muted","aria-hidden":!0,children:e.glyph}):d?s(d,{size:16,className:"shrink-0 text-muted","aria-hidden":!0}):s("span",{className:"size-4 shrink-0","aria-hidden":!0}),p("span",{className:"min-w-0 flex-1 truncate",title:R,children:[n&&e.group?p("span",{className:"text-muted",children:[e.group," \u203A "]}):null,c?s(v,{className:"-mx-0.5",children:e.label}):e.label,e.detail?s("span",{className:"ml-2 text-faint text-xs",children:e.detail}):null]}),k?s(j,{parts:m(k,t.apple)}):null,P?s(B,{checked:!!e.checked}):null,f?s(E,{size:16,className:"shrink-0 text-faint","aria-hidden":!0}):null]})},"CommandRow"),j=r(({parts:e})=>s("span",{className:"hidden shrink-0 items-center gap-0.5 md:flex",children:e.map(t=>s(H,{children:t},t))}),"KeyCaps"),B=r(({checked:e})=>s("span",{"aria-hidden":!0,className:h("flex size-4 shrink-0 items-center justify-center rounded border",e?"border-accent bg-accent text-on-solid":"border-faint bg-surface"),children:e?s(z,{size:12,strokeWidth:3}):null}),"CheckMark");function U(e){return[e.group,e.label,...e.keywords??[]].filter(Boolean).join(" ").toLowerCase()}r(U,"haystack");function y(e){return!e.hidden&&e.enabled!==!1}r(y,"listed");function M(e,t){let n=w(U(e),t);if(n==null)return;let o=e.label.toLowerCase(),a=o.startsWith(t[0])?0:t.every(i=>o.includes(i))?1:2;return{proximity:n,surface:a}}r(M,"rankCommand");function C(e,t,n){return n.length===1?e.surface-t.surface:e.proximity-t.proximity||e.surface-t.surface}r(C,"compareRanks");function x(e,t){let n=M(e,t);for(let o of e.children??[]){if(!y(o))continue;let a=x(o,t);a&&(!n||C(a,n,t)<0)&&(n=a)}return n}r(x,"branchRank");function W(e,t){let n=e.filter(y),o=b(t);if(!o.length)return n;let a=[];for(let i of n){let c=x(i,o);c&&a.push({command:i,rank:c})}return a.sort((i,c)=>C(i.rank,c.rank,o)).map(i=>i.command)}r(W,"matchCommands");function Y(e,t){let n=b(t);if(!n.length)return[];let o=M(e,n);return(e.children??[]).filter(a=>{if(!y(a))return!1;let i=x(a,n);return!!i&&(!o||C(i,o,n)<0)})}r(Y,"submenuHits");export{F as CommandResults,K as CommandRow,N as PaletteHeading,m as formatShortcut,T as isApplePlatform,W as matchCommands,$ as matchesShortcut,g as shortcutAvailable,L as shortcutText,Y as submenuHits};
|
package/dist/fence.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o}from"./chunks/chunk-LNOXROHT.js";import{a as e,b as r,c as t}from"./chunks/chunk-
|
|
1
|
+
import{a as o}from"./chunks/chunk-LNOXROHT.js";import{a as e,b as r,c as t}from"./chunks/chunk-J6G4JKVU.js";import"./chunks/chunk-ZVJQ5X63.js";import"./chunks/chunk-OHGCJOUT.js";import"./chunks/chunk-7OIEAISL.js";import"./chunks/chunk-WQZ3EUKA.js";import"./chunks/chunk-FW2QVWXL.js";import"./chunks/chunk-HGN4GN2E.js";import"./chunks/chunk-5SBKMKFB.js";import"./chunks/chunk-3I4YBQX6.js";export{o as IsolatedPreview,t as RichFence,e as diffLineClass,r as fenceKind};
|
package/dist/generated-ui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as ee,i as te,j as ne,n as re,p as ae}from"./chunks/chunk-5WPOTZ7L.js";import"./chunks/chunk-MMVOWP5T.js";import{a as W,b as Q,c as X,d as Y}from"./chunks/chunk-6RFRRT4V.js";import{e as _,r as Z}from"./chunks/chunk-JNOL5TLS.js";import"./chunks/chunk-JMYCJ5PW.js";import"./chunks/chunk-LHMFMBHY.js";import{b as H}from"./chunks/chunk-HE55M4S6.js";import"./chunks/chunk-ONVWTQLU.js";import{a as U}from"./chunks/chunk-ITKN2ASJ.js";import"./chunks/chunk-S3DX6DGB.js";import"./chunks/chunk-RWGTJDY3.js";import"./chunks/chunk-YPRVAH5G.js";import"./chunks/chunk-T3JXEXIJ.js";import"./chunks/chunk-RR7BB4EQ.js";import"./chunks/chunk-BLVH5CWZ.js";import"./chunks/chunk-ZVJQ5X63.js";import"./chunks/chunk-MHKNH5JT.js";import"./chunks/chunk-MTA5M6VK.js";import"./chunks/chunk-WQZ3EUKA.js";import{b as A}from"./chunks/chunk-FW2QVWXL.js";import"./chunks/chunk-HGN4GN2E.js";import{a as C}from"./chunks/chunk-5SBKMKFB.js";import{a}from"./chunks/chunk-3I4YBQX6.js";import{useMemo as Ve}from"react";import{createStateStore as Ie}from"@json-render/core";import{JSONUIProvider as je,Renderer as Le}from"@json-render/react";import{Expand as Je,Minimize2 as qe}from"lucide-react";import{useEffect as ze,useLayoutEffect as Ke,useMemo as O,useRef as B,useState as me}from"react";import{createContext as j}from"react";var N=j(void 0),T=j({available:!1,pending:!1}),G=j({});import{createStateStore as xe}from"@json-render/core";var L=new Map;function se(e,t){return typeof t=="string"?t:e}a(se,"tabName");function ve(e){let t={};for(let[n,r]of Object.entries(e.elements)){if(r.type!=="Tabs")continue;let l=r.children[0];l&&(t[se(n,r.props.name)]=l)}return t}a(ve,"tabSelection");function he(e,t){for(let[n,r]of Object.entries(e.elements))if(r.type==="Tabs"&&se(n,r.props.name)===t)return r.children;return[]}a(he,"tabChildren");function M(e){return{...re(e),tabs:ve(e)}}a(M,"initialPanelState");function oe(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t={};for(let[n,r]of Object.entries(e))t[n]=r;return t}a(oe,"record");function ie(e,t){let n=M(t),r=e.getSnapshot(),l={...n.values},d=oe(r.values);if(d)for(let[u,g]of Object.entries(d)){let P=l[u];P!==void 0&&typeof g==typeof P&&(typeof g=="string"||typeof g=="boolean")&&(l[u]=g)}let o={...n.tabs},b=oe(r.tabs);if(b)for(let[u,g]of Object.entries(b))typeof g!="string"||o[u]===void 0||he(t,u).includes(g)&&(o[u]=g);let m={data:n.data,values:l,tabs:o};JSON.stringify(r.data)===JSON.stringify(m.data)&&JSON.stringify(r.values)===JSON.stringify(m.values)&&JSON.stringify(r.tabs)===JSON.stringify(m.tabs)||e.update({"/data":m.data,"/values":m.values,"/tabs":m.tabs})}a(ie,"syncMemoryPanel");function J(e,t){let n=L.get(e);if(n)return n;let r=xe(M(t));return L.set(e,r),r}a(J,"memoryPanelStore");function Se(){L.clear(),Q()}a(Se,"releaseGeneratedUiMemory");import{defineRegistry as Pe,useBoundProp as F,useStateStore as R}from"@json-render/react";import{Children as Ne,useContext as $,useId as ke}from"react";import{useId as Ce,useMemo as le}from"react";import{jsx as v,jsxs as w}from"react/jsx-runtime";var we=W(),ce=a(({title:e,kind:t,data:n,valueLabel:r,retentionKey:l})=>{let[d,o]=X(l,we,()=>""),b=Ce(),m=le(()=>n.map((s,h)=>({...s,key:String(h)})),[n]),u=le(()=>m.filter(s=>s.label.toLocaleLowerCase().includes(d.toLocaleLowerCase())),[m,d]),g=Math.min(0,...u.map(s=>s.value)),x=Math.max(0,...u.map(s=>s.value))-g||1,y=a(s=>160-(s-g)/x*140,"y"),S=480/Math.max(1,u.length);return w("figure",{className:"min-w-0 space-y-2",children:[w("figcaption",{id:b,className:"font-medium text-sm",children:[e,r?w("span",{className:"text-muted",children:[" \xB7 ",r]}):null]}),v("input",{type:"search","aria-label":`Filter ${e}`,placeholder:"Filter labels\u2026",value:d,onChange:s=>o(s.target.value),className:"w-full rounded-lg border border-border bg-bg px-2 py-1.5 text-base sm:text-sm"}),u.length?w("svg",{viewBox:"0 0 520 185",role:"img","aria-labelledby":b,className:"w-full text-accent",children:[v("title",{children:e}),v("line",{x1:"20",x2:"500",y1:y(0),y2:y(0),stroke:"currentColor",className:"text-border"}),t==="line"?v("polyline",{fill:"none",stroke:"currentColor",strokeWidth:"2",points:u.map((s,h)=>`${20+S*(h+.5)},${y(s.value)}`).join(" ")}):null,u.map((s,h)=>t==="bar"?v("rect",{x:20+S*h+S*.15,y:Math.min(y(0),y(s.value)),width:S*.7,height:Math.max(1,Math.abs(y(0)-y(s.value))),rx:"2",fill:"currentColor",children:w("title",{children:[s.label,": ",s.value]})},s.key):v("circle",{cx:20+S*(h+.5),cy:y(s.value),r:"3",fill:"currentColor",children:w("title",{children:[s.label,": ",s.value]})},s.key))]}):v("p",{className:"text-muted text-sm",children:"No matching values."}),v("dl",{className:"grid max-h-40 grid-cols-[minmax(0,1fr)_auto] gap-x-3 gap-y-1 overflow-y-auto overscroll-y-contain text-xs",children:u.map(s=>w("div",{className:"contents",children:[v("dt",{className:"break-words text-muted",children:s.label}),v("dd",{className:"tabular-nums",children:s.value.toLocaleString()})]},s.key))})]})},"Chart");import{jsx as i,jsxs as k}from"react/jsx-runtime";var de="w-full min-w-0 rounded-lg border border-border bg-bg px-2 py-1.5 text-base outline-none focus:border-accent disabled:opacity-50 sm:text-sm",ue=a(({label:e,children:t})=>{let n=ke();return k("div",{className:"min-w-0 space-y-1",children:[i("label",{htmlFor:n,className:"block text-muted text-xs",children:e}),t(n)]})},"Field"),Ue=a(({props:e,children:t})=>{let n=$(G)[e.name??""]??[],r=R(),[l,d]=F(String(r.get(`/tabs/${e.name}`)??""),`/tabs/${e.name}`),o=l&&n.includes(l)?l:n[0]??"";return k("div",{className:"min-w-0 space-y-3",children:[i(A,{value:o,options:n.map((b,m)=>({id:b,label:e.labels[m]??""})),onChange:d,wrap:!0}),Ne.toArray(t).map((b,m)=>i("div",{hidden:n[m]!==o,children:b},n[m]))]})},"PanelTabs"),Te=a(({props:e,bindings:t})=>{let n=R(),[r,l]=F(String(n.get(`/values/${e.name}`)??""),t?.value??`/values/${e.name}`);return i(ue,{label:e.label,children:d=>i("input",{id:d,name:e.name,type:e.type??"text",value:String(r??""),required:e.required,placeholder:e.placeholder,maxLength:4e3,onChange:o=>l(o.target.value),className:de})})},"PanelInput"),Ge=a(({props:e,bindings:t})=>{let n=R(),[r,l]=F(String(n.get(`/values/${e.name}`)??""),t?.value??`/values/${e.name}`);return i(ue,{label:e.label,children:d=>i("select",{id:d,name:e.name,value:String(r??""),onChange:o=>l(o.target.value),className:de,children:e.options.map(o=>i("option",{value:o.value,children:o.label},o.value))})})},"PanelSelect"),Me=a(({props:e,bindings:t})=>{let n=R(),[r,l]=F(n.get(`/values/${e.name}`)===!0,t?.checked??`/values/${e.name}`),d=r===!0;return k("div",{className:"flex items-center justify-between gap-3",children:[i("span",{className:"text-sm",children:e.label}),i(H,{label:e.label,checked:d,onChange:()=>l(!d)})]})},"PanelToggle"),Fe=a(({props:e,emit:t})=>{let n=$(T);return i(U,{type:"submit",size:"md",variant:"primary",disabled:!n.available||n.pending,onClick:r=>{r.preventDefault(),r.currentTarget.form?.reportValidity()&&t("press")},children:e.label})},"PanelSubmit");function Re(e,t,n){if(e)return`${e}:table:${t??""}:${n.join("\0")}`}a(Re,"tableRetention");var $e=a(({props:e})=>{let t=$(N);return k("div",{className:"min-w-0 space-y-2",children:[e.caption?i("p",{className:"text-muted text-xs",children:e.caption}):null,i(Y,{columns:e.columns,rows:e.rows.map(n=>n.map(r=>String(r??""))),retentionKey:Re(t,e.caption,e.columns)})]})},"PanelTable"),Oe=a(({props:e})=>{let t=$(N);return i(ce,{...e,retentionKey:t?`${t}:chart:${e.title}`:void 0})},"PanelChart"),Be=Pe(ne,{components:{Stack:a(({props:e,children:t})=>i("div",{className:C("flex min-w-0 gap-3",e.direction==="horizontal"?"flex-wrap items-start [&>*]:min-w-0 [&>*]:flex-1":"flex-col"),children:t}),"Stack"),Card:a(({props:e,children:t})=>k("section",{className:"min-w-0 space-y-3 rounded-lg border border-border-soft p-3",children:[e.title?i("h3",{className:"font-medium text-sm",children:e.title}):null,e.description?i("p",{className:"whitespace-pre-wrap break-words text-muted text-sm",children:e.description}):null,t]}),"Card"),Text:a(({props:e})=>i("p",{className:C("whitespace-pre-wrap break-words text-sm",e.tone==="muted"&&"text-muted"),children:e.text}),"Text"),Table:a(e=>i($e,{...e}),"Table"),Chart:a(e=>i(Oe,{...e}),"Chart"),Tabs:a(e=>i(Ue,{...e}),"Tabs"),Input:a(e=>i(Te,{...e}),"Input"),Select:a(e=>i(Ge,{...e}),"Select"),Toggle:a(e=>i(Me,{...e}),"Toggle"),Button:a(e=>i(Fe,{...e}),"Button")},actions:{submit:a(async()=>{},"submit")}}),Ee=te,q=Object.fromEntries(Object.entries(Be.registry).map(([e,t])=>[e,n=>Ee[e]?.props.safeParse(n.element.props).success?i(t,{...n}):i("p",{className:"text-muted text-xs",children:"This component has no valid value."})]));import{jsx as p,jsxs as z}from"react/jsx-runtime";var K=a(({panel:e,memoryKey:t,store:n,streaming:r=!1,ready:l=!0,notice:d,status:o,readOnly:b=!1,onSubmit:m})=>{let u=O(()=>n||(t?J(t,e.spec):Ie(M(e.spec))),[n,t,e.spec]);ze(()=>{n||!t||ie(u,e.spec)},[n,t,u,e.spec]);let g=O(()=>({...e.spec,elements:Object.fromEntries(Object.entries(e.spec.elements).map(([c,f])=>[c,f.type==="Tabs"?{...f,props:{...f.props,name:f.props.name??c}}:f]))}),[e.spec]),P=O(()=>Object.fromEntries(Object.entries(e.spec.elements).filter(([,c])=>c.type==="Tabs").map(([c,f])=>[String(f.props.name??c),f.children])),[e.spec]),[x,y]=me(!1),[S,s]=me(!1),h=B(null),V=B(null),I=B(!1),D=B({onSubmit:m,streaming:r,ready:l,store:u});D.current={onSubmit:m,streaming:r,ready:l,store:u};let pe=O(()=>({submit:a(async c=>{let{onSubmit:f,streaming:ge,ready:be,store:ye}=D.current;if(!(!f||ge||!be||I.current||typeof c.prompt!="string")){I.current=!0,s(!0);try{await f({prompt:c.prompt,values:ye.getSnapshot().values})}catch{}finally{I.current=!1,s(!1)}}},"submit")}),[]);Ke(()=>{let c=h.current;if(!c)return;let f=c.matches(":modal");if(x){if(f)return;c.close(),c.showModal();return}f&&c.close(),c.open=!0,f&&V.current?.focus({preventScroll:!0})},[x]);let fe=!!m&&!r&&l;return p(N,{value:n?void 0:t,children:p("dialog",{ref:h,"aria-label":e.title,"aria-modal":x,onCancel:c=>{c.preventDefault(),y(!1)},className:C("farero-ui overflow-hidden overscroll-contain rounded-xl border border-border-soft bg-surface p-0 text-text backdrop:bg-black/60",x?"fixed inset-0 m-auto h-[90dvh] w-[96vw] max-w-5xl":"relative m-0 w-full max-w-none"),children:p(je,{registry:q,store:u,handlers:pe,functions:ee,children:p(G,{value:P,children:p(T,{value:{available:fe,pending:S},children:z("div",{className:C("flex min-h-0 flex-col",x&&"h-full"),children:[z("header",{className:"flex shrink-0 items-center gap-2 border-border-soft border-b px-3 py-2",children:[p("h2",{className:"min-w-0 flex-1 truncate font-medium text-sm",children:e.title}),p(U,{ref:V,size:"sm",variant:"ghost","aria-label":x?"Collapse panel":"Expand panel",onClick:()=>y(c=>!c),children:x?p(qe,{size:14}):p(Je,{size:14})})]}),z("div",{className:C("min-h-0 overflow-auto overscroll-contain p-3",x?"flex-1":"max-h-[36rem]"),children:[p("form",{onSubmit:c=>c.preventDefault(),children:p("fieldset",{disabled:r||!l,className:"min-w-0 border-0 p-0",children:p(Le,{spec:g,registry:q,loading:r})})}),r?p("p",{role:"status",className:"mt-3 text-muted text-xs",children:"Interface in progress"}):d?p("p",{role:"status",className:"mt-3 text-muted text-xs",children:d}):null,b?p("p",{className:"mt-3 text-muted text-xs",children:"This saved view is read-only."}):null,o?p("p",{role:"status",className:"mt-3 text-muted text-xs",children:o}):null]})]})})})})})})},"GeneratedPanel");import{jsx as E,jsxs as _e}from"react/jsx-runtime";var De=Z();function Ae(e){return E(_,{components:De,children:e})}a(Ae,"defaultText");var He=a(({text:e,memoryKey:t,renderText:n=Ae,streaming:r=!1,onSubmit:l})=>{let d=Ve(()=>ae(e),[e]);return E("div",{className:"farero-ui space-y-3",children:d.map(o=>o.kind==="text"?E("div",{children:n(o.text)},`text-${o.start}`):o.panel?E(K,{panel:o.panel,memoryKey:`${t}:${o.index}`,streaming:r||!o.complete,onSubmit:l},`panel-${o.start}`):_e("p",{role:"status",className:"text-muted text-xs",children:[o.title," \xB7"," ",o.error?"This interface could not be rendered.":o.complete?"Saving interface\u2026":"Interface in progress"]},`panel-${o.start}`))})},"GeneratedUiContent");export{K as GeneratedPanel,He as GeneratedUiContent,J as memoryPanelStore,Se as releaseGeneratedUiMemory};
|
|
1
|
+
import{f as ee,i as te,j as ne,n as re,p as ae}from"./chunks/chunk-5WPOTZ7L.js";import"./chunks/chunk-MMVOWP5T.js";import{a as W,b as Q,c as X,d as Y}from"./chunks/chunk-6RFRRT4V.js";import{e as _,r as Z}from"./chunks/chunk-EUYN7WNH.js";import"./chunks/chunk-JMYCJ5PW.js";import"./chunks/chunk-LHMFMBHY.js";import{b as H}from"./chunks/chunk-HE55M4S6.js";import"./chunks/chunk-ONVWTQLU.js";import{a as U}from"./chunks/chunk-ITKN2ASJ.js";import"./chunks/chunk-S3DX6DGB.js";import"./chunks/chunk-RWGTJDY3.js";import"./chunks/chunk-YPRVAH5G.js";import"./chunks/chunk-T3JXEXIJ.js";import"./chunks/chunk-RR7BB4EQ.js";import"./chunks/chunk-J6G4JKVU.js";import"./chunks/chunk-ZVJQ5X63.js";import"./chunks/chunk-OHGCJOUT.js";import"./chunks/chunk-7OIEAISL.js";import"./chunks/chunk-WQZ3EUKA.js";import{b as A}from"./chunks/chunk-FW2QVWXL.js";import"./chunks/chunk-HGN4GN2E.js";import{a as C}from"./chunks/chunk-5SBKMKFB.js";import{a}from"./chunks/chunk-3I4YBQX6.js";import{useMemo as Ve}from"react";import{createStateStore as Ie}from"@json-render/core";import{JSONUIProvider as je,Renderer as Le}from"@json-render/react";import{Expand as Je,Minimize2 as qe}from"lucide-react";import{useEffect as ze,useLayoutEffect as Ke,useMemo as O,useRef as B,useState as me}from"react";import{createContext as j}from"react";var N=j(void 0),T=j({available:!1,pending:!1}),G=j({});import{createStateStore as xe}from"@json-render/core";var L=new Map;function se(e,t){return typeof t=="string"?t:e}a(se,"tabName");function ve(e){let t={};for(let[n,r]of Object.entries(e.elements)){if(r.type!=="Tabs")continue;let l=r.children[0];l&&(t[se(n,r.props.name)]=l)}return t}a(ve,"tabSelection");function he(e,t){for(let[n,r]of Object.entries(e.elements))if(r.type==="Tabs"&&se(n,r.props.name)===t)return r.children;return[]}a(he,"tabChildren");function M(e){return{...re(e),tabs:ve(e)}}a(M,"initialPanelState");function oe(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t={};for(let[n,r]of Object.entries(e))t[n]=r;return t}a(oe,"record");function ie(e,t){let n=M(t),r=e.getSnapshot(),l={...n.values},d=oe(r.values);if(d)for(let[u,g]of Object.entries(d)){let P=l[u];P!==void 0&&typeof g==typeof P&&(typeof g=="string"||typeof g=="boolean")&&(l[u]=g)}let o={...n.tabs},b=oe(r.tabs);if(b)for(let[u,g]of Object.entries(b))typeof g!="string"||o[u]===void 0||he(t,u).includes(g)&&(o[u]=g);let m={data:n.data,values:l,tabs:o};JSON.stringify(r.data)===JSON.stringify(m.data)&&JSON.stringify(r.values)===JSON.stringify(m.values)&&JSON.stringify(r.tabs)===JSON.stringify(m.tabs)||e.update({"/data":m.data,"/values":m.values,"/tabs":m.tabs})}a(ie,"syncMemoryPanel");function J(e,t){let n=L.get(e);if(n)return n;let r=xe(M(t));return L.set(e,r),r}a(J,"memoryPanelStore");function Se(){L.clear(),Q()}a(Se,"releaseGeneratedUiMemory");import{defineRegistry as Pe,useBoundProp as F,useStateStore as R}from"@json-render/react";import{Children as Ne,useContext as $,useId as ke}from"react";import{useId as Ce,useMemo as le}from"react";import{jsx as v,jsxs as w}from"react/jsx-runtime";var we=W(),ce=a(({title:e,kind:t,data:n,valueLabel:r,retentionKey:l})=>{let[d,o]=X(l,we,()=>""),b=Ce(),m=le(()=>n.map((s,h)=>({...s,key:String(h)})),[n]),u=le(()=>m.filter(s=>s.label.toLocaleLowerCase().includes(d.toLocaleLowerCase())),[m,d]),g=Math.min(0,...u.map(s=>s.value)),x=Math.max(0,...u.map(s=>s.value))-g||1,y=a(s=>160-(s-g)/x*140,"y"),S=480/Math.max(1,u.length);return w("figure",{className:"min-w-0 space-y-2",children:[w("figcaption",{id:b,className:"font-medium text-sm",children:[e,r?w("span",{className:"text-muted",children:[" \xB7 ",r]}):null]}),v("input",{type:"search","aria-label":`Filter ${e}`,placeholder:"Filter labels\u2026",value:d,onChange:s=>o(s.target.value),className:"w-full rounded-lg border border-border bg-bg px-2 py-1.5 text-base sm:text-sm"}),u.length?w("svg",{viewBox:"0 0 520 185",role:"img","aria-labelledby":b,className:"w-full text-accent",children:[v("title",{children:e}),v("line",{x1:"20",x2:"500",y1:y(0),y2:y(0),stroke:"currentColor",className:"text-border"}),t==="line"?v("polyline",{fill:"none",stroke:"currentColor",strokeWidth:"2",points:u.map((s,h)=>`${20+S*(h+.5)},${y(s.value)}`).join(" ")}):null,u.map((s,h)=>t==="bar"?v("rect",{x:20+S*h+S*.15,y:Math.min(y(0),y(s.value)),width:S*.7,height:Math.max(1,Math.abs(y(0)-y(s.value))),rx:"2",fill:"currentColor",children:w("title",{children:[s.label,": ",s.value]})},s.key):v("circle",{cx:20+S*(h+.5),cy:y(s.value),r:"3",fill:"currentColor",children:w("title",{children:[s.label,": ",s.value]})},s.key))]}):v("p",{className:"text-muted text-sm",children:"No matching values."}),v("dl",{className:"grid max-h-40 grid-cols-[minmax(0,1fr)_auto] gap-x-3 gap-y-1 overflow-y-auto overscroll-y-contain text-xs",children:u.map(s=>w("div",{className:"contents",children:[v("dt",{className:"break-words text-muted",children:s.label}),v("dd",{className:"tabular-nums",children:s.value.toLocaleString()})]},s.key))})]})},"Chart");import{jsx as i,jsxs as k}from"react/jsx-runtime";var de="w-full min-w-0 rounded-lg border border-border bg-bg px-2 py-1.5 text-base outline-none focus:border-accent disabled:opacity-50 sm:text-sm",ue=a(({label:e,children:t})=>{let n=ke();return k("div",{className:"min-w-0 space-y-1",children:[i("label",{htmlFor:n,className:"block text-muted text-xs",children:e}),t(n)]})},"Field"),Ue=a(({props:e,children:t})=>{let n=$(G)[e.name??""]??[],r=R(),[l,d]=F(String(r.get(`/tabs/${e.name}`)??""),`/tabs/${e.name}`),o=l&&n.includes(l)?l:n[0]??"";return k("div",{className:"min-w-0 space-y-3",children:[i(A,{value:o,options:n.map((b,m)=>({id:b,label:e.labels[m]??""})),onChange:d,wrap:!0}),Ne.toArray(t).map((b,m)=>i("div",{hidden:n[m]!==o,children:b},n[m]))]})},"PanelTabs"),Te=a(({props:e,bindings:t})=>{let n=R(),[r,l]=F(String(n.get(`/values/${e.name}`)??""),t?.value??`/values/${e.name}`);return i(ue,{label:e.label,children:d=>i("input",{id:d,name:e.name,type:e.type??"text",value:String(r??""),required:e.required,placeholder:e.placeholder,maxLength:4e3,onChange:o=>l(o.target.value),className:de})})},"PanelInput"),Ge=a(({props:e,bindings:t})=>{let n=R(),[r,l]=F(String(n.get(`/values/${e.name}`)??""),t?.value??`/values/${e.name}`);return i(ue,{label:e.label,children:d=>i("select",{id:d,name:e.name,value:String(r??""),onChange:o=>l(o.target.value),className:de,children:e.options.map(o=>i("option",{value:o.value,children:o.label},o.value))})})},"PanelSelect"),Me=a(({props:e,bindings:t})=>{let n=R(),[r,l]=F(n.get(`/values/${e.name}`)===!0,t?.checked??`/values/${e.name}`),d=r===!0;return k("div",{className:"flex items-center justify-between gap-3",children:[i("span",{className:"text-sm",children:e.label}),i(H,{label:e.label,checked:d,onChange:()=>l(!d)})]})},"PanelToggle"),Fe=a(({props:e,emit:t})=>{let n=$(T);return i(U,{type:"submit",size:"md",variant:"primary",disabled:!n.available||n.pending,onClick:r=>{r.preventDefault(),r.currentTarget.form?.reportValidity()&&t("press")},children:e.label})},"PanelSubmit");function Re(e,t,n){if(e)return`${e}:table:${t??""}:${n.join("\0")}`}a(Re,"tableRetention");var $e=a(({props:e})=>{let t=$(N);return k("div",{className:"min-w-0 space-y-2",children:[e.caption?i("p",{className:"text-muted text-xs",children:e.caption}):null,i(Y,{columns:e.columns,rows:e.rows.map(n=>n.map(r=>String(r??""))),retentionKey:Re(t,e.caption,e.columns)})]})},"PanelTable"),Oe=a(({props:e})=>{let t=$(N);return i(ce,{...e,retentionKey:t?`${t}:chart:${e.title}`:void 0})},"PanelChart"),Be=Pe(ne,{components:{Stack:a(({props:e,children:t})=>i("div",{className:C("flex min-w-0 gap-3",e.direction==="horizontal"?"flex-wrap items-start [&>*]:min-w-0 [&>*]:flex-1":"flex-col"),children:t}),"Stack"),Card:a(({props:e,children:t})=>k("section",{className:"min-w-0 space-y-3 rounded-lg border border-border-soft p-3",children:[e.title?i("h3",{className:"font-medium text-sm",children:e.title}):null,e.description?i("p",{className:"whitespace-pre-wrap break-words text-muted text-sm",children:e.description}):null,t]}),"Card"),Text:a(({props:e})=>i("p",{className:C("whitespace-pre-wrap break-words text-sm",e.tone==="muted"&&"text-muted"),children:e.text}),"Text"),Table:a(e=>i($e,{...e}),"Table"),Chart:a(e=>i(Oe,{...e}),"Chart"),Tabs:a(e=>i(Ue,{...e}),"Tabs"),Input:a(e=>i(Te,{...e}),"Input"),Select:a(e=>i(Ge,{...e}),"Select"),Toggle:a(e=>i(Me,{...e}),"Toggle"),Button:a(e=>i(Fe,{...e}),"Button")},actions:{submit:a(async()=>{},"submit")}}),Ee=te,q=Object.fromEntries(Object.entries(Be.registry).map(([e,t])=>[e,n=>Ee[e]?.props.safeParse(n.element.props).success?i(t,{...n}):i("p",{className:"text-muted text-xs",children:"This component has no valid value."})]));import{jsx as p,jsxs as z}from"react/jsx-runtime";var K=a(({panel:e,memoryKey:t,store:n,streaming:r=!1,ready:l=!0,notice:d,status:o,readOnly:b=!1,onSubmit:m})=>{let u=O(()=>n||(t?J(t,e.spec):Ie(M(e.spec))),[n,t,e.spec]);ze(()=>{n||!t||ie(u,e.spec)},[n,t,u,e.spec]);let g=O(()=>({...e.spec,elements:Object.fromEntries(Object.entries(e.spec.elements).map(([c,f])=>[c,f.type==="Tabs"?{...f,props:{...f.props,name:f.props.name??c}}:f]))}),[e.spec]),P=O(()=>Object.fromEntries(Object.entries(e.spec.elements).filter(([,c])=>c.type==="Tabs").map(([c,f])=>[String(f.props.name??c),f.children])),[e.spec]),[x,y]=me(!1),[S,s]=me(!1),h=B(null),V=B(null),I=B(!1),D=B({onSubmit:m,streaming:r,ready:l,store:u});D.current={onSubmit:m,streaming:r,ready:l,store:u};let pe=O(()=>({submit:a(async c=>{let{onSubmit:f,streaming:ge,ready:be,store:ye}=D.current;if(!(!f||ge||!be||I.current||typeof c.prompt!="string")){I.current=!0,s(!0);try{await f({prompt:c.prompt,values:ye.getSnapshot().values})}catch{}finally{I.current=!1,s(!1)}}},"submit")}),[]);Ke(()=>{let c=h.current;if(!c)return;let f=c.matches(":modal");if(x){if(f)return;c.close(),c.showModal();return}f&&c.close(),c.open=!0,f&&V.current?.focus({preventScroll:!0})},[x]);let fe=!!m&&!r&&l;return p(N,{value:n?void 0:t,children:p("dialog",{ref:h,"aria-label":e.title,"aria-modal":x,onCancel:c=>{c.preventDefault(),y(!1)},className:C("farero-ui overflow-hidden overscroll-contain rounded-xl border border-border-soft bg-surface p-0 text-text backdrop:bg-black/60",x?"fixed inset-0 m-auto h-[90dvh] w-[96vw] max-w-5xl":"relative m-0 w-full max-w-none"),children:p(je,{registry:q,store:u,handlers:pe,functions:ee,children:p(G,{value:P,children:p(T,{value:{available:fe,pending:S},children:z("div",{className:C("flex min-h-0 flex-col",x&&"h-full"),children:[z("header",{className:"flex shrink-0 items-center gap-2 border-border-soft border-b px-3 py-2",children:[p("h2",{className:"min-w-0 flex-1 truncate font-medium text-sm",children:e.title}),p(U,{ref:V,size:"sm",variant:"ghost","aria-label":x?"Collapse panel":"Expand panel",onClick:()=>y(c=>!c),children:x?p(qe,{size:14}):p(Je,{size:14})})]}),z("div",{className:C("min-h-0 overflow-auto overscroll-contain p-3",x?"flex-1":"max-h-[36rem]"),children:[p("form",{onSubmit:c=>c.preventDefault(),children:p("fieldset",{disabled:r||!l,className:"min-w-0 border-0 p-0",children:p(Le,{spec:g,registry:q,loading:r})})}),r?p("p",{role:"status",className:"mt-3 text-muted text-xs",children:"Interface in progress"}):d?p("p",{role:"status",className:"mt-3 text-muted text-xs",children:d}):null,b?p("p",{className:"mt-3 text-muted text-xs",children:"This saved view is read-only."}):null,o?p("p",{role:"status",className:"mt-3 text-muted text-xs",children:o}):null]})]})})})})})})},"GeneratedPanel");import{jsx as E,jsxs as _e}from"react/jsx-runtime";var De=Z();function Ae(e){return E(_,{components:De,children:e})}a(Ae,"defaultText");var He=a(({text:e,memoryKey:t,renderText:n=Ae,streaming:r=!1,onSubmit:l})=>{let d=Ve(()=>ae(e),[e]);return E("div",{className:"farero-ui space-y-3",children:d.map(o=>o.kind==="text"?E("div",{children:n(o.text)},`text-${o.start}`):o.panel?E(K,{panel:o.panel,memoryKey:`${t}:${o.index}`,streaming:r||!o.complete,onSubmit:l},`panel-${o.start}`):_e("p",{role:"status",className:"text-muted text-xs",children:[o.title," \xB7"," ",o.error?"This interface could not be rendered.":o.complete?"Saving interface\u2026":"Interface in progress"]},`panel-${o.start}`))})},"GeneratedUiContent");export{K as GeneratedPanel,He as GeneratedUiContent,J as memoryPanelStore,Se as releaseGeneratedUiMemory};
|
package/dist/markdown.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o,b as r,c as t,d as n,e as a,f as c,g as p,h as f,i as m,j as i,k as l,l as d,m as s,n as h,o as x,p as y,q as k,r as C,s as R}from"./chunks/chunk-
|
|
1
|
+
import{a as o,b as r,c as t,d as n,e as a,f as c,g as p,h as f,i as m,j as i,k as l,l as d,m as s,n as h,o as x,p as y,q as k,r as C,s as R}from"./chunks/chunk-EUYN7WNH.js";import"./chunks/chunk-JMYCJ5PW.js";import"./chunks/chunk-LHMFMBHY.js";import"./chunks/chunk-ONVWTQLU.js";import"./chunks/chunk-ITKN2ASJ.js";import"./chunks/chunk-RWGTJDY3.js";import"./chunks/chunk-YPRVAH5G.js";import"./chunks/chunk-T3JXEXIJ.js";import{e}from"./chunks/chunk-RR7BB4EQ.js";import"./chunks/chunk-J6G4JKVU.js";import"./chunks/chunk-ZVJQ5X63.js";import"./chunks/chunk-OHGCJOUT.js";import"./chunks/chunk-7OIEAISL.js";import"./chunks/chunk-WQZ3EUKA.js";import"./chunks/chunk-FW2QVWXL.js";import"./chunks/chunk-HGN4GN2E.js";import"./chunks/chunk-5SBKMKFB.js";import"./chunks/chunk-3I4YBQX6.js";export{o as ATTACHMENT_HOST,y as ChatParagraph,k as FootnoteReference,a as MarkdownBody,R as ReadonlyMarkdownComponents,r as attachmentHref,m as attachmentPath,s as chatLinkAction,C as createReadonlyComponents,f as fenceSource,p as fileUrlToLocalPath,c as isAbsoluteFilePath,i as isChatHandoffHref,n as isMarkdownFile,h as linkFaviconUrl,x as linkText,t as markdownSource,e as reactText,l as sourceReference,d as sourceReferences};
|
package/dist/transcript.d.ts
CHANGED
|
@@ -633,6 +633,22 @@ declare const GROUP_PREVIEWS: {
|
|
|
633
633
|
}[];
|
|
634
634
|
/** Latest thinking needs a thought inside the group, and only Group tools + thinking puts one there. */
|
|
635
635
|
declare const groupPreviewAvailable: (preview: StepsSummary, grouping: GroupingMode) => boolean;
|
|
636
|
+
/** A background task's end, drawn as one line that opens to the task's text. */
|
|
637
|
+
interface BackgroundEnd {
|
|
638
|
+
/** What ended and how, such as "Command succeeded" or "Background task stopped". */
|
|
639
|
+
label: string;
|
|
640
|
+
/** The task the provider names: a command, or a subagent's description. */
|
|
641
|
+
description: string;
|
|
642
|
+
tone: 'done' | 'failed' | 'stopped';
|
|
643
|
+
/** What the row opens to, and where it starts in `e.text` so a find match lands on it. */
|
|
644
|
+
output: string;
|
|
645
|
+
outputStart: number;
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* A background task's end, whether a provider stores it as `backgroundResult` or, like
|
|
649
|
+
* Claude, as `Background task <status>: <summary>` text (see `backgroundTaskNotice`).
|
|
650
|
+
*/
|
|
651
|
+
declare function backgroundEnd(e: TranscriptEntry): BackgroundEnd | null;
|
|
636
652
|
/**
|
|
637
653
|
* The collapsed header's preview text. `latest` and `latest-thinking` surface the
|
|
638
654
|
* step's real text — for short-summary thinkers that is the summary itself — while
|
|
@@ -845,5 +861,5 @@ type Lookup = 'Read' | 'Grep' | 'Glob' | 'LS';
|
|
|
845
861
|
/** Pipelines retain their first lookup's kind; sequences must all have the same kind. */
|
|
846
862
|
declare function shellLookup(command: string): Lookup | null;
|
|
847
863
|
|
|
848
|
-
export { ACTIVITY_LAYOUTS, ATTACHED_REPORTS_HEADER, AssistantBody, AutomaticResend, AutomationCard, Bubble, COMPLETED_TURNS, DelegationReturnBody, GROUP_PREVIEWS, QuestionAnswerRecord, QuestionContent, QuestionMarkdown, ReadOnlyTranscript, STICKY_TOP, SystemLine, TurnWorkFold, UserBody, automaticResendIds, batchLookups, browserSignInOf, clockFields, clockSeconds, clockTime, continuesMessageMinute, dateStamp, dateTime, elapsed, foldTurns, groupPreviewAvailable, groupSteps, handoffRequestOf, isAgentAuthored, isAutomaticRetryEntry, isDelegationReturnEntry, isRetryOf, isTurnPrompt, isWorkflowReport, latestTurnActionEnd, lookupLabel, mcpSignInOf, messagePreview, messageTime, parseDelegationReturn, personCard, repliesBeforeWakes, rowKey, savedSignInOf, shellLookup, splitAttachedReports, staysVisible, stepSummary, stepTitle, transcriptSubagents, transcriptTree, turnActionEnds, turnDelegationCount, turnOrigin, turnOrigins, turnWorkLine, workflowReportPromptIds };
|
|
849
|
-
export type { AssistantBodyProps, AttachedReport, ClockFormat, CompletedTurns, DelegationReport, DelegationReturnNotice, GroupingMode, ReadOnlyTranscriptProps, Row, StepRow, StepsSummary, TranscriptEntry, TranscriptNode, TranscriptSubagent, TurnRow, UserBodyProps, UserMessageState, WorkRow };
|
|
864
|
+
export { ACTIVITY_LAYOUTS, ATTACHED_REPORTS_HEADER, AssistantBody, AutomaticResend, AutomationCard, Bubble, COMPLETED_TURNS, DelegationReturnBody, GROUP_PREVIEWS, QuestionAnswerRecord, QuestionContent, QuestionMarkdown, ReadOnlyTranscript, STICKY_TOP, SystemLine, TurnWorkFold, UserBody, automaticResendIds, backgroundEnd, batchLookups, browserSignInOf, clockFields, clockSeconds, clockTime, continuesMessageMinute, dateStamp, dateTime, elapsed, foldTurns, groupPreviewAvailable, groupSteps, handoffRequestOf, isAgentAuthored, isAutomaticRetryEntry, isDelegationReturnEntry, isRetryOf, isTurnPrompt, isWorkflowReport, latestTurnActionEnd, lookupLabel, mcpSignInOf, messagePreview, messageTime, parseDelegationReturn, personCard, repliesBeforeWakes, rowKey, savedSignInOf, shellLookup, splitAttachedReports, staysVisible, stepSummary, stepTitle, transcriptSubagents, transcriptTree, turnActionEnds, turnDelegationCount, turnOrigin, turnOrigins, turnWorkLine, workflowReportPromptIds };
|
|
865
|
+
export type { AssistantBodyProps, AttachedReport, BackgroundEnd, ClockFormat, CompletedTurns, DelegationReport, DelegationReturnNotice, GroupingMode, ReadOnlyTranscriptProps, Row, StepRow, StepsSummary, TranscriptEntry, TranscriptNode, TranscriptSubagent, TurnRow, UserBodyProps, UserMessageState, WorkRow };
|
package/dist/transcript.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import{e as _,h as
|
|
2
|
-
`),
|
|
3
|
-
`)}}let s=null,a=r.indexOf(
|
|
1
|
+
import{e as _,h as je,r as Qe}from"./chunks/chunk-EUYN7WNH.js";import"./chunks/chunk-JMYCJ5PW.js";import"./chunks/chunk-LHMFMBHY.js";import"./chunks/chunk-ONVWTQLU.js";import"./chunks/chunk-ITKN2ASJ.js";import{a as D}from"./chunks/chunk-S3DX6DGB.js";import"./chunks/chunk-RWGTJDY3.js";import"./chunks/chunk-YPRVAH5G.js";import"./chunks/chunk-T3JXEXIJ.js";import{c as He}from"./chunks/chunk-RR7BB4EQ.js";import"./chunks/chunk-J6G4JKVU.js";import"./chunks/chunk-ZVJQ5X63.js";import"./chunks/chunk-OHGCJOUT.js";import{b as De,f as T,g as L,i as x,j as le,k as Ue,l as $e,m as H,n as de,o as b,p as We,q as j,r as qe}from"./chunks/chunk-7OIEAISL.js";import"./chunks/chunk-WQZ3EUKA.js";import"./chunks/chunk-FW2QVWXL.js";import{d as Ge}from"./chunks/chunk-HGN4GN2E.js";import{a as R}from"./chunks/chunk-5SBKMKFB.js";import{a as i}from"./chunks/chunk-3I4YBQX6.js";function Q(e){e=e.filter(s=>!s.supersededBy&&!$e(s.text));let t=new Map;for(let s of e)s.subagentLabel&&s.toolUseId&&!t.has(s.toolUseId)&&t.set(s.toolUseId,s);let n=new Map,r=new Set;for(let s of e){let a=s.parentToolUseId,l=a?t.get(a):void 0;if(!l||l===s)continue;let p=n.get(a)??[];p.push(s),n.set(a,p),r.add(s)}let o=i((s,a)=>{let l=s.toolUseId;if(!l||a.has(l))return{e:s,children:[]};let p=new Set(a);return p.add(l),{e:s,children:(n.get(l)??[]).map(u=>o(u,p))}},"build");return e.filter(s=>!r.has(s)).map(s=>o(s,new Set))}i(Q,"transcriptTree");function Ve(e){let t=[],n=new Set,r=i(o=>{let s=o.e.toolUseId,a=o.e.subagentLabel;s&&a&&!n.has(s)&&(n.add(s),t.push({id:s,label:a,node:o}));for(let l of o.children)r(l)},"visit");for(let o of e)r(o);return t.sort((o,s)=>o.node.e.rowid-s.node.e.rowid||o.id.localeCompare(s.id))}i(Ve,"transcriptSubagents");var A=i(e=>e.role==="user"&&(e.queued||!b(e)),"isTurnPrompt");function ze(e){let t=[],n=null,r=null,o=!1,s=i(()=>{n?t.push(n):o&&r&&t.push(r),n=null,r=null,o=!1},"close");for(let a of e)a.role==="assistant"?n=a:A(a)?(s(),o=!0):r=a;return s(),t}i(ze,"turnActionEnds");function Ke(e){return e.source?.kind==="workflow"}i(Ke,"isWorkflowReport");function Nt(e,t){return e.flatMap(n=>Ke(n)&&n.parentSessionId===t?[n.wake?.promptId,n.wakeFailure?.promptId].filter(r=>r!==void 0):[])}i(Nt,"workflowReportPromptIds");var Ye=/^Report: (\S.*)$/;function ce(e){let t=new Set,n=!1,r=!1;for(let o of e)if(!o.queued&&b(o)){let s=H.exec(o.text);r||=s?.[1]==="Workflow"||o.id.startsWith("workflow_");let a=s?.[1]==="Delegated"?s[3]:o.id.replace(/^return-/,"").replace(/(?:-wake-\d+|-retry(?:-\d+)?)$/,"");t.add(`job:${a}`)}else if(o.role==="tool"&&!o.aborted){if(o.subagentLabel){if(!o.toolUseId)return null;t.add(`native:${o.toolUseId}`)}else if(o.tool&&!o.error&&x(o.tool,o.text).name==="mcp__farero_host__delegate_task"){let s=V(o.output);if(!s)return null;n||=!!s.workflowId,t.add(`job:${s.delegationId}`)}}return n&&r?null:t.size}i(ce,"turnDelegationCount");function V(e,t=0){if(t>6)return null;if(typeof e=="string")try{return V(JSON.parse(e),t+1)}catch{return null}if(Array.isArray(e)){for(let r of e){let o=V(r,t+1);if(o)return o}return null}if(!e||typeof e!="object")return null;let n=e;return n.isError||n.outputValidation?null:n.ok===!0&&typeof n.delegationId=="string"&&n.delegationId?{delegationId:n.delegationId,...typeof n.workflowId=="string"?{workflowId:n.workflowId}:{}}:V(n.structuredContent??n.content??n.text,t+1)}i(V,"delegationReceipt");function pe(e){let t=H.exec(e),n="Worker complete",r=e,o=null;if(t){let[,,m,,S]=t;n=`${m.charAt(0).toUpperCase()}${m.slice(1)} ${S==="completed"?"complete":S}`;let h=r.split(`
|
|
2
|
+
`),k=h.findIndex(N=>H.test(N));if(k>=0){o=h[k].trim();let N=h[k].slice(t[0].length).replace(/^:\s*/,"").trim();S==="failed"&&N?h[k]=N:h.splice(k,1),r=h.join(`
|
|
3
|
+
`)}}let s=null,a=r.indexOf(de);if(a>=0){let m=r.lastIndexOf(`
|
|
4
4
|
|
|
5
|
-
`,a),S=m>=0?m+2:a,
|
|
6
|
-
`)}else o&&(s=o);let{text:l,token:p}=
|
|
7
|
-
`);for(let n=t.length-1;n>=0;n--){let r=
|
|
8
|
-
`).trim(),token:r[1].trim()}}return{text:e,token:null}}i(
|
|
5
|
+
`,a),S=m>=0?m+2:a,h=r.slice(S).trim();r=r.slice(0,S),s=[o,h].filter(Boolean).join(`
|
|
6
|
+
`)}else o&&(s=o);let{text:l,token:p}=Et(r.trim()),[u,w]=Je(l.replace(/^## (?:Baton|Result summary)\s*\n/i,"").trim());return{title:n,lead:u,rest:w,report:p,machine:s}}i(pe,"parseDelegationReturn");function Et(e){let t=e.split(`
|
|
7
|
+
`);for(let n=t.length-1;n>=0;n--){let r=Ye.exec(t[n].trim());if(!(!r||!L(r[1]).length))return t.splice(n,1),{text:t.join(`
|
|
8
|
+
`).trim(),token:r[1].trim()}}return{text:e,token:null}}i(Et,"takeReportLine");function Je(e){let[t,n]=vt(e);if(!It(t)||!n)return[t,n];let[r,o]=Je(n);return[`${t}
|
|
9
9
|
|
|
10
|
-
${r}`,o]}i(
|
|
11
|
-
`).map(n=>n.trim()).filter(Boolean);return t.length>0&&t.every(n=>/^#{1,6}(?:\s|$)/.test(n))}i(
|
|
10
|
+
${r}`,o]}i(Je,"splitLead");function It(e){let t=e.split(`
|
|
11
|
+
`).map(n=>n.trim()).filter(Boolean);return t.length>0&&t.every(n=>/^#{1,6}(?:\s|$)/.test(n))}i(It,"isHeadingOnly");function vt(e){let t=e.split(`
|
|
12
12
|
`),n=!1,r=!1;for(let o=0;o<t.length;o++){let s=t[o].trim();if(/^(```|~~~)/.test(s)&&(n=!n),n){r=!0;continue}if(s)r=!0;else if(r)return[t.slice(0,o).join(`
|
|
13
13
|
`).trim(),t.slice(o+1).join(`
|
|
14
|
-
`).trim()]}return[e.trim(),""]}i(
|
|
15
|
-
`),r=n.findLastIndex(s=>s.trimEnd()===
|
|
16
|
-
`).trimEnd(),reports:o.map(
|
|
14
|
+
`).trim()]}return[e.trim(),""]}i(vt,"splitFirstParagraph");var Xe="Helper reports delivered with this message:",Ze=/^- Delegated (\S+) task (\S+) (completed|failed)\b/;function At(e){let t={body:e,reports:[]},n=e.split(`
|
|
15
|
+
`),r=n.findLastIndex(s=>s.trimEnd()===Xe);if(r<0||r>0&&n[r-1].trim())return t;let o=[];for(let s of n.slice(r+1))if(Ze.test(s))o.push([s]);else if(!s.trim()||o.length&&/^\s/.test(s))o[o.length-1]?.push(s);else return t;return o.length?{body:n.slice(0,r).join(`
|
|
16
|
+
`).trimEnd(),reports:o.map(Ct)}:t}i(At,"splitAttachedReports");function Ct(e){let[t,...n]=e,[,r,o,s]=Ze.exec(t)??[],a=L(e.join(`
|
|
17
17
|
`)),l=a.length?e.join(`
|
|
18
|
-
`).slice(a[0].start,a[0].end):void 0,p=t.slice(2).replace(/\s*Report:\s*\S.*$/,"").trim(),u=
|
|
19
|
-
`).trim()}i(
|
|
20
|
-
`)){let r="",o="",s=0;for(let l of F(n)){let p=n.slice(s,l.start);r+=p+l.name,o+=p,s=l.end}let a=n.slice(s);if((o+a).trim())return r+a;t||=r.trim()}return t}i($t,"firstWords");function X(e,t=120){let n=$t(Pe(e).text).replace(/^[\s>#*\-+]+/,"").replace(/`/g,"").replace(/\s+/g," ").trim();return n.length>t?`${n.slice(0,t-1)}\u2026`:n}i(X,"messagePreview");function ye(e){let t=Math.max(0,Math.floor(e/1e3)),n=t%60,r=Math.floor(t/60)%60,o=Math.floor(t/3600),s=i(a=>String(a).padStart(2,"0"),"pad");return o?`${o}h ${s(r)}m ${s(n)}s`:r?`${r}m ${s(n)}s`:`${n}s`}i(ye,"elapsed");function pt(e,t,n){return`${e.toLocaleDateString(void 0,{month:"short",day:"numeric",...e.getFullYear()===t.getFullYear()?{}:{year:"numeric"}})}, ${J(e,n)}`}i(pt,"dateStamp");function Z(e,t=null){let n=new Date(R(e));if(!Number.isFinite(n.getTime()))return"";let r=new Date;return n.toDateString()===r.toDateString()?J(n,t):pt(n,r,t)}i(Z,"messageTime");var Wt="render_ui";function we(e,t=""){return x(e,t).name===`mcp__farero_host__${Wt}`}i(we,"isGeneratedUiTool");function qt(e){if(/[$`\r\n<>]/.test(e))return null;let t=[],n="",r=!1,o="",s=i(()=>{r&&t.push({word:n}),n="",r=!1},"flush");for(let a=0;a<e.length;a++){let l=e[a];if(l==="\\"&&o!=="'"){let p=e[++a];if(p===void 0)return null;n+=o==='"'&&p!=='"'&&p!=="\\"?`\\${p}`:p,r=!0}else if(o)l===o?o="":n+=l;else if(l==="'"||l==='"')o=l,r=!0;else if(/\s/.test(l))s();else if(l==="|"||l===";"||l==="&")if(s(),l==="&"){if(e[++a]!=="&")return null;t.push({operator:"&&"})}else t.push({operator:l});else{if(/[(){}#]/.test(l))return null;n+=l,r=!0}}return o?null:(s(),t)}i(qt,"tokenize");function Gt(e){let[t,...n]=e;switch(t){case"rg":return n.some(r=>/^--(?:pre|hostname-bin)(?:=|$)/.test(r))?null:n.includes("--files")?"Glob":"Grep";case"grep":return"Grep";case"ls":return"LS";case"cat":case"head":case"tail":case"nl":case"wc":return"Read";case"sed":{if(n[0]!=="-n")return null;let r=n[1]==="-e"?2:1;return/^\d+(?:,\d+)?p$/.test(n[r]??"")?n.slice(r+1).some(o=>o.startsWith("-"))?null:"Read":null}default:return null}}i(Gt,"lookupCommand");function be(e){let t=qt(Fe(e));if(!t?.length)return null;let n=[],r=null,o=null;for(let s=0;s<=t.length;s++){let a=t[s];if(a&&"word"in a){n.push(a.word);continue}if(n[0]==="cd"&&n.length===2&&a?.operator==="&&"&&!r&&!o){n=[];continue}let l=Gt(n);if(!l)return null;if(r??=l,n=[],a?.operator!=="|"){if(o&&o!==r)return null;o=r,r=null}}return o}i(be,"shellLookup");var Ht=[{id:"off",label:"Inline"},{id:"tools",label:"Group tools"},{id:"all",label:"Group tools + thinking"}],jt=[{id:"all",label:"All messages"},{id:"final",label:"Final reply"}],E=i(e=>`${e.rowid}-${e.id}`,"rowKey");function he(e,t,n){if(!t||n?.has(t.id)||e.role!==t.role||!["user","assistant","thinking"].includes(e.role)||e.questionAnswer||t.questionAnswer||e.subagentLabel||t.subagentLabel||h(e)||h(t)||(e.origin??"human")!==(t.origin??"human"))return!1;let r=Math.floor(R(e.ts)/6e4);return Number.isFinite(r)&&r===Math.floor(R(t.ts)/6e4)}i(he,"continuesMessageMinute");var Qt=[{id:"all",label:"All steps"},{id:"latest",label:"Latest step"},{id:"latest-thinking",label:"Latest thinking"}],Vt=i((e,t)=>e!=="latest-thinking"||t==="all","groupPreviewAvailable"),zt=i(e=>e.role==="thinking"?"Thinking":U(e).title,"stepLabel");function ee(e,t="all"){if(t==="all")return[...new Set(e.map(({e:r})=>zt(r)))].join(", ");if(t==="latest-thinking"){for(let r=e.length-1;r>=0;r--)if(e[r].e.role==="thinking")return e[r].e.text}let n=e[e.length-1];return n?n.e.role==="tool"?U(n.e).title:n.e.text:""}i(ee,"stepSummary");var Kt=new Set(["Read","Grep","Glob","LS"]);function ut(e){if(e.role!=="tool"||!e.tool||e.subagentLabel||ie(e))return null;let{name:t}=x(e.tool);return Kt.has(t)?t:t==="Bash"?be(e.detail??""):null}i(ut,"lookupKind");function U(e){if(e.role!=="tool"||!e.tool)return{title:e.text,server:null};let t=x(e.tool,e.text);return{title:ft(e)??ut(e)??t.label,server:t.server}}i(U,"stepTitle");function ft(e){if(!e.text||!e.tool||e.text===e.tool)return;let t=x(e.tool,e.text);if(x(e.text).name!==t.name&&!(t.name==="Bash"&&e.text==="Run command")&&!(t.name==="Edit"&&e.text==="Edit files"))return e.text===t.label?void 0:e.text}i(ft,"ownTitle");function te(e,t=!1){let n=ft(e);if(n)return n;let r=e.detail??"";return e.tool&&x(e.tool).name==="Bash"?r:!t&&r.startsWith("/")?r.slice(r.lastIndexOf("/")+1):r||e.text}i(te,"lookupLabel");function D(e){let t=[],n=[],r=null,o=i(()=>{if(n.length>1)t.push({kind:"batch",key:`batch-${E(n[0].e)}`,tool:r,nodes:n});else for(let s of n)t.push({kind:"entry",key:E(s.e),node:s});n=[],r=null},"flush");for(let s of e){let a=ut(s.e);if(a){n.length&&r!==a&&o(),r=a,n.push(s);continue}o(),t.push({kind:"entry",key:E(s.e),node:s})}return o(),t}i(D,"batchLookups");function B(e,t="all"){if(t==="off")return D(e);let n=t==="tools",r=[],o=[],s=i(()=>{let l=D(o);l.length===1?r.push(l[0]):l.length&&r.push({kind:"steps",key:`steps-${E(o[0].e)}`,nodes:o}),o=[]},"flush"),a=i(l=>!l.e.subagentLabel&&!ie(l.e)&&!Y(l.e)&&!l.e.app&&!l.e.generatedUi&&!we(l.e.tool??"",l.e.text)&&(l.e.role==="tool"||l.e.role==="thinking"&&!n),"joinsRun");for(let l of e){if(a(l)){o.push(l);continue}s(),r.push({kind:"entry",key:E(l.e),node:l})}return s(),r}i(B,"groupSteps");var mt=i(e=>e.role==="system"&&(!!e.backgroundResult||Ue(e.text)),"isBackgroundEnd"),P=i(e=>e.role==="system"&&!mt(e)||!!e.questionAnswer||!!e.sideQuestion||Y(e)||!!e.app?.call||!!e.generatedUi||e.role==="assistant"&&(!!e.generatedUiStreams||e.text.includes("```farero-ui "))||e.role==="tool"&&we(e.tool??"",e.text),"staysVisible"),gt=i(e=>!P(e)&&(e.role==="thinking"||e.role==="tool"||e.role==="assistant"),"agentWork"),xt=i(e=>e.role==="assistant"&&!P(e)&&!!e.text.trim(),"isReply"),Yt=i(e=>!e.queued&&h(e)||mt(e),"isWake");function ke(e){let t=new Set,n=null;for(let{e:r}of e)Yt(r)?(n&&t.add(n),n=null):gt(r)&&(n=xt(r)?r:null);return t}i(ke,"repliesBeforeWakes");function Te(e,t,n){let r=ke(e),o=t?R(n)-R(t):Number.NaN,s=le(e.map(a=>a.e));return{label:[o>0?`Worked for ${ye(o)}`:null,s?`${s} delegation${s===1?"":"s"}`:null].filter(Boolean).join(" \xB7 ")||"Show work",aborted:e.filter(a=>!P(a.e)&&a.e.aborted).length,kept:e.filter(a=>P(a.e)||r.has(a.e))}}i(Te,"turnWorkLine");var Jt=5;function Xt(e,t){let n=ke(e),r=i(o=>!P(o)&&!n.has(o),"hidden");return B(e,t).filter(o=>o.kind==="entry"?r(o.node.e):o.nodes.some(({e:s})=>r(s))).length}i(Xt,"hiddenRows");function Re(e,t="all",{completedTurns:n="final",live:r=!1,dispatched:o}={}){if(n==="all")return B(e,t);let s=[],a=r&&o?R(o):Number.NaN,l=0;for(;l<e.length;){let p=l+1;for(;p<e.length&&!A(e[p].e);)p++;let u=e.slice(l,p),w=p===e.length;l=p;let m=u.length-1;for(;m>0&&!xt(u[m].e);)m--;let S=u[0].e,k=u[m].e,T=u.slice(1,m);if(!(A(S)&&m>0&&!u.slice(m+1).some(({e:C})=>gt(C))&&!(r&&(w||R(k.ts)>=a))&&(T.some(({e:C})=>h(C))||Xt(T,t)>=Jt))){s.push(...B(u,t));continue}s.push({kind:"entry",key:E(S),node:u[0]}),s.push({kind:"work",key:`work-${E(T[0].e)}`,nodes:T,reply:k,startedAt:ce(u.map(({e:C})=>C),k,o)}),s.push(...B(u.slice(m),t))}return s}i(Re,"foldTurns");import{ChevronRight as Zt}from"lucide-react";import{jsx as y,jsxs as v}from"react/jsx-runtime";var ne=i(({children:e})=>y("div",{className:"flex flex-col items-start",children:y(V,{className:"max-w-[92%] px-0.5",children:e})}),"AssistantBody"),Se=i(({children:e,queued:t})=>v(V,{className:I("max-w-[85%] bg-accent-soft text-text",t&&"opacity-60"),children:[t?y(L,{as:"div",className:"mb-1",children:"queued"}):null,e]}),"UserBody"),Ne=i(({id:e,state:t,children:n})=>v("div",{className:"flex flex-col items-end gap-0.5","data-automatic-resend":e,children:[y("span",{className:"pr-1 text-[11px] text-muted",children:t==="queued"?"Message queued to send again":t==="sending"?"Sending your message again\u2026":t==="failed"?"Couldn\u2019t send your message again":t==="uncertain"?"Resend delivery unconfirmed":"Sent your message again"}),n]}),"AutomaticResend"),Ie=i(({label:e,children:t})=>v("div",{className:"max-w-[92%] rounded-xl border border-border-soft bg-surface/40 px-3 py-2 text-left",children:[y(L,{as:"div",className:"mb-1",children:e}),t]}),"AutomationCard"),Ee=i(({children:e})=>y("div",{className:"px-2 text-center text-[11px] text-faint",children:e}),"SystemLine"),ve=i(({notice:e,markdown:t,report:n,time:r})=>v("div",{className:"flex flex-col items-end gap-0.5","data-delegation-return":e.title,children:[v("div",{className:"max-w-[92%] rounded-xl border border-border-soft bg-surface/40 px-3 py-2 text-left",children:[y("p",{className:"text-center font-medium text-[12.5px] text-muted",children:e.title}),e.lead?y("div",{className:"mt-1 text-[13px] text-muted",children:t(e.lead)}):null,e.report?y("div",{className:"mt-1 text-[12px]",children:n}):null,e.rest?v("details",{className:"mt-1",children:[y("summary",{className:"cursor-pointer text-[11px] text-faint",children:"Show full preview"}),y("div",{className:"mt-1 text-[13px] text-muted",children:t(e.rest)})]}):null,e.machine?v("details",{className:"mt-1",children:[y("summary",{className:"cursor-pointer text-[11px] text-faint",children:"Investigation details"}),y("p",{className:"mt-1 whitespace-pre-wrap font-mono text-[11px] text-faint",children:e.machine})]}):null]}),r]}),"DelegationReturnBody"),Ae=i(({label:e,aborted:t,open:n,onToggle:r,work:o,kept:s})=>v("div",{className:"flex min-w-0 flex-col gap-2.5 border-border-soft border-b pb-2.5",children:[v("details",{open:n,onToggle:r,className:"group/work min-w-0",children:[v("summary",{className:"flex w-fit max-w-full cursor-pointer select-none list-none items-center gap-1.5 px-0.5 py-1 text-[12.5px] text-muted transition-colors hover:text-text [&::-webkit-details-marker]:hidden",children:[y("span",{className:"tabular-nums",children:e}),t?v("span",{className:"text-faint",children:["\xB7 ",t," aborted"]}):null,y(Zt,{size:14,"aria-hidden":!0,className:"shrink-0 text-faint transition-transform group-open/work:rotate-90 motion-reduce:transition-none"})]}),n?y("div",{className:"mt-2 flex min-w-0 flex-col gap-2.5",children:o()}):null]}),n?null:s()]}),"TurnWorkFold");import{useContext as dn,useState as cn}from"react";import{createContext as en,useContext as yt,useState as wt}from"react";import tn from"react-markdown";import nn from"remark-breaks";import rn from"remark-gfm";import{jsx as O,jsxs as Ce}from"react/jsx-runtime";var $=en({link:i(({children:e})=>O("span",{children:e}),"link"),original:i(e=>O("pre",{className:"whitespace-pre-wrap break-words font-mono text-xs",children:e}),"original")}),on=[rn,nn],sn=i(({node:e,children:t,className:n,...r})=>{let[o,s]=wt(null);return Ce("div",{className:"relative my-2 min-w-0",children:[O("pre",{...r,className:I("m-0 cursor-text select-text pr-10",n),children:t}),e?O($e,{text:qe(e),label:"code",title:"Copy code",size:12,className:"absolute top-1.5 right-1.5 size-6 select-none rounded-md border border-border-soft bg-bg/90 hover:text-text focus-visible:outline-2 focus-visible:outline-accent",onCopyError:()=>s("Could not copy to the clipboard. Try again.")}):null,O(We,{error:o,onDismiss:()=>s(null)})]})},"QuestionPre"),an=i(e=>yt($).link(e),"QuestionLink"),ln={a:an,pre:sn},_e=i(({text:e})=>{let[t,n]=wt(!1),r=yt($);return Ce("div",{className:"md min-w-0 select-text whitespace-normal break-words [&_pre]:max-h-40 [&_pre]:overflow-auto [&_pre]:overscroll-contain",children:[t?r.original(e):O(tn,{remarkPlugins:on,allowedElements:["p","em","strong","del","code","pre","a","br","ul","ol","li","blockquote"],unwrapDisallowed:!0,components:ln,children:e.length<=32768?e:e.slice(0,32768)}),e.length>32768?Ce("span",{className:"block text-muted",children:["Preview limited to 32,768 characters."," ",O("button",{type:"button",className:"text-accent underline",onClick:()=>n(!t),children:t?"Formatted preview":"Full original text"})]}):null]})},"QuestionMarkdown");import{jsx as W,jsxs as q}from"react/jsx-runtime";var pn=i(({text:e})=>{let[t,n]=cn(!1),r=dn($);return e.length<=1e3?W("span",{className:"whitespace-pre-wrap break-words text-text",children:e}):q("details",{open:t,onToggle:o=>n(o.currentTarget.open),className:"min-w-0",children:[q("summary",{className:"cursor-pointer whitespace-pre-wrap break-words",children:[e.slice(0,500),"\u2026 (full submitted answer)"]}),t?r.original(e):null]})},"AnswerValue"),Be=i(({record:e})=>q("div",{className:"min-w-0 rounded-lg border border-border-soft px-3 py-2 text-xs",children:[q("p",{className:"mb-1 text-muted",children:[e.provider," \xB7"," ",e.decision==="cancel"?"question cancelled":`answer submitted${e.decision?` \xB7 ${e.decision}`:""}`]}),e.questions.map(t=>q("div",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-1 py-1",children:[W("div",{className:"min-w-0 text-muted",children:W(_e,{text:t.question})}),W("span",{"aria-hidden":"true",children:"\u2192"}),W(pn,{text:t.redacted?"[redacted]":t.values.length?(t.labels??t.values).join(", "):e.decision??"No answer supplied"})]},t.id))]}),"QuestionAnswerRecord");import{Waypoints as un}from"lucide-react";import{Fragment as oe,useMemo as re,useState as fn}from"react";function bt(e,t){return e.startsWith(`${t.slice(0,80)||"prompt"}-retry`)}i(bt,"isRetryOf");function Oe(e){let t=new Set,n=new Map,r=new Set;for(let o of e){if(o.role!=="user"||t.has(o.id))continue;let s=n.get(o.text)??[];s.some(a=>bt(o.id,a))&&r.add(o.id),s.push(o.id),n.set(o.text,s),t.add(o.id)}return r}i(Oe,"automaticResendIds");import{Fragment as yn,jsx as d,jsxs as f}from"react/jsx-runtime";var Me=i(({ts:e,clock:t,align:n})=>d("span",{className:I("text-[11px] text-faint",n==="right"?"pr-1 text-right":"pl-1"),children:Z(e,t)}),"RowTime"),mn=i(({e})=>{if(e.error&&!e.tool)return f("details",{className:"overflow-hidden rounded-xl border border-del/30 bg-del/5 px-3 py-2",children:[d("summary",{className:"cursor-pointer text-del text-xs",children:"Failed tool output"}),d("pre",{className:"mt-2 whitespace-pre-wrap font-mono text-[11.5px] leading-relaxed [overflow-wrap:anywhere]",children:e.text})]});let t=e.detail!==e.text?e.detail:void 0,n=z(e),r=K(e),{title:o,server:s}=U(e),a=e.error?d("span",{className:"ml-auto shrink-0 text-[11px] text-del",children:"failed"}):e.aborted?d("span",{className:"ml-auto shrink-0 text-[11px] text-faint",children:"aborted"}):null;return!t&&!e.output&&!e.images?.length&&!e.outputTruncated?f("div",{className:"flex min-w-0 items-baseline gap-2 overflow-hidden whitespace-nowrap rounded-xl border border-border-soft bg-surface/60 px-3 py-1.5",children:[d("span",{className:"shrink-0 font-mono text-[11px] text-faint",children:"\xB7"}),d("span",{title:o,className:"max-w-full truncate text-[12.5px] text-muted",children:o}),s?f("span",{className:"shrink-0 text-[11px] text-faint",children:["\xB7 ",s]}):null,a]}):f("details",{className:I("min-w-0 overflow-clip rounded-xl border",e.error?"border-del/30 bg-del/5":"border-border-soft bg-surface/60"),children:[f("summary",{className:"flex cursor-pointer select-none list-none items-baseline gap-2 overflow-hidden whitespace-nowrap px-3 py-1.5 [&::-webkit-details-marker]:hidden",children:[d("span",{className:"shrink-0 font-mono text-[11px] text-faint",children:"\u25B8"}),d("span",{title:o,className:"max-w-full truncate text-[12.5px] text-muted",children:o}),s?f("span",{className:"shrink-0 text-[11px] text-faint",children:["\xB7 ",s]}):null,t?d("span",{title:t,className:"min-w-0 flex-1 truncate font-mono text-[11px] text-faint",children:t}):null,a]}),f("div",{className:"flex min-w-0 flex-col gap-2 px-3 py-2",children:[t?d("pre",{className:"whitespace-pre-wrap font-mono text-[11.5px] text-muted leading-relaxed [overflow-wrap:anywhere]",children:t}):null,e.output?f("div",{className:I("min-w-0",t&&"border-border-soft border-t pt-2"),children:[d(L,{as:"div",className:"mb-1",children:e.error?"error":e.aborted?"aborted":e.diff?"changes":"output"}),d("pre",{className:"whitespace-pre-wrap font-mono text-[11.5px] leading-relaxed [overflow-wrap:anywhere]",children:e.output})]}):null,n?f("p",{className:"text-[11px] text-faint",children:["Sign-in required for ",n.servers.join(", "),"."]}):null,r?d("p",{className:"text-[11px] text-faint",children:"Browser sign-in requested."}):null,e.outputTruncated?f("p",{className:"text-[11px] text-faint tabular-nums",children:["Output truncated.",e.outputOriginalBytes?` Original size: ${e.outputOriginalBytes.toLocaleString()} bytes.`:null]}):null,e.images?.length?f("p",{className:"text-[11px] text-faint",children:[e.images.length," image",e.images.length===1?"":"s"," (not shown in preview)"]}):null]})]})},"ReadonlyToolRow"),ht=i(({tool:e,nodes:t,renderNode:n})=>{let r=t.map(({e:s})=>te(s)).join(", "),o=x(e).label;return f("details",{className:"min-w-0 overflow-clip rounded-xl border border-border-soft bg-surface/40",children:[f("summary",{className:"flex cursor-pointer select-none list-none items-baseline gap-2 overflow-hidden whitespace-nowrap px-3 py-1.5 [&::-webkit-details-marker]:hidden",children:[d("span",{className:"shrink-0 font-mono text-[11px] text-faint",children:"\u25B8"}),f("span",{className:"shrink-0 text-[12.5px] text-muted",children:[o," \xD7",t.length]}),d("span",{title:t.map(({e:s})=>te(s,!0)).join(", "),className:"min-w-0 flex-1 truncate font-mono text-[11px] text-faint",children:r})]}),d("div",{className:"flex min-w-0 flex-col gap-2.5 px-2 py-2.5",children:t.map(s=>d(oe,{children:n(s)},E(s.e)))})]})},"ReadonlyBatch"),gn=i(({row:e,grouping:t,renderRows:n,renderNode:r})=>{let[o,s]=fn(!1),{label:a,aborted:l,kept:p}=Te(e.nodes,e.startedAt,e.reply.ts);return d(Ae,{label:a,aborted:l,open:o,onToggle:u=>s(u.currentTarget.open),work:()=>n(B(e.nodes,t)),kept:()=>p.map(u=>d(oe,{children:r(u)},E(u.e)))})},"ReadonlyTurnWork"),xn=i(({entries:e,grouping:t="all",completedTurns:n="final",stepsSummary:r="all",clock:o=null,onOpenFile:s,filePaths:a,images:l,onSelectSubagent:p,className:u})=>{let w=re(()=>Ge({onOpenFile:s,filePaths:a,images:l}),[s,a,l]),m=re(()=>j(e),[e]),S=re(()=>Re(m,t,{completedTurns:n}),[m,t,n]),k=t==="tools",T=re(()=>Oe(e),[e]),N=i((g,se)=>{let{e:c}=g,M=he(c,se?.e,T);if(c.subagentLabel){let b=f(yn,{children:[d(un,{size:14,strokeWidth:1.7,className:"shrink-0 text-faint","aria-hidden":!0}),d("span",{className:"shrink-0 font-medium text-text",children:"Agent"}),d("span",{title:c.subagentLabel,className:"min-w-0 flex-1 truncate text-[11.5px] text-muted",children:c.subagentLabel}),c.error?d("span",{className:"shrink-0 text-[11px] text-del",children:"failed"}):null,c.toolUseId&&p?d("span",{className:"shrink-0 text-[11px] text-faint",children:"Open"}):null]});return d("section",{className:"min-w-0 px-0.5","data-subagent":c.subagentLabel,children:c.toolUseId&&p?d("button",{type:"button",onClick:()=>p(c.toolUseId??null),"aria-label":`Open agent ${c.subagentLabel}`,className:"flex w-full min-w-0 items-center gap-2 rounded-lg py-1 text-left text-[12.5px] transition active:bg-surface-2",children:b}):d("div",{className:"flex min-w-0 items-center gap-2 py-1 text-[12.5px]",children:b})})}if(c.questionAnswer?.evidence==="submitted")return d(Be,{record:c.questionAnswer});if(c.role==="user"){if(T.has(c.id))return d(Ne,{id:c.id,state:c.queued?"queued":void 0});if(h(c)){let b=de(c.text);return d(ve,{notice:b,markdown:kt=>d(_,{components:w,children:kt}),report:b.report?d(_,{components:w,children:b.report}):null,time:d("span",{className:"pr-1 text-[11px] text-faint",children:Z(c.ts,o)})})}return c.origin==="agent"||c.parentToolUseId||H(c)?f("div",{className:"flex flex-col items-end gap-0.5","data-automation":c.id,children:[d(Ie,{label:c.parentToolUseId?"Assignment":"Automation",children:d("div",{className:"text-[13px] text-muted leading-relaxed",children:d(_,{components:w,children:c.text})})}),M?null:d(Me,{ts:c.ts,clock:o,align:"right"})]}):f("div",{className:"flex flex-col items-end gap-0.5","data-user-msg":X(c.text),"data-msg-ts":c.ts,children:[d(Se,{queued:c.queued,children:d(_,{components:w,children:c.text})}),M?null:d(Me,{ts:c.ts,clock:o,align:"right"})]})}return c.role==="tool"?d(mn,{e:c}):c.role==="thinking"&&!k?f("details",{className:"min-w-0 overflow-clip rounded-xl border border-border-soft bg-surface/60",children:[f("summary",{className:"flex cursor-pointer select-none list-none items-baseline gap-2 overflow-hidden whitespace-nowrap px-3 py-1.5 [&::-webkit-details-marker]:hidden",children:[d("span",{className:"shrink-0 font-mono text-[11px] text-faint",children:"\u25B8"}),d("span",{className:"shrink-0 text-[12.5px] text-muted",children:"Thinking"}),d("span",{title:c.text,className:"min-w-0 flex-1 truncate text-[11px] text-faint",children:X(c.text)})]}),d("div",{className:"px-3 py-2 text-[13px] text-muted italic leading-relaxed",children:d(ne,{children:d(_,{components:w,children:c.text})})})]}):c.role==="system"?d(Ee,{children:c.text}):f("div",{className:"flex flex-col items-start gap-0.5 max-md:items-stretch",children:[d(ne,{children:d(_,{components:w,children:c.text})}),M?null:d(Me,{ts:c.ts,clock:o,align:"left"})]})},"renderNode"),C=i((g,se,c)=>{if(g.kind==="work")return d(gn,{row:g,grouping:t,renderRows:b=>b.map(C),renderNode:N},g.key);if(g.kind==="steps")return f("details",{className:"min-w-0 overflow-clip rounded-xl border border-border-soft bg-surface/40",children:[f("summary",{className:"flex cursor-pointer select-none list-none items-baseline gap-2 overflow-hidden whitespace-nowrap px-3 py-1.5 [&::-webkit-details-marker]:hidden",children:[d("span",{className:"shrink-0 font-mono text-[11px] text-faint",children:"\u25B8"}),f("span",{className:"shrink-0 text-[12.5px] text-muted",children:[g.nodes.length," steps"]}),d("span",{title:ee(g.nodes,r),className:"min-w-0 flex-1 truncate text-[11px] text-faint",children:ee(g.nodes,r)})]}),d("div",{className:"flex min-w-0 flex-col gap-2.5 px-2 py-2.5",children:D(g.nodes).map(b=>b.kind==="batch"?d(ht,{tool:b.tool,nodes:b.nodes,renderNode:N},b.key):d(oe,{children:N(b.node)},b.key))})]},g.key);if(g.kind==="batch")return d(ht,{tool:g.tool,nodes:g.nodes,renderNode:N},g.key);let M=c[se+1];return d(oe,{children:N(g.node,M?.kind==="entry"?M.node:void 0)},g.key)},"renderRow");return d("div",{className:I("farero-ui flex min-w-0 flex-col gap-2.5 text-text",u),children:S.map(C)})},"ReadOnlyTranscript");export{Ht as ACTIVITY_LAYOUTS,Ke as ATTACHED_REPORTS_HEADER,ne as AssistantBody,Ne as AutomaticResend,Ie as AutomationCard,V as Bubble,jt as COMPLETED_TURNS,ve as DelegationReturnBody,Qt as GROUP_PREVIEWS,Be as QuestionAnswerRecord,$ as QuestionContent,_e as QuestionMarkdown,xn as ReadOnlyTranscript,Ct as STICKY_TOP,Ee as SystemLine,Ae as TurnWorkFold,Se as UserBody,Oe as automaticResendIds,D as batchLookups,K as browserSignInOf,ct as clockFields,Dt as clockSeconds,J as clockTime,he as continuesMessageMinute,pt as dateStamp,Ut as dateTime,ye as elapsed,Re as foldTurns,Vt as groupPreviewAvailable,B as groupSteps,dt as handoffRequestOf,De as isAgentAuthored,H as isAutomaticRetryEntry,h as isDelegationReturnEntry,bt as isRetryOf,A as isTurnPrompt,Qe as isWorkflowReport,At as latestTurnActionEnd,te as lookupLabel,z as mcpSignInOf,X as messagePreview,Z as messageTime,de as parseDelegationReturn,Y as personCard,ke as repliesBeforeWakes,E as rowKey,lt as savedSignInOf,be as shellLookup,It as splitAttachedReports,P as staysVisible,ee as stepSummary,U as stepTitle,He as transcriptSubagents,j as transcriptTree,je as turnActionEnds,le as turnDelegationCount,ce as turnOrigin,Je as turnOrigins,Te as turnWorkLine,Tt as workflowReportPromptIds};
|
|
18
|
+
`).slice(a[0].start,a[0].end):void 0,p=t.slice(2).replace(/\s*Report:\s*\S.*$/,"").trim(),u=_t(n.filter(w=>!Ye.test(w.trim())&&!w.trim().startsWith(de)));return{label:r,id:o,outcome:s==="failed"?"failed":"completed",line:p,...u?{preview:u}:{},...l?{attachmentToken:l}:{}}}i(Ct,"attachedReport");function _t(e){let t=e.filter(r=>r.trim()).map(r=>/^ */.exec(r)?.[0].length??0),n=t.length?Math.min(...t):0;return e.map(r=>r.slice(Math.min(n,/^ */.exec(r)?.[0].length??0))).join(`
|
|
19
|
+
`).trim()}i(_t,"dedent");function Bt(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.role==="assistant")return n;if(A(n))return t+1<e.length?e[e.length-1]:null}return null}i(Bt,"latestTurnActionEnd");function ue(e,t,n){return et(e,[t],n).get(t)??null}i(ue,"turnOrigin");function et(e,t,n){let r=new Map;if(t.length===0)return r;let o=n?T(n):Number.NaN,s=new Set(t),a=i((u,w,m)=>n&&o<m&&!w?n:u,"originAt"),l=null,p=!1;for(let u of e)s.has(u)&&r.set(u,a(l,p,T(u.ts))),A(u)?(l=u.ts,p=!1):b(u)&&(p=!0);if(r.size===s.size)return r;for(let u of s)r.has(u)||r.set(u,a(l,p,T(u.ts)));return r}i(et,"turnOrigins");import{jsx as Mt}from"react/jsx-runtime";var z=i(({children:e,className:t})=>Mt("div",{className:R("min-w-0 rounded-2xl px-3.5 py-2.5 text-[14px] leading-relaxed [overflow-wrap:anywhere]",t),children:e}),"Bubble"),Ot=["-top-3","top-5","top-13"];var fe="browser_sign_in";function tt(e){let t=i((n,r)=>{if(r>6)return;if(typeof n=="string")try{return t(JSON.parse(n),r+1)}catch{return}if(Array.isArray(n)){for(let a of n){let l=t(a,r+1);if(l)return l}return}if(!n||typeof n!="object")return;let o=n;if(o.isError)return;let s=o.signIn;return s&&typeof s.id=="string"&&/^bsi_[a-f\d]{64}$/.test(s.id)?s.id:t(o.structuredContent??o.content??o.text,r+1)},"read");return t(e,0)}i(tt,"browserSignInReceipt");var me="handoff_request";function nt(e){let t=i((n,r)=>{if(r>6)return;if(typeof n=="string")try{return t(JSON.parse(n),r+1)}catch{return}if(Array.isArray(n)){for(let l of n){let p=t(l,r+1);if(p)return p}return}if(!n||typeof n!="object")return;let o=n;if(o.isError)return;let s=o.handoff,a=s?.id;if(typeof a=="string"){if(s?.kind==="sign_in"&&/^bsi_[a-f\d]{64}$/.test(a))return{kind:"sign_in",id:a};if(s?.kind==="saved_sign_in"&&/^psi_[a-f\d]{64}$/.test(a))return{kind:"saved_sign_in",id:a};if(s?.kind!=="sign_in"&&s?.kind!=="saved_sign_in"&&/^hr_[a-f\d]{64}$/.test(a))return{kind:"request",id:a}}return t(o.structuredContent??o.content??o.text,r+1)},"read");return t(e,0)}i(nt,"handoffRequestReceipt");var Pt="request_mcp_sign_in";function ge(e,t=""){return x(e,t).name===`mcp__farero_host__${Pt}`}i(ge,"isMcpSignInTool");function rt(e){let t=i((n,r)=>{if(r>6)return;if(typeof n=="string")try{return t(JSON.parse(n),r+1)}catch{return}if(Array.isArray(n)){for(let s of n){let a=t(s,r+1);if(a)return a}return}if(!n||typeof n!="object")return;let o=n;if(!o.isError)return typeof o.server=="string"&&o.server&&typeof o.status=="string"&&typeof o.next=="string"?{server:o.server,status:o.status}:t(o.structuredContent??o.content??o.text,r+1)},"read");return t(e,0)}i(rt,"readSignInReceipt");function Ft(e){let t=rt(e);return t?{servers:[t.server]}:void 0}i(Ft,"mcpSignInToolResult");var Lt=["needs-sign-in","connecting","connected","failed","disabled","unknown"];function ot(e){let t=rt(e)?.status;return Lt.find(n=>n===t)}i(ot,"mcpSignInToolStatus");function st(e){return ge(e.tool??"",e.text)?e.error?void 0:Ft(e.output):e.mcpSignIn}i(st,"mcpSignInCard");var it=new WeakMap,at=new WeakMap,lt=new WeakMap,dt=new WeakMap,ct=new WeakMap;function K(e){let t=it.get(e);if(t!==void 0)return t??void 0;let n=st(e)??null;return it.set(e,n),n??void 0}i(K,"mcpSignInOf");function Y(e){let t=at.get(e);if(t!==void 0)return t??void 0;let n=Dt(e)??null;return at.set(e,n),n??void 0}i(Y,"browserSignInOf");function pt(e){let t=lt.get(e);if(t!==void 0)return t??void 0;let n=ye(e),r=n?.kind==="saved_sign_in"?n.id:null;return lt.set(e,r),r??void 0}i(pt,"savedSignInOf");function ut(e){let t=ye(e);return t?.kind==="request"?t.id:void 0}i(ut,"handoffRequestOf");function xe(e){let t=x(e.tool??"",e.text);return(t.server??"farero_host")==="farero_host"?t.label:void 0}i(xe,"hostTool");function ye(e){let t=dt.get(e);if(t!==void 0)return t??void 0;let n=!e.error&&xe(e)===me&&nt(e.output)||null;return dt.set(e,n),n??void 0}i(ye,"handoffOf");function Dt(e){if(e.error)return;let t=ye(e);return t?.kind==="sign_in"?t.id:xe(e)===fe?tt(e.output):void 0}i(Dt,"browserSignInReceiptOf");function Ut(e){if(!e.error)return!1;if(ge(e.tool??"",e.text))return!0;let t=xe(e);return t===fe||t===me}i(Ut,"failedCardRow");function J(e){let t=ct.get(e);if(t!==void 0)return t;let n=$t(e);return ct.set(e,n),n}i(J,"personCard");function $t(e){if(Ut(e))return!0;if(!K(e)&&!Y(e)&&!pt(e)&&!ut(e))return!1;let t=ot(e.output);return t!=="connected"&&t!=="disabled"}i($t,"personCardUncached");function we(e){return e==="24h"?{hourCycle:"h23"}:e==="12h"?{hour12:!0}:{}}i(we,"hourCycle");function ft(e){return{hour:e==="12h"?"numeric":"2-digit",minute:"2-digit",...we(e)}}i(ft,"clockFields");function X(e,t=null){return new Date(e).toLocaleTimeString(void 0,ft(t))}i(X,"clockTime");function Wt(e,t=null){return new Date(e).toLocaleTimeString(void 0,we(t))}i(Wt,"clockSeconds");function qt(e,t=null){return new Date(e).toLocaleString(void 0,we(t))}i(qt,"dateTime");function Gt(e){let t="";for(let n of e.split(`
|
|
20
|
+
`)){let r="",o="",s=0;for(let l of L(n)){let p=n.slice(s,l.start);r+=p+l.name,o+=p,s=l.end}let a=n.slice(s);if((o+a).trim())return r+a;t||=r.trim()}return t}i(Gt,"firstWords");function Z(e,t=120){let n=Gt(De(e).text).replace(/^[\s>#*\-+]+/,"").replace(/`/g,"").replace(/\s+/g," ").trim();return n.length>t?`${n.slice(0,t-1)}\u2026`:n}i(Z,"messagePreview");function be(e){let t=Math.max(0,Math.floor(e/1e3)),n=t%60,r=Math.floor(t/60)%60,o=Math.floor(t/3600),s=i(a=>String(a).padStart(2,"0"),"pad");return o?`${o}h ${s(r)}m ${s(n)}s`:r?`${r}m ${s(n)}s`:`${n}s`}i(be,"elapsed");function mt(e,t,n){return`${e.toLocaleDateString(void 0,{month:"short",day:"numeric",...e.getFullYear()===t.getFullYear()?{}:{year:"numeric"}})}, ${X(e,n)}`}i(mt,"dateStamp");function ee(e,t=null){let n=new Date(T(e));if(!Number.isFinite(n.getTime()))return"";let r=new Date;return n.toDateString()===r.toDateString()?X(n,t):mt(n,r,t)}i(ee,"messageTime");var Ht="render_ui";function he(e,t=""){return x(e,t).name===`mcp__farero_host__${Ht}`}i(he,"isGeneratedUiTool");function jt(e){if(/[$`\r\n<>]/.test(e))return null;let t=[],n="",r=!1,o="",s=i(()=>{r&&t.push({word:n}),n="",r=!1},"flush");for(let a=0;a<e.length;a++){let l=e[a];if(l==="\\"&&o!=="'"){let p=e[++a];if(p===void 0)return null;n+=o==='"'&&p!=='"'&&p!=="\\"?`\\${p}`:p,r=!0}else if(o)l===o?o="":n+=l;else if(l==="'"||l==='"')o=l,r=!0;else if(/\s/.test(l))s();else if(l==="|"||l===";"||l==="&")if(s(),l==="&"){if(e[++a]!=="&")return null;t.push({operator:"&&"})}else t.push({operator:l});else{if(/[(){}#]/.test(l))return null;n+=l,r=!0}}return o?null:(s(),t)}i(jt,"tokenize");function Qt(e){let[t,...n]=e;switch(t){case"rg":return n.some(r=>/^--(?:pre|hostname-bin)(?:=|$)/.test(r))?null:n.includes("--files")?"Glob":"Grep";case"grep":return"Grep";case"ls":return"LS";case"cat":case"head":case"tail":case"nl":case"wc":return"Read";case"sed":{if(n[0]!=="-n")return null;let r=n[1]==="-e"?2:1;return/^\d+(?:,\d+)?p$/.test(n[r]??"")?n.slice(r+1).some(o=>o.startsWith("-"))?null:"Read":null}default:return null}}i(Qt,"lookupCommand");function ke(e){let t=jt(Ue(e));if(!t?.length)return null;let n=[],r=null,o=null;for(let s=0;s<=t.length;s++){let a=t[s];if(a&&"word"in a){n.push(a.word);continue}if(n[0]==="cd"&&n.length===2&&a?.operator==="&&"&&!r&&!o){n=[];continue}let l=Qt(n);if(!l)return null;if(r??=l,n=[],a?.operator!=="|"){if(o&&o!==r)return null;o=r,r=null}}return o}i(ke,"shellLookup");var Vt=[{id:"off",label:"Inline"},{id:"tools",label:"Group tools"},{id:"all",label:"Group tools + thinking"}],zt=[{id:"all",label:"All messages"},{id:"final",label:"Final reply"}],I=i(e=>`${e.rowid}-${e.id}`,"rowKey");function Te(e,t,n){if(!t||n?.has(t.id)||e.role!==t.role||!["user","assistant","thinking"].includes(e.role)||e.questionAnswer||t.questionAnswer||e.subagentLabel||t.subagentLabel||b(e)||b(t)||(e.origin??"human")!==(t.origin??"human"))return!1;let r=Math.floor(T(e.ts)/6e4);return Number.isFinite(r)&&r===Math.floor(T(t.ts)/6e4)}i(Te,"continuesMessageMinute");var Kt=[{id:"all",label:"All steps"},{id:"latest",label:"Latest step"},{id:"latest-thinking",label:"Latest thinking"}],Yt=i((e,t)=>e!=="latest-thinking"||t==="all","groupPreviewAvailable");function $(e){if(e.role!=="system")return null;let t=e.backgroundResult;if(t)return{label:`${t.kind==="shell"?"Command":"Subagent"} ${t.state}`,description:t.description,tone:t.state==="succeeded"?"done":"failed",output:e.text,outputStart:0};let n=qe(e.text);return n?{label:`Background task ${n.status||"ended"}`,description:n.summary,tone:n.status==="completed"?"done":n.status==="failed"?"failed":"stopped",output:n.summary,outputStart:e.text.length-n.summary.length}:null}i($,"backgroundEnd");var Re=i(e=>!!$(e),"isBackgroundEnd"),gt=i(e=>e.role==="thinking"?"Thinking":$(e)?.label??ne(e).title,"stepLabel");function te(e,t="all"){if(t==="all")return[...new Set(e.map(({e:r})=>gt(r)))].join(", ");if(t==="latest-thinking"){for(let r=e.length-1;r>=0;r--)if(e[r].e.role==="thinking")return e[r].e.text}let n=e[e.length-1];return n?n.e.role==="thinking"?n.e.text:gt(n.e):""}i(te,"stepSummary");var Jt=new Set(["Read","Grep","Glob","LS"]);function xt(e){if(e.role!=="tool"||!e.tool||e.subagentLabel||le(e))return null;let{name:t}=x(e.tool);return Jt.has(t)?t:t==="Bash"?ke(e.detail??""):null}i(xt,"lookupKind");function ne(e){if(e.role!=="tool"||!e.tool)return{title:e.text,server:null};let t=x(e.tool,e.text);return{title:yt(e)??xt(e)??t.label,server:t.server}}i(ne,"stepTitle");function yt(e){if(!e.text||!e.tool||e.text===e.tool)return;let t=x(e.tool,e.text);if(x(e.text).name!==t.name&&!(t.name==="Bash"&&e.text==="Run command")&&!(t.name==="Edit"&&e.text==="Edit files"))return e.text===t.label?void 0:e.text}i(yt,"ownTitle");function re(e,t=!1){let n=yt(e);if(n)return n;let r=e.detail??"";return e.tool&&x(e.tool).name==="Bash"?r:!t&&r.startsWith("/")?r.slice(r.lastIndexOf("/")+1):r||e.text}i(re,"lookupLabel");function U(e){let t=[],n=[],r=null,o=i(()=>{if(n.length>1)t.push({kind:"batch",key:`batch-${I(n[0].e)}`,tool:r,nodes:n});else for(let s of n)t.push({kind:"entry",key:I(s.e),node:s});n=[],r=null},"flush");for(let s of e){let a=xt(s.e);if(a){n.length&&r!==a&&o(),r=a,n.push(s);continue}o(),t.push({kind:"entry",key:I(s.e),node:s})}return o(),t}i(U,"batchLookups");function B(e,t="all"){if(t==="off")return U(e);let n=t==="tools",r=[],o=[],s=i(()=>{let l=U(o);l.length===1?r.push(l[0]):l.length&&r.push({kind:"steps",key:`steps-${I(o[0].e)}`,nodes:o}),o=[]},"flush"),a=i(l=>!l.e.subagentLabel&&!le(l.e)&&!J(l.e)&&!l.e.app&&!l.e.generatedUi&&!he(l.e.tool??"",l.e.text)&&(l.e.role==="tool"||Re(l.e)||l.e.role==="thinking"&&!n),"joinsRun");for(let l of e){if(a(l)){o.push(l);continue}s(),r.push({kind:"entry",key:I(l.e),node:l})}return s(),r}i(B,"groupSteps");var F=i(e=>e.role==="system"&&!Re(e)||!!e.questionAnswer||!!e.sideQuestion||J(e)||!!e.app?.call||!!e.generatedUi||e.role==="assistant"&&(!!e.generatedUiStreams||e.text.includes("```farero-ui "))||e.role==="tool"&&he(e.tool??"",e.text),"staysVisible"),wt=i(e=>!F(e)&&(e.role==="thinking"||e.role==="tool"||e.role==="assistant"),"agentWork"),bt=i(e=>e.role==="assistant"&&!F(e)&&!!e.text.trim(),"isReply"),Xt=i(e=>!e.queued&&b(e)||Re(e),"isWake");function Se(e){let t=new Set,n=null;for(let{e:r}of e)Xt(r)?(n&&t.add(n),n=null):wt(r)&&(n=bt(r)?r:null);return t}i(Se,"repliesBeforeWakes");function Ne(e,t,n){let r=Se(e),o=t?T(n)-T(t):Number.NaN,s=ce(e.map(a=>a.e));return{label:[o>0?`Worked for ${be(o)}`:null,s?`${s} delegation${s===1?"":"s"}`:null].filter(Boolean).join(" \xB7 ")||"Show work",aborted:e.filter(a=>!F(a.e)&&a.e.aborted).length,kept:e.filter(a=>F(a.e)||r.has(a.e))}}i(Ne,"turnWorkLine");var Zt=5;function en(e,t){let n=Se(e),r=i(o=>!F(o)&&!n.has(o),"hidden");return B(e,t).filter(o=>o.kind==="entry"?r(o.node.e):o.nodes.some(({e:s})=>r(s))).length}i(en,"hiddenRows");function Ee(e,t="all",{completedTurns:n="final",live:r=!1,dispatched:o}={}){if(n==="all")return B(e,t);let s=[],a=r&&o?T(o):Number.NaN,l=0;for(;l<e.length;){let p=l+1;for(;p<e.length&&!A(e[p].e);)p++;let u=e.slice(l,p),w=p===e.length;l=p;let m=u.length-1;for(;m>0&&!bt(u[m].e);)m--;let S=u[0].e,h=u[m].e,k=u.slice(1,m);if(!(A(S)&&m>0&&!u.slice(m+1).some(({e:C})=>wt(C))&&!(r&&(w||T(h.ts)>=a))&&(k.some(({e:C})=>b(C))||en(k,t)>=Zt))){s.push(...B(u,t));continue}s.push({kind:"entry",key:I(S),node:u[0]}),s.push({kind:"work",key:`work-${I(k[0].e)}`,nodes:k,reply:h,startedAt:ue(u.map(({e:C})=>C),h,o)}),s.push(...B(u.slice(m),t))}return s}i(Ee,"foldTurns");import{ChevronRight as tn}from"lucide-react";import{jsx as y,jsxs as v}from"react/jsx-runtime";var oe=i(({children:e})=>y("div",{className:"flex flex-col items-start",children:y(z,{className:"max-w-[92%] px-0.5",children:e})}),"AssistantBody"),Ie=i(({children:e,queued:t})=>v(z,{className:R("max-w-[85%] bg-accent-soft text-text",t&&"opacity-60"),children:[t?y(D,{as:"div",className:"mb-1",children:"queued"}):null,e]}),"UserBody"),ve=i(({id:e,state:t,children:n})=>v("div",{className:"flex flex-col items-end gap-0.5","data-automatic-resend":e,children:[y("span",{className:"pr-1 text-[11px] text-muted",children:t==="queued"?"Message queued to send again":t==="sending"?"Sending your message again\u2026":t==="failed"?"Couldn\u2019t send your message again":t==="uncertain"?"Resend delivery unconfirmed":"Sent your message again"}),n]}),"AutomaticResend"),Ae=i(({label:e,children:t})=>v("div",{className:"max-w-[92%] rounded-xl border border-border-soft bg-surface/40 px-3 py-2 text-left",children:[y(D,{as:"div",className:"mb-1",children:e}),t]}),"AutomationCard"),Ce=i(({children:e})=>y("div",{className:"px-2 text-center text-[11px] text-faint",children:e}),"SystemLine"),_e=i(({notice:e,markdown:t,report:n,time:r})=>v("div",{className:"flex flex-col items-end gap-0.5","data-delegation-return":e.title,children:[v("div",{className:"max-w-[92%] rounded-xl border border-border-soft bg-surface/40 px-3 py-2 text-left",children:[y("p",{className:"text-center font-medium text-[12.5px] text-muted",children:e.title}),e.lead?y("div",{className:"mt-1 text-[13px] text-muted",children:t(e.lead)}):null,e.report?y("div",{className:"mt-1 text-[12px]",children:n}):null,e.rest?v("details",{className:"mt-1",children:[y("summary",{className:"cursor-pointer text-[11px] text-faint",children:"Show full preview"}),y("div",{className:"mt-1 text-[13px] text-muted",children:t(e.rest)})]}):null,e.machine?v("details",{className:"mt-1",children:[y("summary",{className:"cursor-pointer text-[11px] text-faint",children:"Investigation details"}),y("p",{className:"mt-1 whitespace-pre-wrap font-mono text-[11px] text-faint",children:e.machine})]}):null]}),r]}),"DelegationReturnBody"),Be=i(({label:e,aborted:t,open:n,onToggle:r,work:o,kept:s})=>v("div",{className:"flex min-w-0 flex-col gap-2.5 border-border-soft border-b pb-2.5",children:[v("details",{open:n,onToggle:r,className:"group/work min-w-0",children:[v("summary",{className:"flex w-fit max-w-full cursor-pointer select-none list-none items-center gap-1.5 px-0.5 py-1 text-[12.5px] text-muted transition-colors hover:text-text [&::-webkit-details-marker]:hidden",children:[y("span",{className:"tabular-nums",children:e}),t?v("span",{className:"text-faint",children:["\xB7 ",t," aborted"]}):null,y(tn,{size:14,"aria-hidden":!0,className:"shrink-0 text-faint transition-transform group-open/work:rotate-90 motion-reduce:transition-none"})]}),n?y("div",{className:"mt-2 flex min-w-0 flex-col gap-2.5",children:o()}):null]}),n?null:s()]}),"TurnWorkFold");import{useContext as pn,useState as un}from"react";import{createContext as nn,useContext as ht,useState as kt}from"react";import rn from"react-markdown";import on from"remark-breaks";import sn from"remark-gfm";import{jsx as O,jsxs as Oe}from"react/jsx-runtime";var W=nn({link:i(({children:e})=>O("span",{children:e}),"link"),original:i(e=>O("pre",{className:"whitespace-pre-wrap break-words font-mono text-xs",children:e}),"original")}),an=[sn,on],ln=i(({node:e,children:t,className:n,...r})=>{let[o,s]=kt(null);return Oe("div",{className:"relative my-2 min-w-0",children:[O("pre",{...r,className:R("m-0 cursor-text select-text pr-10",n),children:t}),e?O(Ge,{text:je(e),label:"code",title:"Copy code",size:12,className:"absolute top-1.5 right-1.5 size-6 select-none rounded-md border border-border-soft bg-bg/90 hover:text-text focus-visible:outline-2 focus-visible:outline-accent",onCopyError:()=>s("Could not copy to the clipboard. Try again.")}):null,O(He,{error:o,onDismiss:()=>s(null)})]})},"QuestionPre"),dn=i(e=>ht(W).link(e),"QuestionLink"),cn={a:dn,pre:ln},Me=i(({text:e})=>{let[t,n]=kt(!1),r=ht(W);return Oe("div",{className:"md min-w-0 select-text whitespace-normal break-words [&_pre]:max-h-40 [&_pre]:overflow-auto [&_pre]:overscroll-contain",children:[t?r.original(e):O(rn,{remarkPlugins:an,allowedElements:["p","em","strong","del","code","pre","a","br","ul","ol","li","blockquote"],unwrapDisallowed:!0,components:cn,children:e.length<=32768?e:e.slice(0,32768)}),e.length>32768?Oe("span",{className:"block text-muted",children:["Preview limited to 32,768 characters."," ",O("button",{type:"button",className:"text-accent underline",onClick:()=>n(!t),children:t?"Formatted preview":"Full original text"})]}):null]})},"QuestionMarkdown");import{jsx as q,jsxs as G}from"react/jsx-runtime";var fn=i(({text:e})=>{let[t,n]=un(!1),r=pn(W);return e.length<=1e3?q("span",{className:"whitespace-pre-wrap break-words text-text",children:e}):G("details",{open:t,onToggle:o=>n(o.currentTarget.open),className:"min-w-0",children:[G("summary",{className:"cursor-pointer whitespace-pre-wrap break-words",children:[e.slice(0,500),"\u2026 (full submitted answer)"]}),t?r.original(e):null]})},"AnswerValue"),Pe=i(({record:e})=>G("div",{className:"min-w-0 rounded-lg border border-border-soft px-3 py-2 text-xs",children:[G("p",{className:"mb-1 text-muted",children:[e.provider," \xB7"," ",e.decision==="cancel"?"question cancelled":`answer submitted${e.decision?` \xB7 ${e.decision}`:""}`]}),e.questions.map(t=>G("div",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-1 py-1",children:[q("div",{className:"min-w-0 text-muted",children:q(Me,{text:t.question})}),q("span",{"aria-hidden":"true",children:"\u2192"}),q(fn,{text:t.redacted?"[redacted]":t.values.length?(t.labels??t.values).join(", "):e.decision??"No answer supplied"})]},t.id))]}),"QuestionAnswerRecord");import{Waypoints as mn}from"lucide-react";import{Fragment as ie,useMemo as se,useState as gn}from"react";function Tt(e,t){return e.startsWith(`${t.slice(0,80)||"prompt"}-retry`)}i(Tt,"isRetryOf");function Fe(e){let t=new Set,n=new Map,r=new Set;for(let o of e){if(o.role!=="user"||t.has(o.id))continue;let s=n.get(o.text)??[];s.some(a=>Tt(o.id,a))&&r.add(o.id),s.push(o.id),n.set(o.text,s),t.add(o.id)}return r}i(Fe,"automaticResendIds");import{Fragment as hn,jsx as d,jsxs as f}from"react/jsx-runtime";var Le=i(({ts:e,clock:t,align:n})=>d("span",{className:R("text-[11px] text-faint",n==="right"?"pr-1 text-right":"pl-1"),children:ee(e,t)}),"RowTime"),xn=i(({e})=>{if(e.error&&!e.tool)return f("details",{className:"overflow-hidden rounded-xl border border-del/30 bg-del/5 px-3 py-2",children:[d("summary",{className:"cursor-pointer text-del text-xs",children:"Failed tool output"}),d("pre",{className:"mt-2 whitespace-pre-wrap font-mono text-[11.5px] leading-relaxed [overflow-wrap:anywhere]",children:e.text})]});let t=e.detail!==e.text?e.detail:void 0,n=K(e),r=Y(e),{title:o,server:s}=ne(e),a=e.error?d("span",{className:"ml-auto shrink-0 text-[11px] text-del",children:"failed"}):e.aborted?d("span",{className:"ml-auto shrink-0 text-[11px] text-faint",children:"aborted"}):null;return!t&&!e.output&&!e.images?.length&&!e.outputTruncated?f("div",{className:"flex min-w-0 items-baseline gap-2 overflow-hidden whitespace-nowrap rounded-xl border border-border-soft bg-surface/60 px-3 py-1.5",children:[d("span",{className:"shrink-0 font-mono text-[11px] text-faint",children:"\xB7"}),d("span",{title:o,className:"max-w-full truncate text-[12.5px] text-muted",children:o}),s?f("span",{className:"shrink-0 text-[11px] text-faint",children:["\xB7 ",s]}):null,a]}):f("details",{className:R("min-w-0 overflow-clip rounded-xl border",e.error?"border-del/30 bg-del/5":"border-border-soft bg-surface/60"),children:[f("summary",{className:"flex cursor-pointer select-none list-none items-baseline gap-2 overflow-hidden whitespace-nowrap px-3 py-1.5 [&::-webkit-details-marker]:hidden",children:[d("span",{className:"shrink-0 font-mono text-[11px] text-faint",children:"\u25B8"}),d("span",{title:o,className:"max-w-full truncate text-[12.5px] text-muted",children:o}),s?f("span",{className:"shrink-0 text-[11px] text-faint",children:["\xB7 ",s]}):null,t?d("span",{title:t,className:"min-w-0 flex-1 truncate font-mono text-[11px] text-faint",children:t}):null,a]}),f("div",{className:"flex min-w-0 flex-col gap-2 px-3 py-2",children:[t?d("pre",{className:"whitespace-pre-wrap font-mono text-[11.5px] text-muted leading-relaxed [overflow-wrap:anywhere]",children:t}):null,e.output?f("div",{className:R("min-w-0",t&&"border-border-soft border-t pt-2"),children:[d(D,{as:"div",className:"mb-1",children:e.error?"error":e.aborted?"aborted":e.diff?"changes":"output"}),d("pre",{className:"whitespace-pre-wrap font-mono text-[11.5px] leading-relaxed [overflow-wrap:anywhere]",children:e.output})]}):null,n?f("p",{className:"text-[11px] text-faint",children:["Sign-in required for ",n.servers.join(", "),"."]}):null,r?d("p",{className:"text-[11px] text-faint",children:"Browser sign-in requested."}):null,e.outputTruncated?f("p",{className:"text-[11px] text-faint tabular-nums",children:["Output truncated.",e.outputOriginalBytes?` Original size: ${e.outputOriginalBytes.toLocaleString()} bytes.`:null]}):null,e.images?.length?f("p",{className:"text-[11px] text-faint",children:[e.images.length," image",e.images.length===1?"":"s"," (not shown in preview)"]}):null]})]})},"ReadonlyToolRow"),yn=i(({result:e})=>f("details",{className:R("min-w-0 overflow-clip rounded-xl border",e.tone==="failed"?"border-del/30 bg-del/5":"border-border-soft bg-surface/60"),children:[f("summary",{className:"flex cursor-pointer select-none list-none items-baseline gap-2 overflow-hidden whitespace-nowrap px-3 py-1.5 [&::-webkit-details-marker]:hidden",children:[d("span",{className:"shrink-0 font-mono text-[11px] text-faint",children:"\u25B8"}),d("span",{className:"shrink-0 text-[12.5px] text-muted",children:e.label}),d("span",{title:e.description,className:"min-w-0 flex-1 truncate text-[11px] text-faint",children:e.description})]}),d("pre",{className:"whitespace-pre-wrap px-3 py-2 font-mono text-[11.5px] text-muted leading-relaxed [overflow-wrap:anywhere]",children:e.output})]}),"ReadonlyBackgroundEnd"),Rt=i(({tool:e,nodes:t,renderNode:n})=>{let r=t.map(({e:s})=>re(s)).join(", "),o=x(e).label;return f("details",{className:"min-w-0 overflow-clip rounded-xl border border-border-soft bg-surface/40",children:[f("summary",{className:"flex cursor-pointer select-none list-none items-baseline gap-2 overflow-hidden whitespace-nowrap px-3 py-1.5 [&::-webkit-details-marker]:hidden",children:[d("span",{className:"shrink-0 font-mono text-[11px] text-faint",children:"\u25B8"}),f("span",{className:"shrink-0 text-[12.5px] text-muted",children:[o," \xD7",t.length]}),d("span",{title:t.map(({e:s})=>re(s,!0)).join(", "),className:"min-w-0 flex-1 truncate font-mono text-[11px] text-faint",children:r})]}),d("div",{className:"flex min-w-0 flex-col gap-2.5 px-2 py-2.5",children:t.map(s=>d(ie,{children:n(s)},I(s.e)))})]})},"ReadonlyBatch"),wn=i(({row:e,grouping:t,renderRows:n,renderNode:r})=>{let[o,s]=gn(!1),{label:a,aborted:l,kept:p}=Ne(e.nodes,e.startedAt,e.reply.ts);return d(Be,{label:a,aborted:l,open:o,onToggle:u=>s(u.currentTarget.open),work:()=>n(B(e.nodes,t)),kept:()=>p.map(u=>d(ie,{children:r(u)},I(u.e)))})},"ReadonlyTurnWork"),bn=i(({entries:e,grouping:t="all",completedTurns:n="final",stepsSummary:r="all",clock:o=null,onOpenFile:s,filePaths:a,images:l,onSelectSubagent:p,className:u})=>{let w=se(()=>Qe({onOpenFile:s,filePaths:a,images:l}),[s,a,l]),m=se(()=>Q(e),[e]),S=se(()=>Ee(m,t,{completedTurns:n}),[m,t,n]),h=t==="tools",k=se(()=>Fe(e),[e]),N=i((g,ae)=>{let{e:c}=g,M=Te(c,ae?.e,k);if(c.subagentLabel){let P=f(hn,{children:[d(mn,{size:14,strokeWidth:1.7,className:"shrink-0 text-faint","aria-hidden":!0}),d("span",{className:"shrink-0 font-medium text-text",children:"Agent"}),d("span",{title:c.subagentLabel,className:"min-w-0 flex-1 truncate text-[11.5px] text-muted",children:c.subagentLabel}),c.error?d("span",{className:"shrink-0 text-[11px] text-del",children:"failed"}):null,c.toolUseId&&p?d("span",{className:"shrink-0 text-[11px] text-faint",children:"Open"}):null]});return d("section",{className:"min-w-0 px-0.5","data-subagent":c.subagentLabel,children:c.toolUseId&&p?d("button",{type:"button",onClick:()=>p(c.toolUseId??null),"aria-label":`Open agent ${c.subagentLabel}`,className:"flex w-full min-w-0 items-center gap-2 rounded-lg py-1 text-left text-[12.5px] transition active:bg-surface-2",children:P}):d("div",{className:"flex min-w-0 items-center gap-2 py-1 text-[12.5px]",children:P})})}if(c.questionAnswer?.evidence==="submitted")return d(Pe,{record:c.questionAnswer});if(c.role==="user"){if(k.has(c.id))return d(ve,{id:c.id,state:c.queued?"queued":void 0});if(b(c)){let P=pe(c.text);return d(_e,{notice:P,markdown:St=>d(_,{components:w,children:St}),report:P.report?d(_,{components:w,children:P.report}):null,time:d("span",{className:"pr-1 text-[11px] text-faint",children:ee(c.ts,o)})})}return c.origin==="agent"||c.parentToolUseId||j(c)?f("div",{className:"flex flex-col items-end gap-0.5","data-automation":c.id,children:[d(Ae,{label:c.parentToolUseId?"Assignment":"Automation",children:d("div",{className:"text-[13px] text-muted leading-relaxed",children:d(_,{components:w,children:c.text})})}),M?null:d(Le,{ts:c.ts,clock:o,align:"right"})]}):f("div",{className:"flex flex-col items-end gap-0.5","data-user-msg":Z(c.text),"data-msg-ts":c.ts,children:[d(Ie,{queued:c.queued,children:d(_,{components:w,children:c.text})}),M?null:d(Le,{ts:c.ts,clock:o,align:"right"})]})}if(c.role==="tool")return d(xn,{e:c});if(c.role==="thinking"&&!h)return f("details",{className:"min-w-0 overflow-clip rounded-xl border border-border-soft bg-surface/60",children:[f("summary",{className:"flex cursor-pointer select-none list-none items-baseline gap-2 overflow-hidden whitespace-nowrap px-3 py-1.5 [&::-webkit-details-marker]:hidden",children:[d("span",{className:"shrink-0 font-mono text-[11px] text-faint",children:"\u25B8"}),d("span",{className:"shrink-0 text-[12.5px] text-muted",children:"Thinking"}),d("span",{title:c.text,className:"min-w-0 flex-1 truncate text-[11px] text-faint",children:Z(c.text)})]}),d("div",{className:"px-3 py-2 text-[13px] text-muted italic leading-relaxed",children:d(oe,{children:d(_,{components:w,children:c.text})})})]});let E=$(c);return E?d(yn,{result:E}):c.role==="system"?d(Ce,{children:c.text}):f("div",{className:"flex flex-col items-start gap-0.5 max-md:items-stretch",children:[d(oe,{children:d(_,{components:w,children:c.text})}),M?null:d(Le,{ts:c.ts,clock:o,align:"left"})]})},"renderNode"),C=i((g,ae,c)=>{if(g.kind==="work")return d(wn,{row:g,grouping:t,renderRows:E=>E.map(C),renderNode:N},g.key);if(g.kind==="steps")return f("details",{className:"min-w-0 overflow-clip rounded-xl border border-border-soft bg-surface/40",children:[f("summary",{className:"flex cursor-pointer select-none list-none items-baseline gap-2 overflow-hidden whitespace-nowrap px-3 py-1.5 [&::-webkit-details-marker]:hidden",children:[d("span",{className:"shrink-0 font-mono text-[11px] text-faint",children:"\u25B8"}),f("span",{className:"shrink-0 text-[12.5px] text-muted",children:[g.nodes.length," steps"]}),d("span",{title:te(g.nodes,r),className:"min-w-0 flex-1 truncate text-[11px] text-faint",children:te(g.nodes,r)})]}),d("div",{className:"flex min-w-0 flex-col gap-2.5 px-2 py-2.5",children:U(g.nodes).map(E=>E.kind==="batch"?d(Rt,{tool:E.tool,nodes:E.nodes,renderNode:N},E.key):d(ie,{children:N(E.node)},E.key))})]},g.key);if(g.kind==="batch")return d(Rt,{tool:g.tool,nodes:g.nodes,renderNode:N},g.key);let M=c[ae+1];return d(ie,{children:N(g.node,M?.kind==="entry"?M.node:void 0)},g.key)},"renderRow");return d("div",{className:R("farero-ui flex min-w-0 flex-col gap-2.5 text-text",u),children:S.map(C)})},"ReadOnlyTranscript");export{Vt as ACTIVITY_LAYOUTS,Xe as ATTACHED_REPORTS_HEADER,oe as AssistantBody,ve as AutomaticResend,Ae as AutomationCard,z as Bubble,zt as COMPLETED_TURNS,_e as DelegationReturnBody,Kt as GROUP_PREVIEWS,Pe as QuestionAnswerRecord,W as QuestionContent,Me as QuestionMarkdown,bn as ReadOnlyTranscript,Ot as STICKY_TOP,Ce as SystemLine,Be as TurnWorkFold,Ie as UserBody,Fe as automaticResendIds,$ as backgroundEnd,U as batchLookups,Y as browserSignInOf,ft as clockFields,Wt as clockSeconds,X as clockTime,Te as continuesMessageMinute,mt as dateStamp,qt as dateTime,be as elapsed,Ee as foldTurns,Yt as groupPreviewAvailable,B as groupSteps,ut as handoffRequestOf,We as isAgentAuthored,j as isAutomaticRetryEntry,b as isDelegationReturnEntry,Tt as isRetryOf,A as isTurnPrompt,Ke as isWorkflowReport,Bt as latestTurnActionEnd,re as lookupLabel,K as mcpSignInOf,Z as messagePreview,ee as messageTime,pe as parseDelegationReturn,J as personCard,Se as repliesBeforeWakes,I as rowKey,pt as savedSignInOf,ke as shellLookup,At as splitAttachedReports,F as staysVisible,te as stepSummary,ne as stepTitle,Ve as transcriptSubagents,Q as transcriptTree,ze as turnActionEnds,ce as turnDelegationCount,ue as turnOrigin,et as turnOrigins,Ne as turnWorkLine,Nt as workflowReportPromptIds};
|