heyio 1.12.1 → 1.13.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.
- package/dist/copilot/skills.js +8 -2
- package/package.json +5 -2
- package/web-dist/assets/{AuditLogView-C5QtUQBq.js → AuditLogView-BzfjNXBT.js} +1 -1
- package/web-dist/assets/{ChatView-DLu9BMg8.js → ChatView-BdMukPKG.js} +1 -1
- package/web-dist/assets/{FeedView-6OV-l6Gl.js → FeedView-BfPIabGr.js} +1 -1
- package/web-dist/assets/{HistoryView-DizPqv0y.js → HistoryView-BmEEk3Rs.js} +1 -1
- package/web-dist/assets/{LoginView-CG1O9fmR.js → LoginView-D7LrkeX7.js} +1 -1
- package/web-dist/assets/{McpView-TJN-fZvI.js → McpView-BAP_ah3T.js} +1 -1
- package/web-dist/assets/{SchedulesView-BDFpImX6.js → SchedulesView-CAtsUPCZ.js} +2 -2
- package/web-dist/assets/{SettingsView-D-K1iC1c.js → SettingsView-BovjWZDa.js} +1 -1
- package/web-dist/assets/SkillsView-DQSMM5LN.js +16 -0
- package/web-dist/assets/{SquadDetailView-BBvrgHzn.js → SquadDetailView-DBscu0m2.js} +1 -1
- package/web-dist/assets/{SquadHealthView-DF2zF9D3.js → SquadHealthView-D686BuQo.js} +1 -1
- package/web-dist/assets/{SquadsView-CPVzko7k.js → SquadsView-AzMht2NJ.js} +1 -1
- package/web-dist/assets/{ToggleSwitch.vue_vue_type_script_setup_true_lang-Bk_t9_Rn.js → ToggleSwitch.vue_vue_type_script_setup_true_lang-DtShZAjW.js} +1 -1
- package/web-dist/assets/{UsageView-OcyM5k14.js → UsageView-DiVn97aI.js} +2 -2
- package/web-dist/assets/{WikiView-KhFqBZI0.js → WikiView-Cn7KipkZ.js} +2 -2
- package/web-dist/assets/{api-BiDVwQrs.js → api-D4mHJ3u0.js} +1 -1
- package/web-dist/assets/{arrow-left-DFbf2tii.js → arrow-left-D_qUNUWW.js} +1 -1
- package/web-dist/assets/{git-branch-BLstr_Gr.js → git-branch-DOM-orcl.js} +1 -1
- package/web-dist/assets/index-Bo83B1LR.css +1 -0
- package/web-dist/assets/{index-DCJUYZtV.js → index-ELvnkQjd.js} +7 -3
- package/web-dist/assets/{pencil-D4Zz_t0y.js → pencil-CFsi7ufI.js} +1 -1
- package/web-dist/assets/{plus-gmwiZVfr.js → plus-BAzlGFd_.js} +1 -1
- package/web-dist/assets/{save-BvtAs5WB.js → save-BmgCYJ1g.js} +1 -1
- package/web-dist/assets/{search-BabUvoGD.js → search-CS9zSIeW.js} +1 -1
- package/web-dist/assets/{trash-2-C21cNLJl.js → trash-2-DLveUEsd.js} +1 -1
- package/web-dist/assets/{triangle-alert-BrzY_E1n.js → triangle-alert-lj4I30rL.js} +1 -1
- package/web-dist/assets/{x-xgLSmc9e.js → x-CjXR97Fa.js} +1 -1
- package/web-dist/index.html +2 -2
- package/web-dist/assets/SkillsView-DnNmO192.js +0 -15
- package/web-dist/assets/index-B-o45ao1.css +0 -1
package/dist/copilot/skills.js
CHANGED
|
@@ -96,6 +96,10 @@ export async function loadSkillDirectories() {
|
|
|
96
96
|
.filter((e) => e.isDirectory() && existsSync(join(PATHS.skills, e.name, "SKILL.md")))
|
|
97
97
|
.map((e) => join(PATHS.skills, e.name));
|
|
98
98
|
}
|
|
99
|
+
export const GITHUB_REPO_PATH = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;
|
|
100
|
+
export function isGitHubRepoPath(value) {
|
|
101
|
+
return GITHUB_REPO_PATH.test(value.trim());
|
|
102
|
+
}
|
|
99
103
|
const DISCOVERY_CACHE = new Map();
|
|
100
104
|
const CACHE_TTL_MS = 5 * 60 * 1000; // 5 minutes
|
|
101
105
|
/** Validate and return a safe slug, throwing if it contains unsafe characters. */
|
|
@@ -153,14 +157,16 @@ async function fetchSkillsShSkills(query) {
|
|
|
153
157
|
if (!res.ok)
|
|
154
158
|
return [];
|
|
155
159
|
const data = (await res.json());
|
|
156
|
-
return data.skills
|
|
160
|
+
return data.skills
|
|
161
|
+
.map((item) => ({
|
|
157
162
|
slug: item.skillId || item.name || "",
|
|
158
163
|
name: item.name || item.skillId || "",
|
|
159
164
|
description: "",
|
|
160
165
|
source: "skillssh",
|
|
161
166
|
sourceRepo: item.source,
|
|
162
167
|
installs: item.installs,
|
|
163
|
-
}))
|
|
168
|
+
}))
|
|
169
|
+
.filter((item) => item.sourceRepo ? isGitHubRepoPath(item.sourceRepo) : false);
|
|
164
170
|
}
|
|
165
171
|
catch {
|
|
166
172
|
return [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "heyio",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"description": "IO — a personal AI assistant daemon built on the GitHub Copilot SDK",
|
|
5
5
|
"bin": {
|
|
6
6
|
"io": "dist/index.js"
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
"daemon": "tsx src/daemon.ts",
|
|
19
19
|
"dev": "tsx --watch src/daemon.ts",
|
|
20
20
|
"prepublishOnly": "npm run build:all",
|
|
21
|
-
"test": "node --import tsx --test 'src/**/*.test.ts'"
|
|
21
|
+
"test": "node --import tsx --test 'src/**/*.test.ts' 'web/src/**/*.test.ts'",
|
|
22
|
+
"test:coverage": "c8 node --import tsx --test 'src/**/*.test.ts' 'web/src/**/*.test.ts'",
|
|
23
|
+
"coverage:check": "c8 report --reporter=text --reporter=text-summary --check-coverage --lines 40 --functions 35 --branches 60 --statements 40"
|
|
22
24
|
},
|
|
23
25
|
"engines": {
|
|
24
26
|
"node": ">=22"
|
|
@@ -52,6 +54,7 @@
|
|
|
52
54
|
"@types/better-sqlite3": "^7.6.13",
|
|
53
55
|
"@types/express": "^5.0.6",
|
|
54
56
|
"@types/node": "^22.15.0",
|
|
57
|
+
"c8": "^10.1.3",
|
|
55
58
|
"tsx": "^4.21.0",
|
|
56
59
|
"typescript": "^5.8.0"
|
|
57
60
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as W,u as X,E as Z,J as a,q as d,n as o,t as A,T as N,b as V,s as S,R as l,a4 as f,$ as T,d as h,L as w,a0 as L,p as b,K as n,m as _,z as ee}from"./index-
|
|
1
|
+
import{r as W,u as X,E as Z,J as a,q as d,n as o,t as A,T as N,b as V,s as S,R as l,a4 as f,$ as T,d as h,L as w,a0 as L,p as b,K as n,m as _,z as ee}from"./index-ELvnkQjd.js";import{b as F}from"./api-D4mHJ3u0.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 R,W as U,a2 as T,E as X,J as a,q as r,n as o,T as s,t as A,p,d as C,L as S,R as d,w as x,M as W,f as Y,P as J,a4 as Q,a0 as G,o as m,S as Z,j as ee,z as k,K as v,m as I,v as te,a1 as se,_ as ae,x as D,Q as ne,I as j,F as H,l as oe,y as M}from"./index-
|
|
1
|
+
import{u as R,W as U,a2 as T,E as X,J as a,q as r,n as o,T as s,t as A,p,d as C,L as S,R as d,w as x,M as W,f as Y,P as J,a4 as Q,a0 as G,o as m,S as Z,j as ee,z as k,K as v,m as I,v as te,a1 as se,_ as ae,x as D,Q as ne,I as j,F as H,l as oe,y as M}from"./index-ELvnkQjd.js";import{X as re}from"./x-CjXR97Fa.js";const le={class:"flex flex-col h-full"},ie={key:0,class:"flex items-center justify-center h-full"},ce={class:"text-center text-muted-foreground"},ue={key:0,class:"mb-2 space-y-2"},de=["src","alt"],fe={class:"flex items-center gap-2 text-xs"},pe={class:"truncate"},me={class:"opacity-70"},ve={key:2,class:"text-muted-foreground"},he={key:3,class:"inline-block w-2 h-4 bg-current animate-pulse ml-1"},ge={key:0,class:"mb-2 space-y-2"},xe={class:"flex flex-wrap gap-2"},ye={class:"max-w-[170px] truncate"},_e={class:"opacity-70"},be=["onClick"],ke={class:"text-xs text-muted-foreground"},we={key:1,class:"text-xs text-destructive mb-2"},Te={class:"flex gap-2 items-end"},Ae=["disabled"],Ce=["disabled"],ze=R({__name:"ChatView",setup(Se){const c=U(),h=v(""),f=v(""),y=v(),_=v(),i=v([]),g=v(),b=v(!1),N=I(()=>i.value.reduce((e,n)=>e+n.size,0)),z=I(()=>!c.isStreaming&&(h.value.trim().length>0||i.value.length>0));async function B(e){if(!e||e.length===0)return;f.value="";const n=[];try{for(const u of Array.from(e))n.push(await te(u))}catch(u){f.value=(u==null?void 0:u.message)??"Unable to read one or more files.";return}const t=[...i.value,...n],l=se(t);if(!l.ok){f.value=l.error;return}i.value=t,_.value&&(_.value.value="")}function P(e){i.value.splice(e,1),f.value=""}function V(){var e;(e=_.value)==null||e.click()}function F(e){const n=e.target;B((n==null?void 0:n.files)??null)}async function E(){if(!z.value)return;const e=h.value.trim(),n=[...i.value],t=e||"Please review the attached file(s).";h.value="",i.value=[],f.value="",await c.sendMessage(t,n)}function w(){y.value&&(y.value.scrollTop=y.value.scrollHeight)}function $(){g.value&&(g.value.style.height="auto",g.value.style.height=`${Math.min(g.value.scrollHeight,120)}px`)}function K(e){e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),E())}function L(e){e.preventDefault(),b.value=!0}function q(e){e.preventDefault(),b.value=!1}async function O(e){var n;e.preventDefault(),b.value=!1,await B(((n=e.dataTransfer)==null?void 0:n.files)??null)}return T(()=>c.messages.map(e=>e.content),async()=>{await M(),w()},{deep:!0}),T(()=>c.messages.length,async()=>{await M(),w()}),T(()=>h.value,async()=>{await M(),$()}),X(()=>{$(),w()}),(e,n)=>(a(),r("div",le,[o("div",{ref_key:"messagesContainer",ref:y,class:"flex-1 overflow-y-auto p-4 space-y-4"},[s(c).messages.length===0?(a(),r("div",ie,[o("div",ce,[A(ae,{size:56,class:"mx-auto mb-4"}),n[1]||(n[1]=o("p",{class:"text-lg font-medium"},"Welcome to IO",-1)),n[2]||(n[2]=o("p",{class:"text-sm mt-1"},"Send a message to get started.",-1))])])):p("",!0),(a(!0),r(C,null,S(s(c).messages,t=>(a(),r("div",{key:t.id,class:k(["flex",t.role==="user"?"justify-end":"justify-start"])},[o("div",{class:k(["max-w-[75%] rounded-lg px-4 py-2 text-sm",t.role==="user"?"bg-primary text-primary-foreground":"bg-muted text-foreground"])},[t.attachments.length>0?(a(),r("div",ue,[(a(!0),r(C,null,S(t.attachments,(l,u)=>(a(),r("div",{key:`${t.id}-${u}`,class:"rounded border border-border/50 p-2 bg-background/70 text-foreground"},[s(D)(l)?(a(),r("img",{key:0,src:s(ne)(l),alt:l.name,class:"max-h-44 rounded mb-1 object-contain"},null,8,de)):p("",!0),o("div",fe,[s(D)(l)?(a(),m(s(j),{key:0,class:"w-3.5 h-3.5"})):(a(),m(s(H),{key:1,class:"w-3.5 h-3.5"})),o("span",pe,d(l.name),1),o("span",me,d(s(x)(l.size)),1)])]))),128))])):p("",!0),t.content?(a(),m(oe,{key:1,content:t.content,class:k(t.role==="user"?"prose-invert":"")},null,8,["content","class"])):t.streaming?p("",!0):(a(),r("span",ve,"...")),t.streaming?(a(),r("div",he)):p("",!0)],2)],2))),128))],512),o("div",{class:k(["border-t border-border p-4",b.value?"bg-accent/40":""]),onDragover:L,onDragleave:q,onDrop:O},[o("input",{ref_key:"fileInput",ref:_,type:"file",multiple:"",class:"hidden",onChange:F},null,544),i.value.length>0?(a(),r("div",ge,[o("div",xe,[(a(!0),r(C,null,S(i.value,(t,l)=>(a(),r("div",{key:`${t.name}-${l}`,class:"flex items-center gap-2 rounded border border-border px-2 py-1 text-xs bg-muted"},[s(D)(t)?(a(),m(s(j),{key:0,class:"w-3.5 h-3.5"})):(a(),m(s(H),{key:1,class:"w-3.5 h-3.5"})),o("span",ye,d(t.name),1),o("span",_e,d(s(x)(t.size)),1),o("button",{class:"hover:text-destructive",onClick:u=>P(l)},[A(s(re),{class:"w-3.5 h-3.5"})],8,be)]))),128))]),o("p",ke,d(s(x)(N.value))+" attached · Max per file "+d(s(x)(s(W)))+" · Max total "+d(s(x)(s(Y))),1)])):p("",!0),f.value?(a(),r("p",we,d(f.value),1)):p("",!0),o("div",Te,[o("button",{class:"rounded-md border border-input p-2 hover:bg-accent disabled:opacity-50",disabled:s(c).isStreaming,onClick:V,title:"Attach files"},[A(s(J),{class:"w-4 h-4"})],8,Ae),Q(o("textarea",{ref_key:"textareaRef",ref:g,"onUpdate:modelValue":n[0]||(n[0]=t=>h.value=t),onKeydown:K,placeholder:"Send a message...",rows:"1",class:"flex-1 resize-none rounded-md border border-input bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring min-h-[40px] max-h-[120px]"},null,544),[[G,h.value]]),o("button",{onClick:E,disabled:!z.value,class:"rounded-md bg-primary text-primary-foreground p-2 hover:bg-primary/90 disabled:opacity-50 transition-colors"},[s(c).isStreaming?(a(),m(s(ee),{key:1,class:"w-4 h-4"})):(a(),m(s(Z),{key:0,class:"w-4 h-4"}))],8,Ce)])],34)]))}});export{ze as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as M,u as D,E as N,J as o,q as n,n as a,d as h,L as b,t as c,T as i,e as V,K as d,m as z,z as f,R as p,D as B,a6 as k,p as q,l as T}from"./index-
|
|
1
|
+
import{r as M,u as D,E as N,J as o,q as n,n as a,d as h,L as b,t as c,T as i,e as V,K as d,m as z,z as f,R as p,D as B,a6 as k,p as q,l as T}from"./index-ELvnkQjd.js";import{b as C,c as E,a as P}from"./api-D4mHJ3u0.js";import{g as R}from"./squad-colors-B8B_Y-lz.js";import{T as j}from"./trash-2-DLveUEsd.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 q,a2 as F,E as z,J as r,q as n,n as t,t as d,T as c,H as M,a4 as T,a0 as L,g as E,p as x,d as $,L as A,z as p,R as g,K as l,m as P,o as R,l as G}from"./index-
|
|
1
|
+
import{u as q,a2 as F,E as z,J as r,q as n,n as t,t as d,T as c,H as M,a4 as T,a0 as L,g as E,p as x,d as $,L as A,z as p,R as g,K as l,m as P,o as R,l as G}from"./index-ELvnkQjd.js";import{b as B,a as J}from"./api-D4mHJ3u0.js";import{S as K}from"./search-CS9zSIeW.js";import{A as Q}from"./arrow-left-D_qUNUWW.js";import{T as I}from"./trash-2-DLveUEsd.js";const O={class:"flex h-full"},W={class:"p-3 border-b border-border space-y-2"},X={class:"flex items-center gap-2"},Y={class:"relative"},Z={class:"flex gap-2"},ee={class:"flex-1"},te={class:"flex-1"},se={class:"flex-1 overflow-y-auto"},oe={key:0,class:"p-4 text-xs text-muted-foreground"},re={key:1,class:"flex flex-col items-center justify-center h-full p-6 text-center text-muted-foreground"},ne=["onClick"],ae={class:"flex-1 min-w-0"},le={class:"text-xs text-foreground line-clamp-2"},ie={class:"flex items-center gap-2 mt-1"},ue={class:"text-xs text-muted-foreground"},de={class:"text-xs text-muted-foreground"},ce=["onClick"],fe={key:2,class:"p-3 text-center"},ve={key:0,class:"flex-1 flex flex-col"},me={class:"flex items-center gap-2 px-4 py-2 border-b border-border"},xe={class:"text-sm font-medium text-muted-foreground"},pe={class:"flex-1 overflow-y-auto p-4 space-y-4"},ge={key:0,class:"text-center text-xs text-muted-foreground py-8"},he={class:"text-xs mt-1 opacity-60"},ye={key:1,class:"hidden md:flex flex-1 items-center justify-center text-muted-foreground"},be={class:"text-center"},_e=50,De=q({__name:"HistoryView",setup(we){const a=l([]),h=l(0),y=l(!0),f=l(""),v=l(""),m=l(""),u=l(null),b=l([]),_=l(!1),w=l(0);async function k(o=!0){y.value=!0;try{o&&(w.value=0,a.value=[]);const e=new URLSearchParams;f.value&&e.set("q",f.value),v.value&&e.set("from",v.value),m.value&&e.set("to",m.value+"T23:59:59"),e.set("limit",String(_e)),e.set("offset",String(w.value));const i=await B(`/history?${e.toString()}`);a.value=o?i.items:[...a.value,...i.items],h.value=i.total,w.value+=i.items.length}finally{y.value=!1}}async function j(o){u.value=o,_.value=!0;try{b.value=await B(`/history/${o}`)}finally{_.value=!1}}function D(){u.value=null,b.value=[]}async function H(o,e){e.stopPropagation(),confirm("Delete this conversation?")&&(await J(`/history/${o}`),a.value=a.value.filter(i=>i.id!==o),h.value=Math.max(0,h.value-1),u.value===o&&D())}function C(o){return new Date(o).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function N(o,e=100){return o.length>e?o.slice(0,e)+"…":o}const U=P(()=>a.value.length<h.value);let S=null;return F([f,v,m],()=>{S&&clearTimeout(S),S=setTimeout(()=>k(!0),300)}),z(()=>k(!0)),(o,e)=>{var i;return r(),n("div",O,[t("div",{class:p(["flex flex-col border-r border-border",u.value?"hidden md:flex w-80 shrink-0":"flex-1"])},[t("div",W,[t("div",X,[d(c(M),{class:"w-4 h-4 text-muted-foreground"}),e[4]||(e[4]=t("span",{class:"text-sm font-medium"},"Conversation History",-1))]),t("div",Y,[d(c(K),{class:"absolute left-2.5 top-2.5 w-3.5 h-3.5 text-muted-foreground"}),T(t("input",{"onUpdate:modelValue":e[0]||(e[0]=s=>f.value=s),placeholder:"Search conversations...",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,f.value]])]),t("div",Z,[t("div",ee,[e[5]||(e[5]=t("label",{class:"text-xs text-muted-foreground block mb-1"},"From",-1)),T(t("input",{"onUpdate:modelValue":e[1]||(e[1]=s=>v.value=s),type:"date",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"},null,512),[[L,v.value]])]),t("div",te,[e[6]||(e[6]=t("label",{class:"text-xs text-muted-foreground block mb-1"},"To",-1)),T(t("input",{"onUpdate:modelValue":e[2]||(e[2]=s=>m.value=s),type:"date",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"},null,512),[[L,m.value]])])])]),t("div",se,[y.value&&a.value.length===0?(r(),n("div",oe," Loading... ")):a.value.length===0?(r(),n("div",re,[d(c(E),{class:"w-10 h-10 mb-3 opacity-40"}),e[7]||(e[7]=t("p",{class:"text-sm"},"No conversations found.",-1)),e[8]||(e[8]=t("p",{class:"text-xs mt-1"},"Start chatting to build up your history.",-1))])):x("",!0),(r(!0),n($,null,A(a.value,s=>(r(),n("div",{key:s.id,class:p(["group flex items-start gap-2 px-3 py-3 border-b border-border cursor-pointer hover:bg-accent/50 transition-colors",u.value===s.id?"bg-accent":""]),onClick:V=>j(s.id)},[t("div",ae,[t("p",le,g(N(s.preview)),1),t("div",ie,[t("span",ue,g(C(s.updatedAt)),1),t("span",de,"· "+g(s.messageCount)+" msgs",1)])]),t("button",{class:"opacity-0 group-hover:opacity-100 p-1 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-all",title:"Delete",onClick:V=>H(s.id,V)},[d(c(I),{class:"w-3.5 h-3.5"})],8,ce)],10,ne))),128)),U.value?(r(),n("div",fe,[t("button",{class:"text-xs text-muted-foreground hover:text-foreground underline",onClick:e[3]||(e[3]=s=>k(!1))}," Load more ")])):x("",!0)])],2),u.value?(r(),n("div",ve,[t("div",me,[t("button",{class:"p-1.5 rounded hover:bg-accent text-muted-foreground",title:"Back",onClick:D},[d(c(Q),{class:"w-4 h-4"})]),t("span",xe,g(C(((i=a.value.find(s=>s.id===u.value))==null?void 0:i.startedAt)??"")),1)]),t("div",pe,[_.value?(r(),n("div",ge," Loading... ")):x("",!0),(r(!0),n($,null,A(b.value,s=>(r(),n("div",{key:s.id,class:p(["flex",s.role==="user"?"justify-end":"justify-start"])},[t("div",{class:p(["max-w-[75%] rounded-lg px-4 py-2 text-sm",s.role==="user"?"bg-blue-600 text-white":"bg-muted text-foreground"])},[s.content?(r(),R(G,{key:0,content:s.content,class:p(s.role==="user"?"prose-invert":"")},null,8,["content","class"])):x("",!0),t("p",he,g(C(s.createdAt)),1)],2)],2))),128))])])):u.value?x("",!0):(r(),n("div",ye,[t("div",be,[d(c(M),{class:"w-12 h-12 mx-auto mb-3 opacity-50"}),e[9]||(e[9]=t("p",null,"Select a conversation to view",-1))])]))])}}});export{De as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as b,V as v,J as u,q as i,n as t,t as y,a6 as w,a4 as m,a0 as p,R as c,p as V,T as f,K as d,_,Y as h}from"./index-
|
|
1
|
+
import{u as b,V as v,J as u,q as i,n as t,t as y,a6 as w,a4 as m,a0 as p,R as c,p as V,T as f,K as d,_,Y as h}from"./index-ELvnkQjd.js";const S={class:"min-h-screen flex items-center justify-center bg-background p-4"},k={class:"w-full max-w-sm space-y-8"},q={class:"text-center"},A={key:0,class:"text-sm text-destructive"},B=["disabled"],L=b({__name:"LoginView",setup(D){const o=v(),g=h(),r=d(""),n=d(""),s=d("");async function x(){s.value="";try{await o.login(r.value,n.value),g.push("/")}catch(l){s.value=l.message??"Login failed"}}return(l,e)=>(u(),i("div",S,[t("div",k,[t("div",q,[y(_,{size:56,class:"mx-auto mb-4"}),e[2]||(e[2]=t("h1",{class:"font-display text-4xl font-normal uppercase tracking-[0.18em] bg-gradient-brand bg-clip-text text-transparent"}," IO ",-1)),e[3]||(e[3]=t("p",{class:"text-sm text-muted-foreground mt-1"},"Sign in to your dashboard",-1))]),t("form",{onSubmit:w(x,["prevent"]),class:"space-y-4 bg-card border border-border rounded-lg p-6"},[t("div",null,[e[4]||(e[4]=t("label",{class:"text-sm font-medium text-muted-foreground",for:"email"},"Email",-1)),m(t("input",{id:"email","onUpdate:modelValue":e[0]||(e[0]=a=>r.value=a),type:"email",required:"",class:"mt-1 w-full rounded-md border border-border bg-input px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring",placeholder:"you@example.com"},null,512),[[p,r.value]])]),t("div",null,[e[5]||(e[5]=t("label",{class:"text-sm font-medium text-muted-foreground",for:"password"},"Password",-1)),m(t("input",{id:"password","onUpdate:modelValue":e[1]||(e[1]=a=>n.value=a),type:"password",required:"",class:"mt-1 w-full rounded-md border border-border bg-input px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring",placeholder:"••••••••"},null,512),[[p,n.value]])]),s.value?(u(),i("div",A,c(s.value),1)):V("",!0),t("button",{type:"submit",disabled:f(o).loading,class:"btn-gradient w-full py-2.5"},c(f(o).loading?"Signing in...":"Sign In"),9,B)],32),e[6]||(e[6]=t("p",{class:"text-center text-xs text-muted-foreground"},"Personal AI Assistant Daemon",-1))])]))}});export{L as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as E,E as S,J as l,q as a,n as s,t as c,T as b,s as C,a4 as i,a0 as m,$ as M,p as x,i as P,d as $,L as j,K as f,R as p}from"./index-
|
|
1
|
+
import{u as E,E as S,J as l,q as a,n as s,t as c,T as b,s as C,a4 as i,a0 as m,$ as M,p as x,i as P,d as $,L as j,K as f,R as p}from"./index-ELvnkQjd.js";import{b as U,c as I,d as N,a as L}from"./api-D4mHJ3u0.js";import{_ as O}from"./ToggleSwitch.vue_vue_type_script_setup_true_lang-DtShZAjW.js";import{P as G}from"./plus-BAzlGFd_.js";import{T as K}from"./trash-2-DLveUEsd.js";const F={class:"p-6"},Y={class:"flex items-center justify-between mb-6"},B={key:0,class:"border border-border rounded-lg p-4 mb-6 space-y-3 bg-card"},h={class:"grid grid-cols-2 gap-3"},D={key:0},J={key:1},R={key:1,class:"text-muted-foreground"},q={key:2,class:"text-center py-12 text-muted-foreground"},W={key:3,class:"space-y-2"},z={class:"space-y-1"},H={class:"flex items-center gap-2"},Q={class:"font-medium text-sm"},X={class:"text-xs text-muted-foreground bg-secondary px-1.5 py-0.5 rounded"},Z={key:0,class:"text-xs text-muted-foreground"},ee={key:1,class:"text-xs text-muted-foreground"},te={key:2,class:"text-xs text-muted-foreground"},se={class:"flex items-center gap-3"},oe=["onClick"],ie=E({__name:"McpView",setup(ne){const u=f([]),g=f(!0),v=f(!1),o=f({name:"",type:"stdio",command:"",url:"",argsText:"",envText:""});S(async()=>{try{u.value=await U("/mcp")}finally{g.value=!1}});function k(n){return n.split(/\r?\n|,/).map(e=>e.trim()).filter(Boolean)}function w(n){const e={};try{const t=JSON.parse(n);if(t&&typeof t=="object"&&!Array.isArray(t)){for(const[d,r]of Object.entries(t))e[d]=String(r);return e}}catch{}for(const t of n.split(/\r?\n/)){const d=t.trim();if(!d||d.startsWith("#"))continue;const r=d.indexOf("=");if(r===-1)continue;const y=d.slice(0,r).trim(),A=d.slice(r+1).trim();y&&(e[y]=A)}return e}async function _(n){await N(`/mcp/${n.id}`,{enabled:!n.enabled}),n.enabled=!n.enabled}async function T(n){await L(`/mcp/${n}`),u.value=u.value.filter(e=>e.id!==n)}async function V(){const n={name:o.value.name,type:o.value.type,args:k(o.value.argsText),env:w(o.value.envText)};o.value.type==="stdio"?n.command=o.value.command:n.url=o.value.url;const e=await I("/mcp",n);u.value.push(e),v.value=!1,o.value={name:"",type:"stdio",command:"",url:"",argsText:"",envText:""}}return(n,e)=>(l(),a("div",F,[s("div",Y,[e[8]||(e[8]=s("div",null,[s("p",{class:"text-sm font-medium text-primary"},"MCP configuration"),s("h1",{class:"text-2xl font-bold"},"MCP Servers")],-1)),s("button",{onClick:e[0]||(e[0]=t=>v.value=!v.value),class:"btn-gradient inline-flex items-center gap-1"},[c(b(G),{class:"w-4 h-4"}),e[7]||(e[7]=C(" Add Server ",-1))])]),v.value?(l(),a("div",B,[s("div",h,[s("div",null,[e[9]||(e[9]=s("label",{class:"text-sm font-medium"},"Name",-1)),i(s("input",{"onUpdate:modelValue":e[1]||(e[1]=t=>o.value.name=t),class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},null,512),[[m,o.value.name]])]),s("div",null,[e[11]||(e[11]=s("label",{class:"text-sm font-medium"},"Type",-1)),i(s("select",{"onUpdate:modelValue":e[2]||(e[2]=t=>o.value.type=t),class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},[...e[10]||(e[10]=[s("option",{value:"stdio"},"stdio",-1),s("option",{value:"http"},"http",-1)])],512),[[M,o.value.type]])])]),o.value.type==="stdio"?(l(),a("div",D,[e[12]||(e[12]=s("label",{class:"text-sm font-medium"},"Command",-1)),i(s("input",{"onUpdate:modelValue":e[3]||(e[3]=t=>o.value.command=t),placeholder:"npx @my/mcp-server",class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},null,512),[[m,o.value.command]])])):(l(),a("div",J,[e[13]||(e[13]=s("label",{class:"text-sm font-medium"},"URL",-1)),i(s("input",{"onUpdate:modelValue":e[4]||(e[4]=t=>o.value.url=t),placeholder:"https://...",class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},null,512),[[m,o.value.url]])])),s("div",null,[e[14]||(e[14]=s("label",{class:"text-sm font-medium"},"Command args",-1)),i(s("textarea",{"onUpdate:modelValue":e[5]||(e[5]=t=>o.value.argsText=t),rows:"3",placeholder:"--stdio\n--figma-api-key=${FIGMA_API_KEY}",class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},null,512),[[m,o.value.argsText]]),e[15]||(e[15]=s("p",{class:"mt-1 text-xs text-muted-foreground"},"Enter one arg per line or comma-separated.",-1))]),s("div",null,[e[16]||(e[16]=s("label",{class:"text-sm font-medium"},"Environment variables",-1)),i(s("textarea",{"onUpdate:modelValue":e[6]||(e[6]=t=>o.value.envText=t),rows:"4",placeholder:"FIGMA_API_KEY=${FIGMA_API_KEY}\nLOG_LEVEL=debug",class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm font-mono"},null,512),[[m,o.value.envText]]),e[17]||(e[17]=s("p",{class:"mt-1 text-xs text-muted-foreground"}," Use KEY=value lines, or paste JSON. Values like ${FIGMA_API_KEY} are preserved. ",-1))]),s("div",{class:"flex justify-end"},[s("button",{onClick:V,class:"btn-gradient"},"Save")])])):x("",!0),g.value?(l(),a("div",R,"Loading...")):u.value.length===0?(l(),a("div",q,[c(b(P),{class:"w-12 h-12 mx-auto mb-3 opacity-50"}),e[18]||(e[18]=s("p",null,"No MCP servers configured.",-1))])):(l(),a("div",W,[(l(!0),a($,null,j(u.value,t=>{var d;return l(),a("div",{key:t.id,class:"flex items-center justify-between border border-border rounded-lg px-4 py-3 bg-card"},[s("div",z,[s("div",H,[s("span",Q,p(t.name),1),s("span",X,p(t.type),1)]),t.command||t.url?(l(),a("div",Z,p(t.command||t.url),1)):x("",!0),(d=t.args)!=null&&d.length?(l(),a("div",ee," Args: "+p(t.args.join(", ")),1)):x("",!0),t.env&&Object.keys(t.env).length>0?(l(),a("div",te," Env: "+p(Object.keys(t.env).join(", ")),1)):x("",!0)]),s("div",se,[c(O,{"model-value":t.enabled,"aria-label":`Toggle ${t.name}`,"onUpdate:modelValue":r=>_(t)},null,8,["model-value","aria-label","onUpdate:modelValue"]),s("button",{onClick:r=>T(t.id),class:"p-1.5 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive"},[c(b(K),{class:"w-4 h-4"})],8,oe)])])}),128))]))]))}});export{ie as default};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{r as J,u as G,E as H,J as m,q as p,n as s,t as _,T as k,s as V,d as C,L as P,a4 as S,$ as A,a0 as M,p as T,c as K,R as h,K as b,m as D,z as Y,D as Q}from"./index-
|
|
1
|
+
import{r as J,u as G,E as H,J as m,q as p,n as s,t as _,T as k,s as V,d as C,L as P,a4 as S,$ as A,a0 as M,p as T,c as K,R as h,K as b,m as D,z as Y,D as Q}from"./index-ELvnkQjd.js";import{b as I,c as O,d as E,a as X}from"./api-D4mHJ3u0.js";import{g as Z}from"./squad-colors-B8B_Y-lz.js";import{_ as ee}from"./ToggleSwitch.vue_vue_type_script_setup_true_lang-DtShZAjW.js";import{P as te}from"./plus-BAzlGFd_.js";import{P as ne}from"./pencil-CFsi7ufI.js";import{T as re}from"./trash-2-DLveUEsd.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 oe=J("PlayIcon",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]),se=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ae=["January","February","March","April","May","June","July","August","September","October","November","December"];function $(l,r,o){const n=new Set;if(l==="*"){for(let u=r;u<=o;u+=1)n.add(u);return Array.from(n)}if(l.startsWith("*/")){const u=Number.parseInt(l.slice(2),10);if(Number.isNaN(u)||u<=0)return[];for(let d=r;d<=o;d+=u)n.add(d);return Array.from(n)}const i=l.split(",").map(u=>u.trim()).filter(Boolean);for(const u of i){if(u.includes("-")){const[f,c]=u.split("-"),v=Number.parseInt(f,10),g=Number.parseInt(c,10);if(Number.isNaN(v)||Number.isNaN(g))continue;for(let y=Math.min(v,g);y<=Math.max(v,g);y+=1)y>=r&&y<=o&&n.add(y);continue}const d=Number.parseInt(u,10);!Number.isNaN(d)&&d>=r&&d<=o&&n.add(d)}return Array.from(n)}function q(l,r){const o=(l+11)%12+1,n=l<12?"AM":"PM",i=r.toString().padStart(2,"0");return`${o}:${i} ${n}`}function j(l,r){if(l.length===0)return"";if(l.length===1)return r[l[0]];const o=l.map(n=>r[n]);return o.length===2?`${o[0]} and ${o[1]}`:`${o.slice(0,-1).join(", ")}, and ${o[o.length-1]}`}function de(l){const r=$(l,0,6);if(r.length===0)return"";const o=r.map(c=>c===7?0:c),n=Array.from(new Set(o)).sort((c,v)=>c-v);if(n.length===7)return"every day";const i=[1,2,3,4,5],u=[0,6],d=i.every(c=>n.includes(c))&&n.length===i.length,f=u.every(c=>n.includes(c))&&n.length===u.length;return d?"weekdays":f?"weekends":j(n,se)}function ie(l){const r=$(l,1,12);return r.length===0||r.length===12?"":j(r.map(o=>o-1),ae)}function le(l){const r=$(l,1,31);if(r.length===0||r.length===31)return"";const o=r.map(n=>{const i=[11,12,13].includes(n)?"th":[1,21,31].includes(n)?"st":[2,22].includes(n)?"nd":[3,23].includes(n)?"rd":"th";return`${n}${i}`});return o.length===1?`on the ${o[0]} of the month`:`on the ${o.join(", ")}`}function ue(l,r){const o=$(l,0,59),n=$(r,0,23);if(o.length===0||n.length===0)return"custom times";if(l==="*"&&r==="*")return"every minute";if(l==="*"&&r.startsWith("*/")){const i=Number.parseInt(r.slice(2),10);if(!Number.isNaN(i)&&i>0)return`every ${i} hours`}if(l.startsWith("*/")&&r==="*"){const i=Number.parseInt(l.slice(2),10);if(!Number.isNaN(i)&&i>0)return`every ${i} minutes`}return l==="*"&&n.length===24?"every hour":l==="*"&&n.length===1?`once each hour at ${q(n[0],0)}`:o.length===1&&n.length===1?`at ${q(n[0],o[0])}`:o.length>1&&n.length===1?`at ${o.map(i=>q(n[0],i)).join(", ")}`:n.length>1&&o.length===1?`at ${n.map(i=>q(i,o[0])).join(", ")}`:"at matching times"}function ce(l){const r=l.trim().split(/\s+/);if(r.length!==5)return"custom schedule";const[o,n,i,u,d]=r,f=ue(o,n),c=de(d),v=le(i),g=ie(u);if(f==="every minute")return"every minute";const y=d!=="*"&&i==="*"?`on ${c}`:i!=="*"&&d==="*"?v:d==="*"&&i==="*"?"each day":"on matching days",w=[f,y].filter(N=>N&&N!=="custom times"&&N!=="at matching times");return g&&w.push(`in ${g}`),w.length===0?"custom schedule":w.join(" ")}const me={class:"p-6"},pe={class:"flex items-center justify-between mb-6"},fe={class:"flex gap-1 border-b border-border mb-4"},ve=["onClick"],ge={key:0,class:"border border-border rounded-lg p-4 mb-4 space-y-3"},ye={class:"grid grid-cols-2 gap-3"},be=["value"],xe=["disabled"],he={key:1,class:"text-muted-foreground"},_e={key:2,class:"text-center py-12 text-muted-foreground"},ke={key:3,class:"space-y-2"},we={class:"text-sm font-medium font-mono"},Ne={class:"text-xs text-primary/90 mt-1 font-medium"},Se={key:0,class:"mt-1"},$e={class:"text-xs text-muted-foreground mt-0.5"},qe={key:0,class:"mt-2 space-y-2"},Ce={class:"flex gap-2"},Pe=["onClick"],Me={key:1,class:"mt-2 flex items-center justify-between gap-3"},Te=["onClick"],Ve={class:"text-xs text-muted-foreground mt-0.5"},Ae={class:"flex items-center gap-3"},De=["onClick"],Ie={key:0,class:"text-xs text-green-500 font-medium"},Oe=["onClick"],ze=G({__name:"SchedulesView",setup(l){const r=b([]),o=b([]),n=b(!0),i=b("squad"),u=b(!1),d=b({type:"squad",cron:"",squad_id:"",prompt:""}),f=b(null),c=b(""),v=b(null);H(async()=>{try{const a=await I("/squads");o.value=a.squads,o.value.length>0&&(d.value.squad_id=o.value[0].id),r.value=await I("/schedules")}finally{n.value=!1}});const g=D(()=>r.value.filter(a=>a.type===i.value));async function y(){const a={type:d.value.type,cron:d.value.cron,squad_id:d.value.squad_id};if(!d.value.squad_id||!d.value.prompt.trim())return;a.prompt=d.value.prompt;const e=await O("/schedules",a);r.value.push(e),u.value=!1}function w(a){if(a)return o.value.find(e=>e.id===a)}const N=D(()=>g.value.map(a=>({...a,squad:w(a.squad_id),description:ce(a.cron)})));async function U(a){const e=!a.enabled,t=await E(`/schedules/${a.id}`,{enabled:e});a.enabled=t.enabled}function W(a){f.value=a.id,c.value=a.prompt}async function B(a){const e=await E(`/schedules/${a.id}`,{prompt:c.value});a.prompt=e.prompt,f.value=null,c.value=""}function L(){f.value=null,c.value=""}async function R(a){await X(`/schedules/${a}`),r.value=r.value.filter(e=>e.id!==a)}async function z(a){await O(`/schedules/${a.id}/trigger`,{}),v.value=a.id;const e=r.value.findIndex(t=>t.id===a.id);e!==-1&&(r.value[e]={...r.value[e],last_run:new Date().toISOString()}),setTimeout(()=>{v.value=null},3e3)}function F(a){var e;return a?((e=o.value.find(t=>t.id===a))==null?void 0:e.name)??a:"Unknown squad"}return(a,e)=>(m(),p("div",me,[s("div",pe,[e[8]||(e[8]=s("h1",{class:"text-2xl font-bold"},"Schedules",-1)),s("button",{onClick:e[0]||(e[0]=t=>u.value=!u.value),class:"inline-flex items-center gap-1 px-3 py-1.5 text-sm rounded-md bg-primary text-primary-foreground hover:bg-primary/90 transition-colors"},[_(k(te),{class:"w-4 h-4"}),e[7]||(e[7]=V(" Add Schedule ",-1))])]),s("div",fe,[(m(),p(C,null,P(["squad","io"],t=>s("button",{key:t,onClick:x=>i.value=t,class:Y(["px-4 py-2 text-sm font-medium border-b-2 transition-colors",i.value===t?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"])},h(t==="squad"?"Squad Schedules":"IO Schedules"),11,ve)),64))]),u.value?(m(),p("div",ge,[s("div",ye,[s("div",null,[e[10]||(e[10]=s("label",{class:"text-sm font-medium"},"Type",-1)),S(s("select",{"onUpdate:modelValue":e[1]||(e[1]=t=>d.value.type=t),class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},[...e[9]||(e[9]=[s("option",{value:"squad"},"Squad",-1),s("option",{value:"io"},"IO",-1)])],512),[[A,d.value.type]])]),s("div",null,[e[11]||(e[11]=s("label",{class:"text-sm font-medium"},"Cron Expression",-1)),S(s("input",{"onUpdate:modelValue":e[2]||(e[2]=t=>d.value.cron=t),placeholder:"0 9 * * 1-5",class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},null,512),[[M,d.value.cron]])])]),s("div",null,[e[12]||(e[12]=s("label",{class:"text-sm font-medium"},"Target Squad",-1)),S(s("select",{"onUpdate:modelValue":e[3]||(e[3]=t=>d.value.squad_id=t),class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},[(m(!0),p(C,null,P(o.value,t=>(m(),p("option",{key:t.id,value:t.id},h(t.name),9,be))),128))],512),[[A,d.value.squad_id]])]),s("div",null,[e[13]||(e[13]=s("label",{class:"text-sm font-medium"},"Prompt",-1)),S(s("textarea",{"onUpdate:modelValue":e[4]||(e[4]=t=>d.value.prompt=t),rows:"3",placeholder:"e.g. Triage issues, review PRs, ideate on features",class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},null,512),[[M,d.value.prompt]])]),s("button",{onClick:y,disabled:!d.value.squad_id||!d.value.prompt.trim(),class:"px-4 py-2 text-sm rounded-md bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed"}," Save ",8,xe)])):T("",!0),n.value?(m(),p("div",he,"Loading...")):g.value.length===0?(m(),p("div",_e,[_(k(K),{class:"w-12 h-12 mx-auto mb-3 opacity-50"}),s("p",null,"No "+h(i.value)+" schedules configured.",1)])):(m(),p("div",ke,[(m(!0),p(C,null,P(N.value,t=>(m(),p("div",{key:t.id,class:"flex items-center justify-between border border-border rounded-lg px-4 py-3"},[s("div",null,[s("div",we,h(t.cron),1),s("div",Ne,"Runs "+h(t.description),1),t.squad?(m(),p("div",Se,[s("span",{class:"text-xs px-2 py-0.5 rounded-full",style:Q(k(Z)(t.squad.color))},h(t.squad.name),5)])):T("",!0),s("div",$e,[f.value===t.id?(m(),p("div",qe,[S(s("textarea",{"onUpdate:modelValue":e[5]||(e[5]=x=>c.value=x),rows:"3",class:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",placeholder:"Schedule prompt"},null,512),[[M,c.value]]),s("div",Ce,[s("button",{onClick:x=>B(t),class:"px-3 py-1.5 text-xs rounded-md bg-primary text-primary-foreground hover:bg-primary/90"}," Save ",8,Pe),s("button",{onClick:e[6]||(e[6]=x=>L()),class:"px-3 py-1.5 text-xs rounded-md border border-border hover:bg-muted/50"}," Cancel ")])])):(m(),p("div",Me,[s("span",null,h(t.prompt?t.prompt:"(no prompt)"),1),s("button",{onClick:x=>W(t),class:"inline-flex items-center gap-1 px-2 py-1 text-xs rounded-md border border-border hover:bg-muted/50"},[_(k(ne),{class:"w-3 h-3"}),e[14]||(e[14]=V(" Edit prompt ",-1))],8,Te)]))]),s("div",Ve," Squad: "+h(F(t.squad_id)),1)]),s("div",Ae,[s("button",{onClick:x=>z(t),class:"p-1.5 rounded hover:bg-primary/10 text-muted-foreground hover:text-primary",title:"Trigger now"},[_(k(oe),{class:"w-4 h-4"})],8,De),v.value===t.id?(m(),p("span",Ie,"Triggered!")):T("",!0),_(ee,{"model-value":!!t.enabled,"aria-label":`Toggle schedule ${t.cron}`,"onUpdate:modelValue":x=>U(t)},null,8,["model-value","aria-label","onUpdate:modelValue"]),s("button",{onClick:x=>R(t.id),class:"p-1.5 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive"},[_(k(re),{class:"w-4 h-4"})],8,Oe)])]))),128))]))]))}});export{ze as default};
|
|
6
|
+
*/const oe=J("PlayIcon",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]),se=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ae=["January","February","March","April","May","June","July","August","September","October","November","December"];function $(l,r,o){const n=new Set;if(l==="*"){for(let u=r;u<=o;u+=1)n.add(u);return Array.from(n)}if(l.startsWith("*/")){const u=Number.parseInt(l.slice(2),10);if(Number.isNaN(u)||u<=0)return[];for(let d=r;d<=o;d+=u)n.add(d);return Array.from(n)}const i=l.split(",").map(u=>u.trim()).filter(Boolean);for(const u of i){if(u.includes("-")){const[f,c]=u.split("-"),v=Number.parseInt(f,10),g=Number.parseInt(c,10);if(Number.isNaN(v)||Number.isNaN(g))continue;for(let y=Math.min(v,g);y<=Math.max(v,g);y+=1)y>=r&&y<=o&&n.add(y);continue}const d=Number.parseInt(u,10);!Number.isNaN(d)&&d>=r&&d<=o&&n.add(d)}return Array.from(n)}function q(l,r){const o=(l+11)%12+1,n=l<12?"AM":"PM",i=r.toString().padStart(2,"0");return`${o}:${i} ${n}`}function j(l,r){if(l.length===0)return"";if(l.length===1)return r[l[0]];const o=l.map(n=>r[n]);return o.length===2?`${o[0]} and ${o[1]}`:`${o.slice(0,-1).join(", ")}, and ${o[o.length-1]}`}function de(l){const r=$(l,0,6);if(r.length===0)return"";const o=r.map(c=>c===7?0:c),n=Array.from(new Set(o)).sort((c,v)=>c-v);if(n.length===7)return"every day";const i=[1,2,3,4,5],u=[0,6],d=i.every(c=>n.includes(c))&&n.length===i.length,f=u.every(c=>n.includes(c))&&n.length===u.length;return d?"weekdays":f?"weekends":j(n,se)}function ie(l){const r=$(l,1,12);return r.length===0||r.length===12?"":j(r.map(o=>o-1),ae)}function le(l){const r=$(l,1,31);if(r.length===0||r.length===31)return"";const o=r.map(n=>{const i=[11,12,13].includes(n)?"th":[1,21,31].includes(n)?"st":[2,22].includes(n)?"nd":[3,23].includes(n)?"rd":"th";return`${n}${i}`});return o.length===1?`on the ${o[0]} of the month`:`on the ${o.join(", ")}`}function ue(l,r){const o=$(l,0,59),n=$(r,0,23);if(o.length===0||n.length===0)return"custom times";if(l==="*"&&r==="*")return"every minute";if(l==="*"&&r.startsWith("*/")){const i=Number.parseInt(r.slice(2),10);if(!Number.isNaN(i)&&i>0)return`every ${i} hours`}if(l.startsWith("*/")&&r==="*"){const i=Number.parseInt(l.slice(2),10);if(!Number.isNaN(i)&&i>0)return`every ${i} minutes`}return l==="*"&&n.length===24?"every hour":l==="*"&&n.length===1?`once each hour at ${q(n[0],0)}`:o.length===1&&n.length===1?`at ${q(n[0],o[0])}`:o.length>1&&n.length===1?`at ${o.map(i=>q(n[0],i)).join(", ")}`:n.length>1&&o.length===1?`at ${n.map(i=>q(i,o[0])).join(", ")}`:"at matching times"}function ce(l){const r=l.trim().split(/\s+/);if(r.length!==5)return"custom schedule";const[o,n,i,u,d]=r,f=ue(o,n),c=de(d),v=le(i),g=ie(u);if(f==="every minute")return"every minute";const y=d!=="*"&&i==="*"?`on ${c}`:i!=="*"&&d==="*"?v:d==="*"&&i==="*"?"each day":"on matching days",w=[f,y].filter(N=>N&&N!=="custom times"&&N!=="at matching times");return g&&w.push(`in ${g}`),w.length===0?"custom schedule":w.join(" ")}const me={class:"p-6"},pe={class:"flex items-center justify-between mb-6"},fe={class:"flex gap-1 border-b border-border mb-4"},ve=["onClick"],ge={key:0,class:"border border-border rounded-lg p-4 mb-4 space-y-3"},ye={class:"grid grid-cols-2 gap-3"},be=["value"],xe=["disabled"],he={key:1,class:"text-muted-foreground"},_e={key:2,class:"text-center py-12 text-muted-foreground"},ke={key:3,class:"space-y-2"},we={class:"text-sm font-medium font-mono"},Ne={class:"text-xs text-primary/90 mt-1 font-medium"},Se={key:0,class:"mt-1"},$e={class:"text-xs text-muted-foreground mt-0.5"},qe={key:0,class:"mt-2 space-y-2"},Ce={class:"flex gap-2"},Pe=["onClick"],Me={key:1,class:"mt-2 flex items-center justify-between gap-3"},Te=["onClick"],Ve={class:"text-xs text-muted-foreground mt-0.5"},Ae={class:"flex items-center gap-3"},De=["onClick"],Ie={key:0,class:"text-xs text-green-500 font-medium"},Oe=["onClick"],ze=G({__name:"SchedulesView",setup(l){const r=b([]),o=b([]),n=b(!0),i=b("squad"),u=b(!1),d=b({type:"squad",cron:"",squad_id:"",prompt:""}),f=b(null),c=b(""),v=b(null);H(async()=>{try{const a=await I("/squads");o.value=a.squads,o.value.length>0&&(d.value.squad_id=o.value[0].id),r.value=await I("/schedules")}finally{n.value=!1}});const g=D(()=>r.value.filter(a=>a.type===i.value));async function y(){const a={type:d.value.type,cron:d.value.cron,squad_id:d.value.squad_id};if(!d.value.squad_id||!d.value.prompt.trim())return;a.prompt=d.value.prompt;const e=await O("/schedules",a);r.value.push(e),u.value=!1}function w(a){if(a)return o.value.find(e=>e.id===a)}const N=D(()=>g.value.map(a=>({...a,squad:w(a.squad_id),description:ce(a.cron)})));async function U(a){const e=!a.enabled,t=await E(`/schedules/${a.id}`,{enabled:e});a.enabled=t.enabled}function W(a){f.value=a.id,c.value=a.prompt}async function B(a){const e=await E(`/schedules/${a.id}`,{prompt:c.value});a.prompt=e.prompt,f.value=null,c.value=""}function L(){f.value=null,c.value=""}async function R(a){await X(`/schedules/${a}`),r.value=r.value.filter(e=>e.id!==a)}async function z(a){await O(`/schedules/${a.id}/trigger`,{}),v.value=a.id;const e=r.value.findIndex(t=>t.id===a.id);e!==-1&&(r.value[e]={...r.value[e],last_run:new Date().toISOString()}),setTimeout(()=>{v.value=null},3e3)}function F(a){var e;return a?((e=o.value.find(t=>t.id===a))==null?void 0:e.name)??a:"Unknown squad"}return(a,e)=>(m(),p("div",me,[s("div",pe,[e[8]||(e[8]=s("h1",{class:"text-2xl font-bold"},"Schedules",-1)),s("button",{onClick:e[0]||(e[0]=t=>u.value=!u.value),class:"inline-flex items-center gap-1 px-3 py-1.5 text-sm rounded-md bg-primary text-primary-foreground hover:bg-primary/90 transition-colors"},[_(k(te),{class:"w-4 h-4"}),e[7]||(e[7]=V(" Add Schedule ",-1))])]),s("div",fe,[(m(),p(C,null,P(["squad","io"],t=>s("button",{key:t,onClick:x=>i.value=t,class:Y(["px-4 py-2 text-sm font-medium border-b-2 transition-colors",i.value===t?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"])},h(t==="squad"?"Squad Schedules":"IO Schedules"),11,ve)),64))]),u.value?(m(),p("div",ge,[s("div",ye,[s("div",null,[e[10]||(e[10]=s("label",{class:"text-sm font-medium"},"Type",-1)),S(s("select",{"onUpdate:modelValue":e[1]||(e[1]=t=>d.value.type=t),class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},[...e[9]||(e[9]=[s("option",{value:"squad"},"Squad",-1),s("option",{value:"io"},"IO",-1)])],512),[[A,d.value.type]])]),s("div",null,[e[11]||(e[11]=s("label",{class:"text-sm font-medium"},"Cron Expression",-1)),S(s("input",{"onUpdate:modelValue":e[2]||(e[2]=t=>d.value.cron=t),placeholder:"0 9 * * 1-5",class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},null,512),[[M,d.value.cron]])])]),s("div",null,[e[12]||(e[12]=s("label",{class:"text-sm font-medium"},"Target Squad",-1)),S(s("select",{"onUpdate:modelValue":e[3]||(e[3]=t=>d.value.squad_id=t),class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},[(m(!0),p(C,null,P(o.value,t=>(m(),p("option",{key:t.id,value:t.id},h(t.name),9,be))),128))],512),[[A,d.value.squad_id]])]),s("div",null,[e[13]||(e[13]=s("label",{class:"text-sm font-medium"},"Prompt",-1)),S(s("textarea",{"onUpdate:modelValue":e[4]||(e[4]=t=>d.value.prompt=t),rows:"3",placeholder:"e.g. Triage issues, review PRs, ideate on features",class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},null,512),[[M,d.value.prompt]])]),s("button",{onClick:y,disabled:!d.value.squad_id||!d.value.prompt.trim(),class:"px-4 py-2 text-sm rounded-md bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed"}," Save ",8,xe)])):T("",!0),n.value?(m(),p("div",he,"Loading...")):g.value.length===0?(m(),p("div",_e,[_(k(K),{class:"w-12 h-12 mx-auto mb-3 opacity-50"}),s("p",null,"No "+h(i.value)+" schedules configured.",1)])):(m(),p("div",ke,[(m(!0),p(C,null,P(N.value,t=>(m(),p("div",{key:t.id,class:"flex items-center justify-between border border-border rounded-lg px-4 py-3"},[s("div",null,[s("div",we,h(t.cron),1),s("div",Ne," Runs "+h(t.description),1),t.squad?(m(),p("div",Se,[s("span",{class:"text-xs px-2 py-0.5 rounded-full",style:Q(k(Z)(t.squad.color))},h(t.squad.name),5)])):T("",!0),s("div",$e,[f.value===t.id?(m(),p("div",qe,[S(s("textarea",{"onUpdate:modelValue":e[5]||(e[5]=x=>c.value=x),rows:"3",class:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",placeholder:"Schedule prompt"},null,512),[[M,c.value]]),s("div",Ce,[s("button",{onClick:x=>B(t),class:"px-3 py-1.5 text-xs rounded-md bg-primary text-primary-foreground hover:bg-primary/90"}," Save ",8,Pe),s("button",{onClick:e[6]||(e[6]=x=>L()),class:"px-3 py-1.5 text-xs rounded-md border border-border hover:bg-muted/50"}," Cancel ")])])):(m(),p("div",Me,[s("span",null,h(t.prompt?t.prompt:"(no prompt)"),1),s("button",{onClick:x=>W(t),class:"inline-flex items-center gap-1 px-2 py-1 text-xs rounded-md border border-border hover:bg-muted/50"},[_(k(ne),{class:"w-3 h-3"}),e[14]||(e[14]=V(" Edit prompt ",-1))],8,Te)]))]),s("div",Ve," Squad: "+h(F(t.squad_id)),1)]),s("div",Ae,[s("button",{onClick:x=>z(t),class:"p-1.5 rounded hover:bg-primary/10 text-muted-foreground hover:text-primary",title:"Trigger now"},[_(k(oe),{class:"w-4 h-4"})],8,De),v.value===t.id?(m(),p("span",Ie,"Triggered!")):T("",!0),_(ee,{"model-value":!!t.enabled,"aria-label":`Toggle schedule ${t.cron}`,"onUpdate:modelValue":x=>U(t)},null,8,["model-value","aria-label","onUpdate:modelValue"]),s("button",{onClick:x=>R(t.id),class:"p-1.5 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive"},[_(k(re),{class:"w-4 h-4"})],8,Oe)])]))),128))]))]))}});export{ze as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as w,E,J as d,q as s,n as t,R as g,d as x,L as U,a4 as o,a0 as n,$ as M,Z as p,p as b,K as r,z as T}from"./index-
|
|
1
|
+
import{u as w,E,J as d,q as s,n as t,R as g,d as x,L as U,a4 as o,a0 as n,$ as M,Z as p,p as b,K as r,z as T}from"./index-ELvnkQjd.js";import{b as V,d as S}from"./api-D4mHJ3u0.js";const z={class:"p-6"},A={class:"flex items-center justify-between mb-6"},B=["disabled"],N={key:0,class:"text-muted-foreground"},C={class:"flex gap-1 border-b border-border mb-6"},I=["onClick"],K={key:0,class:"space-y-4 max-w-lg"},D={class:"flex items-center gap-3"},L={key:1,class:"space-y-4 max-w-lg"},R={class:"flex items-center gap-3"},j={key:2,class:"space-y-4 max-w-lg"},q={key:3,class:"space-y-4 max-w-lg"},G={class:"flex items-center gap-3"},O={class:"flex items-center gap-3"},W=w({__name:"SettingsView",setup(P){const f=r(!0),i=r(!1),m=r(!1),u=r("general"),y=[{id:"general",label:"General"},{id:"telegram",label:"Telegram"},{id:"auth",label:"Auth"},{id:"advanced",label:"Advanced"}],a=r({defaultModel:"",port:3170,telegramEnabled:!1,telegramBotToken:"",authorizedUserId:null,supabaseUrl:"",supabaseAnonKey:"",authorizedEmail:"",backgroundNotifyMode:"meaningful",backgroundNotifyTelegram:!0,selfEditEnabled:!1,watchdogEnabled:!0});async function k(){f.value=!0;try{const v=await V("/settings");a.value=v}finally{f.value=!1}}async function c(){i.value=!0,m.value=!1;try{await S("/settings",a.value),m.value=!0,setTimeout(()=>m.value=!1,2e3)}finally{i.value=!1}}return E(k),(v,e)=>(d(),s("div",z,[t("div",A,[e[12]||(e[12]=t("h1",{class:"text-2xl font-bold"},"Settings",-1)),t("button",{onClick:c,disabled:i.value,class:"px-4 py-2 rounded-md bg-primary text-primary-foreground text-sm hover:bg-primary/90 disabled:opacity-50"},g(i.value?"Saving...":m.value?"Saved ✓":"Save"),9,B)]),f.value?(d(),s("div",N,"Loading...")):(d(),s(x,{key:1},[t("div",C,[(d(),s(x,null,U(y,l=>t("button",{key:l.id,onClick:$=>u.value=l.id,class:T(["px-4 py-2 text-sm font-medium border-b-2 transition-colors",u.value===l.id?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"])},g(l.label),11,I)),64))]),u.value==="general"?(d(),s("div",K,[t("div",null,[e[13]||(e[13]=t("label",{class:"text-sm font-medium"},"Default Model",-1)),o(t("input",{"onUpdate:modelValue":e[0]||(e[0]=l=>a.value.defaultModel=l),class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},null,512),[[n,a.value.defaultModel]])]),t("div",null,[e[14]||(e[14]=t("label",{class:"text-sm font-medium"},"Port",-1)),o(t("input",{"onUpdate:modelValue":e[1]||(e[1]=l=>a.value.port=l),type:"number",class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},null,512),[[n,a.value.port,void 0,{number:!0}]]),e[15]||(e[15]=t("p",{class:"text-xs text-muted-foreground mt-1"},"Requires restart to take effect",-1))]),t("div",null,[e[17]||(e[17]=t("label",{class:"text-sm font-medium"},"Background Notify Mode",-1)),o(t("select",{"onUpdate:modelValue":e[2]||(e[2]=l=>a.value.backgroundNotifyMode=l),class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},[...e[16]||(e[16]=[t("option",{value:"all"},"All",-1),t("option",{value:"meaningful"},"Meaningful",-1),t("option",{value:"off"},"Off",-1)])],512),[[M,a.value.backgroundNotifyMode]])]),t("div",D,[o(t("input",{"onUpdate:modelValue":e[3]||(e[3]=l=>a.value.backgroundNotifyTelegram=l),type:"checkbox",id:"notifyTelegram",class:"rounded"},null,512),[[p,a.value.backgroundNotifyTelegram]]),e[18]||(e[18]=t("label",{for:"notifyTelegram",class:"text-sm font-medium"},"Send notifications via Telegram",-1))])])):b("",!0),u.value==="telegram"?(d(),s("div",L,[t("div",null,[e[19]||(e[19]=t("label",{class:"text-sm font-medium"},"Bot Token",-1)),o(t("input",{"onUpdate:modelValue":e[4]||(e[4]=l=>a.value.telegramBotToken=l),type:"password",placeholder:"Enter new token to update",class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},null,512),[[n,a.value.telegramBotToken]])]),t("div",null,[e[20]||(e[20]=t("label",{class:"text-sm font-medium"},"Authorized User ID",-1)),o(t("input",{"onUpdate:modelValue":e[5]||(e[5]=l=>a.value.authorizedUserId=l),type:"number",placeholder:"123456789",class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},null,512),[[n,a.value.authorizedUserId,void 0,{number:!0}]])]),t("div",R,[o(t("input",{"onUpdate:modelValue":e[6]||(e[6]=l=>a.value.telegramEnabled=l),type:"checkbox",id:"telegramEnabled",class:"rounded"},null,512),[[p,a.value.telegramEnabled]]),e[21]||(e[21]=t("label",{for:"telegramEnabled",class:"text-sm font-medium"},"Enable Telegram Bot",-1))])])):b("",!0),u.value==="auth"?(d(),s("div",j,[t("div",null,[e[22]||(e[22]=t("label",{class:"text-sm font-medium"},"Supabase URL",-1)),o(t("input",{"onUpdate:modelValue":e[7]||(e[7]=l=>a.value.supabaseUrl=l),placeholder:"https://your-project.supabase.co",class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},null,512),[[n,a.value.supabaseUrl]])]),t("div",null,[e[23]||(e[23]=t("label",{class:"text-sm font-medium"},"Supabase Anon Key",-1)),o(t("input",{"onUpdate:modelValue":e[8]||(e[8]=l=>a.value.supabaseAnonKey=l),type:"password",placeholder:"Enter new key to update",class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},null,512),[[n,a.value.supabaseAnonKey]])]),t("div",null,[e[24]||(e[24]=t("label",{class:"text-sm font-medium"},"Authorized Email",-1)),o(t("input",{"onUpdate:modelValue":e[9]||(e[9]=l=>a.value.authorizedEmail=l),type:"email",placeholder:"you@example.com",class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},null,512),[[n,a.value.authorizedEmail]])])])):b("",!0),u.value==="advanced"?(d(),s("div",q,[t("div",G,[o(t("input",{"onUpdate:modelValue":e[10]||(e[10]=l=>a.value.selfEditEnabled=l),type:"checkbox",id:"selfEdit",class:"rounded"},null,512),[[p,a.value.selfEditEnabled]]),e[25]||(e[25]=t("div",null,[t("label",{for:"selfEdit",class:"text-sm font-medium"},"Self-Edit Mode"),t("p",{class:"text-xs text-muted-foreground"},"Allow IO to modify its own source code")],-1))]),t("div",O,[o(t("input",{"onUpdate:modelValue":e[11]||(e[11]=l=>a.value.watchdogEnabled=l),type:"checkbox",id:"watchdog",class:"rounded"},null,512),[[p,a.value.watchdogEnabled]]),e[26]||(e[26]=t("div",null,[t("label",{for:"watchdog",class:"text-sm font-medium"},"Watchdog"),t("p",{class:"text-xs text-muted-foreground"},"Monitor event loop and zombie instances")],-1))])])):b("",!0)],64))]))}});export{W as default};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{r as be,u as he,E as ke,J as o,q as l,n as e,z as K,t as c,T as g,s as X,d as b,a4 as M,a0 as U,a5 as ne,R as i,p as w,h as ae,L as R,$ as _e,l as ie,K as n,m as H,a6 as ue}from"./index-ELvnkQjd.js";import{b as O,c as Y,d as we,a as Se}from"./api-D4mHJ3u0.js";import{P as de}from"./plus-BAzlGFd_.js";import{S as Ce}from"./search-CS9zSIeW.js";import{P as $e}from"./pencil-CFsi7ufI.js";import{S as Le}from"./save-BmgCYJ1g.js";import{X as Fe}from"./x-CjXR97Fa.js";import{T as je}from"./trash-2-DLveUEsd.js";/**
|
|
2
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const Z=be("GlobeIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]),Ie=/^---\s*\n([\s\S]*?)\n---\s*(?:\n|$)/;function ee(C){const a=C.trim();if(a==="")return"";if(/^\[(.*)\]$/.test(a)){const _=a.slice(1,-1).trim();return _===""?[]:_.split(",").map(u=>ee(u)).filter(u=>typeof u=="string"||typeof u=="number"||typeof u=="boolean")}return/^(true|false)$/i.test(a)?a.toLowerCase()==="true":/^-?\d+(?:\.\d+)?$/.test(a)?Number(a):a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'")?a.slice(1,-1):a}function ce(C){const a=C.match(Ie);if(!a)return{frontmatter:{},body:C,hasFrontmatter:!1};const _=a[1].replace(/\r/g,"").split(`
|
|
7
|
+
`),u={};let x=null,m=[];for(const k of _){const v=k.trim();if(v==="")continue;if(v.startsWith("- ")){x&&m.push(String(ee(v.slice(2))));continue}x&&(u[x]=m,x=null,m=[]);const f=v.indexOf(":");if(f===-1)continue;const d=v.slice(0,f).trim(),T=v.slice(f+1).trim();if(T===""){x=d,m=[];continue}u[d]=ee(T)}return x&&(u[x]=m),{frontmatter:u,body:C.slice(a[0].length).replace(/^\n+/,""),hasFrontmatter:!0}}const Me={class:"flex h-full"},Te={class:"w-72 border-r border-border flex flex-col shrink-0"},Ee={class:"flex border-b border-border"},Ve={class:"p-3 border-b border-border space-y-2"},Ae={class:"flex gap-1"},Ue={key:0,class:"space-y-1.5"},De={class:"flex gap-1"},Ne=["disabled"],Pe={key:1,class:"space-y-1.5"},ze={key:0,class:"mt-0.5 text-xs text-muted-foreground font-mono"},Ke={class:"flex gap-1"},Re=["disabled"],Oe={class:"flex-1 overflow-y-auto p-2"},Ge={key:0,class:"text-xs text-muted-foreground p-2"},We={key:1,class:"text-center py-8 text-muted-foreground"},Be=["onClick"],qe={class:"min-w-0 flex-1"},Je={class:"font-medium truncate"},Qe={class:"text-muted-foreground truncate"},Xe=["onClick"],He={class:"p-3 border-b border-border space-y-2"},Ye={class:"relative"},Ze=["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-destructive p-2"},ot={key:2,class:"text-center py-8 text-muted-foreground"},lt=["onClick"],rt={class:"min-w-0 flex-1"},nt={class:"font-medium truncate"},at=["title"],it=["onClick","disabled"],ut={key:1,class:"shrink-0 mt-0.5 px-1.5 py-0.5 text-xs rounded bg-muted text-muted-foreground"},dt={class:"flex-1 flex flex-col"},ct={key:0,class:"flex items-center justify-center h-full text-muted-foreground"},vt={class:"text-center"},pt={class:"flex items-center justify-between px-4 py-2 border-b border-border"},mt={class:"text-sm font-medium"},ft={class:"text-xs text-muted-foreground ml-2 font-mono"},gt={class:"flex gap-1"},xt={class:"flex-1 overflow-y-auto p-4"},yt={key:0,class:"text-muted-foreground text-sm"},bt={key:2,class:"space-y-4"},ht={key:0,class:"rounded-lg border border-border bg-card p-4"},kt={class:"mt-3 grid gap-2 sm:grid-cols-2"},_t={class:"text-[10px] uppercase tracking-wide text-muted-foreground"},wt={class:"mt-1 text-sm text-foreground"},St={key:0,class:"flex items-center justify-center h-full text-muted-foreground"},Ct={class:"text-center"},$t={class:"flex items-center justify-between px-4 py-2 border-b border-border"},Lt={class:"min-w-0 flex-1"},Ft={class:"text-sm font-medium"},jt={class:"text-xs text-muted-foreground ml-2"},It=["disabled"],Mt={key:1,class:"ml-2 shrink-0 px-3 py-1 text-xs rounded bg-muted text-muted-foreground"},Tt={class:"flex-1 overflow-y-auto p-4"},Et={key:0,class:"text-muted-foreground text-sm"},Vt={key:1,class:"space-y-4"},At={key:0,class:"rounded-lg border border-border bg-card p-4"},Ut={class:"mt-3 grid gap-2 sm:grid-cols-2"},Dt={class:"text-[10px] uppercase tracking-wide text-muted-foreground"},Nt={class:"mt-1 text-sm text-foreground"},Pt={key:0,class:"absolute bottom-4 left-4 text-sm text-destructive bg-background border border-destructive/30 px-3 py-2 rounded-md"},ve=`# My Skill
|
|
8
|
+
|
|
9
|
+
A brief description of what this skill does.
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
Instructions for how to use this skill...
|
|
14
|
+
`,Jt=he({__name:"SkillsView",setup(C){const a=n([]),_=n(!0),u=n(!1),x=n("git"),m=n(""),k=n(""),v=n(ve),f=n(!1),d=n(""),T=H(()=>k.value.trim().replace(/[^a-z0-9-]/gi,"-").toLowerCase().replace(/-+/g,"-").replace(/^-|-$/g,"")),h=n(null),S=n(""),$=n(!1),E=n(""),G=n(!1),W=H(()=>ce(S.value)),B=H(()=>ce(F.value)),L=n("installed"),q=n("awesome-copilot"),D=n(""),V=n([]),A=n(!1),N=n(""),y=n(null),F=n(""),J=n(!1),j=n("");async function I(){_.value=!0;try{a.value=await O("/skills")}finally{_.value=!1}}function te(r){x.value=r,u.value=!0,d.value=""}function P(){u.value=!1,m.value="",k.value="",v.value=ve,d.value=""}async function se(){if(m.value.trim()){f.value=!0,d.value="";try{await Y("/skills",{url:m.value.trim()}),P(),await I()}catch(r){d.value=r.message||"Failed to install skill"}finally{f.value=!1}}}async function pe(){if(!(!k.value.trim()||!v.value.trim())){f.value=!0,d.value="";try{await Y("/skills",{slug:T.value,content:v.value}),P(),await I()}catch(r){d.value=r.message||"Failed to create skill"}finally{f.value=!1}}}async function me(r){var t;try{await Se(`/skills/${r}`),((t=h.value)==null?void 0:t.slug)===r&&(h.value=null,S.value=""),await I()}catch(s){d.value=s.message||"Failed to remove skill"}}async function fe(r){h.value=r,$.value=!1,G.value=!0;try{const t=await O(`/skills/${r.slug}/content`);S.value=t.content}catch(t){S.value=`Error loading skill: ${t.message}`}finally{G.value=!1}}function ge(){E.value=S.value,$.value=!0}async function xe(){if(h.value)try{await we(`/skills/${h.value.slug}/content`,{content:E.value}),S.value=E.value,$.value=!1,await I()}catch(r){d.value=r.message||"Failed to save skill"}}async function z(){A.value=!0,N.value="",y.value=null,F.value="";try{const r=new URLSearchParams({source:q.value});D.value.trim()&&r.set("q",D.value.trim()),V.value=await O(`/skills/discover?${r}`)}catch(r){N.value=r.message||"Failed to fetch community skills",V.value=[]}finally{A.value=!1}}async function ye(r){y.value=r,J.value=!0,F.value="";try{const t=await O(`/skills/preview?source=${r.source}&slug=${encodeURIComponent(r.slug)}`);F.value=t.content}catch(t){F.value=`Error loading preview: ${t.message}`}finally{J.value=!1}}async function oe(r){j.value=r.slug,d.value="";try{await Y("/skills",{source:r.source,slug:r.slug}),await I(),L.value="installed"}catch(t){d.value=t.message||"Failed to install skill"}finally{j.value=""}}function le(r){return a.value.some(t=>t.slug===r)}function re(r){L.value=r,h.value=null,y.value=null,S.value="",F.value="",r==="discover"&&V.value.length===0&&z()}return ke(I),(r,t)=>(o(),l("div",Me,[e("div",Te,[e("div",Ee,[e("button",{onClick:t[0]||(t[0]=s=>re("installed")),class:K(["flex-1 px-3 py-2 text-xs font-medium transition-colors",L.value==="installed"?"border-b-2 border-primary text-primary":"text-muted-foreground hover:text-foreground"])}," Installed ",2),e("button",{onClick:t[1]||(t[1]=s=>re("discover")),class:K(["flex-1 px-3 py-2 text-xs font-medium transition-colors",L.value==="discover"?"border-b-2 border-primary text-primary":"text-muted-foreground hover:text-foreground"])},[c(g(Z),{class:"w-3 h-3 inline mr-1"}),t[12]||(t[12]=X(" Discover ",-1))],2)]),L.value==="installed"?(o(),l(b,{key:0},[e("div",Ve,[e("div",Ae,[e("button",{onClick:t[2]||(t[2]=s=>te("git")),class:"flex-1 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"},[c(g(de),{class:"w-3.5 h-3.5"}),t[13]||(t[13]=X(" From Git ",-1))]),e("button",{onClick:t[3]||(t[3]=s=>te("create")),class:"flex-1 flex items-center justify-center gap-1.5 px-2 py-1.5 text-xs rounded-md border border-border hover:bg-accent"},[c(g(de),{class:"w-3.5 h-3.5"}),t[14]||(t[14]=X(" Create New ",-1))])]),u.value&&x.value==="git"?(o(),l("div",Ue,[M(e("input",{"onUpdate:modelValue":t[4]||(t[4]=s=>m.value=s),type:"text",placeholder:"https://github.com/user/skill-repo.git",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:ne(se,["enter"])},null,544),[[U,m.value]]),e("div",De,[e("button",{onClick:se,disabled:f.value||!m.value.trim(),class:"flex-1 px-2 py-1 text-xs rounded bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50"},i(f.value?"Installing...":"Install"),9,Ne),e("button",{onClick:P,class:"px-2 py-1 text-xs rounded border border-border hover:bg-accent"}," Cancel ")])])):w("",!0),u.value&&x.value==="create"?(o(),l("div",Pe,[e("div",null,[M(e("input",{"onUpdate:modelValue":t[5]||(t[5]=s=>k.value=s),type:"text",placeholder:"Skill title",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"},null,512),[[U,k.value]]),k.value.trim()?(o(),l("p",ze," slug: "+i(T.value),1)):w("",!0)]),M(e("textarea",{"onUpdate:modelValue":t[6]||(t[6]=s=>v.value=s),rows:"8",placeholder:`# My Skill
|
|
15
|
+
|
|
16
|
+
Describe your skill in Markdown...`,class:"w-full rounded-md border border-input bg-background px-2 py-1.5 text-xs font-mono focus:outline-none focus:ring-1 focus:ring-ring resize-none"},null,512),[[U,v.value]]),e("div",Ke,[e("button",{onClick:pe,disabled:f.value||!k.value.trim()||!v.value.trim(),class:"flex-1 px-2 py-1 text-xs rounded bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50"},i(f.value?"Creating...":"Create"),9,Re),e("button",{onClick:P,class:"px-2 py-1 text-xs rounded border border-border hover:bg-accent"}," Cancel ")])])):w("",!0)]),e("div",Oe,[_.value?(o(),l("div",Ge,"Loading...")):a.value.length===0?(o(),l("div",We,[c(g(ae),{class:"w-8 h-8 mx-auto mb-2 opacity-50"}),t[15]||(t[15]=e("p",{class:"text-xs"},"No skills installed.",-1))])):w("",!0),(o(!0),l(b,null,R(a.value,s=>{var p;return o(),l("div",{key:s.slug,onClick:Q=>fe(s),class:K(["flex items-center justify-between px-2 py-2 text-xs rounded cursor-pointer hover:bg-accent transition-colors group",{"bg-accent font-medium":((p=h.value)==null?void 0:p.slug)===s.slug}])},[e("div",qe,[e("div",Je,i(s.name),1),e("div",Qe,i(s.slug),1)]),e("button",{onClick:ue(Q=>me(s.slug),["stop"]),class:"opacity-0 group-hover:opacity-100 p-1 rounded hover:bg-destructive/10 text-destructive transition-opacity shrink-0",title:"Remove"},[c(g(je),{class:"w-3.5 h-3.5"})],8,Xe)],10,Be)}),128))])],64)):(o(),l(b,{key:1},[e("div",He,[M(e("select",{"onUpdate:modelValue":t[7]||(t[7]=s=>q.value=s),onChange:z,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"},[...t[16]||(t[16]=[e("option",{value:"awesome-copilot"},"awesome-copilot",-1),e("option",{value:"skillssh"},"skills.sh",-1)])],544),[[_e,q.value]]),e("div",Ye,[c(g(Ce),{class:"absolute left-2 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground"}),M(e("input",{"onUpdate:modelValue":t[8]||(t[8]=s=>D.value=s),type:"text",placeholder:"Search skills...",class:"w-full rounded-md border border-input bg-background pl-6 pr-2 py-1.5 text-xs focus:outline-none focus:ring-1 focus:ring-ring",onKeyup:ne(z,["enter"])},null,544),[[U,D.value]])]),e("button",{onClick:z,disabled:A.value,class:"w-full px-2 py-1.5 text-xs rounded-md bg-secondary text-secondary-foreground hover:bg-secondary/80 disabled:opacity-50"},i(A.value?"Searching...":"Search"),9,Ze)]),e("div",et,[A.value?(o(),l("div",tt,"Loading...")):N.value?(o(),l("div",st,i(N.value),1)):V.value.length===0?(o(),l("div",ot,[c(g(Z),{class:"w-8 h-8 mx-auto mb-2 opacity-50"}),t[17]||(t[17]=e("p",{class:"text-xs"},"No skills found.",-1))])):w("",!0),(o(!0),l(b,null,R(V.value,s=>{var p;return o(),l("div",{key:s.slug,onClick:Q=>ye(s),class:K(["flex items-start justify-between px-2 py-2 text-xs rounded cursor-pointer hover:bg-accent transition-colors gap-1",{"bg-accent":((p=y.value)==null?void 0:p.slug)===s.slug}])},[e("div",rt,[e("div",nt,i(s.slug),1),e("div",{class:"text-muted-foreground line-clamp-2 mt-0.5",title:s.description},i(s.description),9,at)]),le(s.slug)?(o(),l("span",ut," Installed ")):(o(),l("button",{key:0,onClick:ue(Q=>oe(s),["stop"]),disabled:j.value===s.slug,class:"shrink-0 mt-0.5 px-1.5 py-0.5 text-xs rounded bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50",title:"Install"},i(j.value===s.slug?"...":"Install"),9,it))],10,lt)}),128))])],64))]),e("div",dt,[L.value==="installed"?(o(),l(b,{key:0},[h.value?(o(),l(b,{key:1},[e("div",pt,[e("div",null,[e("span",mt,i(h.value.name),1),e("span",ft,i(h.value.slug)+"/SKILL.md",1)]),e("div",gt,[$.value?(o(),l(b,{key:1},[e("button",{onClick:xe,class:"p-1.5 rounded hover:bg-accent text-green-500",title:"Save"},[c(g(Le),{class:"w-4 h-4"})]),e("button",{onClick:t[9]||(t[9]=s=>$.value=!1),class:"p-1.5 rounded hover:bg-accent text-muted-foreground",title:"Cancel"},[c(g(Fe),{class:"w-4 h-4"})])],64)):(o(),l("button",{key:0,onClick:ge,class:"p-1.5 rounded hover:bg-accent text-muted-foreground",title:"Edit"},[c(g($e),{class:"w-4 h-4"})]))])]),e("div",xt,[G.value?(o(),l("div",yt,"Loading...")):$.value?M((o(),l("textarea",{key:1,"onUpdate:modelValue":t[10]||(t[10]=s=>E.value=s),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)),[[U,E.value]]):(o(),l("div",bt,[Object.keys(W.value.frontmatter).length>0?(o(),l("div",ht,[t[19]||(t[19]=e("div",{class:"flex items-center justify-between"},[e("p",{class:"text-xs font-medium uppercase tracking-wide text-muted-foreground"}," Metadata ")],-1)),e("dl",kt,[(o(!0),l(b,null,R(Object.entries(W.value.frontmatter),([s,p])=>(o(),l("div",{key:s,class:"rounded-md bg-muted px-3 py-2"},[e("dt",_t,i(s),1),e("dd",wt,i(Array.isArray(p)?p.join(", "):String(p)),1)]))),128))])])):w("",!0),c(ie,{content:W.value.body},null,8,["content"])]))])],64)):(o(),l("div",ct,[e("div",vt,[c(g(ae),{class:"w-12 h-12 mx-auto mb-3 opacity-50"}),t[18]||(t[18]=e("p",null,"Select a skill to view",-1))])]))],64)):(o(),l(b,{key:1},[y.value?(o(),l(b,{key:1},[e("div",$t,[e("div",Lt,[e("span",Ft,i(y.value.slug),1),e("span",jt,i(y.value.source),1)]),le(y.value.slug)?(o(),l("span",Mt," Installed ")):(o(),l("button",{key:0,onClick:t[11]||(t[11]=s=>oe(y.value)),disabled:j.value===y.value.slug,class:"ml-2 shrink-0 px-3 py-1 text-xs rounded bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50"},i(j.value===y.value.slug?"Installing...":"Install"),9,It))]),e("div",Tt,[J.value?(o(),l("div",Et," Loading preview... ")):(o(),l("div",Vt,[Object.keys(B.value.frontmatter).length>0?(o(),l("div",At,[t[21]||(t[21]=e("div",{class:"flex items-center justify-between"},[e("p",{class:"text-xs font-medium uppercase tracking-wide text-muted-foreground"}," Metadata ")],-1)),e("dl",Ut,[(o(!0),l(b,null,R(Object.entries(B.value.frontmatter),([s,p])=>(o(),l("div",{key:s,class:"rounded-md bg-muted px-3 py-2"},[e("dt",Dt,i(s),1),e("dd",Nt,i(Array.isArray(p)?p.join(", "):String(p)),1)]))),128))])])):w("",!0),c(ie,{content:B.value.body},null,8,["content"])]))])],64)):(o(),l("div",St,[e("div",Ct,[c(g(Z),{class:"w-12 h-12 mx-auto mb-3 opacity-50"}),t[20]||(t[20]=e("p",null,"Select a skill to preview",-1))])]))],64))]),d.value?(o(),l("p",Pt,i(d.value),1)):w("",!0)]))}});export{Jt as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
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-
|
|
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-ELvnkQjd.js";import{b as P,e as W,c as V,a as Y}from"./api-D4mHJ3u0.js";import{g as ee}from"./squad-colors-B8B_Y-lz.js";import{X as te}from"./x-CjXR97Fa.js";import{G as se}from"./git-branch-DOM-orcl.js";import{T as oe}from"./trash-2-DLveUEsd.js";import{A as re}from"./arrow-left-D_qUNUWW.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 L}from"./api-
|
|
1
|
+
import{b as L}from"./api-D4mHJ3u0.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-ELvnkQjd.js";import{T as w}from"./triangle-alert-lj4I30rL.js";import{G as $}from"./git-branch-DOM-orcl.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-
|
|
1
|
+
import{b as y}from"./api-D4mHJ3u0.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-ELvnkQjd.js";import{G as V}from"./git-branch-DOM-orcl.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-
|
|
1
|
+
import{u as t,J as s,q as r,z as l,n as d}from"./index-ELvnkQjd.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,a4 as F,a0 as O,K as a,z as Y,D as Z,m as tt}from"./index-
|
|
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-ELvnkQjd.js";import{b as T,d as q}from"./api-D4mHJ3u0.js";import{T as et}from"./triangle-alert-lj4I30rL.js";/**
|
|
2
2
|
* @license lucide-vue-next v0.474.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -13,4 +13,4 @@ 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 a
|
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const dt=L("TrendingUpIcon",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]),rt={class:"p-6"},lt={class:"flex items-center gap-3 mb-6"},nt={key:0,class:"text-muted-foreground"},at={class:"flex gap-1 border-b border-border mb-6"},it=["onClick"],ut={key:0,class:"space-y-6"},pt={class:"grid grid-cols-2 md:grid-cols-4 gap-4"},xt={class:"border border-border rounded-lg p-4"},ct={class:"flex items-center gap-2 text-muted-foreground text-xs mb-1"},mt={class:"text-2xl font-bold"},gt={class:"text-xs text-muted-foreground mt-1"},ht={class:"border border-border rounded-lg p-4"},vt={class:"flex items-center gap-2 text-muted-foreground text-xs mb-1"},bt={class:"text-2xl font-bold"},yt={class:"border border-border rounded-lg p-4"},ft={class:"flex items-center gap-2 text-muted-foreground text-xs mb-1"},_t={class:"text-2xl font-bold"},kt={class:"border border-border rounded-lg p-4"},wt={class:"flex items-center gap-2 text-muted-foreground text-xs mb-1"},Tt={class:"text-2xl font-bold"},Mt={key:0,class:"flex items-center gap-2 text-sm text-yellow-600 bg-yellow-500/10 border border-yellow-500/20 rounded-lg px-4 py-3"},Ct={key:1},Pt={class:"border border-border rounded-lg overflow-hidden"},St={class:"w-full text-sm"},At={class:"px-4 py-2 font-medium"},Ut={class:"px-4 py-2 text-right text-muted-foreground"},$t={class:"px-4 py-2 text-right text-muted-foreground"},Dt={class:"px-4 py-2 text-right text-muted-foreground"},It={key:2,class:"text-sm text-muted-foreground"},Et={key:1},Vt={key:0,class:"text-sm text-muted-foreground"},Nt={key:1,class:"border border-border rounded-lg overflow-hidden"},Bt={class:"w-full text-sm"},Ft={class:"px-4 py-2 font-medium"},Ot={class:"px-4 py-2 text-right text-muted-foreground"},Lt={class:"px-4 py-2 text-right text-muted-foreground"},qt={class:"px-4 py-2 text-right font-medium"},zt={class:"px-4 py-2 text-right text-muted-foreground"},Ht={class:"px-4 py-2 text-right text-muted-foreground"},Kt={key:2},Gt={key:0,class:"text-sm text-muted-foreground"},Jt={key:1,class:"border border-border rounded-lg overflow-hidden"},Rt={class:"w-full text-sm"},jt={class:"px-4 py-2 font-medium"},Qt={class:"px-4 py-2 text-right text-muted-foreground"},Wt={class:"px-4 py-2 text-right text-muted-foreground"},Xt={class:"px-4 py-2 text-right font-medium"},Yt={class:"px-4 py-2 text-right text-muted-foreground"},Zt={class:"px-4 py-2 text-right text-muted-foreground"},te={key:3},ee={key:0,class:"text-sm text-muted-foreground"},se={class:"mb-6"},oe={class:"flex items-end gap-1 h-32 border border-border rounded-lg p-3 bg-muted/20"},de={class:"absolute bottom-full left-1/2 -translate-x-1/2 mb-1 hidden group-hover:block bg-popover border border-border text-xs rounded px-2 py-1 whitespace-nowrap z-10"},re={class:"border border-border rounded-lg overflow-hidden"},le={class:"w-full text-sm"},ne={class:"px-4 py-2 font-mono text-xs"},ae={class:"px-4 py-2 text-right text-muted-foreground"},ie={class:"px-4 py-2 text-right text-muted-foreground"},ue={class:"px-4 py-2 text-right font-medium"},pe={class:"px-4 py-2 text-right text-muted-foreground"},xe={key:4,class:"space-y-6"},ce={class:"flex items-center gap-3 max-w-sm"},me=["disabled"],ge={key:0,class:"border border-border rounded-lg p-4 mb-4 max-w-md space-y-3"},he={class:"font-medium text-sm"},ve={class:"bg-muted px-1 rounded"},be={class:"flex gap-3"},ye={class:"flex-1"},fe={class:"flex-1"},_e={class:"flex gap-2"},ke=["disabled"],we={class:"border border-border rounded-lg overflow-hidden"},Te={class:"w-full text-sm"},Me={class:"px-4 py-2 font-mono text-xs"},Ce={class:"px-4 py-2 text-right text-muted-foreground"},Pe={class:"px-4 py-2 text-right text-muted-foreground"},Se={class:"px-4 py-2 text-right"},Ae=["onClick"],Ve=j({__name:"UsageView",setup(Ue){const B=a(!0),p=a("overview"),z=[{id:"overview",label:"Overview"},{id:"by-squad",label:"By Squad"},{id:"by-agent",label:"By Agent"},{id:"daily",label:"Daily Trend"},{id:"pricing",label:"Pricing"}],g=a(null),h=a([]),C=a([]),M=a([]),v=a({}),b=a(null),P=a(!1),S=a(!1),A=a(!1),U=a(!1),x=a(""),$=a(0),D=a(0);async function H(){B.value=!0;try{const[l,e,c,I,E,V]=await Promise.all([T("/token-usage/summary"),T("/token-usage/by-squad"),T("/token-usage/by-agent"),T("/token-usage/daily?days=30"),T("/token-usage/pricing"),T("/token-usage/alert-threshold")]);g.value=l,h.value=e.filter(f=>f.record_count>0),C.value=c.filter(f=>f.record_count>0),M.value=I,v.value=E,b.value=V.tokenAlertThreshold}finally{B.value=!1}}async function K(){P.value=!0,S.value=!1;try{await q("/token-usage/alert-threshold",{tokenAlertThreshold:b.value}),S.value=!0,setTimeout(()=>S.value=!1,2e3)}finally{P.value=!1}}function G(l){var e,c;x.value=l,$.value=((e=v.value[l])==null?void 0:e.inputPer1M)??0,D.value=((c=v.value[l])==null?void 0:c.outputPer1M)??0}async function J(){if(x.value){A.value=!0,U.value=!1;try{const l={...v.value,[x.value]:{inputPer1M:$.value,outputPer1M:D.value}};await q("/token-usage/pricing",l),v.value=l,x.value="",U.value=!0,setTimeout(()=>U.value=!1,2e3)}finally{A.value=!1}}}function n(l){return l>=1e6?`${(l/1e6).toFixed(2)}M`:l>=1e3?`${(l/1e3).toFixed(1)}K`:String(l)}function y(l){return l<1e-4?"$0.00":l<.01?`$${l.toFixed(4)}`:`$${l.toFixed(2)}`}const R=tt(()=>Math.max(1,...M.value.map(l=>l.total_tokens)));return Q(H),(l,e)=>{var c,I,E,V,f;return d(),r("div",rt,[t("div",lt,[_(k(W),{class:"w-6 h-6 text-primary"}),e[4]||(e[4]=t("h1",{class:"text-2xl font-bold"},"Token Usage",-1))]),B.value?(d(),r("div",nt,"Loading...")):(d(),r(i,{key:1},[t("div",at,[(d(),r(i,null,m(z,s=>t("button",{key:s.id,onClick:N=>p.value=s.id,class:Y(["px-4 py-2 text-sm font-medium border-b-2 transition-colors",p.value===s.id?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"])},o(s.label),11,it)),64))]),p.value==="overview"?(d(),r("div",ut,[t("div",pt,[t("div",xt,[t("div",ct,[_(k(dt),{class:"w-3 h-3"}),e[5]||(e[5]=w(" Total Tokens ",-1))]),t("div",mt,o(n(((c=g.value)==null?void 0:c.total_tokens)??0)),1),t("div",gt,o(n(((I=g.value)==null?void 0:I.total_input_tokens)??0))+" in / "+o(n(((E=g.value)==null?void 0:E.total_output_tokens)??0))+" out ",1)]),t("div",ht,[t("div",vt,[_(k(ot),{class:"w-3 h-3"}),e[6]||(e[6]=w(" Est. Cost ",-1))]),t("div",bt,o(y(((V=g.value)==null?void 0:V.total_cost_usd)??0)),1),e[7]||(e[7]=t("div",{class:"text-xs text-muted-foreground mt-1"},"all time",-1))]),t("div",yt,[t("div",ft,[_(k(X),{class:"w-3 h-3"}),e[8]||(e[8]=w(" Active Squads ",-1))]),t("div",_t,o(h.value.length),1),e[9]||(e[9]=t("div",{class:"text-xs text-muted-foreground mt-1"},"with usage",-1))]),t("div",kt,[t("div",wt,[_(k(st),{class:"w-3 h-3"}),e[10]||(e[10]=w(" Active Agents ",-1))]),t("div",Tt,o(C.value.length),1),e[11]||(e[11]=t("div",{class:"text-xs text-muted-foreground mt-1"},"with usage",-1))])]),b.value!==null?(d(),r("div",Mt,[_(k(et),{class:"w-4 h-4 shrink-0"}),w(" Alert threshold active: "+o(n(b.value))+" tokens per task ",1)])):u("",!0),h.value.length>0?(d(),r("div",Ct,[e[13]||(e[13]=t("h2",{class:"text-base font-semibold mb-3"},"Top Squads by Token Usage",-1)),t("div",Pt,[t("table",St,[e[12]||(e[12]=t("thead",{class:"bg-muted"},[t("tr",null,[t("th",{class:"text-left px-4 py-2 font-medium"},"Squad"),t("th",{class:"text-right px-4 py-2 font-medium"},"Tokens"),t("th",{class:"text-right px-4 py-2 font-medium"},"Est. Cost"),t("th",{class:"text-right px-4 py-2 font-medium"},"Calls")])],-1)),t("tbody",null,[(d(!0),r(i,null,m(h.value.slice(0,5),s=>(d(),r("tr",{key:s.id,class:"border-t border-border"},[t("td",At,o(s.name),1),t("td",Ut,o(n(s.total_tokens)),1),t("td",$t,o(y(s.total_cost_usd)),1),t("td",Dt,o(s.record_count),1)]))),128))])])])])):u("",!0),((f=g.value)==null?void 0:f.total_records)===0?(d(),r("div",It," No token usage recorded yet. Usage will appear here after squads or agents complete tasks. ")):u("",!0)])):u("",!0),p.value==="by-squad"?(d(),r("div",Et,[h.value.length===0?(d(),r("div",Vt,"No usage data yet.")):(d(),r("div",Nt,[t("table",Bt,[e[14]||(e[14]=t("thead",{class:"bg-muted"},[t("tr",null,[t("th",{class:"text-left px-4 py-2 font-medium"},"Squad"),t("th",{class:"text-right px-4 py-2 font-medium"},"Input Tokens"),t("th",{class:"text-right px-4 py-2 font-medium"},"Output Tokens"),t("th",{class:"text-right px-4 py-2 font-medium"},"Total Tokens"),t("th",{class:"text-right px-4 py-2 font-medium"},"Est. Cost"),t("th",{class:"text-right px-4 py-2 font-medium"},"API Calls")])],-1)),t("tbody",null,[(d(!0),r(i,null,m(h.value,s=>(d(),r("tr",{key:s.id,class:"border-t border-border"},[t("td",Ft,o(s.name),1),t("td",Ot,o(n(s.total_input_tokens)),1),t("td",Lt,o(n(s.total_output_tokens)),1),t("td",qt,o(n(s.total_tokens)),1),t("td",zt,o(y(s.total_cost_usd)),1),t("td",Ht,o(s.record_count),1)]))),128))])])]))])):u("",!0),p.value==="by-agent"?(d(),r("div",Kt,[C.value.length===0?(d(),r("div",Gt,"No usage data yet.")):(d(),r("div",Jt,[t("table",Rt,[e[15]||(e[15]=t("thead",{class:"bg-muted"},[t("tr",null,[t("th",{class:"text-left px-4 py-2 font-medium"},"Agent"),t("th",{class:"text-right px-4 py-2 font-medium"},"Input Tokens"),t("th",{class:"text-right px-4 py-2 font-medium"},"Output Tokens"),t("th",{class:"text-right px-4 py-2 font-medium"},"Total Tokens"),t("th",{class:"text-right px-4 py-2 font-medium"},"Est. Cost"),t("th",{class:"text-right px-4 py-2 font-medium"},"API Calls")])],-1)),t("tbody",null,[(d(!0),r(i,null,m(C.value,s=>(d(),r("tr",{key:s.id,class:"border-t border-border"},[t("td",jt,o(s.name),1),t("td",Qt,o(n(s.total_input_tokens)),1),t("td",Wt,o(n(s.total_output_tokens)),1),t("td",Xt,o(n(s.total_tokens)),1),t("td",Yt,o(y(s.total_cost_usd)),1),t("td",Zt,o(s.record_count),1)]))),128))])])]))])):u("",!0),p.value==="daily"?(d(),r("div",te,[M.value.length===0?(d(),r("div",ee,"No usage data yet.")):(d(),r(i,{key:1},[t("div",se,[e[16]||(e[16]=t("h2",{class:"text-base font-semibold mb-3"},"Last 30 Days — Token Usage",-1)),t("div",oe,[(d(!0),r(i,null,m(M.value,s=>(d(),r("div",{key:s.date,class:"flex-1 bg-primary/60 rounded-t min-w-[4px] relative group",style:Z({height:`${s.total_tokens/R.value*100}%`})},[t("div",de,o(s.date)+": "+o(n(s.total_tokens))+" tokens ("+o(y(s.total_cost_usd))+") ",1)],4))),128))])]),t("div",re,[t("table",le,[e[17]||(e[17]=t("thead",{class:"bg-muted"},[t("tr",null,[t("th",{class:"text-left px-4 py-2 font-medium"},"Date"),t("th",{class:"text-right px-4 py-2 font-medium"},"Input Tokens"),t("th",{class:"text-right px-4 py-2 font-medium"},"Output Tokens"),t("th",{class:"text-right px-4 py-2 font-medium"},"Total Tokens"),t("th",{class:"text-right px-4 py-2 font-medium"},"Est. Cost")])],-1)),t("tbody",null,[(d(!0),r(i,null,m([...M.value].reverse(),s=>(d(),r("tr",{key:s.date,class:"border-t border-border"},[t("td",ne,o(s.date),1),t("td",ae,o(n(s.total_input_tokens)),1),t("td",ie,o(n(s.total_output_tokens)),1),t("td",ue,o(n(s.total_tokens)),1),t("td",pe,o(y(s.total_cost_usd)),1)]))),128))])])])],64))])):u("",!0),p.value==="pricing"?(d(),r("div",xe,[t("div",null,[e[18]||(e[18]=t("h2",{class:"text-base font-semibold mb-1"},"Alert Threshold",-1)),e[19]||(e[19]=t("p",{class:"text-sm text-muted-foreground mb-3"}," Post a feed alert when a single task exceeds this many tokens. Leave empty to disable. ",-1)),t("div",ce,[F(t("input",{"onUpdate:modelValue":e[0]||(e[0]=s=>b.value=s),type:"number",min:"0",placeholder:"e.g. 100000",class:"flex-1 rounded-md border border-input bg-background px-3 py-2 text-sm"},null,512),[[O,b.value,void 0,{number:!0}]]),t("button",{onClick:K,disabled:P.value,class:"px-4 py-2 rounded-md bg-primary text-primary-foreground text-sm hover:bg-primary/90 disabled:opacity-50 shrink-0"},o(P.value?"Saving...":S.value?"Saved ✓":"Save"),9,me)])]),t("div",null,[e[24]||(e[24]=t("h2",{class:"text-base font-semibold mb-1"},"Model Pricing",-1)),e[25]||(e[25]=t("p",{class:"text-sm text-muted-foreground mb-3"}," Prices in USD per 1M tokens. Used for cost estimates only. ",-1)),x.value?(d(),r("div",ge,[t("div",he,[e[20]||(e[20]=w("Editing: ",-1)),t("code",ve,o(x.value),1)]),t("div",be,[t("div",ye,[e[21]||(e[21]=t("label",{class:"text-xs text-muted-foreground"},"Input (per 1M tokens)",-1)),F(t("input",{"onUpdate:modelValue":e[1]||(e[1]=s=>$.value=s),type:"number",min:"0",step:"0.01",class:"w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm"},null,512),[[O,$.value,void 0,{number:!0}]])]),t("div",fe,[e[22]||(e[22]=t("label",{class:"text-xs text-muted-foreground"},"Output (per 1M tokens)",-1)),F(t("input",{"onUpdate:modelValue":e[2]||(e[2]=s=>D.value=s),type:"number",min:"0",step:"0.01",class:"w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm"},null,512),[[O,D.value,void 0,{number:!0}]])])]),t("div",_e,[t("button",{onClick:J,disabled:A.value,class:"px-3 py-1.5 rounded-md bg-primary text-primary-foreground text-sm hover:bg-primary/90 disabled:opacity-50"},o(A.value?"Saving...":U.value?"Saved ✓":"Save"),9,ke),t("button",{onClick:e[3]||(e[3]=s=>x.value=""),class:"px-3 py-1.5 rounded-md border border-border text-sm hover:bg-accent"},"Cancel")])])):u("",!0),t("div",we,[t("table",Te,[e[23]||(e[23]=t("thead",{class:"bg-muted"},[t("tr",null,[t("th",{class:"text-left px-4 py-2 font-medium"},"Model"),t("th",{class:"text-right px-4 py-2 font-medium"},"Input / 1M tokens"),t("th",{class:"text-right px-4 py-2 font-medium"},"Output / 1M tokens"),t("th",{class:"text-right px-4 py-2 font-medium"})])],-1)),t("tbody",null,[(d(!0),r(i,null,m(v.value,(s,N)=>(d(),r("tr",{key:N,class:"border-t border-border"},[t("td",Me,o(N),1),t("td",Ce,"$"+o(s.inputPer1M.toFixed(2)),1),t("td",Pe,"$"+o(s.outputPer1M.toFixed(2)),1),t("td",Se,[t("button",{onClick:$e=>G(N),class:"text-xs text-primary hover:underline"},"Edit",8,Ae)])]))),128))])])])])])):u("",!0)],64))])}}});export{Ve as default};
|
|
16
|
+
*/const dt=L("TrendingUpIcon",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]),rt={class:"p-6"},lt={class:"flex items-center gap-3 mb-6"},nt={key:0,class:"text-muted-foreground"},at={class:"flex gap-1 border-b border-border mb-6"},it=["onClick"],ut={key:0,class:"space-y-6"},pt={class:"grid grid-cols-2 md:grid-cols-4 gap-4"},xt={class:"border border-border rounded-lg p-4"},ct={class:"flex items-center gap-2 text-muted-foreground text-xs mb-1"},mt={class:"text-2xl font-bold"},gt={class:"text-xs text-muted-foreground mt-1"},ht={class:"border border-border rounded-lg p-4"},vt={class:"flex items-center gap-2 text-muted-foreground text-xs mb-1"},bt={class:"text-2xl font-bold"},yt={class:"border border-border rounded-lg p-4"},ft={class:"flex items-center gap-2 text-muted-foreground text-xs mb-1"},_t={class:"text-2xl font-bold"},kt={class:"border border-border rounded-lg p-4"},wt={class:"flex items-center gap-2 text-muted-foreground text-xs mb-1"},Tt={class:"text-2xl font-bold"},Mt={key:0,class:"flex items-center gap-2 text-sm text-yellow-600 bg-yellow-500/10 border border-yellow-500/20 rounded-lg px-4 py-3"},Ct={key:1},Pt={class:"border border-border rounded-lg overflow-hidden"},St={class:"w-full text-sm"},At={class:"px-4 py-2 font-medium"},Ut={class:"px-4 py-2 text-right text-muted-foreground"},$t={class:"px-4 py-2 text-right text-muted-foreground"},Dt={class:"px-4 py-2 text-right text-muted-foreground"},It={key:2,class:"text-sm text-muted-foreground"},Et={key:1},Vt={key:0,class:"text-sm text-muted-foreground"},Nt={key:1,class:"border border-border rounded-lg overflow-hidden"},Bt={class:"w-full text-sm"},Ft={class:"px-4 py-2 font-medium"},Ot={class:"px-4 py-2 text-right text-muted-foreground"},Lt={class:"px-4 py-2 text-right text-muted-foreground"},qt={class:"px-4 py-2 text-right font-medium"},zt={class:"px-4 py-2 text-right text-muted-foreground"},Ht={class:"px-4 py-2 text-right text-muted-foreground"},Kt={key:2},Gt={key:0,class:"text-sm text-muted-foreground"},Jt={key:1,class:"border border-border rounded-lg overflow-hidden"},Rt={class:"w-full text-sm"},jt={class:"px-4 py-2 font-medium"},Qt={class:"px-4 py-2 text-right text-muted-foreground"},Wt={class:"px-4 py-2 text-right text-muted-foreground"},Xt={class:"px-4 py-2 text-right font-medium"},Yt={class:"px-4 py-2 text-right text-muted-foreground"},Zt={class:"px-4 py-2 text-right text-muted-foreground"},te={key:3},ee={key:0,class:"text-sm text-muted-foreground"},se={class:"mb-6"},oe={class:"flex items-end gap-1 h-32 border border-border rounded-lg p-3 bg-muted/20"},de={class:"absolute bottom-full left-1/2 -translate-x-1/2 mb-1 hidden group-hover:block bg-popover border border-border text-xs rounded px-2 py-1 whitespace-nowrap z-10"},re={class:"border border-border rounded-lg overflow-hidden"},le={class:"w-full text-sm"},ne={class:"px-4 py-2 font-mono text-xs"},ae={class:"px-4 py-2 text-right text-muted-foreground"},ie={class:"px-4 py-2 text-right text-muted-foreground"},ue={class:"px-4 py-2 text-right font-medium"},pe={class:"px-4 py-2 text-right text-muted-foreground"},xe={key:4,class:"space-y-6"},ce={class:"flex items-center gap-3 max-w-sm"},me=["disabled"],ge={key:0,class:"border border-border rounded-lg p-4 mb-4 max-w-md space-y-3"},he={class:"font-medium text-sm"},ve={class:"bg-muted px-1 rounded"},be={class:"flex gap-3"},ye={class:"flex-1"},fe={class:"flex-1"},_e={class:"flex gap-2"},ke=["disabled"],we={class:"border border-border rounded-lg overflow-hidden"},Te={class:"w-full text-sm"},Me={class:"px-4 py-2 font-mono text-xs"},Ce={class:"px-4 py-2 text-right text-muted-foreground"},Pe={class:"px-4 py-2 text-right text-muted-foreground"},Se={class:"px-4 py-2 text-right"},Ae=["onClick"],Ve=j({__name:"UsageView",setup(Ue){const B=a(!0),p=a("overview"),z=[{id:"overview",label:"Overview"},{id:"by-squad",label:"By Squad"},{id:"by-agent",label:"By Agent"},{id:"daily",label:"Daily Trend"},{id:"pricing",label:"Pricing"}],g=a(null),h=a([]),C=a([]),M=a([]),v=a({}),b=a(null),P=a(!1),S=a(!1),A=a(!1),U=a(!1),x=a(""),$=a(0),D=a(0);async function H(){B.value=!0;try{const[l,e,c,I,E,V]=await Promise.all([T("/token-usage/summary"),T("/token-usage/by-squad"),T("/token-usage/by-agent"),T("/token-usage/daily?days=30"),T("/token-usage/pricing"),T("/token-usage/alert-threshold")]);g.value=l,h.value=e.filter(f=>f.record_count>0),C.value=c.filter(f=>f.record_count>0),M.value=I,v.value=E,b.value=V.tokenAlertThreshold}finally{B.value=!1}}async function K(){P.value=!0,S.value=!1;try{await q("/token-usage/alert-threshold",{tokenAlertThreshold:b.value}),S.value=!0,setTimeout(()=>S.value=!1,2e3)}finally{P.value=!1}}function G(l){var e,c;x.value=l,$.value=((e=v.value[l])==null?void 0:e.inputPer1M)??0,D.value=((c=v.value[l])==null?void 0:c.outputPer1M)??0}async function J(){if(x.value){A.value=!0,U.value=!1;try{const l={...v.value,[x.value]:{inputPer1M:$.value,outputPer1M:D.value}};await q("/token-usage/pricing",l),v.value=l,x.value="",U.value=!0,setTimeout(()=>U.value=!1,2e3)}finally{A.value=!1}}}function n(l){return l>=1e6?`${(l/1e6).toFixed(2)}M`:l>=1e3?`${(l/1e3).toFixed(1)}K`:String(l)}function y(l){return l<1e-4?"$0.00":l<.01?`$${l.toFixed(4)}`:`$${l.toFixed(2)}`}const R=tt(()=>Math.max(1,...M.value.map(l=>l.total_tokens)));return Q(H),(l,e)=>{var c,I,E,V,f;return d(),r("div",rt,[t("div",lt,[_(k(W),{class:"w-6 h-6 text-primary"}),e[4]||(e[4]=t("h1",{class:"text-2xl font-bold"},"Token Usage",-1))]),B.value?(d(),r("div",nt,"Loading...")):(d(),r(i,{key:1},[t("div",at,[(d(),r(i,null,m(z,s=>t("button",{key:s.id,onClick:N=>p.value=s.id,class:Y(["px-4 py-2 text-sm font-medium border-b-2 transition-colors",p.value===s.id?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"])},o(s.label),11,it)),64))]),p.value==="overview"?(d(),r("div",ut,[t("div",pt,[t("div",xt,[t("div",ct,[_(k(dt),{class:"w-3 h-3"}),e[5]||(e[5]=w(" Total Tokens ",-1))]),t("div",mt,o(n(((c=g.value)==null?void 0:c.total_tokens)??0)),1),t("div",gt,o(n(((I=g.value)==null?void 0:I.total_input_tokens)??0))+" in / "+o(n(((E=g.value)==null?void 0:E.total_output_tokens)??0))+" out ",1)]),t("div",ht,[t("div",vt,[_(k(ot),{class:"w-3 h-3"}),e[6]||(e[6]=w(" Est. Cost ",-1))]),t("div",bt,o(y(((V=g.value)==null?void 0:V.total_cost_usd)??0)),1),e[7]||(e[7]=t("div",{class:"text-xs text-muted-foreground mt-1"},"all time",-1))]),t("div",yt,[t("div",ft,[_(k(X),{class:"w-3 h-3"}),e[8]||(e[8]=w(" Active Squads ",-1))]),t("div",_t,o(h.value.length),1),e[9]||(e[9]=t("div",{class:"text-xs text-muted-foreground mt-1"},"with usage",-1))]),t("div",kt,[t("div",wt,[_(k(st),{class:"w-3 h-3"}),e[10]||(e[10]=w(" Active Agents ",-1))]),t("div",Tt,o(C.value.length),1),e[11]||(e[11]=t("div",{class:"text-xs text-muted-foreground mt-1"},"with usage",-1))])]),b.value!==null?(d(),r("div",Mt,[_(k(et),{class:"w-4 h-4 shrink-0"}),w(" Alert threshold active: "+o(n(b.value))+" tokens per task ",1)])):u("",!0),h.value.length>0?(d(),r("div",Ct,[e[13]||(e[13]=t("h2",{class:"text-base font-semibold mb-3"},"Top Squads by Token Usage",-1)),t("div",Pt,[t("table",St,[e[12]||(e[12]=t("thead",{class:"bg-muted"},[t("tr",null,[t("th",{class:"text-left px-4 py-2 font-medium"},"Squad"),t("th",{class:"text-right px-4 py-2 font-medium"},"Tokens"),t("th",{class:"text-right px-4 py-2 font-medium"},"Est. Cost"),t("th",{class:"text-right px-4 py-2 font-medium"},"Calls")])],-1)),t("tbody",null,[(d(!0),r(i,null,m(h.value.slice(0,5),s=>(d(),r("tr",{key:s.id,class:"border-t border-border"},[t("td",At,o(s.name),1),t("td",Ut,o(n(s.total_tokens)),1),t("td",$t,o(y(s.total_cost_usd)),1),t("td",Dt,o(s.record_count),1)]))),128))])])])])):u("",!0),((f=g.value)==null?void 0:f.total_records)===0?(d(),r("div",It," No token usage recorded yet. Usage will appear here after squads or agents complete tasks. ")):u("",!0)])):u("",!0),p.value==="by-squad"?(d(),r("div",Et,[h.value.length===0?(d(),r("div",Vt," No usage data yet. ")):(d(),r("div",Nt,[t("table",Bt,[e[14]||(e[14]=t("thead",{class:"bg-muted"},[t("tr",null,[t("th",{class:"text-left px-4 py-2 font-medium"},"Squad"),t("th",{class:"text-right px-4 py-2 font-medium"},"Input Tokens"),t("th",{class:"text-right px-4 py-2 font-medium"},"Output Tokens"),t("th",{class:"text-right px-4 py-2 font-medium"},"Total Tokens"),t("th",{class:"text-right px-4 py-2 font-medium"},"Est. Cost"),t("th",{class:"text-right px-4 py-2 font-medium"},"API Calls")])],-1)),t("tbody",null,[(d(!0),r(i,null,m(h.value,s=>(d(),r("tr",{key:s.id,class:"border-t border-border"},[t("td",Ft,o(s.name),1),t("td",Ot,o(n(s.total_input_tokens)),1),t("td",Lt,o(n(s.total_output_tokens)),1),t("td",qt,o(n(s.total_tokens)),1),t("td",zt,o(y(s.total_cost_usd)),1),t("td",Ht,o(s.record_count),1)]))),128))])])]))])):u("",!0),p.value==="by-agent"?(d(),r("div",Kt,[C.value.length===0?(d(),r("div",Gt," No usage data yet. ")):(d(),r("div",Jt,[t("table",Rt,[e[15]||(e[15]=t("thead",{class:"bg-muted"},[t("tr",null,[t("th",{class:"text-left px-4 py-2 font-medium"},"Agent"),t("th",{class:"text-right px-4 py-2 font-medium"},"Input Tokens"),t("th",{class:"text-right px-4 py-2 font-medium"},"Output Tokens"),t("th",{class:"text-right px-4 py-2 font-medium"},"Total Tokens"),t("th",{class:"text-right px-4 py-2 font-medium"},"Est. Cost"),t("th",{class:"text-right px-4 py-2 font-medium"},"API Calls")])],-1)),t("tbody",null,[(d(!0),r(i,null,m(C.value,s=>(d(),r("tr",{key:s.id,class:"border-t border-border"},[t("td",jt,o(s.name),1),t("td",Qt,o(n(s.total_input_tokens)),1),t("td",Wt,o(n(s.total_output_tokens)),1),t("td",Xt,o(n(s.total_tokens)),1),t("td",Yt,o(y(s.total_cost_usd)),1),t("td",Zt,o(s.record_count),1)]))),128))])])]))])):u("",!0),p.value==="daily"?(d(),r("div",te,[M.value.length===0?(d(),r("div",ee," No usage data yet. ")):(d(),r(i,{key:1},[t("div",se,[e[16]||(e[16]=t("h2",{class:"text-base font-semibold mb-3"},"Last 30 Days — Token Usage",-1)),t("div",oe,[(d(!0),r(i,null,m(M.value,s=>(d(),r("div",{key:s.date,class:"flex-1 bg-primary/60 rounded-t min-w-[4px] relative group",style:Z({height:`${s.total_tokens/R.value*100}%`})},[t("div",de,o(s.date)+": "+o(n(s.total_tokens))+" tokens ("+o(y(s.total_cost_usd))+") ",1)],4))),128))])]),t("div",re,[t("table",le,[e[17]||(e[17]=t("thead",{class:"bg-muted"},[t("tr",null,[t("th",{class:"text-left px-4 py-2 font-medium"},"Date"),t("th",{class:"text-right px-4 py-2 font-medium"},"Input Tokens"),t("th",{class:"text-right px-4 py-2 font-medium"},"Output Tokens"),t("th",{class:"text-right px-4 py-2 font-medium"},"Total Tokens"),t("th",{class:"text-right px-4 py-2 font-medium"},"Est. Cost")])],-1)),t("tbody",null,[(d(!0),r(i,null,m([...M.value].reverse(),s=>(d(),r("tr",{key:s.date,class:"border-t border-border"},[t("td",ne,o(s.date),1),t("td",ae,o(n(s.total_input_tokens)),1),t("td",ie,o(n(s.total_output_tokens)),1),t("td",ue,o(n(s.total_tokens)),1),t("td",pe,o(y(s.total_cost_usd)),1)]))),128))])])])],64))])):u("",!0),p.value==="pricing"?(d(),r("div",xe,[t("div",null,[e[18]||(e[18]=t("h2",{class:"text-base font-semibold mb-1"},"Alert Threshold",-1)),e[19]||(e[19]=t("p",{class:"text-sm text-muted-foreground mb-3"}," Post a feed alert when a single task exceeds this many tokens. Leave empty to disable. ",-1)),t("div",ce,[F(t("input",{"onUpdate:modelValue":e[0]||(e[0]=s=>b.value=s),type:"number",min:"0",placeholder:"e.g. 100000",class:"flex-1 rounded-md border border-input bg-background px-3 py-2 text-sm"},null,512),[[O,b.value,void 0,{number:!0}]]),t("button",{onClick:K,disabled:P.value,class:"px-4 py-2 rounded-md bg-primary text-primary-foreground text-sm hover:bg-primary/90 disabled:opacity-50 shrink-0"},o(P.value?"Saving...":S.value?"Saved ✓":"Save"),9,me)])]),t("div",null,[e[24]||(e[24]=t("h2",{class:"text-base font-semibold mb-1"},"Model Pricing",-1)),e[25]||(e[25]=t("p",{class:"text-sm text-muted-foreground mb-3"}," Prices in USD per 1M tokens. Used for cost estimates only. ",-1)),x.value?(d(),r("div",ge,[t("div",he,[e[20]||(e[20]=w(" Editing: ",-1)),t("code",ve,o(x.value),1)]),t("div",be,[t("div",ye,[e[21]||(e[21]=t("label",{class:"text-xs text-muted-foreground"},"Input (per 1M tokens)",-1)),F(t("input",{"onUpdate:modelValue":e[1]||(e[1]=s=>$.value=s),type:"number",min:"0",step:"0.01",class:"w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm"},null,512),[[O,$.value,void 0,{number:!0}]])]),t("div",fe,[e[22]||(e[22]=t("label",{class:"text-xs text-muted-foreground"},"Output (per 1M tokens)",-1)),F(t("input",{"onUpdate:modelValue":e[2]||(e[2]=s=>D.value=s),type:"number",min:"0",step:"0.01",class:"w-full mt-1 rounded-md border border-input bg-background px-3 py-2 text-sm"},null,512),[[O,D.value,void 0,{number:!0}]])])]),t("div",_e,[t("button",{onClick:J,disabled:A.value,class:"px-3 py-1.5 rounded-md bg-primary text-primary-foreground text-sm hover:bg-primary/90 disabled:opacity-50"},o(A.value?"Saving...":U.value?"Saved ✓":"Save"),9,ke),t("button",{onClick:e[3]||(e[3]=s=>x.value=""),class:"px-3 py-1.5 rounded-md border border-border text-sm hover:bg-accent"}," Cancel ")])])):u("",!0),t("div",we,[t("table",Te,[e[23]||(e[23]=t("thead",{class:"bg-muted"},[t("tr",null,[t("th",{class:"text-left px-4 py-2 font-medium"},"Model"),t("th",{class:"text-right px-4 py-2 font-medium"},"Input / 1M tokens"),t("th",{class:"text-right px-4 py-2 font-medium"},"Output / 1M tokens"),t("th",{class:"text-right px-4 py-2 font-medium"})])],-1)),t("tbody",null,[(d(!0),r(i,null,m(v.value,(s,N)=>(d(),r("tr",{key:N,class:"border-t border-border"},[t("td",Me,o(N),1),t("td",Ce," $"+o(s.inputPer1M.toFixed(2)),1),t("td",Pe," $"+o(s.outputPer1M.toFixed(2)),1),t("td",Se,[t("button",{onClick:$e=>G(N),class:"text-xs text-primary hover:underline"}," Edit ",8,Ae)])]))),128))])])])])])):u("",!0)],64))])}}});export{Ve as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
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-
|
|
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-ELvnkQjd.js";import{b as T,d as E,a as G}from"./api-D4mHJ3u0.js";import{S as xe}from"./search-CS9zSIeW.js";import{P as J}from"./plus-BAzlGFd_.js";import{P as O}from"./pencil-CFsi7ufI.js";import{T as X}from"./trash-2-DLveUEsd.js";import{S as Y}from"./save-BmgCYJ1g.js";import{X as ee}from"./x-CjXR97Fa.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,a2 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"},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};
|
|
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};
|