#!/usr/bin/env node
import {b}from'./chunk-J6KWGCHN.js';import {e,f,c,d,l,h,g,k,i,m as m$1,o,n,j,b as b$1,a as a$1}from'./chunk-AO7ZSRME.js';import {a}from'./chunk-Y4XFVDZC.js';import*as $ from'fs';import*as m from'path';import e$1 from'chalk';import E from'prompts';function F(){return process.env.CLAUDE_CODE==="1"||process.env.TERM_PROGRAM==="claude"?false:!!(process.env.TERM_PROGRAM==="cursor"||process.env.CURSOR_SESSION||process.env.CURSOR_TRACE_ID||process.env.VSCODE_CWD&&process.env.VSCODE_CWD.toLowerCase().includes("cursor")||process.env.VSCODE_NLS_CONFIG&&process.env.VSCODE_NLS_CONFIG.toLowerCase().includes("cursor")||process.env.TERM_PROGRAM==="vscode"&&process.env.VSCODE_GIT_ASKPASS_NODE?.toLowerCase().includes("cursor")||process.stdin.isTTY)}async function T(g){let n=new a(g),c=await n.discover();console.log(e$1.cyan(`
  Configure Agent Models
`)),console.log(e$1.gray(`    Environment: ${c.source}`)),console.log(e$1.gray(`    Available: ${c.models.length} models
`));let i={},o=n.groupByTier(c.models),a$2=t=>{let r=a$1[t],s=r.tier==="high"?o.high:r.tier==="medium"?o.medium:o.low,l=[];for(let f of s){let P=l.length===0;l.push({title:P?`${f.name} (recommended)`:f.name,value:f.id,description:`${f.provider} - ${r.tier} tier`});}let u=o.high.filter(f=>!s.includes(f)),y=o.medium.filter(f=>!s.includes(f)),v=o.low.filter(f=>!s.includes(f));for(let f of u)l.push({title:f.name,value:f.id,description:`${f.provider} - high tier`});for(let f of y)l.push({title:f.name,value:f.id,description:`${f.provider} - medium tier`});for(let f of v)l.push({title:f.name,value:f.id,description:`${f.provider} - low tier`});return l};for(let t of ["architect","builder","tester","reviewer","security"]){let r=a$1[t],s=t.charAt(0).toUpperCase()+t.slice(1),l=a$2(t),u=await E({type:"select",name:"model",message:`${s} (${r.description})`,choices:l,initial:0},{onCancel:()=>{console.log(e$1.yellow(`
  Cancelled. Using defaults.
`)),process.exit(0);}});i[t]={id:u.model},console.log(e$1.green(`    \u2713 ${s}: ${u.model}
`));}return i}async function U(g,n){let c=g?m.resolve(g):process.cwd(),i=e(c),o=new a(c);n.refresh&&o.clearCache();let a$1=await o.discover();if(n.json){let r={};if(i?.agents)for(let[s,l]of Object.entries(i.agents))r[s]=l.defaultModel||"default";console.log(JSON.stringify({environment:a$1.source,cached:a$1.cached,agents:r,available:a$1.models},null,2));return}if(console.log(e$1.cyan(`
  Agent Model Configuration
`)),console.log(e$1.gray(`    Environment: ${a$1.source}${a$1.cached?" (cached)":""}`)),console.log(e$1.gray(`    Available models: ${a$1.models.length}
`)),console.log("    Current assignments:"),console.log(e$1.gray("    \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510")),console.log(e$1.gray("    \u2502 Agent       \u2502 Model                 \u2502")),console.log(e$1.gray("    \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524")),i?.agents)for(let[r,s]of Object.entries(i.agents)){let l=s.defaultModel||"default",u=r.padEnd(11),y=l.padEnd(21);console.log(e$1.gray("    \u2502 ")+e$1.white(u)+e$1.gray(" \u2502 ")+e$1.yellow(y)+e$1.gray(" \u2502"));}else console.log(e$1.gray("    \u2502 (no agents configured)             \u2502"));console.log(e$1.gray(`    \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518
`));let t=o.groupByTier(a$1.models);if(console.log(e$1.cyan(`    Available models by tier:
`)),t.high.length>0){console.log(e$1.yellow("    High (complex reasoning):"));for(let r of t.high.slice(0,5))console.log(e$1.gray(`      - ${r.name} (${r.provider})`));t.high.length>5&&console.log(e$1.gray(`      ... and ${t.high.length-5} more`)),console.log();}if(t.medium.length>0){console.log(e$1.blue("    Medium (balanced):"));for(let r of t.medium.slice(0,5))console.log(e$1.gray(`      - ${r.name} (${r.provider})`));t.medium.length>5&&console.log(e$1.gray(`      ... and ${t.medium.length-5} more`)),console.log();}if(t.low.length>0){console.log(e$1.green("    Low (fast & cheap):"));for(let r of t.low.slice(0,5))console.log(e$1.gray(`      - ${r.name} (${r.provider})`));t.low.length>5&&console.log(e$1.gray(`      ... and ${t.low.length-5} more`)),console.log();}if(process.stdin.isTTY&&!n.json){console.log(e$1.gray("    \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));let{action:r}=await E({type:"select",name:"action",message:"What would you like to do?",choices:[{title:"Reconfigure all models",value:"all"},{title:"Exit",value:"exit"}],initial:1});if(r==="all"&&i){let s=await T(c);for(let[l,u]of Object.entries(s))i.agents[l]&&(i.agents[l].defaultModel=I(u.id));f(c,i),console.log(e$1.green(`
    \u2713 Model configuration updated.
`));}}}function I(g){let n=g.toLowerCase();return n.includes("opus")||n.includes("gpt-4")&&!n.includes("mini")&&!n.includes("nano")||n==="o3"||n.includes("o3")&&!n.includes("mini")||n.includes("o1")&&!n.includes("mini")||n.includes("-pro")&&!n.includes("mini")||n.includes("large")||n.includes("maverick")||n.includes("deepseek-r1")||n.includes("grok-3")&&!n.includes("mini")||n.includes("grok-2")&&!n.includes("mini")?"opus":n.includes("haiku")||n.includes("mini")||n.includes("nano")||n.includes("flash")||n.includes("scout")||n.includes("small")?"haiku":"sonnet"}async function oe(g,n){let c$1=g?m.resolve(g):process.cwd(),i=m.basename(c$1),o=c(c$1);if(n.json||console.log(e$1.blue(`
  Initialize Paradigm Team
`)),d(c$1)&&!n.force){n.json?console.log(JSON.stringify({error:"Team already configured",path:o})):(console.log(e$1.yellow(`  Team already configured at ${o}`)),console.log(e$1.gray(`  Use --force to reinitialize.
`)));return}let a;if((n.configureModels||F()&&n.noConfigureModels!==true)&&!n.json)try{a=await T(c$1);}catch{}let r=l(i,a);if(f(c$1,r),h(c$1,{current:null,queue:[],recent:[],blocked:[]}),n.json){let l={};for(let[u,y]of Object.entries(r.agents))l[u]=y.defaultModel||"default";console.log(JSON.stringify({success:true,path:o,agents:Object.keys(r.agents),models:l}));return}console.log(e$1.green(`  \u2713 Team configuration created
`)),console.log(e$1.gray(`    ${o}
`)),console.log(e$1.cyan("  Available agents:"));for(let[l,u]of Object.entries(r.agents)){let y=u.defaultModel||"default";console.log(`    ${e$1.yellow(l.padEnd(12))} ${e$1.gray(`(${y})`)} ${u.role.split(`
`)[0]}`);}console.log(e$1.cyan(`
  Next steps:`)),console.log(e$1.gray("    1. Review .paradigm/agents.yaml and customize roles")),console.log(e$1.gray("    2. Run `paradigm team models` to reconfigure models")),console.log(e$1.gray("    3. Run `paradigm team status` to see team state")),console.log(e$1.gray("    4. Use `paradigm team handoff --to <agent>` to hand off work\n"));}async function ne(g$1,n){let c=g$1?m.resolve(g$1):process.cwd();if(n.id)return L(c,n.id,n);if(n.running)return B(c,n);let i=e(c);if(!i){n.json?console.log(JSON.stringify({error:"Team not configured"})):console.log(e$1.yellow("\nTeam not configured. Run `paradigm team init` first.\n"));return}let o=g(c),a=k(c),r=new b(c).getRunning();if(n.json){console.log(JSON.stringify({team:i.team,agents:Object.keys(i.agents),current:o.current,queue:o.queue,pending_handoffs:a.length,running_orchestrations:r.length,recent:o.recent.slice(0,5)},null,2));return}if(console.log(e$1.blue(`
\u{1F465} Paradigm Team Status
`)),console.log(e$1.gray("\u2500".repeat(50))),console.log(e$1.white(`Team: ${i.team.name}`)),console.log(e$1.gray(`Agents: ${Object.keys(i.agents).join(", ")}`)),console.log(),r.length>0){console.log(e$1.cyan("Running Orchestrations:"));for(let s of r){let l=s.started?Math.floor((Date.now()-new Date(s.started).getTime())/6e4):0;console.log(`  ${e$1.yellow("\u25B6")} ${s.id}`),console.log(e$1.gray(`    ${s.task.slice(0,40)}${s.task.length>40?"...":""}`)),console.log(e$1.gray(`    Running for ${l}m | Mode: ${s.mode}`));}console.log(e$1.gray("\n  Use --running to see details, or `tail -f <output_file>` for logs")),console.log();}if(o.current){let s=Date.now()-new Date(o.current.started).getTime(),l=Math.floor(s/6e4);console.log(e$1.cyan("Current Agent:")),console.log(`  ${e$1.yellow(o.current.agent.toUpperCase())} - ${o.current.task}`),console.log(e$1.gray(`  Started ${l}m ago`)),o.current.symbols_touched.length>0&&console.log(e$1.gray(`  Touched: ${o.current.symbols_touched.join(", ")}`)),console.log();}else console.log(e$1.cyan("Current Agent:")),console.log(e$1.gray("  No active agent")),console.log();if(a.length>0){console.log(e$1.cyan("Pending Handoffs:"));for(let s of a)console.log(`  ${e$1.yellow(s.from)} \u2192 ${e$1.green(s.to)}: ${s.context.summary.substring(0,50)}...`);console.log(e$1.gray("\n  Run `paradigm team accept` to accept a handoff")),console.log();}if(o.queue.length>0){console.log(e$1.cyan("Queue:"));for(let s of o.queue)console.log(`  ${e$1.yellow(s.agent)} waiting for ${s.waiting_for}: ${s.task}`);console.log();}if(o.blocked.length>0){console.log(e$1.red("Blocked:"));for(let s of o.blocked)console.log(`  ${e$1.yellow(s.agent)}: ${s.reason}`);console.log();}if(o.recent.length>0){console.log(e$1.cyan("Recent Activity:"));for(let s of o.recent.slice(0,5)){let l=new Date(s.timestamp).toLocaleTimeString(),u=s.result==="success"?e$1.green("\u2713"):s.result==="failed"?e$1.red("\u2717"):s.result==="blocked"?e$1.yellow("\u2298"):e$1.gray("\u25CB"),y=s.handed_to?` \u2192 ${s.handed_to}`:"";console.log(`  ${u} ${l} ${e$1.gray(s.agent)}: ${s.task}${y}`);}console.log();}console.log(e$1.gray("\u2500".repeat(50))),console.log(e$1.gray("Commands: team status | team status --running | team diff <id> | team accept <id>")),console.log();}async function B(g,n){let c=new b(g),i=c.listOrchestrations({status:["running","pending"]}),o=c.listOrchestrations({status:"completed",limit:5});if(n.json){console.log(JSON.stringify({running:i,recently_completed:o},null,2));return}if(console.log(e$1.blue(`
\u{1F504} Running Orchestrations
`)),console.log(e$1.gray("\u2500".repeat(60))),i.length===0)console.log(e$1.gray("  No orchestrations currently running.")),console.log();else for(let a of i){let t=a.started?Math.floor((Date.now()-new Date(a.started).getTime())/6e4):0,r=a.status==="running"?e$1.yellow("\u25B6"):e$1.gray("\u25CB");console.log(`  ${r} ${e$1.cyan(a.id)}`),console.log(e$1.white(`    Task: ${a.task.slice(0,50)}${a.task.length>50?"...":""}`)),console.log(e$1.gray(`    Status: ${a.status} | Mode: ${a.mode} | Duration: ${t}m`)),console.log(e$1.gray(`    Output: ${a.outputFile}`)),console.log();}if(o.length>0){console.log(e$1.cyan("Recently Completed:"));for(let a of o){let t=a.status==="completed"?e$1.green("\u2713"):a.status==="failed"?e$1.red("\u2717"):a.status==="accepted"?e$1.green("\u2713\u2713"):e$1.gray("\u25CB");console.log(`  ${t} ${a.id} - ${a.task.slice(0,40)}${a.task.length>40?"...":""}`);}console.log();}console.log(e$1.gray("\u2500".repeat(60))),console.log(e$1.gray("Commands: team status <id> | team diff <id> | team accept <id>")),console.log();}async function L(g,n,c){let o=new b(g).getOrchestration(n);if(!o){c.json?console.log(JSON.stringify({error:"Orchestration not found",id:n})):console.log(e$1.red(`
Orchestration not found: ${n}
`));return}if(c.json){console.log(JSON.stringify(o,null,2));return}let a=o.status==="running"?e$1.yellow("\u25B6"):o.status==="completed"?e$1.green("\u2713"):o.status==="failed"?e$1.red("\u2717"):o.status==="accepted"?e$1.green("\u2713\u2713"):o.status==="rejected"?e$1.red("\u2717\u2717"):e$1.gray("\u25CB");if(console.log(),console.log(e$1.blue("\u2501".repeat(60))),console.log(e$1.blue(`  Orchestration: ${o.id}`)),console.log(e$1.blue("\u2501".repeat(60))),console.log(),console.log(`  Status: ${a} ${o.status}`),console.log(e$1.gray(`  Task: ${o.task}`)),console.log(e$1.gray(`  Mode: ${o.mode}`)),console.log(e$1.gray(`  Created: ${o.created}`)),o.started&&console.log(e$1.gray(`  Started: ${o.started}`)),o.completed&&console.log(e$1.gray(`  Completed: ${o.completed}`)),console.log(),o.parallelBuilderStats&&(console.log(e$1.cyan("  Parallel Builders:")),console.log(e$1.gray(`    Used file plan: ${o.parallelBuilderStats.usedFilePlan?"Yes":"No"}`)),console.log(e$1.gray(`    Sub-phases: ${o.parallelBuilderStats.totalSubPhases}`)),console.log(e$1.gray(`    Parallel builders: ${o.parallelBuilderStats.totalParallelBuilders}`)),console.log(e$1.gray(`    Files created: ${o.parallelBuilderStats.filesCreated}`)),console.log()),o.artifacts.length>0){console.log(e$1.cyan("  Artifacts:"));for(let t of o.artifacts){let r=t.action==="created"?e$1.green("+"):t.action==="modified"?e$1.yellow("~"):e$1.red("-");console.log(`    ${r} ${t.path}`);}console.log();}o.result&&(console.log(e$1.cyan("  Result:")),console.log(e$1.gray(`    Agents spawned: ${o.result.agentsSpawned}`)),console.log(e$1.gray(`    Total tokens: ${o.result.totalTokens.total}`)),console.log(e$1.gray(`    Total cost: $${o.result.totalCost.toFixed(4)}`)),console.log(e$1.gray(`    Duration: ${(o.result.duration_ms/1e3).toFixed(1)}s`)),console.log()),o.error&&(console.log(e$1.red(`  Error: ${o.error}`)),console.log()),console.log(e$1.gray(`  Output file: ${o.outputFile}`)),console.log(),o.status==="completed"&&(console.log(e$1.cyan("  Actions:")),console.log(e$1.gray(`    paradigm team diff ${o.id}    # View changes`)),console.log(e$1.gray(`    paradigm team accept ${o.id}  # Accept changes`)),console.log(e$1.gray(`    paradigm team reject ${o.id}  # Reject changes`)),console.log());}async function te(g$1,n){let c=g$1?m.resolve(g$1):process.cwd(),i$1=e(c);if(!i$1){n.json?console.log(JSON.stringify({error:"Team not configured"})):console.log(e$1.yellow("\nTeam not configured. Run `paradigm team init` first.\n"));return}let o$1=g(c);if(!i$1.agents[n.to]){n.json?console.log(JSON.stringify({error:"Unknown agent",agent:n.to,available:Object.keys(i$1.agents)})):(console.log(e$1.red(`
Unknown agent: ${n.to}`)),console.log(e$1.gray(`Available agents: ${Object.keys(i$1.agents).join(", ")}
`)));return}let a=o$1.current?.agent||i$1.team.default_agent,t=`${Date.now()}-${a}-${n.to}`,r={id:t,from:a,to:n.to,timestamp:new Date().toISOString(),status:"pending",completed:{symbols:o$1.current?.symbols_touched||[],artifacts:[]},context:{summary:n.summary||`Task handed off from ${a} to ${n.to}`,key_symbols:[],warnings:[]}};if(i(c,r),m$1(c,{agent:a,task:o$1.current?.task||"Unknown task",result:"success",handed_to:n.to}),o(c),n.json){console.log(JSON.stringify({success:true,handoff_id:t,from:a,to:n.to}));return}console.log(e$1.blue(`
\u270B Handoff Created
`)),console.log(e$1.gray("\u2500".repeat(50))),console.log(`  From: ${e$1.yellow(a)}`),console.log(`  To:   ${e$1.green(n.to)}`),console.log(`  ID:   ${e$1.gray(t)}`),console.log(e$1.gray("\u2500".repeat(50)));let s=i$1.agents[n.to];console.log(e$1.cyan(`
Target agent role:`));for(let l of s.role.split(`
`))console.log(e$1.gray(`  ${l}`));console.log(e$1.cyan(`
Next steps:`)),console.log(e$1.gray(`  1. The ${n.to} agent will see this handoff`)),console.log(e$1.gray(`  2. Run \`paradigm team accept\` as ${n.to} to accept`)),console.log();}async function se(g,n$1,c){let i$1=n$1?m.resolve(n$1):process.cwd(),o=e(i$1);if(!o){c.json?console.log(JSON.stringify({error:"Team not configured"})):console.log(e$1.yellow("\nTeam not configured. Run `paradigm team init` first.\n"));return}let a=k(i$1);if(a.length===0){c.json?console.log(JSON.stringify({error:"No pending handoffs"})):console.log(e$1.yellow(`
No pending handoffs to accept.
`));return}let t;if(g){if(t=a.find(s=>s.id===g),!t){c.json?console.log(JSON.stringify({error:"Handoff not found",id:g})):console.log(e$1.red(`
Handoff not found: ${g}
`));return}}else t=a[0];if(t.status="accepted",t.accepted_at=new Date().toISOString(),t.acceptance_note=c.note,i(i$1,t),n(i$1,t.to,`Accepted from ${t.from}: ${t.context.summary}`),c.json){console.log(JSON.stringify({success:true,handoff_id:t.id,agent:t.to,from:t.from,context:t.context}));return}if(console.log(e$1.blue(`
\u2713 Handoff Accepted
`)),console.log(e$1.gray("\u2500".repeat(50))),console.log(`  You are now: ${e$1.green(t.to.toUpperCase())}`),console.log(`  From:        ${e$1.yellow(t.from)}`),console.log(e$1.gray("\u2500".repeat(50))),console.log(e$1.cyan(`
Context from previous agent:`)),console.log(e$1.white(`  ${t.context.summary}`)),t.completed.symbols.length>0){console.log(e$1.cyan(`
Symbols touched:`));for(let s of t.completed.symbols)console.log(e$1.gray(`  \u2022 ${s}`));}if(t.context.warnings.length>0){console.log(e$1.yellow(`
Warnings:`));for(let s of t.context.warnings)console.log(e$1.yellow(`  \u26A0 ${s}`));}let r=o.agents[t.to];console.log(e$1.cyan(`
Your role:`));for(let s of r.role.split(`
`))console.log(e$1.gray(`  ${s}`));console.log();}async function le(g$1,n){let c=g$1?m.resolve(g$1):process.cwd(),i=e(c);if(!i){n.json?console.log(JSON.stringify({error:"Team not configured"})):console.log(e$1.yellow("\nTeam not configured. Run `paradigm team init` first.\n"));return}let o=g(c),a=k(c),t=[];for(let r of a){let s=Date.now()-new Date(r.timestamp).getTime(),l=Math.floor(s/36e5);l>24&&t.push({type:"stale_handoff",message:`Handoff from ${r.from} to ${r.to} pending for ${l}h`,severity:"warning"});}for(let r of o.blocked)t.push({type:"blocked_agent",message:`${r.agent} blocked: ${r.reason}`,severity:"error"});if(o.current){let r=Date.now()-new Date(o.current.started).getTime(),s=Math.floor(r/36e5);s>8&&t.push({type:"long_task",message:`Current task running for ${s}h - consider handing off`,severity:"warning"});}for(let[r,s]of Object.entries(i.agents))for(let l of s.handoff_to)i.agents[l]||t.push({type:"invalid_handoff",message:`${r} can handoff to unknown agent: ${l}`,severity:"error"});if(n.json){console.log(JSON.stringify({issues:t,current:o.current,pending_count:a.length},null,2));return}if(console.log(e$1.blue(`
\u{1F50D} Team Health Check
`)),console.log(e$1.gray("\u2500".repeat(50))),t.length===0)console.log(e$1.green(`\u2713 No issues found
`));else {console.log(e$1.yellow(`Found ${t.length} issue(s):
`));for(let r of t){let s=r.severity==="error"?e$1.red("\u2717"):e$1.yellow("\u26A0");console.log(`  ${s} ${r.message}`);}console.log();}console.log(e$1.cyan("Status:")),console.log(`  Current agent: ${o.current?e$1.green(o.current.agent):e$1.gray("none")}`),console.log(`  Pending handoffs: ${a.length}`),console.log(`  Blocked agents: ${o.blocked.length}`),console.log();}async function re(g$1,n){let c=g$1?m.resolve(g$1):process.cwd();if(!e(c)){n.json?console.log(JSON.stringify({error:"Team not configured"})):console.log(e$1.yellow("\nTeam not configured. Run `paradigm team init` first.\n"));return}let o=g(c),a=j(c),t=n.limit||50,r=[];for(let l of o.recent)r.push({timestamp:l.timestamp,type:"activity",agent:l.agent,description:l.task,details:{result:l.result,handed_to:l.handed_to,artifacts:l.artifacts}});for(let l of a)r.push({timestamp:l.timestamp,type:"handoff",agent:l.from,description:`Handoff to ${l.to}: ${l.context.summary}`,details:{to:l.to,status:l.status,symbols:l.completed.symbols}});r.sort((l,u)=>new Date(u.timestamp).getTime()-new Date(l.timestamp).getTime());let s=r.slice(0,t);if(n.json){console.log(JSON.stringify({total:r.length,showing:s.length,timeline:s},null,2));return}if(console.log(e$1.blue(`
\u{1F4DC} Team History
`)),console.log(e$1.gray("\u2500".repeat(60))),s.length===0){console.log(e$1.gray(`No activity recorded yet.
`));return}for(let l of s){let u=new Date(l.timestamp).toLocaleString(),y=l.type==="handoff"?"\u270B":l.details?.result==="success"?"\u2713":l.details?.result==="failed"?"\u2717":"\u25CB",v=l.type==="handoff"?e$1.cyan:l.details?.result==="success"?e$1.green:l.details?.result==="failed"?e$1.red:e$1.gray;console.log(`${v(y)} ${e$1.gray(u)}`),console.log(`  ${e$1.yellow(l.agent)}: ${l.description}`),l.details?.handed_to&&console.log(e$1.gray(`  \u2192 handed to ${l.details.handed_to}`)),l.details?.symbols&&l.details.symbols.length>0&&console.log(e$1.gray(`  symbols: ${l.details.symbols.join(", ")}`)),console.log();}r.length>t&&console.log(e$1.gray(`Showing ${t} of ${r.length} entries. Use --limit to see more.
`));}async function ae(g$1,n){let c=g$1?m.resolve(g$1):process.cwd();if(!e(c)){n.json?console.log(JSON.stringify({error:"Team not configured"})):console.log(e$1.yellow("\nTeam not configured. Run `paradigm team init` first.\n"));return}let o=g(c),a=k(c);if(!n.force&&(o.current||a.length>0)){n.json?console.log(JSON.stringify({error:"Has pending work",current:o.current,pending_handoffs:a.length})):(console.log(e$1.yellow(`
\u26A0 Cannot reset - there is pending work:
`)),o.current&&console.log(`  Current: ${o.current.agent} working on "${o.current.task}"`),a.length>0&&console.log(`  Pending handoffs: ${a.length}`),console.log(e$1.gray(`
Use --force to reset anyway.
`)));return}h(c,{current:null,queue:[],recent:[],blocked:[]});let r=m.join(b$1(c),"handoffs");if(n.force&&$.existsSync(r)){let s=$.readdirSync(r);for(let l of s)$.unlinkSync(m.join(r,l));}if(n.json){console.log(JSON.stringify({success:true,cleared_handoffs:n.force}));return}console.log(e$1.green(`
\u2713 Team state reset
`)),console.log(e$1.gray("  Current agent: cleared")),console.log(e$1.gray("  Activity log: cleared")),console.log(e$1.gray("  Queue: cleared")),n.force&&console.log(e$1.gray("  Handoff files: deleted")),console.log(e$1.gray("\nReady for fresh start. Run `paradigm team status` to verify.\n"));}export{U as a,oe as b,ne as c,te as d,se as e,le as f,re as g,ae as h};