octomux 1.0.0 → 1.0.4

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 (38) hide show
  1. package/bin/octomux.js +21 -27
  2. package/dist/assets/{TaskDetail-GGGQ2C1J.js → TaskDetail-BvIvYM_M.js} +1 -1
  3. package/dist/assets/{index-Bsj_BLLM.js → index-DHcnQkuw.js} +2 -2
  4. package/dist/assets/index-Df8OBouU.css +1 -0
  5. package/dist/index.html +2 -2
  6. package/dist-server/index.js +16 -16
  7. package/dist-server/orchestrator-prompt.md +105 -0
  8. package/package.json +8 -3
  9. package/skills/octomux-create-commit/SKILL.md +78 -0
  10. package/skills/octomux-create-pr/SKILL.md +103 -0
  11. package/skills/octomux-create-task/SKILL.md +99 -0
  12. package/cli/dist/commands/cancel-task.js +0 -10
  13. package/dist/assets/index-Br9dLOzs.css +0 -1
  14. package/dist-server/api.d.ts +0 -2
  15. package/dist-server/api.js +0 -447
  16. package/dist-server/app.d.ts +0 -2
  17. package/dist-server/app.js +0 -13
  18. package/dist-server/db.d.ts +0 -7
  19. package/dist-server/db.js +0 -107
  20. package/dist-server/events.d.ts +0 -13
  21. package/dist-server/events.js +0 -35
  22. package/dist-server/hook-settings.d.ts +0 -5
  23. package/dist-server/hook-settings.js +0 -195
  24. package/dist-server/hooks.d.ts +0 -2
  25. package/dist-server/hooks.js +0 -118
  26. package/dist-server/index.d.ts +0 -5
  27. package/dist-server/orchestrator.d.ts +0 -4
  28. package/dist-server/orchestrator.js +0 -37
  29. package/dist-server/poller.d.ts +0 -17
  30. package/dist-server/poller.js +0 -170
  31. package/dist-server/pr-template.d.ts +0 -7
  32. package/dist-server/pr-template.js +0 -29
  33. package/dist-server/task-runner.d.ts +0 -28
  34. package/dist-server/task-runner.js +0 -359
  35. package/dist-server/terminal.d.ts +0 -13
  36. package/dist-server/terminal.js +0 -173
  37. package/dist-server/types.d.ts +0 -73
  38. package/dist-server/types.js +0 -1
package/bin/octomux.js CHANGED
@@ -1,9 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { execFileSync, exec as execCb } from 'child_process';
4
- import { readFileSync, existsSync, mkdirSync, writeFileSync } from 'fs';
4
+ import { readFileSync, existsSync, mkdirSync, readdirSync, cpSync } from 'fs';
5
5
  import { fileURLToPath } from 'url';
6
6
  import path from 'path';
7
+ import os from 'os';
7
8
 
8
9
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
9
10
 
@@ -18,8 +19,6 @@ const command = args[0];
18
19
 
