heyio 1.4.0 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +2 -2
  2. package/dist/api/server.js +37 -9
  3. package/dist/copilot/agents.js +47 -3
  4. package/dist/copilot/squad-tools.js +55 -1
  5. package/dist/store/instances.js +4 -0
  6. package/package.json +1 -1
  7. package/web-dist/assets/{AuditLogView-DqxVzjd_.js → AuditLogView-eyz02XQx.js} +2 -2
  8. package/web-dist/assets/{ChatView-BBopM_A3.js → ChatView-DXpE1NMj.js} +1 -1
  9. package/web-dist/assets/{FeedView-Bo4p1stx.js → FeedView-Clis71Lg.js} +2 -2
  10. package/web-dist/assets/HistoryView-B1EJ2Q9S.js +1 -0
  11. package/web-dist/assets/LoginView-bg8Sl_Gw.js +1 -0
  12. package/web-dist/assets/McpView-CBepc2JJ.js +1 -0
  13. package/web-dist/assets/{SchedulesView-B2o3vMm-.js → SchedulesView-DDFUUMPG.js} +2 -2
  14. package/web-dist/assets/SettingsView-BFfDRToB.js +1 -0
  15. package/web-dist/assets/{SkillsView-D_NHLk7C.js → SkillsView-Dv-337Yq.js} +4 -4
  16. package/web-dist/assets/{SquadDetailView-BKXLWvwn.js → SquadDetailView-p4c6XQ5a.js} +2 -2
  17. package/web-dist/assets/SquadHealthView-IjOdIla7.js +11 -0
  18. package/web-dist/assets/SquadsView-C5wQPkBA.js +6 -0
  19. package/web-dist/assets/{UsageView-Cy5Mbprb.js → UsageView-BcHfPX-N.js} +2 -2
  20. package/web-dist/assets/{WikiView-B5TOMnOg.js → WikiView-CKBw5FOf.js} +2 -2
  21. package/web-dist/assets/api-DPUP4xY9.js +1 -0
  22. package/web-dist/assets/{arrow-left-CGMB1w_A.js → arrow-left-BMJZvMdZ.js} +1 -1
  23. package/web-dist/assets/{git-branch-C_Hu39uh.js → git-branch-BF40208L.js} +1 -1
  24. package/web-dist/assets/{index-CiZnRvN4.js → index-DSAUDIwK.js} +63 -62
  25. package/web-dist/assets/{plus-DIBAaEMT.js → plus-aHVgAXQB.js} +1 -1
  26. package/web-dist/assets/{save-Chqlu7QA.js → save-jn5LGsCv.js} +1 -1
  27. package/web-dist/assets/{search-Cl8HcIsG.js → search-DUqJxRNn.js} +1 -1
  28. package/web-dist/assets/{trash-2-CQSzbVIr.js → trash-2-B9ibnt3n.js} +1 -1
  29. package/web-dist/assets/{triangle-alert-C1OjMvP5.js → triangle-alert-Cindqw1C.js} +1 -1
  30. package/web-dist/assets/{x-DThJHYFm.js → x-BDIsved4.js} +1 -1
  31. package/web-dist/index.html +1 -1
  32. package/web-dist/assets/HistoryView-ChTuQvXr.js +0 -1
  33. package/web-dist/assets/LoginView-AnOP3Mau.js +0 -1
  34. package/web-dist/assets/McpView-DPcihjuB.js +0 -1
  35. package/web-dist/assets/SettingsView-rtMUmH43.js +0 -1
  36. package/web-dist/assets/SquadHealthView-CVJiAgVW.js +0 -11
  37. package/web-dist/assets/SquadsView-fammrB7r.js +0 -6
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # 🤖 IO
1
+ <img src="assets/IO-logo.svg" width="120"/>
2
2
 
3
- A personal AI assistant daemon built on the GitHub Copilot SDK. IO runs 24/7 on your machine, reachable via Telegram, a web dashboard, and an HTTP API.
3
+ IO is a personal AI assistant daemon built on the GitHub Copilot SDK. It runs 24/7 on your machine, reachable via Telegram, a web dashboard, and an HTTP API.
4
4
 
5
5
  [![CI](https://github.com/michaeljolley/io/actions/workflows/ci.yml/badge.svg)](https://github.com/michaeljolley/io/actions/workflows/ci.yml)
6
6
  ![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)
@@ -62,7 +62,7 @@ export async function startApiServer(config) {
62
62
  sseClients.splice(idx, 1);
63
63
  });
64
64
  });
