agentnetes 0.1.7 → 0.1.9

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 (68) hide show
  1. package/dist/index.js +94 -85
  2. package/package.json +2 -2
  3. package/web/.next/BUILD_ID +1 -1
  4. package/web/.next/build-manifest.json +3 -3
  5. package/web/.next/prerender-manifest.json +0 -28
  6. package/web/.next/server/app/_global-error.html +1 -1
  7. package/web/.next/server/app/_global-error.rsc +1 -1
  8. package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  9. package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  10. package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  11. package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  12. package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  14. package/web/.next/server/app/_not-found.html +1 -1
  15. package/web/.next/server/app/_not-found.rsc +2 -2
  16. package/web/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  17. package/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  18. package/web/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  19. package/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  20. package/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  21. package/web/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  22. package/web/.next/server/app/demo/page_client-reference-manifest.js +1 -1
  23. package/web/.next/server/app/demo.html +1 -1
  24. package/web/.next/server/app/demo.rsc +3 -3
  25. package/web/.next/server/app/demo.segments/_full.segment.rsc +3 -3
  26. package/web/.next/server/app/demo.segments/_head.segment.rsc +1 -1
  27. package/web/.next/server/app/demo.segments/_index.segment.rsc +2 -2
  28. package/web/.next/server/app/demo.segments/_tree.segment.rsc +2 -2
  29. package/web/.next/server/app/demo.segments/demo/__PAGE__.segment.rsc +2 -2
  30. package/web/.next/server/app/demo.segments/demo.segment.rsc +1 -1
  31. package/web/.next/server/app/docs/page_client-reference-manifest.js +1 -1
  32. package/web/.next/server/app/docs.html +3 -3
  33. package/web/.next/server/app/docs.rsc +3 -3
  34. package/web/.next/server/app/docs.segments/_full.segment.rsc +3 -3
  35. package/web/.next/server/app/docs.segments/_head.segment.rsc +1 -1
  36. package/web/.next/server/app/docs.segments/_index.segment.rsc +2 -2
  37. package/web/.next/server/app/docs.segments/_tree.segment.rsc +2 -2
  38. package/web/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +2 -2
  39. package/web/.next/server/app/docs.segments/docs.segment.rsc +1 -1
  40. package/web/.next/server/app/index.html +1 -1
  41. package/web/.next/server/app/index.rsc +3 -3
  42. package/web/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  43. package/web/.next/server/app/index.segments/_full.segment.rsc +3 -3
  44. package/web/.next/server/app/index.segments/_head.segment.rsc +1 -1
  45. package/web/.next/server/app/index.segments/_index.segment.rsc +2 -2
  46. package/web/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  47. package/web/.next/server/app/page_client-reference-manifest.js +1 -1
  48. package/web/.next/server/chunks/[root-of-the-server]__0h9pqwt._.js +1 -1
  49. package/web/.next/server/chunks/[root-of-the-server]__0j8_mc~._.js +23 -23
  50. package/web/.next/server/chunks/ssr/app_demo_page_tsx_0.31s93._.js +2 -2
  51. package/web/.next/server/chunks/ssr/app_docs_page_tsx_0a3qz3_._.js +1 -1
  52. package/web/.next/server/chunks/ssr/app_page_tsx_0es_sk2._.js +1 -1
  53. package/web/.next/server/middleware-build-manifest.js +3 -3
  54. package/web/.next/server/pages/404.html +1 -1
  55. package/web/.next/server/pages/500.html +1 -1
  56. package/web/.next/static/chunks/02fb.n1lz42au.css +3 -0
  57. package/web/.next/static/chunks/0jq5vvqp4k_30.js +1 -0
  58. package/web/.next/static/chunks/0o4.v~utr5rij.js +185 -0
  59. package/web/.next/static/chunks/{08845o78x1i1w.js → 0uksyqmbyr9u_.js} +5 -5
  60. package/web/package.json +6 -3
  61. package/web/.next/server/app/api/config.body +0 -1
  62. package/web/.next/server/app/api/config.meta +0 -1
  63. package/web/.next/static/chunks/00gs7ywo3p_-j.css +0 -3
  64. package/web/.next/static/chunks/00pksrk9b32qm.js +0 -1
  65. package/web/.next/static/chunks/07h.efnrmr0xe.js +0 -185
  66. /package/web/.next/static/{SMcLeSYWNCOVrWD-oXgfW → 1jHD4Io184UO0XmrdHDL_}/_buildManifest.js +0 -0
  67. /package/web/.next/static/{SMcLeSYWNCOVrWD-oXgfW → 1jHD4Io184UO0XmrdHDL_}/_clientMiddlewareManifest.js +0 -0
  68. /package/web/.next/static/{SMcLeSYWNCOVrWD-oXgfW → 1jHD4Io184UO0XmrdHDL_}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