19
20
  if (command === 'start') {
20
21
  await runStart(args.slice(1));
21
- } else if (command === 'init') {
22
- runInit();
23
22
  } else {
24
23
  // Delegate to CLI (commander-based) for all other commands
25
24
  await import('../cli/dist/index.js');
@@ -44,6 +43,9 @@ async function runStart(startArgs) {
44
43
  // Welcome banner
45
44
  console.log(`\n\uD83D\uDC19 octomux v${version}\n`);
46
45
 
46
+ // Install bundled skills
47
+ installSkills();
48
+
47
49
  // Preflight checks
48
50
  const required = [
49
51
  {
@@ -108,32 +110,24 @@ async function runStart(startArgs) {
108
110
  }
109
111
  }
110
112
 
111
- // ─── init command ────────────────────────────────────────────────────────────
113
+ // ─── skill installer ─────────────────────────────────────────────────────────
112
114
 
113
- function runInit() {
114
- // Verify git repo
115
- if (!existsSync('.git')) {
116
- console.error('Error: Current directory is not a git repository.');
117
- console.error('Run this command from the root of a git repo.');
118
- process.exit(1);
119
- }
115
+ function installSkills() {
116
+ const skillsSource = path.join(__dirname, '..', 'skills');
117
+ const skillsTarget = path.join(os.homedir(), '.claude', 'skills');
120
118
 
121
- const settingsPath = path.join('.claude', 'settings.local.json');
119
+ if (!existsSync(skillsSource)) return;
122
120
 
123
- if (existsSync(settingsPath)) {
124
- console.log(`${settingsPath} already exists. No changes made.`);
125
- return;
121
+ let installed = false;
122
+ for (const skill of readdirSync(skillsSource)) {
123
+ const target = path.join(skillsTarget, skill);
124
+ if (!existsSync(target)) {
125
+ mkdirSync(target, { recursive: true });
126
+ cpSync(path.join(skillsSource, skill), target, { recursive: true });
127
+ installed = true;
128
+ }
129
+ }
130
+ if (installed) {
131
+ console.log('Installed octomux skills for Claude Code');
126
132
  }
127
-
128
- const settings = {
129
- permissions: {
130
- allow: ['Bash(git *)', 'Bash(npm *)', 'Bash(bun *)', 'Read', 'Write', 'Edit'],
131
- },
132
- };
133
-
134
- mkdirSync('.claude', { recursive: true });
135
- writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n');
136
-
137
- console.log(`Created ${settingsPath} with recommended agent permissions.`);
138
- console.log(`Add to .gitignore: .claude/settings.local.json`);
139
133
  }
@@ -1 +1 @@
1
- import{j as e,r as s}from"./vendor-react-BZ8ItZjw.js";import{c as ne,D as re,a as ae,b as ie,d as oe,e as le,L as y,T as q,B as u,f as p,I as Z,P as J,g as K,h as X,u as de,S as ce,i as ue}from"./index-Bsj_BLLM.js";import{TerminalView as Y}from"./TerminalView-CguHyqU9.js";import{b as xe,a as me,d as he}from"./vendor-router-DRLGqALp.js";import"./vendor-ui-CWZtXYLx.js";import"./vendor-xterm-DvXGiZvM.js";function pe({agents:i,activeIndex:x,onSelect:r,onAddAgent:t,onStopAgent:d,canAddAgent:m}){return e.jsxs("div",{className:"flex items-center gap-1 border-b border-border px-1 pb-1",children:[i.filter(a=>a.status!=="stopped").map(a=>e.jsxs("div",{className:"group flex items-center",children:[e.jsxs("button",{className:ne("rounded-t-md px-3 py-1.5 text-sm transition-colors",a.window_index===x?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>r(a.window_index),children:[a.label,a.status==="running"&&e.jsx("span",{className:`ml-1.5 inline-block h-1.5 w-1.5 rounded-full ${a.hook_activity==="waiting"?"bg-amber-500":a.hook_activity==="idle"?"bg-zinc-400":"animate-pulse bg-green-400"}`})]}),a.status==="running"&&e.jsx("button",{className:"ml-0.5 hidden rounded p-0.5 text-muted-foreground hover:text-destructive group-hover:inline-flex",onClick:l=>{l.stopPropagation(),d(a.id)},title:"Stop agent",children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 6 6 18"}),e.jsx("path",{d:"m6 6 12 12"})]})})]},a.id)),m&&e.jsx(fe,{onAdd:t})]})}function fe({onAdd:i}){const[x,r]=s.useState(!1),[t,d]=s.useState("");function m(){i(t.trim()||void 0),d(""),r(!1)}function a(){i()}return e.jsxs(re,{open:x,onOpenChange:r,children:[e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx("button",{className:"rounded-t-md px-2 py-1.5 text-sm text-muted-foreground hover:text-foreground",onClick:a,title:"Add agent without prompt",children:"+"}),e.jsx(ae,{render:e.jsx("button",{className:"rounded px-1 py-1 text-xs text-muted-foreground hover:text-foreground",title:"Add agent with prompt"}),children:"..."})]}),e.jsxs(ie,{className:"sm:max-w-md",children:[e.jsx(oe,{children:e.jsx(le,{children:"Add Agent"})}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(y,{htmlFor:"agent-prompt",children:"Initial Prompt (optional)"}),e.jsx(q,{id:"agent-prompt",placeholder:"Write tests for the authentication module...",rows:3,value:t,onChange:l=>d(l.target.value)})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(u,{variant:"ghost",onClick:()=>r(!1),children:"Cancel"}),e.jsx(u,{onClick:m,children:"Add Agent"})]})]})]})]})}function ge({task:i,onSaved:x,onStart:r}){const[t,d]=s.useState(i.title),[m,a]=s.useState(i.description),[l,g]=s.useState(i.repo_path),[C,R]=s.useState(i.branch??""),[f,E]=s.useState(i.base_branch??""),[h,S]=s.useState(i.initial_prompt??""),[v,O]=s.useState(!!i.initial_prompt),[I,j]=s.useState([]),[z,_]=s.useState(""),[b,w]=s.useState(!1),[B,U]=s.useState(!1),[A,M]=s.useState(null),[V,G]=s.useState(!1),[L,N]=s.useState(!1),[T,H]=s.useState(null),[Q,D]=s.useState(!1),P=s.useRef(f);P.current=f,s.useEffect(()=>{const n=l.trim();if(!n){j([]);return}let W=!1;const ee=setTimeout(async()=>{try{const[te,se]=await Promise.all([p.listBranches(n),p.getDefaultBranch(n)]);W||(j(te),P.current||E(se.branch))}catch{W||j([])}},300);return()=>{W=!0,clearTimeout(ee)}},[l]);const F=I.filter(n=>n.toLowerCase().includes(z.toLowerCase())),o=s.useCallback(async n=>{G(!0);try{const W=await p.browse(n);M(W)}catch{}finally{G(!1)}},[]);s.useEffect(()=>{B&&!A&&o()},[B,A,o]);function c(n){g(n),U(!1)}async function $(){if(!(!t.trim()||!m.trim()||!l.trim())){N(!0),H(null),D(!1);try{await p.updateTask(i.id,{title:t.trim(),description:m.trim(),repo_path:l.trim(),branch:C.trim()||void 0,base_branch:f.trim()||void 0,initial_prompt:h.trim()||void 0}),D(!0),x(),setTimeout(()=>D(!1),2e3)}catch(n){H(n.message)}finally{N(!1)}}}const k=t.trim()&&m.trim()&&l.trim()&&!L;return e.jsx("div",{className:"mx-auto max-w-2xl p-6",children:e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(y,{htmlFor:"edit-title",children:"Title"}),e.jsx(Z,{id:"edit-title",value:t,onChange:n=>d(n.target.value),placeholder:"Task title"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(y,{htmlFor:"edit-description",children:"Description"}),e.jsx(q,{id:"edit-description",value:m,onChange:n=>a(n.target.value),placeholder:"Task description",rows:3})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(y,{htmlFor:"edit-repo-path",children:"Repository Path"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Z,{id:"edit-repo-path",className:"flex-1 font-mono text-sm",value:l,onChange:n=>g(n.target.value),placeholder:"/Users/you/projects/my-repo"}),e.jsxs(J,{open:B,onOpenChange:U,children:[e.jsx(K,{render:e.jsx(u,{type:"button",variant:"outline",className:"shrink-0",children:"Browse"})}),e.jsx(X,{align:"end",side:"bottom",sideOffset:4,className:"w-[420px] p-0",children:e.jsx(je,{data:A,loading:V,onNavigate:o,onSelect:c})})]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(y,{htmlFor:"edit-branch",children:"Branch Name"}),e.jsx(Z,{id:"edit-branch",className:"font-mono text-sm",value:C,onChange:n=>R(n.target.value),placeholder:"feat/my-feature"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(y,{children:"Base Branch"}),e.jsxs(J,{open:b,onOpenChange:w,children:[e.jsx(K,{render:e.jsxs("button",{type:"button",className:"flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[e.jsx("span",{className:f?"font-mono text-xs":"text-muted-foreground",children:f||"Select base branch..."}),e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-muted-foreground",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})]})}),e.jsx(X,{align:"start",side:"bottom",sideOffset:4,className:"w-[--trigger-width] p-0",children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{className:"border-b border-border px-3 py-2",children:e.jsx("input",{type:"text",placeholder:"Search branches...",className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",value:z,onChange:n=>_(n.target.value),autoFocus:!0})}),e.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[F.length===0&&e.jsx("div",{className:"px-3 py-3 text-center text-xs text-muted-foreground",children:I.length===0?"Select a repository first":"No matching branches"}),F.map(n=>e.jsx("button",{type:"button",className:`flex w-full items-center px-3 py-1.5 text-left text-sm hover:bg-muted transition-colors ${n===f?"bg-muted font-medium":""}`,onClick:()=>{E(n),_(""),w(!1)},children:e.jsx("span",{className:"font-mono text-xs truncate",children:n})},n))]})]})})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("button",{type:"button",className:"w-fit cursor-pointer border-0 bg-transparent p-0 text-xs text-muted-foreground outline-0 ring-0 hover:text-foreground transition-colors text-left focus:outline-0 focus:ring-0 focus-visible:outline-0 focus-visible:ring-0",onClick:()=>O(!v),children:v?"- Hide initial prompt":"+ Add initial prompt"}),v&&e.jsx(q,{id:"edit-initial-prompt",placeholder:"Custom prompt to send to the agent on start...",rows:4,value:h,onChange:n=>S(n.target.value)})]}),T&&e.jsx("p",{className:"text-sm text-destructive",children:T}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(u,{onClick:$,disabled:!k,children:L?"Saving...":"Save"}),e.jsx(u,{variant:"outline",onClick:r,children:"Start"}),Q&&e.jsx("span",{className:"text-sm text-emerald-500",children:"Saved"})]})]})})}function je({data:i,loading:x,onNavigate:r,onSelect:t}){return!i&&x?e.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"Loading..."}):i?e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[e.jsx("button",{type:"button",disabled:!i.parent,className:"shrink-0 rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-30 disabled:hover:bg-transparent",onClick:()=>i.parent&&r(i.parent),children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m15 18-6-6 6-6"})})}),e.jsx("span",{className:"font-mono text-xs text-muted-foreground truncate direction-rtl text-left",children:i.current})]}),e.jsxs("div",{className:"max-h-[280px] overflow-y-auto",children:[i.entries.length===0&&e.jsx("div",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:"No subdirectories"}),i.entries.map(d=>e.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm hover:bg-muted transition-colors",onClick:()=>r(d.path),onDoubleClick:()=>d.isGit&&t(d.path),children:[e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:d.isGit?"text-emerald-500":"text-muted-foreground",children:e.jsx("path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"})}),e.jsxs("span",{className:"font-mono text-xs truncate",children:[d.name,e.jsx("span",{className:"text-muted-foreground",children:"/"})]}),d.isGit&&e.jsx("span",{className:"ml-auto shrink-0 rounded bg-emerald-500/10 px-1.5 py-0.5 text-[10px] font-medium text-emerald-600 dark:text-emerald-400",children:"git"})]},d.path))]}),e.jsxs("div",{className:"flex items-center justify-between border-t border-border px-3 py-2",children:[e.jsxs("div",{className:"flex flex-col truncate mr-2",children:[e.jsx("span",{className:"font-mono text-[10px] text-muted-foreground truncate",children:i.current}),e.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"Double-click a git repo to select it"})]}),e.jsx(u,{type:"button",size:"sm",className:"shrink-0 h-7 text-xs",onClick:()=>t(i.current),children:"Select"})]})]}):null}function Ce(){var P,F;const{id:i}=xe(),x=me(),r=i??"",{task:t,loading:d,error:m,refresh:a}=de(r),[l,g]=s.useState(null),[C,R]=s.useState(!1),[f,E]=s.useState(()=>window.innerWidth>=640),[h,S]=s.useState("agents"),[v,O]=s.useState(!1),[I]=he(),j=I.get("agent"),[z,_]=s.useState(null),b=(t==null?void 0:t.user_window_index)??z,w=((F=(P=t==null?void 0:t.agents)==null?void 0:P[0])==null?void 0:F.window_index)??null;s.useEffect(()=>{if(j&&(t!=null&&t.agents)){const o=t.agents.find(c=>c.id===j);if(o){g(o.window_index);return}}l===null&&w!==null&&g(w)},[w,l,j,t==null?void 0:t.agents]),s.useEffect(()=>{t&&t.status!=="running"&&(S("agents"),_(null))},[t==null?void 0:t.status]);const B=s.useCallback(async o=>{if(r)try{const c=await p.addAgent(r,o?{prompt:o}:void 0);g(c.window_index),a()}catch(c){console.error("Failed to add agent:",c)}},[r,a]),U=s.useCallback(async o=>{if(r)try{const c=(t==null?void 0:t.agents)||[],$=c.find(k=>k.id===o);if(await p.stopAgent(r,o),$&&$.window_index===l){const k=c.find(n=>n.id!==o&&n.status!=="stopped");k&&g(k.window_index)}a()}catch(c){console.error("Failed to stop agent:",c)}},[r,a,t,l]),A=s.useCallback(async()=>{if(r)try{await p.updateTask(r,{status:"closed"}),a()}catch(o){console.error("Failed to close task:",o)}},[r,a]),M=s.useCallback(async()=>{if(r)try{await p.startTask(r),a()}catch(o){console.error("Failed to start task:",o)}},[r,a]),V=s.useCallback(async()=>{if(r){R(!0);try{await p.updateTask(r,{status:"running"}),a()}catch(o){console.error("Failed to resume task:",o)}finally{R(!1)}}},[r,a]),G=s.useCallback(async()=>{if(h==="editor"){S("agents");return}if(b===null){if(v)return;O(!0);try{const o=await p.createUserTerminal(r);_(o.user_window_index),a()}catch(o){console.error("Failed to create user terminal:",o);return}finally{O(!1)}}S("editor")},[h,b,r,v,a]);if(d)return e.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:"Loading..."});if(!t)return e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-4",children:[e.jsx("p",{className:"text-destructive",children:m||"Task not found"}),e.jsx(u,{variant:"outline",onClick:()=>x("/"),children:"Back to Dashboard"})]});const L=t.agents||[],N=t.status==="running",T=t.status==="draft",H=(t.status==="closed"||t.status==="error")&&!!t.worktree,Q=t.status==="running"||t.status==="setting_up",D=!!t.tmux_session&&L.length>0&&l!==null&&Q;return e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2 sm:px-4 sm:py-3",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[e.jsxs(u,{variant:"ghost",size:"sm",className:"shrink-0",onClick:()=>x("/"),children:[e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","data-icon":"inline-start",children:e.jsx("path",{d:"m15 18-6-6 6-6"})}),e.jsx("span",{className:"hidden sm:inline",children:"Back"})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h1",{className:"truncate text-base font-semibold sm:text-lg",children:t.title}),e.jsx(ce,{status:t.derived_status||t.status})]}),e.jsx("p",{className:"hidden max-w-xl truncate text-xs text-muted-foreground sm:block",children:t.description})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1 sm:gap-2",children:[t.pr_url&&e.jsxs("a",{href:t.pr_url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-400 hover:underline sm:text-sm",children:["PR #",t.pr_number]}),H&&e.jsx(u,{variant:"outline",size:"sm",disabled:C,onClick:V,children:C?"...":"Resume"}),N&&!!t.tmux_session&&e.jsxs(u,{variant:h==="editor"?"default":"outline",size:"sm",onClick:G,children:[e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"16 18 22 12 16 6"}),e.jsx("polyline",{points:"8 6 2 12 8 18"})]}),e.jsx("span",{className:"hidden sm:inline",children:"Editor"})]}),T&&e.jsx(u,{variant:"outline",size:"sm",onClick:M,children:"Start"}),N&&e.jsx(u,{variant:"outline",size:"sm",onClick:A,children:"Close"})]})]}),t.error&&e.jsx("div",{className:"border-b border-destructive/30 bg-destructive/10 px-4 py-2 text-sm text-destructive",children:t.error}),e.jsxs("div",{className:"border-b border-border",children:[e.jsxs("button",{onClick:()=>E(o=>!o),className:"flex w-full items-center gap-1.5 px-4 py-1.5 text-xs text-muted-foreground hover:bg-muted/50",children:[e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:`transition-transform ${f?"rotate-90":""}`,children:e.jsx("path",{d:"m9 18 6-6-6-6"})}),"Details"]}),f&&e.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-6 gap-y-1 px-4 pb-3 text-xs",children:[t.repo_path&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:"Repo"}),e.jsx("span",{className:"font-mono text-muted-foreground",children:t.repo_path})]}),t.branch&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:"Branch"}),e.jsx("span",{className:"font-mono text-muted-foreground",children:t.branch})]}),t.base_branch&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:"Base"}),e.jsx(ue,{variant:"outline",className:"w-fit text-xs font-normal",children:t.base_branch})]}),t.description&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:"Description"}),e.jsx("span",{className:"whitespace-pre-wrap text-muted-foreground",children:t.description})]}),t.pr_url&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:"PR"}),e.jsxs("a",{href:t.pr_url,target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 hover:underline",children:["#",t.pr_number," — ",t.pr_url]})]}),t.created_at&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:"Created"}),e.jsx("span",{className:"text-muted-foreground",children:new Date(t.created_at).toLocaleString()})]}),t.updated_at&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:"Updated"}),e.jsx("span",{className:"text-muted-foreground",children:new Date(t.updated_at).toLocaleString()})]})]})]}),D?e.jsxs("div",{className:h==="agents"?"flex min-h-0 flex-1 flex-col":"hidden",children:[e.jsx(pe,{agents:L,activeIndex:l,onSelect:g,onAddAgent:B,onStopAgent:U,canAddAgent:N}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden p-2",children:e.jsx(Y,{taskId:t.id,windowIndex:l,visible:h==="agents"})})]}):T?e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx(ge,{task:t,onSaved:a,onStart:M})}):e.jsx("div",{className:h==="agents"?"flex flex-1 items-center justify-center text-muted-foreground":"hidden",children:t.status==="setting_up"?"Setting up terminal...":t.status==="closed"||t.status==="error"?"Terminal session ended":"No terminal available"}),b!==null&&h==="editor"&&e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden p-2",children:e.jsx(Y,{taskId:t.id,windowIndex:b})})})]})}export{Ce as default};
1
+ import{j as e,r as s}from"./vendor-react-BZ8ItZjw.js";import{c as ne,D as re,a as ae,b as ie,d as oe,e as le,L as y,T as q,B as u,f as p,I as Z,P as J,g as K,h as X,u as de,S as ce,i as ue}from"./index-DHcnQkuw.js";import{TerminalView as Y}from"./TerminalView-CguHyqU9.js";import{b as xe,a as me,d as he}from"./vendor-router-DRLGqALp.js";import"./vendor-ui-CWZtXYLx.js";import"./vendor-xterm-DvXGiZvM.js";function pe({agents:i,activeIndex:x,onSelect:r,onAddAgent:t,onStopAgent:d,canAddAgent:m}){return e.jsxs("div",{className:"flex items-center gap-1 border-b border-border px-1 pb-1",children:[i.filter(a=>a.status!=="stopped").map(a=>e.jsxs("div",{className:"group flex items-center",children:[e.jsxs("button",{className:ne("rounded-t-md px-3 py-1.5 text-sm transition-colors",a.window_index===x?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>r(a.window_index),children:[a.label,a.status==="running"&&e.jsx("span",{className:`ml-1.5 inline-block h-1.5 w-1.5 rounded-full ${a.hook_activity==="waiting"?"bg-amber-500":a.hook_activity==="idle"?"bg-zinc-400":"animate-pulse bg-green-400"}`})]}),a.status==="running"&&e.jsx("button",{className:"ml-0.5 hidden rounded p-0.5 text-muted-foreground hover:text-destructive group-hover:inline-flex",onClick:l=>{l.stopPropagation(),d(a.id)},title:"Stop agent",children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 6 6 18"}),e.jsx("path",{d:"m6 6 12 12"})]})})]},a.id)),m&&e.jsx(fe,{onAdd:t})]})}function fe({onAdd:i}){const[x,r]=s.useState(!1),[t,d]=s.useState("");function m(){i(t.trim()||void 0),d(""),r(!1)}function a(){i()}return e.jsxs(re,{open:x,onOpenChange:r,children:[e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx("button",{className:"rounded-t-md px-2 py-1.5 text-sm text-muted-foreground hover:text-foreground",onClick:a,title:"Add agent without prompt",children:"+"}),e.jsx(ae,{render:e.jsx("button",{className:"rounded px-1 py-1 text-xs text-muted-foreground hover:text-foreground",title:"Add agent with prompt"}),children:"..."})]}),e.jsxs(ie,{className:"sm:max-w-md",children:[e.jsx(oe,{children:e.jsx(le,{children:"Add Agent"})}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(y,{htmlFor:"agent-prompt",children:"Initial Prompt (optional)"}),e.jsx(q,{id:"agent-prompt",placeholder:"Write tests for the authentication module...",rows:3,value:t,onChange:l=>d(l.target.value)})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(u,{variant:"ghost",onClick:()=>r(!1),children:"Cancel"}),e.jsx(u,{onClick:m,children:"Add Agent"})]})]})]})]})}function ge({task:i,onSaved:x,onStart:r}){const[t,d]=s.useState(i.title),[m,a]=s.useState(i.description),[l,g]=s.useState(i.repo_path),[C,R]=s.useState(i.branch??""),[f,E]=s.useState(i.base_branch??""),[h,S]=s.useState(i.initial_prompt??""),[v,O]=s.useState(!!i.initial_prompt),[I,j]=s.useState([]),[z,_]=s.useState(""),[b,w]=s.useState(!1),[B,U]=s.useState(!1),[A,M]=s.useState(null),[V,G]=s.useState(!1),[L,N]=s.useState(!1),[T,H]=s.useState(null),[Q,D]=s.useState(!1),P=s.useRef(f);P.current=f,s.useEffect(()=>{const n=l.trim();if(!n){j([]);return}let W=!1;const ee=setTimeout(async()=>{try{const[te,se]=await Promise.all([p.listBranches(n),p.getDefaultBranch(n)]);W||(j(te),P.current||E(se.branch))}catch{W||j([])}},300);return()=>{W=!0,clearTimeout(ee)}},[l]);const F=I.filter(n=>n.toLowerCase().includes(z.toLowerCase())),o=s.useCallback(async n=>{G(!0);try{const W=await p.browse(n);M(W)}catch{}finally{G(!1)}},[]);s.useEffect(()=>{B&&!A&&o()},[B,A,o]);function c(n){g(n),U(!1)}async function $(){if(!(!t.trim()||!m.trim()||!l.trim())){N(!0),H(null),D(!1);try{await p.updateTask(i.id,{title:t.trim(),description:m.trim(),repo_path:l.trim(),branch:C.trim()||void 0,base_branch:f.trim()||void 0,initial_prompt:h.trim()||void 0}),D(!0),x(),setTimeout(()=>D(!1),2e3)}catch(n){H(n.message)}finally{N(!1)}}}const k=t.trim()&&m.trim()&&l.trim()&&!L;return e.jsx("div",{className:"mx-auto max-w-2xl p-6",children:e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(y,{htmlFor:"edit-title",children:"Title"}),e.jsx(Z,{id:"edit-title",value:t,onChange:n=>d(n.target.value),placeholder:"Task title"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(y,{htmlFor:"edit-description",children:"Description"}),e.jsx(q,{id:"edit-description",value:m,onChange:n=>a(n.target.value),placeholder:"Task description",rows:3})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(y,{htmlFor:"edit-repo-path",children:"Repository Path"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Z,{id:"edit-repo-path",className:"flex-1 font-mono text-sm",value:l,onChange:n=>g(n.target.value),placeholder:"/Users/you/projects/my-repo"}),e.jsxs(J,{open:B,onOpenChange:U,children:[e.jsx(K,{render:e.jsx(u,{type:"button",variant:"outline",className:"shrink-0",children:"Browse"})}),e.jsx(X,{align:"end",side:"bottom",sideOffset:4,className:"w-[420px] p-0",children:e.jsx(je,{data:A,loading:V,onNavigate:o,onSelect:c})})]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(y,{htmlFor:"edit-branch",children:"Branch Name"}),e.jsx(Z,{id:"edit-branch",className:"font-mono text-sm",value:C,onChange:n=>R(n.target.value),placeholder:"feat/my-feature"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(y,{children:"Base Branch"}),e.jsxs(J,{open:b,onOpenChange:w,children:[e.jsx(K,{render:e.jsxs("button",{type:"button",className:"flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[e.jsx("span",{className:f?"font-mono text-xs":"text-muted-foreground",children:f||"Select base branch..."}),e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-muted-foreground",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})]})}),e.jsx(X,{align:"start",side:"bottom",sideOffset:4,className:"w-[--trigger-width] p-0",children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{className:"border-b border-border px-3 py-2",children:e.jsx("input",{type:"text",placeholder:"Search branches...",className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",value:z,onChange:n=>_(n.target.value),autoFocus:!0})}),e.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[F.length===0&&e.jsx("div",{className:"px-3 py-3 text-center text-xs text-muted-foreground",children:I.length===0?"Select a repository first":"No matching branches"}),F.map(n=>e.jsx("button",{type:"button",className:`flex w-full items-center px-3 py-1.5 text-left text-sm hover:bg-muted transition-colors ${n===f?"bg-muted font-medium":""}`,onClick:()=>{E(n),_(""),w(!1)},children:e.jsx("span",{className:"font-mono text-xs truncate",children:n})},n))]})]})})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("button",{type:"button",className:"w-fit cursor-pointer border-0 bg-transparent p-0 text-xs text-muted-foreground outline-0 ring-0 hover:text-foreground transition-colors text-left focus:outline-0 focus:ring-0 focus-visible:outline-0 focus-visible:ring-0",onClick:()=>O(!v),children:v?"- Hide initial prompt":"+ Add initial prompt"}),v&&e.jsx(q,{id:"edit-initial-prompt",placeholder:"Custom prompt to send to the agent on start...",rows:4,value:h,onChange:n=>S(n.target.value)})]}),T&&e.jsx("p",{className:"text-sm text-destructive",children:T}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(u,{onClick:$,disabled:!k,children:L?"Saving...":"Save"}),e.jsx(u,{variant:"outline",onClick:r,children:"Start"}),Q&&e.jsx("span",{className:"text-sm text-emerald-500",children:"Saved"})]})]})})}function je({data:i,loading:x,onNavigate:r,onSelect:t}){return!i&&x?e.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"Loading..."}):i?e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[e.jsx("button",{type:"button",disabled:!i.parent,className:"shrink-0 rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-30 disabled:hover:bg-transparent",onClick:()=>i.parent&&r(i.parent),children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m15 18-6-6 6-6"})})}),e.jsx("span",{className:"font-mono text-xs text-muted-foreground truncate direction-rtl text-left",children:i.current})]}),e.jsxs("div",{className:"max-h-[280px] overflow-y-auto",children:[i.entries.length===0&&e.jsx("div",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:"No subdirectories"}),i.entries.map(d=>e.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm hover:bg-muted transition-colors",onClick:()=>r(d.path),onDoubleClick:()=>d.isGit&&t(d.path),children:[e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:d.isGit?"text-emerald-500":"text-muted-foreground",children:e.jsx("path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"})}),e.jsxs("span",{className:"font-mono text-xs truncate",children:[d.name,e.jsx("span",{className:"text-muted-foreground",children:"/"})]}),d.isGit&&e.jsx("span",{className:"ml-auto shrink-0 rounded bg-emerald-500/10 px-1.5 py-0.5 text-[10px] font-medium text-emerald-600 dark:text-emerald-400",children:"git"})]},d.path))]}),e.jsxs("div",{className:"flex items-center justify-between border-t border-border px-3 py-2",children:[e.jsxs("div",{className:"flex flex-col truncate mr-2",children:[e.jsx("span",{className:"font-mono text-[10px] text-muted-foreground truncate",children:i.current}),e.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"Double-click a git repo to select it"})]}),e.jsx(u,{type:"button",size:"sm",className:"shrink-0 h-7 text-xs",onClick:()=>t(i.current),children:"Select"})]})]}):null}function Ce(){var P,F;const{id:i}=xe(),x=me(),r=i??"",{task:t,loading:d,error:m,refresh:a}=de(r),[l,g]=s.useState(null),[C,R]=s.useState(!1),[f,E]=s.useState(()=>window.innerWidth>=640),[h,S]=s.useState("agents"),[v,O]=s.useState(!1),[I]=he(),j=I.get("agent"),[z,_]=s.useState(null),b=(t==null?void 0:t.user_window_index)??z,w=((F=(P=t==null?void 0:t.agents)==null?void 0:P[0])==null?void 0:F.window_index)??null;s.useEffect(()=>{if(j&&(t!=null&&t.agents)){const o=t.agents.find(c=>c.id===j);if(o){g(o.window_index);return}}l===null&&w!==null&&g(w)},[w,l,j,t==null?void 0:t.agents]),s.useEffect(()=>{t&&t.status!=="running"&&(S("agents"),_(null))},[t==null?void 0:t.status]);const B=s.useCallback(async o=>{if(r)try{const c=await p.addAgent(r,o?{prompt:o}:void 0);g(c.window_index),a()}catch(c){console.error("Failed to add agent:",c)}},[r,a]),U=s.useCallback(async o=>{if(r)try{const c=(t==null?void 0:t.agents)||[],$=c.find(k=>k.id===o);if(await p.stopAgent(r,o),$&&$.window_index===l){const k=c.find(n=>n.id!==o&&n.status!=="stopped");k&&g(k.window_index)}a()}catch(c){console.error("Failed to stop agent:",c)}},[r,a,t,l]),A=s.useCallback(async()=>{if(r)try{await p.updateTask(r,{status:"closed"}),a()}catch(o){console.error("Failed to close task:",o)}},[r,a]),M=s.useCallback(async()=>{if(r)try{await p.startTask(r),a()}catch(o){console.error("Failed to start task:",o)}},[r,a]),V=s.useCallback(async()=>{if(r){R(!0);try{await p.updateTask(r,{status:"running"}),a()}catch(o){console.error("Failed to resume task:",o)}finally{R(!1)}}},[r,a]),G=s.useCallback(async()=>{if(h==="editor"){S("agents");return}if(b===null){if(v)return;O(!0);try{const o=await p.createUserTerminal(r);_(o.user_window_index),a()}catch(o){console.error("Failed to create user terminal:",o);return}finally{O(!1)}}S("editor")},[h,b,r,v,a]);if(d)return e.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:"Loading..."});if(!t)return e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-4",children:[e.jsx("p",{className:"text-destructive",children:m||"Task not found"}),e.jsx(u,{variant:"outline",onClick:()=>x("/"),children:"Back to Dashboard"})]});const L=t.agents||[],N=t.status==="running",T=t.status==="draft",H=(t.status==="closed"||t.status==="error")&&!!t.worktree,Q=t.status==="running"||t.status==="setting_up",D=!!t.tmux_session&&L.length>0&&l!==null&&Q;return e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2 sm:px-4 sm:py-3",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[e.jsxs(u,{variant:"ghost",size:"sm",className:"shrink-0",onClick:()=>x("/"),children:[e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","data-icon":"inline-start",children:e.jsx("path",{d:"m15 18-6-6 6-6"})}),e.jsx("span",{className:"hidden sm:inline",children:"Back"})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h1",{className:"truncate text-base font-semibold sm:text-lg",children:t.title}),e.jsx(ce,{status:t.derived_status||t.status})]}),e.jsx("p",{className:"hidden max-w-xl truncate text-xs text-muted-foreground sm:block",children:t.description})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1 sm:gap-2",children:[t.pr_url&&e.jsxs("a",{href:t.pr_url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-400 hover:underline sm:text-sm",children:["PR #",t.pr_number]}),H&&e.jsx(u,{variant:"outline",size:"sm",disabled:C,onClick:V,children:C?"...":"Resume"}),N&&!!t.tmux_session&&e.jsxs(u,{variant:h==="editor"?"default":"outline",size:"sm",onClick:G,children:[e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"16 18 22 12 16 6"}),e.jsx("polyline",{points:"8 6 2 12 8 18"})]}),e.jsx("span",{className:"hidden sm:inline",children:"Editor"})]}),T&&e.jsx(u,{variant:"outline",size:"sm",onClick:M,children:"Start"}),N&&e.jsx(u,{variant:"outline",size:"sm",onClick:A,children:"Close"})]})]}),t.error&&e.jsx("div",{className:"border-b border-destructive/30 bg-destructive/10 px-4 py-2 text-sm text-destructive",children:t.error}),e.jsxs("div",{className:"border-b border-border",children:[e.jsxs("button",{onClick:()=>E(o=>!o),className:"flex w-full items-center gap-1.5 px-4 py-1.5 text-xs text-muted-foreground hover:bg-muted/50",children:[e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:`transition-transform ${f?"rotate-90":""}`,children:e.jsx("path",{d:"m9 18 6-6-6-6"})}),"Details"]}),f&&e.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-6 gap-y-1 px-4 pb-3 text-xs",children:[t.repo_path&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:"Repo"}),e.jsx("span",{className:"font-mono text-muted-foreground",children:t.repo_path})]}),t.branch&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:"Branch"}),e.jsx("span",{className:"font-mono text-muted-foreground",children:t.branch})]}),t.base_branch&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:"Base"}),e.jsx(ue,{variant:"outline",className:"w-fit text-xs font-normal",children:t.base_branch})]}),t.description&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:"Description"}),e.jsx("span",{className:"whitespace-pre-wrap text-muted-foreground",children:t.description})]}),t.pr_url&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:"PR"}),e.jsxs("a",{href:t.pr_url,target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 hover:underline",children:["#",t.pr_number," — ",t.pr_url]})]}),t.created_at&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:"Created"}),e.jsx("span",{className:"text-muted-foreground",children:new Date(t.created_at).toLocaleString()})]}),t.updated_at&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:"Updated"}),e.jsx("span",{className:"text-muted-foreground",children:new Date(t.updated_at).toLocaleString()})]})]})]}),D?e.jsxs("div",{className:h==="agents"?"flex min-h-0 flex-1 flex-col":"hidden",children:[e.jsx(pe,{agents:L,activeIndex:l,onSelect:g,onAddAgent:B,onStopAgent:U,canAddAgent:N}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden p-2",children:e.jsx(Y,{taskId:t.id,windowIndex:l,visible:h==="agents"})})]}):T?e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx(ge,{task:t,onSaved:a,onStart:M})}):e.jsx("div",{className:h==="agents"?"flex flex-1 items-center justify-center text-muted-foreground":"hidden",children:t.status==="setting_up"?"Setting up terminal...":t.status==="closed"||t.status==="error"?"Terminal session ended":"No terminal available"}),b!==null&&h==="editor"&&e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden p-2",children:e.jsx(Y,{taskId:t.id,windowIndex:b})})})]})}export{Ce as default};