65
- // --- Chat ---
65
+ // --- Chat (SSE-streamed response) ---
66
66
  app.post("/api/message", async (req, res) => {
67
67
  const { prompt, conversationId: clientConvId } = req.body;
68
68
  if (!prompt || typeof prompt !== "string") {
@@ -72,15 +72,43 @@ export async function startApiServer(config) {
72
72
  const conversationId = (typeof clientConvId === "string" && clientConvId) ? clientConvId : randomUUID();
73
73
  // Persist the user message
74
74
  saveMessage(conversationId, "user", prompt, "web");
75
- // Stream response via SSE, send final to HTTP response
76
- await sendToOrchestrator(prompt, "web", (content, done) => {
77
- broadcast("message_delta", { content, done });
78
- if (done) {
79
- // Persist the assistant response
80
- saveMessage(conversationId, "assistant", content, "web");
81
- res.json({ content, conversationId });
75
+ // Switch to SSE streaming to avoid Cloudflare 524 timeouts
76
+ res.setHeader("Content-Type", "text/event-stream");
77
+ res.setHeader("Cache-Control", "no-cache");
78
+ res.setHeader("Connection", "keep-alive");
79
+ res.setHeader("X-Accel-Buffering", "no");
80
+ res.flushHeaders();
81
+ // Keepalive: send a comment every 30s to keep Cloudflare happy
82
+ const keepalive = setInterval(() => {
83
+ res.write(": keepalive\n\n");
84
+ }, 30_000);
85
+ let closed = false;
86
+ req.on("close", () => { closed = true; clearInterval(keepalive); });
87
+ try {
88
+ await sendToOrchestrator(prompt, "web", (content, done) => {
89
+ if (closed)
90
+ return;
91
+ if (done) {
92
+ saveMessage(conversationId, "assistant", content, "web");
93
+ res.write(`event: done\ndata: ${JSON.stringify({ content, conversationId })}\n\n`);
94
+ clearInterval(keepalive);
95
+ res.end();
96
+ }
97
+ else {
98
+ res.write(`event: delta\ndata: ${JSON.stringify({ content })}\n\n`);
99
+ // Also broadcast to other SSE listeners (e.g. ChatOverlay)
100
+ broadcast("message_delta", { content, done: false });
101
+ }
102
+ });
103
+ }
104
+ catch (err) {
105
+ if (!closed) {
106
+ const message = err instanceof Error ? err.message : "Unknown error";
107
+ res.write(`event: error\ndata: ${JSON.stringify({ error: message })}\n\n`);
108
+ clearInterval(keepalive);
109
+ res.end();
82
110
  }
83
- });
111
+ }
84
112
  });
85
113
  // --- History ---
86
114
  app.get("/api/history", (req, res) => {
@@ -2,17 +2,59 @@ import { approveAll } from "@github/copilot-sdk";
2
2
  import { getClient } from "./client.js";
3
3
  import { getLeadForSquad, getAgentsForSquad, updateAgentStatus, getSquad } from "../store/squads.js";
4
4
  import { createTask, updateTaskStatus, getTask } from "../store/tasks.js";
5
- import { touchInstanceActivity } from "../store/instances.js";
5
+ import { touchInstanceActivity, getInstance } from "../store/instances.js";
6
6
  import { selectModel, classifyComplexity } from "./model-router.js";
7
7
  import { postFeedItem } from "../store/feed.js";
8
8
  import { attachTokenTracker } from "./token-tracker.js";
9
9
  import { addAuditEntry } from "../store/audit-log.js";
10
10
  import { addAgentEvent } from "../store/agent-events.js";
11
+ import { PATHS } from "../paths.js";
11
12
  import { createSquadTools } from "./squad-tools.js";
12
13
  import { loadSkillDirectories } from "./skills.js";
13
14
  import { getMcpServersForSession } from "../mcp/registry.js";
15
+ import { existsSync, mkdirSync } from "node:fs";
16
+ import { join } from "node:path";
17
+ import { exec } from "node:child_process";
18
+ import { promisify } from "node:util";
19
+ const execAsync = promisify(exec);
14
20
  // Registry of active agent sessions keyed by task ID
15
21
  const activeSessions = new Map();
22
+ /**
23
+ * Resolve the working directory for a squad agent session.
24
+ * Priority: instance worktree → cloned repo → process.cwd()
25
+ */
26
+ async function resolveSquadWorkingDirectory(squad, instanceId) {
27
+ // If an instance is specified, use its worktree path
28
+ if (instanceId) {
29
+ const instance = getInstance(instanceId);
30
+ if (instance?.worktree_path && existsSync(instance.worktree_path)) {
31
+ return instance.worktree_path;
32
+ }
33
+ }
34
+ // Derive from squad repo_url → ~/.io/source/{owner}/{repo}
35
+ if (squad.repo_url) {
36
+ const match = squad.repo_url.match(/[/:]([^/]+)\/([^/.]+?)(?:\.git)?$/);
37
+ if (match) {
38
+ const [, owner, repo] = match;
39
+ const sourceDir = join(PATHS.source, owner, repo);
40
+ if (existsSync(sourceDir)) {
41
+ return sourceDir;
42
+ }
43
+ // Attempt to clone if missing
44
+ const parentDir = join(PATHS.source, owner);
45
+ if (!existsSync(parentDir))
46
+ mkdirSync(parentDir, { recursive: true });
47
+ try {
48
+ await execAsync(`git clone ${squad.repo_url} ${sourceDir}`, { timeout: 120_000 });
49
+ return sourceDir;
50
+ }
51
+ catch {
52
+ // Clone failed — fall through to default
53
+ }
54
+ }
55
+ }
56
+ return process.cwd();
57
+ }
16
58
  /**
17
59
  * Stop a running agent by task ID. Disconnects the session and marks the task as stopped.
18
60
  */
@@ -93,13 +135,15 @@ ${lead.persona ? `## Personality:\n${lead.persona}` : ""}
93
135
  let result;
94
136
  try {
95
137
  // Load squad-scoped tools, skills, and MCP servers
96
- const squadTools = createSquadTools(squadSlug, squadId);
138
+ const squadTools = createSquadTools(squadSlug, squadId, squad?.repo_url);
97
139
  const skillDirs = await loadSkillDirectories();
98
140
  const mcpServers = getMcpServersForSession();
141
+ // Resolve correct working directory for the squad's project
142
+ const workDir = await resolveSquadWorkingDirectory(squad, instanceId);
99
143
  const session = await client.createSession({
100
144
  model,
101
145
  streaming: true,
102
- workingDirectory: process.cwd(),
146
+ workingDirectory: workDir,
103
147
  systemMessage: { content: systemMessage },
104
148
  tools: squadTools,
105
149
  skillDirectories: skillDirs,
@@ -1,12 +1,31 @@
1
1
  import { z } from "zod";
2
2
  import { defineTool } from "@github/copilot-sdk";
3
+ import { exec } from "node:child_process";
4
+ import { promisify } from "node:util";
5
+ import { join } from "node:path";
6
+ import { PATHS } from "../paths.js";
7
+ const execAsync = promisify(exec);
8
+ /**
9
+ * Resolve the project root directory for a squad from its repo_url.
10
+ * Returns the path under ~/.io/source/{owner}/{repo} or null if unknown.
11
+ */
12
+ function resolveSquadProjectDir(repoUrl) {
13
+ if (!repoUrl)
14
+ return null;
15
+ const match = repoUrl.match(/[/:]([^/]+)\/([^/.]+?)(?:\.git)?$/);
16
+ if (!match)
17
+ return null;
18
+ const [, owner, repo] = match;
19
+ return join(PATHS.source, owner, repo);
20
+ }
3
21
  /**
4
22
  * Creates a scoped set of tools for squad agent sessions.
5
23
  * Wiki tools are sandboxed to the squad's own wiki subfolder.
6
24
  * Feed posts are locked to the squad's source identifier.
7
25
  */
8
- export function createSquadTools(squadSlug, squadId) {
26
+ export function createSquadTools(squadSlug, squadId, repoUrl) {
9
27
  const wikiPrefix = `squads/${squadSlug}`;
28
+ const projectDir = resolveSquadProjectDir(repoUrl ?? null);
10
29
  return [
11
30
  // --- Wiki Tools (scoped to squads/{slug}/) ---
12
31
  defineTool("wiki_read", {
@@ -97,6 +116,41 @@ export function createSquadTools(squadSlug, squadId) {
97
116
  return getTasksForSquad(squadId);
98
117
  },
99
118
  }),
119
+ // --- Shell Tool (scoped to project directory) ---
120
+ defineTool("shell_exec", {
121
+ description: "Execute a shell command in the squad's project directory. Use for git, build tools, test runners, file operations, etc.",
122
+ parameters: z.object({
123
+ command: z.string().describe("Shell command to execute"),
124
+ cwd: z
125
+ .string()
126
+ .optional()
127
+ .describe("Working directory relative to project root (optional, defaults to project root)"),
128
+ }),
129
+ handler: async ({ command, cwd }) => {
130
+ const baseDir = projectDir ?? process.cwd();
131
+ // If cwd is provided, resolve it relative to the project dir
132
+ const workDir = cwd ? join(baseDir, cwd) : baseDir;
133
+ // Safety: ensure workDir is under baseDir
134
+ const resolved = join(workDir);
135
+ if (!resolved.startsWith(baseDir)) {
136
+ return `Error: cannot execute commands outside the project directory`;
137
+ }
138
+ try {
139
+ const { stdout } = await execAsync(command, {
140
+ cwd: workDir,
141
+ timeout: 120_000,
142
+ maxBuffer: 2 * 1024 * 1024,
143
+ env: { ...process.env, GH_PROMPT_DISABLED: "1" },
144
+ });
145
+ return stdout.trim() || "(no output)";
146
+ }
147
+ catch (err) {
148
+ const stderr = err.stderr?.toString().trim() ?? "";
149
+ const stdout = err.stdout?.toString().trim() ?? "";
150
+ return `Error (exit ${err.code ?? 1}): ${stderr || stdout || err.message}`;
151
+ }
152
+ },
153
+ }),
100
154
  ];
101
155
  }
102
156
  //# sourceMappingURL=squad-tools.js.map
@@ -4,6 +4,10 @@ import { promisify } from "node:util";
4
4
  import { getDb } from "./db.js";
5
5
  const execAsync = promisify(exec);
6
6
  const MAX_INSTANCES_PER_SQUAD = 3;
7
+ export function getInstance(instanceId) {
8
+ const db = getDb();
9
+ return db.prepare("SELECT * FROM instances WHERE id = ?").get(instanceId);
10
+ }
7
11
  export async function createInstance(squadId, branch) {
8
12
  const db = getDb();
9
13
  // Check max instances
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "heyio",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "description": "IO — a personal AI assistant daemon built on the GitHub Copilot SDK",
5
5
  "bin": {
6
6
  "io": "dist/index.js"
@@ -1,6 +1,6 @@
1
- import{q as W,t as X,x as Z,z as a,o as d,l as o,s as A,K as N,a as V,r as S,J as l,Y as f,T,F as h,E as w,V as F,n as b,D as n,h as L,k as _,v as ee}from"./index-CiZnRvN4.js";/**
1
+ import{l as W,o as X,s as Z,u as a,k as d,h as o,n as P,D as A,a as V,m as S,z as l,T as f,N as T,F as h,w,O as F,j as b,v as n,g as _,q as ee}from"./index-DSAUDIwK.js";import{b as L}from"./api-DPUP4xY9.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 te=W("FilterIcon",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]),oe={class:"p-6"},se={class:"flex items-center justify-between mb-6"},ae={class:"text-2xl font-bold flex items-center gap-2"},de={class:"text-sm text-muted-foreground"},le={class:"border border-border rounded-lg p-4 mb-6 space-y-3"},re={class:"flex items-center gap-2 text-sm font-medium text-muted-foreground mb-1"},ne={class:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-3"},ue=["value"],ie=["value"],ce=["value"],pe={key:0,class:"text-muted-foreground"},ve={key:1,class:"text-center py-12 text-muted-foreground"},me={key:2,class:"space-y-1"},ge=["onClick"],xe={class:"flex-1 min-w-0"},fe={class:"flex flex-wrap items-center gap-2 mb-1"},be={key:0,class:"text-xs bg-secondary text-secondary-foreground px-2 py-0.5 rounded-full"},_e={key:1,class:"text-xs bg-secondary text-secondary-foreground px-2 py-0.5 rounded-full"},ye={class:"text-sm truncate"},ke={class:"text-xs text-muted-foreground mt-0.5"},he={class:"text-xs text-muted-foreground mt-1 shrink-0"},we={key:0,class:"border-t border-border px-4 py-3"},qe={key:0,class:"text-xs text-muted-foreground mb-2"},Ce={class:"font-mono"},Pe={class:"text-xs bg-muted rounded p-3 overflow-x-auto whitespace-pre-wrap break-words"},Ae={key:3,class:"flex items-center justify-between mt-4"},Ne=["disabled"],Se={class:"text-xs text-muted-foreground"},Te=["disabled"],u=50,Me=X({__name:"AuditLogView",setup(Ve){const q=n([]),c=n(0),C=n(!0),y=n(null),P=n([]),k=n([]),i=n(""),p=n(""),v=n(""),m=n(""),g=n(""),r=n(0),M=["message_received","task_delegated","task_completed","task_failed","shell_command","squad_created","squad_meeting"],I={message_received:"bg-blue-500/20 text-blue-400",task_delegated:"bg-purple-500/20 text-purple-400",task_completed:"bg-green-500/20 text-green-400",task_failed:"bg-red-500/20 text-red-400",shell_command:"bg-yellow-500/20 text-yellow-400",squad_created:"bg-indigo-500/20 text-indigo-400",squad_meeting:"bg-teal-500/20 text-teal-400"};function O(s){return I[s]??"bg-secondary text-secondary-foreground"}async function x(){C.value=!0;try{const s=new URLSearchParams;i.value&&s.set("squad_id",i.value),p.value&&s.set("agent_id",p.value),v.value&&s.set("action_type",v.value),m.value&&s.set("from",m.value),g.value&&s.set("to",g.value),s.set("limit",String(u)),s.set("offset",String(r.value));const t=await L(`/audit-log?${s.toString()}`);q.value=t.entries,c.value=t.total}finally{C.value=!1}}async function U(){const s=await L("/squads");P.value=s.squads,k.value=s.agents}function D(){r.value=0,x()}function $(){i.value="",p.value="",v.value="",m.value="",g.value="",r.value=0,x()}function E(){r.value>0&&(r.value=Math.max(0,r.value-u),x())}function B(){r.value+u<c.value&&(r.value=r.value+u,x())}function J(s){y.value=y.value===s?null:s}function R(s){try{return JSON.stringify(JSON.parse(s.payload),null,2)}catch{return s.payload}}function Y(s){var t;return s?((t=P.value.find(e=>e.id===s))==null?void 0:t.name)??s.slice(0,8):""}function j(s){if(!s)return"";const t=k.value.find(e=>e.id===s);return t?`${t.character_name} (${t.role_title})`:s.slice(0,8)}const z=_(()=>r.value+u<c.value),G=_(()=>r.value>0),K=_(()=>Math.floor(r.value/u)+1),H=_(()=>Math.max(1,Math.ceil(c.value/u))),Q=_(()=>i.value?k.value.filter(s=>s.squad_id===i.value):k.value);return Z(async()=>{await Promise.all([x(),U()])}),(s,t)=>(a(),d("div",oe,[o("div",se,[o("h1",ae,[A(N(V),{class:"w-6 h-6"}),t[6]||(t[6]=S(" Audit Log ",-1))]),o("span",de,l(c.value)+" entries",1)]),o("div",le,[o("div",re,[A(N(te),{class:"w-4 h-4"}),t[7]||(t[7]=S(" Filters ",-1))]),o("div",ne,[f(o("select",{"onUpdate:modelValue":t[0]||(t[0]=e=>i.value=e),class:"px-2 py-1.5 text-sm rounded-md border border-border bg-background",onChange:t[1]||(t[1]=e=>p.value="")},[t[8]||(t[8]=o("option",{value:""},"All squads",-1)),(a(!0),d(h,null,w(P.value,e=>(a(),d("option",{key:e.id,value:e.id},l(e.name),9,ue))),128))],544),[[T,i.value]]),f(o("select",{"onUpdate:modelValue":t[2]||(t[2]=e=>p.value=e),class:"px-2 py-1.5 text-sm rounded-md border border-border bg-background"},[t[9]||(t[9]=o("option",{value:""},"All agents",-1)),(a(!0),d(h,null,w(Q.value,e=>(a(),d("option",{key:e.id,value:e.id},l(e.character_name),9,ie))),128))],512),[[T,p.value]]),f(o("select",{"onUpdate:modelValue":t[3]||(t[3]=e=>v.value=e),class:"px-2 py-1.5 text-sm rounded-md border border-border bg-background"},[t[10]||(t[10]=o("option",{value:""},"All action types",-1)),(a(),d(h,null,w(M,e=>o("option",{key:e,value:e},l(e),9,ce)),64))],512),[[T,v.value]]),f(o("input",{"onUpdate:modelValue":t[4]||(t[4]=e=>m.value=e),type:"datetime-local",placeholder:"From",class:"px-2 py-1.5 text-sm rounded-md border border-border bg-background"},null,512),[[F,m.value]]),f(o("input",{"onUpdate:modelValue":t[5]||(t[5]=e=>g.value=e),type:"datetime-local",placeholder:"To",class:"px-2 py-1.5 text-sm rounded-md border border-border bg-background"},null,512),[[F,g.value]])]),o("div",{class:"flex gap-2"},[o("button",{onClick:D,class:"px-3 py-1.5 text-xs rounded-md bg-primary text-primary-foreground hover:bg-primary/90 transition-colors"}," Apply "),o("button",{onClick:$,class:"px-3 py-1.5 text-xs rounded-md border border-border text-muted-foreground hover:text-foreground transition-colors"}," Reset ")])]),C.value?(a(),d("div",pe,"Loading...")):q.value.length===0?(a(),d("div",ve,[A(N(V),{class:"w-12 h-12 mx-auto mb-3 opacity-50"}),t[11]||(t[11]=o("p",null,"No audit log entries found.",-1))])):(a(),d("div",me,[(a(!0),d(h,null,w(q.value,e=>(a(),d("div",{key:e.id,class:"border border-border rounded-lg overflow-hidden"},[o("div",{onClick:Fe=>J(e.id),class:"flex items-start gap-3 px-4 py-3 cursor-pointer hover:bg-muted/50 transition-colors"},[o("div",xe,[o("div",fe,[o("span",{class:ee(["text-xs px-2 py-0.5 rounded-full font-mono",O(e.action_type)])},l(e.action_type),3),e.squad_id?(a(),d("span",be,l(Y(e.squad_id)),1)):b("",!0),e.agent_id?(a(),d("span",_e,l(j(e.agent_id)),1)):b("",!0)]),o("p",ye,l(e.summary),1),o("p",ke,l(e.created_at),1)]),o("span",he,l(y.value===e.id?"▲":"▼"),1)],8,ge),y.value===e.id?(a(),d("div",we,[e.task_id?(a(),d("div",qe,[t[12]||(t[12]=S(" Task ID: ",-1)),o("code",Ce,l(e.task_id),1)])):b("",!0),o("pre",Pe,l(R(e)),1)])):b("",!0)]))),128))])),c.value>u?(a(),d("div",Ae,[o("button",{disabled:!G.value,onClick:E,class:"px-3 py-1.5 text-xs rounded-md border border-border text-muted-foreground disabled:opacity-40 hover:text-foreground transition-colors"}," ← Previous ",8,Ne),o("span",Se," Page "+l(K.value)+" of "+l(H.value),1),o("button",{disabled:!z.value,onClick:B,class:"px-3 py-1.5 text-xs rounded-md border border-border text-muted-foreground disabled:opacity-40 hover:text-foreground transition-colors"}," Next → ",8,Te)])):b("",!0)]))}});export{Me as default};
6
+ */const te=W("FilterIcon",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]),oe={class:"p-6"},se={class:"flex items-center justify-between mb-6"},ae={class:"text-2xl font-bold flex items-center gap-2"},de={class:"text-sm text-muted-foreground"},le={class:"border border-border rounded-lg p-4 mb-6 space-y-3"},re={class:"flex items-center gap-2 text-sm font-medium text-muted-foreground mb-1"},ne={class:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-3"},ue=["value"],ie=["value"],ce=["value"],pe={key:0,class:"text-muted-foreground"},ve={key:1,class:"text-center py-12 text-muted-foreground"},me={key:2,class:"space-y-1"},ge=["onClick"],xe={class:"flex-1 min-w-0"},fe={class:"flex flex-wrap items-center gap-2 mb-1"},be={key:0,class:"text-xs bg-secondary text-secondary-foreground px-2 py-0.5 rounded-full"},_e={key:1,class:"text-xs bg-secondary text-secondary-foreground px-2 py-0.5 rounded-full"},ye={class:"text-sm truncate"},ke={class:"text-xs text-muted-foreground mt-0.5"},he={class:"text-xs text-muted-foreground mt-1 shrink-0"},we={key:0,class:"border-t border-border px-4 py-3"},qe={key:0,class:"text-xs text-muted-foreground mb-2"},Ce={class:"font-mono"},Ne={class:"text-xs bg-muted rounded p-3 overflow-x-auto whitespace-pre-wrap break-words"},Pe={key:3,class:"flex items-center justify-between mt-4"},Ae=["disabled"],Se={class:"text-xs text-muted-foreground"},Te=["disabled"],u=50,Oe=X({__name:"AuditLogView",setup(Ve){const q=n([]),c=n(0),C=n(!0),y=n(null),N=n([]),k=n([]),i=n(""),p=n(""),v=n(""),m=n(""),g=n(""),r=n(0),M=["message_received","task_delegated","task_completed","task_failed","shell_command","squad_created","squad_meeting"],O={message_received:"bg-blue-500/20 text-blue-400",task_delegated:"bg-purple-500/20 text-purple-400",task_completed:"bg-green-500/20 text-green-400",task_failed:"bg-red-500/20 text-red-400",shell_command:"bg-yellow-500/20 text-yellow-400",squad_created:"bg-indigo-500/20 text-indigo-400",squad_meeting:"bg-teal-500/20 text-teal-400"};function I(s){return O[s]??"bg-secondary text-secondary-foreground"}async function x(){C.value=!0;try{const s=new URLSearchParams;i.value&&s.set("squad_id",i.value),p.value&&s.set("agent_id",p.value),v.value&&s.set("action_type",v.value),m.value&&s.set("from",m.value),g.value&&s.set("to",g.value),s.set("limit",String(u)),s.set("offset",String(r.value));const t=await L(`/audit-log?${s.toString()}`);q.value=t.entries,c.value=t.total}finally{C.value=!1}}async function U(){const s=await L("/squads");N.value=s.squads,k.value=s.agents}function D(){r.value=0,x()}function $(){i.value="",p.value="",v.value="",m.value="",g.value="",r.value=0,x()}function j(){r.value>0&&(r.value=Math.max(0,r.value-u),x())}function B(){r.value+u<c.value&&(r.value=r.value+u,x())}function E(s){y.value=y.value===s?null:s}function R(s){try{return JSON.stringify(JSON.parse(s.payload),null,2)}catch{return s.payload}}function z(s){var t;return s?((t=N.value.find(e=>e.id===s))==null?void 0:t.name)??s.slice(0,8):""}function J(s){if(!s)return"";const t=k.value.find(e=>e.id===s);return t?`${t.character_name} (${t.role_title})`:s.slice(0,8)}const Y=_(()=>r.value+u<c.value),G=_(()=>r.value>0),H=_(()=>Math.floor(r.value/u)+1),K=_(()=>Math.max(1,Math.ceil(c.value/u))),Q=_(()=>i.value?k.value.filter(s=>s.squad_id===i.value):k.value);return Z(async()=>{await Promise.all([x(),U()])}),(s,t)=>(a(),d("div",oe,[o("div",se,[o("h1",ae,[P(A(V),{class:"w-6 h-6"}),t[6]||(t[6]=S(" Audit Log ",-1))]),o("span",de,l(c.value)+" entries",1)]),o("div",le,[o("div",re,[P(A(te),{class:"w-4 h-4"}),t[7]||(t[7]=S(" Filters ",-1))]),o("div",ne,[f(o("select",{"onUpdate:modelValue":t[0]||(t[0]=e=>i.value=e),class:"px-2 py-1.5 text-sm rounded-md border border-border bg-background",onChange:t[1]||(t[1]=e=>p.value="")},[t[8]||(t[8]=o("option",{value:""},"All squads",-1)),(a(!0),d(h,null,w(N.value,e=>(a(),d("option",{key:e.id,value:e.id},l(e.name),9,ue))),128))],544),[[T,i.value]]),f(o("select",{"onUpdate:modelValue":t[2]||(t[2]=e=>p.value=e),class:"px-2 py-1.5 text-sm rounded-md border border-border bg-background"},[t[9]||(t[9]=o("option",{value:""},"All agents",-1)),(a(!0),d(h,null,w(Q.value,e=>(a(),d("option",{key:e.id,value:e.id},l(e.character_name),9,ie))),128))],512),[[T,p.value]]),f(o("select",{"onUpdate:modelValue":t[3]||(t[3]=e=>v.value=e),class:"px-2 py-1.5 text-sm rounded-md border border-border bg-background"},[t[10]||(t[10]=o("option",{value:""},"All action types",-1)),(a(),d(h,null,w(M,e=>o("option",{key:e,value:e},l(e),9,ce)),64))],512),[[T,v.value]]),f(o("input",{"onUpdate:modelValue":t[4]||(t[4]=e=>m.value=e),type:"datetime-local",placeholder:"From",class:"px-2 py-1.5 text-sm rounded-md border border-border bg-background"},null,512),[[F,m.value]]),f(o("input",{"onUpdate:modelValue":t[5]||(t[5]=e=>g.value=e),type:"datetime-local",placeholder:"To",class:"px-2 py-1.5 text-sm rounded-md border border-border bg-background"},null,512),[[F,g.value]])]),o("div",{class:"flex gap-2"},[o("button",{onClick:D,class:"px-3 py-1.5 text-xs rounded-md bg-primary text-primary-foreground hover:bg-primary/90 transition-colors"}," Apply "),o("button",{onClick:$,class:"px-3 py-1.5 text-xs rounded-md border border-border text-muted-foreground hover:text-foreground transition-colors"}," Reset ")])]),C.value?(a(),d("div",pe,"Loading...")):q.value.length===0?(a(),d("div",ve,[P(A(V),{class:"w-12 h-12 mx-auto mb-3 opacity-50"}),t[11]||(t[11]=o("p",null,"No audit log entries found.",-1))])):(a(),d("div",me,[(a(!0),d(h,null,w(q.value,e=>(a(),d("div",{key:e.id,class:"border border-border rounded-lg overflow-hidden"},[o("div",{onClick:Fe=>E(e.id),class:"flex items-start gap-3 px-4 py-3 cursor-pointer hover:bg-muted/50 transition-colors"},[o("div",xe,[o("div",fe,[o("span",{class:ee(["text-xs px-2 py-0.5 rounded-full font-mono",I(e.action_type)])},l(e.action_type),3),e.squad_id?(a(),d("span",be,l(z(e.squad_id)),1)):b("",!0),e.agent_id?(a(),d("span",_e,l(J(e.agent_id)),1)):b("",!0)]),o("p",ye,l(e.summary),1),o("p",ke,l(e.created_at),1)]),o("span",he,l(y.value===e.id?"▲":"▼"),1)],8,ge),y.value===e.id?(a(),d("div",we,[e.task_id?(a(),d("div",qe,[t[12]||(t[12]=S(" Task ID: ",-1)),o("code",Ce,l(e.task_id),1)])):b("",!0),o("pre",Ne,l(R(e)),1)])):b("",!0)]))),128))])),c.value>u?(a(),d("div",Pe,[o("button",{disabled:!G.value,onClick:j,class:"px-3 py-1.5 text-xs rounded-md border border-border text-muted-foreground disabled:opacity-40 hover:text-foreground transition-colors"}," ← Previous ",8,Ae),o("span",Se," Page "+l(H.value)+" of "+l(K.value),1),o("button",{disabled:!Y.value,onClick:B,class:"px-3 py-1.5 text-xs rounded-md border border-border text-muted-foreground disabled:opacity-40 hover:text-foreground transition-colors"}," Next → ",8,Te)])):b("",!0)]))}});export{Oe as default};
@@ -1 +1 @@
1
- import{t as h,N as _,W as p,x as b,z as a,o,l as e,K as r,n as x,F as k,E as w,Y as S,V as C,m as u,S as B,d as V,D as g,v as m,f as K,u as y}from"./index-CiZnRvN4.js";const T={class:"flex flex-col h-full"},j={key:0,class:"flex items-center justify-center h-full"},z={key:1,class:"text-muted-foreground"},D={key:2,class:"inline-block w-2 h-4 bg-current animate-pulse ml-1"},E={class:"border-t border-border p-4"},M={class:"flex gap-2 items-end"},N=["disabled"],q=h({__name:"ChatView",setup(F){const n=_(),l=g(""),i=g();async function f(){const s=l.value.trim();!s||n.isStreaming||(l.value="",await n.sendMessage(s))}function c(){i.value&&(i.value.scrollTop=i.value.scrollHeight)}function v(s){s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),f())}return p(()=>n.messages.map(s=>s.content),async()=>{await y(),c()},{deep:!0}),p(()=>n.messages.length,async()=>{await y(),c()}),b(()=>c()),(s,d)=>(a(),o("div",T,[e("div",{ref_key:"messagesContainer",ref:i,class:"flex-1 overflow-y-auto p-4 space-y-4"},[r(n).messages.length===0?(a(),o("div",j,[...d[1]||(d[1]=[e("div",{class:"text-center text-muted-foreground"},[e("div",{class:"text-4xl mb-3"},"🤖"),e("p",{class:"text-lg font-medium"},"Welcome to IO"),e("p",{class:"text-sm mt-1"},"Send a message to get started.")],-1)])])):x("",!0),(a(!0),o(k,null,w(r(n).messages,t=>(a(),o("div",{key:t.id,class:m(["flex",t.role==="user"?"justify-end":"justify-start"])},[e("div",{class:m(["max-w-[75%] rounded-lg px-4 py-2 text-sm",t.role==="user"?"bg-primary text-primary-foreground":"bg-muted text-foreground"])},[t.content?(a(),u(K,{key:0,content:t.content,class:m(t.role==="user"?"prose-invert":"")},null,8,["content","class"])):(a(),o("span",z,"...")),t.streaming?(a(),o("div",D)):x("",!0)],2)],2))),128))],512),e("div",E,[e("div",M,[S(e("textarea",{"onUpdate:modelValue":d[0]||(d[0]=t=>l.value=t),onKeydown:v,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),[[C,l.value]]),e("button",{onClick:f,disabled:!l.value.trim()||r(n).isStreaming,class:"rounded-md bg-primary text-primary-foreground p-2 hover:bg-primary/90 disabled:opacity-50 transition-colors"},[r(n).isStreaming?(a(),u(r(V),{key:1,class:"w-4 h-4"})):(a(),u(r(B),{key:0,class:"w-4 h-4"}))],8,N)])])]))}});export{q as default};
1
+ import{o as h,G as _,Q as p,s as b,u as a,k as o,h as e,D as r,j as x,F as k,w,T as S,O as C,i as u,S as B,d as T,v as g,q as m,f as j,p as y}from"./index-DSAUDIwK.js";const V={class:"flex flex-col h-full"},D={key:0,class:"flex items-center justify-center h-full"},K={key:1,class:"text-muted-foreground"},M={key:2,class:"inline-block w-2 h-4 bg-current animate-pulse ml-1"},q={class:"border-t border-border p-4"},z={class:"flex gap-2 items-end"},E=["disabled"],O=h({__name:"ChatView",setup(F){const n=_(),l=g(""),i=g();async function f(){const s=l.value.trim();!s||n.isStreaming||(l.value="",await n.sendMessage(s))}function c(){i.value&&(i.value.scrollTop=i.value.scrollHeight)}function v(s){s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),f())}return p(()=>n.messages.map(s=>s.content),async()=>{await y(),c()},{deep:!0}),p(()=>n.messages.length,async()=>{await y(),c()}),b(()=>c()),(s,d)=>(a(),o("div",V,[e("div",{ref_key:"messagesContainer",ref:i,class:"flex-1 overflow-y-auto p-4 space-y-4"},[r(n).messages.length===0?(a(),o("div",D,[...d[1]||(d[1]=[e("div",{class:"text-center text-muted-foreground"},[e("div",{class:"text-4xl mb-3"},"🤖"),e("p",{class:"text-lg font-medium"},"Welcome to IO"),e("p",{class:"text-sm mt-1"},"Send a message to get started.")],-1)])])):x("",!0),(a(!0),o(k,null,w(r(n).messages,t=>(a(),o("div",{key:t.id,class:m(["flex",t.role==="user"?"justify-end":"justify-start"])},[e("div",{class:m(["max-w-[75%] rounded-lg px-4 py-2 text-sm",t.role==="user"?"bg-primary text-primary-foreground":"bg-muted text-foreground"])},[t.content?(a(),u(j,{key:0,content:t.content,class:m(t.role==="user"?"prose-invert":"")},null,8,["content","class"])):(a(),o("span",K,"...")),t.streaming?(a(),o("div",M)):x("",!0)],2)],2))),128))],512),e("div",q,[e("div",z,[S(e("textarea",{"onUpdate:modelValue":d[0]||(d[0]=t=>l.value=t),onKeydown:v,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),[[C,l.value]]),e("button",{onClick:f,disabled:!l.value.trim()||r(n).isStreaming,class:"rounded-md bg-primary text-primary-foreground p-2 hover:bg-primary/90 disabled:opacity-50 transition-colors"},[r(n).isStreaming?(a(),u(r(T),{key:1,class:"w-4 h-4"})):(a(),u(r(B),{key:0,class:"w-4 h-4"}))],8,E)])])]))}});export{O as default};
@@ -1,6 +1,6 @@
1
- import{q as M,t as D,x as N,z as o,o as n,l as a,F as y,E as b,s as c,K as i,I as V,D as d,h as k,k as z,v as f,J as v,w as B,$ as q,n as C,f as E,i as P,g as T}from"./index-CiZnRvN4.js";import{g as j}from"./squad-colors-B8B_Y-lz.js";import{T as A}from"./trash-2-CQSzbVIr.js";/**
1
+ import{l as M,o as D,s as N,u as o,k as n,h as a,F as y,w as b,n as c,D as i,I as V,v as d,g as z,q as f,z as v,r as B,W as k,j as q,f as j}from"./index-DSAUDIwK.js";import{b as C,c as P,a as T}from"./api-DPUP4xY9.js";import{g as W}from"./squad-colors-B8B_Y-lz.js";import{T as A}from"./trash-2-B9ibnt3n.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 G=M("CheckIcon",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),J={class:"p-6"},K={class:"flex items-center justify-between mb-6"},R={class:"flex gap-2"},U=["onClick"],W={key:0,class:"text-muted-foreground"},H={key:1,class:"text-center py-12 text-muted-foreground"},O={key:2,class:"space-y-2"},Q=["onClick"],X={class:"flex-1 min-w-0"},Y={class:"flex items-center gap-2"},Z={class:"text-xs text-muted-foreground mt-0.5"},ee={class:"flex gap-1"},te=["onClick"],se=["onClick"],ae={key:0,class:"px-4 pb-3 border-t border-border pt-3"},le=D({__name:"FeedView",setup(oe){const r=d([]),m=d([]),l=d(0),p=d("all"),x=d(!0),u=d(null);async function g(){x.value=!0;try{const e=await k(`/feed?unread=${p.value==="unread"}`);r.value=e.items,l.value=e.unreadCount}finally{x.value=!1}}async function w(){const e=await k("/squads");m.value=e.squads}async function h(e){await P(`/feed/${e}/read`);const s=r.value.find(t=>t.id===e);s&&(s.read=1,l.value=Math.max(0,l.value-1))}async function $(e){await T(`/feed/${e}`),r.value=r.value.filter(s=>s.id!==e)}function I(e){u.value=u.value===e?null:e,u.value===e&&h(e)}function S(e){if(!e.startsWith("squad-"))return;const s=e.slice(6);return m.value.find(t=>t.id===s)}const F=z(()=>r.value.map(e=>{const s=S(e.source);return{...e,squad:s}}));N(async()=>{await Promise.all([g(),w()])});function L(e){var s;return((s=e.squad)==null?void 0:s.name)??e.source}return(e,s)=>(o(),n("div",J,[a("div",K,[s[0]||(s[0]=a("h1",{class:"text-2xl font-bold"},"Feed",-1)),a("div",R,[(o(),n(y,null,b(["all","unread"],t=>a("button",{key:t,onClick:_=>{p.value=t,g()},class:f(["px-3 py-1.5 text-xs rounded-md border transition-colors",p.value===t?"bg-primary text-primary-foreground border-primary":"border-border text-muted-foreground hover:text-foreground"])},v(t==="all"?"All":`Unread (${l.value})`),11,U)),64))])]),x.value?(o(),n("div",W,"Loading...")):r.value.length===0?(o(),n("div",H,[c(i(V),{class:"w-12 h-12 mx-auto mb-3 opacity-50"}),s[1]||(s[1]=a("p",null,"No feed items.",-1))])):(o(),n("div",O,[(o(!0),n(y,null,b(F.value,t=>(o(),n("div",{key:t.id,class:f(["border border-border rounded-lg overflow-hidden",{"border-l-2 border-l-primary":!t.read}])},[a("div",{onClick:_=>I(t.id),class:"flex items-center gap-3 px-4 py-3 cursor-pointer hover:bg-muted/50 transition-colors"},[a("div",X,[a("div",Y,[a("span",{class:f(["text-xs px-2 py-0.5 rounded-full",{"bg-secondary text-secondary-foreground":!t.squad}]),style:B(t.squad?i(j)(t.squad.color):{})},v(L(t)),7),a("span",{class:f(["text-sm font-medium truncate",{"font-bold":!t.read}])},v(t.title),3)]),a("p",Z,v(t.created_at),1)]),a("div",ee,[t.read?C("",!0):(o(),n("button",{key:0,onClick:q(_=>h(t.id),["stop"]),class:"p-1.5 rounded hover:bg-accent text-muted-foreground",title:"Mark as read"},[c(i(G),{class:"w-3.5 h-3.5"})],8,te)),a("button",{onClick:q(_=>$(t.id),["stop"]),class:"p-1.5 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive",title:"Delete"},[c(i(A),{class:"w-3.5 h-3.5"})],8,se)])],8,Q),u.value===t.id?(o(),n("div",ae,[c(E,{content:t.content},null,8,["content"])])):C("",!0)],2))),128))]))]))}});export{le as default};
6
+ */const E=M("CheckIcon",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),G={class:"p-6"},R={class:"flex items-center justify-between mb-6"},U={class:"flex gap-2"},H=["onClick"],J={key:0,class:"text-muted-foreground"},K={key:1,class:"text-center py-12 text-muted-foreground"},O={key:2,class:"space-y-2"},Q=["onClick"],X={class:"flex-1 min-w-0"},Y={class:"flex items-center gap-2"},Z={class:"text-xs text-muted-foreground mt-0.5"},ee={class:"flex gap-1"},te=["onClick"],se=["onClick"],ae={key:0,class:"px-4 pb-3 border-t border-border pt-3"},ue=D({__name:"FeedView",setup(oe){const r=d([]),x=d([]),l=d(0),p=d("all"),m=d(!0),u=d(null);async function g(){m.value=!0;try{const e=await C(`/feed?unread=${p.value==="unread"}`);r.value=e.items,l.value=e.unreadCount}finally{m.value=!1}}async function w(){const e=await C("/squads");x.value=e.squads}async function h(e){await P(`/feed/${e}/read`);const s=r.value.find(t=>t.id===e);s&&(s.read=1,l.value=Math.max(0,l.value-1))}async function $(e){await T(`/feed/${e}`),r.value=r.value.filter(s=>s.id!==e)}function I(e){u.value=u.value===e?null:e,u.value===e&&h(e)}function S(e){if(!e.startsWith("squad-"))return;const s=e.slice(6);return x.value.find(t=>t.id===s)}const F=z(()=>r.value.map(e=>{const s=S(e.source);return{...e,squad:s}}));N(async()=>{await Promise.all([g(),w()])});function L(e){var s;return((s=e.squad)==null?void 0:s.name)??e.source}return(e,s)=>(o(),n("div",G,[a("div",R,[s[0]||(s[0]=a("h1",{class:"text-2xl font-bold"},"Feed",-1)),a("div",U,[(o(),n(y,null,b(["all","unread"],t=>a("button",{key:t,onClick:_=>{p.value=t,g()},class:f(["px-3 py-1.5 text-xs rounded-md border transition-colors",p.value===t?"bg-primary text-primary-foreground border-primary":"border-border text-muted-foreground hover:text-foreground"])},v(t==="all"?"All":`Unread (${l.value})`),11,H)),64))])]),m.value?(o(),n("div",J,"Loading...")):r.value.length===0?(o(),n("div",K,[c(i(V),{class:"w-12 h-12 mx-auto mb-3 opacity-50"}),s[1]||(s[1]=a("p",null,"No feed items.",-1))])):(o(),n("div",O,[(o(!0),n(y,null,b(F.value,t=>(o(),n("div",{key:t.id,class:f(["border border-border rounded-lg overflow-hidden",{"border-l-2 border-l-primary":!t.read}])},[a("div",{onClick:_=>I(t.id),class:"flex items-center gap-3 px-4 py-3 cursor-pointer hover:bg-muted/50 transition-colors"},[a("div",X,[a("div",Y,[a("span",{class:f(["text-xs px-2 py-0.5 rounded-full",{"bg-secondary text-secondary-foreground":!t.squad}]),style:B(t.squad?i(W)(t.squad.color):{})},v(L(t)),7),a("span",{class:f(["text-sm font-medium truncate",{"font-bold":!t.read}])},v(t.title),3)]),a("p",Z,v(t.created_at),1)]),a("div",ee,[t.read?q("",!0):(o(),n("button",{key:0,onClick:k(_=>h(t.id),["stop"]),class:"p-1.5 rounded hover:bg-accent text-muted-foreground",title:"Mark as read"},[c(i(E),{class:"w-3.5 h-3.5"})],8,te)),a("button",{onClick:k(_=>$(t.id),["stop"]),class:"p-1.5 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive",title:"Delete"},[c(i(A),{class:"w-3.5 h-3.5"})],8,se)])],8,Q),u.value===t.id?(o(),n("div",ae,[c(j,{content:t.content},null,8,["content"])])):q("",!0)],2))),128))]))]))}});export{ue as default};
@@ -0,0 +1 @@
1
+ import{o as U,Q as q,s as z,u as r,k as n,h as t,n as d,D as c,H as V,T,O as D,M as P,j as x,F as $,w as j,q as p,z as g,v as l,g as Q,i as E,f as G}from"./index-DSAUDIwK.js";import{b as A,a as O}from"./api-DPUP4xY9.js";import{S as R}from"./search-DUqJxRNn.js";import{A as I}from"./arrow-left-BMJZvMdZ.js";import{T as J}from"./trash-2-B9ibnt3n.js";const K={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,Le=U({__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 A(`/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 B(o){u.value=o,_.value=!0;try{b.value=await A(`/history/${o}`)}finally{_.value=!1}}function L(){u.value=null,b.value=[]}async function F(o,e){e.stopPropagation(),confirm("Delete this conversation?")&&(await O(`/history/${o}`),a.value=a.value.filter(i=>i.id!==o),h.value=Math.max(0,h.value-1),u.value===o&&L())}function C(o){return new Date(o).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function H(o,e=100){return o.length>e?o.slice(0,e)+"…":o}const N=Q(()=>a.value.length<h.value);let S=null;return q([f,v,m],()=>{S&&clearTimeout(S),S=setTimeout(()=>k(!0),300)}),z(()=>k(!0)),(o,e)=>{var i;return r(),n("div",K,[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(V),{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(R),{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),[[D,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),[[D,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),[[D,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(P),{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,j(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:M=>B(s.id)},[t("div",ae,[t("p",le,g(H(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:M=>F(s.id,M)},[d(c(J),{class:"w-3.5 h-3.5"})],8,ce)],10,ne))),128)),N.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:L},[d(c(I),{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,j(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(),E(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(V),{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{Le as default};
@@ -0,0 +1 @@
1
+ import{o as b,E as v,u,k as i,h as t,n as y,W as w,T as m,O as p,z as f,j as h,D as g,v as d,_,K as S}from"./index-DSAUDIwK.js";const V={class:"min-h-screen flex items-center justify-center bg-background p-4"},k={class:"w-full max-w-sm space-y-8"},D={class:"text-center"},A={key:0,class:"text-sm text-destructive"},B=["disabled"],L=b({__name:"LoginView",setup(E){const o=v(),c=S(),r=d(""),n=d(""),s=d("");async function x(){s.value="";try{await o.login(r.value,n.value),c.push("/")}catch(l){s.value=l.message??"Login failed"}}return(l,e)=>(u(),i("div",V,[t("div",k,[t("div",D,[y(_,{size:56,class:"mx-auto mb-4"}),e[2]||(e[2]=t("h1",{class:"text-2xl font-bold 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,f(s.value),1)):h("",!0),t("button",{type:"submit",disabled:g(o).loading,class:"btn-gradient w-full py-2.5"},f(g(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};
@@ -0,0 +1 @@
1
+ import{o as k,s as C,u as a,k as n,h as t,n as m,D as p,m as h,T as u,O as v,N as S,j as _,c as V,F as N,w as M,v as i,z as b,q as y}from"./index-DSAUDIwK.js";import{b as P,c as T,d as U,a as $}from"./api-DPUP4xY9.js";import{P as D}from"./plus-aHVgAXQB.js";import{T as j}from"./trash-2-B9ibnt3n.js";const B={class:"p-6"},L={class:"flex items-center justify-between mb-6"},z={key:0,class:"border border-border rounded-lg p-4 mb-6 space-y-3"},A={class:"grid grid-cols-2 gap-3"},F={key:0},q={key:1},E={key:1,class:"text-muted-foreground"},G={key:2,class:"text-center py-12 text-muted-foreground"},O={key:3,class:"space-y-2"},R={class:"font-medium text-sm"},H={class:"ml-2 text-xs text-muted-foreground bg-secondary px-1.5 py-0.5 rounded"},I={class:"flex items-center gap-3"},J=["onClick"],K=["onClick"],ee=k({__name:"McpView",setup(Q){const d=i([]),c=i(!0),r=i(!1),o=i({name:"",type:"stdio",command:"",url:""});C(async()=>{try{d.value=await P("/mcp")}finally{c.value=!1}});async function f(l){await U(`/mcp/${l.id}`,{enabled:!l.enabled}),l.enabled=!l.enabled}async function x(l){await $(`/mcp/${l}`),d.value=d.value.filter(e=>e.id!==l)}async function g(){const l={name:o.value.name,type:o.value.type};o.value.type==="stdio"?l.command=o.value.command:l.url=o.value.url;const e=await T("/mcp",l);d.value.push(e),r.value=!1,o.value={name:"",type:"stdio",command:"",url:""}}return(l,e)=>(a(),n("div",B,[t("div",L,[e[6]||(e[6]=t("h1",{class:"text-2xl font-bold"},"MCP Servers",-1)),t("button",{onClick:e[0]||(e[0]=s=>r.value=!r.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"},[m(p(D),{class:"w-4 h-4"}),e[5]||(e[5]=h(" Add Server ",-1))])]),r.value?(a(),n("div",z,[t("div",A,[t("div",null,[e[7]||(e[7]=t("label",{class:"text-sm font-medium"},"Name",-1)),u(t("input",{"onUpdate:modelValue":e[1]||(e[1]=s=>o.value.name=s),class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},null,512),[[v,o.value.name]])]),t("div",null,[e[9]||(e[9]=t("label",{class:"text-sm font-medium"},"Type",-1)),u(t("select",{"onUpdate:modelValue":e[2]||(e[2]=s=>o.value.type=s),class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},[...e[8]||(e[8]=[t("option",{value:"stdio"},"stdio",-1),t("option",{value:"http"},"http",-1)])],512),[[S,o.value.type]])])]),o.value.type==="stdio"?(a(),n("div",F,[e[10]||(e[10]=t("label",{class:"text-sm font-medium"},"Command",-1)),u(t("input",{"onUpdate:modelValue":e[3]||(e[3]=s=>o.value.command=s),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),[[v,o.value.command]])])):(a(),n("div",q,[e[11]||(e[11]=t("label",{class:"text-sm font-medium"},"URL",-1)),u(t("input",{"onUpdate:modelValue":e[4]||(e[4]=s=>o.value.url=s),placeholder:"https://...",class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},null,512),[[v,o.value.url]])])),t("button",{onClick:g,class:"px-4 py-2 text-sm rounded-md bg-primary text-primary-foreground hover:bg-primary/90"},"Save")])):_("",!0),c.value?(a(),n("div",E,"Loading...")):d.value.length===0?(a(),n("div",G,[m(p(V),{class:"w-12 h-12 mx-auto mb-3 opacity-50"}),e[12]||(e[12]=t("p",null,"No MCP servers configured.",-1))])):(a(),n("div",O,[(a(!0),n(N,null,M(d.value,s=>(a(),n("div",{key:s.id,class:"flex items-center justify-between border border-border rounded-lg px-4 py-3"},[t("div",null,[t("span",R,b(s.name),1),t("span",H,b(s.type),1)]),t("div",I,[t("button",{onClick:w=>f(s),class:y(["relative w-10 h-5 rounded-full transition-colors",s.enabled?"bg-primary":"bg-muted"])},[t("span",{class:y(["absolute top-0.5 w-4 h-4 rounded-full bg-white transition-transform",s.enabled?"translate-x-5":"translate-x-0.5"])},null,2)],10,J),t("button",{onClick:w=>x(s.id),class:"p-1.5 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive"},[m(p(j),{class:"w-4 h-4"})],8,K)])]))),128))]))]))}});export{ee as default};
@@ -1,6 +1,6 @@
1
- import{q as B,t as L,x as j,h as S,z as d,o as r,l as o,s as v,K as p,r as z,F as x,E as y,Y as b,T as h,V as C,n as _,b as E,J as l,D as u,i as T,k as M,v as w,w as O,j as A,g as F}from"./index-CiZnRvN4.js";import{g as G}from"./squad-colors-B8B_Y-lz.js";import{P as J}from"./plus-DIBAaEMT.js";import{T as K}from"./trash-2-CQSzbVIr.js";/**
1
+ import{l as B,o as L,s as O,u as r,k as d,h as o,n as v,D as m,m as j,F as x,w as y,T as b,N as S,O as h,j as _,b as z,z as l,v as u,g as M,q as w,r as A}from"./index-DSAUDIwK.js";import{b as C,c as T,d as E,a as F}from"./api-DPUP4xY9.js";import{g as G}from"./squad-colors-B8B_Y-lz.js";import{P as R}from"./plus-aHVgAXQB.js";import{T as H}from"./trash-2-B9ibnt3n.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 R=B("PlayIcon",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]),Y={class:"p-6"},H={class:"flex items-center justify-between mb-6"},Q={class:"flex gap-1 border-b border-border mb-4"},W=["onClick"],X={key:0,class:"border border-border rounded-lg p-4 mb-4 space-y-3"},Z={class:"grid grid-cols-2 gap-3"},ee=["value"],te=["disabled"],oe={key:1,class:"text-muted-foreground"},se={key:2,class:"text-center py-12 text-muted-foreground"},ae={key:3,class:"space-y-2"},de={class:"text-sm font-medium font-mono"},re={key:0,class:"mt-1"},ne={class:"text-xs text-muted-foreground mt-0.5"},le={class:"text-xs text-muted-foreground mt-0.5"},ue={class:"flex items-center gap-3"},ie=["onClick"],pe={key:0,class:"text-xs text-green-500 font-medium"},me=["onClick"],ce=["onClick"],ye=L({__name:"SchedulesView",setup(ve){const n=u([]),i=u([]),k=u(!0),m=u("squad"),c=u(!1),a=u({type:"squad",cron:"",squad_id:"",prompt:""}),f=u(null);j(async()=>{try{const s=await S("/squads");i.value=s.squads,i.value.length>0&&(a.value.squad_id=i.value[0].id),n.value=await S("/schedules")}finally{k.value=!1}});const q=()=>n.value.filter(s=>s.type===m.value);async function V(){const s={type:a.value.type,cron:a.value.cron,squad_id:a.value.squad_id};if(!a.value.squad_id||!a.value.prompt.trim())return;s.prompt=a.value.prompt;const e=await T("/schedules",s);n.value.push(e),c.value=!1}function P(s){if(s)return i.value.find(e=>e.id===s)}const $=M(()=>q().map(s=>({...s,squad:P(s.squad_id)})));async function N(s){const e=!s.enabled;await A(`/schedules/${s.id}`,{enabled:e}),s.enabled=e?1:0}async function D(s){await F(`/schedules/${s}`),n.value=n.value.filter(e=>e.id!==s)}async function I(s){await T(`/schedules/${s.id}/trigger`,{}),f.value=s.id;const e=n.value.findIndex(t=>t.id===s.id);e!==-1&&(n.value[e]={...n.value[e],last_run:new Date().toISOString()}),setTimeout(()=>{f.value=null},3e3)}function U(s){var e;return s?((e=i.value.find(t=>t.id===s))==null?void 0:e.name)??s:"Unknown squad"}return(s,e)=>(d(),r("div",Y,[o("div",H,[e[6]||(e[6]=o("h1",{class:"text-2xl font-bold"},"Schedules",-1)),o("button",{onClick:e[0]||(e[0]=t=>c.value=!c.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"},[v(p(J),{class:"w-4 h-4"}),e[5]||(e[5]=z(" Add Schedule ",-1))])]),o("div",Q,[(d(),r(x,null,y(["squad","io"],t=>o("button",{key:t,onClick:g=>m.value=t,class:w(["px-4 py-2 text-sm font-medium border-b-2 transition-colors",m.value===t?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"])},l(t==="squad"?"Squad Schedules":"IO Schedules"),11,W)),64))]),c.value?(d(),r("div",X,[o("div",Z,[o("div",null,[e[8]||(e[8]=o("label",{class:"text-sm font-medium"},"Type",-1)),b(o("select",{"onUpdate:modelValue":e[1]||(e[1]=t=>a.value.type=t),class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},[...e[7]||(e[7]=[o("option",{value:"squad"},"Squad",-1),o("option",{value:"io"},"IO",-1)])],512),[[h,a.value.type]])]),o("div",null,[e[9]||(e[9]=o("label",{class:"text-sm font-medium"},"Cron Expression",-1)),b(o("input",{"onUpdate:modelValue":e[2]||(e[2]=t=>a.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),[[C,a.value.cron]])])]),o("div",null,[e[10]||(e[10]=o("label",{class:"text-sm font-medium"},"Target Squad",-1)),b(o("select",{"onUpdate:modelValue":e[3]||(e[3]=t=>a.value.squad_id=t),class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},[(d(!0),r(x,null,y(i.value,t=>(d(),r("option",{key:t.id,value:t.id},l(t.name),9,ee))),128))],512),[[h,a.value.squad_id]])]),o("div",null,[e[11]||(e[11]=o("label",{class:"text-sm font-medium"},"Prompt",-1)),b(o("textarea",{"onUpdate:modelValue":e[4]||(e[4]=t=>a.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),[[C,a.value.prompt]])]),o("button",{onClick:V,disabled:!a.value.squad_id||!a.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,te)])):_("",!0),k.value?(d(),r("div",oe,"Loading...")):q().length===0?(d(),r("div",se,[v(p(E),{class:"w-12 h-12 mx-auto mb-3 opacity-50"}),o("p",null,"No "+l(m.value)+" schedules configured.",1)])):(d(),r("div",ae,[(d(!0),r(x,null,y($.value,t=>(d(),r("div",{key:t.id,class:"flex items-center justify-between border border-border rounded-lg px-4 py-3"},[o("div",null,[o("div",de,l(t.cron),1),t.squad?(d(),r("div",re,[o("span",{class:"text-xs px-2 py-0.5 rounded-full",style:O(p(G)(t.squad.color))},l(t.squad.name),5)])):_("",!0),o("div",ne,l(t.prompt?t.prompt.slice(0,80):"(no prompt)"),1),o("div",le," Squad: "+l(U(t.squad_id)),1)]),o("div",ue,[o("button",{onClick:g=>I(t),class:"p-1.5 rounded hover:bg-primary/10 text-muted-foreground hover:text-primary",title:"Trigger now"},[v(p(R),{class:"w-4 h-4"})],8,ie),f.value===t.id?(d(),r("span",pe,"Triggered!")):_("",!0),o("button",{onClick:g=>N(t),class:w(["relative w-10 h-5 rounded-full transition-colors",t.enabled?"bg-primary":"bg-muted"])},[o("span",{class:w(["absolute top-0.5 w-4 h-4 rounded-full bg-white transition-transform",t.enabled?"translate-x-5":"translate-x-0.5"])},null,2)],10,me),o("button",{onClick:g=>D(t.id),class:"p-1.5 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive"},[v(p(K),{class:"w-4 h-4"})],8,ce)])]))),128))]))]))}});export{ye as default};
6
+ */const J=B("PlayIcon",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]),K={class:"p-6"},Q={class:"flex items-center justify-between mb-6"},W={class:"flex gap-1 border-b border-border mb-4"},X=["onClick"],Y={key:0,class:"border border-border rounded-lg p-4 mb-4 space-y-3"},Z={class:"grid grid-cols-2 gap-3"},ee=["value"],te=["disabled"],oe={key:1,class:"text-muted-foreground"},se={key:2,class:"text-center py-12 text-muted-foreground"},ae={key:3,class:"space-y-2"},re={class:"text-sm font-medium font-mono"},de={key:0,class:"mt-1"},ne={class:"text-xs text-muted-foreground mt-0.5"},le={class:"text-xs text-muted-foreground mt-0.5"},ue={class:"flex items-center gap-3"},ie=["onClick"],me={key:0,class:"text-xs text-green-500 font-medium"},pe=["onClick"],ce=["onClick"],_e=L({__name:"SchedulesView",setup(ve){const n=u([]),i=u([]),k=u(!0),p=u("squad"),c=u(!1),a=u({type:"squad",cron:"",squad_id:"",prompt:""}),f=u(null);O(async()=>{try{const s=await C("/squads");i.value=s.squads,i.value.length>0&&(a.value.squad_id=i.value[0].id),n.value=await C("/schedules")}finally{k.value=!1}});const q=()=>n.value.filter(s=>s.type===p.value);async function V(){const s={type:a.value.type,cron:a.value.cron,squad_id:a.value.squad_id};if(!a.value.squad_id||!a.value.prompt.trim())return;s.prompt=a.value.prompt;const e=await T("/schedules",s);n.value.push(e),c.value=!1}function N(s){if(s)return i.value.find(e=>e.id===s)}const P=M(()=>q().map(s=>({...s,squad:N(s.squad_id)})));async function $(s){const e=!s.enabled;await E(`/schedules/${s.id}`,{enabled:e}),s.enabled=e?1:0}async function D(s){await F(`/schedules/${s}`),n.value=n.value.filter(e=>e.id!==s)}async function I(s){await T(`/schedules/${s.id}/trigger`,{}),f.value=s.id;const e=n.value.findIndex(t=>t.id===s.id);e!==-1&&(n.value[e]={...n.value[e],last_run:new Date().toISOString()}),setTimeout(()=>{f.value=null},3e3)}function U(s){var e;return s?((e=i.value.find(t=>t.id===s))==null?void 0:e.name)??s:"Unknown squad"}return(s,e)=>(r(),d("div",K,[o("div",Q,[e[6]||(e[6]=o("h1",{class:"text-2xl font-bold"},"Schedules",-1)),o("button",{onClick:e[0]||(e[0]=t=>c.value=!c.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"},[v(m(R),{class:"w-4 h-4"}),e[5]||(e[5]=j(" Add Schedule ",-1))])]),o("div",W,[(r(),d(x,null,y(["squad","io"],t=>o("button",{key:t,onClick:g=>p.value=t,class:w(["px-4 py-2 text-sm font-medium border-b-2 transition-colors",p.value===t?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"])},l(t==="squad"?"Squad Schedules":"IO Schedules"),11,X)),64))]),c.value?(r(),d("div",Y,[o("div",Z,[o("div",null,[e[8]||(e[8]=o("label",{class:"text-sm font-medium"},"Type",-1)),b(o("select",{"onUpdate:modelValue":e[1]||(e[1]=t=>a.value.type=t),class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},[...e[7]||(e[7]=[o("option",{value:"squad"},"Squad",-1),o("option",{value:"io"},"IO",-1)])],512),[[S,a.value.type]])]),o("div",null,[e[9]||(e[9]=o("label",{class:"text-sm font-medium"},"Cron Expression",-1)),b(o("input",{"onUpdate:modelValue":e[2]||(e[2]=t=>a.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),[[h,a.value.cron]])])]),o("div",null,[e[10]||(e[10]=o("label",{class:"text-sm font-medium"},"Target Squad",-1)),b(o("select",{"onUpdate:modelValue":e[3]||(e[3]=t=>a.value.squad_id=t),class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},[(r(!0),d(x,null,y(i.value,t=>(r(),d("option",{key:t.id,value:t.id},l(t.name),9,ee))),128))],512),[[S,a.value.squad_id]])]),o("div",null,[e[11]||(e[11]=o("label",{class:"text-sm font-medium"},"Prompt",-1)),b(o("textarea",{"onUpdate:modelValue":e[4]||(e[4]=t=>a.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),[[h,a.value.prompt]])]),o("button",{onClick:V,disabled:!a.value.squad_id||!a.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,te)])):_("",!0),k.value?(r(),d("div",oe,"Loading...")):q().length===0?(r(),d("div",se,[v(m(z),{class:"w-12 h-12 mx-auto mb-3 opacity-50"}),o("p",null,"No "+l(p.value)+" schedules configured.",1)])):(r(),d("div",ae,[(r(!0),d(x,null,y(P.value,t=>(r(),d("div",{key:t.id,class:"flex items-center justify-between border border-border rounded-lg px-4 py-3"},[o("div",null,[o("div",re,l(t.cron),1),t.squad?(r(),d("div",de,[o("span",{class:"text-xs px-2 py-0.5 rounded-full",style:A(m(G)(t.squad.color))},l(t.squad.name),5)])):_("",!0),o("div",ne,l(t.prompt?t.prompt.slice(0,80):"(no prompt)"),1),o("div",le," Squad: "+l(U(t.squad_id)),1)]),o("div",ue,[o("button",{onClick:g=>I(t),class:"p-1.5 rounded hover:bg-primary/10 text-muted-foreground hover:text-primary",title:"Trigger now"},[v(m(J),{class:"w-4 h-4"})],8,ie),f.value===t.id?(r(),d("span",me,"Triggered!")):_("",!0),o("button",{onClick:g=>$(t),class:w(["relative w-10 h-5 rounded-full transition-colors",t.enabled?"bg-primary":"bg-muted"])},[o("span",{class:w(["absolute top-0.5 w-4 h-4 rounded-full bg-white transition-transform",t.enabled?"translate-x-5":"translate-x-0.5"])},null,2)],10,pe),o("button",{onClick:g=>D(t.id),class:"p-1.5 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive"},[v(m(H),{class:"w-4 h-4"})],8,ce)])]))),128))]))]))}});export{_e as default};
@@ -0,0 +1 @@
1
+ import{o as w,s as E,u as d,k as s,h as t,z as g,F as x,w as U,T as a,O as n,N as T,L as p,j as b,v as r,q as M}from"./index-DSAUDIwK.js";import{b as V,d as S}from"./api-DPUP4xY9.js";const z={class:"p-6"},A={class:"flex items-center justify-between mb-6"},N=["disabled"],B={key:0,class:"text-muted-foreground"},C={class:"flex gap-1 border-b border-border mb-6"},I=["onClick"],D={key:0,class:"space-y-4 max-w-lg"},K={class:"flex items-center gap-3"},L={key:1,class:"space-y-4 max-w-lg"},j={class:"flex items-center gap-3"},O={key:2,class:"space-y-4 max-w-lg"},q={key:3,class:"space-y-4 max-w-lg"},F={class:"flex items-center gap-3"},G={class:"flex items-center gap-3"},H=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"}],o=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");o.value=v}finally{f.value=!1}}async function c(){i.value=!0,m.value=!1;try{await S("/settings",o.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,N)]),f.value?(d(),s("div",B,"Loading...")):(d(),s(x,{key:1},[t("div",C,[(d(),s(x,null,U(y,l=>t("button",{key:l.id,onClick:R=>u.value=l.id,class:M(["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",D,[t("div",null,[e[13]||(e[13]=t("label",{class:"text-sm font-medium"},"Default Model",-1)),a(t("input",{"onUpdate:modelValue":e[0]||(e[0]=l=>o.value.defaultModel=l),class:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"},null,512),[[n,o.value.defaultModel]])]),t("div",null,[e[14]||(e[14]=t("label",{class:"text-sm font-medium"},"Port",-1)),a(t("input",{"onUpdate:modelValue":e[1]||(e[1]=l=>o.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,o.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)),a(t("select",{"onUpdate:modelValue":e[2]||(e[2]=l=>o.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),[[T,o.value.backgroundNotifyMode]])]),t("div",K,[a(t("input",{"onUpdate:modelValue":e[3]||(e[3]=l=>o.value.backgroundNotifyTelegram=l),type:"checkbox",id:"notifyTelegram",class:"rounded"},null,512),[[p,o.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)),a(t("input",{"onUpdate:modelValue":e[4]||(e[4]=l=>o.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,o.value.telegramBotToken]])]),t("div",null,[e[20]||(e[20]=t("label",{class:"text-sm font-medium"},"Authorized User ID",-1)),a(t("input",{"onUpdate:modelValue":e[5]||(e[5]=l=>o.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,o.value.authorizedUserId,void 0,{number:!0}]])]),t("div",j,[a(t("input",{"onUpdate:modelValue":e[6]||(e[6]=l=>o.value.telegramEnabled=l),type:"checkbox",id:"telegramEnabled",class:"rounded"},null,512),[[p,o.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",O,[t("div",null,[e[22]||(e[22]=t("label",{class:"text-sm font-medium"},"Supabase URL",-1)),a(t("input",{"onUpdate:modelValue":e[7]||(e[7]=l=>o.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,o.value.supabaseUrl]])]),t("div",null,[e[23]||(e[23]=t("label",{class:"text-sm font-medium"},"Supabase Anon Key",-1)),a(t("input",{"onUpdate:modelValue":e[8]||(e[8]=l=>o.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,o.value.supabaseAnonKey]])]),t("div",null,[e[24]||(e[24]=t("label",{class:"text-sm font-medium"},"Authorized Email",-1)),a(t("input",{"onUpdate:modelValue":e[9]||(e[9]=l=>o.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,o.value.authorizedEmail]])])])):b("",!0),u.value==="advanced"?(d(),s("div",q,[t("div",F,[a(t("input",{"onUpdate:modelValue":e[10]||(e[10]=l=>o.value.selfEditEnabled=l),type:"checkbox",id:"selfEdit",class:"rounded"},null,512),[[p,o.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",G,[a(t("input",{"onUpdate:modelValue":e[11]||(e[11]=l=>o.value.watchdogEnabled=l),type:"checkbox",id:"watchdog",class:"rounded"},null,512),[[p,o.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{H as default};
@@ -1,15 +1,15 @@
1
- import{q as fe,t as me,x as xe,z as l,o as a,l as t,v as j,s as u,K as d,r as q,F as p,Y as C,V as M,Z as ee,J as r,n as S,P as te,E as se,T as ge,m as le,f as oe,D as n,k as ye,h as z,i as J,j as be,$ as ae,g as ke}from"./index-CiZnRvN4.js";import{P as ne}from"./plus-DIBAaEMT.js";import{S as he}from"./search-Cl8HcIsG.js";import{P as _e,S as we}from"./save-Chqlu7QA.js";import{X as Ce}from"./x-DThJHYFm.js";import{T as Se}from"./trash-2-CQSzbVIr.js";/**
1
+ import{l as fe,o as me,s as xe,u as o,k as a,h as t,q as E,n as u,D as d,m as q,F as p,T as C,O as M,V as ee,z as r,j as S,P as te,w as se,N as ge,i as oe,f as le,v as n,g as ye,W as ae}from"./index-DSAUDIwK.js";import{b as z,c as O,d as be,a as ke}from"./api-DPUP4xY9.js";import{P as ne}from"./plus-aHVgAXQB.js";import{S as he}from"./search-DUqJxRNn.js";import{P as _e,S as we}from"./save-jn5LGsCv.js";import{X as Ce}from"./x-BDIsved4.js";import{T as Se}from"./trash-2-B9ibnt3n.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 Q=fe("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"}]]),$e={class:"flex h-full"},Ie={class:"w-72 border-r border-border flex flex-col shrink-0"},Le={class:"flex border-b border-border"},Fe={class:"p-3 border-b border-border space-y-2"},Me={class:"flex gap-1"},Ve={key:0,class:"space-y-1.5"},De={class:"flex gap-1"},Te=["disabled"],Ue={key:1,class:"space-y-1.5"},Ee={key:0,class:"mt-0.5 text-xs text-muted-foreground font-mono"},Pe={class:"flex gap-1"},je=["disabled"],ze={class:"flex-1 overflow-y-auto p-2"},Ne={key:0,class:"text-xs text-muted-foreground p-2"},Ae={key:1,class:"text-center py-8 text-muted-foreground"},Ke=["onClick"],Ge={class:"min-w-0 flex-1"},Be={class:"font-medium truncate"},Re={class:"text-muted-foreground truncate"},qe=["onClick"],Je={class:"p-3 border-b border-border space-y-2"},Qe={class:"relative"},Xe=["disabled"],Ye={class:"flex-1 overflow-y-auto p-2"},Ze={key:0,class:"text-xs text-muted-foreground p-2"},He={key:1,class:"text-xs text-destructive p-2"},Oe={key:2,class:"text-center py-8 text-muted-foreground"},We=["onClick"],et={class:"min-w-0 flex-1"},tt={class:"font-medium truncate"},st=["title"],lt=["onClick","disabled"],ot={key:1,class:"shrink-0 mt-0.5 px-1.5 py-0.5 text-xs rounded bg-muted text-muted-foreground"},at={class:"flex-1 flex flex-col"},nt={key:0,class:"flex items-center justify-center h-full text-muted-foreground"},rt={class:"text-center"},it={class:"flex items-center justify-between px-4 py-2 border-b border-border"},ut={class:"text-sm font-medium"},dt={class:"text-xs text-muted-foreground ml-2 font-mono"},ct={class:"flex gap-1"},vt={class:"flex-1 overflow-y-auto p-4"},pt={key:0,class:"text-muted-foreground text-sm"},ft={key:0,class:"flex items-center justify-center h-full text-muted-foreground"},mt={class:"text-center"},xt={class:"flex items-center justify-between px-4 py-2 border-b border-border"},gt={class:"min-w-0 flex-1"},yt={class:"text-sm font-medium"},bt={class:"text-xs text-muted-foreground ml-2"},kt=["disabled"],ht={key:1,class:"ml-2 shrink-0 px-3 py-1 text-xs rounded bg-muted text-muted-foreground"},_t={class:"flex-1 overflow-y-auto p-4"},wt={key:0,class:"text-muted-foreground text-sm"},Ct={key:0,class:"absolute bottom-4 left-4 text-sm text-destructive bg-background border border-destructive/30 px-3 py-2 rounded-md"},re=`# My Skill
6
+ */const Q=fe("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"}]]),$e={class:"flex h-full"},Ie={class:"w-72 border-r border-border flex flex-col shrink-0"},Le={class:"flex border-b border-border"},Fe={class:"p-3 border-b border-border space-y-2"},Me={class:"flex gap-1"},Ve={key:0,class:"space-y-1.5"},De={class:"flex gap-1"},Te=["disabled"],Ue={key:1,class:"space-y-1.5"},Pe={key:0,class:"mt-0.5 text-xs text-muted-foreground font-mono"},je={class:"flex gap-1"},Ee=["disabled"],ze={class:"flex-1 overflow-y-auto p-2"},Ne={key:0,class:"text-xs text-muted-foreground p-2"},Ae={key:1,class:"text-center py-8 text-muted-foreground"},Ge=["onClick"],Ke={class:"min-w-0 flex-1"},Be={class:"font-medium truncate"},Re={class:"text-muted-foreground truncate"},qe=["onClick"],Oe={class:"p-3 border-b border-border space-y-2"},Qe={class:"relative"},We=["disabled"],Xe={class:"flex-1 overflow-y-auto p-2"},He={key:0,class:"text-xs text-muted-foreground p-2"},Je={key:1,class:"text-xs text-destructive p-2"},Ye={key:2,class:"text-center py-8 text-muted-foreground"},Ze=["onClick"],et={class:"min-w-0 flex-1"},tt={class:"font-medium truncate"},st=["title"],ot=["onClick","disabled"],lt={key:1,class:"shrink-0 mt-0.5 px-1.5 py-0.5 text-xs rounded bg-muted text-muted-foreground"},at={class:"flex-1 flex flex-col"},nt={key:0,class:"flex items-center justify-center h-full text-muted-foreground"},rt={class:"text-center"},it={class:"flex items-center justify-between px-4 py-2 border-b border-border"},ut={class:"text-sm font-medium"},dt={class:"text-xs text-muted-foreground ml-2 font-mono"},ct={class:"flex gap-1"},vt={class:"flex-1 overflow-y-auto p-4"},pt={key:0,class:"text-muted-foreground text-sm"},ft={key:0,class:"flex items-center justify-center h-full text-muted-foreground"},mt={class:"text-center"},xt={class:"flex items-center justify-between px-4 py-2 border-b border-border"},gt={class:"min-w-0 flex-1"},yt={class:"text-sm font-medium"},bt={class:"text-xs text-muted-foreground ml-2"},kt=["disabled"],ht={key:1,class:"ml-2 shrink-0 px-3 py-1 text-xs rounded bg-muted text-muted-foreground"},_t={class:"flex-1 overflow-y-auto p-4"},wt={key:0,class:"text-muted-foreground text-sm"},Ct={key:0,class:"absolute bottom-4 left-4 text-sm text-destructive bg-background border border-destructive/30 px-3 py-2 rounded-md"},re=`# My Skill
7
7
 
8
8
  A brief description of what this skill does.
9
9
 
10
10
  ## Usage
11
11
 
12
12
  Instructions for how to use this skill...
13
- `,Dt=me({__name:"SkillsView",setup(St){const V=n([]),N=n(!0),D=n(!1),A=n("git"),g=n(""),m=n(""),y=n(re),f=n(!1),i=n(""),X=ye(()=>m.value.trim().replace(/[^a-z0-9-]/gi,"-").toLowerCase().replace(/-+/g,"-").replace(/^-|-$/g,"")),v=n(null),x=n(""),b=n(!1),$=n(""),K=n(!1),k=n("installed"),G=n("awesome-copilot"),T=n(""),I=n([]),L=n(!1),U=n(""),c=n(null),h=n(""),B=n(!1),_=n("");async function w(){N.value=!0;try{V.value=await z("/skills")}finally{N.value=!1}}function Y(o){A.value=o,D.value=!0,i.value=""}function E(){D.value=!1,g.value="",m.value="",y.value=re,i.value=""}async function Z(){if(g.value.trim()){f.value=!0,i.value="";try{await J("/skills",{url:g.value.trim()}),E(),await w()}catch(o){i.value=o.message||"Failed to install skill"}finally{f.value=!1}}}async function ie(){if(!(!m.value.trim()||!y.value.trim())){f.value=!0,i.value="";try{await J("/skills",{slug:X.value,content:y.value}),E(),await w()}catch(o){i.value=o.message||"Failed to create skill"}finally{f.value=!1}}}async function ue(o){var e;try{await ke(`/skills/${o}`),((e=v.value)==null?void 0:e.slug)===o&&(v.value=null,x.value=""),await w()}catch(s){i.value=s.message||"Failed to remove skill"}}async function de(o){v.value=o,b.value=!1,K.value=!0;try{const e=await z(`/skills/${o.slug}/content`);x.value=e.content}catch(e){x.value=`Error loading skill: ${e.message}`}finally{K.value=!1}}function ce(){$.value=x.value,b.value=!0}async function ve(){if(v.value)try{await be(`/skills/${v.value.slug}/content`,{content:$.value}),x.value=$.value,b.value=!1,await w()}catch(o){i.value=o.message||"Failed to save skill"}}async function P(){L.value=!0,U.value="",c.value=null,h.value="";try{const o=new URLSearchParams({source:G.value});T.value.trim()&&o.set("q",T.value.trim()),I.value=await z(`/skills/discover?${o}`)}catch(o){U.value=o.message||"Failed to fetch community skills",I.value=[]}finally{L.value=!1}}async function pe(o){c.value=o,B.value=!0,h.value="";try{const e=await z(`/skills/preview?source=${o.source}&slug=${encodeURIComponent(o.slug)}`);h.value=e.content}catch(e){h.value=`Error loading preview: ${e.message}`}finally{B.value=!1}}async function H(o){_.value=o.slug,i.value="";try{await J("/skills",{source:o.source,slug:o.slug}),await w(),k.value="installed"}catch(e){i.value=e.message||"Failed to install skill"}finally{_.value=""}}function O(o){return V.value.some(e=>e.slug===o)}function W(o){k.value=o,v.value=null,c.value=null,x.value="",h.value="",o==="discover"&&I.value.length===0&&P()}return xe(w),(o,e)=>(l(),a("div",$e,[t("div",Ie,[t("div",Le,[t("button",{onClick:e[0]||(e[0]=s=>W("installed")),class:j(["flex-1 px-3 py-2 text-xs font-medium transition-colors",k.value==="installed"?"border-b-2 border-primary text-primary":"text-muted-foreground hover:text-foreground"])}," Installed ",2),t("button",{onClick:e[1]||(e[1]=s=>W("discover")),class:j(["flex-1 px-3 py-2 text-xs font-medium transition-colors",k.value==="discover"?"border-b-2 border-primary text-primary":"text-muted-foreground hover:text-foreground"])},[u(d(Q),{class:"w-3 h-3 inline mr-1"}),e[12]||(e[12]=q(" Discover ",-1))],2)]),k.value==="installed"?(l(),a(p,{key:0},[t("div",Fe,[t("div",Me,[t("button",{onClick:e[2]||(e[2]=s=>Y("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"},[u(d(ne),{class:"w-3.5 h-3.5"}),e[13]||(e[13]=q(" From Git ",-1))]),t("button",{onClick:e[3]||(e[3]=s=>Y("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"},[u(d(ne),{class:"w-3.5 h-3.5"}),e[14]||(e[14]=q(" Create New ",-1))])]),D.value&&A.value==="git"?(l(),a("div",Ve,[C(t("input",{"onUpdate:modelValue":e[4]||(e[4]=s=>g.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:ee(Z,["enter"])},null,544),[[M,g.value]]),t("div",De,[t("button",{onClick:Z,disabled:f.value||!g.value.trim(),class:"flex-1 px-2 py-1 text-xs rounded bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50"},r(f.value?"Installing...":"Install"),9,Te),t("button",{onClick:E,class:"px-2 py-1 text-xs rounded border border-border hover:bg-accent"}," Cancel ")])])):S("",!0),D.value&&A.value==="create"?(l(),a("div",Ue,[t("div",null,[C(t("input",{"onUpdate:modelValue":e[5]||(e[5]=s=>m.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),[[M,m.value]]),m.value.trim()?(l(),a("p",Ee," slug: "+r(X.value),1)):S("",!0)]),C(t("textarea",{"onUpdate:modelValue":e[6]||(e[6]=s=>y.value=s),rows:"8",placeholder:`# My Skill
13
+ `,Tt=me({__name:"SkillsView",setup(St){const V=n([]),N=n(!0),D=n(!1),A=n("git"),g=n(""),m=n(""),y=n(re),f=n(!1),i=n(""),W=ye(()=>m.value.trim().replace(/[^a-z0-9-]/gi,"-").toLowerCase().replace(/-+/g,"-").replace(/^-|-$/g,"")),v=n(null),x=n(""),b=n(!1),$=n(""),G=n(!1),k=n("installed"),K=n("awesome-copilot"),T=n(""),I=n([]),L=n(!1),U=n(""),c=n(null),h=n(""),B=n(!1),_=n("");async function w(){N.value=!0;try{V.value=await z("/skills")}finally{N.value=!1}}function X(l){A.value=l,D.value=!0,i.value=""}function P(){D.value=!1,g.value="",m.value="",y.value=re,i.value=""}async function H(){if(g.value.trim()){f.value=!0,i.value="";try{await O("/skills",{url:g.value.trim()}),P(),await w()}catch(l){i.value=l.message||"Failed to install skill"}finally{f.value=!1}}}async function ie(){if(!(!m.value.trim()||!y.value.trim())){f.value=!0,i.value="";try{await O("/skills",{slug:W.value,content:y.value}),P(),await w()}catch(l){i.value=l.message||"Failed to create skill"}finally{f.value=!1}}}async function ue(l){var e;try{await ke(`/skills/${l}`),((e=v.value)==null?void 0:e.slug)===l&&(v.value=null,x.value=""),await w()}catch(s){i.value=s.message||"Failed to remove skill"}}async function de(l){v.value=l,b.value=!1,G.value=!0;try{const e=await z(`/skills/${l.slug}/content`);x.value=e.content}catch(e){x.value=`Error loading skill: ${e.message}`}finally{G.value=!1}}function ce(){$.value=x.value,b.value=!0}async function ve(){if(v.value)try{await be(`/skills/${v.value.slug}/content`,{content:$.value}),x.value=$.value,b.value=!1,await w()}catch(l){i.value=l.message||"Failed to save skill"}}async function j(){L.value=!0,U.value="",c.value=null,h.value="";try{const l=new URLSearchParams({source:K.value});T.value.trim()&&l.set("q",T.value.trim()),I.value=await z(`/skills/discover?${l}`)}catch(l){U.value=l.message||"Failed to fetch community skills",I.value=[]}finally{L.value=!1}}async function pe(l){c.value=l,B.value=!0,h.value="";try{const e=await z(`/skills/preview?source=${l.source}&slug=${encodeURIComponent(l.slug)}`);h.value=e.content}catch(e){h.value=`Error loading preview: ${e.message}`}finally{B.value=!1}}async function J(l){_.value=l.slug,i.value="";try{await O("/skills",{source:l.source,slug:l.slug}),await w(),k.value="installed"}catch(e){i.value=e.message||"Failed to install skill"}finally{_.value=""}}function Y(l){return V.value.some(e=>e.slug===l)}function Z(l){k.value=l,v.value=null,c.value=null,x.value="",h.value="",l==="discover"&&I.value.length===0&&j()}return xe(w),(l,e)=>(o(),a("div",$e,[t("div",Ie,[t("div",Le,[t("button",{onClick:e[0]||(e[0]=s=>Z("installed")),class:E(["flex-1 px-3 py-2 text-xs font-medium transition-colors",k.value==="installed"?"border-b-2 border-primary text-primary":"text-muted-foreground hover:text-foreground"])}," Installed ",2),t("button",{onClick:e[1]||(e[1]=s=>Z("discover")),class:E(["flex-1 px-3 py-2 text-xs font-medium transition-colors",k.value==="discover"?"border-b-2 border-primary text-primary":"text-muted-foreground hover:text-foreground"])},[u(d(Q),{class:"w-3 h-3 inline mr-1"}),e[12]||(e[12]=q(" Discover ",-1))],2)]),k.value==="installed"?(o(),a(p,{key:0},[t("div",Fe,[t("div",Me,[t("button",{onClick:e[2]||(e[2]=s=>X("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"},[u(d(ne),{class:"w-3.5 h-3.5"}),e[13]||(e[13]=q(" From Git ",-1))]),t("button",{onClick:e[3]||(e[3]=s=>X("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"},[u(d(ne),{class:"w-3.5 h-3.5"}),e[14]||(e[14]=q(" Create New ",-1))])]),D.value&&A.value==="git"?(o(),a("div",Ve,[C(t("input",{"onUpdate:modelValue":e[4]||(e[4]=s=>g.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:ee(H,["enter"])},null,544),[[M,g.value]]),t("div",De,[t("button",{onClick:H,disabled:f.value||!g.value.trim(),class:"flex-1 px-2 py-1 text-xs rounded bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50"},r(f.value?"Installing...":"Install"),9,Te),t("button",{onClick:P,class:"px-2 py-1 text-xs rounded border border-border hover:bg-accent"}," Cancel ")])])):S("",!0),D.value&&A.value==="create"?(o(),a("div",Ue,[t("div",null,[C(t("input",{"onUpdate:modelValue":e[5]||(e[5]=s=>m.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),[[M,m.value]]),m.value.trim()?(o(),a("p",Pe," slug: "+r(W.value),1)):S("",!0)]),C(t("textarea",{"onUpdate:modelValue":e[6]||(e[6]=s=>y.value=s),rows:"8",placeholder:`# My Skill
14
14
 
15
- 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),[[M,y.value]]),t("div",Pe,[t("button",{onClick:ie,disabled:f.value||!m.value.trim()||!y.value.trim(),class:"flex-1 px-2 py-1 text-xs rounded bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50"},r(f.value?"Creating...":"Create"),9,je),t("button",{onClick:E,class:"px-2 py-1 text-xs rounded border border-border hover:bg-accent"}," Cancel ")])])):S("",!0)]),t("div",ze,[N.value?(l(),a("div",Ne,"Loading...")):V.value.length===0?(l(),a("div",Ae,[u(d(te),{class:"w-8 h-8 mx-auto mb-2 opacity-50"}),e[15]||(e[15]=t("p",{class:"text-xs"},"No skills installed.",-1))])):S("",!0),(l(!0),a(p,null,se(V.value,s=>{var F;return l(),a("div",{key:s.slug,onClick:R=>de(s),class:j(["flex items-center justify-between px-2 py-2 text-xs rounded cursor-pointer hover:bg-accent transition-colors group",{"bg-accent font-medium":((F=v.value)==null?void 0:F.slug)===s.slug}])},[t("div",Ge,[t("div",Be,r(s.name),1),t("div",Re,r(s.slug),1)]),t("button",{onClick:ae(R=>ue(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"},[u(d(Se),{class:"w-3.5 h-3.5"})],8,qe)],10,Ke)}),128))])],64)):(l(),a(p,{key:1},[t("div",Je,[C(t("select",{"onUpdate:modelValue":e[7]||(e[7]=s=>G.value=s),onChange:P,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"},[...e[16]||(e[16]=[t("option",{value:"awesome-copilot"},"awesome-copilot",-1),t("option",{value:"skillssh"},"skills.sh",-1)])],544),[[ge,G.value]]),t("div",Qe,[u(d(he),{class:"absolute left-2 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground"}),C(t("input",{"onUpdate:modelValue":e[8]||(e[8]=s=>T.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:ee(P,["enter"])},null,544),[[M,T.value]])]),t("button",{onClick:P,disabled:L.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"},r(L.value?"Searching...":"Search"),9,Xe)]),t("div",Ye,[L.value?(l(),a("div",Ze,"Loading...")):U.value?(l(),a("div",He,r(U.value),1)):I.value.length===0?(l(),a("div",Oe,[u(d(Q),{class:"w-8 h-8 mx-auto mb-2 opacity-50"}),e[17]||(e[17]=t("p",{class:"text-xs"},"No skills found.",-1))])):S("",!0),(l(!0),a(p,null,se(I.value,s=>{var F;return l(),a("div",{key:s.slug,onClick:R=>pe(s),class:j(["flex items-start justify-between px-2 py-2 text-xs rounded cursor-pointer hover:bg-accent transition-colors gap-1",{"bg-accent":((F=c.value)==null?void 0:F.slug)===s.slug}])},[t("div",et,[t("div",tt,r(s.slug),1),t("div",{class:"text-muted-foreground line-clamp-2 mt-0.5",title:s.description},r(s.description),9,st)]),O(s.slug)?(l(),a("span",ot," Installed ")):(l(),a("button",{key:0,onClick:ae(R=>H(s),["stop"]),disabled:_.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"},r(_.value===s.slug?"...":"Install"),9,lt))],10,We)}),128))])],64))]),t("div",at,[k.value==="installed"?(l(),a(p,{key:0},[v.value?(l(),a(p,{key:1},[t("div",it,[t("div",null,[t("span",ut,r(v.value.name),1),t("span",dt,r(v.value.slug)+"/SKILL.md",1)]),t("div",ct,[b.value?(l(),a(p,{key:1},[t("button",{onClick:ve,class:"p-1.5 rounded hover:bg-accent text-green-500",title:"Save"},[u(d(we),{class:"w-4 h-4"})]),t("button",{onClick:e[9]||(e[9]=s=>b.value=!1),class:"p-1.5 rounded hover:bg-accent text-muted-foreground",title:"Cancel"},[u(d(Ce),{class:"w-4 h-4"})])],64)):(l(),a("button",{key:0,onClick:ce,class:"p-1.5 rounded hover:bg-accent text-muted-foreground",title:"Edit"},[u(d(_e),{class:"w-4 h-4"})]))])]),t("div",vt,[K.value?(l(),a("div",pt,"Loading...")):b.value?C((l(),a("textarea",{key:1,"onUpdate:modelValue":e[10]||(e[10]=s=>$.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)),[[M,$.value]]):(l(),le(oe,{key:2,content:x.value},null,8,["content"]))])],64)):(l(),a("div",nt,[t("div",rt,[u(d(te),{class:"w-12 h-12 mx-auto mb-3 opacity-50"}),e[18]||(e[18]=t("p",null,"Select a skill to view",-1))])]))],64)):(l(),a(p,{key:1},[c.value?(l(),a(p,{key:1},[t("div",xt,[t("div",gt,[t("span",yt,r(c.value.slug),1),t("span",bt,r(c.value.source),1)]),O(c.value.slug)?(l(),a("span",ht," Installed ")):(l(),a("button",{key:0,onClick:e[11]||(e[11]=s=>H(c.value)),disabled:_.value===c.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"},r(_.value===c.value.slug?"Installing...":"Install"),9,kt))]),t("div",_t,[B.value?(l(),a("div",wt,"Loading preview...")):(l(),le(oe,{key:1,content:h.value},null,8,["content"]))])],64)):(l(),a("div",ft,[t("div",mt,[u(d(Q),{class:"w-12 h-12 mx-auto mb-3 opacity-50"}),e[19]||(e[19]=t("p",null,"Select a skill to preview",-1))])]))],64))]),i.value?(l(),a("p",Ct,r(i.value),1)):S("",!0)]))}});export{Dt as default};
15
+ 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),[[M,y.value]]),t("div",je,[t("button",{onClick:ie,disabled:f.value||!m.value.trim()||!y.value.trim(),class:"flex-1 px-2 py-1 text-xs rounded bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50"},r(f.value?"Creating...":"Create"),9,Ee),t("button",{onClick:P,class:"px-2 py-1 text-xs rounded border border-border hover:bg-accent"}," Cancel ")])])):S("",!0)]),t("div",ze,[N.value?(o(),a("div",Ne,"Loading...")):V.value.length===0?(o(),a("div",Ae,[u(d(te),{class:"w-8 h-8 mx-auto mb-2 opacity-50"}),e[15]||(e[15]=t("p",{class:"text-xs"},"No skills installed.",-1))])):S("",!0),(o(!0),a(p,null,se(V.value,s=>{var F;return o(),a("div",{key:s.slug,onClick:R=>de(s),class:E(["flex items-center justify-between px-2 py-2 text-xs rounded cursor-pointer hover:bg-accent transition-colors group",{"bg-accent font-medium":((F=v.value)==null?void 0:F.slug)===s.slug}])},[t("div",Ke,[t("div",Be,r(s.name),1),t("div",Re,r(s.slug),1)]),t("button",{onClick:ae(R=>ue(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"},[u(d(Se),{class:"w-3.5 h-3.5"})],8,qe)],10,Ge)}),128))])],64)):(o(),a(p,{key:1},[t("div",Oe,[C(t("select",{"onUpdate:modelValue":e[7]||(e[7]=s=>K.value=s),onChange:j,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"},[...e[16]||(e[16]=[t("option",{value:"awesome-copilot"},"awesome-copilot",-1),t("option",{value:"skillssh"},"skills.sh",-1)])],544),[[ge,K.value]]),t("div",Qe,[u(d(he),{class:"absolute left-2 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground"}),C(t("input",{"onUpdate:modelValue":e[8]||(e[8]=s=>T.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:ee(j,["enter"])},null,544),[[M,T.value]])]),t("button",{onClick:j,disabled:L.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"},r(L.value?"Searching...":"Search"),9,We)]),t("div",Xe,[L.value?(o(),a("div",He,"Loading...")):U.value?(o(),a("div",Je,r(U.value),1)):I.value.length===0?(o(),a("div",Ye,[u(d(Q),{class:"w-8 h-8 mx-auto mb-2 opacity-50"}),e[17]||(e[17]=t("p",{class:"text-xs"},"No skills found.",-1))])):S("",!0),(o(!0),a(p,null,se(I.value,s=>{var F;return o(),a("div",{key:s.slug,onClick:R=>pe(s),class:E(["flex items-start justify-between px-2 py-2 text-xs rounded cursor-pointer hover:bg-accent transition-colors gap-1",{"bg-accent":((F=c.value)==null?void 0:F.slug)===s.slug}])},[t("div",et,[t("div",tt,r(s.slug),1),t("div",{class:"text-muted-foreground line-clamp-2 mt-0.5",title:s.description},r(s.description),9,st)]),Y(s.slug)?(o(),a("span",lt," Installed ")):(o(),a("button",{key:0,onClick:ae(R=>J(s),["stop"]),disabled:_.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"},r(_.value===s.slug?"...":"Install"),9,ot))],10,Ze)}),128))])],64))]),t("div",at,[k.value==="installed"?(o(),a(p,{key:0},[v.value?(o(),a(p,{key:1},[t("div",it,[t("div",null,[t("span",ut,r(v.value.name),1),t("span",dt,r(v.value.slug)+"/SKILL.md",1)]),t("div",ct,[b.value?(o(),a(p,{key:1},[t("button",{onClick:ve,class:"p-1.5 rounded hover:bg-accent text-green-500",title:"Save"},[u(d(we),{class:"w-4 h-4"})]),t("button",{onClick:e[9]||(e[9]=s=>b.value=!1),class:"p-1.5 rounded hover:bg-accent text-muted-foreground",title:"Cancel"},[u(d(Ce),{class:"w-4 h-4"})])],64)):(o(),a("button",{key:0,onClick:ce,class:"p-1.5 rounded hover:bg-accent text-muted-foreground",title:"Edit"},[u(d(_e),{class:"w-4 h-4"})]))])]),t("div",vt,[G.value?(o(),a("div",pt,"Loading...")):b.value?C((o(),a("textarea",{key:1,"onUpdate:modelValue":e[10]||(e[10]=s=>$.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)),[[M,$.value]]):(o(),oe(le,{key:2,content:x.value},null,8,["content"]))])],64)):(o(),a("div",nt,[t("div",rt,[u(d(te),{class:"w-12 h-12 mx-auto mb-3 opacity-50"}),e[18]||(e[18]=t("p",null,"Select a skill to view",-1))])]))],64)):(o(),a(p,{key:1},[c.value?(o(),a(p,{key:1},[t("div",xt,[t("div",gt,[t("span",yt,r(c.value.slug),1),t("span",bt,r(c.value.source),1)]),Y(c.value.slug)?(o(),a("span",ht," Installed ")):(o(),a("button",{key:0,onClick:e[11]||(e[11]=s=>J(c.value)),disabled:_.value===c.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"},r(_.value===c.value.slug?"Installing...":"Install"),9,kt))]),t("div",_t,[B.value?(o(),a("div",wt,"Loading preview...")):(o(),oe(le,{key:1,content:h.value},null,8,["content"]))])],64)):(o(),a("div",ft,[t("div",mt,[u(d(Q),{class:"w-12 h-12 mx-auto mb-3 opacity-50"}),e[19]||(e[19]=t("p",null,"Select a skill to preview",-1))])]))],64))]),i.value?(o(),a("p",Ct,r(i.value),1)):S("",!0)]))}});export{Tt as default};