heyio 1.10.5 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/api/server.js +13 -5
  2. package/dist/copilot/agents.js +19 -33
  3. package/dist/copilot/model-router.js +3 -1
  4. package/dist/copilot/specialist-runner.js +2 -8
  5. package/dist/copilot/token-tracker.js +11 -2
  6. package/dist/logging.js +27 -0
  7. package/dist/notify.js +3 -2
  8. package/dist/store/conversations.js +3 -1
  9. package/dist/store/instances.js +5 -3
  10. package/dist/telegram/handlers.js +3 -1
  11. package/package.json +1 -1
  12. package/web-dist/assets/{AuditLogView-woN7ioIn.js → AuditLogView-D_hjbFeU.js} +1 -1
  13. package/web-dist/assets/ChatView-XB4VHKWa.js +1 -0
  14. package/web-dist/assets/{FeedView-CM_NchwM.js → FeedView-CWkQ5pic.js} +1 -1
  15. package/web-dist/assets/{HistoryView-gv3hNNaR.js → HistoryView-vzl7hv9X.js} +1 -1
  16. package/web-dist/assets/{LoginView-D6FxlFTp.js → LoginView-DN9HNjvR.js} +1 -1
  17. package/web-dist/assets/McpView-DpT5UTzd.js +1 -0
  18. package/web-dist/assets/SchedulesView-CuK5-pZx.js +6 -0
  19. package/web-dist/assets/SettingsView-a1mw0ZH-.js +1 -0
  20. package/web-dist/assets/{SkillsView-VJut_N_L.js → SkillsView-B6iRMrFO.js} +4 -4
  21. package/web-dist/assets/{SquadDetailView-D8DZ_Ikj.js → SquadDetailView-CO8XPLyf.js} +3 -3
  22. package/web-dist/assets/{SquadHealthView-PV7ZI5SM.js → SquadHealthView-BxoGpUhr.js} +1 -1
  23. package/web-dist/assets/{SquadsView-gLvCqdRU.js → SquadsView-DzzR00S-.js} +1 -1
  24. package/web-dist/assets/{ToggleSwitch.vue_vue_type_script_setup_true_lang-CaTy4iAc.js → ToggleSwitch.vue_vue_type_script_setup_true_lang-BdCOFRaC.js} +1 -1
  25. package/web-dist/assets/{UsageView-CNL9uMUZ.js → UsageView-BE_TxjDe.js} +1 -1
  26. package/web-dist/assets/{WikiView-Cf-4O99a.js → WikiView-BiM180c8.js} +2 -2
  27. package/web-dist/assets/{api-qgb8ODgh.js → api-DthBzc-F.js} +1 -1
  28. package/web-dist/assets/{arrow-left-BaiHJkhe.js → arrow-left-DazIIlN_.js} +1 -1
  29. package/web-dist/assets/{git-branch-BG_ozkFm.js → git-branch-BDJQ9Lx3.js} +1 -1
  30. package/web-dist/assets/{index-CCZu8Q1C.js → index-BGLdlKTT.js} +61 -66
  31. package/web-dist/assets/index-vcgp2T40.css +1 -0
  32. package/web-dist/assets/pencil-aJ0SIjrw.js +6 -0
  33. package/web-dist/assets/{plus-Ca2bOAAz.js → plus-BQd_XYgK.js} +1 -1
  34. package/web-dist/assets/save-CQegsgKM.js +6 -0
  35. package/web-dist/assets/{search-BHoRZUY-.js → search-tP42aLoo.js} +1 -1
  36. package/web-dist/assets/{trash-2-B0cHPT2B.js → trash-2-dt2YqJne.js} +1 -1
  37. package/web-dist/assets/{triangle-alert-B7rUnBx3.js → triangle-alert-_B-01mAe.js} +1 -1
  38. package/web-dist/assets/x-DgnyxyzU.js +6 -0
  39. package/web-dist/index.html +2 -2
  40. package/web-dist/assets/ChatView-CWuu7kcL.js +0 -1
  41. package/web-dist/assets/McpView-DfZEvnpw.js +0 -1
  42. package/web-dist/assets/SchedulesView-BCoRLLIP.js +0 -6
  43. package/web-dist/assets/SettingsView-CsNOtTbL.js +0 -1
  44. package/web-dist/assets/index-c_ZAglfK.css +0 -1
  45. package/web-dist/assets/save-BYzmOVHA.js +0 -11
