thursday-agent 0.1.1 → 0.1.2
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/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +3 -3
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +1 -1
- package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/artifact/[...path]/page/server-reference-manifest.json +1 -1
- package/.next/server/app/artifact/[...path]/page.js.nft.json +1 -1
- package/.next/server/app/artifact/[...path]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/page/server-reference-manifest.json +41 -41
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/chunks/ssr/{[root-of-the-server]__1e-f3gy._.js → [root-of-the-server]__01id-v3._.js} +2 -2
- package/.next/server/chunks/ssr/[root-of-the-server]__0dfwvr4._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__1-mnhyd._.js +1 -1
- package/.next/server/chunks/ssr/{[root-of-the-server]__1ncajna._.js → [root-of-the-server]__185grso._.js} +2 -2
- package/.next/server/chunks/ssr/_077-g6s._.js +1 -1
- package/.next/server/chunks/ssr/_0ay6b01._.js +1 -1
- package/.next/server/chunks/ssr/{_1aca4j8._.js → _0j4v8of._.js} +2 -2
- package/.next/server/chunks/ssr/{_1m5popy._.js → _0l81bzy._.js} +2 -2
- package/.next/server/chunks/ssr/{_1r2_qk-._.js → _0lc_7c8._.js} +2 -2
- package/.next/server/chunks/ssr/_0nso8tp._.js +3 -0
- package/.next/server/chunks/ssr/{_1b3yex3._.js → _0q_2f2x._.js} +2 -2
- package/.next/server/chunks/ssr/_0sf1isi._.js +1 -1
- package/.next/server/chunks/ssr/{_124q1la._.js → _10uvw3l._.js} +2 -2
- package/.next/server/chunks/ssr/{_1hkvsg0._.js → _19_o9d-._.js} +2 -2
- package/.next/server/chunks/ssr/{_1dnxp2k._.js → _1dcxzqe._.js} +2 -2
- package/.next/server/chunks/ssr/_1e-dgz0._.js +1 -1
- package/.next/server/chunks/ssr/_1jbv7m1._.js +3 -0
- package/.next/server/chunks/ssr/features_bot_components_bot-setting_tsx_01ajft6._.js +1 -1
- package/.next/server/chunks/ssr/features_config_components_14jqgy4._.js +1 -1
- package/.next/server/chunks/ssr/features_config_components_config-setting_tsx_0xfwqdg._.js +1 -1
- package/.next/server/chunks/ssr/features_connectors_components_mcp-setting_tsx_0jmbgvp._.js +1 -1
- package/.next/server/chunks/ssr/features_memory_components_memory-setting_tsx_0oa43sw._.js +1 -1
- package/.next/server/chunks/ssr/{node_modules_1_w_b81._.js → node_modules_00d6675._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1854ebs._.js → node_modules_043-236._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1mnmhse._.js → node_modules_06kvvuo._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_17ls31t._.js → node_modules_0_fvxnt._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0eqdzva._.js → node_modules_0_j7-g4._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1yxkq1s._.js → node_modules_0bue6gy._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1kj6swe._.js → node_modules_0fbw5-u._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1euv75v._.js → node_modules_0ipn1ho._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_00riwzq._.js → node_modules_0ls96je._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0i37h34._.js → node_modules_0xwx4u-._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0nq_p-o._.js → node_modules_0y2-av4._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1wsx1pg._.js → node_modules_108wd2o._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_01jj5oy._.js → node_modules_13f2md6._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_03f-6up._.js → node_modules_16i4o_3._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_14uxpfb._.js → node_modules_1_588_4._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0sbobpz._.js → node_modules_1d-is1o._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0xe_k12._.js → node_modules_1ee8gav._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_012m-mo._.js → node_modules_1hn_sd5._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0ewynyi._.js → node_modules_1jatz7w._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1bjm3ch._.js → node_modules_1k29j1j._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1y1m-q4._.js → node_modules_1nhw9qg._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1fsvm8f._.js → node_modules_1t0y5jt._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0nh2m35._.js → node_modules_1ub40gk._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_17c71fz._.js → node_modules_1v0077l._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_07_oxjr._.js → node_modules_1y8_3vg._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0egn4iq._.js → node_modules_20ynonm._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1f5re6n._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_092s8nx._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_216aa7f._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1nvexgu._.js} +1 -1
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +42 -42
- package/.next/static/chunks/{35uo6rtl_otbd.js → 0yysv1gzin17t.js} +1 -1
- package/.next/static/chunks/{0yn2yol46cj77.js → 1fr5m75pwtyic.js} +1 -1
- package/.next/static/chunks/{0h7pjyewk7ky-.js → 1gy3bbv7usnjo.js} +1 -1
- package/.next/static/chunks/{1lpdcqos7mkek.js → 1keib_gt066gc.js} +1 -1
- package/.next/static/chunks/{2qci2z603es_m.js → 1khakdu_iuedc.js} +1 -1
- package/.next/static/chunks/{2kl3n2d-4-7i5.js → 21rk8w7bda-su.js} +1 -1
- package/.next/static/chunks/{261871a8ot1pi.js → 247d-r95j8xs0.js} +1 -1
- package/.next/static/chunks/{1u5d-pvhwir9g.js → 28g42tw8tsvhd.js} +1 -1
- package/.next/static/chunks/{2ka9uwo_evj7a.js → 2fq_86jvq9ymq.js} +1 -1
- package/.next/static/chunks/{3yan6-5cvpk2o.js → 2ihkf6l2jowo9.js} +3 -3
- package/.next/static/chunks/{0g2n0xskvyk04.js → 2wngeetfnzxkp.js} +1 -1
- package/.next/static/chunks/{1rja48de93vvx.js → 3aquirz5h71da.js} +1 -1
- package/.next/static/chunks/{14s7e14xltx47.js → 3fqvc0cg-atq_.js} +1 -1
- package/.next/static/chunks/{3w7-y53xzl2ir.js → 3p4egvfjxpatb.js} +1 -1
- package/.next/static/chunks/3qe1w1ei-huhl.js +1 -0
- package/.next/static/chunks/{34eu8t79ko6lm.js → 3xxa2j56-f3nm.js} +1 -1
- package/.next/static/chunks/{0_6qjj4f3t3j-.js → 3y40riycdip-i.js} +1 -1
- package/.next/static/chunks/{2v_vqhmdl8de_.js → 45a6zbtkelph9.js} +1 -1
- package/README.md +24 -1
- package/bin/thursday.mjs +50 -2
- package/package.json +1 -1
- package/.next/server/chunks/ssr/_19eoufz._.js +0 -3
- package/.next/server/chunks/ssr/_1cb_5sv._.js +0 -3
- package/.next/static/chunks/2cgzsjzheo2m2.js +0 -1
- /package/.next/static/{G-9_HnysmzY_Bx9GpDYAO → X34BUd9bfdH27ripuwwBm}/_buildManifest.js +0 -0
- /package/.next/static/{G-9_HnysmzY_Bx9GpDYAO → X34BUd9bfdH27ripuwwBm}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{G-9_HnysmzY_Bx9GpDYAO → X34BUd9bfdH27ripuwwBm}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,279265,240829,206721,e=>{"use strict";var t=e.i(843476),n=e.i(96892),s=e.i(689664),a=e.i(24071),o=e.i(867927),r=e.i(931619),i=e.i(508734),l=e.i(779266),d=e.i(632781),u=e.i(77071),c=e.i(263676),m=e.i(271645),x=e.i(798120),p=e.i(815731),f=e.i(167881),h=e.i(496336),b=e.i(683408),g=e.i(660302),k=e.i(184762),v=e.i(6799),j=e.i(41533),y=e.i(178378),N=e.i(104194),w=e.i(451888),C=e.i(635963),T=e.i(835878),z=e.i(764224),S=e.i(919191),A=e.i(929272),M=e.i(176975),B=e.i(480263);let _=[],R=!1,I=new Set,E={sync(e,t){for(let n of(R=!0,_=[...e].reverse().map(e=>$(e,t)).slice(-30),I))n()},primed:()=>R};function $(e,t){let n=e=>({name:e,icon:t?.find(t=>t.name===e)?.icon??null}),s=n(e.bot),a=[],o=new Map,r=new Map;for(let t of e.lines){let e=t.bot?n(t.bot):s,i=t.parent&&r.get(t.parent)?.name?s:null;switch(t.kind){case"user":a.push({id:t.id,bot:s,to:null,text:t.text,kind:"user"});break;case"text":a.push({id:t.id,bot:e,to:i,text:t.text,kind:"say"});break;case"note":a.push({id:t.id,bot:e,to:i,text:t.text,kind:"note"});break;case"tool":o.set(t.callId,a.length),a.push({id:t.id,bot:e,to:i,text:t.note??t.input,kind:"tool",tool:{name:t.name,input:t.input,note:t.note,path:t.path,callId:t.callId}});break;case"tool-result":{let e=o.get(t.callId),n=void 0===e?void 0:a[e];n?.tool&&void 0!==e&&(a[e]={...n,tool:{...n.tool,results:t.results,more:t.more}});break}case"ask":{let s=n(t.to);r.set(t.callId,s),a.push({id:t.id,bot:e,to:s,text:t.text,kind:"ask"});break}case"ask-result":{let n=r.get(t.callId);n&&t.text&&a.push({id:t.id,bot:n,to:e,text:t.text,kind:"ask"});break}case"waiting":a.push({id:t.id,bot:e,to:null,text:t.question,kind:"result",options:t.options})}}if("failed"===e.status&&e.outcome)a.push({id:`${e.id}-end`,bot:s,to:null,text:e.outcome,kind:"error"});else if("done"===e.status||"waiting"===e.status){let t=a.at(-1);t&&"say"===t.kind&&t.text===e.outcome&&(a[a.length-1]={...t,kind:"result"})}return{id:e.id,request:e.request,label:e.label,bot:s,lines:a,status:"running"===e.status?"working":e.status,outcome:e.outcome,ask:e.ask,relayed:e.reported,tokens:e.tokens,contextTokens:e.contextTokens,contextBudget:e.contextBudget,updatedAt:e.updatedAt}}function q(e){for(let t=e.lines.length-1;t>=0;t--){let n=e.lines[t];if("user"!==n.kind&&"note"!==n.kind)return n}return null}let K=new Map,F={get:e=>K.get(e)??"",set(e,t){t?K.set(e,t):K.delete(e)},typing:e=>(K.get(e)?.trim().length??0)>0},L=new Set,O={announce(e){for(let t of L)t(e)},subscribe:e=>(L.add(e),()=>{L.delete(e)})},U=[];function D(){return(0,m.useSyncExternalStore)(e=>(I.add(e),()=>I.delete(e)),()=>_,()=>U)}let P=e=>"result"===e.kind||"error"===e.kind;function H(e){let t=[e.bot];for(let n of e.lines)t.some(e=>e.name===n.bot.name)||t.push(n.bot);return t}function V(e){let t=new Set([e.bot.name]),n=[];for(let s of function(e){let t=[];for(let n of e){let e=t.at(-1);if(e&&e.bot.name===n.bot.name&&e.to?.name===n.to?.name&&"user"===e.lines[0].kind==("user"===n.kind)){e.lines.push(n);continue}t.push({key:n.id,bot:n.bot,to:n.to,lines:[n]})}return t}(e.lines))s.to&&!t.has(s.to.name)&&(t.add(s.to.name),n.push({kind:"invite",key:`${s.key}-joins`,from:s.bot,to:s.to})),t.add(s.bot.name),n.push({kind:"group",key:s.key,group:s});return n}function W(e){let t=new Map;for(let n of e)for(let e of(t.has(n.bot.name)||t.set(n.bot.name,{bot:n.bot,task:n,line:null,open:0}),n.lines))"user"!==e.kind&&"note"!==e.kind&&t.set(e.bot.name,{bot:e.bot,task:n,line:e,open:t.get(e.bot.name)?.open??0});for(let n of e){if("working"!==n.status)continue;let e=t.get(n.bot.name);e&&(e.open+=1)}return[...t.values()]}e.s(["botTasks",0,E,"isOutcome",0,P,"lastSaid",0,q,"latestPerBot",0,W,"rosterOf",0,H,"screenActs",0,O,"taskDrafts",0,F,"taskFromRow",0,$,"threadItems",0,V,"useBotTasks",0,D],240829);var G=e.i(609856),X=e.i(283653),J=e.i(647163);function Y({task:e,status:s,lines:a=[],className:o}){let[i,l]=(0,m.useState)(()=>F.get(e.id));(0,m.useEffect)(()=>l(F.get(e.id)),[e.id]);let u=t=>{l(t),F.set(e.id,t)},[p,b]=Q(),[v,y]=(0,G.useServerAction)(B.cancelTaskAction,{onOk:e=>{(0,X.revalidate)(x.queryKey.tasks),O.announce({kind:"stopped",id:e.id,label:e.label})}}),N=b||y,[C,T]=(0,m.useState)(!1),[z,M]=(0,m.useState)(null);(0,m.useEffect)(()=>{T(!1),M(null)},[e.id]),(0,m.useEffect)(()=>{"running"!==s&&M(null)},[s]),(0,m.useEffect)(()=>{z&&a.some(e=>"user"===e.kind&&e.text===z)&&M(null)},[a,z]);let _=async t=>{!N&&await p(e,t)&&(u(""),"running"===s&&(M(t.trim()),T(!1)))},R="waiting"===s?e.ask:null,I=(0,w.isBudgetAsk)(R),E=R?R.options.length?"Or put it another way…":"Your answer":"running"===s?`What's off? ${e.bot} reads this before its next step`:"Anything more? It picks up where it left off",$=(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault(),_(i)},className:"flex items-end gap-1 rounded-2xl bg-background py-1.5 pr-1.5 pl-3.5 ring-1 ring-border/80 transition-shadow focus-within:ring-ring/60",children:[(0,t.jsx)(k.Textarea,{value:i,rows:1,disabled:N,autoFocus:"running"===s,onChange:e=>u(e.target.value),onKeyDown:e=>{"Escape"===e.key&&"running"===s?T(!1):"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||229===e.keyCode||(e.preventDefault(),_(i))},placeholder:E,"aria-label":`Message for ${e.label}`,className:"max-h-32 min-h-0 flex-1 resize-none border-0 bg-transparent px-0 py-1 text-[13px] leading-5 shadow-none focus-visible:ring-0 dark:bg-transparent"}),"running"===s&&(0,t.jsx)(f.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:N,onClick:()=>T(!1),"aria-label":"Never mind",className:"text-muted-foreground",children:(0,t.jsx)(c.X,{})}),(0,t.jsx)(f.Button,{type:"submit",size:"icon-sm",variant:i.trim()?"default":"ghost",disabled:!i.trim()||N,"aria-label":"Send",className:"rounded-full",children:b?(0,t.jsx)(d.Loader2,{className:"animate-spin"}):(0,t.jsx)(n.ArrowUp,{})})]});return"running"!==s||C?R?(0,t.jsxs)("div",{className:(0,J.cn)("space-y-2.5 rounded-2xl px-3.5 py-3 ring-1",I?"bg-muted/40 ring-border/50":"bg-amber-500/8 ring-amber-500/25",o),children:[(0,t.jsxs)("p",{className:"flex items-center gap-1.5 font-mono text-[10px] text-muted-foreground",children:[(0,t.jsx)("span",{className:"shrink-0",children:"To"}),(0,t.jsx)("span",{className:"truncate text-foreground",children:e.bot}),(0,t.jsx)("span",{className:"shrink-0 text-muted-foreground/50",children:"·"}),(0,t.jsx)("span",{className:"truncate",children:e.label})]}),R.question&&(0,t.jsx)(h.FoldedText,{text:R.question,subject:"message",clamp:"line-clamp-6",tall:"max-h-56"}),R.options.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:R.options.map(e=>(0,t.jsxs)(f.Button,{size:"sm",variant:"outline",disabled:N,onClick:()=>_(e),className:"h-7 gap-1.5 rounded-full bg-background px-3 text-[12px]",children:[I&&e===w.TASK_CONTINUE&&(0,t.jsx)(r.ChevronsRight,{className:"size-3.5 text-muted-foreground"}),e,I&&e===w.TASK_CONTINUE&&(0,t.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground",children:["+",j.BOT_RUN.steps," steps"]})]},e))}),$,(0,t.jsx)("button",{type:"button",disabled:N,onClick:()=>v(e.id),className:"font-mono text-[10px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50",children:"Stop this task instead"})]}):(0,t.jsx)("div",{className:o,children:$}):(0,t.jsxs)("div",{className:(0,J.cn)("flex items-center gap-2 rounded-2xl bg-muted/40 py-1.5 pr-1.5 pl-3.5 ring-1 ring-border/50",o),children:[z?(0,t.jsxs)("p",{className:"flex min-w-0 flex-1 items-center gap-2 text-[12.5px] leading-5 text-muted-foreground",children:[(0,t.jsx)(d.Loader2,{className:"size-3 shrink-0 animate-spin"}),(0,t.jsx)("span",{className:"shrink-0",children:"Before its next step:"}),(0,t.jsx)(g.default,{text:z,speed:2.2,color:"var(--muted-foreground)",shineColor:"var(--foreground)",className:"min-w-0 truncate"})]}):(0,t.jsx)(g.default,{text:`${e.bot} is on it — Thursday steers it by voice.`,speed:2.4,color:"var(--muted-foreground)",shineColor:"var(--foreground)",className:"min-w-0 flex-1 truncate text-[12.5px] leading-5 break-keep"}),(0,t.jsxs)(f.Button,{type:"button",size:"sm",variant:"ghost",disabled:N,onClick:()=>T(!0),className:"h-7 shrink-0 gap-1.5 rounded-full px-2.5 text-[12px]",children:[(0,t.jsx)(S.CornerDownLeft,{className:"size-3.5"}),"Step in"]}),(0,t.jsx)("span",{className:"h-4 w-px shrink-0 bg-border"}),(0,t.jsx)(f.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:N,onClick:()=>v(e.id),"aria-label":"Stop this task",className:"shrink-0 text-muted-foreground/60 hover:text-foreground",children:y?(0,t.jsx)(d.Loader2,{className:"animate-spin"}):(0,t.jsx)(A.Square,{className:"size-3"})})]})}function Q(){let[e,t]=(0,G.useServerAction)(M.answerTaskAction,{onOk:()=>(0,X.revalidate)(x.queryKey.tasks)});return[async(t,n)=>{let s=n.trim();if(!s)return!1;try{let n=await e(t.id,s);return O.announce({kind:"answered",id:n.id,label:n.label,answer:s}),!0}catch{return!1}},t]}e.s(["TaskReply",0,Y,"useAnswerTask",0,Q],206721);var Z=e.i(989409),ee=e.i(621285),et=e.i(245629),en=e.i(393080),es=e.i(864723),ea=e.i(222055);let eo=(0,m.memo)(function(){let e=D(),{data:n}=(0,X.useServerRoute)(x.queryKey.bot),[s,a]=(0,m.useState)(!1),[o,r]=(0,m.useState)(null),[i,l]=(0,m.useState)(!1),d=[...e].reverse(),u=o?d.find(e=>e.id===o)??null:null,[c,p]=function(){let[e,t]=(0,m.useState)(null),n=(0,m.useRef)([]),s=(0,m.useRef)(!1),a=(0,m.useRef)([]);(0,m.useEffect)(()=>()=>{for(let e of a.current)clearTimeout(e)},[]);let o=(0,m.useRef)(()=>{});return o.current=()=>{if(s.current)return;let e=n.current.shift();e&&(s.current=!0,t(e),a.current.push(setTimeout(()=>{t(null),a.current.push(setTimeout(()=>{s.current=!1,o.current()},260))},3e3)))},[e,(0,m.useCallback)(e=>{let t=n.current.findIndex(t=>t.bot===e.bot);t>=0?n.current[t]=e:n.current.push(e),o.current()},[])]}(),f=(0,m.useRef)(null),h=(0,m.useRef)(new Map);(0,m.useEffect)(()=>{if(!E.primed())return;let t=new Map(d.map(e=>[e.id,e.status])),n=f.current;f.current=t;let s=new Map;for(let t of W(e))t.line&&s.set(t.bot.name,t.line.id);let a=h.current;if(h.current=s,n){for(let t of W(e)){if("working"!==t.task.status)continue;let e=t.line?.id;e&&a.get(t.bot.name)!==e&&p({bot:t.bot.name,label:t.task.label,what:eT(t.task).text,live:!0})}for(let e of d){let t=n.get(e.id);t!==e.status&&(void 0===t&&"working"!==e.status&&e.relayed||p({bot:e.bot.name,label:e.label,...function(e,t){let n=e.bot.name;return"working"===e.status?{what:t?`${n} took this on`:`${n} picked it back up`,live:!0}:"waiting"===e.status?(0,w.isBudgetAsk)(e.ask)?{what:`${n} is out of steps`}:{what:`${n} is asking`,tone:J.WAITING_INK}:"failed"===e.status?{what:`${n} could not finish`,tone:"text-destructive"}:{what:`${n} finished`}}(e,void 0===t)}))}}},[e,p]);let b=(0,m.useRef)(new Set);(0,m.useEffect)(()=>{if(!u||u.relayed||"done"!==u.status&&"failed"!==u.status)return;let e=`${u.id}@${(0,et.toDate)(u.updatedAt).getTime()}`;b.current.has(e)||(b.current.add(e),(0,y.markReportedAction)([u.id]).then(en.unwrapResult).then(()=>(0,X.revalidate)(x.queryKey.tasks)).catch(t=>{b.current.delete(e),v.toast.add({type:"error",title:"Could not mark the task as read",description:(0,J.errorToString)(t)})}))},[u]);let g=e.filter(e=>"working"===e.status).length,k=d.filter(er),j=k.length,N=k.map(e=>e.bot).filter((e,t,n)=>n.findIndex(t=>t.name===e.name)===t),C=(0,m.useCallback)(()=>l(!1),[]);return(0,t.jsx)("div",{className:"pointer-events-none absolute right-5 bottom-5 z-10 flex w-132 max-w-[calc(100vw-2.5rem)] flex-col items-end gap-2",children:s?(0,t.jsx)("div",{className:"pointer-events-auto flex max-h-[min(44rem,78vh)] w-full animate-in flex-col overflow-hidden rounded-3xl bg-background/75 shadow-2xl shadow-black/6 ring-1 ring-border/50 backdrop-blur-xl fade-in slide-in-from-bottom-1 duration-200",children:u?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eh,{task:u,onBack:()=>r(null),onClose:()=>a(!1)}),(0,t.jsx)(ez,{task:u,className:"min-h-0 flex-1"}),(0,t.jsx)(Y,{task:{id:u.id,label:u.label,bot:u.bot.name,ask:function(e){if(!e.ask?.question)return e.ask;let t=e.lines.at(-1);return t&&P(t)&&t.text===e.ask.question?{...e.ask,question:""}:e.ask}(u)},status:"working"===u.status?"running":u.status,lines:u.lines,className:"mx-3 mb-2 shrink-0"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ef,{count:e.length,pending:j,composing:i,onCompose:()=>l(!0),onClose:()=>i?l(!1):a(!1)}),i?(0,t.jsx)(ec,{bots:n,onDone:C}):d.length?(0,t.jsx)(ew,{tasks:d,onPick:r}):(0,t.jsx)(ej,{bots:n}),!i&&(0,t.jsx)(ey,{})]})}):(0,t.jsx)(ei,{bots:n,rows:k,waiting:N,count:e.length,busy:g,pending:j,beat:c,composing:i,onCompose:()=>l(!0),onCloseCompose:C,onPick:e=>{r(e),a(!0)},onOpen:()=>{o||1!==k.length||r(k[0].id),a(!0)}})})}),er=e=>"waiting"===e.status;function ei({bots:e,rows:n,waiting:a,count:o,busy:r,pending:i,beat:l,composing:u,onCompose:m,onCloseCompose:x,onPick:p,onOpen:f}){let h=function({count:e,busy:t,pending:n}){return n>0?{text:1===n?"waiting on you":`${n} waiting on you`,tone:J.WAITING_INK,shine:"amber"}:t>0?{text:1===t?"working":`${t} running`,tone:"text-muted-foreground",shine:"muted"}:e>0?{text:"all done",tone:"text-muted-foreground"}:{text:"no jobs yet",tone:"text-muted-foreground"}}({count:o,busy:r,pending:i}),b=u||i>0;return(0,t.jsxs)("div",{className:(0,J.cn)("pointer-events-auto w-fit max-w-full overflow-hidden bg-background/78 ring-1 ring-border/50 backdrop-blur-md transition-shadow duration-300",b?"min-w-96 rounded-3xl shadow-lg shadow-black/8":"rounded-full shadow-sm shadow-black/3"),children:[(0,t.jsx)("div",{className:(0,J.cn)("grid transition-[grid-template-rows] duration-300 ease-out",b?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:(0,t.jsx)("div",{className:"min-h-0 overflow-hidden",inert:!b,children:u?(0,t.jsx)(ec,{bots:e,onDone:x}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("p",{className:"flex items-center gap-2 px-3 py-2 font-mono text-[10px] tracking-wide text-muted-foreground",children:[(0,t.jsxs)("span",{className:"flex-1",children:["needs you · ",i]}),(0,t.jsx)(ed,{onClick:m})]}),(0,t.jsx)("div",{className:"px-1.5 pb-2",children:n.map(e=>(0,t.jsx)(eC,{task:e,onPick:()=>p(e.id)},e.id))}),(0,t.jsx)("span",{className:"block h-1.5"})]})})}),(0,t.jsxs)("div",{className:(0,J.cn)("flex items-center gap-2 px-3 py-1.5"),children:[(0,t.jsxs)("button",{type:"button",onClick:f,"aria-label":o?`Tasks (${o})`:"Bots",className:"flex min-w-0 flex-1 items-center gap-2 rounded-full text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)(ex,{bots:e,waiting:a,only:l?.bot}),(0,t.jsxs)("span",{className:"flex h-7 min-w-0 flex-1 items-center",children:[(0,t.jsx)(el,{on:!!l,children:(0,t.jsxs)("span",{className:"flex items-center gap-1.5 whitespace-nowrap",children:[(0,t.jsx)("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground/70",children:l?.label}),l?.live?(0,t.jsx)(g.default,{text:l.what,speed:2.4,color:"var(--muted-foreground)",shineColor:"var(--foreground)",className:"min-w-0 truncate text-[14px] leading-5 tracking-[-0.15px]"}):(0,t.jsx)("span",{className:(0,J.cn)("min-w-0 truncate text-[14px] leading-5 tracking-[-0.15px]",l?.tone??"text-foreground"),children:l?.what})]})}),(0,t.jsx)(el,{on:!l,children:h.shine?(0,t.jsx)("span",{className:(0,J.cn)("block","amber"===h.shine?"[--rest:var(--color-amber-700)] [--shine:var(--color-amber-400)] dark:[--rest:var(--color-amber-400)] dark:[--shine:var(--color-amber-100)]":"[--rest:var(--muted-foreground)] [--shine:var(--foreground)]"),children:(0,t.jsx)(g.default,{text:h.text,speed:2.6,color:"var(--rest)",shineColor:"var(--shine)",className:"truncate text-[14px] leading-5 tracking-[-0.15px]"})}):(0,t.jsx)("span",{className:(0,J.cn)("block animate-in truncate text-[14px] leading-5 tracking-[-0.15px] fade-in duration-300",h.tone),children:h.text},h.text)})]})]}),u&&(0,t.jsx)(eu,{onClick:x,label:"Cancel the message",children:(0,t.jsx)(c.X,{className:"size-3.5"})}),!u&&0===i&&r>0&&(0,t.jsx)(d.Loader2,{className:"size-4 shrink-0 animate-spin text-muted-foreground/70"}),!u&&0===i&&0===r&&o>0&&(0,t.jsx)(s.Check,{className:"size-4 shrink-0 text-muted-foreground/60"})]})]})}function el({on:e,children:n}){return(0,t.jsx)("span",{className:(0,J.cn)("grid min-w-0 transition-[grid-template-columns,opacity] duration-200 ease-out",e?"grid-cols-[1fr] opacity-100":"grid-cols-[0fr] opacity-0"),children:(0,t.jsx)("span",{className:"min-w-0 overflow-hidden",children:n})})}function ed({onClick:e}){return(0,t.jsx)(eu,{onClick:e,label:"Message a bot",children:(0,t.jsx)(u.Plus,{className:"size-4"})})}function eu({onClick:e,label:n,children:s}){return(0,t.jsx)("button",{type:"button",onClick:e,"aria-label":n,className:"grid size-7 shrink-0 place-items-center rounded-full text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:s})}function ec({bots:e,onDone:s}){let[r,i]=(0,m.useState)(null),[l,u]=(0,m.useState)(""),[c,p]=(0,G.useServerAction)(N.startTaskAction,{onOk:()=>{(0,X.revalidate)(x.queryKey.tasks),s()}}),h=e?.length?e.map(e=>({name:e.name,icon:e.icon})):[{name:w.DEFAULT_BOT.name,icon:w.DEFAULT_BOT.icon}],b=()=>{r&&l.trim()&&!p&&c(r.name,l.trim())};return r?(0,t.jsxs)("div",{className:"flex min-h-32 flex-col pb-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 pt-3 pb-2",children:[(0,t.jsx)("button",{type:"button",onClick:()=>i(null),"aria-label":"Choose a different bot",className:"grid size-6 shrink-0 place-items-center rounded-lg text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,t.jsx)(a.ChevronLeft,{className:"size-3.5"})}),(0,t.jsx)(C.BotMark,{size:22,seed:r.name,vary:r.name,color:r.icon?.color,shape:r.icon?.shape,outline:r.icon?.outline,className:"shrink-0"}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 truncate text-[12.5px] font-medium",children:["To ",r.name]})]}),(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault(),b()},className:"mx-3 mt-auto flex items-end gap-1 rounded-2xl bg-background py-2 pr-2 pl-3 ring-1 ring-border/80 transition-shadow focus-within:ring-ring/60",children:[(0,t.jsx)(k.Textarea,{value:l,rows:1,autoFocus:!0,disabled:p,onChange:e=>u(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||229===e.keyCode||(e.preventDefault(),b())},placeholder:`What should ${r.name} do? It cannot hear the call, so say the whole job.`,"aria-label":`Message for ${r.name}`,className:"max-h-32 min-h-15 flex-1 resize-none border-0 bg-transparent px-0 py-0 text-[13px] leading-5 shadow-none focus-visible:ring-0 dark:bg-transparent"}),(0,t.jsx)(f.Button,{type:"submit",size:"icon-sm",variant:l.trim()?"default":"ghost",disabled:!l.trim()||p,"aria-label":"Send",className:"rounded-full",children:p?(0,t.jsx)(d.Loader2,{className:"animate-spin"}):(0,t.jsx)(n.ArrowUp,{})})]})]}):(0,t.jsxs)("div",{className:"min-h-32 pb-3",children:[(0,t.jsx)("p",{className:"px-3 pt-3 pb-1.5 font-mono text-[10px] tracking-wide text-muted-foreground",children:"message a bot"}),(0,t.jsx)("div",{className:"px-1",children:h.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>i(e),className:"flex w-full items-center gap-2.5 rounded-xl px-2 py-1.5 text-left outline-none transition-colors hover:bg-muted/60 focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)(C.BotMark,{size:22,seed:e.name,vary:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,className:"shrink-0"}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate text-[13px]",children:e.name}),(0,t.jsx)(o.ChevronRight,{className:"size-3.5 shrink-0 text-muted-foreground/50"})]},e.name))})]})}let em=["alto","brio","cinder","delta"].map((e,t)=>({key:e,seed:e,color:es.MARK_PALETTE[Math.floor(t*es.MARK_PALETTE.length/4)],shape:es.MARK_SHAPES[t%es.MARK_SHAPES.length],outline:void 0}));function ex({bots:e,waiting:n=[],only:s}){let a=e?.length?e.map(e=>({key:e.name,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,notify:!1})):em.map(e=>({...e,notify:!1})),o=n.map(e=>({key:e.name,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,notify:!0})),r=[...o,...a.filter(e=>!o.some(t=>t.key===e.key))].map(e=>({...e,standIn:!1})),i=em.filter(e=>!r.some(t=>t.key===e.key)).slice(0,Math.max(0,3-r.length)).map(e=>({...e,notify:!1,standIn:!0})),l=[...r,...i].slice(0,4);return(0,t.jsx)("span",{className:(0,J.cn)("flex shrink-0 items-center",!e?.length&&!o.length&&"opacity-50"),children:l.map((e,n)=>(0,t.jsx)("span",{className:(0,J.cn)("origin-right transition-[margin,opacity,transform] duration-300 ease-out",n>0&&"-ml-2",e.standIn&&"opacity-35",s&&e.key!==s&&"-ml-[28px] scale-50 opacity-0"),style:{zIndex:l.length-n},children:(0,t.jsx)(C.BotMark,{size:28,seed:e.seed,vary:e.seed,color:e.color,shape:e.shape,outline:e.outline,notify:e.notify})},e.key))})}function ep({onClick:e}){return(0,t.jsx)("button",{type:"button",onClick:e,"aria-label":"Fold the room away",className:"grid size-7 shrink-0 place-items-center rounded-full bg-muted text-foreground outline-none transition-colors hover:bg-muted-foreground/20 focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,t.jsx)(c.X,{className:"size-3.5"})})}function ef({count:e,pending:n,composing:s,onCompose:a,onClose:o}){return(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3.5 pt-3 pb-1.5",children:[(0,t.jsx)("span",{className:"text-[13px] font-medium",children:"Tasks"}),e>0&&!s&&(0,t.jsx)("span",{className:"font-mono text-[10px] text-muted-foreground tabular-nums",children:n>0?`${n} for you \xb7 ${e}`:e}),(0,t.jsx)("span",{className:"flex-1"}),!s&&(0,t.jsx)(ed,{onClick:a}),(0,t.jsx)(ep,{onClick:o})]})}function eh({task:e,onBack:n,onClose:s}){return(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 pt-3 pb-1",children:[(0,t.jsx)("button",{type:"button",onClick:n,"aria-label":"Back to the list",className:"shrink-0 rounded-md p-1 text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,t.jsx)(a.ChevronLeft,{className:"size-4"})}),(0,t.jsx)(C.BotMark,{size:22,seed:e.bot.name,vary:e.id,color:e.bot.icon?.color,shape:e.bot.icon?.shape,outline:e.bot.icon?.outline,notify:!1}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 truncate text-[13px] font-medium",children:[e.label,(0,t.jsx)("span",{title:e.id,className:"ml-1.5 font-mono text-[10px] font-normal text-muted-foreground/60",children:e.id.slice(0,8)})]}),(0,t.jsx)(eb,{usage:e.tokens}),(0,t.jsx)(eg,{task:e}),(0,t.jsx)(ev,{task:e}),(0,t.jsx)(ep,{onClick:s})]})}function eb({usage:e}){let n=e.input+e.output;return n?(0,t.jsx)("span",{title:`in ${(0,J.formatCount)(e.input)} \xb7 out ${(0,J.formatCount)(e.output)}`,className:"shrink-0 font-mono text-[10px] text-muted-foreground/70 tabular-nums",children:(0,J.formatCount)(n)}):null}function eg({task:e}){let{contextTokens:n,contextBudget:s}=e;if(!n||!s)return null;let a=Math.min(1,n/s);return(0,t.jsx)("span",{title:`Context ${(0,J.formatCount)(n)} of ${(0,J.formatCount)(s)} — it summarizes itself here`,className:"block h-[3px] w-9 shrink-0 overflow-hidden rounded-full bg-muted",children:(0,t.jsx)("span",{className:(0,J.cn)("block h-full rounded-full",a>.9?"bg-amber-500/80":"bg-muted-foreground/70"),style:{width:`${Math.max(4,Math.round(100*a))}%`}})})}let ek={working:"text-muted-foreground",waiting:J.WAITING_INK,done:"text-foreground",failed:"text-destructive"};function ev({task:e}){let n="done"===e.status&&e.relayed?"text-muted-foreground":ek[e.status];return"working"===e.status?(0,t.jsx)(g.default,{text:"working",speed:2.2,color:"var(--muted-foreground)",shineColor:"var(--foreground)",className:"shrink-0 font-mono text-[10px]"}):(0,t.jsx)("span",{className:(0,J.cn)("flex shrink-0 items-center gap-1.5 font-mono text-[10px]",n),children:e.status})}function ej({bots:e}){return(0,t.jsxs)("div",{className:"flex flex-col items-center gap-3 px-6 pt-3 pb-4 text-center",children:[(0,t.jsx)(ex,{bots:e}),e?.length?(0,t.jsx)("p",{className:"text-[12px] text-muted-foreground",children:"Nothing handed over yet — ask for something that takes a while."}):(0,t.jsxs)("p",{className:"text-[12px] text-muted-foreground",children:["Thursday hands work to ",w.DEFAULT_BOT.name," until you make bots of your own in Settings › Bots."]})]})}function ey(){return(0,t.jsx)("div",{className:"flex shrink-0 justify-end px-3 pb-2.5",children:(0,t.jsxs)("button",{type:"button",onClick:()=>(0,Z.openSettings)("tasks"),className:"flex items-center gap-1 rounded-md px-1.5 py-1 font-mono text-[10px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)(l.History,{className:"size-3"}),"History"]})})}let eN=[{id:"you",label:"needs you",holds:er},{id:"working",label:"working",holds:e=>"working"===e.status},{id:"done",label:"done",holds:()=>!0}];function ew({tasks:e,onPick:n}){let s=new Map;for(let t of e){let e=eN.find(e=>e.holds(t))??eN[2],n=s.get(e.id);n?n.push(t):s.set(e.id,[t])}return(0,t.jsx)("div",{className:"flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto px-2 pt-1 pb-1 scrollbar-none",children:eN.map((e,a)=>{let o=s.get(e.id)??[];return o.length?(0,t.jsxs)(m.Fragment,{children:[(0,t.jsxs)("p",{className:(0,J.cn)("px-2.5 pb-1 font-mono text-[10px] text-muted-foreground",0===a?"pt-1":"pt-3"),children:[e.label," · ",o.length]}),o.map(e=>(0,t.jsx)(eC,{task:e,onPick:()=>n(e.id)},e.id))]},e.id):null})})}function eC({task:e,onPick:n}){let s=er(e),a=e.lines.at(-1),o=(0,m.useMemo)(()=>eT(e),[e.status,e.outcome,e.relayed,e.ask,a?.id]),[i,l]=Q(),[u,c]=(0,m.useState)(null),x="waiting"===e.status?e.ask?.options??[]:[],p=(0,w.isBudgetAsk)(e.ask);return(0,t.jsxs)("div",{className:"rounded-xl transition-colors hover:bg-muted/60",children:[(0,t.jsxs)("button",{type:"button",onClick:n,className:"flex w-full items-center gap-2.5 rounded-xl px-2 py-1.5 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)("span",{className:"relative flex size-8 shrink-0 items-center justify-center overflow-visible",title:e.bot.name,children:(0,t.jsx)(C.BotMark,{size:32,seed:e.bot.name,vary:e.id,color:e.bot.icon?.color,shape:e.bot.icon?.shape,outline:e.bot.icon?.outline,state:"working"===e.status?"thinking":"idle",notify:s})}),(0,t.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("span",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("span",{className:(0,J.cn)("min-w-0 truncate text-[14px] leading-5 tracking-[-0.15px]",s?"text-foreground":"text-foreground/80"),children:e.label}),(0,t.jsx)(T.BotRoster,{bots:H(e),taskId:e.id}),(0,t.jsx)("span",{className:"flex-1"}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-[11px] leading-4 text-muted-foreground/70 tabular-nums",children:(0,et.shortAgo)(e.updatedAt)})]}),(0,t.jsxs)("span",{className:"mt-px flex h-4 items-center gap-1.5",children:["working"===e.status&&(0,t.jsx)(d.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground/70"}),"working"===e.status?(0,t.jsx)(g.default,{text:o.text,speed:2.2,color:"var(--muted-foreground)",shineColor:"var(--foreground)",className:(0,J.cn)("min-w-0 flex-1 truncate text-[12px] leading-4",o.tone)}):(0,t.jsx)("span",{className:(0,J.cn)("min-w-0 flex-1 truncate text-[12px] leading-4",o.tone),children:o.text})]})]})]}),x.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5 pt-0.5 pr-2 pb-2 pl-12.5",children:x.map(n=>(0,t.jsxs)(f.Button,{size:"sm",variant:"outline",loading:u===n,disabled:l,onClick:async()=>{c(n),await i(e,n),c(null)},className:(0,J.cn)("h-7 gap-1.5 rounded-full bg-background px-3 text-[12px]",!p&&"border-amber-500/35"),children:[p&&n===w.TASK_CONTINUE&&(0,t.jsx)(r.ChevronsRight,{className:"size-3.5 text-muted-foreground"}),n,p&&n===w.TASK_CONTINUE&&(0,t.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground",children:["+",j.BOT_RUN.steps," steps"]})]},n))})]})}function eT(e){if("waiting"===e.status&&e.ask)return(0,w.isBudgetAsk)(e.ask)?{text:(0,J.plainText)(e.outcome??e.ask.question),tone:"text-muted-foreground"}:{text:e.ask.question,tone:J.WAITING_INK};if("failed"===e.status)return{text:(0,J.plainText)(e.outcome??"Failed"),tone:"text-destructive"};if("done"===e.status)return{text:(0,J.plainText)(e.outcome??"Done"),tone:e.relayed?"text-muted-foreground":"text-foreground"};let t=q(e);return t?{text:"tool"===t.kind&&t.tool?t.tool.note??`${t.tool.name} \xb7 ${t.tool.input}`:t.text,tone:"text-muted-foreground"}:{text:`${e.bot.name} is taking it on…`,tone:"text-muted-foreground italic"}}function ez({task:e,className:n}){let s=(0,m.useRef)(null),a=(0,m.useRef)(!0);return(0,m.useEffect)(()=>{a.current=!0},[e.id]),(0,m.useEffect)(()=>{let e=s.current;e&&a.current&&(e.scrollTop=e.scrollHeight)},[e.lines,e.status]),(0,t.jsx)(ee.FileViewer,{children:(0,t.jsxs)("div",{ref:s,onScroll:e=>{let t=e.currentTarget;a.current=t.scrollHeight-t.scrollTop-t.clientHeight<24},className:(0,J.cn)("max-h-[64vh] space-y-3 overflow-y-auto px-4 pt-6 pb-4 mask-[linear-gradient(to_bottom,transparent,black_2rem)] scrollbar-none",n),children:[(0,t.jsx)(eS,{task:e}),V(e).map(n=>"invite"===n.kind?(0,t.jsx)(eM,{from:n.from,to:n.to},n.key):(0,t.jsx)(eI,{group:n.group,task:e},n.key)),"working"===e.status&&0===e.lines.length&&(0,t.jsx)(g.default,{text:`${e.bot.name} is taking it on…`,speed:2.2,color:"var(--muted-foreground)",shineColor:"var(--foreground)",className:"block px-1 font-mono text-[10px]"})]})})}function eS({task:e}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eM,{from:eA,to:e.bot}),(0,t.jsx)(e_,{children:(0,t.jsx)(p.Bubble,{align:"end",className:"max-w-full",children:(0,t.jsx)(p.BubbleContent,{className:"rounded-tr-md py-2 pr-2 pl-3.5",children:(0,t.jsx)(h.FoldedText,{text:e.request,subject:"request"})})})})]})}let eA={name:"Thursday"};function eM({from:e,to:n}){return(0,t.jsx)("div",{className:"flex animate-in justify-center fade-in duration-300",children:(0,t.jsxs)("span",{className:"flex max-w-full items-center gap-1.5 rounded-full bg-muted px-2.5 py-1 font-mono text-[10px] text-muted-foreground",children:[(0,t.jsx)(eB,{bot:e}),(0,t.jsx)("span",{className:"shrink-0 text-muted-foreground/70",children:"invited"}),(0,t.jsx)(eB,{bot:n})]})})}function eB({bot:e}){return(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,t.jsx)(C.BotMark,{size:15,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,notify:!1,className:"shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]})}function e_({children:e}){return(0,t.jsx)(eR,{side:"end",name:"Thursday",mark:(0,t.jsx)(C.BotMark,{size:26,seed:"thursday",notify:!1,className:"mt-1 shrink-0"}),children:e})}function eR({side:e,mark:n,name:s,children:a}){return(0,t.jsxs)("div",{className:(0,J.cn)("flex gap-2.5","end"===e&&"flex-row-reverse"),children:[n,(0,t.jsxs)("div",{className:(0,J.cn)("flex min-w-0 flex-1 flex-col gap-1.5 [&>*+*]:max-w-[80%]","end"===e&&"items-end"),children:[(0,t.jsx)("p",{className:"max-w-[80%] truncate px-1 font-mono text-[10px] text-muted-foreground",children:s}),a]})]})}function eI({group:e,task:n}){return e.lines[0]?.kind==="user"?(0,t.jsx)("div",{className:"animate-in fade-in slide-in-from-bottom-2 duration-300",children:(0,t.jsx)(e_,{children:e.lines.map(e=>(0,t.jsx)(p.Bubble,{align:"end",className:"max-w-full",children:(0,t.jsx)(p.BubbleContent,{className:"rounded-tr-md px-3.5 text-[13px] leading-snug break-keep",children:e.text})},e.id))})}):(0,t.jsx)("div",{className:"animate-in fade-in slide-in-from-bottom-2 duration-300",children:(0,t.jsx)(eR,{side:e.bot.name===n.bot.name?"start":"end",name:e.bot.name,mark:(0,t.jsx)(C.BotMark,{size:26,seed:e.bot.name,vary:n.id,color:e.bot.icon?.color,shape:e.bot.icon?.shape,outline:e.bot.icon?.outline,notify:!1,className:"mt-1 shrink-0"}),children:(function(e){let t=[];for(let n of e){let e="tool"===n.kind&&n.tool?"tools":"said",s=t.at(-1);s&&s.kind===e?s.lines.push(n):t.push({kind:e,key:n.id,lines:[n]})}return t})(e.lines).map(e=>"tools"===e.kind?(0,t.jsx)(eq,{lines:e.lines,taskId:n.id},e.key):e.lines.map(e=>(0,t.jsx)(eE,{line:e,taskId:n.id},e.id)))})})}function eE({line:e,taskId:n}){if("tool"===e.kind&&e.tool)return(0,t.jsx)(ea.BotTool,{tool:e.tool,taskId:n});if("note"===e.kind)return(0,t.jsxs)("details",{className:"w-full py-1 text-muted-foreground",children:[(0,t.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2.5 outline-none [&::-webkit-details-marker]:hidden",children:[(0,t.jsx)("span",{className:"h-px flex-1 bg-border"}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-[10px]",children:"Compacted — it goes on from its summary"}),(0,t.jsx)("span",{className:"h-px flex-1 bg-border"})]}),(0,t.jsx)("p",{className:"mt-2 rounded-xl bg-muted/40 px-3 py-2 text-[11px] leading-relaxed whitespace-pre-wrap break-keep",children:e.text})]});if(!P(e))return(0,t.jsx)("p",{className:"px-1 text-[12.5px] leading-relaxed break-keep text-muted-foreground",children:e.text});if(e.options)return(0,t.jsxs)("div",{className:"w-fit max-w-full space-y-1.5 rounded-2xl bg-amber-500/8 px-3 py-2 ring-1 ring-amber-500/25",children:[(0,t.jsx)("p",{className:"text-[13px] leading-snug break-keep",children:e.text}),e.options.length>0&&(0,t.jsx)("p",{className:"flex flex-wrap gap-1",children:e.options.map(e=>(0,t.jsx)("span",{className:"rounded-full bg-background/70 px-2 py-0.5 font-mono text-[10px] text-muted-foreground",children:e},e))})]});let s="error"===e.kind;return(0,t.jsxs)("div",{className:"min-w-0 px-1",children:[s&&(0,t.jsxs)("p",{className:"mb-1.5 flex items-center gap-1.5 font-mono text-[10px] text-destructive",children:[(0,t.jsx)(c.X,{className:"size-3 shrink-0"}),"Could not finish"]}),(0,t.jsx)(b.Markdown,{className:(0,J.cn)("overflow-x-auto text-[13px] leading-relaxed break-keep [&_h1]:text-[15px] [&_h2]:text-[14px] [&_h3]:text-[13px] [&_h3]:font-semibold [&_li]:my-0.5 [&_table]:text-[12px] [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",s&&"text-destructive"),children:e.text}),(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,t.jsx)(z.PathChips,{text:e.text,className:"min-w-0"}),!s&&(0,t.jsx)("span",{className:"ml-auto shrink-0",children:(0,t.jsx)(e$,{text:e.text})})]})]})}function e$({text:e}){let[n,a]=(0,m.useState)(!1),o=(0,m.useRef)(null);return(0,m.useEffect)(()=>()=>{o.current&&clearTimeout(o.current)},[]),(0,t.jsx)("button",{type:"button","aria-label":"Copy the report",onClick:async()=>{try{await navigator.clipboard.writeText(e),a(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>a(!1),1400)}catch(e){v.toast.add({type:"error",title:"Could not copy the report",description:(0,J.errorToString)(e)})}},className:"grid size-5 shrink-0 place-items-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:n?(0,t.jsx)(s.Check,{className:"size-3"}):(0,t.jsx)(i.Copy,{className:"size-3"})})}function eq({lines:e,taskId:n}){return(0,t.jsxs)("div",{className:"flex w-full flex-col gap-0.5 rounded-2xl bg-muted/40 p-1",children:[e.length>1&&(0,t.jsxs)("p",{className:"px-2 py-1 font-mono text-[10px] text-muted-foreground",children:[e.length," steps"]}),e.map(e=>e.tool?(0,t.jsx)(ea.BotTool,{tool:e.tool,taskId:n,collapsed:!0},e.id):null)]})}e.s(["BotRoom",0,eo,"Conversation",0,ez],279265)},480263,e=>{"use strict";var t=e.i(95187);let n=(0,t.createServerReference)("7fe21e4e229cffa414a4ef02ed9591309ce5d04398",t.callServer,void 0,t.findSourceMapURL,"cancelTaskAction");e.s(["cancelTaskAction",0,n])},176975,e=>{"use strict";var t=e.i(95187);let n=(0,t.createServerReference)("7fbc7081db6a5f8821ff485f87b3fd5a4a2f223663",t.callServer,void 0,t.findSourceMapURL,"answerTaskAction");e.s(["answerTaskAction",0,n])},96892,931619,508734,815731,496336,178378,104194,835878,764224,919191,e=>{"use strict";var t=e.i(456420);let n={name:"arrow-up",size:24,node:[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]};n.node;let s=(0,t.default)(n);e.s(["ArrowUp",0,s],96892);let a={name:"chevrons-right",size:24,node:[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]};a.node;let o=(0,t.default)(a);e.s(["ChevronsRight",0,o],931619);let r={name:"copy",size:24,node:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]};r.node;let i=(0,t.default)(r);e.s(["Copy",0,i],508734);var l=e.i(843476),d=e.i(176782),u=e.i(552245),c=e.i(225913),m=e.i(647163);let x=(0,c.cva)("group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full",{variants:{variant:{default:"*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80",secondary:"*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]",muted:"*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--muted),var(--foreground)_5%)]",tinted:"*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)] [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.88_calc(c*0.5)_h)] dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.35_calc(c*0.5)_h)]",outline:"*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-input/30",ghost:"border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/50",destructive:"*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive dark:*:data-[slot=bubble-content]:bg-destructive/20 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20 dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/30"}},defaultVariants:{variant:"default"}});(0,c.cva)("absolute z-10 flex w-fit shrink-0 items-center justify-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-sm ring-3 ring-card has-[button]:p-0",{variants:{side:{top:"top-0 -translate-y-3/4",bottom:"bottom-0 translate-y-3/4"},align:{start:"left-3",end:"right-3"}},defaultVariants:{side:"bottom",align:"end"}}),e.s(["Bubble",0,function({variant:e="default",align:t="start",className:n,...s}){return(0,l.jsx)("div",{"data-slot":"bubble","data-variant":e,"data-align":t,className:(0,m.cn)(x({variant:e}),n),...s})},"BubbleContent",0,function({className:e,render:t,...n}){var s;return s={defaultTagName:"div",props:(0,d.mergeProps)({className:(0,m.cn)("w-fit max-w-full min-w-0 overflow-hidden rounded-xl border border-transparent px-3 py-2 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/50",e)},n),render:t,state:{slot:"bubble-content"}},(0,u.useRenderElement)(s.defaultTagName??"div",s,s)}],815731);var p=e.i(716327),f=e.i(271645);e.s(["FoldedText",0,function({text:e,subject:t,clamp:n="line-clamp-3",tall:s="max-h-40",className:a}){let[o,r]=(0,f.useState)(!1),[i,d]=(0,f.useState)(!1),u=(0,f.useRef)(null);return(0,f.useEffect)(()=>r(!1),[e]),(0,f.useEffect)(()=>{let e=u.current;e&&!o&&d(e.scrollHeight>e.clientHeight+1)},[o,e]),(0,l.jsxs)("div",{className:(0,m.cn)("flex items-start gap-1",a),children:[(0,l.jsx)("p",{ref:u,className:(0,m.cn)("min-w-0 flex-1 text-[13px] leading-snug break-keep",o?(0,m.cn)(s,"overflow-y-auto scrollbar-none"):n),children:e}),(i||o)&&(0,l.jsx)("button",{type:"button",onClick:()=>r(e=>!e),"aria-label":o?`Fold the ${t}`:`Read the whole ${t}`,className:"shrink-0 rounded-md p-0.5 opacity-60 outline-none transition-opacity hover:opacity-100 focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,l.jsx)(p.ChevronDown,{className:(0,m.cn)("size-3.5",o&&"rotate-180")})})]})}],496336);var h=e.i(95187);let b=(0,h.createServerReference)("7fbb988f415acfb6ae0ecf4b9da4d6510c4331ed8f",h.callServer,void 0,h.findSourceMapURL,"markReportedAction");e.s(["markReportedAction",0,b],178378);let g=(0,h.createServerReference)("7f2b62a0347bf9a35aa766fc41149b696cbf7af676",h.callServer,void 0,h.findSourceMapURL,"startTaskAction");e.s(["startTaskAction",0,g],104194);var k=e.i(635963);e.s(["BotRoster",0,function({bots:e,taskId:t}){return e.length<2?null:(0,l.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",title:e.map(e=>e.name).join(", "),children:[(0,l.jsx)("span",{className:"flex items-center",children:e.slice(0,3).map(e=>(0,l.jsx)(k.BotMark,{size:18,seed:e.name,vary:t,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,notify:!1,className:"-ml-[3px] rounded-[7px] ring-2 ring-background first:ml-0"},e.name))}),(0,l.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground",children:[e.length," bots"]})]})}],835878);var v=e.i(829600);let j={name:"file-code",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]]};j.node;let y=(0,t.default)(j),N={name:"file-image",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]};N.node;let w=(0,t.default)(N);var C=e.i(905015);let T={name:"file-spreadsheet",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]};T.node;let z=(0,t.default)(T);var S=e.i(226091);let A={name:"file-type",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M11 18h2",key:"12mj7e"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5",key:"qbrxap"}]]};A.node;let M=(0,t.default)(A);var B=e.i(621285),_=e.i(616172);let R={markdown:S.FileText,csv:z,json:C.FileJson,text:M,image:w};e.s(["PathChips",0,function({text:e,className:t}){let n=(0,f.useMemo)(()=>(0,_.pathsIn)(e),[e]);return n.length?(0,l.jsx)("div",{className:(0,m.cn)("flex flex-wrap gap-1.5",t),children:n.map(e=>{let t,n=e.split("/").pop()??e,s="frame"===(t=(0,_.viewKindOf)(e))?e.toLowerCase().endsWith(".pdf")?S.FileText:y:R[t]??v.File;return(0,l.jsxs)(B.FileLink,{path:e,className:"flex max-w-full items-center gap-1.5 rounded-full bg-muted/70 py-1 pr-2.5 pl-2 font-mono text-[11px] text-foreground/80 outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,l.jsx)(s,{className:"size-3 shrink-0 text-muted-foreground"}),(0,l.jsx)("span",{className:"truncate",children:n})]},e)})}):null}],764224);let I={name:"corner-down-left",size:24,node:[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]]};I.node;let E=(0,t.default)(I);e.s(["CornerDownLeft",0,E],919191)},929272,e=>{"use strict";var t=e.i(456420);let n={name:"square",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]};n.node;let s=(0,t.default)(n);e.s(["Square",0,s],929272)}]);
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,279265,240829,206721,e=>{"use strict";var t=e.i(843476),n=e.i(96892),s=e.i(689664),a=e.i(24071),o=e.i(867927),r=e.i(931619),i=e.i(508734),l=e.i(779266),d=e.i(632781),u=e.i(77071),c=e.i(263676),m=e.i(271645),x=e.i(798120),p=e.i(815731),f=e.i(167881),h=e.i(496336),b=e.i(683408),g=e.i(660302),k=e.i(184762),v=e.i(6799),j=e.i(41533),y=e.i(158774),N=e.i(562026),w=e.i(451888),C=e.i(635963),T=e.i(835878),z=e.i(764224),S=e.i(919191),A=e.i(929272),M=e.i(996632),B=e.i(996272);let _=[],R=!1,I=new Set,E={sync(e,t){for(let n of(R=!0,_=[...e].reverse().map(e=>$(e,t)).slice(-30),I))n()},primed:()=>R};function $(e,t){let n=e=>({name:e,icon:t?.find(t=>t.name===e)?.icon??null}),s=n(e.bot),a=[],o=new Map,r=new Map;for(let t of e.lines){let e=t.bot?n(t.bot):s,i=t.parent&&r.get(t.parent)?.name?s:null;switch(t.kind){case"user":a.push({id:t.id,bot:s,to:null,text:t.text,kind:"user"});break;case"text":a.push({id:t.id,bot:e,to:i,text:t.text,kind:"say"});break;case"note":a.push({id:t.id,bot:e,to:i,text:t.text,kind:"note"});break;case"tool":o.set(t.callId,a.length),a.push({id:t.id,bot:e,to:i,text:t.note??t.input,kind:"tool",tool:{name:t.name,input:t.input,note:t.note,path:t.path,callId:t.callId}});break;case"tool-result":{let e=o.get(t.callId),n=void 0===e?void 0:a[e];n?.tool&&void 0!==e&&(a[e]={...n,tool:{...n.tool,results:t.results,more:t.more}});break}case"ask":{let s=n(t.to);r.set(t.callId,s),a.push({id:t.id,bot:e,to:s,text:t.text,kind:"ask"});break}case"ask-result":{let n=r.get(t.callId);n&&t.text&&a.push({id:t.id,bot:n,to:e,text:t.text,kind:"ask"});break}case"waiting":a.push({id:t.id,bot:e,to:null,text:t.question,kind:"result",options:t.options})}}if("failed"===e.status&&e.outcome)a.push({id:`${e.id}-end`,bot:s,to:null,text:e.outcome,kind:"error"});else if("done"===e.status||"waiting"===e.status){let t=a.at(-1);t&&"say"===t.kind&&t.text===e.outcome&&(a[a.length-1]={...t,kind:"result"})}return{id:e.id,request:e.request,label:e.label,bot:s,lines:a,status:"running"===e.status?"working":e.status,outcome:e.outcome,ask:e.ask,relayed:e.reported,tokens:e.tokens,contextTokens:e.contextTokens,contextBudget:e.contextBudget,updatedAt:e.updatedAt}}function q(e){for(let t=e.lines.length-1;t>=0;t--){let n=e.lines[t];if("user"!==n.kind&&"note"!==n.kind)return n}return null}let K=new Map,F={get:e=>K.get(e)??"",set(e,t){t?K.set(e,t):K.delete(e)},typing:e=>(K.get(e)?.trim().length??0)>0},L=new Set,O={announce(e){for(let t of L)t(e)},subscribe:e=>(L.add(e),()=>{L.delete(e)})},U=[];function D(){return(0,m.useSyncExternalStore)(e=>(I.add(e),()=>I.delete(e)),()=>_,()=>U)}let P=e=>"result"===e.kind||"error"===e.kind;function H(e){let t=[e.bot];for(let n of e.lines)t.some(e=>e.name===n.bot.name)||t.push(n.bot);return t}function V(e){let t=new Set([e.bot.name]),n=[];for(let s of function(e){let t=[];for(let n of e){let e=t.at(-1);if(e&&e.bot.name===n.bot.name&&e.to?.name===n.to?.name&&"user"===e.lines[0].kind==("user"===n.kind)){e.lines.push(n);continue}t.push({key:n.id,bot:n.bot,to:n.to,lines:[n]})}return t}(e.lines))s.to&&!t.has(s.to.name)&&(t.add(s.to.name),n.push({kind:"invite",key:`${s.key}-joins`,from:s.bot,to:s.to})),t.add(s.bot.name),n.push({kind:"group",key:s.key,group:s});return n}function W(e){let t=new Map;for(let n of e)for(let e of(t.has(n.bot.name)||t.set(n.bot.name,{bot:n.bot,task:n,line:null,open:0}),n.lines))"user"!==e.kind&&"note"!==e.kind&&t.set(e.bot.name,{bot:e.bot,task:n,line:e,open:t.get(e.bot.name)?.open??0});for(let n of e){if("working"!==n.status)continue;let e=t.get(n.bot.name);e&&(e.open+=1)}return[...t.values()]}e.s(["botTasks",0,E,"isOutcome",0,P,"lastSaid",0,q,"latestPerBot",0,W,"rosterOf",0,H,"screenActs",0,O,"taskDrafts",0,F,"taskFromRow",0,$,"threadItems",0,V,"useBotTasks",0,D],240829);var G=e.i(609856),X=e.i(283653),J=e.i(647163);function Y({task:e,status:s,lines:a=[],className:o}){let[i,l]=(0,m.useState)(()=>F.get(e.id));(0,m.useEffect)(()=>l(F.get(e.id)),[e.id]);let u=t=>{l(t),F.set(e.id,t)},[p,b]=Q(),[v,y]=(0,G.useServerAction)(B.cancelTaskAction,{onOk:e=>{(0,X.revalidate)(x.queryKey.tasks),O.announce({kind:"stopped",id:e.id,label:e.label})}}),N=b||y,[C,T]=(0,m.useState)(!1),[z,M]=(0,m.useState)(null);(0,m.useEffect)(()=>{T(!1),M(null)},[e.id]),(0,m.useEffect)(()=>{"running"!==s&&M(null)},[s]),(0,m.useEffect)(()=>{z&&a.some(e=>"user"===e.kind&&e.text===z)&&M(null)},[a,z]);let _=async t=>{!N&&await p(e,t)&&(u(""),"running"===s&&(M(t.trim()),T(!1)))},R="waiting"===s?e.ask:null,I=(0,w.isBudgetAsk)(R),E=R?R.options.length?"Or put it another way…":"Your answer":"running"===s?`What's off? ${e.bot} reads this before its next step`:"Anything more? It picks up where it left off",$=(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault(),_(i)},className:"flex items-end gap-1 rounded-2xl bg-background py-1.5 pr-1.5 pl-3.5 ring-1 ring-border/80 transition-shadow focus-within:ring-ring/60",children:[(0,t.jsx)(k.Textarea,{value:i,rows:1,disabled:N,autoFocus:"running"===s,onChange:e=>u(e.target.value),onKeyDown:e=>{"Escape"===e.key&&"running"===s?T(!1):"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||229===e.keyCode||(e.preventDefault(),_(i))},placeholder:E,"aria-label":`Message for ${e.label}`,className:"max-h-32 min-h-0 flex-1 resize-none border-0 bg-transparent px-0 py-1 text-[13px] leading-5 shadow-none focus-visible:ring-0 dark:bg-transparent"}),"running"===s&&(0,t.jsx)(f.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:N,onClick:()=>T(!1),"aria-label":"Never mind",className:"text-muted-foreground",children:(0,t.jsx)(c.X,{})}),(0,t.jsx)(f.Button,{type:"submit",size:"icon-sm",variant:i.trim()?"default":"ghost",disabled:!i.trim()||N,"aria-label":"Send",className:"rounded-full",children:b?(0,t.jsx)(d.Loader2,{className:"animate-spin"}):(0,t.jsx)(n.ArrowUp,{})})]});return"running"!==s||C?R?(0,t.jsxs)("div",{className:(0,J.cn)("space-y-2.5 rounded-2xl px-3.5 py-3 ring-1",I?"bg-muted/40 ring-border/50":"bg-amber-500/8 ring-amber-500/25",o),children:[(0,t.jsxs)("p",{className:"flex items-center gap-1.5 font-mono text-[10px] text-muted-foreground",children:[(0,t.jsx)("span",{className:"shrink-0",children:"To"}),(0,t.jsx)("span",{className:"truncate text-foreground",children:e.bot}),(0,t.jsx)("span",{className:"shrink-0 text-muted-foreground/50",children:"·"}),(0,t.jsx)("span",{className:"truncate",children:e.label})]}),R.question&&(0,t.jsx)(h.FoldedText,{text:R.question,subject:"message",clamp:"line-clamp-6",tall:"max-h-56"}),R.options.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:R.options.map(e=>(0,t.jsxs)(f.Button,{size:"sm",variant:"outline",disabled:N,onClick:()=>_(e),className:"h-7 gap-1.5 rounded-full bg-background px-3 text-[12px]",children:[I&&e===w.TASK_CONTINUE&&(0,t.jsx)(r.ChevronsRight,{className:"size-3.5 text-muted-foreground"}),e,I&&e===w.TASK_CONTINUE&&(0,t.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground",children:["+",j.BOT_RUN.steps," steps"]})]},e))}),$,(0,t.jsx)("button",{type:"button",disabled:N,onClick:()=>v(e.id),className:"font-mono text-[10px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50",children:"Stop this task instead"})]}):(0,t.jsx)("div",{className:o,children:$}):(0,t.jsxs)("div",{className:(0,J.cn)("flex items-center gap-2 rounded-2xl bg-muted/40 py-1.5 pr-1.5 pl-3.5 ring-1 ring-border/50",o),children:[z?(0,t.jsxs)("p",{className:"flex min-w-0 flex-1 items-center gap-2 text-[12.5px] leading-5 text-muted-foreground",children:[(0,t.jsx)(d.Loader2,{className:"size-3 shrink-0 animate-spin"}),(0,t.jsx)("span",{className:"shrink-0",children:"Before its next step:"}),(0,t.jsx)(g.default,{text:z,speed:2.2,color:"var(--muted-foreground)",shineColor:"var(--foreground)",className:"min-w-0 truncate"})]}):(0,t.jsx)(g.default,{text:`${e.bot} is on it — Thursday steers it by voice.`,speed:2.4,color:"var(--muted-foreground)",shineColor:"var(--foreground)",className:"min-w-0 flex-1 truncate text-[12.5px] leading-5 break-keep"}),(0,t.jsxs)(f.Button,{type:"button",size:"sm",variant:"ghost",disabled:N,onClick:()=>T(!0),className:"h-7 shrink-0 gap-1.5 rounded-full px-2.5 text-[12px]",children:[(0,t.jsx)(S.CornerDownLeft,{className:"size-3.5"}),"Step in"]}),(0,t.jsx)("span",{className:"h-4 w-px shrink-0 bg-border"}),(0,t.jsx)(f.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:N,onClick:()=>v(e.id),"aria-label":"Stop this task",className:"shrink-0 text-muted-foreground/60 hover:text-foreground",children:y?(0,t.jsx)(d.Loader2,{className:"animate-spin"}):(0,t.jsx)(A.Square,{className:"size-3"})})]})}function Q(){let[e,t]=(0,G.useServerAction)(M.answerTaskAction,{onOk:()=>(0,X.revalidate)(x.queryKey.tasks)});return[async(t,n)=>{let s=n.trim();if(!s)return!1;try{let n=await e(t.id,s);return O.announce({kind:"answered",id:n.id,label:n.label,answer:s}),!0}catch{return!1}},t]}e.s(["TaskReply",0,Y,"useAnswerTask",0,Q],206721);var Z=e.i(989409),ee=e.i(621285),et=e.i(245629),en=e.i(393080),es=e.i(864723),ea=e.i(222055);let eo=(0,m.memo)(function(){let e=D(),{data:n}=(0,X.useServerRoute)(x.queryKey.bot),[s,a]=(0,m.useState)(!1),[o,r]=(0,m.useState)(null),[i,l]=(0,m.useState)(!1),d=[...e].reverse(),u=o?d.find(e=>e.id===o)??null:null,[c,p]=function(){let[e,t]=(0,m.useState)(null),n=(0,m.useRef)([]),s=(0,m.useRef)(!1),a=(0,m.useRef)([]);(0,m.useEffect)(()=>()=>{for(let e of a.current)clearTimeout(e)},[]);let o=(0,m.useRef)(()=>{});return o.current=()=>{if(s.current)return;let e=n.current.shift();e&&(s.current=!0,t(e),a.current.push(setTimeout(()=>{t(null),a.current.push(setTimeout(()=>{s.current=!1,o.current()},260))},3e3)))},[e,(0,m.useCallback)(e=>{let t=n.current.findIndex(t=>t.bot===e.bot);t>=0?n.current[t]=e:n.current.push(e),o.current()},[])]}(),f=(0,m.useRef)(null),h=(0,m.useRef)(new Map);(0,m.useEffect)(()=>{if(!E.primed())return;let t=new Map(d.map(e=>[e.id,e.status])),n=f.current;f.current=t;let s=new Map;for(let t of W(e))t.line&&s.set(t.bot.name,t.line.id);let a=h.current;if(h.current=s,n){for(let t of W(e)){if("working"!==t.task.status)continue;let e=t.line?.id;e&&a.get(t.bot.name)!==e&&p({bot:t.bot.name,label:t.task.label,what:eT(t.task).text,live:!0})}for(let e of d){let t=n.get(e.id);t!==e.status&&(void 0===t&&"working"!==e.status&&e.relayed||p({bot:e.bot.name,label:e.label,...function(e,t){let n=e.bot.name;return"working"===e.status?{what:t?`${n} took this on`:`${n} picked it back up`,live:!0}:"waiting"===e.status?(0,w.isBudgetAsk)(e.ask)?{what:`${n} is out of steps`}:{what:`${n} is asking`,tone:J.WAITING_INK}:"failed"===e.status?{what:`${n} could not finish`,tone:"text-destructive"}:{what:`${n} finished`}}(e,void 0===t)}))}}},[e,p]);let b=(0,m.useRef)(new Set);(0,m.useEffect)(()=>{if(!u||u.relayed||"done"!==u.status&&"failed"!==u.status)return;let e=`${u.id}@${(0,et.toDate)(u.updatedAt).getTime()}`;b.current.has(e)||(b.current.add(e),(0,y.markReportedAction)([u.id]).then(en.unwrapResult).then(()=>(0,X.revalidate)(x.queryKey.tasks)).catch(t=>{b.current.delete(e),v.toast.add({type:"error",title:"Could not mark the task as read",description:(0,J.errorToString)(t)})}))},[u]);let g=e.filter(e=>"working"===e.status).length,k=d.filter(er),j=k.length,N=k.map(e=>e.bot).filter((e,t,n)=>n.findIndex(t=>t.name===e.name)===t),C=(0,m.useCallback)(()=>l(!1),[]);return(0,t.jsx)("div",{className:"pointer-events-none absolute right-5 bottom-5 z-10 flex w-132 max-w-[calc(100vw-2.5rem)] flex-col items-end gap-2",children:s?(0,t.jsx)("div",{className:"pointer-events-auto flex max-h-[min(44rem,78vh)] w-full animate-in flex-col overflow-hidden rounded-3xl bg-background/75 shadow-2xl shadow-black/6 ring-1 ring-border/50 backdrop-blur-xl fade-in slide-in-from-bottom-1 duration-200",children:u?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eh,{task:u,onBack:()=>r(null),onClose:()=>a(!1)}),(0,t.jsx)(ez,{task:u,className:"min-h-0 flex-1"}),(0,t.jsx)(Y,{task:{id:u.id,label:u.label,bot:u.bot.name,ask:function(e){if(!e.ask?.question)return e.ask;let t=e.lines.at(-1);return t&&P(t)&&t.text===e.ask.question?{...e.ask,question:""}:e.ask}(u)},status:"working"===u.status?"running":u.status,lines:u.lines,className:"mx-3 mb-2 shrink-0"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ef,{count:e.length,pending:j,composing:i,onCompose:()=>l(!0),onClose:()=>i?l(!1):a(!1)}),i?(0,t.jsx)(ec,{bots:n,onDone:C}):d.length?(0,t.jsx)(ew,{tasks:d,onPick:r}):(0,t.jsx)(ej,{bots:n}),!i&&(0,t.jsx)(ey,{})]})}):(0,t.jsx)(ei,{bots:n,rows:k,waiting:N,count:e.length,busy:g,pending:j,beat:c,composing:i,onCompose:()=>l(!0),onCloseCompose:C,onPick:e=>{r(e),a(!0)},onOpen:()=>{o||1!==k.length||r(k[0].id),a(!0)}})})}),er=e=>"waiting"===e.status;function ei({bots:e,rows:n,waiting:a,count:o,busy:r,pending:i,beat:l,composing:u,onCompose:m,onCloseCompose:x,onPick:p,onOpen:f}){let h=function({count:e,busy:t,pending:n}){return n>0?{text:1===n?"waiting on you":`${n} waiting on you`,tone:J.WAITING_INK,shine:"amber"}:t>0?{text:1===t?"working":`${t} running`,tone:"text-muted-foreground",shine:"muted"}:e>0?{text:"all done",tone:"text-muted-foreground"}:{text:"no jobs yet",tone:"text-muted-foreground"}}({count:o,busy:r,pending:i}),b=u||i>0;return(0,t.jsxs)("div",{className:(0,J.cn)("pointer-events-auto w-fit max-w-full overflow-hidden bg-background/78 ring-1 ring-border/50 backdrop-blur-md transition-shadow duration-300",b?"min-w-96 rounded-3xl shadow-lg shadow-black/8":"rounded-full shadow-sm shadow-black/3"),children:[(0,t.jsx)("div",{className:(0,J.cn)("grid transition-[grid-template-rows] duration-300 ease-out",b?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:(0,t.jsx)("div",{className:"min-h-0 overflow-hidden",inert:!b,children:u?(0,t.jsx)(ec,{bots:e,onDone:x}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("p",{className:"flex items-center gap-2 px-3 py-2 font-mono text-[10px] tracking-wide text-muted-foreground",children:[(0,t.jsxs)("span",{className:"flex-1",children:["needs you · ",i]}),(0,t.jsx)(ed,{onClick:m})]}),(0,t.jsx)("div",{className:"px-1.5 pb-2",children:n.map(e=>(0,t.jsx)(eC,{task:e,onPick:()=>p(e.id)},e.id))}),(0,t.jsx)("span",{className:"block h-1.5"})]})})}),(0,t.jsxs)("div",{className:(0,J.cn)("flex items-center gap-2 px-3 py-1.5"),children:[(0,t.jsxs)("button",{type:"button",onClick:f,"aria-label":o?`Tasks (${o})`:"Bots",className:"flex min-w-0 flex-1 items-center gap-2 rounded-full text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)(ex,{bots:e,waiting:a,only:l?.bot}),(0,t.jsxs)("span",{className:"flex h-7 min-w-0 flex-1 items-center",children:[(0,t.jsx)(el,{on:!!l,children:(0,t.jsxs)("span",{className:"flex items-center gap-1.5 whitespace-nowrap",children:[(0,t.jsx)("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground/70",children:l?.label}),l?.live?(0,t.jsx)(g.default,{text:l.what,speed:2.4,color:"var(--muted-foreground)",shineColor:"var(--foreground)",className:"min-w-0 truncate text-[14px] leading-5 tracking-[-0.15px]"}):(0,t.jsx)("span",{className:(0,J.cn)("min-w-0 truncate text-[14px] leading-5 tracking-[-0.15px]",l?.tone??"text-foreground"),children:l?.what})]})}),(0,t.jsx)(el,{on:!l,children:h.shine?(0,t.jsx)("span",{className:(0,J.cn)("block","amber"===h.shine?"[--rest:var(--color-amber-700)] [--shine:var(--color-amber-400)] dark:[--rest:var(--color-amber-400)] dark:[--shine:var(--color-amber-100)]":"[--rest:var(--muted-foreground)] [--shine:var(--foreground)]"),children:(0,t.jsx)(g.default,{text:h.text,speed:2.6,color:"var(--rest)",shineColor:"var(--shine)",className:"truncate text-[14px] leading-5 tracking-[-0.15px]"})}):(0,t.jsx)("span",{className:(0,J.cn)("block animate-in truncate text-[14px] leading-5 tracking-[-0.15px] fade-in duration-300",h.tone),children:h.text},h.text)})]})]}),u&&(0,t.jsx)(eu,{onClick:x,label:"Cancel the message",children:(0,t.jsx)(c.X,{className:"size-3.5"})}),!u&&0===i&&r>0&&(0,t.jsx)(d.Loader2,{className:"size-4 shrink-0 animate-spin text-muted-foreground/70"}),!u&&0===i&&0===r&&o>0&&(0,t.jsx)(s.Check,{className:"size-4 shrink-0 text-muted-foreground/60"})]})]})}function el({on:e,children:n}){return(0,t.jsx)("span",{className:(0,J.cn)("grid min-w-0 transition-[grid-template-columns,opacity] duration-200 ease-out",e?"grid-cols-[1fr] opacity-100":"grid-cols-[0fr] opacity-0"),children:(0,t.jsx)("span",{className:"min-w-0 overflow-hidden",children:n})})}function ed({onClick:e}){return(0,t.jsx)(eu,{onClick:e,label:"Message a bot",children:(0,t.jsx)(u.Plus,{className:"size-4"})})}function eu({onClick:e,label:n,children:s}){return(0,t.jsx)("button",{type:"button",onClick:e,"aria-label":n,className:"grid size-7 shrink-0 place-items-center rounded-full text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:s})}function ec({bots:e,onDone:s}){let[r,i]=(0,m.useState)(null),[l,u]=(0,m.useState)(""),[c,p]=(0,G.useServerAction)(N.startTaskAction,{onOk:()=>{(0,X.revalidate)(x.queryKey.tasks),s()}}),h=e?.length?e.map(e=>({name:e.name,icon:e.icon})):[{name:w.DEFAULT_BOT.name,icon:w.DEFAULT_BOT.icon}],b=()=>{r&&l.trim()&&!p&&c(r.name,l.trim())};return r?(0,t.jsxs)("div",{className:"flex min-h-32 flex-col pb-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 pt-3 pb-2",children:[(0,t.jsx)("button",{type:"button",onClick:()=>i(null),"aria-label":"Choose a different bot",className:"grid size-6 shrink-0 place-items-center rounded-lg text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,t.jsx)(a.ChevronLeft,{className:"size-3.5"})}),(0,t.jsx)(C.BotMark,{size:22,seed:r.name,vary:r.name,color:r.icon?.color,shape:r.icon?.shape,outline:r.icon?.outline,className:"shrink-0"}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 truncate text-[12.5px] font-medium",children:["To ",r.name]})]}),(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault(),b()},className:"mx-3 mt-auto flex items-end gap-1 rounded-2xl bg-background py-2 pr-2 pl-3 ring-1 ring-border/80 transition-shadow focus-within:ring-ring/60",children:[(0,t.jsx)(k.Textarea,{value:l,rows:1,autoFocus:!0,disabled:p,onChange:e=>u(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||229===e.keyCode||(e.preventDefault(),b())},placeholder:`What should ${r.name} do? It cannot hear the call, so say the whole job.`,"aria-label":`Message for ${r.name}`,className:"max-h-32 min-h-15 flex-1 resize-none border-0 bg-transparent px-0 py-0 text-[13px] leading-5 shadow-none focus-visible:ring-0 dark:bg-transparent"}),(0,t.jsx)(f.Button,{type:"submit",size:"icon-sm",variant:l.trim()?"default":"ghost",disabled:!l.trim()||p,"aria-label":"Send",className:"rounded-full",children:p?(0,t.jsx)(d.Loader2,{className:"animate-spin"}):(0,t.jsx)(n.ArrowUp,{})})]})]}):(0,t.jsxs)("div",{className:"min-h-32 pb-3",children:[(0,t.jsx)("p",{className:"px-3 pt-3 pb-1.5 font-mono text-[10px] tracking-wide text-muted-foreground",children:"message a bot"}),(0,t.jsx)("div",{className:"px-1",children:h.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>i(e),className:"flex w-full items-center gap-2.5 rounded-xl px-2 py-1.5 text-left outline-none transition-colors hover:bg-muted/60 focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)(C.BotMark,{size:22,seed:e.name,vary:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,className:"shrink-0"}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate text-[13px]",children:e.name}),(0,t.jsx)(o.ChevronRight,{className:"size-3.5 shrink-0 text-muted-foreground/50"})]},e.name))})]})}let em=["alto","brio","cinder","delta"].map((e,t)=>({key:e,seed:e,color:es.MARK_PALETTE[Math.floor(t*es.MARK_PALETTE.length/4)],shape:es.MARK_SHAPES[t%es.MARK_SHAPES.length],outline:void 0}));function ex({bots:e,waiting:n=[],only:s}){let a=e?.length?e.map(e=>({key:e.name,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,notify:!1})):em.map(e=>({...e,notify:!1})),o=n.map(e=>({key:e.name,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,notify:!0})),r=[...o,...a.filter(e=>!o.some(t=>t.key===e.key))].map(e=>({...e,standIn:!1})),i=em.filter(e=>!r.some(t=>t.key===e.key)).slice(0,Math.max(0,3-r.length)).map(e=>({...e,notify:!1,standIn:!0})),l=[...r,...i].slice(0,4);return(0,t.jsx)("span",{className:(0,J.cn)("flex shrink-0 items-center",!e?.length&&!o.length&&"opacity-50"),children:l.map((e,n)=>(0,t.jsx)("span",{className:(0,J.cn)("origin-right transition-[margin,opacity,transform] duration-300 ease-out",n>0&&"-ml-2",e.standIn&&"opacity-35",s&&e.key!==s&&"-ml-[28px] scale-50 opacity-0"),style:{zIndex:l.length-n},children:(0,t.jsx)(C.BotMark,{size:28,seed:e.seed,vary:e.seed,color:e.color,shape:e.shape,outline:e.outline,notify:e.notify})},e.key))})}function ep({onClick:e}){return(0,t.jsx)("button",{type:"button",onClick:e,"aria-label":"Fold the room away",className:"grid size-7 shrink-0 place-items-center rounded-full bg-muted text-foreground outline-none transition-colors hover:bg-muted-foreground/20 focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,t.jsx)(c.X,{className:"size-3.5"})})}function ef({count:e,pending:n,composing:s,onCompose:a,onClose:o}){return(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3.5 pt-3 pb-1.5",children:[(0,t.jsx)("span",{className:"text-[13px] font-medium",children:"Tasks"}),e>0&&!s&&(0,t.jsx)("span",{className:"font-mono text-[10px] text-muted-foreground tabular-nums",children:n>0?`${n} for you \xb7 ${e}`:e}),(0,t.jsx)("span",{className:"flex-1"}),!s&&(0,t.jsx)(ed,{onClick:a}),(0,t.jsx)(ep,{onClick:o})]})}function eh({task:e,onBack:n,onClose:s}){return(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 pt-3 pb-1",children:[(0,t.jsx)("button",{type:"button",onClick:n,"aria-label":"Back to the list",className:"shrink-0 rounded-md p-1 text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,t.jsx)(a.ChevronLeft,{className:"size-4"})}),(0,t.jsx)(C.BotMark,{size:22,seed:e.bot.name,vary:e.id,color:e.bot.icon?.color,shape:e.bot.icon?.shape,outline:e.bot.icon?.outline,notify:!1}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 truncate text-[13px] font-medium",children:[e.label,(0,t.jsx)("span",{title:e.id,className:"ml-1.5 font-mono text-[10px] font-normal text-muted-foreground/60",children:e.id.slice(0,8)})]}),(0,t.jsx)(eb,{usage:e.tokens}),(0,t.jsx)(eg,{task:e}),(0,t.jsx)(ev,{task:e}),(0,t.jsx)(ep,{onClick:s})]})}function eb({usage:e}){let n=e.input+e.output;return n?(0,t.jsx)("span",{title:`in ${(0,J.formatCount)(e.input)} \xb7 out ${(0,J.formatCount)(e.output)}`,className:"shrink-0 font-mono text-[10px] text-muted-foreground/70 tabular-nums",children:(0,J.formatCount)(n)}):null}function eg({task:e}){let{contextTokens:n,contextBudget:s}=e;if(!n||!s)return null;let a=Math.min(1,n/s);return(0,t.jsx)("span",{title:`Context ${(0,J.formatCount)(n)} of ${(0,J.formatCount)(s)} — it summarizes itself here`,className:"block h-[3px] w-9 shrink-0 overflow-hidden rounded-full bg-muted",children:(0,t.jsx)("span",{className:(0,J.cn)("block h-full rounded-full",a>.9?"bg-amber-500/80":"bg-muted-foreground/70"),style:{width:`${Math.max(4,Math.round(100*a))}%`}})})}let ek={working:"text-muted-foreground",waiting:J.WAITING_INK,done:"text-foreground",failed:"text-destructive"};function ev({task:e}){let n="done"===e.status&&e.relayed?"text-muted-foreground":ek[e.status];return"working"===e.status?(0,t.jsx)(g.default,{text:"working",speed:2.2,color:"var(--muted-foreground)",shineColor:"var(--foreground)",className:"shrink-0 font-mono text-[10px]"}):(0,t.jsx)("span",{className:(0,J.cn)("flex shrink-0 items-center gap-1.5 font-mono text-[10px]",n),children:e.status})}function ej({bots:e}){return(0,t.jsxs)("div",{className:"flex flex-col items-center gap-3 px-6 pt-3 pb-4 text-center",children:[(0,t.jsx)(ex,{bots:e}),e?.length?(0,t.jsx)("p",{className:"text-[12px] text-muted-foreground",children:"Nothing handed over yet — ask for something that takes a while."}):(0,t.jsxs)("p",{className:"text-[12px] text-muted-foreground",children:["Thursday hands work to ",w.DEFAULT_BOT.name," until you make bots of your own in Settings › Bots."]})]})}function ey(){return(0,t.jsx)("div",{className:"flex shrink-0 justify-end px-3 pb-2.5",children:(0,t.jsxs)("button",{type:"button",onClick:()=>(0,Z.openSettings)("tasks"),className:"flex items-center gap-1 rounded-md px-1.5 py-1 font-mono text-[10px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)(l.History,{className:"size-3"}),"History"]})})}let eN=[{id:"you",label:"needs you",holds:er},{id:"working",label:"working",holds:e=>"working"===e.status},{id:"done",label:"done",holds:()=>!0}];function ew({tasks:e,onPick:n}){let s=new Map;for(let t of e){let e=eN.find(e=>e.holds(t))??eN[2],n=s.get(e.id);n?n.push(t):s.set(e.id,[t])}return(0,t.jsx)("div",{className:"flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto px-2 pt-1 pb-1 scrollbar-none",children:eN.map((e,a)=>{let o=s.get(e.id)??[];return o.length?(0,t.jsxs)(m.Fragment,{children:[(0,t.jsxs)("p",{className:(0,J.cn)("px-2.5 pb-1 font-mono text-[10px] text-muted-foreground",0===a?"pt-1":"pt-3"),children:[e.label," · ",o.length]}),o.map(e=>(0,t.jsx)(eC,{task:e,onPick:()=>n(e.id)},e.id))]},e.id):null})})}function eC({task:e,onPick:n}){let s=er(e),a=e.lines.at(-1),o=(0,m.useMemo)(()=>eT(e),[e.status,e.outcome,e.relayed,e.ask,a?.id]),[i,l]=Q(),[u,c]=(0,m.useState)(null),x="waiting"===e.status?e.ask?.options??[]:[],p=(0,w.isBudgetAsk)(e.ask);return(0,t.jsxs)("div",{className:"rounded-xl transition-colors hover:bg-muted/60",children:[(0,t.jsxs)("button",{type:"button",onClick:n,className:"flex w-full items-center gap-2.5 rounded-xl px-2 py-1.5 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)("span",{className:"relative flex size-8 shrink-0 items-center justify-center overflow-visible",title:e.bot.name,children:(0,t.jsx)(C.BotMark,{size:32,seed:e.bot.name,vary:e.id,color:e.bot.icon?.color,shape:e.bot.icon?.shape,outline:e.bot.icon?.outline,state:"working"===e.status?"thinking":"idle",notify:s})}),(0,t.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("span",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("span",{className:(0,J.cn)("min-w-0 truncate text-[14px] leading-5 tracking-[-0.15px]",s?"text-foreground":"text-foreground/80"),children:e.label}),(0,t.jsx)(T.BotRoster,{bots:H(e),taskId:e.id}),(0,t.jsx)("span",{className:"flex-1"}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-[11px] leading-4 text-muted-foreground/70 tabular-nums",children:(0,et.shortAgo)(e.updatedAt)})]}),(0,t.jsxs)("span",{className:"mt-px flex h-4 items-center gap-1.5",children:["working"===e.status&&(0,t.jsx)(d.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground/70"}),"working"===e.status?(0,t.jsx)(g.default,{text:o.text,speed:2.2,color:"var(--muted-foreground)",shineColor:"var(--foreground)",className:(0,J.cn)("min-w-0 flex-1 truncate text-[12px] leading-4",o.tone)}):(0,t.jsx)("span",{className:(0,J.cn)("min-w-0 flex-1 truncate text-[12px] leading-4",o.tone),children:o.text})]})]})]}),x.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5 pt-0.5 pr-2 pb-2 pl-12.5",children:x.map(n=>(0,t.jsxs)(f.Button,{size:"sm",variant:"outline",loading:u===n,disabled:l,onClick:async()=>{c(n),await i(e,n),c(null)},className:(0,J.cn)("h-7 gap-1.5 rounded-full bg-background px-3 text-[12px]",!p&&"border-amber-500/35"),children:[p&&n===w.TASK_CONTINUE&&(0,t.jsx)(r.ChevronsRight,{className:"size-3.5 text-muted-foreground"}),n,p&&n===w.TASK_CONTINUE&&(0,t.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground",children:["+",j.BOT_RUN.steps," steps"]})]},n))})]})}function eT(e){if("waiting"===e.status&&e.ask)return(0,w.isBudgetAsk)(e.ask)?{text:(0,J.plainText)(e.outcome??e.ask.question),tone:"text-muted-foreground"}:{text:e.ask.question,tone:J.WAITING_INK};if("failed"===e.status)return{text:(0,J.plainText)(e.outcome??"Failed"),tone:"text-destructive"};if("done"===e.status)return{text:(0,J.plainText)(e.outcome??"Done"),tone:e.relayed?"text-muted-foreground":"text-foreground"};let t=q(e);return t?{text:"tool"===t.kind&&t.tool?t.tool.note??`${t.tool.name} \xb7 ${t.tool.input}`:t.text,tone:"text-muted-foreground"}:{text:`${e.bot.name} is taking it on…`,tone:"text-muted-foreground italic"}}function ez({task:e,className:n}){let s=(0,m.useRef)(null),a=(0,m.useRef)(!0);return(0,m.useEffect)(()=>{a.current=!0},[e.id]),(0,m.useEffect)(()=>{let e=s.current;e&&a.current&&(e.scrollTop=e.scrollHeight)},[e.lines,e.status]),(0,t.jsx)(ee.FileViewer,{children:(0,t.jsxs)("div",{ref:s,onScroll:e=>{let t=e.currentTarget;a.current=t.scrollHeight-t.scrollTop-t.clientHeight<24},className:(0,J.cn)("max-h-[64vh] space-y-3 overflow-y-auto px-4 pt-6 pb-4 mask-[linear-gradient(to_bottom,transparent,black_2rem)] scrollbar-none",n),children:[(0,t.jsx)(eS,{task:e}),V(e).map(n=>"invite"===n.kind?(0,t.jsx)(eM,{from:n.from,to:n.to},n.key):(0,t.jsx)(eI,{group:n.group,task:e},n.key)),"working"===e.status&&0===e.lines.length&&(0,t.jsx)(g.default,{text:`${e.bot.name} is taking it on…`,speed:2.2,color:"var(--muted-foreground)",shineColor:"var(--foreground)",className:"block px-1 font-mono text-[10px]"})]})})}function eS({task:e}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eM,{from:eA,to:e.bot}),(0,t.jsx)(e_,{children:(0,t.jsx)(p.Bubble,{align:"end",className:"max-w-full",children:(0,t.jsx)(p.BubbleContent,{className:"rounded-tr-md py-2 pr-2 pl-3.5",children:(0,t.jsx)(h.FoldedText,{text:e.request,subject:"request"})})})})]})}let eA={name:"Thursday"};function eM({from:e,to:n}){return(0,t.jsx)("div",{className:"flex animate-in justify-center fade-in duration-300",children:(0,t.jsxs)("span",{className:"flex max-w-full items-center gap-1.5 rounded-full bg-muted px-2.5 py-1 font-mono text-[10px] text-muted-foreground",children:[(0,t.jsx)(eB,{bot:e}),(0,t.jsx)("span",{className:"shrink-0 text-muted-foreground/70",children:"invited"}),(0,t.jsx)(eB,{bot:n})]})})}function eB({bot:e}){return(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,t.jsx)(C.BotMark,{size:15,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,notify:!1,className:"shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]})}function e_({children:e}){return(0,t.jsx)(eR,{side:"end",name:"Thursday",mark:(0,t.jsx)(C.BotMark,{size:26,seed:"thursday",notify:!1,className:"mt-1 shrink-0"}),children:e})}function eR({side:e,mark:n,name:s,children:a}){return(0,t.jsxs)("div",{className:(0,J.cn)("flex gap-2.5","end"===e&&"flex-row-reverse"),children:[n,(0,t.jsxs)("div",{className:(0,J.cn)("flex min-w-0 flex-1 flex-col gap-1.5 [&>*+*]:max-w-[80%]","end"===e&&"items-end"),children:[(0,t.jsx)("p",{className:"max-w-[80%] truncate px-1 font-mono text-[10px] text-muted-foreground",children:s}),a]})]})}function eI({group:e,task:n}){return e.lines[0]?.kind==="user"?(0,t.jsx)("div",{className:"animate-in fade-in slide-in-from-bottom-2 duration-300",children:(0,t.jsx)(e_,{children:e.lines.map(e=>(0,t.jsx)(p.Bubble,{align:"end",className:"max-w-full",children:(0,t.jsx)(p.BubbleContent,{className:"rounded-tr-md px-3.5 text-[13px] leading-snug break-keep",children:e.text})},e.id))})}):(0,t.jsx)("div",{className:"animate-in fade-in slide-in-from-bottom-2 duration-300",children:(0,t.jsx)(eR,{side:e.bot.name===n.bot.name?"start":"end",name:e.bot.name,mark:(0,t.jsx)(C.BotMark,{size:26,seed:e.bot.name,vary:n.id,color:e.bot.icon?.color,shape:e.bot.icon?.shape,outline:e.bot.icon?.outline,notify:!1,className:"mt-1 shrink-0"}),children:(function(e){let t=[];for(let n of e){let e="tool"===n.kind&&n.tool?"tools":"said",s=t.at(-1);s&&s.kind===e?s.lines.push(n):t.push({kind:e,key:n.id,lines:[n]})}return t})(e.lines).map(e=>"tools"===e.kind?(0,t.jsx)(eq,{lines:e.lines,taskId:n.id},e.key):e.lines.map(e=>(0,t.jsx)(eE,{line:e,taskId:n.id},e.id)))})})}function eE({line:e,taskId:n}){if("tool"===e.kind&&e.tool)return(0,t.jsx)(ea.BotTool,{tool:e.tool,taskId:n});if("note"===e.kind)return(0,t.jsxs)("details",{className:"w-full py-1 text-muted-foreground",children:[(0,t.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2.5 outline-none [&::-webkit-details-marker]:hidden",children:[(0,t.jsx)("span",{className:"h-px flex-1 bg-border"}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-[10px]",children:"Compacted — it goes on from its summary"}),(0,t.jsx)("span",{className:"h-px flex-1 bg-border"})]}),(0,t.jsx)("p",{className:"mt-2 rounded-xl bg-muted/40 px-3 py-2 text-[11px] leading-relaxed whitespace-pre-wrap break-keep",children:e.text})]});if(!P(e))return(0,t.jsx)("p",{className:"px-1 text-[12.5px] leading-relaxed break-keep text-muted-foreground",children:e.text});if(e.options)return(0,t.jsxs)("div",{className:"w-fit max-w-full space-y-1.5 rounded-2xl bg-amber-500/8 px-3 py-2 ring-1 ring-amber-500/25",children:[(0,t.jsx)("p",{className:"text-[13px] leading-snug break-keep",children:e.text}),e.options.length>0&&(0,t.jsx)("p",{className:"flex flex-wrap gap-1",children:e.options.map(e=>(0,t.jsx)("span",{className:"rounded-full bg-background/70 px-2 py-0.5 font-mono text-[10px] text-muted-foreground",children:e},e))})]});let s="error"===e.kind;return(0,t.jsxs)("div",{className:"min-w-0 px-1",children:[s&&(0,t.jsxs)("p",{className:"mb-1.5 flex items-center gap-1.5 font-mono text-[10px] text-destructive",children:[(0,t.jsx)(c.X,{className:"size-3 shrink-0"}),"Could not finish"]}),(0,t.jsx)(b.Markdown,{className:(0,J.cn)("overflow-x-auto text-[13px] leading-relaxed break-keep [&_h1]:text-[15px] [&_h2]:text-[14px] [&_h3]:text-[13px] [&_h3]:font-semibold [&_li]:my-0.5 [&_table]:text-[12px] [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",s&&"text-destructive"),children:e.text}),(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,t.jsx)(z.PathChips,{text:e.text,className:"min-w-0"}),!s&&(0,t.jsx)("span",{className:"ml-auto shrink-0",children:(0,t.jsx)(e$,{text:e.text})})]})]})}function e$({text:e}){let[n,a]=(0,m.useState)(!1),o=(0,m.useRef)(null);return(0,m.useEffect)(()=>()=>{o.current&&clearTimeout(o.current)},[]),(0,t.jsx)("button",{type:"button","aria-label":"Copy the report",onClick:async()=>{try{await navigator.clipboard.writeText(e),a(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>a(!1),1400)}catch(e){v.toast.add({type:"error",title:"Could not copy the report",description:(0,J.errorToString)(e)})}},className:"grid size-5 shrink-0 place-items-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:n?(0,t.jsx)(s.Check,{className:"size-3"}):(0,t.jsx)(i.Copy,{className:"size-3"})})}function eq({lines:e,taskId:n}){return(0,t.jsxs)("div",{className:"flex w-full flex-col gap-0.5 rounded-2xl bg-muted/40 p-1",children:[e.length>1&&(0,t.jsxs)("p",{className:"px-2 py-1 font-mono text-[10px] text-muted-foreground",children:[e.length," steps"]}),e.map(e=>e.tool?(0,t.jsx)(ea.BotTool,{tool:e.tool,taskId:n,collapsed:!0},e.id):null)]})}e.s(["BotRoom",0,eo,"Conversation",0,ez],279265)},996272,e=>{"use strict";var t=e.i(95187);let n=(0,t.createServerReference)("7fc799595327176b60f83fed3c679f1a687ecca4fe",t.callServer,void 0,t.findSourceMapURL,"cancelTaskAction");e.s(["cancelTaskAction",0,n])},996632,e=>{"use strict";var t=e.i(95187);let n=(0,t.createServerReference)("7f6297eba857045d97a0b713eb1ebfbc273f39ed1d",t.callServer,void 0,t.findSourceMapURL,"answerTaskAction");e.s(["answerTaskAction",0,n])},96892,931619,508734,815731,496336,158774,562026,835878,764224,919191,e=>{"use strict";var t=e.i(456420);let n={name:"arrow-up",size:24,node:[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]};n.node;let s=(0,t.default)(n);e.s(["ArrowUp",0,s],96892);let a={name:"chevrons-right",size:24,node:[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]};a.node;let o=(0,t.default)(a);e.s(["ChevronsRight",0,o],931619);let r={name:"copy",size:24,node:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]};r.node;let i=(0,t.default)(r);e.s(["Copy",0,i],508734);var l=e.i(843476),d=e.i(176782),u=e.i(552245),c=e.i(225913),m=e.i(647163);let x=(0,c.cva)("group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full",{variants:{variant:{default:"*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80",secondary:"*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]",muted:"*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--muted),var(--foreground)_5%)]",tinted:"*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)] [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.88_calc(c*0.5)_h)] dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.35_calc(c*0.5)_h)]",outline:"*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-input/30",ghost:"border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/50",destructive:"*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive dark:*:data-[slot=bubble-content]:bg-destructive/20 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20 dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/30"}},defaultVariants:{variant:"default"}});(0,c.cva)("absolute z-10 flex w-fit shrink-0 items-center justify-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-sm ring-3 ring-card has-[button]:p-0",{variants:{side:{top:"top-0 -translate-y-3/4",bottom:"bottom-0 translate-y-3/4"},align:{start:"left-3",end:"right-3"}},defaultVariants:{side:"bottom",align:"end"}}),e.s(["Bubble",0,function({variant:e="default",align:t="start",className:n,...s}){return(0,l.jsx)("div",{"data-slot":"bubble","data-variant":e,"data-align":t,className:(0,m.cn)(x({variant:e}),n),...s})},"BubbleContent",0,function({className:e,render:t,...n}){var s;return s={defaultTagName:"div",props:(0,d.mergeProps)({className:(0,m.cn)("w-fit max-w-full min-w-0 overflow-hidden rounded-xl border border-transparent px-3 py-2 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/50",e)},n),render:t,state:{slot:"bubble-content"}},(0,u.useRenderElement)(s.defaultTagName??"div",s,s)}],815731);var p=e.i(716327),f=e.i(271645);e.s(["FoldedText",0,function({text:e,subject:t,clamp:n="line-clamp-3",tall:s="max-h-40",className:a}){let[o,r]=(0,f.useState)(!1),[i,d]=(0,f.useState)(!1),u=(0,f.useRef)(null);return(0,f.useEffect)(()=>r(!1),[e]),(0,f.useEffect)(()=>{let e=u.current;e&&!o&&d(e.scrollHeight>e.clientHeight+1)},[o,e]),(0,l.jsxs)("div",{className:(0,m.cn)("flex items-start gap-1",a),children:[(0,l.jsx)("p",{ref:u,className:(0,m.cn)("min-w-0 flex-1 text-[13px] leading-snug break-keep",o?(0,m.cn)(s,"overflow-y-auto scrollbar-none"):n),children:e}),(i||o)&&(0,l.jsx)("button",{type:"button",onClick:()=>r(e=>!e),"aria-label":o?`Fold the ${t}`:`Read the whole ${t}`,className:"shrink-0 rounded-md p-0.5 opacity-60 outline-none transition-opacity hover:opacity-100 focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,l.jsx)(p.ChevronDown,{className:(0,m.cn)("size-3.5",o&&"rotate-180")})})]})}],496336);var h=e.i(95187);let b=(0,h.createServerReference)("7f26ed34628aa747f4041e3b9f2728a7554015982d",h.callServer,void 0,h.findSourceMapURL,"markReportedAction");e.s(["markReportedAction",0,b],158774);let g=(0,h.createServerReference)("7f9fe74599a3a42962491399d55e9fc8e17f39eb51",h.callServer,void 0,h.findSourceMapURL,"startTaskAction");e.s(["startTaskAction",0,g],562026);var k=e.i(635963);e.s(["BotRoster",0,function({bots:e,taskId:t}){return e.length<2?null:(0,l.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",title:e.map(e=>e.name).join(", "),children:[(0,l.jsx)("span",{className:"flex items-center",children:e.slice(0,3).map(e=>(0,l.jsx)(k.BotMark,{size:18,seed:e.name,vary:t,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,notify:!1,className:"-ml-[3px] rounded-[7px] ring-2 ring-background first:ml-0"},e.name))}),(0,l.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground",children:[e.length," bots"]})]})}],835878);var v=e.i(829600);let j={name:"file-code",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]]};j.node;let y=(0,t.default)(j),N={name:"file-image",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]};N.node;let w=(0,t.default)(N);var C=e.i(905015);let T={name:"file-spreadsheet",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]};T.node;let z=(0,t.default)(T);var S=e.i(226091);let A={name:"file-type",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M11 18h2",key:"12mj7e"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5",key:"qbrxap"}]]};A.node;let M=(0,t.default)(A);var B=e.i(621285),_=e.i(616172);let R={markdown:S.FileText,csv:z,json:C.FileJson,text:M,image:w};e.s(["PathChips",0,function({text:e,className:t}){let n=(0,f.useMemo)(()=>(0,_.pathsIn)(e),[e]);return n.length?(0,l.jsx)("div",{className:(0,m.cn)("flex flex-wrap gap-1.5",t),children:n.map(e=>{let t,n=e.split("/").pop()??e,s="frame"===(t=(0,_.viewKindOf)(e))?e.toLowerCase().endsWith(".pdf")?S.FileText:y:R[t]??v.File;return(0,l.jsxs)(B.FileLink,{path:e,className:"flex max-w-full items-center gap-1.5 rounded-full bg-muted/70 py-1 pr-2.5 pl-2 font-mono text-[11px] text-foreground/80 outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,l.jsx)(s,{className:"size-3 shrink-0 text-muted-foreground"}),(0,l.jsx)("span",{className:"truncate",children:n})]},e)})}):null}],764224);let I={name:"corner-down-left",size:24,node:[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]]};I.node;let E=(0,t.default)(I);e.s(["CornerDownLeft",0,E],919191)},929272,e=>{"use strict";var t=e.i(456420);let n={name:"square",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]};n.node;let s=(0,t.default)(n);e.s(["Square",0,s],929272)}]);
|