- module.exports=[58689,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(38246),e=a.i(71987),f=a.i(70106);let g=(0,f.default)("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]),h=["Audit all dependencies for known CVEs and outdated versions","Add rate limiting middleware with configurable limits per route","Find all TODO and FIXME comments and summarise what needs to be done","Add input validation and sanitisation to every request handler"],i=["Add a new provider package with streaming and tool-use support","Find security vulnerabilities in the authentication flow","Refactor the router module to improve test coverage","Generate TypeScript types for all public API endpoints"];function j({content:a}){let c=a.split("\n");return(0,b.jsx)("div",{className:"prose text-base space-y-1.5",children:c.map((a,c)=>{if(a.startsWith("## "))return(0,b.jsx)("h2",{className:"text-lg font-semibold text-white mt-3 mb-1",children:a.slice(3)},c);if(a.startsWith("### "))return(0,b.jsx)("h3",{className:"text-base font-semibold text-white mt-2",children:a.slice(4)},c);if(a.startsWith("- ")){let d=a.slice(2).replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/`(.*?)`/g,"<code>$1</code>");return(0,b.jsx)("li",{className:"ml-4 text-white/80",dangerouslySetInnerHTML:{__html:d}},c)}if(a.startsWith("**Goal:**"))return(0,b.jsxs)("p",{className:"text-white/65",children:[(0,b.jsx)("strong",{className:"text-white",children:"Goal:"}),a.slice(9)]},c);if(""===a.trim())return(0,b.jsx)("div",{className:"h-1"},c);let d=a.replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/`(.*?)`/g,"<code>$1</code>");return(0,b.jsx)("p",{className:"text-white/80",dangerouslySetInnerHTML:{__html:d}},c)})})}function k({onSubmit:a,messages:d,isRunning:f,mode:l="real"}){let[m,n]=(0,c.useState)(""),o=(0,c.useRef)(null);return(0,c.useEffect)(()=>{o.current?.scrollIntoView({behavior:"smooth"})},[d]),(0,b.jsxs)("div",{className:"h-full flex flex-col",children:[(0,b.jsxs)("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[0===d.length&&(0,b.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-center px-4",children:[(0,b.jsx)(e.default,{src:`${process.env.NEXT_PUBLIC_BASE_PATH??""}/logo.png`,alt:"Agentnetes",width:72,height:72,className:"rounded-2xl mb-6 animate-float"}),(0,b.jsx)("h2",{className:"text-white text-2xl font-extrabold tracking-tight mb-2",children:"Agentnetes"}),(0,b.jsx)("p",{className:"text-white/70 text-base mb-1.5 max-w-md",children:"simulation"===l?"Watch the swarm in action · no setup needed.":"Self-organizing agents · real Docker sandboxes."}),(0,b.jsx)("p",{className:"text-white/40 text-sm mb-10 max-w-md",children:"simulation"===l?"Pre-scripted scenarios showing real event sequences.":"Agents clone your repo, run shell commands, and deliver results."}),(0,b.jsx)("div",{className:"space-y-2.5 w-full max-w-md",children:("simulation"===l?i:h).map((a,c)=>(0,b.jsx)("button",{onClick:()=>n(a),className:"w-full text-left text-sm text-white/60 border border-white/10 rounded-xl px-4 py-3 hover:border-white/20 hover:text-white/80 transition-all card-hover bg-white/[0.03]",children:a},c))})]}),d.map((a,c)=>(0,b.jsx)("div",{className:`flex ${"user"===a.role?"justify-end":"justify-start"}`,children:"user"===a.role?(0,b.jsx)("div",{className:"max-w-[80%] border border-white/15 rounded-2xl rounded-br-sm px-5 py-3 text-base",style:{background:"var(--bg-hover)"},children:a.content}):(0,b.jsx)("div",{className:"max-w-[90%] border border-white/[0.06] rounded-2xl rounded-bl-sm px-5 py-4",style:{background:"var(--bg-panel)"},children:(0,b.jsx)(j,{content:a.content})})},c)),f&&(0,b.jsx)("div",{className:"flex justify-start",children:(0,b.jsx)("div",{className:"border border-white/[0.06] rounded-2xl rounded-bl-sm px-5 py-4",style:{background:"var(--bg-panel)"},children:(0,b.jsxs)("div",{className:"flex items-center gap-2 text-white/55 text-sm font-mono",children:[(0,b.jsx)("span",{className:"w-2 h-2 bg-yellow-400 rounded-full animate-pulse"}),"Agents working..."]})})}),(0,b.jsx)("div",{ref:o})]}),(0,b.jsx)("div",{className:"p-4 border-t border-white/[0.07]",children:(0,b.jsxs)("form",{onSubmit:function(b){b.preventDefault(),m.trim()&&!f&&(a(m.trim()),n(""))},className:"flex gap-3",children:[(0,b.jsx)("input",{value:m,onChange:a=>n(a.target.value),disabled:f,placeholder:"simulation"===l?"Describe a task for the simulated swarm...":"Give the agents a goal for your repo...",className:"flex-1 bg-white/[0.04] border border-white/15 rounded-xl px-5 py-3 text-base text-white placeholder-white/30 outline-none focus:border-white/30 disabled:opacity-50 transition-colors"}),(0,b.jsx)("button",{type:"submit",disabled:!m.trim()||f,className:"bg-white text-black rounded-xl px-4 py-3 hover:bg-[#e0e0e0] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:(0,b.jsx)(g,{size:18})})]})})]})}let l=(0,f.default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);var m=a.i(50522),n=a.i(80386);let o=(0,f.default)("file-code",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]]),p=(0,f.default)("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),q=(0,f.default)("hexagon",[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}]]);function r({status:a}){return(0,b.jsx)("span",{className:`inline-block w-2 h-2 rounded-full shrink-0 ${{pending:"bg-white/20",running:"bg-yellow-400 animate-pulse shadow-[0_0_6px_rgba(250,204,21,0.6)]",completed:"bg-green-400 shadow-[0_0_6px_rgba(74,222,128,0.5)]",failed:"bg-red-400"}[a]}`})}function s({artifact:a,onClick:c}){return(0,b.jsxs)("button",{onClick:c,className:"flex items-center gap-1.5 text-xs font-mono bg-[#0d1117] border border-[#30363d] text-[#7dd3fc] px-2.5 py-1.5 rounded-md hover:border-[#58a6ff] hover:bg-[#161b22] transition-colors",children:[(0,b.jsx)(o,{size:12}),a.filename.split("/").pop()]})}function t({artifact:a,onClose:c}){let d=a.content.split("\n");return(0,b.jsx)("div",{className:"fixed inset-0 bg-black/80 z-50 flex items-center justify-center p-6 backdrop-blur-sm",onClick:c,children:(0,b.jsxs)("div",{className:"w-full max-w-3xl max-h-[80vh] flex flex-col bg-[#0d1117] border border-[#30363d] rounded-xl overflow-hidden shadow-2xl",onClick:a=>a.stopPropagation(),children:[(0,b.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[#21262d] shrink-0",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(o,{size:14,className:"text-[#7dd3fc]"}),(0,b.jsx)("span",{className:"text-sm font-mono text-[#e6edf3]",children:a.filename}),(0,b.jsx)("span",{className:"text-xs text-[#555] bg-[#161b22] border border-[#21262d] px-1.5 py-0.5 rounded",children:a.language})]}),(0,b.jsx)("button",{onClick:c,className:"text-[#555] hover:text-white text-lg leading-none",children:"×"})]}),(0,b.jsx)("div",{className:"overflow-auto flex-1 p-4",children:(0,b.jsx)("div",{className:"font-mono text-sm leading-5",children:d.map((a,c)=>(0,b.jsxs)("div",{className:"flex gap-4 hover:bg-[#161b22] px-2 rounded",children:[(0,b.jsx)("span",{className:"text-[#555] w-6 shrink-0 select-none text-right",children:c+1}),(0,b.jsx)("span",{className:"text-[#e6edf3] whitespace-pre",children:a})]},c))})})]})})}function u({task:a,onClose:d}){var e;let f,g,h=(g=(e=a).role.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,""),{name:e.role,description:e.goal,url:`https://agentnetes.vercel.app/agents/${g}`,version:"1.0.0",provider:{organization:"Agentnetes"},capabilities:{streaming:!0,pushNotifications:!1,stateTransitionHistory:!0},authentication:{schemes:["bearer"]},defaultInputModes:["text/plain","application/json"],defaultOutputModes:["text/plain","application/json"],skills:(f=e.role.toLowerCase()).includes("scout")||f.includes("explorer")||f.includes("architect")?[{id:"explore-codebase",name:"Explore Codebase",description:"Scans a repository and documents architecture patterns, interface contracts, and file conventions",tags:["codebase","architecture","typescript","monorepo"],examples:["Explore the provider package structure in vercel/ai","Document interface contracts for LanguageModelV1","Find all test patterns across packages"]},{id:"map-dependencies",name:"Map Dependencies",description:"Traces dependency graphs across a monorepo and identifies shared utilities",tags:["dependencies","monorepo","pnpm"],examples:["Map all workspace dependencies in vercel/ai","Find all packages that depend on @ai-sdk/provider"]}]:f.includes("provider")||f.includes("implement")||f.includes("engineer")?[{id:"implement-provider",name:"Implement Provider",description:"Creates a new AI SDK provider package following existing patterns — provider class, chat model, streaming",tags:["typescript","ai-sdk","provider","streaming"],examples:["Add @ai-sdk/deepseek with streaming and reasoning tokens","Implement a new OpenAI-compatible provider","Add tool-calling support to an existing provider"]},{id:"implement-feature",name:"Implement Feature",description:"Builds a software feature in an existing codebase following discovered conventions",tags:["typescript","implementation","feature"],examples:["Add a /research command to a CLI tool","Implement a new API endpoint following existing patterns"]}]:f.includes("test")||f.includes("verif")||f.includes("qa")?[{id:"write-tests",name:"Write Tests",description:"Writes comprehensive tests following the codebase test conventions — unit, integration, streaming",tags:["vitest","testing","typescript","coverage"],examples:["Write tests for a new provider package","Add streaming tests for a chat model","Write integration tests for a new API endpoint"]},{id:"run-verification",name:"Run Verification",description:"Runs tests, type checks, and linting to verify correctness. Reports failures with context.",tags:["typescript","vitest","tsc","verification"],examples:["Verify TypeScript compilation passes","Run all tests and report failures"]}]:f.includes("package")||f.includes("config")||f.includes("integrat")?[{id:"setup-package",name:"Setup Package",description:"Configures package.json, tsconfig.json, exports, and monorepo wiring for a new package",tags:["monorepo","pnpm","typescript","package"],examples:["Set up a new @ai-sdk/* package from scratch","Configure ESM + CJS dual exports","Wire a new package into pnpm workspace"]}]:f.includes("security")||f.includes("scanner")||f.includes("auth")||f.includes("risk")?[{id:"security-audit",name:"Security Audit",description:"Analyzes code for security vulnerabilities — auth flows, input validation, dependency CVEs",tags:["security","audit","vulnerabilities","owasp"],examples:["Audit authentication flows for session fixation","Scan dependencies for known CVEs","Find XSS vulnerabilities in user input handling"]}]:[{id:"general-task",name:"General Engineering Task",description:"Performs software engineering tasks — exploration, implementation, verification",tags:["typescript","engineering"],examples:["Implement a requested feature following existing patterns"]}]}),i=JSON.stringify(h,null,2),[j,k]=(0,c.useState)(!1);return(0,b.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6 backdrop-blur-md",style:{background:"rgba(0,0,0,0.85)"},onClick:d,children:(0,b.jsxs)("div",{className:"w-full max-w-2xl max-h-[90vh] flex flex-col rounded-2xl overflow-hidden shadow-2xl border border-purple-500/20",style:{background:"var(--bg-base)"},onClick:a=>a.stopPropagation(),children:[(0,b.jsxs)("div",{className:"px-6 py-5 border-b border-white/[0.08] shrink-0",style:{background:"linear-gradient(135deg, rgba(168,85,247,0.08), rgba(236,72,153,0.05))"},children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center text-lg",style:{background:"linear-gradient(135deg, rgba(168,85,247,0.2), rgba(236,72,153,0.15))",border:"1px solid rgba(168,85,247,0.3)"},children:a.icon}),(0,b.jsxs)("div",{children:[(0,b.jsx)("h2",{className:"text-white font-bold text-lg",children:a.role}),(0,b.jsx)("p",{className:"text-white/50 text-sm font-mono mt-0.5",children:h.url})]})]}),(0,b.jsx)("button",{onClick:d,className:"text-white/30 hover:text-white/70 transition-colors text-xl leading-none p-1",children:"✕"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-xs font-mono px-2.5 py-1 rounded-full font-semibold",style:{background:"linear-gradient(135deg, rgba(168,85,247,0.2), rgba(236,72,153,0.15))",border:"1px solid rgba(168,85,247,0.3)",color:"#c084fc"},children:"A2A Agent Card"}),(0,b.jsxs)("span",{className:"text-xs font-mono text-white/30",children:["v",h.version]}),(0,b.jsx)("span",{className:"text-xs font-mono text-white/30",children:"·"}),(0,b.jsx)("span",{className:"text-xs font-mono text-emerald-400/70",children:"streaming"}),(0,b.jsx)("span",{className:"text-xs font-mono text-white/30",children:"·"}),(0,b.jsxs)("span",{className:"text-xs font-mono text-white/30",children:[h.authentication.schemes[0]," auth"]})]})]}),(0,b.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[(0,b.jsxs)("div",{className:"px-6 py-4 border-b border-white/[0.06]",children:[(0,b.jsx)("p",{className:"text-xs font-mono text-white/40 uppercase tracking-widest mb-2",children:"Description"}),(0,b.jsx)("p",{className:"text-white/80 text-sm leading-relaxed",children:h.description})]}),(0,b.jsxs)("div",{className:"px-6 py-4 border-b border-white/[0.06]",children:[(0,b.jsx)("p",{className:"text-xs font-mono text-white/40 uppercase tracking-widest mb-3",children:"Capabilities"}),(0,b.jsx)("div",{className:"grid grid-cols-3 gap-3",children:[{label:"Streaming",value:h.capabilities.streaming,color:"emerald"},{label:"Push Notifications",value:h.capabilities.pushNotifications,color:"yellow"},{label:"State History",value:h.capabilities.stateTransitionHistory,color:"blue"}].map(a=>(0,b.jsxs)("div",{className:"rounded-xl border border-white/[0.08] px-3 py-2.5 text-center",style:{background:"var(--bg-card)"},children:[(0,b.jsx)("div",{className:`text-sm font-mono font-semibold ${a.value?`text-${a.color}-400`:"text-white/20"}`,children:a.value?"✓":"✗"}),(0,b.jsx)("div",{className:"text-xs text-white/50 mt-1",children:a.label})]},a.label))})]}),(0,b.jsxs)("div",{className:"px-6 py-4 border-b border-white/[0.06]",children:[(0,b.jsx)("p",{className:"text-xs font-mono text-white/40 uppercase tracking-widest mb-3",children:"Skills"}),(0,b.jsx)("div",{className:"space-y-3",children:h.skills.map(a=>(0,b.jsxs)("div",{className:"rounded-xl border border-white/[0.08] p-4",style:{background:"var(--bg-card)"},children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,b.jsx)("span",{className:"text-violet-400 font-semibold text-sm",children:a.name}),(0,b.jsx)("span",{className:"text-xs font-mono text-white/25",children:a.id})]}),(0,b.jsx)("p",{className:"text-sm text-white/60 leading-relaxed mb-3",children:a.description}),(0,b.jsx)("div",{className:"flex flex-wrap gap-1.5 mb-3",children:a.tags.map(a=>(0,b.jsx)("span",{className:"text-xs font-mono text-emerald-400/70 border border-emerald-500/20 bg-emerald-500/5 px-2 py-0.5 rounded-md",children:a},a))}),a.examples.length>0&&(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("p",{className:"text-xs text-white/30 font-mono",children:"Examples:"}),a.examples.map((a,c)=>(0,b.jsx)("div",{className:"text-sm text-white/50 pl-3 border-l-2 border-white/[0.06]",children:a},c))]})]},a.id))})]}),(0,b.jsxs)("div",{className:"px-6 py-4 border-b border-white/[0.06]",children:[(0,b.jsx)("p",{className:"text-xs font-mono text-white/40 uppercase tracking-widest mb-3",children:"Input / Output"}),(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-xs text-white/30 mb-1.5",children:"Input Modes"}),(0,b.jsx)("div",{className:"flex flex-wrap gap-1.5",children:h.defaultInputModes.map(a=>(0,b.jsx)("span",{className:"text-xs font-mono text-blue-400/70 border border-blue-500/20 bg-blue-500/5 px-2 py-0.5 rounded-md",children:a},a))})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-xs text-white/30 mb-1.5",children:"Output Modes"}),(0,b.jsx)("div",{className:"flex flex-wrap gap-1.5",children:h.defaultOutputModes.map(a=>(0,b.jsx)("span",{className:"text-xs font-mono text-orange-400/70 border border-orange-500/20 bg-orange-500/5 px-2 py-0.5 rounded-md",children:a},a))})]})]})]}),(0,b.jsxs)("div",{className:"px-6 py-4",children:[(0,b.jsxs)("button",{onClick:()=>k(a=>!a),className:"flex items-center gap-2 text-sm font-mono text-white/40 hover:text-white/70 transition-colors mb-3",children:[(0,b.jsx)(o,{size:14}),(0,b.jsxs)("span",{children:[j?"Hide":"Show"," agent-card.json"]}),j?(0,b.jsx)(l,{size:14}):(0,b.jsx)(m.ChevronRight,{size:14})]}),j&&(0,b.jsxs)("div",{className:"rounded-xl border border-white/[0.08] overflow-hidden",style:{background:"var(--bg-panel)"},children:[(0,b.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-white/[0.06]",children:[(0,b.jsx)("span",{className:"text-xs text-white/30 font-mono",children:"agent-card.json"}),(0,b.jsx)("span",{className:"text-xs text-white/20 font-mono",children:"A2A v1.0"})]}),(0,b.jsx)("div",{className:"p-4 font-mono text-sm leading-6 overflow-x-auto",children:i.split("\n").map((a,c)=>(0,b.jsxs)("div",{className:"flex gap-4 hover:bg-white/[0.02] px-2 rounded",children:[(0,b.jsx)("span",{className:"text-white/20 w-5 shrink-0 select-none text-right",children:c+1}),(0,b.jsx)("span",{dangerouslySetInnerHTML:{__html:a.replace(/"([^"]+)":/g,'<span class="text-[#79c0ff]">"$1"</span>:').replace(/: "([^"]*)"(,?)/g,': <span class="text-[#a5d6ff]">"$1"</span>$2').replace(/: (true|false)(,?)/g,': <span class="text-[#ff7b72]">$1</span>$2')},className:"whitespace-pre"})]},c))})]})]})]}),(0,b.jsxs)("div",{className:"px-6 py-4 border-t border-white/[0.08] flex items-center justify-between shrink-0",style:{background:"var(--bg-card)"},children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(p,{size:14,className:"text-purple-400/50"}),(0,b.jsxs)("span",{className:"text-sm text-white/40",children:[h.skills.length," skill",h.skills.length>1?"s":""," · Google A2A Protocol"]})]}),(0,b.jsx)("button",{onClick:d,className:"text-sm font-semibold px-5 py-2 rounded-xl transition-all hover:opacity-90",style:{background:"linear-gradient(135deg, #a855f7, #ec4899)",color:"#fff"},children:"Close"})]})]})})}function v({lines:a}){let d=(0,c.useRef)(null);return((0,c.useEffect)(()=>{d.current?.scrollTo({top:d.current.scrollHeight,behavior:"smooth"})},[a]),0===a.length)?null:(0,b.jsxs)("div",{className:"mt-2 border border-white/[0.06] rounded-lg overflow-hidden",style:{background:"var(--bg-panel)"},children:[(0,b.jsxs)("div",{className:"flex items-center gap-1.5 px-3 py-1.5 border-b border-white/[0.06]",children:[(0,b.jsx)(n.Terminal,{size:12,className:"text-white/30"}),(0,b.jsx)("span",{className:"text-xs text-white/35 font-mono uppercase tracking-wider",children:"sandbox"})]}),(0,b.jsx)("div",{ref:d,className:"max-h-32 overflow-y-auto p-3 space-y-0.5",children:a.map((a,c)=>(0,b.jsx)("div",{className:`text-sm font-mono leading-5 whitespace-pre-wrap ${a.startsWith("$")?"text-[#7dd3fc]":a.includes("error")||a.includes("FAIL")?"text-red-400":a.includes("✓")||a.includes("passed")?"text-green-400":"text-white/50"}`,children:a},c))})]})}function w({task:a,terminalLines:d,isCollabTarget:e,isCollabSource:f}){let[g,h]=(0,c.useState)(!1),[i,j]=(0,c.useState)(null),[k,n]=(0,c.useState)(!1),o=function(a,b=18){let[d,e]=(0,c.useState)(a),f=(0,c.useRef)(a);return(0,c.useEffect)(()=>{if(a===f.current)return;f.current=a,e("");let c=0,d=setInterval(()=>{c++,e(a.slice(0,c)),c>=a.length&&clearInterval(d)},b);return()=>clearInterval(d)},[a,b]),d}(a.statusText,20),q=e?"border-purple-500/60 shadow-[0_0_12px_rgba(168,85,247,0.25)]":f?"border-purple-400/40":"running"===a.status?"border-yellow-500/40 shadow-[0_0_8px_rgba(234,179,8,0.1)]":"completed"===a.status?"border-green-500/25":"failed"===a.status?"border-red-500/25":"border-white/[0.06]",x="running"===a.status?"bg-yellow-500/[0.04]":"completed"===a.status?"bg-green-500/[0.04]":"failed"===a.status?"bg-red-500/[0.04]":"";return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:`rounded-xl border transition-all duration-500 ${q} ${x} overflow-hidden`,style:{background:x?void 0:"var(--bg-card)"},children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3 cursor-pointer select-none",onClick:()=>h(a=>!a),children:[(0,b.jsx)("span",{className:"text-base shrink-0",children:a.icon}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-violet-400 font-semibold text-base",children:a.role}),(0,b.jsx)(r,{status:a.status}),"completed"===a.status&&(0,b.jsx)("span",{className:"text-xs text-green-400 font-mono",children:"✓ done"})]}),(0,b.jsx)("p",{className:"text-sm text-white/45 font-mono mt-0.5 truncate",children:o})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[a.artifacts.length>0&&(0,b.jsxs)("span",{className:"text-xs text-white/35 font-mono",children:[a.artifacts.length," file",a.artifacts.length>1?"s":""]}),(0,b.jsxs)("button",{onClick:a=>{a.stopPropagation(),n(!0)},title:"View A2A Agent Card",className:"flex items-center gap-1.5 text-xs font-mono px-2.5 py-1 rounded-lg transition-all hover:scale-105",style:{background:"linear-gradient(135deg, rgba(168,85,247,0.15), rgba(236,72,153,0.15))",border:"1px solid rgba(168,85,247,0.3)"},children:[(0,b.jsx)(p,{size:11,className:"text-purple-400"}),(0,b.jsx)("span",{className:"text-purple-300 font-semibold",children:"A2A"})]}),g?(0,b.jsx)(l,{size:14,className:"text-white/30"}):(0,b.jsx)(m.ChevronRight,{size:14,className:"text-white/30"})]})]}),g&&(0,b.jsxs)("div",{className:"px-4 pb-3 border-t border-white/[0.07] pt-3 space-y-3",children:[(0,b.jsx)("p",{className:"text-sm text-white/45 italic",children:a.goal}),(0,b.jsx)(v,{lines:d}),a.findings.length>0&&(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("p",{className:"text-xs text-white/35 uppercase tracking-wider font-mono",children:"Findings"}),a.findings.map((a,c)=>(0,b.jsxs)("div",{className:"flex gap-2 text-sm text-white/70",children:[(0,b.jsx)("span",{className:"text-green-400 shrink-0",children:"✓"}),(0,b.jsx)("span",{children:a})]},c))]}),a.artifacts.length>0&&(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-xs text-white/35 uppercase tracking-wider font-mono mb-2",children:"Files"}),(0,b.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.artifacts.map((a,c)=>(0,b.jsx)(s,{artifact:a,onClick:()=>j(a)},c))})]})]})]}),i&&(0,b.jsx)(t,{artifact:i,onClose:()=>j(null)}),k&&(0,b.jsx)(u,{task:a,onClose:()=>n(!1)})]})}function x({event:a,tasks:c}){let d=a.fromTaskId?c[a.fromTaskId]?.role:"?",e=a.toTaskId?c[a.toTaskId]?.role:"?";return(0,b.jsxs)("div",{className:"flex items-start gap-2 px-3 py-2.5 rounded-xl bg-purple-500/8 border border-purple-500/20 animate-pulse-once",children:[(0,b.jsx)("span",{className:"text-base shrink-0",children:"🔗"}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"text-sm text-purple-300 font-medium",children:[d," → ",e]}),(0,b.jsx)("div",{className:"text-sm text-purple-400/80 font-mono mt-0.5",children:String(a.data.message??"")})]})]})}function y({tasks:a,rootId:c}){let d=Object.values(a).filter(a=>a.id!==c);if(0===d.length)return null;let e=d.filter(a=>"completed"===a.status).length,f=Math.round(e/d.length*100);return(0,b.jsxs)("div",{className:"px-4 py-2.5 border-b border-white/[0.07]",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between text-xs text-white/40 font-mono mb-1.5",children:[(0,b.jsxs)("span",{children:[e,"/",d.length," agents complete"]}),(0,b.jsxs)("span",{children:[f,"%"]})]}),(0,b.jsx)("div",{className:"h-1.5 bg-white/[0.06] rounded-full overflow-hidden",children:(0,b.jsx)("div",{className:"h-full bg-gradient-to-r from-purple-500 via-pink-500 to-orange-400 rounded-full transition-all duration-700 ease-out",style:{width:`${f}%`}})})]})}function z({tasks:a,rootId:d,events:e}){let f=Object.values(a),g=d?a[d]:null,h=f.filter(a=>a.id!==d),i=e.filter(a=>"collaboration"===a.type),[j,k]=(0,c.useState)(new Set);(0,c.useEffect)(()=>{f.forEach((a,b)=>{setTimeout(()=>k(b=>new Set([...b,a.id])),120*b)})},[f.length]);let l={};for(let a of e)if("terminal"===a.type&&a.taskId){l[a.taskId]||(l[a.taskId]=[]);let b=String(a.data.output??"");l[a.taskId].push(...b.split("\n").filter(Boolean))}let m=new Set(i.map(a=>a.toTaskId).filter(Boolean)),n=new Set(i.map(a=>a.fromTaskId).filter(Boolean));return 0===f.length?(0,b.jsx)("div",{className:"h-full flex items-center justify-center text-center p-8",children:(0,b.jsxs)("div",{children:[(0,b.jsx)(q,{size:48,className:"text-white/15 mx-auto mb-4"}),(0,b.jsx)("p",{className:"text-white/30 text-base",children:"Agent activity appears here"}),(0,b.jsx)("p",{className:"text-white/20 text-sm mt-1",children:"Tasks and agent progress will show when a run starts"})]})}):(0,b.jsxs)("div",{className:"h-full flex flex-col overflow-hidden",children:[(0,b.jsx)(y,{tasks:a,rootId:d}),(0,b.jsxs)("div",{className:"flex-1 overflow-y-auto p-4 space-y-3",children:[g&&j.has(g.id)&&(0,b.jsxs)("div",{className:"transition-all duration-300 animate-slide-in",children:[(0,b.jsx)("div",{className:"text-xs text-white/30 uppercase tracking-widest font-mono mb-2",children:"Orchestrator"}),(0,b.jsx)(w,{task:g,terminalLines:l[g.id]??[],isCollabTarget:!1,isCollabSource:!1})]}),h.length>0&&(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"text-xs text-white/30 uppercase tracking-widest font-mono mb-2",children:["Agent Team · ",h.length," specialists"]}),(0,b.jsx)("div",{className:"space-y-2",children:h.map(a=>j.has(a.id)?(0,b.jsx)("div",{className:"transition-all duration-300 animate-slide-in",children:(0,b.jsx)(w,{task:a,terminalLines:l[a.id]??[],isCollabTarget:m.has(a.id),isCollabSource:n.has(a.id)})},a.id):null)})]}),i.length>0&&(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-xs text-white/30 uppercase tracking-widest font-mono mb-2",children:"Collaborations"}),(0,b.jsx)("div",{className:"space-y-2",children:i.map((c,d)=>(0,b.jsx)(x,{event:c,tasks:a},d))})]})]})]})}let A=[{id:"google/gemini-3.1-pro",label:"Gemini 3.1 Pro",badge:"latest"},{id:"google/gemini-3.1-flash-lite",label:"Gemini 3.1 Flash-Lite",badge:"fast"},{id:"google/gemini-3-pro",label:"Gemini 3 Pro",badge:""},{id:"google/gemini-3-flash",label:"Gemini 3 Flash",badge:""},{id:"google/gemini-2.5-pro",label:"Gemini 2.5 Pro",badge:""},{id:"google/gemini-2.5-flash",label:"Gemini 2.5 Flash",badge:"recommended"},{id:"google/gemini-2.5-flash-lite",label:"Gemini 2.5 Flash-Lite",badge:""},{id:"google/gemini-2.0-flash",label:"Gemini 2.0 Flash",badge:""},{id:"google/gemini-2.0-flash-lite",label:"Gemini 2.0 Flash-Lite",badge:"budget"}];function B({value:a,onChange:c}){return(0,b.jsx)("select",{value:a,onChange:a=>c(a.target.value),className:"border border-white/15 text-sm rounded-lg px-3 py-1.5 outline-none focus:border-white/30 cursor-pointer",style:{background:"var(--bg-hover)",color:"rgb(var(--fg))"},children:A.map(a=>(0,b.jsxs)("option",{value:a.id,children:[a.label,a.badge?` (${a.badge})`:""]},a.id))})}let C=(0,f.default)("panel-right-open",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]]),D=(0,f.default)("panel-right-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]),E=(0,f.default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);var F=a.i(21161);let G=(0,f.default)("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),H=(0,f.default)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var I=a.i(52495);class J{handlers=[];queue=[];closed=!1;on(a){for(let b of(this.handlers.push(a),this.queue))a(b)}emit(a){for(let b of(this.queue.push(a),this.handlers))b(a)}close(){this.closed=!0}isClosed(){return this.closed}}let K={maxDepth:3,maxWorkers:6,maxTotalTasks:15,maxStepsPerAgent:20,plannerModel:"google/gemini-2.5-pro",workerModel:"google/gemini-2.5-flash",repoUrl:""},L=a=>new Promise(b=>setTimeout(b,a));function M(a){return{parentId:null,status:"pending",statusText:"Waiting to start...",findings:[],artifacts:[],children:[],sandboxId:null,model:"google/gemini-2.5-flash",createdAt:Date.now(),completedAt:null,depth:1,icon:"⚙️",...a}}class N{emitter;config;constructor(a={}){this.emitter=new J,this.config={...K,...a}}onEvent(a){this.emitter.on(a)}async run(a){let b=M({id:"root",parentId:null,role:"Tech Lead",goal:a,depth:0,model:this.config.plannerModel,icon:"🧠",status:"running",statusText:"Spinning up sandbox..."});for(let[a,c,d]of(this.emitter.emit({type:"task-created",taskId:"root",data:{task:b}}),[[400,"Spinning up sandbox..."],[500,"Analyzing goal..."],[300,"Exploring monorepo structure...","$ ls packages/ | wc -l\n47"],[600,"Scanning provider packages...",'$ find packages -name "*-provider.ts" | head -8\npackages/openai/src/openai-provider.ts\npackages/anthropic/src/anthropic-provider.ts\npackages/google/src/google-provider.ts\npackages/mistral/src/mistral-provider.ts'],[700,"Reading interface contracts...",'$ grep -r "implements LanguageModelV1" packages/ --include="*.ts" -l\npackages/openai/src/openai-chat-model.ts\npackages/anthropic/src/anthropic-messages-language-model.ts'],[500,"Understanding test patterns...","$ ls packages/openai/src/__tests__/\nopenai-chat-model.test.ts\nopenai-completion-model.test.ts\nopenai-provider.test.ts"],[400,"Assembling the team..."]]))await L(a),this.emitter.emit({type:"task-updated",taskId:"root",data:{statusText:c}}),d&&(this.emitter.emit({type:"terminal",taskId:"root",data:{output:d}}),await L(200));let c=this.buildWorkerPlan(a);for(let a of c)a.icon=function(a){let b=a.toLowerCase();return b.includes("scout")||b.includes("architect")||b.includes("analysis")||b.includes("explorer")?"🔍":b.includes("lead")||b.includes("planner")||b.includes("tech")?"🧠":b.includes("test")||b.includes("qa")||b.includes("verif")?"🧪":b.includes("package")||b.includes("config")||b.includes("infra")?"📦":b.includes("doc")?"📝":b.includes("front")||b.includes("ui")||b.includes("design")?"🎨":b.includes("security")||b.includes("auth")||b.includes("risk")?"🔐":b.includes("scanner")||b.includes("scan")?"🔎":"⚙️"}(a.role);for(let a of c)this.emitter.emit({type:"task-created",taskId:a.id,data:{task:a}}),await L(280);this.emit("task-completed","root","Team assembled — workers running in parallel"),await Promise.all(c.map((a,b)=>this.runWorker(a,150*b))),await L(500);let d=c.flatMap(a=>a.artifacts);this.emitter.emit({type:"task-updated",taskId:"root",data:{statusText:"Synthesizing results..."}}),await L(600);let e=this.buildSummary(a,c,d);this.emitter.emit({type:"synthesis",taskId:"root",data:{content:e,artifacts:d}}),await L(300),this.emitter.emit({type:"done",data:{content:e,artifacts:d}}),this.emitter.close()}emit(a,b,c){this.emitter.emit({type:a,taskId:b,data:{statusText:c}})}buildWorkerPlan(a){let b=a.toLowerCase();return b.includes("provider")||b.includes("sdk")||b.includes("package")||b.includes("deepseek")?[M({id:"scout",role:"Architecture Scout",goal:"Explore existing provider packages and document interface contracts, file patterns, and test conventions",icon:"🔍"}),M({id:"engineer",role:"Provider Engineer",goal:"Implement the new provider package — provider class, chat model, streaming, reasoning tokens",icon:"⚙️"}),M({id:"tester",role:"Test Engineer",goal:"Write comprehensive tests matching existing monorepo test patterns",icon:"🧪"}),M({id:"packager",role:"Package Engineer",goal:"Set up package.json, tsconfig.json, exports, and wire into the monorepo build system",icon:"📦"})]:b.includes("security")||b.includes("vulnerabilit")||b.includes("audit")?[M({id:"dep-scanner",role:"Dependency Scanner",goal:"Audit all dependencies for known vulnerabilities",icon:"🔎"}),M({id:"auth-analyzer",role:"Auth Flow Analyzer",goal:"Trace authentication flows and identify weaknesses",icon:"🔐"}),M({id:"input-checker",role:"Input Validator",goal:"Check all user input handling for injection attack surfaces",icon:"⚙️"}),M({id:"risk-report",role:"Risk Prioritizer",goal:"Combine all findings into a prioritized security report",icon:"📝"})]:b.includes("research")||b.includes("command")||b.includes("cli")||b.includes("feature")?[M({id:"explorer",role:"Codebase Explorer",goal:"Map the existing command structure and extension patterns",icon:"🔍"}),M({id:"implementer",role:"Feature Engineer",goal:"Implement the new feature following existing patterns",icon:"⚙️"}),M({id:"integrator",role:"Integration Engineer",goal:"Wire the feature into the CLI entry point and config",icon:"📦"}),M({id:"tester",role:"Test Engineer",goal:"Write integration tests covering the new command end-to-end",icon:"🧪"})]:[M({id:"explorer",role:"Codebase Explorer",goal:"Map the repository structure and identify relevant files",icon:"🔍"}),M({id:"implementer",role:"Implementation Engineer",goal:"Implement the requested changes following existing patterns",icon:"⚙️"}),M({id:"verifier",role:"Verification Engineer",goal:"Verify the implementation is correct and consistent",icon:"🧪"})]}async runWorker(a,b){for(let c of(await L(b),this.emitter.emit({type:"task-updated",taskId:a.id,data:{status:"running",statusText:"Starting sandbox..."}}),await L(300),this.stepsForRole(a.role)))await L(c.delay),this.emitter.emit({type:"task-updated",taskId:a.id,data:{statusText:c.text}}),c.cmd&&(this.emitter.emit({type:"terminal",taskId:a.id,data:{output:c.cmd}}),await L(180));"engineer"===a.id&&(await L(600),this.emitter.emit({type:"collaboration",fromTaskId:"tester",toTaskId:"engineer",data:{message:"Type error: doStream() must return AsyncIterable<LanguageModelV1StreamPart>"}}),await L(300),this.emitter.emit({type:"task-updated",taskId:a.id,data:{statusText:"Fixing streaming return type..."}}),this.emitter.emit({type:"terminal",taskId:a.id,data:{output:"$ npx tsc --noEmit\nsrc/deepseek-chat-model.ts:47:5 - error TS2322: Type mismatch on doStream return\n\nFixing..."}}),await L(700),this.emitter.emit({type:"task-updated",taskId:a.id,data:{statusText:"Type check passing ✓"}}),this.emitter.emit({type:"terminal",taskId:a.id,data:{output:"$ npx tsc --noEmit\n✓ No errors found"}}),await L(300));let c=this.artifactsForRole(a.role),d=this.findingsForRole(a.role);for(let b of c)await L(150),this.emitter.emit({type:"artifact",taskId:a.id,data:{artifact:b}});for(let b of d)this.emitter.emit({type:"finding",taskId:a.id,data:{content:b}});await L(200),this.emitter.emit({type:"task-completed",taskId:a.id,data:{statusText:"Done",artifacts:c,findings:d}}),a.status="completed",a.artifacts=c,a.findings=d}stepsForRole(a){let b=a.toLowerCase();return b.includes("scout")||b.includes("explorer")||b.includes("codebase")?[{text:"Scanning packages directory...",delay:400,cmd:"$ ls packages/ | head -12\nai anthropic azure cohere deepseek\ngoogle groq mistral openai perplexity"},{text:"Reading openai provider structure...",delay:700,cmd:'$ find packages/openai/src -name "*.ts" | head -6\npackages/openai/src/index.ts\npackages/openai/src/openai-provider.ts\npackages/openai/src/openai-chat-model.ts\npackages/openai/src/convert-to-openai-messages.ts'},{text:"Extracting interface contracts...",delay:800,cmd:'$ head -30 packages/openai/src/openai-chat-model.ts\nexport class OpenAIChatModel implements LanguageModelV1 {\n readonly specificationVersion = "v1";\n readonly provider: string;\n readonly modelId: string;\n ...'},{text:"Checking test patterns...",delay:600,cmd:'$ head -20 packages/openai/src/__tests__/openai-chat-model.test.ts\nimport { describe, it, expect, vi } from "vitest";\nimport { createOpenAI } from "../openai-provider";\n\nconst server = createTestServer({...})'},{text:"Documenting findings...",delay:500}]:b.includes("provider")||b.includes("feature")||b.includes("implement")?[{text:"Reading Architecture Scout findings...",delay:400},{text:"Creating package directory...",delay:300,cmd:"$ mkdir -p packages/deepseek/src/__tests__"},{text:"Writing deepseek-provider.ts...",delay:900,cmd:'$ cat > packages/deepseek/src/deepseek-provider.ts\nexport function createDeepSeek(options) {\n const baseURL = options.baseURL ?? "https://api.deepseek.com/v1";\n return { chat: (modelId) => new DeepSeekChatModel(modelId, ...) }\n}'},{text:"Implementing chat model...",delay:1100,cmd:"$ cat > packages/deepseek/src/deepseek-chat-model.ts\nexport class DeepSeekChatModel implements LanguageModelV1 {\n async doGenerate(options) { ... }\n async doStream(options) { ... }\n}"},{text:"Adding streaming support...",delay:800,cmd:"$ wc -l packages/deepseek/src/deepseek-chat-model.ts\n 187 packages/deepseek/src/deepseek-chat-model.ts"},{text:"Running type check...",delay:600,cmd:"$ npx tsc --noEmit\n...(checking)"}]:b.includes("test")||b.includes("verif")?[{text:"Studying existing test patterns...",delay:500,cmd:'$ grep -r "createTestServer\\|mockFetch" packages/openai --include="*.ts" -l\npackages/openai/src/__tests__/openai-chat-model.test.ts'},{text:"Writing provider tests...",delay:700,cmd:'$ cat > packages/deepseek/src/__tests__/deepseek-provider.test.ts\ndescribe("createDeepSeek", () => {\n it("creates provider with default URL", () => {...})\n it("passes apiKey to model", () => {...})\n})'},{text:"Writing streaming tests...",delay:800,cmd:'$ cat >> packages/deepseek/src/__tests__/deepseek-chat-model.test.ts\nit("streams text chunks correctly", async () => {\n const chunks = [];\n for await (const chunk of stream) { chunks.push(chunk); }\n expect(chunks[0].type).toBe("text-delta");\n})'},{text:"Running vitest...",delay:900,cmd:"$ npx vitest run packages/deepseek --reporter=verbose\n✓ deepseek-provider.test.ts (3)\n✓ deepseek-chat-model.test.ts (4)\n✗ deepseek-chat-model.test.ts > streaming type (1)\n\nFAIL: expected AsyncIterable<StreamPart>, got ReadableStream"},{text:"Reporting type error to Provider Engineer...",delay:400},{text:"Waiting for fix...",delay:1200},{text:"Re-running vitest...",delay:400,cmd:"$ npx vitest run packages/deepseek --reporter=verbose\n✓ deepseek-provider.test.ts (3)\n✓ deepseek-chat-model.test.ts (5)\n\nTest Files 1 passed\nTests 8 passed\nDuration 1.24s"}]:b.includes("package")||b.includes("config")||b.includes("integrat")?[{text:"Checking workspace config...",delay:400,cmd:'$ cat pnpm-workspace.yaml\npackages:\n - "packages/*"\n - "packages/provider-utils"'},{text:"Writing package.json...",delay:500,cmd:'$ cat > packages/deepseek/package.json\n{\n "name": "@ai-sdk/deepseek",\n "version": "1.0.0",\n "dependencies": {\n "@ai-sdk/provider": "workspace:*"\n }\n}'},{text:"Writing tsconfig.json...",delay:400,cmd:'$ cat > packages/deepseek/tsconfig.json\n{\n "extends": "../../tsconfig.json",\n "compilerOptions": { "outDir": "dist" },\n "include": ["src"]\n}'},{text:"Wiring into monorepo...",delay:500,cmd:'$ cat >> tsconfig.json\n{ "path": "packages/deepseek/tsconfig.json" }'},{text:"Verifying workspace links...",delay:400,cmd:"$ pnpm list @ai-sdk/deepseek\n@ai-sdk/deepseek 1.0.0 packages/deepseek"}]:b.includes("auth")||b.includes("input")||b.includes("risk")||b.includes("dep")?[{text:"Scanning codebase...",delay:500,cmd:'$ find . -name "*.ts" | xargs grep -l "password\\|token\\|secret" | head -8'},{text:"Analyzing patterns...",delay:800},{text:"Running checks...",delay:700,cmd:"$ npx audit-ci --moderate"},{text:"Compiling findings...",delay:500}]:[{text:"Analyzing task...",delay:500},{text:"Working...",delay:1e3},{text:"Finalizing...",delay:600}]}artifactsForRole(a){let b=a.toLowerCase();return b.includes("scout")||b.includes("codebase")?[{filename:"architecture-findings.md",language:"markdown",content:`# Architecture Findings
1
+ module.exports=[58689,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(38246),e=a.i(71987),f=a.i(70106);let g=(0,f.default)("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]),h=["What's missing in the README?","Audit all dependencies for known CVEs and outdated versions","Add rate limiting middleware with configurable limits per route","Find all TODO and FIXME comments and summarise what needs to be done","Add input validation and sanitisation to every request handler"],i=["Add a new provider package with streaming and tool-use support","Find security vulnerabilities in the authentication flow","Refactor the router module to improve test coverage","Generate TypeScript types for all public API endpoints"];function j({content:a}){let c=a.split("\n");return(0,b.jsx)("div",{className:"prose text-base space-y-1.5",children:c.map((a,c)=>{if(a.startsWith("## "))return(0,b.jsx)("h2",{className:"text-lg font-semibold text-white mt-3 mb-1",children:a.slice(3)},c);if(a.startsWith("### "))return(0,b.jsx)("h3",{className:"text-base font-semibold text-white mt-2",children:a.slice(4)},c);if(a.startsWith("- ")){let d=a.slice(2).replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/`(.*?)`/g,"<code>$1</code>");return(0,b.jsx)("li",{className:"ml-4 text-white/80",dangerouslySetInnerHTML:{__html:d}},c)}if(a.startsWith("**Goal:**"))return(0,b.jsxs)("p",{className:"text-white/65",children:[(0,b.jsx)("strong",{className:"text-white",children:"Goal:"}),a.slice(9)]},c);if(""===a.trim())return(0,b.jsx)("div",{className:"h-1"},c);let d=a.replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/`(.*?)`/g,"<code>$1</code>");return(0,b.jsx)("p",{className:"text-white/80",dangerouslySetInnerHTML:{__html:d}},c)})})}function k({onSubmit:a,messages:d,isRunning:f,mode:l="real"}){let[m,n]=(0,c.useState)(""),o=(0,c.useRef)(null);return(0,c.useEffect)(()=>{o.current?.scrollIntoView({behavior:"smooth"})},[d]),(0,b.jsxs)("div",{className:"h-full flex flex-col",children:[(0,b.jsxs)("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[0===d.length&&(0,b.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-center px-4",children:[(0,b.jsx)(e.default,{src:`${process.env.NEXT_PUBLIC_BASE_PATH??""}/logo.png`,alt:"Agentnetes",width:72,height:72,className:"rounded-2xl mb-6 animate-float"}),(0,b.jsx)("h2",{className:"text-white text-2xl font-extrabold tracking-tight mb-2",children:"Agentnetes"}),(0,b.jsx)("p",{className:"text-white/70 text-base mb-1.5 max-w-md",children:"simulation"===l?"Watch the swarm in action · no setup needed.":"Self-organizing agents · real Docker sandboxes."}),(0,b.jsx)("p",{className:"text-white/40 text-sm mb-10 max-w-md",children:"simulation"===l?"Pre-scripted scenarios showing real event sequences.":"Agents clone your repo, run shell commands, and deliver results."}),(0,b.jsx)("div",{className:"space-y-2.5 w-full max-w-md",children:("simulation"===l?i:h).map((a,c)=>(0,b.jsx)("button",{onClick:()=>n(a),className:"w-full text-left text-sm text-white/60 border border-white/10 rounded-xl px-4 py-3 hover:border-white/20 hover:text-white/80 transition-all card-hover bg-white/[0.03]",children:a},c))})]}),d.map((a,c)=>(0,b.jsx)("div",{className:`flex ${"user"===a.role?"justify-end":"justify-start"}`,children:"user"===a.role?(0,b.jsx)("div",{className:"max-w-[80%] border border-white/15 rounded-2xl rounded-br-sm px-5 py-3 text-base",style:{background:"var(--bg-hover)"},children:a.content}):(0,b.jsx)("div",{className:"max-w-[90%] border border-white/[0.06] rounded-2xl rounded-bl-sm px-5 py-4",style:{background:"var(--bg-panel)"},children:(0,b.jsx)(j,{content:a.content})})},c)),f&&(0,b.jsx)("div",{className:"flex justify-start",children:(0,b.jsx)("div",{className:"border border-white/[0.06] rounded-2xl rounded-bl-sm px-5 py-4",style:{background:"var(--bg-panel)"},children:(0,b.jsxs)("div",{className:"flex items-center gap-2 text-white/55 text-sm font-mono",children:[(0,b.jsx)("span",{className:"w-2 h-2 bg-yellow-400 rounded-full animate-pulse"}),"Agents working..."]})})}),(0,b.jsx)("div",{ref:o})]}),(0,b.jsx)("div",{className:"p-4 border-t border-white/[0.07]",children:(0,b.jsxs)("form",{onSubmit:function(b){b.preventDefault(),m.trim()&&!f&&(a(m.trim()),n(""))},className:"flex gap-3",children:[(0,b.jsx)("input",{value:m,onChange:a=>n(a.target.value),disabled:f,placeholder:"simulation"===l?"Describe a task for the simulated swarm...":"Give the agents a goal for your repo...",className:"flex-1 bg-white/[0.04] border border-white/15 rounded-xl px-5 py-3 text-base text-white placeholder-white/30 outline-none focus:border-white/30 disabled:opacity-50 transition-colors"}),(0,b.jsx)("button",{type:"submit",disabled:!m.trim()||f,className:"bg-white text-black rounded-xl px-4 py-3 hover:bg-[#e0e0e0] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:(0,b.jsx)(g,{size:18})})]})})]})}let l=(0,f.default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);var m=a.i(50522),n=a.i(80386);let o=(0,f.default)("file-code",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]]),p=(0,f.default)("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),q=(0,f.default)("hexagon",[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}]]);function r({status:a}){return(0,b.jsx)("span",{className:`inline-block w-2 h-2 rounded-full shrink-0 ${{pending:"bg-white/20",running:"bg-yellow-400 animate-pulse shadow-[0_0_6px_rgba(250,204,21,0.6)]",completed:"bg-green-400 shadow-[0_0_6px_rgba(74,222,128,0.5)]",failed:"bg-red-400"}[a]}`})}function s({artifact:a,onClick:c}){return(0,b.jsxs)("button",{onClick:c,className:"flex items-center gap-1.5 text-xs font-mono bg-[#0d1117] border border-[#30363d] text-[#7dd3fc] px-2.5 py-1.5 rounded-md hover:border-[#58a6ff] hover:bg-[#161b22] transition-colors",children:[(0,b.jsx)(o,{size:12}),a.filename.split("/").pop()]})}function t({artifact:a,onClose:c}){let d=a.content.split("\n");return(0,b.jsx)("div",{className:"fixed inset-0 bg-black/80 z-50 flex items-center justify-center p-6 backdrop-blur-sm",onClick:c,children:(0,b.jsxs)("div",{className:"w-full max-w-3xl max-h-[80vh] flex flex-col bg-[#0d1117] border border-[#30363d] rounded-xl overflow-hidden shadow-2xl",onClick:a=>a.stopPropagation(),children:[(0,b.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[#21262d] shrink-0",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(o,{size:14,className:"text-[#7dd3fc]"}),(0,b.jsx)("span",{className:"text-sm font-mono text-[#e6edf3]",children:a.filename}),(0,b.jsx)("span",{className:"text-xs text-[#555] bg-[#161b22] border border-[#21262d] px-1.5 py-0.5 rounded",children:a.language})]}),(0,b.jsx)("button",{onClick:c,className:"text-[#555] hover:text-white text-lg leading-none",children:"×"})]}),(0,b.jsx)("div",{className:"overflow-auto flex-1 p-4",children:(0,b.jsx)("div",{className:"font-mono text-sm leading-5",children:d.map((a,c)=>(0,b.jsxs)("div",{className:"flex gap-4 hover:bg-[#161b22] px-2 rounded",children:[(0,b.jsx)("span",{className:"text-[#555] w-6 shrink-0 select-none text-right",children:c+1}),(0,b.jsx)("span",{className:"text-[#e6edf3] whitespace-pre",children:a})]},c))})})]})})}function u({task:a,onClose:d}){var e;let f,g,h=(g=(e=a).role.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,""),{name:e.role,description:e.goal,url:`https://agentnetes.vercel.app/agents/${g}`,version:"1.0.0",provider:{organization:"Agentnetes"},capabilities:{streaming:!0,pushNotifications:!1,stateTransitionHistory:!0},authentication:{schemes:["bearer"]},defaultInputModes:["text/plain","application/json"],defaultOutputModes:["text/plain","application/json"],skills:(f=e.role.toLowerCase()).includes("scout")||f.includes("explorer")||f.includes("architect")?[{id:"explore-codebase",name:"Explore Codebase",description:"Scans a repository and documents architecture patterns, interface contracts, and file conventions",tags:["codebase","architecture","typescript","monorepo"],examples:["Explore the provider package structure in vercel/ai","Document interface contracts for LanguageModelV1","Find all test patterns across packages"]},{id:"map-dependencies",name:"Map Dependencies",description:"Traces dependency graphs across a monorepo and identifies shared utilities",tags:["dependencies","monorepo","pnpm"],examples:["Map all workspace dependencies in vercel/ai","Find all packages that depend on @ai-sdk/provider"]}]:f.includes("provider")||f.includes("implement")||f.includes("engineer")?[{id:"implement-provider",name:"Implement Provider",description:"Creates a new AI SDK provider package following existing patterns — provider class, chat model, streaming",tags:["typescript","ai-sdk","provider","streaming"],examples:["Add @ai-sdk/deepseek with streaming and reasoning tokens","Implement a new OpenAI-compatible provider","Add tool-calling support to an existing provider"]},{id:"implement-feature",name:"Implement Feature",description:"Builds a software feature in an existing codebase following discovered conventions",tags:["typescript","implementation","feature"],examples:["Add a /research command to a CLI tool","Implement a new API endpoint following existing patterns"]}]:f.includes("test")||f.includes("verif")||f.includes("qa")?[{id:"write-tests",name:"Write Tests",description:"Writes comprehensive tests following the codebase test conventions — unit, integration, streaming",tags:["vitest","testing","typescript","coverage"],examples:["Write tests for a new provider package","Add streaming tests for a chat model","Write integration tests for a new API endpoint"]},{id:"run-verification",name:"Run Verification",description:"Runs tests, type checks, and linting to verify correctness. Reports failures with context.",tags:["typescript","vitest","tsc","verification"],examples:["Verify TypeScript compilation passes","Run all tests and report failures"]}]:f.includes("package")||f.includes("config")||f.includes("integrat")?[{id:"setup-package",name:"Setup Package",description:"Configures package.json, tsconfig.json, exports, and monorepo wiring for a new package",tags:["monorepo","pnpm","typescript","package"],examples:["Set up a new @ai-sdk/* package from scratch","Configure ESM + CJS dual exports","Wire a new package into pnpm workspace"]}]:f.includes("security")||f.includes("scanner")||f.includes("auth")||f.includes("risk")?[{id:"security-audit",name:"Security Audit",description:"Analyzes code for security vulnerabilities — auth flows, input validation, dependency CVEs",tags:["security","audit","vulnerabilities","owasp"],examples:["Audit authentication flows for session fixation","Scan dependencies for known CVEs","Find XSS vulnerabilities in user input handling"]}]:[{id:"general-task",name:"General Engineering Task",description:"Performs software engineering tasks — exploration, implementation, verification",tags:["typescript","engineering"],examples:["Implement a requested feature following existing patterns"]}]}),i=JSON.stringify(h,null,2),[j,k]=(0,c.useState)(!1);return(0,b.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6 backdrop-blur-md",style:{background:"rgba(0,0,0,0.85)"},onClick:d,children:(0,b.jsxs)("div",{className:"w-full max-w-2xl max-h-[90vh] flex flex-col rounded-2xl overflow-hidden shadow-2xl border border-purple-500/20",style:{background:"var(--bg-base)"},onClick:a=>a.stopPropagation(),children:[(0,b.jsxs)("div",{className:"px-6 py-5 border-b border-white/[0.08] shrink-0",style:{background:"linear-gradient(135deg, rgba(168,85,247,0.08), rgba(236,72,153,0.05))"},children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center text-lg",style:{background:"linear-gradient(135deg, rgba(168,85,247,0.2), rgba(236,72,153,0.15))",border:"1px solid rgba(168,85,247,0.3)"},children:a.icon}),(0,b.jsxs)("div",{children:[(0,b.jsx)("h2",{className:"text-white font-bold text-lg",children:a.role}),(0,b.jsx)("p",{className:"text-white/50 text-sm font-mono mt-0.5",children:h.url})]})]}),(0,b.jsx)("button",{onClick:d,className:"text-white/30 hover:text-white/70 transition-colors text-xl leading-none p-1",children:"✕"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-xs font-mono px-2.5 py-1 rounded-full font-semibold",style:{background:"linear-gradient(135deg, rgba(168,85,247,0.2), rgba(236,72,153,0.15))",border:"1px solid rgba(168,85,247,0.3)",color:"#c084fc"},children:"A2A Agent Card"}),(0,b.jsxs)("span",{className:"text-xs font-mono text-white/30",children:["v",h.version]}),(0,b.jsx)("span",{className:"text-xs font-mono text-white/30",children:"·"}),(0,b.jsx)("span",{className:"text-xs font-mono text-emerald-400/70",children:"streaming"}),(0,b.jsx)("span",{className:"text-xs font-mono text-white/30",children:"·"}),(0,b.jsxs)("span",{className:"text-xs font-mono text-white/30",children:[h.authentication.schemes[0]," auth"]})]})]}),(0,b.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[(0,b.jsxs)("div",{className:"px-6 py-4 border-b border-white/[0.06]",children:[(0,b.jsx)("p",{className:"text-xs font-mono text-white/40 uppercase tracking-widest mb-2",children:"Description"}),(0,b.jsx)("p",{className:"text-white/80 text-sm leading-relaxed",children:h.description})]}),(0,b.jsxs)("div",{className:"px-6 py-4 border-b border-white/[0.06]",children:[(0,b.jsx)("p",{className:"text-xs font-mono text-white/40 uppercase tracking-widest mb-3",children:"Capabilities"}),(0,b.jsx)("div",{className:"grid grid-cols-3 gap-3",children:[{label:"Streaming",value:h.capabilities.streaming,color:"emerald"},{label:"Push Notifications",value:h.capabilities.pushNotifications,color:"yellow"},{label:"State History",value:h.capabilities.stateTransitionHistory,color:"blue"}].map(a=>(0,b.jsxs)("div",{className:"rounded-xl border border-white/[0.08] px-3 py-2.5 text-center",style:{background:"var(--bg-card)"},children:[(0,b.jsx)("div",{className:`text-sm font-mono font-semibold ${a.value?`text-${a.color}-400`:"text-white/20"}`,children:a.value?"✓":"✗"}),(0,b.jsx)("div",{className:"text-xs text-white/50 mt-1",children:a.label})]},a.label))})]}),(0,b.jsxs)("div",{className:"px-6 py-4 border-b border-white/[0.06]",children:[(0,b.jsx)("p",{className:"text-xs font-mono text-white/40 uppercase tracking-widest mb-3",children:"Skills"}),(0,b.jsx)("div",{className:"space-y-3",children:h.skills.map(a=>(0,b.jsxs)("div",{className:"rounded-xl border border-white/[0.08] p-4",style:{background:"var(--bg-card)"},children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,b.jsx)("span",{className:"text-violet-400 font-semibold text-sm",children:a.name}),(0,b.jsx)("span",{className:"text-xs font-mono text-white/25",children:a.id})]}),(0,b.jsx)("p",{className:"text-sm text-white/60 leading-relaxed mb-3",children:a.description}),(0,b.jsx)("div",{className:"flex flex-wrap gap-1.5 mb-3",children:a.tags.map(a=>(0,b.jsx)("span",{className:"text-xs font-mono text-emerald-400/70 border border-emerald-500/20 bg-emerald-500/5 px-2 py-0.5 rounded-md",children:a},a))}),a.examples.length>0&&(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("p",{className:"text-xs text-white/30 font-mono",children:"Examples:"}),a.examples.map((a,c)=>(0,b.jsx)("div",{className:"text-sm text-white/50 pl-3 border-l-2 border-white/[0.06]",children:a},c))]})]},a.id))})]}),(0,b.jsxs)("div",{className:"px-6 py-4 border-b border-white/[0.06]",children:[(0,b.jsx)("p",{className:"text-xs font-mono text-white/40 uppercase tracking-widest mb-3",children:"Input / Output"}),(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-xs text-white/30 mb-1.5",children:"Input Modes"}),(0,b.jsx)("div",{className:"flex flex-wrap gap-1.5",children:h.defaultInputModes.map(a=>(0,b.jsx)("span",{className:"text-xs font-mono text-blue-400/70 border border-blue-500/20 bg-blue-500/5 px-2 py-0.5 rounded-md",children:a},a))})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-xs text-white/30 mb-1.5",children:"Output Modes"}),(0,b.jsx)("div",{className:"flex flex-wrap gap-1.5",children:h.defaultOutputModes.map(a=>(0,b.jsx)("span",{className:"text-xs font-mono text-orange-400/70 border border-orange-500/20 bg-orange-500/5 px-2 py-0.5 rounded-md",children:a},a))})]})]})]}),(0,b.jsxs)("div",{className:"px-6 py-4",children:[(0,b.jsxs)("button",{onClick:()=>k(a=>!a),className:"flex items-center gap-2 text-sm font-mono text-white/40 hover:text-white/70 transition-colors mb-3",children:[(0,b.jsx)(o,{size:14}),(0,b.jsxs)("span",{children:[j?"Hide":"Show"," agent-card.json"]}),j?(0,b.jsx)(l,{size:14}):(0,b.jsx)(m.ChevronRight,{size:14})]}),j&&(0,b.jsxs)("div",{className:"rounded-xl border border-white/[0.08] overflow-hidden",style:{background:"var(--bg-panel)"},children:[(0,b.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-white/[0.06]",children:[(0,b.jsx)("span",{className:"text-xs text-white/30 font-mono",children:"agent-card.json"}),(0,b.jsx)("span",{className:"text-xs text-white/20 font-mono",children:"A2A v1.0"})]}),(0,b.jsx)("div",{className:"p-4 font-mono text-sm leading-6 overflow-x-auto",children:i.split("\n").map((a,c)=>(0,b.jsxs)("div",{className:"flex gap-4 hover:bg-white/[0.02] px-2 rounded",children:[(0,b.jsx)("span",{className:"text-white/20 w-5 shrink-0 select-none text-right",children:c+1}),(0,b.jsx)("span",{dangerouslySetInnerHTML:{__html:a.replace(/"([^"]+)":/g,'<span class="text-[#79c0ff]">"$1"</span>:').replace(/: "([^"]*)"(,?)/g,': <span class="text-[#a5d6ff]">"$1"</span>$2').replace(/: (true|false)(,?)/g,': <span class="text-[#ff7b72]">$1</span>$2')},className:"whitespace-pre"})]},c))})]})]})]}),(0,b.jsxs)("div",{className:"px-6 py-4 border-t border-white/[0.08] flex items-center justify-between shrink-0",style:{background:"var(--bg-card)"},children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(p,{size:14,className:"text-purple-400/50"}),(0,b.jsxs)("span",{className:"text-sm text-white/40",children:[h.skills.length," skill",h.skills.length>1?"s":""," · Google A2A Protocol"]})]}),(0,b.jsx)("button",{onClick:d,className:"text-sm font-semibold px-5 py-2 rounded-xl transition-all hover:opacity-90",style:{background:"linear-gradient(135deg, #a855f7, #ec4899)",color:"#fff"},children:"Close"})]})]})})}function v({lines:a}){let d=(0,c.useRef)(null);return((0,c.useEffect)(()=>{d.current?.scrollTo({top:d.current.scrollHeight,behavior:"smooth"})},[a]),0===a.length)?null:(0,b.jsxs)("div",{className:"mt-2 border border-white/[0.06] rounded-lg overflow-hidden",style:{background:"var(--bg-panel)"},children:[(0,b.jsxs)("div",{className:"flex items-center gap-1.5 px-3 py-1.5 border-b border-white/[0.06]",children:[(0,b.jsx)(n.Terminal,{size:12,className:"text-white/30"}),(0,b.jsx)("span",{className:"text-xs text-white/35 font-mono uppercase tracking-wider",children:"sandbox"})]}),(0,b.jsx)("div",{ref:d,className:"max-h-32 overflow-y-auto p-3 space-y-0.5",children:a.map((a,c)=>(0,b.jsx)("div",{className:`text-sm font-mono leading-5 whitespace-pre-wrap ${a.startsWith("$")?"text-[#7dd3fc]":a.includes("error")||a.includes("FAIL")?"text-red-400":a.includes("✓")||a.includes("passed")?"text-green-400":"text-white/50"}`,children:a},c))})]})}function w({task:a,terminalLines:d,isCollabTarget:e,isCollabSource:f}){let[g,h]=(0,c.useState)(!1),[i,j]=(0,c.useState)(null),[k,n]=(0,c.useState)(!1),o=function(a,b=18){let[d,e]=(0,c.useState)(a),f=(0,c.useRef)(a);return(0,c.useEffect)(()=>{if(a===f.current)return;f.current=a,e("");let c=0,d=setInterval(()=>{c++,e(a.slice(0,c)),c>=a.length&&clearInterval(d)},b);return()=>clearInterval(d)},[a,b]),d}(a.statusText,20),q=e?"border-purple-500/60 shadow-[0_0_12px_rgba(168,85,247,0.25)]":f?"border-purple-400/40":"running"===a.status?"border-yellow-500/40 shadow-[0_0_8px_rgba(234,179,8,0.1)]":"completed"===a.status?"border-green-500/25":"failed"===a.status?"border-red-500/25":"border-white/[0.06]",x="running"===a.status?"bg-yellow-500/[0.04]":"completed"===a.status?"bg-green-500/[0.04]":"failed"===a.status?"bg-red-500/[0.04]":"";return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:`rounded-xl border transition-all duration-500 ${q} ${x} overflow-hidden`,style:{background:x?void 0:"var(--bg-card)"},children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3 cursor-pointer select-none",onClick:()=>h(a=>!a),children:[(0,b.jsx)("span",{className:"text-base shrink-0",children:a.icon}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-violet-400 font-semibold text-base",children:a.role}),(0,b.jsx)(r,{status:a.status}),"completed"===a.status&&(0,b.jsx)("span",{className:"text-xs text-green-400 font-mono",children:"✓ done"})]}),(0,b.jsx)("p",{className:"text-sm text-white/45 font-mono mt-0.5 truncate",children:o})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[a.artifacts.length>0&&(0,b.jsxs)("span",{className:"text-xs text-white/35 font-mono",children:[a.artifacts.length," file",a.artifacts.length>1?"s":""]}),(0,b.jsxs)("button",{onClick:a=>{a.stopPropagation(),n(!0)},title:"View A2A Agent Card",className:"flex items-center gap-1.5 text-xs font-mono px-2.5 py-1 rounded-lg transition-all hover:scale-105",style:{background:"linear-gradient(135deg, rgba(168,85,247,0.15), rgba(236,72,153,0.15))",border:"1px solid rgba(168,85,247,0.3)"},children:[(0,b.jsx)(p,{size:11,className:"text-purple-400"}),(0,b.jsx)("span",{className:"text-purple-300 font-semibold",children:"A2A"})]}),g?(0,b.jsx)(l,{size:14,className:"text-white/30"}):(0,b.jsx)(m.ChevronRight,{size:14,className:"text-white/30"})]})]}),g&&(0,b.jsxs)("div",{className:"px-4 pb-3 border-t border-white/[0.07] pt-3 space-y-3",children:[(0,b.jsx)("p",{className:"text-sm text-white/45 italic",children:a.goal}),(0,b.jsx)(v,{lines:d}),a.findings.length>0&&(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("p",{className:"text-xs text-white/35 uppercase tracking-wider font-mono",children:"Findings"}),a.findings.map((a,c)=>(0,b.jsxs)("div",{className:"flex gap-2 text-sm text-white/70",children:[(0,b.jsx)("span",{className:"text-green-400 shrink-0",children:"✓"}),(0,b.jsx)("span",{children:a})]},c))]}),a.artifacts.length>0&&(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-xs text-white/35 uppercase tracking-wider font-mono mb-2",children:"Files"}),(0,b.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.artifacts.map((a,c)=>(0,b.jsx)(s,{artifact:a,onClick:()=>j(a)},c))})]})]})]}),i&&(0,b.jsx)(t,{artifact:i,onClose:()=>j(null)}),k&&(0,b.jsx)(u,{task:a,onClose:()=>n(!1)})]})}function x({event:a,tasks:c}){let d=a.fromTaskId?c[a.fromTaskId]?.role:"?",e=a.toTaskId?c[a.toTaskId]?.role:"?";return(0,b.jsxs)("div",{className:"flex items-start gap-2 px-3 py-2.5 rounded-xl bg-purple-500/8 border border-purple-500/20 animate-pulse-once",children:[(0,b.jsx)("span",{className:"text-base shrink-0",children:"🔗"}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"text-sm text-purple-300 font-medium",children:[d," → ",e]}),(0,b.jsx)("div",{className:"text-sm text-purple-400/80 font-mono mt-0.5",children:String(a.data.message??"")})]})]})}function y({tasks:a,rootId:c}){let d=Object.values(a).filter(a=>a.id!==c);if(0===d.length)return null;let e=d.filter(a=>"completed"===a.status).length,f=Math.round(e/d.length*100);return(0,b.jsxs)("div",{className:"px-4 py-2.5 border-b border-white/[0.07]",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between text-xs text-white/40 font-mono mb-1.5",children:[(0,b.jsxs)("span",{children:[e,"/",d.length," agents complete"]}),(0,b.jsxs)("span",{children:[f,"%"]})]}),(0,b.jsx)("div",{className:"h-1.5 bg-white/[0.06] rounded-full overflow-hidden",children:(0,b.jsx)("div",{className:"h-full bg-gradient-to-r from-purple-500 via-pink-500 to-orange-400 rounded-full transition-all duration-700 ease-out",style:{width:`${f}%`}})})]})}function z({tasks:a,rootId:d,events:e}){let f=Object.values(a),g=d?a[d]:null,h=f.filter(a=>a.id!==d),i=e.filter(a=>"collaboration"===a.type),[j,k]=(0,c.useState)(new Set);(0,c.useEffect)(()=>{f.forEach((a,b)=>{setTimeout(()=>k(b=>new Set([...b,a.id])),120*b)})},[f.length]);let l={};for(let a of e)if("terminal"===a.type&&a.taskId){l[a.taskId]||(l[a.taskId]=[]);let b=String(a.data.output??"");l[a.taskId].push(...b.split("\n").filter(Boolean))}let m=new Set(i.map(a=>a.toTaskId).filter(Boolean)),n=new Set(i.map(a=>a.fromTaskId).filter(Boolean));return 0===f.length?(0,b.jsx)("div",{className:"h-full flex items-center justify-center text-center p-8",children:(0,b.jsxs)("div",{children:[(0,b.jsx)(q,{size:48,className:"text-white/15 mx-auto mb-4"}),(0,b.jsx)("p",{className:"text-white/30 text-base",children:"Agent activity appears here"}),(0,b.jsx)("p",{className:"text-white/20 text-sm mt-1",children:"Tasks and agent progress will show when a run starts"})]})}):(0,b.jsxs)("div",{className:"h-full flex flex-col overflow-hidden",children:[(0,b.jsx)(y,{tasks:a,rootId:d}),(0,b.jsxs)("div",{className:"flex-1 overflow-y-auto p-4 space-y-3",children:[g&&j.has(g.id)&&(0,b.jsxs)("div",{className:"transition-all duration-300 animate-slide-in",children:[(0,b.jsx)("div",{className:"text-xs text-white/30 uppercase tracking-widest font-mono mb-2",children:"Orchestrator"}),(0,b.jsx)(w,{task:g,terminalLines:l[g.id]??[],isCollabTarget:!1,isCollabSource:!1})]}),h.length>0&&(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"text-xs text-white/30 uppercase tracking-widest font-mono mb-2",children:["Agent Team · ",h.length," specialists"]}),(0,b.jsx)("div",{className:"space-y-2",children:h.map(a=>j.has(a.id)?(0,b.jsx)("div",{className:"transition-all duration-300 animate-slide-in",children:(0,b.jsx)(w,{task:a,terminalLines:l[a.id]??[],isCollabTarget:m.has(a.id),isCollabSource:n.has(a.id)})},a.id):null)})]}),i.length>0&&(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-xs text-white/30 uppercase tracking-widest font-mono mb-2",children:"Collaborations"}),(0,b.jsx)("div",{className:"space-y-2",children:i.map((c,d)=>(0,b.jsx)(x,{event:c,tasks:a},d))})]})]})]})}let A=[{id:"google/gemini-3.1-pro",label:"Gemini 3.1 Pro",badge:"latest"},{id:"google/gemini-3.1-flash-lite",label:"Gemini 3.1 Flash-Lite",badge:"fast"},{id:"google/gemini-3-pro",label:"Gemini 3 Pro",badge:""},{id:"google/gemini-3-flash",label:"Gemini 3 Flash",badge:""},{id:"google/gemini-2.5-pro",label:"Gemini 2.5 Pro",badge:""},{id:"google/gemini-2.5-flash",label:"Gemini 2.5 Flash",badge:"recommended"},{id:"google/gemini-2.5-flash-lite",label:"Gemini 2.5 Flash-Lite",badge:""},{id:"google/gemini-2.0-flash",label:"Gemini 2.0 Flash",badge:""},{id:"google/gemini-2.0-flash-lite",label:"Gemini 2.0 Flash-Lite",badge:"budget"}];function B({value:a,onChange:c}){return(0,b.jsx)("select",{value:a,onChange:a=>c(a.target.value),className:"border border-white/15 text-sm rounded-lg px-3 py-1.5 outline-none focus:border-white/30 cursor-pointer",style:{background:"var(--bg-hover)",color:"rgb(var(--fg))"},children:A.map(a=>(0,b.jsxs)("option",{value:a.id,children:[a.label,a.badge?` (${a.badge})`:""]},a.id))})}let C=(0,f.default)("panel-right-open",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]]),D=(0,f.default)("panel-right-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]),E=(0,f.default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);var F=a.i(21161);let G=(0,f.default)("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),H=(0,f.default)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var I=a.i(52495);class J{handlers=[];queue=[];closed=!1;on(a){for(let b of(this.handlers.push(a),this.queue))a(b)}emit(a){for(let b of(this.queue.push(a),this.handlers))b(a)}close(){this.closed=!0}isClosed(){return this.closed}}let K={maxDepth:3,maxWorkers:6,maxTotalTasks:15,maxStepsPerAgent:20,plannerModel:"google/gemini-2.5-pro",workerModel:"google/gemini-2.5-flash",repoUrl:""},L=a=>new Promise(b=>setTimeout(b,a));function M(a){return{parentId:null,status:"pending",statusText:"Waiting to start...",findings:[],artifacts:[],children:[],sandboxId:null,model:"google/gemini-2.5-flash",createdAt:Date.now(),completedAt:null,depth:1,icon:"⚙️",...a}}class N{emitter;config;constructor(a={}){this.emitter=new J,this.config={...K,...a}}onEvent(a){this.emitter.on(a)}async run(a){let b=M({id:"root",parentId:null,role:"Tech Lead",goal:a,depth:0,model:this.config.plannerModel,icon:"🧠",status:"running",statusText:"Spinning up sandbox..."});for(let[a,c,d]of(this.emitter.emit({type:"task-created",taskId:"root",data:{task:b}}),[[400,"Spinning up sandbox..."],[500,"Analyzing goal..."],[300,"Exploring monorepo structure...","$ ls packages/ | wc -l\n47"],[600,"Scanning provider packages...",'$ find packages -name "*-provider.ts" | head -8\npackages/openai/src/openai-provider.ts\npackages/anthropic/src/anthropic-provider.ts\npackages/google/src/google-provider.ts\npackages/mistral/src/mistral-provider.ts'],[700,"Reading interface contracts...",'$ grep -r "implements LanguageModelV1" packages/ --include="*.ts" -l\npackages/openai/src/openai-chat-model.ts\npackages/anthropic/src/anthropic-messages-language-model.ts'],[500,"Understanding test patterns...","$ ls packages/openai/src/__tests__/\nopenai-chat-model.test.ts\nopenai-completion-model.test.ts\nopenai-provider.test.ts"],[400,"Assembling the team..."]]))await L(a),this.emitter.emit({type:"task-updated",taskId:"root",data:{statusText:c}}),d&&(this.emitter.emit({type:"terminal",taskId:"root",data:{output:d}}),await L(200));let c=this.buildWorkerPlan(a);for(let a of c)a.icon=function(a){let b=a.toLowerCase();return b.includes("scout")||b.includes("architect")||b.includes("analysis")||b.includes("explorer")?"🔍":b.includes("lead")||b.includes("planner")||b.includes("tech")?"🧠":b.includes("test")||b.includes("qa")||b.includes("verif")?"🧪":b.includes("package")||b.includes("config")||b.includes("infra")?"📦":b.includes("doc")?"📝":b.includes("front")||b.includes("ui")||b.includes("design")?"🎨":b.includes("security")||b.includes("auth")||b.includes("risk")?"🔐":b.includes("scanner")||b.includes("scan")?"🔎":"⚙️"}(a.role);for(let a of c)this.emitter.emit({type:"task-created",taskId:a.id,data:{task:a}}),await L(280);this.emit("task-completed","root","Team assembled — workers running in parallel"),await Promise.all(c.map((a,b)=>this.runWorker(a,150*b))),await L(500);let d=c.flatMap(a=>a.artifacts);this.emitter.emit({type:"task-updated",taskId:"root",data:{statusText:"Synthesizing results..."}}),await L(600);let e=this.buildSummary(a,c,d);this.emitter.emit({type:"synthesis",taskId:"root",data:{content:e,artifacts:d}}),await L(300),this.emitter.emit({type:"done",data:{content:e,artifacts:d}}),this.emitter.close()}emit(a,b,c){this.emitter.emit({type:a,taskId:b,data:{statusText:c}})}buildWorkerPlan(a){let b=a.toLowerCase();return b.includes("provider")||b.includes("sdk")||b.includes("package")||b.includes("deepseek")?[M({id:"scout",role:"Architecture Scout",goal:"Explore existing provider packages and document interface contracts, file patterns, and test conventions",icon:"🔍"}),M({id:"engineer",role:"Provider Engineer",goal:"Implement the new provider package — provider class, chat model, streaming, reasoning tokens",icon:"⚙️"}),M({id:"tester",role:"Test Engineer",goal:"Write comprehensive tests matching existing monorepo test patterns",icon:"🧪"}),M({id:"packager",role:"Package Engineer",goal:"Set up package.json, tsconfig.json, exports, and wire into the monorepo build system",icon:"📦"})]:b.includes("security")||b.includes("vulnerabilit")||b.includes("audit")?[M({id:"dep-scanner",role:"Dependency Scanner",goal:"Audit all dependencies for known vulnerabilities",icon:"🔎"}),M({id:"auth-analyzer",role:"Auth Flow Analyzer",goal:"Trace authentication flows and identify weaknesses",icon:"🔐"}),M({id:"input-checker",role:"Input Validator",goal:"Check all user input handling for injection attack surfaces",icon:"⚙️"}),M({id:"risk-report",role:"Risk Prioritizer",goal:"Combine all findings into a prioritized security report",icon:"📝"})]:b.includes("research")||b.includes("command")||b.includes("cli")||b.includes("feature")?[M({id:"explorer",role:"Codebase Explorer",goal:"Map the existing command structure and extension patterns",icon:"🔍"}),M({id:"implementer",role:"Feature Engineer",goal:"Implement the new feature following existing patterns",icon:"⚙️"}),M({id:"integrator",role:"Integration Engineer",goal:"Wire the feature into the CLI entry point and config",icon:"📦"}),M({id:"tester",role:"Test Engineer",goal:"Write integration tests covering the new command end-to-end",icon:"🧪"})]:[M({id:"explorer",role:"Codebase Explorer",goal:"Map the repository structure and identify relevant files",icon:"🔍"}),M({id:"implementer",role:"Implementation Engineer",goal:"Implement the requested changes following existing patterns",icon:"⚙️"}),M({id:"verifier",role:"Verification Engineer",goal:"Verify the implementation is correct and consistent",icon:"🧪"})]}async runWorker(a,b){for(let c of(await L(b),this.emitter.emit({type:"task-updated",taskId:a.id,data:{status:"running",statusText:"Starting sandbox..."}}),await L(300),this.stepsForRole(a.role)))await L(c.delay),this.emitter.emit({type:"task-updated",taskId:a.id,data:{statusText:c.text}}),c.cmd&&(this.emitter.emit({type:"terminal",taskId:a.id,data:{output:c.cmd}}),await L(180));"engineer"===a.id&&(await L(600),this.emitter.emit({type:"collaboration",fromTaskId:"tester",toTaskId:"engineer",data:{message:"Type error: doStream() must return AsyncIterable<LanguageModelV1StreamPart>"}}),await L(300),this.emitter.emit({type:"task-updated",taskId:a.id,data:{statusText:"Fixing streaming return type..."}}),this.emitter.emit({type:"terminal",taskId:a.id,data:{output:"$ npx tsc --noEmit\nsrc/deepseek-chat-model.ts:47:5 - error TS2322: Type mismatch on doStream return\n\nFixing..."}}),await L(700),this.emitter.emit({type:"task-updated",taskId:a.id,data:{statusText:"Type check passing ✓"}}),this.emitter.emit({type:"terminal",taskId:a.id,data:{output:"$ npx tsc --noEmit\n✓ No errors found"}}),await L(300));let c=this.artifactsForRole(a.role),d=this.findingsForRole(a.role);for(let b of c)await L(150),this.emitter.emit({type:"artifact",taskId:a.id,data:{artifact:b}});for(let b of d)this.emitter.emit({type:"finding",taskId:a.id,data:{content:b}});await L(200),this.emitter.emit({type:"task-completed",taskId:a.id,data:{statusText:"Done",artifacts:c,findings:d}}),a.status="completed",a.artifacts=c,a.findings=d}stepsForRole(a){let b=a.toLowerCase();return b.includes("scout")||b.includes("explorer")||b.includes("codebase")?[{text:"Scanning packages directory...",delay:400,cmd:"$ ls packages/ | head -12\nai anthropic azure cohere deepseek\ngoogle groq mistral openai perplexity"},{text:"Reading openai provider structure...",delay:700,cmd:'$ find packages/openai/src -name "*.ts" | head -6\npackages/openai/src/index.ts\npackages/openai/src/openai-provider.ts\npackages/openai/src/openai-chat-model.ts\npackages/openai/src/convert-to-openai-messages.ts'},{text:"Extracting interface contracts...",delay:800,cmd:'$ head -30 packages/openai/src/openai-chat-model.ts\nexport class OpenAIChatModel implements LanguageModelV1 {\n readonly specificationVersion = "v1";\n readonly provider: string;\n readonly modelId: string;\n ...'},{text:"Checking test patterns...",delay:600,cmd:'$ head -20 packages/openai/src/__tests__/openai-chat-model.test.ts\nimport { describe, it, expect, vi } from "vitest";\nimport { createOpenAI } from "../openai-provider";\n\nconst server = createTestServer({...})'},{text:"Documenting findings...",delay:500}]:b.includes("provider")||b.includes("feature")||b.includes("implement")?[{text:"Reading Architecture Scout findings...",delay:400},{text:"Creating package directory...",delay:300,cmd:"$ mkdir -p packages/deepseek/src/__tests__"},{text:"Writing deepseek-provider.ts...",delay:900,cmd:'$ cat > packages/deepseek/src/deepseek-provider.ts\nexport function createDeepSeek(options) {\n const baseURL = options.baseURL ?? "https://api.deepseek.com/v1";\n return { chat: (modelId) => new DeepSeekChatModel(modelId, ...) }\n}'},{text:"Implementing chat model...",delay:1100,cmd:"$ cat > packages/deepseek/src/deepseek-chat-model.ts\nexport class DeepSeekChatModel implements LanguageModelV1 {\n async doGenerate(options) { ... }\n async doStream(options) { ... }\n}"},{text:"Adding streaming support...",delay:800,cmd:"$ wc -l packages/deepseek/src/deepseek-chat-model.ts\n 187 packages/deepseek/src/deepseek-chat-model.ts"},{text:"Running type check...",delay:600,cmd:"$ npx tsc --noEmit\n...(checking)"}]:b.includes("test")||b.includes("verif")?[{text:"Studying existing test patterns...",delay:500,cmd:'$ grep -r "createTestServer\\|mockFetch" packages/openai --include="*.ts" -l\npackages/openai/src/__tests__/openai-chat-model.test.ts'},{text:"Writing provider tests...",delay:700,cmd:'$ cat > packages/deepseek/src/__tests__/deepseek-provider.test.ts\ndescribe("createDeepSeek", () => {\n it("creates provider with default URL", () => {...})\n it("passes apiKey to model", () => {...})\n})'},{text:"Writing streaming tests...",delay:800,cmd:'$ cat >> packages/deepseek/src/__tests__/deepseek-chat-model.test.ts\nit("streams text chunks correctly", async () => {\n const chunks = [];\n for await (const chunk of stream) { chunks.push(chunk); }\n expect(chunks[0].type).toBe("text-delta");\n})'},{text:"Running vitest...",delay:900,cmd:"$ npx vitest run packages/deepseek --reporter=verbose\n✓ deepseek-provider.test.ts (3)\n✓ deepseek-chat-model.test.ts (4)\n✗ deepseek-chat-model.test.ts > streaming type (1)\n\nFAIL: expected AsyncIterable<StreamPart>, got ReadableStream"},{text:"Reporting type error to Provider Engineer...",delay:400},{text:"Waiting for fix...",delay:1200},{text:"Re-running vitest...",delay:400,cmd:"$ npx vitest run packages/deepseek --reporter=verbose\n✓ deepseek-provider.test.ts (3)\n✓ deepseek-chat-model.test.ts (5)\n\nTest Files 1 passed\nTests 8 passed\nDuration 1.24s"}]:b.includes("package")||b.includes("config")||b.includes("integrat")?[{text:"Checking workspace config...",delay:400,cmd:'$ cat pnpm-workspace.yaml\npackages:\n - "packages/*"\n - "packages/provider-utils"'},{text:"Writing package.json...",delay:500,cmd:'$ cat > packages/deepseek/package.json\n{\n "name": "@ai-sdk/deepseek",\n "version": "1.0.0",\n "dependencies": {\n "@ai-sdk/provider": "workspace:*"\n }\n}'},{text:"Writing tsconfig.json...",delay:400,cmd:'$ cat > packages/deepseek/tsconfig.json\n{\n "extends": "../../tsconfig.json",\n "compilerOptions": { "outDir": "dist" },\n "include": ["src"]\n}'},{text:"Wiring into monorepo...",delay:500,cmd:'$ cat >> tsconfig.json\n{ "path": "packages/deepseek/tsconfig.json" }'},{text:"Verifying workspace links...",delay:400,cmd:"$ pnpm list @ai-sdk/deepseek\n@ai-sdk/deepseek 1.0.0 packages/deepseek"}]:b.includes("auth")||b.includes("input")||b.includes("risk")||b.includes("dep")?[{text:"Scanning codebase...",delay:500,cmd:'$ find . -name "*.ts" | xargs grep -l "password\\|token\\|secret" | head -8'},{text:"Analyzing patterns...",delay:800},{text:"Running checks...",delay:700,cmd:"$ npx audit-ci --moderate"},{text:"Compiling findings...",delay:500}]:[{text:"Analyzing task...",delay:500},{text:"Working...",delay:1e3},{text:"Finalizing...",delay:600}]}artifactsForRole(a){let b=a.toLowerCase();return b.includes("scout")||b.includes("codebase")?[{filename:"architecture-findings.md",language:"markdown",content:`# Architecture Findings
2
2
 
3
3
  ## Provider Pattern
4
4
  All providers implement \`LanguageModelV1\` from \`@ai-sdk/provider\`.
@@ -182,6 +182,6 @@ ${b.map(a=>`- **${a.role}**: ${a.findings[0]??"Completed"}`).join("\n")}`:`##
182
182
  ${d}
183
183
 
184
184
  ### Agent Team (${b.length} agents)
185
- ${b.map(a=>`- **${a.role}**: ${a.findings[0]??"Completed"}`).join("\n")}`}}let O="agentnetes-settings",P="true"===process.env.NEXT_PUBLIC_STATIC_MODE,Q={sandboxProvider:"docker",repoUrl:"https://github.com/expressjs/express",plannerModel:"google/gemini-2.5-flash",workerModel:"google/gemini-2.5-flash"};function R({current:a,apiKeySet:d,onClose:e}){let[f,g]=(0,c.useState)(a),h=a=>g(b=>({...b,...a}));return(0,b.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 backdrop-blur-sm",style:{background:"rgba(0,0,0,0.7)"},onClick:b=>b.target===b.currentTarget&&e(a),children:(0,b.jsxs)("div",{className:"w-full max-w-md rounded-2xl border border-white/[0.12] overflow-hidden shadow-2xl",style:{background:"var(--bg-card)"},children:[(0,b.jsxs)("div",{className:"px-6 pt-5 pb-4 border-b border-white/[0.07] flex items-center justify-between",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h2",{className:"text-white font-bold text-base",children:"Runtime Settings"}),(0,b.jsx)("p",{className:"text-sm text-white/40 font-mono mt-0.5",children:"Saved in your browser"})]}),(0,b.jsx)("button",{onClick:()=>e(a),className:"text-white/30 hover:text-white/60 transition-colors text-xl leading-none",children:"✕"})]}),(0,b.jsxs)("div",{className:"px-6 py-5 space-y-5",children:[(0,b.jsxs)("div",{className:`flex items-start gap-3 rounded-xl px-4 py-3 border ${d?"border-green-500/20 bg-green-500/5":"border-yellow-500/20 bg-yellow-500/5"}`,children:[d?(0,b.jsx)(G,{size:15,className:"text-green-400 mt-0.5 shrink-0"}):(0,b.jsx)(H,{size:15,className:"text-yellow-400 mt-0.5 shrink-0"}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("p",{className:"text-sm font-mono font-medium",style:{color:d?"rgb(134 239 172)":"rgb(253 224 71)"},children:["GOOGLE_API_KEY ",d?"is set":"not set"]}),!d&&(0,b.jsxs)("div",{className:"mt-1.5 space-y-1.5",children:[(0,b.jsx)("p",{className:"text-sm text-white/45",children:"Option 1: export in your shell, then restart:"}),(0,b.jsx)("div",{className:"rounded-lg px-3 py-2 font-mono text-sm text-green-300/80 border border-white/10",style:{background:"var(--bg-subtle)"},children:"export GOOGLE_API_KEY=your_key_here"}),(0,b.jsxs)("p",{className:"text-sm text-white/45",children:["Option 2: add to ",(0,b.jsx)("span",{className:"font-mono text-white/60",children:".env.local"})," and restart:"]}),(0,b.jsx)("div",{className:"rounded-lg px-3 py-2 font-mono text-sm text-green-300/80 border border-white/10",style:{background:"var(--bg-subtle)"},children:"GOOGLE_API_KEY=your_key_here"}),(0,b.jsxs)("a",{href:"https://aistudio.google.com/apikey",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-0.5 text-purple-400/70 hover:text-purple-400 transition-colors text-sm",children:["Get a free key at aistudio.google.com ",(0,b.jsx)(I.ExternalLink,{size:12})]})]})]})]}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("label",{className:"text-xs font-mono text-white/40 uppercase tracking-widest block mb-1.5",children:["Target Repo URL ",(0,b.jsx)("span",{className:"text-red-400/80",children:"*"})]}),(0,b.jsx)("input",{type:"text",value:f.repoUrl,onChange:a=>h({repoUrl:a.target.value}),placeholder:"https://github.com/owner/repo",autoFocus:!0,className:"w-full rounded-lg border border-white/15 px-3 py-2 text-sm font-mono outline-none focus:border-purple-500/50 transition-colors",style:{background:"var(--bg-subtle)",color:"rgb(var(--fg))"}}),(0,b.jsx)("p",{className:"text-sm text-white/35 mt-1",children:"Agents clone this into each sandbox. Use a small repo for faster runs."})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-mono text-white/40 uppercase tracking-widest block mb-1.5",children:"Sandbox Provider"}),(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,b.jsxs)("button",{onClick:()=>h({sandboxProvider:"docker"}),className:`rounded-lg border px-4 py-3 text-left transition-all ${"docker"===f.sandboxProvider?"border-purple-500/50 bg-purple-500/10":"border-white/10 hover:border-white/20"}`,children:[(0,b.jsx)("div",{className:"text-white text-sm font-mono font-medium",children:"docker"}),(0,b.jsx)("div",{className:"text-white/40 text-xs mt-0.5",children:"Isolated containers · recommended"})]}),(0,b.jsxs)("button",{onClick:()=>h({sandboxProvider:"local"}),className:`rounded-lg border px-4 py-3 text-left transition-all ${"local"===f.sandboxProvider?"border-yellow-500/40 bg-yellow-500/5":"border-white/10 hover:border-white/20"}`,children:[(0,b.jsxs)("div",{className:"flex items-center gap-1.5 text-sm font-mono font-medium text-white/70",children:[(0,b.jsx)(H,{size:11,className:"text-yellow-500/70"})," local"]}),(0,b.jsx)("div",{className:"text-white/35 text-xs mt-0.5",children:"No isolation · not recommended"})]})]}),"docker"===f.sandboxProvider&&(0,b.jsxs)("p",{className:"text-sm text-white/35 mt-1.5 font-mono",children:["Make sure Docker is running: ",(0,b.jsx)("span",{className:"text-white/50",children:"docker pull node:20-alpine"})]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-mono text-white/40 uppercase tracking-widest block mb-2",children:"Models"}),(0,b.jsxs)("div",{className:"space-y-2.5",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("span",{className:"text-xs text-white/35 w-14 shrink-0",children:"Planner"}),(0,b.jsx)(B,{value:f.plannerModel,onChange:a=>h({plannerModel:a})})]}),(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("span",{className:"text-xs text-white/35 w-14 shrink-0",children:"Worker"}),(0,b.jsx)(B,{value:f.workerModel,onChange:a=>h({workerModel:a})})]})]})]})]}),(0,b.jsxs)("div",{className:"px-6 pb-5 flex justify-end gap-3 border-t border-white/[0.05] pt-4",children:[(0,b.jsx)("button",{onClick:()=>e(a),className:"px-4 py-2 rounded-lg text-sm text-white/40 hover:text-white/65 transition-colors",children:"Cancel"}),(0,b.jsx)("button",{onClick:function(){try{localStorage.setItem(O,JSON.stringify(f))}catch{}e(f)},disabled:!f.repoUrl.trim().startsWith("http"),className:"px-6 py-2.5 rounded-xl text-sm font-semibold transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{background:"linear-gradient(135deg, #a855f7, #ec4899)",color:"#fff"},children:"Save"})]})]})})}a.s(["default",0,function(){let[a,f]=(0,c.useState)([]),[g,h]=(0,c.useState)({}),[i,j]=(0,c.useState)(null),[l,m]=(0,c.useState)([]),[n,o]=(0,c.useState)(!1),[p,q]=(0,c.useState)(!0),[r,s]=(0,c.useState)(!1),[t,u]=(0,c.useState)(P?"simulation":"real"),[v,w]=(0,c.useState)(Q),[x,y]=(0,c.useState)(!1),A=(0,c.useRef)(!1);(0,c.useEffect)(()=>{A.current||(A.current=!0,w(function(){try{let a=localStorage.getItem(O);return a?{...Q,...JSON.parse(a)}:{...Q}}catch{return{...Q}}}()),fetch("/api/config").then(a=>a.json()).then(a=>y(!!a.googleApiKeySet)).catch(()=>{}))},[]);let B=(0,c.useCallback)((a,b)=>{if(m(b=>[...b,a]),"task-created"===a.type){let b=a.data.task;h(a=>({...a,[b.id]:b})),0===b.depth&&j(b.id)}"task-updated"===a.type&&a.taskId&&h(b=>{let c=b[a.taskId];return c?{...b,[a.taskId]:{...c,status:a.data.status??c.status,statusText:a.data.statusText??c.statusText}}:b}),"task-completed"===a.type&&a.taskId&&h(b=>{let c=b[a.taskId];return c?{...b,[a.taskId]:{...c,status:"completed",statusText:"Done",completedAt:Date.now(),artifacts:a.data.artifacts??c.artifacts,findings:a.data.findings??c.findings}}:b}),"artifact"===a.type&&a.taskId&&h(b=>{let c=b[a.taskId];if(!c)return b;let d=a.data.artifact;return c.artifacts.some(a=>a.filename===d.filename)?b:{...b,[a.taskId]:{...c,artifacts:[...c.artifacts,d]}}}),"done"===a.type&&(b.content=String(a.data.content??"")),"error"===a.type&&(b.content=`Error: ${String(a.data.message??a.data)}`)},[]),G=(0,c.useCallback)(async a=>{f(b=>[...b,{role:"user",content:a}]),h({}),j(null),m([]),o(!0);let b={content:""};try{if("simulation"===t){let c=new N({});c.onEvent(a=>B(a,b)),await c.run(a)}else{let c=await fetch("/api/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:a,sandboxProvider:v.sandboxProvider,repoUrl:v.repoUrl,plannerModel:v.plannerModel,workerModel:v.workerModel})});if(!c.body)throw Error("No response body");let d=c.body.getReader(),e=new TextDecoder;for(;;){let{done:a,value:c}=await d.read();if(a)break;for(let a of e.decode(c,{stream:!0}).split("\n"))if(a.startsWith("data: "))try{B(JSON.parse(a.slice(6)),b)}catch{}}}b.content&&f(a=>[...a,{role:"assistant",content:b.content}])}catch(a){f(b=>[...b,{role:"assistant",content:`Error: ${String(a)}`}])}finally{o(!1)}},[t,v,B]);return(0,b.jsxs)("div",{className:"h-screen overflow-hidden flex flex-col",style:{background:"var(--bg-base)",color:"rgb(var(--fg))"},children:[r&&(0,b.jsx)(R,{current:v,apiKeySet:x,onClose:a=>{w(a),s(!1)}}),(0,b.jsxs)("header",{className:"flex items-center justify-between px-5 py-2.5 border-b border-white/[0.07] shrink-0",style:{background:"var(--bg-base)"},children:[(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsxs)(d.default,{href:"/",className:"flex items-center gap-1.5 text-white/50 hover:text-white/80 transition-colors text-sm font-mono",children:[(0,b.jsx)(E,{size:15})," Home"]}),(0,b.jsx)("span",{className:"text-white/20",children:"|"}),(0,b.jsx)(e.default,{src:`${process.env.NEXT_PUBLIC_BASE_PATH??""}/logo.png`,alt:"Agentnetes",width:28,height:28,className:"rounded-lg"}),(0,b.jsx)("span",{className:"text-lg font-extrabold tracking-tight",children:"Agentnetes"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-1 rounded-full p-1 border border-white/[0.10]",style:{background:"var(--bg-subtle)"},children:[P?(0,b.jsx)("span",{className:"px-4 py-1.5 rounded-full text-sm font-mono text-white/20 cursor-not-allowed",title:"Real mode requires agentnetes serve or self-hosting",children:"Real"}):(0,b.jsx)("button",{onClick:()=>u("real"),className:`px-4 py-1.5 rounded-full text-sm font-mono font-medium transition-all ${"real"===t?"text-white":"text-white/35 hover:text-white/55"}`,style:"real"===t?{background:"linear-gradient(135deg, #a855f7, #ec4899)",color:"#fff"}:{},children:"Real"}),(0,b.jsx)("button",{onClick:()=>u("simulation"),className:`px-4 py-1.5 rounded-full text-sm font-mono font-medium transition-all ${"simulation"===t?"bg-white/10 text-white":"text-white/35 hover:text-white/55"}`,children:"Simulation"})]}),!P&&"real"===t&&(0,b.jsxs)("button",{onClick:()=>s(!0),className:"flex items-center gap-1.5 text-sm font-mono border border-white/10 rounded-xl px-3 py-1.5 transition-all",style:{background:"var(--bg-subtle)"},title:"Runtime settings",children:[(0,b.jsx)(F.Settings,{size:14,className:"text-white/50"}),(0,b.jsxs)("span",{className:"text-white/45",children:[v.sandboxProvider," · ",v.repoUrl.replace("https://github.com/","")]}),!x&&(0,b.jsx)("span",{className:"text-yellow-400/70 text-xs font-mono",children:"· no key"})]}),(0,b.jsx)("button",{onClick:()=>q(a=>!a),className:"text-white/50 hover:text-white/75 transition-colors p-1",title:p?"Hide agent panel":"Show agent panel",children:p?(0,b.jsx)(D,{size:19}):(0,b.jsx)(C,{size:19})})]})]}),P?(0,b.jsxs)("div",{className:"px-4 py-2 border-b border-white/[0.07] flex items-center justify-between shrink-0",style:{background:"var(--bg-subtle)"},children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-xs font-mono text-green-400/80 border border-green-500/20 bg-green-500/5 rounded px-2.5 py-1",children:"simulation only"}),(0,b.jsx)("span",{className:"text-sm text-white/45",children:"This is a preview. Real agents require a server."})]}),(0,b.jsxs)("div",{className:"flex items-center gap-3 text-sm font-mono",children:[(0,b.jsx)("span",{className:"text-white/40",children:"Run real agents:"}),(0,b.jsx)("code",{className:"text-purple-400/80 bg-purple-500/10 border border-purple-500/20 rounded px-2 py-0.5",children:"npx agentnetes serve"}),(0,b.jsx)("a",{href:"https://github.com/Shashikant86/agentnetes#running-locally",target:"_blank",rel:"noreferrer",className:"text-white/30 hover:text-white/60 transition-colors",children:"self-host"})]})]}):"simulation"===t&&(0,b.jsxs)("div",{className:"px-4 py-2 border-b border-white/[0.07] flex items-center gap-2 shrink-0",style:{background:"var(--bg-subtle)"},children:[(0,b.jsx)("span",{className:"text-xs font-mono text-green-400/80 border border-green-500/20 bg-green-500/5 rounded px-2.5 py-1",children:"simulation"}),(0,b.jsx)("span",{className:"text-sm text-white/45",children:"Pre-scripted scenarios · no API key or Docker required · switch to Real for live execution"})]}),(0,b.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,b.jsx)("div",{className:`flex flex-col border-r border-white/[0.07] overflow-hidden transition-all duration-300 ${p?"w-1/2":"w-full"}`,children:(0,b.jsx)(k,{messages:a,onSubmit:G,isRunning:n,mode:t})}),p&&(0,b.jsxs)("div",{className:"w-1/2 flex flex-col overflow-hidden",children:[(0,b.jsxs)("div",{className:"px-4 py-2.5 border-b border-white/[0.07] flex items-center justify-between shrink-0",children:[(0,b.jsx)("span",{className:"text-sm text-white/70 font-mono uppercase tracking-wider",children:"Agent Activity"}),Object.keys(g).length>0&&(0,b.jsxs)("span",{className:"text-sm text-white/60 font-mono",children:[Object.values(g).filter(a=>"completed"===a.status).length,"/",Object.keys(g).length," done"]})]}),(0,b.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,b.jsx)(z,{tasks:g,rootId:i,events:l})})]})]})]})}],58689)}];
185
+ ${b.map(a=>`- **${a.role}**: ${a.findings[0]??"Completed"}`).join("\n")}`}}let O="agentnetes-settings",P="true"===process.env.NEXT_PUBLIC_STATIC_MODE,Q={sandboxProvider:"docker",repoUrl:"https://github.com/expressjs/express",plannerModel:"google/gemini-2.5-flash",workerModel:"google/gemini-2.5-flash"};function R({current:a,apiKeySet:d,onClose:e}){let[f,g]=(0,c.useState)(a),h=a=>g(b=>({...b,...a}));return(0,b.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 backdrop-blur-sm",style:{background:"rgba(0,0,0,0.7)"},onClick:b=>b.target===b.currentTarget&&e(a),children:(0,b.jsxs)("div",{className:"w-full max-w-md rounded-2xl border border-white/[0.12] overflow-hidden shadow-2xl",style:{background:"var(--bg-card)"},children:[(0,b.jsxs)("div",{className:"px-6 pt-5 pb-4 border-b border-white/[0.07] flex items-center justify-between",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h2",{className:"text-white font-bold text-base",children:"Runtime Settings"}),(0,b.jsx)("p",{className:"text-sm text-white/40 font-mono mt-0.5",children:"Saved in your browser"})]}),(0,b.jsx)("button",{onClick:()=>e(a),className:"text-white/30 hover:text-white/60 transition-colors text-xl leading-none",children:"✕"})]}),(0,b.jsxs)("div",{className:"px-6 py-5 space-y-5",children:[(0,b.jsxs)("div",{className:`flex items-start gap-3 rounded-xl px-4 py-3 border ${d?"border-green-500/20 bg-green-500/5":"border-yellow-500/20 bg-yellow-500/5"}`,children:[d?(0,b.jsx)(G,{size:15,className:"text-green-400 mt-0.5 shrink-0"}):(0,b.jsx)(H,{size:15,className:"text-yellow-400 mt-0.5 shrink-0"}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("p",{className:"text-sm font-mono font-medium",style:{color:d?"rgb(134 239 172)":"rgb(253 224 71)"},children:["GOOGLE_API_KEY ",d?"is set":"not set"]}),!d&&(0,b.jsxs)("div",{className:"mt-1.5 space-y-1.5",children:[(0,b.jsx)("p",{className:"text-sm text-white/45",children:"Option 1: export in your shell, then restart:"}),(0,b.jsx)("div",{className:"rounded-lg px-3 py-2 font-mono text-sm text-green-300/80 border border-white/10",style:{background:"var(--bg-subtle)"},children:"export GOOGLE_API_KEY=your_key_here"}),(0,b.jsxs)("p",{className:"text-sm text-white/45",children:["Option 2: add to ",(0,b.jsx)("span",{className:"font-mono text-white/60",children:".env.local"})," and restart:"]}),(0,b.jsx)("div",{className:"rounded-lg px-3 py-2 font-mono text-sm text-green-300/80 border border-white/10",style:{background:"var(--bg-subtle)"},children:"GOOGLE_API_KEY=your_key_here"}),(0,b.jsxs)("a",{href:"https://aistudio.google.com/apikey",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-0.5 text-purple-400/70 hover:text-purple-400 transition-colors text-sm",children:["Get a free key at aistudio.google.com ",(0,b.jsx)(I.ExternalLink,{size:12})]})]})]})]}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("label",{className:"text-xs font-mono text-white/40 uppercase tracking-widest block mb-1.5",children:["Target Repo URL ",(0,b.jsx)("span",{className:"text-red-400/80",children:"*"})]}),(0,b.jsx)("input",{type:"text",value:f.repoUrl,onChange:a=>h({repoUrl:a.target.value}),placeholder:"https://github.com/owner/repo",autoFocus:!0,className:"w-full rounded-lg border border-white/15 px-3 py-2 text-sm font-mono outline-none focus:border-purple-500/50 transition-colors",style:{background:"var(--bg-subtle)",color:"rgb(var(--fg))"}}),(0,b.jsx)("p",{className:"text-sm text-white/35 mt-1",children:"Agents clone this into each sandbox. Use a small repo for faster runs."})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-mono text-white/40 uppercase tracking-widest block mb-1.5",children:"Sandbox Provider"}),(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,b.jsxs)("button",{onClick:()=>h({sandboxProvider:"docker"}),className:`rounded-lg border px-4 py-3 text-left transition-all ${"docker"===f.sandboxProvider?"border-purple-500/50 bg-purple-500/10":"border-white/10 hover:border-white/20"}`,children:[(0,b.jsx)("div",{className:"text-white text-sm font-mono font-medium",children:"docker"}),(0,b.jsx)("div",{className:"text-white/40 text-xs mt-0.5",children:"Isolated containers · recommended"})]}),(0,b.jsxs)("button",{onClick:()=>h({sandboxProvider:"local"}),className:`rounded-lg border px-4 py-3 text-left transition-all ${"local"===f.sandboxProvider?"border-yellow-500/40 bg-yellow-500/5":"border-white/10 hover:border-white/20"}`,children:[(0,b.jsxs)("div",{className:"flex items-center gap-1.5 text-sm font-mono font-medium text-white/70",children:[(0,b.jsx)(H,{size:11,className:"text-yellow-500/70"})," local"]}),(0,b.jsx)("div",{className:"text-white/35 text-xs mt-0.5",children:"No isolation · not recommended"})]})]}),"docker"===f.sandboxProvider&&(0,b.jsxs)("p",{className:"text-sm text-white/35 mt-1.5 font-mono",children:["Make sure Docker is running: ",(0,b.jsx)("span",{className:"text-white/50",children:"docker pull node:20-alpine"})]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-mono text-white/40 uppercase tracking-widest block mb-2",children:"Models"}),(0,b.jsxs)("div",{className:"space-y-2.5",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("span",{className:"text-xs text-white/35 w-14 shrink-0",children:"Planner"}),(0,b.jsx)(B,{value:f.plannerModel,onChange:a=>h({plannerModel:a})})]}),(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("span",{className:"text-xs text-white/35 w-14 shrink-0",children:"Worker"}),(0,b.jsx)(B,{value:f.workerModel,onChange:a=>h({workerModel:a})})]})]})]})]}),(0,b.jsxs)("div",{className:"px-6 pb-5 flex justify-end gap-3 border-t border-white/[0.05] pt-4",children:[(0,b.jsx)("button",{onClick:()=>e(a),className:"px-4 py-2 rounded-lg text-sm text-white/40 hover:text-white/65 transition-colors",children:"Cancel"}),(0,b.jsx)("button",{onClick:function(){try{localStorage.setItem(O,JSON.stringify(f))}catch{}e(f)},disabled:!f.repoUrl.trim().startsWith("http"),className:"px-6 py-2.5 rounded-xl text-sm font-semibold transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{background:"linear-gradient(135deg, #a855f7, #ec4899)",color:"#fff"},children:"Save"})]})]})})}a.s(["default",0,function(){let[a,f]=(0,c.useState)([]),[g,h]=(0,c.useState)({}),[i,j]=(0,c.useState)(null),[l,m]=(0,c.useState)([]),[n,o]=(0,c.useState)(!1),[p,q]=(0,c.useState)(!0),[r,s]=(0,c.useState)(!1),[t,u]=(0,c.useState)(P?"simulation":"real"),[v,w]=(0,c.useState)(Q),[x,y]=(0,c.useState)(!1),A=(0,c.useRef)(!1);(0,c.useEffect)(()=>{A.current||(A.current=!0,w(function(){try{let a=localStorage.getItem(O);return a?{...Q,...JSON.parse(a)}:{...Q}}catch{return{...Q}}}()),fetch("/api/config").then(a=>a.json()).then(a=>y(!!a.googleApiKeySet)).catch(()=>{}))},[]);let B=(0,c.useCallback)((a,b)=>{if(m(b=>[...b,a]),"task-created"===a.type){let b=a.data.task;h(a=>({...a,[b.id]:b})),0===b.depth&&j(b.id)}"task-updated"===a.type&&a.taskId&&h(b=>{let c=b[a.taskId];return c?{...b,[a.taskId]:{...c,status:a.data.status??c.status,statusText:a.data.statusText??c.statusText}}:b}),"task-completed"===a.type&&a.taskId&&h(b=>{let c=b[a.taskId];return c?{...b,[a.taskId]:{...c,status:"completed",statusText:"Done",completedAt:Date.now(),artifacts:a.data.artifacts??c.artifacts,findings:a.data.findings??c.findings}}:b}),"artifact"===a.type&&a.taskId&&h(b=>{let c=b[a.taskId];if(!c)return b;let d=a.data.artifact;return c.artifacts.some(a=>a.filename===d.filename)?b:{...b,[a.taskId]:{...c,artifacts:[...c.artifacts,d]}}}),"done"===a.type&&(b.content=String(a.data.content??"")),"error"===a.type&&(b.content=`Error: ${String(a.data.message??a.data)}`)},[]),G=(0,c.useCallback)(async a=>{f(b=>[...b,{role:"user",content:a}]),h({}),j(null),m([]),o(!0);let b={content:""};try{if("simulation"===t){let c=new N({});c.onEvent(a=>B(a,b)),await c.run(a)}else{let c=await fetch("/api/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:a,mode:t,sandboxProvider:v.sandboxProvider,repoUrl:v.repoUrl,plannerModel:v.plannerModel,workerModel:v.workerModel})});if(!c.body)throw Error("No response body");let d=c.body.getReader(),e=new TextDecoder;for(;;){let{done:a,value:c}=await d.read();if(a)break;for(let a of e.decode(c,{stream:!0}).split("\n"))if(a.startsWith("data: "))try{B(JSON.parse(a.slice(6)),b)}catch{}}}b.content&&f(a=>[...a,{role:"assistant",content:b.content}])}catch(a){f(b=>[...b,{role:"assistant",content:`Error: ${String(a)}`}])}finally{o(!1)}},[t,v,B]);return(0,b.jsxs)("div",{className:"h-screen overflow-hidden flex flex-col",style:{background:"var(--bg-base)",color:"rgb(var(--fg))"},children:[r&&(0,b.jsx)(R,{current:v,apiKeySet:x,onClose:a=>{w(a),s(!1)}}),(0,b.jsxs)("header",{className:"flex items-center justify-between px-5 py-2.5 border-b border-white/[0.07] shrink-0",style:{background:"var(--bg-base)"},children:[(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsxs)(d.default,{href:"/",className:"flex items-center gap-1.5 text-white/50 hover:text-white/80 transition-colors text-sm font-mono",children:[(0,b.jsx)(E,{size:15})," Home"]}),(0,b.jsx)("span",{className:"text-white/20",children:"|"}),(0,b.jsx)(e.default,{src:`${process.env.NEXT_PUBLIC_BASE_PATH??""}/logo.png`,alt:"Agentnetes",width:28,height:28,className:"rounded-lg"}),(0,b.jsx)("span",{className:"text-lg font-extrabold tracking-tight",children:"Agentnetes"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-1 rounded-full p-1 border border-white/[0.10]",style:{background:"var(--bg-subtle)"},children:[P?(0,b.jsx)("span",{className:"px-4 py-1.5 rounded-full text-sm font-mono text-white/20 cursor-not-allowed",title:"Real mode requires agentnetes serve or self-hosting",children:"Real"}):(0,b.jsx)("button",{onClick:()=>u("real"),className:`px-4 py-1.5 rounded-full text-sm font-mono font-medium transition-all ${"real"===t?"text-white":"text-white/35 hover:text-white/55"}`,style:"real"===t?{background:"linear-gradient(135deg, #a855f7, #ec4899)",color:"#fff"}:{},children:"Real"}),(0,b.jsx)("button",{onClick:()=>u("simulation"),className:`px-4 py-1.5 rounded-full text-sm font-mono font-medium transition-all ${"simulation"===t?"bg-white/10 text-white":"text-white/35 hover:text-white/55"}`,children:"Simulation"})]}),!P&&"real"===t&&(0,b.jsxs)("button",{onClick:()=>s(!0),className:"flex items-center gap-1.5 text-sm font-mono border border-white/10 rounded-xl px-3 py-1.5 transition-all",style:{background:"var(--bg-subtle)"},title:"Runtime settings",children:[(0,b.jsx)(F.Settings,{size:14,className:"text-white/50"}),(0,b.jsxs)("span",{className:"text-white/45",children:[v.sandboxProvider," · ",v.repoUrl.replace("https://github.com/","")]}),!x&&(0,b.jsx)("span",{className:"text-yellow-400/70 text-xs font-mono",children:"· no key"})]}),(0,b.jsx)("button",{onClick:()=>q(a=>!a),className:"text-white/50 hover:text-white/75 transition-colors p-1",title:p?"Hide agent panel":"Show agent panel",children:p?(0,b.jsx)(D,{size:19}):(0,b.jsx)(C,{size:19})})]})]}),P?(0,b.jsxs)("div",{className:"px-4 py-2 border-b border-white/[0.07] flex items-center justify-between shrink-0",style:{background:"var(--bg-subtle)"},children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-xs font-mono text-green-400/80 border border-green-500/20 bg-green-500/5 rounded px-2.5 py-1",children:"simulation only"}),(0,b.jsx)("span",{className:"text-sm text-white/45",children:"This is a preview. Real agents require a server."})]}),(0,b.jsxs)("div",{className:"flex items-center gap-3 text-sm font-mono",children:[(0,b.jsx)("span",{className:"text-white/40",children:"Run real agents:"}),(0,b.jsx)("code",{className:"text-purple-400/80 bg-purple-500/10 border border-purple-500/20 rounded px-2 py-0.5",children:"npx agentnetes serve"}),(0,b.jsx)("a",{href:"https://github.com/Shashikant86/agentnetes#running-locally",target:"_blank",rel:"noreferrer",className:"text-white/30 hover:text-white/60 transition-colors",children:"self-host"})]})]}):"simulation"===t&&(0,b.jsxs)("div",{className:"px-4 py-2 border-b border-white/[0.07] flex items-center gap-2 shrink-0",style:{background:"var(--bg-subtle)"},children:[(0,b.jsx)("span",{className:"text-xs font-mono text-green-400/80 border border-green-500/20 bg-green-500/5 rounded px-2.5 py-1",children:"simulation"}),(0,b.jsx)("span",{className:"text-sm text-white/45",children:"Pre-scripted scenarios · no API key or Docker required · switch to Real for live execution"})]}),(0,b.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,b.jsx)("div",{className:`flex flex-col border-r border-white/[0.07] overflow-hidden transition-all duration-300 ${p?"w-1/2":"w-full"}`,children:(0,b.jsx)(k,{messages:a,onSubmit:G,isRunning:n,mode:t})}),p&&(0,b.jsxs)("div",{className:"w-1/2 flex flex-col overflow-hidden",children:[(0,b.jsxs)("div",{className:"px-4 py-2.5 border-b border-white/[0.07] flex items-center justify-between shrink-0",children:[(0,b.jsx)("span",{className:"text-sm text-white/70 font-mono uppercase tracking-wider",children:"Agent Activity"}),Object.keys(g).length>0&&(0,b.jsxs)("span",{className:"text-sm text-white/60 font-mono",children:[Object.values(g).filter(a=>"completed"===a.status).length,"/",Object.keys(g).length," done"]})]}),(0,b.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,b.jsx)(z,{tasks:g,rootId:i,events:l})})]})]})]})}],58689)}];
186
186
 
187
187
  //# sourceMappingURL=app_demo_page_tsx_0.31s93._.js.map
@@ -31,7 +31,7 @@ GOOGLE_API_KEY=your_key npx agentnetes run "add comprehensive test coverage"`}),
31
31
  `.trim()})]}),(0,b.jsxs)(A,{type:"tip",children:["Run ",(0,b.jsx)("code",{className:"text-purple-400",children:"npx agentnetes"})," with no arguments to see all available commands."]}),(0,b.jsx)(y,{children:"3. Install globally (optional)"}),(0,b.jsxs)(z,{children:["Skip the ",(0,b.jsx)("code",{className:"text-white/80 bg-white/5 px-1.5 py-0.5 rounded text-sm",children:"npx"})," prefix by installing once:"]}),(0,b.jsx)(w,{children:`npm install -g agentnetes
32
32
 
33
33
  # Then use anywhere
34
- GOOGLE_API_KEY=your_key agentnetes run "refactor auth module to use JWT"`}),(0,b.jsx)(y,{children:"Prerequisites"}),(0,b.jsx)("div",{className:"rounded-xl border border-white/10 overflow-hidden my-4",style:{background:"var(--bg-subtle)"},children:[["Node.js","18+","Required"],["Docker","any recent version","Required for docker sandbox (default)"],["Google API key","free tier works","Required · or use AI Gateway"],["Git","repo must have origin remote","Required"]].map(([a,c,d])=>(0,b.jsxs)("div",{className:"flex items-center gap-4 px-5 py-3 border-b border-white/[0.05] last:border-0",children:[(0,b.jsx)("span",{className:"text-white font-medium text-sm w-32 shrink-0",children:a}),(0,b.jsx)("span",{className:"text-white/50 text-sm font-mono",children:c}),(0,b.jsx)("span",{className:"text-white/35 text-xs ml-auto",children:d})]},a))}),(0,b.jsxs)(A,{type:"info",children:["Pull the Docker base image once to speed up first runs:"," ",(0,b.jsx)("code",{className:"text-white/80 bg-white/5 px-1.5 py-0.5 rounded text-sm",children:"docker pull node:20-alpine"})]}),(0,b.jsx)(x,{id:"how-it-works",children:"How it Works"}),(0,b.jsxs)(z,{children:["Agentnetes implements the ",(0,b.jsx)("a",{href:"https://arxiv.org/abs/2512.24601",target:"_blank",rel:"noreferrer",className:"text-purple-400 hover:text-purple-300 underline underline-offset-2",children:"RLM pattern (MIT CSAIL)"})," · context lives in sandboxes, not prompts."]}),[["1. You type a goal","A natural-language description of what you want done. No special syntax required."],["2. Root agent plans","A Tech Lead agent explores your repo structure and invents a specialist team tailored to the goal. Roles are fully emergent · nothing is hardcoded."],["3. Specialists run in parallel","Each specialist gets its own isolated sandbox with the repo cloned inside. They use two tools: search() and execute(). No file contents stuffed into prompts."],["4. AutoResearch loop","Agents write code, run tests, observe failures, patch, and repeat · following the write test fix loop until the task is done or the step budget is reached."],["5. Synthesis","The root agent collects all findings and delivers a final markdown summary of everything built."]].map(([a,c])=>(0,b.jsxs)("div",{className:"flex gap-4 mb-5",style:{},children:[(0,b.jsx)("div",{className:"w-1.5 shrink-0 rounded-full mt-1",style:{background:"linear-gradient(180deg, #a855f7 0%, #f97316 100%)",minHeight:"2rem"}}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-white font-semibold text-sm mb-1",children:a}),(0,b.jsx)("div",{className:"text-white/60 text-sm leading-relaxed",children:c})]})]},a)),(0,b.jsx)(y,{children:"The two-tool strategy"}),(0,b.jsx)(z,{children:"Every agent has exactly two tools · keeping the token footprint under ~1,000 tokens regardless of codebase size:"}),(0,b.jsx)(w,{lang:"typescript",children:`search(pattern, path?, fileGlob?) // grep -r across the repo
34
+ GOOGLE_API_KEY=your_key agentnetes run "refactor auth module to use JWT"`}),(0,b.jsx)(y,{children:"Prerequisites"}),(0,b.jsx)("div",{className:"rounded-xl border border-white/10 overflow-hidden my-4",style:{background:"var(--bg-subtle)"},children:[["Node.js","18+","Required"],["Docker","any recent version","Required for docker sandbox (default)"],["Google API key","free tier works","Required · or use AI Gateway"],["Git","repo must have origin remote","Required"]].map(([a,c,d])=>(0,b.jsxs)("div",{className:"flex items-center gap-4 px-5 py-3 border-b border-white/[0.05] last:border-0",children:[(0,b.jsx)("span",{className:"text-white font-medium text-sm w-32 shrink-0",children:a}),(0,b.jsx)("span",{className:"text-white/50 text-sm font-mono",children:c}),(0,b.jsx)("span",{className:"text-white/35 text-xs ml-auto",children:d})]},a))}),(0,b.jsxs)(A,{type:"info",children:["Pull the Docker base image once to speed up first runs:"," ",(0,b.jsx)("code",{className:"text-white/80 bg-white/5 px-1.5 py-0.5 rounded text-sm",children:"docker pull node:20-alpine"})]}),(0,b.jsx)(x,{id:"how-it-works",children:"How it Works"}),(0,b.jsxs)(z,{children:["Agentnetes implements the ",(0,b.jsx)("a",{href:"https://arxiv.org/abs/2512.24601",target:"_blank",rel:"noreferrer",className:"text-purple-400 hover:text-purple-300 underline underline-offset-2",children:"RLM pattern (MIT CSAIL)"})," · context lives in sandboxes, not prompts. One goal in, verified results out."]}),[["1. You type a goal","A natural-language description of what you want done. No special syntax, no config files, no agent definitions."],["2. Root agent decomposes","The root agent auto-researches your codebase and breaks the goal into focused sub-tasks. It invents the right specialist team on the fly · roles are never hardcoded."],["3. Agents get isolated sandboxes","Each specialist spins up in its own sandbox (Firecracker microVM, Docker container, or local) with a full coding agent harness and the repo pre-cloned. No shared state, no stuffed context windows."],["4. Auto-research loops","Inside each sandbox, agents run a tight RLM loop: search the codebase, read what they find, reason about the approach, execute code, and verify the result. They repeat until the sub-task is solved or the step budget is reached."],["5. Cross-sandbox collaboration","When one agent discovers something another needs · a failing test, a missing type, a better pattern · they collaborate to fix it. Agents coordinate through shared findings without sharing filesystems."],["6. Verified results delivered","The root agent merges all work, validates the combined output, and delivers a complete summary with all artifacts back to you."]].map(([a,c])=>(0,b.jsxs)("div",{className:"flex gap-4 mb-5",children:[(0,b.jsx)("div",{className:"w-1.5 shrink-0 rounded-full mt-1",style:{background:"linear-gradient(180deg, #a855f7 0%, #f97316 100%)",minHeight:"2rem"}}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-white font-semibold text-sm mb-1",children:a}),(0,b.jsx)("div",{className:"text-white/60 text-sm leading-relaxed",children:c})]})]},a)),(0,b.jsx)(y,{children:"The two-tool strategy"}),(0,b.jsx)(z,{children:"Every agent has exactly two MCP tools · keeping the token footprint under ~1,000 tokens regardless of codebase size. Agents compose all other operations from these primitives:"}),(0,b.jsx)(w,{lang:"typescript",children:`search(pattern, path?, fileGlob?) // grep -r across the repo
35
35
  execute(command) // run any shell command in the sandbox`}),(0,b.jsx)(x,{id:"local-docker",children:"Local Dev with Docker"}),(0,b.jsxs)(z,{children:["Run the full Agentnetes web app locally with real Docker sandboxes · no cloud accounts needed. Each agent gets its own ",(0,b.jsx)("code",{className:"text-white/80 bg-white/5 px-1.5 py-0.5 rounded text-sm",children:"node:20-alpine"})," container with the target repo cloned inside."]}),(0,b.jsx)(y,{children:"1. Pre-pull the Docker image"}),(0,b.jsx)(z,{children:"Do this once to avoid the image download on your first run:"}),(0,b.jsx)(w,{children:"docker pull node:20-alpine"}),(0,b.jsx)(y,{children:"2. Create .env.local"}),(0,b.jsxs)(z,{children:["In the root of the agentnetes repo, create a ",(0,b.jsx)("code",{className:"text-white/80 bg-white/5 px-1.5 py-0.5 rounded text-sm",children:".env.local"})," file:"]}),(0,b.jsx)(w,{children:`# ── Sandbox ───────────────────────────────────────────────────────
36
36
  SIMULATION_MODE=false
37
37
  SANDBOX_PROVIDER=docker