@@ -1,9 +1,9 @@
1
- import{r as A,u as J,a3 as F,E as z,y as E,G,J as s,q as o,n as t,t as p,T as c,A as B,z as _,R as i,j as O,s as h,p as v,o as I,X as H,d as C,L as D,l as R,K as m,m as U,a4 as X,D as Z,Y as K,N as Q,U as W}from"./index-CCZu8Q1C.js";import{b as P,e as Y,c as V,a as ee}from"./api-qgb8ODgh.js";import{g as te}from"./squad-colors-B8B_Y-lz.js";import{G as se}from"./git-branch-BG_ozkFm.js";import{T as oe}from"./trash-2-B0cHPT2B.js";import{A as ae}from"./arrow-left-BaiHJkhe.js";/**
1
+ import{r as A,u as J,a2 as F,E as z,y as E,G,J as s,q as o,n as t,t as p,T as c,A as B,z as _,R as i,j as O,s as h,p as v,o as I,d as C,L as D,l as R,K as m,m as H,a3 as U,D as X,X as Z,N as K,U as Q}from"./index-BGLdlKTT.js";import{b as P,e as W,c as V,a as Y}from"./api-DthBzc-F.js";import{g as ee}from"./squad-colors-B8B_Y-lz.js";import{X as te}from"./x-DgnyxyzU.js";import{G as se}from"./git-branch-BDJQ9Lx3.js";import{T as oe}from"./trash-2-dt2YqJne.js";import{A as re}from"./arrow-left-DazIIlN_.js";/**
2
2
  * @license lucide-vue-next v0.474.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const re=A("EyeIcon",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
6
+ */const ae=A("EyeIcon",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
7
7
  * @license lucide-vue-next v0.474.0 - ISC
8
8
  *
9
9
  * This source code is licensed under the ISC license.
@@ -23,4 +23,4 @@ import{r as A,u as J,a3 as F,E as z,y as E,G,J as s,q as o,n as t,t as p,T as c,
23
23
  *
24
24
  * This source code is licensed under the ISC license.
25
25
  * See the LICENSE file in the root directory of this source tree.
26
- */const de=A("ToggleRightIcon",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"16",cy:"12",r:"2",key:"4ma0v8"}]]),ue={class:"flex flex-col h-full border border-border rounded-lg overflow-hidden bg-background"},ce={class:"flex items-center justify-between px-4 py-3 border-b border-border bg-muted/30"},pe={class:"flex items-center gap-2 min-w-0"},me={class:"flex items-center gap-2"},xe=["disabled"],fe=["aria-label","title"],ge={class:"px-4 py-2 text-xs text-muted-foreground border-b border-border bg-muted/10 truncate"},ye={key:0,class:"text-muted-foreground text-xs"},be={key:1,class:"text-muted-foreground text-xs"},ve={class:"flex items-center justify-between mb-1"},he={class:"text-xs font-medium text-muted-foreground uppercase tracking-wide"},we={class:"text-xs text-muted-foreground"},_e={key:0,class:"text-xs bg-muted rounded p-2 overflow-x-auto whitespace-pre-wrap break-all"},ke={key:1},Se={key:1,class:"text-sm"},$e={key:2,class:"border border-border border-l-2 border-l-yellow-500 rounded-lg p-3 animate-pulse"},Te={key:0,class:"text-xs bg-muted rounded p-2 overflow-x-auto whitespace-pre-wrap break-all"},Ce=J({__name:"AgentActivityPreview",props:{taskId:{},taskDescription:{},taskStatus:{}},emits:["close","stopped"],setup(f,{emit:L}){const x=f,S=L,w=m([]),u=m(!1),$=m(!0),g=m(!1),y=m();let d=null;const N=U(()=>w.value.filter(l=>l.summary.trim()!=="")),b=m("");async function k(){try{const l=await P(`/tasks/${x.taskId}/events`);w.value=l}finally{$.value=!1}}function T(){y.value&&(y.value.scrollTop=y.value.scrollHeight)}function M(){x.taskStatus!=="pending"&&x.taskStatus!=="in_progress"||(d=Y(),d.addEventListener("agent_event",l=>{const e=JSON.parse(l.data);e.taskId===x.taskId&&(e.type==="message_delta"?(b.value=e.summary??"",E(T)):(k().then(()=>E(T)),b.value=""))}))}async function q(){if(!g.value){g.value=!0;try{await V(`/tasks/${x.taskId}/stop`),S("stopped")}catch(l){console.error("Failed to stop agent:",l)}finally{g.value=!1}}}function r(l){switch(l){case"status":return"Status";case"message":return"Agent message";case"message_delta":return"Streaming…";default:return l}}function a(l){return new Date(l).toLocaleTimeString()}return F(()=>x.taskStatus,l=>{(l==="done"||l==="failed"||l==="stopped")&&(b.value="",k(),d&&(d.close(),d=null))}),z(()=>{k().then(()=>E(T)),M()}),G(()=>{d&&(d.close(),d=null)}),(l,e)=>(s(),o("div",ue,[t("div",ce,[t("div",pe,[p(c(B),{class:"w-4 h-4 text-primary flex-shrink-0"}),e[2]||(e[2]=t("h3",{class:"text-sm font-semibold truncate"},"Activity Preview",-1)),t("span",{class:_(["text-xs px-2 py-0.5 rounded-full flex-shrink-0",{"bg-yellow-500/10 text-yellow-500":f.taskStatus==="pending","bg-blue-500/10 text-blue-500":f.taskStatus==="in_progress","bg-green-500/10 text-green-500":f.taskStatus==="done","bg-red-500/10 text-red-500":f.taskStatus==="failed","bg-orange-500/10 text-orange-500":f.taskStatus==="stopped"}])},i(f.taskStatus),3)]),t("div",me,[f.taskStatus==="pending"||f.taskStatus==="in_progress"?(s(),o("button",{key:0,onClick:q,disabled:g.value,class:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded border border-red-500/50 text-red-500 hover:bg-red-500/10 transition-colors disabled:opacity-50 disabled:cursor-not-allowed","aria-label":"Stop agent",title:"Stop agent"},[p(c(O),{class:"w-3 h-3"}),h(" "+i(g.value?"Stopping…":"Stop"),1)],8,xe)):v("",!0),t("button",{onClick:e[0]||(e[0]=n=>u.value=!u.value),class:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors","aria-label":u.value?"Switch to human-readable view":"Switch to raw JSON view",title:u.value?"Switch to human-readable view":"Switch to raw JSON view"},[u.value?(s(),I(c(de),{key:1,class:"w-4 h-4 text-primary"})):(s(),I(c(ie),{key:0,class:"w-4 h-4"})),t("span",null,i(u.value?"Raw JSON":"Readable"),1)],8,fe),t("button",{onClick:e[1]||(e[1]=n=>S("close")),class:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors","aria-label":"Close preview",title:"Close preview"},[p(c(H),{class:"w-4 h-4"})])])]),t("div",ge,i(f.taskDescription),1),t("div",{ref_key:"feedContainer",ref:y,class:"flex-1 overflow-y-auto p-4 space-y-3 text-sm"},[$.value?(s(),o("div",ye,"Loading events…")):N.value.length===0&&!b.value?(s(),o("div",be," No events yet. The agent will start shortly. ")):v("",!0),(s(!0),o(C,null,D(N.value,n=>(s(),o("div",{key:n.id,class:_(["border border-border rounded-lg p-3",{"border-l-2 border-l-green-500":n.type==="status"&&n.summary.includes("completed"),"border-l-2 border-l-red-500":n.type==="status"&&n.summary.includes("failed"),"border-l-2 border-l-blue-500":n.type==="message","border-l-2 border-l-primary":n.type==="status"&&!n.summary.includes("completed")&&!n.summary.includes("failed")}])},[t("div",ve,[t("span",he,i(r(n.type)),1),t("span",we,i(a(n.created_at)),1)]),u.value?(s(),o("pre",_e,i(JSON.stringify(JSON.parse(n.payload),null,2)),1)):(s(),o("div",ke,[n.type==="message"?(s(),I(R,{key:0,content:n.summary,class:"text-sm"},null,8,["content"])):(s(),o("p",Se,i(n.summary),1))]))],2))),128)),b.value.trim()?(s(),o("div",$e,[e[3]||(e[3]=t("div",{class:"flex items-center justify-between mb-1"},[t("span",{class:"text-xs font-medium text-muted-foreground uppercase tracking-wide"}," Agent is responding… "),t("span",{class:"inline-block w-2 h-2 rounded-full bg-yellow-500 animate-ping"})],-1)),u.value?(s(),o("pre",Te,i(JSON.stringify({type:"message_delta",accumulated:b.value},null,2)),1)):(s(),I(R,{key:1,content:b.value,class:"text-sm"},null,8,["content"]))])):v("",!0)],512)]))}}),Ae={class:"p-6"},Ne={key:0,class:"text-muted-foreground"},Ie={class:"mb-6"},De={class:"text-muted-foreground"},Le={class:"mb-8"},Me={class:"border border-border rounded-lg overflow-hidden"},qe={class:"w-full text-sm"},Ee={class:"px-4 py-2 font-medium"},Re={class:"px-4 py-2 text-muted-foreground"},je={class:"px-4 py-2"},Je={class:"px-4 py-2 flex gap-1"},ze={key:0,class:"text-xs bg-primary/10 text-primary px-1.5 py-0.5 rounded"},Be={key:1,class:"text-xs bg-blue-500/10 text-blue-500 px-1.5 py-0.5 rounded"},Oe={key:2,class:"text-xs bg-purple-500/10 text-purple-500 px-1.5 py-0.5 rounded"},Pe={class:"mb-8"},Ve={class:"flex items-center justify-between mb-3"},Fe={key:0,class:"text-sm text-muted-foreground border border-border rounded-lg p-4 text-center"},Ge={key:1,class:"grid grid-cols-1 md:grid-cols-3 gap-3"},He={class:"flex items-center justify-between gap-2"},Ue={class:"flex items-center gap-1.5 min-w-0"},Xe={class:"text-sm font-medium truncate"},Ze={class:"flex items-center gap-1 text-xs text-muted-foreground"},Ke=["title"],Qe={class:"pt-1 border-t border-border"},We=["disabled","onClick"],Ye={key:0,class:"text-sm text-muted-foreground"},et={key:1,class:"space-y-2"},tt={class:"flex items-center justify-between"},st={class:"text-sm"},ot={class:"flex items-center gap-2"},at=["onClick","disabled"],rt=["onClick","aria-label","title"],lt={key:0,class:"mt-3 h-96"},j=3,mt=J({__name:"SquadDetailView",setup(f){const L=K(),x=m(null),S=m([]),w=m([]),u=m([]),$=m(!0),g=m(null),y=m(null),d=m(null);function N(r){d.value=r}function b(){d.value=null}function k(r){return r==="pending"||r==="in_progress"}async function T(r){if(!y.value){y.value=r;try{await V(`/tasks/${r}/stop`);const a=w.value.find(l=>l.id===r);a&&(a.status="stopped")}catch(a){console.error("Failed to stop task:",a)}finally{y.value=null}}}z(async()=>{try{const r=await P(`/squads/${L.params.id}`);x.value=r.squad,S.value=r.agents,w.value=r.tasks,u.value=r.instances}finally{$.value=!1}});async function M(r,a){if(confirm(`Destroy instance on branch "${a}"? This will remove the worktree.`)){g.value=r;try{await ee(`/instances/${r}`),u.value=u.value.filter(l=>l.id!==r)}finally{g.value=null}}}function q(r){if(!r)return"never";const a=r.replace(" ","T")+(r.includes("T")||r.endsWith("Z")?"":"Z"),l=Date.now()-new Date(a).getTime(),e=Math.floor(l/6e4);if(e<1)return"just now";if(e<60)return`${e}m ago`;const n=Math.floor(e/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}return(r,a)=>{const l=Q("router-link");return s(),o("div",Ae,[p(l,{to:"/squads",class:"inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground mb-4"},{default:X(()=>[p(c(ae),{class:"w-4 h-4"}),a[0]||(a[0]=h(" Back to Squads ",-1))]),_:1}),$.value?(s(),o("div",Ne,"Loading...")):x.value?(s(),o(C,{key:1},[t("div",Ie,[t("span",{class:"inline-flex items-center text-sm px-2.5 py-1 rounded-full font-medium mb-2 w-fit",style:Z(c(te)(x.value.color))},i(x.value.name),5),t("p",De,i(x.value.universe),1)]),t("section",Le,[a[5]||(a[5]=t("h2",{class:"text-lg font-semibold mb-3"},"Agent Roster",-1)),t("div",Me,[t("table",qe,[a[4]||(a[4]=t("thead",{class:"bg-muted"},[t("tr",null,[t("th",{class:"text-left px-4 py-2 font-medium"},"Character"),t("th",{class:"text-left px-4 py-2 font-medium"},"Role"),t("th",{class:"text-left px-4 py-2 font-medium"},"Status"),t("th",{class:"text-left px-4 py-2 font-medium"},"Flags")])],-1)),t("tbody",null,[(s(!0),o(C,null,D(S.value,e=>(s(),o("tr",{key:e.id,class:"border-t border-border"},[t("td",Ee,i(e.character_name),1),t("td",Re,i(e.role_title),1),t("td",je,[t("span",{class:_(["inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full",{"bg-green-500/10 text-green-500":e.status==="idle","bg-yellow-500/10 text-yellow-500":e.status==="working","bg-blue-500/10 text-blue-500":e.status==="reviewing"}])},i(e.status),3)]),t("td",Je,[e.is_lead?(s(),o("span",ze,[p(c(W),{class:"w-3 h-3 inline"}),a[1]||(a[1]=h(" Lead ",-1))])):v("",!0),e.is_qa?(s(),o("span",Be,[p(c(ne),{class:"w-3 h-3 inline"}),a[2]||(a[2]=h(" QA ",-1))])):v("",!0),e.is_test?(s(),o("span",Oe,[p(c(le),{class:"w-3 h-3 inline"}),a[3]||(a[3]=h(" Test ",-1))])):v("",!0)])]))),128))])])])]),t("section",Pe,[t("div",Ve,[a[6]||(a[6]=t("h2",{class:"text-lg font-semibold"},"Instances",-1)),t("span",{class:_(["text-xs px-2 py-0.5 rounded-full font-medium",u.value.length>=j?"bg-red-500/10 text-red-500":"bg-secondary text-secondary-foreground"])},i(u.value.length)+" / "+i(j)+" active ",3)]),u.value.length===0?(s(),o("div",Fe," No active instances. ")):(s(),o("div",Ge,[(s(!0),o(C,null,D(u.value,e=>(s(),o("div",{key:e.id,class:"border border-border rounded-lg p-3 flex flex-col gap-2"},[t("div",He,[t("div",Ue,[p(c(se),{class:"w-3.5 h-3.5 text-muted-foreground shrink-0"}),t("span",Xe,i(e.branch),1)]),t("span",{class:_(["text-xs px-1.5 py-0.5 rounded-full shrink-0",{"bg-green-500/10 text-green-500":e.status==="active","bg-red-500/10 text-red-500":e.status==="destroyed","bg-yellow-500/10 text-yellow-500":e.status==="stale"}])},i(e.status),3)]),t("div",Ze,[p(c(B),{class:"w-3 h-3 shrink-0"}),t("span",null,i(q(e.last_activity)),1)]),t("div",{class:"font-mono text-xs text-muted-foreground truncate",title:e.worktree_path},i(e.worktree_path),9,Ke),t("div",Qe,[t("button",{class:"inline-flex items-center gap-1 text-xs text-red-500 hover:text-red-400 disabled:opacity-50 disabled:cursor-not-allowed",disabled:g.value===e.id,onClick:n=>M(e.id,e.branch)},[p(c(oe),{class:"w-3 h-3"}),h(" "+i(g.value===e.id?"Destroying…":"Destroy"),1)],8,We)])]))),128))]))]),t("section",null,[a[8]||(a[8]=t("h2",{class:"text-lg font-semibold mb-3"},"Recent Tasks",-1)),w.value.length===0?(s(),o("div",Ye,"No tasks yet.")):(s(),o("div",et,[(s(!0),o(C,null,D(w.value,e=>(s(),o("div",{key:e.id,class:"border border-border rounded-lg p-3"},[t("div",tt,[t("span",st,i(e.description),1),t("div",ot,[k(e.status)?(s(),o("button",{key:0,onClick:n=>T(e.id),disabled:y.value===e.id,class:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded border border-red-500/50 text-red-500 hover:bg-red-500/10 transition-colors disabled:opacity-50 disabled:cursor-not-allowed","aria-label":"Stop agent",title:"Stop agent"},[p(c(O),{class:"w-3 h-3"}),h(" "+i(y.value===e.id?"Stopping…":"Stop"),1)],8,at)):v("",!0),k(e.status)||d.value===e.id?(s(),o("button",{key:1,onClick:n=>d.value===e.id?b():N(e.id),class:_(["inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded border transition-colors",d.value===e.id?"bg-primary text-primary-foreground border-primary":"border-border text-muted-foreground hover:text-foreground hover:border-foreground"]),"aria-label":d.value===e.id?"Hide activity preview":"Show activity preview",title:d.value===e.id?"Hide preview":"Preview activity"},[p(c(re),{class:"w-3 h-3"}),a[7]||(a[7]=h(" Preview ",-1))],10,rt)):v("",!0),t("span",{class:_(["text-xs px-2 py-0.5 rounded-full",{"bg-yellow-500/10 text-yellow-500":e.status==="pending","bg-blue-500/10 text-blue-500":e.status==="in_progress","bg-green-500/10 text-green-500":e.status==="done","bg-red-500/10 text-red-500":e.status==="failed","bg-orange-500/10 text-orange-500":e.status==="stopped"}])},i(e.status),3)])]),d.value===e.id?(s(),o("div",lt,[p(Ce,{"task-id":e.id,"task-description":e.description,"task-status":e.status,onClose:b,onStopped:n=>e.status="stopped"},null,8,["task-id","task-description","task-status","onStopped"])])):v("",!0)]))),128))]))])],64)):v("",!0)])}}});export{mt as default};
26
+ */const de=A("ToggleRightIcon",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"16",cy:"12",r:"2",key:"4ma0v8"}]]),ue={class:"flex flex-col h-full border border-border rounded-lg overflow-hidden bg-background"},ce={class:"flex items-center justify-between px-4 py-3 border-b border-border bg-muted/30"},pe={class:"flex items-center gap-2 min-w-0"},me={class:"flex items-center gap-2"},xe=["disabled"],fe=["aria-label","title"],ge={class:"px-4 py-2 text-xs text-muted-foreground border-b border-border bg-muted/10 truncate"},ye={key:0,class:"text-muted-foreground text-xs"},be={key:1,class:"text-muted-foreground text-xs"},ve={class:"flex items-center justify-between mb-1"},he={class:"text-xs font-medium text-muted-foreground uppercase tracking-wide"},we={class:"text-xs text-muted-foreground"},_e={key:0,class:"text-xs bg-muted rounded p-2 overflow-x-auto whitespace-pre-wrap break-all"},ke={key:1},Se={key:1,class:"text-sm"},$e={key:2,class:"border border-border border-l-2 border-l-yellow-500 rounded-lg p-3 animate-pulse"},Te={key:0,class:"text-xs bg-muted rounded p-2 overflow-x-auto whitespace-pre-wrap break-all"},Ce=J({__name:"AgentActivityPreview",props:{taskId:{},taskDescription:{},taskStatus:{}},emits:["close","stopped"],setup(f,{emit:L}){const x=f,S=L,w=m([]),u=m(!1),$=m(!0),g=m(!1),y=m();let d=null;const N=H(()=>w.value.filter(l=>l.summary.trim()!=="")),b=m("");async function k(){try{const l=await P(`/tasks/${x.taskId}/events`);w.value=l}finally{$.value=!1}}function T(){y.value&&(y.value.scrollTop=y.value.scrollHeight)}function M(){x.taskStatus!=="pending"&&x.taskStatus!=="in_progress"||(d=W(),d.addEventListener("agent_event",l=>{const e=JSON.parse(l.data);e.taskId===x.taskId&&(e.type==="message_delta"?(b.value=e.summary??"",E(T)):(k().then(()=>E(T)),b.value=""))}))}async function q(){if(!g.value){g.value=!0;try{await V(`/tasks/${x.taskId}/stop`),S("stopped")}catch(l){console.error("Failed to stop agent:",l)}finally{g.value=!1}}}function a(l){switch(l){case"status":return"Status";case"message":return"Agent message";case"message_delta":return"Streaming…";default:return l}}function r(l){return new Date(l).toLocaleTimeString()}return F(()=>x.taskStatus,l=>{(l==="done"||l==="failed"||l==="stopped")&&(b.value="",k(),d&&(d.close(),d=null))}),z(()=>{k().then(()=>E(T)),M()}),G(()=>{d&&(d.close(),d=null)}),(l,e)=>(s(),o("div",ue,[t("div",ce,[t("div",pe,[p(c(B),{class:"w-4 h-4 text-primary flex-shrink-0"}),e[2]||(e[2]=t("h3",{class:"text-sm font-semibold truncate"},"Activity Preview",-1)),t("span",{class:_(["text-xs px-2 py-0.5 rounded-full flex-shrink-0",{"bg-yellow-500/10 text-yellow-500":f.taskStatus==="pending","bg-blue-500/10 text-blue-500":f.taskStatus==="in_progress","bg-green-500/10 text-green-500":f.taskStatus==="done","bg-red-500/10 text-red-500":f.taskStatus==="failed","bg-orange-500/10 text-orange-500":f.taskStatus==="stopped"}])},i(f.taskStatus),3)]),t("div",me,[f.taskStatus==="pending"||f.taskStatus==="in_progress"?(s(),o("button",{key:0,onClick:q,disabled:g.value,class:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded border border-red-500/50 text-red-500 hover:bg-red-500/10 transition-colors disabled:opacity-50 disabled:cursor-not-allowed","aria-label":"Stop agent",title:"Stop agent"},[p(c(O),{class:"w-3 h-3"}),h(" "+i(g.value?"Stopping…":"Stop"),1)],8,xe)):v("",!0),t("button",{onClick:e[0]||(e[0]=n=>u.value=!u.value),class:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors","aria-label":u.value?"Switch to human-readable view":"Switch to raw JSON view",title:u.value?"Switch to human-readable view":"Switch to raw JSON view"},[u.value?(s(),I(c(de),{key:1,class:"w-4 h-4 text-primary"})):(s(),I(c(ie),{key:0,class:"w-4 h-4"})),t("span",null,i(u.value?"Raw JSON":"Readable"),1)],8,fe),t("button",{onClick:e[1]||(e[1]=n=>S("close")),class:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors","aria-label":"Close preview",title:"Close preview"},[p(c(te),{class:"w-4 h-4"})])])]),t("div",ge,i(f.taskDescription),1),t("div",{ref_key:"feedContainer",ref:y,class:"flex-1 overflow-y-auto p-4 space-y-3 text-sm"},[$.value?(s(),o("div",ye,"Loading events…")):N.value.length===0&&!b.value?(s(),o("div",be," No events yet. The agent will start shortly. ")):v("",!0),(s(!0),o(C,null,D(N.value,n=>(s(),o("div",{key:n.id,class:_(["border border-border rounded-lg p-3",{"border-l-2 border-l-green-500":n.type==="status"&&n.summary.includes("completed"),"border-l-2 border-l-red-500":n.type==="status"&&n.summary.includes("failed"),"border-l-2 border-l-blue-500":n.type==="message","border-l-2 border-l-primary":n.type==="status"&&!n.summary.includes("completed")&&!n.summary.includes("failed")}])},[t("div",ve,[t("span",he,i(a(n.type)),1),t("span",we,i(r(n.created_at)),1)]),u.value?(s(),o("pre",_e,i(JSON.stringify(JSON.parse(n.payload),null,2)),1)):(s(),o("div",ke,[n.type==="message"?(s(),I(R,{key:0,content:n.summary,class:"text-sm"},null,8,["content"])):(s(),o("p",Se,i(n.summary),1))]))],2))),128)),b.value.trim()?(s(),o("div",$e,[e[3]||(e[3]=t("div",{class:"flex items-center justify-between mb-1"},[t("span",{class:"text-xs font-medium text-muted-foreground uppercase tracking-wide"}," Agent is responding… "),t("span",{class:"inline-block w-2 h-2 rounded-full bg-yellow-500 animate-ping"})],-1)),u.value?(s(),o("pre",Te,i(JSON.stringify({type:"message_delta",accumulated:b.value},null,2)),1)):(s(),I(R,{key:1,content:b.value,class:"text-sm"},null,8,["content"]))])):v("",!0)],512)]))}}),Ae={class:"p-6"},Ne={key:0,class:"text-muted-foreground"},Ie={class:"mb-6"},De={class:"text-muted-foreground"},Le={class:"mb-8"},Me={class:"border border-border rounded-lg overflow-hidden"},qe={class:"w-full text-sm"},Ee={class:"px-4 py-2 font-medium"},Re={class:"px-4 py-2 text-muted-foreground"},je={class:"px-4 py-2"},Je={class:"px-4 py-2 flex gap-1"},ze={key:0,class:"text-xs bg-primary/10 text-primary px-1.5 py-0.5 rounded"},Be={key:1,class:"text-xs bg-blue-500/10 text-blue-500 px-1.5 py-0.5 rounded"},Oe={key:2,class:"text-xs bg-purple-500/10 text-purple-500 px-1.5 py-0.5 rounded"},Pe={class:"mb-8"},Ve={class:"flex items-center justify-between mb-3"},Fe={key:0,class:"text-sm text-muted-foreground border border-border rounded-lg p-4 text-center"},Ge={key:1,class:"grid grid-cols-1 md:grid-cols-3 gap-3"},He={class:"flex items-center justify-between gap-2"},Ue={class:"flex items-center gap-1.5 min-w-0"},Xe={class:"text-sm font-medium truncate"},Ze={class:"flex items-center gap-1 text-xs text-muted-foreground"},Ke=["title"],Qe={class:"pt-1 border-t border-border"},We=["disabled","onClick"],Ye={key:0,class:"text-sm text-muted-foreground"},et={key:1,class:"space-y-2"},tt={class:"flex items-center justify-between"},st={class:"text-sm"},ot={class:"flex items-center gap-2"},rt=["onClick","disabled"],at=["onClick","aria-label","title"],lt={key:0,class:"mt-3 h-96"},j=3,xt=J({__name:"SquadDetailView",setup(f){const L=Z(),x=m(null),S=m([]),w=m([]),u=m([]),$=m(!0),g=m(null),y=m(null),d=m(null);function N(a){d.value=a}function b(){d.value=null}function k(a){return a==="pending"||a==="in_progress"}async function T(a){if(!y.value){y.value=a;try{await V(`/tasks/${a}/stop`);const r=w.value.find(l=>l.id===a);r&&(r.status="stopped")}catch(r){console.error("Failed to stop task:",r)}finally{y.value=null}}}z(async()=>{try{const a=await P(`/squads/${L.params.id}`);x.value=a.squad,S.value=a.agents,w.value=a.tasks,u.value=a.instances}finally{$.value=!1}});async function M(a,r){if(confirm(`Destroy instance on branch "${r}"? This will remove the worktree.`)){g.value=a;try{await Y(`/instances/${a}`),u.value=u.value.filter(l=>l.id!==a)}finally{g.value=null}}}function q(a){if(!a)return"never";const r=a.replace(" ","T")+(a.includes("T")||a.endsWith("Z")?"":"Z"),l=Date.now()-new Date(r).getTime(),e=Math.floor(l/6e4);if(e<1)return"just now";if(e<60)return`${e}m ago`;const n=Math.floor(e/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}return(a,r)=>{const l=K("router-link");return s(),o("div",Ae,[p(l,{to:"/squads",class:"inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground mb-4"},{default:U(()=>[p(c(re),{class:"w-4 h-4"}),r[0]||(r[0]=h(" Back to Squads ",-1))]),_:1}),$.value?(s(),o("div",Ne,"Loading...")):x.value?(s(),o(C,{key:1},[t("div",Ie,[t("span",{class:"inline-flex items-center text-sm px-2.5 py-1 rounded-full font-medium mb-2 w-fit",style:X(c(ee)(x.value.color))},i(x.value.name),5),t("p",De,i(x.value.universe),1)]),t("section",Le,[r[5]||(r[5]=t("h2",{class:"text-lg font-semibold mb-3"},"Agent Roster",-1)),t("div",Me,[t("table",qe,[r[4]||(r[4]=t("thead",{class:"bg-muted"},[t("tr",null,[t("th",{class:"text-left px-4 py-2 font-medium"},"Character"),t("th",{class:"text-left px-4 py-2 font-medium"},"Role"),t("th",{class:"text-left px-4 py-2 font-medium"},"Status"),t("th",{class:"text-left px-4 py-2 font-medium"},"Flags")])],-1)),t("tbody",null,[(s(!0),o(C,null,D(S.value,e=>(s(),o("tr",{key:e.id,class:"border-t border-border"},[t("td",Ee,i(e.character_name),1),t("td",Re,i(e.role_title),1),t("td",je,[t("span",{class:_(["inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full",{"bg-green-500/10 text-green-500":e.status==="idle","bg-yellow-500/10 text-yellow-500":e.status==="working","bg-blue-500/10 text-blue-500":e.status==="reviewing"}])},i(e.status),3)]),t("td",Je,[e.is_lead?(s(),o("span",ze,[p(c(Q),{class:"w-3 h-3 inline"}),r[1]||(r[1]=h(" Lead ",-1))])):v("",!0),e.is_qa?(s(),o("span",Be,[p(c(ne),{class:"w-3 h-3 inline"}),r[2]||(r[2]=h(" QA ",-1))])):v("",!0),e.is_test?(s(),o("span",Oe,[p(c(le),{class:"w-3 h-3 inline"}),r[3]||(r[3]=h(" Test ",-1))])):v("",!0)])]))),128))])])])]),t("section",Pe,[t("div",Ve,[r[6]||(r[6]=t("h2",{class:"text-lg font-semibold"},"Instances",-1)),t("span",{class:_(["text-xs px-2 py-0.5 rounded-full font-medium",u.value.length>=j?"bg-red-500/10 text-red-500":"bg-secondary text-secondary-foreground"])},i(u.value.length)+" / "+i(j)+" active ",3)]),u.value.length===0?(s(),o("div",Fe," No active instances. ")):(s(),o("div",Ge,[(s(!0),o(C,null,D(u.value,e=>(s(),o("div",{key:e.id,class:"border border-border rounded-lg p-3 flex flex-col gap-2"},[t("div",He,[t("div",Ue,[p(c(se),{class:"w-3.5 h-3.5 text-muted-foreground shrink-0"}),t("span",Xe,i(e.branch),1)]),t("span",{class:_(["text-xs px-1.5 py-0.5 rounded-full shrink-0",{"bg-green-500/10 text-green-500":e.status==="active","bg-red-500/10 text-red-500":e.status==="destroyed","bg-yellow-500/10 text-yellow-500":e.status==="stale"}])},i(e.status),3)]),t("div",Ze,[p(c(B),{class:"w-3 h-3 shrink-0"}),t("span",null,i(q(e.last_activity)),1)]),t("div",{class:"font-mono text-xs text-muted-foreground truncate",title:e.worktree_path},i(e.worktree_path),9,Ke),t("div",Qe,[t("button",{class:"inline-flex items-center gap-1 text-xs text-red-500 hover:text-red-400 disabled:opacity-50 disabled:cursor-not-allowed",disabled:g.value===e.id,onClick:n=>M(e.id,e.branch)},[p(c(oe),{class:"w-3 h-3"}),h(" "+i(g.value===e.id?"Destroying…":"Destroy"),1)],8,We)])]))),128))]))]),t("section",null,[r[8]||(r[8]=t("h2",{class:"text-lg font-semibold mb-3"},"Recent Tasks",-1)),w.value.length===0?(s(),o("div",Ye,"No tasks yet.")):(s(),o("div",et,[(s(!0),o(C,null,D(w.value,e=>(s(),o("div",{key:e.id,class:"border border-border rounded-lg p-3"},[t("div",tt,[t("span",st,i(e.description),1),t("div",ot,[k(e.status)?(s(),o("button",{key:0,onClick:n=>T(e.id),disabled:y.value===e.id,class:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded border border-red-500/50 text-red-500 hover:bg-red-500/10 transition-colors disabled:opacity-50 disabled:cursor-not-allowed","aria-label":"Stop agent",title:"Stop agent"},[p(c(O),{class:"w-3 h-3"}),h(" "+i(y.value===e.id?"Stopping…":"Stop"),1)],8,rt)):v("",!0),k(e.status)||d.value===e.id?(s(),o("button",{key:1,onClick:n=>d.value===e.id?b():N(e.id),class:_(["inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded border transition-colors",d.value===e.id?"bg-primary text-primary-foreground border-primary":"border-border text-muted-foreground hover:text-foreground hover:border-foreground"]),"aria-label":d.value===e.id?"Hide activity preview":"Show activity preview",title:d.value===e.id?"Hide preview":"Preview activity"},[p(c(ae),{class:"w-3 h-3"}),r[7]||(r[7]=h(" Preview ",-1))],10,at)):v("",!0),t("span",{class:_(["text-xs px-2 py-0.5 rounded-full",{"bg-yellow-500/10 text-yellow-500":e.status==="pending","bg-blue-500/10 text-blue-500":e.status==="in_progress","bg-green-500/10 text-green-500":e.status==="done","bg-red-500/10 text-red-500":e.status==="failed","bg-orange-500/10 text-orange-500":e.status==="stopped"}])},i(e.status),3)])]),d.value===e.id?(s(),o("div",lt,[p(Ce,{"task-id":e.id,"task-description":e.description,"task-status":e.status,onClose:b,onStopped:n=>e.status="stopped"},null,8,["task-id","task-description","task-status","onStopped"])])):v("",!0)]))),128))]))])],64)):v("",!0)])}}});export{xt as default};
@@ -1,4 +1,4 @@
1
- import{b as L}from"./api-qgb8ODgh.js";import{r as I,u as T,E as B,J as o,q as n,n as t,t as u,T as l,A as M,s as g,k as _,d as f,L as y,K as v,m as N,z as k,a4 as P,R as a,o as x,p,c as b,N as V}from"./index-CCZu8Q1C.js";import{T as w}from"./triangle-alert-B7rUnBx3.js";import{G as $}from"./git-branch-BG_ozkFm.js";/**
1
+ import{b as L}from"./api-DthBzc-F.js";import{r as I,u as T,E as B,J as o,q as n,n as t,t as u,T as l,A as M,s as g,k as _,d as f,L as y,K as v,m as N,z as k,a3 as P,R as a,o as x,p,c as b,N as V}from"./index-BGLdlKTT.js";import{T as w}from"./triangle-alert-_B-01mAe.js";import{G as $}from"./git-branch-BDJQ9Lx3.js";/**
2
2
  * @license lucide-vue-next v0.474.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{b as y}from"./api-qgb8ODgh.js";import{g as v}from"./squad-colors-B8B_Y-lz.js";import{r as h,u as k,E as b,J as o,q as r,n as t,t as i,T as l,k as w,d as L,L as C,K as d,o as S,a4 as N,D as f,N as q,R as n,s as _,p as B}from"./index-CCZu8Q1C.js";import{G as V}from"./git-branch-BG_ozkFm.js";/**
1
+ import{b as y}from"./api-DthBzc-F.js";import{g as v}from"./squad-colors-B8B_Y-lz.js";import{r as h,u as k,E as b,J as o,q as r,n as t,t as i,T as l,k as w,d as L,L as C,K as d,o as S,a3 as N,D as f,N as q,R as n,s as _,p as B}from"./index-BGLdlKTT.js";import{G as V}from"./git-branch-BDJQ9Lx3.js";/**
2
2
  * @license lucide-vue-next v0.474.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{u as t,J as s,q as r,z as l,n as d}from"./index-CCZu8Q1C.js";const u=["aria-label","aria-checked","disabled"],m=t({__name:"ToggleSwitch",props:{modelValue:{type:Boolean},ariaLabel:{default:"Toggle"},disabled:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(e,{emit:o}){const a=e,i=o;function n(){a.disabled||i("update:modelValue",!a.modelValue)}return(c,b)=>(s(),r("button",{type:"button",role:"switch","aria-label":e.ariaLabel,"aria-checked":e.modelValue,disabled:e.disabled,class:l(["inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-border p-0.5 transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",e.modelValue?"bg-gradient-brand shadow-[0_0_0_1px_rgba(228,58,156,0.35)]":"bg-muted"]),onClick:n},[d("span",{class:l(["pointer-events-none h-4 w-4 rounded-full bg-white shadow-sm ring-1 ring-black/10 transition-transform duration-200",e.modelValue?"translate-x-5":"translate-x-0"])},null,2)],10,u))}});export{m as _};
1
+ import{u as t,J as s,q as r,z as l,n as d}from"./index-BGLdlKTT.js";const u=["aria-label","aria-checked","disabled"],m=t({__name:"ToggleSwitch",props:{modelValue:{type:Boolean},ariaLabel:{default:"Toggle"},disabled:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(e,{emit:o}){const a=e,i=o;function n(){a.disabled||i("update:modelValue",!a.modelValue)}return(c,b)=>(s(),r("button",{type:"button",role:"switch","aria-label":e.ariaLabel,"aria-checked":e.modelValue,disabled:e.disabled,class:l(["inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-border p-0.5 transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",e.modelValue?"bg-gradient-brand shadow-[0_0_0_1px_rgba(228,58,156,0.35)]":"bg-muted"]),onClick:n},[d("span",{class:l(["pointer-events-none h-4 w-4 rounded-full bg-white shadow-sm ring-1 ring-black/10 transition-transform duration-200",e.modelValue?"translate-x-5":"translate-x-0"])},null,2)],10,u))}});export{m as _};
@@ -1,4 +1,4 @@
1
- import{r as L,u as j,E as Q,J as d,q as r,n as t,t as _,T as k,C as W,d as i,L as m,s as w,R as o,k as X,p as u,a5 as F,a1 as O,K as a,z as Y,D as Z,m as tt}from"./index-CCZu8Q1C.js";import{b as T,d as q}from"./api-qgb8ODgh.js";import{T as et}from"./triangle-alert-B7rUnBx3.js";/**
1
+ import{r as L,u as j,E as Q,J as d,q as r,n as t,t as _,T as k,C as W,d as i,L as m,s as w,R as o,k as X,p as u,a4 as F,a0 as O,K as a,z as Y,D as Z,m as tt}from"./index-BGLdlKTT.js";import{b as T,d as q}from"./api-DthBzc-F.js";import{T as et}from"./triangle-alert-_B-01mAe.js";/**
2
2
  * @license lucide-vue-next v0.474.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{r as j,u as se,a3 as oe,J as o,q as a,d as b,L as K,m as A,n as t,o as I,T as d,a as ce,t as v,F as ve,R as N,D as pe,z,a7 as fe,p as B,K as c,E as me,B as H,s as S,a5 as V,a1 as L,a6 as R,X as Z,l as G}from"./index-CCZu8Q1C.js";import{b as T,d as E,a as J}from"./api-qgb8ODgh.js";import{S as xe}from"./search-BHoRZUY-.js";import{P as O}from"./plus-Ca2bOAAz.js";import{P as X,S as Y}from"./save-BYzmOVHA.js";import{T as ee}from"./trash-2-B0cHPT2B.js";/**
1
+ import{r as j,u as se,a2 as oe,J as o,q as a,d as b,L as K,m as A,n as t,o as I,T as d,a as ce,t as v,F as ve,R as N,D as pe,z,a6 as fe,p as B,K as c,E as me,B as H,s as S,a4 as V,a0 as L,a5 as R,l as Z}from"./index-BGLdlKTT.js";import{b as T,d as E,a as G}from"./api-DthBzc-F.js";import{S as xe}from"./search-tP42aLoo.js";import{P as J}from"./plus-BQd_XYgK.js";import{P as O}from"./pencil-aJ0SIjrw.js";import{T as X}from"./trash-2-dt2YqJne.js";import{S as Y}from"./save-CQegsgKM.js";import{X as ee}from"./x-DgnyxyzU.js";/**
2
2
  * @license lucide-vue-next v0.474.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -23,4 +23,4 @@ import{r as j,u as se,a3 as oe,J as o,q as a,d as b,L as K,m as A,n as t,o as I,
23
23
  *
24
24
  * This source code is licensed under the ISC license.
25
25
  * See the LICENSE file in the root directory of this source tree.
26
- */const ye=j("LinkIcon",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]),ke={class:"select-none"},we=["onClick"],_e={class:"truncate"},Ce=["onClick"],$e=se({__name:"WikiTree",props:{pages:{},selectedPage:{},searchQuery:{}},emits:["select","addFile"],setup(U,{emit:w}){const x=U,f=w,g=c(new Set);function y(i){const u=[];for(const n of i){const p=n.split("/");let m=u;for(let h=0;h<p.length;h++){const P=p[h],$=p.slice(0,h+1).join("/"),k=h<p.length-1;let F=m.find(D=>D.name===P&&D.isFolder===k);F||(F={name:P,path:$,children:[],isFolder:k},m.push(F)),m=F.children}}const s=n=>{n.sort((p,m)=>p.isFolder!==m.isFolder?p.isFolder?-1:1:p.name.localeCompare(m.name)),n.forEach(p=>s(p.children))};return s(u),u}const _=A(()=>{let i=x.pages;if(x.searchQuery){const u=x.searchQuery.toLowerCase();i=x.pages.filter(s=>s.toLowerCase().includes(u))}return y(i)});oe(()=>x.selectedPage,i=>{if(!i)return;const u=i.split("/");for(let s=1;s<u.length;s++)g.value.add(u.slice(0,s).join("/"))},{immediate:!0});function q(i){g.value.has(i)?g.value.delete(i):g.value.add(i)}function M(i,u){const s=[];for(const n of i)s.push({node:n,depth:u}),n.isFolder&&g.value.has(n.path)&&s.push(...M(n.children,u+1));return s}const C=A(()=>M(_.value,0));return(i,u)=>(o(),a("div",ke,[(o(!0),a(b,null,K(C.value,({node:s,depth:n})=>(o(),a("div",{key:s.path,class:"group relative"},[t("button",{onClick:p=>s.isFolder?q(s.path):f("select",s.path),class:z(["w-full text-left flex items-center gap-1 py-1 text-xs rounded hover:bg-accent transition-colors",{"bg-accent font-medium":!s.isFolder&&U.selectedPage===s.path}]),style:pe({paddingLeft:n*12+8+"px"})},[s.isFolder?(o(),a(b,{key:0},[g.value.has(s.path)?(o(),I(d(ce),{key:0,class:"w-3 h-3 shrink-0 text-muted-foreground"})):(o(),I(d(ge),{key:1,class:"w-3 h-3 shrink-0 text-muted-foreground"})),v(d(be),{class:"w-3.5 h-3.5 shrink-0 text-muted-foreground"})],64)):(o(),a(b,{key:1},[u[0]||(u[0]=t("span",{class:"w-3 shrink-0"},null,-1)),v(d(ve),{class:"w-3.5 h-3.5 shrink-0 text-muted-foreground"})],64)),t("span",_e,N(s.name),1)],14,we),s.isFolder?(o(),a("button",{key:0,onClick:fe(p=>f("addFile",s.path),["stop"]),class:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 rounded opacity-0 group-hover:opacity-100 hover:bg-primary/10 text-muted-foreground hover:text-primary transition-all",title:"Add file here"},[v(d(he),{class:"w-3.5 h-3.5"})],8,Ce)):B("",!0)]))),128))]))}}),Fe={class:"flex flex-col h-full"},Pe={class:"flex border-b border-border shrink-0"},Te={key:0,class:"flex flex-1 overflow-hidden"},qe={class:"w-64 border-r border-border flex flex-col shrink-0"},Me={class:"p-3 border-b border-border space-y-2"},Se={class:"relative"},Ve={key:0,class:"space-y-1.5"},Le={class:"flex gap-1"},Ne=["disabled"],je={class:"flex-1 overflow-y-auto p-2"},De={key:0,class:"text-xs text-muted-foreground p-2"},Ee={class:"flex-1 flex flex-col overflow-hidden"},ze={key:0,class:"flex items-center justify-center h-full text-muted-foreground"},Be={class:"text-center"},Ie={class:"flex items-center justify-between px-4 py-2 border-b border-border"},Ue={class:"text-sm font-medium font-mono"},Ke={class:"flex gap-1"},Qe={class:"flex-1 overflow-y-auto p-4"},We={key:0,class:"mt-8 pt-4 border-t border-border"},Ae={class:"flex items-center gap-1.5 mb-2 text-xs font-medium text-muted-foreground"},He={class:"space-y-1"},Re=["onClick"],Ze={key:1,class:"flex flex-1 overflow-hidden"},Ge={class:"w-64 border-r border-border flex flex-col shrink-0"},Je={class:"p-3 border-b border-border space-y-2"},Oe={key:0,class:"space-y-1.5"},Xe={class:"flex gap-1"},Ye=["disabled"],et={class:"flex-1 overflow-y-auto p-2"},tt={key:0,class:"text-xs text-muted-foreground p-2"},st={key:1,class:"text-xs text-muted-foreground p-2"},ot=["onClick"],lt={class:"flex-1 flex flex-col overflow-hidden"},at={key:0,class:"flex items-center justify-center h-full text-muted-foreground"},nt={class:"text-center"},rt={class:"flex items-center justify-between px-4 py-2 border-b border-border"},it={class:"text-sm font-medium font-mono"},ut={class:"flex gap-1"},dt={class:"flex-1 overflow-y-auto p-4"},gt=se({__name:"WikiView",setup(U){const w=c("pages"),x=c([]),f=c(null),g=c(""),y=c(!1),_=c(""),q=c(""),M=c(!0),C=c(!1),i=c(""),u=c([]),s=c([]),n=c(null),p=c(""),m=c(!1),h=c(""),P=c(!1),$=c(!1),k=c("");me(async()=>{try{x.value=await T("/wiki/pages")}finally{M.value=!1}}),oe(w,async r=>{if(r==="templates"&&s.value.length===0){P.value=!0;try{s.value=await T("/wiki/templates/squad")}finally{P.value=!1}}});async function F(r){f.value=r,y.value=!1;const e=await T(`/wiki/page/${r}`);g.value=e.content,u.value=await T(`/wiki/backlinks/${r}`)}function D(){_.value=g.value,y.value=!0}async function le(){f.value&&(await E(`/wiki/page/${f.value}`,{content:_.value}),g.value=_.value,y.value=!1,u.value=await T(`/wiki/backlinks/${f.value}`))}async function ae(){f.value&&confirm(`Delete "${f.value}"?`)&&(await J(`/wiki/page/${f.value}`),x.value=x.value.filter(r=>r!==f.value),f.value=null,g.value="",u.value=[])}async function Q(){const r=i.value.trim();if(!r)return;const e=r.endsWith(".md")?r:`${r}.md`;await E(`/wiki/page/${e}`,{content:""}),x.value.includes(e)||(x.value.push(e),x.value.sort()),C.value=!1,i.value="",f.value=e,g.value="",_.value="",y.value=!0,u.value=[]}async function ne(r){n.value=r,m.value=!1;const e=await T(`/wiki/template/squad/${r}`);p.value=e.content}function re(){h.value=p.value,m.value=!0}async function ie(){n.value&&(await E(`/wiki/template/squad/${n.value}`,{content:h.value}),p.value=h.value,m.value=!1)}async function ue(){n.value&&confirm(`Delete template "${n.value}"?`)&&(await J(`/wiki/template/squad/${n.value}`),s.value=s.value.filter(r=>r!==n.value),n.value=null,p.value="")}async function W(){const r=k.value.trim();if(!r)return;const e=r.endsWith(".md")?r:`${r}.md`;await E(`/wiki/template/squad/${e}`,{content:""}),s.value.includes(e)||(s.value.push(e),s.value.sort()),$.value=!1,k.value="",n.value=e,p.value="",h.value="",m.value=!0}return(r,e)=>(o(),a("div",Fe,[t("div",Pe,[t("button",{onClick:e[0]||(e[0]=l=>w.value="pages"),class:z(["px-4 py-2 text-sm font-medium border-b-2 transition-colors",w.value==="pages"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"])},[v(d(H),{class:"inline w-4 h-4 mr-1.5 -mt-0.5"}),e[15]||(e[15]=S(" Pages ",-1))],2),t("button",{onClick:e[1]||(e[1]=l=>w.value="templates"),class:z(["px-4 py-2 text-sm font-medium border-b-2 transition-colors",w.value==="templates"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"])},[v(d(te),{class:"inline w-4 h-4 mr-1.5 -mt-0.5"}),e[16]||(e[16]=S(" Squad Templates ",-1))],2)]),w.value==="pages"?(o(),a("div",Te,[t("div",qe,[t("div",Me,[t("div",Se,[v(d(xe),{class:"absolute left-2.5 top-2.5 w-3.5 h-3.5 text-muted-foreground"}),V(t("input",{"onUpdate:modelValue":e[2]||(e[2]=l=>q.value=l),placeholder:"Search pages...",class:"w-full rounded-md border border-input bg-background pl-8 pr-3 py-2 text-xs focus:outline-none focus:ring-1 focus:ring-ring"},null,512),[[L,q.value]])]),t("button",{onClick:e[3]||(e[3]=l=>C.value=!C.value),class:"w-full flex items-center justify-center gap-1.5 px-2 py-1.5 text-xs rounded-md bg-primary text-primary-foreground hover:bg-primary/90"},[v(d(O),{class:"w-3.5 h-3.5"}),e[17]||(e[17]=S(" New Page ",-1))]),C.value?(o(),a("div",Ve,[V(t("input",{"onUpdate:modelValue":e[4]||(e[4]=l=>i.value=l),placeholder:"path/to/page.md",class:"w-full rounded-md border border-input bg-background px-2 py-1.5 text-xs focus:outline-none focus:ring-1 focus:ring-ring",onKeyup:R(Q,["enter"])},null,544),[[L,i.value]]),t("div",Le,[t("button",{onClick:Q,disabled:!i.value.trim(),class:"flex-1 px-2 py-1 text-xs rounded bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50"}," Create ",8,Ne),t("button",{onClick:e[5]||(e[5]=l=>{C.value=!1,i.value=""}),class:"px-2 py-1 text-xs rounded border border-border hover:bg-accent"}," Cancel ")])])):B("",!0)]),t("div",je,[M.value?(o(),a("div",De,"Loading...")):(o(),I($e,{key:1,pages:x.value,"selected-page":f.value,"search-query":q.value,onSelect:e[6]||(e[6]=l=>F(l)),onAddFile:e[7]||(e[7]=l=>{C.value=!0,i.value=l+"/"})},null,8,["pages","selected-page","search-query"]))])]),t("div",Ee,[f.value?(o(),a(b,{key:1},[t("div",Ie,[t("span",Ue,N(f.value),1),t("div",Ke,[y.value?(o(),a(b,{key:1},[t("button",{onClick:le,class:"p-1.5 rounded hover:bg-accent text-green-500",title:"Save"},[v(d(Y),{class:"w-4 h-4"})]),t("button",{onClick:e[8]||(e[8]=l=>y.value=!1),class:"p-1.5 rounded hover:bg-accent text-muted-foreground",title:"Cancel"},[v(d(Z),{class:"w-4 h-4"})])],64)):(o(),a(b,{key:0},[t("button",{onClick:D,class:"p-1.5 rounded hover:bg-accent text-muted-foreground",title:"Edit"},[v(d(X),{class:"w-4 h-4"})]),t("button",{onClick:ae,class:"p-1.5 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive",title:"Delete"},[v(d(ee),{class:"w-4 h-4"})])],64))])]),t("div",Qe,[y.value?V((o(),a("textarea",{key:0,"onUpdate:modelValue":e[9]||(e[9]=l=>_.value=l),class:"w-full h-full min-h-[400px] font-mono text-sm bg-background border border-input rounded-md p-3 focus:outline-none focus:ring-1 focus:ring-ring resize-none"},null,512)),[[L,_.value]]):(o(),a(b,{key:1},[v(G,{content:g.value},null,8,["content"]),u.value.length>0?(o(),a("div",We,[t("div",Ae,[v(d(ye),{class:"w-3.5 h-3.5"}),e[19]||(e[19]=S(" Backlinks ",-1))]),t("ul",He,[(o(!0),a(b,null,K(u.value,l=>(o(),a("li",{key:l},[t("button",{onClick:de=>F(l),class:"text-xs text-primary hover:underline font-mono"},N(l),9,Re)]))),128))])])):B("",!0)],64))])],64)):(o(),a("div",ze,[t("div",Be,[v(d(H),{class:"w-12 h-12 mx-auto mb-3 opacity-50"}),e[18]||(e[18]=t("p",null,"Select a page to view",-1))])]))])])):(o(),a("div",Ze,[t("div",Ge,[t("div",Je,[e[21]||(e[21]=t("p",{class:"text-xs text-muted-foreground"}," Files copied verbatim into each new squad's wiki directory on creation. ",-1)),t("button",{onClick:e[10]||(e[10]=l=>$.value=!$.value),class:"w-full flex items-center justify-center gap-1.5 px-2 py-1.5 text-xs rounded-md bg-primary text-primary-foreground hover:bg-primary/90"},[v(d(O),{class:"w-3.5 h-3.5"}),e[20]||(e[20]=S(" New Template ",-1))]),$.value?(o(),a("div",Oe,[V(t("input",{"onUpdate:modelValue":e[11]||(e[11]=l=>k.value=l),placeholder:"filename.md",class:"w-full rounded-md border border-input bg-background px-2 py-1.5 text-xs focus:outline-none focus:ring-1 focus:ring-ring",onKeyup:R(W,["enter"])},null,544),[[L,k.value]]),t("div",Xe,[t("button",{onClick:W,disabled:!k.value.trim(),class:"flex-1 px-2 py-1 text-xs rounded bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50"}," Create ",8,Ye),t("button",{onClick:e[12]||(e[12]=l=>{$.value=!1,k.value=""}),class:"px-2 py-1 text-xs rounded border border-border hover:bg-accent"}," Cancel ")])])):B("",!0)]),t("div",et,[P.value?(o(),a("div",tt,"Loading...")):s.value.length===0?(o(),a("div",st,"No templates yet.")):(o(!0),a(b,{key:2},K(s.value,l=>(o(),a("button",{key:l,onClick:de=>ne(l),class:z(["w-full text-left px-2 py-1.5 text-xs rounded hover:bg-accent font-mono truncate",n.value===l?"bg-accent text-accent-foreground":"text-foreground"])},N(l),11,ot))),128))])]),t("div",lt,[n.value?(o(),a(b,{key:1},[t("div",rt,[t("span",it,N(n.value),1),t("div",ut,[m.value?(o(),a(b,{key:1},[t("button",{onClick:ie,class:"p-1.5 rounded hover:bg-accent text-green-500",title:"Save"},[v(d(Y),{class:"w-4 h-4"})]),t("button",{onClick:e[13]||(e[13]=l=>m.value=!1),class:"p-1.5 rounded hover:bg-accent text-muted-foreground",title:"Cancel"},[v(d(Z),{class:"w-4 h-4"})])],64)):(o(),a(b,{key:0},[t("button",{onClick:re,class:"p-1.5 rounded hover:bg-accent text-muted-foreground",title:"Edit"},[v(d(X),{class:"w-4 h-4"})]),t("button",{onClick:ue,class:"p-1.5 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive",title:"Delete"},[v(d(ee),{class:"w-4 h-4"})])],64))])]),t("div",dt,[m.value?V((o(),a("textarea",{key:0,"onUpdate:modelValue":e[14]||(e[14]=l=>h.value=l),class:"w-full h-full min-h-[400px] font-mono text-sm bg-background border border-input rounded-md p-3 focus:outline-none focus:ring-1 focus:ring-ring resize-none"},null,512)),[[L,h.value]]):(o(),I(G,{key:1,content:p.value},null,8,["content"]))])],64)):(o(),a("div",at,[t("div",nt,[v(d(te),{class:"w-12 h-12 mx-auto mb-3 opacity-50"}),e[22]||(e[22]=t("p",null,"Select a template to edit",-1)),e[23]||(e[23]=t("p",{class:"text-xs mt-1"},"Templates are copied into new squads on creation",-1))])]))])]))]))}});export{gt as default};
26
+ */const ye=j("LinkIcon",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]),ke={class:"select-none"},we=["onClick"],_e={class:"truncate"},Ce=["onClick"],$e=se({__name:"WikiTree",props:{pages:{},selectedPage:{},searchQuery:{}},emits:["select","addFile"],setup(U,{emit:w}){const x=U,f=w,g=c(new Set);function y(i){const u=[];for(const n of i){const p=n.split("/");let m=u;for(let h=0;h<p.length;h++){const P=p[h],$=p.slice(0,h+1).join("/"),k=h<p.length-1;let F=m.find(D=>D.name===P&&D.isFolder===k);F||(F={name:P,path:$,children:[],isFolder:k},m.push(F)),m=F.children}}const s=n=>{n.sort((p,m)=>p.isFolder!==m.isFolder?p.isFolder?-1:1:p.name.localeCompare(m.name)),n.forEach(p=>s(p.children))};return s(u),u}const _=A(()=>{let i=x.pages;if(x.searchQuery){const u=x.searchQuery.toLowerCase();i=x.pages.filter(s=>s.toLowerCase().includes(u))}return y(i)});oe(()=>x.selectedPage,i=>{if(!i)return;const u=i.split("/");for(let s=1;s<u.length;s++)g.value.add(u.slice(0,s).join("/"))},{immediate:!0});function q(i){g.value.has(i)?g.value.delete(i):g.value.add(i)}function M(i,u){const s=[];for(const n of i)s.push({node:n,depth:u}),n.isFolder&&g.value.has(n.path)&&s.push(...M(n.children,u+1));return s}const C=A(()=>M(_.value,0));return(i,u)=>(o(),a("div",ke,[(o(!0),a(b,null,K(C.value,({node:s,depth:n})=>(o(),a("div",{key:s.path,class:"group relative"},[t("button",{onClick:p=>s.isFolder?q(s.path):f("select",s.path),class:z(["w-full text-left flex items-center gap-1 py-1 text-xs rounded hover:bg-accent transition-colors",{"bg-accent font-medium":!s.isFolder&&U.selectedPage===s.path}]),style:pe({paddingLeft:n*12+8+"px"})},[s.isFolder?(o(),a(b,{key:0},[g.value.has(s.path)?(o(),I(d(ce),{key:0,class:"w-3 h-3 shrink-0 text-muted-foreground"})):(o(),I(d(ge),{key:1,class:"w-3 h-3 shrink-0 text-muted-foreground"})),v(d(be),{class:"w-3.5 h-3.5 shrink-0 text-muted-foreground"})],64)):(o(),a(b,{key:1},[u[0]||(u[0]=t("span",{class:"w-3 shrink-0"},null,-1)),v(d(ve),{class:"w-3.5 h-3.5 shrink-0 text-muted-foreground"})],64)),t("span",_e,N(s.name),1)],14,we),s.isFolder?(o(),a("button",{key:0,onClick:fe(p=>f("addFile",s.path),["stop"]),class:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 rounded opacity-0 group-hover:opacity-100 hover:bg-primary/10 text-muted-foreground hover:text-primary transition-all",title:"Add file here"},[v(d(he),{class:"w-3.5 h-3.5"})],8,Ce)):B("",!0)]))),128))]))}}),Fe={class:"flex flex-col h-full"},Pe={class:"flex border-b border-border shrink-0"},Te={key:0,class:"flex flex-1 overflow-hidden"},qe={class:"w-64 border-r border-border flex flex-col shrink-0"},Me={class:"p-3 border-b border-border space-y-2"},Se={class:"relative"},Ve={key:0,class:"space-y-1.5"},Le={class:"flex gap-1"},Ne=["disabled"],je={class:"flex-1 overflow-y-auto p-2"},De={key:0,class:"text-xs text-muted-foreground p-2"},Ee={class:"flex-1 flex flex-col overflow-hidden"},ze={key:0,class:"flex items-center justify-center h-full text-muted-foreground"},Be={class:"text-center"},Ie={class:"flex items-center justify-between px-4 py-2 border-b border-border"},Ue={class:"text-sm font-medium font-mono"},Ke={class:"flex gap-1"},Qe={class:"flex-1 overflow-y-auto p-4"},We={key:0,class:"mt-8 pt-4 border-t border-border"},Ae={class:"flex items-center gap-1.5 mb-2 text-xs font-medium text-muted-foreground"},He={class:"space-y-1"},Re=["onClick"],Ze={key:1,class:"flex flex-1 overflow-hidden"},Ge={class:"w-64 border-r border-border flex flex-col shrink-0"},Je={class:"p-3 border-b border-border space-y-2"},Oe={key:0,class:"space-y-1.5"},Xe={class:"flex gap-1"},Ye=["disabled"],et={class:"flex-1 overflow-y-auto p-2"},tt={key:0,class:"text-xs text-muted-foreground p-2"},st={key:1,class:"text-xs text-muted-foreground p-2"},ot=["onClick"],lt={class:"flex-1 flex flex-col overflow-hidden"},at={key:0,class:"flex items-center justify-center h-full text-muted-foreground"},nt={class:"text-center"},rt={class:"flex items-center justify-between px-4 py-2 border-b border-border"},it={class:"text-sm font-medium font-mono"},ut={class:"flex gap-1"},dt={class:"flex-1 overflow-y-auto p-4"},bt=se({__name:"WikiView",setup(U){const w=c("pages"),x=c([]),f=c(null),g=c(""),y=c(!1),_=c(""),q=c(""),M=c(!0),C=c(!1),i=c(""),u=c([]),s=c([]),n=c(null),p=c(""),m=c(!1),h=c(""),P=c(!1),$=c(!1),k=c("");me(async()=>{try{x.value=await T("/wiki/pages")}finally{M.value=!1}}),oe(w,async r=>{if(r==="templates"&&s.value.length===0){P.value=!0;try{s.value=await T("/wiki/templates/squad")}finally{P.value=!1}}});async function F(r){f.value=r,y.value=!1;const e=await T(`/wiki/page/${r}`);g.value=e.content,u.value=await T(`/wiki/backlinks/${r}`)}function D(){_.value=g.value,y.value=!0}async function le(){f.value&&(await E(`/wiki/page/${f.value}`,{content:_.value}),g.value=_.value,y.value=!1,u.value=await T(`/wiki/backlinks/${f.value}`))}async function ae(){f.value&&confirm(`Delete "${f.value}"?`)&&(await G(`/wiki/page/${f.value}`),x.value=x.value.filter(r=>r!==f.value),f.value=null,g.value="",u.value=[])}async function Q(){const r=i.value.trim();if(!r)return;const e=r.endsWith(".md")?r:`${r}.md`;await E(`/wiki/page/${e}`,{content:""}),x.value.includes(e)||(x.value.push(e),x.value.sort()),C.value=!1,i.value="",f.value=e,g.value="",_.value="",y.value=!0,u.value=[]}async function ne(r){n.value=r,m.value=!1;const e=await T(`/wiki/template/squad/${r}`);p.value=e.content}function re(){h.value=p.value,m.value=!0}async function ie(){n.value&&(await E(`/wiki/template/squad/${n.value}`,{content:h.value}),p.value=h.value,m.value=!1)}async function ue(){n.value&&confirm(`Delete template "${n.value}"?`)&&(await G(`/wiki/template/squad/${n.value}`),s.value=s.value.filter(r=>r!==n.value),n.value=null,p.value="")}async function W(){const r=k.value.trim();if(!r)return;const e=r.endsWith(".md")?r:`${r}.md`;await E(`/wiki/template/squad/${e}`,{content:""}),s.value.includes(e)||(s.value.push(e),s.value.sort()),$.value=!1,k.value="",n.value=e,p.value="",h.value="",m.value=!0}return(r,e)=>(o(),a("div",Fe,[t("div",Pe,[t("button",{onClick:e[0]||(e[0]=l=>w.value="pages"),class:z(["px-4 py-2 text-sm font-medium border-b-2 transition-colors",w.value==="pages"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"])},[v(d(H),{class:"inline w-4 h-4 mr-1.5 -mt-0.5"}),e[15]||(e[15]=S(" Pages ",-1))],2),t("button",{onClick:e[1]||(e[1]=l=>w.value="templates"),class:z(["px-4 py-2 text-sm font-medium border-b-2 transition-colors",w.value==="templates"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"])},[v(d(te),{class:"inline w-4 h-4 mr-1.5 -mt-0.5"}),e[16]||(e[16]=S(" Squad Templates ",-1))],2)]),w.value==="pages"?(o(),a("div",Te,[t("div",qe,[t("div",Me,[t("div",Se,[v(d(xe),{class:"absolute left-2.5 top-2.5 w-3.5 h-3.5 text-muted-foreground"}),V(t("input",{"onUpdate:modelValue":e[2]||(e[2]=l=>q.value=l),placeholder:"Search pages...",class:"w-full rounded-md border border-input bg-background pl-8 pr-3 py-2 text-xs focus:outline-none focus:ring-1 focus:ring-ring"},null,512),[[L,q.value]])]),t("button",{onClick:e[3]||(e[3]=l=>C.value=!C.value),class:"w-full flex items-center justify-center gap-1.5 px-2 py-1.5 text-xs rounded-md bg-primary text-primary-foreground hover:bg-primary/90"},[v(d(J),{class:"w-3.5 h-3.5"}),e[17]||(e[17]=S(" New Page ",-1))]),C.value?(o(),a("div",Ve,[V(t("input",{"onUpdate:modelValue":e[4]||(e[4]=l=>i.value=l),placeholder:"path/to/page.md",class:"w-full rounded-md border border-input bg-background px-2 py-1.5 text-xs focus:outline-none focus:ring-1 focus:ring-ring",onKeyup:R(Q,["enter"])},null,544),[[L,i.value]]),t("div",Le,[t("button",{onClick:Q,disabled:!i.value.trim(),class:"flex-1 px-2 py-1 text-xs rounded bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50"}," Create ",8,Ne),t("button",{onClick:e[5]||(e[5]=l=>{C.value=!1,i.value=""}),class:"px-2 py-1 text-xs rounded border border-border hover:bg-accent"}," Cancel ")])])):B("",!0)]),t("div",je,[M.value?(o(),a("div",De,"Loading...")):(o(),I($e,{key:1,pages:x.value,"selected-page":f.value,"search-query":q.value,onSelect:e[6]||(e[6]=l=>F(l)),onAddFile:e[7]||(e[7]=l=>{C.value=!0,i.value=l+"/"})},null,8,["pages","selected-page","search-query"]))])]),t("div",Ee,[f.value?(o(),a(b,{key:1},[t("div",Ie,[t("span",Ue,N(f.value),1),t("div",Ke,[y.value?(o(),a(b,{key:1},[t("button",{onClick:le,class:"p-1.5 rounded hover:bg-accent text-green-500",title:"Save"},[v(d(Y),{class:"w-4 h-4"})]),t("button",{onClick:e[8]||(e[8]=l=>y.value=!1),class:"p-1.5 rounded hover:bg-accent text-muted-foreground",title:"Cancel"},[v(d(ee),{class:"w-4 h-4"})])],64)):(o(),a(b,{key:0},[t("button",{onClick:D,class:"p-1.5 rounded hover:bg-accent text-muted-foreground",title:"Edit"},[v(d(O),{class:"w-4 h-4"})]),t("button",{onClick:ae,class:"p-1.5 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive",title:"Delete"},[v(d(X),{class:"w-4 h-4"})])],64))])]),t("div",Qe,[y.value?V((o(),a("textarea",{key:0,"onUpdate:modelValue":e[9]||(e[9]=l=>_.value=l),class:"w-full h-full min-h-[400px] font-mono text-sm bg-background border border-input rounded-md p-3 focus:outline-none focus:ring-1 focus:ring-ring resize-none"},null,512)),[[L,_.value]]):(o(),a(b,{key:1},[v(Z,{content:g.value},null,8,["content"]),u.value.length>0?(o(),a("div",We,[t("div",Ae,[v(d(ye),{class:"w-3.5 h-3.5"}),e[19]||(e[19]=S(" Backlinks ",-1))]),t("ul",He,[(o(!0),a(b,null,K(u.value,l=>(o(),a("li",{key:l},[t("button",{onClick:de=>F(l),class:"text-xs text-primary hover:underline font-mono"},N(l),9,Re)]))),128))])])):B("",!0)],64))])],64)):(o(),a("div",ze,[t("div",Be,[v(d(H),{class:"w-12 h-12 mx-auto mb-3 opacity-50"}),e[18]||(e[18]=t("p",null,"Select a page to view",-1))])]))])])):(o(),a("div",Ze,[t("div",Ge,[t("div",Je,[e[21]||(e[21]=t("p",{class:"text-xs text-muted-foreground"}," Files copied verbatim into each new squad's wiki directory on creation. ",-1)),t("button",{onClick:e[10]||(e[10]=l=>$.value=!$.value),class:"w-full flex items-center justify-center gap-1.5 px-2 py-1.5 text-xs rounded-md bg-primary text-primary-foreground hover:bg-primary/90"},[v(d(J),{class:"w-3.5 h-3.5"}),e[20]||(e[20]=S(" New Template ",-1))]),$.value?(o(),a("div",Oe,[V(t("input",{"onUpdate:modelValue":e[11]||(e[11]=l=>k.value=l),placeholder:"filename.md",class:"w-full rounded-md border border-input bg-background px-2 py-1.5 text-xs focus:outline-none focus:ring-1 focus:ring-ring",onKeyup:R(W,["enter"])},null,544),[[L,k.value]]),t("div",Xe,[t("button",{onClick:W,disabled:!k.value.trim(),class:"flex-1 px-2 py-1 text-xs rounded bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50"}," Create ",8,Ye),t("button",{onClick:e[12]||(e[12]=l=>{$.value=!1,k.value=""}),class:"px-2 py-1 text-xs rounded border border-border hover:bg-accent"}," Cancel ")])])):B("",!0)]),t("div",et,[P.value?(o(),a("div",tt,"Loading...")):s.value.length===0?(o(),a("div",st,"No templates yet.")):(o(!0),a(b,{key:2},K(s.value,l=>(o(),a("button",{key:l,onClick:de=>ne(l),class:z(["w-full text-left px-2 py-1.5 text-xs rounded hover:bg-accent font-mono truncate",n.value===l?"bg-accent text-accent-foreground":"text-foreground"])},N(l),11,ot))),128))])]),t("div",lt,[n.value?(o(),a(b,{key:1},[t("div",rt,[t("span",it,N(n.value),1),t("div",ut,[m.value?(o(),a(b,{key:1},[t("button",{onClick:ie,class:"p-1.5 rounded hover:bg-accent text-green-500",title:"Save"},[v(d(Y),{class:"w-4 h-4"})]),t("button",{onClick:e[13]||(e[13]=l=>m.value=!1),class:"p-1.5 rounded hover:bg-accent text-muted-foreground",title:"Cancel"},[v(d(ee),{class:"w-4 h-4"})])],64)):(o(),a(b,{key:0},[t("button",{onClick:re,class:"p-1.5 rounded hover:bg-accent text-muted-foreground",title:"Edit"},[v(d(O),{class:"w-4 h-4"})]),t("button",{onClick:ue,class:"p-1.5 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive",title:"Delete"},[v(d(X),{class:"w-4 h-4"})])],64))])]),t("div",dt,[m.value?V((o(),a("textarea",{key:0,"onUpdate:modelValue":e[14]||(e[14]=l=>h.value=l),class:"w-full h-full min-h-[400px] font-mono text-sm bg-background border border-input rounded-md p-3 focus:outline-none focus:ring-1 focus:ring-ring resize-none"},null,512)),[[L,h.value]]):(o(),I(Z,{key:1,content:p.value},null,8,["content"]))])],64)):(o(),a("div",at,[t("div",nt,[v(d(te),{class:"w-12 h-12 mx-auto mb-3 opacity-50"}),e[22]||(e[22]=t("p",null,"Select a template to edit",-1)),e[23]||(e[23]=t("p",{class:"text-xs mt-1"},"Templates are copied into new squads on creation",-1))])]))])]))]))}});export{bt as default};
@@ -1 +1 @@
1
- import{V as i,O as c}from"./index-CCZu8Q1C.js";const o="/api";function u(t){try{return JSON.parse(atob(t.split(".")[1])).exp*1e3<=Date.now()+6e4}catch{return!0}}async function n(){const t=i(),e={"Content-Type":"application/json"};return t.token&&u(t.token)&&await t.refreshToken(),t.token&&(e.Authorization=`Bearer ${t.token}`),e}async function s(t,e){if(t.status===401){const r=i();try{if(await r.refreshToken(),r.token){const a=await e();if(a.status===401)throw r.logout(),c.push("/login"),new Error("Session expired");return a}}catch{}throw r.logout(),c.push("/login"),new Error("Session expired")}return t}async function w(t){const e=await s(await fetch(`${o}${t}`,{headers:await n()}),async()=>fetch(`${o}${t}`,{headers:await n()}));if(!e.ok)throw new Error(`API error: ${e.status}`);return e.json()}async function f(t,e){const r={method:"POST",headers:await n(),body:e?JSON.stringify(e):void 0},a=await s(await fetch(`${o}${t}`,r),async()=>fetch(`${o}${t}`,{...r,headers:await n()}));if(!a.ok)throw new Error(`API error: ${a.status}`);return a.json()}async function $(t,e){const r={method:"PUT",headers:await n(),body:e?JSON.stringify(e):void 0},a=await s(await fetch(`${o}${t}`,r),async()=>fetch(`${o}${t}`,{...r,headers:await n()}));if(!a.ok)throw new Error(`API error: ${a.status}`);return a.json()}async function d(t){const e={method:"DELETE",headers:await n()},r=await s(await fetch(`${o}${t}`,e),async()=>fetch(`${o}${t}`,{...e,headers:await n()}));if(!r.ok)throw new Error(`API error: ${r.status}`);return r.json()}function p(){const t=i(),e=`${o}/stream?token=${t.token??""}`;return new EventSource(e)}export{d as a,w as b,f as c,$ as d,p as e};
1
+ import{V as i,O as c}from"./index-BGLdlKTT.js";const o="/api";function u(t){try{return JSON.parse(atob(t.split(".")[1])).exp*1e3<=Date.now()+6e4}catch{return!0}}async function n(){const t=i(),e={"Content-Type":"application/json"};return t.token&&u(t.token)&&await t.refreshToken(),t.token&&(e.Authorization=`Bearer ${t.token}`),e}async function s(t,e){if(t.status===401){const r=i();try{if(await r.refreshToken(),r.token){const a=await e();if(a.status===401)throw r.logout(),c.push("/login"),new Error("Session expired");return a}}catch{}throw r.logout(),c.push("/login"),new Error("Session expired")}return t}async function w(t){const e=await s(await fetch(`${o}${t}`,{headers:await n()}),async()=>fetch(`${o}${t}`,{headers:await n()}));if(!e.ok)throw new Error(`API error: ${e.status}`);return e.json()}async function f(t,e){const r={method:"POST",headers:await n(),body:e?JSON.stringify(e):void 0},a=await s(await fetch(`${o}${t}`,r),async()=>fetch(`${o}${t}`,{...r,headers:await n()}));if(!a.ok)throw new Error(`API error: ${a.status}`);return a.json()}async function $(t,e){const r={method:"PUT",headers:await n(),body:e?JSON.stringify(e):void 0},a=await s(await fetch(`${o}${t}`,r),async()=>fetch(`${o}${t}`,{...r,headers:await n()}));if(!a.ok)throw new Error(`API error: ${a.status}`);return a.json()}async function d(t){const e={method:"DELETE",headers:await n()},r=await s(await fetch(`${o}${t}`,e),async()=>fetch(`${o}${t}`,{...e,headers:await n()}));if(!r.ok)throw new Error(`API error: ${r.status}`);return r.json()}function p(){const t=i(),e=`${o}/stream?token=${t.token??""}`;return new EventSource(e)}export{d as a,w as b,f as c,$ as d,p as e};
@@ -1,4 +1,4 @@
1
- import{r}from"./index-CCZu8Q1C.js";/**
1
+ import{r}from"./index-BGLdlKTT.js";/**
2
2
  * @license lucide-vue-next v0.474.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{r as c}from"./index-CCZu8Q1C.js";/**
1
+ import{r as c}from"./index-BGLdlKTT.js";/**
2
2
  * @license lucide-vue-next v0.474.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.